From 290b363d41f5be44a700705e73366f7872d08513 Mon Sep 17 00:00:00 2001 From: Ewout Kramer Date: Sat, 22 Feb 2025 10:37:03 +0100 Subject: [PATCH 1/6] Made property access use the private property instead of getter --- src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj | 1 + .../Model/Generated/Attachment.cs | 244 +++--- .../Model/Generated/BackboneElement.cs | 21 +- .../Model/Generated/BackboneType.cs | 21 +- src/Hl7.Fhir.Base/Model/Generated/Base.cs | 6 +- src/Hl7.Fhir.Base/Model/Generated/Binary.cs | 70 +- src/Hl7.Fhir.Base/Model/Generated/Bundle.cs | 483 +++++----- .../Model/Generated/CodeableConcept.cs | 38 +- .../Model/Generated/CodeableReference.cs | 29 +- src/Hl7.Fhir.Base/Model/Generated/Coding.cs | 94 +- .../Model/Generated/ContactDetail.cs | 38 +- .../Model/Generated/ContactPoint.cs | 87 +- src/Hl7.Fhir.Base/Model/Generated/DataType.cs | 9 +- .../Model/Generated/DomainResource.cs | 55 +- src/Hl7.Fhir.Base/Model/Generated/Element.cs | 38 +- .../Model/Generated/Extension.cs | 36 +- .../Model/Generated/Identifier.cs | 90 +- src/Hl7.Fhir.Base/Model/Generated/Meta.cs | 96 +- .../Model/Generated/Narrative.cs | 43 +- .../Model/Generated/OperationOutcome.cs | 115 +-- .../Model/Generated/Parameters.cs | 79 +- src/Hl7.Fhir.Base/Model/Generated/Period.cs | 43 +- .../Model/Generated/PrimitiveType.cs | 9 +- src/Hl7.Fhir.Base/Model/Generated/Quantity.cs | 94 +- src/Hl7.Fhir.Base/Model/Generated/Range.cs | 29 +- src/Hl7.Fhir.Base/Model/Generated/Resource.cs | 70 +- .../Model/Generated/ResourceReference.cs | 70 +- .../Model/Generated/Signature.cs | 143 ++- .../Model/Generated/UsageContext.cs | 29 +- .../Model/Generated/CapabilityStatement.cs | 824 +++++++----------- .../Model/Generated/CodeSystem.cs | 527 +++++------ .../Model/Generated/ElementDefinition.cs | 727 ++++++--------- .../Model/Generated/RelatedArtifact.cs | 105 +-- .../Model/Generated/StructureDefinition.cs | 351 +++----- .../Model/Generated/ValueSet.cs | 731 ++++++---------- 35 files changed, 2160 insertions(+), 3285 deletions(-) diff --git a/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj b/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj index 57492d3a4..29d2dab7f 100644 --- a/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj +++ b/src/Hl7.Fhir.Base/Hl7.Fhir.Base.csproj @@ -8,6 +8,7 @@ Firely's HL7 FHIR SDK Base Class Library Firely's HL7 FHIR SDK Base Class Library. Is a dependency for the FHIR release-specific NuGet packages and is usually not directly referenced. HL7;FHIR;Firely;SDK;BCL + Hl7.Fhir diff --git a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs index 868c078d6..8569e92d9 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs @@ -81,13 +81,10 @@ public Hl7.Fhir.Model.Code ContentTypeElement [IgnoreDataMember] public string ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -113,13 +110,10 @@ public Hl7.Fhir.Model.Code LanguageElement [IgnoreDataMember] public string Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -144,13 +138,10 @@ public Hl7.Fhir.Model.Base64Binary DataElement [IgnoreDataMember] public byte[] Data { - get { return DataElement != null ? DataElement.Value : null; } + get => _DataElement?.Value; set { - if (value == null) - DataElement = null; - else - DataElement = new Hl7.Fhir.Model.Base64Binary(value); + DataElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Data"); } } @@ -185,13 +176,10 @@ public Hl7.Fhir.Model.PrimitiveType UrlElement [IgnoreDataMember] public string UrlUri { - get { return UrlElement != null ? ((IValue)UrlElement).Value : null; } + get => ((IValue)_UrlElement)?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("UrlUri"); } } @@ -203,13 +191,10 @@ public string UrlUri [IgnoreDataMember] public string Url { - get { return UrlElement != null ? ((IValue)UrlElement).Value : null; } + get => ((IValue)_UrlElement)?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } @@ -244,13 +229,10 @@ public Hl7.Fhir.Model.PrimitiveType SizeElement [IgnoreDataMember] public int? SizeUnsignedInt { - get { return SizeElement != null ? ((Hl7.Fhir.Model.UnsignedInt)SizeElement).Value : null; } + get => ((Hl7.Fhir.Model.UnsignedInt)_SizeElement)?.Value; set { - if (value == null) - SizeElement = null; - else - SizeElement = new Hl7.Fhir.Model.UnsignedInt(value); + SizeElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("SizeUnsignedInt"); } } @@ -262,13 +244,10 @@ public int? SizeUnsignedInt [IgnoreDataMember] public long? Size { - get { return SizeElement != null ? ((Hl7.Fhir.Model.Integer64)SizeElement).Value : null; } + get => ((Hl7.Fhir.Model.Integer64)_SizeElement)?.Value; set { - if (value == null) - SizeElement = null; - else - SizeElement = new Hl7.Fhir.Model.Integer64(value); + SizeElement = value is null ? null : new Hl7.Fhir.Model.Integer64(value); OnPropertyChanged("Size"); } } @@ -293,13 +272,10 @@ public Hl7.Fhir.Model.Base64Binary HashElement [IgnoreDataMember] public byte[] Hash { - get { return HashElement != null ? HashElement.Value : null; } + get => _HashElement?.Value; set { - if (value == null) - HashElement = null; - else - HashElement = new Hl7.Fhir.Model.Base64Binary(value); + HashElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Hash"); } } @@ -324,13 +300,10 @@ public Hl7.Fhir.Model.FhirString TitleElement [IgnoreDataMember] public string Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -355,13 +328,10 @@ public Hl7.Fhir.Model.FhirDateTime CreationElement [IgnoreDataMember] public string Creation { - get { return CreationElement != null ? CreationElement.Value : null; } + get => _CreationElement?.Value; set { - if (value == null) - CreationElement = null; - else - CreationElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreationElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Creation"); } } @@ -389,13 +359,10 @@ public Hl7.Fhir.Model.PositiveInt HeightElement [IgnoreDataMember] public int? Height { - get { return HeightElement != null ? HeightElement.Value : null; } + get => _HeightElement?.Value; set { - if (value == null) - HeightElement = null; - else - HeightElement = new Hl7.Fhir.Model.PositiveInt(value); + HeightElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Height"); } } @@ -423,13 +390,10 @@ public Hl7.Fhir.Model.PositiveInt WidthElement [IgnoreDataMember] public int? Width { - get { return WidthElement != null ? WidthElement.Value : null; } + get => _WidthElement?.Value; set { - if (value == null) - WidthElement = null; - else - WidthElement = new Hl7.Fhir.Model.PositiveInt(value); + WidthElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Width"); } } @@ -457,13 +421,10 @@ public Hl7.Fhir.Model.PositiveInt FramesElement [IgnoreDataMember] public int? Frames { - get { return FramesElement != null ? FramesElement.Value : null; } + get => _FramesElement?.Value; set { - if (value == null) - FramesElement = null; - else - FramesElement = new Hl7.Fhir.Model.PositiveInt(value); + FramesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Frames"); } } @@ -491,13 +452,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement [IgnoreDataMember] public decimal? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Duration"); } } @@ -525,40 +483,33 @@ public Hl7.Fhir.Model.PositiveInt PagesElement [IgnoreDataMember] public int? Pages { - get { return PagesElement != null ? PagesElement.Value : null; } + get => _PagesElement?.Value; set { - if (value == null) - PagesElement = null; - else - PagesElement = new Hl7.Fhir.Model.PositiveInt(value); + PagesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Pages"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Attachment; - - if (dest == null) - { + if(other is not Attachment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.PrimitiveType)UrlElement.DeepCopyInternal(); - if(SizeElement != null) dest.SizeElement = (Hl7.Fhir.Model.PrimitiveType)SizeElement.DeepCopyInternal(); - if(HashElement != null) dest.HashElement = (Hl7.Fhir.Model.Base64Binary)HashElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(CreationElement != null) dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)CreationElement.DeepCopyInternal(); - if(HeightElement != null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)HeightElement.DeepCopyInternal(); - if(WidthElement != null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)WidthElement.DeepCopyInternal(); - if(FramesElement != null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)FramesElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal(); - if(PagesElement != null) dest.PagesElement = (Hl7.Fhir.Model.PositiveInt)PagesElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)_DataElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.PrimitiveType)_UrlElement.DeepCopyInternal(); + if(_SizeElement is not null) dest.SizeElement = (Hl7.Fhir.Model.PrimitiveType)_SizeElement.DeepCopyInternal(); + if(_HashElement is not null) dest.HashElement = (Hl7.Fhir.Model.Base64Binary)_HashElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_CreationElement is not null) dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)_CreationElement.DeepCopyInternal(); + if(_HeightElement is not null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)_HeightElement.DeepCopyInternal(); + if(_WidthElement is not null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)_WidthElement.DeepCopyInternal(); + if(_FramesElement is not null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)_FramesElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal(); + if(_PagesElement is not null) dest.PagesElement = (Hl7.Fhir.Model.PositiveInt)_PagesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -570,23 +521,22 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Attachment; - if(otherT == null) return false; + if(other is not Attachment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(DataElement, otherT.DataElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(SizeElement, otherT.SizeElement)) return false; - if(!comparer.Equals(HashElement, otherT.HashElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(CreationElement, otherT.CreationElement)) return false; - if(!comparer.Equals(HeightElement, otherT.HeightElement)) return false; - if(!comparer.Equals(WidthElement, otherT.WidthElement)) return false; - if(!comparer.Equals(FramesElement, otherT.FramesElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(PagesElement, otherT.PagesElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_SizeElement, otherT._SizeElement)) return false; + if(!comparer.Equals(_HashElement, otherT._HashElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_CreationElement, otherT._CreationElement)) return false; + if(!comparer.Equals(_HeightElement, otherT._HeightElement)) return false; + if(!comparer.Equals(_WidthElement, otherT._WidthElement)) return false; + if(!comparer.Equals(_FramesElement, otherT._FramesElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_PagesElement, otherT._PagesElement)) return false; return true; } @@ -596,44 +546,44 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "data": - value = DataElement; - return DataElement is not null; + value = _DataElement; + return _DataElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "size": - value = SizeElement; - return SizeElement is not null; + value = _SizeElement; + return _SizeElement is not null; case "hash": - value = HashElement; - return HashElement is not null; + value = _HashElement; + return _HashElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "creation": - value = CreationElement; - return CreationElement is not null; + value = _CreationElement; + return _CreationElement is not null; case "height": - value = HeightElement; - return HeightElement is not null; + value = _HeightElement; + return _HeightElement is not null; case "width": - value = WidthElement; - return WidthElement is not null; + value = _WidthElement; + return _WidthElement is not null; case "frames": - value = FramesElement; - return FramesElement is not null; + value = _FramesElement; + return _FramesElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "pages": - value = PagesElement; - return PagesElement is not null; + value = _PagesElement; + return _PagesElement is not null; default: return base.TryGetValue(key, out value); } @@ -692,19 +642,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (DataElement is not null) yield return new KeyValuePair("data",DataElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (SizeElement is not null) yield return new KeyValuePair("size",SizeElement); - if (HashElement is not null) yield return new KeyValuePair("hash",HashElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (CreationElement is not null) yield return new KeyValuePair("creation",CreationElement); - if (HeightElement is not null) yield return new KeyValuePair("height",HeightElement); - if (WidthElement is not null) yield return new KeyValuePair("width",WidthElement); - if (FramesElement is not null) yield return new KeyValuePair("frames",FramesElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (PagesElement is not null) yield return new KeyValuePair("pages",PagesElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_SizeElement is not null) yield return new KeyValuePair("size",_SizeElement); + if (_HashElement is not null) yield return new KeyValuePair("hash",_HashElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_CreationElement is not null) yield return new KeyValuePair("creation",_CreationElement); + if (_HeightElement is not null) yield return new KeyValuePair("height",_HeightElement); + if (_WidthElement is not null) yield return new KeyValuePair("width",_WidthElement); + if (_FramesElement is not null) yield return new KeyValuePair("frames",_FramesElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_PagesElement is not null) yield return new KeyValuePair("pages",_PagesElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs index 15ec37a82..f1fdd9c1f 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs @@ -62,7 +62,7 @@ public abstract partial class BackboneElement : Hl7.Fhir.Model.Element, Hl7.Fhir [DataMember] public List ModifierExtension { - get { if(_ModifierExtension==null) _ModifierExtension = new List(); return _ModifierExtension; } + get => _ModifierExtension ?? new List(); set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } @@ -70,24 +70,19 @@ public List ModifierExtension protected internal override void CopyToInternal(Base other) { - var dest = other as BackboneElement; - - if (dest == null) - { + if(other is not BackboneElement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModifierExtension.Any()) dest.ModifierExtension = new List(ModifierExtension.DeepCopyInternal()); + if(_ModifierExtension is not null) dest.ModifierExtension = new List(_ModifierExtension.DeepCopyInternal()); } public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BackboneElement; - if(otherT == null) return false; + if(other is not BackboneElement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ModifierExtension, otherT.ModifierExtension)) return false; + if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; return true; } @@ -97,8 +92,8 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "modifierExtension": - value = ModifierExtension; - return ModifierExtension?.Any() == true; + value = _ModifierExtension; + return _ModifierExtension?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -121,7 +116,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",ModifierExtension); + if (_ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",_ModifierExtension); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs index fea1afd05..4e828cc54 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs @@ -62,7 +62,7 @@ public abstract partial class BackboneType : Hl7.Fhir.Model.DataType, Hl7.Fhir.M [DataMember] public List ModifierExtension { - get { if(_ModifierExtension==null) _ModifierExtension = new List(); return _ModifierExtension; } + get => _ModifierExtension ?? new List(); set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } @@ -70,24 +70,19 @@ public List ModifierExtension protected internal override void CopyToInternal(Base other) { - var dest = other as BackboneType; - - if (dest == null) - { + if(other is not BackboneType dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModifierExtension.Any()) dest.ModifierExtension = new List(ModifierExtension.DeepCopyInternal()); + if(_ModifierExtension is not null) dest.ModifierExtension = new List(_ModifierExtension.DeepCopyInternal()); } public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BackboneType; - if(otherT == null) return false; + if(other is not BackboneType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ModifierExtension, otherT.ModifierExtension)) return false; + if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; return true; } @@ -97,8 +92,8 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "modifierExtension": - value = ModifierExtension; - return ModifierExtension?.Any() == true; + value = _ModifierExtension; + return _ModifierExtension?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -121,7 +116,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",ModifierExtension); + if (_ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",_ModifierExtension); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Base.cs b/src/Hl7.Fhir.Base/Model/Generated/Base.cs index 6ebbce7f1..d47779718 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Base.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Base.cs @@ -56,12 +56,8 @@ public abstract partial class Base { protected internal virtual void CopyToInternal(Base other) { - var dest = other as Base; - - if (dest == null) - { + if(other is not Base dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } if (_annotations is not null) dest.annotations.AddRange(annotations); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs index 74db8051e..3c7bfda39 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs @@ -85,13 +85,10 @@ public Hl7.Fhir.Model.Code ContentTypeElement [IgnoreDataMember] public string ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -135,13 +132,10 @@ public Hl7.Fhir.Model.Base64Binary ContentElement [IgnoreDataMember] public byte[] Content { - get { return ContentElement != null ? ContentElement.Value : null; } + get => _ContentElement?.Value; set { - if (value == null) - ContentElement = null; - else - ContentElement = new Hl7.Fhir.Model.Base64Binary(value); + ContentElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Content"); } } @@ -169,31 +163,24 @@ public Hl7.Fhir.Model.Base64Binary DataElement [IgnoreDataMember] public byte[] Data { - get { return DataElement != null ? DataElement.Value : null; } + get => _DataElement?.Value; set { - if (value == null) - DataElement = null; - else - DataElement = new Hl7.Fhir.Model.Base64Binary(value); + DataElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Data"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Binary; - - if (dest == null) - { + if(other is not Binary dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(SecurityContext != null) dest.SecurityContext = (Hl7.Fhir.Model.ResourceReference)SecurityContext.DeepCopyInternal(); - if(ContentElement != null) dest.ContentElement = (Hl7.Fhir.Model.Base64Binary)ContentElement.DeepCopyInternal(); - if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_SecurityContext is not null) dest.SecurityContext = (Hl7.Fhir.Model.ResourceReference)_SecurityContext.DeepCopyInternal(); + if(_ContentElement is not null) dest.ContentElement = (Hl7.Fhir.Model.Base64Binary)_ContentElement.DeepCopyInternal(); + if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)_DataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -205,14 +192,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Binary; - if(otherT == null) return false; + if(other is not Binary otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(SecurityContext, otherT.SecurityContext)) return false; - if(!comparer.Equals(ContentElement, otherT.ContentElement)) return false; - if(!comparer.Equals(DataElement, otherT.DataElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_SecurityContext, otherT._SecurityContext)) return false; + if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; + if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; return true; } @@ -222,17 +208,17 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "securityContext": - value = SecurityContext; - return SecurityContext is not null; + value = _SecurityContext; + return _SecurityContext is not null; case "content": - value = ContentElement; - return ContentElement is not null; + value = _ContentElement; + return _ContentElement is not null; case "data": - value = DataElement; - return DataElement is not null; + value = _DataElement; + return _DataElement is not null; default: return base.TryGetValue(key, out value); } @@ -264,10 +250,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (SecurityContext is not null) yield return new KeyValuePair("securityContext",SecurityContext); - if (ContentElement is not null) yield return new KeyValuePair("content",ContentElement); - if (DataElement is not null) yield return new KeyValuePair("data",DataElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_SecurityContext is not null) yield return new KeyValuePair("securityContext",_SecurityContext); + if (_ContentElement is not null) yield return new KeyValuePair("content",_ContentElement); + if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs index d2d5e9128..b9b442433 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs @@ -984,13 +984,10 @@ public Hl7.Fhir.Model.PrimitiveType RelationElement [IgnoreDataMember] public string RelationString { - get { return RelationElement != null ? ((IValue)RelationElement).Value : null; } + get => ((IValue)_RelationElement)?.Value; set { - if (value == null) - RelationElement = null; - else - RelationElement = new Hl7.Fhir.Model.FhirString(value); + RelationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RelationString"); } } @@ -1002,13 +999,10 @@ public string RelationString [IgnoreDataMember] public string Relation { - get { return RelationElement != null ? ((IValue)RelationElement).Value : null; } + get => ((IValue)_RelationElement)?.Value; set { - if (value == null) - RelationElement = null; - else - RelationElement = new Hl7.Fhir.Model.Code(value); + RelationElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Relation"); } } @@ -1034,29 +1028,22 @@ public Hl7.Fhir.Model.FhirUri UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RelationElement != null) dest.RelationElement = (Hl7.Fhir.Model.PrimitiveType)RelationElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); + if(_RelationElement is not null) dest.RelationElement = (Hl7.Fhir.Model.PrimitiveType)_RelationElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1068,12 +1055,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RelationElement, otherT.RelationElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + if(!comparer.Equals(_RelationElement, otherT._RelationElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; return true; } @@ -1083,11 +1069,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "relation": - value = RelationElement; - return RelationElement is not null; + value = _RelationElement; + return _RelationElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } @@ -1113,8 +1099,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RelationElement is not null) yield return new KeyValuePair("relation",RelationElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_RelationElement is not null) yield return new KeyValuePair("relation",_RelationElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -1143,7 +1129,7 @@ public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } @@ -1169,13 +1155,10 @@ public Hl7.Fhir.Model.FhirUri FullUrlElement [IgnoreDataMember] public string FullUrl { - get { return FullUrlElement != null ? FullUrlElement.Value : null; } + get => _FullUrlElement?.Value; set { - if (value == null) - FullUrlElement = null; - else - FullUrlElement = new Hl7.Fhir.Model.FhirUri(value); + FullUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("FullUrl"); } } @@ -1236,20 +1219,16 @@ public Hl7.Fhir.Model.Bundle.ResponseComponent Response protected internal override void CopyToInternal(Base other) { - var dest = other as EntryComponent; - - if (dest == null) - { + if(other is not EntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); - if(FullUrlElement != null) dest.FullUrlElement = (Hl7.Fhir.Model.FhirUri)FullUrlElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.Resource)Resource.DeepCopyInternal(); - if(Search != null) dest.Search = (Hl7.Fhir.Model.Bundle.SearchComponent)Search.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.Bundle.RequestComponent)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.Bundle.ResponseComponent)Response.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); + if(_FullUrlElement is not null) dest.FullUrlElement = (Hl7.Fhir.Model.FhirUri)_FullUrlElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.Resource)_Resource.DeepCopyInternal(); + if(_Search is not null) dest.Search = (Hl7.Fhir.Model.Bundle.SearchComponent)_Search.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.Bundle.RequestComponent)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.Bundle.ResponseComponent)_Response.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1261,16 +1240,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntryComponent; - if(otherT == null) return false; + if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; - if(!comparer.Equals(FullUrlElement, otherT.FullUrlElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.Equals(Search, otherT.Search)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; + if(!comparer.Equals(_FullUrlElement, otherT._FullUrlElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.Equals(_Search, otherT._Search)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; return true; } @@ -1280,23 +1258,23 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; case "fullUrl": - value = FullUrlElement; - return FullUrlElement is not null; + value = _FullUrlElement; + return _FullUrlElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "search": - value = Search; - return Search is not null; + value = _Search; + return _Search is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; default: return base.TryGetValue(key, out value); } @@ -1334,12 +1312,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); - if (FullUrlElement is not null) yield return new KeyValuePair("fullUrl",FullUrlElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Search is not null) yield return new KeyValuePair("search",Search); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); + if (_FullUrlElement is not null) yield return new KeyValuePair("fullUrl",_FullUrlElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Search is not null) yield return new KeyValuePair("search",_Search); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); } } @@ -1382,13 +1360,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.Bundle.SearchEntryMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -1413,29 +1388,22 @@ public Hl7.Fhir.Model.FhirDecimal ScoreElement [IgnoreDataMember] public decimal? Score { - get { return ScoreElement != null ? ScoreElement.Value : null; } + get => _ScoreElement?.Value; set { - if (value == null) - ScoreElement = null; - else - ScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + ScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Score"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SearchComponent; - - if (dest == null) - { + if(other is not SearchComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(ScoreElement != null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)ScoreElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_ScoreElement is not null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)_ScoreElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1447,12 +1415,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SearchComponent; - if(otherT == null) return false; + if(other is not SearchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(ScoreElement, otherT.ScoreElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false; return true; } @@ -1462,11 +1429,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "score": - value = ScoreElement; - return ScoreElement is not null; + value = _ScoreElement; + return _ScoreElement is not null; default: return base.TryGetValue(key, out value); } @@ -1492,8 +1459,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (ScoreElement is not null) yield return new KeyValuePair("score",ScoreElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_ScoreElement is not null) yield return new KeyValuePair("score",_ScoreElement); } } @@ -1537,13 +1504,10 @@ public Code MethodElement [IgnoreDataMember] public Hl7.Fhir.Model.Bundle.HTTPVerb? Method { - get { return MethodElement != null ? MethodElement.Value : null; } + get => _MethodElement?.Value; set { - if (value == null) - MethodElement = null; - else - MethodElement = new Code(value); + MethodElement = value is null ? null : new Code(value); OnPropertyChanged("Method"); } } @@ -1569,13 +1533,10 @@ public Hl7.Fhir.Model.FhirUri UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1600,13 +1561,10 @@ public Hl7.Fhir.Model.FhirString IfNoneMatchElement [IgnoreDataMember] public string IfNoneMatch { - get { return IfNoneMatchElement != null ? IfNoneMatchElement.Value : null; } + get => _IfNoneMatchElement?.Value; set { - if (value == null) - IfNoneMatchElement = null; - else - IfNoneMatchElement = new Hl7.Fhir.Model.FhirString(value); + IfNoneMatchElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IfNoneMatch"); } } @@ -1631,13 +1589,10 @@ public Hl7.Fhir.Model.Instant IfModifiedSinceElement [IgnoreDataMember] public DateTimeOffset? IfModifiedSince { - get { return IfModifiedSinceElement != null ? IfModifiedSinceElement.Value : null; } + get => _IfModifiedSinceElement?.Value; set { - if (value == null) - IfModifiedSinceElement = null; - else - IfModifiedSinceElement = new Hl7.Fhir.Model.Instant(value); + IfModifiedSinceElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("IfModifiedSince"); } } @@ -1662,13 +1617,10 @@ public Hl7.Fhir.Model.FhirString IfMatchElement [IgnoreDataMember] public string IfMatch { - get { return IfMatchElement != null ? IfMatchElement.Value : null; } + get => _IfMatchElement?.Value; set { - if (value == null) - IfMatchElement = null; - else - IfMatchElement = new Hl7.Fhir.Model.FhirString(value); + IfMatchElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IfMatch"); } } @@ -1693,33 +1645,26 @@ public Hl7.Fhir.Model.FhirString IfNoneExistElement [IgnoreDataMember] public string IfNoneExist { - get { return IfNoneExistElement != null ? IfNoneExistElement.Value : null; } + get => _IfNoneExistElement?.Value; set { - if (value == null) - IfNoneExistElement = null; - else - IfNoneExistElement = new Hl7.Fhir.Model.FhirString(value); + IfNoneExistElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IfNoneExist"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestComponent; - - if (dest == null) - { + if(other is not RequestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MethodElement != null) dest.MethodElement = (Code)MethodElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(IfNoneMatchElement != null) dest.IfNoneMatchElement = (Hl7.Fhir.Model.FhirString)IfNoneMatchElement.DeepCopyInternal(); - if(IfModifiedSinceElement != null) dest.IfModifiedSinceElement = (Hl7.Fhir.Model.Instant)IfModifiedSinceElement.DeepCopyInternal(); - if(IfMatchElement != null) dest.IfMatchElement = (Hl7.Fhir.Model.FhirString)IfMatchElement.DeepCopyInternal(); - if(IfNoneExistElement != null) dest.IfNoneExistElement = (Hl7.Fhir.Model.FhirString)IfNoneExistElement.DeepCopyInternal(); + if(_MethodElement is not null) dest.MethodElement = (Code)_MethodElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_IfNoneMatchElement is not null) dest.IfNoneMatchElement = (Hl7.Fhir.Model.FhirString)_IfNoneMatchElement.DeepCopyInternal(); + if(_IfModifiedSinceElement is not null) dest.IfModifiedSinceElement = (Hl7.Fhir.Model.Instant)_IfModifiedSinceElement.DeepCopyInternal(); + if(_IfMatchElement is not null) dest.IfMatchElement = (Hl7.Fhir.Model.FhirString)_IfMatchElement.DeepCopyInternal(); + if(_IfNoneExistElement is not null) dest.IfNoneExistElement = (Hl7.Fhir.Model.FhirString)_IfNoneExistElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1731,16 +1676,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestComponent; - if(otherT == null) return false; + if(other is not RequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MethodElement, otherT.MethodElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(IfNoneMatchElement, otherT.IfNoneMatchElement)) return false; - if(!comparer.Equals(IfModifiedSinceElement, otherT.IfModifiedSinceElement)) return false; - if(!comparer.Equals(IfMatchElement, otherT.IfMatchElement)) return false; - if(!comparer.Equals(IfNoneExistElement, otherT.IfNoneExistElement)) return false; + if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_IfNoneMatchElement, otherT._IfNoneMatchElement)) return false; + if(!comparer.Equals(_IfModifiedSinceElement, otherT._IfModifiedSinceElement)) return false; + if(!comparer.Equals(_IfMatchElement, otherT._IfMatchElement)) return false; + if(!comparer.Equals(_IfNoneExistElement, otherT._IfNoneExistElement)) return false; return true; } @@ -1750,23 +1694,23 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "method": - value = MethodElement; - return MethodElement is not null; + value = _MethodElement; + return _MethodElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "ifNoneMatch": - value = IfNoneMatchElement; - return IfNoneMatchElement is not null; + value = _IfNoneMatchElement; + return _IfNoneMatchElement is not null; case "ifModifiedSince": - value = IfModifiedSinceElement; - return IfModifiedSinceElement is not null; + value = _IfModifiedSinceElement; + return _IfModifiedSinceElement is not null; case "ifMatch": - value = IfMatchElement; - return IfMatchElement is not null; + value = _IfMatchElement; + return _IfMatchElement is not null; case "ifNoneExist": - value = IfNoneExistElement; - return IfNoneExistElement is not null; + value = _IfNoneExistElement; + return _IfNoneExistElement is not null; default: return base.TryGetValue(key, out value); } @@ -1804,12 +1748,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MethodElement is not null) yield return new KeyValuePair("method",MethodElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (IfNoneMatchElement is not null) yield return new KeyValuePair("ifNoneMatch",IfNoneMatchElement); - if (IfModifiedSinceElement is not null) yield return new KeyValuePair("ifModifiedSince",IfModifiedSinceElement); - if (IfMatchElement is not null) yield return new KeyValuePair("ifMatch",IfMatchElement); - if (IfNoneExistElement is not null) yield return new KeyValuePair("ifNoneExist",IfNoneExistElement); + if (_MethodElement is not null) yield return new KeyValuePair("method",_MethodElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_IfNoneMatchElement is not null) yield return new KeyValuePair("ifNoneMatch",_IfNoneMatchElement); + if (_IfModifiedSinceElement is not null) yield return new KeyValuePair("ifModifiedSince",_IfModifiedSinceElement); + if (_IfMatchElement is not null) yield return new KeyValuePair("ifMatch",_IfMatchElement); + if (_IfNoneExistElement is not null) yield return new KeyValuePair("ifNoneExist",_IfNoneExistElement); } } @@ -1851,13 +1795,10 @@ public Hl7.Fhir.Model.FhirString StatusElement [IgnoreDataMember] public string Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Hl7.Fhir.Model.FhirString(value); + StatusElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Status"); } } @@ -1882,13 +1823,10 @@ public Hl7.Fhir.Model.FhirUri LocationElement [IgnoreDataMember] public string Location { - get { return LocationElement != null ? LocationElement.Value : null; } + get => _LocationElement?.Value; set { - if (value == null) - LocationElement = null; - else - LocationElement = new Hl7.Fhir.Model.FhirUri(value); + LocationElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Location"); } } @@ -1913,13 +1851,10 @@ public Hl7.Fhir.Model.FhirString EtagElement [IgnoreDataMember] public string Etag { - get { return EtagElement != null ? EtagElement.Value : null; } + get => _EtagElement?.Value; set { - if (value == null) - EtagElement = null; - else - EtagElement = new Hl7.Fhir.Model.FhirString(value); + EtagElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Etag"); } } @@ -1944,13 +1879,10 @@ public Hl7.Fhir.Model.Instant LastModifiedElement [IgnoreDataMember] public DateTimeOffset? LastModified { - get { return LastModifiedElement != null ? LastModifiedElement.Value : null; } + get => _LastModifiedElement?.Value; set { - if (value == null) - LastModifiedElement = null; - else - LastModifiedElement = new Hl7.Fhir.Model.Instant(value); + LastModifiedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("LastModified"); } } @@ -1972,19 +1904,15 @@ public Hl7.Fhir.Model.Resource Outcome protected internal override void CopyToInternal(Base other) { - var dest = other as ResponseComponent; - - if (dest == null) - { + if(other is not ResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Hl7.Fhir.Model.FhirString)StatusElement.DeepCopyInternal(); - if(LocationElement != null) dest.LocationElement = (Hl7.Fhir.Model.FhirUri)LocationElement.DeepCopyInternal(); - if(EtagElement != null) dest.EtagElement = (Hl7.Fhir.Model.FhirString)EtagElement.DeepCopyInternal(); - if(LastModifiedElement != null) dest.LastModifiedElement = (Hl7.Fhir.Model.Instant)LastModifiedElement.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.Resource)Outcome.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Hl7.Fhir.Model.FhirString)_StatusElement.DeepCopyInternal(); + if(_LocationElement is not null) dest.LocationElement = (Hl7.Fhir.Model.FhirUri)_LocationElement.DeepCopyInternal(); + if(_EtagElement is not null) dest.EtagElement = (Hl7.Fhir.Model.FhirString)_EtagElement.DeepCopyInternal(); + if(_LastModifiedElement is not null) dest.LastModifiedElement = (Hl7.Fhir.Model.Instant)_LastModifiedElement.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.Resource)_Outcome.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1996,15 +1924,14 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResponseComponent; - if(otherT == null) return false; + if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(LocationElement, otherT.LocationElement)) return false; - if(!comparer.Equals(EtagElement, otherT.EtagElement)) return false; - if(!comparer.Equals(LastModifiedElement, otherT.LastModifiedElement)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_LocationElement, otherT._LocationElement)) return false; + if(!comparer.Equals(_EtagElement, otherT._EtagElement)) return false; + if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; return true; } @@ -2014,20 +1941,20 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "location": - value = LocationElement; - return LocationElement is not null; + value = _LocationElement; + return _LocationElement is not null; case "etag": - value = EtagElement; - return EtagElement is not null; + value = _EtagElement; + return _EtagElement is not null; case "lastModified": - value = LastModifiedElement; - return LastModifiedElement is not null; + value = _LastModifiedElement; + return _LastModifiedElement is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; default: return base.TryGetValue(key, out value); } @@ -2062,11 +1989,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (LocationElement is not null) yield return new KeyValuePair("location",LocationElement); - if (EtagElement is not null) yield return new KeyValuePair("etag",EtagElement); - if (LastModifiedElement is not null) yield return new KeyValuePair("lastModified",LastModifiedElement); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_LocationElement is not null) yield return new KeyValuePair("location",_LocationElement); + if (_EtagElement is not null) yield return new KeyValuePair("etag",_EtagElement); + if (_LastModifiedElement is not null) yield return new KeyValuePair("lastModified",_LastModifiedElement); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); } } @@ -2107,13 +2034,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Bundle.BundleType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2141,13 +2065,10 @@ public Hl7.Fhir.Model.Instant TimestampElement [IgnoreDataMember] public DateTimeOffset? Timestamp { - get { return TimestampElement != null ? TimestampElement.Value : null; } + get => _TimestampElement?.Value; set { - if (value == null) - TimestampElement = null; - else - TimestampElement = new Hl7.Fhir.Model.Instant(value); + TimestampElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Timestamp"); } } @@ -2172,13 +2093,10 @@ public Hl7.Fhir.Model.UnsignedInt TotalElement [IgnoreDataMember] public int? Total { - get { return TotalElement != null ? TotalElement.Value : null; } + get => _TotalElement?.Value; set { - if (value == null) - TotalElement = null; - else - TotalElement = new Hl7.Fhir.Model.UnsignedInt(value); + TotalElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Total"); } } @@ -2191,7 +2109,7 @@ public int? Total [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } @@ -2205,7 +2123,7 @@ public List Link [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } @@ -2246,22 +2164,18 @@ public Hl7.Fhir.Model.Resource Issues protected internal override void CopyToInternal(Base other) { - var dest = other as Bundle; - - if (dest == null) - { + if(other is not Bundle dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TimestampElement != null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)TimestampElement.DeepCopyInternal(); - if(TotalElement != null) dest.TotalElement = (Hl7.Fhir.Model.UnsignedInt)TotalElement.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(Signature != null) dest.Signature = (Hl7.Fhir.Model.Signature)Signature.DeepCopyInternal(); - if(Issues != null) dest.Issues = (Hl7.Fhir.Model.Resource)Issues.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TimestampElement is not null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)_TimestampElement.DeepCopyInternal(); + if(_TotalElement is not null) dest.TotalElement = (Hl7.Fhir.Model.UnsignedInt)_TotalElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_Signature is not null) dest.Signature = (Hl7.Fhir.Model.Signature)_Signature.DeepCopyInternal(); + if(_Issues is not null) dest.Issues = (Hl7.Fhir.Model.Resource)_Issues.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2273,18 +2187,17 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Bundle; - if(otherT == null) return false; + if(other is not Bundle otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TimestampElement, otherT.TimestampElement)) return false; - if(!comparer.Equals(TotalElement, otherT.TotalElement)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(Signature, otherT.Signature)) return false; - if(!comparer.Equals(Issues, otherT.Issues)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; + if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_Signature, otherT._Signature)) return false; + if(!comparer.Equals(_Issues, otherT._Issues)) return false; return true; } @@ -2294,29 +2207,29 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "timestamp": - value = TimestampElement; - return TimestampElement is not null; + value = _TimestampElement; + return _TimestampElement is not null; case "total": - value = TotalElement; - return TotalElement is not null; + value = _TotalElement; + return _TotalElement is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "signature": - value = Signature; - return Signature is not null; + value = _Signature; + return _Signature is not null; case "issues": - value = Issues; - return Issues is not null; + value = _Issues; + return _Issues is not null; default: return base.TryGetValue(key, out value); } @@ -2360,14 +2273,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TimestampElement is not null) yield return new KeyValuePair("timestamp",TimestampElement); - if (TotalElement is not null) yield return new KeyValuePair("total",TotalElement); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (Signature is not null) yield return new KeyValuePair("signature",Signature); - if (Issues is not null) yield return new KeyValuePair("issues",Issues); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TimestampElement is not null) yield return new KeyValuePair("timestamp",_TimestampElement); + if (_TotalElement is not null) yield return new KeyValuePair("total",_TotalElement); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_Signature is not null) yield return new KeyValuePair("signature",_Signature); + if (_Issues is not null) yield return new KeyValuePair("issues",_Issues); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs index dab9d114e..236a2c583 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs @@ -68,7 +68,7 @@ public partial class CodeableConcept : Hl7.Fhir.Model.DataType [DataMember] public List Coding { - get { if(_Coding==null) _Coding = new List(); return _Coding; } + get => _Coding ?? new List(); set { _Coding = value; OnPropertyChanged("Coding"); } } @@ -94,29 +94,22 @@ public Hl7.Fhir.Model.FhirString TextElement [IgnoreDataMember] public string Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CodeableConcept; - - if (dest == null) - { + if(other is not CodeableConcept dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coding.Any()) dest.Coding = new List(Coding.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Coding is not null) dest.Coding = new List(_Coding.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -128,12 +121,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeableConcept; - if(otherT == null) return false; + if(other is not CodeableConcept otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Coding, otherT.Coding)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + if(!comparer.ListEquals(_Coding, otherT._Coding)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; return true; } @@ -143,11 +135,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "coding": - value = Coding; - return Coding?.Any() == true; + value = _Coding; + return _Coding?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } @@ -173,8 +165,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coding?.Any() == true) yield return new KeyValuePair("coding",Coding); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Coding?.Any() == true) yield return new KeyValuePair("coding",_Coding); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs index 05dd1da8a..23711fbe0 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs @@ -87,16 +87,12 @@ public Hl7.Fhir.Model.ResourceReference Reference protected internal override void CopyToInternal(Base other) { - var dest = other as CodeableReference; - - if (dest == null) - { + if(other is not CodeableReference dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Concept != null) dest.Concept = (Hl7.Fhir.Model.CodeableConcept)Concept.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Concept is not null) dest.Concept = (Hl7.Fhir.Model.CodeableConcept)_Concept.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -108,12 +104,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeableReference; - if(otherT == null) return false; + if(other is not CodeableReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Concept, otherT.Concept)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + if(!comparer.Equals(_Concept, otherT._Concept)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; return true; } @@ -123,11 +118,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "concept": - value = Concept; - return Concept is not null; + value = _Concept; + return _Concept is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } @@ -153,8 +148,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Concept is not null) yield return new KeyValuePair("concept",Concept); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Concept is not null) yield return new KeyValuePair("concept",_Concept); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs index 7466b0f9e..b8963b147 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs @@ -79,13 +79,10 @@ public Hl7.Fhir.Model.FhirUri SystemElement [IgnoreDataMember] public string System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -110,13 +107,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -141,13 +135,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -172,13 +163,10 @@ public Hl7.Fhir.Model.FhirString DisplayElement [IgnoreDataMember] public string Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -203,32 +191,25 @@ public Hl7.Fhir.Model.FhirBoolean UserSelectedElement [IgnoreDataMember] public bool? UserSelected { - get { return UserSelectedElement != null ? UserSelectedElement.Value : null; } + get => _UserSelectedElement?.Value; set { - if (value == null) - UserSelectedElement = null; - else - UserSelectedElement = new Hl7.Fhir.Model.FhirBoolean(value); + UserSelectedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("UserSelected"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Coding; - - if (dest == null) - { + if(other is not Coding dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(UserSelectedElement != null) dest.UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean)UserSelectedElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_UserSelectedElement is not null) dest.UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean)_UserSelectedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -240,15 +221,14 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Coding; - if(otherT == null) return false; + if(other is not Coding otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(UserSelectedElement, otherT.UserSelectedElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_UserSelectedElement, otherT._UserSelectedElement)) return false; return true; } @@ -258,20 +238,20 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "userSelected": - value = UserSelectedElement; - return UserSelectedElement is not null; + value = _UserSelectedElement; + return _UserSelectedElement is not null; default: return base.TryGetValue(key, out value); } @@ -306,11 +286,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (UserSelectedElement is not null) yield return new KeyValuePair("userSelected",UserSelectedElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_UserSelectedElement is not null) yield return new KeyValuePair("userSelected",_UserSelectedElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs index 5bccaba8b..a971dd9cd 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs @@ -79,13 +79,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -98,7 +95,7 @@ public string Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -106,16 +103,12 @@ public List Telecom protected internal override void CopyToInternal(Base other) { - var dest = other as ContactDetail; - - if (dest == null) - { + if(other is not ContactDetail dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -127,12 +120,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactDetail; - if(otherT == null) return false; + if(other is not ContactDetail otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; return true; } @@ -142,11 +134,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -172,8 +164,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs index 0e145ac89..a928a7759 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs @@ -173,13 +173,10 @@ public Code SystemElement [IgnoreDataMember] public Hl7.Fhir.Model.ContactPoint.ContactPointSystem? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Code(value); + SystemElement = value is null ? null : new Code(value); OnPropertyChanged("System"); } } @@ -204,13 +201,10 @@ public Hl7.Fhir.Model.FhirString ValueElement [IgnoreDataMember] public string Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -237,13 +231,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ContactPoint.ContactPointUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -268,13 +259,10 @@ public Hl7.Fhir.Model.PositiveInt RankElement [IgnoreDataMember] public int? Rank { - get { return RankElement != null ? RankElement.Value : null; } + get => _RankElement?.Value; set { - if (value == null) - RankElement = null; - else - RankElement = new Hl7.Fhir.Model.PositiveInt(value); + RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Rank"); } } @@ -294,19 +282,15 @@ public Hl7.Fhir.Model.Period Period protected internal override void CopyToInternal(Base other) { - var dest = other as ContactPoint; - - if (dest == null) - { + if(other is not ContactPoint dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Code)SystemElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Code)_SystemElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -318,15 +302,14 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactPoint; - if(otherT == null) return false; + if(other is not ContactPoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(RankElement, otherT.RankElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; return true; } @@ -336,20 +319,20 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "rank": - value = RankElement; - return RankElement is not null; + value = _RankElement; + return _RankElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } @@ -384,11 +367,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (RankElement is not null) yield return new KeyValuePair("rank",RankElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs index 26b0a62e0..e259edae5 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs @@ -56,20 +56,15 @@ public abstract partial class DataType : Hl7.Fhir.Model.Element { protected internal override void CopyToInternal(Base other) { - var dest = other as DataType; - - if (dest == null) - { + if(other is not DataType dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); } public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataType; - if(otherT == null) return false; + if(other is not DataType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; diff --git a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs index b50e9962a..7ae7bcb77 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs @@ -77,7 +77,7 @@ public Hl7.Fhir.Model.Narrative Text [DataMember] public List Contained { - get { if(_Contained==null) _Contained = new List(); return _Contained; } + get => _Contained ?? new List(); set { _Contained = value; OnPropertyChanged("Contained"); } } @@ -91,7 +91,7 @@ public List Contained [DataMember] public List Extension { - get { if(_Extension==null) _Extension = new List(); return _Extension; } + get => _Extension ?? new List(); set { _Extension = value; OnPropertyChanged("Extension"); } } @@ -105,7 +105,7 @@ public List Extension [DataMember] public List ModifierExtension { - get { if(_ModifierExtension==null) _ModifierExtension = new List(); return _ModifierExtension; } + get => _ModifierExtension ?? new List(); set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } @@ -113,30 +113,25 @@ public List ModifierExtension protected internal override void CopyToInternal(Base other) { - var dest = other as DomainResource; - - if (dest == null) - { + if(other is not DomainResource dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal(); - if(Contained.Any()) dest.Contained = new List(Contained.DeepCopyInternal()); - if(Extension.Any()) dest.Extension = new List(Extension.DeepCopyInternal()); - if(ModifierExtension.Any()) dest.ModifierExtension = new List(ModifierExtension.DeepCopyInternal()); + if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal(); + if(_Contained is not null) dest.Contained = new List(_Contained.DeepCopyInternal()); + if(_Extension is not null) dest.Extension = new List(_Extension.DeepCopyInternal()); + if(_ModifierExtension is not null) dest.ModifierExtension = new List(_ModifierExtension.DeepCopyInternal()); } public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DomainResource; - if(otherT == null) return false; + if(other is not DomainResource otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Text, otherT.Text)) return false; - if(!comparer.ListEquals(Contained, otherT.Contained)) return false; - if(!comparer.ListEquals(Extension, otherT.Extension)) return false; - if(!comparer.ListEquals(ModifierExtension, otherT.ModifierExtension)) return false; + if(!comparer.Equals(_Text, otherT._Text)) return false; + if(!comparer.ListEquals(_Contained, otherT._Contained)) return false; + if(!comparer.ListEquals(_Extension, otherT._Extension)) return false; + if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; return true; } @@ -146,17 +141,17 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "text": - value = Text; - return Text is not null; + value = _Text; + return _Text is not null; case "contained": - value = Contained; - return Contained?.Any() == true; + value = _Contained; + return _Contained?.Any() == true; case "extension": - value = Extension; - return Extension?.Any() == true; + value = _Extension; + return _Extension?.Any() == true; case "modifierExtension": - value = ModifierExtension; - return ModifierExtension?.Any() == true; + value = _ModifierExtension; + return _ModifierExtension?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -188,10 +183,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Text is not null) yield return new KeyValuePair("text",Text); - if (Contained?.Any() == true) yield return new KeyValuePair("contained",Contained); - if (Extension?.Any() == true) yield return new KeyValuePair("extension",Extension); - if (ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",ModifierExtension); + if (_Text is not null) yield return new KeyValuePair("text",_Text); + if (_Contained?.Any() == true) yield return new KeyValuePair("contained",_Contained); + if (_Extension?.Any() == true) yield return new KeyValuePair("extension",_Extension); + if (_ModifierExtension?.Any() == true) yield return new KeyValuePair("modifierExtension",_ModifierExtension); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Element.cs b/src/Hl7.Fhir.Base/Model/Generated/Element.cs index b78679690..dac572621 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Element.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Element.cs @@ -74,13 +74,10 @@ public Hl7.Fhir.Model.FhirString ElementIdElement [IgnoreDataMember] public string ElementId { - get { return ElementIdElement != null ? ElementIdElement.Value : null; } + get => _ElementIdElement?.Value; set { - if (value == null) - ElementIdElement = null; - else - ElementIdElement = new Hl7.Fhir.Model.FhirString(value); + ElementIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ElementId"); } } @@ -93,7 +90,7 @@ public string ElementId [DataMember] public List Extension { - get { if(_Extension==null) _Extension = new List(); return _Extension; } + get => _Extension ?? new List(); set { _Extension = value; OnPropertyChanged("Extension"); } } @@ -101,26 +98,21 @@ public List Extension protected internal override void CopyToInternal(Base other) { - var dest = other as Element; - - if (dest == null) - { + if(other is not Element dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ElementIdElement != null) dest.ElementIdElement = (Hl7.Fhir.Model.FhirString)ElementIdElement.DeepCopyInternal(); - if(Extension.Any()) dest.Extension = new List(Extension.DeepCopyInternal()); + if(_ElementIdElement is not null) dest.ElementIdElement = (Hl7.Fhir.Model.FhirString)_ElementIdElement.DeepCopyInternal(); + if(_Extension is not null) dest.Extension = new List(_Extension.DeepCopyInternal()); } public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Element; - if(otherT == null) return false; + if(other is not Element otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ElementIdElement, otherT.ElementIdElement)) return false; - if(!comparer.ListEquals(Extension, otherT.Extension)) return false; + if(!comparer.Equals(_ElementIdElement, otherT._ElementIdElement)) return false; + if(!comparer.ListEquals(_Extension, otherT._Extension)) return false; return true; } @@ -130,11 +122,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "id": - value = ElementIdElement; - return ElementIdElement is not null; + value = _ElementIdElement; + return _ElementIdElement is not null; case "extension": - value = Extension; - return Extension?.Any() == true; + value = _Extension; + return _Extension?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -160,8 +152,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ElementIdElement is not null) yield return new KeyValuePair("id",ElementIdElement); - if (Extension?.Any() == true) yield return new KeyValuePair("extension",Extension); + if (_ElementIdElement is not null) yield return new KeyValuePair("id",_ElementIdElement); + if (_Extension?.Any() == true) yield return new KeyValuePair("extension",_Extension); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs index c0deb9841..15ffc66ae 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs @@ -80,13 +80,10 @@ public Hl7.Fhir.Model.FhirUri UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -106,16 +103,12 @@ public Hl7.Fhir.Model.DataType Value protected internal override void CopyToInternal(Base other) { - var dest = other as Extension; - - if (dest == null) - { + if(other is not Extension dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -127,12 +120,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Extension; - if(otherT == null) return false; + if(other is not Extension otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; return true; } @@ -142,11 +134,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } @@ -172,8 +164,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs index 33d6a0bf2..256074c78 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs @@ -122,13 +122,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.Identifier.IdentifierUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -167,13 +164,10 @@ public Hl7.Fhir.Model.FhirUri SystemElement [IgnoreDataMember] public string System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -198,13 +192,10 @@ public Hl7.Fhir.Model.FhirString ValueElement [IgnoreDataMember] public string Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -239,20 +230,16 @@ public Hl7.Fhir.Model.ResourceReference Assigner protected internal override void CopyToInternal(Base other) { - var dest = other as Identifier; - - if (dest == null) - { + if(other is not Identifier dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Assigner != null) dest.Assigner = (Hl7.Fhir.Model.ResourceReference)Assigner.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Assigner is not null) dest.Assigner = (Hl7.Fhir.Model.ResourceReference)_Assigner.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -264,16 +251,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Identifier; - if(otherT == null) return false; + if(other is not Identifier otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Assigner, otherT.Assigner)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Assigner, otherT._Assigner)) return false; return true; } @@ -283,23 +269,23 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "assigner": - value = Assigner; - return Assigner is not null; + value = _Assigner; + return _Assigner is not null; default: return base.TryGetValue(key, out value); } @@ -337,12 +323,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Assigner is not null) yield return new KeyValuePair("assigner",Assigner); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Assigner is not null) yield return new KeyValuePair("assigner",_Assigner); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs index e3e628bd0..33c3d782d 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs @@ -79,13 +79,10 @@ public Hl7.Fhir.Model.Id VersionIdElement [IgnoreDataMember] public string VersionId { - get { return VersionIdElement != null ? VersionIdElement.Value : null; } + get => _VersionIdElement?.Value; set { - if (value == null) - VersionIdElement = null; - else - VersionIdElement = new Hl7.Fhir.Model.Id(value); + VersionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("VersionId"); } } @@ -110,13 +107,10 @@ public Hl7.Fhir.Model.Instant LastUpdatedElement [IgnoreDataMember] public DateTimeOffset? LastUpdated { - get { return LastUpdatedElement != null ? LastUpdatedElement.Value : null; } + get => _LastUpdatedElement?.Value; set { - if (value == null) - LastUpdatedElement = null; - else - LastUpdatedElement = new Hl7.Fhir.Model.Instant(value); + LastUpdatedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("LastUpdated"); } } @@ -144,13 +138,10 @@ public Hl7.Fhir.Model.FhirUri SourceElement [IgnoreDataMember] public string Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -173,7 +164,7 @@ public string Source [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -224,7 +215,7 @@ public IEnumerable Profile [DataMember] public List Security { - get { if(_Security==null) _Security = new List(); return _Security; } + get => _Security ?? new List(); set { _Security = value; OnPropertyChanged("Security"); } } @@ -239,7 +230,7 @@ public List Security [DataMember] public List Tag { - get { if(_Tag==null) _Tag = new List(); return _Tag; } + get => _Tag ?? new List(); set { _Tag = value; OnPropertyChanged("Tag"); } } @@ -247,20 +238,16 @@ public List Tag protected internal override void CopyToInternal(Base other) { - var dest = other as Meta; - - if (dest == null) - { + if(other is not Meta dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VersionIdElement != null) dest.VersionIdElement = (Hl7.Fhir.Model.Id)VersionIdElement.DeepCopyInternal(); - if(LastUpdatedElement != null) dest.LastUpdatedElement = (Hl7.Fhir.Model.Instant)LastUpdatedElement.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(Security.Any()) dest.Security = new List(Security.DeepCopyInternal()); - if(Tag.Any()) dest.Tag = new List(Tag.DeepCopyInternal()); + if(_VersionIdElement is not null) dest.VersionIdElement = (Hl7.Fhir.Model.Id)_VersionIdElement.DeepCopyInternal(); + if(_LastUpdatedElement is not null) dest.LastUpdatedElement = (Hl7.Fhir.Model.Instant)_LastUpdatedElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_Security is not null) dest.Security = new List(_Security.DeepCopyInternal()); + if(_Tag is not null) dest.Tag = new List(_Tag.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -272,16 +259,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Meta; - if(otherT == null) return false; + if(other is not Meta otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VersionIdElement, otherT.VersionIdElement)) return false; - if(!comparer.Equals(LastUpdatedElement, otherT.LastUpdatedElement)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Security, otherT.Security)) return false; - if(!comparer.ListEquals(Tag, otherT.Tag)) return false; + if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; + if(!comparer.Equals(_LastUpdatedElement, otherT._LastUpdatedElement)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Security, otherT._Security)) return false; + if(!comparer.ListEquals(_Tag, otherT._Tag)) return false; return true; } @@ -291,23 +277,23 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "versionId": - value = VersionIdElement; - return VersionIdElement is not null; + value = _VersionIdElement; + return _VersionIdElement is not null; case "lastUpdated": - value = LastUpdatedElement; - return LastUpdatedElement is not null; + value = _LastUpdatedElement; + return _LastUpdatedElement is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "security": - value = Security; - return Security?.Any() == true; + value = _Security; + return _Security?.Any() == true; case "tag": - value = Tag; - return Tag?.Any() == true; + value = _Tag; + return _Tag?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -345,12 +331,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VersionIdElement is not null) yield return new KeyValuePair("versionId",VersionIdElement); - if (LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",LastUpdatedElement); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (Security?.Any() == true) yield return new KeyValuePair("security",Security); - if (Tag?.Any() == true) yield return new KeyValuePair("tag",Tag); + if (_VersionIdElement is not null) yield return new KeyValuePair("versionId",_VersionIdElement); + if (_LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",_LastUpdatedElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_Security?.Any() == true) yield return new KeyValuePair("security",_Security); + if (_Tag?.Any() == true) yield return new KeyValuePair("tag",_Tag); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs index 71e0fbc1b..f56b49e31 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs @@ -116,13 +116,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Narrative.NarrativeStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -148,29 +145,22 @@ public Hl7.Fhir.Model.XHtml DivElement [IgnoreDataMember] public string Div { - get { return DivElement != null ? DivElement.Value : null; } + get => _DivElement?.Value; set { - if (value == null) - DivElement = null; - else - DivElement = new Hl7.Fhir.Model.XHtml(value); + DivElement = value is null ? null : new Hl7.Fhir.Model.XHtml(value); OnPropertyChanged("Div"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Narrative; - - if (dest == null) - { + if(other is not Narrative dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DivElement != null) dest.DivElement = (Hl7.Fhir.Model.XHtml)DivElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DivElement is not null) dest.DivElement = (Hl7.Fhir.Model.XHtml)_DivElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -182,12 +172,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Narrative; - if(otherT == null) return false; + if(other is not Narrative otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DivElement, otherT.DivElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DivElement, otherT._DivElement)) return false; return true; } @@ -197,11 +186,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "div": - value = DivElement; - return DivElement is not null; + value = _DivElement; + return _DivElement is not null; default: return base.TryGetValue(key, out value); } @@ -227,8 +216,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DivElement is not null) yield return new KeyValuePair("div",DivElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DivElement is not null) yield return new KeyValuePair("div",_DivElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs index 41e8a59a5..29169de67 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs @@ -348,13 +348,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationOutcome.IssueSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -382,13 +379,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationOutcome.IssueType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -427,13 +421,10 @@ public Hl7.Fhir.Model.FhirString DiagnosticsElement [IgnoreDataMember] public string Diagnostics { - get { return DiagnosticsElement != null ? DiagnosticsElement.Value : null; } + get => _DiagnosticsElement?.Value; set { - if (value == null) - DiagnosticsElement = null; - else - DiagnosticsElement = new Hl7.Fhir.Model.FhirString(value); + DiagnosticsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Diagnostics"); } } @@ -446,7 +437,7 @@ public string Diagnostics [DataMember] public List LocationElement { - get { if(_LocationElement==null) _LocationElement = new List(); return _LocationElement; } + get => _LocationElement ?? new List(); set { _LocationElement = value; OnPropertyChanged("LocationElement"); } } @@ -478,7 +469,7 @@ public IEnumerable Location [DataMember] public List ExpressionElement { - get { if(_ExpressionElement==null) _ExpressionElement = new List(); return _ExpressionElement; } + get => _ExpressionElement ?? new List(); set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } @@ -504,20 +495,16 @@ public IEnumerable Expression protected internal override void CopyToInternal(Base other) { - var dest = other as IssueComponent; - - if (dest == null) - { + if(other is not IssueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Details != null) dest.Details = (Hl7.Fhir.Model.CodeableConcept)Details.DeepCopyInternal(); - if(DiagnosticsElement != null) dest.DiagnosticsElement = (Hl7.Fhir.Model.FhirString)DiagnosticsElement.DeepCopyInternal(); - if(LocationElement.Any()) dest.LocationElement = new List(LocationElement.DeepCopyInternal()); - if(ExpressionElement.Any()) dest.ExpressionElement = new List(ExpressionElement.DeepCopyInternal()); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Details is not null) dest.Details = (Hl7.Fhir.Model.CodeableConcept)_Details.DeepCopyInternal(); + if(_DiagnosticsElement is not null) dest.DiagnosticsElement = (Hl7.Fhir.Model.FhirString)_DiagnosticsElement.DeepCopyInternal(); + if(_LocationElement is not null) dest.LocationElement = new List(_LocationElement.DeepCopyInternal()); + if(_ExpressionElement is not null) dest.ExpressionElement = new List(_ExpressionElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -529,16 +516,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IssueComponent; - if(otherT == null) return false; + if(other is not IssueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Details, otherT.Details)) return false; - if(!comparer.Equals(DiagnosticsElement, otherT.DiagnosticsElement)) return false; - if(!comparer.ListEquals(LocationElement, otherT.LocationElement)) return false; - if(!comparer.ListEquals(ExpressionElement, otherT.ExpressionElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Details, otherT._Details)) return false; + if(!comparer.Equals(_DiagnosticsElement, otherT._DiagnosticsElement)) return false; + if(!comparer.ListEquals(_LocationElement, otherT._LocationElement)) return false; + if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false; return true; } @@ -548,23 +534,23 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "details": - value = Details; - return Details is not null; + value = _Details; + return _Details is not null; case "diagnostics": - value = DiagnosticsElement; - return DiagnosticsElement is not null; + value = _DiagnosticsElement; + return _DiagnosticsElement is not null; case "location": - value = LocationElement; - return LocationElement?.Any() == true; + value = _LocationElement; + return _LocationElement?.Any() == true; case "expression": - value = ExpressionElement; - return ExpressionElement?.Any() == true; + value = _ExpressionElement; + return _ExpressionElement?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -602,12 +588,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Details is not null) yield return new KeyValuePair("details",Details); - if (DiagnosticsElement is not null) yield return new KeyValuePair("diagnostics",DiagnosticsElement); - if (LocationElement?.Any() == true) yield return new KeyValuePair("location",LocationElement); - if (ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",ExpressionElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Details is not null) yield return new KeyValuePair("details",_Details); + if (_DiagnosticsElement is not null) yield return new KeyValuePair("diagnostics",_DiagnosticsElement); + if (_LocationElement?.Any() == true) yield return new KeyValuePair("location",_LocationElement); + if (_ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -620,7 +606,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Issue { - get { if(_Issue==null) _Issue = new List(); return _Issue; } + get => _Issue ?? new List(); set { _Issue = value; OnPropertyChanged("Issue"); } } @@ -628,15 +614,11 @@ public List Issue protected internal override void CopyToInternal(Base other) { - var dest = other as OperationOutcome; - - if (dest == null) - { + if(other is not OperationOutcome dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Issue.Any()) dest.Issue = new List(Issue.DeepCopyInternal()); + if(_Issue is not null) dest.Issue = new List(_Issue.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -648,11 +630,10 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationOutcome; - if(otherT == null) return false; + if(other is not OperationOutcome otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Issue, otherT.Issue)) return false; + if(!comparer.ListEquals(_Issue, otherT._Issue)) return false; return true; } @@ -662,8 +643,8 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "issue": - value = Issue; - return Issue?.Any() == true; + value = _Issue; + return _Issue?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -686,7 +667,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Issue?.Any() == true) yield return new KeyValuePair("issue",Issue); + if (_Issue?.Any() == true) yield return new KeyValuePair("issue",_Issue); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs index 414d6b4a3..6843d63d9 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs @@ -97,13 +97,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -144,7 +141,7 @@ public Hl7.Fhir.Model.Resource Resource [DataMember] public List Part { - get { if(_Part==null) _Part = new List(); return _Part; } + get => _Part ?? new List(); set { _Part = value; OnPropertyChanged("Part"); } } @@ -152,18 +149,14 @@ public List Part protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.Resource)Resource.DeepCopyInternal(); - if(Part.Any()) dest.Part = new List(Part.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.Resource)_Resource.DeepCopyInternal(); + if(_Part is not null) dest.Part = new List(_Part.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -175,14 +168,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Part, otherT.Part)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Part, otherT._Part)) return false; return true; } @@ -192,17 +184,17 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "part": - value = Part; - return Part?.Any() == true; + value = _Part; + return _Part?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -234,10 +226,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Part?.Any() == true) yield return new KeyValuePair("part",Part); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Part?.Any() == true) yield return new KeyValuePair("part",_Part); } } @@ -250,7 +242,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -258,15 +250,11 @@ public List Parameter protected internal override void CopyToInternal(Base other) { - var dest = other as Parameters; - - if (dest == null) - { + if(other is not Parameters dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -278,11 +266,10 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Parameters; - if(otherT == null) return false; + if(other is not Parameters otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; return true; } @@ -292,8 +279,8 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; default: return base.TryGetValue(key, out value); } @@ -316,7 +303,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Period.cs b/src/Hl7.Fhir.Base/Model/Generated/Period.cs index 78663099f..f23c400ac 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Period.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Period.cs @@ -81,13 +81,10 @@ public Hl7.Fhir.Model.FhirDateTime StartElement [IgnoreDataMember] public string Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Start"); } } @@ -112,29 +109,22 @@ public Hl7.Fhir.Model.FhirDateTime EndElement [IgnoreDataMember] public string End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.FhirDateTime(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("End"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Period; - - if (dest == null) - { + if(other is not Period dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.FhirDateTime)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.FhirDateTime)EndElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.FhirDateTime)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.FhirDateTime)_EndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -146,12 +136,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Period; - if(otherT == null) return false; + if(other is not Period otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; return true; } @@ -161,11 +150,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; default: return base.TryGetValue(key, out value); } @@ -191,8 +180,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs index 402e4ec8e..ebbead031 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs @@ -56,12 +56,8 @@ public abstract partial class PrimitiveType : Hl7.Fhir.Model.DataType { protected internal override void CopyToInternal(Base other) { - var dest = other as PrimitiveType; - - if (dest == null) - { + if(other is not PrimitiveType dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if (ObjectValue != null) dest.ObjectValue = ObjectValue; @@ -69,8 +65,7 @@ protected internal override void CopyToInternal(Base other) public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrimitiveType; - if(otherT == null) return false; + if(other is not PrimitiveType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; diff --git a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs index 32a139214..a7ce8de41 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs @@ -120,13 +120,10 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } @@ -153,13 +150,10 @@ public Code ComparatorElement [IgnoreDataMember] public Hl7.Fhir.Model.Quantity.QuantityComparator? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Value : null; } + get => _ComparatorElement?.Value; set { - if (value == null) - ComparatorElement = null; - else - ComparatorElement = new Code(value); + ComparatorElement = value is null ? null : new Code(value); OnPropertyChanged("Comparator"); } } @@ -184,13 +178,10 @@ public Hl7.Fhir.Model.FhirString UnitElement [IgnoreDataMember] public string Unit { - get { return UnitElement != null ? UnitElement.Value : null; } + get => _UnitElement?.Value; set { - if (value == null) - UnitElement = null; - else - UnitElement = new Hl7.Fhir.Model.FhirString(value); + UnitElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Unit"); } } @@ -215,13 +206,10 @@ public Hl7.Fhir.Model.FhirUri SystemElement [IgnoreDataMember] public string System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -246,32 +234,25 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Quantity; - - if (dest == null) - { + if(other is not Quantity dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); - if(ComparatorElement != null) dest.ComparatorElement = (Code)ComparatorElement.DeepCopyInternal(); - if(UnitElement != null) dest.UnitElement = (Hl7.Fhir.Model.FhirString)UnitElement.DeepCopyInternal(); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); + if(_ComparatorElement is not null) dest.ComparatorElement = (Code)_ComparatorElement.DeepCopyInternal(); + if(_UnitElement is not null) dest.UnitElement = (Hl7.Fhir.Model.FhirString)_UnitElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -283,15 +264,14 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Quantity; - if(otherT == null) return false; + if(other is not Quantity otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.Equals(UnitElement, otherT.UnitElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.Equals(_UnitElement, otherT._UnitElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; return true; } @@ -301,20 +281,20 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "comparator": - value = ComparatorElement; - return ComparatorElement is not null; + value = _ComparatorElement; + return _ComparatorElement is not null; case "unit": - value = UnitElement; - return UnitElement is not null; + value = _UnitElement; + return _UnitElement is not null; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; default: return base.TryGetValue(key, out value); } @@ -349,11 +329,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (ComparatorElement is not null) yield return new KeyValuePair("comparator",ComparatorElement); - if (UnitElement is not null) yield return new KeyValuePair("unit",UnitElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_ComparatorElement is not null) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_UnitElement is not null) yield return new KeyValuePair("unit",_UnitElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Range.cs b/src/Hl7.Fhir.Base/Model/Generated/Range.cs index 4fa7f408f..a72c3dd11 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Range.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Range.cs @@ -88,16 +88,12 @@ public Hl7.Fhir.Model.Quantity High protected internal override void CopyToInternal(Base other) { - var dest = other as Range; - - if (dest == null) - { + if(other is not Range dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Low != null) dest.Low = (Hl7.Fhir.Model.Quantity)Low.DeepCopyInternal(); - if(High != null) dest.High = (Hl7.Fhir.Model.Quantity)High.DeepCopyInternal(); + if(_Low is not null) dest.Low = (Hl7.Fhir.Model.Quantity)_Low.DeepCopyInternal(); + if(_High is not null) dest.High = (Hl7.Fhir.Model.Quantity)_High.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -109,12 +105,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Range; - if(otherT == null) return false; + if(other is not Range otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Low, otherT.Low)) return false; - if(!comparer.Equals(High, otherT.High)) return false; + if(!comparer.Equals(_Low, otherT._Low)) return false; + if(!comparer.Equals(_High, otherT._High)) return false; return true; } @@ -124,11 +119,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "low": - value = Low; - return Low is not null; + value = _Low; + return _Low is not null; case "high": - value = High; - return High is not null; + value = _High; + return _High is not null; default: return base.TryGetValue(key, out value); } @@ -154,8 +149,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Low is not null) yield return new KeyValuePair("low",Low); - if (High is not null) yield return new KeyValuePair("high",High); + if (_Low is not null) yield return new KeyValuePair("low",_Low); + if (_High is not null) yield return new KeyValuePair("high",_High); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs index f2bb8c35f..b3b20be32 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs @@ -74,13 +74,10 @@ public Hl7.Fhir.Model.Id IdElement [IgnoreDataMember] public string Id { - get { return IdElement != null ? IdElement.Value : null; } + get => _IdElement?.Value; set { - if (value == null) - IdElement = null; - else - IdElement = new Hl7.Fhir.Model.Id(value); + IdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Id"); } } @@ -118,13 +115,10 @@ public Hl7.Fhir.Model.FhirUri ImplicitRulesElement [IgnoreDataMember] public string ImplicitRules { - get { return ImplicitRulesElement != null ? ImplicitRulesElement.Value : null; } + get => _ImplicitRulesElement?.Value; set { - if (value == null) - ImplicitRulesElement = null; - else - ImplicitRulesElement = new Hl7.Fhir.Model.FhirUri(value); + ImplicitRulesElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("ImplicitRules"); } } @@ -150,43 +144,35 @@ public Hl7.Fhir.Model.Code LanguageElement [IgnoreDataMember] public string Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Resource; - - if (dest == null) - { + if(other is not Resource dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdElement != null) dest.IdElement = (Hl7.Fhir.Model.Id)IdElement.DeepCopyInternal(); - if(Meta != null) dest.Meta = (Hl7.Fhir.Model.Meta)Meta.DeepCopyInternal(); - if(ImplicitRulesElement != null) dest.ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri)ImplicitRulesElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); + if(_IdElement is not null) dest.IdElement = (Hl7.Fhir.Model.Id)_IdElement.DeepCopyInternal(); + if(_Meta is not null) dest.Meta = (Hl7.Fhir.Model.Meta)_Meta.DeepCopyInternal(); + if(_ImplicitRulesElement is not null) dest.ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri)_ImplicitRulesElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); } public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Resource; - if(otherT == null) return false; + if(other is not Resource otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdElement, otherT.IdElement)) return false; - if(!comparer.Equals(Meta, otherT.Meta)) return false; - if(!comparer.Equals(ImplicitRulesElement, otherT.ImplicitRulesElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; + if(!comparer.Equals(_IdElement, otherT._IdElement)) return false; + if(!comparer.Equals(_Meta, otherT._Meta)) return false; + if(!comparer.Equals(_ImplicitRulesElement, otherT._ImplicitRulesElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; return true; } @@ -196,17 +182,17 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "id": - value = IdElement; - return IdElement is not null; + value = _IdElement; + return _IdElement is not null; case "meta": - value = Meta; - return Meta is not null; + value = _Meta; + return _Meta is not null; case "implicitRules": - value = ImplicitRulesElement; - return ImplicitRulesElement is not null; + value = _ImplicitRulesElement; + return _ImplicitRulesElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; default: return base.TryGetValue(key, out value); } @@ -238,10 +224,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdElement is not null) yield return new KeyValuePair("id",IdElement); - if (Meta is not null) yield return new KeyValuePair("meta",Meta); - if (ImplicitRulesElement is not null) yield return new KeyValuePair("implicitRules",ImplicitRulesElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); + if (_IdElement is not null) yield return new KeyValuePair("id",_IdElement); + if (_Meta is not null) yield return new KeyValuePair("meta",_Meta); + if (_ImplicitRulesElement is not null) yield return new KeyValuePair("implicitRules",_ImplicitRulesElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs index d6b157a02..8cc6c07dd 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs @@ -79,13 +79,10 @@ public Hl7.Fhir.Model.FhirString ReferenceElement [IgnoreDataMember] public string Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Reference"); } } @@ -114,13 +111,10 @@ public Hl7.Fhir.Model.FhirUri TypeElement [IgnoreDataMember] public string Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirUri(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Type"); } } @@ -158,31 +152,24 @@ public Hl7.Fhir.Model.FhirString DisplayElement [IgnoreDataMember] public string Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceReference; - - if (dest == null) - { + if(other is not ResourceReference dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirString)ReferenceElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirUri)TypeElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirString)_ReferenceElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirUri)_TypeElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -194,14 +181,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceReference; - if(otherT == null) return false; + if(other is not ResourceReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; return true; } @@ -211,17 +197,17 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } @@ -253,10 +239,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs index e14001a32..c110d2c71 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs @@ -72,7 +72,7 @@ public partial class Signature : Hl7.Fhir.Model.DataType [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } @@ -101,13 +101,10 @@ public Hl7.Fhir.Model.Instant WhenElement [IgnoreDataMember] public DateTimeOffset? When { - get { return WhenElement != null ? WhenElement.Value : null; } + get => _WhenElement?.Value; set { - if (value == null) - WhenElement = null; - else - WhenElement = new Hl7.Fhir.Model.Instant(value); + WhenElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("When"); } } @@ -182,13 +179,10 @@ public Hl7.Fhir.Model.Code ContentTypeElement [IgnoreDataMember] public string ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -217,13 +211,10 @@ public Hl7.Fhir.Model.Code TargetFormatElement [IgnoreDataMember] public string TargetFormat { - get { return TargetFormatElement != null ? TargetFormatElement.Value : null; } + get => _TargetFormatElement?.Value; set { - if (value == null) - TargetFormatElement = null; - else - TargetFormatElement = new Hl7.Fhir.Model.Code(value); + TargetFormatElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("TargetFormat"); } } @@ -252,13 +243,10 @@ public Hl7.Fhir.Model.Code SigFormatElement [IgnoreDataMember] public string SigFormat { - get { return SigFormatElement != null ? SigFormatElement.Value : null; } + get => _SigFormatElement?.Value; set { - if (value == null) - SigFormatElement = null; - else - SigFormatElement = new Hl7.Fhir.Model.Code(value); + SigFormatElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("SigFormat"); } } @@ -287,13 +275,10 @@ public Hl7.Fhir.Model.Base64Binary BlobElement [IgnoreDataMember] public byte[] Blob { - get { return BlobElement != null ? BlobElement.Value : null; } + get => _BlobElement?.Value; set { - if (value == null) - BlobElement = null; - else - BlobElement = new Hl7.Fhir.Model.Base64Binary(value); + BlobElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Blob"); } } @@ -321,36 +306,29 @@ public Hl7.Fhir.Model.Base64Binary DataElement [IgnoreDataMember] public byte[] Data { - get { return DataElement != null ? DataElement.Value : null; } + get => _DataElement?.Value; set { - if (value == null) - DataElement = null; - else - DataElement = new Hl7.Fhir.Model.Base64Binary(value); + DataElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Data"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Signature; - - if (dest == null) - { + if(other is not Signature dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(WhenElement != null) dest.WhenElement = (Hl7.Fhir.Model.Instant)WhenElement.DeepCopyInternal(); - if(Who != null) dest.Who = (Hl7.Fhir.Model.DataType)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.DataType)OnBehalfOf.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(TargetFormatElement != null) dest.TargetFormatElement = (Hl7.Fhir.Model.Code)TargetFormatElement.DeepCopyInternal(); - if(SigFormatElement != null) dest.SigFormatElement = (Hl7.Fhir.Model.Code)SigFormatElement.DeepCopyInternal(); - if(BlobElement != null) dest.BlobElement = (Hl7.Fhir.Model.Base64Binary)BlobElement.DeepCopyInternal(); - if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)DataElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_WhenElement is not null) dest.WhenElement = (Hl7.Fhir.Model.Instant)_WhenElement.DeepCopyInternal(); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.DataType)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.DataType)_OnBehalfOf.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_TargetFormatElement is not null) dest.TargetFormatElement = (Hl7.Fhir.Model.Code)_TargetFormatElement.DeepCopyInternal(); + if(_SigFormatElement is not null) dest.SigFormatElement = (Hl7.Fhir.Model.Code)_SigFormatElement.DeepCopyInternal(); + if(_BlobElement is not null) dest.BlobElement = (Hl7.Fhir.Model.Base64Binary)_BlobElement.DeepCopyInternal(); + if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.Base64Binary)_DataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -362,19 +340,18 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Signature; - if(otherT == null) return false; + if(other is not Signature otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(WhenElement, otherT.WhenElement)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(TargetFormatElement, otherT.TargetFormatElement)) return false; - if(!comparer.Equals(SigFormatElement, otherT.SigFormatElement)) return false; - if(!comparer.Equals(BlobElement, otherT.BlobElement)) return false; - if(!comparer.Equals(DataElement, otherT.DataElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_WhenElement, otherT._WhenElement)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_TargetFormatElement, otherT._TargetFormatElement)) return false; + if(!comparer.Equals(_SigFormatElement, otherT._SigFormatElement)) return false; + if(!comparer.Equals(_BlobElement, otherT._BlobElement)) return false; + if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; return true; } @@ -384,32 +361,32 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "when": - value = WhenElement; - return WhenElement is not null; + value = _WhenElement; + return _WhenElement is not null; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "targetFormat": - value = TargetFormatElement; - return TargetFormatElement is not null; + value = _TargetFormatElement; + return _TargetFormatElement is not null; case "sigFormat": - value = SigFormatElement; - return SigFormatElement is not null; + value = _SigFormatElement; + return _SigFormatElement is not null; case "blob": - value = BlobElement; - return BlobElement is not null; + value = _BlobElement; + return _BlobElement is not null; case "data": - value = DataElement; - return DataElement is not null; + value = _DataElement; + return _DataElement is not null; default: return base.TryGetValue(key, out value); } @@ -456,15 +433,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (WhenElement is not null) yield return new KeyValuePair("when",WhenElement); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (TargetFormatElement is not null) yield return new KeyValuePair("targetFormat",TargetFormatElement); - if (SigFormatElement is not null) yield return new KeyValuePair("sigFormat",SigFormatElement); - if (BlobElement is not null) yield return new KeyValuePair("blob",BlobElement); - if (DataElement is not null) yield return new KeyValuePair("data",DataElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_WhenElement is not null) yield return new KeyValuePair("when",_WhenElement); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_TargetFormatElement is not null) yield return new KeyValuePair("targetFormat",_TargetFormatElement); + if (_SigFormatElement is not null) yield return new KeyValuePair("sigFormat",_SigFormatElement); + if (_BlobElement is not null) yield return new KeyValuePair("blob",_BlobElement); + if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs index 8d621423a..c2f0c01f7 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs @@ -94,16 +94,12 @@ public Hl7.Fhir.Model.DataType Value protected internal override void CopyToInternal(Base other) { - var dest = other as UsageContext; - - if (dest == null) - { + if(other is not UsageContext dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.Coding)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.Coding)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -115,12 +111,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UsageContext; - if(otherT == null) return false; + if(other is not UsageContext otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; return true; } @@ -130,11 +125,11 @@ public override bool TryGetValue(string key, out object value) switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } @@ -160,8 +155,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs index 29f1d4272..4905a3a67 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs @@ -391,13 +391,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -422,13 +419,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -453,13 +447,10 @@ public Hl7.Fhir.Model.FhirDateTime ReleaseDateElement [IgnoreDataMember] public string ReleaseDate { - get { return ReleaseDateElement != null ? ReleaseDateElement.Value : null; } + get => _ReleaseDateElement?.Value; set { - if (value == null) - ReleaseDateElement = null; - else - ReleaseDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReleaseDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ReleaseDate"); } } @@ -474,9 +465,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(ReleaseDateElement != null) dest.ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)ReleaseDateElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_ReleaseDateElement is not null) dest.ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)_ReleaseDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -488,13 +479,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SoftwareComponent; - if(otherT == null) return false; + if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(ReleaseDateElement, otherT.ReleaseDateElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_ReleaseDateElement, otherT._ReleaseDateElement)) return false; return true; } @@ -594,13 +584,10 @@ public Hl7.Fhir.Model.PrimitiveType DescriptionElement [IgnoreDataMember] public string DescriptionString { - get { return DescriptionElement != null ? ((IValue)DescriptionElement).Value : null; } + get => ((IValue)_DescriptionElement)?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DescriptionString"); } } @@ -612,13 +599,10 @@ public string DescriptionString [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? ((IValue)DescriptionElement).Value : null; } + get => ((IValue)_DescriptionElement)?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -643,13 +627,10 @@ public Hl7.Fhir.Model.FhirUrl UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } @@ -679,9 +660,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)DescriptionElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)_DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -693,13 +674,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationComponent; - if(otherT == null) return false; + if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; return true; } @@ -792,13 +772,10 @@ public Code ModeElemen [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.RestfulCapabilityMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -823,13 +800,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -855,7 +829,7 @@ public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent Security [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -869,7 +843,7 @@ public List Resource [DataMember] public List Interaction { - get { if(_Interaction==null) _Interaction = new List(); return _Interaction; } + get => _Interaction ?? new List(); set { _Interaction = value; OnPropertyChanged("Interaction"); } } @@ -883,7 +857,7 @@ public List Inter [DataMember] public List SearchParam { - get { if(_SearchParam==null) _SearchParam = new List(); return _SearchParam; } + get => _SearchParam ?? new List(); set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } @@ -897,7 +871,7 @@ public List SearchParam [DataMember] public List Operation { - get { if(_Operation==null) _Operation = new List(); return _Operation; } + get => _Operation ?? new List(); set { _Operation = value; OnPropertyChanged("Operation"); } } @@ -911,7 +885,7 @@ public List Operation [DataMember] public List CompartmentElement { - get { if(_CompartmentElement==null) _CompartmentElement = new List(); return _CompartmentElement; } + get => _CompartmentElement ?? new List(); set { _CompartmentElement = value; OnPropertyChanged("CompartmentElement"); } } @@ -945,14 +919,14 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(Security != null) dest.Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)Security.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Interaction.Any()) dest.Interaction = new List(Interaction.DeepCopyInternal()); - if(SearchParam.Any()) dest.SearchParam = new List(SearchParam.DeepCopyInternal()); - if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal()); - if(CompartmentElement.Any()) dest.CompartmentElement = new List(CompartmentElement.DeepCopyInternal()); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_Security is not null) dest.Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)_Security.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Interaction is not null) dest.Interaction = new List(_Interaction.DeepCopyInternal()); + if(_SearchParam is not null) dest.SearchParam = new List(_SearchParam.DeepCopyInternal()); + if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal()); + if(_CompartmentElement is not null) dest.CompartmentElement = new List(_CompartmentElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -964,18 +938,17 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RestComponent; - if(otherT == null) return false; + if(other is not RestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(Security, otherT.Security)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Interaction, otherT.Interaction)) return false; - if(!comparer.ListEquals(SearchParam, otherT.SearchParam)) return false; - if(!comparer.ListEquals(Operation, otherT.Operation)) return false; - if(!comparer.ListEquals(CompartmentElement, otherT.CompartmentElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_Security, otherT._Security)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Interaction, otherT._Interaction)) return false; + if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; + if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; + if(!comparer.ListEquals(_CompartmentElement, otherT._CompartmentElement)) return false; return true; } @@ -1099,13 +1072,10 @@ public Hl7.Fhir.Model.FhirBoolean CorsElement [IgnoreDataMember] public bool? Cors { - get { return CorsElement != null ? CorsElement.Value : null; } + get => _CorsElement?.Value; set { - if (value == null) - CorsElement = null; - else - CorsElement = new Hl7.Fhir.Model.FhirBoolean(value); + CorsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Cors"); } } @@ -1119,7 +1089,7 @@ public bool? Cors [DataMember] public List Service { - get { if(_Service==null) _Service = new List(); return _Service; } + get => _Service ?? new List(); set { _Service = value; OnPropertyChanged("Service"); } } @@ -1145,13 +1115,10 @@ public Hl7.Fhir.Model.Markdown DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1166,9 +1133,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CorsElement != null) dest.CorsElement = (Hl7.Fhir.Model.FhirBoolean)CorsElement.DeepCopyInternal(); - if(Service.Any()) dest.Service = new List(Service.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_CorsElement is not null) dest.CorsElement = (Hl7.Fhir.Model.FhirBoolean)_CorsElement.DeepCopyInternal(); + if(_Service is not null) dest.Service = new List(_Service.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1180,13 +1147,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SecurityComponent; - if(otherT == null) return false; + if(other is not SecurityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CorsElement, otherT.CorsElement)) return false; - if(!comparer.ListEquals(Service, otherT.Service)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; + if(!comparer.ListEquals(_Service, otherT._Service)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; return true; } @@ -1278,13 +1244,10 @@ public Hl7.Fhir.Model.Code TypeElement [IgnoreDataMember] public string Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.Code(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Type"); } } @@ -1309,13 +1272,10 @@ public Hl7.Fhir.Model.Canonical ProfileElement [IgnoreDataMember] public string Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -1328,7 +1288,7 @@ public string Profile [DataMember] public List SupportedProfileElement { - get { if(_SupportedProfileElement==null) _SupportedProfileElement = new List(); return _SupportedProfileElement; } + get => _SupportedProfileElement ?? new List(); set { _SupportedProfileElement = value; OnPropertyChanged("SupportedProfileElement"); } } @@ -1372,13 +1332,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -1391,7 +1348,7 @@ public string Documentation [DataMember] public List Interaction { - get { if(_Interaction==null) _Interaction = new List(); return _Interaction; } + get => _Interaction ?? new List(); set { _Interaction = value; OnPropertyChanged("Interaction"); } } @@ -1419,13 +1376,10 @@ public Code Versioning [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.ResourceVersionPolicy? Versioning { - get { return VersioningElement != null ? VersioningElement.Value : null; } + get => _VersioningElement?.Value; set { - if (value == null) - VersioningElement = null; - else - VersioningElement = new Code(value); + VersioningElement = value is null ? null : new Code(value); OnPropertyChanged("Versioning"); } } @@ -1450,13 +1404,10 @@ public Hl7.Fhir.Model.FhirBoolean ReadHistoryElement [IgnoreDataMember] public bool? ReadHistory { - get { return ReadHistoryElement != null ? ReadHistoryElement.Value : null; } + get => _ReadHistoryElement?.Value; set { - if (value == null) - ReadHistoryElement = null; - else - ReadHistoryElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReadHistoryElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReadHistory"); } } @@ -1481,13 +1432,10 @@ public Hl7.Fhir.Model.FhirBoolean UpdateCreateElement [IgnoreDataMember] public bool? UpdateCreate { - get { return UpdateCreateElement != null ? UpdateCreateElement.Value : null; } + get => _UpdateCreateElement?.Value; set { - if (value == null) - UpdateCreateElement = null; - else - UpdateCreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + UpdateCreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("UpdateCreate"); } } @@ -1512,13 +1460,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalCreateElement [IgnoreDataMember] public bool? ConditionalCreate { - get { return ConditionalCreateElement != null ? ConditionalCreateElement.Value : null; } + get => _ConditionalCreateElement?.Value; set { - if (value == null) - ConditionalCreateElement = null; - else - ConditionalCreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + ConditionalCreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ConditionalCreate"); } } @@ -1545,13 +1490,10 @@ public Code Conditiona [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.ConditionalReadStatus? ConditionalRead { - get { return ConditionalReadElement != null ? ConditionalReadElement.Value : null; } + get => _ConditionalReadElement?.Value; set { - if (value == null) - ConditionalReadElement = null; - else - ConditionalReadElement = new Code(value); + ConditionalReadElement = value is null ? null : new Code(value); OnPropertyChanged("ConditionalRead"); } } @@ -1576,13 +1518,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalUpdateElement [IgnoreDataMember] public bool? ConditionalUpdate { - get { return ConditionalUpdateElement != null ? ConditionalUpdateElement.Value : null; } + get => _ConditionalUpdateElement?.Value; set { - if (value == null) - ConditionalUpdateElement = null; - else - ConditionalUpdateElement = new Hl7.Fhir.Model.FhirBoolean(value); + ConditionalUpdateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ConditionalUpdate"); } } @@ -1610,13 +1549,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalPatchElement [IgnoreDataMember] public bool? ConditionalPatch { - get { return ConditionalPatchElement != null ? ConditionalPatchElement.Value : null; } + get => _ConditionalPatchElement?.Value; set { - if (value == null) - ConditionalPatchElement = null; - else - ConditionalPatchElement = new Hl7.Fhir.Model.FhirBoolean(value); + ConditionalPatchElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ConditionalPatch"); } } @@ -1643,13 +1579,10 @@ public Code Conditio [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDelete { - get { return ConditionalDeleteElement != null ? ConditionalDeleteElement.Value : null; } + get => _ConditionalDeleteElement?.Value; set { - if (value == null) - ConditionalDeleteElement = null; - else - ConditionalDeleteElement = new Code(value); + ConditionalDeleteElement = value is null ? null : new Code(value); OnPropertyChanged("ConditionalDelete"); } } @@ -1664,7 +1597,7 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDe [DataMember] public List> ReferencePolicyElement { - get { if(_ReferencePolicyElement==null) _ReferencePolicyElement = new List>(); return _ReferencePolicyElement; } + get => _ReferencePolicyElement ?? new List>(); set { _ReferencePolicyElement = value; OnPropertyChanged("ReferencePolicyElement"); } } @@ -1696,7 +1629,7 @@ public IEnumerable [DataMember] public List SearchIncludeElement { - get { if(_SearchIncludeElement==null) _SearchIncludeElement = new List(); return _SearchIncludeElement; } + get => _SearchIncludeElement ?? new List(); set { _SearchIncludeElement = value; OnPropertyChanged("SearchIncludeElement"); } } @@ -1728,7 +1661,7 @@ public IEnumerable SearchInclude [DataMember] public List SearchRevIncludeElement { - get { if(_SearchRevIncludeElement==null) _SearchRevIncludeElement = new List(); return _SearchRevIncludeElement; } + get => _SearchRevIncludeElement ?? new List(); set { _SearchRevIncludeElement = value; OnPropertyChanged("SearchRevIncludeElement"); } } @@ -1760,7 +1693,7 @@ public IEnumerable SearchRevInclude [DataMember] public List SearchParam { - get { if(_SearchParam==null) _SearchParam = new List(); return _SearchParam; } + get => _SearchParam ?? new List(); set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } @@ -1774,7 +1707,7 @@ public List SearchParam [DataMember] public List Operation { - get { if(_Operation==null) _Operation = new List(); return _Operation; } + get => _Operation ?? new List(); set { _Operation = value; OnPropertyChanged("Operation"); } } @@ -1790,24 +1723,24 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(SupportedProfileElement.Any()) dest.SupportedProfileElement = new List(SupportedProfileElement.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(Interaction.Any()) dest.Interaction = new List(Interaction.DeepCopyInternal()); - if(VersioningElement != null) dest.VersioningElement = (Code)VersioningElement.DeepCopyInternal(); - if(ReadHistoryElement != null) dest.ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)ReadHistoryElement.DeepCopyInternal(); - if(UpdateCreateElement != null) dest.UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)UpdateCreateElement.DeepCopyInternal(); - if(ConditionalCreateElement != null) dest.ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalCreateElement.DeepCopyInternal(); - if(ConditionalReadElement != null) dest.ConditionalReadElement = (Code)ConditionalReadElement.DeepCopyInternal(); - if(ConditionalUpdateElement != null) dest.ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalUpdateElement.DeepCopyInternal(); - if(ConditionalPatchElement != null) dest.ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalPatchElement.DeepCopyInternal(); - if(ConditionalDeleteElement != null) dest.ConditionalDeleteElement = (Code)ConditionalDeleteElement.DeepCopyInternal(); - if(ReferencePolicyElement.Any()) dest.ReferencePolicyElement = new List>(ReferencePolicyElement.DeepCopyInternal()); - if(SearchIncludeElement.Any()) dest.SearchIncludeElement = new List(SearchIncludeElement.DeepCopyInternal()); - if(SearchRevIncludeElement.Any()) dest.SearchRevIncludeElement = new List(SearchRevIncludeElement.DeepCopyInternal()); - if(SearchParam.Any()) dest.SearchParam = new List(SearchParam.DeepCopyInternal()); - if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_SupportedProfileElement is not null) dest.SupportedProfileElement = new List(_SupportedProfileElement.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_Interaction is not null) dest.Interaction = new List(_Interaction.DeepCopyInternal()); + if(_VersioningElement is not null) dest.VersioningElement = (Code)_VersioningElement.DeepCopyInternal(); + if(_ReadHistoryElement is not null) dest.ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)_ReadHistoryElement.DeepCopyInternal(); + if(_UpdateCreateElement is not null) dest.UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)_UpdateCreateElement.DeepCopyInternal(); + if(_ConditionalCreateElement is not null) dest.ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalCreateElement.DeepCopyInternal(); + if(_ConditionalReadElement is not null) dest.ConditionalReadElement = (Code)_ConditionalReadElement.DeepCopyInternal(); + if(_ConditionalUpdateElement is not null) dest.ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalUpdateElement.DeepCopyInternal(); + if(_ConditionalPatchElement is not null) dest.ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalPatchElement.DeepCopyInternal(); + if(_ConditionalDeleteElement is not null) dest.ConditionalDeleteElement = (Code)_ConditionalDeleteElement.DeepCopyInternal(); + if(_ReferencePolicyElement is not null) dest.ReferencePolicyElement = new List>(_ReferencePolicyElement.DeepCopyInternal()); + if(_SearchIncludeElement is not null) dest.SearchIncludeElement = new List(_SearchIncludeElement.DeepCopyInternal()); + if(_SearchRevIncludeElement is not null) dest.SearchRevIncludeElement = new List(_SearchRevIncludeElement.DeepCopyInternal()); + if(_SearchParam is not null) dest.SearchParam = new List(_SearchParam.DeepCopyInternal()); + if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1819,28 +1752,27 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(SupportedProfileElement, otherT.SupportedProfileElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(Interaction, otherT.Interaction)) return false; - if(!comparer.Equals(VersioningElement, otherT.VersioningElement)) return false; - if(!comparer.Equals(ReadHistoryElement, otherT.ReadHistoryElement)) return false; - if(!comparer.Equals(UpdateCreateElement, otherT.UpdateCreateElement)) return false; - if(!comparer.Equals(ConditionalCreateElement, otherT.ConditionalCreateElement)) return false; - if(!comparer.Equals(ConditionalReadElement, otherT.ConditionalReadElement)) return false; - if(!comparer.Equals(ConditionalUpdateElement, otherT.ConditionalUpdateElement)) return false; - if(!comparer.Equals(ConditionalPatchElement, otherT.ConditionalPatchElement)) return false; - if(!comparer.Equals(ConditionalDeleteElement, otherT.ConditionalDeleteElement)) return false; - if(!comparer.ListEquals(ReferencePolicyElement, otherT.ReferencePolicyElement)) return false; - if(!comparer.ListEquals(SearchIncludeElement, otherT.SearchIncludeElement)) return false; - if(!comparer.ListEquals(SearchRevIncludeElement, otherT.SearchRevIncludeElement)) return false; - if(!comparer.ListEquals(SearchParam, otherT.SearchParam)) return false; - if(!comparer.ListEquals(Operation, otherT.Operation)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_SupportedProfileElement, otherT._SupportedProfileElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_Interaction, otherT._Interaction)) return false; + if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false; + if(!comparer.Equals(_ReadHistoryElement, otherT._ReadHistoryElement)) return false; + if(!comparer.Equals(_UpdateCreateElement, otherT._UpdateCreateElement)) return false; + if(!comparer.Equals(_ConditionalCreateElement, otherT._ConditionalCreateElement)) return false; + if(!comparer.Equals(_ConditionalReadElement, otherT._ConditionalReadElement)) return false; + if(!comparer.Equals(_ConditionalUpdateElement, otherT._ConditionalUpdateElement)) return false; + if(!comparer.Equals(_ConditionalPatchElement, otherT._ConditionalPatchElement)) return false; + if(!comparer.Equals(_ConditionalDeleteElement, otherT._ConditionalDeleteElement)) return false; + if(!comparer.ListEquals(_ReferencePolicyElement, otherT._ReferencePolicyElement)) return false; + if(!comparer.ListEquals(_SearchIncludeElement, otherT._SearchIncludeElement)) return false; + if(!comparer.ListEquals(_SearchRevIncludeElement, otherT._SearchRevIncludeElement)) return false; + if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; + if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; return true; } @@ -2038,13 +1970,10 @@ public Code CodeEleme [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.TypeRestfulInteraction? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -2069,13 +1998,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -2090,8 +2016,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2103,12 +2029,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceInteractionComponent; - if(otherT == null) return false; + if(other is not ResourceInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; return true; } @@ -2192,13 +2117,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2223,13 +2145,10 @@ public Hl7.Fhir.Model.Canonical DefinitionElement [IgnoreDataMember] public string Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } @@ -2257,13 +2176,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2288,13 +2204,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -2309,10 +2222,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2324,14 +2237,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SearchParamComponent; - if(otherT == null) return false; + if(other is not SearchParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; return true; } @@ -2430,13 +2342,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2462,13 +2371,10 @@ public Hl7.Fhir.Model.Canonical DefinitionElement [IgnoreDataMember] public string Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } @@ -2493,13 +2399,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -2514,9 +2417,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2528,13 +2431,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; return true; } @@ -2626,13 +2528,10 @@ public Code CodeEle [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.SystemRestfulInteraction? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -2657,13 +2556,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -2678,8 +2574,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2691,12 +2587,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SystemInteractionComponent; - if(otherT == null) return false; + if(other is not SystemInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; return true; } @@ -2767,7 +2662,7 @@ public partial class MessagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -2793,13 +2688,10 @@ public Hl7.Fhir.Model.UnsignedInt ReliableCacheElement [IgnoreDataMember] public int? ReliableCache { - get { return ReliableCacheElement != null ? ReliableCacheElement.Value : null; } + get => _ReliableCacheElement?.Value; set { - if (value == null) - ReliableCacheElement = null; - else - ReliableCacheElement = new Hl7.Fhir.Model.UnsignedInt(value); + ReliableCacheElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("ReliableCache"); } } @@ -2824,13 +2716,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -2843,7 +2732,7 @@ public string Documentation [DataMember] public List SupportedMessage { - get { if(_SupportedMessage==null) _SupportedMessage = new List(); return _SupportedMessage; } + get => _SupportedMessage ?? new List(); set { _SupportedMessage = value; OnPropertyChanged("SupportedMessage"); } } @@ -2859,10 +2748,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(ReliableCacheElement != null) dest.ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)ReliableCacheElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(SupportedMessage.Any()) dest.SupportedMessage = new List(SupportedMessage.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_ReliableCacheElement is not null) dest.ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)_ReliableCacheElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_SupportedMessage is not null) dest.SupportedMessage = new List(_SupportedMessage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2874,14 +2763,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessagingComponent; - if(otherT == null) return false; + if(other is not MessagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(ReliableCacheElement, otherT.ReliableCacheElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(SupportedMessage, otherT.SupportedMessage)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_ReliableCacheElement, otherT._ReliableCacheElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_SupportedMessage, otherT._SupportedMessage)) return false; return true; } @@ -2993,13 +2881,10 @@ public Hl7.Fhir.Model.FhirUrl AddressElement [IgnoreDataMember] public string Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirUrl(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Address"); } } @@ -3014,8 +2899,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(Protocol != null) dest.Protocol = (Hl7.Fhir.Model.Coding)Protocol.DeepCopyInternal(); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)AddressElement.DeepCopyInternal(); + if(_Protocol is not null) dest.Protocol = (Hl7.Fhir.Model.Coding)_Protocol.DeepCopyInternal(); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)_AddressElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3027,12 +2912,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EndpointComponent; - if(otherT == null) return false; + if(other is not EndpointComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Protocol, otherT.Protocol)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; + if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; return true; } @@ -3118,13 +3002,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -3150,13 +3031,10 @@ public Hl7.Fhir.Model.Canonical DefinitionElement [IgnoreDataMember] public string Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } @@ -3171,8 +3049,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3184,12 +3062,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportedMessageComponent; - if(otherT == null) return false; + if(other is not SupportedMessageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; return true; } @@ -3274,13 +3151,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.DocumentMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -3305,13 +3179,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -3337,13 +3208,10 @@ public Hl7.Fhir.Model.Canonical ProfileElement [IgnoreDataMember] public string Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -3358,9 +3226,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3372,13 +3240,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentComponent; - if(otherT == null) return false; + if(other is not DocumentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; return true; } @@ -3451,13 +3318,10 @@ public Hl7.Fhir.Model.FhirUri UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -3473,7 +3337,7 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3499,13 +3363,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -3548,13 +3409,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3579,13 +3437,10 @@ public Hl7.Fhir.Model.FhirString TitleElement [IgnoreDataMember] public string Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -3613,13 +3468,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3644,13 +3496,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -3676,13 +3525,10 @@ public Hl7.Fhir.Model.FhirDateTime DateElement [IgnoreDataMember] public string Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -3707,13 +3553,10 @@ public Hl7.Fhir.Model.FhirString PublisherElement [IgnoreDataMember] public string Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -3726,7 +3569,7 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -3752,13 +3595,10 @@ public Hl7.Fhir.Model.Markdown DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -3771,7 +3611,7 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -3786,7 +3626,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -3812,13 +3652,10 @@ public Hl7.Fhir.Model.Markdown PurposeElement [IgnoreDataMember] public string Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -3843,13 +3680,10 @@ public Hl7.Fhir.Model.Markdown CopyrightElement [IgnoreDataMember] public string Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -3877,13 +3711,10 @@ public Hl7.Fhir.Model.FhirString CopyrightLabelElement [IgnoreDataMember] public string CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -3911,13 +3742,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatementKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -3930,7 +3758,7 @@ public Hl7.Fhir.Model.CapabilityStatementKind? Kind [DataMember] public List InstantiatesElement { - get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; } + get => _InstantiatesElement ?? new List(); set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -3962,7 +3790,7 @@ public IEnumerable Instantiates [DataMember] public List ImportsElement { - get { if(_ImportsElement==null) _ImportsElement = new List(); return _ImportsElement; } + get => _ImportsElement ?? new List(); set { _ImportsElement = value; OnPropertyChanged("ImportsElement"); } } @@ -4035,13 +3863,10 @@ public Code FhirVersionElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRVersion? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Value : null; } + get => _FhirVersionElement?.Value; set { - if (value == null) - FhirVersionElement = null; - else - FhirVersionElement = new Code(value); + FhirVersionElement = value is null ? null : new Code(value); OnPropertyChanged("FhirVersion"); } } @@ -4055,7 +3880,7 @@ public Hl7.Fhir.Model.FHIRVersion? FhirVersion [DataMember] public List FormatElement { - get { if(_FormatElement==null) _FormatElement = new List(); return _FormatElement; } + get => _FormatElement ?? new List(); set { _FormatElement = value; OnPropertyChanged("FormatElement"); } } @@ -4088,7 +3913,7 @@ public IEnumerable Format [DataMember] public List PatchFormatElement { - get { if(_PatchFormatElement==null) _PatchFormatElement = new List(); return _PatchFormatElement; } + get => _PatchFormatElement ?? new List(); set { _PatchFormatElement = value; OnPropertyChanged("PatchFormatElement"); } } @@ -4124,7 +3949,7 @@ public IEnumerable PatchFormat [DataMember] public List AcceptLanguageElement { - get { if(_AcceptLanguageElement==null) _AcceptLanguageElement = new List(); return _AcceptLanguageElement; } + get => _AcceptLanguageElement ?? new List(); set { _AcceptLanguageElement = value; OnPropertyChanged("AcceptLanguageElement"); } } @@ -4156,7 +3981,7 @@ public IEnumerable AcceptLanguage [DataMember] public List ImplementationGuideElement { - get { if(_ImplementationGuideElement==null) _ImplementationGuideElement = new List(); return _ImplementationGuideElement; } + get => _ImplementationGuideElement ?? new List(); set { _ImplementationGuideElement = value; OnPropertyChanged("ImplementationGuideElement"); } } @@ -4188,7 +4013,7 @@ public IEnumerable ImplementationGuide [DataMember] public List Rest { - get { if(_Rest==null) _Rest = new List(); return _Rest; } + get => _Rest ?? new List(); set { _Rest = value; OnPropertyChanged("Rest"); } } @@ -4202,7 +4027,7 @@ public List Rest [DataMember] public List Messaging { - get { if(_Messaging==null) _Messaging = new List(); return _Messaging; } + get => _Messaging ?? new List(); set { _Messaging = value; OnPropertyChanged("Messaging"); } } @@ -4216,7 +4041,7 @@ public List Messaging [DataMember] public List Document { - get { if(_Document==null) _Document = new List(); return _Document; } + get => _Document ?? new List(); set { _Document = value; OnPropertyChanged("Document"); } } @@ -4234,36 +4059,36 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal()); - if(ImportsElement.Any()) dest.ImportsElement = new List(ImportsElement.DeepCopyInternal()); - if(Software != null) dest.Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent)Software.DeepCopyInternal(); - if(Implementation != null) dest.Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent)Implementation.DeepCopyInternal(); - if(FhirVersionElement != null) dest.FhirVersionElement = (Code)FhirVersionElement.DeepCopyInternal(); - if(FormatElement.Any()) dest.FormatElement = new List(FormatElement.DeepCopyInternal()); - if(PatchFormatElement.Any()) dest.PatchFormatElement = new List(PatchFormatElement.DeepCopyInternal()); - if(AcceptLanguageElement.Any()) dest.AcceptLanguageElement = new List(AcceptLanguageElement.DeepCopyInternal()); - if(ImplementationGuideElement.Any()) dest.ImplementationGuideElement = new List(ImplementationGuideElement.DeepCopyInternal()); - if(Rest.Any()) dest.Rest = new List(Rest.DeepCopyInternal()); - if(Messaging.Any()) dest.Messaging = new List(Messaging.DeepCopyInternal()); - if(Document.Any()) dest.Document = new List(Document.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_InstantiatesElement is not null) dest.InstantiatesElement = new List(_InstantiatesElement.DeepCopyInternal()); + if(_ImportsElement is not null) dest.ImportsElement = new List(_ImportsElement.DeepCopyInternal()); + if(_Software is not null) dest.Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent)_Software.DeepCopyInternal(); + if(_Implementation is not null) dest.Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent)_Implementation.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = (Code)_FhirVersionElement.DeepCopyInternal(); + if(_FormatElement is not null) dest.FormatElement = new List(_FormatElement.DeepCopyInternal()); + if(_PatchFormatElement is not null) dest.PatchFormatElement = new List(_PatchFormatElement.DeepCopyInternal()); + if(_AcceptLanguageElement is not null) dest.AcceptLanguageElement = new List(_AcceptLanguageElement.DeepCopyInternal()); + if(_ImplementationGuideElement is not null) dest.ImplementationGuideElement = new List(_ImplementationGuideElement.DeepCopyInternal()); + if(_Rest is not null) dest.Rest = new List(_Rest.DeepCopyInternal()); + if(_Messaging is not null) dest.Messaging = new List(_Messaging.DeepCopyInternal()); + if(_Document is not null) dest.Document = new List(_Document.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4275,40 +4100,39 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityStatement; - if(otherT == null) return false; + if(other is not CapabilityStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.ListEquals(InstantiatesElement, otherT.InstantiatesElement)) return false; - if(!comparer.ListEquals(ImportsElement, otherT.ImportsElement)) return false; - if(!comparer.Equals(Software, otherT.Software)) return false; - if(!comparer.Equals(Implementation, otherT.Implementation)) return false; - if(!comparer.Equals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.ListEquals(FormatElement, otherT.FormatElement)) return false; - if(!comparer.ListEquals(PatchFormatElement, otherT.PatchFormatElement)) return false; - if(!comparer.ListEquals(AcceptLanguageElement, otherT.AcceptLanguageElement)) return false; - if(!comparer.ListEquals(ImplementationGuideElement, otherT.ImplementationGuideElement)) return false; - if(!comparer.ListEquals(Rest, otherT.Rest)) return false; - if(!comparer.ListEquals(Messaging, otherT.Messaging)) return false; - if(!comparer.ListEquals(Document, otherT.Document)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; + if(!comparer.ListEquals(_ImportsElement, otherT._ImportsElement)) return false; + if(!comparer.Equals(_Software, otherT._Software)) return false; + if(!comparer.Equals(_Implementation, otherT._Implementation)) return false; + if(!comparer.Equals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.ListEquals(_FormatElement, otherT._FormatElement)) return false; + if(!comparer.ListEquals(_PatchFormatElement, otherT._PatchFormatElement)) return false; + if(!comparer.ListEquals(_AcceptLanguageElement, otherT._AcceptLanguageElement)) return false; + if(!comparer.ListEquals(_ImplementationGuideElement, otherT._ImplementationGuideElement)) return false; + if(!comparer.ListEquals(_Rest, otherT._Rest)) return false; + if(!comparer.ListEquals(_Messaging, otherT._Messaging)) return false; + if(!comparer.ListEquals(_Document, otherT._Document)) return false; return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs index 51830d727..8909f652f 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs @@ -183,13 +183,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -214,13 +211,10 @@ public Hl7.Fhir.Model.FhirString DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -235,7 +229,7 @@ public string Description [DataMember] public List> OperatorElement { - get { if(_OperatorElement==null) _OperatorElement = new List>(); return _OperatorElement; } + get => _OperatorElement ?? new List>(); set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } @@ -280,13 +274,10 @@ public Hl7.Fhir.Model.FhirString ValueElement [IgnoreDataMember] public string Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -301,10 +292,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OperatorElement.Any()) dest.OperatorElement = new List>(OperatorElement.DeepCopyInternal()); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = new List>(_OperatorElement.DeepCopyInternal()); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -316,14 +307,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterComponent; - if(otherT == null) return false; + if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; return true; } @@ -421,13 +411,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -452,13 +439,10 @@ public Hl7.Fhir.Model.FhirUri UriElement [IgnoreDataMember] public string Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -483,13 +467,10 @@ public Hl7.Fhir.Model.FhirString DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -517,13 +498,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.CodeSystem.PropertyType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -538,10 +516,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -553,14 +531,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; return true; } @@ -658,13 +635,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -689,13 +663,10 @@ public Hl7.Fhir.Model.FhirString DisplayElement [IgnoreDataMember] public string Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -720,13 +691,10 @@ public Hl7.Fhir.Model.FhirString DefinitionElement [IgnoreDataMember] public string Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirString(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Definition"); } } @@ -739,7 +707,7 @@ public string Definition [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -753,7 +721,7 @@ public List Designation [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } @@ -767,7 +735,7 @@ public List Property [DataMember] public List Concept { - get { if(_Concept==null) _Concept = new List(); return _Concept; } + get => _Concept ?? new List(); set { _Concept = value; OnPropertyChanged("Concept"); } } @@ -783,12 +751,12 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirString)DefinitionElement.DeepCopyInternal(); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Concept.Any()) dest.Concept = new List(Concept.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirString)_DefinitionElement.DeepCopyInternal(); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Concept is not null) dest.Concept = new List(_Concept.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -800,16 +768,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptDefinitionComponent; - if(otherT == null) return false; + if(other is not ConceptDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Concept, otherT.Concept)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; return true; } @@ -921,13 +888,10 @@ public Hl7.Fhir.Model.Code LanguageElement [IgnoreDataMember] public string Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -958,7 +922,7 @@ public Hl7.Fhir.Model.Coding Use [DataMember] public List AdditionalUse { - get { if(_AdditionalUse==null) _AdditionalUse = new List(); return _AdditionalUse; } + get => _AdditionalUse ?? new List(); set { _AdditionalUse = value; OnPropertyChanged("AdditionalUse"); } } @@ -985,13 +949,10 @@ public Hl7.Fhir.Model.FhirString ValueElement [IgnoreDataMember] public string Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -1006,10 +967,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.Coding)Use.DeepCopyInternal(); - if(AdditionalUse.Any()) dest.AdditionalUse = new List(AdditionalUse.DeepCopyInternal()); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.Coding)_Use.DeepCopyInternal(); + if(_AdditionalUse is not null) dest.AdditionalUse = new List(_AdditionalUse.DeepCopyInternal()); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1021,14 +982,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationComponent; - if(otherT == null) return false; + if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; - if(!comparer.ListEquals(AdditionalUse, otherT.AdditionalUse)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; + if(!comparer.ListEquals(_AdditionalUse, otherT._AdditionalUse)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; return true; } @@ -1125,13 +1085,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1162,8 +1119,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1175,12 +1132,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptPropertyComponent; - if(otherT == null) return false; + if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; return true; } @@ -1246,13 +1202,10 @@ public Hl7.Fhir.Model.FhirUri UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1265,7 +1218,7 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1291,13 +1244,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1340,13 +1290,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1371,13 +1318,10 @@ public Hl7.Fhir.Model.FhirString TitleElement [IgnoreDataMember] public string Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1405,13 +1349,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1436,13 +1377,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1467,13 +1405,10 @@ public Hl7.Fhir.Model.FhirDateTime DateElement [IgnoreDataMember] public string Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1498,13 +1433,10 @@ public Hl7.Fhir.Model.FhirString PublisherElement [IgnoreDataMember] public string Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1517,7 +1449,7 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1543,13 +1475,10 @@ public Hl7.Fhir.Model.Markdown DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1562,7 +1491,7 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1577,7 +1506,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1603,13 +1532,10 @@ public Hl7.Fhir.Model.Markdown PurposeElement [IgnoreDataMember] public string Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1634,13 +1560,10 @@ public Hl7.Fhir.Model.Markdown CopyrightElement [IgnoreDataMember] public string Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1668,13 +1591,10 @@ public Hl7.Fhir.Model.FhirString CopyrightLabelElement [IgnoreDataMember] public string CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1702,13 +1622,10 @@ public Hl7.Fhir.Model.Date ApprovalDateElement [IgnoreDataMember] public string ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1736,13 +1653,10 @@ public Hl7.Fhir.Model.Date LastReviewDateElement [IgnoreDataMember] public string LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1775,7 +1689,7 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1792,7 +1706,7 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } @@ -1809,7 +1723,7 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1826,7 +1740,7 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1843,7 +1757,7 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1860,7 +1774,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1886,13 +1800,10 @@ public Hl7.Fhir.Model.FhirBoolean CaseSensitiveElement [IgnoreDataMember] public bool? CaseSensitive { - get { return CaseSensitiveElement != null ? CaseSensitiveElement.Value : null; } + get => _CaseSensitiveElement?.Value; set { - if (value == null) - CaseSensitiveElement = null; - else - CaseSensitiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + CaseSensitiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("CaseSensitive"); } } @@ -1917,13 +1828,10 @@ public Hl7.Fhir.Model.Canonical ValueSetElement [IgnoreDataMember] public string ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -1950,13 +1858,10 @@ public Code HierarchyMeani [IgnoreDataMember] public Hl7.Fhir.Model.CodeSystem.CodeSystemHierarchyMeaning? HierarchyMeaning { - get { return HierarchyMeaningElement != null ? HierarchyMeaningElement.Value : null; } + get => _HierarchyMeaningElement?.Value; set { - if (value == null) - HierarchyMeaningElement = null; - else - HierarchyMeaningElement = new Code(value); + HierarchyMeaningElement = value is null ? null : new Code(value); OnPropertyChanged("HierarchyMeaning"); } } @@ -1981,13 +1886,10 @@ public Hl7.Fhir.Model.FhirBoolean CompositionalElement [IgnoreDataMember] public bool? Compositional { - get { return CompositionalElement != null ? CompositionalElement.Value : null; } + get => _CompositionalElement?.Value; set { - if (value == null) - CompositionalElement = null; - else - CompositionalElement = new Hl7.Fhir.Model.FhirBoolean(value); + CompositionalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Compositional"); } } @@ -2012,13 +1914,10 @@ public Hl7.Fhir.Model.FhirBoolean VersionNeededElement [IgnoreDataMember] public bool? VersionNeeded { - get { return VersionNeededElement != null ? VersionNeededElement.Value : null; } + get => _VersionNeededElement?.Value; set { - if (value == null) - VersionNeededElement = null; - else - VersionNeededElement = new Hl7.Fhir.Model.FhirBoolean(value); + VersionNeededElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("VersionNeeded"); } } @@ -2046,13 +1945,10 @@ public Code ContentElement [IgnoreDataMember] public Hl7.Fhir.Model.CodeSystemContentMode? Content { - get { return ContentElement != null ? ContentElement.Value : null; } + get => _ContentElement?.Value; set { - if (value == null) - ContentElement = null; - else - ContentElement = new Code(value); + ContentElement = value is null ? null : new Code(value); OnPropertyChanged("Content"); } } @@ -2077,13 +1973,10 @@ public Hl7.Fhir.Model.Canonical SupplementsElement [IgnoreDataMember] public string Supplements { - get { return SupplementsElement != null ? SupplementsElement.Value : null; } + get => _SupplementsElement?.Value; set { - if (value == null) - SupplementsElement = null; - else - SupplementsElement = new Hl7.Fhir.Model.Canonical(value); + SupplementsElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Supplements"); } } @@ -2108,13 +2001,10 @@ public Hl7.Fhir.Model.UnsignedInt CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.UnsignedInt(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Count"); } } @@ -2127,7 +2017,7 @@ public int? Count [DataMember] public List Filter { - get { if(_Filter==null) _Filter = new List(); return _Filter; } + get => _Filter ?? new List(); set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -2141,7 +2031,7 @@ public List Filter [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } @@ -2155,7 +2045,7 @@ public List Property [DataMember] public List Concept { - get { if(_Concept==null) _Concept = new List(); return _Concept; } + get => _Concept ?? new List(); set { _Concept = value; OnPropertyChanged("Concept"); } } @@ -2173,43 +2063,43 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(CaseSensitiveElement != null) dest.CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean)CaseSensitiveElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(HierarchyMeaningElement != null) dest.HierarchyMeaningElement = (Code)HierarchyMeaningElement.DeepCopyInternal(); - if(CompositionalElement != null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)CompositionalElement.DeepCopyInternal(); - if(VersionNeededElement != null) dest.VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean)VersionNeededElement.DeepCopyInternal(); - if(ContentElement != null) dest.ContentElement = (Code)ContentElement.DeepCopyInternal(); - if(SupplementsElement != null) dest.SupplementsElement = (Hl7.Fhir.Model.Canonical)SupplementsElement.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.UnsignedInt)CountElement.DeepCopyInternal(); - if(Filter.Any()) dest.Filter = new List(Filter.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Concept.Any()) dest.Concept = new List(Concept.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_CaseSensitiveElement is not null) dest.CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean)_CaseSensitiveElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_HierarchyMeaningElement is not null) dest.HierarchyMeaningElement = (Code)_HierarchyMeaningElement.DeepCopyInternal(); + if(_CompositionalElement is not null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)_CompositionalElement.DeepCopyInternal(); + if(_VersionNeededElement is not null) dest.VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean)_VersionNeededElement.DeepCopyInternal(); + if(_ContentElement is not null) dest.ContentElement = (Code)_ContentElement.DeepCopyInternal(); + if(_SupplementsElement is not null) dest.SupplementsElement = (Hl7.Fhir.Model.Canonical)_SupplementsElement.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.UnsignedInt)_CountElement.DeepCopyInternal(); + if(_Filter is not null) dest.Filter = new List(_Filter.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Concept is not null) dest.Concept = new List(_Concept.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2221,47 +2111,46 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeSystem; - if(otherT == null) return false; + if(other is not CodeSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(CaseSensitiveElement, otherT.CaseSensitiveElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.Equals(HierarchyMeaningElement, otherT.HierarchyMeaningElement)) return false; - if(!comparer.Equals(CompositionalElement, otherT.CompositionalElement)) return false; - if(!comparer.Equals(VersionNeededElement, otherT.VersionNeededElement)) return false; - if(!comparer.Equals(ContentElement, otherT.ContentElement)) return false; - if(!comparer.Equals(SupplementsElement, otherT.SupplementsElement)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.ListEquals(Filter, otherT.Filter)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Concept, otherT.Concept)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_CaseSensitiveElement, otherT._CaseSensitiveElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.Equals(_HierarchyMeaningElement, otherT._HierarchyMeaningElement)) return false; + if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; + if(!comparer.Equals(_VersionNeededElement, otherT._VersionNeededElement)) return false; + if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; + if(!comparer.Equals(_SupplementsElement, otherT._SupplementsElement)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs index 49407264a..17517ec1d 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs @@ -325,7 +325,7 @@ public partial class SlicingComponent : Hl7.Fhir.Model.Element [DataMember] public List Discriminator { - get { if(_Discriminator==null) _Discriminator = new List(); return _Discriminator; } + get => _Discriminator ?? new List(); set { _Discriminator = value; OnPropertyChanged("Discriminator"); } } @@ -351,13 +351,10 @@ public Hl7.Fhir.Model.FhirString DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -382,13 +379,10 @@ public Hl7.Fhir.Model.FhirBoolean OrderedElement [IgnoreDataMember] public bool? Ordered { - get { return OrderedElement != null ? OrderedElement.Value : null; } + get => _OrderedElement?.Value; set { - if (value == null) - OrderedElement = null; - else - OrderedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OrderedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Ordered"); } } @@ -416,13 +410,10 @@ public Code RulesElement [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.SlicingRules? Rules { - get { return RulesElement != null ? RulesElement.Value : null; } + get => _RulesElement?.Value; set { - if (value == null) - RulesElement = null; - else - RulesElement = new Code(value); + RulesElement = value is null ? null : new Code(value); OnPropertyChanged("Rules"); } } @@ -437,10 +428,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(Discriminator.Any()) dest.Discriminator = new List(Discriminator.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OrderedElement != null) dest.OrderedElement = (Hl7.Fhir.Model.FhirBoolean)OrderedElement.DeepCopyInternal(); - if(RulesElement != null) dest.RulesElement = (Code)RulesElement.DeepCopyInternal(); + if(_Discriminator is not null) dest.Discriminator = new List(_Discriminator.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OrderedElement is not null) dest.OrderedElement = (Hl7.Fhir.Model.FhirBoolean)_OrderedElement.DeepCopyInternal(); + if(_RulesElement is not null) dest.RulesElement = (Code)_RulesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -452,14 +443,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SlicingComponent; - if(otherT == null) return false; + if(other is not SlicingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Discriminator, otherT.Discriminator)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(OrderedElement, otherT.OrderedElement)) return false; - if(!comparer.Equals(RulesElement, otherT.RulesElement)) return false; + if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_OrderedElement, otherT._OrderedElement)) return false; + if(!comparer.Equals(_RulesElement, otherT._RulesElement)) return false; return true; } @@ -559,13 +549,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.DiscriminatorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -591,13 +578,10 @@ public Hl7.Fhir.Model.FhirString PathElement [IgnoreDataMember] public string Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -612,8 +596,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -625,12 +609,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiscriminatorComponent; - if(otherT == null) return false; + if(other is not DiscriminatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; return true; } @@ -714,13 +697,10 @@ public Hl7.Fhir.Model.FhirString PathElement [IgnoreDataMember] public string Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -746,13 +726,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -778,13 +755,10 @@ public Hl7.Fhir.Model.FhirString MaxElement [IgnoreDataMember] public string Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -799,9 +773,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -813,13 +787,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BaseComponent; - if(otherT == null) return false; + if(other is not BaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; return true; } @@ -911,13 +884,10 @@ public Hl7.Fhir.Model.FhirUri CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.FhirUri(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Code"); } } @@ -930,7 +900,7 @@ public string Code [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -962,7 +932,7 @@ public IEnumerable Profile [DataMember] public List TargetProfileElement { - get { if(_TargetProfileElement==null) _TargetProfileElement = new List(); return _TargetProfileElement; } + get => _TargetProfileElement ?? new List(); set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } @@ -996,7 +966,7 @@ public IEnumerable TargetProfile [DataMember] public List> AggregationElement { - get { if(_AggregationElement==null) _AggregationElement = new List>(); return _AggregationElement; } + get => _AggregationElement ?? new List>(); set { _AggregationElement = value; OnPropertyChanged("AggregationElement"); } } @@ -1042,13 +1012,10 @@ public Code VersioningEl [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.ReferenceVersionRules? Versioning { - get { return VersioningElement != null ? VersioningElement.Value : null; } + get => _VersioningElement?.Value; set { - if (value == null) - VersioningElement = null; - else - VersioningElement = new Code(value); + VersioningElement = value is null ? null : new Code(value); OnPropertyChanged("Versioning"); } } @@ -1063,11 +1030,11 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.FhirUri)CodeElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(TargetProfileElement.Any()) dest.TargetProfileElement = new List(TargetProfileElement.DeepCopyInternal()); - if(AggregationElement.Any()) dest.AggregationElement = new List>(AggregationElement.DeepCopyInternal()); - if(VersioningElement != null) dest.VersioningElement = (Code)VersioningElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.FhirUri)_CodeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_TargetProfileElement is not null) dest.TargetProfileElement = new List(_TargetProfileElement.DeepCopyInternal()); + if(_AggregationElement is not null) dest.AggregationElement = new List>(_AggregationElement.DeepCopyInternal()); + if(_VersioningElement is not null) dest.VersioningElement = (Code)_VersioningElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1079,15 +1046,14 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TypeRefComponent; - if(otherT == null) return false; + if(other is not TypeRefComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(TargetProfileElement, otherT.TargetProfileElement)) return false; - if(!comparer.ListEquals(AggregationElement, otherT.AggregationElement)) return false; - if(!comparer.Equals(VersioningElement, otherT.VersioningElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_TargetProfileElement, otherT._TargetProfileElement)) return false; + if(!comparer.ListEquals(_AggregationElement, otherT._AggregationElement)) return false; + if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false; return true; } @@ -1192,13 +1158,10 @@ public Hl7.Fhir.Model.FhirString LabelElement [IgnoreDataMember] public string Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -1227,8 +1190,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1240,12 +1203,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExampleComponent; - if(otherT == null) return false; + if(other is not ExampleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; return true; } @@ -1329,13 +1291,10 @@ public Hl7.Fhir.Model.Id KeyElement [IgnoreDataMember] public string Key { - get { return KeyElement != null ? KeyElement.Value : null; } + get => _KeyElement?.Value; set { - if (value == null) - KeyElement = null; - else - KeyElement = new Hl7.Fhir.Model.Id(value); + KeyElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Key"); } } @@ -1370,13 +1329,10 @@ public Hl7.Fhir.Model.PrimitiveType RequirementsElement [IgnoreDataMember] public string RequirementsString { - get { return RequirementsElement != null ? ((IValue)RequirementsElement).Value : null; } + get => ((IValue)_RequirementsElement)?.Value; set { - if (value == null) - RequirementsElement = null; - else - RequirementsElement = new Hl7.Fhir.Model.FhirString(value); + RequirementsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RequirementsString"); } } @@ -1388,13 +1344,10 @@ public string RequirementsString [IgnoreDataMember] public string Requirements { - get { return RequirementsElement != null ? ((IValue)RequirementsElement).Value : null; } + get => ((IValue)_RequirementsElement)?.Value; set { - if (value == null) - RequirementsElement = null; - else - RequirementsElement = new Hl7.Fhir.Model.Markdown(value); + RequirementsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Requirements"); } } @@ -1422,13 +1375,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.ConstraintSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -1456,13 +1406,10 @@ public Hl7.Fhir.Model.FhirBoolean SuppressElement [IgnoreDataMember] public bool? Suppress { - get { return SuppressElement != null ? SuppressElement.Value : null; } + get => _SuppressElement?.Value; set { - if (value == null) - SuppressElement = null; - else - SuppressElement = new Hl7.Fhir.Model.FhirBoolean(value); + SuppressElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Suppress"); } } @@ -1488,13 +1435,10 @@ public Hl7.Fhir.Model.FhirString HumanElement [IgnoreDataMember] public string Human { - get { return HumanElement != null ? HumanElement.Value : null; } + get => _HumanElement?.Value; set { - if (value == null) - HumanElement = null; - else - HumanElement = new Hl7.Fhir.Model.FhirString(value); + HumanElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Human"); } } @@ -1519,13 +1463,10 @@ public Hl7.Fhir.Model.FhirString ExpressionElement [IgnoreDataMember] public string Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -1554,13 +1495,10 @@ public Hl7.Fhir.Model.FhirString XpathElement [IgnoreDataMember] public string Xpath { - get { return XpathElement != null ? XpathElement.Value : null; } + get => _XpathElement?.Value; set { - if (value == null) - XpathElement = null; - else - XpathElement = new Hl7.Fhir.Model.FhirString(value); + XpathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Xpath"); } } @@ -1585,13 +1523,10 @@ public Hl7.Fhir.Model.Canonical SourceElement [IgnoreDataMember] public string Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.Canonical(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Source"); } } @@ -1606,14 +1541,14 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(KeyElement != null) dest.KeyElement = (Hl7.Fhir.Model.Id)KeyElement.DeepCopyInternal(); - if(RequirementsElement != null) dest.RequirementsElement = (Hl7.Fhir.Model.PrimitiveType)RequirementsElement.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(SuppressElement != null) dest.SuppressElement = (Hl7.Fhir.Model.FhirBoolean)SuppressElement.DeepCopyInternal(); - if(HumanElement != null) dest.HumanElement = (Hl7.Fhir.Model.FhirString)HumanElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(XpathElement != null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)XpathElement.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.Canonical)SourceElement.DeepCopyInternal(); + if(_KeyElement is not null) dest.KeyElement = (Hl7.Fhir.Model.Id)_KeyElement.DeepCopyInternal(); + if(_RequirementsElement is not null) dest.RequirementsElement = (Hl7.Fhir.Model.PrimitiveType)_RequirementsElement.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_SuppressElement is not null) dest.SuppressElement = (Hl7.Fhir.Model.FhirBoolean)_SuppressElement.DeepCopyInternal(); + if(_HumanElement is not null) dest.HumanElement = (Hl7.Fhir.Model.FhirString)_HumanElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_XpathElement is not null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)_XpathElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.Canonical)_SourceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1625,18 +1560,17 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConstraintComponent; - if(otherT == null) return false; + if(other is not ConstraintComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KeyElement, otherT.KeyElement)) return false; - if(!comparer.Equals(RequirementsElement, otherT.RequirementsElement)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(SuppressElement, otherT.SuppressElement)) return false; - if(!comparer.Equals(HumanElement, otherT.HumanElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(XpathElement, otherT.XpathElement)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; + if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + if(!comparer.Equals(_RequirementsElement, otherT._RequirementsElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_SuppressElement, otherT._SuppressElement)) return false; + if(!comparer.Equals(_HumanElement, otherT._HumanElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; return true; } @@ -1764,13 +1698,10 @@ public Code StrengthElement [IgnoreDataMember] public Hl7.Fhir.Model.BindingStrength? Strength { - get { return StrengthElement != null ? StrengthElement.Value : null; } + get => _StrengthElement?.Value; set { - if (value == null) - StrengthElement = null; - else - StrengthElement = new Code(value); + StrengthElement = value is null ? null : new Code(value); OnPropertyChanged("Strength"); } } @@ -1805,13 +1736,10 @@ public Hl7.Fhir.Model.PrimitiveType DescriptionElement [IgnoreDataMember] public string DescriptionString { - get { return DescriptionElement != null ? ((IValue)DescriptionElement).Value : null; } + get => ((IValue)_DescriptionElement)?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DescriptionString"); } } @@ -1823,13 +1751,10 @@ public string DescriptionString [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? ((IValue)DescriptionElement).Value : null; } + get => ((IValue)_DescriptionElement)?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1854,13 +1779,10 @@ public Hl7.Fhir.Model.Canonical ValueSetElement [IgnoreDataMember] public string ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -1876,7 +1798,7 @@ public string ValueSet [DataMember] public List Additional { - get { if(_Additional==null) _Additional = new List(); return _Additional; } + get => _Additional ?? new List(); set { _Additional = value; OnPropertyChanged("Additional"); } } @@ -1892,10 +1814,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(StrengthElement != null) dest.StrengthElement = (Code)StrengthElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)DescriptionElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(Additional.Any()) dest.Additional = new List(Additional.DeepCopyInternal()); + if(_StrengthElement is not null) dest.StrengthElement = (Code)_StrengthElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)_DescriptionElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_Additional is not null) dest.Additional = new List(_Additional.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1907,14 +1829,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ElementDefinitionBindingComponent; - if(otherT == null) return false; + if(other is not ElementDefinitionBindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StrengthElement, otherT.StrengthElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.ListEquals(Additional, otherT.Additional)) return false; + if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.ListEquals(_Additional, otherT._Additional)) return false; return true; } @@ -2016,13 +1937,10 @@ public Code Purpose [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.AdditionalBindingPurposeVS? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Code(value); + PurposeElement = value is null ? null : new Code(value); OnPropertyChanged("Purpose"); } } @@ -2051,13 +1969,10 @@ public Hl7.Fhir.Model.Canonical ValueSetElement [IgnoreDataMember] public string ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -2085,13 +2000,10 @@ public Hl7.Fhir.Model.Markdown DocumentationElement [IgnoreDataMember] public string Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -2119,13 +2031,10 @@ public Hl7.Fhir.Model.FhirString ShortDocoElement [IgnoreDataMember] public string ShortDoco { - get { return ShortDocoElement != null ? ShortDocoElement.Value : null; } + get => _ShortDocoElement?.Value; set { - if (value == null) - ShortDocoElement = null; - else - ShortDocoElement = new Hl7.Fhir.Model.FhirString(value); + ShortDocoElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortDoco"); } } @@ -2141,7 +2050,7 @@ public string ShortDoco [DataMember] public List Usage { - get { if(_Usage==null) _Usage = new List(); return _Usage; } + get => _Usage ?? new List(); set { _Usage = value; OnPropertyChanged("Usage"); } } @@ -2170,13 +2079,10 @@ public Hl7.Fhir.Model.FhirBoolean AnyElement [IgnoreDataMember] public bool? Any { - get { return AnyElement != null ? AnyElement.Value : null; } + get => _AnyElement?.Value; set { - if (value == null) - AnyElement = null; - else - AnyElement = new Hl7.Fhir.Model.FhirBoolean(value); + AnyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Any"); } } @@ -2191,12 +2097,12 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(PurposeElement != null) dest.PurposeElement = (Code)PurposeElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(ShortDocoElement != null) dest.ShortDocoElement = (Hl7.Fhir.Model.FhirString)ShortDocoElement.DeepCopyInternal(); - if(Usage.Any()) dest.Usage = new List(Usage.DeepCopyInternal()); - if(AnyElement != null) dest.AnyElement = (Hl7.Fhir.Model.FhirBoolean)AnyElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Code)_PurposeElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_ShortDocoElement is not null) dest.ShortDocoElement = (Hl7.Fhir.Model.FhirString)_ShortDocoElement.DeepCopyInternal(); + if(_Usage is not null) dest.Usage = new List(_Usage.DeepCopyInternal()); + if(_AnyElement is not null) dest.AnyElement = (Hl7.Fhir.Model.FhirBoolean)_AnyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2208,16 +2114,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdditionalComponent; - if(otherT == null) return false; + if(other is not AdditionalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(ShortDocoElement, otherT.ShortDocoElement)) return false; - if(!comparer.ListEquals(Usage, otherT.Usage)) return false; - if(!comparer.Equals(AnyElement, otherT.AnyElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_ShortDocoElement, otherT._ShortDocoElement)) return false; + if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; + if(!comparer.Equals(_AnyElement, otherT._AnyElement)) return false; return true; } @@ -2329,13 +2234,10 @@ public Hl7.Fhir.Model.Id IdentityElement [IgnoreDataMember] public string Identity { - get { return IdentityElement != null ? IdentityElement.Value : null; } + get => _IdentityElement?.Value; set { - if (value == null) - IdentityElement = null; - else - IdentityElement = new Hl7.Fhir.Model.Id(value); + IdentityElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identity"); } } @@ -2361,13 +2263,10 @@ public Hl7.Fhir.Model.Code LanguageElement [IgnoreDataMember] public string Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -2393,13 +2292,10 @@ public Hl7.Fhir.Model.FhirString MapElement [IgnoreDataMember] public string Map { - get { return MapElement != null ? MapElement.Value : null; } + get => _MapElement?.Value; set { - if (value == null) - MapElement = null; - else - MapElement = new Hl7.Fhir.Model.FhirString(value); + MapElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Map"); } } @@ -2434,13 +2330,10 @@ public Hl7.Fhir.Model.PrimitiveType CommentElement [IgnoreDataMember] public string CommentString { - get { return CommentElement != null ? ((IValue)CommentElement).Value : null; } + get => ((IValue)_CommentElement)?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CommentString"); } } @@ -2452,13 +2345,10 @@ public string CommentString [IgnoreDataMember] public string Comment { - get { return CommentElement != null ? ((IValue)CommentElement).Value : null; } + get => ((IValue)_CommentElement)?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -2473,10 +2363,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(IdentityElement != null) dest.IdentityElement = (Hl7.Fhir.Model.Id)IdentityElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(MapElement != null) dest.MapElement = (Hl7.Fhir.Model.FhirString)MapElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.PrimitiveType)CommentElement.DeepCopyInternal(); + if(_IdentityElement is not null) dest.IdentityElement = (Hl7.Fhir.Model.Id)_IdentityElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_MapElement is not null) dest.MapElement = (Hl7.Fhir.Model.FhirString)_MapElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.PrimitiveType)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2488,14 +2378,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MappingComponent; - if(otherT == null) return false; + if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentityElement, otherT.IdentityElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(MapElement, otherT.MapElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_MapElement, otherT._MapElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; return true; } @@ -2576,13 +2465,10 @@ public Hl7.Fhir.Model.FhirString PathElement [IgnoreDataMember] public string Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -2597,7 +2483,7 @@ public string Path [DataMember] public List> RepresentationElement { - get { if(_RepresentationElement==null) _RepresentationElement = new List>(); return _RepresentationElement; } + get => _RepresentationElement ?? new List>(); set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } @@ -2641,13 +2527,10 @@ public Hl7.Fhir.Model.FhirString SliceNameElement [IgnoreDataMember] public string SliceName { - get { return SliceNameElement != null ? SliceNameElement.Value : null; } + get => _SliceNameElement?.Value; set { - if (value == null) - SliceNameElement = null; - else - SliceNameElement = new Hl7.Fhir.Model.FhirString(value); + SliceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SliceName"); } } @@ -2672,13 +2555,10 @@ public Hl7.Fhir.Model.FhirBoolean SliceIsConstrainingElement [IgnoreDataMember] public bool? SliceIsConstraining { - get { return SliceIsConstrainingElement != null ? SliceIsConstrainingElement.Value : null; } + get => _SliceIsConstrainingElement?.Value; set { - if (value == null) - SliceIsConstrainingElement = null; - else - SliceIsConstrainingElement = new Hl7.Fhir.Model.FhirBoolean(value); + SliceIsConstrainingElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("SliceIsConstraining"); } } @@ -2703,13 +2583,10 @@ public Hl7.Fhir.Model.FhirString LabelElement [IgnoreDataMember] public string Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2723,7 +2600,7 @@ public string Label [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } @@ -2762,13 +2639,10 @@ public Hl7.Fhir.Model.FhirString ShortElement [IgnoreDataMember] public string Short { - get { return ShortElement != null ? ShortElement.Value : null; } + get => _ShortElement?.Value; set { - if (value == null) - ShortElement = null; - else - ShortElement = new Hl7.Fhir.Model.FhirString(value); + ShortElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Short"); } } @@ -2793,13 +2667,10 @@ public Hl7.Fhir.Model.Markdown DefinitionElement [IgnoreDataMember] public string Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Markdown(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Definition"); } } @@ -2824,13 +2695,10 @@ public Hl7.Fhir.Model.Markdown CommentElement [IgnoreDataMember] public string Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -2855,13 +2723,10 @@ public Hl7.Fhir.Model.Markdown RequirementsElement [IgnoreDataMember] public string Requirements { - get { return RequirementsElement != null ? RequirementsElement.Value : null; } + get => _RequirementsElement?.Value; set { - if (value == null) - RequirementsElement = null; - else - RequirementsElement = new Hl7.Fhir.Model.Markdown(value); + RequirementsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Requirements"); } } @@ -2874,7 +2739,7 @@ public string Requirements [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -2918,13 +2783,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -2949,13 +2811,10 @@ public Hl7.Fhir.Model.FhirString MaxElement [IgnoreDataMember] public string Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -2993,13 +2852,10 @@ public Hl7.Fhir.Model.FhirUri ContentReferenceElement [IgnoreDataMember] public string ContentReference { - get { return ContentReferenceElement != null ? ContentReferenceElement.Value : null; } + get => _ContentReferenceElement?.Value; set { - if (value == null) - ContentReferenceElement = null; - else - ContentReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ContentReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("ContentReference"); } } @@ -3012,7 +2868,7 @@ public string ContentReference [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } @@ -3051,13 +2907,10 @@ public Hl7.Fhir.Model.Markdown MeaningWhenMissingElement [IgnoreDataMember] public string MeaningWhenMissing { - get { return MeaningWhenMissingElement != null ? MeaningWhenMissingElement.Value : null; } + get => _MeaningWhenMissingElement?.Value; set { - if (value == null) - MeaningWhenMissingElement = null; - else - MeaningWhenMissingElement = new Hl7.Fhir.Model.Markdown(value); + MeaningWhenMissingElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("MeaningWhenMissing"); } } @@ -3082,13 +2935,10 @@ public Hl7.Fhir.Model.FhirString OrderMeaningElement [IgnoreDataMember] public string OrderMeaning { - get { return OrderMeaningElement != null ? OrderMeaningElement.Value : null; } + get => _OrderMeaningElement?.Value; set { - if (value == null) - OrderMeaningElement = null; - else - OrderMeaningElement = new Hl7.Fhir.Model.FhirString(value); + OrderMeaningElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OrderMeaning"); } } @@ -3127,7 +2977,7 @@ public Hl7.Fhir.Model.DataType Pattern [DataMember] public List Example { - get { if(_Example==null) _Example = new List(); return _Example; } + get => _Example ?? new List(); set { _Example = value; OnPropertyChanged("Example"); } } @@ -3183,13 +3033,10 @@ public Hl7.Fhir.Model.Integer MaxLengthElement [IgnoreDataMember] public int? MaxLength { - get { return MaxLengthElement != null ? MaxLengthElement.Value : null; } + get => _MaxLengthElement?.Value; set { - if (value == null) - MaxLengthElement = null; - else - MaxLengthElement = new Hl7.Fhir.Model.Integer(value); + MaxLengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("MaxLength"); } } @@ -3202,7 +3049,7 @@ public int? MaxLength [DataMember] public List ConditionElement { - get { if(_ConditionElement==null) _ConditionElement = new List(); return _ConditionElement; } + get => _ConditionElement ?? new List(); set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } @@ -3234,7 +3081,7 @@ public IEnumerable Condition [DataMember] public List Constraint { - get { if(_Constraint==null) _Constraint = new List(); return _Constraint; } + get => _Constraint ?? new List(); set { _Constraint = value; OnPropertyChanged("Constraint"); } } @@ -3263,13 +3110,10 @@ public Hl7.Fhir.Model.FhirBoolean MustHaveValueElement [IgnoreDataMember] public bool? MustHaveValue { - get { return MustHaveValueElement != null ? MustHaveValueElement.Value : null; } + get => _MustHaveValueElement?.Value; set { - if (value == null) - MustHaveValueElement = null; - else - MustHaveValueElement = new Hl7.Fhir.Model.FhirBoolean(value); + MustHaveValueElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MustHaveValue"); } } @@ -3285,7 +3129,7 @@ public bool? MustHaveValue [DataMember] public List ValueAlternativesElement { - get { if(_ValueAlternativesElement==null) _ValueAlternativesElement = new List(); return _ValueAlternativesElement; } + get => _ValueAlternativesElement ?? new List(); set { _ValueAlternativesElement = value; OnPropertyChanged("ValueAlternativesElement"); } } @@ -3329,13 +3173,10 @@ public Hl7.Fhir.Model.FhirBoolean MustSupportElement [IgnoreDataMember] public bool? MustSupport { - get { return MustSupportElement != null ? MustSupportElement.Value : null; } + get => _MustSupportElement?.Value; set { - if (value == null) - MustSupportElement = null; - else - MustSupportElement = new Hl7.Fhir.Model.FhirBoolean(value); + MustSupportElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MustSupport"); } } @@ -3360,13 +3201,10 @@ public Hl7.Fhir.Model.FhirBoolean IsModifierElement [IgnoreDataMember] public bool? IsModifier { - get { return IsModifierElement != null ? IsModifierElement.Value : null; } + get => _IsModifierElement?.Value; set { - if (value == null) - IsModifierElement = null; - else - IsModifierElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsModifierElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsModifier"); } } @@ -3391,13 +3229,10 @@ public Hl7.Fhir.Model.FhirString IsModifierReasonElement [IgnoreDataMember] public string IsModifierReason { - get { return IsModifierReasonElement != null ? IsModifierReasonElement.Value : null; } + get => _IsModifierReasonElement?.Value; set { - if (value == null) - IsModifierReasonElement = null; - else - IsModifierReasonElement = new Hl7.Fhir.Model.FhirString(value); + IsModifierReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IsModifierReason"); } } @@ -3422,13 +3257,10 @@ public Hl7.Fhir.Model.FhirBoolean IsSummaryElement [IgnoreDataMember] public bool? IsSummary { - get { return IsSummaryElement != null ? IsSummaryElement.Value : null; } + get => _IsSummaryElement?.Value; set { - if (value == null) - IsSummaryElement = null; - else - IsSummaryElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsSummaryElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsSummary"); } } @@ -3454,7 +3286,7 @@ public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent Bindin [DataMember] public List Mapping { - get { if(_Mapping==null) _Mapping = new List(); return _Mapping; } + get => _Mapping ?? new List(); set { _Mapping = value; OnPropertyChanged("Mapping"); } } @@ -3470,42 +3302,42 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(RepresentationElement.Any()) dest.RepresentationElement = new List>(RepresentationElement.DeepCopyInternal()); - if(SliceNameElement != null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)SliceNameElement.DeepCopyInternal(); - if(SliceIsConstrainingElement != null) dest.SliceIsConstrainingElement = (Hl7.Fhir.Model.FhirBoolean)SliceIsConstrainingElement.DeepCopyInternal(); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Slicing != null) dest.Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent)Slicing.DeepCopyInternal(); - if(ShortElement != null) dest.ShortElement = (Hl7.Fhir.Model.FhirString)ShortElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Markdown)DefinitionElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(RequirementsElement != null) dest.RequirementsElement = (Hl7.Fhir.Model.Markdown)RequirementsElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(Base != null) dest.Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent)Base.DeepCopyInternal(); - if(ContentReferenceElement != null) dest.ContentReferenceElement = (Hl7.Fhir.Model.FhirUri)ContentReferenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DefaultValue != null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)DefaultValue.DeepCopyInternal(); - if(MeaningWhenMissingElement != null) dest.MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown)MeaningWhenMissingElement.DeepCopyInternal(); - if(OrderMeaningElement != null) dest.OrderMeaningElement = (Hl7.Fhir.Model.FhirString)OrderMeaningElement.DeepCopyInternal(); - if(Fixed != null) dest.Fixed = (Hl7.Fhir.Model.DataType)Fixed.DeepCopyInternal(); - if(Pattern != null) dest.Pattern = (Hl7.Fhir.Model.DataType)Pattern.DeepCopyInternal(); - if(Example.Any()) dest.Example = new List(Example.DeepCopyInternal()); - if(MinValue != null) dest.MinValue = (Hl7.Fhir.Model.DataType)MinValue.DeepCopyInternal(); - if(MaxValue != null) dest.MaxValue = (Hl7.Fhir.Model.DataType)MaxValue.DeepCopyInternal(); - if(MaxLengthElement != null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)MaxLengthElement.DeepCopyInternal(); - if(ConditionElement.Any()) dest.ConditionElement = new List(ConditionElement.DeepCopyInternal()); - if(Constraint.Any()) dest.Constraint = new List(Constraint.DeepCopyInternal()); - if(MustHaveValueElement != null) dest.MustHaveValueElement = (Hl7.Fhir.Model.FhirBoolean)MustHaveValueElement.DeepCopyInternal(); - if(ValueAlternativesElement.Any()) dest.ValueAlternativesElement = new List(ValueAlternativesElement.DeepCopyInternal()); - if(MustSupportElement != null) dest.MustSupportElement = (Hl7.Fhir.Model.FhirBoolean)MustSupportElement.DeepCopyInternal(); - if(IsModifierElement != null) dest.IsModifierElement = (Hl7.Fhir.Model.FhirBoolean)IsModifierElement.DeepCopyInternal(); - if(IsModifierReasonElement != null) dest.IsModifierReasonElement = (Hl7.Fhir.Model.FhirString)IsModifierReasonElement.DeepCopyInternal(); - if(IsSummaryElement != null) dest.IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean)IsSummaryElement.DeepCopyInternal(); - if(Binding != null) dest.Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent)Binding.DeepCopyInternal(); - if(Mapping.Any()) dest.Mapping = new List(Mapping.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_RepresentationElement is not null) dest.RepresentationElement = new List>(_RepresentationElement.DeepCopyInternal()); + if(_SliceNameElement is not null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)_SliceNameElement.DeepCopyInternal(); + if(_SliceIsConstrainingElement is not null) dest.SliceIsConstrainingElement = (Hl7.Fhir.Model.FhirBoolean)_SliceIsConstrainingElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Slicing is not null) dest.Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent)_Slicing.DeepCopyInternal(); + if(_ShortElement is not null) dest.ShortElement = (Hl7.Fhir.Model.FhirString)_ShortElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Markdown)_DefinitionElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_RequirementsElement is not null) dest.RequirementsElement = (Hl7.Fhir.Model.Markdown)_RequirementsElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_Base is not null) dest.Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent)_Base.DeepCopyInternal(); + if(_ContentReferenceElement is not null) dest.ContentReferenceElement = (Hl7.Fhir.Model.FhirUri)_ContentReferenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DefaultValue is not null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)_DefaultValue.DeepCopyInternal(); + if(_MeaningWhenMissingElement is not null) dest.MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown)_MeaningWhenMissingElement.DeepCopyInternal(); + if(_OrderMeaningElement is not null) dest.OrderMeaningElement = (Hl7.Fhir.Model.FhirString)_OrderMeaningElement.DeepCopyInternal(); + if(_Fixed is not null) dest.Fixed = (Hl7.Fhir.Model.DataType)_Fixed.DeepCopyInternal(); + if(_Pattern is not null) dest.Pattern = (Hl7.Fhir.Model.DataType)_Pattern.DeepCopyInternal(); + if(_Example is not null) dest.Example = new List(_Example.DeepCopyInternal()); + if(_MinValue is not null) dest.MinValue = (Hl7.Fhir.Model.DataType)_MinValue.DeepCopyInternal(); + if(_MaxValue is not null) dest.MaxValue = (Hl7.Fhir.Model.DataType)_MaxValue.DeepCopyInternal(); + if(_MaxLengthElement is not null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)_MaxLengthElement.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = new List(_ConditionElement.DeepCopyInternal()); + if(_Constraint is not null) dest.Constraint = new List(_Constraint.DeepCopyInternal()); + if(_MustHaveValueElement is not null) dest.MustHaveValueElement = (Hl7.Fhir.Model.FhirBoolean)_MustHaveValueElement.DeepCopyInternal(); + if(_ValueAlternativesElement is not null) dest.ValueAlternativesElement = new List(_ValueAlternativesElement.DeepCopyInternal()); + if(_MustSupportElement is not null) dest.MustSupportElement = (Hl7.Fhir.Model.FhirBoolean)_MustSupportElement.DeepCopyInternal(); + if(_IsModifierElement is not null) dest.IsModifierElement = (Hl7.Fhir.Model.FhirBoolean)_IsModifierElement.DeepCopyInternal(); + if(_IsModifierReasonElement is not null) dest.IsModifierReasonElement = (Hl7.Fhir.Model.FhirString)_IsModifierReasonElement.DeepCopyInternal(); + if(_IsSummaryElement is not null) dest.IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean)_IsSummaryElement.DeepCopyInternal(); + if(_Binding is not null) dest.Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent)_Binding.DeepCopyInternal(); + if(_Mapping is not null) dest.Mapping = new List(_Mapping.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3517,46 +3349,45 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ElementDefinition; - if(otherT == null) return false; + if(other is not ElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.ListEquals(RepresentationElement, otherT.RepresentationElement)) return false; - if(!comparer.Equals(SliceNameElement, otherT.SliceNameElement)) return false; - if(!comparer.Equals(SliceIsConstrainingElement, otherT.SliceIsConstrainingElement)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(Slicing, otherT.Slicing)) return false; - if(!comparer.Equals(ShortElement, otherT.ShortElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(RequirementsElement, otherT.RequirementsElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(Base, otherT.Base)) return false; - if(!comparer.Equals(ContentReferenceElement, otherT.ContentReferenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DefaultValue, otherT.DefaultValue)) return false; - if(!comparer.Equals(MeaningWhenMissingElement, otherT.MeaningWhenMissingElement)) return false; - if(!comparer.Equals(OrderMeaningElement, otherT.OrderMeaningElement)) return false; - if(!comparer.Equals(Fixed, otherT.Fixed)) return false; - if(!comparer.Equals(Pattern, otherT.Pattern)) return false; - if(!comparer.ListEquals(Example, otherT.Example)) return false; - if(!comparer.Equals(MinValue, otherT.MinValue)) return false; - if(!comparer.Equals(MaxValue, otherT.MaxValue)) return false; - if(!comparer.Equals(MaxLengthElement, otherT.MaxLengthElement)) return false; - if(!comparer.ListEquals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.ListEquals(Constraint, otherT.Constraint)) return false; - if(!comparer.Equals(MustHaveValueElement, otherT.MustHaveValueElement)) return false; - if(!comparer.ListEquals(ValueAlternativesElement, otherT.ValueAlternativesElement)) return false; - if(!comparer.Equals(MustSupportElement, otherT.MustSupportElement)) return false; - if(!comparer.Equals(IsModifierElement, otherT.IsModifierElement)) return false; - if(!comparer.Equals(IsModifierReasonElement, otherT.IsModifierReasonElement)) return false; - if(!comparer.Equals(IsSummaryElement, otherT.IsSummaryElement)) return false; - if(!comparer.Equals(Binding, otherT.Binding)) return false; - if(!comparer.ListEquals(Mapping, otherT.Mapping)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.ListEquals(_RepresentationElement, otherT._RepresentationElement)) return false; + if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; + if(!comparer.Equals(_SliceIsConstrainingElement, otherT._SliceIsConstrainingElement)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Slicing, otherT._Slicing)) return false; + if(!comparer.Equals(_ShortElement, otherT._ShortElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_RequirementsElement, otherT._RequirementsElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_Base, otherT._Base)) return false; + if(!comparer.Equals(_ContentReferenceElement, otherT._ContentReferenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DefaultValue, otherT._DefaultValue)) return false; + if(!comparer.Equals(_MeaningWhenMissingElement, otherT._MeaningWhenMissingElement)) return false; + if(!comparer.Equals(_OrderMeaningElement, otherT._OrderMeaningElement)) return false; + if(!comparer.Equals(_Fixed, otherT._Fixed)) return false; + if(!comparer.Equals(_Pattern, otherT._Pattern)) return false; + if(!comparer.ListEquals(_Example, otherT._Example)) return false; + if(!comparer.Equals(_MinValue, otherT._MinValue)) return false; + if(!comparer.Equals(_MaxValue, otherT._MaxValue)) return false; + if(!comparer.Equals(_MaxLengthElement, otherT._MaxLengthElement)) return false; + if(!comparer.ListEquals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.ListEquals(_Constraint, otherT._Constraint)) return false; + if(!comparer.Equals(_MustHaveValueElement, otherT._MustHaveValueElement)) return false; + if(!comparer.ListEquals(_ValueAlternativesElement, otherT._ValueAlternativesElement)) return false; + if(!comparer.Equals(_MustSupportElement, otherT._MustSupportElement)) return false; + if(!comparer.Equals(_IsModifierElement, otherT._IsModifierElement)) return false; + if(!comparer.Equals(_IsModifierReasonElement, otherT._IsModifierReasonElement)) return false; + if(!comparer.Equals(_IsSummaryElement, otherT._IsSummaryElement)) return false; + if(!comparer.Equals(_Binding, otherT._Binding)) return false; + if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs index 679f73c32..faffc5b40 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs @@ -309,13 +309,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.RelatedArtifact.RelatedArtifactType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -332,7 +329,7 @@ public Hl7.Fhir.Model.RelatedArtifact.RelatedArtifactType? Type [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -358,13 +355,10 @@ public Hl7.Fhir.Model.FhirString LabelElement [IgnoreDataMember] public string Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -389,13 +383,10 @@ public Hl7.Fhir.Model.FhirString DisplayElement [IgnoreDataMember] public string Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -420,13 +411,10 @@ public Hl7.Fhir.Model.Markdown CitationElement [IgnoreDataMember] public string Citation { - get { return CitationElement != null ? CitationElement.Value : null; } + get => _CitationElement?.Value; set { - if (value == null) - CitationElement = null; - else - CitationElement = new Hl7.Fhir.Model.Markdown(value); + CitationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Citation"); } } @@ -455,13 +443,10 @@ public Hl7.Fhir.Model.FhirUrl UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } @@ -499,13 +484,10 @@ public Hl7.Fhir.Model.Canonical ResourceElement [IgnoreDataMember] public string Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.Canonical(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Resource"); } } @@ -553,13 +535,10 @@ public Code PublicationStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? PublicationStatus { - get { return PublicationStatusElement != null ? PublicationStatusElement.Value : null; } + get => _PublicationStatusElement?.Value; set { - if (value == null) - PublicationStatusElement = null; - else - PublicationStatusElement = new Code(value); + PublicationStatusElement = value is null ? null : new Code(value); OnPropertyChanged("PublicationStatus"); } } @@ -587,13 +566,10 @@ public Hl7.Fhir.Model.Date PublicationDateElement [IgnoreDataMember] public string PublicationDate { - get { return PublicationDateElement != null ? PublicationDateElement.Value : null; } + get => _PublicationDateElement?.Value; set { - if (value == null) - PublicationDateElement = null; - else - PublicationDateElement = new Hl7.Fhir.Model.Date(value); + PublicationDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("PublicationDate"); } } @@ -608,17 +584,17 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(CitationElement != null) dest.CitationElement = (Hl7.Fhir.Model.Markdown)CitationElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); - if(Document != null) dest.Document = (Hl7.Fhir.Model.Attachment)Document.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.Canonical)ResourceElement.DeepCopyInternal(); - if(ResourceReference != null) dest.ResourceReference = (Hl7.Fhir.Model.ResourceReference)ResourceReference.DeepCopyInternal(); - if(PublicationStatusElement != null) dest.PublicationStatusElement = (Code)PublicationStatusElement.DeepCopyInternal(); - if(PublicationDateElement != null) dest.PublicationDateElement = (Hl7.Fhir.Model.Date)PublicationDateElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_CitationElement is not null) dest.CitationElement = (Hl7.Fhir.Model.Markdown)_CitationElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); + if(_Document is not null) dest.Document = (Hl7.Fhir.Model.Attachment)_Document.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.Canonical)_ResourceElement.DeepCopyInternal(); + if(_ResourceReference is not null) dest.ResourceReference = (Hl7.Fhir.Model.ResourceReference)_ResourceReference.DeepCopyInternal(); + if(_PublicationStatusElement is not null) dest.PublicationStatusElement = (Code)_PublicationStatusElement.DeepCopyInternal(); + if(_PublicationDateElement is not null) dest.PublicationDateElement = (Hl7.Fhir.Model.Date)_PublicationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -630,21 +606,20 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedArtifact; - if(otherT == null) return false; + if(other is not RelatedArtifact otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(CitationElement, otherT.CitationElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Document, otherT.Document)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(ResourceReference, otherT.ResourceReference)) return false; - if(!comparer.Equals(PublicationStatusElement, otherT.PublicationStatusElement)) return false; - if(!comparer.Equals(PublicationDateElement, otherT.PublicationDateElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_CitationElement, otherT._CitationElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Document, otherT._Document)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_ResourceReference, otherT._ResourceReference)) return false; + if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; + if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs index 395b78178..ee8d5a2f6 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs @@ -180,13 +180,10 @@ public Hl7.Fhir.Model.Id IdentityElement [IgnoreDataMember] public string Identity { - get { return IdentityElement != null ? IdentityElement.Value : null; } + get => _IdentityElement?.Value; set { - if (value == null) - IdentityElement = null; - else - IdentityElement = new Hl7.Fhir.Model.Id(value); + IdentityElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identity"); } } @@ -211,13 +208,10 @@ public Hl7.Fhir.Model.FhirUri UriElement [IgnoreDataMember] public string Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -242,13 +236,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -273,13 +264,10 @@ public Hl7.Fhir.Model.FhirString CommentElement [IgnoreDataMember] public string Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -294,10 +282,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(IdentityElement != null) dest.IdentityElement = (Hl7.Fhir.Model.Id)IdentityElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_IdentityElement is not null) dest.IdentityElement = (Hl7.Fhir.Model.Id)_IdentityElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -309,14 +297,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MappingComponent; - if(otherT == null) return false; + if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentityElement, otherT.IdentityElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; return true; } @@ -415,13 +402,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureDefinition.ExtensionContextType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -447,13 +431,10 @@ public Hl7.Fhir.Model.FhirString ExpressionElement [IgnoreDataMember] public string Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -468,8 +449,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -481,12 +462,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContextComponent; - if(otherT == null) return false; + if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; return true; } @@ -556,7 +536,7 @@ public partial class SnapshotComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } @@ -572,7 +552,7 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -584,11 +564,10 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SnapshotComponent; - if(otherT == null) return false; + if(other is not SnapshotComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; + if(!comparer.ListEquals(_Element, otherT._Element)) return false; return true; } @@ -651,7 +630,7 @@ public partial class DifferentialComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } @@ -667,7 +646,7 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -679,11 +658,10 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DifferentialComponent; - if(otherT == null) return false; + if(other is not DifferentialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; + if(!comparer.ListEquals(_Element, otherT._Element)) return false; return true; } @@ -743,13 +721,10 @@ public Hl7.Fhir.Model.FhirUri UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -762,7 +737,7 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -788,13 +763,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -838,13 +810,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -869,13 +838,10 @@ public Hl7.Fhir.Model.FhirString TitleElement [IgnoreDataMember] public string Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -903,13 +869,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -934,13 +897,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -965,13 +925,10 @@ public Hl7.Fhir.Model.FhirDateTime DateElement [IgnoreDataMember] public string Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -996,13 +953,10 @@ public Hl7.Fhir.Model.FhirString PublisherElement [IgnoreDataMember] public string Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1015,7 +969,7 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1041,13 +995,10 @@ public Hl7.Fhir.Model.Markdown DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1060,7 +1011,7 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1075,7 +1026,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1101,13 +1052,10 @@ public Hl7.Fhir.Model.Markdown PurposeElement [IgnoreDataMember] public string Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1132,13 +1080,10 @@ public Hl7.Fhir.Model.Markdown CopyrightElement [IgnoreDataMember] public string Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1166,13 +1111,10 @@ public Hl7.Fhir.Model.FhirString CopyrightLabelElement [IgnoreDataMember] public string CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1186,7 +1128,7 @@ public string CopyrightLabel [DataMember] public List Keyword { - get { if(_Keyword==null) _Keyword = new List(); return _Keyword; } + get => _Keyword ?? new List(); set { _Keyword = value; OnPropertyChanged("Keyword"); } } @@ -1214,13 +1156,10 @@ public Code FhirVersionElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRVersion? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Value : null; } + get => _FhirVersionElement?.Value; set { - if (value == null) - FhirVersionElement = null; - else - FhirVersionElement = new Code(value); + FhirVersionElement = value is null ? null : new Code(value); OnPropertyChanged("FhirVersion"); } } @@ -1233,7 +1172,7 @@ public Hl7.Fhir.Model.FHIRVersion? FhirVersion [DataMember] public List Mapping { - get { if(_Mapping==null) _Mapping = new List(); return _Mapping; } + get => _Mapping ?? new List(); set { _Mapping = value; OnPropertyChanged("Mapping"); } } @@ -1262,13 +1201,10 @@ public Code KindElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureDefinition.StructureDefinitionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1294,13 +1230,10 @@ public Hl7.Fhir.Model.FhirBoolean AbstractElement [IgnoreDataMember] public bool? Abstract { - get { return AbstractElement != null ? AbstractElement.Value : null; } + get => _AbstractElement?.Value; set { - if (value == null) - AbstractElement = null; - else - AbstractElement = new Hl7.Fhir.Model.FhirBoolean(value); + AbstractElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Abstract"); } } @@ -1313,7 +1246,7 @@ public bool? Abstract [DataMember] public List Context { - get { if(_Context==null) _Context = new List(); return _Context; } + get => _Context ?? new List(); set { _Context = value; OnPropertyChanged("Context"); } } @@ -1327,7 +1260,7 @@ public List Context [DataMember] public List ContextInvariantElement { - get { if(_ContextInvariantElement==null) _ContextInvariantElement = new List(); return _ContextInvariantElement; } + get => _ContextInvariantElement ?? new List(); set { _ContextInvariantElement = value; OnPropertyChanged("ContextInvariantElement"); } } @@ -1373,13 +1306,10 @@ public Hl7.Fhir.Model.FhirUri TypeElement [IgnoreDataMember] public string Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirUri(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Type"); } } @@ -1404,13 +1334,10 @@ public Hl7.Fhir.Model.Canonical BaseDefinitionElement [IgnoreDataMember] public string BaseDefinition { - get { return BaseDefinitionElement != null ? BaseDefinitionElement.Value : null; } + get => _BaseDefinitionElement?.Value; set { - if (value == null) - BaseDefinitionElement = null; - else - BaseDefinitionElement = new Hl7.Fhir.Model.Canonical(value); + BaseDefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("BaseDefinition"); } } @@ -1437,13 +1364,10 @@ public Code DerivationEle [IgnoreDataMember] public Hl7.Fhir.Model.StructureDefinition.TypeDerivationRule? Derivation { - get { return DerivationElement != null ? DerivationElement.Value : null; } + get => _DerivationElement?.Value; set { - if (value == null) - DerivationElement = null; - else - DerivationElement = new Code(value); + DerivationElement = value is null ? null : new Code(value); OnPropertyChanged("Derivation"); } } @@ -1486,35 +1410,35 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(Keyword.Any()) dest.Keyword = new List(Keyword.DeepCopyInternal()); - if(FhirVersionElement != null) dest.FhirVersionElement = (Code)FhirVersionElement.DeepCopyInternal(); - if(Mapping.Any()) dest.Mapping = new List(Mapping.DeepCopyInternal()); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(AbstractElement != null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)AbstractElement.DeepCopyInternal(); - if(Context.Any()) dest.Context = new List(Context.DeepCopyInternal()); - if(ContextInvariantElement.Any()) dest.ContextInvariantElement = new List(ContextInvariantElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirUri)TypeElement.DeepCopyInternal(); - if(BaseDefinitionElement != null) dest.BaseDefinitionElement = (Hl7.Fhir.Model.Canonical)BaseDefinitionElement.DeepCopyInternal(); - if(DerivationElement != null) dest.DerivationElement = (Code)DerivationElement.DeepCopyInternal(); - if(Snapshot != null) dest.Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent)Snapshot.DeepCopyInternal(); - if(Differential != null) dest.Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent)Differential.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_Keyword is not null) dest.Keyword = new List(_Keyword.DeepCopyInternal()); + if(_FhirVersionElement is not null) dest.FhirVersionElement = (Code)_FhirVersionElement.DeepCopyInternal(); + if(_Mapping is not null) dest.Mapping = new List(_Mapping.DeepCopyInternal()); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_AbstractElement is not null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)_AbstractElement.DeepCopyInternal(); + if(_Context is not null) dest.Context = new List(_Context.DeepCopyInternal()); + if(_ContextInvariantElement is not null) dest.ContextInvariantElement = new List(_ContextInvariantElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirUri)_TypeElement.DeepCopyInternal(); + if(_BaseDefinitionElement is not null) dest.BaseDefinitionElement = (Hl7.Fhir.Model.Canonical)_BaseDefinitionElement.DeepCopyInternal(); + if(_DerivationElement is not null) dest.DerivationElement = (Code)_DerivationElement.DeepCopyInternal(); + if(_Snapshot is not null) dest.Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent)_Snapshot.DeepCopyInternal(); + if(_Differential is not null) dest.Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent)_Differential.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1526,39 +1450,38 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureDefinition; - if(otherT == null) return false; + if(other is not StructureDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.ListEquals(Keyword, otherT.Keyword)) return false; - if(!comparer.Equals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.ListEquals(Mapping, otherT.Mapping)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(AbstractElement, otherT.AbstractElement)) return false; - if(!comparer.ListEquals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(ContextInvariantElement, otherT.ContextInvariantElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(BaseDefinitionElement, otherT.BaseDefinitionElement)) return false; - if(!comparer.Equals(DerivationElement, otherT.DerivationElement)) return false; - if(!comparer.Equals(Snapshot, otherT.Snapshot)) return false; - if(!comparer.Equals(Differential, otherT.Differential)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.ListEquals(_Keyword, otherT._Keyword)) return false; + if(!comparer.Equals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_AbstractElement, otherT._AbstractElement)) return false; + if(!comparer.ListEquals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_ContextInvariantElement, otherT._ContextInvariantElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_BaseDefinitionElement, otherT._BaseDefinitionElement)) return false; + if(!comparer.Equals(_DerivationElement, otherT._DerivationElement)) return false; + if(!comparer.Equals(_Snapshot, otherT._Snapshot)) return false; + if(!comparer.Equals(_Differential, otherT._Differential)) return false; return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs index 7ef9170ab..d0a7435cd 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs @@ -95,13 +95,10 @@ public Hl7.Fhir.Model.Date LockedDateElement [IgnoreDataMember] public string LockedDate { - get { return LockedDateElement != null ? LockedDateElement.Value : null; } + get => _LockedDateElement?.Value; set { - if (value == null) - LockedDateElement = null; - else - LockedDateElement = new Hl7.Fhir.Model.Date(value); + LockedDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LockedDate"); } } @@ -126,13 +123,10 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } @@ -145,7 +139,7 @@ public bool? Inactive [DataMember] public List Include { - get { if(_Include==null) _Include = new List(); return _Include; } + get => _Include ?? new List(); set { _Include = value; OnPropertyChanged("Include"); } } @@ -159,7 +153,7 @@ public List Include [DataMember] public List Exclude { - get { if(_Exclude==null) _Exclude = new List(); return _Exclude; } + get => _Exclude ?? new List(); set { _Exclude = value; OnPropertyChanged("Exclude"); } } @@ -176,7 +170,7 @@ public List Exclude [DataMember] public List PropertyElement { - get { if(_PropertyElement==null) _PropertyElement = new List(); return _PropertyElement; } + get => _PropertyElement ?? new List(); set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } @@ -210,11 +204,11 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(LockedDateElement != null) dest.LockedDateElement = (Hl7.Fhir.Model.Date)LockedDateElement.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); - if(Include.Any()) dest.Include = new List(Include.DeepCopyInternal()); - if(Exclude.Any()) dest.Exclude = new List(Exclude.DeepCopyInternal()); - if(PropertyElement.Any()) dest.PropertyElement = new List(PropertyElement.DeepCopyInternal()); + if(_LockedDateElement is not null) dest.LockedDateElement = (Hl7.Fhir.Model.Date)_LockedDateElement.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); + if(_Include is not null) dest.Include = new List(_Include.DeepCopyInternal()); + if(_Exclude is not null) dest.Exclude = new List(_Exclude.DeepCopyInternal()); + if(_PropertyElement is not null) dest.PropertyElement = new List(_PropertyElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -226,15 +220,14 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComposeComponent; - if(otherT == null) return false; + if(other is not ComposeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LockedDateElement, otherT.LockedDateElement)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; - if(!comparer.ListEquals(Include, otherT.Include)) return false; - if(!comparer.ListEquals(Exclude, otherT.Exclude)) return false; - if(!comparer.ListEquals(PropertyElement, otherT.PropertyElement)) return false; + if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; + if(!comparer.ListEquals(_Include, otherT._Include)) return false; + if(!comparer.ListEquals(_Exclude, otherT._Exclude)) return false; + if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; return true; } @@ -337,13 +330,10 @@ public Hl7.Fhir.Model.FhirUri SystemElement [IgnoreDataMember] public string System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -368,13 +358,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -387,7 +374,7 @@ public string Version [DataMember] public List Concept { - get { if(_Concept==null) _Concept = new List(); return _Concept; } + get => _Concept ?? new List(); set { _Concept = value; OnPropertyChanged("Concept"); } } @@ -401,7 +388,7 @@ public List Concept [DataMember] public List Filter { - get { if(_Filter==null) _Filter = new List(); return _Filter; } + get => _Filter ?? new List(); set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -415,7 +402,7 @@ public List Filter [DataMember] public List ValueSetElement { - get { if(_ValueSetElement==null) _ValueSetElement = new List(); return _ValueSetElement; } + get => _ValueSetElement ?? new List(); set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } @@ -462,13 +449,10 @@ public Hl7.Fhir.Model.FhirString CopyrightElement [IgnoreDataMember] public string Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Copyright"); } } @@ -483,12 +467,12 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Concept.Any()) dest.Concept = new List(Concept.DeepCopyInternal()); - if(Filter.Any()) dest.Filter = new List(Filter.DeepCopyInternal()); - if(ValueSetElement.Any()) dest.ValueSetElement = new List(ValueSetElement.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.FhirString)CopyrightElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Concept is not null) dest.Concept = new List(_Concept.DeepCopyInternal()); + if(_Filter is not null) dest.Filter = new List(_Filter.DeepCopyInternal()); + if(_ValueSetElement is not null) dest.ValueSetElement = new List(_ValueSetElement.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.FhirString)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -500,16 +484,15 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptSetComponent; - if(otherT == null) return false; + if(other is not ConceptSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.ListEquals(Concept, otherT.Concept)) return false; - if(!comparer.ListEquals(Filter, otherT.Filter)) return false; - if(!comparer.ListEquals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; + if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; + if(!comparer.ListEquals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; return true; } @@ -621,13 +604,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -652,13 +632,10 @@ public Hl7.Fhir.Model.FhirString DisplayElement [IgnoreDataMember] public string Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -671,7 +648,7 @@ public string Display [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -687,9 +664,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -701,13 +678,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptReferenceComponent; - if(otherT == null) return false; + if(other is not ConceptReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; return true; } @@ -798,13 +774,10 @@ public Hl7.Fhir.Model.Code LanguageElement [IgnoreDataMember] public string Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -835,7 +808,7 @@ public Hl7.Fhir.Model.Coding Use [DataMember] public List AdditionalUse { - get { if(_AdditionalUse==null) _AdditionalUse = new List(); return _AdditionalUse; } + get => _AdditionalUse ?? new List(); set { _AdditionalUse = value; OnPropertyChanged("AdditionalUse"); } } @@ -862,13 +835,10 @@ public Hl7.Fhir.Model.FhirString ValueElement [IgnoreDataMember] public string Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -883,10 +853,10 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.Coding)Use.DeepCopyInternal(); - if(AdditionalUse.Any()) dest.AdditionalUse = new List(AdditionalUse.DeepCopyInternal()); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.Coding)_Use.DeepCopyInternal(); + if(_AdditionalUse is not null) dest.AdditionalUse = new List(_AdditionalUse.DeepCopyInternal()); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -898,14 +868,13 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationComponent; - if(otherT == null) return false; + if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; - if(!comparer.ListEquals(AdditionalUse, otherT.AdditionalUse)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; + if(!comparer.ListEquals(_AdditionalUse, otherT._AdditionalUse)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; return true; } @@ -1003,13 +972,10 @@ public Hl7.Fhir.Model.Code PropertyElement [IgnoreDataMember] public string Property { - get { return PropertyElement != null ? PropertyElement.Value : null; } + get => _PropertyElement?.Value; set { - if (value == null) - PropertyElement = null; - else - PropertyElement = new Hl7.Fhir.Model.Code(value); + PropertyElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Property"); } } @@ -1037,13 +1003,10 @@ public Code OpElement [IgnoreDataMember] public Hl7.Fhir.Model.FilterOperator? Op { - get { return OpElement != null ? OpElement.Value : null; } + get => _OpElement?.Value; set { - if (value == null) - OpElement = null; - else - OpElement = new Code(value); + OpElement = value is null ? null : new Code(value); OnPropertyChanged("Op"); } } @@ -1069,13 +1032,10 @@ public Hl7.Fhir.Model.FhirString ValueElement [IgnoreDataMember] public string Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -1090,9 +1050,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(PropertyElement != null) dest.PropertyElement = (Hl7.Fhir.Model.Code)PropertyElement.DeepCopyInternal(); - if(OpElement != null) dest.OpElement = (Code)OpElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_PropertyElement is not null) dest.PropertyElement = (Hl7.Fhir.Model.Code)_PropertyElement.DeepCopyInternal(); + if(_OpElement is not null) dest.OpElement = (Code)_OpElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1104,13 +1064,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterComponent; - if(otherT == null) return false; + if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PropertyElement, otherT.PropertyElement)) return false; - if(!comparer.Equals(OpElement, otherT.OpElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + if(!comparer.Equals(_OpElement, otherT._OpElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; return true; } @@ -1201,13 +1160,10 @@ public Hl7.Fhir.Model.FhirUri IdentifierElement [IgnoreDataMember] public string Identifier { - get { return IdentifierElement != null ? IdentifierElement.Value : null; } + get => _IdentifierElement?.Value; set { - if (value == null) - IdentifierElement = null; - else - IdentifierElement = new Hl7.Fhir.Model.FhirUri(value); + IdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Identifier"); } } @@ -1235,13 +1191,10 @@ public Hl7.Fhir.Model.FhirUri NextElement [IgnoreDataMember] public string Next { - get { return NextElement != null ? NextElement.Value : null; } + get => _NextElement?.Value; set { - if (value == null) - NextElement = null; - else - NextElement = new Hl7.Fhir.Model.FhirUri(value); + NextElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Next"); } } @@ -1267,13 +1220,10 @@ public Hl7.Fhir.Model.FhirDateTime TimestampElement [IgnoreDataMember] public string Timestamp { - get { return TimestampElement != null ? TimestampElement.Value : null; } + get => _TimestampElement?.Value; set { - if (value == null) - TimestampElement = null; - else - TimestampElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimestampElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Timestamp"); } } @@ -1298,13 +1248,10 @@ public Hl7.Fhir.Model.Integer TotalElement [IgnoreDataMember] public int? Total { - get { return TotalElement != null ? TotalElement.Value : null; } + get => _TotalElement?.Value; set { - if (value == null) - TotalElement = null; - else - TotalElement = new Hl7.Fhir.Model.Integer(value); + TotalElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Total"); } } @@ -1329,13 +1276,10 @@ public Hl7.Fhir.Model.Integer OffsetElement [IgnoreDataMember] public int? Offset { - get { return OffsetElement != null ? OffsetElement.Value : null; } + get => _OffsetElement?.Value; set { - if (value == null) - OffsetElement = null; - else - OffsetElement = new Hl7.Fhir.Model.Integer(value); + OffsetElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Offset"); } } @@ -1348,7 +1292,7 @@ public int? Offset [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1365,7 +1309,7 @@ public List Parameter [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } @@ -1379,7 +1323,7 @@ public List Property [DataMember] public List Contains { - get { if(_Contains==null) _Contains = new List(); return _Contains; } + get => _Contains ?? new List(); set { _Contains = value; OnPropertyChanged("Contains"); } } @@ -1395,14 +1339,14 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(IdentifierElement != null) dest.IdentifierElement = (Hl7.Fhir.Model.FhirUri)IdentifierElement.DeepCopyInternal(); - if(NextElement != null) dest.NextElement = (Hl7.Fhir.Model.FhirUri)NextElement.DeepCopyInternal(); - if(TimestampElement != null) dest.TimestampElement = (Hl7.Fhir.Model.FhirDateTime)TimestampElement.DeepCopyInternal(); - if(TotalElement != null) dest.TotalElement = (Hl7.Fhir.Model.Integer)TotalElement.DeepCopyInternal(); - if(OffsetElement != null) dest.OffsetElement = (Hl7.Fhir.Model.Integer)OffsetElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Contains.Any()) dest.Contains = new List(Contains.DeepCopyInternal()); + if(_IdentifierElement is not null) dest.IdentifierElement = (Hl7.Fhir.Model.FhirUri)_IdentifierElement.DeepCopyInternal(); + if(_NextElement is not null) dest.NextElement = (Hl7.Fhir.Model.FhirUri)_NextElement.DeepCopyInternal(); + if(_TimestampElement is not null) dest.TimestampElement = (Hl7.Fhir.Model.FhirDateTime)_TimestampElement.DeepCopyInternal(); + if(_TotalElement is not null) dest.TotalElement = (Hl7.Fhir.Model.Integer)_TotalElement.DeepCopyInternal(); + if(_OffsetElement is not null) dest.OffsetElement = (Hl7.Fhir.Model.Integer)_OffsetElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Contains is not null) dest.Contains = new List(_Contains.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1414,18 +1358,17 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExpansionComponent; - if(otherT == null) return false; + if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentifierElement, otherT.IdentifierElement)) return false; - if(!comparer.Equals(NextElement, otherT.NextElement)) return false; - if(!comparer.Equals(TimestampElement, otherT.TimestampElement)) return false; - if(!comparer.Equals(TotalElement, otherT.TotalElement)) return false; - if(!comparer.Equals(OffsetElement, otherT.OffsetElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Contains, otherT.Contains)) return false; + if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + if(!comparer.Equals(_NextElement, otherT._NextElement)) return false; + if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; + if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; + if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; return true; } @@ -1551,13 +1494,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1587,8 +1527,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1600,12 +1540,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; return true; } @@ -1688,13 +1627,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1719,13 +1655,10 @@ public Hl7.Fhir.Model.FhirUri UriElement [IgnoreDataMember] public string Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -1740,8 +1673,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1753,12 +1686,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; return true; } @@ -1840,13 +1772,10 @@ public Hl7.Fhir.Model.FhirUri SystemElement [IgnoreDataMember] public string System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -1871,13 +1800,10 @@ public Hl7.Fhir.Model.FhirBoolean AbstractElement [IgnoreDataMember] public bool? Abstract { - get { return AbstractElement != null ? AbstractElement.Value : null; } + get => _AbstractElement?.Value; set { - if (value == null) - AbstractElement = null; - else - AbstractElement = new Hl7.Fhir.Model.FhirBoolean(value); + AbstractElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Abstract"); } } @@ -1902,13 +1828,10 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } @@ -1933,13 +1856,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1964,13 +1884,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1995,13 +1912,10 @@ public Hl7.Fhir.Model.FhirString DisplayElement [IgnoreDataMember] public string Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -2014,7 +1928,7 @@ public string Display [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -2031,7 +1945,7 @@ public List Designation [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } @@ -2045,7 +1959,7 @@ public List Property [DataMember] public List Contains { - get { if(_Contains==null) _Contains = new List(); return _Contains; } + get => _Contains ?? new List(); set { _Contains = value; OnPropertyChanged("Contains"); } } @@ -2061,15 +1975,15 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(AbstractElement != null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)AbstractElement.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Contains.Any()) dest.Contains = new List(Contains.DeepCopyInternal()); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_AbstractElement is not null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)_AbstractElement.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Contains is not null) dest.Contains = new List(_Contains.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2081,19 +1995,18 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainsComponent; - if(otherT == null) return false; + if(other is not ContainsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(AbstractElement, otherT.AbstractElement)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Contains, otherT.Contains)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_AbstractElement, otherT._AbstractElement)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; return true; } @@ -2225,13 +2138,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -2263,7 +2173,7 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List SubProperty { - get { if(_SubProperty==null) _SubProperty = new List(); return _SubProperty; } + get => _SubProperty ?? new List(); set { _SubProperty = value; OnPropertyChanged("SubProperty"); } } @@ -2279,9 +2189,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(SubProperty.Any()) dest.SubProperty = new List(SubProperty.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_SubProperty is not null) dest.SubProperty = new List(_SubProperty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2293,13 +2203,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptPropertyComponent; - if(otherT == null) return false; + if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(SubProperty, otherT.SubProperty)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_SubProperty, otherT._SubProperty)) return false; return true; } @@ -2392,13 +2301,10 @@ public Hl7.Fhir.Model.Code CodeElement [IgnoreDataMember] public string Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -2432,8 +2338,8 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2445,12 +2351,11 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptSubPropertyComponent; - if(otherT == null) return false; + if(other is not ConceptSubPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; return true; } @@ -2529,13 +2434,10 @@ public Hl7.Fhir.Model.FhirString InclusionCriteriaElement [IgnoreDataMember] public string InclusionCriteria { - get { return InclusionCriteriaElement != null ? InclusionCriteriaElement.Value : null; } + get => _InclusionCriteriaElement?.Value; set { - if (value == null) - InclusionCriteriaElement = null; - else - InclusionCriteriaElement = new Hl7.Fhir.Model.FhirString(value); + InclusionCriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("InclusionCriteria"); } } @@ -2564,13 +2466,10 @@ public Hl7.Fhir.Model.FhirString FocusElement [IgnoreDataMember] public string Focus { - get { return FocusElement != null ? FocusElement.Value : null; } + get => _FocusElement?.Value; set { - if (value == null) - FocusElement = null; - else - FocusElement = new Hl7.Fhir.Model.FhirString(value); + FocusElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Focus"); } } @@ -2595,13 +2494,10 @@ public Hl7.Fhir.Model.FhirString ExclusionCriteriaElement [IgnoreDataMember] public string ExclusionCriteria { - get { return ExclusionCriteriaElement != null ? ExclusionCriteriaElement.Value : null; } + get => _ExclusionCriteriaElement?.Value; set { - if (value == null) - ExclusionCriteriaElement = null; - else - ExclusionCriteriaElement = new Hl7.Fhir.Model.FhirString(value); + ExclusionCriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ExclusionCriteria"); } } @@ -2616,9 +2512,9 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(InclusionCriteriaElement != null) dest.InclusionCriteriaElement = (Hl7.Fhir.Model.FhirString)InclusionCriteriaElement.DeepCopyInternal(); - if(FocusElement != null) dest.FocusElement = (Hl7.Fhir.Model.FhirString)FocusElement.DeepCopyInternal(); - if(ExclusionCriteriaElement != null) dest.ExclusionCriteriaElement = (Hl7.Fhir.Model.FhirString)ExclusionCriteriaElement.DeepCopyInternal(); + if(_InclusionCriteriaElement is not null) dest.InclusionCriteriaElement = (Hl7.Fhir.Model.FhirString)_InclusionCriteriaElement.DeepCopyInternal(); + if(_FocusElement is not null) dest.FocusElement = (Hl7.Fhir.Model.FhirString)_FocusElement.DeepCopyInternal(); + if(_ExclusionCriteriaElement is not null) dest.ExclusionCriteriaElement = (Hl7.Fhir.Model.FhirString)_ExclusionCriteriaElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2630,13 +2526,12 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ScopeComponent; - if(otherT == null) return false; + if(other is not ScopeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(InclusionCriteriaElement, otherT.InclusionCriteriaElement)) return false; - if(!comparer.Equals(FocusElement, otherT.FocusElement)) return false; - if(!comparer.Equals(ExclusionCriteriaElement, otherT.ExclusionCriteriaElement)) return false; + if(!comparer.Equals(_InclusionCriteriaElement, otherT._InclusionCriteriaElement)) return false; + if(!comparer.Equals(_FocusElement, otherT._FocusElement)) return false; + if(!comparer.Equals(_ExclusionCriteriaElement, otherT._ExclusionCriteriaElement)) return false; return true; } @@ -2709,13 +2604,10 @@ public Hl7.Fhir.Model.FhirUri UrlElement [IgnoreDataMember] public string Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2728,7 +2620,7 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2754,13 +2646,10 @@ public Hl7.Fhir.Model.FhirString VersionElement [IgnoreDataMember] public string Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2803,13 +2692,10 @@ public Hl7.Fhir.Model.FhirString NameElement [IgnoreDataMember] public string Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2834,13 +2720,10 @@ public Hl7.Fhir.Model.FhirString TitleElement [IgnoreDataMember] public string Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2868,13 +2751,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2899,13 +2779,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2930,13 +2807,10 @@ public Hl7.Fhir.Model.FhirDateTime DateElement [IgnoreDataMember] public string Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2961,13 +2835,10 @@ public Hl7.Fhir.Model.FhirString PublisherElement [IgnoreDataMember] public string Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2980,7 +2851,7 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -3006,13 +2877,10 @@ public Hl7.Fhir.Model.Markdown DescriptionElement [IgnoreDataMember] public string Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -3025,7 +2893,7 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -3040,7 +2908,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -3066,13 +2934,10 @@ public Hl7.Fhir.Model.FhirBoolean ImmutableElement [IgnoreDataMember] public bool? Immutable { - get { return ImmutableElement != null ? ImmutableElement.Value : null; } + get => _ImmutableElement?.Value; set { - if (value == null) - ImmutableElement = null; - else - ImmutableElement = new Hl7.Fhir.Model.FhirBoolean(value); + ImmutableElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Immutable"); } } @@ -3097,13 +2962,10 @@ public Hl7.Fhir.Model.Markdown PurposeElement [IgnoreDataMember] public string Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -3128,13 +2990,10 @@ public Hl7.Fhir.Model.Markdown CopyrightElement [IgnoreDataMember] public string Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -3162,13 +3021,10 @@ public Hl7.Fhir.Model.FhirString CopyrightLabelElement [IgnoreDataMember] public string CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -3196,13 +3052,10 @@ public Hl7.Fhir.Model.Date ApprovalDateElement [IgnoreDataMember] public string ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -3230,13 +3083,10 @@ public Hl7.Fhir.Model.Date LastReviewDateElement [IgnoreDataMember] public string LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -3269,7 +3119,7 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -3286,7 +3136,7 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } @@ -3303,7 +3153,7 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -3320,7 +3170,7 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -3337,7 +3187,7 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -3354,7 +3204,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -3414,36 +3264,36 @@ protected internal override void CopyToInternal(Base other) } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(ImmutableElement != null) dest.ImmutableElement = (Hl7.Fhir.Model.FhirBoolean)ImmutableElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Compose != null) dest.Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent)Compose.DeepCopyInternal(); - if(Expansion != null) dest.Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent)Expansion.DeepCopyInternal(); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.ValueSet.ScopeComponent)Scope.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_ImmutableElement is not null) dest.ImmutableElement = (Hl7.Fhir.Model.FhirBoolean)_ImmutableElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Compose is not null) dest.Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent)_Compose.DeepCopyInternal(); + if(_Expansion is not null) dest.Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent)_Expansion.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.ValueSet.ScopeComponent)_Scope.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3455,40 +3305,39 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValueSet; - if(otherT == null) return false; + if(other is not ValueSet otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(ImmutableElement, otherT.ImmutableElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(Compose, otherT.Compose)) return false; - if(!comparer.Equals(Expansion, otherT.Expansion)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_ImmutableElement, otherT._ImmutableElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_Compose, otherT._Compose)) return false; + if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; + if(!comparer.Equals(_Scope, otherT._Scope)) return false; return true; } From 5a51c4117b5bca8ee1a25b568e9e669e65d76d39 Mon Sep 17 00:00:00 2001 From: Ewout Kramer Date: Sat, 22 Feb 2025 11:43:28 +0100 Subject: [PATCH 2/6] WIP nullability - manually repair errors we never caught. --- src/Hl7.Fhir.Base/Model/Base.Extensions.cs | 14 +- src/Hl7.Fhir.Base/Model/Bundle.cs | 4 +- src/Hl7.Fhir.Base/Model/Canonical.cs | 10 +- src/Hl7.Fhir.Base/Model/CodeableReference.cs | 2 +- .../Model/Generated/Attachment.cs | 112 +- .../Model/Generated/BackboneElement.cs | 14 +- .../Model/Generated/BackboneType.cs | 14 +- src/Hl7.Fhir.Base/Model/Generated/Base.cs | 3 + .../Model/Generated/Base64Binary.cs | 7 +- src/Hl7.Fhir.Base/Model/Generated/Binary.cs | 40 +- src/Hl7.Fhir.Base/Model/Generated/Bundle.cs | 241 +- .../Model/Generated/Canonical.cs | 11 +- src/Hl7.Fhir.Base/Model/Generated/Code.cs | 11 +- .../Model/Generated/CodeableConcept.cs | 22 +- .../Model/Generated/CodeableReference.cs | 22 +- src/Hl7.Fhir.Base/Model/Generated/Coding.cs | 48 +- .../Model/Generated/ContactDetail.cs | 22 +- .../Model/Generated/ContactPoint.cs | 42 +- src/Hl7.Fhir.Base/Model/Generated/DataType.cs | 4 + src/Hl7.Fhir.Base/Model/Generated/Date.cs | 11 +- .../Model/Generated/DomainResource.cs | 28 +- src/Hl7.Fhir.Base/Model/Generated/Element.cs | 22 +- .../Model/Generated/Extension.cs | 24 +- .../Model/Generated/FhirBoolean.cs | 3 + .../Model/Generated/FhirDateTime.cs | 11 +- .../Model/Generated/FhirDecimal.cs | 3 + .../Model/Generated/FhirString.cs | 11 +- src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs | 11 +- src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs | 11 +- src/Hl7.Fhir.Base/Model/Generated/Id.cs | 11 +- .../Model/Generated/Identifier.cs | 50 +- src/Hl7.Fhir.Base/Model/Generated/Instant.cs | 3 + src/Hl7.Fhir.Base/Model/Generated/Integer.cs | 3 + .../Model/Generated/Integer64.cs | 3 + src/Hl7.Fhir.Base/Model/Generated/Markdown.cs | 11 +- src/Hl7.Fhir.Base/Model/Generated/Meta.cs | 56 +- .../Model/Generated/Narrative.cs | 24 +- src/Hl7.Fhir.Base/Model/Generated/Oid.cs | 11 +- .../Model/Generated/OperationOutcome.cs | 67 +- .../Model/Generated/Parameters.cs | 45 +- src/Hl7.Fhir.Base/Model/Generated/Period.cs | 26 +- .../Model/Generated/PositiveInt.cs | 3 + .../Model/Generated/PrimitiveType.cs | 4 + src/Hl7.Fhir.Base/Model/Generated/Quantity.cs | 46 +- src/Hl7.Fhir.Base/Model/Generated/Range.cs | 22 +- src/Hl7.Fhir.Base/Model/Generated/Resource.cs | 40 +- .../Model/Generated/ResourceReference.cs | 40 +- .../Model/Generated/Signature.cs | 72 +- src/Hl7.Fhir.Base/Model/Generated/Time.cs | 11 +- .../Model/Generated/UnsignedInt.cs | 3 + .../Model/Generated/UsageContext.cs | 22 +- src/Hl7.Fhir.Base/Model/Generated/Uuid.cs | 11 +- src/Hl7.Fhir.Base/Model/Generated/XHtml.cs | 11 +- src/Hl7.Fhir.Base/Model/IIdentifiable.cs | 2 +- src/Hl7.Fhir.Base/Model/IValue.cs | 6 +- src/Hl7.Fhir.Base/Model/OverflowEntry.cs | 35 + .../Model/PocoEqualityComparisons.cs | 4 +- src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs | 16 +- .../Model/Generated/CapabilityStatement.cs | 1311 ++++--- .../Model/Generated/CodeSystem.cs | 787 ++--- .../Model/Generated/ElementDefinition.cs | 1117 +++--- .../Model/Generated/RelatedArtifact.cs | 158 +- .../Model/Generated/StructureDefinition.cs | 532 ++- .../Model/Generated/ValueSet.cs | 1168 +++---- src/Hl7.Fhir.STU3/Model/Generated/Account.cs | 356 +- .../Model/Generated/ActivityDefinition.cs | 857 +++-- src/Hl7.Fhir.STU3/Model/Generated/Address.cs | 251 +- .../Model/Generated/AdverseEvent.cs | 442 ++- src/Hl7.Fhir.STU3/Model/Generated/Age.cs | 3 + .../Model/Generated/AllergyIntolerance.cs | 460 ++- .../Model/Generated/Annotation.cs | 83 +- .../Model/Generated/Appointment.cs | 491 ++- .../Model/Generated/AppointmentResponse.cs | 175 +- .../Model/Generated/AuditEvent.cs | 826 ++--- src/Hl7.Fhir.STU3/Model/Generated/Basic.cs | 106 +- src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs | 145 +- .../Model/Generated/CapabilityStatement.cs | 2146 +++++------- src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs | 765 ++-- src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs | 303 +- .../Model/Generated/ChargeItem.cs | 471 ++- src/Hl7.Fhir.STU3/Model/Generated/Claim.cs | 2054 ++++++----- .../Model/Generated/ClaimResponse.cs | 1505 ++++---- .../Model/Generated/ClinicalImpression.cs | 462 ++- .../Model/Generated/CodeSystem.cs | 1060 +++--- .../Model/Generated/Communication.cs | 399 +-- .../Model/Generated/CommunicationRequest.cs | 436 ++- .../Model/Generated/CompartmentDefinition.cs | 432 +-- .../Model/Generated/Composition.cs | 641 ++-- .../Model/Generated/ConceptMap.cs | 998 +++--- .../Model/Generated/Condition.cs | 388 +- src/Hl7.Fhir.STU3/Model/Generated/Consent.cs | 775 ++-- src/Hl7.Fhir.STU3/Model/Generated/Contract.cs | 1217 +++---- .../Model/Generated/Contributor.cs | 81 +- src/Hl7.Fhir.STU3/Model/Generated/Count.cs | 3 + src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs | 637 ++-- .../Model/Generated/DataElement.cs | 471 ++- .../Model/Generated/DataRequirement.cs | 280 +- .../Model/Generated/DetectedIssue.cs | 307 +- src/Hl7.Fhir.STU3/Model/Generated/Device.cs | 546 ++- .../Model/Generated/DeviceComponent.cs | 264 +- .../Model/Generated/DeviceMetric.cs | 283 +- .../Model/Generated/DeviceRequest.cs | 422 ++- .../Model/Generated/DeviceUseStatement.cs | 209 +- .../Model/Generated/DiagnosticReport.cs | 413 ++- src/Hl7.Fhir.STU3/Model/Generated/Distance.cs | 3 + .../Model/Generated/DocumentManifest.cs | 319 +- .../Model/Generated/DocumentReference.cs | 599 ++-- src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs | 266 +- src/Hl7.Fhir.STU3/Model/Generated/Duration.cs | 3 + .../Model/Generated/ElementDefinition.cs | 1499 ++++---- .../Model/Generated/EligibilityRequest.cs | 282 +- .../Model/Generated/EligibilityResponse.cs | 594 ++-- .../Model/Generated/Encounter.cs | 817 +++-- src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs | 230 +- .../Model/Generated/EnrollmentRequest.cs | 161 +- .../Model/Generated/EnrollmentResponse.cs | 186 +- .../Model/Generated/EpisodeOfCare.cs | 338 +- .../Model/Generated/ExpansionProfile.cs | 880 +++-- .../Model/Generated/ExplanationOfBenefit.cs | 3111 ++++++++--------- .../Model/Generated/FamilyMemberHistory.cs | 429 ++- src/Hl7.Fhir.STU3/Model/Generated/Flag.cs | 152 +- src/Hl7.Fhir.STU3/Model/Generated/Goal.cs | 344 +- .../Model/Generated/GraphDefinition.cs | 707 ++-- src/Hl7.Fhir.STU3/Model/Generated/Group.cs | 352 +- .../Model/Generated/GuidanceResponse.cs | 268 +- .../Model/Generated/HealthcareService.cs | 630 ++-- .../Model/Generated/HumanName.cs | 172 +- .../Model/Generated/ImagingManifest.cs | 355 +- .../Model/Generated/ImagingStudy.cs | 735 ++-- .../Model/Generated/Immunization.cs | 745 ++-- .../Generated/ImmunizationRecommendation.cs | 397 +-- .../Model/Generated/ImplementationGuide.cs | 908 +++-- src/Hl7.Fhir.STU3/Model/Generated/Library.cs | 555 ++- src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs | 125 +- src/Hl7.Fhir.STU3/Model/Generated/List.cs | 351 +- src/Hl7.Fhir.STU3/Model/Generated/Location.cs | 378 +- src/Hl7.Fhir.STU3/Model/Generated/Measure.cs | 1218 +++---- .../Model/Generated/MeasureReport.cs | 581 ++- src/Hl7.Fhir.STU3/Model/Generated/Media.cs | 340 +- .../Model/Generated/Medication.cs | 423 +-- .../Generated/MedicationAdministration.cs | 516 ++- .../Model/Generated/MedicationDispense.cs | 564 ++- .../Model/Generated/MedicationRequest.cs | 631 ++-- .../Model/Generated/MedicationStatement.cs | 328 +- .../Model/Generated/MessageDefinition.cs | 652 ++-- .../Model/Generated/MessageHeader.cs | 504 ++- src/Hl7.Fhir.STU3/Model/Generated/Money.cs | 3 + .../Model/Generated/NamingSystem.cs | 435 ++- .../Model/Generated/NutritionOrder.cs | 795 ++--- .../Model/Generated/Observation.cs | 642 ++-- .../Model/Generated/OperationDefinition.cs | 864 ++--- .../Model/Generated/Organization.cs | 277 +- .../Model/Generated/ParameterDefinition.cs | 177 +- src/Hl7.Fhir.STU3/Model/Generated/Patient.cs | 613 ++-- .../Model/Generated/PaymentNotice.cs | 202 +- .../Model/Generated/PaymentReconciliation.cs | 456 ++- src/Hl7.Fhir.STU3/Model/Generated/Person.cs | 253 +- .../Model/Generated/PlanDefinition.cs | 1591 ++++----- .../Model/Generated/Practitioner.cs | 278 +- .../Model/Generated/PractitionerRole.cs | 421 ++- .../Model/Generated/Procedure.cs | 555 ++- .../Model/Generated/ProcedureRequest.cs | 516 ++- .../Model/Generated/ProcessRequest.cs | 345 +- .../Model/Generated/ProcessResponse.cs | 305 +- .../Model/Generated/Provenance.cs | 337 +- .../Model/Generated/Questionnaire.cs | 905 +++-- .../Model/Generated/QuestionnaireResponse.cs | 394 +-- src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs | 49 +- .../Model/Generated/ReferralRequest.cs | 470 ++- .../Model/Generated/RelatedArtifact.cs | 147 +- .../Model/Generated/RelatedPerson.cs | 216 +- .../Model/Generated/RequestGroup.cs | 850 +++-- .../Model/Generated/ResearchStudy.cs | 442 ++- .../Model/Generated/ResearchSubject.cs | 172 +- .../Model/Generated/RiskAssessment.cs | 426 ++- .../Model/Generated/SampledData.cs | 173 +- src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs | 161 +- .../Model/Generated/SearchParameter.cs | 613 ++-- src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs | 1098 +++--- .../Model/Generated/ServiceDefinition.cs | 539 ++- src/Hl7.Fhir.STU3/Model/Generated/Slot.cs | 230 +- src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs | 525 ++- .../Model/Generated/StructureDefinition.cs | 801 ++--- .../Model/Generated/StructureMap.cs | 1442 ++++---- .../Model/Generated/Subscription.cs | 295 +- .../Model/Generated/Substance.cs | 262 +- .../Model/Generated/SupplyDelivery.cs | 248 +- .../Model/Generated/SupplyRequest.cs | 326 +- src/Hl7.Fhir.STU3/Model/Generated/Task.cs | 704 ++-- .../Model/Generated/TestReport.cs | 782 ++--- .../Model/Generated/TestScript.cs | 3062 +++++++--------- src/Hl7.Fhir.STU3/Model/Generated/Timing.cs | 420 +-- .../Model/Generated/TriggerDefinition.cs | 97 +- src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs | 1278 +++---- .../Model/Generated/VisionPrescription.cs | 503 ++- 195 files changed, 36433 insertions(+), 41582 deletions(-) create mode 100644 src/Hl7.Fhir.Base/Model/OverflowEntry.cs diff --git a/src/Hl7.Fhir.Base/Model/Base.Extensions.cs b/src/Hl7.Fhir.Base/Model/Base.Extensions.cs index 82f735e5e..b658102b7 100644 --- a/src/Hl7.Fhir.Base/Model/Base.Extensions.cs +++ b/src/Hl7.Fhir.Base/Model/Base.Extensions.cs @@ -1,10 +1,14 @@ +/* + * Copyright (c) 2025, Firely (info@fire.ly) and contributors + * See the file CONTRIBUTORS for details. + * + * This file is licensed under the BSD 3-Clause license + * available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE + */ + #nullable enable -using Hl7.Fhir.ElementModel; -using Hl7.Fhir.Introspection; -using Hl7.Fhir.Rest; -using Hl7.Fhir.Utility; + using System; -using System.Collections; using System.Collections.Generic; using System.Linq; diff --git a/src/Hl7.Fhir.Base/Model/Bundle.cs b/src/Hl7.Fhir.Base/Model/Bundle.cs index 25df5eced..a15e20752 100644 --- a/src/Hl7.Fhir.Base/Model/Bundle.cs +++ b/src/Hl7.Fhir.Base/Model/Bundle.cs @@ -109,11 +109,11 @@ public Uri? Alternate private Uri? getLink(string rel) { - if (Link is null) return null; + if (!Link.Any()) return null; var entry = Link.FirstOrDefault(e => rel.Equals(e.Relation, StringComparison.OrdinalIgnoreCase)); - return entry != null ? new Uri(entry.Url, UriKind.RelativeOrAbsolute) : null; + return entry?.Url != null ? new Uri(entry.Url, UriKind.RelativeOrAbsolute) : null; } private void setLink(string rel, Uri? uri) diff --git a/src/Hl7.Fhir.Base/Model/Canonical.cs b/src/Hl7.Fhir.Base/Model/Canonical.cs index e31d358ea..5961110de 100644 --- a/src/Hl7.Fhir.Base/Model/Canonical.cs +++ b/src/Hl7.Fhir.Base/Model/Canonical.cs @@ -111,23 +111,25 @@ string unparsed when IsValidValue(unparsed) => null, /// /// The version string of the canonical (if present). /// - public string? Version => splitCanonical(Value).version; + public string? Version => Value is null ? null : splitCanonical(Value).version; /// /// Optional anchor at the end of the canonical, without the '#' prefix. /// - public string? Fragment => splitCanonical(Value).fragment; + public string? Fragment => Value is null ? null : splitCanonical(Value).fragment; /// /// The uri part of the canonical, which is the canonical without the version indication. /// - public string? Uri => splitCanonical(Value).url; + public string? Uri => Value is null ? null : splitCanonical(Value).url; /// /// Converts the canonical to a . /// /// - public Uri ToUri() => new(Value, UriKind.RelativeOrAbsolute); + public Uri ToUri() => new( + Value ?? throw new InvalidOperationException("Cannot turn a canonical without a value into a Uri"), + UriKind.RelativeOrAbsolute); /// /// Whether the canonical is a relative or an absolute uri. diff --git a/src/Hl7.Fhir.Base/Model/CodeableReference.cs b/src/Hl7.Fhir.Base/Model/CodeableReference.cs index 6219e15c3..bab7deade 100644 --- a/src/Hl7.Fhir.Base/Model/CodeableReference.cs +++ b/src/Hl7.Fhir.Base/Model/CodeableReference.cs @@ -43,7 +43,7 @@ public P.Concept ToSystemConcept() => "and can therefore not be converted to a System Concept."); internal P.Concept? ToSystemConceptInternal() => - ((P.IToSystemPrimitive)Concept)?.TryConvertToSystemType(out var result) == true ? (P.Concept)result : null; + ((P.IToSystemPrimitive?)Concept)?.TryConvertToSystemType(out var result) == true ? (P.Concept)result : null; /// /// Converts the reference part of this CodeableReference to a . diff --git a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs index 8569e92d9..16ef76a03 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,20 +69,20 @@ public partial class Attachment : Hl7.Fhir.Model.DataType [FhirElement("contentType", InSummary=true, Order=30)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// Mime type of the content, with charset etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { get => _ContentTypeElement?.Value; set @@ -95,20 +98,20 @@ public string ContentType [FhirElement("language", InSummary=true, Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Human language of the content (BCP-47) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { get => _LanguageElement?.Value; set @@ -123,20 +126,20 @@ public string Language /// [FhirElement("data", Order=50)] [DataMember] - public Hl7.Fhir.Model.Base64Binary DataElement + public Hl7.Fhir.Model.Base64Binary? DataElement { get { return _DataElement; } set { _DataElement = value; OnPropertyChanged("DataElement"); } } - private Hl7.Fhir.Model.Base64Binary _DataElement; + private Hl7.Fhir.Model.Base64Binary? _DataElement; /// /// Data inline, base64ed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Data + public byte[]? Data { get => _DataElement?.Value; set @@ -161,22 +164,22 @@ public byte[] Data [DeclaredType(Type = typeof(Hl7.Fhir.Model.FhirUri), Since = FhirRelease.STU3)] [DeclaredType(Type = typeof(Hl7.Fhir.Model.FhirUrl), Since = FhirRelease.R4)] [DataMember] - public Hl7.Fhir.Model.PrimitiveType UrlElement + public Hl7.Fhir.Model.PrimitiveType? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.PrimitiveType _UrlElement; + private Hl7.Fhir.Model.PrimitiveType? _UrlElement; /// /// Uri where the data can be found. Use this property in STU3. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string UrlUri + public string? UrlUri { - get => ((IValue)_UrlElement)?.Value; + get => ((IValue?)_UrlElement)?.Value; set { UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); @@ -189,9 +192,9 @@ public string UrlUri /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get => ((IValue)_UrlElement)?.Value; + get => ((IValue?)_UrlElement)?.Value; set { UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); @@ -214,13 +217,13 @@ public string Url [DeclaredType(Type = typeof(Hl7.Fhir.Model.UnsignedInt), Since = FhirRelease.STU3)] [DeclaredType(Type = typeof(Hl7.Fhir.Model.Integer64), Since = FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PrimitiveType SizeElement + public Hl7.Fhir.Model.PrimitiveType? SizeElement { get { return _SizeElement; } set { _SizeElement = value; OnPropertyChanged("SizeElement"); } } - private Hl7.Fhir.Model.PrimitiveType _SizeElement; + private Hl7.Fhir.Model.PrimitiveType? _SizeElement; /// /// Number of bytes of content (if url provided). Use this property in STU3, R4 and R4B. @@ -229,7 +232,7 @@ public Hl7.Fhir.Model.PrimitiveType SizeElement [IgnoreDataMember] public int? SizeUnsignedInt { - get => ((Hl7.Fhir.Model.UnsignedInt)_SizeElement)?.Value; + get => ((Hl7.Fhir.Model.UnsignedInt?)_SizeElement)?.Value; set { SizeElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); @@ -244,7 +247,7 @@ public int? SizeUnsignedInt [IgnoreDataMember] public long? Size { - get => ((Hl7.Fhir.Model.Integer64)_SizeElement)?.Value; + get => ((Hl7.Fhir.Model.Integer64?)_SizeElement)?.Value; set { SizeElement = value is null ? null : new Hl7.Fhir.Model.Integer64(value); @@ -257,20 +260,20 @@ public long? Size /// [FhirElement("hash", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Base64Binary HashElement + public Hl7.Fhir.Model.Base64Binary? HashElement { get { return _HashElement; } set { _HashElement = value; OnPropertyChanged("HashElement"); } } - private Hl7.Fhir.Model.Base64Binary _HashElement; + private Hl7.Fhir.Model.Base64Binary? _HashElement; /// /// Hash of the data (sha-1, base64ed) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Hash + public byte[]? Hash { get => _HashElement?.Value; set @@ -285,20 +288,20 @@ public byte[] Hash /// [FhirElement("title", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label to display in place of the data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { get => _TitleElement?.Value; set @@ -313,20 +316,20 @@ public string Title /// [FhirElement("creation", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreationElement + public Hl7.Fhir.Model.FhirDateTime? CreationElement { get { return _CreationElement; } set { _CreationElement = value; OnPropertyChanged("CreationElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreationElement; + private Hl7.Fhir.Model.FhirDateTime? _CreationElement; /// /// Date attachment was first created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Creation + public string? Creation { get => _CreationElement?.Value; set @@ -344,13 +347,13 @@ public string Creation /// [FhirElement("height", Order=110, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PositiveInt HeightElement + public Hl7.Fhir.Model.PositiveInt? HeightElement { get { return _HeightElement; } set { _HeightElement = value; OnPropertyChanged("HeightElement"); } } - private Hl7.Fhir.Model.PositiveInt _HeightElement; + private Hl7.Fhir.Model.PositiveInt? _HeightElement; /// /// Height of the image in pixels (photo/video) @@ -375,13 +378,13 @@ public int? Height /// [FhirElement("width", Order=120, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PositiveInt WidthElement + public Hl7.Fhir.Model.PositiveInt? WidthElement { get { return _WidthElement; } set { _WidthElement = value; OnPropertyChanged("WidthElement"); } } - private Hl7.Fhir.Model.PositiveInt _WidthElement; + private Hl7.Fhir.Model.PositiveInt? _WidthElement; /// /// Width of the image in pixels (photo/video) @@ -406,13 +409,13 @@ public int? Width /// [FhirElement("frames", Order=130, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FramesElement + public Hl7.Fhir.Model.PositiveInt? FramesElement { get { return _FramesElement; } set { _FramesElement = value; OnPropertyChanged("FramesElement"); } } - private Hl7.Fhir.Model.PositiveInt _FramesElement; + private Hl7.Fhir.Model.PositiveInt? _FramesElement; /// /// Number of frames if > 1 (photo) @@ -437,13 +440,13 @@ public int? Frames /// [FhirElement("duration", Order=140, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationElement + public Hl7.Fhir.Model.FhirDecimal? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationElement; /// /// Length in seconds (audio / video) @@ -468,13 +471,13 @@ public decimal? Duration /// [FhirElement("pages", Order=150, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PagesElement + public Hl7.Fhir.Model.PositiveInt? PagesElement { get { return _PagesElement; } set { _PagesElement = value; OnPropertyChanged("PagesElement"); } } - private Hl7.Fhir.Model.PositiveInt _PagesElement; + private Hl7.Fhir.Model.PositiveInt? _PagesElement; /// /// Number of printed pages @@ -524,7 +527,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Attachment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; @@ -537,11 +540,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FramesElement, otherT._FramesElement)) return false; if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; if(!comparer.Equals(_PagesElement, otherT._PagesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -590,48 +594,48 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "data": - DataElement = (Hl7.Fhir.Model.Base64Binary)value; + DataElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.PrimitiveType)value; + UrlElement = (Hl7.Fhir.Model.PrimitiveType?)value; return this; case "size": - SizeElement = (Hl7.Fhir.Model.PrimitiveType)value; + SizeElement = (Hl7.Fhir.Model.PrimitiveType?)value; return this; case "hash": - HashElement = (Hl7.Fhir.Model.Base64Binary)value; + HashElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "creation": - CreationElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreationElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "height": - HeightElement = (Hl7.Fhir.Model.PositiveInt)value; + HeightElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "width": - WidthElement = (Hl7.Fhir.Model.PositiveInt)value; + WidthElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "frames": - FramesElement = (Hl7.Fhir.Model.PositiveInt)value; + FramesElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "pages": - PagesElement = (Hl7.Fhir.Model.PositiveInt)value; + PagesElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs index f1fdd9c1f..37c03a8fa 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,7 +69,7 @@ public List ModifierExtension set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } - private List _ModifierExtension; + private List? _ModifierExtension; protected internal override void CopyToInternal(Base other) { @@ -82,12 +85,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BackboneElement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -100,12 +104,12 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifierExtension": - ModifierExtension = (List)value; + ModifierExtension = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs index 4e828cc54..b1d432607 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,7 +69,7 @@ public List ModifierExtension set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } - private List _ModifierExtension; + private List? _ModifierExtension; protected internal override void CopyToInternal(Base other) { @@ -82,12 +85,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BackboneType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -100,12 +104,12 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifierExtension": - ModifierExtension = (List)value; + ModifierExtension = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Base.cs b/src/Hl7.Fhir.Base/Model/Generated/Base.cs index d47779718..8fa9b969c 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Base.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Base.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs b/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs index 12a3214ba..4b75e4a3f 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Base64Binary.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class Base64Binary : PrimitiveType, IValue /// Must conform to the pattern "(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?" public const string PATTERN = @"(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?"; - public Base64Binary(byte[] value) + public Base64Binary(byte[]? value) { Value = value; } - public Base64Binary(): this((byte[])null) {} + public Base64Binary(): this((byte[]?)null) {} protected internal override Base DeepCopyInternal() { diff --git a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs index 3c7bfda39..b987dc456 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -70,20 +73,20 @@ public partial class Binary : Hl7.Fhir.Model.Resource [Binding("MimeType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// MimeType of the binary content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { get => _ContentTypeElement?.Value; set @@ -100,13 +103,13 @@ public string ContentType [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SecurityContext + public Hl7.Fhir.Model.ResourceReference? SecurityContext { get { return _SecurityContext; } set { _SecurityContext = value; OnPropertyChanged("SecurityContext"); } } - private Hl7.Fhir.Model.ResourceReference _SecurityContext; + private Hl7.Fhir.Model.ResourceReference? _SecurityContext; /// /// The actual content. @@ -117,20 +120,20 @@ public Hl7.Fhir.Model.ResourceReference SecurityContext [FhirElement("content", Order=70)] [NotMapped(Since=FhirRelease.R4)] [DataMember] - public Hl7.Fhir.Model.Base64Binary ContentElement + public Hl7.Fhir.Model.Base64Binary? ContentElement { get { return _ContentElement; } set { _ContentElement = value; OnPropertyChanged("ContentElement"); } } - private Hl7.Fhir.Model.Base64Binary _ContentElement; + private Hl7.Fhir.Model.Base64Binary? _ContentElement; /// /// The actual content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Content + public byte[]? Content { get => _ContentElement?.Value; set @@ -148,20 +151,20 @@ public byte[] Content /// [FhirElement("data", Order=70, Since=FhirRelease.R4)] [DataMember] - public Hl7.Fhir.Model.Base64Binary DataElement + public Hl7.Fhir.Model.Base64Binary? DataElement { get { return _DataElement; } set { _DataElement = value; OnPropertyChanged("DataElement"); } } - private Hl7.Fhir.Model.Base64Binary _DataElement; + private Hl7.Fhir.Model.Base64Binary? _DataElement; /// /// The actual content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Data + public byte[]? Data { get => _DataElement?.Value; set @@ -195,15 +198,16 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Binary otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; if(!comparer.Equals(_SecurityContext, otherT._SecurityContext)) return false; if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -225,21 +229,21 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "securityContext": - SecurityContext = (Hl7.Fhir.Model.ResourceReference)value; + SecurityContext = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "content": - ContentElement = (Hl7.Fhir.Model.Base64Binary)value; + ContentElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "data": - DataElement = (Hl7.Fhir.Model.Base64Binary)value; + DataElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs index b9b442433..c0cc42012 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -969,22 +972,22 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Hl7.Fhir.Model.Code), Since = FhirRelease.R5)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PrimitiveType RelationElement + public Hl7.Fhir.Model.PrimitiveType? RelationElement { get { return _RelationElement; } set { _RelationElement = value; OnPropertyChanged("RelationElement"); } } - private Hl7.Fhir.Model.PrimitiveType _RelationElement; + private Hl7.Fhir.Model.PrimitiveType? _RelationElement; /// /// See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1. Use this property in STU3, R4 and R4B. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelationString + public string? RelationString { - get => ((IValue)_RelationElement)?.Value; + get => ((IValue?)_RelationElement)?.Value; set { RelationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); @@ -997,9 +1000,9 @@ public string RelationString /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Relation + public string? Relation { - get => ((IValue)_RelationElement)?.Value; + get => ((IValue?)_RelationElement)?.Value; set { RelationElement = value is null ? null : new Hl7.Fhir.Model.Code(value); @@ -1013,20 +1016,20 @@ public string Relation [FhirElement("url", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Reference details for the link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -1058,13 +1061,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_RelationElement, otherT._RelationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationElement, otherT._RelationElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -1080,15 +1084,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relation": - RelationElement = (Hl7.Fhir.Model.PrimitiveType)value; + RelationElement = (Hl7.Fhir.Model.PrimitiveType?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -1133,27 +1137,27 @@ public List Link set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; /// /// URI for resource (e.g. the absolute URL server address, URI for UUID/OID, etc.). /// [FhirElement("fullUrl", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri FullUrlElement + public Hl7.Fhir.Model.FhirUri? FullUrlElement { get { return _FullUrlElement; } set { _FullUrlElement = value; OnPropertyChanged("FullUrlElement"); } } - private Hl7.Fhir.Model.FhirUri _FullUrlElement; + private Hl7.Fhir.Model.FhirUri? _FullUrlElement; /// /// URI for resource (e.g. the absolute URL server address, URI for UUID/OID, etc.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FullUrl + public string? FullUrl { get => _FullUrlElement?.Value; set @@ -1170,52 +1174,52 @@ public string FullUrl [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Resource))] [DataMember] - public Hl7.Fhir.Model.Resource Resource + public Hl7.Fhir.Model.Resource? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.Resource _Resource; + private Hl7.Fhir.Model.Resource? _Resource; /// /// Search related information. /// [FhirElement("search", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Bundle.SearchComponent Search + public Hl7.Fhir.Model.Bundle.SearchComponent? Search { get { return _Search; } set { _Search = value; OnPropertyChanged("Search"); } } - private Hl7.Fhir.Model.Bundle.SearchComponent _Search; + private Hl7.Fhir.Model.Bundle.SearchComponent? _Search; /// /// Additional execution information (transaction/batch/history). /// [FhirElement("request", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Bundle.RequestComponent Request + public Hl7.Fhir.Model.Bundle.RequestComponent? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.Bundle.RequestComponent _Request; + private Hl7.Fhir.Model.Bundle.RequestComponent? _Request; /// /// Results of execution (transaction/batch/history). /// [FhirElement("response", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Bundle.ResponseComponent Response + public Hl7.Fhir.Model.Bundle.ResponseComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.Bundle.ResponseComponent _Response; + private Hl7.Fhir.Model.Bundle.ResponseComponent? _Response; protected internal override void CopyToInternal(Base other) { @@ -1243,17 +1247,18 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Link, otherT._Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; if(!comparer.Equals(_FullUrlElement, otherT._FullUrlElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.Equals(_Search, otherT._Search)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -1281,27 +1286,27 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "link": - Link = (List)value; + Link = (List?)value!; return this; case "fullUrl": - FullUrlElement = (Hl7.Fhir.Model.FhirUri)value; + FullUrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.Resource)value; + Resource = (Hl7.Fhir.Model.Resource?)value; return this; case "search": - Search = (Hl7.Fhir.Model.Bundle.SearchComponent)value; + Search = (Hl7.Fhir.Model.Bundle.SearchComponent?)value; return this; case "request": - Request = (Hl7.Fhir.Model.Bundle.RequestComponent)value; + Request = (Hl7.Fhir.Model.Bundle.RequestComponent?)value; return this; case "response": - Response = (Hl7.Fhir.Model.Bundle.ResponseComponent)value; + Response = (Hl7.Fhir.Model.Bundle.ResponseComponent?)value; return this; default: return base.SetValue(key, value); @@ -1345,13 +1350,13 @@ public partial class SearchComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("SearchEntryMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// match | include - why this is in the result set @@ -1373,13 +1378,13 @@ public Hl7.Fhir.Model.Bundle.SearchEntryMode? Mode /// [FhirElement("score", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ScoreElement + public Hl7.Fhir.Model.FhirDecimal? ScoreElement { get { return _ScoreElement; } set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _ScoreElement; /// /// Search ranking (between 0 and 1) @@ -1418,13 +1423,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -1440,15 +1446,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "score": - ScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + ScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -1489,13 +1495,13 @@ public partial class RequestComponent : Hl7.Fhir.Model.BackboneElement [Binding("HTTPVerb")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MethodElement + public Code? MethodElement { get { return _MethodElement; } set { _MethodElement = value; OnPropertyChanged("MethodElement"); } } - private Code _MethodElement; + private Code? _MethodElement; /// /// GET | HEAD | POST | PUT | DELETE | PATCH @@ -1518,20 +1524,20 @@ public Hl7.Fhir.Model.Bundle.HTTPVerb? Method [FhirElement("url", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URL for HTTP equivalent of this entry /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -1546,20 +1552,20 @@ public string Url /// [FhirElement("ifNoneMatch", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString IfNoneMatchElement + public Hl7.Fhir.Model.FhirString? IfNoneMatchElement { get { return _IfNoneMatchElement; } set { _IfNoneMatchElement = value; OnPropertyChanged("IfNoneMatchElement"); } } - private Hl7.Fhir.Model.FhirString _IfNoneMatchElement; + private Hl7.Fhir.Model.FhirString? _IfNoneMatchElement; /// /// For managing cache validation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IfNoneMatch + public string? IfNoneMatch { get => _IfNoneMatchElement?.Value; set @@ -1574,13 +1580,13 @@ public string IfNoneMatch /// [FhirElement("ifModifiedSince", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Instant IfModifiedSinceElement + public Hl7.Fhir.Model.Instant? IfModifiedSinceElement { get { return _IfModifiedSinceElement; } set { _IfModifiedSinceElement = value; OnPropertyChanged("IfModifiedSinceElement"); } } - private Hl7.Fhir.Model.Instant _IfModifiedSinceElement; + private Hl7.Fhir.Model.Instant? _IfModifiedSinceElement; /// /// For managing cache currency @@ -1602,20 +1608,20 @@ public DateTimeOffset? IfModifiedSince /// [FhirElement("ifMatch", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString IfMatchElement + public Hl7.Fhir.Model.FhirString? IfMatchElement { get { return _IfMatchElement; } set { _IfMatchElement = value; OnPropertyChanged("IfMatchElement"); } } - private Hl7.Fhir.Model.FhirString _IfMatchElement; + private Hl7.Fhir.Model.FhirString? _IfMatchElement; /// /// For managing update contention /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IfMatch + public string? IfMatch { get => _IfMatchElement?.Value; set @@ -1630,20 +1636,20 @@ public string IfMatch /// [FhirElement("ifNoneExist", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString IfNoneExistElement + public Hl7.Fhir.Model.FhirString? IfNoneExistElement { get { return _IfNoneExistElement; } set { _IfNoneExistElement = value; OnPropertyChanged("IfNoneExistElement"); } } - private Hl7.Fhir.Model.FhirString _IfNoneExistElement; + private Hl7.Fhir.Model.FhirString? _IfNoneExistElement; /// /// For conditional creates /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IfNoneExist + public string? IfNoneExist { get => _IfNoneExistElement?.Value; set @@ -1679,17 +1685,18 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_IfNoneMatchElement, otherT._IfNoneMatchElement)) return false; if(!comparer.Equals(_IfModifiedSinceElement, otherT._IfModifiedSinceElement)) return false; if(!comparer.Equals(_IfMatchElement, otherT._IfMatchElement)) return false; if(!comparer.Equals(_IfNoneExistElement, otherT._IfNoneExistElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -1717,27 +1724,27 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "method": - MethodElement = (Code)value; + MethodElement = (Code?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "ifNoneMatch": - IfNoneMatchElement = (Hl7.Fhir.Model.FhirString)value; + IfNoneMatchElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "ifModifiedSince": - IfModifiedSinceElement = (Hl7.Fhir.Model.Instant)value; + IfModifiedSinceElement = (Hl7.Fhir.Model.Instant?)value; return this; case "ifMatch": - IfMatchElement = (Hl7.Fhir.Model.FhirString)value; + IfMatchElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "ifNoneExist": - IfNoneExistElement = (Hl7.Fhir.Model.FhirString)value; + IfNoneExistElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1780,20 +1787,20 @@ public partial class ResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("status", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString StatusElement + public Hl7.Fhir.Model.FhirString? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Hl7.Fhir.Model.FhirString _StatusElement; + private Hl7.Fhir.Model.FhirString? _StatusElement; /// /// Status response code (text optional) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Status + public string? Status { get => _StatusElement?.Value; set @@ -1808,20 +1815,20 @@ public string Status /// [FhirElement("location", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri LocationElement + public Hl7.Fhir.Model.FhirUri? LocationElement { get { return _LocationElement; } set { _LocationElement = value; OnPropertyChanged("LocationElement"); } } - private Hl7.Fhir.Model.FhirUri _LocationElement; + private Hl7.Fhir.Model.FhirUri? _LocationElement; /// /// The location (if the operation returns a location) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Location + public string? Location { get => _LocationElement?.Value; set @@ -1836,20 +1843,20 @@ public string Location /// [FhirElement("etag", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString EtagElement + public Hl7.Fhir.Model.FhirString? EtagElement { get { return _EtagElement; } set { _EtagElement = value; OnPropertyChanged("EtagElement"); } } - private Hl7.Fhir.Model.FhirString _EtagElement; + private Hl7.Fhir.Model.FhirString? _EtagElement; /// /// The Etag for the resource (if relevant) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Etag + public string? Etag { get => _EtagElement?.Value; set @@ -1864,13 +1871,13 @@ public string Etag /// [FhirElement("lastModified", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Instant LastModifiedElement + public Hl7.Fhir.Model.Instant? LastModifiedElement { get { return _LastModifiedElement; } set { _LastModifiedElement = value; OnPropertyChanged("LastModifiedElement"); } } - private Hl7.Fhir.Model.Instant _LastModifiedElement; + private Hl7.Fhir.Model.Instant? _LastModifiedElement; /// /// Server's date time modified @@ -1894,13 +1901,13 @@ public DateTimeOffset? LastModified [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Resource))] [DataMember] - public Hl7.Fhir.Model.Resource Outcome + public Hl7.Fhir.Model.Resource? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.Resource _Outcome; + private Hl7.Fhir.Model.Resource? _Outcome; protected internal override void CopyToInternal(Base other) { @@ -1927,16 +1934,17 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_LocationElement, otherT._LocationElement)) return false; if(!comparer.Equals(_EtagElement, otherT._EtagElement)) return false; if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -1961,24 +1969,24 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Hl7.Fhir.Model.FhirString)value; + StatusElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "location": - LocationElement = (Hl7.Fhir.Model.FhirUri)value; + LocationElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "etag": - EtagElement = (Hl7.Fhir.Model.FhirString)value; + EtagElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "lastModified": - LastModifiedElement = (Hl7.Fhir.Model.Instant)value; + LastModifiedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.Resource)value; + Outcome = (Hl7.Fhir.Model.Resource?)value; return this; default: return base.SetValue(key, value); @@ -2003,13 +2011,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=50, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection | subscription-notification. @@ -2019,13 +2027,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("BundleType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection | subscription-notification @@ -2050,13 +2058,13 @@ public Hl7.Fhir.Model.Bundle.BundleType? Type /// [FhirElement("timestamp", InSummary=true, Order=70, FiveWs="FiveWs.init", Since=FhirRelease.R4)] [DataMember] - public Hl7.Fhir.Model.Instant TimestampElement + public Hl7.Fhir.Model.Instant? TimestampElement { get { return _TimestampElement; } set { _TimestampElement = value; OnPropertyChanged("TimestampElement"); } } - private Hl7.Fhir.Model.Instant _TimestampElement; + private Hl7.Fhir.Model.Instant? _TimestampElement; /// /// When the bundle was assembled @@ -2078,13 +2086,13 @@ public DateTimeOffset? Timestamp /// [FhirElement("total", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt TotalElement + public Hl7.Fhir.Model.UnsignedInt? TotalElement { get { return _TotalElement; } set { _TotalElement = value; OnPropertyChanged("TotalElement"); } } - private Hl7.Fhir.Model.UnsignedInt _TotalElement; + private Hl7.Fhir.Model.UnsignedInt? _TotalElement; /// /// If search, the total number of matches @@ -2113,7 +2121,7 @@ public List Link set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; /// /// Entry in the bundle - will have a resource or information. @@ -2127,20 +2135,20 @@ public List Entry set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Digital Signature. /// [FhirElement("signature", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Signature Signature + public Hl7.Fhir.Model.Signature? Signature { get { return _Signature; } set { _Signature = value; OnPropertyChanged("Signature"); } } - private Hl7.Fhir.Model.Signature _Signature; + private Hl7.Fhir.Model.Signature? _Signature; /// /// Issues with the Bundle. @@ -2152,15 +2160,15 @@ public Hl7.Fhir.Model.Signature Signature [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Resource))] [DataMember] - public Hl7.Fhir.Model.Resource Issues + public Hl7.Fhir.Model.Resource? Issues { get { return _Issues; } set { _Issues = value; OnPropertyChanged("Issues"); } } - private Hl7.Fhir.Model.Resource _Issues; + private Hl7.Fhir.Model.Resource? _Issues; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { @@ -2190,7 +2198,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Bundle otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; @@ -2198,11 +2206,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_Signature, otherT._Signature)) return false; if(!comparer.Equals(_Issues, otherT._Issues)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -2236,33 +2245,33 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "timestamp": - TimestampElement = (Hl7.Fhir.Model.Instant)value; + TimestampElement = (Hl7.Fhir.Model.Instant?)value; return this; case "total": - TotalElement = (Hl7.Fhir.Model.UnsignedInt)value; + TotalElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "signature": - Signature = (Hl7.Fhir.Model.Signature)value; + Signature = (Hl7.Fhir.Model.Signature?)value; return this; case "issues": - Issues = (Hl7.Fhir.Model.Resource)value; + Issues = (Hl7.Fhir.Model.Resource?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs b/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs index 4574c57ad..ee532b7ef 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Canonical.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class Canonical : PrimitiveType, IValue /// Must conform to the pattern "\S*" public const string PATTERN = @"\S*"; - public Canonical(string value) + public Canonical(string? value) { Value = value; } - public Canonical(): this((string)null) {} + public Canonical(): this((string?)null) {} /// /// Primitive value of the element @@ -75,9 +78,9 @@ public Canonical(): this((string)null) {} [FhirElement("value", IsPrimitiveValue=true, XmlSerialization=XmlRepresentation.XmlAttr, InSummary=true, Order=30)] [DeclaredType(Type = typeof(SystemPrimitive.String))] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Code.cs b/src/Hl7.Fhir.Base/Model/Generated/Code.cs index 5481ebc25..a3843aeba 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Code.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Code.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -59,12 +62,12 @@ public partial class Code : PrimitiveType, IValue /// Must conform to the pattern "[^\s]+( [^\s]+)*" public const string PATTERN = @"[^\s]+( [^\s]+)*"; - public Code(string value) + public Code(string? value) { Value = value; } - public Code(): this((string)null) {} + public Code(): this((string?)null) {} /// /// Primitive value of the element @@ -73,9 +76,9 @@ public Code(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [CodePattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs index 236a2c583..cf276bd70 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -72,27 +75,27 @@ public List Coding set { _Coding = value; OnPropertyChanged("Coding"); } } - private List _Coding; + private List? _Coding; /// /// Plain text representation of the concept. /// [FhirElement("text", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Plain text representation of the concept /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { get => _TextElement?.Value; set @@ -124,13 +127,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeableConcept otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Coding, otherT._Coding)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Coding, otherT._Coding)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -146,15 +150,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coding": - Coding = (List)value; + Coding = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs index 23711fbe0..7c00ed4fd 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,26 +67,26 @@ public partial class CodeableReference : Hl7.Fhir.Model.DataType /// [FhirElement("concept", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Concept + public Hl7.Fhir.Model.CodeableConcept? Concept { get { return _Concept; } set { _Concept = value; OnPropertyChanged("Concept"); } } - private Hl7.Fhir.Model.CodeableConcept _Concept; + private Hl7.Fhir.Model.CodeableConcept? _Concept; /// /// Reference to a resource (by instance). /// [FhirElement("reference", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { @@ -107,13 +110,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeableReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_Concept, otherT._Concept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Concept, otherT._Concept)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -129,15 +133,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "concept": - Concept = (Hl7.Fhir.Model.CodeableConcept)value; + Concept = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs index b8963b147..626c105eb 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,20 +67,20 @@ public partial class Coding : Hl7.Fhir.Model.DataType /// [FhirElement("system", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// Identity of the terminology system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { get => _SystemElement?.Value; set @@ -92,20 +95,20 @@ public string System /// [FhirElement("version", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of the system - if relevant /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -120,20 +123,20 @@ public string Version /// [FhirElement("code", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Symbol in syntax defined by the system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -148,20 +151,20 @@ public string Code /// [FhirElement("display", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Representation defined by the system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { get => _DisplayElement?.Value; set @@ -176,13 +179,13 @@ public string Display /// [FhirElement("userSelected", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean UserSelectedElement + public Hl7.Fhir.Model.FhirBoolean? UserSelectedElement { get { return _UserSelectedElement; } set { _UserSelectedElement = value; OnPropertyChanged("UserSelectedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _UserSelectedElement; + private Hl7.Fhir.Model.FhirBoolean? _UserSelectedElement; /// /// If this coding was chosen directly by the user @@ -224,16 +227,17 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Coding otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_UserSelectedElement, otherT._UserSelectedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -258,24 +262,24 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "userSelected": - UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean)value; + UserSelectedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs index a971dd9cd..d942b6a91 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,20 +67,20 @@ public partial class ContactDetail : Hl7.Fhir.Model.DataType /// [FhirElement("name", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of an individual to contact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -99,7 +102,7 @@ public List Telecom set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; protected internal override void CopyToInternal(Base other) { @@ -123,13 +126,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactDetail otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -145,15 +149,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs index a928a7759..cc8dc4b46 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -158,13 +161,13 @@ public enum ContactPointUse [DeclaredType(Type = typeof(Code))] [Binding("ContactPointSystem")] [DataMember] - public Code SystemElement + public Code? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Code _SystemElement; + private Code? _SystemElement; /// /// phone | fax | email | pager | url | sms | other @@ -186,20 +189,20 @@ public Hl7.Fhir.Model.ContactPoint.ContactPointSystem? System /// [FhirElement("value", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The actual contact point details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { get => _ValueElement?.Value; set @@ -216,13 +219,13 @@ public string Value [DeclaredType(Type = typeof(Code))] [Binding("ContactPointUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// home | work | temp | old | mobile - purpose of this contact point @@ -244,13 +247,13 @@ public Hl7.Fhir.Model.ContactPoint.ContactPointUse? Use /// [FhirElement("rank", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankElement + public Hl7.Fhir.Model.PositiveInt? RankElement { get { return _RankElement; } set { _RankElement = value; OnPropertyChanged("RankElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankElement; + private Hl7.Fhir.Model.PositiveInt? _RankElement; /// /// Specify preferred order of use (1 = highest) @@ -272,13 +275,13 @@ public int? Rank /// [FhirElement("period", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { @@ -305,16 +308,17 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactPoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -339,24 +343,24 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Code)value; + SystemElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "rank": - RankElement = (Hl7.Fhir.Model.PositiveInt)value; + RankElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs index e259edae5..a0657de58 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,6 +70,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here#pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Date.cs b/src/Hl7.Fhir.Base/Model/Generated/Date.cs index efb4b4b05..86e5c92e3 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Date.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Date.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -59,12 +62,12 @@ public partial class Date : PrimitiveType, IValue /// Must conform to the pattern "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?" public const string PATTERN = @"([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?"; - public Date(string value) + public Date(string? value) { Value = value; } - public Date(): this((string)null) {} + public Date(): this((string?)null) {} /// /// Primitive value of the element @@ -73,9 +76,9 @@ public Date(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.Date))] [DatePattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs index 7ae7bcb77..13e061c48 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -59,13 +62,13 @@ public abstract partial class DomainResource : Hl7.Fhir.Model.Resource, Hl7.Fhir /// [FhirElement("text", Order=50)] [DataMember] - public Hl7.Fhir.Model.Narrative Text + public Hl7.Fhir.Model.Narrative? Text { get { return _Text; } set { _Text = value; OnPropertyChanged("Text"); } } - private Hl7.Fhir.Model.Narrative _Text; + private Hl7.Fhir.Model.Narrative? _Text; /// /// Contained, inline Resources. @@ -81,7 +84,7 @@ public List Contained set { _Contained = value; OnPropertyChanged("Contained"); } } - private List _Contained; + private List? _Contained; /// /// Additional content defined by implementations. @@ -95,7 +98,7 @@ public List Extension set { _Extension = value; OnPropertyChanged("Extension"); } } - private List _Extension; + private List? _Extension; /// /// Extensions that cannot be ignored. @@ -109,7 +112,7 @@ public List ModifierExtension set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } - private List _ModifierExtension; + private List? _ModifierExtension; protected internal override void CopyToInternal(Base other) { @@ -128,15 +131,16 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DomainResource otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_Text, otherT._Text)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Text, otherT._Text)) return false; if(!comparer.ListEquals(_Contained, otherT._Contained)) return false; if(!comparer.ListEquals(_Extension, otherT._Extension)) return false; if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -158,21 +162,21 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "text": - Text = (Hl7.Fhir.Model.Narrative)value; + Text = (Hl7.Fhir.Model.Narrative?)value; return this; case "contained": - Contained = (List)value; + Contained = (List?)value!; return this; case "extension": - Extension = (List)value; + Extension = (List?)value!; return this; case "modifierExtension": - ModifierExtension = (List)value; + ModifierExtension = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Element.cs b/src/Hl7.Fhir.Base/Model/Generated/Element.cs index dac572621..a6f832d73 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Element.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Element.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -59,20 +62,20 @@ public abstract partial class Element : Hl7.Fhir.Model.Base /// [FhirElement("id", XmlSerialization = XmlRepresentation.XmlAttr, Order=10)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementIdElement + public Hl7.Fhir.Model.FhirString? ElementIdElement { get { return _ElementIdElement; } set { _ElementIdElement = value; OnPropertyChanged("ElementIdElement"); } } - private Hl7.Fhir.Model.FhirString _ElementIdElement; + private Hl7.Fhir.Model.FhirString? _ElementIdElement; /// /// Unique id for inter-element referencing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ElementId + public string? ElementId { get => _ElementIdElement?.Value; set @@ -94,7 +97,7 @@ public List Extension set { _Extension = value; OnPropertyChanged("Extension"); } } - private List _Extension; + private List? _Extension; protected internal override void CopyToInternal(Base other) { @@ -111,13 +114,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Element otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ElementIdElement, otherT._ElementIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ElementIdElement, otherT._ElementIdElement)) return false; if(!comparer.ListEquals(_Extension, otherT._Extension)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -133,15 +137,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "id": - ElementIdElement = (Hl7.Fhir.Model.FhirString)value; + ElementIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "extension": - Extension = (List)value; + Extension = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs index 15ffc66ae..d4a5297d5 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -65,20 +68,20 @@ public partial class Extension : Hl7.Fhir.Model.DataType [FhirElement("url", XmlSerialization = XmlRepresentation.XmlAttr, InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// identifies the meaning of the extension /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -93,13 +96,13 @@ public string Url /// [FhirElement("value", InSummary=true, Order=40, Choice=ChoiceType.DatatypeChoice)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { @@ -123,13 +126,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Extension otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -145,15 +149,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs index fad870b49..3cb2ea23b 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/FhirBoolean.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs index d71b13ff9..57791cc9b 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/FhirDateTime.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class FhirDateTime : PrimitiveType, IValue /// Must conform to the pattern "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?)?)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)?)?)?" public const string PATTERN = @"([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?)?)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)?)?)?"; - public FhirDateTime(string value) + public FhirDateTime(string? value) { Value = value; } - public FhirDateTime(): this((string)null) {} + public FhirDateTime(): this((string?)null) {} /// /// Primitive value of the element @@ -76,9 +79,9 @@ public FhirDateTime(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.DateTime))] [DateTimePattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs index 35b1dde62..af4145b3b 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/FhirDecimal.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs index c56295292..0d66ad430 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/FhirString.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class FhirString : PrimitiveType, IValue /// Must conform to the pattern "^[\s\S]+$" public const string PATTERN = @"^[\s\S]+$"; - public FhirString(string value) + public FhirString(string? value) { Value = value; } - public FhirString(): this((string)null) {} + public FhirString(): this((string?)null) {} /// /// Primitive value of the element @@ -76,9 +79,9 @@ public FhirString(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [StringPattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs index 7b61da5f3..1d3f123ec 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/FhirUri.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class FhirUri : PrimitiveType, IValue /// Must conform to the pattern "\S*" public const string PATTERN = @"\S*"; - public FhirUri(string value) + public FhirUri(string? value) { Value = value; } - public FhirUri(): this((string)null) {} + public FhirUri(): this((string?)null) {} /// /// Primitive value of the element @@ -76,9 +79,9 @@ public FhirUri(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [UriPattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs b/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs index 605794031..019cde620 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/FhirUrl.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -59,12 +62,12 @@ public partial class FhirUrl : PrimitiveType, IValue /// Must conform to the pattern "\S*" public const string PATTERN = @"\S*"; - public FhirUrl(string value) + public FhirUrl(string? value) { Value = value; } - public FhirUrl(): this((string)null) {} + public FhirUrl(): this((string?)null) {} /// /// Primitive value of the element @@ -72,9 +75,9 @@ public FhirUrl(): this((string)null) {} [FhirElement("value", IsPrimitiveValue=true, XmlSerialization=XmlRepresentation.XmlAttr, InSummary=true, Order=30)] [DeclaredType(Type = typeof(SystemPrimitive.String))] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Id.cs b/src/Hl7.Fhir.Base/Model/Generated/Id.cs index 7064bba8f..0767912ac 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Id.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Id.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class Id : PrimitiveType, IValue /// Must conform to the pattern "[A-Za-z0-9\-\.]{1,64}" public const string PATTERN = @"[A-Za-z0-9\-\.]{1,64}"; - public Id(string value) + public Id(string? value) { Value = value; } - public Id(): this((string)null) {} + public Id(): this((string?)null) {} /// /// Primitive value of the element @@ -76,9 +79,9 @@ public Id(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [IdPattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs index 256074c78..408a14cb2 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -107,13 +110,13 @@ public enum IdentifierUse [DeclaredType(Type = typeof(Code))] [Binding("IdentifierUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// usual | official | temp | secondary | old (If known) @@ -136,33 +139,33 @@ public Hl7.Fhir.Model.Identifier.IdentifierUse? Use [FhirElement("type", InSummary=true, Order=40)] [Binding("IdentifierType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The namespace for the identifier value. /// [FhirElement("system", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// The namespace for the identifier value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { get => _SystemElement?.Value; set @@ -177,20 +180,20 @@ public string System /// [FhirElement("value", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The value that is unique /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { get => _ValueElement?.Value; set @@ -205,13 +208,13 @@ public string Value /// [FhirElement("period", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that issued id (may be just text). @@ -220,13 +223,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Assigner + public Hl7.Fhir.Model.ResourceReference? Assigner { get { return _Assigner; } set { _Assigner = value; OnPropertyChanged("Assigner"); } } - private Hl7.Fhir.Model.ResourceReference _Assigner; + private Hl7.Fhir.Model.ResourceReference? _Assigner; protected internal override void CopyToInternal(Base other) { @@ -254,17 +257,18 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Identifier otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Assigner, otherT._Assigner)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -292,27 +296,27 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "assigner": - Assigner = (Hl7.Fhir.Model.ResourceReference)value; + Assigner = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Instant.cs b/src/Hl7.Fhir.Base/Model/Generated/Instant.cs index 79028c84d..b96551758 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Instant.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Instant.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/Integer.cs b/src/Hl7.Fhir.Base/Model/Generated/Integer.cs index 0de52b51b..5321fba8f 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Integer.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Integer.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs b/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs index fa0611552..c6fe05b6e 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Integer64.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs b/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs index d795f61be..a6f06ee17 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Markdown.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class Markdown : PrimitiveType, IValue /// Must conform to the pattern "^[\s\S]+$" public const string PATTERN = @"^[\s\S]+$"; - public Markdown(string value) + public Markdown(string? value) { Value = value; } - public Markdown(): this((string)null) {} + public Markdown(): this((string?)null) {} /// /// Primitive value of the element @@ -76,9 +79,9 @@ public Markdown(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [StringPattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs index 33c3d782d..29b44baa9 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,20 +67,20 @@ public partial class Meta : Hl7.Fhir.Model.DataType /// [FhirElement("versionId", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Id VersionIdElement + public Hl7.Fhir.Model.Id? VersionIdElement { get { return _VersionIdElement; } set { _VersionIdElement = value; OnPropertyChanged("VersionIdElement"); } } - private Hl7.Fhir.Model.Id _VersionIdElement; + private Hl7.Fhir.Model.Id? _VersionIdElement; /// /// Version specific identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VersionId + public string? VersionId { get => _VersionIdElement?.Value; set @@ -92,13 +95,13 @@ public string VersionId /// [FhirElement("lastUpdated", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Instant LastUpdatedElement + public Hl7.Fhir.Model.Instant? LastUpdatedElement { get { return _LastUpdatedElement; } set { _LastUpdatedElement = value; OnPropertyChanged("LastUpdatedElement"); } } - private Hl7.Fhir.Model.Instant _LastUpdatedElement; + private Hl7.Fhir.Model.Instant? _LastUpdatedElement; /// /// When the resource version last changed @@ -123,20 +126,20 @@ public DateTimeOffset? LastUpdated /// [FhirElement("source", InSummary=true, Order=50, Since=FhirRelease.R4)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// Identifies where the resource comes from /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { get => _SourceElement?.Value; set @@ -168,20 +171,20 @@ public List ProfileElement set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// Profiles this resource claims to conform to. Use this property in STU3. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProfileUri + public IEnumerable? ProfileUri { - get { return ProfileElement != null ? ProfileElement.Cast>().Select(elem => elem.Value) : null; } + get => _ProfileElement?.Cast>()?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("ProfileUri"); @@ -193,13 +196,13 @@ public IEnumerable ProfileUri /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Cast>().Select(elem => elem.Value) : null; } + get => _ProfileElement?.Cast>()?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -219,7 +222,7 @@ public List Security set { _Security = value; OnPropertyChanged("Security"); } } - private List _Security; + private List? _Security; /// /// Tags applied to this resource. @@ -234,7 +237,7 @@ public List Tag set { _Tag = value; OnPropertyChanged("Tag"); } } - private List _Tag; + private List? _Tag; protected internal override void CopyToInternal(Base other) { @@ -262,17 +265,18 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Meta otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; if(!comparer.Equals(_LastUpdatedElement, otherT._LastUpdatedElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Security, otherT._Security)) return false; if(!comparer.ListEquals(_Tag, otherT._Tag)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -300,27 +304,27 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "versionId": - VersionIdElement = (Hl7.Fhir.Model.Id)value; + VersionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "lastUpdated": - LastUpdatedElement = (Hl7.Fhir.Model.Instant)value; + LastUpdatedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "security": - Security = (List)value; + Security = (List?)value!; return this; case "tag": - Tag = (List)value; + Tag = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs index f56b49e31..28b42e3ff 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -101,13 +104,13 @@ public enum NarrativeStatus [Binding("NarrativeStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// generated | extensions | additional | empty @@ -130,20 +133,20 @@ public Hl7.Fhir.Model.Narrative.NarrativeStatus? Status [FhirElement("div", XmlSerialization = XmlRepresentation.XHtml, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.XHtml DivElement + public Hl7.Fhir.Model.XHtml? DivElement { get { return _DivElement; } set { _DivElement = value; OnPropertyChanged("DivElement"); } } - private Hl7.Fhir.Model.XHtml _DivElement; + private Hl7.Fhir.Model.XHtml? _DivElement; /// /// Limited xhtml content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Div + public string? Div { get => _DivElement?.Value; set @@ -175,13 +178,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Narrative otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_DivElement, otherT._DivElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -197,15 +201,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "div": - DivElement = (Hl7.Fhir.Model.XHtml)value; + DivElement = (Hl7.Fhir.Model.XHtml?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Oid.cs b/src/Hl7.Fhir.Base/Model/Generated/Oid.cs index 70f7baf49..6aa8f1862 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Oid.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Oid.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class Oid : PrimitiveType, IValue /// Must conform to the pattern "urn:oid:[0-2](\.(0|[1-9][0-9]*))+" public const string PATTERN = @"urn:oid:[0-2](\.(0|[1-9][0-9]*))+"; - public Oid(string value) + public Oid(string? value) { Value = value; } - public Oid(): this((string)null) {} + public Oid(): this((string?)null) {} /// /// Primitive value of the element @@ -76,9 +79,9 @@ public Oid(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [OidPattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs index 29169de67..255eff126 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -333,13 +336,13 @@ public partial class IssueComponent : Hl7.Fhir.Model.BackboneElement [Binding("IssueSeverity")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// fatal | error | warning | information | success @@ -364,13 +367,13 @@ public Hl7.Fhir.Model.OperationOutcome.IssueSeverity? Severity [Binding("IssueType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Error or warning code @@ -393,33 +396,33 @@ public Hl7.Fhir.Model.OperationOutcome.IssueType? Code [FhirElement("details", InSummary=true, Order=60)] [Binding("IssueDetails")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Details + public Hl7.Fhir.Model.CodeableConcept? Details { get { return _Details; } set { _Details = value; OnPropertyChanged("Details"); } } - private Hl7.Fhir.Model.CodeableConcept _Details; + private Hl7.Fhir.Model.CodeableConcept? _Details; /// /// Additional diagnostic information about the issue. /// [FhirElement("diagnostics", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DiagnosticsElement + public Hl7.Fhir.Model.FhirString? DiagnosticsElement { get { return _DiagnosticsElement; } set { _DiagnosticsElement = value; OnPropertyChanged("DiagnosticsElement"); } } - private Hl7.Fhir.Model.FhirString _DiagnosticsElement; + private Hl7.Fhir.Model.FhirString? _DiagnosticsElement; /// /// Additional diagnostic information about the issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Diagnostics + public string? Diagnostics { get => _DiagnosticsElement?.Value; set @@ -441,20 +444,20 @@ public List LocationElement set { _LocationElement = value; OnPropertyChanged("LocationElement"); } } - private List _LocationElement; + private List? _LocationElement; /// /// Deprecated: Path of element(s) related to issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Location + public IEnumerable? Location { - get { return LocationElement != null ? LocationElement.Select(elem => elem.Value) : null; } + get => _LocationElement?.Select(elem => elem.Value); set { if (value == null) - LocationElement = null; + LocationElement = null!; else LocationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Location"); @@ -473,20 +476,20 @@ public List ExpressionElement set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private List _ExpressionElement; + private List? _ExpressionElement; /// /// FHIRPath of element(s) related to issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Expression + public IEnumerable? Expression { - get { return ExpressionElement != null ? ExpressionElement.Select(elem => elem.Value) : null; } + get => _ExpressionElement?.Select(elem => elem.Value); set { if (value == null) - ExpressionElement = null; + ExpressionElement = null!; else ExpressionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Expression"); @@ -519,17 +522,18 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IssueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Details, otherT._Details)) return false; if(!comparer.Equals(_DiagnosticsElement, otherT._DiagnosticsElement)) return false; if(!comparer.ListEquals(_LocationElement, otherT._LocationElement)) return false; if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -557,27 +561,27 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "details": - Details = (Hl7.Fhir.Model.CodeableConcept)value; + Details = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "diagnostics": - DiagnosticsElement = (Hl7.Fhir.Model.FhirString)value; + DiagnosticsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "location": - LocationElement = (List)value; + LocationElement = (List?)value!; return this; case "expression": - ExpressionElement = (List)value; + ExpressionElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -610,7 +614,7 @@ public List Issue set { _Issue = value; OnPropertyChanged("Issue"); } } - private List _Issue; + private List? _Issue; protected internal override void CopyToInternal(Base other) { @@ -633,12 +637,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationOutcome otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Issue, otherT._Issue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Issue, otherT._Issue)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -651,12 +656,12 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "issue": - Issue = (List)value; + Issue = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs index 6843d63d9..00388fcd2 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,20 +85,20 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name from the definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -110,13 +113,13 @@ public string Name /// [FhirElement("value", InSummary=true, Order=50, Choice=ChoiceType.DatatypeChoice)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// If parameter is a whole resource. @@ -125,13 +128,13 @@ public Hl7.Fhir.Model.DataType Value [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Resource))] [DataMember] - public Hl7.Fhir.Model.Resource Resource + public Hl7.Fhir.Model.Resource? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.Resource _Resource; + private Hl7.Fhir.Model.Resource? _Resource; /// /// Named part of a multi-part parameter. @@ -145,7 +148,7 @@ public List Part set { _Part = value; OnPropertyChanged("Part"); } } - private List _Part; + private List? _Part; protected internal override void CopyToInternal(Base other) { @@ -171,15 +174,16 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Part, otherT._Part)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -201,21 +205,21 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.Resource)value; + Resource = (Hl7.Fhir.Model.Resource?)value; return this; case "part": - Part = (List)value; + Part = (List?)value!; return this; default: return base.SetValue(key, value); @@ -246,7 +250,7 @@ public List Parameter set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; protected internal override void CopyToInternal(Base other) { @@ -269,12 +273,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Parameters otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -287,12 +292,12 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Period.cs b/src/Hl7.Fhir.Base/Model/Generated/Period.cs index f23c400ac..8b10bb038 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Period.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Period.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,20 +69,20 @@ public partial class Period : Hl7.Fhir.Model.DataType /// [FhirElement("start", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartElement + public Hl7.Fhir.Model.FhirDateTime? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartElement; + private Hl7.Fhir.Model.FhirDateTime? _StartElement; /// /// Starting time with inclusive boundary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Start + public string? Start { get => _StartElement?.Value; set @@ -94,20 +97,20 @@ public string Start /// [FhirElement("end", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EndElement + public Hl7.Fhir.Model.FhirDateTime? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EndElement; + private Hl7.Fhir.Model.FhirDateTime? _EndElement; /// /// End time with inclusive boundary, if not ongoing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string End + public string? End { get => _EndElement?.Value; set @@ -139,13 +142,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Period otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -161,15 +165,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.FhirDateTime)value; + EndElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs b/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs index 66bb2846e..6df68dac6 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/PositiveInt.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs index ebbead031..4c3a6baa4 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -68,6 +71,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrimitiveType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here#pragma warning restore CS8604 // Possible null reference argument. return Equals(ObjectValue, otherT.ObjectValue); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs index a7ce8de41..c758b0f47 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -105,13 +108,13 @@ public enum QuantityComparator /// [FhirElement("value", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Numerical value (with implicit precision) @@ -135,13 +138,13 @@ public decimal? Value [DeclaredType(Type = typeof(Code))] [Binding("QuantityComparator")] [DataMember] - public Code ComparatorElement + public Code? ComparatorElement { get { return _ComparatorElement; } set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private Code _ComparatorElement; + private Code? _ComparatorElement; /// /// < | <= | >= | > | ad - how to understand the value @@ -163,20 +166,20 @@ public Hl7.Fhir.Model.Quantity.QuantityComparator? Comparator /// [FhirElement("unit", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString UnitElement + public Hl7.Fhir.Model.FhirString? UnitElement { get { return _UnitElement; } set { _UnitElement = value; OnPropertyChanged("UnitElement"); } } - private Hl7.Fhir.Model.FhirString _UnitElement; + private Hl7.Fhir.Model.FhirString? _UnitElement; /// /// Unit representation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Unit + public string? Unit { get => _UnitElement?.Value; set @@ -191,20 +194,20 @@ public string Unit /// [FhirElement("system", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// System that defines coded unit form /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { get => _SystemElement?.Value; set @@ -219,20 +222,20 @@ public string System /// [FhirElement("code", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Coded form of the unit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -267,16 +270,17 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Quantity otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false; if(!comparer.Equals(_UnitElement, otherT._UnitElement)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -301,24 +305,24 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "comparator": - ComparatorElement = (Code)value; + ComparatorElement = (Code?)value; return this; case "unit": - UnitElement = (Hl7.Fhir.Model.FhirString)value; + UnitElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Range.cs b/src/Hl7.Fhir.Base/Model/Generated/Range.cs index a72c3dd11..b59cfb048 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Range.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Range.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -65,26 +68,26 @@ public partial class Range : Hl7.Fhir.Model.DataType /// [FhirElement("low", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity Low + public Hl7.Fhir.Model.Quantity? Low { get { return _Low; } set { _Low = value; OnPropertyChanged("Low"); } } - private Hl7.Fhir.Model.Quantity _Low; + private Hl7.Fhir.Model.Quantity? _Low; /// /// High limit. /// [FhirElement("high", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity High + public Hl7.Fhir.Model.Quantity? High { get { return _High; } set { _High = value; OnPropertyChanged("High"); } } - private Hl7.Fhir.Model.Quantity _High; + private Hl7.Fhir.Model.Quantity? _High; protected internal override void CopyToInternal(Base other) { @@ -108,13 +111,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Range otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_Low, otherT._Low)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; if(!comparer.Equals(_High, otherT._High)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -130,15 +134,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "low": - Low = (Hl7.Fhir.Model.Quantity)value; + Low = (Hl7.Fhir.Model.Quantity?)value; return this; case "high": - High = (Hl7.Fhir.Model.Quantity)value; + High = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs index b3b20be32..be68607ca 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -59,20 +62,20 @@ public abstract partial class Resource : Hl7.Fhir.Model.Base /// [FhirElement("id", InSummary=true, Order=10)] [DataMember] - public Hl7.Fhir.Model.Id IdElement + public Hl7.Fhir.Model.Id? IdElement { get { return _IdElement; } set { _IdElement = value; OnPropertyChanged("IdElement"); } } - private Hl7.Fhir.Model.Id _IdElement; + private Hl7.Fhir.Model.Id? _IdElement; /// /// Logical id of this artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Id + public string? Id { get => _IdElement?.Value; set @@ -87,33 +90,33 @@ public string Id /// [FhirElement("meta", InSummary=true, Order=20)] [DataMember] - public Hl7.Fhir.Model.Meta Meta + public Hl7.Fhir.Model.Meta? Meta { get { return _Meta; } set { _Meta = value; OnPropertyChanged("Meta"); } } - private Hl7.Fhir.Model.Meta _Meta; + private Hl7.Fhir.Model.Meta? _Meta; /// /// A set of rules under which this content was created. /// [FhirElement("implicitRules", InSummary=true, IsModifier=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirUri ImplicitRulesElement + public Hl7.Fhir.Model.FhirUri? ImplicitRulesElement { get { return _ImplicitRulesElement; } set { _ImplicitRulesElement = value; OnPropertyChanged("ImplicitRulesElement"); } } - private Hl7.Fhir.Model.FhirUri _ImplicitRulesElement; + private Hl7.Fhir.Model.FhirUri? _ImplicitRulesElement; /// /// A set of rules under which this content was created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ImplicitRules + public string? ImplicitRules { get => _ImplicitRulesElement?.Value; set @@ -129,20 +132,20 @@ public string ImplicitRules [FhirElement("language", Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Language of the resource content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { get => _LanguageElement?.Value; set @@ -169,15 +172,16 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Resource otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_IdElement, otherT._IdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdElement, otherT._IdElement)) return false; if(!comparer.Equals(_Meta, otherT._Meta)) return false; if(!comparer.Equals(_ImplicitRulesElement, otherT._ImplicitRulesElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -199,21 +203,21 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "id": - IdElement = (Hl7.Fhir.Model.Id)value; + IdElement = (Hl7.Fhir.Model.Id?)value; return this; case "meta": - Meta = (Hl7.Fhir.Model.Meta)value; + Meta = (Hl7.Fhir.Model.Meta?)value; return this; case "implicitRules": - ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri)value; + ImplicitRulesElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs index 8cc6c07dd..b0731ac22 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,20 +67,20 @@ public partial class ResourceReference : Hl7.Fhir.Model.DataType /// [FhirElement("reference", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceElement + public Hl7.Fhir.Model.FhirString? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceElement; + private Hl7.Fhir.Model.FhirString? _ReferenceElement; /// /// Literal reference, Relative, internal or absolute URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { get => _ReferenceElement?.Value; set @@ -96,20 +99,20 @@ public string Reference [FhirElement("type", InSummary=true, Order=40, Since=FhirRelease.R4)] [Binding("FHIRResourceTypeExt")] [DataMember] - public Hl7.Fhir.Model.FhirUri TypeElement + public Hl7.Fhir.Model.FhirUri? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirUri _TypeElement; + private Hl7.Fhir.Model.FhirUri? _TypeElement; /// /// Type the reference refers to (e.g. "Patient") - must be a resource in resources /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { get => _TypeElement?.Value; set @@ -124,33 +127,33 @@ public string Type /// [FhirElement("identifier", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Text alternative for the resource. /// [FhirElement("display", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Text alternative for the resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { get => _DisplayElement?.Value; set @@ -184,15 +187,16 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -214,21 +218,21 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirUri)value; + TypeElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs index c110d2c71..56425b966 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -76,7 +79,7 @@ public List Type set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// When the signature was created. @@ -86,13 +89,13 @@ public List Type /// [FhirElement("when", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Instant WhenElement + public Hl7.Fhir.Model.Instant? WhenElement { get { return _WhenElement; } set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } - private Hl7.Fhir.Model.Instant _WhenElement; + private Hl7.Fhir.Model.Instant? _WhenElement; /// /// When the signature was created @@ -124,13 +127,13 @@ public DateTimeOffset? When [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization", Since=FhirRelease.R4)] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType Who + public Hl7.Fhir.Model.DataType? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.DataType _Who; + private Hl7.Fhir.Model.DataType? _Who; /// /// The party represented. @@ -146,13 +149,13 @@ public Hl7.Fhir.Model.DataType Who [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization", Since=FhirRelease.R4)] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType OnBehalfOf + public Hl7.Fhir.Model.DataType? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.DataType _OnBehalfOf; + private Hl7.Fhir.Model.DataType? _OnBehalfOf; /// /// The technical format of the signature. @@ -164,20 +167,20 @@ public Hl7.Fhir.Model.DataType OnBehalfOf [NotMapped(Since=FhirRelease.R4)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// The technical format of the signature /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { get => _ContentTypeElement?.Value; set @@ -196,20 +199,20 @@ public string ContentType [FhirElement("targetFormat", Order=70, Since=FhirRelease.R4)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code TargetFormatElement + public Hl7.Fhir.Model.Code? TargetFormatElement { get { return _TargetFormatElement; } set { _TargetFormatElement = value; OnPropertyChanged("TargetFormatElement"); } } - private Hl7.Fhir.Model.Code _TargetFormatElement; + private Hl7.Fhir.Model.Code? _TargetFormatElement; /// /// The technical format of the signed resources /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetFormat + public string? TargetFormat { get => _TargetFormatElement?.Value; set @@ -228,20 +231,20 @@ public string TargetFormat [FhirElement("sigFormat", Order=80, Since=FhirRelease.R4)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code SigFormatElement + public Hl7.Fhir.Model.Code? SigFormatElement { get { return _SigFormatElement; } set { _SigFormatElement = value; OnPropertyChanged("SigFormatElement"); } } - private Hl7.Fhir.Model.Code _SigFormatElement; + private Hl7.Fhir.Model.Code? _SigFormatElement; /// /// The technical format of the signature /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SigFormat + public string? SigFormat { get => _SigFormatElement?.Value; set @@ -260,20 +263,20 @@ public string SigFormat [FhirElement("blob", Order=90)] [NotMapped(Since=FhirRelease.R4)] [DataMember] - public Hl7.Fhir.Model.Base64Binary BlobElement + public Hl7.Fhir.Model.Base64Binary? BlobElement { get { return _BlobElement; } set { _BlobElement = value; OnPropertyChanged("BlobElement"); } } - private Hl7.Fhir.Model.Base64Binary _BlobElement; + private Hl7.Fhir.Model.Base64Binary? _BlobElement; /// /// The actual signature content (XML DigSig. JWS, picture, etc.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Blob + public byte[]? Blob { get => _BlobElement?.Value; set @@ -291,20 +294,20 @@ public byte[] Blob /// [FhirElement("data", Order=90, Since=FhirRelease.R4)] [DataMember] - public Hl7.Fhir.Model.Base64Binary DataElement + public Hl7.Fhir.Model.Base64Binary? DataElement { get { return _DataElement; } set { _DataElement = value; OnPropertyChanged("DataElement"); } } - private Hl7.Fhir.Model.Base64Binary _DataElement; + private Hl7.Fhir.Model.Base64Binary? _DataElement; /// /// The actual signature content (XML DigSig. JWS, picture, etc.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Data + public byte[]? Data { get => _DataElement?.Value; set @@ -343,7 +346,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Signature otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_WhenElement, otherT._WhenElement)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; @@ -352,11 +355,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SigFormatElement, otherT._SigFormatElement)) return false; if(!comparer.Equals(_BlobElement, otherT._BlobElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -393,36 +397,36 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "when": - WhenElement = (Hl7.Fhir.Model.Instant)value; + WhenElement = (Hl7.Fhir.Model.Instant?)value; return this; case "who": - Who = (Hl7.Fhir.Model.DataType)value; + Who = (Hl7.Fhir.Model.DataType?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.DataType)value; + OnBehalfOf = (Hl7.Fhir.Model.DataType?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "targetFormat": - TargetFormatElement = (Hl7.Fhir.Model.Code)value; + TargetFormatElement = (Hl7.Fhir.Model.Code?)value; return this; case "sigFormat": - SigFormatElement = (Hl7.Fhir.Model.Code)value; + SigFormatElement = (Hl7.Fhir.Model.Code?)value; return this; case "blob": - BlobElement = (Hl7.Fhir.Model.Base64Binary)value; + BlobElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "data": - DataElement = (Hl7.Fhir.Model.Base64Binary)value; + DataElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Time.cs b/src/Hl7.Fhir.Base/Model/Generated/Time.cs index 5f910ae09..33a6e4b6f 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Time.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Time.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -59,12 +62,12 @@ public partial class Time : PrimitiveType, IValue /// Must conform to the pattern "([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?" public const string PATTERN = @"([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]{1,9})?"; - public Time(string value) + public Time(string? value) { Value = value; } - public Time(): this((string)null) {} + public Time(): this((string?)null) {} /// /// Primitive value of the element @@ -73,9 +76,9 @@ public Time(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.Time))] [TimePattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs b/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs index 3366bd709..55a942abe 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/UnsignedInt.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs index c2f0c01f7..c9034bfac 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,13 +69,13 @@ public partial class UsageContext : Hl7.Fhir.Model.DataType [Binding("UsageContextType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Code + public Hl7.Fhir.Model.Coding? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.Coding _Code; + private Hl7.Fhir.Model.Coding? _Code; /// /// Value that defines the context. @@ -84,13 +87,13 @@ public Hl7.Fhir.Model.Coding Code [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { @@ -114,13 +117,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UsageContext otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { @@ -136,15 +140,15 @@ public override bool TryGetValue(string key, out object value) } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.Coding)value; + Code = (Hl7.Fhir.Model.Coding?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs b/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs index 5c0be7f55..06733f0c0 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Uuid.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,12 +65,12 @@ public partial class Uuid : PrimitiveType, IValue /// Must conform to the pattern "urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" public const string PATTERN = @"urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; - public Uuid(string value) + public Uuid(string? value) { Value = value; } - public Uuid(): this((string)null) {} + public Uuid(): this((string?)null) {} /// /// Primitive value of the element @@ -76,9 +79,9 @@ public Uuid(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [UuidPattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs b/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs index a8804a160..df15a08e7 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/XHtml.cs @@ -7,9 +7,12 @@ using Hl7.Fhir.Introspection; using Hl7.Fhir.Specification; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; using COVE=Hl7.Fhir.Validation.CodedValidationException; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -56,12 +59,12 @@ public partial class XHtml : PrimitiveType, IValue /// public override string TypeName { get { return "xhtml"; } } - public XHtml(string value) + public XHtml(string? value) { Value = value; } - public XHtml(): this((string)null) {} + public XHtml(): this((string?)null) {} /// /// Primitive value of the element @@ -70,9 +73,9 @@ public XHtml(): this((string)null) {} [DeclaredType(Type = typeof(SystemPrimitive.String))] [NarrativeXhtmlPattern] [DataMember] - public string Value + public string? Value { - get { return ObjectValue is string or null ? (string)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } + get { return ObjectValue is string or null ? (string?)ObjectValue : throw COVE.INCORRECT_LITERAL_VALUE_TYPE(null, ObjectValue, this.TypeName); } set { ObjectValue = value; OnPropertyChanged("Value"); } } diff --git a/src/Hl7.Fhir.Base/Model/IIdentifiable.cs b/src/Hl7.Fhir.Base/Model/IIdentifiable.cs index 5defa18b2..f07549326 100644 --- a/src/Hl7.Fhir.Base/Model/IIdentifiable.cs +++ b/src/Hl7.Fhir.Base/Model/IIdentifiable.cs @@ -30,7 +30,7 @@ public interface IIdentifiable /// The type that is used to identify the resource, usually a (list of) . public interface IIdentifiable : IIdentifiable { - T Identifier { get; set; } + T? Identifier { get; set; } } diff --git a/src/Hl7.Fhir.Base/Model/IValue.cs b/src/Hl7.Fhir.Base/Model/IValue.cs index 2e5ff6838..1312151ad 100644 --- a/src/Hl7.Fhir.Base/Model/IValue.cs +++ b/src/Hl7.Fhir.Base/Model/IValue.cs @@ -6,6 +6,8 @@ * available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE */ +#nullable enable + namespace Hl7.Fhir.Model; /// Common generic Value property interface. @@ -13,9 +15,9 @@ namespace Hl7.Fhir.Model; public interface IValue { /// Gets or sets the value - T Value { get; set; } + T? Value { get; set; } } /// Common generic nullable value property interface. /// The value type. -public interface INullableValue : IValue where T : struct { } \ No newline at end of file +public interface INullableValue : IValue where T : struct; \ No newline at end of file diff --git a/src/Hl7.Fhir.Base/Model/OverflowEntry.cs b/src/Hl7.Fhir.Base/Model/OverflowEntry.cs new file mode 100644 index 000000000..a32393afc --- /dev/null +++ b/src/Hl7.Fhir.Base/Model/OverflowEntry.cs @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2025, Firely (info@fire.ly) and contributors + * See the file CONTRIBUTORS for details. + * + * This file is licensed under the BSD 3-Clause license + * available at https://raw.githubusercontent.com/FirelyTeam/firely-net-sdk/master/LICENSE + */ + +#nullable enable + +using Hl7.Fhir.Validation; +using System; +using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; + +namespace Hl7.Fhir.Model; + +/// +/// Contains both a value for an overflow and its nature. +/// +/// Internal use only. This class keeps track of why an item appears in overflow so validation +/// can provide the correct error message. +public abstract record OverflowEntry(object Value) +{ + private readonly static object OVERFLOW_MARKER = new(); + + public static T GetOverflowMarker() where T:class => Unsafe.As(OVERFLOW_MARKER); + public static bool IsOverflow(object marker) => ReferenceEquals(marker, OVERFLOW_MARKER); + + public virtual CodedValidationException? Validate(ValidationContext context) => null; +} + +public record UnknownElementOverflow(object Value) : OverflowEntry(Value); + +public record IncorrectTypeOverflow(object Value, Type ExpectedType) : OverflowEntry(Value); \ No newline at end of file diff --git a/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs b/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs index 5795b4287..a0f546cb1 100644 --- a/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs +++ b/src/Hl7.Fhir.Base/Model/PocoEqualityComparisons.cs @@ -89,12 +89,14 @@ public static class PocoEqualityComparisons /// /// Is throw when the IEqualityComparer for Base does not /// support comparing IEnumerable{Base} - public static bool ListEquals(this IEqualityComparer comparer, IEnumerable a, IEnumerable b) + public static bool ListEquals(this IEqualityComparer comparer, IEnumerable? a, IEnumerable? b) { if (comparer is not IEqualityComparer> listComparer) throw new ArgumentException("The comparer does not support list comparison", nameof(comparer)); +#pragma warning disable CS8604 // Possible null reference argument - incorrect signature in netstd2.1 return listComparer.Equals(a, b); +#pragma warning restore CS8604 // Possible null reference argument. } /// diff --git a/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs b/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs index 8b22f52d0..25c7abf97 100644 --- a/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs +++ b/src/Hl7.Fhir.Base/Rest/TransactionBuilder.cs @@ -107,7 +107,7 @@ public TransactionBuilder Get(string url, string? bundleEntryFullUrl = null) public TransactionBuilder Read(string resourceType, string id, string? versionId = null, DateTimeOffset? ifModifiedSince = null, string? bundleEntryFullUrl = null) { var entry = newEntry(Bundle.HTTPVerb.GET, InteractionType.Read, bundleEntryFullUrl); - entry.Request.IfNoneMatch = createIfMatchETag(versionId); + entry.Request!.IfNoneMatch = createIfMatchETag(versionId); entry.Request.IfModifiedSince = ifModifiedSince; var path = newRestUrl().AddPath(resourceType, id); addEntry(entry, path); @@ -148,7 +148,7 @@ public TransactionBuilder Update(string id, Resource body, string? versionId = n { var entry = newEntry(Bundle.HTTPVerb.PUT, InteractionType.Update, bundleEntryFullUrl); entry.Resource = body; - entry.Request.IfMatch = createIfMatchETag(versionId); + entry.Request!.IfMatch = createIfMatchETag(versionId); var path = newRestUrl().AddPath(body.TypeName, id); addEntry(entry, path); @@ -167,7 +167,7 @@ public TransactionBuilder ConditionalUpdate(SearchParams condition, Resource bod { var entry = newEntry(Bundle.HTTPVerb.PUT, InteractionType.ConditionalUpdate, bundleEntryFullUrl); entry.Resource = body; - entry.Request.IfMatch = createIfMatchETag(versionId); + entry.Request!.IfMatch = createIfMatchETag(versionId); var path = newRestUrl().AddPath(body.TypeName); path.AddParams(condition.ToUriParamList()); addEntry(entry, path); @@ -192,7 +192,7 @@ public TransactionBuilder Patch(string resourceType, string id, Parameters body, { var entry = newEntry(Bundle.HTTPVerb.PATCH, InteractionType.Patch, bundleEntryFullUrl); entry.Resource = body; - entry.Request.IfMatch = createIfMatchETag(versionId); + entry.Request!.IfMatch = createIfMatchETag(versionId); var path = newRestUrl().AddPath(resourceType, id); addEntry(entry, path); @@ -212,7 +212,7 @@ public TransactionBuilder ConditionalPatch(string resourceType, SearchParams con { var entry = newEntry(Bundle.HTTPVerb.PATCH, InteractionType.ConditionalPatch, bundleEntryFullUrl); entry.Resource = body; - entry.Request.IfMatch = createIfMatchETag(versionId); + entry.Request!.IfMatch = createIfMatchETag(versionId); var path = newRestUrl().AddPath(resourceType); path.AddParams(condition.ToUriParamList()); addEntry(entry, path); @@ -253,7 +253,7 @@ public TransactionBuilder ConditionalDeleteSingle(SearchParams condition, string var entry = newEntry(Bundle.HTTPVerb.DELETE, InteractionType.ConditionalDeleteSingle, bundleEntryFullUrl); var path = newRestUrl().AddPath(resourceType ?? ""); path.AddParams(condition.ToUriParamList()); - entry.Request.IfMatch = createIfMatchETag(versionId); + entry.Request!.IfMatch = createIfMatchETag(versionId); addEntry(entry, path); @@ -347,7 +347,7 @@ public TransactionBuilder ConditionalCreate(Resource body, SearchParams conditio entry.Resource = body; var path = newRestUrl().AddPath(body.TypeName); - entry.Request.IfNoneExist = condition.ToUriParamList().ToQueryString(); + entry.Request!.IfNoneExist = condition.ToUriParamList().ToQueryString(); addEntry(entry, path); return this; @@ -635,6 +635,8 @@ private static Bundle.EntryComponent newEntry(Bundle.HTTPVerb method, Interactio private void addEntry(Bundle.EntryComponent newEntry, RestUrl path) { + if(newEntry.Request is null) throw Error.InvalidOperation("Request component of the entry is not set."); + var url = HttpUtil.MakeRelativeFromBase(path.Uri, _baseUrl); newEntry.Request.Url = url!.OriginalString; _result.Entry.Add(newEntry); diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs index 4905a3a67..e064a4a99 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -376,20 +379,20 @@ public partial class SoftwareComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name the software is known by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -404,20 +407,20 @@ public string Name /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version covered by this statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -432,20 +435,20 @@ public string Version /// [FhirElement("releaseDate", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReleaseDateElement + public Hl7.Fhir.Model.FhirDateTime? ReleaseDateElement { get { return _ReleaseDateElement; } set { _ReleaseDateElement = value; OnPropertyChanged("ReleaseDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReleaseDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ReleaseDateElement; /// /// Date this version was released /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReleaseDate + public string? ReleaseDate { get => _ReleaseDateElement?.Value; set @@ -457,12 +460,8 @@ public string ReleaseDate protected internal override void CopyToInternal(Base other) { - var dest = other as SoftwareComponent; - - if (dest == null) - { + if(other is not SoftwareComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); @@ -482,44 +481,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_ReleaseDateElement, otherT._ReleaseDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "releaseDate": - value = ReleaseDateElement; - return ReleaseDateElement is not null; + value = _ReleaseDateElement; + return _ReleaseDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "releaseDate": - ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -530,9 +530,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (ReleaseDateElement is not null) yield return new KeyValuePair("releaseDate",ReleaseDateElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_ReleaseDateElement is not null) yield return new KeyValuePair("releaseDate",_ReleaseDateElement); } } @@ -569,22 +569,22 @@ public partial class ImplementationComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Hl7.Fhir.Model.Markdown), Since = FhirRelease.R5)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PrimitiveType DescriptionElement + public Hl7.Fhir.Model.PrimitiveType? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.PrimitiveType _DescriptionElement; + private Hl7.Fhir.Model.PrimitiveType? _DescriptionElement; /// /// Describes this specific instance. Use this property in STU3, R4 and R4B. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DescriptionString + public string? DescriptionString { - get => ((IValue)_DescriptionElement)?.Value; + get => ((IValue?)_DescriptionElement)?.Value; set { DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); @@ -597,9 +597,9 @@ public string DescriptionString /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get => ((IValue)_DescriptionElement)?.Value; + get => ((IValue?)_DescriptionElement)?.Value; set { DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); @@ -612,20 +612,20 @@ public string Description /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// Base URL for the installation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -642,22 +642,18 @@ public string Url [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationComponent; - - if (dest == null) - { + if(other is not ImplementationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)_DescriptionElement.DeepCopyInternal(); @@ -677,44 +673,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)value; + DescriptionElement = (Hl7.Fhir.Model.PrimitiveType?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -725,9 +722,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); } } @@ -757,13 +754,13 @@ public partial class RestComponent : Hl7.Fhir.Model.BackboneElement [Binding("RestfulCapabilityMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// client | server @@ -785,20 +782,20 @@ public Hl7.Fhir.Model.CapabilityStatement.RestfulCapabilityMode? Mode /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// General description of implementation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -813,13 +810,13 @@ public string Documentation /// [FhirElement("security", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent Security + public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? Security { get { return _Security; } set { _Security = value; OnPropertyChanged("Security"); } } - private Hl7.Fhir.Model.CapabilityStatement.SecurityComponent _Security; + private Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? _Security; /// /// Resource served on the REST interface. @@ -833,7 +830,7 @@ public List Resource set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// What operations are supported?. @@ -847,7 +844,7 @@ public List Inter set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private List _Interaction; + private List? _Interaction; /// /// Search parameters for searching all resources. @@ -861,7 +858,7 @@ public List SearchParam set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } - private List _SearchParam; + private List? _SearchParam; /// /// Definition of a system level operation. @@ -875,7 +872,7 @@ public List Operation set { _Operation = value; OnPropertyChanged("Operation"); } } - private List _Operation; + private List? _Operation; /// /// Compartments served/used by system. @@ -889,20 +886,20 @@ public List CompartmentElement set { _CompartmentElement = value; OnPropertyChanged("CompartmentElement"); } } - private List _CompartmentElement; + private List? _CompartmentElement; /// /// Compartments served/used by system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Compartment + public IEnumerable? Compartment { - get { return CompartmentElement != null ? CompartmentElement.Select(elem => elem.Value) : null; } + get => _CompartmentElement?.Select(elem => elem.Value); set { if (value == null) - CompartmentElement = null; + CompartmentElement = null!; else CompartmentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Compartment"); @@ -911,12 +908,8 @@ public IEnumerable Compartment protected internal override void CopyToInternal(Base other) { - var dest = other as RestComponent; - - if (dest == null) - { + if(other is not RestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); @@ -941,7 +934,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_Security, otherT._Security)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; @@ -949,71 +942,72 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_CompartmentElement, otherT._CompartmentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "security": - value = Security; - return Security is not null; + value = _Security; + return _Security is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "interaction": - value = Interaction; - return Interaction?.Any() == true; + value = _Interaction; + return _Interaction?.Any() == true; case "searchParam": - value = SearchParam; - return SearchParam?.Any() == true; + value = _SearchParam; + return _SearchParam?.Any() == true; case "operation": - value = Operation; - return Operation?.Any() == true; + value = _Operation; + return _Operation?.Any() == true; case "compartment": - value = CompartmentElement; - return CompartmentElement?.Any() == true; + value = _CompartmentElement; + return _CompartmentElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "security": - Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)value; + Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "interaction": - Interaction = (List)value; + Interaction = (List?)value!; return this; case "searchParam": - SearchParam = (List)value; + SearchParam = (List?)value!; return this; case "operation": - Operation = (List)value; + Operation = (List?)value!; return this; case "compartment": - CompartmentElement = (List)value; + CompartmentElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1024,14 +1018,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Security is not null) yield return new KeyValuePair("security",Security); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Interaction?.Any() == true) yield return new KeyValuePair("interaction",Interaction); - if (SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",SearchParam); - if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation); - if (CompartmentElement?.Any() == true) yield return new KeyValuePair("compartment",CompartmentElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Security is not null) yield return new KeyValuePair("security",_Security); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Interaction?.Any() == true) yield return new KeyValuePair("interaction",_Interaction); + if (_SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",_SearchParam); + if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation); + if (_CompartmentElement?.Any() == true) yield return new KeyValuePair("compartment",_CompartmentElement); } } @@ -1057,13 +1051,13 @@ public partial class SecurityComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("cors", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CorsElement + public Hl7.Fhir.Model.FhirBoolean? CorsElement { get { return _CorsElement; } set { _CorsElement = value; OnPropertyChanged("CorsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CorsElement; + private Hl7.Fhir.Model.FhirBoolean? _CorsElement; /// /// Adds CORS Headers (http://enable-cors.org/) @@ -1093,27 +1087,27 @@ public List Service set { _Service = value; OnPropertyChanged("Service"); } } - private List _Service; + private List? _Service; /// /// General description of how security works. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// General description of how security works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -1125,12 +1119,8 @@ public string Description protected internal override void CopyToInternal(Base other) { - var dest = other as SecurityComponent; - - if (dest == null) - { + if(other is not SecurityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CorsElement is not null) dest.CorsElement = (Hl7.Fhir.Model.FhirBoolean)_CorsElement.DeepCopyInternal(); @@ -1150,44 +1140,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SecurityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; if(!comparer.ListEquals(_Service, otherT._Service)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "cors": - value = CorsElement; - return CorsElement is not null; + value = _CorsElement; + return _CorsElement is not null; case "service": - value = Service; - return Service?.Any() == true; + value = _Service; + return _Service?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "cors": - CorsElement = (Hl7.Fhir.Model.FhirBoolean)value; + CorsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "service": - Service = (List)value; + Service = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1198,9 +1189,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CorsElement is not null) yield return new KeyValuePair("cors",CorsElement); - if (Service?.Any() == true) yield return new KeyValuePair("service",Service); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_CorsElement is not null) yield return new KeyValuePair("cors",_CorsElement); + if (_Service?.Any() == true) yield return new KeyValuePair("service",_Service); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -1229,20 +1220,20 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code TypeElement + public Hl7.Fhir.Model.Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.Code _TypeElement; + private Hl7.Fhir.Model.Code? _TypeElement; /// /// A resource type that is supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { get => _TypeElement?.Value; set @@ -1257,20 +1248,20 @@ public string Type /// [FhirElement("profile", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// System-wide profile /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { get => _ProfileElement?.Value; set @@ -1292,20 +1283,20 @@ public List SupportedProfileElement set { _SupportedProfileElement = value; OnPropertyChanged("SupportedProfileElement"); } } - private List _SupportedProfileElement; + private List? _SupportedProfileElement; /// /// Use-case specific profiles /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SupportedProfile + public IEnumerable? SupportedProfile { - get { return SupportedProfileElement != null ? SupportedProfileElement.Select(elem => elem.Value) : null; } + get => _SupportedProfileElement?.Select(elem => elem.Value); set { if (value == null) - SupportedProfileElement = null; + SupportedProfileElement = null!; else SupportedProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("SupportedProfile"); @@ -1317,20 +1308,20 @@ public IEnumerable SupportedProfile /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Additional information about the use of the resource type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -1352,7 +1343,7 @@ public List Int set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private List _Interaction; + private List? _Interaction; /// /// no-version | versioned | versioned-update. @@ -1361,13 +1352,13 @@ public List Int [DeclaredType(Type = typeof(Code))] [Binding("ResourceVersionPolicy")] [DataMember] - public Code VersioningElement + public Code? VersioningElement { get { return _VersioningElement; } set { _VersioningElement = value; OnPropertyChanged("VersioningElement"); } } - private Code _VersioningElement; + private Code? _VersioningElement; /// /// no-version | versioned | versioned-update @@ -1389,13 +1380,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ResourceVersionPolicy? Versioning /// [FhirElement("readHistory", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReadHistoryElement + public Hl7.Fhir.Model.FhirBoolean? ReadHistoryElement { get { return _ReadHistoryElement; } set { _ReadHistoryElement = value; OnPropertyChanged("ReadHistoryElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReadHistoryElement; + private Hl7.Fhir.Model.FhirBoolean? _ReadHistoryElement; /// /// Whether vRead can return past versions @@ -1417,13 +1408,13 @@ public bool? ReadHistory /// [FhirElement("updateCreate", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean UpdateCreateElement + public Hl7.Fhir.Model.FhirBoolean? UpdateCreateElement { get { return _UpdateCreateElement; } set { _UpdateCreateElement = value; OnPropertyChanged("UpdateCreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _UpdateCreateElement; + private Hl7.Fhir.Model.FhirBoolean? _UpdateCreateElement; /// /// If update can commit to a new identity @@ -1445,13 +1436,13 @@ public bool? UpdateCreate /// [FhirElement("conditionalCreate", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ConditionalCreateElement + public Hl7.Fhir.Model.FhirBoolean? ConditionalCreateElement { get { return _ConditionalCreateElement; } set { _ConditionalCreateElement = value; OnPropertyChanged("ConditionalCreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ConditionalCreateElement; + private Hl7.Fhir.Model.FhirBoolean? _ConditionalCreateElement; /// /// If allows/uses conditional create @@ -1475,13 +1466,13 @@ public bool? ConditionalCreate [DeclaredType(Type = typeof(Code))] [Binding("ConditionalReadStatus")] [DataMember] - public Code ConditionalReadElement + public Code? ConditionalReadElement { get { return _ConditionalReadElement; } set { _ConditionalReadElement = value; OnPropertyChanged("ConditionalReadElement"); } } - private Code _ConditionalReadElement; + private Code? _ConditionalReadElement; /// /// not-supported | modified-since | not-match | full-support @@ -1503,13 +1494,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalReadStatus? ConditionalRead /// [FhirElement("conditionalUpdate", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ConditionalUpdateElement + public Hl7.Fhir.Model.FhirBoolean? ConditionalUpdateElement { get { return _ConditionalUpdateElement; } set { _ConditionalUpdateElement = value; OnPropertyChanged("ConditionalUpdateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ConditionalUpdateElement; + private Hl7.Fhir.Model.FhirBoolean? _ConditionalUpdateElement; /// /// If allows/uses conditional update @@ -1534,13 +1525,13 @@ public bool? ConditionalUpdate /// [FhirElement("conditionalPatch", Order=150, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ConditionalPatchElement + public Hl7.Fhir.Model.FhirBoolean? ConditionalPatchElement { get { return _ConditionalPatchElement; } set { _ConditionalPatchElement = value; OnPropertyChanged("ConditionalPatchElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ConditionalPatchElement; + private Hl7.Fhir.Model.FhirBoolean? _ConditionalPatchElement; /// /// If allows/uses conditional patch @@ -1564,13 +1555,13 @@ public bool? ConditionalPatch [DeclaredType(Type = typeof(Code))] [Binding("ConditionalDeleteStatus")] [DataMember] - public Code ConditionalDeleteElement + public Code? ConditionalDeleteElement { get { return _ConditionalDeleteElement; } set { _ConditionalDeleteElement = value; OnPropertyChanged("ConditionalDeleteElement"); } } - private Code _ConditionalDeleteElement; + private Code? _ConditionalDeleteElement; /// /// not-supported | single | multiple - how conditional delete is supported @@ -1601,20 +1592,20 @@ public List> Re set { _ReferencePolicyElement = value; OnPropertyChanged("ReferencePolicyElement"); } } - private List> _ReferencePolicyElement; + private List>? _ReferencePolicyElement; /// /// literal | logical | resolves | enforced | local /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ReferencePolicy + public IEnumerable? ReferencePolicy { - get { return ReferencePolicyElement != null ? ReferencePolicyElement.Select(elem => elem.Value) : null; } + get => _ReferencePolicyElement?.Select(elem => elem.Value); set { if (value == null) - ReferencePolicyElement = null; + ReferencePolicyElement = null!; else ReferencePolicyElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("ReferencePolicy"); @@ -1633,20 +1624,20 @@ public List SearchIncludeElement set { _SearchIncludeElement = value; OnPropertyChanged("SearchIncludeElement"); } } - private List _SearchIncludeElement; + private List? _SearchIncludeElement; /// /// _include values supported by the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SearchInclude + public IEnumerable? SearchInclude { - get { return SearchIncludeElement != null ? SearchIncludeElement.Select(elem => elem.Value) : null; } + get => _SearchIncludeElement?.Select(elem => elem.Value); set { if (value == null) - SearchIncludeElement = null; + SearchIncludeElement = null!; else SearchIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("SearchInclude"); @@ -1665,20 +1656,20 @@ public List SearchRevIncludeElement set { _SearchRevIncludeElement = value; OnPropertyChanged("SearchRevIncludeElement"); } } - private List _SearchRevIncludeElement; + private List? _SearchRevIncludeElement; /// /// _revinclude values supported by the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SearchRevInclude + public IEnumerable? SearchRevInclude { - get { return SearchRevIncludeElement != null ? SearchRevIncludeElement.Select(elem => elem.Value) : null; } + get => _SearchRevIncludeElement?.Select(elem => elem.Value); set { if (value == null) - SearchRevIncludeElement = null; + SearchRevIncludeElement = null!; else SearchRevIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("SearchRevInclude"); @@ -1697,7 +1688,7 @@ public List SearchParam set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } - private List _SearchParam; + private List? _SearchParam; /// /// Definition of a resource operation. @@ -1711,16 +1702,12 @@ public List Operation set { _Operation = value; OnPropertyChanged("Operation"); } } - private List _Operation; + private List? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.Code)_TypeElement.DeepCopyInternal(); @@ -1755,7 +1742,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_SupportedProfileElement, otherT._SupportedProfileElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; @@ -1773,131 +1760,132 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SearchRevIncludeElement, otherT._SearchRevIncludeElement)) return false; if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "supportedProfile": - value = SupportedProfileElement; - return SupportedProfileElement?.Any() == true; + value = _SupportedProfileElement; + return _SupportedProfileElement?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "interaction": - value = Interaction; - return Interaction?.Any() == true; + value = _Interaction; + return _Interaction?.Any() == true; case "versioning": - value = VersioningElement; - return VersioningElement is not null; + value = _VersioningElement; + return _VersioningElement is not null; case "readHistory": - value = ReadHistoryElement; - return ReadHistoryElement is not null; + value = _ReadHistoryElement; + return _ReadHistoryElement is not null; case "updateCreate": - value = UpdateCreateElement; - return UpdateCreateElement is not null; + value = _UpdateCreateElement; + return _UpdateCreateElement is not null; case "conditionalCreate": - value = ConditionalCreateElement; - return ConditionalCreateElement is not null; + value = _ConditionalCreateElement; + return _ConditionalCreateElement is not null; case "conditionalRead": - value = ConditionalReadElement; - return ConditionalReadElement is not null; + value = _ConditionalReadElement; + return _ConditionalReadElement is not null; case "conditionalUpdate": - value = ConditionalUpdateElement; - return ConditionalUpdateElement is not null; + value = _ConditionalUpdateElement; + return _ConditionalUpdateElement is not null; case "conditionalPatch": - value = ConditionalPatchElement; - return ConditionalPatchElement is not null; + value = _ConditionalPatchElement; + return _ConditionalPatchElement is not null; case "conditionalDelete": - value = ConditionalDeleteElement; - return ConditionalDeleteElement is not null; + value = _ConditionalDeleteElement; + return _ConditionalDeleteElement is not null; case "referencePolicy": - value = ReferencePolicyElement; - return ReferencePolicyElement?.Any() == true; + value = _ReferencePolicyElement; + return _ReferencePolicyElement?.Any() == true; case "searchInclude": - value = SearchIncludeElement; - return SearchIncludeElement?.Any() == true; + value = _SearchIncludeElement; + return _SearchIncludeElement?.Any() == true; case "searchRevInclude": - value = SearchRevIncludeElement; - return SearchRevIncludeElement?.Any() == true; + value = _SearchRevIncludeElement; + return _SearchRevIncludeElement?.Any() == true; case "searchParam": - value = SearchParam; - return SearchParam?.Any() == true; + value = _SearchParam; + return _SearchParam?.Any() == true; case "operation": - value = Operation; - return Operation?.Any() == true; + value = _Operation; + return _Operation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Hl7.Fhir.Model.Code)value; + TypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "supportedProfile": - SupportedProfileElement = (List)value; + SupportedProfileElement = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "interaction": - Interaction = (List)value; + Interaction = (List?)value!; return this; case "versioning": - VersioningElement = (Code)value; + VersioningElement = (Code?)value; return this; case "readHistory": - ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "updateCreate": - UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "conditionalCreate": - ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "conditionalRead": - ConditionalReadElement = (Code)value; + ConditionalReadElement = (Code?)value; return this; case "conditionalUpdate": - ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)value; + ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "conditionalPatch": - ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean)value; + ConditionalPatchElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "conditionalDelete": - ConditionalDeleteElement = (Code)value; + ConditionalDeleteElement = (Code?)value; return this; case "referencePolicy": - ReferencePolicyElement = (List>)value; + ReferencePolicyElement = (List>?)value!; return this; case "searchInclude": - SearchIncludeElement = (List)value; + SearchIncludeElement = (List?)value!; return this; case "searchRevInclude": - SearchRevIncludeElement = (List)value; + SearchRevIncludeElement = (List?)value!; return this; case "searchParam": - SearchParam = (List)value; + SearchParam = (List?)value!; return this; case "operation": - Operation = (List)value; + Operation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1908,24 +1896,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (SupportedProfileElement?.Any() == true) yield return new KeyValuePair("supportedProfile",SupportedProfileElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Interaction?.Any() == true) yield return new KeyValuePair("interaction",Interaction); - if (VersioningElement is not null) yield return new KeyValuePair("versioning",VersioningElement); - if (ReadHistoryElement is not null) yield return new KeyValuePair("readHistory",ReadHistoryElement); - if (UpdateCreateElement is not null) yield return new KeyValuePair("updateCreate",UpdateCreateElement); - if (ConditionalCreateElement is not null) yield return new KeyValuePair("conditionalCreate",ConditionalCreateElement); - if (ConditionalReadElement is not null) yield return new KeyValuePair("conditionalRead",ConditionalReadElement); - if (ConditionalUpdateElement is not null) yield return new KeyValuePair("conditionalUpdate",ConditionalUpdateElement); - if (ConditionalPatchElement is not null) yield return new KeyValuePair("conditionalPatch",ConditionalPatchElement); - if (ConditionalDeleteElement is not null) yield return new KeyValuePair("conditionalDelete",ConditionalDeleteElement); - if (ReferencePolicyElement?.Any() == true) yield return new KeyValuePair("referencePolicy",ReferencePolicyElement); - if (SearchIncludeElement?.Any() == true) yield return new KeyValuePair("searchInclude",SearchIncludeElement); - if (SearchRevIncludeElement?.Any() == true) yield return new KeyValuePair("searchRevInclude",SearchRevIncludeElement); - if (SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",SearchParam); - if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_SupportedProfileElement?.Any() == true) yield return new KeyValuePair("supportedProfile",_SupportedProfileElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Interaction?.Any() == true) yield return new KeyValuePair("interaction",_Interaction); + if (_VersioningElement is not null) yield return new KeyValuePair("versioning",_VersioningElement); + if (_ReadHistoryElement is not null) yield return new KeyValuePair("readHistory",_ReadHistoryElement); + if (_UpdateCreateElement is not null) yield return new KeyValuePair("updateCreate",_UpdateCreateElement); + if (_ConditionalCreateElement is not null) yield return new KeyValuePair("conditionalCreate",_ConditionalCreateElement); + if (_ConditionalReadElement is not null) yield return new KeyValuePair("conditionalRead",_ConditionalReadElement); + if (_ConditionalUpdateElement is not null) yield return new KeyValuePair("conditionalUpdate",_ConditionalUpdateElement); + if (_ConditionalPatchElement is not null) yield return new KeyValuePair("conditionalPatch",_ConditionalPatchElement); + if (_ConditionalDeleteElement is not null) yield return new KeyValuePair("conditionalDelete",_ConditionalDeleteElement); + if (_ReferencePolicyElement?.Any() == true) yield return new KeyValuePair("referencePolicy",_ReferencePolicyElement); + if (_SearchIncludeElement?.Any() == true) yield return new KeyValuePair("searchInclude",_SearchIncludeElement); + if (_SearchRevIncludeElement?.Any() == true) yield return new KeyValuePair("searchRevInclude",_SearchRevIncludeElement); + if (_SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",_SearchParam); + if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation); } } @@ -1955,13 +1943,13 @@ public partial class ResourceInteractionComponent : Hl7.Fhir.Model.BackboneEleme [Binding("TypeRestfulInteraction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// read | vread | update | patch | delete | history-instance | history-type | create | search-type @@ -1983,20 +1971,20 @@ public Hl7.Fhir.Model.CapabilityStatement.TypeRestfulInteraction? Code /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Anything special about operation behavior /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -2008,12 +1996,8 @@ public string Documentation protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceInteractionComponent; - - if (dest == null) - { + if(other is not ResourceInteractionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); @@ -2032,37 +2016,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2073,8 +2058,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -2102,20 +2087,20 @@ public partial class SearchParamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for parameter in search url /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -2130,20 +2115,20 @@ public string Name /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Source of definition for parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { get => _DefinitionElement?.Value; set @@ -2161,13 +2146,13 @@ public string Definition [Binding("SearchParamType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// number | date | string | token | reference | composite | quantity | uri | special @@ -2189,20 +2174,20 @@ public Hl7.Fhir.Model.SearchParamType? Type /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Server-specific usage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -2214,12 +2199,8 @@ public string Documentation protected internal override void CopyToInternal(Base other) { - var dest = other as SearchParamComponent; - - if (dest == null) - { + if(other is not SearchParamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); @@ -2240,51 +2221,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2295,10 +2277,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -2327,20 +2309,20 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name by which the operation/query is invoked /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -2356,20 +2338,20 @@ public string Name [FhirElement("definition", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// The defined operation/query /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { get => _DefinitionElement?.Value; set @@ -2384,20 +2366,20 @@ public string Definition /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Specific details about operation behavior /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -2409,12 +2391,8 @@ public string Documentation protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); @@ -2434,44 +2412,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2482,9 +2461,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -2513,13 +2492,13 @@ public partial class SystemInteractionComponent : Hl7.Fhir.Model.BackboneElement [Binding("SystemRestfulInteraction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// transaction | batch | search-system | history-system @@ -2541,20 +2520,20 @@ public Hl7.Fhir.Model.CapabilityStatement.SystemRestfulInteraction? Code /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Anything special about operation behavior /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -2566,12 +2545,8 @@ public string Documentation protected internal override void CopyToInternal(Base other) { - var dest = other as SystemInteractionComponent; - - if (dest == null) - { + if(other is not SystemInteractionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); @@ -2590,37 +2565,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SystemInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2631,8 +2607,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -2666,20 +2642,20 @@ public List Endpoint set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Reliable Message Cache Length (min). /// [FhirElement("reliableCache", Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt ReliableCacheElement + public Hl7.Fhir.Model.UnsignedInt? ReliableCacheElement { get { return _ReliableCacheElement; } set { _ReliableCacheElement = value; OnPropertyChanged("ReliableCacheElement"); } } - private Hl7.Fhir.Model.UnsignedInt _ReliableCacheElement; + private Hl7.Fhir.Model.UnsignedInt? _ReliableCacheElement; /// /// Reliable Message Cache Length (min) @@ -2701,20 +2677,20 @@ public int? ReliableCache /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Messaging interface behavior details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -2736,16 +2712,12 @@ public List Suppor set { _SupportedMessage = value; OnPropertyChanged("SupportedMessage"); } } - private List _SupportedMessage; + private List? _SupportedMessage; protected internal override void CopyToInternal(Base other) { - var dest = other as MessagingComponent; - - if (dest == null) - { + if(other is not MessagingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); @@ -2766,51 +2738,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.Equals(_ReliableCacheElement, otherT._ReliableCacheElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_SupportedMessage, otherT._SupportedMessage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "reliableCache": - value = ReliableCacheElement; - return ReliableCacheElement is not null; + value = _ReliableCacheElement; + return _ReliableCacheElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "supportedMessage": - value = SupportedMessage; - return SupportedMessage?.Any() == true; + value = _SupportedMessage; + return _SupportedMessage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "reliableCache": - ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)value; + ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "supportedMessage": - SupportedMessage = (List)value; + SupportedMessage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2821,10 +2794,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (ReliableCacheElement is not null) yield return new KeyValuePair("reliableCache",ReliableCacheElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (SupportedMessage?.Any() == true) yield return new KeyValuePair("supportedMessage",SupportedMessage); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_ReliableCacheElement is not null) yield return new KeyValuePair("reliableCache",_ReliableCacheElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_SupportedMessage?.Any() == true) yield return new KeyValuePair("supportedMessage",_SupportedMessage); } } @@ -2852,13 +2825,13 @@ public partial class EndpointComponent : Hl7.Fhir.Model.BackboneElement [Binding("MessageTransport")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Protocol + public Hl7.Fhir.Model.Coding? Protocol { get { return _Protocol; } set { _Protocol = value; OnPropertyChanged("Protocol"); } } - private Hl7.Fhir.Model.Coding _Protocol; + private Hl7.Fhir.Model.Coding? _Protocol; /// /// Network address or identifier of the end-point. @@ -2866,20 +2839,20 @@ public Hl7.Fhir.Model.Coding Protocol [FhirElement("address", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl AddressElement + public Hl7.Fhir.Model.FhirUrl? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirUrl _AddressElement; + private Hl7.Fhir.Model.FhirUrl? _AddressElement; /// /// Network address or identifier of the end-point /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { get => _AddressElement?.Value; set @@ -2891,12 +2864,8 @@ public string Address protected internal override void CopyToInternal(Base other) { - var dest = other as EndpointComponent; - - if (dest == null) - { + if(other is not EndpointComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_Protocol is not null) dest.Protocol = (Hl7.Fhir.Model.Coding)_Protocol.DeepCopyInternal(); @@ -2915,37 +2884,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EndpointComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "protocol": - value = Protocol; - return Protocol is not null; + value = _Protocol; + return _Protocol is not null; case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "protocol": - Protocol = (Hl7.Fhir.Model.Coding)value; + Protocol = (Hl7.Fhir.Model.Coding?)value; return this; case "address": - AddressElement = (Hl7.Fhir.Model.FhirUrl)value; + AddressElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -2956,8 +2926,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Protocol is not null) yield return new KeyValuePair("protocol",Protocol); - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); + if (_Protocol is not null) yield return new KeyValuePair("protocol",_Protocol); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); } } @@ -2987,13 +2957,13 @@ public partial class SupportedMessageComponent : Hl7.Fhir.Model.BackboneElement [Binding("EventCapabilityMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// sender | receiver @@ -3016,20 +2986,20 @@ public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode [FhirElement("definition", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Message supported by this system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { get => _DefinitionElement?.Value; set @@ -3041,12 +3011,8 @@ public string Definition protected internal override void CopyToInternal(Base other) { - var dest = other as SupportedMessageComponent; - - if (dest == null) - { + if(other is not SupportedMessageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); @@ -3065,37 +3031,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportedMessageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -3106,8 +3073,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); } } @@ -3136,13 +3103,13 @@ public partial class DocumentComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// producer | consumer @@ -3164,20 +3131,20 @@ public Hl7.Fhir.Model.CapabilityStatement.DocumentMode? Mode /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Description of document support /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -3193,20 +3160,20 @@ public string Documentation [FhirElement("profile", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Constraint on the resources used in the document /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { get => _ProfileElement?.Value; set @@ -3218,12 +3185,8 @@ public string Profile protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentComponent; - - if (dest == null) - { + if(other is not DocumentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); @@ -3243,44 +3206,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -3291,9 +3255,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } @@ -3303,20 +3267,20 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this capability statement, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -3341,27 +3305,27 @@ public List Identifier set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the capability statement. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the capability statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -3381,33 +3345,33 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this capability statement (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this capability statement (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -3422,20 +3386,20 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this capability statement (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { get => _TitleElement?.Value; set @@ -3453,13 +3417,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -3481,13 +3445,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -3510,20 +3474,20 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { get => _DateElement?.Value; set @@ -3538,20 +3502,20 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { get => _PublisherElement?.Value; set @@ -3573,27 +3537,27 @@ public List Contact set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the capability statement. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the capability statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -3615,7 +3579,7 @@ public List UseContext set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for capability statement (if applicable). @@ -3630,27 +3594,27 @@ public List Jurisdiction set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this capability statement is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this capability statement is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { get => _PurposeElement?.Value; set @@ -3665,20 +3629,20 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { get => _CopyrightElement?.Value; set @@ -3696,20 +3660,20 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { get => _CopyrightLabelElement?.Value; set @@ -3727,13 +3691,13 @@ public string CopyrightLabel [Binding("CapabilityStatementKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// instance | capability | requirements @@ -3762,20 +3726,20 @@ public List InstantiatesElement set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } - private List _InstantiatesElement; + private List? _InstantiatesElement; /// /// Canonical URL of another capability statement this implements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Instantiates + public IEnumerable? Instantiates { - get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; } + get => _InstantiatesElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesElement = null; + InstantiatesElement = null!; else InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Instantiates"); @@ -3794,20 +3758,20 @@ public List ImportsElement set { _ImportsElement = value; OnPropertyChanged("ImportsElement"); } } - private List _ImportsElement; + private List? _ImportsElement; /// /// Canonical URL of another capability statement this adds to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Imports + public IEnumerable? Imports { - get { return ImportsElement != null ? ImportsElement.Select(elem => elem.Value) : null; } + get => _ImportsElement?.Select(elem => elem.Value); set { if (value == null) - ImportsElement = null; + ImportsElement = null!; else ImportsElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Imports"); @@ -3819,26 +3783,26 @@ public IEnumerable Imports /// [FhirElement("software", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent Software + public Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent? Software { get { return _Software; } set { _Software = value; OnPropertyChanged("Software"); } } - private Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent _Software; + private Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent? _Software; /// /// If this describes a specific instance. /// [FhirElement("implementation", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent Implementation + public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent? Implementation { get { return _Implementation; } set { _Implementation = value; OnPropertyChanged("Implementation"); } } - private Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent _Implementation; + private Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent? _Implementation; /// /// FHIR Version the system supports. @@ -3848,13 +3812,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent Implementation [Binding("FHIRVersion")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code FhirVersionElement + public Code? FhirVersionElement { get { return _FhirVersionElement; } set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private Code _FhirVersionElement; + private Code? _FhirVersionElement; /// /// FHIR Version the system supports @@ -3884,20 +3848,20 @@ public List FormatElement set { _FormatElement = value; OnPropertyChanged("FormatElement"); } } - private List _FormatElement; + private List? _FormatElement; /// /// formats supported (xml | json | ttl | mime type) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Format + public IEnumerable? Format { - get { return FormatElement != null ? FormatElement.Select(elem => elem.Value) : null; } + get => _FormatElement?.Select(elem => elem.Value); set { if (value == null) - FormatElement = null; + FormatElement = null!; else FormatElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Format"); @@ -3917,20 +3881,20 @@ public List PatchFormatElement set { _PatchFormatElement = value; OnPropertyChanged("PatchFormatElement"); } } - private List _PatchFormatElement; + private List? _PatchFormatElement; /// /// Patch formats supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PatchFormat + public IEnumerable? PatchFormat { - get { return PatchFormatElement != null ? PatchFormatElement.Select(elem => elem.Value) : null; } + get => _PatchFormatElement?.Select(elem => elem.Value); set { if (value == null) - PatchFormatElement = null; + PatchFormatElement = null!; else PatchFormatElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("PatchFormat"); @@ -3953,20 +3917,20 @@ public List AcceptLanguageElement set { _AcceptLanguageElement = value; OnPropertyChanged("AcceptLanguageElement"); } } - private List _AcceptLanguageElement; + private List? _AcceptLanguageElement; /// /// Languages supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable AcceptLanguage + public IEnumerable? AcceptLanguage { - get { return AcceptLanguageElement != null ? AcceptLanguageElement.Select(elem => elem.Value) : null; } + get => _AcceptLanguageElement?.Select(elem => elem.Value); set { if (value == null) - AcceptLanguageElement = null; + AcceptLanguageElement = null!; else AcceptLanguageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("AcceptLanguage"); @@ -3985,20 +3949,20 @@ public List ImplementationGuideElement set { _ImplementationGuideElement = value; OnPropertyChanged("ImplementationGuideElement"); } } - private List _ImplementationGuideElement; + private List? _ImplementationGuideElement; /// /// Implementation guides supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ImplementationGuide + public IEnumerable? ImplementationGuide { - get { return ImplementationGuideElement != null ? ImplementationGuideElement.Select(elem => elem.Value) : null; } + get => _ImplementationGuideElement?.Select(elem => elem.Value); set { if (value == null) - ImplementationGuideElement = null; + ImplementationGuideElement = null!; else ImplementationGuideElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("ImplementationGuide"); @@ -4017,7 +3981,7 @@ public List Rest set { _Rest = value; OnPropertyChanged("Rest"); } } - private List _Rest; + private List? _Rest; /// /// If messaging is supported. @@ -4031,7 +3995,7 @@ public List Messaging set { _Messaging = value; OnPropertyChanged("Messaging"); } } - private List _Messaging; + private List? _Messaging; /// /// Document definition. @@ -4045,18 +4009,14 @@ public List Document set { _Document = value; OnPropertyChanged("Document"); } } - private List _Document; + private List? _Document; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityStatement; - - if (dest == null) - { + if(other is not CapabilityStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); @@ -4103,7 +4063,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -4133,203 +4093,204 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Rest, otherT._Rest)) return false; if(!comparer.ListEquals(_Messaging, otherT._Messaging)) return false; if(!comparer.ListEquals(_Document, otherT._Document)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "instantiates": - value = InstantiatesElement; - return InstantiatesElement?.Any() == true; + value = _InstantiatesElement; + return _InstantiatesElement?.Any() == true; case "imports": - value = ImportsElement; - return ImportsElement?.Any() == true; + value = _ImportsElement; + return _ImportsElement?.Any() == true; case "software": - value = Software; - return Software is not null; + value = _Software; + return _Software is not null; case "implementation": - value = Implementation; - return Implementation is not null; + value = _Implementation; + return _Implementation is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement is not null; + value = _FhirVersionElement; + return _FhirVersionElement is not null; case "format": - value = FormatElement; - return FormatElement?.Any() == true; + value = _FormatElement; + return _FormatElement?.Any() == true; case "patchFormat": - value = PatchFormatElement; - return PatchFormatElement?.Any() == true; + value = _PatchFormatElement; + return _PatchFormatElement?.Any() == true; case "acceptLanguage": - value = AcceptLanguageElement; - return AcceptLanguageElement?.Any() == true; + value = _AcceptLanguageElement; + return _AcceptLanguageElement?.Any() == true; case "implementationGuide": - value = ImplementationGuideElement; - return ImplementationGuideElement?.Any() == true; + value = _ImplementationGuideElement; + return _ImplementationGuideElement?.Any() == true; case "rest": - value = Rest; - return Rest?.Any() == true; + value = _Rest; + return _Rest?.Any() == true; case "messaging": - value = Messaging; - return Messaging?.Any() == true; + value = _Messaging; + return _Messaging?.Any() == true; case "document": - value = Document; - return Document?.Any() == true; + value = _Document; + return _Document?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "instantiates": - InstantiatesElement = (List)value; + InstantiatesElement = (List?)value!; return this; case "imports": - ImportsElement = (List)value; + ImportsElement = (List?)value!; return this; case "software": - Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent)value; + Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent?)value; return this; case "implementation": - Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent)value; + Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent?)value; return this; case "fhirVersion": - FhirVersionElement = (Code)value; + FhirVersionElement = (Code?)value; return this; case "format": - FormatElement = (List)value; + FormatElement = (List?)value!; return this; case "patchFormat": - PatchFormatElement = (List)value; + PatchFormatElement = (List?)value!; return this; case "acceptLanguage": - AcceptLanguageElement = (List)value; + AcceptLanguageElement = (List?)value!; return this; case "implementationGuide": - ImplementationGuideElement = (List)value; + ImplementationGuideElement = (List?)value!; return this; case "rest": - Rest = (List)value; + Rest = (List?)value!; return this; case "messaging": - Messaging = (List)value; + Messaging = (List?)value!; return this; case "document": - Document = (List)value; + Document = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4340,36 +4301,36 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",InstantiatesElement); - if (ImportsElement?.Any() == true) yield return new KeyValuePair("imports",ImportsElement); - if (Software is not null) yield return new KeyValuePair("software",Software); - if (Implementation is not null) yield return new KeyValuePair("implementation",Implementation); - if (FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (FormatElement?.Any() == true) yield return new KeyValuePair("format",FormatElement); - if (PatchFormatElement?.Any() == true) yield return new KeyValuePair("patchFormat",PatchFormatElement); - if (AcceptLanguageElement?.Any() == true) yield return new KeyValuePair("acceptLanguage",AcceptLanguageElement); - if (ImplementationGuideElement?.Any() == true) yield return new KeyValuePair("implementationGuide",ImplementationGuideElement); - if (Rest?.Any() == true) yield return new KeyValuePair("rest",Rest); - if (Messaging?.Any() == true) yield return new KeyValuePair("messaging",Messaging); - if (Document?.Any() == true) yield return new KeyValuePair("document",Document); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",_InstantiatesElement); + if (_ImportsElement?.Any() == true) yield return new KeyValuePair("imports",_ImportsElement); + if (_Software is not null) yield return new KeyValuePair("software",_Software); + if (_Implementation is not null) yield return new KeyValuePair("implementation",_Implementation); + if (_FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_FormatElement?.Any() == true) yield return new KeyValuePair("format",_FormatElement); + if (_PatchFormatElement?.Any() == true) yield return new KeyValuePair("patchFormat",_PatchFormatElement); + if (_AcceptLanguageElement?.Any() == true) yield return new KeyValuePair("acceptLanguage",_AcceptLanguageElement); + if (_ImplementationGuideElement?.Any() == true) yield return new KeyValuePair("implementationGuide",_ImplementationGuideElement); + if (_Rest?.Any() == true) yield return new KeyValuePair("rest",_Rest); + if (_Messaging?.Any() == true) yield return new KeyValuePair("messaging",_Messaging); + if (_Document?.Any() == true) yield return new KeyValuePair("document",_Document); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs index 8909f652f..340eb1170 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -168,20 +171,20 @@ public partial class FilterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies the filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -196,20 +199,20 @@ public string Code /// [FhirElement("description", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// How or why the filter is used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -233,20 +236,20 @@ public List> OperatorElement set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private List> _OperatorElement; + private List>? _OperatorElement; /// /// = | is-a | descendent-of | is-not-a | regex | in | not-in | generalizes | child-of | descendent-leaf | exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Operator + public IEnumerable? Operator { - get { return OperatorElement != null ? OperatorElement.Select(elem => elem.Value) : null; } + get => _OperatorElement?.Select(elem => elem.Value); set { if (value == null) - OperatorElement = null; + OperatorElement = null!; else OperatorElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Operator"); @@ -259,20 +262,20 @@ public IEnumerable Operator [FhirElement("value", InSummary=true, Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// What to use for the value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { get => _ValueElement?.Value; set @@ -284,12 +287,8 @@ public string Value protected internal override void CopyToInternal(Base other) { - var dest = other as FilterComponent; - - if (dest == null) - { + if(other is not FilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -310,51 +309,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_OperatorElement, otherT._OperatorElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "operator": - value = OperatorElement; - return OperatorElement?.Any() == true; + value = _OperatorElement; + return _OperatorElement?.Any() == true; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "operator": - OperatorElement = (List>)value; + OperatorElement = (List>?)value!; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -365,10 +365,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OperatorElement?.Any() == true) yield return new KeyValuePair("operator",OperatorElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OperatorElement?.Any() == true) yield return new KeyValuePair("operator",_OperatorElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -396,20 +396,20 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies the property on the concepts, and when referred to in operations /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -424,20 +424,20 @@ public string Code /// [FhirElement("uri", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Formal identifier for the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { get => _UriElement?.Value; set @@ -452,20 +452,20 @@ public string Uri /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why the property is defined, and/or what it conveys /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -483,13 +483,13 @@ public string Description [Binding("PropertyType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// code | Coding | string | integer | boolean | dateTime | decimal @@ -508,12 +508,8 @@ public Hl7.Fhir.Model.CodeSystem.PropertyType? Type protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -534,51 +530,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -589,10 +586,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -620,20 +617,20 @@ public partial class ConceptDefinitionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies concept /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -648,20 +645,20 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Text to display to the user /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { get => _DisplayElement?.Value; set @@ -676,20 +673,20 @@ public string Display /// [FhirElement("definition", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DefinitionElement + public Hl7.Fhir.Model.FhirString? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirString _DefinitionElement; + private Hl7.Fhir.Model.FhirString? _DefinitionElement; /// /// Formal definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { get => _DefinitionElement?.Value; set @@ -711,7 +708,7 @@ public List Designation set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; /// /// Property value for the concept. @@ -725,7 +722,7 @@ public List Property set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Child Concepts (is-a/contains/categorizes). @@ -739,16 +736,12 @@ public List Concept set { _Concept = value; OnPropertyChanged("Concept"); } } - private List _Concept; + private List? _Concept; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptDefinitionComponent; - - if (dest == null) - { + if(other is not ConceptDefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -771,65 +764,66 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "concept": - value = Concept; - return Concept?.Any() == true; + value = _Concept; + return _Concept?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirString)value; + DefinitionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "concept": - Concept = (List)value; + Concept = (List?)value!; return this; default: return base.SetValue(key, value); @@ -840,12 +834,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Concept?.Any() == true) yield return new KeyValuePair("concept",Concept); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Concept?.Any() == true) yield return new KeyValuePair("concept",_Concept); } } @@ -873,20 +867,20 @@ public partial class DesignationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("language", Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Human language of the designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { get => _LanguageElement?.Value; set @@ -902,13 +896,13 @@ public string Language [FhirElement("use", Order=50)] [Binding("ConceptDesignationUse")] [DataMember] - public Hl7.Fhir.Model.Coding Use + public Hl7.Fhir.Model.Coding? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.Coding _Use; + private Hl7.Fhir.Model.Coding? _Use; /// /// Additional ways how this designation would be used. @@ -926,7 +920,7 @@ public List AdditionalUse set { _AdditionalUse = value; OnPropertyChanged("AdditionalUse"); } } - private List _AdditionalUse; + private List? _AdditionalUse; /// /// The text value for this designation. @@ -934,20 +928,20 @@ public List AdditionalUse [FhirElement("value", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The text value for this designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { get => _ValueElement?.Value; set @@ -959,12 +953,8 @@ public string Value protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationComponent; - - if (dest == null) - { + if(other is not DesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); @@ -985,51 +975,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.ListEquals(_AdditionalUse, otherT._AdditionalUse)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; case "additionalUse": - value = AdditionalUse; - return AdditionalUse?.Any() == true; + value = _AdditionalUse; + return _AdditionalUse?.Any() == true; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - Use = (Hl7.Fhir.Model.Coding)value; + Use = (Hl7.Fhir.Model.Coding?)value; return this; case "additionalUse": - AdditionalUse = (List)value; + AdditionalUse = (List?)value!; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1040,10 +1031,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (Use is not null) yield return new KeyValuePair("use",Use); - if (AdditionalUse?.Any() == true) yield return new KeyValuePair("additionalUse",AdditionalUse); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_Use is not null) yield return new KeyValuePair("use",_Use); + if (_AdditionalUse?.Any() == true) yield return new KeyValuePair("additionalUse",_AdditionalUse); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -1070,20 +1061,20 @@ public partial class ConceptPropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Reference to CodeSystem.property.code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -1101,22 +1092,18 @@ public string Code [AllowedTypes(typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptPropertyComponent; - - if (dest == null) - { + if(other is not ConceptPropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -1135,37 +1122,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1176,8 +1164,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1187,20 +1175,20 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this code system, represented as a URI (globally unique) (Coding.system) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -1222,27 +1210,27 @@ public List Identifier set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the code system (Coding.version). /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the code system (Coding.version) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -1262,33 +1250,33 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this code system (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this code system (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -1303,20 +1291,20 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this code system (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { get => _TitleElement?.Value; set @@ -1334,13 +1322,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1362,13 +1350,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1390,20 +1378,20 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { get => _DateElement?.Value; set @@ -1418,20 +1406,20 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { get => _PublisherElement?.Value; set @@ -1453,27 +1441,27 @@ public List Contact set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the code system. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -1495,7 +1483,7 @@ public List UseContext set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for code system (if applicable). @@ -1510,27 +1498,27 @@ public List Jurisdiction set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this code system is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this code system is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { get => _PurposeElement?.Value; set @@ -1545,20 +1533,20 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { get => _CopyrightElement?.Value; set @@ -1576,20 +1564,20 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { get => _CopyrightLabelElement?.Value; set @@ -1607,20 +1595,20 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=260, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the CodeSystem was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { get => _ApprovalDateElement?.Value; set @@ -1638,20 +1626,20 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=270, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the CodeSystem was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { get => _LastReviewDateElement?.Value; set @@ -1669,13 +1657,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=280, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -1693,7 +1681,7 @@ public List Topic set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the CodeSystem. @@ -1710,7 +1698,7 @@ public List Author set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the CodeSystem. @@ -1727,7 +1715,7 @@ public List Editor set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the CodeSystem. @@ -1744,7 +1732,7 @@ public List Reviewer set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the CodeSystem. @@ -1761,7 +1749,7 @@ public List Endorser set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1778,20 +1766,20 @@ public List RelatedArtifact set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// If code comparison is case sensitive. /// [FhirElement("caseSensitive", InSummary=true, Order=350)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CaseSensitiveElement + public Hl7.Fhir.Model.FhirBoolean? CaseSensitiveElement { get { return _CaseSensitiveElement; } set { _CaseSensitiveElement = value; OnPropertyChanged("CaseSensitiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CaseSensitiveElement; + private Hl7.Fhir.Model.FhirBoolean? _CaseSensitiveElement; /// /// If code comparison is case sensitive @@ -1813,20 +1801,20 @@ public bool? CaseSensitive /// [FhirElement("valueSet", InSummary=true, Order=360)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Canonical reference to the value set with entire code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { get => _ValueSetElement?.Value; set @@ -1843,13 +1831,13 @@ public string ValueSet [DeclaredType(Type = typeof(Code))] [Binding("CodeSystemHierarchyMeaning")] [DataMember] - public Code HierarchyMeaningElement + public Code? HierarchyMeaningElement { get { return _HierarchyMeaningElement; } set { _HierarchyMeaningElement = value; OnPropertyChanged("HierarchyMeaningElement"); } } - private Code _HierarchyMeaningElement; + private Code? _HierarchyMeaningElement; /// /// grouped-by | is-a | part-of | classified-with @@ -1871,13 +1859,13 @@ public Hl7.Fhir.Model.CodeSystem.CodeSystemHierarchyMeaning? HierarchyMeaning /// [FhirElement("compositional", InSummary=true, Order=380)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CompositionalElement + public Hl7.Fhir.Model.FhirBoolean? CompositionalElement { get { return _CompositionalElement; } set { _CompositionalElement = value; OnPropertyChanged("CompositionalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CompositionalElement; + private Hl7.Fhir.Model.FhirBoolean? _CompositionalElement; /// /// If code system defines a compositional grammar @@ -1899,13 +1887,13 @@ public bool? Compositional /// [FhirElement("versionNeeded", InSummary=true, Order=390)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean VersionNeededElement + public Hl7.Fhir.Model.FhirBoolean? VersionNeededElement { get { return _VersionNeededElement; } set { _VersionNeededElement = value; OnPropertyChanged("VersionNeededElement"); } } - private Hl7.Fhir.Model.FhirBoolean _VersionNeededElement; + private Hl7.Fhir.Model.FhirBoolean? _VersionNeededElement; /// /// If definitions are not stable @@ -1930,13 +1918,13 @@ public bool? VersionNeeded [Binding("CodeSystemContentMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ContentElement + public Code? ContentElement { get { return _ContentElement; } set { _ContentElement = value; OnPropertyChanged("ContentElement"); } } - private Code _ContentElement; + private Code? _ContentElement; /// /// not-present | example | fragment | complete | supplement @@ -1958,20 +1946,20 @@ public Hl7.Fhir.Model.CodeSystemContentMode? Content /// [FhirElement("supplements", InSummary=true, Order=410)] [DataMember] - public Hl7.Fhir.Model.Canonical SupplementsElement + public Hl7.Fhir.Model.Canonical? SupplementsElement { get { return _SupplementsElement; } set { _SupplementsElement = value; OnPropertyChanged("SupplementsElement"); } } - private Hl7.Fhir.Model.Canonical _SupplementsElement; + private Hl7.Fhir.Model.Canonical? _SupplementsElement; /// /// Canonical URL of Code System this adds designations and properties to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Supplements + public string? Supplements { get => _SupplementsElement?.Value; set @@ -1986,13 +1974,13 @@ public string Supplements /// [FhirElement("count", InSummary=true, Order=420)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt CountElement + public Hl7.Fhir.Model.UnsignedInt? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.UnsignedInt _CountElement; + private Hl7.Fhir.Model.UnsignedInt? _CountElement; /// /// Total concepts in the code system @@ -2021,7 +2009,7 @@ public List Filter set { _Filter = value; OnPropertyChanged("Filter"); } } - private List _Filter; + private List? _Filter; /// /// Additional information supplied about each concept. @@ -2035,7 +2023,7 @@ public List Property set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Concepts in the code system. @@ -2049,18 +2037,14 @@ public List Concept set { _Concept = value; OnPropertyChanged("Concept"); } } - private List _Concept; + private List? _Concept; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CodeSystem; - - if (dest == null) - { + if(other is not CodeSystem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); @@ -2114,7 +2098,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2151,245 +2135,246 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "caseSensitive": - value = CaseSensitiveElement; - return CaseSensitiveElement is not null; + value = _CaseSensitiveElement; + return _CaseSensitiveElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "hierarchyMeaning": - value = HierarchyMeaningElement; - return HierarchyMeaningElement is not null; + value = _HierarchyMeaningElement; + return _HierarchyMeaningElement is not null; case "compositional": - value = CompositionalElement; - return CompositionalElement is not null; + value = _CompositionalElement; + return _CompositionalElement is not null; case "versionNeeded": - value = VersionNeededElement; - return VersionNeededElement is not null; + value = _VersionNeededElement; + return _VersionNeededElement is not null; case "content": - value = ContentElement; - return ContentElement is not null; + value = _ContentElement; + return _ContentElement is not null; case "supplements": - value = SupplementsElement; - return SupplementsElement is not null; + value = _SupplementsElement; + return _SupplementsElement is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "filter": - value = Filter; - return Filter?.Any() == true; + value = _Filter; + return _Filter?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "concept": - value = Concept; - return Concept?.Any() == true; + value = _Concept; + return _Concept?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "caseSensitive": - CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "hierarchyMeaning": - HierarchyMeaningElement = (Code)value; + HierarchyMeaningElement = (Code?)value; return this; case "compositional": - CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)value; + CompositionalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "versionNeeded": - VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean)value; + VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "content": - ContentElement = (Code)value; + ContentElement = (Code?)value; return this; case "supplements": - SupplementsElement = (Hl7.Fhir.Model.Canonical)value; + SupplementsElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.UnsignedInt)value; + CountElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "filter": - Filter = (List)value; + Filter = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "concept": - Concept = (List)value; + Concept = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2400,43 +2385,43 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (CaseSensitiveElement is not null) yield return new KeyValuePair("caseSensitive",CaseSensitiveElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (HierarchyMeaningElement is not null) yield return new KeyValuePair("hierarchyMeaning",HierarchyMeaningElement); - if (CompositionalElement is not null) yield return new KeyValuePair("compositional",CompositionalElement); - if (VersionNeededElement is not null) yield return new KeyValuePair("versionNeeded",VersionNeededElement); - if (ContentElement is not null) yield return new KeyValuePair("content",ContentElement); - if (SupplementsElement is not null) yield return new KeyValuePair("supplements",SupplementsElement); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (Filter?.Any() == true) yield return new KeyValuePair("filter",Filter); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Concept?.Any() == true) yield return new KeyValuePair("concept",Concept); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_CaseSensitiveElement is not null) yield return new KeyValuePair("caseSensitive",_CaseSensitiveElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_HierarchyMeaningElement is not null) yield return new KeyValuePair("hierarchyMeaning",_HierarchyMeaningElement); + if (_CompositionalElement is not null) yield return new KeyValuePair("compositional",_CompositionalElement); + if (_VersionNeededElement is not null) yield return new KeyValuePair("versionNeeded",_VersionNeededElement); + if (_ContentElement is not null) yield return new KeyValuePair("content",_ContentElement); + if (_SupplementsElement is not null) yield return new KeyValuePair("supplements",_SupplementsElement); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_Filter?.Any() == true) yield return new KeyValuePair("filter",_Filter); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Concept?.Any() == true) yield return new KeyValuePair("concept",_Concept); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs index 17517ec1d..e9eb19bda 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -329,27 +332,27 @@ public List Discriminat set { _Discriminator = value; OnPropertyChanged("Discriminator"); } } - private List _Discriminator; + private List? _Discriminator; /// /// Text description of how slicing works (or not). /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Text description of how slicing works (or not) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -364,13 +367,13 @@ public string Description /// [FhirElement("ordered", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OrderedElement + public Hl7.Fhir.Model.FhirBoolean? OrderedElement { get { return _OrderedElement; } set { _OrderedElement = value; OnPropertyChanged("OrderedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OrderedElement; + private Hl7.Fhir.Model.FhirBoolean? _OrderedElement; /// /// If elements must be in same order as slices @@ -395,13 +398,13 @@ public bool? Ordered [Binding("SlicingRules")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RulesElement + public Code? RulesElement { get { return _RulesElement; } set { _RulesElement = value; OnPropertyChanged("RulesElement"); } } - private Code _RulesElement; + private Code? _RulesElement; /// /// closed | open | openAtEnd @@ -420,12 +423,8 @@ public Hl7.Fhir.Model.ElementDefinition.SlicingRules? Rules protected internal override void CopyToInternal(Base other) { - var dest = other as SlicingComponent; - - if (dest == null) - { + if(other is not SlicingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_Discriminator is not null) dest.Discriminator = new List(_Discriminator.DeepCopyInternal()); @@ -446,51 +445,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SlicingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_OrderedElement, otherT._OrderedElement)) return false; if(!comparer.Equals(_RulesElement, otherT._RulesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "discriminator": - value = Discriminator; - return Discriminator?.Any() == true; + value = _Discriminator; + return _Discriminator?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "ordered": - value = OrderedElement; - return OrderedElement is not null; + value = _OrderedElement; + return _OrderedElement is not null; case "rules": - value = RulesElement; - return RulesElement is not null; + value = _RulesElement; + return _RulesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "discriminator": - Discriminator = (List)value; + Discriminator = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "ordered": - OrderedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OrderedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "rules": - RulesElement = (Code)value; + RulesElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -501,10 +501,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Discriminator?.Any() == true) yield return new KeyValuePair("discriminator",Discriminator); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OrderedElement is not null) yield return new KeyValuePair("ordered",OrderedElement); - if (RulesElement is not null) yield return new KeyValuePair("rules",RulesElement); + if (_Discriminator?.Any() == true) yield return new KeyValuePair("discriminator",_Discriminator); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OrderedElement is not null) yield return new KeyValuePair("ordered",_OrderedElement); + if (_RulesElement is not null) yield return new KeyValuePair("rules",_RulesElement); } } @@ -534,13 +534,13 @@ public partial class DiscriminatorComponent : Hl7.Fhir.Model.Element [Binding("DiscriminatorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// value | exists | type | profile | position @@ -563,20 +563,20 @@ public Hl7.Fhir.Model.ElementDefinition.DiscriminatorType? Type [FhirElement("path", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path to element value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { get => _PathElement?.Value; set @@ -588,12 +588,8 @@ public string Path protected internal override void CopyToInternal(Base other) { - var dest = other as DiscriminatorComponent; - - if (dest == null) - { + if(other is not DiscriminatorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); @@ -612,37 +608,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiscriminatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -653,8 +650,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); } } @@ -682,20 +679,20 @@ public partial class BaseComponent : Hl7.Fhir.Model.Element [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path that identifies the base element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { get => _PathElement?.Value; set @@ -711,13 +708,13 @@ public string Path [FhirElement("min", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Min cardinality of the base element @@ -740,20 +737,20 @@ public int? Min [FhirElement("max", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Max cardinality of the base element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { get => _MaxElement?.Value; set @@ -765,12 +762,8 @@ public string Max protected internal override void CopyToInternal(Base other) { - var dest = other as BaseComponent; - - if (dest == null) - { + if(other is not BaseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); @@ -790,44 +783,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -838,9 +832,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); } } @@ -869,20 +863,20 @@ public partial class TypeRefComponent : Hl7.Fhir.Model.Element [Binding("ElementDefinitionTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri CodeElement + public Hl7.Fhir.Model.FhirUri? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.FhirUri _CodeElement; + private Hl7.Fhir.Model.FhirUri? _CodeElement; /// /// Data type or Resource (reference to definition) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -904,20 +898,20 @@ public List ProfileElement set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// Profiles (StructureDefinition or IG) - one must apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -936,20 +930,20 @@ public List TargetProfileElement set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } - private List _TargetProfileElement; + private List? _TargetProfileElement; /// /// Profile (StructureDefinition or IG) on the Reference/canonical target - one must apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TargetProfile + public IEnumerable? TargetProfile { - get { return TargetProfileElement != null ? TargetProfileElement.Select(elem => elem.Value) : null; } + get => _TargetProfileElement?.Select(elem => elem.Value); set { if (value == null) - TargetProfileElement = null; + TargetProfileElement = null!; else TargetProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("TargetProfile"); @@ -970,20 +964,20 @@ public List> AggregationE set { _AggregationElement = value; OnPropertyChanged("AggregationElement"); } } - private List> _AggregationElement; + private List>? _AggregationElement; /// /// contained | referenced | bundled - how aggregated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Aggregation + public IEnumerable? Aggregation { - get { return AggregationElement != null ? AggregationElement.Select(elem => elem.Value) : null; } + get => _AggregationElement?.Select(elem => elem.Value); set { if (value == null) - AggregationElement = null; + AggregationElement = null!; else AggregationElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Aggregation"); @@ -997,13 +991,13 @@ public IEnumerable Aggregatio [DeclaredType(Type = typeof(Code))] [Binding("ReferenceVersionRules")] [DataMember] - public Code VersioningElement + public Code? VersioningElement { get { return _VersioningElement; } set { _VersioningElement = value; OnPropertyChanged("VersioningElement"); } } - private Code _VersioningElement; + private Code? _VersioningElement; /// /// either | independent | specific @@ -1022,12 +1016,8 @@ public Hl7.Fhir.Model.ElementDefinition.ReferenceVersionRules? Versioning protected internal override void CopyToInternal(Base other) { - var dest = other as TypeRefComponent; - - if (dest == null) - { + if(other is not TypeRefComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.FhirUri)_CodeElement.DeepCopyInternal(); @@ -1049,58 +1039,59 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TypeRefComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_TargetProfileElement, otherT._TargetProfileElement)) return false; if(!comparer.ListEquals(_AggregationElement, otherT._AggregationElement)) return false; if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "targetProfile": - value = TargetProfileElement; - return TargetProfileElement?.Any() == true; + value = _TargetProfileElement; + return _TargetProfileElement?.Any() == true; case "aggregation": - value = AggregationElement; - return AggregationElement?.Any() == true; + value = _AggregationElement; + return _AggregationElement?.Any() == true; case "versioning": - value = VersioningElement; - return VersioningElement is not null; + value = _VersioningElement; + return _VersioningElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.FhirUri)value; + CodeElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "targetProfile": - TargetProfileElement = (List)value; + TargetProfileElement = (List?)value!; return this; case "aggregation": - AggregationElement = (List>)value; + AggregationElement = (List>?)value!; return this; case "versioning": - VersioningElement = (Code)value; + VersioningElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -1111,11 +1102,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",TargetProfileElement); - if (AggregationElement?.Any() == true) yield return new KeyValuePair("aggregation",AggregationElement); - if (VersioningElement is not null) yield return new KeyValuePair("versioning",VersioningElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",_TargetProfileElement); + if (_AggregationElement?.Any() == true) yield return new KeyValuePair("aggregation",_AggregationElement); + if (_VersioningElement is not null) yield return new KeyValuePair("versioning",_VersioningElement); } } @@ -1143,20 +1134,20 @@ public partial class ExampleComponent : Hl7.Fhir.Model.Element [FhirElement("label", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Describes the purpose of this example /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { get => _LabelElement?.Value; set @@ -1172,22 +1163,18 @@ public string Label [FhirElement("value", InSummary=true, Order=40, Choice=ChoiceType.DatatypeChoice)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ExampleComponent; - - if (dest == null) - { + if(other is not ExampleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); @@ -1206,37 +1193,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExampleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1247,8 +1235,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1276,20 +1264,20 @@ public partial class ConstraintComponent : Hl7.Fhir.Model.Element [FhirElement("key", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id KeyElement + public Hl7.Fhir.Model.Id? KeyElement { get { return _KeyElement; } set { _KeyElement = value; OnPropertyChanged("KeyElement"); } } - private Hl7.Fhir.Model.Id _KeyElement; + private Hl7.Fhir.Model.Id? _KeyElement; /// /// Target of 'condition' reference above /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Key + public string? Key { get => _KeyElement?.Value; set @@ -1314,22 +1302,22 @@ public string Key [DeclaredType(Type = typeof(Hl7.Fhir.Model.FhirString), Since = FhirRelease.STU3)] [DeclaredType(Type = typeof(Hl7.Fhir.Model.Markdown), Since = FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PrimitiveType RequirementsElement + public Hl7.Fhir.Model.PrimitiveType? RequirementsElement { get { return _RequirementsElement; } set { _RequirementsElement = value; OnPropertyChanged("RequirementsElement"); } } - private Hl7.Fhir.Model.PrimitiveType _RequirementsElement; + private Hl7.Fhir.Model.PrimitiveType? _RequirementsElement; /// /// Why this constraint is necessary or appropriate. Use this property in STU3, R4 and R4B. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequirementsString + public string? RequirementsString { - get => ((IValue)_RequirementsElement)?.Value; + get => ((IValue?)_RequirementsElement)?.Value; set { RequirementsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); @@ -1342,9 +1330,9 @@ public string RequirementsString /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirements + public string? Requirements { - get => ((IValue)_RequirementsElement)?.Value; + get => ((IValue?)_RequirementsElement)?.Value; set { RequirementsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); @@ -1360,13 +1348,13 @@ public string Requirements [Binding("ConstraintSeverity")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// error | warning @@ -1391,13 +1379,13 @@ public Hl7.Fhir.Model.ConstraintSeverity? Severity /// [FhirElement("suppress", InSummary=true, Order=60, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SuppressElement + public Hl7.Fhir.Model.FhirBoolean? SuppressElement { get { return _SuppressElement; } set { _SuppressElement = value; OnPropertyChanged("SuppressElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SuppressElement; + private Hl7.Fhir.Model.FhirBoolean? _SuppressElement; /// /// Suppress warning or hint in profile @@ -1420,20 +1408,20 @@ public bool? Suppress [FhirElement("human", InSummary=true, Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString HumanElement + public Hl7.Fhir.Model.FhirString? HumanElement { get { return _HumanElement; } set { _HumanElement = value; OnPropertyChanged("HumanElement"); } } - private Hl7.Fhir.Model.FhirString _HumanElement; + private Hl7.Fhir.Model.FhirString? _HumanElement; /// /// Human description of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Human + public string? Human { get => _HumanElement?.Value; set @@ -1448,20 +1436,20 @@ public string Human /// [FhirElement("expression", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// FHIRPath expression of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { get => _ExpressionElement?.Value; set @@ -1480,20 +1468,20 @@ public string Expression [FhirElement("xpath", InSummary=true, Order=90)] [NotMapped(Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString XpathElement + public Hl7.Fhir.Model.FhirString? XpathElement { get { return _XpathElement; } set { _XpathElement = value; OnPropertyChanged("XpathElement"); } } - private Hl7.Fhir.Model.FhirString _XpathElement; + private Hl7.Fhir.Model.FhirString? _XpathElement; /// /// XPath expression of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Xpath + public string? Xpath { get => _XpathElement?.Value; set @@ -1508,20 +1496,20 @@ public string Xpath /// [FhirElement("source", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical SourceElement + public Hl7.Fhir.Model.Canonical? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.Canonical _SourceElement; + private Hl7.Fhir.Model.Canonical? _SourceElement; /// /// Reference to original source of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { get => _SourceElement?.Value; set @@ -1533,12 +1521,8 @@ public string Source protected internal override void CopyToInternal(Base other) { - var dest = other as ConstraintComponent; - - if (dest == null) - { + if(other is not ConstraintComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_KeyElement is not null) dest.KeyElement = (Hl7.Fhir.Model.Id)_KeyElement.DeepCopyInternal(); @@ -1563,7 +1547,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConstraintComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; if(!comparer.Equals(_RequirementsElement, otherT._RequirementsElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_SuppressElement, otherT._SuppressElement)) return false; @@ -1571,71 +1555,72 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "key": - value = KeyElement; - return KeyElement is not null; + value = _KeyElement; + return _KeyElement is not null; case "requirements": - value = RequirementsElement; - return RequirementsElement is not null; + value = _RequirementsElement; + return _RequirementsElement is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "suppress": - value = SuppressElement; - return SuppressElement is not null; + value = _SuppressElement; + return _SuppressElement is not null; case "human": - value = HumanElement; - return HumanElement is not null; + value = _HumanElement; + return _HumanElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "xpath": - value = XpathElement; - return XpathElement is not null; + value = _XpathElement; + return _XpathElement is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "key": - KeyElement = (Hl7.Fhir.Model.Id)value; + KeyElement = (Hl7.Fhir.Model.Id?)value; return this; case "requirements": - RequirementsElement = (Hl7.Fhir.Model.PrimitiveType)value; + RequirementsElement = (Hl7.Fhir.Model.PrimitiveType?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "suppress": - SuppressElement = (Hl7.Fhir.Model.FhirBoolean)value; + SuppressElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "human": - HumanElement = (Hl7.Fhir.Model.FhirString)value; + HumanElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpath": - XpathElement = (Hl7.Fhir.Model.FhirString)value; + XpathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.Canonical)value; + SourceElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1646,14 +1631,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KeyElement is not null) yield return new KeyValuePair("key",KeyElement); - if (RequirementsElement is not null) yield return new KeyValuePair("requirements",RequirementsElement); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (SuppressElement is not null) yield return new KeyValuePair("suppress",SuppressElement); - if (HumanElement is not null) yield return new KeyValuePair("human",HumanElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (XpathElement is not null) yield return new KeyValuePair("xpath",XpathElement); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); + if (_KeyElement is not null) yield return new KeyValuePair("key",_KeyElement); + if (_RequirementsElement is not null) yield return new KeyValuePair("requirements",_RequirementsElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_SuppressElement is not null) yield return new KeyValuePair("suppress",_SuppressElement); + if (_HumanElement is not null) yield return new KeyValuePair("human",_HumanElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_XpathElement is not null) yield return new KeyValuePair("xpath",_XpathElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); } } @@ -1683,13 +1668,13 @@ public partial class ElementDefinitionBindingComponent : Hl7.Fhir.Model.Element [Binding("BindingStrength")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StrengthElement + public Code? StrengthElement { get { return _StrengthElement; } set { _StrengthElement = value; OnPropertyChanged("StrengthElement"); } } - private Code _StrengthElement; + private Code? _StrengthElement; /// /// required | extensible | preferred | example @@ -1721,22 +1706,22 @@ public Hl7.Fhir.Model.BindingStrength? Strength [DeclaredType(Type = typeof(Hl7.Fhir.Model.FhirString), Since = FhirRelease.STU3)] [DeclaredType(Type = typeof(Hl7.Fhir.Model.Markdown), Since = FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PrimitiveType DescriptionElement + public Hl7.Fhir.Model.PrimitiveType? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.PrimitiveType _DescriptionElement; + private Hl7.Fhir.Model.PrimitiveType? _DescriptionElement; /// /// Intended use of codes in the bound value set. Use this property in STU3, R4 and R4B. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DescriptionString + public string? DescriptionString { - get => ((IValue)_DescriptionElement)?.Value; + get => ((IValue?)_DescriptionElement)?.Value; set { DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); @@ -1749,9 +1734,9 @@ public string DescriptionString /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get => ((IValue)_DescriptionElement)?.Value; + get => ((IValue?)_DescriptionElement)?.Value; set { DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); @@ -1764,20 +1749,20 @@ public string Description /// [FhirElement("valueSet", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Source of value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { get => _ValueSetElement?.Value; set @@ -1802,16 +1787,12 @@ public List Additional set { _Additional = value; OnPropertyChanged("Additional"); } } - private List _Additional; + private List? _Additional; protected internal override void CopyToInternal(Base other) { - var dest = other as ElementDefinitionBindingComponent; - - if (dest == null) - { + if(other is not ElementDefinitionBindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_StrengthElement is not null) dest.StrengthElement = (Code)_StrengthElement.DeepCopyInternal(); @@ -1832,51 +1813,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ElementDefinitionBindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.ListEquals(_Additional, otherT._Additional)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "strength": - value = StrengthElement; - return StrengthElement is not null; + value = _StrengthElement; + return _StrengthElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "additional": - value = Additional; - return Additional?.Any() == true; + value = _Additional; + return _Additional?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "strength": - StrengthElement = (Code)value; + StrengthElement = (Code?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.PrimitiveType)value; + DescriptionElement = (Hl7.Fhir.Model.PrimitiveType?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "additional": - Additional = (List)value; + Additional = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1887,10 +1869,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StrengthElement is not null) yield return new KeyValuePair("strength",StrengthElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (Additional?.Any() == true) yield return new KeyValuePair("additional",Additional); + if (_StrengthElement is not null) yield return new KeyValuePair("strength",_StrengthElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_Additional?.Any() == true) yield return new KeyValuePair("additional",_Additional); } } @@ -1922,13 +1904,13 @@ public partial class AdditionalComponent : Hl7.Fhir.Model.Element [Binding("AdditionalBindingPurpose")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PurposeElement + public Code? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Code _PurposeElement; + private Code? _PurposeElement; /// /// maximum | minimum | required | extensible | candidate | current | preferred | ui | starter | component @@ -1954,20 +1936,20 @@ public Hl7.Fhir.Model.ElementDefinition.AdditionalBindingPurposeVS? Purpose [FhirElement("valueSet", InSummary=true, Order=40, Since=FhirRelease.R5)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// The value set for the additional binding /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { get => _ValueSetElement?.Value; set @@ -1985,20 +1967,20 @@ public string ValueSet /// [FhirElement("documentation", InSummary=true, Order=50, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Documentation of the purpose of use of the binding /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { get => _DocumentationElement?.Value; set @@ -2016,20 +1998,20 @@ public string Documentation /// [FhirElement("shortDoco", InSummary=true, Order=60, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortDocoElement + public Hl7.Fhir.Model.FhirString? ShortDocoElement { get { return _ShortDocoElement; } set { _ShortDocoElement = value; OnPropertyChanged("ShortDocoElement"); } } - private Hl7.Fhir.Model.FhirString _ShortDocoElement; + private Hl7.Fhir.Model.FhirString? _ShortDocoElement; /// /// Concise documentation - for summary tables /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortDoco + public string? ShortDoco { get => _ShortDocoElement?.Value; set @@ -2054,7 +2036,7 @@ public List Usage set { _Usage = value; OnPropertyChanged("Usage"); } } - private List _Usage; + private List? _Usage; /// /// Whether binding can applies to all repeats, or just one. @@ -2064,13 +2046,13 @@ public List Usage /// [FhirElement("any", InSummary=true, Order=80, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AnyElement + public Hl7.Fhir.Model.FhirBoolean? AnyElement { get { return _AnyElement; } set { _AnyElement = value; OnPropertyChanged("AnyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AnyElement; + private Hl7.Fhir.Model.FhirBoolean? _AnyElement; /// /// Whether binding can applies to all repeats, or just one @@ -2089,12 +2071,8 @@ public bool? Any protected internal override void CopyToInternal(Base other) { - var dest = other as AdditionalComponent; - - if (dest == null) - { + if(other is not AdditionalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_PurposeElement is not null) dest.PurposeElement = (Code)_PurposeElement.DeepCopyInternal(); @@ -2117,65 +2095,66 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdditionalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_ShortDocoElement, otherT._ShortDocoElement)) return false; if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; if(!comparer.Equals(_AnyElement, otherT._AnyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "shortDoco": - value = ShortDocoElement; - return ShortDocoElement is not null; + value = _ShortDocoElement; + return _ShortDocoElement is not null; case "usage": - value = Usage; - return Usage?.Any() == true; + value = _Usage; + return _Usage?.Any() == true; case "any": - value = AnyElement; - return AnyElement is not null; + value = _AnyElement; + return _AnyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - PurposeElement = (Code)value; + PurposeElement = (Code?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "shortDoco": - ShortDocoElement = (Hl7.Fhir.Model.FhirString)value; + ShortDocoElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "usage": - Usage = (List)value; + Usage = (List?)value!; return this; case "any": - AnyElement = (Hl7.Fhir.Model.FhirBoolean)value; + AnyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -2186,12 +2165,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (ShortDocoElement is not null) yield return new KeyValuePair("shortDoco",ShortDocoElement); - if (Usage?.Any() == true) yield return new KeyValuePair("usage",Usage); - if (AnyElement is not null) yield return new KeyValuePair("any",AnyElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_ShortDocoElement is not null) yield return new KeyValuePair("shortDoco",_ShortDocoElement); + if (_Usage?.Any() == true) yield return new KeyValuePair("usage",_Usage); + if (_AnyElement is not null) yield return new KeyValuePair("any",_AnyElement); } } @@ -2219,20 +2198,20 @@ public partial class MappingComponent : Hl7.Fhir.Model.Element [FhirElement("identity", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentityElement + public Hl7.Fhir.Model.Id? IdentityElement { get { return _IdentityElement; } set { _IdentityElement = value; OnPropertyChanged("IdentityElement"); } } - private Hl7.Fhir.Model.Id _IdentityElement; + private Hl7.Fhir.Model.Id? _IdentityElement; /// /// Reference to mapping declaration /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identity + public string? Identity { get => _IdentityElement?.Value; set @@ -2248,20 +2227,20 @@ public string Identity [FhirElement("language", InSummary=true, Order=40)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Computable language of mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { get => _LanguageElement?.Value; set @@ -2277,20 +2256,20 @@ public string Language [FhirElement("map", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MapElement + public Hl7.Fhir.Model.FhirString? MapElement { get { return _MapElement; } set { _MapElement = value; OnPropertyChanged("MapElement"); } } - private Hl7.Fhir.Model.FhirString _MapElement; + private Hl7.Fhir.Model.FhirString? _MapElement; /// /// Details of the mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Map + public string? Map { get => _MapElement?.Value; set @@ -2315,22 +2294,22 @@ public string Map [DeclaredType(Type = typeof(Hl7.Fhir.Model.FhirString), Since = FhirRelease.STU3)] [DeclaredType(Type = typeof(Hl7.Fhir.Model.Markdown), Since = FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.PrimitiveType CommentElement + public Hl7.Fhir.Model.PrimitiveType? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.PrimitiveType _CommentElement; + private Hl7.Fhir.Model.PrimitiveType? _CommentElement; /// /// Comments about the mapping or its use. Use this property in STU3, R4 and R4B. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CommentString + public string? CommentString { - get => ((IValue)_CommentElement)?.Value; + get => ((IValue?)_CommentElement)?.Value; set { CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); @@ -2343,9 +2322,9 @@ public string CommentString /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get => ((IValue)_CommentElement)?.Value; + get => ((IValue?)_CommentElement)?.Value; set { CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); @@ -2355,12 +2334,8 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as MappingComponent; - - if (dest == null) - { + if(other is not MappingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_IdentityElement is not null) dest.IdentityElement = (Hl7.Fhir.Model.Id)_IdentityElement.DeepCopyInternal(); @@ -2381,51 +2356,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_MapElement, otherT._MapElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identity": - value = IdentityElement; - return IdentityElement is not null; + value = _IdentityElement; + return _IdentityElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "map": - value = MapElement; - return MapElement is not null; + value = _MapElement; + return _MapElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identity": - IdentityElement = (Hl7.Fhir.Model.Id)value; + IdentityElement = (Hl7.Fhir.Model.Id?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "map": - MapElement = (Hl7.Fhir.Model.FhirString)value; + MapElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.PrimitiveType)value; + CommentElement = (Hl7.Fhir.Model.PrimitiveType?)value; return this; default: return base.SetValue(key, value); @@ -2436,10 +2412,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentityElement is not null) yield return new KeyValuePair("identity",IdentityElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (MapElement is not null) yield return new KeyValuePair("map",MapElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_IdentityElement is not null) yield return new KeyValuePair("identity",_IdentityElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_MapElement is not null) yield return new KeyValuePair("map",_MapElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -2450,20 +2426,20 @@ public override IEnumerable> EnumerateElements() [FhirElement("path", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path of the element in the hierarchy of elements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { get => _PathElement?.Value; set @@ -2487,20 +2463,20 @@ public List> Repre set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } - private List> _RepresentationElement; + private List>? _RepresentationElement; /// /// xmlAttr | xmlText | typeAttr | cdaText | xhtml /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Representation + public IEnumerable? Representation { - get { return RepresentationElement != null ? RepresentationElement.Select(elem => elem.Value) : null; } + get => _RepresentationElement?.Select(elem => elem.Value); set { if (value == null) - RepresentationElement = null; + RepresentationElement = null!; else RepresentationElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Representation"); @@ -2512,20 +2488,20 @@ public IEnumerable Rep /// [FhirElement("sliceName", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString SliceNameElement + public Hl7.Fhir.Model.FhirString? SliceNameElement { get { return _SliceNameElement; } set { _SliceNameElement = value; OnPropertyChanged("SliceNameElement"); } } - private Hl7.Fhir.Model.FhirString _SliceNameElement; + private Hl7.Fhir.Model.FhirString? _SliceNameElement; /// /// Name for this particular element (in a set of slices) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SliceName + public string? SliceName { get => _SliceNameElement?.Value; set @@ -2540,13 +2516,13 @@ public string SliceName /// [FhirElement("sliceIsConstraining", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SliceIsConstrainingElement + public Hl7.Fhir.Model.FhirBoolean? SliceIsConstrainingElement { get { return _SliceIsConstrainingElement; } set { _SliceIsConstrainingElement = value; OnPropertyChanged("SliceIsConstrainingElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SliceIsConstrainingElement; + private Hl7.Fhir.Model.FhirBoolean? _SliceIsConstrainingElement; /// /// If this slice definition constrains an inherited slice definition (or not) @@ -2568,20 +2544,20 @@ public bool? SliceIsConstraining /// [FhirElement("label", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Name for element to display with or prompt for element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { get => _LabelElement?.Value; set @@ -2604,40 +2580,40 @@ public List Code set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// This element is sliced - slices follow. /// [FhirElement("slicing", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.ElementDefinition.SlicingComponent Slicing + public Hl7.Fhir.Model.ElementDefinition.SlicingComponent? Slicing { get { return _Slicing; } set { _Slicing = value; OnPropertyChanged("Slicing"); } } - private Hl7.Fhir.Model.ElementDefinition.SlicingComponent _Slicing; + private Hl7.Fhir.Model.ElementDefinition.SlicingComponent? _Slicing; /// /// Concise definition for space-constrained presentation. /// [FhirElement("short", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortElement + public Hl7.Fhir.Model.FhirString? ShortElement { get { return _ShortElement; } set { _ShortElement = value; OnPropertyChanged("ShortElement"); } } - private Hl7.Fhir.Model.FhirString _ShortElement; + private Hl7.Fhir.Model.FhirString? _ShortElement; /// /// Concise definition for space-constrained presentation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Short + public string? Short { get => _ShortElement?.Value; set @@ -2652,20 +2628,20 @@ public string Short /// [FhirElement("definition", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Markdown DefinitionElement + public Hl7.Fhir.Model.Markdown? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Markdown _DefinitionElement; + private Hl7.Fhir.Model.Markdown? _DefinitionElement; /// /// Full formal definition as narrative text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { get => _DefinitionElement?.Value; set @@ -2680,20 +2656,20 @@ public string Definition /// [FhirElement("comment", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Comments about the use of this element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { get => _CommentElement?.Value; set @@ -2708,20 +2684,20 @@ public string Comment /// [FhirElement("requirements", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Markdown RequirementsElement + public Hl7.Fhir.Model.Markdown? RequirementsElement { get { return _RequirementsElement; } set { _RequirementsElement = value; OnPropertyChanged("RequirementsElement"); } } - private Hl7.Fhir.Model.Markdown _RequirementsElement; + private Hl7.Fhir.Model.Markdown? _RequirementsElement; /// /// Why this resource has been created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirements + public string? Requirements { get => _RequirementsElement?.Value; set @@ -2743,20 +2719,20 @@ public List AliasElement set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Other names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -2768,13 +2744,13 @@ public IEnumerable Alias /// [FhirElement("min", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Minimum Cardinality @@ -2796,20 +2772,20 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum Cardinality (a number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { get => _MaxElement?.Value; set @@ -2824,33 +2800,33 @@ public string Max /// [FhirElement("base", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.ElementDefinition.BaseComponent Base + public Hl7.Fhir.Model.ElementDefinition.BaseComponent? Base { get { return _Base; } set { _Base = value; OnPropertyChanged("Base"); } } - private Hl7.Fhir.Model.ElementDefinition.BaseComponent _Base; + private Hl7.Fhir.Model.ElementDefinition.BaseComponent? _Base; /// /// Reference to definition of content for the element. /// [FhirElement("contentReference", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirUri ContentReferenceElement + public Hl7.Fhir.Model.FhirUri? ContentReferenceElement { get { return _ContentReferenceElement; } set { _ContentReferenceElement = value; OnPropertyChanged("ContentReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ContentReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ContentReferenceElement; /// /// Reference to definition of content for the element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentReference + public string? ContentReference { get => _ContentReferenceElement?.Value; set @@ -2872,40 +2848,40 @@ public List Type set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specified value if missing from instance. /// [FhirElement("defaultValue", InSummary=true, Order=210, Choice=ChoiceType.DatatypeChoice)] [DataMember] - public Hl7.Fhir.Model.DataType DefaultValue + public Hl7.Fhir.Model.DataType? DefaultValue { get { return _DefaultValue; } set { _DefaultValue = value; OnPropertyChanged("DefaultValue"); } } - private Hl7.Fhir.Model.DataType _DefaultValue; + private Hl7.Fhir.Model.DataType? _DefaultValue; /// /// Implicit meaning when this element is missing. /// [FhirElement("meaningWhenMissing", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown MeaningWhenMissingElement + public Hl7.Fhir.Model.Markdown? MeaningWhenMissingElement { get { return _MeaningWhenMissingElement; } set { _MeaningWhenMissingElement = value; OnPropertyChanged("MeaningWhenMissingElement"); } } - private Hl7.Fhir.Model.Markdown _MeaningWhenMissingElement; + private Hl7.Fhir.Model.Markdown? _MeaningWhenMissingElement; /// /// Implicit meaning when this element is missing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeaningWhenMissing + public string? MeaningWhenMissing { get => _MeaningWhenMissingElement?.Value; set @@ -2920,20 +2896,20 @@ public string MeaningWhenMissing /// [FhirElement("orderMeaning", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString OrderMeaningElement + public Hl7.Fhir.Model.FhirString? OrderMeaningElement { get { return _OrderMeaningElement; } set { _OrderMeaningElement = value; OnPropertyChanged("OrderMeaningElement"); } } - private Hl7.Fhir.Model.FhirString _OrderMeaningElement; + private Hl7.Fhir.Model.FhirString? _OrderMeaningElement; /// /// What the order of the elements means /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OrderMeaning + public string? OrderMeaning { get => _OrderMeaningElement?.Value; set @@ -2948,26 +2924,26 @@ public string OrderMeaning /// [FhirElement("fixed", InSummary=true, Order=240, Choice=ChoiceType.DatatypeChoice)] [DataMember] - public Hl7.Fhir.Model.DataType Fixed + public Hl7.Fhir.Model.DataType? Fixed { get { return _Fixed; } set { _Fixed = value; OnPropertyChanged("Fixed"); } } - private Hl7.Fhir.Model.DataType _Fixed; + private Hl7.Fhir.Model.DataType? _Fixed; /// /// Value must have at least these property values. /// [FhirElement("pattern", InSummary=true, Order=250, Choice=ChoiceType.DatatypeChoice)] [DataMember] - public Hl7.Fhir.Model.DataType Pattern + public Hl7.Fhir.Model.DataType? Pattern { get { return _Pattern; } set { _Pattern = value; OnPropertyChanged("Pattern"); } } - private Hl7.Fhir.Model.DataType _Pattern; + private Hl7.Fhir.Model.DataType? _Pattern; /// /// Example value (as defined for type). @@ -2981,7 +2957,7 @@ public List Example set { _Example = value; OnPropertyChanged("Example"); } } - private List _Example; + private List? _Example; /// /// Minimum Allowed Value (for some types). @@ -2990,13 +2966,13 @@ public List Example [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Integer64),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType MinValue + public Hl7.Fhir.Model.DataType? MinValue { get { return _MinValue; } set { _MinValue = value; OnPropertyChanged("MinValue"); } } - private Hl7.Fhir.Model.DataType _MinValue; + private Hl7.Fhir.Model.DataType? _MinValue; /// /// Maximum Allowed Value (for some types). @@ -3005,26 +2981,26 @@ public Hl7.Fhir.Model.DataType MinValue [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Integer64),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType MaxValue + public Hl7.Fhir.Model.DataType? MaxValue { get { return _MaxValue; } set { _MaxValue = value; OnPropertyChanged("MaxValue"); } } - private Hl7.Fhir.Model.DataType _MaxValue; + private Hl7.Fhir.Model.DataType? _MaxValue; /// /// Max length for string type data. /// [FhirElement("maxLength", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Integer MaxLengthElement + public Hl7.Fhir.Model.Integer? MaxLengthElement { get { return _MaxLengthElement; } set { _MaxLengthElement = value; OnPropertyChanged("MaxLengthElement"); } } - private Hl7.Fhir.Model.Integer _MaxLengthElement; + private Hl7.Fhir.Model.Integer? _MaxLengthElement; /// /// Max length for string type data @@ -3053,20 +3029,20 @@ public List ConditionElement set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private List _ConditionElement; + private List? _ConditionElement; /// /// Reference to invariant about presence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Condition + public IEnumerable? Condition { - get { return ConditionElement != null ? ConditionElement.Select(elem => elem.Value) : null; } + get => _ConditionElement?.Select(elem => elem.Value); set { if (value == null) - ConditionElement = null; + ConditionElement = null!; else ConditionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Id(elem))); OnPropertyChanged("Condition"); @@ -3085,7 +3061,7 @@ public List Constraint set { _Constraint = value; OnPropertyChanged("Constraint"); } } - private List _Constraint; + private List? _Constraint; /// /// For primitives, that a value must be present - not replaced by an extension. @@ -3095,13 +3071,13 @@ public List Constraint /// [FhirElement("mustHaveValue", InSummary=true, Order=320, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MustHaveValueElement + public Hl7.Fhir.Model.FhirBoolean? MustHaveValueElement { get { return _MustHaveValueElement; } set { _MustHaveValueElement = value; OnPropertyChanged("MustHaveValueElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MustHaveValueElement; + private Hl7.Fhir.Model.FhirBoolean? _MustHaveValueElement; /// /// For primitives, that a value must be present - not replaced by an extension @@ -3133,20 +3109,20 @@ public List ValueAlternativesElement set { _ValueAlternativesElement = value; OnPropertyChanged("ValueAlternativesElement"); } } - private List _ValueAlternativesElement; + private List? _ValueAlternativesElement; /// /// Extensions that are allowed to replace a primitive value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ValueAlternatives + public IEnumerable? ValueAlternatives { - get { return ValueAlternativesElement != null ? ValueAlternativesElement.Select(elem => elem.Value) : null; } + get => _ValueAlternativesElement?.Select(elem => elem.Value); set { if (value == null) - ValueAlternativesElement = null; + ValueAlternativesElement = null!; else ValueAlternativesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("ValueAlternatives"); @@ -3158,13 +3134,13 @@ public IEnumerable ValueAlternatives /// [FhirElement("mustSupport", InSummary=true, Order=340)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MustSupportElement + public Hl7.Fhir.Model.FhirBoolean? MustSupportElement { get { return _MustSupportElement; } set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MustSupportElement; + private Hl7.Fhir.Model.FhirBoolean? _MustSupportElement; /// /// If the element must be supported (discouraged - see obligations) @@ -3186,13 +3162,13 @@ public bool? MustSupport /// [FhirElement("isModifier", InSummary=true, Order=350)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsModifierElement + public Hl7.Fhir.Model.FhirBoolean? IsModifierElement { get { return _IsModifierElement; } set { _IsModifierElement = value; OnPropertyChanged("IsModifierElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsModifierElement; + private Hl7.Fhir.Model.FhirBoolean? _IsModifierElement; /// /// If this modifies the meaning of other elements @@ -3214,20 +3190,20 @@ public bool? IsModifier /// [FhirElement("isModifierReason", InSummary=true, Order=360)] [DataMember] - public Hl7.Fhir.Model.FhirString IsModifierReasonElement + public Hl7.Fhir.Model.FhirString? IsModifierReasonElement { get { return _IsModifierReasonElement; } set { _IsModifierReasonElement = value; OnPropertyChanged("IsModifierReasonElement"); } } - private Hl7.Fhir.Model.FhirString _IsModifierReasonElement; + private Hl7.Fhir.Model.FhirString? _IsModifierReasonElement; /// /// Reason that this element is marked as a modifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IsModifierReason + public string? IsModifierReason { get => _IsModifierReasonElement?.Value; set @@ -3242,13 +3218,13 @@ public string IsModifierReason /// [FhirElement("isSummary", InSummary=true, Order=370)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsSummaryElement + public Hl7.Fhir.Model.FhirBoolean? IsSummaryElement { get { return _IsSummaryElement; } set { _IsSummaryElement = value; OnPropertyChanged("IsSummaryElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsSummaryElement; + private Hl7.Fhir.Model.FhirBoolean? _IsSummaryElement; /// /// Include when _summary = true? @@ -3270,13 +3246,13 @@ public bool? IsSummary /// [FhirElement("binding", InSummary=true, Order=380)] [DataMember] - public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent Binding + public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent? Binding { get { return _Binding; } set { _Binding = value; OnPropertyChanged("Binding"); } } - private Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent _Binding; + private Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent? _Binding; /// /// Map element to another set of definitions. @@ -3290,16 +3266,12 @@ public List Mapping set { _Mapping = value; OnPropertyChanged("Mapping"); } } - private List _Mapping; + private List? _Mapping; protected internal override void CopyToInternal(Base other) { - var dest = other as ElementDefinition; - - if (dest == null) - { + if(other is not ElementDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); @@ -3352,7 +3324,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.ListEquals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; if(!comparer.Equals(_SliceIsConstrainingElement, otherT._SliceIsConstrainingElement)) return false; @@ -3388,239 +3360,240 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_IsSummaryElement, otherT._IsSummaryElement)) return false; if(!comparer.Equals(_Binding, otherT._Binding)) return false; if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "representation": - value = RepresentationElement; - return RepresentationElement?.Any() == true; + value = _RepresentationElement; + return _RepresentationElement?.Any() == true; case "sliceName": - value = SliceNameElement; - return SliceNameElement is not null; + value = _SliceNameElement; + return _SliceNameElement is not null; case "sliceIsConstraining": - value = SliceIsConstrainingElement; - return SliceIsConstrainingElement is not null; + value = _SliceIsConstrainingElement; + return _SliceIsConstrainingElement is not null; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "slicing": - value = Slicing; - return Slicing is not null; + value = _Slicing; + return _Slicing is not null; case "short": - value = ShortElement; - return ShortElement is not null; + value = _ShortElement; + return _ShortElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "requirements": - value = RequirementsElement; - return RequirementsElement is not null; + value = _RequirementsElement; + return _RequirementsElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "base": - value = Base; - return Base is not null; + value = _Base; + return _Base is not null; case "contentReference": - value = ContentReferenceElement; - return ContentReferenceElement is not null; + value = _ContentReferenceElement; + return _ContentReferenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "defaultValue": - value = DefaultValue; - return DefaultValue is not null; + value = _DefaultValue; + return _DefaultValue is not null; case "meaningWhenMissing": - value = MeaningWhenMissingElement; - return MeaningWhenMissingElement is not null; + value = _MeaningWhenMissingElement; + return _MeaningWhenMissingElement is not null; case "orderMeaning": - value = OrderMeaningElement; - return OrderMeaningElement is not null; + value = _OrderMeaningElement; + return _OrderMeaningElement is not null; case "fixed": - value = Fixed; - return Fixed is not null; + value = _Fixed; + return _Fixed is not null; case "pattern": - value = Pattern; - return Pattern is not null; + value = _Pattern; + return _Pattern is not null; case "example": - value = Example; - return Example?.Any() == true; + value = _Example; + return _Example?.Any() == true; case "minValue": - value = MinValue; - return MinValue is not null; + value = _MinValue; + return _MinValue is not null; case "maxValue": - value = MaxValue; - return MaxValue is not null; + value = _MaxValue; + return _MaxValue is not null; case "maxLength": - value = MaxLengthElement; - return MaxLengthElement is not null; + value = _MaxLengthElement; + return _MaxLengthElement is not null; case "condition": - value = ConditionElement; - return ConditionElement?.Any() == true; + value = _ConditionElement; + return _ConditionElement?.Any() == true; case "constraint": - value = Constraint; - return Constraint?.Any() == true; + value = _Constraint; + return _Constraint?.Any() == true; case "mustHaveValue": - value = MustHaveValueElement; - return MustHaveValueElement is not null; + value = _MustHaveValueElement; + return _MustHaveValueElement is not null; case "valueAlternatives": - value = ValueAlternativesElement; - return ValueAlternativesElement?.Any() == true; + value = _ValueAlternativesElement; + return _ValueAlternativesElement?.Any() == true; case "mustSupport": - value = MustSupportElement; - return MustSupportElement is not null; + value = _MustSupportElement; + return _MustSupportElement is not null; case "isModifier": - value = IsModifierElement; - return IsModifierElement is not null; + value = _IsModifierElement; + return _IsModifierElement is not null; case "isModifierReason": - value = IsModifierReasonElement; - return IsModifierReasonElement is not null; + value = _IsModifierReasonElement; + return _IsModifierReasonElement is not null; case "isSummary": - value = IsSummaryElement; - return IsSummaryElement is not null; + value = _IsSummaryElement; + return _IsSummaryElement is not null; case "binding": - value = Binding; - return Binding is not null; + value = _Binding; + return _Binding is not null; case "mapping": - value = Mapping; - return Mapping?.Any() == true; + value = _Mapping; + return _Mapping?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "representation": - RepresentationElement = (List>)value; + RepresentationElement = (List>?)value!; return this; case "sliceName": - SliceNameElement = (Hl7.Fhir.Model.FhirString)value; + SliceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sliceIsConstraining": - SliceIsConstrainingElement = (Hl7.Fhir.Model.FhirBoolean)value; + SliceIsConstrainingElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "slicing": - Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent)value; + Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent?)value; return this; case "short": - ShortElement = (Hl7.Fhir.Model.FhirString)value; + ShortElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Markdown)value; + DefinitionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "requirements": - RequirementsElement = (Hl7.Fhir.Model.Markdown)value; + RequirementsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "base": - Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent)value; + Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent?)value; return this; case "contentReference": - ContentReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ContentReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "defaultValue": - DefaultValue = (Hl7.Fhir.Model.DataType)value; + DefaultValue = (Hl7.Fhir.Model.DataType?)value; return this; case "meaningWhenMissing": - MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown)value; + MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "orderMeaning": - OrderMeaningElement = (Hl7.Fhir.Model.FhirString)value; + OrderMeaningElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "fixed": - Fixed = (Hl7.Fhir.Model.DataType)value; + Fixed = (Hl7.Fhir.Model.DataType?)value; return this; case "pattern": - Pattern = (Hl7.Fhir.Model.DataType)value; + Pattern = (Hl7.Fhir.Model.DataType?)value; return this; case "example": - Example = (List)value; + Example = (List?)value!; return this; case "minValue": - MinValue = (Hl7.Fhir.Model.DataType)value; + MinValue = (Hl7.Fhir.Model.DataType?)value; return this; case "maxValue": - MaxValue = (Hl7.Fhir.Model.DataType)value; + MaxValue = (Hl7.Fhir.Model.DataType?)value; return this; case "maxLength": - MaxLengthElement = (Hl7.Fhir.Model.Integer)value; + MaxLengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "condition": - ConditionElement = (List)value; + ConditionElement = (List?)value!; return this; case "constraint": - Constraint = (List)value; + Constraint = (List?)value!; return this; case "mustHaveValue": - MustHaveValueElement = (Hl7.Fhir.Model.FhirBoolean)value; + MustHaveValueElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "valueAlternatives": - ValueAlternativesElement = (List)value; + ValueAlternativesElement = (List?)value!; return this; case "mustSupport": - MustSupportElement = (Hl7.Fhir.Model.FhirBoolean)value; + MustSupportElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "isModifier": - IsModifierElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsModifierElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "isModifierReason": - IsModifierReasonElement = (Hl7.Fhir.Model.FhirString)value; + IsModifierReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "isSummary": - IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "binding": - Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent)value; + Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent?)value; return this; case "mapping": - Mapping = (List)value; + Mapping = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3631,42 +3604,42 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (RepresentationElement?.Any() == true) yield return new KeyValuePair("representation",RepresentationElement); - if (SliceNameElement is not null) yield return new KeyValuePair("sliceName",SliceNameElement); - if (SliceIsConstrainingElement is not null) yield return new KeyValuePair("sliceIsConstraining",SliceIsConstrainingElement); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Slicing is not null) yield return new KeyValuePair("slicing",Slicing); - if (ShortElement is not null) yield return new KeyValuePair("short",ShortElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (RequirementsElement is not null) yield return new KeyValuePair("requirements",RequirementsElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (Base is not null) yield return new KeyValuePair("base",Base); - if (ContentReferenceElement is not null) yield return new KeyValuePair("contentReference",ContentReferenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DefaultValue is not null) yield return new KeyValuePair("defaultValue",DefaultValue); - if (MeaningWhenMissingElement is not null) yield return new KeyValuePair("meaningWhenMissing",MeaningWhenMissingElement); - if (OrderMeaningElement is not null) yield return new KeyValuePair("orderMeaning",OrderMeaningElement); - if (Fixed is not null) yield return new KeyValuePair("fixed",Fixed); - if (Pattern is not null) yield return new KeyValuePair("pattern",Pattern); - if (Example?.Any() == true) yield return new KeyValuePair("example",Example); - if (MinValue is not null) yield return new KeyValuePair("minValue",MinValue); - if (MaxValue is not null) yield return new KeyValuePair("maxValue",MaxValue); - if (MaxLengthElement is not null) yield return new KeyValuePair("maxLength",MaxLengthElement); - if (ConditionElement?.Any() == true) yield return new KeyValuePair("condition",ConditionElement); - if (Constraint?.Any() == true) yield return new KeyValuePair("constraint",Constraint); - if (MustHaveValueElement is not null) yield return new KeyValuePair("mustHaveValue",MustHaveValueElement); - if (ValueAlternativesElement?.Any() == true) yield return new KeyValuePair("valueAlternatives",ValueAlternativesElement); - if (MustSupportElement is not null) yield return new KeyValuePair("mustSupport",MustSupportElement); - if (IsModifierElement is not null) yield return new KeyValuePair("isModifier",IsModifierElement); - if (IsModifierReasonElement is not null) yield return new KeyValuePair("isModifierReason",IsModifierReasonElement); - if (IsSummaryElement is not null) yield return new KeyValuePair("isSummary",IsSummaryElement); - if (Binding is not null) yield return new KeyValuePair("binding",Binding); - if (Mapping?.Any() == true) yield return new KeyValuePair("mapping",Mapping); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_RepresentationElement?.Any() == true) yield return new KeyValuePair("representation",_RepresentationElement); + if (_SliceNameElement is not null) yield return new KeyValuePair("sliceName",_SliceNameElement); + if (_SliceIsConstrainingElement is not null) yield return new KeyValuePair("sliceIsConstraining",_SliceIsConstrainingElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Slicing is not null) yield return new KeyValuePair("slicing",_Slicing); + if (_ShortElement is not null) yield return new KeyValuePair("short",_ShortElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_RequirementsElement is not null) yield return new KeyValuePair("requirements",_RequirementsElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_Base is not null) yield return new KeyValuePair("base",_Base); + if (_ContentReferenceElement is not null) yield return new KeyValuePair("contentReference",_ContentReferenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DefaultValue is not null) yield return new KeyValuePair("defaultValue",_DefaultValue); + if (_MeaningWhenMissingElement is not null) yield return new KeyValuePair("meaningWhenMissing",_MeaningWhenMissingElement); + if (_OrderMeaningElement is not null) yield return new KeyValuePair("orderMeaning",_OrderMeaningElement); + if (_Fixed is not null) yield return new KeyValuePair("fixed",_Fixed); + if (_Pattern is not null) yield return new KeyValuePair("pattern",_Pattern); + if (_Example?.Any() == true) yield return new KeyValuePair("example",_Example); + if (_MinValue is not null) yield return new KeyValuePair("minValue",_MinValue); + if (_MaxValue is not null) yield return new KeyValuePair("maxValue",_MaxValue); + if (_MaxLengthElement is not null) yield return new KeyValuePair("maxLength",_MaxLengthElement); + if (_ConditionElement?.Any() == true) yield return new KeyValuePair("condition",_ConditionElement); + if (_Constraint?.Any() == true) yield return new KeyValuePair("constraint",_Constraint); + if (_MustHaveValueElement is not null) yield return new KeyValuePair("mustHaveValue",_MustHaveValueElement); + if (_ValueAlternativesElement?.Any() == true) yield return new KeyValuePair("valueAlternatives",_ValueAlternativesElement); + if (_MustSupportElement is not null) yield return new KeyValuePair("mustSupport",_MustSupportElement); + if (_IsModifierElement is not null) yield return new KeyValuePair("isModifier",_IsModifierElement); + if (_IsModifierReasonElement is not null) yield return new KeyValuePair("isModifierReason",_IsModifierReasonElement); + if (_IsSummaryElement is not null) yield return new KeyValuePair("isSummary",_IsSummaryElement); + if (_Binding is not null) yield return new KeyValuePair("binding",_Binding); + if (_Mapping?.Any() == true) yield return new KeyValuePair("mapping",_Mapping); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs index faffc5b40..d8e9f5d8f 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -294,13 +297,13 @@ public enum RelatedArtifactType [Binding("RelatedArtifactType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// documentation | justification | citation | predecessor | successor | derived-from | depends-on | composed-of | part-of | amends | amended-with | appends | appended-with | cites | cited-by | comments-on | comment-in | contains | contained-in | corrects | correction-in | replaces | replaced-with | retracts | retracted-by | signs | similar-to | supports | supported-with | transforms | transformed-into | transformed-with | documents | specification-of | created-with | cite-as @@ -333,27 +336,27 @@ public List Classifier set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// Short label. /// [FhirElement("label", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Short label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { get => _LabelElement?.Value; set @@ -368,20 +371,20 @@ public string Label /// [FhirElement("display", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Brief description of the related artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { get => _DisplayElement?.Value; set @@ -396,20 +399,20 @@ public string Display /// [FhirElement("citation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown CitationElement + public Hl7.Fhir.Model.Markdown? CitationElement { get { return _CitationElement; } set { _CitationElement = value; OnPropertyChanged("CitationElement"); } } - private Hl7.Fhir.Model.Markdown _CitationElement; + private Hl7.Fhir.Model.Markdown? _CitationElement; /// /// Bibliographic citation for the artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Citation + public string? Citation { get => _CitationElement?.Value; set @@ -428,20 +431,20 @@ public string Citation [FhirElement("url", InSummary=true, Order=80)] [NotMapped(Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// Where the artifact can be accessed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -456,33 +459,33 @@ public string Url /// [FhirElement("document", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Attachment Document + public Hl7.Fhir.Model.Attachment? Document { get { return _Document; } set { _Document = value; OnPropertyChanged("Document"); } } - private Hl7.Fhir.Model.Attachment _Document; + private Hl7.Fhir.Model.Attachment? _Document; /// /// What artifact is being referenced. /// [FhirElement("resource", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical ResourceElement + public Hl7.Fhir.Model.Canonical? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.Canonical _ResourceElement; + private Hl7.Fhir.Model.Canonical? _ResourceElement; /// /// What artifact is being referenced /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { get => _ResourceElement?.Value; set @@ -502,13 +505,13 @@ public string Resource [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ResourceReference + public Hl7.Fhir.Model.ResourceReference? ResourceReference { get { return _ResourceReference; } set { _ResourceReference = value; OnPropertyChanged("ResourceReference"); } } - private Hl7.Fhir.Model.ResourceReference _ResourceReference; + private Hl7.Fhir.Model.ResourceReference? _ResourceReference; /// /// draft | active | retired | unknown. @@ -520,13 +523,13 @@ public Hl7.Fhir.Model.ResourceReference ResourceReference [DeclaredType(Type = typeof(Code))] [Binding("RelatedArtifactPublicationStatus")] [DataMember] - public Code PublicationStatusElement + public Code? PublicationStatusElement { get { return _PublicationStatusElement; } set { _PublicationStatusElement = value; OnPropertyChanged("PublicationStatusElement"); } } - private Code _PublicationStatusElement; + private Code? _PublicationStatusElement; /// /// draft | active | retired | unknown @@ -551,20 +554,20 @@ public Hl7.Fhir.Model.PublicationStatus? PublicationStatus /// [FhirElement("publicationDate", InSummary=true, Order=130, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Date PublicationDateElement + public Hl7.Fhir.Model.Date? PublicationDateElement { get { return _PublicationDateElement; } set { _PublicationDateElement = value; OnPropertyChanged("PublicationDateElement"); } } - private Hl7.Fhir.Model.Date _PublicationDateElement; + private Hl7.Fhir.Model.Date? _PublicationDateElement; /// /// Date of publication of the artifact being referred to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDate + public string? PublicationDate { get => _PublicationDateElement?.Value; set @@ -576,12 +579,8 @@ public string PublicationDate protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedArtifact; - - if (dest == null) - { + if(other is not RelatedArtifact dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); @@ -609,7 +608,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedArtifact otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; @@ -620,89 +619,90 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ResourceReference, otherT._ResourceReference)) return false; if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "citation": - value = CitationElement; - return CitationElement is not null; + value = _CitationElement; + return _CitationElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "document": - value = Document; - return Document is not null; + value = _Document; + return _Document is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "resourceReference": - value = ResourceReference; - return ResourceReference is not null; + value = _ResourceReference; + return _ResourceReference is not null; case "publicationStatus": - value = PublicationStatusElement; - return PublicationStatusElement is not null; + value = _PublicationStatusElement; + return _PublicationStatusElement is not null; case "publicationDate": - value = PublicationDateElement; - return PublicationDateElement is not null; + value = _PublicationDateElement; + return _PublicationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "citation": - CitationElement = (Hl7.Fhir.Model.Markdown)value; + CitationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "document": - Document = (Hl7.Fhir.Model.Attachment)value; + Document = (Hl7.Fhir.Model.Attachment?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.Canonical)value; + ResourceElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "resourceReference": - ResourceReference = (Hl7.Fhir.Model.ResourceReference)value; + ResourceReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "publicationStatus": - PublicationStatusElement = (Code)value; + PublicationStatusElement = (Code?)value; return this; case "publicationDate": - PublicationDateElement = (Hl7.Fhir.Model.Date)value; + PublicationDateElement = (Hl7.Fhir.Model.Date?)value; return this; default: return base.SetValue(key, value); @@ -713,17 +713,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (CitationElement is not null) yield return new KeyValuePair("citation",CitationElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Document is not null) yield return new KeyValuePair("document",Document); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (ResourceReference is not null) yield return new KeyValuePair("resourceReference",ResourceReference); - if (PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",PublicationStatusElement); - if (PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",PublicationDateElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_CitationElement is not null) yield return new KeyValuePair("citation",_CitationElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Document is not null) yield return new KeyValuePair("document",_Document); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_ResourceReference is not null) yield return new KeyValuePair("resourceReference",_ResourceReference); + if (_PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",_PublicationStatusElement); + if (_PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",_PublicationDateElement); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs index ee8d5a2f6..2b35ea2d1 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -165,20 +168,20 @@ public partial class MappingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identity", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentityElement + public Hl7.Fhir.Model.Id? IdentityElement { get { return _IdentityElement; } set { _IdentityElement = value; OnPropertyChanged("IdentityElement"); } } - private Hl7.Fhir.Model.Id _IdentityElement; + private Hl7.Fhir.Model.Id? _IdentityElement; /// /// Internal id when this mapping is used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identity + public string? Identity { get => _IdentityElement?.Value; set @@ -193,20 +196,20 @@ public string Identity /// [FhirElement("uri", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Identifies what this mapping refers to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { get => _UriElement?.Value; set @@ -221,20 +224,20 @@ public string Uri /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Names what this mapping refers to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -249,20 +252,20 @@ public string Name /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Versions, Issues, Scope limitations etc /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { get => _CommentElement?.Value; set @@ -274,12 +277,8 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as MappingComponent; - - if (dest == null) - { + if(other is not MappingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_IdentityElement is not null) dest.IdentityElement = (Hl7.Fhir.Model.Id)_IdentityElement.DeepCopyInternal(); @@ -300,51 +299,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identity": - value = IdentityElement; - return IdentityElement is not null; + value = _IdentityElement; + return _IdentityElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identity": - IdentityElement = (Hl7.Fhir.Model.Id)value; + IdentityElement = (Hl7.Fhir.Model.Id?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -355,10 +355,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentityElement is not null) yield return new KeyValuePair("identity",IdentityElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_IdentityElement is not null) yield return new KeyValuePair("identity",_IdentityElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -387,13 +387,13 @@ public partial class ContextComponent : Hl7.Fhir.Model.BackboneElement [Binding("ExtensionContextType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// fhirpath | element | extension @@ -416,20 +416,20 @@ public Hl7.Fhir.Model.StructureDefinition.ExtensionContextType? Type [FhirElement("expression", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Where the extension can be used in instances /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { get => _ExpressionElement?.Value; set @@ -441,12 +441,8 @@ public string Expression protected internal override void CopyToInternal(Base other) { - var dest = other as ContextComponent; - - if (dest == null) - { + if(other is not ContextComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); @@ -465,37 +461,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -506,8 +503,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -540,16 +537,12 @@ public List Element set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; protected internal override void CopyToInternal(Base other) { - var dest = other as SnapshotComponent; - - if (dest == null) - { + if(other is not SnapshotComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); @@ -567,30 +560,31 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SnapshotComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Element, otherT._Element)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "element": - Element = (List)value; + Element = (List?)value!; return this; default: return base.SetValue(key, value); @@ -601,7 +595,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); } } @@ -634,16 +628,12 @@ public List Element set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; protected internal override void CopyToInternal(Base other) { - var dest = other as DifferentialComponent; - - if (dest == null) - { + if(other is not DifferentialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); @@ -661,30 +651,31 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DifferentialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(_Element, otherT._Element)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "element": - Element = (List)value; + Element = (List?)value!; return this; default: return base.SetValue(key, value); @@ -695,7 +686,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); } } @@ -706,20 +697,20 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this structure definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -741,27 +732,27 @@ public List Identifier set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the structure definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -781,13 +772,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this structure definition (computer friendly). @@ -795,20 +786,20 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this structure definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -823,20 +814,20 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this structure definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { get => _TitleElement?.Value; set @@ -854,13 +845,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -882,13 +873,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -910,20 +901,20 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { get => _DateElement?.Value; set @@ -938,20 +929,20 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { get => _PublisherElement?.Value; set @@ -973,27 +964,27 @@ public List Contact set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the structure definition. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -1015,7 +1006,7 @@ public List UseContext set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for structure definition (if applicable). @@ -1030,27 +1021,27 @@ public List Jurisdiction set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this structure definition is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this structure definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { get => _PurposeElement?.Value; set @@ -1065,20 +1056,20 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { get => _CopyrightElement?.Value; set @@ -1096,20 +1087,20 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { get => _CopyrightLabelElement?.Value; set @@ -1132,7 +1123,7 @@ public List Keyword set { _Keyword = value; OnPropertyChanged("Keyword"); } } - private List _Keyword; + private List? _Keyword; /// /// FHIR Version this StructureDefinition targets. @@ -1141,13 +1132,13 @@ public List Keyword [DeclaredType(Type = typeof(Code))] [Binding("FHIRVersion")] [DataMember] - public Code FhirVersionElement + public Code? FhirVersionElement { get { return _FhirVersionElement; } set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private Code _FhirVersionElement; + private Code? _FhirVersionElement; /// /// FHIR Version this StructureDefinition targets @@ -1176,7 +1167,7 @@ public List Mapping set { _Mapping = value; OnPropertyChanged("Mapping"); } } - private List _Mapping; + private List? _Mapping; /// /// primitive-type | complex-type | resource | logical. @@ -1186,13 +1177,13 @@ public List Mapping [Binding("StructureDefinitionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// primitive-type | complex-type | resource | logical @@ -1215,13 +1206,13 @@ public Hl7.Fhir.Model.StructureDefinition.StructureDefinitionKind? Kind [FhirElement("abstract", InSummary=true, Order=300)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AbstractElement + public Hl7.Fhir.Model.FhirBoolean? AbstractElement { get { return _AbstractElement; } set { _AbstractElement = value; OnPropertyChanged("AbstractElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AbstractElement; + private Hl7.Fhir.Model.FhirBoolean? _AbstractElement; /// /// Whether the structure is abstract @@ -1250,7 +1241,7 @@ public List Context set { _Context = value; OnPropertyChanged("Context"); } } - private List _Context; + private List? _Context; /// /// FHIRPath invariants - when the extension can be used. @@ -1264,20 +1255,20 @@ public List ContextInvariantElement set { _ContextInvariantElement = value; OnPropertyChanged("ContextInvariantElement"); } } - private List _ContextInvariantElement; + private List? _ContextInvariantElement; /// /// FHIRPath invariants - when the extension can be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ContextInvariant + public IEnumerable? ContextInvariant { - get { return ContextInvariantElement != null ? ContextInvariantElement.Select(elem => elem.Value) : null; } + get => _ContextInvariantElement?.Select(elem => elem.Value); set { if (value == null) - ContextInvariantElement = null; + ContextInvariantElement = null!; else ContextInvariantElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ContextInvariant"); @@ -1291,20 +1282,20 @@ public IEnumerable ContextInvariant [Binding("FHIRTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri TypeElement + public Hl7.Fhir.Model.FhirUri? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirUri _TypeElement; + private Hl7.Fhir.Model.FhirUri? _TypeElement; /// /// Type defined or constrained by this structure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { get => _TypeElement?.Value; set @@ -1319,20 +1310,20 @@ public string Type /// [FhirElement("baseDefinition", InSummary=true, Order=340)] [DataMember] - public Hl7.Fhir.Model.Canonical BaseDefinitionElement + public Hl7.Fhir.Model.Canonical? BaseDefinitionElement { get { return _BaseDefinitionElement; } set { _BaseDefinitionElement = value; OnPropertyChanged("BaseDefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _BaseDefinitionElement; + private Hl7.Fhir.Model.Canonical? _BaseDefinitionElement; /// /// Definition that this type is constrained/specialized from /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BaseDefinition + public string? BaseDefinition { get => _BaseDefinitionElement?.Value; set @@ -1349,13 +1340,13 @@ public string BaseDefinition [DeclaredType(Type = typeof(Code))] [Binding("TypeDerivationRule")] [DataMember] - public Code DerivationElement + public Code? DerivationElement { get { return _DerivationElement; } set { _DerivationElement = value; OnPropertyChanged("DerivationElement"); } } - private Code _DerivationElement; + private Code? _DerivationElement; /// /// specialization | constraint - How relates to base definition @@ -1377,37 +1368,33 @@ public Hl7.Fhir.Model.StructureDefinition.TypeDerivationRule? Derivation /// [FhirElement("snapshot", Order=360)] [DataMember] - public Hl7.Fhir.Model.StructureDefinition.SnapshotComponent Snapshot + public Hl7.Fhir.Model.StructureDefinition.SnapshotComponent? Snapshot { get { return _Snapshot; } set { _Snapshot = value; OnPropertyChanged("Snapshot"); } } - private Hl7.Fhir.Model.StructureDefinition.SnapshotComponent _Snapshot; + private Hl7.Fhir.Model.StructureDefinition.SnapshotComponent? _Snapshot; /// /// Differential view of the structure. /// [FhirElement("differential", Order=370)] [DataMember] - public Hl7.Fhir.Model.StructureDefinition.DifferentialComponent Differential + public Hl7.Fhir.Model.StructureDefinition.DifferentialComponent? Differential { get { return _Differential; } set { _Differential = value; OnPropertyChanged("Differential"); } } - private Hl7.Fhir.Model.StructureDefinition.DifferentialComponent _Differential; + private Hl7.Fhir.Model.StructureDefinition.DifferentialComponent? _Differential; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureDefinition; - - if (dest == null) - { + if(other is not StructureDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); @@ -1453,7 +1440,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1482,197 +1469,198 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DerivationElement, otherT._DerivationElement)) return false; if(!comparer.Equals(_Snapshot, otherT._Snapshot)) return false; if(!comparer.Equals(_Differential, otherT._Differential)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "keyword": - value = Keyword; - return Keyword?.Any() == true; + value = _Keyword; + return _Keyword?.Any() == true; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement is not null; + value = _FhirVersionElement; + return _FhirVersionElement is not null; case "mapping": - value = Mapping; - return Mapping?.Any() == true; + value = _Mapping; + return _Mapping?.Any() == true; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "abstract": - value = AbstractElement; - return AbstractElement is not null; + value = _AbstractElement; + return _AbstractElement is not null; case "context": - value = Context; - return Context?.Any() == true; + value = _Context; + return _Context?.Any() == true; case "contextInvariant": - value = ContextInvariantElement; - return ContextInvariantElement?.Any() == true; + value = _ContextInvariantElement; + return _ContextInvariantElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "baseDefinition": - value = BaseDefinitionElement; - return BaseDefinitionElement is not null; + value = _BaseDefinitionElement; + return _BaseDefinitionElement is not null; case "derivation": - value = DerivationElement; - return DerivationElement is not null; + value = _DerivationElement; + return _DerivationElement is not null; case "snapshot": - value = Snapshot; - return Snapshot is not null; + value = _Snapshot; + return _Snapshot is not null; case "differential": - value = Differential; - return Differential is not null; + value = _Differential; + return _Differential is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "keyword": - Keyword = (List)value; + Keyword = (List?)value!; return this; case "fhirVersion": - FhirVersionElement = (Code)value; + FhirVersionElement = (Code?)value; return this; case "mapping": - Mapping = (List)value; + Mapping = (List?)value!; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "abstract": - AbstractElement = (Hl7.Fhir.Model.FhirBoolean)value; + AbstractElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "context": - Context = (List)value; + Context = (List?)value!; return this; case "contextInvariant": - ContextInvariantElement = (List)value; + ContextInvariantElement = (List?)value!; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirUri)value; + TypeElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "baseDefinition": - BaseDefinitionElement = (Hl7.Fhir.Model.Canonical)value; + BaseDefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "derivation": - DerivationElement = (Code)value; + DerivationElement = (Code?)value; return this; case "snapshot": - Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent)value; + Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent?)value; return this; case "differential": - Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent)value; + Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent?)value; return this; default: return base.SetValue(key, value); @@ -1683,35 +1671,35 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (Keyword?.Any() == true) yield return new KeyValuePair("keyword",Keyword); - if (FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (Mapping?.Any() == true) yield return new KeyValuePair("mapping",Mapping); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (AbstractElement is not null) yield return new KeyValuePair("abstract",AbstractElement); - if (Context?.Any() == true) yield return new KeyValuePair("context",Context); - if (ContextInvariantElement?.Any() == true) yield return new KeyValuePair("contextInvariant",ContextInvariantElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (BaseDefinitionElement is not null) yield return new KeyValuePair("baseDefinition",BaseDefinitionElement); - if (DerivationElement is not null) yield return new KeyValuePair("derivation",DerivationElement); - if (Snapshot is not null) yield return new KeyValuePair("snapshot",Snapshot); - if (Differential is not null) yield return new KeyValuePair("differential",Differential); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_Keyword?.Any() == true) yield return new KeyValuePair("keyword",_Keyword); + if (_FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_Mapping?.Any() == true) yield return new KeyValuePair("mapping",_Mapping); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_AbstractElement is not null) yield return new KeyValuePair("abstract",_AbstractElement); + if (_Context?.Any() == true) yield return new KeyValuePair("context",_Context); + if (_ContextInvariantElement?.Any() == true) yield return new KeyValuePair("contextInvariant",_ContextInvariantElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_BaseDefinitionElement is not null) yield return new KeyValuePair("baseDefinition",_BaseDefinitionElement); + if (_DerivationElement is not null) yield return new KeyValuePair("derivation",_DerivationElement); + if (_Snapshot is not null) yield return new KeyValuePair("snapshot",_Snapshot); + if (_Differential is not null) yield return new KeyValuePair("differential",_Differential); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs index d0a7435cd..7a321bbcb 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,20 +83,20 @@ public partial class ComposeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("lockedDate", InSummary=true, Order=40, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Date LockedDateElement + public Hl7.Fhir.Model.Date? LockedDateElement { get { return _LockedDateElement; } set { _LockedDateElement = value; OnPropertyChanged("LockedDateElement"); } } - private Hl7.Fhir.Model.Date _LockedDateElement; + private Hl7.Fhir.Model.Date? _LockedDateElement; /// /// Fixed date for references with no specified version (transitive) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LockedDate + public string? LockedDate { get => _LockedDateElement?.Value; set @@ -108,13 +111,13 @@ public string LockedDate /// [FhirElement("inactive", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// Whether inactive codes are in the value set @@ -143,7 +146,7 @@ public List Include set { _Include = value; OnPropertyChanged("Include"); } } - private List _Include; + private List? _Include; /// /// Explicitly exclude codes from a code system or other value sets. @@ -157,7 +160,7 @@ public List Exclude set { _Exclude = value; OnPropertyChanged("Exclude"); } } - private List _Exclude; + private List? _Exclude; /// /// Property to return if client doesn't override. @@ -174,20 +177,20 @@ public List PropertyElement set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private List _PropertyElement; + private List? _PropertyElement; /// /// Property to return if client doesn't override /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Property + public IEnumerable? Property { - get { return PropertyElement != null ? PropertyElement.Select(elem => elem.Value) : null; } + get => _PropertyElement?.Select(elem => elem.Value); set { if (value == null) - PropertyElement = null; + PropertyElement = null!; else PropertyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Property"); @@ -196,12 +199,8 @@ public IEnumerable Property protected internal override void CopyToInternal(Base other) { - var dest = other as ComposeComponent; - - if (dest == null) - { + if(other is not ComposeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_LockedDateElement is not null) dest.LockedDateElement = (Hl7.Fhir.Model.Date)_LockedDateElement.DeepCopyInternal(); @@ -223,58 +222,59 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComposeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; if(!comparer.ListEquals(_Include, otherT._Include)) return false; if(!comparer.ListEquals(_Exclude, otherT._Exclude)) return false; if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lockedDate": - value = LockedDateElement; - return LockedDateElement is not null; + value = _LockedDateElement; + return _LockedDateElement is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; case "include": - value = Include; - return Include?.Any() == true; + value = _Include; + return _Include?.Any() == true; case "exclude": - value = Exclude; - return Exclude?.Any() == true; + value = _Exclude; + return _Exclude?.Any() == true; case "property": - value = PropertyElement; - return PropertyElement?.Any() == true; + value = _PropertyElement; + return _PropertyElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lockedDate": - LockedDateElement = (Hl7.Fhir.Model.Date)value; + LockedDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "include": - Include = (List)value; + Include = (List?)value!; return this; case "exclude": - Exclude = (List)value; + Exclude = (List?)value!; return this; case "property": - PropertyElement = (List)value; + PropertyElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -285,11 +285,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LockedDateElement is not null) yield return new KeyValuePair("lockedDate",LockedDateElement); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); - if (Include?.Any() == true) yield return new KeyValuePair("include",Include); - if (Exclude?.Any() == true) yield return new KeyValuePair("exclude",Exclude); - if (PropertyElement?.Any() == true) yield return new KeyValuePair("property",PropertyElement); + if (_LockedDateElement is not null) yield return new KeyValuePair("lockedDate",_LockedDateElement); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); + if (_Include?.Any() == true) yield return new KeyValuePair("include",_Include); + if (_Exclude?.Any() == true) yield return new KeyValuePair("exclude",_Exclude); + if (_PropertyElement?.Any() == true) yield return new KeyValuePair("property",_PropertyElement); } } @@ -315,20 +315,20 @@ public partial class ConceptSetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("system", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// The system the codes come from /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { get => _SystemElement?.Value; set @@ -343,20 +343,20 @@ public string System /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Specific version of the code system referred to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -378,7 +378,7 @@ public List Concept set { _Concept = value; OnPropertyChanged("Concept"); } } - private List _Concept; + private List? _Concept; /// /// Select codes/concepts by their properties (including relationships). @@ -392,7 +392,7 @@ public List Filter set { _Filter = value; OnPropertyChanged("Filter"); } } - private List _Filter; + private List? _Filter; /// /// Select the contents included in this value set. @@ -406,20 +406,20 @@ public List ValueSetElement set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private List _ValueSetElement; + private List? _ValueSetElement; /// /// Select the contents included in this value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ValueSet + public IEnumerable? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Select(elem => elem.Value) : null; } + get => _ValueSetElement?.Select(elem => elem.Value); set { if (value == null) - ValueSetElement = null; + ValueSetElement = null!; else ValueSetElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("ValueSet"); @@ -434,20 +434,20 @@ public IEnumerable ValueSet /// [FhirElement("copyright", Order=90, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightElement + public Hl7.Fhir.Model.FhirString? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightElement; + private Hl7.Fhir.Model.FhirString? _CopyrightElement; /// /// A copyright statement for the specific code system included in the value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { get => _CopyrightElement?.Value; set @@ -459,12 +459,8 @@ public string Copyright protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptSetComponent; - - if (dest == null) - { + if(other is not ConceptSetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); @@ -487,65 +483,66 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "concept": - value = Concept; - return Concept?.Any() == true; + value = _Concept; + return _Concept?.Any() == true; case "filter": - value = Filter; - return Filter?.Any() == true; + value = _Filter; + return _Filter?.Any() == true; case "valueSet": - value = ValueSetElement; - return ValueSetElement?.Any() == true; + value = _ValueSetElement; + return _ValueSetElement?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "concept": - Concept = (List)value; + Concept = (List?)value!; return this; case "filter": - Filter = (List)value; + Filter = (List?)value!; return this; case "valueSet": - ValueSetElement = (List)value; + ValueSetElement = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -556,12 +553,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Concept?.Any() == true) yield return new KeyValuePair("concept",Concept); - if (Filter?.Any() == true) yield return new KeyValuePair("filter",Filter); - if (ValueSetElement?.Any() == true) yield return new KeyValuePair("valueSet",ValueSetElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Concept?.Any() == true) yield return new KeyValuePair("concept",_Concept); + if (_Filter?.Any() == true) yield return new KeyValuePair("filter",_Filter); + if (_ValueSetElement?.Any() == true) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -589,20 +586,20 @@ public partial class ConceptReferenceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code or expression from system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -617,20 +614,20 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Text to display for this code for this value set in this valueset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { get => _DisplayElement?.Value; set @@ -652,16 +649,12 @@ public List Designation set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptReferenceComponent; - - if (dest == null) - { + if(other is not ConceptReferenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -681,44 +674,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -729,9 +723,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); } } @@ -759,20 +753,20 @@ public partial class DesignationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("language", Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Human language of the designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { get => _LanguageElement?.Value; set @@ -788,13 +782,13 @@ public string Language [FhirElement("use", Order=50)] [Binding("ConceptDesignationUse")] [DataMember] - public Hl7.Fhir.Model.Coding Use + public Hl7.Fhir.Model.Coding? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.Coding _Use; + private Hl7.Fhir.Model.Coding? _Use; /// /// Additional ways how this designation would be used. @@ -812,7 +806,7 @@ public List AdditionalUse set { _AdditionalUse = value; OnPropertyChanged("AdditionalUse"); } } - private List _AdditionalUse; + private List? _AdditionalUse; /// /// The text value for this designation. @@ -820,20 +814,20 @@ public List AdditionalUse [FhirElement("value", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The text value for this designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { get => _ValueElement?.Value; set @@ -845,12 +839,8 @@ public string Value protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationComponent; - - if (dest == null) - { + if(other is not DesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); @@ -871,51 +861,52 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.ListEquals(_AdditionalUse, otherT._AdditionalUse)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; case "additionalUse": - value = AdditionalUse; - return AdditionalUse?.Any() == true; + value = _AdditionalUse; + return _AdditionalUse?.Any() == true; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - Use = (Hl7.Fhir.Model.Coding)value; + Use = (Hl7.Fhir.Model.Coding?)value; return this; case "additionalUse": - AdditionalUse = (List)value; + AdditionalUse = (List?)value!; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -926,10 +917,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (Use is not null) yield return new KeyValuePair("use",Use); - if (AdditionalUse?.Any() == true) yield return new KeyValuePair("additionalUse",AdditionalUse); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_Use is not null) yield return new KeyValuePair("use",_Use); + if (_AdditionalUse?.Any() == true) yield return new KeyValuePair("additionalUse",_AdditionalUse); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -957,20 +948,20 @@ public partial class FilterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("property", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code PropertyElement + public Hl7.Fhir.Model.Code? PropertyElement { get { return _PropertyElement; } set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private Hl7.Fhir.Model.Code _PropertyElement; + private Hl7.Fhir.Model.Code? _PropertyElement; /// /// A property/filter defined by the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Property + public string? Property { get => _PropertyElement?.Value; set @@ -988,13 +979,13 @@ public string Property [Binding("FilterOperator")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OpElement + public Code? OpElement { get { return _OpElement; } set { _OpElement = value; OnPropertyChanged("OpElement"); } } - private Code _OpElement; + private Code? _OpElement; /// /// = | is-a | descendent-of | is-not-a | regex | in | not-in | generalizes | child-of | descendent-leaf | exists @@ -1017,20 +1008,20 @@ public Hl7.Fhir.Model.FilterOperator? Op [FhirElement("value", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Code from the system, or regex criteria, or boolean value for exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { get => _ValueElement?.Value; set @@ -1042,12 +1033,8 @@ public string Value protected internal override void CopyToInternal(Base other) { - var dest = other as FilterComponent; - - if (dest == null) - { + if(other is not FilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_PropertyElement is not null) dest.PropertyElement = (Hl7.Fhir.Model.Code)_PropertyElement.DeepCopyInternal(); @@ -1067,44 +1054,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; if(!comparer.Equals(_OpElement, otherT._OpElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "property": - value = PropertyElement; - return PropertyElement is not null; + value = _PropertyElement; + return _PropertyElement is not null; case "op": - value = OpElement; - return OpElement is not null; + value = _OpElement; + return _OpElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "property": - PropertyElement = (Hl7.Fhir.Model.Code)value; + PropertyElement = (Hl7.Fhir.Model.Code?)value; return this; case "op": - OpElement = (Code)value; + OpElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1115,9 +1103,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PropertyElement is not null) yield return new KeyValuePair("property",PropertyElement); - if (OpElement is not null) yield return new KeyValuePair("op",OpElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_PropertyElement is not null) yield return new KeyValuePair("property",_PropertyElement); + if (_OpElement is not null) yield return new KeyValuePair("op",_OpElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -1145,20 +1133,20 @@ public partial class ExpansionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri IdentifierElement + public Hl7.Fhir.Model.FhirUri? IdentifierElement { get { return _IdentifierElement; } set { _IdentifierElement = value; OnPropertyChanged("IdentifierElement"); } } - private Hl7.Fhir.Model.FhirUri _IdentifierElement; + private Hl7.Fhir.Model.FhirUri? _IdentifierElement; /// /// Identifies the value set expansion (business identifier) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identifier + public string? Identifier { get => _IdentifierElement?.Value; set @@ -1176,20 +1164,20 @@ public string Identifier /// [FhirElement("next", Order=50, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirUri NextElement + public Hl7.Fhir.Model.FhirUri? NextElement { get { return _NextElement; } set { _NextElement = value; OnPropertyChanged("NextElement"); } } - private Hl7.Fhir.Model.FhirUri _NextElement; + private Hl7.Fhir.Model.FhirUri? _NextElement; /// /// Opaque urls for paging through expansion results /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Next + public string? Next { get => _NextElement?.Value; set @@ -1205,20 +1193,20 @@ public string Next [FhirElement("timestamp", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimestampElement + public Hl7.Fhir.Model.FhirDateTime? TimestampElement { get { return _TimestampElement; } set { _TimestampElement = value; OnPropertyChanged("TimestampElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimestampElement; + private Hl7.Fhir.Model.FhirDateTime? _TimestampElement; /// /// Time ValueSet expansion happened /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Timestamp + public string? Timestamp { get => _TimestampElement?.Value; set @@ -1233,13 +1221,13 @@ public string Timestamp /// [FhirElement("total", Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer TotalElement + public Hl7.Fhir.Model.Integer? TotalElement { get { return _TotalElement; } set { _TotalElement = value; OnPropertyChanged("TotalElement"); } } - private Hl7.Fhir.Model.Integer _TotalElement; + private Hl7.Fhir.Model.Integer? _TotalElement; /// /// Total number of codes in the expansion @@ -1261,13 +1249,13 @@ public int? Total /// [FhirElement("offset", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer OffsetElement + public Hl7.Fhir.Model.Integer? OffsetElement { get { return _OffsetElement; } set { _OffsetElement = value; OnPropertyChanged("OffsetElement"); } } - private Hl7.Fhir.Model.Integer _OffsetElement; + private Hl7.Fhir.Model.Integer? _OffsetElement; /// /// Offset at which this resource starts @@ -1296,7 +1284,7 @@ public List Parameter set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Additional information supplied about each concept. @@ -1313,7 +1301,7 @@ public List Property set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Codes in the value set. @@ -1327,16 +1315,12 @@ public List Contains set { _Contains = value; OnPropertyChanged("Contains"); } } - private List _Contains; + private List? _Contains; protected internal override void CopyToInternal(Base other) { - var dest = other as ExpansionComponent; - - if (dest == null) - { + if(other is not ExpansionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_IdentifierElement is not null) dest.IdentifierElement = (Hl7.Fhir.Model.FhirUri)_IdentifierElement.DeepCopyInternal(); @@ -1361,7 +1345,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; if(!comparer.Equals(_NextElement, otherT._NextElement)) return false; if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; @@ -1369,71 +1353,72 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = IdentifierElement; - return IdentifierElement is not null; + value = _IdentifierElement; + return _IdentifierElement is not null; case "next": - value = NextElement; - return NextElement is not null; + value = _NextElement; + return _NextElement is not null; case "timestamp": - value = TimestampElement; - return TimestampElement is not null; + value = _TimestampElement; + return _TimestampElement is not null; case "total": - value = TotalElement; - return TotalElement is not null; + value = _TotalElement; + return _TotalElement is not null; case "offset": - value = OffsetElement; - return OffsetElement is not null; + value = _OffsetElement; + return _OffsetElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "contains": - value = Contains; - return Contains?.Any() == true; + value = _Contains; + return _Contains?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - IdentifierElement = (Hl7.Fhir.Model.FhirUri)value; + IdentifierElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "next": - NextElement = (Hl7.Fhir.Model.FhirUri)value; + NextElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "timestamp": - TimestampElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimestampElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "total": - TotalElement = (Hl7.Fhir.Model.Integer)value; + TotalElement = (Hl7.Fhir.Model.Integer?)value; return this; case "offset": - OffsetElement = (Hl7.Fhir.Model.Integer)value; + OffsetElement = (Hl7.Fhir.Model.Integer?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "contains": - Contains = (List)value; + Contains = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1444,14 +1429,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentifierElement is not null) yield return new KeyValuePair("identifier",IdentifierElement); - if (NextElement is not null) yield return new KeyValuePair("next",NextElement); - if (TimestampElement is not null) yield return new KeyValuePair("timestamp",TimestampElement); - if (TotalElement is not null) yield return new KeyValuePair("total",TotalElement); - if (OffsetElement is not null) yield return new KeyValuePair("offset",OffsetElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Contains?.Any() == true) yield return new KeyValuePair("contains",Contains); + if (_IdentifierElement is not null) yield return new KeyValuePair("identifier",_IdentifierElement); + if (_NextElement is not null) yield return new KeyValuePair("next",_NextElement); + if (_TimestampElement is not null) yield return new KeyValuePair("timestamp",_TimestampElement); + if (_TotalElement is not null) yield return new KeyValuePair("total",_TotalElement); + if (_OffsetElement is not null) yield return new KeyValuePair("offset",_OffsetElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Contains?.Any() == true) yield return new KeyValuePair("contains",_Contains); } } @@ -1479,20 +1464,20 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name as assigned by the client or server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -1509,22 +1494,18 @@ public string Name [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); @@ -1543,37 +1524,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1584,8 +1566,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1612,20 +1594,20 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies the property on the concepts, and when referred to in operations /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -1640,20 +1622,20 @@ public string Code /// [FhirElement("uri", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Formal identifier for the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { get => _UriElement?.Value; set @@ -1665,12 +1647,8 @@ public string Uri protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -1689,37 +1667,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -1730,8 +1709,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); } } @@ -1757,20 +1736,20 @@ public partial class ContainsComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("system", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// System value for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { get => _SystemElement?.Value; set @@ -1785,13 +1764,13 @@ public string System /// [FhirElement("abstract", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AbstractElement + public Hl7.Fhir.Model.FhirBoolean? AbstractElement { get { return _AbstractElement; } set { _AbstractElement = value; OnPropertyChanged("AbstractElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AbstractElement; + private Hl7.Fhir.Model.FhirBoolean? _AbstractElement; /// /// If user cannot select this entry @@ -1813,13 +1792,13 @@ public bool? Abstract /// [FhirElement("inactive", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// If concept is inactive in the code system @@ -1841,20 +1820,20 @@ public bool? Inactive /// [FhirElement("version", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version in which this code/display is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -1869,20 +1848,20 @@ public string Version /// [FhirElement("code", Order=80)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code - if blank, this is not a selectable code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -1897,20 +1876,20 @@ public string Code /// [FhirElement("display", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// User display for the concept /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { get => _DisplayElement?.Value; set @@ -1932,7 +1911,7 @@ public List Designation set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; /// /// Property value for the concept. @@ -1949,7 +1928,7 @@ public List Property set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Codes contained under this entry. @@ -1963,16 +1942,12 @@ public List Contains set { _Contains = value; OnPropertyChanged("Contains"); } } - private List _Contains; + private List? _Contains; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainsComponent; - - if (dest == null) - { + if(other is not ContainsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); @@ -1998,7 +1973,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_AbstractElement, otherT._AbstractElement)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; @@ -2007,77 +1982,78 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "abstract": - value = AbstractElement; - return AbstractElement is not null; + value = _AbstractElement; + return _AbstractElement is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "contains": - value = Contains; - return Contains?.Any() == true; + value = _Contains; + return _Contains?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "abstract": - AbstractElement = (Hl7.Fhir.Model.FhirBoolean)value; + AbstractElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "contains": - Contains = (List)value; + Contains = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2088,15 +2064,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (AbstractElement is not null) yield return new KeyValuePair("abstract",AbstractElement); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Contains?.Any() == true) yield return new KeyValuePair("contains",Contains); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_AbstractElement is not null) yield return new KeyValuePair("abstract",_AbstractElement); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Contains?.Any() == true) yield return new KeyValuePair("contains",_Contains); } } @@ -2123,20 +2099,20 @@ public partial class ConceptPropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Reference to ValueSet.expansion.property.code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -2154,13 +2130,13 @@ public string Code [AllowedTypes(typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// SubProperty value for the concept. @@ -2177,16 +2153,12 @@ public List SubProperty set { _SubProperty = value; OnPropertyChanged("SubProperty"); } } - private List _SubProperty; + private List? _SubProperty; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptPropertyComponent; - - if (dest == null) - { + if(other is not ConceptPropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -2206,44 +2178,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_SubProperty, otherT._SubProperty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "subProperty": - value = SubProperty; - return SubProperty?.Any() == true; + value = _SubProperty; + return _SubProperty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "subProperty": - SubProperty = (List)value; + SubProperty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2254,9 +2227,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (SubProperty?.Any() == true) yield return new KeyValuePair("subProperty",SubProperty); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_SubProperty?.Any() == true) yield return new KeyValuePair("subProperty",_SubProperty); } } @@ -2286,20 +2259,20 @@ public partial class ConceptSubPropertyComponent : Hl7.Fhir.Model.BackboneElemen [FhirElement("code", Order=40, Since=FhirRelease.R5)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Reference to ValueSet.expansion.property.code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { get => _CodeElement?.Value; set @@ -2320,22 +2293,18 @@ public string Code [AllowedTypes(typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptSubPropertyComponent; - - if (dest == null) - { + if(other is not ConceptSubPropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); @@ -2354,37 +2323,38 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptSubPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2395,8 +2365,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -2419,20 +2389,20 @@ public partial class ScopeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("inclusionCriteria", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString InclusionCriteriaElement + public Hl7.Fhir.Model.FhirString? InclusionCriteriaElement { get { return _InclusionCriteriaElement; } set { _InclusionCriteriaElement = value; OnPropertyChanged("InclusionCriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _InclusionCriteriaElement; + private Hl7.Fhir.Model.FhirString? _InclusionCriteriaElement; /// /// Criteria describing which concepts or codes should be included and why /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InclusionCriteria + public string? InclusionCriteria { get => _InclusionCriteriaElement?.Value; set @@ -2451,20 +2421,20 @@ public string InclusionCriteria [FhirElement("focus", Order=40)] [NotMapped(Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString FocusElement + public Hl7.Fhir.Model.FhirString? FocusElement { get { return _FocusElement; } set { _FocusElement = value; OnPropertyChanged("FocusElement"); } } - private Hl7.Fhir.Model.FhirString _FocusElement; + private Hl7.Fhir.Model.FhirString? _FocusElement; /// /// General focus of the Value Set as it relates to the intended semantic space /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Focus + public string? Focus { get => _FocusElement?.Value; set @@ -2479,20 +2449,20 @@ public string Focus /// [FhirElement("exclusionCriteria", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ExclusionCriteriaElement + public Hl7.Fhir.Model.FhirString? ExclusionCriteriaElement { get { return _ExclusionCriteriaElement; } set { _ExclusionCriteriaElement = value; OnPropertyChanged("ExclusionCriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _ExclusionCriteriaElement; + private Hl7.Fhir.Model.FhirString? _ExclusionCriteriaElement; /// /// Criteria describing which concepts or codes should be excluded and why /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExclusionCriteria + public string? ExclusionCriteria { get => _ExclusionCriteriaElement?.Value; set @@ -2504,12 +2474,8 @@ public string ExclusionCriteria protected internal override void CopyToInternal(Base other) { - var dest = other as ScopeComponent; - - if (dest == null) - { + if(other is not ScopeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_InclusionCriteriaElement is not null) dest.InclusionCriteriaElement = (Hl7.Fhir.Model.FhirString)_InclusionCriteriaElement.DeepCopyInternal(); @@ -2529,44 +2495,45 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ScopeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_InclusionCriteriaElement, otherT._InclusionCriteriaElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InclusionCriteriaElement, otherT._InclusionCriteriaElement)) return false; if(!comparer.Equals(_FocusElement, otherT._FocusElement)) return false; if(!comparer.Equals(_ExclusionCriteriaElement, otherT._ExclusionCriteriaElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "inclusionCriteria": - value = InclusionCriteriaElement; - return InclusionCriteriaElement is not null; + value = _InclusionCriteriaElement; + return _InclusionCriteriaElement is not null; case "focus": - value = FocusElement; - return FocusElement is not null; + value = _FocusElement; + return _FocusElement is not null; case "exclusionCriteria": - value = ExclusionCriteriaElement; - return ExclusionCriteriaElement is not null; + value = _ExclusionCriteriaElement; + return _ExclusionCriteriaElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "inclusionCriteria": - InclusionCriteriaElement = (Hl7.Fhir.Model.FhirString)value; + InclusionCriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - FocusElement = (Hl7.Fhir.Model.FhirString)value; + FocusElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "exclusionCriteria": - ExclusionCriteriaElement = (Hl7.Fhir.Model.FhirString)value; + ExclusionCriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2577,9 +2544,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (InclusionCriteriaElement is not null) yield return new KeyValuePair("inclusionCriteria",InclusionCriteriaElement); - if (FocusElement is not null) yield return new KeyValuePair("focus",FocusElement); - if (ExclusionCriteriaElement is not null) yield return new KeyValuePair("exclusionCriteria",ExclusionCriteriaElement); + if (_InclusionCriteriaElement is not null) yield return new KeyValuePair("inclusionCriteria",_InclusionCriteriaElement); + if (_FocusElement is not null) yield return new KeyValuePair("focus",_FocusElement); + if (_ExclusionCriteriaElement is not null) yield return new KeyValuePair("exclusionCriteria",_ExclusionCriteriaElement); } } @@ -2589,20 +2556,20 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this value set, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { get => _UrlElement?.Value; set @@ -2624,27 +2591,27 @@ public List Identifier set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the value set. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { get => _VersionElement?.Value; set @@ -2664,33 +2631,33 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this value set (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this value set (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { get => _NameElement?.Value; set @@ -2705,20 +2672,20 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this value set (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { get => _TitleElement?.Value; set @@ -2736,13 +2703,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2764,13 +2731,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2792,20 +2759,20 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { get => _DateElement?.Value; set @@ -2820,20 +2787,20 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { get => _PublisherElement?.Value; set @@ -2855,27 +2822,27 @@ public List Contact set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the value set. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { get => _DescriptionElement?.Value; set @@ -2897,7 +2864,7 @@ public List UseContext set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for value set (if applicable). @@ -2912,20 +2879,20 @@ public List Jurisdiction set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Indicates whether or not any change to the content logical definition may occur. /// [FhirElement("immutable", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ImmutableElement + public Hl7.Fhir.Model.FhirBoolean? ImmutableElement { get { return _ImmutableElement; } set { _ImmutableElement = value; OnPropertyChanged("ImmutableElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ImmutableElement; + private Hl7.Fhir.Model.FhirBoolean? _ImmutableElement; /// /// Indicates whether or not any change to the content logical definition may occur @@ -2947,20 +2914,20 @@ public bool? Immutable /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this value set is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { get => _PurposeElement?.Value; set @@ -2975,20 +2942,20 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { get => _CopyrightElement?.Value; set @@ -3006,20 +2973,20 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=260, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { get => _CopyrightLabelElement?.Value; set @@ -3037,20 +3004,20 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=270, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the ValueSet was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { get => _ApprovalDateElement?.Value; set @@ -3068,20 +3035,20 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=280, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the ValueSet was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { get => _LastReviewDateElement?.Value; set @@ -3099,13 +3066,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -3123,7 +3090,7 @@ public List Topic set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the ValueSet. @@ -3140,7 +3107,7 @@ public List Author set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the ValueSet. @@ -3157,7 +3124,7 @@ public List Editor set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the ValueSet. @@ -3174,7 +3141,7 @@ public List Reviewer set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the ValueSet. @@ -3191,7 +3158,7 @@ public List Endorser set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -3208,33 +3175,33 @@ public List RelatedArtifact set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Content logical definition of the value set (CLD). /// [FhirElement("compose", Order=360)] [DataMember] - public Hl7.Fhir.Model.ValueSet.ComposeComponent Compose + public Hl7.Fhir.Model.ValueSet.ComposeComponent? Compose { get { return _Compose; } set { _Compose = value; OnPropertyChanged("Compose"); } } - private Hl7.Fhir.Model.ValueSet.ComposeComponent _Compose; + private Hl7.Fhir.Model.ValueSet.ComposeComponent? _Compose; /// /// Used when the value set is "expanded". /// [FhirElement("expansion", Order=370)] [DataMember] - public Hl7.Fhir.Model.ValueSet.ExpansionComponent Expansion + public Hl7.Fhir.Model.ValueSet.ExpansionComponent? Expansion { get { return _Expansion; } set { _Expansion = value; OnPropertyChanged("Expansion"); } } - private Hl7.Fhir.Model.ValueSet.ExpansionComponent _Expansion; + private Hl7.Fhir.Model.ValueSet.ExpansionComponent? _Expansion; /// /// Description of the semantic space the Value Set Expansion is intended to cover and should further clarify the text in ValueSet.description. @@ -3244,24 +3211,20 @@ public Hl7.Fhir.Model.ValueSet.ExpansionComponent Expansion /// [FhirElement("scope", Order=380, Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.ValueSet.ScopeComponent Scope + public Hl7.Fhir.Model.ValueSet.ScopeComponent? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.ValueSet.ScopeComponent _Scope; + private Hl7.Fhir.Model.ValueSet.ScopeComponent? _Scope; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ValueSet; - - if (dest == null) - { + if(other is not ValueSet dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); @@ -3308,7 +3271,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValueSet otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -3338,203 +3301,204 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Compose, otherT._Compose)) return false; if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; if(!comparer.Equals(_Scope, otherT._Scope)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "immutable": - value = ImmutableElement; - return ImmutableElement is not null; + value = _ImmutableElement; + return _ImmutableElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "compose": - value = Compose; - return Compose is not null; + value = _Compose; + return _Compose is not null; case "expansion": - value = Expansion; - return Expansion is not null; + value = _Expansion; + return _Expansion is not null; case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "immutable": - ImmutableElement = (Hl7.Fhir.Model.FhirBoolean)value; + ImmutableElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "compose": - Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent)value; + Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent?)value; return this; case "expansion": - Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent)value; + Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent?)value; return this; case "scope": - Scope = (Hl7.Fhir.Model.ValueSet.ScopeComponent)value; + Scope = (Hl7.Fhir.Model.ValueSet.ScopeComponent?)value; return this; default: return base.SetValue(key, value); @@ -3545,36 +3509,36 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (ImmutableElement is not null) yield return new KeyValuePair("immutable",ImmutableElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Compose is not null) yield return new KeyValuePair("compose",Compose); - if (Expansion is not null) yield return new KeyValuePair("expansion",Expansion); - if (Scope is not null) yield return new KeyValuePair("scope",Scope); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_ImmutableElement is not null) yield return new KeyValuePair("immutable",_ImmutableElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Compose is not null) yield return new KeyValuePair("compose",_Compose); + if (_Expansion is not null) yield return new KeyValuePair("expansion",_Expansion); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Account.cs b/src/Hl7.Fhir.STU3/Model/Generated/Account.cs index 65e281000..5536a4cdc 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Account.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,26 +116,26 @@ public partial class CoverageComponent : Hl7.Fhir.Model.BackboneElement [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// The priority of the coverage in the context of this account. /// [FhirElement("priority", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PriorityElement + public Hl7.Fhir.Model.PositiveInt? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Hl7.Fhir.Model.PositiveInt _PriorityElement; + private Hl7.Fhir.Model.PositiveInt? _PriorityElement; /// /// The priority of the coverage in the context of this account @@ -141,29 +144,22 @@ public Hl7.Fhir.Model.PositiveInt PriorityElement [IgnoreDataMember] public int? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Hl7.Fhir.Model.PositiveInt(value); + PriorityElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Priority"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageComponent; - - if (dest == null) - { + if(other is not CoverageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)PriorityElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)_PriorityElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -175,41 +171,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageComponent; - if(otherT == null) return false; + if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - PriorityElement = (Hl7.Fhir.Model.PositiveInt)value; + PriorityElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -220,8 +216,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); } } @@ -250,26 +246,26 @@ public partial class GuarantorComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Credit or other hold applied. /// [FhirElement("onHold", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OnHoldElement + public Hl7.Fhir.Model.FhirBoolean? OnHoldElement { get { return _OnHoldElement; } set { _OnHoldElement = value; OnPropertyChanged("OnHoldElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OnHoldElement; + private Hl7.Fhir.Model.FhirBoolean? _OnHoldElement; /// /// Credit or other hold applied @@ -278,13 +274,10 @@ public Hl7.Fhir.Model.FhirBoolean OnHoldElement [IgnoreDataMember] public bool? OnHold { - get { return OnHoldElement != null ? OnHoldElement.Value : null; } + get => _OnHoldElement?.Value; set { - if (value == null) - OnHoldElement = null; - else - OnHoldElement = new Hl7.Fhir.Model.FhirBoolean(value); + OnHoldElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("OnHold"); } } @@ -294,27 +287,23 @@ public bool? OnHold /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as GuarantorComponent; - - if (dest == null) - { + if(other is not GuarantorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(OnHoldElement != null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)OnHoldElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_OnHoldElement is not null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)_OnHoldElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -326,48 +315,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuarantorComponent; - if(otherT == null) return false; + if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.Equals(OnHoldElement, otherT.OnHoldElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "onHold": - value = OnHoldElement; - return OnHoldElement is not null; + value = _OnHoldElement; + return _OnHoldElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onHold": - OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)value; + OnHoldElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -378,9 +367,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Party is not null) yield return new KeyValuePair("party",Party); - if (OnHoldElement is not null) yield return new KeyValuePair("onHold",OnHoldElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_OnHoldElement is not null) yield return new KeyValuePair("onHold",_OnHoldElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -393,11 +382,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -406,13 +395,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("AccountStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -421,13 +410,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Account.AccountStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -438,41 +424,38 @@ public Hl7.Fhir.Model.Account.AccountStatus? Status [FhirElement("type", InSummary=true, Order=110, FiveWs="class")] [Binding("AccountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Human-readable label. /// [FhirElement("name", InSummary=true, Order=120, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -484,52 +467,52 @@ public string Name [CLSCompliant(false)] [References("Patient","Device","Practitioner","Location","HealthcareService","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Transaction window. /// [FhirElement("period", InSummary=true, Order=140, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Time window that transactions may be posted to this account. /// [FhirElement("active", InSummary=true, Order=150, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.Period Active + public Hl7.Fhir.Model.Period? Active { get { return _Active; } set { _Active = value; OnPropertyChanged("Active"); } } - private Hl7.Fhir.Model.Period _Active; + private Hl7.Fhir.Model.Period? _Active; /// /// How much is in account?. /// [FhirElement("balance", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Balance + public Hl7.Fhir.Model.Money? Balance { get { return _Balance; } set { _Balance = value; OnPropertyChanged("Balance"); } } - private Hl7.Fhir.Model.Money _Balance; + private Hl7.Fhir.Model.Money? _Balance; /// /// The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account. @@ -539,11 +522,11 @@ public Hl7.Fhir.Model.Money Balance [DataMember] public List Coverage { - get { if(_Coverage==null) _Coverage = new List(); return _Coverage; } + get => _Coverage ?? new List(); set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private List _Coverage; + private List? _Coverage; /// /// Who is responsible?. @@ -552,41 +535,38 @@ public List Coverage [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Explanation of purpose/use. /// [FhirElement("description", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Explanation of purpose/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -599,36 +579,32 @@ public string Description [DataMember] public List Guarantor { - get { if(_Guarantor==null) _Guarantor = new List(); return _Guarantor; } + get => _Guarantor ?? new List(); set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } - private List _Guarantor; + private List? _Guarantor; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Account; - - if (dest == null) - { + if(other is not Account dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Active != null) dest.Active = (Hl7.Fhir.Model.Period)Active.DeepCopyInternal(); - if(Balance != null) dest.Balance = (Hl7.Fhir.Model.Money)Balance.DeepCopyInternal(); - if(Coverage.Any()) dest.Coverage = new List(Coverage.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Guarantor.Any()) dest.Guarantor = new List(Guarantor.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Active is not null) dest.Active = (Hl7.Fhir.Model.Period)_Active.DeepCopyInternal(); + if(_Balance is not null) dest.Balance = (Hl7.Fhir.Model.Money)_Balance.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = new List(_Coverage.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Guarantor is not null) dest.Guarantor = new List(_Guarantor.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -640,111 +616,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Account; - if(otherT == null) return false; + if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Active, otherT.Active)) return false; - if(!comparer.Equals(Balance, otherT.Balance)) return false; - if(!comparer.ListEquals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Guarantor, otherT.Guarantor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Active, otherT._Active)) return false; + if(!comparer.Equals(_Balance, otherT._Balance)) return false; + if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Guarantor, otherT._Guarantor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "active": - value = Active; - return Active is not null; + value = _Active; + return _Active is not null; case "balance": - value = Balance; - return Balance is not null; + value = _Balance; + return _Balance is not null; case "coverage": - value = Coverage; - return Coverage?.Any() == true; + value = _Coverage; + return _Coverage?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "guarantor": - value = Guarantor; - return Guarantor?.Any() == true; + value = _Guarantor; + return _Guarantor?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "active": - Active = (Hl7.Fhir.Model.Period)value; + Active = (Hl7.Fhir.Model.Period?)value; return this; case "balance": - Balance = (Hl7.Fhir.Model.Money)value; + Balance = (Hl7.Fhir.Model.Money?)value; return this; case "coverage": - Coverage = (List)value; + Coverage = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "guarantor": - Guarantor = (List)value; + Guarantor = (List?)value!; return this; default: return base.SetValue(key, value); @@ -755,18 +731,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Active is not null) yield return new KeyValuePair("active",Active); - if (Balance is not null) yield return new KeyValuePair("balance",Balance); - if (Coverage?.Any() == true) yield return new KeyValuePair("coverage",Coverage); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",Guarantor); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Active is not null) yield return new KeyValuePair("active",_Active); + if (_Balance is not null) yield return new KeyValuePair("balance",_Balance); + if (_Coverage?.Any() == true) yield return new KeyValuePair("coverage",_Coverage); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",_Guarantor); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs index 10dde5f33..2face56f0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -83,13 +86,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActivityParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// patient | practitioner | related-person @@ -98,13 +101,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -115,26 +115,22 @@ public Hl7.Fhir.Model.ActionParticipantType? Type [FhirElement("role", Order=50)] [Binding("ActivityParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -146,41 +142,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -191,8 +187,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -218,28 +214,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the dynamic value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -249,28 +242,25 @@ public string Description /// [FhirElement("path", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -280,28 +270,25 @@ public string Path /// [FhirElement("language", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LanguageElement + public Hl7.Fhir.Model.FhirString? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.FhirString _LanguageElement; + private Hl7.Fhir.Model.FhirString? _LanguageElement; /// /// Language of the expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.FhirString(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Language"); } } @@ -311,46 +298,39 @@ public string Language /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// An expression that provides the dynamic value for the customization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -362,55 +342,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.FhirString)value; + LanguageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -421,10 +401,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -434,28 +414,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this activity definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -468,39 +445,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the activity definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -510,28 +484,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this activity definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -541,28 +512,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this activity definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -575,13 +543,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -590,13 +558,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -606,13 +571,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -621,13 +586,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -637,28 +599,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -668,28 +627,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -699,28 +655,25 @@ public string Publisher /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -730,28 +683,25 @@ public string Description /// [FhirElement("purpose", Order=190, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this activity definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -761,28 +711,25 @@ public string Purpose /// [FhirElement("usage", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the asset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -792,28 +739,25 @@ public string Usage /// [FhirElement("approvalDate", Order=210)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the activity definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -823,28 +767,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=220)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the activity definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -854,13 +795,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Context the content is intended to support. @@ -870,11 +811,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for activity definition (if applicable). @@ -885,11 +826,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// E.g. Education, Treatment, Assessment, etc. @@ -900,11 +841,11 @@ public List Jurisdiction [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// A content contributor. @@ -914,11 +855,11 @@ public List Topic [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Contact details for the publisher. @@ -928,39 +869,36 @@ public List Contributor [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=290)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -973,11 +911,11 @@ public string Copyright [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the asset. @@ -989,11 +927,11 @@ public List RelatedArtifact [DataMember] public List Library { - get { if(_Library==null) _Library = new List(); return _Library; } + get => _Library ?? new List(); set { _Library = value; OnPropertyChanged("Library"); } } - private List _Library; + private List? _Library; /// /// Kind of resource. @@ -1002,13 +940,13 @@ public List Library [DeclaredType(Type = typeof(Code))] [Binding("ActivityDefinitionKind")] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// Kind of resource @@ -1017,13 +955,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1034,13 +969,13 @@ public Hl7.Fhir.Model.ResourceType? Kind [FhirElement("code", Order=330)] [Binding("ActivityDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When activity is to occur. @@ -1049,13 +984,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Where it should happen. @@ -1064,13 +999,13 @@ public Hl7.Fhir.Model.DataType Timing [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Who should participate in the action. @@ -1080,11 +1015,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// What's administered/supplied. @@ -1095,26 +1030,26 @@ public List Participant [References("Medication","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// How much is administered/consumed/supplied. /// [FhirElement("quantity", Order=380)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Detailed dosage instructions. @@ -1124,11 +1059,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// What part of body to perform on. @@ -1139,11 +1074,11 @@ public List Dosage [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Transform to apply the template. @@ -1152,13 +1087,13 @@ public List BodySite [CLSCompliant(false)] [References("StructureMap")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Transform + public Hl7.Fhir.Model.ResourceReference? Transform { get { return _Transform; } set { _Transform = value; OnPropertyChanged("Transform"); } } - private Hl7.Fhir.Model.ResourceReference _Transform; + private Hl7.Fhir.Model.ResourceReference? _Transform; /// /// Dynamic aspects of the definition. @@ -1168,58 +1103,54 @@ public Hl7.Fhir.Model.ResourceReference Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityDefinition; - - if (dest == null) - { + if(other is not ActivityDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Library.Any()) dest.Library = new List(Library.DeepCopyInternal()); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Transform != null) dest.Transform = (Hl7.Fhir.Model.ResourceReference)Transform.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Library is not null) dest.Library = new List(_Library.DeepCopyInternal()); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Transform is not null) dest.Transform = (Hl7.Fhir.Model.ResourceReference)_Transform.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1231,265 +1162,265 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityDefinition; - if(otherT == null) return false; + if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Library, otherT.Library)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Transform, otherT.Transform)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Library, otherT._Library)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Transform, otherT._Transform)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = Library; - return Library?.Any() == true; + value = _Library; + return _Library?.Any() == true; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "transform": - value = Transform; - return Transform is not null; + value = _Transform; + return _Transform is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - Library = (List)value; + Library = (List?)value!; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "transform": - Transform = (Hl7.Fhir.Model.ResourceReference)value; + Transform = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1500,40 +1431,40 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Library?.Any() == true) yield return new KeyValuePair("library",Library); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Transform is not null) yield return new KeyValuePair("transform",Transform); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Library?.Any() == true) yield return new KeyValuePair("library",_Library); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Transform is not null) yield return new KeyValuePair("transform",_Transform); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs index 48a7290f0..a18ff620f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -129,13 +132,13 @@ public enum AddressType [DeclaredType(Type = typeof(Code))] [Binding("AddressUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// home | work | temp | old - purpose of this address @@ -144,13 +147,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -162,13 +162,13 @@ public Hl7.Fhir.Model.Address.AddressUse? Use [DeclaredType(Type = typeof(Code))] [Binding("AddressType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// postal | physical | both @@ -177,13 +177,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -193,28 +190,25 @@ public Hl7.Fhir.Model.Address.AddressType? Type /// [FhirElement("text", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the address /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -227,24 +221,24 @@ public string Text [DataMember] public List LineElement { - get { if(_LineElement==null) _LineElement = new List(); return _LineElement; } + get => _LineElement ?? new List(); set { _LineElement = value; OnPropertyChanged("LineElement"); } } - private List _LineElement; + private List? _LineElement; /// /// Street name, number, direction & P.O. Box etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Line + public IEnumerable? Line { - get { return LineElement != null ? LineElement.Select(elem => elem.Value) : null; } + get => _LineElement?.Select(elem => elem.Value); set { if (value == null) - LineElement = null; + LineElement = null!; else LineElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Line"); @@ -256,28 +250,25 @@ public IEnumerable Line /// [FhirElement("city", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CityElement + public Hl7.Fhir.Model.FhirString? CityElement { get { return _CityElement; } set { _CityElement = value; OnPropertyChanged("CityElement"); } } - private Hl7.Fhir.Model.FhirString _CityElement; + private Hl7.Fhir.Model.FhirString? _CityElement; /// /// Name of city, town etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string City + public string? City { - get { return CityElement != null ? CityElement.Value : null; } + get => _CityElement?.Value; set { - if (value == null) - CityElement = null; - else - CityElement = new Hl7.Fhir.Model.FhirString(value); + CityElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("City"); } } @@ -287,28 +278,25 @@ public string City /// [FhirElement("district", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DistrictElement + public Hl7.Fhir.Model.FhirString? DistrictElement { get { return _DistrictElement; } set { _DistrictElement = value; OnPropertyChanged("DistrictElement"); } } - private Hl7.Fhir.Model.FhirString _DistrictElement; + private Hl7.Fhir.Model.FhirString? _DistrictElement; /// /// District name (aka county) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string District + public string? District { - get { return DistrictElement != null ? DistrictElement.Value : null; } + get => _DistrictElement?.Value; set { - if (value == null) - DistrictElement = null; - else - DistrictElement = new Hl7.Fhir.Model.FhirString(value); + DistrictElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("District"); } } @@ -318,28 +306,25 @@ public string District /// [FhirElement("state", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString StateElement + public Hl7.Fhir.Model.FhirString? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Hl7.Fhir.Model.FhirString _StateElement; + private Hl7.Fhir.Model.FhirString? _StateElement; /// /// Sub-unit of country (abbreviations ok) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string State + public string? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Hl7.Fhir.Model.FhirString(value); + StateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("State"); } } @@ -349,28 +334,25 @@ public string State /// [FhirElement("postalCode", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PostalCodeElement + public Hl7.Fhir.Model.FhirString? PostalCodeElement { get { return _PostalCodeElement; } set { _PostalCodeElement = value; OnPropertyChanged("PostalCodeElement"); } } - private Hl7.Fhir.Model.FhirString _PostalCodeElement; + private Hl7.Fhir.Model.FhirString? _PostalCodeElement; /// /// Postal code for area /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PostalCode + public string? PostalCode { - get { return PostalCodeElement != null ? PostalCodeElement.Value : null; } + get => _PostalCodeElement?.Value; set { - if (value == null) - PostalCodeElement = null; - else - PostalCodeElement = new Hl7.Fhir.Model.FhirString(value); + PostalCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PostalCode"); } } @@ -380,28 +362,25 @@ public string PostalCode /// [FhirElement("country", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CountryElement + public Hl7.Fhir.Model.FhirString? CountryElement { get { return _CountryElement; } set { _CountryElement = value; OnPropertyChanged("CountryElement"); } } - private Hl7.Fhir.Model.FhirString _CountryElement; + private Hl7.Fhir.Model.FhirString? _CountryElement; /// /// Country (e.g. can be ISO 3166 2 or 3 letter code) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Country + public string? Country { - get { return CountryElement != null ? CountryElement.Value : null; } + get => _CountryElement?.Value; set { - if (value == null) - CountryElement = null; - else - CountryElement = new Hl7.Fhir.Model.FhirString(value); + CountryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Country"); } } @@ -411,34 +390,30 @@ public string Country /// [FhirElement("period", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as Address; - - if (dest == null) - { + if(other is not Address dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LineElement.Any()) dest.LineElement = new List(LineElement.DeepCopyInternal()); - if(CityElement != null) dest.CityElement = (Hl7.Fhir.Model.FhirString)CityElement.DeepCopyInternal(); - if(DistrictElement != null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)DistrictElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Hl7.Fhir.Model.FhirString)StateElement.DeepCopyInternal(); - if(PostalCodeElement != null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)PostalCodeElement.DeepCopyInternal(); - if(CountryElement != null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)CountryElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LineElement is not null) dest.LineElement = new List(_LineElement.DeepCopyInternal()); + if(_CityElement is not null) dest.CityElement = (Hl7.Fhir.Model.FhirString)_CityElement.DeepCopyInternal(); + if(_DistrictElement is not null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)_DistrictElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Hl7.Fhir.Model.FhirString)_StateElement.DeepCopyInternal(); + if(_PostalCodeElement is not null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)_PostalCodeElement.DeepCopyInternal(); + if(_CountryElement is not null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)_CountryElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -450,97 +425,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Address; - if(otherT == null) return false; + if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LineElement, otherT.LineElement)) return false; - if(!comparer.Equals(CityElement, otherT.CityElement)) return false; - if(!comparer.Equals(DistrictElement, otherT.DistrictElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(PostalCodeElement, otherT.PostalCodeElement)) return false; - if(!comparer.Equals(CountryElement, otherT.CountryElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; + if(!comparer.Equals(_CityElement, otherT._CityElement)) return false; + if(!comparer.Equals(_DistrictElement, otherT._DistrictElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; + if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "line": - value = LineElement; - return LineElement?.Any() == true; + value = _LineElement; + return _LineElement?.Any() == true; case "city": - value = CityElement; - return CityElement is not null; + value = _CityElement; + return _CityElement is not null; case "district": - value = DistrictElement; - return DistrictElement is not null; + value = _DistrictElement; + return _DistrictElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "postalCode": - value = PostalCodeElement; - return PostalCodeElement is not null; + value = _PostalCodeElement; + return _PostalCodeElement is not null; case "country": - value = CountryElement; - return CountryElement is not null; + value = _CountryElement; + return _CountryElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "line": - LineElement = (List)value; + LineElement = (List?)value!; return this; case "city": - CityElement = (Hl7.Fhir.Model.FhirString)value; + CityElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "district": - DistrictElement = (Hl7.Fhir.Model.FhirString)value; + DistrictElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "state": - StateElement = (Hl7.Fhir.Model.FhirString)value; + StateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "postalCode": - PostalCodeElement = (Hl7.Fhir.Model.FhirString)value; + PostalCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - CountryElement = (Hl7.Fhir.Model.FhirString)value; + CountryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -551,16 +526,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LineElement?.Any() == true) yield return new KeyValuePair("line",LineElement); - if (CityElement is not null) yield return new KeyValuePair("city",CityElement); - if (DistrictElement is not null) yield return new KeyValuePair("district",DistrictElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (PostalCodeElement is not null) yield return new KeyValuePair("postalCode",PostalCodeElement); - if (CountryElement is not null) yield return new KeyValuePair("country",CountryElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LineElement?.Any() == true) yield return new KeyValuePair("line",_LineElement); + if (_CityElement is not null) yield return new KeyValuePair("city",_CityElement); + if (_DistrictElement is not null) yield return new KeyValuePair("district",_DistrictElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_PostalCodeElement is not null) yield return new KeyValuePair("postalCode",_PostalCodeElement); + if (_CountryElement is not null) yield return new KeyValuePair("country",_CountryElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs index 7109a95c4..00dc62fee 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -173,13 +176,13 @@ public partial class SuspectEntityComponent : Hl7.Fhir.Model.BackboneElement [References("Substance","Medication","MedicationAdministration","MedicationStatement","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Instance + public Hl7.Fhir.Model.ResourceReference? Instance { get { return _Instance; } set { _Instance = value; OnPropertyChanged("Instance"); } } - private Hl7.Fhir.Model.ResourceReference _Instance; + private Hl7.Fhir.Model.ResourceReference? _Instance; /// /// causality1 | causality2. @@ -188,13 +191,13 @@ public Hl7.Fhir.Model.ResourceReference Instance [DeclaredType(Type = typeof(Code))] [Binding("AdverseEventCausality")] [DataMember] - public Code CausalityElement + public Code? CausalityElement { get { return _CausalityElement; } set { _CausalityElement = value; OnPropertyChanged("CausalityElement"); } } - private Code _CausalityElement; + private Code? _CausalityElement; /// /// causality1 | causality2 @@ -203,13 +206,10 @@ public Code CausalityElement [IgnoreDataMember] public Hl7.Fhir.Model.AdverseEvent.AdverseEventCausality? Causality { - get { return CausalityElement != null ? CausalityElement.Value : null; } + get => _CausalityElement?.Value; set { - if (value == null) - CausalityElement = null; - else - CausalityElement = new Code(value); + CausalityElement = value is null ? null : new Code(value); OnPropertyChanged("Causality"); } } @@ -220,41 +220,38 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventCausality? Causality [FhirElement("causalityAssessment", InSummary=true, Order=60)] [Binding("AdverseEventCausalityAssessment")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CausalityAssessment + public Hl7.Fhir.Model.CodeableConcept? CausalityAssessment { get { return _CausalityAssessment; } set { _CausalityAssessment = value; OnPropertyChanged("CausalityAssessment"); } } - private Hl7.Fhir.Model.CodeableConcept _CausalityAssessment; + private Hl7.Fhir.Model.CodeableConcept? _CausalityAssessment; /// /// AdverseEvent.suspectEntity.causalityProductRelatedness. /// [FhirElement("causalityProductRelatedness", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CausalityProductRelatednessElement + public Hl7.Fhir.Model.FhirString? CausalityProductRelatednessElement { get { return _CausalityProductRelatednessElement; } set { _CausalityProductRelatednessElement = value; OnPropertyChanged("CausalityProductRelatednessElement"); } } - private Hl7.Fhir.Model.FhirString _CausalityProductRelatednessElement; + private Hl7.Fhir.Model.FhirString? _CausalityProductRelatednessElement; /// /// AdverseEvent.suspectEntity.causalityProductRelatedness /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CausalityProductRelatedness + public string? CausalityProductRelatedness { - get { return CausalityProductRelatednessElement != null ? CausalityProductRelatednessElement.Value : null; } + get => _CausalityProductRelatednessElement?.Value; set { - if (value == null) - CausalityProductRelatednessElement = null; - else - CausalityProductRelatednessElement = new Hl7.Fhir.Model.FhirString(value); + CausalityProductRelatednessElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CausalityProductRelatedness"); } } @@ -265,13 +262,13 @@ public string CausalityProductRelatedness [FhirElement("causalityMethod", InSummary=true, Order=80)] [Binding("AdverseEventCausalityMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CausalityMethod + public Hl7.Fhir.Model.CodeableConcept? CausalityMethod { get { return _CausalityMethod; } set { _CausalityMethod = value; OnPropertyChanged("CausalityMethod"); } } - private Hl7.Fhir.Model.CodeableConcept _CausalityMethod; + private Hl7.Fhir.Model.CodeableConcept? _CausalityMethod; /// /// AdverseEvent.suspectEntity.causalityAuthor. @@ -280,13 +277,13 @@ public Hl7.Fhir.Model.CodeableConcept CausalityMethod [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CausalityAuthor + public Hl7.Fhir.Model.ResourceReference? CausalityAuthor { get { return _CausalityAuthor; } set { _CausalityAuthor = value; OnPropertyChanged("CausalityAuthor"); } } - private Hl7.Fhir.Model.ResourceReference _CausalityAuthor; + private Hl7.Fhir.Model.ResourceReference? _CausalityAuthor; /// /// result1 | result2. @@ -294,31 +291,27 @@ public Hl7.Fhir.Model.ResourceReference CausalityAuthor [FhirElement("causalityResult", InSummary=true, Order=100)] [Binding("AdverseEventCausalityResult")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CausalityResult + public Hl7.Fhir.Model.CodeableConcept? CausalityResult { get { return _CausalityResult; } set { _CausalityResult = value; OnPropertyChanged("CausalityResult"); } } - private Hl7.Fhir.Model.CodeableConcept _CausalityResult; + private Hl7.Fhir.Model.CodeableConcept? _CausalityResult; protected internal override void CopyToInternal(Base other) { - var dest = other as SuspectEntityComponent; - - if (dest == null) - { + if(other is not SuspectEntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Instance != null) dest.Instance = (Hl7.Fhir.Model.ResourceReference)Instance.DeepCopyInternal(); - if(CausalityElement != null) dest.CausalityElement = (Code)CausalityElement.DeepCopyInternal(); - if(CausalityAssessment != null) dest.CausalityAssessment = (Hl7.Fhir.Model.CodeableConcept)CausalityAssessment.DeepCopyInternal(); - if(CausalityProductRelatednessElement != null) dest.CausalityProductRelatednessElement = (Hl7.Fhir.Model.FhirString)CausalityProductRelatednessElement.DeepCopyInternal(); - if(CausalityMethod != null) dest.CausalityMethod = (Hl7.Fhir.Model.CodeableConcept)CausalityMethod.DeepCopyInternal(); - if(CausalityAuthor != null) dest.CausalityAuthor = (Hl7.Fhir.Model.ResourceReference)CausalityAuthor.DeepCopyInternal(); - if(CausalityResult != null) dest.CausalityResult = (Hl7.Fhir.Model.CodeableConcept)CausalityResult.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = (Hl7.Fhir.Model.ResourceReference)_Instance.DeepCopyInternal(); + if(_CausalityElement is not null) dest.CausalityElement = (Code)_CausalityElement.DeepCopyInternal(); + if(_CausalityAssessment is not null) dest.CausalityAssessment = (Hl7.Fhir.Model.CodeableConcept)_CausalityAssessment.DeepCopyInternal(); + if(_CausalityProductRelatednessElement is not null) dest.CausalityProductRelatednessElement = (Hl7.Fhir.Model.FhirString)_CausalityProductRelatednessElement.DeepCopyInternal(); + if(_CausalityMethod is not null) dest.CausalityMethod = (Hl7.Fhir.Model.CodeableConcept)_CausalityMethod.DeepCopyInternal(); + if(_CausalityAuthor is not null) dest.CausalityAuthor = (Hl7.Fhir.Model.ResourceReference)_CausalityAuthor.DeepCopyInternal(); + if(_CausalityResult is not null) dest.CausalityResult = (Hl7.Fhir.Model.CodeableConcept)_CausalityResult.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -330,76 +323,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuspectEntityComponent; - if(otherT == null) return false; + if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Instance, otherT.Instance)) return false; - if(!comparer.Equals(CausalityElement, otherT.CausalityElement)) return false; - if(!comparer.Equals(CausalityAssessment, otherT.CausalityAssessment)) return false; - if(!comparer.Equals(CausalityProductRelatednessElement, otherT.CausalityProductRelatednessElement)) return false; - if(!comparer.Equals(CausalityMethod, otherT.CausalityMethod)) return false; - if(!comparer.Equals(CausalityAuthor, otherT.CausalityAuthor)) return false; - if(!comparer.Equals(CausalityResult, otherT.CausalityResult)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + if(!comparer.Equals(_CausalityElement, otherT._CausalityElement)) return false; + if(!comparer.Equals(_CausalityAssessment, otherT._CausalityAssessment)) return false; + if(!comparer.Equals(_CausalityProductRelatednessElement, otherT._CausalityProductRelatednessElement)) return false; + if(!comparer.Equals(_CausalityMethod, otherT._CausalityMethod)) return false; + if(!comparer.Equals(_CausalityAuthor, otherT._CausalityAuthor)) return false; + if(!comparer.Equals(_CausalityResult, otherT._CausalityResult)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "instance": - value = Instance; - return Instance is not null; + value = _Instance; + return _Instance is not null; case "causality": - value = CausalityElement; - return CausalityElement is not null; + value = _CausalityElement; + return _CausalityElement is not null; case "causalityAssessment": - value = CausalityAssessment; - return CausalityAssessment is not null; + value = _CausalityAssessment; + return _CausalityAssessment is not null; case "causalityProductRelatedness": - value = CausalityProductRelatednessElement; - return CausalityProductRelatednessElement is not null; + value = _CausalityProductRelatednessElement; + return _CausalityProductRelatednessElement is not null; case "causalityMethod": - value = CausalityMethod; - return CausalityMethod is not null; + value = _CausalityMethod; + return _CausalityMethod is not null; case "causalityAuthor": - value = CausalityAuthor; - return CausalityAuthor is not null; + value = _CausalityAuthor; + return _CausalityAuthor is not null; case "causalityResult": - value = CausalityResult; - return CausalityResult is not null; + value = _CausalityResult; + return _CausalityResult is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "instance": - Instance = (Hl7.Fhir.Model.ResourceReference)value; + Instance = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "causality": - CausalityElement = (Code)value; + CausalityElement = (Code?)value; return this; case "causalityAssessment": - CausalityAssessment = (Hl7.Fhir.Model.CodeableConcept)value; + CausalityAssessment = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "causalityProductRelatedness": - CausalityProductRelatednessElement = (Hl7.Fhir.Model.FhirString)value; + CausalityProductRelatednessElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "causalityMethod": - CausalityMethod = (Hl7.Fhir.Model.CodeableConcept)value; + CausalityMethod = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "causalityAuthor": - CausalityAuthor = (Hl7.Fhir.Model.ResourceReference)value; + CausalityAuthor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "causalityResult": - CausalityResult = (Hl7.Fhir.Model.CodeableConcept)value; + CausalityResult = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -410,13 +403,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Instance is not null) yield return new KeyValuePair("instance",Instance); - if (CausalityElement is not null) yield return new KeyValuePair("causality",CausalityElement); - if (CausalityAssessment is not null) yield return new KeyValuePair("causalityAssessment",CausalityAssessment); - if (CausalityProductRelatednessElement is not null) yield return new KeyValuePair("causalityProductRelatedness",CausalityProductRelatednessElement); - if (CausalityMethod is not null) yield return new KeyValuePair("causalityMethod",CausalityMethod); - if (CausalityAuthor is not null) yield return new KeyValuePair("causalityAuthor",CausalityAuthor); - if (CausalityResult is not null) yield return new KeyValuePair("causalityResult",CausalityResult); + if (_Instance is not null) yield return new KeyValuePair("instance",_Instance); + if (_CausalityElement is not null) yield return new KeyValuePair("causality",_CausalityElement); + if (_CausalityAssessment is not null) yield return new KeyValuePair("causalityAssessment",_CausalityAssessment); + if (_CausalityProductRelatednessElement is not null) yield return new KeyValuePair("causalityProductRelatedness",_CausalityProductRelatednessElement); + if (_CausalityMethod is not null) yield return new KeyValuePair("causalityMethod",_CausalityMethod); + if (_CausalityAuthor is not null) yield return new KeyValuePair("causalityAuthor",_CausalityAuthor); + if (_CausalityResult is not null) yield return new KeyValuePair("causalityResult",_CausalityResult); } } @@ -426,13 +419,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// AE | PAE @@ -442,13 +435,13 @@ public Hl7.Fhir.Model.Identifier Identifier [DeclaredType(Type = typeof(Code))] [Binding("AdverseEventCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// AE | PAE @@ -458,13 +451,10 @@ public Code CategoryElement [IgnoreDataMember] public Hl7.Fhir.Model.AdverseEvent.AdverseEventCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -475,13 +465,13 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventCategory? Category [FhirElement("type", InSummary=true, Order=110, FiveWs="what")] [Binding("AdverseEventType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Subject or group impacted by event. @@ -490,41 +480,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","ResearchSubject","Medication","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When the event occurred. /// [FhirElement("date", InSummary=true, Order=130, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the event occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -539,11 +526,11 @@ public string Date [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; /// /// Location where adverse event occurred. @@ -552,13 +539,13 @@ public List Reaction [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Mild | Moderate | Severe. @@ -566,13 +553,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("seriousness", InSummary=true, Order=160)] [Binding("AdverseEventSeriousness")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Seriousness + public Hl7.Fhir.Model.CodeableConcept? Seriousness { get { return _Seriousness; } set { _Seriousness = value; OnPropertyChanged("Seriousness"); } } - private Hl7.Fhir.Model.CodeableConcept _Seriousness; + private Hl7.Fhir.Model.CodeableConcept? _Seriousness; /// /// resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown. @@ -580,13 +567,13 @@ public Hl7.Fhir.Model.CodeableConcept Seriousness [FhirElement("outcome", InSummary=true, Order=170)] [Binding("AdverseEventOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Who recorded the adverse event. @@ -595,13 +582,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Who was involved in the adverse event or the potential adverse event. @@ -610,41 +597,38 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Practitioner","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference EventParticipant + public Hl7.Fhir.Model.ResourceReference? EventParticipant { get { return _EventParticipant; } set { _EventParticipant = value; OnPropertyChanged("EventParticipant"); } } - private Hl7.Fhir.Model.ResourceReference _EventParticipant; + private Hl7.Fhir.Model.ResourceReference? _EventParticipant; /// /// Description of the adverse event. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the adverse event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -657,11 +641,11 @@ public string Description [DataMember] public List SuspectEntity { - get { if(_SuspectEntity==null) _SuspectEntity = new List(); return _SuspectEntity; } + get => _SuspectEntity ?? new List(); set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } - private List _SuspectEntity; + private List? _SuspectEntity; /// /// AdverseEvent.subjectMedicalHistory. @@ -673,11 +657,11 @@ public List SuspectEntity [DataMember] public List SubjectMedicalHistory { - get { if(_SubjectMedicalHistory==null) _SubjectMedicalHistory = new List(); return _SubjectMedicalHistory; } + get => _SubjectMedicalHistory ?? new List(); set { _SubjectMedicalHistory = value; OnPropertyChanged("SubjectMedicalHistory"); } } - private List _SubjectMedicalHistory; + private List? _SubjectMedicalHistory; /// /// AdverseEvent.referenceDocument. @@ -689,11 +673,11 @@ public List SubjectMedicalHistory [DataMember] public List ReferenceDocument { - get { if(_ReferenceDocument==null) _ReferenceDocument = new List(); return _ReferenceDocument; } + get => _ReferenceDocument ?? new List(); set { _ReferenceDocument = value; OnPropertyChanged("ReferenceDocument"); } } - private List _ReferenceDocument; + private List? _ReferenceDocument; /// /// AdverseEvent.study. @@ -705,40 +689,36 @@ public List ReferenceDocument [DataMember] public List Study { - get { if(_Study==null) _Study = new List(); return _Study; } + get => _Study ?? new List(); set { _Study = value; OnPropertyChanged("Study"); } } - private List _Study; + private List? _Study; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AdverseEvent; - - if (dest == null) - { + if(other is not AdverseEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Seriousness != null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)Seriousness.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(EventParticipant != null) dest.EventParticipant = (Hl7.Fhir.Model.ResourceReference)EventParticipant.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SuspectEntity.Any()) dest.SuspectEntity = new List(SuspectEntity.DeepCopyInternal()); - if(SubjectMedicalHistory.Any()) dest.SubjectMedicalHistory = new List(SubjectMedicalHistory.DeepCopyInternal()); - if(ReferenceDocument.Any()) dest.ReferenceDocument = new List(ReferenceDocument.DeepCopyInternal()); - if(Study.Any()) dest.Study = new List(Study.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Seriousness is not null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)_Seriousness.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_EventParticipant is not null) dest.EventParticipant = (Hl7.Fhir.Model.ResourceReference)_EventParticipant.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SuspectEntity is not null) dest.SuspectEntity = new List(_SuspectEntity.DeepCopyInternal()); + if(_SubjectMedicalHistory is not null) dest.SubjectMedicalHistory = new List(_SubjectMedicalHistory.DeepCopyInternal()); + if(_ReferenceDocument is not null) dest.ReferenceDocument = new List(_ReferenceDocument.DeepCopyInternal()); + if(_Study is not null) dest.Study = new List(_Study.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -750,139 +730,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdverseEvent; - if(otherT == null) return false; + if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Seriousness, otherT.Seriousness)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(EventParticipant, otherT.EventParticipant)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SuspectEntity, otherT.SuspectEntity)) return false; - if(!comparer.ListEquals(SubjectMedicalHistory, otherT.SubjectMedicalHistory)) return false; - if(!comparer.ListEquals(ReferenceDocument, otherT.ReferenceDocument)) return false; - if(!comparer.ListEquals(Study, otherT.Study)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Seriousness, otherT._Seriousness)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_EventParticipant, otherT._EventParticipant)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SuspectEntity, otherT._SuspectEntity)) return false; + if(!comparer.ListEquals(_SubjectMedicalHistory, otherT._SubjectMedicalHistory)) return false; + if(!comparer.ListEquals(_ReferenceDocument, otherT._ReferenceDocument)) return false; + if(!comparer.ListEquals(_Study, otherT._Study)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "seriousness": - value = Seriousness; - return Seriousness is not null; + value = _Seriousness; + return _Seriousness is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "eventParticipant": - value = EventParticipant; - return EventParticipant is not null; + value = _EventParticipant; + return _EventParticipant is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "suspectEntity": - value = SuspectEntity; - return SuspectEntity?.Any() == true; + value = _SuspectEntity; + return _SuspectEntity?.Any() == true; case "subjectMedicalHistory": - value = SubjectMedicalHistory; - return SubjectMedicalHistory?.Any() == true; + value = _SubjectMedicalHistory; + return _SubjectMedicalHistory?.Any() == true; case "referenceDocument": - value = ReferenceDocument; - return ReferenceDocument?.Any() == true; + value = _ReferenceDocument; + return _ReferenceDocument?.Any() == true; case "study": - value = Study; - return Study?.Any() == true; + value = _Study; + return _Study?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "seriousness": - Seriousness = (Hl7.Fhir.Model.CodeableConcept)value; + Seriousness = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "eventParticipant": - EventParticipant = (Hl7.Fhir.Model.ResourceReference)value; + EventParticipant = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "suspectEntity": - SuspectEntity = (List)value; + SuspectEntity = (List?)value!; return this; case "subjectMedicalHistory": - SubjectMedicalHistory = (List)value; + SubjectMedicalHistory = (List?)value!; return this; case "referenceDocument": - ReferenceDocument = (List)value; + ReferenceDocument = (List?)value!; return this; case "study": - Study = (List)value; + Study = (List?)value!; return this; default: return base.SetValue(key, value); @@ -893,22 +873,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Seriousness is not null) yield return new KeyValuePair("seriousness",Seriousness); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (EventParticipant is not null) yield return new KeyValuePair("eventParticipant",EventParticipant); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",SuspectEntity); - if (SubjectMedicalHistory?.Any() == true) yield return new KeyValuePair("subjectMedicalHistory",SubjectMedicalHistory); - if (ReferenceDocument?.Any() == true) yield return new KeyValuePair("referenceDocument",ReferenceDocument); - if (Study?.Any() == true) yield return new KeyValuePair("study",Study); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Seriousness is not null) yield return new KeyValuePair("seriousness",_Seriousness); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_EventParticipant is not null) yield return new KeyValuePair("eventParticipant",_EventParticipant); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",_SuspectEntity); + if (_SubjectMedicalHistory?.Any() == true) yield return new KeyValuePair("subjectMedicalHistory",_SubjectMedicalHistory); + if (_ReferenceDocument?.Any() == true) yield return new KeyValuePair("referenceDocument",_ReferenceDocument); + if (_Study?.Any() == true) yield return new KeyValuePair("study",_Study); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Age.cs b/src/Hl7.Fhir.STU3/Model/Generated/Age.cs index 13cd297c1..948601f99 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Age.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Age.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs index 64dd1dfa4..917cc5e20 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -256,13 +259,13 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", Order=40)] [Binding("SubstanceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Clinical symptoms/signs associated with the Event. @@ -273,39 +276,36 @@ public Hl7.Fhir.Model.CodeableConcept Substance [DataMember] public List Manifestation { - get { if(_Manifestation==null) _Manifestation = new List(); return _Manifestation; } + get => _Manifestation ?? new List(); set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } - private List _Manifestation; + private List? _Manifestation; /// /// Description of the event as a whole. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the event as a whole /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -315,28 +315,25 @@ public string Description /// [FhirElement("onset", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OnsetElement + public Hl7.Fhir.Model.FhirDateTime? OnsetElement { get { return _OnsetElement; } set { _OnsetElement = value; OnPropertyChanged("OnsetElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OnsetElement; + private Hl7.Fhir.Model.FhirDateTime? _OnsetElement; /// /// Date(/time) when manifestations showed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Onset + public string? Onset { - get { return OnsetElement != null ? OnsetElement.Value : null; } + get => _OnsetElement?.Value; set { - if (value == null) - OnsetElement = null; - else - OnsetElement = new Hl7.Fhir.Model.FhirDateTime(value); + OnsetElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Onset"); } } @@ -348,13 +345,13 @@ public string Onset [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// mild | moderate | severe (of event as a whole) @@ -363,13 +360,10 @@ public Code Severi [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -380,13 +374,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity [FhirElement("exposureRoute", Order=90)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ExposureRoute + public Hl7.Fhir.Model.CodeableConcept? ExposureRoute { get { return _ExposureRoute; } set { _ExposureRoute = value; OnPropertyChanged("ExposureRoute"); } } - private Hl7.Fhir.Model.CodeableConcept _ExposureRoute; + private Hl7.Fhir.Model.CodeableConcept? _ExposureRoute; /// /// Text about event not captured in other fields. @@ -396,29 +390,25 @@ public Hl7.Fhir.Model.CodeableConcept ExposureRoute [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(Manifestation.Any()) dest.Manifestation = new List(Manifestation.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OnsetElement != null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)OnsetElement.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(ExposureRoute != null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)ExposureRoute.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_Manifestation is not null) dest.Manifestation = new List(_Manifestation.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OnsetElement is not null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)_OnsetElement.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_ExposureRoute is not null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)_ExposureRoute.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -430,76 +420,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.ListEquals(Manifestation, otherT.Manifestation)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(OnsetElement, otherT.OnsetElement)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(ExposureRoute, otherT.ExposureRoute)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "manifestation": - value = Manifestation; - return Manifestation?.Any() == true; + value = _Manifestation; + return _Manifestation?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "onset": - value = OnsetElement; - return OnsetElement is not null; + value = _OnsetElement; + return _OnsetElement is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "exposureRoute": - value = ExposureRoute; - return ExposureRoute is not null; + value = _ExposureRoute; + return _ExposureRoute is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manifestation": - Manifestation = (List)value; + Manifestation = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "onset": - OnsetElement = (Hl7.Fhir.Model.FhirDateTime)value; + OnsetElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "exposureRoute": - ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)value; + ExposureRoute = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -510,13 +500,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",Manifestation); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OnsetElement is not null) yield return new KeyValuePair("onset",OnsetElement); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",ExposureRoute); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",_Manifestation); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OnsetElement is not null) yield return new KeyValuePair("onset",_OnsetElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",_ExposureRoute); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -529,11 +519,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | resolved. @@ -542,13 +532,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceClinicalStatus")] [DataMember] - public Code ClinicalStatusElement + public Code? ClinicalStatusElement { get { return _ClinicalStatusElement; } set { _ClinicalStatusElement = value; OnPropertyChanged("ClinicalStatusElement"); } } - private Code _ClinicalStatusElement; + private Code? _ClinicalStatusElement; /// /// active | inactive | resolved @@ -557,13 +547,10 @@ public Code [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceClinicalStatus? ClinicalStatus { - get { return ClinicalStatusElement != null ? ClinicalStatusElement.Value : null; } + get => _ClinicalStatusElement?.Value; set { - if (value == null) - ClinicalStatusElement = null; - else - ClinicalStatusElement = new Code(value); + ClinicalStatusElement = value is null ? null : new Code(value); OnPropertyChanged("ClinicalStatus"); } } @@ -576,13 +563,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceClinicalStatus? Clini [Binding("AllergyIntoleranceVerificationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code VerificationStatusElement + public Code? VerificationStatusElement { get { return _VerificationStatusElement; } set { _VerificationStatusElement = value; OnPropertyChanged("VerificationStatusElement"); } } - private Code _VerificationStatusElement; + private Code? _VerificationStatusElement; /// /// unconfirmed | confirmed | refuted | entered-in-error @@ -591,13 +578,10 @@ public Code _VerificationStatusElement?.Value; set { - if (value == null) - VerificationStatusElement = null; - else - VerificationStatusElement = new Code(value); + VerificationStatusElement = value is null ? null : new Code(value); OnPropertyChanged("VerificationStatus"); } } @@ -609,13 +593,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceVerificationStatus? V [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// allergy | intolerance - Underlying mechanism (if known) @@ -624,13 +608,10 @@ public Code TypeElemen [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -645,24 +626,24 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type [DataMember] public List> CategoryElement { - get { if(_CategoryElement==null) _CategoryElement = new List>(); return _CategoryElement; } + get => _CategoryElement ?? new List>(); set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private List> _CategoryElement; + private List>? _CategoryElement; /// /// food | medication | environment | biologic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Category + public IEnumerable? Category { - get { return CategoryElement != null ? CategoryElement.Select(elem => elem.Value) : null; } + get => _CategoryElement?.Select(elem => elem.Value); set { if (value == null) - CategoryElement = null; + CategoryElement = null!; else CategoryElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Category"); @@ -676,13 +657,13 @@ public IEnumerable CriticalityElement + public Code? CriticalityElement { get { return _CriticalityElement; } set { _CriticalityElement = value; OnPropertyChanged("CriticalityElement"); } } - private Code _CriticalityElement; + private Code? _CriticalityElement; /// /// low | high | unable-to-assess @@ -691,13 +672,10 @@ public Code Cri [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Criticality { - get { return CriticalityElement != null ? CriticalityElement.Value : null; } + get => _CriticalityElement?.Value; set { - if (value == null) - CriticalityElement = null; - else - CriticalityElement = new Code(value); + CriticalityElement = value is null ? null : new Code(value); OnPropertyChanged("Criticality"); } } @@ -708,13 +686,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Critical [FhirElement("code", InSummary=true, Order=150, FiveWs="what")] [Binding("AllergyIntoleranceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the sensitivity is for. @@ -724,13 +702,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When allergy or intolerance was identified. @@ -739,41 +717,38 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Date record was believed accurate. /// [FhirElement("assertedDate", Order=180, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AssertedDateElement + public Hl7.Fhir.Model.FhirDateTime? AssertedDateElement { get { return _AssertedDateElement; } set { _AssertedDateElement = value; OnPropertyChanged("AssertedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AssertedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _AssertedDateElement; /// /// Date record was believed accurate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AssertedDate + public string? AssertedDate { - get { return AssertedDateElement != null ? AssertedDateElement.Value : null; } + get => _AssertedDateElement?.Value; set { - if (value == null) - AssertedDateElement = null; - else - AssertedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + AssertedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AssertedDate"); } } @@ -785,13 +760,13 @@ public string AssertedDate [CLSCompliant(false)] [References("Practitioner","Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Source of the information about the allergy. @@ -800,41 +775,38 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// Date(/time) of last known occurrence of a reaction. /// [FhirElement("lastOccurrence", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastOccurrenceElement + public Hl7.Fhir.Model.FhirDateTime? LastOccurrenceElement { get { return _LastOccurrenceElement; } set { _LastOccurrenceElement = value; OnPropertyChanged("LastOccurrenceElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastOccurrenceElement; + private Hl7.Fhir.Model.FhirDateTime? _LastOccurrenceElement; /// /// Date(/time) of last known occurrence of a reaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastOccurrence + public string? LastOccurrence { - get { return LastOccurrenceElement != null ? LastOccurrenceElement.Value : null; } + get => _LastOccurrenceElement?.Value; set { - if (value == null) - LastOccurrenceElement = null; - else - LastOccurrenceElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastOccurrenceElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastOccurrence"); } } @@ -847,11 +819,11 @@ public string LastOccurrence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Adverse Reaction Events linked to exposure to substance. @@ -861,39 +833,35 @@ public List Note [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AllergyIntolerance; - - if (dest == null) - { + if(other is not AllergyIntolerance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatusElement != null) dest.ClinicalStatusElement = (Code)ClinicalStatusElement.DeepCopyInternal(); - if(VerificationStatusElement != null) dest.VerificationStatusElement = (Code)VerificationStatusElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(CategoryElement.Any()) dest.CategoryElement = new List>(CategoryElement.DeepCopyInternal()); - if(CriticalityElement != null) dest.CriticalityElement = (Code)CriticalityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(AssertedDateElement != null) dest.AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime)AssertedDateElement.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(LastOccurrenceElement != null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)LastOccurrenceElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatusElement is not null) dest.ClinicalStatusElement = (Code)_ClinicalStatusElement.DeepCopyInternal(); + if(_VerificationStatusElement is not null) dest.VerificationStatusElement = (Code)_VerificationStatusElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = new List>(_CategoryElement.DeepCopyInternal()); + if(_CriticalityElement is not null) dest.CriticalityElement = (Code)_CriticalityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_AssertedDateElement is not null) dest.AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime)_AssertedDateElement.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_LastOccurrenceElement is not null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)_LastOccurrenceElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -905,132 +873,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllergyIntolerance; - if(otherT == null) return false; + if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatusElement, otherT.ClinicalStatusElement)) return false; - if(!comparer.Equals(VerificationStatusElement, otherT.VerificationStatusElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(CriticalityElement, otherT.CriticalityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(AssertedDateElement, otherT.AssertedDateElement)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.Equals(LastOccurrenceElement, otherT.LastOccurrenceElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatusElement, otherT._ClinicalStatusElement)) return false; + if(!comparer.Equals(_VerificationStatusElement, otherT._VerificationStatusElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_CriticalityElement, otherT._CriticalityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_AssertedDateElement, otherT._AssertedDateElement)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatusElement; - return ClinicalStatusElement is not null; + value = _ClinicalStatusElement; + return _ClinicalStatusElement is not null; case "verificationStatus": - value = VerificationStatusElement; - return VerificationStatusElement is not null; + value = _VerificationStatusElement; + return _VerificationStatusElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "category": - value = CategoryElement; - return CategoryElement?.Any() == true; + value = _CategoryElement; + return _CategoryElement?.Any() == true; case "criticality": - value = CriticalityElement; - return CriticalityElement is not null; + value = _CriticalityElement; + return _CriticalityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "assertedDate": - value = AssertedDateElement; - return AssertedDateElement is not null; + value = _AssertedDateElement; + return _AssertedDateElement is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "lastOccurrence": - value = LastOccurrenceElement; - return LastOccurrenceElement is not null; + value = _LastOccurrenceElement; + return _LastOccurrenceElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatusElement = (Code)value; + ClinicalStatusElement = (Code?)value; return this; case "verificationStatus": - VerificationStatusElement = (Code)value; + VerificationStatusElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "category": - CategoryElement = (List>)value; + CategoryElement = (List>?)value!; return this; case "criticality": - CriticalityElement = (Code)value; + CriticalityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "assertedDate": - AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lastOccurrence": - LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1041,21 +1009,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatusElement is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatusElement); - if (VerificationStatusElement is not null) yield return new KeyValuePair("verificationStatus",VerificationStatusElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (CategoryElement?.Any() == true) yield return new KeyValuePair("category",CategoryElement); - if (CriticalityElement is not null) yield return new KeyValuePair("criticality",CriticalityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (AssertedDateElement is not null) yield return new KeyValuePair("assertedDate",AssertedDateElement); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",LastOccurrenceElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatusElement is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatusElement); + if (_VerificationStatusElement is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatusElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_CategoryElement?.Any() == true) yield return new KeyValuePair("category",_CategoryElement); + if (_CriticalityElement is not null) yield return new KeyValuePair("criticality",_CriticalityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_AssertedDateElement is not null) yield return new KeyValuePair("assertedDate",_AssertedDateElement); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",_LastOccurrenceElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs b/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs index 7015db2d0..4f39920e1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -68,41 +71,38 @@ public partial class Annotation : Hl7.Fhir.Model.DataType [References("Practitioner","Patient","RelatedPerson")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Author + public Hl7.Fhir.Model.DataType? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.DataType _Author; + private Hl7.Fhir.Model.DataType? _Author; /// /// When the annotation was made. /// [FhirElement("time", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the annotation was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -113,45 +113,38 @@ public string Time [FhirElement("text", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// The annotation - text content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Annotation; - - if (dest == null) - { + if(other is not Annotation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Author != null) dest.Author = (Hl7.Fhir.Model.DataType)Author.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.DataType)_Author.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -163,48 +156,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Annotation; - if(otherT == null) return false; + if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "author": - Author = (Hl7.Fhir.Model.DataType)value; + Author = (Hl7.Fhir.Model.DataType?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -215,9 +208,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Author is not null) yield return new KeyValuePair("author",Author); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs b/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs index fcc15c728..82ae2eb11 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -167,11 +170,11 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Person, Location/HealthcareService or Device. @@ -180,13 +183,13 @@ public List Type [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// required | optional | information-only. @@ -195,13 +198,13 @@ public Hl7.Fhir.Model.ResourceReference Actor [DeclaredType(Type = typeof(Code))] [Binding("ParticipantRequired")] [DataMember] - public Code RequiredElement + public Code? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Code _RequiredElement; + private Code? _RequiredElement; /// /// required | optional | information-only @@ -210,13 +213,10 @@ public Code RequiredElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.ParticipantRequired? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Code(value); + RequiredElement = value is null ? null : new Code(value); OnPropertyChanged("Required"); } } @@ -229,13 +229,13 @@ public Hl7.Fhir.Model.Appointment.ParticipantRequired? Required [Binding("ParticipationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// accepted | declined | tentative | needs-action @@ -244,31 +244,24 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ParticipationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(RequiredElement != null) dest.RequiredElement = (Code)RequiredElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Code)_RequiredElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -280,55 +273,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "required": - RequiredElement = (Code)value; + RequiredElement = (Code?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -339,10 +332,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); } } @@ -355,11 +348,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error. @@ -369,13 +362,13 @@ public List Identifier [Binding("AppointmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error @@ -384,13 +377,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -401,13 +391,13 @@ public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status [FhirElement("serviceCategory", InSummary=true, Order=110)] [Binding("service-category")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ServiceCategory + public Hl7.Fhir.Model.CodeableConcept? ServiceCategory { get { return _ServiceCategory; } set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private Hl7.Fhir.Model.CodeableConcept _ServiceCategory; + private Hl7.Fhir.Model.CodeableConcept? _ServiceCategory; /// /// The specific service that is to be performed during this appointment. @@ -418,11 +408,11 @@ public Hl7.Fhir.Model.CodeableConcept ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -433,11 +423,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that has been booked in the slot (not service type). @@ -445,13 +435,13 @@ public List Specialty [FhirElement("appointmentType", InSummary=true, Order=140)] [Binding("appointment-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AppointmentType + public Hl7.Fhir.Model.CodeableConcept? AppointmentType { get { return _AppointmentType; } set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private Hl7.Fhir.Model.CodeableConcept _AppointmentType; + private Hl7.Fhir.Model.CodeableConcept? _AppointmentType; /// /// Reason this appointment is scheduled. @@ -462,11 +452,11 @@ public Hl7.Fhir.Model.CodeableConcept AppointmentType [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Reason the appointment is to takes place (resource). @@ -478,24 +468,24 @@ public List Reason [DataMember] public List Indication { - get { if(_Indication==null) _Indication = new List(); return _Indication; } + get => _Indication ?? new List(); set { _Indication = value; OnPropertyChanged("Indication"); } } - private List _Indication; + private List? _Indication; /// /// Used to make informed decisions if needing to re-prioritize. /// [FhirElement("priority", Order=170, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.UnsignedInt PriorityElement + public Hl7.Fhir.Model.UnsignedInt? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Hl7.Fhir.Model.UnsignedInt _PriorityElement; + private Hl7.Fhir.Model.UnsignedInt? _PriorityElement; /// /// Used to make informed decisions if needing to re-prioritize @@ -504,13 +494,10 @@ public Hl7.Fhir.Model.UnsignedInt PriorityElement [IgnoreDataMember] public int? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Hl7.Fhir.Model.UnsignedInt(value); + PriorityElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Priority"); } } @@ -520,28 +507,25 @@ public int? Priority /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Shown on a subject line in a meeting request, or appointment list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -556,24 +540,24 @@ public string Description [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// When appointment is to take place. /// [FhirElement("start", InSummary=true, Order=200, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// When appointment is to take place @@ -582,13 +566,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -598,13 +579,13 @@ public DateTimeOffset? Start /// [FhirElement("end", InSummary=true, Order=210, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When appointment is to conclude @@ -613,13 +594,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -629,13 +607,13 @@ public DateTimeOffset? End /// [FhirElement("minutesDuration", Order=220)] [DataMember] - public Hl7.Fhir.Model.PositiveInt MinutesDurationElement + public Hl7.Fhir.Model.PositiveInt? MinutesDurationElement { get { return _MinutesDurationElement; } set { _MinutesDurationElement = value; OnPropertyChanged("MinutesDurationElement"); } } - private Hl7.Fhir.Model.PositiveInt _MinutesDurationElement; + private Hl7.Fhir.Model.PositiveInt? _MinutesDurationElement; /// /// Can be less than start/end (e.g. estimate) @@ -644,13 +622,10 @@ public Hl7.Fhir.Model.PositiveInt MinutesDurationElement [IgnoreDataMember] public int? MinutesDuration { - get { return MinutesDurationElement != null ? MinutesDurationElement.Value : null; } + get => _MinutesDurationElement?.Value; set { - if (value == null) - MinutesDurationElement = null; - else - MinutesDurationElement = new Hl7.Fhir.Model.PositiveInt(value); + MinutesDurationElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("MinutesDuration"); } } @@ -665,39 +640,36 @@ public int? MinutesDuration [DataMember] public List Slot { - get { if(_Slot==null) _Slot = new List(); return _Slot; } + get => _Slot ?? new List(); set { _Slot = value; OnPropertyChanged("Slot"); } } - private List _Slot; + private List? _Slot; /// /// The date that this appointment was initially created. /// [FhirElement("created", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// The date that this appointment was initially created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -707,28 +679,25 @@ public string Created /// [FhirElement("comment", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -743,11 +712,11 @@ public string Comment [DataMember] public List IncomingReferral { - get { if(_IncomingReferral==null) _IncomingReferral = new List(); return _IncomingReferral; } + get => _IncomingReferral ?? new List(); set { _IncomingReferral = value; OnPropertyChanged("IncomingReferral"); } } - private List _IncomingReferral; + private List? _IncomingReferral; /// /// Participants involved in appointment. @@ -757,11 +726,11 @@ public List IncomingReferral [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Potential date/time interval(s) requested to allocate the appointment within. @@ -771,44 +740,40 @@ public List Participant [DataMember] public List RequestedPeriod { - get { if(_RequestedPeriod==null) _RequestedPeriod = new List(); return _RequestedPeriod; } + get => _RequestedPeriod ?? new List(); set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } - private List _RequestedPeriod; + private List? _RequestedPeriod; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Appointment; - - if (dest == null) - { + if(other is not Appointment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ServiceCategory != null) dest.ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)ServiceCategory.DeepCopyInternal(); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType != null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)AppointmentType.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Indication.Any()) dest.Indication = new List(Indication.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Hl7.Fhir.Model.UnsignedInt)PriorityElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(MinutesDurationElement != null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)MinutesDurationElement.DeepCopyInternal(); - if(Slot.Any()) dest.Slot = new List(Slot.DeepCopyInternal()); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(IncomingReferral.Any()) dest.IncomingReferral = new List(IncomingReferral.DeepCopyInternal()); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(RequestedPeriod.Any()) dest.RequestedPeriod = new List(RequestedPeriod.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ServiceCategory is not null) dest.ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)_ServiceCategory.DeepCopyInternal(); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)_AppointmentType.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Indication is not null) dest.Indication = new List(_Indication.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Hl7.Fhir.Model.UnsignedInt)_PriorityElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_MinutesDurationElement is not null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)_MinutesDurationElement.DeepCopyInternal(); + if(_Slot is not null) dest.Slot = new List(_Slot.DeepCopyInternal()); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_IncomingReferral is not null) dest.IncomingReferral = new List(_IncomingReferral.DeepCopyInternal()); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_RequestedPeriod is not null) dest.RequestedPeriod = new List(_RequestedPeriod.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -820,167 +785,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Appointment; - if(otherT == null) return false; + if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(MinutesDurationElement, otherT.MinutesDurationElement)) return false; - if(!comparer.ListEquals(Slot, otherT.Slot)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(IncomingReferral, otherT.IncomingReferral)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(RequestedPeriod, otherT.RequestedPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_MinutesDurationElement, otherT._MinutesDurationElement)) return false; + if(!comparer.ListEquals(_Slot, otherT._Slot)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_IncomingReferral, otherT._IncomingReferral)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_RequestedPeriod, otherT._RequestedPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory is not null; + value = _ServiceCategory; + return _ServiceCategory is not null; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType is not null; + value = _AppointmentType; + return _AppointmentType is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "indication": - value = Indication; - return Indication?.Any() == true; + value = _Indication; + return _Indication?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "minutesDuration": - value = MinutesDurationElement; - return MinutesDurationElement is not null; + value = _MinutesDurationElement; + return _MinutesDurationElement is not null; case "slot": - value = Slot; - return Slot?.Any() == true; + value = _Slot; + return _Slot?.Any() == true; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "incomingReferral": - value = IncomingReferral; - return IncomingReferral?.Any() == true; + value = _IncomingReferral; + return _IncomingReferral?.Any() == true; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "requestedPeriod": - value = RequestedPeriod; - return RequestedPeriod?.Any() == true; + value = _RequestedPeriod; + return _RequestedPeriod?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "serviceCategory": - ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)value; + ServiceCategory = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (Hl7.Fhir.Model.CodeableConcept)value; + AppointmentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "indication": - Indication = (List)value; + Indication = (List?)value!; return this; case "priority": - PriorityElement = (Hl7.Fhir.Model.UnsignedInt)value; + PriorityElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "minutesDuration": - MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)value; + MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "slot": - Slot = (List)value; + Slot = (List?)value!; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "incomingReferral": - IncomingReferral = (List)value; + IncomingReferral = (List?)value!; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "requestedPeriod": - RequestedPeriod = (List)value; + RequestedPeriod = (List?)value!; return this; default: return base.SetValue(key, value); @@ -991,26 +956,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ServiceCategory is not null) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType is not null) yield return new KeyValuePair("appointmentType",AppointmentType); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Indication?.Any() == true) yield return new KeyValuePair("indication",Indication); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",MinutesDurationElement); - if (Slot?.Any() == true) yield return new KeyValuePair("slot",Slot); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (IncomingReferral?.Any() == true) yield return new KeyValuePair("incomingReferral",IncomingReferral); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",RequestedPeriod); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ServiceCategory is not null) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType is not null) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Indication?.Any() == true) yield return new KeyValuePair("indication",_Indication); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",_MinutesDurationElement); + if (_Slot?.Any() == true) yield return new KeyValuePair("slot",_Slot); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_IncomingReferral?.Any() == true) yield return new KeyValuePair("incomingReferral",_IncomingReferral); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",_RequestedPeriod); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs index 9b2a524fd..a50dd282a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,11 +67,11 @@ public partial class AppointmentResponse : Hl7.Fhir.Model.DomainResource, IIdent [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Appointment this response relates to. @@ -78,26 +81,26 @@ public List Identifier [References("Appointment")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Appointment + public Hl7.Fhir.Model.ResourceReference? Appointment { get { return _Appointment; } set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private Hl7.Fhir.Model.ResourceReference _Appointment; + private Hl7.Fhir.Model.ResourceReference? _Appointment; /// /// Time from appointment, or requested new start time. /// [FhirElement("start", Order=110, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Time from appointment, or requested new start time @@ -106,13 +109,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -122,13 +122,13 @@ public DateTimeOffset? Start /// [FhirElement("end", Order=120, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Time from appointment, or requested new end time @@ -137,13 +137,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -157,11 +154,11 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get { if(_ParticipantType==null) _ParticipantType = new List(); return _ParticipantType; } + get => _ParticipantType ?? new List(); set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } - private List _ParticipantType; + private List? _ParticipantType; /// /// Person, Location/HealthcareService or Device. @@ -170,13 +167,13 @@ public List ParticipantType [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// accepted | declined | tentative | in-process | completed | needs-action | entered-in-error. @@ -186,13 +183,13 @@ public Hl7.Fhir.Model.ResourceReference Actor [Binding("ParticipantStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ParticipantStatusElement + public Code? ParticipantStatusElement { get { return _ParticipantStatusElement; } set { _ParticipantStatusElement = value; OnPropertyChanged("ParticipantStatusElement"); } } - private Code _ParticipantStatusElement; + private Code? _ParticipantStatusElement; /// /// accepted | declined | tentative | in-process | completed | needs-action | entered-in-error @@ -201,13 +198,10 @@ public Code ParticipantStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ParticipationStatus? ParticipantStatus { - get { return ParticipantStatusElement != null ? ParticipantStatusElement.Value : null; } + get => _ParticipantStatusElement?.Value; set { - if (value == null) - ParticipantStatusElement = null; - else - ParticipantStatusElement = new Code(value); + ParticipantStatusElement = value is null ? null : new Code(value); OnPropertyChanged("ParticipantStatus"); } } @@ -217,28 +211,25 @@ public Hl7.Fhir.Model.ParticipationStatus? ParticipantStatus /// [FhirElement("comment", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -247,22 +238,18 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as AppointmentResponse; - - if (dest == null) - { + if(other is not AppointmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Appointment != null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)Appointment.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ParticipantType.Any()) dest.ParticipantType = new List(ParticipantType.DeepCopyInternal()); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(ParticipantStatusElement != null) dest.ParticipantStatusElement = (Code)ParticipantStatusElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)_Appointment.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ParticipantType is not null) dest.ParticipantType = new List(_ParticipantType.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_ParticipantStatusElement is not null) dest.ParticipantStatusElement = (Code)_ParticipantStatusElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -274,83 +261,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AppointmentResponse; - if(otherT == null) return false; + if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Appointment, otherT.Appointment)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.ListEquals(ParticipantType, otherT.ParticipantType)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(ParticipantStatusElement, otherT.ParticipantStatusElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.ListEquals(_ParticipantType, otherT._ParticipantType)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_ParticipantStatusElement, otherT._ParticipantStatusElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "appointment": - value = Appointment; - return Appointment is not null; + value = _Appointment; + return _Appointment is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "participantType": - value = ParticipantType; - return ParticipantType?.Any() == true; + value = _ParticipantType; + return _ParticipantType?.Any() == true; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "participantStatus": - value = ParticipantStatusElement; - return ParticipantStatusElement is not null; + value = _ParticipantStatusElement; + return _ParticipantStatusElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "appointment": - Appointment = (Hl7.Fhir.Model.ResourceReference)value; + Appointment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "participantType": - ParticipantType = (List)value; + ParticipantType = (List?)value!; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participantStatus": - ParticipantStatusElement = (Code)value; + ParticipantStatusElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -361,14 +348,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Appointment is not null) yield return new KeyValuePair("appointment",Appointment); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",ParticipantType); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",ParticipantStatusElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Appointment is not null) yield return new KeyValuePair("appointment",_Appointment); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",_ParticipantType); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",_ParticipantStatusElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs index 86c0b4b6f..3daf1a325 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -201,11 +204,11 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Direct reference to resource. @@ -214,54 +217,51 @@ public List Role [CLSCompliant(false)] [References("Practitioner","Organization","Device","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Unique identifier for the user. /// [FhirElement("userId", InSummary=true, Order=60, FiveWs="who")] [DataMember] - public Hl7.Fhir.Model.Identifier UserId + public Hl7.Fhir.Model.Identifier? UserId { get { return _UserId; } set { _UserId = value; OnPropertyChanged("UserId"); } } - private Hl7.Fhir.Model.Identifier _UserId; + private Hl7.Fhir.Model.Identifier? _UserId; /// /// Alternative User id e.g. authentication. /// [FhirElement("altId", Order=70, FiveWs="who")] [DataMember] - public Hl7.Fhir.Model.FhirString AltIdElement + public Hl7.Fhir.Model.FhirString? AltIdElement { get { return _AltIdElement; } set { _AltIdElement = value; OnPropertyChanged("AltIdElement"); } } - private Hl7.Fhir.Model.FhirString _AltIdElement; + private Hl7.Fhir.Model.FhirString? _AltIdElement; /// /// Alternative User id e.g. authentication /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AltId + public string? AltId { - get { return AltIdElement != null ? AltIdElement.Value : null; } + get => _AltIdElement?.Value; set { - if (value == null) - AltIdElement = null; - else - AltIdElement = new Hl7.Fhir.Model.FhirString(value); + AltIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AltId"); } } @@ -271,28 +271,25 @@ public string AltId /// [FhirElement("name", Order=80, FiveWs="who")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human-meaningful name for the agent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -303,13 +300,13 @@ public string Name [FhirElement("requestor", Order=90, FiveWs="who")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequestorElement + public Hl7.Fhir.Model.FhirBoolean? RequestorElement { get { return _RequestorElement; } set { _RequestorElement = value; OnPropertyChanged("RequestorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequestorElement; + private Hl7.Fhir.Model.FhirBoolean? _RequestorElement; /// /// Whether user is initiator @@ -318,13 +315,10 @@ public Hl7.Fhir.Model.FhirBoolean RequestorElement [IgnoreDataMember] public bool? Requestor { - get { return RequestorElement != null ? RequestorElement.Value : null; } + get => _RequestorElement?.Value; set { - if (value == null) - RequestorElement = null; - else - RequestorElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequestorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Requestor"); } } @@ -336,13 +330,13 @@ public bool? Requestor [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Policy that authorized event. @@ -352,24 +346,24 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy that authorized event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -382,26 +376,26 @@ public IEnumerable Policy [FhirElement("media", Order=120, FiveWs="where")] [Binding("DICOMMediaType")] [DataMember] - public Hl7.Fhir.Model.Coding Media + public Hl7.Fhir.Model.Coding? Media { get { return _Media; } set { _Media = value; OnPropertyChanged("Media"); } } - private Hl7.Fhir.Model.Coding _Media; + private Hl7.Fhir.Model.Coding? _Media; /// /// Logical network location for application activity. /// [FhirElement("network", Order=130, FiveWs="where")] [DataMember] - public Hl7.Fhir.Model.AuditEvent.NetworkComponent Network + public Hl7.Fhir.Model.AuditEvent.NetworkComponent? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.AuditEvent.NetworkComponent _Network; + private Hl7.Fhir.Model.AuditEvent.NetworkComponent? _Network; /// /// Reason given for this user. @@ -412,33 +406,29 @@ public Hl7.Fhir.Model.AuditEvent.NetworkComponent Network [DataMember] public List PurposeOfUse { - get { if(_PurposeOfUse==null) _PurposeOfUse = new List(); return _PurposeOfUse; } + get => _PurposeOfUse ?? new List(); set { _PurposeOfUse = value; OnPropertyChanged("PurposeOfUse"); } } - private List _PurposeOfUse; + private List? _PurposeOfUse; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(UserId != null) dest.UserId = (Hl7.Fhir.Model.Identifier)UserId.DeepCopyInternal(); - if(AltIdElement != null) dest.AltIdElement = (Hl7.Fhir.Model.FhirString)AltIdElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(RequestorElement != null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)RequestorElement.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Media != null) dest.Media = (Hl7.Fhir.Model.Coding)Media.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)Network.DeepCopyInternal(); - if(PurposeOfUse.Any()) dest.PurposeOfUse = new List(PurposeOfUse.DeepCopyInternal()); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_UserId is not null) dest.UserId = (Hl7.Fhir.Model.Identifier)_UserId.DeepCopyInternal(); + if(_AltIdElement is not null) dest.AltIdElement = (Hl7.Fhir.Model.FhirString)_AltIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_RequestorElement is not null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)_RequestorElement.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Media is not null) dest.Media = (Hl7.Fhir.Model.Coding)_Media.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)_Network.DeepCopyInternal(); + if(_PurposeOfUse is not null) dest.PurposeOfUse = new List(_PurposeOfUse.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -450,104 +440,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(UserId, otherT.UserId)) return false; - if(!comparer.Equals(AltIdElement, otherT.AltIdElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(RequestorElement, otherT.RequestorElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Media, otherT.Media)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(PurposeOfUse, otherT.PurposeOfUse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_UserId, otherT._UserId)) return false; + if(!comparer.Equals(_AltIdElement, otherT._AltIdElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_RequestorElement, otherT._RequestorElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Media, otherT._Media)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_PurposeOfUse, otherT._PurposeOfUse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "userId": - value = UserId; - return UserId is not null; + value = _UserId; + return _UserId is not null; case "altId": - value = AltIdElement; - return AltIdElement is not null; + value = _AltIdElement; + return _AltIdElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "requestor": - value = RequestorElement; - return RequestorElement is not null; + value = _RequestorElement; + return _RequestorElement is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "media": - value = Media; - return Media is not null; + value = _Media; + return _Media is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "purposeOfUse": - value = PurposeOfUse; - return PurposeOfUse?.Any() == true; + value = _PurposeOfUse; + return _PurposeOfUse?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (List)value; + Role = (List?)value!; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "userId": - UserId = (Hl7.Fhir.Model.Identifier)value; + UserId = (Hl7.Fhir.Model.Identifier?)value; return this; case "altId": - AltIdElement = (Hl7.Fhir.Model.FhirString)value; + AltIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestor": - RequestorElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequestorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "media": - Media = (Hl7.Fhir.Model.Coding)value; + Media = (Hl7.Fhir.Model.Coding?)value; return this; case "network": - Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)value; + Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent?)value; return this; case "purposeOfUse": - PurposeOfUse = (List)value; + PurposeOfUse = (List?)value!; return this; default: return base.SetValue(key, value); @@ -558,17 +548,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (UserId is not null) yield return new KeyValuePair("userId",UserId); - if (AltIdElement is not null) yield return new KeyValuePair("altId",AltIdElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (RequestorElement is not null) yield return new KeyValuePair("requestor",RequestorElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Media is not null) yield return new KeyValuePair("media",Media); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (PurposeOfUse?.Any() == true) yield return new KeyValuePair("purposeOfUse",PurposeOfUse); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_UserId is not null) yield return new KeyValuePair("userId",_UserId); + if (_AltIdElement is not null) yield return new KeyValuePair("altId",_AltIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_RequestorElement is not null) yield return new KeyValuePair("requestor",_RequestorElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Media is not null) yield return new KeyValuePair("media",_Media); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_PurposeOfUse?.Any() == true) yield return new KeyValuePair("purposeOfUse",_PurposeOfUse); } } @@ -594,28 +584,25 @@ public partial class NetworkComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("address", Order=40, FiveWs="where")] [DataMember] - public Hl7.Fhir.Model.FhirString AddressElement + public Hl7.Fhir.Model.FhirString? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirString _AddressElement; + private Hl7.Fhir.Model.FhirString? _AddressElement; /// /// Identifier for the network access point of the user device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirString(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Address"); } } @@ -627,13 +614,13 @@ public string Address [DeclaredType(Type = typeof(Code))] [Binding("AuditEventAgentNetworkType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// The type of network access point @@ -642,29 +629,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventAgentNetworkType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NetworkComponent; - - if (dest == null) - { + if(other is not NetworkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirString)AddressElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirString)_AddressElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -676,41 +656,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NetworkComponent; - if(otherT == null) return false; + if(other is not NetworkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "address": - AddressElement = (Hl7.Fhir.Model.FhirString)value; + AddressElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -721,8 +701,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -749,28 +729,25 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("site", Order=40, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString SiteElement + public Hl7.Fhir.Model.FhirString? SiteElement { get { return _SiteElement; } set { _SiteElement = value; OnPropertyChanged("SiteElement"); } } - private Hl7.Fhir.Model.FhirString _SiteElement; + private Hl7.Fhir.Model.FhirString? _SiteElement; /// /// Logical source location within the enterprise /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Site + public string? Site { - get { return SiteElement != null ? SiteElement.Value : null; } + get => _SiteElement?.Value; set { - if (value == null) - SiteElement = null; - else - SiteElement = new Hl7.Fhir.Model.FhirString(value); + SiteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Site"); } } @@ -781,13 +758,13 @@ public string Site [FhirElement("identifier", InSummary=true, Order=50, FiveWs="who.witness")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// The type of source where event originated. @@ -798,25 +775,21 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SiteElement != null) dest.SiteElement = (Hl7.Fhir.Model.FhirString)SiteElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); + if(_SiteElement is not null) dest.SiteElement = (Hl7.Fhir.Model.FhirString)_SiteElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -828,48 +801,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SiteElement, otherT.SiteElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = SiteElement; - return SiteElement is not null; + value = _SiteElement; + return _SiteElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - SiteElement = (Hl7.Fhir.Model.FhirString)value; + SiteElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; default: return base.SetValue(key, value); @@ -880,9 +853,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SiteElement is not null) yield return new KeyValuePair("site",SiteElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); + if (_SiteElement is not null) yield return new KeyValuePair("site",_SiteElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); } } @@ -909,13 +882,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Specific instance of resource. @@ -924,13 +897,13 @@ public Hl7.Fhir.Model.Identifier Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Type of entity involved. @@ -938,13 +911,13 @@ public Hl7.Fhir.Model.ResourceReference Reference [FhirElement("type", Order=60, FiveWs="what")] [Binding("AuditEventEntityType")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// What role the entity played. @@ -952,13 +925,13 @@ public Hl7.Fhir.Model.Coding Type [FhirElement("role", Order=70, FiveWs="context")] [Binding("AuditEventEntityRole")] [DataMember] - public Hl7.Fhir.Model.Coding Role + public Hl7.Fhir.Model.Coding? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.Coding _Role; + private Hl7.Fhir.Model.Coding? _Role; /// /// Life-cycle stage for the entity. @@ -966,13 +939,13 @@ public Hl7.Fhir.Model.Coding Role [FhirElement("lifecycle", Order=80, FiveWs="context")] [Binding("AuditEventEntityLifecycle")] [DataMember] - public Hl7.Fhir.Model.Coding Lifecycle + public Hl7.Fhir.Model.Coding? Lifecycle { get { return _Lifecycle; } set { _Lifecycle = value; OnPropertyChanged("Lifecycle"); } } - private Hl7.Fhir.Model.Coding _Lifecycle; + private Hl7.Fhir.Model.Coding? _Lifecycle; /// /// Security labels on the entity. @@ -983,39 +956,36 @@ public Hl7.Fhir.Model.Coding Lifecycle [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Descriptor for entity. /// [FhirElement("name", InSummary=true, Order=100, FiveWs="context")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptor for entity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1025,28 +995,25 @@ public string Name /// [FhirElement("description", Order=110, FiveWs="context")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Descriptive text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1056,28 +1023,25 @@ public string Description /// [FhirElement("query", InSummary=true, Order=120, FiveWs="context")] [DataMember] - public Hl7.Fhir.Model.Base64Binary QueryElement + public Hl7.Fhir.Model.Base64Binary? QueryElement { get { return _QueryElement; } set { _QueryElement = value; OnPropertyChanged("QueryElement"); } } - private Hl7.Fhir.Model.Base64Binary _QueryElement; + private Hl7.Fhir.Model.Base64Binary? _QueryElement; /// /// Query parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Query + public byte[]? Query { - get { return QueryElement != null ? QueryElement.Value : null; } + get => _QueryElement?.Value; set { - if (value == null) - QueryElement = null; - else - QueryElement = new Hl7.Fhir.Model.Base64Binary(value); + QueryElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Query"); } } @@ -1090,32 +1054,28 @@ public byte[] Query [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.Coding)Role.DeepCopyInternal(); - if(Lifecycle != null) dest.Lifecycle = (Hl7.Fhir.Model.Coding)Lifecycle.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(QueryElement != null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)QueryElement.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.Coding)_Role.DeepCopyInternal(); + if(_Lifecycle is not null) dest.Lifecycle = (Hl7.Fhir.Model.Coding)_Lifecycle.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_QueryElement is not null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)_QueryElement.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1127,97 +1087,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Lifecycle, otherT.Lifecycle)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(QueryElement, otherT.QueryElement)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Lifecycle, otherT._Lifecycle)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "lifecycle": - value = Lifecycle; - return Lifecycle is not null; + value = _Lifecycle; + return _Lifecycle is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "query": - value = QueryElement; - return QueryElement is not null; + value = _QueryElement; + return _QueryElement is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "role": - Role = (Hl7.Fhir.Model.Coding)value; + Role = (Hl7.Fhir.Model.Coding?)value; return this; case "lifecycle": - Lifecycle = (Hl7.Fhir.Model.Coding)value; + Lifecycle = (Hl7.Fhir.Model.Coding?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "query": - QueryElement = (Hl7.Fhir.Model.Base64Binary)value; + QueryElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1228,16 +1188,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Lifecycle is not null) yield return new KeyValuePair("lifecycle",Lifecycle); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (QueryElement is not null) yield return new KeyValuePair("query",QueryElement); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Lifecycle is not null) yield return new KeyValuePair("lifecycle",_Lifecycle); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_QueryElement is not null) yield return new KeyValuePair("query",_QueryElement); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -1264,28 +1224,25 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40, FiveWs="context")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Name of the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1296,44 +1253,37 @@ public string Type [FhirElement("value", Order=50, FiveWs="context")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Base64Binary ValueElement + public Hl7.Fhir.Model.Base64Binary? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.Base64Binary _ValueElement; + private Hl7.Fhir.Model.Base64Binary? _ValueElement; /// /// Property value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Value + public byte[]? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.Base64Binary(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.Base64Binary)ValueElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.Base64Binary)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1345,41 +1295,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.Base64Binary)value; + ValueElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; default: return base.SetValue(key, value); @@ -1390,8 +1340,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -1403,13 +1353,13 @@ public override IEnumerable> EnumerateElements() [Binding("AuditEventType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// More specific type/id for the event. @@ -1420,11 +1370,11 @@ public Hl7.Fhir.Model.Coding Type [DataMember] public List Subtype { - get { if(_Subtype==null) _Subtype = new List(); return _Subtype; } + get => _Subtype ?? new List(); set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private List _Subtype; + private List? _Subtype; /// /// Type of action performed during the event. @@ -1433,13 +1383,13 @@ public List Subtype [DeclaredType(Type = typeof(Code))] [Binding("AuditEventAction")] [DataMember] - public Code ActionElement + public Code? ActionElement { get { return _ActionElement; } set { _ActionElement = value; OnPropertyChanged("ActionElement"); } } - private Code _ActionElement; + private Code? _ActionElement; /// /// Type of action performed during the event @@ -1448,13 +1398,10 @@ public Code ActionElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action { - get { return ActionElement != null ? ActionElement.Value : null; } + get => _ActionElement?.Value; set { - if (value == null) - ActionElement = null; - else - ActionElement = new Code(value); + ActionElement = value is null ? null : new Code(value); OnPropertyChanged("Action"); } } @@ -1465,13 +1412,13 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action [FhirElement("recorded", InSummary=true, Order=120, FiveWs="when.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// Time when the event occurred on source @@ -1480,13 +1427,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -1498,13 +1442,13 @@ public DateTimeOffset? Recorded [DeclaredType(Type = typeof(Code))] [Binding("AuditEventOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// Whether the event succeeded or failed @@ -1513,13 +1457,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -1529,28 +1470,25 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventOutcome? Outcome /// [FhirElement("outcomeDesc", InSummary=true, Order=140, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString OutcomeDescElement + public Hl7.Fhir.Model.FhirString? OutcomeDescElement { get { return _OutcomeDescElement; } set { _OutcomeDescElement = value; OnPropertyChanged("OutcomeDescElement"); } } - private Hl7.Fhir.Model.FhirString _OutcomeDescElement; + private Hl7.Fhir.Model.FhirString? _OutcomeDescElement; /// /// Description of the event outcome /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OutcomeDesc + public string? OutcomeDesc { - get { return OutcomeDescElement != null ? OutcomeDescElement.Value : null; } + get => _OutcomeDescElement?.Value; set { - if (value == null) - OutcomeDescElement = null; - else - OutcomeDescElement = new Hl7.Fhir.Model.FhirString(value); + OutcomeDescElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OutcomeDesc"); } } @@ -1564,11 +1502,11 @@ public string OutcomeDesc [DataMember] public List PurposeOfEvent { - get { if(_PurposeOfEvent==null) _PurposeOfEvent = new List(); return _PurposeOfEvent; } + get => _PurposeOfEvent ?? new List(); set { _PurposeOfEvent = value; OnPropertyChanged("PurposeOfEvent"); } } - private List _PurposeOfEvent; + private List? _PurposeOfEvent; /// /// Actor involved in the event. @@ -1578,11 +1516,11 @@ public List PurposeOfEvent [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// Audit Event Reporter. @@ -1590,13 +1528,13 @@ public List Agent [FhirElement("source", Order=170, FiveWs="who.witness")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.AuditEvent.SourceComponent Source + public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.AuditEvent.SourceComponent _Source; + private Hl7.Fhir.Model.AuditEvent.SourceComponent? _Source; /// /// Data or objects used. @@ -1606,32 +1544,28 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent Source [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; protected internal override void CopyToInternal(Base other) { - var dest = other as AuditEvent; - - if (dest == null) - { + if(other is not AuditEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Subtype.Any()) dest.Subtype = new List(Subtype.DeepCopyInternal()); - if(ActionElement != null) dest.ActionElement = (Code)ActionElement.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(OutcomeDescElement != null) dest.OutcomeDescElement = (Hl7.Fhir.Model.FhirString)OutcomeDescElement.DeepCopyInternal(); - if(PurposeOfEvent.Any()) dest.PurposeOfEvent = new List(PurposeOfEvent.DeepCopyInternal()); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Source != null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)Source.DeepCopyInternal(); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Subtype is not null) dest.Subtype = new List(_Subtype.DeepCopyInternal()); + if(_ActionElement is not null) dest.ActionElement = (Code)_ActionElement.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_OutcomeDescElement is not null) dest.OutcomeDescElement = (Hl7.Fhir.Model.FhirString)_OutcomeDescElement.DeepCopyInternal(); + if(_PurposeOfEvent is not null) dest.PurposeOfEvent = new List(_PurposeOfEvent.DeepCopyInternal()); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)_Source.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1643,97 +1577,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AuditEvent; - if(otherT == null) return false; + if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Subtype, otherT.Subtype)) return false; - if(!comparer.Equals(ActionElement, otherT.ActionElement)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(OutcomeDescElement, otherT.OutcomeDescElement)) return false; - if(!comparer.ListEquals(PurposeOfEvent, otherT.PurposeOfEvent)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; + if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_OutcomeDescElement, otherT._OutcomeDescElement)) return false; + if(!comparer.ListEquals(_PurposeOfEvent, otherT._PurposeOfEvent)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subtype": - value = Subtype; - return Subtype?.Any() == true; + value = _Subtype; + return _Subtype?.Any() == true; case "action": - value = ActionElement; - return ActionElement is not null; + value = _ActionElement; + return _ActionElement is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "outcomeDesc": - value = OutcomeDescElement; - return OutcomeDescElement is not null; + value = _OutcomeDescElement; + return _OutcomeDescElement is not null; case "purposeOfEvent": - value = PurposeOfEvent; - return PurposeOfEvent?.Any() == true; + value = _PurposeOfEvent; + return _PurposeOfEvent?.Any() == true; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "subtype": - Subtype = (List)value; + Subtype = (List?)value!; return this; case "action": - ActionElement = (Code)value; + ActionElement = (Code?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "outcomeDesc": - OutcomeDescElement = (Hl7.Fhir.Model.FhirString)value; + OutcomeDescElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "purposeOfEvent": - PurposeOfEvent = (List)value; + PurposeOfEvent = (List?)value!; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "source": - Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)value; + Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent?)value; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1744,16 +1678,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subtype?.Any() == true) yield return new KeyValuePair("subtype",Subtype); - if (ActionElement is not null) yield return new KeyValuePair("action",ActionElement); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (OutcomeDescElement is not null) yield return new KeyValuePair("outcomeDesc",OutcomeDescElement); - if (PurposeOfEvent?.Any() == true) yield return new KeyValuePair("purposeOfEvent",PurposeOfEvent); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subtype?.Any() == true) yield return new KeyValuePair("subtype",_Subtype); + if (_ActionElement is not null) yield return new KeyValuePair("action",_ActionElement); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_OutcomeDescElement is not null) yield return new KeyValuePair("outcomeDesc",_OutcomeDescElement); + if (_PurposeOfEvent?.Any() == true) yield return new KeyValuePair("purposeOfEvent",_PurposeOfEvent); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs b/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs index 09ca30421..333840422 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Kind of Resource. @@ -80,13 +83,13 @@ public List Identifier [Binding("BasicResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Identifies the focus of this resource. @@ -95,41 +98,38 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When created. /// [FhirElement("created", InSummary=true, Order=120, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.Date CreatedElement + public Hl7.Fhir.Model.Date? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.Date _CreatedElement; + private Hl7.Fhir.Model.Date? _CreatedElement; /// /// When created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.Date(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Created"); } } @@ -141,31 +141,27 @@ public string Created [CLSCompliant(false)] [References("Practitioner","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Basic; - - if (dest == null) - { + if(other is not Basic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.Date)CreatedElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.Date)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -177,62 +173,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Basic; - if(otherT == null) return false; + if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.Date)value; + CreatedElement = (Hl7.Fhir.Model.Date?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -243,11 +239,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs b/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs index eaea7dd45..87f054665 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,24 +70,24 @@ public partial class BodySite : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this body site record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this body site record is in active use @@ -93,13 +96,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -110,13 +110,13 @@ public bool? Active [FhirElement("code", InSummary=true, Order=110, FiveWs="what")] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Modification to location code. @@ -127,39 +127,36 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Qualifier { - get { if(_Qualifier==null) _Qualifier = new List(); return _Qualifier; } + get => _Qualifier ?? new List(); set { _Qualifier = value; OnPropertyChanged("Qualifier"); } } - private List _Qualifier; + private List? _Qualifier; /// /// Anatomical location description. /// [FhirElement("description", InSummary=true, Order=130, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Anatomical location description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -172,11 +169,11 @@ public string Description [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; /// /// Who this is about. @@ -186,33 +183,29 @@ public List Image [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as BodySite; - - if (dest == null) - { + if(other is not BodySite dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Qualifier.Any()) dest.Qualifier = new List(Qualifier.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Qualifier is not null) dest.Qualifier = new List(_Qualifier.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -224,76 +217,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BodySite; - if(otherT == null) return false; + if(other is not BodySite otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Qualifier, otherT.Qualifier)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Qualifier, otherT._Qualifier)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "qualifier": - value = Qualifier; - return Qualifier?.Any() == true; + value = _Qualifier; + return _Qualifier?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualifier": - Qualifier = (List)value; + Qualifier = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -304,13 +297,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Qualifier?.Any() == true) yield return new KeyValuePair("qualifier",Qualifier); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Qualifier?.Any() == true) yield return new KeyValuePair("qualifier",_Qualifier); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs index a362ab448..0ead43ade 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -437,28 +440,25 @@ public partial class SoftwareComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name the software is known by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -468,28 +468,25 @@ public string Name /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version covered by this statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -499,45 +496,38 @@ public string Version /// [FhirElement("releaseDate", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReleaseDateElement + public Hl7.Fhir.Model.FhirDateTime? ReleaseDateElement { get { return _ReleaseDateElement; } set { _ReleaseDateElement = value; OnPropertyChanged("ReleaseDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReleaseDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ReleaseDateElement; /// /// Date this version released /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReleaseDate + public string? ReleaseDate { - get { return ReleaseDateElement != null ? ReleaseDateElement.Value : null; } + get => _ReleaseDateElement?.Value; set { - if (value == null) - ReleaseDateElement = null; - else - ReleaseDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReleaseDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ReleaseDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SoftwareComponent; - - if (dest == null) - { + if(other is not SoftwareComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(ReleaseDateElement != null) dest.ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)ReleaseDateElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_ReleaseDateElement is not null) dest.ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)_ReleaseDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -549,48 +539,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SoftwareComponent; - if(otherT == null) return false; + if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(ReleaseDateElement, otherT.ReleaseDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_ReleaseDateElement, otherT._ReleaseDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "releaseDate": - value = ReleaseDateElement; - return ReleaseDateElement is not null; + value = _ReleaseDateElement; + return _ReleaseDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "releaseDate": - ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReleaseDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -601,9 +591,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (ReleaseDateElement is not null) yield return new KeyValuePair("releaseDate",ReleaseDateElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_ReleaseDateElement is not null) yield return new KeyValuePair("releaseDate",_ReleaseDateElement); } } @@ -630,28 +620,25 @@ public partial class ImplementationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Describes this specific instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -661,44 +648,37 @@ public string Description /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Base URL for the installation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationComponent; - - if (dest == null) - { + if(other is not ImplementationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -710,41 +690,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationComponent; - if(otherT == null) return false; + if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -755,8 +735,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -786,13 +766,13 @@ public partial class RestComponent : Hl7.Fhir.Model.BackboneElement [Binding("RestfulCapabilityMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// client | server @@ -801,13 +781,10 @@ public Code ModeElemen [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.RestfulCapabilityMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -817,28 +794,25 @@ public Hl7.Fhir.Model.CapabilityStatement.RestfulCapabilityMode? Mode /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// General description of implementation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -848,13 +822,13 @@ public string Documentation /// [FhirElement("security", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent Security + public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? Security { get { return _Security; } set { _Security = value; OnPropertyChanged("Security"); } } - private Hl7.Fhir.Model.CapabilityStatement.SecurityComponent _Security; + private Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? _Security; /// /// Resource served on the REST interface. @@ -864,11 +838,11 @@ public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent Security [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// What operations are supported?. @@ -878,11 +852,11 @@ public List Resource [DataMember] public List Interaction { - get { if(_Interaction==null) _Interaction = new List(); return _Interaction; } + get => _Interaction ?? new List(); set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private List _Interaction; + private List? _Interaction; /// /// Search parameters for searching all resources. @@ -892,11 +866,11 @@ public List Inter [DataMember] public List SearchParam { - get { if(_SearchParam==null) _SearchParam = new List(); return _SearchParam; } + get => _SearchParam ?? new List(); set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } - private List _SearchParam; + private List? _SearchParam; /// /// Definition of an operation or a custom query. @@ -906,11 +880,11 @@ public List SearchParam [DataMember] public List Operation { - get { if(_Operation==null) _Operation = new List(); return _Operation; } + get => _Operation ?? new List(); set { _Operation = value; OnPropertyChanged("Operation"); } } - private List _Operation; + private List? _Operation; /// /// Compartments served/used by system. @@ -920,24 +894,24 @@ public List Operation [DataMember] public List CompartmentElement { - get { if(_CompartmentElement==null) _CompartmentElement = new List(); return _CompartmentElement; } + get => _CompartmentElement ?? new List(); set { _CompartmentElement = value; OnPropertyChanged("CompartmentElement"); } } - private List _CompartmentElement; + private List? _CompartmentElement; /// /// Compartments served/used by system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Compartment + public IEnumerable? Compartment { - get { return CompartmentElement != null ? CompartmentElement.Select(elem => elem.Value) : null; } + get => _CompartmentElement?.Select(elem => elem.Value); set { if (value == null) - CompartmentElement = null; + CompartmentElement = null!; else CompartmentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Compartment"); @@ -946,22 +920,18 @@ public IEnumerable Compartment protected internal override void CopyToInternal(Base other) { - var dest = other as RestComponent; - - if (dest == null) - { + if(other is not RestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(Security != null) dest.Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)Security.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Interaction.Any()) dest.Interaction = new List(Interaction.DeepCopyInternal()); - if(SearchParam.Any()) dest.SearchParam = new List(SearchParam.DeepCopyInternal()); - if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal()); - if(CompartmentElement.Any()) dest.CompartmentElement = new List(CompartmentElement.DeepCopyInternal()); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_Security is not null) dest.Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)_Security.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Interaction is not null) dest.Interaction = new List(_Interaction.DeepCopyInternal()); + if(_SearchParam is not null) dest.SearchParam = new List(_SearchParam.DeepCopyInternal()); + if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal()); + if(_CompartmentElement is not null) dest.CompartmentElement = new List(_CompartmentElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -973,83 +943,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RestComponent; - if(otherT == null) return false; + if(other is not RestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(Security, otherT.Security)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Interaction, otherT.Interaction)) return false; - if(!comparer.ListEquals(SearchParam, otherT.SearchParam)) return false; - if(!comparer.ListEquals(Operation, otherT.Operation)) return false; - if(!comparer.ListEquals(CompartmentElement, otherT.CompartmentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_Security, otherT._Security)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Interaction, otherT._Interaction)) return false; + if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; + if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; + if(!comparer.ListEquals(_CompartmentElement, otherT._CompartmentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "security": - value = Security; - return Security is not null; + value = _Security; + return _Security is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "interaction": - value = Interaction; - return Interaction?.Any() == true; + value = _Interaction; + return _Interaction?.Any() == true; case "searchParam": - value = SearchParam; - return SearchParam?.Any() == true; + value = _SearchParam; + return _SearchParam?.Any() == true; case "operation": - value = Operation; - return Operation?.Any() == true; + value = _Operation; + return _Operation?.Any() == true; case "compartment": - value = CompartmentElement; - return CompartmentElement?.Any() == true; + value = _CompartmentElement; + return _CompartmentElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "security": - Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent)value; + Security = (Hl7.Fhir.Model.CapabilityStatement.SecurityComponent?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "interaction": - Interaction = (List)value; + Interaction = (List?)value!; return this; case "searchParam": - SearchParam = (List)value; + SearchParam = (List?)value!; return this; case "operation": - Operation = (List)value; + Operation = (List?)value!; return this; case "compartment": - CompartmentElement = (List)value; + CompartmentElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1060,14 +1030,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Security is not null) yield return new KeyValuePair("security",Security); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Interaction?.Any() == true) yield return new KeyValuePair("interaction",Interaction); - if (SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",SearchParam); - if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation); - if (CompartmentElement?.Any() == true) yield return new KeyValuePair("compartment",CompartmentElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Security is not null) yield return new KeyValuePair("security",_Security); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Interaction?.Any() == true) yield return new KeyValuePair("interaction",_Interaction); + if (_SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",_SearchParam); + if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation); + if (_CompartmentElement?.Any() == true) yield return new KeyValuePair("compartment",_CompartmentElement); } } @@ -1093,13 +1063,13 @@ public partial class SecurityComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("cors", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CorsElement + public Hl7.Fhir.Model.FhirBoolean? CorsElement { get { return _CorsElement; } set { _CorsElement = value; OnPropertyChanged("CorsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CorsElement; + private Hl7.Fhir.Model.FhirBoolean? _CorsElement; /// /// Adds CORS Headers (http://enable-cors.org/) @@ -1108,13 +1078,10 @@ public Hl7.Fhir.Model.FhirBoolean CorsElement [IgnoreDataMember] public bool? Cors { - get { return CorsElement != null ? CorsElement.Value : null; } + get => _CorsElement?.Value; set { - if (value == null) - CorsElement = null; - else - CorsElement = new Hl7.Fhir.Model.FhirBoolean(value); + CorsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Cors"); } } @@ -1128,39 +1095,36 @@ public bool? Cors [DataMember] public List Service { - get { if(_Service==null) _Service = new List(); return _Service; } + get => _Service ?? new List(); set { _Service = value; OnPropertyChanged("Service"); } } - private List _Service; + private List? _Service; /// /// General description of how security works. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// General description of how security works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1173,26 +1137,22 @@ public string Description [DataMember] public List Certificate { - get { if(_Certificate==null) _Certificate = new List(); return _Certificate; } + get => _Certificate ?? new List(); set { _Certificate = value; OnPropertyChanged("Certificate"); } } - private List _Certificate; + private List? _Certificate; protected internal override void CopyToInternal(Base other) { - var dest = other as SecurityComponent; - - if (dest == null) - { + if(other is not SecurityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CorsElement != null) dest.CorsElement = (Hl7.Fhir.Model.FhirBoolean)CorsElement.DeepCopyInternal(); - if(Service.Any()) dest.Service = new List(Service.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Certificate.Any()) dest.Certificate = new List(Certificate.DeepCopyInternal()); + if(_CorsElement is not null) dest.CorsElement = (Hl7.Fhir.Model.FhirBoolean)_CorsElement.DeepCopyInternal(); + if(_Service is not null) dest.Service = new List(_Service.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Certificate is not null) dest.Certificate = new List(_Certificate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1204,55 +1164,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SecurityComponent; - if(otherT == null) return false; + if(other is not SecurityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CorsElement, otherT.CorsElement)) return false; - if(!comparer.ListEquals(Service, otherT.Service)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Certificate, otherT.Certificate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; + if(!comparer.ListEquals(_Service, otherT._Service)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Certificate, otherT._Certificate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "cors": - value = CorsElement; - return CorsElement is not null; + value = _CorsElement; + return _CorsElement is not null; case "service": - value = Service; - return Service?.Any() == true; + value = _Service; + return _Service?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "certificate": - value = Certificate; - return Certificate?.Any() == true; + value = _Certificate; + return _Certificate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "cors": - CorsElement = (Hl7.Fhir.Model.FhirBoolean)value; + CorsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "service": - Service = (List)value; + Service = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "certificate": - Certificate = (List)value; + Certificate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1263,10 +1223,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CorsElement is not null) yield return new KeyValuePair("cors",CorsElement); - if (Service?.Any() == true) yield return new KeyValuePair("service",Service); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Certificate?.Any() == true) yield return new KeyValuePair("certificate",Certificate); + if (_CorsElement is not null) yield return new KeyValuePair("cors",_CorsElement); + if (_Service?.Any() == true) yield return new KeyValuePair("service",_Service); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Certificate?.Any() == true) yield return new KeyValuePair("certificate",_Certificate); } } @@ -1290,28 +1250,25 @@ public partial class CertificateComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code TypeElement + public Hl7.Fhir.Model.Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.Code _TypeElement; + private Hl7.Fhir.Model.Code? _TypeElement; /// /// Mime type for certificates /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.Code(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Type"); } } @@ -1321,44 +1278,37 @@ public string Type /// [FhirElement("blob", Order=50)] [DataMember] - public Hl7.Fhir.Model.Base64Binary BlobElement + public Hl7.Fhir.Model.Base64Binary? BlobElement { get { return _BlobElement; } set { _BlobElement = value; OnPropertyChanged("BlobElement"); } } - private Hl7.Fhir.Model.Base64Binary _BlobElement; + private Hl7.Fhir.Model.Base64Binary? _BlobElement; /// /// Actual certificate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Blob + public byte[]? Blob { - get { return BlobElement != null ? BlobElement.Value : null; } + get => _BlobElement?.Value; set { - if (value == null) - BlobElement = null; - else - BlobElement = new Hl7.Fhir.Model.Base64Binary(value); + BlobElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Blob"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CertificateComponent; - - if (dest == null) - { + if(other is not CertificateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.Code)TypeElement.DeepCopyInternal(); - if(BlobElement != null) dest.BlobElement = (Hl7.Fhir.Model.Base64Binary)BlobElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.Code)_TypeElement.DeepCopyInternal(); + if(_BlobElement is not null) dest.BlobElement = (Hl7.Fhir.Model.Base64Binary)_BlobElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1370,41 +1320,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CertificateComponent; - if(otherT == null) return false; + if(other is not CertificateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(BlobElement, otherT.BlobElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_BlobElement, otherT._BlobElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "blob": - value = BlobElement; - return BlobElement is not null; + value = _BlobElement; + return _BlobElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Hl7.Fhir.Model.Code)value; + TypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "blob": - BlobElement = (Hl7.Fhir.Model.Base64Binary)value; + BlobElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; default: return base.SetValue(key, value); @@ -1415,8 +1365,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (BlobElement is not null) yield return new KeyValuePair("blob",BlobElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_BlobElement is not null) yield return new KeyValuePair("blob",_BlobElement); } } @@ -1446,13 +1396,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// A resource type that is supported @@ -1461,13 +1411,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1479,41 +1426,38 @@ public Hl7.Fhir.Model.ResourceType? Type [CLSCompliant(false)] [References("StructureDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Profile + public Hl7.Fhir.Model.ResourceReference? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.ResourceReference _Profile; + private Hl7.Fhir.Model.ResourceReference? _Profile; /// /// Additional information about the use of the resource type. /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Additional information about the use of the resource type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -1526,11 +1470,11 @@ public string Documentation [DataMember] public List Interaction { - get { if(_Interaction==null) _Interaction = new List(); return _Interaction; } + get => _Interaction ?? new List(); set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private List _Interaction; + private List? _Interaction; /// /// no-version | versioned | versioned-update. @@ -1539,13 +1483,13 @@ public List Int [DeclaredType(Type = typeof(Code))] [Binding("ResourceVersionPolicy")] [DataMember] - public Code VersioningElement + public Code? VersioningElement { get { return _VersioningElement; } set { _VersioningElement = value; OnPropertyChanged("VersioningElement"); } } - private Code _VersioningElement; + private Code? _VersioningElement; /// /// no-version | versioned | versioned-update @@ -1554,13 +1498,10 @@ public Code Versioning [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.ResourceVersionPolicy? Versioning { - get { return VersioningElement != null ? VersioningElement.Value : null; } + get => _VersioningElement?.Value; set { - if (value == null) - VersioningElement = null; - else - VersioningElement = new Code(value); + VersioningElement = value is null ? null : new Code(value); OnPropertyChanged("Versioning"); } } @@ -1570,13 +1511,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ResourceVersionPolicy? Versioning /// [FhirElement("readHistory", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReadHistoryElement + public Hl7.Fhir.Model.FhirBoolean? ReadHistoryElement { get { return _ReadHistoryElement; } set { _ReadHistoryElement = value; OnPropertyChanged("ReadHistoryElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReadHistoryElement; + private Hl7.Fhir.Model.FhirBoolean? _ReadHistoryElement; /// /// Whether vRead can return past versions @@ -1585,13 +1526,10 @@ public Hl7.Fhir.Model.FhirBoolean ReadHistoryElement [IgnoreDataMember] public bool? ReadHistory { - get { return ReadHistoryElement != null ? ReadHistoryElement.Value : null; } + get => _ReadHistoryElement?.Value; set { - if (value == null) - ReadHistoryElement = null; - else - ReadHistoryElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReadHistoryElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReadHistory"); } } @@ -1601,13 +1539,13 @@ public bool? ReadHistory /// [FhirElement("updateCreate", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean UpdateCreateElement + public Hl7.Fhir.Model.FhirBoolean? UpdateCreateElement { get { return _UpdateCreateElement; } set { _UpdateCreateElement = value; OnPropertyChanged("UpdateCreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _UpdateCreateElement; + private Hl7.Fhir.Model.FhirBoolean? _UpdateCreateElement; /// /// If update can commit to a new identity @@ -1616,13 +1554,10 @@ public Hl7.Fhir.Model.FhirBoolean UpdateCreateElement [IgnoreDataMember] public bool? UpdateCreate { - get { return UpdateCreateElement != null ? UpdateCreateElement.Value : null; } + get => _UpdateCreateElement?.Value; set { - if (value == null) - UpdateCreateElement = null; - else - UpdateCreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + UpdateCreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("UpdateCreate"); } } @@ -1632,13 +1567,13 @@ public bool? UpdateCreate /// [FhirElement("conditionalCreate", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ConditionalCreateElement + public Hl7.Fhir.Model.FhirBoolean? ConditionalCreateElement { get { return _ConditionalCreateElement; } set { _ConditionalCreateElement = value; OnPropertyChanged("ConditionalCreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ConditionalCreateElement; + private Hl7.Fhir.Model.FhirBoolean? _ConditionalCreateElement; /// /// If allows/uses conditional create @@ -1647,13 +1582,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalCreateElement [IgnoreDataMember] public bool? ConditionalCreate { - get { return ConditionalCreateElement != null ? ConditionalCreateElement.Value : null; } + get => _ConditionalCreateElement?.Value; set { - if (value == null) - ConditionalCreateElement = null; - else - ConditionalCreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + ConditionalCreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ConditionalCreate"); } } @@ -1665,13 +1597,13 @@ public bool? ConditionalCreate [DeclaredType(Type = typeof(Code))] [Binding("ConditionalReadStatus")] [DataMember] - public Code ConditionalReadElement + public Code? ConditionalReadElement { get { return _ConditionalReadElement; } set { _ConditionalReadElement = value; OnPropertyChanged("ConditionalReadElement"); } } - private Code _ConditionalReadElement; + private Code? _ConditionalReadElement; /// /// not-supported | modified-since | not-match | full-support @@ -1680,13 +1612,10 @@ public Code Conditiona [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.ConditionalReadStatus? ConditionalRead { - get { return ConditionalReadElement != null ? ConditionalReadElement.Value : null; } + get => _ConditionalReadElement?.Value; set { - if (value == null) - ConditionalReadElement = null; - else - ConditionalReadElement = new Code(value); + ConditionalReadElement = value is null ? null : new Code(value); OnPropertyChanged("ConditionalRead"); } } @@ -1696,13 +1625,13 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalReadStatus? ConditionalRead /// [FhirElement("conditionalUpdate", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ConditionalUpdateElement + public Hl7.Fhir.Model.FhirBoolean? ConditionalUpdateElement { get { return _ConditionalUpdateElement; } set { _ConditionalUpdateElement = value; OnPropertyChanged("ConditionalUpdateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ConditionalUpdateElement; + private Hl7.Fhir.Model.FhirBoolean? _ConditionalUpdateElement; /// /// If allows/uses conditional update @@ -1711,13 +1640,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalUpdateElement [IgnoreDataMember] public bool? ConditionalUpdate { - get { return ConditionalUpdateElement != null ? ConditionalUpdateElement.Value : null; } + get => _ConditionalUpdateElement?.Value; set { - if (value == null) - ConditionalUpdateElement = null; - else - ConditionalUpdateElement = new Hl7.Fhir.Model.FhirBoolean(value); + ConditionalUpdateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ConditionalUpdate"); } } @@ -1729,13 +1655,13 @@ public bool? ConditionalUpdate [DeclaredType(Type = typeof(Code))] [Binding("ConditionalDeleteStatus")] [DataMember] - public Code ConditionalDeleteElement + public Code? ConditionalDeleteElement { get { return _ConditionalDeleteElement; } set { _ConditionalDeleteElement = value; OnPropertyChanged("ConditionalDeleteElement"); } } - private Code _ConditionalDeleteElement; + private Code? _ConditionalDeleteElement; /// /// not-supported | single | multiple - how conditional delete is supported @@ -1744,13 +1670,10 @@ public Code Conditio [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDelete { - get { return ConditionalDeleteElement != null ? ConditionalDeleteElement.Value : null; } + get => _ConditionalDeleteElement?.Value; set { - if (value == null) - ConditionalDeleteElement = null; - else - ConditionalDeleteElement = new Code(value); + ConditionalDeleteElement = value is null ? null : new Code(value); OnPropertyChanged("ConditionalDelete"); } } @@ -1765,24 +1688,24 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDe [DataMember] public List> ReferencePolicyElement { - get { if(_ReferencePolicyElement==null) _ReferencePolicyElement = new List>(); return _ReferencePolicyElement; } + get => _ReferencePolicyElement ?? new List>(); set { _ReferencePolicyElement = value; OnPropertyChanged("ReferencePolicyElement"); } } - private List> _ReferencePolicyElement; + private List>? _ReferencePolicyElement; /// /// literal | logical | resolves | enforced | local /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ReferencePolicy + public IEnumerable? ReferencePolicy { - get { return ReferencePolicyElement != null ? ReferencePolicyElement.Select(elem => elem.Value) : null; } + get => _ReferencePolicyElement?.Select(elem => elem.Value); set { if (value == null) - ReferencePolicyElement = null; + ReferencePolicyElement = null!; else ReferencePolicyElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("ReferencePolicy"); @@ -1797,24 +1720,24 @@ public IEnumerable [DataMember] public List SearchIncludeElement { - get { if(_SearchIncludeElement==null) _SearchIncludeElement = new List(); return _SearchIncludeElement; } + get => _SearchIncludeElement ?? new List(); set { _SearchIncludeElement = value; OnPropertyChanged("SearchIncludeElement"); } } - private List _SearchIncludeElement; + private List? _SearchIncludeElement; /// /// _include values supported by the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SearchInclude + public IEnumerable? SearchInclude { - get { return SearchIncludeElement != null ? SearchIncludeElement.Select(elem => elem.Value) : null; } + get => _SearchIncludeElement?.Select(elem => elem.Value); set { if (value == null) - SearchIncludeElement = null; + SearchIncludeElement = null!; else SearchIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("SearchInclude"); @@ -1829,24 +1752,24 @@ public IEnumerable SearchInclude [DataMember] public List SearchRevIncludeElement { - get { if(_SearchRevIncludeElement==null) _SearchRevIncludeElement = new List(); return _SearchRevIncludeElement; } + get => _SearchRevIncludeElement ?? new List(); set { _SearchRevIncludeElement = value; OnPropertyChanged("SearchRevIncludeElement"); } } - private List _SearchRevIncludeElement; + private List? _SearchRevIncludeElement; /// /// _revinclude values supported by the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SearchRevInclude + public IEnumerable? SearchRevInclude { - get { return SearchRevIncludeElement != null ? SearchRevIncludeElement.Select(elem => elem.Value) : null; } + get => _SearchRevIncludeElement?.Select(elem => elem.Value); set { if (value == null) - SearchRevIncludeElement = null; + SearchRevIncludeElement = null!; else SearchRevIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("SearchRevInclude"); @@ -1861,37 +1784,33 @@ public IEnumerable SearchRevInclude [DataMember] public List SearchParam { - get { if(_SearchParam==null) _SearchParam = new List(); return _SearchParam; } + get => _SearchParam ?? new List(); set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } - private List _SearchParam; + private List? _SearchParam; protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)Profile.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(Interaction.Any()) dest.Interaction = new List(Interaction.DeepCopyInternal()); - if(VersioningElement != null) dest.VersioningElement = (Code)VersioningElement.DeepCopyInternal(); - if(ReadHistoryElement != null) dest.ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)ReadHistoryElement.DeepCopyInternal(); - if(UpdateCreateElement != null) dest.UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)UpdateCreateElement.DeepCopyInternal(); - if(ConditionalCreateElement != null) dest.ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalCreateElement.DeepCopyInternal(); - if(ConditionalReadElement != null) dest.ConditionalReadElement = (Code)ConditionalReadElement.DeepCopyInternal(); - if(ConditionalUpdateElement != null) dest.ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalUpdateElement.DeepCopyInternal(); - if(ConditionalDeleteElement != null) dest.ConditionalDeleteElement = (Code)ConditionalDeleteElement.DeepCopyInternal(); - if(ReferencePolicyElement.Any()) dest.ReferencePolicyElement = new List>(ReferencePolicyElement.DeepCopyInternal()); - if(SearchIncludeElement.Any()) dest.SearchIncludeElement = new List(SearchIncludeElement.DeepCopyInternal()); - if(SearchRevIncludeElement.Any()) dest.SearchRevIncludeElement = new List(SearchRevIncludeElement.DeepCopyInternal()); - if(SearchParam.Any()) dest.SearchParam = new List(SearchParam.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)_Profile.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_Interaction is not null) dest.Interaction = new List(_Interaction.DeepCopyInternal()); + if(_VersioningElement is not null) dest.VersioningElement = (Code)_VersioningElement.DeepCopyInternal(); + if(_ReadHistoryElement is not null) dest.ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)_ReadHistoryElement.DeepCopyInternal(); + if(_UpdateCreateElement is not null) dest.UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)_UpdateCreateElement.DeepCopyInternal(); + if(_ConditionalCreateElement is not null) dest.ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalCreateElement.DeepCopyInternal(); + if(_ConditionalReadElement is not null) dest.ConditionalReadElement = (Code)_ConditionalReadElement.DeepCopyInternal(); + if(_ConditionalUpdateElement is not null) dest.ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalUpdateElement.DeepCopyInternal(); + if(_ConditionalDeleteElement is not null) dest.ConditionalDeleteElement = (Code)_ConditionalDeleteElement.DeepCopyInternal(); + if(_ReferencePolicyElement is not null) dest.ReferencePolicyElement = new List>(_ReferencePolicyElement.DeepCopyInternal()); + if(_SearchIncludeElement is not null) dest.SearchIncludeElement = new List(_SearchIncludeElement.DeepCopyInternal()); + if(_SearchRevIncludeElement is not null) dest.SearchRevIncludeElement = new List(_SearchRevIncludeElement.DeepCopyInternal()); + if(_SearchParam is not null) dest.SearchParam = new List(_SearchParam.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1903,132 +1822,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(Interaction, otherT.Interaction)) return false; - if(!comparer.Equals(VersioningElement, otherT.VersioningElement)) return false; - if(!comparer.Equals(ReadHistoryElement, otherT.ReadHistoryElement)) return false; - if(!comparer.Equals(UpdateCreateElement, otherT.UpdateCreateElement)) return false; - if(!comparer.Equals(ConditionalCreateElement, otherT.ConditionalCreateElement)) return false; - if(!comparer.Equals(ConditionalReadElement, otherT.ConditionalReadElement)) return false; - if(!comparer.Equals(ConditionalUpdateElement, otherT.ConditionalUpdateElement)) return false; - if(!comparer.Equals(ConditionalDeleteElement, otherT.ConditionalDeleteElement)) return false; - if(!comparer.ListEquals(ReferencePolicyElement, otherT.ReferencePolicyElement)) return false; - if(!comparer.ListEquals(SearchIncludeElement, otherT.SearchIncludeElement)) return false; - if(!comparer.ListEquals(SearchRevIncludeElement, otherT.SearchRevIncludeElement)) return false; - if(!comparer.ListEquals(SearchParam, otherT.SearchParam)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_Interaction, otherT._Interaction)) return false; + if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false; + if(!comparer.Equals(_ReadHistoryElement, otherT._ReadHistoryElement)) return false; + if(!comparer.Equals(_UpdateCreateElement, otherT._UpdateCreateElement)) return false; + if(!comparer.Equals(_ConditionalCreateElement, otherT._ConditionalCreateElement)) return false; + if(!comparer.Equals(_ConditionalReadElement, otherT._ConditionalReadElement)) return false; + if(!comparer.Equals(_ConditionalUpdateElement, otherT._ConditionalUpdateElement)) return false; + if(!comparer.Equals(_ConditionalDeleteElement, otherT._ConditionalDeleteElement)) return false; + if(!comparer.ListEquals(_ReferencePolicyElement, otherT._ReferencePolicyElement)) return false; + if(!comparer.ListEquals(_SearchIncludeElement, otherT._SearchIncludeElement)) return false; + if(!comparer.ListEquals(_SearchRevIncludeElement, otherT._SearchRevIncludeElement)) return false; + if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "interaction": - value = Interaction; - return Interaction?.Any() == true; + value = _Interaction; + return _Interaction?.Any() == true; case "versioning": - value = VersioningElement; - return VersioningElement is not null; + value = _VersioningElement; + return _VersioningElement is not null; case "readHistory": - value = ReadHistoryElement; - return ReadHistoryElement is not null; + value = _ReadHistoryElement; + return _ReadHistoryElement is not null; case "updateCreate": - value = UpdateCreateElement; - return UpdateCreateElement is not null; + value = _UpdateCreateElement; + return _UpdateCreateElement is not null; case "conditionalCreate": - value = ConditionalCreateElement; - return ConditionalCreateElement is not null; + value = _ConditionalCreateElement; + return _ConditionalCreateElement is not null; case "conditionalRead": - value = ConditionalReadElement; - return ConditionalReadElement is not null; + value = _ConditionalReadElement; + return _ConditionalReadElement is not null; case "conditionalUpdate": - value = ConditionalUpdateElement; - return ConditionalUpdateElement is not null; + value = _ConditionalUpdateElement; + return _ConditionalUpdateElement is not null; case "conditionalDelete": - value = ConditionalDeleteElement; - return ConditionalDeleteElement is not null; + value = _ConditionalDeleteElement; + return _ConditionalDeleteElement is not null; case "referencePolicy": - value = ReferencePolicyElement; - return ReferencePolicyElement?.Any() == true; + value = _ReferencePolicyElement; + return _ReferencePolicyElement?.Any() == true; case "searchInclude": - value = SearchIncludeElement; - return SearchIncludeElement?.Any() == true; + value = _SearchIncludeElement; + return _SearchIncludeElement?.Any() == true; case "searchRevInclude": - value = SearchRevIncludeElement; - return SearchRevIncludeElement?.Any() == true; + value = _SearchRevIncludeElement; + return _SearchRevIncludeElement?.Any() == true; case "searchParam": - value = SearchParam; - return SearchParam?.Any() == true; + value = _SearchParam; + return _SearchParam?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.ResourceReference)value; + Profile = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "interaction": - Interaction = (List)value; + Interaction = (List?)value!; return this; case "versioning": - VersioningElement = (Code)value; + VersioningElement = (Code?)value; return this; case "readHistory": - ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReadHistoryElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "updateCreate": - UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + UpdateCreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "conditionalCreate": - ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + ConditionalCreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "conditionalRead": - ConditionalReadElement = (Code)value; + ConditionalReadElement = (Code?)value; return this; case "conditionalUpdate": - ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean)value; + ConditionalUpdateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "conditionalDelete": - ConditionalDeleteElement = (Code)value; + ConditionalDeleteElement = (Code?)value; return this; case "referencePolicy": - ReferencePolicyElement = (List>)value; + ReferencePolicyElement = (List>?)value!; return this; case "searchInclude": - SearchIncludeElement = (List)value; + SearchIncludeElement = (List?)value!; return this; case "searchRevInclude": - SearchRevIncludeElement = (List)value; + SearchRevIncludeElement = (List?)value!; return this; case "searchParam": - SearchParam = (List)value; + SearchParam = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2039,21 +1958,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Interaction?.Any() == true) yield return new KeyValuePair("interaction",Interaction); - if (VersioningElement is not null) yield return new KeyValuePair("versioning",VersioningElement); - if (ReadHistoryElement is not null) yield return new KeyValuePair("readHistory",ReadHistoryElement); - if (UpdateCreateElement is not null) yield return new KeyValuePair("updateCreate",UpdateCreateElement); - if (ConditionalCreateElement is not null) yield return new KeyValuePair("conditionalCreate",ConditionalCreateElement); - if (ConditionalReadElement is not null) yield return new KeyValuePair("conditionalRead",ConditionalReadElement); - if (ConditionalUpdateElement is not null) yield return new KeyValuePair("conditionalUpdate",ConditionalUpdateElement); - if (ConditionalDeleteElement is not null) yield return new KeyValuePair("conditionalDelete",ConditionalDeleteElement); - if (ReferencePolicyElement?.Any() == true) yield return new KeyValuePair("referencePolicy",ReferencePolicyElement); - if (SearchIncludeElement?.Any() == true) yield return new KeyValuePair("searchInclude",SearchIncludeElement); - if (SearchRevIncludeElement?.Any() == true) yield return new KeyValuePair("searchRevInclude",SearchRevIncludeElement); - if (SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",SearchParam); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Interaction?.Any() == true) yield return new KeyValuePair("interaction",_Interaction); + if (_VersioningElement is not null) yield return new KeyValuePair("versioning",_VersioningElement); + if (_ReadHistoryElement is not null) yield return new KeyValuePair("readHistory",_ReadHistoryElement); + if (_UpdateCreateElement is not null) yield return new KeyValuePair("updateCreate",_UpdateCreateElement); + if (_ConditionalCreateElement is not null) yield return new KeyValuePair("conditionalCreate",_ConditionalCreateElement); + if (_ConditionalReadElement is not null) yield return new KeyValuePair("conditionalRead",_ConditionalReadElement); + if (_ConditionalUpdateElement is not null) yield return new KeyValuePair("conditionalUpdate",_ConditionalUpdateElement); + if (_ConditionalDeleteElement is not null) yield return new KeyValuePair("conditionalDelete",_ConditionalDeleteElement); + if (_ReferencePolicyElement?.Any() == true) yield return new KeyValuePair("referencePolicy",_ReferencePolicyElement); + if (_SearchIncludeElement?.Any() == true) yield return new KeyValuePair("searchInclude",_SearchIncludeElement); + if (_SearchRevIncludeElement?.Any() == true) yield return new KeyValuePair("searchRevInclude",_SearchRevIncludeElement); + if (_SearchParam?.Any() == true) yield return new KeyValuePair("searchParam",_SearchParam); } } @@ -2082,13 +2001,13 @@ public partial class ResourceInteractionComponent : Hl7.Fhir.Model.BackboneEleme [Binding("TypeRestfulInteraction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// read | vread | update | patch | delete | history-instance | history-type | create | search-type @@ -2097,13 +2016,10 @@ public Code CodeEleme [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.TypeRestfulInteraction? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -2113,44 +2029,37 @@ public Hl7.Fhir.Model.CapabilityStatement.TypeRestfulInteraction? Code /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Anything special about operation behavior /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceInteractionComponent; - - if (dest == null) - { + if(other is not ResourceInteractionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2162,41 +2071,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceInteractionComponent; - if(otherT == null) return false; + if(other is not ResourceInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2207,8 +2116,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -2235,28 +2144,25 @@ public partial class SearchParamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2266,28 +2172,25 @@ public string Name /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// Source of definition for parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -2300,13 +2203,13 @@ public string Definition [Binding("SearchParamType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// number | date | string | token | reference | composite | quantity | uri @@ -2315,13 +2218,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2331,46 +2231,39 @@ public Hl7.Fhir.Model.SearchParamType? Type /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Server-specific usage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SearchParamComponent; - - if (dest == null) - { + if(other is not SearchParamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2382,55 +2275,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SearchParamComponent; - if(otherT == null) return false; + if(other is not SearchParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2441,10 +2334,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -2473,13 +2366,13 @@ public partial class SystemInteractionComponent : Hl7.Fhir.Model.BackboneElement [Binding("SystemRestfulInteraction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// transaction | batch | search-system | history-system @@ -2488,13 +2381,10 @@ public Code CodeEle [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.SystemRestfulInteraction? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -2504,44 +2394,37 @@ public Hl7.Fhir.Model.CapabilityStatement.SystemRestfulInteraction? Code /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Anything special about operation behavior /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SystemInteractionComponent; - - if (dest == null) - { + if(other is not SystemInteractionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2553,41 +2436,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SystemInteractionComponent; - if(otherT == null) return false; + if(other is not SystemInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2598,8 +2481,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -2626,28 +2509,25 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name by which the operation/query is invoked /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2660,26 +2540,22 @@ public string Name [References("OperationDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2691,41 +2567,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -2736,8 +2612,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); } } @@ -2767,24 +2643,24 @@ public partial class MessagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Reliable Message Cache Length (min). /// [FhirElement("reliableCache", Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt ReliableCacheElement + public Hl7.Fhir.Model.UnsignedInt? ReliableCacheElement { get { return _ReliableCacheElement; } set { _ReliableCacheElement = value; OnPropertyChanged("ReliableCacheElement"); } } - private Hl7.Fhir.Model.UnsignedInt _ReliableCacheElement; + private Hl7.Fhir.Model.UnsignedInt? _ReliableCacheElement; /// /// Reliable Message Cache Length (min) @@ -2793,13 +2669,10 @@ public Hl7.Fhir.Model.UnsignedInt ReliableCacheElement [IgnoreDataMember] public int? ReliableCache { - get { return ReliableCacheElement != null ? ReliableCacheElement.Value : null; } + get => _ReliableCacheElement?.Value; set { - if (value == null) - ReliableCacheElement = null; - else - ReliableCacheElement = new Hl7.Fhir.Model.UnsignedInt(value); + ReliableCacheElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("ReliableCache"); } } @@ -2809,28 +2682,25 @@ public int? ReliableCache /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Messaging interface behavior details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -2843,11 +2713,11 @@ public string Documentation [DataMember] public List SupportedMessage { - get { if(_SupportedMessage==null) _SupportedMessage = new List(); return _SupportedMessage; } + get => _SupportedMessage ?? new List(); set { _SupportedMessage = value; OnPropertyChanged("SupportedMessage"); } } - private List _SupportedMessage; + private List? _SupportedMessage; /// /// Declare support for this event. @@ -2857,27 +2727,23 @@ public List Suppor [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; protected internal override void CopyToInternal(Base other) { - var dest = other as MessagingComponent; - - if (dest == null) - { + if(other is not MessagingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(ReliableCacheElement != null) dest.ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)ReliableCacheElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(SupportedMessage.Any()) dest.SupportedMessage = new List(SupportedMessage.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_ReliableCacheElement is not null) dest.ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)_ReliableCacheElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_SupportedMessage is not null) dest.SupportedMessage = new List(_SupportedMessage.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2889,62 +2755,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessagingComponent; - if(otherT == null) return false; + if(other is not MessagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(ReliableCacheElement, otherT.ReliableCacheElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(SupportedMessage, otherT.SupportedMessage)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_ReliableCacheElement, otherT._ReliableCacheElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_SupportedMessage, otherT._SupportedMessage)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "reliableCache": - value = ReliableCacheElement; - return ReliableCacheElement is not null; + value = _ReliableCacheElement; + return _ReliableCacheElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "supportedMessage": - value = SupportedMessage; - return SupportedMessage?.Any() == true; + value = _SupportedMessage; + return _SupportedMessage?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "reliableCache": - ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt)value; + ReliableCacheElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "supportedMessage": - SupportedMessage = (List)value; + SupportedMessage = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2955,11 +2821,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (ReliableCacheElement is not null) yield return new KeyValuePair("reliableCache",ReliableCacheElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (SupportedMessage?.Any() == true) yield return new KeyValuePair("supportedMessage",SupportedMessage); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_ReliableCacheElement is not null) yield return new KeyValuePair("reliableCache",_ReliableCacheElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_SupportedMessage?.Any() == true) yield return new KeyValuePair("supportedMessage",_SupportedMessage); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); } } @@ -2987,13 +2853,13 @@ public partial class EndpointComponent : Hl7.Fhir.Model.BackboneElement [Binding("MessageTransport")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Protocol + public Hl7.Fhir.Model.Coding? Protocol { get { return _Protocol; } set { _Protocol = value; OnPropertyChanged("Protocol"); } } - private Hl7.Fhir.Model.Coding _Protocol; + private Hl7.Fhir.Model.Coding? _Protocol; /// /// Network address or identifier of the end-point. @@ -3001,44 +2867,37 @@ public Hl7.Fhir.Model.Coding Protocol [FhirElement("address", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri AddressElement + public Hl7.Fhir.Model.FhirUri? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirUri _AddressElement; + private Hl7.Fhir.Model.FhirUri? _AddressElement; /// /// Network address or identifier of the end-point /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirUri(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Address"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EndpointComponent; - - if (dest == null) - { + if(other is not EndpointComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Protocol != null) dest.Protocol = (Hl7.Fhir.Model.Coding)Protocol.DeepCopyInternal(); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirUri)AddressElement.DeepCopyInternal(); + if(_Protocol is not null) dest.Protocol = (Hl7.Fhir.Model.Coding)_Protocol.DeepCopyInternal(); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirUri)_AddressElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3050,41 +2909,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EndpointComponent; - if(otherT == null) return false; + if(other is not EndpointComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Protocol, otherT.Protocol)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "protocol": - value = Protocol; - return Protocol is not null; + value = _Protocol; + return _Protocol is not null; case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "protocol": - Protocol = (Hl7.Fhir.Model.Coding)value; + Protocol = (Hl7.Fhir.Model.Coding?)value; return this; case "address": - AddressElement = (Hl7.Fhir.Model.FhirUri)value; + AddressElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -3095,8 +2954,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Protocol is not null) yield return new KeyValuePair("protocol",Protocol); - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); + if (_Protocol is not null) yield return new KeyValuePair("protocol",_Protocol); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); } } @@ -3126,13 +2985,13 @@ public partial class SupportedMessageComponent : Hl7.Fhir.Model.BackboneElement [Binding("EventCapabilityMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// sender | receiver @@ -3141,13 +3000,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -3160,26 +3016,22 @@ public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode [References("MessageDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportedMessageComponent; - - if (dest == null) - { + if(other is not SupportedMessageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3191,41 +3043,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportedMessageComponent; - if(otherT == null) return false; + if(other is not SupportedMessageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -3236,8 +3088,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); } } @@ -3266,13 +3118,13 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [Binding("MessageEvent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Code + public Hl7.Fhir.Model.Coding? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.Coding _Code; + private Hl7.Fhir.Model.Coding? _Code; /// /// Consequence | Currency | Notification. @@ -3281,13 +3133,13 @@ public Hl7.Fhir.Model.Coding Code [DeclaredType(Type = typeof(Code))] [Binding("MessageSignificanceCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// Consequence | Currency | Notification @@ -3296,13 +3148,10 @@ public Code CategoryElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageSignificanceCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -3315,13 +3164,13 @@ public Hl7.Fhir.Model.MessageSignificanceCategory? Category [Binding("EventCapabilityMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// sender | receiver @@ -3330,13 +3179,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -3349,13 +3195,13 @@ public Hl7.Fhir.Model.CapabilityStatement.EventCapabilityMode? Mode [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code FocusElement + public Code? FocusElement { get { return _FocusElement; } set { _FocusElement = value; OnPropertyChanged("FocusElement"); } } - private Code _FocusElement; + private Code? _FocusElement; /// /// Resource that's focus of message @@ -3364,13 +3210,10 @@ public Code FocusElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Focus { - get { return FocusElement != null ? FocusElement.Value : null; } + get => _FocusElement?.Value; set { - if (value == null) - FocusElement = null; - else - FocusElement = new Code(value); + FocusElement = value is null ? null : new Code(value); OnPropertyChanged("Focus"); } } @@ -3383,13 +3226,13 @@ public Hl7.Fhir.Model.ResourceType? Focus [References("StructureDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Profile that describes the response. @@ -3399,62 +3242,55 @@ public Hl7.Fhir.Model.ResourceReference Request [References("StructureDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Endpoint-specific event documentation. /// [FhirElement("documentation", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Endpoint-specific event documentation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.Coding)Code.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(FocusElement != null) dest.FocusElement = (Code)FocusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.Coding)_Code.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_FocusElement is not null) dest.FocusElement = (Code)_FocusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3466,76 +3302,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(FocusElement, otherT.FocusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_FocusElement, otherT._FocusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "focus": - value = FocusElement; - return FocusElement is not null; + value = _FocusElement; + return _FocusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.Coding)value; + Code = (Hl7.Fhir.Model.Coding?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "focus": - FocusElement = (Code)value; + FocusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3546,13 +3382,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (FocusElement is not null) yield return new KeyValuePair("focus",FocusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_FocusElement is not null) yield return new KeyValuePair("focus",_FocusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -3581,13 +3417,13 @@ public partial class DocumentComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// producer | consumer @@ -3596,13 +3432,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.DocumentMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -3612,28 +3445,25 @@ public Hl7.Fhir.Model.CapabilityStatement.DocumentMode? Mode /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Description of document support /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -3646,27 +3476,23 @@ public string Documentation [References("StructureDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Profile + public Hl7.Fhir.Model.ResourceReference? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.ResourceReference _Profile; + private Hl7.Fhir.Model.ResourceReference? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentComponent; - - if (dest == null) - { + if(other is not DocumentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)Profile.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3678,48 +3504,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentComponent; - if(otherT == null) return false; + if(other is not DocumentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.ResourceReference)value; + Profile = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -3730,9 +3556,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -3742,28 +3568,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this capability statement (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -3773,28 +3596,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the capability statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -3804,28 +3624,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this capability statement (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3835,28 +3652,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this capability statement (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -3869,13 +3683,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -3884,13 +3698,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3900,13 +3711,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=140, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -3915,13 +3726,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -3932,28 +3740,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=150, FiveWs="when.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -3963,28 +3768,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -3997,39 +3799,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the capability statement. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the capability statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -4042,11 +3841,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for capability statement (if applicable). @@ -4057,39 +3856,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this capability statement is defined. /// [FhirElement("purpose", Order=210, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this capability statement is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -4099,28 +3895,25 @@ public string Purpose /// [FhirElement("copyright", Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -4133,13 +3926,13 @@ public string Copyright [Binding("CapabilityStatementKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// instance | capability | requirements @@ -4148,13 +3941,10 @@ public Code KindElem [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.CapabilityStatementKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -4167,24 +3957,24 @@ public Hl7.Fhir.Model.CapabilityStatement.CapabilityStatementKind? Kind [DataMember] public List InstantiatesElement { - get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; } + get => _InstantiatesElement ?? new List(); set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } - private List _InstantiatesElement; + private List? _InstantiatesElement; /// /// Canonical URL of another capability statement this implements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Instantiates + public IEnumerable? Instantiates { - get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; } + get => _InstantiatesElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesElement = null; + InstantiatesElement = null!; else InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Instantiates"); @@ -4196,26 +3986,26 @@ public IEnumerable Instantiates /// [FhirElement("software", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent Software + public Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent? Software { get { return _Software; } set { _Software = value; OnPropertyChanged("Software"); } } - private Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent _Software; + private Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent? _Software; /// /// If this describes a specific instance. /// [FhirElement("implementation", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent Implementation + public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent? Implementation { get { return _Implementation; } set { _Implementation = value; OnPropertyChanged("Implementation"); } } - private Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent _Implementation; + private Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent? _Implementation; /// /// FHIR Version the system uses. @@ -4223,28 +4013,25 @@ public Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent Implementation [FhirElement("fhirVersion", InSummary=true, Order=270)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id FhirVersionElement + public Hl7.Fhir.Model.Id? FhirVersionElement { get { return _FhirVersionElement; } set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private Hl7.Fhir.Model.Id _FhirVersionElement; + private Hl7.Fhir.Model.Id? _FhirVersionElement; /// /// FHIR Version the system uses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FhirVersion + public string? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Value : null; } + get => _FhirVersionElement?.Value; set { - if (value == null) - FhirVersionElement = null; - else - FhirVersionElement = new Hl7.Fhir.Model.Id(value); + FhirVersionElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("FhirVersion"); } } @@ -4257,13 +4044,13 @@ public string FhirVersion [Binding("UnknownContentCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code AcceptUnknownElement + public Code? AcceptUnknownElement { get { return _AcceptUnknownElement; } set { _AcceptUnknownElement = value; OnPropertyChanged("AcceptUnknownElement"); } } - private Code _AcceptUnknownElement; + private Code? _AcceptUnknownElement; /// /// no | extensions | elements | both @@ -4272,13 +4059,10 @@ public Code AcceptUnknown [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatement.UnknownContentCode? AcceptUnknown { - get { return AcceptUnknownElement != null ? AcceptUnknownElement.Value : null; } + get => _AcceptUnknownElement?.Value; set { - if (value == null) - AcceptUnknownElement = null; - else - AcceptUnknownElement = new Code(value); + AcceptUnknownElement = value is null ? null : new Code(value); OnPropertyChanged("AcceptUnknown"); } } @@ -4292,24 +4076,24 @@ public Hl7.Fhir.Model.CapabilityStatement.UnknownContentCode? AcceptUnknown [DataMember] public List FormatElement { - get { if(_FormatElement==null) _FormatElement = new List(); return _FormatElement; } + get => _FormatElement ?? new List(); set { _FormatElement = value; OnPropertyChanged("FormatElement"); } } - private List _FormatElement; + private List? _FormatElement; /// /// formats supported (xml | json | ttl | mime type) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Format + public IEnumerable? Format { - get { return FormatElement != null ? FormatElement.Select(elem => elem.Value) : null; } + get => _FormatElement?.Select(elem => elem.Value); set { if (value == null) - FormatElement = null; + FormatElement = null!; else FormatElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Format"); @@ -4325,24 +4109,24 @@ public IEnumerable Format [DataMember] public List PatchFormatElement { - get { if(_PatchFormatElement==null) _PatchFormatElement = new List(); return _PatchFormatElement; } + get => _PatchFormatElement ?? new List(); set { _PatchFormatElement = value; OnPropertyChanged("PatchFormatElement"); } } - private List _PatchFormatElement; + private List? _PatchFormatElement; /// /// Patch formats supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PatchFormat + public IEnumerable? PatchFormat { - get { return PatchFormatElement != null ? PatchFormatElement.Select(elem => elem.Value) : null; } + get => _PatchFormatElement?.Select(elem => elem.Value); set { if (value == null) - PatchFormatElement = null; + PatchFormatElement = null!; else PatchFormatElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("PatchFormat"); @@ -4357,24 +4141,24 @@ public IEnumerable PatchFormat [DataMember] public List ImplementationGuideElement { - get { if(_ImplementationGuideElement==null) _ImplementationGuideElement = new List(); return _ImplementationGuideElement; } + get => _ImplementationGuideElement ?? new List(); set { _ImplementationGuideElement = value; OnPropertyChanged("ImplementationGuideElement"); } } - private List _ImplementationGuideElement; + private List? _ImplementationGuideElement; /// /// Implementation guides supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ImplementationGuide + public IEnumerable? ImplementationGuide { - get { return ImplementationGuideElement != null ? ImplementationGuideElement.Select(elem => elem.Value) : null; } + get => _ImplementationGuideElement?.Select(elem => elem.Value); set { if (value == null) - ImplementationGuideElement = null; + ImplementationGuideElement = null!; else ImplementationGuideElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("ImplementationGuide"); @@ -4391,11 +4175,11 @@ public IEnumerable ImplementationGuide [DataMember] public List Profile { - get { if(_Profile==null) _Profile = new List(); return _Profile; } + get => _Profile ?? new List(); set { _Profile = value; OnPropertyChanged("Profile"); } } - private List _Profile; + private List? _Profile; /// /// If the endpoint is a RESTful one. @@ -4405,11 +4189,11 @@ public List Profile [DataMember] public List Rest { - get { if(_Rest==null) _Rest = new List(); return _Rest; } + get => _Rest ?? new List(); set { _Rest = value; OnPropertyChanged("Rest"); } } - private List _Rest; + private List? _Rest; /// /// If messaging is supported. @@ -4419,11 +4203,11 @@ public List Rest [DataMember] public List Messaging { - get { if(_Messaging==null) _Messaging = new List(); return _Messaging; } + get => _Messaging ?? new List(); set { _Messaging = value; OnPropertyChanged("Messaging"); } } - private List _Messaging; + private List? _Messaging; /// /// Document definition. @@ -4433,49 +4217,45 @@ public List Messaging [DataMember] public List Document { - get { if(_Document==null) _Document = new List(); return _Document; } + get => _Document ?? new List(); set { _Document = value; OnPropertyChanged("Document"); } } - private List _Document; + private List? _Document; protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityStatement; - - if (dest == null) - { + if(other is not CapabilityStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal()); - if(Software != null) dest.Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent)Software.DeepCopyInternal(); - if(Implementation != null) dest.Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent)Implementation.DeepCopyInternal(); - if(FhirVersionElement != null) dest.FhirVersionElement = (Hl7.Fhir.Model.Id)FhirVersionElement.DeepCopyInternal(); - if(AcceptUnknownElement != null) dest.AcceptUnknownElement = (Code)AcceptUnknownElement.DeepCopyInternal(); - if(FormatElement.Any()) dest.FormatElement = new List(FormatElement.DeepCopyInternal()); - if(PatchFormatElement.Any()) dest.PatchFormatElement = new List(PatchFormatElement.DeepCopyInternal()); - if(ImplementationGuideElement.Any()) dest.ImplementationGuideElement = new List(ImplementationGuideElement.DeepCopyInternal()); - if(Profile.Any()) dest.Profile = new List(Profile.DeepCopyInternal()); - if(Rest.Any()) dest.Rest = new List(Rest.DeepCopyInternal()); - if(Messaging.Any()) dest.Messaging = new List(Messaging.DeepCopyInternal()); - if(Document.Any()) dest.Document = new List(Document.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_InstantiatesElement is not null) dest.InstantiatesElement = new List(_InstantiatesElement.DeepCopyInternal()); + if(_Software is not null) dest.Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent)_Software.DeepCopyInternal(); + if(_Implementation is not null) dest.Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent)_Implementation.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = (Hl7.Fhir.Model.Id)_FhirVersionElement.DeepCopyInternal(); + if(_AcceptUnknownElement is not null) dest.AcceptUnknownElement = (Code)_AcceptUnknownElement.DeepCopyInternal(); + if(_FormatElement is not null) dest.FormatElement = new List(_FormatElement.DeepCopyInternal()); + if(_PatchFormatElement is not null) dest.PatchFormatElement = new List(_PatchFormatElement.DeepCopyInternal()); + if(_ImplementationGuideElement is not null) dest.ImplementationGuideElement = new List(_ImplementationGuideElement.DeepCopyInternal()); + if(_Profile is not null) dest.Profile = new List(_Profile.DeepCopyInternal()); + if(_Rest is not null) dest.Rest = new List(_Rest.DeepCopyInternal()); + if(_Messaging is not null) dest.Messaging = new List(_Messaging.DeepCopyInternal()); + if(_Document is not null) dest.Document = new List(_Document.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4487,216 +4267,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityStatement; - if(otherT == null) return false; + if(other is not CapabilityStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.ListEquals(InstantiatesElement, otherT.InstantiatesElement)) return false; - if(!comparer.Equals(Software, otherT.Software)) return false; - if(!comparer.Equals(Implementation, otherT.Implementation)) return false; - if(!comparer.Equals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.Equals(AcceptUnknownElement, otherT.AcceptUnknownElement)) return false; - if(!comparer.ListEquals(FormatElement, otherT.FormatElement)) return false; - if(!comparer.ListEquals(PatchFormatElement, otherT.PatchFormatElement)) return false; - if(!comparer.ListEquals(ImplementationGuideElement, otherT.ImplementationGuideElement)) return false; - if(!comparer.ListEquals(Profile, otherT.Profile)) return false; - if(!comparer.ListEquals(Rest, otherT.Rest)) return false; - if(!comparer.ListEquals(Messaging, otherT.Messaging)) return false; - if(!comparer.ListEquals(Document, otherT.Document)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; + if(!comparer.Equals(_Software, otherT._Software)) return false; + if(!comparer.Equals(_Implementation, otherT._Implementation)) return false; + if(!comparer.Equals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.Equals(_AcceptUnknownElement, otherT._AcceptUnknownElement)) return false; + if(!comparer.ListEquals(_FormatElement, otherT._FormatElement)) return false; + if(!comparer.ListEquals(_PatchFormatElement, otherT._PatchFormatElement)) return false; + if(!comparer.ListEquals(_ImplementationGuideElement, otherT._ImplementationGuideElement)) return false; + if(!comparer.ListEquals(_Profile, otherT._Profile)) return false; + if(!comparer.ListEquals(_Rest, otherT._Rest)) return false; + if(!comparer.ListEquals(_Messaging, otherT._Messaging)) return false; + if(!comparer.ListEquals(_Document, otherT._Document)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "instantiates": - value = InstantiatesElement; - return InstantiatesElement?.Any() == true; + value = _InstantiatesElement; + return _InstantiatesElement?.Any() == true; case "software": - value = Software; - return Software is not null; + value = _Software; + return _Software is not null; case "implementation": - value = Implementation; - return Implementation is not null; + value = _Implementation; + return _Implementation is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement is not null; + value = _FhirVersionElement; + return _FhirVersionElement is not null; case "acceptUnknown": - value = AcceptUnknownElement; - return AcceptUnknownElement is not null; + value = _AcceptUnknownElement; + return _AcceptUnknownElement is not null; case "format": - value = FormatElement; - return FormatElement?.Any() == true; + value = _FormatElement; + return _FormatElement?.Any() == true; case "patchFormat": - value = PatchFormatElement; - return PatchFormatElement?.Any() == true; + value = _PatchFormatElement; + return _PatchFormatElement?.Any() == true; case "implementationGuide": - value = ImplementationGuideElement; - return ImplementationGuideElement?.Any() == true; + value = _ImplementationGuideElement; + return _ImplementationGuideElement?.Any() == true; case "profile": - value = Profile; - return Profile?.Any() == true; + value = _Profile; + return _Profile?.Any() == true; case "rest": - value = Rest; - return Rest?.Any() == true; + value = _Rest; + return _Rest?.Any() == true; case "messaging": - value = Messaging; - return Messaging?.Any() == true; + value = _Messaging; + return _Messaging?.Any() == true; case "document": - value = Document; - return Document?.Any() == true; + value = _Document; + return _Document?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "instantiates": - InstantiatesElement = (List)value; + InstantiatesElement = (List?)value!; return this; case "software": - Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent)value; + Software = (Hl7.Fhir.Model.CapabilityStatement.SoftwareComponent?)value; return this; case "implementation": - Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent)value; + Implementation = (Hl7.Fhir.Model.CapabilityStatement.ImplementationComponent?)value; return this; case "fhirVersion": - FhirVersionElement = (Hl7.Fhir.Model.Id)value; + FhirVersionElement = (Hl7.Fhir.Model.Id?)value; return this; case "acceptUnknown": - AcceptUnknownElement = (Code)value; + AcceptUnknownElement = (Code?)value; return this; case "format": - FormatElement = (List)value; + FormatElement = (List?)value!; return this; case "patchFormat": - PatchFormatElement = (List)value; + PatchFormatElement = (List?)value!; return this; case "implementationGuide": - ImplementationGuideElement = (List)value; + ImplementationGuideElement = (List?)value!; return this; case "profile": - Profile = (List)value; + Profile = (List?)value!; return this; case "rest": - Rest = (List)value; + Rest = (List?)value!; return this; case "messaging": - Messaging = (List)value; + Messaging = (List?)value!; return this; case "document": - Document = (List)value; + Document = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4707,33 +4487,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",InstantiatesElement); - if (Software is not null) yield return new KeyValuePair("software",Software); - if (Implementation is not null) yield return new KeyValuePair("implementation",Implementation); - if (FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (AcceptUnknownElement is not null) yield return new KeyValuePair("acceptUnknown",AcceptUnknownElement); - if (FormatElement?.Any() == true) yield return new KeyValuePair("format",FormatElement); - if (PatchFormatElement?.Any() == true) yield return new KeyValuePair("patchFormat",PatchFormatElement); - if (ImplementationGuideElement?.Any() == true) yield return new KeyValuePair("implementationGuide",ImplementationGuideElement); - if (Profile?.Any() == true) yield return new KeyValuePair("profile",Profile); - if (Rest?.Any() == true) yield return new KeyValuePair("rest",Rest); - if (Messaging?.Any() == true) yield return new KeyValuePair("messaging",Messaging); - if (Document?.Any() == true) yield return new KeyValuePair("document",Document); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",_InstantiatesElement); + if (_Software is not null) yield return new KeyValuePair("software",_Software); + if (_Implementation is not null) yield return new KeyValuePair("implementation",_Implementation); + if (_FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_AcceptUnknownElement is not null) yield return new KeyValuePair("acceptUnknown",_AcceptUnknownElement); + if (_FormatElement?.Any() == true) yield return new KeyValuePair("format",_FormatElement); + if (_PatchFormatElement?.Any() == true) yield return new KeyValuePair("patchFormat",_PatchFormatElement); + if (_ImplementationGuideElement?.Any() == true) yield return new KeyValuePair("implementationGuide",_ImplementationGuideElement); + if (_Profile?.Any() == true) yield return new KeyValuePair("profile",_Profile); + if (_Rest?.Any() == true) yield return new KeyValuePair("rest",_Rest); + if (_Messaging?.Any() == true) yield return new KeyValuePair("messaging",_Messaging); + if (_Document?.Any() == true) yield return new KeyValuePair("document",_Document); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs index c3443d6e0..5bc0335ac 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -222,11 +225,11 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List OutcomeCodeableConcept { - get { if(_OutcomeCodeableConcept==null) _OutcomeCodeableConcept = new List(); return _OutcomeCodeableConcept; } + get => _OutcomeCodeableConcept ?? new List(); set { _OutcomeCodeableConcept = value; OnPropertyChanged("OutcomeCodeableConcept"); } } - private List _OutcomeCodeableConcept; + private List? _OutcomeCodeableConcept; /// /// Appointment, Encounter, Procedure, etc. @@ -238,11 +241,11 @@ public List OutcomeCodeableConcept [DataMember] public List OutcomeReference { - get { if(_OutcomeReference==null) _OutcomeReference = new List(); return _OutcomeReference; } + get => _OutcomeReference ?? new List(); set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } - private List _OutcomeReference; + private List? _OutcomeReference; /// /// Comments about the activity status/progress. @@ -252,11 +255,11 @@ public List OutcomeReference [DataMember] public List Progress { - get { if(_Progress==null) _Progress = new List(); return _Progress; } + get => _Progress ?? new List(); set { _Progress = value; OnPropertyChanged("Progress"); } } - private List _Progress; + private List? _Progress; /// /// Activity details defined in specific resource. @@ -265,42 +268,38 @@ public List Progress [CLSCompliant(false)] [References("Appointment","CommunicationRequest","DeviceRequest","MedicationRequest","NutritionOrder","Task","ProcedureRequest","ReferralRequest","VisionPrescription","RequestGroup")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// In-line definition of activity. /// [FhirElement("detail", Order=80)] [DataMember] - public Hl7.Fhir.Model.CarePlan.DetailComponent Detail + public Hl7.Fhir.Model.CarePlan.DetailComponent? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.CarePlan.DetailComponent _Detail; + private Hl7.Fhir.Model.CarePlan.DetailComponent? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityComponent; - - if (dest == null) - { + if(other is not ActivityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(OutcomeCodeableConcept.Any()) dest.OutcomeCodeableConcept = new List(OutcomeCodeableConcept.DeepCopyInternal()); - if(OutcomeReference.Any()) dest.OutcomeReference = new List(OutcomeReference.DeepCopyInternal()); - if(Progress.Any()) dest.Progress = new List(Progress.DeepCopyInternal()); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)Detail.DeepCopyInternal(); + if(_OutcomeCodeableConcept is not null) dest.OutcomeCodeableConcept = new List(_OutcomeCodeableConcept.DeepCopyInternal()); + if(_OutcomeReference is not null) dest.OutcomeReference = new List(_OutcomeReference.DeepCopyInternal()); + if(_Progress is not null) dest.Progress = new List(_Progress.DeepCopyInternal()); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)_Detail.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -312,62 +311,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityComponent; - if(otherT == null) return false; + if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(OutcomeCodeableConcept, otherT.OutcomeCodeableConcept)) return false; - if(!comparer.ListEquals(OutcomeReference, otherT.OutcomeReference)) return false; - if(!comparer.ListEquals(Progress, otherT.Progress)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; + if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; + if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outcomeCodeableConcept": - value = OutcomeCodeableConcept; - return OutcomeCodeableConcept?.Any() == true; + value = _OutcomeCodeableConcept; + return _OutcomeCodeableConcept?.Any() == true; case "outcomeReference": - value = OutcomeReference; - return OutcomeReference?.Any() == true; + value = _OutcomeReference; + return _OutcomeReference?.Any() == true; case "progress": - value = Progress; - return Progress?.Any() == true; + value = _Progress; + return _Progress?.Any() == true; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outcomeCodeableConcept": - OutcomeCodeableConcept = (List)value; + OutcomeCodeableConcept = (List?)value!; return this; case "outcomeReference": - OutcomeReference = (List)value; + OutcomeReference = (List?)value!; return this; case "progress": - Progress = (List)value; + Progress = (List?)value!; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)value; + Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent?)value; return this; default: return base.SetValue(key, value); @@ -378,11 +377,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (OutcomeCodeableConcept?.Any() == true) yield return new KeyValuePair("outcomeCodeableConcept",OutcomeCodeableConcept); - if (OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",OutcomeReference); - if (Progress?.Any() == true) yield return new KeyValuePair("progress",Progress); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); + if (_OutcomeCodeableConcept?.Any() == true) yield return new KeyValuePair("outcomeCodeableConcept",_OutcomeCodeableConcept); + if (_OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",_OutcomeReference); + if (_Progress?.Any() == true) yield return new KeyValuePair("progress",_Progress); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); } } @@ -409,13 +408,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("CarePlanActivityCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Protocol or definition. @@ -424,13 +423,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [CLSCompliant(false)] [References("PlanDefinition","ActivityDefinition","Questionnaire")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; /// /// Detail type of activity. @@ -438,13 +437,13 @@ public Hl7.Fhir.Model.ResourceReference Definition [FhirElement("code", Order=60)] [Binding("CarePlanActivityType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Why activity should be done or why activity was prohibited. @@ -455,11 +454,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition triggering need for activity. @@ -471,11 +470,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Goals this activity relates to. @@ -487,11 +486,11 @@ public List ReasonReference [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// not-started | scheduled | in-progress | on-hold | completed | cancelled | unknown. @@ -501,13 +500,13 @@ public List Goal [Binding("CarePlanActivityStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// not-started | scheduled | in-progress | on-hold | completed | cancelled | unknown @@ -516,13 +515,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanActivityStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -532,28 +528,25 @@ public Hl7.Fhir.Model.CarePlan.CarePlanActivityStatus? Status /// [FhirElement("statusReason", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString StatusReasonElement + public Hl7.Fhir.Model.FhirString? StatusReasonElement { get { return _StatusReasonElement; } set { _StatusReasonElement = value; OnPropertyChanged("StatusReasonElement"); } } - private Hl7.Fhir.Model.FhirString _StatusReasonElement; + private Hl7.Fhir.Model.FhirString? _StatusReasonElement; /// /// Reason for current status /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusReason + public string? StatusReason { - get { return StatusReasonElement != null ? StatusReasonElement.Value : null; } + get => _StatusReasonElement?.Value; set { - if (value == null) - StatusReasonElement = null; - else - StatusReasonElement = new Hl7.Fhir.Model.FhirString(value); + StatusReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StatusReason"); } } @@ -563,13 +556,13 @@ public string StatusReason /// [FhirElement("prohibited", IsModifier=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ProhibitedElement + public Hl7.Fhir.Model.FhirBoolean? ProhibitedElement { get { return _ProhibitedElement; } set { _ProhibitedElement = value; OnPropertyChanged("ProhibitedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ProhibitedElement; + private Hl7.Fhir.Model.FhirBoolean? _ProhibitedElement; /// /// Do NOT do @@ -578,13 +571,10 @@ public Hl7.Fhir.Model.FhirBoolean ProhibitedElement [IgnoreDataMember] public bool? Prohibited { - get { return ProhibitedElement != null ? ProhibitedElement.Value : null; } + get => _ProhibitedElement?.Value; set { - if (value == null) - ProhibitedElement = null; - else - ProhibitedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ProhibitedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Prohibited"); } } @@ -596,13 +586,13 @@ public bool? Prohibited [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Scheduled + public Hl7.Fhir.Model.DataType? Scheduled { get { return _Scheduled; } set { _Scheduled = value; OnPropertyChanged("Scheduled"); } } - private Hl7.Fhir.Model.DataType _Scheduled; + private Hl7.Fhir.Model.DataType? _Scheduled; /// /// Where it should happen. @@ -611,13 +601,13 @@ public Hl7.Fhir.Model.DataType Scheduled [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Who will be responsible?. @@ -629,11 +619,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// What is to be administered/supplied. @@ -644,97 +634,90 @@ public List Performer [References("Medication","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// How to consume/day?. /// [FhirElement("dailyAmount", Order=170)] [DataMember] - public Hl7.Fhir.Model.Quantity DailyAmount + public Hl7.Fhir.Model.Quantity? DailyAmount { get { return _DailyAmount; } set { _DailyAmount = value; OnPropertyChanged("DailyAmount"); } } - private Hl7.Fhir.Model.Quantity _DailyAmount; + private Hl7.Fhir.Model.Quantity? _DailyAmount; /// /// How much to administer/supply/consume. /// [FhirElement("quantity", Order=180)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Extra info describing activity to perform. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Extra info describing activity to perform /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReasonElement != null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)StatusReasonElement.DeepCopyInternal(); - if(ProhibitedElement != null) dest.ProhibitedElement = (Hl7.Fhir.Model.FhirBoolean)ProhibitedElement.DeepCopyInternal(); - if(Scheduled != null) dest.Scheduled = (Hl7.Fhir.Model.DataType)Scheduled.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(DailyAmount != null) dest.DailyAmount = (Hl7.Fhir.Model.Quantity)DailyAmount.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReasonElement is not null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)_StatusReasonElement.DeepCopyInternal(); + if(_ProhibitedElement is not null) dest.ProhibitedElement = (Hl7.Fhir.Model.FhirBoolean)_ProhibitedElement.DeepCopyInternal(); + if(_Scheduled is not null) dest.Scheduled = (Hl7.Fhir.Model.DataType)_Scheduled.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_DailyAmount is not null) dest.DailyAmount = (Hl7.Fhir.Model.Quantity)_DailyAmount.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -746,139 +729,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReasonElement, otherT.StatusReasonElement)) return false; - if(!comparer.Equals(ProhibitedElement, otherT.ProhibitedElement)) return false; - if(!comparer.Equals(Scheduled, otherT.Scheduled)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(DailyAmount, otherT.DailyAmount)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReasonElement, otherT._StatusReasonElement)) return false; + if(!comparer.Equals(_ProhibitedElement, otherT._ProhibitedElement)) return false; + if(!comparer.Equals(_Scheduled, otherT._Scheduled)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_DailyAmount, otherT._DailyAmount)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReasonElement; - return StatusReasonElement is not null; + value = _StatusReasonElement; + return _StatusReasonElement is not null; case "prohibited": - value = ProhibitedElement; - return ProhibitedElement is not null; + value = _ProhibitedElement; + return _ProhibitedElement is not null; case "scheduled": - value = Scheduled; - return Scheduled is not null; + value = _Scheduled; + return _Scheduled is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "dailyAmount": - value = DailyAmount; - return DailyAmount is not null; + value = _DailyAmount; + return _DailyAmount is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReasonElement = (Hl7.Fhir.Model.FhirString)value; + StatusReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "prohibited": - ProhibitedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ProhibitedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "scheduled": - Scheduled = (Hl7.Fhir.Model.DataType)value; + Scheduled = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "dailyAmount": - DailyAmount = (Hl7.Fhir.Model.Quantity)value; + DailyAmount = (Hl7.Fhir.Model.Quantity?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -889,22 +872,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReasonElement is not null) yield return new KeyValuePair("statusReason",StatusReasonElement); - if (ProhibitedElement is not null) yield return new KeyValuePair("prohibited",ProhibitedElement); - if (Scheduled is not null) yield return new KeyValuePair("scheduled",Scheduled); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (DailyAmount is not null) yield return new KeyValuePair("dailyAmount",DailyAmount); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReasonElement is not null) yield return new KeyValuePair("statusReason",_StatusReasonElement); + if (_ProhibitedElement is not null) yield return new KeyValuePair("prohibited",_ProhibitedElement); + if (_Scheduled is not null) yield return new KeyValuePair("scheduled",_Scheduled); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_DailyAmount is not null) yield return new KeyValuePair("dailyAmount",_DailyAmount); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -917,11 +900,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Protocol or definition. @@ -933,11 +916,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// Fulfills care plan. @@ -949,11 +932,11 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// CarePlan replaced by this CarePlan. @@ -965,11 +948,11 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Part of referenced CarePlan. @@ -981,11 +964,11 @@ public List Replaces [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | active | suspended | completed | entered-in-error | cancelled | unknown. @@ -995,13 +978,13 @@ public List PartOf [Binding("CarePlanStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended | completed | entered-in-error | cancelled | unknown @@ -1010,13 +993,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1029,13 +1009,13 @@ public Hl7.Fhir.Model.CarePlan.CarePlanStatus? Status [Binding("CarePlanIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | option @@ -1044,13 +1024,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1064,39 +1041,36 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Human-friendly name for the CarePlan. /// [FhirElement("title", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human-friendly name for the CarePlan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1106,28 +1080,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=180, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Summary of nature of plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1140,13 +1111,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Created in context of. @@ -1155,26 +1126,26 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Time period plan covers. /// [FhirElement("period", InSummary=true, Order=210, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Who is responsible for contents of the plan. @@ -1186,11 +1157,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who's involved in plan?. @@ -1202,11 +1173,11 @@ public List Author [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Health issues this plan addresses. @@ -1218,11 +1189,11 @@ public List CareTeam [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Information considered as part of plan. @@ -1234,11 +1205,11 @@ public List Addresses [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Desired outcome of plan. @@ -1250,11 +1221,11 @@ public List SupportingInfo [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Action to occur as part of plan. @@ -1264,11 +1235,11 @@ public List Goal [DataMember] public List Activity { - get { if(_Activity==null) _Activity = new List(); return _Activity; } + get => _Activity ?? new List(); set { _Activity = value; OnPropertyChanged("Activity"); } } - private List _Activity; + private List? _Activity; /// /// Comments about the plan. @@ -1278,44 +1249,40 @@ public List Activity [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CarePlan; - - if (dest == null) - { + if(other is not CarePlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Activity.Any()) dest.Activity = new List(Activity.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = new List(_Activity.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1327,167 +1294,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CarePlan; - if(otherT == null) return false; + if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "activity": - value = Activity; - return Activity?.Any() == true; + value = _Activity; + return _Activity?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "activity": - Activity = (List)value; + Activity = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1498,26 +1465,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Activity?.Any() == true) yield return new KeyValuePair("activity",Activity); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Activity?.Any() == true) yield return new KeyValuePair("activity",_Activity); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs index d893d3955..6d9183ed5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,13 +124,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("role", InSummary=true, Order=40)] [Binding("CareTeamParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Who is involved. @@ -136,13 +139,13 @@ public Hl7.Fhir.Model.CodeableConcept Role [CLSCompliant(false)] [References("Practitioner","RelatedPerson","Patient","Organization","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Member + public Hl7.Fhir.Model.ResourceReference? Member { get { return _Member; } set { _Member = value; OnPropertyChanged("Member"); } } - private Hl7.Fhir.Model.ResourceReference _Member; + private Hl7.Fhir.Model.ResourceReference? _Member; /// /// Organization of the practitioner. @@ -151,41 +154,37 @@ public Hl7.Fhir.Model.ResourceReference Member [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// Time period of participant. /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Member != null) dest.Member = (Hl7.Fhir.Model.ResourceReference)Member.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Member is not null) dest.Member = (Hl7.Fhir.Model.ResourceReference)_Member.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -197,55 +196,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Member, otherT.Member)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Member, otherT._Member)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "member": - value = Member; - return Member is not null; + value = _Member; + return _Member is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "member": - Member = (Hl7.Fhir.Model.ResourceReference)value; + Member = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -256,10 +255,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Member is not null) yield return new KeyValuePair("member",Member); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Member is not null) yield return new KeyValuePair("member",_Member); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -272,11 +271,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | active | suspended | inactive | entered-in-error. @@ -285,13 +284,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("CareTeamStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | active | suspended | inactive | entered-in-error @@ -300,13 +299,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -320,39 +316,36 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Name of the team, such as crisis assessment team. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the team, such as crisis assessment team /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -364,13 +357,13 @@ public string Name [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or episode associated with CareTeam. @@ -379,26 +372,26 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Time period team covers. /// [FhirElement("period", InSummary=true, Order=150, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Members of the team. @@ -408,11 +401,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Why the care team exists. @@ -423,11 +416,11 @@ public List Participant [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why the care team exists. @@ -439,11 +432,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Organization responsible for the care team. @@ -455,11 +448,11 @@ public List ReasonReference [DataMember] public List ManagingOrganization { - get { if(_ManagingOrganization==null) _ManagingOrganization = new List(); return _ManagingOrganization; } + get => _ManagingOrganization ?? new List(); set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private List _ManagingOrganization; + private List? _ManagingOrganization; /// /// Comments made about the CareTeam. @@ -469,36 +462,32 @@ public List ManagingOrganization [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeam; - - if (dest == null) - { + if(other is not CareTeam dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(ManagingOrganization.Any()) dest.ManagingOrganization = new List(ManagingOrganization.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = new List(_ManagingOrganization.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -510,111 +499,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeam; - if(otherT == null) return false; + if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization?.Any() == true; + value = _ManagingOrganization; + return _ManagingOrganization?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (List)value; + ManagingOrganization = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -625,18 +614,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs index a0039d66e..104ca8211 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,13 +136,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("role", Order=40)] [Binding("ChargeItemPerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Individual who was performing. @@ -149,26 +152,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Practitioner","Organization","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,41 +179,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -225,8 +224,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -236,13 +235,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Defining information about the code of this charge item. @@ -252,24 +251,24 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List DefinitionElement { - get { if(_DefinitionElement==null) _DefinitionElement = new List(); return _DefinitionElement; } + get => _DefinitionElement ?? new List(); set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private List _DefinitionElement; + private List? _DefinitionElement; /// /// Defining information about the code of this charge item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Definition + public IEnumerable? Definition { - get { return DefinitionElement != null ? DefinitionElement.Select(elem => elem.Value) : null; } + get => _DefinitionElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionElement = null; + DefinitionElement = null!; else DefinitionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Definition"); @@ -284,13 +283,13 @@ public IEnumerable Definition [Binding("ChargeItemStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | billable | not-billable | aborted | billed | entered-in-error | unknown @@ -299,13 +298,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -320,11 +316,11 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// A code that identifies the charge, like a billing code. @@ -333,13 +329,13 @@ public List PartOf [Binding("ChargeItemCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Individual service was done for/to. @@ -349,13 +345,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with event. @@ -364,13 +360,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When the charged service was applied. @@ -379,13 +375,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Who performed charged service. @@ -395,11 +391,11 @@ public Hl7.Fhir.Model.DataType Occurrence [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Organization providing the charged sevice. @@ -408,13 +404,13 @@ public List Participant [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PerformingOrganization + public Hl7.Fhir.Model.ResourceReference? PerformingOrganization { get { return _PerformingOrganization; } set { _PerformingOrganization = value; OnPropertyChanged("PerformingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _PerformingOrganization; + private Hl7.Fhir.Model.ResourceReference? _PerformingOrganization; /// /// Organization requesting the charged service. @@ -423,26 +419,26 @@ public Hl7.Fhir.Model.ResourceReference PerformingOrganization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestingOrganization + public Hl7.Fhir.Model.ResourceReference? RequestingOrganization { get { return _RequestingOrganization; } set { _RequestingOrganization = value; OnPropertyChanged("RequestingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestingOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestingOrganization; /// /// Quantity of which the charge item has been serviced. /// [FhirElement("quantity", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Anatomical location, if relevant. @@ -453,24 +449,24 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Bodysite { - get { if(_Bodysite==null) _Bodysite = new List(); return _Bodysite; } + get => _Bodysite ?? new List(); set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } - private List _Bodysite; + private List? _Bodysite; /// /// Factor overriding the associated rules. /// [FhirElement("factorOverride", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorOverrideElement + public Hl7.Fhir.Model.FhirDecimal? FactorOverrideElement { get { return _FactorOverrideElement; } set { _FactorOverrideElement = value; OnPropertyChanged("FactorOverrideElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorOverrideElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorOverrideElement; /// /// Factor overriding the associated rules @@ -479,13 +475,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorOverrideElement [IgnoreDataMember] public decimal? FactorOverride { - get { return FactorOverrideElement != null ? FactorOverrideElement.Value : null; } + get => _FactorOverrideElement?.Value; set { - if (value == null) - FactorOverrideElement = null; - else - FactorOverrideElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorOverrideElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("FactorOverride"); } } @@ -495,41 +488,38 @@ public decimal? FactorOverride /// [FhirElement("priceOverride", Order=230)] [DataMember] - public Hl7.Fhir.Model.Money PriceOverride + public Hl7.Fhir.Model.Money? PriceOverride { get { return _PriceOverride; } set { _PriceOverride = value; OnPropertyChanged("PriceOverride"); } } - private Hl7.Fhir.Model.Money _PriceOverride; + private Hl7.Fhir.Model.Money? _PriceOverride; /// /// Reason for overriding the list price/factor. /// [FhirElement("overrideReason", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString OverrideReasonElement + public Hl7.Fhir.Model.FhirString? OverrideReasonElement { get { return _OverrideReasonElement; } set { _OverrideReasonElement = value; OnPropertyChanged("OverrideReasonElement"); } } - private Hl7.Fhir.Model.FhirString _OverrideReasonElement; + private Hl7.Fhir.Model.FhirString? _OverrideReasonElement; /// /// Reason for overriding the list price/factor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OverrideReason + public string? OverrideReason { - get { return OverrideReasonElement != null ? OverrideReasonElement.Value : null; } + get => _OverrideReasonElement?.Value; set { - if (value == null) - OverrideReasonElement = null; - else - OverrideReasonElement = new Hl7.Fhir.Model.FhirString(value); + OverrideReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OverrideReason"); } } @@ -541,41 +531,38 @@ public string OverrideReason [CLSCompliant(false)] [References("Practitioner","Organization","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Date the charge item was entered. /// [FhirElement("enteredDate", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EnteredDateElement + public Hl7.Fhir.Model.FhirDateTime? EnteredDateElement { get { return _EnteredDateElement; } set { _EnteredDateElement = value; OnPropertyChanged("EnteredDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EnteredDateElement; + private Hl7.Fhir.Model.FhirDateTime? _EnteredDateElement; /// /// Date the charge item was entered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EnteredDate + public string? EnteredDate { - get { return EnteredDateElement != null ? EnteredDateElement.Value : null; } + get => _EnteredDateElement?.Value; set { - if (value == null) - EnteredDateElement = null; - else - EnteredDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + EnteredDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EnteredDate"); } } @@ -589,11 +576,11 @@ public string EnteredDate [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Which rendered service is being charged?. @@ -605,11 +592,11 @@ public List Reason [DataMember] public List Service { - get { if(_Service==null) _Service = new List(); return _Service; } + get => _Service ?? new List(); set { _Service = value; OnPropertyChanged("Service"); } } - private List _Service; + private List? _Service; /// /// Account to place this charge. @@ -621,11 +608,11 @@ public List Service [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Comments made about the ChargeItem. @@ -635,11 +622,11 @@ public List Account [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Further information supporting the this charge. @@ -651,47 +638,43 @@ public List Note [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItem; - - if (dest == null) - { + if(other is not ChargeItem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(DefinitionElement.Any()) dest.DefinitionElement = new List(DefinitionElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(PerformingOrganization != null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)PerformingOrganization.DeepCopyInternal(); - if(RequestingOrganization != null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)RequestingOrganization.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Bodysite.Any()) dest.Bodysite = new List(Bodysite.DeepCopyInternal()); - if(FactorOverrideElement != null) dest.FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)FactorOverrideElement.DeepCopyInternal(); - if(PriceOverride != null) dest.PriceOverride = (Hl7.Fhir.Model.Money)PriceOverride.DeepCopyInternal(); - if(OverrideReasonElement != null) dest.OverrideReasonElement = (Hl7.Fhir.Model.FhirString)OverrideReasonElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(EnteredDateElement != null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)EnteredDateElement.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Service.Any()) dest.Service = new List(Service.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = new List(_DefinitionElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_PerformingOrganization is not null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)_PerformingOrganization.DeepCopyInternal(); + if(_RequestingOrganization is not null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestingOrganization.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Bodysite is not null) dest.Bodysite = new List(_Bodysite.DeepCopyInternal()); + if(_FactorOverrideElement is not null) dest.FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)_FactorOverrideElement.DeepCopyInternal(); + if(_PriceOverride is not null) dest.PriceOverride = (Hl7.Fhir.Model.Money)_PriceOverride.DeepCopyInternal(); + if(_OverrideReasonElement is not null) dest.OverrideReasonElement = (Hl7.Fhir.Model.FhirString)_OverrideReasonElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_EnteredDateElement is not null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)_EnteredDateElement.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Service is not null) dest.Service = new List(_Service.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -703,188 +686,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItem; - if(otherT == null) return false; + if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(PerformingOrganization, otherT.PerformingOrganization)) return false; - if(!comparer.Equals(RequestingOrganization, otherT.RequestingOrganization)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Bodysite, otherT.Bodysite)) return false; - if(!comparer.Equals(FactorOverrideElement, otherT.FactorOverrideElement)) return false; - if(!comparer.Equals(PriceOverride, otherT.PriceOverride)) return false; - if(!comparer.Equals(OverrideReasonElement, otherT.OverrideReasonElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(EnteredDateElement, otherT.EnteredDateElement)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_PerformingOrganization, otherT._PerformingOrganization)) return false; + if(!comparer.Equals(_RequestingOrganization, otherT._RequestingOrganization)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Bodysite, otherT._Bodysite)) return false; + if(!comparer.Equals(_FactorOverrideElement, otherT._FactorOverrideElement)) return false; + if(!comparer.Equals(_PriceOverride, otherT._PriceOverride)) return false; + if(!comparer.Equals(_OverrideReasonElement, otherT._OverrideReasonElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_EnteredDateElement, otherT._EnteredDateElement)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "definition": - value = DefinitionElement; - return DefinitionElement?.Any() == true; + value = _DefinitionElement; + return _DefinitionElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "performingOrganization": - value = PerformingOrganization; - return PerformingOrganization is not null; + value = _PerformingOrganization; + return _PerformingOrganization is not null; case "requestingOrganization": - value = RequestingOrganization; - return RequestingOrganization is not null; + value = _RequestingOrganization; + return _RequestingOrganization is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "bodysite": - value = Bodysite; - return Bodysite?.Any() == true; + value = _Bodysite; + return _Bodysite?.Any() == true; case "factorOverride": - value = FactorOverrideElement; - return FactorOverrideElement is not null; + value = _FactorOverrideElement; + return _FactorOverrideElement is not null; case "priceOverride": - value = PriceOverride; - return PriceOverride is not null; + value = _PriceOverride; + return _PriceOverride is not null; case "overrideReason": - value = OverrideReasonElement; - return OverrideReasonElement is not null; + value = _OverrideReasonElement; + return _OverrideReasonElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "enteredDate": - value = EnteredDateElement; - return EnteredDateElement is not null; + value = _EnteredDateElement; + return _EnteredDateElement is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "service": - value = Service; - return Service?.Any() == true; + value = _Service; + return _Service?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "definition": - DefinitionElement = (List)value; + DefinitionElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "performingOrganization": - PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + PerformingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestingOrganization": - RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "bodysite": - Bodysite = (List)value; + Bodysite = (List?)value!; return this; case "factorOverride": - FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "priceOverride": - PriceOverride = (Hl7.Fhir.Model.Money)value; + PriceOverride = (Hl7.Fhir.Model.Money?)value; return this; case "overrideReason": - OverrideReasonElement = (Hl7.Fhir.Model.FhirString)value; + OverrideReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "enteredDate": - EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "service": - Service = (List)value; + Service = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -895,29 +878,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",DefinitionElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",PerformingOrganization); - if (RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",RequestingOrganization); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",Bodysite); - if (FactorOverrideElement is not null) yield return new KeyValuePair("factorOverride",FactorOverrideElement); - if (PriceOverride is not null) yield return new KeyValuePair("priceOverride",PriceOverride); - if (OverrideReasonElement is not null) yield return new KeyValuePair("overrideReason",OverrideReasonElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",EnteredDateElement); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Service?.Any() == true) yield return new KeyValuePair("service",Service); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",_DefinitionElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",_PerformingOrganization); + if (_RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",_RequestingOrganization); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",_Bodysite); + if (_FactorOverrideElement is not null) yield return new KeyValuePair("factorOverride",_FactorOverrideElement); + if (_PriceOverride is not null) yield return new KeyValuePair("priceOverride",_PriceOverride); + if (_OverrideReasonElement is not null) yield return new KeyValuePair("overrideReason",_OverrideReasonElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",_EnteredDateElement); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Service?.Any() == true) yield return new KeyValuePair("service",_Service); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs index 1b6fe31a6..074092cf1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -130,40 +133,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// Related file or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -175,48 +174,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -227,9 +226,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -257,13 +256,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [Binding("PayeeType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// organization | patient | practitioner | relatedperson. @@ -271,13 +270,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("resourceType", Order=50)] [Binding("ClaimPayeeResourceType")] [DataMember] - public Hl7.Fhir.Model.Coding ResourceType + public Hl7.Fhir.Model.Coding? ResourceType { get { return _ResourceType; } set { _ResourceType = value; OnPropertyChanged("ResourceType"); } } - private Hl7.Fhir.Model.Coding _ResourceType; + private Hl7.Fhir.Model.Coding? _ResourceType; /// /// Party to receive the payable. @@ -286,27 +285,23 @@ public Hl7.Fhir.Model.Coding ResourceType [CLSCompliant(false)] [References("Practitioner","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ResourceType != null) dest.ResourceType = (Hl7.Fhir.Model.Coding)ResourceType.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ResourceType is not null) dest.ResourceType = (Hl7.Fhir.Model.Coding)_ResourceType.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -318,48 +313,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ResourceType, otherT.ResourceType)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ResourceType, otherT._ResourceType)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "resourceType": - value = ResourceType; - return ResourceType is not null; + value = _ResourceType; + return _ResourceType is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "resourceType": - ResourceType = (Hl7.Fhir.Model.Coding)value; + ResourceType = (Hl7.Fhir.Model.Coding?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -370,9 +365,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ResourceType is not null) yield return new KeyValuePair("resourceType",ResourceType); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ResourceType is not null) yield return new KeyValuePair("resourceType",_ResourceType); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -399,13 +394,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Number to covey order of careTeam @@ -414,13 +409,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -433,26 +425,26 @@ public int? Sequence [References("Practitioner","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Billing provider. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Billing provider @@ -461,13 +453,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -478,13 +467,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Type, classification or Specialization. @@ -492,29 +481,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("qualification", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Qualification + public Hl7.Fhir.Model.CodeableConcept? Qualification { get { return _Qualification; } set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private Hl7.Fhir.Model.CodeableConcept _Qualification; + private Hl7.Fhir.Model.CodeableConcept? _Qualification; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Qualification != null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)Qualification.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Qualification is not null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)_Qualification.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -526,62 +511,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Qualification, otherT.Qualification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "qualification": - value = Qualification; - return Qualification is not null; + value = _Qualification; + return _Qualification is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualification": - Qualification = (Hl7.Fhir.Model.CodeableConcept)value; + Qualification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -592,11 +577,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Qualification is not null) yield return new KeyValuePair("qualification",Qualification); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Qualification is not null) yield return new KeyValuePair("qualification",_Qualification); } } @@ -623,13 +608,13 @@ public partial class SpecialConditionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -638,13 +623,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -656,13 +638,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -670,13 +652,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -685,13 +667,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Additional Data or supporting information. @@ -701,13 +683,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Reason associated with the information. @@ -715,30 +697,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SpecialConditionComponent; - - if (dest == null) - { + if(other is not SpecialConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -750,69 +728,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecialConditionComponent; - if(otherT == null) return false; + if(other is not SpecialConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -823,12 +801,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -855,13 +833,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Number to covey order of diagnosis @@ -870,13 +848,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -891,13 +866,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -908,11 +883,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Package billing code. @@ -920,28 +895,24 @@ public List Type [FhirElement("packageCode", Order=70)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PackageCode + public Hl7.Fhir.Model.CodeableConcept? PackageCode { get { return _PackageCode; } set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private Hl7.Fhir.Model.CodeableConcept _PackageCode; + private Hl7.Fhir.Model.CodeableConcept? _PackageCode; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(PackageCode != null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)PackageCode.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_PackageCode is not null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)_PackageCode.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -953,55 +924,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(PackageCode, otherT.PackageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "packageCode": - value = PackageCode; - return PackageCode is not null; + value = _PackageCode; + return _PackageCode is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "packageCode": - PackageCode = (Hl7.Fhir.Model.CodeableConcept)value; + PackageCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1012,10 +983,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (PackageCode is not null) yield return new KeyValuePair("packageCode",PackageCode); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_PackageCode is not null) yield return new KeyValuePair("packageCode",_PackageCode); } } @@ -1042,13 +1013,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure sequence for reference @@ -1057,13 +1028,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1073,28 +1041,25 @@ public int? Sequence /// [FhirElement("date", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1109,27 +1074,23 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1141,48 +1102,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1193,9 +1154,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); } } @@ -1222,13 +1183,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance identifier @@ -1237,13 +1198,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1254,13 +1212,13 @@ public int? Sequence [FhirElement("focal", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Is the focal Coverage @@ -1269,13 +1227,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -1288,41 +1243,38 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Business agreement. /// [FhirElement("businessArrangement", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Business agreement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -1335,24 +1287,24 @@ public string BusinessArrangement [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Pre-Authorization/Determination Reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1366,30 +1318,26 @@ public IEnumerable PreAuthRef [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1401,69 +1349,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1474,12 +1422,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -1508,13 +1456,13 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("date", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the accident occurred @@ -1523,15 +1471,12 @@ public Hl7.Fhir.Model.Date DateElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1542,13 +1487,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Accident Place. @@ -1558,27 +1503,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1590,48 +1531,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1642,9 +1583,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1671,13 +1612,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance @@ -1686,13 +1627,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1705,24 +1643,24 @@ public int? Sequence [DataMember] public List CareTeamLinkIdElement { - get { if(_CareTeamLinkIdElement==null) _CareTeamLinkIdElement = new List(); return _CareTeamLinkIdElement; } + get => _CareTeamLinkIdElement ?? new List(); set { _CareTeamLinkIdElement = value; OnPropertyChanged("CareTeamLinkIdElement"); } } - private List _CareTeamLinkIdElement; + private List? _CareTeamLinkIdElement; /// /// Applicable careTeam members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamLinkId + public IEnumerable? CareTeamLinkId { - get { return CareTeamLinkIdElement != null ? CareTeamLinkIdElement.Select(elem => elem.Value) : null; } + get => _CareTeamLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamLinkIdElement = null; + CareTeamLinkIdElement = null!; else CareTeamLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamLinkId"); @@ -1737,24 +1675,24 @@ public IEnumerable CareTeamLinkId [DataMember] public List DiagnosisLinkIdElement { - get { if(_DiagnosisLinkIdElement==null) _DiagnosisLinkIdElement = new List(); return _DiagnosisLinkIdElement; } + get => _DiagnosisLinkIdElement ?? new List(); set { _DiagnosisLinkIdElement = value; OnPropertyChanged("DiagnosisLinkIdElement"); } } - private List _DiagnosisLinkIdElement; + private List? _DiagnosisLinkIdElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisLinkId + public IEnumerable? DiagnosisLinkId { - get { return DiagnosisLinkIdElement != null ? DiagnosisLinkIdElement.Select(elem => elem.Value) : null; } + get => _DiagnosisLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisLinkIdElement = null; + DiagnosisLinkIdElement = null!; else DiagnosisLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisLinkId"); @@ -1769,24 +1707,24 @@ public IEnumerable DiagnosisLinkId [DataMember] public List ProcedureLinkIdElement { - get { if(_ProcedureLinkIdElement==null) _ProcedureLinkIdElement = new List(); return _ProcedureLinkIdElement; } + get => _ProcedureLinkIdElement ?? new List(); set { _ProcedureLinkIdElement = value; OnPropertyChanged("ProcedureLinkIdElement"); } } - private List _ProcedureLinkIdElement; + private List? _ProcedureLinkIdElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureLinkId + public IEnumerable? ProcedureLinkId { - get { return ProcedureLinkIdElement != null ? ProcedureLinkIdElement.Select(elem => elem.Value) : null; } + get => _ProcedureLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureLinkIdElement = null; + ProcedureLinkIdElement = null!; else ProcedureLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureLinkId"); @@ -1801,24 +1739,24 @@ public IEnumerable ProcedureLinkId [DataMember] public List InformationLinkIdElement { - get { if(_InformationLinkIdElement==null) _InformationLinkIdElement = new List(); return _InformationLinkIdElement; } + get => _InformationLinkIdElement ?? new List(); set { _InformationLinkIdElement = value; OnPropertyChanged("InformationLinkIdElement"); } } - private List _InformationLinkIdElement; + private List? _InformationLinkIdElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationLinkId + public IEnumerable? InformationLinkId { - get { return InformationLinkIdElement != null ? InformationLinkIdElement.Select(elem => elem.Value) : null; } + get => _InformationLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - InformationLinkIdElement = null; + InformationLinkIdElement = null!; else InformationLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationLinkId"); @@ -1831,13 +1769,13 @@ public IEnumerable InformationLinkId [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -1845,13 +1783,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=100)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -1859,13 +1797,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=110)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -1876,11 +1814,11 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program specific reason for item inclusion. @@ -1891,11 +1829,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of Service. @@ -1904,13 +1842,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service. @@ -1921,52 +1859,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of Products or Services. /// [FhirElement("quantity", Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per point. /// [FhirElement("unitPrice", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1975,13 +1913,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1991,13 +1926,13 @@ public decimal? Factor /// [FhirElement("net", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique Device Identifier. @@ -2009,11 +1944,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Service Location. @@ -2021,13 +1956,13 @@ public List Udi [FhirElement("bodySite", Order=210)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Service Sub-location. @@ -2038,11 +1973,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Encounters related to this billed item. @@ -2054,11 +1989,11 @@ public List SubSite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Additional items. @@ -2068,43 +2003,39 @@ public List Encounter [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(CareTeamLinkIdElement.Any()) dest.CareTeamLinkIdElement = new List(CareTeamLinkIdElement.DeepCopyInternal()); - if(DiagnosisLinkIdElement.Any()) dest.DiagnosisLinkIdElement = new List(DiagnosisLinkIdElement.DeepCopyInternal()); - if(ProcedureLinkIdElement.Any()) dest.ProcedureLinkIdElement = new List(ProcedureLinkIdElement.DeepCopyInternal()); - if(InformationLinkIdElement.Any()) dest.InformationLinkIdElement = new List(InformationLinkIdElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_CareTeamLinkIdElement is not null) dest.CareTeamLinkIdElement = new List(_CareTeamLinkIdElement.DeepCopyInternal()); + if(_DiagnosisLinkIdElement is not null) dest.DiagnosisLinkIdElement = new List(_DiagnosisLinkIdElement.DeepCopyInternal()); + if(_ProcedureLinkIdElement is not null) dest.ProcedureLinkIdElement = new List(_ProcedureLinkIdElement.DeepCopyInternal()); + if(_InformationLinkIdElement is not null) dest.InformationLinkIdElement = new List(_InformationLinkIdElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2116,174 +2047,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(CareTeamLinkIdElement, otherT.CareTeamLinkIdElement)) return false; - if(!comparer.ListEquals(DiagnosisLinkIdElement, otherT.DiagnosisLinkIdElement)) return false; - if(!comparer.ListEquals(ProcedureLinkIdElement, otherT.ProcedureLinkIdElement)) return false; - if(!comparer.ListEquals(InformationLinkIdElement, otherT.InformationLinkIdElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_CareTeamLinkIdElement, otherT._CareTeamLinkIdElement)) return false; + if(!comparer.ListEquals(_DiagnosisLinkIdElement, otherT._DiagnosisLinkIdElement)) return false; + if(!comparer.ListEquals(_ProcedureLinkIdElement, otherT._ProcedureLinkIdElement)) return false; + if(!comparer.ListEquals(_InformationLinkIdElement, otherT._InformationLinkIdElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "careTeamLinkId": - value = CareTeamLinkIdElement; - return CareTeamLinkIdElement?.Any() == true; + value = _CareTeamLinkIdElement; + return _CareTeamLinkIdElement?.Any() == true; case "diagnosisLinkId": - value = DiagnosisLinkIdElement; - return DiagnosisLinkIdElement?.Any() == true; + value = _DiagnosisLinkIdElement; + return _DiagnosisLinkIdElement?.Any() == true; case "procedureLinkId": - value = ProcedureLinkIdElement; - return ProcedureLinkIdElement?.Any() == true; + value = _ProcedureLinkIdElement; + return _ProcedureLinkIdElement?.Any() == true; case "informationLinkId": - value = InformationLinkIdElement; - return InformationLinkIdElement?.Any() == true; + value = _InformationLinkIdElement; + return _InformationLinkIdElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "careTeamLinkId": - CareTeamLinkIdElement = (List)value; + CareTeamLinkIdElement = (List?)value!; return this; case "diagnosisLinkId": - DiagnosisLinkIdElement = (List)value; + DiagnosisLinkIdElement = (List?)value!; return this; case "procedureLinkId": - ProcedureLinkIdElement = (List)value; + ProcedureLinkIdElement = (List?)value!; return this; case "informationLinkId": - InformationLinkIdElement = (List)value; + InformationLinkIdElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2294,27 +2225,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (CareTeamLinkIdElement?.Any() == true) yield return new KeyValuePair("careTeamLinkId",CareTeamLinkIdElement); - if (DiagnosisLinkIdElement?.Any() == true) yield return new KeyValuePair("diagnosisLinkId",DiagnosisLinkIdElement); - if (ProcedureLinkIdElement?.Any() == true) yield return new KeyValuePair("procedureLinkId",ProcedureLinkIdElement); - if (InformationLinkIdElement?.Any() == true) yield return new KeyValuePair("informationLinkId",InformationLinkIdElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_CareTeamLinkIdElement?.Any() == true) yield return new KeyValuePair("careTeamLinkId",_CareTeamLinkIdElement); + if (_DiagnosisLinkIdElement?.Any() == true) yield return new KeyValuePair("diagnosisLinkId",_DiagnosisLinkIdElement); + if (_ProcedureLinkIdElement?.Any() == true) yield return new KeyValuePair("procedureLinkId",_ProcedureLinkIdElement); + if (_InformationLinkIdElement?.Any() == true) yield return new KeyValuePair("informationLinkId",_InformationLinkIdElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2341,13 +2272,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance @@ -2356,13 +2287,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2373,13 +2301,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -2387,13 +2315,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -2401,13 +2329,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -2418,11 +2346,11 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program specific reason for item inclusion. @@ -2433,50 +2361,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of Products or Services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per point. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2485,13 +2413,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2501,13 +2426,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique Device Identifier. @@ -2519,11 +2444,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Additional items. @@ -2533,34 +2458,30 @@ public List Udi [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2572,111 +2493,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2687,18 +2608,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -2725,13 +2646,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance @@ -2740,13 +2661,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2757,13 +2675,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -2771,13 +2689,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -2785,13 +2703,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -2802,11 +2720,11 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program specific reason for item inclusion. @@ -2817,50 +2735,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of Products or Services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per point. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2869,13 +2787,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2885,13 +2800,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique Device Identifier. @@ -2903,33 +2818,29 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2941,104 +2852,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3049,17 +2960,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -3072,11 +2983,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -3085,13 +2996,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("ClaimStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -3100,13 +3011,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3117,13 +3025,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("type", Order=110, FiveWs="class")] [Binding("ClaimType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Finer grained claim type information. @@ -3134,11 +3042,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List SubType { - get { if(_SubType==null) _SubType = new List(); return _SubType; } + get => _SubType ?? new List(); set { _SubType = value; OnPropertyChanged("SubType"); } } - private List _SubType; + private List? _SubType; /// /// complete | proposed | exploratory | other. @@ -3147,13 +3055,13 @@ public List SubType [DeclaredType(Type = typeof(Code))] [Binding("Use")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// complete | proposed | exploratory | other @@ -3162,13 +3070,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.Claim.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -3180,54 +3085,51 @@ public Hl7.Fhir.Model.Claim.ClaimUseCode? Use [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Period for charge submission. /// [FhirElement("billablePeriod", Order=150, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Creation date. /// [FhirElement("created", Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -3239,13 +3141,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Target. @@ -3254,13 +3156,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Responsible provider. @@ -3269,13 +3171,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Responsible organization. @@ -3284,13 +3186,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Desired processing priority. @@ -3298,13 +3200,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [FhirElement("priority", Order=210)] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// Funds requested to be reserved. @@ -3312,13 +3214,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("fundsReserve", Order=220)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Related Claims which may be revelant to processing this claimn. @@ -3328,11 +3230,11 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services or products. @@ -3341,13 +3243,13 @@ public List Related [CLSCompliant(false)] [References("MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superceded by fulfiller. @@ -3356,26 +3258,26 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Party to be paid any benefits payable. /// [FhirElement("payee", Order=260)] [DataMember] - public Hl7.Fhir.Model.Claim.PayeeComponent Payee + public Hl7.Fhir.Model.Claim.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.Claim.PayeeComponent _Payee; + private Hl7.Fhir.Model.Claim.PayeeComponent? _Payee; /// /// Treatment Referral. @@ -3384,13 +3286,13 @@ public Hl7.Fhir.Model.Claim.PayeeComponent Payee [CLSCompliant(false)] [References("ReferralRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Servicing Facility. @@ -3399,13 +3301,13 @@ public Hl7.Fhir.Model.ResourceReference Referral [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Members of the care team. @@ -3415,11 +3317,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Exceptions, special considerations, the condition, situation, prior or concurrent issues. @@ -3429,11 +3331,11 @@ public List CareTeam [DataMember] public List Information { - get { if(_Information==null) _Information = new List(); return _Information; } + get => _Information ?? new List(); set { _Information = value; OnPropertyChanged("Information"); } } - private List _Information; + private List? _Information; /// /// List of Diagnosis. @@ -3443,11 +3345,11 @@ public List Information [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Procedures performed. @@ -3457,11 +3359,11 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Insurance or medical plan. @@ -3471,50 +3373,50 @@ public List Procedure [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Details about an accident. /// [FhirElement("accident", Order=340)] [DataMember] - public Hl7.Fhir.Model.Claim.AccidentComponent Accident + public Hl7.Fhir.Model.Claim.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.Claim.AccidentComponent _Accident; + private Hl7.Fhir.Model.Claim.AccidentComponent? _Accident; /// /// Period unable to work. /// [FhirElement("employmentImpacted", Order=350)] [DataMember] - public Hl7.Fhir.Model.Period EmploymentImpacted + public Hl7.Fhir.Model.Period? EmploymentImpacted { get { return _EmploymentImpacted; } set { _EmploymentImpacted = value; OnPropertyChanged("EmploymentImpacted"); } } - private Hl7.Fhir.Model.Period _EmploymentImpacted; + private Hl7.Fhir.Model.Period? _EmploymentImpacted; /// /// Period in hospital. /// [FhirElement("hospitalization", Order=360)] [DataMember] - public Hl7.Fhir.Model.Period Hospitalization + public Hl7.Fhir.Model.Period? Hospitalization { get { return _Hospitalization; } set { _Hospitalization = value; OnPropertyChanged("Hospitalization"); } } - private Hl7.Fhir.Model.Period _Hospitalization; + private Hl7.Fhir.Model.Period? _Hospitalization; /// /// Goods and Services. @@ -3524,67 +3426,63 @@ public Hl7.Fhir.Model.Period Hospitalization [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Total claim cost. /// [FhirElement("total", Order=380)] [DataMember] - public Hl7.Fhir.Model.Money Total + public Hl7.Fhir.Model.Money? Total { get { return _Total; } set { _Total = value; OnPropertyChanged("Total"); } } - private Hl7.Fhir.Model.Money _Total; + private Hl7.Fhir.Model.Money? _Total; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Claim; - - if (dest == null) - { + if(other is not Claim dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType.Any()) dest.SubType = new List(SubType.DeepCopyInternal()); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)Payee.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(Information.Any()) dest.Information = new List(Information.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)Accident.DeepCopyInternal(); - if(EmploymentImpacted != null) dest.EmploymentImpacted = (Hl7.Fhir.Model.Period)EmploymentImpacted.DeepCopyInternal(); - if(Hospitalization != null) dest.Hospitalization = (Hl7.Fhir.Model.Period)Hospitalization.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(Total != null) dest.Total = (Hl7.Fhir.Model.Money)Total.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = new List(_SubType.DeepCopyInternal()); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_Information is not null) dest.Information = new List(_Information.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)_Accident.DeepCopyInternal(); + if(_EmploymentImpacted is not null) dest.EmploymentImpacted = (Hl7.Fhir.Model.Period)_EmploymentImpacted.DeepCopyInternal(); + if(_Hospitalization is not null) dest.Hospitalization = (Hl7.Fhir.Model.Period)_Hospitalization.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_Total is not null) dest.Total = (Hl7.Fhir.Model.Money)_Total.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3596,237 +3494,237 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Claim; - if(otherT == null) return false; + if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(Information, otherT.Information)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.Equals(EmploymentImpacted, otherT.EmploymentImpacted)) return false; - if(!comparer.Equals(Hospitalization, otherT.Hospitalization)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.Equals(Total, otherT.Total)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_Information, otherT._Information)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.Equals(_EmploymentImpacted, otherT._EmploymentImpacted)) return false; + if(!comparer.Equals(_Hospitalization, otherT._Hospitalization)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Total, otherT._Total)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType?.Any() == true; + value = _SubType; + return _SubType?.Any() == true; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "information": - value = Information; - return Information?.Any() == true; + value = _Information; + return _Information?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "employmentImpacted": - value = EmploymentImpacted; - return EmploymentImpacted is not null; + value = _EmploymentImpacted; + return _EmploymentImpacted is not null; case "hospitalization": - value = Hospitalization; - return Hospitalization is not null; + value = _Hospitalization; + return _Hospitalization is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "total": - value = Total; - return Total is not null; + value = _Total; + return _Total is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (List)value; + SubType = (List?)value!; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.Claim.PayeeComponent?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "information": - Information = (List)value; + Information = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "accident": - Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.Claim.AccidentComponent?)value; return this; case "employmentImpacted": - EmploymentImpacted = (Hl7.Fhir.Model.Period)value; + EmploymentImpacted = (Hl7.Fhir.Model.Period?)value; return this; case "hospitalization": - Hospitalization = (Hl7.Fhir.Model.Period)value; + Hospitalization = (Hl7.Fhir.Model.Period?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "total": - Total = (Hl7.Fhir.Model.Money)value; + Total = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -3837,36 +3735,36 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType?.Any() == true) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (Information?.Any() == true) yield return new KeyValuePair("information",Information); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (EmploymentImpacted is not null) yield return new KeyValuePair("employmentImpacted",EmploymentImpacted); - if (Hospitalization is not null) yield return new KeyValuePair("hospitalization",Hospitalization); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (Total is not null) yield return new KeyValuePair("total",Total); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType?.Any() == true) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_Information?.Any() == true) yield return new KeyValuePair("information",_Information); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_EmploymentImpacted is not null) yield return new KeyValuePair("employmentImpacted",_EmploymentImpacted); + if (_Hospitalization is not null) yield return new KeyValuePair("hospitalization",_Hospitalization); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_Total is not null) yield return new KeyValuePair("total",_Total); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs index ef07d2711..2c708b830 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequenceLinkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement + public Hl7.Fhir.Model.PositiveInt? SequenceLinkIdElement { get { return _SequenceLinkIdElement; } set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceLinkIdElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceLinkIdElement; /// /// Service instance @@ -96,13 +99,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement [IgnoreDataMember] public int? SequenceLinkId { - get { return SequenceLinkIdElement != null ? SequenceLinkIdElement.Value : null; } + get => _SequenceLinkIdElement?.Value; set { - if (value == null) - SequenceLinkIdElement = null; - else - SequenceLinkIdElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceLinkIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SequenceLinkId"); } } @@ -115,24 +115,24 @@ public int? SequenceLinkId [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -147,11 +147,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Detail line items. @@ -161,26 +161,22 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceLinkIdElement != null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)SequenceLinkIdElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceLinkIdElement is not null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)_SequenceLinkIdElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -192,55 +188,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceLinkIdElement, otherT.SequenceLinkIdElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceLinkId": - value = SequenceLinkIdElement; - return SequenceLinkIdElement is not null; + value = _SequenceLinkIdElement; + return _SequenceLinkIdElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceLinkId": - SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -251,10 +247,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",SequenceLinkIdElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",_SequenceLinkIdElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -282,13 +278,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of Adjudication outcome. @@ -296,39 +292,39 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monetary value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Non-monetary value @@ -337,31 +333,24 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -373,55 +362,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -432,10 +421,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -462,13 +451,13 @@ public partial class ItemDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequenceLinkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement + public Hl7.Fhir.Model.PositiveInt? SequenceLinkIdElement { get { return _SequenceLinkIdElement; } set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceLinkIdElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceLinkIdElement; /// /// Service instance @@ -477,13 +466,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement [IgnoreDataMember] public int? SequenceLinkId { - get { return SequenceLinkIdElement != null ? SequenceLinkIdElement.Value : null; } + get => _SequenceLinkIdElement?.Value; set { - if (value == null) - SequenceLinkIdElement = null; - else - SequenceLinkIdElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceLinkIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SequenceLinkId"); } } @@ -496,24 +482,24 @@ public int? SequenceLinkId [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -528,11 +514,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Subdetail line items. @@ -542,26 +528,22 @@ public List Adjudication [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemDetailComponent; - - if (dest == null) - { + if(other is not ItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceLinkIdElement != null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)SequenceLinkIdElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceLinkIdElement is not null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)_SequenceLinkIdElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -573,55 +555,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemDetailComponent; - if(otherT == null) return false; + if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceLinkIdElement, otherT.SequenceLinkIdElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceLinkId": - value = SequenceLinkIdElement; - return SequenceLinkIdElement is not null; + value = _SequenceLinkIdElement; + return _SequenceLinkIdElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceLinkId": - SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -632,10 +614,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",SequenceLinkIdElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",_SequenceLinkIdElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -662,13 +644,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequenceLinkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement + public Hl7.Fhir.Model.PositiveInt? SequenceLinkIdElement { get { return _SequenceLinkIdElement; } set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceLinkIdElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceLinkIdElement; /// /// Service instance @@ -677,13 +659,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement [IgnoreDataMember] public int? SequenceLinkId { - get { return SequenceLinkIdElement != null ? SequenceLinkIdElement.Value : null; } + get => _SequenceLinkIdElement?.Value; set { - if (value == null) - SequenceLinkIdElement = null; - else - SequenceLinkIdElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceLinkIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SequenceLinkId"); } } @@ -696,24 +675,24 @@ public int? SequenceLinkId [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -728,25 +707,21 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceLinkIdElement != null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)SequenceLinkIdElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SequenceLinkIdElement is not null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)_SequenceLinkIdElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -758,48 +733,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceLinkIdElement, otherT.SequenceLinkIdElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceLinkId": - value = SequenceLinkIdElement; - return SequenceLinkIdElement is not null; + value = _SequenceLinkIdElement; + return _SequenceLinkIdElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceLinkId": - SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -810,9 +785,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",SequenceLinkIdElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",_SequenceLinkIdElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -841,24 +816,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SequenceLinkIdElement { - get { if(_SequenceLinkIdElement==null) _SequenceLinkIdElement = new List(); return _SequenceLinkIdElement; } + get => _SequenceLinkIdElement ?? new List(); set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } - private List _SequenceLinkIdElement; + private List? _SequenceLinkIdElement; /// /// Service instances /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SequenceLinkId + public IEnumerable? SequenceLinkId { - get { return SequenceLinkIdElement != null ? SequenceLinkIdElement.Select(elem => elem.Value) : null; } + get => _SequenceLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - SequenceLinkIdElement = null; + SequenceLinkIdElement = null!; else SequenceLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SequenceLinkId"); @@ -871,13 +846,13 @@ public IEnumerable SequenceLinkId [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -885,13 +860,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Group, Service or Product. @@ -899,13 +874,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -916,24 +891,24 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Professional fee or Product charge. /// [FhirElement("fee", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Fee + public Hl7.Fhir.Model.Money? Fee { get { return _Fee; } set { _Fee = value; OnPropertyChanged("Fee"); } } - private Hl7.Fhir.Model.Money _Fee; + private Hl7.Fhir.Model.Money? _Fee; /// /// List of note numbers which apply. @@ -943,24 +918,24 @@ public Hl7.Fhir.Model.Money Fee [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -975,11 +950,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Added items details. @@ -989,31 +964,27 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceLinkIdElement.Any()) dest.SequenceLinkIdElement = new List(SequenceLinkIdElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Fee != null) dest.Fee = (Hl7.Fhir.Model.Money)Fee.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceLinkIdElement is not null) dest.SequenceLinkIdElement = new List(_SequenceLinkIdElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Fee is not null) dest.Fee = (Hl7.Fhir.Model.Money)_Fee.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1025,90 +996,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(SequenceLinkIdElement, otherT.SequenceLinkIdElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Fee, otherT.Fee)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Fee, otherT._Fee)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceLinkId": - value = SequenceLinkIdElement; - return SequenceLinkIdElement?.Any() == true; + value = _SequenceLinkIdElement; + return _SequenceLinkIdElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "fee": - value = Fee; - return Fee is not null; + value = _Fee; + return _Fee is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceLinkId": - SequenceLinkIdElement = (List)value; + SequenceLinkIdElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "fee": - Fee = (Hl7.Fhir.Model.Money)value; + Fee = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1119,15 +1090,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceLinkIdElement?.Any() == true) yield return new KeyValuePair("sequenceLinkId",SequenceLinkIdElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Fee is not null) yield return new KeyValuePair("fee",Fee); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceLinkIdElement?.Any() == true) yield return new KeyValuePair("sequenceLinkId",_SequenceLinkIdElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Fee is not null) yield return new KeyValuePair("fee",_Fee); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -1154,13 +1125,13 @@ public partial class AddedItemsDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("revenue", Order=40)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -1168,13 +1139,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=50)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Service or Product. @@ -1182,13 +1153,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -1199,24 +1170,24 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Professional fee or Product charge. /// [FhirElement("fee", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money Fee + public Hl7.Fhir.Model.Money? Fee { get { return _Fee; } set { _Fee = value; OnPropertyChanged("Fee"); } } - private Hl7.Fhir.Model.Money _Fee; + private Hl7.Fhir.Model.Money? _Fee; /// /// List of note numbers which apply. @@ -1226,24 +1197,24 @@ public Hl7.Fhir.Model.Money Fee [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1258,29 +1229,25 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemsDetailComponent; - - if (dest == null) - { + if(other is not AddedItemsDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Fee != null) dest.Fee = (Hl7.Fhir.Model.Money)Fee.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Fee is not null) dest.Fee = (Hl7.Fhir.Model.Money)_Fee.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1292,76 +1259,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemsDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemsDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Fee, otherT.Fee)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Fee, otherT._Fee)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "fee": - value = Fee; - return Fee is not null; + value = _Fee; + return _Fee is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "fee": - Fee = (Hl7.Fhir.Model.Money)value; + Fee = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1372,13 +1339,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Fee is not null) yield return new KeyValuePair("fee",Fee); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Fee is not null) yield return new KeyValuePair("fee",_Fee); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -1404,13 +1371,13 @@ public partial class ErrorComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("sequenceLinkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement + public Hl7.Fhir.Model.PositiveInt? SequenceLinkIdElement { get { return _SequenceLinkIdElement; } set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceLinkIdElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceLinkIdElement; /// /// Item sequence number @@ -1419,13 +1386,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceLinkIdElement [IgnoreDataMember] public int? SequenceLinkId { - get { return SequenceLinkIdElement != null ? SequenceLinkIdElement.Value : null; } + get => _SequenceLinkIdElement?.Value; set { - if (value == null) - SequenceLinkIdElement = null; - else - SequenceLinkIdElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceLinkIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SequenceLinkId"); } } @@ -1435,13 +1399,13 @@ public int? SequenceLinkId /// [FhirElement("detailSequenceLinkId", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DetailSequenceLinkIdElement + public Hl7.Fhir.Model.PositiveInt? DetailSequenceLinkIdElement { get { return _DetailSequenceLinkIdElement; } set { _DetailSequenceLinkIdElement = value; OnPropertyChanged("DetailSequenceLinkIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _DetailSequenceLinkIdElement; + private Hl7.Fhir.Model.PositiveInt? _DetailSequenceLinkIdElement; /// /// Detail sequence number @@ -1450,13 +1414,10 @@ public Hl7.Fhir.Model.PositiveInt DetailSequenceLinkIdElement [IgnoreDataMember] public int? DetailSequenceLinkId { - get { return DetailSequenceLinkIdElement != null ? DetailSequenceLinkIdElement.Value : null; } + get => _DetailSequenceLinkIdElement?.Value; set { - if (value == null) - DetailSequenceLinkIdElement = null; - else - DetailSequenceLinkIdElement = new Hl7.Fhir.Model.PositiveInt(value); + DetailSequenceLinkIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DetailSequenceLinkId"); } } @@ -1466,13 +1427,13 @@ public int? DetailSequenceLinkId /// [FhirElement("subdetailSequenceLinkId", Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SubdetailSequenceLinkIdElement + public Hl7.Fhir.Model.PositiveInt? SubdetailSequenceLinkIdElement { get { return _SubdetailSequenceLinkIdElement; } set { _SubdetailSequenceLinkIdElement = value; OnPropertyChanged("SubdetailSequenceLinkIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _SubdetailSequenceLinkIdElement; + private Hl7.Fhir.Model.PositiveInt? _SubdetailSequenceLinkIdElement; /// /// Subdetail sequence number @@ -1481,13 +1442,10 @@ public Hl7.Fhir.Model.PositiveInt SubdetailSequenceLinkIdElement [IgnoreDataMember] public int? SubdetailSequenceLinkId { - get { return SubdetailSequenceLinkIdElement != null ? SubdetailSequenceLinkIdElement.Value : null; } + get => _SubdetailSequenceLinkIdElement?.Value; set { - if (value == null) - SubdetailSequenceLinkIdElement = null; - else - SubdetailSequenceLinkIdElement = new Hl7.Fhir.Model.PositiveInt(value); + SubdetailSequenceLinkIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SubdetailSequenceLinkId"); } } @@ -1499,28 +1457,24 @@ public int? SubdetailSequenceLinkId [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorComponent; - - if (dest == null) - { + if(other is not ErrorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceLinkIdElement != null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)SequenceLinkIdElement.DeepCopyInternal(); - if(DetailSequenceLinkIdElement != null) dest.DetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)DetailSequenceLinkIdElement.DeepCopyInternal(); - if(SubdetailSequenceLinkIdElement != null) dest.SubdetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)SubdetailSequenceLinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_SequenceLinkIdElement is not null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)_SequenceLinkIdElement.DeepCopyInternal(); + if(_DetailSequenceLinkIdElement is not null) dest.DetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)_DetailSequenceLinkIdElement.DeepCopyInternal(); + if(_SubdetailSequenceLinkIdElement is not null) dest.SubdetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)_SubdetailSequenceLinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1532,55 +1486,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorComponent; - if(otherT == null) return false; + if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceLinkIdElement, otherT.SequenceLinkIdElement)) return false; - if(!comparer.Equals(DetailSequenceLinkIdElement, otherT.DetailSequenceLinkIdElement)) return false; - if(!comparer.Equals(SubdetailSequenceLinkIdElement, otherT.SubdetailSequenceLinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + if(!comparer.Equals(_DetailSequenceLinkIdElement, otherT._DetailSequenceLinkIdElement)) return false; + if(!comparer.Equals(_SubdetailSequenceLinkIdElement, otherT._SubdetailSequenceLinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceLinkId": - value = SequenceLinkIdElement; - return SequenceLinkIdElement is not null; + value = _SequenceLinkIdElement; + return _SequenceLinkIdElement is not null; case "detailSequenceLinkId": - value = DetailSequenceLinkIdElement; - return DetailSequenceLinkIdElement is not null; + value = _DetailSequenceLinkIdElement; + return _DetailSequenceLinkIdElement is not null; case "subdetailSequenceLinkId": - value = SubdetailSequenceLinkIdElement; - return SubdetailSequenceLinkIdElement is not null; + value = _SubdetailSequenceLinkIdElement; + return _SubdetailSequenceLinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceLinkId": - SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "detailSequenceLinkId": - DetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)value; + DetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "subdetailSequenceLinkId": - SubdetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt)value; + SubdetailSequenceLinkIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1591,10 +1545,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",SequenceLinkIdElement); - if (DetailSequenceLinkIdElement is not null) yield return new KeyValuePair("detailSequenceLinkId",DetailSequenceLinkIdElement); - if (SubdetailSequenceLinkIdElement is not null) yield return new KeyValuePair("subdetailSequenceLinkId",SubdetailSequenceLinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",_SequenceLinkIdElement); + if (_DetailSequenceLinkIdElement is not null) yield return new KeyValuePair("detailSequenceLinkId",_DetailSequenceLinkIdElement); + if (_SubdetailSequenceLinkIdElement is not null) yield return new KeyValuePair("subdetailSequenceLinkId",_SubdetailSequenceLinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -1621,26 +1575,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PaymentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-Claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the non-claim adjustment. @@ -1648,41 +1602,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected data of Payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected data of Payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1692,43 +1643,39 @@ public string Date /// [FhirElement("amount", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Identifier of the payment instrument. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1740,69 +1687,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -1813,12 +1760,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -1844,13 +1791,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Sequence Number for this note @@ -1859,13 +1806,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -1876,41 +1820,38 @@ public int? Number [FhirElement("type", Order=50)] [Binding("NoteType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Note explanatory text. /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -1921,28 +1862,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1954,55 +1891,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -2013,10 +1950,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -2043,13 +1980,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance identifier @@ -2058,13 +1995,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2075,13 +2009,13 @@ public int? Sequence [FhirElement("focal", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Is the focal Coverage @@ -2090,13 +2024,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -2109,41 +2040,38 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Business agreement. /// [FhirElement("businessArrangement", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Business agreement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -2156,24 +2084,24 @@ public string BusinessArrangement [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Pre-Authorization/Determination Reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -2187,30 +2115,26 @@ public IEnumerable PreAuthRef [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2222,69 +2146,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -2295,12 +2219,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -2313,11 +2237,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -2326,13 +2250,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("ClaimResponseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -2341,13 +2265,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2359,41 +2280,38 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Creation date. /// [FhirElement("created", Order=120, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -2405,13 +2323,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Responsible practitioner. @@ -2420,13 +2338,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; /// /// Responsible organization. @@ -2435,13 +2353,13 @@ public Hl7.Fhir.Model.ResourceReference RequestProvider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestOrganization + public Hl7.Fhir.Model.ResourceReference? RequestOrganization { get { return _RequestOrganization; } set { _RequestOrganization = value; OnPropertyChanged("RequestOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestOrganization; /// /// Id of resource triggering adjudication. @@ -2450,13 +2368,13 @@ public Hl7.Fhir.Model.ResourceReference RequestOrganization [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// complete | error | partial. @@ -2464,41 +2382,38 @@ public Hl7.Fhir.Model.ResourceReference Request [FhirElement("outcome", Order=170)] [Binding("RemittanceOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Disposition Message. /// [FhirElement("disposition", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -2509,13 +2424,13 @@ public string Disposition [FhirElement("payeeType", Order=190)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PayeeType + public Hl7.Fhir.Model.CodeableConcept? PayeeType { get { return _PayeeType; } set { _PayeeType = value; OnPropertyChanged("PayeeType"); } } - private Hl7.Fhir.Model.CodeableConcept _PayeeType; + private Hl7.Fhir.Model.CodeableConcept? _PayeeType; /// /// Line items. @@ -2525,11 +2440,11 @@ public Hl7.Fhir.Model.CodeableConcept PayeeType [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -2539,11 +2454,11 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Processing errors. @@ -2553,63 +2468,63 @@ public List AddItem [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; /// /// Total Cost of service from the Claim. /// [FhirElement("totalCost", Order=230)] [DataMember] - public Hl7.Fhir.Model.Money TotalCost + public Hl7.Fhir.Model.Money? TotalCost { get { return _TotalCost; } set { _TotalCost = value; OnPropertyChanged("TotalCost"); } } - private Hl7.Fhir.Model.Money _TotalCost; + private Hl7.Fhir.Model.Money? _TotalCost; /// /// Unallocated deductible. /// [FhirElement("unallocDeductable", Order=240)] [DataMember] - public Hl7.Fhir.Model.Money UnallocDeductable + public Hl7.Fhir.Model.Money? UnallocDeductable { get { return _UnallocDeductable; } set { _UnallocDeductable = value; OnPropertyChanged("UnallocDeductable"); } } - private Hl7.Fhir.Model.Money _UnallocDeductable; + private Hl7.Fhir.Model.Money? _UnallocDeductable; /// /// Total benefit payable for the Claim. /// [FhirElement("totalBenefit", Order=250)] [DataMember] - public Hl7.Fhir.Model.Money TotalBenefit + public Hl7.Fhir.Model.Money? TotalBenefit { get { return _TotalBenefit; } set { _TotalBenefit = value; OnPropertyChanged("TotalBenefit"); } } - private Hl7.Fhir.Model.Money _TotalBenefit; + private Hl7.Fhir.Model.Money? _TotalBenefit; /// /// Payment details, if paid. /// [FhirElement("payment", Order=260)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment + public Hl7.Fhir.Model.ClaimResponse.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ClaimResponse.PaymentComponent _Payment; + private Hl7.Fhir.Model.ClaimResponse.PaymentComponent? _Payment; /// /// Funds reserved status. @@ -2617,13 +2532,13 @@ public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment [FhirElement("reserved", Order=270)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.Coding Reserved + public Hl7.Fhir.Model.Coding? Reserved { get { return _Reserved; } set { _Reserved = value; OnPropertyChanged("Reserved"); } } - private Hl7.Fhir.Model.Coding _Reserved; + private Hl7.Fhir.Model.Coding? _Reserved; /// /// Printed Form Identifier. @@ -2631,13 +2546,13 @@ public Hl7.Fhir.Model.Coding Reserved [FhirElement("form", Order=280)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Processing notes. @@ -2647,11 +2562,11 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// Request for additional information. @@ -2663,11 +2578,11 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get { if(_CommunicationRequest==null) _CommunicationRequest = new List(); return _CommunicationRequest; } + get => _CommunicationRequest ?? new List(); set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } - private List _CommunicationRequest; + private List? _CommunicationRequest; /// /// Insurance or medical plan. @@ -2677,47 +2592,43 @@ public List CommunicationRequest [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClaimResponse; - - if (dest == null) - { + if(other is not ClaimResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); - if(RequestOrganization != null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)RequestOrganization.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PayeeType != null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)PayeeType.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); - if(TotalCost != null) dest.TotalCost = (Hl7.Fhir.Model.Money)TotalCost.DeepCopyInternal(); - if(UnallocDeductable != null) dest.UnallocDeductable = (Hl7.Fhir.Model.Money)UnallocDeductable.DeepCopyInternal(); - if(TotalBenefit != null) dest.TotalBenefit = (Hl7.Fhir.Model.Money)TotalBenefit.DeepCopyInternal(); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)Payment.DeepCopyInternal(); - if(Reserved != null) dest.Reserved = (Hl7.Fhir.Model.Coding)Reserved.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(CommunicationRequest.Any()) dest.CommunicationRequest = new List(CommunicationRequest.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); + if(_RequestOrganization is not null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestOrganization.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PayeeType is not null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)_PayeeType.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); + if(_TotalCost is not null) dest.TotalCost = (Hl7.Fhir.Model.Money)_TotalCost.DeepCopyInternal(); + if(_UnallocDeductable is not null) dest.UnallocDeductable = (Hl7.Fhir.Model.Money)_UnallocDeductable.DeepCopyInternal(); + if(_TotalBenefit is not null) dest.TotalBenefit = (Hl7.Fhir.Model.Money)_TotalBenefit.DeepCopyInternal(); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)_Payment.DeepCopyInternal(); + if(_Reserved is not null) dest.Reserved = (Hl7.Fhir.Model.Coding)_Reserved.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_CommunicationRequest is not null) dest.CommunicationRequest = new List(_CommunicationRequest.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2729,188 +2640,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClaimResponse; - if(otherT == null) return false; + if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; - if(!comparer.Equals(RequestOrganization, otherT.RequestOrganization)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(PayeeType, otherT.PayeeType)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; - if(!comparer.Equals(TotalCost, otherT.TotalCost)) return false; - if(!comparer.Equals(UnallocDeductable, otherT.UnallocDeductable)) return false; - if(!comparer.Equals(TotalBenefit, otherT.TotalBenefit)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(Reserved, otherT.Reserved)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.ListEquals(CommunicationRequest, otherT.CommunicationRequest)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; + if(!comparer.Equals(_RequestOrganization, otherT._RequestOrganization)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_PayeeType, otherT._PayeeType)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; + if(!comparer.Equals(_TotalCost, otherT._TotalCost)) return false; + if(!comparer.Equals(_UnallocDeductable, otherT._UnallocDeductable)) return false; + if(!comparer.Equals(_TotalBenefit, otherT._TotalBenefit)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_Reserved, otherT._Reserved)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; case "requestOrganization": - value = RequestOrganization; - return RequestOrganization is not null; + value = _RequestOrganization; + return _RequestOrganization is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "payeeType": - value = PayeeType; - return PayeeType is not null; + value = _PayeeType; + return _PayeeType is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; case "totalCost": - value = TotalCost; - return TotalCost is not null; + value = _TotalCost; + return _TotalCost is not null; case "unallocDeductable": - value = UnallocDeductable; - return UnallocDeductable is not null; + value = _UnallocDeductable; + return _UnallocDeductable is not null; case "totalBenefit": - value = TotalBenefit; - return TotalBenefit is not null; + value = _TotalBenefit; + return _TotalBenefit is not null; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "reserved": - value = Reserved; - return Reserved is not null; + value = _Reserved; + return _Reserved is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "communicationRequest": - value = CommunicationRequest; - return CommunicationRequest?.Any() == true; + value = _CommunicationRequest; + return _CommunicationRequest?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestOrganization": - RequestOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "payeeType": - PayeeType = (Hl7.Fhir.Model.CodeableConcept)value; + PayeeType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; case "totalCost": - TotalCost = (Hl7.Fhir.Model.Money)value; + TotalCost = (Hl7.Fhir.Model.Money?)value; return this; case "unallocDeductable": - UnallocDeductable = (Hl7.Fhir.Model.Money)value; + UnallocDeductable = (Hl7.Fhir.Model.Money?)value; return this; case "totalBenefit": - TotalBenefit = (Hl7.Fhir.Model.Money)value; + TotalBenefit = (Hl7.Fhir.Model.Money?)value; return this; case "payment": - Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent?)value; return this; case "reserved": - Reserved = (Hl7.Fhir.Model.Coding)value; + Reserved = (Hl7.Fhir.Model.Coding?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "communicationRequest": - CommunicationRequest = (List)value; + CommunicationRequest = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2921,29 +2832,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); - if (RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",RequestOrganization); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PayeeType is not null) yield return new KeyValuePair("payeeType",PayeeType); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); - if (TotalCost is not null) yield return new KeyValuePair("totalCost",TotalCost); - if (UnallocDeductable is not null) yield return new KeyValuePair("unallocDeductable",UnallocDeductable); - if (TotalBenefit is not null) yield return new KeyValuePair("totalBenefit",TotalBenefit); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (Reserved is not null) yield return new KeyValuePair("reserved",Reserved); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",CommunicationRequest); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); + if (_RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",_RequestOrganization); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PayeeType is not null) yield return new KeyValuePair("payeeType",_PayeeType); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); + if (_TotalCost is not null) yield return new KeyValuePair("totalCost",_TotalCost); + if (_UnallocDeductable is not null) yield return new KeyValuePair("unallocDeductable",_UnallocDeductable); + if (_TotalBenefit is not null) yield return new KeyValuePair("totalBenefit",_TotalBenefit); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_Reserved is not null) yield return new KeyValuePair("reserved",_Reserved); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",_CommunicationRequest); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs index faafdc83b..c3094816a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,13 +113,13 @@ public partial class InvestigationComponent : Hl7.Fhir.Model.BackboneElement [Binding("InvestigationGroupType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Record of a specific investigation. @@ -128,24 +131,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InvestigationComponent; - - if (dest == null) - { + if(other is not InvestigationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -157,41 +156,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InvestigationComponent; - if(otherT == null) return false; + if(other is not InvestigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -202,8 +201,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -234,57 +233,50 @@ public partial class FindingComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// Which investigations support finding. /// [FhirElement("basis", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString BasisElement + public Hl7.Fhir.Model.FhirString? BasisElement { get { return _BasisElement; } set { _BasisElement = value; OnPropertyChanged("BasisElement"); } } - private Hl7.Fhir.Model.FhirString _BasisElement; + private Hl7.Fhir.Model.FhirString? _BasisElement; /// /// Which investigations support finding /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Basis + public string? Basis { - get { return BasisElement != null ? BasisElement.Value : null; } + get => _BasisElement?.Value; set { - if (value == null) - BasisElement = null; - else - BasisElement = new Hl7.Fhir.Model.FhirString(value); + BasisElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Basis"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FindingComponent; - - if (dest == null) - { + if(other is not FindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(BasisElement != null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)BasisElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_BasisElement is not null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)_BasisElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -296,41 +288,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FindingComponent; - if(otherT == null) return false; + if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(BasisElement, otherT.BasisElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "basis": - value = BasisElement; - return BasisElement is not null; + value = _BasisElement; + return _BasisElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "basis": - BasisElement = (Hl7.Fhir.Model.FhirString)value; + BasisElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -341,8 +333,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (BasisElement is not null) yield return new KeyValuePair("basis",BasisElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_BasisElement is not null) yield return new KeyValuePair("basis",_BasisElement); } } @@ -355,11 +347,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | completed | entered-in-error. @@ -369,13 +361,13 @@ public List Identifier [Binding("ClinicalImpressionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | completed | entered-in-error @@ -384,13 +376,10 @@ public Code StatusEl [IgnoreDataMember] public Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -401,41 +390,38 @@ public Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus? Status [FhirElement("code", InSummary=true, Order=110, FiveWs="what")] [Binding("ClinicalImpressionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Why/how the assessment was performed. /// [FhirElement("description", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why/how the assessment was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -448,13 +434,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode created from. @@ -463,13 +449,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Time of assessment. @@ -478,41 +464,38 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the assessment was documented. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the assessment was documented /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -524,13 +507,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Assessor + public Hl7.Fhir.Model.ResourceReference? Assessor { get { return _Assessor; } set { _Assessor = value; OnPropertyChanged("Assessor"); } } - private Hl7.Fhir.Model.ResourceReference _Assessor; + private Hl7.Fhir.Model.ResourceReference? _Assessor; /// /// Reference to last assessment. @@ -539,13 +522,13 @@ public Hl7.Fhir.Model.ResourceReference Assessor [CLSCompliant(false)] [References("ClinicalImpression")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Previous + public Hl7.Fhir.Model.ResourceReference? Previous { get { return _Previous; } set { _Previous = value; OnPropertyChanged("Previous"); } } - private Hl7.Fhir.Model.ResourceReference _Previous; + private Hl7.Fhir.Model.ResourceReference? _Previous; /// /// Relevant impressions of patient state. @@ -557,11 +540,11 @@ public Hl7.Fhir.Model.ResourceReference Previous [DataMember] public List Problem { - get { if(_Problem==null) _Problem = new List(); return _Problem; } + get => _Problem ?? new List(); set { _Problem = value; OnPropertyChanged("Problem"); } } - private List _Problem; + private List? _Problem; /// /// One or more sets of investigations (signs, symptions, etc.). @@ -571,11 +554,11 @@ public List Problem [DataMember] public List Investigation { - get { if(_Investigation==null) _Investigation = new List(); return _Investigation; } + get => _Investigation ?? new List(); set { _Investigation = value; OnPropertyChanged("Investigation"); } } - private List _Investigation; + private List? _Investigation; /// /// Clinical Protocol followed. @@ -585,24 +568,24 @@ public List Investigat [DataMember] public List ProtocolElement { - get { if(_ProtocolElement==null) _ProtocolElement = new List(); return _ProtocolElement; } + get => _ProtocolElement ?? new List(); set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } - private List _ProtocolElement; + private List? _ProtocolElement; /// /// Clinical Protocol followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Protocol + public IEnumerable? Protocol { - get { return ProtocolElement != null ? ProtocolElement.Select(elem => elem.Value) : null; } + get => _ProtocolElement?.Select(elem => elem.Value); set { if (value == null) - ProtocolElement = null; + ProtocolElement = null!; else ProtocolElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Protocol"); @@ -614,28 +597,25 @@ public IEnumerable Protocol /// [FhirElement("summary", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString SummaryElement + public Hl7.Fhir.Model.FhirString? SummaryElement { get { return _SummaryElement; } set { _SummaryElement = value; OnPropertyChanged("SummaryElement"); } } - private Hl7.Fhir.Model.FhirString _SummaryElement; + private Hl7.Fhir.Model.FhirString? _SummaryElement; /// /// Summary of the assessment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Summary + public string? Summary { - get { return SummaryElement != null ? SummaryElement.Value : null; } + get => _SummaryElement?.Value; set { - if (value == null) - SummaryElement = null; - else - SummaryElement = new Hl7.Fhir.Model.FhirString(value); + SummaryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Summary"); } } @@ -648,11 +628,11 @@ public string Summary [DataMember] public List Finding { - get { if(_Finding==null) _Finding = new List(); return _Finding; } + get => _Finding ?? new List(); set { _Finding = value; OnPropertyChanged("Finding"); } } - private List _Finding; + private List? _Finding; /// /// Estimate of likely outcome. @@ -663,11 +643,11 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get { if(_PrognosisCodeableConcept==null) _PrognosisCodeableConcept = new List(); return _PrognosisCodeableConcept; } + get => _PrognosisCodeableConcept ?? new List(); set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } - private List _PrognosisCodeableConcept; + private List? _PrognosisCodeableConcept; /// /// RiskAssessment expressing likely outcome. @@ -679,11 +659,11 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get { if(_PrognosisReference==null) _PrognosisReference = new List(); return _PrognosisReference; } + get => _PrognosisReference ?? new List(); set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } - private List _PrognosisReference; + private List? _PrognosisReference; /// /// Action taken as part of assessment procedure. @@ -695,11 +675,11 @@ public List PrognosisReference [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Comments made about the ClinicalImpression. @@ -709,43 +689,39 @@ public List Action [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClinicalImpression; - - if (dest == null) - { + if(other is not ClinicalImpression dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Assessor != null) dest.Assessor = (Hl7.Fhir.Model.ResourceReference)Assessor.DeepCopyInternal(); - if(Previous != null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)Previous.DeepCopyInternal(); - if(Problem.Any()) dest.Problem = new List(Problem.DeepCopyInternal()); - if(Investigation.Any()) dest.Investigation = new List(Investigation.DeepCopyInternal()); - if(ProtocolElement.Any()) dest.ProtocolElement = new List(ProtocolElement.DeepCopyInternal()); - if(SummaryElement != null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)SummaryElement.DeepCopyInternal(); - if(Finding.Any()) dest.Finding = new List(Finding.DeepCopyInternal()); - if(PrognosisCodeableConcept.Any()) dest.PrognosisCodeableConcept = new List(PrognosisCodeableConcept.DeepCopyInternal()); - if(PrognosisReference.Any()) dest.PrognosisReference = new List(PrognosisReference.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Assessor is not null) dest.Assessor = (Hl7.Fhir.Model.ResourceReference)_Assessor.DeepCopyInternal(); + if(_Previous is not null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)_Previous.DeepCopyInternal(); + if(_Problem is not null) dest.Problem = new List(_Problem.DeepCopyInternal()); + if(_Investigation is not null) dest.Investigation = new List(_Investigation.DeepCopyInternal()); + if(_ProtocolElement is not null) dest.ProtocolElement = new List(_ProtocolElement.DeepCopyInternal()); + if(_SummaryElement is not null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)_SummaryElement.DeepCopyInternal(); + if(_Finding is not null) dest.Finding = new List(_Finding.DeepCopyInternal()); + if(_PrognosisCodeableConcept is not null) dest.PrognosisCodeableConcept = new List(_PrognosisCodeableConcept.DeepCopyInternal()); + if(_PrognosisReference is not null) dest.PrognosisReference = new List(_PrognosisReference.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -757,160 +733,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClinicalImpression; - if(otherT == null) return false; + if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Assessor, otherT.Assessor)) return false; - if(!comparer.Equals(Previous, otherT.Previous)) return false; - if(!comparer.ListEquals(Problem, otherT.Problem)) return false; - if(!comparer.ListEquals(Investigation, otherT.Investigation)) return false; - if(!comparer.ListEquals(ProtocolElement, otherT.ProtocolElement)) return false; - if(!comparer.Equals(SummaryElement, otherT.SummaryElement)) return false; - if(!comparer.ListEquals(Finding, otherT.Finding)) return false; - if(!comparer.ListEquals(PrognosisCodeableConcept, otherT.PrognosisCodeableConcept)) return false; - if(!comparer.ListEquals(PrognosisReference, otherT.PrognosisReference)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Assessor, otherT._Assessor)) return false; + if(!comparer.Equals(_Previous, otherT._Previous)) return false; + if(!comparer.ListEquals(_Problem, otherT._Problem)) return false; + if(!comparer.ListEquals(_Investigation, otherT._Investigation)) return false; + if(!comparer.ListEquals(_ProtocolElement, otherT._ProtocolElement)) return false; + if(!comparer.Equals(_SummaryElement, otherT._SummaryElement)) return false; + if(!comparer.ListEquals(_Finding, otherT._Finding)) return false; + if(!comparer.ListEquals(_PrognosisCodeableConcept, otherT._PrognosisCodeableConcept)) return false; + if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "assessor": - value = Assessor; - return Assessor is not null; + value = _Assessor; + return _Assessor is not null; case "previous": - value = Previous; - return Previous is not null; + value = _Previous; + return _Previous is not null; case "problem": - value = Problem; - return Problem?.Any() == true; + value = _Problem; + return _Problem?.Any() == true; case "investigation": - value = Investigation; - return Investigation?.Any() == true; + value = _Investigation; + return _Investigation?.Any() == true; case "protocol": - value = ProtocolElement; - return ProtocolElement?.Any() == true; + value = _ProtocolElement; + return _ProtocolElement?.Any() == true; case "summary": - value = SummaryElement; - return SummaryElement is not null; + value = _SummaryElement; + return _SummaryElement is not null; case "finding": - value = Finding; - return Finding?.Any() == true; + value = _Finding; + return _Finding?.Any() == true; case "prognosisCodeableConcept": - value = PrognosisCodeableConcept; - return PrognosisCodeableConcept?.Any() == true; + value = _PrognosisCodeableConcept; + return _PrognosisCodeableConcept?.Any() == true; case "prognosisReference": - value = PrognosisReference; - return PrognosisReference?.Any() == true; + value = _PrognosisReference; + return _PrognosisReference?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "assessor": - Assessor = (Hl7.Fhir.Model.ResourceReference)value; + Assessor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "previous": - Previous = (Hl7.Fhir.Model.ResourceReference)value; + Previous = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "problem": - Problem = (List)value; + Problem = (List?)value!; return this; case "investigation": - Investigation = (List)value; + Investigation = (List?)value!; return this; case "protocol": - ProtocolElement = (List)value; + ProtocolElement = (List?)value!; return this; case "summary": - SummaryElement = (Hl7.Fhir.Model.FhirString)value; + SummaryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "finding": - Finding = (List)value; + Finding = (List?)value!; return this; case "prognosisCodeableConcept": - PrognosisCodeableConcept = (List)value; + PrognosisCodeableConcept = (List?)value!; return this; case "prognosisReference": - PrognosisReference = (List)value; + PrognosisReference = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -921,25 +897,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Assessor is not null) yield return new KeyValuePair("assessor",Assessor); - if (Previous is not null) yield return new KeyValuePair("previous",Previous); - if (Problem?.Any() == true) yield return new KeyValuePair("problem",Problem); - if (Investigation?.Any() == true) yield return new KeyValuePair("investigation",Investigation); - if (ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",ProtocolElement); - if (SummaryElement is not null) yield return new KeyValuePair("summary",SummaryElement); - if (Finding?.Any() == true) yield return new KeyValuePair("finding",Finding); - if (PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",PrognosisCodeableConcept); - if (PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",PrognosisReference); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Assessor is not null) yield return new KeyValuePair("assessor",_Assessor); + if (_Previous is not null) yield return new KeyValuePair("previous",_Previous); + if (_Problem?.Any() == true) yield return new KeyValuePair("problem",_Problem); + if (_Investigation?.Any() == true) yield return new KeyValuePair("investigation",_Investigation); + if (_ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",_ProtocolElement); + if (_SummaryElement is not null) yield return new KeyValuePair("summary",_SummaryElement); + if (_Finding?.Any() == true) yield return new KeyValuePair("finding",_Finding); + if (_PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",_PrognosisCodeableConcept); + if (_PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",_PrognosisReference); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs index 6259fe27d..92b4c2729 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -195,28 +198,25 @@ public partial class FilterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies the filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -226,28 +226,25 @@ public string Code /// [FhirElement("description", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// How or why the filter is used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -262,24 +259,24 @@ public string Description [DataMember] public List> OperatorElement { - get { if(_OperatorElement==null) _OperatorElement = new List>(); return _OperatorElement; } + get => _OperatorElement ?? new List>(); set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private List> _OperatorElement; + private List>? _OperatorElement; /// /// Operators that can be used with filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Operator + public IEnumerable? Operator { - get { return OperatorElement != null ? OperatorElement.Select(elem => elem.Value) : null; } + get => _OperatorElement?.Select(elem => elem.Value); set { if (value == null) - OperatorElement = null; + OperatorElement = null!; else OperatorElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Operator"); @@ -292,46 +289,39 @@ public IEnumerable Operator [FhirElement("value", InSummary=true, Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// What to use for the value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FilterComponent; - - if (dest == null) - { + if(other is not FilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OperatorElement.Any()) dest.OperatorElement = new List>(OperatorElement.DeepCopyInternal()); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = new List>(_OperatorElement.DeepCopyInternal()); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -343,55 +333,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterComponent; - if(otherT == null) return false; + if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "operator": - value = OperatorElement; - return OperatorElement?.Any() == true; + value = _OperatorElement; + return _OperatorElement?.Any() == true; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "operator": - OperatorElement = (List>)value; + OperatorElement = (List>?)value!; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -402,10 +392,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OperatorElement?.Any() == true) yield return new KeyValuePair("operator",OperatorElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OperatorElement?.Any() == true) yield return new KeyValuePair("operator",_OperatorElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -432,28 +422,25 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies the property on the concepts, and when referred to in operations /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -463,28 +450,25 @@ public string Code /// [FhirElement("uri", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Formal identifier for the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -494,28 +478,25 @@ public string Uri /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why the property is defined, and/or what it conveys /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -528,13 +509,13 @@ public string Description [Binding("PropertyType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// code | Coding | string | integer | boolean | dateTime @@ -543,31 +524,24 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.CodeSystem.PropertyType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -579,55 +553,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -638,10 +612,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -669,28 +643,25 @@ public partial class ConceptDefinitionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies concept /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -700,28 +671,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Text to display to the user /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -731,28 +699,25 @@ public string Display /// [FhirElement("definition", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DefinitionElement + public Hl7.Fhir.Model.FhirString? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirString _DefinitionElement; + private Hl7.Fhir.Model.FhirString? _DefinitionElement; /// /// Formal definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirString(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Definition"); } } @@ -765,11 +730,11 @@ public string Definition [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; /// /// Property value for the concept. @@ -779,11 +744,11 @@ public List Designation [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Child Concepts (is-a/contains/categorizes). @@ -793,28 +758,24 @@ public List Property [DataMember] public List Concept { - get { if(_Concept==null) _Concept = new List(); return _Concept; } + get => _Concept ?? new List(); set { _Concept = value; OnPropertyChanged("Concept"); } } - private List _Concept; + private List? _Concept; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptDefinitionComponent; - - if (dest == null) - { + if(other is not ConceptDefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirString)DefinitionElement.DeepCopyInternal(); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Concept.Any()) dest.Concept = new List(Concept.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirString)_DefinitionElement.DeepCopyInternal(); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Concept is not null) dest.Concept = new List(_Concept.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -826,69 +787,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptDefinitionComponent; - if(otherT == null) return false; + if(other is not ConceptDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Concept, otherT.Concept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "concept": - value = Concept; - return Concept?.Any() == true; + value = _Concept; + return _Concept?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirString)value; + DefinitionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "concept": - Concept = (List)value; + Concept = (List?)value!; return this; default: return base.SetValue(key, value); @@ -899,12 +860,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Concept?.Any() == true) yield return new KeyValuePair("concept",Concept); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Concept?.Any() == true) yield return new KeyValuePair("concept",_Concept); } } @@ -931,28 +892,25 @@ public partial class DesignationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("language", Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Human language of the designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -963,13 +921,13 @@ public string Language [FhirElement("use", Order=50)] [Binding("ConceptDesignationUse")] [DataMember] - public Hl7.Fhir.Model.Coding Use + public Hl7.Fhir.Model.Coding? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.Coding _Use; + private Hl7.Fhir.Model.Coding? _Use; /// /// The text value for this designation. @@ -977,45 +935,38 @@ public Hl7.Fhir.Model.Coding Use [FhirElement("value", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The text value for this designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationComponent; - - if (dest == null) - { + if(other is not DesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.Coding)Use.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.Coding)_Use.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1027,48 +978,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationComponent; - if(otherT == null) return false; + if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - Use = (Hl7.Fhir.Model.Coding)value; + Use = (Hl7.Fhir.Model.Coding?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1079,9 +1030,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (Use is not null) yield return new KeyValuePair("use",Use); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_Use is not null) yield return new KeyValuePair("use",_Use); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -1108,28 +1059,25 @@ public partial class ConceptPropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Reference to CodeSystem.property.code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1142,26 +1090,22 @@ public string Code [AllowedTypes(typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptPropertyComponent; - - if (dest == null) - { + if(other is not ConceptPropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1173,41 +1117,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptPropertyComponent; - if(otherT == null) return false; + if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1218,8 +1162,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1229,28 +1173,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this code system (globally unique) (Coding.system) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1260,41 +1201,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the code system (Coding.version). /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the code system (Coding.version) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1304,28 +1242,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this code system (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1335,28 +1270,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this code system (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1369,13 +1301,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1384,13 +1316,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1400,13 +1329,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1415,13 +1344,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1431,28 +1357,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1462,28 +1385,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1496,39 +1416,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the code system. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1541,11 +1458,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for code system (if applicable). @@ -1556,39 +1473,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this code system is defined. /// [FhirElement("purpose", Order=220, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this code system is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1598,28 +1512,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1629,13 +1540,13 @@ public string Copyright /// [FhirElement("caseSensitive", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CaseSensitiveElement + public Hl7.Fhir.Model.FhirBoolean? CaseSensitiveElement { get { return _CaseSensitiveElement; } set { _CaseSensitiveElement = value; OnPropertyChanged("CaseSensitiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CaseSensitiveElement; + private Hl7.Fhir.Model.FhirBoolean? _CaseSensitiveElement; /// /// If code comparison is case sensitive @@ -1644,13 +1555,10 @@ public Hl7.Fhir.Model.FhirBoolean CaseSensitiveElement [IgnoreDataMember] public bool? CaseSensitive { - get { return CaseSensitiveElement != null ? CaseSensitiveElement.Value : null; } + get => _CaseSensitiveElement?.Value; set { - if (value == null) - CaseSensitiveElement = null; - else - CaseSensitiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + CaseSensitiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("CaseSensitive"); } } @@ -1660,28 +1568,25 @@ public bool? CaseSensitive /// [FhirElement("valueSet", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirUri ValueSetElement + public Hl7.Fhir.Model.FhirUri? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.FhirUri _ValueSetElement; + private Hl7.Fhir.Model.FhirUri? _ValueSetElement; /// /// Canonical URL for value set with entire code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.FhirUri(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("ValueSet"); } } @@ -1693,13 +1598,13 @@ public string ValueSet [DeclaredType(Type = typeof(Code))] [Binding("CodeSystemHierarchyMeaning")] [DataMember] - public Code HierarchyMeaningElement + public Code? HierarchyMeaningElement { get { return _HierarchyMeaningElement; } set { _HierarchyMeaningElement = value; OnPropertyChanged("HierarchyMeaningElement"); } } - private Code _HierarchyMeaningElement; + private Code? _HierarchyMeaningElement; /// /// grouped-by | is-a | part-of | classified-with @@ -1708,13 +1613,10 @@ public Code HierarchyMeani [IgnoreDataMember] public Hl7.Fhir.Model.CodeSystem.CodeSystemHierarchyMeaning? HierarchyMeaning { - get { return HierarchyMeaningElement != null ? HierarchyMeaningElement.Value : null; } + get => _HierarchyMeaningElement?.Value; set { - if (value == null) - HierarchyMeaningElement = null; - else - HierarchyMeaningElement = new Code(value); + HierarchyMeaningElement = value is null ? null : new Code(value); OnPropertyChanged("HierarchyMeaning"); } } @@ -1724,13 +1626,13 @@ public Hl7.Fhir.Model.CodeSystem.CodeSystemHierarchyMeaning? HierarchyMeaning /// [FhirElement("compositional", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CompositionalElement + public Hl7.Fhir.Model.FhirBoolean? CompositionalElement { get { return _CompositionalElement; } set { _CompositionalElement = value; OnPropertyChanged("CompositionalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CompositionalElement; + private Hl7.Fhir.Model.FhirBoolean? _CompositionalElement; /// /// If code system defines a post-composition grammar @@ -1739,13 +1641,10 @@ public Hl7.Fhir.Model.FhirBoolean CompositionalElement [IgnoreDataMember] public bool? Compositional { - get { return CompositionalElement != null ? CompositionalElement.Value : null; } + get => _CompositionalElement?.Value; set { - if (value == null) - CompositionalElement = null; - else - CompositionalElement = new Hl7.Fhir.Model.FhirBoolean(value); + CompositionalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Compositional"); } } @@ -1755,13 +1654,13 @@ public bool? Compositional /// [FhirElement("versionNeeded", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean VersionNeededElement + public Hl7.Fhir.Model.FhirBoolean? VersionNeededElement { get { return _VersionNeededElement; } set { _VersionNeededElement = value; OnPropertyChanged("VersionNeededElement"); } } - private Hl7.Fhir.Model.FhirBoolean _VersionNeededElement; + private Hl7.Fhir.Model.FhirBoolean? _VersionNeededElement; /// /// If definitions are not stable @@ -1770,13 +1669,10 @@ public Hl7.Fhir.Model.FhirBoolean VersionNeededElement [IgnoreDataMember] public bool? VersionNeeded { - get { return VersionNeededElement != null ? VersionNeededElement.Value : null; } + get => _VersionNeededElement?.Value; set { - if (value == null) - VersionNeededElement = null; - else - VersionNeededElement = new Hl7.Fhir.Model.FhirBoolean(value); + VersionNeededElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("VersionNeeded"); } } @@ -1789,13 +1685,13 @@ public bool? VersionNeeded [Binding("CodeSystemContentMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ContentElement + public Code? ContentElement { get { return _ContentElement; } set { _ContentElement = value; OnPropertyChanged("ContentElement"); } } - private Code _ContentElement; + private Code? _ContentElement; /// /// not-present | example | fragment | complete @@ -1804,13 +1700,10 @@ public Code ContentElement [IgnoreDataMember] public Hl7.Fhir.Model.CodeSystem.CodeSystemContentMode? Content { - get { return ContentElement != null ? ContentElement.Value : null; } + get => _ContentElement?.Value; set { - if (value == null) - ContentElement = null; - else - ContentElement = new Code(value); + ContentElement = value is null ? null : new Code(value); OnPropertyChanged("Content"); } } @@ -1820,13 +1713,13 @@ public Hl7.Fhir.Model.CodeSystem.CodeSystemContentMode? Content /// [FhirElement("count", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt CountElement + public Hl7.Fhir.Model.UnsignedInt? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.UnsignedInt _CountElement; + private Hl7.Fhir.Model.UnsignedInt? _CountElement; /// /// Total concepts in the code system @@ -1835,13 +1728,10 @@ public Hl7.Fhir.Model.UnsignedInt CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.UnsignedInt(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Count"); } } @@ -1854,11 +1744,11 @@ public int? Count [DataMember] public List Filter { - get { if(_Filter==null) _Filter = new List(); return _Filter; } + get => _Filter ?? new List(); set { _Filter = value; OnPropertyChanged("Filter"); } } - private List _Filter; + private List? _Filter; /// /// Additional information supplied about each concept. @@ -1868,11 +1758,11 @@ public List Filter [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Concepts in the code system. @@ -1882,49 +1772,45 @@ public List Property [DataMember] public List Concept { - get { if(_Concept==null) _Concept = new List(); return _Concept; } + get => _Concept ?? new List(); set { _Concept = value; OnPropertyChanged("Concept"); } } - private List _Concept; + private List? _Concept; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CodeSystem; - - if (dest == null) - { + if(other is not CodeSystem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CaseSensitiveElement != null) dest.CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean)CaseSensitiveElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.FhirUri)ValueSetElement.DeepCopyInternal(); - if(HierarchyMeaningElement != null) dest.HierarchyMeaningElement = (Code)HierarchyMeaningElement.DeepCopyInternal(); - if(CompositionalElement != null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)CompositionalElement.DeepCopyInternal(); - if(VersionNeededElement != null) dest.VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean)VersionNeededElement.DeepCopyInternal(); - if(ContentElement != null) dest.ContentElement = (Code)ContentElement.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.UnsignedInt)CountElement.DeepCopyInternal(); - if(Filter.Any()) dest.Filter = new List(Filter.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Concept.Any()) dest.Concept = new List(Concept.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CaseSensitiveElement is not null) dest.CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean)_CaseSensitiveElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.FhirUri)_ValueSetElement.DeepCopyInternal(); + if(_HierarchyMeaningElement is not null) dest.HierarchyMeaningElement = (Code)_HierarchyMeaningElement.DeepCopyInternal(); + if(_CompositionalElement is not null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)_CompositionalElement.DeepCopyInternal(); + if(_VersionNeededElement is not null) dest.VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean)_VersionNeededElement.DeepCopyInternal(); + if(_ContentElement is not null) dest.ContentElement = (Code)_ContentElement.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.UnsignedInt)_CountElement.DeepCopyInternal(); + if(_Filter is not null) dest.Filter = new List(_Filter.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Concept is not null) dest.Concept = new List(_Concept.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1936,202 +1822,202 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeSystem; - if(otherT == null) return false; + if(other is not CodeSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CaseSensitiveElement, otherT.CaseSensitiveElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.Equals(HierarchyMeaningElement, otherT.HierarchyMeaningElement)) return false; - if(!comparer.Equals(CompositionalElement, otherT.CompositionalElement)) return false; - if(!comparer.Equals(VersionNeededElement, otherT.VersionNeededElement)) return false; - if(!comparer.Equals(ContentElement, otherT.ContentElement)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.ListEquals(Filter, otherT.Filter)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Concept, otherT.Concept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CaseSensitiveElement, otherT._CaseSensitiveElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.Equals(_HierarchyMeaningElement, otherT._HierarchyMeaningElement)) return false; + if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; + if(!comparer.Equals(_VersionNeededElement, otherT._VersionNeededElement)) return false; + if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "caseSensitive": - value = CaseSensitiveElement; - return CaseSensitiveElement is not null; + value = _CaseSensitiveElement; + return _CaseSensitiveElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "hierarchyMeaning": - value = HierarchyMeaningElement; - return HierarchyMeaningElement is not null; + value = _HierarchyMeaningElement; + return _HierarchyMeaningElement is not null; case "compositional": - value = CompositionalElement; - return CompositionalElement is not null; + value = _CompositionalElement; + return _CompositionalElement is not null; case "versionNeeded": - value = VersionNeededElement; - return VersionNeededElement is not null; + value = _VersionNeededElement; + return _VersionNeededElement is not null; case "content": - value = ContentElement; - return ContentElement is not null; + value = _ContentElement; + return _ContentElement is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "filter": - value = Filter; - return Filter?.Any() == true; + value = _Filter; + return _Filter?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "concept": - value = Concept; - return Concept?.Any() == true; + value = _Concept; + return _Concept?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "caseSensitive": - CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + CaseSensitiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.FhirUri)value; + ValueSetElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "hierarchyMeaning": - HierarchyMeaningElement = (Code)value; + HierarchyMeaningElement = (Code?)value; return this; case "compositional": - CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)value; + CompositionalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "versionNeeded": - VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean)value; + VersionNeededElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "content": - ContentElement = (Code)value; + ContentElement = (Code?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.UnsignedInt)value; + CountElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "filter": - Filter = (List)value; + Filter = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "concept": - Concept = (List)value; + Concept = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2142,31 +2028,31 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CaseSensitiveElement is not null) yield return new KeyValuePair("caseSensitive",CaseSensitiveElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (HierarchyMeaningElement is not null) yield return new KeyValuePair("hierarchyMeaning",HierarchyMeaningElement); - if (CompositionalElement is not null) yield return new KeyValuePair("compositional",CompositionalElement); - if (VersionNeededElement is not null) yield return new KeyValuePair("versionNeeded",VersionNeededElement); - if (ContentElement is not null) yield return new KeyValuePair("content",ContentElement); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (Filter?.Any() == true) yield return new KeyValuePair("filter",Filter); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Concept?.Any() == true) yield return new KeyValuePair("concept",Concept); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CaseSensitiveElement is not null) yield return new KeyValuePair("caseSensitive",_CaseSensitiveElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_HierarchyMeaningElement is not null) yield return new KeyValuePair("hierarchyMeaning",_HierarchyMeaningElement); + if (_CompositionalElement is not null) yield return new KeyValuePair("compositional",_CompositionalElement); + if (_VersionNeededElement is not null) yield return new KeyValuePair("versionNeeded",_VersionNeededElement); + if (_ContentElement is not null) yield return new KeyValuePair("content",_ContentElement); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_Filter?.Any() == true) yield return new KeyValuePair("filter",_Filter); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Concept?.Any() == true) yield return new KeyValuePair("concept",_Concept); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs b/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs index 86ec6fa79..a430a205a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -165,11 +164,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -181,11 +180,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// Request fulfilled by this communication. @@ -197,11 +196,11 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of this action. @@ -213,11 +212,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | suspended | aborted | completed | entered-in-error. @@ -227,13 +226,13 @@ public List PartOf [Binding("CommunicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | suspended | aborted | completed | entered-in-error @@ -242,13 +241,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -258,13 +254,13 @@ public Hl7.Fhir.Model.EventStatus? Status /// [FhirElement("notDone", InSummary=true, IsModifier=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NotDoneElement + public Hl7.Fhir.Model.FhirBoolean? NotDoneElement { get { return _NotDoneElement; } set { _NotDoneElement = value; OnPropertyChanged("NotDoneElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NotDoneElement; + private Hl7.Fhir.Model.FhirBoolean? _NotDoneElement; /// /// Communication did not occur @@ -273,13 +269,10 @@ public Hl7.Fhir.Model.FhirBoolean NotDoneElement [IgnoreDataMember] public bool? NotDone { - get { return NotDoneElement != null ? NotDoneElement.Value : null; } + get => _NotDoneElement?.Value; set { - if (value == null) - NotDoneElement = null; - else - NotDoneElement = new Hl7.Fhir.Model.FhirBoolean(value); + NotDoneElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NotDone"); } } @@ -290,13 +283,13 @@ public bool? NotDone [FhirElement("notDoneReason", InSummary=true, Order=150)] [Binding("CommunicationNotDoneReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept NotDoneReason + public Hl7.Fhir.Model.CodeableConcept? NotDoneReason { get { return _NotDoneReason; } set { _NotDoneReason = value; OnPropertyChanged("NotDoneReason"); } } - private Hl7.Fhir.Model.CodeableConcept _NotDoneReason; + private Hl7.Fhir.Model.CodeableConcept? _NotDoneReason; /// /// Message category. @@ -307,11 +300,11 @@ public Hl7.Fhir.Model.CodeableConcept NotDoneReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// A channel of communication. @@ -322,11 +315,11 @@ public List Category [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -335,13 +328,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Message recipient. @@ -353,11 +346,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Focal resources. @@ -369,11 +362,11 @@ public List Recipient [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Encounter or episode leading to message. @@ -382,41 +375,38 @@ public List Topic [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When sent. /// [FhirElement("sent", Order=220, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime SentElement + public Hl7.Fhir.Model.FhirDateTime? SentElement { get { return _SentElement; } set { _SentElement = value; OnPropertyChanged("SentElement"); } } - private Hl7.Fhir.Model.FhirDateTime _SentElement; + private Hl7.Fhir.Model.FhirDateTime? _SentElement; /// /// When sent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sent + public string? Sent { - get { return SentElement != null ? SentElement.Value : null; } + get => _SentElement?.Value; set { - if (value == null) - SentElement = null; - else - SentElement = new Hl7.Fhir.Model.FhirDateTime(value); + SentElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Sent"); } } @@ -426,28 +416,25 @@ public string Sent /// [FhirElement("received", Order=230, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedElement { get { return _ReceivedElement; } set { _ReceivedElement = value; OnPropertyChanged("ReceivedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedElement; /// /// When received /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Received + public string? Received { - get { return ReceivedElement != null ? ReceivedElement.Value : null; } + get => _ReceivedElement?.Value; set { - if (value == null) - ReceivedElement = null; - else - ReceivedElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Received"); } } @@ -459,13 +446,13 @@ public string Received [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Indication for message. @@ -476,11 +463,11 @@ public Hl7.Fhir.Model.ResourceReference Sender [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was communication done?. @@ -492,11 +479,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Message payload. @@ -506,11 +493,11 @@ public List ReasonReference [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// Comments made about the communication. @@ -520,44 +507,40 @@ public List Payload [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Communication; - - if (dest == null) - { + if(other is not Communication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(NotDoneElement != null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)NotDoneElement.DeepCopyInternal(); - if(NotDoneReason != null) dest.NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)NotDoneReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SentElement != null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)SentElement.DeepCopyInternal(); - if(ReceivedElement != null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedElement.DeepCopyInternal(); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_NotDoneElement is not null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)_NotDoneElement.DeepCopyInternal(); + if(_NotDoneReason is not null) dest.NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)_NotDoneReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SentElement is not null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)_SentElement.DeepCopyInternal(); + if(_ReceivedElement is not null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedElement.DeepCopyInternal(); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -569,167 +552,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Communication; - if(otherT == null) return false; + if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(NotDoneElement, otherT.NotDoneElement)) return false; - if(!comparer.Equals(NotDoneReason, otherT.NotDoneReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(SentElement, otherT.SentElement)) return false; - if(!comparer.Equals(ReceivedElement, otherT.ReceivedElement)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_NotDoneElement, otherT._NotDoneElement)) return false; + if(!comparer.Equals(_NotDoneReason, otherT._NotDoneReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_SentElement, otherT._SentElement)) return false; + if(!comparer.Equals(_ReceivedElement, otherT._ReceivedElement)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "notDone": - value = NotDoneElement; - return NotDoneElement is not null; + value = _NotDoneElement; + return _NotDoneElement is not null; case "notDoneReason": - value = NotDoneReason; - return NotDoneReason is not null; + value = _NotDoneReason; + return _NotDoneReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "sent": - value = SentElement; - return SentElement is not null; + value = _SentElement; + return _SentElement is not null; case "received": - value = ReceivedElement; - return ReceivedElement is not null; + value = _ReceivedElement; + return _ReceivedElement is not null; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "notDone": - NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)value; + NotDoneElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "notDoneReason": - NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)value; + NotDoneReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sent": - SentElement = (Hl7.Fhir.Model.FhirDateTime)value; + SentElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "received": - ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -740,26 +723,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (NotDoneElement is not null) yield return new KeyValuePair("notDone",NotDoneElement); - if (NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",NotDoneReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SentElement is not null) yield return new KeyValuePair("sent",SentElement); - if (ReceivedElement is not null) yield return new KeyValuePair("received",ReceivedElement); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_NotDoneElement is not null) yield return new KeyValuePair("notDone",_NotDoneElement); + if (_NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",_NotDoneReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SentElement is not null) yield return new KeyValuePair("sent",_SentElement); + if (_ReceivedElement is not null) yield return new KeyValuePair("received",_ReceivedElement); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs index f65c31965..643f90c98 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -181,13 +180,13 @@ public partial class RequesterComponent : Hl7.Fhir.Model.BackboneElement [References("Practitioner","Organization","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Agent + public Hl7.Fhir.Model.ResourceReference? Agent { get { return _Agent; } set { _Agent = value; OnPropertyChanged("Agent"); } } - private Hl7.Fhir.Model.ResourceReference _Agent; + private Hl7.Fhir.Model.ResourceReference? _Agent; /// /// Organization agent is acting for. @@ -196,26 +195,22 @@ public Hl7.Fhir.Model.ResourceReference Agent [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as RequesterComponent; - - if (dest == null) - { + if(other is not RequesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Agent != null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)Agent.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)_Agent.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -227,41 +222,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequesterComponent; - if(otherT == null) return false; + if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "agent": - value = Agent; - return Agent is not null; + value = _Agent; + return _Agent is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "agent": - Agent = (Hl7.Fhir.Model.ResourceReference)value; + Agent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -272,8 +267,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Agent is not null) yield return new KeyValuePair("agent",Agent); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Agent is not null) yield return new KeyValuePair("agent",_Agent); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -286,11 +281,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan or proposal. @@ -302,11 +297,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -318,24 +313,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | suspended | cancelled | completed | entered-in-error | unknown. @@ -345,13 +340,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("CommunicationRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended | cancelled | completed | entered-in-error | unknown @@ -360,13 +355,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -380,11 +372,11 @@ public Hl7.Fhir.Model.RequestStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Message urgency. @@ -393,13 +385,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("CommunicationPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// Message urgency @@ -408,13 +400,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -428,11 +417,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -441,13 +430,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Message recipient. @@ -459,11 +448,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Focal resources. @@ -475,11 +464,11 @@ public List Recipient [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Encounter or episode leading to message. @@ -488,13 +477,13 @@ public List Topic [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Message payload. @@ -504,11 +493,11 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// When scheduled. @@ -517,41 +506,38 @@ public List Payload [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When request transitioned to being actionable. /// [FhirElement("authoredOn", InSummary=true, Order=230, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request transitioned to being actionable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -563,26 +549,26 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Who/what is requesting service. /// [FhirElement("requester", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.CommunicationRequest.RequesterComponent Requester + public Hl7.Fhir.Model.CommunicationRequest.RequesterComponent? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.CommunicationRequest.RequesterComponent _Requester; + private Hl7.Fhir.Model.CommunicationRequest.RequesterComponent? _Requester; /// /// Why is communication needed?. @@ -593,11 +579,11 @@ public Hl7.Fhir.Model.CommunicationRequest.RequesterComponent Requester [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why is communication needed?. @@ -609,11 +595,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Comments made about communication request. @@ -623,44 +609,40 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationRequest; - - if (dest == null) - { + if(other is not CommunicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.CommunicationRequest.RequesterComponent)Requester.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.CommunicationRequest.RequesterComponent)_Requester.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -672,167 +654,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationRequest; - if(otherT == null) return false; + if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.CommunicationRequest.RequesterComponent)value; + Requester = (Hl7.Fhir.Model.CommunicationRequest.RequesterComponent?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -843,26 +825,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs index 294af0a49..8501a9ebb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Name of resource type @@ -99,13 +102,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -118,24 +118,24 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get { if(_ParamElement==null) _ParamElement = new List(); return _ParamElement; } + get => _ParamElement ?? new List(); set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } - private List _ParamElement; + private List? _ParamElement; /// /// Search Parameter Name, or chained parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Param + public IEnumerable? Param { - get { return ParamElement != null ? ParamElement.Select(elem => elem.Value) : null; } + get => _ParamElement?.Select(elem => elem.Value); set { if (value == null) - ParamElement = null; + ParamElement = null!; else ParamElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Param"); @@ -147,45 +147,38 @@ public IEnumerable Param /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional documentation about the resource and compartment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ParamElement.Any()) dest.ParamElement = new List(ParamElement.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ParamElement is not null) dest.ParamElement = new List(_ParamElement.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -197,48 +190,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(ParamElement, otherT.ParamElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "param": - value = ParamElement; - return ParamElement?.Any() == true; + value = _ParamElement; + return _ParamElement?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "param": - ParamElement = (List)value; + ParamElement = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -249,9 +242,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ParamElement?.Any() == true) yield return new KeyValuePair("param",ParamElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ParamElement?.Any() == true) yield return new KeyValuePair("param",_ParamElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -262,28 +255,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this compartment definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -294,28 +284,25 @@ public string Url [FhirElement("name", InSummary=true, Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this compartment definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -325,28 +312,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this compartment definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -359,13 +343,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -374,13 +358,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -390,13 +371,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=130, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -405,13 +386,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -421,28 +399,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -452,28 +427,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -486,39 +458,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the compartment definition. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the compartment definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -528,28 +497,25 @@ public string Description /// [FhirElement("purpose", Order=180, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this compartment definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -562,11 +528,11 @@ public string Purpose [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for compartment definition (if applicable). @@ -577,11 +543,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device. @@ -591,13 +557,13 @@ public List Jurisdiction [Binding("CompartmentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device @@ -606,13 +572,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -623,13 +586,13 @@ public Hl7.Fhir.Model.CompartmentType? Code [FhirElement("search", InSummary=true, Order=220)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SearchElement + public Hl7.Fhir.Model.FhirBoolean? SearchElement { get { return _SearchElement; } set { _SearchElement = value; OnPropertyChanged("SearchElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SearchElement; + private Hl7.Fhir.Model.FhirBoolean? _SearchElement; /// /// Whether the search syntax is supported @@ -638,13 +601,10 @@ public Hl7.Fhir.Model.FhirBoolean SearchElement [IgnoreDataMember] public bool? Search { - get { return SearchElement != null ? SearchElement.Value : null; } + get => _SearchElement?.Value; set { - if (value == null) - SearchElement = null; - else - SearchElement = new Hl7.Fhir.Model.FhirBoolean(value); + SearchElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Search"); } } @@ -657,37 +617,33 @@ public bool? Search [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentDefinition; - - if (dest == null) - { + if(other is not CompartmentDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(SearchElement != null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)SearchElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_SearchElement is not null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)_SearchElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -699,132 +655,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentDefinition; - if(otherT == null) return false; + if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(SearchElement, otherT.SearchElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "search": - value = SearchElement; - return SearchElement is not null; + value = _SearchElement; + return _SearchElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "search": - SearchElement = (Hl7.Fhir.Model.FhirBoolean)value; + SearchElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -835,21 +791,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (SearchElement is not null) yield return new KeyValuePair("search",SearchElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_SearchElement is not null) yield return new KeyValuePair("search",_SearchElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs index 5a774848d..85ccc4567 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -184,24 +187,24 @@ public partial class AttesterComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> ModeElement { - get { if(_ModeElement==null) _ModeElement = new List>(); return _ModeElement; } + get => _ModeElement ?? new List>(); set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private List> _ModeElement; + private List>? _ModeElement; /// /// personal | professional | legal | official /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Mode + public IEnumerable? Mode { - get { return ModeElement != null ? ModeElement.Select(elem => elem.Value) : null; } + get => _ModeElement?.Select(elem => elem.Value); set { if (value == null) - ModeElement = null; + ModeElement = null!; else ModeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Mode"); @@ -213,28 +216,25 @@ public IEnumerable Mode /// [FhirElement("time", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the composition was attested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -246,27 +246,23 @@ public string Time [CLSCompliant(false)] [References("Patient","Practitioner","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as AttesterComponent; - - if (dest == null) - { + if(other is not AttesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement.Any()) dest.ModeElement = new List>(ModeElement.DeepCopyInternal()); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = new List>(_ModeElement.DeepCopyInternal()); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -278,48 +274,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttesterComponent; - if(otherT == null) return false; + if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement?.Any() == true; + value = _ModeElement; + return _ModeElement?.Any() == true; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (List>)value; + ModeElement = (List>?)value!; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -330,9 +326,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement?.Any() == true) yield return new KeyValuePair("mode",ModeElement); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_ModeElement?.Any() == true) yield return new KeyValuePair("mode",_ModeElement); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -362,13 +358,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | transforms | signs | appends @@ -377,13 +373,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -397,26 +390,22 @@ public Hl7.Fhir.Model.DocumentRelationshipType? Code [AllowedTypes(typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -428,41 +417,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -473,8 +462,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -505,24 +494,24 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// The period covered by the documentation. /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The event(s) being documented. @@ -534,25 +523,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -564,48 +549,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -616,9 +601,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -644,28 +629,25 @@ public partial class SectionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for section (e.g. for ToC) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -676,26 +658,26 @@ public string Title [FhirElement("code", Order=50)] [Binding("CompositionSectionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Text summary of the section, for human interpretation. /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.Narrative Text + public Hl7.Fhir.Model.Narrative? Text { get { return _Text; } set { _Text = value; OnPropertyChanged("Text"); } } - private Hl7.Fhir.Model.Narrative _Text; + private Hl7.Fhir.Model.Narrative? _Text; /// /// working | snapshot | changes. @@ -704,13 +686,13 @@ public Hl7.Fhir.Model.Narrative Text [DeclaredType(Type = typeof(Code))] [Binding("SectionMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -719,13 +701,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -736,13 +715,13 @@ public Hl7.Fhir.Model.ListMode? Mode [FhirElement("orderedBy", Order=80)] [Binding("SectionEntryOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// A reference to data that supports this section. @@ -754,11 +733,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why the section is empty. @@ -766,13 +745,13 @@ public List Entry [FhirElement("emptyReason", Order=100)] [Binding("SectionEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; /// /// Nested Section. @@ -782,30 +761,26 @@ public Hl7.Fhir.Model.CodeableConcept EmptyReason [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; protected internal override void CopyToInternal(Base other) { - var dest = other as SectionComponent; - - if (dest == null) - { + if(other is not SectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -817,83 +792,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SectionComponent; - if(otherT == null) return false; + if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Text, otherT.Text)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Text, otherT._Text)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "text": - value = Text; - return Text is not null; + value = _Text; + return _Text is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - Text = (Hl7.Fhir.Model.Narrative)value; + Text = (Hl7.Fhir.Model.Narrative?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -904,14 +879,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Text is not null) yield return new KeyValuePair("text",Text); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Text is not null) yield return new KeyValuePair("text",_Text); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } @@ -921,13 +896,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// preliminary | final | amended | entered-in-error. @@ -937,13 +912,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("CompositionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preliminary | final | amended | entered-in-error @@ -952,13 +927,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -970,13 +942,13 @@ public Hl7.Fhir.Model.CompositionStatus? Status [Binding("DocumentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of Composition. @@ -984,13 +956,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("class", InSummary=true, Order=120, FiveWs="class")] [Binding("DocumentClass")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Class + public Hl7.Fhir.Model.CodeableConcept? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.CodeableConcept _Class; + private Hl7.Fhir.Model.CodeableConcept? _Class; /// /// Who and/or what the composition is about. @@ -1000,13 +972,13 @@ public Hl7.Fhir.Model.CodeableConcept Class [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Context of the Composition. @@ -1015,13 +987,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Composition editing time. @@ -1029,28 +1001,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("date", InSummary=true, Order=150, FiveWs="when.done")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Composition editing time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1065,11 +1034,11 @@ public string Date [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Human Readable name/title. @@ -1077,28 +1046,25 @@ public List Author [FhirElement("title", InSummary=true, Order=170)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human Readable name/title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1110,13 +1076,13 @@ public string Title [DeclaredType(Type = typeof(Code))] [Binding("DocumentConfidentiality")] [DataMember] - public Code ConfidentialityElement + public Code? ConfidentialityElement { get { return _ConfidentialityElement; } set { _ConfidentialityElement = value; OnPropertyChanged("ConfidentialityElement"); } } - private Code _ConfidentialityElement; + private Code? _ConfidentialityElement; /// /// As defined by affinity domain @@ -1125,13 +1091,10 @@ public Code Confidenti [IgnoreDataMember] public Hl7.Fhir.Model.Composition.ConfidentialityClassification? Confidentiality { - get { return ConfidentialityElement != null ? ConfidentialityElement.Value : null; } + get => _ConfidentialityElement?.Value; set { - if (value == null) - ConfidentialityElement = null; - else - ConfidentialityElement = new Code(value); + ConfidentialityElement = value is null ? null : new Code(value); OnPropertyChanged("Confidentiality"); } } @@ -1144,11 +1107,11 @@ public Hl7.Fhir.Model.Composition.ConfidentialityClassification? Confidentiality [DataMember] public List Attester { - get { if(_Attester==null) _Attester = new List(); return _Attester; } + get => _Attester ?? new List(); set { _Attester = value; OnPropertyChanged("Attester"); } } - private List _Attester; + private List? _Attester; /// /// Organization which maintains the composition. @@ -1157,13 +1120,13 @@ public List Attester [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other compositions/documents. @@ -1173,11 +1136,11 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// The clinical service(s) being documented. @@ -1187,11 +1150,11 @@ public List RelatesTo [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Composition is broken into sections. @@ -1201,39 +1164,35 @@ public List Event [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Composition; - - if (dest == null) - { + if(other is not Composition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Class != null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ConfidentialityElement != null) dest.ConfidentialityElement = (Code)ConfidentialityElement.DeepCopyInternal(); - if(Attester.Any()) dest.Attester = new List(Attester.DeepCopyInternal()); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)_Class.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ConfidentialityElement is not null) dest.ConfidentialityElement = (Code)_ConfidentialityElement.DeepCopyInternal(); + if(_Attester is not null) dest.Attester = new List(_Attester.DeepCopyInternal()); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1245,132 +1204,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Composition; - if(otherT == null) return false; + if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ConfidentialityElement, otherT.ConfidentialityElement)) return false; - if(!comparer.ListEquals(Attester, otherT.Attester)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ConfidentialityElement, otherT._ConfidentialityElement)) return false; + if(!comparer.ListEquals(_Attester, otherT._Attester)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "confidentiality": - value = ConfidentialityElement; - return ConfidentialityElement is not null; + value = _ConfidentialityElement; + return _ConfidentialityElement is not null; case "attester": - value = Attester; - return Attester?.Any() == true; + value = _Attester; + return _Attester?.Any() == true; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "class": - Class = (Hl7.Fhir.Model.CodeableConcept)value; + Class = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "confidentiality": - ConfidentialityElement = (Code)value; + ConfidentialityElement = (Code?)value; return this; case "attester": - Attester = (List)value; + Attester = (List?)value!; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1381,21 +1340,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ConfidentialityElement is not null) yield return new KeyValuePair("confidentiality",ConfidentialityElement); - if (Attester?.Any() == true) yield return new KeyValuePair("attester",Attester); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ConfidentialityElement is not null) yield return new KeyValuePair("confidentiality",_ConfidentialityElement); + if (_Attester?.Any() == true) yield return new KeyValuePair("attester",_Attester); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs index 8d9dc3861..567c2452d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -178,28 +181,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("source", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// Code System (if value set crosses code systems) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -209,28 +209,25 @@ public string Source /// [FhirElement("sourceVersion", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceVersionElement + public Hl7.Fhir.Model.FhirString? SourceVersionElement { get { return _SourceVersionElement; } set { _SourceVersionElement = value; OnPropertyChanged("SourceVersionElement"); } } - private Hl7.Fhir.Model.FhirString _SourceVersionElement; + private Hl7.Fhir.Model.FhirString? _SourceVersionElement; /// /// Specific version of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceVersion + public string? SourceVersion { - get { return SourceVersionElement != null ? SourceVersionElement.Value : null; } + get => _SourceVersionElement?.Value; set { - if (value == null) - SourceVersionElement = null; - else - SourceVersionElement = new Hl7.Fhir.Model.FhirString(value); + SourceVersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceVersion"); } } @@ -240,28 +237,25 @@ public string SourceVersion /// [FhirElement("target", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri TargetElement + public Hl7.Fhir.Model.FhirUri? TargetElement { get { return _TargetElement; } set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private Hl7.Fhir.Model.FhirUri _TargetElement; + private Hl7.Fhir.Model.FhirUri? _TargetElement; /// /// System of the target (if necessary) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Target + public string? Target { - get { return TargetElement != null ? TargetElement.Value : null; } + get => _TargetElement?.Value; set { - if (value == null) - TargetElement = null; - else - TargetElement = new Hl7.Fhir.Model.FhirUri(value); + TargetElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Target"); } } @@ -271,28 +265,25 @@ public string Target /// [FhirElement("targetVersion", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TargetVersionElement + public Hl7.Fhir.Model.FhirString? TargetVersionElement { get { return _TargetVersionElement; } set { _TargetVersionElement = value; OnPropertyChanged("TargetVersionElement"); } } - private Hl7.Fhir.Model.FhirString _TargetVersionElement; + private Hl7.Fhir.Model.FhirString? _TargetVersionElement; /// /// Specific version of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetVersion + public string? TargetVersion { - get { return TargetVersionElement != null ? TargetVersionElement.Value : null; } + get => _TargetVersionElement?.Value; set { - if (value == null) - TargetVersionElement = null; - else - TargetVersionElement = new Hl7.Fhir.Model.FhirString(value); + TargetVersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TargetVersion"); } } @@ -305,41 +296,37 @@ public string TargetVersion [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; /// /// When no match in the mappings. /// [FhirElement("unmapped", Order=90)] [DataMember] - public Hl7.Fhir.Model.ConceptMap.UnmappedComponent Unmapped + public Hl7.Fhir.Model.ConceptMap.UnmappedComponent? Unmapped { get { return _Unmapped; } set { _Unmapped = value; OnPropertyChanged("Unmapped"); } } - private Hl7.Fhir.Model.ConceptMap.UnmappedComponent _Unmapped; + private Hl7.Fhir.Model.ConceptMap.UnmappedComponent? _Unmapped; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(SourceVersionElement != null) dest.SourceVersionElement = (Hl7.Fhir.Model.FhirString)SourceVersionElement.DeepCopyInternal(); - if(TargetElement != null) dest.TargetElement = (Hl7.Fhir.Model.FhirUri)TargetElement.DeepCopyInternal(); - if(TargetVersionElement != null) dest.TargetVersionElement = (Hl7.Fhir.Model.FhirString)TargetVersionElement.DeepCopyInternal(); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); - if(Unmapped != null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)Unmapped.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_SourceVersionElement is not null) dest.SourceVersionElement = (Hl7.Fhir.Model.FhirString)_SourceVersionElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = (Hl7.Fhir.Model.FhirUri)_TargetElement.DeepCopyInternal(); + if(_TargetVersionElement is not null) dest.TargetVersionElement = (Hl7.Fhir.Model.FhirString)_TargetVersionElement.DeepCopyInternal(); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); + if(_Unmapped is not null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)_Unmapped.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -351,69 +338,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(SourceVersionElement, otherT.SourceVersionElement)) return false; - if(!comparer.Equals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.Equals(TargetVersionElement, otherT.TargetVersionElement)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; - if(!comparer.Equals(Unmapped, otherT.Unmapped)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_SourceVersionElement, otherT._SourceVersionElement)) return false; + if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.Equals(_TargetVersionElement, otherT._TargetVersionElement)) return false; + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "sourceVersion": - value = SourceVersionElement; - return SourceVersionElement is not null; + value = _SourceVersionElement; + return _SourceVersionElement is not null; case "target": - value = TargetElement; - return TargetElement is not null; + value = _TargetElement; + return _TargetElement is not null; case "targetVersion": - value = TargetVersionElement; - return TargetVersionElement is not null; + value = _TargetVersionElement; + return _TargetVersionElement is not null; case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; case "unmapped": - value = Unmapped; - return Unmapped is not null; + value = _Unmapped; + return _Unmapped is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "sourceVersion": - SourceVersionElement = (Hl7.Fhir.Model.FhirString)value; + SourceVersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - TargetElement = (Hl7.Fhir.Model.FhirUri)value; + TargetElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "targetVersion": - TargetVersionElement = (Hl7.Fhir.Model.FhirString)value; + TargetVersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "element": - Element = (List)value; + Element = (List?)value!; return this; case "unmapped": - Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)value; + Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent?)value; return this; default: return base.SetValue(key, value); @@ -424,12 +411,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (SourceVersionElement is not null) yield return new KeyValuePair("sourceVersion",SourceVersionElement); - if (TargetElement is not null) yield return new KeyValuePair("target",TargetElement); - if (TargetVersionElement is not null) yield return new KeyValuePair("targetVersion",TargetVersionElement); - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); - if (Unmapped is not null) yield return new KeyValuePair("unmapped",Unmapped); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_SourceVersionElement is not null) yield return new KeyValuePair("sourceVersion",_SourceVersionElement); + if (_TargetElement is not null) yield return new KeyValuePair("target",_TargetElement); + if (_TargetVersionElement is not null) yield return new KeyValuePair("targetVersion",_TargetVersionElement); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); + if (_Unmapped is not null) yield return new KeyValuePair("unmapped",_Unmapped); } } @@ -456,28 +443,25 @@ public partial class SourceElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies element being mapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -487,28 +471,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -521,25 +502,21 @@ public string Display [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceElementComponent; - - if (dest == null) - { + if(other is not SourceElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -551,48 +528,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceElementComponent; - if(otherT == null) return false; + if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -603,9 +580,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -632,28 +609,25 @@ public partial class TargetElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies the target element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -663,28 +637,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -696,13 +667,13 @@ public string Display [DeclaredType(Type = typeof(Code))] [Binding("ConceptMapEquivalence")] [DataMember] - public Code EquivalenceElement + public Code? EquivalenceElement { get { return _EquivalenceElement; } set { _EquivalenceElement = value; OnPropertyChanged("EquivalenceElement"); } } - private Code _EquivalenceElement; + private Code? _EquivalenceElement; /// /// relatedto | equivalent | equal | wider | subsumes | narrower | specializes | inexact | unmatched | disjoint @@ -711,13 +682,10 @@ public Code EquivalenceElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapEquivalence? Equivalence { - get { return EquivalenceElement != null ? EquivalenceElement.Value : null; } + get => _EquivalenceElement?.Value; set { - if (value == null) - EquivalenceElement = null; - else - EquivalenceElement = new Code(value); + EquivalenceElement = value is null ? null : new Code(value); OnPropertyChanged("Equivalence"); } } @@ -727,28 +695,25 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapEquivalence? Equivalence /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Description of status/issues in mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -761,11 +726,11 @@ public string Comment [DataMember] public List DependsOn { - get { if(_DependsOn==null) _DependsOn = new List(); return _DependsOn; } + get => _DependsOn ?? new List(); set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } - private List _DependsOn; + private List? _DependsOn; /// /// Other concepts that this mapping also produces. @@ -775,28 +740,24 @@ public List DependsOn [DataMember] public List Product { - get { if(_Product==null) _Product = new List(); return _Product; } + get => _Product ?? new List(); set { _Product = value; OnPropertyChanged("Product"); } } - private List _Product; + private List? _Product; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetElementComponent; - - if (dest == null) - { + if(other is not TargetElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(EquivalenceElement != null) dest.EquivalenceElement = (Code)EquivalenceElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(DependsOn.Any()) dest.DependsOn = new List(DependsOn.DeepCopyInternal()); - if(Product.Any()) dest.Product = new List(Product.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_EquivalenceElement is not null) dest.EquivalenceElement = (Code)_EquivalenceElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_DependsOn is not null) dest.DependsOn = new List(_DependsOn.DeepCopyInternal()); + if(_Product is not null) dest.Product = new List(_Product.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -808,69 +769,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetElementComponent; - if(otherT == null) return false; + if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(EquivalenceElement, otherT.EquivalenceElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(DependsOn, otherT.DependsOn)) return false; - if(!comparer.ListEquals(Product, otherT.Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_EquivalenceElement, otherT._EquivalenceElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; + if(!comparer.ListEquals(_Product, otherT._Product)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "equivalence": - value = EquivalenceElement; - return EquivalenceElement is not null; + value = _EquivalenceElement; + return _EquivalenceElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "dependsOn": - value = DependsOn; - return DependsOn?.Any() == true; + value = _DependsOn; + return _DependsOn?.Any() == true; case "product": - value = Product; - return Product?.Any() == true; + value = _Product; + return _Product?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "equivalence": - EquivalenceElement = (Code)value; + EquivalenceElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "dependsOn": - DependsOn = (List)value; + DependsOn = (List?)value!; return this; case "product": - Product = (List)value; + Product = (List?)value!; return this; default: return base.SetValue(key, value); @@ -881,12 +842,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (EquivalenceElement is not null) yield return new KeyValuePair("equivalence",EquivalenceElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",DependsOn); - if (Product?.Any() == true) yield return new KeyValuePair("product",Product); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_EquivalenceElement is not null) yield return new KeyValuePair("equivalence",_EquivalenceElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",_DependsOn); + if (_Product?.Any() == true) yield return new KeyValuePair("product",_Product); } } @@ -913,28 +874,25 @@ public partial class OtherElementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("property", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri PropertyElement + public Hl7.Fhir.Model.FhirUri? PropertyElement { get { return _PropertyElement; } set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private Hl7.Fhir.Model.FhirUri _PropertyElement; + private Hl7.Fhir.Model.FhirUri? _PropertyElement; /// /// Reference to property mapping depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Property + public string? Property { - get { return PropertyElement != null ? PropertyElement.Value : null; } + get => _PropertyElement?.Value; set { - if (value == null) - PropertyElement = null; - else - PropertyElement = new Hl7.Fhir.Model.FhirUri(value); + PropertyElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Property"); } } @@ -944,28 +902,25 @@ public string Property /// [FhirElement("system", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// Code System (if necessary) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -976,28 +931,25 @@ public string System [FhirElement("code", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString CodeElement + public Hl7.Fhir.Model.FhirString? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.FhirString _CodeElement; + private Hl7.Fhir.Model.FhirString? _CodeElement; /// /// Value of the referenced element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.FhirString(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Code"); } } @@ -1007,46 +959,39 @@ public string Code /// [FhirElement("display", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OtherElementComponent; - - if (dest == null) - { + if(other is not OtherElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PropertyElement != null) dest.PropertyElement = (Hl7.Fhir.Model.FhirUri)PropertyElement.DeepCopyInternal(); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_PropertyElement is not null) dest.PropertyElement = (Hl7.Fhir.Model.FhirUri)_PropertyElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1058,55 +1003,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherElementComponent; - if(otherT == null) return false; + if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PropertyElement, otherT.PropertyElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "property": - value = PropertyElement; - return PropertyElement is not null; + value = _PropertyElement; + return _PropertyElement is not null; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "property": - PropertyElement = (Hl7.Fhir.Model.FhirUri)value; + PropertyElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.FhirString)value; + CodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1117,10 +1062,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PropertyElement is not null) yield return new KeyValuePair("property",PropertyElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_PropertyElement is not null) yield return new KeyValuePair("property",_PropertyElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -1150,13 +1095,13 @@ public partial class UnmappedComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConceptMapGroupUnmappedMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// provided | fixed | other-map @@ -1165,13 +1110,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -1181,28 +1123,25 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Fixed code when mode = fixed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1212,28 +1151,25 @@ public string Code /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -1243,46 +1179,39 @@ public string Display /// [FhirElement("url", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical URL for other concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UnmappedComponent; - - if (dest == null) - { + if(other is not UnmappedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1294,55 +1223,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UnmappedComponent; - if(otherT == null) return false; + if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -1353,10 +1282,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -1366,28 +1295,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this concept map (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1397,41 +1323,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the concept map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1441,28 +1364,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this concept map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1472,28 +1392,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this concept map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1506,13 +1423,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1521,13 +1438,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1537,13 +1451,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1552,13 +1466,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1568,28 +1479,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1599,28 +1507,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1633,39 +1538,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the concept map. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1678,11 +1580,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for concept map (if applicable). @@ -1693,39 +1595,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this concept map is defined. /// [FhirElement("purpose", Order=220, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this concept map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1735,28 +1634,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1769,13 +1665,13 @@ public string Copyright [References("ValueSet")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// Provides context to the mappings. @@ -1785,13 +1681,13 @@ public Hl7.Fhir.Model.DataType Source [References("ValueSet")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; /// /// Same source and target systems. @@ -1801,42 +1697,38 @@ public Hl7.Fhir.Model.DataType Target [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptMap; - - if (dest == null) - { + if(other is not ConceptMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1848,153 +1740,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptMap; - if(otherT == null) return false; + if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2005,24 +1897,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs index 0841e19d6..3c1b78288 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -167,13 +170,13 @@ public partial class StageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("summary", Order=40)] [Binding("ConditionStage")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Summary + public Hl7.Fhir.Model.CodeableConcept? Summary { get { return _Summary; } set { _Summary = value; OnPropertyChanged("Summary"); } } - private Hl7.Fhir.Model.CodeableConcept _Summary; + private Hl7.Fhir.Model.CodeableConcept? _Summary; /// /// Formal record of assessment. @@ -185,24 +188,20 @@ public Hl7.Fhir.Model.CodeableConcept Summary [DataMember] public List Assessment { - get { if(_Assessment==null) _Assessment = new List(); return _Assessment; } + get => _Assessment ?? new List(); set { _Assessment = value; OnPropertyChanged("Assessment"); } } - private List _Assessment; + private List? _Assessment; protected internal override void CopyToInternal(Base other) { - var dest = other as StageComponent; - - if (dest == null) - { + if(other is not StageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Summary != null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)Summary.DeepCopyInternal(); - if(Assessment.Any()) dest.Assessment = new List(Assessment.DeepCopyInternal()); + if(_Summary is not null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)_Summary.DeepCopyInternal(); + if(_Assessment is not null) dest.Assessment = new List(_Assessment.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -214,41 +213,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StageComponent; - if(otherT == null) return false; + if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Summary, otherT.Summary)) return false; - if(!comparer.ListEquals(Assessment, otherT.Assessment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "summary": - value = Summary; - return Summary is not null; + value = _Summary; + return _Summary is not null; case "assessment": - value = Assessment; - return Assessment?.Any() == true; + value = _Assessment; + return _Assessment?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "summary": - Summary = (Hl7.Fhir.Model.CodeableConcept)value; + Summary = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "assessment": - Assessment = (List)value; + Assessment = (List?)value!; return this; default: return base.SetValue(key, value); @@ -259,8 +258,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Summary is not null) yield return new KeyValuePair("summary",Summary); - if (Assessment?.Any() == true) yield return new KeyValuePair("assessment",Assessment); + if (_Summary is not null) yield return new KeyValuePair("summary",_Summary); + if (_Assessment?.Any() == true) yield return new KeyValuePair("assessment",_Assessment); } } @@ -291,11 +290,11 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting information found elsewhere. @@ -307,24 +306,20 @@ public List Code [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceComponent; - - if (dest == null) - { + if(other is not EvidenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -336,41 +331,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceComponent; - if(otherT == null) return false; + if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -381,8 +376,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -395,11 +390,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | recurrence | inactive | remission | resolved. @@ -408,13 +403,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("ConditionClinicalStatus")] [DataMember] - public Code ClinicalStatusElement + public Code? ClinicalStatusElement { get { return _ClinicalStatusElement; } set { _ClinicalStatusElement = value; OnPropertyChanged("ClinicalStatusElement"); } } - private Code _ClinicalStatusElement; + private Code? _ClinicalStatusElement; /// /// active | recurrence | inactive | remission | resolved @@ -423,13 +418,10 @@ public Code ClinicalStatu [IgnoreDataMember] public Hl7.Fhir.Model.Condition.ConditionClinicalStatusCodes? ClinicalStatus { - get { return ClinicalStatusElement != null ? ClinicalStatusElement.Value : null; } + get => _ClinicalStatusElement?.Value; set { - if (value == null) - ClinicalStatusElement = null; - else - ClinicalStatusElement = new Code(value); + ClinicalStatusElement = value is null ? null : new Code(value); OnPropertyChanged("ClinicalStatus"); } } @@ -441,13 +433,13 @@ public Hl7.Fhir.Model.Condition.ConditionClinicalStatusCodes? ClinicalStatus [DeclaredType(Type = typeof(Code))] [Binding("ConditionVerificationStatus")] [DataMember] - public Code VerificationStatusElement + public Code? VerificationStatusElement { get { return _VerificationStatusElement; } set { _VerificationStatusElement = value; OnPropertyChanged("VerificationStatusElement"); } } - private Code _VerificationStatusElement; + private Code? _VerificationStatusElement; /// /// provisional | differential | confirmed | refuted | entered-in-error | unknown @@ -456,13 +448,10 @@ public Code VerificationSt [IgnoreDataMember] public Hl7.Fhir.Model.Condition.ConditionVerificationStatus? VerificationStatus { - get { return VerificationStatusElement != null ? VerificationStatusElement.Value : null; } + get => _VerificationStatusElement?.Value; set { - if (value == null) - VerificationStatusElement = null; - else - VerificationStatusElement = new Code(value); + VerificationStatusElement = value is null ? null : new Code(value); OnPropertyChanged("VerificationStatus"); } } @@ -476,11 +465,11 @@ public Hl7.Fhir.Model.Condition.ConditionVerificationStatus? VerificationStatus [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Subjective severity of condition. @@ -488,13 +477,13 @@ public List Category [FhirElement("severity", Order=130, FiveWs="grade")] [Binding("ConditionSeverity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Severity + public Hl7.Fhir.Model.CodeableConcept? Severity { get { return _Severity; } set { _Severity = value; OnPropertyChanged("Severity"); } } - private Hl7.Fhir.Model.CodeableConcept _Severity; + private Hl7.Fhir.Model.CodeableConcept? _Severity; /// /// Identification of the condition, problem or diagnosis. @@ -502,13 +491,13 @@ public Hl7.Fhir.Model.CodeableConcept Severity [FhirElement("code", InSummary=true, Order=140, FiveWs="what")] [Binding("ConditionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Anatomical location, if relevant. @@ -519,11 +508,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Who has the condition?. @@ -533,13 +522,13 @@ public List BodySite [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or episode when condition first asserted. @@ -548,13 +537,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Estimated or actual date, date-time, or age. @@ -563,13 +552,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// If/when in resolution/remission. @@ -578,41 +567,38 @@ public Hl7.Fhir.Model.DataType Onset [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Abatement + public Hl7.Fhir.Model.DataType? Abatement { get { return _Abatement; } set { _Abatement = value; OnPropertyChanged("Abatement"); } } - private Hl7.Fhir.Model.DataType _Abatement; + private Hl7.Fhir.Model.DataType? _Abatement; /// /// Date record was believed accurate. /// [FhirElement("assertedDate", InSummary=true, Order=200, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AssertedDateElement + public Hl7.Fhir.Model.FhirDateTime? AssertedDateElement { get { return _AssertedDateElement; } set { _AssertedDateElement = value; OnPropertyChanged("AssertedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AssertedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _AssertedDateElement; /// /// Date record was believed accurate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AssertedDate + public string? AssertedDate { - get { return AssertedDateElement != null ? AssertedDateElement.Value : null; } + get => _AssertedDateElement?.Value; set { - if (value == null) - AssertedDateElement = null; - else - AssertedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + AssertedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AssertedDate"); } } @@ -624,26 +610,26 @@ public string AssertedDate [CLSCompliant(false)] [References("Practitioner","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// Stage/grade, usually assessed formally. /// [FhirElement("stage", Order=220)] [DataMember] - public Hl7.Fhir.Model.Condition.StageComponent Stage + public Hl7.Fhir.Model.Condition.StageComponent? Stage { get { return _Stage; } set { _Stage = value; OnPropertyChanged("Stage"); } } - private Hl7.Fhir.Model.Condition.StageComponent _Stage; + private Hl7.Fhir.Model.Condition.StageComponent? _Stage; /// /// Supporting evidence. @@ -653,11 +639,11 @@ public Hl7.Fhir.Model.Condition.StageComponent Stage [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; /// /// Additional information about the Condition. @@ -667,40 +653,36 @@ public List Evidence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Condition; - - if (dest == null) - { + if(other is not Condition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatusElement != null) dest.ClinicalStatusElement = (Code)ClinicalStatusElement.DeepCopyInternal(); - if(VerificationStatusElement != null) dest.VerificationStatusElement = (Code)VerificationStatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Severity != null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)Severity.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Abatement != null) dest.Abatement = (Hl7.Fhir.Model.DataType)Abatement.DeepCopyInternal(); - if(AssertedDateElement != null) dest.AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime)AssertedDateElement.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(Stage != null) dest.Stage = (Hl7.Fhir.Model.Condition.StageComponent)Stage.DeepCopyInternal(); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatusElement is not null) dest.ClinicalStatusElement = (Code)_ClinicalStatusElement.DeepCopyInternal(); + if(_VerificationStatusElement is not null) dest.VerificationStatusElement = (Code)_VerificationStatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Severity is not null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)_Severity.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Abatement is not null) dest.Abatement = (Hl7.Fhir.Model.DataType)_Abatement.DeepCopyInternal(); + if(_AssertedDateElement is not null) dest.AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime)_AssertedDateElement.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_Stage is not null) dest.Stage = (Hl7.Fhir.Model.Condition.StageComponent)_Stage.DeepCopyInternal(); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -712,139 +694,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Condition; - if(otherT == null) return false; + if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatusElement, otherT.ClinicalStatusElement)) return false; - if(!comparer.Equals(VerificationStatusElement, otherT.VerificationStatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Severity, otherT.Severity)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(Abatement, otherT.Abatement)) return false; - if(!comparer.Equals(AssertedDateElement, otherT.AssertedDateElement)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.Equals(Stage, otherT.Stage)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatusElement, otherT._ClinicalStatusElement)) return false; + if(!comparer.Equals(_VerificationStatusElement, otherT._VerificationStatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Severity, otherT._Severity)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_Abatement, otherT._Abatement)) return false; + if(!comparer.Equals(_AssertedDateElement, otherT._AssertedDateElement)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.Equals(_Stage, otherT._Stage)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatusElement; - return ClinicalStatusElement is not null; + value = _ClinicalStatusElement; + return _ClinicalStatusElement is not null; case "verificationStatus": - value = VerificationStatusElement; - return VerificationStatusElement is not null; + value = _VerificationStatusElement; + return _VerificationStatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "severity": - value = Severity; - return Severity is not null; + value = _Severity; + return _Severity is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "abatement": - value = Abatement; - return Abatement is not null; + value = _Abatement; + return _Abatement is not null; case "assertedDate": - value = AssertedDateElement; - return AssertedDateElement is not null; + value = _AssertedDateElement; + return _AssertedDateElement is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "stage": - value = Stage; - return Stage is not null; + value = _Stage; + return _Stage is not null; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatusElement = (Code)value; + ClinicalStatusElement = (Code?)value; return this; case "verificationStatus": - VerificationStatusElement = (Code)value; + VerificationStatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "severity": - Severity = (Hl7.Fhir.Model.CodeableConcept)value; + Severity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "abatement": - Abatement = (Hl7.Fhir.Model.DataType)value; + Abatement = (Hl7.Fhir.Model.DataType?)value; return this; case "assertedDate": - AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + AssertedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "stage": - Stage = (Hl7.Fhir.Model.Condition.StageComponent)value; + Stage = (Hl7.Fhir.Model.Condition.StageComponent?)value; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -855,22 +837,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatusElement is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatusElement); - if (VerificationStatusElement is not null) yield return new KeyValuePair("verificationStatus",VerificationStatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Severity is not null) yield return new KeyValuePair("severity",Severity); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Abatement is not null) yield return new KeyValuePair("abatement",Abatement); - if (AssertedDateElement is not null) yield return new KeyValuePair("assertedDate",AssertedDateElement); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (Stage is not null) yield return new KeyValuePair("stage",Stage); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatusElement is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatusElement); + if (_VerificationStatusElement is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Severity is not null) yield return new KeyValuePair("severity",_Severity); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Abatement is not null) yield return new KeyValuePair("abatement",_Abatement); + if (_AssertedDateElement is not null) yield return new KeyValuePair("assertedDate",_AssertedDateElement); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_Stage is not null) yield return new KeyValuePair("stage",_Stage); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs index 32a8f1df6..8043d71b2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -185,13 +188,13 @@ public partial class ActorComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentActorRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Resource for the actor (or group, by role). @@ -201,26 +204,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Device","Group","CareTeam","Organization","Patient","Practitioner","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as ActorComponent; - - if (dest == null) - { + if(other is not ActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -232,41 +231,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActorComponent; - if(otherT == null) return false; + if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -277,8 +276,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -304,28 +303,25 @@ public partial class PolicyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("authority", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri AuthorityElement + public Hl7.Fhir.Model.FhirUri? AuthorityElement { get { return _AuthorityElement; } set { _AuthorityElement = value; OnPropertyChanged("AuthorityElement"); } } - private Hl7.Fhir.Model.FhirUri _AuthorityElement; + private Hl7.Fhir.Model.FhirUri? _AuthorityElement; /// /// Enforcement source for policy /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authority + public string? Authority { - get { return AuthorityElement != null ? AuthorityElement.Value : null; } + get => _AuthorityElement?.Value; set { - if (value == null) - AuthorityElement = null; - else - AuthorityElement = new Hl7.Fhir.Model.FhirUri(value); + AuthorityElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Authority"); } } @@ -335,44 +331,37 @@ public string Authority /// [FhirElement("uri", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Specific policy covered by this consent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PolicyComponent; - - if (dest == null) - { + if(other is not PolicyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AuthorityElement != null) dest.AuthorityElement = (Hl7.Fhir.Model.FhirUri)AuthorityElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); + if(_AuthorityElement is not null) dest.AuthorityElement = (Hl7.Fhir.Model.FhirUri)_AuthorityElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -384,41 +373,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PolicyComponent; - if(otherT == null) return false; + if(other is not PolicyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AuthorityElement, otherT.AuthorityElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authority": - value = AuthorityElement; - return AuthorityElement is not null; + value = _AuthorityElement; + return _AuthorityElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authority": - AuthorityElement = (Hl7.Fhir.Model.FhirUri)value; + AuthorityElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -429,8 +418,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AuthorityElement is not null) yield return new KeyValuePair("authority",AuthorityElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); + if (_AuthorityElement is not null) yield return new KeyValuePair("authority",_AuthorityElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); } } @@ -459,13 +448,13 @@ public partial class DataComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentDataMeaning")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MeaningElement + public Code? MeaningElement { get { return _MeaningElement; } set { _MeaningElement = value; OnPropertyChanged("MeaningElement"); } } - private Code _MeaningElement; + private Code? _MeaningElement; /// /// instance | related | dependents | authoredby @@ -474,13 +463,10 @@ public Code MeaningElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning { - get { return MeaningElement != null ? MeaningElement.Value : null; } + get => _MeaningElement?.Value; set { - if (value == null) - MeaningElement = null; - else - MeaningElement = new Code(value); + MeaningElement = value is null ? null : new Code(value); OnPropertyChanged("Meaning"); } } @@ -493,26 +479,22 @@ public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as DataComponent; - - if (dest == null) - { + if(other is not DataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MeaningElement != null) dest.MeaningElement = (Code)MeaningElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_MeaningElement is not null) dest.MeaningElement = (Code)_MeaningElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -524,41 +506,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataComponent; - if(otherT == null) return false; + if(other is not DataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MeaningElement, otherT.MeaningElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "meaning": - value = MeaningElement; - return MeaningElement is not null; + value = _MeaningElement; + return _MeaningElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "meaning": - MeaningElement = (Code)value; + MeaningElement = (Code?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -569,8 +551,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MeaningElement is not null) yield return new KeyValuePair("meaning",MeaningElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_MeaningElement is not null) yield return new KeyValuePair("meaning",_MeaningElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -599,13 +581,13 @@ public partial class ExceptComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentExceptType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// deny | permit @@ -614,13 +596,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentExceptType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -630,13 +609,13 @@ public Hl7.Fhir.Model.Consent.ConsentExceptType? Type /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Who|what controlled by this exception (or group, by role). @@ -646,11 +625,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Actions controlled by this exception. @@ -661,11 +640,11 @@ public List Actor [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Security Labels that define affected resources. @@ -676,11 +655,11 @@ public List Action [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of activities covered by this exception. @@ -691,11 +670,11 @@ public List SecurityLabel [DataMember] public List Purpose { - get { if(_Purpose==null) _Purpose = new List(); return _Purpose; } + get => _Purpose ?? new List(); set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private List _Purpose; + private List? _Purpose; /// /// e.g. Resource Type, Profile, or CDA etc. @@ -706,11 +685,11 @@ public List Purpose [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// e.g. LOINC or SNOMED CT code, etc in the content. @@ -721,24 +700,24 @@ public List Class [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Timeframe for data controlled by this exception. /// [FhirElement("dataPeriod", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period DataPeriod + public Hl7.Fhir.Model.Period? DataPeriod { get { return _DataPeriod; } set { _DataPeriod = value; OnPropertyChanged("DataPeriod"); } } - private Hl7.Fhir.Model.Period _DataPeriod; + private Hl7.Fhir.Model.Period? _DataPeriod; /// /// Data controlled by this exception. @@ -748,32 +727,28 @@ public Hl7.Fhir.Model.Period DataPeriod [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; protected internal override void CopyToInternal(Base other) { - var dest = other as ExceptComponent; - - if (dest == null) - { + if(other is not ExceptComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Purpose.Any()) dest.Purpose = new List(Purpose.DeepCopyInternal()); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(DataPeriod != null) dest.DataPeriod = (Hl7.Fhir.Model.Period)DataPeriod.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Purpose is not null) dest.Purpose = new List(_Purpose.DeepCopyInternal()); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_DataPeriod is not null) dest.DataPeriod = (Hl7.Fhir.Model.Period)_DataPeriod.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -785,97 +760,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExceptComponent; - if(otherT == null) return false; + if(other is not ExceptComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Purpose, otherT.Purpose)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(DataPeriod, otherT.DataPeriod)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Purpose, otherT._Purpose)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "purpose": - value = Purpose; - return Purpose?.Any() == true; + value = _Purpose; + return _Purpose?.Any() == true; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "dataPeriod": - value = DataPeriod; - return DataPeriod is not null; + value = _DataPeriod; + return _DataPeriod is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "purpose": - Purpose = (List)value; + Purpose = (List?)value!; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "dataPeriod": - DataPeriod = (Hl7.Fhir.Model.Period)value; + DataPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; default: return base.SetValue(key, value); @@ -886,16 +861,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Purpose?.Any() == true) yield return new KeyValuePair("purpose",Purpose); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (DataPeriod is not null) yield return new KeyValuePair("dataPeriod",DataPeriod); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Purpose?.Any() == true) yield return new KeyValuePair("purpose",_Purpose); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_DataPeriod is not null) yield return new KeyValuePair("dataPeriod",_DataPeriod); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); } } @@ -923,13 +898,13 @@ public partial class ExceptActorComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentActorRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Resource for the actor (or group, by role). @@ -939,26 +914,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Device","Group","CareTeam","Organization","Patient","Practitioner","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as ExceptActorComponent; - - if (dest == null) - { + if(other is not ExceptActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -970,41 +941,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExceptActorComponent; - if(otherT == null) return false; + if(other is not ExceptActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1015,8 +986,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -1045,13 +1016,13 @@ public partial class ExceptDataComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentDataMeaning")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MeaningElement + public Code? MeaningElement { get { return _MeaningElement; } set { _MeaningElement = value; OnPropertyChanged("MeaningElement"); } } - private Code _MeaningElement; + private Code? _MeaningElement; /// /// instance | related | dependents | authoredby @@ -1060,13 +1031,10 @@ public Code MeaningElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning { - get { return MeaningElement != null ? MeaningElement.Value : null; } + get => _MeaningElement?.Value; set { - if (value == null) - MeaningElement = null; - else - MeaningElement = new Code(value); + MeaningElement = value is null ? null : new Code(value); OnPropertyChanged("Meaning"); } } @@ -1079,26 +1047,22 @@ public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as ExceptDataComponent; - - if (dest == null) - { + if(other is not ExceptDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MeaningElement != null) dest.MeaningElement = (Code)MeaningElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_MeaningElement is not null) dest.MeaningElement = (Code)_MeaningElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1110,41 +1074,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExceptDataComponent; - if(otherT == null) return false; + if(other is not ExceptDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MeaningElement, otherT.MeaningElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "meaning": - value = MeaningElement; - return MeaningElement is not null; + value = _MeaningElement; + return _MeaningElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "meaning": - MeaningElement = (Code)value; + MeaningElement = (Code?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1155,8 +1119,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MeaningElement is not null) yield return new KeyValuePair("meaning",MeaningElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_MeaningElement is not null) yield return new KeyValuePair("meaning",_MeaningElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -1166,13 +1130,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// draft | proposed | active | rejected | inactive | entered-in-error. @@ -1182,13 +1146,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("ConsentState")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | proposed | active | rejected | inactive | entered-in-error @@ -1197,13 +1161,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentState? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1217,11 +1178,11 @@ public Hl7.Fhir.Model.Consent.ConsentState? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who the consent applies to. @@ -1231,54 +1192,51 @@ public List Category [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Period that this consent applies. /// [FhirElement("period", InSummary=true, Order=130, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// When this Consent was created or indexed. /// [FhirElement("dateTime", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateTimeElement + public Hl7.Fhir.Model.FhirDateTime? DateTimeElement { get { return _DateTimeElement; } set { _DateTimeElement = value; OnPropertyChanged("DateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _DateTimeElement; /// /// When this Consent was created or indexed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateTime + public string? DateTime { - get { return DateTimeElement != null ? DateTimeElement.Value : null; } + get => _DateTimeElement?.Value; set { - if (value == null) - DateTimeElement = null; - else - DateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateTime"); } } @@ -1293,11 +1251,11 @@ public string DateTime [DataMember] public List ConsentingParty { - get { if(_ConsentingParty==null) _ConsentingParty = new List(); return _ConsentingParty; } + get => _ConsentingParty ?? new List(); set { _ConsentingParty = value; OnPropertyChanged("ConsentingParty"); } } - private List _ConsentingParty; + private List? _ConsentingParty; /// /// Who|what controlled by this consent (or group, by role). @@ -1307,11 +1265,11 @@ public List ConsentingParty [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Actions controlled by this consent. @@ -1322,11 +1280,11 @@ public List Actor [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Custodian of the consent. @@ -1338,11 +1296,11 @@ public List Action [DataMember] public List Organization { - get { if(_Organization==null) _Organization = new List(); return _Organization; } + get => _Organization ?? new List(); set { _Organization = value; OnPropertyChanged("Organization"); } } - private List _Organization; + private List? _Organization; /// /// Source from which this consent is taken. @@ -1352,13 +1310,13 @@ public List Organization [References("Consent","DocumentReference","Contract","QuestionnaireResponse")] [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// Policies covered by this consent. @@ -1368,39 +1326,36 @@ public Hl7.Fhir.Model.DataType Source [DataMember] public List Policy { - get { if(_Policy==null) _Policy = new List(); return _Policy; } + get => _Policy ?? new List(); set { _Policy = value; OnPropertyChanged("Policy"); } } - private List _Policy; + private List? _Policy; /// /// Policy that this consents to. /// [FhirElement("policyRule", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirUri PolicyRuleElement + public Hl7.Fhir.Model.FhirUri? PolicyRuleElement { get { return _PolicyRuleElement; } set { _PolicyRuleElement = value; OnPropertyChanged("PolicyRuleElement"); } } - private Hl7.Fhir.Model.FhirUri _PolicyRuleElement; + private Hl7.Fhir.Model.FhirUri? _PolicyRuleElement; /// /// Policy that this consents to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PolicyRule + public string? PolicyRule { - get { return PolicyRuleElement != null ? PolicyRuleElement.Value : null; } + get => _PolicyRuleElement?.Value; set { - if (value == null) - PolicyRuleElement = null; - else - PolicyRuleElement = new Hl7.Fhir.Model.FhirUri(value); + PolicyRuleElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("PolicyRule"); } } @@ -1414,11 +1369,11 @@ public string PolicyRule [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of activities for which the agreement is made. @@ -1429,24 +1384,24 @@ public List SecurityLabel [DataMember] public List Purpose { - get { if(_Purpose==null) _Purpose = new List(); return _Purpose; } + get => _Purpose ?? new List(); set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private List _Purpose; + private List? _Purpose; /// /// Timeframe for data controlled by this consent. /// [FhirElement("dataPeriod", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.Period DataPeriod + public Hl7.Fhir.Model.Period? DataPeriod { get { return _DataPeriod; } set { _DataPeriod = value; OnPropertyChanged("DataPeriod"); } } - private Hl7.Fhir.Model.Period _DataPeriod; + private Hl7.Fhir.Model.Period? _DataPeriod; /// /// Data controlled by this consent. @@ -1456,11 +1411,11 @@ public Hl7.Fhir.Model.Period DataPeriod [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// Additional rule - addition or removal of permissions. @@ -1470,42 +1425,38 @@ public List Data [DataMember] public List Except { - get { if(_Except==null) _Except = new List(); return _Except; } + get => _Except ?? new List(); set { _Except = value; OnPropertyChanged("Except"); } } - private List _Except; + private List? _Except; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Consent; - - if (dest == null) - { + if(other is not Consent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(DateTimeElement != null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopyInternal(); - if(ConsentingParty.Any()) dest.ConsentingParty = new List(ConsentingParty.DeepCopyInternal()); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(Organization.Any()) dest.Organization = new List(Organization.DeepCopyInternal()); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(Policy.Any()) dest.Policy = new List(Policy.DeepCopyInternal()); - if(PolicyRuleElement != null) dest.PolicyRuleElement = (Hl7.Fhir.Model.FhirUri)PolicyRuleElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Purpose.Any()) dest.Purpose = new List(Purpose.DeepCopyInternal()); - if(DataPeriod != null) dest.DataPeriod = (Hl7.Fhir.Model.Period)DataPeriod.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Except.Any()) dest.Except = new List(Except.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_DateTimeElement is not null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_DateTimeElement.DeepCopyInternal(); + if(_ConsentingParty is not null) dest.ConsentingParty = new List(_ConsentingParty.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_Organization is not null) dest.Organization = new List(_Organization.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_Policy is not null) dest.Policy = new List(_Policy.DeepCopyInternal()); + if(_PolicyRuleElement is not null) dest.PolicyRuleElement = (Hl7.Fhir.Model.FhirUri)_PolicyRuleElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Purpose is not null) dest.Purpose = new List(_Purpose.DeepCopyInternal()); + if(_DataPeriod is not null) dest.DataPeriod = (Hl7.Fhir.Model.Period)_DataPeriod.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Except is not null) dest.Except = new List(_Except.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1517,153 +1468,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Consent; - if(otherT == null) return false; + if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(DateTimeElement, otherT.DateTimeElement)) return false; - if(!comparer.ListEquals(ConsentingParty, otherT.ConsentingParty)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Policy, otherT.Policy)) return false; - if(!comparer.Equals(PolicyRuleElement, otherT.PolicyRuleElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Purpose, otherT.Purpose)) return false; - if(!comparer.Equals(DataPeriod, otherT.DataPeriod)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.ListEquals(Except, otherT.Except)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_DateTimeElement, otherT._DateTimeElement)) return false; + if(!comparer.ListEquals(_ConsentingParty, otherT._ConsentingParty)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Policy, otherT._Policy)) return false; + if(!comparer.Equals(_PolicyRuleElement, otherT._PolicyRuleElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Purpose, otherT._Purpose)) return false; + if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.ListEquals(_Except, otherT._Except)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "dateTime": - value = DateTimeElement; - return DateTimeElement is not null; + value = _DateTimeElement; + return _DateTimeElement is not null; case "consentingParty": - value = ConsentingParty; - return ConsentingParty?.Any() == true; + value = _ConsentingParty; + return _ConsentingParty?.Any() == true; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "organization": - value = Organization; - return Organization?.Any() == true; + value = _Organization; + return _Organization?.Any() == true; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "policy": - value = Policy; - return Policy?.Any() == true; + value = _Policy; + return _Policy?.Any() == true; case "policyRule": - value = PolicyRuleElement; - return PolicyRuleElement is not null; + value = _PolicyRuleElement; + return _PolicyRuleElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "purpose": - value = Purpose; - return Purpose?.Any() == true; + value = _Purpose; + return _Purpose?.Any() == true; case "dataPeriod": - value = DataPeriod; - return DataPeriod is not null; + value = _DataPeriod; + return _DataPeriod is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "except": - value = Except; - return Except?.Any() == true; + value = _Except; + return _Except?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "dateTime": - DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "consentingParty": - ConsentingParty = (List)value; + ConsentingParty = (List?)value!; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "organization": - Organization = (List)value; + Organization = (List?)value!; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "policy": - Policy = (List)value; + Policy = (List?)value!; return this; case "policyRule": - PolicyRuleElement = (Hl7.Fhir.Model.FhirUri)value; + PolicyRuleElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "purpose": - Purpose = (List)value; + Purpose = (List?)value!; return this; case "dataPeriod": - DataPeriod = (Hl7.Fhir.Model.Period)value; + DataPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "except": - Except = (List)value; + Except = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1674,24 +1625,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (DateTimeElement is not null) yield return new KeyValuePair("dateTime",DateTimeElement); - if (ConsentingParty?.Any() == true) yield return new KeyValuePair("consentingParty",ConsentingParty); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (Organization?.Any() == true) yield return new KeyValuePair("organization",Organization); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Policy?.Any() == true) yield return new KeyValuePair("policy",Policy); - if (PolicyRuleElement is not null) yield return new KeyValuePair("policyRule",PolicyRuleElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Purpose?.Any() == true) yield return new KeyValuePair("purpose",Purpose); - if (DataPeriod is not null) yield return new KeyValuePair("dataPeriod",DataPeriod); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Except?.Any() == true) yield return new KeyValuePair("except",Except); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_DateTimeElement is not null) yield return new KeyValuePair("dateTime",_DateTimeElement); + if (_ConsentingParty?.Any() == true) yield return new KeyValuePair("consentingParty",_ConsentingParty); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_Organization?.Any() == true) yield return new KeyValuePair("organization",_Organization); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Policy?.Any() == true) yield return new KeyValuePair("policy",_Policy); + if (_PolicyRuleElement is not null) yield return new KeyValuePair("policyRule",_PolicyRuleElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Purpose?.Any() == true) yield return new KeyValuePair("purpose",_Purpose); + if (_DataPeriod is not null) yield return new KeyValuePair("dataPeriod",_DataPeriod); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Except?.Any() == true) yield return new KeyValuePair("except",_Except); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs index 9dee2cb05..f479aab14 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -185,13 +188,13 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [References("Contract","Device","Group","Location","Organization","Patient","Practitioner","RelatedPerson","Substance")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Role type of the agent. @@ -202,24 +205,20 @@ public Hl7.Fhir.Model.ResourceReference Actor [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -231,41 +230,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; default: return base.SetValue(key, value); @@ -276,8 +275,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); } } @@ -307,13 +306,13 @@ public partial class SignatoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("ContractSignerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Contract Signatory Party. @@ -323,13 +322,13 @@ public Hl7.Fhir.Model.Coding Type [References("Organization","Patient","Practitioner","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Contract Documentation Signature. @@ -339,25 +338,21 @@ public Hl7.Fhir.Model.ResourceReference Party [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as SignatoryComponent; - - if (dest == null) - { + if(other is not SignatoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -369,48 +364,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SignatoryComponent; - if(otherT == null) return false; + if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -421,9 +416,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } @@ -449,54 +444,51 @@ public partial class ValuedItemComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Entity + public Hl7.Fhir.Model.DataType? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.DataType _Entity; + private Hl7.Fhir.Model.DataType? _Entity; /// /// Contract Valued Item Number. /// [FhirElement("identifier", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Valued Item Effective Tiem. /// [FhirElement("effectiveTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EffectiveTimeElement + public Hl7.Fhir.Model.FhirDateTime? EffectiveTimeElement { get { return _EffectiveTimeElement; } set { _EffectiveTimeElement = value; OnPropertyChanged("EffectiveTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EffectiveTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _EffectiveTimeElement; /// /// Contract Valued Item Effective Tiem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EffectiveTime + public string? EffectiveTime { - get { return EffectiveTimeElement != null ? EffectiveTimeElement.Value : null; } + get => _EffectiveTimeElement?.Value; set { - if (value == null) - EffectiveTimeElement = null; - else - EffectiveTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + EffectiveTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EffectiveTime"); } } @@ -506,39 +498,39 @@ public string EffectiveTime /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Contract Valued Item fee, charge, or cost. /// [FhirElement("unitPrice", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Contract Valued Item Price Scaling Factor. /// [FhirElement("factor", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Contract Valued Item Price Scaling Factor @@ -547,13 +539,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -563,13 +552,13 @@ public decimal? Factor /// [FhirElement("points", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PointsElement + public Hl7.Fhir.Model.FhirDecimal? PointsElement { get { return _PointsElement; } set { _PointsElement = value; OnPropertyChanged("PointsElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PointsElement; + private Hl7.Fhir.Model.FhirDecimal? _PointsElement; /// /// Contract Valued Item Difficulty Scaling Factor @@ -578,13 +567,10 @@ public Hl7.Fhir.Model.FhirDecimal PointsElement [IgnoreDataMember] public decimal? Points { - get { return PointsElement != null ? PointsElement.Value : null; } + get => _PointsElement?.Value; set { - if (value == null) - PointsElement = null; - else - PointsElement = new Hl7.Fhir.Model.FhirDecimal(value); + PointsElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Points"); } } @@ -594,32 +580,28 @@ public decimal? Points /// [FhirElement("net", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; protected internal override void CopyToInternal(Base other) { - var dest = other as ValuedItemComponent; - - if (dest == null) - { + if(other is not ValuedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.DataType)Entity.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(EffectiveTimeElement != null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)EffectiveTimeElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(PointsElement != null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)PointsElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.DataType)_Entity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_EffectiveTimeElement is not null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)_EffectiveTimeElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_PointsElement is not null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)_PointsElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -631,83 +613,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValuedItemComponent; - if(otherT == null) return false; + if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(EffectiveTimeElement, otherT.EffectiveTimeElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(PointsElement, otherT.PointsElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_PointsElement, otherT._PointsElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "effectiveTime": - value = EffectiveTimeElement; - return EffectiveTimeElement is not null; + value = _EffectiveTimeElement; + return _EffectiveTimeElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "points": - value = PointsElement; - return PointsElement is not null; + value = _PointsElement; + return _PointsElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.DataType)value; + Entity = (Hl7.Fhir.Model.DataType?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "effectiveTime": - EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "points": - PointsElement = (Hl7.Fhir.Model.FhirDecimal)value; + PointsElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -718,14 +700,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",EffectiveTimeElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (PointsElement is not null) yield return new KeyValuePair("points",PointsElement); - if (Net is not null) yield return new KeyValuePair("net",Net); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",_EffectiveTimeElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_PointsElement is not null) yield return new KeyValuePair("points",_PointsElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); } } @@ -751,41 +733,38 @@ public partial class TermComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Term Issue Date Time. /// [FhirElement("issued", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// Contract Term Issue Date Time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -795,13 +774,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Contract Term Type or Form. @@ -809,13 +788,13 @@ public Hl7.Fhir.Model.Period Applies [FhirElement("type", Order=70)] [Binding("ContractTermType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Contract Term Type specific classification. @@ -823,13 +802,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=80)] [Binding("ContractTermSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// Context of the Contract term. @@ -841,11 +820,11 @@ public Hl7.Fhir.Model.CodeableConcept SubType [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Contract Term Activity. @@ -856,11 +835,11 @@ public List Topic [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Purpose for the Contract Term Action. @@ -871,11 +850,11 @@ public List Action [DataMember] public List ActionReason { - get { if(_ActionReason==null) _ActionReason = new List(); return _ActionReason; } + get => _ActionReason ?? new List(); set { _ActionReason = value; OnPropertyChanged("ActionReason"); } } - private List _ActionReason; + private List? _ActionReason; /// /// Security Labels that define affected terms. @@ -886,11 +865,11 @@ public List ActionReason [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Contract Term Agent List. @@ -900,39 +879,36 @@ public List SecurityLabel [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// Human readable Contract term text. /// [FhirElement("text", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Human readable Contract term text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -945,11 +921,11 @@ public string Text [DataMember] public List ValuedItem { - get { if(_ValuedItem==null) _ValuedItem = new List(); return _ValuedItem; } + get => _ValuedItem ?? new List(); set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } - private List _ValuedItem; + private List? _ValuedItem; /// /// Nested Contract Term Group. @@ -959,35 +935,31 @@ public List ValuedItem [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; protected internal override void CopyToInternal(Base other) { - var dest = other as TermComponent; - - if (dest == null) - { + if(other is not TermComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(ActionReason.Any()) dest.ActionReason = new List(ActionReason.DeepCopyInternal()); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(ValuedItem.Any()) dest.ValuedItem = new List(ValuedItem.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_ActionReason is not null) dest.ActionReason = new List(_ActionReason.DeepCopyInternal()); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_ValuedItem is not null) dest.ValuedItem = new List(_ValuedItem.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -999,118 +971,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TermComponent; - if(otherT == null) return false; + if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(ActionReason, otherT.ActionReason)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(ValuedItem, otherT.ValuedItem)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_ActionReason, otherT._ActionReason)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "actionReason": - value = ActionReason; - return ActionReason?.Any() == true; + value = _ActionReason; + return _ActionReason?.Any() == true; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "valuedItem": - value = ValuedItem; - return ValuedItem?.Any() == true; + value = _ValuedItem; + return _ValuedItem?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "actionReason": - ActionReason = (List)value; + ActionReason = (List?)value!; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valuedItem": - ValuedItem = (List)value; + ValuedItem = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1121,19 +1093,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (ActionReason?.Any() == true) yield return new KeyValuePair("actionReason",ActionReason); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",ValuedItem); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_ActionReason?.Any() == true) yield return new KeyValuePair("actionReason",_ActionReason); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",_ValuedItem); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } @@ -1164,13 +1136,13 @@ public partial class TermAgentComponent : Hl7.Fhir.Model.BackboneElement [References("Contract","Device","Group","Location","Organization","Patient","Practitioner","RelatedPerson","Substance")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Type of the Contract Term Agent. @@ -1181,24 +1153,20 @@ public Hl7.Fhir.Model.ResourceReference Actor [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as TermAgentComponent; - - if (dest == null) - { + if(other is not TermAgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1210,41 +1178,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TermAgentComponent; - if(otherT == null) return false; + if(other is not TermAgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1255,8 +1223,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); } } @@ -1285,54 +1253,51 @@ public partial class TermValuedItemComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Entity + public Hl7.Fhir.Model.DataType? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.DataType _Entity; + private Hl7.Fhir.Model.DataType? _Entity; /// /// Contract Term Valued Item Number. /// [FhirElement("identifier", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Term Valued Item Effective Tiem. /// [FhirElement("effectiveTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EffectiveTimeElement + public Hl7.Fhir.Model.FhirDateTime? EffectiveTimeElement { get { return _EffectiveTimeElement; } set { _EffectiveTimeElement = value; OnPropertyChanged("EffectiveTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EffectiveTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _EffectiveTimeElement; /// /// Contract Term Valued Item Effective Tiem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EffectiveTime + public string? EffectiveTime { - get { return EffectiveTimeElement != null ? EffectiveTimeElement.Value : null; } + get => _EffectiveTimeElement?.Value; set { - if (value == null) - EffectiveTimeElement = null; - else - EffectiveTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + EffectiveTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EffectiveTime"); } } @@ -1342,39 +1307,39 @@ public string EffectiveTime /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Contract Term Valued Item fee, charge, or cost. /// [FhirElement("unitPrice", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Contract Term Valued Item Price Scaling Factor. /// [FhirElement("factor", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Contract Term Valued Item Price Scaling Factor @@ -1383,13 +1348,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1399,13 +1361,13 @@ public decimal? Factor /// [FhirElement("points", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PointsElement + public Hl7.Fhir.Model.FhirDecimal? PointsElement { get { return _PointsElement; } set { _PointsElement = value; OnPropertyChanged("PointsElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PointsElement; + private Hl7.Fhir.Model.FhirDecimal? _PointsElement; /// /// Contract Term Valued Item Difficulty Scaling Factor @@ -1414,13 +1376,10 @@ public Hl7.Fhir.Model.FhirDecimal PointsElement [IgnoreDataMember] public decimal? Points { - get { return PointsElement != null ? PointsElement.Value : null; } + get => _PointsElement?.Value; set { - if (value == null) - PointsElement = null; - else - PointsElement = new Hl7.Fhir.Model.FhirDecimal(value); + PointsElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Points"); } } @@ -1430,32 +1389,28 @@ public decimal? Points /// [FhirElement("net", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; protected internal override void CopyToInternal(Base other) { - var dest = other as TermValuedItemComponent; - - if (dest == null) - { + if(other is not TermValuedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.DataType)Entity.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(EffectiveTimeElement != null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)EffectiveTimeElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(PointsElement != null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)PointsElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.DataType)_Entity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_EffectiveTimeElement is not null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)_EffectiveTimeElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_PointsElement is not null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)_PointsElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1467,83 +1422,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TermValuedItemComponent; - if(otherT == null) return false; + if(other is not TermValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(EffectiveTimeElement, otherT.EffectiveTimeElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(PointsElement, otherT.PointsElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_PointsElement, otherT._PointsElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "effectiveTime": - value = EffectiveTimeElement; - return EffectiveTimeElement is not null; + value = _EffectiveTimeElement; + return _EffectiveTimeElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "points": - value = PointsElement; - return PointsElement is not null; + value = _PointsElement; + return _PointsElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.DataType)value; + Entity = (Hl7.Fhir.Model.DataType?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "effectiveTime": - EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "points": - PointsElement = (Hl7.Fhir.Model.FhirDecimal)value; + PointsElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -1554,14 +1509,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",EffectiveTimeElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (PointsElement is not null) yield return new KeyValuePair("points",PointsElement); - if (Net is not null) yield return new KeyValuePair("net",Net); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",_EffectiveTimeElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_PointsElement is not null) yield return new KeyValuePair("points",_PointsElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); } } @@ -1591,25 +1546,21 @@ public partial class FriendlyLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as FriendlyLanguageComponent; - - if (dest == null) - { + if(other is not FriendlyLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1621,34 +1572,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FriendlyLanguageComponent; - if(otherT == null) return false; + if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1659,7 +1610,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -1689,25 +1640,21 @@ public partial class LegalLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as LegalLanguageComponent; - - if (dest == null) - { + if(other is not LegalLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1719,34 +1666,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LegalLanguageComponent; - if(otherT == null) return false; + if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1757,7 +1704,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -1787,25 +1734,21 @@ public partial class ComputableLanguageComponent : Hl7.Fhir.Model.BackboneElemen [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as ComputableLanguageComponent; - - if (dest == null) - { + if(other is not ComputableLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1817,34 +1760,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComputableLanguageComponent; - if(otherT == null) return false; + if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1855,7 +1798,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -1865,13 +1808,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated. @@ -1880,13 +1823,13 @@ public Hl7.Fhir.Model.Identifier Identifier [DeclaredType(Type = typeof(Code))] [Binding("ContractStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated @@ -1895,13 +1838,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1911,28 +1851,25 @@ public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status /// [FhirElement("issued", InSummary=true, Order=110, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When this Contract was issued /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -1942,13 +1879,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Contract Target Entity. @@ -1960,11 +1897,11 @@ public Hl7.Fhir.Model.Period Applies [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Context of the Contract. @@ -1976,11 +1913,11 @@ public List Subject [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Authority under which this Contract has standing. @@ -1992,11 +1929,11 @@ public List Topic [DataMember] public List Authority { - get { if(_Authority==null) _Authority = new List(); return _Authority; } + get => _Authority ?? new List(); set { _Authority = value; OnPropertyChanged("Authority"); } } - private List _Authority; + private List? _Authority; /// /// Domain in which this Contract applies. @@ -2008,11 +1945,11 @@ public List Authority [DataMember] public List Domain { - get { if(_Domain==null) _Domain = new List(); return _Domain; } + get => _Domain ?? new List(); set { _Domain = value; OnPropertyChanged("Domain"); } } - private List _Domain; + private List? _Domain; /// /// Type or form. @@ -2020,13 +1957,13 @@ public List Domain [FhirElement("type", InSummary=true, Order=170)] [Binding("ContractType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Subtype within the context of type. @@ -2037,11 +1974,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List SubType { - get { if(_SubType==null) _SubType = new List(); return _SubType; } + get => _SubType ?? new List(); set { _SubType = value; OnPropertyChanged("SubType"); } } - private List _SubType; + private List? _SubType; /// /// Action stipulated by this Contract. @@ -2052,11 +1989,11 @@ public List SubType [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Rationale for the stiplulated action. @@ -2067,11 +2004,11 @@ public List Action [DataMember] public List ActionReason { - get { if(_ActionReason==null) _ActionReason = new List(); return _ActionReason; } + get => _ActionReason ?? new List(); set { _ActionReason = value; OnPropertyChanged("ActionReason"); } } - private List _ActionReason; + private List? _ActionReason; /// /// Decision by Grantor. @@ -2079,13 +2016,13 @@ public List ActionReason [FhirElement("decisionType", Order=210)] [Binding("ContractDecisionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DecisionType + public Hl7.Fhir.Model.CodeableConcept? DecisionType { get { return _DecisionType; } set { _DecisionType = value; OnPropertyChanged("DecisionType"); } } - private Hl7.Fhir.Model.CodeableConcept _DecisionType; + private Hl7.Fhir.Model.CodeableConcept? _DecisionType; /// /// Content derived from the basal information. @@ -2093,13 +2030,13 @@ public Hl7.Fhir.Model.CodeableConcept DecisionType [FhirElement("contentDerivative", Order=220)] [Binding("ContractContentDerivative")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ContentDerivative + public Hl7.Fhir.Model.CodeableConcept? ContentDerivative { get { return _ContentDerivative; } set { _ContentDerivative = value; OnPropertyChanged("ContentDerivative"); } } - private Hl7.Fhir.Model.CodeableConcept _ContentDerivative; + private Hl7.Fhir.Model.CodeableConcept? _ContentDerivative; /// /// Security Labels that define affected resources. @@ -2110,11 +2047,11 @@ public Hl7.Fhir.Model.CodeableConcept ContentDerivative [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Entity being ascribed responsibility. @@ -2124,11 +2061,11 @@ public List SecurityLabel [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// Contract Signatory. @@ -2138,11 +2075,11 @@ public List Agent [DataMember] public List Signer { - get { if(_Signer==null) _Signer = new List(); return _Signer; } + get => _Signer ?? new List(); set { _Signer = value; OnPropertyChanged("Signer"); } } - private List _Signer; + private List? _Signer; /// /// Contract Valued Item List. @@ -2152,11 +2089,11 @@ public List Signer [DataMember] public List ValuedItem { - get { if(_ValuedItem==null) _ValuedItem = new List(); return _ValuedItem; } + get => _ValuedItem ?? new List(); set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } - private List _ValuedItem; + private List? _ValuedItem; /// /// Contract Term List. @@ -2166,11 +2103,11 @@ public List ValuedItem [DataMember] public List Term { - get { if(_Term==null) _Term = new List(); return _Term; } + get => _Term ?? new List(); set { _Term = value; OnPropertyChanged("Term"); } } - private List _Term; + private List? _Term; /// /// Binding Contract. @@ -2180,13 +2117,13 @@ public List Term [References("Composition","DocumentReference","QuestionnaireResponse")] [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Binding + public Hl7.Fhir.Model.DataType? Binding { get { return _Binding; } set { _Binding = value; OnPropertyChanged("Binding"); } } - private Hl7.Fhir.Model.DataType _Binding; + private Hl7.Fhir.Model.DataType? _Binding; /// /// Contract Friendly Language. @@ -2196,11 +2133,11 @@ public Hl7.Fhir.Model.DataType Binding [DataMember] public List Friendly { - get { if(_Friendly==null) _Friendly = new List(); return _Friendly; } + get => _Friendly ?? new List(); set { _Friendly = value; OnPropertyChanged("Friendly"); } } - private List _Friendly; + private List? _Friendly; /// /// Contract Legal Language. @@ -2210,11 +2147,11 @@ public List Friendly [DataMember] public List Legal { - get { if(_Legal==null) _Legal = new List(); return _Legal; } + get => _Legal ?? new List(); set { _Legal = value; OnPropertyChanged("Legal"); } } - private List _Legal; + private List? _Legal; /// /// Computable Contract Language. @@ -2224,47 +2161,43 @@ public List Legal [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Contract; - - if (dest == null) - { + if(other is not Contract dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Authority.Any()) dest.Authority = new List(Authority.DeepCopyInternal()); - if(Domain.Any()) dest.Domain = new List(Domain.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType.Any()) dest.SubType = new List(SubType.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(ActionReason.Any()) dest.ActionReason = new List(ActionReason.DeepCopyInternal()); - if(DecisionType != null) dest.DecisionType = (Hl7.Fhir.Model.CodeableConcept)DecisionType.DeepCopyInternal(); - if(ContentDerivative != null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)ContentDerivative.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Signer.Any()) dest.Signer = new List(Signer.DeepCopyInternal()); - if(ValuedItem.Any()) dest.ValuedItem = new List(ValuedItem.DeepCopyInternal()); - if(Term.Any()) dest.Term = new List(Term.DeepCopyInternal()); - if(Binding != null) dest.Binding = (Hl7.Fhir.Model.DataType)Binding.DeepCopyInternal(); - if(Friendly.Any()) dest.Friendly = new List(Friendly.DeepCopyInternal()); - if(Legal.Any()) dest.Legal = new List(Legal.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Authority is not null) dest.Authority = new List(_Authority.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = new List(_Domain.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = new List(_SubType.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_ActionReason is not null) dest.ActionReason = new List(_ActionReason.DeepCopyInternal()); + if(_DecisionType is not null) dest.DecisionType = (Hl7.Fhir.Model.CodeableConcept)_DecisionType.DeepCopyInternal(); + if(_ContentDerivative is not null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)_ContentDerivative.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Signer is not null) dest.Signer = new List(_Signer.DeepCopyInternal()); + if(_ValuedItem is not null) dest.ValuedItem = new List(_ValuedItem.DeepCopyInternal()); + if(_Term is not null) dest.Term = new List(_Term.DeepCopyInternal()); + if(_Binding is not null) dest.Binding = (Hl7.Fhir.Model.DataType)_Binding.DeepCopyInternal(); + if(_Friendly is not null) dest.Friendly = new List(_Friendly.DeepCopyInternal()); + if(_Legal is not null) dest.Legal = new List(_Legal.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2276,188 +2209,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contract; - if(otherT == null) return false; + if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(Domain, otherT.Domain)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(SubType, otherT.SubType)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(ActionReason, otherT.ActionReason)) return false; - if(!comparer.Equals(DecisionType, otherT.DecisionType)) return false; - if(!comparer.Equals(ContentDerivative, otherT.ContentDerivative)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.ListEquals(Signer, otherT.Signer)) return false; - if(!comparer.ListEquals(ValuedItem, otherT.ValuedItem)) return false; - if(!comparer.ListEquals(Term, otherT.Term)) return false; - if(!comparer.Equals(Binding, otherT.Binding)) return false; - if(!comparer.ListEquals(Friendly, otherT.Friendly)) return false; - if(!comparer.ListEquals(Legal, otherT.Legal)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_Domain, otherT._Domain)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_ActionReason, otherT._ActionReason)) return false; + if(!comparer.Equals(_DecisionType, otherT._DecisionType)) return false; + if(!comparer.Equals(_ContentDerivative, otherT._ContentDerivative)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.ListEquals(_Signer, otherT._Signer)) return false; + if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; + if(!comparer.ListEquals(_Term, otherT._Term)) return false; + if(!comparer.Equals(_Binding, otherT._Binding)) return false; + if(!comparer.ListEquals(_Friendly, otherT._Friendly)) return false; + if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "authority": - value = Authority; - return Authority?.Any() == true; + value = _Authority; + return _Authority?.Any() == true; case "domain": - value = Domain; - return Domain?.Any() == true; + value = _Domain; + return _Domain?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType?.Any() == true; + value = _SubType; + return _SubType?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "actionReason": - value = ActionReason; - return ActionReason?.Any() == true; + value = _ActionReason; + return _ActionReason?.Any() == true; case "decisionType": - value = DecisionType; - return DecisionType is not null; + value = _DecisionType; + return _DecisionType is not null; case "contentDerivative": - value = ContentDerivative; - return ContentDerivative is not null; + value = _ContentDerivative; + return _ContentDerivative is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "signer": - value = Signer; - return Signer?.Any() == true; + value = _Signer; + return _Signer?.Any() == true; case "valuedItem": - value = ValuedItem; - return ValuedItem?.Any() == true; + value = _ValuedItem; + return _ValuedItem?.Any() == true; case "term": - value = Term; - return Term?.Any() == true; + value = _Term; + return _Term?.Any() == true; case "binding": - value = Binding; - return Binding is not null; + value = _Binding; + return _Binding is not null; case "friendly": - value = Friendly; - return Friendly?.Any() == true; + value = _Friendly; + return _Friendly?.Any() == true; case "legal": - value = Legal; - return Legal?.Any() == true; + value = _Legal; + return _Legal?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "authority": - Authority = (List)value; + Authority = (List?)value!; return this; case "domain": - Domain = (List)value; + Domain = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (List)value; + SubType = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "actionReason": - ActionReason = (List)value; + ActionReason = (List?)value!; return this; case "decisionType": - DecisionType = (Hl7.Fhir.Model.CodeableConcept)value; + DecisionType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contentDerivative": - ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)value; + ContentDerivative = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "signer": - Signer = (List)value; + Signer = (List?)value!; return this; case "valuedItem": - ValuedItem = (List)value; + ValuedItem = (List?)value!; return this; case "term": - Term = (List)value; + Term = (List?)value!; return this; case "binding": - Binding = (Hl7.Fhir.Model.DataType)value; + Binding = (Hl7.Fhir.Model.DataType?)value; return this; case "friendly": - Friendly = (List)value; + Friendly = (List?)value!; return this; case "legal": - Legal = (List)value; + Legal = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2468,29 +2401,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Authority?.Any() == true) yield return new KeyValuePair("authority",Authority); - if (Domain?.Any() == true) yield return new KeyValuePair("domain",Domain); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType?.Any() == true) yield return new KeyValuePair("subType",SubType); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (ActionReason?.Any() == true) yield return new KeyValuePair("actionReason",ActionReason); - if (DecisionType is not null) yield return new KeyValuePair("decisionType",DecisionType); - if (ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",ContentDerivative); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Signer?.Any() == true) yield return new KeyValuePair("signer",Signer); - if (ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",ValuedItem); - if (Term?.Any() == true) yield return new KeyValuePair("term",Term); - if (Binding is not null) yield return new KeyValuePair("binding",Binding); - if (Friendly?.Any() == true) yield return new KeyValuePair("friendly",Friendly); - if (Legal?.Any() == true) yield return new KeyValuePair("legal",Legal); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Authority?.Any() == true) yield return new KeyValuePair("authority",_Authority); + if (_Domain?.Any() == true) yield return new KeyValuePair("domain",_Domain); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType?.Any() == true) yield return new KeyValuePair("subType",_SubType); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_ActionReason?.Any() == true) yield return new KeyValuePair("actionReason",_ActionReason); + if (_DecisionType is not null) yield return new KeyValuePair("decisionType",_DecisionType); + if (_ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",_ContentDerivative); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Signer?.Any() == true) yield return new KeyValuePair("signer",_Signer); + if (_ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",_ValuedItem); + if (_Term?.Any() == true) yield return new KeyValuePair("term",_Term); + if (_Binding is not null) yield return new KeyValuePair("binding",_Binding); + if (_Friendly?.Any() == true) yield return new KeyValuePair("friendly",_Friendly); + if (_Legal?.Any() == true) yield return new KeyValuePair("legal",_Legal); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs b/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs index c30b4cec8..57b5fccd2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -101,13 +104,13 @@ public enum ContributorType [Binding("ContributorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// author | editor | reviewer | endorser @@ -116,13 +119,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Contributor.ContributorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -133,28 +133,25 @@ public Hl7.Fhir.Model.Contributor.ContributorType? Type [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Who contributed the content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -167,25 +164,21 @@ public string Name [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; protected internal override void CopyToInternal(Base other) { - var dest = other as Contributor; - - if (dest == null) - { + if(other is not Contributor dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -197,48 +190,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contributor; - if(otherT == null) return false; + if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; default: return base.SetValue(key, value); @@ -249,9 +242,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Count.cs b/src/Hl7.Fhir.STU3/Model/Generated/Count.cs index 85704ba9a..d1842dbee 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Count.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Count.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs index 806e9673e..800892efc 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,28 +83,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("group", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString GroupElement + public Hl7.Fhir.Model.FhirString? GroupElement { get { return _GroupElement; } set { _GroupElement = value; OnPropertyChanged("GroupElement"); } } - private Hl7.Fhir.Model.FhirString _GroupElement; + private Hl7.Fhir.Model.FhirString? _GroupElement; /// /// An identifier for the group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Group + public string? Group { - get { return GroupElement != null ? GroupElement.Value : null; } + get => _GroupElement?.Value; set { - if (value == null) - GroupElement = null; - else - GroupElement = new Hl7.Fhir.Model.FhirString(value); + GroupElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Group"); } } @@ -111,28 +111,25 @@ public string Group /// [FhirElement("groupDisplay", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString GroupDisplayElement + public Hl7.Fhir.Model.FhirString? GroupDisplayElement { get { return _GroupDisplayElement; } set { _GroupDisplayElement = value; OnPropertyChanged("GroupDisplayElement"); } } - private Hl7.Fhir.Model.FhirString _GroupDisplayElement; + private Hl7.Fhir.Model.FhirString? _GroupDisplayElement; /// /// Display text for an identifier for the group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string GroupDisplay + public string? GroupDisplay { - get { return GroupDisplayElement != null ? GroupDisplayElement.Value : null; } + get => _GroupDisplayElement?.Value; set { - if (value == null) - GroupDisplayElement = null; - else - GroupDisplayElement = new Hl7.Fhir.Model.FhirString(value); + GroupDisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("GroupDisplay"); } } @@ -142,28 +139,25 @@ public string GroupDisplay /// [FhirElement("subGroup", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString SubGroupElement + public Hl7.Fhir.Model.FhirString? SubGroupElement { get { return _SubGroupElement; } set { _SubGroupElement = value; OnPropertyChanged("SubGroupElement"); } } - private Hl7.Fhir.Model.FhirString _SubGroupElement; + private Hl7.Fhir.Model.FhirString? _SubGroupElement; /// /// An identifier for the subsection of the group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubGroup + public string? SubGroup { - get { return SubGroupElement != null ? SubGroupElement.Value : null; } + get => _SubGroupElement?.Value; set { - if (value == null) - SubGroupElement = null; - else - SubGroupElement = new Hl7.Fhir.Model.FhirString(value); + SubGroupElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubGroup"); } } @@ -173,28 +167,25 @@ public string SubGroup /// [FhirElement("subGroupDisplay", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString SubGroupDisplayElement + public Hl7.Fhir.Model.FhirString? SubGroupDisplayElement { get { return _SubGroupDisplayElement; } set { _SubGroupDisplayElement = value; OnPropertyChanged("SubGroupDisplayElement"); } } - private Hl7.Fhir.Model.FhirString _SubGroupDisplayElement; + private Hl7.Fhir.Model.FhirString? _SubGroupDisplayElement; /// /// Display text for the subsection of the group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubGroupDisplay + public string? SubGroupDisplay { - get { return SubGroupDisplayElement != null ? SubGroupDisplayElement.Value : null; } + get => _SubGroupDisplayElement?.Value; set { - if (value == null) - SubGroupDisplayElement = null; - else - SubGroupDisplayElement = new Hl7.Fhir.Model.FhirString(value); + SubGroupDisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubGroupDisplay"); } } @@ -204,28 +195,25 @@ public string SubGroupDisplay /// [FhirElement("plan", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString PlanElement + public Hl7.Fhir.Model.FhirString? PlanElement { get { return _PlanElement; } set { _PlanElement = value; OnPropertyChanged("PlanElement"); } } - private Hl7.Fhir.Model.FhirString _PlanElement; + private Hl7.Fhir.Model.FhirString? _PlanElement; /// /// An identifier for the plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Plan + public string? Plan { - get { return PlanElement != null ? PlanElement.Value : null; } + get => _PlanElement?.Value; set { - if (value == null) - PlanElement = null; - else - PlanElement = new Hl7.Fhir.Model.FhirString(value); + PlanElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Plan"); } } @@ -235,28 +223,25 @@ public string Plan /// [FhirElement("planDisplay", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString PlanDisplayElement + public Hl7.Fhir.Model.FhirString? PlanDisplayElement { get { return _PlanDisplayElement; } set { _PlanDisplayElement = value; OnPropertyChanged("PlanDisplayElement"); } } - private Hl7.Fhir.Model.FhirString _PlanDisplayElement; + private Hl7.Fhir.Model.FhirString? _PlanDisplayElement; /// /// Display text for the plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PlanDisplay + public string? PlanDisplay { - get { return PlanDisplayElement != null ? PlanDisplayElement.Value : null; } + get => _PlanDisplayElement?.Value; set { - if (value == null) - PlanDisplayElement = null; - else - PlanDisplayElement = new Hl7.Fhir.Model.FhirString(value); + PlanDisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PlanDisplay"); } } @@ -266,28 +251,25 @@ public string PlanDisplay /// [FhirElement("subPlan", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString SubPlanElement + public Hl7.Fhir.Model.FhirString? SubPlanElement { get { return _SubPlanElement; } set { _SubPlanElement = value; OnPropertyChanged("SubPlanElement"); } } - private Hl7.Fhir.Model.FhirString _SubPlanElement; + private Hl7.Fhir.Model.FhirString? _SubPlanElement; /// /// An identifier for the subsection of the plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubPlan + public string? SubPlan { - get { return SubPlanElement != null ? SubPlanElement.Value : null; } + get => _SubPlanElement?.Value; set { - if (value == null) - SubPlanElement = null; - else - SubPlanElement = new Hl7.Fhir.Model.FhirString(value); + SubPlanElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubPlan"); } } @@ -297,28 +279,25 @@ public string SubPlan /// [FhirElement("subPlanDisplay", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString SubPlanDisplayElement + public Hl7.Fhir.Model.FhirString? SubPlanDisplayElement { get { return _SubPlanDisplayElement; } set { _SubPlanDisplayElement = value; OnPropertyChanged("SubPlanDisplayElement"); } } - private Hl7.Fhir.Model.FhirString _SubPlanDisplayElement; + private Hl7.Fhir.Model.FhirString? _SubPlanDisplayElement; /// /// Display text for the subsection of the plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubPlanDisplay + public string? SubPlanDisplay { - get { return SubPlanDisplayElement != null ? SubPlanDisplayElement.Value : null; } + get => _SubPlanDisplayElement?.Value; set { - if (value == null) - SubPlanDisplayElement = null; - else - SubPlanDisplayElement = new Hl7.Fhir.Model.FhirString(value); + SubPlanDisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubPlanDisplay"); } } @@ -328,28 +307,25 @@ public string SubPlanDisplay /// [FhirElement("class", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ClassElement + public Hl7.Fhir.Model.FhirString? ClassElement { get { return _ClassElement; } set { _ClassElement = value; OnPropertyChanged("ClassElement"); } } - private Hl7.Fhir.Model.FhirString _ClassElement; + private Hl7.Fhir.Model.FhirString? _ClassElement; /// /// An identifier for the class /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Class + public string? Class { - get { return ClassElement != null ? ClassElement.Value : null; } + get => _ClassElement?.Value; set { - if (value == null) - ClassElement = null; - else - ClassElement = new Hl7.Fhir.Model.FhirString(value); + ClassElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Class"); } } @@ -359,28 +335,25 @@ public string Class /// [FhirElement("classDisplay", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString ClassDisplayElement + public Hl7.Fhir.Model.FhirString? ClassDisplayElement { get { return _ClassDisplayElement; } set { _ClassDisplayElement = value; OnPropertyChanged("ClassDisplayElement"); } } - private Hl7.Fhir.Model.FhirString _ClassDisplayElement; + private Hl7.Fhir.Model.FhirString? _ClassDisplayElement; /// /// Display text for the class /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClassDisplay + public string? ClassDisplay { - get { return ClassDisplayElement != null ? ClassDisplayElement.Value : null; } + get => _ClassDisplayElement?.Value; set { - if (value == null) - ClassDisplayElement = null; - else - ClassDisplayElement = new Hl7.Fhir.Model.FhirString(value); + ClassDisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ClassDisplay"); } } @@ -390,28 +363,25 @@ public string ClassDisplay /// [FhirElement("subClass", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubClassElement + public Hl7.Fhir.Model.FhirString? SubClassElement { get { return _SubClassElement; } set { _SubClassElement = value; OnPropertyChanged("SubClassElement"); } } - private Hl7.Fhir.Model.FhirString _SubClassElement; + private Hl7.Fhir.Model.FhirString? _SubClassElement; /// /// An identifier for the subsection of the class /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubClass + public string? SubClass { - get { return SubClassElement != null ? SubClassElement.Value : null; } + get => _SubClassElement?.Value; set { - if (value == null) - SubClassElement = null; - else - SubClassElement = new Hl7.Fhir.Model.FhirString(value); + SubClassElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubClass"); } } @@ -421,54 +391,47 @@ public string SubClass /// [FhirElement("subClassDisplay", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubClassDisplayElement + public Hl7.Fhir.Model.FhirString? SubClassDisplayElement { get { return _SubClassDisplayElement; } set { _SubClassDisplayElement = value; OnPropertyChanged("SubClassDisplayElement"); } } - private Hl7.Fhir.Model.FhirString _SubClassDisplayElement; + private Hl7.Fhir.Model.FhirString? _SubClassDisplayElement; /// /// Display text for the subsection of the subclass /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubClassDisplay + public string? SubClassDisplay { - get { return SubClassDisplayElement != null ? SubClassDisplayElement.Value : null; } + get => _SubClassDisplayElement?.Value; set { - if (value == null) - SubClassDisplayElement = null; - else - SubClassDisplayElement = new Hl7.Fhir.Model.FhirString(value); + SubClassDisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubClassDisplay"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(GroupElement != null) dest.GroupElement = (Hl7.Fhir.Model.FhirString)GroupElement.DeepCopyInternal(); - if(GroupDisplayElement != null) dest.GroupDisplayElement = (Hl7.Fhir.Model.FhirString)GroupDisplayElement.DeepCopyInternal(); - if(SubGroupElement != null) dest.SubGroupElement = (Hl7.Fhir.Model.FhirString)SubGroupElement.DeepCopyInternal(); - if(SubGroupDisplayElement != null) dest.SubGroupDisplayElement = (Hl7.Fhir.Model.FhirString)SubGroupDisplayElement.DeepCopyInternal(); - if(PlanElement != null) dest.PlanElement = (Hl7.Fhir.Model.FhirString)PlanElement.DeepCopyInternal(); - if(PlanDisplayElement != null) dest.PlanDisplayElement = (Hl7.Fhir.Model.FhirString)PlanDisplayElement.DeepCopyInternal(); - if(SubPlanElement != null) dest.SubPlanElement = (Hl7.Fhir.Model.FhirString)SubPlanElement.DeepCopyInternal(); - if(SubPlanDisplayElement != null) dest.SubPlanDisplayElement = (Hl7.Fhir.Model.FhirString)SubPlanDisplayElement.DeepCopyInternal(); - if(ClassElement != null) dest.ClassElement = (Hl7.Fhir.Model.FhirString)ClassElement.DeepCopyInternal(); - if(ClassDisplayElement != null) dest.ClassDisplayElement = (Hl7.Fhir.Model.FhirString)ClassDisplayElement.DeepCopyInternal(); - if(SubClassElement != null) dest.SubClassElement = (Hl7.Fhir.Model.FhirString)SubClassElement.DeepCopyInternal(); - if(SubClassDisplayElement != null) dest.SubClassDisplayElement = (Hl7.Fhir.Model.FhirString)SubClassDisplayElement.DeepCopyInternal(); + if(_GroupElement is not null) dest.GroupElement = (Hl7.Fhir.Model.FhirString)_GroupElement.DeepCopyInternal(); + if(_GroupDisplayElement is not null) dest.GroupDisplayElement = (Hl7.Fhir.Model.FhirString)_GroupDisplayElement.DeepCopyInternal(); + if(_SubGroupElement is not null) dest.SubGroupElement = (Hl7.Fhir.Model.FhirString)_SubGroupElement.DeepCopyInternal(); + if(_SubGroupDisplayElement is not null) dest.SubGroupDisplayElement = (Hl7.Fhir.Model.FhirString)_SubGroupDisplayElement.DeepCopyInternal(); + if(_PlanElement is not null) dest.PlanElement = (Hl7.Fhir.Model.FhirString)_PlanElement.DeepCopyInternal(); + if(_PlanDisplayElement is not null) dest.PlanDisplayElement = (Hl7.Fhir.Model.FhirString)_PlanDisplayElement.DeepCopyInternal(); + if(_SubPlanElement is not null) dest.SubPlanElement = (Hl7.Fhir.Model.FhirString)_SubPlanElement.DeepCopyInternal(); + if(_SubPlanDisplayElement is not null) dest.SubPlanDisplayElement = (Hl7.Fhir.Model.FhirString)_SubPlanDisplayElement.DeepCopyInternal(); + if(_ClassElement is not null) dest.ClassElement = (Hl7.Fhir.Model.FhirString)_ClassElement.DeepCopyInternal(); + if(_ClassDisplayElement is not null) dest.ClassDisplayElement = (Hl7.Fhir.Model.FhirString)_ClassDisplayElement.DeepCopyInternal(); + if(_SubClassElement is not null) dest.SubClassElement = (Hl7.Fhir.Model.FhirString)_SubClassElement.DeepCopyInternal(); + if(_SubClassDisplayElement is not null) dest.SubClassDisplayElement = (Hl7.Fhir.Model.FhirString)_SubClassDisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -480,111 +443,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(GroupElement, otherT.GroupElement)) return false; - if(!comparer.Equals(GroupDisplayElement, otherT.GroupDisplayElement)) return false; - if(!comparer.Equals(SubGroupElement, otherT.SubGroupElement)) return false; - if(!comparer.Equals(SubGroupDisplayElement, otherT.SubGroupDisplayElement)) return false; - if(!comparer.Equals(PlanElement, otherT.PlanElement)) return false; - if(!comparer.Equals(PlanDisplayElement, otherT.PlanDisplayElement)) return false; - if(!comparer.Equals(SubPlanElement, otherT.SubPlanElement)) return false; - if(!comparer.Equals(SubPlanDisplayElement, otherT.SubPlanDisplayElement)) return false; - if(!comparer.Equals(ClassElement, otherT.ClassElement)) return false; - if(!comparer.Equals(ClassDisplayElement, otherT.ClassDisplayElement)) return false; - if(!comparer.Equals(SubClassElement, otherT.SubClassElement)) return false; - if(!comparer.Equals(SubClassDisplayElement, otherT.SubClassDisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GroupElement, otherT._GroupElement)) return false; + if(!comparer.Equals(_GroupDisplayElement, otherT._GroupDisplayElement)) return false; + if(!comparer.Equals(_SubGroupElement, otherT._SubGroupElement)) return false; + if(!comparer.Equals(_SubGroupDisplayElement, otherT._SubGroupDisplayElement)) return false; + if(!comparer.Equals(_PlanElement, otherT._PlanElement)) return false; + if(!comparer.Equals(_PlanDisplayElement, otherT._PlanDisplayElement)) return false; + if(!comparer.Equals(_SubPlanElement, otherT._SubPlanElement)) return false; + if(!comparer.Equals(_SubPlanDisplayElement, otherT._SubPlanDisplayElement)) return false; + if(!comparer.Equals(_ClassElement, otherT._ClassElement)) return false; + if(!comparer.Equals(_ClassDisplayElement, otherT._ClassDisplayElement)) return false; + if(!comparer.Equals(_SubClassElement, otherT._SubClassElement)) return false; + if(!comparer.Equals(_SubClassDisplayElement, otherT._SubClassDisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "group": - value = GroupElement; - return GroupElement is not null; + value = _GroupElement; + return _GroupElement is not null; case "groupDisplay": - value = GroupDisplayElement; - return GroupDisplayElement is not null; + value = _GroupDisplayElement; + return _GroupDisplayElement is not null; case "subGroup": - value = SubGroupElement; - return SubGroupElement is not null; + value = _SubGroupElement; + return _SubGroupElement is not null; case "subGroupDisplay": - value = SubGroupDisplayElement; - return SubGroupDisplayElement is not null; + value = _SubGroupDisplayElement; + return _SubGroupDisplayElement is not null; case "plan": - value = PlanElement; - return PlanElement is not null; + value = _PlanElement; + return _PlanElement is not null; case "planDisplay": - value = PlanDisplayElement; - return PlanDisplayElement is not null; + value = _PlanDisplayElement; + return _PlanDisplayElement is not null; case "subPlan": - value = SubPlanElement; - return SubPlanElement is not null; + value = _SubPlanElement; + return _SubPlanElement is not null; case "subPlanDisplay": - value = SubPlanDisplayElement; - return SubPlanDisplayElement is not null; + value = _SubPlanDisplayElement; + return _SubPlanDisplayElement is not null; case "class": - value = ClassElement; - return ClassElement is not null; + value = _ClassElement; + return _ClassElement is not null; case "classDisplay": - value = ClassDisplayElement; - return ClassDisplayElement is not null; + value = _ClassDisplayElement; + return _ClassDisplayElement is not null; case "subClass": - value = SubClassElement; - return SubClassElement is not null; + value = _SubClassElement; + return _SubClassElement is not null; case "subClassDisplay": - value = SubClassDisplayElement; - return SubClassDisplayElement is not null; + value = _SubClassDisplayElement; + return _SubClassDisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "group": - GroupElement = (Hl7.Fhir.Model.FhirString)value; + GroupElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "groupDisplay": - GroupDisplayElement = (Hl7.Fhir.Model.FhirString)value; + GroupDisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subGroup": - SubGroupElement = (Hl7.Fhir.Model.FhirString)value; + SubGroupElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subGroupDisplay": - SubGroupDisplayElement = (Hl7.Fhir.Model.FhirString)value; + SubGroupDisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "plan": - PlanElement = (Hl7.Fhir.Model.FhirString)value; + PlanElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "planDisplay": - PlanDisplayElement = (Hl7.Fhir.Model.FhirString)value; + PlanDisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subPlan": - SubPlanElement = (Hl7.Fhir.Model.FhirString)value; + SubPlanElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subPlanDisplay": - SubPlanDisplayElement = (Hl7.Fhir.Model.FhirString)value; + SubPlanDisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "class": - ClassElement = (Hl7.Fhir.Model.FhirString)value; + ClassElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "classDisplay": - ClassDisplayElement = (Hl7.Fhir.Model.FhirString)value; + ClassDisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subClass": - SubClassElement = (Hl7.Fhir.Model.FhirString)value; + SubClassElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subClassDisplay": - SubClassDisplayElement = (Hl7.Fhir.Model.FhirString)value; + SubClassDisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -595,18 +558,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (GroupElement is not null) yield return new KeyValuePair("group",GroupElement); - if (GroupDisplayElement is not null) yield return new KeyValuePair("groupDisplay",GroupDisplayElement); - if (SubGroupElement is not null) yield return new KeyValuePair("subGroup",SubGroupElement); - if (SubGroupDisplayElement is not null) yield return new KeyValuePair("subGroupDisplay",SubGroupDisplayElement); - if (PlanElement is not null) yield return new KeyValuePair("plan",PlanElement); - if (PlanDisplayElement is not null) yield return new KeyValuePair("planDisplay",PlanDisplayElement); - if (SubPlanElement is not null) yield return new KeyValuePair("subPlan",SubPlanElement); - if (SubPlanDisplayElement is not null) yield return new KeyValuePair("subPlanDisplay",SubPlanDisplayElement); - if (ClassElement is not null) yield return new KeyValuePair("class",ClassElement); - if (ClassDisplayElement is not null) yield return new KeyValuePair("classDisplay",ClassDisplayElement); - if (SubClassElement is not null) yield return new KeyValuePair("subClass",SubClassElement); - if (SubClassDisplayElement is not null) yield return new KeyValuePair("subClassDisplay",SubClassDisplayElement); + if (_GroupElement is not null) yield return new KeyValuePair("group",_GroupElement); + if (_GroupDisplayElement is not null) yield return new KeyValuePair("groupDisplay",_GroupDisplayElement); + if (_SubGroupElement is not null) yield return new KeyValuePair("subGroup",_SubGroupElement); + if (_SubGroupDisplayElement is not null) yield return new KeyValuePair("subGroupDisplay",_SubGroupDisplayElement); + if (_PlanElement is not null) yield return new KeyValuePair("plan",_PlanElement); + if (_PlanDisplayElement is not null) yield return new KeyValuePair("planDisplay",_PlanDisplayElement); + if (_SubPlanElement is not null) yield return new KeyValuePair("subPlan",_SubPlanElement); + if (_SubPlanDisplayElement is not null) yield return new KeyValuePair("subPlanDisplay",_SubPlanDisplayElement); + if (_ClassElement is not null) yield return new KeyValuePair("class",_ClassElement); + if (_ClassDisplayElement is not null) yield return new KeyValuePair("classDisplay",_ClassDisplayElement); + if (_SubClassElement is not null) yield return new KeyValuePair("subClass",_SubClassElement); + if (_SubClassDisplayElement is not null) yield return new KeyValuePair("subClassDisplay",_SubClassDisplayElement); } } @@ -619,11 +582,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -632,13 +595,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("CoverageStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -647,13 +610,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -664,13 +624,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("type", InSummary=true, Order=110, FiveWs="class")] [Binding("CoverageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Owner of the policy. @@ -679,13 +639,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PolicyHolder + public Hl7.Fhir.Model.ResourceReference? PolicyHolder { get { return _PolicyHolder; } set { _PolicyHolder = value; OnPropertyChanged("PolicyHolder"); } } - private Hl7.Fhir.Model.ResourceReference _PolicyHolder; + private Hl7.Fhir.Model.ResourceReference? _PolicyHolder; /// /// Subscriber to the policy. @@ -694,41 +654,38 @@ public Hl7.Fhir.Model.ResourceReference PolicyHolder [CLSCompliant(false)] [References("Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subscriber + public Hl7.Fhir.Model.ResourceReference? Subscriber { get { return _Subscriber; } set { _Subscriber = value; OnPropertyChanged("Subscriber"); } } - private Hl7.Fhir.Model.ResourceReference _Subscriber; + private Hl7.Fhir.Model.ResourceReference? _Subscriber; /// /// ID assigned to the Subscriber. /// [FhirElement("subscriberId", InSummary=true, Order=140, FiveWs="who.focus")] [DataMember] - public Hl7.Fhir.Model.FhirString SubscriberIdElement + public Hl7.Fhir.Model.FhirString? SubscriberIdElement { get { return _SubscriberIdElement; } set { _SubscriberIdElement = value; OnPropertyChanged("SubscriberIdElement"); } } - private Hl7.Fhir.Model.FhirString _SubscriberIdElement; + private Hl7.Fhir.Model.FhirString? _SubscriberIdElement; /// /// ID assigned to the Subscriber /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubscriberId + public string? SubscriberId { - get { return SubscriberIdElement != null ? SubscriberIdElement.Value : null; } + get => _SubscriberIdElement?.Value; set { - if (value == null) - SubscriberIdElement = null; - else - SubscriberIdElement = new Hl7.Fhir.Model.FhirString(value); + SubscriberIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubscriberId"); } } @@ -740,13 +697,13 @@ public string SubscriberId [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Beneficiary + public Hl7.Fhir.Model.ResourceReference? Beneficiary { get { return _Beneficiary; } set { _Beneficiary = value; OnPropertyChanged("Beneficiary"); } } - private Hl7.Fhir.Model.ResourceReference _Beneficiary; + private Hl7.Fhir.Model.ResourceReference? _Beneficiary; /// /// Beneficiary relationship to the Subscriber. @@ -754,26 +711,26 @@ public Hl7.Fhir.Model.ResourceReference Beneficiary [FhirElement("relationship", Order=160)] [Binding("Relationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// Coverage start and end dates. /// [FhirElement("period", InSummary=true, Order=170, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Identifier for the plan or agreement issuer. @@ -785,52 +742,49 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Payor { - get { if(_Payor==null) _Payor = new List(); return _Payor; } + get => _Payor ?? new List(); set { _Payor = value; OnPropertyChanged("Payor"); } } - private List _Payor; + private List? _Payor; /// /// Additional coverage classifications. /// [FhirElement("grouping", Order=190)] [DataMember] - public Hl7.Fhir.Model.Coverage.GroupComponent Grouping + public Hl7.Fhir.Model.Coverage.GroupComponent? Grouping { get { return _Grouping; } set { _Grouping = value; OnPropertyChanged("Grouping"); } } - private Hl7.Fhir.Model.Coverage.GroupComponent _Grouping; + private Hl7.Fhir.Model.Coverage.GroupComponent? _Grouping; /// /// Dependent number. /// [FhirElement("dependent", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DependentElement + public Hl7.Fhir.Model.FhirString? DependentElement { get { return _DependentElement; } set { _DependentElement = value; OnPropertyChanged("DependentElement"); } } - private Hl7.Fhir.Model.FhirString _DependentElement; + private Hl7.Fhir.Model.FhirString? _DependentElement; /// /// Dependent number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Dependent + public string? Dependent { - get { return DependentElement != null ? DependentElement.Value : null; } + get => _DependentElement?.Value; set { - if (value == null) - DependentElement = null; - else - DependentElement = new Hl7.Fhir.Model.FhirString(value); + DependentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Dependent"); } } @@ -840,28 +794,25 @@ public string Dependent /// [FhirElement("sequence", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString SequenceElement + public Hl7.Fhir.Model.FhirString? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.FhirString _SequenceElement; + private Hl7.Fhir.Model.FhirString? _SequenceElement; /// /// The plan instance or sequence counter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sequence + public string? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.FhirString(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Sequence"); } } @@ -871,13 +822,13 @@ public string Sequence /// [FhirElement("order", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.PositiveInt OrderElement + public Hl7.Fhir.Model.PositiveInt? OrderElement { get { return _OrderElement; } set { _OrderElement = value; OnPropertyChanged("OrderElement"); } } - private Hl7.Fhir.Model.PositiveInt _OrderElement; + private Hl7.Fhir.Model.PositiveInt? _OrderElement; /// /// Relative order of the coverage @@ -886,13 +837,10 @@ public Hl7.Fhir.Model.PositiveInt OrderElement [IgnoreDataMember] public int? Order { - get { return OrderElement != null ? OrderElement.Value : null; } + get => _OrderElement?.Value; set { - if (value == null) - OrderElement = null; - else - OrderElement = new Hl7.Fhir.Model.PositiveInt(value); + OrderElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Order"); } } @@ -902,28 +850,25 @@ public int? Order /// [FhirElement("network", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString NetworkElement + public Hl7.Fhir.Model.FhirString? NetworkElement { get { return _NetworkElement; } set { _NetworkElement = value; OnPropertyChanged("NetworkElement"); } } - private Hl7.Fhir.Model.FhirString _NetworkElement; + private Hl7.Fhir.Model.FhirString? _NetworkElement; /// /// Insurer network /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Network + public string? Network { - get { return NetworkElement != null ? NetworkElement.Value : null; } + get => _NetworkElement?.Value; set { - if (value == null) - NetworkElement = null; - else - NetworkElement = new Hl7.Fhir.Model.FhirString(value); + NetworkElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Network"); } } @@ -938,40 +883,36 @@ public string Network [DataMember] public List Contract { - get { if(_Contract==null) _Contract = new List(); return _Contract; } + get => _Contract ?? new List(); set { _Contract = value; OnPropertyChanged("Contract"); } } - private List _Contract; + private List? _Contract; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Coverage; - - if (dest == null) - { + if(other is not Coverage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PolicyHolder != null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)PolicyHolder.DeepCopyInternal(); - if(Subscriber != null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)Subscriber.DeepCopyInternal(); - if(SubscriberIdElement != null) dest.SubscriberIdElement = (Hl7.Fhir.Model.FhirString)SubscriberIdElement.DeepCopyInternal(); - if(Beneficiary != null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)Beneficiary.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Payor.Any()) dest.Payor = new List(Payor.DeepCopyInternal()); - if(Grouping != null) dest.Grouping = (Hl7.Fhir.Model.Coverage.GroupComponent)Grouping.DeepCopyInternal(); - if(DependentElement != null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)DependentElement.DeepCopyInternal(); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)SequenceElement.DeepCopyInternal(); - if(OrderElement != null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)OrderElement.DeepCopyInternal(); - if(NetworkElement != null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)NetworkElement.DeepCopyInternal(); - if(Contract.Any()) dest.Contract = new List(Contract.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PolicyHolder is not null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)_PolicyHolder.DeepCopyInternal(); + if(_Subscriber is not null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)_Subscriber.DeepCopyInternal(); + if(_SubscriberIdElement is not null) dest.SubscriberIdElement = (Hl7.Fhir.Model.FhirString)_SubscriberIdElement.DeepCopyInternal(); + if(_Beneficiary is not null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)_Beneficiary.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Payor is not null) dest.Payor = new List(_Payor.DeepCopyInternal()); + if(_Grouping is not null) dest.Grouping = (Hl7.Fhir.Model.Coverage.GroupComponent)_Grouping.DeepCopyInternal(); + if(_DependentElement is not null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)_DependentElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)_SequenceElement.DeepCopyInternal(); + if(_OrderElement is not null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)_OrderElement.DeepCopyInternal(); + if(_NetworkElement is not null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)_NetworkElement.DeepCopyInternal(); + if(_Contract is not null) dest.Contract = new List(_Contract.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -983,139 +924,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Coverage; - if(otherT == null) return false; + if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PolicyHolder, otherT.PolicyHolder)) return false; - if(!comparer.Equals(Subscriber, otherT.Subscriber)) return false; - if(!comparer.Equals(SubscriberIdElement, otherT.SubscriberIdElement)) return false; - if(!comparer.Equals(Beneficiary, otherT.Beneficiary)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Payor, otherT.Payor)) return false; - if(!comparer.Equals(Grouping, otherT.Grouping)) return false; - if(!comparer.Equals(DependentElement, otherT.DependentElement)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(OrderElement, otherT.OrderElement)) return false; - if(!comparer.Equals(NetworkElement, otherT.NetworkElement)) return false; - if(!comparer.ListEquals(Contract, otherT.Contract)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PolicyHolder, otherT._PolicyHolder)) return false; + if(!comparer.Equals(_Subscriber, otherT._Subscriber)) return false; + if(!comparer.Equals(_SubscriberIdElement, otherT._SubscriberIdElement)) return false; + if(!comparer.Equals(_Beneficiary, otherT._Beneficiary)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Payor, otherT._Payor)) return false; + if(!comparer.Equals(_Grouping, otherT._Grouping)) return false; + if(!comparer.Equals(_DependentElement, otherT._DependentElement)) return false; + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_OrderElement, otherT._OrderElement)) return false; + if(!comparer.Equals(_NetworkElement, otherT._NetworkElement)) return false; + if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "policyHolder": - value = PolicyHolder; - return PolicyHolder is not null; + value = _PolicyHolder; + return _PolicyHolder is not null; case "subscriber": - value = Subscriber; - return Subscriber is not null; + value = _Subscriber; + return _Subscriber is not null; case "subscriberId": - value = SubscriberIdElement; - return SubscriberIdElement is not null; + value = _SubscriberIdElement; + return _SubscriberIdElement is not null; case "beneficiary": - value = Beneficiary; - return Beneficiary is not null; + value = _Beneficiary; + return _Beneficiary is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "payor": - value = Payor; - return Payor?.Any() == true; + value = _Payor; + return _Payor?.Any() == true; case "grouping": - value = Grouping; - return Grouping is not null; + value = _Grouping; + return _Grouping is not null; case "dependent": - value = DependentElement; - return DependentElement is not null; + value = _DependentElement; + return _DependentElement is not null; case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "order": - value = OrderElement; - return OrderElement is not null; + value = _OrderElement; + return _OrderElement is not null; case "network": - value = NetworkElement; - return NetworkElement is not null; + value = _NetworkElement; + return _NetworkElement is not null; case "contract": - value = Contract; - return Contract?.Any() == true; + value = _Contract; + return _Contract?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "policyHolder": - PolicyHolder = (Hl7.Fhir.Model.ResourceReference)value; + PolicyHolder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriber": - Subscriber = (Hl7.Fhir.Model.ResourceReference)value; + Subscriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriberId": - SubscriberIdElement = (Hl7.Fhir.Model.FhirString)value; + SubscriberIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "beneficiary": - Beneficiary = (Hl7.Fhir.Model.ResourceReference)value; + Beneficiary = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "payor": - Payor = (List)value; + Payor = (List?)value!; return this; case "grouping": - Grouping = (Hl7.Fhir.Model.Coverage.GroupComponent)value; + Grouping = (Hl7.Fhir.Model.Coverage.GroupComponent?)value; return this; case "dependent": - DependentElement = (Hl7.Fhir.Model.FhirString)value; + DependentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sequence": - SequenceElement = (Hl7.Fhir.Model.FhirString)value; + SequenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "order": - OrderElement = (Hl7.Fhir.Model.PositiveInt)value; + OrderElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "network": - NetworkElement = (Hl7.Fhir.Model.FhirString)value; + NetworkElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contract": - Contract = (List)value; + Contract = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1126,22 +1067,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PolicyHolder is not null) yield return new KeyValuePair("policyHolder",PolicyHolder); - if (Subscriber is not null) yield return new KeyValuePair("subscriber",Subscriber); - if (SubscriberIdElement is not null) yield return new KeyValuePair("subscriberId",SubscriberIdElement); - if (Beneficiary is not null) yield return new KeyValuePair("beneficiary",Beneficiary); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Payor?.Any() == true) yield return new KeyValuePair("payor",Payor); - if (Grouping is not null) yield return new KeyValuePair("grouping",Grouping); - if (DependentElement is not null) yield return new KeyValuePair("dependent",DependentElement); - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (OrderElement is not null) yield return new KeyValuePair("order",OrderElement); - if (NetworkElement is not null) yield return new KeyValuePair("network",NetworkElement); - if (Contract?.Any() == true) yield return new KeyValuePair("contract",Contract); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PolicyHolder is not null) yield return new KeyValuePair("policyHolder",_PolicyHolder); + if (_Subscriber is not null) yield return new KeyValuePair("subscriber",_Subscriber); + if (_SubscriberIdElement is not null) yield return new KeyValuePair("subscriberId",_SubscriberIdElement); + if (_Beneficiary is not null) yield return new KeyValuePair("beneficiary",_Beneficiary); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Payor?.Any() == true) yield return new KeyValuePair("payor",_Payor); + if (_Grouping is not null) yield return new KeyValuePair("grouping",_Grouping); + if (_DependentElement is not null) yield return new KeyValuePair("dependent",_DependentElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_OrderElement is not null) yield return new KeyValuePair("order",_OrderElement); + if (_NetworkElement is not null) yield return new KeyValuePair("network",_NetworkElement); + if (_Contract?.Any() == true) yield return new KeyValuePair("contract",_Contract); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs index d54e7c461..c78dc91bb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -128,28 +131,25 @@ public partial class MappingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identity", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentityElement + public Hl7.Fhir.Model.Id? IdentityElement { get { return _IdentityElement; } set { _IdentityElement = value; OnPropertyChanged("IdentityElement"); } } - private Hl7.Fhir.Model.Id _IdentityElement; + private Hl7.Fhir.Model.Id? _IdentityElement; /// /// Internal id when this mapping is used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identity + public string? Identity { - get { return IdentityElement != null ? IdentityElement.Value : null; } + get => _IdentityElement?.Value; set { - if (value == null) - IdentityElement = null; - else - IdentityElement = new Hl7.Fhir.Model.Id(value); + IdentityElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identity"); } } @@ -159,28 +159,25 @@ public string Identity /// [FhirElement("uri", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Identifies what this mapping refers to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -190,28 +187,25 @@ public string Uri /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Names what this mapping refers to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -221,46 +215,39 @@ public string Name /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Versions, issues, scope limitations, etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MappingComponent; - - if (dest == null) - { + if(other is not MappingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdentityElement != null) dest.IdentityElement = (Hl7.Fhir.Model.Id)IdentityElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_IdentityElement is not null) dest.IdentityElement = (Hl7.Fhir.Model.Id)_IdentityElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,55 +259,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MappingComponent; - if(otherT == null) return false; + if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentityElement, otherT.IdentityElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identity": - value = IdentityElement; - return IdentityElement is not null; + value = _IdentityElement; + return _IdentityElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identity": - IdentityElement = (Hl7.Fhir.Model.Id)value; + IdentityElement = (Hl7.Fhir.Model.Id?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -331,10 +318,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentityElement is not null) yield return new KeyValuePair("identity",IdentityElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_IdentityElement is not null) yield return new KeyValuePair("identity",_IdentityElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -344,28 +331,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this data element (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -378,39 +362,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the data element. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the data element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -423,13 +404,13 @@ public string Version [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -438,13 +419,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -454,13 +432,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=130, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -469,13 +447,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -485,28 +460,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -516,28 +488,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -547,28 +516,25 @@ public string Publisher /// [FhirElement("name", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this data element (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -578,28 +544,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this data element (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -612,11 +575,11 @@ public string Title [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Context the content is intended to support. @@ -626,11 +589,11 @@ public List Contact [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for data element (if applicable). @@ -641,39 +604,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -685,13 +645,13 @@ public string Copyright [DeclaredType(Type = typeof(Code))] [Binding("DataElementStringency")] [DataMember] - public Code StringencyElement + public Code? StringencyElement { get { return _StringencyElement; } set { _StringencyElement = value; OnPropertyChanged("StringencyElement"); } } - private Code _StringencyElement; + private Code? _StringencyElement; /// /// comparable | fully-specified | equivalent | convertable | scaleable | flexible @@ -700,13 +660,10 @@ public Code StringencyElement [IgnoreDataMember] public Hl7.Fhir.Model.DataElement.DataElementStringency? Stringency { - get { return StringencyElement != null ? StringencyElement.Value : null; } + get => _StringencyElement?.Value; set { - if (value == null) - StringencyElement = null; - else - StringencyElement = new Code(value); + StringencyElement = value is null ? null : new Code(value); OnPropertyChanged("Stringency"); } } @@ -719,11 +676,11 @@ public Hl7.Fhir.Model.DataElement.DataElementStringency? Stringency [DataMember] public List Mapping { - get { if(_Mapping==null) _Mapping = new List(); return _Mapping; } + get => _Mapping ?? new List(); set { _Mapping = value; OnPropertyChanged("Mapping"); } } - private List _Mapping; + private List? _Mapping; /// /// Definition of element. @@ -733,40 +690,36 @@ public List Mapping [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DataElement; - - if (dest == null) - { + if(other is not DataElement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(StringencyElement != null) dest.StringencyElement = (Code)StringencyElement.DeepCopyInternal(); - if(Mapping.Any()) dest.Mapping = new List(Mapping.DeepCopyInternal()); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_StringencyElement is not null) dest.StringencyElement = (Code)_StringencyElement.DeepCopyInternal(); + if(_Mapping is not null) dest.Mapping = new List(_Mapping.DeepCopyInternal()); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -778,139 +731,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataElement; - if(otherT == null) return false; + if(other is not DataElement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(StringencyElement, otherT.StringencyElement)) return false; - if(!comparer.ListEquals(Mapping, otherT.Mapping)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_StringencyElement, otherT._StringencyElement)) return false; + if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; + if(!comparer.ListEquals(_Element, otherT._Element)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "stringency": - value = StringencyElement; - return StringencyElement is not null; + value = _StringencyElement; + return _StringencyElement is not null; case "mapping": - value = Mapping; - return Mapping?.Any() == true; + value = _Mapping; + return _Mapping?.Any() == true; case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "stringency": - StringencyElement = (Code)value; + StringencyElement = (Code?)value; return this; case "mapping": - Mapping = (List)value; + Mapping = (List?)value!; return this; case "element": - Element = (List)value; + Element = (List?)value!; return this; default: return base.SetValue(key, value); @@ -921,22 +874,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (StringencyElement is not null) yield return new KeyValuePair("stringency",StringencyElement); - if (Mapping?.Any() == true) yield return new KeyValuePair("mapping",Mapping); - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_StringencyElement is not null) yield return new KeyValuePair("stringency",_StringencyElement); + if (_Mapping?.Any() == true) yield return new KeyValuePair("mapping",_Mapping); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs index 47f8c0dba..d02ddcb37 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,28 +84,25 @@ public partial class CodeFilterComponent : Hl7.Fhir.Model.Element [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The code-valued attribute of the filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -115,13 +115,13 @@ public string Path [References("ValueSet")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType ValueSet + public Hl7.Fhir.Model.DataType? ValueSet { get { return _ValueSet; } set { _ValueSet = value; OnPropertyChanged("ValueSet"); } } - private Hl7.Fhir.Model.DataType _ValueSet; + private Hl7.Fhir.Model.DataType? _ValueSet; /// /// What code is expected. @@ -131,24 +131,24 @@ public Hl7.Fhir.Model.DataType ValueSet [DataMember] public List ValueCodeElement { - get { if(_ValueCodeElement==null) _ValueCodeElement = new List(); return _ValueCodeElement; } + get => _ValueCodeElement ?? new List(); set { _ValueCodeElement = value; OnPropertyChanged("ValueCodeElement"); } } - private List _ValueCodeElement; + private List? _ValueCodeElement; /// /// What code is expected /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ValueCode + public IEnumerable? ValueCode { - get { return ValueCodeElement != null ? ValueCodeElement.Select(elem => elem.Value) : null; } + get => _ValueCodeElement?.Select(elem => elem.Value); set { if (value == null) - ValueCodeElement = null; + ValueCodeElement = null!; else ValueCodeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("ValueCode"); @@ -163,11 +163,11 @@ public IEnumerable ValueCode [DataMember] public List ValueCoding { - get { if(_ValueCoding==null) _ValueCoding = new List(); return _ValueCoding; } + get => _ValueCoding ?? new List(); set { _ValueCoding = value; OnPropertyChanged("ValueCoding"); } } - private List _ValueCoding; + private List? _ValueCoding; /// /// What CodeableConcept is expected. @@ -177,27 +177,23 @@ public List ValueCoding [DataMember] public List ValueCodeableConcept { - get { if(_ValueCodeableConcept==null) _ValueCodeableConcept = new List(); return _ValueCodeableConcept; } + get => _ValueCodeableConcept ?? new List(); set { _ValueCodeableConcept = value; OnPropertyChanged("ValueCodeableConcept"); } } - private List _ValueCodeableConcept; + private List? _ValueCodeableConcept; protected internal override void CopyToInternal(Base other) { - var dest = other as CodeFilterComponent; - - if (dest == null) - { + if(other is not CodeFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(ValueSet != null) dest.ValueSet = (Hl7.Fhir.Model.DataType)ValueSet.DeepCopyInternal(); - if(ValueCodeElement.Any()) dest.ValueCodeElement = new List(ValueCodeElement.DeepCopyInternal()); - if(ValueCoding.Any()) dest.ValueCoding = new List(ValueCoding.DeepCopyInternal()); - if(ValueCodeableConcept.Any()) dest.ValueCodeableConcept = new List(ValueCodeableConcept.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_ValueSet is not null) dest.ValueSet = (Hl7.Fhir.Model.DataType)_ValueSet.DeepCopyInternal(); + if(_ValueCodeElement is not null) dest.ValueCodeElement = new List(_ValueCodeElement.DeepCopyInternal()); + if(_ValueCoding is not null) dest.ValueCoding = new List(_ValueCoding.DeepCopyInternal()); + if(_ValueCodeableConcept is not null) dest.ValueCodeableConcept = new List(_ValueCodeableConcept.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -209,62 +205,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeFilterComponent; - if(otherT == null) return false; + if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(ValueSet, otherT.ValueSet)) return false; - if(!comparer.ListEquals(ValueCodeElement, otherT.ValueCodeElement)) return false; - if(!comparer.ListEquals(ValueCoding, otherT.ValueCoding)) return false; - if(!comparer.ListEquals(ValueCodeableConcept, otherT.ValueCodeableConcept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_ValueSet, otherT._ValueSet)) return false; + if(!comparer.ListEquals(_ValueCodeElement, otherT._ValueCodeElement)) return false; + if(!comparer.ListEquals(_ValueCoding, otherT._ValueCoding)) return false; + if(!comparer.ListEquals(_ValueCodeableConcept, otherT._ValueCodeableConcept)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "valueSet": - value = ValueSet; - return ValueSet is not null; + value = _ValueSet; + return _ValueSet is not null; case "valueCode": - value = ValueCodeElement; - return ValueCodeElement?.Any() == true; + value = _ValueCodeElement; + return _ValueCodeElement?.Any() == true; case "valueCoding": - value = ValueCoding; - return ValueCoding?.Any() == true; + value = _ValueCoding; + return _ValueCoding?.Any() == true; case "valueCodeableConcept": - value = ValueCodeableConcept; - return ValueCodeableConcept?.Any() == true; + value = _ValueCodeableConcept; + return _ValueCodeableConcept?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSet = (Hl7.Fhir.Model.DataType)value; + ValueSet = (Hl7.Fhir.Model.DataType?)value; return this; case "valueCode": - ValueCodeElement = (List)value; + ValueCodeElement = (List?)value!; return this; case "valueCoding": - ValueCoding = (List)value; + ValueCoding = (List?)value!; return this; case "valueCodeableConcept": - ValueCodeableConcept = (List)value; + ValueCodeableConcept = (List?)value!; return this; default: return base.SetValue(key, value); @@ -275,11 +271,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (ValueSet is not null) yield return new KeyValuePair("valueSet",ValueSet); - if (ValueCodeElement?.Any() == true) yield return new KeyValuePair("valueCode",ValueCodeElement); - if (ValueCoding?.Any() == true) yield return new KeyValuePair("valueCoding",ValueCoding); - if (ValueCodeableConcept?.Any() == true) yield return new KeyValuePair("valueCodeableConcept",ValueCodeableConcept); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_ValueSet is not null) yield return new KeyValuePair("valueSet",_ValueSet); + if (_ValueCodeElement?.Any() == true) yield return new KeyValuePair("valueCode",_ValueCodeElement); + if (_ValueCoding?.Any() == true) yield return new KeyValuePair("valueCoding",_ValueCoding); + if (_ValueCodeableConcept?.Any() == true) yield return new KeyValuePair("valueCodeableConcept",_ValueCodeableConcept); } } @@ -306,28 +302,25 @@ public partial class DateFilterComponent : Hl7.Fhir.Model.Element [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The date-valued attribute of the filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -339,26 +332,22 @@ public string Path [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DateFilterComponent; - - if (dest == null) - { + if(other is not DateFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -370,41 +359,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateFilterComponent; - if(otherT == null) return false; + if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -415,8 +404,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -429,13 +418,13 @@ public override IEnumerable> EnumerateElements() [Binding("FHIRAllTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// The type of the required data @@ -444,13 +433,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -463,24 +449,24 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// The profile of the required data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Profile"); @@ -495,24 +481,24 @@ public IEnumerable Profile [DataMember] public List MustSupportElement { - get { if(_MustSupportElement==null) _MustSupportElement = new List(); return _MustSupportElement; } + get => _MustSupportElement ?? new List(); set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } - private List _MustSupportElement; + private List? _MustSupportElement; /// /// Indicates that specific structure elements are referenced by the knowledge module /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable MustSupport + public IEnumerable? MustSupport { - get { return MustSupportElement != null ? MustSupportElement.Select(elem => elem.Value) : null; } + get => _MustSupportElement?.Select(elem => elem.Value); set { if (value == null) - MustSupportElement = null; + MustSupportElement = null!; else MustSupportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("MustSupport"); @@ -527,11 +513,11 @@ public IEnumerable MustSupport [DataMember] public List CodeFilter { - get { if(_CodeFilter==null) _CodeFilter = new List(); return _CodeFilter; } + get => _CodeFilter ?? new List(); set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } - private List _CodeFilter; + private List? _CodeFilter; /// /// What dates/date ranges are expected. @@ -541,27 +527,23 @@ public List CodeFilter [DataMember] public List DateFilter { - get { if(_DateFilter==null) _DateFilter = new List(); return _DateFilter; } + get => _DateFilter ?? new List(); set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } - private List _DateFilter; + private List? _DateFilter; protected internal override void CopyToInternal(Base other) { - var dest = other as DataRequirement; - - if (dest == null) - { + if(other is not DataRequirement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(MustSupportElement.Any()) dest.MustSupportElement = new List(MustSupportElement.DeepCopyInternal()); - if(CodeFilter.Any()) dest.CodeFilter = new List(CodeFilter.DeepCopyInternal()); - if(DateFilter.Any()) dest.DateFilter = new List(DateFilter.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_MustSupportElement is not null) dest.MustSupportElement = new List(_MustSupportElement.DeepCopyInternal()); + if(_CodeFilter is not null) dest.CodeFilter = new List(_CodeFilter.DeepCopyInternal()); + if(_DateFilter is not null) dest.DateFilter = new List(_DateFilter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -573,62 +555,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataRequirement; - if(otherT == null) return false; + if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(MustSupportElement, otherT.MustSupportElement)) return false; - if(!comparer.ListEquals(CodeFilter, otherT.CodeFilter)) return false; - if(!comparer.ListEquals(DateFilter, otherT.DateFilter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; + if(!comparer.ListEquals(_CodeFilter, otherT._CodeFilter)) return false; + if(!comparer.ListEquals(_DateFilter, otherT._DateFilter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "mustSupport": - value = MustSupportElement; - return MustSupportElement?.Any() == true; + value = _MustSupportElement; + return _MustSupportElement?.Any() == true; case "codeFilter": - value = CodeFilter; - return CodeFilter?.Any() == true; + value = _CodeFilter; + return _CodeFilter?.Any() == true; case "dateFilter": - value = DateFilter; - return DateFilter?.Any() == true; + value = _DateFilter; + return _DateFilter?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "mustSupport": - MustSupportElement = (List)value; + MustSupportElement = (List?)value!; return this; case "codeFilter": - CodeFilter = (List)value; + CodeFilter = (List?)value!; return this; case "dateFilter": - DateFilter = (List)value; + DateFilter = (List?)value!; return this; default: return base.SetValue(key, value); @@ -639,11 +621,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",MustSupportElement); - if (CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",CodeFilter); - if (DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",DateFilter); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",_MustSupportElement); + if (_CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",_CodeFilter); + if (_DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",_DateFilter); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs index 5e780a642..47ec61452 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,41 +113,38 @@ public partial class MitigationComponent : Hl7.Fhir.Model.BackboneElement [Binding("DetectedIssueMitigationAction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Date committed. /// [FhirElement("date", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date committed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -156,27 +156,23 @@ public string Date [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; protected internal override void CopyToInternal(Base other) { - var dest = other as MitigationComponent; - - if (dest == null) - { + if(other is not MitigationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -188,48 +184,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MitigationComponent; - if(otherT == null) return false; + if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -240,9 +236,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } @@ -252,13 +248,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// registered | preliminary | final | amended +. @@ -268,13 +264,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("DetectedIssueStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -283,13 +279,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -300,13 +293,13 @@ public Hl7.Fhir.Model.ObservationStatus? Status [FhirElement("category", InSummary=true, Order=110, FiveWs="class")] [Binding("DetectedIssueCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// high | moderate | low. @@ -315,13 +308,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [DeclaredType(Type = typeof(Code))] [Binding("DetectedIssueSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// high | moderate | low @@ -330,13 +323,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -348,41 +338,38 @@ public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When identified. /// [FhirElement("date", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When identified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -394,13 +381,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Problem resource. @@ -412,39 +399,36 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Implicated { - get { if(_Implicated==null) _Implicated = new List(); return _Implicated; } + get => _Implicated ?? new List(); set { _Implicated = value; OnPropertyChanged("Implicated"); } } - private List _Implicated; + private List? _Implicated; /// /// Description and context. /// [FhirElement("detail", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString DetailElement + public Hl7.Fhir.Model.FhirString? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirString _DetailElement; + private Hl7.Fhir.Model.FhirString? _DetailElement; /// /// Description and context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirString(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Detail"); } } @@ -454,28 +438,25 @@ public string Detail /// [FhirElement("reference", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Authority for issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } @@ -488,35 +469,31 @@ public string Reference [DataMember] public List Mitigation { - get { if(_Mitigation==null) _Mitigation = new List(); return _Mitigation; } + get => _Mitigation ?? new List(); set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } - private List _Mitigation; + private List? _Mitigation; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DetectedIssue; - - if (dest == null) - { + if(other is not DetectedIssue dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Implicated.Any()) dest.Implicated = new List(Implicated.DeepCopyInternal()); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); - if(Mitigation.Any()) dest.Mitigation = new List(Mitigation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Implicated is not null) dest.Implicated = new List(_Implicated.DeepCopyInternal()); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)_DetailElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); + if(_Mitigation is not null) dest.Mitigation = new List(_Mitigation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -528,104 +505,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetectedIssue; - if(otherT == null) return false; + if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Implicated, otherT.Implicated)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(Mitigation, otherT.Mitigation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Implicated, otherT._Implicated)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "implicated": - value = Implicated; - return Implicated?.Any() == true; + value = _Implicated; + return _Implicated?.Any() == true; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "mitigation": - value = Mitigation; - return Mitigation?.Any() == true; + value = _Mitigation; + return _Mitigation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "implicated": - Implicated = (List)value; + Implicated = (List?)value!; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirString)value; + DetailElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "mitigation": - Mitigation = (List)value; + Mitigation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -636,17 +613,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Implicated?.Any() == true) yield return new KeyValuePair("implicated",Implicated); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",Mitigation); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Implicated?.Any() == true) yield return new KeyValuePair("implicated",_Implicated); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",_Mitigation); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Device.cs b/src/Hl7.Fhir.STU3/Model/Generated/Device.cs index a257abfe5..d93ab7c11 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Device.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -161,28 +164,25 @@ public partial class UdiComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("deviceIdentifier", InSummary=true, Order=40, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// Mandatory fixed portion of UDI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -192,28 +192,25 @@ public string DeviceIdentifier /// [FhirElement("name", InSummary=true, Order=50, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Device Name as appears on UDI label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -223,28 +220,25 @@ public string Name /// [FhirElement("jurisdiction", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// Regional UDI authority /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } @@ -254,28 +248,25 @@ public string Jurisdiction /// [FhirElement("carrierHRF", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CarrierHRFElement + public Hl7.Fhir.Model.FhirString? CarrierHRFElement { get { return _CarrierHRFElement; } set { _CarrierHRFElement = value; OnPropertyChanged("CarrierHRFElement"); } } - private Hl7.Fhir.Model.FhirString _CarrierHRFElement; + private Hl7.Fhir.Model.FhirString? _CarrierHRFElement; /// /// UDI Human Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CarrierHRF + public string? CarrierHRF { - get { return CarrierHRFElement != null ? CarrierHRFElement.Value : null; } + get => _CarrierHRFElement?.Value; set { - if (value == null) - CarrierHRFElement = null; - else - CarrierHRFElement = new Hl7.Fhir.Model.FhirString(value); + CarrierHRFElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CarrierHRF"); } } @@ -285,28 +276,25 @@ public string CarrierHRF /// [FhirElement("carrierAIDC", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Base64Binary CarrierAIDCElement + public Hl7.Fhir.Model.Base64Binary? CarrierAIDCElement { get { return _CarrierAIDCElement; } set { _CarrierAIDCElement = value; OnPropertyChanged("CarrierAIDCElement"); } } - private Hl7.Fhir.Model.Base64Binary _CarrierAIDCElement; + private Hl7.Fhir.Model.Base64Binary? _CarrierAIDCElement; /// /// UDI Machine Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] CarrierAIDC + public byte[]? CarrierAIDC { - get { return CarrierAIDCElement != null ? CarrierAIDCElement.Value : null; } + get => _CarrierAIDCElement?.Value; set { - if (value == null) - CarrierAIDCElement = null; - else - CarrierAIDCElement = new Hl7.Fhir.Model.Base64Binary(value); + CarrierAIDCElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("CarrierAIDC"); } } @@ -316,28 +304,25 @@ public byte[] CarrierAIDC /// [FhirElement("issuer", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// UDI Issuing Organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -349,13 +334,13 @@ public string Issuer [DeclaredType(Type = typeof(Code))] [Binding("UDIEntryType")] [DataMember] - public Code EntryTypeElement + public Code? EntryTypeElement { get { return _EntryTypeElement; } set { _EntryTypeElement = value; OnPropertyChanged("EntryTypeElement"); } } - private Code _EntryTypeElement; + private Code? _EntryTypeElement; /// /// barcode | rfid | manual + @@ -364,34 +349,27 @@ public Code EntryTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.UDIEntryType? EntryType { - get { return EntryTypeElement != null ? EntryTypeElement.Value : null; } + get => _EntryTypeElement?.Value; set { - if (value == null) - EntryTypeElement = null; - else - EntryTypeElement = new Code(value); + EntryTypeElement = value is null ? null : new Code(value); OnPropertyChanged("EntryType"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UdiComponent; - - if (dest == null) - { + if(other is not UdiComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); - if(CarrierHRFElement != null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)CarrierHRFElement.DeepCopyInternal(); - if(CarrierAIDCElement != null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)CarrierAIDCElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(EntryTypeElement != null) dest.EntryTypeElement = (Code)EntryTypeElement.DeepCopyInternal(); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); + if(_CarrierHRFElement is not null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)_CarrierHRFElement.DeepCopyInternal(); + if(_CarrierAIDCElement is not null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)_CarrierAIDCElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_EntryTypeElement is not null) dest.EntryTypeElement = (Code)_EntryTypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -403,76 +381,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiComponent; - if(otherT == null) return false; + if(other is not UdiComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; - if(!comparer.Equals(CarrierHRFElement, otherT.CarrierHRFElement)) return false; - if(!comparer.Equals(CarrierAIDCElement, otherT.CarrierAIDCElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(EntryTypeElement, otherT.EntryTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; + if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; + if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; case "carrierHRF": - value = CarrierHRFElement; - return CarrierHRFElement is not null; + value = _CarrierHRFElement; + return _CarrierHRFElement is not null; case "carrierAIDC": - value = CarrierAIDCElement; - return CarrierAIDCElement is not null; + value = _CarrierAIDCElement; + return _CarrierAIDCElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "entryType": - value = EntryTypeElement; - return EntryTypeElement is not null; + value = _EntryTypeElement; + return _EntryTypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "carrierHRF": - CarrierHRFElement = (Hl7.Fhir.Model.FhirString)value; + CarrierHRFElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "carrierAIDC": - CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)value; + CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "entryType": - EntryTypeElement = (Code)value; + EntryTypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -483,13 +461,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); - if (CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",CarrierHRFElement); - if (CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",CarrierAIDCElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (EntryTypeElement is not null) yield return new KeyValuePair("entryType",EntryTypeElement); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); + if (_CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",_CarrierHRFElement); + if (_CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",_CarrierAIDCElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_EntryTypeElement is not null) yield return new KeyValuePair("entryType",_EntryTypeElement); } } @@ -502,24 +480,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Unique Device Identifier (UDI) Barcode string. /// [FhirElement("udi", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Device.UdiComponent Udi + public Hl7.Fhir.Model.Device.UdiComponent? Udi { get { return _Udi; } set { _Udi = value; OnPropertyChanged("Udi"); } } - private Hl7.Fhir.Model.Device.UdiComponent _Udi; + private Hl7.Fhir.Model.Device.UdiComponent? _Udi; /// /// active | inactive | entered-in-error | unknown. @@ -528,13 +506,13 @@ public Hl7.Fhir.Model.Device.UdiComponent Udi [DeclaredType(Type = typeof(Code))] [Binding("FHIRDeviceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error | unknown @@ -543,13 +521,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -560,41 +535,38 @@ public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status [FhirElement("type", Order=120, FiveWs="what")] [Binding("DeviceKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Lot number of manufacture. /// [FhirElement("lotNumber", Order=130, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Lot number of manufacture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -604,28 +576,25 @@ public string LotNumber /// [FhirElement("manufacturer", Order=140, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString ManufacturerElement + public Hl7.Fhir.Model.FhirString? ManufacturerElement { get { return _ManufacturerElement; } set { _ManufacturerElement = value; OnPropertyChanged("ManufacturerElement"); } } - private Hl7.Fhir.Model.FhirString _ManufacturerElement; + private Hl7.Fhir.Model.FhirString? _ManufacturerElement; /// /// Name of device manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Manufacturer + public string? Manufacturer { - get { return ManufacturerElement != null ? ManufacturerElement.Value : null; } + get => _ManufacturerElement?.Value; set { - if (value == null) - ManufacturerElement = null; - else - ManufacturerElement = new Hl7.Fhir.Model.FhirString(value); + ManufacturerElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Manufacturer"); } } @@ -635,28 +604,25 @@ public string Manufacturer /// [FhirElement("manufactureDate", Order=150, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ManufactureDateElement + public Hl7.Fhir.Model.FhirDateTime? ManufactureDateElement { get { return _ManufactureDateElement; } set { _ManufactureDateElement = value; OnPropertyChanged("ManufactureDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ManufactureDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ManufactureDateElement; /// /// Date when the device was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ManufactureDate + public string? ManufactureDate { - get { return ManufactureDateElement != null ? ManufactureDateElement.Value : null; } + get => _ManufactureDateElement?.Value; set { - if (value == null) - ManufactureDateElement = null; - else - ManufactureDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ManufactureDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ManufactureDate"); } } @@ -666,28 +632,25 @@ public string ManufactureDate /// [FhirElement("expirationDate", Order=160, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// Date and time of expiry of this device (if applicable) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } @@ -697,28 +660,25 @@ public string ExpirationDate /// [FhirElement("model", Order=170, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString ModelElement + public Hl7.Fhir.Model.FhirString? ModelElement { get { return _ModelElement; } set { _ModelElement = value; OnPropertyChanged("ModelElement"); } } - private Hl7.Fhir.Model.FhirString _ModelElement; + private Hl7.Fhir.Model.FhirString? _ModelElement; /// /// Model id assigned by the manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Model + public string? Model { - get { return ModelElement != null ? ModelElement.Value : null; } + get => _ModelElement?.Value; set { - if (value == null) - ModelElement = null; - else - ModelElement = new Hl7.Fhir.Model.FhirString(value); + ModelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Model"); } } @@ -728,28 +688,25 @@ public string Model /// [FhirElement("version", Order=180, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version number (i.e. software) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -761,13 +718,13 @@ public string Version [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Organization responsible for device. @@ -776,13 +733,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Details for human/organization for support. @@ -792,11 +749,11 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Where the resource is found. @@ -805,41 +762,38 @@ public List Contact [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Network address to contact device. /// [FhirElement("url", Order=230, FiveWs="where")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Network address to contact device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -852,11 +806,11 @@ public string Url [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Safety Characteristics of Device. @@ -867,41 +821,37 @@ public List Note [DataMember] public List Safety { - get { if(_Safety==null) _Safety = new List(); return _Safety; } + get => _Safety ?? new List(); set { _Safety = value; OnPropertyChanged("Safety"); } } - private List _Safety; + private List? _Safety; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Device; - - if (dest == null) - { + if(other is not Device dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Udi != null) dest.Udi = (Hl7.Fhir.Model.Device.UdiComponent)Udi.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ManufacturerElement != null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)ManufacturerElement.DeepCopyInternal(); - if(ManufactureDateElement != null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)ManufactureDateElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); - if(ModelElement != null) dest.ModelElement = (Hl7.Fhir.Model.FhirString)ModelElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Safety.Any()) dest.Safety = new List(Safety.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Udi is not null) dest.Udi = (Hl7.Fhir.Model.Device.UdiComponent)_Udi.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ManufacturerElement is not null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)_ManufacturerElement.DeepCopyInternal(); + if(_ManufactureDateElement is not null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)_ManufactureDateElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); + if(_ModelElement is not null) dest.ModelElement = (Hl7.Fhir.Model.FhirString)_ModelElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Safety is not null) dest.Safety = new List(_Safety.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -913,146 +863,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Device; - if(otherT == null) return false; + if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Udi, otherT.Udi)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ManufacturerElement, otherT.ManufacturerElement)) return false; - if(!comparer.Equals(ManufactureDateElement, otherT.ManufactureDateElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(ModelElement, otherT.ModelElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Safety, otherT.Safety)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Udi, otherT._Udi)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ManufacturerElement, otherT._ManufacturerElement)) return false; + if(!comparer.Equals(_ManufactureDateElement, otherT._ManufactureDateElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_ModelElement, otherT._ModelElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "udi": - value = Udi; - return Udi is not null; + value = _Udi; + return _Udi is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "manufacturer": - value = ManufacturerElement; - return ManufacturerElement is not null; + value = _ManufacturerElement; + return _ManufacturerElement is not null; case "manufactureDate": - value = ManufactureDateElement; - return ManufactureDateElement is not null; + value = _ManufactureDateElement; + return _ManufactureDateElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "model": - value = ModelElement; - return ModelElement is not null; + value = _ModelElement; + return _ModelElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "safety": - value = Safety; - return Safety?.Any() == true; + value = _Safety; + return _Safety?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "udi": - Udi = (Hl7.Fhir.Model.Device.UdiComponent)value; + Udi = (Hl7.Fhir.Model.Device.UdiComponent?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufacturer": - ManufacturerElement = (Hl7.Fhir.Model.FhirString)value; + ManufacturerElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufactureDate": - ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "model": - ModelElement = (Hl7.Fhir.Model.FhirString)value; + ModelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "safety": - Safety = (List)value; + Safety = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1063,23 +1013,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Udi is not null) yield return new KeyValuePair("udi",Udi); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",ManufacturerElement); - if (ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",ManufactureDateElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (ModelElement is not null) yield return new KeyValuePair("model",ModelElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Safety?.Any() == true) yield return new KeyValuePair("safety",Safety); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Udi is not null) yield return new KeyValuePair("udi",_Udi); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",_ManufacturerElement); + if (_ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",_ManufactureDateElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_ModelElement is not null) yield return new KeyValuePair("model",_ModelElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Safety?.Any() == true) yield return new KeyValuePair("safety",_Safety); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs index 8b563ee4f..f95269f1a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -158,71 +161,64 @@ public partial class ProductionSpecificationComponent : Hl7.Fhir.Model.BackboneE [FhirElement("specType", InSummary=true, Order=40)] [Binding("DeviceSpecificationSpecType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SpecType + public Hl7.Fhir.Model.CodeableConcept? SpecType { get { return _SpecType; } set { _SpecType = value; OnPropertyChanged("SpecType"); } } - private Hl7.Fhir.Model.CodeableConcept _SpecType; + private Hl7.Fhir.Model.CodeableConcept? _SpecType; /// /// Internal component unique identification. /// [FhirElement("componentId", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier ComponentId + public Hl7.Fhir.Model.Identifier? ComponentId { get { return _ComponentId; } set { _ComponentId = value; OnPropertyChanged("ComponentId"); } } - private Hl7.Fhir.Model.Identifier _ComponentId; + private Hl7.Fhir.Model.Identifier? _ComponentId; /// /// A printable string defining the component. /// [FhirElement("productionSpec", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductionSpecElement + public Hl7.Fhir.Model.FhirString? ProductionSpecElement { get { return _ProductionSpecElement; } set { _ProductionSpecElement = value; OnPropertyChanged("ProductionSpecElement"); } } - private Hl7.Fhir.Model.FhirString _ProductionSpecElement; + private Hl7.Fhir.Model.FhirString? _ProductionSpecElement; /// /// A printable string defining the component /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductionSpec + public string? ProductionSpec { - get { return ProductionSpecElement != null ? ProductionSpecElement.Value : null; } + get => _ProductionSpecElement?.Value; set { - if (value == null) - ProductionSpecElement = null; - else - ProductionSpecElement = new Hl7.Fhir.Model.FhirString(value); + ProductionSpecElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductionSpec"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ProductionSpecificationComponent; - - if (dest == null) - { + if(other is not ProductionSpecificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SpecType != null) dest.SpecType = (Hl7.Fhir.Model.CodeableConcept)SpecType.DeepCopyInternal(); - if(ComponentId != null) dest.ComponentId = (Hl7.Fhir.Model.Identifier)ComponentId.DeepCopyInternal(); - if(ProductionSpecElement != null) dest.ProductionSpecElement = (Hl7.Fhir.Model.FhirString)ProductionSpecElement.DeepCopyInternal(); + if(_SpecType is not null) dest.SpecType = (Hl7.Fhir.Model.CodeableConcept)_SpecType.DeepCopyInternal(); + if(_ComponentId is not null) dest.ComponentId = (Hl7.Fhir.Model.Identifier)_ComponentId.DeepCopyInternal(); + if(_ProductionSpecElement is not null) dest.ProductionSpecElement = (Hl7.Fhir.Model.FhirString)_ProductionSpecElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -234,48 +230,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProductionSpecificationComponent; - if(otherT == null) return false; + if(other is not ProductionSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SpecType, otherT.SpecType)) return false; - if(!comparer.Equals(ComponentId, otherT.ComponentId)) return false; - if(!comparer.Equals(ProductionSpecElement, otherT.ProductionSpecElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SpecType, otherT._SpecType)) return false; + if(!comparer.Equals(_ComponentId, otherT._ComponentId)) return false; + if(!comparer.Equals(_ProductionSpecElement, otherT._ProductionSpecElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "specType": - value = SpecType; - return SpecType is not null; + value = _SpecType; + return _SpecType is not null; case "componentId": - value = ComponentId; - return ComponentId is not null; + value = _ComponentId; + return _ComponentId is not null; case "productionSpec": - value = ProductionSpecElement; - return ProductionSpecElement is not null; + value = _ProductionSpecElement; + return _ProductionSpecElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "specType": - SpecType = (Hl7.Fhir.Model.CodeableConcept)value; + SpecType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "componentId": - ComponentId = (Hl7.Fhir.Model.Identifier)value; + ComponentId = (Hl7.Fhir.Model.Identifier?)value; return this; case "productionSpec": - ProductionSpecElement = (Hl7.Fhir.Model.FhirString)value; + ProductionSpecElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -286,9 +282,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SpecType is not null) yield return new KeyValuePair("specType",SpecType); - if (ComponentId is not null) yield return new KeyValuePair("componentId",ComponentId); - if (ProductionSpecElement is not null) yield return new KeyValuePair("productionSpec",ProductionSpecElement); + if (_SpecType is not null) yield return new KeyValuePair("specType",_SpecType); + if (_ComponentId is not null) yield return new KeyValuePair("componentId",_ComponentId); + if (_ProductionSpecElement is not null) yield return new KeyValuePair("productionSpec",_ProductionSpecElement); } } @@ -299,13 +295,13 @@ public override IEnumerable> EnumerateElements() [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// What kind of component it is. @@ -314,26 +310,26 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("ComponentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recent system change timestamp. /// [FhirElement("lastSystemChange", InSummary=true, Order=110, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.Instant LastSystemChangeElement + public Hl7.Fhir.Model.Instant? LastSystemChangeElement { get { return _LastSystemChangeElement; } set { _LastSystemChangeElement = value; OnPropertyChanged("LastSystemChangeElement"); } } - private Hl7.Fhir.Model.Instant _LastSystemChangeElement; + private Hl7.Fhir.Model.Instant? _LastSystemChangeElement; /// /// Recent system change timestamp @@ -342,13 +338,10 @@ public Hl7.Fhir.Model.Instant LastSystemChangeElement [IgnoreDataMember] public DateTimeOffset? LastSystemChange { - get { return LastSystemChangeElement != null ? LastSystemChangeElement.Value : null; } + get => _LastSystemChangeElement?.Value; set { - if (value == null) - LastSystemChangeElement = null; - else - LastSystemChangeElement = new Hl7.Fhir.Model.Instant(value); + LastSystemChangeElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("LastSystemChange"); } } @@ -360,13 +353,13 @@ public DateTimeOffset? LastSystemChange [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Parent resource link. @@ -375,13 +368,13 @@ public Hl7.Fhir.Model.ResourceReference Source [CLSCompliant(false)] [References("DeviceComponent")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// Current operational status of the component, for example On, Off or Standby. @@ -392,11 +385,11 @@ public Hl7.Fhir.Model.ResourceReference Parent [DataMember] public List OperationalStatus { - get { if(_OperationalStatus==null) _OperationalStatus = new List(); return _OperationalStatus; } + get => _OperationalStatus ?? new List(); set { _OperationalStatus = value; OnPropertyChanged("OperationalStatus"); } } - private List _OperationalStatus; + private List? _OperationalStatus; /// /// Current supported parameter group. @@ -404,13 +397,13 @@ public List OperationalStatus [FhirElement("parameterGroup", InSummary=true, Order=150)] [Binding("DeviceComponentParameterGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ParameterGroup + public Hl7.Fhir.Model.CodeableConcept? ParameterGroup { get { return _ParameterGroup; } set { _ParameterGroup = value; OnPropertyChanged("ParameterGroup"); } } - private Hl7.Fhir.Model.CodeableConcept _ParameterGroup; + private Hl7.Fhir.Model.CodeableConcept? _ParameterGroup; /// /// other | chemical | electrical | impedance | nuclear | optical | thermal | biological | mechanical | acoustical | manual+. @@ -419,13 +412,13 @@ public Hl7.Fhir.Model.CodeableConcept ParameterGroup [DeclaredType(Type = typeof(Code))] [Binding("MeasmntPrinciple")] [DataMember] - public Code MeasurementPrincipleElement + public Code? MeasurementPrincipleElement { get { return _MeasurementPrincipleElement; } set { _MeasurementPrincipleElement = value; OnPropertyChanged("MeasurementPrincipleElement"); } } - private Code _MeasurementPrincipleElement; + private Code? _MeasurementPrincipleElement; /// /// other | chemical | electrical | impedance | nuclear | optical | thermal | biological | mechanical | acoustical | manual+ @@ -434,13 +427,10 @@ public Code MeasurementPrincipl [IgnoreDataMember] public Hl7.Fhir.Model.DeviceComponent.MeasmntPrinciple? MeasurementPrinciple { - get { return MeasurementPrincipleElement != null ? MeasurementPrincipleElement.Value : null; } + get => _MeasurementPrincipleElement?.Value; set { - if (value == null) - MeasurementPrincipleElement = null; - else - MeasurementPrincipleElement = new Code(value); + MeasurementPrincipleElement = value is null ? null : new Code(value); OnPropertyChanged("MeasurementPrinciple"); } } @@ -453,11 +443,11 @@ public Hl7.Fhir.Model.DeviceComponent.MeasmntPrinciple? MeasurementPrinciple [DataMember] public List ProductionSpecification { - get { if(_ProductionSpecification==null) _ProductionSpecification = new List(); return _ProductionSpecification; } + get => _ProductionSpecification ?? new List(); set { _ProductionSpecification = value; OnPropertyChanged("ProductionSpecification"); } } - private List _ProductionSpecification; + private List? _ProductionSpecification; /// /// Language code for the human-readable text strings produced by the device. @@ -465,36 +455,32 @@ public List Pro [FhirElement("languageCode", InSummary=true, Order=180)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LanguageCode + public Hl7.Fhir.Model.CodeableConcept? LanguageCode { get { return _LanguageCode; } set { _LanguageCode = value; OnPropertyChanged("LanguageCode"); } } - private Hl7.Fhir.Model.CodeableConcept _LanguageCode; + private Hl7.Fhir.Model.CodeableConcept? _LanguageCode; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceComponent; - - if (dest == null) - { + if(other is not DeviceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(LastSystemChangeElement != null) dest.LastSystemChangeElement = (Hl7.Fhir.Model.Instant)LastSystemChangeElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(OperationalStatus.Any()) dest.OperationalStatus = new List(OperationalStatus.DeepCopyInternal()); - if(ParameterGroup != null) dest.ParameterGroup = (Hl7.Fhir.Model.CodeableConcept)ParameterGroup.DeepCopyInternal(); - if(MeasurementPrincipleElement != null) dest.MeasurementPrincipleElement = (Code)MeasurementPrincipleElement.DeepCopyInternal(); - if(ProductionSpecification.Any()) dest.ProductionSpecification = new List(ProductionSpecification.DeepCopyInternal()); - if(LanguageCode != null) dest.LanguageCode = (Hl7.Fhir.Model.CodeableConcept)LanguageCode.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_LastSystemChangeElement is not null) dest.LastSystemChangeElement = (Hl7.Fhir.Model.Instant)_LastSystemChangeElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_OperationalStatus is not null) dest.OperationalStatus = new List(_OperationalStatus.DeepCopyInternal()); + if(_ParameterGroup is not null) dest.ParameterGroup = (Hl7.Fhir.Model.CodeableConcept)_ParameterGroup.DeepCopyInternal(); + if(_MeasurementPrincipleElement is not null) dest.MeasurementPrincipleElement = (Code)_MeasurementPrincipleElement.DeepCopyInternal(); + if(_ProductionSpecification is not null) dest.ProductionSpecification = new List(_ProductionSpecification.DeepCopyInternal()); + if(_LanguageCode is not null) dest.LanguageCode = (Hl7.Fhir.Model.CodeableConcept)_LanguageCode.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -506,97 +492,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceComponent; - if(otherT == null) return false; + if(other is not DeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(LastSystemChangeElement, otherT.LastSystemChangeElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.ListEquals(OperationalStatus, otherT.OperationalStatus)) return false; - if(!comparer.Equals(ParameterGroup, otherT.ParameterGroup)) return false; - if(!comparer.Equals(MeasurementPrincipleElement, otherT.MeasurementPrincipleElement)) return false; - if(!comparer.ListEquals(ProductionSpecification, otherT.ProductionSpecification)) return false; - if(!comparer.Equals(LanguageCode, otherT.LanguageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_LastSystemChangeElement, otherT._LastSystemChangeElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.ListEquals(_OperationalStatus, otherT._OperationalStatus)) return false; + if(!comparer.Equals(_ParameterGroup, otherT._ParameterGroup)) return false; + if(!comparer.Equals(_MeasurementPrincipleElement, otherT._MeasurementPrincipleElement)) return false; + if(!comparer.ListEquals(_ProductionSpecification, otherT._ProductionSpecification)) return false; + if(!comparer.Equals(_LanguageCode, otherT._LanguageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "lastSystemChange": - value = LastSystemChangeElement; - return LastSystemChangeElement is not null; + value = _LastSystemChangeElement; + return _LastSystemChangeElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "operationalStatus": - value = OperationalStatus; - return OperationalStatus?.Any() == true; + value = _OperationalStatus; + return _OperationalStatus?.Any() == true; case "parameterGroup": - value = ParameterGroup; - return ParameterGroup is not null; + value = _ParameterGroup; + return _ParameterGroup is not null; case "measurementPrinciple": - value = MeasurementPrincipleElement; - return MeasurementPrincipleElement is not null; + value = _MeasurementPrincipleElement; + return _MeasurementPrincipleElement is not null; case "productionSpecification": - value = ProductionSpecification; - return ProductionSpecification?.Any() == true; + value = _ProductionSpecification; + return _ProductionSpecification?.Any() == true; case "languageCode": - value = LanguageCode; - return LanguageCode is not null; + value = _LanguageCode; + return _LanguageCode is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "lastSystemChange": - LastSystemChangeElement = (Hl7.Fhir.Model.Instant)value; + LastSystemChangeElement = (Hl7.Fhir.Model.Instant?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "operationalStatus": - OperationalStatus = (List)value; + OperationalStatus = (List?)value!; return this; case "parameterGroup": - ParameterGroup = (Hl7.Fhir.Model.CodeableConcept)value; + ParameterGroup = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "measurementPrinciple": - MeasurementPrincipleElement = (Code)value; + MeasurementPrincipleElement = (Code?)value; return this; case "productionSpecification": - ProductionSpecification = (List)value; + ProductionSpecification = (List?)value!; return this; case "languageCode": - LanguageCode = (Hl7.Fhir.Model.CodeableConcept)value; + LanguageCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -607,16 +593,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (LastSystemChangeElement is not null) yield return new KeyValuePair("lastSystemChange",LastSystemChangeElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (OperationalStatus?.Any() == true) yield return new KeyValuePair("operationalStatus",OperationalStatus); - if (ParameterGroup is not null) yield return new KeyValuePair("parameterGroup",ParameterGroup); - if (MeasurementPrincipleElement is not null) yield return new KeyValuePair("measurementPrinciple",MeasurementPrincipleElement); - if (ProductionSpecification?.Any() == true) yield return new KeyValuePair("productionSpecification",ProductionSpecification); - if (LanguageCode is not null) yield return new KeyValuePair("languageCode",LanguageCode); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_LastSystemChangeElement is not null) yield return new KeyValuePair("lastSystemChange",_LastSystemChangeElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_OperationalStatus?.Any() == true) yield return new KeyValuePair("operationalStatus",_OperationalStatus); + if (_ParameterGroup is not null) yield return new KeyValuePair("parameterGroup",_ParameterGroup); + if (_MeasurementPrincipleElement is not null) yield return new KeyValuePair("measurementPrinciple",_MeasurementPrincipleElement); + if (_ProductionSpecification?.Any() == true) yield return new KeyValuePair("productionSpecification",_ProductionSpecification); + if (_LanguageCode is not null) yield return new KeyValuePair("languageCode",_LanguageCode); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs index 5c45316b3..e97f3f21c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -274,13 +277,13 @@ public partial class CalibrationComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// unspecified | offset | gain | two-point @@ -289,13 +292,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -307,13 +307,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationState")] [DataMember] - public Code StateElement + public Code? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Code _StateElement; + private Code? _StateElement; /// /// not-calibrated | calibration-required | calibrated | unspecified @@ -322,13 +322,10 @@ public Code StateEleme [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Code(value); + StateElement = value is null ? null : new Code(value); OnPropertyChanged("State"); } } @@ -338,13 +335,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State /// [FhirElement("time", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Instant TimeElement + public Hl7.Fhir.Model.Instant? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.Instant _TimeElement; + private Hl7.Fhir.Model.Instant? _TimeElement; /// /// Describes the time last calibration has been performed @@ -353,30 +350,23 @@ public Hl7.Fhir.Model.Instant TimeElement [IgnoreDataMember] public DateTimeOffset? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.Instant(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Time"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CalibrationComponent; - - if (dest == null) - { + if(other is not CalibrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Code)StateElement.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.Instant)TimeElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Code)_StateElement.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.Instant)_TimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -388,48 +378,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CalibrationComponent; - if(otherT == null) return false; + if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "state": - StateElement = (Code)value; + StateElement = (Code?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.Instant)value; + TimeElement = (Hl7.Fhir.Model.Instant?)value; return this; default: return base.SetValue(key, value); @@ -440,9 +430,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); } } @@ -453,13 +443,13 @@ public override IEnumerable> EnumerateElements() [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Identity of metric, for example Heart Rate or PEEP Setting. @@ -468,13 +458,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("MetricType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Unit of Measure for the Metric. @@ -482,13 +472,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("unit", InSummary=true, Order=110)] [Binding("MetricUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Describes the link to the source Device. @@ -497,13 +487,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Describes the link to the parent DeviceComponent. @@ -512,13 +502,13 @@ public Hl7.Fhir.Model.ResourceReference Source [CLSCompliant(false)] [References("DeviceComponent")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// on | off | standby | entered-in-error. @@ -527,13 +517,13 @@ public Hl7.Fhir.Model.ResourceReference Parent [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricOperationalStatus")] [DataMember] - public Code OperationalStatusElement + public Code? OperationalStatusElement { get { return _OperationalStatusElement; } set { _OperationalStatusElement = value; OnPropertyChanged("OperationalStatusElement"); } } - private Code _OperationalStatusElement; + private Code? _OperationalStatusElement; /// /// on | off | standby | entered-in-error @@ -542,13 +532,10 @@ public Code Operation [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalStatus { - get { return OperationalStatusElement != null ? OperationalStatusElement.Value : null; } + get => _OperationalStatusElement?.Value; set { - if (value == null) - OperationalStatusElement = null; - else - OperationalStatusElement = new Code(value); + OperationalStatusElement = value is null ? null : new Code(value); OnPropertyChanged("OperationalStatus"); } } @@ -560,13 +547,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalSta [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricColor")] [DataMember] - public Code ColorElement + public Code? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Code _ColorElement; + private Code? _ColorElement; /// /// black | red | green | yellow | blue | magenta | cyan | white @@ -575,13 +562,10 @@ public Code ColorElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricColor? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Code(value); + ColorElement = value is null ? null : new Code(value); OnPropertyChanged("Color"); } } @@ -594,13 +578,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricColor? Color [Binding("DeviceMetricCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// measurement | setting | calculation | unspecified @@ -609,13 +593,10 @@ public Code CategoryElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -625,13 +606,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category /// [FhirElement("measurementPeriod", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.Timing MeasurementPeriod + public Hl7.Fhir.Model.Timing? MeasurementPeriod { get { return _MeasurementPeriod; } set { _MeasurementPeriod = value; OnPropertyChanged("MeasurementPeriod"); } } - private Hl7.Fhir.Model.Timing _MeasurementPeriod; + private Hl7.Fhir.Model.Timing? _MeasurementPeriod; /// /// Describes the calibrations that have been performed or that are required to be performed. @@ -641,34 +622,30 @@ public Hl7.Fhir.Model.Timing MeasurementPeriod [DataMember] public List Calibration { - get { if(_Calibration==null) _Calibration = new List(); return _Calibration; } + get => _Calibration ?? new List(); set { _Calibration = value; OnPropertyChanged("Calibration"); } } - private List _Calibration; + private List? _Calibration; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceMetric; - - if (dest == null) - { + if(other is not DeviceMetric dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(OperationalStatusElement != null) dest.OperationalStatusElement = (Code)OperationalStatusElement.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Code)ColorElement.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(MeasurementPeriod != null) dest.MeasurementPeriod = (Hl7.Fhir.Model.Timing)MeasurementPeriod.DeepCopyInternal(); - if(Calibration.Any()) dest.Calibration = new List(Calibration.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_OperationalStatusElement is not null) dest.OperationalStatusElement = (Code)_OperationalStatusElement.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Code)_ColorElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_MeasurementPeriod is not null) dest.MeasurementPeriod = (Hl7.Fhir.Model.Timing)_MeasurementPeriod.DeepCopyInternal(); + if(_Calibration is not null) dest.Calibration = new List(_Calibration.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -680,97 +657,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceMetric; - if(otherT == null) return false; + if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(OperationalStatusElement, otherT.OperationalStatusElement)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(MeasurementPeriod, otherT.MeasurementPeriod)) return false; - if(!comparer.ListEquals(Calibration, otherT.Calibration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_OperationalStatusElement, otherT._OperationalStatusElement)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_MeasurementPeriod, otherT._MeasurementPeriod)) return false; + if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "operationalStatus": - value = OperationalStatusElement; - return OperationalStatusElement is not null; + value = _OperationalStatusElement; + return _OperationalStatusElement is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "measurementPeriod": - value = MeasurementPeriod; - return MeasurementPeriod is not null; + value = _MeasurementPeriod; + return _MeasurementPeriod is not null; case "calibration": - value = Calibration; - return Calibration?.Any() == true; + value = _Calibration; + return _Calibration?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "operationalStatus": - OperationalStatusElement = (Code)value; + OperationalStatusElement = (Code?)value; return this; case "color": - ColorElement = (Code)value; + ColorElement = (Code?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "measurementPeriod": - MeasurementPeriod = (Hl7.Fhir.Model.Timing)value; + MeasurementPeriod = (Hl7.Fhir.Model.Timing?)value; return this; case "calibration": - Calibration = (List)value; + Calibration = (List?)value!; return this; default: return base.SetValue(key, value); @@ -781,16 +758,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",OperationalStatusElement); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (MeasurementPeriod is not null) yield return new KeyValuePair("measurementPeriod",MeasurementPeriod); - if (Calibration?.Any() == true) yield return new KeyValuePair("calibration",Calibration); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatusElement); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_MeasurementPeriod is not null) yield return new KeyValuePair("measurementPeriod",_MeasurementPeriod); + if (_Calibration?.Any() == true) yield return new KeyValuePair("calibration",_Calibration); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs index b0d83c99a..27bf2a96c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -83,13 +86,13 @@ public partial class RequesterComponent : Hl7.Fhir.Model.BackboneElement [References("Device","Practitioner","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Agent + public Hl7.Fhir.Model.ResourceReference? Agent { get { return _Agent; } set { _Agent = value; OnPropertyChanged("Agent"); } } - private Hl7.Fhir.Model.ResourceReference _Agent; + private Hl7.Fhir.Model.ResourceReference? _Agent; /// /// Organization agent is acting for. @@ -98,26 +101,22 @@ public Hl7.Fhir.Model.ResourceReference Agent [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as RequesterComponent; - - if (dest == null) - { + if(other is not RequesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Agent != null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)Agent.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)_Agent.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -129,41 +128,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequesterComponent; - if(otherT == null) return false; + if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "agent": - value = Agent; - return Agent is not null; + value = _Agent; + return _Agent is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "agent": - Agent = (Hl7.Fhir.Model.ResourceReference)value; + Agent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -174,8 +173,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Agent is not null) yield return new KeyValuePair("agent",Agent); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Agent is not null) yield return new KeyValuePair("agent",_Agent); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -188,11 +187,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Protocol or definition. @@ -204,11 +203,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// What request fulfills. @@ -220,11 +219,11 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -236,24 +235,24 @@ public List BasedOn [DataMember] public List PriorRequest { - get { if(_PriorRequest==null) _PriorRequest = new List(); return _PriorRequest; } + get => _PriorRequest ?? new List(); set { _PriorRequest = value; OnPropertyChanged("PriorRequest"); } } - private List _PriorRequest; + private List? _PriorRequest; /// /// Identifier of composite request. /// [FhirElement("groupIdentifier", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | suspended | completed | entered-in-error | cancelled. @@ -262,13 +261,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DeclaredType(Type = typeof(Code))] [Binding("DeviceRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended | completed | entered-in-error | cancelled @@ -277,13 +276,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -295,13 +291,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Intent + public Hl7.Fhir.Model.CodeableConcept? Intent { get { return _Intent; } set { _Intent = value; OnPropertyChanged("Intent"); } } - private Hl7.Fhir.Model.CodeableConcept _Intent; + private Hl7.Fhir.Model.CodeableConcept? _Intent; /// /// Indicates how quickly the {{title}} should be addressed with respect to other requests. @@ -310,13 +306,13 @@ public Hl7.Fhir.Model.CodeableConcept Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// Indicates how quickly the {{title}} should be addressed with respect to other requests @@ -325,13 +321,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -346,13 +339,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Code + public Hl7.Fhir.Model.DataType? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.DataType _Code; + private Hl7.Fhir.Model.DataType? _Code; /// /// Focus of request. @@ -362,13 +355,13 @@ public Hl7.Fhir.Model.DataType Code [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode motivating request. @@ -377,13 +370,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Desired time or schedule for use. @@ -392,41 +385,38 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When recorded. /// [FhirElement("authoredOn", InSummary=true, Order=210, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -436,13 +426,13 @@ public string AuthoredOn /// [FhirElement("requester", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.DeviceRequest.RequesterComponent Requester + public Hl7.Fhir.Model.DeviceRequest.RequesterComponent? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.DeviceRequest.RequesterComponent _Requester; + private Hl7.Fhir.Model.DeviceRequest.RequesterComponent? _Requester; /// /// Fille role. @@ -450,13 +440,13 @@ public Hl7.Fhir.Model.DeviceRequest.RequesterComponent Requester [FhirElement("performerType", InSummary=true, Order=230, FiveWs="who.actor")] [Binding("DeviceRequestParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Requested Filler. @@ -465,13 +455,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [CLSCompliant(false)] [References("Practitioner","Organization","Patient","Device","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Coded Reason for request. @@ -482,11 +472,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Linked Reason for request. @@ -498,11 +488,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Additional clinical information. @@ -514,11 +504,11 @@ public List ReasonReference [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Notes or comments. @@ -528,11 +518,11 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Request provenance. @@ -544,45 +534,41 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceRequest; - - if (dest == null) - { + if(other is not DeviceRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PriorRequest.Any()) dest.PriorRequest = new List(PriorRequest.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Intent != null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)Intent.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.DataType)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.DeviceRequest.RequesterComponent)Requester.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PriorRequest is not null) dest.PriorRequest = new List(_PriorRequest.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Intent is not null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)_Intent.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.DataType)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.DeviceRequest.RequesterComponent)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -594,174 +580,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceRequest; - if(otherT == null) return false; + if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PriorRequest, otherT.PriorRequest)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Intent, otherT.Intent)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PriorRequest, otherT._PriorRequest)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Intent, otherT._Intent)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "priorRequest": - value = PriorRequest; - return PriorRequest?.Any() == true; + value = _PriorRequest; + return _PriorRequest?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = Intent; - return Intent is not null; + value = _Intent; + return _Intent is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "priorRequest": - PriorRequest = (List)value; + PriorRequest = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - Intent = (Hl7.Fhir.Model.CodeableConcept)value; + Intent = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.DataType)value; + Code = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.DeviceRequest.RequesterComponent)value; + Requester = (Hl7.Fhir.Model.DeviceRequest.RequesterComponent?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -772,27 +758,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PriorRequest?.Any() == true) yield return new KeyValuePair("priorRequest",PriorRequest); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Intent is not null) yield return new KeyValuePair("intent",Intent); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PriorRequest?.Any() == true) yield return new KeyValuePair("priorRequest",_PriorRequest); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Intent is not null) yield return new KeyValuePair("intent",_Intent); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs index 19ff1b325..313a441ea 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,11 +116,11 @@ public enum DeviceUseStatementStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | completed | entered-in-error +. @@ -127,13 +130,13 @@ public List Identifier [Binding("DeviceUseStatementStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | completed | entered-in-error + @@ -142,13 +145,10 @@ public Code StatusEl [IgnoreDataMember] public Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -161,26 +161,26 @@ public Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus? Status [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Period device was used. /// [FhirElement("whenUsed", Order=120, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period WhenUsed + public Hl7.Fhir.Model.Period? WhenUsed { get { return _WhenUsed; } set { _WhenUsed = value; OnPropertyChanged("WhenUsed"); } } - private Hl7.Fhir.Model.Period _WhenUsed; + private Hl7.Fhir.Model.Period? _WhenUsed; /// /// How often the device was used. @@ -189,41 +189,38 @@ public Hl7.Fhir.Model.Period WhenUsed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// When statement was recorded. /// [FhirElement("recordedOn", Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedOnElement + public Hl7.Fhir.Model.FhirDateTime? RecordedOnElement { get { return _RecordedOnElement; } set { _RecordedOnElement = value; OnPropertyChanged("RecordedOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedOnElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedOnElement; /// /// When statement was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedOn + public string? RecordedOn { - get { return RecordedOnElement != null ? RecordedOnElement.Value : null; } + get => _RecordedOnElement?.Value; set { - if (value == null) - RecordedOnElement = null; - else - RecordedOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedOn"); } } @@ -235,13 +232,13 @@ public string RecordedOn [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Reference to device used. @@ -251,13 +248,13 @@ public Hl7.Fhir.Model.ResourceReference Source [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Why device was used. @@ -267,11 +264,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List Indication { - get { if(_Indication==null) _Indication = new List(); return _Indication; } + get => _Indication ?? new List(); set { _Indication = value; OnPropertyChanged("Indication"); } } - private List _Indication; + private List? _Indication; /// /// Target body site. @@ -279,13 +276,13 @@ public List Indication [FhirElement("bodySite", Order=180)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Addition details (comments, instructions). @@ -295,35 +292,31 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceUseStatement; - - if (dest == null) - { + if(other is not DeviceUseStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(WhenUsed != null) dest.WhenUsed = (Hl7.Fhir.Model.Period)WhenUsed.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(RecordedOnElement != null) dest.RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)RecordedOnElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Indication.Any()) dest.Indication = new List(Indication.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_WhenUsed is not null) dest.WhenUsed = (Hl7.Fhir.Model.Period)_WhenUsed.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_RecordedOnElement is not null) dest.RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedOnElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Indication is not null) dest.Indication = new List(_Indication.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -335,104 +328,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceUseStatement; - if(otherT == null) return false; + if(other is not DeviceUseStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(WhenUsed, otherT.WhenUsed)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(RecordedOnElement, otherT.RecordedOnElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_WhenUsed, otherT._WhenUsed)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_RecordedOnElement, otherT._RecordedOnElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "whenUsed": - value = WhenUsed; - return WhenUsed is not null; + value = _WhenUsed; + return _WhenUsed is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "recordedOn": - value = RecordedOnElement; - return RecordedOnElement is not null; + value = _RecordedOnElement; + return _RecordedOnElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "indication": - value = Indication; - return Indication?.Any() == true; + value = _Indication; + return _Indication?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "whenUsed": - WhenUsed = (Hl7.Fhir.Model.Period)value; + WhenUsed = (Hl7.Fhir.Model.Period?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedOn": - RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "indication": - Indication = (List)value; + Indication = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -443,17 +436,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (WhenUsed is not null) yield return new KeyValuePair("whenUsed",WhenUsed); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (RecordedOnElement is not null) yield return new KeyValuePair("recordedOn",RecordedOnElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Indication?.Any() == true) yield return new KeyValuePair("indication",Indication); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_WhenUsed is not null) yield return new KeyValuePair("whenUsed",_WhenUsed); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_RecordedOnElement is not null) yield return new KeyValuePair("recordedOn",_RecordedOnElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Indication?.Any() == true) yield return new KeyValuePair("indication",_Indication); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs index 63b04c05f..63d17d8d5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -152,13 +155,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("role", InSummary=true, Order=40)] [Binding("Role")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Practitioner or Organization participant. @@ -168,26 +171,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Practitioner","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -199,41 +198,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -244,8 +243,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -271,28 +270,25 @@ public partial class ImageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("comment", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comment about the image (e.g. explanation) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -305,26 +301,22 @@ public string Comment [References("Media")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Link + public Hl7.Fhir.Model.ResourceReference? Link { get { return _Link; } set { _Link = value; OnPropertyChanged("Link"); } } - private Hl7.Fhir.Model.ResourceReference _Link; + private Hl7.Fhir.Model.ResourceReference? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as ImageComponent; - - if (dest == null) - { + if(other is not ImageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Link != null) dest.Link = (Hl7.Fhir.Model.ResourceReference)Link.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = (Hl7.Fhir.Model.ResourceReference)_Link.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -336,41 +328,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImageComponent; - if(otherT == null) return false; + if(other is not ImageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "link": - value = Link; - return Link is not null; + value = _Link; + return _Link is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "link": - Link = (Hl7.Fhir.Model.ResourceReference)value; + Link = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -381,8 +373,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Link is not null) yield return new KeyValuePair("link",Link); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Link is not null) yield return new KeyValuePair("link",_Link); } } @@ -395,11 +387,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// What was requested. @@ -411,11 +403,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// registered | partial | preliminary | final +. @@ -425,13 +417,13 @@ public List BasedOn [Binding("DiagnosticReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | partial | preliminary | final + @@ -440,13 +432,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -457,13 +446,13 @@ public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status [FhirElement("category", InSummary=true, Order=120, FiveWs="class")] [Binding("DiagnosticServiceSection")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Name/Code for this diagnostic report. @@ -472,13 +461,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("DiagnosticReportCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The subject of the report - usually, but not always, the patient. @@ -487,13 +476,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Health care event when test ordered. @@ -502,13 +491,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Clinically relevant time/time-period for report. @@ -517,26 +506,26 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// DateTime this version was released. /// [FhirElement("issued", InSummary=true, Order=170, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// DateTime this version was released @@ -545,13 +534,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -564,11 +550,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Specimens this report is based on. @@ -580,11 +566,11 @@ public List Performer [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Observations - simple, or complex nested groups. @@ -596,11 +582,11 @@ public List Specimen [DataMember] public List Result { - get { if(_Result==null) _Result = new List(); return _Result; } + get => _Result ?? new List(); set { _Result = value; OnPropertyChanged("Result"); } } - private List _Result; + private List? _Result; /// /// Reference to full details of imaging associated with the diagnostic report. @@ -612,11 +598,11 @@ public List Result [DataMember] public List ImagingStudy { - get { if(_ImagingStudy==null) _ImagingStudy = new List(); return _ImagingStudy; } + get => _ImagingStudy ?? new List(); set { _ImagingStudy = value; OnPropertyChanged("ImagingStudy"); } } - private List _ImagingStudy; + private List? _ImagingStudy; /// /// Key images associated with this report. @@ -626,39 +612,36 @@ public List ImagingStudy [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; /// /// Clinical Interpretation of test results. /// [FhirElement("conclusion", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString ConclusionElement + public Hl7.Fhir.Model.FhirString? ConclusionElement { get { return _ConclusionElement; } set { _ConclusionElement = value; OnPropertyChanged("ConclusionElement"); } } - private Hl7.Fhir.Model.FhirString _ConclusionElement; + private Hl7.Fhir.Model.FhirString? _ConclusionElement; /// /// Clinical Interpretation of test results /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Conclusion + public string? Conclusion { - get { return ConclusionElement != null ? ConclusionElement.Value : null; } + get => _ConclusionElement?.Value; set { - if (value == null) - ConclusionElement = null; - else - ConclusionElement = new Hl7.Fhir.Model.FhirString(value); + ConclusionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Conclusion"); } } @@ -672,11 +655,11 @@ public string Conclusion [DataMember] public List CodedDiagnosis { - get { if(_CodedDiagnosis==null) _CodedDiagnosis = new List(); return _CodedDiagnosis; } + get => _CodedDiagnosis ?? new List(); set { _CodedDiagnosis = value; OnPropertyChanged("CodedDiagnosis"); } } - private List _CodedDiagnosis; + private List? _CodedDiagnosis; /// /// Entire report as issued. @@ -686,41 +669,37 @@ public List CodedDiagnosis [DataMember] public List PresentedForm { - get { if(_PresentedForm==null) _PresentedForm = new List(); return _PresentedForm; } + get => _PresentedForm ?? new List(); set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } - private List _PresentedForm; + private List? _PresentedForm; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosticReport; - - if (dest == null) - { + if(other is not DiagnosticReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(Result.Any()) dest.Result = new List(Result.DeepCopyInternal()); - if(ImagingStudy.Any()) dest.ImagingStudy = new List(ImagingStudy.DeepCopyInternal()); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); - if(ConclusionElement != null) dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)ConclusionElement.DeepCopyInternal(); - if(CodedDiagnosis.Any()) dest.CodedDiagnosis = new List(CodedDiagnosis.DeepCopyInternal()); - if(PresentedForm.Any()) dest.PresentedForm = new List(PresentedForm.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_Result is not null) dest.Result = new List(_Result.DeepCopyInternal()); + if(_ImagingStudy is not null) dest.ImagingStudy = new List(_ImagingStudy.DeepCopyInternal()); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); + if(_ConclusionElement is not null) dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)_ConclusionElement.DeepCopyInternal(); + if(_CodedDiagnosis is not null) dest.CodedDiagnosis = new List(_CodedDiagnosis.DeepCopyInternal()); + if(_PresentedForm is not null) dest.PresentedForm = new List(_PresentedForm.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -732,146 +711,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosticReport; - if(otherT == null) return false; + if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(ImagingStudy, otherT.ImagingStudy)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; - if(!comparer.Equals(ConclusionElement, otherT.ConclusionElement)) return false; - if(!comparer.ListEquals(CodedDiagnosis, otherT.CodedDiagnosis)) return false; - if(!comparer.ListEquals(PresentedForm, otherT.PresentedForm)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_ImagingStudy, otherT._ImagingStudy)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; + if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; + if(!comparer.ListEquals(_CodedDiagnosis, otherT._CodedDiagnosis)) return false; + if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "result": - value = Result; - return Result?.Any() == true; + value = _Result; + return _Result?.Any() == true; case "imagingStudy": - value = ImagingStudy; - return ImagingStudy?.Any() == true; + value = _ImagingStudy; + return _ImagingStudy?.Any() == true; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; case "conclusion": - value = ConclusionElement; - return ConclusionElement is not null; + value = _ConclusionElement; + return _ConclusionElement is not null; case "codedDiagnosis": - value = CodedDiagnosis; - return CodedDiagnosis?.Any() == true; + value = _CodedDiagnosis; + return _CodedDiagnosis?.Any() == true; case "presentedForm": - value = PresentedForm; - return PresentedForm?.Any() == true; + value = _PresentedForm; + return _PresentedForm?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "result": - Result = (List)value; + Result = (List?)value!; return this; case "imagingStudy": - ImagingStudy = (List)value; + ImagingStudy = (List?)value!; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; case "conclusion": - ConclusionElement = (Hl7.Fhir.Model.FhirString)value; + ConclusionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "codedDiagnosis": - CodedDiagnosis = (List)value; + CodedDiagnosis = (List?)value!; return this; case "presentedForm": - PresentedForm = (List)value; + PresentedForm = (List?)value!; return this; default: return base.SetValue(key, value); @@ -882,23 +861,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (Result?.Any() == true) yield return new KeyValuePair("result",Result); - if (ImagingStudy?.Any() == true) yield return new KeyValuePair("imagingStudy",ImagingStudy); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); - if (ConclusionElement is not null) yield return new KeyValuePair("conclusion",ConclusionElement); - if (CodedDiagnosis?.Any() == true) yield return new KeyValuePair("codedDiagnosis",CodedDiagnosis); - if (PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",PresentedForm); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_Result?.Any() == true) yield return new KeyValuePair("result",_Result); + if (_ImagingStudy?.Any() == true) yield return new KeyValuePair("imagingStudy",_ImagingStudy); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); + if (_ConclusionElement is not null) yield return new KeyValuePair("conclusion",_ConclusionElement); + if (_CodedDiagnosis?.Any() == true) yield return new KeyValuePair("codedDiagnosis",_CodedDiagnosis); + if (_PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",_PresentedForm); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Distance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Distance.cs index 1023e3ad9..5836df1b5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Distance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Distance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs index 4cb317ee6..04afc2584 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class ContentComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType P + public Hl7.Fhir.Model.DataType? P { get { return _P; } set { _P = value; OnPropertyChanged("P"); } } - private Hl7.Fhir.Model.DataType _P; + private Hl7.Fhir.Model.DataType? _P; protected internal override void CopyToInternal(Base other) { - var dest = other as ContentComponent; - - if (dest == null) - { + if(other is not ContentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(P != null) dest.P = (Hl7.Fhir.Model.DataType)P.DeepCopyInternal(); + if(_P is not null) dest.P = (Hl7.Fhir.Model.DataType)_P.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentComponent; - if(otherT == null) return false; + if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(P, otherT.P)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_P, otherT._P)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "p": - value = P; - return P is not null; + value = _P; + return _P is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "p": - P = (Hl7.Fhir.Model.DataType)value; + P = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (P is not null) yield return new KeyValuePair("p",P); + if (_P is not null) yield return new KeyValuePair("p",_P); } } @@ -179,13 +178,13 @@ public partial class RelatedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Related Resource. @@ -194,26 +193,22 @@ public Hl7.Fhir.Model.Identifier Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Ref + public Hl7.Fhir.Model.ResourceReference? Ref { get { return _Ref; } set { _Ref = value; OnPropertyChanged("Ref"); } } - private Hl7.Fhir.Model.ResourceReference _Ref; + private Hl7.Fhir.Model.ResourceReference? _Ref; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedComponent; - - if (dest == null) - { + if(other is not RelatedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Ref != null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)Ref.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Ref is not null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)_Ref.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -225,41 +220,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedComponent; - if(otherT == null) return false; + if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Ref, otherT.Ref)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Ref, otherT._Ref)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "ref": - value = Ref; - return Ref is not null; + value = _Ref; + return _Ref is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "ref": - Ref = (Hl7.Fhir.Model.ResourceReference)value; + Ref = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -270,8 +265,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Ref is not null) yield return new KeyValuePair("ref",Ref); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Ref is not null) yield return new KeyValuePair("ref",_Ref); } } @@ -281,13 +276,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("masterIdentifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier MasterIdentifier + public Hl7.Fhir.Model.Identifier? MasterIdentifier { get { return _MasterIdentifier; } set { _MasterIdentifier = value; OnPropertyChanged("MasterIdentifier"); } } - private Hl7.Fhir.Model.Identifier _MasterIdentifier; + private Hl7.Fhir.Model.Identifier? _MasterIdentifier; /// /// Other identifiers for the manifest. @@ -297,11 +292,11 @@ public Hl7.Fhir.Model.Identifier MasterIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | superseded | entered-in-error. @@ -311,13 +306,13 @@ public List Identifier [Binding("DocumentReferenceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | superseded | entered-in-error @@ -326,13 +321,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentReferenceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -343,13 +335,13 @@ public Hl7.Fhir.Model.DocumentReferenceStatus? Status [FhirElement("type", InSummary=true, Order=120, FiveWs="class")] [Binding("DocumentC80Type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The subject of the set of documents. @@ -358,41 +350,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Practitioner","Group","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When this document manifest created. /// [FhirElement("created", InSummary=true, Order=140, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// When this document manifest created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -407,11 +396,11 @@ public string Created [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Intended to get notified about this set of documents. @@ -423,39 +412,36 @@ public List Author [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// The source system/application/software. /// [FhirElement("source", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// The source system/application/software /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -465,28 +451,25 @@ public string Source /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable description (title) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -499,11 +482,11 @@ public string Description [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// Related things. @@ -513,36 +496,32 @@ public List Content [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentManifest; - - if (dest == null) - { + if(other is not DocumentManifest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MasterIdentifier != null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); + if(_MasterIdentifier is not null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)_MasterIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -554,111 +533,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentManifest; - if(otherT == null) return false; + if(other is not DocumentManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MasterIdentifier, otherT.MasterIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "masterIdentifier": - value = MasterIdentifier; - return MasterIdentifier is not null; + value = _MasterIdentifier; + return _MasterIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "masterIdentifier": - MasterIdentifier = (Hl7.Fhir.Model.Identifier)value; + MasterIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; default: return base.SetValue(key, value); @@ -669,18 +648,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",MasterIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); + if (_MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",_MasterIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs index 1762b3e16..2688506cd 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | transforms | signs | appends @@ -99,13 +102,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -118,26 +118,22 @@ public Hl7.Fhir.Model.DocumentRelationshipType? Code [References("DocumentReference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -149,41 +145,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -194,8 +190,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -222,13 +218,13 @@ public partial class ContentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("attachment", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Attachment Attachment + public Hl7.Fhir.Model.Attachment? Attachment { get { return _Attachment; } set { _Attachment = value; OnPropertyChanged("Attachment"); } } - private Hl7.Fhir.Model.Attachment _Attachment; + private Hl7.Fhir.Model.Attachment? _Attachment; /// /// Format/content rules for the document. @@ -236,26 +232,22 @@ public Hl7.Fhir.Model.Attachment Attachment [FhirElement("format", InSummary=true, Order=50)] [Binding("DocumentFormat")] [DataMember] - public Hl7.Fhir.Model.Coding Format + public Hl7.Fhir.Model.Coding? Format { get { return _Format; } set { _Format = value; OnPropertyChanged("Format"); } } - private Hl7.Fhir.Model.Coding _Format; + private Hl7.Fhir.Model.Coding? _Format; protected internal override void CopyToInternal(Base other) { - var dest = other as ContentComponent; - - if (dest == null) - { + if(other is not ContentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Attachment != null) dest.Attachment = (Hl7.Fhir.Model.Attachment)Attachment.DeepCopyInternal(); - if(Format != null) dest.Format = (Hl7.Fhir.Model.Coding)Format.DeepCopyInternal(); + if(_Attachment is not null) dest.Attachment = (Hl7.Fhir.Model.Attachment)_Attachment.DeepCopyInternal(); + if(_Format is not null) dest.Format = (Hl7.Fhir.Model.Coding)_Format.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -267,41 +259,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentComponent; - if(otherT == null) return false; + if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Attachment, otherT.Attachment)) return false; - if(!comparer.Equals(Format, otherT.Format)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + if(!comparer.Equals(_Format, otherT._Format)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "attachment": - value = Attachment; - return Attachment is not null; + value = _Attachment; + return _Attachment is not null; case "format": - value = Format; - return Format is not null; + value = _Format; + return _Format is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "attachment": - Attachment = (Hl7.Fhir.Model.Attachment)value; + Attachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "format": - Format = (Hl7.Fhir.Model.Coding)value; + Format = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -312,8 +304,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Attachment is not null) yield return new KeyValuePair("attachment",Attachment); - if (Format is not null) yield return new KeyValuePair("format",Format); + if (_Attachment is not null) yield return new KeyValuePair("attachment",_Attachment); + if (_Format is not null) yield return new KeyValuePair("format",_Format); } } @@ -342,13 +334,13 @@ public partial class ContextComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Main clinical acts documented. @@ -359,24 +351,24 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Time of service that is being documented. /// [FhirElement("period", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Kind of facility where patient was seen. @@ -384,13 +376,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("facilityType", InSummary=true, Order=70)] [Binding("DocumentC80FacilityType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FacilityType + public Hl7.Fhir.Model.CodeableConcept? FacilityType { get { return _FacilityType; } set { _FacilityType = value; OnPropertyChanged("FacilityType"); } } - private Hl7.Fhir.Model.CodeableConcept _FacilityType; + private Hl7.Fhir.Model.CodeableConcept? _FacilityType; /// /// Additional details about where the content was created (e.g. clinical specialty). @@ -398,13 +390,13 @@ public Hl7.Fhir.Model.CodeableConcept FacilityType [FhirElement("practiceSetting", InSummary=true, Order=80)] [Binding("DocumentC80PracticeSetting")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PracticeSetting + public Hl7.Fhir.Model.CodeableConcept? PracticeSetting { get { return _PracticeSetting; } set { _PracticeSetting = value; OnPropertyChanged("PracticeSetting"); } } - private Hl7.Fhir.Model.CodeableConcept _PracticeSetting; + private Hl7.Fhir.Model.CodeableConcept? _PracticeSetting; /// /// Patient demographics from source. @@ -413,13 +405,13 @@ public Hl7.Fhir.Model.CodeableConcept PracticeSetting [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SourcePatientInfo + public Hl7.Fhir.Model.ResourceReference? SourcePatientInfo { get { return _SourcePatientInfo; } set { _SourcePatientInfo = value; OnPropertyChanged("SourcePatientInfo"); } } - private Hl7.Fhir.Model.ResourceReference _SourcePatientInfo; + private Hl7.Fhir.Model.ResourceReference? _SourcePatientInfo; /// /// Related identifiers or resources. @@ -429,29 +421,25 @@ public Hl7.Fhir.Model.ResourceReference SourcePatientInfo [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; protected internal override void CopyToInternal(Base other) { - var dest = other as ContextComponent; - - if (dest == null) - { + if(other is not ContextComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(FacilityType != null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)FacilityType.DeepCopyInternal(); - if(PracticeSetting != null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)PracticeSetting.DeepCopyInternal(); - if(SourcePatientInfo != null) dest.SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)SourcePatientInfo.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_FacilityType is not null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)_FacilityType.DeepCopyInternal(); + if(_PracticeSetting is not null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)_PracticeSetting.DeepCopyInternal(); + if(_SourcePatientInfo is not null) dest.SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)_SourcePatientInfo.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -463,76 +451,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContextComponent; - if(otherT == null) return false; + if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(FacilityType, otherT.FacilityType)) return false; - if(!comparer.Equals(PracticeSetting, otherT.PracticeSetting)) return false; - if(!comparer.Equals(SourcePatientInfo, otherT.SourcePatientInfo)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_FacilityType, otherT._FacilityType)) return false; + if(!comparer.Equals(_PracticeSetting, otherT._PracticeSetting)) return false; + if(!comparer.Equals(_SourcePatientInfo, otherT._SourcePatientInfo)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "facilityType": - value = FacilityType; - return FacilityType is not null; + value = _FacilityType; + return _FacilityType is not null; case "practiceSetting": - value = PracticeSetting; - return PracticeSetting is not null; + value = _PracticeSetting; + return _PracticeSetting is not null; case "sourcePatientInfo": - value = SourcePatientInfo; - return SourcePatientInfo is not null; + value = _SourcePatientInfo; + return _SourcePatientInfo is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "facilityType": - FacilityType = (Hl7.Fhir.Model.CodeableConcept)value; + FacilityType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "practiceSetting": - PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)value; + PracticeSetting = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sourcePatientInfo": - SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)value; + SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; default: return base.SetValue(key, value); @@ -543,13 +531,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (FacilityType is not null) yield return new KeyValuePair("facilityType",FacilityType); - if (PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",PracticeSetting); - if (SourcePatientInfo is not null) yield return new KeyValuePair("sourcePatientInfo",SourcePatientInfo); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_FacilityType is not null) yield return new KeyValuePair("facilityType",_FacilityType); + if (_PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",_PracticeSetting); + if (_SourcePatientInfo is not null) yield return new KeyValuePair("sourcePatientInfo",_SourcePatientInfo); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); } } @@ -576,13 +564,13 @@ public partial class RelatedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Related Resource. @@ -591,26 +579,22 @@ public Hl7.Fhir.Model.Identifier Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Ref + public Hl7.Fhir.Model.ResourceReference? Ref { get { return _Ref; } set { _Ref = value; OnPropertyChanged("Ref"); } } - private Hl7.Fhir.Model.ResourceReference _Ref; + private Hl7.Fhir.Model.ResourceReference? _Ref; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedComponent; - - if (dest == null) - { + if(other is not RelatedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Ref != null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)Ref.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Ref is not null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)_Ref.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -622,41 +606,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedComponent; - if(otherT == null) return false; + if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Ref, otherT.Ref)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Ref, otherT._Ref)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "ref": - value = Ref; - return Ref is not null; + value = _Ref; + return _Ref is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "ref": - Ref = (Hl7.Fhir.Model.ResourceReference)value; + Ref = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -667,8 +651,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Ref is not null) yield return new KeyValuePair("ref",Ref); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Ref is not null) yield return new KeyValuePair("ref",_Ref); } } @@ -678,13 +662,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("masterIdentifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier MasterIdentifier + public Hl7.Fhir.Model.Identifier? MasterIdentifier { get { return _MasterIdentifier; } set { _MasterIdentifier = value; OnPropertyChanged("MasterIdentifier"); } } - private Hl7.Fhir.Model.Identifier _MasterIdentifier; + private Hl7.Fhir.Model.Identifier? _MasterIdentifier; /// /// Other identifiers for the document. @@ -694,11 +678,11 @@ public Hl7.Fhir.Model.Identifier MasterIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | superseded | entered-in-error. @@ -708,13 +692,13 @@ public List Identifier [Binding("DocumentReferenceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | superseded | entered-in-error @@ -723,13 +707,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentReferenceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -741,13 +722,13 @@ public Hl7.Fhir.Model.DocumentReferenceStatus? Status [DeclaredType(Type = typeof(Code))] [Binding("ReferredDocumentStatus")] [DataMember] - public Code DocStatusElement + public Code? DocStatusElement { get { return _DocStatusElement; } set { _DocStatusElement = value; OnPropertyChanged("DocStatusElement"); } } - private Code _DocStatusElement; + private Code? _DocStatusElement; /// /// preliminary | final | appended | amended | entered-in-error @@ -756,13 +737,10 @@ public Code DocStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? DocStatus { - get { return DocStatusElement != null ? DocStatusElement.Value : null; } + get => _DocStatusElement?.Value; set { - if (value == null) - DocStatusElement = null; - else - DocStatusElement = new Code(value); + DocStatusElement = value is null ? null : new Code(value); OnPropertyChanged("DocStatus"); } } @@ -774,13 +752,13 @@ public Hl7.Fhir.Model.CompositionStatus? DocStatus [Binding("DocumentC80Type")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of document. @@ -788,13 +766,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("class", InSummary=true, Order=140, FiveWs="class")] [Binding("DocumentC80Class")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Class + public Hl7.Fhir.Model.CodeableConcept? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.CodeableConcept _Class; + private Hl7.Fhir.Model.CodeableConcept? _Class; /// /// Who/what is the subject of the document. @@ -803,41 +781,38 @@ public Hl7.Fhir.Model.CodeableConcept Class [CLSCompliant(false)] [References("Patient","Practitioner","Group","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Document creation time. /// [FhirElement("created", InSummary=true, Order=160, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Document creation time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -848,13 +823,13 @@ public string Created [FhirElement("indexed", InSummary=true, Order=170, FiveWs="when.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant IndexedElement + public Hl7.Fhir.Model.Instant? IndexedElement { get { return _IndexedElement; } set { _IndexedElement = value; OnPropertyChanged("IndexedElement"); } } - private Hl7.Fhir.Model.Instant _IndexedElement; + private Hl7.Fhir.Model.Instant? _IndexedElement; /// /// When this document reference was created @@ -863,13 +838,10 @@ public Hl7.Fhir.Model.Instant IndexedElement [IgnoreDataMember] public DateTimeOffset? Indexed { - get { return IndexedElement != null ? IndexedElement.Value : null; } + get => _IndexedElement?.Value; set { - if (value == null) - IndexedElement = null; - else - IndexedElement = new Hl7.Fhir.Model.Instant(value); + IndexedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Indexed"); } } @@ -884,11 +856,11 @@ public DateTimeOffset? Indexed [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who/what authenticated the document. @@ -897,13 +869,13 @@ public List Author [CLSCompliant(false)] [References("Practitioner","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authenticator + public Hl7.Fhir.Model.ResourceReference? Authenticator { get { return _Authenticator; } set { _Authenticator = value; OnPropertyChanged("Authenticator"); } } - private Hl7.Fhir.Model.ResourceReference _Authenticator; + private Hl7.Fhir.Model.ResourceReference? _Authenticator; /// /// Organization which maintains the document. @@ -912,13 +884,13 @@ public Hl7.Fhir.Model.ResourceReference Authenticator [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other documents. @@ -928,39 +900,36 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// Human-readable description (title). /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable description (title) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -974,11 +943,11 @@ public string Description [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Document referenced. @@ -988,54 +957,50 @@ public List SecurityLabel [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// Clinical context of document. /// [FhirElement("context", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.DocumentReference.ContextComponent Context + public Hl7.Fhir.Model.DocumentReference.ContextComponent? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.DocumentReference.ContextComponent _Context; + private Hl7.Fhir.Model.DocumentReference.ContextComponent? _Context; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentReference; - - if (dest == null) - { + if(other is not DocumentReference dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MasterIdentifier != null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DocStatusElement != null) dest.DocStatusElement = (Code)DocStatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Class != null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(IndexedElement != null) dest.IndexedElement = (Hl7.Fhir.Model.Instant)IndexedElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Authenticator != null) dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)Authenticator.DeepCopyInternal(); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(Context != null) dest.Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)Context.DeepCopyInternal(); + if(_MasterIdentifier is not null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)_MasterIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DocStatusElement is not null) dest.DocStatusElement = (Code)_DocStatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)_Class.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_IndexedElement is not null) dest.IndexedElement = (Hl7.Fhir.Model.Instant)_IndexedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Authenticator is not null) dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)_Authenticator.DeepCopyInternal(); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)_Context.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1047,146 +1012,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentReference; - if(otherT == null) return false; + if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MasterIdentifier, otherT.MasterIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DocStatusElement, otherT.DocStatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(IndexedElement, otherT.IndexedElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Authenticator, otherT.Authenticator)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DocStatusElement, otherT._DocStatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_IndexedElement, otherT._IndexedElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Authenticator, otherT._Authenticator)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "masterIdentifier": - value = MasterIdentifier; - return MasterIdentifier is not null; + value = _MasterIdentifier; + return _MasterIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "docStatus": - value = DocStatusElement; - return DocStatusElement is not null; + value = _DocStatusElement; + return _DocStatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "indexed": - value = IndexedElement; - return IndexedElement is not null; + value = _IndexedElement; + return _IndexedElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "authenticator": - value = Authenticator; - return Authenticator is not null; + value = _Authenticator; + return _Authenticator is not null; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "masterIdentifier": - MasterIdentifier = (Hl7.Fhir.Model.Identifier)value; + MasterIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "docStatus": - DocStatusElement = (Code)value; + DocStatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "class": - Class = (Hl7.Fhir.Model.CodeableConcept)value; + Class = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "indexed": - IndexedElement = (Hl7.Fhir.Model.Instant)value; + IndexedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "authenticator": - Authenticator = (Hl7.Fhir.Model.ResourceReference)value; + Authenticator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "context": - Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)value; + Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent?)value; return this; default: return base.SetValue(key, value); @@ -1197,23 +1162,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",MasterIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DocStatusElement is not null) yield return new KeyValuePair("docStatus",DocStatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (IndexedElement is not null) yield return new KeyValuePair("indexed",IndexedElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Authenticator is not null) yield return new KeyValuePair("authenticator",Authenticator); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (Context is not null) yield return new KeyValuePair("context",Context); + if (_MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",_MasterIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DocStatusElement is not null) yield return new KeyValuePair("docStatus",_DocStatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_IndexedElement is not null) yield return new KeyValuePair("indexed",_IndexedElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Authenticator is not null) yield return new KeyValuePair("authenticator",_Authenticator); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_Context is not null) yield return new KeyValuePair("context",_Context); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs index b33971f3d..a2eae4d55 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,13 +67,13 @@ public partial class Dosage : Hl7.Fhir.Model.DataType /// [FhirElement("sequence", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Integer SequenceElement + public Hl7.Fhir.Model.Integer? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.Integer _SequenceElement; + private Hl7.Fhir.Model.Integer? _SequenceElement; /// /// The order of the dosage instructions @@ -79,13 +82,10 @@ public Hl7.Fhir.Model.Integer SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.Integer(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Sequence"); } } @@ -95,28 +95,25 @@ public int? Sequence /// [FhirElement("text", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -130,39 +127,36 @@ public string Text [DataMember] public List AdditionalInstruction { - get { if(_AdditionalInstruction==null) _AdditionalInstruction = new List(); return _AdditionalInstruction; } + get => _AdditionalInstruction ?? new List(); set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } - private List _AdditionalInstruction; + private List? _AdditionalInstruction; /// /// Patient or consumer oriented instructions. /// [FhirElement("patientInstruction", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Patient or consumer oriented instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -172,13 +166,13 @@ public string PatientInstruction /// [FhirElement("timing", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Timing Timing + public Hl7.Fhir.Model.Timing? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.Timing _Timing; + private Hl7.Fhir.Model.Timing? _Timing; /// /// Take "as needed" (for x). @@ -188,13 +182,13 @@ public Hl7.Fhir.Model.Timing Timing [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Body site to administer to. @@ -202,13 +196,13 @@ public Hl7.Fhir.Model.DataType AsNeeded [FhirElement("site", InSummary=true, Order=90)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How drug should enter body. @@ -216,13 +210,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", InSummary=true, Order=100)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Technique for administering medication. @@ -230,13 +224,13 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", InSummary=true, Order=110)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication per dose. @@ -245,52 +239,52 @@ public Hl7.Fhir.Model.CodeableConcept Method [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Dose + public Hl7.Fhir.Model.DataType? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.DataType _Dose; + private Hl7.Fhir.Model.DataType? _Dose; /// /// Upper limit on medication per unit of time. /// [FhirElement("maxDosePerPeriod", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Ratio MaxDosePerPeriod + public Hl7.Fhir.Model.Ratio? MaxDosePerPeriod { get { return _MaxDosePerPeriod; } set { _MaxDosePerPeriod = value; OnPropertyChanged("MaxDosePerPeriod"); } } - private Hl7.Fhir.Model.Ratio _MaxDosePerPeriod; + private Hl7.Fhir.Model.Ratio? _MaxDosePerPeriod; /// /// Upper limit on medication per administration. /// [FhirElement("maxDosePerAdministration", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerAdministration + public Hl7.Fhir.Model.Quantity? MaxDosePerAdministration { get { return _MaxDosePerAdministration; } set { _MaxDosePerAdministration = value; OnPropertyChanged("MaxDosePerAdministration"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerAdministration; + private Hl7.Fhir.Model.Quantity? _MaxDosePerAdministration; /// /// Upper limit on medication per lifetime of the patient. /// [FhirElement("maxDosePerLifetime", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerLifetime + public Hl7.Fhir.Model.Quantity? MaxDosePerLifetime { get { return _MaxDosePerLifetime; } set { _MaxDosePerLifetime = value; OnPropertyChanged("MaxDosePerLifetime"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerLifetime; + private Hl7.Fhir.Model.Quantity? _MaxDosePerLifetime; /// /// Amount of medication per unit of time. @@ -299,38 +293,34 @@ public Hl7.Fhir.Model.Quantity MaxDosePerLifetime [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as Dosage; - - if (dest == null) - { + if(other is not Dosage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)SequenceElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(AdditionalInstruction.Any()) dest.AdditionalInstruction = new List(AdditionalInstruction.DeepCopyInternal()); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.Timing)Timing.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.DataType)Dose.DeepCopyInternal(); - if(MaxDosePerPeriod != null) dest.MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)MaxDosePerPeriod.DeepCopyInternal(); - if(MaxDosePerAdministration != null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)MaxDosePerAdministration.DeepCopyInternal(); - if(MaxDosePerLifetime != null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)MaxDosePerLifetime.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)_SequenceElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_AdditionalInstruction is not null) dest.AdditionalInstruction = new List(_AdditionalInstruction.DeepCopyInternal()); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.Timing)_Timing.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.DataType)_Dose.DeepCopyInternal(); + if(_MaxDosePerPeriod is not null) dest.MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)_MaxDosePerPeriod.DeepCopyInternal(); + if(_MaxDosePerAdministration is not null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)_MaxDosePerAdministration.DeepCopyInternal(); + if(_MaxDosePerLifetime is not null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)_MaxDosePerLifetime.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -342,125 +332,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Dosage; - if(otherT == null) return false; + if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(AdditionalInstruction, otherT.AdditionalInstruction)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(MaxDosePerPeriod, otherT.MaxDosePerPeriod)) return false; - if(!comparer.Equals(MaxDosePerAdministration, otherT.MaxDosePerAdministration)) return false; - if(!comparer.Equals(MaxDosePerLifetime, otherT.MaxDosePerLifetime)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_MaxDosePerPeriod, otherT._MaxDosePerPeriod)) return false; + if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; + if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "additionalInstruction": - value = AdditionalInstruction; - return AdditionalInstruction?.Any() == true; + value = _AdditionalInstruction; + return _AdditionalInstruction?.Any() == true; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "maxDosePerPeriod": - value = MaxDosePerPeriod; - return MaxDosePerPeriod is not null; + value = _MaxDosePerPeriod; + return _MaxDosePerPeriod is not null; case "maxDosePerAdministration": - value = MaxDosePerAdministration; - return MaxDosePerAdministration is not null; + value = _MaxDosePerAdministration; + return _MaxDosePerAdministration is not null; case "maxDosePerLifetime": - value = MaxDosePerLifetime; - return MaxDosePerLifetime is not null; + value = _MaxDosePerLifetime; + return _MaxDosePerLifetime is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.Integer)value; + SequenceElement = (Hl7.Fhir.Model.Integer?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "additionalInstruction": - AdditionalInstruction = (List)value; + AdditionalInstruction = (List?)value!; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.Timing)value; + Timing = (Hl7.Fhir.Model.Timing?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.DataType)value; + Dose = (Hl7.Fhir.Model.DataType?)value; return this; case "maxDosePerPeriod": - MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)value; + MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio?)value; return this; case "maxDosePerAdministration": - MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerLifetime": - MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -471,20 +461,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",AdditionalInstruction); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (MaxDosePerPeriod is not null) yield return new KeyValuePair("maxDosePerPeriod",MaxDosePerPeriod); - if (MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",MaxDosePerAdministration); - if (MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",MaxDosePerLifetime); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",_AdditionalInstruction); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_MaxDosePerPeriod is not null) yield return new KeyValuePair("maxDosePerPeriod",_MaxDosePerPeriod); + if (_MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",_MaxDosePerAdministration); + if (_MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",_MaxDosePerLifetime); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Duration.cs b/src/Hl7.Fhir.STU3/Model/Generated/Duration.cs index 34316d2e6..a71cf549e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Duration.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Duration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs index c91877503..e1ae6fca0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -270,39 +273,36 @@ public partial class SlicingComponent : Hl7.Fhir.Model.Element [DataMember] public List Discriminator { - get { if(_Discriminator==null) _Discriminator = new List(); return _Discriminator; } + get => _Discriminator ?? new List(); set { _Discriminator = value; OnPropertyChanged("Discriminator"); } } - private List _Discriminator; + private List? _Discriminator; /// /// Text description of how slicing works (or not). /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Text description of how slicing works (or not) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -312,13 +312,13 @@ public string Description /// [FhirElement("ordered", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OrderedElement + public Hl7.Fhir.Model.FhirBoolean? OrderedElement { get { return _OrderedElement; } set { _OrderedElement = value; OnPropertyChanged("OrderedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OrderedElement; + private Hl7.Fhir.Model.FhirBoolean? _OrderedElement; /// /// If elements must be in same order as slices @@ -327,13 +327,10 @@ public Hl7.Fhir.Model.FhirBoolean OrderedElement [IgnoreDataMember] public bool? Ordered { - get { return OrderedElement != null ? OrderedElement.Value : null; } + get => _OrderedElement?.Value; set { - if (value == null) - OrderedElement = null; - else - OrderedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OrderedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Ordered"); } } @@ -346,13 +343,13 @@ public bool? Ordered [Binding("SlicingRules")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RulesElement + public Code? RulesElement { get { return _RulesElement; } set { _RulesElement = value; OnPropertyChanged("RulesElement"); } } - private Code _RulesElement; + private Code? _RulesElement; /// /// closed | open | openAtEnd @@ -361,31 +358,24 @@ public Code RulesElement [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.SlicingRules? Rules { - get { return RulesElement != null ? RulesElement.Value : null; } + get => _RulesElement?.Value; set { - if (value == null) - RulesElement = null; - else - RulesElement = new Code(value); + RulesElement = value is null ? null : new Code(value); OnPropertyChanged("Rules"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SlicingComponent; - - if (dest == null) - { + if(other is not SlicingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Discriminator.Any()) dest.Discriminator = new List(Discriminator.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OrderedElement != null) dest.OrderedElement = (Hl7.Fhir.Model.FhirBoolean)OrderedElement.DeepCopyInternal(); - if(RulesElement != null) dest.RulesElement = (Code)RulesElement.DeepCopyInternal(); + if(_Discriminator is not null) dest.Discriminator = new List(_Discriminator.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OrderedElement is not null) dest.OrderedElement = (Hl7.Fhir.Model.FhirBoolean)_OrderedElement.DeepCopyInternal(); + if(_RulesElement is not null) dest.RulesElement = (Code)_RulesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -397,55 +387,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SlicingComponent; - if(otherT == null) return false; + if(other is not SlicingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Discriminator, otherT.Discriminator)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(OrderedElement, otherT.OrderedElement)) return false; - if(!comparer.Equals(RulesElement, otherT.RulesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_OrderedElement, otherT._OrderedElement)) return false; + if(!comparer.Equals(_RulesElement, otherT._RulesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "discriminator": - value = Discriminator; - return Discriminator?.Any() == true; + value = _Discriminator; + return _Discriminator?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "ordered": - value = OrderedElement; - return OrderedElement is not null; + value = _OrderedElement; + return _OrderedElement is not null; case "rules": - value = RulesElement; - return RulesElement is not null; + value = _RulesElement; + return _RulesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "discriminator": - Discriminator = (List)value; + Discriminator = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "ordered": - OrderedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OrderedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "rules": - RulesElement = (Code)value; + RulesElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -456,10 +446,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Discriminator?.Any() == true) yield return new KeyValuePair("discriminator",Discriminator); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OrderedElement is not null) yield return new KeyValuePair("ordered",OrderedElement); - if (RulesElement is not null) yield return new KeyValuePair("rules",RulesElement); + if (_Discriminator?.Any() == true) yield return new KeyValuePair("discriminator",_Discriminator); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OrderedElement is not null) yield return new KeyValuePair("ordered",_OrderedElement); + if (_RulesElement is not null) yield return new KeyValuePair("rules",_RulesElement); } } @@ -489,13 +479,13 @@ public partial class DiscriminatorComponent : Hl7.Fhir.Model.Element [Binding("DiscriminatorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// value | exists | pattern | type | profile @@ -504,13 +494,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.DiscriminatorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -521,44 +508,37 @@ public Hl7.Fhir.Model.ElementDefinition.DiscriminatorType? Type [FhirElement("path", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path to element value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DiscriminatorComponent; - - if (dest == null) - { + if(other is not DiscriminatorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -570,41 +550,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiscriminatorComponent; - if(otherT == null) return false; + if(other is not DiscriminatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -615,8 +595,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); } } @@ -644,28 +624,25 @@ public partial class BaseComponent : Hl7.Fhir.Model.Element [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path that identifies the base element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -676,13 +653,13 @@ public string Path [FhirElement("min", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Min cardinality of the base element @@ -691,13 +668,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -708,45 +682,38 @@ public int? Min [FhirElement("max", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Max cardinality of the base element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BaseComponent; - - if (dest == null) - { + if(other is not BaseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -758,48 +725,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BaseComponent; - if(otherT == null) return false; + if(other is not BaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -810,9 +777,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); } } @@ -841,28 +808,25 @@ public partial class TypeRefComponent : Hl7.Fhir.Model.Element [Binding("FHIRDefinedTypeExt")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri CodeElement + public Hl7.Fhir.Model.FhirUri? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.FhirUri _CodeElement; + private Hl7.Fhir.Model.FhirUri? _CodeElement; /// /// Data type or Resource (reference to definition) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.FhirUri(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Code"); } } @@ -872,28 +836,25 @@ public string Code /// [FhirElement("profile", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri ProfileElement + public Hl7.Fhir.Model.FhirUri? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.FhirUri _ProfileElement; + private Hl7.Fhir.Model.FhirUri? _ProfileElement; /// /// Profile (StructureDefinition) to apply (or IG) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.FhirUri(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Profile"); } } @@ -903,28 +864,25 @@ public string Profile /// [FhirElement("targetProfile", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri TargetProfileElement + public Hl7.Fhir.Model.FhirUri? TargetProfileElement { get { return _TargetProfileElement; } set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } - private Hl7.Fhir.Model.FhirUri _TargetProfileElement; + private Hl7.Fhir.Model.FhirUri? _TargetProfileElement; /// /// Profile (StructureDefinition) to apply to reference target (or IG) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetProfile + public string? TargetProfile { - get { return TargetProfileElement != null ? TargetProfileElement.Value : null; } + get => _TargetProfileElement?.Value; set { - if (value == null) - TargetProfileElement = null; - else - TargetProfileElement = new Hl7.Fhir.Model.FhirUri(value); + TargetProfileElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("TargetProfile"); } } @@ -939,24 +897,24 @@ public string TargetProfile [DataMember] public List> AggregationElement { - get { if(_AggregationElement==null) _AggregationElement = new List>(); return _AggregationElement; } + get => _AggregationElement ?? new List>(); set { _AggregationElement = value; OnPropertyChanged("AggregationElement"); } } - private List> _AggregationElement; + private List>? _AggregationElement; /// /// contained | referenced | bundled - how aggregated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Aggregation + public IEnumerable? Aggregation { - get { return AggregationElement != null ? AggregationElement.Select(elem => elem.Value) : null; } + get => _AggregationElement?.Select(elem => elem.Value); set { if (value == null) - AggregationElement = null; + AggregationElement = null!; else AggregationElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Aggregation"); @@ -970,13 +928,13 @@ public IEnumerable Aggregatio [DeclaredType(Type = typeof(Code))] [Binding("ReferenceVersionRules")] [DataMember] - public Code VersioningElement + public Code? VersioningElement { get { return _VersioningElement; } set { _VersioningElement = value; OnPropertyChanged("VersioningElement"); } } - private Code _VersioningElement; + private Code? _VersioningElement; /// /// either | independent | specific @@ -985,32 +943,25 @@ public Code VersioningEl [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.ReferenceVersionRules? Versioning { - get { return VersioningElement != null ? VersioningElement.Value : null; } + get => _VersioningElement?.Value; set { - if (value == null) - VersioningElement = null; - else - VersioningElement = new Code(value); + VersioningElement = value is null ? null : new Code(value); OnPropertyChanged("Versioning"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TypeRefComponent; - - if (dest == null) - { + if(other is not TypeRefComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.FhirUri)CodeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.FhirUri)ProfileElement.DeepCopyInternal(); - if(TargetProfileElement != null) dest.TargetProfileElement = (Hl7.Fhir.Model.FhirUri)TargetProfileElement.DeepCopyInternal(); - if(AggregationElement.Any()) dest.AggregationElement = new List>(AggregationElement.DeepCopyInternal()); - if(VersioningElement != null) dest.VersioningElement = (Code)VersioningElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.FhirUri)_CodeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.FhirUri)_ProfileElement.DeepCopyInternal(); + if(_TargetProfileElement is not null) dest.TargetProfileElement = (Hl7.Fhir.Model.FhirUri)_TargetProfileElement.DeepCopyInternal(); + if(_AggregationElement is not null) dest.AggregationElement = new List>(_AggregationElement.DeepCopyInternal()); + if(_VersioningElement is not null) dest.VersioningElement = (Code)_VersioningElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1022,62 +973,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TypeRefComponent; - if(otherT == null) return false; + if(other is not TypeRefComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(TargetProfileElement, otherT.TargetProfileElement)) return false; - if(!comparer.ListEquals(AggregationElement, otherT.AggregationElement)) return false; - if(!comparer.Equals(VersioningElement, otherT.VersioningElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_TargetProfileElement, otherT._TargetProfileElement)) return false; + if(!comparer.ListEquals(_AggregationElement, otherT._AggregationElement)) return false; + if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "targetProfile": - value = TargetProfileElement; - return TargetProfileElement is not null; + value = _TargetProfileElement; + return _TargetProfileElement is not null; case "aggregation": - value = AggregationElement; - return AggregationElement?.Any() == true; + value = _AggregationElement; + return _AggregationElement?.Any() == true; case "versioning": - value = VersioningElement; - return VersioningElement is not null; + value = _VersioningElement; + return _VersioningElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.FhirUri)value; + CodeElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.FhirUri)value; + ProfileElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "targetProfile": - TargetProfileElement = (Hl7.Fhir.Model.FhirUri)value; + TargetProfileElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "aggregation": - AggregationElement = (List>)value; + AggregationElement = (List>?)value!; return this; case "versioning": - VersioningElement = (Code)value; + VersioningElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -1088,11 +1039,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (TargetProfileElement is not null) yield return new KeyValuePair("targetProfile",TargetProfileElement); - if (AggregationElement?.Any() == true) yield return new KeyValuePair("aggregation",AggregationElement); - if (VersioningElement is not null) yield return new KeyValuePair("versioning",VersioningElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_TargetProfileElement is not null) yield return new KeyValuePair("targetProfile",_TargetProfileElement); + if (_AggregationElement?.Any() == true) yield return new KeyValuePair("aggregation",_AggregationElement); + if (_VersioningElement is not null) yield return new KeyValuePair("versioning",_VersioningElement); } } @@ -1120,28 +1071,25 @@ public partial class ExampleComponent : Hl7.Fhir.Model.Element [FhirElement("label", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Describes the purpose of this example /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -1154,26 +1102,22 @@ public string Label [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ExampleComponent; - - if (dest == null) - { + if(other is not ExampleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1185,41 +1129,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExampleComponent; - if(otherT == null) return false; + if(other is not ExampleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1230,8 +1174,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1259,28 +1203,25 @@ public partial class ConstraintComponent : Hl7.Fhir.Model.Element [FhirElement("key", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id KeyElement + public Hl7.Fhir.Model.Id? KeyElement { get { return _KeyElement; } set { _KeyElement = value; OnPropertyChanged("KeyElement"); } } - private Hl7.Fhir.Model.Id _KeyElement; + private Hl7.Fhir.Model.Id? _KeyElement; /// /// Target of 'condition' reference above /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Key + public string? Key { - get { return KeyElement != null ? KeyElement.Value : null; } + get => _KeyElement?.Value; set { - if (value == null) - KeyElement = null; - else - KeyElement = new Hl7.Fhir.Model.Id(value); + KeyElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Key"); } } @@ -1290,28 +1231,25 @@ public string Key /// [FhirElement("requirements", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString RequirementsElement + public Hl7.Fhir.Model.FhirString? RequirementsElement { get { return _RequirementsElement; } set { _RequirementsElement = value; OnPropertyChanged("RequirementsElement"); } } - private Hl7.Fhir.Model.FhirString _RequirementsElement; + private Hl7.Fhir.Model.FhirString? _RequirementsElement; /// /// Why this constraint is necessary or appropriate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirements + public string? Requirements { - get { return RequirementsElement != null ? RequirementsElement.Value : null; } + get => _RequirementsElement?.Value; set { - if (value == null) - RequirementsElement = null; - else - RequirementsElement = new Hl7.Fhir.Model.FhirString(value); + RequirementsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Requirements"); } } @@ -1324,13 +1262,13 @@ public string Requirements [Binding("ConstraintSeverity")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// error | warning @@ -1339,13 +1277,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.ElementDefinition.ConstraintSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -1356,28 +1291,25 @@ public Hl7.Fhir.Model.ElementDefinition.ConstraintSeverity? Severity [FhirElement("human", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString HumanElement + public Hl7.Fhir.Model.FhirString? HumanElement { get { return _HumanElement; } set { _HumanElement = value; OnPropertyChanged("HumanElement"); } } - private Hl7.Fhir.Model.FhirString _HumanElement; + private Hl7.Fhir.Model.FhirString? _HumanElement; /// /// Human description of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Human + public string? Human { - get { return HumanElement != null ? HumanElement.Value : null; } + get => _HumanElement?.Value; set { - if (value == null) - HumanElement = null; - else - HumanElement = new Hl7.Fhir.Model.FhirString(value); + HumanElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Human"); } } @@ -1388,28 +1320,25 @@ public string Human [FhirElement("expression", InSummary=true, Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// FHIRPath expression of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -1423,28 +1352,25 @@ public string Expression [FhirElement("xpath", InSummary=true, Order=80)] [NotMapped(Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirString XpathElement + public Hl7.Fhir.Model.FhirString? XpathElement { get { return _XpathElement; } set { _XpathElement = value; OnPropertyChanged("XpathElement"); } } - private Hl7.Fhir.Model.FhirString _XpathElement; + private Hl7.Fhir.Model.FhirString? _XpathElement; /// /// XPath expression of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Xpath + public string? Xpath { - get { return XpathElement != null ? XpathElement.Value : null; } + get => _XpathElement?.Value; set { - if (value == null) - XpathElement = null; - else - XpathElement = new Hl7.Fhir.Model.FhirString(value); + XpathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Xpath"); } } @@ -1454,49 +1380,42 @@ public string Xpath /// [FhirElement("source", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// Reference to original source of constraint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ConstraintComponent; - - if (dest == null) - { + if(other is not ConstraintComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KeyElement != null) dest.KeyElement = (Hl7.Fhir.Model.Id)KeyElement.DeepCopyInternal(); - if(RequirementsElement != null) dest.RequirementsElement = (Hl7.Fhir.Model.FhirString)RequirementsElement.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(HumanElement != null) dest.HumanElement = (Hl7.Fhir.Model.FhirString)HumanElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(XpathElement != null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)XpathElement.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); + if(_KeyElement is not null) dest.KeyElement = (Hl7.Fhir.Model.Id)_KeyElement.DeepCopyInternal(); + if(_RequirementsElement is not null) dest.RequirementsElement = (Hl7.Fhir.Model.FhirString)_RequirementsElement.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_HumanElement is not null) dest.HumanElement = (Hl7.Fhir.Model.FhirString)_HumanElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_XpathElement is not null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)_XpathElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1508,76 +1427,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConstraintComponent; - if(otherT == null) return false; + if(other is not ConstraintComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KeyElement, otherT.KeyElement)) return false; - if(!comparer.Equals(RequirementsElement, otherT.RequirementsElement)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(HumanElement, otherT.HumanElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(XpathElement, otherT.XpathElement)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + if(!comparer.Equals(_RequirementsElement, otherT._RequirementsElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_HumanElement, otherT._HumanElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "key": - value = KeyElement; - return KeyElement is not null; + value = _KeyElement; + return _KeyElement is not null; case "requirements": - value = RequirementsElement; - return RequirementsElement is not null; + value = _RequirementsElement; + return _RequirementsElement is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "human": - value = HumanElement; - return HumanElement is not null; + value = _HumanElement; + return _HumanElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "xpath": - value = XpathElement; - return XpathElement is not null; + value = _XpathElement; + return _XpathElement is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "key": - KeyElement = (Hl7.Fhir.Model.Id)value; + KeyElement = (Hl7.Fhir.Model.Id?)value; return this; case "requirements": - RequirementsElement = (Hl7.Fhir.Model.FhirString)value; + RequirementsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "human": - HumanElement = (Hl7.Fhir.Model.FhirString)value; + HumanElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpath": - XpathElement = (Hl7.Fhir.Model.FhirString)value; + XpathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -1588,13 +1507,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KeyElement is not null) yield return new KeyValuePair("key",KeyElement); - if (RequirementsElement is not null) yield return new KeyValuePair("requirements",RequirementsElement); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (HumanElement is not null) yield return new KeyValuePair("human",HumanElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (XpathElement is not null) yield return new KeyValuePair("xpath",XpathElement); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); + if (_KeyElement is not null) yield return new KeyValuePair("key",_KeyElement); + if (_RequirementsElement is not null) yield return new KeyValuePair("requirements",_RequirementsElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_HumanElement is not null) yield return new KeyValuePair("human",_HumanElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_XpathElement is not null) yield return new KeyValuePair("xpath",_XpathElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); } } @@ -1624,13 +1543,13 @@ public partial class ElementDefinitionBindingComponent : Hl7.Fhir.Model.Element [Binding("BindingStrength")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StrengthElement + public Code? StrengthElement { get { return _StrengthElement; } set { _StrengthElement = value; OnPropertyChanged("StrengthElement"); } } - private Code _StrengthElement; + private Code? _StrengthElement; /// /// required | extensible | preferred | example @@ -1639,13 +1558,10 @@ public Code StrengthElement [IgnoreDataMember] public Hl7.Fhir.Model.BindingStrength? Strength { - get { return StrengthElement != null ? StrengthElement.Value : null; } + get => _StrengthElement?.Value; set { - if (value == null) - StrengthElement = null; - else - StrengthElement = new Code(value); + StrengthElement = value is null ? null : new Code(value); OnPropertyChanged("Strength"); } } @@ -1655,28 +1571,25 @@ public Hl7.Fhir.Model.BindingStrength? Strength /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human explanation of the value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1689,27 +1602,23 @@ public string Description [References("ValueSet")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType ValueSet + public Hl7.Fhir.Model.DataType? ValueSet { get { return _ValueSet; } set { _ValueSet = value; OnPropertyChanged("ValueSet"); } } - private Hl7.Fhir.Model.DataType _ValueSet; + private Hl7.Fhir.Model.DataType? _ValueSet; protected internal override void CopyToInternal(Base other) { - var dest = other as ElementDefinitionBindingComponent; - - if (dest == null) - { + if(other is not ElementDefinitionBindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StrengthElement != null) dest.StrengthElement = (Code)StrengthElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ValueSet != null) dest.ValueSet = (Hl7.Fhir.Model.DataType)ValueSet.DeepCopyInternal(); + if(_StrengthElement is not null) dest.StrengthElement = (Code)_StrengthElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ValueSet is not null) dest.ValueSet = (Hl7.Fhir.Model.DataType)_ValueSet.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1721,48 +1630,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ElementDefinitionBindingComponent; - if(otherT == null) return false; + if(other is not ElementDefinitionBindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StrengthElement, otherT.StrengthElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ValueSet, otherT.ValueSet)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ValueSet, otherT._ValueSet)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "strength": - value = StrengthElement; - return StrengthElement is not null; + value = _StrengthElement; + return _StrengthElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "valueSet": - value = ValueSet; - return ValueSet is not null; + value = _ValueSet; + return _ValueSet is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "strength": - StrengthElement = (Code)value; + StrengthElement = (Code?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSet = (Hl7.Fhir.Model.DataType)value; + ValueSet = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1773,9 +1682,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StrengthElement is not null) yield return new KeyValuePair("strength",StrengthElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ValueSet is not null) yield return new KeyValuePair("valueSet",ValueSet); + if (_StrengthElement is not null) yield return new KeyValuePair("strength",_StrengthElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ValueSet is not null) yield return new KeyValuePair("valueSet",_ValueSet); } } @@ -1803,28 +1712,25 @@ public partial class MappingComponent : Hl7.Fhir.Model.Element [FhirElement("identity", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentityElement + public Hl7.Fhir.Model.Id? IdentityElement { get { return _IdentityElement; } set { _IdentityElement = value; OnPropertyChanged("IdentityElement"); } } - private Hl7.Fhir.Model.Id _IdentityElement; + private Hl7.Fhir.Model.Id? _IdentityElement; /// /// Reference to mapping declaration /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identity + public string? Identity { - get { return IdentityElement != null ? IdentityElement.Value : null; } + get => _IdentityElement?.Value; set { - if (value == null) - IdentityElement = null; - else - IdentityElement = new Hl7.Fhir.Model.Id(value); + IdentityElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identity"); } } @@ -1835,28 +1741,25 @@ public string Identity [FhirElement("language", InSummary=true, Order=40)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Computable language of mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -1867,28 +1770,25 @@ public string Language [FhirElement("map", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MapElement + public Hl7.Fhir.Model.FhirString? MapElement { get { return _MapElement; } set { _MapElement = value; OnPropertyChanged("MapElement"); } } - private Hl7.Fhir.Model.FhirString _MapElement; + private Hl7.Fhir.Model.FhirString? _MapElement; /// /// Details of the mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Map + public string? Map { - get { return MapElement != null ? MapElement.Value : null; } + get => _MapElement?.Value; set { - if (value == null) - MapElement = null; - else - MapElement = new Hl7.Fhir.Model.FhirString(value); + MapElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Map"); } } @@ -1898,46 +1798,39 @@ public string Map /// [FhirElement("comment", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments about the mapping or its use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MappingComponent; - - if (dest == null) - { + if(other is not MappingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdentityElement != null) dest.IdentityElement = (Hl7.Fhir.Model.Id)IdentityElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(MapElement != null) dest.MapElement = (Hl7.Fhir.Model.FhirString)MapElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_IdentityElement is not null) dest.IdentityElement = (Hl7.Fhir.Model.Id)_IdentityElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_MapElement is not null) dest.MapElement = (Hl7.Fhir.Model.FhirString)_MapElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1949,55 +1842,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MappingComponent; - if(otherT == null) return false; + if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentityElement, otherT.IdentityElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(MapElement, otherT.MapElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_MapElement, otherT._MapElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identity": - value = IdentityElement; - return IdentityElement is not null; + value = _IdentityElement; + return _IdentityElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "map": - value = MapElement; - return MapElement is not null; + value = _MapElement; + return _MapElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identity": - IdentityElement = (Hl7.Fhir.Model.Id)value; + IdentityElement = (Hl7.Fhir.Model.Id?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "map": - MapElement = (Hl7.Fhir.Model.FhirString)value; + MapElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2008,10 +1901,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentityElement is not null) yield return new KeyValuePair("identity",IdentityElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (MapElement is not null) yield return new KeyValuePair("map",MapElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_IdentityElement is not null) yield return new KeyValuePair("identity",_IdentityElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_MapElement is not null) yield return new KeyValuePair("map",_MapElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -2022,28 +1915,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path of the element in the hierarchy of elements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -2058,24 +1948,24 @@ public string Path [DataMember] public List> RepresentationElement { - get { if(_RepresentationElement==null) _RepresentationElement = new List>(); return _RepresentationElement; } + get => _RepresentationElement ?? new List>(); set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } - private List> _RepresentationElement; + private List>? _RepresentationElement; /// /// xmlAttr | xmlText | typeAttr | cdaText | xhtml /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Representation + public IEnumerable? Representation { - get { return RepresentationElement != null ? RepresentationElement.Select(elem => elem.Value) : null; } + get => _RepresentationElement?.Select(elem => elem.Value); set { if (value == null) - RepresentationElement = null; + RepresentationElement = null!; else RepresentationElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Representation"); @@ -2087,28 +1977,25 @@ public IEnumerable Rep /// [FhirElement("sliceName", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SliceNameElement + public Hl7.Fhir.Model.FhirString? SliceNameElement { get { return _SliceNameElement; } set { _SliceNameElement = value; OnPropertyChanged("SliceNameElement"); } } - private Hl7.Fhir.Model.FhirString _SliceNameElement; + private Hl7.Fhir.Model.FhirString? _SliceNameElement; /// /// Name for this particular element (in a set of slices) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SliceName + public string? SliceName { - get { return SliceNameElement != null ? SliceNameElement.Value : null; } + get => _SliceNameElement?.Value; set { - if (value == null) - SliceNameElement = null; - else - SliceNameElement = new Hl7.Fhir.Model.FhirString(value); + SliceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SliceName"); } } @@ -2118,28 +2005,25 @@ public string SliceName /// [FhirElement("label", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Name for element to display with or prompt for element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2153,52 +2037,49 @@ public string Label [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// This element is sliced - slices follow. /// [FhirElement("slicing", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.ElementDefinition.SlicingComponent Slicing + public Hl7.Fhir.Model.ElementDefinition.SlicingComponent? Slicing { get { return _Slicing; } set { _Slicing = value; OnPropertyChanged("Slicing"); } } - private Hl7.Fhir.Model.ElementDefinition.SlicingComponent _Slicing; + private Hl7.Fhir.Model.ElementDefinition.SlicingComponent? _Slicing; /// /// Concise definition for space-constrained presentation. /// [FhirElement("short", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortElement + public Hl7.Fhir.Model.FhirString? ShortElement { get { return _ShortElement; } set { _ShortElement = value; OnPropertyChanged("ShortElement"); } } - private Hl7.Fhir.Model.FhirString _ShortElement; + private Hl7.Fhir.Model.FhirString? _ShortElement; /// /// Concise definition for space-constrained presentation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Short + public string? Short { - get { return ShortElement != null ? ShortElement.Value : null; } + get => _ShortElement?.Value; set { - if (value == null) - ShortElement = null; - else - ShortElement = new Hl7.Fhir.Model.FhirString(value); + ShortElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Short"); } } @@ -2208,28 +2089,25 @@ public string Short /// [FhirElement("definition", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Markdown DefinitionElement + public Hl7.Fhir.Model.Markdown? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Markdown _DefinitionElement; + private Hl7.Fhir.Model.Markdown? _DefinitionElement; /// /// Full formal definition as narrative text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Markdown(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Definition"); } } @@ -2239,28 +2117,25 @@ public string Definition /// [FhirElement("comment", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Comments about the use of this element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -2270,28 +2145,25 @@ public string Comment /// [FhirElement("requirements", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Markdown RequirementsElement + public Hl7.Fhir.Model.Markdown? RequirementsElement { get { return _RequirementsElement; } set { _RequirementsElement = value; OnPropertyChanged("RequirementsElement"); } } - private Hl7.Fhir.Model.Markdown _RequirementsElement; + private Hl7.Fhir.Model.Markdown? _RequirementsElement; /// /// Why this resource has been created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirements + public string? Requirements { - get { return RequirementsElement != null ? RequirementsElement.Value : null; } + get => _RequirementsElement?.Value; set { - if (value == null) - RequirementsElement = null; - else - RequirementsElement = new Hl7.Fhir.Model.Markdown(value); + RequirementsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Requirements"); } } @@ -2304,24 +2176,24 @@ public string Requirements [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Other names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -2333,13 +2205,13 @@ public IEnumerable Alias /// [FhirElement("min", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Minimum Cardinality @@ -2348,13 +2220,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -2364,28 +2233,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum Cardinality (a number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -2395,41 +2261,38 @@ public string Max /// [FhirElement("base", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.ElementDefinition.BaseComponent Base + public Hl7.Fhir.Model.ElementDefinition.BaseComponent? Base { get { return _Base; } set { _Base = value; OnPropertyChanged("Base"); } } - private Hl7.Fhir.Model.ElementDefinition.BaseComponent _Base; + private Hl7.Fhir.Model.ElementDefinition.BaseComponent? _Base; /// /// Reference to definition of content for the element. /// [FhirElement("contentReference", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirUri ContentReferenceElement + public Hl7.Fhir.Model.FhirUri? ContentReferenceElement { get { return _ContentReferenceElement; } set { _ContentReferenceElement = value; OnPropertyChanged("ContentReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ContentReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ContentReferenceElement; /// /// Reference to definition of content for the element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentReference + public string? ContentReference { - get { return ContentReferenceElement != null ? ContentReferenceElement.Value : null; } + get => _ContentReferenceElement?.Value; set { - if (value == null) - ContentReferenceElement = null; - else - ContentReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ContentReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("ContentReference"); } } @@ -2442,11 +2305,11 @@ public string ContentReference [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specified value if missing from instance. @@ -2455,41 +2318,38 @@ public List Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Meta))] [DataMember] - public Hl7.Fhir.Model.DataType DefaultValue + public Hl7.Fhir.Model.DataType? DefaultValue { get { return _DefaultValue; } set { _DefaultValue = value; OnPropertyChanged("DefaultValue"); } } - private Hl7.Fhir.Model.DataType _DefaultValue; + private Hl7.Fhir.Model.DataType? _DefaultValue; /// /// Implicit meaning when this element is missing. /// [FhirElement("meaningWhenMissing", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown MeaningWhenMissingElement + public Hl7.Fhir.Model.Markdown? MeaningWhenMissingElement { get { return _MeaningWhenMissingElement; } set { _MeaningWhenMissingElement = value; OnPropertyChanged("MeaningWhenMissingElement"); } } - private Hl7.Fhir.Model.Markdown _MeaningWhenMissingElement; + private Hl7.Fhir.Model.Markdown? _MeaningWhenMissingElement; /// /// Implicit meaning when this element is missing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeaningWhenMissing + public string? MeaningWhenMissing { - get { return MeaningWhenMissingElement != null ? MeaningWhenMissingElement.Value : null; } + get => _MeaningWhenMissingElement?.Value; set { - if (value == null) - MeaningWhenMissingElement = null; - else - MeaningWhenMissingElement = new Hl7.Fhir.Model.Markdown(value); + MeaningWhenMissingElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("MeaningWhenMissing"); } } @@ -2499,28 +2359,25 @@ public string MeaningWhenMissing /// [FhirElement("orderMeaning", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString OrderMeaningElement + public Hl7.Fhir.Model.FhirString? OrderMeaningElement { get { return _OrderMeaningElement; } set { _OrderMeaningElement = value; OnPropertyChanged("OrderMeaningElement"); } } - private Hl7.Fhir.Model.FhirString _OrderMeaningElement; + private Hl7.Fhir.Model.FhirString? _OrderMeaningElement; /// /// What the order of the elements means /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OrderMeaning + public string? OrderMeaning { - get { return OrderMeaningElement != null ? OrderMeaningElement.Value : null; } + get => _OrderMeaningElement?.Value; set { - if (value == null) - OrderMeaningElement = null; - else - OrderMeaningElement = new Hl7.Fhir.Model.FhirString(value); + OrderMeaningElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OrderMeaning"); } } @@ -2532,13 +2389,13 @@ public string OrderMeaning [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Meta))] [DataMember] - public Hl7.Fhir.Model.DataType Fixed + public Hl7.Fhir.Model.DataType? Fixed { get { return _Fixed; } set { _Fixed = value; OnPropertyChanged("Fixed"); } } - private Hl7.Fhir.Model.DataType _Fixed; + private Hl7.Fhir.Model.DataType? _Fixed; /// /// Value must have at least these property values. @@ -2547,13 +2404,13 @@ public Hl7.Fhir.Model.DataType Fixed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Meta))] [DataMember] - public Hl7.Fhir.Model.DataType Pattern + public Hl7.Fhir.Model.DataType? Pattern { get { return _Pattern; } set { _Pattern = value; OnPropertyChanged("Pattern"); } } - private Hl7.Fhir.Model.DataType _Pattern; + private Hl7.Fhir.Model.DataType? _Pattern; /// /// Example value (as defined for type). @@ -2563,11 +2420,11 @@ public Hl7.Fhir.Model.DataType Pattern [DataMember] public List Example { - get { if(_Example==null) _Example = new List(); return _Example; } + get => _Example ?? new List(); set { _Example = value; OnPropertyChanged("Example"); } } - private List _Example; + private List? _Example; /// /// Minimum Allowed Value (for some types). @@ -2576,13 +2433,13 @@ public List Example [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType MinValue + public Hl7.Fhir.Model.DataType? MinValue { get { return _MinValue; } set { _MinValue = value; OnPropertyChanged("MinValue"); } } - private Hl7.Fhir.Model.DataType _MinValue; + private Hl7.Fhir.Model.DataType? _MinValue; /// /// Maximum Allowed Value (for some types). @@ -2591,26 +2448,26 @@ public Hl7.Fhir.Model.DataType MinValue [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType MaxValue + public Hl7.Fhir.Model.DataType? MaxValue { get { return _MaxValue; } set { _MaxValue = value; OnPropertyChanged("MaxValue"); } } - private Hl7.Fhir.Model.DataType _MaxValue; + private Hl7.Fhir.Model.DataType? _MaxValue; /// /// Max length for strings. /// [FhirElement("maxLength", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Integer MaxLengthElement + public Hl7.Fhir.Model.Integer? MaxLengthElement { get { return _MaxLengthElement; } set { _MaxLengthElement = value; OnPropertyChanged("MaxLengthElement"); } } - private Hl7.Fhir.Model.Integer _MaxLengthElement; + private Hl7.Fhir.Model.Integer? _MaxLengthElement; /// /// Max length for strings @@ -2619,13 +2476,10 @@ public Hl7.Fhir.Model.Integer MaxLengthElement [IgnoreDataMember] public int? MaxLength { - get { return MaxLengthElement != null ? MaxLengthElement.Value : null; } + get => _MaxLengthElement?.Value; set { - if (value == null) - MaxLengthElement = null; - else - MaxLengthElement = new Hl7.Fhir.Model.Integer(value); + MaxLengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("MaxLength"); } } @@ -2638,24 +2492,24 @@ public int? MaxLength [DataMember] public List ConditionElement { - get { if(_ConditionElement==null) _ConditionElement = new List(); return _ConditionElement; } + get => _ConditionElement ?? new List(); set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private List _ConditionElement; + private List? _ConditionElement; /// /// Reference to invariant about presence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Condition + public IEnumerable? Condition { - get { return ConditionElement != null ? ConditionElement.Select(elem => elem.Value) : null; } + get => _ConditionElement?.Select(elem => elem.Value); set { if (value == null) - ConditionElement = null; + ConditionElement = null!; else ConditionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Id(elem))); OnPropertyChanged("Condition"); @@ -2670,24 +2524,24 @@ public IEnumerable Condition [DataMember] public List Constraint { - get { if(_Constraint==null) _Constraint = new List(); return _Constraint; } + get => _Constraint ?? new List(); set { _Constraint = value; OnPropertyChanged("Constraint"); } } - private List _Constraint; + private List? _Constraint; /// /// If the element must supported. /// [FhirElement("mustSupport", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MustSupportElement + public Hl7.Fhir.Model.FhirBoolean? MustSupportElement { get { return _MustSupportElement; } set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MustSupportElement; + private Hl7.Fhir.Model.FhirBoolean? _MustSupportElement; /// /// If the element must supported @@ -2696,13 +2550,10 @@ public Hl7.Fhir.Model.FhirBoolean MustSupportElement [IgnoreDataMember] public bool? MustSupport { - get { return MustSupportElement != null ? MustSupportElement.Value : null; } + get => _MustSupportElement?.Value; set { - if (value == null) - MustSupportElement = null; - else - MustSupportElement = new Hl7.Fhir.Model.FhirBoolean(value); + MustSupportElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MustSupport"); } } @@ -2712,13 +2563,13 @@ public bool? MustSupport /// [FhirElement("isModifier", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsModifierElement + public Hl7.Fhir.Model.FhirBoolean? IsModifierElement { get { return _IsModifierElement; } set { _IsModifierElement = value; OnPropertyChanged("IsModifierElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsModifierElement; + private Hl7.Fhir.Model.FhirBoolean? _IsModifierElement; /// /// If this modifies the meaning of other elements @@ -2727,13 +2578,10 @@ public Hl7.Fhir.Model.FhirBoolean IsModifierElement [IgnoreDataMember] public bool? IsModifier { - get { return IsModifierElement != null ? IsModifierElement.Value : null; } + get => _IsModifierElement?.Value; set { - if (value == null) - IsModifierElement = null; - else - IsModifierElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsModifierElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsModifier"); } } @@ -2743,13 +2591,13 @@ public bool? IsModifier /// [FhirElement("isSummary", InSummary=true, Order=320)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsSummaryElement + public Hl7.Fhir.Model.FhirBoolean? IsSummaryElement { get { return _IsSummaryElement; } set { _IsSummaryElement = value; OnPropertyChanged("IsSummaryElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsSummaryElement; + private Hl7.Fhir.Model.FhirBoolean? _IsSummaryElement; /// /// Include when _summary = true? @@ -2758,13 +2606,10 @@ public Hl7.Fhir.Model.FhirBoolean IsSummaryElement [IgnoreDataMember] public bool? IsSummary { - get { return IsSummaryElement != null ? IsSummaryElement.Value : null; } + get => _IsSummaryElement?.Value; set { - if (value == null) - IsSummaryElement = null; - else - IsSummaryElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsSummaryElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsSummary"); } } @@ -2774,13 +2619,13 @@ public bool? IsSummary /// [FhirElement("binding", InSummary=true, Order=330)] [DataMember] - public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent Binding + public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent? Binding { get { return _Binding; } set { _Binding = value; OnPropertyChanged("Binding"); } } - private Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent _Binding; + private Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent? _Binding; /// /// Map element to another set of definitions. @@ -2790,54 +2635,50 @@ public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent Bindin [DataMember] public List Mapping { - get { if(_Mapping==null) _Mapping = new List(); return _Mapping; } + get => _Mapping ?? new List(); set { _Mapping = value; OnPropertyChanged("Mapping"); } } - private List _Mapping; + private List? _Mapping; protected internal override void CopyToInternal(Base other) { - var dest = other as ElementDefinition; - - if (dest == null) - { + if(other is not ElementDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(RepresentationElement.Any()) dest.RepresentationElement = new List>(RepresentationElement.DeepCopyInternal()); - if(SliceNameElement != null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)SliceNameElement.DeepCopyInternal(); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Slicing != null) dest.Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent)Slicing.DeepCopyInternal(); - if(ShortElement != null) dest.ShortElement = (Hl7.Fhir.Model.FhirString)ShortElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Markdown)DefinitionElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(RequirementsElement != null) dest.RequirementsElement = (Hl7.Fhir.Model.Markdown)RequirementsElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(Base != null) dest.Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent)Base.DeepCopyInternal(); - if(ContentReferenceElement != null) dest.ContentReferenceElement = (Hl7.Fhir.Model.FhirUri)ContentReferenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DefaultValue != null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)DefaultValue.DeepCopyInternal(); - if(MeaningWhenMissingElement != null) dest.MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown)MeaningWhenMissingElement.DeepCopyInternal(); - if(OrderMeaningElement != null) dest.OrderMeaningElement = (Hl7.Fhir.Model.FhirString)OrderMeaningElement.DeepCopyInternal(); - if(Fixed != null) dest.Fixed = (Hl7.Fhir.Model.DataType)Fixed.DeepCopyInternal(); - if(Pattern != null) dest.Pattern = (Hl7.Fhir.Model.DataType)Pattern.DeepCopyInternal(); - if(Example.Any()) dest.Example = new List(Example.DeepCopyInternal()); - if(MinValue != null) dest.MinValue = (Hl7.Fhir.Model.DataType)MinValue.DeepCopyInternal(); - if(MaxValue != null) dest.MaxValue = (Hl7.Fhir.Model.DataType)MaxValue.DeepCopyInternal(); - if(MaxLengthElement != null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)MaxLengthElement.DeepCopyInternal(); - if(ConditionElement.Any()) dest.ConditionElement = new List(ConditionElement.DeepCopyInternal()); - if(Constraint.Any()) dest.Constraint = new List(Constraint.DeepCopyInternal()); - if(MustSupportElement != null) dest.MustSupportElement = (Hl7.Fhir.Model.FhirBoolean)MustSupportElement.DeepCopyInternal(); - if(IsModifierElement != null) dest.IsModifierElement = (Hl7.Fhir.Model.FhirBoolean)IsModifierElement.DeepCopyInternal(); - if(IsSummaryElement != null) dest.IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean)IsSummaryElement.DeepCopyInternal(); - if(Binding != null) dest.Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent)Binding.DeepCopyInternal(); - if(Mapping.Any()) dest.Mapping = new List(Mapping.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_RepresentationElement is not null) dest.RepresentationElement = new List>(_RepresentationElement.DeepCopyInternal()); + if(_SliceNameElement is not null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)_SliceNameElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Slicing is not null) dest.Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent)_Slicing.DeepCopyInternal(); + if(_ShortElement is not null) dest.ShortElement = (Hl7.Fhir.Model.FhirString)_ShortElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Markdown)_DefinitionElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_RequirementsElement is not null) dest.RequirementsElement = (Hl7.Fhir.Model.Markdown)_RequirementsElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_Base is not null) dest.Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent)_Base.DeepCopyInternal(); + if(_ContentReferenceElement is not null) dest.ContentReferenceElement = (Hl7.Fhir.Model.FhirUri)_ContentReferenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DefaultValue is not null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)_DefaultValue.DeepCopyInternal(); + if(_MeaningWhenMissingElement is not null) dest.MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown)_MeaningWhenMissingElement.DeepCopyInternal(); + if(_OrderMeaningElement is not null) dest.OrderMeaningElement = (Hl7.Fhir.Model.FhirString)_OrderMeaningElement.DeepCopyInternal(); + if(_Fixed is not null) dest.Fixed = (Hl7.Fhir.Model.DataType)_Fixed.DeepCopyInternal(); + if(_Pattern is not null) dest.Pattern = (Hl7.Fhir.Model.DataType)_Pattern.DeepCopyInternal(); + if(_Example is not null) dest.Example = new List(_Example.DeepCopyInternal()); + if(_MinValue is not null) dest.MinValue = (Hl7.Fhir.Model.DataType)_MinValue.DeepCopyInternal(); + if(_MaxValue is not null) dest.MaxValue = (Hl7.Fhir.Model.DataType)_MaxValue.DeepCopyInternal(); + if(_MaxLengthElement is not null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)_MaxLengthElement.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = new List(_ConditionElement.DeepCopyInternal()); + if(_Constraint is not null) dest.Constraint = new List(_Constraint.DeepCopyInternal()); + if(_MustSupportElement is not null) dest.MustSupportElement = (Hl7.Fhir.Model.FhirBoolean)_MustSupportElement.DeepCopyInternal(); + if(_IsModifierElement is not null) dest.IsModifierElement = (Hl7.Fhir.Model.FhirBoolean)_IsModifierElement.DeepCopyInternal(); + if(_IsSummaryElement is not null) dest.IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean)_IsSummaryElement.DeepCopyInternal(); + if(_Binding is not null) dest.Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent)_Binding.DeepCopyInternal(); + if(_Mapping is not null) dest.Mapping = new List(_Mapping.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2849,251 +2690,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ElementDefinition; - if(otherT == null) return false; + if(other is not ElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.ListEquals(RepresentationElement, otherT.RepresentationElement)) return false; - if(!comparer.Equals(SliceNameElement, otherT.SliceNameElement)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(Slicing, otherT.Slicing)) return false; - if(!comparer.Equals(ShortElement, otherT.ShortElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(RequirementsElement, otherT.RequirementsElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(Base, otherT.Base)) return false; - if(!comparer.Equals(ContentReferenceElement, otherT.ContentReferenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DefaultValue, otherT.DefaultValue)) return false; - if(!comparer.Equals(MeaningWhenMissingElement, otherT.MeaningWhenMissingElement)) return false; - if(!comparer.Equals(OrderMeaningElement, otherT.OrderMeaningElement)) return false; - if(!comparer.Equals(Fixed, otherT.Fixed)) return false; - if(!comparer.Equals(Pattern, otherT.Pattern)) return false; - if(!comparer.ListEquals(Example, otherT.Example)) return false; - if(!comparer.Equals(MinValue, otherT.MinValue)) return false; - if(!comparer.Equals(MaxValue, otherT.MaxValue)) return false; - if(!comparer.Equals(MaxLengthElement, otherT.MaxLengthElement)) return false; - if(!comparer.ListEquals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.ListEquals(Constraint, otherT.Constraint)) return false; - if(!comparer.Equals(MustSupportElement, otherT.MustSupportElement)) return false; - if(!comparer.Equals(IsModifierElement, otherT.IsModifierElement)) return false; - if(!comparer.Equals(IsSummaryElement, otherT.IsSummaryElement)) return false; - if(!comparer.Equals(Binding, otherT.Binding)) return false; - if(!comparer.ListEquals(Mapping, otherT.Mapping)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.ListEquals(_RepresentationElement, otherT._RepresentationElement)) return false; + if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Slicing, otherT._Slicing)) return false; + if(!comparer.Equals(_ShortElement, otherT._ShortElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_RequirementsElement, otherT._RequirementsElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_Base, otherT._Base)) return false; + if(!comparer.Equals(_ContentReferenceElement, otherT._ContentReferenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DefaultValue, otherT._DefaultValue)) return false; + if(!comparer.Equals(_MeaningWhenMissingElement, otherT._MeaningWhenMissingElement)) return false; + if(!comparer.Equals(_OrderMeaningElement, otherT._OrderMeaningElement)) return false; + if(!comparer.Equals(_Fixed, otherT._Fixed)) return false; + if(!comparer.Equals(_Pattern, otherT._Pattern)) return false; + if(!comparer.ListEquals(_Example, otherT._Example)) return false; + if(!comparer.Equals(_MinValue, otherT._MinValue)) return false; + if(!comparer.Equals(_MaxValue, otherT._MaxValue)) return false; + if(!comparer.Equals(_MaxLengthElement, otherT._MaxLengthElement)) return false; + if(!comparer.ListEquals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.ListEquals(_Constraint, otherT._Constraint)) return false; + if(!comparer.Equals(_MustSupportElement, otherT._MustSupportElement)) return false; + if(!comparer.Equals(_IsModifierElement, otherT._IsModifierElement)) return false; + if(!comparer.Equals(_IsSummaryElement, otherT._IsSummaryElement)) return false; + if(!comparer.Equals(_Binding, otherT._Binding)) return false; + if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "representation": - value = RepresentationElement; - return RepresentationElement?.Any() == true; + value = _RepresentationElement; + return _RepresentationElement?.Any() == true; case "sliceName": - value = SliceNameElement; - return SliceNameElement is not null; + value = _SliceNameElement; + return _SliceNameElement is not null; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "slicing": - value = Slicing; - return Slicing is not null; + value = _Slicing; + return _Slicing is not null; case "short": - value = ShortElement; - return ShortElement is not null; + value = _ShortElement; + return _ShortElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "requirements": - value = RequirementsElement; - return RequirementsElement is not null; + value = _RequirementsElement; + return _RequirementsElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "base": - value = Base; - return Base is not null; + value = _Base; + return _Base is not null; case "contentReference": - value = ContentReferenceElement; - return ContentReferenceElement is not null; + value = _ContentReferenceElement; + return _ContentReferenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "defaultValue": - value = DefaultValue; - return DefaultValue is not null; + value = _DefaultValue; + return _DefaultValue is not null; case "meaningWhenMissing": - value = MeaningWhenMissingElement; - return MeaningWhenMissingElement is not null; + value = _MeaningWhenMissingElement; + return _MeaningWhenMissingElement is not null; case "orderMeaning": - value = OrderMeaningElement; - return OrderMeaningElement is not null; + value = _OrderMeaningElement; + return _OrderMeaningElement is not null; case "fixed": - value = Fixed; - return Fixed is not null; + value = _Fixed; + return _Fixed is not null; case "pattern": - value = Pattern; - return Pattern is not null; + value = _Pattern; + return _Pattern is not null; case "example": - value = Example; - return Example?.Any() == true; + value = _Example; + return _Example?.Any() == true; case "minValue": - value = MinValue; - return MinValue is not null; + value = _MinValue; + return _MinValue is not null; case "maxValue": - value = MaxValue; - return MaxValue is not null; + value = _MaxValue; + return _MaxValue is not null; case "maxLength": - value = MaxLengthElement; - return MaxLengthElement is not null; + value = _MaxLengthElement; + return _MaxLengthElement is not null; case "condition": - value = ConditionElement; - return ConditionElement?.Any() == true; + value = _ConditionElement; + return _ConditionElement?.Any() == true; case "constraint": - value = Constraint; - return Constraint?.Any() == true; + value = _Constraint; + return _Constraint?.Any() == true; case "mustSupport": - value = MustSupportElement; - return MustSupportElement is not null; + value = _MustSupportElement; + return _MustSupportElement is not null; case "isModifier": - value = IsModifierElement; - return IsModifierElement is not null; + value = _IsModifierElement; + return _IsModifierElement is not null; case "isSummary": - value = IsSummaryElement; - return IsSummaryElement is not null; + value = _IsSummaryElement; + return _IsSummaryElement is not null; case "binding": - value = Binding; - return Binding is not null; + value = _Binding; + return _Binding is not null; case "mapping": - value = Mapping; - return Mapping?.Any() == true; + value = _Mapping; + return _Mapping?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "representation": - RepresentationElement = (List>)value; + RepresentationElement = (List>?)value!; return this; case "sliceName": - SliceNameElement = (Hl7.Fhir.Model.FhirString)value; + SliceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "slicing": - Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent)value; + Slicing = (Hl7.Fhir.Model.ElementDefinition.SlicingComponent?)value; return this; case "short": - ShortElement = (Hl7.Fhir.Model.FhirString)value; + ShortElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Markdown)value; + DefinitionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "requirements": - RequirementsElement = (Hl7.Fhir.Model.Markdown)value; + RequirementsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "base": - Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent)value; + Base = (Hl7.Fhir.Model.ElementDefinition.BaseComponent?)value; return this; case "contentReference": - ContentReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ContentReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "defaultValue": - DefaultValue = (Hl7.Fhir.Model.DataType)value; + DefaultValue = (Hl7.Fhir.Model.DataType?)value; return this; case "meaningWhenMissing": - MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown)value; + MeaningWhenMissingElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "orderMeaning": - OrderMeaningElement = (Hl7.Fhir.Model.FhirString)value; + OrderMeaningElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "fixed": - Fixed = (Hl7.Fhir.Model.DataType)value; + Fixed = (Hl7.Fhir.Model.DataType?)value; return this; case "pattern": - Pattern = (Hl7.Fhir.Model.DataType)value; + Pattern = (Hl7.Fhir.Model.DataType?)value; return this; case "example": - Example = (List)value; + Example = (List?)value!; return this; case "minValue": - MinValue = (Hl7.Fhir.Model.DataType)value; + MinValue = (Hl7.Fhir.Model.DataType?)value; return this; case "maxValue": - MaxValue = (Hl7.Fhir.Model.DataType)value; + MaxValue = (Hl7.Fhir.Model.DataType?)value; return this; case "maxLength": - MaxLengthElement = (Hl7.Fhir.Model.Integer)value; + MaxLengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "condition": - ConditionElement = (List)value; + ConditionElement = (List?)value!; return this; case "constraint": - Constraint = (List)value; + Constraint = (List?)value!; return this; case "mustSupport": - MustSupportElement = (Hl7.Fhir.Model.FhirBoolean)value; + MustSupportElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "isModifier": - IsModifierElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsModifierElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "isSummary": - IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsSummaryElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "binding": - Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent)value; + Binding = (Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent?)value; return this; case "mapping": - Mapping = (List)value; + Mapping = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3104,38 +2945,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (RepresentationElement?.Any() == true) yield return new KeyValuePair("representation",RepresentationElement); - if (SliceNameElement is not null) yield return new KeyValuePair("sliceName",SliceNameElement); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Slicing is not null) yield return new KeyValuePair("slicing",Slicing); - if (ShortElement is not null) yield return new KeyValuePair("short",ShortElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (RequirementsElement is not null) yield return new KeyValuePair("requirements",RequirementsElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (Base is not null) yield return new KeyValuePair("base",Base); - if (ContentReferenceElement is not null) yield return new KeyValuePair("contentReference",ContentReferenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DefaultValue is not null) yield return new KeyValuePair("defaultValue",DefaultValue); - if (MeaningWhenMissingElement is not null) yield return new KeyValuePair("meaningWhenMissing",MeaningWhenMissingElement); - if (OrderMeaningElement is not null) yield return new KeyValuePair("orderMeaning",OrderMeaningElement); - if (Fixed is not null) yield return new KeyValuePair("fixed",Fixed); - if (Pattern is not null) yield return new KeyValuePair("pattern",Pattern); - if (Example?.Any() == true) yield return new KeyValuePair("example",Example); - if (MinValue is not null) yield return new KeyValuePair("minValue",MinValue); - if (MaxValue is not null) yield return new KeyValuePair("maxValue",MaxValue); - if (MaxLengthElement is not null) yield return new KeyValuePair("maxLength",MaxLengthElement); - if (ConditionElement?.Any() == true) yield return new KeyValuePair("condition",ConditionElement); - if (Constraint?.Any() == true) yield return new KeyValuePair("constraint",Constraint); - if (MustSupportElement is not null) yield return new KeyValuePair("mustSupport",MustSupportElement); - if (IsModifierElement is not null) yield return new KeyValuePair("isModifier",IsModifierElement); - if (IsSummaryElement is not null) yield return new KeyValuePair("isSummary",IsSummaryElement); - if (Binding is not null) yield return new KeyValuePair("binding",Binding); - if (Mapping?.Any() == true) yield return new KeyValuePair("mapping",Mapping); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_RepresentationElement?.Any() == true) yield return new KeyValuePair("representation",_RepresentationElement); + if (_SliceNameElement is not null) yield return new KeyValuePair("sliceName",_SliceNameElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Slicing is not null) yield return new KeyValuePair("slicing",_Slicing); + if (_ShortElement is not null) yield return new KeyValuePair("short",_ShortElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_RequirementsElement is not null) yield return new KeyValuePair("requirements",_RequirementsElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_Base is not null) yield return new KeyValuePair("base",_Base); + if (_ContentReferenceElement is not null) yield return new KeyValuePair("contentReference",_ContentReferenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DefaultValue is not null) yield return new KeyValuePair("defaultValue",_DefaultValue); + if (_MeaningWhenMissingElement is not null) yield return new KeyValuePair("meaningWhenMissing",_MeaningWhenMissingElement); + if (_OrderMeaningElement is not null) yield return new KeyValuePair("orderMeaning",_OrderMeaningElement); + if (_Fixed is not null) yield return new KeyValuePair("fixed",_Fixed); + if (_Pattern is not null) yield return new KeyValuePair("pattern",_Pattern); + if (_Example?.Any() == true) yield return new KeyValuePair("example",_Example); + if (_MinValue is not null) yield return new KeyValuePair("minValue",_MinValue); + if (_MaxValue is not null) yield return new KeyValuePair("maxValue",_MaxValue); + if (_MaxLengthElement is not null) yield return new KeyValuePair("maxLength",_MaxLengthElement); + if (_ConditionElement?.Any() == true) yield return new KeyValuePair("condition",_ConditionElement); + if (_Constraint?.Any() == true) yield return new KeyValuePair("constraint",_Constraint); + if (_MustSupportElement is not null) yield return new KeyValuePair("mustSupport",_MustSupportElement); + if (_IsModifierElement is not null) yield return new KeyValuePair("isModifier",_IsModifierElement); + if (_IsSummaryElement is not null) yield return new KeyValuePair("isSummary",_IsSummaryElement); + if (_Binding is not null) yield return new KeyValuePair("binding",_Binding); + if (_Mapping?.Any() == true) yield return new KeyValuePair("mapping",_Mapping); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs index c61bf54b7..cb3926ee9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EligibilityRequest : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EligibilityRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -112,13 +112,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("priority", Order=110, FiveWs="class")] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// The subject of the Products and Services. @@ -127,13 +127,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Estimated date or dates of Service. @@ -142,41 +142,38 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Creation date. /// [FhirElement("created", Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -188,13 +185,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Responsible practitioner. @@ -203,13 +200,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Responsible organization. @@ -218,13 +215,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Target. @@ -233,13 +230,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Servicing Facility. @@ -248,13 +245,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Insurance or medical plan. @@ -263,41 +260,38 @@ public Hl7.Fhir.Model.ResourceReference Facility [CLSCompliant(false)] [References("Coverage")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Business agreement. /// [FhirElement("businessArrangement", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Business agreement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -308,13 +302,13 @@ public string BusinessArrangement [FhirElement("benefitCategory", Order=220)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BenefitCategory + public Hl7.Fhir.Model.CodeableConcept? BenefitCategory { get { return _BenefitCategory; } set { _BenefitCategory = value; OnPropertyChanged("BenefitCategory"); } } - private Hl7.Fhir.Model.CodeableConcept _BenefitCategory; + private Hl7.Fhir.Model.CodeableConcept? _BenefitCategory; /// /// Detailed services covered within the type. @@ -322,41 +316,37 @@ public Hl7.Fhir.Model.CodeableConcept BenefitCategory [FhirElement("benefitSubCategory", Order=230)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BenefitSubCategory + public Hl7.Fhir.Model.CodeableConcept? BenefitSubCategory { get { return _BenefitSubCategory; } set { _BenefitSubCategory = value; OnPropertyChanged("BenefitSubCategory"); } } - private Hl7.Fhir.Model.CodeableConcept _BenefitSubCategory; + private Hl7.Fhir.Model.CodeableConcept? _BenefitSubCategory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EligibilityRequest; - - if (dest == null) - { + if(other is not EligibilityRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(BenefitCategory != null) dest.BenefitCategory = (Hl7.Fhir.Model.CodeableConcept)BenefitCategory.DeepCopyInternal(); - if(BenefitSubCategory != null) dest.BenefitSubCategory = (Hl7.Fhir.Model.CodeableConcept)BenefitSubCategory.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_BenefitCategory is not null) dest.BenefitCategory = (Hl7.Fhir.Model.CodeableConcept)_BenefitCategory.DeepCopyInternal(); + if(_BenefitSubCategory is not null) dest.BenefitSubCategory = (Hl7.Fhir.Model.CodeableConcept)_BenefitSubCategory.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -368,132 +358,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EligibilityRequest; - if(otherT == null) return false; + if(other is not EligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.Equals(BenefitCategory, otherT.BenefitCategory)) return false; - if(!comparer.Equals(BenefitSubCategory, otherT.BenefitSubCategory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.Equals(_BenefitCategory, otherT._BenefitCategory)) return false; + if(!comparer.Equals(_BenefitSubCategory, otherT._BenefitSubCategory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "benefitCategory": - value = BenefitCategory; - return BenefitCategory is not null; + value = _BenefitCategory; + return _BenefitCategory is not null; case "benefitSubCategory": - value = BenefitSubCategory; - return BenefitSubCategory is not null; + value = _BenefitSubCategory; + return _BenefitSubCategory is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "benefitCategory": - BenefitCategory = (Hl7.Fhir.Model.CodeableConcept)value; + BenefitCategory = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "benefitSubCategory": - BenefitSubCategory = (Hl7.Fhir.Model.CodeableConcept)value; + BenefitSubCategory = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -504,21 +494,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (BenefitCategory is not null) yield return new KeyValuePair("benefitCategory",BenefitCategory); - if (BenefitSubCategory is not null) yield return new KeyValuePair("benefitSubCategory",BenefitSubCategory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_BenefitCategory is not null) yield return new KeyValuePair("benefitCategory",_BenefitCategory); + if (_BenefitSubCategory is not null) yield return new KeyValuePair("benefitSubCategory",_BenefitSubCategory); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs index 803128bcb..4ccb4333f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,13 +85,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Coverage")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Contract details. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.ResourceReference Coverage [CLSCompliant(false)] [References("Contract")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Contract + public Hl7.Fhir.Model.ResourceReference? Contract { get { return _Contract; } set { _Contract = value; OnPropertyChanged("Contract"); } } - private Hl7.Fhir.Model.ResourceReference _Contract; + private Hl7.Fhir.Model.ResourceReference? _Contract; /// /// Benefits by Category. @@ -113,25 +116,21 @@ public Hl7.Fhir.Model.ResourceReference Contract [DataMember] public List BenefitBalance { - get { if(_BenefitBalance==null) _BenefitBalance = new List(); return _BenefitBalance; } + get => _BenefitBalance ?? new List(); set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } - private List _BenefitBalance; + private List? _BenefitBalance; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(Contract != null) dest.Contract = (Hl7.Fhir.Model.ResourceReference)Contract.DeepCopyInternal(); - if(BenefitBalance.Any()) dest.BenefitBalance = new List(BenefitBalance.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_Contract is not null) dest.Contract = (Hl7.Fhir.Model.ResourceReference)_Contract.DeepCopyInternal(); + if(_BenefitBalance is not null) dest.BenefitBalance = new List(_BenefitBalance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(Contract, otherT.Contract)) return false; - if(!comparer.ListEquals(BenefitBalance, otherT.BenefitBalance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_Contract, otherT._Contract)) return false; + if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "contract": - value = Contract; - return Contract is not null; + value = _Contract; + return _Contract is not null; case "benefitBalance": - value = BenefitBalance; - return BenefitBalance?.Any() == true; + value = _BenefitBalance; + return _BenefitBalance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contract": - Contract = (Hl7.Fhir.Model.ResourceReference)value; + Contract = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "benefitBalance": - BenefitBalance = (List)value; + BenefitBalance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (Contract is not null) yield return new KeyValuePair("contract",Contract); - if (BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",BenefitBalance); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_Contract is not null) yield return new KeyValuePair("contract",_Contract); + if (_BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",_BenefitBalance); } } @@ -225,13 +224,13 @@ public partial class BenefitsComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Detailed services covered within the type. @@ -239,26 +238,26 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("subCategory", Order=50)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubCategory + public Hl7.Fhir.Model.CodeableConcept? SubCategory { get { return _SubCategory; } set { _SubCategory = value; OnPropertyChanged("SubCategory"); } } - private Hl7.Fhir.Model.CodeableConcept _SubCategory; + private Hl7.Fhir.Model.CodeableConcept? _SubCategory; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -267,13 +266,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -283,28 +279,25 @@ public bool? Excluded /// [FhirElement("name", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -314,28 +307,25 @@ public string Name /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -346,13 +336,13 @@ public string Description [FhirElement("network", Order=90)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -360,13 +350,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=100)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -374,13 +364,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=110)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -390,31 +380,27 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Financial { - get { if(_Financial==null) _Financial = new List(); return _Financial; } + get => _Financial ?? new List(); set { _Financial = value; OnPropertyChanged("Financial"); } } - private List _Financial; + private List? _Financial; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitsComponent; - - if (dest == null) - { + if(other is not BenefitsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(SubCategory != null) dest.SubCategory = (Hl7.Fhir.Model.CodeableConcept)SubCategory.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Financial.Any()) dest.Financial = new List(Financial.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_SubCategory is not null) dest.SubCategory = (Hl7.Fhir.Model.CodeableConcept)_SubCategory.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Financial is not null) dest.Financial = new List(_Financial.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -426,90 +412,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitsComponent; - if(otherT == null) return false; + if(other is not BenefitsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(SubCategory, otherT.SubCategory)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Financial, otherT.Financial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_SubCategory, otherT._SubCategory)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "subCategory": - value = SubCategory; - return SubCategory is not null; + value = _SubCategory; + return _SubCategory is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "financial": - value = Financial; - return Financial?.Any() == true; + value = _Financial; + return _Financial?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subCategory": - SubCategory = (Hl7.Fhir.Model.CodeableConcept)value; + SubCategory = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "financial": - Financial = (List)value; + Financial = (List?)value!; return this; default: return base.SetValue(key, value); @@ -520,15 +506,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (SubCategory is not null) yield return new KeyValuePair("subCategory",SubCategory); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Financial?.Any() == true) yield return new KeyValuePair("financial",Financial); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_SubCategory is not null) yield return new KeyValuePair("subCategory",_SubCategory); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Financial?.Any() == true) yield return new KeyValuePair("financial",_Financial); } } @@ -556,13 +542,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -571,13 +557,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -586,27 +572,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -618,48 +600,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -670,9 +652,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -700,25 +682,21 @@ public partial class ErrorsComponent : Hl7.Fhir.Model.BackboneElement [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorsComponent; - - if (dest == null) - { + if(other is not ErrorsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -730,34 +708,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorsComponent; - if(otherT == null) return false; + if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -768,7 +746,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -781,11 +759,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -794,13 +772,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EligibilityResponseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -809,13 +787,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -825,28 +800,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("created", Order=110, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -858,13 +830,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; /// /// Responsible organization. @@ -873,13 +845,13 @@ public Hl7.Fhir.Model.ResourceReference RequestProvider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestOrganization + public Hl7.Fhir.Model.ResourceReference? RequestOrganization { get { return _RequestOrganization; } set { _RequestOrganization = value; OnPropertyChanged("RequestOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestOrganization; /// /// Eligibility reference. @@ -888,13 +860,13 @@ public Hl7.Fhir.Model.ResourceReference RequestOrganization [CLSCompliant(false)] [References("EligibilityRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// complete | error | partial. @@ -902,41 +874,38 @@ public Hl7.Fhir.Model.ResourceReference Request [FhirElement("outcome", Order=150)] [Binding("RemittanceOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Disposition Message. /// [FhirElement("disposition", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -948,26 +917,26 @@ public string Disposition [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Coverage inforce indicator. /// [FhirElement("inforce", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InforceElement + public Hl7.Fhir.Model.FhirBoolean? InforceElement { get { return _InforceElement; } set { _InforceElement = value; OnPropertyChanged("InforceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InforceElement; + private Hl7.Fhir.Model.FhirBoolean? _InforceElement; /// /// Coverage inforce indicator @@ -976,13 +945,10 @@ public Hl7.Fhir.Model.FhirBoolean InforceElement [IgnoreDataMember] public bool? Inforce { - get { return InforceElement != null ? InforceElement.Value : null; } + get => _InforceElement?.Value; set { - if (value == null) - InforceElement = null; - else - InforceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InforceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inforce"); } } @@ -995,11 +961,11 @@ public bool? Inforce [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Printed Form Identifier. @@ -1007,13 +973,13 @@ public List Insurance [FhirElement("form", Order=200)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Processing errors. @@ -1023,37 +989,33 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EligibilityResponse; - - if (dest == null) - { + if(other is not EligibilityResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); - if(RequestOrganization != null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)RequestOrganization.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(InforceElement != null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)InforceElement.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); + if(_RequestOrganization is not null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestOrganization.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_InforceElement is not null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)_InforceElement.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1065,118 +1027,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EligibilityResponse; - if(otherT == null) return false; + if(other is not EligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; - if(!comparer.Equals(RequestOrganization, otherT.RequestOrganization)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(InforceElement, otherT.InforceElement)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; + if(!comparer.Equals(_RequestOrganization, otherT._RequestOrganization)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_InforceElement, otherT._InforceElement)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; case "requestOrganization": - value = RequestOrganization; - return RequestOrganization is not null; + value = _RequestOrganization; + return _RequestOrganization is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "inforce": - value = InforceElement; - return InforceElement is not null; + value = _InforceElement; + return _InforceElement is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestOrganization": - RequestOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "inforce": - InforceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InforceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1187,19 +1149,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); - if (RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",RequestOrganization); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (InforceElement is not null) yield return new KeyValuePair("inforce",InforceElement); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); + if (_RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",_RequestOrganization); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_InforceElement is not null) yield return new KeyValuePair("inforce",_InforceElement); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs b/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs index f4bf2ac2f..a9d2d7eb7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -184,13 +187,13 @@ public partial class StatusHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled + @@ -199,13 +202,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -216,26 +216,22 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusHistoryComponent; - - if (dest == null) - { + if(other is not StatusHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -247,41 +243,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusHistoryComponent; - if(otherT == null) return false; + if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -292,8 +288,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -322,13 +318,13 @@ public partial class ClassHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EncounterClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Class + public Hl7.Fhir.Model.Coding? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.Coding _Class; + private Hl7.Fhir.Model.Coding? _Class; /// /// The time that the episode was in the specified class. @@ -336,26 +332,22 @@ public Hl7.Fhir.Model.Coding Class [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ClassHistoryComponent; - - if (dest == null) - { + if(other is not ClassHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Class != null) dest.Class = (Hl7.Fhir.Model.Coding)Class.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.Coding)_Class.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -367,41 +359,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassHistoryComponent; - if(otherT == null) return false; + if(other is not ClassHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "class": - Class = (Hl7.Fhir.Model.Coding)value; + Class = (Hl7.Fhir.Model.Coding?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -412,8 +404,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -443,24 +435,24 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Period of time during the encounter that the participant participated. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Persons involved in the encounter other than the patient. @@ -469,27 +461,23 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Individual + public Hl7.Fhir.Model.ResourceReference? Individual { get { return _Individual; } set { _Individual = value; OnPropertyChanged("Individual"); } } - private Hl7.Fhir.Model.ResourceReference _Individual; + private Hl7.Fhir.Model.ResourceReference? _Individual; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Individual != null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)Individual.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Individual is not null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)_Individual.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -501,48 +489,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Individual, otherT.Individual)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Individual, otherT._Individual)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "individual": - value = Individual; - return Individual is not null; + value = _Individual; + return _Individual is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "individual": - Individual = (Hl7.Fhir.Model.ResourceReference)value; + Individual = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -553,9 +541,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Individual is not null) yield return new KeyValuePair("individual",Individual); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Individual is not null) yield return new KeyValuePair("individual",_Individual); } } @@ -581,13 +569,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition","Procedure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …). @@ -595,26 +583,26 @@ public Hl7.Fhir.Model.ResourceReference Condition [FhirElement("role", Order=50)] [Binding("DiagnosisRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Ranking of the diagnosis (for each role type). /// [FhirElement("rank", Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankElement + public Hl7.Fhir.Model.PositiveInt? RankElement { get { return _RankElement; } set { _RankElement = value; OnPropertyChanged("RankElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankElement; + private Hl7.Fhir.Model.PositiveInt? _RankElement; /// /// Ranking of the diagnosis (for each role type) @@ -623,30 +611,23 @@ public Hl7.Fhir.Model.PositiveInt RankElement [IgnoreDataMember] public int? Rank { - get { return RankElement != null ? RankElement.Value : null; } + get => _RankElement?.Value; set { - if (value == null) - RankElement = null; - else - RankElement = new Hl7.Fhir.Model.PositiveInt(value); + RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Rank"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -658,48 +639,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(RankElement, otherT.RankElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "rank": - value = RankElement; - return RankElement is not null; + value = _RankElement; + return _RankElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rank": - RankElement = (Hl7.Fhir.Model.PositiveInt)value; + RankElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -710,9 +691,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (RankElement is not null) yield return new KeyValuePair("rank",RankElement); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement); } } @@ -739,13 +720,13 @@ public partial class HospitalizationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("preAdmissionIdentifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier + public Hl7.Fhir.Model.Identifier? PreAdmissionIdentifier { get { return _PreAdmissionIdentifier; } set { _PreAdmissionIdentifier = value; OnPropertyChanged("PreAdmissionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _PreAdmissionIdentifier; + private Hl7.Fhir.Model.Identifier? _PreAdmissionIdentifier; /// /// The location from which the patient came before admission. @@ -754,13 +735,13 @@ public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Origin + public Hl7.Fhir.Model.ResourceReference? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.ResourceReference _Origin; + private Hl7.Fhir.Model.ResourceReference? _Origin; /// /// From where patient was admitted (physician referral, transfer). @@ -768,13 +749,13 @@ public Hl7.Fhir.Model.ResourceReference Origin [FhirElement("admitSource", Order=60)] [Binding("AdmitSource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdmitSource + public Hl7.Fhir.Model.CodeableConcept? AdmitSource { get { return _AdmitSource; } set { _AdmitSource = value; OnPropertyChanged("AdmitSource"); } } - private Hl7.Fhir.Model.CodeableConcept _AdmitSource; + private Hl7.Fhir.Model.CodeableConcept? _AdmitSource; /// /// The type of hospital re-admission that has occurred (if any). If the value is absent, then this is not identified as a readmission. @@ -782,13 +763,13 @@ public Hl7.Fhir.Model.CodeableConcept AdmitSource [FhirElement("reAdmission", Order=70)] [Binding("ReAdmissionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReAdmission + public Hl7.Fhir.Model.CodeableConcept? ReAdmission { get { return _ReAdmission; } set { _ReAdmission = value; OnPropertyChanged("ReAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _ReAdmission; + private Hl7.Fhir.Model.CodeableConcept? _ReAdmission; /// /// Diet preferences reported by the patient. @@ -799,11 +780,11 @@ public Hl7.Fhir.Model.CodeableConcept ReAdmission [DataMember] public List DietPreference { - get { if(_DietPreference==null) _DietPreference = new List(); return _DietPreference; } + get => _DietPreference ?? new List(); set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } - private List _DietPreference; + private List? _DietPreference; /// /// Special courtesies (VIP, board member). @@ -814,11 +795,11 @@ public List DietPreference [DataMember] public List SpecialCourtesy { - get { if(_SpecialCourtesy==null) _SpecialCourtesy = new List(); return _SpecialCourtesy; } + get => _SpecialCourtesy ?? new List(); set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } - private List _SpecialCourtesy; + private List? _SpecialCourtesy; /// /// Wheelchair, translator, stretcher, etc. @@ -829,11 +810,11 @@ public List SpecialCourtesy [DataMember] public List SpecialArrangement { - get { if(_SpecialArrangement==null) _SpecialArrangement = new List(); return _SpecialArrangement; } + get => _SpecialArrangement ?? new List(); set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } - private List _SpecialArrangement; + private List? _SpecialArrangement; /// /// Location to which the patient is discharged. @@ -842,13 +823,13 @@ public List SpecialArrangement [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Category or kind of location after discharge. @@ -856,33 +837,29 @@ public Hl7.Fhir.Model.ResourceReference Destination [FhirElement("dischargeDisposition", Order=120)] [Binding("DischargeDisp")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DischargeDisposition + public Hl7.Fhir.Model.CodeableConcept? DischargeDisposition { get { return _DischargeDisposition; } set { _DischargeDisposition = value; OnPropertyChanged("DischargeDisposition"); } } - private Hl7.Fhir.Model.CodeableConcept _DischargeDisposition; + private Hl7.Fhir.Model.CodeableConcept? _DischargeDisposition; protected internal override void CopyToInternal(Base other) { - var dest = other as HospitalizationComponent; - - if (dest == null) - { + if(other is not HospitalizationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PreAdmissionIdentifier != null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)PreAdmissionIdentifier.DeepCopyInternal(); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)Origin.DeepCopyInternal(); - if(AdmitSource != null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)AdmitSource.DeepCopyInternal(); - if(ReAdmission != null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)ReAdmission.DeepCopyInternal(); - if(DietPreference.Any()) dest.DietPreference = new List(DietPreference.DeepCopyInternal()); - if(SpecialCourtesy.Any()) dest.SpecialCourtesy = new List(SpecialCourtesy.DeepCopyInternal()); - if(SpecialArrangement.Any()) dest.SpecialArrangement = new List(SpecialArrangement.DeepCopyInternal()); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(DischargeDisposition != null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)DischargeDisposition.DeepCopyInternal(); + if(_PreAdmissionIdentifier is not null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)_PreAdmissionIdentifier.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)_Origin.DeepCopyInternal(); + if(_AdmitSource is not null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)_AdmitSource.DeepCopyInternal(); + if(_ReAdmission is not null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)_ReAdmission.DeepCopyInternal(); + if(_DietPreference is not null) dest.DietPreference = new List(_DietPreference.DeepCopyInternal()); + if(_SpecialCourtesy is not null) dest.SpecialCourtesy = new List(_SpecialCourtesy.DeepCopyInternal()); + if(_SpecialArrangement is not null) dest.SpecialArrangement = new List(_SpecialArrangement.DeepCopyInternal()); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_DischargeDisposition is not null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)_DischargeDisposition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -894,90 +871,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HospitalizationComponent; - if(otherT == null) return false; + if(other is not HospitalizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PreAdmissionIdentifier, otherT.PreAdmissionIdentifier)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(AdmitSource, otherT.AdmitSource)) return false; - if(!comparer.Equals(ReAdmission, otherT.ReAdmission)) return false; - if(!comparer.ListEquals(DietPreference, otherT.DietPreference)) return false; - if(!comparer.ListEquals(SpecialCourtesy, otherT.SpecialCourtesy)) return false; - if(!comparer.ListEquals(SpecialArrangement, otherT.SpecialArrangement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(DischargeDisposition, otherT.DischargeDisposition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; + if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; + if(!comparer.ListEquals(_DietPreference, otherT._DietPreference)) return false; + if(!comparer.ListEquals(_SpecialCourtesy, otherT._SpecialCourtesy)) return false; + if(!comparer.ListEquals(_SpecialArrangement, otherT._SpecialArrangement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "preAdmissionIdentifier": - value = PreAdmissionIdentifier; - return PreAdmissionIdentifier is not null; + value = _PreAdmissionIdentifier; + return _PreAdmissionIdentifier is not null; case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "admitSource": - value = AdmitSource; - return AdmitSource is not null; + value = _AdmitSource; + return _AdmitSource is not null; case "reAdmission": - value = ReAdmission; - return ReAdmission is not null; + value = _ReAdmission; + return _ReAdmission is not null; case "dietPreference": - value = DietPreference; - return DietPreference?.Any() == true; + value = _DietPreference; + return _DietPreference?.Any() == true; case "specialCourtesy": - value = SpecialCourtesy; - return SpecialCourtesy?.Any() == true; + value = _SpecialCourtesy; + return _SpecialCourtesy?.Any() == true; case "specialArrangement": - value = SpecialArrangement; - return SpecialArrangement?.Any() == true; + value = _SpecialArrangement; + return _SpecialArrangement?.Any() == true; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "dischargeDisposition": - value = DischargeDisposition; - return DischargeDisposition is not null; + value = _DischargeDisposition; + return _DischargeDisposition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "preAdmissionIdentifier": - PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)value; + PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "origin": - Origin = (Hl7.Fhir.Model.ResourceReference)value; + Origin = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "admitSource": - AdmitSource = (Hl7.Fhir.Model.CodeableConcept)value; + AdmitSource = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reAdmission": - ReAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + ReAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dietPreference": - DietPreference = (List)value; + DietPreference = (List?)value!; return this; case "specialCourtesy": - SpecialCourtesy = (List)value; + SpecialCourtesy = (List?)value!; return this; case "specialArrangement": - SpecialArrangement = (List)value; + SpecialArrangement = (List?)value!; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dischargeDisposition": - DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)value; + DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -988,15 +965,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",PreAdmissionIdentifier); - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (AdmitSource is not null) yield return new KeyValuePair("admitSource",AdmitSource); - if (ReAdmission is not null) yield return new KeyValuePair("reAdmission",ReAdmission); - if (DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",DietPreference); - if (SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",SpecialCourtesy); - if (SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",SpecialArrangement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",DischargeDisposition); + if (_PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",_PreAdmissionIdentifier); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_AdmitSource is not null) yield return new KeyValuePair("admitSource",_AdmitSource); + if (_ReAdmission is not null) yield return new KeyValuePair("reAdmission",_ReAdmission); + if (_DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",_DietPreference); + if (_SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",_SpecialCourtesy); + if (_SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",_SpecialArrangement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",_DischargeDisposition); } } @@ -1026,13 +1003,13 @@ public partial class LocationComponent : Hl7.Fhir.Model.BackboneElement [References("Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// planned | active | reserved | completed. @@ -1041,13 +1018,13 @@ public Hl7.Fhir.Model.ResourceReference Location [DeclaredType(Type = typeof(Code))] [Binding("EncounterLocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | active | reserved | completed @@ -1056,13 +1033,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1072,27 +1046,23 @@ public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as LocationComponent; - - if (dest == null) - { + if(other is not LocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1104,48 +1074,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LocationComponent; - if(otherT == null) return false; + if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -1156,9 +1126,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Location is not null) yield return new KeyValuePair("location",Location); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -1171,11 +1141,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled +. @@ -1185,13 +1155,13 @@ public List Identifier [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled + @@ -1200,13 +1170,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1219,11 +1186,11 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [DataMember] public List StatusHistory { - get { if(_StatusHistory==null) _StatusHistory = new List(); return _StatusHistory; } + get => _StatusHistory ?? new List(); set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } - private List _StatusHistory; + private List? _StatusHistory; /// /// inpatient | outpatient | ambulatory | emergency +. @@ -1231,13 +1198,13 @@ public List StatusHistory [FhirElement("class", InSummary=true, Order=120, FiveWs="class")] [Binding("EncounterClass")] [DataMember] - public Hl7.Fhir.Model.Coding Class + public Hl7.Fhir.Model.Coding? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.Coding _Class; + private Hl7.Fhir.Model.Coding? _Class; /// /// List of past encounter classes. @@ -1247,11 +1214,11 @@ public Hl7.Fhir.Model.Coding Class [DataMember] public List ClassHistory { - get { if(_ClassHistory==null) _ClassHistory = new List(); return _ClassHistory; } + get => _ClassHistory ?? new List(); set { _ClassHistory = value; OnPropertyChanged("ClassHistory"); } } - private List _ClassHistory; + private List? _ClassHistory; /// /// Specific type of encounter. @@ -1262,11 +1229,11 @@ public List ClassHistory [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Indicates the urgency of the encounter. @@ -1274,13 +1241,13 @@ public List Type [FhirElement("priority", Order=150, FiveWs="grade")] [Binding("Priority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// The patient ro group present at the encounter. @@ -1289,13 +1256,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Episode(s) of care that this encounter should be recorded against. @@ -1307,11 +1274,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List EpisodeOfCare { - get { if(_EpisodeOfCare==null) _EpisodeOfCare = new List(); return _EpisodeOfCare; } + get => _EpisodeOfCare ?? new List(); set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } - private List _EpisodeOfCare; + private List? _EpisodeOfCare; /// /// The ReferralRequest that initiated this encounter. @@ -1323,11 +1290,11 @@ public List EpisodeOfCare [DataMember] public List IncomingReferral { - get { if(_IncomingReferral==null) _IncomingReferral = new List(); return _IncomingReferral; } + get => _IncomingReferral ?? new List(); set { _IncomingReferral = value; OnPropertyChanged("IncomingReferral"); } } - private List _IncomingReferral; + private List? _IncomingReferral; /// /// List of participants involved in the encounter. @@ -1337,11 +1304,11 @@ public List IncomingReferral [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The appointment that scheduled this encounter. @@ -1350,39 +1317,39 @@ public List Participant [CLSCompliant(false)] [References("Appointment")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Appointment + public Hl7.Fhir.Model.ResourceReference? Appointment { get { return _Appointment; } set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private Hl7.Fhir.Model.ResourceReference _Appointment; + private Hl7.Fhir.Model.ResourceReference? _Appointment; /// /// The start and end time of the encounter. /// [FhirElement("period", Order=210, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Quantity of time the encounter lasted (less time absent). /// [FhirElement("length", Order=220)] [DataMember] - public Hl7.Fhir.Model.Duration Length + public Hl7.Fhir.Model.Duration? Length { get { return _Length; } set { _Length = value; OnPropertyChanged("Length"); } } - private Hl7.Fhir.Model.Duration _Length; + private Hl7.Fhir.Model.Duration? _Length; /// /// Reason the encounter takes place (code). @@ -1393,11 +1360,11 @@ public Hl7.Fhir.Model.Duration Length [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// The list of diagnosis relevant to this encounter. @@ -1407,11 +1374,11 @@ public List Reason [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The set of accounts that may be used for billing for this Encounter. @@ -1423,24 +1390,24 @@ public List Diagnosis [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Details about the admission to a healthcare service. /// [FhirElement("hospitalization", Order=260)] [DataMember] - public Hl7.Fhir.Model.Encounter.HospitalizationComponent Hospitalization + public Hl7.Fhir.Model.Encounter.HospitalizationComponent? Hospitalization { get { return _Hospitalization; } set { _Hospitalization = value; OnPropertyChanged("Hospitalization"); } } - private Hl7.Fhir.Model.Encounter.HospitalizationComponent _Hospitalization; + private Hl7.Fhir.Model.Encounter.HospitalizationComponent? _Hospitalization; /// /// List of locations where the patient has been. @@ -1450,11 +1417,11 @@ public Hl7.Fhir.Model.Encounter.HospitalizationComponent Hospitalization [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// The custodian organization of this Encounter record. @@ -1463,13 +1430,13 @@ public List Location [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ServiceProvider + public Hl7.Fhir.Model.ResourceReference? ServiceProvider { get { return _ServiceProvider; } set { _ServiceProvider = value; OnPropertyChanged("ServiceProvider"); } } - private Hl7.Fhir.Model.ResourceReference _ServiceProvider; + private Hl7.Fhir.Model.ResourceReference? _ServiceProvider; /// /// Another Encounter this encounter is part of. @@ -1478,47 +1445,43 @@ public Hl7.Fhir.Model.ResourceReference ServiceProvider [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Encounter; - - if (dest == null) - { + if(other is not Encounter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusHistory.Any()) dest.StatusHistory = new List(StatusHistory.DeepCopyInternal()); - if(Class != null) dest.Class = (Hl7.Fhir.Model.Coding)Class.DeepCopyInternal(); - if(ClassHistory.Any()) dest.ClassHistory = new List(ClassHistory.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(EpisodeOfCare.Any()) dest.EpisodeOfCare = new List(EpisodeOfCare.DeepCopyInternal()); - if(IncomingReferral.Any()) dest.IncomingReferral = new List(IncomingReferral.DeepCopyInternal()); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Appointment != null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)Appointment.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Length != null) dest.Length = (Hl7.Fhir.Model.Duration)Length.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(Hospitalization != null) dest.Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)Hospitalization.DeepCopyInternal(); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(ServiceProvider != null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)ServiceProvider.DeepCopyInternal(); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusHistory is not null) dest.StatusHistory = new List(_StatusHistory.DeepCopyInternal()); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.Coding)_Class.DeepCopyInternal(); + if(_ClassHistory is not null) dest.ClassHistory = new List(_ClassHistory.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_EpisodeOfCare is not null) dest.EpisodeOfCare = new List(_EpisodeOfCare.DeepCopyInternal()); + if(_IncomingReferral is not null) dest.IncomingReferral = new List(_IncomingReferral.DeepCopyInternal()); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)_Appointment.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Length is not null) dest.Length = (Hl7.Fhir.Model.Duration)_Length.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_Hospitalization is not null) dest.Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)_Hospitalization.DeepCopyInternal(); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_ServiceProvider is not null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)_ServiceProvider.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1530,174 +1493,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Encounter; - if(otherT == null) return false; + if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusHistory, otherT.StatusHistory)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(ClassHistory, otherT.ClassHistory)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(EpisodeOfCare, otherT.EpisodeOfCare)) return false; - if(!comparer.ListEquals(IncomingReferral, otherT.IncomingReferral)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Appointment, otherT.Appointment)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Length, otherT.Length)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.Equals(Hospitalization, otherT.Hospitalization)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(ServiceProvider, otherT.ServiceProvider)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_ClassHistory, otherT._ClassHistory)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_EpisodeOfCare, otherT._EpisodeOfCare)) return false; + if(!comparer.ListEquals(_IncomingReferral, otherT._IncomingReferral)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Length, otherT._Length)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.Equals(_Hospitalization, otherT._Hospitalization)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_ServiceProvider, otherT._ServiceProvider)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusHistory": - value = StatusHistory; - return StatusHistory?.Any() == true; + value = _StatusHistory; + return _StatusHistory?.Any() == true; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "classHistory": - value = ClassHistory; - return ClassHistory?.Any() == true; + value = _ClassHistory; + return _ClassHistory?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "episodeOfCare": - value = EpisodeOfCare; - return EpisodeOfCare?.Any() == true; + value = _EpisodeOfCare; + return _EpisodeOfCare?.Any() == true; case "incomingReferral": - value = IncomingReferral; - return IncomingReferral?.Any() == true; + value = _IncomingReferral; + return _IncomingReferral?.Any() == true; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "appointment": - value = Appointment; - return Appointment is not null; + value = _Appointment; + return _Appointment is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "length": - value = Length; - return Length is not null; + value = _Length; + return _Length is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "hospitalization": - value = Hospitalization; - return Hospitalization is not null; + value = _Hospitalization; + return _Hospitalization is not null; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "serviceProvider": - value = ServiceProvider; - return ServiceProvider is not null; + value = _ServiceProvider; + return _ServiceProvider is not null; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusHistory": - StatusHistory = (List)value; + StatusHistory = (List?)value!; return this; case "class": - Class = (Hl7.Fhir.Model.Coding)value; + Class = (Hl7.Fhir.Model.Coding?)value; return this; case "classHistory": - ClassHistory = (List)value; + ClassHistory = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "episodeOfCare": - EpisodeOfCare = (List)value; + EpisodeOfCare = (List?)value!; return this; case "incomingReferral": - IncomingReferral = (List)value; + IncomingReferral = (List?)value!; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "appointment": - Appointment = (Hl7.Fhir.Model.ResourceReference)value; + Appointment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "length": - Length = (Hl7.Fhir.Model.Duration)value; + Length = (Hl7.Fhir.Model.Duration?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "hospitalization": - Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)value; + Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent?)value; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "serviceProvider": - ServiceProvider = (Hl7.Fhir.Model.ResourceReference)value; + ServiceProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1708,27 +1671,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",StatusHistory); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (ClassHistory?.Any() == true) yield return new KeyValuePair("classHistory",ClassHistory); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",EpisodeOfCare); - if (IncomingReferral?.Any() == true) yield return new KeyValuePair("incomingReferral",IncomingReferral); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Appointment is not null) yield return new KeyValuePair("appointment",Appointment); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Length is not null) yield return new KeyValuePair("length",Length); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (Hospitalization is not null) yield return new KeyValuePair("hospitalization",Hospitalization); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",ServiceProvider); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",_StatusHistory); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_ClassHistory?.Any() == true) yield return new KeyValuePair("classHistory",_ClassHistory); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",_EpisodeOfCare); + if (_IncomingReferral?.Any() == true) yield return new KeyValuePair("incomingReferral",_IncomingReferral); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Appointment is not null) yield return new KeyValuePair("appointment",_Appointment); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Length is not null) yield return new KeyValuePair("length",_Length); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_Hospitalization is not null) yield return new KeyValuePair("hospitalization",_Hospitalization); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",_ServiceProvider); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs index 12f99375f..93fb62b6e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,11 +116,11 @@ public enum EndpointStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | error | off | entered-in-error | test. @@ -127,13 +130,13 @@ public List Identifier [Binding("EndpointStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | error | off | entered-in-error | test @@ -142,13 +145,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -160,41 +160,38 @@ public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status [Binding("endpoint-contype")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding ConnectionType + public Hl7.Fhir.Model.Coding? ConnectionType { get { return _ConnectionType; } set { _ConnectionType = value; OnPropertyChanged("ConnectionType"); } } - private Hl7.Fhir.Model.Coding _ConnectionType; + private Hl7.Fhir.Model.Coding? _ConnectionType; /// /// A name that this endpoint can be identified by. /// [FhirElement("name", InSummary=true, Order=120, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name that this endpoint can be identified by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -206,13 +203,13 @@ public string Name [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Contact details for source (e.g. troubleshooting). @@ -222,24 +219,24 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Interval the endpoint is expected to be operational. /// [FhirElement("period", InSummary=true, Order=150, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The type of content that may be used at this endpoint (e.g. XDS Discharge summaries). @@ -250,11 +247,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List PayloadType { - get { if(_PayloadType==null) _PayloadType = new List(); return _PayloadType; } + get => _PayloadType ?? new List(); set { _PayloadType = value; OnPropertyChanged("PayloadType"); } } - private List _PayloadType; + private List? _PayloadType; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this). @@ -265,24 +262,24 @@ public List PayloadType [DataMember] public List PayloadMimeTypeElement { - get { if(_PayloadMimeTypeElement==null) _PayloadMimeTypeElement = new List(); return _PayloadMimeTypeElement; } + get => _PayloadMimeTypeElement ?? new List(); set { _PayloadMimeTypeElement = value; OnPropertyChanged("PayloadMimeTypeElement"); } } - private List _PayloadMimeTypeElement; + private List? _PayloadMimeTypeElement; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PayloadMimeType + public IEnumerable? PayloadMimeType { - get { return PayloadMimeTypeElement != null ? PayloadMimeTypeElement.Select(elem => elem.Value) : null; } + get => _PayloadMimeTypeElement?.Select(elem => elem.Value); set { if (value == null) - PayloadMimeTypeElement = null; + PayloadMimeTypeElement = null!; else PayloadMimeTypeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("PayloadMimeType"); @@ -295,28 +292,25 @@ public IEnumerable PayloadMimeType [FhirElement("address", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri AddressElement + public Hl7.Fhir.Model.FhirUri? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirUri _AddressElement; + private Hl7.Fhir.Model.FhirUri? _AddressElement; /// /// The technical base address for connecting to this endpoint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirUri(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Address"); } } @@ -329,24 +323,24 @@ public string Address [DataMember] public List HeaderElement { - get { if(_HeaderElement==null) _HeaderElement = new List(); return _HeaderElement; } + get => _HeaderElement ?? new List(); set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } - private List _HeaderElement; + private List? _HeaderElement; /// /// Usage depends on the channel type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Header + public IEnumerable? Header { - get { return HeaderElement != null ? HeaderElement.Select(elem => elem.Value) : null; } + get => _HeaderElement?.Select(elem => elem.Value); set { if (value == null) - HeaderElement = null; + HeaderElement = null!; else HeaderElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Header"); @@ -357,25 +351,21 @@ public IEnumerable Header protected internal override void CopyToInternal(Base other) { - var dest = other as Endpoint; - - if (dest == null) - { + if(other is not Endpoint dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ConnectionType != null) dest.ConnectionType = (Hl7.Fhir.Model.Coding)ConnectionType.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(PayloadType.Any()) dest.PayloadType = new List(PayloadType.DeepCopyInternal()); - if(PayloadMimeTypeElement.Any()) dest.PayloadMimeTypeElement = new List(PayloadMimeTypeElement.DeepCopyInternal()); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirUri)AddressElement.DeepCopyInternal(); - if(HeaderElement.Any()) dest.HeaderElement = new List(HeaderElement.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ConnectionType is not null) dest.ConnectionType = (Hl7.Fhir.Model.Coding)_ConnectionType.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_PayloadType is not null) dest.PayloadType = new List(_PayloadType.DeepCopyInternal()); + if(_PayloadMimeTypeElement is not null) dest.PayloadMimeTypeElement = new List(_PayloadMimeTypeElement.DeepCopyInternal()); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirUri)_AddressElement.DeepCopyInternal(); + if(_HeaderElement is not null) dest.HeaderElement = new List(_HeaderElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -387,104 +377,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Endpoint; - if(otherT == null) return false; + if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ConnectionType, otherT.ConnectionType)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(PayloadType, otherT.PayloadType)) return false; - if(!comparer.ListEquals(PayloadMimeTypeElement, otherT.PayloadMimeTypeElement)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; - if(!comparer.ListEquals(HeaderElement, otherT.HeaderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ConnectionType, otherT._ConnectionType)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_PayloadType, otherT._PayloadType)) return false; + if(!comparer.ListEquals(_PayloadMimeTypeElement, otherT._PayloadMimeTypeElement)) return false; + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "connectionType": - value = ConnectionType; - return ConnectionType is not null; + value = _ConnectionType; + return _ConnectionType is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "payloadType": - value = PayloadType; - return PayloadType?.Any() == true; + value = _PayloadType; + return _PayloadType?.Any() == true; case "payloadMimeType": - value = PayloadMimeTypeElement; - return PayloadMimeTypeElement?.Any() == true; + value = _PayloadMimeTypeElement; + return _PayloadMimeTypeElement?.Any() == true; case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; case "header": - value = HeaderElement; - return HeaderElement?.Any() == true; + value = _HeaderElement; + return _HeaderElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "connectionType": - ConnectionType = (Hl7.Fhir.Model.Coding)value; + ConnectionType = (Hl7.Fhir.Model.Coding?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "payloadType": - PayloadType = (List)value; + PayloadType = (List?)value!; return this; case "payloadMimeType": - PayloadMimeTypeElement = (List)value; + PayloadMimeTypeElement = (List?)value!; return this; case "address": - AddressElement = (Hl7.Fhir.Model.FhirUri)value; + AddressElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "header": - HeaderElement = (List)value; + HeaderElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -495,17 +485,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ConnectionType is not null) yield return new KeyValuePair("connectionType",ConnectionType); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (PayloadType?.Any() == true) yield return new KeyValuePair("payloadType",PayloadType); - if (PayloadMimeTypeElement?.Any() == true) yield return new KeyValuePair("payloadMimeType",PayloadMimeTypeElement); - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); - if (HeaderElement?.Any() == true) yield return new KeyValuePair("header",HeaderElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ConnectionType is not null) yield return new KeyValuePair("connectionType",_ConnectionType); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_PayloadType?.Any() == true) yield return new KeyValuePair("payloadType",_PayloadType); + if (_PayloadMimeTypeElement?.Any() == true) yield return new KeyValuePair("payloadMimeType",_PayloadMimeTypeElement); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); + if (_HeaderElement?.Any() == true) yield return new KeyValuePair("header",_HeaderElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs index 72b7046e8..c115ad405 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -111,28 +111,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("created", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -144,13 +141,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Responsible practitioner. @@ -159,13 +156,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Responsible organization. @@ -174,13 +171,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// The subject of the Products and Services. @@ -189,13 +186,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Insurance information. @@ -204,34 +201,30 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Coverage")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentRequest; - - if (dest == null) - { + if(other is not EnrollmentRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -243,83 +236,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentRequest; - if(otherT == null) return false; + if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -330,14 +323,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs index cd8a64950..753a91e14 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EnrollmentResponse : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentResponseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -113,13 +113,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("EnrollmentRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// complete | error | partial. @@ -127,41 +127,38 @@ public Hl7.Fhir.Model.ResourceReference Request [FhirElement("outcome", Order=120)] [Binding("RemittanceOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Disposition Message. /// [FhirElement("disposition", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -171,28 +168,25 @@ public string Disposition /// [FhirElement("created", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -204,13 +198,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Responsible practitioner. @@ -219,13 +213,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; /// /// Responsible organization. @@ -234,35 +228,31 @@ public Hl7.Fhir.Model.ResourceReference RequestProvider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestOrganization + public Hl7.Fhir.Model.ResourceReference? RequestOrganization { get { return _RequestOrganization; } set { _RequestOrganization = value; OnPropertyChanged("RequestOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestOrganization; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentResponse; - - if (dest == null) - { + if(other is not EnrollmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); - if(RequestOrganization != null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)RequestOrganization.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); + if(_RequestOrganization is not null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestOrganization.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -274,90 +264,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentResponse; - if(otherT == null) return false; + if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; - if(!comparer.Equals(RequestOrganization, otherT.RequestOrganization)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; + if(!comparer.Equals(_RequestOrganization, otherT._RequestOrganization)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; case "requestOrganization": - value = RequestOrganization; - return RequestOrganization is not null; + value = _RequestOrganization; + return _RequestOrganization is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestOrganization": - RequestOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -368,15 +358,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); - if (RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",RequestOrganization); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); + if (_RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",_RequestOrganization); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs index 2bcb012f7..119962074 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -135,13 +138,13 @@ public partial class StatusHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -150,13 +153,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -167,26 +167,22 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusHistoryComponent; - - if (dest == null) - { + if(other is not StatusHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -198,41 +194,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusHistoryComponent; - if(otherT == null) return false; + if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -243,8 +239,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -270,13 +266,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …). @@ -284,26 +280,26 @@ public Hl7.Fhir.Model.ResourceReference Condition [FhirElement("role", InSummary=true, Order=50)] [Binding("DiagnosisRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Ranking of the diagnosis (for each role type). /// [FhirElement("rank", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankElement + public Hl7.Fhir.Model.PositiveInt? RankElement { get { return _RankElement; } set { _RankElement = value; OnPropertyChanged("RankElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankElement; + private Hl7.Fhir.Model.PositiveInt? _RankElement; /// /// Ranking of the diagnosis (for each role type) @@ -312,30 +308,23 @@ public Hl7.Fhir.Model.PositiveInt RankElement [IgnoreDataMember] public int? Rank { - get { return RankElement != null ? RankElement.Value : null; } + get => _RankElement?.Value; set { - if (value == null) - RankElement = null; - else - RankElement = new Hl7.Fhir.Model.PositiveInt(value); + RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Rank"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -347,48 +336,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(RankElement, otherT.RankElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "rank": - value = RankElement; - return RankElement is not null; + value = _RankElement; + return _RankElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rank": - RankElement = (Hl7.Fhir.Model.PositiveInt)value; + RankElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -399,9 +388,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (RankElement is not null) yield return new KeyValuePair("rank",RankElement); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement); } } @@ -414,11 +403,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error. @@ -428,13 +417,13 @@ public List Identifier [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -443,13 +432,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -462,11 +448,11 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get { if(_StatusHistory==null) _StatusHistory = new List(); return _StatusHistory; } + get => _StatusHistory ?? new List(); set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } - private List _StatusHistory; + private List? _StatusHistory; /// /// Type/class - e.g. specialist referral, disease management. @@ -477,11 +463,11 @@ public List StatusHistory [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// The list of diagnosis relevant to this episode of care. @@ -491,11 +477,11 @@ public List Type [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The patient who is the focus of this episode of care. @@ -505,13 +491,13 @@ public List Diagnosis [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Organization that assumes care. @@ -520,26 +506,26 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Interval during responsibility is assumed. /// [FhirElement("period", InSummary=true, Order=160, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Originating Referral Request(s). @@ -551,11 +537,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List ReferralRequest { - get { if(_ReferralRequest==null) _ReferralRequest = new List(); return _ReferralRequest; } + get => _ReferralRequest ?? new List(); set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } - private List _ReferralRequest; + private List? _ReferralRequest; /// /// Care manager/care co-ordinator for the patient. @@ -564,13 +550,13 @@ public List ReferralRequest [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CareManager + public Hl7.Fhir.Model.ResourceReference? CareManager { get { return _CareManager; } set { _CareManager = value; OnPropertyChanged("CareManager"); } } - private Hl7.Fhir.Model.ResourceReference _CareManager; + private Hl7.Fhir.Model.ResourceReference? _CareManager; /// /// Other practitioners facilitating this episode of care. @@ -582,11 +568,11 @@ public Hl7.Fhir.Model.ResourceReference CareManager [DataMember] public List Team { - get { if(_Team==null) _Team = new List(); return _Team; } + get => _Team ?? new List(); set { _Team = value; OnPropertyChanged("Team"); } } - private List _Team; + private List? _Team; /// /// The set of accounts that may be used for billing for this EpisodeOfCare. @@ -598,36 +584,32 @@ public List Team [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EpisodeOfCare; - - if (dest == null) - { + if(other is not EpisodeOfCare dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusHistory.Any()) dest.StatusHistory = new List(StatusHistory.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(ReferralRequest.Any()) dest.ReferralRequest = new List(ReferralRequest.DeepCopyInternal()); - if(CareManager != null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)CareManager.DeepCopyInternal(); - if(Team.Any()) dest.Team = new List(Team.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusHistory is not null) dest.StatusHistory = new List(_StatusHistory.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_ReferralRequest is not null) dest.ReferralRequest = new List(_ReferralRequest.DeepCopyInternal()); + if(_CareManager is not null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)_CareManager.DeepCopyInternal(); + if(_Team is not null) dest.Team = new List(_Team.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -639,111 +621,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EpisodeOfCare; - if(otherT == null) return false; + if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusHistory, otherT.StatusHistory)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(ReferralRequest, otherT.ReferralRequest)) return false; - if(!comparer.Equals(CareManager, otherT.CareManager)) return false; - if(!comparer.ListEquals(Team, otherT.Team)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_ReferralRequest, otherT._ReferralRequest)) return false; + if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; + if(!comparer.ListEquals(_Team, otherT._Team)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusHistory": - value = StatusHistory; - return StatusHistory?.Any() == true; + value = _StatusHistory; + return _StatusHistory?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "referralRequest": - value = ReferralRequest; - return ReferralRequest?.Any() == true; + value = _ReferralRequest; + return _ReferralRequest?.Any() == true; case "careManager": - value = CareManager; - return CareManager is not null; + value = _CareManager; + return _CareManager is not null; case "team": - value = Team; - return Team?.Any() == true; + value = _Team; + return _Team?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusHistory": - StatusHistory = (List)value; + StatusHistory = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "referralRequest": - ReferralRequest = (List)value; + ReferralRequest = (List?)value!; return this; case "careManager": - CareManager = (Hl7.Fhir.Model.ResourceReference)value; + CareManager = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "team": - Team = (List)value; + Team = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; default: return base.SetValue(key, value); @@ -754,18 +736,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",StatusHistory); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",ReferralRequest); - if (CareManager is not null) yield return new KeyValuePair("careManager",CareManager); - if (Team?.Any() == true) yield return new KeyValuePair("team",Team); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",_StatusHistory); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",_ReferralRequest); + if (_CareManager is not null) yield return new KeyValuePair("careManager",_CareManager); + if (_Team?.Any() == true) yield return new KeyValuePair("team",_Team); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs index faf76edeb..1ca385928 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,28 +112,25 @@ public partial class FixedVersionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("system", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// System to have its version fixed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -141,28 +141,25 @@ public string System [FhirElement("version", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Specific version of the code system referred to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -175,13 +172,13 @@ public string Version [Binding("SystemVersionProcessingMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// default | check | override @@ -190,30 +187,23 @@ public Code ModeEle [IgnoreDataMember] public Hl7.Fhir.Model.ExpansionProfile.SystemVersionProcessingMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FixedVersionComponent; - - if (dest == null) - { + if(other is not FixedVersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -225,48 +215,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FixedVersionComponent; - if(otherT == null) return false; + if(other is not FixedVersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -277,9 +267,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); } } @@ -307,28 +297,25 @@ public partial class ExcludedSystemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("system", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// The specific code system to be excluded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -338,44 +325,37 @@ public string System /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Specific version of the code system referred to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ExcludedSystemComponent; - - if (dest == null) - { + if(other is not ExcludedSystemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -387,41 +367,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExcludedSystemComponent; - if(otherT == null) return false; + if(other is not ExcludedSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -432,8 +412,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -459,39 +439,35 @@ public partial class DesignationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("include", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent Include + public Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent? Include { get { return _Include; } set { _Include = value; OnPropertyChanged("Include"); } } - private Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent _Include; + private Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent? _Include; /// /// Designations to be excluded. /// [FhirElement("exclude", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent Exclude + public Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent? Exclude { get { return _Exclude; } set { _Exclude = value; OnPropertyChanged("Exclude"); } } - private Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent _Exclude; + private Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent? _Exclude; protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationComponent; - - if (dest == null) - { + if(other is not DesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Include != null) dest.Include = (Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent)Include.DeepCopyInternal(); - if(Exclude != null) dest.Exclude = (Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent)Exclude.DeepCopyInternal(); + if(_Include is not null) dest.Include = (Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent)_Include.DeepCopyInternal(); + if(_Exclude is not null) dest.Exclude = (Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent)_Exclude.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -503,41 +479,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationComponent; - if(otherT == null) return false; + if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Include, otherT.Include)) return false; - if(!comparer.Equals(Exclude, otherT.Exclude)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Include, otherT._Include)) return false; + if(!comparer.Equals(_Exclude, otherT._Exclude)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "include": - value = Include; - return Include is not null; + value = _Include; + return _Include is not null; case "exclude": - value = Exclude; - return Exclude is not null; + value = _Exclude; + return _Exclude is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "include": - Include = (Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent)value; + Include = (Hl7.Fhir.Model.ExpansionProfile.DesignationIncludeComponent?)value; return this; case "exclude": - Exclude = (Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent)value; + Exclude = (Hl7.Fhir.Model.ExpansionProfile.DesignationExcludeComponent?)value; return this; default: return base.SetValue(key, value); @@ -548,8 +524,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Include is not null) yield return new KeyValuePair("include",Include); - if (Exclude is not null) yield return new KeyValuePair("exclude",Exclude); + if (_Include is not null) yield return new KeyValuePair("include",_Include); + if (_Exclude is not null) yield return new KeyValuePair("exclude",_Exclude); } } @@ -575,23 +551,19 @@ public partial class DesignationIncludeComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationIncludeComponent; - - if (dest == null) - { + if(other is not DesignationIncludeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -603,34 +575,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationIncludeComponent; - if(otherT == null) return false; + if(other is not DesignationIncludeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -641,7 +613,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); } } @@ -669,28 +641,25 @@ public partial class DesignationIncludeDesignationComponent : Hl7.Fhir.Model.Bac [FhirElement("language", InSummary=true, Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Human language of the designation to be included /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -701,26 +670,22 @@ public string Language [FhirElement("use", InSummary=true, Order=50)] [Binding("ConceptDesignationUse")] [DataMember] - public Hl7.Fhir.Model.Coding Use + public Hl7.Fhir.Model.Coding? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.Coding _Use; + private Hl7.Fhir.Model.Coding? _Use; protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationIncludeDesignationComponent; - - if (dest == null) - { + if(other is not DesignationIncludeDesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.Coding)Use.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.Coding)_Use.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -732,41 +697,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationIncludeDesignationComponent; - if(otherT == null) return false; + if(other is not DesignationIncludeDesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - Use = (Hl7.Fhir.Model.Coding)value; + Use = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -777,8 +742,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (Use is not null) yield return new KeyValuePair("use",Use); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_Use is not null) yield return new KeyValuePair("use",_Use); } } @@ -804,23 +769,19 @@ public partial class DesignationExcludeComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationExcludeComponent; - - if (dest == null) - { + if(other is not DesignationExcludeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -832,34 +793,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationExcludeComponent; - if(otherT == null) return false; + if(other is not DesignationExcludeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -870,7 +831,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); } } @@ -898,28 +859,25 @@ public partial class DesignationExcludeDesignationComponent : Hl7.Fhir.Model.Bac [FhirElement("language", InSummary=true, Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Human language of the designation to be excluded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -930,26 +888,22 @@ public string Language [FhirElement("use", InSummary=true, Order=50)] [Binding("ConceptDesignationUse")] [DataMember] - public Hl7.Fhir.Model.Coding Use + public Hl7.Fhir.Model.Coding? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.Coding _Use; + private Hl7.Fhir.Model.Coding? _Use; protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationExcludeDesignationComponent; - - if (dest == null) - { + if(other is not DesignationExcludeDesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.Coding)Use.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.Coding)_Use.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -961,41 +915,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationExcludeDesignationComponent; - if(otherT == null) return false; + if(other is not DesignationExcludeDesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - Use = (Hl7.Fhir.Model.Coding)value; + Use = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -1006,8 +960,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (Use is not null) yield return new KeyValuePair("use",Use); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_Use is not null) yield return new KeyValuePair("use",_Use); } } @@ -1017,28 +971,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this expansion profile (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1048,41 +999,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the expansion profile. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the expansion profile /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1092,28 +1040,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this expansion profile (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1126,13 +1071,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1141,13 +1086,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1157,13 +1099,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=140, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1172,13 +1114,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1188,28 +1127,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1219,28 +1155,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1253,39 +1186,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the expansion profile. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the expansion profile /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1298,11 +1228,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for expansion profile (if applicable). @@ -1313,11 +1243,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Fix use of a code system to a particular version. @@ -1327,37 +1257,37 @@ public List Jurisdiction [DataMember] public List FixedVersion { - get { if(_FixedVersion==null) _FixedVersion = new List(); return _FixedVersion; } + get => _FixedVersion ?? new List(); set { _FixedVersion = value; OnPropertyChanged("FixedVersion"); } } - private List _FixedVersion; + private List? _FixedVersion; /// /// Systems/Versions to be exclude. /// [FhirElement("excludedSystem", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent ExcludedSystem + public Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent? ExcludedSystem { get { return _ExcludedSystem; } set { _ExcludedSystem = value; OnPropertyChanged("ExcludedSystem"); } } - private Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent _ExcludedSystem; + private Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent? _ExcludedSystem; /// /// Whether the expansion should include concept designations. /// [FhirElement("includeDesignations", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IncludeDesignationsElement + public Hl7.Fhir.Model.FhirBoolean? IncludeDesignationsElement { get { return _IncludeDesignationsElement; } set { _IncludeDesignationsElement = value; OnPropertyChanged("IncludeDesignationsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IncludeDesignationsElement; + private Hl7.Fhir.Model.FhirBoolean? _IncludeDesignationsElement; /// /// Whether the expansion should include concept designations @@ -1366,13 +1296,10 @@ public Hl7.Fhir.Model.FhirBoolean IncludeDesignationsElement [IgnoreDataMember] public bool? IncludeDesignations { - get { return IncludeDesignationsElement != null ? IncludeDesignationsElement.Value : null; } + get => _IncludeDesignationsElement?.Value; set { - if (value == null) - IncludeDesignationsElement = null; - else - IncludeDesignationsElement = new Hl7.Fhir.Model.FhirBoolean(value); + IncludeDesignationsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IncludeDesignations"); } } @@ -1382,26 +1309,26 @@ public bool? IncludeDesignations /// [FhirElement("designation", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.ExpansionProfile.DesignationComponent Designation + public Hl7.Fhir.Model.ExpansionProfile.DesignationComponent? Designation { get { return _Designation; } set { _Designation = value; OnPropertyChanged("Designation"); } } - private Hl7.Fhir.Model.ExpansionProfile.DesignationComponent _Designation; + private Hl7.Fhir.Model.ExpansionProfile.DesignationComponent? _Designation; /// /// Include or exclude the value set definition in the expansion. /// [FhirElement("includeDefinition", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IncludeDefinitionElement + public Hl7.Fhir.Model.FhirBoolean? IncludeDefinitionElement { get { return _IncludeDefinitionElement; } set { _IncludeDefinitionElement = value; OnPropertyChanged("IncludeDefinitionElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IncludeDefinitionElement; + private Hl7.Fhir.Model.FhirBoolean? _IncludeDefinitionElement; /// /// Include or exclude the value set definition in the expansion @@ -1410,13 +1337,10 @@ public Hl7.Fhir.Model.FhirBoolean IncludeDefinitionElement [IgnoreDataMember] public bool? IncludeDefinition { - get { return IncludeDefinitionElement != null ? IncludeDefinitionElement.Value : null; } + get => _IncludeDefinitionElement?.Value; set { - if (value == null) - IncludeDefinitionElement = null; - else - IncludeDefinitionElement = new Hl7.Fhir.Model.FhirBoolean(value); + IncludeDefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IncludeDefinition"); } } @@ -1426,13 +1350,13 @@ public bool? IncludeDefinition /// [FhirElement("activeOnly", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveOnlyElement + public Hl7.Fhir.Model.FhirBoolean? ActiveOnlyElement { get { return _ActiveOnlyElement; } set { _ActiveOnlyElement = value; OnPropertyChanged("ActiveOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveOnlyElement; /// /// Include or exclude inactive concepts in the expansion @@ -1441,13 +1365,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveOnlyElement [IgnoreDataMember] public bool? ActiveOnly { - get { return ActiveOnlyElement != null ? ActiveOnlyElement.Value : null; } + get => _ActiveOnlyElement?.Value; set { - if (value == null) - ActiveOnlyElement = null; - else - ActiveOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ActiveOnly"); } } @@ -1457,13 +1378,13 @@ public bool? ActiveOnly /// [FhirElement("excludeNested", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeNestedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeNestedElement { get { return _ExcludeNestedElement; } set { _ExcludeNestedElement = value; OnPropertyChanged("ExcludeNestedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeNestedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeNestedElement; /// /// Nested codes in the expansion or not @@ -1472,13 +1393,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeNestedElement [IgnoreDataMember] public bool? ExcludeNested { - get { return ExcludeNestedElement != null ? ExcludeNestedElement.Value : null; } + get => _ExcludeNestedElement?.Value; set { - if (value == null) - ExcludeNestedElement = null; - else - ExcludeNestedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeNestedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ExcludeNested"); } } @@ -1488,13 +1406,13 @@ public bool? ExcludeNested /// [FhirElement("excludeNotForUI", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeNotForUIElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeNotForUIElement { get { return _ExcludeNotForUIElement; } set { _ExcludeNotForUIElement = value; OnPropertyChanged("ExcludeNotForUIElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeNotForUIElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeNotForUIElement; /// /// Include or exclude codes which cannot be rendered in user interfaces in the value set expansion @@ -1503,13 +1421,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeNotForUIElement [IgnoreDataMember] public bool? ExcludeNotForUI { - get { return ExcludeNotForUIElement != null ? ExcludeNotForUIElement.Value : null; } + get => _ExcludeNotForUIElement?.Value; set { - if (value == null) - ExcludeNotForUIElement = null; - else - ExcludeNotForUIElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeNotForUIElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ExcludeNotForUI"); } } @@ -1519,13 +1434,13 @@ public bool? ExcludeNotForUI /// [FhirElement("excludePostCoordinated", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludePostCoordinatedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludePostCoordinatedElement { get { return _ExcludePostCoordinatedElement; } set { _ExcludePostCoordinatedElement = value; OnPropertyChanged("ExcludePostCoordinatedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludePostCoordinatedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludePostCoordinatedElement; /// /// Include or exclude codes which are post coordinated expressions in the value set expansion @@ -1534,13 +1449,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludePostCoordinatedElement [IgnoreDataMember] public bool? ExcludePostCoordinated { - get { return ExcludePostCoordinatedElement != null ? ExcludePostCoordinatedElement.Value : null; } + get => _ExcludePostCoordinatedElement?.Value; set { - if (value == null) - ExcludePostCoordinatedElement = null; - else - ExcludePostCoordinatedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludePostCoordinatedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ExcludePostCoordinated"); } } @@ -1551,28 +1463,25 @@ public bool? ExcludePostCoordinated [FhirElement("displayLanguage", InSummary=true, Order=300)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code DisplayLanguageElement + public Hl7.Fhir.Model.Code? DisplayLanguageElement { get { return _DisplayLanguageElement; } set { _DisplayLanguageElement = value; OnPropertyChanged("DisplayLanguageElement"); } } - private Hl7.Fhir.Model.Code _DisplayLanguageElement; + private Hl7.Fhir.Model.Code? _DisplayLanguageElement; /// /// Specify the language for the display element of codes in the value set expansion /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DisplayLanguage + public string? DisplayLanguage { - get { return DisplayLanguageElement != null ? DisplayLanguageElement.Value : null; } + get => _DisplayLanguageElement?.Value; set { - if (value == null) - DisplayLanguageElement = null; - else - DisplayLanguageElement = new Hl7.Fhir.Model.Code(value); + DisplayLanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("DisplayLanguage"); } } @@ -1582,13 +1491,13 @@ public string DisplayLanguage /// [FhirElement("limitedExpansion", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean LimitedExpansionElement + public Hl7.Fhir.Model.FhirBoolean? LimitedExpansionElement { get { return _LimitedExpansionElement; } set { _LimitedExpansionElement = value; OnPropertyChanged("LimitedExpansionElement"); } } - private Hl7.Fhir.Model.FhirBoolean _LimitedExpansionElement; + private Hl7.Fhir.Model.FhirBoolean? _LimitedExpansionElement; /// /// Controls behaviour of the value set expand operation when value sets are too large to be completely expanded @@ -1597,52 +1506,45 @@ public Hl7.Fhir.Model.FhirBoolean LimitedExpansionElement [IgnoreDataMember] public bool? LimitedExpansion { - get { return LimitedExpansionElement != null ? LimitedExpansionElement.Value : null; } + get => _LimitedExpansionElement?.Value; set { - if (value == null) - LimitedExpansionElement = null; - else - LimitedExpansionElement = new Hl7.Fhir.Model.FhirBoolean(value); + LimitedExpansionElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("LimitedExpansion"); } } - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ExpansionProfile; - - if (dest == null) - { + if(other is not ExpansionProfile dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(FixedVersion.Any()) dest.FixedVersion = new List(FixedVersion.DeepCopyInternal()); - if(ExcludedSystem != null) dest.ExcludedSystem = (Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent)ExcludedSystem.DeepCopyInternal(); - if(IncludeDesignationsElement != null) dest.IncludeDesignationsElement = (Hl7.Fhir.Model.FhirBoolean)IncludeDesignationsElement.DeepCopyInternal(); - if(Designation != null) dest.Designation = (Hl7.Fhir.Model.ExpansionProfile.DesignationComponent)Designation.DeepCopyInternal(); - if(IncludeDefinitionElement != null) dest.IncludeDefinitionElement = (Hl7.Fhir.Model.FhirBoolean)IncludeDefinitionElement.DeepCopyInternal(); - if(ActiveOnlyElement != null) dest.ActiveOnlyElement = (Hl7.Fhir.Model.FhirBoolean)ActiveOnlyElement.DeepCopyInternal(); - if(ExcludeNestedElement != null) dest.ExcludeNestedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeNestedElement.DeepCopyInternal(); - if(ExcludeNotForUIElement != null) dest.ExcludeNotForUIElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeNotForUIElement.DeepCopyInternal(); - if(ExcludePostCoordinatedElement != null) dest.ExcludePostCoordinatedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludePostCoordinatedElement.DeepCopyInternal(); - if(DisplayLanguageElement != null) dest.DisplayLanguageElement = (Hl7.Fhir.Model.Code)DisplayLanguageElement.DeepCopyInternal(); - if(LimitedExpansionElement != null) dest.LimitedExpansionElement = (Hl7.Fhir.Model.FhirBoolean)LimitedExpansionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_FixedVersion is not null) dest.FixedVersion = new List(_FixedVersion.DeepCopyInternal()); + if(_ExcludedSystem is not null) dest.ExcludedSystem = (Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent)_ExcludedSystem.DeepCopyInternal(); + if(_IncludeDesignationsElement is not null) dest.IncludeDesignationsElement = (Hl7.Fhir.Model.FhirBoolean)_IncludeDesignationsElement.DeepCopyInternal(); + if(_Designation is not null) dest.Designation = (Hl7.Fhir.Model.ExpansionProfile.DesignationComponent)_Designation.DeepCopyInternal(); + if(_IncludeDefinitionElement is not null) dest.IncludeDefinitionElement = (Hl7.Fhir.Model.FhirBoolean)_IncludeDefinitionElement.DeepCopyInternal(); + if(_ActiveOnlyElement is not null) dest.ActiveOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveOnlyElement.DeepCopyInternal(); + if(_ExcludeNestedElement is not null) dest.ExcludeNestedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeNestedElement.DeepCopyInternal(); + if(_ExcludeNotForUIElement is not null) dest.ExcludeNotForUIElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeNotForUIElement.DeepCopyInternal(); + if(_ExcludePostCoordinatedElement is not null) dest.ExcludePostCoordinatedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludePostCoordinatedElement.DeepCopyInternal(); + if(_DisplayLanguageElement is not null) dest.DisplayLanguageElement = (Hl7.Fhir.Model.Code)_DisplayLanguageElement.DeepCopyInternal(); + if(_LimitedExpansionElement is not null) dest.LimitedExpansionElement = (Hl7.Fhir.Model.FhirBoolean)_LimitedExpansionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1654,188 +1556,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExpansionProfile; - if(otherT == null) return false; + if(other is not ExpansionProfile otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(FixedVersion, otherT.FixedVersion)) return false; - if(!comparer.Equals(ExcludedSystem, otherT.ExcludedSystem)) return false; - if(!comparer.Equals(IncludeDesignationsElement, otherT.IncludeDesignationsElement)) return false; - if(!comparer.Equals(Designation, otherT.Designation)) return false; - if(!comparer.Equals(IncludeDefinitionElement, otherT.IncludeDefinitionElement)) return false; - if(!comparer.Equals(ActiveOnlyElement, otherT.ActiveOnlyElement)) return false; - if(!comparer.Equals(ExcludeNestedElement, otherT.ExcludeNestedElement)) return false; - if(!comparer.Equals(ExcludeNotForUIElement, otherT.ExcludeNotForUIElement)) return false; - if(!comparer.Equals(ExcludePostCoordinatedElement, otherT.ExcludePostCoordinatedElement)) return false; - if(!comparer.Equals(DisplayLanguageElement, otherT.DisplayLanguageElement)) return false; - if(!comparer.Equals(LimitedExpansionElement, otherT.LimitedExpansionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_FixedVersion, otherT._FixedVersion)) return false; + if(!comparer.Equals(_ExcludedSystem, otherT._ExcludedSystem)) return false; + if(!comparer.Equals(_IncludeDesignationsElement, otherT._IncludeDesignationsElement)) return false; + if(!comparer.Equals(_Designation, otherT._Designation)) return false; + if(!comparer.Equals(_IncludeDefinitionElement, otherT._IncludeDefinitionElement)) return false; + if(!comparer.Equals(_ActiveOnlyElement, otherT._ActiveOnlyElement)) return false; + if(!comparer.Equals(_ExcludeNestedElement, otherT._ExcludeNestedElement)) return false; + if(!comparer.Equals(_ExcludeNotForUIElement, otherT._ExcludeNotForUIElement)) return false; + if(!comparer.Equals(_ExcludePostCoordinatedElement, otherT._ExcludePostCoordinatedElement)) return false; + if(!comparer.Equals(_DisplayLanguageElement, otherT._DisplayLanguageElement)) return false; + if(!comparer.Equals(_LimitedExpansionElement, otherT._LimitedExpansionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "fixedVersion": - value = FixedVersion; - return FixedVersion?.Any() == true; + value = _FixedVersion; + return _FixedVersion?.Any() == true; case "excludedSystem": - value = ExcludedSystem; - return ExcludedSystem is not null; + value = _ExcludedSystem; + return _ExcludedSystem is not null; case "includeDesignations": - value = IncludeDesignationsElement; - return IncludeDesignationsElement is not null; + value = _IncludeDesignationsElement; + return _IncludeDesignationsElement is not null; case "designation": - value = Designation; - return Designation is not null; + value = _Designation; + return _Designation is not null; case "includeDefinition": - value = IncludeDefinitionElement; - return IncludeDefinitionElement is not null; + value = _IncludeDefinitionElement; + return _IncludeDefinitionElement is not null; case "activeOnly": - value = ActiveOnlyElement; - return ActiveOnlyElement is not null; + value = _ActiveOnlyElement; + return _ActiveOnlyElement is not null; case "excludeNested": - value = ExcludeNestedElement; - return ExcludeNestedElement is not null; + value = _ExcludeNestedElement; + return _ExcludeNestedElement is not null; case "excludeNotForUI": - value = ExcludeNotForUIElement; - return ExcludeNotForUIElement is not null; + value = _ExcludeNotForUIElement; + return _ExcludeNotForUIElement is not null; case "excludePostCoordinated": - value = ExcludePostCoordinatedElement; - return ExcludePostCoordinatedElement is not null; + value = _ExcludePostCoordinatedElement; + return _ExcludePostCoordinatedElement is not null; case "displayLanguage": - value = DisplayLanguageElement; - return DisplayLanguageElement is not null; + value = _DisplayLanguageElement; + return _DisplayLanguageElement is not null; case "limitedExpansion": - value = LimitedExpansionElement; - return LimitedExpansionElement is not null; + value = _LimitedExpansionElement; + return _LimitedExpansionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "fixedVersion": - FixedVersion = (List)value; + FixedVersion = (List?)value!; return this; case "excludedSystem": - ExcludedSystem = (Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent)value; + ExcludedSystem = (Hl7.Fhir.Model.ExpansionProfile.ExcludedSystemComponent?)value; return this; case "includeDesignations": - IncludeDesignationsElement = (Hl7.Fhir.Model.FhirBoolean)value; + IncludeDesignationsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "designation": - Designation = (Hl7.Fhir.Model.ExpansionProfile.DesignationComponent)value; + Designation = (Hl7.Fhir.Model.ExpansionProfile.DesignationComponent?)value; return this; case "includeDefinition": - IncludeDefinitionElement = (Hl7.Fhir.Model.FhirBoolean)value; + IncludeDefinitionElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "activeOnly": - ActiveOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "excludeNested": - ExcludeNestedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeNestedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "excludeNotForUI": - ExcludeNotForUIElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeNotForUIElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "excludePostCoordinated": - ExcludePostCoordinatedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludePostCoordinatedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "displayLanguage": - DisplayLanguageElement = (Hl7.Fhir.Model.Code)value; + DisplayLanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "limitedExpansion": - LimitedExpansionElement = (Hl7.Fhir.Model.FhirBoolean)value; + LimitedExpansionElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1846,29 +1748,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (FixedVersion?.Any() == true) yield return new KeyValuePair("fixedVersion",FixedVersion); - if (ExcludedSystem is not null) yield return new KeyValuePair("excludedSystem",ExcludedSystem); - if (IncludeDesignationsElement is not null) yield return new KeyValuePair("includeDesignations",IncludeDesignationsElement); - if (Designation is not null) yield return new KeyValuePair("designation",Designation); - if (IncludeDefinitionElement is not null) yield return new KeyValuePair("includeDefinition",IncludeDefinitionElement); - if (ActiveOnlyElement is not null) yield return new KeyValuePair("activeOnly",ActiveOnlyElement); - if (ExcludeNestedElement is not null) yield return new KeyValuePair("excludeNested",ExcludeNestedElement); - if (ExcludeNotForUIElement is not null) yield return new KeyValuePair("excludeNotForUI",ExcludeNotForUIElement); - if (ExcludePostCoordinatedElement is not null) yield return new KeyValuePair("excludePostCoordinated",ExcludePostCoordinatedElement); - if (DisplayLanguageElement is not null) yield return new KeyValuePair("displayLanguage",DisplayLanguageElement); - if (LimitedExpansionElement is not null) yield return new KeyValuePair("limitedExpansion",LimitedExpansionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_FixedVersion?.Any() == true) yield return new KeyValuePair("fixedVersion",_FixedVersion); + if (_ExcludedSystem is not null) yield return new KeyValuePair("excludedSystem",_ExcludedSystem); + if (_IncludeDesignationsElement is not null) yield return new KeyValuePair("includeDesignations",_IncludeDesignationsElement); + if (_Designation is not null) yield return new KeyValuePair("designation",_Designation); + if (_IncludeDefinitionElement is not null) yield return new KeyValuePair("includeDefinition",_IncludeDefinitionElement); + if (_ActiveOnlyElement is not null) yield return new KeyValuePair("activeOnly",_ActiveOnlyElement); + if (_ExcludeNestedElement is not null) yield return new KeyValuePair("excludeNested",_ExcludeNestedElement); + if (_ExcludeNotForUIElement is not null) yield return new KeyValuePair("excludeNotForUI",_ExcludeNotForUIElement); + if (_ExcludePostCoordinatedElement is not null) yield return new KeyValuePair("excludePostCoordinated",_ExcludePostCoordinatedElement); + if (_DisplayLanguageElement is not null) yield return new KeyValuePair("displayLanguage",_DisplayLanguageElement); + if (_LimitedExpansionElement is not null) yield return new KeyValuePair("limitedExpansion",_LimitedExpansionElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs index cb62266c8..a6d4f898d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -273,13 +276,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -287,40 +290,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// Related file or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -332,48 +331,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -384,9 +383,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -413,13 +412,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// organization | patient | practitioner | relatedperson. @@ -427,13 +426,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("resourceType", Order=50)] [Binding("PayeeResourceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ResourceType + public Hl7.Fhir.Model.CodeableConcept? ResourceType { get { return _ResourceType; } set { _ResourceType = value; OnPropertyChanged("ResourceType"); } } - private Hl7.Fhir.Model.CodeableConcept _ResourceType; + private Hl7.Fhir.Model.CodeableConcept? _ResourceType; /// /// Party to receive the payable. @@ -442,27 +441,23 @@ public Hl7.Fhir.Model.CodeableConcept ResourceType [CLSCompliant(false)] [References("Practitioner","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ResourceType != null) dest.ResourceType = (Hl7.Fhir.Model.CodeableConcept)ResourceType.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ResourceType is not null) dest.ResourceType = (Hl7.Fhir.Model.CodeableConcept)_ResourceType.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -474,48 +469,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ResourceType, otherT.ResourceType)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ResourceType, otherT._ResourceType)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "resourceType": - value = ResourceType; - return ResourceType is not null; + value = _ResourceType; + return _ResourceType is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "resourceType": - ResourceType = (Hl7.Fhir.Model.CodeableConcept)value; + ResourceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -526,9 +521,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ResourceType is not null) yield return new KeyValuePair("resourceType",ResourceType); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ResourceType is not null) yield return new KeyValuePair("resourceType",_ResourceType); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -555,13 +550,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -570,13 +565,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -588,13 +580,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -602,13 +594,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -617,13 +609,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Additional Data or supporting information. @@ -633,13 +625,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Reason associated with the information. @@ -647,30 +639,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.Coding Reason + public Hl7.Fhir.Model.Coding? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.Coding _Reason; + private Hl7.Fhir.Model.Coding? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.Coding)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.Coding)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -682,69 +670,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.Coding)value; + Reason = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -755,12 +743,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -787,13 +775,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Number to covey order of careteam @@ -802,13 +790,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -821,26 +806,26 @@ public int? Sequence [References("Practitioner","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Billing practitioner. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Billing practitioner @@ -849,13 +834,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -866,13 +848,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Type, classification or Specialization. @@ -880,29 +862,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("qualification", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Qualification + public Hl7.Fhir.Model.CodeableConcept? Qualification { get { return _Qualification; } set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private Hl7.Fhir.Model.CodeableConcept _Qualification; + private Hl7.Fhir.Model.CodeableConcept? _Qualification; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Qualification != null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)Qualification.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Qualification is not null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)_Qualification.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -914,62 +892,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Qualification, otherT.Qualification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "qualification": - value = Qualification; - return Qualification is not null; + value = _Qualification; + return _Qualification is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualification": - Qualification = (Hl7.Fhir.Model.CodeableConcept)value; + Qualification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -980,11 +958,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Qualification is not null) yield return new KeyValuePair("qualification",Qualification); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Qualification is not null) yield return new KeyValuePair("qualification",_Qualification); } } @@ -1011,13 +989,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Number to covey order of diagnosis @@ -1026,13 +1004,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1047,13 +1022,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -1064,11 +1039,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Package billing code. @@ -1076,28 +1051,24 @@ public List Type [FhirElement("packageCode", Order=70)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PackageCode + public Hl7.Fhir.Model.CodeableConcept? PackageCode { get { return _PackageCode; } set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private Hl7.Fhir.Model.CodeableConcept _PackageCode; + private Hl7.Fhir.Model.CodeableConcept? _PackageCode; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(PackageCode != null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)PackageCode.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_PackageCode is not null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)_PackageCode.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1109,55 +1080,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(PackageCode, otherT.PackageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "packageCode": - value = PackageCode; - return PackageCode is not null; + value = _PackageCode; + return _PackageCode is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "packageCode": - PackageCode = (Hl7.Fhir.Model.CodeableConcept)value; + PackageCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1168,10 +1139,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (PackageCode is not null) yield return new KeyValuePair("packageCode",PackageCode); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_PackageCode is not null) yield return new KeyValuePair("packageCode",_PackageCode); } } @@ -1198,13 +1169,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure sequence for reference @@ -1213,13 +1184,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1229,28 +1197,25 @@ public int? Sequence /// [FhirElement("date", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1265,27 +1230,23 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1297,48 +1258,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1349,9 +1310,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); } } @@ -1379,13 +1340,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Coverage")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Pre-Authorization/Determination Reference. @@ -1395,24 +1356,24 @@ public Hl7.Fhir.Model.ResourceReference Coverage [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Pre-Authorization/Determination Reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1421,16 +1382,12 @@ public IEnumerable PreAuthRef protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1442,41 +1399,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1487,8 +1444,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); } } @@ -1514,28 +1471,25 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the accident occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1546,13 +1500,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Accident Place. @@ -1562,27 +1516,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1594,48 +1544,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1646,9 +1596,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1675,13 +1625,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance @@ -1690,13 +1640,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1709,24 +1656,24 @@ public int? Sequence [DataMember] public List CareTeamLinkIdElement { - get { if(_CareTeamLinkIdElement==null) _CareTeamLinkIdElement = new List(); return _CareTeamLinkIdElement; } + get => _CareTeamLinkIdElement ?? new List(); set { _CareTeamLinkIdElement = value; OnPropertyChanged("CareTeamLinkIdElement"); } } - private List _CareTeamLinkIdElement; + private List? _CareTeamLinkIdElement; /// /// Applicable careteam members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamLinkId + public IEnumerable? CareTeamLinkId { - get { return CareTeamLinkIdElement != null ? CareTeamLinkIdElement.Select(elem => elem.Value) : null; } + get => _CareTeamLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamLinkIdElement = null; + CareTeamLinkIdElement = null!; else CareTeamLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamLinkId"); @@ -1741,24 +1688,24 @@ public IEnumerable CareTeamLinkId [DataMember] public List DiagnosisLinkIdElement { - get { if(_DiagnosisLinkIdElement==null) _DiagnosisLinkIdElement = new List(); return _DiagnosisLinkIdElement; } + get => _DiagnosisLinkIdElement ?? new List(); set { _DiagnosisLinkIdElement = value; OnPropertyChanged("DiagnosisLinkIdElement"); } } - private List _DiagnosisLinkIdElement; + private List? _DiagnosisLinkIdElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisLinkId + public IEnumerable? DiagnosisLinkId { - get { return DiagnosisLinkIdElement != null ? DiagnosisLinkIdElement.Select(elem => elem.Value) : null; } + get => _DiagnosisLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisLinkIdElement = null; + DiagnosisLinkIdElement = null!; else DiagnosisLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisLinkId"); @@ -1773,24 +1720,24 @@ public IEnumerable DiagnosisLinkId [DataMember] public List ProcedureLinkIdElement { - get { if(_ProcedureLinkIdElement==null) _ProcedureLinkIdElement = new List(); return _ProcedureLinkIdElement; } + get => _ProcedureLinkIdElement ?? new List(); set { _ProcedureLinkIdElement = value; OnPropertyChanged("ProcedureLinkIdElement"); } } - private List _ProcedureLinkIdElement; + private List? _ProcedureLinkIdElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureLinkId + public IEnumerable? ProcedureLinkId { - get { return ProcedureLinkIdElement != null ? ProcedureLinkIdElement.Select(elem => elem.Value) : null; } + get => _ProcedureLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureLinkIdElement = null; + ProcedureLinkIdElement = null!; else ProcedureLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureLinkId"); @@ -1805,24 +1752,24 @@ public IEnumerable ProcedureLinkId [DataMember] public List InformationLinkIdElement { - get { if(_InformationLinkIdElement==null) _InformationLinkIdElement = new List(); return _InformationLinkIdElement; } + get => _InformationLinkIdElement ?? new List(); set { _InformationLinkIdElement = value; OnPropertyChanged("InformationLinkIdElement"); } } - private List _InformationLinkIdElement; + private List? _InformationLinkIdElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationLinkId + public IEnumerable? InformationLinkId { - get { return InformationLinkIdElement != null ? InformationLinkIdElement.Select(elem => elem.Value) : null; } + get => _InformationLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - InformationLinkIdElement = null; + InformationLinkIdElement = null!; else InformationLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationLinkId"); @@ -1835,13 +1782,13 @@ public IEnumerable InformationLinkId [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -1849,13 +1796,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=100)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -1863,13 +1810,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=110)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -1880,11 +1827,11 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program specific reason for item inclusion. @@ -1895,11 +1842,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of Service. @@ -1908,13 +1855,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service. @@ -1925,52 +1872,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of Products or Services. /// [FhirElement("quantity", Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per point. /// [FhirElement("unitPrice", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1979,13 +1926,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1995,13 +1939,13 @@ public decimal? Factor /// [FhirElement("net", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique Device Identifier. @@ -2013,11 +1957,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Service Location. @@ -2025,13 +1969,13 @@ public List Udi [FhirElement("bodySite", Order=210)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Service Sub-location. @@ -2042,11 +1986,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Encounters related to this billed item. @@ -2058,11 +2002,11 @@ public List SubSite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// List of note numbers which apply. @@ -2072,24 +2016,24 @@ public List Encounter [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2104,11 +2048,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -2118,45 +2062,41 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(CareTeamLinkIdElement.Any()) dest.CareTeamLinkIdElement = new List(CareTeamLinkIdElement.DeepCopyInternal()); - if(DiagnosisLinkIdElement.Any()) dest.DiagnosisLinkIdElement = new List(DiagnosisLinkIdElement.DeepCopyInternal()); - if(ProcedureLinkIdElement.Any()) dest.ProcedureLinkIdElement = new List(ProcedureLinkIdElement.DeepCopyInternal()); - if(InformationLinkIdElement.Any()) dest.InformationLinkIdElement = new List(InformationLinkIdElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_CareTeamLinkIdElement is not null) dest.CareTeamLinkIdElement = new List(_CareTeamLinkIdElement.DeepCopyInternal()); + if(_DiagnosisLinkIdElement is not null) dest.DiagnosisLinkIdElement = new List(_DiagnosisLinkIdElement.DeepCopyInternal()); + if(_ProcedureLinkIdElement is not null) dest.ProcedureLinkIdElement = new List(_ProcedureLinkIdElement.DeepCopyInternal()); + if(_InformationLinkIdElement is not null) dest.InformationLinkIdElement = new List(_InformationLinkIdElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2168,188 +2108,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(CareTeamLinkIdElement, otherT.CareTeamLinkIdElement)) return false; - if(!comparer.ListEquals(DiagnosisLinkIdElement, otherT.DiagnosisLinkIdElement)) return false; - if(!comparer.ListEquals(ProcedureLinkIdElement, otherT.ProcedureLinkIdElement)) return false; - if(!comparer.ListEquals(InformationLinkIdElement, otherT.InformationLinkIdElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_CareTeamLinkIdElement, otherT._CareTeamLinkIdElement)) return false; + if(!comparer.ListEquals(_DiagnosisLinkIdElement, otherT._DiagnosisLinkIdElement)) return false; + if(!comparer.ListEquals(_ProcedureLinkIdElement, otherT._ProcedureLinkIdElement)) return false; + if(!comparer.ListEquals(_InformationLinkIdElement, otherT._InformationLinkIdElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "careTeamLinkId": - value = CareTeamLinkIdElement; - return CareTeamLinkIdElement?.Any() == true; + value = _CareTeamLinkIdElement; + return _CareTeamLinkIdElement?.Any() == true; case "diagnosisLinkId": - value = DiagnosisLinkIdElement; - return DiagnosisLinkIdElement?.Any() == true; + value = _DiagnosisLinkIdElement; + return _DiagnosisLinkIdElement?.Any() == true; case "procedureLinkId": - value = ProcedureLinkIdElement; - return ProcedureLinkIdElement?.Any() == true; + value = _ProcedureLinkIdElement; + return _ProcedureLinkIdElement?.Any() == true; case "informationLinkId": - value = InformationLinkIdElement; - return InformationLinkIdElement?.Any() == true; + value = _InformationLinkIdElement; + return _InformationLinkIdElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "careTeamLinkId": - CareTeamLinkIdElement = (List)value; + CareTeamLinkIdElement = (List?)value!; return this; case "diagnosisLinkId": - DiagnosisLinkIdElement = (List)value; + DiagnosisLinkIdElement = (List?)value!; return this; case "procedureLinkId": - ProcedureLinkIdElement = (List)value; + ProcedureLinkIdElement = (List?)value!; return this; case "informationLinkId": - InformationLinkIdElement = (List)value; + InformationLinkIdElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2360,29 +2300,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (CareTeamLinkIdElement?.Any() == true) yield return new KeyValuePair("careTeamLinkId",CareTeamLinkIdElement); - if (DiagnosisLinkIdElement?.Any() == true) yield return new KeyValuePair("diagnosisLinkId",DiagnosisLinkIdElement); - if (ProcedureLinkIdElement?.Any() == true) yield return new KeyValuePair("procedureLinkId",ProcedureLinkIdElement); - if (InformationLinkIdElement?.Any() == true) yield return new KeyValuePair("informationLinkId",InformationLinkIdElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_CareTeamLinkIdElement?.Any() == true) yield return new KeyValuePair("careTeamLinkId",_CareTeamLinkIdElement); + if (_DiagnosisLinkIdElement?.Any() == true) yield return new KeyValuePair("diagnosisLinkId",_DiagnosisLinkIdElement); + if (_ProcedureLinkIdElement?.Any() == true) yield return new KeyValuePair("procedureLinkId",_ProcedureLinkIdElement); + if (_InformationLinkIdElement?.Any() == true) yield return new KeyValuePair("informationLinkId",_InformationLinkIdElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2410,13 +2350,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of Adjudication outcome. @@ -2424,39 +2364,39 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monitory value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Non-monitory value @@ -2465,31 +2405,24 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2501,55 +2434,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -2560,10 +2493,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -2590,13 +2523,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance @@ -2605,13 +2538,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2623,13 +2553,13 @@ public int? Sequence [Binding("ItemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Revenue or cost center code. @@ -2637,13 +2567,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("revenue", Order=60)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -2651,13 +2581,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=70)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -2665,13 +2595,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=80)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -2682,11 +2612,11 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program specific reason for item inclusion. @@ -2697,50 +2627,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of Products or Services. /// [FhirElement("quantity", Order=110)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per point. /// [FhirElement("unitPrice", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2749,13 +2679,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2765,13 +2692,13 @@ public decimal? Factor /// [FhirElement("net", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique Device Identifier. @@ -2783,11 +2710,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// List of note numbers which apply. @@ -2797,24 +2724,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2829,11 +2756,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -2843,37 +2770,33 @@ public List Adjudicat [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2885,132 +2808,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3021,21 +2944,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -3062,13 +2985,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Service instance @@ -3077,13 +3000,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -3095,13 +3015,13 @@ public int? Sequence [Binding("ItemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Revenue or cost center code. @@ -3109,13 +3029,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("revenue", Order=60)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -3123,13 +3043,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=70)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -3137,13 +3057,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=80)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -3154,11 +3074,11 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program specific reason for item inclusion. @@ -3169,50 +3089,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of Products or Services. /// [FhirElement("quantity", Order=110)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per point. /// [FhirElement("unitPrice", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3221,13 +3141,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3237,13 +3154,13 @@ public decimal? Factor /// [FhirElement("net", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique Device Identifier. @@ -3255,11 +3172,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// List of note numbers which apply. @@ -3269,24 +3186,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3301,36 +3218,32 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3342,125 +3255,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3471,20 +3384,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -3513,24 +3426,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SequenceLinkIdElement { - get { if(_SequenceLinkIdElement==null) _SequenceLinkIdElement = new List(); return _SequenceLinkIdElement; } + get => _SequenceLinkIdElement ?? new List(); set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } - private List _SequenceLinkIdElement; + private List? _SequenceLinkIdElement; /// /// Service instances /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SequenceLinkId + public IEnumerable? SequenceLinkId { - get { return SequenceLinkIdElement != null ? SequenceLinkIdElement.Select(elem => elem.Value) : null; } + get => _SequenceLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - SequenceLinkIdElement = null; + SequenceLinkIdElement = null!; else SequenceLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SequenceLinkId"); @@ -3543,13 +3456,13 @@ public IEnumerable SequenceLinkId [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -3557,13 +3470,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -3571,13 +3484,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -3588,24 +3501,24 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Professional fee or Product charge. /// [FhirElement("fee", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Fee + public Hl7.Fhir.Model.Money? Fee { get { return _Fee; } set { _Fee = value; OnPropertyChanged("Fee"); } } - private Hl7.Fhir.Model.Money _Fee; + private Hl7.Fhir.Model.Money? _Fee; /// /// List of note numbers which apply. @@ -3615,24 +3528,24 @@ public Hl7.Fhir.Model.Money Fee [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3647,11 +3560,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Added items details. @@ -3661,31 +3574,27 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceLinkIdElement.Any()) dest.SequenceLinkIdElement = new List(SequenceLinkIdElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Fee != null) dest.Fee = (Hl7.Fhir.Model.Money)Fee.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceLinkIdElement is not null) dest.SequenceLinkIdElement = new List(_SequenceLinkIdElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Fee is not null) dest.Fee = (Hl7.Fhir.Model.Money)_Fee.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3697,90 +3606,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(SequenceLinkIdElement, otherT.SequenceLinkIdElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Fee, otherT.Fee)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Fee, otherT._Fee)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceLinkId": - value = SequenceLinkIdElement; - return SequenceLinkIdElement?.Any() == true; + value = _SequenceLinkIdElement; + return _SequenceLinkIdElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "fee": - value = Fee; - return Fee is not null; + value = _Fee; + return _Fee is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceLinkId": - SequenceLinkIdElement = (List)value; + SequenceLinkIdElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "fee": - Fee = (Hl7.Fhir.Model.Money)value; + Fee = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3791,15 +3700,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceLinkIdElement?.Any() == true) yield return new KeyValuePair("sequenceLinkId",SequenceLinkIdElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Fee is not null) yield return new KeyValuePair("fee",Fee); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceLinkIdElement?.Any() == true) yield return new KeyValuePair("sequenceLinkId",_SequenceLinkIdElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Fee is not null) yield return new KeyValuePair("fee",_Fee); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -3826,13 +3735,13 @@ public partial class AddedItemsDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("revenue", Order=40)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Type of service or product. @@ -3840,13 +3749,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=50)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing Code. @@ -3854,13 +3763,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("service", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Service + public Hl7.Fhir.Model.CodeableConcept? Service { get { return _Service; } set { _Service = value; OnPropertyChanged("Service"); } } - private Hl7.Fhir.Model.CodeableConcept _Service; + private Hl7.Fhir.Model.CodeableConcept? _Service; /// /// Service/Product billing modifiers. @@ -3871,24 +3780,24 @@ public Hl7.Fhir.Model.CodeableConcept Service [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Professional fee or Product charge. /// [FhirElement("fee", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money Fee + public Hl7.Fhir.Model.Money? Fee { get { return _Fee; } set { _Fee = value; OnPropertyChanged("Fee"); } } - private Hl7.Fhir.Model.Money _Fee; + private Hl7.Fhir.Model.Money? _Fee; /// /// List of note numbers which apply. @@ -3898,24 +3807,24 @@ public Hl7.Fhir.Model.Money Fee [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// List of note numbers which apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3930,29 +3839,25 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemsDetailComponent; - - if (dest == null) - { + if(other is not AddedItemsDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Service != null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)Service.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Fee != null) dest.Fee = (Hl7.Fhir.Model.Money)Fee.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Service is not null) dest.Service = (Hl7.Fhir.Model.CodeableConcept)_Service.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Fee is not null) dest.Fee = (Hl7.Fhir.Model.Money)_Fee.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3964,76 +3869,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemsDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemsDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Fee, otherT.Fee)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Fee, otherT._Fee)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "service": - value = Service; - return Service is not null; + value = _Service; + return _Service is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "fee": - value = Fee; - return Fee is not null; + value = _Fee; + return _Fee is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "service": - Service = (Hl7.Fhir.Model.CodeableConcept)value; + Service = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "fee": - Fee = (Hl7.Fhir.Model.Money)value; + Fee = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4044,13 +3949,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Service is not null) yield return new KeyValuePair("service",Service); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Fee is not null) yield return new KeyValuePair("fee",Fee); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Service is not null) yield return new KeyValuePair("service",_Service); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Fee is not null) yield return new KeyValuePair("fee",_Fee); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -4077,26 +3982,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PaymentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-Claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the non-claim adjustment. @@ -4104,41 +4009,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected date of Payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected date of Payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -4148,43 +4050,39 @@ public string Date /// [FhirElement("amount", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Identifier of the payment instrument. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4196,69 +4094,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -4269,12 +4167,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -4300,13 +4198,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Sequence number for this note @@ -4315,13 +4213,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -4332,41 +4227,38 @@ public int? Number [FhirElement("type", Order=50)] [Binding("NoteType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Note explanitory text. /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanitory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -4377,28 +4269,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4410,55 +4298,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -4469,10 +4357,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -4497,13 +4385,13 @@ public partial class BenefitBalanceComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Detailed services covered within the type. @@ -4511,26 +4399,26 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("subCategory", Order=50)] [Binding("BenefitSubCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubCategory + public Hl7.Fhir.Model.CodeableConcept? SubCategory { get { return _SubCategory; } set { _SubCategory = value; OnPropertyChanged("SubCategory"); } } - private Hl7.Fhir.Model.CodeableConcept _SubCategory; + private Hl7.Fhir.Model.CodeableConcept? _SubCategory; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -4539,13 +4427,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -4555,28 +4440,25 @@ public bool? Excluded /// [FhirElement("name", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4586,28 +4468,25 @@ public string Name /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -4618,13 +4497,13 @@ public string Description [FhirElement("network", Order=90)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -4632,13 +4511,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=100)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -4646,13 +4525,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=110)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -4662,31 +4541,27 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Financial { - get { if(_Financial==null) _Financial = new List(); return _Financial; } + get => _Financial ?? new List(); set { _Financial = value; OnPropertyChanged("Financial"); } } - private List _Financial; + private List? _Financial; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitBalanceComponent; - - if (dest == null) - { + if(other is not BenefitBalanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(SubCategory != null) dest.SubCategory = (Hl7.Fhir.Model.CodeableConcept)SubCategory.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Financial.Any()) dest.Financial = new List(Financial.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_SubCategory is not null) dest.SubCategory = (Hl7.Fhir.Model.CodeableConcept)_SubCategory.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Financial is not null) dest.Financial = new List(_Financial.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4698,90 +4573,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitBalanceComponent; - if(otherT == null) return false; + if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(SubCategory, otherT.SubCategory)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Financial, otherT.Financial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_SubCategory, otherT._SubCategory)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "subCategory": - value = SubCategory; - return SubCategory is not null; + value = _SubCategory; + return _SubCategory is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "financial": - value = Financial; - return Financial?.Any() == true; + value = _Financial; + return _Financial?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subCategory": - SubCategory = (Hl7.Fhir.Model.CodeableConcept)value; + SubCategory = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "financial": - Financial = (List)value; + Financial = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4792,15 +4667,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (SubCategory is not null) yield return new KeyValuePair("subCategory",SubCategory); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Financial?.Any() == true) yield return new KeyValuePair("financial",Financial); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_SubCategory is not null) yield return new KeyValuePair("subCategory",_SubCategory); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Financial?.Any() == true) yield return new KeyValuePair("financial",_Financial); } } @@ -4828,13 +4703,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -4843,13 +4718,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -4858,27 +4733,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4890,48 +4761,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -4942,9 +4813,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -4957,11 +4828,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -4970,13 +4841,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("ExplanationOfBenefitStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -4985,13 +4856,10 @@ public Code Stat [IgnoreDataMember] public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -5002,13 +4870,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status [FhirElement("type", Order=110, FiveWs="class")] [Binding("ClaimType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Finer grained claim type information. @@ -5019,11 +4887,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List SubType { - get { if(_SubType==null) _SubType = new List(); return _SubType; } + get => _SubType ?? new List(); set { _SubType = value; OnPropertyChanged("SubType"); } } - private List _SubType; + private List? _SubType; /// /// The subject of the Products and Services. @@ -5032,54 +4900,51 @@ public List SubType [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Period for charge submission. /// [FhirElement("billablePeriod", Order=140, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Creation date. /// [FhirElement("created", Order=150, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -5091,13 +4956,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Insurer responsible for the EOB. @@ -5106,13 +4971,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Responsible provider for the claim. @@ -5121,13 +4986,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Responsible organization for the claim. @@ -5136,13 +5001,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Treatment Referral. @@ -5151,13 +5016,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("ReferralRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Servicing Facility. @@ -5166,13 +5031,13 @@ public Hl7.Fhir.Model.ResourceReference Referral [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Claim reference. @@ -5181,13 +5046,13 @@ public Hl7.Fhir.Model.ResourceReference Facility [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// Claim response reference. @@ -5196,13 +5061,13 @@ public Hl7.Fhir.Model.ResourceReference Claim [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; /// /// complete | error | partial. @@ -5210,41 +5075,38 @@ public Hl7.Fhir.Model.ResourceReference ClaimResponse [FhirElement("outcome", Order=240)] [Binding("RemittanceOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Disposition Message. /// [FhirElement("disposition", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -5257,11 +5119,11 @@ public string Disposition [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services or products. @@ -5270,13 +5132,13 @@ public List Related [CLSCompliant(false)] [References("MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superceded by fulfiller. @@ -5285,26 +5147,26 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Party to be paid any benefits payable. /// [FhirElement("payee", Order=290)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee + public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent _Payee; + private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? _Payee; /// /// Exceptions, special considerations, the condition, situation, prior or concurrent issues. @@ -5314,11 +5176,11 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee [DataMember] public List Information { - get { if(_Information==null) _Information = new List(); return _Information; } + get => _Information ?? new List(); set { _Information = value; OnPropertyChanged("Information"); } } - private List _Information; + private List? _Information; /// /// Care Team members. @@ -5328,11 +5190,11 @@ public List [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// List of Diagnosis. @@ -5342,11 +5204,11 @@ public List CareTeam [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Procedures performed. @@ -5356,24 +5218,24 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Precedence (primary, secondary, etc.). /// [FhirElement("precedence", Order=340)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PrecedenceElement + public Hl7.Fhir.Model.PositiveInt? PrecedenceElement { get { return _PrecedenceElement; } set { _PrecedenceElement = value; OnPropertyChanged("PrecedenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _PrecedenceElement; + private Hl7.Fhir.Model.PositiveInt? _PrecedenceElement; /// /// Precedence (primary, secondary, etc.) @@ -5382,13 +5244,10 @@ public Hl7.Fhir.Model.PositiveInt PrecedenceElement [IgnoreDataMember] public int? Precedence { - get { return PrecedenceElement != null ? PrecedenceElement.Value : null; } + get => _PrecedenceElement?.Value; set { - if (value == null) - PrecedenceElement = null; - else - PrecedenceElement = new Hl7.Fhir.Model.PositiveInt(value); + PrecedenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Precedence"); } } @@ -5398,52 +5257,52 @@ public int? Precedence /// [FhirElement("insurance", Order=350)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent Insurance + public Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent? Insurance { get { return _Insurance; } set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent _Insurance; + private Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent? _Insurance; /// /// Details of an accident. /// [FhirElement("accident", Order=360)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent Accident + public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent _Accident; + private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? _Accident; /// /// Period unable to work. /// [FhirElement("employmentImpacted", Order=370)] [DataMember] - public Hl7.Fhir.Model.Period EmploymentImpacted + public Hl7.Fhir.Model.Period? EmploymentImpacted { get { return _EmploymentImpacted; } set { _EmploymentImpacted = value; OnPropertyChanged("EmploymentImpacted"); } } - private Hl7.Fhir.Model.Period _EmploymentImpacted; + private Hl7.Fhir.Model.Period? _EmploymentImpacted; /// /// Period in hospital. /// [FhirElement("hospitalization", Order=380)] [DataMember] - public Hl7.Fhir.Model.Period Hospitalization + public Hl7.Fhir.Model.Period? Hospitalization { get { return _Hospitalization; } set { _Hospitalization = value; OnPropertyChanged("Hospitalization"); } } - private Hl7.Fhir.Model.Period _Hospitalization; + private Hl7.Fhir.Model.Period? _Hospitalization; /// /// Goods and Services. @@ -5453,11 +5312,11 @@ public Hl7.Fhir.Model.Period Hospitalization [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -5467,63 +5326,63 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Total Cost of service from the Claim. /// [FhirElement("totalCost", Order=410)] [DataMember] - public Hl7.Fhir.Model.Money TotalCost + public Hl7.Fhir.Model.Money? TotalCost { get { return _TotalCost; } set { _TotalCost = value; OnPropertyChanged("TotalCost"); } } - private Hl7.Fhir.Model.Money _TotalCost; + private Hl7.Fhir.Model.Money? _TotalCost; /// /// Unallocated deductable. /// [FhirElement("unallocDeductable", Order=420)] [DataMember] - public Hl7.Fhir.Model.Money UnallocDeductable + public Hl7.Fhir.Model.Money? UnallocDeductable { get { return _UnallocDeductable; } set { _UnallocDeductable = value; OnPropertyChanged("UnallocDeductable"); } } - private Hl7.Fhir.Model.Money _UnallocDeductable; + private Hl7.Fhir.Model.Money? _UnallocDeductable; /// /// Total benefit payable for the Claim. /// [FhirElement("totalBenefit", Order=430)] [DataMember] - public Hl7.Fhir.Model.Money TotalBenefit + public Hl7.Fhir.Model.Money? TotalBenefit { get { return _TotalBenefit; } set { _TotalBenefit = value; OnPropertyChanged("TotalBenefit"); } } - private Hl7.Fhir.Model.Money _TotalBenefit; + private Hl7.Fhir.Model.Money? _TotalBenefit; /// /// Payment (if paid). /// [FhirElement("payment", Order=440)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment + public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent _Payment; + private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? _Payment; /// /// Printed Form Identifier. @@ -5531,13 +5390,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment [FhirElement("form", Order=450)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Processing notes. @@ -5547,11 +5406,11 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// Balance by Benefit Category. @@ -5561,63 +5420,59 @@ public List ProcessNote [DataMember] public List BenefitBalance { - get { if(_BenefitBalance==null) _BenefitBalance = new List(); return _BenefitBalance; } + get => _BenefitBalance ?? new List(); set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } - private List _BenefitBalance; + private List? _BenefitBalance; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ExplanationOfBenefit; - - if (dest == null) - { + if(other is not ExplanationOfBenefit dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType.Any()) dest.SubType = new List(SubType.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)Payee.DeepCopyInternal(); - if(Information.Any()) dest.Information = new List(Information.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(PrecedenceElement != null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)PrecedenceElement.DeepCopyInternal(); - if(Insurance != null) dest.Insurance = (Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent)Insurance.DeepCopyInternal(); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)Accident.DeepCopyInternal(); - if(EmploymentImpacted != null) dest.EmploymentImpacted = (Hl7.Fhir.Model.Period)EmploymentImpacted.DeepCopyInternal(); - if(Hospitalization != null) dest.Hospitalization = (Hl7.Fhir.Model.Period)Hospitalization.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(TotalCost != null) dest.TotalCost = (Hl7.Fhir.Model.Money)TotalCost.DeepCopyInternal(); - if(UnallocDeductable != null) dest.UnallocDeductable = (Hl7.Fhir.Model.Money)UnallocDeductable.DeepCopyInternal(); - if(TotalBenefit != null) dest.TotalBenefit = (Hl7.Fhir.Model.Money)TotalBenefit.DeepCopyInternal(); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)Payment.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(BenefitBalance.Any()) dest.BenefitBalance = new List(BenefitBalance.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = new List(_SubType.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Information is not null) dest.Information = new List(_Information.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_PrecedenceElement is not null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)_PrecedenceElement.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = (Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent)_Insurance.DeepCopyInternal(); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)_Accident.DeepCopyInternal(); + if(_EmploymentImpacted is not null) dest.EmploymentImpacted = (Hl7.Fhir.Model.Period)_EmploymentImpacted.DeepCopyInternal(); + if(_Hospitalization is not null) dest.Hospitalization = (Hl7.Fhir.Model.Period)_Hospitalization.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_TotalCost is not null) dest.TotalCost = (Hl7.Fhir.Model.Money)_TotalCost.DeepCopyInternal(); + if(_UnallocDeductable is not null) dest.UnallocDeductable = (Hl7.Fhir.Model.Money)_UnallocDeductable.DeepCopyInternal(); + if(_TotalBenefit is not null) dest.TotalBenefit = (Hl7.Fhir.Model.Money)_TotalBenefit.DeepCopyInternal(); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)_Payment.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_BenefitBalance is not null) dest.BenefitBalance = new List(_BenefitBalance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5629,300 +5484,300 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExplanationOfBenefit; - if(otherT == null) return false; + if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.ListEquals(Information, otherT.Information)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(PrecedenceElement, otherT.PrecedenceElement)) return false; - if(!comparer.Equals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.Equals(EmploymentImpacted, otherT.EmploymentImpacted)) return false; - if(!comparer.Equals(Hospitalization, otherT.Hospitalization)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.Equals(TotalCost, otherT.TotalCost)) return false; - if(!comparer.Equals(UnallocDeductable, otherT.UnallocDeductable)) return false; - if(!comparer.Equals(TotalBenefit, otherT.TotalBenefit)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.ListEquals(BenefitBalance, otherT.BenefitBalance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.ListEquals(_Information, otherT._Information)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_PrecedenceElement, otherT._PrecedenceElement)) return false; + if(!comparer.Equals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.Equals(_EmploymentImpacted, otherT._EmploymentImpacted)) return false; + if(!comparer.Equals(_Hospitalization, otherT._Hospitalization)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.Equals(_TotalCost, otherT._TotalCost)) return false; + if(!comparer.Equals(_UnallocDeductable, otherT._UnallocDeductable)) return false; + if(!comparer.Equals(_TotalBenefit, otherT._TotalBenefit)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType?.Any() == true; + value = _SubType; + return _SubType?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "information": - value = Information; - return Information?.Any() == true; + value = _Information; + return _Information?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "precedence": - value = PrecedenceElement; - return PrecedenceElement is not null; + value = _PrecedenceElement; + return _PrecedenceElement is not null; case "insurance": - value = Insurance; - return Insurance is not null; + value = _Insurance; + return _Insurance is not null; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "employmentImpacted": - value = EmploymentImpacted; - return EmploymentImpacted is not null; + value = _EmploymentImpacted; + return _EmploymentImpacted is not null; case "hospitalization": - value = Hospitalization; - return Hospitalization is not null; + value = _Hospitalization; + return _Hospitalization is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "totalCost": - value = TotalCost; - return TotalCost is not null; + value = _TotalCost; + return _TotalCost is not null; case "unallocDeductable": - value = UnallocDeductable; - return UnallocDeductable is not null; + value = _UnallocDeductable; + return _UnallocDeductable is not null; case "totalBenefit": - value = TotalBenefit; - return TotalBenefit is not null; + value = _TotalBenefit; + return _TotalBenefit is not null; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "benefitBalance": - value = BenefitBalance; - return BenefitBalance?.Any() == true; + value = _BenefitBalance; + return _BenefitBalance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (List)value; + SubType = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent?)value; return this; case "information": - Information = (List)value; + Information = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "precedence": - PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)value; + PrecedenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "insurance": - Insurance = (Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent)value; + Insurance = (Hl7.Fhir.Model.ExplanationOfBenefit.InsuranceComponent?)value; return this; case "accident": - Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent?)value; return this; case "employmentImpacted": - EmploymentImpacted = (Hl7.Fhir.Model.Period)value; + EmploymentImpacted = (Hl7.Fhir.Model.Period?)value; return this; case "hospitalization": - Hospitalization = (Hl7.Fhir.Model.Period)value; + Hospitalization = (Hl7.Fhir.Model.Period?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "totalCost": - TotalCost = (Hl7.Fhir.Model.Money)value; + TotalCost = (Hl7.Fhir.Model.Money?)value; return this; case "unallocDeductable": - UnallocDeductable = (Hl7.Fhir.Model.Money)value; + UnallocDeductable = (Hl7.Fhir.Model.Money?)value; return this; case "totalBenefit": - TotalBenefit = (Hl7.Fhir.Model.Money)value; + TotalBenefit = (Hl7.Fhir.Model.Money?)value; return this; case "payment": - Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "benefitBalance": - BenefitBalance = (List)value; + BenefitBalance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5933,45 +5788,45 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType?.Any() == true) yield return new KeyValuePair("subType",SubType); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Information?.Any() == true) yield return new KeyValuePair("information",Information); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (PrecedenceElement is not null) yield return new KeyValuePair("precedence",PrecedenceElement); - if (Insurance is not null) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (EmploymentImpacted is not null) yield return new KeyValuePair("employmentImpacted",EmploymentImpacted); - if (Hospitalization is not null) yield return new KeyValuePair("hospitalization",Hospitalization); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (TotalCost is not null) yield return new KeyValuePair("totalCost",TotalCost); - if (UnallocDeductable is not null) yield return new KeyValuePair("unallocDeductable",UnallocDeductable); - if (TotalBenefit is not null) yield return new KeyValuePair("totalBenefit",TotalBenefit); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",BenefitBalance); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType?.Any() == true) yield return new KeyValuePair("subType",_SubType); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Information?.Any() == true) yield return new KeyValuePair("information",_Information); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_PrecedenceElement is not null) yield return new KeyValuePair("precedence",_PrecedenceElement); + if (_Insurance is not null) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_EmploymentImpacted is not null) yield return new KeyValuePair("employmentImpacted",_EmploymentImpacted); + if (_Hospitalization is not null) yield return new KeyValuePair("hospitalization",_Hospitalization); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_TotalCost is not null) yield return new KeyValuePair("totalCost",_TotalCost); + if (_UnallocDeductable is not null) yield return new KeyValuePair("unallocDeductable",_UnallocDeductable); + if (_TotalBenefit is not null) yield return new KeyValuePair("totalBenefit",_TotalBenefit); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",_BenefitBalance); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs index 053bf6ee8..1a2cdf7af 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -117,13 +120,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConditionCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// deceased | permanent disability | etc. @@ -131,13 +134,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("outcome", Order=50)] [Binding("ConditionOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// When condition first manifested. @@ -146,13 +149,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Extra information about condition. @@ -162,26 +165,22 @@ public Hl7.Fhir.Model.DataType Onset [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -193,55 +192,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -252,10 +251,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -268,11 +267,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -284,11 +283,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// partial | completed | entered-in-error | health-unknown. @@ -298,13 +297,13 @@ public List Definition [Binding("FamilyHistoryStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// partial | completed | entered-in-error | health-unknown @@ -313,13 +312,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -329,13 +325,13 @@ public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status /// [FhirElement("notDone", InSummary=true, IsModifier=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NotDoneElement + public Hl7.Fhir.Model.FhirBoolean? NotDoneElement { get { return _NotDoneElement; } set { _NotDoneElement = value; OnPropertyChanged("NotDoneElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NotDoneElement; + private Hl7.Fhir.Model.FhirBoolean? _NotDoneElement; /// /// The taking of a family member's history did not occur @@ -344,13 +340,10 @@ public Hl7.Fhir.Model.FhirBoolean NotDoneElement [IgnoreDataMember] public bool? NotDone { - get { return NotDoneElement != null ? NotDoneElement.Value : null; } + get => _NotDoneElement?.Value; set { - if (value == null) - NotDoneElement = null; - else - NotDoneElement = new Hl7.Fhir.Model.FhirBoolean(value); + NotDoneElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NotDone"); } } @@ -361,13 +354,13 @@ public bool? NotDone [FhirElement("notDoneReason", InSummary=true, Order=130)] [Binding("FamilyHistoryNotDoneReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept NotDoneReason + public Hl7.Fhir.Model.CodeableConcept? NotDoneReason { get { return _NotDoneReason; } set { _NotDoneReason = value; OnPropertyChanged("NotDoneReason"); } } - private Hl7.Fhir.Model.CodeableConcept _NotDoneReason; + private Hl7.Fhir.Model.CodeableConcept? _NotDoneReason; /// /// Patient history is about. @@ -377,41 +370,38 @@ public Hl7.Fhir.Model.CodeableConcept NotDoneReason [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When history was captured/updated. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When history was captured/updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -421,28 +411,25 @@ public string Date /// [FhirElement("name", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The family member described /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -454,13 +441,13 @@ public string Name [Binding("FamilialRelationship")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// male | female | other | unknown. @@ -469,13 +456,13 @@ public Hl7.Fhir.Model.CodeableConcept Relationship [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -484,13 +471,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -502,13 +486,13 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Born + public Hl7.Fhir.Model.DataType? Born { get { return _Born; } set { _Born = value; OnPropertyChanged("Born"); } } - private Hl7.Fhir.Model.DataType _Born; + private Hl7.Fhir.Model.DataType? _Born; /// /// (approximate) age. @@ -517,26 +501,26 @@ public Hl7.Fhir.Model.DataType Born [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Age + public Hl7.Fhir.Model.DataType? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.DataType _Age; + private Hl7.Fhir.Model.DataType? _Age; /// /// Age is estimated?. /// [FhirElement("estimatedAge", InSummary=true, IsModifier=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement + public Hl7.Fhir.Model.FhirBoolean? EstimatedAgeElement { get { return _EstimatedAgeElement; } set { _EstimatedAgeElement = value; OnPropertyChanged("EstimatedAgeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EstimatedAgeElement; + private Hl7.Fhir.Model.FhirBoolean? _EstimatedAgeElement; /// /// Age is estimated? @@ -545,13 +529,10 @@ public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement [IgnoreDataMember] public bool? EstimatedAge { - get { return EstimatedAgeElement != null ? EstimatedAgeElement.Value : null; } + get => _EstimatedAgeElement?.Value; set { - if (value == null) - EstimatedAgeElement = null; - else - EstimatedAgeElement = new Hl7.Fhir.Model.FhirBoolean(value); + EstimatedAgeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EstimatedAge"); } } @@ -563,13 +544,13 @@ public bool? EstimatedAge [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// Why was family member history performed?. @@ -580,11 +561,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was family member history performed?. @@ -596,11 +577,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// General note about related person. @@ -610,11 +591,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Condition that the related person had. @@ -624,42 +605,38 @@ public List Note [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as FamilyMemberHistory; - - if (dest == null) - { + if(other is not FamilyMemberHistory dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(NotDoneElement != null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)NotDoneElement.DeepCopyInternal(); - if(NotDoneReason != null) dest.NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)NotDoneReason.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Born != null) dest.Born = (Hl7.Fhir.Model.DataType)Born.DeepCopyInternal(); - if(Age != null) dest.Age = (Hl7.Fhir.Model.DataType)Age.DeepCopyInternal(); - if(EstimatedAgeElement != null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)EstimatedAgeElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_NotDoneElement is not null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)_NotDoneElement.DeepCopyInternal(); + if(_NotDoneReason is not null) dest.NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)_NotDoneReason.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Born is not null) dest.Born = (Hl7.Fhir.Model.DataType)_Born.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.DataType)_Age.DeepCopyInternal(); + if(_EstimatedAgeElement is not null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)_EstimatedAgeElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -671,153 +648,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FamilyMemberHistory; - if(otherT == null) return false; + if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(NotDoneElement, otherT.NotDoneElement)) return false; - if(!comparer.Equals(NotDoneReason, otherT.NotDoneReason)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Born, otherT.Born)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(EstimatedAgeElement, otherT.EstimatedAgeElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_NotDoneElement, otherT._NotDoneElement)) return false; + if(!comparer.Equals(_NotDoneReason, otherT._NotDoneReason)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Born, otherT._Born)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_EstimatedAgeElement, otherT._EstimatedAgeElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "notDone": - value = NotDoneElement; - return NotDoneElement is not null; + value = _NotDoneElement; + return _NotDoneElement is not null; case "notDoneReason": - value = NotDoneReason; - return NotDoneReason is not null; + value = _NotDoneReason; + return _NotDoneReason is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "born": - value = Born; - return Born is not null; + value = _Born; + return _Born is not null; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "estimatedAge": - value = EstimatedAgeElement; - return EstimatedAgeElement is not null; + value = _EstimatedAgeElement; + return _EstimatedAgeElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "notDone": - NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)value; + NotDoneElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "notDoneReason": - NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)value; + NotDoneReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "born": - Born = (Hl7.Fhir.Model.DataType)value; + Born = (Hl7.Fhir.Model.DataType?)value; return this; case "age": - Age = (Hl7.Fhir.Model.DataType)value; + Age = (Hl7.Fhir.Model.DataType?)value; return this; case "estimatedAge": - EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)value; + EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; default: return base.SetValue(key, value); @@ -828,24 +805,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (NotDoneElement is not null) yield return new KeyValuePair("notDone",NotDoneElement); - if (NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",NotDoneReason); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Born is not null) yield return new KeyValuePair("born",Born); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",EstimatedAgeElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_NotDoneElement is not null) yield return new KeyValuePair("notDone",_NotDoneElement); + if (_NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",_NotDoneReason); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Born is not null) yield return new KeyValuePair("born",_Born); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",_EstimatedAgeElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs b/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs index 1bf0b6b5c..5202016cc 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -95,11 +98,11 @@ public enum FlagStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -109,13 +112,13 @@ public List Identifier [Binding("FlagStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -124,13 +127,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Flag.FlagStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -141,13 +141,13 @@ public Hl7.Fhir.Model.Flag.FlagStatus? Status [FhirElement("category", InSummary=true, Order=110, FiveWs="class")] [Binding("FlagCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Coded or textual message to display to user. @@ -156,13 +156,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("FlagCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/What is flag about?. @@ -172,26 +172,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Location","Group","Organization","Practitioner","PlanDefinition","Medication","Procedure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Time period when flag is active. /// [FhirElement("period", InSummary=true, Order=140, FiveWs="context")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Alert relevant during encounter. @@ -200,13 +200,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Flag creator. @@ -215,34 +215,30 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Flag; - - if (dest == null) - { + if(other is not Flag dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -254,83 +250,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Flag; - if(otherT == null) return false; + if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -341,14 +337,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs b/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs index 102631e4b..e41f2b0b8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -170,13 +173,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", InSummary=true, Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -186,13 +189,13 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal on or before. @@ -201,27 +204,23 @@ public Hl7.Fhir.Model.DataType Detail [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Due + public Hl7.Fhir.Model.DataType? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.DataType _Due; + private Hl7.Fhir.Model.DataType? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.DataType)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.DataType)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -233,48 +232,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.DataType)value; + Due = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -285,9 +284,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -300,11 +299,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected. @@ -314,13 +313,13 @@ public List Identifier [Binding("GoalStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected @@ -329,13 +328,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Goal.GoalStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -349,11 +345,11 @@ public Hl7.Fhir.Model.Goal.GoalStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// high-priority | medium-priority | low-priority. @@ -361,13 +357,13 @@ public List Category [FhirElement("priority", InSummary=true, Order=120, FiveWs="grade")] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// Code or text describing goal. @@ -376,13 +372,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// Who this goal is intended for. @@ -391,13 +387,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [CLSCompliant(false)] [References("Patient","Group","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When goal pursuit begins. @@ -407,54 +403,51 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Start + public Hl7.Fhir.Model.DataType? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.DataType _Start; + private Hl7.Fhir.Model.DataType? _Start; /// /// Target outcome for the goal. /// [FhirElement("target", Order=160)] [DataMember] - public Hl7.Fhir.Model.Goal.TargetComponent Target + public Hl7.Fhir.Model.Goal.TargetComponent? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.Goal.TargetComponent _Target; + private Hl7.Fhir.Model.Goal.TargetComponent? _Target; /// /// When goal status took effect. /// [FhirElement("statusDate", InSummary=true, Order=170, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.Date StatusDateElement + public Hl7.Fhir.Model.Date? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.Date _StatusDateElement; + private Hl7.Fhir.Model.Date? _StatusDateElement; /// /// When goal status took effect /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.Date(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("StatusDate"); } } @@ -464,28 +457,25 @@ public string StatusDate /// [FhirElement("statusReason", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString StatusReasonElement + public Hl7.Fhir.Model.FhirString? StatusReasonElement { get { return _StatusReasonElement; } set { _StatusReasonElement = value; OnPropertyChanged("StatusReasonElement"); } } - private Hl7.Fhir.Model.FhirString _StatusReasonElement; + private Hl7.Fhir.Model.FhirString? _StatusReasonElement; /// /// Reason for current status /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusReason + public string? StatusReason { - get { return StatusReasonElement != null ? StatusReasonElement.Value : null; } + get => _StatusReasonElement?.Value; set { - if (value == null) - StatusReasonElement = null; - else - StatusReasonElement = new Hl7.Fhir.Model.FhirString(value); + StatusReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StatusReason"); } } @@ -497,13 +487,13 @@ public string StatusReason [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExpressedBy + public Hl7.Fhir.Model.ResourceReference? ExpressedBy { get { return _ExpressedBy; } set { _ExpressedBy = value; OnPropertyChanged("ExpressedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ExpressedBy; + private Hl7.Fhir.Model.ResourceReference? _ExpressedBy; /// /// Issues addressed by this goal. @@ -515,11 +505,11 @@ public Hl7.Fhir.Model.ResourceReference ExpressedBy [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Comments about the goal. @@ -529,11 +519,11 @@ public List Addresses [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// What result was achieved regarding the goal?. @@ -544,11 +534,11 @@ public List Note [DataMember] public List OutcomeCode { - get { if(_OutcomeCode==null) _OutcomeCode = new List(); return _OutcomeCode; } + get => _OutcomeCode ?? new List(); set { _OutcomeCode = value; OnPropertyChanged("OutcomeCode"); } } - private List _OutcomeCode; + private List? _OutcomeCode; /// /// Observation that resulted from goal. @@ -560,39 +550,35 @@ public List OutcomeCode [DataMember] public List OutcomeReference { - get { if(_OutcomeReference==null) _OutcomeReference = new List(); return _OutcomeReference; } + get => _OutcomeReference ?? new List(); set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } - private List _OutcomeReference; + private List? _OutcomeReference; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Goal; - - if (dest == null) - { + if(other is not Goal dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.DataType)Start.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.Goal.TargetComponent)Target.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)StatusDateElement.DeepCopyInternal(); - if(StatusReasonElement != null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)StatusReasonElement.DeepCopyInternal(); - if(ExpressedBy != null) dest.ExpressedBy = (Hl7.Fhir.Model.ResourceReference)ExpressedBy.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(OutcomeCode.Any()) dest.OutcomeCode = new List(OutcomeCode.DeepCopyInternal()); - if(OutcomeReference.Any()) dest.OutcomeReference = new List(OutcomeReference.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.DataType)_Start.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.Goal.TargetComponent)_Target.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)_StatusDateElement.DeepCopyInternal(); + if(_StatusReasonElement is not null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)_StatusReasonElement.DeepCopyInternal(); + if(_ExpressedBy is not null) dest.ExpressedBy = (Hl7.Fhir.Model.ResourceReference)_ExpressedBy.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_OutcomeCode is not null) dest.OutcomeCode = new List(_OutcomeCode.DeepCopyInternal()); + if(_OutcomeReference is not null) dest.OutcomeReference = new List(_OutcomeReference.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -604,132 +590,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Goal; - if(otherT == null) return false; + if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(StatusReasonElement, otherT.StatusReasonElement)) return false; - if(!comparer.Equals(ExpressedBy, otherT.ExpressedBy)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(OutcomeCode, otherT.OutcomeCode)) return false; - if(!comparer.ListEquals(OutcomeReference, otherT.OutcomeReference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_StatusReasonElement, otherT._StatusReasonElement)) return false; + if(!comparer.Equals(_ExpressedBy, otherT._ExpressedBy)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_OutcomeCode, otherT._OutcomeCode)) return false; + if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "statusReason": - value = StatusReasonElement; - return StatusReasonElement is not null; + value = _StatusReasonElement; + return _StatusReasonElement is not null; case "expressedBy": - value = ExpressedBy; - return ExpressedBy is not null; + value = _ExpressedBy; + return _ExpressedBy is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "outcomeCode": - value = OutcomeCode; - return OutcomeCode?.Any() == true; + value = _OutcomeCode; + return _OutcomeCode?.Any() == true; case "outcomeReference": - value = OutcomeReference; - return OutcomeReference?.Any() == true; + value = _OutcomeReference; + return _OutcomeReference?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - Start = (Hl7.Fhir.Model.DataType)value; + Start = (Hl7.Fhir.Model.DataType?)value; return this; case "target": - Target = (Hl7.Fhir.Model.Goal.TargetComponent)value; + Target = (Hl7.Fhir.Model.Goal.TargetComponent?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.Date)value; + StatusDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "statusReason": - StatusReasonElement = (Hl7.Fhir.Model.FhirString)value; + StatusReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expressedBy": - ExpressedBy = (Hl7.Fhir.Model.ResourceReference)value; + ExpressedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "outcomeCode": - OutcomeCode = (List)value; + OutcomeCode = (List?)value!; return this; case "outcomeReference": - OutcomeReference = (List)value; + OutcomeReference = (List?)value!; return this; default: return base.SetValue(key, value); @@ -740,21 +726,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (StatusReasonElement is not null) yield return new KeyValuePair("statusReason",StatusReasonElement); - if (ExpressedBy is not null) yield return new KeyValuePair("expressedBy",ExpressedBy); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (OutcomeCode?.Any() == true) yield return new KeyValuePair("outcomeCode",OutcomeCode); - if (OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",OutcomeReference); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_StatusReasonElement is not null) yield return new KeyValuePair("statusReason",_StatusReasonElement); + if (_ExpressedBy is not null) yield return new KeyValuePair("expressedBy",_ExpressedBy); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_OutcomeCode?.Any() == true) yield return new KeyValuePair("outcomeCode",_OutcomeCode); + if (_OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",_OutcomeReference); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs index 1c99fc645..b326a544e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,28 +115,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("path", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path in the resource that contains the link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -143,28 +143,25 @@ public string Path /// [FhirElement("sliceName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SliceNameElement + public Hl7.Fhir.Model.FhirString? SliceNameElement { get { return _SliceNameElement; } set { _SliceNameElement = value; OnPropertyChanged("SliceNameElement"); } } - private Hl7.Fhir.Model.FhirString _SliceNameElement; + private Hl7.Fhir.Model.FhirString? _SliceNameElement; /// /// Which slice (if profiled) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SliceName + public string? SliceName { - get { return SliceNameElement != null ? SliceNameElement.Value : null; } + get => _SliceNameElement?.Value; set { - if (value == null) - SliceNameElement = null; - else - SliceNameElement = new Hl7.Fhir.Model.FhirString(value); + SliceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SliceName"); } } @@ -174,13 +171,13 @@ public string SliceName /// [FhirElement("min", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum occurrences for this link @@ -189,13 +186,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -205,28 +199,25 @@ public int? Min /// [FhirElement("max", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum occurrences for this link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -236,28 +227,25 @@ public string Max /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why this link is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -270,28 +258,24 @@ public string Description [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SliceNameElement != null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)SliceNameElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SliceNameElement is not null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)_SliceNameElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -303,69 +287,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SliceNameElement, otherT.SliceNameElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sliceName": - value = SliceNameElement; - return SliceNameElement is not null; + value = _SliceNameElement; + return _SliceNameElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sliceName": - SliceNameElement = (Hl7.Fhir.Model.FhirString)value; + SliceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -376,12 +360,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SliceNameElement is not null) yield return new KeyValuePair("sliceName",SliceNameElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SliceNameElement is not null) yield return new KeyValuePair("sliceName",_SliceNameElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -407,13 +391,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type of resource this link refers to @@ -422,13 +406,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -438,28 +419,25 @@ public Hl7.Fhir.Model.ResourceType? Type /// [FhirElement("profile", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri ProfileElement + public Hl7.Fhir.Model.FhirUri? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.FhirUri _ProfileElement; + private Hl7.Fhir.Model.FhirUri? _ProfileElement; /// /// Profile for the target resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.FhirUri(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Profile"); } } @@ -472,11 +450,11 @@ public string Profile [DataMember] public List Compartment { - get { if(_Compartment==null) _Compartment = new List(); return _Compartment; } + get => _Compartment ?? new List(); set { _Compartment = value; OnPropertyChanged("Compartment"); } } - private List _Compartment; + private List? _Compartment; /// /// Additional links from target resource. @@ -486,26 +464,22 @@ public List Compartment [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.FhirUri)ProfileElement.DeepCopyInternal(); - if(Compartment.Any()) dest.Compartment = new List(Compartment.DeepCopyInternal()); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.FhirUri)_ProfileElement.DeepCopyInternal(); + if(_Compartment is not null) dest.Compartment = new List(_Compartment.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -517,55 +491,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Compartment, otherT.Compartment)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "compartment": - value = Compartment; - return Compartment?.Any() == true; + value = _Compartment; + return _Compartment?.Any() == true; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.FhirUri)value; + ProfileElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "compartment": - Compartment = (List)value; + Compartment = (List?)value!; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -576,10 +550,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Compartment?.Any() == true) yield return new KeyValuePair("compartment",Compartment); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Compartment?.Any() == true) yield return new KeyValuePair("compartment",_Compartment); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } @@ -605,13 +579,13 @@ public partial class CompartmentComponent : Hl7.Fhir.Model.BackboneElement [Binding("CompartmentCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Identifies the compartment @@ -620,13 +594,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -639,13 +610,13 @@ public Hl7.Fhir.Model.CompartmentType? Code [Binding("GraphCompartmentRule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RuleElement + public Code? RuleElement { get { return _RuleElement; } set { _RuleElement = value; OnPropertyChanged("RuleElement"); } } - private Code _RuleElement; + private Code? _RuleElement; /// /// identical | matching | different | custom @@ -654,13 +625,10 @@ public Code RuleElement [IgnoreDataMember] public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule { - get { return RuleElement != null ? RuleElement.Value : null; } + get => _RuleElement?.Value; set { - if (value == null) - RuleElement = null; - else - RuleElement = new Code(value); + RuleElement = value is null ? null : new Code(value); OnPropertyChanged("Rule"); } } @@ -670,28 +638,25 @@ public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule /// [FhirElement("expression", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Custom rule, as a FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -701,46 +666,39 @@ public string Expression /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Documentation for FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentComponent; - - if (dest == null) - { + if(other is not CompartmentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(RuleElement != null) dest.RuleElement = (Code)RuleElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_RuleElement is not null) dest.RuleElement = (Code)_RuleElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -752,55 +710,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentComponent; - if(otherT == null) return false; + if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(RuleElement, otherT.RuleElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "rule": - value = RuleElement; - return RuleElement is not null; + value = _RuleElement; + return _RuleElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "rule": - RuleElement = (Code)value; + RuleElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -811,10 +769,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (RuleElement is not null) yield return new KeyValuePair("rule",RuleElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_RuleElement is not null) yield return new KeyValuePair("rule",_RuleElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -824,28 +782,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this graph definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -855,28 +810,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -887,28 +839,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this graph definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -921,13 +870,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -936,13 +885,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -952,13 +898,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=130, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -967,13 +913,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -983,28 +926,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1014,28 +954,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1048,39 +985,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the graph definition. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1093,11 +1027,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for graph definition (if applicable). @@ -1108,39 +1042,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this graph definition is defined. /// [FhirElement("purpose", Order=200, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this graph definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1153,13 +1084,13 @@ public string Purpose [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StartElement + public Code? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Code _StartElement; + private Code? _StartElement; /// /// Type of resource at which the graph starts @@ -1168,13 +1099,10 @@ public Code StartElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Code(value); + StartElement = value is null ? null : new Code(value); OnPropertyChanged("Start"); } } @@ -1184,28 +1112,25 @@ public Hl7.Fhir.Model.ResourceType? Start /// [FhirElement("profile", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirUri ProfileElement + public Hl7.Fhir.Model.FhirUri? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.FhirUri _ProfileElement; + private Hl7.Fhir.Model.FhirUri? _ProfileElement; /// /// Profile on base resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.FhirUri(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Profile"); } } @@ -1218,37 +1143,33 @@ public string Profile [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as GraphDefinition; - - if (dest == null) - { + if(other is not GraphDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Code)StartElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.FhirUri)ProfileElement.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Code)_StartElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.FhirUri)_ProfileElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1260,132 +1181,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GraphDefinition; - if(otherT == null) return false; + if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "start": - StartElement = (Code)value; + StartElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.FhirUri)value; + ProfileElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1396,21 +1317,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Group.cs b/src/Hl7.Fhir.STU3/Model/Generated/Group.cs index 3270b20e2..5eb62062e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Group.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -129,13 +132,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("GroupCharacteristicKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value held by characteristic. @@ -146,13 +149,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Group includes or excludes. @@ -160,13 +163,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("exclude", IsModifier=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Group includes or excludes @@ -175,13 +178,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -191,28 +191,24 @@ public bool? Exclude /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -224,55 +220,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -283,10 +279,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -315,39 +311,39 @@ public partial class MemberComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","Practitioner","Device","Medication","Substance")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Entity + public Hl7.Fhir.Model.ResourceReference? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.ResourceReference _Entity; + private Hl7.Fhir.Model.ResourceReference? _Entity; /// /// Period member belonged to the group. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// If member is no longer in group. /// [FhirElement("inactive", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// If member is no longer in group @@ -356,30 +352,23 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MemberComponent; - - if (dest == null) - { + if(other is not MemberComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)Entity.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)_Entity.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -391,48 +380,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MemberComponent; - if(otherT == null) return false; + if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.ResourceReference)value; + Entity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -443,9 +432,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); } } @@ -458,24 +447,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this group's record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this group's record is in active use @@ -484,13 +473,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -503,13 +489,13 @@ public bool? Active [Binding("GroupType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | animal | practitioner | device | medication | substance @@ -518,13 +504,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Group.GroupType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -535,13 +518,13 @@ public Hl7.Fhir.Model.Group.GroupType? Type [FhirElement("actual", InSummary=true, Order=120, FiveWs="class")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Descriptive or actual @@ -550,13 +533,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -567,41 +547,38 @@ public bool? Actual [FhirElement("code", InSummary=true, Order=130, FiveWs="what")] [Binding("GroupKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Label for Group. /// [FhirElement("name", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for Group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -611,13 +588,13 @@ public string Name /// [FhirElement("quantity", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt QuantityElement + public Hl7.Fhir.Model.UnsignedInt? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.UnsignedInt _QuantityElement; + private Hl7.Fhir.Model.UnsignedInt? _QuantityElement; /// /// Number of members @@ -626,13 +603,10 @@ public Hl7.Fhir.Model.UnsignedInt QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.UnsignedInt(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Quantity"); } } @@ -645,11 +619,11 @@ public int? Quantity [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Who or what is in group. @@ -659,33 +633,29 @@ public List Characteristic [DataMember] public List Member { - get { if(_Member==null) _Member = new List(); return _Member; } + get => _Member ?? new List(); set { _Member = value; OnPropertyChanged("Member"); } } - private List _Member; + private List? _Member; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Group; - - if (dest == null) - { + if(other is not Group dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)QuantityElement.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Member.Any()) dest.Member = new List(Member.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)_QuantityElement.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Member is not null) dest.Member = new List(_Member.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -697,90 +667,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Group; - if(otherT == null) return false; + if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Member, otherT.Member)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Member, otherT._Member)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "member": - value = Member; - return Member?.Any() == true; + value = _Member; + return _Member?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.UnsignedInt)value; + QuantityElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "member": - Member = (List)value; + Member = (List?)value!; return this; default: return base.SetValue(key, value); @@ -791,15 +761,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Member?.Any() == true) yield return new KeyValuePair("member",Member); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Member?.Any() == true) yield return new KeyValuePair("member",_Member); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs index 71f7b0aa4..1a383575e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,28 +113,25 @@ public enum GuidanceResponseStatus /// [FhirElement("requestId", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Id RequestIdElement + public Hl7.Fhir.Model.Id? RequestIdElement { get { return _RequestIdElement; } set { _RequestIdElement = value; OnPropertyChanged("RequestIdElement"); } } - private Hl7.Fhir.Model.Id _RequestIdElement; + private Hl7.Fhir.Model.Id? _RequestIdElement; /// /// The id of the request associated with this response, if any /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestId + public string? RequestId { - get { return RequestIdElement != null ? RequestIdElement.Value : null; } + get => _RequestIdElement?.Value; set { - if (value == null) - RequestIdElement = null; - else - RequestIdElement = new Hl7.Fhir.Model.Id(value); + RequestIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RequestId"); } } @@ -141,13 +141,13 @@ public string RequestId /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// A reference to a knowledge module. @@ -157,13 +157,13 @@ public Hl7.Fhir.Model.Identifier Identifier [References("ServiceDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Module + public Hl7.Fhir.Model.ResourceReference? Module { get { return _Module; } set { _Module = value; OnPropertyChanged("Module"); } } - private Hl7.Fhir.Model.ResourceReference _Module; + private Hl7.Fhir.Model.ResourceReference? _Module; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error. @@ -173,13 +173,13 @@ public Hl7.Fhir.Model.ResourceReference Module [Binding("GuidanceResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error @@ -188,13 +188,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -206,13 +203,13 @@ public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode during which the response was returned. @@ -221,41 +218,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When the guidance response was processed. /// [FhirElement("occurrenceDateTime", Order=150, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OccurrenceDateTimeElement + public Hl7.Fhir.Model.FhirDateTime? OccurrenceDateTimeElement { get { return _OccurrenceDateTimeElement; } set { _OccurrenceDateTimeElement = value; OnPropertyChanged("OccurrenceDateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OccurrenceDateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _OccurrenceDateTimeElement; /// /// When the guidance response was processed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OccurrenceDateTime + public string? OccurrenceDateTime { - get { return OccurrenceDateTimeElement != null ? OccurrenceDateTimeElement.Value : null; } + get => _OccurrenceDateTimeElement?.Value; set { - if (value == null) - OccurrenceDateTimeElement = null; - else - OccurrenceDateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + OccurrenceDateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("OccurrenceDateTime"); } } @@ -267,13 +261,13 @@ public string OccurrenceDateTime [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Reason for the response. @@ -283,13 +277,13 @@ public Hl7.Fhir.Model.ResourceReference Performer [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reason + public Hl7.Fhir.Model.DataType? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.DataType _Reason; + private Hl7.Fhir.Model.DataType? _Reason; /// /// Additional notes about the response. @@ -299,11 +293,11 @@ public Hl7.Fhir.Model.DataType Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Messages resulting from the evaluation of the artifact or artifacts. @@ -315,11 +309,11 @@ public List Note [DataMember] public List EvaluationMessage { - get { if(_EvaluationMessage==null) _EvaluationMessage = new List(); return _EvaluationMessage; } + get => _EvaluationMessage ?? new List(); set { _EvaluationMessage = value; OnPropertyChanged("EvaluationMessage"); } } - private List _EvaluationMessage; + private List? _EvaluationMessage; /// /// The output parameters of the evaluation, if any. @@ -328,13 +322,13 @@ public List EvaluationMessage [CLSCompliant(false)] [References("Parameters")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OutputParameters + public Hl7.Fhir.Model.ResourceReference? OutputParameters { get { return _OutputParameters; } set { _OutputParameters = value; OnPropertyChanged("OutputParameters"); } } - private Hl7.Fhir.Model.ResourceReference _OutputParameters; + private Hl7.Fhir.Model.ResourceReference? _OutputParameters; /// /// Proposed actions, if any. @@ -343,13 +337,13 @@ public Hl7.Fhir.Model.ResourceReference OutputParameters [CLSCompliant(false)] [References("CarePlan","RequestGroup")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Result + public Hl7.Fhir.Model.ResourceReference? Result { get { return _Result; } set { _Result = value; OnPropertyChanged("Result"); } } - private Hl7.Fhir.Model.ResourceReference _Result; + private Hl7.Fhir.Model.ResourceReference? _Result; /// /// Additional required data. @@ -359,38 +353,34 @@ public Hl7.Fhir.Model.ResourceReference Result [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as GuidanceResponse; - - if (dest == null) - { + if(other is not GuidanceResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequestIdElement != null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)RequestIdElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Module != null) dest.Module = (Hl7.Fhir.Model.ResourceReference)Module.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(OccurrenceDateTimeElement != null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)OccurrenceDateTimeElement.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.DataType)Reason.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(EvaluationMessage.Any()) dest.EvaluationMessage = new List(EvaluationMessage.DeepCopyInternal()); - if(OutputParameters != null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)OutputParameters.DeepCopyInternal(); - if(Result != null) dest.Result = (Hl7.Fhir.Model.ResourceReference)Result.DeepCopyInternal(); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); + if(_RequestIdElement is not null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)_RequestIdElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Module is not null) dest.Module = (Hl7.Fhir.Model.ResourceReference)_Module.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_OccurrenceDateTimeElement is not null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_OccurrenceDateTimeElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.DataType)_Reason.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_EvaluationMessage is not null) dest.EvaluationMessage = new List(_EvaluationMessage.DeepCopyInternal()); + if(_OutputParameters is not null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)_OutputParameters.DeepCopyInternal(); + if(_Result is not null) dest.Result = (Hl7.Fhir.Model.ResourceReference)_Result.DeepCopyInternal(); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -402,125 +392,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuidanceResponse; - if(otherT == null) return false; + if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequestIdElement, otherT.RequestIdElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Module, otherT.Module)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(OccurrenceDateTimeElement, otherT.OccurrenceDateTimeElement)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(EvaluationMessage, otherT.EvaluationMessage)) return false; - if(!comparer.Equals(OutputParameters, otherT.OutputParameters)) return false; - if(!comparer.Equals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdElement, otherT._RequestIdElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Module, otherT._Module)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_OccurrenceDateTimeElement, otherT._OccurrenceDateTimeElement)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_EvaluationMessage, otherT._EvaluationMessage)) return false; + if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; + if(!comparer.Equals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "requestId": - value = RequestIdElement; - return RequestIdElement is not null; + value = _RequestIdElement; + return _RequestIdElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "module": - value = Module; - return Module is not null; + value = _Module; + return _Module is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrenceDateTime": - value = OccurrenceDateTimeElement; - return OccurrenceDateTimeElement is not null; + value = _OccurrenceDateTimeElement; + return _OccurrenceDateTimeElement is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "evaluationMessage": - value = EvaluationMessage; - return EvaluationMessage?.Any() == true; + value = _EvaluationMessage; + return _EvaluationMessage?.Any() == true; case "outputParameters": - value = OutputParameters; - return OutputParameters is not null; + value = _OutputParameters; + return _OutputParameters is not null; case "result": - value = Result; - return Result is not null; + value = _Result; + return _Result is not null; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "requestId": - RequestIdElement = (Hl7.Fhir.Model.Id)value; + RequestIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "module": - Module = (Hl7.Fhir.Model.ResourceReference)value; + Module = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrenceDateTime": - OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.DataType)value; + Reason = (Hl7.Fhir.Model.DataType?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "evaluationMessage": - EvaluationMessage = (List)value; + EvaluationMessage = (List?)value!; return this; case "outputParameters": - OutputParameters = (Hl7.Fhir.Model.ResourceReference)value; + OutputParameters = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "result": - Result = (Hl7.Fhir.Model.ResourceReference)value; + Result = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -531,20 +521,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequestIdElement is not null) yield return new KeyValuePair("requestId",RequestIdElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Module is not null) yield return new KeyValuePair("module",Module); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",OccurrenceDateTimeElement); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (EvaluationMessage?.Any() == true) yield return new KeyValuePair("evaluationMessage",EvaluationMessage); - if (OutputParameters is not null) yield return new KeyValuePair("outputParameters",OutputParameters); - if (Result is not null) yield return new KeyValuePair("result",Result); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); + if (_RequestIdElement is not null) yield return new KeyValuePair("requestId",_RequestIdElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Module is not null) yield return new KeyValuePair("module",_Module); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",_OccurrenceDateTimeElement); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_EvaluationMessage?.Any() == true) yield return new KeyValuePair("evaluationMessage",_EvaluationMessage); + if (_OutputParameters is not null) yield return new KeyValuePair("outputParameters",_OutputParameters); + if (_Result is not null) yield return new KeyValuePair("result",_Result); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs index 70e9b9526..78353a6e9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -83,24 +86,24 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -112,13 +115,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// Always available? e.g. 24 hour service @@ -127,13 +130,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -143,28 +143,25 @@ public bool? AllDay /// [FhirElement("availableStartTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time AvailableStartTimeElement + public Hl7.Fhir.Model.Time? AvailableStartTimeElement { get { return _AvailableStartTimeElement; } set { _AvailableStartTimeElement = value; OnPropertyChanged("AvailableStartTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableStartTimeElement; + private Hl7.Fhir.Model.Time? _AvailableStartTimeElement; /// /// Opening time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableStartTime + public string? AvailableStartTime { - get { return AvailableStartTimeElement != null ? AvailableStartTimeElement.Value : null; } + get => _AvailableStartTimeElement?.Value; set { - if (value == null) - AvailableStartTimeElement = null; - else - AvailableStartTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableStartTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableStartTime"); } } @@ -174,46 +171,39 @@ public string AvailableStartTime /// [FhirElement("availableEndTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time AvailableEndTimeElement + public Hl7.Fhir.Model.Time? AvailableEndTimeElement { get { return _AvailableEndTimeElement; } set { _AvailableEndTimeElement = value; OnPropertyChanged("AvailableEndTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableEndTimeElement; + private Hl7.Fhir.Model.Time? _AvailableEndTimeElement; /// /// Closing time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableEndTime + public string? AvailableEndTime { - get { return AvailableEndTimeElement != null ? AvailableEndTimeElement.Value : null; } + get => _AvailableEndTimeElement?.Value; set { - if (value == null) - AvailableEndTimeElement = null; - else - AvailableEndTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableEndTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableEndTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AvailableTimeComponent; - - if (dest == null) - { + if(other is not AvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(AvailableStartTimeElement != null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)AvailableStartTimeElement.DeepCopyInternal(); - if(AvailableEndTimeElement != null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)AvailableEndTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_AvailableStartTimeElement is not null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)_AvailableStartTimeElement.DeepCopyInternal(); + if(_AvailableEndTimeElement is not null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)_AvailableEndTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -225,55 +215,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AvailableTimeComponent; - if(otherT == null) return false; + if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(AvailableStartTimeElement, otherT.AvailableStartTimeElement)) return false; - if(!comparer.Equals(AvailableEndTimeElement, otherT.AvailableEndTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; + if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "availableStartTime": - value = AvailableStartTimeElement; - return AvailableStartTimeElement is not null; + value = _AvailableStartTimeElement; + return _AvailableStartTimeElement is not null; case "availableEndTime": - value = AvailableEndTimeElement; - return AvailableEndTimeElement is not null; + value = _AvailableEndTimeElement; + return _AvailableEndTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableStartTime": - AvailableStartTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableStartTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "availableEndTime": - AvailableEndTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableEndTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -284,10 +274,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",AvailableStartTimeElement); - if (AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",AvailableEndTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",_AvailableStartTimeElement); + if (_AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",_AvailableEndTimeElement); } } @@ -314,28 +304,25 @@ public partial class NotAvailableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason presented to the user explaining why time not available /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -345,26 +332,22 @@ public string Description /// [FhirElement("during", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period During + public Hl7.Fhir.Model.Period? During { get { return _During; } set { _During = value; OnPropertyChanged("During"); } } - private Hl7.Fhir.Model.Period _During; + private Hl7.Fhir.Model.Period? _During; protected internal override void CopyToInternal(Base other) { - var dest = other as NotAvailableComponent; - - if (dest == null) - { + if(other is not NotAvailableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(During != null) dest.During = (Hl7.Fhir.Model.Period)During.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_During is not null) dest.During = (Hl7.Fhir.Model.Period)_During.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -376,41 +359,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotAvailableComponent; - if(otherT == null) return false; + if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(During, otherT.During)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_During, otherT._During)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "during": - value = During; - return During is not null; + value = _During; + return _During is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "during": - During = (Hl7.Fhir.Model.Period)value; + During = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -421,8 +404,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (During is not null) yield return new KeyValuePair("during",During); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_During is not null) yield return new KeyValuePair("during",_During); } } @@ -435,24 +418,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this healthcareservice is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this healthcareservice is in active use @@ -461,13 +444,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -479,13 +459,13 @@ public bool? Active [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProvidedBy + public Hl7.Fhir.Model.ResourceReference? ProvidedBy { get { return _ProvidedBy; } set { _ProvidedBy = value; OnPropertyChanged("ProvidedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ProvidedBy; + private Hl7.Fhir.Model.ResourceReference? _ProvidedBy; /// /// Broad category of service being performed or delivered. @@ -493,13 +473,13 @@ public Hl7.Fhir.Model.ResourceReference ProvidedBy [FhirElement("category", InSummary=true, Order=120, FiveWs="class")] [Binding("service-category")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of service that may be delivered or performed. @@ -510,11 +490,11 @@ public Hl7.Fhir.Model.CodeableConcept Category [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specialties handled by the HealthcareService. @@ -525,11 +505,11 @@ public List Type [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Location(s) where service may be provided. @@ -541,39 +521,36 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Description of service as presented to a consumer while searching. /// [FhirElement("name", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Description of service as presented to a consumer while searching /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -583,28 +560,25 @@ public string Name /// [FhirElement("comment", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional description and/or any specific issues not covered elsewhere /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -614,28 +588,25 @@ public string Comment /// [FhirElement("extraDetails", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString ExtraDetailsElement + public Hl7.Fhir.Model.FhirString? ExtraDetailsElement { get { return _ExtraDetailsElement; } set { _ExtraDetailsElement = value; OnPropertyChanged("ExtraDetailsElement"); } } - private Hl7.Fhir.Model.FhirString _ExtraDetailsElement; + private Hl7.Fhir.Model.FhirString? _ExtraDetailsElement; /// /// Extra details about the service that can't be placed in the other fields /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExtraDetails + public string? ExtraDetails { - get { return ExtraDetailsElement != null ? ExtraDetailsElement.Value : null; } + get => _ExtraDetailsElement?.Value; set { - if (value == null) - ExtraDetailsElement = null; - else - ExtraDetailsElement = new Hl7.Fhir.Model.FhirString(value); + ExtraDetailsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ExtraDetails"); } } @@ -645,13 +616,13 @@ public string ExtraDetails /// [FhirElement("photo", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Attachment Photo + public Hl7.Fhir.Model.Attachment? Photo { get { return _Photo; } set { _Photo = value; OnPropertyChanged("Photo"); } } - private Hl7.Fhir.Model.Attachment _Photo; + private Hl7.Fhir.Model.Attachment? _Photo; /// /// Contacts related to the healthcare service. @@ -661,11 +632,11 @@ public Hl7.Fhir.Model.Attachment Photo [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Location(s) service is inteded for/available to. @@ -677,11 +648,11 @@ public List Telecom [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// Conditions under which service is available/offered. @@ -692,11 +663,11 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get { if(_ServiceProvisionCode==null) _ServiceProvisionCode = new List(); return _ServiceProvisionCode; } + get => _ServiceProvisionCode ?? new List(); set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } - private List _ServiceProvisionCode; + private List? _ServiceProvisionCode; /// /// Specific eligibility requirements required to use the service. @@ -704,41 +675,38 @@ public List ServiceProvisionCode [FhirElement("eligibility", Order=230)] [Binding("ServiceEligibility")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Eligibility + public Hl7.Fhir.Model.CodeableConcept? Eligibility { get { return _Eligibility; } set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } - private Hl7.Fhir.Model.CodeableConcept _Eligibility; + private Hl7.Fhir.Model.CodeableConcept? _Eligibility; /// /// Describes the eligibility conditions for the service. /// [FhirElement("eligibilityNote", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString EligibilityNoteElement + public Hl7.Fhir.Model.FhirString? EligibilityNoteElement { get { return _EligibilityNoteElement; } set { _EligibilityNoteElement = value; OnPropertyChanged("EligibilityNoteElement"); } } - private Hl7.Fhir.Model.FhirString _EligibilityNoteElement; + private Hl7.Fhir.Model.FhirString? _EligibilityNoteElement; /// /// Describes the eligibility conditions for the service /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EligibilityNote + public string? EligibilityNote { - get { return EligibilityNoteElement != null ? EligibilityNoteElement.Value : null; } + get => _EligibilityNoteElement?.Value; set { - if (value == null) - EligibilityNoteElement = null; - else - EligibilityNoteElement = new Hl7.Fhir.Model.FhirString(value); + EligibilityNoteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("EligibilityNote"); } } @@ -751,24 +719,24 @@ public string EligibilityNote [DataMember] public List ProgramNameElement { - get { if(_ProgramNameElement==null) _ProgramNameElement = new List(); return _ProgramNameElement; } + get => _ProgramNameElement ?? new List(); set { _ProgramNameElement = value; OnPropertyChanged("ProgramNameElement"); } } - private List _ProgramNameElement; + private List? _ProgramNameElement; /// /// Program Names that categorize the service /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProgramName + public IEnumerable? ProgramName { - get { return ProgramNameElement != null ? ProgramNameElement.Select(elem => elem.Value) : null; } + get => _ProgramNameElement?.Select(elem => elem.Value); set { if (value == null) - ProgramNameElement = null; + ProgramNameElement = null!; else ProgramNameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ProgramName"); @@ -784,11 +752,11 @@ public IEnumerable ProgramName [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Ways that the service accepts referrals. @@ -799,24 +767,24 @@ public List Characteristic [DataMember] public List ReferralMethod { - get { if(_ReferralMethod==null) _ReferralMethod = new List(); return _ReferralMethod; } + get => _ReferralMethod ?? new List(); set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } - private List _ReferralMethod; + private List? _ReferralMethod; /// /// If an appointment is required for access to this service. /// [FhirElement("appointmentRequired", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement + public Hl7.Fhir.Model.FhirBoolean? AppointmentRequiredElement { get { return _AppointmentRequiredElement; } set { _AppointmentRequiredElement = value; OnPropertyChanged("AppointmentRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AppointmentRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _AppointmentRequiredElement; /// /// If an appointment is required for access to this service @@ -825,13 +793,10 @@ public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement [IgnoreDataMember] public bool? AppointmentRequired { - get { return AppointmentRequiredElement != null ? AppointmentRequiredElement.Value : null; } + get => _AppointmentRequiredElement?.Value; set { - if (value == null) - AppointmentRequiredElement = null; - else - AppointmentRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + AppointmentRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AppointmentRequired"); } } @@ -844,11 +809,11 @@ public bool? AppointmentRequired [DataMember] public List AvailableTime { - get { if(_AvailableTime==null) _AvailableTime = new List(); return _AvailableTime; } + get => _AvailableTime ?? new List(); set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } - private List _AvailableTime; + private List? _AvailableTime; /// /// Not available during this time due to provided reason. @@ -858,39 +823,36 @@ public List AvailableTi [DataMember] public List NotAvailable { - get { if(_NotAvailable==null) _NotAvailable = new List(); return _NotAvailable; } + get => _NotAvailable ?? new List(); set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } - private List _NotAvailable; + private List? _NotAvailable; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=310)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -905,48 +867,44 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as HealthcareService; - - if (dest == null) - { + if(other is not HealthcareService dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ProvidedBy != null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)ProvidedBy.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(ExtraDetailsElement != null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.FhirString)ExtraDetailsElement.DeepCopyInternal(); - if(Photo != null) dest.Photo = (Hl7.Fhir.Model.Attachment)Photo.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(ServiceProvisionCode.Any()) dest.ServiceProvisionCode = new List(ServiceProvisionCode.DeepCopyInternal()); - if(Eligibility != null) dest.Eligibility = (Hl7.Fhir.Model.CodeableConcept)Eligibility.DeepCopyInternal(); - if(EligibilityNoteElement != null) dest.EligibilityNoteElement = (Hl7.Fhir.Model.FhirString)EligibilityNoteElement.DeepCopyInternal(); - if(ProgramNameElement.Any()) dest.ProgramNameElement = new List(ProgramNameElement.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(ReferralMethod.Any()) dest.ReferralMethod = new List(ReferralMethod.DeepCopyInternal()); - if(AppointmentRequiredElement != null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)AppointmentRequiredElement.DeepCopyInternal(); - if(AvailableTime.Any()) dest.AvailableTime = new List(AvailableTime.DeepCopyInternal()); - if(NotAvailable.Any()) dest.NotAvailable = new List(NotAvailable.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ProvidedBy is not null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)_ProvidedBy.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_ExtraDetailsElement is not null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.FhirString)_ExtraDetailsElement.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = (Hl7.Fhir.Model.Attachment)_Photo.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_ServiceProvisionCode is not null) dest.ServiceProvisionCode = new List(_ServiceProvisionCode.DeepCopyInternal()); + if(_Eligibility is not null) dest.Eligibility = (Hl7.Fhir.Model.CodeableConcept)_Eligibility.DeepCopyInternal(); + if(_EligibilityNoteElement is not null) dest.EligibilityNoteElement = (Hl7.Fhir.Model.FhirString)_EligibilityNoteElement.DeepCopyInternal(); + if(_ProgramNameElement is not null) dest.ProgramNameElement = new List(_ProgramNameElement.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_ReferralMethod is not null) dest.ReferralMethod = new List(_ReferralMethod.DeepCopyInternal()); + if(_AppointmentRequiredElement is not null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_AppointmentRequiredElement.DeepCopyInternal(); + if(_AvailableTime is not null) dest.AvailableTime = new List(_AvailableTime.DeepCopyInternal()); + if(_NotAvailable is not null) dest.NotAvailable = new List(_NotAvailable.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -958,195 +916,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HealthcareService; - if(otherT == null) return false; + if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(ProvidedBy, otherT.ProvidedBy)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(ExtraDetailsElement, otherT.ExtraDetailsElement)) return false; - if(!comparer.Equals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(ServiceProvisionCode, otherT.ServiceProvisionCode)) return false; - if(!comparer.Equals(Eligibility, otherT.Eligibility)) return false; - if(!comparer.Equals(EligibilityNoteElement, otherT.EligibilityNoteElement)) return false; - if(!comparer.ListEquals(ProgramNameElement, otherT.ProgramNameElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(ReferralMethod, otherT.ReferralMethod)) return false; - if(!comparer.Equals(AppointmentRequiredElement, otherT.AppointmentRequiredElement)) return false; - if(!comparer.ListEquals(AvailableTime, otherT.AvailableTime)) return false; - if(!comparer.ListEquals(NotAvailable, otherT.NotAvailable)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_ExtraDetailsElement, otherT._ExtraDetailsElement)) return false; + if(!comparer.Equals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_ServiceProvisionCode, otherT._ServiceProvisionCode)) return false; + if(!comparer.Equals(_Eligibility, otherT._Eligibility)) return false; + if(!comparer.Equals(_EligibilityNoteElement, otherT._EligibilityNoteElement)) return false; + if(!comparer.ListEquals(_ProgramNameElement, otherT._ProgramNameElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_ReferralMethod, otherT._ReferralMethod)) return false; + if(!comparer.Equals(_AppointmentRequiredElement, otherT._AppointmentRequiredElement)) return false; + if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "providedBy": - value = ProvidedBy; - return ProvidedBy is not null; + value = _ProvidedBy; + return _ProvidedBy is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "extraDetails": - value = ExtraDetailsElement; - return ExtraDetailsElement is not null; + value = _ExtraDetailsElement; + return _ExtraDetailsElement is not null; case "photo": - value = Photo; - return Photo is not null; + value = _Photo; + return _Photo is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "serviceProvisionCode": - value = ServiceProvisionCode; - return ServiceProvisionCode?.Any() == true; + value = _ServiceProvisionCode; + return _ServiceProvisionCode?.Any() == true; case "eligibility": - value = Eligibility; - return Eligibility is not null; + value = _Eligibility; + return _Eligibility is not null; case "eligibilityNote": - value = EligibilityNoteElement; - return EligibilityNoteElement is not null; + value = _EligibilityNoteElement; + return _EligibilityNoteElement is not null; case "programName": - value = ProgramNameElement; - return ProgramNameElement?.Any() == true; + value = _ProgramNameElement; + return _ProgramNameElement?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "referralMethod": - value = ReferralMethod; - return ReferralMethod?.Any() == true; + value = _ReferralMethod; + return _ReferralMethod?.Any() == true; case "appointmentRequired": - value = AppointmentRequiredElement; - return AppointmentRequiredElement is not null; + value = _AppointmentRequiredElement; + return _AppointmentRequiredElement is not null; case "availableTime": - value = AvailableTime; - return AvailableTime?.Any() == true; + value = _AvailableTime; + return _AvailableTime?.Any() == true; case "notAvailable": - value = NotAvailable; - return NotAvailable?.Any() == true; + value = _NotAvailable; + return _NotAvailable?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "providedBy": - ProvidedBy = (Hl7.Fhir.Model.ResourceReference)value; + ProvidedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "extraDetails": - ExtraDetailsElement = (Hl7.Fhir.Model.FhirString)value; + ExtraDetailsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "photo": - Photo = (Hl7.Fhir.Model.Attachment)value; + Photo = (Hl7.Fhir.Model.Attachment?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "serviceProvisionCode": - ServiceProvisionCode = (List)value; + ServiceProvisionCode = (List?)value!; return this; case "eligibility": - Eligibility = (Hl7.Fhir.Model.CodeableConcept)value; + Eligibility = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "eligibilityNote": - EligibilityNoteElement = (Hl7.Fhir.Model.FhirString)value; + EligibilityNoteElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "programName": - ProgramNameElement = (List)value; + ProgramNameElement = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "referralMethod": - ReferralMethod = (List)value; + ReferralMethod = (List?)value!; return this; case "appointmentRequired": - AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableTime": - AvailableTime = (List)value; + AvailableTime = (List?)value!; return this; case "notAvailable": - NotAvailable = (List)value; + NotAvailable = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1157,30 +1115,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ProvidedBy is not null) yield return new KeyValuePair("providedBy",ProvidedBy); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",ExtraDetailsElement); - if (Photo is not null) yield return new KeyValuePair("photo",Photo); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",ServiceProvisionCode); - if (Eligibility is not null) yield return new KeyValuePair("eligibility",Eligibility); - if (EligibilityNoteElement is not null) yield return new KeyValuePair("eligibilityNote",EligibilityNoteElement); - if (ProgramNameElement?.Any() == true) yield return new KeyValuePair("programName",ProgramNameElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",ReferralMethod); - if (AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",AppointmentRequiredElement); - if (AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",AvailableTime); - if (NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",NotAvailable); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ProvidedBy is not null) yield return new KeyValuePair("providedBy",_ProvidedBy); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",_ExtraDetailsElement); + if (_Photo is not null) yield return new KeyValuePair("photo",_Photo); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",_ServiceProvisionCode); + if (_Eligibility is not null) yield return new KeyValuePair("eligibility",_Eligibility); + if (_EligibilityNoteElement is not null) yield return new KeyValuePair("eligibilityNote",_EligibilityNoteElement); + if (_ProgramNameElement?.Any() == true) yield return new KeyValuePair("programName",_ProgramNameElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",_ReferralMethod); + if (_AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",_AppointmentRequiredElement); + if (_AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",_AvailableTime); + if (_NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",_NotAvailable); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs index e5886f1d1..0fb3fe01a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -119,13 +122,13 @@ public enum NameUse [DeclaredType(Type = typeof(Code))] [Binding("NameUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// usual | official | temp | nickname | anonymous | old | maiden @@ -134,13 +137,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.HumanName.NameUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -150,28 +150,25 @@ public Hl7.Fhir.Model.HumanName.NameUse? Use /// [FhirElement("text", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the full name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -181,28 +178,25 @@ public string Text /// [FhirElement("family", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString FamilyElement + public Hl7.Fhir.Model.FhirString? FamilyElement { get { return _FamilyElement; } set { _FamilyElement = value; OnPropertyChanged("FamilyElement"); } } - private Hl7.Fhir.Model.FhirString _FamilyElement; + private Hl7.Fhir.Model.FhirString? _FamilyElement; /// /// Family name (often called 'Surname') /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Family + public string? Family { - get { return FamilyElement != null ? FamilyElement.Value : null; } + get => _FamilyElement?.Value; set { - if (value == null) - FamilyElement = null; - else - FamilyElement = new Hl7.Fhir.Model.FhirString(value); + FamilyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Family"); } } @@ -215,24 +209,24 @@ public string Family [DataMember] public List GivenElement { - get { if(_GivenElement==null) _GivenElement = new List(); return _GivenElement; } + get => _GivenElement ?? new List(); set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } - private List _GivenElement; + private List? _GivenElement; /// /// Given names (not always 'first'). Includes middle names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Given + public IEnumerable? Given { - get { return GivenElement != null ? GivenElement.Select(elem => elem.Value) : null; } + get => _GivenElement?.Select(elem => elem.Value); set { if (value == null) - GivenElement = null; + GivenElement = null!; else GivenElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Given"); @@ -247,24 +241,24 @@ public IEnumerable Given [DataMember] public List PrefixElement { - get { if(_PrefixElement==null) _PrefixElement = new List(); return _PrefixElement; } + get => _PrefixElement ?? new List(); set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private List _PrefixElement; + private List? _PrefixElement; /// /// Parts that come before the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Prefix + public IEnumerable? Prefix { - get { return PrefixElement != null ? PrefixElement.Select(elem => elem.Value) : null; } + get => _PrefixElement?.Select(elem => elem.Value); set { if (value == null) - PrefixElement = null; + PrefixElement = null!; else PrefixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Prefix"); @@ -279,24 +273,24 @@ public IEnumerable Prefix [DataMember] public List SuffixElement { - get { if(_SuffixElement==null) _SuffixElement = new List(); return _SuffixElement; } + get => _SuffixElement ?? new List(); set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } - private List _SuffixElement; + private List? _SuffixElement; /// /// Parts that come after the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Suffix + public IEnumerable? Suffix { - get { return SuffixElement != null ? SuffixElement.Select(elem => elem.Value) : null; } + get => _SuffixElement?.Select(elem => elem.Value); set { if (value == null) - SuffixElement = null; + SuffixElement = null!; else SuffixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Suffix"); @@ -308,31 +302,27 @@ public IEnumerable Suffix /// [FhirElement("period", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as HumanName; - - if (dest == null) - { + if(other is not HumanName dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(FamilyElement != null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)FamilyElement.DeepCopyInternal(); - if(GivenElement.Any()) dest.GivenElement = new List(GivenElement.DeepCopyInternal()); - if(PrefixElement.Any()) dest.PrefixElement = new List(PrefixElement.DeepCopyInternal()); - if(SuffixElement.Any()) dest.SuffixElement = new List(SuffixElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_FamilyElement is not null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)_FamilyElement.DeepCopyInternal(); + if(_GivenElement is not null) dest.GivenElement = new List(_GivenElement.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = new List(_PrefixElement.DeepCopyInternal()); + if(_SuffixElement is not null) dest.SuffixElement = new List(_SuffixElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -344,76 +334,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HumanName; - if(otherT == null) return false; + if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(FamilyElement, otherT.FamilyElement)) return false; - if(!comparer.ListEquals(GivenElement, otherT.GivenElement)) return false; - if(!comparer.ListEquals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.ListEquals(SuffixElement, otherT.SuffixElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; + if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; + if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "family": - value = FamilyElement; - return FamilyElement is not null; + value = _FamilyElement; + return _FamilyElement is not null; case "given": - value = GivenElement; - return GivenElement?.Any() == true; + value = _GivenElement; + return _GivenElement?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement?.Any() == true; + value = _PrefixElement; + return _PrefixElement?.Any() == true; case "suffix": - value = SuffixElement; - return SuffixElement?.Any() == true; + value = _SuffixElement; + return _SuffixElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "family": - FamilyElement = (Hl7.Fhir.Model.FhirString)value; + FamilyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "given": - GivenElement = (List)value; + GivenElement = (List?)value!; return this; case "prefix": - PrefixElement = (List)value; + PrefixElement = (List?)value!; return this; case "suffix": - SuffixElement = (List)value; + SuffixElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -424,13 +414,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (FamilyElement is not null) yield return new KeyValuePair("family",FamilyElement); - if (GivenElement?.Any() == true) yield return new KeyValuePair("given",GivenElement); - if (PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",PrefixElement); - if (SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",SuffixElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_FamilyElement is not null) yield return new KeyValuePair("family",_FamilyElement); + if (_GivenElement?.Any() == true) yield return new KeyValuePair("given",_GivenElement); + if (_PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",_PrefixElement); + if (_SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",_SuffixElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs index 850a7c250..9af996ce4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,28 +85,25 @@ public partial class StudyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid UidElement + public Hl7.Fhir.Model.Oid? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Oid _UidElement; + private Hl7.Fhir.Model.Oid? _UidElement; /// /// Study instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Oid(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("Uid"); } } @@ -115,13 +115,13 @@ public string Uid [CLSCompliant(false)] [References("ImagingStudy")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ImagingStudy + public Hl7.Fhir.Model.ResourceReference? ImagingStudy { get { return _ImagingStudy; } set { _ImagingStudy = value; OnPropertyChanged("ImagingStudy"); } } - private Hl7.Fhir.Model.ResourceReference _ImagingStudy; + private Hl7.Fhir.Model.ResourceReference? _ImagingStudy; /// /// Study access service endpoint. @@ -133,11 +133,11 @@ public Hl7.Fhir.Model.ResourceReference ImagingStudy [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Series identity of the selected instances. @@ -147,26 +147,22 @@ public List Endpoint [DataMember] public List Series { - get { if(_Series==null) _Series = new List(); return _Series; } + get => _Series ?? new List(); set { _Series = value; OnPropertyChanged("Series"); } } - private List _Series; + private List? _Series; protected internal override void CopyToInternal(Base other) { - var dest = other as StudyComponent; - - if (dest == null) - { + if(other is not StudyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Oid)UidElement.DeepCopyInternal(); - if(ImagingStudy != null) dest.ImagingStudy = (Hl7.Fhir.Model.ResourceReference)ImagingStudy.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(Series.Any()) dest.Series = new List(Series.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Oid)_UidElement.DeepCopyInternal(); + if(_ImagingStudy is not null) dest.ImagingStudy = (Hl7.Fhir.Model.ResourceReference)_ImagingStudy.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_Series is not null) dest.Series = new List(_Series.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -178,55 +174,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StudyComponent; - if(otherT == null) return false; + if(other is not StudyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(ImagingStudy, otherT.ImagingStudy)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.ListEquals(Series, otherT.Series)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_ImagingStudy, otherT._ImagingStudy)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.ListEquals(_Series, otherT._Series)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "imagingStudy": - value = ImagingStudy; - return ImagingStudy is not null; + value = _ImagingStudy; + return _ImagingStudy is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "series": - value = Series; - return Series?.Any() == true; + value = _Series; + return _Series?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Oid)value; + UidElement = (Hl7.Fhir.Model.Oid?)value; return this; case "imagingStudy": - ImagingStudy = (Hl7.Fhir.Model.ResourceReference)value; + ImagingStudy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "series": - Series = (List)value; + Series = (List?)value!; return this; default: return base.SetValue(key, value); @@ -237,10 +233,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (ImagingStudy is not null) yield return new KeyValuePair("imagingStudy",ImagingStudy); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (Series?.Any() == true) yield return new KeyValuePair("series",Series); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_ImagingStudy is not null) yield return new KeyValuePair("imagingStudy",_ImagingStudy); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_Series?.Any() == true) yield return new KeyValuePair("series",_Series); } } @@ -268,28 +264,25 @@ public partial class SeriesComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid UidElement + public Hl7.Fhir.Model.Oid? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Oid _UidElement; + private Hl7.Fhir.Model.Oid? _UidElement; /// /// Series instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Oid(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("Uid"); } } @@ -304,11 +297,11 @@ public string Uid [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// The selected instance. @@ -318,25 +311,21 @@ public List Endpoint [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; protected internal override void CopyToInternal(Base other) { - var dest = other as SeriesComponent; - - if (dest == null) - { + if(other is not SeriesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Oid)UidElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Oid)_UidElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -348,48 +337,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SeriesComponent; - if(otherT == null) return false; + if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Oid)value; + UidElement = (Hl7.Fhir.Model.Oid?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -400,9 +389,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); } } @@ -430,28 +419,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sopClass", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid SopClassElement + public Hl7.Fhir.Model.Oid? SopClassElement { get { return _SopClassElement; } set { _SopClassElement = value; OnPropertyChanged("SopClassElement"); } } - private Hl7.Fhir.Model.Oid _SopClassElement; + private Hl7.Fhir.Model.Oid? _SopClassElement; /// /// SOP class UID of instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SopClass + public string? SopClass { - get { return SopClassElement != null ? SopClassElement.Value : null; } + get => _SopClassElement?.Value; set { - if (value == null) - SopClassElement = null; - else - SopClassElement = new Hl7.Fhir.Model.Oid(value); + SopClassElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("SopClass"); } } @@ -462,44 +448,37 @@ public string SopClass [FhirElement("uid", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid UidElement + public Hl7.Fhir.Model.Oid? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Oid _UidElement; + private Hl7.Fhir.Model.Oid? _UidElement; /// /// Selected instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Oid(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("Uid"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SopClassElement != null) dest.SopClassElement = (Hl7.Fhir.Model.Oid)SopClassElement.DeepCopyInternal(); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Oid)UidElement.DeepCopyInternal(); + if(_SopClassElement is not null) dest.SopClassElement = (Hl7.Fhir.Model.Oid)_SopClassElement.DeepCopyInternal(); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Oid)_UidElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -511,41 +490,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SopClassElement, otherT.SopClassElement)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SopClassElement, otherT._SopClassElement)) return false; + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sopClass": - value = SopClassElement; - return SopClassElement is not null; + value = _SopClassElement; + return _SopClassElement is not null; case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sopClass": - SopClassElement = (Hl7.Fhir.Model.Oid)value; + SopClassElement = (Hl7.Fhir.Model.Oid?)value; return this; case "uid": - UidElement = (Hl7.Fhir.Model.Oid)value; + UidElement = (Hl7.Fhir.Model.Oid?)value; return this; default: return base.SetValue(key, value); @@ -556,8 +535,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SopClassElement is not null) yield return new KeyValuePair("sopClass",SopClassElement); - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); + if (_SopClassElement is not null) yield return new KeyValuePair("sopClass",_SopClassElement); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); } } @@ -567,13 +546,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Patient of the selected objects. @@ -583,41 +562,38 @@ public Hl7.Fhir.Model.Identifier Identifier [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Time when the selection of instances was made. /// [FhirElement("authoringTime", InSummary=true, Order=110, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoringTimeElement + public Hl7.Fhir.Model.FhirDateTime? AuthoringTimeElement { get { return _AuthoringTimeElement; } set { _AuthoringTimeElement = value; OnPropertyChanged("AuthoringTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoringTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoringTimeElement; /// /// Time when the selection of instances was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoringTime + public string? AuthoringTime { - get { return AuthoringTimeElement != null ? AuthoringTimeElement.Value : null; } + get => _AuthoringTimeElement?.Value; set { - if (value == null) - AuthoringTimeElement = null; - else - AuthoringTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoringTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoringTime"); } } @@ -629,41 +605,38 @@ public string AuthoringTime [CLSCompliant(false)] [References("Practitioner","Device","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Description text. /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -676,30 +649,26 @@ public string Description [DataMember] public List Study { - get { if(_Study==null) _Study = new List(); return _Study; } + get => _Study ?? new List(); set { _Study = value; OnPropertyChanged("Study"); } } - private List _Study; + private List? _Study; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImagingManifest; - - if (dest == null) - { + if(other is not ImagingManifest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(AuthoringTimeElement != null) dest.AuthoringTimeElement = (Hl7.Fhir.Model.FhirDateTime)AuthoringTimeElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Study.Any()) dest.Study = new List(Study.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_AuthoringTimeElement is not null) dest.AuthoringTimeElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoringTimeElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Study is not null) dest.Study = new List(_Study.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -711,69 +680,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImagingManifest; - if(otherT == null) return false; + if(other is not ImagingManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(AuthoringTimeElement, otherT.AuthoringTimeElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Study, otherT.Study)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_AuthoringTimeElement, otherT._AuthoringTimeElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Study, otherT._Study)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "authoringTime": - value = AuthoringTimeElement; - return AuthoringTimeElement is not null; + value = _AuthoringTimeElement; + return _AuthoringTimeElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "study": - value = Study; - return Study?.Any() == true; + value = _Study; + return _Study?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authoringTime": - AuthoringTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoringTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "study": - Study = (List)value; + Study = (List?)value!; return this; default: return base.SetValue(key, value); @@ -784,12 +753,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (AuthoringTimeElement is not null) yield return new KeyValuePair("authoringTime",AuthoringTimeElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Study?.Any() == true) yield return new KeyValuePair("study",Study); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_AuthoringTimeElement is not null) yield return new KeyValuePair("authoringTime",_AuthoringTimeElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Study?.Any() == true) yield return new KeyValuePair("study",_Study); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs index 83f4a5eee..c5cbcd011 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,28 +118,25 @@ public partial class SeriesComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid UidElement + public Hl7.Fhir.Model.Oid? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Oid _UidElement; + private Hl7.Fhir.Model.Oid? _UidElement; /// /// Formal DICOM identifier for this series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Oid(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("Uid"); } } @@ -146,13 +146,13 @@ public string Uid /// [FhirElement("number", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// Numeric identifier of this series @@ -161,13 +161,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -179,41 +176,38 @@ public int? Number [Binding("ImagingModality")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Modality + public Hl7.Fhir.Model.Coding? Modality { get { return _Modality; } set { _Modality = value; OnPropertyChanged("Modality"); } } - private Hl7.Fhir.Model.Coding _Modality; + private Hl7.Fhir.Model.Coding? _Modality; /// /// A short human readable summary of the series. /// [FhirElement("description", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// A short human readable summary of the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -223,13 +217,13 @@ public string Description /// [FhirElement("numberOfInstances", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Series Related Instances @@ -238,13 +232,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -256,13 +247,13 @@ public int? NumberOfInstances [DeclaredType(Type = typeof(Code))] [Binding("InstanceAvailability")] [DataMember] - public Code AvailabilityElement + public Code? AvailabilityElement { get { return _AvailabilityElement; } set { _AvailabilityElement = value; OnPropertyChanged("AvailabilityElement"); } } - private Code _AvailabilityElement; + private Code? _AvailabilityElement; /// /// ONLINE | OFFLINE | NEARLINE | UNAVAILABLE @@ -271,13 +262,10 @@ public Code AvailabilityElemen [IgnoreDataMember] public Hl7.Fhir.Model.ImagingStudy.InstanceAvailability? Availability { - get { return AvailabilityElement != null ? AvailabilityElement.Value : null; } + get => _AvailabilityElement?.Value; set { - if (value == null) - AvailabilityElement = null; - else - AvailabilityElement = new Code(value); + AvailabilityElement = value is null ? null : new Code(value); OnPropertyChanged("Availability"); } } @@ -292,11 +280,11 @@ public Hl7.Fhir.Model.ImagingStudy.InstanceAvailability? Availability [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Body part examined. @@ -304,13 +292,13 @@ public List Endpoint [FhirElement("bodySite", InSummary=true, Order=110)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.Coding BodySite + public Hl7.Fhir.Model.Coding? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.Coding _BodySite; + private Hl7.Fhir.Model.Coding? _BodySite; /// /// Body part laterality. @@ -318,41 +306,38 @@ public Hl7.Fhir.Model.Coding BodySite [FhirElement("laterality", InSummary=true, Order=120)] [Binding("Laterality")] [DataMember] - public Hl7.Fhir.Model.Coding Laterality + public Hl7.Fhir.Model.Coding? Laterality { get { return _Laterality; } set { _Laterality = value; OnPropertyChanged("Laterality"); } } - private Hl7.Fhir.Model.Coding _Laterality; + private Hl7.Fhir.Model.Coding? _Laterality; /// /// When the series started. /// [FhirElement("started", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the series started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -367,11 +352,11 @@ public string Started [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// A single SOP instance from the series. @@ -381,34 +366,30 @@ public List Performer [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; protected internal override void CopyToInternal(Base other) { - var dest = other as SeriesComponent; - - if (dest == null) - { + if(other is not SeriesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Oid)UidElement.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(Modality != null) dest.Modality = (Hl7.Fhir.Model.Coding)Modality.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(AvailabilityElement != null) dest.AvailabilityElement = (Code)AvailabilityElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.Coding)BodySite.DeepCopyInternal(); - if(Laterality != null) dest.Laterality = (Hl7.Fhir.Model.Coding)Laterality.DeepCopyInternal(); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Oid)_UidElement.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = (Hl7.Fhir.Model.Coding)_Modality.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_AvailabilityElement is not null) dest.AvailabilityElement = (Code)_AvailabilityElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.Coding)_BodySite.DeepCopyInternal(); + if(_Laterality is not null) dest.Laterality = (Hl7.Fhir.Model.Coding)_Laterality.DeepCopyInternal(); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -420,111 +401,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SeriesComponent; - if(otherT == null) return false; + if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.Equals(AvailabilityElement, otherT.AvailabilityElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Laterality, otherT.Laterality)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.Equals(_AvailabilityElement, otherT._AvailabilityElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Laterality, otherT._Laterality)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "modality": - value = Modality; - return Modality is not null; + value = _Modality; + return _Modality is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "availability": - value = AvailabilityElement; - return AvailabilityElement is not null; + value = _AvailabilityElement; + return _AvailabilityElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "laterality": - value = Laterality; - return Laterality is not null; + value = _Laterality; + return _Laterality is not null; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Oid)value; + UidElement = (Hl7.Fhir.Model.Oid?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "modality": - Modality = (Hl7.Fhir.Model.Coding)value; + Modality = (Hl7.Fhir.Model.Coding?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "availability": - AvailabilityElement = (Code)value; + AvailabilityElement = (Code?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.Coding)value; + BodySite = (Hl7.Fhir.Model.Coding?)value; return this; case "laterality": - Laterality = (Hl7.Fhir.Model.Coding)value; + Laterality = (Hl7.Fhir.Model.Coding?)value; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -535,18 +516,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Modality is not null) yield return new KeyValuePair("modality",Modality); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (AvailabilityElement is not null) yield return new KeyValuePair("availability",AvailabilityElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Laterality is not null) yield return new KeyValuePair("laterality",Laterality); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Modality is not null) yield return new KeyValuePair("modality",_Modality); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_AvailabilityElement is not null) yield return new KeyValuePair("availability",_AvailabilityElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Laterality is not null) yield return new KeyValuePair("laterality",_Laterality); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); } } @@ -573,28 +554,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid UidElement + public Hl7.Fhir.Model.Oid? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Oid _UidElement; + private Hl7.Fhir.Model.Oid? _UidElement; /// /// Formal DICOM identifier for this instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Oid(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("Uid"); } } @@ -604,13 +582,13 @@ public string Uid /// [FhirElement("number", Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// The number of this instance in the series @@ -619,13 +597,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -636,28 +611,25 @@ public int? Number [FhirElement("sopClass", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid SopClassElement + public Hl7.Fhir.Model.Oid? SopClassElement { get { return _SopClassElement; } set { _SopClassElement = value; OnPropertyChanged("SopClassElement"); } } - private Hl7.Fhir.Model.Oid _SopClassElement; + private Hl7.Fhir.Model.Oid? _SopClassElement; /// /// DICOM class type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SopClass + public string? SopClass { - get { return SopClassElement != null ? SopClassElement.Value : null; } + get => _SopClassElement?.Value; set { - if (value == null) - SopClassElement = null; - else - SopClassElement = new Hl7.Fhir.Model.Oid(value); + SopClassElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("SopClass"); } } @@ -667,46 +639,39 @@ public string SopClass /// [FhirElement("title", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Description of instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Oid)UidElement.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(SopClassElement != null) dest.SopClassElement = (Hl7.Fhir.Model.Oid)SopClassElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Oid)_UidElement.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_SopClassElement is not null) dest.SopClassElement = (Hl7.Fhir.Model.Oid)_SopClassElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -718,55 +683,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(SopClassElement, otherT.SopClassElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_SopClassElement, otherT._SopClassElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "sopClass": - value = SopClassElement; - return SopClassElement is not null; + value = _SopClassElement; + return _SopClassElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Oid)value; + UidElement = (Hl7.Fhir.Model.Oid?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "sopClass": - SopClassElement = (Hl7.Fhir.Model.Oid)value; + SopClassElement = (Hl7.Fhir.Model.Oid?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -777,10 +742,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (SopClassElement is not null) yield return new KeyValuePair("sopClass",SopClassElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_SopClassElement is not null) yield return new KeyValuePair("sopClass",_SopClassElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); } } @@ -791,28 +756,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("uid", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Oid UidElement + public Hl7.Fhir.Model.Oid? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Oid _UidElement; + private Hl7.Fhir.Model.Oid? _UidElement; /// /// Formal DICOM identifier for the study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Oid(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Oid(value); OnPropertyChanged("Uid"); } } @@ -822,13 +784,13 @@ public string Uid /// [FhirElement("accession", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Accession + public Hl7.Fhir.Model.Identifier? Accession { get { return _Accession; } set { _Accession = value; OnPropertyChanged("Accession"); } } - private Hl7.Fhir.Model.Identifier _Accession; + private Hl7.Fhir.Model.Identifier? _Accession; /// /// Other identifiers for the study. @@ -838,11 +800,11 @@ public Hl7.Fhir.Model.Identifier Accession [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// ONLINE | OFFLINE | NEARLINE | UNAVAILABLE. @@ -851,13 +813,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("InstanceAvailability")] [DataMember] - public Code AvailabilityElement + public Code? AvailabilityElement { get { return _AvailabilityElement; } set { _AvailabilityElement = value; OnPropertyChanged("AvailabilityElement"); } } - private Code _AvailabilityElement; + private Code? _AvailabilityElement; /// /// ONLINE | OFFLINE | NEARLINE | UNAVAILABLE @@ -866,13 +828,10 @@ public Code AvailabilityElemen [IgnoreDataMember] public Hl7.Fhir.Model.ImagingStudy.InstanceAvailability? Availability { - get { return AvailabilityElement != null ? AvailabilityElement.Value : null; } + get => _AvailabilityElement?.Value; set { - if (value == null) - AvailabilityElement = null; - else - AvailabilityElement = new Code(value); + AvailabilityElement = value is null ? null : new Code(value); OnPropertyChanged("Availability"); } } @@ -886,11 +845,11 @@ public Hl7.Fhir.Model.ImagingStudy.InstanceAvailability? Availability [DataMember] public List ModalityList { - get { if(_ModalityList==null) _ModalityList = new List(); return _ModalityList; } + get => _ModalityList ?? new List(); set { _ModalityList = value; OnPropertyChanged("ModalityList"); } } - private List _ModalityList; + private List? _ModalityList; /// /// Who the images are of. @@ -900,13 +859,13 @@ public List ModalityList [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Originating context. @@ -915,41 +874,38 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When the study was started. /// [FhirElement("started", InSummary=true, Order=160, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the study was started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -964,11 +920,11 @@ public string Started [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Referring physician. @@ -977,13 +933,13 @@ public List BasedOn [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referrer + public Hl7.Fhir.Model.ResourceReference? Referrer { get { return _Referrer; } set { _Referrer = value; OnPropertyChanged("Referrer"); } } - private Hl7.Fhir.Model.ResourceReference _Referrer; + private Hl7.Fhir.Model.ResourceReference? _Referrer; /// /// Who interpreted images. @@ -995,11 +951,11 @@ public Hl7.Fhir.Model.ResourceReference Referrer [DataMember] public List Interpreter { - get { if(_Interpreter==null) _Interpreter = new List(); return _Interpreter; } + get => _Interpreter ?? new List(); set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } - private List _Interpreter; + private List? _Interpreter; /// /// Study access endpoint. @@ -1011,24 +967,24 @@ public List Interpreter [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Number of Study Related Series. /// [FhirElement("numberOfSeries", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfSeriesElement { get { return _NumberOfSeriesElement; } set { _NumberOfSeriesElement = value; OnPropertyChanged("NumberOfSeriesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfSeriesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfSeriesElement; /// /// Number of Study Related Series @@ -1037,13 +993,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement [IgnoreDataMember] public int? NumberOfSeries { - get { return NumberOfSeriesElement != null ? NumberOfSeriesElement.Value : null; } + get => _NumberOfSeriesElement?.Value; set { - if (value == null) - NumberOfSeriesElement = null; - else - NumberOfSeriesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfSeriesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfSeries"); } } @@ -1053,13 +1006,13 @@ public int? NumberOfSeries /// [FhirElement("numberOfInstances", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Study Related Instances @@ -1068,13 +1021,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -1089,11 +1039,11 @@ public int? NumberOfInstances [DataMember] public List ProcedureReference { - get { if(_ProcedureReference==null) _ProcedureReference = new List(); return _ProcedureReference; } + get => _ProcedureReference ?? new List(); set { _ProcedureReference = value; OnPropertyChanged("ProcedureReference"); } } - private List _ProcedureReference; + private List? _ProcedureReference; /// /// The performed procedure code. @@ -1104,11 +1054,11 @@ public List ProcedureReference [DataMember] public List ProcedureCode { - get { if(_ProcedureCode==null) _ProcedureCode = new List(); return _ProcedureCode; } + get => _ProcedureCode ?? new List(); set { _ProcedureCode = value; OnPropertyChanged("ProcedureCode"); } } - private List _ProcedureCode; + private List? _ProcedureCode; /// /// Why the study was requested. @@ -1116,41 +1066,38 @@ public List ProcedureCode [FhirElement("reason", InSummary=true, Order=250, FiveWs="why")] [Binding("ImagingReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Institution-generated description. /// [FhirElement("description", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Institution-generated description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1163,43 +1110,39 @@ public string Description [DataMember] public List Series { - get { if(_Series==null) _Series = new List(); return _Series; } + get => _Series ?? new List(); set { _Series = value; OnPropertyChanged("Series"); } } - private List _Series; + private List? _Series; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImagingStudy; - - if (dest == null) - { + if(other is not ImagingStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Oid)UidElement.DeepCopyInternal(); - if(Accession != null) dest.Accession = (Hl7.Fhir.Model.Identifier)Accession.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(AvailabilityElement != null) dest.AvailabilityElement = (Code)AvailabilityElement.DeepCopyInternal(); - if(ModalityList.Any()) dest.ModalityList = new List(ModalityList.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Referrer != null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)Referrer.DeepCopyInternal(); - if(Interpreter.Any()) dest.Interpreter = new List(Interpreter.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(NumberOfSeriesElement != null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfSeriesElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(ProcedureReference.Any()) dest.ProcedureReference = new List(ProcedureReference.DeepCopyInternal()); - if(ProcedureCode.Any()) dest.ProcedureCode = new List(ProcedureCode.DeepCopyInternal()); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Series.Any()) dest.Series = new List(Series.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Oid)_UidElement.DeepCopyInternal(); + if(_Accession is not null) dest.Accession = (Hl7.Fhir.Model.Identifier)_Accession.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_AvailabilityElement is not null) dest.AvailabilityElement = (Code)_AvailabilityElement.DeepCopyInternal(); + if(_ModalityList is not null) dest.ModalityList = new List(_ModalityList.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Referrer is not null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)_Referrer.DeepCopyInternal(); + if(_Interpreter is not null) dest.Interpreter = new List(_Interpreter.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_NumberOfSeriesElement is not null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfSeriesElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_ProcedureReference is not null) dest.ProcedureReference = new List(_ProcedureReference.DeepCopyInternal()); + if(_ProcedureCode is not null) dest.ProcedureCode = new List(_ProcedureCode.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Series is not null) dest.Series = new List(_Series.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1211,160 +1154,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImagingStudy; - if(otherT == null) return false; + if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(Accession, otherT.Accession)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(AvailabilityElement, otherT.AvailabilityElement)) return false; - if(!comparer.ListEquals(ModalityList, otherT.ModalityList)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Referrer, otherT.Referrer)) return false; - if(!comparer.ListEquals(Interpreter, otherT.Interpreter)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(NumberOfSeriesElement, otherT.NumberOfSeriesElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.ListEquals(ProcedureReference, otherT.ProcedureReference)) return false; - if(!comparer.ListEquals(ProcedureCode, otherT.ProcedureCode)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Series, otherT.Series)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_Accession, otherT._Accession)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_AvailabilityElement, otherT._AvailabilityElement)) return false; + if(!comparer.ListEquals(_ModalityList, otherT._ModalityList)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Referrer, otherT._Referrer)) return false; + if(!comparer.ListEquals(_Interpreter, otherT._Interpreter)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_NumberOfSeriesElement, otherT._NumberOfSeriesElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.ListEquals(_ProcedureReference, otherT._ProcedureReference)) return false; + if(!comparer.ListEquals(_ProcedureCode, otherT._ProcedureCode)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Series, otherT._Series)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "accession": - value = Accession; - return Accession is not null; + value = _Accession; + return _Accession is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "availability": - value = AvailabilityElement; - return AvailabilityElement is not null; + value = _AvailabilityElement; + return _AvailabilityElement is not null; case "modalityList": - value = ModalityList; - return ModalityList?.Any() == true; + value = _ModalityList; + return _ModalityList?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "referrer": - value = Referrer; - return Referrer is not null; + value = _Referrer; + return _Referrer is not null; case "interpreter": - value = Interpreter; - return Interpreter?.Any() == true; + value = _Interpreter; + return _Interpreter?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "numberOfSeries": - value = NumberOfSeriesElement; - return NumberOfSeriesElement is not null; + value = _NumberOfSeriesElement; + return _NumberOfSeriesElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "procedureReference": - value = ProcedureReference; - return ProcedureReference?.Any() == true; + value = _ProcedureReference; + return _ProcedureReference?.Any() == true; case "procedureCode": - value = ProcedureCode; - return ProcedureCode?.Any() == true; + value = _ProcedureCode; + return _ProcedureCode?.Any() == true; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = Series; - return Series?.Any() == true; + value = _Series; + return _Series?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Oid)value; + UidElement = (Hl7.Fhir.Model.Oid?)value; return this; case "accession": - Accession = (Hl7.Fhir.Model.Identifier)value; + Accession = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "availability": - AvailabilityElement = (Code)value; + AvailabilityElement = (Code?)value; return this; case "modalityList": - ModalityList = (List)value; + ModalityList = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "referrer": - Referrer = (Hl7.Fhir.Model.ResourceReference)value; + Referrer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "interpreter": - Interpreter = (List)value; + Interpreter = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "numberOfSeries": - NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "procedureReference": - ProcedureReference = (List)value; + ProcedureReference = (List?)value!; return this; case "procedureCode": - ProcedureCode = (List)value; + ProcedureCode = (List?)value!; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - Series = (List)value; + Series = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1375,25 +1318,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (Accession is not null) yield return new KeyValuePair("accession",Accession); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (AvailabilityElement is not null) yield return new KeyValuePair("availability",AvailabilityElement); - if (ModalityList?.Any() == true) yield return new KeyValuePair("modalityList",ModalityList); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Referrer is not null) yield return new KeyValuePair("referrer",Referrer); - if (Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",Interpreter); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",NumberOfSeriesElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (ProcedureReference?.Any() == true) yield return new KeyValuePair("procedureReference",ProcedureReference); - if (ProcedureCode?.Any() == true) yield return new KeyValuePair("procedureCode",ProcedureCode); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Series?.Any() == true) yield return new KeyValuePair("series",Series); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_Accession is not null) yield return new KeyValuePair("accession",_Accession); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_AvailabilityElement is not null) yield return new KeyValuePair("availability",_AvailabilityElement); + if (_ModalityList?.Any() == true) yield return new KeyValuePair("modalityList",_ModalityList); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Referrer is not null) yield return new KeyValuePair("referrer",_Referrer); + if (_Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",_Interpreter); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",_NumberOfSeriesElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_ProcedureReference?.Any() == true) yield return new KeyValuePair("procedureReference",_ProcedureReference); + if (_ProcedureCode?.Any() == true) yield return new KeyValuePair("procedureCode",_ProcedureCode); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Series?.Any() == true) yield return new KeyValuePair("series",_Series); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs b/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs index e2561680d..d2a61d98b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -103,13 +106,13 @@ public partial class PractitionerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("role", InSummary=true, Order=40)] [Binding("ImmunizationRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Individual who was performing. @@ -119,26 +122,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Practitioner")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PractitionerComponent; - - if (dest == null) - { + if(other is not PractitionerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -150,41 +149,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PractitionerComponent; - if(otherT == null) return false; + if(other is not PractitionerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -195,8 +194,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -226,11 +225,11 @@ public partial class ExplanationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Why immunization did not occur. @@ -241,24 +240,20 @@ public List Reason [DataMember] public List ReasonNotGiven { - get { if(_ReasonNotGiven==null) _ReasonNotGiven = new List(); return _ReasonNotGiven; } + get => _ReasonNotGiven ?? new List(); set { _ReasonNotGiven = value; OnPropertyChanged("ReasonNotGiven"); } } - private List _ReasonNotGiven; + private List? _ReasonNotGiven; protected internal override void CopyToInternal(Base other) { - var dest = other as ExplanationComponent; - - if (dest == null) - { + if(other is not ExplanationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(ReasonNotGiven.Any()) dest.ReasonNotGiven = new List(ReasonNotGiven.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_ReasonNotGiven is not null) dest.ReasonNotGiven = new List(_ReasonNotGiven.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -270,41 +265,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExplanationComponent; - if(otherT == null) return false; + if(other is not ExplanationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(ReasonNotGiven, otherT.ReasonNotGiven)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_ReasonNotGiven, otherT._ReasonNotGiven)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "reasonNotGiven": - value = ReasonNotGiven; - return ReasonNotGiven?.Any() == true; + value = _ReasonNotGiven; + return _ReasonNotGiven?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "reasonNotGiven": - ReasonNotGiven = (List)value; + ReasonNotGiven = (List?)value!; return this; default: return base.SetValue(key, value); @@ -315,8 +310,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (ReasonNotGiven?.Any() == true) yield return new KeyValuePair("reasonNotGiven",ReasonNotGiven); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_ReasonNotGiven?.Any() == true) yield return new KeyValuePair("reasonNotGiven",_ReasonNotGiven); } } @@ -343,28 +338,25 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When reaction started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -376,26 +368,26 @@ public string Date [CLSCompliant(false)] [References("Observation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Detail + public Hl7.Fhir.Model.ResourceReference? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.ResourceReference _Detail; + private Hl7.Fhir.Model.ResourceReference? _Detail; /// /// Indicates self-reported reaction. /// [FhirElement("reported", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReportedElement + public Hl7.Fhir.Model.FhirBoolean? ReportedElement { get { return _ReportedElement; } set { _ReportedElement = value; OnPropertyChanged("ReportedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReportedElement; + private Hl7.Fhir.Model.FhirBoolean? _ReportedElement; /// /// Indicates self-reported reaction @@ -404,30 +396,23 @@ public Hl7.Fhir.Model.FhirBoolean ReportedElement [IgnoreDataMember] public bool? Reported { - get { return ReportedElement != null ? ReportedElement.Value : null; } + get => _ReportedElement?.Value; set { - if (value == null) - ReportedElement = null; - else - ReportedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReportedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Reported"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.ResourceReference)Detail.DeepCopyInternal(); - if(ReportedElement != null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)ReportedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.ResourceReference)_Detail.DeepCopyInternal(); + if(_ReportedElement is not null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)_ReportedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -439,48 +424,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(ReportedElement, otherT.ReportedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "reported": - value = ReportedElement; - return ReportedElement is not null; + value = _ReportedElement; + return _ReportedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.ResourceReference)value; + Detail = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reported": - ReportedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReportedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -491,9 +476,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (ReportedElement is not null) yield return new KeyValuePair("reported",ReportedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_ReportedElement is not null) yield return new KeyValuePair("reported",_ReportedElement); } } @@ -519,13 +504,13 @@ public partial class VaccinationProtocolComponent : Hl7.Fhir.Model.BackboneEleme /// [FhirElement("doseSequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DoseSequenceElement + public Hl7.Fhir.Model.PositiveInt? DoseSequenceElement { get { return _DoseSequenceElement; } set { _DoseSequenceElement = value; OnPropertyChanged("DoseSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DoseSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DoseSequenceElement; /// /// Dose number within series @@ -534,13 +519,10 @@ public Hl7.Fhir.Model.PositiveInt DoseSequenceElement [IgnoreDataMember] public int? DoseSequence { - get { return DoseSequenceElement != null ? DoseSequenceElement.Value : null; } + get => _DoseSequenceElement?.Value; set { - if (value == null) - DoseSequenceElement = null; - else - DoseSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DoseSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DoseSequence"); } } @@ -550,28 +532,25 @@ public int? DoseSequence /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Details of vaccine protocol /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -583,41 +562,38 @@ public string Description [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Name of vaccine series. /// [FhirElement("series", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccine series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -627,13 +603,13 @@ public string Series /// [FhirElement("seriesDoses", Order=80)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SeriesDosesElement + public Hl7.Fhir.Model.PositiveInt? SeriesDosesElement { get { return _SeriesDosesElement; } set { _SeriesDosesElement = value; OnPropertyChanged("SeriesDosesElement"); } } - private Hl7.Fhir.Model.PositiveInt _SeriesDosesElement; + private Hl7.Fhir.Model.PositiveInt? _SeriesDosesElement; /// /// Recommended number of doses for immunity @@ -642,13 +618,10 @@ public Hl7.Fhir.Model.PositiveInt SeriesDosesElement [IgnoreDataMember] public int? SeriesDoses { - get { return SeriesDosesElement != null ? SeriesDosesElement.Value : null; } + get => _SeriesDosesElement?.Value; set { - if (value == null) - SeriesDosesElement = null; - else - SeriesDosesElement = new Hl7.Fhir.Model.PositiveInt(value); + SeriesDosesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SeriesDoses"); } } @@ -662,11 +635,11 @@ public int? SeriesDoses [DataMember] public List TargetDisease { - get { if(_TargetDisease==null) _TargetDisease = new List(); return _TargetDisease; } + get => _TargetDisease ?? new List(); set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private List _TargetDisease; + private List? _TargetDisease; /// /// Indicates if dose counts towards immunity. @@ -675,13 +648,13 @@ public List TargetDisease [Binding("VaccinationProtocolDoseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseStatus + public Hl7.Fhir.Model.CodeableConcept? DoseStatus { get { return _DoseStatus; } set { _DoseStatus = value; OnPropertyChanged("DoseStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseStatus; + private Hl7.Fhir.Model.CodeableConcept? _DoseStatus; /// /// Why dose does (not) count. @@ -689,32 +662,28 @@ public Hl7.Fhir.Model.CodeableConcept DoseStatus [FhirElement("doseStatusReason", Order=110)] [Binding("VaccinationProtocolDoseStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseStatusReason + public Hl7.Fhir.Model.CodeableConcept? DoseStatusReason { get { return _DoseStatusReason; } set { _DoseStatusReason = value; OnPropertyChanged("DoseStatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseStatusReason; + private Hl7.Fhir.Model.CodeableConcept? _DoseStatusReason; protected internal override void CopyToInternal(Base other) { - var dest = other as VaccinationProtocolComponent; - - if (dest == null) - { + if(other is not VaccinationProtocolComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DoseSequenceElement != null) dest.DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt)DoseSequenceElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(SeriesDosesElement != null) dest.SeriesDosesElement = (Hl7.Fhir.Model.PositiveInt)SeriesDosesElement.DeepCopyInternal(); - if(TargetDisease.Any()) dest.TargetDisease = new List(TargetDisease.DeepCopyInternal()); - if(DoseStatus != null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)DoseStatus.DeepCopyInternal(); - if(DoseStatusReason != null) dest.DoseStatusReason = (Hl7.Fhir.Model.CodeableConcept)DoseStatusReason.DeepCopyInternal(); + if(_DoseSequenceElement is not null) dest.DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DoseSequenceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_SeriesDosesElement is not null) dest.SeriesDosesElement = (Hl7.Fhir.Model.PositiveInt)_SeriesDosesElement.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = new List(_TargetDisease.DeepCopyInternal()); + if(_DoseStatus is not null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)_DoseStatus.DeepCopyInternal(); + if(_DoseStatusReason is not null) dest.DoseStatusReason = (Hl7.Fhir.Model.CodeableConcept)_DoseStatusReason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -726,83 +695,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VaccinationProtocolComponent; - if(otherT == null) return false; + if(other is not VaccinationProtocolComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DoseSequenceElement, otherT.DoseSequenceElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(SeriesDosesElement, otherT.SeriesDosesElement)) return false; - if(!comparer.ListEquals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(DoseStatus, otherT.DoseStatus)) return false; - if(!comparer.Equals(DoseStatusReason, otherT.DoseStatusReason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoseSequenceElement, otherT._DoseSequenceElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_SeriesDosesElement, otherT._SeriesDosesElement)) return false; + if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_DoseStatus, otherT._DoseStatus)) return false; + if(!comparer.Equals(_DoseStatusReason, otherT._DoseStatusReason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "doseSequence": - value = DoseSequenceElement; - return DoseSequenceElement is not null; + value = _DoseSequenceElement; + return _DoseSequenceElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "seriesDoses": - value = SeriesDosesElement; - return SeriesDosesElement is not null; + value = _SeriesDosesElement; + return _SeriesDosesElement is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease?.Any() == true; + value = _TargetDisease; + return _TargetDisease?.Any() == true; case "doseStatus": - value = DoseStatus; - return DoseStatus is not null; + value = _DoseStatus; + return _DoseStatus is not null; case "doseStatusReason": - value = DoseStatusReason; - return DoseStatusReason is not null; + value = _DoseStatusReason; + return _DoseStatusReason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "doseSequence": - DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "seriesDoses": - SeriesDosesElement = (Hl7.Fhir.Model.PositiveInt)value; + SeriesDosesElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "targetDisease": - TargetDisease = (List)value; + TargetDisease = (List?)value!; return this; case "doseStatus": - DoseStatus = (Hl7.Fhir.Model.CodeableConcept)value; + DoseStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseStatusReason": - DoseStatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + DoseStatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -813,14 +782,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DoseSequenceElement is not null) yield return new KeyValuePair("doseSequence",DoseSequenceElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",SeriesDosesElement); - if (TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",TargetDisease); - if (DoseStatus is not null) yield return new KeyValuePair("doseStatus",DoseStatus); - if (DoseStatusReason is not null) yield return new KeyValuePair("doseStatusReason",DoseStatusReason); + if (_DoseSequenceElement is not null) yield return new KeyValuePair("doseSequence",_DoseSequenceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",_SeriesDosesElement); + if (_TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_DoseStatus is not null) yield return new KeyValuePair("doseStatus",_DoseStatus); + if (_DoseStatusReason is not null) yield return new KeyValuePair("doseStatusReason",_DoseStatusReason); } } @@ -833,11 +802,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// completed | entered-in-error. @@ -847,13 +816,13 @@ public List Identifier [Binding("ImmunizationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | entered-in-error @@ -862,13 +831,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -879,13 +845,13 @@ public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status [FhirElement("notGiven", InSummary=true, IsModifier=true, Order=110, FiveWs="status")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NotGivenElement + public Hl7.Fhir.Model.FhirBoolean? NotGivenElement { get { return _NotGivenElement; } set { _NotGivenElement = value; OnPropertyChanged("NotGivenElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NotGivenElement; + private Hl7.Fhir.Model.FhirBoolean? _NotGivenElement; /// /// Flag for whether immunization was given @@ -894,13 +860,10 @@ public Hl7.Fhir.Model.FhirBoolean NotGivenElement [IgnoreDataMember] public bool? NotGiven { - get { return NotGivenElement != null ? NotGivenElement.Value : null; } + get => _NotGivenElement?.Value; set { - if (value == null) - NotGivenElement = null; - else - NotGivenElement = new Hl7.Fhir.Model.FhirBoolean(value); + NotGivenElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NotGiven"); } } @@ -912,13 +875,13 @@ public bool? NotGiven [Binding("VaccineCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VaccineCode + public Hl7.Fhir.Model.CodeableConcept? VaccineCode { get { return _VaccineCode; } set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private Hl7.Fhir.Model.CodeableConcept _VaccineCode; + private Hl7.Fhir.Model.CodeableConcept? _VaccineCode; /// /// Who was immunized. @@ -928,13 +891,13 @@ public Hl7.Fhir.Model.CodeableConcept VaccineCode [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter administered as part of. @@ -943,41 +906,38 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Vaccination administration date. /// [FhirElement("date", Order=150, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Vaccination administration date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -988,13 +948,13 @@ public string Date [FhirElement("primarySource", Order=160, FiveWs="who.source")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement + public Hl7.Fhir.Model.FhirBoolean? PrimarySourceElement { get { return _PrimarySourceElement; } set { _PrimarySourceElement = value; OnPropertyChanged("PrimarySourceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PrimarySourceElement; + private Hl7.Fhir.Model.FhirBoolean? _PrimarySourceElement; /// /// Indicates context the data was recorded in @@ -1003,13 +963,10 @@ public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement [IgnoreDataMember] public bool? PrimarySource { - get { return PrimarySourceElement != null ? PrimarySourceElement.Value : null; } + get => _PrimarySourceElement?.Value; set { - if (value == null) - PrimarySourceElement = null; - else - PrimarySourceElement = new Hl7.Fhir.Model.FhirBoolean(value); + PrimarySourceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("PrimarySource"); } } @@ -1020,13 +977,13 @@ public bool? PrimarySource [FhirElement("reportOrigin", Order=170, FiveWs="who.source")] [Binding("ImmunizationReportOrigin")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReportOrigin + public Hl7.Fhir.Model.CodeableConcept? ReportOrigin { get { return _ReportOrigin; } set { _ReportOrigin = value; OnPropertyChanged("ReportOrigin"); } } - private Hl7.Fhir.Model.CodeableConcept _ReportOrigin; + private Hl7.Fhir.Model.CodeableConcept? _ReportOrigin; /// /// Where vaccination occurred. @@ -1035,13 +992,13 @@ public Hl7.Fhir.Model.CodeableConcept ReportOrigin [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Vaccine manufacturer. @@ -1050,41 +1007,38 @@ public Hl7.Fhir.Model.ResourceReference Location [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// Vaccine lot number. /// [FhirElement("lotNumber", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Vaccine lot number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -1094,28 +1048,25 @@ public string LotNumber /// [FhirElement("expirationDate", Order=210)] [DataMember] - public Hl7.Fhir.Model.Date ExpirationDateElement + public Hl7.Fhir.Model.Date? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.Date _ExpirationDateElement; + private Hl7.Fhir.Model.Date? _ExpirationDateElement; /// /// Vaccine expiration date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.Date(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ExpirationDate"); } } @@ -1126,13 +1077,13 @@ public string ExpirationDate [FhirElement("site", Order=220)] [Binding("ImmunizationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How vaccine entered body. @@ -1140,26 +1091,26 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=230)] [Binding("ImmunizationRoute")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Amount of vaccine administered. /// [FhirElement("doseQuantity", Order=240)] [DataMember] - public Hl7.Fhir.Model.Quantity DoseQuantity + public Hl7.Fhir.Model.Quantity? DoseQuantity { get { return _DoseQuantity; } set { _DoseQuantity = value; OnPropertyChanged("DoseQuantity"); } } - private Hl7.Fhir.Model.Quantity _DoseQuantity; + private Hl7.Fhir.Model.Quantity? _DoseQuantity; /// /// Who performed event. @@ -1169,11 +1120,11 @@ public Hl7.Fhir.Model.Quantity DoseQuantity [DataMember] public List Practitioner { - get { if(_Practitioner==null) _Practitioner = new List(); return _Practitioner; } + get => _Practitioner ?? new List(); set { _Practitioner = value; OnPropertyChanged("Practitioner"); } } - private List _Practitioner; + private List? _Practitioner; /// /// Vaccination notes. @@ -1183,24 +1134,24 @@ public List Practitioner [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Administration/non-administration reasons. /// [FhirElement("explanation", Order=270)] [DataMember] - public Hl7.Fhir.Model.Immunization.ExplanationComponent Explanation + public Hl7.Fhir.Model.Immunization.ExplanationComponent? Explanation { get { return _Explanation; } set { _Explanation = value; OnPropertyChanged("Explanation"); } } - private Hl7.Fhir.Model.Immunization.ExplanationComponent _Explanation; + private Hl7.Fhir.Model.Immunization.ExplanationComponent? _Explanation; /// /// Details of a reaction that follows immunization. @@ -1210,11 +1161,11 @@ public Hl7.Fhir.Model.Immunization.ExplanationComponent Explanation [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; /// /// What protocol was followed. @@ -1224,45 +1175,41 @@ public List Reaction [DataMember] public List VaccinationProtocol { - get { if(_VaccinationProtocol==null) _VaccinationProtocol = new List(); return _VaccinationProtocol; } + get => _VaccinationProtocol ?? new List(); set { _VaccinationProtocol = value; OnPropertyChanged("VaccinationProtocol"); } } - private List _VaccinationProtocol; + private List? _VaccinationProtocol; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Immunization; - - if (dest == null) - { + if(other is not Immunization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(NotGivenElement != null) dest.NotGivenElement = (Hl7.Fhir.Model.FhirBoolean)NotGivenElement.DeepCopyInternal(); - if(VaccineCode != null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)VaccineCode.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PrimarySourceElement != null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)PrimarySourceElement.DeepCopyInternal(); - if(ReportOrigin != null) dest.ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)ReportOrigin.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)ExpirationDateElement.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(DoseQuantity != null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)DoseQuantity.DeepCopyInternal(); - if(Practitioner.Any()) dest.Practitioner = new List(Practitioner.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Explanation != null) dest.Explanation = (Hl7.Fhir.Model.Immunization.ExplanationComponent)Explanation.DeepCopyInternal(); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); - if(VaccinationProtocol.Any()) dest.VaccinationProtocol = new List(VaccinationProtocol.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_NotGivenElement is not null) dest.NotGivenElement = (Hl7.Fhir.Model.FhirBoolean)_NotGivenElement.DeepCopyInternal(); + if(_VaccineCode is not null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)_VaccineCode.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PrimarySourceElement is not null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)_PrimarySourceElement.DeepCopyInternal(); + if(_ReportOrigin is not null) dest.ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)_ReportOrigin.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)_ExpirationDateElement.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_DoseQuantity is not null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)_DoseQuantity.DeepCopyInternal(); + if(_Practitioner is not null) dest.Practitioner = new List(_Practitioner.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Explanation is not null) dest.Explanation = (Hl7.Fhir.Model.Immunization.ExplanationComponent)_Explanation.DeepCopyInternal(); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); + if(_VaccinationProtocol is not null) dest.VaccinationProtocol = new List(_VaccinationProtocol.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1274,174 +1221,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Immunization; - if(otherT == null) return false; + if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(NotGivenElement, otherT.NotGivenElement)) return false; - if(!comparer.Equals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PrimarySourceElement, otherT.PrimarySourceElement)) return false; - if(!comparer.Equals(ReportOrigin, otherT.ReportOrigin)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(DoseQuantity, otherT.DoseQuantity)) return false; - if(!comparer.ListEquals(Practitioner, otherT.Practitioner)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Explanation, otherT.Explanation)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; - if(!comparer.ListEquals(VaccinationProtocol, otherT.VaccinationProtocol)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_NotGivenElement, otherT._NotGivenElement)) return false; + if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PrimarySourceElement, otherT._PrimarySourceElement)) return false; + if(!comparer.Equals(_ReportOrigin, otherT._ReportOrigin)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_DoseQuantity, otherT._DoseQuantity)) return false; + if(!comparer.ListEquals(_Practitioner, otherT._Practitioner)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Explanation, otherT._Explanation)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; + if(!comparer.ListEquals(_VaccinationProtocol, otherT._VaccinationProtocol)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "notGiven": - value = NotGivenElement; - return NotGivenElement is not null; + value = _NotGivenElement; + return _NotGivenElement is not null; case "vaccineCode": - value = VaccineCode; - return VaccineCode is not null; + value = _VaccineCode; + return _VaccineCode is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "primarySource": - value = PrimarySourceElement; - return PrimarySourceElement is not null; + value = _PrimarySourceElement; + return _PrimarySourceElement is not null; case "reportOrigin": - value = ReportOrigin; - return ReportOrigin is not null; + value = _ReportOrigin; + return _ReportOrigin is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "doseQuantity": - value = DoseQuantity; - return DoseQuantity is not null; + value = _DoseQuantity; + return _DoseQuantity is not null; case "practitioner": - value = Practitioner; - return Practitioner?.Any() == true; + value = _Practitioner; + return _Practitioner?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "explanation": - value = Explanation; - return Explanation is not null; + value = _Explanation; + return _Explanation is not null; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; case "vaccinationProtocol": - value = VaccinationProtocol; - return VaccinationProtocol?.Any() == true; + value = _VaccinationProtocol; + return _VaccinationProtocol?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "notGiven": - NotGivenElement = (Hl7.Fhir.Model.FhirBoolean)value; + NotGivenElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "vaccineCode": - VaccineCode = (Hl7.Fhir.Model.CodeableConcept)value; + VaccineCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "primarySource": - PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)value; + PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reportOrigin": - ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)value; + ReportOrigin = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.Date)value; + ExpirationDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseQuantity": - DoseQuantity = (Hl7.Fhir.Model.Quantity)value; + DoseQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "practitioner": - Practitioner = (List)value; + Practitioner = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "explanation": - Explanation = (Hl7.Fhir.Model.Immunization.ExplanationComponent)value; + Explanation = (Hl7.Fhir.Model.Immunization.ExplanationComponent?)value; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; case "vaccinationProtocol": - VaccinationProtocol = (List)value; + VaccinationProtocol = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1452,27 +1399,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (NotGivenElement is not null) yield return new KeyValuePair("notGiven",NotGivenElement); - if (VaccineCode is not null) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",PrimarySourceElement); - if (ReportOrigin is not null) yield return new KeyValuePair("reportOrigin",ReportOrigin); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",DoseQuantity); - if (Practitioner?.Any() == true) yield return new KeyValuePair("practitioner",Practitioner); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Explanation is not null) yield return new KeyValuePair("explanation",Explanation); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); - if (VaccinationProtocol?.Any() == true) yield return new KeyValuePair("vaccinationProtocol",VaccinationProtocol); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_NotGivenElement is not null) yield return new KeyValuePair("notGiven",_NotGivenElement); + if (_VaccineCode is not null) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",_PrimarySourceElement); + if (_ReportOrigin is not null) yield return new KeyValuePair("reportOrigin",_ReportOrigin); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",_DoseQuantity); + if (_Practitioner?.Any() == true) yield return new KeyValuePair("practitioner",_Practitioner); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Explanation is not null) yield return new KeyValuePair("explanation",_Explanation); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); + if (_VaccinationProtocol?.Any() == true) yield return new KeyValuePair("vaccinationProtocol",_VaccinationProtocol); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs index 1fef5ef39..d8a68d89f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,28 +81,25 @@ public partial class RecommendationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("date", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date recommendation created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -110,13 +110,13 @@ public string Date [FhirElement("vaccineCode", InSummary=true, Order=50)] [Binding("VaccineCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VaccineCode + public Hl7.Fhir.Model.CodeableConcept? VaccineCode { get { return _VaccineCode; } set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private Hl7.Fhir.Model.CodeableConcept _VaccineCode; + private Hl7.Fhir.Model.CodeableConcept? _VaccineCode; /// /// Disease to be immunized against. @@ -124,26 +124,26 @@ public Hl7.Fhir.Model.CodeableConcept VaccineCode [FhirElement("targetDisease", InSummary=true, Order=60)] [Binding("TargetDisease")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TargetDisease + public Hl7.Fhir.Model.CodeableConcept? TargetDisease { get { return _TargetDisease; } set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private Hl7.Fhir.Model.CodeableConcept _TargetDisease; + private Hl7.Fhir.Model.CodeableConcept? _TargetDisease; /// /// Recommended dose number. /// [FhirElement("doseNumber", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DoseNumberElement + public Hl7.Fhir.Model.PositiveInt? DoseNumberElement { get { return _DoseNumberElement; } set { _DoseNumberElement = value; OnPropertyChanged("DoseNumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _DoseNumberElement; + private Hl7.Fhir.Model.PositiveInt? _DoseNumberElement; /// /// Recommended dose number @@ -152,13 +152,10 @@ public Hl7.Fhir.Model.PositiveInt DoseNumberElement [IgnoreDataMember] public int? DoseNumber { - get { return DoseNumberElement != null ? DoseNumberElement.Value : null; } + get => _DoseNumberElement?.Value; set { - if (value == null) - DoseNumberElement = null; - else - DoseNumberElement = new Hl7.Fhir.Model.PositiveInt(value); + DoseNumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DoseNumber"); } } @@ -170,13 +167,13 @@ public int? DoseNumber [Binding("ImmunizationRecommendationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ForecastStatus + public Hl7.Fhir.Model.CodeableConcept? ForecastStatus { get { return _ForecastStatus; } set { _ForecastStatus = value; OnPropertyChanged("ForecastStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ForecastStatus; + private Hl7.Fhir.Model.CodeableConcept? _ForecastStatus; /// /// Dates governing proposed immunization. @@ -186,24 +183,24 @@ public Hl7.Fhir.Model.CodeableConcept ForecastStatus [DataMember] public List DateCriterion { - get { if(_DateCriterion==null) _DateCriterion = new List(); return _DateCriterion; } + get => _DateCriterion ?? new List(); set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } - private List _DateCriterion; + private List? _DateCriterion; /// /// Protocol used by recommendation. /// [FhirElement("protocol", Order=100)] [DataMember] - public Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent Protocol + public Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent? Protocol { get { return _Protocol; } set { _Protocol = value; OnPropertyChanged("Protocol"); } } - private Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent _Protocol; + private Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent? _Protocol; /// /// Past immunizations supporting recommendation. @@ -215,11 +212,11 @@ public Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent Protocol [DataMember] public List SupportingImmunization { - get { if(_SupportingImmunization==null) _SupportingImmunization = new List(); return _SupportingImmunization; } + get => _SupportingImmunization ?? new List(); set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } - private List _SupportingImmunization; + private List? _SupportingImmunization; /// /// Patient observations supporting recommendation. @@ -231,31 +228,27 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get { if(_SupportingPatientInformation==null) _SupportingPatientInformation = new List(); return _SupportingPatientInformation; } + get => _SupportingPatientInformation ?? new List(); set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } - private List _SupportingPatientInformation; + private List? _SupportingPatientInformation; protected internal override void CopyToInternal(Base other) { - var dest = other as RecommendationComponent; - - if (dest == null) - { + if(other is not RecommendationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(VaccineCode != null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)VaccineCode.DeepCopyInternal(); - if(TargetDisease != null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopyInternal(); - if(DoseNumberElement != null) dest.DoseNumberElement = (Hl7.Fhir.Model.PositiveInt)DoseNumberElement.DeepCopyInternal(); - if(ForecastStatus != null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)ForecastStatus.DeepCopyInternal(); - if(DateCriterion.Any()) dest.DateCriterion = new List(DateCriterion.DeepCopyInternal()); - if(Protocol != null) dest.Protocol = (Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent)Protocol.DeepCopyInternal(); - if(SupportingImmunization.Any()) dest.SupportingImmunization = new List(SupportingImmunization.DeepCopyInternal()); - if(SupportingPatientInformation.Any()) dest.SupportingPatientInformation = new List(SupportingPatientInformation.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_VaccineCode is not null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)_VaccineCode.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)_TargetDisease.DeepCopyInternal(); + if(_DoseNumberElement is not null) dest.DoseNumberElement = (Hl7.Fhir.Model.PositiveInt)_DoseNumberElement.DeepCopyInternal(); + if(_ForecastStatus is not null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)_ForecastStatus.DeepCopyInternal(); + if(_DateCriterion is not null) dest.DateCriterion = new List(_DateCriterion.DeepCopyInternal()); + if(_Protocol is not null) dest.Protocol = (Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent)_Protocol.DeepCopyInternal(); + if(_SupportingImmunization is not null) dest.SupportingImmunization = new List(_SupportingImmunization.DeepCopyInternal()); + if(_SupportingPatientInformation is not null) dest.SupportingPatientInformation = new List(_SupportingPatientInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -267,90 +260,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RecommendationComponent; - if(otherT == null) return false; + if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.Equals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(DoseNumberElement, otherT.DoseNumberElement)) return false; - if(!comparer.Equals(ForecastStatus, otherT.ForecastStatus)) return false; - if(!comparer.ListEquals(DateCriterion, otherT.DateCriterion)) return false; - if(!comparer.Equals(Protocol, otherT.Protocol)) return false; - if(!comparer.ListEquals(SupportingImmunization, otherT.SupportingImmunization)) return false; - if(!comparer.ListEquals(SupportingPatientInformation, otherT.SupportingPatientInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_DoseNumberElement, otherT._DoseNumberElement)) return false; + if(!comparer.Equals(_ForecastStatus, otherT._ForecastStatus)) return false; + if(!comparer.ListEquals(_DateCriterion, otherT._DateCriterion)) return false; + if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; + if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; + if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "vaccineCode": - value = VaccineCode; - return VaccineCode is not null; + value = _VaccineCode; + return _VaccineCode is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease is not null; + value = _TargetDisease; + return _TargetDisease is not null; case "doseNumber": - value = DoseNumberElement; - return DoseNumberElement is not null; + value = _DoseNumberElement; + return _DoseNumberElement is not null; case "forecastStatus": - value = ForecastStatus; - return ForecastStatus is not null; + value = _ForecastStatus; + return _ForecastStatus is not null; case "dateCriterion": - value = DateCriterion; - return DateCriterion?.Any() == true; + value = _DateCriterion; + return _DateCriterion?.Any() == true; case "protocol": - value = Protocol; - return Protocol is not null; + value = _Protocol; + return _Protocol is not null; case "supportingImmunization": - value = SupportingImmunization; - return SupportingImmunization?.Any() == true; + value = _SupportingImmunization; + return _SupportingImmunization?.Any() == true; case "supportingPatientInformation": - value = SupportingPatientInformation; - return SupportingPatientInformation?.Any() == true; + value = _SupportingPatientInformation; + return _SupportingPatientInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "vaccineCode": - VaccineCode = (Hl7.Fhir.Model.CodeableConcept)value; + VaccineCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "targetDisease": - TargetDisease = (Hl7.Fhir.Model.CodeableConcept)value; + TargetDisease = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseNumber": - DoseNumberElement = (Hl7.Fhir.Model.PositiveInt)value; + DoseNumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "forecastStatus": - ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ForecastStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dateCriterion": - DateCriterion = (List)value; + DateCriterion = (List?)value!; return this; case "protocol": - Protocol = (Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent)value; + Protocol = (Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent?)value; return this; case "supportingImmunization": - SupportingImmunization = (List)value; + SupportingImmunization = (List?)value!; return this; case "supportingPatientInformation": - SupportingPatientInformation = (List)value; + SupportingPatientInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -361,15 +354,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (VaccineCode is not null) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (TargetDisease is not null) yield return new KeyValuePair("targetDisease",TargetDisease); - if (DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",DoseNumberElement); - if (ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",ForecastStatus); - if (DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",DateCriterion); - if (Protocol is not null) yield return new KeyValuePair("protocol",Protocol); - if (SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",SupportingImmunization); - if (SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",SupportingPatientInformation); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_VaccineCode is not null) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_TargetDisease is not null) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",_DoseNumberElement); + if (_ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",_ForecastStatus); + if (_DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",_DateCriterion); + if (_Protocol is not null) yield return new KeyValuePair("protocol",_Protocol); + if (_SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",_SupportingImmunization); + if (_SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",_SupportingPatientInformation); } } @@ -397,13 +390,13 @@ public partial class DateCriterionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ImmunizationRecommendationDateCriterion")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Recommended date. @@ -411,44 +404,37 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValueElement + public Hl7.Fhir.Model.FhirDateTime? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValueElement; + private Hl7.Fhir.Model.FhirDateTime? _ValueElement; /// /// Recommended date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DateCriterionComponent; - - if (dest == null) - { + if(other is not DateCriterionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)ValueElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -460,41 +446,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateCriterionComponent; - if(otherT == null) return false; + if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValueElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -505,8 +491,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -532,13 +518,13 @@ public partial class ProtocolComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("doseSequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DoseSequenceElement + public Hl7.Fhir.Model.PositiveInt? DoseSequenceElement { get { return _DoseSequenceElement; } set { _DoseSequenceElement = value; OnPropertyChanged("DoseSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DoseSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DoseSequenceElement; /// /// Dose number within sequence @@ -547,13 +533,10 @@ public Hl7.Fhir.Model.PositiveInt DoseSequenceElement [IgnoreDataMember] public int? DoseSequence { - get { return DoseSequenceElement != null ? DoseSequenceElement.Value : null; } + get => _DoseSequenceElement?.Value; set { - if (value == null) - DoseSequenceElement = null; - else - DoseSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DoseSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DoseSequence"); } } @@ -563,28 +546,25 @@ public int? DoseSequence /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Protocol details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -596,59 +576,52 @@ public string Description [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Name of vaccination series. /// [FhirElement("series", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccination series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ProtocolComponent; - - if (dest == null) - { + if(other is not ProtocolComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DoseSequenceElement != null) dest.DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt)DoseSequenceElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); + if(_DoseSequenceElement is not null) dest.DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DoseSequenceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -660,55 +633,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProtocolComponent; - if(otherT == null) return false; + if(other is not ProtocolComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DoseSequenceElement, otherT.DoseSequenceElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoseSequenceElement, otherT._DoseSequenceElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "doseSequence": - value = DoseSequenceElement; - return DoseSequenceElement is not null; + value = _DoseSequenceElement; + return _DoseSequenceElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "doseSequence": - DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DoseSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -719,10 +692,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DoseSequenceElement is not null) yield return new KeyValuePair("doseSequence",DoseSequenceElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); + if (_DoseSequenceElement is not null) yield return new KeyValuePair("doseSequence",_DoseSequenceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); } } @@ -735,11 +708,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Who this profile is for. @@ -749,13 +722,13 @@ public List Identifier [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Vaccine administration recommendations. @@ -765,27 +738,23 @@ public Hl7.Fhir.Model.ResourceReference Patient [DataMember] public List Recommendation { - get { if(_Recommendation==null) _Recommendation = new List(); return _Recommendation; } + get => _Recommendation ?? new List(); set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } - private List _Recommendation; + private List? _Recommendation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImmunizationRecommendation; - - if (dest == null) - { + if(other is not ImmunizationRecommendation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Recommendation.Any()) dest.Recommendation = new List(Recommendation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Recommendation is not null) dest.Recommendation = new List(_Recommendation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -797,48 +766,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImmunizationRecommendation; - if(otherT == null) return false; + if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.ListEquals(Recommendation, otherT.Recommendation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "recommendation": - value = Recommendation; - return Recommendation?.Any() == true; + value = _Recommendation; + return _Recommendation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recommendation": - Recommendation = (List)value; + Recommendation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -849,9 +818,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",Recommendation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",_Recommendation); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs index fb44c3939..f59146c8a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -163,13 +166,13 @@ public partial class DependencyComponent : Hl7.Fhir.Model.BackboneElement [Binding("GuideDependencyType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// reference | inclusion @@ -178,13 +181,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.GuideDependencyType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -195,44 +195,37 @@ public Hl7.Fhir.Model.ImplementationGuide.GuideDependencyType? Type [FhirElement("uri", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Where to find dependency /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DependencyComponent; - - if (dest == null) - { + if(other is not DependencyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -244,41 +237,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependencyComponent; - if(otherT == null) return false; + if(other is not DependencyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -289,8 +282,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); } } @@ -317,28 +310,25 @@ public partial class PackageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name used .page.package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -348,28 +338,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human readable text describing the package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -382,25 +369,21 @@ public string Description [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as PackageComponent; - - if (dest == null) - { + if(other is not PackageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -412,48 +395,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackageComponent; - if(otherT == null) return false; + if(other is not PackageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -464,9 +447,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); } } @@ -493,13 +476,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("example", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExampleElement + public Hl7.Fhir.Model.FhirBoolean? ExampleElement { get { return _ExampleElement; } set { _ExampleElement = value; OnPropertyChanged("ExampleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExampleElement; + private Hl7.Fhir.Model.FhirBoolean? _ExampleElement; /// /// If not an example, has its normal meaning @@ -508,13 +491,10 @@ public Hl7.Fhir.Model.FhirBoolean ExampleElement [IgnoreDataMember] public bool? Example { - get { return ExampleElement != null ? ExampleElement.Value : null; } + get => _ExampleElement?.Value; set { - if (value == null) - ExampleElement = null; - else - ExampleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExampleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Example"); } } @@ -524,28 +504,25 @@ public bool? Example /// [FhirElement("name", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human Name for the resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -555,28 +532,25 @@ public string Name /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason why included in guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -586,28 +560,25 @@ public string Description /// [FhirElement("acronym", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString AcronymElement + public Hl7.Fhir.Model.FhirString? AcronymElement { get { return _AcronymElement; } set { _AcronymElement = value; OnPropertyChanged("AcronymElement"); } } - private Hl7.Fhir.Model.FhirString _AcronymElement; + private Hl7.Fhir.Model.FhirString? _AcronymElement; /// /// Short code to identify the resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Acronym + public string? Acronym { - get { return AcronymElement != null ? AcronymElement.Value : null; } + get => _AcronymElement?.Value; set { - if (value == null) - AcronymElement = null; - else - AcronymElement = new Hl7.Fhir.Model.FhirString(value); + AcronymElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Acronym"); } } @@ -621,13 +592,13 @@ public string Acronym [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// Resource this is an example of (if applicable). @@ -636,30 +607,26 @@ public Hl7.Fhir.Model.DataType Source [CLSCompliant(false)] [References("StructureDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExampleFor + public Hl7.Fhir.Model.ResourceReference? ExampleFor { get { return _ExampleFor; } set { _ExampleFor = value; OnPropertyChanged("ExampleFor"); } } - private Hl7.Fhir.Model.ResourceReference _ExampleFor; + private Hl7.Fhir.Model.ResourceReference? _ExampleFor; protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ExampleElement != null) dest.ExampleElement = (Hl7.Fhir.Model.FhirBoolean)ExampleElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(AcronymElement != null) dest.AcronymElement = (Hl7.Fhir.Model.FhirString)AcronymElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(ExampleFor != null) dest.ExampleFor = (Hl7.Fhir.Model.ResourceReference)ExampleFor.DeepCopyInternal(); + if(_ExampleElement is not null) dest.ExampleElement = (Hl7.Fhir.Model.FhirBoolean)_ExampleElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_AcronymElement is not null) dest.AcronymElement = (Hl7.Fhir.Model.FhirString)_AcronymElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_ExampleFor is not null) dest.ExampleFor = (Hl7.Fhir.Model.ResourceReference)_ExampleFor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -671,69 +638,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ExampleElement, otherT.ExampleElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(AcronymElement, otherT.AcronymElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(ExampleFor, otherT.ExampleFor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ExampleElement, otherT._ExampleElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_AcronymElement, otherT._AcronymElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_ExampleFor, otherT._ExampleFor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "example": - value = ExampleElement; - return ExampleElement is not null; + value = _ExampleElement; + return _ExampleElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "acronym": - value = AcronymElement; - return AcronymElement is not null; + value = _AcronymElement; + return _AcronymElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "exampleFor": - value = ExampleFor; - return ExampleFor is not null; + value = _ExampleFor; + return _ExampleFor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "example": - ExampleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExampleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "acronym": - AcronymElement = (Hl7.Fhir.Model.FhirString)value; + AcronymElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "exampleFor": - ExampleFor = (Hl7.Fhir.Model.ResourceReference)value; + ExampleFor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -744,12 +711,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ExampleElement is not null) yield return new KeyValuePair("example",ExampleElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (AcronymElement is not null) yield return new KeyValuePair("acronym",AcronymElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (ExampleFor is not null) yield return new KeyValuePair("exampleFor",ExampleFor); + if (_ExampleElement is not null) yield return new KeyValuePair("example",_ExampleElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_AcronymElement is not null) yield return new KeyValuePair("acronym",_AcronymElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_ExampleFor is not null) yield return new KeyValuePair("exampleFor",_ExampleFor); } } @@ -779,13 +746,13 @@ public partial class GlobalComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type this profiles applies to @@ -794,13 +761,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -813,26 +777,22 @@ public Hl7.Fhir.Model.ResourceType? Type [References("StructureDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Profile + public Hl7.Fhir.Model.ResourceReference? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.ResourceReference _Profile; + private Hl7.Fhir.Model.ResourceReference? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as GlobalComponent; - - if (dest == null) - { + if(other is not GlobalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)Profile.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -844,41 +804,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GlobalComponent; - if(otherT == null) return false; + if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.ResourceReference)value; + Profile = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -889,8 +849,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -918,28 +878,25 @@ public partial class PageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("source", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// Where to find that page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -950,28 +907,25 @@ public string Source [FhirElement("title", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Short title shown for navigational assistance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -984,13 +938,13 @@ public string Title [Binding("GuidePageKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// page | example | list | include | directory | dictionary | toc | resource @@ -999,13 +953,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.GuidePageKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1020,24 +971,24 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageKind? Kind [DataMember] public List> TypeElement { - get { if(_TypeElement==null) _TypeElement = new List>(); return _TypeElement; } + get => _TypeElement ?? new List>(); set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private List> _TypeElement; + private List>? _TypeElement; /// /// Kind of resource to include in the list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Type + public IEnumerable? Type { - get { return TypeElement != null ? TypeElement.Select(elem => elem.Value) : null; } + get => _TypeElement?.Select(elem => elem.Value); set { if (value == null) - TypeElement = null; + TypeElement = null!; else TypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Type"); @@ -1052,24 +1003,24 @@ public IEnumerable Type [DataMember] public List PackageElement { - get { if(_PackageElement==null) _PackageElement = new List(); return _PackageElement; } + get => _PackageElement ?? new List(); set { _PackageElement = value; OnPropertyChanged("PackageElement"); } } - private List _PackageElement; + private List? _PackageElement; /// /// Name of package to include /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Package + public IEnumerable? Package { - get { return PackageElement != null ? PackageElement.Select(elem => elem.Value) : null; } + get => _PackageElement?.Select(elem => elem.Value); set { if (value == null) - PackageElement = null; + PackageElement = null!; else PackageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Package"); @@ -1082,28 +1033,25 @@ public IEnumerable Package [FhirElement("format", Order=90)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code FormatElement + public Hl7.Fhir.Model.Code? FormatElement { get { return _FormatElement; } set { _FormatElement = value; OnPropertyChanged("FormatElement"); } } - private Hl7.Fhir.Model.Code _FormatElement; + private Hl7.Fhir.Model.Code? _FormatElement; /// /// Format of the page (e.g. html, markdown, etc.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Format + public string? Format { - get { return FormatElement != null ? FormatElement.Value : null; } + get => _FormatElement?.Value; set { - if (value == null) - FormatElement = null; - else - FormatElement = new Hl7.Fhir.Model.Code(value); + FormatElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Format"); } } @@ -1116,29 +1064,25 @@ public string Format [DataMember] public List Page { - get { if(_Page==null) _Page = new List(); return _Page; } + get => _Page ?? new List(); set { _Page = value; OnPropertyChanged("Page"); } } - private List _Page; + private List? _Page; protected internal override void CopyToInternal(Base other) { - var dest = other as PageComponent; - - if (dest == null) - { + if(other is not PageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(TypeElement.Any()) dest.TypeElement = new List>(TypeElement.DeepCopyInternal()); - if(PackageElement.Any()) dest.PackageElement = new List(PackageElement.DeepCopyInternal()); - if(FormatElement != null) dest.FormatElement = (Hl7.Fhir.Model.Code)FormatElement.DeepCopyInternal(); - if(Page.Any()) dest.Page = new List(Page.DeepCopyInternal()); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = new List>(_TypeElement.DeepCopyInternal()); + if(_PackageElement is not null) dest.PackageElement = new List(_PackageElement.DeepCopyInternal()); + if(_FormatElement is not null) dest.FormatElement = (Hl7.Fhir.Model.Code)_FormatElement.DeepCopyInternal(); + if(_Page is not null) dest.Page = new List(_Page.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1150,76 +1094,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PageComponent; - if(otherT == null) return false; + if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.ListEquals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(PackageElement, otherT.PackageElement)) return false; - if(!comparer.Equals(FormatElement, otherT.FormatElement)) return false; - if(!comparer.ListEquals(Page, otherT.Page)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.ListEquals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_PackageElement, otherT._PackageElement)) return false; + if(!comparer.Equals(_FormatElement, otherT._FormatElement)) return false; + if(!comparer.ListEquals(_Page, otherT._Page)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "type": - value = TypeElement; - return TypeElement?.Any() == true; + value = _TypeElement; + return _TypeElement?.Any() == true; case "package": - value = PackageElement; - return PackageElement?.Any() == true; + value = _PackageElement; + return _PackageElement?.Any() == true; case "format": - value = FormatElement; - return FormatElement is not null; + value = _FormatElement; + return _FormatElement is not null; case "page": - value = Page; - return Page?.Any() == true; + value = _Page; + return _Page?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "type": - TypeElement = (List>)value; + TypeElement = (List>?)value!; return this; case "package": - PackageElement = (List)value; + PackageElement = (List?)value!; return this; case "format": - FormatElement = (Hl7.Fhir.Model.Code)value; + FormatElement = (Hl7.Fhir.Model.Code?)value; return this; case "page": - Page = (List)value; + Page = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1230,13 +1174,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (TypeElement?.Any() == true) yield return new KeyValuePair("type",TypeElement); - if (PackageElement?.Any() == true) yield return new KeyValuePair("package",PackageElement); - if (FormatElement is not null) yield return new KeyValuePair("format",FormatElement); - if (Page?.Any() == true) yield return new KeyValuePair("page",Page); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_TypeElement?.Any() == true) yield return new KeyValuePair("type",_TypeElement); + if (_PackageElement?.Any() == true) yield return new KeyValuePair("package",_PackageElement); + if (_FormatElement is not null) yield return new KeyValuePair("format",_FormatElement); + if (_Page?.Any() == true) yield return new KeyValuePair("page",_Page); } } @@ -1247,28 +1191,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this implementation guide (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1278,28 +1219,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1310,28 +1248,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this implementation guide (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1344,13 +1279,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1359,13 +1294,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1375,13 +1307,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=130, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1390,13 +1322,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1406,28 +1335,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1437,28 +1363,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1471,39 +1394,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the implementation guide. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1516,11 +1436,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for implementation guide (if applicable). @@ -1531,39 +1451,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1573,28 +1490,25 @@ public string Copyright /// [FhirElement("fhirVersion", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Id FhirVersionElement + public Hl7.Fhir.Model.Id? FhirVersionElement { get { return _FhirVersionElement; } set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private Hl7.Fhir.Model.Id _FhirVersionElement; + private Hl7.Fhir.Model.Id? _FhirVersionElement; /// /// FHIR Version this Implementation Guide targets /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FhirVersion + public string? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Value : null; } + get => _FhirVersionElement?.Value; set { - if (value == null) - FhirVersionElement = null; - else - FhirVersionElement = new Hl7.Fhir.Model.Id(value); + FhirVersionElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("FhirVersion"); } } @@ -1607,11 +1521,11 @@ public string FhirVersion [DataMember] public List Dependency { - get { if(_Dependency==null) _Dependency = new List(); return _Dependency; } + get => _Dependency ?? new List(); set { _Dependency = value; OnPropertyChanged("Dependency"); } } - private List _Dependency; + private List? _Dependency; /// /// Group of resources as used in .page.package. @@ -1621,11 +1535,11 @@ public List Dependency [DataMember] public List Package { - get { if(_Package==null) _Package = new List(); return _Package; } + get => _Package ?? new List(); set { _Package = value; OnPropertyChanged("Package"); } } - private List _Package; + private List? _Package; /// /// Profiles that apply globally. @@ -1635,11 +1549,11 @@ public List Package [DataMember] public List Global { - get { if(_Global==null) _Global = new List(); return _Global; } + get => _Global ?? new List(); set { _Global = value; OnPropertyChanged("Global"); } } - private List _Global; + private List? _Global; /// /// Image, css, script, etc. @@ -1649,24 +1563,24 @@ public List Global [DataMember] public List BinaryElement { - get { if(_BinaryElement==null) _BinaryElement = new List(); return _BinaryElement; } + get => _BinaryElement ?? new List(); set { _BinaryElement = value; OnPropertyChanged("BinaryElement"); } } - private List _BinaryElement; + private List? _BinaryElement; /// /// Image, css, script, etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Binary + public IEnumerable? Binary { - get { return BinaryElement != null ? BinaryElement.Select(elem => elem.Value) : null; } + get => _BinaryElement?.Select(elem => elem.Value); set { if (value == null) - BinaryElement = null; + BinaryElement = null!; else BinaryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Binary"); @@ -1678,42 +1592,38 @@ public IEnumerable Binary /// [FhirElement("page", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.PageComponent Page + public Hl7.Fhir.Model.ImplementationGuide.PageComponent? Page { get { return _Page; } set { _Page = value; OnPropertyChanged("Page"); } } - private Hl7.Fhir.Model.ImplementationGuide.PageComponent _Page; + private Hl7.Fhir.Model.ImplementationGuide.PageComponent? _Page; protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationGuide; - - if (dest == null) - { + if(other is not ImplementationGuide dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(FhirVersionElement != null) dest.FhirVersionElement = (Hl7.Fhir.Model.Id)FhirVersionElement.DeepCopyInternal(); - if(Dependency.Any()) dest.Dependency = new List(Dependency.DeepCopyInternal()); - if(Package.Any()) dest.Package = new List(Package.DeepCopyInternal()); - if(Global.Any()) dest.Global = new List(Global.DeepCopyInternal()); - if(BinaryElement.Any()) dest.BinaryElement = new List(BinaryElement.DeepCopyInternal()); - if(Page != null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)Page.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = (Hl7.Fhir.Model.Id)_FhirVersionElement.DeepCopyInternal(); + if(_Dependency is not null) dest.Dependency = new List(_Dependency.DeepCopyInternal()); + if(_Package is not null) dest.Package = new List(_Package.DeepCopyInternal()); + if(_Global is not null) dest.Global = new List(_Global.DeepCopyInternal()); + if(_BinaryElement is not null) dest.BinaryElement = new List(_BinaryElement.DeepCopyInternal()); + if(_Page is not null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)_Page.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1725,153 +1635,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationGuide; - if(otherT == null) return false; + if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.ListEquals(Dependency, otherT.Dependency)) return false; - if(!comparer.ListEquals(Package, otherT.Package)) return false; - if(!comparer.ListEquals(Global, otherT.Global)) return false; - if(!comparer.ListEquals(BinaryElement, otherT.BinaryElement)) return false; - if(!comparer.Equals(Page, otherT.Page)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.ListEquals(_Dependency, otherT._Dependency)) return false; + if(!comparer.ListEquals(_Package, otherT._Package)) return false; + if(!comparer.ListEquals(_Global, otherT._Global)) return false; + if(!comparer.ListEquals(_BinaryElement, otherT._BinaryElement)) return false; + if(!comparer.Equals(_Page, otherT._Page)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement is not null; + value = _FhirVersionElement; + return _FhirVersionElement is not null; case "dependency": - value = Dependency; - return Dependency?.Any() == true; + value = _Dependency; + return _Dependency?.Any() == true; case "package": - value = Package; - return Package?.Any() == true; + value = _Package; + return _Package?.Any() == true; case "global": - value = Global; - return Global?.Any() == true; + value = _Global; + return _Global?.Any() == true; case "binary": - value = BinaryElement; - return BinaryElement?.Any() == true; + value = _BinaryElement; + return _BinaryElement?.Any() == true; case "page": - value = Page; - return Page is not null; + value = _Page; + return _Page is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "fhirVersion": - FhirVersionElement = (Hl7.Fhir.Model.Id)value; + FhirVersionElement = (Hl7.Fhir.Model.Id?)value; return this; case "dependency": - Dependency = (List)value; + Dependency = (List?)value!; return this; case "package": - Package = (List)value; + Package = (List?)value!; return this; case "global": - Global = (List)value; + Global = (List?)value!; return this; case "binary": - BinaryElement = (List)value; + BinaryElement = (List?)value!; return this; case "page": - Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)value; + Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent?)value; return this; default: return base.SetValue(key, value); @@ -1882,24 +1792,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (Dependency?.Any() == true) yield return new KeyValuePair("dependency",Dependency); - if (Package?.Any() == true) yield return new KeyValuePair("package",Package); - if (Global?.Any() == true) yield return new KeyValuePair("global",Global); - if (BinaryElement?.Any() == true) yield return new KeyValuePair("binary",BinaryElement); - if (Page is not null) yield return new KeyValuePair("page",Page); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_Dependency?.Any() == true) yield return new KeyValuePair("dependency",_Dependency); + if (_Package?.Any() == true) yield return new KeyValuePair("package",_Package); + if (_Global?.Any() == true) yield return new KeyValuePair("global",_Global); + if (_BinaryElement?.Any() == true) yield return new KeyValuePair("binary",_BinaryElement); + if (_Page is not null) yield return new KeyValuePair("page",_Page); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Library.cs b/src/Hl7.Fhir.STU3/Model/Generated/Library.cs index a7e950faf..88105a951 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Library.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Library : Hl7.Fhir.Model.DomainResource, IIdentifiable [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this library (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the library. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this library (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this library (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -205,13 +196,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -220,13 +211,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -236,13 +224,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -251,13 +239,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -269,41 +254,38 @@ public bool? Experimental [Binding("LibraryType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Date this was last changed. /// [FhirElement("date", InSummary=true, Order=170, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -313,28 +295,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -344,28 +323,25 @@ public string Publisher /// [FhirElement("description", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -375,28 +351,25 @@ public string Description /// [FhirElement("purpose", Order=200, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this library is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -406,28 +379,25 @@ public string Purpose /// [FhirElement("usage", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -437,28 +407,25 @@ public string Usage /// [FhirElement("approvalDate", Order=220)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the library was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -468,28 +435,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=230)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the library was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -499,13 +463,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Context the content is intended to support. @@ -515,11 +479,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for library (if applicable). @@ -530,11 +494,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// E.g. Education, Treatment, Assessment, etc. @@ -545,11 +509,11 @@ public List Jurisdiction [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// A content contributor. @@ -559,11 +523,11 @@ public List Topic [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Contact details for the publisher. @@ -573,39 +537,36 @@ public List Contributor [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=300)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -618,11 +579,11 @@ public string Copyright [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Parameters defined by the library. @@ -632,11 +593,11 @@ public List RelatedArtifact [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// What data is referenced by this library. @@ -646,11 +607,11 @@ public List Parameter [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; /// /// Contents of the library, either embedded or referenced. @@ -660,50 +621,46 @@ public List DataRequirement [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Library; - - if (dest == null) - { + if(other is not Library dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -715,209 +672,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Library; - if(otherT == null) return false; + if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; default: return base.SetValue(key, value); @@ -928,32 +885,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs index af53e1bab..fd02bf2b1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -111,13 +114,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [Binding("LinkageType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// source | alternate | historical @@ -126,13 +129,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Linkage.LinkageType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -143,26 +143,22 @@ public Hl7.Fhir.Model.Linkage.LinkageType? Type [FhirElement("resource", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -174,41 +170,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -219,8 +215,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -230,13 +226,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("active", InSummary=true, Order=90, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this linkage assertion is active or not @@ -245,13 +241,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -263,13 +256,13 @@ public bool? Active [CLSCompliant(false)] [References("Practitioner","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Item to be linked. @@ -279,25 +272,21 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as Linkage; - - if (dest == null) - { + if(other is not Linkage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -309,48 +298,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Linkage; - if(otherT == null) return false; + if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -361,9 +350,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/List.cs b/src/Hl7.Fhir.STU3/Model/Generated/List.cs index db3c67a64..0c835fd46 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/List.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/List.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,26 +113,26 @@ public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("flag", Order=40)] [Binding("ListItemFlag")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Flag + public Hl7.Fhir.Model.CodeableConcept? Flag { get { return _Flag; } set { _Flag = value; OnPropertyChanged("Flag"); } } - private Hl7.Fhir.Model.CodeableConcept _Flag; + private Hl7.Fhir.Model.CodeableConcept? _Flag; /// /// If this item is actually marked as deleted. /// [FhirElement("deleted", IsModifier=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DeletedElement + public Hl7.Fhir.Model.FhirBoolean? DeletedElement { get { return _DeletedElement; } set { _DeletedElement = value; OnPropertyChanged("DeletedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DeletedElement; + private Hl7.Fhir.Model.FhirBoolean? _DeletedElement; /// /// If this item is actually marked as deleted @@ -138,13 +141,10 @@ public Hl7.Fhir.Model.FhirBoolean DeletedElement [IgnoreDataMember] public bool? Deleted { - get { return DeletedElement != null ? DeletedElement.Value : null; } + get => _DeletedElement?.Value; set { - if (value == null) - DeletedElement = null; - else - DeletedElement = new Hl7.Fhir.Model.FhirBoolean(value); + DeletedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Deleted"); } } @@ -154,28 +154,25 @@ public bool? Deleted /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When item added to list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -188,28 +185,24 @@ public string Date [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Item + public Hl7.Fhir.Model.ResourceReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.ResourceReference _Item; + private Hl7.Fhir.Model.ResourceReference? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as EntryComponent; - - if (dest == null) - { + if(other is not EntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Flag != null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)Flag.DeepCopyInternal(); - if(DeletedElement != null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)DeletedElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.ResourceReference)Item.DeepCopyInternal(); + if(_Flag is not null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)_Flag.DeepCopyInternal(); + if(_DeletedElement is not null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)_DeletedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.ResourceReference)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -221,55 +214,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntryComponent; - if(otherT == null) return false; + if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Flag, otherT.Flag)) return false; - if(!comparer.Equals(DeletedElement, otherT.DeletedElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "flag": - value = Flag; - return Flag is not null; + value = _Flag; + return _Flag is not null; case "deleted": - value = DeletedElement; - return DeletedElement is not null; + value = _DeletedElement; + return _DeletedElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "flag": - Flag = (Hl7.Fhir.Model.CodeableConcept)value; + Flag = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "deleted": - DeletedElement = (Hl7.Fhir.Model.FhirBoolean)value; + DeletedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "item": - Item = (Hl7.Fhir.Model.ResourceReference)value; + Item = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -280,10 +273,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Flag is not null) yield return new KeyValuePair("flag",Flag); - if (DeletedElement is not null) yield return new KeyValuePair("deleted",DeletedElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Flag is not null) yield return new KeyValuePair("flag",_Flag); + if (_DeletedElement is not null) yield return new KeyValuePair("deleted",_DeletedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -296,11 +289,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | retired | entered-in-error. @@ -310,13 +303,13 @@ public List Identifier [Binding("ListStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | retired | entered-in-error @@ -325,13 +318,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.List.ListStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -344,13 +334,13 @@ public Hl7.Fhir.Model.List.ListStatus? Status [Binding("ListMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -359,13 +349,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -375,28 +362,25 @@ public Hl7.Fhir.Model.ListMode? Mode /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Descriptive name for the list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -407,13 +391,13 @@ public string Title [FhirElement("code", InSummary=true, Order=130, FiveWs="what")] [Binding("ListPurpose")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// If all resources have the same subject. @@ -422,13 +406,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Context in which list created. @@ -437,41 +421,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the list was prepared. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the list was prepared /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -483,13 +464,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","Patient","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// What order the list has. @@ -497,13 +478,13 @@ public Hl7.Fhir.Model.ResourceReference Source [FhirElement("orderedBy", Order=180)] [Binding("ListOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// Comments about the list. @@ -513,11 +494,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Entries in the list. @@ -527,11 +508,11 @@ public List Note [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why list is empty. @@ -539,39 +520,35 @@ public List Entry [FhirElement("emptyReason", Order=210)] [Binding("ListEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as List; - - if (dest == null) - { + if(other is not List dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -583,118 +560,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as List; - if(otherT == null) return false; + if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -705,19 +682,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs index 443679234..51b425d12 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -131,13 +134,13 @@ public partial class PositionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("longitude", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LongitudeElement + public Hl7.Fhir.Model.FhirDecimal? LongitudeElement { get { return _LongitudeElement; } set { _LongitudeElement = value; OnPropertyChanged("LongitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LongitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LongitudeElement; /// /// Longitude with WGS84 datum @@ -146,13 +149,10 @@ public Hl7.Fhir.Model.FhirDecimal LongitudeElement [IgnoreDataMember] public decimal? Longitude { - get { return LongitudeElement != null ? LongitudeElement.Value : null; } + get => _LongitudeElement?.Value; set { - if (value == null) - LongitudeElement = null; - else - LongitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LongitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Longitude"); } } @@ -163,13 +163,13 @@ public decimal? Longitude [FhirElement("latitude", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LatitudeElement + public Hl7.Fhir.Model.FhirDecimal? LatitudeElement { get { return _LatitudeElement; } set { _LatitudeElement = value; OnPropertyChanged("LatitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LatitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LatitudeElement; /// /// Latitude with WGS84 datum @@ -178,13 +178,10 @@ public Hl7.Fhir.Model.FhirDecimal LatitudeElement [IgnoreDataMember] public decimal? Latitude { - get { return LatitudeElement != null ? LatitudeElement.Value : null; } + get => _LatitudeElement?.Value; set { - if (value == null) - LatitudeElement = null; - else - LatitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LatitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Latitude"); } } @@ -194,13 +191,13 @@ public decimal? Latitude /// [FhirElement("altitude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AltitudeElement + public Hl7.Fhir.Model.FhirDecimal? AltitudeElement { get { return _AltitudeElement; } set { _AltitudeElement = value; OnPropertyChanged("AltitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AltitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _AltitudeElement; /// /// Altitude with WGS84 datum @@ -209,30 +206,23 @@ public Hl7.Fhir.Model.FhirDecimal AltitudeElement [IgnoreDataMember] public decimal? Altitude { - get { return AltitudeElement != null ? AltitudeElement.Value : null; } + get => _AltitudeElement?.Value; set { - if (value == null) - AltitudeElement = null; - else - AltitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + AltitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Altitude"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PositionComponent; - - if (dest == null) - { + if(other is not PositionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LongitudeElement != null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)LongitudeElement.DeepCopyInternal(); - if(LatitudeElement != null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)LatitudeElement.DeepCopyInternal(); - if(AltitudeElement != null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)AltitudeElement.DeepCopyInternal(); + if(_LongitudeElement is not null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LongitudeElement.DeepCopyInternal(); + if(_LatitudeElement is not null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LatitudeElement.DeepCopyInternal(); + if(_AltitudeElement is not null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)_AltitudeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -244,48 +234,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PositionComponent; - if(otherT == null) return false; + if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LongitudeElement, otherT.LongitudeElement)) return false; - if(!comparer.Equals(LatitudeElement, otherT.LatitudeElement)) return false; - if(!comparer.Equals(AltitudeElement, otherT.AltitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; + if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "longitude": - value = LongitudeElement; - return LongitudeElement is not null; + value = _LongitudeElement; + return _LongitudeElement is not null; case "latitude": - value = LatitudeElement; - return LatitudeElement is not null; + value = _LatitudeElement; + return _LatitudeElement is not null; case "altitude": - value = AltitudeElement; - return AltitudeElement is not null; + value = _AltitudeElement; + return _AltitudeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "longitude": - LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LongitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "latitude": - LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LatitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "altitude": - AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + AltitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -296,9 +286,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LongitudeElement is not null) yield return new KeyValuePair("longitude",LongitudeElement); - if (LatitudeElement is not null) yield return new KeyValuePair("latitude",LatitudeElement); - if (AltitudeElement is not null) yield return new KeyValuePair("altitude",AltitudeElement); + if (_LongitudeElement is not null) yield return new KeyValuePair("longitude",_LongitudeElement); + if (_LatitudeElement is not null) yield return new KeyValuePair("latitude",_LatitudeElement); + if (_AltitudeElement is not null) yield return new KeyValuePair("altitude",_AltitudeElement); } } @@ -311,11 +301,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | inactive. @@ -324,13 +314,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("LocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | inactive @@ -339,13 +329,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -356,41 +343,38 @@ public Hl7.Fhir.Model.Location.LocationStatus? Status [FhirElement("operationalStatus", InSummary=true, Order=110, FiveWs="status")] [Binding("OperationalStatus")] [DataMember] - public Hl7.Fhir.Model.Coding OperationalStatus + public Hl7.Fhir.Model.Coding? OperationalStatus { get { return _OperationalStatus; } set { _OperationalStatus = value; OnPropertyChanged("OperationalStatus"); } } - private Hl7.Fhir.Model.Coding _OperationalStatus; + private Hl7.Fhir.Model.Coding? _OperationalStatus; /// /// Name of the location as used by humans. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the location as used by humans /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -403,24 +387,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the location is known as, or was known as in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -432,28 +416,25 @@ public IEnumerable Alias /// [FhirElement("description", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Additional details about the location that could be displayed as further information to identify the location beyond its name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -465,13 +446,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("LocationMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// instance | kind @@ -480,13 +461,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -497,13 +475,13 @@ public Hl7.Fhir.Model.Location.LocationMode? Mode [FhirElement("type", InSummary=true, Order=160, FiveWs="class")] [Binding("LocationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Contact details of the location. @@ -513,24 +491,24 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Physical location. /// [FhirElement("address", Order=180)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// Physical form of the location. @@ -538,26 +516,26 @@ public Hl7.Fhir.Model.Address Address [FhirElement("physicalType", InSummary=true, Order=190, FiveWs="class")] [Binding("PhysicalType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PhysicalType + public Hl7.Fhir.Model.CodeableConcept? PhysicalType { get { return _PhysicalType; } set { _PhysicalType = value; OnPropertyChanged("PhysicalType"); } } - private Hl7.Fhir.Model.CodeableConcept _PhysicalType; + private Hl7.Fhir.Model.CodeableConcept? _PhysicalType; /// /// The absolute geographic location. /// [FhirElement("position", Order=200)] [DataMember] - public Hl7.Fhir.Model.Location.PositionComponent Position + public Hl7.Fhir.Model.Location.PositionComponent? Position { get { return _Position; } set { _Position = value; OnPropertyChanged("Position"); } } - private Hl7.Fhir.Model.Location.PositionComponent _Position; + private Hl7.Fhir.Model.Location.PositionComponent? _Position; /// /// Organization responsible for provisioning and upkeep. @@ -566,13 +544,13 @@ public Hl7.Fhir.Model.Location.PositionComponent Position [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Another Location this one is physically part of. @@ -581,13 +559,13 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// Technical endpoints providing access to services operated for the location. @@ -599,39 +577,35 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Location; - - if (dest == null) - { + if(other is not Location dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(OperationalStatus != null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)OperationalStatus.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(PhysicalType != null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)PhysicalType.DeepCopyInternal(); - if(Position != null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)Position.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_OperationalStatus is not null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)_OperationalStatus.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_PhysicalType is not null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)_PhysicalType.DeepCopyInternal(); + if(_Position is not null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)_Position.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -643,132 +617,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Location; - if(otherT == null) return false; + if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(OperationalStatus, otherT.OperationalStatus)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(PhysicalType, otherT.PhysicalType)) return false; - if(!comparer.Equals(Position, otherT.Position)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_PhysicalType, otherT._PhysicalType)) return false; + if(!comparer.Equals(_Position, otherT._Position)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "operationalStatus": - value = OperationalStatus; - return OperationalStatus is not null; + value = _OperationalStatus; + return _OperationalStatus is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "physicalType": - value = PhysicalType; - return PhysicalType is not null; + value = _PhysicalType; + return _PhysicalType is not null; case "position": - value = Position; - return Position is not null; + value = _Position; + return _Position is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "operationalStatus": - OperationalStatus = (Hl7.Fhir.Model.Coding)value; + OperationalStatus = (Hl7.Fhir.Model.Coding?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "physicalType": - PhysicalType = (Hl7.Fhir.Model.CodeableConcept)value; + PhysicalType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "position": - Position = (Hl7.Fhir.Model.Location.PositionComponent)value; + Position = (Hl7.Fhir.Model.Location.PositionComponent?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -779,21 +753,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",OperationalStatus); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (PhysicalType is not null) yield return new KeyValuePair("physicalType",PhysicalType); - if (Position is not null) yield return new KeyValuePair("position",Position); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatus); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_PhysicalType is not null) yield return new KeyValuePair("physicalType",_PhysicalType); + if (_Position is not null) yield return new KeyValuePair("position",_Position); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs index bfc30a1ee..c85c957a7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,41 +84,38 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identifier", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Short name. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -125,28 +125,25 @@ public string Name /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Summary description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -159,11 +156,11 @@ public string Description [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// Stratifier criteria for the measure. @@ -173,27 +170,23 @@ public List Population [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -205,62 +198,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -271,11 +264,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -301,13 +294,13 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-observation. @@ -315,41 +308,38 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("code", Order=50)] [Binding("MeasurePopulationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Short name. /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -359,28 +349,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this population criteria /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -391,47 +378,40 @@ public string Description [FhirElement("criteria", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString CriteriaElement + public Hl7.Fhir.Model.FhirString? CriteriaElement { get { return _CriteriaElement; } set { _CriteriaElement = value; OnPropertyChanged("CriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _CriteriaElement; + private Hl7.Fhir.Model.FhirString? _CriteriaElement; /// /// The name of a valid referenced CQL expression (may be namespaced) that defines this population criteria /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Criteria + public string? Criteria { - get { return CriteriaElement != null ? CriteriaElement.Value : null; } + get => _CriteriaElement?.Value; set { - if (value == null) - CriteriaElement = null; - else - CriteriaElement = new Hl7.Fhir.Model.FhirString(value); + CriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Criteria"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(CriteriaElement != null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)CriteriaElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_CriteriaElement is not null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)_CriteriaElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -443,62 +423,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(CriteriaElement, otherT.CriteriaElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = CriteriaElement; - return CriteriaElement is not null; + value = _CriteriaElement; + return _CriteriaElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - CriteriaElement = (Hl7.Fhir.Model.FhirString)value; + CriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -509,11 +489,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (CriteriaElement is not null) yield return new KeyValuePair("criteria",CriteriaElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_CriteriaElement is not null) yield return new KeyValuePair("criteria",_CriteriaElement); } } @@ -539,41 +519,38 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// How the measure should be stratified. /// [FhirElement("criteria", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString CriteriaElement + public Hl7.Fhir.Model.FhirString? CriteriaElement { get { return _CriteriaElement; } set { _CriteriaElement = value; OnPropertyChanged("CriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _CriteriaElement; + private Hl7.Fhir.Model.FhirString? _CriteriaElement; /// /// How the measure should be stratified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Criteria + public string? Criteria { - get { return CriteriaElement != null ? CriteriaElement.Value : null; } + get => _CriteriaElement?.Value; set { - if (value == null) - CriteriaElement = null; - else - CriteriaElement = new Hl7.Fhir.Model.FhirString(value); + CriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Criteria"); } } @@ -583,45 +560,38 @@ public string Criteria /// [FhirElement("path", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path to the stratifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(CriteriaElement != null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)CriteriaElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_CriteriaElement is not null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)_CriteriaElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -633,48 +603,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(CriteriaElement, otherT.CriteriaElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "criteria": - value = CriteriaElement; - return CriteriaElement is not null; + value = _CriteriaElement; + return _CriteriaElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "criteria": - CriteriaElement = (Hl7.Fhir.Model.FhirString)value; + CriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -685,9 +655,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (CriteriaElement is not null) yield return new KeyValuePair("criteria",CriteriaElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_CriteriaElement is not null) yield return new KeyValuePair("criteria",_CriteriaElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); } } @@ -714,13 +684,13 @@ public partial class SupplementalDataComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// supplemental-data | risk-adjustment-factor. @@ -731,39 +701,36 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List Usage { - get { if(_Usage==null) _Usage = new List(); return _Usage; } + get => _Usage ?? new List(); set { _Usage = value; OnPropertyChanged("Usage"); } } - private List _Usage; + private List? _Usage; /// /// Expression describing additional data to be reported. /// [FhirElement("criteria", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString CriteriaElement + public Hl7.Fhir.Model.FhirString? CriteriaElement { get { return _CriteriaElement; } set { _CriteriaElement = value; OnPropertyChanged("CriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _CriteriaElement; + private Hl7.Fhir.Model.FhirString? _CriteriaElement; /// /// Expression describing additional data to be reported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Criteria + public string? Criteria { - get { return CriteriaElement != null ? CriteriaElement.Value : null; } + get => _CriteriaElement?.Value; set { - if (value == null) - CriteriaElement = null; - else - CriteriaElement = new Hl7.Fhir.Model.FhirString(value); + CriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Criteria"); } } @@ -773,46 +740,39 @@ public string Criteria /// [FhirElement("path", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path to the supplemental data element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementalDataComponent; - - if (dest == null) - { + if(other is not SupplementalDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Usage.Any()) dest.Usage = new List(Usage.DeepCopyInternal()); - if(CriteriaElement != null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)CriteriaElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Usage is not null) dest.Usage = new List(_Usage.DeepCopyInternal()); + if(_CriteriaElement is not null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)_CriteriaElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -824,55 +784,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementalDataComponent; - if(otherT == null) return false; + if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Usage, otherT.Usage)) return false; - if(!comparer.Equals(CriteriaElement, otherT.CriteriaElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; + if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "usage": - value = Usage; - return Usage?.Any() == true; + value = _Usage; + return _Usage?.Any() == true; case "criteria": - value = CriteriaElement; - return CriteriaElement is not null; + value = _CriteriaElement; + return _CriteriaElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "usage": - Usage = (List)value; + Usage = (List?)value!; return this; case "criteria": - CriteriaElement = (Hl7.Fhir.Model.FhirString)value; + CriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -883,10 +843,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Usage?.Any() == true) yield return new KeyValuePair("usage",Usage); - if (CriteriaElement is not null) yield return new KeyValuePair("criteria",CriteriaElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Usage?.Any() == true) yield return new KeyValuePair("usage",_Usage); + if (_CriteriaElement is not null) yield return new KeyValuePair("criteria",_CriteriaElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); } } @@ -896,28 +856,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this measure (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -930,39 +887,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the measure. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -972,28 +926,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this measure (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1003,28 +954,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this measure (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1037,13 +985,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1052,13 +1000,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1068,13 +1013,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1083,13 +1028,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1099,28 +1041,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1130,28 +1069,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1161,28 +1097,25 @@ public string Publisher /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1192,28 +1125,25 @@ public string Description /// [FhirElement("purpose", Order=190, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this measure is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1223,28 +1153,25 @@ public string Purpose /// [FhirElement("usage", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -1254,28 +1181,25 @@ public string Usage /// [FhirElement("approvalDate", Order=210)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the measure was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1285,28 +1209,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=220)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the measure was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1316,13 +1237,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Context the content is intended to support. @@ -1332,11 +1253,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for measure (if applicable). @@ -1347,11 +1268,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// E.g. Education, Treatment, Assessment, etc. @@ -1362,11 +1283,11 @@ public List Jurisdiction [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// A content contributor. @@ -1376,11 +1297,11 @@ public List Topic [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Contact details for the publisher. @@ -1390,39 +1311,36 @@ public List Contributor [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=290)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1435,11 +1353,11 @@ public string Copyright [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the measure. @@ -1451,39 +1369,36 @@ public List RelatedArtifact [DataMember] public List Library { - get { if(_Library==null) _Library = new List(); return _Library; } + get => _Library ?? new List(); set { _Library = value; OnPropertyChanged("Library"); } } - private List _Library; + private List? _Library; /// /// Disclaimer for use of the measure or its referenced content. /// [FhirElement("disclaimer", InSummary=true, Order=320)] [DataMember] - public Hl7.Fhir.Model.Markdown DisclaimerElement + public Hl7.Fhir.Model.Markdown? DisclaimerElement { get { return _DisclaimerElement; } set { _DisclaimerElement = value; OnPropertyChanged("DisclaimerElement"); } } - private Hl7.Fhir.Model.Markdown _DisclaimerElement; + private Hl7.Fhir.Model.Markdown? _DisclaimerElement; /// /// Disclaimer for use of the measure or its referenced content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disclaimer + public string? Disclaimer { - get { return DisclaimerElement != null ? DisclaimerElement.Value : null; } + get => _DisclaimerElement?.Value; set { - if (value == null) - DisclaimerElement = null; - else - DisclaimerElement = new Hl7.Fhir.Model.Markdown(value); + DisclaimerElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Disclaimer"); } } @@ -1494,13 +1409,13 @@ public string Disclaimer [FhirElement("scoring", InSummary=true, Order=330)] [Binding("MeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; /// /// opportunity | all-or-nothing | linear | weighted. @@ -1508,13 +1423,13 @@ public Hl7.Fhir.Model.CodeableConcept Scoring [FhirElement("compositeScoring", InSummary=true, Order=340)] [Binding("CompositeMeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CompositeScoring + public Hl7.Fhir.Model.CodeableConcept? CompositeScoring { get { return _CompositeScoring; } set { _CompositeScoring = value; OnPropertyChanged("CompositeScoring"); } } - private Hl7.Fhir.Model.CodeableConcept _CompositeScoring; + private Hl7.Fhir.Model.CodeableConcept? _CompositeScoring; /// /// process | outcome | structure | patient-reported-outcome | composite. @@ -1525,39 +1440,36 @@ public Hl7.Fhir.Model.CodeableConcept CompositeScoring [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// How is risk adjustment applied for this measure. /// [FhirElement("riskAdjustment", InSummary=true, Order=360)] [DataMember] - public Hl7.Fhir.Model.FhirString RiskAdjustmentElement + public Hl7.Fhir.Model.FhirString? RiskAdjustmentElement { get { return _RiskAdjustmentElement; } set { _RiskAdjustmentElement = value; OnPropertyChanged("RiskAdjustmentElement"); } } - private Hl7.Fhir.Model.FhirString _RiskAdjustmentElement; + private Hl7.Fhir.Model.FhirString? _RiskAdjustmentElement; /// /// How is risk adjustment applied for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RiskAdjustment + public string? RiskAdjustment { - get { return RiskAdjustmentElement != null ? RiskAdjustmentElement.Value : null; } + get => _RiskAdjustmentElement?.Value; set { - if (value == null) - RiskAdjustmentElement = null; - else - RiskAdjustmentElement = new Hl7.Fhir.Model.FhirString(value); + RiskAdjustmentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RiskAdjustment"); } } @@ -1567,28 +1479,25 @@ public string RiskAdjustment /// [FhirElement("rateAggregation", InSummary=true, Order=370)] [DataMember] - public Hl7.Fhir.Model.FhirString RateAggregationElement + public Hl7.Fhir.Model.FhirString? RateAggregationElement { get { return _RateAggregationElement; } set { _RateAggregationElement = value; OnPropertyChanged("RateAggregationElement"); } } - private Hl7.Fhir.Model.FhirString _RateAggregationElement; + private Hl7.Fhir.Model.FhirString? _RateAggregationElement; /// /// How is rate aggregation performed for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RateAggregation + public string? RateAggregation { - get { return RateAggregationElement != null ? RateAggregationElement.Value : null; } + get => _RateAggregationElement?.Value; set { - if (value == null) - RateAggregationElement = null; - else - RateAggregationElement = new Hl7.Fhir.Model.FhirString(value); + RateAggregationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RateAggregation"); } } @@ -1598,28 +1507,25 @@ public string RateAggregation /// [FhirElement("rationale", InSummary=true, Order=380)] [DataMember] - public Hl7.Fhir.Model.Markdown RationaleElement + public Hl7.Fhir.Model.Markdown? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.Markdown _RationaleElement; + private Hl7.Fhir.Model.Markdown? _RationaleElement; /// /// Why does this measure exist /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.Markdown(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Rationale"); } } @@ -1629,28 +1535,25 @@ public string Rationale /// [FhirElement("clinicalRecommendationStatement", InSummary=true, Order=390)] [DataMember] - public Hl7.Fhir.Model.Markdown ClinicalRecommendationStatementElement + public Hl7.Fhir.Model.Markdown? ClinicalRecommendationStatementElement { get { return _ClinicalRecommendationStatementElement; } set { _ClinicalRecommendationStatementElement = value; OnPropertyChanged("ClinicalRecommendationStatementElement"); } } - private Hl7.Fhir.Model.Markdown _ClinicalRecommendationStatementElement; + private Hl7.Fhir.Model.Markdown? _ClinicalRecommendationStatementElement; /// /// Summary of clinical guidelines /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClinicalRecommendationStatement + public string? ClinicalRecommendationStatement { - get { return ClinicalRecommendationStatementElement != null ? ClinicalRecommendationStatementElement.Value : null; } + get => _ClinicalRecommendationStatementElement?.Value; set { - if (value == null) - ClinicalRecommendationStatementElement = null; - else - ClinicalRecommendationStatementElement = new Hl7.Fhir.Model.Markdown(value); + ClinicalRecommendationStatementElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ClinicalRecommendationStatement"); } } @@ -1660,28 +1563,25 @@ public string ClinicalRecommendationStatement /// [FhirElement("improvementNotation", InSummary=true, Order=400)] [DataMember] - public Hl7.Fhir.Model.FhirString ImprovementNotationElement + public Hl7.Fhir.Model.FhirString? ImprovementNotationElement { get { return _ImprovementNotationElement; } set { _ImprovementNotationElement = value; OnPropertyChanged("ImprovementNotationElement"); } } - private Hl7.Fhir.Model.FhirString _ImprovementNotationElement; + private Hl7.Fhir.Model.FhirString? _ImprovementNotationElement; /// /// Improvement notation for the measure, e.g. higher score indicates better quality /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ImprovementNotation + public string? ImprovementNotation { - get { return ImprovementNotationElement != null ? ImprovementNotationElement.Value : null; } + get => _ImprovementNotationElement?.Value; set { - if (value == null) - ImprovementNotationElement = null; - else - ImprovementNotationElement = new Hl7.Fhir.Model.FhirString(value); + ImprovementNotationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ImprovementNotation"); } } @@ -1694,24 +1594,24 @@ public string ImprovementNotation [DataMember] public List DefinitionElement { - get { if(_DefinitionElement==null) _DefinitionElement = new List(); return _DefinitionElement; } + get => _DefinitionElement ?? new List(); set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private List _DefinitionElement; + private List? _DefinitionElement; /// /// Defined terms used in the measure documentation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Definition + public IEnumerable? Definition { - get { return DefinitionElement != null ? DefinitionElement.Select(elem => elem.Value) : null; } + get => _DefinitionElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionElement = null; + DefinitionElement = null!; else DefinitionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Markdown(elem))); OnPropertyChanged("Definition"); @@ -1723,28 +1623,25 @@ public IEnumerable Definition /// [FhirElement("guidance", InSummary=true, Order=420)] [DataMember] - public Hl7.Fhir.Model.Markdown GuidanceElement + public Hl7.Fhir.Model.Markdown? GuidanceElement { get { return _GuidanceElement; } set { _GuidanceElement = value; OnPropertyChanged("GuidanceElement"); } } - private Hl7.Fhir.Model.Markdown _GuidanceElement; + private Hl7.Fhir.Model.Markdown? _GuidanceElement; /// /// Additional guidance for implementers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Guidance + public string? Guidance { - get { return GuidanceElement != null ? GuidanceElement.Value : null; } + get => _GuidanceElement?.Value; set { - if (value == null) - GuidanceElement = null; - else - GuidanceElement = new Hl7.Fhir.Model.Markdown(value); + GuidanceElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Guidance"); } } @@ -1754,28 +1651,25 @@ public string Guidance /// [FhirElement("set", InSummary=true, Order=430)] [DataMember] - public Hl7.Fhir.Model.FhirString SetElement + public Hl7.Fhir.Model.FhirString? SetElement { get { return _SetElement; } set { _SetElement = value; OnPropertyChanged("SetElement"); } } - private Hl7.Fhir.Model.FhirString _SetElement; + private Hl7.Fhir.Model.FhirString? _SetElement; /// /// The measure set, e.g. Preventive Care and Screening /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Set + public string? Set { - get { return SetElement != null ? SetElement.Value : null; } + get => _SetElement?.Value; set { - if (value == null) - SetElement = null; - else - SetElement = new Hl7.Fhir.Model.FhirString(value); + SetElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Set"); } } @@ -1788,11 +1682,11 @@ public string Set [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// What other data should be reported with the measure. @@ -1802,61 +1696,57 @@ public List Group [DataMember] public List SupplementalData { - get { if(_SupplementalData==null) _SupplementalData = new List(); return _SupplementalData; } + get => _SupplementalData ?? new List(); set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } - private List _SupplementalData; + private List? _SupplementalData; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Measure; - - if (dest == null) - { + if(other is not Measure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Library.Any()) dest.Library = new List(Library.DeepCopyInternal()); - if(DisclaimerElement != null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)DisclaimerElement.DeepCopyInternal(); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); - if(CompositeScoring != null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)CompositeScoring.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(RiskAdjustmentElement != null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)RiskAdjustmentElement.DeepCopyInternal(); - if(RateAggregationElement != null) dest.RateAggregationElement = (Hl7.Fhir.Model.FhirString)RateAggregationElement.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)RationaleElement.DeepCopyInternal(); - if(ClinicalRecommendationStatementElement != null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)ClinicalRecommendationStatementElement.DeepCopyInternal(); - if(ImprovementNotationElement != null) dest.ImprovementNotationElement = (Hl7.Fhir.Model.FhirString)ImprovementNotationElement.DeepCopyInternal(); - if(DefinitionElement.Any()) dest.DefinitionElement = new List(DefinitionElement.DeepCopyInternal()); - if(GuidanceElement != null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)GuidanceElement.DeepCopyInternal(); - if(SetElement != null) dest.SetElement = (Hl7.Fhir.Model.FhirString)SetElement.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(SupplementalData.Any()) dest.SupplementalData = new List(SupplementalData.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Library is not null) dest.Library = new List(_Library.DeepCopyInternal()); + if(_DisclaimerElement is not null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)_DisclaimerElement.DeepCopyInternal(); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); + if(_CompositeScoring is not null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)_CompositeScoring.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_RiskAdjustmentElement is not null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)_RiskAdjustmentElement.DeepCopyInternal(); + if(_RateAggregationElement is not null) dest.RateAggregationElement = (Hl7.Fhir.Model.FhirString)_RateAggregationElement.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)_RationaleElement.DeepCopyInternal(); + if(_ClinicalRecommendationStatementElement is not null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)_ClinicalRecommendationStatementElement.DeepCopyInternal(); + if(_ImprovementNotationElement is not null) dest.ImprovementNotationElement = (Hl7.Fhir.Model.FhirString)_ImprovementNotationElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = new List(_DefinitionElement.DeepCopyInternal()); + if(_GuidanceElement is not null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)_GuidanceElement.DeepCopyInternal(); + if(_SetElement is not null) dest.SetElement = (Hl7.Fhir.Model.FhirString)_SetElement.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_SupplementalData is not null) dest.SupplementalData = new List(_SupplementalData.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1868,286 +1758,286 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Measure; - if(otherT == null) return false; + if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Library, otherT.Library)) return false; - if(!comparer.Equals(DisclaimerElement, otherT.DisclaimerElement)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; - if(!comparer.Equals(CompositeScoring, otherT.CompositeScoring)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(RiskAdjustmentElement, otherT.RiskAdjustmentElement)) return false; - if(!comparer.Equals(RateAggregationElement, otherT.RateAggregationElement)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; - if(!comparer.Equals(ClinicalRecommendationStatementElement, otherT.ClinicalRecommendationStatementElement)) return false; - if(!comparer.Equals(ImprovementNotationElement, otherT.ImprovementNotationElement)) return false; - if(!comparer.ListEquals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(GuidanceElement, otherT.GuidanceElement)) return false; - if(!comparer.Equals(SetElement, otherT.SetElement)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.ListEquals(SupplementalData, otherT.SupplementalData)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Library, otherT._Library)) return false; + if(!comparer.Equals(_DisclaimerElement, otherT._DisclaimerElement)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; + if(!comparer.Equals(_CompositeScoring, otherT._CompositeScoring)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RiskAdjustmentElement, otherT._RiskAdjustmentElement)) return false; + if(!comparer.Equals(_RateAggregationElement, otherT._RateAggregationElement)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; + if(!comparer.Equals(_ClinicalRecommendationStatementElement, otherT._ClinicalRecommendationStatementElement)) return false; + if(!comparer.Equals(_ImprovementNotationElement, otherT._ImprovementNotationElement)) return false; + if(!comparer.ListEquals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_GuidanceElement, otherT._GuidanceElement)) return false; + if(!comparer.Equals(_SetElement, otherT._SetElement)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = Library; - return Library?.Any() == true; + value = _Library; + return _Library?.Any() == true; case "disclaimer": - value = DisclaimerElement; - return DisclaimerElement is not null; + value = _DisclaimerElement; + return _DisclaimerElement is not null; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; case "compositeScoring": - value = CompositeScoring; - return CompositeScoring is not null; + value = _CompositeScoring; + return _CompositeScoring is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "riskAdjustment": - value = RiskAdjustmentElement; - return RiskAdjustmentElement is not null; + value = _RiskAdjustmentElement; + return _RiskAdjustmentElement is not null; case "rateAggregation": - value = RateAggregationElement; - return RateAggregationElement is not null; + value = _RateAggregationElement; + return _RateAggregationElement is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; case "clinicalRecommendationStatement": - value = ClinicalRecommendationStatementElement; - return ClinicalRecommendationStatementElement is not null; + value = _ClinicalRecommendationStatementElement; + return _ClinicalRecommendationStatementElement is not null; case "improvementNotation": - value = ImprovementNotationElement; - return ImprovementNotationElement is not null; + value = _ImprovementNotationElement; + return _ImprovementNotationElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement?.Any() == true; + value = _DefinitionElement; + return _DefinitionElement?.Any() == true; case "guidance": - value = GuidanceElement; - return GuidanceElement is not null; + value = _GuidanceElement; + return _GuidanceElement is not null; case "set": - value = SetElement; - return SetElement is not null; + value = _SetElement; + return _SetElement is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "supplementalData": - value = SupplementalData; - return SupplementalData?.Any() == true; + value = _SupplementalData; + return _SupplementalData?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - Library = (List)value; + Library = (List?)value!; return this; case "disclaimer": - DisclaimerElement = (Hl7.Fhir.Model.Markdown)value; + DisclaimerElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "compositeScoring": - CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)value; + CompositeScoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "riskAdjustment": - RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)value; + RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rateAggregation": - RateAggregationElement = (Hl7.Fhir.Model.FhirString)value; + RateAggregationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.Markdown)value; + RationaleElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "clinicalRecommendationStatement": - ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)value; + ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "improvementNotation": - ImprovementNotationElement = (Hl7.Fhir.Model.FhirString)value; + ImprovementNotationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (List)value; + DefinitionElement = (List?)value!; return this; case "guidance": - GuidanceElement = (Hl7.Fhir.Model.Markdown)value; + GuidanceElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "set": - SetElement = (Hl7.Fhir.Model.FhirString)value; + SetElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "supplementalData": - SupplementalData = (List)value; + SupplementalData = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2158,43 +2048,43 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Library?.Any() == true) yield return new KeyValuePair("library",Library); - if (DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",DisclaimerElement); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); - if (CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",CompositeScoring); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",RiskAdjustmentElement); - if (RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",RateAggregationElement); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); - if (ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",ClinicalRecommendationStatementElement); - if (ImprovementNotationElement is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotationElement); - if (DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",DefinitionElement); - if (GuidanceElement is not null) yield return new KeyValuePair("guidance",GuidanceElement); - if (SetElement is not null) yield return new KeyValuePair("set",SetElement); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",SupplementalData); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Library?.Any() == true) yield return new KeyValuePair("library",_Library); + if (_DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",_DisclaimerElement); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); + if (_CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",_CompositeScoring); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",_RiskAdjustmentElement); + if (_RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",_RateAggregationElement); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); + if (_ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",_ClinicalRecommendationStatementElement); + if (_ImprovementNotationElement is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotationElement); + if (_DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",_DefinitionElement); + if (_GuidanceElement is not null) yield return new KeyValuePair("guidance",_GuidanceElement); + if (_SetElement is not null) yield return new KeyValuePair("set",_SetElement); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",_SupplementalData); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs index 1dad18e5c..9b7c7853d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -137,13 +140,13 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identifier", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// The populations in the group. @@ -153,24 +156,24 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this group achieved. /// [FhirElement("measureScore", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal MeasureScoreElement + public Hl7.Fhir.Model.FhirDecimal? MeasureScoreElement { get { return _MeasureScoreElement; } set { _MeasureScoreElement = value; OnPropertyChanged("MeasureScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _MeasureScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _MeasureScoreElement; /// /// What score this group achieved @@ -179,13 +182,10 @@ public Hl7.Fhir.Model.FhirDecimal MeasureScoreElement [IgnoreDataMember] public decimal? MeasureScore { - get { return MeasureScoreElement != null ? MeasureScoreElement.Value : null; } + get => _MeasureScoreElement?.Value; set { - if (value == null) - MeasureScoreElement = null; - else - MeasureScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + MeasureScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("MeasureScore"); } } @@ -198,26 +198,22 @@ public decimal? MeasureScore [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScoreElement != null) dest.MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal)MeasureScoreElement.DeepCopyInternal(); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScoreElement is not null) dest.MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal)_MeasureScoreElement.DeepCopyInternal(); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -229,55 +225,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScoreElement, otherT.MeasureScoreElement)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScoreElement, otherT._MeasureScoreElement)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScoreElement; - return MeasureScoreElement is not null; + value = _MeasureScoreElement; + return _MeasureScoreElement is not null; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -288,10 +284,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScoreElement is not null) yield return new KeyValuePair("measureScore",MeasureScoreElement); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScoreElement is not null) yield return new KeyValuePair("measureScore",_MeasureScoreElement); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -317,13 +313,13 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score. @@ -331,26 +327,26 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("code", InSummary=true, Order=50)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -359,13 +355,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -377,28 +370,24 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patients + public Hl7.Fhir.Model.ResourceReference? Patients { get { return _Patients; } set { _Patients = value; OnPropertyChanged("Patients"); } } - private Hl7.Fhir.Model.ResourceReference _Patients; + private Hl7.Fhir.Model.ResourceReference? _Patients; protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(Patients != null) dest.Patients = (Hl7.Fhir.Model.ResourceReference)Patients.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_Patients is not null) dest.Patients = (Hl7.Fhir.Model.ResourceReference)_Patients.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -410,55 +399,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(Patients, otherT.Patients)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_Patients, otherT._Patients)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "patients": - value = Patients; - return Patients is not null; + value = _Patients; + return _Patients is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "patients": - Patients = (Hl7.Fhir.Model.ResourceReference)value; + Patients = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -469,10 +458,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (Patients is not null) yield return new KeyValuePair("patients",Patients); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_Patients is not null) yield return new KeyValuePair("patients",_Patients); } } @@ -498,13 +487,13 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Stratum results, one for each unique value in the stratifier. @@ -514,24 +503,20 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List Stratum { - get { if(_Stratum==null) _Stratum = new List(); return _Stratum; } + get => _Stratum ?? new List(); set { _Stratum = value; OnPropertyChanged("Stratum"); } } - private List _Stratum; + private List? _Stratum; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Stratum.Any()) dest.Stratum = new List(Stratum.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Stratum is not null) dest.Stratum = new List(_Stratum.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -543,41 +528,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Stratum, otherT.Stratum)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "stratum": - value = Stratum; - return Stratum?.Any() == true; + value = _Stratum; + return _Stratum?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "stratum": - Stratum = (List)value; + Stratum = (List?)value!; return this; default: return base.SetValue(key, value); @@ -588,8 +573,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Stratum?.Any() == true) yield return new KeyValuePair("stratum",Stratum); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Stratum?.Any() == true) yield return new KeyValuePair("stratum",_Stratum); } } @@ -616,28 +601,25 @@ public partial class StratifierGroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("value", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The stratum value, e.g. male /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -650,24 +632,24 @@ public string Value [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this stratum achieved. /// [FhirElement("measureScore", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal MeasureScoreElement + public Hl7.Fhir.Model.FhirDecimal? MeasureScoreElement { get { return _MeasureScoreElement; } set { _MeasureScoreElement = value; OnPropertyChanged("MeasureScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _MeasureScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _MeasureScoreElement; /// /// What score this stratum achieved @@ -676,30 +658,23 @@ public Hl7.Fhir.Model.FhirDecimal MeasureScoreElement [IgnoreDataMember] public decimal? MeasureScore { - get { return MeasureScoreElement != null ? MeasureScoreElement.Value : null; } + get => _MeasureScoreElement?.Value; set { - if (value == null) - MeasureScoreElement = null; - else - MeasureScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + MeasureScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("MeasureScore"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupComponent; - - if (dest == null) - { + if(other is not StratifierGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScoreElement != null) dest.MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal)MeasureScoreElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScoreElement is not null) dest.MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal)_MeasureScoreElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -711,48 +686,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupComponent; - if(otherT == null) return false; + if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScoreElement, otherT.MeasureScoreElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScoreElement, otherT._MeasureScoreElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScoreElement; - return MeasureScoreElement is not null; + value = _MeasureScoreElement; + return _MeasureScoreElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + MeasureScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -763,9 +738,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScoreElement is not null) yield return new KeyValuePair("measureScore",MeasureScoreElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScoreElement is not null) yield return new KeyValuePair("measureScore",_MeasureScoreElement); } } @@ -791,13 +766,13 @@ public partial class StratifierGroupPopulationComponent : Hl7.Fhir.Model.Backbon /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score. @@ -805,26 +780,26 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("code", InSummary=true, Order=50)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -833,13 +808,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -851,28 +823,24 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patients + public Hl7.Fhir.Model.ResourceReference? Patients { get { return _Patients; } set { _Patients = value; OnPropertyChanged("Patients"); } } - private Hl7.Fhir.Model.ResourceReference _Patients; + private Hl7.Fhir.Model.ResourceReference? _Patients; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupPopulationComponent; - - if (dest == null) - { + if(other is not StratifierGroupPopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(Patients != null) dest.Patients = (Hl7.Fhir.Model.ResourceReference)Patients.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_Patients is not null) dest.Patients = (Hl7.Fhir.Model.ResourceReference)_Patients.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -884,55 +852,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupPopulationComponent; - if(otherT == null) return false; + if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(Patients, otherT.Patients)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_Patients, otherT._Patients)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "patients": - value = Patients; - return Patients is not null; + value = _Patients; + return _Patients is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "patients": - Patients = (Hl7.Fhir.Model.ResourceReference)value; + Patients = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -943,10 +911,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (Patients is not null) yield return new KeyValuePair("patients",Patients); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_Patients is not null) yield return new KeyValuePair("patients",_Patients); } } @@ -956,13 +924,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// complete | pending | error. @@ -972,13 +940,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("MeasureReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// complete | pending | error @@ -987,13 +955,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1006,13 +971,13 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status [Binding("MeasureReportType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// individual | patient-list | summary @@ -1021,13 +986,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1040,13 +1002,13 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type [References("Measure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Measure + public Hl7.Fhir.Model.ResourceReference? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.ResourceReference _Measure; + private Hl7.Fhir.Model.ResourceReference? _Measure; /// /// What patient the report is for. @@ -1055,41 +1017,38 @@ public Hl7.Fhir.Model.ResourceReference Measure [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When the report was generated. /// [FhirElement("date", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the report was generated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1101,13 +1060,13 @@ public string Date [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReportingOrganization + public Hl7.Fhir.Model.ResourceReference? ReportingOrganization { get { return _ReportingOrganization; } set { _ReportingOrganization = value; OnPropertyChanged("ReportingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ReportingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ReportingOrganization; /// /// What period the report covers. @@ -1115,13 +1074,13 @@ public Hl7.Fhir.Model.ResourceReference ReportingOrganization [FhirElement("period", InSummary=true, Order=160)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Measure results for each group. @@ -1131,11 +1090,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// What data was evaluated to produce the measure score. @@ -1144,36 +1103,32 @@ public List Group [CLSCompliant(false)] [References("Bundle")] [DataMember] - public Hl7.Fhir.Model.ResourceReference EvaluatedResources + public Hl7.Fhir.Model.ResourceReference? EvaluatedResources { get { return _EvaluatedResources; } set { _EvaluatedResources = value; OnPropertyChanged("EvaluatedResources"); } } - private Hl7.Fhir.Model.ResourceReference _EvaluatedResources; + private Hl7.Fhir.Model.ResourceReference? _EvaluatedResources; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MeasureReport; - - if (dest == null) - { + if(other is not MeasureReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.ResourceReference)Measure.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(ReportingOrganization != null) dest.ReportingOrganization = (Hl7.Fhir.Model.ResourceReference)ReportingOrganization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(EvaluatedResources != null) dest.EvaluatedResources = (Hl7.Fhir.Model.ResourceReference)EvaluatedResources.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.ResourceReference)_Measure.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_ReportingOrganization is not null) dest.ReportingOrganization = (Hl7.Fhir.Model.ResourceReference)_ReportingOrganization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_EvaluatedResources is not null) dest.EvaluatedResources = (Hl7.Fhir.Model.ResourceReference)_EvaluatedResources.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1185,97 +1140,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MeasureReport; - if(otherT == null) return false; + if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(ReportingOrganization, otherT.ReportingOrganization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.Equals(EvaluatedResources, otherT.EvaluatedResources)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_ReportingOrganization, otherT._ReportingOrganization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.Equals(_EvaluatedResources, otherT._EvaluatedResources)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "reportingOrganization": - value = ReportingOrganization; - return ReportingOrganization is not null; + value = _ReportingOrganization; + return _ReportingOrganization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "evaluatedResources": - value = EvaluatedResources; - return EvaluatedResources is not null; + value = _EvaluatedResources; + return _EvaluatedResources is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "measure": - Measure = (Hl7.Fhir.Model.ResourceReference)value; + Measure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reportingOrganization": - ReportingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ReportingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "evaluatedResources": - EvaluatedResources = (Hl7.Fhir.Model.ResourceReference)value; + EvaluatedResources = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1286,16 +1241,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (ReportingOrganization is not null) yield return new KeyValuePair("reportingOrganization",ReportingOrganization); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (EvaluatedResources is not null) yield return new KeyValuePair("evaluatedResources",EvaluatedResources); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_ReportingOrganization is not null) yield return new KeyValuePair("reportingOrganization",_ReportingOrganization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_EvaluatedResources is not null) yield return new KeyValuePair("evaluatedResources",_EvaluatedResources); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Media.cs b/src/Hl7.Fhir.STU3/Model/Generated/Media.cs index 4e93f5020..3d45adbba 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Media.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -92,11 +95,11 @@ public enum DigitalMediaType [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Procedure that caused this media to be created. @@ -108,11 +111,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// photo | video | audio. @@ -122,13 +125,13 @@ public List BasedOn [Binding("DigitalMediaType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// photo | video | audio @@ -137,13 +140,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Media.DigitalMediaType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -154,13 +154,13 @@ public Hl7.Fhir.Model.Media.DigitalMediaType? Type [FhirElement("subtype", InSummary=true, Order=120, FiveWs="class")] [Binding("DigitalMediaSubtype")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Subtype + public Hl7.Fhir.Model.CodeableConcept? Subtype { get { return _Subtype; } set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private Hl7.Fhir.Model.CodeableConcept _Subtype; + private Hl7.Fhir.Model.CodeableConcept? _Subtype; /// /// Imaging view, e.g. Lateral or Antero-posterior. @@ -168,13 +168,13 @@ public Hl7.Fhir.Model.CodeableConcept Subtype [FhirElement("view", InSummary=true, Order=130, FiveWs="class")] [Binding("MediaView")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept View + public Hl7.Fhir.Model.CodeableConcept? View { get { return _View; } set { _View = value; OnPropertyChanged("View"); } } - private Hl7.Fhir.Model.CodeableConcept _View; + private Hl7.Fhir.Model.CodeableConcept? _View; /// /// Who/What this Media is a record of. @@ -183,13 +183,13 @@ public Hl7.Fhir.Model.CodeableConcept View [CLSCompliant(false)] [References("Patient","Practitioner","Group","Device","Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with media. @@ -198,13 +198,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When Media was collected. @@ -213,13 +213,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// The person who generated the image. @@ -228,13 +228,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Operator + public Hl7.Fhir.Model.ResourceReference? Operator { get { return _Operator; } set { _Operator = value; OnPropertyChanged("Operator"); } } - private Hl7.Fhir.Model.ResourceReference _Operator; + private Hl7.Fhir.Model.ResourceReference? _Operator; /// /// Why was event performed?. @@ -245,11 +245,11 @@ public Hl7.Fhir.Model.ResourceReference Operator [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Body part in media. @@ -257,13 +257,13 @@ public List ReasonCode [FhirElement("bodySite", InSummary=true, Order=190)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Observing Device. @@ -272,26 +272,26 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Height of the image in pixels (photo/video). /// [FhirElement("height", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.PositiveInt HeightElement + public Hl7.Fhir.Model.PositiveInt? HeightElement { get { return _HeightElement; } set { _HeightElement = value; OnPropertyChanged("HeightElement"); } } - private Hl7.Fhir.Model.PositiveInt _HeightElement; + private Hl7.Fhir.Model.PositiveInt? _HeightElement; /// /// Height of the image in pixels (photo/video) @@ -300,13 +300,10 @@ public Hl7.Fhir.Model.PositiveInt HeightElement [IgnoreDataMember] public int? Height { - get { return HeightElement != null ? HeightElement.Value : null; } + get => _HeightElement?.Value; set { - if (value == null) - HeightElement = null; - else - HeightElement = new Hl7.Fhir.Model.PositiveInt(value); + HeightElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Height"); } } @@ -316,13 +313,13 @@ public int? Height /// [FhirElement("width", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.PositiveInt WidthElement + public Hl7.Fhir.Model.PositiveInt? WidthElement { get { return _WidthElement; } set { _WidthElement = value; OnPropertyChanged("WidthElement"); } } - private Hl7.Fhir.Model.PositiveInt _WidthElement; + private Hl7.Fhir.Model.PositiveInt? _WidthElement; /// /// Width of the image in pixels (photo/video) @@ -331,13 +328,10 @@ public Hl7.Fhir.Model.PositiveInt WidthElement [IgnoreDataMember] public int? Width { - get { return WidthElement != null ? WidthElement.Value : null; } + get => _WidthElement?.Value; set { - if (value == null) - WidthElement = null; - else - WidthElement = new Hl7.Fhir.Model.PositiveInt(value); + WidthElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Width"); } } @@ -347,13 +341,13 @@ public int? Width /// [FhirElement("frames", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FramesElement + public Hl7.Fhir.Model.PositiveInt? FramesElement { get { return _FramesElement; } set { _FramesElement = value; OnPropertyChanged("FramesElement"); } } - private Hl7.Fhir.Model.PositiveInt _FramesElement; + private Hl7.Fhir.Model.PositiveInt? _FramesElement; /// /// Number of frames if > 1 (photo) @@ -362,13 +356,10 @@ public Hl7.Fhir.Model.PositiveInt FramesElement [IgnoreDataMember] public int? Frames { - get { return FramesElement != null ? FramesElement.Value : null; } + get => _FramesElement?.Value; set { - if (value == null) - FramesElement = null; - else - FramesElement = new Hl7.Fhir.Model.PositiveInt(value); + FramesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Frames"); } } @@ -378,13 +369,13 @@ public int? Frames /// [FhirElement("duration", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt DurationElement + public Hl7.Fhir.Model.UnsignedInt? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.UnsignedInt _DurationElement; + private Hl7.Fhir.Model.UnsignedInt? _DurationElement; /// /// Length in seconds (audio / video) @@ -393,13 +384,10 @@ public Hl7.Fhir.Model.UnsignedInt DurationElement [IgnoreDataMember] public int? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.UnsignedInt(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Duration"); } } @@ -410,13 +398,13 @@ public int? Duration [FhirElement("content", Order=250)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Attachment Content + public Hl7.Fhir.Model.Attachment? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.Attachment _Content; + private Hl7.Fhir.Model.Attachment? _Content; /// /// Comments made about the media. @@ -426,42 +414,38 @@ public Hl7.Fhir.Model.Attachment Content [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Media; - - if (dest == null) - { + if(other is not Media dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Subtype != null) dest.Subtype = (Hl7.Fhir.Model.CodeableConcept)Subtype.DeepCopyInternal(); - if(View != null) dest.View = (Hl7.Fhir.Model.CodeableConcept)View.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Operator != null) dest.Operator = (Hl7.Fhir.Model.ResourceReference)Operator.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(HeightElement != null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)HeightElement.DeepCopyInternal(); - if(WidthElement != null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)WidthElement.DeepCopyInternal(); - if(FramesElement != null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)FramesElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.UnsignedInt)DurationElement.DeepCopyInternal(); - if(Content != null) dest.Content = (Hl7.Fhir.Model.Attachment)Content.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Subtype is not null) dest.Subtype = (Hl7.Fhir.Model.CodeableConcept)_Subtype.DeepCopyInternal(); + if(_View is not null) dest.View = (Hl7.Fhir.Model.CodeableConcept)_View.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Operator is not null) dest.Operator = (Hl7.Fhir.Model.ResourceReference)_Operator.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_HeightElement is not null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)_HeightElement.DeepCopyInternal(); + if(_WidthElement is not null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)_WidthElement.DeepCopyInternal(); + if(_FramesElement is not null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)_FramesElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.UnsignedInt)_DurationElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.Attachment)_Content.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -473,153 +457,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Media; - if(otherT == null) return false; + if(other is not Media otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Subtype, otherT.Subtype)) return false; - if(!comparer.Equals(View, otherT.View)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Operator, otherT.Operator)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(HeightElement, otherT.HeightElement)) return false; - if(!comparer.Equals(WidthElement, otherT.WidthElement)) return false; - if(!comparer.Equals(FramesElement, otherT.FramesElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Subtype, otherT._Subtype)) return false; + if(!comparer.Equals(_View, otherT._View)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Operator, otherT._Operator)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_HeightElement, otherT._HeightElement)) return false; + if(!comparer.Equals(_WidthElement, otherT._WidthElement)) return false; + if(!comparer.Equals(_FramesElement, otherT._FramesElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "subtype": - value = Subtype; - return Subtype is not null; + value = _Subtype; + return _Subtype is not null; case "view": - value = View; - return View is not null; + value = _View; + return _View is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "operator": - value = Operator; - return Operator is not null; + value = _Operator; + return _Operator is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "height": - value = HeightElement; - return HeightElement is not null; + value = _HeightElement; + return _HeightElement is not null; case "width": - value = WidthElement; - return WidthElement is not null; + value = _WidthElement; + return _WidthElement is not null; case "frames": - value = FramesElement; - return FramesElement is not null; + value = _FramesElement; + return _FramesElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "subtype": - Subtype = (Hl7.Fhir.Model.CodeableConcept)value; + Subtype = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "view": - View = (Hl7.Fhir.Model.CodeableConcept)value; + View = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "operator": - Operator = (Hl7.Fhir.Model.ResourceReference)value; + Operator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "height": - HeightElement = (Hl7.Fhir.Model.PositiveInt)value; + HeightElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "width": - WidthElement = (Hl7.Fhir.Model.PositiveInt)value; + WidthElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "frames": - FramesElement = (Hl7.Fhir.Model.PositiveInt)value; + FramesElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.UnsignedInt)value; + DurationElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "content": - Content = (Hl7.Fhir.Model.Attachment)value; + Content = (Hl7.Fhir.Model.Attachment?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -630,24 +614,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Subtype is not null) yield return new KeyValuePair("subtype",Subtype); - if (View is not null) yield return new KeyValuePair("view",View); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Operator is not null) yield return new KeyValuePair("operator",Operator); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (HeightElement is not null) yield return new KeyValuePair("height",HeightElement); - if (WidthElement is not null) yield return new KeyValuePair("width",WidthElement); - if (FramesElement is not null) yield return new KeyValuePair("frames",FramesElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (Content is not null) yield return new KeyValuePair("content",Content); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Subtype is not null) yield return new KeyValuePair("subtype",_Subtype); + if (_View is not null) yield return new KeyValuePair("view",_View); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Operator is not null) yield return new KeyValuePair("operator",_Operator); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_HeightElement is not null) yield return new KeyValuePair("height",_HeightElement); + if (_WidthElement is not null) yield return new KeyValuePair("width",_WidthElement); + if (_FramesElement is not null) yield return new KeyValuePair("frames",_FramesElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_Content is not null) yield return new KeyValuePair("content",_Content); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs b/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs index d70ebc80a..b0fd0c15c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,26 +116,26 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// Active ingredient indicator. /// [FhirElement("isActive", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsActiveElement + public Hl7.Fhir.Model.FhirBoolean? IsActiveElement { get { return _IsActiveElement; } set { _IsActiveElement = value; OnPropertyChanged("IsActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _IsActiveElement; /// /// Active ingredient indicator @@ -141,13 +144,10 @@ public Hl7.Fhir.Model.FhirBoolean IsActiveElement [IgnoreDataMember] public bool? IsActive { - get { return IsActiveElement != null ? IsActiveElement.Value : null; } + get => _IsActiveElement?.Value; set { - if (value == null) - IsActiveElement = null; - else - IsActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsActive"); } } @@ -157,27 +157,23 @@ public bool? IsActive /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Ratio Amount + public Hl7.Fhir.Model.Ratio? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Ratio _Amount; + private Hl7.Fhir.Model.Ratio? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(IsActiveElement != null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)IsActiveElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Ratio)Amount.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_IsActiveElement is not null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)_IsActiveElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Ratio)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -189,48 +185,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(IsActiveElement, otherT.IsActiveElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "isActive": - value = IsActiveElement; - return IsActiveElement is not null; + value = _IsActiveElement; + return _IsActiveElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "isActive": - IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Ratio)value; + Amount = (Hl7.Fhir.Model.Ratio?)value; return this; default: return base.SetValue(key, value); @@ -241,9 +237,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (IsActiveElement is not null) yield return new KeyValuePair("isActive",IsActiveElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_IsActiveElement is not null) yield return new KeyValuePair("isActive",_IsActiveElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -270,13 +266,13 @@ public partial class PackageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("container", Order=40)] [Binding("MedicationContainer")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Container + public Hl7.Fhir.Model.CodeableConcept? Container { get { return _Container; } set { _Container = value; OnPropertyChanged("Container"); } } - private Hl7.Fhir.Model.CodeableConcept _Container; + private Hl7.Fhir.Model.CodeableConcept? _Container; /// /// What is in the package. @@ -286,11 +282,11 @@ public Hl7.Fhir.Model.CodeableConcept Container [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// Identifies a single production run. @@ -300,25 +296,21 @@ public List Content [DataMember] public List Batch { - get { if(_Batch==null) _Batch = new List(); return _Batch; } + get => _Batch ?? new List(); set { _Batch = value; OnPropertyChanged("Batch"); } } - private List _Batch; + private List? _Batch; protected internal override void CopyToInternal(Base other) { - var dest = other as PackageComponent; - - if (dest == null) - { + if(other is not PackageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Container != null) dest.Container = (Hl7.Fhir.Model.CodeableConcept)Container.DeepCopyInternal(); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(Batch.Any()) dest.Batch = new List(Batch.DeepCopyInternal()); + if(_Container is not null) dest.Container = (Hl7.Fhir.Model.CodeableConcept)_Container.DeepCopyInternal(); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_Batch is not null) dest.Batch = new List(_Batch.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -330,48 +322,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackageComponent; - if(otherT == null) return false; + if(other is not PackageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Container, otherT.Container)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Batch, otherT.Batch)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Container, otherT._Container)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Batch, otherT._Batch)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "container": - value = Container; - return Container is not null; + value = _Container; + return _Container is not null; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "batch": - value = Batch; - return Batch?.Any() == true; + value = _Batch; + return _Batch?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "container": - Container = (Hl7.Fhir.Model.CodeableConcept)value; + Container = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "batch": - Batch = (List)value; + Batch = (List?)value!; return this; default: return base.SetValue(key, value); @@ -382,9 +374,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Container is not null) yield return new KeyValuePair("container",Container); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (Batch?.Any() == true) yield return new KeyValuePair("batch",Batch); + if (_Container is not null) yield return new KeyValuePair("container",_Container); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_Batch?.Any() == true) yield return new KeyValuePair("batch",_Batch); } } @@ -414,39 +406,35 @@ public partial class ContentComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// Quantity present in the package. /// [FhirElement("amount", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as ContentComponent; - - if (dest == null) - { + if(other is not ContentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -458,41 +446,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentComponent; - if(otherT == null) return false; + if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -503,8 +491,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -530,28 +518,25 @@ public partial class BatchComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("lotNumber", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Identifier assigned to batch /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -561,44 +546,37 @@ public string LotNumber /// [FhirElement("expirationDate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// When batch will expire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BatchComponent; - - if (dest == null) - { + if(other is not BatchComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -610,41 +588,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BatchComponent; - if(otherT == null) return false; + if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -655,8 +633,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); } } @@ -667,13 +645,13 @@ public override IEnumerable> EnumerateElements() [FhirElement("code", InSummary=true, Order=90, FiveWs="class")] [Binding("MedicationFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | inactive | entered-in-error. @@ -682,13 +660,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("MedicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -697,13 +675,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Medication.MedicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -713,13 +688,13 @@ public Hl7.Fhir.Model.Medication.MedicationStatus? Status /// [FhirElement("isBrand", InSummary=true, Order=110, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsBrandElement + public Hl7.Fhir.Model.FhirBoolean? IsBrandElement { get { return _IsBrandElement; } set { _IsBrandElement = value; OnPropertyChanged("IsBrandElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsBrandElement; + private Hl7.Fhir.Model.FhirBoolean? _IsBrandElement; /// /// True if a brand @@ -728,13 +703,10 @@ public Hl7.Fhir.Model.FhirBoolean IsBrandElement [IgnoreDataMember] public bool? IsBrand { - get { return IsBrandElement != null ? IsBrandElement.Value : null; } + get => _IsBrandElement?.Value; set { - if (value == null) - IsBrandElement = null; - else - IsBrandElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsBrandElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsBrand"); } } @@ -744,13 +716,13 @@ public bool? IsBrand /// [FhirElement("isOverTheCounter", InSummary=true, Order=120, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsOverTheCounterElement + public Hl7.Fhir.Model.FhirBoolean? IsOverTheCounterElement { get { return _IsOverTheCounterElement; } set { _IsOverTheCounterElement = value; OnPropertyChanged("IsOverTheCounterElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsOverTheCounterElement; + private Hl7.Fhir.Model.FhirBoolean? _IsOverTheCounterElement; /// /// True if medication does not require a prescription @@ -759,13 +731,10 @@ public Hl7.Fhir.Model.FhirBoolean IsOverTheCounterElement [IgnoreDataMember] public bool? IsOverTheCounter { - get { return IsOverTheCounterElement != null ? IsOverTheCounterElement.Value : null; } + get => _IsOverTheCounterElement?.Value; set { - if (value == null) - IsOverTheCounterElement = null; - else - IsOverTheCounterElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsOverTheCounterElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsOverTheCounter"); } } @@ -777,13 +746,13 @@ public bool? IsOverTheCounter [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// powder | tablets | capsule +. @@ -791,13 +760,13 @@ public Hl7.Fhir.Model.ResourceReference Manufacturer [FhirElement("form", Order=140)] [Binding("MedicationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Active or inactive ingredient. @@ -807,24 +776,24 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Details about packaged medications. /// [FhirElement("package", Order=160)] [DataMember] - public Hl7.Fhir.Model.Medication.PackageComponent Package + public Hl7.Fhir.Model.Medication.PackageComponent? Package { get { return _Package; } set { _Package = value; OnPropertyChanged("Package"); } } - private Hl7.Fhir.Model.Medication.PackageComponent _Package; + private Hl7.Fhir.Model.Medication.PackageComponent? _Package; /// /// Picture of the medication. @@ -834,31 +803,27 @@ public Hl7.Fhir.Model.Medication.PackageComponent Package [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; protected internal override void CopyToInternal(Base other) { - var dest = other as Medication; - - if (dest == null) - { + if(other is not Medication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IsBrandElement != null) dest.IsBrandElement = (Hl7.Fhir.Model.FhirBoolean)IsBrandElement.DeepCopyInternal(); - if(IsOverTheCounterElement != null) dest.IsOverTheCounterElement = (Hl7.Fhir.Model.FhirBoolean)IsOverTheCounterElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Package != null) dest.Package = (Hl7.Fhir.Model.Medication.PackageComponent)Package.DeepCopyInternal(); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IsBrandElement is not null) dest.IsBrandElement = (Hl7.Fhir.Model.FhirBoolean)_IsBrandElement.DeepCopyInternal(); + if(_IsOverTheCounterElement is not null) dest.IsOverTheCounterElement = (Hl7.Fhir.Model.FhirBoolean)_IsOverTheCounterElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Package is not null) dest.Package = (Hl7.Fhir.Model.Medication.PackageComponent)_Package.DeepCopyInternal(); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -870,90 +835,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Medication; - if(otherT == null) return false; + if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IsBrandElement, otherT.IsBrandElement)) return false; - if(!comparer.Equals(IsOverTheCounterElement, otherT.IsOverTheCounterElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(Package, otherT.Package)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IsBrandElement, otherT._IsBrandElement)) return false; + if(!comparer.Equals(_IsOverTheCounterElement, otherT._IsOverTheCounterElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_Package, otherT._Package)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "isBrand": - value = IsBrandElement; - return IsBrandElement is not null; + value = _IsBrandElement; + return _IsBrandElement is not null; case "isOverTheCounter": - value = IsOverTheCounterElement; - return IsOverTheCounterElement is not null; + value = _IsOverTheCounterElement; + return _IsOverTheCounterElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "package": - value = Package; - return Package is not null; + value = _Package; + return _Package is not null; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "isBrand": - IsBrandElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsBrandElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "isOverTheCounter": - IsOverTheCounterElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsOverTheCounterElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "package": - Package = (Hl7.Fhir.Model.Medication.PackageComponent)value; + Package = (Hl7.Fhir.Model.Medication.PackageComponent?)value; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; default: return base.SetValue(key, value); @@ -964,15 +929,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IsBrandElement is not null) yield return new KeyValuePair("isBrand",IsBrandElement); - if (IsOverTheCounterElement is not null) yield return new KeyValuePair("isOverTheCounter",IsOverTheCounterElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Package is not null) yield return new KeyValuePair("package",Package); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IsBrandElement is not null) yield return new KeyValuePair("isBrand",_IsBrandElement); + if (_IsOverTheCounterElement is not null) yield return new KeyValuePair("isOverTheCounter",_IsOverTheCounterElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Package is not null) yield return new KeyValuePair("package",_Package); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs index f8de41e15..4e38e06e3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -130,13 +133,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [References("Practitioner","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Organization organization was acting for. @@ -145,26 +148,22 @@ public Hl7.Fhir.Model.ResourceReference Actor [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -176,41 +175,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -221,8 +220,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -248,28 +247,25 @@ public partial class DosageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("text", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -280,13 +276,13 @@ public string Text [FhirElement("site", Order=50)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// Path of substance into body. @@ -294,13 +290,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=60)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// How drug was administered. @@ -308,26 +304,26 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", Order=70)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication per dose. /// [FhirElement("dose", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Dose + public Hl7.Fhir.Model.Quantity? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.Quantity _Dose; + private Hl7.Fhir.Model.Quantity? _Dose; /// /// Dose quantity per unit of time. @@ -336,30 +332,26 @@ public Hl7.Fhir.Model.Quantity Dose [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as DosageComponent; - - if (dest == null) - { + if(other is not DosageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.Quantity)Dose.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.Quantity)_Dose.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -371,69 +363,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosageComponent; - if(otherT == null) return false; + if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.Quantity)value; + Dose = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -444,12 +436,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -462,11 +454,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -478,11 +470,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// Part of referenced event. @@ -494,11 +486,11 @@ public List Definition [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | on-hold | completed | entered-in-error | stopped | unknown. @@ -508,13 +500,13 @@ public List PartOf [Binding("MedicationAdministrationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | on-hold | completed | entered-in-error | stopped | unknown @@ -523,13 +515,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -540,13 +529,13 @@ public Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatus? S [FhirElement("category", Order=130)] [Binding("MedicationAdministrationCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What was administered. @@ -558,13 +547,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who received medication. @@ -574,13 +563,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode of Care administered as part of. @@ -589,13 +578,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Additional information to support administration. @@ -607,11 +596,11 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Start and end time of administration. @@ -621,13 +610,13 @@ public List SupportingInformation [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// Who administered substance. @@ -637,24 +626,24 @@ public Hl7.Fhir.Model.DataType Effective [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// True if medication not administered. /// [FhirElement("notGiven", InSummary=true, IsModifier=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NotGivenElement + public Hl7.Fhir.Model.FhirBoolean? NotGivenElement { get { return _NotGivenElement; } set { _NotGivenElement = value; OnPropertyChanged("NotGivenElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NotGivenElement; + private Hl7.Fhir.Model.FhirBoolean? _NotGivenElement; /// /// True if medication not administered @@ -663,13 +652,10 @@ public Hl7.Fhir.Model.FhirBoolean NotGivenElement [IgnoreDataMember] public bool? NotGiven { - get { return NotGivenElement != null ? NotGivenElement.Value : null; } + get => _NotGivenElement?.Value; set { - if (value == null) - NotGivenElement = null; - else - NotGivenElement = new Hl7.Fhir.Model.FhirBoolean(value); + NotGivenElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NotGiven"); } } @@ -683,11 +669,11 @@ public bool? NotGiven [DataMember] public List ReasonNotGiven { - get { if(_ReasonNotGiven==null) _ReasonNotGiven = new List(); return _ReasonNotGiven; } + get => _ReasonNotGiven ?? new List(); set { _ReasonNotGiven = value; OnPropertyChanged("ReasonNotGiven"); } } - private List _ReasonNotGiven; + private List? _ReasonNotGiven; /// /// Reason administration performed. @@ -698,11 +684,11 @@ public List ReasonNotGiven [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or Observation that supports why the medication was administered. @@ -714,11 +700,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Request administration performed against. @@ -727,13 +713,13 @@ public List ReasonReference [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Device used to administer. @@ -745,11 +731,11 @@ public Hl7.Fhir.Model.ResourceReference Prescription [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// Information about the administration. @@ -759,24 +745,24 @@ public List Device [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Details of how medication was taken. /// [FhirElement("dosage", Order=270)] [DataMember] - public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage + public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage { get { return _Dosage; } set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private Hl7.Fhir.Model.MedicationAdministration.DosageComponent _Dosage; + private Hl7.Fhir.Model.MedicationAdministration.DosageComponent? _Dosage; /// /// A list of events of interest in the lifecycle. @@ -788,44 +774,40 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationAdministration; - - if (dest == null) - { + if(other is not MedicationAdministration dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(NotGivenElement != null) dest.NotGivenElement = (Hl7.Fhir.Model.FhirBoolean)NotGivenElement.DeepCopyInternal(); - if(ReasonNotGiven.Any()) dest.ReasonNotGiven = new List(ReasonNotGiven.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Dosage != null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)Dosage.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_NotGivenElement is not null) dest.NotGivenElement = (Hl7.Fhir.Model.FhirBoolean)_NotGivenElement.DeepCopyInternal(); + if(_ReasonNotGiven is not null) dest.ReasonNotGiven = new List(_ReasonNotGiven.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)_Dosage.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -837,167 +819,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationAdministration; - if(otherT == null) return false; + if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(NotGivenElement, otherT.NotGivenElement)) return false; - if(!comparer.ListEquals(ReasonNotGiven, otherT.ReasonNotGiven)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_NotGivenElement, otherT._NotGivenElement)) return false; + if(!comparer.ListEquals(_ReasonNotGiven, otherT._ReasonNotGiven)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "notGiven": - value = NotGivenElement; - return NotGivenElement is not null; + value = _NotGivenElement; + return _NotGivenElement is not null; case "reasonNotGiven": - value = ReasonNotGiven; - return ReasonNotGiven?.Any() == true; + value = _ReasonNotGiven; + return _ReasonNotGiven?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosage": - value = Dosage; - return Dosage is not null; + value = _Dosage; + return _Dosage is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "notGiven": - NotGivenElement = (Hl7.Fhir.Model.FhirBoolean)value; + NotGivenElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reasonNotGiven": - ReasonNotGiven = (List)value; + ReasonNotGiven = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosage": - Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)value; + Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1008,26 +990,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (NotGivenElement is not null) yield return new KeyValuePair("notGiven",NotGivenElement); - if (ReasonNotGiven?.Any() == true) yield return new KeyValuePair("reasonNotGiven",ReasonNotGiven); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Dosage is not null) yield return new KeyValuePair("dosage",Dosage); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_NotGivenElement is not null) yield return new KeyValuePair("notGiven",_NotGivenElement); + if (_ReasonNotGiven?.Any() == true) yield return new KeyValuePair("reasonNotGiven",_ReasonNotGiven); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Dosage is not null) yield return new KeyValuePair("dosage",_Dosage); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs index 201c7c536..396e374f6 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -131,13 +134,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [References("Practitioner","Organization","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Organization organization was acting for. @@ -146,26 +149,22 @@ public Hl7.Fhir.Model.ResourceReference Actor [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -177,41 +176,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -222,8 +221,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -250,13 +249,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("wasSubstituted", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement + public Hl7.Fhir.Model.FhirBoolean? WasSubstitutedElement { get { return _WasSubstitutedElement; } set { _WasSubstitutedElement = value; OnPropertyChanged("WasSubstitutedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WasSubstitutedElement; + private Hl7.Fhir.Model.FhirBoolean? _WasSubstitutedElement; /// /// Whether a substitution was or was not performed on the dispense @@ -265,13 +264,10 @@ public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement [IgnoreDataMember] public bool? WasSubstituted { - get { return WasSubstitutedElement != null ? WasSubstitutedElement.Value : null; } + get => _WasSubstitutedElement?.Value; set { - if (value == null) - WasSubstitutedElement = null; - else - WasSubstitutedElement = new Hl7.Fhir.Model.FhirBoolean(value); + WasSubstitutedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WasSubstituted"); } } @@ -282,13 +278,13 @@ public bool? WasSubstituted [FhirElement("type", Order=50)] [Binding("MedicationIntendedSubstitutionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Why was substitution made. @@ -299,11 +295,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Who is responsible for the substitution. @@ -315,26 +311,22 @@ public List Reason [DataMember] public List ResponsibleParty { - get { if(_ResponsibleParty==null) _ResponsibleParty = new List(); return _ResponsibleParty; } + get => _ResponsibleParty ?? new List(); set { _ResponsibleParty = value; OnPropertyChanged("ResponsibleParty"); } } - private List _ResponsibleParty; + private List? _ResponsibleParty; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(WasSubstitutedElement != null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)WasSubstitutedElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(ResponsibleParty.Any()) dest.ResponsibleParty = new List(ResponsibleParty.DeepCopyInternal()); + if(_WasSubstitutedElement is not null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)_WasSubstitutedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_ResponsibleParty is not null) dest.ResponsibleParty = new List(_ResponsibleParty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -346,55 +338,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(WasSubstitutedElement, otherT.WasSubstitutedElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(ResponsibleParty, otherT.ResponsibleParty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_ResponsibleParty, otherT._ResponsibleParty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "wasSubstituted": - value = WasSubstitutedElement; - return WasSubstitutedElement is not null; + value = _WasSubstitutedElement; + return _WasSubstitutedElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "responsibleParty": - value = ResponsibleParty; - return ResponsibleParty?.Any() == true; + value = _ResponsibleParty; + return _ResponsibleParty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "wasSubstituted": - WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)value; + WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "responsibleParty": - ResponsibleParty = (List)value; + ResponsibleParty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -405,10 +397,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",WasSubstitutedElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (ResponsibleParty?.Any() == true) yield return new KeyValuePair("responsibleParty",ResponsibleParty); + if (_WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",_WasSubstitutedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_ResponsibleParty?.Any() == true) yield return new KeyValuePair("responsibleParty",_ResponsibleParty); } } @@ -421,11 +413,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Event that dispense is part of. @@ -437,11 +429,11 @@ public List Identifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | on-hold | completed | entered-in-error | stopped. @@ -450,13 +442,13 @@ public List PartOf [DeclaredType(Type = typeof(Code))] [Binding("MedicationDispenseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | on-hold | completed | entered-in-error | stopped @@ -465,13 +457,10 @@ public Code StatusEl [IgnoreDataMember] public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -482,13 +471,13 @@ public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus? Status [FhirElement("category", Order=120)] [Binding("MedicationDispenseCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What medication was supplied. @@ -500,13 +489,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who the dispense is for. @@ -515,13 +504,13 @@ public Hl7.Fhir.Model.DataType Medication [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with event. @@ -530,13 +519,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Information that supports the dispensing of the medication. @@ -548,11 +537,11 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Who performed event. @@ -562,11 +551,11 @@ public List SupportingInformation [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Medication order that authorizes the dispense. @@ -578,11 +567,11 @@ public List Performer [DataMember] public List AuthorizingPrescription { - get { if(_AuthorizingPrescription==null) _AuthorizingPrescription = new List(); return _AuthorizingPrescription; } + get => _AuthorizingPrescription ?? new List(); set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } - private List _AuthorizingPrescription; + private List? _AuthorizingPrescription; /// /// Trial fill, partial fill, emergency fill, etc. @@ -590,67 +579,64 @@ public List AuthorizingPrescription [FhirElement("type", Order=190)] [Binding("MedicationDispenseType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount dispensed. /// [FhirElement("quantity", Order=200)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Amount of medication expressed as a timing amount. /// [FhirElement("daysSupply", Order=210)] [DataMember] - public Hl7.Fhir.Model.Quantity DaysSupply + public Hl7.Fhir.Model.Quantity? DaysSupply { get { return _DaysSupply; } set { _DaysSupply = value; OnPropertyChanged("DaysSupply"); } } - private Hl7.Fhir.Model.Quantity _DaysSupply; + private Hl7.Fhir.Model.Quantity? _DaysSupply; /// /// When product was packaged and reviewed. /// [FhirElement("whenPrepared", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenPreparedElement + public Hl7.Fhir.Model.FhirDateTime? WhenPreparedElement { get { return _WhenPreparedElement; } set { _WhenPreparedElement = value; OnPropertyChanged("WhenPreparedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenPreparedElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenPreparedElement; /// /// When product was packaged and reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenPrepared + public string? WhenPrepared { - get { return WhenPreparedElement != null ? WhenPreparedElement.Value : null; } + get => _WhenPreparedElement?.Value; set { - if (value == null) - WhenPreparedElement = null; - else - WhenPreparedElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenPreparedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenPrepared"); } } @@ -660,28 +646,25 @@ public string WhenPrepared /// [FhirElement("whenHandedOver", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenHandedOverElement + public Hl7.Fhir.Model.FhirDateTime? WhenHandedOverElement { get { return _WhenHandedOverElement; } set { _WhenHandedOverElement = value; OnPropertyChanged("WhenHandedOverElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenHandedOverElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenHandedOverElement; /// /// When product was given out /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenHandedOver + public string? WhenHandedOver { - get { return WhenHandedOverElement != null ? WhenHandedOverElement.Value : null; } + get => _WhenHandedOverElement?.Value; set { - if (value == null) - WhenHandedOverElement = null; - else - WhenHandedOverElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenHandedOverElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenHandedOver"); } } @@ -693,13 +676,13 @@ public string WhenHandedOver [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who collected the medication. @@ -711,11 +694,11 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; /// /// Information about the dispense. @@ -725,11 +708,11 @@ public List Receiver [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// How the medication is to be used by the patient or administered by the caregiver. @@ -739,24 +722,24 @@ public List Note [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Whether a substitution was performed on the dispense. /// [FhirElement("substitution", Order=280)] [DataMember] - public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? _Substitution; /// /// Clinical issue with action. @@ -768,24 +751,24 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution [DataMember] public List DetectedIssue { - get { if(_DetectedIssue==null) _DetectedIssue = new List(); return _DetectedIssue; } + get => _DetectedIssue ?? new List(); set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } - private List _DetectedIssue; + private List? _DetectedIssue; /// /// Whether the dispense was or was not performed. /// [FhirElement("notDone", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NotDoneElement + public Hl7.Fhir.Model.FhirBoolean? NotDoneElement { get { return _NotDoneElement; } set { _NotDoneElement = value; OnPropertyChanged("NotDoneElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NotDoneElement; + private Hl7.Fhir.Model.FhirBoolean? _NotDoneElement; /// /// Whether the dispense was or was not performed @@ -794,13 +777,10 @@ public Hl7.Fhir.Model.FhirBoolean NotDoneElement [IgnoreDataMember] public bool? NotDone { - get { return NotDoneElement != null ? NotDoneElement.Value : null; } + get => _NotDoneElement?.Value; set { - if (value == null) - NotDoneElement = null; - else - NotDoneElement = new Hl7.Fhir.Model.FhirBoolean(value); + NotDoneElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NotDone"); } } @@ -813,13 +793,13 @@ public bool? NotDone [References("DetectedIssue")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType NotDoneReason + public Hl7.Fhir.Model.DataType? NotDoneReason { get { return _NotDoneReason; } set { _NotDoneReason = value; OnPropertyChanged("NotDoneReason"); } } - private Hl7.Fhir.Model.DataType _NotDoneReason; + private Hl7.Fhir.Model.DataType? _NotDoneReason; /// /// A list of releveant lifecycle events. @@ -831,48 +811,44 @@ public Hl7.Fhir.Model.DataType NotDoneReason [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationDispense; - - if (dest == null) - { + if(other is not MedicationDispense dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(AuthorizingPrescription.Any()) dest.AuthorizingPrescription = new List(AuthorizingPrescription.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(DaysSupply != null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)DaysSupply.DeepCopyInternal(); - if(WhenPreparedElement != null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)WhenPreparedElement.DeepCopyInternal(); - if(WhenHandedOverElement != null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(DetectedIssue.Any()) dest.DetectedIssue = new List(DetectedIssue.DeepCopyInternal()); - if(NotDoneElement != null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)NotDoneElement.DeepCopyInternal(); - if(NotDoneReason != null) dest.NotDoneReason = (Hl7.Fhir.Model.DataType)NotDoneReason.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_AuthorizingPrescription is not null) dest.AuthorizingPrescription = new List(_AuthorizingPrescription.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_DaysSupply is not null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)_DaysSupply.DeepCopyInternal(); + if(_WhenPreparedElement is not null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)_WhenPreparedElement.DeepCopyInternal(); + if(_WhenHandedOverElement is not null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)_WhenHandedOverElement.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_DetectedIssue is not null) dest.DetectedIssue = new List(_DetectedIssue.DeepCopyInternal()); + if(_NotDoneElement is not null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)_NotDoneElement.DeepCopyInternal(); + if(_NotDoneReason is not null) dest.NotDoneReason = (Hl7.Fhir.Model.DataType)_NotDoneReason.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -884,195 +860,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationDispense; - if(otherT == null) return false; + if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(AuthorizingPrescription, otherT.AuthorizingPrescription)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(DaysSupply, otherT.DaysSupply)) return false; - if(!comparer.Equals(WhenPreparedElement, otherT.WhenPreparedElement)) return false; - if(!comparer.Equals(WhenHandedOverElement, otherT.WhenHandedOverElement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(DetectedIssue, otherT.DetectedIssue)) return false; - if(!comparer.Equals(NotDoneElement, otherT.NotDoneElement)) return false; - if(!comparer.Equals(NotDoneReason, otherT.NotDoneReason)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_AuthorizingPrescription, otherT._AuthorizingPrescription)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_DaysSupply, otherT._DaysSupply)) return false; + if(!comparer.Equals(_WhenPreparedElement, otherT._WhenPreparedElement)) return false; + if(!comparer.Equals(_WhenHandedOverElement, otherT._WhenHandedOverElement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; + if(!comparer.Equals(_NotDoneElement, otherT._NotDoneElement)) return false; + if(!comparer.Equals(_NotDoneReason, otherT._NotDoneReason)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "authorizingPrescription": - value = AuthorizingPrescription; - return AuthorizingPrescription?.Any() == true; + value = _AuthorizingPrescription; + return _AuthorizingPrescription?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "daysSupply": - value = DaysSupply; - return DaysSupply is not null; + value = _DaysSupply; + return _DaysSupply is not null; case "whenPrepared": - value = WhenPreparedElement; - return WhenPreparedElement is not null; + value = _WhenPreparedElement; + return _WhenPreparedElement is not null; case "whenHandedOver": - value = WhenHandedOverElement; - return WhenHandedOverElement is not null; + value = _WhenHandedOverElement; + return _WhenHandedOverElement is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "detectedIssue": - value = DetectedIssue; - return DetectedIssue?.Any() == true; + value = _DetectedIssue; + return _DetectedIssue?.Any() == true; case "notDone": - value = NotDoneElement; - return NotDoneElement is not null; + value = _NotDoneElement; + return _NotDoneElement is not null; case "notDoneReason": - value = NotDoneReason; - return NotDoneReason is not null; + value = _NotDoneReason; + return _NotDoneReason is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "authorizingPrescription": - AuthorizingPrescription = (List)value; + AuthorizingPrescription = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "daysSupply": - DaysSupply = (Hl7.Fhir.Model.Quantity)value; + DaysSupply = (Hl7.Fhir.Model.Quantity?)value; return this; case "whenPrepared": - WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "whenHandedOver": - WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent?)value; return this; case "detectedIssue": - DetectedIssue = (List)value; + DetectedIssue = (List?)value!; return this; case "notDone": - NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)value; + NotDoneElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "notDoneReason": - NotDoneReason = (Hl7.Fhir.Model.DataType)value; + NotDoneReason = (Hl7.Fhir.Model.DataType?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1083,30 +1059,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",AuthorizingPrescription); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (DaysSupply is not null) yield return new KeyValuePair("daysSupply",DaysSupply); - if (WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",WhenPreparedElement); - if (WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",WhenHandedOverElement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",DetectedIssue); - if (NotDoneElement is not null) yield return new KeyValuePair("notDone",NotDoneElement); - if (NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",NotDoneReason); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",_AuthorizingPrescription); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_DaysSupply is not null) yield return new KeyValuePair("daysSupply",_DaysSupply); + if (_WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",_WhenPreparedElement); + if (_WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",_WhenHandedOverElement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",_DetectedIssue); + if (_NotDoneElement is not null) yield return new KeyValuePair("notDone",_NotDoneElement); + if (_NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",_NotDoneReason); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs index a23d298d7..2dfb45567 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -209,13 +212,13 @@ public partial class RequesterComponent : Hl7.Fhir.Model.BackboneElement [References("Practitioner","Organization","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Agent + public Hl7.Fhir.Model.ResourceReference? Agent { get { return _Agent; } set { _Agent = value; OnPropertyChanged("Agent"); } } - private Hl7.Fhir.Model.ResourceReference _Agent; + private Hl7.Fhir.Model.ResourceReference? _Agent; /// /// Organization agent is acting for. @@ -224,26 +227,22 @@ public Hl7.Fhir.Model.ResourceReference Agent [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as RequesterComponent; - - if (dest == null) - { + if(other is not RequesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Agent != null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)Agent.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)_Agent.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -255,41 +254,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequesterComponent; - if(otherT == null) return false; + if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "agent": - value = Agent; - return Agent is not null; + value = _Agent; + return _Agent is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "agent": - Agent = (Hl7.Fhir.Model.ResourceReference)value; + Agent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -300,8 +299,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Agent is not null) yield return new KeyValuePair("agent",Agent); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Agent is not null) yield return new KeyValuePair("agent",_Agent); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -327,26 +326,26 @@ public partial class DispenseRequestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("validityPeriod", Order=40)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// Number of refills authorized. /// [FhirElement("numberOfRepeatsAllowed", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberOfRepeatsAllowedElement + public Hl7.Fhir.Model.PositiveInt? NumberOfRepeatsAllowedElement { get { return _NumberOfRepeatsAllowedElement; } set { _NumberOfRepeatsAllowedElement = value; OnPropertyChanged("NumberOfRepeatsAllowedElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberOfRepeatsAllowedElement; + private Hl7.Fhir.Model.PositiveInt? _NumberOfRepeatsAllowedElement; /// /// Number of refills authorized @@ -355,13 +354,10 @@ public Hl7.Fhir.Model.PositiveInt NumberOfRepeatsAllowedElement [IgnoreDataMember] public int? NumberOfRepeatsAllowed { - get { return NumberOfRepeatsAllowedElement != null ? NumberOfRepeatsAllowedElement.Value : null; } + get => _NumberOfRepeatsAllowedElement?.Value; set { - if (value == null) - NumberOfRepeatsAllowedElement = null; - else - NumberOfRepeatsAllowedElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberOfRepeatsAllowedElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("NumberOfRepeatsAllowed"); } } @@ -371,26 +367,26 @@ public int? NumberOfRepeatsAllowed /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Number of days supply per dispense. /// [FhirElement("expectedSupplyDuration", Order=70)] [DataMember] - public Hl7.Fhir.Model.Duration ExpectedSupplyDuration + public Hl7.Fhir.Model.Duration? ExpectedSupplyDuration { get { return _ExpectedSupplyDuration; } set { _ExpectedSupplyDuration = value; OnPropertyChanged("ExpectedSupplyDuration"); } } - private Hl7.Fhir.Model.Duration _ExpectedSupplyDuration; + private Hl7.Fhir.Model.Duration? _ExpectedSupplyDuration; /// /// Intended dispenser. @@ -399,29 +395,25 @@ public Hl7.Fhir.Model.Duration ExpectedSupplyDuration [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; protected internal override void CopyToInternal(Base other) { - var dest = other as DispenseRequestComponent; - - if (dest == null) - { + if(other is not DispenseRequestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(NumberOfRepeatsAllowedElement != null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.PositiveInt)NumberOfRepeatsAllowedElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ExpectedSupplyDuration != null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)ExpectedSupplyDuration.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_NumberOfRepeatsAllowedElement is not null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.PositiveInt)_NumberOfRepeatsAllowedElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ExpectedSupplyDuration is not null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)_ExpectedSupplyDuration.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -433,62 +425,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DispenseRequestComponent; - if(otherT == null) return false; + if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(NumberOfRepeatsAllowedElement, otherT.NumberOfRepeatsAllowedElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ExpectedSupplyDuration, otherT.ExpectedSupplyDuration)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ExpectedSupplyDuration, otherT._ExpectedSupplyDuration)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "numberOfRepeatsAllowed": - value = NumberOfRepeatsAllowedElement; - return NumberOfRepeatsAllowedElement is not null; + value = _NumberOfRepeatsAllowedElement; + return _NumberOfRepeatsAllowedElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "expectedSupplyDuration": - value = ExpectedSupplyDuration; - return ExpectedSupplyDuration is not null; + value = _ExpectedSupplyDuration; + return _ExpectedSupplyDuration is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "numberOfRepeatsAllowed": - NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "expectedSupplyDuration": - ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)value; + ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -499,11 +491,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",NumberOfRepeatsAllowedElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",ExpectedSupplyDuration); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",_NumberOfRepeatsAllowedElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",_ExpectedSupplyDuration); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); } } @@ -530,13 +522,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("allowed", IsModifier=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllowedElement + public Hl7.Fhir.Model.FhirBoolean? AllowedElement { get { return _AllowedElement; } set { _AllowedElement = value; OnPropertyChanged("AllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _AllowedElement; /// /// Whether substitution is allowed or not @@ -545,13 +537,10 @@ public Hl7.Fhir.Model.FhirBoolean AllowedElement [IgnoreDataMember] public bool? Allowed { - get { return AllowedElement != null ? AllowedElement.Value : null; } + get => _AllowedElement?.Value; set { - if (value == null) - AllowedElement = null; - else - AllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Allowed"); } } @@ -562,26 +551,22 @@ public bool? Allowed [FhirElement("reason", Order=50)] [Binding("MedicationIntendedSubstitutionReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AllowedElement != null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)AllowedElement.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_AllowedElement is not null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)_AllowedElement.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -593,41 +578,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AllowedElement, otherT.AllowedElement)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "allowed": - value = AllowedElement; - return AllowedElement is not null; + value = _AllowedElement; + return _AllowedElement is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "allowed": - AllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -638,8 +623,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AllowedElement is not null) yield return new KeyValuePair("allowed",AllowedElement); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_AllowedElement is not null) yield return new KeyValuePair("allowed",_AllowedElement); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -652,11 +637,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Protocol or definition. @@ -668,11 +653,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// What request fulfills. @@ -684,24 +669,24 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown. @@ -710,13 +695,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DeclaredType(Type = typeof(Code))] [Binding("MedicationRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown @@ -725,13 +710,10 @@ public Code StatusElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationRequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -744,13 +726,13 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestStatus? Status [Binding("MedicationRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | instance-order @@ -759,13 +741,10 @@ public Code IntentElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -776,13 +755,13 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent [FhirElement("category", Order=150, FiveWs="class")] [Binding("MedicationRequestCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// routine | urgent | stat | asap. @@ -791,13 +770,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [DeclaredType(Type = typeof(Code))] [Binding("MedicationRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | stat | asap @@ -806,13 +785,10 @@ public Code Priority [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationRequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -827,13 +803,13 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestPriority? Priority [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who or group medication request is for. @@ -843,13 +819,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Created during encounter/admission/stay. @@ -858,13 +834,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Information to support ordering of the medication. @@ -876,39 +852,36 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// When request was initially authored. /// [FhirElement("authoredOn", InSummary=true, Order=210, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request was initially authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -918,13 +891,13 @@ public string AuthoredOn /// [FhirElement("requester", InSummary=true, Order=220, FiveWs="who.author")] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.RequesterComponent Requester + public Hl7.Fhir.Model.MedicationRequest.RequesterComponent? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.MedicationRequest.RequesterComponent _Requester; + private Hl7.Fhir.Model.MedicationRequest.RequesterComponent? _Requester; /// /// Person who entered the request. @@ -933,13 +906,13 @@ public Hl7.Fhir.Model.MedicationRequest.RequesterComponent Requester [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Reason or indication for writing the prescription. @@ -950,11 +923,11 @@ public Hl7.Fhir.Model.ResourceReference Recorder [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or Observation that supports why the prescription is being written. @@ -966,11 +939,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Information about the prescription. @@ -980,11 +953,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// How the medication should be taken. @@ -994,37 +967,37 @@ public List Note [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Medication supply authorization. /// [FhirElement("dispenseRequest", Order=280)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent DispenseRequest + public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? DispenseRequest { get { return _DispenseRequest; } set { _DispenseRequest = value; OnPropertyChanged("DispenseRequest"); } } - private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent _DispenseRequest; + private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? _DispenseRequest; /// /// Any restrictions on medication substitution. /// [FhirElement("substitution", Order=290)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? _Substitution; /// /// An order/prescription that is being replaced. @@ -1033,13 +1006,13 @@ public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PriorPrescription + public Hl7.Fhir.Model.ResourceReference? PriorPrescription { get { return _PriorPrescription; } set { _PriorPrescription = value; OnPropertyChanged("PriorPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _PriorPrescription; + private Hl7.Fhir.Model.ResourceReference? _PriorPrescription; /// /// Clinical Issue with action. @@ -1051,11 +1024,11 @@ public Hl7.Fhir.Model.ResourceReference PriorPrescription [DataMember] public List DetectedIssue { - get { if(_DetectedIssue==null) _DetectedIssue = new List(); return _DetectedIssue; } + get => _DetectedIssue ?? new List(); set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } - private List _DetectedIssue; + private List? _DetectedIssue; /// /// A list of events of interest in the lifecycle. @@ -1067,48 +1040,44 @@ public List DetectedIssue [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationRequest; - - if (dest == null) - { + if(other is not MedicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.MedicationRequest.RequesterComponent)Requester.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(DispenseRequest != null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)DispenseRequest.DeepCopyInternal(); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(PriorPrescription != null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)PriorPrescription.DeepCopyInternal(); - if(DetectedIssue.Any()) dest.DetectedIssue = new List(DetectedIssue.DeepCopyInternal()); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.MedicationRequest.RequesterComponent)_Requester.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_DispenseRequest is not null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)_DispenseRequest.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_PriorPrescription is not null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)_PriorPrescription.DeepCopyInternal(); + if(_DetectedIssue is not null) dest.DetectedIssue = new List(_DetectedIssue.DeepCopyInternal()); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1120,195 +1089,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationRequest; - if(otherT == null) return false; + if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(DispenseRequest, otherT.DispenseRequest)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.Equals(PriorPrescription, otherT.PriorPrescription)) return false; - if(!comparer.ListEquals(DetectedIssue, otherT.DetectedIssue)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_DispenseRequest, otherT._DispenseRequest)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; + if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "dispenseRequest": - value = DispenseRequest; - return DispenseRequest is not null; + value = _DispenseRequest; + return _DispenseRequest is not null; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "priorPrescription": - value = PriorPrescription; - return PriorPrescription is not null; + value = _PriorPrescription; + return _PriorPrescription is not null; case "detectedIssue": - value = DetectedIssue; - return DetectedIssue?.Any() == true; + value = _DetectedIssue; + return _DetectedIssue?.Any() == true; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.MedicationRequest.RequesterComponent)value; + Requester = (Hl7.Fhir.Model.MedicationRequest.RequesterComponent?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "dispenseRequest": - DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)value; + DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent?)value; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent?)value; return this; case "priorPrescription": - PriorPrescription = (Hl7.Fhir.Model.ResourceReference)value; + PriorPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "detectedIssue": - DetectedIssue = (List)value; + DetectedIssue = (List?)value!; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1319,30 +1288,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",DispenseRequest); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",PriorPrescription); - if (DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",DetectedIssue); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",_DispenseRequest); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",_PriorPrescription); + if (_DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",_DetectedIssue); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs index 83289cd77..2b2615abe 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -158,11 +161,11 @@ public enum MedicationStatementTaken [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfils plan, proposal or order. @@ -174,11 +177,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -190,11 +193,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Encounter / Episode associated with MedicationStatement. @@ -203,13 +206,13 @@ public List PartOf [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// active | completed | entered-in-error | intended | stopped | on-hold. @@ -219,13 +222,13 @@ public Hl7.Fhir.Model.ResourceReference Context [Binding("MedicationStatementStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | completed | entered-in-error | intended | stopped | on-hold @@ -234,13 +237,10 @@ public Code Status [IgnoreDataMember] public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -251,13 +251,13 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatus? Status [FhirElement("category", InSummary=true, Order=140, FiveWs="class")] [Binding("MedicationStatementCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What medication was taken. @@ -269,13 +269,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// The date/time or interval when the medication was taken. @@ -284,41 +284,38 @@ public Hl7.Fhir.Model.DataType Medication [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the statement was asserted?. /// [FhirElement("dateAsserted", InSummary=true, Order=170, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateAssertedElement + public Hl7.Fhir.Model.FhirDateTime? DateAssertedElement { get { return _DateAssertedElement; } set { _DateAssertedElement = value; OnPropertyChanged("DateAssertedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateAssertedElement; + private Hl7.Fhir.Model.FhirDateTime? _DateAssertedElement; /// /// When the statement was asserted? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateAsserted + public string? DateAsserted { - get { return DateAssertedElement != null ? DateAssertedElement.Value : null; } + get => _DateAssertedElement?.Value; set { - if (value == null) - DateAssertedElement = null; - else - DateAssertedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateAssertedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateAsserted"); } } @@ -330,13 +327,13 @@ public string DateAsserted [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InformationSource + public Hl7.Fhir.Model.ResourceReference? InformationSource { get { return _InformationSource; } set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private Hl7.Fhir.Model.ResourceReference _InformationSource; + private Hl7.Fhir.Model.ResourceReference? _InformationSource; /// /// Who is/was taking the medication. @@ -346,13 +343,13 @@ public Hl7.Fhir.Model.ResourceReference InformationSource [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Additional supporting information. @@ -364,11 +361,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// y | n | unk | na. @@ -378,13 +375,13 @@ public List DerivedFrom [Binding("MedicationStatementTaken")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TakenElement + public Code? TakenElement { get { return _TakenElement; } set { _TakenElement = value; OnPropertyChanged("TakenElement"); } } - private Code _TakenElement; + private Code? _TakenElement; /// /// y | n | unk | na @@ -393,13 +390,10 @@ public Code TakenEl [IgnoreDataMember] public Hl7.Fhir.Model.MedicationStatement.MedicationStatementTaken? Taken { - get { return TakenElement != null ? TakenElement.Value : null; } + get => _TakenElement?.Value; set { - if (value == null) - TakenElement = null; - else - TakenElement = new Code(value); + TakenElement = value is null ? null : new Code(value); OnPropertyChanged("Taken"); } } @@ -413,11 +407,11 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatementTaken? Taken [DataMember] public List ReasonNotTaken { - get { if(_ReasonNotTaken==null) _ReasonNotTaken = new List(); return _ReasonNotTaken; } + get => _ReasonNotTaken ?? new List(); set { _ReasonNotTaken = value; OnPropertyChanged("ReasonNotTaken"); } } - private List _ReasonNotTaken; + private List? _ReasonNotTaken; /// /// Reason for why the medication is being/was taken. @@ -428,11 +422,11 @@ public List ReasonNotTaken [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or observation that supports why the medication is being/was taken. @@ -444,11 +438,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Further information about the statement. @@ -458,11 +452,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Details of how medication is/was taken or should be taken. @@ -472,42 +466,38 @@ public List Note [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationStatement; - - if (dest == null) - { + if(other is not MedicationStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateAssertedElement != null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopyInternal(); - if(InformationSource != null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(TakenElement != null) dest.TakenElement = (Code)TakenElement.DeepCopyInternal(); - if(ReasonNotTaken.Any()) dest.ReasonNotTaken = new List(ReasonNotTaken.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateAssertedElement is not null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)_DateAssertedElement.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)_InformationSource.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_TakenElement is not null) dest.TakenElement = (Code)_TakenElement.DeepCopyInternal(); + if(_ReasonNotTaken is not null) dest.ReasonNotTaken = new List(_ReasonNotTaken.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -519,153 +509,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationStatement; - if(otherT == null) return false; + if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateAssertedElement, otherT.DateAssertedElement)) return false; - if(!comparer.Equals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.Equals(TakenElement, otherT.TakenElement)) return false; - if(!comparer.ListEquals(ReasonNotTaken, otherT.ReasonNotTaken)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateAssertedElement, otherT._DateAssertedElement)) return false; + if(!comparer.Equals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.Equals(_TakenElement, otherT._TakenElement)) return false; + if(!comparer.ListEquals(_ReasonNotTaken, otherT._ReasonNotTaken)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "dateAsserted": - value = DateAssertedElement; - return DateAssertedElement is not null; + value = _DateAssertedElement; + return _DateAssertedElement is not null; case "informationSource": - value = InformationSource; - return InformationSource is not null; + value = _InformationSource; + return _InformationSource is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "taken": - value = TakenElement; - return TakenElement is not null; + value = _TakenElement; + return _TakenElement is not null; case "reasonNotTaken": - value = ReasonNotTaken; - return ReasonNotTaken?.Any() == true; + value = _ReasonNotTaken; + return _ReasonNotTaken?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "dateAsserted": - DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "informationSource": - InformationSource = (Hl7.Fhir.Model.ResourceReference)value; + InformationSource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "taken": - TakenElement = (Code)value; + TakenElement = (Code?)value; return this; case "reasonNotTaken": - ReasonNotTaken = (List)value; + ReasonNotTaken = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -676,24 +666,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",DateAssertedElement); - if (InformationSource is not null) yield return new KeyValuePair("informationSource",InformationSource); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (TakenElement is not null) yield return new KeyValuePair("taken",TakenElement); - if (ReasonNotTaken?.Any() == true) yield return new KeyValuePair("reasonNotTaken",ReasonNotTaken); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",_DateAssertedElement); + if (_InformationSource is not null) yield return new KeyValuePair("informationSource",_InformationSource); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_TakenElement is not null) yield return new KeyValuePair("taken",_TakenElement); + if (_ReasonNotTaken?.Any() == true) yield return new KeyValuePair("reasonNotTaken",_ReasonNotTaken); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs index 8350b930e..10f1cc883 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class FocusComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Type of resource @@ -99,13 +102,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -117,26 +117,26 @@ public Hl7.Fhir.Model.ResourceType? Code [CLSCompliant(false)] [References("StructureDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Profile + public Hl7.Fhir.Model.ResourceReference? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.ResourceReference _Profile; + private Hl7.Fhir.Model.ResourceReference? _Profile; /// /// Minimum number of focuses of this type. /// [FhirElement("min", Order=60)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Minimum number of focuses of this type @@ -145,13 +145,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -161,46 +158,39 @@ public int? Min /// [FhirElement("max", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum number of focuses of this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FocusComponent; - - if (dest == null) - { + if(other is not FocusComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)Profile.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)_Profile.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -212,55 +202,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocusComponent; - if(otherT == null) return false; + if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.ResourceReference)value; + Profile = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -271,10 +261,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); } } @@ -304,57 +294,50 @@ public partial class AllowedResponseComponent : Hl7.Fhir.Model.BackboneElement [References("MessageDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Message + public Hl7.Fhir.Model.ResourceReference? Message { get { return _Message; } set { _Message = value; OnPropertyChanged("Message"); } } - private Hl7.Fhir.Model.ResourceReference _Message; + private Hl7.Fhir.Model.ResourceReference? _Message; /// /// When should this response be used. /// [FhirElement("situation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown SituationElement + public Hl7.Fhir.Model.Markdown? SituationElement { get { return _SituationElement; } set { _SituationElement = value; OnPropertyChanged("SituationElement"); } } - private Hl7.Fhir.Model.Markdown _SituationElement; + private Hl7.Fhir.Model.Markdown? _SituationElement; /// /// When should this response be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Situation + public string? Situation { - get { return SituationElement != null ? SituationElement.Value : null; } + get => _SituationElement?.Value; set { - if (value == null) - SituationElement = null; - else - SituationElement = new Hl7.Fhir.Model.Markdown(value); + SituationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Situation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AllowedResponseComponent; - - if (dest == null) - { + if(other is not AllowedResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Message != null) dest.Message = (Hl7.Fhir.Model.ResourceReference)Message.DeepCopyInternal(); - if(SituationElement != null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)SituationElement.DeepCopyInternal(); + if(_Message is not null) dest.Message = (Hl7.Fhir.Model.ResourceReference)_Message.DeepCopyInternal(); + if(_SituationElement is not null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)_SituationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -366,41 +349,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllowedResponseComponent; - if(otherT == null) return false; + if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Message, otherT.Message)) return false; - if(!comparer.Equals(SituationElement, otherT.SituationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Message, otherT._Message)) return false; + if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "message": - value = Message; - return Message is not null; + value = _Message; + return _Message is not null; case "situation": - value = SituationElement; - return SituationElement is not null; + value = _SituationElement; + return _SituationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "message": - Message = (Hl7.Fhir.Model.ResourceReference)value; + Message = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "situation": - SituationElement = (Hl7.Fhir.Model.Markdown)value; + SituationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -411,8 +394,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Message is not null) yield return new KeyValuePair("message",Message); - if (SituationElement is not null) yield return new KeyValuePair("situation",SituationElement); + if (_Message is not null) yield return new KeyValuePair("message",_Message); + if (_SituationElement is not null) yield return new KeyValuePair("situation",_SituationElement); } } @@ -422,28 +405,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this message definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -453,41 +433,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the message definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -497,28 +474,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this message definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -528,28 +502,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this message definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -562,13 +533,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -577,13 +548,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -593,13 +561,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -608,13 +576,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -625,28 +590,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -656,28 +618,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -690,39 +649,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the message definition. /// [FhirElement("description", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -735,11 +691,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for message definition (if applicable). @@ -750,39 +706,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this message definition is defined. /// [FhirElement("purpose", InSummary=true, Order=220, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this message definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -792,28 +745,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -825,13 +775,13 @@ public string Copyright [CLSCompliant(false)] [References("MessageDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Base + public Hl7.Fhir.Model.ResourceReference? Base { get { return _Base; } set { _Base = value; OnPropertyChanged("Base"); } } - private Hl7.Fhir.Model.ResourceReference _Base; + private Hl7.Fhir.Model.ResourceReference? _Base; /// /// Protocol/workflow this is part of. @@ -843,11 +793,11 @@ public Hl7.Fhir.Model.ResourceReference Base [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// Takes the place of. @@ -859,11 +809,11 @@ public List Parent [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Event type. @@ -872,13 +822,13 @@ public List Replaces [Binding("MessageEvent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Event + public Hl7.Fhir.Model.Coding? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.Coding _Event; + private Hl7.Fhir.Model.Coding? _Event; /// /// Consequence | Currency | Notification. @@ -887,13 +837,13 @@ public Hl7.Fhir.Model.Coding Event [DeclaredType(Type = typeof(Code))] [Binding("MessageSignificanceCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// Consequence | Currency | Notification @@ -902,13 +852,10 @@ public Code CategoryElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageSignificanceCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -921,24 +868,24 @@ public Hl7.Fhir.Model.MessageSignificanceCategory? Category [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Is a response required?. /// [FhirElement("responseRequired", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponseRequiredElement + public Hl7.Fhir.Model.FhirBoolean? ResponseRequiredElement { get { return _ResponseRequiredElement; } set { _ResponseRequiredElement = value; OnPropertyChanged("ResponseRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponseRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponseRequiredElement; /// /// Is a response required? @@ -947,13 +894,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponseRequiredElement [IgnoreDataMember] public bool? ResponseRequired { - get { return ResponseRequiredElement != null ? ResponseRequiredElement.Value : null; } + get => _ResponseRequiredElement?.Value; set { - if (value == null) - ResponseRequiredElement = null; - else - ResponseRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponseRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ResponseRequired"); } } @@ -966,47 +910,43 @@ public bool? ResponseRequired [DataMember] public List AllowedResponse { - get { if(_AllowedResponse==null) _AllowedResponse = new List(); return _AllowedResponse; } + get => _AllowedResponse ?? new List(); set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } - private List _AllowedResponse; + private List? _AllowedResponse; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDefinition; - - if (dest == null) - { + if(other is not MessageDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Base != null) dest.Base = (Hl7.Fhir.Model.ResourceReference)Base.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(Event != null) dest.Event = (Hl7.Fhir.Model.Coding)Event.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(ResponseRequiredElement != null) dest.ResponseRequiredElement = (Hl7.Fhir.Model.FhirBoolean)ResponseRequiredElement.DeepCopyInternal(); - if(AllowedResponse.Any()) dest.AllowedResponse = new List(AllowedResponse.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Base is not null) dest.Base = (Hl7.Fhir.Model.ResourceReference)_Base.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.Coding)_Event.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_ResponseRequiredElement is not null) dest.ResponseRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_ResponseRequiredElement.DeepCopyInternal(); + if(_AllowedResponse is not null) dest.AllowedResponse = new List(_AllowedResponse.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1018,188 +958,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDefinition; - if(otherT == null) return false; + if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(Base, otherT.Base)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(ResponseRequiredElement, otherT.ResponseRequiredElement)) return false; - if(!comparer.ListEquals(AllowedResponse, otherT.AllowedResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_Base, otherT._Base)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; + if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "base": - value = Base; - return Base is not null; + value = _Base; + return _Base is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "responseRequired": - value = ResponseRequiredElement; - return ResponseRequiredElement is not null; + value = _ResponseRequiredElement; + return _ResponseRequiredElement is not null; case "allowedResponse": - value = AllowedResponse; - return AllowedResponse?.Any() == true; + value = _AllowedResponse; + return _AllowedResponse?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "base": - Base = (Hl7.Fhir.Model.ResourceReference)value; + Base = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "event": - Event = (Hl7.Fhir.Model.Coding)value; + Event = (Hl7.Fhir.Model.Coding?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "responseRequired": - ResponseRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponseRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "allowedResponse": - AllowedResponse = (List)value; + AllowedResponse = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1210,29 +1150,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Base is not null) yield return new KeyValuePair("base",Base); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",ResponseRequiredElement); - if (AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",AllowedResponse); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Base is not null) yield return new KeyValuePair("base",_Base); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",_ResponseRequiredElement); + if (_AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",_AllowedResponse); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs index d1b4e2285..271ef0df9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,28 +112,25 @@ public partial class MessageDestinationComponent : Hl7.Fhir.Model.BackboneElemen /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -142,13 +142,13 @@ public string Name [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// Actual destination address or id. @@ -156,45 +156,38 @@ public Hl7.Fhir.Model.ResourceReference Target [FhirElement("endpoint", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri EndpointElement + public Hl7.Fhir.Model.FhirUri? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUri _EndpointElement; + private Hl7.Fhir.Model.FhirUri? _EndpointElement; /// /// Actual destination address or id /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUri(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Endpoint"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDestinationComponent; - - if (dest == null) - { + if(other is not MessageDestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUri)EndpointElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUri)_EndpointElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -206,48 +199,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDestinationComponent; - if(otherT == null) return false; + if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUri)value; + EndpointElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -258,9 +251,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); } } @@ -286,28 +279,25 @@ public partial class MessageSourceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -317,28 +307,25 @@ public string Name /// [FhirElement("software", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SoftwareElement + public Hl7.Fhir.Model.FhirString? SoftwareElement { get { return _SoftwareElement; } set { _SoftwareElement = value; OnPropertyChanged("SoftwareElement"); } } - private Hl7.Fhir.Model.FhirString _SoftwareElement; + private Hl7.Fhir.Model.FhirString? _SoftwareElement; /// /// Name of software running the system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Software + public string? Software { - get { return SoftwareElement != null ? SoftwareElement.Value : null; } + get => _SoftwareElement?.Value; set { - if (value == null) - SoftwareElement = null; - else - SoftwareElement = new Hl7.Fhir.Model.FhirString(value); + SoftwareElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Software"); } } @@ -348,28 +335,25 @@ public string Software /// [FhirElement("version", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of software running /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -379,13 +363,13 @@ public string Version /// [FhirElement("contact", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.ContactPoint Contact + public Hl7.Fhir.Model.ContactPoint? Contact { get { return _Contact; } set { _Contact = value; OnPropertyChanged("Contact"); } } - private Hl7.Fhir.Model.ContactPoint _Contact; + private Hl7.Fhir.Model.ContactPoint? _Contact; /// /// Actual message source address or id. @@ -393,47 +377,40 @@ public Hl7.Fhir.Model.ContactPoint Contact [FhirElement("endpoint", InSummary=true, Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri EndpointElement + public Hl7.Fhir.Model.FhirUri? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUri _EndpointElement; + private Hl7.Fhir.Model.FhirUri? _EndpointElement; /// /// Actual message source address or id /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUri(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Endpoint"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageSourceComponent; - - if (dest == null) - { + if(other is not MessageSourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(SoftwareElement != null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)SoftwareElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Contact != null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)Contact.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUri)EndpointElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_SoftwareElement is not null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)_SoftwareElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)_Contact.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUri)_EndpointElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -445,62 +422,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageSourceComponent; - if(otherT == null) return false; + if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(SoftwareElement, otherT.SoftwareElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "software": - value = SoftwareElement; - return SoftwareElement is not null; + value = _SoftwareElement; + return _SoftwareElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "contact": - value = Contact; - return Contact is not null; + value = _Contact; + return _Contact is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "software": - SoftwareElement = (Hl7.Fhir.Model.FhirString)value; + SoftwareElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (Hl7.Fhir.Model.ContactPoint)value; + Contact = (Hl7.Fhir.Model.ContactPoint?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUri)value; + EndpointElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -511,11 +488,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (SoftwareElement is not null) yield return new KeyValuePair("software",SoftwareElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Contact is not null) yield return new KeyValuePair("contact",Contact); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_SoftwareElement is not null) yield return new KeyValuePair("software",_SoftwareElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Contact is not null) yield return new KeyValuePair("contact",_Contact); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); } } @@ -542,28 +519,25 @@ public partial class ResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identifier", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentifierElement + public Hl7.Fhir.Model.Id? IdentifierElement { get { return _IdentifierElement; } set { _IdentifierElement = value; OnPropertyChanged("IdentifierElement"); } } - private Hl7.Fhir.Model.Id _IdentifierElement; + private Hl7.Fhir.Model.Id? _IdentifierElement; /// /// Id of original message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identifier + public string? Identifier { - get { return IdentifierElement != null ? IdentifierElement.Value : null; } + get => _IdentifierElement?.Value; set { - if (value == null) - IdentifierElement = null; - else - IdentifierElement = new Hl7.Fhir.Model.Id(value); + IdentifierElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identifier"); } } @@ -576,13 +550,13 @@ public string Identifier [Binding("ResponseType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// ok | transient-error | fatal-error @@ -591,13 +565,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageHeader.ResponseType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -609,27 +580,23 @@ public Hl7.Fhir.Model.MessageHeader.ResponseType? Code [CLSCompliant(false)] [References("OperationOutcome")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Details + public Hl7.Fhir.Model.ResourceReference? Details { get { return _Details; } set { _Details = value; OnPropertyChanged("Details"); } } - private Hl7.Fhir.Model.ResourceReference _Details; + private Hl7.Fhir.Model.ResourceReference? _Details; protected internal override void CopyToInternal(Base other) { - var dest = other as ResponseComponent; - - if (dest == null) - { + if(other is not ResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdentifierElement != null) dest.IdentifierElement = (Hl7.Fhir.Model.Id)IdentifierElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Details != null) dest.Details = (Hl7.Fhir.Model.ResourceReference)Details.DeepCopyInternal(); + if(_IdentifierElement is not null) dest.IdentifierElement = (Hl7.Fhir.Model.Id)_IdentifierElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Details is not null) dest.Details = (Hl7.Fhir.Model.ResourceReference)_Details.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -641,48 +608,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResponseComponent; - if(otherT == null) return false; + if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentifierElement, otherT.IdentifierElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Details, otherT.Details)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Details, otherT._Details)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = IdentifierElement; - return IdentifierElement is not null; + value = _IdentifierElement; + return _IdentifierElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "details": - value = Details; - return Details is not null; + value = _Details; + return _Details is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - IdentifierElement = (Hl7.Fhir.Model.Id)value; + IdentifierElement = (Hl7.Fhir.Model.Id?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "details": - Details = (Hl7.Fhir.Model.ResourceReference)value; + Details = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -693,9 +660,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentifierElement is not null) yield return new KeyValuePair("identifier",IdentifierElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Details is not null) yield return new KeyValuePair("details",Details); + if (_IdentifierElement is not null) yield return new KeyValuePair("identifier",_IdentifierElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Details is not null) yield return new KeyValuePair("details",_Details); } } @@ -707,13 +674,13 @@ public override IEnumerable> EnumerateElements() [Binding("MessageEvent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Event + public Hl7.Fhir.Model.Coding? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.Coding _Event; + private Hl7.Fhir.Model.Coding? _Event; /// /// Message destination application(s). @@ -723,11 +690,11 @@ public Hl7.Fhir.Model.Coding Event [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Intended "real-world" recipient for the data. @@ -736,13 +703,13 @@ public List Destinatio [CLSCompliant(false)] [References("Practitioner","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Receiver + public Hl7.Fhir.Model.ResourceReference? Receiver { get { return _Receiver; } set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private Hl7.Fhir.Model.ResourceReference _Receiver; + private Hl7.Fhir.Model.ResourceReference? _Receiver; /// /// Real world sender of the message. @@ -751,13 +718,13 @@ public Hl7.Fhir.Model.ResourceReference Receiver [CLSCompliant(false)] [References("Practitioner","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Time that the message was sent. @@ -765,13 +732,13 @@ public Hl7.Fhir.Model.ResourceReference Sender [FhirElement("timestamp", InSummary=true, Order=130, FiveWs="when.init")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant TimestampElement + public Hl7.Fhir.Model.Instant? TimestampElement { get { return _TimestampElement; } set { _TimestampElement = value; OnPropertyChanged("TimestampElement"); } } - private Hl7.Fhir.Model.Instant _TimestampElement; + private Hl7.Fhir.Model.Instant? _TimestampElement; /// /// Time that the message was sent @@ -780,13 +747,10 @@ public Hl7.Fhir.Model.Instant TimestampElement [IgnoreDataMember] public DateTimeOffset? Timestamp { - get { return TimestampElement != null ? TimestampElement.Value : null; } + get => _TimestampElement?.Value; set { - if (value == null) - TimestampElement = null; - else - TimestampElement = new Hl7.Fhir.Model.Instant(value); + TimestampElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Timestamp"); } } @@ -798,13 +762,13 @@ public DateTimeOffset? Timestamp [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// The source of the decision. @@ -813,13 +777,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Message source application. @@ -827,13 +791,13 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("source", InSummary=true, Order=160, FiveWs="who.actor")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source + public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent _Source; + private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? _Source; /// /// Final responsibility for event. @@ -842,13 +806,13 @@ public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source [CLSCompliant(false)] [References("Practitioner","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Cause of event. @@ -856,26 +820,26 @@ public Hl7.Fhir.Model.ResourceReference Responsible [FhirElement("reason", InSummary=true, Order=180, FiveWs="why")] [Binding("EventReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// If this is a reply to prior message. /// [FhirElement("response", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response + public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.MessageHeader.ResponseComponent _Response; + private Hl7.Fhir.Model.MessageHeader.ResponseComponent? _Response; /// /// The actual content of the message. @@ -887,34 +851,30 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; protected internal override void CopyToInternal(Base other) { - var dest = other as MessageHeader; - - if (dest == null) - { + if(other is not MessageHeader dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Event != null) dest.Event = (Hl7.Fhir.Model.Coding)Event.DeepCopyInternal(); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Receiver != null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)Receiver.DeepCopyInternal(); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(TimestampElement != null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)TimestampElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)Source.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)Response.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.Coding)_Event.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Receiver is not null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)_Receiver.DeepCopyInternal(); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_TimestampElement is not null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)_TimestampElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)_Source.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)_Response.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -926,111 +886,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageHeader; - if(otherT == null) return false; + if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Receiver, otherT.Receiver)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.Equals(TimestampElement, otherT.TimestampElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "receiver": - value = Receiver; - return Receiver is not null; + value = _Receiver; + return _Receiver is not null; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "timestamp": - value = TimestampElement; - return TimestampElement is not null; + value = _TimestampElement; + return _TimestampElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - Event = (Hl7.Fhir.Model.Coding)value; + Event = (Hl7.Fhir.Model.Coding?)value; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "receiver": - Receiver = (Hl7.Fhir.Model.ResourceReference)value; + Receiver = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "timestamp": - TimestampElement = (Hl7.Fhir.Model.Instant)value; + TimestampElement = (Hl7.Fhir.Model.Instant?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)value; + Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "response": - Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)value; + Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1041,18 +1001,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Event is not null) yield return new KeyValuePair("event",Event); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Receiver is not null) yield return new KeyValuePair("receiver",Receiver); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (TimestampElement is not null) yield return new KeyValuePair("timestamp",TimestampElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Receiver is not null) yield return new KeyValuePair("receiver",_Receiver); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_TimestampElement is not null) yield return new KeyValuePair("timestamp",_TimestampElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Money.cs b/src/Hl7.Fhir.STU3/Model/Generated/Money.cs index f82116ab4..47fc59eda 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Money.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Money.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs index 76da9c039..255884db7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -146,13 +149,13 @@ public partial class UniqueIdComponent : Hl7.Fhir.Model.BackboneElement [Binding("NamingSystemIdentifierType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// oid | uuid | uri | other @@ -161,13 +164,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -178,28 +178,25 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type [FhirElement("value", Order=50, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The unique identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -209,13 +206,13 @@ public string Value /// [FhirElement("preferred", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Is this the id that should be used for this type @@ -224,13 +221,10 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } @@ -240,28 +234,25 @@ public bool? Preferred /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Notes about identifier usage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -271,29 +262,25 @@ public string Comment /// [FhirElement("period", Order=80)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as UniqueIdComponent; - - if (dest == null) - { + if(other is not UniqueIdComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -305,62 +292,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UniqueIdComponent; - if(otherT == null) return false; + if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -371,11 +358,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -386,28 +373,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("name", InSummary=true, Order=90)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this naming system (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -420,13 +404,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -435,13 +419,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -454,13 +435,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("NamingSystemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// codesystem | identifier | root @@ -469,13 +450,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -486,28 +464,25 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind [FhirElement("date", InSummary=true, Order=120, FiveWs="when.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -517,28 +492,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=130, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -551,39 +523,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who maintains system namespace?. /// [FhirElement("responsible", Order=150, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString ResponsibleElement + public Hl7.Fhir.Model.FhirString? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirString _ResponsibleElement; + private Hl7.Fhir.Model.FhirString? _ResponsibleElement; /// /// Who maintains system namespace? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Responsible + public string? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirString(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Responsible"); } } @@ -594,41 +563,38 @@ public string Responsible [FhirElement("type", Order=160)] [Binding("IdentifierType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Natural language description of the naming system. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the naming system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -641,11 +607,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for naming system (if applicable). @@ -656,39 +622,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// How/where is it used. /// [FhirElement("usage", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// How/where is it used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -701,11 +664,11 @@ public string Usage [DataMember] public List UniqueId { - get { if(_UniqueId==null) _UniqueId = new List(); return _UniqueId; } + get => _UniqueId ?? new List(); set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } - private List _UniqueId; + private List? _UniqueId; /// /// Use this instead. @@ -714,38 +677,34 @@ public List UniqueId [CLSCompliant(false)] [References("NamingSystem")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReplacedBy + public Hl7.Fhir.Model.ResourceReference? ReplacedBy { get { return _ReplacedBy; } set { _ReplacedBy = value; OnPropertyChanged("ReplacedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ReplacedBy; + private Hl7.Fhir.Model.ResourceReference? _ReplacedBy; protected internal override void CopyToInternal(Base other) { - var dest = other as NamingSystem; - - if (dest == null) - { + if(other is not NamingSystem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)ResponsibleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(UniqueId.Any()) dest.UniqueId = new List(UniqueId.DeepCopyInternal()); - if(ReplacedBy != null) dest.ReplacedBy = (Hl7.Fhir.Model.ResourceReference)ReplacedBy.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)_ResponsibleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_UniqueId is not null) dest.UniqueId = new List(_UniqueId.DeepCopyInternal()); + if(_ReplacedBy is not null) dest.ReplacedBy = (Hl7.Fhir.Model.ResourceReference)_ReplacedBy.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -757,125 +716,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NamingSystem; - if(otherT == null) return false; + if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.ListEquals(UniqueId, otherT.UniqueId)) return false; - if(!comparer.Equals(ReplacedBy, otherT.ReplacedBy)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; + if(!comparer.Equals(_ReplacedBy, otherT._ReplacedBy)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "uniqueId": - value = UniqueId; - return UniqueId?.Any() == true; + value = _UniqueId; + return _UniqueId?.Any() == true; case "replacedBy": - value = ReplacedBy; - return ReplacedBy is not null; + value = _ReplacedBy; + return _ReplacedBy is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirString)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "uniqueId": - UniqueId = (List)value; + UniqueId = (List?)value!; return this; case "replacedBy": - ReplacedBy = (Hl7.Fhir.Model.ResourceReference)value; + ReplacedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -886,20 +845,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",UniqueId); - if (ReplacedBy is not null) yield return new KeyValuePair("replacedBy",ReplacedBy); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",_UniqueId); + if (_ReplacedBy is not null) yield return new KeyValuePair("replacedBy",_ReplacedBy); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs index 469b0965a..1be7f7d99 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -149,11 +152,11 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Scheduled frequency of diet. @@ -163,11 +166,11 @@ public List Type [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// Required nutrient modifications. @@ -177,11 +180,11 @@ public List Schedule [DataMember] public List Nutrient { - get { if(_Nutrient==null) _Nutrient = new List(); return _Nutrient; } + get => _Nutrient ?? new List(); set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } - private List _Nutrient; + private List? _Nutrient; /// /// Required texture modifications. @@ -191,11 +194,11 @@ public List Nutrient [DataMember] public List Texture { - get { if(_Texture==null) _Texture = new List(); return _Texture; } + get => _Texture ?? new List(); set { _Texture = value; OnPropertyChanged("Texture"); } } - private List _Texture; + private List? _Texture; /// /// The required consistency of fluids and liquids provided to the patient. @@ -206,59 +209,52 @@ public List Texture [DataMember] public List FluidConsistencyType { - get { if(_FluidConsistencyType==null) _FluidConsistencyType = new List(); return _FluidConsistencyType; } + get => _FluidConsistencyType ?? new List(); set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } - private List _FluidConsistencyType; + private List? _FluidConsistencyType; /// /// Instructions or additional information about the oral diet. /// [FhirElement("instruction", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral diet /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OralDietComponent; - - if (dest == null) - { + if(other is not OralDietComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(Nutrient.Any()) dest.Nutrient = new List(Nutrient.DeepCopyInternal()); - if(Texture.Any()) dest.Texture = new List(Texture.DeepCopyInternal()); - if(FluidConsistencyType.Any()) dest.FluidConsistencyType = new List(FluidConsistencyType.DeepCopyInternal()); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_Nutrient is not null) dest.Nutrient = new List(_Nutrient.DeepCopyInternal()); + if(_Texture is not null) dest.Texture = new List(_Texture.DeepCopyInternal()); + if(_FluidConsistencyType is not null) dest.FluidConsistencyType = new List(_FluidConsistencyType.DeepCopyInternal()); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -270,69 +266,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OralDietComponent; - if(otherT == null) return false; + if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.ListEquals(Nutrient, otherT.Nutrient)) return false; - if(!comparer.ListEquals(Texture, otherT.Texture)) return false; - if(!comparer.ListEquals(FluidConsistencyType, otherT.FluidConsistencyType)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; + if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; + if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "nutrient": - value = Nutrient; - return Nutrient?.Any() == true; + value = _Nutrient; + return _Nutrient?.Any() == true; case "texture": - value = Texture; - return Texture?.Any() == true; + value = _Texture; + return _Texture?.Any() == true; case "fluidConsistencyType": - value = FluidConsistencyType; - return FluidConsistencyType?.Any() == true; + value = _FluidConsistencyType; + return _FluidConsistencyType?.Any() == true; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "nutrient": - Nutrient = (List)value; + Nutrient = (List?)value!; return this; case "texture": - Texture = (List)value; + Texture = (List?)value!; return this; case "fluidConsistencyType": - FluidConsistencyType = (List)value; + FluidConsistencyType = (List?)value!; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -343,12 +339,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",Nutrient); - if (Texture?.Any() == true) yield return new KeyValuePair("texture",Texture); - if (FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",FluidConsistencyType); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",_Nutrient); + if (_Texture?.Any() == true) yield return new KeyValuePair("texture",_Texture); + if (_FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",_FluidConsistencyType); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -375,39 +371,35 @@ public partial class NutrientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40, FiveWs="what")] [Binding("NutrientModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Quantity of the specified nutrient. /// [FhirElement("amount", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as NutrientComponent; - - if (dest == null) - { + if(other is not NutrientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -419,41 +411,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutrientComponent; - if(otherT == null) return false; + if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -464,8 +456,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -492,13 +484,13 @@ public partial class TextureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40)] [Binding("TextureModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Concepts that are used to identify an entity that is ingested for nutritional purposes. @@ -506,26 +498,22 @@ public Hl7.Fhir.Model.CodeableConcept Modifier [FhirElement("foodType", Order=50)] [Binding("TextureModifiedFoodType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FoodType + public Hl7.Fhir.Model.CodeableConcept? FoodType { get { return _FoodType; } set { _FoodType = value; OnPropertyChanged("FoodType"); } } - private Hl7.Fhir.Model.CodeableConcept _FoodType; + private Hl7.Fhir.Model.CodeableConcept? _FoodType; protected internal override void CopyToInternal(Base other) { - var dest = other as TextureComponent; - - if (dest == null) - { + if(other is not TextureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(FoodType != null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)FoodType.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_FoodType is not null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)_FoodType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -537,41 +525,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TextureComponent; - if(otherT == null) return false; + if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(FoodType, otherT.FoodType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "foodType": - value = FoodType; - return FoodType is not null; + value = _FoodType; + return _FoodType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "foodType": - FoodType = (Hl7.Fhir.Model.CodeableConcept)value; + FoodType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -582,8 +570,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (FoodType is not null) yield return new KeyValuePair("foodType",FoodType); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_FoodType is not null) yield return new KeyValuePair("foodType",_FoodType); } } @@ -610,41 +598,38 @@ public partial class SupplementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40, FiveWs="what")] [Binding("SupplementType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Product or brand name of the nutritional supplement. /// [FhirElement("productName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// Product or brand name of the nutritional supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -657,71 +642,64 @@ public string ProductName [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// Amount of the nutritional supplement. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Instructions or additional information about the oral supplement. /// [FhirElement("instruction", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementComponent; - - if (dest == null) - { + if(other is not SupplementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -733,62 +711,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementComponent; - if(otherT == null) return false; + if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -799,11 +777,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -830,41 +808,38 @@ public partial class EnteralFormulaComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("baseFormulaType", InSummary=true, Order=40, FiveWs="what")] [Binding("EnteralFormulaType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BaseFormulaType + public Hl7.Fhir.Model.CodeableConcept? BaseFormulaType { get { return _BaseFormulaType; } set { _BaseFormulaType = value; OnPropertyChanged("BaseFormulaType"); } } - private Hl7.Fhir.Model.CodeableConcept _BaseFormulaType; + private Hl7.Fhir.Model.CodeableConcept? _BaseFormulaType; /// /// Product or brand name of the enteral or infant formula. /// [FhirElement("baseFormulaProductName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString BaseFormulaProductNameElement + public Hl7.Fhir.Model.FhirString? BaseFormulaProductNameElement { get { return _BaseFormulaProductNameElement; } set { _BaseFormulaProductNameElement = value; OnPropertyChanged("BaseFormulaProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _BaseFormulaProductNameElement; + private Hl7.Fhir.Model.FhirString? _BaseFormulaProductNameElement; /// /// Product or brand name of the enteral or infant formula /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BaseFormulaProductName + public string? BaseFormulaProductName { - get { return BaseFormulaProductNameElement != null ? BaseFormulaProductNameElement.Value : null; } + get => _BaseFormulaProductNameElement?.Value; set { - if (value == null) - BaseFormulaProductNameElement = null; - else - BaseFormulaProductNameElement = new Hl7.Fhir.Model.FhirString(value); + BaseFormulaProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BaseFormulaProductName"); } } @@ -875,41 +850,38 @@ public string BaseFormulaProductName [FhirElement("additiveType", Order=60, FiveWs="what")] [Binding("EnteralFormulaAdditiveType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdditiveType + public Hl7.Fhir.Model.CodeableConcept? AdditiveType { get { return _AdditiveType; } set { _AdditiveType = value; OnPropertyChanged("AdditiveType"); } } - private Hl7.Fhir.Model.CodeableConcept _AdditiveType; + private Hl7.Fhir.Model.CodeableConcept? _AdditiveType; /// /// Product or brand name of the modular additive. /// [FhirElement("additiveProductName", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString AdditiveProductNameElement + public Hl7.Fhir.Model.FhirString? AdditiveProductNameElement { get { return _AdditiveProductNameElement; } set { _AdditiveProductNameElement = value; OnPropertyChanged("AdditiveProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _AdditiveProductNameElement; + private Hl7.Fhir.Model.FhirString? _AdditiveProductNameElement; /// /// Product or brand name of the modular additive /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AdditiveProductName + public string? AdditiveProductName { - get { return AdditiveProductNameElement != null ? AdditiveProductNameElement.Value : null; } + get => _AdditiveProductNameElement?.Value; set { - if (value == null) - AdditiveProductNameElement = null; - else - AdditiveProductNameElement = new Hl7.Fhir.Model.FhirString(value); + AdditiveProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AdditiveProductName"); } } @@ -919,13 +891,13 @@ public string AdditiveProductName /// [FhirElement("caloricDensity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity CaloricDensity + public Hl7.Fhir.Model.Quantity? CaloricDensity { get { return _CaloricDensity; } set { _CaloricDensity = value; OnPropertyChanged("CaloricDensity"); } } - private Hl7.Fhir.Model.Quantity _CaloricDensity; + private Hl7.Fhir.Model.Quantity? _CaloricDensity; /// /// How the formula should enter the patient's gastrointestinal tract. @@ -933,13 +905,13 @@ public Hl7.Fhir.Model.Quantity CaloricDensity [FhirElement("routeofAdministration", Order=90)] [Binding("EnteralRouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RouteofAdministration + public Hl7.Fhir.Model.CodeableConcept? RouteofAdministration { get { return _RouteofAdministration; } set { _RouteofAdministration = value; OnPropertyChanged("RouteofAdministration"); } } - private Hl7.Fhir.Model.CodeableConcept _RouteofAdministration; + private Hl7.Fhir.Model.CodeableConcept? _RouteofAdministration; /// /// Formula feeding instruction as structured data. @@ -949,75 +921,68 @@ public Hl7.Fhir.Model.CodeableConcept RouteofAdministration [DataMember] public List Administration { - get { if(_Administration==null) _Administration = new List(); return _Administration; } + get => _Administration ?? new List(); set { _Administration = value; OnPropertyChanged("Administration"); } } - private List _Administration; + private List? _Administration; /// /// Upper limit on formula volume per unit of time. /// [FhirElement("maxVolumeToDeliver", Order=110)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxVolumeToDeliver + public Hl7.Fhir.Model.Quantity? MaxVolumeToDeliver { get { return _MaxVolumeToDeliver; } set { _MaxVolumeToDeliver = value; OnPropertyChanged("MaxVolumeToDeliver"); } } - private Hl7.Fhir.Model.Quantity _MaxVolumeToDeliver; + private Hl7.Fhir.Model.Quantity? _MaxVolumeToDeliver; /// /// Formula feeding instructions expressed as text. /// [FhirElement("administrationInstruction", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString AdministrationInstructionElement + public Hl7.Fhir.Model.FhirString? AdministrationInstructionElement { get { return _AdministrationInstructionElement; } set { _AdministrationInstructionElement = value; OnPropertyChanged("AdministrationInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _AdministrationInstructionElement; + private Hl7.Fhir.Model.FhirString? _AdministrationInstructionElement; /// /// Formula feeding instructions expressed as text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AdministrationInstruction + public string? AdministrationInstruction { - get { return AdministrationInstructionElement != null ? AdministrationInstructionElement.Value : null; } + get => _AdministrationInstructionElement?.Value; set { - if (value == null) - AdministrationInstructionElement = null; - else - AdministrationInstructionElement = new Hl7.Fhir.Model.FhirString(value); + AdministrationInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AdministrationInstruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EnteralFormulaComponent; - - if (dest == null) - { + if(other is not EnteralFormulaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(BaseFormulaType != null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)BaseFormulaType.DeepCopyInternal(); - if(BaseFormulaProductNameElement != null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)BaseFormulaProductNameElement.DeepCopyInternal(); - if(AdditiveType != null) dest.AdditiveType = (Hl7.Fhir.Model.CodeableConcept)AdditiveType.DeepCopyInternal(); - if(AdditiveProductNameElement != null) dest.AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)AdditiveProductNameElement.DeepCopyInternal(); - if(CaloricDensity != null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)CaloricDensity.DeepCopyInternal(); - if(RouteofAdministration != null) dest.RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)RouteofAdministration.DeepCopyInternal(); - if(Administration.Any()) dest.Administration = new List(Administration.DeepCopyInternal()); - if(MaxVolumeToDeliver != null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)MaxVolumeToDeliver.DeepCopyInternal(); - if(AdministrationInstructionElement != null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)AdministrationInstructionElement.DeepCopyInternal(); + if(_BaseFormulaType is not null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)_BaseFormulaType.DeepCopyInternal(); + if(_BaseFormulaProductNameElement is not null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)_BaseFormulaProductNameElement.DeepCopyInternal(); + if(_AdditiveType is not null) dest.AdditiveType = (Hl7.Fhir.Model.CodeableConcept)_AdditiveType.DeepCopyInternal(); + if(_AdditiveProductNameElement is not null) dest.AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)_AdditiveProductNameElement.DeepCopyInternal(); + if(_CaloricDensity is not null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)_CaloricDensity.DeepCopyInternal(); + if(_RouteofAdministration is not null) dest.RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)_RouteofAdministration.DeepCopyInternal(); + if(_Administration is not null) dest.Administration = new List(_Administration.DeepCopyInternal()); + if(_MaxVolumeToDeliver is not null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)_MaxVolumeToDeliver.DeepCopyInternal(); + if(_AdministrationInstructionElement is not null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)_AdministrationInstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1029,90 +994,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnteralFormulaComponent; - if(otherT == null) return false; + if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(BaseFormulaType, otherT.BaseFormulaType)) return false; - if(!comparer.Equals(BaseFormulaProductNameElement, otherT.BaseFormulaProductNameElement)) return false; - if(!comparer.Equals(AdditiveType, otherT.AdditiveType)) return false; - if(!comparer.Equals(AdditiveProductNameElement, otherT.AdditiveProductNameElement)) return false; - if(!comparer.Equals(CaloricDensity, otherT.CaloricDensity)) return false; - if(!comparer.Equals(RouteofAdministration, otherT.RouteofAdministration)) return false; - if(!comparer.ListEquals(Administration, otherT.Administration)) return false; - if(!comparer.Equals(MaxVolumeToDeliver, otherT.MaxVolumeToDeliver)) return false; - if(!comparer.Equals(AdministrationInstructionElement, otherT.AdministrationInstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; + if(!comparer.Equals(_AdditiveType, otherT._AdditiveType)) return false; + if(!comparer.Equals(_AdditiveProductNameElement, otherT._AdditiveProductNameElement)) return false; + if(!comparer.Equals(_CaloricDensity, otherT._CaloricDensity)) return false; + if(!comparer.Equals(_RouteofAdministration, otherT._RouteofAdministration)) return false; + if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; + if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; + if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "baseFormulaType": - value = BaseFormulaType; - return BaseFormulaType is not null; + value = _BaseFormulaType; + return _BaseFormulaType is not null; case "baseFormulaProductName": - value = BaseFormulaProductNameElement; - return BaseFormulaProductNameElement is not null; + value = _BaseFormulaProductNameElement; + return _BaseFormulaProductNameElement is not null; case "additiveType": - value = AdditiveType; - return AdditiveType is not null; + value = _AdditiveType; + return _AdditiveType is not null; case "additiveProductName": - value = AdditiveProductNameElement; - return AdditiveProductNameElement is not null; + value = _AdditiveProductNameElement; + return _AdditiveProductNameElement is not null; case "caloricDensity": - value = CaloricDensity; - return CaloricDensity is not null; + value = _CaloricDensity; + return _CaloricDensity is not null; case "routeofAdministration": - value = RouteofAdministration; - return RouteofAdministration is not null; + value = _RouteofAdministration; + return _RouteofAdministration is not null; case "administration": - value = Administration; - return Administration?.Any() == true; + value = _Administration; + return _Administration?.Any() == true; case "maxVolumeToDeliver": - value = MaxVolumeToDeliver; - return MaxVolumeToDeliver is not null; + value = _MaxVolumeToDeliver; + return _MaxVolumeToDeliver is not null; case "administrationInstruction": - value = AdministrationInstructionElement; - return AdministrationInstructionElement is not null; + value = _AdministrationInstructionElement; + return _AdministrationInstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "baseFormulaType": - BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)value; + BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "baseFormulaProductName": - BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)value; + BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "additiveType": - AdditiveType = (Hl7.Fhir.Model.CodeableConcept)value; + AdditiveType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additiveProductName": - AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)value; + AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "caloricDensity": - CaloricDensity = (Hl7.Fhir.Model.Quantity)value; + CaloricDensity = (Hl7.Fhir.Model.Quantity?)value; return this; case "routeofAdministration": - RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)value; + RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "administration": - Administration = (List)value; + Administration = (List?)value!; return this; case "maxVolumeToDeliver": - MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)value; + MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity?)value; return this; case "administrationInstruction": - AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)value; + AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1123,15 +1088,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",BaseFormulaType); - if (BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",BaseFormulaProductNameElement); - if (AdditiveType is not null) yield return new KeyValuePair("additiveType",AdditiveType); - if (AdditiveProductNameElement is not null) yield return new KeyValuePair("additiveProductName",AdditiveProductNameElement); - if (CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",CaloricDensity); - if (RouteofAdministration is not null) yield return new KeyValuePair("routeofAdministration",RouteofAdministration); - if (Administration?.Any() == true) yield return new KeyValuePair("administration",Administration); - if (MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",MaxVolumeToDeliver); - if (AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",AdministrationInstructionElement); + if (_BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",_BaseFormulaType); + if (_BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",_BaseFormulaProductNameElement); + if (_AdditiveType is not null) yield return new KeyValuePair("additiveType",_AdditiveType); + if (_AdditiveProductNameElement is not null) yield return new KeyValuePair("additiveProductName",_AdditiveProductNameElement); + if (_CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",_CaloricDensity); + if (_RouteofAdministration is not null) yield return new KeyValuePair("routeofAdministration",_RouteofAdministration); + if (_Administration?.Any() == true) yield return new KeyValuePair("administration",_Administration); + if (_MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",_MaxVolumeToDeliver); + if (_AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",_AdministrationInstructionElement); } } @@ -1158,26 +1123,26 @@ public partial class AdministrationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("schedule", Order=40)] [DataMember] - public Hl7.Fhir.Model.Timing Schedule + public Hl7.Fhir.Model.Timing? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.Timing _Schedule; + private Hl7.Fhir.Model.Timing? _Schedule; /// /// The volume of formula to provide. /// [FhirElement("quantity", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Speed with which the formula is provided per period of time. @@ -1186,27 +1151,23 @@ public Hl7.Fhir.Model.Quantity Quantity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrationComponent; - - if (dest == null) - { + if(other is not AdministrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.Timing)Schedule.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.Timing)_Schedule.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1218,48 +1179,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrationComponent; - if(otherT == null) return false; + if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "schedule": - Schedule = (Hl7.Fhir.Model.Timing)value; + Schedule = (Hl7.Fhir.Model.Timing?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1270,9 +1231,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -1285,11 +1246,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | draft | planned | requested | active | on-hold | completed | cancelled | entered-in-error. @@ -1298,13 +1259,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("NutritionOrderStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | draft | planned | requested | active | on-hold | completed | cancelled | entered-in-error @@ -1313,13 +1274,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.NutritionOrder.NutritionOrderStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1332,13 +1290,13 @@ public Hl7.Fhir.Model.NutritionOrder.NutritionOrderStatus? Status [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// The encounter associated with this nutrition order. @@ -1347,13 +1305,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Date and time the nutrition order was requested. @@ -1361,28 +1319,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("dateTime", InSummary=true, Order=130, FiveWs="when.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateTimeElement + public Hl7.Fhir.Model.FhirDateTime? DateTimeElement { get { return _DateTimeElement; } set { _DateTimeElement = value; OnPropertyChanged("DateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _DateTimeElement; /// /// Date and time the nutrition order was requested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateTime + public string? DateTime { - get { return DateTimeElement != null ? DateTimeElement.Value : null; } + get => _DateTimeElement?.Value; set { - if (value == null) - DateTimeElement = null; - else - DateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateTime"); } } @@ -1394,13 +1349,13 @@ public string DateTime [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Orderer + public Hl7.Fhir.Model.ResourceReference? Orderer { get { return _Orderer; } set { _Orderer = value; OnPropertyChanged("Orderer"); } } - private Hl7.Fhir.Model.ResourceReference _Orderer; + private Hl7.Fhir.Model.ResourceReference? _Orderer; /// /// List of the patient's food and nutrition-related allergies and intolerances. @@ -1412,11 +1367,11 @@ public Hl7.Fhir.Model.ResourceReference Orderer [DataMember] public List AllergyIntolerance { - get { if(_AllergyIntolerance==null) _AllergyIntolerance = new List(); return _AllergyIntolerance; } + get => _AllergyIntolerance ?? new List(); set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } - private List _AllergyIntolerance; + private List? _AllergyIntolerance; /// /// Order-specific modifier about the type of food that should be given. @@ -1427,11 +1382,11 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get { if(_FoodPreferenceModifier==null) _FoodPreferenceModifier = new List(); return _FoodPreferenceModifier; } + get => _FoodPreferenceModifier ?? new List(); set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } - private List _FoodPreferenceModifier; + private List? _FoodPreferenceModifier; /// /// Order-specific modifier about the type of food that should not be given. @@ -1442,24 +1397,24 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get { if(_ExcludeFoodModifier==null) _ExcludeFoodModifier = new List(); return _ExcludeFoodModifier; } + get => _ExcludeFoodModifier ?? new List(); set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } - private List _ExcludeFoodModifier; + private List? _ExcludeFoodModifier; /// /// Oral diet components. /// [FhirElement("oralDiet", Order=180)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet + public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet { get { return _OralDiet; } set { _OralDiet = value; OnPropertyChanged("OralDiet"); } } - private Hl7.Fhir.Model.NutritionOrder.OralDietComponent _OralDiet; + private Hl7.Fhir.Model.NutritionOrder.OralDietComponent? _OralDiet; /// /// Supplement components. @@ -1469,49 +1424,45 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet [DataMember] public List Supplement { - get { if(_Supplement==null) _Supplement = new List(); return _Supplement; } + get => _Supplement ?? new List(); set { _Supplement = value; OnPropertyChanged("Supplement"); } } - private List _Supplement; + private List? _Supplement; /// /// Enteral formula components. /// [FhirElement("enteralFormula", Order=200)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent EnteralFormula + public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? EnteralFormula { get { return _EnteralFormula; } set { _EnteralFormula = value; OnPropertyChanged("EnteralFormula"); } } - private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent _EnteralFormula; + private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? _EnteralFormula; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as NutritionOrder; - - if (dest == null) - { + if(other is not NutritionOrder dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateTimeElement != null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopyInternal(); - if(Orderer != null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)Orderer.DeepCopyInternal(); - if(AllergyIntolerance.Any()) dest.AllergyIntolerance = new List(AllergyIntolerance.DeepCopyInternal()); - if(FoodPreferenceModifier.Any()) dest.FoodPreferenceModifier = new List(FoodPreferenceModifier.DeepCopyInternal()); - if(ExcludeFoodModifier.Any()) dest.ExcludeFoodModifier = new List(ExcludeFoodModifier.DeepCopyInternal()); - if(OralDiet != null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)OralDiet.DeepCopyInternal(); - if(Supplement.Any()) dest.Supplement = new List(Supplement.DeepCopyInternal()); - if(EnteralFormula != null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)EnteralFormula.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateTimeElement is not null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_DateTimeElement.DeepCopyInternal(); + if(_Orderer is not null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)_Orderer.DeepCopyInternal(); + if(_AllergyIntolerance is not null) dest.AllergyIntolerance = new List(_AllergyIntolerance.DeepCopyInternal()); + if(_FoodPreferenceModifier is not null) dest.FoodPreferenceModifier = new List(_FoodPreferenceModifier.DeepCopyInternal()); + if(_ExcludeFoodModifier is not null) dest.ExcludeFoodModifier = new List(_ExcludeFoodModifier.DeepCopyInternal()); + if(_OralDiet is not null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)_OralDiet.DeepCopyInternal(); + if(_Supplement is not null) dest.Supplement = new List(_Supplement.DeepCopyInternal()); + if(_EnteralFormula is not null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)_EnteralFormula.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1523,111 +1474,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutritionOrder; - if(otherT == null) return false; + if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateTimeElement, otherT.DateTimeElement)) return false; - if(!comparer.Equals(Orderer, otherT.Orderer)) return false; - if(!comparer.ListEquals(AllergyIntolerance, otherT.AllergyIntolerance)) return false; - if(!comparer.ListEquals(FoodPreferenceModifier, otherT.FoodPreferenceModifier)) return false; - if(!comparer.ListEquals(ExcludeFoodModifier, otherT.ExcludeFoodModifier)) return false; - if(!comparer.Equals(OralDiet, otherT.OralDiet)) return false; - if(!comparer.ListEquals(Supplement, otherT.Supplement)) return false; - if(!comparer.Equals(EnteralFormula, otherT.EnteralFormula)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateTimeElement, otherT._DateTimeElement)) return false; + if(!comparer.Equals(_Orderer, otherT._Orderer)) return false; + if(!comparer.ListEquals(_AllergyIntolerance, otherT._AllergyIntolerance)) return false; + if(!comparer.ListEquals(_FoodPreferenceModifier, otherT._FoodPreferenceModifier)) return false; + if(!comparer.ListEquals(_ExcludeFoodModifier, otherT._ExcludeFoodModifier)) return false; + if(!comparer.Equals(_OralDiet, otherT._OralDiet)) return false; + if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; + if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "dateTime": - value = DateTimeElement; - return DateTimeElement is not null; + value = _DateTimeElement; + return _DateTimeElement is not null; case "orderer": - value = Orderer; - return Orderer is not null; + value = _Orderer; + return _Orderer is not null; case "allergyIntolerance": - value = AllergyIntolerance; - return AllergyIntolerance?.Any() == true; + value = _AllergyIntolerance; + return _AllergyIntolerance?.Any() == true; case "foodPreferenceModifier": - value = FoodPreferenceModifier; - return FoodPreferenceModifier?.Any() == true; + value = _FoodPreferenceModifier; + return _FoodPreferenceModifier?.Any() == true; case "excludeFoodModifier": - value = ExcludeFoodModifier; - return ExcludeFoodModifier?.Any() == true; + value = _ExcludeFoodModifier; + return _ExcludeFoodModifier?.Any() == true; case "oralDiet": - value = OralDiet; - return OralDiet is not null; + value = _OralDiet; + return _OralDiet is not null; case "supplement": - value = Supplement; - return Supplement?.Any() == true; + value = _Supplement; + return _Supplement?.Any() == true; case "enteralFormula": - value = EnteralFormula; - return EnteralFormula is not null; + value = _EnteralFormula; + return _EnteralFormula is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateTime": - DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "orderer": - Orderer = (Hl7.Fhir.Model.ResourceReference)value; + Orderer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "allergyIntolerance": - AllergyIntolerance = (List)value; + AllergyIntolerance = (List?)value!; return this; case "foodPreferenceModifier": - FoodPreferenceModifier = (List)value; + FoodPreferenceModifier = (List?)value!; return this; case "excludeFoodModifier": - ExcludeFoodModifier = (List)value; + ExcludeFoodModifier = (List?)value!; return this; case "oralDiet": - OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)value; + OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent?)value; return this; case "supplement": - Supplement = (List)value; + Supplement = (List?)value!; return this; case "enteralFormula": - EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)value; + EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent?)value; return this; default: return base.SetValue(key, value); @@ -1638,18 +1589,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateTimeElement is not null) yield return new KeyValuePair("dateTime",DateTimeElement); - if (Orderer is not null) yield return new KeyValuePair("orderer",Orderer); - if (AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",AllergyIntolerance); - if (FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",FoodPreferenceModifier); - if (ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",ExcludeFoodModifier); - if (OralDiet is not null) yield return new KeyValuePair("oralDiet",OralDiet); - if (Supplement?.Any() == true) yield return new KeyValuePair("supplement",Supplement); - if (EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",EnteralFormula); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateTimeElement is not null) yield return new KeyValuePair("dateTime",_DateTimeElement); + if (_Orderer is not null) yield return new KeyValuePair("orderer",_Orderer); + if (_AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",_AllergyIntolerance); + if (_FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",_FoodPreferenceModifier); + if (_ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",_ExcludeFoodModifier); + if (_OralDiet is not null) yield return new KeyValuePair("oralDiet",_OralDiet); + if (_Supplement?.Any() == true) yield return new KeyValuePair("supplement",_Supplement); + if (_EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",_EnteralFormula); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs b/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs index 8710f8867..1521bba9f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -128,26 +131,26 @@ public partial class ReferenceRangeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("low", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Low + public Hl7.Fhir.Model.Quantity? Low { get { return _Low; } set { _Low = value; OnPropertyChanged("Low"); } } - private Hl7.Fhir.Model.Quantity _Low; + private Hl7.Fhir.Model.Quantity? _Low; /// /// High Range, if relevant. /// [FhirElement("high", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity High + public Hl7.Fhir.Model.Quantity? High { get { return _High; } set { _High = value; OnPropertyChanged("High"); } } - private Hl7.Fhir.Model.Quantity _High; + private Hl7.Fhir.Model.Quantity? _High; /// /// Reference range qualifier. @@ -155,13 +158,13 @@ public Hl7.Fhir.Model.Quantity High [FhirElement("type", Order=60)] [Binding("ObservationRangeMeaning")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Reference range population. @@ -172,72 +175,65 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List AppliesTo { - get { if(_AppliesTo==null) _AppliesTo = new List(); return _AppliesTo; } + get => _AppliesTo ?? new List(); set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } - private List _AppliesTo; + private List? _AppliesTo; /// /// Applicable age range, if relevant. /// [FhirElement("age", Order=80)] [DataMember] - public Hl7.Fhir.Model.Range Age + public Hl7.Fhir.Model.Range? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.Range _Age; + private Hl7.Fhir.Model.Range? _Age; /// /// Text based reference range in an observation. /// [FhirElement("text", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text based reference range in an observation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceRangeComponent; - - if (dest == null) - { + if(other is not ReferenceRangeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Low != null) dest.Low = (Hl7.Fhir.Model.Quantity)Low.DeepCopyInternal(); - if(High != null) dest.High = (Hl7.Fhir.Model.Quantity)High.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AppliesTo.Any()) dest.AppliesTo = new List(AppliesTo.DeepCopyInternal()); - if(Age != null) dest.Age = (Hl7.Fhir.Model.Range)Age.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Low is not null) dest.Low = (Hl7.Fhir.Model.Quantity)_Low.DeepCopyInternal(); + if(_High is not null) dest.High = (Hl7.Fhir.Model.Quantity)_High.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AppliesTo is not null) dest.AppliesTo = new List(_AppliesTo.DeepCopyInternal()); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.Range)_Age.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -249,69 +245,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceRangeComponent; - if(otherT == null) return false; + if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Low, otherT.Low)) return false; - if(!comparer.Equals(High, otherT.High)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(AppliesTo, otherT.AppliesTo)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + if(!comparer.Equals(_High, otherT._High)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "low": - value = Low; - return Low is not null; + value = _Low; + return _Low is not null; case "high": - value = High; - return High is not null; + value = _High; + return _High is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "appliesTo": - value = AppliesTo; - return AppliesTo?.Any() == true; + value = _AppliesTo; + return _AppliesTo?.Any() == true; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "low": - Low = (Hl7.Fhir.Model.Quantity)value; + Low = (Hl7.Fhir.Model.Quantity?)value; return this; case "high": - High = (Hl7.Fhir.Model.Quantity)value; + High = (Hl7.Fhir.Model.Quantity?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "appliesTo": - AppliesTo = (List)value; + AppliesTo = (List?)value!; return this; case "age": - Age = (Hl7.Fhir.Model.Range)value; + Age = (Hl7.Fhir.Model.Range?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -322,12 +318,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Low is not null) yield return new KeyValuePair("low",Low); - if (High is not null) yield return new KeyValuePair("high",High); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",AppliesTo); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Low is not null) yield return new KeyValuePair("low",_Low); + if (_High is not null) yield return new KeyValuePair("high",_High); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",_AppliesTo); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -356,13 +352,13 @@ public partial class RelatedComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ObservationRelationshipType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by @@ -371,13 +367,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Observation.ObservationRelationshipType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -390,26 +383,22 @@ public Hl7.Fhir.Model.Observation.ObservationRelationshipType? Type [References("Observation","QuestionnaireResponse","Sequence")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedComponent; - - if (dest == null) - { + if(other is not RelatedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -421,41 +410,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedComponent; - if(otherT == null) return false; + if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -466,8 +455,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -496,13 +485,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Actual component result. @@ -511,13 +500,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the component result is missing. @@ -525,13 +514,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=60)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -539,13 +528,13 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [FhirElement("interpretation", Order=70)] [Binding("ObservationInterpretation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Interpretation + public Hl7.Fhir.Model.CodeableConcept? Interpretation { get { return _Interpretation; } set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private Hl7.Fhir.Model.CodeableConcept _Interpretation; + private Hl7.Fhir.Model.CodeableConcept? _Interpretation; /// /// Provides guide for interpretation of component result. @@ -555,27 +544,23 @@ public Hl7.Fhir.Model.CodeableConcept Interpretation [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation != null) dest.Interpretation = (Hl7.Fhir.Model.CodeableConcept)Interpretation.DeepCopyInternal(); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = (Hl7.Fhir.Model.CodeableConcept)_Interpretation.DeepCopyInternal(); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -587,62 +572,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.Equals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.Equals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation is not null; + value = _Interpretation; + return _Interpretation is not null; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (Hl7.Fhir.Model.CodeableConcept)value; + Interpretation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; default: return base.SetValue(key, value); @@ -653,11 +638,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation is not null) yield return new KeyValuePair("interpretation",Interpretation); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation is not null) yield return new KeyValuePair("interpretation",_Interpretation); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); } } @@ -670,11 +655,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -686,11 +671,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// registered | preliminary | final | amended +. @@ -700,13 +685,13 @@ public List BasedOn [Binding("ObservationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -715,13 +700,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -735,11 +717,11 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of observation (code / type). @@ -748,13 +730,13 @@ public List Category [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who and/or what this is about. @@ -763,13 +745,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Healthcare event during which this observation is made. @@ -778,13 +760,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Clinically relevant time/time-period for observation. @@ -793,26 +775,26 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// Date/Time this was made available. /// [FhirElement("issued", InSummary=true, Order=170, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// Date/Time this was made available @@ -821,13 +803,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -842,11 +821,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Actual result. @@ -855,13 +834,13 @@ public List Performer [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the result is missing. @@ -869,13 +848,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=200)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -883,41 +862,38 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [FhirElement("interpretation", Order=210)] [Binding("ObservationInterpretation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Interpretation + public Hl7.Fhir.Model.CodeableConcept? Interpretation { get { return _Interpretation; } set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private Hl7.Fhir.Model.CodeableConcept _Interpretation; + private Hl7.Fhir.Model.CodeableConcept? _Interpretation; /// /// Comments about result. /// [FhirElement("comment", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments about result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -928,13 +904,13 @@ public string Comment [FhirElement("bodySite", Order=230)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// How it was done. @@ -942,13 +918,13 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [FhirElement("method", Order=240)] [Binding("ObservationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Specimen used for this observation. @@ -957,13 +933,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [CLSCompliant(false)] [References("Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// (Measurement) Device. @@ -972,13 +948,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Provides guide for interpretation. @@ -988,11 +964,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; /// /// Resource related to this observation. @@ -1002,11 +978,11 @@ public List ReferenceRange [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Component results. @@ -1016,45 +992,41 @@ public List Related [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Observation; - - if (dest == null) - { + if(other is not Observation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation != null) dest.Interpretation = (Hl7.Fhir.Model.CodeableConcept)Interpretation.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = (Hl7.Fhir.Model.CodeableConcept)_Interpretation.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1066,174 +1038,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Observation; - if(otherT == null) return false; + if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.Equals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.Equals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation is not null; + value = _Interpretation; + return _Interpretation is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (Hl7.Fhir.Model.CodeableConcept)value; + Interpretation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1244,27 +1216,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation is not null) yield return new KeyValuePair("interpretation",Interpretation); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation is not null) yield return new KeyValuePair("interpretation",_Interpretation); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs index ebeb19584..580e7186e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,28 +107,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name in Parameters.parameter.name or in URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -138,13 +138,13 @@ public string Name [Binding("OperationParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -153,13 +153,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -170,13 +167,13 @@ public Hl7.Fhir.Model.OperationParameterUse? Use [FhirElement("min", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum Cardinality @@ -185,13 +182,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -202,28 +196,25 @@ public int? Min [FhirElement("max", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum Cardinality (a number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -233,28 +224,25 @@ public string Max /// [FhirElement("documentation", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Description of meaning/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -266,13 +254,13 @@ public string Documentation [DeclaredType(Type = typeof(Code))] [Binding("FHIRAllTypes")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type this parameter has @@ -281,13 +269,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -299,13 +284,13 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DeclaredType(Type = typeof(Code))] [Binding("SearchParamType")] [DataMember] - public Code SearchTypeElement + public Code? SearchTypeElement { get { return _SearchTypeElement; } set { _SearchTypeElement = value; OnPropertyChanged("SearchTypeElement"); } } - private Code _SearchTypeElement; + private Code? _SearchTypeElement; /// /// number | date | string | token | reference | composite | quantity | uri @@ -314,13 +299,10 @@ public Code SearchTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? SearchType { - get { return SearchTypeElement != null ? SearchTypeElement.Value : null; } + get => _SearchTypeElement?.Value; set { - if (value == null) - SearchTypeElement = null; - else - SearchTypeElement = new Code(value); + SearchTypeElement = value is null ? null : new Code(value); OnPropertyChanged("SearchType"); } } @@ -332,26 +314,26 @@ public Hl7.Fhir.Model.SearchParamType? SearchType [CLSCompliant(false)] [References("StructureDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Profile + public Hl7.Fhir.Model.ResourceReference? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.ResourceReference _Profile; + private Hl7.Fhir.Model.ResourceReference? _Profile; /// /// ValueSet details if this is coded. /// [FhirElement("binding", Order=120)] [DataMember] - public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding + public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding { get { return _Binding; } set { _Binding = value; OnPropertyChanged("Binding"); } } - private Hl7.Fhir.Model.OperationDefinition.BindingComponent _Binding; + private Hl7.Fhir.Model.OperationDefinition.BindingComponent? _Binding; /// /// Parts of a nested Parameter. @@ -361,32 +343,28 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding [DataMember] public List Part { - get { if(_Part==null) _Part = new List(); return _Part; } + get => _Part ?? new List(); set { _Part = value; OnPropertyChanged("Part"); } } - private List _Part; + private List? _Part; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(SearchTypeElement != null) dest.SearchTypeElement = (Code)SearchTypeElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)Profile.DeepCopyInternal(); - if(Binding != null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)Binding.DeepCopyInternal(); - if(Part.Any()) dest.Part = new List(Part.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_SearchTypeElement is not null) dest.SearchTypeElement = (Code)_SearchTypeElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)_Profile.DeepCopyInternal(); + if(_Binding is not null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)_Binding.DeepCopyInternal(); + if(_Part is not null) dest.Part = new List(_Part.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -398,97 +376,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(SearchTypeElement, otherT.SearchTypeElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; - if(!comparer.Equals(Binding, otherT.Binding)) return false; - if(!comparer.ListEquals(Part, otherT.Part)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_SearchTypeElement, otherT._SearchTypeElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; + if(!comparer.Equals(_Binding, otherT._Binding)) return false; + if(!comparer.ListEquals(_Part, otherT._Part)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "searchType": - value = SearchTypeElement; - return SearchTypeElement is not null; + value = _SearchTypeElement; + return _SearchTypeElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; case "binding": - value = Binding; - return Binding is not null; + value = _Binding; + return _Binding is not null; case "part": - value = Part; - return Part?.Any() == true; + value = _Part; + return _Part?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "searchType": - SearchTypeElement = (Code)value; + SearchTypeElement = (Code?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.ResourceReference)value; + Profile = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "binding": - Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)value; + Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent?)value; return this; case "part": - Part = (List)value; + Part = (List?)value!; return this; default: return base.SetValue(key, value); @@ -499,16 +477,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (SearchTypeElement is not null) yield return new KeyValuePair("searchType",SearchTypeElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); - if (Binding is not null) yield return new KeyValuePair("binding",Binding); - if (Part?.Any() == true) yield return new KeyValuePair("part",Part); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_SearchTypeElement is not null) yield return new KeyValuePair("searchType",_SearchTypeElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); + if (_Binding is not null) yield return new KeyValuePair("binding",_Binding); + if (_Part?.Any() == true) yield return new KeyValuePair("part",_Part); } } @@ -537,13 +515,13 @@ public partial class BindingComponent : Hl7.Fhir.Model.BackboneElement [Binding("BindingStrength")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StrengthElement + public Code? StrengthElement { get { return _StrengthElement; } set { _StrengthElement = value; OnPropertyChanged("StrengthElement"); } } - private Code _StrengthElement; + private Code? _StrengthElement; /// /// required | extensible | preferred | example @@ -552,13 +530,10 @@ public Code StrengthElement [IgnoreDataMember] public Hl7.Fhir.Model.BindingStrength? Strength { - get { return StrengthElement != null ? StrengthElement.Value : null; } + get => _StrengthElement?.Value; set { - if (value == null) - StrengthElement = null; - else - StrengthElement = new Code(value); + StrengthElement = value is null ? null : new Code(value); OnPropertyChanged("Strength"); } } @@ -572,26 +547,22 @@ public Hl7.Fhir.Model.BindingStrength? Strength [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType ValueSet + public Hl7.Fhir.Model.DataType? ValueSet { get { return _ValueSet; } set { _ValueSet = value; OnPropertyChanged("ValueSet"); } } - private Hl7.Fhir.Model.DataType _ValueSet; + private Hl7.Fhir.Model.DataType? _ValueSet; protected internal override void CopyToInternal(Base other) { - var dest = other as BindingComponent; - - if (dest == null) - { + if(other is not BindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StrengthElement != null) dest.StrengthElement = (Code)StrengthElement.DeepCopyInternal(); - if(ValueSet != null) dest.ValueSet = (Hl7.Fhir.Model.DataType)ValueSet.DeepCopyInternal(); + if(_StrengthElement is not null) dest.StrengthElement = (Code)_StrengthElement.DeepCopyInternal(); + if(_ValueSet is not null) dest.ValueSet = (Hl7.Fhir.Model.DataType)_ValueSet.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -603,41 +574,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BindingComponent; - if(otherT == null) return false; + if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StrengthElement, otherT.StrengthElement)) return false; - if(!comparer.Equals(ValueSet, otherT.ValueSet)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + if(!comparer.Equals(_ValueSet, otherT._ValueSet)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "strength": - value = StrengthElement; - return StrengthElement is not null; + value = _StrengthElement; + return _StrengthElement is not null; case "valueSet": - value = ValueSet; - return ValueSet is not null; + value = _ValueSet; + return _ValueSet is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "strength": - StrengthElement = (Code)value; + StrengthElement = (Code?)value; return this; case "valueSet": - ValueSet = (Hl7.Fhir.Model.DataType)value; + ValueSet = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -648,8 +619,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StrengthElement is not null) yield return new KeyValuePair("strength",StrengthElement); - if (ValueSet is not null) yield return new KeyValuePair("valueSet",ValueSet); + if (_StrengthElement is not null) yield return new KeyValuePair("strength",_StrengthElement); + if (_ValueSet is not null) yield return new KeyValuePair("valueSet",_ValueSet); } } @@ -679,24 +650,24 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get { if(_ParameterNameElement==null) _ParameterNameElement = new List(); return _ParameterNameElement; } + get => _ParameterNameElement ?? new List(); set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } - private List _ParameterNameElement; + private List? _ParameterNameElement; /// /// Name of parameter to include in overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ParameterName + public IEnumerable? ParameterName { - get { return ParameterNameElement != null ? ParameterNameElement.Select(elem => elem.Value) : null; } + get => _ParameterNameElement?.Select(elem => elem.Value); set { if (value == null) - ParameterNameElement = null; + ParameterNameElement = null!; else ParameterNameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ParameterName"); @@ -708,44 +679,37 @@ public IEnumerable ParameterName /// [FhirElement("comment", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments to go on overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OverloadComponent; - - if (dest == null) - { + if(other is not OverloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ParameterNameElement.Any()) dest.ParameterNameElement = new List(ParameterNameElement.DeepCopyInternal()); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_ParameterNameElement is not null) dest.ParameterNameElement = new List(_ParameterNameElement.DeepCopyInternal()); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -757,41 +721,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OverloadComponent; - if(otherT == null) return false; + if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ParameterNameElement, otherT.ParameterNameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "parameterName": - value = ParameterNameElement; - return ParameterNameElement?.Any() == true; + value = _ParameterNameElement; + return _ParameterNameElement?.Any() == true; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "parameterName": - ParameterNameElement = (List)value; + ParameterNameElement = (List?)value!; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -802,8 +766,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",ParameterNameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",_ParameterNameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -813,28 +777,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this operation definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -844,28 +805,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -876,28 +834,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this operation definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -910,13 +865,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -925,13 +880,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -944,13 +896,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("OperationKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// operation | query @@ -959,13 +911,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -975,13 +924,13 @@ public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=140, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -990,13 +939,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1006,28 +952,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1037,28 +980,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1071,39 +1011,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the operation definition. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1116,11 +1053,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for operation definition (if applicable). @@ -1131,39 +1068,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this operation definition is defined. /// [FhirElement("purpose", Order=210, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this operation definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1173,13 +1107,13 @@ public string Purpose /// [FhirElement("idempotent", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IdempotentElement + public Hl7.Fhir.Model.FhirBoolean? IdempotentElement { get { return _IdempotentElement; } set { _IdempotentElement = value; OnPropertyChanged("IdempotentElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IdempotentElement; + private Hl7.Fhir.Model.FhirBoolean? _IdempotentElement; /// /// Whether content is unchanged by the operation @@ -1188,13 +1122,10 @@ public Hl7.Fhir.Model.FhirBoolean IdempotentElement [IgnoreDataMember] public bool? Idempotent { - get { return IdempotentElement != null ? IdempotentElement.Value : null; } + get => _IdempotentElement?.Value; set { - if (value == null) - IdempotentElement = null; - else - IdempotentElement = new Hl7.Fhir.Model.FhirBoolean(value); + IdempotentElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Idempotent"); } } @@ -1205,28 +1136,25 @@ public bool? Idempotent [FhirElement("code", InSummary=true, Order=230)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Name used to invoke the operation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1236,28 +1164,25 @@ public string Code /// [FhirElement("comment", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional information about use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -1269,13 +1194,13 @@ public string Comment [CLSCompliant(false)] [References("OperationDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Base + public Hl7.Fhir.Model.ResourceReference? Base { get { return _Base; } set { _Base = value; OnPropertyChanged("Base"); } } - private Hl7.Fhir.Model.ResourceReference _Base; + private Hl7.Fhir.Model.ResourceReference? _Base; /// /// Types this operation applies to. @@ -1287,24 +1212,24 @@ public Hl7.Fhir.Model.ResourceReference Base [DataMember] public List> ResourceElement { - get { if(_ResourceElement==null) _ResourceElement = new List>(); return _ResourceElement; } + get => _ResourceElement ?? new List>(); set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private List> _ResourceElement; + private List>? _ResourceElement; /// /// Types this operation applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Resource + public IEnumerable? Resource { - get { return ResourceElement != null ? ResourceElement.Select(elem => elem.Value) : null; } + get => _ResourceElement?.Select(elem => elem.Value); set { if (value == null) - ResourceElement = null; + ResourceElement = null!; else ResourceElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Resource"); @@ -1317,13 +1242,13 @@ public IEnumerable Resource [FhirElement("system", InSummary=true, Order=270)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SystemElement + public Hl7.Fhir.Model.FhirBoolean? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SystemElement; + private Hl7.Fhir.Model.FhirBoolean? _SystemElement; /// /// Invoke at the system level? @@ -1332,13 +1257,10 @@ public Hl7.Fhir.Model.FhirBoolean SystemElement [IgnoreDataMember] public bool? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirBoolean(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("System"); } } @@ -1349,13 +1271,13 @@ public bool? System [FhirElement("type", InSummary=true, Order=280)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TypeElement + public Hl7.Fhir.Model.FhirBoolean? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TypeElement; + private Hl7.Fhir.Model.FhirBoolean? _TypeElement; /// /// Invole at the type level? @@ -1364,13 +1286,10 @@ public Hl7.Fhir.Model.FhirBoolean TypeElement [IgnoreDataMember] public bool? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirBoolean(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Type"); } } @@ -1381,13 +1300,13 @@ public bool? Type [FhirElement("instance", InSummary=true, Order=290)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InstanceElement + public Hl7.Fhir.Model.FhirBoolean? InstanceElement { get { return _InstanceElement; } set { _InstanceElement = value; OnPropertyChanged("InstanceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InstanceElement; + private Hl7.Fhir.Model.FhirBoolean? _InstanceElement; /// /// Invoke on an instance? @@ -1396,13 +1315,10 @@ public Hl7.Fhir.Model.FhirBoolean InstanceElement [IgnoreDataMember] public bool? Instance { - get { return InstanceElement != null ? InstanceElement.Value : null; } + get => _InstanceElement?.Value; set { - if (value == null) - InstanceElement = null; - else - InstanceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InstanceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Instance"); } } @@ -1415,11 +1331,11 @@ public bool? Instance [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Define overloaded variants for when generating code. @@ -1429,45 +1345,41 @@ public List Parameter [DataMember] public List Overload { - get { if(_Overload==null) _Overload = new List(); return _Overload; } + get => _Overload ?? new List(); set { _Overload = value; OnPropertyChanged("Overload"); } } - private List _Overload; + private List? _Overload; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationDefinition; - - if (dest == null) - { + if(other is not OperationDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(IdempotentElement != null) dest.IdempotentElement = (Hl7.Fhir.Model.FhirBoolean)IdempotentElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Base != null) dest.Base = (Hl7.Fhir.Model.ResourceReference)Base.DeepCopyInternal(); - if(ResourceElement.Any()) dest.ResourceElement = new List>(ResourceElement.DeepCopyInternal()); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)SystemElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)TypeElement.DeepCopyInternal(); - if(InstanceElement != null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)InstanceElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Overload.Any()) dest.Overload = new List(Overload.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_IdempotentElement is not null) dest.IdempotentElement = (Hl7.Fhir.Model.FhirBoolean)_IdempotentElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Base is not null) dest.Base = (Hl7.Fhir.Model.ResourceReference)_Base.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = new List>(_ResourceElement.DeepCopyInternal()); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)_SystemElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)_TypeElement.DeepCopyInternal(); + if(_InstanceElement is not null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)_InstanceElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Overload is not null) dest.Overload = new List(_Overload.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1479,188 +1391,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationDefinition; - if(otherT == null) return false; + if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(IdempotentElement, otherT.IdempotentElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Base, otherT.Base)) return false; - if(!comparer.ListEquals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(InstanceElement, otherT.InstanceElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Overload, otherT.Overload)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_IdempotentElement, otherT._IdempotentElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Base, otherT._Base)) return false; + if(!comparer.ListEquals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_InstanceElement, otherT._InstanceElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "idempotent": - value = IdempotentElement; - return IdempotentElement is not null; + value = _IdempotentElement; + return _IdempotentElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "base": - value = Base; - return Base is not null; + value = _Base; + return _Base is not null; case "resource": - value = ResourceElement; - return ResourceElement?.Any() == true; + value = _ResourceElement; + return _ResourceElement?.Any() == true; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "instance": - value = InstanceElement; - return InstanceElement is not null; + value = _InstanceElement; + return _InstanceElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "overload": - value = Overload; - return Overload?.Any() == true; + value = _Overload; + return _Overload?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "idempotent": - IdempotentElement = (Hl7.Fhir.Model.FhirBoolean)value; + IdempotentElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "base": - Base = (Hl7.Fhir.Model.ResourceReference)value; + Base = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "resource": - ResourceElement = (List>)value; + ResourceElement = (List>?)value!; return this; case "system": - SystemElement = (Hl7.Fhir.Model.FhirBoolean)value; + SystemElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirBoolean)value; + TypeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "instance": - InstanceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InstanceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "overload": - Overload = (List)value; + Overload = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1671,29 +1583,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (IdempotentElement is not null) yield return new KeyValuePair("idempotent",IdempotentElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Base is not null) yield return new KeyValuePair("base",Base); - if (ResourceElement?.Any() == true) yield return new KeyValuePair("resource",ResourceElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (InstanceElement is not null) yield return new KeyValuePair("instance",InstanceElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Overload?.Any() == true) yield return new KeyValuePair("overload",Overload); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_IdempotentElement is not null) yield return new KeyValuePair("idempotent",_IdempotentElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Base is not null) yield return new KeyValuePair("base",_Base); + if (_ResourceElement?.Any() == true) yield return new KeyValuePair("resource",_ResourceElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_InstanceElement is not null) yield return new KeyValuePair("instance",_InstanceElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Overload?.Any() == true) yield return new KeyValuePair("overload",_Overload); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs index cddea91b8..870eb2dfa 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,26 +84,26 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("purpose", Order=40)] [Binding("ContactPartyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Purpose + public Hl7.Fhir.Model.CodeableConcept? Purpose { get { return _Purpose; } set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private Hl7.Fhir.Model.CodeableConcept _Purpose; + private Hl7.Fhir.Model.CodeableConcept? _Purpose; /// /// A name associated with the contact. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// Contact details (telephone, email, etc.) for a contact. @@ -110,39 +113,35 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Visiting or postal addresses for the contact. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Purpose != null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)Purpose.DeepCopyInternal(); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); + if(_Purpose is not null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)_Purpose.DeepCopyInternal(); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -154,55 +153,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Purpose, otherT.Purpose)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = Purpose; - return Purpose is not null; + value = _Purpose; + return _Purpose is not null; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - Purpose = (Hl7.Fhir.Model.CodeableConcept)value; + Purpose = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; default: return base.SetValue(key, value); @@ -213,10 +212,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Purpose is not null) yield return new KeyValuePair("purpose",Purpose); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); + if (_Purpose is not null) yield return new KeyValuePair("purpose",_Purpose); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); } } @@ -229,24 +228,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether the organization's record is still in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether the organization's record is still in active use @@ -255,13 +254,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -275,39 +271,36 @@ public bool? Active [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Name used for the organization. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name used for the organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -320,24 +313,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the organization is known as, or was known as in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -352,11 +345,11 @@ public IEnumerable Alias [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// An address for the organization. @@ -366,11 +359,11 @@ public List Telecom [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// The organization of which this organization forms a part. @@ -379,13 +372,13 @@ public List Address [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// Contact for the organization for a certain purpose. @@ -395,11 +388,11 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Technical endpoints providing access to services operated for the organization. @@ -411,34 +404,30 @@ public List Contact [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Organization; - - if (dest == null) - { + if(other is not Organization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -450,97 +439,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Organization; - if(otherT == null) return false; + if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -551,16 +540,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs index cdf39eb51..f51520888 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ParameterDefinition : Hl7.Fhir.Model.DataType /// [FhirElement("name", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name used to access the parameter value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -98,13 +98,13 @@ public string Name [Binding("ParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -113,13 +113,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -129,13 +126,13 @@ public Hl7.Fhir.Model.OperationParameterUse? Use /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum cardinality @@ -144,13 +141,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -160,28 +154,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum cardinality (a number of *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -191,28 +182,25 @@ public string Max /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// A brief description of the parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -225,13 +213,13 @@ public string Documentation [Binding("FHIRAllTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type of value @@ -240,13 +228,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -258,31 +243,27 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [CLSCompliant(false)] [References("StructureDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Profile + public Hl7.Fhir.Model.ResourceReference? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.ResourceReference _Profile; + private Hl7.Fhir.Model.ResourceReference? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterDefinition; - - if (dest == null) - { + if(other is not ParameterDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)Profile.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.ResourceReference)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -294,76 +275,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterDefinition; - if(otherT == null) return false; + if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.ResourceReference)value; + Profile = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -374,13 +355,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs b/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs index 4e9c1dcac..f4d75a2a2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -118,24 +121,24 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// A name associated with the contact person. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// A contact detail for the person. @@ -145,24 +148,24 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address for the contact person. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// male | female | other | unknown. @@ -171,13 +174,13 @@ public Hl7.Fhir.Model.Address Address [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -186,13 +189,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -204,44 +204,40 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// The period during which this contact person or organization is valid to be contacted relating to this patient. /// [FhirElement("period", Order=100)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -253,76 +249,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -333,13 +329,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -368,13 +364,13 @@ public partial class AnimalComponent : Hl7.Fhir.Model.BackboneElement [Binding("AnimalSpecies")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Species + public Hl7.Fhir.Model.CodeableConcept? Species { get { return _Species; } set { _Species = value; OnPropertyChanged("Species"); } } - private Hl7.Fhir.Model.CodeableConcept _Species; + private Hl7.Fhir.Model.CodeableConcept? _Species; /// /// E.g. Poodle, Angus. @@ -382,13 +378,13 @@ public Hl7.Fhir.Model.CodeableConcept Species [FhirElement("breed", InSummary=true, Order=50)] [Binding("AnimalBreed")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Breed + public Hl7.Fhir.Model.CodeableConcept? Breed { get { return _Breed; } set { _Breed = value; OnPropertyChanged("Breed"); } } - private Hl7.Fhir.Model.CodeableConcept _Breed; + private Hl7.Fhir.Model.CodeableConcept? _Breed; /// /// E.g. Neutered, Intact. @@ -396,27 +392,23 @@ public Hl7.Fhir.Model.CodeableConcept Breed [FhirElement("genderStatus", InSummary=true, Order=60)] [Binding("AnimalGenderStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept GenderStatus + public Hl7.Fhir.Model.CodeableConcept? GenderStatus { get { return _GenderStatus; } set { _GenderStatus = value; OnPropertyChanged("GenderStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _GenderStatus; + private Hl7.Fhir.Model.CodeableConcept? _GenderStatus; protected internal override void CopyToInternal(Base other) { - var dest = other as AnimalComponent; - - if (dest == null) - { + if(other is not AnimalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Species != null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)Species.DeepCopyInternal(); - if(Breed != null) dest.Breed = (Hl7.Fhir.Model.CodeableConcept)Breed.DeepCopyInternal(); - if(GenderStatus != null) dest.GenderStatus = (Hl7.Fhir.Model.CodeableConcept)GenderStatus.DeepCopyInternal(); + if(_Species is not null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)_Species.DeepCopyInternal(); + if(_Breed is not null) dest.Breed = (Hl7.Fhir.Model.CodeableConcept)_Breed.DeepCopyInternal(); + if(_GenderStatus is not null) dest.GenderStatus = (Hl7.Fhir.Model.CodeableConcept)_GenderStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -428,48 +420,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnimalComponent; - if(otherT == null) return false; + if(other is not AnimalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Species, otherT.Species)) return false; - if(!comparer.Equals(Breed, otherT.Breed)) return false; - if(!comparer.Equals(GenderStatus, otherT.GenderStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Species, otherT._Species)) return false; + if(!comparer.Equals(_Breed, otherT._Breed)) return false; + if(!comparer.Equals(_GenderStatus, otherT._GenderStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "species": - value = Species; - return Species is not null; + value = _Species; + return _Species is not null; case "breed": - value = Breed; - return Breed is not null; + value = _Breed; + return _Breed is not null; case "genderStatus": - value = GenderStatus; - return GenderStatus is not null; + value = _GenderStatus; + return _GenderStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "species": - Species = (Hl7.Fhir.Model.CodeableConcept)value; + Species = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "breed": - Breed = (Hl7.Fhir.Model.CodeableConcept)value; + Breed = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genderStatus": - GenderStatus = (Hl7.Fhir.Model.CodeableConcept)value; + GenderStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -480,9 +472,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Species is not null) yield return new KeyValuePair("species",Species); - if (Breed is not null) yield return new KeyValuePair("breed",Breed); - if (GenderStatus is not null) yield return new KeyValuePair("genderStatus",GenderStatus); + if (_Species is not null) yield return new KeyValuePair("species",_Species); + if (_Breed is not null) yield return new KeyValuePair("breed",_Breed); + if (_GenderStatus is not null) yield return new KeyValuePair("genderStatus",_GenderStatus); } } @@ -511,26 +503,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -539,29 +531,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -573,41 +558,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -618,8 +603,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -650,13 +635,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Other + public Hl7.Fhir.Model.ResourceReference? Other { get { return _Other; } set { _Other = value; OnPropertyChanged("Other"); } } - private Hl7.Fhir.Model.ResourceReference _Other; + private Hl7.Fhir.Model.ResourceReference? _Other; /// /// replaced-by | replaces | refer | seealso - type of link. @@ -666,13 +651,13 @@ public Hl7.Fhir.Model.ResourceReference Other [Binding("LinkType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// replaced-by | replaces | refer | seealso - type of link @@ -681,29 +666,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Patient.LinkType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Other != null) dest.Other = (Hl7.Fhir.Model.ResourceReference)Other.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_Other is not null) dest.Other = (Hl7.Fhir.Model.ResourceReference)_Other.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -715,41 +693,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Other, otherT.Other)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "other": - value = Other; - return Other is not null; + value = _Other; + return _Other is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "other": - Other = (Hl7.Fhir.Model.ResourceReference)value; + Other = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -760,8 +738,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Other is not null) yield return new KeyValuePair("other",Other); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_Other is not null) yield return new KeyValuePair("other",_Other); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -774,24 +752,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this patient's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this patient's record is in active use @@ -800,13 +778,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -819,11 +794,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the individual. @@ -833,11 +808,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -846,13 +821,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -861,13 +836,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -877,28 +849,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date of birth for the individual /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -910,13 +879,13 @@ public string BirthDate [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// Addresses for the individual. @@ -926,11 +895,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Marital (civil) status of a patient. @@ -938,13 +907,13 @@ public List Address [FhirElement("maritalStatus", Order=170)] [Binding("MaritalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MaritalStatus + public Hl7.Fhir.Model.CodeableConcept? MaritalStatus { get { return _MaritalStatus; } set { _MaritalStatus = value; OnPropertyChanged("MaritalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _MaritalStatus; + private Hl7.Fhir.Model.CodeableConcept? _MaritalStatus; /// /// Whether patient is part of a multiple birth. @@ -953,13 +922,13 @@ public Hl7.Fhir.Model.CodeableConcept MaritalStatus [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer))] [DataMember] - public Hl7.Fhir.Model.DataType MultipleBirth + public Hl7.Fhir.Model.DataType? MultipleBirth { get { return _MultipleBirth; } set { _MultipleBirth = value; OnPropertyChanged("MultipleBirth"); } } - private Hl7.Fhir.Model.DataType _MultipleBirth; + private Hl7.Fhir.Model.DataType? _MultipleBirth; /// /// Image of the patient. @@ -969,11 +938,11 @@ public Hl7.Fhir.Model.DataType MultipleBirth [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// A contact party (e.g. guardian, partner, friend) for the patient. @@ -983,24 +952,24 @@ public List Photo [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// This patient is known to be an animal (non-human). /// [FhirElement("animal", InSummary=true, IsModifier=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Patient.AnimalComponent Animal + public Hl7.Fhir.Model.Patient.AnimalComponent? Animal { get { return _Animal; } set { _Animal = value; OnPropertyChanged("Animal"); } } - private Hl7.Fhir.Model.Patient.AnimalComponent _Animal; + private Hl7.Fhir.Model.Patient.AnimalComponent? _Animal; /// /// A list of Languages which may be used to communicate with the patient about his or her health. @@ -1010,11 +979,11 @@ public Hl7.Fhir.Model.Patient.AnimalComponent Animal [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Patient's nominated primary care provider. @@ -1026,11 +995,11 @@ public List Communication [DataMember] public List GeneralPractitioner { - get { if(_GeneralPractitioner==null) _GeneralPractitioner = new List(); return _GeneralPractitioner; } + get => _GeneralPractitioner ?? new List(); set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } - private List _GeneralPractitioner; + private List? _GeneralPractitioner; /// /// Organization that is the custodian of the patient record. @@ -1039,13 +1008,13 @@ public List GeneralPractitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Link to another patient resource that concerns the same actual person. @@ -1055,41 +1024,37 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Patient; - - if (dest == null) - { + if(other is not Patient dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(MaritalStatus != null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)MaritalStatus.DeepCopyInternal(); - if(MultipleBirth != null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)MultipleBirth.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Animal != null) dest.Animal = (Hl7.Fhir.Model.Patient.AnimalComponent)Animal.DeepCopyInternal(); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(GeneralPractitioner.Any()) dest.GeneralPractitioner = new List(GeneralPractitioner.DeepCopyInternal()); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_MaritalStatus is not null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)_MaritalStatus.DeepCopyInternal(); + if(_MultipleBirth is not null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)_MultipleBirth.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Animal is not null) dest.Animal = (Hl7.Fhir.Model.Patient.AnimalComponent)_Animal.DeepCopyInternal(); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_GeneralPractitioner is not null) dest.GeneralPractitioner = new List(_GeneralPractitioner.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1101,146 +1066,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Patient; - if(otherT == null) return false; + if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(MaritalStatus, otherT.MaritalStatus)) return false; - if(!comparer.Equals(MultipleBirth, otherT.MultipleBirth)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Animal, otherT.Animal)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(GeneralPractitioner, otherT.GeneralPractitioner)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_MaritalStatus, otherT._MaritalStatus)) return false; + if(!comparer.Equals(_MultipleBirth, otherT._MultipleBirth)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Animal, otherT._Animal)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "maritalStatus": - value = MaritalStatus; - return MaritalStatus is not null; + value = _MaritalStatus; + return _MaritalStatus is not null; case "multipleBirth": - value = MultipleBirth; - return MultipleBirth is not null; + value = _MultipleBirth; + return _MultipleBirth is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "animal": - value = Animal; - return Animal is not null; + value = _Animal; + return _Animal is not null; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "generalPractitioner": - value = GeneralPractitioner; - return GeneralPractitioner?.Any() == true; + value = _GeneralPractitioner; + return _GeneralPractitioner?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "maritalStatus": - MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + MaritalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "multipleBirth": - MultipleBirth = (Hl7.Fhir.Model.DataType)value; + MultipleBirth = (Hl7.Fhir.Model.DataType?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "animal": - Animal = (Hl7.Fhir.Model.Patient.AnimalComponent)value; + Animal = (Hl7.Fhir.Model.Patient.AnimalComponent?)value; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "generalPractitioner": - GeneralPractitioner = (List)value; + GeneralPractitioner = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1251,23 +1216,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",MaritalStatus); - if (MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",MultipleBirth); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Animal is not null) yield return new KeyValuePair("animal",Animal); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",GeneralPractitioner); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",_MaritalStatus); + if (_MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",_MultipleBirth); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Animal is not null) yield return new KeyValuePair("animal",_Animal); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",_GeneralPractitioner); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs index e85adcfdc..a2c214b46 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("PaymentNoticeStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -113,13 +113,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Response reference. @@ -128,41 +128,38 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Payment or clearing date. /// [FhirElement("statusDate", Order=130, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Date StatusDateElement + public Hl7.Fhir.Model.Date? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.Date _StatusDateElement; + private Hl7.Fhir.Model.Date? _StatusDateElement; /// /// Payment or clearing date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.Date(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("StatusDate"); } } @@ -172,28 +169,25 @@ public string StatusDate /// [FhirElement("created", Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -205,13 +199,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// Responsible practitioner. @@ -220,13 +214,13 @@ public Hl7.Fhir.Model.ResourceReference Target [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Responsible organization. @@ -235,13 +229,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Whether payment has been sent or cleared. @@ -249,36 +243,32 @@ public Hl7.Fhir.Model.ResourceReference Organization [FhirElement("paymentStatus", Order=180)] [Binding("PaymentStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PaymentStatus + public Hl7.Fhir.Model.CodeableConcept? PaymentStatus { get { return _PaymentStatus; } set { _PaymentStatus = value; OnPropertyChanged("PaymentStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _PaymentStatus; + private Hl7.Fhir.Model.CodeableConcept? _PaymentStatus; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentNotice; - - if (dest == null) - { + if(other is not PaymentNotice dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)StatusDateElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(PaymentStatus != null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)PaymentStatus.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)_StatusDateElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_PaymentStatus is not null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)_PaymentStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -290,97 +280,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentNotice; - if(otherT == null) return false; + if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(PaymentStatus, otherT.PaymentStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "paymentStatus": - value = PaymentStatus; - return PaymentStatus is not null; + value = _PaymentStatus; + return _PaymentStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.Date)value; + StatusDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "paymentStatus": - PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)value; + PaymentStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -391,16 +381,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",PaymentStatus); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",_PaymentStatus); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs index d9cc11946..cafd81f32 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,13 +85,13 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement [Binding("PaymentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Claim. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Claim Response. @@ -112,13 +115,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Organization which submitted the claim. @@ -127,13 +130,13 @@ public Hl7.Fhir.Model.ResourceReference Response [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Submitter + public Hl7.Fhir.Model.ResourceReference? Submitter { get { return _Submitter; } set { _Submitter = value; OnPropertyChanged("Submitter"); } } - private Hl7.Fhir.Model.ResourceReference _Submitter; + private Hl7.Fhir.Model.ResourceReference? _Submitter; /// /// Organization which is receiving the payment. @@ -142,41 +145,38 @@ public Hl7.Fhir.Model.ResourceReference Submitter [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payee + public Hl7.Fhir.Model.ResourceReference? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ResourceReference _Payee; + private Hl7.Fhir.Model.ResourceReference? _Payee; /// /// Invoice date. /// [FhirElement("date", Order=90)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Invoice date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -186,31 +186,27 @@ public string Date /// [FhirElement("amount", Order=100)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailsComponent; - - if (dest == null) - { + if(other is not DetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(Submitter != null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)Submitter.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_Submitter is not null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)_Submitter.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)_Payee.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -222,76 +218,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailsComponent; - if(otherT == null) return false; + if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(Submitter, otherT.Submitter)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_Submitter, otherT._Submitter)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "submitter": - value = Submitter; - return Submitter is not null; + value = _Submitter; + return _Submitter is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "submitter": - Submitter = (Hl7.Fhir.Model.ResourceReference)value; + Submitter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ResourceReference)value; + Payee = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -302,13 +298,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (Submitter is not null) yield return new KeyValuePair("submitter",Submitter); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_Submitter is not null) yield return new KeyValuePair("submitter",_Submitter); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -335,57 +331,50 @@ public partial class NotesComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("NoteType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Comment on the processing. /// [FhirElement("text", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Comment on the processing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NotesComponent; - - if (dest == null) - { + if(other is not NotesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -397,41 +386,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotesComponent; - if(otherT == null) return false; + if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -442,8 +431,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -456,11 +445,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -469,13 +458,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("PaymentReconciliationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -484,13 +473,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -500,41 +486,38 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("period", Order=110, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Creation date. /// [FhirElement("created", Order=120, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -546,13 +529,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Claim reference. @@ -561,13 +544,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("ProcessRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// complete | error | partial. @@ -575,41 +558,38 @@ public Hl7.Fhir.Model.ResourceReference Request [FhirElement("outcome", Order=150)] [Binding("RemittanceOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Disposition Message. /// [FhirElement("disposition", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -621,13 +601,13 @@ public string Disposition [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; /// /// Responsible organization. @@ -636,13 +616,13 @@ public Hl7.Fhir.Model.ResourceReference RequestProvider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestOrganization + public Hl7.Fhir.Model.ResourceReference? RequestOrganization { get { return _RequestOrganization; } set { _RequestOrganization = value; OnPropertyChanged("RequestOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestOrganization; /// /// List of settlements. @@ -652,11 +632,11 @@ public Hl7.Fhir.Model.ResourceReference RequestOrganization [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; /// /// Printed Form Identifier. @@ -664,26 +644,26 @@ public List Detail [FhirElement("form", Order=200)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Total amount of Payment. /// [FhirElement("total", Order=210)] [DataMember] - public Hl7.Fhir.Model.Money Total + public Hl7.Fhir.Model.Money? Total { get { return _Total; } set { _Total = value; OnPropertyChanged("Total"); } } - private Hl7.Fhir.Model.Money _Total; + private Hl7.Fhir.Model.Money? _Total; /// /// Processing comments. @@ -693,38 +673,34 @@ public Hl7.Fhir.Model.Money Total [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentReconciliation; - - if (dest == null) - { + if(other is not PaymentReconciliation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); - if(RequestOrganization != null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)RequestOrganization.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Total != null) dest.Total = (Hl7.Fhir.Model.Money)Total.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); + if(_RequestOrganization is not null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestOrganization.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Total is not null) dest.Total = (Hl7.Fhir.Model.Money)_Total.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -736,125 +712,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentReconciliation; - if(otherT == null) return false; + if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; - if(!comparer.Equals(RequestOrganization, otherT.RequestOrganization)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.Equals(Total, otherT.Total)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; + if(!comparer.Equals(_RequestOrganization, otherT._RequestOrganization)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.Equals(_Total, otherT._Total)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; case "requestOrganization": - value = RequestOrganization; - return RequestOrganization is not null; + value = _RequestOrganization; + return _RequestOrganization is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "total": - value = Total; - return Total is not null; + value = _Total; + return _Total is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestOrganization": - RequestOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "total": - Total = (Hl7.Fhir.Model.Money)value; + Total = (Hl7.Fhir.Model.Money?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; default: return base.SetValue(key, value); @@ -865,20 +841,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); - if (RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",RequestOrganization); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Total is not null) yield return new KeyValuePair("total",Total); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); + if (_RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",_RequestOrganization); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Total is not null) yield return new KeyValuePair("total",_Total); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Person.cs b/src/Hl7.Fhir.STU3/Model/Generated/Person.cs index 1f9f71da8..196692fb0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Person.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,13 +118,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","Practitioner","RelatedPerson","Person")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// level1 | level2 | level3 | level4. @@ -130,13 +133,13 @@ public Hl7.Fhir.Model.ResourceReference Target [DeclaredType(Type = typeof(Code))] [Binding("IdentityAssuranceLevel")] [DataMember] - public Code AssuranceElement + public Code? AssuranceElement { get { return _AssuranceElement; } set { _AssuranceElement = value; OnPropertyChanged("AssuranceElement"); } } - private Code _AssuranceElement; + private Code? _AssuranceElement; /// /// level1 | level2 | level3 | level4 @@ -145,29 +148,22 @@ public Code AssuranceElement [IgnoreDataMember] public Hl7.Fhir.Model.Person.IdentityAssuranceLevel? Assurance { - get { return AssuranceElement != null ? AssuranceElement.Value : null; } + get => _AssuranceElement?.Value; set { - if (value == null) - AssuranceElement = null; - else - AssuranceElement = new Code(value); + AssuranceElement = value is null ? null : new Code(value); OnPropertyChanged("Assurance"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(AssuranceElement != null) dest.AssuranceElement = (Code)AssuranceElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_AssuranceElement is not null) dest.AssuranceElement = (Code)_AssuranceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,41 +175,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(AssuranceElement, otherT.AssuranceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "assurance": - value = AssuranceElement; - return AssuranceElement is not null; + value = _AssuranceElement; + return _AssuranceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assurance": - AssuranceElement = (Code)value; + AssuranceElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -224,8 +220,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target is not null) yield return new KeyValuePair("target",Target); - if (AssuranceElement is not null) yield return new KeyValuePair("assurance",AssuranceElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_AssuranceElement is not null) yield return new KeyValuePair("assurance",_AssuranceElement); } } @@ -238,11 +234,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A name associated with the person. @@ -252,11 +248,11 @@ public List Identifier [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -266,11 +262,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -279,13 +275,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -294,13 +290,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -310,28 +303,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -344,24 +334,24 @@ public string BirthDate [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. /// [FhirElement("photo", Order=150)] [DataMember] - public Hl7.Fhir.Model.Attachment Photo + public Hl7.Fhir.Model.Attachment? Photo { get { return _Photo; } set { _Photo = value; OnPropertyChanged("Photo"); } } - private Hl7.Fhir.Model.Attachment _Photo; + private Hl7.Fhir.Model.Attachment? _Photo; /// /// The organization that is the custodian of the person record. @@ -370,26 +360,26 @@ public Hl7.Fhir.Model.Attachment Photo [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// This person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=170, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// This person's record is in active use @@ -398,13 +388,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -417,34 +404,30 @@ public bool? Active [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Person; - - if (dest == null) - { + if(other is not Person dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo != null) dest.Photo = (Hl7.Fhir.Model.Attachment)Photo.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = (Hl7.Fhir.Model.Attachment)_Photo.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -456,97 +439,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Person; - if(otherT == null) return false; + if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(Photo, otherT.Photo)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_Photo, otherT._Photo)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo is not null; + value = _Photo; + return _Photo is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (Hl7.Fhir.Model.Attachment)value; + Photo = (Hl7.Fhir.Model.Attachment?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -557,16 +540,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo is not null) yield return new KeyValuePair("photo",Photo); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo is not null) yield return new KeyValuePair("photo",_Photo); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs index 9bd526a71..66dfab908 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class GoalComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("GoalCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Code or text describing the goal. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// high-priority | medium-priority | low-priority. @@ -110,13 +113,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [FhirElement("priority", Order=60)] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// When goal pursuit begins. @@ -124,13 +127,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("start", Order=70)] [Binding("GoalStartEvent")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Start + public Hl7.Fhir.Model.CodeableConcept? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.CodeableConcept _Start; + private Hl7.Fhir.Model.CodeableConcept? _Start; /// /// What does the goal address. @@ -141,11 +144,11 @@ public Hl7.Fhir.Model.CodeableConcept Start [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Supporting documentation for the goal. @@ -155,11 +158,11 @@ public List Addresses [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// Target outcome for the goal. @@ -169,29 +172,25 @@ public List Documentation [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as GoalComponent; - - if (dest == null) - { + if(other is not GoalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)Start.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)_Start.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -203,76 +202,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GoalComponent; - if(otherT == null) return false; + if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "start": - Start = (Hl7.Fhir.Model.CodeableConcept)value; + Start = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -283,13 +282,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -316,13 +315,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -331,40 +330,36 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal within. /// [FhirElement("due", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration Due + public Hl7.Fhir.Model.Duration? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.Duration _Due; + private Hl7.Fhir.Model.Duration? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.Duration)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.Duration)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -376,48 +371,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.Duration)value; + Due = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -428,9 +423,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -456,28 +451,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("label", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// User-visible label for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -487,28 +479,25 @@ public string Label /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -518,28 +507,25 @@ public string Title /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -549,28 +535,25 @@ public string Description /// [FhirElement("textEquivalent", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextEquivalentElement + public Hl7.Fhir.Model.FhirString? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.FhirString _TextEquivalentElement; + private Hl7.Fhir.Model.FhirString? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.FhirString(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextEquivalent"); } } @@ -583,11 +566,11 @@ public string TextEquivalent [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Why the action should be performed. @@ -597,11 +580,11 @@ public List Code [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Supporting documentation for the intended performer of the action. @@ -611,11 +594,11 @@ public List Reason [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// What goals this action supports. @@ -625,24 +608,24 @@ public List Documentation [DataMember] public List GoalIdElement { - get { if(_GoalIdElement==null) _GoalIdElement = new List(); return _GoalIdElement; } + get => _GoalIdElement ?? new List(); set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } - private List _GoalIdElement; + private List? _GoalIdElement; /// /// What goals this action supports /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable GoalId + public IEnumerable? GoalId { - get { return GoalIdElement != null ? GoalIdElement.Select(elem => elem.Value) : null; } + get => _GoalIdElement?.Select(elem => elem.Value); set { if (value == null) - GoalIdElement = null; + GoalIdElement = null!; else GoalIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Id(elem))); OnPropertyChanged("GoalId"); @@ -657,11 +640,11 @@ public IEnumerable GoalId [DataMember] public List TriggerDefinition { - get { if(_TriggerDefinition==null) _TriggerDefinition = new List(); return _TriggerDefinition; } + get => _TriggerDefinition ?? new List(); set { _TriggerDefinition = value; OnPropertyChanged("TriggerDefinition"); } } - private List _TriggerDefinition; + private List? _TriggerDefinition; /// /// Whether or not the action is applicable. @@ -671,11 +654,11 @@ public List TriggerDefinition [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Input data requirements. @@ -685,11 +668,11 @@ public List Condition [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Output data definition. @@ -699,11 +682,11 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; /// /// Relationship to another action. @@ -713,11 +696,11 @@ public List Output [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -726,13 +709,13 @@ public List RelatedAction [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Who should participate in the action. @@ -742,11 +725,11 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -754,13 +737,13 @@ public List Participant [FhirElement("type", Order=190)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// visual-group | logical-group | sentence-group. @@ -769,13 +752,13 @@ public Hl7.Fhir.Model.Coding Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -784,13 +767,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -802,13 +782,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -817,13 +797,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -835,13 +812,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -850,13 +827,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -868,13 +842,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -883,13 +857,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -901,13 +872,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -916,13 +887,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -934,13 +902,13 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [References("ActivityDefinition","PlanDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; /// /// Transform to apply the template. @@ -949,13 +917,13 @@ public Hl7.Fhir.Model.ResourceReference Definition [CLSCompliant(false)] [References("StructureMap")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Transform + public Hl7.Fhir.Model.ResourceReference? Transform { get { return _Transform; } set { _Transform = value; OnPropertyChanged("Transform"); } } - private Hl7.Fhir.Model.ResourceReference _Transform; + private Hl7.Fhir.Model.ResourceReference? _Transform; /// /// Dynamic aspects of the definition. @@ -965,11 +933,11 @@ public Hl7.Fhir.Model.ResourceReference Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; /// /// A sub-action. @@ -979,47 +947,43 @@ public List DynamicValue [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)TextEquivalentElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(GoalIdElement.Any()) dest.GoalIdElement = new List(GoalIdElement.DeepCopyInternal()); - if(TriggerDefinition.Any()) dest.TriggerDefinition = new List(TriggerDefinition.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); - if(Transform != null) dest.Transform = (Hl7.Fhir.Model.ResourceReference)Transform.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)_TextEquivalentElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_GoalIdElement is not null) dest.GoalIdElement = new List(_GoalIdElement.DeepCopyInternal()); + if(_TriggerDefinition is not null) dest.TriggerDefinition = new List(_TriggerDefinition.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); + if(_Transform is not null) dest.Transform = (Hl7.Fhir.Model.ResourceReference)_Transform.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1031,202 +995,202 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(GoalIdElement, otherT.GoalIdElement)) return false; - if(!comparer.ListEquals(TriggerDefinition, otherT.TriggerDefinition)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(Transform, otherT.Transform)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_GoalIdElement, otherT._GoalIdElement)) return false; + if(!comparer.ListEquals(_TriggerDefinition, otherT._TriggerDefinition)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_Transform, otherT._Transform)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "goalId": - value = GoalIdElement; - return GoalIdElement?.Any() == true; + value = _GoalIdElement; + return _GoalIdElement?.Any() == true; case "triggerDefinition": - value = TriggerDefinition; - return TriggerDefinition?.Any() == true; + value = _TriggerDefinition; + return _TriggerDefinition?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "transform": - value = Transform; - return Transform is not null; + value = _Transform; + return _Transform is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.FhirString)value; + TextEquivalentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "goalId": - GoalIdElement = (List)value; + GoalIdElement = (List?)value!; return this; case "triggerDefinition": - TriggerDefinition = (List)value; + TriggerDefinition = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "transform": - Transform = (Hl7.Fhir.Model.ResourceReference)value; + Transform = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1237,31 +1201,31 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",GoalIdElement); - if (TriggerDefinition?.Any() == true) yield return new KeyValuePair("triggerDefinition",TriggerDefinition); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (Transform is not null) yield return new KeyValuePair("transform",Transform); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",_GoalIdElement); + if (_TriggerDefinition?.Any() == true) yield return new KeyValuePair("triggerDefinition",_TriggerDefinition); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_Transform is not null) yield return new KeyValuePair("transform",_Transform); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1290,13 +1254,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -1305,13 +1269,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1321,28 +1282,25 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1352,28 +1310,25 @@ public string Description /// [FhirElement("language", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LanguageElement + public Hl7.Fhir.Model.FhirString? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.FhirString _LanguageElement; + private Hl7.Fhir.Model.FhirString? _LanguageElement; /// /// Language of the expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.FhirString(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Language"); } } @@ -1383,46 +1338,39 @@ public string Language /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Boolean-valued expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1434,55 +1382,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.FhirString)value; + LanguageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1493,10 +1441,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -1524,28 +1472,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ActionIdElement + public Hl7.Fhir.Model.Id? ActionIdElement { get { return _ActionIdElement; } set { _ActionIdElement = value; OnPropertyChanged("ActionIdElement"); } } - private Hl7.Fhir.Model.Id _ActionIdElement; + private Hl7.Fhir.Model.Id? _ActionIdElement; /// /// What action is this related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActionId + public string? ActionId { - get { return ActionIdElement != null ? ActionIdElement.Value : null; } + get => _ActionIdElement?.Value; set { - if (value == null) - ActionIdElement = null; - else - ActionIdElement = new Hl7.Fhir.Model.Id(value); + ActionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ActionId"); } } @@ -1558,13 +1503,13 @@ public string ActionId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end @@ -1573,13 +1518,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -1591,27 +1533,23 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActionIdElement != null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)ActionIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_ActionIdElement is not null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)_ActionIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1623,48 +1561,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActionIdElement, otherT.ActionIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actionId": - value = ActionIdElement; - return ActionIdElement is not null; + value = _ActionIdElement; + return _ActionIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actionId": - ActionIdElement = (Hl7.Fhir.Model.Id)value; + ActionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1675,9 +1613,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActionIdElement is not null) yield return new KeyValuePair("actionId",ActionIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_ActionIdElement is not null) yield return new KeyValuePair("actionId",_ActionIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -1706,13 +1644,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// patient | practitioner | related-person @@ -1721,13 +1659,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1738,26 +1673,22 @@ public Hl7.Fhir.Model.ActionParticipantType? Type [FhirElement("role", Order=50)] [Binding("ActionParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1769,41 +1700,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1814,8 +1745,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -1841,28 +1772,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the dynamic value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1872,28 +1800,25 @@ public string Description /// [FhirElement("path", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -1903,28 +1828,25 @@ public string Path /// [FhirElement("language", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LanguageElement + public Hl7.Fhir.Model.FhirString? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.FhirString _LanguageElement; + private Hl7.Fhir.Model.FhirString? _LanguageElement; /// /// Language of the expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.FhirString(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Language"); } } @@ -1934,46 +1856,39 @@ public string Language /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// An expression that provides the dynamic value for the customization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1985,55 +1900,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.FhirString)value; + LanguageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2044,10 +1959,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -2057,28 +1972,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this plan definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2091,39 +2003,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the plan definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2133,28 +2042,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this plan definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2164,28 +2070,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this plan definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2196,13 +2099,13 @@ public string Title [FhirElement("type", InSummary=true, Order=140)] [Binding("PlanDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// draft | active | retired | unknown. @@ -2212,13 +2115,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2227,13 +2130,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2243,13 +2143,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=160, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2258,13 +2158,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2274,28 +2171,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2305,28 +2199,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2336,28 +2227,25 @@ public string Publisher /// [FhirElement("description", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2367,28 +2255,25 @@ public string Description /// [FhirElement("purpose", Order=200, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this plan definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2398,28 +2283,25 @@ public string Purpose /// [FhirElement("usage", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the asset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -2429,28 +2311,25 @@ public string Usage /// [FhirElement("approvalDate", Order=220)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the plan definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -2460,28 +2339,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=230)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the plan definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2491,13 +2367,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Context the content is intended to support. @@ -2507,11 +2383,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for plan definition (if applicable). @@ -2522,11 +2398,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// E.g. Education, Treatment, Assessment, etc. @@ -2537,11 +2413,11 @@ public List Jurisdiction [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// A content contributor. @@ -2551,11 +2427,11 @@ public List Topic [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Contact details for the publisher. @@ -2565,39 +2441,36 @@ public List Contributor [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=300)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2610,11 +2483,11 @@ public string Copyright [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the plan definition. @@ -2626,11 +2499,11 @@ public List RelatedArtifact [DataMember] public List Library { - get { if(_Library==null) _Library = new List(); return _Library; } + get => _Library ?? new List(); set { _Library = value; OnPropertyChanged("Library"); } } - private List _Library; + private List? _Library; /// /// What the plan is trying to accomplish. @@ -2640,11 +2513,11 @@ public List Library [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Action defined by the plan. @@ -2654,50 +2527,46 @@ public List Goal [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PlanDefinition; - - if (dest == null) - { + if(other is not PlanDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Library.Any()) dest.Library = new List(Library.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Library is not null) dest.Library = new List(_Library.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2709,209 +2578,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanDefinition; - if(otherT == null) return false; + if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Library, otherT.Library)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Library, otherT._Library)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = Library; - return Library?.Any() == true; + value = _Library; + return _Library?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - Library = (List)value; + Library = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2922,32 +2791,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Library?.Any() == true) yield return new KeyValuePair("library",Library); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Library?.Any() == true) yield return new KeyValuePair("library",_Library); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs index 781bc108d..04a97d962 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,11 +84,11 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Coded representation of the qualification. @@ -94,26 +97,26 @@ public List Identifier [Binding("Qualification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Period during which the qualification is valid. /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that regulates and issues the qualification. @@ -122,28 +125,24 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; protected internal override void CopyToInternal(Base other) { - var dest = other as QualificationComponent; - - if (dest == null) - { + if(other is not QualificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -155,55 +154,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualificationComponent; - if(otherT == null) return false; + if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -214,10 +213,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); } } @@ -230,24 +229,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner's record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner's record is in active use @@ -256,13 +255,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -275,11 +271,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the practitioner (that apply to all roles). @@ -289,11 +285,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address(es) of the practitioner that are not role specific (typically home address). @@ -303,11 +299,11 @@ public List Telecom [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// male | female | other | unknown. @@ -316,13 +312,13 @@ public List Address [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -331,13 +327,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -347,28 +340,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the practitioner was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -381,11 +371,11 @@ public string BirthDate [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Qualifications obtained by training and certification. @@ -395,11 +385,11 @@ public List Photo [DataMember] public List Qualification { - get { if(_Qualification==null) _Qualification = new List(); return _Qualification; } + get => _Qualification ?? new List(); set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private List _Qualification; + private List? _Qualification; /// /// A language the practitioner is able to use in patient communication. @@ -410,34 +400,30 @@ public List Qualification [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Practitioner; - - if (dest == null) - { + if(other is not Practitioner dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Qualification.Any()) dest.Qualification = new List(Qualification.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Qualification is not null) dest.Qualification = new List(_Qualification.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -449,97 +435,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Practitioner; - if(otherT == null) return false; + if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Qualification, otherT.Qualification)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "qualification": - value = Qualification; - return Qualification?.Any() == true; + value = _Qualification; + return _Qualification?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "qualification": - Qualification = (List)value; + Qualification = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -550,16 +536,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Qualification?.Any() == true) yield return new KeyValuePair("qualification",Qualification); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Qualification?.Any() == true) yield return new KeyValuePair("qualification",_Qualification); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs index 8f323868e..cfbd1e15f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -86,24 +89,24 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -115,13 +118,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// Always available? e.g. 24 hour service @@ -130,13 +133,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -146,28 +146,25 @@ public bool? AllDay /// [FhirElement("availableStartTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time AvailableStartTimeElement + public Hl7.Fhir.Model.Time? AvailableStartTimeElement { get { return _AvailableStartTimeElement; } set { _AvailableStartTimeElement = value; OnPropertyChanged("AvailableStartTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableStartTimeElement; + private Hl7.Fhir.Model.Time? _AvailableStartTimeElement; /// /// Opening time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableStartTime + public string? AvailableStartTime { - get { return AvailableStartTimeElement != null ? AvailableStartTimeElement.Value : null; } + get => _AvailableStartTimeElement?.Value; set { - if (value == null) - AvailableStartTimeElement = null; - else - AvailableStartTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableStartTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableStartTime"); } } @@ -177,46 +174,39 @@ public string AvailableStartTime /// [FhirElement("availableEndTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time AvailableEndTimeElement + public Hl7.Fhir.Model.Time? AvailableEndTimeElement { get { return _AvailableEndTimeElement; } set { _AvailableEndTimeElement = value; OnPropertyChanged("AvailableEndTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableEndTimeElement; + private Hl7.Fhir.Model.Time? _AvailableEndTimeElement; /// /// Closing time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableEndTime + public string? AvailableEndTime { - get { return AvailableEndTimeElement != null ? AvailableEndTimeElement.Value : null; } + get => _AvailableEndTimeElement?.Value; set { - if (value == null) - AvailableEndTimeElement = null; - else - AvailableEndTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableEndTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableEndTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AvailableTimeComponent; - - if (dest == null) - { + if(other is not AvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(AvailableStartTimeElement != null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)AvailableStartTimeElement.DeepCopyInternal(); - if(AvailableEndTimeElement != null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)AvailableEndTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_AvailableStartTimeElement is not null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)_AvailableStartTimeElement.DeepCopyInternal(); + if(_AvailableEndTimeElement is not null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)_AvailableEndTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -228,55 +218,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AvailableTimeComponent; - if(otherT == null) return false; + if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(AvailableStartTimeElement, otherT.AvailableStartTimeElement)) return false; - if(!comparer.Equals(AvailableEndTimeElement, otherT.AvailableEndTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; + if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "availableStartTime": - value = AvailableStartTimeElement; - return AvailableStartTimeElement is not null; + value = _AvailableStartTimeElement; + return _AvailableStartTimeElement is not null; case "availableEndTime": - value = AvailableEndTimeElement; - return AvailableEndTimeElement is not null; + value = _AvailableEndTimeElement; + return _AvailableEndTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableStartTime": - AvailableStartTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableStartTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "availableEndTime": - AvailableEndTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableEndTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -287,10 +277,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",AvailableStartTimeElement); - if (AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",AvailableEndTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",_AvailableStartTimeElement); + if (_AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",_AvailableEndTimeElement); } } @@ -317,28 +307,25 @@ public partial class NotAvailableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason presented to the user explaining why time not available /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -348,26 +335,22 @@ public string Description /// [FhirElement("during", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period During + public Hl7.Fhir.Model.Period? During { get { return _During; } set { _During = value; OnPropertyChanged("During"); } } - private Hl7.Fhir.Model.Period _During; + private Hl7.Fhir.Model.Period? _During; protected internal override void CopyToInternal(Base other) { - var dest = other as NotAvailableComponent; - - if (dest == null) - { + if(other is not NotAvailableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(During != null) dest.During = (Hl7.Fhir.Model.Period)During.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_During is not null) dest.During = (Hl7.Fhir.Model.Period)_During.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -379,41 +362,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotAvailableComponent; - if(otherT == null) return false; + if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(During, otherT.During)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_During, otherT._During)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "during": - value = During; - return During is not null; + value = _During; + return _During is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "during": - During = (Hl7.Fhir.Model.Period)value; + During = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -424,8 +407,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (During is not null) yield return new KeyValuePair("during",During); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_During is not null) yield return new KeyValuePair("during",_During); } } @@ -438,24 +421,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner's record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner's record is in active use @@ -464,13 +447,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -480,13 +460,13 @@ public bool? Active /// [FhirElement("period", InSummary=true, Order=110, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Practitioner that is able to provide the defined services for the organation. @@ -495,13 +475,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Practitioner + public Hl7.Fhir.Model.ResourceReference? Practitioner { get { return _Practitioner; } set { _Practitioner = value; OnPropertyChanged("Practitioner"); } } - private Hl7.Fhir.Model.ResourceReference _Practitioner; + private Hl7.Fhir.Model.ResourceReference? _Practitioner; /// /// Organization where the roles are available. @@ -510,13 +490,13 @@ public Hl7.Fhir.Model.ResourceReference Practitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Roles which this practitioner may perform. @@ -527,11 +507,11 @@ public Hl7.Fhir.Model.ResourceReference Organization [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Specific specialty of the practitioner. @@ -542,11 +522,11 @@ public List Code [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The location(s) at which this practitioner provides care. @@ -558,11 +538,11 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// The list of healthcare services that this worker provides for this role's Organization/Location(s). @@ -574,11 +554,11 @@ public List Location [DataMember] public List HealthcareService { - get { if(_HealthcareService==null) _HealthcareService = new List(); return _HealthcareService; } + get => _HealthcareService ?? new List(); set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } - private List _HealthcareService; + private List? _HealthcareService; /// /// Contact details that are specific to the role/location/service. @@ -588,11 +568,11 @@ public List HealthcareService [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Times the Service Site is available. @@ -602,11 +582,11 @@ public List Telecom [DataMember] public List AvailableTime { - get { if(_AvailableTime==null) _AvailableTime = new List(); return _AvailableTime; } + get => _AvailableTime ?? new List(); set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } - private List _AvailableTime; + private List? _AvailableTime; /// /// Not available during this time due to provided reason. @@ -616,39 +596,36 @@ public List AvailableTim [DataMember] public List NotAvailable { - get { if(_NotAvailable==null) _NotAvailable = new List(); return _NotAvailable; } + get => _NotAvailable ?? new List(); set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } - private List _NotAvailable; + private List? _NotAvailable; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -663,38 +640,34 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PractitionerRole; - - if (dest == null) - { + if(other is not PractitionerRole dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Practitioner != null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)Practitioner.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(HealthcareService.Any()) dest.HealthcareService = new List(HealthcareService.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(AvailableTime.Any()) dest.AvailableTime = new List(AvailableTime.DeepCopyInternal()); - if(NotAvailable.Any()) dest.NotAvailable = new List(NotAvailable.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Practitioner is not null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)_Practitioner.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_HealthcareService is not null) dest.HealthcareService = new List(_HealthcareService.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_AvailableTime is not null) dest.AvailableTime = new List(_AvailableTime.DeepCopyInternal()); + if(_NotAvailable is not null) dest.NotAvailable = new List(_NotAvailable.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -706,125 +679,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PractitionerRole; - if(otherT == null) return false; + if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Practitioner, otherT.Practitioner)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(HealthcareService, otherT.HealthcareService)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(AvailableTime, otherT.AvailableTime)) return false; - if(!comparer.ListEquals(NotAvailable, otherT.NotAvailable)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "practitioner": - value = Practitioner; - return Practitioner is not null; + value = _Practitioner; + return _Practitioner is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "healthcareService": - value = HealthcareService; - return HealthcareService?.Any() == true; + value = _HealthcareService; + return _HealthcareService?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "availableTime": - value = AvailableTime; - return AvailableTime?.Any() == true; + value = _AvailableTime; + return _AvailableTime?.Any() == true; case "notAvailable": - value = NotAvailable; - return NotAvailable?.Any() == true; + value = _NotAvailable; + return _NotAvailable?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "practitioner": - Practitioner = (Hl7.Fhir.Model.ResourceReference)value; + Practitioner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "healthcareService": - HealthcareService = (List)value; + HealthcareService = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "availableTime": - AvailableTime = (List)value; + AvailableTime = (List?)value!; return this; case "notAvailable": - NotAvailable = (List)value; + NotAvailable = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -835,20 +808,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Practitioner is not null) yield return new KeyValuePair("practitioner",Practitioner); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",HealthcareService); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",AvailableTime); - if (NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",NotAvailable); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Practitioner is not null) yield return new KeyValuePair("practitioner",_Practitioner); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",_HealthcareService); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",_AvailableTime); + if (_NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",_NotAvailable); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs b/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs index 13cee663a..9ed8209f2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("role", InSummary=true, Order=40)] [Binding("ProcedurePerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// The reference to the practitioner. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Practitioner","Organization","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Organization the device or practitioner was acting for. @@ -112,27 +115,23 @@ public Hl7.Fhir.Model.ResourceReference Actor [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -144,48 +143,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -196,9 +195,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -225,13 +224,13 @@ public partial class FocalDeviceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("action", Order=40)] [Binding("DeviceActionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Device that was changed. @@ -241,26 +240,22 @@ public Hl7.Fhir.Model.CodeableConcept Action [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manipulated + public Hl7.Fhir.Model.ResourceReference? Manipulated { get { return _Manipulated; } set { _Manipulated = value; OnPropertyChanged("Manipulated"); } } - private Hl7.Fhir.Model.ResourceReference _Manipulated; + private Hl7.Fhir.Model.ResourceReference? _Manipulated; protected internal override void CopyToInternal(Base other) { - var dest = other as FocalDeviceComponent; - - if (dest == null) - { + if(other is not FocalDeviceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(Manipulated != null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)Manipulated.DeepCopyInternal(); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_Manipulated is not null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)_Manipulated.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,41 +267,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocalDeviceComponent; - if(otherT == null) return false; + if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(Manipulated, otherT.Manipulated)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "manipulated": - value = Manipulated; - return Manipulated is not null; + value = _Manipulated; + return _Manipulated is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manipulated": - Manipulated = (Hl7.Fhir.Model.ResourceReference)value; + Manipulated = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -317,8 +312,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (Manipulated is not null) yield return new KeyValuePair("manipulated",Manipulated); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_Manipulated is not null) yield return new KeyValuePair("manipulated",_Manipulated); } } @@ -331,11 +326,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -347,11 +342,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// A request for this procedure. @@ -363,11 +358,11 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -379,11 +374,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown. @@ -393,13 +388,13 @@ public List PartOf [Binding("ProcedureStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown @@ -408,13 +403,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -424,13 +416,13 @@ public Hl7.Fhir.Model.EventStatus? Status /// [FhirElement("notDone", InSummary=true, IsModifier=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NotDoneElement + public Hl7.Fhir.Model.FhirBoolean? NotDoneElement { get { return _NotDoneElement; } set { _NotDoneElement = value; OnPropertyChanged("NotDoneElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NotDoneElement; + private Hl7.Fhir.Model.FhirBoolean? _NotDoneElement; /// /// True if procedure was not performed as scheduled @@ -439,13 +431,10 @@ public Hl7.Fhir.Model.FhirBoolean NotDoneElement [IgnoreDataMember] public bool? NotDone { - get { return NotDoneElement != null ? NotDoneElement.Value : null; } + get => _NotDoneElement?.Value; set { - if (value == null) - NotDoneElement = null; - else - NotDoneElement = new Hl7.Fhir.Model.FhirBoolean(value); + NotDoneElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NotDone"); } } @@ -456,13 +445,13 @@ public bool? NotDone [FhirElement("notDoneReason", InSummary=true, Order=150)] [Binding("ProcedureNegationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept NotDoneReason + public Hl7.Fhir.Model.CodeableConcept? NotDoneReason { get { return _NotDoneReason; } set { _NotDoneReason = value; OnPropertyChanged("NotDoneReason"); } } - private Hl7.Fhir.Model.CodeableConcept _NotDoneReason; + private Hl7.Fhir.Model.CodeableConcept? _NotDoneReason; /// /// Classification of the procedure. @@ -470,13 +459,13 @@ public Hl7.Fhir.Model.CodeableConcept NotDoneReason [FhirElement("category", InSummary=true, Order=160, FiveWs="class")] [Binding("ProcedureCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Identification of the procedure. @@ -484,13 +473,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", InSummary=true, Order=170, FiveWs="what")] [Binding("ProcedureCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the procedure was performed on. @@ -500,13 +489,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or episode associated with the procedure. @@ -515,13 +504,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Date/Period the procedure was performed. @@ -530,13 +519,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Performed + public Hl7.Fhir.Model.DataType? Performed { get { return _Performed; } set { _Performed = value; OnPropertyChanged("Performed"); } } - private Hl7.Fhir.Model.DataType _Performed; + private Hl7.Fhir.Model.DataType? _Performed; /// /// The people who performed the procedure. @@ -546,11 +535,11 @@ public Hl7.Fhir.Model.DataType Performed [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the procedure happened. @@ -559,13 +548,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Coded reason procedure performed. @@ -576,11 +565,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition that is the reason the procedure performed. @@ -592,11 +581,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Target body sites. @@ -607,11 +596,11 @@ public List ReasonReference [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// The result of procedure. @@ -619,13 +608,13 @@ public List BodySite [FhirElement("outcome", InSummary=true, Order=260)] [Binding("ProcedureOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Any report resulting from the procedure. @@ -637,11 +626,11 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [DataMember] public List Report { - get { if(_Report==null) _Report = new List(); return _Report; } + get => _Report ?? new List(); set { _Report = value; OnPropertyChanged("Report"); } } - private List _Report; + private List? _Report; /// /// Complication following the procedure. @@ -652,11 +641,11 @@ public List Report [DataMember] public List Complication { - get { if(_Complication==null) _Complication = new List(); return _Complication; } + get => _Complication ?? new List(); set { _Complication = value; OnPropertyChanged("Complication"); } } - private List _Complication; + private List? _Complication; /// /// A condition that is a result of the procedure. @@ -668,11 +657,11 @@ public List Complication [DataMember] public List ComplicationDetail { - get { if(_ComplicationDetail==null) _ComplicationDetail = new List(); return _ComplicationDetail; } + get => _ComplicationDetail ?? new List(); set { _ComplicationDetail = value; OnPropertyChanged("ComplicationDetail"); } } - private List _ComplicationDetail; + private List? _ComplicationDetail; /// /// Instructions for follow up. @@ -683,11 +672,11 @@ public List ComplicationDetail [DataMember] public List FollowUp { - get { if(_FollowUp==null) _FollowUp = new List(); return _FollowUp; } + get => _FollowUp ?? new List(); set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } - private List _FollowUp; + private List? _FollowUp; /// /// Additional information about the procedure. @@ -697,11 +686,11 @@ public List FollowUp [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Device changed in procedure. @@ -711,11 +700,11 @@ public List Note [DataMember] public List FocalDevice { - get { if(_FocalDevice==null) _FocalDevice = new List(); return _FocalDevice; } + get => _FocalDevice ?? new List(); set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } - private List _FocalDevice; + private List? _FocalDevice; /// /// Items used during procedure. @@ -727,11 +716,11 @@ public List FocalDevice [DataMember] public List UsedReference { - get { if(_UsedReference==null) _UsedReference = new List(); return _UsedReference; } + get => _UsedReference ?? new List(); set { _UsedReference = value; OnPropertyChanged("UsedReference"); } } - private List _UsedReference; + private List? _UsedReference; /// /// Coded items used during the procedure. @@ -742,50 +731,46 @@ public List UsedReference [DataMember] public List UsedCode { - get { if(_UsedCode==null) _UsedCode = new List(); return _UsedCode; } + get => _UsedCode ?? new List(); set { _UsedCode = value; OnPropertyChanged("UsedCode"); } } - private List _UsedCode; + private List? _UsedCode; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Procedure; - - if (dest == null) - { + if(other is not Procedure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(NotDoneElement != null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)NotDoneElement.DeepCopyInternal(); - if(NotDoneReason != null) dest.NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)NotDoneReason.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Performed != null) dest.Performed = (Hl7.Fhir.Model.DataType)Performed.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Report.Any()) dest.Report = new List(Report.DeepCopyInternal()); - if(Complication.Any()) dest.Complication = new List(Complication.DeepCopyInternal()); - if(ComplicationDetail.Any()) dest.ComplicationDetail = new List(ComplicationDetail.DeepCopyInternal()); - if(FollowUp.Any()) dest.FollowUp = new List(FollowUp.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(FocalDevice.Any()) dest.FocalDevice = new List(FocalDevice.DeepCopyInternal()); - if(UsedReference.Any()) dest.UsedReference = new List(UsedReference.DeepCopyInternal()); - if(UsedCode.Any()) dest.UsedCode = new List(UsedCode.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_NotDoneElement is not null) dest.NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)_NotDoneElement.DeepCopyInternal(); + if(_NotDoneReason is not null) dest.NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)_NotDoneReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Performed is not null) dest.Performed = (Hl7.Fhir.Model.DataType)_Performed.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Report is not null) dest.Report = new List(_Report.DeepCopyInternal()); + if(_Complication is not null) dest.Complication = new List(_Complication.DeepCopyInternal()); + if(_ComplicationDetail is not null) dest.ComplicationDetail = new List(_ComplicationDetail.DeepCopyInternal()); + if(_FollowUp is not null) dest.FollowUp = new List(_FollowUp.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_FocalDevice is not null) dest.FocalDevice = new List(_FocalDevice.DeepCopyInternal()); + if(_UsedReference is not null) dest.UsedReference = new List(_UsedReference.DeepCopyInternal()); + if(_UsedCode is not null) dest.UsedCode = new List(_UsedCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -797,209 +782,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Procedure; - if(otherT == null) return false; + if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(NotDoneElement, otherT.NotDoneElement)) return false; - if(!comparer.Equals(NotDoneReason, otherT.NotDoneReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Performed, otherT.Performed)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.ListEquals(Report, otherT.Report)) return false; - if(!comparer.ListEquals(Complication, otherT.Complication)) return false; - if(!comparer.ListEquals(ComplicationDetail, otherT.ComplicationDetail)) return false; - if(!comparer.ListEquals(FollowUp, otherT.FollowUp)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(FocalDevice, otherT.FocalDevice)) return false; - if(!comparer.ListEquals(UsedReference, otherT.UsedReference)) return false; - if(!comparer.ListEquals(UsedCode, otherT.UsedCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_NotDoneElement, otherT._NotDoneElement)) return false; + if(!comparer.Equals(_NotDoneReason, otherT._NotDoneReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Performed, otherT._Performed)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.ListEquals(_Report, otherT._Report)) return false; + if(!comparer.ListEquals(_Complication, otherT._Complication)) return false; + if(!comparer.ListEquals(_ComplicationDetail, otherT._ComplicationDetail)) return false; + if(!comparer.ListEquals(_FollowUp, otherT._FollowUp)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; + if(!comparer.ListEquals(_UsedReference, otherT._UsedReference)) return false; + if(!comparer.ListEquals(_UsedCode, otherT._UsedCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "notDone": - value = NotDoneElement; - return NotDoneElement is not null; + value = _NotDoneElement; + return _NotDoneElement is not null; case "notDoneReason": - value = NotDoneReason; - return NotDoneReason is not null; + value = _NotDoneReason; + return _NotDoneReason is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "performed": - value = Performed; - return Performed is not null; + value = _Performed; + return _Performed is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "report": - value = Report; - return Report?.Any() == true; + value = _Report; + return _Report?.Any() == true; case "complication": - value = Complication; - return Complication?.Any() == true; + value = _Complication; + return _Complication?.Any() == true; case "complicationDetail": - value = ComplicationDetail; - return ComplicationDetail?.Any() == true; + value = _ComplicationDetail; + return _ComplicationDetail?.Any() == true; case "followUp": - value = FollowUp; - return FollowUp?.Any() == true; + value = _FollowUp; + return _FollowUp?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "focalDevice": - value = FocalDevice; - return FocalDevice?.Any() == true; + value = _FocalDevice; + return _FocalDevice?.Any() == true; case "usedReference": - value = UsedReference; - return UsedReference?.Any() == true; + value = _UsedReference; + return _UsedReference?.Any() == true; case "usedCode": - value = UsedCode; - return UsedCode?.Any() == true; + value = _UsedCode; + return _UsedCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "notDone": - NotDoneElement = (Hl7.Fhir.Model.FhirBoolean)value; + NotDoneElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "notDoneReason": - NotDoneReason = (Hl7.Fhir.Model.CodeableConcept)value; + NotDoneReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performed": - Performed = (Hl7.Fhir.Model.DataType)value; + Performed = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "report": - Report = (List)value; + Report = (List?)value!; return this; case "complication": - Complication = (List)value; + Complication = (List?)value!; return this; case "complicationDetail": - ComplicationDetail = (List)value; + ComplicationDetail = (List?)value!; return this; case "followUp": - FollowUp = (List)value; + FollowUp = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "focalDevice": - FocalDevice = (List)value; + FocalDevice = (List?)value!; return this; case "usedReference": - UsedReference = (List)value; + UsedReference = (List?)value!; return this; case "usedCode": - UsedCode = (List)value; + UsedCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1010,32 +995,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (NotDoneElement is not null) yield return new KeyValuePair("notDone",NotDoneElement); - if (NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",NotDoneReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Performed is not null) yield return new KeyValuePair("performed",Performed); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Report?.Any() == true) yield return new KeyValuePair("report",Report); - if (Complication?.Any() == true) yield return new KeyValuePair("complication",Complication); - if (ComplicationDetail?.Any() == true) yield return new KeyValuePair("complicationDetail",ComplicationDetail); - if (FollowUp?.Any() == true) yield return new KeyValuePair("followUp",FollowUp); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",FocalDevice); - if (UsedReference?.Any() == true) yield return new KeyValuePair("usedReference",UsedReference); - if (UsedCode?.Any() == true) yield return new KeyValuePair("usedCode",UsedCode); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_NotDoneElement is not null) yield return new KeyValuePair("notDone",_NotDoneElement); + if (_NotDoneReason is not null) yield return new KeyValuePair("notDoneReason",_NotDoneReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Performed is not null) yield return new KeyValuePair("performed",_Performed); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Report?.Any() == true) yield return new KeyValuePair("report",_Report); + if (_Complication?.Any() == true) yield return new KeyValuePair("complication",_Complication); + if (_ComplicationDetail?.Any() == true) yield return new KeyValuePair("complicationDetail",_ComplicationDetail); + if (_FollowUp?.Any() == true) yield return new KeyValuePair("followUp",_FollowUp); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",_FocalDevice); + if (_UsedReference?.Any() == true) yield return new KeyValuePair("usedReference",_UsedReference); + if (_UsedCode?.Any() == true) yield return new KeyValuePair("usedCode",_UsedCode); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs index 68e01a821..c8253ddaa 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class RequesterComponent : Hl7.Fhir.Model.BackboneElement [References("Device","Practitioner","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Agent + public Hl7.Fhir.Model.ResourceReference? Agent { get { return _Agent; } set { _Agent = value; OnPropertyChanged("Agent"); } } - private Hl7.Fhir.Model.ResourceReference _Agent; + private Hl7.Fhir.Model.ResourceReference? _Agent; /// /// Organization agent is acting for. @@ -99,26 +102,22 @@ public Hl7.Fhir.Model.ResourceReference Agent [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as RequesterComponent; - - if (dest == null) - { + if(other is not RequesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Agent != null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)Agent.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)_Agent.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -130,41 +129,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequesterComponent; - if(otherT == null) return false; + if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "agent": - value = Agent; - return Agent is not null; + value = _Agent; + return _Agent is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "agent": - Agent = (Hl7.Fhir.Model.ResourceReference)value; + Agent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -175,8 +174,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Agent is not null) yield return new KeyValuePair("agent",Agent); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Agent is not null) yield return new KeyValuePair("agent",_Agent); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -189,11 +188,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Protocol or definition. @@ -205,11 +204,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// What request fulfills. @@ -221,11 +220,11 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -237,24 +236,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite Request ID. /// [FhirElement("requisition", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier Requisition + public Hl7.Fhir.Model.Identifier? Requisition { get { return _Requisition; } set { _Requisition = value; OnPropertyChanged("Requisition"); } } - private Hl7.Fhir.Model.Identifier _Requisition; + private Hl7.Fhir.Model.Identifier? _Requisition; /// /// draft | active | suspended | completed | entered-in-error | cancelled. @@ -264,13 +263,13 @@ public Hl7.Fhir.Model.Identifier Requisition [Binding("ProcedureRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended | completed | entered-in-error | cancelled @@ -279,13 +278,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -298,13 +294,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("ProcedureRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order + @@ -313,13 +309,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -331,13 +324,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("ProcedureRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -346,13 +339,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -362,13 +352,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if procedure should not be performed @@ -377,13 +367,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -397,11 +384,11 @@ public bool? DoNotPerform [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What is being requested/ordered. @@ -410,13 +397,13 @@ public List Category [Binding("ProcedureRequestCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Individual the service is ordered for. @@ -426,13 +413,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode during which request was created. @@ -441,13 +428,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When procedure should occur. @@ -456,13 +443,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Preconditions for procedure or diagnostic. @@ -472,41 +459,38 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Date request signed. /// [FhirElement("authoredOn", InSummary=true, Order=240, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Date request signed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -516,13 +500,13 @@ public string AuthoredOn /// [FhirElement("requester", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.ProcedureRequest.RequesterComponent Requester + public Hl7.Fhir.Model.ProcedureRequest.RequesterComponent? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ProcedureRequest.RequesterComponent _Requester; + private Hl7.Fhir.Model.ProcedureRequest.RequesterComponent? _Requester; /// /// Performer role. @@ -530,13 +514,13 @@ public Hl7.Fhir.Model.ProcedureRequest.RequesterComponent Requester [FhirElement("performerType", InSummary=true, Order=260, FiveWs="who.actor")] [Binding("ProcedureRequestParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Requested perfomer. @@ -545,13 +529,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [CLSCompliant(false)] [References("Practitioner","Organization","Patient","Device","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Explanation/Justification for test. @@ -562,11 +546,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Explanation/Justification for test. @@ -578,11 +562,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Additional clinical information. @@ -594,11 +578,11 @@ public List ReasonReference [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Procedure Samples. @@ -610,11 +594,11 @@ public List SupportingInfo [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Location on Body. @@ -625,11 +609,11 @@ public List Specimen [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Comments. @@ -639,11 +623,11 @@ public List BodySite [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Request provenance. @@ -655,50 +639,46 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureRequest; - - if (dest == null) - { + if(other is not ProcedureRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(Requisition != null) dest.Requisition = (Hl7.Fhir.Model.Identifier)Requisition.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ProcedureRequest.RequesterComponent)Requester.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_Requisition is not null) dest.Requisition = (Hl7.Fhir.Model.Identifier)_Requisition.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ProcedureRequest.RequesterComponent)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -710,209 +690,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureRequest; - if(otherT == null) return false; + if(other is not ProcedureRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(Requisition, otherT.Requisition)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_Requisition, otherT._Requisition)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "requisition": - value = Requisition; - return Requisition is not null; + value = _Requisition; + return _Requisition is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "requisition": - Requisition = (Hl7.Fhir.Model.Identifier)value; + Requisition = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ProcedureRequest.RequesterComponent)value; + Requester = (Hl7.Fhir.Model.ProcedureRequest.RequesterComponent?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -923,32 +903,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (Requisition is not null) yield return new KeyValuePair("requisition",Requisition); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_Requisition is not null) yield return new KeyValuePair("requisition",_Requisition); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs index 0e776313f..d09d17d82 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,13 +118,13 @@ public partial class ItemsComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequenceLinkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer SequenceLinkIdElement + public Hl7.Fhir.Model.Integer? SequenceLinkIdElement { get { return _SequenceLinkIdElement; } set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } - private Hl7.Fhir.Model.Integer _SequenceLinkIdElement; + private Hl7.Fhir.Model.Integer? _SequenceLinkIdElement; /// /// Service instance @@ -130,28 +133,21 @@ public Hl7.Fhir.Model.Integer SequenceLinkIdElement [IgnoreDataMember] public int? SequenceLinkId { - get { return SequenceLinkIdElement != null ? SequenceLinkIdElement.Value : null; } + get => _SequenceLinkIdElement?.Value; set { - if (value == null) - SequenceLinkIdElement = null; - else - SequenceLinkIdElement = new Hl7.Fhir.Model.Integer(value); + SequenceLinkIdElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("SequenceLinkId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ItemsComponent; - - if (dest == null) - { + if(other is not ItemsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceLinkIdElement != null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.Integer)SequenceLinkIdElement.DeepCopyInternal(); + if(_SequenceLinkIdElement is not null) dest.SequenceLinkIdElement = (Hl7.Fhir.Model.Integer)_SequenceLinkIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -163,34 +159,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemsComponent; - if(otherT == null) return false; + if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceLinkIdElement, otherT.SequenceLinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceLinkId": - value = SequenceLinkIdElement; - return SequenceLinkIdElement is not null; + value = _SequenceLinkIdElement; + return _SequenceLinkIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceLinkId": - SequenceLinkIdElement = (Hl7.Fhir.Model.Integer)value; + SequenceLinkIdElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -201,7 +197,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",SequenceLinkIdElement); + if (_SequenceLinkIdElement is not null) yield return new KeyValuePair("sequenceLinkId",_SequenceLinkIdElement); } } @@ -214,11 +210,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -227,13 +223,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("ProcessRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -242,13 +238,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -260,13 +253,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [DeclaredType(Type = typeof(Code))] [Binding("ActionList")] [DataMember] - public Code ActionElement + public Code? ActionElement { get { return _ActionElement; } set { _ActionElement = value; OnPropertyChanged("ActionElement"); } } - private Code _ActionElement; + private Code? _ActionElement; /// /// cancel | poll | reprocess | status @@ -275,13 +268,10 @@ public Code ActionElement [IgnoreDataMember] public Hl7.Fhir.Model.ProcessRequest.ActionList? Action { - get { return ActionElement != null ? ActionElement.Value : null; } + get => _ActionElement?.Value; set { - if (value == null) - ActionElement = null; - else - ActionElement = new Code(value); + ActionElement = value is null ? null : new Code(value); OnPropertyChanged("Action"); } } @@ -293,41 +283,38 @@ public Hl7.Fhir.Model.ProcessRequest.ActionList? Action [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// Creation date. /// [FhirElement("created", Order=130, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -339,13 +326,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Responsible organization. @@ -354,13 +341,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Reference to the Request resource. @@ -369,13 +356,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Reference to the Response resource. @@ -384,26 +371,26 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Remove history. /// [FhirElement("nullify", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NullifyElement + public Hl7.Fhir.Model.FhirBoolean? NullifyElement { get { return _NullifyElement; } set { _NullifyElement = value; OnPropertyChanged("NullifyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NullifyElement; + private Hl7.Fhir.Model.FhirBoolean? _NullifyElement; /// /// Remove history @@ -412,13 +399,10 @@ public Hl7.Fhir.Model.FhirBoolean NullifyElement [IgnoreDataMember] public bool? Nullify { - get { return NullifyElement != null ? NullifyElement.Value : null; } + get => _NullifyElement?.Value; set { - if (value == null) - NullifyElement = null; - else - NullifyElement = new Hl7.Fhir.Model.FhirBoolean(value); + NullifyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Nullify"); } } @@ -428,28 +412,25 @@ public bool? Nullify /// [FhirElement("reference", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceElement + public Hl7.Fhir.Model.FhirString? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceElement; + private Hl7.Fhir.Model.FhirString? _ReferenceElement; /// /// Reference number/string /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Reference"); } } @@ -462,11 +443,11 @@ public string Reference [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Resource type(s) to include. @@ -476,24 +457,24 @@ public List Item [DataMember] public List IncludeElement { - get { if(_IncludeElement==null) _IncludeElement = new List(); return _IncludeElement; } + get => _IncludeElement ?? new List(); set { _IncludeElement = value; OnPropertyChanged("IncludeElement"); } } - private List _IncludeElement; + private List? _IncludeElement; /// /// Resource type(s) to include /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Include + public IEnumerable? Include { - get { return IncludeElement != null ? IncludeElement.Select(elem => elem.Value) : null; } + get => _IncludeElement?.Select(elem => elem.Value); set { if (value == null) - IncludeElement = null; + IncludeElement = null!; else IncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Include"); @@ -508,24 +489,24 @@ public IEnumerable Include [DataMember] public List ExcludeElement { - get { if(_ExcludeElement==null) _ExcludeElement = new List(); return _ExcludeElement; } + get => _ExcludeElement ?? new List(); set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private List _ExcludeElement; + private List? _ExcludeElement; /// /// Resource type(s) to exclude /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Exclude + public IEnumerable? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Select(elem => elem.Value) : null; } + get => _ExcludeElement?.Select(elem => elem.Value); set { if (value == null) - ExcludeElement = null; + ExcludeElement = null!; else ExcludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Exclude"); @@ -537,41 +518,37 @@ public IEnumerable Exclude /// [FhirElement("period", Order=230)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessRequest; - - if (dest == null) - { + if(other is not ProcessRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ActionElement != null) dest.ActionElement = (Code)ActionElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(NullifyElement != null) dest.NullifyElement = (Hl7.Fhir.Model.FhirBoolean)NullifyElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirString)ReferenceElement.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(IncludeElement.Any()) dest.IncludeElement = new List(IncludeElement.DeepCopyInternal()); - if(ExcludeElement.Any()) dest.ExcludeElement = new List(ExcludeElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ActionElement is not null) dest.ActionElement = (Code)_ActionElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_NullifyElement is not null) dest.NullifyElement = (Hl7.Fhir.Model.FhirBoolean)_NullifyElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirString)_ReferenceElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_IncludeElement is not null) dest.IncludeElement = new List(_IncludeElement.DeepCopyInternal()); + if(_ExcludeElement is not null) dest.ExcludeElement = new List(_ExcludeElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -583,132 +560,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessRequest; - if(otherT == null) return false; + if(other is not ProcessRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ActionElement, otherT.ActionElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(NullifyElement, otherT.NullifyElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(IncludeElement, otherT.IncludeElement)) return false; - if(!comparer.ListEquals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_NullifyElement, otherT._NullifyElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_IncludeElement, otherT._IncludeElement)) return false; + if(!comparer.ListEquals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "action": - value = ActionElement; - return ActionElement is not null; + value = _ActionElement; + return _ActionElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "nullify": - value = NullifyElement; - return NullifyElement is not null; + value = _NullifyElement; + return _NullifyElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "include": - value = IncludeElement; - return IncludeElement?.Any() == true; + value = _IncludeElement; + return _IncludeElement?.Any() == true; case "exclude": - value = ExcludeElement; - return ExcludeElement?.Any() == true; + value = _ExcludeElement; + return _ExcludeElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "action": - ActionElement = (Code)value; + ActionElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "nullify": - NullifyElement = (Hl7.Fhir.Model.FhirBoolean)value; + NullifyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "include": - IncludeElement = (List)value; + IncludeElement = (List?)value!; return this; case "exclude": - ExcludeElement = (List)value; + ExcludeElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -719,21 +696,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ActionElement is not null) yield return new KeyValuePair("action",ActionElement); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (NullifyElement is not null) yield return new KeyValuePair("nullify",NullifyElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (IncludeElement?.Any() == true) yield return new KeyValuePair("include",IncludeElement); - if (ExcludeElement?.Any() == true) yield return new KeyValuePair("exclude",ExcludeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ActionElement is not null) yield return new KeyValuePair("action",_ActionElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_NullifyElement is not null) yield return new KeyValuePair("nullify",_NullifyElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_IncludeElement?.Any() == true) yield return new KeyValuePair("include",_IncludeElement); + if (_ExcludeElement?.Any() == true) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs index 1447bf538..cf0eba880 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,57 +84,50 @@ public partial class ProcessNoteComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("NoteType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Comment on the processing. /// [FhirElement("text", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Comment on the processing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessNoteComponent; - - if (dest == null) - { + if(other is not ProcessNoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,41 +139,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessNoteComponent; - if(otherT == null) return false; + if(other is not ProcessNoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -188,8 +184,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -202,11 +198,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -215,13 +211,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("ProcessResponseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -230,13 +226,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -246,28 +239,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("created", Order=110, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -279,13 +269,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Request reference. @@ -294,13 +284,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Processing outcome. @@ -308,41 +298,38 @@ public Hl7.Fhir.Model.ResourceReference Request [FhirElement("outcome", Order=140)] [Binding("ProcessingOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Disposition Message. /// [FhirElement("disposition", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -354,13 +341,13 @@ public string Disposition [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; /// /// Responsible organization. @@ -369,13 +356,13 @@ public Hl7.Fhir.Model.ResourceReference RequestProvider [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestOrganization + public Hl7.Fhir.Model.ResourceReference? RequestOrganization { get { return _RequestOrganization; } set { _RequestOrganization = value; OnPropertyChanged("RequestOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestOrganization; /// /// Printed Form Identifier. @@ -383,13 +370,13 @@ public Hl7.Fhir.Model.ResourceReference RequestOrganization [FhirElement("form", Order=180)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Processing comments or additional requirements. @@ -399,11 +386,11 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// Error code. @@ -414,11 +401,11 @@ public List ProcessNote [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; /// /// Request for additional information. @@ -430,37 +417,33 @@ public List Error [DataMember] public List CommunicationRequest { - get { if(_CommunicationRequest==null) _CommunicationRequest = new List(); return _CommunicationRequest; } + get => _CommunicationRequest ?? new List(); set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } - private List _CommunicationRequest; + private List? _CommunicationRequest; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessResponse; - - if (dest == null) - { + if(other is not ProcessResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); - if(RequestOrganization != null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)RequestOrganization.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); - if(CommunicationRequest.Any()) dest.CommunicationRequest = new List(CommunicationRequest.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); + if(_RequestOrganization is not null) dest.RequestOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestOrganization.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); + if(_CommunicationRequest is not null) dest.CommunicationRequest = new List(_CommunicationRequest.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -472,118 +455,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessResponse; - if(otherT == null) return false; + if(other is not ProcessResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; - if(!comparer.Equals(RequestOrganization, otherT.RequestOrganization)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; - if(!comparer.ListEquals(CommunicationRequest, otherT.CommunicationRequest)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; + if(!comparer.Equals(_RequestOrganization, otherT._RequestOrganization)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; + if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; case "requestOrganization": - value = RequestOrganization; - return RequestOrganization is not null; + value = _RequestOrganization; + return _RequestOrganization is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; case "communicationRequest": - value = CommunicationRequest; - return CommunicationRequest?.Any() == true; + value = _CommunicationRequest; + return _CommunicationRequest?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestOrganization": - RequestOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; case "communicationRequest": - CommunicationRequest = (List)value; + CommunicationRequest = (List?)value!; return this; default: return base.SetValue(key, value); @@ -594,19 +577,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); - if (RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",RequestOrganization); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); - if (CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",CommunicationRequest); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); + if (_RequestOrganization is not null) yield return new KeyValuePair("requestOrganization",_RequestOrganization); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); + if (_CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",_CommunicationRequest); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs index d639c3454..017b1491a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -126,11 +129,11 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Who participated. @@ -141,13 +144,13 @@ public List Role [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Who + public Hl7.Fhir.Model.DataType? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.DataType _Who; + private Hl7.Fhir.Model.DataType? _Who; /// /// Who the agent is representing. @@ -157,13 +160,13 @@ public Hl7.Fhir.Model.DataType Who [References("Practitioner","RelatedPerson","Patient","Device","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType OnBehalfOf + public Hl7.Fhir.Model.DataType? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.DataType _OnBehalfOf; + private Hl7.Fhir.Model.DataType? _OnBehalfOf; /// /// Type of relationship between agents. @@ -171,28 +174,24 @@ public Hl7.Fhir.Model.DataType OnBehalfOf [FhirElement("relatedAgentType", Order=70)] [Binding("RelatedAgentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RelatedAgentType + public Hl7.Fhir.Model.CodeableConcept? RelatedAgentType { get { return _RelatedAgentType; } set { _RelatedAgentType = value; OnPropertyChanged("RelatedAgentType"); } } - private Hl7.Fhir.Model.CodeableConcept _RelatedAgentType; + private Hl7.Fhir.Model.CodeableConcept? _RelatedAgentType; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Who != null) dest.Who = (Hl7.Fhir.Model.DataType)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.DataType)OnBehalfOf.DeepCopyInternal(); - if(RelatedAgentType != null) dest.RelatedAgentType = (Hl7.Fhir.Model.CodeableConcept)RelatedAgentType.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.DataType)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.DataType)_OnBehalfOf.DeepCopyInternal(); + if(_RelatedAgentType is not null) dest.RelatedAgentType = (Hl7.Fhir.Model.CodeableConcept)_RelatedAgentType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -204,55 +203,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(RelatedAgentType, otherT.RelatedAgentType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_RelatedAgentType, otherT._RelatedAgentType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "relatedAgentType": - value = RelatedAgentType; - return RelatedAgentType is not null; + value = _RelatedAgentType; + return _RelatedAgentType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (List)value; + Role = (List?)value!; return this; case "who": - Who = (Hl7.Fhir.Model.DataType)value; + Who = (Hl7.Fhir.Model.DataType?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.DataType)value; + OnBehalfOf = (Hl7.Fhir.Model.DataType?)value; return this; case "relatedAgentType": - RelatedAgentType = (Hl7.Fhir.Model.CodeableConcept)value; + RelatedAgentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -263,10 +262,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (RelatedAgentType is not null) yield return new KeyValuePair("relatedAgentType",RelatedAgentType); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_RelatedAgentType is not null) yield return new KeyValuePair("relatedAgentType",_RelatedAgentType); } } @@ -295,13 +294,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProvenanceEntityRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RoleElement + public Code? RoleElement { get { return _RoleElement; } set { _RoleElement = value; OnPropertyChanged("RoleElement"); } } - private Code _RoleElement; + private Code? _RoleElement; /// /// derivation | revision | quotation | source | removal @@ -310,13 +309,10 @@ public Code RoleElement [IgnoreDataMember] public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role { - get { return RoleElement != null ? RoleElement.Value : null; } + get => _RoleElement?.Value; set { - if (value == null) - RoleElement = null; - else - RoleElement = new Code(value); + RoleElement = value is null ? null : new Code(value); OnPropertyChanged("Role"); } } @@ -330,13 +326,13 @@ public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Identifier))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType What + public Hl7.Fhir.Model.DataType? What { get { return _What; } set { _What = value; OnPropertyChanged("What"); } } - private Hl7.Fhir.Model.DataType _What; + private Hl7.Fhir.Model.DataType? _What; /// /// Entity is attributed to this agent. @@ -346,25 +342,21 @@ public Hl7.Fhir.Model.DataType What [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RoleElement != null) dest.RoleElement = (Code)RoleElement.DeepCopyInternal(); - if(What != null) dest.What = (Hl7.Fhir.Model.DataType)What.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); + if(_RoleElement is not null) dest.RoleElement = (Code)_RoleElement.DeepCopyInternal(); + if(_What is not null) dest.What = (Hl7.Fhir.Model.DataType)_What.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -376,48 +368,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RoleElement, otherT.RoleElement)) return false; - if(!comparer.Equals(What, otherT.What)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + if(!comparer.Equals(_What, otherT._What)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = RoleElement; - return RoleElement is not null; + value = _RoleElement; + return _RoleElement is not null; case "what": - value = What; - return What is not null; + value = _What; + return _What is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - RoleElement = (Code)value; + RoleElement = (Code?)value; return this; case "what": - What = (Hl7.Fhir.Model.DataType)value; + What = (Hl7.Fhir.Model.DataType?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -428,9 +420,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RoleElement is not null) yield return new KeyValuePair("role",RoleElement); - if (What is not null) yield return new KeyValuePair("what",What); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); + if (_RoleElement is not null) yield return new KeyValuePair("role",_RoleElement); + if (_What is not null) yield return new KeyValuePair("what",_What); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); } } @@ -445,24 +437,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// When the activity occurred. /// [FhirElement("period", Order=100, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// When the activity was recorded / updated. @@ -470,13 +462,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("recorded", InSummary=true, Order=110, FiveWs="when.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// When the activity was recorded / updated @@ -485,13 +477,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -504,24 +493,24 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy or plan the activity was defined by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -535,13 +524,13 @@ public IEnumerable Policy [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Reason the activity is occurring. @@ -552,11 +541,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Activity that occurred. @@ -564,13 +553,13 @@ public List Reason [FhirElement("activity", Order=150, FiveWs="why")] [Binding("ProvenanceActivity")] [DataMember] - public Hl7.Fhir.Model.Coding Activity + public Hl7.Fhir.Model.Coding? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.Coding _Activity; + private Hl7.Fhir.Model.Coding? _Activity; /// /// Actor involved. @@ -580,11 +569,11 @@ public Hl7.Fhir.Model.Coding Activity [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// An entity used in this activity. @@ -594,11 +583,11 @@ public List Agent [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; /// /// Signature on target. @@ -608,32 +597,28 @@ public List Entity [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as Provenance; - - if (dest == null) - { + if(other is not Provenance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.Coding)Activity.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.Coding)_Activity.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -645,97 +630,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Provenance; - if(otherT == null) return false; + if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (List)value; + Target = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "activity": - Activity = (Hl7.Fhir.Model.Coding)value; + Activity = (Hl7.Fhir.Model.Coding?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -746,16 +731,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs index a85c72184..5b9abf9d5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -188,28 +191,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for item in questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -219,28 +219,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -254,39 +251,36 @@ public string Definition [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// E.g. "1(a)", "2.5.3". /// [FhirElement("prefix", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// E.g. "1(a)", "2.5.3" /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -296,28 +290,25 @@ public string Prefix /// [FhirElement("text", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Primary text for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -330,13 +321,13 @@ public string Text [Binding("QuestionnaireItemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// group | display | boolean | decimal | integer | date | dateTime + @@ -345,13 +336,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -364,24 +352,24 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get { if(_EnableWhen==null) _EnableWhen = new List(); return _EnableWhen; } + get => _EnableWhen ?? new List(); set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } - private List _EnableWhen; + private List? _EnableWhen; /// /// Whether the item must be included in data results. /// [FhirElement("required", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Whether the item must be included in data results @@ -390,13 +378,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -406,13 +391,13 @@ public bool? Required /// [FhirElement("repeats", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RepeatsElement + public Hl7.Fhir.Model.FhirBoolean? RepeatsElement { get { return _RepeatsElement; } set { _RepeatsElement = value; OnPropertyChanged("RepeatsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RepeatsElement; + private Hl7.Fhir.Model.FhirBoolean? _RepeatsElement; /// /// Whether the item may repeat @@ -421,13 +406,10 @@ public Hl7.Fhir.Model.FhirBoolean RepeatsElement [IgnoreDataMember] public bool? Repeats { - get { return RepeatsElement != null ? RepeatsElement.Value : null; } + get => _RepeatsElement?.Value; set { - if (value == null) - RepeatsElement = null; - else - RepeatsElement = new Hl7.Fhir.Model.FhirBoolean(value); + RepeatsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Repeats"); } } @@ -437,13 +419,13 @@ public bool? Repeats /// [FhirElement("readOnly", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement + public Hl7.Fhir.Model.FhirBoolean? ReadOnlyElement { get { return _ReadOnlyElement; } set { _ReadOnlyElement = value; OnPropertyChanged("ReadOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReadOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _ReadOnlyElement; /// /// Don't allow human editing @@ -452,13 +434,10 @@ public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement [IgnoreDataMember] public bool? ReadOnly { - get { return ReadOnlyElement != null ? ReadOnlyElement.Value : null; } + get => _ReadOnlyElement?.Value; set { - if (value == null) - ReadOnlyElement = null; - else - ReadOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReadOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReadOnly"); } } @@ -468,13 +447,13 @@ public bool? ReadOnly /// [FhirElement("maxLength", Order=140)] [DataMember] - public Hl7.Fhir.Model.Integer MaxLengthElement + public Hl7.Fhir.Model.Integer? MaxLengthElement { get { return _MaxLengthElement; } set { _MaxLengthElement = value; OnPropertyChanged("MaxLengthElement"); } } - private Hl7.Fhir.Model.Integer _MaxLengthElement; + private Hl7.Fhir.Model.Integer? _MaxLengthElement; /// /// No more than this many characters @@ -483,13 +462,10 @@ public Hl7.Fhir.Model.Integer MaxLengthElement [IgnoreDataMember] public int? MaxLength { - get { return MaxLengthElement != null ? MaxLengthElement.Value : null; } + get => _MaxLengthElement?.Value; set { - if (value == null) - MaxLengthElement = null; - else - MaxLengthElement = new Hl7.Fhir.Model.Integer(value); + MaxLengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("MaxLength"); } } @@ -501,13 +477,13 @@ public int? MaxLength [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Options + public Hl7.Fhir.Model.ResourceReference? Options { get { return _Options; } set { _Options = value; OnPropertyChanged("Options"); } } - private Hl7.Fhir.Model.ResourceReference _Options; + private Hl7.Fhir.Model.ResourceReference? _Options; /// /// Permitted answer. @@ -517,11 +493,11 @@ public Hl7.Fhir.Model.ResourceReference Options [DataMember] public List Option { - get { if(_Option==null) _Option = new List(); return _Option; } + get => _Option ?? new List(); set { _Option = value; OnPropertyChanged("Option"); } } - private List _Option; + private List? _Option; /// /// Default value when item is first rendered. @@ -532,13 +508,13 @@ public List Option [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Initial + public Hl7.Fhir.Model.DataType? Initial { get { return _Initial; } set { _Initial = value; OnPropertyChanged("Initial"); } } - private Hl7.Fhir.Model.DataType _Initial; + private Hl7.Fhir.Model.DataType? _Initial; /// /// Nested questionnaire items. @@ -548,37 +524,33 @@ public Hl7.Fhir.Model.DataType Initial [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EnableWhen.Any()) dest.EnableWhen = new List(EnableWhen.DeepCopyInternal()); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(RepeatsElement != null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)RepeatsElement.DeepCopyInternal(); - if(ReadOnlyElement != null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)ReadOnlyElement.DeepCopyInternal(); - if(MaxLengthElement != null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)MaxLengthElement.DeepCopyInternal(); - if(Options != null) dest.Options = (Hl7.Fhir.Model.ResourceReference)Options.DeepCopyInternal(); - if(Option.Any()) dest.Option = new List(Option.DeepCopyInternal()); - if(Initial != null) dest.Initial = (Hl7.Fhir.Model.DataType)Initial.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EnableWhen is not null) dest.EnableWhen = new List(_EnableWhen.DeepCopyInternal()); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_RepeatsElement is not null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)_RepeatsElement.DeepCopyInternal(); + if(_ReadOnlyElement is not null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_ReadOnlyElement.DeepCopyInternal(); + if(_MaxLengthElement is not null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)_MaxLengthElement.DeepCopyInternal(); + if(_Options is not null) dest.Options = (Hl7.Fhir.Model.ResourceReference)_Options.DeepCopyInternal(); + if(_Option is not null) dest.Option = new List(_Option.DeepCopyInternal()); + if(_Initial is not null) dest.Initial = (Hl7.Fhir.Model.DataType)_Initial.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -590,132 +562,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(EnableWhen, otherT.EnableWhen)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(RepeatsElement, otherT.RepeatsElement)) return false; - if(!comparer.Equals(ReadOnlyElement, otherT.ReadOnlyElement)) return false; - if(!comparer.Equals(MaxLengthElement, otherT.MaxLengthElement)) return false; - if(!comparer.Equals(Options, otherT.Options)) return false; - if(!comparer.ListEquals(Option, otherT.Option)) return false; - if(!comparer.Equals(Initial, otherT.Initial)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_EnableWhen, otherT._EnableWhen)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_RepeatsElement, otherT._RepeatsElement)) return false; + if(!comparer.Equals(_ReadOnlyElement, otherT._ReadOnlyElement)) return false; + if(!comparer.Equals(_MaxLengthElement, otherT._MaxLengthElement)) return false; + if(!comparer.Equals(_Options, otherT._Options)) return false; + if(!comparer.ListEquals(_Option, otherT._Option)) return false; + if(!comparer.Equals(_Initial, otherT._Initial)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "enableWhen": - value = EnableWhen; - return EnableWhen?.Any() == true; + value = _EnableWhen; + return _EnableWhen?.Any() == true; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "repeats": - value = RepeatsElement; - return RepeatsElement is not null; + value = _RepeatsElement; + return _RepeatsElement is not null; case "readOnly": - value = ReadOnlyElement; - return ReadOnlyElement is not null; + value = _ReadOnlyElement; + return _ReadOnlyElement is not null; case "maxLength": - value = MaxLengthElement; - return MaxLengthElement is not null; + value = _MaxLengthElement; + return _MaxLengthElement is not null; case "options": - value = Options; - return Options is not null; + value = _Options; + return _Options is not null; case "option": - value = Option; - return Option?.Any() == true; + value = _Option; + return _Option?.Any() == true; case "initial": - value = Initial; - return Initial is not null; + value = _Initial; + return _Initial is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "enableWhen": - EnableWhen = (List)value; + EnableWhen = (List?)value!; return this; case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "repeats": - RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)value; + RepeatsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "readOnly": - ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "maxLength": - MaxLengthElement = (Hl7.Fhir.Model.Integer)value; + MaxLengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "options": - Options = (Hl7.Fhir.Model.ResourceReference)value; + Options = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "option": - Option = (List)value; + Option = (List?)value!; return this; case "initial": - Initial = (Hl7.Fhir.Model.DataType)value; + Initial = (Hl7.Fhir.Model.DataType?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -726,21 +698,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",EnableWhen); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (RepeatsElement is not null) yield return new KeyValuePair("repeats",RepeatsElement); - if (ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",ReadOnlyElement); - if (MaxLengthElement is not null) yield return new KeyValuePair("maxLength",MaxLengthElement); - if (Options is not null) yield return new KeyValuePair("options",Options); - if (Option?.Any() == true) yield return new KeyValuePair("option",Option); - if (Initial is not null) yield return new KeyValuePair("initial",Initial); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",_EnableWhen); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_RepeatsElement is not null) yield return new KeyValuePair("repeats",_RepeatsElement); + if (_ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",_ReadOnlyElement); + if (_MaxLengthElement is not null) yield return new KeyValuePair("maxLength",_MaxLengthElement); + if (_Options is not null) yield return new KeyValuePair("options",_Options); + if (_Option?.Any() == true) yield return new KeyValuePair("option",_Option); + if (_Initial is not null) yield return new KeyValuePair("initial",_Initial); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -769,28 +741,25 @@ public partial class EnableWhenComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("question", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString QuestionElement + public Hl7.Fhir.Model.FhirString? QuestionElement { get { return _QuestionElement; } set { _QuestionElement = value; OnPropertyChanged("QuestionElement"); } } - private Hl7.Fhir.Model.FhirString _QuestionElement; + private Hl7.Fhir.Model.FhirString? _QuestionElement; /// /// Question that determines whether item is enabled /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Question + public string? Question { - get { return QuestionElement != null ? QuestionElement.Value : null; } + get => _QuestionElement?.Value; set { - if (value == null) - QuestionElement = null; - else - QuestionElement = new Hl7.Fhir.Model.FhirString(value); + QuestionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Question"); } } @@ -800,13 +769,13 @@ public string Question /// [FhirElement("hasAnswer", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean HasAnswerElement + public Hl7.Fhir.Model.FhirBoolean? HasAnswerElement { get { return _HasAnswerElement; } set { _HasAnswerElement = value; OnPropertyChanged("HasAnswerElement"); } } - private Hl7.Fhir.Model.FhirBoolean _HasAnswerElement; + private Hl7.Fhir.Model.FhirBoolean? _HasAnswerElement; /// /// Enable when answered or not @@ -815,13 +784,10 @@ public Hl7.Fhir.Model.FhirBoolean HasAnswerElement [IgnoreDataMember] public bool? HasAnswer { - get { return HasAnswerElement != null ? HasAnswerElement.Value : null; } + get => _HasAnswerElement?.Value; set { - if (value == null) - HasAnswerElement = null; - else - HasAnswerElement = new Hl7.Fhir.Model.FhirBoolean(value); + HasAnswerElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("HasAnswer"); } } @@ -835,27 +801,23 @@ public bool? HasAnswer [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Answer + public Hl7.Fhir.Model.DataType? Answer { get { return _Answer; } set { _Answer = value; OnPropertyChanged("Answer"); } } - private Hl7.Fhir.Model.DataType _Answer; + private Hl7.Fhir.Model.DataType? _Answer; protected internal override void CopyToInternal(Base other) { - var dest = other as EnableWhenComponent; - - if (dest == null) - { + if(other is not EnableWhenComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(QuestionElement != null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)QuestionElement.DeepCopyInternal(); - if(HasAnswerElement != null) dest.HasAnswerElement = (Hl7.Fhir.Model.FhirBoolean)HasAnswerElement.DeepCopyInternal(); - if(Answer != null) dest.Answer = (Hl7.Fhir.Model.DataType)Answer.DeepCopyInternal(); + if(_QuestionElement is not null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)_QuestionElement.DeepCopyInternal(); + if(_HasAnswerElement is not null) dest.HasAnswerElement = (Hl7.Fhir.Model.FhirBoolean)_HasAnswerElement.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = (Hl7.Fhir.Model.DataType)_Answer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -867,48 +829,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnableWhenComponent; - if(otherT == null) return false; + if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(QuestionElement, otherT.QuestionElement)) return false; - if(!comparer.Equals(HasAnswerElement, otherT.HasAnswerElement)) return false; - if(!comparer.Equals(Answer, otherT.Answer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + if(!comparer.Equals(_HasAnswerElement, otherT._HasAnswerElement)) return false; + if(!comparer.Equals(_Answer, otherT._Answer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "question": - value = QuestionElement; - return QuestionElement is not null; + value = _QuestionElement; + return _QuestionElement is not null; case "hasAnswer": - value = HasAnswerElement; - return HasAnswerElement is not null; + value = _HasAnswerElement; + return _HasAnswerElement is not null; case "answer": - value = Answer; - return Answer is not null; + value = _Answer; + return _Answer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "question": - QuestionElement = (Hl7.Fhir.Model.FhirString)value; + QuestionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "hasAnswer": - HasAnswerElement = (Hl7.Fhir.Model.FhirBoolean)value; + HasAnswerElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "answer": - Answer = (Hl7.Fhir.Model.DataType)value; + Answer = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -919,9 +881,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (QuestionElement is not null) yield return new KeyValuePair("question",QuestionElement); - if (HasAnswerElement is not null) yield return new KeyValuePair("hasAnswer",HasAnswerElement); - if (Answer is not null) yield return new KeyValuePair("answer",Answer); + if (_QuestionElement is not null) yield return new KeyValuePair("question",_QuestionElement); + if (_HasAnswerElement is not null) yield return new KeyValuePair("hasAnswer",_HasAnswerElement); + if (_Answer is not null) yield return new KeyValuePair("answer",_Answer); } } @@ -952,25 +914,21 @@ public partial class OptionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as OptionComponent; - - if (dest == null) - { + if(other is not OptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -982,34 +940,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OptionComponent; - if(otherT == null) return false; + if(other is not OptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1020,7 +978,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1030,28 +988,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this questionnaire (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1064,39 +1019,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the questionnaire. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1106,28 +1058,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this questionnaire (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1137,28 +1086,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this questionnaire (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1171,13 +1117,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1186,13 +1132,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1202,13 +1145,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1217,13 +1160,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1233,28 +1173,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1264,28 +1201,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1295,28 +1229,25 @@ public string Publisher /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1326,28 +1257,25 @@ public string Description /// [FhirElement("purpose", Order=190, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this questionnaire is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1357,28 +1285,25 @@ public string Purpose /// [FhirElement("approvalDate", Order=200)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the questionnaire was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1388,28 +1313,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=210)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the questionnaire was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1419,13 +1341,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Context the content is intended to support. @@ -1435,11 +1357,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for questionnaire (if applicable). @@ -1450,11 +1372,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Contact details for the publisher. @@ -1464,39 +1386,36 @@ public List Jurisdiction [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1510,11 +1429,11 @@ public string Copyright [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Resource that can be subject of QuestionnaireResponse. @@ -1526,24 +1445,24 @@ public List Code [DataMember] public List> SubjectTypeElement { - get { if(_SubjectTypeElement==null) _SubjectTypeElement = new List>(); return _SubjectTypeElement; } + get => _SubjectTypeElement ?? new List>(); set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } - private List> _SubjectTypeElement; + private List>? _SubjectTypeElement; /// /// Resource that can be subject of QuestionnaireResponse /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubjectType + public IEnumerable? SubjectType { - get { return SubjectTypeElement != null ? SubjectTypeElement.Select(elem => elem.Value) : null; } + get => _SubjectTypeElement?.Select(elem => elem.Value); set { if (value == null) - SubjectTypeElement = null; + SubjectTypeElement = null!; else SubjectTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("SubjectType"); @@ -1558,45 +1477,41 @@ public IEnumerable SubjectType [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Questionnaire; - - if (dest == null) - { + if(other is not Questionnaire dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(SubjectTypeElement.Any()) dest.SubjectTypeElement = new List>(SubjectTypeElement.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_SubjectTypeElement is not null) dest.SubjectTypeElement = new List>(_SubjectTypeElement.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1608,174 +1523,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Questionnaire; - if(otherT == null) return false; + if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(SubjectTypeElement, otherT.SubjectTypeElement)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_SubjectTypeElement, otherT._SubjectTypeElement)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "subjectType": - value = SubjectTypeElement; - return SubjectTypeElement?.Any() == true; + value = _SubjectTypeElement; + return _SubjectTypeElement?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "subjectType": - SubjectTypeElement = (List>)value; + SubjectTypeElement = (List>?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1786,27 +1701,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",SubjectTypeElement); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",_SubjectTypeElement); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs index 9dec186b4..42e5e6bf9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -123,28 +126,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific item from Questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -154,28 +154,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -185,28 +182,25 @@ public string Definition /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Name for group or question text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -218,13 +212,13 @@ public string Text [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The response(s) to the question. @@ -234,11 +228,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Nested questionnaire response items. @@ -248,28 +242,24 @@ public List Answer [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -281,69 +271,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -354,12 +344,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -390,13 +380,13 @@ public partial class AnswerComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Nested groups and questions. @@ -406,24 +396,20 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerComponent; - - if (dest == null) - { + if(other is not AnswerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -435,41 +421,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerComponent; - if(otherT == null) return false; + if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -480,8 +466,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -491,13 +477,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Request fulfilled by this QuestionnaireResponse. @@ -509,11 +495,11 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of this action. @@ -525,11 +511,11 @@ public List BasedOn [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// Form being answered. @@ -538,13 +524,13 @@ public List Parent [CLSCompliant(false)] [References("Questionnaire")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Questionnaire + public Hl7.Fhir.Model.ResourceReference? Questionnaire { get { return _Questionnaire; } set { _Questionnaire = value; OnPropertyChanged("Questionnaire"); } } - private Hl7.Fhir.Model.ResourceReference _Questionnaire; + private Hl7.Fhir.Model.ResourceReference? _Questionnaire; /// /// in-progress | completed | amended | entered-in-error | stopped. @@ -554,13 +540,13 @@ public Hl7.Fhir.Model.ResourceReference Questionnaire [Binding("QuestionnaireResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | amended | entered-in-error | stopped @@ -569,13 +555,10 @@ public Code St [IgnoreDataMember] public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -587,13 +570,13 @@ public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode during which questionnaire was completed. @@ -602,41 +585,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Date the answers were gathered. /// [FhirElement("authored", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredElement { get { return _AuthoredElement; } set { _AuthoredElement = value; OnPropertyChanged("AuthoredElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredElement; /// /// Date the answers were gathered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authored + public string? Authored { - get { return AuthoredElement != null ? AuthoredElement.Value : null; } + get => _AuthoredElement?.Value; set { - if (value == null) - AuthoredElement = null; - else - AuthoredElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Authored"); } } @@ -648,13 +628,13 @@ public string Authored [CLSCompliant(false)] [References("Device","Practitioner","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// The person who answered the questions. @@ -663,13 +643,13 @@ public Hl7.Fhir.Model.ResourceReference Author [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Groups and questions. @@ -679,35 +659,31 @@ public Hl7.Fhir.Model.ResourceReference Source [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as QuestionnaireResponse; - - if (dest == null) - { + if(other is not QuestionnaireResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Questionnaire != null) dest.Questionnaire = (Hl7.Fhir.Model.ResourceReference)Questionnaire.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(AuthoredElement != null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Questionnaire is not null) dest.Questionnaire = (Hl7.Fhir.Model.ResourceReference)_Questionnaire.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_AuthoredElement is not null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -719,104 +695,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QuestionnaireResponse; - if(otherT == null) return false; + if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(Questionnaire, otherT.Questionnaire)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(AuthoredElement, otherT.AuthoredElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_Questionnaire, otherT._Questionnaire)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_AuthoredElement, otherT._AuthoredElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "questionnaire": - value = Questionnaire; - return Questionnaire is not null; + value = _Questionnaire; + return _Questionnaire is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "authored": - value = AuthoredElement; - return AuthoredElement is not null; + value = _AuthoredElement; + return _AuthoredElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "questionnaire": - Questionnaire = (Hl7.Fhir.Model.ResourceReference)value; + Questionnaire = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authored": - AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -827,17 +803,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Questionnaire is not null) yield return new KeyValuePair("questionnaire",Questionnaire); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (AuthoredElement is not null) yield return new KeyValuePair("authored",AuthoredElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Questionnaire is not null) yield return new KeyValuePair("questionnaire",_Questionnaire); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_AuthoredElement is not null) yield return new KeyValuePair("authored",_AuthoredElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs b/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs index 9ceee425a..f9d57db29 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,39 +67,35 @@ public partial class Ratio : Hl7.Fhir.Model.DataType /// [FhirElement("numerator", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity Numerator + public Hl7.Fhir.Model.Quantity? Numerator { get { return _Numerator; } set { _Numerator = value; OnPropertyChanged("Numerator"); } } - private Hl7.Fhir.Model.Quantity _Numerator; + private Hl7.Fhir.Model.Quantity? _Numerator; /// /// Denominator value. /// [FhirElement("denominator", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Denominator + public Hl7.Fhir.Model.Quantity? Denominator { get { return _Denominator; } set { _Denominator = value; OnPropertyChanged("Denominator"); } } - private Hl7.Fhir.Model.Quantity _Denominator; + private Hl7.Fhir.Model.Quantity? _Denominator; protected internal override void CopyToInternal(Base other) { - var dest = other as Ratio; - - if (dest == null) - { + if(other is not Ratio dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Numerator != null) dest.Numerator = (Hl7.Fhir.Model.Quantity)Numerator.DeepCopyInternal(); - if(Denominator != null) dest.Denominator = (Hl7.Fhir.Model.Quantity)Denominator.DeepCopyInternal(); + if(_Numerator is not null) dest.Numerator = (Hl7.Fhir.Model.Quantity)_Numerator.DeepCopyInternal(); + if(_Denominator is not null) dest.Denominator = (Hl7.Fhir.Model.Quantity)_Denominator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -108,41 +107,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Ratio; - if(otherT == null) return false; + if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Numerator, otherT.Numerator)) return false; - if(!comparer.Equals(Denominator, otherT.Denominator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "numerator": - value = Numerator; - return Numerator is not null; + value = _Numerator; + return _Numerator is not null; case "denominator": - value = Denominator; - return Denominator is not null; + value = _Denominator; + return _Denominator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "numerator": - Numerator = (Hl7.Fhir.Model.Quantity)value; + Numerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "denominator": - Denominator = (Hl7.Fhir.Model.Quantity)value; + Denominator = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -153,8 +152,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Numerator is not null) yield return new KeyValuePair("numerator",Numerator); - if (Denominator is not null) yield return new KeyValuePair("denominator",Denominator); + if (_Numerator is not null) yield return new KeyValuePair("numerator",_Numerator); + if (_Denominator is not null) yield return new KeyValuePair("denominator",_Denominator); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs index 7cb7b7313..4d4ed3856 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -83,13 +86,13 @@ public partial class RequesterComponent : Hl7.Fhir.Model.BackboneElement [References("Practitioner","Organization","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Agent + public Hl7.Fhir.Model.ResourceReference? Agent { get { return _Agent; } set { _Agent = value; OnPropertyChanged("Agent"); } } - private Hl7.Fhir.Model.ResourceReference _Agent; + private Hl7.Fhir.Model.ResourceReference? _Agent; /// /// Organization agent is acting for. @@ -98,26 +101,22 @@ public Hl7.Fhir.Model.ResourceReference Agent [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as RequesterComponent; - - if (dest == null) - { + if(other is not RequesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Agent != null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)Agent.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)_Agent.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -129,41 +128,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequesterComponent; - if(otherT == null) return false; + if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "agent": - value = Agent; - return Agent is not null; + value = _Agent; + return _Agent is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "agent": - Agent = (Hl7.Fhir.Model.ResourceReference)value; + Agent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -174,8 +173,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Agent is not null) yield return new KeyValuePair("agent",Agent); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Agent is not null) yield return new KeyValuePair("agent",_Agent); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -188,11 +187,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -204,11 +203,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// Request fulfilled by this request. @@ -220,11 +219,11 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -236,24 +235,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | suspended | cancelled | completed | entered-in-error | unknown. @@ -263,13 +262,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("ReferralRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended | cancelled | completed | entered-in-error | unknown @@ -278,13 +277,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -297,13 +293,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("ReferralCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order @@ -312,13 +308,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -329,13 +322,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [FhirElement("type", InSummary=true, Order=160, FiveWs="class")] [Binding("ReferralType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Urgency of referral / transfer of care request. @@ -344,13 +337,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [DeclaredType(Type = typeof(Code))] [Binding("ReferralPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// Urgency of referral / transfer of care request @@ -359,13 +352,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -379,11 +369,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List ServiceRequested { - get { if(_ServiceRequested==null) _ServiceRequested = new List(); return _ServiceRequested; } + get => _ServiceRequested ?? new List(); set { _ServiceRequested = value; OnPropertyChanged("ServiceRequested"); } } - private List _ServiceRequested; + private List? _ServiceRequested; /// /// Patient referred to care or transfer. @@ -393,13 +383,13 @@ public List ServiceRequested [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Originating encounter. @@ -408,13 +398,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When the service(s) requested in the referral should occur. @@ -423,41 +413,38 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Date of creation/activation. /// [FhirElement("authoredOn", InSummary=true, Order=220, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Date of creation/activation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -467,13 +454,13 @@ public string AuthoredOn /// [FhirElement("requester", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.ReferralRequest.RequesterComponent Requester + public Hl7.Fhir.Model.ReferralRequest.RequesterComponent? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ReferralRequest.RequesterComponent _Requester; + private Hl7.Fhir.Model.ReferralRequest.RequesterComponent? _Requester; /// /// The clinical specialty (discipline) that the referral is requested for. @@ -481,13 +468,13 @@ public Hl7.Fhir.Model.ReferralRequest.RequesterComponent Requester [FhirElement("specialty", Order=240)] [Binding("ReferralSpecialty")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Specialty + public Hl7.Fhir.Model.CodeableConcept? Specialty { get { return _Specialty; } set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private Hl7.Fhir.Model.CodeableConcept _Specialty; + private Hl7.Fhir.Model.CodeableConcept? _Specialty; /// /// Receiver of referral / transfer of care request. @@ -499,11 +486,11 @@ public Hl7.Fhir.Model.CodeableConcept Specialty [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Reason for referral / transfer of care request. @@ -514,11 +501,11 @@ public List Recipient [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why is service needed?. @@ -530,39 +517,36 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// A textual description of the referral. /// [FhirElement("description", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// A textual description of the referral /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -577,11 +561,11 @@ public string Description [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Comments made about referral request. @@ -591,11 +575,11 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Key events in history of request. @@ -607,47 +591,43 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferralRequest; - - if (dest == null) - { + if(other is not ReferralRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(ServiceRequested.Any()) dest.ServiceRequested = new List(ServiceRequested.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ReferralRequest.RequesterComponent)Requester.DeepCopyInternal(); - if(Specialty != null) dest.Specialty = (Hl7.Fhir.Model.CodeableConcept)Specialty.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_ServiceRequested is not null) dest.ServiceRequested = new List(_ServiceRequested.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ReferralRequest.RequesterComponent)_Requester.DeepCopyInternal(); + if(_Specialty is not null) dest.Specialty = (Hl7.Fhir.Model.CodeableConcept)_Specialty.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -659,188 +639,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferralRequest; - if(otherT == null) return false; + if(other is not ReferralRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(ServiceRequested, otherT.ServiceRequested)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_ServiceRequested, otherT._ServiceRequested)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "serviceRequested": - value = ServiceRequested; - return ServiceRequested?.Any() == true; + value = _ServiceRequested; + return _ServiceRequested?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "specialty": - value = Specialty; - return Specialty is not null; + value = _Specialty; + return _Specialty is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "serviceRequested": - ServiceRequested = (List)value; + ServiceRequested = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ReferralRequest.RequesterComponent)value; + Requester = (Hl7.Fhir.Model.ReferralRequest.RequesterComponent?)value; return this; case "specialty": - Specialty = (Hl7.Fhir.Model.CodeableConcept)value; + Specialty = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -851,29 +831,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (ServiceRequested?.Any() == true) yield return new KeyValuePair("serviceRequested",ServiceRequested); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Specialty is not null) yield return new KeyValuePair("specialty",Specialty); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_ServiceRequested?.Any() == true) yield return new KeyValuePair("serviceRequested",_ServiceRequested); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Specialty is not null) yield return new KeyValuePair("specialty",_Specialty); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs b/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs index 8010d672e..8b77377b7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -126,13 +129,13 @@ public enum RelatedArtifactType [Binding("RelatedArtifactType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// documentation | justification | citation | predecessor | successor | derived-from | depends-on | composed-of @@ -141,13 +144,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.RelatedArtifact.RelatedArtifactType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -157,28 +157,25 @@ public Hl7.Fhir.Model.RelatedArtifact.RelatedArtifactType? Type /// [FhirElement("display", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Brief description of the related artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -188,28 +185,25 @@ public string Display /// [FhirElement("citation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString CitationElement + public Hl7.Fhir.Model.FhirString? CitationElement { get { return _CitationElement; } set { _CitationElement = value; OnPropertyChanged("CitationElement"); } } - private Hl7.Fhir.Model.FhirString _CitationElement; + private Hl7.Fhir.Model.FhirString? _CitationElement; /// /// Bibliographic citation for the artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Citation + public string? Citation { - get { return CitationElement != null ? CitationElement.Value : null; } + get => _CitationElement?.Value; set { - if (value == null) - CitationElement = null; - else - CitationElement = new Hl7.Fhir.Model.FhirString(value); + CitationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Citation"); } } @@ -223,28 +217,25 @@ public string Citation [FhirElement("url", InSummary=true, Order=60)] [NotMapped(Since=FhirRelease.R5)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Where the artifact can be accessed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -254,13 +245,13 @@ public string Url /// [FhirElement("document", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Attachment Document + public Hl7.Fhir.Model.Attachment? Document { get { return _Document; } set { _Document = value; OnPropertyChanged("Document"); } } - private Hl7.Fhir.Model.Attachment _Document; + private Hl7.Fhir.Model.Attachment? _Document; /// /// What resource is being referenced. @@ -269,30 +260,26 @@ public Hl7.Fhir.Model.Attachment Document [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedArtifact; - - if (dest == null) - { + if(other is not RelatedArtifact dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(CitationElement != null) dest.CitationElement = (Hl7.Fhir.Model.FhirString)CitationElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Document != null) dest.Document = (Hl7.Fhir.Model.Attachment)Document.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_CitationElement is not null) dest.CitationElement = (Hl7.Fhir.Model.FhirString)_CitationElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Document is not null) dest.Document = (Hl7.Fhir.Model.Attachment)_Document.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -304,69 +291,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedArtifact; - if(otherT == null) return false; + if(other is not RelatedArtifact otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(CitationElement, otherT.CitationElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Document, otherT.Document)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_CitationElement, otherT._CitationElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Document, otherT._Document)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "citation": - value = CitationElement; - return CitationElement is not null; + value = _CitationElement; + return _CitationElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "document": - value = Document; - return Document is not null; + value = _Document; + return _Document is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "citation": - CitationElement = (Hl7.Fhir.Model.FhirString)value; + CitationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "document": - Document = (Hl7.Fhir.Model.Attachment)value; + Document = (Hl7.Fhir.Model.Attachment?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -377,12 +364,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (CitationElement is not null) yield return new KeyValuePair("citation",CitationElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Document is not null) yield return new KeyValuePair("document",Document); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_CitationElement is not null) yield return new KeyValuePair("citation",_CitationElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Document is not null) yield return new KeyValuePair("document",_Document); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs index ab5e1a619..6b6e0a711 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,24 +70,24 @@ public partial class RelatedPerson : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this related person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this related person's record is in active use @@ -93,13 +96,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -112,13 +112,13 @@ public bool? Active [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// The nature of the relationship. @@ -126,13 +126,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("relationship", InSummary=true, Order=120, FiveWs="class")] [Binding("PatientRelationshipType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// A name associated with the person. @@ -142,11 +142,11 @@ public Hl7.Fhir.Model.CodeableConcept Relationship [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -156,11 +156,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -169,13 +169,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -184,13 +184,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -200,28 +197,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the related person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -234,11 +228,11 @@ public string BirthDate [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. @@ -248,48 +242,44 @@ public List Address [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Period of time that this relationship is considered valid. /// [FhirElement("period", Order=190, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedPerson; - - if (dest == null) - { + if(other is not RelatedPerson dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -301,104 +291,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedPerson; - if(otherT == null) return false; + if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -409,17 +399,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs index ca0ef87f8..236614354 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,28 +83,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("label", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// User-visible label for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -111,28 +111,25 @@ public string Label /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -142,28 +139,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -173,28 +167,25 @@ public string Description /// [FhirElement("textEquivalent", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextEquivalentElement + public Hl7.Fhir.Model.FhirString? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.FhirString _TextEquivalentElement; + private Hl7.Fhir.Model.FhirString? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.FhirString(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextEquivalent"); } } @@ -207,11 +198,11 @@ public string TextEquivalent [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting documentation for the intended performer of the action. @@ -221,11 +212,11 @@ public List Code [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// Whether or not the action is applicable. @@ -235,11 +226,11 @@ public List Documentation [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Relationship to another action. @@ -249,11 +240,11 @@ public List Condition [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -262,13 +253,13 @@ public List RelatedAction [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Who should perform the action. @@ -280,11 +271,11 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -292,13 +283,13 @@ public List Participant [FhirElement("type", Order=140)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// visual-group | logical-group | sentence-group. @@ -307,13 +298,13 @@ public Hl7.Fhir.Model.Coding Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -322,13 +313,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -340,13 +328,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -355,13 +343,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -373,13 +358,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -388,13 +373,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -406,13 +388,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -421,13 +403,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -439,13 +418,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -454,13 +433,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -472,13 +448,13 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; /// /// Sub action. @@ -488,40 +464,36 @@ public Hl7.Fhir.Model.ResourceReference Resource [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)TextEquivalentElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)_TextEquivalentElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -533,153 +505,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.FhirString)value; + TextEquivalentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -690,24 +662,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -736,13 +708,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -751,13 +723,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -767,28 +736,25 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -798,28 +764,25 @@ public string Description /// [FhirElement("language", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LanguageElement + public Hl7.Fhir.Model.FhirString? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.FhirString _LanguageElement; + private Hl7.Fhir.Model.FhirString? _LanguageElement; /// /// Language of the expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.FhirString(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Language"); } } @@ -829,46 +792,39 @@ public string Language /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Boolean-valued expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -880,55 +836,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.FhirString)value; + LanguageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -939,10 +895,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -969,28 +925,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ActionIdElement + public Hl7.Fhir.Model.Id? ActionIdElement { get { return _ActionIdElement; } set { _ActionIdElement = value; OnPropertyChanged("ActionIdElement"); } } - private Hl7.Fhir.Model.Id _ActionIdElement; + private Hl7.Fhir.Model.Id? _ActionIdElement; /// /// What action this is related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActionId + public string? ActionId { - get { return ActionIdElement != null ? ActionIdElement.Value : null; } + get => _ActionIdElement?.Value; set { - if (value == null) - ActionIdElement = null; - else - ActionIdElement = new Hl7.Fhir.Model.Id(value); + ActionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ActionId"); } } @@ -1003,13 +956,13 @@ public string ActionId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end @@ -1018,13 +971,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -1036,27 +986,23 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActionIdElement != null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)ActionIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_ActionIdElement is not null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)_ActionIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1068,48 +1014,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActionIdElement, otherT.ActionIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actionId": - value = ActionIdElement; - return ActionIdElement is not null; + value = _ActionIdElement; + return _ActionIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actionId": - ActionIdElement = (Hl7.Fhir.Model.Id)value; + ActionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1120,9 +1066,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActionIdElement is not null) yield return new KeyValuePair("actionId",ActionIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_ActionIdElement is not null) yield return new KeyValuePair("actionId",_ActionIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -1135,11 +1081,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -1151,11 +1097,11 @@ public List Identifier [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// Fulfills plan, proposal, or order. @@ -1167,11 +1113,11 @@ public List Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -1183,24 +1129,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | suspended | cancelled | completed | entered-in-error | unknown. @@ -1210,13 +1156,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("RequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended | cancelled | completed | entered-in-error | unknown @@ -1225,13 +1171,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1244,13 +1187,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order @@ -1259,13 +1202,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1277,13 +1217,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -1292,13 +1232,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -1310,13 +1247,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode for the request group. @@ -1325,41 +1262,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When the request group was authored. /// [FhirElement("authoredOn", Order=190, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request group was authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -1371,13 +1305,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Reason for the request group. @@ -1387,13 +1321,13 @@ public Hl7.Fhir.Model.ResourceReference Author [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reason + public Hl7.Fhir.Model.DataType? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.DataType _Reason; + private Hl7.Fhir.Model.DataType? _Reason; /// /// Additional notes about the response. @@ -1403,11 +1337,11 @@ public Hl7.Fhir.Model.DataType Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Proposed actions, if any. @@ -1417,39 +1351,35 @@ public List Note [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestGroup; - - if (dest == null) - { + if(other is not RequestGroup dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.DataType)Reason.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.DataType)_Reason.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1461,132 +1391,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestGroup; - if(otherT == null) return false; + if(other is not RequestGroup otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.DataType)value; + Reason = (Hl7.Fhir.Model.DataType?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1597,21 +1527,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs index fb171127b..a18c2acd5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -128,28 +131,25 @@ public partial class ArmComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for study arm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -159,58 +159,51 @@ public string Name /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Short explanation of study path. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short explanation of study path /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ArmComponent; - - if (dest == null) - { + if(other is not ArmComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -222,48 +215,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ArmComponent; - if(otherT == null) return false; + if(other is not ArmComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -274,9 +267,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -289,39 +282,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Name for this study. /// [FhirElement("title", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -336,11 +326,11 @@ public string Title [DataMember] public List Protocol { - get { if(_Protocol==null) _Protocol = new List(); return _Protocol; } + get => _Protocol ?? new List(); set { _Protocol = value; OnPropertyChanged("Protocol"); } } - private List _Protocol; + private List? _Protocol; /// /// Part of larger study. @@ -352,11 +342,11 @@ public List Protocol [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | in-progress | suspended | stopped | completed | entered-in-error. @@ -366,13 +356,13 @@ public List PartOf [Binding("ResearchStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | in-progress | suspended | stopped | completed | entered-in-error @@ -381,13 +371,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -401,11 +388,11 @@ public Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Drugs, devices, conditions, etc. under study. @@ -416,11 +403,11 @@ public List Category [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Contact details for the study. @@ -430,11 +417,11 @@ public List Focus [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// References and dependencies. @@ -444,11 +431,11 @@ public List Contact [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Used to search for the study. @@ -459,11 +446,11 @@ public List RelatedArtifact [DataMember] public List Keyword { - get { if(_Keyword==null) _Keyword = new List(); return _Keyword; } + get => _Keyword ?? new List(); set { _Keyword = value; OnPropertyChanged("Keyword"); } } - private List _Keyword; + private List? _Keyword; /// /// Geographic region(s) for study. @@ -474,39 +461,36 @@ public List Keyword [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// What this is study doing. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// What this is study doing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -521,24 +505,24 @@ public string Description [DataMember] public List Enrollment { - get { if(_Enrollment==null) _Enrollment = new List(); return _Enrollment; } + get => _Enrollment ?? new List(); set { _Enrollment = value; OnPropertyChanged("Enrollment"); } } - private List _Enrollment; + private List? _Enrollment; /// /// When the study began and ended. /// [FhirElement("period", InSummary=true, Order=220, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization responsible for the study. @@ -547,13 +531,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sponsor + public Hl7.Fhir.Model.ResourceReference? Sponsor { get { return _Sponsor; } set { _Sponsor = value; OnPropertyChanged("Sponsor"); } } - private Hl7.Fhir.Model.ResourceReference _Sponsor; + private Hl7.Fhir.Model.ResourceReference? _Sponsor; /// /// The individual responsible for the study. @@ -562,13 +546,13 @@ public Hl7.Fhir.Model.ResourceReference Sponsor [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PrincipalInvestigator + public Hl7.Fhir.Model.ResourceReference? PrincipalInvestigator { get { return _PrincipalInvestigator; } set { _PrincipalInvestigator = value; OnPropertyChanged("PrincipalInvestigator"); } } - private Hl7.Fhir.Model.ResourceReference _PrincipalInvestigator; + private Hl7.Fhir.Model.ResourceReference? _PrincipalInvestigator; /// /// Location involved in study execution. @@ -580,24 +564,24 @@ public Hl7.Fhir.Model.ResourceReference PrincipalInvestigator [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Reason for terminating study early. /// [FhirElement("reasonStopped", InSummary=true, Order=260, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReasonStopped + public Hl7.Fhir.Model.CodeableConcept? ReasonStopped { get { return _ReasonStopped; } set { _ReasonStopped = value; OnPropertyChanged("ReasonStopped"); } } - private Hl7.Fhir.Model.CodeableConcept _ReasonStopped; + private Hl7.Fhir.Model.CodeableConcept? _ReasonStopped; /// /// Comments made about the event. @@ -607,11 +591,11 @@ public Hl7.Fhir.Model.CodeableConcept ReasonStopped [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Defined path through the study for a subject. @@ -621,44 +605,40 @@ public List Note [DataMember] public List Arm { - get { if(_Arm==null) _Arm = new List(); return _Arm; } + get => _Arm ?? new List(); set { _Arm = value; OnPropertyChanged("Arm"); } } - private List _Arm; + private List? _Arm; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchStudy; - - if (dest == null) - { + if(other is not ResearchStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Protocol.Any()) dest.Protocol = new List(Protocol.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Keyword.Any()) dest.Keyword = new List(Keyword.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Enrollment.Any()) dest.Enrollment = new List(Enrollment.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Sponsor != null) dest.Sponsor = (Hl7.Fhir.Model.ResourceReference)Sponsor.DeepCopyInternal(); - if(PrincipalInvestigator != null) dest.PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)PrincipalInvestigator.DeepCopyInternal(); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(ReasonStopped != null) dest.ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)ReasonStopped.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Arm.Any()) dest.Arm = new List(Arm.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Protocol is not null) dest.Protocol = new List(_Protocol.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Keyword is not null) dest.Keyword = new List(_Keyword.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Enrollment is not null) dest.Enrollment = new List(_Enrollment.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Sponsor is not null) dest.Sponsor = (Hl7.Fhir.Model.ResourceReference)_Sponsor.DeepCopyInternal(); + if(_PrincipalInvestigator is not null) dest.PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)_PrincipalInvestigator.DeepCopyInternal(); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_ReasonStopped is not null) dest.ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)_ReasonStopped.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Arm is not null) dest.Arm = new List(_Arm.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -670,167 +650,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchStudy; - if(otherT == null) return false; + if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(Protocol, otherT.Protocol)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Keyword, otherT.Keyword)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Enrollment, otherT.Enrollment)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Sponsor, otherT.Sponsor)) return false; - if(!comparer.Equals(PrincipalInvestigator, otherT.PrincipalInvestigator)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.Equals(ReasonStopped, otherT.ReasonStopped)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Arm, otherT.Arm)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_Protocol, otherT._Protocol)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Keyword, otherT._Keyword)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Enrollment, otherT._Enrollment)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Sponsor, otherT._Sponsor)) return false; + if(!comparer.Equals(_PrincipalInvestigator, otherT._PrincipalInvestigator)) return false; + if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_ReasonStopped, otherT._ReasonStopped)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Arm, otherT._Arm)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "protocol": - value = Protocol; - return Protocol?.Any() == true; + value = _Protocol; + return _Protocol?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "keyword": - value = Keyword; - return Keyword?.Any() == true; + value = _Keyword; + return _Keyword?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "enrollment": - value = Enrollment; - return Enrollment?.Any() == true; + value = _Enrollment; + return _Enrollment?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "sponsor": - value = Sponsor; - return Sponsor is not null; + value = _Sponsor; + return _Sponsor is not null; case "principalInvestigator": - value = PrincipalInvestigator; - return PrincipalInvestigator is not null; + value = _PrincipalInvestigator; + return _PrincipalInvestigator is not null; case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "reasonStopped": - value = ReasonStopped; - return ReasonStopped is not null; + value = _ReasonStopped; + return _ReasonStopped is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "arm": - value = Arm; - return Arm?.Any() == true; + value = _Arm; + return _Arm?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "protocol": - Protocol = (List)value; + Protocol = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "keyword": - Keyword = (List)value; + Keyword = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "enrollment": - Enrollment = (List)value; + Enrollment = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "sponsor": - Sponsor = (Hl7.Fhir.Model.ResourceReference)value; + Sponsor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "principalInvestigator": - PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)value; + PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "site": - Site = (List)value; + Site = (List?)value!; return this; case "reasonStopped": - ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)value; + ReasonStopped = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "arm": - Arm = (List)value; + Arm = (List?)value!; return this; default: return base.SetValue(key, value); @@ -841,26 +821,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Protocol?.Any() == true) yield return new KeyValuePair("protocol",Protocol); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Keyword?.Any() == true) yield return new KeyValuePair("keyword",Keyword); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Enrollment?.Any() == true) yield return new KeyValuePair("enrollment",Enrollment); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Sponsor is not null) yield return new KeyValuePair("sponsor",Sponsor); - if (PrincipalInvestigator is not null) yield return new KeyValuePair("principalInvestigator",PrincipalInvestigator); - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (ReasonStopped is not null) yield return new KeyValuePair("reasonStopped",ReasonStopped); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Arm?.Any() == true) yield return new KeyValuePair("arm",Arm); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Protocol?.Any() == true) yield return new KeyValuePair("protocol",_Protocol); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Keyword?.Any() == true) yield return new KeyValuePair("keyword",_Keyword); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Enrollment?.Any() == true) yield return new KeyValuePair("enrollment",_Enrollment); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Sponsor is not null) yield return new KeyValuePair("sponsor",_Sponsor); + if (_PrincipalInvestigator is not null) yield return new KeyValuePair("principalInvestigator",_PrincipalInvestigator); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_ReasonStopped is not null) yield return new KeyValuePair("reasonStopped",_ReasonStopped); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Arm?.Any() == true) yield return new KeyValuePair("arm",_Arm); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs index 20a46ce66..d58d6776f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -111,13 +114,13 @@ public enum ResearchSubjectStatus /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// candidate | enrolled | active | suspended | withdrawn | completed. @@ -127,13 +130,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("ResearchSubjectStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// candidate | enrolled | active | suspended | withdrawn | completed @@ -142,13 +145,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ResearchSubject.ResearchSubjectStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -158,13 +158,13 @@ public Hl7.Fhir.Model.ResearchSubject.ResearchSubjectStatus? Status /// [FhirElement("period", InSummary=true, Order=110, FiveWs="when.planned")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Study subject is part of. @@ -174,13 +174,13 @@ public Hl7.Fhir.Model.Period Period [References("ResearchStudy")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Study + public Hl7.Fhir.Model.ResourceReference? Study { get { return _Study; } set { _Study = value; OnPropertyChanged("Study"); } } - private Hl7.Fhir.Model.ResourceReference _Study; + private Hl7.Fhir.Model.ResourceReference? _Study; /// /// Who is part of study. @@ -190,41 +190,38 @@ public Hl7.Fhir.Model.ResourceReference Study [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Individual + public Hl7.Fhir.Model.ResourceReference? Individual { get { return _Individual; } set { _Individual = value; OnPropertyChanged("Individual"); } } - private Hl7.Fhir.Model.ResourceReference _Individual; + private Hl7.Fhir.Model.ResourceReference? _Individual; /// /// What path should be followed. /// [FhirElement("assignedArm", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString AssignedArmElement + public Hl7.Fhir.Model.FhirString? AssignedArmElement { get { return _AssignedArmElement; } set { _AssignedArmElement = value; OnPropertyChanged("AssignedArmElement"); } } - private Hl7.Fhir.Model.FhirString _AssignedArmElement; + private Hl7.Fhir.Model.FhirString? _AssignedArmElement; /// /// What path should be followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AssignedArm + public string? AssignedArm { - get { return AssignedArmElement != null ? AssignedArmElement.Value : null; } + get => _AssignedArmElement?.Value; set { - if (value == null) - AssignedArmElement = null; - else - AssignedArmElement = new Hl7.Fhir.Model.FhirString(value); + AssignedArmElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AssignedArm"); } } @@ -234,28 +231,25 @@ public string AssignedArm /// [FhirElement("actualArm", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString ActualArmElement + public Hl7.Fhir.Model.FhirString? ActualArmElement { get { return _ActualArmElement; } set { _ActualArmElement = value; OnPropertyChanged("ActualArmElement"); } } - private Hl7.Fhir.Model.FhirString _ActualArmElement; + private Hl7.Fhir.Model.FhirString? _ActualArmElement; /// /// What path was followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActualArm + public string? ActualArm { - get { return ActualArmElement != null ? ActualArmElement.Value : null; } + get => _ActualArmElement?.Value; set { - if (value == null) - ActualArmElement = null; - else - ActualArmElement = new Hl7.Fhir.Model.FhirString(value); + ActualArmElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ActualArm"); } } @@ -267,34 +261,30 @@ public string ActualArm [CLSCompliant(false)] [References("Consent")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Consent + public Hl7.Fhir.Model.ResourceReference? Consent { get { return _Consent; } set { _Consent = value; OnPropertyChanged("Consent"); } } - private Hl7.Fhir.Model.ResourceReference _Consent; + private Hl7.Fhir.Model.ResourceReference? _Consent; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchSubject; - - if (dest == null) - { + if(other is not ResearchSubject dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Study != null) dest.Study = (Hl7.Fhir.Model.ResourceReference)Study.DeepCopyInternal(); - if(Individual != null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)Individual.DeepCopyInternal(); - if(AssignedArmElement != null) dest.AssignedArmElement = (Hl7.Fhir.Model.FhirString)AssignedArmElement.DeepCopyInternal(); - if(ActualArmElement != null) dest.ActualArmElement = (Hl7.Fhir.Model.FhirString)ActualArmElement.DeepCopyInternal(); - if(Consent != null) dest.Consent = (Hl7.Fhir.Model.ResourceReference)Consent.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Study is not null) dest.Study = (Hl7.Fhir.Model.ResourceReference)_Study.DeepCopyInternal(); + if(_Individual is not null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)_Individual.DeepCopyInternal(); + if(_AssignedArmElement is not null) dest.AssignedArmElement = (Hl7.Fhir.Model.FhirString)_AssignedArmElement.DeepCopyInternal(); + if(_ActualArmElement is not null) dest.ActualArmElement = (Hl7.Fhir.Model.FhirString)_ActualArmElement.DeepCopyInternal(); + if(_Consent is not null) dest.Consent = (Hl7.Fhir.Model.ResourceReference)_Consent.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -306,83 +296,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchSubject; - if(otherT == null) return false; + if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Study, otherT.Study)) return false; - if(!comparer.Equals(Individual, otherT.Individual)) return false; - if(!comparer.Equals(AssignedArmElement, otherT.AssignedArmElement)) return false; - if(!comparer.Equals(ActualArmElement, otherT.ActualArmElement)) return false; - if(!comparer.Equals(Consent, otherT.Consent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Study, otherT._Study)) return false; + if(!comparer.Equals(_Individual, otherT._Individual)) return false; + if(!comparer.Equals(_AssignedArmElement, otherT._AssignedArmElement)) return false; + if(!comparer.Equals(_ActualArmElement, otherT._ActualArmElement)) return false; + if(!comparer.Equals(_Consent, otherT._Consent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "study": - value = Study; - return Study is not null; + value = _Study; + return _Study is not null; case "individual": - value = Individual; - return Individual is not null; + value = _Individual; + return _Individual is not null; case "assignedArm": - value = AssignedArmElement; - return AssignedArmElement is not null; + value = _AssignedArmElement; + return _AssignedArmElement is not null; case "actualArm": - value = ActualArmElement; - return ActualArmElement is not null; + value = _ActualArmElement; + return _ActualArmElement is not null; case "consent": - value = Consent; - return Consent is not null; + value = _Consent; + return _Consent is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "study": - Study = (Hl7.Fhir.Model.ResourceReference)value; + Study = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "individual": - Individual = (Hl7.Fhir.Model.ResourceReference)value; + Individual = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assignedArm": - AssignedArmElement = (Hl7.Fhir.Model.FhirString)value; + AssignedArmElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "actualArm": - ActualArmElement = (Hl7.Fhir.Model.FhirString)value; + ActualArmElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "consent": - Consent = (Hl7.Fhir.Model.ResourceReference)value; + Consent = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -393,14 +383,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Study is not null) yield return new KeyValuePair("study",Study); - if (Individual is not null) yield return new KeyValuePair("individual",Individual); - if (AssignedArmElement is not null) yield return new KeyValuePair("assignedArm",AssignedArmElement); - if (ActualArmElement is not null) yield return new KeyValuePair("actualArm",ActualArmElement); - if (Consent is not null) yield return new KeyValuePair("consent",Consent); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Study is not null) yield return new KeyValuePair("study",_Study); + if (_Individual is not null) yield return new KeyValuePair("individual",_Individual); + if (_AssignedArmElement is not null) yield return new KeyValuePair("assignedArm",_AssignedArmElement); + if (_ActualArmElement is not null) yield return new KeyValuePair("actualArm",_ActualArmElement); + if (_Consent is not null) yield return new KeyValuePair("consent",_Consent); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs index 4992e7565..1596161ea 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -83,13 +86,13 @@ public partial class PredictionComponent : Hl7.Fhir.Model.BackboneElement [Binding("RiskAssessmentOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Likelihood of specified outcome. @@ -98,13 +101,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Probability + public Hl7.Fhir.Model.DataType? Probability { get { return _Probability; } set { _Probability = value; OnPropertyChanged("Probability"); } } - private Hl7.Fhir.Model.DataType _Probability; + private Hl7.Fhir.Model.DataType? _Probability; /// /// Likelihood of specified outcome as a qualitative value. @@ -112,26 +115,26 @@ public Hl7.Fhir.Model.DataType Probability [FhirElement("qualitativeRisk", Order=60)] [Binding("RiskAssessmentProbability")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept QualitativeRisk + public Hl7.Fhir.Model.CodeableConcept? QualitativeRisk { get { return _QualitativeRisk; } set { _QualitativeRisk = value; OnPropertyChanged("QualitativeRisk"); } } - private Hl7.Fhir.Model.CodeableConcept _QualitativeRisk; + private Hl7.Fhir.Model.CodeableConcept? _QualitativeRisk; /// /// Relative likelihood. /// [FhirElement("relativeRisk", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement + public Hl7.Fhir.Model.FhirDecimal? RelativeRiskElement { get { return _RelativeRiskElement; } set { _RelativeRiskElement = value; OnPropertyChanged("RelativeRiskElement"); } } - private Hl7.Fhir.Model.FhirDecimal _RelativeRiskElement; + private Hl7.Fhir.Model.FhirDecimal? _RelativeRiskElement; /// /// Relative likelihood @@ -140,13 +143,10 @@ public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement [IgnoreDataMember] public decimal? RelativeRisk { - get { return RelativeRiskElement != null ? RelativeRiskElement.Value : null; } + get => _RelativeRiskElement?.Value; set { - if (value == null) - RelativeRiskElement = null; - else - RelativeRiskElement = new Hl7.Fhir.Model.FhirDecimal(value); + RelativeRiskElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("RelativeRisk"); } } @@ -158,61 +158,54 @@ public decimal? RelativeRisk [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; /// /// Explanation of prediction. /// [FhirElement("rationale", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString RationaleElement + public Hl7.Fhir.Model.FhirString? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.FhirString _RationaleElement; + private Hl7.Fhir.Model.FhirString? _RationaleElement; /// /// Explanation of prediction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.FhirString(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Rationale"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PredictionComponent; - - if (dest == null) - { + if(other is not PredictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Probability != null) dest.Probability = (Hl7.Fhir.Model.DataType)Probability.DeepCopyInternal(); - if(QualitativeRisk != null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)QualitativeRisk.DeepCopyInternal(); - if(RelativeRiskElement != null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)RelativeRiskElement.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)RationaleElement.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Probability is not null) dest.Probability = (Hl7.Fhir.Model.DataType)_Probability.DeepCopyInternal(); + if(_QualitativeRisk is not null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)_QualitativeRisk.DeepCopyInternal(); + if(_RelativeRiskElement is not null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)_RelativeRiskElement.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)_RationaleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -224,69 +217,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PredictionComponent; - if(otherT == null) return false; + if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Probability, otherT.Probability)) return false; - if(!comparer.Equals(QualitativeRisk, otherT.QualitativeRisk)) return false; - if(!comparer.Equals(RelativeRiskElement, otherT.RelativeRiskElement)) return false; - if(!comparer.Equals(When, otherT.When)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Probability, otherT._Probability)) return false; + if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; + if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "probability": - value = Probability; - return Probability is not null; + value = _Probability; + return _Probability is not null; case "qualitativeRisk": - value = QualitativeRisk; - return QualitativeRisk is not null; + value = _QualitativeRisk; + return _QualitativeRisk is not null; case "relativeRisk": - value = RelativeRiskElement; - return RelativeRiskElement is not null; + value = _RelativeRiskElement; + return _RelativeRiskElement is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "probability": - Probability = (Hl7.Fhir.Model.DataType)value; + Probability = (Hl7.Fhir.Model.DataType?)value; return this; case "qualitativeRisk": - QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)value; + QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "relativeRisk": - RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)value; + RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.FhirString)value; + RationaleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -297,12 +290,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Probability is not null) yield return new KeyValuePair("probability",Probability); - if (QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",QualitativeRisk); - if (RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",RelativeRiskElement); - if (When is not null) yield return new KeyValuePair("when",When); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Probability is not null) yield return new KeyValuePair("probability",_Probability); + if (_QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",_QualitativeRisk); + if (_RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",_RelativeRiskElement); + if (_When is not null) yield return new KeyValuePair("when",_When); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); } } @@ -312,13 +305,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Request fulfilled by this assessment. @@ -327,13 +320,13 @@ public Hl7.Fhir.Model.Identifier Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BasedOn + public Hl7.Fhir.Model.ResourceReference? BasedOn { get { return _BasedOn; } set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private Hl7.Fhir.Model.ResourceReference _BasedOn; + private Hl7.Fhir.Model.ResourceReference? _BasedOn; /// /// Part of this occurrence. @@ -342,13 +335,13 @@ public Hl7.Fhir.Model.ResourceReference BasedOn [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// registered | preliminary | final | amended +. @@ -358,13 +351,13 @@ public Hl7.Fhir.Model.ResourceReference Parent [Binding("RiskAssessmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -373,13 +366,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -390,26 +380,26 @@ public Hl7.Fhir.Model.ObservationStatus? Status [FhirElement("method", InSummary=true, Order=130, FiveWs="class")] [Binding("RiskAssessmentMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of assessment. /// [FhirElement("code", InSummary=true, Order=140, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/what does assessment apply to?. @@ -418,13 +408,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Where was assessment performed?. @@ -433,13 +423,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When was assessment made?. @@ -448,13 +438,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Condition assessed. @@ -463,13 +453,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Condition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Who did assessment?. @@ -478,13 +468,13 @@ public Hl7.Fhir.Model.ResourceReference Condition [CLSCompliant(false)] [References("Practitioner","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Why the assessment was necessary?. @@ -494,13 +484,13 @@ public Hl7.Fhir.Model.ResourceReference Performer [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reason + public Hl7.Fhir.Model.DataType? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.DataType _Reason; + private Hl7.Fhir.Model.DataType? _Reason; /// /// Information used in assessment. @@ -512,11 +502,11 @@ public Hl7.Fhir.Model.DataType Reason [DataMember] public List Basis { - get { if(_Basis==null) _Basis = new List(); return _Basis; } + get => _Basis ?? new List(); set { _Basis = value; OnPropertyChanged("Basis"); } } - private List _Basis; + private List? _Basis; /// /// Outcome predicted. @@ -526,39 +516,36 @@ public List Basis [DataMember] public List Prediction { - get { if(_Prediction==null) _Prediction = new List(); return _Prediction; } + get => _Prediction ?? new List(); set { _Prediction = value; OnPropertyChanged("Prediction"); } } - private List _Prediction; + private List? _Prediction; /// /// How to reduce risk. /// [FhirElement("mitigation", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString MitigationElement + public Hl7.Fhir.Model.FhirString? MitigationElement { get { return _MitigationElement; } set { _MitigationElement = value; OnPropertyChanged("MitigationElement"); } } - private Hl7.Fhir.Model.FhirString _MitigationElement; + private Hl7.Fhir.Model.FhirString? _MitigationElement; /// /// How to reduce risk /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Mitigation + public string? Mitigation { - get { return MitigationElement != null ? MitigationElement.Value : null; } + get => _MitigationElement?.Value; set { - if (value == null) - MitigationElement = null; - else - MitigationElement = new Hl7.Fhir.Model.FhirString(value); + MitigationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Mitigation"); } } @@ -568,60 +555,53 @@ public string Mitigation /// [FhirElement("comment", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on the risk assessment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RiskAssessment; - - if (dest == null) - { + if(other is not RiskAssessment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(BasedOn != null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)BasedOn.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.DataType)Reason.DeepCopyInternal(); - if(Basis.Any()) dest.Basis = new List(Basis.DeepCopyInternal()); - if(Prediction.Any()) dest.Prediction = new List(Prediction.DeepCopyInternal()); - if(MitigationElement != null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)MitigationElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)_BasedOn.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.DataType)_Reason.DeepCopyInternal(); + if(_Basis is not null) dest.Basis = new List(_Basis.DeepCopyInternal()); + if(_Prediction is not null) dest.Prediction = new List(_Prediction.DeepCopyInternal()); + if(_MitigationElement is not null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)_MitigationElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -633,139 +613,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RiskAssessment; - if(otherT == null) return false; + if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Basis, otherT.Basis)) return false; - if(!comparer.ListEquals(Prediction, otherT.Prediction)) return false; - if(!comparer.Equals(MitigationElement, otherT.MitigationElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; + if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "basedOn": - value = BasedOn; - return BasedOn is not null; + value = _BasedOn; + return _BasedOn is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "basis": - value = Basis; - return Basis?.Any() == true; + value = _Basis; + return _Basis?.Any() == true; case "prediction": - value = Prediction; - return Prediction?.Any() == true; + value = _Prediction; + return _Prediction?.Any() == true; case "mitigation": - value = MitigationElement; - return MitigationElement is not null; + value = _MitigationElement; + return _MitigationElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "basedOn": - BasedOn = (Hl7.Fhir.Model.ResourceReference)value; + BasedOn = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.DataType)value; + Reason = (Hl7.Fhir.Model.DataType?)value; return this; case "basis": - Basis = (List)value; + Basis = (List?)value!; return this; case "prediction": - Prediction = (List)value; + Prediction = (List?)value!; return this; case "mitigation": - MitigationElement = (Hl7.Fhir.Model.FhirString)value; + MitigationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -776,22 +756,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn is not null) yield return new KeyValuePair("basedOn",BasedOn); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Basis?.Any() == true) yield return new KeyValuePair("basis",Basis); - if (Prediction?.Any() == true) yield return new KeyValuePair("prediction",Prediction); - if (MitigationElement is not null) yield return new KeyValuePair("mitigation",MitigationElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn is not null) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Basis?.Any() == true) yield return new KeyValuePair("basis",_Basis); + if (_Prediction?.Any() == true) yield return new KeyValuePair("prediction",_Prediction); + if (_MitigationElement is not null) yield return new KeyValuePair("mitigation",_MitigationElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs b/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs index 1c544992c..7864914a1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,13 +69,13 @@ public partial class SampledData : Hl7.Fhir.Model.DataType [FhirElement("origin", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Origin + public Hl7.Fhir.Model.Quantity? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.Quantity _Origin; + private Hl7.Fhir.Model.Quantity? _Origin; /// /// Number of milliseconds between samples. @@ -80,13 +83,13 @@ public Hl7.Fhir.Model.Quantity Origin [FhirElement("period", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodElement + public Hl7.Fhir.Model.FhirDecimal? PeriodElement { get { return _PeriodElement; } set { _PeriodElement = value; OnPropertyChanged("PeriodElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodElement; /// /// Number of milliseconds between samples @@ -95,13 +98,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodElement [IgnoreDataMember] public decimal? Period { - get { return PeriodElement != null ? PeriodElement.Value : null; } + get => _PeriodElement?.Value; set { - if (value == null) - PeriodElement = null; - else - PeriodElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Period"); } } @@ -111,13 +111,13 @@ public decimal? Period /// [FhirElement("factor", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Multiply data by this before adding to origin @@ -126,13 +126,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -142,13 +139,13 @@ public decimal? Factor /// [FhirElement("lowerLimit", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LowerLimitElement + public Hl7.Fhir.Model.FhirDecimal? LowerLimitElement { get { return _LowerLimitElement; } set { _LowerLimitElement = value; OnPropertyChanged("LowerLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LowerLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _LowerLimitElement; /// /// Lower limit of detection @@ -157,13 +154,10 @@ public Hl7.Fhir.Model.FhirDecimal LowerLimitElement [IgnoreDataMember] public decimal? LowerLimit { - get { return LowerLimitElement != null ? LowerLimitElement.Value : null; } + get => _LowerLimitElement?.Value; set { - if (value == null) - LowerLimitElement = null; - else - LowerLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + LowerLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("LowerLimit"); } } @@ -173,13 +167,13 @@ public decimal? LowerLimit /// [FhirElement("upperLimit", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal UpperLimitElement + public Hl7.Fhir.Model.FhirDecimal? UpperLimitElement { get { return _UpperLimitElement; } set { _UpperLimitElement = value; OnPropertyChanged("UpperLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _UpperLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _UpperLimitElement; /// /// Upper limit of detection @@ -188,13 +182,10 @@ public Hl7.Fhir.Model.FhirDecimal UpperLimitElement [IgnoreDataMember] public decimal? UpperLimit { - get { return UpperLimitElement != null ? UpperLimitElement.Value : null; } + get => _UpperLimitElement?.Value; set { - if (value == null) - UpperLimitElement = null; - else - UpperLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + UpperLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("UpperLimit"); } } @@ -205,13 +196,13 @@ public decimal? UpperLimit [FhirElement("dimensions", InSummary=true, Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DimensionsElement + public Hl7.Fhir.Model.PositiveInt? DimensionsElement { get { return _DimensionsElement; } set { _DimensionsElement = value; OnPropertyChanged("DimensionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _DimensionsElement; + private Hl7.Fhir.Model.PositiveInt? _DimensionsElement; /// /// Number of sample points at each time point @@ -220,13 +211,10 @@ public Hl7.Fhir.Model.PositiveInt DimensionsElement [IgnoreDataMember] public int? Dimensions { - get { return DimensionsElement != null ? DimensionsElement.Value : null; } + get => _DimensionsElement?.Value; set { - if (value == null) - DimensionsElement = null; - else - DimensionsElement = new Hl7.Fhir.Model.PositiveInt(value); + DimensionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Dimensions"); } } @@ -237,49 +225,42 @@ public int? Dimensions [FhirElement("data", Order=90)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DataElement + public Hl7.Fhir.Model.FhirString? DataElement { get { return _DataElement; } set { _DataElement = value; OnPropertyChanged("DataElement"); } } - private Hl7.Fhir.Model.FhirString _DataElement; + private Hl7.Fhir.Model.FhirString? _DataElement; /// /// Decimal values with spaces, or "E" | "U" | "L" /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Data + public string? Data { - get { return DataElement != null ? DataElement.Value : null; } + get => _DataElement?.Value; set { - if (value == null) - DataElement = null; - else - DataElement = new Hl7.Fhir.Model.FhirString(value); + DataElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Data"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampledData; - - if (dest == null) - { + if(other is not SampledData dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.Quantity)Origin.DeepCopyInternal(); - if(PeriodElement != null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)PeriodElement.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(LowerLimitElement != null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)LowerLimitElement.DeepCopyInternal(); - if(UpperLimitElement != null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)UpperLimitElement.DeepCopyInternal(); - if(DimensionsElement != null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)DimensionsElement.DeepCopyInternal(); - if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.FhirString)DataElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.Quantity)_Origin.DeepCopyInternal(); + if(_PeriodElement is not null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodElement.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_LowerLimitElement is not null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)_LowerLimitElement.DeepCopyInternal(); + if(_UpperLimitElement is not null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)_UpperLimitElement.DeepCopyInternal(); + if(_DimensionsElement is not null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)_DimensionsElement.DeepCopyInternal(); + if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.FhirString)_DataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -291,76 +272,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampledData; - if(otherT == null) return false; + if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(PeriodElement, otherT.PeriodElement)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(LowerLimitElement, otherT.LowerLimitElement)) return false; - if(!comparer.Equals(UpperLimitElement, otherT.UpperLimitElement)) return false; - if(!comparer.Equals(DimensionsElement, otherT.DimensionsElement)) return false; - if(!comparer.Equals(DataElement, otherT.DataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_LowerLimitElement, otherT._LowerLimitElement)) return false; + if(!comparer.Equals(_UpperLimitElement, otherT._UpperLimitElement)) return false; + if(!comparer.Equals(_DimensionsElement, otherT._DimensionsElement)) return false; + if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "period": - value = PeriodElement; - return PeriodElement is not null; + value = _PeriodElement; + return _PeriodElement is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "lowerLimit": - value = LowerLimitElement; - return LowerLimitElement is not null; + value = _LowerLimitElement; + return _LowerLimitElement is not null; case "upperLimit": - value = UpperLimitElement; - return UpperLimitElement is not null; + value = _UpperLimitElement; + return _UpperLimitElement is not null; case "dimensions": - value = DimensionsElement; - return DimensionsElement is not null; + value = _DimensionsElement; + return _DimensionsElement is not null; case "data": - value = DataElement; - return DataElement is not null; + value = _DataElement; + return _DataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "origin": - Origin = (Hl7.Fhir.Model.Quantity)value; + Origin = (Hl7.Fhir.Model.Quantity?)value; return this; case "period": - PeriodElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "lowerLimit": - LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "upperLimit": - UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "dimensions": - DimensionsElement = (Hl7.Fhir.Model.PositiveInt)value; + DimensionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "data": - DataElement = (Hl7.Fhir.Model.FhirString)value; + DataElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -371,13 +352,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (PeriodElement is not null) yield return new KeyValuePair("period",PeriodElement); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",LowerLimitElement); - if (UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",UpperLimitElement); - if (DimensionsElement is not null) yield return new KeyValuePair("dimensions",DimensionsElement); - if (DataElement is not null) yield return new KeyValuePair("data",DataElement); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_PeriodElement is not null) yield return new KeyValuePair("period",_PeriodElement); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",_LowerLimitElement); + if (_UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",_UpperLimitElement); + if (_DimensionsElement is not null) yield return new KeyValuePair("dimensions",_DimensionsElement); + if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs b/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs index 159546049..28fdfb866 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,24 +67,24 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this schedule is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this schedule is in active use @@ -90,13 +93,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -107,13 +107,13 @@ public bool? Active [FhirElement("serviceCategory", InSummary=true, Order=110, FiveWs="class")] [Binding("service-category")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ServiceCategory + public Hl7.Fhir.Model.CodeableConcept? ServiceCategory { get { return _ServiceCategory; } set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private Hl7.Fhir.Model.CodeableConcept _ServiceCategory; + private Hl7.Fhir.Model.CodeableConcept? _ServiceCategory; /// /// The specific service that is to be performed during this appointment. @@ -124,11 +124,11 @@ public Hl7.Fhir.Model.CodeableConcept ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -139,11 +139,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson. @@ -155,52 +155,49 @@ public List Specialty [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates. /// [FhirElement("planningHorizon", InSummary=true, Order=150, FiveWs="when.planned")] [DataMember] - public Hl7.Fhir.Model.Period PlanningHorizon + public Hl7.Fhir.Model.Period? PlanningHorizon { get { return _PlanningHorizon; } set { _PlanningHorizon = value; OnPropertyChanged("PlanningHorizon"); } } - private Hl7.Fhir.Model.Period _PlanningHorizon; + private Hl7.Fhir.Model.Period? _PlanningHorizon; /// /// Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated. /// [FhirElement("comment", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -209,22 +206,18 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Schedule; - - if (dest == null) - { + if(other is not Schedule dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ServiceCategory != null) dest.ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)ServiceCategory.DeepCopyInternal(); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(PlanningHorizon != null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)PlanningHorizon.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ServiceCategory is not null) dest.ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)_ServiceCategory.DeepCopyInternal(); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_PlanningHorizon is not null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)_PlanningHorizon.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -236,83 +229,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Schedule; - if(otherT == null) return false; + if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(PlanningHorizon, otherT.PlanningHorizon)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory is not null; + value = _ServiceCategory; + return _ServiceCategory is not null; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "planningHorizon": - value = PlanningHorizon; - return PlanningHorizon is not null; + value = _PlanningHorizon; + return _PlanningHorizon is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "serviceCategory": - ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)value; + ServiceCategory = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "planningHorizon": - PlanningHorizon = (Hl7.Fhir.Model.Period)value; + PlanningHorizon = (Hl7.Fhir.Model.Period?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -323,14 +316,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ServiceCategory is not null) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",PlanningHorizon); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ServiceCategory is not null) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",_PlanningHorizon); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs index da1c621a0..186e886a4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -258,13 +261,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [References("SearchParameter")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; /// /// Subexpression relative to main expression. @@ -272,44 +275,37 @@ public Hl7.Fhir.Model.ResourceReference Definition [FhirElement("expression", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Subexpression relative to main expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -321,41 +317,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -366,8 +362,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -378,28 +374,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this search parameter (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -409,28 +402,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -441,28 +431,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this search parameter (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -475,13 +462,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -490,13 +477,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -506,13 +490,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=130, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -521,13 +505,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -537,28 +518,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -568,28 +546,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -602,11 +577,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Context the content is intended to support. @@ -616,11 +591,11 @@ public List Contact [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for search parameter (if applicable). @@ -631,39 +606,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this search parameter is defined. /// [FhirElement("purpose", Order=190, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this search parameter is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -674,28 +646,25 @@ public string Purpose [FhirElement("code", InSummary=true, Order=200)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code used in URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -710,24 +679,24 @@ public string Code [DataMember] public List> BaseElement { - get { if(_BaseElement==null) _BaseElement = new List>(); return _BaseElement; } + get => _BaseElement ?? new List>(); set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private List> _BaseElement; + private List>? _BaseElement; /// /// The resource type(s) this search parameter applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Base + public IEnumerable? Base { - get { return BaseElement != null ? BaseElement.Select(elem => elem.Value) : null; } + get => _BaseElement?.Select(elem => elem.Value); set { if (value == null) - BaseElement = null; + BaseElement = null!; else BaseElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Base"); @@ -742,13 +711,13 @@ public IEnumerable Base [Binding("SearchParamType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// number | date | string | token | reference | composite | quantity | uri @@ -757,13 +726,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -773,28 +739,25 @@ public Hl7.Fhir.Model.SearchParamType? Type /// [FhirElement("derivedFrom", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirUri DerivedFromElement + public Hl7.Fhir.Model.FhirUri? DerivedFromElement { get { return _DerivedFromElement; } set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private Hl7.Fhir.Model.FhirUri _DerivedFromElement; + private Hl7.Fhir.Model.FhirUri? _DerivedFromElement; /// /// Original Definition for the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DerivedFrom + public string? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Value : null; } + get => _DerivedFromElement?.Value; set { - if (value == null) - DerivedFromElement = null; - else - DerivedFromElement = new Hl7.Fhir.Model.FhirUri(value); + DerivedFromElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("DerivedFrom"); } } @@ -805,28 +768,25 @@ public string DerivedFrom [FhirElement("description", InSummary=true, Order=240)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -836,28 +796,25 @@ public string Description /// [FhirElement("expression", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// FHIRPath expression that extracts the values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -867,28 +824,25 @@ public string Expression /// [FhirElement("xpath", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString XpathElement + public Hl7.Fhir.Model.FhirString? XpathElement { get { return _XpathElement; } set { _XpathElement = value; OnPropertyChanged("XpathElement"); } } - private Hl7.Fhir.Model.FhirString _XpathElement; + private Hl7.Fhir.Model.FhirString? _XpathElement; /// /// XPath that extracts the values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Xpath + public string? Xpath { - get { return XpathElement != null ? XpathElement.Value : null; } + get => _XpathElement?.Value; set { - if (value == null) - XpathElement = null; - else - XpathElement = new Hl7.Fhir.Model.FhirString(value); + XpathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Xpath"); } } @@ -900,13 +854,13 @@ public string Xpath [DeclaredType(Type = typeof(Code))] [Binding("XPathUsageType")] [DataMember] - public Code XpathUsageElement + public Code? XpathUsageElement { get { return _XpathUsageElement; } set { _XpathUsageElement = value; OnPropertyChanged("XpathUsageElement"); } } - private Code _XpathUsageElement; + private Code? _XpathUsageElement; /// /// normal | phonetic | nearby | distance | other @@ -915,13 +869,10 @@ public Code XpathUsageElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage { - get { return XpathUsageElement != null ? XpathUsageElement.Value : null; } + get => _XpathUsageElement?.Value; set { - if (value == null) - XpathUsageElement = null; - else - XpathUsageElement = new Code(value); + XpathUsageElement = value is null ? null : new Code(value); OnPropertyChanged("XpathUsage"); } } @@ -936,24 +887,24 @@ public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage [DataMember] public List> TargetElement { - get { if(_TargetElement==null) _TargetElement = new List>(); return _TargetElement; } + get => _TargetElement ?? new List>(); set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private List> _TargetElement; + private List>? _TargetElement; /// /// Types of resource (if a resource reference) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Target + public IEnumerable? Target { - get { return TargetElement != null ? TargetElement.Select(elem => elem.Value) : null; } + get => _TargetElement?.Select(elem => elem.Value); set { if (value == null) - TargetElement = null; + TargetElement = null!; else TargetElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Target"); @@ -970,24 +921,24 @@ public IEnumerable Target [DataMember] public List> ComparatorElement { - get { if(_ComparatorElement==null) _ComparatorElement = new List>(); return _ComparatorElement; } + get => _ComparatorElement ?? new List>(); set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private List> _ComparatorElement; + private List>? _ComparatorElement; /// /// eq | ne | gt | lt | ge | le | sa | eb | ap /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comparator + public IEnumerable? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Select(elem => elem.Value) : null; } + get => _ComparatorElement?.Select(elem => elem.Value); set { if (value == null) - ComparatorElement = null; + ComparatorElement = null!; else ComparatorElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Comparator"); @@ -1004,24 +955,24 @@ public IEnumerable Comparator [DataMember] public List> ModifierElement { - get { if(_ModifierElement==null) _ModifierElement = new List>(); return _ModifierElement; } + get => _ModifierElement ?? new List>(); set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } - private List> _ModifierElement; + private List>? _ModifierElement; /// /// missing | exact | contains | not | text | in | not-in | below | above | type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Modifier + public IEnumerable? Modifier { - get { return ModifierElement != null ? ModifierElement.Select(elem => elem.Value) : null; } + get => _ModifierElement?.Select(elem => elem.Value); set { if (value == null) - ModifierElement = null; + ModifierElement = null!; else ModifierElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Modifier"); @@ -1036,24 +987,24 @@ public IEnumerable Modifier [DataMember] public List ChainElement { - get { if(_ChainElement==null) _ChainElement = new List(); return _ChainElement; } + get => _ChainElement ?? new List(); set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } - private List _ChainElement; + private List? _ChainElement; /// /// Chained names supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Chain + public IEnumerable? Chain { - get { return ChainElement != null ? ChainElement.Select(elem => elem.Value) : null; } + get => _ChainElement?.Select(elem => elem.Value); set { if (value == null) - ChainElement = null; + ChainElement = null!; else ChainElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Chain"); @@ -1068,46 +1019,42 @@ public IEnumerable Chain [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; protected internal override void CopyToInternal(Base other) { - var dest = other as SearchParameter; - - if (dest == null) - { + if(other is not SearchParameter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(BaseElement.Any()) dest.BaseElement = new List>(BaseElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DerivedFromElement != null) dest.DerivedFromElement = (Hl7.Fhir.Model.FhirUri)DerivedFromElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(XpathElement != null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)XpathElement.DeepCopyInternal(); - if(XpathUsageElement != null) dest.XpathUsageElement = (Code)XpathUsageElement.DeepCopyInternal(); - if(TargetElement.Any()) dest.TargetElement = new List>(TargetElement.DeepCopyInternal()); - if(ComparatorElement.Any()) dest.ComparatorElement = new List>(ComparatorElement.DeepCopyInternal()); - if(ModifierElement.Any()) dest.ModifierElement = new List>(ModifierElement.DeepCopyInternal()); - if(ChainElement.Any()) dest.ChainElement = new List(ChainElement.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = new List>(_BaseElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = (Hl7.Fhir.Model.FhirUri)_DerivedFromElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_XpathElement is not null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)_XpathElement.DeepCopyInternal(); + if(_XpathUsageElement is not null) dest.XpathUsageElement = (Code)_XpathUsageElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = new List>(_TargetElement.DeepCopyInternal()); + if(_ComparatorElement is not null) dest.ComparatorElement = new List>(_ComparatorElement.DeepCopyInternal()); + if(_ModifierElement is not null) dest.ModifierElement = new List>(_ModifierElement.DeepCopyInternal()); + if(_ChainElement is not null) dest.ChainElement = new List(_ChainElement.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1119,195 +1066,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SearchParameter; - if(otherT == null) return false; + if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(XpathElement, otherT.XpathElement)) return false; - if(!comparer.Equals(XpathUsageElement, otherT.XpathUsageElement)) return false; - if(!comparer.ListEquals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.ListEquals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.ListEquals(ModifierElement, otherT.ModifierElement)) return false; - if(!comparer.ListEquals(ChainElement, otherT.ChainElement)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; + if(!comparer.Equals(_XpathUsageElement, otherT._XpathUsageElement)) return false; + if(!comparer.ListEquals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.ListEquals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; + if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "base": - value = BaseElement; - return BaseElement?.Any() == true; + value = _BaseElement; + return _BaseElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement is not null; + value = _DerivedFromElement; + return _DerivedFromElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "xpath": - value = XpathElement; - return XpathElement is not null; + value = _XpathElement; + return _XpathElement is not null; case "xpathUsage": - value = XpathUsageElement; - return XpathUsageElement is not null; + value = _XpathUsageElement; + return _XpathUsageElement is not null; case "target": - value = TargetElement; - return TargetElement?.Any() == true; + value = _TargetElement; + return _TargetElement?.Any() == true; case "comparator": - value = ComparatorElement; - return ComparatorElement?.Any() == true; + value = _ComparatorElement; + return _ComparatorElement?.Any() == true; case "modifier": - value = ModifierElement; - return ModifierElement?.Any() == true; + value = _ModifierElement; + return _ModifierElement?.Any() == true; case "chain": - value = ChainElement; - return ChainElement?.Any() == true; + value = _ChainElement; + return _ChainElement?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "base": - BaseElement = (List>)value; + BaseElement = (List>?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "derivedFrom": - DerivedFromElement = (Hl7.Fhir.Model.FhirUri)value; + DerivedFromElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpath": - XpathElement = (Hl7.Fhir.Model.FhirString)value; + XpathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpathUsage": - XpathUsageElement = (Code)value; + XpathUsageElement = (Code?)value; return this; case "target": - TargetElement = (List>)value; + TargetElement = (List>?)value!; return this; case "comparator": - ComparatorElement = (List>)value; + ComparatorElement = (List>?)value!; return this; case "modifier": - ModifierElement = (List>)value; + ModifierElement = (List>?)value!; return this; case "chain": - ChainElement = (List)value; + ChainElement = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1318,30 +1265,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (BaseElement?.Any() == true) yield return new KeyValuePair("base",BaseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (XpathElement is not null) yield return new KeyValuePair("xpath",XpathElement); - if (XpathUsageElement is not null) yield return new KeyValuePair("xpathUsage",XpathUsageElement); - if (TargetElement?.Any() == true) yield return new KeyValuePair("target",TargetElement); - if (ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",ComparatorElement); - if (ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",ModifierElement); - if (ChainElement?.Any() == true) yield return new KeyValuePair("chain",ChainElement); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_BaseElement?.Any() == true) yield return new KeyValuePair("base",_BaseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_XpathElement is not null) yield return new KeyValuePair("xpath",_XpathElement); + if (_XpathUsageElement is not null) yield return new KeyValuePair("xpathUsage",_XpathUsageElement); + if (_TargetElement?.Any() == true) yield return new KeyValuePair("target",_TargetElement); + if (_ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",_ModifierElement); + if (_ChainElement?.Any() == true) yield return new KeyValuePair("chain",_ChainElement); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs b/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs index 8805fde0a..5c79f7537 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -149,41 +152,38 @@ public partial class ReferenceSeqComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("chromosome", InSummary=true, Order=40)] [Binding("chromosome-human")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Chromosome + public Hl7.Fhir.Model.CodeableConcept? Chromosome { get { return _Chromosome; } set { _Chromosome = value; OnPropertyChanged("Chromosome"); } } - private Hl7.Fhir.Model.CodeableConcept _Chromosome; + private Hl7.Fhir.Model.CodeableConcept? _Chromosome; /// /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37'. /// [FhirElement("genomeBuild", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString GenomeBuildElement + public Hl7.Fhir.Model.FhirString? GenomeBuildElement { get { return _GenomeBuildElement; } set { _GenomeBuildElement = value; OnPropertyChanged("GenomeBuildElement"); } } - private Hl7.Fhir.Model.FhirString _GenomeBuildElement; + private Hl7.Fhir.Model.FhirString? _GenomeBuildElement; /// /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37' /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string GenomeBuild + public string? GenomeBuild { - get { return GenomeBuildElement != null ? GenomeBuildElement.Value : null; } + get => _GenomeBuildElement?.Value; set { - if (value == null) - GenomeBuildElement = null; - else - GenomeBuildElement = new Hl7.Fhir.Model.FhirString(value); + GenomeBuildElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("GenomeBuild"); } } @@ -194,13 +194,13 @@ public string GenomeBuild [FhirElement("referenceSeqId", InSummary=true, Order=60)] [Binding("sequenceReference")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReferenceSeqId + public Hl7.Fhir.Model.CodeableConcept? ReferenceSeqId { get { return _ReferenceSeqId; } set { _ReferenceSeqId = value; OnPropertyChanged("ReferenceSeqId"); } } - private Hl7.Fhir.Model.CodeableConcept _ReferenceSeqId; + private Hl7.Fhir.Model.CodeableConcept? _ReferenceSeqId; /// /// A Pointer to another Sequence entity as reference sequence. @@ -209,41 +209,38 @@ public Hl7.Fhir.Model.CodeableConcept ReferenceSeqId [CLSCompliant(false)] [References("Sequence")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReferenceSeqPointer + public Hl7.Fhir.Model.ResourceReference? ReferenceSeqPointer { get { return _ReferenceSeqPointer; } set { _ReferenceSeqPointer = value; OnPropertyChanged("ReferenceSeqPointer"); } } - private Hl7.Fhir.Model.ResourceReference _ReferenceSeqPointer; + private Hl7.Fhir.Model.ResourceReference? _ReferenceSeqPointer; /// /// A string to represent reference sequence. /// [FhirElement("referenceSeqString", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceSeqStringElement + public Hl7.Fhir.Model.FhirString? ReferenceSeqStringElement { get { return _ReferenceSeqStringElement; } set { _ReferenceSeqStringElement = value; OnPropertyChanged("ReferenceSeqStringElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceSeqStringElement; + private Hl7.Fhir.Model.FhirString? _ReferenceSeqStringElement; /// /// A string to represent reference sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReferenceSeqString + public string? ReferenceSeqString { - get { return ReferenceSeqStringElement != null ? ReferenceSeqStringElement.Value : null; } + get => _ReferenceSeqStringElement?.Value; set { - if (value == null) - ReferenceSeqStringElement = null; - else - ReferenceSeqStringElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceSeqStringElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReferenceSeqString"); } } @@ -253,13 +250,13 @@ public string ReferenceSeqString /// [FhirElement("strand", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Integer StrandElement + public Hl7.Fhir.Model.Integer? StrandElement { get { return _StrandElement; } set { _StrandElement = value; OnPropertyChanged("StrandElement"); } } - private Hl7.Fhir.Model.Integer _StrandElement; + private Hl7.Fhir.Model.Integer? _StrandElement; /// /// Directionality of DNA ( +1/-1) @@ -268,13 +265,10 @@ public Hl7.Fhir.Model.Integer StrandElement [IgnoreDataMember] public int? Strand { - get { return StrandElement != null ? StrandElement.Value : null; } + get => _StrandElement?.Value; set { - if (value == null) - StrandElement = null; - else - StrandElement = new Hl7.Fhir.Model.Integer(value); + StrandElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Strand"); } } @@ -285,13 +279,13 @@ public int? Strand [FhirElement("windowStart", InSummary=true, Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer WindowStartElement + public Hl7.Fhir.Model.Integer? WindowStartElement { get { return _WindowStartElement; } set { _WindowStartElement = value; OnPropertyChanged("WindowStartElement"); } } - private Hl7.Fhir.Model.Integer _WindowStartElement; + private Hl7.Fhir.Model.Integer? _WindowStartElement; /// /// Start position of the window on the reference sequence @@ -300,13 +294,10 @@ public Hl7.Fhir.Model.Integer WindowStartElement [IgnoreDataMember] public int? WindowStart { - get { return WindowStartElement != null ? WindowStartElement.Value : null; } + get => _WindowStartElement?.Value; set { - if (value == null) - WindowStartElement = null; - else - WindowStartElement = new Hl7.Fhir.Model.Integer(value); + WindowStartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowStart"); } } @@ -317,13 +308,13 @@ public int? WindowStart [FhirElement("windowEnd", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer WindowEndElement + public Hl7.Fhir.Model.Integer? WindowEndElement { get { return _WindowEndElement; } set { _WindowEndElement = value; OnPropertyChanged("WindowEndElement"); } } - private Hl7.Fhir.Model.Integer _WindowEndElement; + private Hl7.Fhir.Model.Integer? _WindowEndElement; /// /// End position of the window on the reference sequence @@ -332,35 +323,28 @@ public Hl7.Fhir.Model.Integer WindowEndElement [IgnoreDataMember] public int? WindowEnd { - get { return WindowEndElement != null ? WindowEndElement.Value : null; } + get => _WindowEndElement?.Value; set { - if (value == null) - WindowEndElement = null; - else - WindowEndElement = new Hl7.Fhir.Model.Integer(value); + WindowEndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowEnd"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceSeqComponent; - - if (dest == null) - { + if(other is not ReferenceSeqComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Chromosome != null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)Chromosome.DeepCopyInternal(); - if(GenomeBuildElement != null) dest.GenomeBuildElement = (Hl7.Fhir.Model.FhirString)GenomeBuildElement.DeepCopyInternal(); - if(ReferenceSeqId != null) dest.ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)ReferenceSeqId.DeepCopyInternal(); - if(ReferenceSeqPointer != null) dest.ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)ReferenceSeqPointer.DeepCopyInternal(); - if(ReferenceSeqStringElement != null) dest.ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)ReferenceSeqStringElement.DeepCopyInternal(); - if(StrandElement != null) dest.StrandElement = (Hl7.Fhir.Model.Integer)StrandElement.DeepCopyInternal(); - if(WindowStartElement != null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)WindowStartElement.DeepCopyInternal(); - if(WindowEndElement != null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)WindowEndElement.DeepCopyInternal(); + if(_Chromosome is not null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)_Chromosome.DeepCopyInternal(); + if(_GenomeBuildElement is not null) dest.GenomeBuildElement = (Hl7.Fhir.Model.FhirString)_GenomeBuildElement.DeepCopyInternal(); + if(_ReferenceSeqId is not null) dest.ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)_ReferenceSeqId.DeepCopyInternal(); + if(_ReferenceSeqPointer is not null) dest.ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)_ReferenceSeqPointer.DeepCopyInternal(); + if(_ReferenceSeqStringElement is not null) dest.ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)_ReferenceSeqStringElement.DeepCopyInternal(); + if(_StrandElement is not null) dest.StrandElement = (Hl7.Fhir.Model.Integer)_StrandElement.DeepCopyInternal(); + if(_WindowStartElement is not null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)_WindowStartElement.DeepCopyInternal(); + if(_WindowEndElement is not null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)_WindowEndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -372,83 +356,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceSeqComponent; - if(otherT == null) return false; + if(other is not ReferenceSeqComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Chromosome, otherT.Chromosome)) return false; - if(!comparer.Equals(GenomeBuildElement, otherT.GenomeBuildElement)) return false; - if(!comparer.Equals(ReferenceSeqId, otherT.ReferenceSeqId)) return false; - if(!comparer.Equals(ReferenceSeqPointer, otherT.ReferenceSeqPointer)) return false; - if(!comparer.Equals(ReferenceSeqStringElement, otherT.ReferenceSeqStringElement)) return false; - if(!comparer.Equals(StrandElement, otherT.StrandElement)) return false; - if(!comparer.Equals(WindowStartElement, otherT.WindowStartElement)) return false; - if(!comparer.Equals(WindowEndElement, otherT.WindowEndElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; + if(!comparer.Equals(_GenomeBuildElement, otherT._GenomeBuildElement)) return false; + if(!comparer.Equals(_ReferenceSeqId, otherT._ReferenceSeqId)) return false; + if(!comparer.Equals(_ReferenceSeqPointer, otherT._ReferenceSeqPointer)) return false; + if(!comparer.Equals(_ReferenceSeqStringElement, otherT._ReferenceSeqStringElement)) return false; + if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; + if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; + if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "chromosome": - value = Chromosome; - return Chromosome is not null; + value = _Chromosome; + return _Chromosome is not null; case "genomeBuild": - value = GenomeBuildElement; - return GenomeBuildElement is not null; + value = _GenomeBuildElement; + return _GenomeBuildElement is not null; case "referenceSeqId": - value = ReferenceSeqId; - return ReferenceSeqId is not null; + value = _ReferenceSeqId; + return _ReferenceSeqId is not null; case "referenceSeqPointer": - value = ReferenceSeqPointer; - return ReferenceSeqPointer is not null; + value = _ReferenceSeqPointer; + return _ReferenceSeqPointer is not null; case "referenceSeqString": - value = ReferenceSeqStringElement; - return ReferenceSeqStringElement is not null; + value = _ReferenceSeqStringElement; + return _ReferenceSeqStringElement is not null; case "strand": - value = StrandElement; - return StrandElement is not null; + value = _StrandElement; + return _StrandElement is not null; case "windowStart": - value = WindowStartElement; - return WindowStartElement is not null; + value = _WindowStartElement; + return _WindowStartElement is not null; case "windowEnd": - value = WindowEndElement; - return WindowEndElement is not null; + value = _WindowEndElement; + return _WindowEndElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "chromosome": - Chromosome = (Hl7.Fhir.Model.CodeableConcept)value; + Chromosome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genomeBuild": - GenomeBuildElement = (Hl7.Fhir.Model.FhirString)value; + GenomeBuildElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "referenceSeqId": - ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)value; + ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "referenceSeqPointer": - ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)value; + ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referenceSeqString": - ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "strand": - StrandElement = (Hl7.Fhir.Model.Integer)value; + StrandElement = (Hl7.Fhir.Model.Integer?)value; return this; case "windowStart": - WindowStartElement = (Hl7.Fhir.Model.Integer)value; + WindowStartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "windowEnd": - WindowEndElement = (Hl7.Fhir.Model.Integer)value; + WindowEndElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -459,14 +443,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Chromosome is not null) yield return new KeyValuePair("chromosome",Chromosome); - if (GenomeBuildElement is not null) yield return new KeyValuePair("genomeBuild",GenomeBuildElement); - if (ReferenceSeqId is not null) yield return new KeyValuePair("referenceSeqId",ReferenceSeqId); - if (ReferenceSeqPointer is not null) yield return new KeyValuePair("referenceSeqPointer",ReferenceSeqPointer); - if (ReferenceSeqStringElement is not null) yield return new KeyValuePair("referenceSeqString",ReferenceSeqStringElement); - if (StrandElement is not null) yield return new KeyValuePair("strand",StrandElement); - if (WindowStartElement is not null) yield return new KeyValuePair("windowStart",WindowStartElement); - if (WindowEndElement is not null) yield return new KeyValuePair("windowEnd",WindowEndElement); + if (_Chromosome is not null) yield return new KeyValuePair("chromosome",_Chromosome); + if (_GenomeBuildElement is not null) yield return new KeyValuePair("genomeBuild",_GenomeBuildElement); + if (_ReferenceSeqId is not null) yield return new KeyValuePair("referenceSeqId",_ReferenceSeqId); + if (_ReferenceSeqPointer is not null) yield return new KeyValuePair("referenceSeqPointer",_ReferenceSeqPointer); + if (_ReferenceSeqStringElement is not null) yield return new KeyValuePair("referenceSeqString",_ReferenceSeqStringElement); + if (_StrandElement is not null) yield return new KeyValuePair("strand",_StrandElement); + if (_WindowStartElement is not null) yield return new KeyValuePair("windowStart",_WindowStartElement); + if (_WindowEndElement is not null) yield return new KeyValuePair("windowEnd",_WindowEndElement); } } @@ -492,13 +476,13 @@ public partial class VariantComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Start position of the variant on the reference sequence @@ -507,13 +491,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -523,13 +504,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// End position of the variant on the reference sequence @@ -538,13 +519,10 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } @@ -554,28 +532,25 @@ public int? End /// [FhirElement("observedAllele", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ObservedAlleleElement + public Hl7.Fhir.Model.FhirString? ObservedAlleleElement { get { return _ObservedAlleleElement; } set { _ObservedAlleleElement = value; OnPropertyChanged("ObservedAlleleElement"); } } - private Hl7.Fhir.Model.FhirString _ObservedAlleleElement; + private Hl7.Fhir.Model.FhirString? _ObservedAlleleElement; /// /// Allele that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ObservedAllele + public string? ObservedAllele { - get { return ObservedAlleleElement != null ? ObservedAlleleElement.Value : null; } + get => _ObservedAlleleElement?.Value; set { - if (value == null) - ObservedAlleleElement = null; - else - ObservedAlleleElement = new Hl7.Fhir.Model.FhirString(value); + ObservedAlleleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ObservedAllele"); } } @@ -585,28 +560,25 @@ public string ObservedAllele /// [FhirElement("referenceAllele", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceAlleleElement + public Hl7.Fhir.Model.FhirString? ReferenceAlleleElement { get { return _ReferenceAlleleElement; } set { _ReferenceAlleleElement = value; OnPropertyChanged("ReferenceAlleleElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceAlleleElement; + private Hl7.Fhir.Model.FhirString? _ReferenceAlleleElement; /// /// Allele in the reference sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReferenceAllele + public string? ReferenceAllele { - get { return ReferenceAlleleElement != null ? ReferenceAlleleElement.Value : null; } + get => _ReferenceAlleleElement?.Value; set { - if (value == null) - ReferenceAlleleElement = null; - else - ReferenceAlleleElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceAlleleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReferenceAllele"); } } @@ -616,28 +588,25 @@ public string ReferenceAllele /// [FhirElement("cigar", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CigarElement + public Hl7.Fhir.Model.FhirString? CigarElement { get { return _CigarElement; } set { _CigarElement = value; OnPropertyChanged("CigarElement"); } } - private Hl7.Fhir.Model.FhirString _CigarElement; + private Hl7.Fhir.Model.FhirString? _CigarElement; /// /// Extended CIGAR string for aligning the sequence with reference bases /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Cigar + public string? Cigar { - get { return CigarElement != null ? CigarElement.Value : null; } + get => _CigarElement?.Value; set { - if (value == null) - CigarElement = null; - else - CigarElement = new Hl7.Fhir.Model.FhirString(value); + CigarElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Cigar"); } } @@ -649,30 +618,26 @@ public string Cigar [CLSCompliant(false)] [References("Observation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference VariantPointer + public Hl7.Fhir.Model.ResourceReference? VariantPointer { get { return _VariantPointer; } set { _VariantPointer = value; OnPropertyChanged("VariantPointer"); } } - private Hl7.Fhir.Model.ResourceReference _VariantPointer; + private Hl7.Fhir.Model.ResourceReference? _VariantPointer; protected internal override void CopyToInternal(Base other) { - var dest = other as VariantComponent; - - if (dest == null) - { + if(other is not VariantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); - if(ObservedAlleleElement != null) dest.ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)ObservedAlleleElement.DeepCopyInternal(); - if(ReferenceAlleleElement != null) dest.ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)ReferenceAlleleElement.DeepCopyInternal(); - if(CigarElement != null) dest.CigarElement = (Hl7.Fhir.Model.FhirString)CigarElement.DeepCopyInternal(); - if(VariantPointer != null) dest.VariantPointer = (Hl7.Fhir.Model.ResourceReference)VariantPointer.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); + if(_ObservedAlleleElement is not null) dest.ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)_ObservedAlleleElement.DeepCopyInternal(); + if(_ReferenceAlleleElement is not null) dest.ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)_ReferenceAlleleElement.DeepCopyInternal(); + if(_CigarElement is not null) dest.CigarElement = (Hl7.Fhir.Model.FhirString)_CigarElement.DeepCopyInternal(); + if(_VariantPointer is not null) dest.VariantPointer = (Hl7.Fhir.Model.ResourceReference)_VariantPointer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -684,69 +649,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariantComponent; - if(otherT == null) return false; + if(other is not VariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ObservedAlleleElement, otherT.ObservedAlleleElement)) return false; - if(!comparer.Equals(ReferenceAlleleElement, otherT.ReferenceAlleleElement)) return false; - if(!comparer.Equals(CigarElement, otherT.CigarElement)) return false; - if(!comparer.Equals(VariantPointer, otherT.VariantPointer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ObservedAlleleElement, otherT._ObservedAlleleElement)) return false; + if(!comparer.Equals(_ReferenceAlleleElement, otherT._ReferenceAlleleElement)) return false; + if(!comparer.Equals(_CigarElement, otherT._CigarElement)) return false; + if(!comparer.Equals(_VariantPointer, otherT._VariantPointer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "observedAllele": - value = ObservedAlleleElement; - return ObservedAlleleElement is not null; + value = _ObservedAlleleElement; + return _ObservedAlleleElement is not null; case "referenceAllele": - value = ReferenceAlleleElement; - return ReferenceAlleleElement is not null; + value = _ReferenceAlleleElement; + return _ReferenceAlleleElement is not null; case "cigar": - value = CigarElement; - return CigarElement is not null; + value = _CigarElement; + return _CigarElement is not null; case "variantPointer": - value = VariantPointer; - return VariantPointer is not null; + value = _VariantPointer; + return _VariantPointer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "observedAllele": - ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)value; + ObservedAlleleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "referenceAllele": - ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cigar": - CigarElement = (Hl7.Fhir.Model.FhirString)value; + CigarElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variantPointer": - VariantPointer = (Hl7.Fhir.Model.ResourceReference)value; + VariantPointer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -757,12 +722,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ObservedAlleleElement is not null) yield return new KeyValuePair("observedAllele",ObservedAlleleElement); - if (ReferenceAlleleElement is not null) yield return new KeyValuePair("referenceAllele",ReferenceAlleleElement); - if (CigarElement is not null) yield return new KeyValuePair("cigar",CigarElement); - if (VariantPointer is not null) yield return new KeyValuePair("variantPointer",VariantPointer); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ObservedAlleleElement is not null) yield return new KeyValuePair("observedAllele",_ObservedAlleleElement); + if (_ReferenceAlleleElement is not null) yield return new KeyValuePair("referenceAllele",_ReferenceAlleleElement); + if (_CigarElement is not null) yield return new KeyValuePair("cigar",_CigarElement); + if (_VariantPointer is not null) yield return new KeyValuePair("variantPointer",_VariantPointer); } } @@ -791,13 +756,13 @@ public partial class QualityComponent : Hl7.Fhir.Model.BackboneElement [Binding("qualityType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// indel | snp | unknown @@ -806,13 +771,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Sequence.QualityType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -823,26 +785,26 @@ public Hl7.Fhir.Model.Sequence.QualityType? Type [FhirElement("standardSequence", InSummary=true, Order=50)] [Binding("qualityStandardSequence")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StandardSequence + public Hl7.Fhir.Model.CodeableConcept? StandardSequence { get { return _StandardSequence; } set { _StandardSequence = value; OnPropertyChanged("StandardSequence"); } } - private Hl7.Fhir.Model.CodeableConcept _StandardSequence; + private Hl7.Fhir.Model.CodeableConcept? _StandardSequence; /// /// Start position of the sequence. /// [FhirElement("start", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Start position of the sequence @@ -851,13 +813,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -867,13 +826,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// End position of the sequence @@ -882,13 +841,10 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } @@ -898,13 +854,13 @@ public int? End /// [FhirElement("score", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Score + public Hl7.Fhir.Model.Quantity? Score { get { return _Score; } set { _Score = value; OnPropertyChanged("Score"); } } - private Hl7.Fhir.Model.Quantity _Score; + private Hl7.Fhir.Model.Quantity? _Score; /// /// Method to get quality. @@ -912,26 +868,26 @@ public Hl7.Fhir.Model.Quantity Score [FhirElement("method", InSummary=true, Order=90)] [Binding("qualityMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// True positives from the perspective of the truth data. /// [FhirElement("truthTP", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TruthTPElement + public Hl7.Fhir.Model.FhirDecimal? TruthTPElement { get { return _TruthTPElement; } set { _TruthTPElement = value; OnPropertyChanged("TruthTPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TruthTPElement; + private Hl7.Fhir.Model.FhirDecimal? _TruthTPElement; /// /// True positives from the perspective of the truth data @@ -940,13 +896,10 @@ public Hl7.Fhir.Model.FhirDecimal TruthTPElement [IgnoreDataMember] public decimal? TruthTP { - get { return TruthTPElement != null ? TruthTPElement.Value : null; } + get => _TruthTPElement?.Value; set { - if (value == null) - TruthTPElement = null; - else - TruthTPElement = new Hl7.Fhir.Model.FhirDecimal(value); + TruthTPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("TruthTP"); } } @@ -956,13 +909,13 @@ public decimal? TruthTP /// [FhirElement("queryTP", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal QueryTPElement + public Hl7.Fhir.Model.FhirDecimal? QueryTPElement { get { return _QueryTPElement; } set { _QueryTPElement = value; OnPropertyChanged("QueryTPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _QueryTPElement; + private Hl7.Fhir.Model.FhirDecimal? _QueryTPElement; /// /// True positives from the perspective of the query data @@ -971,13 +924,10 @@ public Hl7.Fhir.Model.FhirDecimal QueryTPElement [IgnoreDataMember] public decimal? QueryTP { - get { return QueryTPElement != null ? QueryTPElement.Value : null; } + get => _QueryTPElement?.Value; set { - if (value == null) - QueryTPElement = null; - else - QueryTPElement = new Hl7.Fhir.Model.FhirDecimal(value); + QueryTPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("QueryTP"); } } @@ -987,13 +937,13 @@ public decimal? QueryTP /// [FhirElement("truthFN", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TruthFNElement + public Hl7.Fhir.Model.FhirDecimal? TruthFNElement { get { return _TruthFNElement; } set { _TruthFNElement = value; OnPropertyChanged("TruthFNElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TruthFNElement; + private Hl7.Fhir.Model.FhirDecimal? _TruthFNElement; /// /// False negatives @@ -1002,13 +952,10 @@ public Hl7.Fhir.Model.FhirDecimal TruthFNElement [IgnoreDataMember] public decimal? TruthFN { - get { return TruthFNElement != null ? TruthFNElement.Value : null; } + get => _TruthFNElement?.Value; set { - if (value == null) - TruthFNElement = null; - else - TruthFNElement = new Hl7.Fhir.Model.FhirDecimal(value); + TruthFNElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("TruthFN"); } } @@ -1018,13 +965,13 @@ public decimal? TruthFN /// [FhirElement("queryFP", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal QueryFPElement + public Hl7.Fhir.Model.FhirDecimal? QueryFPElement { get { return _QueryFPElement; } set { _QueryFPElement = value; OnPropertyChanged("QueryFPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _QueryFPElement; + private Hl7.Fhir.Model.FhirDecimal? _QueryFPElement; /// /// False positives @@ -1033,13 +980,10 @@ public Hl7.Fhir.Model.FhirDecimal QueryFPElement [IgnoreDataMember] public decimal? QueryFP { - get { return QueryFPElement != null ? QueryFPElement.Value : null; } + get => _QueryFPElement?.Value; set { - if (value == null) - QueryFPElement = null; - else - QueryFPElement = new Hl7.Fhir.Model.FhirDecimal(value); + QueryFPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("QueryFP"); } } @@ -1049,13 +993,13 @@ public decimal? QueryFP /// [FhirElement("gtFP", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal GtFPElement + public Hl7.Fhir.Model.FhirDecimal? GtFPElement { get { return _GtFPElement; } set { _GtFPElement = value; OnPropertyChanged("GtFPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _GtFPElement; + private Hl7.Fhir.Model.FhirDecimal? _GtFPElement; /// /// False positives where the non-REF alleles in the Truth and Query Call Sets match @@ -1064,13 +1008,10 @@ public Hl7.Fhir.Model.FhirDecimal GtFPElement [IgnoreDataMember] public decimal? GtFP { - get { return GtFPElement != null ? GtFPElement.Value : null; } + get => _GtFPElement?.Value; set { - if (value == null) - GtFPElement = null; - else - GtFPElement = new Hl7.Fhir.Model.FhirDecimal(value); + GtFPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("GtFP"); } } @@ -1080,13 +1021,13 @@ public decimal? GtFP /// [FhirElement("precision", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PrecisionElement + public Hl7.Fhir.Model.FhirDecimal? PrecisionElement { get { return _PrecisionElement; } set { _PrecisionElement = value; OnPropertyChanged("PrecisionElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PrecisionElement; + private Hl7.Fhir.Model.FhirDecimal? _PrecisionElement; /// /// Precision of comparison @@ -1095,13 +1036,10 @@ public Hl7.Fhir.Model.FhirDecimal PrecisionElement [IgnoreDataMember] public decimal? Precision { - get { return PrecisionElement != null ? PrecisionElement.Value : null; } + get => _PrecisionElement?.Value; set { - if (value == null) - PrecisionElement = null; - else - PrecisionElement = new Hl7.Fhir.Model.FhirDecimal(value); + PrecisionElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Precision"); } } @@ -1111,13 +1049,13 @@ public decimal? Precision /// [FhirElement("recall", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal RecallElement + public Hl7.Fhir.Model.FhirDecimal? RecallElement { get { return _RecallElement; } set { _RecallElement = value; OnPropertyChanged("RecallElement"); } } - private Hl7.Fhir.Model.FhirDecimal _RecallElement; + private Hl7.Fhir.Model.FhirDecimal? _RecallElement; /// /// Recall of comparison @@ -1126,13 +1064,10 @@ public Hl7.Fhir.Model.FhirDecimal RecallElement [IgnoreDataMember] public decimal? Recall { - get { return RecallElement != null ? RecallElement.Value : null; } + get => _RecallElement?.Value; set { - if (value == null) - RecallElement = null; - else - RecallElement = new Hl7.Fhir.Model.FhirDecimal(value); + RecallElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Recall"); } } @@ -1142,13 +1077,13 @@ public decimal? Recall /// [FhirElement("fScore", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FScoreElement + public Hl7.Fhir.Model.FhirDecimal? FScoreElement { get { return _FScoreElement; } set { _FScoreElement = value; OnPropertyChanged("FScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _FScoreElement; /// /// F-score @@ -1157,41 +1092,34 @@ public Hl7.Fhir.Model.FhirDecimal FScoreElement [IgnoreDataMember] public decimal? FScore { - get { return FScoreElement != null ? FScoreElement.Value : null; } + get => _FScoreElement?.Value; set { - if (value == null) - FScoreElement = null; - else - FScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + FScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("FScore"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QualityComponent; - - if (dest == null) - { + if(other is not QualityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(StandardSequence != null) dest.StandardSequence = (Hl7.Fhir.Model.CodeableConcept)StandardSequence.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); - if(Score != null) dest.Score = (Hl7.Fhir.Model.Quantity)Score.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(TruthTPElement != null) dest.TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)TruthTPElement.DeepCopyInternal(); - if(QueryTPElement != null) dest.QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)QueryTPElement.DeepCopyInternal(); - if(TruthFNElement != null) dest.TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)TruthFNElement.DeepCopyInternal(); - if(QueryFPElement != null) dest.QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)QueryFPElement.DeepCopyInternal(); - if(GtFPElement != null) dest.GtFPElement = (Hl7.Fhir.Model.FhirDecimal)GtFPElement.DeepCopyInternal(); - if(PrecisionElement != null) dest.PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)PrecisionElement.DeepCopyInternal(); - if(RecallElement != null) dest.RecallElement = (Hl7.Fhir.Model.FhirDecimal)RecallElement.DeepCopyInternal(); - if(FScoreElement != null) dest.FScoreElement = (Hl7.Fhir.Model.FhirDecimal)FScoreElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_StandardSequence is not null) dest.StandardSequence = (Hl7.Fhir.Model.CodeableConcept)_StandardSequence.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); + if(_Score is not null) dest.Score = (Hl7.Fhir.Model.Quantity)_Score.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_TruthTPElement is not null) dest.TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)_TruthTPElement.DeepCopyInternal(); + if(_QueryTPElement is not null) dest.QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)_QueryTPElement.DeepCopyInternal(); + if(_TruthFNElement is not null) dest.TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)_TruthFNElement.DeepCopyInternal(); + if(_QueryFPElement is not null) dest.QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)_QueryFPElement.DeepCopyInternal(); + if(_GtFPElement is not null) dest.GtFPElement = (Hl7.Fhir.Model.FhirDecimal)_GtFPElement.DeepCopyInternal(); + if(_PrecisionElement is not null) dest.PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)_PrecisionElement.DeepCopyInternal(); + if(_RecallElement is not null) dest.RecallElement = (Hl7.Fhir.Model.FhirDecimal)_RecallElement.DeepCopyInternal(); + if(_FScoreElement is not null) dest.FScoreElement = (Hl7.Fhir.Model.FhirDecimal)_FScoreElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1203,125 +1131,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualityComponent; - if(otherT == null) return false; + if(other is not QualityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(StandardSequence, otherT.StandardSequence)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(Score, otherT.Score)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(TruthTPElement, otherT.TruthTPElement)) return false; - if(!comparer.Equals(QueryTPElement, otherT.QueryTPElement)) return false; - if(!comparer.Equals(TruthFNElement, otherT.TruthFNElement)) return false; - if(!comparer.Equals(QueryFPElement, otherT.QueryFPElement)) return false; - if(!comparer.Equals(GtFPElement, otherT.GtFPElement)) return false; - if(!comparer.Equals(PrecisionElement, otherT.PrecisionElement)) return false; - if(!comparer.Equals(RecallElement, otherT.RecallElement)) return false; - if(!comparer.Equals(FScoreElement, otherT.FScoreElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_StandardSequence, otherT._StandardSequence)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_Score, otherT._Score)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_TruthTPElement, otherT._TruthTPElement)) return false; + if(!comparer.Equals(_QueryTPElement, otherT._QueryTPElement)) return false; + if(!comparer.Equals(_TruthFNElement, otherT._TruthFNElement)) return false; + if(!comparer.Equals(_QueryFPElement, otherT._QueryFPElement)) return false; + if(!comparer.Equals(_GtFPElement, otherT._GtFPElement)) return false; + if(!comparer.Equals(_PrecisionElement, otherT._PrecisionElement)) return false; + if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; + if(!comparer.Equals(_FScoreElement, otherT._FScoreElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "standardSequence": - value = StandardSequence; - return StandardSequence is not null; + value = _StandardSequence; + return _StandardSequence is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "score": - value = Score; - return Score is not null; + value = _Score; + return _Score is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "truthTP": - value = TruthTPElement; - return TruthTPElement is not null; + value = _TruthTPElement; + return _TruthTPElement is not null; case "queryTP": - value = QueryTPElement; - return QueryTPElement is not null; + value = _QueryTPElement; + return _QueryTPElement is not null; case "truthFN": - value = TruthFNElement; - return TruthFNElement is not null; + value = _TruthFNElement; + return _TruthFNElement is not null; case "queryFP": - value = QueryFPElement; - return QueryFPElement is not null; + value = _QueryFPElement; + return _QueryFPElement is not null; case "gtFP": - value = GtFPElement; - return GtFPElement is not null; + value = _GtFPElement; + return _GtFPElement is not null; case "precision": - value = PrecisionElement; - return PrecisionElement is not null; + value = _PrecisionElement; + return _PrecisionElement is not null; case "recall": - value = RecallElement; - return RecallElement is not null; + value = _RecallElement; + return _RecallElement is not null; case "fScore": - value = FScoreElement; - return FScoreElement is not null; + value = _FScoreElement; + return _FScoreElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "standardSequence": - StandardSequence = (Hl7.Fhir.Model.CodeableConcept)value; + StandardSequence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "score": - Score = (Hl7.Fhir.Model.Quantity)value; + Score = (Hl7.Fhir.Model.Quantity?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "truthTP": - TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)value; + TruthTPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "queryTP": - QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)value; + QueryTPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "truthFN": - TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)value; + TruthFNElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "queryFP": - QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)value; + QueryFPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "gtFP": - GtFPElement = (Hl7.Fhir.Model.FhirDecimal)value; + GtFPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "precision": - PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)value; + PrecisionElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "recall": - RecallElement = (Hl7.Fhir.Model.FhirDecimal)value; + RecallElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "fScore": - FScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + FScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -1332,20 +1260,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (StandardSequence is not null) yield return new KeyValuePair("standardSequence",StandardSequence); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (Score is not null) yield return new KeyValuePair("score",Score); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (TruthTPElement is not null) yield return new KeyValuePair("truthTP",TruthTPElement); - if (QueryTPElement is not null) yield return new KeyValuePair("queryTP",QueryTPElement); - if (TruthFNElement is not null) yield return new KeyValuePair("truthFN",TruthFNElement); - if (QueryFPElement is not null) yield return new KeyValuePair("queryFP",QueryFPElement); - if (GtFPElement is not null) yield return new KeyValuePair("gtFP",GtFPElement); - if (PrecisionElement is not null) yield return new KeyValuePair("precision",PrecisionElement); - if (RecallElement is not null) yield return new KeyValuePair("recall",RecallElement); - if (FScoreElement is not null) yield return new KeyValuePair("fScore",FScoreElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_StandardSequence is not null) yield return new KeyValuePair("standardSequence",_StandardSequence); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_Score is not null) yield return new KeyValuePair("score",_Score); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_TruthTPElement is not null) yield return new KeyValuePair("truthTP",_TruthTPElement); + if (_QueryTPElement is not null) yield return new KeyValuePair("queryTP",_QueryTPElement); + if (_TruthFNElement is not null) yield return new KeyValuePair("truthFN",_TruthFNElement); + if (_QueryFPElement is not null) yield return new KeyValuePair("queryFP",_QueryFPElement); + if (_GtFPElement is not null) yield return new KeyValuePair("gtFP",_GtFPElement); + if (_PrecisionElement is not null) yield return new KeyValuePair("precision",_PrecisionElement); + if (_RecallElement is not null) yield return new KeyValuePair("recall",_RecallElement); + if (_FScoreElement is not null) yield return new KeyValuePair("fScore",_FScoreElement); } } @@ -1374,13 +1302,13 @@ public partial class RepositoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("repositoryType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// directlink | openapi | login | oauth | other @@ -1389,13 +1317,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Sequence.RepositoryType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1405,28 +1330,25 @@ public Hl7.Fhir.Model.Sequence.RepositoryType? Type /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URI of the repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1436,28 +1358,25 @@ public string Url /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Repository's name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1467,28 +1386,25 @@ public string Name /// [FhirElement("datasetId", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DatasetIdElement + public Hl7.Fhir.Model.FhirString? DatasetIdElement { get { return _DatasetIdElement; } set { _DatasetIdElement = value; OnPropertyChanged("DatasetIdElement"); } } - private Hl7.Fhir.Model.FhirString _DatasetIdElement; + private Hl7.Fhir.Model.FhirString? _DatasetIdElement; /// /// Id of the dataset that used to call for dataset in repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DatasetId + public string? DatasetId { - get { return DatasetIdElement != null ? DatasetIdElement.Value : null; } + get => _DatasetIdElement?.Value; set { - if (value == null) - DatasetIdElement = null; - else - DatasetIdElement = new Hl7.Fhir.Model.FhirString(value); + DatasetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DatasetId"); } } @@ -1498,28 +1414,25 @@ public string DatasetId /// [FhirElement("variantsetId", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString VariantsetIdElement + public Hl7.Fhir.Model.FhirString? VariantsetIdElement { get { return _VariantsetIdElement; } set { _VariantsetIdElement = value; OnPropertyChanged("VariantsetIdElement"); } } - private Hl7.Fhir.Model.FhirString _VariantsetIdElement; + private Hl7.Fhir.Model.FhirString? _VariantsetIdElement; /// /// Id of the variantset that used to call for variantset in repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VariantsetId + public string? VariantsetId { - get { return VariantsetIdElement != null ? VariantsetIdElement.Value : null; } + get => _VariantsetIdElement?.Value; set { - if (value == null) - VariantsetIdElement = null; - else - VariantsetIdElement = new Hl7.Fhir.Model.FhirString(value); + VariantsetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VariantsetId"); } } @@ -1529,48 +1442,41 @@ public string VariantsetId /// [FhirElement("readsetId", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ReadsetIdElement + public Hl7.Fhir.Model.FhirString? ReadsetIdElement { get { return _ReadsetIdElement; } set { _ReadsetIdElement = value; OnPropertyChanged("ReadsetIdElement"); } } - private Hl7.Fhir.Model.FhirString _ReadsetIdElement; + private Hl7.Fhir.Model.FhirString? _ReadsetIdElement; /// /// Id of the read /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReadsetId + public string? ReadsetId { - get { return ReadsetIdElement != null ? ReadsetIdElement.Value : null; } + get => _ReadsetIdElement?.Value; set { - if (value == null) - ReadsetIdElement = null; - else - ReadsetIdElement = new Hl7.Fhir.Model.FhirString(value); + ReadsetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReadsetId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RepositoryComponent; - - if (dest == null) - { + if(other is not RepositoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DatasetIdElement != null) dest.DatasetIdElement = (Hl7.Fhir.Model.FhirString)DatasetIdElement.DeepCopyInternal(); - if(VariantsetIdElement != null) dest.VariantsetIdElement = (Hl7.Fhir.Model.FhirString)VariantsetIdElement.DeepCopyInternal(); - if(ReadsetIdElement != null) dest.ReadsetIdElement = (Hl7.Fhir.Model.FhirString)ReadsetIdElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DatasetIdElement is not null) dest.DatasetIdElement = (Hl7.Fhir.Model.FhirString)_DatasetIdElement.DeepCopyInternal(); + if(_VariantsetIdElement is not null) dest.VariantsetIdElement = (Hl7.Fhir.Model.FhirString)_VariantsetIdElement.DeepCopyInternal(); + if(_ReadsetIdElement is not null) dest.ReadsetIdElement = (Hl7.Fhir.Model.FhirString)_ReadsetIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1582,69 +1488,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepositoryComponent; - if(otherT == null) return false; + if(other is not RepositoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DatasetIdElement, otherT.DatasetIdElement)) return false; - if(!comparer.Equals(VariantsetIdElement, otherT.VariantsetIdElement)) return false; - if(!comparer.Equals(ReadsetIdElement, otherT.ReadsetIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DatasetIdElement, otherT._DatasetIdElement)) return false; + if(!comparer.Equals(_VariantsetIdElement, otherT._VariantsetIdElement)) return false; + if(!comparer.Equals(_ReadsetIdElement, otherT._ReadsetIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "datasetId": - value = DatasetIdElement; - return DatasetIdElement is not null; + value = _DatasetIdElement; + return _DatasetIdElement is not null; case "variantsetId": - value = VariantsetIdElement; - return VariantsetIdElement is not null; + value = _VariantsetIdElement; + return _VariantsetIdElement is not null; case "readsetId": - value = ReadsetIdElement; - return ReadsetIdElement is not null; + value = _ReadsetIdElement; + return _ReadsetIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "datasetId": - DatasetIdElement = (Hl7.Fhir.Model.FhirString)value; + DatasetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variantsetId": - VariantsetIdElement = (Hl7.Fhir.Model.FhirString)value; + VariantsetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "readsetId": - ReadsetIdElement = (Hl7.Fhir.Model.FhirString)value; + ReadsetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1655,12 +1561,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DatasetIdElement is not null) yield return new KeyValuePair("datasetId",DatasetIdElement); - if (VariantsetIdElement is not null) yield return new KeyValuePair("variantsetId",VariantsetIdElement); - if (ReadsetIdElement is not null) yield return new KeyValuePair("readsetId",ReadsetIdElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DatasetIdElement is not null) yield return new KeyValuePair("datasetId",_DatasetIdElement); + if (_VariantsetIdElement is not null) yield return new KeyValuePair("variantsetId",_VariantsetIdElement); + if (_ReadsetIdElement is not null) yield return new KeyValuePair("readsetId",_ReadsetIdElement); } } @@ -1673,11 +1579,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// aa | dna | rna. @@ -1685,28 +1591,25 @@ public List Identifier [FhirElement("type", InSummary=true, Order=100)] [Binding("sequenceType")] [DataMember] - public Hl7.Fhir.Model.Code TypeElement + public Hl7.Fhir.Model.Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.Code _TypeElement; + private Hl7.Fhir.Model.Code? _TypeElement; /// /// aa | dna | rna /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.Code(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Type"); } } @@ -1717,13 +1620,13 @@ public string Type [FhirElement("coordinateSystem", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer CoordinateSystemElement + public Hl7.Fhir.Model.Integer? CoordinateSystemElement { get { return _CoordinateSystemElement; } set { _CoordinateSystemElement = value; OnPropertyChanged("CoordinateSystemElement"); } } - private Hl7.Fhir.Model.Integer _CoordinateSystemElement; + private Hl7.Fhir.Model.Integer? _CoordinateSystemElement; /// /// Base number of coordinate system (0 for 0-based numbering or coordinates, inclusive start, exclusive end, 1 for 1-based numbering, inclusive start, inclusive end) @@ -1732,13 +1635,10 @@ public Hl7.Fhir.Model.Integer CoordinateSystemElement [IgnoreDataMember] public int? CoordinateSystem { - get { return CoordinateSystemElement != null ? CoordinateSystemElement.Value : null; } + get => _CoordinateSystemElement?.Value; set { - if (value == null) - CoordinateSystemElement = null; - else - CoordinateSystemElement = new Hl7.Fhir.Model.Integer(value); + CoordinateSystemElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("CoordinateSystem"); } } @@ -1750,13 +1650,13 @@ public int? CoordinateSystem [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Specimen used for sequencing. @@ -1765,13 +1665,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// The method for sequencing. @@ -1780,13 +1680,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Who should be responsible for test result. @@ -1795,39 +1695,39 @@ public Hl7.Fhir.Model.ResourceReference Device [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// The number of copies of the seqeunce of interest. (RNASeq). /// [FhirElement("quantity", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// A sequence used as reference. /// [FhirElement("referenceSeq", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.Sequence.ReferenceSeqComponent ReferenceSeq + public Hl7.Fhir.Model.Sequence.ReferenceSeqComponent? ReferenceSeq { get { return _ReferenceSeq; } set { _ReferenceSeq = value; OnPropertyChanged("ReferenceSeq"); } } - private Hl7.Fhir.Model.Sequence.ReferenceSeqComponent _ReferenceSeq; + private Hl7.Fhir.Model.Sequence.ReferenceSeqComponent? _ReferenceSeq; /// /// Variant in sequence. @@ -1837,39 +1737,36 @@ public Hl7.Fhir.Model.Sequence.ReferenceSeqComponent ReferenceSeq [DataMember] public List Variant { - get { if(_Variant==null) _Variant = new List(); return _Variant; } + get => _Variant ?? new List(); set { _Variant = value; OnPropertyChanged("Variant"); } } - private List _Variant; + private List? _Variant; /// /// Sequence that was observed. /// [FhirElement("observedSeq", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString ObservedSeqElement + public Hl7.Fhir.Model.FhirString? ObservedSeqElement { get { return _ObservedSeqElement; } set { _ObservedSeqElement = value; OnPropertyChanged("ObservedSeqElement"); } } - private Hl7.Fhir.Model.FhirString _ObservedSeqElement; + private Hl7.Fhir.Model.FhirString? _ObservedSeqElement; /// /// Sequence that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ObservedSeq + public string? ObservedSeq { - get { return ObservedSeqElement != null ? ObservedSeqElement.Value : null; } + get => _ObservedSeqElement?.Value; set { - if (value == null) - ObservedSeqElement = null; - else - ObservedSeqElement = new Hl7.Fhir.Model.FhirString(value); + ObservedSeqElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ObservedSeq"); } } @@ -1882,24 +1779,24 @@ public string ObservedSeq [DataMember] public List Quality { - get { if(_Quality==null) _Quality = new List(); return _Quality; } + get => _Quality ?? new List(); set { _Quality = value; OnPropertyChanged("Quality"); } } - private List _Quality; + private List? _Quality; /// /// Average number of reads representing a given nucleotide in the reconstructed sequence. /// [FhirElement("readCoverage", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Integer ReadCoverageElement + public Hl7.Fhir.Model.Integer? ReadCoverageElement { get { return _ReadCoverageElement; } set { _ReadCoverageElement = value; OnPropertyChanged("ReadCoverageElement"); } } - private Hl7.Fhir.Model.Integer _ReadCoverageElement; + private Hl7.Fhir.Model.Integer? _ReadCoverageElement; /// /// Average number of reads representing a given nucleotide in the reconstructed sequence @@ -1908,13 +1805,10 @@ public Hl7.Fhir.Model.Integer ReadCoverageElement [IgnoreDataMember] public int? ReadCoverage { - get { return ReadCoverageElement != null ? ReadCoverageElement.Value : null; } + get => _ReadCoverageElement?.Value; set { - if (value == null) - ReadCoverageElement = null; - else - ReadCoverageElement = new Hl7.Fhir.Model.Integer(value); + ReadCoverageElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("ReadCoverage"); } } @@ -1927,11 +1821,11 @@ public int? ReadCoverage [DataMember] public List Repository { - get { if(_Repository==null) _Repository = new List(); return _Repository; } + get => _Repository ?? new List(); set { _Repository = value; OnPropertyChanged("Repository"); } } - private List _Repository; + private List? _Repository; /// /// Pointer to next atomic sequence. @@ -1943,39 +1837,35 @@ public List Repository [DataMember] public List Pointer { - get { if(_Pointer==null) _Pointer = new List(); return _Pointer; } + get => _Pointer ?? new List(); set { _Pointer = value; OnPropertyChanged("Pointer"); } } - private List _Pointer; + private List? _Pointer; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Sequence; - - if (dest == null) - { + if(other is not Sequence dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.Code)TypeElement.DeepCopyInternal(); - if(CoordinateSystemElement != null) dest.CoordinateSystemElement = (Hl7.Fhir.Model.Integer)CoordinateSystemElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ReferenceSeq != null) dest.ReferenceSeq = (Hl7.Fhir.Model.Sequence.ReferenceSeqComponent)ReferenceSeq.DeepCopyInternal(); - if(Variant.Any()) dest.Variant = new List(Variant.DeepCopyInternal()); - if(ObservedSeqElement != null) dest.ObservedSeqElement = (Hl7.Fhir.Model.FhirString)ObservedSeqElement.DeepCopyInternal(); - if(Quality.Any()) dest.Quality = new List(Quality.DeepCopyInternal()); - if(ReadCoverageElement != null) dest.ReadCoverageElement = (Hl7.Fhir.Model.Integer)ReadCoverageElement.DeepCopyInternal(); - if(Repository.Any()) dest.Repository = new List(Repository.DeepCopyInternal()); - if(Pointer.Any()) dest.Pointer = new List(Pointer.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.Code)_TypeElement.DeepCopyInternal(); + if(_CoordinateSystemElement is not null) dest.CoordinateSystemElement = (Hl7.Fhir.Model.Integer)_CoordinateSystemElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ReferenceSeq is not null) dest.ReferenceSeq = (Hl7.Fhir.Model.Sequence.ReferenceSeqComponent)_ReferenceSeq.DeepCopyInternal(); + if(_Variant is not null) dest.Variant = new List(_Variant.DeepCopyInternal()); + if(_ObservedSeqElement is not null) dest.ObservedSeqElement = (Hl7.Fhir.Model.FhirString)_ObservedSeqElement.DeepCopyInternal(); + if(_Quality is not null) dest.Quality = new List(_Quality.DeepCopyInternal()); + if(_ReadCoverageElement is not null) dest.ReadCoverageElement = (Hl7.Fhir.Model.Integer)_ReadCoverageElement.DeepCopyInternal(); + if(_Repository is not null) dest.Repository = new List(_Repository.DeepCopyInternal()); + if(_Pointer is not null) dest.Pointer = new List(_Pointer.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1987,132 +1877,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Sequence; - if(otherT == null) return false; + if(other is not Sequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(CoordinateSystemElement, otherT.CoordinateSystemElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ReferenceSeq, otherT.ReferenceSeq)) return false; - if(!comparer.ListEquals(Variant, otherT.Variant)) return false; - if(!comparer.Equals(ObservedSeqElement, otherT.ObservedSeqElement)) return false; - if(!comparer.ListEquals(Quality, otherT.Quality)) return false; - if(!comparer.Equals(ReadCoverageElement, otherT.ReadCoverageElement)) return false; - if(!comparer.ListEquals(Repository, otherT.Repository)) return false; - if(!comparer.ListEquals(Pointer, otherT.Pointer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_CoordinateSystemElement, otherT._CoordinateSystemElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ReferenceSeq, otherT._ReferenceSeq)) return false; + if(!comparer.ListEquals(_Variant, otherT._Variant)) return false; + if(!comparer.Equals(_ObservedSeqElement, otherT._ObservedSeqElement)) return false; + if(!comparer.ListEquals(_Quality, otherT._Quality)) return false; + if(!comparer.Equals(_ReadCoverageElement, otherT._ReadCoverageElement)) return false; + if(!comparer.ListEquals(_Repository, otherT._Repository)) return false; + if(!comparer.ListEquals(_Pointer, otherT._Pointer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "coordinateSystem": - value = CoordinateSystemElement; - return CoordinateSystemElement is not null; + value = _CoordinateSystemElement; + return _CoordinateSystemElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "referenceSeq": - value = ReferenceSeq; - return ReferenceSeq is not null; + value = _ReferenceSeq; + return _ReferenceSeq is not null; case "variant": - value = Variant; - return Variant?.Any() == true; + value = _Variant; + return _Variant?.Any() == true; case "observedSeq": - value = ObservedSeqElement; - return ObservedSeqElement is not null; + value = _ObservedSeqElement; + return _ObservedSeqElement is not null; case "quality": - value = Quality; - return Quality?.Any() == true; + value = _Quality; + return _Quality?.Any() == true; case "readCoverage": - value = ReadCoverageElement; - return ReadCoverageElement is not null; + value = _ReadCoverageElement; + return _ReadCoverageElement is not null; case "repository": - value = Repository; - return Repository?.Any() == true; + value = _Repository; + return _Repository?.Any() == true; case "pointer": - value = Pointer; - return Pointer?.Any() == true; + value = _Pointer; + return _Pointer?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - TypeElement = (Hl7.Fhir.Model.Code)value; + TypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "coordinateSystem": - CoordinateSystemElement = (Hl7.Fhir.Model.Integer)value; + CoordinateSystemElement = (Hl7.Fhir.Model.Integer?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "referenceSeq": - ReferenceSeq = (Hl7.Fhir.Model.Sequence.ReferenceSeqComponent)value; + ReferenceSeq = (Hl7.Fhir.Model.Sequence.ReferenceSeqComponent?)value; return this; case "variant": - Variant = (List)value; + Variant = (List?)value!; return this; case "observedSeq": - ObservedSeqElement = (Hl7.Fhir.Model.FhirString)value; + ObservedSeqElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quality": - Quality = (List)value; + Quality = (List?)value!; return this; case "readCoverage": - ReadCoverageElement = (Hl7.Fhir.Model.Integer)value; + ReadCoverageElement = (Hl7.Fhir.Model.Integer?)value; return this; case "repository": - Repository = (List)value; + Repository = (List?)value!; return this; case "pointer": - Pointer = (List)value; + Pointer = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2123,21 +2013,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (CoordinateSystemElement is not null) yield return new KeyValuePair("coordinateSystem",CoordinateSystemElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ReferenceSeq is not null) yield return new KeyValuePair("referenceSeq",ReferenceSeq); - if (Variant?.Any() == true) yield return new KeyValuePair("variant",Variant); - if (ObservedSeqElement is not null) yield return new KeyValuePair("observedSeq",ObservedSeqElement); - if (Quality?.Any() == true) yield return new KeyValuePair("quality",Quality); - if (ReadCoverageElement is not null) yield return new KeyValuePair("readCoverage",ReadCoverageElement); - if (Repository?.Any() == true) yield return new KeyValuePair("repository",Repository); - if (Pointer?.Any() == true) yield return new KeyValuePair("pointer",Pointer); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_CoordinateSystemElement is not null) yield return new KeyValuePair("coordinateSystem",_CoordinateSystemElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ReferenceSeq is not null) yield return new KeyValuePair("referenceSeq",_ReferenceSeq); + if (_Variant?.Any() == true) yield return new KeyValuePair("variant",_Variant); + if (_ObservedSeqElement is not null) yield return new KeyValuePair("observedSeq",_ObservedSeqElement); + if (_Quality?.Any() == true) yield return new KeyValuePair("quality",_Quality); + if (_ReadCoverageElement is not null) yield return new KeyValuePair("readCoverage",_ReadCoverageElement); + if (_Repository?.Any() == true) yield return new KeyValuePair("repository",_Repository); + if (_Pointer?.Any() == true) yield return new KeyValuePair("pointer",_Pointer); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs index 078a96b2a..27b2772ab 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ServiceDefinition : Hl7.Fhir.Model.DomainResource, IIdentif /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this service definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the service definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the service definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this service definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this service definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -205,13 +196,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -220,13 +211,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -236,13 +224,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -251,13 +239,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -267,28 +252,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -298,28 +280,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -329,28 +308,25 @@ public string Publisher /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the service definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -360,28 +336,25 @@ public string Description /// [FhirElement("purpose", Order=190, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this service definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -391,28 +364,25 @@ public string Purpose /// [FhirElement("usage", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the module /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -422,28 +392,25 @@ public string Usage /// [FhirElement("approvalDate", Order=210)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the service definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -453,28 +420,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=220)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the service definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -484,13 +448,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Context the content is intended to support. @@ -500,11 +464,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for service definition (if applicable). @@ -515,11 +479,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// E.g. Education, Treatment, Assessment, etc. @@ -530,11 +494,11 @@ public List Jurisdiction [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// A content contributor. @@ -544,11 +508,11 @@ public List Topic [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Contact details for the publisher. @@ -558,39 +522,36 @@ public List Contributor [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=290)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -603,11 +564,11 @@ public string Copyright [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// "when" the module should be invoked. @@ -617,11 +578,11 @@ public List RelatedArtifact [DataMember] public List Trigger { - get { if(_Trigger==null) _Trigger = new List(); return _Trigger; } + get => _Trigger ?? new List(); set { _Trigger = value; OnPropertyChanged("Trigger"); } } - private List _Trigger; + private List? _Trigger; /// /// What data is used by the module. @@ -631,11 +592,11 @@ public List Trigger [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; /// /// Operation to invoke. @@ -644,51 +605,47 @@ public List DataRequirement [CLSCompliant(false)] [References("OperationDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OperationDefinition + public Hl7.Fhir.Model.ResourceReference? OperationDefinition { get { return _OperationDefinition; } set { _OperationDefinition = value; OnPropertyChanged("OperationDefinition"); } } - private Hl7.Fhir.Model.ResourceReference _OperationDefinition; + private Hl7.Fhir.Model.ResourceReference? _OperationDefinition; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ServiceDefinition; - - if (dest == null) - { + if(other is not ServiceDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Trigger.Any()) dest.Trigger = new List(Trigger.DeepCopyInternal()); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); - if(OperationDefinition != null) dest.OperationDefinition = (Hl7.Fhir.Model.ResourceReference)OperationDefinition.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Trigger is not null) dest.Trigger = new List(_Trigger.DeepCopyInternal()); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); + if(_OperationDefinition is not null) dest.OperationDefinition = (Hl7.Fhir.Model.ResourceReference)_OperationDefinition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -700,202 +657,202 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ServiceDefinition; - if(otherT == null) return false; + if(other is not ServiceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Trigger, otherT.Trigger)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; - if(!comparer.Equals(OperationDefinition, otherT.OperationDefinition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; + if(!comparer.Equals(_OperationDefinition, otherT._OperationDefinition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "trigger": - value = Trigger; - return Trigger?.Any() == true; + value = _Trigger; + return _Trigger?.Any() == true; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; case "operationDefinition": - value = OperationDefinition; - return OperationDefinition is not null; + value = _OperationDefinition; + return _OperationDefinition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "trigger": - Trigger = (List)value; + Trigger = (List?)value!; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; case "operationDefinition": - OperationDefinition = (Hl7.Fhir.Model.ResourceReference)value; + OperationDefinition = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -906,31 +863,31 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Trigger?.Any() == true) yield return new KeyValuePair("trigger",Trigger); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); - if (OperationDefinition is not null) yield return new KeyValuePair("operationDefinition",OperationDefinition); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Trigger?.Any() == true) yield return new KeyValuePair("trigger",_Trigger); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); + if (_OperationDefinition is not null) yield return new KeyValuePair("operationDefinition",_OperationDefinition); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs b/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs index 9d5858425..2e7baeb2a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,11 +107,11 @@ public enum SlotStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A broad categorisation of the service that is to be performed during this appointment. @@ -116,13 +119,13 @@ public List Identifier [FhirElement("serviceCategory", InSummary=true, Order=100, FiveWs="class")] [Binding("service-category")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ServiceCategory + public Hl7.Fhir.Model.CodeableConcept? ServiceCategory { get { return _ServiceCategory; } set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private Hl7.Fhir.Model.CodeableConcept _ServiceCategory; + private Hl7.Fhir.Model.CodeableConcept? _ServiceCategory; /// /// The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource. @@ -133,11 +136,11 @@ public Hl7.Fhir.Model.CodeableConcept ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -148,11 +151,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that may be booked in the slot (not service type). @@ -160,13 +163,13 @@ public List Specialty [FhirElement("appointmentType", InSummary=true, Order=130, FiveWs="class")] [Binding("appointment-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AppointmentType + public Hl7.Fhir.Model.CodeableConcept? AppointmentType { get { return _AppointmentType; } set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private Hl7.Fhir.Model.CodeableConcept _AppointmentType; + private Hl7.Fhir.Model.CodeableConcept? _AppointmentType; /// /// The schedule resource that this slot defines an interval of status information. @@ -176,13 +179,13 @@ public Hl7.Fhir.Model.CodeableConcept AppointmentType [References("Schedule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Schedule + public Hl7.Fhir.Model.ResourceReference? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.ResourceReference _Schedule; + private Hl7.Fhir.Model.ResourceReference? _Schedule; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error. @@ -192,13 +195,13 @@ public Hl7.Fhir.Model.ResourceReference Schedule [Binding("SlotStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error @@ -207,13 +210,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Slot.SlotStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -224,13 +224,13 @@ public Hl7.Fhir.Model.Slot.SlotStatus? Status [FhirElement("start", InSummary=true, Order=160, FiveWs="when.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Date/Time that the slot is to begin @@ -239,13 +239,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -256,13 +253,13 @@ public DateTimeOffset? Start [FhirElement("end", InSummary=true, Order=170, FiveWs="when.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Date/Time that the slot is to conclude @@ -271,13 +268,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -287,13 +281,13 @@ public DateTimeOffset? End /// [FhirElement("overbooked", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OverbookedElement + public Hl7.Fhir.Model.FhirBoolean? OverbookedElement { get { return _OverbookedElement; } set { _OverbookedElement = value; OnPropertyChanged("OverbookedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OverbookedElement; + private Hl7.Fhir.Model.FhirBoolean? _OverbookedElement; /// /// This slot has already been overbooked, appointments are unlikely to be accepted for this time @@ -302,13 +296,10 @@ public Hl7.Fhir.Model.FhirBoolean OverbookedElement [IgnoreDataMember] public bool? Overbooked { - get { return OverbookedElement != null ? OverbookedElement.Value : null; } + get => _OverbookedElement?.Value; set { - if (value == null) - OverbookedElement = null; - else - OverbookedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OverbookedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Overbooked"); } } @@ -318,28 +309,25 @@ public bool? Overbooked /// [FhirElement("comment", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on the slot to describe any extended information. Such as custom constraints on the slot /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -348,25 +336,21 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Slot; - - if (dest == null) - { + if(other is not Slot dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ServiceCategory != null) dest.ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)ServiceCategory.DeepCopyInternal(); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType != null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)AppointmentType.DeepCopyInternal(); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)Schedule.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(OverbookedElement != null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)OverbookedElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ServiceCategory is not null) dest.ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)_ServiceCategory.DeepCopyInternal(); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)_AppointmentType.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)_Schedule.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_OverbookedElement is not null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)_OverbookedElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -378,104 +362,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Slot; - if(otherT == null) return false; + if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(OverbookedElement, otherT.OverbookedElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory is not null; + value = _ServiceCategory; + return _ServiceCategory is not null; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType is not null; + value = _AppointmentType; + return _AppointmentType is not null; case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "overbooked": - value = OverbookedElement; - return OverbookedElement is not null; + value = _OverbookedElement; + return _OverbookedElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "serviceCategory": - ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)value; + ServiceCategory = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (Hl7.Fhir.Model.CodeableConcept)value; + AppointmentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "schedule": - Schedule = (Hl7.Fhir.Model.ResourceReference)value; + Schedule = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "overbooked": - OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OverbookedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -486,17 +470,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ServiceCategory is not null) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType is not null) yield return new KeyValuePair("appointmentType",AppointmentType); - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (OverbookedElement is not null) yield return new KeyValuePair("overbooked",OverbookedElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ServiceCategory is not null) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType is not null) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_OverbookedElement is not null) yield return new KeyValuePair("overbooked",_OverbookedElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs b/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs index 4a891c30e..d35285f9a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class CollectionComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Collector + public Hl7.Fhir.Model.ResourceReference? Collector { get { return _Collector; } set { _Collector = value; OnPropertyChanged("Collector"); } } - private Hl7.Fhir.Model.ResourceReference _Collector; + private Hl7.Fhir.Model.ResourceReference? _Collector; /// /// Collection time. @@ -131,26 +134,26 @@ public Hl7.Fhir.Model.ResourceReference Collector [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Collected + public Hl7.Fhir.Model.DataType? Collected { get { return _Collected; } set { _Collected = value; OnPropertyChanged("Collected"); } } - private Hl7.Fhir.Model.DataType _Collected; + private Hl7.Fhir.Model.DataType? _Collected; /// /// The quantity of specimen collected. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Technique used to perform collection. @@ -158,13 +161,13 @@ public Hl7.Fhir.Model.Quantity Quantity [FhirElement("method", Order=70)] [Binding("SpecimenCollectionMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Anatomical collection site. @@ -172,29 +175,25 @@ public Hl7.Fhir.Model.CodeableConcept Method [FhirElement("bodySite", Order=80)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; protected internal override void CopyToInternal(Base other) { - var dest = other as CollectionComponent; - - if (dest == null) - { + if(other is not CollectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Collector != null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)Collector.DeepCopyInternal(); - if(Collected != null) dest.Collected = (Hl7.Fhir.Model.DataType)Collected.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); + if(_Collector is not null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)_Collector.DeepCopyInternal(); + if(_Collected is not null) dest.Collected = (Hl7.Fhir.Model.DataType)_Collected.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -206,62 +205,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CollectionComponent; - if(otherT == null) return false; + if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Collector, otherT.Collector)) return false; - if(!comparer.Equals(Collected, otherT.Collected)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + if(!comparer.Equals(_Collected, otherT._Collected)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "collector": - value = Collector; - return Collector is not null; + value = _Collector; + return _Collector is not null; case "collected": - value = Collected; - return Collected is not null; + value = _Collected; + return _Collected is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "collector": - Collector = (Hl7.Fhir.Model.ResourceReference)value; + Collector = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "collected": - Collected = (Hl7.Fhir.Model.DataType)value; + Collected = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -272,11 +271,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Collector is not null) yield return new KeyValuePair("collector",Collector); - if (Collected is not null) yield return new KeyValuePair("collected",Collected); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); + if (_Collector is not null) yield return new KeyValuePair("collector",_Collector); + if (_Collected is not null) yield return new KeyValuePair("collected",_Collected); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); } } @@ -302,28 +301,25 @@ public partial class ProcessingComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of procedure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -334,13 +330,13 @@ public string Description [FhirElement("procedure", Order=50)] [Binding("SpecimenProcessingProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Procedure + public Hl7.Fhir.Model.CodeableConcept? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.CodeableConcept _Procedure; + private Hl7.Fhir.Model.CodeableConcept? _Procedure; /// /// Material used in the processing step. @@ -352,11 +348,11 @@ public Hl7.Fhir.Model.CodeableConcept Procedure [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Date and time of specimen processing. @@ -365,28 +361,24 @@ public List Additive [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessingComponent; - - if (dest == null) - { + if(other is not ProcessingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)Procedure.DeepCopyInternal(); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)_Procedure.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -398,55 +390,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessingComponent; - if(otherT == null) return false; + if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.CodeableConcept)value; + Procedure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -457,10 +449,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -489,39 +481,36 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Textual description of the container. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the container /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -532,39 +521,39 @@ public string Description [FhirElement("type", Order=60)] [Binding("SpecimenContainerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Container volume or size. /// [FhirElement("capacity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Capacity + public Hl7.Fhir.Model.Quantity? Capacity { get { return _Capacity; } set { _Capacity = value; OnPropertyChanged("Capacity"); } } - private Hl7.Fhir.Model.Quantity _Capacity; + private Hl7.Fhir.Model.Quantity? _Capacity; /// /// Quantity of specimen within container. /// [FhirElement("specimenQuantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity SpecimenQuantity + public Hl7.Fhir.Model.Quantity? SpecimenQuantity { get { return _SpecimenQuantity; } set { _SpecimenQuantity = value; OnPropertyChanged("SpecimenQuantity"); } } - private Hl7.Fhir.Model.Quantity _SpecimenQuantity; + private Hl7.Fhir.Model.Quantity? _SpecimenQuantity; /// /// Additive associated with container. @@ -575,30 +564,26 @@ public Hl7.Fhir.Model.Quantity SpecimenQuantity [References("Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Additive + public Hl7.Fhir.Model.DataType? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.DataType _Additive; + private Hl7.Fhir.Model.DataType? _Additive; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainerComponent; - - if (dest == null) - { + if(other is not ContainerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Capacity != null) dest.Capacity = (Hl7.Fhir.Model.Quantity)Capacity.DeepCopyInternal(); - if(SpecimenQuantity != null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)SpecimenQuantity.DeepCopyInternal(); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.DataType)Additive.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Capacity is not null) dest.Capacity = (Hl7.Fhir.Model.Quantity)_Capacity.DeepCopyInternal(); + if(_SpecimenQuantity is not null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)_SpecimenQuantity.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.DataType)_Additive.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -610,69 +595,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainerComponent; - if(otherT == null) return false; + if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Capacity, otherT.Capacity)) return false; - if(!comparer.Equals(SpecimenQuantity, otherT.SpecimenQuantity)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; + if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; + if(!comparer.Equals(_Additive, otherT._Additive)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "capacity": - value = Capacity; - return Capacity is not null; + value = _Capacity; + return _Capacity is not null; case "specimenQuantity": - value = SpecimenQuantity; - return SpecimenQuantity is not null; + value = _SpecimenQuantity; + return _SpecimenQuantity is not null; case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "capacity": - Capacity = (Hl7.Fhir.Model.Quantity)value; + Capacity = (Hl7.Fhir.Model.Quantity?)value; return this; case "specimenQuantity": - SpecimenQuantity = (Hl7.Fhir.Model.Quantity)value; + SpecimenQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "additive": - Additive = (Hl7.Fhir.Model.DataType)value; + Additive = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -683,12 +668,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Capacity is not null) yield return new KeyValuePair("capacity",Capacity); - if (SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",SpecimenQuantity); - if (Additive is not null) yield return new KeyValuePair("additive",Additive); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Capacity is not null) yield return new KeyValuePair("capacity",_Capacity); + if (_SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",_SpecimenQuantity); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); } } @@ -701,24 +686,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identifier assigned by the lab. /// [FhirElement("accessionIdentifier", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier AccessionIdentifier + public Hl7.Fhir.Model.Identifier? AccessionIdentifier { get { return _AccessionIdentifier; } set { _AccessionIdentifier = value; OnPropertyChanged("AccessionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _AccessionIdentifier; + private Hl7.Fhir.Model.Identifier? _AccessionIdentifier; /// /// available | unavailable | unsatisfactory | entered-in-error. @@ -727,13 +712,13 @@ public Hl7.Fhir.Model.Identifier AccessionIdentifier [DeclaredType(Type = typeof(Code))] [Binding("SpecimenStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// available | unavailable | unsatisfactory | entered-in-error @@ -742,13 +727,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -759,13 +741,13 @@ public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status [FhirElement("type", InSummary=true, Order=120, FiveWs="what")] [Binding("SpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the specimen came from. This may be from the patient(s) or from the environment or a device. @@ -775,41 +757,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Patient","Group","Device","Substance")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The time when specimen was received for processing. /// [FhirElement("receivedTime", InSummary=true, Order=140, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedTimeElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedTimeElement { get { return _ReceivedTimeElement; } set { _ReceivedTimeElement = value; OnPropertyChanged("ReceivedTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedTimeElement; /// /// The time when specimen was received for processing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReceivedTime + public string? ReceivedTime { - get { return ReceivedTimeElement != null ? ReceivedTimeElement.Value : null; } + get => _ReceivedTimeElement?.Value; set { - if (value == null) - ReceivedTimeElement = null; - else - ReceivedTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ReceivedTime"); } } @@ -824,11 +803,11 @@ public string ReceivedTime [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// Why the specimen was collected. @@ -840,24 +819,24 @@ public List Parent [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Collection details. /// [FhirElement("collection", Order=170)] [DataMember] - public Hl7.Fhir.Model.Specimen.CollectionComponent Collection + public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection { get { return _Collection; } set { _Collection = value; OnPropertyChanged("Collection"); } } - private Hl7.Fhir.Model.Specimen.CollectionComponent _Collection; + private Hl7.Fhir.Model.Specimen.CollectionComponent? _Collection; /// /// Processing and processing step details. @@ -867,11 +846,11 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent Collection [DataMember] public List Processing { - get { if(_Processing==null) _Processing = new List(); return _Processing; } + get => _Processing ?? new List(); set { _Processing = value; OnPropertyChanged("Processing"); } } - private List _Processing; + private List? _Processing; /// /// Direct container of specimen (tube/slide, etc.). @@ -881,11 +860,11 @@ public List Processing [DataMember] public List Container { - get { if(_Container==null) _Container = new List(); return _Container; } + get => _Container ?? new List(); set { _Container = value; OnPropertyChanged("Container"); } } - private List _Container; + private List? _Container; /// /// Comments. @@ -895,36 +874,32 @@ public List Container [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Specimen; - - if (dest == null) - { + if(other is not Specimen dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(AccessionIdentifier != null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)AccessionIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(ReceivedTimeElement != null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedTimeElement.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Collection != null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)Collection.DeepCopyInternal(); - if(Processing.Any()) dest.Processing = new List(Processing.DeepCopyInternal()); - if(Container.Any()) dest.Container = new List(Container.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_AccessionIdentifier is not null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)_AccessionIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_ReceivedTimeElement is not null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedTimeElement.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Collection is not null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)_Collection.DeepCopyInternal(); + if(_Processing is not null) dest.Processing = new List(_Processing.DeepCopyInternal()); + if(_Container is not null) dest.Container = new List(_Container.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -936,111 +911,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Specimen; - if(otherT == null) return false; + if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(AccessionIdentifier, otherT.AccessionIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(ReceivedTimeElement, otherT.ReceivedTimeElement)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.Equals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(Processing, otherT.Processing)) return false; - if(!comparer.ListEquals(Container, otherT.Container)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_ReceivedTimeElement, otherT._ReceivedTimeElement)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; + if(!comparer.ListEquals(_Container, otherT._Container)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "accessionIdentifier": - value = AccessionIdentifier; - return AccessionIdentifier is not null; + value = _AccessionIdentifier; + return _AccessionIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "receivedTime": - value = ReceivedTimeElement; - return ReceivedTimeElement is not null; + value = _ReceivedTimeElement; + return _ReceivedTimeElement is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "collection": - value = Collection; - return Collection is not null; + value = _Collection; + return _Collection is not null; case "processing": - value = Processing; - return Processing?.Any() == true; + value = _Processing; + return _Processing?.Any() == true; case "container": - value = Container; - return Container?.Any() == true; + value = _Container; + return _Container?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "accessionIdentifier": - AccessionIdentifier = (Hl7.Fhir.Model.Identifier)value; + AccessionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receivedTime": - ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "collection": - Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)value; + Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent?)value; return this; case "processing": - Processing = (List)value; + Processing = (List?)value!; return this; case "container": - Container = (List)value; + Container = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1051,18 +1026,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",AccessionIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",ReceivedTimeElement); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Collection is not null) yield return new KeyValuePair("collection",Collection); - if (Processing?.Any() == true) yield return new KeyValuePair("processing",Processing); - if (Container?.Any() == true) yield return new KeyValuePair("container",Container); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",_AccessionIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",_ReceivedTimeElement); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Collection is not null) yield return new KeyValuePair("collection",_Collection); + if (_Processing?.Any() == true) yield return new KeyValuePair("processing",_Processing); + if (_Container?.Any() == true) yield return new KeyValuePair("container",_Container); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs index 660462b5a..4e17dd06e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -165,28 +168,25 @@ public partial class MappingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identity", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentityElement + public Hl7.Fhir.Model.Id? IdentityElement { get { return _IdentityElement; } set { _IdentityElement = value; OnPropertyChanged("IdentityElement"); } } - private Hl7.Fhir.Model.Id _IdentityElement; + private Hl7.Fhir.Model.Id? _IdentityElement; /// /// Internal id when this mapping is used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identity + public string? Identity { - get { return IdentityElement != null ? IdentityElement.Value : null; } + get => _IdentityElement?.Value; set { - if (value == null) - IdentityElement = null; - else - IdentityElement = new Hl7.Fhir.Model.Id(value); + IdentityElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identity"); } } @@ -196,28 +196,25 @@ public string Identity /// [FhirElement("uri", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Identifies what this mapping refers to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -227,28 +224,25 @@ public string Uri /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Names what this mapping refers to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -258,46 +252,39 @@ public string Name /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Versions, Issues, Scope limitations etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MappingComponent; - - if (dest == null) - { + if(other is not MappingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdentityElement != null) dest.IdentityElement = (Hl7.Fhir.Model.Id)IdentityElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_IdentityElement is not null) dest.IdentityElement = (Hl7.Fhir.Model.Id)_IdentityElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -309,55 +296,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MappingComponent; - if(otherT == null) return false; + if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentityElement, otherT.IdentityElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identity": - value = IdentityElement; - return IdentityElement is not null; + value = _IdentityElement; + return _IdentityElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identity": - IdentityElement = (Hl7.Fhir.Model.Id)value; + IdentityElement = (Hl7.Fhir.Model.Id?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -368,10 +355,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentityElement is not null) yield return new KeyValuePair("identity",IdentityElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_IdentityElement is not null) yield return new KeyValuePair("identity",_IdentityElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -400,23 +387,19 @@ public partial class SnapshotComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; protected internal override void CopyToInternal(Base other) { - var dest = other as SnapshotComponent; - - if (dest == null) - { + if(other is not SnapshotComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -428,34 +411,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SnapshotComponent; - if(otherT == null) return false; + if(other is not SnapshotComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "element": - Element = (List)value; + Element = (List?)value!; return this; default: return base.SetValue(key, value); @@ -466,7 +449,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); } } @@ -495,23 +478,19 @@ public partial class DifferentialComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; protected internal override void CopyToInternal(Base other) { - var dest = other as DifferentialComponent; - - if (dest == null) - { + if(other is not DifferentialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -523,34 +502,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DifferentialComponent; - if(otherT == null) return false; + if(other is not DifferentialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "element": - Element = (List)value; + Element = (List?)value!; return this; default: return base.SetValue(key, value); @@ -561,7 +540,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); } } @@ -572,28 +551,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this structure definition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -606,39 +582,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the structure definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -649,28 +622,25 @@ public string Version [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this structure definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -680,28 +650,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this structure definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -714,13 +681,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -729,13 +696,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -745,13 +709,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -760,13 +724,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -776,28 +737,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -807,28 +765,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -841,39 +796,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the structure definition. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -886,11 +838,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for structure definition (if applicable). @@ -901,39 +853,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this structure definition is defined. /// [FhirElement("purpose", Order=220, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this structure definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -943,28 +892,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -978,39 +924,36 @@ public string Copyright [DataMember] public List Keyword { - get { if(_Keyword==null) _Keyword = new List(); return _Keyword; } + get => _Keyword ?? new List(); set { _Keyword = value; OnPropertyChanged("Keyword"); } } - private List _Keyword; + private List? _Keyword; /// /// FHIR Version this StructureDefinition targets. /// [FhirElement("fhirVersion", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.Id FhirVersionElement + public Hl7.Fhir.Model.Id? FhirVersionElement { get { return _FhirVersionElement; } set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private Hl7.Fhir.Model.Id _FhirVersionElement; + private Hl7.Fhir.Model.Id? _FhirVersionElement; /// /// FHIR Version this StructureDefinition targets /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FhirVersion + public string? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Value : null; } + get => _FhirVersionElement?.Value; set { - if (value == null) - FhirVersionElement = null; - else - FhirVersionElement = new Hl7.Fhir.Model.Id(value); + FhirVersionElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("FhirVersion"); } } @@ -1023,11 +966,11 @@ public string FhirVersion [DataMember] public List Mapping { - get { if(_Mapping==null) _Mapping = new List(); return _Mapping; } + get => _Mapping ?? new List(); set { _Mapping = value; OnPropertyChanged("Mapping"); } } - private List _Mapping; + private List? _Mapping; /// /// primitive-type | complex-type | resource | logical. @@ -1037,13 +980,13 @@ public List Mapping [Binding("StructureDefinitionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// primitive-type | complex-type | resource | logical @@ -1052,13 +995,10 @@ public Code KindElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureDefinition.StructureDefinitionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1069,13 +1009,13 @@ public Hl7.Fhir.Model.StructureDefinition.StructureDefinitionKind? Kind [FhirElement("abstract", InSummary=true, Order=280)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AbstractElement + public Hl7.Fhir.Model.FhirBoolean? AbstractElement { get { return _AbstractElement; } set { _AbstractElement = value; OnPropertyChanged("AbstractElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AbstractElement; + private Hl7.Fhir.Model.FhirBoolean? _AbstractElement; /// /// Whether the structure is abstract @@ -1084,13 +1024,10 @@ public Hl7.Fhir.Model.FhirBoolean AbstractElement [IgnoreDataMember] public bool? Abstract { - get { return AbstractElement != null ? AbstractElement.Value : null; } + get => _AbstractElement?.Value; set { - if (value == null) - AbstractElement = null; - else - AbstractElement = new Hl7.Fhir.Model.FhirBoolean(value); + AbstractElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Abstract"); } } @@ -1102,13 +1039,13 @@ public bool? Abstract [DeclaredType(Type = typeof(Code))] [Binding("ExtensionContext")] [DataMember] - public Code ContextTypeElement + public Code? ContextTypeElement { get { return _ContextTypeElement; } set { _ContextTypeElement = value; OnPropertyChanged("ContextTypeElement"); } } - private Code _ContextTypeElement; + private Code? _ContextTypeElement; /// /// resource | datatype | extension @@ -1117,13 +1054,10 @@ public Code ContextTypeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureDefinition.ExtensionContext? ContextType { - get { return ContextTypeElement != null ? ContextTypeElement.Value : null; } + get => _ContextTypeElement?.Value; set { - if (value == null) - ContextTypeElement = null; - else - ContextTypeElement = new Code(value); + ContextTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ContextType"); } } @@ -1136,24 +1070,24 @@ public Hl7.Fhir.Model.StructureDefinition.ExtensionContext? ContextType [DataMember] public List ContextElement { - get { if(_ContextElement==null) _ContextElement = new List(); return _ContextElement; } + get => _ContextElement ?? new List(); set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private List _ContextElement; + private List? _ContextElement; /// /// Where the extension can be used in instances /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Context + public IEnumerable? Context { - get { return ContextElement != null ? ContextElement.Select(elem => elem.Value) : null; } + get => _ContextElement?.Select(elem => elem.Value); set { if (value == null) - ContextElement = null; + ContextElement = null!; else ContextElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Context"); @@ -1168,24 +1102,24 @@ public IEnumerable Context [DataMember] public List ContextInvariantElement { - get { if(_ContextInvariantElement==null) _ContextInvariantElement = new List(); return _ContextInvariantElement; } + get => _ContextInvariantElement ?? new List(); set { _ContextInvariantElement = value; OnPropertyChanged("ContextInvariantElement"); } } - private List _ContextInvariantElement; + private List? _ContextInvariantElement; /// /// FHIRPath invariants - when the extension can be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ContextInvariant + public IEnumerable? ContextInvariant { - get { return ContextInvariantElement != null ? ContextInvariantElement.Select(elem => elem.Value) : null; } + get => _ContextInvariantElement?.Select(elem => elem.Value); set { if (value == null) - ContextInvariantElement = null; + ContextInvariantElement = null!; else ContextInvariantElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ContextInvariant"); @@ -1199,28 +1133,25 @@ public IEnumerable ContextInvariant [Binding("FHIRDefinedTypeExt")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code TypeElement + public Hl7.Fhir.Model.Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.Code _TypeElement; + private Hl7.Fhir.Model.Code? _TypeElement; /// /// Type defined or constrained by this structure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.Code(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Type"); } } @@ -1230,28 +1161,25 @@ public string Type /// [FhirElement("baseDefinition", InSummary=true, Order=330)] [DataMember] - public Hl7.Fhir.Model.FhirUri BaseDefinitionElement + public Hl7.Fhir.Model.FhirUri? BaseDefinitionElement { get { return _BaseDefinitionElement; } set { _BaseDefinitionElement = value; OnPropertyChanged("BaseDefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _BaseDefinitionElement; + private Hl7.Fhir.Model.FhirUri? _BaseDefinitionElement; /// /// Definition that this type is constrained/specialized from /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BaseDefinition + public string? BaseDefinition { - get { return BaseDefinitionElement != null ? BaseDefinitionElement.Value : null; } + get => _BaseDefinitionElement?.Value; set { - if (value == null) - BaseDefinitionElement = null; - else - BaseDefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + BaseDefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("BaseDefinition"); } } @@ -1263,13 +1191,13 @@ public string BaseDefinition [DeclaredType(Type = typeof(Code))] [Binding("TypeDerivationRule")] [DataMember] - public Code DerivationElement + public Code? DerivationElement { get { return _DerivationElement; } set { _DerivationElement = value; OnPropertyChanged("DerivationElement"); } } - private Code _DerivationElement; + private Code? _DerivationElement; /// /// specialization | constraint - How relates to base definition @@ -1278,13 +1206,10 @@ public Code DerivationEle [IgnoreDataMember] public Hl7.Fhir.Model.StructureDefinition.TypeDerivationRule? Derivation { - get { return DerivationElement != null ? DerivationElement.Value : null; } + get => _DerivationElement?.Value; set { - if (value == null) - DerivationElement = null; - else - DerivationElement = new Code(value); + DerivationElement = value is null ? null : new Code(value); OnPropertyChanged("Derivation"); } } @@ -1294,67 +1219,63 @@ public Hl7.Fhir.Model.StructureDefinition.TypeDerivationRule? Derivation /// [FhirElement("snapshot", Order=350)] [DataMember] - public Hl7.Fhir.Model.StructureDefinition.SnapshotComponent Snapshot + public Hl7.Fhir.Model.StructureDefinition.SnapshotComponent? Snapshot { get { return _Snapshot; } set { _Snapshot = value; OnPropertyChanged("Snapshot"); } } - private Hl7.Fhir.Model.StructureDefinition.SnapshotComponent _Snapshot; + private Hl7.Fhir.Model.StructureDefinition.SnapshotComponent? _Snapshot; /// /// Differential view of the structure. /// [FhirElement("differential", Order=360)] [DataMember] - public Hl7.Fhir.Model.StructureDefinition.DifferentialComponent Differential + public Hl7.Fhir.Model.StructureDefinition.DifferentialComponent? Differential { get { return _Differential; } set { _Differential = value; OnPropertyChanged("Differential"); } } - private Hl7.Fhir.Model.StructureDefinition.DifferentialComponent _Differential; + private Hl7.Fhir.Model.StructureDefinition.DifferentialComponent? _Differential; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureDefinition; - - if (dest == null) - { + if(other is not StructureDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Keyword.Any()) dest.Keyword = new List(Keyword.DeepCopyInternal()); - if(FhirVersionElement != null) dest.FhirVersionElement = (Hl7.Fhir.Model.Id)FhirVersionElement.DeepCopyInternal(); - if(Mapping.Any()) dest.Mapping = new List(Mapping.DeepCopyInternal()); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(AbstractElement != null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)AbstractElement.DeepCopyInternal(); - if(ContextTypeElement != null) dest.ContextTypeElement = (Code)ContextTypeElement.DeepCopyInternal(); - if(ContextElement.Any()) dest.ContextElement = new List(ContextElement.DeepCopyInternal()); - if(ContextInvariantElement.Any()) dest.ContextInvariantElement = new List(ContextInvariantElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.Code)TypeElement.DeepCopyInternal(); - if(BaseDefinitionElement != null) dest.BaseDefinitionElement = (Hl7.Fhir.Model.FhirUri)BaseDefinitionElement.DeepCopyInternal(); - if(DerivationElement != null) dest.DerivationElement = (Code)DerivationElement.DeepCopyInternal(); - if(Snapshot != null) dest.Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent)Snapshot.DeepCopyInternal(); - if(Differential != null) dest.Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent)Differential.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Keyword is not null) dest.Keyword = new List(_Keyword.DeepCopyInternal()); + if(_FhirVersionElement is not null) dest.FhirVersionElement = (Hl7.Fhir.Model.Id)_FhirVersionElement.DeepCopyInternal(); + if(_Mapping is not null) dest.Mapping = new List(_Mapping.DeepCopyInternal()); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_AbstractElement is not null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)_AbstractElement.DeepCopyInternal(); + if(_ContextTypeElement is not null) dest.ContextTypeElement = (Code)_ContextTypeElement.DeepCopyInternal(); + if(_ContextElement is not null) dest.ContextElement = new List(_ContextElement.DeepCopyInternal()); + if(_ContextInvariantElement is not null) dest.ContextInvariantElement = new List(_ContextInvariantElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.Code)_TypeElement.DeepCopyInternal(); + if(_BaseDefinitionElement is not null) dest.BaseDefinitionElement = (Hl7.Fhir.Model.FhirUri)_BaseDefinitionElement.DeepCopyInternal(); + if(_DerivationElement is not null) dest.DerivationElement = (Code)_DerivationElement.DeepCopyInternal(); + if(_Snapshot is not null) dest.Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent)_Snapshot.DeepCopyInternal(); + if(_Differential is not null) dest.Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent)_Differential.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1366,223 +1287,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureDefinition; - if(otherT == null) return false; + if(other is not StructureDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Keyword, otherT.Keyword)) return false; - if(!comparer.Equals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.ListEquals(Mapping, otherT.Mapping)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(AbstractElement, otherT.AbstractElement)) return false; - if(!comparer.Equals(ContextTypeElement, otherT.ContextTypeElement)) return false; - if(!comparer.ListEquals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.ListEquals(ContextInvariantElement, otherT.ContextInvariantElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(BaseDefinitionElement, otherT.BaseDefinitionElement)) return false; - if(!comparer.Equals(DerivationElement, otherT.DerivationElement)) return false; - if(!comparer.Equals(Snapshot, otherT.Snapshot)) return false; - if(!comparer.Equals(Differential, otherT.Differential)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Keyword, otherT._Keyword)) return false; + if(!comparer.Equals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_AbstractElement, otherT._AbstractElement)) return false; + if(!comparer.Equals(_ContextTypeElement, otherT._ContextTypeElement)) return false; + if(!comparer.ListEquals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.ListEquals(_ContextInvariantElement, otherT._ContextInvariantElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_BaseDefinitionElement, otherT._BaseDefinitionElement)) return false; + if(!comparer.Equals(_DerivationElement, otherT._DerivationElement)) return false; + if(!comparer.Equals(_Snapshot, otherT._Snapshot)) return false; + if(!comparer.Equals(_Differential, otherT._Differential)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "keyword": - value = Keyword; - return Keyword?.Any() == true; + value = _Keyword; + return _Keyword?.Any() == true; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement is not null; + value = _FhirVersionElement; + return _FhirVersionElement is not null; case "mapping": - value = Mapping; - return Mapping?.Any() == true; + value = _Mapping; + return _Mapping?.Any() == true; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "abstract": - value = AbstractElement; - return AbstractElement is not null; + value = _AbstractElement; + return _AbstractElement is not null; case "contextType": - value = ContextTypeElement; - return ContextTypeElement is not null; + value = _ContextTypeElement; + return _ContextTypeElement is not null; case "context": - value = ContextElement; - return ContextElement?.Any() == true; + value = _ContextElement; + return _ContextElement?.Any() == true; case "contextInvariant": - value = ContextInvariantElement; - return ContextInvariantElement?.Any() == true; + value = _ContextInvariantElement; + return _ContextInvariantElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "baseDefinition": - value = BaseDefinitionElement; - return BaseDefinitionElement is not null; + value = _BaseDefinitionElement; + return _BaseDefinitionElement is not null; case "derivation": - value = DerivationElement; - return DerivationElement is not null; + value = _DerivationElement; + return _DerivationElement is not null; case "snapshot": - value = Snapshot; - return Snapshot is not null; + value = _Snapshot; + return _Snapshot is not null; case "differential": - value = Differential; - return Differential is not null; + value = _Differential; + return _Differential is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "keyword": - Keyword = (List)value; + Keyword = (List?)value!; return this; case "fhirVersion": - FhirVersionElement = (Hl7.Fhir.Model.Id)value; + FhirVersionElement = (Hl7.Fhir.Model.Id?)value; return this; case "mapping": - Mapping = (List)value; + Mapping = (List?)value!; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "abstract": - AbstractElement = (Hl7.Fhir.Model.FhirBoolean)value; + AbstractElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "contextType": - ContextTypeElement = (Code)value; + ContextTypeElement = (Code?)value; return this; case "context": - ContextElement = (List)value; + ContextElement = (List?)value!; return this; case "contextInvariant": - ContextInvariantElement = (List)value; + ContextInvariantElement = (List?)value!; return this; case "type": - TypeElement = (Hl7.Fhir.Model.Code)value; + TypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "baseDefinition": - BaseDefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + BaseDefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "derivation": - DerivationElement = (Code)value; + DerivationElement = (Code?)value; return this; case "snapshot": - Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent)value; + Snapshot = (Hl7.Fhir.Model.StructureDefinition.SnapshotComponent?)value; return this; case "differential": - Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent)value; + Differential = (Hl7.Fhir.Model.StructureDefinition.DifferentialComponent?)value; return this; default: return base.SetValue(key, value); @@ -1593,34 +1514,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Keyword?.Any() == true) yield return new KeyValuePair("keyword",Keyword); - if (FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (Mapping?.Any() == true) yield return new KeyValuePair("mapping",Mapping); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (AbstractElement is not null) yield return new KeyValuePair("abstract",AbstractElement); - if (ContextTypeElement is not null) yield return new KeyValuePair("contextType",ContextTypeElement); - if (ContextElement?.Any() == true) yield return new KeyValuePair("context",ContextElement); - if (ContextInvariantElement?.Any() == true) yield return new KeyValuePair("contextInvariant",ContextInvariantElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (BaseDefinitionElement is not null) yield return new KeyValuePair("baseDefinition",BaseDefinitionElement); - if (DerivationElement is not null) yield return new KeyValuePair("derivation",DerivationElement); - if (Snapshot is not null) yield return new KeyValuePair("snapshot",Snapshot); - if (Differential is not null) yield return new KeyValuePair("differential",Differential); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Keyword?.Any() == true) yield return new KeyValuePair("keyword",_Keyword); + if (_FhirVersionElement is not null) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_Mapping?.Any() == true) yield return new KeyValuePair("mapping",_Mapping); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_AbstractElement is not null) yield return new KeyValuePair("abstract",_AbstractElement); + if (_ContextTypeElement is not null) yield return new KeyValuePair("contextType",_ContextTypeElement); + if (_ContextElement?.Any() == true) yield return new KeyValuePair("context",_ContextElement); + if (_ContextInvariantElement?.Any() == true) yield return new KeyValuePair("contextInvariant",_ContextInvariantElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_BaseDefinitionElement is not null) yield return new KeyValuePair("baseDefinition",_BaseDefinitionElement); + if (_DerivationElement is not null) yield return new KeyValuePair("derivation",_DerivationElement); + if (_Snapshot is not null) yield return new KeyValuePair("snapshot",_Snapshot); + if (_Differential is not null) yield return new KeyValuePair("differential",_Differential); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs index 659949ec9..401943f5f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -371,28 +374,25 @@ public partial class StructureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical URL for structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -405,13 +405,13 @@ public string Url [Binding("StructureMapModelMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | queried | target | produced @@ -420,13 +420,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -436,28 +433,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode /// [FhirElement("alias", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString AliasElement + public Hl7.Fhir.Model.FhirString? AliasElement { get { return _AliasElement; } set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private Hl7.Fhir.Model.FhirString _AliasElement; + private Hl7.Fhir.Model.FhirString? _AliasElement; /// /// Name for type in this map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Alias + public string? Alias { - get { return AliasElement != null ? AliasElement.Value : null; } + get => _AliasElement?.Value; set { - if (value == null) - AliasElement = null; - else - AliasElement = new Hl7.Fhir.Model.FhirString(value); + AliasElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Alias"); } } @@ -467,46 +461,39 @@ public string Alias /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation on use of structure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureComponent; - - if (dest == null) - { + if(other is not StructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(AliasElement != null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)AliasElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)_AliasElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -518,55 +505,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureComponent; - if(otherT == null) return false; + if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "alias": - value = AliasElement; - return AliasElement is not null; + value = _AliasElement; + return _AliasElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "alias": - AliasElement = (Hl7.Fhir.Model.FhirString)value; + AliasElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -577,10 +564,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (AliasElement is not null) yield return new KeyValuePair("alias",AliasElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_AliasElement is not null) yield return new KeyValuePair("alias",_AliasElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -607,28 +594,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -638,28 +622,25 @@ public string Name /// [FhirElement("extends", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Id ExtendsElement + public Hl7.Fhir.Model.Id? ExtendsElement { get { return _ExtendsElement; } set { _ExtendsElement = value; OnPropertyChanged("ExtendsElement"); } } - private Hl7.Fhir.Model.Id _ExtendsElement; + private Hl7.Fhir.Model.Id? _ExtendsElement; /// /// Another group that this group adds rules to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Extends + public string? Extends { - get { return ExtendsElement != null ? ExtendsElement.Value : null; } + get => _ExtendsElement?.Value; set { - if (value == null) - ExtendsElement = null; - else - ExtendsElement = new Hl7.Fhir.Model.Id(value); + ExtendsElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Extends"); } } @@ -672,13 +653,13 @@ public string Extends [Binding("StructureMapGroupTypeMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeModeElement + public Code? TypeModeElement { get { return _TypeModeElement; } set { _TypeModeElement = value; OnPropertyChanged("TypeModeElement"); } } - private Code _TypeModeElement; + private Code? _TypeModeElement; /// /// none | types | type-and-types @@ -687,13 +668,10 @@ public Code TypeModeEleme [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode { - get { return TypeModeElement != null ? TypeModeElement.Value : null; } + get => _TypeModeElement?.Value; set { - if (value == null) - TypeModeElement = null; - else - TypeModeElement = new Code(value); + TypeModeElement = value is null ? null : new Code(value); OnPropertyChanged("TypeMode"); } } @@ -703,28 +681,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional description/explaination for group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -737,11 +712,11 @@ public string Documentation [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Transform Rule from source to target. @@ -751,28 +726,24 @@ public List Input [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(ExtendsElement != null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)ExtendsElement.DeepCopyInternal(); - if(TypeModeElement != null) dest.TypeModeElement = (Code)TypeModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_ExtendsElement is not null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)_ExtendsElement.DeepCopyInternal(); + if(_TypeModeElement is not null) dest.TypeModeElement = (Code)_TypeModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -784,69 +755,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ExtendsElement, otherT.ExtendsElement)) return false; - if(!comparer.Equals(TypeModeElement, otherT.TypeModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; + if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "extends": - value = ExtendsElement; - return ExtendsElement is not null; + value = _ExtendsElement; + return _ExtendsElement is not null; case "typeMode": - value = TypeModeElement; - return TypeModeElement is not null; + value = _TypeModeElement; + return _TypeModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "extends": - ExtendsElement = (Hl7.Fhir.Model.Id)value; + ExtendsElement = (Hl7.Fhir.Model.Id?)value; return this; case "typeMode": - TypeModeElement = (Code)value; + TypeModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -857,12 +828,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ExtendsElement is not null) yield return new KeyValuePair("extends",ExtendsElement); - if (TypeModeElement is not null) yield return new KeyValuePair("typeMode",TypeModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ExtendsElement is not null) yield return new KeyValuePair("extends",_ExtendsElement); + if (_TypeModeElement is not null) yield return new KeyValuePair("typeMode",_TypeModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } @@ -890,28 +861,25 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -921,28 +889,25 @@ public string Name /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Type for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -955,13 +920,13 @@ public string Type [Binding("StructureMapInputMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | target @@ -970,13 +935,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -986,46 +948,39 @@ public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1037,55 +992,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1096,10 +1051,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1123,28 +1078,25 @@ public partial class RuleComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of the rule for internal references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -1157,11 +1109,11 @@ public string Name [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; /// /// Content to create because of this mapping rule. @@ -1171,11 +1123,11 @@ public List Source [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// Rules contained in this rule. @@ -1185,11 +1137,11 @@ public List Target [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Which other rules to apply in the context of this rule. @@ -1199,59 +1151,52 @@ public List Rule [DataMember] public List Dependent { - get { if(_Dependent==null) _Dependent = new List(); return _Dependent; } + get => _Dependent ?? new List(); set { _Dependent = value; OnPropertyChanged("Dependent"); } } - private List _Dependent; + private List? _Dependent; /// /// Documentation for this instance of data. /// [FhirElement("documentation", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RuleComponent; - - if (dest == null) - { + if(other is not RuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(Dependent.Any()) dest.Dependent = new List(Dependent.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_Dependent is not null) dest.Dependent = new List(_Dependent.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1263,69 +1208,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RuleComponent; - if(otherT == null) return false; + if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.ListEquals(Dependent, otherT.Dependent)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "dependent": - value = Dependent; - return Dependent?.Any() == true; + value = _Dependent; + return _Dependent?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "dependent": - Dependent = (List)value; + Dependent = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1336,12 +1281,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (Dependent?.Any() == true) yield return new KeyValuePair("dependent",Dependent); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_Dependent?.Any() == true) yield return new KeyValuePair("dependent",_Dependent); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1365,28 +1310,25 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("context", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ContextElement + public Hl7.Fhir.Model.Id? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.Id _ContextElement; + private Hl7.Fhir.Model.Id? _ContextElement; /// /// Type or variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.Id(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Context"); } } @@ -1396,13 +1338,13 @@ public string Context /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Specified minimum cardinality @@ -1411,13 +1353,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -1427,28 +1366,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Specified maximum cardinality (number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -1458,28 +1394,25 @@ public string Max /// [FhirElement("type", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Rule only applies if source has this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1491,41 +1424,38 @@ public string Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Meta))] [DataMember] - public Hl7.Fhir.Model.DataType DefaultValue + public Hl7.Fhir.Model.DataType? DefaultValue { get { return _DefaultValue; } set { _DefaultValue = value; OnPropertyChanged("DefaultValue"); } } - private Hl7.Fhir.Model.DataType _DefaultValue; + private Hl7.Fhir.Model.DataType? _DefaultValue; /// /// Optional field for this source. /// [FhirElement("element", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Optional field for this source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -1537,13 +1467,13 @@ public string Element [DeclaredType(Type = typeof(Code))] [Binding("StructureMapSourceListMode")] [DataMember] - public Code ListModeElement + public Code? ListModeElement { get { return _ListModeElement; } set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private Code _ListModeElement; + private Code? _ListModeElement; /// /// first | not_first | last | not_last | only_one @@ -1552,13 +1482,10 @@ public Code ListModeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode { - get { return ListModeElement != null ? ListModeElement.Value : null; } + get => _ListModeElement?.Value; set { - if (value == null) - ListModeElement = null; - else - ListModeElement = new Code(value); + ListModeElement = value is null ? null : new Code(value); OnPropertyChanged("ListMode"); } } @@ -1568,28 +1495,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode /// [FhirElement("variable", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -1599,28 +1523,25 @@ public string Variable /// [FhirElement("condition", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// FHIRPath expression - must be true or the rule does not apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -1630,52 +1551,45 @@ public string Condition /// [FhirElement("check", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString CheckElement + public Hl7.Fhir.Model.FhirString? CheckElement { get { return _CheckElement; } set { _CheckElement = value; OnPropertyChanged("CheckElement"); } } - private Hl7.Fhir.Model.FhirString _CheckElement; + private Hl7.Fhir.Model.FhirString? _CheckElement; /// /// FHIRPath expression - must be true or the mapping engine throws an error instead of completing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Check + public string? Check { - get { return CheckElement != null ? CheckElement.Value : null; } + get => _CheckElement?.Value; set { - if (value == null) - CheckElement = null; - else - CheckElement = new Hl7.Fhir.Model.FhirString(value); + CheckElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Check"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.Id)ContextElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(DefaultValue != null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)DefaultValue.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(ListModeElement != null) dest.ListModeElement = (Code)ListModeElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(CheckElement != null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)CheckElement.DeepCopyInternal(); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.Id)_ContextElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_DefaultValue is not null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)_DefaultValue.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = (Code)_ListModeElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_CheckElement is not null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)_CheckElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1687,97 +1601,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DefaultValue, otherT.DefaultValue)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.Equals(CheckElement, otherT.CheckElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DefaultValue, otherT._DefaultValue)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "defaultValue": - value = DefaultValue; - return DefaultValue is not null; + value = _DefaultValue; + return _DefaultValue is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement is not null; + value = _ListModeElement; + return _ListModeElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "check": - value = CheckElement; - return CheckElement is not null; + value = _CheckElement; + return _CheckElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.Id)value; + ContextElement = (Hl7.Fhir.Model.Id?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValue = (Hl7.Fhir.Model.DataType)value; + DefaultValue = (Hl7.Fhir.Model.DataType?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "listMode": - ListModeElement = (Code)value; + ListModeElement = (Code?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "check": - CheckElement = (Hl7.Fhir.Model.FhirString)value; + CheckElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1788,16 +1702,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DefaultValue is not null) yield return new KeyValuePair("defaultValue",DefaultValue); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (ListModeElement is not null) yield return new KeyValuePair("listMode",ListModeElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (CheckElement is not null) yield return new KeyValuePair("check",CheckElement); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DefaultValue is not null) yield return new KeyValuePair("defaultValue",_DefaultValue); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_ListModeElement is not null) yield return new KeyValuePair("listMode",_ListModeElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_CheckElement is not null) yield return new KeyValuePair("check",_CheckElement); } } @@ -1820,28 +1734,25 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("context", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Id ContextElement + public Hl7.Fhir.Model.Id? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.Id _ContextElement; + private Hl7.Fhir.Model.Id? _ContextElement; /// /// Type or variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.Id(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Context"); } } @@ -1853,13 +1764,13 @@ public string Context [DeclaredType(Type = typeof(Code))] [Binding("StructureMapContextType")] [DataMember] - public Code ContextTypeElement + public Code? ContextTypeElement { get { return _ContextTypeElement; } set { _ContextTypeElement = value; OnPropertyChanged("ContextTypeElement"); } } - private Code _ContextTypeElement; + private Code? _ContextTypeElement; /// /// type | variable @@ -1868,13 +1779,10 @@ public Code ContextTypeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapContextType? ContextType { - get { return ContextTypeElement != null ? ContextTypeElement.Value : null; } + get => _ContextTypeElement?.Value; set { - if (value == null) - ContextTypeElement = null; - else - ContextTypeElement = new Code(value); + ContextTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ContextType"); } } @@ -1884,28 +1792,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapContextType? ContextType /// [FhirElement("element", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Field to create in the context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -1915,28 +1820,25 @@ public string Element /// [FhirElement("variable", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if desired, and a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -1951,24 +1853,24 @@ public string Variable [DataMember] public List> ListModeElement { - get { if(_ListModeElement==null) _ListModeElement = new List>(); return _ListModeElement; } + get => _ListModeElement ?? new List>(); set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private List> _ListModeElement; + private List>? _ListModeElement; /// /// first | share | last | collate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ListMode + public IEnumerable? ListMode { - get { return ListModeElement != null ? ListModeElement.Select(elem => elem.Value) : null; } + get => _ListModeElement?.Select(elem => elem.Value); set { if (value == null) - ListModeElement = null; + ListModeElement = null!; else ListModeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("ListMode"); @@ -1980,28 +1882,25 @@ public IEnumerable List /// [FhirElement("listRuleId", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Id ListRuleIdElement + public Hl7.Fhir.Model.Id? ListRuleIdElement { get { return _ListRuleIdElement; } set { _ListRuleIdElement = value; OnPropertyChanged("ListRuleIdElement"); } } - private Hl7.Fhir.Model.Id _ListRuleIdElement; + private Hl7.Fhir.Model.Id? _ListRuleIdElement; /// /// Internal rule reference for shared list items /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ListRuleId + public string? ListRuleId { - get { return ListRuleIdElement != null ? ListRuleIdElement.Value : null; } + get => _ListRuleIdElement?.Value; set { - if (value == null) - ListRuleIdElement = null; - else - ListRuleIdElement = new Hl7.Fhir.Model.Id(value); + ListRuleIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ListRuleId"); } } @@ -2013,13 +1912,13 @@ public string ListRuleId [DeclaredType(Type = typeof(Code))] [Binding("StructureMapTransform")] [DataMember] - public Code TransformElement + public Code? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Code _TransformElement; + private Code? _TransformElement; /// /// create | copy + @@ -2028,13 +1927,10 @@ public Code TransformElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Code(value); + TransformElement = value is null ? null : new Code(value); OnPropertyChanged("Transform"); } } @@ -2047,30 +1943,26 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.Id)ContextElement.DeepCopyInternal(); - if(ContextTypeElement != null) dest.ContextTypeElement = (Code)ContextTypeElement.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ListModeElement.Any()) dest.ListModeElement = new List>(ListModeElement.DeepCopyInternal()); - if(ListRuleIdElement != null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)ListRuleIdElement.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Code)TransformElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.Id)_ContextElement.DeepCopyInternal(); + if(_ContextTypeElement is not null) dest.ContextTypeElement = (Code)_ContextTypeElement.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = new List>(_ListModeElement.DeepCopyInternal()); + if(_ListRuleIdElement is not null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)_ListRuleIdElement.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Code)_TransformElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2082,83 +1974,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(ContextTypeElement, otherT.ContextTypeElement)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.ListEquals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(ListRuleIdElement, otherT.ListRuleIdElement)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_ContextTypeElement, otherT._ContextTypeElement)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.ListEquals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "contextType": - value = ContextTypeElement; - return ContextTypeElement is not null; + value = _ContextTypeElement; + return _ContextTypeElement is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement?.Any() == true; + value = _ListModeElement; + return _ListModeElement?.Any() == true; case "listRuleId": - value = ListRuleIdElement; - return ListRuleIdElement is not null; + value = _ListRuleIdElement; + return _ListRuleIdElement is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.Id)value; + ContextElement = (Hl7.Fhir.Model.Id?)value; return this; case "contextType": - ContextTypeElement = (Code)value; + ContextTypeElement = (Code?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "listMode": - ListModeElement = (List>)value; + ListModeElement = (List>?)value!; return this; case "listRuleId": - ListRuleIdElement = (Hl7.Fhir.Model.Id)value; + ListRuleIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "transform": - TransformElement = (Code)value; + TransformElement = (Code?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2169,14 +2061,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (ContextTypeElement is not null) yield return new KeyValuePair("contextType",ContextTypeElement); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",ListModeElement); - if (ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",ListRuleIdElement); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_ContextTypeElement is not null) yield return new KeyValuePair("contextType",_ContextTypeElement); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",_ListModeElement); + if (_ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",_ListRuleIdElement); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); } } @@ -2202,25 +2094,21 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirDecimal))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2232,34 +2120,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2270,7 +2158,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -2294,28 +2182,25 @@ public partial class DependentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of a rule or group to apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -2328,24 +2213,24 @@ public string Name [DataMember] public List VariableElement { - get { if(_VariableElement==null) _VariableElement = new List(); return _VariableElement; } + get => _VariableElement ?? new List(); set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private List _VariableElement; + private List? _VariableElement; /// /// Variable to pass to the rule or group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Variable + public IEnumerable? Variable { - get { return VariableElement != null ? VariableElement.Select(elem => elem.Value) : null; } + get => _VariableElement?.Select(elem => elem.Value); set { if (value == null) - VariableElement = null; + VariableElement = null!; else VariableElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Variable"); @@ -2354,16 +2239,12 @@ public IEnumerable Variable protected internal override void CopyToInternal(Base other) { - var dest = other as DependentComponent; - - if (dest == null) - { + if(other is not DependentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(VariableElement.Any()) dest.VariableElement = new List(VariableElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = new List(_VariableElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2375,41 +2256,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependentComponent; - if(otherT == null) return false; + if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(VariableElement, otherT.VariableElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_VariableElement, otherT._VariableElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "variable": - value = VariableElement; - return VariableElement?.Any() == true; + value = _VariableElement; + return _VariableElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "variable": - VariableElement = (List)value; + VariableElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2420,8 +2301,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VariableElement?.Any() == true) yield return new KeyValuePair("variable",VariableElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VariableElement?.Any() == true) yield return new KeyValuePair("variable",_VariableElement); } } @@ -2432,28 +2313,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this structure map (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2466,39 +2344,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the structure map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2509,28 +2384,25 @@ public string Version [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this structure map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2540,28 +2412,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this structure map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2574,13 +2443,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2589,13 +2458,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2605,13 +2471,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2620,13 +2486,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2636,28 +2499,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2667,28 +2527,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2701,39 +2558,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the structure map. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2746,11 +2600,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for structure map (if applicable). @@ -2761,39 +2615,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this structure map is defined. /// [FhirElement("purpose", Order=220, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this structure map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2803,28 +2654,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2837,11 +2685,11 @@ public string Copyright [DataMember] public List Structure { - get { if(_Structure==null) _Structure = new List(); return _Structure; } + get => _Structure ?? new List(); set { _Structure = value; OnPropertyChanged("Structure"); } } - private List _Structure; + private List? _Structure; /// /// Other maps used by this map (canonical URLs). @@ -2851,24 +2699,24 @@ public List Structure [DataMember] public List ImportElement { - get { if(_ImportElement==null) _ImportElement = new List(); return _ImportElement; } + get => _ImportElement ?? new List(); set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } - private List _ImportElement; + private List? _ImportElement; /// /// Other maps used by this map (canonical URLs) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Import + public IEnumerable? Import { - get { return ImportElement != null ? ImportElement.Select(elem => elem.Value) : null; } + get => _ImportElement?.Select(elem => elem.Value); set { if (value == null) - ImportElement = null; + ImportElement = null!; else ImportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Import"); @@ -2883,42 +2731,38 @@ public IEnumerable Import [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureMap; - - if (dest == null) - { + if(other is not StructureMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Structure.Any()) dest.Structure = new List(Structure.DeepCopyInternal()); - if(ImportElement.Any()) dest.ImportElement = new List(ImportElement.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Structure is not null) dest.Structure = new List(_Structure.DeepCopyInternal()); + if(_ImportElement is not null) dest.ImportElement = new List(_ImportElement.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2930,153 +2774,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureMap; - if(otherT == null) return false; + if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Structure, otherT.Structure)) return false; - if(!comparer.ListEquals(ImportElement, otherT.ImportElement)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Structure, otherT._Structure)) return false; + if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "structure": - value = Structure; - return Structure?.Any() == true; + value = _Structure; + return _Structure?.Any() == true; case "import": - value = ImportElement; - return ImportElement?.Any() == true; + value = _ImportElement; + return _ImportElement?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "structure": - Structure = (List)value; + Structure = (List?)value!; return this; case "import": - ImportElement = (List)value; + ImportElement = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3087,24 +2931,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Structure?.Any() == true) yield return new KeyValuePair("structure",Structure); - if (ImportElement?.Any() == true) yield return new KeyValuePair("import",ImportElement); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Structure?.Any() == true) yield return new KeyValuePair("structure",_Structure); + if (_ImportElement?.Any() == true) yield return new KeyValuePair("import",_ImportElement); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs index 02412bede..42b28121e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -157,13 +160,13 @@ public partial class ChannelComponent : Hl7.Fhir.Model.BackboneElement [Binding("SubscriptionChannelType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// rest-hook | websocket | email | sms | message @@ -172,13 +175,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Subscription.SubscriptionChannelType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -188,28 +188,25 @@ public Hl7.Fhir.Model.Subscription.SubscriptionChannelType? Type /// [FhirElement("endpoint", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri EndpointElement + public Hl7.Fhir.Model.FhirUri? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUri _EndpointElement; + private Hl7.Fhir.Model.FhirUri? _EndpointElement; /// /// Where the channel points to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUri(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Endpoint"); } } @@ -219,28 +216,25 @@ public string Endpoint /// [FhirElement("payload", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString PayloadElement + public Hl7.Fhir.Model.FhirString? PayloadElement { get { return _PayloadElement; } set { _PayloadElement = value; OnPropertyChanged("PayloadElement"); } } - private Hl7.Fhir.Model.FhirString _PayloadElement; + private Hl7.Fhir.Model.FhirString? _PayloadElement; /// /// Mimetype to send, or omit for no payload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Payload + public string? Payload { - get { return PayloadElement != null ? PayloadElement.Value : null; } + get => _PayloadElement?.Value; set { - if (value == null) - PayloadElement = null; - else - PayloadElement = new Hl7.Fhir.Model.FhirString(value); + PayloadElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Payload"); } } @@ -253,24 +247,24 @@ public string Payload [DataMember] public List HeaderElement { - get { if(_HeaderElement==null) _HeaderElement = new List(); return _HeaderElement; } + get => _HeaderElement ?? new List(); set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } - private List _HeaderElement; + private List? _HeaderElement; /// /// Usage depends on the channel type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Header + public IEnumerable? Header { - get { return HeaderElement != null ? HeaderElement.Select(elem => elem.Value) : null; } + get => _HeaderElement?.Select(elem => elem.Value); set { if (value == null) - HeaderElement = null; + HeaderElement = null!; else HeaderElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Header"); @@ -279,18 +273,14 @@ public IEnumerable Header protected internal override void CopyToInternal(Base other) { - var dest = other as ChannelComponent; - - if (dest == null) - { + if(other is not ChannelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUri)EndpointElement.DeepCopyInternal(); - if(PayloadElement != null) dest.PayloadElement = (Hl7.Fhir.Model.FhirString)PayloadElement.DeepCopyInternal(); - if(HeaderElement.Any()) dest.HeaderElement = new List(HeaderElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUri)_EndpointElement.DeepCopyInternal(); + if(_PayloadElement is not null) dest.PayloadElement = (Hl7.Fhir.Model.FhirString)_PayloadElement.DeepCopyInternal(); + if(_HeaderElement is not null) dest.HeaderElement = new List(_HeaderElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -302,55 +292,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChannelComponent; - if(otherT == null) return false; + if(other is not ChannelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; - if(!comparer.Equals(PayloadElement, otherT.PayloadElement)) return false; - if(!comparer.ListEquals(HeaderElement, otherT.HeaderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; + if(!comparer.Equals(_PayloadElement, otherT._PayloadElement)) return false; + if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; case "payload": - value = PayloadElement; - return PayloadElement is not null; + value = _PayloadElement; + return _PayloadElement is not null; case "header": - value = HeaderElement; - return HeaderElement?.Any() == true; + value = _HeaderElement; + return _HeaderElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUri)value; + EndpointElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "payload": - PayloadElement = (Hl7.Fhir.Model.FhirString)value; + PayloadElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "header": - HeaderElement = (List)value; + HeaderElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -361,10 +351,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); - if (PayloadElement is not null) yield return new KeyValuePair("payload",PayloadElement); - if (HeaderElement?.Any() == true) yield return new KeyValuePair("header",HeaderElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); + if (_PayloadElement is not null) yield return new KeyValuePair("payload",_PayloadElement); + if (_HeaderElement?.Any() == true) yield return new KeyValuePair("header",_HeaderElement); } } @@ -377,13 +367,13 @@ public override IEnumerable> EnumerateElements() [Binding("SubscriptionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// requested | active | error | off @@ -392,13 +382,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Subscription.SubscriptionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -411,24 +398,24 @@ public Hl7.Fhir.Model.Subscription.SubscriptionStatus? Status [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// When to automatically delete the subscription. /// [FhirElement("end", InSummary=true, Order=110, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When to automatically delete the subscription @@ -437,13 +424,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -454,28 +438,25 @@ public DateTimeOffset? End [FhirElement("reason", InSummary=true, Order=120, FiveWs="why")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ReasonElement + public Hl7.Fhir.Model.FhirString? ReasonElement { get { return _ReasonElement; } set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private Hl7.Fhir.Model.FhirString _ReasonElement; + private Hl7.Fhir.Model.FhirString? _ReasonElement; /// /// Description of why this subscription was created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reason + public string? Reason { - get { return ReasonElement != null ? ReasonElement.Value : null; } + get => _ReasonElement?.Value; set { - if (value == null) - ReasonElement = null; - else - ReasonElement = new Hl7.Fhir.Model.FhirString(value); + ReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Reason"); } } @@ -486,28 +467,25 @@ public string Reason [FhirElement("criteria", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString CriteriaElement + public Hl7.Fhir.Model.FhirString? CriteriaElement { get { return _CriteriaElement; } set { _CriteriaElement = value; OnPropertyChanged("CriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _CriteriaElement; + private Hl7.Fhir.Model.FhirString? _CriteriaElement; /// /// Rule for server push criteria /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Criteria + public string? Criteria { - get { return CriteriaElement != null ? CriteriaElement.Value : null; } + get => _CriteriaElement?.Value; set { - if (value == null) - CriteriaElement = null; - else - CriteriaElement = new Hl7.Fhir.Model.FhirString(value); + CriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Criteria"); } } @@ -517,28 +495,25 @@ public string Criteria /// [FhirElement("error", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ErrorElement + public Hl7.Fhir.Model.FhirString? ErrorElement { get { return _ErrorElement; } set { _ErrorElement = value; OnPropertyChanged("ErrorElement"); } } - private Hl7.Fhir.Model.FhirString _ErrorElement; + private Hl7.Fhir.Model.FhirString? _ErrorElement; /// /// Latest error note /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Error + public string? Error { - get { return ErrorElement != null ? ErrorElement.Value : null; } + get => _ErrorElement?.Value; set { - if (value == null) - ErrorElement = null; - else - ErrorElement = new Hl7.Fhir.Model.FhirString(value); + ErrorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Error"); } } @@ -549,13 +524,13 @@ public string Error [FhirElement("channel", InSummary=true, Order=150)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Subscription.ChannelComponent Channel + public Hl7.Fhir.Model.Subscription.ChannelComponent? Channel { get { return _Channel; } set { _Channel = value; OnPropertyChanged("Channel"); } } - private Hl7.Fhir.Model.Subscription.ChannelComponent _Channel; + private Hl7.Fhir.Model.Subscription.ChannelComponent? _Channel; /// /// A tag to add to matching resources. @@ -566,30 +541,26 @@ public Hl7.Fhir.Model.Subscription.ChannelComponent Channel [DataMember] public List Tag { - get { if(_Tag==null) _Tag = new List(); return _Tag; } + get => _Tag ?? new List(); set { _Tag = value; OnPropertyChanged("Tag"); } } - private List _Tag; + private List? _Tag; protected internal override void CopyToInternal(Base other) { - var dest = other as Subscription; - - if (dest == null) - { + if(other is not Subscription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ReasonElement != null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)ReasonElement.DeepCopyInternal(); - if(CriteriaElement != null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)CriteriaElement.DeepCopyInternal(); - if(ErrorElement != null) dest.ErrorElement = (Hl7.Fhir.Model.FhirString)ErrorElement.DeepCopyInternal(); - if(Channel != null) dest.Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)Channel.DeepCopyInternal(); - if(Tag.Any()) dest.Tag = new List(Tag.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ReasonElement is not null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)_ReasonElement.DeepCopyInternal(); + if(_CriteriaElement is not null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)_CriteriaElement.DeepCopyInternal(); + if(_ErrorElement is not null) dest.ErrorElement = (Hl7.Fhir.Model.FhirString)_ErrorElement.DeepCopyInternal(); + if(_Channel is not null) dest.Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)_Channel.DeepCopyInternal(); + if(_Tag is not null) dest.Tag = new List(_Tag.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -601,83 +572,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Subscription; - if(otherT == null) return false; + if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ReasonElement, otherT.ReasonElement)) return false; - if(!comparer.Equals(CriteriaElement, otherT.CriteriaElement)) return false; - if(!comparer.Equals(ErrorElement, otherT.ErrorElement)) return false; - if(!comparer.Equals(Channel, otherT.Channel)) return false; - if(!comparer.ListEquals(Tag, otherT.Tag)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; + if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; + if(!comparer.Equals(_ErrorElement, otherT._ErrorElement)) return false; + if(!comparer.Equals(_Channel, otherT._Channel)) return false; + if(!comparer.ListEquals(_Tag, otherT._Tag)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "reason": - value = ReasonElement; - return ReasonElement is not null; + value = _ReasonElement; + return _ReasonElement is not null; case "criteria": - value = CriteriaElement; - return CriteriaElement is not null; + value = _CriteriaElement; + return _CriteriaElement is not null; case "error": - value = ErrorElement; - return ErrorElement is not null; + value = _ErrorElement; + return _ErrorElement is not null; case "channel": - value = Channel; - return Channel is not null; + value = _Channel; + return _Channel is not null; case "tag": - value = Tag; - return Tag?.Any() == true; + value = _Tag; + return _Tag?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "reason": - ReasonElement = (Hl7.Fhir.Model.FhirString)value; + ReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - CriteriaElement = (Hl7.Fhir.Model.FhirString)value; + CriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "error": - ErrorElement = (Hl7.Fhir.Model.FhirString)value; + ErrorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "channel": - Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)value; + Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent?)value; return this; case "tag": - Tag = (List)value; + Tag = (List?)value!; return this; default: return base.SetValue(key, value); @@ -688,14 +659,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ReasonElement is not null) yield return new KeyValuePair("reason",ReasonElement); - if (CriteriaElement is not null) yield return new KeyValuePair("criteria",CriteriaElement); - if (ErrorElement is not null) yield return new KeyValuePair("error",ErrorElement); - if (Channel is not null) yield return new KeyValuePair("channel",Channel); - if (Tag?.Any() == true) yield return new KeyValuePair("tag",Tag); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ReasonElement is not null) yield return new KeyValuePair("reason",_ReasonElement); + if (_CriteriaElement is not null) yield return new KeyValuePair("criteria",_CriteriaElement); + if (_ErrorElement is not null) yield return new KeyValuePair("error",_ErrorElement); + if (_Channel is not null) yield return new KeyValuePair("channel",_Channel); + if (_Tag?.Any() == true) yield return new KeyValuePair("tag",_Tag); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs index 10665431f..07e5e41b2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -105,41 +108,38 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// When no longer valid to use. /// [FhirElement("expiry", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpiryElement + public Hl7.Fhir.Model.FhirDateTime? ExpiryElement { get { return _ExpiryElement; } set { _ExpiryElement = value; OnPropertyChanged("ExpiryElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpiryElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpiryElement; /// /// When no longer valid to use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expiry + public string? Expiry { - get { return ExpiryElement != null ? ExpiryElement.Value : null; } + get => _ExpiryElement?.Value; set { - if (value == null) - ExpiryElement = null; - else - ExpiryElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpiryElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Expiry"); } } @@ -149,27 +149,23 @@ public string Expiry /// [FhirElement("quantity", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(ExpiryElement != null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)ExpiryElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_ExpiryElement is not null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)_ExpiryElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -181,48 +177,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ExpiryElement, otherT.ExpiryElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "expiry": - value = ExpiryElement; - return ExpiryElement is not null; + value = _ExpiryElement; + return _ExpiryElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "expiry": - ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpiryElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -233,9 +229,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (ExpiryElement is not null) yield return new KeyValuePair("expiry",ExpiryElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_ExpiryElement is not null) yield return new KeyValuePair("expiry",_ExpiryElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -261,13 +257,13 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Ratio Quantity + public Hl7.Fhir.Model.Ratio? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Ratio _Quantity; + private Hl7.Fhir.Model.Ratio? _Quantity; /// /// A component of the substance. @@ -279,26 +275,22 @@ public Hl7.Fhir.Model.Ratio Quantity [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Substance + public Hl7.Fhir.Model.DataType? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.DataType _Substance; + private Hl7.Fhir.Model.DataType? _Substance; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Ratio)Quantity.DeepCopyInternal(); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.DataType)Substance.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Ratio)_Quantity.DeepCopyInternal(); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.DataType)_Substance.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -310,41 +302,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Substance, otherT._Substance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Ratio)value; + Quantity = (Hl7.Fhir.Model.Ratio?)value; return this; case "substance": - Substance = (Hl7.Fhir.Model.DataType)value; + Substance = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -355,8 +347,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Substance is not null) yield return new KeyValuePair("substance",Substance); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); } } @@ -369,11 +361,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -382,13 +374,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("FHIRSubstanceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -397,13 +389,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -417,11 +406,11 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What substance this is. @@ -430,41 +419,38 @@ public List Category [Binding("SubstanceCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Textual description of the substance, comments. /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the substance, comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -477,11 +463,11 @@ public string Description [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Composition information about the substance. @@ -491,31 +477,27 @@ public List Instance [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Substance; - - if (dest == null) - { + if(other is not Substance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -527,76 +509,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Substance; - if(otherT == null) return false; + if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -607,13 +589,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs index 36ede8b9b..b727b7922 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -136,13 +139,13 @@ public partial class SuppliedItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Medication, Substance, or Device supplied. @@ -153,26 +156,22 @@ public Hl7.Fhir.Model.Quantity Quantity [References("Medication","Substance","Device")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as SuppliedItemComponent; - - if (dest == null) - { + if(other is not SuppliedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -184,41 +183,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuppliedItemComponent; - if(otherT == null) return false; + if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -229,8 +228,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -240,13 +239,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Fulfills plan, proposal or order. @@ -258,11 +257,11 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -274,11 +273,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | completed | abandoned | entered-in-error. @@ -287,13 +286,13 @@ public List PartOf [DeclaredType(Type = typeof(Code))] [Binding("SupplyDeliveryStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | abandoned | entered-in-error @@ -302,13 +301,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -320,13 +316,13 @@ public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Category of dispense event. @@ -334,26 +330,26 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("type", Order=140)] [Binding("SupplyDeliveryType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The item that is delivered or supplied. /// [FhirElement("suppliedItem", Order=150)] [DataMember] - public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent SuppliedItem + public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent? SuppliedItem { get { return _SuppliedItem; } set { _SuppliedItem = value; OnPropertyChanged("SuppliedItem"); } } - private Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent _SuppliedItem; + private Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent? _SuppliedItem; /// /// When event occurred. @@ -362,13 +358,13 @@ public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent SuppliedItem [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Dispenser. @@ -377,13 +373,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Practitioner","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Supplier + public Hl7.Fhir.Model.ResourceReference? Supplier { get { return _Supplier; } set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private Hl7.Fhir.Model.ResourceReference _Supplier; + private Hl7.Fhir.Model.ResourceReference? _Supplier; /// /// Where the Supply was sent. @@ -392,13 +388,13 @@ public Hl7.Fhir.Model.ResourceReference Supplier [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who collected the Supply. @@ -410,35 +406,31 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyDelivery; - - if (dest == null) - { + if(other is not SupplyDelivery dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SuppliedItem != null) dest.SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)SuppliedItem.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Supplier != null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)Supplier.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SuppliedItem is not null) dest.SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)_SuppliedItem.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)_Supplier.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -450,104 +442,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyDelivery; - if(otherT == null) return false; + if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SuppliedItem, otherT.SuppliedItem)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Supplier, otherT.Supplier)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SuppliedItem, otherT._SuppliedItem)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "suppliedItem": - value = SuppliedItem; - return SuppliedItem is not null; + value = _SuppliedItem; + return _SuppliedItem is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "supplier": - value = Supplier; - return Supplier is not null; + value = _Supplier; + return _Supplier is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "suppliedItem": - SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)value; + SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "supplier": - Supplier = (Hl7.Fhir.Model.ResourceReference)value; + Supplier = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; default: return base.SetValue(key, value); @@ -558,17 +550,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SuppliedItem is not null) yield return new KeyValuePair("suppliedItem",SuppliedItem); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Supplier is not null) yield return new KeyValuePair("supplier",Supplier); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SuppliedItem is not null) yield return new KeyValuePair("suppliedItem",_SuppliedItem); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Supplier is not null) yield return new KeyValuePair("supplier",_Supplier); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs index b9d32d1fb..91b83aad1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -130,13 +133,13 @@ public partial class OrderedItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("quantity", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Medication, Substance, or Device requested to be supplied. @@ -147,26 +150,22 @@ public Hl7.Fhir.Model.Quantity Quantity [References("Medication","Substance","Device")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as OrderedItemComponent; - - if (dest == null) - { + if(other is not OrderedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -178,41 +177,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrderedItemComponent; - if(otherT == null) return false; + if(other is not OrderedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -223,8 +222,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -253,13 +252,13 @@ public partial class RequesterComponent : Hl7.Fhir.Model.BackboneElement [References("Practitioner","Organization","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Agent + public Hl7.Fhir.Model.ResourceReference? Agent { get { return _Agent; } set { _Agent = value; OnPropertyChanged("Agent"); } } - private Hl7.Fhir.Model.ResourceReference _Agent; + private Hl7.Fhir.Model.ResourceReference? _Agent; /// /// Organization agent is acting for. @@ -268,26 +267,22 @@ public Hl7.Fhir.Model.ResourceReference Agent [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as RequesterComponent; - - if (dest == null) - { + if(other is not RequesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Agent != null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)Agent.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)_Agent.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -299,41 +294,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequesterComponent; - if(otherT == null) return false; + if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "agent": - value = Agent; - return Agent is not null; + value = _Agent; + return _Agent is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "agent": - Agent = (Hl7.Fhir.Model.ResourceReference)value; + Agent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -344,8 +339,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Agent is not null) yield return new KeyValuePair("agent",Agent); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Agent is not null) yield return new KeyValuePair("agent",_Agent); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -355,13 +350,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// draft | active | suspended +. @@ -370,13 +365,13 @@ public Hl7.Fhir.Model.Identifier Identifier [DeclaredType(Type = typeof(Code))] [Binding("SupplyRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended + @@ -385,13 +380,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -402,13 +394,13 @@ public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status [FhirElement("category", InSummary=true, Order=110, FiveWs="class")] [Binding("SupplyRequestKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// routine | urgent | asap | stat. @@ -417,13 +409,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -432,13 +424,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -448,13 +437,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("orderedItem", InSummary=true, Order=130, FiveWs="what")] [DataMember] - public Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent OrderedItem + public Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent? OrderedItem { get { return _OrderedItem; } set { _OrderedItem = value; OnPropertyChanged("OrderedItem"); } } - private Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent _OrderedItem; + private Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent? _OrderedItem; /// /// When the request should be fulfilled. @@ -463,41 +452,38 @@ public Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent OrderedItem [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the request was made. /// [FhirElement("authoredOn", InSummary=true, Order=150, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -507,13 +493,13 @@ public string AuthoredOn /// [FhirElement("requester", InSummary=true, Order=160, FiveWs="who.author")] [DataMember] - public Hl7.Fhir.Model.SupplyRequest.RequesterComponent Requester + public Hl7.Fhir.Model.SupplyRequest.RequesterComponent? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.SupplyRequest.RequesterComponent _Requester; + private Hl7.Fhir.Model.SupplyRequest.RequesterComponent? _Requester; /// /// Who is intended to fulfill the request. @@ -525,11 +511,11 @@ public Hl7.Fhir.Model.SupplyRequest.RequesterComponent Requester [DataMember] public List Supplier { - get { if(_Supplier==null) _Supplier = new List(); return _Supplier; } + get => _Supplier ?? new List(); set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private List _Supplier; + private List? _Supplier; /// /// Why the supply item was requested. @@ -540,13 +526,13 @@ public List Supplier [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reason + public Hl7.Fhir.Model.DataType? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.DataType _Reason; + private Hl7.Fhir.Model.DataType? _Reason; /// /// The origin of the supply. @@ -555,13 +541,13 @@ public Hl7.Fhir.Model.DataType Reason [CLSCompliant(false)] [References("Organization","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverFrom + public Hl7.Fhir.Model.ResourceReference? DeliverFrom { get { return _DeliverFrom; } set { _DeliverFrom = value; OnPropertyChanged("DeliverFrom"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverFrom; + private Hl7.Fhir.Model.ResourceReference? _DeliverFrom; /// /// The destination of the supply. @@ -570,38 +556,34 @@ public Hl7.Fhir.Model.ResourceReference DeliverFrom [CLSCompliant(false)] [References("Organization","Location","Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverTo + public Hl7.Fhir.Model.ResourceReference? DeliverTo { get { return _DeliverTo; } set { _DeliverTo = value; OnPropertyChanged("DeliverTo"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverTo; + private Hl7.Fhir.Model.ResourceReference? _DeliverTo; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyRequest; - - if (dest == null) - { + if(other is not SupplyRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(OrderedItem != null) dest.OrderedItem = (Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent)OrderedItem.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.SupplyRequest.RequesterComponent)Requester.DeepCopyInternal(); - if(Supplier.Any()) dest.Supplier = new List(Supplier.DeepCopyInternal()); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.DataType)Reason.DeepCopyInternal(); - if(DeliverFrom != null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)DeliverFrom.DeepCopyInternal(); - if(DeliverTo != null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)DeliverTo.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_OrderedItem is not null) dest.OrderedItem = (Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent)_OrderedItem.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.SupplyRequest.RequesterComponent)_Requester.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = new List(_Supplier.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.DataType)_Reason.DeepCopyInternal(); + if(_DeliverFrom is not null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)_DeliverFrom.DeepCopyInternal(); + if(_DeliverTo is not null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)_DeliverTo.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -613,111 +595,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyRequest; - if(otherT == null) return false; + if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(OrderedItem, otherT.OrderedItem)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(Supplier, otherT.Supplier)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(DeliverFrom, otherT.DeliverFrom)) return false; - if(!comparer.Equals(DeliverTo, otherT.DeliverTo)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_OrderedItem, otherT._OrderedItem)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_Supplier, otherT._Supplier)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; + if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "orderedItem": - value = OrderedItem; - return OrderedItem is not null; + value = _OrderedItem; + return _OrderedItem is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "supplier": - value = Supplier; - return Supplier?.Any() == true; + value = _Supplier; + return _Supplier?.Any() == true; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "deliverFrom": - value = DeliverFrom; - return DeliverFrom is not null; + value = _DeliverFrom; + return _DeliverFrom is not null; case "deliverTo": - value = DeliverTo; - return DeliverTo is not null; + value = _DeliverTo; + return _DeliverTo is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "orderedItem": - OrderedItem = (Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent)value; + OrderedItem = (Hl7.Fhir.Model.SupplyRequest.OrderedItemComponent?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.SupplyRequest.RequesterComponent)value; + Requester = (Hl7.Fhir.Model.SupplyRequest.RequesterComponent?)value; return this; case "supplier": - Supplier = (List)value; + Supplier = (List?)value!; return this; case "reason": - Reason = (Hl7.Fhir.Model.DataType)value; + Reason = (Hl7.Fhir.Model.DataType?)value; return this; case "deliverFrom": - DeliverFrom = (Hl7.Fhir.Model.ResourceReference)value; + DeliverFrom = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "deliverTo": - DeliverTo = (Hl7.Fhir.Model.ResourceReference)value; + DeliverTo = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -728,18 +710,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (OrderedItem is not null) yield return new KeyValuePair("orderedItem",OrderedItem); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Supplier?.Any() == true) yield return new KeyValuePair("supplier",Supplier); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",DeliverFrom); - if (DeliverTo is not null) yield return new KeyValuePair("deliverTo",DeliverTo); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_OrderedItem is not null) yield return new KeyValuePair("orderedItem",_OrderedItem); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Supplier?.Any() == true) yield return new KeyValuePair("supplier",_Supplier); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",_DeliverFrom); + if (_DeliverTo is not null) yield return new KeyValuePair("deliverTo",_DeliverTo); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Task.cs b/src/Hl7.Fhir.STU3/Model/Generated/Task.cs index 109ada6bd..fc2a0eed4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Task.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -162,13 +165,13 @@ public partial class RequesterComponent : Hl7.Fhir.Model.BackboneElement [References("Device","Organization","Patient","Practitioner","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Agent + public Hl7.Fhir.Model.ResourceReference? Agent { get { return _Agent; } set { _Agent = value; OnPropertyChanged("Agent"); } } - private Hl7.Fhir.Model.ResourceReference _Agent; + private Hl7.Fhir.Model.ResourceReference? _Agent; /// /// Organization individual is acting for. @@ -177,26 +180,22 @@ public Hl7.Fhir.Model.ResourceReference Agent [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as RequesterComponent; - - if (dest == null) - { + if(other is not RequesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Agent != null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)Agent.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = (Hl7.Fhir.Model.ResourceReference)_Agent.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -208,41 +207,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequesterComponent; - if(otherT == null) return false; + if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "agent": - value = Agent; - return Agent is not null; + value = _Agent; + return _Agent is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "agent": - Agent = (Hl7.Fhir.Model.ResourceReference)value; + Agent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -253,8 +252,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Agent is not null) yield return new KeyValuePair("agent",Agent); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Agent is not null) yield return new KeyValuePair("agent",_Agent); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -280,13 +279,13 @@ public partial class RestrictionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("repetitions", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RepetitionsElement + public Hl7.Fhir.Model.PositiveInt? RepetitionsElement { get { return _RepetitionsElement; } set { _RepetitionsElement = value; OnPropertyChanged("RepetitionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _RepetitionsElement; + private Hl7.Fhir.Model.PositiveInt? _RepetitionsElement; /// /// How many times to repeat @@ -295,13 +294,10 @@ public Hl7.Fhir.Model.PositiveInt RepetitionsElement [IgnoreDataMember] public int? Repetitions { - get { return RepetitionsElement != null ? RepetitionsElement.Value : null; } + get => _RepetitionsElement?.Value; set { - if (value == null) - RepetitionsElement = null; - else - RepetitionsElement = new Hl7.Fhir.Model.PositiveInt(value); + RepetitionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Repetitions"); } } @@ -311,13 +307,13 @@ public int? Repetitions /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// For whom is fulfillment sought?. @@ -329,25 +325,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; protected internal override void CopyToInternal(Base other) { - var dest = other as RestrictionComponent; - - if (dest == null) - { + if(other is not RestrictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RepetitionsElement != null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)RepetitionsElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); + if(_RepetitionsElement is not null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)_RepetitionsElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -359,48 +351,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RestrictionComponent; - if(otherT == null) return false; + if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RepetitionsElement, otherT.RepetitionsElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "repetitions": - value = RepetitionsElement; - return RepetitionsElement is not null; + value = _RepetitionsElement; + return _RepetitionsElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "repetitions": - RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)value; + RepetitionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -411,9 +403,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RepetitionsElement is not null) yield return new KeyValuePair("repetitions",RepetitionsElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); + if (_RepetitionsElement is not null) yield return new KeyValuePair("repetitions",_RepetitionsElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); } } @@ -441,13 +433,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskInputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Content to use in performing the task. @@ -457,26 +449,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -488,41 +476,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -533,8 +521,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -562,13 +550,13 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskOutputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Result of output. @@ -578,26 +566,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -609,41 +593,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -654,8 +638,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -668,11 +652,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Formal definition of task. @@ -682,13 +666,13 @@ public List Identifier [References("ActivityDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// Request fulfilled by this task. @@ -700,24 +684,24 @@ public Hl7.Fhir.Model.DataType Definition [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Requisition or grouper id. /// [FhirElement("groupIdentifier", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// Composite task. @@ -729,11 +713,11 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | requested | received | accepted | +. @@ -743,13 +727,13 @@ public List PartOf [Binding("TaskStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | requested | received | accepted | + @@ -758,13 +742,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Task.TaskStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -775,13 +756,13 @@ public Hl7.Fhir.Model.Task.TaskStatus? Status [FhirElement("statusReason", InSummary=true, Order=150)] [Binding("TaskStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// E.g. "Specimen collected", "IV prepped". @@ -789,13 +770,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [FhirElement("businessStatus", InSummary=true, Order=160)] [Binding("TaskBusinessStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BusinessStatus + public Hl7.Fhir.Model.CodeableConcept? BusinessStatus { get { return _BusinessStatus; } set { _BusinessStatus = value; OnPropertyChanged("BusinessStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _BusinessStatus; + private Hl7.Fhir.Model.CodeableConcept? _BusinessStatus; /// /// proposal | plan | order +. @@ -805,13 +786,13 @@ public Hl7.Fhir.Model.CodeableConcept BusinessStatus [Binding("TaskIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order + @@ -820,13 +801,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -838,13 +816,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("TaskPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// normal | urgent | asap | stat @@ -853,13 +831,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -870,41 +845,38 @@ public Hl7.Fhir.Model.RequestPriority? Priority [FhirElement("code", InSummary=true, Order=190, FiveWs="what")] [Binding("TaskCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Human-readable explanation of task. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable explanation of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -916,13 +888,13 @@ public string Description [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Beneficiary of the Task. @@ -931,13 +903,13 @@ public Hl7.Fhir.Model.ResourceReference Focus [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference For + public Hl7.Fhir.Model.ResourceReference? For { get { return _For; } set { _For = value; OnPropertyChanged("For"); } } - private Hl7.Fhir.Model.ResourceReference _For; + private Hl7.Fhir.Model.ResourceReference? _For; /// /// Healthcare event during which this task originated. @@ -946,54 +918,51 @@ public Hl7.Fhir.Model.ResourceReference For [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Start and end time of execution. /// [FhirElement("executionPeriod", InSummary=true, Order=240, FiveWs="when.done")] [DataMember] - public Hl7.Fhir.Model.Period ExecutionPeriod + public Hl7.Fhir.Model.Period? ExecutionPeriod { get { return _ExecutionPeriod; } set { _ExecutionPeriod = value; OnPropertyChanged("ExecutionPeriod"); } } - private Hl7.Fhir.Model.Period _ExecutionPeriod; + private Hl7.Fhir.Model.Period? _ExecutionPeriod; /// /// Task Creation Date. /// [FhirElement("authoredOn", Order=250, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Task Creation Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -1003,28 +972,25 @@ public string AuthoredOn /// [FhirElement("lastModified", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastModifiedElement + public Hl7.Fhir.Model.FhirDateTime? LastModifiedElement { get { return _LastModifiedElement; } set { _LastModifiedElement = value; OnPropertyChanged("LastModifiedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastModifiedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastModifiedElement; /// /// Task Last Modified Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastModified + public string? LastModified { - get { return LastModifiedElement != null ? LastModifiedElement.Value : null; } + get => _LastModifiedElement?.Value; set { - if (value == null) - LastModifiedElement = null; - else - LastModifiedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastModifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastModified"); } } @@ -1034,13 +1000,13 @@ public string LastModified /// [FhirElement("requester", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Task.RequesterComponent Requester + public Hl7.Fhir.Model.Task.RequesterComponent? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.Task.RequesterComponent _Requester; + private Hl7.Fhir.Model.Task.RequesterComponent? _Requester; /// /// requester | dispatcher | scheduler | performer | monitor | manager | acquirer | reviewer. @@ -1051,11 +1017,11 @@ public Hl7.Fhir.Model.Task.RequesterComponent Requester [DataMember] public List PerformerType { - get { if(_PerformerType==null) _PerformerType = new List(); return _PerformerType; } + get => _PerformerType ?? new List(); set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private List _PerformerType; + private List? _PerformerType; /// /// Responsible individual. @@ -1064,13 +1030,13 @@ public List PerformerType [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Why task is needed. @@ -1078,13 +1044,13 @@ public Hl7.Fhir.Model.ResourceReference Owner [FhirElement("reason", Order=300, FiveWs="why")] [Binding("TaskReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Comments made about the task. @@ -1094,11 +1060,11 @@ public Hl7.Fhir.Model.CodeableConcept Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Key events in history of the Task. @@ -1110,24 +1076,24 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Constraints on fulfillment tasks. /// [FhirElement("restriction", Order=330)] [DataMember] - public Hl7.Fhir.Model.Task.RestrictionComponent Restriction + public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction { get { return _Restriction; } set { _Restriction = value; OnPropertyChanged("Restriction"); } } - private Hl7.Fhir.Model.Task.RestrictionComponent _Restriction; + private Hl7.Fhir.Model.Task.RestrictionComponent? _Restriction; /// /// Information used to perform task. @@ -1137,11 +1103,11 @@ public Hl7.Fhir.Model.Task.RestrictionComponent Restriction [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Information produced as part of task. @@ -1151,51 +1117,47 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Task; - - if (dest == null) - { + if(other is not Task dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(BusinessStatus != null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)BusinessStatus.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(For != null) dest.For = (Hl7.Fhir.Model.ResourceReference)For.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(ExecutionPeriod != null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)ExecutionPeriod.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(LastModifiedElement != null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)LastModifiedElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.Task.RequesterComponent)Requester.DeepCopyInternal(); - if(PerformerType.Any()) dest.PerformerType = new List(PerformerType.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Restriction != null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)Restriction.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_BusinessStatus is not null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)_BusinessStatus.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_For is not null) dest.For = (Hl7.Fhir.Model.ResourceReference)_For.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_ExecutionPeriod is not null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)_ExecutionPeriod.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_LastModifiedElement is not null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)_LastModifiedElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.Task.RequesterComponent)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = new List(_PerformerType.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Restriction is not null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)_Restriction.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1207,216 +1169,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Task; - if(otherT == null) return false; + if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(BusinessStatus, otherT.BusinessStatus)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(For, otherT.For)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(ExecutionPeriod, otherT.ExecutionPeriod)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(LastModifiedElement, otherT.LastModifiedElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.Equals(Restriction, otherT.Restriction)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_BusinessStatus, otherT._BusinessStatus)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_For, otherT._For)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_ExecutionPeriod, otherT._ExecutionPeriod)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "businessStatus": - value = BusinessStatus; - return BusinessStatus is not null; + value = _BusinessStatus; + return _BusinessStatus is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "for": - value = For; - return For is not null; + value = _For; + return _For is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "executionPeriod": - value = ExecutionPeriod; - return ExecutionPeriod is not null; + value = _ExecutionPeriod; + return _ExecutionPeriod is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "lastModified": - value = LastModifiedElement; - return LastModifiedElement is not null; + value = _LastModifiedElement; + return _LastModifiedElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType?.Any() == true; + value = _PerformerType; + return _PerformerType?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "restriction": - value = Restriction; - return Restriction is not null; + value = _Restriction; + return _Restriction is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "businessStatus": - BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)value; + BusinessStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "for": - For = (Hl7.Fhir.Model.ResourceReference)value; + For = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "executionPeriod": - ExecutionPeriod = (Hl7.Fhir.Model.Period)value; + ExecutionPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastModified": - LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.Task.RequesterComponent)value; + Requester = (Hl7.Fhir.Model.Task.RequesterComponent?)value; return this; case "performerType": - PerformerType = (List)value; + PerformerType = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "restriction": - Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)value; + Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1427,33 +1389,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (BusinessStatus is not null) yield return new KeyValuePair("businessStatus",BusinessStatus); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (For is not null) yield return new KeyValuePair("for",For); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",ExecutionPeriod); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (LastModifiedElement is not null) yield return new KeyValuePair("lastModified",LastModifiedElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType?.Any() == true) yield return new KeyValuePair("performerType",PerformerType); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Restriction is not null) yield return new KeyValuePair("restriction",Restriction); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_BusinessStatus is not null) yield return new KeyValuePair("businessStatus",_BusinessStatus); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_For is not null) yield return new KeyValuePair("for",_For); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",_ExecutionPeriod); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_LastModifiedElement is not null) yield return new KeyValuePair("lastModified",_LastModifiedElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType?.Any() == true) yield return new KeyValuePair("performerType",_PerformerType); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Restriction is not null) yield return new KeyValuePair("restriction",_Restriction); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs index 8ee5a6a98..a1d5f4890 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -216,13 +219,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// test-engine | client | server @@ -231,13 +234,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -248,28 +248,25 @@ public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type [FhirElement("uri", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// The uri of the participant. An absolute URL is preferred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -279,45 +276,38 @@ public string Uri /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// The display name of the participant /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -329,48 +319,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -381,9 +371,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -409,23 +399,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -437,34 +423,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -475,7 +461,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -502,39 +488,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -546,41 +528,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -591,8 +573,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -621,13 +603,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -636,13 +618,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -652,28 +631,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -683,45 +659,38 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri DetailElement + public Hl7.Fhir.Model.FhirUri? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirUri _DetailElement; + private Hl7.Fhir.Model.FhirUri? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirUri(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Detail"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)DetailElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)_DetailElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -733,48 +702,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirUri)value; + DetailElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -785,9 +754,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); } } @@ -816,13 +785,13 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -831,13 +800,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -847,28 +813,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -878,45 +841,38 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DetailElement + public Hl7.Fhir.Model.FhirString? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirString _DetailElement; + private Hl7.Fhir.Model.FhirString? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirString(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Detail"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)_DetailElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -928,48 +884,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirString)value; + DetailElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -980,9 +936,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); } } @@ -1005,28 +961,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1036,28 +989,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1070,25 +1020,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1100,48 +1046,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1152,9 +1098,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1181,39 +1127,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion performed. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1225,41 +1167,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -1270,8 +1212,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -1300,23 +1242,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1328,34 +1266,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1366,7 +1304,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1394,25 +1332,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1424,34 +1358,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -1462,7 +1396,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -1472,41 +1406,38 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Informal name of the executed TestScript. /// [FhirElement("name", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Informal name of the executed TestScript /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1519,13 +1450,13 @@ public string Name [Binding("TestReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | in-progress | waiting | stopped | entered-in-error @@ -1534,13 +1465,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1553,13 +1481,13 @@ public Hl7.Fhir.Model.TestReport.TestReportStatus? Status [References("TestScript")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference TestScript + public Hl7.Fhir.Model.ResourceReference? TestScript { get { return _TestScript; } set { _TestScript = value; OnPropertyChanged("TestScript"); } } - private Hl7.Fhir.Model.ResourceReference _TestScript; + private Hl7.Fhir.Model.ResourceReference? _TestScript; /// /// pass | fail | pending. @@ -1569,13 +1497,13 @@ public Hl7.Fhir.Model.ResourceReference TestScript [Binding("TestReportResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | fail | pending @@ -1584,13 +1512,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -1600,13 +1525,13 @@ public Hl7.Fhir.Model.TestReport.TestReportResult? Result /// [FhirElement("score", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ScoreElement + public Hl7.Fhir.Model.FhirDecimal? ScoreElement { get { return _ScoreElement; } set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _ScoreElement; /// /// The final score (percentage of tests passed) resulting from the execution of the TestScript @@ -1615,13 +1540,10 @@ public Hl7.Fhir.Model.FhirDecimal ScoreElement [IgnoreDataMember] public decimal? Score { - get { return ScoreElement != null ? ScoreElement.Value : null; } + get => _ScoreElement?.Value; set { - if (value == null) - ScoreElement = null; - else - ScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + ScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Score"); } } @@ -1631,28 +1553,25 @@ public decimal? Score /// [FhirElement("tester", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString TesterElement + public Hl7.Fhir.Model.FhirString? TesterElement { get { return _TesterElement; } set { _TesterElement = value; OnPropertyChanged("TesterElement"); } } - private Hl7.Fhir.Model.FhirString _TesterElement; + private Hl7.Fhir.Model.FhirString? _TesterElement; /// /// Name of the tester producing this report (Organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Tester + public string? Tester { - get { return TesterElement != null ? TesterElement.Value : null; } + get => _TesterElement?.Value; set { - if (value == null) - TesterElement = null; - else - TesterElement = new Hl7.Fhir.Model.FhirString(value); + TesterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Tester"); } } @@ -1662,28 +1581,25 @@ public string Tester /// [FhirElement("issued", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When the TestScript was executed and this TestReport was generated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -1696,24 +1612,24 @@ public string Issued [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The results of the series of required setup operations before the tests were executed. /// [FhirElement("setup", Order=180)] [DataMember] - public Hl7.Fhir.Model.TestReport.SetupComponent Setup + public Hl7.Fhir.Model.TestReport.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestReport.SetupComponent _Setup; + private Hl7.Fhir.Model.TestReport.SetupComponent? _Setup; /// /// A test executed from the test script. @@ -1723,49 +1639,45 @@ public Hl7.Fhir.Model.TestReport.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// The results of running the series of required clean up steps. /// [FhirElement("teardown", Order=200)] [DataMember] - public Hl7.Fhir.Model.TestReport.TeardownComponent Teardown + public Hl7.Fhir.Model.TestReport.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestReport.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestReport.TeardownComponent? _Teardown; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestReport; - - if (dest == null) - { + if(other is not TestReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TestScript != null) dest.TestScript = (Hl7.Fhir.Model.ResourceReference)TestScript.DeepCopyInternal(); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(ScoreElement != null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)ScoreElement.DeepCopyInternal(); - if(TesterElement != null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)TesterElement.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)Teardown.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TestScript is not null) dest.TestScript = (Hl7.Fhir.Model.ResourceReference)_TestScript.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_ScoreElement is not null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)_ScoreElement.DeepCopyInternal(); + if(_TesterElement is not null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)_TesterElement.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1777,111 +1689,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestReport; - if(otherT == null) return false; + if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TestScript, otherT.TestScript)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(ScoreElement, otherT.ScoreElement)) return false; - if(!comparer.Equals(TesterElement, otherT.TesterElement)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TestScript, otherT._TestScript)) return false; + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false; + if(!comparer.Equals(_TesterElement, otherT._TesterElement)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "testScript": - value = TestScript; - return TestScript is not null; + value = _TestScript; + return _TestScript is not null; case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "score": - value = ScoreElement; - return ScoreElement is not null; + value = _ScoreElement; + return _ScoreElement is not null; case "tester": - value = TesterElement; - return TesterElement is not null; + value = _TesterElement; + return _TesterElement is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "testScript": - TestScript = (Hl7.Fhir.Model.ResourceReference)value; + TestScript = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "score": - ScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + ScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tester": - TesterElement = (Hl7.Fhir.Model.FhirString)value; + TesterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestReport.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -1892,18 +1804,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TestScript is not null) yield return new KeyValuePair("testScript",TestScript); - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (ScoreElement is not null) yield return new KeyValuePair("score",ScoreElement); - if (TesterElement is not null) yield return new KeyValuePair("tester",TesterElement); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TestScript is not null) yield return new KeyValuePair("testScript",_TestScript); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_ScoreElement is not null) yield return new KeyValuePair("score",_ScoreElement); + if (_TesterElement is not null) yield return new KeyValuePair("tester",_TesterElement); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs index 018133fdb..e3f195cfe 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -342,13 +345,13 @@ public partial class OriginComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract origin server starting at 1 @@ -357,13 +360,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -375,26 +375,22 @@ public int? Index [Binding("TestScriptProfileOriginType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as OriginComponent; - - if (dest == null) - { + if(other is not OriginComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -406,41 +402,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OriginComponent; - if(otherT == null) return false; + if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -451,8 +447,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -480,13 +476,13 @@ public partial class DestinationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract destination server starting at 1 @@ -495,13 +491,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -513,26 +506,22 @@ public int? Index [Binding("TestScriptProfileDestinationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as DestinationComponent; - - if (dest == null) - { + if(other is not DestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -544,41 +533,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DestinationComponent; - if(otherT == null) return false; + if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -589,8 +578,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -619,11 +608,11 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; /// /// Capabilities that are assumed to function correctly on the FHIR server being tested. @@ -633,24 +622,20 @@ public List Link [DataMember] public List Capability { - get { if(_Capability==null) _Capability = new List(); return _Capability; } + get => _Capability ?? new List(); set { _Capability = value; OnPropertyChanged("Capability"); } } - private List _Capability; + private List? _Capability; protected internal override void CopyToInternal(Base other) { - var dest = other as MetadataComponent; - - if (dest == null) - { + if(other is not MetadataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); - if(Capability.Any()) dest.Capability = new List(Capability.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); + if(_Capability is not null) dest.Capability = new List(_Capability.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -662,41 +647,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MetadataComponent; - if(otherT == null) return false; + if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; - if(!comparer.ListEquals(Capability, otherT.Capability)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; case "capability": - value = Capability; - return Capability?.Any() == true; + value = _Capability; + return _Capability?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "link": - Link = (List)value; + Link = (List?)value!; return this; case "capability": - Capability = (List)value; + Capability = (List?)value!; return this; default: return base.SetValue(key, value); @@ -707,8 +692,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); - if (Capability?.Any() == true) yield return new KeyValuePair("capability",Capability); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); + if (_Capability?.Any() == true) yield return new KeyValuePair("capability",_Capability); } } @@ -735,28 +720,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URL to the specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -766,44 +748,37 @@ public string Url /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -815,41 +790,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -860,8 +835,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -888,13 +863,13 @@ public partial class CapabilityComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("required", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Are the capabilities required? @@ -903,13 +878,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -919,13 +891,13 @@ public bool? Required /// [FhirElement("validated", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ValidatedElement + public Hl7.Fhir.Model.FhirBoolean? ValidatedElement { get { return _ValidatedElement; } set { _ValidatedElement = value; OnPropertyChanged("ValidatedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ValidatedElement; + private Hl7.Fhir.Model.FhirBoolean? _ValidatedElement; /// /// Are the capabilities validated? @@ -934,13 +906,10 @@ public Hl7.Fhir.Model.FhirBoolean ValidatedElement [IgnoreDataMember] public bool? Validated { - get { return ValidatedElement != null ? ValidatedElement.Value : null; } + get => _ValidatedElement?.Value; set { - if (value == null) - ValidatedElement = null; - else - ValidatedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ValidatedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Validated"); } } @@ -950,28 +919,25 @@ public bool? Validated /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The expected capabilities of the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -984,24 +950,24 @@ public string Description [DataMember] public List OriginElement { - get { if(_OriginElement==null) _OriginElement = new List(); return _OriginElement; } + get => _OriginElement ?? new List(); set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private List _OriginElement; + private List? _OriginElement; /// /// Which origin server these requirements apply to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Origin + public IEnumerable? Origin { - get { return OriginElement != null ? OriginElement.Select(elem => elem.Value) : null; } + get => _OriginElement?.Select(elem => elem.Value); set { if (value == null) - OriginElement = null; + OriginElement = null!; else OriginElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("Origin"); @@ -1013,13 +979,13 @@ public IEnumerable Origin /// [FhirElement("destination", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Which server these requirements apply to @@ -1028,13 +994,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -1047,24 +1010,24 @@ public int? Destination [DataMember] public List LinkElement { - get { if(_LinkElement==null) _LinkElement = new List(); return _LinkElement; } + get => _LinkElement ?? new List(); set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } - private List _LinkElement; + private List? _LinkElement; /// /// Links to the FHIR specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Link + public IEnumerable? Link { - get { return LinkElement != null ? LinkElement.Select(elem => elem.Value) : null; } + get => _LinkElement?.Select(elem => elem.Value); set { if (value == null) - LinkElement = null; + LinkElement = null!; else LinkElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Link"); @@ -1079,31 +1042,27 @@ public IEnumerable Link [References("CapabilityStatement")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Capabilities + public Hl7.Fhir.Model.ResourceReference? Capabilities { get { return _Capabilities; } set { _Capabilities = value; OnPropertyChanged("Capabilities"); } } - private Hl7.Fhir.Model.ResourceReference _Capabilities; + private Hl7.Fhir.Model.ResourceReference? _Capabilities; protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityComponent; - - if (dest == null) - { + if(other is not CapabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(ValidatedElement != null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)ValidatedElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OriginElement.Any()) dest.OriginElement = new List(OriginElement.DeepCopyInternal()); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(LinkElement.Any()) dest.LinkElement = new List(LinkElement.DeepCopyInternal()); - if(Capabilities != null) dest.Capabilities = (Hl7.Fhir.Model.ResourceReference)Capabilities.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_ValidatedElement is not null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)_ValidatedElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = new List(_OriginElement.DeepCopyInternal()); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_LinkElement is not null) dest.LinkElement = new List(_LinkElement.DeepCopyInternal()); + if(_Capabilities is not null) dest.Capabilities = (Hl7.Fhir.Model.ResourceReference)_Capabilities.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1115,76 +1074,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityComponent; - if(otherT == null) return false; + if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(ValidatedElement, otherT.ValidatedElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.ListEquals(LinkElement, otherT.LinkElement)) return false; - if(!comparer.Equals(Capabilities, otherT.Capabilities)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; + if(!comparer.Equals(_Capabilities, otherT._Capabilities)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "validated": - value = ValidatedElement; - return ValidatedElement is not null; + value = _ValidatedElement; + return _ValidatedElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "origin": - value = OriginElement; - return OriginElement?.Any() == true; + value = _OriginElement; + return _OriginElement?.Any() == true; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "link": - value = LinkElement; - return LinkElement?.Any() == true; + value = _LinkElement; + return _LinkElement?.Any() == true; case "capabilities": - value = Capabilities; - return Capabilities is not null; + value = _Capabilities; + return _Capabilities is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "validated": - ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ValidatedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "origin": - OriginElement = (List)value; + OriginElement = (List?)value!; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "link": - LinkElement = (List)value; + LinkElement = (List?)value!; return this; case "capabilities": - Capabilities = (Hl7.Fhir.Model.ResourceReference)value; + Capabilities = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1195,13 +1154,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (ValidatedElement is not null) yield return new KeyValuePair("validated",ValidatedElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OriginElement?.Any() == true) yield return new KeyValuePair("origin",OriginElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (LinkElement?.Any() == true) yield return new KeyValuePair("link",LinkElement); - if (Capabilities is not null) yield return new KeyValuePair("capabilities",Capabilities); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_ValidatedElement is not null) yield return new KeyValuePair("validated",_ValidatedElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OriginElement?.Any() == true) yield return new KeyValuePair("origin",_OriginElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_LinkElement?.Any() == true) yield return new KeyValuePair("link",_LinkElement); + if (_Capabilities is not null) yield return new KeyValuePair("capabilities",_Capabilities); } } @@ -1227,13 +1186,13 @@ public partial class FixtureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("autocreate", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutocreateElement + public Hl7.Fhir.Model.FhirBoolean? AutocreateElement { get { return _AutocreateElement; } set { _AutocreateElement = value; OnPropertyChanged("AutocreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutocreateElement; + private Hl7.Fhir.Model.FhirBoolean? _AutocreateElement; /// /// Whether or not to implicitly create the fixture during setup @@ -1242,13 +1201,10 @@ public Hl7.Fhir.Model.FhirBoolean AutocreateElement [IgnoreDataMember] public bool? Autocreate { - get { return AutocreateElement != null ? AutocreateElement.Value : null; } + get => _AutocreateElement?.Value; set { - if (value == null) - AutocreateElement = null; - else - AutocreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutocreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autocreate"); } } @@ -1258,13 +1214,13 @@ public bool? Autocreate /// [FhirElement("autodelete", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutodeleteElement + public Hl7.Fhir.Model.FhirBoolean? AutodeleteElement { get { return _AutodeleteElement; } set { _AutodeleteElement = value; OnPropertyChanged("AutodeleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutodeleteElement; + private Hl7.Fhir.Model.FhirBoolean? _AutodeleteElement; /// /// Whether or not to implicitly delete the fixture during teardown @@ -1273,13 +1229,10 @@ public Hl7.Fhir.Model.FhirBoolean AutodeleteElement [IgnoreDataMember] public bool? Autodelete { - get { return AutodeleteElement != null ? AutodeleteElement.Value : null; } + get => _AutodeleteElement?.Value; set { - if (value == null) - AutodeleteElement = null; - else - AutodeleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutodeleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autodelete"); } } @@ -1291,27 +1244,23 @@ public bool? Autodelete [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as FixtureComponent; - - if (dest == null) - { + if(other is not FixtureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AutocreateElement != null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)AutocreateElement.DeepCopyInternal(); - if(AutodeleteElement != null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)AutodeleteElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_AutocreateElement is not null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)_AutocreateElement.DeepCopyInternal(); + if(_AutodeleteElement is not null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)_AutodeleteElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1323,48 +1272,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FixtureComponent; - if(otherT == null) return false; + if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AutocreateElement, otherT.AutocreateElement)) return false; - if(!comparer.Equals(AutodeleteElement, otherT.AutodeleteElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "autocreate": - value = AutocreateElement; - return AutocreateElement is not null; + value = _AutocreateElement; + return _AutocreateElement is not null; case "autodelete": - value = AutodeleteElement; - return AutodeleteElement is not null; + value = _AutodeleteElement; + return _AutodeleteElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "autocreate": - AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutocreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "autodelete": - AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1375,9 +1324,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AutocreateElement is not null) yield return new KeyValuePair("autocreate",AutocreateElement); - if (AutodeleteElement is not null) yield return new KeyValuePair("autodelete",AutodeleteElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_AutocreateElement is not null) yield return new KeyValuePair("autocreate",_AutocreateElement); + if (_AutodeleteElement is not null) yield return new KeyValuePair("autodelete",_AutodeleteElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -1405,28 +1354,25 @@ public partial class VariableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptive name for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1436,28 +1382,25 @@ public string Name /// [FhirElement("defaultValue", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DefaultValueElement + public Hl7.Fhir.Model.FhirString? DefaultValueElement { get { return _DefaultValueElement; } set { _DefaultValueElement = value; OnPropertyChanged("DefaultValueElement"); } } - private Hl7.Fhir.Model.FhirString _DefaultValueElement; + private Hl7.Fhir.Model.FhirString? _DefaultValueElement; /// /// Default, hard-coded, or user-defined value for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DefaultValue + public string? DefaultValue { - get { return DefaultValueElement != null ? DefaultValueElement.Value : null; } + get => _DefaultValueElement?.Value; set { - if (value == null) - DefaultValueElement = null; - else - DefaultValueElement = new Hl7.Fhir.Model.FhirString(value); + DefaultValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DefaultValue"); } } @@ -1467,28 +1410,25 @@ public string DefaultValue /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1498,28 +1438,25 @@ public string Description /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The fluentpath expression against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -1529,28 +1466,25 @@ public string Expression /// [FhirElement("headerField", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name for source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -1560,28 +1494,25 @@ public string HeaderField /// [FhirElement("hint", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString HintElement + public Hl7.Fhir.Model.FhirString? HintElement { get { return _HintElement; } set { _HintElement = value; OnPropertyChanged("HintElement"); } } - private Hl7.Fhir.Model.FhirString _HintElement; + private Hl7.Fhir.Model.FhirString? _HintElement; /// /// Hint help text for default value to enter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Hint + public string? Hint { - get { return HintElement != null ? HintElement.Value : null; } + get => _HintElement?.Value; set { - if (value == null) - HintElement = null; - else - HintElement = new Hl7.Fhir.Model.FhirString(value); + HintElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Hint"); } } @@ -1591,28 +1522,25 @@ public string Hint /// [FhirElement("path", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -1622,50 +1550,43 @@ public string Path /// [FhirElement("sourceId", Order=110)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField within this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VariableComponent; - - if (dest == null) - { + if(other is not VariableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DefaultValueElement != null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)DefaultValueElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(HintElement != null) dest.HintElement = (Hl7.Fhir.Model.FhirString)HintElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DefaultValueElement is not null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)_DefaultValueElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_HintElement is not null) dest.HintElement = (Hl7.Fhir.Model.FhirString)_HintElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1677,83 +1598,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableComponent; - if(otherT == null) return false; + if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DefaultValueElement, otherT.DefaultValueElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(HintElement, otherT.HintElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "defaultValue": - value = DefaultValueElement; - return DefaultValueElement is not null; + value = _DefaultValueElement; + return _DefaultValueElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "hint": - value = HintElement; - return HintElement is not null; + value = _HintElement; + return _HintElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValueElement = (Hl7.Fhir.Model.FhirString)value; + DefaultValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "hint": - HintElement = (Hl7.Fhir.Model.FhirString)value; + HintElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -1764,14 +1685,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",DefaultValueElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (HintElement is not null) yield return new KeyValuePair("hint",HintElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",_DefaultValueElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_HintElement is not null) yield return new KeyValuePair("hint",_HintElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); } } @@ -1801,13 +1722,13 @@ public partial class RuleComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; /// /// Rule parameter template. @@ -1817,24 +1738,20 @@ public Hl7.Fhir.Model.ResourceReference Resource [DataMember] public List Param { - get { if(_Param==null) _Param = new List(); return _Param; } + get => _Param ?? new List(); set { _Param = value; OnPropertyChanged("Param"); } } - private List _Param; + private List? _Param; protected internal override void CopyToInternal(Base other) { - var dest = other as RuleComponent; - - if (dest == null) - { + if(other is not RuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); - if(Param.Any()) dest.Param = new List(Param.DeepCopyInternal()); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); + if(_Param is not null) dest.Param = new List(_Param.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1846,41 +1763,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RuleComponent; - if(otherT == null) return false; + if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Param, otherT.Param)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Param, otherT._Param)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "param": - value = Param; - return Param?.Any() == true; + value = _Param; + return _Param?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "param": - Param = (List)value; + Param = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1891,8 +1808,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Param?.Any() == true) yield return new KeyValuePair("param",Param); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Param?.Any() == true) yield return new KeyValuePair("param",_Param); } } @@ -1920,28 +1837,25 @@ public partial class RuleParamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Parameter name matching external assert rule parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1951,44 +1865,37 @@ public string Name /// [FhirElement("value", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Parameter value defined either explicitly or dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RuleParamComponent; - - if (dest == null) - { + if(other is not RuleParamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2000,41 +1907,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RuleParamComponent; - if(otherT == null) return false; + if(other is not RuleParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2045,8 +1952,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -2076,13 +1983,13 @@ public partial class RulesetComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; /// /// The referenced rule within the ruleset. @@ -2092,24 +1999,20 @@ public Hl7.Fhir.Model.ResourceReference Resource [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; protected internal override void CopyToInternal(Base other) { - var dest = other as RulesetComponent; - - if (dest == null) - { + if(other is not RulesetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2121,41 +2024,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RulesetComponent; - if(otherT == null) return false; + if(other is not RulesetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2166,8 +2069,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } @@ -2195,28 +2098,25 @@ public partial class RulesetRuleComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("ruleId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id RuleIdElement + public Hl7.Fhir.Model.Id? RuleIdElement { get { return _RuleIdElement; } set { _RuleIdElement = value; OnPropertyChanged("RuleIdElement"); } } - private Hl7.Fhir.Model.Id _RuleIdElement; + private Hl7.Fhir.Model.Id? _RuleIdElement; /// /// Id of referenced rule within the ruleset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RuleId + public string? RuleId { - get { return RuleIdElement != null ? RuleIdElement.Value : null; } + get => _RuleIdElement?.Value; set { - if (value == null) - RuleIdElement = null; - else - RuleIdElement = new Hl7.Fhir.Model.Id(value); + RuleIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RuleId"); } } @@ -2229,24 +2129,20 @@ public string RuleId [DataMember] public List Param { - get { if(_Param==null) _Param = new List(); return _Param; } + get => _Param ?? new List(); set { _Param = value; OnPropertyChanged("Param"); } } - private List _Param; + private List? _Param; protected internal override void CopyToInternal(Base other) { - var dest = other as RulesetRuleComponent; - - if (dest == null) - { + if(other is not RulesetRuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RuleIdElement != null) dest.RuleIdElement = (Hl7.Fhir.Model.Id)RuleIdElement.DeepCopyInternal(); - if(Param.Any()) dest.Param = new List(Param.DeepCopyInternal()); + if(_RuleIdElement is not null) dest.RuleIdElement = (Hl7.Fhir.Model.Id)_RuleIdElement.DeepCopyInternal(); + if(_Param is not null) dest.Param = new List(_Param.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2258,41 +2154,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RulesetRuleComponent; - if(otherT == null) return false; + if(other is not RulesetRuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RuleIdElement, otherT.RuleIdElement)) return false; - if(!comparer.ListEquals(Param, otherT.Param)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; + if(!comparer.ListEquals(_Param, otherT._Param)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "ruleId": - value = RuleIdElement; - return RuleIdElement is not null; + value = _RuleIdElement; + return _RuleIdElement is not null; case "param": - value = Param; - return Param?.Any() == true; + value = _Param; + return _Param?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "ruleId": - RuleIdElement = (Hl7.Fhir.Model.Id)value; + RuleIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "param": - Param = (List)value; + Param = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2303,8 +2199,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RuleIdElement is not null) yield return new KeyValuePair("ruleId",RuleIdElement); - if (Param?.Any() == true) yield return new KeyValuePair("param",Param); + if (_RuleIdElement is not null) yield return new KeyValuePair("ruleId",_RuleIdElement); + if (_Param?.Any() == true) yield return new KeyValuePair("param",_Param); } } @@ -2332,28 +2228,25 @@ public partial class RulesetRuleParamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Parameter name matching external assert ruleset rule parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2363,44 +2256,37 @@ public string Name /// [FhirElement("value", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Parameter value defined either explicitly or dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RulesetRuleParamComponent; - - if (dest == null) - { + if(other is not RulesetRuleParamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2412,41 +2298,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RulesetRuleParamComponent; - if(otherT == null) return false; + if(other is not RulesetRuleParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2457,8 +2343,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -2484,23 +2370,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2512,34 +2394,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2550,7 +2432,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -2577,39 +2459,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2621,41 +2499,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -2666,8 +2544,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -2694,13 +2572,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("TestScriptOperationCode")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Resource type. @@ -2709,13 +2587,13 @@ public Hl7.Fhir.Model.Coding Type [DeclaredType(Type = typeof(Code))] [Binding("FHIRDefinedType")] [DataMember] - public Code ResourceElement + public Code? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Code _ResourceElement; + private Code? _ResourceElement; /// /// Resource type @@ -2724,13 +2602,10 @@ public Code ResourceElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRDefinedType? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Code(value); + ResourceElement = value is null ? null : new Code(value); OnPropertyChanged("Resource"); } } @@ -2740,28 +2615,25 @@ public Hl7.Fhir.Model.FHIRDefinedType? Resource /// [FhirElement("label", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging operation label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2771,28 +2643,25 @@ public string Label /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting operation description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -2804,13 +2673,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("ContentType")] [DataMember] - public Code AcceptElement + public Code? AcceptElement { get { return _AcceptElement; } set { _AcceptElement = value; OnPropertyChanged("AcceptElement"); } } - private Code _AcceptElement; + private Code? _AcceptElement; /// /// xml | json | ttl | none @@ -2819,13 +2688,10 @@ public Code AcceptElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.ContentTypeCode? Accept { - get { return AcceptElement != null ? AcceptElement.Value : null; } + get => _AcceptElement?.Value; set { - if (value == null) - AcceptElement = null; - else - AcceptElement = new Code(value); + AcceptElement = value is null ? null : new Code(value); OnPropertyChanged("Accept"); } } @@ -2837,13 +2703,13 @@ public Hl7.Fhir.Model.TestScript.ContentTypeCode? Accept [DeclaredType(Type = typeof(Code))] [Binding("ContentType")] [DataMember] - public Code ContentTypeElement + public Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Code _ContentTypeElement; + private Code? _ContentTypeElement; /// /// xml | json | ttl | none @@ -2852,13 +2718,10 @@ public Code ContentTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.ContentTypeCode? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Code(value); + ContentTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ContentType"); } } @@ -2868,13 +2731,13 @@ public Hl7.Fhir.Model.TestScript.ContentTypeCode? ContentType /// [FhirElement("destination", Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Server responding to the request @@ -2883,13 +2746,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -2899,13 +2759,13 @@ public int? Destination /// [FhirElement("encodeRequestUrl", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement + public Hl7.Fhir.Model.FhirBoolean? EncodeRequestUrlElement { get { return _EncodeRequestUrlElement; } set { _EncodeRequestUrlElement = value; OnPropertyChanged("EncodeRequestUrlElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EncodeRequestUrlElement; + private Hl7.Fhir.Model.FhirBoolean? _EncodeRequestUrlElement; /// /// Whether or not to send the request url in encoded format @@ -2914,13 +2774,10 @@ public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement [IgnoreDataMember] public bool? EncodeRequestUrl { - get { return EncodeRequestUrlElement != null ? EncodeRequestUrlElement.Value : null; } + get => _EncodeRequestUrlElement?.Value; set { - if (value == null) - EncodeRequestUrlElement = null; - else - EncodeRequestUrlElement = new Hl7.Fhir.Model.FhirBoolean(value); + EncodeRequestUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EncodeRequestUrl"); } } @@ -2930,13 +2787,13 @@ public bool? EncodeRequestUrl /// [FhirElement("origin", Order=120)] [DataMember] - public Hl7.Fhir.Model.Integer OriginElement + public Hl7.Fhir.Model.Integer? OriginElement { get { return _OriginElement; } set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private Hl7.Fhir.Model.Integer _OriginElement; + private Hl7.Fhir.Model.Integer? _OriginElement; /// /// Server initiating the request @@ -2945,13 +2802,10 @@ public Hl7.Fhir.Model.Integer OriginElement [IgnoreDataMember] public int? Origin { - get { return OriginElement != null ? OriginElement.Value : null; } + get => _OriginElement?.Value; set { - if (value == null) - OriginElement = null; - else - OriginElement = new Hl7.Fhir.Model.Integer(value); + OriginElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Origin"); } } @@ -2961,28 +2815,25 @@ public int? Origin /// [FhirElement("params", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString ParamsElement + public Hl7.Fhir.Model.FhirString? ParamsElement { get { return _ParamsElement; } set { _ParamsElement = value; OnPropertyChanged("ParamsElement"); } } - private Hl7.Fhir.Model.FhirString _ParamsElement; + private Hl7.Fhir.Model.FhirString? _ParamsElement; /// /// Explicitly defined path parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Params + public string? Params { - get { return ParamsElement != null ? ParamsElement.Value : null; } + get => _ParamsElement?.Value; set { - if (value == null) - ParamsElement = null; - else - ParamsElement = new Hl7.Fhir.Model.FhirString(value); + ParamsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Params"); } } @@ -2995,39 +2846,36 @@ public string Params [DataMember] public List RequestHeader { - get { if(_RequestHeader==null) _RequestHeader = new List(); return _RequestHeader; } + get => _RequestHeader ?? new List(); set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } - private List _RequestHeader; + private List? _RequestHeader; /// /// Fixture Id of mapped request. /// [FhirElement("requestId", Order=150)] [DataMember] - public Hl7.Fhir.Model.Id RequestIdElement + public Hl7.Fhir.Model.Id? RequestIdElement { get { return _RequestIdElement; } set { _RequestIdElement = value; OnPropertyChanged("RequestIdElement"); } } - private Hl7.Fhir.Model.Id _RequestIdElement; + private Hl7.Fhir.Model.Id? _RequestIdElement; /// /// Fixture Id of mapped request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestId + public string? RequestId { - get { return RequestIdElement != null ? RequestIdElement.Value : null; } + get => _RequestIdElement?.Value; set { - if (value == null) - RequestIdElement = null; - else - RequestIdElement = new Hl7.Fhir.Model.Id(value); + RequestIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RequestId"); } } @@ -3037,28 +2885,25 @@ public string RequestId /// [FhirElement("responseId", Order=160)] [DataMember] - public Hl7.Fhir.Model.Id ResponseIdElement + public Hl7.Fhir.Model.Id? ResponseIdElement { get { return _ResponseIdElement; } set { _ResponseIdElement = value; OnPropertyChanged("ResponseIdElement"); } } - private Hl7.Fhir.Model.Id _ResponseIdElement; + private Hl7.Fhir.Model.Id? _ResponseIdElement; /// /// Fixture Id of mapped response /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseId + public string? ResponseId { - get { return ResponseIdElement != null ? ResponseIdElement.Value : null; } + get => _ResponseIdElement?.Value; set { - if (value == null) - ResponseIdElement = null; - else - ResponseIdElement = new Hl7.Fhir.Model.Id(value); + ResponseIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ResponseId"); } } @@ -3068,28 +2913,25 @@ public string ResponseId /// [FhirElement("sourceId", Order=170)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of body for PUT and POST requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -3099,28 +2941,25 @@ public string SourceId /// [FhirElement("targetId", Order=180)] [DataMember] - public Hl7.Fhir.Model.Id TargetIdElement + public Hl7.Fhir.Model.Id? TargetIdElement { get { return _TargetIdElement; } set { _TargetIdElement = value; OnPropertyChanged("TargetIdElement"); } } - private Hl7.Fhir.Model.Id _TargetIdElement; + private Hl7.Fhir.Model.Id? _TargetIdElement; /// /// Id of fixture used for extracting the [id], [type], and [vid] for GET requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetId + public string? TargetId { - get { return TargetIdElement != null ? TargetIdElement.Value : null; } + get => _TargetIdElement?.Value; set { - if (value == null) - TargetIdElement = null; - else - TargetIdElement = new Hl7.Fhir.Model.Id(value); + TargetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("TargetId"); } } @@ -3130,58 +2969,51 @@ public string TargetId /// [FhirElement("url", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString UrlElement + public Hl7.Fhir.Model.FhirString? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirString _UrlElement; + private Hl7.Fhir.Model.FhirString? _UrlElement; /// /// Request URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirString(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Code)ResourceElement.DeepCopyInternal(); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(AcceptElement != null) dest.AcceptElement = (Code)AcceptElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Code)ContentTypeElement.DeepCopyInternal(); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(EncodeRequestUrlElement != null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)EncodeRequestUrlElement.DeepCopyInternal(); - if(OriginElement != null) dest.OriginElement = (Hl7.Fhir.Model.Integer)OriginElement.DeepCopyInternal(); - if(ParamsElement != null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)ParamsElement.DeepCopyInternal(); - if(RequestHeader.Any()) dest.RequestHeader = new List(RequestHeader.DeepCopyInternal()); - if(RequestIdElement != null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)RequestIdElement.DeepCopyInternal(); - if(ResponseIdElement != null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)ResponseIdElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(TargetIdElement != null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)TargetIdElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)UrlElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Code)_ResourceElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_AcceptElement is not null) dest.AcceptElement = (Code)_AcceptElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Code)_ContentTypeElement.DeepCopyInternal(); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_EncodeRequestUrlElement is not null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)_EncodeRequestUrlElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = (Hl7.Fhir.Model.Integer)_OriginElement.DeepCopyInternal(); + if(_ParamsElement is not null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)_ParamsElement.DeepCopyInternal(); + if(_RequestHeader is not null) dest.RequestHeader = new List(_RequestHeader.DeepCopyInternal()); + if(_RequestIdElement is not null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)_RequestIdElement.DeepCopyInternal(); + if(_ResponseIdElement is not null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)_ResponseIdElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_TargetIdElement is not null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)_TargetIdElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3193,139 +3025,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(AcceptElement, otherT.AcceptElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.Equals(EncodeRequestUrlElement, otherT.EncodeRequestUrlElement)) return false; - if(!comparer.Equals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(ParamsElement, otherT.ParamsElement)) return false; - if(!comparer.ListEquals(RequestHeader, otherT.RequestHeader)) return false; - if(!comparer.Equals(RequestIdElement, otherT.RequestIdElement)) return false; - if(!comparer.Equals(ResponseIdElement, otherT.ResponseIdElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(TargetIdElement, otherT.TargetIdElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_AcceptElement, otherT._AcceptElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.Equals(_EncodeRequestUrlElement, otherT._EncodeRequestUrlElement)) return false; + if(!comparer.Equals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; + if(!comparer.ListEquals(_RequestHeader, otherT._RequestHeader)) return false; + if(!comparer.Equals(_RequestIdElement, otherT._RequestIdElement)) return false; + if(!comparer.Equals(_ResponseIdElement, otherT._ResponseIdElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "accept": - value = AcceptElement; - return AcceptElement is not null; + value = _AcceptElement; + return _AcceptElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "encodeRequestUrl": - value = EncodeRequestUrlElement; - return EncodeRequestUrlElement is not null; + value = _EncodeRequestUrlElement; + return _EncodeRequestUrlElement is not null; case "origin": - value = OriginElement; - return OriginElement is not null; + value = _OriginElement; + return _OriginElement is not null; case "params": - value = ParamsElement; - return ParamsElement is not null; + value = _ParamsElement; + return _ParamsElement is not null; case "requestHeader": - value = RequestHeader; - return RequestHeader?.Any() == true; + value = _RequestHeader; + return _RequestHeader?.Any() == true; case "requestId": - value = RequestIdElement; - return RequestIdElement is not null; + value = _RequestIdElement; + return _RequestIdElement is not null; case "responseId": - value = ResponseIdElement; - return ResponseIdElement is not null; + value = _ResponseIdElement; + return _ResponseIdElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "targetId": - value = TargetIdElement; - return TargetIdElement is not null; + value = _TargetIdElement; + return _TargetIdElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "resource": - ResourceElement = (Code)value; + ResourceElement = (Code?)value; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "accept": - AcceptElement = (Code)value; + AcceptElement = (Code?)value; return this; case "contentType": - ContentTypeElement = (Code)value; + ContentTypeElement = (Code?)value; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "encodeRequestUrl": - EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)value; + EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "origin": - OriginElement = (Hl7.Fhir.Model.Integer)value; + OriginElement = (Hl7.Fhir.Model.Integer?)value; return this; case "params": - ParamsElement = (Hl7.Fhir.Model.FhirString)value; + ParamsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestHeader": - RequestHeader = (List)value; + RequestHeader = (List?)value!; return this; case "requestId": - RequestIdElement = (Hl7.Fhir.Model.Id)value; + RequestIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "responseId": - ResponseIdElement = (Hl7.Fhir.Model.Id)value; + ResponseIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "targetId": - TargetIdElement = (Hl7.Fhir.Model.Id)value; + TargetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirString)value; + UrlElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3336,22 +3168,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (AcceptElement is not null) yield return new KeyValuePair("accept",AcceptElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",EncodeRequestUrlElement); - if (OriginElement is not null) yield return new KeyValuePair("origin",OriginElement); - if (ParamsElement is not null) yield return new KeyValuePair("params",ParamsElement); - if (RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",RequestHeader); - if (RequestIdElement is not null) yield return new KeyValuePair("requestId",RequestIdElement); - if (ResponseIdElement is not null) yield return new KeyValuePair("responseId",ResponseIdElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (TargetIdElement is not null) yield return new KeyValuePair("targetId",TargetIdElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_AcceptElement is not null) yield return new KeyValuePair("accept",_AcceptElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",_EncodeRequestUrlElement); + if (_OriginElement is not null) yield return new KeyValuePair("origin",_OriginElement); + if (_ParamsElement is not null) yield return new KeyValuePair("params",_ParamsElement); + if (_RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",_RequestHeader); + if (_RequestIdElement is not null) yield return new KeyValuePair("requestId",_RequestIdElement); + if (_ResponseIdElement is not null) yield return new KeyValuePair("responseId",_ResponseIdElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_TargetIdElement is not null) yield return new KeyValuePair("targetId",_TargetIdElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -3379,28 +3211,25 @@ public partial class RequestHeaderComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("field", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString FieldElement + public Hl7.Fhir.Model.FhirString? FieldElement { get { return _FieldElement; } set { _FieldElement = value; OnPropertyChanged("FieldElement"); } } - private Hl7.Fhir.Model.FhirString _FieldElement; + private Hl7.Fhir.Model.FhirString? _FieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Field + public string? Field { - get { return FieldElement != null ? FieldElement.Value : null; } + get => _FieldElement?.Value; set { - if (value == null) - FieldElement = null; - else - FieldElement = new Hl7.Fhir.Model.FhirString(value); + FieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Field"); } } @@ -3411,44 +3240,37 @@ public string Field [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// HTTP headerfield value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestHeaderComponent; - - if (dest == null) - { + if(other is not RequestHeaderComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FieldElement != null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)FieldElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_FieldElement is not null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)_FieldElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3460,41 +3282,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestHeaderComponent; - if(otherT == null) return false; + if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FieldElement, otherT.FieldElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "field": - value = FieldElement; - return FieldElement is not null; + value = _FieldElement; + return _FieldElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "field": - FieldElement = (Hl7.Fhir.Model.FhirString)value; + FieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3505,8 +3327,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FieldElement is not null) yield return new KeyValuePair("field",FieldElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_FieldElement is not null) yield return new KeyValuePair("field",_FieldElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -3533,28 +3355,25 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("label", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging assertion label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -3564,28 +3383,25 @@ public string Label /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting assertion description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -3597,13 +3413,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("AssertionDirectionType")] [DataMember] - public Code DirectionElement + public Code? DirectionElement { get { return _DirectionElement; } set { _DirectionElement = value; OnPropertyChanged("DirectionElement"); } } - private Code _DirectionElement; + private Code? _DirectionElement; /// /// response | request @@ -3612,13 +3428,10 @@ public Code DirectionElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction { - get { return DirectionElement != null ? DirectionElement.Value : null; } + get => _DirectionElement?.Value; set { - if (value == null) - DirectionElement = null; - else - DirectionElement = new Code(value); + DirectionElement = value is null ? null : new Code(value); OnPropertyChanged("Direction"); } } @@ -3628,28 +3441,25 @@ public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction /// [FhirElement("compareToSourceId", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceIdElement + public Hl7.Fhir.Model.FhirString? CompareToSourceIdElement { get { return _CompareToSourceIdElement; } set { _CompareToSourceIdElement = value; OnPropertyChanged("CompareToSourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceIdElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceIdElement; /// /// Id of the source fixture to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceId + public string? CompareToSourceId { - get { return CompareToSourceIdElement != null ? CompareToSourceIdElement.Value : null; } + get => _CompareToSourceIdElement?.Value; set { - if (value == null) - CompareToSourceIdElement = null; - else - CompareToSourceIdElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceId"); } } @@ -3659,28 +3469,25 @@ public string CompareToSourceId /// [FhirElement("compareToSourceExpression", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceExpressionElement + public Hl7.Fhir.Model.FhirString? CompareToSourceExpressionElement { get { return _CompareToSourceExpressionElement; } set { _CompareToSourceExpressionElement = value; OnPropertyChanged("CompareToSourceExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceExpressionElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceExpressionElement; /// /// The fluentpath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceExpression + public string? CompareToSourceExpression { - get { return CompareToSourceExpressionElement != null ? CompareToSourceExpressionElement.Value : null; } + get => _CompareToSourceExpressionElement?.Value; set { - if (value == null) - CompareToSourceExpressionElement = null; - else - CompareToSourceExpressionElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceExpression"); } } @@ -3690,28 +3497,25 @@ public string CompareToSourceExpression /// [FhirElement("compareToSourcePath", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourcePathElement + public Hl7.Fhir.Model.FhirString? CompareToSourcePathElement { get { return _CompareToSourcePathElement; } set { _CompareToSourcePathElement = value; OnPropertyChanged("CompareToSourcePathElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourcePathElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourcePathElement; /// /// XPath or JSONPath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourcePath + public string? CompareToSourcePath { - get { return CompareToSourcePathElement != null ? CompareToSourcePathElement.Value : null; } + get => _CompareToSourcePathElement?.Value; set { - if (value == null) - CompareToSourcePathElement = null; - else - CompareToSourcePathElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourcePathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourcePath"); } } @@ -3723,13 +3527,13 @@ public string CompareToSourcePath [DeclaredType(Type = typeof(Code))] [Binding("ContentType")] [DataMember] - public Code ContentTypeElement + public Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Code _ContentTypeElement; + private Code? _ContentTypeElement; /// /// xml | json | ttl | none @@ -3738,13 +3542,10 @@ public Code ContentTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.ContentTypeCode? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Code(value); + ContentTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ContentType"); } } @@ -3754,28 +3555,25 @@ public Hl7.Fhir.Model.TestScript.ContentTypeCode? ContentType /// [FhirElement("expression", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The fluentpath expression to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -3785,28 +3583,25 @@ public string Expression /// [FhirElement("headerField", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -3816,28 +3611,25 @@ public string HeaderField /// [FhirElement("minimumId", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString MinimumIdElement + public Hl7.Fhir.Model.FhirString? MinimumIdElement { get { return _MinimumIdElement; } set { _MinimumIdElement = value; OnPropertyChanged("MinimumIdElement"); } } - private Hl7.Fhir.Model.FhirString _MinimumIdElement; + private Hl7.Fhir.Model.FhirString? _MinimumIdElement; /// /// Fixture Id of minimum content resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MinimumId + public string? MinimumId { - get { return MinimumIdElement != null ? MinimumIdElement.Value : null; } + get => _MinimumIdElement?.Value; set { - if (value == null) - MinimumIdElement = null; - else - MinimumIdElement = new Hl7.Fhir.Model.FhirString(value); + MinimumIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MinimumId"); } } @@ -3847,13 +3639,13 @@ public string MinimumId /// [FhirElement("navigationLinks", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement + public Hl7.Fhir.Model.FhirBoolean? NavigationLinksElement { get { return _NavigationLinksElement; } set { _NavigationLinksElement = value; OnPropertyChanged("NavigationLinksElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NavigationLinksElement; + private Hl7.Fhir.Model.FhirBoolean? _NavigationLinksElement; /// /// Perform validation on navigation links? @@ -3862,13 +3654,10 @@ public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement [IgnoreDataMember] public bool? NavigationLinks { - get { return NavigationLinksElement != null ? NavigationLinksElement.Value : null; } + get => _NavigationLinksElement?.Value; set { - if (value == null) - NavigationLinksElement = null; - else - NavigationLinksElement = new Hl7.Fhir.Model.FhirBoolean(value); + NavigationLinksElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NavigationLinks"); } } @@ -3880,13 +3669,13 @@ public bool? NavigationLinks [DeclaredType(Type = typeof(Code))] [Binding("AssertionOperatorType")] [DataMember] - public Code OperatorElement + public Code? OperatorElement { get { return _OperatorElement; } set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private Code _OperatorElement; + private Code? _OperatorElement; /// /// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval @@ -3895,13 +3684,10 @@ public Code OperatorElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator { - get { return OperatorElement != null ? OperatorElement.Value : null; } + get => _OperatorElement?.Value; set { - if (value == null) - OperatorElement = null; - else - OperatorElement = new Code(value); + OperatorElement = value is null ? null : new Code(value); OnPropertyChanged("Operator"); } } @@ -3911,28 +3697,25 @@ public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator /// [FhirElement("path", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -3944,13 +3727,13 @@ public string Path [DeclaredType(Type = typeof(Code))] [Binding("TestScriptRequestMethodCode")] [DataMember] - public Code RequestMethodElement + public Code? RequestMethodElement { get { return _RequestMethodElement; } set { _RequestMethodElement = value; OnPropertyChanged("RequestMethodElement"); } } - private Code _RequestMethodElement; + private Code? _RequestMethodElement; /// /// delete | get | options | patch | post | put @@ -3959,13 +3742,10 @@ public Code RequestMethod [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod { - get { return RequestMethodElement != null ? RequestMethodElement.Value : null; } + get => _RequestMethodElement?.Value; set { - if (value == null) - RequestMethodElement = null; - else - RequestMethodElement = new Code(value); + RequestMethodElement = value is null ? null : new Code(value); OnPropertyChanged("RequestMethod"); } } @@ -3975,28 +3755,25 @@ public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod /// [FhirElement("requestURL", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString RequestURLElement + public Hl7.Fhir.Model.FhirString? RequestURLElement { get { return _RequestURLElement; } set { _RequestURLElement = value; OnPropertyChanged("RequestURLElement"); } } - private Hl7.Fhir.Model.FhirString _RequestURLElement; + private Hl7.Fhir.Model.FhirString? _RequestURLElement; /// /// Request URL comparison value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestURL + public string? RequestURL { - get { return RequestURLElement != null ? RequestURLElement.Value : null; } + get => _RequestURLElement?.Value; set { - if (value == null) - RequestURLElement = null; - else - RequestURLElement = new Hl7.Fhir.Model.FhirString(value); + RequestURLElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RequestURL"); } } @@ -4008,13 +3785,13 @@ public string RequestURL [DeclaredType(Type = typeof(Code))] [Binding("FHIRDefinedType")] [DataMember] - public Code ResourceElement + public Code? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Code _ResourceElement; + private Code? _ResourceElement; /// /// Resource type @@ -4023,13 +3800,10 @@ public Code ResourceElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRDefinedType? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Code(value); + ResourceElement = value is null ? null : new Code(value); OnPropertyChanged("Resource"); } } @@ -4041,13 +3815,13 @@ public Hl7.Fhir.Model.FHIRDefinedType? Resource [DeclaredType(Type = typeof(Code))] [Binding("AssertionResponseTypes")] [DataMember] - public Code ResponseElement + public Code? ResponseElement { get { return _ResponseElement; } set { _ResponseElement = value; OnPropertyChanged("ResponseElement"); } } - private Code _ResponseElement; + private Code? _ResponseElement; /// /// okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable @@ -4056,13 +3830,10 @@ public Code ResponseElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response { - get { return ResponseElement != null ? ResponseElement.Value : null; } + get => _ResponseElement?.Value; set { - if (value == null) - ResponseElement = null; - else - ResponseElement = new Code(value); + ResponseElement = value is null ? null : new Code(value); OnPropertyChanged("Response"); } } @@ -4072,28 +3843,25 @@ public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response /// [FhirElement("responseCode", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString ResponseCodeElement + public Hl7.Fhir.Model.FhirString? ResponseCodeElement { get { return _ResponseCodeElement; } set { _ResponseCodeElement = value; OnPropertyChanged("ResponseCodeElement"); } } - private Hl7.Fhir.Model.FhirString _ResponseCodeElement; + private Hl7.Fhir.Model.FhirString? _ResponseCodeElement; /// /// HTTP response code to test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseCode + public string? ResponseCode { - get { return ResponseCodeElement != null ? ResponseCodeElement.Value : null; } + get => _ResponseCodeElement?.Value; set { - if (value == null) - ResponseCodeElement = null; - else - ResponseCodeElement = new Hl7.Fhir.Model.FhirString(value); + ResponseCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResponseCode"); } } @@ -4103,54 +3871,51 @@ public string ResponseCode /// [FhirElement("rule", Order=220)] [DataMember] - public Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent Rule + public Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent? Rule { get { return _Rule; } set { _Rule = value; OnPropertyChanged("Rule"); } } - private Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent _Rule; + private Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent? _Rule; /// /// The reference to a TestScript.ruleset. /// [FhirElement("ruleset", Order=230)] [DataMember] - public Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent Ruleset + public Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent? Ruleset { get { return _Ruleset; } set { _Ruleset = value; OnPropertyChanged("Ruleset"); } } - private Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent _Ruleset; + private Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent? _Ruleset; /// /// Fixture Id of source expression or headerField. /// [FhirElement("sourceId", Order=240)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -4160,28 +3925,25 @@ public string SourceId /// [FhirElement("validateProfileId", Order=250)] [DataMember] - public Hl7.Fhir.Model.Id ValidateProfileIdElement + public Hl7.Fhir.Model.Id? ValidateProfileIdElement { get { return _ValidateProfileIdElement; } set { _ValidateProfileIdElement = value; OnPropertyChanged("ValidateProfileIdElement"); } } - private Hl7.Fhir.Model.Id _ValidateProfileIdElement; + private Hl7.Fhir.Model.Id? _ValidateProfileIdElement; /// /// Profile Id of validation profile reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidateProfileId + public string? ValidateProfileId { - get { return ValidateProfileIdElement != null ? ValidateProfileIdElement.Value : null; } + get => _ValidateProfileIdElement?.Value; set { - if (value == null) - ValidateProfileIdElement = null; - else - ValidateProfileIdElement = new Hl7.Fhir.Model.Id(value); + ValidateProfileIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ValidateProfileId"); } } @@ -4191,28 +3953,25 @@ public string ValidateProfileId /// [FhirElement("value", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The value to compare to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -4222,13 +3981,13 @@ public string Value /// [FhirElement("warningOnly", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement + public Hl7.Fhir.Model.FhirBoolean? WarningOnlyElement { get { return _WarningOnlyElement; } set { _WarningOnlyElement = value; OnPropertyChanged("WarningOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WarningOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _WarningOnlyElement; /// /// Will this assert produce a warning only on error? @@ -4237,51 +3996,44 @@ public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement [IgnoreDataMember] public bool? WarningOnly { - get { return WarningOnlyElement != null ? WarningOnlyElement.Value : null; } + get => _WarningOnlyElement?.Value; set { - if (value == null) - WarningOnlyElement = null; - else - WarningOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + WarningOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WarningOnly"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(DirectionElement != null) dest.DirectionElement = (Code)DirectionElement.DeepCopyInternal(); - if(CompareToSourceIdElement != null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)CompareToSourceIdElement.DeepCopyInternal(); - if(CompareToSourceExpressionElement != null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)CompareToSourceExpressionElement.DeepCopyInternal(); - if(CompareToSourcePathElement != null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)CompareToSourcePathElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Code)ContentTypeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(MinimumIdElement != null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)MinimumIdElement.DeepCopyInternal(); - if(NavigationLinksElement != null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)NavigationLinksElement.DeepCopyInternal(); - if(OperatorElement != null) dest.OperatorElement = (Code)OperatorElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(RequestMethodElement != null) dest.RequestMethodElement = (Code)RequestMethodElement.DeepCopyInternal(); - if(RequestURLElement != null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)RequestURLElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Code)ResourceElement.DeepCopyInternal(); - if(ResponseElement != null) dest.ResponseElement = (Code)ResponseElement.DeepCopyInternal(); - if(ResponseCodeElement != null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)ResponseCodeElement.DeepCopyInternal(); - if(Rule != null) dest.Rule = (Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent)Rule.DeepCopyInternal(); - if(Ruleset != null) dest.Ruleset = (Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent)Ruleset.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(ValidateProfileIdElement != null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)ValidateProfileIdElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(WarningOnlyElement != null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)WarningOnlyElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_DirectionElement is not null) dest.DirectionElement = (Code)_DirectionElement.DeepCopyInternal(); + if(_CompareToSourceIdElement is not null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceIdElement.DeepCopyInternal(); + if(_CompareToSourceExpressionElement is not null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceExpressionElement.DeepCopyInternal(); + if(_CompareToSourcePathElement is not null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)_CompareToSourcePathElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Code)_ContentTypeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_MinimumIdElement is not null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)_MinimumIdElement.DeepCopyInternal(); + if(_NavigationLinksElement is not null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)_NavigationLinksElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = (Code)_OperatorElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_RequestMethodElement is not null) dest.RequestMethodElement = (Code)_RequestMethodElement.DeepCopyInternal(); + if(_RequestURLElement is not null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)_RequestURLElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Code)_ResourceElement.DeepCopyInternal(); + if(_ResponseElement is not null) dest.ResponseElement = (Code)_ResponseElement.DeepCopyInternal(); + if(_ResponseCodeElement is not null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)_ResponseCodeElement.DeepCopyInternal(); + if(_Rule is not null) dest.Rule = (Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent)_Rule.DeepCopyInternal(); + if(_Ruleset is not null) dest.Ruleset = (Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent)_Ruleset.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_ValidateProfileIdElement is not null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)_ValidateProfileIdElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_WarningOnlyElement is not null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_WarningOnlyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4293,195 +4045,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(DirectionElement, otherT.DirectionElement)) return false; - if(!comparer.Equals(CompareToSourceIdElement, otherT.CompareToSourceIdElement)) return false; - if(!comparer.Equals(CompareToSourceExpressionElement, otherT.CompareToSourceExpressionElement)) return false; - if(!comparer.Equals(CompareToSourcePathElement, otherT.CompareToSourcePathElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(MinimumIdElement, otherT.MinimumIdElement)) return false; - if(!comparer.Equals(NavigationLinksElement, otherT.NavigationLinksElement)) return false; - if(!comparer.Equals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(RequestMethodElement, otherT.RequestMethodElement)) return false; - if(!comparer.Equals(RequestURLElement, otherT.RequestURLElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(ResponseElement, otherT.ResponseElement)) return false; - if(!comparer.Equals(ResponseCodeElement, otherT.ResponseCodeElement)) return false; - if(!comparer.Equals(Rule, otherT.Rule)) return false; - if(!comparer.Equals(Ruleset, otherT.Ruleset)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(ValidateProfileIdElement, otherT.ValidateProfileIdElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(WarningOnlyElement, otherT.WarningOnlyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; + if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; + if(!comparer.Equals(_CompareToSourceExpressionElement, otherT._CompareToSourceExpressionElement)) return false; + if(!comparer.Equals(_CompareToSourcePathElement, otherT._CompareToSourcePathElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_MinimumIdElement, otherT._MinimumIdElement)) return false; + if(!comparer.Equals(_NavigationLinksElement, otherT._NavigationLinksElement)) return false; + if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_RequestMethodElement, otherT._RequestMethodElement)) return false; + if(!comparer.Equals(_RequestURLElement, otherT._RequestURLElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_ResponseElement, otherT._ResponseElement)) return false; + if(!comparer.Equals(_ResponseCodeElement, otherT._ResponseCodeElement)) return false; + if(!comparer.Equals(_Rule, otherT._Rule)) return false; + if(!comparer.Equals(_Ruleset, otherT._Ruleset)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_ValidateProfileIdElement, otherT._ValidateProfileIdElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "direction": - value = DirectionElement; - return DirectionElement is not null; + value = _DirectionElement; + return _DirectionElement is not null; case "compareToSourceId": - value = CompareToSourceIdElement; - return CompareToSourceIdElement is not null; + value = _CompareToSourceIdElement; + return _CompareToSourceIdElement is not null; case "compareToSourceExpression": - value = CompareToSourceExpressionElement; - return CompareToSourceExpressionElement is not null; + value = _CompareToSourceExpressionElement; + return _CompareToSourceExpressionElement is not null; case "compareToSourcePath": - value = CompareToSourcePathElement; - return CompareToSourcePathElement is not null; + value = _CompareToSourcePathElement; + return _CompareToSourcePathElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "minimumId": - value = MinimumIdElement; - return MinimumIdElement is not null; + value = _MinimumIdElement; + return _MinimumIdElement is not null; case "navigationLinks": - value = NavigationLinksElement; - return NavigationLinksElement is not null; + value = _NavigationLinksElement; + return _NavigationLinksElement is not null; case "operator": - value = OperatorElement; - return OperatorElement is not null; + value = _OperatorElement; + return _OperatorElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "requestMethod": - value = RequestMethodElement; - return RequestMethodElement is not null; + value = _RequestMethodElement; + return _RequestMethodElement is not null; case "requestURL": - value = RequestURLElement; - return RequestURLElement is not null; + value = _RequestURLElement; + return _RequestURLElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "response": - value = ResponseElement; - return ResponseElement is not null; + value = _ResponseElement; + return _ResponseElement is not null; case "responseCode": - value = ResponseCodeElement; - return ResponseCodeElement is not null; + value = _ResponseCodeElement; + return _ResponseCodeElement is not null; case "rule": - value = Rule; - return Rule is not null; + value = _Rule; + return _Rule is not null; case "ruleset": - value = Ruleset; - return Ruleset is not null; + value = _Ruleset; + return _Ruleset is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "validateProfileId": - value = ValidateProfileIdElement; - return ValidateProfileIdElement is not null; + value = _ValidateProfileIdElement; + return _ValidateProfileIdElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "warningOnly": - value = WarningOnlyElement; - return WarningOnlyElement is not null; + value = _WarningOnlyElement; + return _WarningOnlyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "direction": - DirectionElement = (Code)value; + DirectionElement = (Code?)value; return this; case "compareToSourceId": - CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourceExpression": - CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourcePath": - CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contentType": - ContentTypeElement = (Code)value; + ContentTypeElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "minimumId": - MinimumIdElement = (Hl7.Fhir.Model.FhirString)value; + MinimumIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "navigationLinks": - NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)value; + NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "operator": - OperatorElement = (Code)value; + OperatorElement = (Code?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestMethod": - RequestMethodElement = (Code)value; + RequestMethodElement = (Code?)value; return this; case "requestURL": - RequestURLElement = (Hl7.Fhir.Model.FhirString)value; + RequestURLElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resource": - ResourceElement = (Code)value; + ResourceElement = (Code?)value; return this; case "response": - ResponseElement = (Code)value; + ResponseElement = (Code?)value; return this; case "responseCode": - ResponseCodeElement = (Hl7.Fhir.Model.FhirString)value; + ResponseCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rule": - Rule = (Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent)value; + Rule = (Hl7.Fhir.Model.TestScript.ActionAssertRuleComponent?)value; return this; case "ruleset": - Ruleset = (Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent)value; + Ruleset = (Hl7.Fhir.Model.TestScript.ActionAssertRulesetComponent?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "validateProfileId": - ValidateProfileIdElement = (Hl7.Fhir.Model.Id)value; + ValidateProfileIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "warningOnly": - WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -4492,30 +4244,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (DirectionElement is not null) yield return new KeyValuePair("direction",DirectionElement); - if (CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",CompareToSourceIdElement); - if (CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",CompareToSourceExpressionElement); - if (CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",CompareToSourcePathElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (MinimumIdElement is not null) yield return new KeyValuePair("minimumId",MinimumIdElement); - if (NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",NavigationLinksElement); - if (OperatorElement is not null) yield return new KeyValuePair("operator",OperatorElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",RequestMethodElement); - if (RequestURLElement is not null) yield return new KeyValuePair("requestURL",RequestURLElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (ResponseElement is not null) yield return new KeyValuePair("response",ResponseElement); - if (ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",ResponseCodeElement); - if (Rule is not null) yield return new KeyValuePair("rule",Rule); - if (Ruleset is not null) yield return new KeyValuePair("ruleset",Ruleset); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",ValidateProfileIdElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",WarningOnlyElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_DirectionElement is not null) yield return new KeyValuePair("direction",_DirectionElement); + if (_CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",_CompareToSourceIdElement); + if (_CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",_CompareToSourceExpressionElement); + if (_CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",_CompareToSourcePathElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_MinimumIdElement is not null) yield return new KeyValuePair("minimumId",_MinimumIdElement); + if (_NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",_NavigationLinksElement); + if (_OperatorElement is not null) yield return new KeyValuePair("operator",_OperatorElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",_RequestMethodElement); + if (_RequestURLElement is not null) yield return new KeyValuePair("requestURL",_RequestURLElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_ResponseElement is not null) yield return new KeyValuePair("response",_ResponseElement); + if (_ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",_ResponseCodeElement); + if (_Rule is not null) yield return new KeyValuePair("rule",_Rule); + if (_Ruleset is not null) yield return new KeyValuePair("ruleset",_Ruleset); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",_ValidateProfileIdElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",_WarningOnlyElement); } } @@ -4543,28 +4295,25 @@ public partial class ActionAssertRuleComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("ruleId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id RuleIdElement + public Hl7.Fhir.Model.Id? RuleIdElement { get { return _RuleIdElement; } set { _RuleIdElement = value; OnPropertyChanged("RuleIdElement"); } } - private Hl7.Fhir.Model.Id _RuleIdElement; + private Hl7.Fhir.Model.Id? _RuleIdElement; /// /// Id of the TestScript.rule /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RuleId + public string? RuleId { - get { return RuleIdElement != null ? RuleIdElement.Value : null; } + get => _RuleIdElement?.Value; set { - if (value == null) - RuleIdElement = null; - else - RuleIdElement = new Hl7.Fhir.Model.Id(value); + RuleIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RuleId"); } } @@ -4577,24 +4326,20 @@ public string RuleId [DataMember] public List Param { - get { if(_Param==null) _Param = new List(); return _Param; } + get => _Param ?? new List(); set { _Param = value; OnPropertyChanged("Param"); } } - private List _Param; + private List? _Param; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionAssertRuleComponent; - - if (dest == null) - { + if(other is not ActionAssertRuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RuleIdElement != null) dest.RuleIdElement = (Hl7.Fhir.Model.Id)RuleIdElement.DeepCopyInternal(); - if(Param.Any()) dest.Param = new List(Param.DeepCopyInternal()); + if(_RuleIdElement is not null) dest.RuleIdElement = (Hl7.Fhir.Model.Id)_RuleIdElement.DeepCopyInternal(); + if(_Param is not null) dest.Param = new List(_Param.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4606,41 +4351,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionAssertRuleComponent; - if(otherT == null) return false; + if(other is not ActionAssertRuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RuleIdElement, otherT.RuleIdElement)) return false; - if(!comparer.ListEquals(Param, otherT.Param)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; + if(!comparer.ListEquals(_Param, otherT._Param)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "ruleId": - value = RuleIdElement; - return RuleIdElement is not null; + value = _RuleIdElement; + return _RuleIdElement is not null; case "param": - value = Param; - return Param?.Any() == true; + value = _Param; + return _Param?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "ruleId": - RuleIdElement = (Hl7.Fhir.Model.Id)value; + RuleIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "param": - Param = (List)value; + Param = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4651,8 +4396,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RuleIdElement is not null) yield return new KeyValuePair("ruleId",RuleIdElement); - if (Param?.Any() == true) yield return new KeyValuePair("param",Param); + if (_RuleIdElement is not null) yield return new KeyValuePair("ruleId",_RuleIdElement); + if (_Param?.Any() == true) yield return new KeyValuePair("param",_Param); } } @@ -4680,28 +4425,25 @@ public partial class ActionAssertRuleParamComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Parameter name matching external assert rule parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4712,44 +4454,37 @@ public string Name [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Parameter value defined either explicitly or dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ActionAssertRuleParamComponent; - - if (dest == null) - { + if(other is not ActionAssertRuleParamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4761,41 +4496,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionAssertRuleParamComponent; - if(otherT == null) return false; + if(other is not ActionAssertRuleParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -4806,8 +4541,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -4835,28 +4570,25 @@ public partial class ActionAssertRulesetComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("rulesetId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id RulesetIdElement + public Hl7.Fhir.Model.Id? RulesetIdElement { get { return _RulesetIdElement; } set { _RulesetIdElement = value; OnPropertyChanged("RulesetIdElement"); } } - private Hl7.Fhir.Model.Id _RulesetIdElement; + private Hl7.Fhir.Model.Id? _RulesetIdElement; /// /// Id of the TestScript.ruleset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RulesetId + public string? RulesetId { - get { return RulesetIdElement != null ? RulesetIdElement.Value : null; } + get => _RulesetIdElement?.Value; set { - if (value == null) - RulesetIdElement = null; - else - RulesetIdElement = new Hl7.Fhir.Model.Id(value); + RulesetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RulesetId"); } } @@ -4869,24 +4601,20 @@ public string RulesetId [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionAssertRulesetComponent; - - if (dest == null) - { + if(other is not ActionAssertRulesetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RulesetIdElement != null) dest.RulesetIdElement = (Hl7.Fhir.Model.Id)RulesetIdElement.DeepCopyInternal(); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_RulesetIdElement is not null) dest.RulesetIdElement = (Hl7.Fhir.Model.Id)_RulesetIdElement.DeepCopyInternal(); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4898,41 +4626,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionAssertRulesetComponent; - if(otherT == null) return false; + if(other is not ActionAssertRulesetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RulesetIdElement, otherT.RulesetIdElement)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RulesetIdElement, otherT._RulesetIdElement)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "rulesetId": - value = RulesetIdElement; - return RulesetIdElement is not null; + value = _RulesetIdElement; + return _RulesetIdElement is not null; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "rulesetId": - RulesetIdElement = (Hl7.Fhir.Model.Id)value; + RulesetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4943,8 +4671,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RulesetIdElement is not null) yield return new KeyValuePair("rulesetId",RulesetIdElement); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_RulesetIdElement is not null) yield return new KeyValuePair("rulesetId",_RulesetIdElement); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } @@ -4972,28 +4700,25 @@ public partial class ActionAssertRulesetRuleComponent : Hl7.Fhir.Model.BackboneE [FhirElement("ruleId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id RuleIdElement + public Hl7.Fhir.Model.Id? RuleIdElement { get { return _RuleIdElement; } set { _RuleIdElement = value; OnPropertyChanged("RuleIdElement"); } } - private Hl7.Fhir.Model.Id _RuleIdElement; + private Hl7.Fhir.Model.Id? _RuleIdElement; /// /// Id of referenced rule within the ruleset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RuleId + public string? RuleId { - get { return RuleIdElement != null ? RuleIdElement.Value : null; } + get => _RuleIdElement?.Value; set { - if (value == null) - RuleIdElement = null; - else - RuleIdElement = new Hl7.Fhir.Model.Id(value); + RuleIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RuleId"); } } @@ -5006,24 +4731,20 @@ public string RuleId [DataMember] public List Param { - get { if(_Param==null) _Param = new List(); return _Param; } + get => _Param ?? new List(); set { _Param = value; OnPropertyChanged("Param"); } } - private List _Param; + private List? _Param; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionAssertRulesetRuleComponent; - - if (dest == null) - { + if(other is not ActionAssertRulesetRuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RuleIdElement != null) dest.RuleIdElement = (Hl7.Fhir.Model.Id)RuleIdElement.DeepCopyInternal(); - if(Param.Any()) dest.Param = new List(Param.DeepCopyInternal()); + if(_RuleIdElement is not null) dest.RuleIdElement = (Hl7.Fhir.Model.Id)_RuleIdElement.DeepCopyInternal(); + if(_Param is not null) dest.Param = new List(_Param.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5035,41 +4756,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionAssertRulesetRuleComponent; - if(otherT == null) return false; + if(other is not ActionAssertRulesetRuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RuleIdElement, otherT.RuleIdElement)) return false; - if(!comparer.ListEquals(Param, otherT.Param)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; + if(!comparer.ListEquals(_Param, otherT._Param)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "ruleId": - value = RuleIdElement; - return RuleIdElement is not null; + value = _RuleIdElement; + return _RuleIdElement is not null; case "param": - value = Param; - return Param?.Any() == true; + value = _Param; + return _Param?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "ruleId": - RuleIdElement = (Hl7.Fhir.Model.Id)value; + RuleIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "param": - Param = (List)value; + Param = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5080,8 +4801,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RuleIdElement is not null) yield return new KeyValuePair("ruleId",RuleIdElement); - if (Param?.Any() == true) yield return new KeyValuePair("param",Param); + if (_RuleIdElement is not null) yield return new KeyValuePair("ruleId",_RuleIdElement); + if (_Param?.Any() == true) yield return new KeyValuePair("param",_Param); } } @@ -5109,28 +4830,25 @@ public partial class ParamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Parameter name matching external assert ruleset rule parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -5141,44 +4859,37 @@ public string Name [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Parameter value defined either explicitly or dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParamComponent; - - if (dest == null) - { + if(other is not ParamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5190,41 +4901,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParamComponent; - if(otherT == null) return false; + if(other is not ParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -5235,8 +4946,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -5259,28 +4970,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -5290,28 +4998,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -5324,25 +5029,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5354,48 +5055,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5406,9 +5107,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -5435,39 +5136,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The setup assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5479,41 +5176,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -5524,8 +5221,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -5554,23 +5251,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5582,34 +5275,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5620,7 +5313,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -5648,25 +5341,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5678,34 +5367,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -5716,7 +5405,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -5727,28 +5416,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this test script (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -5758,41 +5444,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the test script. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -5803,28 +5486,25 @@ public string Version [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this test script (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -5834,28 +5514,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this test script (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -5868,13 +5545,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -5883,13 +5560,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -5899,13 +5573,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -5914,13 +5588,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -5930,28 +5601,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -5961,28 +5629,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -5995,39 +5660,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the test script. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -6040,11 +5702,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for test script (if applicable). @@ -6055,39 +5717,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this test script is defined. /// [FhirElement("purpose", Order=220, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this test script is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -6097,28 +5756,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -6131,11 +5787,11 @@ public string Copyright [DataMember] public List Origin { - get { if(_Origin==null) _Origin = new List(); return _Origin; } + get => _Origin ?? new List(); set { _Origin = value; OnPropertyChanged("Origin"); } } - private List _Origin; + private List? _Origin; /// /// An abstract server representing a destination or receiver in a message exchange. @@ -6145,24 +5801,24 @@ public List Origin [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Required capability that is assumed to function correctly on the FHIR server being tested. /// [FhirElement("metadata", Order=260)] [DataMember] - public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata + public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata { get { return _Metadata; } set { _Metadata = value; OnPropertyChanged("Metadata"); } } - private Hl7.Fhir.Model.TestScript.MetadataComponent _Metadata; + private Hl7.Fhir.Model.TestScript.MetadataComponent? _Metadata; /// /// Fixture in the test script - by reference (uri). @@ -6172,11 +5828,11 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata [DataMember] public List Fixture { - get { if(_Fixture==null) _Fixture = new List(); return _Fixture; } + get => _Fixture ?? new List(); set { _Fixture = value; OnPropertyChanged("Fixture"); } } - private List _Fixture; + private List? _Fixture; /// /// Reference of the validation profile. @@ -6188,11 +5844,11 @@ public List Fixture [DataMember] public List Profile { - get { if(_Profile==null) _Profile = new List(); return _Profile; } + get => _Profile ?? new List(); set { _Profile = value; OnPropertyChanged("Profile"); } } - private List _Profile; + private List? _Profile; /// /// Placeholder for evaluated elements. @@ -6202,11 +5858,11 @@ public List Profile [DataMember] public List Variable { - get { if(_Variable==null) _Variable = new List(); return _Variable; } + get => _Variable ?? new List(); set { _Variable = value; OnPropertyChanged("Variable"); } } - private List _Variable; + private List? _Variable; /// /// Assert rule used within the test script. @@ -6216,11 +5872,11 @@ public List Variable [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Assert ruleset used within the test script. @@ -6230,24 +5886,24 @@ public List Rule [DataMember] public List Ruleset { - get { if(_Ruleset==null) _Ruleset = new List(); return _Ruleset; } + get => _Ruleset ?? new List(); set { _Ruleset = value; OnPropertyChanged("Ruleset"); } } - private List _Ruleset; + private List? _Ruleset; /// /// A series of required setup operations before tests are executed. /// [FhirElement("setup", Order=320)] [DataMember] - public Hl7.Fhir.Model.TestScript.SetupComponent Setup + public Hl7.Fhir.Model.TestScript.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestScript.SetupComponent _Setup; + private Hl7.Fhir.Model.TestScript.SetupComponent? _Setup; /// /// A test in this script. @@ -6257,63 +5913,59 @@ public Hl7.Fhir.Model.TestScript.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// A series of required clean up steps. /// [FhirElement("teardown", Order=340)] [DataMember] - public Hl7.Fhir.Model.TestScript.TeardownComponent Teardown + public Hl7.Fhir.Model.TestScript.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestScript.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestScript.TeardownComponent? _Teardown; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestScript; - - if (dest == null) - { + if(other is not TestScript dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Origin.Any()) dest.Origin = new List(Origin.DeepCopyInternal()); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Metadata != null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)Metadata.DeepCopyInternal(); - if(Fixture.Any()) dest.Fixture = new List(Fixture.DeepCopyInternal()); - if(Profile.Any()) dest.Profile = new List(Profile.DeepCopyInternal()); - if(Variable.Any()) dest.Variable = new List(Variable.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(Ruleset.Any()) dest.Ruleset = new List(Ruleset.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)Teardown.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = new List(_Origin.DeepCopyInternal()); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Metadata is not null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)_Metadata.DeepCopyInternal(); + if(_Fixture is not null) dest.Fixture = new List(_Fixture.DeepCopyInternal()); + if(_Profile is not null) dest.Profile = new List(_Profile.DeepCopyInternal()); + if(_Variable is not null) dest.Variable = new List(_Variable.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_Ruleset is not null) dest.Ruleset = new List(_Ruleset.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -6325,209 +5977,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestScript; - if(otherT == null) return false; + if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Origin, otherT.Origin)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Metadata, otherT.Metadata)) return false; - if(!comparer.ListEquals(Fixture, otherT.Fixture)) return false; - if(!comparer.ListEquals(Profile, otherT.Profile)) return false; - if(!comparer.ListEquals(Variable, otherT.Variable)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.ListEquals(Ruleset, otherT.Ruleset)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Origin, otherT._Origin)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Metadata, otherT._Metadata)) return false; + if(!comparer.ListEquals(_Fixture, otherT._Fixture)) return false; + if(!comparer.ListEquals(_Profile, otherT._Profile)) return false; + if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.ListEquals(_Ruleset, otherT._Ruleset)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "origin": - value = Origin; - return Origin?.Any() == true; + value = _Origin; + return _Origin?.Any() == true; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "metadata": - value = Metadata; - return Metadata is not null; + value = _Metadata; + return _Metadata is not null; case "fixture": - value = Fixture; - return Fixture?.Any() == true; + value = _Fixture; + return _Fixture?.Any() == true; case "profile": - value = Profile; - return Profile?.Any() == true; + value = _Profile; + return _Profile?.Any() == true; case "variable": - value = Variable; - return Variable?.Any() == true; + value = _Variable; + return _Variable?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "ruleset": - value = Ruleset; - return Ruleset?.Any() == true; + value = _Ruleset; + return _Ruleset?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "origin": - Origin = (List)value; + Origin = (List?)value!; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "metadata": - Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)value; + Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent?)value; return this; case "fixture": - Fixture = (List)value; + Fixture = (List?)value!; return this; case "profile": - Profile = (List)value; + Profile = (List?)value!; return this; case "variable": - Variable = (List)value; + Variable = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "ruleset": - Ruleset = (List)value; + Ruleset = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestScript.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -6538,32 +6190,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Origin?.Any() == true) yield return new KeyValuePair("origin",Origin); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Metadata is not null) yield return new KeyValuePair("metadata",Metadata); - if (Fixture?.Any() == true) yield return new KeyValuePair("fixture",Fixture); - if (Profile?.Any() == true) yield return new KeyValuePair("profile",Profile); - if (Variable?.Any() == true) yield return new KeyValuePair("variable",Variable); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (Ruleset?.Any() == true) yield return new KeyValuePair("ruleset",Ruleset); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Origin?.Any() == true) yield return new KeyValuePair("origin",_Origin); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Metadata is not null) yield return new KeyValuePair("metadata",_Metadata); + if (_Fixture?.Any() == true) yield return new KeyValuePair("fixture",_Fixture); + if (_Profile?.Any() == true) yield return new KeyValuePair("profile",_Profile); + if (_Variable?.Any() == true) yield return new KeyValuePair("variable",_Variable); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_Ruleset?.Any() == true) yield return new KeyValuePair("ruleset",_Ruleset); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs index 7990bc126..30155b1b2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -263,26 +266,26 @@ public partial class RepeatComponent : Hl7.Fhir.Model.Element [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Bounds + public Hl7.Fhir.Model.DataType? Bounds { get { return _Bounds; } set { _Bounds = value; OnPropertyChanged("Bounds"); } } - private Hl7.Fhir.Model.DataType _Bounds; + private Hl7.Fhir.Model.DataType? _Bounds; /// /// Number of times to repeat. /// [FhirElement("count", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Number of times to repeat @@ -291,13 +294,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -307,13 +307,13 @@ public int? Count /// [FhirElement("countMax", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer CountMaxElement + public Hl7.Fhir.Model.Integer? CountMaxElement { get { return _CountMaxElement; } set { _CountMaxElement = value; OnPropertyChanged("CountMaxElement"); } } - private Hl7.Fhir.Model.Integer _CountMaxElement; + private Hl7.Fhir.Model.Integer? _CountMaxElement; /// /// Maximum number of times to repeat @@ -322,13 +322,10 @@ public Hl7.Fhir.Model.Integer CountMaxElement [IgnoreDataMember] public int? CountMax { - get { return CountMaxElement != null ? CountMaxElement.Value : null; } + get => _CountMaxElement?.Value; set { - if (value == null) - CountMaxElement = null; - else - CountMaxElement = new Hl7.Fhir.Model.Integer(value); + CountMaxElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("CountMax"); } } @@ -338,13 +335,13 @@ public int? CountMax /// [FhirElement("duration", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationElement + public Hl7.Fhir.Model.FhirDecimal? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationElement; /// /// How long when it happens @@ -353,13 +350,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement [IgnoreDataMember] public decimal? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Duration"); } } @@ -369,13 +363,13 @@ public decimal? Duration /// [FhirElement("durationMax", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationMaxElement + public Hl7.Fhir.Model.FhirDecimal? DurationMaxElement { get { return _DurationMaxElement; } set { _DurationMaxElement = value; OnPropertyChanged("DurationMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationMaxElement; /// /// How long when it happens (Max) @@ -384,13 +378,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationMaxElement [IgnoreDataMember] public decimal? DurationMax { - get { return DurationMaxElement != null ? DurationMaxElement.Value : null; } + get => _DurationMaxElement?.Value; set { - if (value == null) - DurationMaxElement = null; - else - DurationMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("DurationMax"); } } @@ -402,13 +393,13 @@ public decimal? DurationMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code DurationUnitElement + public Code? DurationUnitElement { get { return _DurationUnitElement; } set { _DurationUnitElement = value; OnPropertyChanged("DurationUnitElement"); } } - private Code _DurationUnitElement; + private Code? _DurationUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -417,13 +408,10 @@ public Code DurationUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit { - get { return DurationUnitElement != null ? DurationUnitElement.Value : null; } + get => _DurationUnitElement?.Value; set { - if (value == null) - DurationUnitElement = null; - else - DurationUnitElement = new Code(value); + DurationUnitElement = value is null ? null : new Code(value); OnPropertyChanged("DurationUnit"); } } @@ -433,13 +421,13 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit /// [FhirElement("frequency", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Integer FrequencyElement + public Hl7.Fhir.Model.Integer? FrequencyElement { get { return _FrequencyElement; } set { _FrequencyElement = value; OnPropertyChanged("FrequencyElement"); } } - private Hl7.Fhir.Model.Integer _FrequencyElement; + private Hl7.Fhir.Model.Integer? _FrequencyElement; /// /// Event occurs frequency times per period @@ -448,13 +436,10 @@ public Hl7.Fhir.Model.Integer FrequencyElement [IgnoreDataMember] public int? Frequency { - get { return FrequencyElement != null ? FrequencyElement.Value : null; } + get => _FrequencyElement?.Value; set { - if (value == null) - FrequencyElement = null; - else - FrequencyElement = new Hl7.Fhir.Model.Integer(value); + FrequencyElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Frequency"); } } @@ -464,13 +449,13 @@ public int? Frequency /// [FhirElement("frequencyMax", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer FrequencyMaxElement + public Hl7.Fhir.Model.Integer? FrequencyMaxElement { get { return _FrequencyMaxElement; } set { _FrequencyMaxElement = value; OnPropertyChanged("FrequencyMaxElement"); } } - private Hl7.Fhir.Model.Integer _FrequencyMaxElement; + private Hl7.Fhir.Model.Integer? _FrequencyMaxElement; /// /// Event occurs up to frequencyMax times per period @@ -479,13 +464,10 @@ public Hl7.Fhir.Model.Integer FrequencyMaxElement [IgnoreDataMember] public int? FrequencyMax { - get { return FrequencyMaxElement != null ? FrequencyMaxElement.Value : null; } + get => _FrequencyMaxElement?.Value; set { - if (value == null) - FrequencyMaxElement = null; - else - FrequencyMaxElement = new Hl7.Fhir.Model.Integer(value); + FrequencyMaxElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("FrequencyMax"); } } @@ -495,13 +477,13 @@ public int? FrequencyMax /// [FhirElement("period", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodElement + public Hl7.Fhir.Model.FhirDecimal? PeriodElement { get { return _PeriodElement; } set { _PeriodElement = value; OnPropertyChanged("PeriodElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodElement; /// /// Event occurs frequency times per period @@ -510,13 +492,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodElement [IgnoreDataMember] public decimal? Period { - get { return PeriodElement != null ? PeriodElement.Value : null; } + get => _PeriodElement?.Value; set { - if (value == null) - PeriodElement = null; - else - PeriodElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Period"); } } @@ -526,13 +505,13 @@ public decimal? Period /// [FhirElement("periodMax", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement + public Hl7.Fhir.Model.FhirDecimal? PeriodMaxElement { get { return _PeriodMaxElement; } set { _PeriodMaxElement = value; OnPropertyChanged("PeriodMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodMaxElement; /// /// Upper limit of period (3-4 hours) @@ -541,13 +520,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement [IgnoreDataMember] public decimal? PeriodMax { - get { return PeriodMaxElement != null ? PeriodMaxElement.Value : null; } + get => _PeriodMaxElement?.Value; set { - if (value == null) - PeriodMaxElement = null; - else - PeriodMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("PeriodMax"); } } @@ -559,13 +535,13 @@ public decimal? PeriodMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code PeriodUnitElement + public Code? PeriodUnitElement { get { return _PeriodUnitElement; } set { _PeriodUnitElement = value; OnPropertyChanged("PeriodUnitElement"); } } - private Code _PeriodUnitElement; + private Code? _PeriodUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -574,13 +550,10 @@ public Code PeriodUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit { - get { return PeriodUnitElement != null ? PeriodUnitElement.Value : null; } + get => _PeriodUnitElement?.Value; set { - if (value == null) - PeriodUnitElement = null; - else - PeriodUnitElement = new Code(value); + PeriodUnitElement = value is null ? null : new Code(value); OnPropertyChanged("PeriodUnit"); } } @@ -595,24 +568,24 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get { if(_DayOfWeekElement==null) _DayOfWeekElement = new List>(); return _DayOfWeekElement; } + get => _DayOfWeekElement ?? new List>(); set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } - private List> _DayOfWeekElement; + private List>? _DayOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DayOfWeek + public IEnumerable? DayOfWeek { - get { return DayOfWeekElement != null ? DayOfWeekElement.Select(elem => elem.Value) : null; } + get => _DayOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DayOfWeekElement = null; + DayOfWeekElement = null!; else DayOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DayOfWeek"); @@ -627,24 +600,24 @@ public IEnumerable DayOfWeek [DataMember] public List TimeOfDayElement { - get { if(_TimeOfDayElement==null) _TimeOfDayElement = new List(); return _TimeOfDayElement; } + get => _TimeOfDayElement ?? new List(); set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } - private List _TimeOfDayElement; + private List? _TimeOfDayElement; /// /// Time of day for action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TimeOfDay + public IEnumerable? TimeOfDay { - get { return TimeOfDayElement != null ? TimeOfDayElement.Select(elem => elem.Value) : null; } + get => _TimeOfDayElement?.Select(elem => elem.Value); set { if (value == null) - TimeOfDayElement = null; + TimeOfDayElement = null!; else TimeOfDayElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Time(elem))); OnPropertyChanged("TimeOfDay"); @@ -661,24 +634,24 @@ public IEnumerable TimeOfDay [DataMember] public List> WhenElement { - get { if(_WhenElement==null) _WhenElement = new List>(); return _WhenElement; } + get => _WhenElement ?? new List>(); set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } - private List> _WhenElement; + private List>? _WhenElement; /// /// Regular life events the event is tied to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable When + public IEnumerable? When { - get { return WhenElement != null ? WhenElement.Select(elem => elem.Value) : null; } + get => _WhenElement?.Select(elem => elem.Value); set { if (value == null) - WhenElement = null; + WhenElement = null!; else WhenElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("When"); @@ -690,13 +663,13 @@ public IEnumerable When /// [FhirElement("offset", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt OffsetElement + public Hl7.Fhir.Model.UnsignedInt? OffsetElement { get { return _OffsetElement; } set { _OffsetElement = value; OnPropertyChanged("OffsetElement"); } } - private Hl7.Fhir.Model.UnsignedInt _OffsetElement; + private Hl7.Fhir.Model.UnsignedInt? _OffsetElement; /// /// Minutes from event (before or after) @@ -705,42 +678,35 @@ public Hl7.Fhir.Model.UnsignedInt OffsetElement [IgnoreDataMember] public int? Offset { - get { return OffsetElement != null ? OffsetElement.Value : null; } + get => _OffsetElement?.Value; set { - if (value == null) - OffsetElement = null; - else - OffsetElement = new Hl7.Fhir.Model.UnsignedInt(value); + OffsetElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Offset"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatComponent; - - if (dest == null) - { + if(other is not RepeatComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Bounds != null) dest.Bounds = (Hl7.Fhir.Model.DataType)Bounds.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(CountMaxElement != null) dest.CountMaxElement = (Hl7.Fhir.Model.Integer)CountMaxElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal(); - if(DurationMaxElement != null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)DurationMaxElement.DeepCopyInternal(); - if(DurationUnitElement != null) dest.DurationUnitElement = (Code)DurationUnitElement.DeepCopyInternal(); - if(FrequencyElement != null) dest.FrequencyElement = (Hl7.Fhir.Model.Integer)FrequencyElement.DeepCopyInternal(); - if(FrequencyMaxElement != null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.Integer)FrequencyMaxElement.DeepCopyInternal(); - if(PeriodElement != null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)PeriodElement.DeepCopyInternal(); - if(PeriodMaxElement != null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)PeriodMaxElement.DeepCopyInternal(); - if(PeriodUnitElement != null) dest.PeriodUnitElement = (Code)PeriodUnitElement.DeepCopyInternal(); - if(DayOfWeekElement.Any()) dest.DayOfWeekElement = new List>(DayOfWeekElement.DeepCopyInternal()); - if(TimeOfDayElement.Any()) dest.TimeOfDayElement = new List(TimeOfDayElement.DeepCopyInternal()); - if(WhenElement.Any()) dest.WhenElement = new List>(WhenElement.DeepCopyInternal()); - if(OffsetElement != null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)OffsetElement.DeepCopyInternal(); + if(_Bounds is not null) dest.Bounds = (Hl7.Fhir.Model.DataType)_Bounds.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_CountMaxElement is not null) dest.CountMaxElement = (Hl7.Fhir.Model.Integer)_CountMaxElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal(); + if(_DurationMaxElement is not null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)_DurationMaxElement.DeepCopyInternal(); + if(_DurationUnitElement is not null) dest.DurationUnitElement = (Code)_DurationUnitElement.DeepCopyInternal(); + if(_FrequencyElement is not null) dest.FrequencyElement = (Hl7.Fhir.Model.Integer)_FrequencyElement.DeepCopyInternal(); + if(_FrequencyMaxElement is not null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.Integer)_FrequencyMaxElement.DeepCopyInternal(); + if(_PeriodElement is not null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodElement.DeepCopyInternal(); + if(_PeriodMaxElement is not null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodMaxElement.DeepCopyInternal(); + if(_PeriodUnitElement is not null) dest.PeriodUnitElement = (Code)_PeriodUnitElement.DeepCopyInternal(); + if(_DayOfWeekElement is not null) dest.DayOfWeekElement = new List>(_DayOfWeekElement.DeepCopyInternal()); + if(_TimeOfDayElement is not null) dest.TimeOfDayElement = new List(_TimeOfDayElement.DeepCopyInternal()); + if(_WhenElement is not null) dest.WhenElement = new List>(_WhenElement.DeepCopyInternal()); + if(_OffsetElement is not null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)_OffsetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -752,132 +718,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatComponent; - if(otherT == null) return false; + if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Bounds, otherT.Bounds)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(CountMaxElement, otherT.CountMaxElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(DurationMaxElement, otherT.DurationMaxElement)) return false; - if(!comparer.Equals(DurationUnitElement, otherT.DurationUnitElement)) return false; - if(!comparer.Equals(FrequencyElement, otherT.FrequencyElement)) return false; - if(!comparer.Equals(FrequencyMaxElement, otherT.FrequencyMaxElement)) return false; - if(!comparer.Equals(PeriodElement, otherT.PeriodElement)) return false; - if(!comparer.Equals(PeriodMaxElement, otherT.PeriodMaxElement)) return false; - if(!comparer.Equals(PeriodUnitElement, otherT.PeriodUnitElement)) return false; - if(!comparer.ListEquals(DayOfWeekElement, otherT.DayOfWeekElement)) return false; - if(!comparer.ListEquals(TimeOfDayElement, otherT.TimeOfDayElement)) return false; - if(!comparer.ListEquals(WhenElement, otherT.WhenElement)) return false; - if(!comparer.Equals(OffsetElement, otherT.OffsetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_DurationMaxElement, otherT._DurationMaxElement)) return false; + if(!comparer.Equals(_DurationUnitElement, otherT._DurationUnitElement)) return false; + if(!comparer.Equals(_FrequencyElement, otherT._FrequencyElement)) return false; + if(!comparer.Equals(_FrequencyMaxElement, otherT._FrequencyMaxElement)) return false; + if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; + if(!comparer.Equals(_PeriodMaxElement, otherT._PeriodMaxElement)) return false; + if(!comparer.Equals(_PeriodUnitElement, otherT._PeriodUnitElement)) return false; + if(!comparer.ListEquals(_DayOfWeekElement, otherT._DayOfWeekElement)) return false; + if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; + if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; + if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "bounds": - value = Bounds; - return Bounds is not null; + value = _Bounds; + return _Bounds is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "countMax": - value = CountMaxElement; - return CountMaxElement is not null; + value = _CountMaxElement; + return _CountMaxElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "durationMax": - value = DurationMaxElement; - return DurationMaxElement is not null; + value = _DurationMaxElement; + return _DurationMaxElement is not null; case "durationUnit": - value = DurationUnitElement; - return DurationUnitElement is not null; + value = _DurationUnitElement; + return _DurationUnitElement is not null; case "frequency": - value = FrequencyElement; - return FrequencyElement is not null; + value = _FrequencyElement; + return _FrequencyElement is not null; case "frequencyMax": - value = FrequencyMaxElement; - return FrequencyMaxElement is not null; + value = _FrequencyMaxElement; + return _FrequencyMaxElement is not null; case "period": - value = PeriodElement; - return PeriodElement is not null; + value = _PeriodElement; + return _PeriodElement is not null; case "periodMax": - value = PeriodMaxElement; - return PeriodMaxElement is not null; + value = _PeriodMaxElement; + return _PeriodMaxElement is not null; case "periodUnit": - value = PeriodUnitElement; - return PeriodUnitElement is not null; + value = _PeriodUnitElement; + return _PeriodUnitElement is not null; case "dayOfWeek": - value = DayOfWeekElement; - return DayOfWeekElement?.Any() == true; + value = _DayOfWeekElement; + return _DayOfWeekElement?.Any() == true; case "timeOfDay": - value = TimeOfDayElement; - return TimeOfDayElement?.Any() == true; + value = _TimeOfDayElement; + return _TimeOfDayElement?.Any() == true; case "when": - value = WhenElement; - return WhenElement?.Any() == true; + value = _WhenElement; + return _WhenElement?.Any() == true; case "offset": - value = OffsetElement; - return OffsetElement is not null; + value = _OffsetElement; + return _OffsetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "bounds": - Bounds = (Hl7.Fhir.Model.DataType)value; + Bounds = (Hl7.Fhir.Model.DataType?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "countMax": - CountMaxElement = (Hl7.Fhir.Model.Integer)value; + CountMaxElement = (Hl7.Fhir.Model.Integer?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationMax": - DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationUnit": - DurationUnitElement = (Code)value; + DurationUnitElement = (Code?)value; return this; case "frequency": - FrequencyElement = (Hl7.Fhir.Model.Integer)value; + FrequencyElement = (Hl7.Fhir.Model.Integer?)value; return this; case "frequencyMax": - FrequencyMaxElement = (Hl7.Fhir.Model.Integer)value; + FrequencyMaxElement = (Hl7.Fhir.Model.Integer?)value; return this; case "period": - PeriodElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodMax": - PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodUnit": - PeriodUnitElement = (Code)value; + PeriodUnitElement = (Code?)value; return this; case "dayOfWeek": - DayOfWeekElement = (List>)value; + DayOfWeekElement = (List>?)value!; return this; case "timeOfDay": - TimeOfDayElement = (List)value; + TimeOfDayElement = (List?)value!; return this; case "when": - WhenElement = (List>)value; + WhenElement = (List>?)value!; return this; case "offset": - OffsetElement = (Hl7.Fhir.Model.UnsignedInt)value; + OffsetElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; default: return base.SetValue(key, value); @@ -888,21 +854,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Bounds is not null) yield return new KeyValuePair("bounds",Bounds); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (CountMaxElement is not null) yield return new KeyValuePair("countMax",CountMaxElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (DurationMaxElement is not null) yield return new KeyValuePair("durationMax",DurationMaxElement); - if (DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",DurationUnitElement); - if (FrequencyElement is not null) yield return new KeyValuePair("frequency",FrequencyElement); - if (FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",FrequencyMaxElement); - if (PeriodElement is not null) yield return new KeyValuePair("period",PeriodElement); - if (PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",PeriodMaxElement); - if (PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",PeriodUnitElement); - if (DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",DayOfWeekElement); - if (TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",TimeOfDayElement); - if (WhenElement?.Any() == true) yield return new KeyValuePair("when",WhenElement); - if (OffsetElement is not null) yield return new KeyValuePair("offset",OffsetElement); + if (_Bounds is not null) yield return new KeyValuePair("bounds",_Bounds); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_CountMaxElement is not null) yield return new KeyValuePair("countMax",_CountMaxElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_DurationMaxElement is not null) yield return new KeyValuePair("durationMax",_DurationMaxElement); + if (_DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",_DurationUnitElement); + if (_FrequencyElement is not null) yield return new KeyValuePair("frequency",_FrequencyElement); + if (_FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",_FrequencyMaxElement); + if (_PeriodElement is not null) yield return new KeyValuePair("period",_PeriodElement); + if (_PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",_PeriodMaxElement); + if (_PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",_PeriodUnitElement); + if (_DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",_DayOfWeekElement); + if (_TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",_TimeOfDayElement); + if (_WhenElement?.Any() == true) yield return new KeyValuePair("when",_WhenElement); + if (_OffsetElement is not null) yield return new KeyValuePair("offset",_OffsetElement); } } @@ -915,24 +881,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get { if(_EventElement==null) _EventElement = new List(); return _EventElement; } + get => _EventElement ?? new List(); set { _EventElement = value; OnPropertyChanged("EventElement"); } } - private List _EventElement; + private List? _EventElement; /// /// When the event occurs /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Event + public IEnumerable? Event { - get { return EventElement != null ? EventElement.Select(elem => elem.Value) : null; } + get => _EventElement?.Select(elem => elem.Value); set { if (value == null) - EventElement = null; + EventElement = null!; else EventElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDateTime(elem))); OnPropertyChanged("Event"); @@ -944,13 +910,13 @@ public IEnumerable Event /// [FhirElement("repeat", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Timing.RepeatComponent Repeat + public Hl7.Fhir.Model.Timing.RepeatComponent? Repeat { get { return _Repeat; } set { _Repeat = value; OnPropertyChanged("Repeat"); } } - private Hl7.Fhir.Model.Timing.RepeatComponent _Repeat; + private Hl7.Fhir.Model.Timing.RepeatComponent? _Repeat; /// /// BID | TID | QID | AM | PM | QD | QOD | Q4H | Q6H +. @@ -958,27 +924,23 @@ public Hl7.Fhir.Model.Timing.RepeatComponent Repeat [FhirElement("code", InSummary=true, Order=50)] [Binding("TimingAbbreviation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as Timing; - - if (dest == null) - { + if(other is not Timing dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(EventElement.Any()) dest.EventElement = new List(EventElement.DeepCopyInternal()); - if(Repeat != null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)Repeat.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_EventElement is not null) dest.EventElement = new List(_EventElement.DeepCopyInternal()); + if(_Repeat is not null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)_Repeat.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -990,48 +952,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Timing; - if(otherT == null) return false; + if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(EventElement, otherT.EventElement)) return false; - if(!comparer.Equals(Repeat, otherT.Repeat)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = EventElement; - return EventElement?.Any() == true; + value = _EventElement; + return _EventElement?.Any() == true; case "repeat": - value = Repeat; - return Repeat is not null; + value = _Repeat; + return _Repeat is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - EventElement = (List)value; + EventElement = (List?)value!; return this; case "repeat": - Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)value; + Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1042,9 +1004,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (EventElement?.Any() == true) yield return new KeyValuePair("event",EventElement); - if (Repeat is not null) yield return new KeyValuePair("repeat",Repeat); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_EventElement?.Any() == true) yield return new KeyValuePair("event",_EventElement); + if (_Repeat is not null) yield return new KeyValuePair("repeat",_Repeat); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs index 183769e62..1bb8890d1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -119,13 +122,13 @@ public enum TriggerType [Binding("TriggerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// named-event | periodic | data-added | data-modified | data-removed | data-accessed | data-access-ended @@ -134,13 +137,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -150,28 +150,25 @@ public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type /// [FhirElement("eventName", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString EventNameElement + public Hl7.Fhir.Model.FhirString? EventNameElement { get { return _EventNameElement; } set { _EventNameElement = value; OnPropertyChanged("EventNameElement"); } } - private Hl7.Fhir.Model.FhirString _EventNameElement; + private Hl7.Fhir.Model.FhirString? _EventNameElement; /// /// Triggering event name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EventName + public string? EventName { - get { return EventNameElement != null ? EventNameElement.Value : null; } + get => _EventNameElement?.Value; set { - if (value == null) - EventNameElement = null; - else - EventNameElement = new Hl7.Fhir.Model.FhirString(value); + EventNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("EventName"); } } @@ -184,41 +181,37 @@ public string EventName [References("Schedule")] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType EventTiming + public Hl7.Fhir.Model.DataType? EventTiming { get { return _EventTiming; } set { _EventTiming = value; OnPropertyChanged("EventTiming"); } } - private Hl7.Fhir.Model.DataType _EventTiming; + private Hl7.Fhir.Model.DataType? _EventTiming; /// /// Triggering data of the event. /// [FhirElement("eventData", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.DataRequirement EventData + public Hl7.Fhir.Model.DataRequirement? EventData { get { return _EventData; } set { _EventData = value; OnPropertyChanged("EventData"); } } - private Hl7.Fhir.Model.DataRequirement _EventData; + private Hl7.Fhir.Model.DataRequirement? _EventData; protected internal override void CopyToInternal(Base other) { - var dest = other as TriggerDefinition; - - if (dest == null) - { + if(other is not TriggerDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EventNameElement != null) dest.EventNameElement = (Hl7.Fhir.Model.FhirString)EventNameElement.DeepCopyInternal(); - if(EventTiming != null) dest.EventTiming = (Hl7.Fhir.Model.DataType)EventTiming.DeepCopyInternal(); - if(EventData != null) dest.EventData = (Hl7.Fhir.Model.DataRequirement)EventData.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EventNameElement is not null) dest.EventNameElement = (Hl7.Fhir.Model.FhirString)_EventNameElement.DeepCopyInternal(); + if(_EventTiming is not null) dest.EventTiming = (Hl7.Fhir.Model.DataType)_EventTiming.DeepCopyInternal(); + if(_EventData is not null) dest.EventData = (Hl7.Fhir.Model.DataRequirement)_EventData.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -230,55 +223,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TriggerDefinition; - if(otherT == null) return false; + if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(EventNameElement, otherT.EventNameElement)) return false; - if(!comparer.Equals(EventTiming, otherT.EventTiming)) return false; - if(!comparer.Equals(EventData, otherT.EventData)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_EventNameElement, otherT._EventNameElement)) return false; + if(!comparer.Equals(_EventTiming, otherT._EventTiming)) return false; + if(!comparer.Equals(_EventData, otherT._EventData)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "eventName": - value = EventNameElement; - return EventNameElement is not null; + value = _EventNameElement; + return _EventNameElement is not null; case "eventTiming": - value = EventTiming; - return EventTiming is not null; + value = _EventTiming; + return _EventTiming is not null; case "eventData": - value = EventData; - return EventData is not null; + value = _EventData; + return _EventData is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "eventName": - EventNameElement = (Hl7.Fhir.Model.FhirString)value; + EventNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "eventTiming": - EventTiming = (Hl7.Fhir.Model.DataType)value; + EventTiming = (Hl7.Fhir.Model.DataType?)value; return this; case "eventData": - EventData = (Hl7.Fhir.Model.DataRequirement)value; + EventData = (Hl7.Fhir.Model.DataRequirement?)value; return this; default: return base.SetValue(key, value); @@ -289,10 +282,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EventNameElement is not null) yield return new KeyValuePair("eventName",EventNameElement); - if (EventTiming is not null) yield return new KeyValuePair("eventTiming",EventTiming); - if (EventData is not null) yield return new KeyValuePair("eventData",EventData); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EventNameElement is not null) yield return new KeyValuePair("eventName",_EventNameElement); + if (_EventTiming is not null) yield return new KeyValuePair("eventTiming",_EventTiming); + if (_EventData is not null) yield return new KeyValuePair("eventData",_EventData); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs index 30e55e6de..a65cb614f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,28 +83,25 @@ public partial class ComposeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("lockedDate", InSummary=true, Order=40, FiveWs="when.init")] [DataMember] - public Hl7.Fhir.Model.Date LockedDateElement + public Hl7.Fhir.Model.Date? LockedDateElement { get { return _LockedDateElement; } set { _LockedDateElement = value; OnPropertyChanged("LockedDateElement"); } } - private Hl7.Fhir.Model.Date _LockedDateElement; + private Hl7.Fhir.Model.Date? _LockedDateElement; /// /// Fixed date for version-less references (transitive) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LockedDate + public string? LockedDate { - get { return LockedDateElement != null ? LockedDateElement.Value : null; } + get => _LockedDateElement?.Value; set { - if (value == null) - LockedDateElement = null; - else - LockedDateElement = new Hl7.Fhir.Model.Date(value); + LockedDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LockedDate"); } } @@ -111,13 +111,13 @@ public string LockedDate /// [FhirElement("inactive", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// Whether inactive codes are in the value set @@ -126,13 +126,10 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } @@ -145,11 +142,11 @@ public bool? Inactive [DataMember] public List Include { - get { if(_Include==null) _Include = new List(); return _Include; } + get => _Include ?? new List(); set { _Include = value; OnPropertyChanged("Include"); } } - private List _Include; + private List? _Include; /// /// Explicitly exclude codes from a code system or other value sets. @@ -159,26 +156,22 @@ public List Include [DataMember] public List Exclude { - get { if(_Exclude==null) _Exclude = new List(); return _Exclude; } + get => _Exclude ?? new List(); set { _Exclude = value; OnPropertyChanged("Exclude"); } } - private List _Exclude; + private List? _Exclude; protected internal override void CopyToInternal(Base other) { - var dest = other as ComposeComponent; - - if (dest == null) - { + if(other is not ComposeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LockedDateElement != null) dest.LockedDateElement = (Hl7.Fhir.Model.Date)LockedDateElement.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); - if(Include.Any()) dest.Include = new List(Include.DeepCopyInternal()); - if(Exclude.Any()) dest.Exclude = new List(Exclude.DeepCopyInternal()); + if(_LockedDateElement is not null) dest.LockedDateElement = (Hl7.Fhir.Model.Date)_LockedDateElement.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); + if(_Include is not null) dest.Include = new List(_Include.DeepCopyInternal()); + if(_Exclude is not null) dest.Exclude = new List(_Exclude.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -190,55 +183,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComposeComponent; - if(otherT == null) return false; + if(other is not ComposeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LockedDateElement, otherT.LockedDateElement)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; - if(!comparer.ListEquals(Include, otherT.Include)) return false; - if(!comparer.ListEquals(Exclude, otherT.Exclude)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; + if(!comparer.ListEquals(_Include, otherT._Include)) return false; + if(!comparer.ListEquals(_Exclude, otherT._Exclude)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lockedDate": - value = LockedDateElement; - return LockedDateElement is not null; + value = _LockedDateElement; + return _LockedDateElement is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; case "include": - value = Include; - return Include?.Any() == true; + value = _Include; + return _Include?.Any() == true; case "exclude": - value = Exclude; - return Exclude?.Any() == true; + value = _Exclude; + return _Exclude?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lockedDate": - LockedDateElement = (Hl7.Fhir.Model.Date)value; + LockedDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "include": - Include = (List)value; + Include = (List?)value!; return this; case "exclude": - Exclude = (List)value; + Exclude = (List?)value!; return this; default: return base.SetValue(key, value); @@ -249,10 +242,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LockedDateElement is not null) yield return new KeyValuePair("lockedDate",LockedDateElement); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); - if (Include?.Any() == true) yield return new KeyValuePair("include",Include); - if (Exclude?.Any() == true) yield return new KeyValuePair("exclude",Exclude); + if (_LockedDateElement is not null) yield return new KeyValuePair("lockedDate",_LockedDateElement); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); + if (_Include?.Any() == true) yield return new KeyValuePair("include",_Include); + if (_Exclude?.Any() == true) yield return new KeyValuePair("exclude",_Exclude); } } @@ -278,28 +271,25 @@ public partial class ConceptSetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("system", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// The system the codes come from /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -309,28 +299,25 @@ public string System /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Specific version of the code system referred to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -343,11 +330,11 @@ public string Version [DataMember] public List Concept { - get { if(_Concept==null) _Concept = new List(); return _Concept; } + get => _Concept ?? new List(); set { _Concept = value; OnPropertyChanged("Concept"); } } - private List _Concept; + private List? _Concept; /// /// Select codes/concepts by their properties (including relationships). @@ -357,11 +344,11 @@ public List Concept [DataMember] public List Filter { - get { if(_Filter==null) _Filter = new List(); return _Filter; } + get => _Filter ?? new List(); set { _Filter = value; OnPropertyChanged("Filter"); } } - private List _Filter; + private List? _Filter; /// /// Select only contents included in this value set. @@ -371,24 +358,24 @@ public List Filter [DataMember] public List ValueSetElement { - get { if(_ValueSetElement==null) _ValueSetElement = new List(); return _ValueSetElement; } + get => _ValueSetElement ?? new List(); set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private List _ValueSetElement; + private List? _ValueSetElement; /// /// Select only contents included in this value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ValueSet + public IEnumerable? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Select(elem => elem.Value) : null; } + get => _ValueSetElement?.Select(elem => elem.Value); set { if (value == null) - ValueSetElement = null; + ValueSetElement = null!; else ValueSetElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("ValueSet"); @@ -397,19 +384,15 @@ public IEnumerable ValueSet protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptSetComponent; - - if (dest == null) - { + if(other is not ConceptSetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Concept.Any()) dest.Concept = new List(Concept.DeepCopyInternal()); - if(Filter.Any()) dest.Filter = new List(Filter.DeepCopyInternal()); - if(ValueSetElement.Any()) dest.ValueSetElement = new List(ValueSetElement.DeepCopyInternal()); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Concept is not null) dest.Concept = new List(_Concept.DeepCopyInternal()); + if(_Filter is not null) dest.Filter = new List(_Filter.DeepCopyInternal()); + if(_ValueSetElement is not null) dest.ValueSetElement = new List(_ValueSetElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -421,62 +404,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptSetComponent; - if(otherT == null) return false; + if(other is not ConceptSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.ListEquals(Concept, otherT.Concept)) return false; - if(!comparer.ListEquals(Filter, otherT.Filter)) return false; - if(!comparer.ListEquals(ValueSetElement, otherT.ValueSetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; + if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; + if(!comparer.ListEquals(_ValueSetElement, otherT._ValueSetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "concept": - value = Concept; - return Concept?.Any() == true; + value = _Concept; + return _Concept?.Any() == true; case "filter": - value = Filter; - return Filter?.Any() == true; + value = _Filter; + return _Filter?.Any() == true; case "valueSet": - value = ValueSetElement; - return ValueSetElement?.Any() == true; + value = _ValueSetElement; + return _ValueSetElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "concept": - Concept = (List)value; + Concept = (List?)value!; return this; case "filter": - Filter = (List)value; + Filter = (List?)value!; return this; case "valueSet": - ValueSetElement = (List)value; + ValueSetElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -487,11 +470,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Concept?.Any() == true) yield return new KeyValuePair("concept",Concept); - if (Filter?.Any() == true) yield return new KeyValuePair("filter",Filter); - if (ValueSetElement?.Any() == true) yield return new KeyValuePair("valueSet",ValueSetElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Concept?.Any() == true) yield return new KeyValuePair("concept",_Concept); + if (_Filter?.Any() == true) yield return new KeyValuePair("filter",_Filter); + if (_ValueSetElement?.Any() == true) yield return new KeyValuePair("valueSet",_ValueSetElement); } } @@ -519,28 +502,25 @@ public partial class ConceptReferenceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code or expression from system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -550,28 +530,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Text to display for this code for this value set in this valueset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -584,25 +561,21 @@ public string Display [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptReferenceComponent; - - if (dest == null) - { + if(other is not ConceptReferenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -614,48 +587,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptReferenceComponent; - if(otherT == null) return false; + if(other is not ConceptReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -666,9 +639,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); } } @@ -695,28 +668,25 @@ public partial class DesignationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("language", Order=40)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// Human language of the designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -727,13 +697,13 @@ public string Language [FhirElement("use", Order=50)] [Binding("ConceptDesignationUse")] [DataMember] - public Hl7.Fhir.Model.Coding Use + public Hl7.Fhir.Model.Coding? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.Coding _Use; + private Hl7.Fhir.Model.Coding? _Use; /// /// The text value for this designation. @@ -741,45 +711,38 @@ public Hl7.Fhir.Model.Coding Use [FhirElement("value", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The text value for this designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DesignationComponent; - - if (dest == null) - { + if(other is not DesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.Coding)Use.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.Coding)_Use.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -791,48 +754,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DesignationComponent; - if(otherT == null) return false; + if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - Use = (Hl7.Fhir.Model.Coding)value; + Use = (Hl7.Fhir.Model.Coding?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -843,9 +806,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (Use is not null) yield return new KeyValuePair("use",Use); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_Use is not null) yield return new KeyValuePair("use",_Use); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -873,28 +836,25 @@ public partial class FilterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("property", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code PropertyElement + public Hl7.Fhir.Model.Code? PropertyElement { get { return _PropertyElement; } set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private Hl7.Fhir.Model.Code _PropertyElement; + private Hl7.Fhir.Model.Code? _PropertyElement; /// /// A property defined by the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Property + public string? Property { - get { return PropertyElement != null ? PropertyElement.Value : null; } + get => _PropertyElement?.Value; set { - if (value == null) - PropertyElement = null; - else - PropertyElement = new Hl7.Fhir.Model.Code(value); + PropertyElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Property"); } } @@ -907,13 +867,13 @@ public string Property [Binding("FilterOperator")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OpElement + public Code? OpElement { get { return _OpElement; } set { _OpElement = value; OnPropertyChanged("OpElement"); } } - private Code _OpElement; + private Code? _OpElement; /// /// = | is-a | descendent-of | is-not-a | regex | in | not-in | generalizes | exists @@ -922,13 +882,10 @@ public Code OpElement [IgnoreDataMember] public Hl7.Fhir.Model.FilterOperator? Op { - get { return OpElement != null ? OpElement.Value : null; } + get => _OpElement?.Value; set { - if (value == null) - OpElement = null; - else - OpElement = new Code(value); + OpElement = value is null ? null : new Code(value); OnPropertyChanged("Op"); } } @@ -939,45 +896,38 @@ public Hl7.Fhir.Model.FilterOperator? Op [FhirElement("value", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code ValueElement + public Hl7.Fhir.Model.Code? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.Code _ValueElement; + private Hl7.Fhir.Model.Code? _ValueElement; /// /// Code from the system, or regex criteria, or boolean value for exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.Code(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FilterComponent; - - if (dest == null) - { + if(other is not FilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PropertyElement != null) dest.PropertyElement = (Hl7.Fhir.Model.Code)PropertyElement.DeepCopyInternal(); - if(OpElement != null) dest.OpElement = (Code)OpElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.Code)ValueElement.DeepCopyInternal(); + if(_PropertyElement is not null) dest.PropertyElement = (Hl7.Fhir.Model.Code)_PropertyElement.DeepCopyInternal(); + if(_OpElement is not null) dest.OpElement = (Code)_OpElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.Code)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -989,48 +939,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterComponent; - if(otherT == null) return false; + if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PropertyElement, otherT.PropertyElement)) return false; - if(!comparer.Equals(OpElement, otherT.OpElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + if(!comparer.Equals(_OpElement, otherT._OpElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "property": - value = PropertyElement; - return PropertyElement is not null; + value = _PropertyElement; + return _PropertyElement is not null; case "op": - value = OpElement; - return OpElement is not null; + value = _OpElement; + return _OpElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "property": - PropertyElement = (Hl7.Fhir.Model.Code)value; + PropertyElement = (Hl7.Fhir.Model.Code?)value; return this; case "op": - OpElement = (Code)value; + OpElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.Code)value; + ValueElement = (Hl7.Fhir.Model.Code?)value; return this; default: return base.SetValue(key, value); @@ -1041,9 +991,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PropertyElement is not null) yield return new KeyValuePair("property",PropertyElement); - if (OpElement is not null) yield return new KeyValuePair("op",OpElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_PropertyElement is not null) yield return new KeyValuePair("property",_PropertyElement); + if (_OpElement is not null) yield return new KeyValuePair("op",_OpElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -1071,28 +1021,25 @@ public partial class ExpansionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identifier", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri IdentifierElement + public Hl7.Fhir.Model.FhirUri? IdentifierElement { get { return _IdentifierElement; } set { _IdentifierElement = value; OnPropertyChanged("IdentifierElement"); } } - private Hl7.Fhir.Model.FhirUri _IdentifierElement; + private Hl7.Fhir.Model.FhirUri? _IdentifierElement; /// /// Uniquely identifies this expansion /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identifier + public string? Identifier { - get { return IdentifierElement != null ? IdentifierElement.Value : null; } + get => _IdentifierElement?.Value; set { - if (value == null) - IdentifierElement = null; - else - IdentifierElement = new Hl7.Fhir.Model.FhirUri(value); + IdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Identifier"); } } @@ -1103,28 +1050,25 @@ public string Identifier [FhirElement("timestamp", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimestampElement + public Hl7.Fhir.Model.FhirDateTime? TimestampElement { get { return _TimestampElement; } set { _TimestampElement = value; OnPropertyChanged("TimestampElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimestampElement; + private Hl7.Fhir.Model.FhirDateTime? _TimestampElement; /// /// Time ValueSet expansion happened /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Timestamp + public string? Timestamp { - get { return TimestampElement != null ? TimestampElement.Value : null; } + get => _TimestampElement?.Value; set { - if (value == null) - TimestampElement = null; - else - TimestampElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimestampElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Timestamp"); } } @@ -1134,13 +1078,13 @@ public string Timestamp /// [FhirElement("total", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer TotalElement + public Hl7.Fhir.Model.Integer? TotalElement { get { return _TotalElement; } set { _TotalElement = value; OnPropertyChanged("TotalElement"); } } - private Hl7.Fhir.Model.Integer _TotalElement; + private Hl7.Fhir.Model.Integer? _TotalElement; /// /// Total number of codes in the expansion @@ -1149,13 +1093,10 @@ public Hl7.Fhir.Model.Integer TotalElement [IgnoreDataMember] public int? Total { - get { return TotalElement != null ? TotalElement.Value : null; } + get => _TotalElement?.Value; set { - if (value == null) - TotalElement = null; - else - TotalElement = new Hl7.Fhir.Model.Integer(value); + TotalElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Total"); } } @@ -1165,13 +1106,13 @@ public int? Total /// [FhirElement("offset", Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer OffsetElement + public Hl7.Fhir.Model.Integer? OffsetElement { get { return _OffsetElement; } set { _OffsetElement = value; OnPropertyChanged("OffsetElement"); } } - private Hl7.Fhir.Model.Integer _OffsetElement; + private Hl7.Fhir.Model.Integer? _OffsetElement; /// /// Offset at which this resource starts @@ -1180,13 +1121,10 @@ public Hl7.Fhir.Model.Integer OffsetElement [IgnoreDataMember] public int? Offset { - get { return OffsetElement != null ? OffsetElement.Value : null; } + get => _OffsetElement?.Value; set { - if (value == null) - OffsetElement = null; - else - OffsetElement = new Hl7.Fhir.Model.Integer(value); + OffsetElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Offset"); } } @@ -1199,11 +1137,11 @@ public int? Offset [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Codes in the value set. @@ -1213,28 +1151,24 @@ public List Parameter [DataMember] public List Contains { - get { if(_Contains==null) _Contains = new List(); return _Contains; } + get => _Contains ?? new List(); set { _Contains = value; OnPropertyChanged("Contains"); } } - private List _Contains; + private List? _Contains; protected internal override void CopyToInternal(Base other) { - var dest = other as ExpansionComponent; - - if (dest == null) - { + if(other is not ExpansionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdentifierElement != null) dest.IdentifierElement = (Hl7.Fhir.Model.FhirUri)IdentifierElement.DeepCopyInternal(); - if(TimestampElement != null) dest.TimestampElement = (Hl7.Fhir.Model.FhirDateTime)TimestampElement.DeepCopyInternal(); - if(TotalElement != null) dest.TotalElement = (Hl7.Fhir.Model.Integer)TotalElement.DeepCopyInternal(); - if(OffsetElement != null) dest.OffsetElement = (Hl7.Fhir.Model.Integer)OffsetElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Contains.Any()) dest.Contains = new List(Contains.DeepCopyInternal()); + if(_IdentifierElement is not null) dest.IdentifierElement = (Hl7.Fhir.Model.FhirUri)_IdentifierElement.DeepCopyInternal(); + if(_TimestampElement is not null) dest.TimestampElement = (Hl7.Fhir.Model.FhirDateTime)_TimestampElement.DeepCopyInternal(); + if(_TotalElement is not null) dest.TotalElement = (Hl7.Fhir.Model.Integer)_TotalElement.DeepCopyInternal(); + if(_OffsetElement is not null) dest.OffsetElement = (Hl7.Fhir.Model.Integer)_OffsetElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Contains is not null) dest.Contains = new List(_Contains.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1246,69 +1180,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExpansionComponent; - if(otherT == null) return false; + if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentifierElement, otherT.IdentifierElement)) return false; - if(!comparer.Equals(TimestampElement, otherT.TimestampElement)) return false; - if(!comparer.Equals(TotalElement, otherT.TotalElement)) return false; - if(!comparer.Equals(OffsetElement, otherT.OffsetElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Contains, otherT.Contains)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; + if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; + if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = IdentifierElement; - return IdentifierElement is not null; + value = _IdentifierElement; + return _IdentifierElement is not null; case "timestamp": - value = TimestampElement; - return TimestampElement is not null; + value = _TimestampElement; + return _TimestampElement is not null; case "total": - value = TotalElement; - return TotalElement is not null; + value = _TotalElement; + return _TotalElement is not null; case "offset": - value = OffsetElement; - return OffsetElement is not null; + value = _OffsetElement; + return _OffsetElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "contains": - value = Contains; - return Contains?.Any() == true; + value = _Contains; + return _Contains?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - IdentifierElement = (Hl7.Fhir.Model.FhirUri)value; + IdentifierElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "timestamp": - TimestampElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimestampElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "total": - TotalElement = (Hl7.Fhir.Model.Integer)value; + TotalElement = (Hl7.Fhir.Model.Integer?)value; return this; case "offset": - OffsetElement = (Hl7.Fhir.Model.Integer)value; + OffsetElement = (Hl7.Fhir.Model.Integer?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "contains": - Contains = (List)value; + Contains = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1319,12 +1253,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentifierElement is not null) yield return new KeyValuePair("identifier",IdentifierElement); - if (TimestampElement is not null) yield return new KeyValuePair("timestamp",TimestampElement); - if (TotalElement is not null) yield return new KeyValuePair("total",TotalElement); - if (OffsetElement is not null) yield return new KeyValuePair("offset",OffsetElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Contains?.Any() == true) yield return new KeyValuePair("contains",Contains); + if (_IdentifierElement is not null) yield return new KeyValuePair("identifier",_IdentifierElement); + if (_TimestampElement is not null) yield return new KeyValuePair("timestamp",_TimestampElement); + if (_TotalElement is not null) yield return new KeyValuePair("total",_TotalElement); + if (_OffsetElement is not null) yield return new KeyValuePair("offset",_OffsetElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Contains?.Any() == true) yield return new KeyValuePair("contains",_Contains); } } @@ -1352,28 +1286,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name as assigned by the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1385,26 +1316,22 @@ public string Name [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Code))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1416,41 +1343,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1461,8 +1388,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1488,28 +1415,25 @@ public partial class ContainsComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("system", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri SystemElement + public Hl7.Fhir.Model.FhirUri? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirUri _SystemElement; + private Hl7.Fhir.Model.FhirUri? _SystemElement; /// /// System value for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirUri(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("System"); } } @@ -1519,13 +1443,13 @@ public string System /// [FhirElement("abstract", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AbstractElement + public Hl7.Fhir.Model.FhirBoolean? AbstractElement { get { return _AbstractElement; } set { _AbstractElement = value; OnPropertyChanged("AbstractElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AbstractElement; + private Hl7.Fhir.Model.FhirBoolean? _AbstractElement; /// /// If user cannot select this entry @@ -1534,13 +1458,10 @@ public Hl7.Fhir.Model.FhirBoolean AbstractElement [IgnoreDataMember] public bool? Abstract { - get { return AbstractElement != null ? AbstractElement.Value : null; } + get => _AbstractElement?.Value; set { - if (value == null) - AbstractElement = null; - else - AbstractElement = new Hl7.Fhir.Model.FhirBoolean(value); + AbstractElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Abstract"); } } @@ -1550,13 +1471,13 @@ public bool? Abstract /// [FhirElement("inactive", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// If concept is inactive in the code system @@ -1565,13 +1486,10 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } @@ -1581,28 +1499,25 @@ public bool? Inactive /// [FhirElement("version", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version in which this code/display is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1612,28 +1527,25 @@ public string Version /// [FhirElement("code", Order=80)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code - if blank, this is not a selectable code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1643,28 +1555,25 @@ public string Code /// [FhirElement("display", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// User display for the concept /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -1677,11 +1586,11 @@ public string Display [DataMember] public List Designation { - get { if(_Designation==null) _Designation = new List(); return _Designation; } + get => _Designation ?? new List(); set { _Designation = value; OnPropertyChanged("Designation"); } } - private List _Designation; + private List? _Designation; /// /// Codes contained under this entry. @@ -1691,30 +1600,26 @@ public List Designation [DataMember] public List Contains { - get { if(_Contains==null) _Contains = new List(); return _Contains; } + get => _Contains ?? new List(); set { _Contains = value; OnPropertyChanged("Contains"); } } - private List _Contains; + private List? _Contains; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainsComponent; - - if (dest == null) - { + if(other is not ContainsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)SystemElement.DeepCopyInternal(); - if(AbstractElement != null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)AbstractElement.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(Designation.Any()) dest.Designation = new List(Designation.DeepCopyInternal()); - if(Contains.Any()) dest.Contains = new List(Contains.DeepCopyInternal()); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirUri)_SystemElement.DeepCopyInternal(); + if(_AbstractElement is not null) dest.AbstractElement = (Hl7.Fhir.Model.FhirBoolean)_AbstractElement.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_Designation is not null) dest.Designation = new List(_Designation.DeepCopyInternal()); + if(_Contains is not null) dest.Contains = new List(_Contains.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1726,83 +1631,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainsComponent; - if(otherT == null) return false; + if(other is not ContainsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(AbstractElement, otherT.AbstractElement)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.ListEquals(Designation, otherT.Designation)) return false; - if(!comparer.ListEquals(Contains, otherT.Contains)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_AbstractElement, otherT._AbstractElement)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; + if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "abstract": - value = AbstractElement; - return AbstractElement is not null; + value = _AbstractElement; + return _AbstractElement is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "designation": - value = Designation; - return Designation?.Any() == true; + value = _Designation; + return _Designation?.Any() == true; case "contains": - value = Contains; - return Contains?.Any() == true; + value = _Contains; + return _Contains?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "system": - SystemElement = (Hl7.Fhir.Model.FhirUri)value; + SystemElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "abstract": - AbstractElement = (Hl7.Fhir.Model.FhirBoolean)value; + AbstractElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "designation": - Designation = (List)value; + Designation = (List?)value!; return this; case "contains": - Contains = (List)value; + Contains = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1813,14 +1718,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (AbstractElement is not null) yield return new KeyValuePair("abstract",AbstractElement); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Designation?.Any() == true) yield return new KeyValuePair("designation",Designation); - if (Contains?.Any() == true) yield return new KeyValuePair("contains",Contains); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_AbstractElement is not null) yield return new KeyValuePair("abstract",_AbstractElement); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Designation?.Any() == true) yield return new KeyValuePair("designation",_Designation); + if (_Contains?.Any() == true) yield return new KeyValuePair("contains",_Contains); } } @@ -1830,28 +1735,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="id")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical URI to reference this value set (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1864,39 +1766,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the value set. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="id.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1906,28 +1805,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this value set (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1937,28 +1833,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this value set (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1971,13 +1864,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1986,13 +1879,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2002,13 +1892,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2017,13 +1907,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2033,28 +1920,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date this was last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2064,28 +1948,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="who.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2098,39 +1979,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the value set. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2143,11 +2021,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for value set (if applicable). @@ -2158,24 +2036,24 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Indicates whether or not any change to the content logical definition may occur. /// [FhirElement("immutable", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ImmutableElement + public Hl7.Fhir.Model.FhirBoolean? ImmutableElement { get { return _ImmutableElement; } set { _ImmutableElement = value; OnPropertyChanged("ImmutableElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ImmutableElement; + private Hl7.Fhir.Model.FhirBoolean? _ImmutableElement; /// /// Indicates whether or not any change to the content logical definition may occur @@ -2184,13 +2062,10 @@ public Hl7.Fhir.Model.FhirBoolean ImmutableElement [IgnoreDataMember] public bool? Immutable { - get { return ImmutableElement != null ? ImmutableElement.Value : null; } + get => _ImmutableElement?.Value; set { - if (value == null) - ImmutableElement = null; - else - ImmutableElement = new Hl7.Fhir.Model.FhirBoolean(value); + ImmutableElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Immutable"); } } @@ -2200,28 +2075,25 @@ public bool? Immutable /// [FhirElement("purpose", Order=230, FiveWs="why")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this value set is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2231,28 +2103,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2262,13 +2131,13 @@ public string Copyright /// [FhirElement("extensible", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExtensibleElement + public Hl7.Fhir.Model.FhirBoolean? ExtensibleElement { get { return _ExtensibleElement; } set { _ExtensibleElement = value; OnPropertyChanged("ExtensibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExtensibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ExtensibleElement; /// /// Whether this is intended to be used with an extensible binding @@ -2277,13 +2146,10 @@ public Hl7.Fhir.Model.FhirBoolean ExtensibleElement [IgnoreDataMember] public bool? Extensible { - get { return ExtensibleElement != null ? ExtensibleElement.Value : null; } + get => _ExtensibleElement?.Value; set { - if (value == null) - ExtensibleElement = null; - else - ExtensibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExtensibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Extensible"); } } @@ -2293,58 +2159,54 @@ public bool? Extensible /// [FhirElement("compose", Order=260)] [DataMember] - public Hl7.Fhir.Model.ValueSet.ComposeComponent Compose + public Hl7.Fhir.Model.ValueSet.ComposeComponent? Compose { get { return _Compose; } set { _Compose = value; OnPropertyChanged("Compose"); } } - private Hl7.Fhir.Model.ValueSet.ComposeComponent _Compose; + private Hl7.Fhir.Model.ValueSet.ComposeComponent? _Compose; /// /// Used when the value set is "expanded". /// [FhirElement("expansion", Order=270)] [DataMember] - public Hl7.Fhir.Model.ValueSet.ExpansionComponent Expansion + public Hl7.Fhir.Model.ValueSet.ExpansionComponent? Expansion { get { return _Expansion; } set { _Expansion = value; OnPropertyChanged("Expansion"); } } - private Hl7.Fhir.Model.ValueSet.ExpansionComponent _Expansion; + private Hl7.Fhir.Model.ValueSet.ExpansionComponent? _Expansion; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ValueSet; - - if (dest == null) - { + if(other is not ValueSet dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(ImmutableElement != null) dest.ImmutableElement = (Hl7.Fhir.Model.FhirBoolean)ImmutableElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ExtensibleElement != null) dest.ExtensibleElement = (Hl7.Fhir.Model.FhirBoolean)ExtensibleElement.DeepCopyInternal(); - if(Compose != null) dest.Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent)Compose.DeepCopyInternal(); - if(Expansion != null) dest.Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent)Expansion.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_ImmutableElement is not null) dest.ImmutableElement = (Hl7.Fhir.Model.FhirBoolean)_ImmutableElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ExtensibleElement is not null) dest.ExtensibleElement = (Hl7.Fhir.Model.FhirBoolean)_ExtensibleElement.DeepCopyInternal(); + if(_Compose is not null) dest.Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent)_Compose.DeepCopyInternal(); + if(_Expansion is not null) dest.Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent)_Expansion.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2356,160 +2218,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValueSet; - if(otherT == null) return false; + if(other is not ValueSet otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(ImmutableElement, otherT.ImmutableElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ExtensibleElement, otherT.ExtensibleElement)) return false; - if(!comparer.Equals(Compose, otherT.Compose)) return false; - if(!comparer.Equals(Expansion, otherT.Expansion)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_ImmutableElement, otherT._ImmutableElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ExtensibleElement, otherT._ExtensibleElement)) return false; + if(!comparer.Equals(_Compose, otherT._Compose)) return false; + if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "immutable": - value = ImmutableElement; - return ImmutableElement is not null; + value = _ImmutableElement; + return _ImmutableElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "extensible": - value = ExtensibleElement; - return ExtensibleElement is not null; + value = _ExtensibleElement; + return _ExtensibleElement is not null; case "compose": - value = Compose; - return Compose is not null; + value = _Compose; + return _Compose is not null; case "expansion": - value = Expansion; - return Expansion is not null; + value = _Expansion; + return _Expansion is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "immutable": - ImmutableElement = (Hl7.Fhir.Model.FhirBoolean)value; + ImmutableElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "extensible": - ExtensibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExtensibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "compose": - Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent)value; + Compose = (Hl7.Fhir.Model.ValueSet.ComposeComponent?)value; return this; case "expansion": - Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent)value; + Expansion = (Hl7.Fhir.Model.ValueSet.ExpansionComponent?)value; return this; default: return base.SetValue(key, value); @@ -2520,25 +2382,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (ImmutableElement is not null) yield return new KeyValuePair("immutable",ImmutableElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ExtensibleElement is not null) yield return new KeyValuePair("extensible",ExtensibleElement); - if (Compose is not null) yield return new KeyValuePair("compose",Compose); - if (Expansion is not null) yield return new KeyValuePair("expansion",Expansion); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_ImmutableElement is not null) yield return new KeyValuePair("immutable",_ImmutableElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ExtensibleElement is not null) yield return new KeyValuePair("extensible",_ExtensibleElement); + if (_Compose is not null) yield return new KeyValuePair("compose",_Compose); + if (_Expansion is not null) yield return new KeyValuePair("expansion",_Expansion); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs index 459a5f2ea..78cda4767 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -137,13 +140,13 @@ public partial class DispenseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("product", Order=40)] [Binding("VisionProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Product + public Hl7.Fhir.Model.CodeableConcept? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.CodeableConcept _Product; + private Hl7.Fhir.Model.CodeableConcept? _Product; /// /// right | left. @@ -152,13 +155,13 @@ public Hl7.Fhir.Model.CodeableConcept Product [DeclaredType(Type = typeof(Code))] [Binding("VisionEyes")] [DataMember] - public Code EyeElement + public Code? EyeElement { get { return _EyeElement; } set { _EyeElement = value; OnPropertyChanged("EyeElement"); } } - private Code _EyeElement; + private Code? _EyeElement; /// /// right | left @@ -167,13 +170,10 @@ public Code EyeElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye { - get { return EyeElement != null ? EyeElement.Value : null; } + get => _EyeElement?.Value; set { - if (value == null) - EyeElement = null; - else - EyeElement = new Code(value); + EyeElement = value is null ? null : new Code(value); OnPropertyChanged("Eye"); } } @@ -183,13 +183,13 @@ public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye /// [FhirElement("sphere", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal SphereElement + public Hl7.Fhir.Model.FhirDecimal? SphereElement { get { return _SphereElement; } set { _SphereElement = value; OnPropertyChanged("SphereElement"); } } - private Hl7.Fhir.Model.FhirDecimal _SphereElement; + private Hl7.Fhir.Model.FhirDecimal? _SphereElement; /// /// Lens sphere @@ -198,13 +198,10 @@ public Hl7.Fhir.Model.FhirDecimal SphereElement [IgnoreDataMember] public decimal? Sphere { - get { return SphereElement != null ? SphereElement.Value : null; } + get => _SphereElement?.Value; set { - if (value == null) - SphereElement = null; - else - SphereElement = new Hl7.Fhir.Model.FhirDecimal(value); + SphereElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Sphere"); } } @@ -214,13 +211,13 @@ public decimal? Sphere /// [FhirElement("cylinder", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal CylinderElement + public Hl7.Fhir.Model.FhirDecimal? CylinderElement { get { return _CylinderElement; } set { _CylinderElement = value; OnPropertyChanged("CylinderElement"); } } - private Hl7.Fhir.Model.FhirDecimal _CylinderElement; + private Hl7.Fhir.Model.FhirDecimal? _CylinderElement; /// /// Lens cylinder @@ -229,13 +226,10 @@ public Hl7.Fhir.Model.FhirDecimal CylinderElement [IgnoreDataMember] public decimal? Cylinder { - get { return CylinderElement != null ? CylinderElement.Value : null; } + get => _CylinderElement?.Value; set { - if (value == null) - CylinderElement = null; - else - CylinderElement = new Hl7.Fhir.Model.FhirDecimal(value); + CylinderElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Cylinder"); } } @@ -245,13 +239,13 @@ public decimal? Cylinder /// [FhirElement("axis", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer AxisElement + public Hl7.Fhir.Model.Integer? AxisElement { get { return _AxisElement; } set { _AxisElement = value; OnPropertyChanged("AxisElement"); } } - private Hl7.Fhir.Model.Integer _AxisElement; + private Hl7.Fhir.Model.Integer? _AxisElement; /// /// Lens axis @@ -260,13 +254,10 @@ public Hl7.Fhir.Model.Integer AxisElement [IgnoreDataMember] public int? Axis { - get { return AxisElement != null ? AxisElement.Value : null; } + get => _AxisElement?.Value; set { - if (value == null) - AxisElement = null; - else - AxisElement = new Hl7.Fhir.Model.Integer(value); + AxisElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Axis"); } } @@ -276,13 +267,13 @@ public int? Axis /// [FhirElement("prism", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PrismElement + public Hl7.Fhir.Model.FhirDecimal? PrismElement { get { return _PrismElement; } set { _PrismElement = value; OnPropertyChanged("PrismElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PrismElement; + private Hl7.Fhir.Model.FhirDecimal? _PrismElement; /// /// Lens prism @@ -291,13 +282,10 @@ public Hl7.Fhir.Model.FhirDecimal PrismElement [IgnoreDataMember] public decimal? Prism { - get { return PrismElement != null ? PrismElement.Value : null; } + get => _PrismElement?.Value; set { - if (value == null) - PrismElement = null; - else - PrismElement = new Hl7.Fhir.Model.FhirDecimal(value); + PrismElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Prism"); } } @@ -309,13 +297,13 @@ public decimal? Prism [DeclaredType(Type = typeof(Code))] [Binding("VisionBase")] [DataMember] - public Code BaseElement + public Code? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Code _BaseElement; + private Code? _BaseElement; /// /// up | down | in | out @@ -324,13 +312,10 @@ public Code BaseElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionBase? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Code(value); + BaseElement = value is null ? null : new Code(value); OnPropertyChanged("Base"); } } @@ -340,13 +325,13 @@ public Hl7.Fhir.Model.VisionPrescription.VisionBase? Base /// [FhirElement("add", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AddElement + public Hl7.Fhir.Model.FhirDecimal? AddElement { get { return _AddElement; } set { _AddElement = value; OnPropertyChanged("AddElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AddElement; + private Hl7.Fhir.Model.FhirDecimal? _AddElement; /// /// Lens add @@ -355,13 +340,10 @@ public Hl7.Fhir.Model.FhirDecimal AddElement [IgnoreDataMember] public decimal? Add { - get { return AddElement != null ? AddElement.Value : null; } + get => _AddElement?.Value; set { - if (value == null) - AddElement = null; - else - AddElement = new Hl7.Fhir.Model.FhirDecimal(value); + AddElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Add"); } } @@ -371,13 +353,13 @@ public decimal? Add /// [FhirElement("power", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PowerElement + public Hl7.Fhir.Model.FhirDecimal? PowerElement { get { return _PowerElement; } set { _PowerElement = value; OnPropertyChanged("PowerElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PowerElement; + private Hl7.Fhir.Model.FhirDecimal? _PowerElement; /// /// Contact lens power @@ -386,13 +368,10 @@ public Hl7.Fhir.Model.FhirDecimal PowerElement [IgnoreDataMember] public decimal? Power { - get { return PowerElement != null ? PowerElement.Value : null; } + get => _PowerElement?.Value; set { - if (value == null) - PowerElement = null; - else - PowerElement = new Hl7.Fhir.Model.FhirDecimal(value); + PowerElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Power"); } } @@ -402,13 +381,13 @@ public decimal? Power /// [FhirElement("backCurve", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal BackCurveElement + public Hl7.Fhir.Model.FhirDecimal? BackCurveElement { get { return _BackCurveElement; } set { _BackCurveElement = value; OnPropertyChanged("BackCurveElement"); } } - private Hl7.Fhir.Model.FhirDecimal _BackCurveElement; + private Hl7.Fhir.Model.FhirDecimal? _BackCurveElement; /// /// Contact lens back curvature @@ -417,13 +396,10 @@ public Hl7.Fhir.Model.FhirDecimal BackCurveElement [IgnoreDataMember] public decimal? BackCurve { - get { return BackCurveElement != null ? BackCurveElement.Value : null; } + get => _BackCurveElement?.Value; set { - if (value == null) - BackCurveElement = null; - else - BackCurveElement = new Hl7.Fhir.Model.FhirDecimal(value); + BackCurveElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("BackCurve"); } } @@ -433,13 +409,13 @@ public decimal? BackCurve /// [FhirElement("diameter", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DiameterElement + public Hl7.Fhir.Model.FhirDecimal? DiameterElement { get { return _DiameterElement; } set { _DiameterElement = value; OnPropertyChanged("DiameterElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DiameterElement; + private Hl7.Fhir.Model.FhirDecimal? _DiameterElement; /// /// Contact lens diameter @@ -448,13 +424,10 @@ public Hl7.Fhir.Model.FhirDecimal DiameterElement [IgnoreDataMember] public decimal? Diameter { - get { return DiameterElement != null ? DiameterElement.Value : null; } + get => _DiameterElement?.Value; set { - if (value == null) - DiameterElement = null; - else - DiameterElement = new Hl7.Fhir.Model.FhirDecimal(value); + DiameterElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Diameter"); } } @@ -464,41 +437,38 @@ public decimal? Diameter /// [FhirElement("duration", Order=150)] [DataMember] - public Hl7.Fhir.Model.Quantity Duration + public Hl7.Fhir.Model.Quantity? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Quantity _Duration; + private Hl7.Fhir.Model.Quantity? _Duration; /// /// Color required. /// [FhirElement("color", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString ColorElement + public Hl7.Fhir.Model.FhirString? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Hl7.Fhir.Model.FhirString _ColorElement; + private Hl7.Fhir.Model.FhirString? _ColorElement; /// /// Color required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Color + public string? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Hl7.Fhir.Model.FhirString(value); + ColorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Color"); } } @@ -508,28 +478,25 @@ public string Color /// [FhirElement("brand", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString BrandElement + public Hl7.Fhir.Model.FhirString? BrandElement { get { return _BrandElement; } set { _BrandElement = value; OnPropertyChanged("BrandElement"); } } - private Hl7.Fhir.Model.FhirString _BrandElement; + private Hl7.Fhir.Model.FhirString? _BrandElement; /// /// Brand required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Brand + public string? Brand { - get { return BrandElement != null ? BrandElement.Value : null; } + get => _BrandElement?.Value; set { - if (value == null) - BrandElement = null; - else - BrandElement = new Hl7.Fhir.Model.FhirString(value); + BrandElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Brand"); } } @@ -542,37 +509,33 @@ public string Brand [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as DispenseComponent; - - if (dest == null) - { + if(other is not DispenseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Product != null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)Product.DeepCopyInternal(); - if(EyeElement != null) dest.EyeElement = (Code)EyeElement.DeepCopyInternal(); - if(SphereElement != null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)SphereElement.DeepCopyInternal(); - if(CylinderElement != null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)CylinderElement.DeepCopyInternal(); - if(AxisElement != null) dest.AxisElement = (Hl7.Fhir.Model.Integer)AxisElement.DeepCopyInternal(); - if(PrismElement != null) dest.PrismElement = (Hl7.Fhir.Model.FhirDecimal)PrismElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Code)BaseElement.DeepCopyInternal(); - if(AddElement != null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)AddElement.DeepCopyInternal(); - if(PowerElement != null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)PowerElement.DeepCopyInternal(); - if(BackCurveElement != null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)BackCurveElement.DeepCopyInternal(); - if(DiameterElement != null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)DiameterElement.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Quantity)Duration.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)ColorElement.DeepCopyInternal(); - if(BrandElement != null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)BrandElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)_Product.DeepCopyInternal(); + if(_EyeElement is not null) dest.EyeElement = (Code)_EyeElement.DeepCopyInternal(); + if(_SphereElement is not null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)_SphereElement.DeepCopyInternal(); + if(_CylinderElement is not null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)_CylinderElement.DeepCopyInternal(); + if(_AxisElement is not null) dest.AxisElement = (Hl7.Fhir.Model.Integer)_AxisElement.DeepCopyInternal(); + if(_PrismElement is not null) dest.PrismElement = (Hl7.Fhir.Model.FhirDecimal)_PrismElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Code)_BaseElement.DeepCopyInternal(); + if(_AddElement is not null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)_AddElement.DeepCopyInternal(); + if(_PowerElement is not null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)_PowerElement.DeepCopyInternal(); + if(_BackCurveElement is not null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)_BackCurveElement.DeepCopyInternal(); + if(_DiameterElement is not null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)_DiameterElement.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Quantity)_Duration.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)_ColorElement.DeepCopyInternal(); + if(_BrandElement is not null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)_BrandElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -584,132 +547,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DispenseComponent; - if(otherT == null) return false; + if(other is not DispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(EyeElement, otherT.EyeElement)) return false; - if(!comparer.Equals(SphereElement, otherT.SphereElement)) return false; - if(!comparer.Equals(CylinderElement, otherT.CylinderElement)) return false; - if(!comparer.Equals(AxisElement, otherT.AxisElement)) return false; - if(!comparer.Equals(PrismElement, otherT.PrismElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.Equals(AddElement, otherT.AddElement)) return false; - if(!comparer.Equals(PowerElement, otherT.PowerElement)) return false; - if(!comparer.Equals(BackCurveElement, otherT.BackCurveElement)) return false; - if(!comparer.Equals(DiameterElement, otherT.DiameterElement)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(BrandElement, otherT.BrandElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; + if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; + if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; + if(!comparer.Equals(_AxisElement, otherT._AxisElement)) return false; + if(!comparer.Equals(_PrismElement, otherT._PrismElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.Equals(_AddElement, otherT._AddElement)) return false; + if(!comparer.Equals(_PowerElement, otherT._PowerElement)) return false; + if(!comparer.Equals(_BackCurveElement, otherT._BackCurveElement)) return false; + if(!comparer.Equals(_DiameterElement, otherT._DiameterElement)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "eye": - value = EyeElement; - return EyeElement is not null; + value = _EyeElement; + return _EyeElement is not null; case "sphere": - value = SphereElement; - return SphereElement is not null; + value = _SphereElement; + return _SphereElement is not null; case "cylinder": - value = CylinderElement; - return CylinderElement is not null; + value = _CylinderElement; + return _CylinderElement is not null; case "axis": - value = AxisElement; - return AxisElement is not null; + value = _AxisElement; + return _AxisElement is not null; case "prism": - value = PrismElement; - return PrismElement is not null; + value = _PrismElement; + return _PrismElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; case "add": - value = AddElement; - return AddElement is not null; + value = _AddElement; + return _AddElement is not null; case "power": - value = PowerElement; - return PowerElement is not null; + value = _PowerElement; + return _PowerElement is not null; case "backCurve": - value = BackCurveElement; - return BackCurveElement is not null; + value = _BackCurveElement; + return _BackCurveElement is not null; case "diameter": - value = DiameterElement; - return DiameterElement is not null; + value = _DiameterElement; + return _DiameterElement is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "brand": - value = BrandElement; - return BrandElement is not null; + value = _BrandElement; + return _BrandElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "product": - Product = (Hl7.Fhir.Model.CodeableConcept)value; + Product = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "eye": - EyeElement = (Code)value; + EyeElement = (Code?)value; return this; case "sphere": - SphereElement = (Hl7.Fhir.Model.FhirDecimal)value; + SphereElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "cylinder": - CylinderElement = (Hl7.Fhir.Model.FhirDecimal)value; + CylinderElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "axis": - AxisElement = (Hl7.Fhir.Model.Integer)value; + AxisElement = (Hl7.Fhir.Model.Integer?)value; return this; case "prism": - PrismElement = (Hl7.Fhir.Model.FhirDecimal)value; + PrismElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "base": - BaseElement = (Code)value; + BaseElement = (Code?)value; return this; case "add": - AddElement = (Hl7.Fhir.Model.FhirDecimal)value; + AddElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "power": - PowerElement = (Hl7.Fhir.Model.FhirDecimal)value; + PowerElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "backCurve": - BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)value; + BackCurveElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "diameter": - DiameterElement = (Hl7.Fhir.Model.FhirDecimal)value; + DiameterElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Quantity)value; + Duration = (Hl7.Fhir.Model.Quantity?)value; return this; case "color": - ColorElement = (Hl7.Fhir.Model.FhirString)value; + ColorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "brand": - BrandElement = (Hl7.Fhir.Model.FhirString)value; + BrandElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -720,21 +683,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Product is not null) yield return new KeyValuePair("product",Product); - if (EyeElement is not null) yield return new KeyValuePair("eye",EyeElement); - if (SphereElement is not null) yield return new KeyValuePair("sphere",SphereElement); - if (CylinderElement is not null) yield return new KeyValuePair("cylinder",CylinderElement); - if (AxisElement is not null) yield return new KeyValuePair("axis",AxisElement); - if (PrismElement is not null) yield return new KeyValuePair("prism",PrismElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); - if (AddElement is not null) yield return new KeyValuePair("add",AddElement); - if (PowerElement is not null) yield return new KeyValuePair("power",PowerElement); - if (BackCurveElement is not null) yield return new KeyValuePair("backCurve",BackCurveElement); - if (DiameterElement is not null) yield return new KeyValuePair("diameter",DiameterElement); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (BrandElement is not null) yield return new KeyValuePair("brand",BrandElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_EyeElement is not null) yield return new KeyValuePair("eye",_EyeElement); + if (_SphereElement is not null) yield return new KeyValuePair("sphere",_SphereElement); + if (_CylinderElement is not null) yield return new KeyValuePair("cylinder",_CylinderElement); + if (_AxisElement is not null) yield return new KeyValuePair("axis",_AxisElement); + if (_PrismElement is not null) yield return new KeyValuePair("prism",_PrismElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); + if (_AddElement is not null) yield return new KeyValuePair("add",_AddElement); + if (_PowerElement is not null) yield return new KeyValuePair("power",_PowerElement); + if (_BackCurveElement is not null) yield return new KeyValuePair("backCurve",_BackCurveElement); + if (_DiameterElement is not null) yield return new KeyValuePair("diameter",_DiameterElement); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_BrandElement is not null) yield return new KeyValuePair("brand",_BrandElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -747,11 +710,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -760,13 +723,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("VisionStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -775,13 +738,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -793,13 +753,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Created during encounter / admission / stay. @@ -808,41 +768,38 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When prescription was authorized. /// [FhirElement("dateWritten", Order=130, FiveWs="when.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateWrittenElement + public Hl7.Fhir.Model.FhirDateTime? DateWrittenElement { get { return _DateWrittenElement; } set { _DateWrittenElement = value; OnPropertyChanged("DateWrittenElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateWrittenElement; + private Hl7.Fhir.Model.FhirDateTime? _DateWrittenElement; /// /// When prescription was authorized /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateWritten + public string? DateWritten { - get { return DateWrittenElement != null ? DateWrittenElement.Value : null; } + get => _DateWrittenElement?.Value; set { - if (value == null) - DateWrittenElement = null; - else - DateWrittenElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateWrittenElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateWritten"); } } @@ -854,13 +811,13 @@ public string DateWritten [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescriber + public Hl7.Fhir.Model.ResourceReference? Prescriber { get { return _Prescriber; } set { _Prescriber = value; OnPropertyChanged("Prescriber"); } } - private Hl7.Fhir.Model.ResourceReference _Prescriber; + private Hl7.Fhir.Model.ResourceReference? _Prescriber; /// /// Reason or indication for writing the prescription. @@ -870,13 +827,13 @@ public Hl7.Fhir.Model.ResourceReference Prescriber [References("Condition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reason + public Hl7.Fhir.Model.DataType? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.DataType _Reason; + private Hl7.Fhir.Model.DataType? _Reason; /// /// Vision supply authorization. @@ -886,32 +843,28 @@ public Hl7.Fhir.Model.DataType Reason [DataMember] public List Dispense { - get { if(_Dispense==null) _Dispense = new List(); return _Dispense; } + get => _Dispense ?? new List(); set { _Dispense = value; OnPropertyChanged("Dispense"); } } - private List _Dispense; + private List? _Dispense; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as VisionPrescription; - - if (dest == null) - { + if(other is not VisionPrescription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateWrittenElement != null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)DateWrittenElement.DeepCopyInternal(); - if(Prescriber != null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)Prescriber.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.DataType)Reason.DeepCopyInternal(); - if(Dispense.Any()) dest.Dispense = new List(Dispense.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateWrittenElement is not null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)_DateWrittenElement.DeepCopyInternal(); + if(_Prescriber is not null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)_Prescriber.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.DataType)_Reason.DeepCopyInternal(); + if(_Dispense is not null) dest.Dispense = new List(_Dispense.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -923,83 +876,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VisionPrescription; - if(otherT == null) return false; + if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateWrittenElement, otherT.DateWrittenElement)) return false; - if(!comparer.Equals(Prescriber, otherT.Prescriber)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Dispense, otherT.Dispense)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateWrittenElement, otherT._DateWrittenElement)) return false; + if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Dispense, otherT._Dispense)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "dateWritten": - value = DateWrittenElement; - return DateWrittenElement is not null; + value = _DateWrittenElement; + return _DateWrittenElement is not null; case "prescriber": - value = Prescriber; - return Prescriber is not null; + value = _Prescriber; + return _Prescriber is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "dispense": - value = Dispense; - return Dispense?.Any() == true; + value = _Dispense; + return _Dispense?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateWritten": - DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "prescriber": - Prescriber = (Hl7.Fhir.Model.ResourceReference)value; + Prescriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.DataType)value; + Reason = (Hl7.Fhir.Model.DataType?)value; return this; case "dispense": - Dispense = (List)value; + Dispense = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1010,14 +963,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",DateWrittenElement); - if (Prescriber is not null) yield return new KeyValuePair("prescriber",Prescriber); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Dispense?.Any() == true) yield return new KeyValuePair("dispense",Dispense); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",_DateWrittenElement); + if (_Prescriber is not null) yield return new KeyValuePair("prescriber",_Prescriber); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Dispense?.Any() == true) yield return new KeyValuePair("dispense",_Dispense); } } From 6ddcec7a362ac955d88c234e16959f4eee941631 Mon Sep 17 00:00:00 2001 From: Ewout Kramer Date: Mon, 24 Feb 2025 15:44:07 +0100 Subject: [PATCH 3/6] Compiles, but with tons of warnings about possible mistakes! --- src/Hl7.Fhir.Base/Model/Generated/Bundle.cs | 4 +- src/Hl7.Fhir.Base/Model/IIdentifiable.cs | 2 +- src/Hl7.Fhir.Base/Model/IPatient.cs | 2 +- .../Model/Generated/CapabilityStatement.cs | 2 +- .../Model/Generated/CodeSystem.cs | 2 +- .../Model/Generated/ElementDefinition.cs | 4 +- .../ScopedNodeTests.cs | 2 +- src/Hl7.Fhir.R4/Model/Generated/Account.cs | 346 +- .../Model/Generated/ActivityDefinition.cs | 1046 ++-- src/Hl7.Fhir.R4/Model/Generated/Address.cs | 251 +- .../Model/Generated/AdverseEvent.cs | 512 +- src/Hl7.Fhir.R4/Model/Generated/Age.cs | 3 + .../Model/Generated/AllergyIntolerance.cs | 468 +- src/Hl7.Fhir.R4/Model/Generated/Annotation.cs | 83 +- .../Model/Generated/Appointment.cs | 550 +- .../Model/Generated/AppointmentResponse.cs | 175 +- src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs | 817 ++- src/Hl7.Fhir.R4/Model/Generated/Basic.cs | 112 +- .../Generated/BiologicallyDerivedProduct.cs | 519 +- .../Model/Generated/BodyStructure.cs | 167 +- src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs | 862 ++- src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs | 321 +- .../Model/Generated/CatalogEntry.cs | 310 +- src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs | 529 +- .../Model/Generated/ChargeItemDefinition.cs | 731 +-- src/Hl7.Fhir.R4/Model/Generated/Claim.cs | 2060 +++---- .../Model/Generated/ClaimResponse.cs | 1980 +++--- .../Model/Generated/ClinicalImpression.cs | 500 +- .../Model/Generated/Communication.cs | 461 +- .../Model/Generated/CommunicationRequest.cs | 431 +- .../Model/Generated/CompartmentDefinition.cs | 416 +- .../Model/Generated/Composition.cs | 680 +- src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs | 1000 ++- src/Hl7.Fhir.R4/Model/Generated/Condition.cs | 412 +- src/Hl7.Fhir.R4/Model/Generated/Consent.cs | 681 +- src/Hl7.Fhir.R4/Model/Generated/Contract.cs | 2578 ++++---- .../Model/Generated/Contributor.cs | 81 +- src/Hl7.Fhir.R4/Model/Generated/Count.cs | 3 + src/Hl7.Fhir.R4/Model/Generated/Coverage.cs | 531 +- .../Generated/CoverageEligibilityRequest.cs | 627 +- .../Generated/CoverageEligibilityResponse.cs | 760 ++- .../Model/Generated/DataRequirement.cs | 418 +- .../Model/Generated/DetectedIssue.cs | 364 +- src/Hl7.Fhir.R4/Model/Generated/Device.cs | 939 ++- .../Model/Generated/DeviceDefinition.cs | 801 ++- .../Model/Generated/DeviceMetric.cs | 287 +- .../Model/Generated/DeviceRequest.cs | 495 +- .../Model/Generated/DeviceUseStatement.cs | 241 +- .../Model/Generated/DiagnosticReport.cs | 389 +- src/Hl7.Fhir.R4/Model/Generated/Distance.cs | 3 + .../Model/Generated/DocumentManifest.cs | 289 +- .../Model/Generated/DocumentReference.cs | 528 +- src/Hl7.Fhir.R4/Model/Generated/Dosage.cs | 312 +- src/Hl7.Fhir.R4/Model/Generated/Duration.cs | 3 + .../Generated/EffectEvidenceSynthesis.cs | 1170 ++-- src/Hl7.Fhir.R4/Model/Generated/Encounter.cs | 867 ++- src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs | 230 +- .../Model/Generated/EnrollmentRequest.cs | 145 +- .../Model/Generated/EnrollmentResponse.cs | 177 +- .../Model/Generated/EpisodeOfCare.cs | 340 +- .../Model/Generated/EventDefinition.cs | 596 +- src/Hl7.Fhir.R4/Model/Generated/Evidence.cs | 580 +- .../Model/Generated/EvidenceVariable.cs | 720 +-- .../Model/Generated/ExampleScenario.cs | 1293 ++-- .../Model/Generated/ExplanationOfBenefit.cs | 3618 ++++++----- src/Hl7.Fhir.R4/Model/Generated/Expression.cs | 142 +- .../Model/Generated/FamilyMemberHistory.cs | 450 +- src/Hl7.Fhir.R4/Model/Generated/Flag.cs | 158 +- src/Hl7.Fhir.R4/Model/Generated/Goal.cs | 362 +- .../Model/Generated/GraphDefinition.cs | 755 +-- src/Hl7.Fhir.R4/Model/Generated/Group.cs | 374 +- .../Model/Generated/GuidanceResponse.cs | 279 +- .../Model/Generated/HealthcareService.cs | 672 +- src/Hl7.Fhir.R4/Model/Generated/HumanName.cs | 172 +- .../Model/Generated/ImagingStudy.cs | 772 ++- .../Model/Generated/Immunization.cs | 860 ++- .../Model/Generated/ImmunizationEvaluation.cs | 259 +- .../Generated/ImmunizationRecommendation.cs | 385 +- .../Model/Generated/ImplementationGuide.cs | 1414 ++--- .../Model/Generated/InsurancePlan.cs | 894 ++- src/Hl7.Fhir.R4/Model/Generated/Invoice.cs | 514 +- src/Hl7.Fhir.R4/Model/Generated/Library.cs | 646 +- src/Hl7.Fhir.R4/Model/Generated/Linkage.cs | 125 +- src/Hl7.Fhir.R4/Model/Generated/List.cs | 357 +- src/Hl7.Fhir.R4/Model/Generated/Location.cs | 530 +- .../Model/Generated/MarketingStatus.cs | 106 +- src/Hl7.Fhir.R4/Model/Generated/Measure.cs | 1275 ++-- .../Model/Generated/MeasureReport.cs | 611 +- src/Hl7.Fhir.R4/Model/Generated/Media.cs | 420 +- src/Hl7.Fhir.R4/Model/Generated/Medication.cs | 291 +- .../Generated/MedicationAdministration.cs | 505 +- .../Model/Generated/MedicationDispense.cs | 563 +- .../Model/Generated/MedicationKnowledge.cs | 1251 ++-- .../Model/Generated/MedicationRequest.cs | 809 ++- .../Model/Generated/MedicationStatement.cs | 311 +- .../Model/Generated/MedicinalProduct.cs | 785 ++- .../MedicinalProductAuthorization.cs | 481 +- .../MedicinalProductContraindication.cs | 175 +- .../Generated/MedicinalProductIndication.cs | 207 +- .../Generated/MedicinalProductIngredient.cs | 486 +- .../Generated/MedicinalProductInteraction.cs | 168 +- .../Generated/MedicinalProductManufactured.cs | 129 +- .../Generated/MedicinalProductPackaged.cs | 422 +- .../MedicinalProductPharmaceutical.cs | 418 +- .../MedicinalProductUndesirableEffect.cs | 97 +- .../Model/Generated/MessageDefinition.cs | 717 +-- .../Model/Generated/MessageHeader.cs | 506 +- .../Model/Generated/MolecularSequence.cs | 1547 +++-- src/Hl7.Fhir.R4/Model/Generated/Money.cs | 63 +- .../Model/Generated/NamingSystem.cs | 419 +- .../Model/Generated/NutritionOrder.cs | 900 ++- .../Model/Generated/Observation.cs | 634 +- .../Model/Generated/ObservationDefinition.cs | 510 +- .../Model/Generated/OperationDefinition.cs | 1049 ++-- .../Model/Generated/Organization.cs | 277 +- .../Generated/OrganizationAffiliation.cs | 216 +- .../Model/Generated/ParameterDefinition.cs | 186 +- src/Hl7.Fhir.R4/Model/Generated/Patient.cs | 537 +- .../Model/Generated/PaymentNotice.cs | 234 +- .../Model/Generated/PaymentReconciliation.cs | 543 +- src/Hl7.Fhir.R4/Model/Generated/Person.cs | 253 +- .../Model/Generated/PlanDefinition.cs | 1616 +++-- src/Hl7.Fhir.R4/Model/Generated/Population.cs | 81 +- .../Model/Generated/Practitioner.cs | 278 +- .../Model/Generated/PractitionerRole.cs | 423 +- src/Hl7.Fhir.R4/Model/Generated/Procedure.cs | 598 +- .../Model/Generated/ProdCharacteristic.cs | 214 +- .../Model/Generated/ProductShelfLife.cs | 81 +- src/Hl7.Fhir.R4/Model/Generated/Provenance.cs | 337 +- .../Model/Generated/Questionnaire.cs | 1018 ++- .../Model/Generated/QuestionnaireResponse.cs | 389 +- src/Hl7.Fhir.R4/Model/Generated/Ratio.cs | 49 +- .../Model/Generated/RelatedPerson.cs | 287 +- .../Model/Generated/RequestGroup.cs | 880 ++- .../Model/Generated/ResearchDefinition.cs | 713 +-- .../Generated/ResearchElementDefinition.cs | 956 ++- .../Model/Generated/ResearchStudy.cs | 561 +- .../Model/Generated/ResearchSubject.cs | 170 +- .../Model/Generated/RiskAssessment.cs | 437 +- .../Model/Generated/RiskEvidenceSynthesis.cs | 1074 ++-- .../Model/Generated/SampledData.cs | 173 +- src/Hl7.Fhir.R4/Model/Generated/Schedule.cs | 161 +- .../Model/Generated/SearchParameter.cs | 670 +- .../Model/Generated/ServiceRequest.cs | 609 +- src/Hl7.Fhir.R4/Model/Generated/Slot.cs | 230 +- src/Hl7.Fhir.R4/Model/Generated/Specimen.cs | 579 +- .../Model/Generated/SpecimenDefinition.cs | 568 +- .../Model/Generated/StructureMap.cs | 1467 ++--- .../Model/Generated/Subscription.cs | 279 +- src/Hl7.Fhir.R4/Model/Generated/Substance.cs | 268 +- .../Model/Generated/SubstanceAmount.cs | 136 +- .../Model/Generated/SubstanceNucleicAcid.cs | 463 +- .../Model/Generated/SubstancePolymer.cs | 564 +- .../Model/Generated/SubstanceProtein.cs | 277 +- .../SubstanceReferenceInformation.cs | 450 +- .../Generated/SubstanceSourceMaterial.cs | 761 ++- .../Model/Generated/SubstanceSpecification.cs | 1499 +++-- .../Model/Generated/SupplyDelivery.cs | 252 +- .../Model/Generated/SupplyRequest.cs | 332 +- src/Hl7.Fhir.R4/Model/Generated/Task.cs | 746 ++- .../Generated/TerminologyCapabilities.cs | 1228 ++-- src/Hl7.Fhir.R4/Model/Generated/TestReport.cs | 784 ++- src/Hl7.Fhir.R4/Model/Generated/TestScript.cs | 2470 ++++---- src/Hl7.Fhir.R4/Model/Generated/Timing.cs | 420 +- .../Model/Generated/TriggerDefinition.cs | 113 +- .../Model/Generated/VerificationResult.cs | 656 +- .../Model/Generated/VisionPrescription.cs | 542 +- src/Hl7.Fhir.R4B/Model/Generated/Account.cs | 340 +- .../Model/Generated/ActivityDefinition.cs | 1044 ++-- src/Hl7.Fhir.R4B/Model/Generated/Address.cs | 251 +- .../AdministrableProductDefinition.cs | 489 +- .../Model/Generated/AdverseEvent.cs | 508 +- src/Hl7.Fhir.R4B/Model/Generated/Age.cs | 3 + .../Model/Generated/AllergyIntolerance.cs | 462 +- .../Model/Generated/Annotation.cs | 83 +- .../Model/Generated/Appointment.cs | 548 +- .../Model/Generated/AppointmentResponse.cs | 175 +- .../Model/Generated/AuditEvent.cs | 817 ++- src/Hl7.Fhir.R4B/Model/Generated/Basic.cs | 106 +- .../Generated/BiologicallyDerivedProduct.cs | 519 +- .../Model/Generated/BodyStructure.cs | 161 +- src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs | 860 ++- src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs | 319 +- .../Model/Generated/CatalogEntry.cs | 310 +- .../Model/Generated/ChargeItem.cs | 523 +- .../Model/Generated/ChargeItemDefinition.cs | 725 +-- src/Hl7.Fhir.R4B/Model/Generated/Citation.cs | 2903 ++++----- src/Hl7.Fhir.R4B/Model/Generated/Claim.cs | 2054 +++---- .../Model/Generated/ClaimResponse.cs | 1980 +++--- .../Model/Generated/ClinicalImpression.cs | 494 +- .../Model/Generated/ClinicalUseDefinition.cs | 707 +-- .../Model/Generated/Communication.cs | 459 +- .../Model/Generated/CommunicationRequest.cs | 429 +- .../Model/Generated/CompartmentDefinition.cs | 416 +- .../Model/Generated/Composition.cs | 676 +- .../Model/Generated/ConceptMap.cs | 1000 ++- src/Hl7.Fhir.R4B/Model/Generated/Condition.cs | 406 +- src/Hl7.Fhir.R4B/Model/Generated/Consent.cs | 679 +- src/Hl7.Fhir.R4B/Model/Generated/Contract.cs | 2578 ++++---- .../Model/Generated/Contributor.cs | 81 +- src/Hl7.Fhir.R4B/Model/Generated/Count.cs | 3 + src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs | 525 +- .../Generated/CoverageEligibilityRequest.cs | 627 +- .../Generated/CoverageEligibilityResponse.cs | 760 ++- .../Model/Generated/DataRequirement.cs | 418 +- .../Model/Generated/DetectedIssue.cs | 358 +- src/Hl7.Fhir.R4B/Model/Generated/Device.cs | 933 ++- .../Model/Generated/DeviceDefinition.cs | 801 ++- .../Model/Generated/DeviceMetric.cs | 281 +- .../Model/Generated/DeviceRequest.cs | 489 +- .../Model/Generated/DeviceUseStatement.cs | 241 +- .../Model/Generated/DiagnosticReport.cs | 383 +- src/Hl7.Fhir.R4B/Model/Generated/Distance.cs | 3 + .../Model/Generated/DocumentManifest.cs | 289 +- .../Model/Generated/DocumentReference.cs | 528 +- src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs | 312 +- src/Hl7.Fhir.R4B/Model/Generated/Duration.cs | 3 + src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs | 865 ++- src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs | 230 +- .../Model/Generated/EnrollmentRequest.cs | 145 +- .../Model/Generated/EnrollmentResponse.cs | 177 +- .../Model/Generated/EpisodeOfCare.cs | 338 +- .../Model/Generated/EventDefinition.cs | 596 +- src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs | 1394 ++--- .../Model/Generated/EvidenceReport.cs | 736 ++- .../Model/Generated/EvidenceVariable.cs | 801 ++- .../Model/Generated/ExampleScenario.cs | 1293 ++-- .../Model/Generated/ExplanationOfBenefit.cs | 3612 ++++++----- .../Model/Generated/Expression.cs | 142 +- .../Model/Generated/FamilyMemberHistory.cs | 450 +- src/Hl7.Fhir.R4B/Model/Generated/Flag.cs | 152 +- src/Hl7.Fhir.R4B/Model/Generated/Goal.cs | 360 +- .../Model/Generated/GraphDefinition.cs | 755 +-- src/Hl7.Fhir.R4B/Model/Generated/Group.cs | 368 +- .../Model/Generated/GuidanceResponse.cs | 273 +- .../Model/Generated/HealthcareService.cs | 670 +- src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs | 172 +- .../Model/Generated/ImagingStudy.cs | 772 ++- .../Model/Generated/Immunization.cs | 854 ++- .../Model/Generated/ImmunizationEvaluation.cs | 259 +- .../Generated/ImmunizationRecommendation.cs | 385 +- .../Model/Generated/ImplementationGuide.cs | 1414 ++--- .../Model/Generated/Ingredient.cs | 502 +- .../Model/Generated/InsurancePlan.cs | 894 ++- src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs | 514 +- src/Hl7.Fhir.R4B/Model/Generated/Library.cs | 644 +- src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs | 125 +- src/Hl7.Fhir.R4B/Model/Generated/List.cs | 351 +- src/Hl7.Fhir.R4B/Model/Generated/Location.cs | 528 +- .../Generated/ManufacturedItemDefinition.cs | 182 +- .../Model/Generated/MarketingStatus.cs | 106 +- src/Hl7.Fhir.R4B/Model/Generated/Measure.cs | 1273 ++-- .../Model/Generated/MeasureReport.cs | 611 +- src/Hl7.Fhir.R4B/Model/Generated/Media.cs | 420 +- .../Model/Generated/Medication.cs | 285 +- .../Generated/MedicationAdministration.cs | 499 +- .../Model/Generated/MedicationDispense.cs | 557 +- .../Model/Generated/MedicationKnowledge.cs | 1245 ++-- .../Model/Generated/MedicationRequest.cs | 803 ++- .../Model/Generated/MedicationStatement.cs | 305 +- .../Generated/MedicinalProductDefinition.cs | 921 ++- .../Model/Generated/MessageDefinition.cs | 711 +-- .../Model/Generated/MessageHeader.cs | 506 +- .../Model/Generated/MolecularSequence.cs | 1547 +++-- src/Hl7.Fhir.R4B/Model/Generated/Money.cs | 63 +- .../Model/Generated/NamingSystem.cs | 419 +- .../Model/Generated/NutritionOrder.cs | 900 ++- .../Model/Generated/NutritionProduct.cs | 443 +- .../Model/Generated/Observation.cs | 628 +- .../Model/Generated/ObservationDefinition.cs | 504 +- .../Model/Generated/OperationDefinition.cs | 1043 ++-- .../Model/Generated/Organization.cs | 277 +- .../Generated/OrganizationAffiliation.cs | 216 +- .../Generated/PackagedProductDefinition.cs | 656 +- .../Model/Generated/ParameterDefinition.cs | 186 +- src/Hl7.Fhir.R4B/Model/Generated/Patient.cs | 535 +- .../Model/Generated/PaymentNotice.cs | 234 +- .../Model/Generated/PaymentReconciliation.cs | 543 +- src/Hl7.Fhir.R4B/Model/Generated/Person.cs | 253 +- .../Model/Generated/PlanDefinition.cs | 1616 +++-- .../Model/Generated/Population.cs | 81 +- .../Model/Generated/Practitioner.cs | 278 +- .../Model/Generated/PractitionerRole.cs | 421 +- src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs | 592 +- .../Model/Generated/ProdCharacteristic.cs | 214 +- .../Model/Generated/ProductShelfLife.cs | 81 +- .../Model/Generated/Provenance.cs | 337 +- .../Model/Generated/Questionnaire.cs | 1012 ++- .../Model/Generated/QuestionnaireResponse.cs | 389 +- src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs | 49 +- .../Model/Generated/RatioRange.cs | 65 +- .../Model/Generated/RegulatedAuthorization.cs | 353 +- .../Model/Generated/RelatedPerson.cs | 285 +- .../Model/Generated/RequestGroup.cs | 874 ++- .../Model/Generated/ResearchDefinition.cs | 713 +-- .../Generated/ResearchElementDefinition.cs | 956 ++- .../Model/Generated/ResearchStudy.cs | 561 +- .../Model/Generated/ResearchSubject.cs | 170 +- .../Model/Generated/RiskAssessment.cs | 431 +- .../Model/Generated/SampledData.cs | 173 +- src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs | 161 +- .../Model/Generated/SearchParameter.cs | 668 +- .../Model/Generated/ServiceRequest.cs | 603 +- src/Hl7.Fhir.R4B/Model/Generated/Slot.cs | 230 +- src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs | 573 +- .../Model/Generated/SpecimenDefinition.cs | 568 +- .../Model/Generated/StructureMap.cs | 1467 ++--- .../Model/Generated/Subscription.cs | 279 +- .../Model/Generated/SubscriptionStatus.cs | 255 +- .../Model/Generated/SubscriptionTopic.cs | 1038 ++-- src/Hl7.Fhir.R4B/Model/Generated/Substance.cs | 262 +- .../Model/Generated/SubstanceDefinition.cs | 1461 +++-- .../Model/Generated/SupplyDelivery.cs | 246 +- .../Model/Generated/SupplyRequest.cs | 326 +- src/Hl7.Fhir.R4B/Model/Generated/Task.cs | 740 ++- .../Generated/TerminologyCapabilities.cs | 1228 ++-- .../Model/Generated/TestReport.cs | 784 ++- .../Model/Generated/TestScript.cs | 2470 ++++---- src/Hl7.Fhir.R4B/Model/Generated/Timing.cs | 420 +- .../Model/Generated/TriggerDefinition.cs | 113 +- .../Model/Generated/VerificationResult.cs | 656 +- .../Model/Generated/VisionPrescription.cs | 542 +- src/Hl7.Fhir.R5/Model/Generated/Account.cs | 833 ++- .../Model/Generated/ActivityDefinition.cs | 1176 ++-- .../Model/Generated/ActorDefinition.cs | 510 +- src/Hl7.Fhir.R5/Model/Generated/Address.cs | 251 +- .../AdministrableProductDefinition.cs | 514 +- .../Model/Generated/AdverseEvent.cs | 714 +-- src/Hl7.Fhir.R5/Model/Generated/Age.cs | 3 + .../Model/Generated/AllergyIntolerance.cs | 485 +- src/Hl7.Fhir.R5/Model/Generated/Annotation.cs | 83 +- .../Model/Generated/Appointment.cs | 1241 ++-- .../Model/Generated/AppointmentResponse.cs | 269 +- .../Model/Generated/ArtifactAssessment.cs | 455 +- src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs | 690 +-- .../Model/Generated/Availability.cs | 213 +- src/Hl7.Fhir.R5/Model/Generated/Basic.cs | 106 +- .../Generated/BiologicallyDerivedProduct.cs | 351 +- .../BiologicallyDerivedProductDispense.cs | 353 +- .../Model/Generated/BodyStructure.cs | 379 +- src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs | 500 +- src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs | 287 +- src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs | 507 +- .../Model/Generated/ChargeItemDefinition.cs | 681 +- src/Hl7.Fhir.R5/Model/Generated/Citation.cs | 2582 ++++---- src/Hl7.Fhir.R5/Model/Generated/Claim.cs | 2402 ++++---- .../Model/Generated/ClaimResponse.cs | 2583 ++++---- .../Model/Generated/ClinicalImpression.cs | 416 +- .../Model/Generated/ClinicalUseDefinition.cs | 761 ++- .../Model/Generated/Communication.cs | 443 +- .../Model/Generated/CommunicationRequest.cs | 436 +- .../Model/Generated/CompartmentDefinition.cs | 507 +- .../Model/Generated/Composition.cs | 657 +- src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs | 1588 +++-- src/Hl7.Fhir.R5/Model/Generated/Condition.cs | 390 +- .../Model/Generated/ConditionDefinition.cs | 854 ++- src/Hl7.Fhir.R5/Model/Generated/Consent.cs | 795 ++- src/Hl7.Fhir.R5/Model/Generated/Contract.cs | 2540 ++++---- .../Model/Generated/Contributor.cs | 81 +- src/Hl7.Fhir.R5/Model/Generated/Count.cs | 3 + src/Hl7.Fhir.R5/Model/Generated/Coverage.cs | 681 +- .../Generated/CoverageEligibilityRequest.cs | 689 +-- .../Generated/CoverageEligibilityResponse.cs | 844 ++- .../Model/Generated/DataRequirement.cs | 537 +- .../Model/Generated/DetectedIssue.cs | 406 +- src/Hl7.Fhir.R5/Model/Generated/Device.cs | 1077 ++-- .../Model/Generated/DeviceAssociation.cs | 223 +- .../Model/Generated/DeviceDefinition.cs | 1692 +++-- .../Model/Generated/DeviceDispense.cs | 433 +- .../Model/Generated/DeviceMetric.cs | 267 +- .../Model/Generated/DeviceRequest.cs | 542 +- .../Model/Generated/DeviceUsage.cs | 351 +- .../Model/Generated/DiagnosticReport.cs | 477 +- src/Hl7.Fhir.R5/Model/Generated/Distance.cs | 3 + .../Model/Generated/DocumentReference.cs | 617 +- src/Hl7.Fhir.R5/Model/Generated/Dosage.cs | 335 +- src/Hl7.Fhir.R5/Model/Generated/Duration.cs | 3 + src/Hl7.Fhir.R5/Model/Generated/Encounter.cs | 839 ++- .../Model/Generated/EncounterHistory.cs | 296 +- src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs | 301 +- .../Model/Generated/EnrollmentRequest.cs | 145 +- .../Model/Generated/EnrollmentResponse.cs | 177 +- .../Model/Generated/EpisodeOfCare.cs | 377 +- .../Model/Generated/EventDefinition.cs | 637 +- src/Hl7.Fhir.R5/Model/Generated/Evidence.cs | 1533 +++-- .../Model/Generated/EvidenceReport.cs | 832 ++- .../Model/Generated/EvidenceVariable.cs | 1251 ++-- .../Model/Generated/ExampleScenario.cs | 1469 ++--- .../Model/Generated/ExplanationOfBenefit.cs | 4431 +++++++------ src/Hl7.Fhir.R5/Model/Generated/Expression.cs | 142 +- .../Model/Generated/ExtendedContactDetail.cs | 113 +- .../Model/Generated/FamilyMemberHistory.cs | 613 +- src/Hl7.Fhir.R5/Model/Generated/Flag.cs | 152 +- .../Model/Generated/FormularyItem.cs | 72 +- .../Model/Generated/GenomicStudy.cs | 838 ++- src/Hl7.Fhir.R5/Model/Generated/Goal.cs | 367 +- .../Model/Generated/GraphDefinition.cs | 923 ++- src/Hl7.Fhir.R5/Model/Generated/Group.cs | 393 +- .../Model/Generated/GuidanceResponse.cs | 257 +- .../Model/Generated/HealthcareService.cs | 481 +- src/Hl7.Fhir.R5/Model/Generated/HumanName.cs | 172 +- .../Model/Generated/ICanonicalResource.cs | 5467 +++++++++++++---- .../Model/Generated/IMetadataResource.cs | 1058 +++- .../Model/Generated/ImagingSelection.cs | 633 +- .../Model/Generated/ImagingStudy.cs | 740 ++- .../Model/Generated/Immunization.cs | 795 ++- .../Model/Generated/ImmunizationEvaluation.cs | 277 +- .../Generated/ImmunizationRecommendation.cs | 403 +- .../Model/Generated/ImplementationGuide.cs | 1597 +++-- src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs | 559 +- .../Model/Generated/InsurancePlan.cs | 816 ++- .../Model/Generated/InventoryItem.cs | 654 +- .../Model/Generated/InventoryReport.cs | 349 +- src/Hl7.Fhir.R5/Model/Generated/Invoice.cs | 479 +- src/Hl7.Fhir.R5/Model/Generated/Library.cs | 685 +-- src/Hl7.Fhir.R5/Model/Generated/Linkage.cs | 125 +- src/Hl7.Fhir.R5/Model/Generated/List.cs | 351 +- src/Hl7.Fhir.R5/Model/Generated/Location.cs | 426 +- .../Generated/ManufacturedItemDefinition.cs | 427 +- .../Model/Generated/MarketingStatus.cs | 106 +- src/Hl7.Fhir.R5/Model/Generated/Measure.cs | 1766 +++--- .../Model/Generated/MeasureReport.cs | 919 ++- src/Hl7.Fhir.R5/Model/Generated/Medication.cs | 301 +- .../Generated/MedicationAdministration.cs | 541 +- .../Model/Generated/MedicationDispense.cs | 632 +- .../Model/Generated/MedicationKnowledge.cs | 1429 ++--- .../Model/Generated/MedicationRequest.cs | 864 ++- .../Model/Generated/MedicationStatement.cs | 360 +- .../Generated/MedicinalProductDefinition.cs | 937 ++- .../Model/Generated/MessageDefinition.cs | 755 +-- .../Model/Generated/MessageHeader.cs | 463 +- .../Model/Generated/MolecularSequence.cs | 558 +- .../Model/Generated/MonetaryComponent.cs | 95 +- src/Hl7.Fhir.R5/Model/Generated/Money.cs | 63 +- .../Model/Generated/NamingSystem.cs | 809 ++- .../Model/Generated/NutritionIntake.cs | 590 +- .../Model/Generated/NutritionOrder.cs | 1279 ++-- .../Model/Generated/NutritionProduct.cs | 484 +- .../Model/Generated/Observation.cs | 770 ++- .../Model/Generated/ObservationDefinition.cs | 1118 ++-- .../Model/Generated/OperationDefinition.cs | 1169 ++-- .../Model/Generated/Organization.cs | 286 +- .../Generated/OrganizationAffiliation.cs | 216 +- .../Generated/PackagedProductDefinition.cs | 633 +- .../Model/Generated/ParameterDefinition.cs | 186 +- src/Hl7.Fhir.R5/Model/Generated/Patient.cs | 535 +- .../Model/Generated/PaymentNotice.cs | 234 +- .../Model/Generated/PaymentReconciliation.cs | 869 ++- src/Hl7.Fhir.R5/Model/Generated/Permission.cs | 473 +- src/Hl7.Fhir.R5/Model/Generated/Person.cs | 354 +- .../Model/Generated/PlanDefinition.cs | 2169 +++---- .../Model/Generated/Practitioner.cs | 347 +- .../Model/Generated/PractitionerRole.cs | 248 +- src/Hl7.Fhir.R5/Model/Generated/Procedure.cs | 617 +- .../Model/Generated/ProductShelfLife.cs | 65 +- src/Hl7.Fhir.R5/Model/Generated/Provenance.cs | 385 +- .../Model/Generated/Questionnaire.cs | 1099 ++-- .../Model/Generated/QuestionnaireResponse.cs | 385 +- src/Hl7.Fhir.R5/Model/Generated/Ratio.cs | 49 +- src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs | 65 +- .../Model/Generated/RegulatedAuthorization.cs | 369 +- .../Model/Generated/RelatedPerson.cs | 285 +- .../Model/Generated/RequestOrchestration.cs | 1384 ++--- .../Model/Generated/Requirements.cs | 719 +-- .../Model/Generated/ResearchStudy.cs | 1231 ++-- .../Model/Generated/ResearchSubject.cs | 314 +- .../Model/Generated/RiskAssessment.cs | 415 +- .../Model/Generated/SampledData.cs | 248 +- src/Hl7.Fhir.R5/Model/Generated/Schedule.cs | 186 +- .../Model/Generated/SearchParameter.cs | 775 ++- .../Model/Generated/ServiceRequest.cs | 716 ++- src/Hl7.Fhir.R5/Model/Generated/Slot.cs | 230 +- src/Hl7.Fhir.R5/Model/Generated/Specimen.cs | 658 +- .../Model/Generated/SpecimenDefinition.cs | 1093 ++-- .../Model/Generated/StructureMap.cs | 1568 +++-- .../Model/Generated/Subscription.cs | 575 +- .../Model/Generated/SubscriptionStatus.cs | 251 +- .../Model/Generated/SubscriptionTopic.cs | 1126 ++-- src/Hl7.Fhir.R5/Model/Generated/Substance.cs | 239 +- .../Model/Generated/SubstanceDefinition.cs | 1628 +++-- .../Model/Generated/SubstanceNucleicAcid.cs | 463 +- .../Model/Generated/SubstancePolymer.cs | 640 +- .../Model/Generated/SubstanceProtein.cs | 277 +- .../SubstanceReferenceInformation.cs | 356 +- .../Generated/SubstanceSourceMaterial.cs | 761 ++- .../Model/Generated/SupplyDelivery.cs | 246 +- .../Model/Generated/SupplyRequest.cs | 342 +- src/Hl7.Fhir.R5/Model/Generated/Task.cs | 825 ++- .../Generated/TerminologyCapabilities.cs | 1308 ++-- src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs | 959 ++- src/Hl7.Fhir.R5/Model/Generated/TestReport.cs | 839 ++- src/Hl7.Fhir.R5/Model/Generated/TestScript.cs | 2746 ++++----- src/Hl7.Fhir.R5/Model/Generated/Timing.cs | 420 +- src/Hl7.Fhir.R5/Model/Generated/Transport.cs | 765 ++- .../Model/Generated/TriggerDefinition.cs | 154 +- .../Model/Generated/VerificationResult.cs | 656 +- .../Model/Generated/VirtualServiceDetail.cs | 119 +- .../Model/Generated/VisionPrescription.cs | 542 +- .../Model/Generated/AdverseEvent.cs | 4 +- .../Model/Generated/AllergyIntolerance.cs | 2 +- .../Model/Generated/CapabilityStatement.cs | 2 +- .../Model/Generated/ChargeItem.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Claim.cs | 8 +- .../Model/Generated/ClaimResponse.cs | 12 +- .../Model/Generated/CodeSystem.cs | 6 +- .../Model/Generated/Composition.cs | 6 +- .../Model/Generated/ConceptMap.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Consent.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Contract.cs | 4 +- .../Model/Generated/DetectedIssue.cs | 4 +- .../Model/Generated/DeviceComponent.cs | 4 +- .../Model/Generated/DeviceMetric.cs | 4 +- .../Model/Generated/ElementDefinition.cs | 4 +- .../Model/Generated/ExpansionProfile.cs | 4 +- .../Model/Generated/ExplanationOfBenefit.cs | 20 +- .../Model/Generated/GuidanceResponse.cs | 4 +- .../Model/Generated/HealthcareService.cs | 2 +- .../Model/Generated/ImagingManifest.cs | 4 +- .../Model/Generated/ImplementationGuide.cs | 2 +- .../Model/Generated/MeasureReport.cs | 4 +- .../Model/Generated/MessageDefinition.cs | 4 +- .../Model/Generated/OperationDefinition.cs | 2 +- .../Model/Generated/PractitionerRole.cs | 2 +- .../Model/Generated/Questionnaire.cs | 2 +- .../Model/Generated/QuestionnaireResponse.cs | 4 +- .../Model/Generated/ResearchSubject.cs | 4 +- .../Model/Generated/RiskAssessment.cs | 4 +- .../Model/Generated/SearchParameter.cs | 8 +- .../Model/Generated/StructureMap.cs | 2 +- .../Model/Generated/SupplyDelivery.cs | 4 +- .../Model/Generated/SupplyRequest.cs | 4 +- .../Model/Generated/TestReport.cs | 4 +- .../Model/Generated/TestScript.cs | 6 +- src/Hl7.Fhir.STU3/Model/Generated/Timing.cs | 4 +- src/firely-net-sdk-tests.props | 2 +- src/firely-net-sdk.props | 2 +- 536 files changed, 144128 insertions(+), 160509 deletions(-) diff --git a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs index c0cc42012..592729fde 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Bundle","http://hl7.org/fhir/StructureDefinition/Bundle")] - public partial class Bundle : Hl7.Fhir.Model.Resource, IIdentifiable + public partial class Bundle : Hl7.Fhir.Model.Resource, IIdentifiable { /// /// FHIR Type Name @@ -2168,7 +2168,7 @@ public Hl7.Fhir.Model.Resource? Issues private Hl7.Fhir.Model.Resource? _Issues; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.Base/Model/IIdentifiable.cs b/src/Hl7.Fhir.Base/Model/IIdentifiable.cs index f07549326..5defa18b2 100644 --- a/src/Hl7.Fhir.Base/Model/IIdentifiable.cs +++ b/src/Hl7.Fhir.Base/Model/IIdentifiable.cs @@ -30,7 +30,7 @@ public interface IIdentifiable /// The type that is used to identify the resource, usually a (list of) . public interface IIdentifiable : IIdentifiable { - T? Identifier { get; set; } + T Identifier { get; set; } } diff --git a/src/Hl7.Fhir.Base/Model/IPatient.cs b/src/Hl7.Fhir.Base/Model/IPatient.cs index 73e6c36ba..a00ad8736 100644 --- a/src/Hl7.Fhir.Base/Model/IPatient.cs +++ b/src/Hl7.Fhir.Base/Model/IPatient.cs @@ -16,7 +16,7 @@ namespace Hl7.Fhir.Model /// public interface IPatient { - Date BirthDate { get; } + Date? BirthDate { get; } } } #nullable restore \ No newline at end of file diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs index e064a4a99..119511634 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs @@ -1599,7 +1599,7 @@ public List> Re /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ReferencePolicy + public IEnumerable? ReferencePolicy { get => _ReferencePolicyElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs index 340eb1170..482b8e746 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs @@ -243,7 +243,7 @@ public List> OperatorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Operator + public IEnumerable? Operator { get => _OperatorElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs index e9eb19bda..cb0f98df2 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs @@ -971,7 +971,7 @@ public List> AggregationE /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Aggregation + public IEnumerable? Aggregation { get => _AggregationElement?.Select(elem => elem.Value); set @@ -2470,7 +2470,7 @@ public List> Repre /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Representation + public IEnumerable? Representation { get => _RepresentationElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.ElementModel.Shared.Tests/ScopedNodeTests.cs b/src/Hl7.Fhir.ElementModel.Shared.Tests/ScopedNodeTests.cs index d9c28ac5d..325ffd226 100644 --- a/src/Hl7.Fhir.ElementModel.Shared.Tests/ScopedNodeTests.cs +++ b/src/Hl7.Fhir.ElementModel.Shared.Tests/ScopedNodeTests.cs @@ -305,7 +305,7 @@ public async Tasks.Task ResolveByCanonicalUriAsync(string uri) { var snapShotGenerator = new SnapshotGenerator(_coreResolver); await snapShotGenerator.UpdateAsync(sd); - _cache.Add(sd.Url, sd); + _cache.Add(sd.Url ?? throw new InvalidOperationException("SD without url, which has just been resolved by url?"), sd); } return sd; diff --git a/src/Hl7.Fhir.R4/Model/Generated/Account.cs b/src/Hl7.Fhir.R4/Model/Generated/Account.cs index 07276b34e..51dbbc7de 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Account.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Account","http://hl7.org/fhir/StructureDefinition/Account")] - public partial class Account : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Account : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -125,26 +128,26 @@ public partial class CoverageComponent : Hl7.Fhir.Model.BackboneElement [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// The priority of the coverage in the context of this account. /// [FhirElement("priority", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PriorityElement + public Hl7.Fhir.Model.PositiveInt? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Hl7.Fhir.Model.PositiveInt _PriorityElement; + private Hl7.Fhir.Model.PositiveInt? _PriorityElement; /// /// The priority of the coverage in the context of this account @@ -153,29 +156,22 @@ public Hl7.Fhir.Model.PositiveInt PriorityElement [IgnoreDataMember] public int? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Hl7.Fhir.Model.PositiveInt(value); + PriorityElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Priority"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageComponent; - - if (dest == null) - { + if(other is not CoverageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)PriorityElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)_PriorityElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -187,41 +183,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageComponent; - if(otherT == null) return false; + if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - PriorityElement = (Hl7.Fhir.Model.PositiveInt)value; + PriorityElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -232,8 +228,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); } } @@ -262,26 +258,26 @@ public partial class GuarantorComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Credit or other hold applied. /// [FhirElement("onHold", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OnHoldElement + public Hl7.Fhir.Model.FhirBoolean? OnHoldElement { get { return _OnHoldElement; } set { _OnHoldElement = value; OnPropertyChanged("OnHoldElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OnHoldElement; + private Hl7.Fhir.Model.FhirBoolean? _OnHoldElement; /// /// Credit or other hold applied @@ -290,13 +286,10 @@ public Hl7.Fhir.Model.FhirBoolean OnHoldElement [IgnoreDataMember] public bool? OnHold { - get { return OnHoldElement != null ? OnHoldElement.Value : null; } + get => _OnHoldElement?.Value; set { - if (value == null) - OnHoldElement = null; - else - OnHoldElement = new Hl7.Fhir.Model.FhirBoolean(value); + OnHoldElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("OnHold"); } } @@ -306,27 +299,23 @@ public bool? OnHold /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as GuarantorComponent; - - if (dest == null) - { + if(other is not GuarantorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(OnHoldElement != null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)OnHoldElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_OnHoldElement is not null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)_OnHoldElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -338,48 +327,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuarantorComponent; - if(otherT == null) return false; + if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.Equals(OnHoldElement, otherT.OnHoldElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "onHold": - value = OnHoldElement; - return OnHoldElement is not null; + value = _OnHoldElement; + return _OnHoldElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onHold": - OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)value; + OnHoldElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -390,9 +379,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Party is not null) yield return new KeyValuePair("party",Party); - if (OnHoldElement is not null) yield return new KeyValuePair("onHold",OnHoldElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_OnHoldElement is not null) yield return new KeyValuePair("onHold",_OnHoldElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -405,11 +394,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error | on-hold | unknown. @@ -419,13 +408,13 @@ public List Identifier [Binding("AccountStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error | on-hold | unknown @@ -434,13 +423,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Account.AccountStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -451,41 +437,38 @@ public Hl7.Fhir.Model.Account.AccountStatus? Status [FhirElement("type", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("AccountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Human-readable label. /// [FhirElement("name", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -500,24 +483,24 @@ public string Name [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Transaction window. /// [FhirElement("servicePeriod", InSummary=true, Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ServicePeriod + public Hl7.Fhir.Model.Period? ServicePeriod { get { return _ServicePeriod; } set { _ServicePeriod = value; OnPropertyChanged("ServicePeriod"); } } - private Hl7.Fhir.Model.Period _ServicePeriod; + private Hl7.Fhir.Model.Period? _ServicePeriod; /// /// The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account. @@ -527,11 +510,11 @@ public Hl7.Fhir.Model.Period ServicePeriod [DataMember] public List Coverage { - get { if(_Coverage==null) _Coverage = new List(); return _Coverage; } + get => _Coverage ?? new List(); set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private List _Coverage; + private List? _Coverage; /// /// Entity managing the Account. @@ -540,41 +523,38 @@ public List Coverage [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Explanation of purpose/use. /// [FhirElement("description", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Explanation of purpose/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -587,11 +567,11 @@ public string Description [DataMember] public List Guarantor { - get { if(_Guarantor==null) _Guarantor = new List(); return _Guarantor; } + get => _Guarantor ?? new List(); set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } - private List _Guarantor; + private List? _Guarantor; /// /// Reference to a parent Account. @@ -600,40 +580,36 @@ public List Guarantor [CLSCompliant(false)] [References("Account")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Account; - - if (dest == null) - { + if(other is not Account dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(ServicePeriod != null) dest.ServicePeriod = (Hl7.Fhir.Model.Period)ServicePeriod.DeepCopyInternal(); - if(Coverage.Any()) dest.Coverage = new List(Coverage.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Guarantor.Any()) dest.Guarantor = new List(Guarantor.DeepCopyInternal()); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_ServicePeriod is not null) dest.ServicePeriod = (Hl7.Fhir.Model.Period)_ServicePeriod.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = new List(_Coverage.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Guarantor is not null) dest.Guarantor = new List(_Guarantor.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -645,104 +621,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Account; - if(otherT == null) return false; + if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(ServicePeriod, otherT.ServicePeriod)) return false; - if(!comparer.ListEquals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Guarantor, otherT.Guarantor)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_ServicePeriod, otherT._ServicePeriod)) return false; + if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Guarantor, otherT._Guarantor)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "servicePeriod": - value = ServicePeriod; - return ServicePeriod is not null; + value = _ServicePeriod; + return _ServicePeriod is not null; case "coverage": - value = Coverage; - return Coverage?.Any() == true; + value = _Coverage; + return _Coverage?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "guarantor": - value = Guarantor; - return Guarantor?.Any() == true; + value = _Guarantor; + return _Guarantor?.Any() == true; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "servicePeriod": - ServicePeriod = (Hl7.Fhir.Model.Period)value; + ServicePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "coverage": - Coverage = (List)value; + Coverage = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "guarantor": - Guarantor = (List)value; + Guarantor = (List?)value!; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -753,17 +729,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (ServicePeriod is not null) yield return new KeyValuePair("servicePeriod",ServicePeriod); - if (Coverage?.Any() == true) yield return new KeyValuePair("coverage",Coverage); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",Guarantor); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_ServicePeriod is not null) yield return new KeyValuePair("servicePeriod",_ServicePeriod); + if (_Coverage?.Any() == true) yield return new KeyValuePair("coverage",_Coverage); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",_Guarantor); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs index 5c1940ba1..18cde249f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -183,13 +186,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActivityParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// patient | practitioner | related-person | device @@ -198,13 +201,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -215,26 +215,22 @@ public Hl7.Fhir.Model.ActionParticipantType? Type [FhirElement("role", Order=50)] [Binding("ActivityParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -246,41 +242,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -291,8 +287,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -320,28 +316,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("path", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -352,26 +345,22 @@ public string Path [FhirElement("expression", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -383,41 +372,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -428,8 +417,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -439,28 +428,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this activity definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -473,39 +459,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the activity definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -515,28 +498,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this activity definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -546,28 +526,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this activity definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -577,28 +554,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -611,13 +585,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -626,13 +600,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -642,13 +613,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -657,13 +628,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -677,41 +645,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -721,28 +686,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -755,39 +717,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the activity definition. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -800,11 +759,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for activity definition (if applicable). @@ -815,39 +774,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this activity definition is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this activity definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -857,28 +813,25 @@ public string Purpose /// [FhirElement("usage", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -888,28 +841,25 @@ public string Usage /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -919,28 +869,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the activity definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -950,28 +897,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the activity definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -981,13 +925,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -998,11 +942,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1012,11 +956,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1026,11 +970,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1040,11 +984,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1054,11 +998,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1068,11 +1012,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the activity definition. @@ -1082,24 +1026,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1113,13 +1057,13 @@ public IEnumerable Library [DeclaredType(Type = typeof(Code))] [Binding("ActivityDefinitionKind")] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// Kind of resource @@ -1128,13 +1072,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActivityDefinition.RequestResourceType? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1144,28 +1085,25 @@ public Hl7.Fhir.Model.ActivityDefinition.RequestResourceType? Kind /// [FhirElement("profile", Order=380)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// What profile the resource needs to conform to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -1176,13 +1114,13 @@ public string Profile [FhirElement("code", InSummary=true, Order=390)] [Binding("ActivityDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option. @@ -1191,13 +1129,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("RequestIntent")] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -1206,13 +1144,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1224,13 +1159,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -1239,13 +1174,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -1255,13 +1187,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=420)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if the activity should not be performed @@ -1270,13 +1202,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -1288,13 +1217,13 @@ public bool? DoNotPerform [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Where it should happen. @@ -1303,13 +1232,13 @@ public Hl7.Fhir.Model.DataType Timing [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Who should participate in the action. @@ -1319,11 +1248,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// What's administered/supplied. @@ -1334,26 +1263,26 @@ public List Participant [References("Medication","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// How much is administered/consumed/supplied. /// [FhirElement("quantity", Order=470)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Detailed dosage instructions. @@ -1363,11 +1292,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// What part of body to perform on. @@ -1378,11 +1307,11 @@ public List Dosage [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// What specimens are required to perform this action. @@ -1394,11 +1323,11 @@ public List BodySite [DataMember] public List SpecimenRequirement { - get { if(_SpecimenRequirement==null) _SpecimenRequirement = new List(); return _SpecimenRequirement; } + get => _SpecimenRequirement ?? new List(); set { _SpecimenRequirement = value; OnPropertyChanged("SpecimenRequirement"); } } - private List _SpecimenRequirement; + private List? _SpecimenRequirement; /// /// What observations are required to perform this action. @@ -1410,11 +1339,11 @@ public List SpecimenRequirement [DataMember] public List ObservationRequirement { - get { if(_ObservationRequirement==null) _ObservationRequirement = new List(); return _ObservationRequirement; } + get => _ObservationRequirement ?? new List(); set { _ObservationRequirement = value; OnPropertyChanged("ObservationRequirement"); } } - private List _ObservationRequirement; + private List? _ObservationRequirement; /// /// What observations must be produced by this action. @@ -1426,39 +1355,36 @@ public List ObservationRequirement [DataMember] public List ObservationResultRequirement { - get { if(_ObservationResultRequirement==null) _ObservationResultRequirement = new List(); return _ObservationResultRequirement; } + get => _ObservationResultRequirement ?? new List(); set { _ObservationResultRequirement = value; OnPropertyChanged("ObservationResultRequirement"); } } - private List _ObservationResultRequirement; + private List? _ObservationResultRequirement; /// /// Transform to apply the template. /// [FhirElement("transform", Order=530)] [DataMember] - public Hl7.Fhir.Model.Canonical TransformElement + public Hl7.Fhir.Model.Canonical? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Hl7.Fhir.Model.Canonical _TransformElement; + private Hl7.Fhir.Model.Canonical? _TransformElement; /// /// Transform to apply the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Transform + public string? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Hl7.Fhir.Model.Canonical(value); + TransformElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Transform"); } } @@ -1471,73 +1397,69 @@ public string Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Topic; set => Topic = value; } - IEnumerable ICoded.ToCodings() => Topic.ToCodings(); + IEnumerable ICoded.ToCodings() => Topic?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityDefinition; - - if (dest == null) - { + if(other is not ActivityDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(SpecimenRequirement.Any()) dest.SpecimenRequirement = new List(SpecimenRequirement.DeepCopyInternal()); - if(ObservationRequirement.Any()) dest.ObservationRequirement = new List(ObservationRequirement.DeepCopyInternal()); - if(ObservationResultRequirement.Any()) dest.ObservationResultRequirement = new List(ObservationResultRequirement.DeepCopyInternal()); - if(TransformElement != null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)TransformElement.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_SpecimenRequirement is not null) dest.SpecimenRequirement = new List(_SpecimenRequirement.DeepCopyInternal()); + if(_ObservationRequirement is not null) dest.ObservationRequirement = new List(_ObservationRequirement.DeepCopyInternal()); + if(_ObservationResultRequirement is not null) dest.ObservationResultRequirement = new List(_ObservationResultRequirement.DeepCopyInternal()); + if(_TransformElement is not null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)_TransformElement.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1549,349 +1471,349 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityDefinition; - if(otherT == null) return false; + if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SpecimenRequirement, otherT.SpecimenRequirement)) return false; - if(!comparer.ListEquals(ObservationRequirement, otherT.ObservationRequirement)) return false; - if(!comparer.ListEquals(ObservationResultRequirement, otherT.ObservationResultRequirement)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SpecimenRequirement, otherT._SpecimenRequirement)) return false; + if(!comparer.ListEquals(_ObservationRequirement, otherT._ObservationRequirement)) return false; + if(!comparer.ListEquals(_ObservationResultRequirement, otherT._ObservationResultRequirement)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "specimenRequirement": - value = SpecimenRequirement; - return SpecimenRequirement?.Any() == true; + value = _SpecimenRequirement; + return _SpecimenRequirement?.Any() == true; case "observationRequirement": - value = ObservationRequirement; - return ObservationRequirement?.Any() == true; + value = _ObservationRequirement; + return _ObservationRequirement?.Any() == true; case "observationResultRequirement": - value = ObservationResultRequirement; - return ObservationResultRequirement?.Any() == true; + value = _ObservationResultRequirement; + return _ObservationResultRequirement?.Any() == true; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "specimenRequirement": - SpecimenRequirement = (List)value; + SpecimenRequirement = (List?)value!; return this; case "observationRequirement": - ObservationRequirement = (List)value; + ObservationRequirement = (List?)value!; return this; case "observationResultRequirement": - ObservationResultRequirement = (List)value; + ObservationResultRequirement = (List?)value!; return this; case "transform": - TransformElement = (Hl7.Fhir.Model.Canonical)value; + TransformElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1902,52 +1824,52 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (SpecimenRequirement?.Any() == true) yield return new KeyValuePair("specimenRequirement",SpecimenRequirement); - if (ObservationRequirement?.Any() == true) yield return new KeyValuePair("observationRequirement",ObservationRequirement); - if (ObservationResultRequirement?.Any() == true) yield return new KeyValuePair("observationResultRequirement",ObservationResultRequirement); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_SpecimenRequirement?.Any() == true) yield return new KeyValuePair("specimenRequirement",_SpecimenRequirement); + if (_ObservationRequirement?.Any() == true) yield return new KeyValuePair("observationRequirement",_ObservationRequirement); + if (_ObservationResultRequirement?.Any() == true) yield return new KeyValuePair("observationResultRequirement",_ObservationResultRequirement); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Address.cs b/src/Hl7.Fhir.R4/Model/Generated/Address.cs index 100f9f701..6d2805ec6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Address.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -135,13 +138,13 @@ public enum AddressType [DeclaredType(Type = typeof(Code))] [Binding("AddressUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// home | work | temp | old | billing - purpose of this address @@ -150,13 +153,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -168,13 +168,13 @@ public Hl7.Fhir.Model.Address.AddressUse? Use [DeclaredType(Type = typeof(Code))] [Binding("AddressType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// postal | physical | both @@ -183,13 +183,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -199,28 +196,25 @@ public Hl7.Fhir.Model.Address.AddressType? Type /// [FhirElement("text", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the address /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -233,24 +227,24 @@ public string Text [DataMember] public List LineElement { - get { if(_LineElement==null) _LineElement = new List(); return _LineElement; } + get => _LineElement ?? new List(); set { _LineElement = value; OnPropertyChanged("LineElement"); } } - private List _LineElement; + private List? _LineElement; /// /// Street name, number, direction & P.O. Box etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Line + public IEnumerable? Line { - get { return LineElement != null ? LineElement.Select(elem => elem.Value) : null; } + get => _LineElement?.Select(elem => elem.Value); set { if (value == null) - LineElement = null; + LineElement = null!; else LineElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Line"); @@ -262,28 +256,25 @@ public IEnumerable Line /// [FhirElement("city", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CityElement + public Hl7.Fhir.Model.FhirString? CityElement { get { return _CityElement; } set { _CityElement = value; OnPropertyChanged("CityElement"); } } - private Hl7.Fhir.Model.FhirString _CityElement; + private Hl7.Fhir.Model.FhirString? _CityElement; /// /// Name of city, town etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string City + public string? City { - get { return CityElement != null ? CityElement.Value : null; } + get => _CityElement?.Value; set { - if (value == null) - CityElement = null; - else - CityElement = new Hl7.Fhir.Model.FhirString(value); + CityElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("City"); } } @@ -293,28 +284,25 @@ public string City /// [FhirElement("district", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DistrictElement + public Hl7.Fhir.Model.FhirString? DistrictElement { get { return _DistrictElement; } set { _DistrictElement = value; OnPropertyChanged("DistrictElement"); } } - private Hl7.Fhir.Model.FhirString _DistrictElement; + private Hl7.Fhir.Model.FhirString? _DistrictElement; /// /// District name (aka county) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string District + public string? District { - get { return DistrictElement != null ? DistrictElement.Value : null; } + get => _DistrictElement?.Value; set { - if (value == null) - DistrictElement = null; - else - DistrictElement = new Hl7.Fhir.Model.FhirString(value); + DistrictElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("District"); } } @@ -324,28 +312,25 @@ public string District /// [FhirElement("state", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString StateElement + public Hl7.Fhir.Model.FhirString? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Hl7.Fhir.Model.FhirString _StateElement; + private Hl7.Fhir.Model.FhirString? _StateElement; /// /// Sub-unit of country (abbreviations ok) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string State + public string? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Hl7.Fhir.Model.FhirString(value); + StateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("State"); } } @@ -355,28 +340,25 @@ public string State /// [FhirElement("postalCode", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PostalCodeElement + public Hl7.Fhir.Model.FhirString? PostalCodeElement { get { return _PostalCodeElement; } set { _PostalCodeElement = value; OnPropertyChanged("PostalCodeElement"); } } - private Hl7.Fhir.Model.FhirString _PostalCodeElement; + private Hl7.Fhir.Model.FhirString? _PostalCodeElement; /// /// Postal code for area /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PostalCode + public string? PostalCode { - get { return PostalCodeElement != null ? PostalCodeElement.Value : null; } + get => _PostalCodeElement?.Value; set { - if (value == null) - PostalCodeElement = null; - else - PostalCodeElement = new Hl7.Fhir.Model.FhirString(value); + PostalCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PostalCode"); } } @@ -386,28 +368,25 @@ public string PostalCode /// [FhirElement("country", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CountryElement + public Hl7.Fhir.Model.FhirString? CountryElement { get { return _CountryElement; } set { _CountryElement = value; OnPropertyChanged("CountryElement"); } } - private Hl7.Fhir.Model.FhirString _CountryElement; + private Hl7.Fhir.Model.FhirString? _CountryElement; /// /// Country (e.g. can be ISO 3166 2 or 3 letter code) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Country + public string? Country { - get { return CountryElement != null ? CountryElement.Value : null; } + get => _CountryElement?.Value; set { - if (value == null) - CountryElement = null; - else - CountryElement = new Hl7.Fhir.Model.FhirString(value); + CountryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Country"); } } @@ -417,34 +396,30 @@ public string Country /// [FhirElement("period", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as Address; - - if (dest == null) - { + if(other is not Address dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LineElement.Any()) dest.LineElement = new List(LineElement.DeepCopyInternal()); - if(CityElement != null) dest.CityElement = (Hl7.Fhir.Model.FhirString)CityElement.DeepCopyInternal(); - if(DistrictElement != null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)DistrictElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Hl7.Fhir.Model.FhirString)StateElement.DeepCopyInternal(); - if(PostalCodeElement != null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)PostalCodeElement.DeepCopyInternal(); - if(CountryElement != null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)CountryElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LineElement is not null) dest.LineElement = new List(_LineElement.DeepCopyInternal()); + if(_CityElement is not null) dest.CityElement = (Hl7.Fhir.Model.FhirString)_CityElement.DeepCopyInternal(); + if(_DistrictElement is not null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)_DistrictElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Hl7.Fhir.Model.FhirString)_StateElement.DeepCopyInternal(); + if(_PostalCodeElement is not null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)_PostalCodeElement.DeepCopyInternal(); + if(_CountryElement is not null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)_CountryElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -456,97 +431,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Address; - if(otherT == null) return false; + if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LineElement, otherT.LineElement)) return false; - if(!comparer.Equals(CityElement, otherT.CityElement)) return false; - if(!comparer.Equals(DistrictElement, otherT.DistrictElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(PostalCodeElement, otherT.PostalCodeElement)) return false; - if(!comparer.Equals(CountryElement, otherT.CountryElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; + if(!comparer.Equals(_CityElement, otherT._CityElement)) return false; + if(!comparer.Equals(_DistrictElement, otherT._DistrictElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; + if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "line": - value = LineElement; - return LineElement?.Any() == true; + value = _LineElement; + return _LineElement?.Any() == true; case "city": - value = CityElement; - return CityElement is not null; + value = _CityElement; + return _CityElement is not null; case "district": - value = DistrictElement; - return DistrictElement is not null; + value = _DistrictElement; + return _DistrictElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "postalCode": - value = PostalCodeElement; - return PostalCodeElement is not null; + value = _PostalCodeElement; + return _PostalCodeElement is not null; case "country": - value = CountryElement; - return CountryElement is not null; + value = _CountryElement; + return _CountryElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "line": - LineElement = (List)value; + LineElement = (List?)value!; return this; case "city": - CityElement = (Hl7.Fhir.Model.FhirString)value; + CityElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "district": - DistrictElement = (Hl7.Fhir.Model.FhirString)value; + DistrictElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "state": - StateElement = (Hl7.Fhir.Model.FhirString)value; + StateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "postalCode": - PostalCodeElement = (Hl7.Fhir.Model.FhirString)value; + PostalCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - CountryElement = (Hl7.Fhir.Model.FhirString)value; + CountryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -557,16 +532,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LineElement?.Any() == true) yield return new KeyValuePair("line",LineElement); - if (CityElement is not null) yield return new KeyValuePair("city",CityElement); - if (DistrictElement is not null) yield return new KeyValuePair("district",DistrictElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (PostalCodeElement is not null) yield return new KeyValuePair("postalCode",PostalCodeElement); - if (CountryElement is not null) yield return new KeyValuePair("country",CountryElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LineElement?.Any() == true) yield return new KeyValuePair("line",_LineElement); + if (_CityElement is not null) yield return new KeyValuePair("city",_CityElement); + if (_DistrictElement is not null) yield return new KeyValuePair("district",_DistrictElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_PostalCodeElement is not null) yield return new KeyValuePair("postalCode",_PostalCodeElement); + if (_CountryElement is not null) yield return new KeyValuePair("country",_CountryElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs index 8620acd8a..d12ab7155 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("AdverseEvent","http://hl7.org/fhir/StructureDefinition/AdverseEvent")] - public partial class AdverseEvent : Hl7.Fhir.Model.DomainResource, IIdentifiable, ICoded + public partial class AdverseEvent : Hl7.Fhir.Model.DomainResource, IIdentifiable, ICoded { /// /// FHIR Type Name @@ -179,13 +182,13 @@ public partial class SuspectEntityComponent : Hl7.Fhir.Model.BackboneElement [References("Immunization","Procedure","Substance","Medication","MedicationAdministration","MedicationStatement","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Instance + public Hl7.Fhir.Model.ResourceReference? Instance { get { return _Instance; } set { _Instance = value; OnPropertyChanged("Instance"); } } - private Hl7.Fhir.Model.ResourceReference _Instance; + private Hl7.Fhir.Model.ResourceReference? _Instance; /// /// Information on the possible cause of the event. @@ -195,24 +198,20 @@ public Hl7.Fhir.Model.ResourceReference Instance [DataMember] public List Causality { - get { if(_Causality==null) _Causality = new List(); return _Causality; } + get => _Causality ?? new List(); set { _Causality = value; OnPropertyChanged("Causality"); } } - private List _Causality; + private List? _Causality; protected internal override void CopyToInternal(Base other) { - var dest = other as SuspectEntityComponent; - - if (dest == null) - { + if(other is not SuspectEntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Instance != null) dest.Instance = (Hl7.Fhir.Model.ResourceReference)Instance.DeepCopyInternal(); - if(Causality.Any()) dest.Causality = new List(Causality.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = (Hl7.Fhir.Model.ResourceReference)_Instance.DeepCopyInternal(); + if(_Causality is not null) dest.Causality = new List(_Causality.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -224,41 +223,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuspectEntityComponent; - if(otherT == null) return false; + if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Causality, otherT.Causality)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Causality, otherT._Causality)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "instance": - value = Instance; - return Instance is not null; + value = _Instance; + return _Instance is not null; case "causality": - value = Causality; - return Causality?.Any() == true; + value = _Causality; + return _Causality?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "instance": - Instance = (Hl7.Fhir.Model.ResourceReference)value; + Instance = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "causality": - Causality = (List)value; + Causality = (List?)value!; return this; default: return base.SetValue(key, value); @@ -269,8 +268,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Instance is not null) yield return new KeyValuePair("instance",Instance); - if (Causality?.Any() == true) yield return new KeyValuePair("causality",Causality); + if (_Instance is not null) yield return new KeyValuePair("instance",_Instance); + if (_Causality?.Any() == true) yield return new KeyValuePair("causality",_Causality); } } @@ -294,41 +293,38 @@ public partial class CausalityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("assessment", InSummary=true, Order=40)] [Binding("AdverseEventCausalityAssessment")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Assessment + public Hl7.Fhir.Model.CodeableConcept? Assessment { get { return _Assessment; } set { _Assessment = value; OnPropertyChanged("Assessment"); } } - private Hl7.Fhir.Model.CodeableConcept _Assessment; + private Hl7.Fhir.Model.CodeableConcept? _Assessment; /// /// AdverseEvent.suspectEntity.causalityProductRelatedness. /// [FhirElement("productRelatedness", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductRelatednessElement + public Hl7.Fhir.Model.FhirString? ProductRelatednessElement { get { return _ProductRelatednessElement; } set { _ProductRelatednessElement = value; OnPropertyChanged("ProductRelatednessElement"); } } - private Hl7.Fhir.Model.FhirString _ProductRelatednessElement; + private Hl7.Fhir.Model.FhirString? _ProductRelatednessElement; /// /// AdverseEvent.suspectEntity.causalityProductRelatedness /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductRelatedness + public string? ProductRelatedness { - get { return ProductRelatednessElement != null ? ProductRelatednessElement.Value : null; } + get => _ProductRelatednessElement?.Value; set { - if (value == null) - ProductRelatednessElement = null; - else - ProductRelatednessElement = new Hl7.Fhir.Model.FhirString(value); + ProductRelatednessElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductRelatedness"); } } @@ -340,13 +336,13 @@ public string ProductRelatedness [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// ProbabilityScale | Bayesian | Checklist. @@ -354,28 +350,24 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("method", InSummary=true, Order=70)] [Binding("AdverseEventCausalityMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; protected internal override void CopyToInternal(Base other) { - var dest = other as CausalityComponent; - - if (dest == null) - { + if(other is not CausalityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Assessment != null) dest.Assessment = (Hl7.Fhir.Model.CodeableConcept)Assessment.DeepCopyInternal(); - if(ProductRelatednessElement != null) dest.ProductRelatednessElement = (Hl7.Fhir.Model.FhirString)ProductRelatednessElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); + if(_Assessment is not null) dest.Assessment = (Hl7.Fhir.Model.CodeableConcept)_Assessment.DeepCopyInternal(); + if(_ProductRelatednessElement is not null) dest.ProductRelatednessElement = (Hl7.Fhir.Model.FhirString)_ProductRelatednessElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -387,55 +379,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CausalityComponent; - if(otherT == null) return false; + if(other is not CausalityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Assessment, otherT.Assessment)) return false; - if(!comparer.Equals(ProductRelatednessElement, otherT.ProductRelatednessElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Assessment, otherT._Assessment)) return false; + if(!comparer.Equals(_ProductRelatednessElement, otherT._ProductRelatednessElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "assessment": - value = Assessment; - return Assessment is not null; + value = _Assessment; + return _Assessment is not null; case "productRelatedness": - value = ProductRelatednessElement; - return ProductRelatednessElement is not null; + value = _ProductRelatednessElement; + return _ProductRelatednessElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "assessment": - Assessment = (Hl7.Fhir.Model.CodeableConcept)value; + Assessment = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productRelatedness": - ProductRelatednessElement = (Hl7.Fhir.Model.FhirString)value; + ProductRelatednessElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -446,10 +438,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Assessment is not null) yield return new KeyValuePair("assessment",Assessment); - if (ProductRelatednessElement is not null) yield return new KeyValuePair("productRelatedness",ProductRelatednessElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Method is not null) yield return new KeyValuePair("method",Method); + if (_Assessment is not null) yield return new KeyValuePair("assessment",_Assessment); + if (_ProductRelatednessElement is not null) yield return new KeyValuePair("productRelatedness",_ProductRelatednessElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Method is not null) yield return new KeyValuePair("method",_Method); } } @@ -459,13 +451,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// actual | potential. @@ -475,13 +467,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("AdverseEventActuality")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ActualityElement + public Code? ActualityElement { get { return _ActualityElement; } set { _ActualityElement = value; OnPropertyChanged("ActualityElement"); } } - private Code _ActualityElement; + private Code? _ActualityElement; /// /// actual | potential @@ -490,13 +482,10 @@ public Code ActualityElement [IgnoreDataMember] public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality { - get { return ActualityElement != null ? ActualityElement.Value : null; } + get => _ActualityElement?.Value; set { - if (value == null) - ActualityElement = null; - else - ActualityElement = new Code(value); + ActualityElement = value is null ? null : new Code(value); OnPropertyChanged("Actuality"); } } @@ -510,11 +499,11 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of the event itself in relation to the subject. @@ -522,13 +511,13 @@ public List Category [FhirElement("event", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("AdverseEventType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Event + public Hl7.Fhir.Model.CodeableConcept? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.CodeableConcept _Event; + private Hl7.Fhir.Model.CodeableConcept? _Event; /// /// Subject impacted by event. @@ -538,13 +527,13 @@ public Hl7.Fhir.Model.CodeableConcept Event [References("Patient","Group","Practitioner","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -553,41 +542,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the event occurred. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the event occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -597,28 +583,25 @@ public string Date /// [FhirElement("detected", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DetectedElement + public Hl7.Fhir.Model.FhirDateTime? DetectedElement { get { return _DetectedElement; } set { _DetectedElement = value; OnPropertyChanged("DetectedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DetectedElement; + private Hl7.Fhir.Model.FhirDateTime? _DetectedElement; /// /// When the event was detected /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detected + public string? Detected { - get { return DetectedElement != null ? DetectedElement.Value : null; } + get => _DetectedElement?.Value; set { - if (value == null) - DetectedElement = null; - else - DetectedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DetectedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Detected"); } } @@ -628,28 +611,25 @@ public string Detected /// [FhirElement("recordedDate", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// When the event was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -664,11 +644,11 @@ public string RecordedDate [DataMember] public List ResultingCondition { - get { if(_ResultingCondition==null) _ResultingCondition = new List(); return _ResultingCondition; } + get => _ResultingCondition ?? new List(); set { _ResultingCondition = value; OnPropertyChanged("ResultingCondition"); } } - private List _ResultingCondition; + private List? _ResultingCondition; /// /// Location where adverse event occurred. @@ -677,13 +657,13 @@ public List ResultingCondition [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Seriousness of the event. @@ -691,13 +671,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("seriousness", InSummary=true, Order=200)] [Binding("AdverseEventSeriousness")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Seriousness + public Hl7.Fhir.Model.CodeableConcept? Seriousness { get { return _Seriousness; } set { _Seriousness = value; OnPropertyChanged("Seriousness"); } } - private Hl7.Fhir.Model.CodeableConcept _Seriousness; + private Hl7.Fhir.Model.CodeableConcept? _Seriousness; /// /// mild | moderate | severe. @@ -705,13 +685,13 @@ public Hl7.Fhir.Model.CodeableConcept Seriousness [FhirElement("severity", InSummary=true, Order=210)] [Binding("AdverseEventSeverity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Severity + public Hl7.Fhir.Model.CodeableConcept? Severity { get { return _Severity; } set { _Severity = value; OnPropertyChanged("Severity"); } } - private Hl7.Fhir.Model.CodeableConcept _Severity; + private Hl7.Fhir.Model.CodeableConcept? _Severity; /// /// resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown. @@ -719,13 +699,13 @@ public Hl7.Fhir.Model.CodeableConcept Severity [FhirElement("outcome", InSummary=true, Order=220)] [Binding("AdverseEventOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Who recorded the adverse event. @@ -734,13 +714,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Who was involved in the adverse event or the potential adverse event. @@ -752,11 +732,11 @@ public Hl7.Fhir.Model.ResourceReference Recorder [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// The suspected agent causing the adverse event. @@ -766,11 +746,11 @@ public List Contributor [DataMember] public List SuspectEntity { - get { if(_SuspectEntity==null) _SuspectEntity = new List(); return _SuspectEntity; } + get => _SuspectEntity ?? new List(); set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } - private List _SuspectEntity; + private List? _SuspectEntity; /// /// AdverseEvent.subjectMedicalHistory. @@ -782,11 +762,11 @@ public List SuspectEntity [DataMember] public List SubjectMedicalHistory { - get { if(_SubjectMedicalHistory==null) _SubjectMedicalHistory = new List(); return _SubjectMedicalHistory; } + get => _SubjectMedicalHistory ?? new List(); set { _SubjectMedicalHistory = value; OnPropertyChanged("SubjectMedicalHistory"); } } - private List _SubjectMedicalHistory; + private List? _SubjectMedicalHistory; /// /// AdverseEvent.referenceDocument. @@ -798,11 +778,11 @@ public List SubjectMedicalHistory [DataMember] public List ReferenceDocument { - get { if(_ReferenceDocument==null) _ReferenceDocument = new List(); return _ReferenceDocument; } + get => _ReferenceDocument ?? new List(); set { _ReferenceDocument = value; OnPropertyChanged("ReferenceDocument"); } } - private List _ReferenceDocument; + private List? _ReferenceDocument; /// /// AdverseEvent.study. @@ -814,47 +794,43 @@ public List ReferenceDocument [DataMember] public List Study { - get { if(_Study==null) _Study = new List(); return _Study; } + get => _Study ?? new List(); set { _Study = value; OnPropertyChanged("Study"); } } - private List _Study; + private List? _Study; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Event; set => Event = value; } - IEnumerable ICoded.ToCodings() => Event.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Event; set => Event = value!; } + IEnumerable ICoded.ToCodings() => Event?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as AdverseEvent; - - if (dest == null) - { + if(other is not AdverseEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(ActualityElement != null) dest.ActualityElement = (Code)ActualityElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Event != null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)Event.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(DetectedElement != null) dest.DetectedElement = (Hl7.Fhir.Model.FhirDateTime)DetectedElement.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(ResultingCondition.Any()) dest.ResultingCondition = new List(ResultingCondition.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Seriousness != null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)Seriousness.DeepCopyInternal(); - if(Severity != null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)Severity.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(SuspectEntity.Any()) dest.SuspectEntity = new List(SuspectEntity.DeepCopyInternal()); - if(SubjectMedicalHistory.Any()) dest.SubjectMedicalHistory = new List(SubjectMedicalHistory.DeepCopyInternal()); - if(ReferenceDocument.Any()) dest.ReferenceDocument = new List(ReferenceDocument.DeepCopyInternal()); - if(Study.Any()) dest.Study = new List(Study.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_ActualityElement is not null) dest.ActualityElement = (Code)_ActualityElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)_Event.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_DetectedElement is not null) dest.DetectedElement = (Hl7.Fhir.Model.FhirDateTime)_DetectedElement.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_ResultingCondition is not null) dest.ResultingCondition = new List(_ResultingCondition.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Seriousness is not null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)_Seriousness.DeepCopyInternal(); + if(_Severity is not null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)_Severity.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_SuspectEntity is not null) dest.SuspectEntity = new List(_SuspectEntity.DeepCopyInternal()); + if(_SubjectMedicalHistory is not null) dest.SubjectMedicalHistory = new List(_SubjectMedicalHistory.DeepCopyInternal()); + if(_ReferenceDocument is not null) dest.ReferenceDocument = new List(_ReferenceDocument.DeepCopyInternal()); + if(_Study is not null) dest.Study = new List(_Study.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -866,167 +842,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdverseEvent; - if(otherT == null) return false; + if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActualityElement, otherT.ActualityElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(DetectedElement, otherT.DetectedElement)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.ListEquals(ResultingCondition, otherT.ResultingCondition)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Seriousness, otherT.Seriousness)) return false; - if(!comparer.Equals(Severity, otherT.Severity)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(SuspectEntity, otherT.SuspectEntity)) return false; - if(!comparer.ListEquals(SubjectMedicalHistory, otherT.SubjectMedicalHistory)) return false; - if(!comparer.ListEquals(ReferenceDocument, otherT.ReferenceDocument)) return false; - if(!comparer.ListEquals(Study, otherT.Study)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActualityElement, otherT._ActualityElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_DetectedElement, otherT._DetectedElement)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.ListEquals(_ResultingCondition, otherT._ResultingCondition)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Seriousness, otherT._Seriousness)) return false; + if(!comparer.Equals(_Severity, otherT._Severity)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_SuspectEntity, otherT._SuspectEntity)) return false; + if(!comparer.ListEquals(_SubjectMedicalHistory, otherT._SubjectMedicalHistory)) return false; + if(!comparer.ListEquals(_ReferenceDocument, otherT._ReferenceDocument)) return false; + if(!comparer.ListEquals(_Study, otherT._Study)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "actuality": - value = ActualityElement; - return ActualityElement is not null; + value = _ActualityElement; + return _ActualityElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "detected": - value = DetectedElement; - return DetectedElement is not null; + value = _DetectedElement; + return _DetectedElement is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "resultingCondition": - value = ResultingCondition; - return ResultingCondition?.Any() == true; + value = _ResultingCondition; + return _ResultingCondition?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "seriousness": - value = Seriousness; - return Seriousness is not null; + value = _Seriousness; + return _Seriousness is not null; case "severity": - value = Severity; - return Severity is not null; + value = _Severity; + return _Severity is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "suspectEntity": - value = SuspectEntity; - return SuspectEntity?.Any() == true; + value = _SuspectEntity; + return _SuspectEntity?.Any() == true; case "subjectMedicalHistory": - value = SubjectMedicalHistory; - return SubjectMedicalHistory?.Any() == true; + value = _SubjectMedicalHistory; + return _SubjectMedicalHistory?.Any() == true; case "referenceDocument": - value = ReferenceDocument; - return ReferenceDocument?.Any() == true; + value = _ReferenceDocument; + return _ReferenceDocument?.Any() == true; case "study": - value = Study; - return Study?.Any() == true; + value = _Study; + return _Study?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "actuality": - ActualityElement = (Code)value; + ActualityElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "event": - Event = (Hl7.Fhir.Model.CodeableConcept)value; + Event = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "detected": - DetectedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DetectedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "resultingCondition": - ResultingCondition = (List)value; + ResultingCondition = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "seriousness": - Seriousness = (Hl7.Fhir.Model.CodeableConcept)value; + Seriousness = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "severity": - Severity = (Hl7.Fhir.Model.CodeableConcept)value; + Severity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "suspectEntity": - SuspectEntity = (List)value; + SuspectEntity = (List?)value!; return this; case "subjectMedicalHistory": - SubjectMedicalHistory = (List)value; + SubjectMedicalHistory = (List?)value!; return this; case "referenceDocument": - ReferenceDocument = (List)value; + ReferenceDocument = (List?)value!; return this; case "study": - Study = (List)value; + Study = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1037,26 +1013,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (ActualityElement is not null) yield return new KeyValuePair("actuality",ActualityElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (DetectedElement is not null) yield return new KeyValuePair("detected",DetectedElement); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (ResultingCondition?.Any() == true) yield return new KeyValuePair("resultingCondition",ResultingCondition); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Seriousness is not null) yield return new KeyValuePair("seriousness",Seriousness); - if (Severity is not null) yield return new KeyValuePair("severity",Severity); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",SuspectEntity); - if (SubjectMedicalHistory?.Any() == true) yield return new KeyValuePair("subjectMedicalHistory",SubjectMedicalHistory); - if (ReferenceDocument?.Any() == true) yield return new KeyValuePair("referenceDocument",ReferenceDocument); - if (Study?.Any() == true) yield return new KeyValuePair("study",Study); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_ActualityElement is not null) yield return new KeyValuePair("actuality",_ActualityElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_DetectedElement is not null) yield return new KeyValuePair("detected",_DetectedElement); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_ResultingCondition?.Any() == true) yield return new KeyValuePair("resultingCondition",_ResultingCondition); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Seriousness is not null) yield return new KeyValuePair("seriousness",_Seriousness); + if (_Severity is not null) yield return new KeyValuePair("severity",_Severity); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",_SuspectEntity); + if (_SubjectMedicalHistory?.Any() == true) yield return new KeyValuePair("subjectMedicalHistory",_SubjectMedicalHistory); + if (_ReferenceDocument?.Any() == true) yield return new KeyValuePair("referenceDocument",_ReferenceDocument); + if (_Study?.Any() == true) yield return new KeyValuePair("study",_Study); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Age.cs b/src/Hl7.Fhir.R4/Model/Generated/Age.cs index 1b91087ab..8381dbdb4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Age.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Age.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs index a532fb8f6..d08328265 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("AllergyIntolerance","http://hl7.org/fhir/StructureDefinition/AllergyIntolerance")] - public partial class AllergyIntolerance : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class AllergyIntolerance : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -256,13 +259,13 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", Order=40)] [Binding("SubstanceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Clinical symptoms/signs associated with the Event. @@ -273,39 +276,36 @@ public Hl7.Fhir.Model.CodeableConcept Substance [DataMember] public List Manifestation { - get { if(_Manifestation==null) _Manifestation = new List(); return _Manifestation; } + get => _Manifestation ?? new List(); set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } - private List _Manifestation; + private List? _Manifestation; /// /// Description of the event as a whole. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the event as a whole /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -315,28 +315,25 @@ public string Description /// [FhirElement("onset", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OnsetElement + public Hl7.Fhir.Model.FhirDateTime? OnsetElement { get { return _OnsetElement; } set { _OnsetElement = value; OnPropertyChanged("OnsetElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OnsetElement; + private Hl7.Fhir.Model.FhirDateTime? _OnsetElement; /// /// Date(/time) when manifestations showed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Onset + public string? Onset { - get { return OnsetElement != null ? OnsetElement.Value : null; } + get => _OnsetElement?.Value; set { - if (value == null) - OnsetElement = null; - else - OnsetElement = new Hl7.Fhir.Model.FhirDateTime(value); + OnsetElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Onset"); } } @@ -348,13 +345,13 @@ public string Onset [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// mild | moderate | severe (of event as a whole) @@ -363,13 +360,10 @@ public Code Severi [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -380,13 +374,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity [FhirElement("exposureRoute", Order=90)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ExposureRoute + public Hl7.Fhir.Model.CodeableConcept? ExposureRoute { get { return _ExposureRoute; } set { _ExposureRoute = value; OnPropertyChanged("ExposureRoute"); } } - private Hl7.Fhir.Model.CodeableConcept _ExposureRoute; + private Hl7.Fhir.Model.CodeableConcept? _ExposureRoute; /// /// Text about event not captured in other fields. @@ -396,29 +390,25 @@ public Hl7.Fhir.Model.CodeableConcept ExposureRoute [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(Manifestation.Any()) dest.Manifestation = new List(Manifestation.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OnsetElement != null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)OnsetElement.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(ExposureRoute != null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)ExposureRoute.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_Manifestation is not null) dest.Manifestation = new List(_Manifestation.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OnsetElement is not null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)_OnsetElement.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_ExposureRoute is not null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)_ExposureRoute.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -430,76 +420,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.ListEquals(Manifestation, otherT.Manifestation)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(OnsetElement, otherT.OnsetElement)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(ExposureRoute, otherT.ExposureRoute)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "manifestation": - value = Manifestation; - return Manifestation?.Any() == true; + value = _Manifestation; + return _Manifestation?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "onset": - value = OnsetElement; - return OnsetElement is not null; + value = _OnsetElement; + return _OnsetElement is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "exposureRoute": - value = ExposureRoute; - return ExposureRoute is not null; + value = _ExposureRoute; + return _ExposureRoute is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manifestation": - Manifestation = (List)value; + Manifestation = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "onset": - OnsetElement = (Hl7.Fhir.Model.FhirDateTime)value; + OnsetElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "exposureRoute": - ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)value; + ExposureRoute = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -510,13 +500,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",Manifestation); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OnsetElement is not null) yield return new KeyValuePair("onset",OnsetElement); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",ExposureRoute); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",_Manifestation); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OnsetElement is not null) yield return new KeyValuePair("onset",_OnsetElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",_ExposureRoute); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -529,11 +519,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | resolved. @@ -541,13 +531,13 @@ public List Identifier [FhirElement("clinicalStatus", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [Binding("AllergyIntoleranceClinicalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ClinicalStatus + public Hl7.Fhir.Model.CodeableConcept? ClinicalStatus { get { return _ClinicalStatus; } set { _ClinicalStatus = value; OnPropertyChanged("ClinicalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ClinicalStatus; + private Hl7.Fhir.Model.CodeableConcept? _ClinicalStatus; /// /// unconfirmed | confirmed | refuted | entered-in-error. @@ -555,13 +545,13 @@ public Hl7.Fhir.Model.CodeableConcept ClinicalStatus [FhirElement("verificationStatus", InSummary=true, IsModifier=true, Order=110, FiveWs="FiveWs.status")] [Binding("AllergyIntoleranceVerificationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VerificationStatus + public Hl7.Fhir.Model.CodeableConcept? VerificationStatus { get { return _VerificationStatus; } set { _VerificationStatus = value; OnPropertyChanged("VerificationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _VerificationStatus; + private Hl7.Fhir.Model.CodeableConcept? _VerificationStatus; /// /// allergy | intolerance - Underlying mechanism (if known). @@ -570,13 +560,13 @@ public Hl7.Fhir.Model.CodeableConcept VerificationStatus [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// allergy | intolerance - Underlying mechanism (if known) @@ -585,13 +575,10 @@ public Code TypeElemen [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -606,24 +593,24 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type [DataMember] public List> CategoryElement { - get { if(_CategoryElement==null) _CategoryElement = new List>(); return _CategoryElement; } + get => _CategoryElement ?? new List>(); set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private List> _CategoryElement; + private List>? _CategoryElement; /// /// food | medication | environment | biologic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Category + public IEnumerable? Category { - get { return CategoryElement != null ? CategoryElement.Select(elem => elem.Value) : null; } + get => _CategoryElement?.Select(elem => elem.Value); set { if (value == null) - CategoryElement = null; + CategoryElement = null!; else CategoryElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Category"); @@ -637,13 +624,13 @@ public IEnumerable CriticalityElement + public Code? CriticalityElement { get { return _CriticalityElement; } set { _CriticalityElement = value; OnPropertyChanged("CriticalityElement"); } } - private Code _CriticalityElement; + private Code? _CriticalityElement; /// /// low | high | unable-to-assess @@ -652,13 +639,10 @@ public Code Cri [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Criticality { - get { return CriticalityElement != null ? CriticalityElement.Value : null; } + get => _CriticalityElement?.Value; set { - if (value == null) - CriticalityElement = null; - else - CriticalityElement = new Code(value); + CriticalityElement = value is null ? null : new Code(value); OnPropertyChanged("Criticality"); } } @@ -669,13 +653,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Critical [FhirElement("code", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [Binding("AllergyIntoleranceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the sensitivity is for. @@ -685,13 +669,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter when the allergy or intolerance was asserted. @@ -700,13 +684,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When allergy or intolerance was identified. @@ -715,41 +699,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Date first version of the resource instance was recorded. /// [FhirElement("recordedDate", Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// Date first version of the resource instance was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -761,13 +742,13 @@ public string RecordedDate [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Source of the information about the allergy. @@ -776,41 +757,38 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// Date(/time) of last known occurrence of a reaction. /// [FhirElement("lastOccurrence", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastOccurrenceElement + public Hl7.Fhir.Model.FhirDateTime? LastOccurrenceElement { get { return _LastOccurrenceElement; } set { _LastOccurrenceElement = value; OnPropertyChanged("LastOccurrenceElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastOccurrenceElement; + private Hl7.Fhir.Model.FhirDateTime? _LastOccurrenceElement; /// /// Date(/time) of last known occurrence of a reaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastOccurrence + public string? LastOccurrence { - get { return LastOccurrenceElement != null ? LastOccurrenceElement.Value : null; } + get => _LastOccurrenceElement?.Value; set { - if (value == null) - LastOccurrenceElement = null; - else - LastOccurrenceElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastOccurrenceElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastOccurrence"); } } @@ -823,11 +801,11 @@ public string LastOccurrence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Adverse Reaction Events linked to exposure to substance. @@ -837,43 +815,39 @@ public List Note [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as AllergyIntolerance; - - if (dest == null) - { + if(other is not AllergyIntolerance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatus != null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)ClinicalStatus.DeepCopyInternal(); - if(VerificationStatus != null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)VerificationStatus.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(CategoryElement.Any()) dest.CategoryElement = new List>(CategoryElement.DeepCopyInternal()); - if(CriticalityElement != null) dest.CriticalityElement = (Code)CriticalityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(LastOccurrenceElement != null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)LastOccurrenceElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatus is not null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)_ClinicalStatus.DeepCopyInternal(); + if(_VerificationStatus is not null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)_VerificationStatus.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = new List>(_CategoryElement.DeepCopyInternal()); + if(_CriticalityElement is not null) dest.CriticalityElement = (Code)_CriticalityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_LastOccurrenceElement is not null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)_LastOccurrenceElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -885,139 +859,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllergyIntolerance; - if(otherT == null) return false; + if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatus, otherT.ClinicalStatus)) return false; - if(!comparer.Equals(VerificationStatus, otherT.VerificationStatus)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(CriticalityElement, otherT.CriticalityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.Equals(LastOccurrenceElement, otherT.LastOccurrenceElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; + if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_CriticalityElement, otherT._CriticalityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatus; - return ClinicalStatus is not null; + value = _ClinicalStatus; + return _ClinicalStatus is not null; case "verificationStatus": - value = VerificationStatus; - return VerificationStatus is not null; + value = _VerificationStatus; + return _VerificationStatus is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "category": - value = CategoryElement; - return CategoryElement?.Any() == true; + value = _CategoryElement; + return _CategoryElement?.Any() == true; case "criticality": - value = CriticalityElement; - return CriticalityElement is not null; + value = _CriticalityElement; + return _CriticalityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "lastOccurrence": - value = LastOccurrenceElement; - return LastOccurrenceElement is not null; + value = _LastOccurrenceElement; + return _LastOccurrenceElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verificationStatus": - VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + VerificationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "category": - CategoryElement = (List>)value; + CategoryElement = (List>?)value!; return this; case "criticality": - CriticalityElement = (Code)value; + CriticalityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lastOccurrence": - LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1028,22 +1002,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatus); - if (VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",VerificationStatus); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (CategoryElement?.Any() == true) yield return new KeyValuePair("category",CategoryElement); - if (CriticalityElement is not null) yield return new KeyValuePair("criticality",CriticalityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",LastOccurrenceElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatus); + if (_VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatus); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_CategoryElement?.Any() == true) yield return new KeyValuePair("category",_CategoryElement); + if (_CriticalityElement is not null) yield return new KeyValuePair("criticality",_CriticalityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",_LastOccurrenceElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs b/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs index abd63c918..217c46b35 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -68,41 +71,38 @@ public partial class Annotation : Hl7.Fhir.Model.DataType [References("Practitioner","Patient","RelatedPerson","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Author + public Hl7.Fhir.Model.DataType? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.DataType _Author; + private Hl7.Fhir.Model.DataType? _Author; /// /// When the annotation was made. /// [FhirElement("time", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the annotation was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -113,45 +113,38 @@ public string Time [FhirElement("text", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// The annotation - text content (as markdown) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Annotation; - - if (dest == null) - { + if(other is not Annotation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Author != null) dest.Author = (Hl7.Fhir.Model.DataType)Author.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.DataType)_Author.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -163,48 +156,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Annotation; - if(otherT == null) return false; + if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "author": - Author = (Hl7.Fhir.Model.DataType)value; + Author = (Hl7.Fhir.Model.DataType?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -215,9 +208,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Author is not null) yield return new KeyValuePair("author",Author); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs index 0d04da7d2..67304cb06 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -179,11 +182,11 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Person, Location/HealthcareService or Device. @@ -192,13 +195,13 @@ public List Type [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// required | optional | information-only. @@ -207,13 +210,13 @@ public Hl7.Fhir.Model.ResourceReference Actor [DeclaredType(Type = typeof(Code))] [Binding("ParticipantRequired")] [DataMember] - public Code RequiredElement + public Code? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Code _RequiredElement; + private Code? _RequiredElement; /// /// required | optional | information-only @@ -222,13 +225,10 @@ public Code RequiredElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.ParticipantRequired? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Code(value); + RequiredElement = value is null ? null : new Code(value); OnPropertyChanged("Required"); } } @@ -241,13 +241,13 @@ public Hl7.Fhir.Model.Appointment.ParticipantRequired? Required [Binding("ParticipationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// accepted | declined | tentative | needs-action @@ -256,13 +256,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ParticipationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -272,29 +269,25 @@ public Hl7.Fhir.Model.ParticipationStatus? Status /// [FhirElement("period", Order=80)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(RequiredElement != null) dest.RequiredElement = (Code)RequiredElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Code)_RequiredElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -306,62 +299,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "required": - RequiredElement = (Code)value; + RequiredElement = (Code?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -372,11 +365,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -389,11 +382,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist. @@ -403,13 +396,13 @@ public List Identifier [Binding("AppointmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist @@ -418,13 +411,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -435,13 +425,13 @@ public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status [FhirElement("cancelationReason", InSummary=true, Order=110)] [Binding("cancelation-reason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CancelationReason + public Hl7.Fhir.Model.CodeableConcept? CancelationReason { get { return _CancelationReason; } set { _CancelationReason = value; OnPropertyChanged("CancelationReason"); } } - private Hl7.Fhir.Model.CodeableConcept _CancelationReason; + private Hl7.Fhir.Model.CodeableConcept? _CancelationReason; /// /// A broad categorization of the service that is to be performed during this appointment. @@ -452,11 +442,11 @@ public Hl7.Fhir.Model.CodeableConcept CancelationReason [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// The specific service that is to be performed during this appointment. @@ -467,11 +457,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -482,11 +472,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that has been booked in the slot (not service type). @@ -494,13 +484,13 @@ public List Specialty [FhirElement("appointmentType", InSummary=true, Order=150)] [Binding("appointment-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AppointmentType + public Hl7.Fhir.Model.CodeableConcept? AppointmentType { get { return _AppointmentType; } set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private Hl7.Fhir.Model.CodeableConcept _AppointmentType; + private Hl7.Fhir.Model.CodeableConcept? _AppointmentType; /// /// Coded reason this appointment is scheduled. @@ -511,11 +501,11 @@ public Hl7.Fhir.Model.CodeableConcept AppointmentType [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Reason the appointment is to take place (resource). @@ -527,24 +517,24 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Used to make informed decisions if needing to re-prioritize. /// [FhirElement("priority", Order=180, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.UnsignedInt PriorityElement + public Hl7.Fhir.Model.UnsignedInt? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Hl7.Fhir.Model.UnsignedInt _PriorityElement; + private Hl7.Fhir.Model.UnsignedInt? _PriorityElement; /// /// Used to make informed decisions if needing to re-prioritize @@ -553,13 +543,10 @@ public Hl7.Fhir.Model.UnsignedInt PriorityElement [IgnoreDataMember] public int? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Hl7.Fhir.Model.UnsignedInt(value); + PriorityElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Priority"); } } @@ -569,28 +556,25 @@ public int? Priority /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Shown on a subject line in a meeting request, or appointment list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -605,24 +589,24 @@ public string Description [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// When appointment is to take place. /// [FhirElement("start", InSummary=true, Order=210, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// When appointment is to take place @@ -631,13 +615,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -647,13 +628,13 @@ public DateTimeOffset? Start /// [FhirElement("end", InSummary=true, Order=220, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When appointment is to conclude @@ -662,13 +643,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -678,13 +656,13 @@ public DateTimeOffset? End /// [FhirElement("minutesDuration", Order=230)] [DataMember] - public Hl7.Fhir.Model.PositiveInt MinutesDurationElement + public Hl7.Fhir.Model.PositiveInt? MinutesDurationElement { get { return _MinutesDurationElement; } set { _MinutesDurationElement = value; OnPropertyChanged("MinutesDurationElement"); } } - private Hl7.Fhir.Model.PositiveInt _MinutesDurationElement; + private Hl7.Fhir.Model.PositiveInt? _MinutesDurationElement; /// /// Can be less than start/end (e.g. estimate) @@ -693,13 +671,10 @@ public Hl7.Fhir.Model.PositiveInt MinutesDurationElement [IgnoreDataMember] public int? MinutesDuration { - get { return MinutesDurationElement != null ? MinutesDurationElement.Value : null; } + get => _MinutesDurationElement?.Value; set { - if (value == null) - MinutesDurationElement = null; - else - MinutesDurationElement = new Hl7.Fhir.Model.PositiveInt(value); + MinutesDurationElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("MinutesDuration"); } } @@ -714,39 +689,36 @@ public int? MinutesDuration [DataMember] public List Slot { - get { if(_Slot==null) _Slot = new List(); return _Slot; } + get => _Slot ?? new List(); set { _Slot = value; OnPropertyChanged("Slot"); } } - private List _Slot; + private List? _Slot; /// /// The date that this appointment was initially created. /// [FhirElement("created", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// The date that this appointment was initially created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -756,28 +728,25 @@ public string Created /// [FhirElement("comment", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -787,28 +756,25 @@ public string Comment /// [FhirElement("patientInstruction", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Detailed information and instructions for the patient /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -823,11 +789,11 @@ public string PatientInstruction [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Participants involved in appointment. @@ -837,11 +803,11 @@ public List BasedOn [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Potential date/time interval(s) requested to allocate the appointment within. @@ -851,49 +817,45 @@ public List Participant [DataMember] public List RequestedPeriod { - get { if(_RequestedPeriod==null) _RequestedPeriod = new List(); return _RequestedPeriod; } + get => _RequestedPeriod ?? new List(); set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } - private List _RequestedPeriod; + private List? _RequestedPeriod; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => ServiceType; set => ServiceType = value; } - IEnumerable ICoded.ToCodings() => ServiceType.ToCodings(); + IEnumerable ICoded.ToCodings() => ServiceType?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Appointment; - - if (dest == null) - { + if(other is not Appointment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CancelationReason != null) dest.CancelationReason = (Hl7.Fhir.Model.CodeableConcept)CancelationReason.DeepCopyInternal(); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType != null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)AppointmentType.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Hl7.Fhir.Model.UnsignedInt)PriorityElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(MinutesDurationElement != null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)MinutesDurationElement.DeepCopyInternal(); - if(Slot.Any()) dest.Slot = new List(Slot.DeepCopyInternal()); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(RequestedPeriod.Any()) dest.RequestedPeriod = new List(RequestedPeriod.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CancelationReason is not null) dest.CancelationReason = (Hl7.Fhir.Model.CodeableConcept)_CancelationReason.DeepCopyInternal(); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)_AppointmentType.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Hl7.Fhir.Model.UnsignedInt)_PriorityElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_MinutesDurationElement is not null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)_MinutesDurationElement.DeepCopyInternal(); + if(_Slot is not null) dest.Slot = new List(_Slot.DeepCopyInternal()); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_RequestedPeriod is not null) dest.RequestedPeriod = new List(_RequestedPeriod.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -905,181 +867,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Appointment; - if(otherT == null) return false; + if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CancelationReason, otherT.CancelationReason)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(MinutesDurationElement, otherT.MinutesDurationElement)) return false; - if(!comparer.ListEquals(Slot, otherT.Slot)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(RequestedPeriod, otherT.RequestedPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CancelationReason, otherT._CancelationReason)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_MinutesDurationElement, otherT._MinutesDurationElement)) return false; + if(!comparer.ListEquals(_Slot, otherT._Slot)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_RequestedPeriod, otherT._RequestedPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "cancelationReason": - value = CancelationReason; - return CancelationReason is not null; + value = _CancelationReason; + return _CancelationReason is not null; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType is not null; + value = _AppointmentType; + return _AppointmentType is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "minutesDuration": - value = MinutesDurationElement; - return MinutesDurationElement is not null; + value = _MinutesDurationElement; + return _MinutesDurationElement is not null; case "slot": - value = Slot; - return Slot?.Any() == true; + value = _Slot; + return _Slot?.Any() == true; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "requestedPeriod": - value = RequestedPeriod; - return RequestedPeriod?.Any() == true; + value = _RequestedPeriod; + return _RequestedPeriod?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "cancelationReason": - CancelationReason = (Hl7.Fhir.Model.CodeableConcept)value; + CancelationReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (Hl7.Fhir.Model.CodeableConcept)value; + AppointmentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "priority": - PriorityElement = (Hl7.Fhir.Model.UnsignedInt)value; + PriorityElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "minutesDuration": - MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)value; + MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "slot": - Slot = (List)value; + Slot = (List?)value!; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "requestedPeriod": - RequestedPeriod = (List)value; + RequestedPeriod = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1090,28 +1052,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CancelationReason is not null) yield return new KeyValuePair("cancelationReason",CancelationReason); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType is not null) yield return new KeyValuePair("appointmentType",AppointmentType); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",MinutesDurationElement); - if (Slot?.Any() == true) yield return new KeyValuePair("slot",Slot); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",RequestedPeriod); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CancelationReason is not null) yield return new KeyValuePair("cancelationReason",_CancelationReason); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType is not null) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",_MinutesDurationElement); + if (_Slot?.Any() == true) yield return new KeyValuePair("slot",_Slot); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",_RequestedPeriod); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs index 656c0b192..128048de6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,11 +67,11 @@ public partial class AppointmentResponse : Hl7.Fhir.Model.DomainResource, IIdent [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Appointment this response relates to. @@ -78,26 +81,26 @@ public List Identifier [References("Appointment")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Appointment + public Hl7.Fhir.Model.ResourceReference? Appointment { get { return _Appointment; } set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private Hl7.Fhir.Model.ResourceReference _Appointment; + private Hl7.Fhir.Model.ResourceReference? _Appointment; /// /// Time from appointment, or requested new start time. /// [FhirElement("start", Order=110, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Time from appointment, or requested new start time @@ -106,13 +109,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -122,13 +122,13 @@ public DateTimeOffset? Start /// [FhirElement("end", Order=120, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Time from appointment, or requested new end time @@ -137,13 +137,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -157,11 +154,11 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get { if(_ParticipantType==null) _ParticipantType = new List(); return _ParticipantType; } + get => _ParticipantType ?? new List(); set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } - private List _ParticipantType; + private List? _ParticipantType; /// /// Person, Location, HealthcareService, or Device. @@ -170,13 +167,13 @@ public List ParticipantType [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// accepted | declined | tentative | needs-action. @@ -186,13 +183,13 @@ public Hl7.Fhir.Model.ResourceReference Actor [Binding("ParticipantStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ParticipantStatusElement + public Code? ParticipantStatusElement { get { return _ParticipantStatusElement; } set { _ParticipantStatusElement = value; OnPropertyChanged("ParticipantStatusElement"); } } - private Code _ParticipantStatusElement; + private Code? _ParticipantStatusElement; /// /// accepted | declined | tentative | needs-action @@ -201,13 +198,10 @@ public Code ParticipantStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ParticipationStatus? ParticipantStatus { - get { return ParticipantStatusElement != null ? ParticipantStatusElement.Value : null; } + get => _ParticipantStatusElement?.Value; set { - if (value == null) - ParticipantStatusElement = null; - else - ParticipantStatusElement = new Code(value); + ParticipantStatusElement = value is null ? null : new Code(value); OnPropertyChanged("ParticipantStatus"); } } @@ -217,28 +211,25 @@ public Hl7.Fhir.Model.ParticipationStatus? ParticipantStatus /// [FhirElement("comment", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -247,22 +238,18 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as AppointmentResponse; - - if (dest == null) - { + if(other is not AppointmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Appointment != null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)Appointment.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ParticipantType.Any()) dest.ParticipantType = new List(ParticipantType.DeepCopyInternal()); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(ParticipantStatusElement != null) dest.ParticipantStatusElement = (Code)ParticipantStatusElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)_Appointment.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ParticipantType is not null) dest.ParticipantType = new List(_ParticipantType.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_ParticipantStatusElement is not null) dest.ParticipantStatusElement = (Code)_ParticipantStatusElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -274,83 +261,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AppointmentResponse; - if(otherT == null) return false; + if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Appointment, otherT.Appointment)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.ListEquals(ParticipantType, otherT.ParticipantType)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(ParticipantStatusElement, otherT.ParticipantStatusElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.ListEquals(_ParticipantType, otherT._ParticipantType)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_ParticipantStatusElement, otherT._ParticipantStatusElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "appointment": - value = Appointment; - return Appointment is not null; + value = _Appointment; + return _Appointment is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "participantType": - value = ParticipantType; - return ParticipantType?.Any() == true; + value = _ParticipantType; + return _ParticipantType?.Any() == true; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "participantStatus": - value = ParticipantStatusElement; - return ParticipantStatusElement is not null; + value = _ParticipantStatusElement; + return _ParticipantStatusElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "appointment": - Appointment = (Hl7.Fhir.Model.ResourceReference)value; + Appointment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "participantType": - ParticipantType = (List)value; + ParticipantType = (List?)value!; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participantStatus": - ParticipantStatusElement = (Code)value; + ParticipantStatusElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -361,14 +348,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Appointment is not null) yield return new KeyValuePair("appointment",Appointment); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",ParticipantType); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",ParticipantStatusElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Appointment is not null) yield return new KeyValuePair("appointment",_Appointment); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",_ParticipantType); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",_ParticipantStatusElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs index 87b45eac3..d9dcc4b63 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -198,13 +201,13 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40, FiveWs="FiveWs.who")] [Binding("AuditAgentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Agent role in the event. @@ -215,11 +218,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Identifier of who. @@ -228,41 +231,38 @@ public List Role [CLSCompliant(false)] [References("PractitionerRole","Practitioner","Organization","Device","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Alternative User identity. /// [FhirElement("altId", Order=70, FiveWs="FiveWs.who")] [DataMember] - public Hl7.Fhir.Model.FhirString AltIdElement + public Hl7.Fhir.Model.FhirString? AltIdElement { get { return _AltIdElement; } set { _AltIdElement = value; OnPropertyChanged("AltIdElement"); } } - private Hl7.Fhir.Model.FhirString _AltIdElement; + private Hl7.Fhir.Model.FhirString? _AltIdElement; /// /// Alternative User identity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AltId + public string? AltId { - get { return AltIdElement != null ? AltIdElement.Value : null; } + get => _AltIdElement?.Value; set { - if (value == null) - AltIdElement = null; - else - AltIdElement = new Hl7.Fhir.Model.FhirString(value); + AltIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AltId"); } } @@ -272,28 +272,25 @@ public string AltId /// [FhirElement("name", Order=80, FiveWs="FiveWs.who")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human friendly name for the agent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -304,13 +301,13 @@ public string Name [FhirElement("requestor", InSummary=true, Order=90, FiveWs="FiveWs.who")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequestorElement + public Hl7.Fhir.Model.FhirBoolean? RequestorElement { get { return _RequestorElement; } set { _RequestorElement = value; OnPropertyChanged("RequestorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequestorElement; + private Hl7.Fhir.Model.FhirBoolean? _RequestorElement; /// /// Whether user is initiator @@ -319,13 +316,10 @@ public Hl7.Fhir.Model.FhirBoolean RequestorElement [IgnoreDataMember] public bool? Requestor { - get { return RequestorElement != null ? RequestorElement.Value : null; } + get => _RequestorElement?.Value; set { - if (value == null) - RequestorElement = null; - else - RequestorElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequestorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Requestor"); } } @@ -337,13 +331,13 @@ public bool? Requestor [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Policy that authorized event. @@ -353,24 +347,24 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy that authorized event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -383,26 +377,26 @@ public IEnumerable Policy [FhirElement("media", Order=120, FiveWs="FiveWs.where[x]")] [Binding("DICOMMediaType")] [DataMember] - public Hl7.Fhir.Model.Coding Media + public Hl7.Fhir.Model.Coding? Media { get { return _Media; } set { _Media = value; OnPropertyChanged("Media"); } } - private Hl7.Fhir.Model.Coding _Media; + private Hl7.Fhir.Model.Coding? _Media; /// /// Logical network location for application activity. /// [FhirElement("network", Order=130, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.AuditEvent.NetworkComponent Network + public Hl7.Fhir.Model.AuditEvent.NetworkComponent? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.AuditEvent.NetworkComponent _Network; + private Hl7.Fhir.Model.AuditEvent.NetworkComponent? _Network; /// /// Reason given for this user. @@ -413,33 +407,29 @@ public Hl7.Fhir.Model.AuditEvent.NetworkComponent Network [DataMember] public List PurposeOfUse { - get { if(_PurposeOfUse==null) _PurposeOfUse = new List(); return _PurposeOfUse; } + get => _PurposeOfUse ?? new List(); set { _PurposeOfUse = value; OnPropertyChanged("PurposeOfUse"); } } - private List _PurposeOfUse; + private List? _PurposeOfUse; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(AltIdElement != null) dest.AltIdElement = (Hl7.Fhir.Model.FhirString)AltIdElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(RequestorElement != null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)RequestorElement.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Media != null) dest.Media = (Hl7.Fhir.Model.Coding)Media.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)Network.DeepCopyInternal(); - if(PurposeOfUse.Any()) dest.PurposeOfUse = new List(PurposeOfUse.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_AltIdElement is not null) dest.AltIdElement = (Hl7.Fhir.Model.FhirString)_AltIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_RequestorElement is not null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)_RequestorElement.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Media is not null) dest.Media = (Hl7.Fhir.Model.Coding)_Media.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)_Network.DeepCopyInternal(); + if(_PurposeOfUse is not null) dest.PurposeOfUse = new List(_PurposeOfUse.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -451,104 +441,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(AltIdElement, otherT.AltIdElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(RequestorElement, otherT.RequestorElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Media, otherT.Media)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(PurposeOfUse, otherT.PurposeOfUse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_AltIdElement, otherT._AltIdElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_RequestorElement, otherT._RequestorElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Media, otherT._Media)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_PurposeOfUse, otherT._PurposeOfUse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "altId": - value = AltIdElement; - return AltIdElement is not null; + value = _AltIdElement; + return _AltIdElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "requestor": - value = RequestorElement; - return RequestorElement is not null; + value = _RequestorElement; + return _RequestorElement is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "media": - value = Media; - return Media is not null; + value = _Media; + return _Media is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "purposeOfUse": - value = PurposeOfUse; - return PurposeOfUse?.Any() == true; + value = _PurposeOfUse; + return _PurposeOfUse?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "altId": - AltIdElement = (Hl7.Fhir.Model.FhirString)value; + AltIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestor": - RequestorElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequestorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "media": - Media = (Hl7.Fhir.Model.Coding)value; + Media = (Hl7.Fhir.Model.Coding?)value; return this; case "network": - Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)value; + Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent?)value; return this; case "purposeOfUse": - PurposeOfUse = (List)value; + PurposeOfUse = (List?)value!; return this; default: return base.SetValue(key, value); @@ -559,17 +549,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (AltIdElement is not null) yield return new KeyValuePair("altId",AltIdElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (RequestorElement is not null) yield return new KeyValuePair("requestor",RequestorElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Media is not null) yield return new KeyValuePair("media",Media); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (PurposeOfUse?.Any() == true) yield return new KeyValuePair("purposeOfUse",PurposeOfUse); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_AltIdElement is not null) yield return new KeyValuePair("altId",_AltIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_RequestorElement is not null) yield return new KeyValuePair("requestor",_RequestorElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Media is not null) yield return new KeyValuePair("media",_Media); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_PurposeOfUse?.Any() == true) yield return new KeyValuePair("purposeOfUse",_PurposeOfUse); } } @@ -595,28 +585,25 @@ public partial class NetworkComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("address", Order=40, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString AddressElement + public Hl7.Fhir.Model.FhirString? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirString _AddressElement; + private Hl7.Fhir.Model.FhirString? _AddressElement; /// /// Identifier for the network access point of the user device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirString(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Address"); } } @@ -628,13 +615,13 @@ public string Address [DeclaredType(Type = typeof(Code))] [Binding("AuditEventAgentNetworkType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// The type of network access point @@ -643,29 +630,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventAgentNetworkType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NetworkComponent; - - if (dest == null) - { + if(other is not NetworkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirString)AddressElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirString)_AddressElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -677,41 +657,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NetworkComponent; - if(otherT == null) return false; + if(other is not NetworkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "address": - AddressElement = (Hl7.Fhir.Model.FhirString)value; + AddressElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -722,8 +702,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -750,28 +730,25 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("site", Order=40, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString SiteElement + public Hl7.Fhir.Model.FhirString? SiteElement { get { return _SiteElement; } set { _SiteElement = value; OnPropertyChanged("SiteElement"); } } - private Hl7.Fhir.Model.FhirString _SiteElement; + private Hl7.Fhir.Model.FhirString? _SiteElement; /// /// Logical source location within the enterprise /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Site + public string? Site { - get { return SiteElement != null ? SiteElement.Value : null; } + get => _SiteElement?.Value; set { - if (value == null) - SiteElement = null; - else - SiteElement = new Hl7.Fhir.Model.FhirString(value); + SiteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Site"); } } @@ -784,13 +761,13 @@ public string Site [References("PractitionerRole","Practitioner","Organization","Device","Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Observer + public Hl7.Fhir.Model.ResourceReference? Observer { get { return _Observer; } set { _Observer = value; OnPropertyChanged("Observer"); } } - private Hl7.Fhir.Model.ResourceReference _Observer; + private Hl7.Fhir.Model.ResourceReference? _Observer; /// /// The type of source where event originated. @@ -801,25 +778,21 @@ public Hl7.Fhir.Model.ResourceReference Observer [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SiteElement != null) dest.SiteElement = (Hl7.Fhir.Model.FhirString)SiteElement.DeepCopyInternal(); - if(Observer != null) dest.Observer = (Hl7.Fhir.Model.ResourceReference)Observer.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); + if(_SiteElement is not null) dest.SiteElement = (Hl7.Fhir.Model.FhirString)_SiteElement.DeepCopyInternal(); + if(_Observer is not null) dest.Observer = (Hl7.Fhir.Model.ResourceReference)_Observer.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -831,48 +804,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SiteElement, otherT.SiteElement)) return false; - if(!comparer.Equals(Observer, otherT.Observer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; + if(!comparer.Equals(_Observer, otherT._Observer)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = SiteElement; - return SiteElement is not null; + value = _SiteElement; + return _SiteElement is not null; case "observer": - value = Observer; - return Observer is not null; + value = _Observer; + return _Observer is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - SiteElement = (Hl7.Fhir.Model.FhirString)value; + SiteElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "observer": - Observer = (Hl7.Fhir.Model.ResourceReference)value; + Observer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; default: return base.SetValue(key, value); @@ -883,9 +856,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SiteElement is not null) yield return new KeyValuePair("site",SiteElement); - if (Observer is not null) yield return new KeyValuePair("observer",Observer); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); + if (_SiteElement is not null) yield return new KeyValuePair("site",_SiteElement); + if (_Observer is not null) yield return new KeyValuePair("observer",_Observer); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); } } @@ -914,13 +887,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference What + public Hl7.Fhir.Model.ResourceReference? What { get { return _What; } set { _What = value; OnPropertyChanged("What"); } } - private Hl7.Fhir.Model.ResourceReference _What; + private Hl7.Fhir.Model.ResourceReference? _What; /// /// Type of entity involved. @@ -928,13 +901,13 @@ public Hl7.Fhir.Model.ResourceReference What [FhirElement("type", Order=50, FiveWs="FiveWs.what[x]")] [Binding("AuditEventEntityType")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// What role the entity played. @@ -942,13 +915,13 @@ public Hl7.Fhir.Model.Coding Type [FhirElement("role", Order=60, FiveWs="FiveWs.context")] [Binding("AuditEventEntityRole")] [DataMember] - public Hl7.Fhir.Model.Coding Role + public Hl7.Fhir.Model.Coding? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.Coding _Role; + private Hl7.Fhir.Model.Coding? _Role; /// /// Life-cycle stage for the entity. @@ -956,13 +929,13 @@ public Hl7.Fhir.Model.Coding Role [FhirElement("lifecycle", Order=70, FiveWs="FiveWs.context")] [Binding("AuditEventEntityLifecycle")] [DataMember] - public Hl7.Fhir.Model.Coding Lifecycle + public Hl7.Fhir.Model.Coding? Lifecycle { get { return _Lifecycle; } set { _Lifecycle = value; OnPropertyChanged("Lifecycle"); } } - private Hl7.Fhir.Model.Coding _Lifecycle; + private Hl7.Fhir.Model.Coding? _Lifecycle; /// /// Security labels on the entity. @@ -973,39 +946,36 @@ public Hl7.Fhir.Model.Coding Lifecycle [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Descriptor for entity. /// [FhirElement("name", InSummary=true, Order=90, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptor for entity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1015,28 +985,25 @@ public string Name /// [FhirElement("description", Order=100, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Descriptive text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1046,28 +1013,25 @@ public string Description /// [FhirElement("query", InSummary=true, Order=110, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.Base64Binary QueryElement + public Hl7.Fhir.Model.Base64Binary? QueryElement { get { return _QueryElement; } set { _QueryElement = value; OnPropertyChanged("QueryElement"); } } - private Hl7.Fhir.Model.Base64Binary _QueryElement; + private Hl7.Fhir.Model.Base64Binary? _QueryElement; /// /// Query parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Query + public byte[]? Query { - get { return QueryElement != null ? QueryElement.Value : null; } + get => _QueryElement?.Value; set { - if (value == null) - QueryElement = null; - else - QueryElement = new Hl7.Fhir.Model.Base64Binary(value); + QueryElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Query"); } } @@ -1080,31 +1044,27 @@ public byte[] Query [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(What != null) dest.What = (Hl7.Fhir.Model.ResourceReference)What.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.Coding)Role.DeepCopyInternal(); - if(Lifecycle != null) dest.Lifecycle = (Hl7.Fhir.Model.Coding)Lifecycle.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(QueryElement != null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)QueryElement.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_What is not null) dest.What = (Hl7.Fhir.Model.ResourceReference)_What.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.Coding)_Role.DeepCopyInternal(); + if(_Lifecycle is not null) dest.Lifecycle = (Hl7.Fhir.Model.Coding)_Lifecycle.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_QueryElement is not null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)_QueryElement.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1116,90 +1076,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(What, otherT.What)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Lifecycle, otherT.Lifecycle)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(QueryElement, otherT.QueryElement)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_What, otherT._What)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Lifecycle, otherT._Lifecycle)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "what": - value = What; - return What is not null; + value = _What; + return _What is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "lifecycle": - value = Lifecycle; - return Lifecycle is not null; + value = _Lifecycle; + return _Lifecycle is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "query": - value = QueryElement; - return QueryElement is not null; + value = _QueryElement; + return _QueryElement is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "what": - What = (Hl7.Fhir.Model.ResourceReference)value; + What = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "role": - Role = (Hl7.Fhir.Model.Coding)value; + Role = (Hl7.Fhir.Model.Coding?)value; return this; case "lifecycle": - Lifecycle = (Hl7.Fhir.Model.Coding)value; + Lifecycle = (Hl7.Fhir.Model.Coding?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "query": - QueryElement = (Hl7.Fhir.Model.Base64Binary)value; + QueryElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1210,15 +1170,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (What is not null) yield return new KeyValuePair("what",What); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Lifecycle is not null) yield return new KeyValuePair("lifecycle",Lifecycle); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (QueryElement is not null) yield return new KeyValuePair("query",QueryElement); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_What is not null) yield return new KeyValuePair("what",_What); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Lifecycle is not null) yield return new KeyValuePair("lifecycle",_Lifecycle); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_QueryElement is not null) yield return new KeyValuePair("query",_QueryElement); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -1245,28 +1205,25 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40, FiveWs="FiveWs.context")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Name of the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1279,26 +1236,22 @@ public string Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Base64Binary))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1310,41 +1263,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1355,8 +1308,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1368,13 +1321,13 @@ public override IEnumerable> EnumerateElements() [Binding("AuditEventType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// More specific type/id for the event. @@ -1385,11 +1338,11 @@ public Hl7.Fhir.Model.Coding Type [DataMember] public List Subtype { - get { if(_Subtype==null) _Subtype = new List(); return _Subtype; } + get => _Subtype ?? new List(); set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private List _Subtype; + private List? _Subtype; /// /// Type of action performed during the event. @@ -1398,13 +1351,13 @@ public List Subtype [DeclaredType(Type = typeof(Code))] [Binding("AuditEventAction")] [DataMember] - public Code ActionElement + public Code? ActionElement { get { return _ActionElement; } set { _ActionElement = value; OnPropertyChanged("ActionElement"); } } - private Code _ActionElement; + private Code? _ActionElement; /// /// Type of action performed during the event @@ -1413,13 +1366,10 @@ public Code ActionElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action { - get { return ActionElement != null ? ActionElement.Value : null; } + get => _ActionElement?.Value; set { - if (value == null) - ActionElement = null; - else - ActionElement = new Code(value); + ActionElement = value is null ? null : new Code(value); OnPropertyChanged("Action"); } } @@ -1429,13 +1379,13 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action /// [FhirElement("period", Order=120, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Time when the event was recorded. @@ -1443,13 +1393,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("recorded", InSummary=true, Order=130, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// Time when the event was recorded @@ -1458,13 +1408,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -1476,13 +1423,13 @@ public DateTimeOffset? Recorded [DeclaredType(Type = typeof(Code))] [Binding("AuditEventOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// Whether the event succeeded or failed @@ -1491,13 +1438,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -1507,28 +1451,25 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventOutcome? Outcome /// [FhirElement("outcomeDesc", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString OutcomeDescElement + public Hl7.Fhir.Model.FhirString? OutcomeDescElement { get { return _OutcomeDescElement; } set { _OutcomeDescElement = value; OnPropertyChanged("OutcomeDescElement"); } } - private Hl7.Fhir.Model.FhirString _OutcomeDescElement; + private Hl7.Fhir.Model.FhirString? _OutcomeDescElement; /// /// Description of the event outcome /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OutcomeDesc + public string? OutcomeDesc { - get { return OutcomeDescElement != null ? OutcomeDescElement.Value : null; } + get => _OutcomeDescElement?.Value; set { - if (value == null) - OutcomeDescElement = null; - else - OutcomeDescElement = new Hl7.Fhir.Model.FhirString(value); + OutcomeDescElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OutcomeDesc"); } } @@ -1542,11 +1483,11 @@ public string OutcomeDesc [DataMember] public List PurposeOfEvent { - get { if(_PurposeOfEvent==null) _PurposeOfEvent = new List(); return _PurposeOfEvent; } + get => _PurposeOfEvent ?? new List(); set { _PurposeOfEvent = value; OnPropertyChanged("PurposeOfEvent"); } } - private List _PurposeOfEvent; + private List? _PurposeOfEvent; /// /// Actor involved in the event. @@ -1556,11 +1497,11 @@ public List PurposeOfEvent [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// Audit Event Reporter. @@ -1568,13 +1509,13 @@ public List Agent [FhirElement("source", Order=180, FiveWs="FiveWs.witness")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.AuditEvent.SourceComponent Source + public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.AuditEvent.SourceComponent _Source; + private Hl7.Fhir.Model.AuditEvent.SourceComponent? _Source; /// /// Data or objects used. @@ -1584,33 +1525,29 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent Source [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; protected internal override void CopyToInternal(Base other) { - var dest = other as AuditEvent; - - if (dest == null) - { + if(other is not AuditEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Subtype.Any()) dest.Subtype = new List(Subtype.DeepCopyInternal()); - if(ActionElement != null) dest.ActionElement = (Code)ActionElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(OutcomeDescElement != null) dest.OutcomeDescElement = (Hl7.Fhir.Model.FhirString)OutcomeDescElement.DeepCopyInternal(); - if(PurposeOfEvent.Any()) dest.PurposeOfEvent = new List(PurposeOfEvent.DeepCopyInternal()); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Source != null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)Source.DeepCopyInternal(); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Subtype is not null) dest.Subtype = new List(_Subtype.DeepCopyInternal()); + if(_ActionElement is not null) dest.ActionElement = (Code)_ActionElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_OutcomeDescElement is not null) dest.OutcomeDescElement = (Hl7.Fhir.Model.FhirString)_OutcomeDescElement.DeepCopyInternal(); + if(_PurposeOfEvent is not null) dest.PurposeOfEvent = new List(_PurposeOfEvent.DeepCopyInternal()); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)_Source.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1622,104 +1559,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AuditEvent; - if(otherT == null) return false; + if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Subtype, otherT.Subtype)) return false; - if(!comparer.Equals(ActionElement, otherT.ActionElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(OutcomeDescElement, otherT.OutcomeDescElement)) return false; - if(!comparer.ListEquals(PurposeOfEvent, otherT.PurposeOfEvent)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; + if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_OutcomeDescElement, otherT._OutcomeDescElement)) return false; + if(!comparer.ListEquals(_PurposeOfEvent, otherT._PurposeOfEvent)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subtype": - value = Subtype; - return Subtype?.Any() == true; + value = _Subtype; + return _Subtype?.Any() == true; case "action": - value = ActionElement; - return ActionElement is not null; + value = _ActionElement; + return _ActionElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "outcomeDesc": - value = OutcomeDescElement; - return OutcomeDescElement is not null; + value = _OutcomeDescElement; + return _OutcomeDescElement is not null; case "purposeOfEvent": - value = PurposeOfEvent; - return PurposeOfEvent?.Any() == true; + value = _PurposeOfEvent; + return _PurposeOfEvent?.Any() == true; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "subtype": - Subtype = (List)value; + Subtype = (List?)value!; return this; case "action": - ActionElement = (Code)value; + ActionElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "outcomeDesc": - OutcomeDescElement = (Hl7.Fhir.Model.FhirString)value; + OutcomeDescElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "purposeOfEvent": - PurposeOfEvent = (List)value; + PurposeOfEvent = (List?)value!; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "source": - Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)value; + Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent?)value; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1730,17 +1667,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subtype?.Any() == true) yield return new KeyValuePair("subtype",Subtype); - if (ActionElement is not null) yield return new KeyValuePair("action",ActionElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (OutcomeDescElement is not null) yield return new KeyValuePair("outcomeDesc",OutcomeDescElement); - if (PurposeOfEvent?.Any() == true) yield return new KeyValuePair("purposeOfEvent",PurposeOfEvent); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subtype?.Any() == true) yield return new KeyValuePair("subtype",_Subtype); + if (_ActionElement is not null) yield return new KeyValuePair("action",_ActionElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_OutcomeDescElement is not null) yield return new KeyValuePair("outcomeDesc",_OutcomeDescElement); + if (_PurposeOfEvent?.Any() == true) yield return new KeyValuePair("purposeOfEvent",_PurposeOfEvent); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Basic.cs b/src/Hl7.Fhir.R4/Model/Generated/Basic.cs index 67caca27c..ffe741719 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Basic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Basic","http://hl7.org/fhir/StructureDefinition/Basic")] - public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -67,11 +70,11 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Kind of Resource. @@ -80,13 +83,13 @@ public List Identifier [Binding("BasicResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Identifies the focus of this resource. @@ -95,41 +98,38 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When created. /// [FhirElement("created", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Date CreatedElement + public Hl7.Fhir.Model.Date? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.Date _CreatedElement; + private Hl7.Fhir.Model.Date? _CreatedElement; /// /// When created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.Date(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Created"); } } @@ -141,34 +141,30 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Basic; - - if (dest == null) - { + if(other is not Basic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.Date)CreatedElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.Date)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,62 +176,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Basic; - if(otherT == null) return false; + if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.Date)value; + CreatedElement = (Hl7.Fhir.Model.Date?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -246,11 +242,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs index 4097bf777..ab2575776 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -171,13 +174,13 @@ public partial class CollectionComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Collector + public Hl7.Fhir.Model.ResourceReference? Collector { get { return _Collector; } set { _Collector = value; OnPropertyChanged("Collector"); } } - private Hl7.Fhir.Model.ResourceReference _Collector; + private Hl7.Fhir.Model.ResourceReference? _Collector; /// /// Who is product from. @@ -186,13 +189,13 @@ public Hl7.Fhir.Model.ResourceReference Collector [CLSCompliant(false)] [References("Patient","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Time of product collection. @@ -201,27 +204,23 @@ public Hl7.Fhir.Model.ResourceReference Source [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Collected + public Hl7.Fhir.Model.DataType? Collected { get { return _Collected; } set { _Collected = value; OnPropertyChanged("Collected"); } } - private Hl7.Fhir.Model.DataType _Collected; + private Hl7.Fhir.Model.DataType? _Collected; protected internal override void CopyToInternal(Base other) { - var dest = other as CollectionComponent; - - if (dest == null) - { + if(other is not CollectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Collector != null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)Collector.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Collected != null) dest.Collected = (Hl7.Fhir.Model.DataType)Collected.DeepCopyInternal(); + if(_Collector is not null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)_Collector.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Collected is not null) dest.Collected = (Hl7.Fhir.Model.DataType)_Collected.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -233,48 +232,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CollectionComponent; - if(otherT == null) return false; + if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Collector, otherT.Collector)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Collected, otherT.Collected)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Collected, otherT._Collected)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "collector": - value = Collector; - return Collector is not null; + value = _Collector; + return _Collector is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "collected": - value = Collected; - return Collected is not null; + value = _Collected; + return _Collected is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "collector": - Collector = (Hl7.Fhir.Model.ResourceReference)value; + Collector = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "collected": - Collected = (Hl7.Fhir.Model.DataType)value; + Collected = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -285,9 +284,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Collector is not null) yield return new KeyValuePair("collector",Collector); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Collected is not null) yield return new KeyValuePair("collected",Collected); + if (_Collector is not null) yield return new KeyValuePair("collector",_Collector); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Collected is not null) yield return new KeyValuePair("collected",_Collected); } } @@ -313,28 +312,25 @@ public partial class ProcessingComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of of processing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -345,13 +341,13 @@ public string Description [FhirElement("procedure", Order=50)] [Binding("BiologicallyDerivedProductProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Procedure + public Hl7.Fhir.Model.CodeableConcept? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.CodeableConcept _Procedure; + private Hl7.Fhir.Model.CodeableConcept? _Procedure; /// /// Substance added during processing. @@ -360,13 +356,13 @@ public Hl7.Fhir.Model.CodeableConcept Procedure [CLSCompliant(false)] [References("Substance")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Additive + public Hl7.Fhir.Model.ResourceReference? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.ResourceReference _Additive; + private Hl7.Fhir.Model.ResourceReference? _Additive; /// /// Time of processing. @@ -375,28 +371,24 @@ public Hl7.Fhir.Model.ResourceReference Additive [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessingComponent; - - if (dest == null) - { + if(other is not ProcessingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)Procedure.DeepCopyInternal(); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.ResourceReference)Additive.DeepCopyInternal(); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)_Procedure.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.ResourceReference)_Additive.DeepCopyInternal(); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -408,55 +400,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessingComponent; - if(otherT == null) return false; + if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.CodeableConcept)value; + Procedure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additive": - Additive = (Hl7.Fhir.Model.ResourceReference)value; + Additive = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -467,10 +459,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Additive is not null) yield return new KeyValuePair("additive",Additive); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -496,28 +488,25 @@ public partial class ManipulationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of manipulation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -529,26 +518,22 @@ public string Description [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ManipulationComponent; - - if (dest == null) - { + if(other is not ManipulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -560,41 +545,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManipulationComponent; - if(otherT == null) return false; + if(other is not ManipulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -605,8 +590,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -629,28 +614,25 @@ public partial class StorageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of storage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -660,13 +642,13 @@ public string Description /// [FhirElement("temperature", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TemperatureElement + public Hl7.Fhir.Model.FhirDecimal? TemperatureElement { get { return _TemperatureElement; } set { _TemperatureElement = value; OnPropertyChanged("TemperatureElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TemperatureElement; + private Hl7.Fhir.Model.FhirDecimal? _TemperatureElement; /// /// Storage temperature @@ -675,13 +657,10 @@ public Hl7.Fhir.Model.FhirDecimal TemperatureElement [IgnoreDataMember] public decimal? Temperature { - get { return TemperatureElement != null ? TemperatureElement.Value : null; } + get => _TemperatureElement?.Value; set { - if (value == null) - TemperatureElement = null; - else - TemperatureElement = new Hl7.Fhir.Model.FhirDecimal(value); + TemperatureElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Temperature"); } } @@ -693,13 +672,13 @@ public decimal? Temperature [DeclaredType(Type = typeof(Code))] [Binding("BiologicallyDerivedProductStorageScale")] [DataMember] - public Code ScaleElement + public Code? ScaleElement { get { return _ScaleElement; } set { _ScaleElement = value; OnPropertyChanged("ScaleElement"); } } - private Code _ScaleElement; + private Code? _ScaleElement; /// /// farenheit | celsius | kelvin @@ -708,13 +687,10 @@ public Code _ScaleElement?.Value; set { - if (value == null) - ScaleElement = null; - else - ScaleElement = new Code(value); + ScaleElement = value is null ? null : new Code(value); OnPropertyChanged("Scale"); } } @@ -724,28 +700,24 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductStora /// [FhirElement("duration", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Duration + public Hl7.Fhir.Model.Period? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Period _Duration; + private Hl7.Fhir.Model.Period? _Duration; protected internal override void CopyToInternal(Base other) { - var dest = other as StorageComponent; - - if (dest == null) - { + if(other is not StorageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TemperatureElement != null) dest.TemperatureElement = (Hl7.Fhir.Model.FhirDecimal)TemperatureElement.DeepCopyInternal(); - if(ScaleElement != null) dest.ScaleElement = (Code)ScaleElement.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Period)Duration.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TemperatureElement is not null) dest.TemperatureElement = (Hl7.Fhir.Model.FhirDecimal)_TemperatureElement.DeepCopyInternal(); + if(_ScaleElement is not null) dest.ScaleElement = (Code)_ScaleElement.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Period)_Duration.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -757,55 +729,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StorageComponent; - if(otherT == null) return false; + if(other is not StorageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TemperatureElement, otherT.TemperatureElement)) return false; - if(!comparer.Equals(ScaleElement, otherT.ScaleElement)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TemperatureElement, otherT._TemperatureElement)) return false; + if(!comparer.Equals(_ScaleElement, otherT._ScaleElement)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "temperature": - value = TemperatureElement; - return TemperatureElement is not null; + value = _TemperatureElement; + return _TemperatureElement is not null; case "scale": - value = ScaleElement; - return ScaleElement is not null; + value = _ScaleElement; + return _ScaleElement is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "temperature": - TemperatureElement = (Hl7.Fhir.Model.FhirDecimal)value; + TemperatureElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "scale": - ScaleElement = (Code)value; + ScaleElement = (Code?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Period)value; + Duration = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -816,10 +788,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TemperatureElement is not null) yield return new KeyValuePair("temperature",TemperatureElement); - if (ScaleElement is not null) yield return new KeyValuePair("scale",ScaleElement); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TemperatureElement is not null) yield return new KeyValuePair("temperature",_TemperatureElement); + if (_ScaleElement is not null) yield return new KeyValuePair("scale",_ScaleElement); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); } } @@ -832,11 +804,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// organ | tissue | fluid | cells | biologicalAgent. @@ -845,13 +817,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("BiologicallyDerivedProductCategory")] [DataMember] - public Code ProductCategoryElement + public Code? ProductCategoryElement { get { return _ProductCategoryElement; } set { _ProductCategoryElement = value; OnPropertyChanged("ProductCategoryElement"); } } - private Code _ProductCategoryElement; + private Code? _ProductCategoryElement; /// /// organ | tissue | fluid | cells | biologicalAgent @@ -860,13 +832,10 @@ public Code _ProductCategoryElement?.Value; set { - if (value == null) - ProductCategoryElement = null; - else - ProductCategoryElement = new Code(value); + ProductCategoryElement = value is null ? null : new Code(value); OnPropertyChanged("ProductCategory"); } } @@ -877,13 +846,13 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductCateg [FhirElement("productCode", Order=110)] [Binding("BiologicallyDerivedProductCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductCode + public Hl7.Fhir.Model.CodeableConcept? ProductCode { get { return _ProductCode; } set { _ProductCode = value; OnPropertyChanged("ProductCode"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductCode; + private Hl7.Fhir.Model.CodeableConcept? _ProductCode; /// /// available | unavailable. @@ -892,13 +861,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductCode [DeclaredType(Type = typeof(Code))] [Binding("BiologicallyDerivedProductStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// available | unavailable @@ -907,13 +876,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -928,24 +894,24 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatu [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// The amount of this biologically derived product. /// [FhirElement("quantity", Order=140)] [DataMember] - public Hl7.Fhir.Model.Integer QuantityElement + public Hl7.Fhir.Model.Integer? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.Integer _QuantityElement; + private Hl7.Fhir.Model.Integer? _QuantityElement; /// /// The amount of this biologically derived product @@ -954,13 +920,10 @@ public Hl7.Fhir.Model.Integer QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.Integer(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Quantity"); } } @@ -975,24 +938,24 @@ public int? Quantity [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// How this product was collected. /// [FhirElement("collection", Order=160)] [DataMember] - public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent Collection + public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? Collection { get { return _Collection; } set { _Collection = value; OnPropertyChanged("Collection"); } } - private Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent _Collection; + private Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? _Collection; /// /// Any processing of the product during collection. @@ -1002,24 +965,24 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent Collection [DataMember] public List Processing { - get { if(_Processing==null) _Processing = new List(); return _Processing; } + get => _Processing ?? new List(); set { _Processing = value; OnPropertyChanged("Processing"); } } - private List _Processing; + private List? _Processing; /// /// Any manipulation of product post-collection. /// [FhirElement("manipulation", Order=180)] [DataMember] - public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent Manipulation + public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent? Manipulation { get { return _Manipulation; } set { _Manipulation = value; OnPropertyChanged("Manipulation"); } } - private Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent _Manipulation; + private Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent? _Manipulation; /// /// Product storage. @@ -1029,35 +992,31 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent Manipulat [DataMember] public List Storage { - get { if(_Storage==null) _Storage = new List(); return _Storage; } + get => _Storage ?? new List(); set { _Storage = value; OnPropertyChanged("Storage"); } } - private List _Storage; + private List? _Storage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as BiologicallyDerivedProduct; - - if (dest == null) - { + if(other is not BiologicallyDerivedProduct dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ProductCategoryElement != null) dest.ProductCategoryElement = (Code)ProductCategoryElement.DeepCopyInternal(); - if(ProductCode != null) dest.ProductCode = (Hl7.Fhir.Model.CodeableConcept)ProductCode.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)QuantityElement.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Collection != null) dest.Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)Collection.DeepCopyInternal(); - if(Processing.Any()) dest.Processing = new List(Processing.DeepCopyInternal()); - if(Manipulation != null) dest.Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent)Manipulation.DeepCopyInternal(); - if(Storage.Any()) dest.Storage = new List(Storage.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ProductCategoryElement is not null) dest.ProductCategoryElement = (Code)_ProductCategoryElement.DeepCopyInternal(); + if(_ProductCode is not null) dest.ProductCode = (Hl7.Fhir.Model.CodeableConcept)_ProductCode.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)_QuantityElement.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Collection is not null) dest.Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)_Collection.DeepCopyInternal(); + if(_Processing is not null) dest.Processing = new List(_Processing.DeepCopyInternal()); + if(_Manipulation is not null) dest.Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent)_Manipulation.DeepCopyInternal(); + if(_Storage is not null) dest.Storage = new List(_Storage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1069,104 +1028,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BiologicallyDerivedProduct; - if(otherT == null) return false; + if(other is not BiologicallyDerivedProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ProductCategoryElement, otherT.ProductCategoryElement)) return false; - if(!comparer.Equals(ProductCode, otherT.ProductCode)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(Processing, otherT.Processing)) return false; - if(!comparer.Equals(Manipulation, otherT.Manipulation)) return false; - if(!comparer.ListEquals(Storage, otherT.Storage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ProductCategoryElement, otherT._ProductCategoryElement)) return false; + if(!comparer.Equals(_ProductCode, otherT._ProductCode)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; + if(!comparer.Equals(_Manipulation, otherT._Manipulation)) return false; + if(!comparer.ListEquals(_Storage, otherT._Storage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "productCategory": - value = ProductCategoryElement; - return ProductCategoryElement is not null; + value = _ProductCategoryElement; + return _ProductCategoryElement is not null; case "productCode": - value = ProductCode; - return ProductCode is not null; + value = _ProductCode; + return _ProductCode is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "collection": - value = Collection; - return Collection is not null; + value = _Collection; + return _Collection is not null; case "processing": - value = Processing; - return Processing?.Any() == true; + value = _Processing; + return _Processing?.Any() == true; case "manipulation": - value = Manipulation; - return Manipulation is not null; + value = _Manipulation; + return _Manipulation is not null; case "storage": - value = Storage; - return Storage?.Any() == true; + value = _Storage; + return _Storage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "productCategory": - ProductCategoryElement = (Code)value; + ProductCategoryElement = (Code?)value; return this; case "productCode": - ProductCode = (Hl7.Fhir.Model.CodeableConcept)value; + ProductCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.Integer)value; + QuantityElement = (Hl7.Fhir.Model.Integer?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "collection": - Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)value; + Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent?)value; return this; case "processing": - Processing = (List)value; + Processing = (List?)value!; return this; case "manipulation": - Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent)value; + Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent?)value; return this; case "storage": - Storage = (List)value; + Storage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1177,17 +1136,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ProductCategoryElement is not null) yield return new KeyValuePair("productCategory",ProductCategoryElement); - if (ProductCode is not null) yield return new KeyValuePair("productCode",ProductCode); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Collection is not null) yield return new KeyValuePair("collection",Collection); - if (Processing?.Any() == true) yield return new KeyValuePair("processing",Processing); - if (Manipulation is not null) yield return new KeyValuePair("manipulation",Manipulation); - if (Storage?.Any() == true) yield return new KeyValuePair("storage",Storage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ProductCategoryElement is not null) yield return new KeyValuePair("productCategory",_ProductCategoryElement); + if (_ProductCode is not null) yield return new KeyValuePair("productCode",_ProductCode); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Collection is not null) yield return new KeyValuePair("collection",_Collection); + if (_Processing?.Any() == true) yield return new KeyValuePair("processing",_Processing); + if (_Manipulation is not null) yield return new KeyValuePair("manipulation",_Manipulation); + if (_Storage?.Any() == true) yield return new KeyValuePair("storage",_Storage); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs index 8ba3de1c6..0e2801bb4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("BodyStructure","http://hl7.org/fhir/StructureDefinition/BodyStructure")] - public partial class BodyStructure : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class BodyStructure : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -67,24 +70,24 @@ public partial class BodyStructure : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this record is in active use @@ -93,13 +96,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -110,13 +110,13 @@ public bool? Active [FhirElement("morphology", InSummary=true, Order=110, FiveWs="FiveWs.what[x]")] [Binding("BodyStructureCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Morphology + public Hl7.Fhir.Model.CodeableConcept? Morphology { get { return _Morphology; } set { _Morphology = value; OnPropertyChanged("Morphology"); } } - private Hl7.Fhir.Model.CodeableConcept _Morphology; + private Hl7.Fhir.Model.CodeableConcept? _Morphology; /// /// Body site. @@ -124,13 +124,13 @@ public Hl7.Fhir.Model.CodeableConcept Morphology [FhirElement("location", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Location + public Hl7.Fhir.Model.CodeableConcept? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.CodeableConcept _Location; + private Hl7.Fhir.Model.CodeableConcept? _Location; /// /// Body site modifier. @@ -141,39 +141,36 @@ public Hl7.Fhir.Model.CodeableConcept Location [DataMember] public List LocationQualifier { - get { if(_LocationQualifier==null) _LocationQualifier = new List(); return _LocationQualifier; } + get => _LocationQualifier ?? new List(); set { _LocationQualifier = value; OnPropertyChanged("LocationQualifier"); } } - private List _LocationQualifier; + private List? _LocationQualifier; /// /// Text description. /// [FhirElement("description", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Text description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -186,11 +183,11 @@ public string Description [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; /// /// Who this is about. @@ -200,37 +197,33 @@ public List Image [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Location; set => Location = value; } - IEnumerable ICoded.ToCodings() => Location.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Location; set => Location = value!; } + IEnumerable ICoded.ToCodings() => Location?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as BodyStructure; - - if (dest == null) - { + if(other is not BodyStructure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Morphology != null) dest.Morphology = (Hl7.Fhir.Model.CodeableConcept)Morphology.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.CodeableConcept)Location.DeepCopyInternal(); - if(LocationQualifier.Any()) dest.LocationQualifier = new List(LocationQualifier.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Morphology is not null) dest.Morphology = (Hl7.Fhir.Model.CodeableConcept)_Morphology.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.CodeableConcept)_Location.DeepCopyInternal(); + if(_LocationQualifier is not null) dest.LocationQualifier = new List(_LocationQualifier.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -242,83 +235,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BodyStructure; - if(otherT == null) return false; + if(other is not BodyStructure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Morphology, otherT.Morphology)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(LocationQualifier, otherT.LocationQualifier)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Morphology, otherT._Morphology)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_LocationQualifier, otherT._LocationQualifier)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "morphology": - value = Morphology; - return Morphology is not null; + value = _Morphology; + return _Morphology is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "locationQualifier": - value = LocationQualifier; - return LocationQualifier?.Any() == true; + value = _LocationQualifier; + return _LocationQualifier?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "morphology": - Morphology = (Hl7.Fhir.Model.CodeableConcept)value; + Morphology = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.CodeableConcept)value; + Location = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "locationQualifier": - LocationQualifier = (List)value; + LocationQualifier = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -329,14 +322,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Morphology is not null) yield return new KeyValuePair("morphology",Morphology); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (LocationQualifier?.Any() == true) yield return new KeyValuePair("locationQualifier",LocationQualifier); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Morphology is not null) yield return new KeyValuePair("morphology",_Morphology); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_LocationQualifier?.Any() == true) yield return new KeyValuePair("locationQualifier",_LocationQualifier); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs index dfe928d75..b4daec901 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -240,11 +243,11 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List OutcomeCodeableConcept { - get { if(_OutcomeCodeableConcept==null) _OutcomeCodeableConcept = new List(); return _OutcomeCodeableConcept; } + get => _OutcomeCodeableConcept ?? new List(); set { _OutcomeCodeableConcept = value; OnPropertyChanged("OutcomeCodeableConcept"); } } - private List _OutcomeCodeableConcept; + private List? _OutcomeCodeableConcept; /// /// Appointment, Encounter, Procedure, etc. @@ -256,11 +259,11 @@ public List OutcomeCodeableConcept [DataMember] public List OutcomeReference { - get { if(_OutcomeReference==null) _OutcomeReference = new List(); return _OutcomeReference; } + get => _OutcomeReference ?? new List(); set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } - private List _OutcomeReference; + private List? _OutcomeReference; /// /// Comments about the activity status/progress. @@ -270,11 +273,11 @@ public List OutcomeReference [DataMember] public List Progress { - get { if(_Progress==null) _Progress = new List(); return _Progress; } + get => _Progress ?? new List(); set { _Progress = value; OnPropertyChanged("Progress"); } } - private List _Progress; + private List? _Progress; /// /// Activity details defined in specific resource. @@ -283,42 +286,38 @@ public List Progress [CLSCompliant(false)] [References("Appointment","CommunicationRequest","DeviceRequest","MedicationRequest","NutritionOrder","Task","ServiceRequest","VisionPrescription","RequestGroup")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// In-line definition of activity. /// [FhirElement("detail", Order=80)] [DataMember] - public Hl7.Fhir.Model.CarePlan.DetailComponent Detail + public Hl7.Fhir.Model.CarePlan.DetailComponent? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.CarePlan.DetailComponent _Detail; + private Hl7.Fhir.Model.CarePlan.DetailComponent? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityComponent; - - if (dest == null) - { + if(other is not ActivityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(OutcomeCodeableConcept.Any()) dest.OutcomeCodeableConcept = new List(OutcomeCodeableConcept.DeepCopyInternal()); - if(OutcomeReference.Any()) dest.OutcomeReference = new List(OutcomeReference.DeepCopyInternal()); - if(Progress.Any()) dest.Progress = new List(Progress.DeepCopyInternal()); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)Detail.DeepCopyInternal(); + if(_OutcomeCodeableConcept is not null) dest.OutcomeCodeableConcept = new List(_OutcomeCodeableConcept.DeepCopyInternal()); + if(_OutcomeReference is not null) dest.OutcomeReference = new List(_OutcomeReference.DeepCopyInternal()); + if(_Progress is not null) dest.Progress = new List(_Progress.DeepCopyInternal()); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)_Detail.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -330,62 +329,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityComponent; - if(otherT == null) return false; + if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(OutcomeCodeableConcept, otherT.OutcomeCodeableConcept)) return false; - if(!comparer.ListEquals(OutcomeReference, otherT.OutcomeReference)) return false; - if(!comparer.ListEquals(Progress, otherT.Progress)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; + if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; + if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outcomeCodeableConcept": - value = OutcomeCodeableConcept; - return OutcomeCodeableConcept?.Any() == true; + value = _OutcomeCodeableConcept; + return _OutcomeCodeableConcept?.Any() == true; case "outcomeReference": - value = OutcomeReference; - return OutcomeReference?.Any() == true; + value = _OutcomeReference; + return _OutcomeReference?.Any() == true; case "progress": - value = Progress; - return Progress?.Any() == true; + value = _Progress; + return _Progress?.Any() == true; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outcomeCodeableConcept": - OutcomeCodeableConcept = (List)value; + OutcomeCodeableConcept = (List?)value!; return this; case "outcomeReference": - OutcomeReference = (List)value; + OutcomeReference = (List?)value!; return this; case "progress": - Progress = (List)value; + Progress = (List?)value!; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)value; + Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent?)value; return this; default: return base.SetValue(key, value); @@ -396,11 +395,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (OutcomeCodeableConcept?.Any() == true) yield return new KeyValuePair("outcomeCodeableConcept",OutcomeCodeableConcept); - if (OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",OutcomeReference); - if (Progress?.Any() == true) yield return new KeyValuePair("progress",Progress); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); + if (_OutcomeCodeableConcept?.Any() == true) yield return new KeyValuePair("outcomeCodeableConcept",_OutcomeCodeableConcept); + if (_OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",_OutcomeReference); + if (_Progress?.Any() == true) yield return new KeyValuePair("progress",_Progress); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); } } @@ -428,13 +427,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("CarePlanActivityKind")] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// Appointment | CommunicationRequest | DeviceRequest | MedicationRequest | NutritionOrder | Task | ServiceRequest | VisionPrescription @@ -443,13 +442,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanActivityKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -462,24 +458,24 @@ public Hl7.Fhir.Model.CarePlan.CarePlanActivityKind? Kind [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -494,24 +490,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -524,13 +520,13 @@ public IEnumerable InstantiatesUri [FhirElement("code", Order=70)] [Binding("CarePlanActivityType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Why activity should be done or why activity was prohibited. @@ -541,11 +537,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why activity is needed. @@ -557,11 +553,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Goals this activity relates to. @@ -573,11 +569,11 @@ public List ReasonReference [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// not-started | scheduled | in-progress | on-hold | completed | cancelled | stopped | unknown | entered-in-error. @@ -587,13 +583,13 @@ public List Goal [Binding("CarePlanActivityStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// not-started | scheduled | in-progress | on-hold | completed | cancelled | stopped | unknown | entered-in-error @@ -602,13 +598,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanActivityStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -618,26 +611,26 @@ public Hl7.Fhir.Model.CarePlan.CarePlanActivityStatus? Status /// [FhirElement("statusReason", Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// If true, activity is prohibiting action. /// [FhirElement("doNotPerform", IsModifier=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// If true, activity is prohibiting action @@ -646,13 +639,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -664,13 +654,13 @@ public bool? DoNotPerform [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Scheduled + public Hl7.Fhir.Model.DataType? Scheduled { get { return _Scheduled; } set { _Scheduled = value; OnPropertyChanged("Scheduled"); } } - private Hl7.Fhir.Model.DataType _Scheduled; + private Hl7.Fhir.Model.DataType? _Scheduled; /// /// Where it should happen. @@ -679,13 +669,13 @@ public Hl7.Fhir.Model.DataType Scheduled [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Who will be responsible?. @@ -697,11 +687,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// What is to be administered/supplied. @@ -712,98 +702,91 @@ public List Performer [References("Medication","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// How to consume/day?. /// [FhirElement("dailyAmount", Order=180)] [DataMember] - public Hl7.Fhir.Model.Quantity DailyAmount + public Hl7.Fhir.Model.Quantity? DailyAmount { get { return _DailyAmount; } set { _DailyAmount = value; OnPropertyChanged("DailyAmount"); } } - private Hl7.Fhir.Model.Quantity _DailyAmount; + private Hl7.Fhir.Model.Quantity? _DailyAmount; /// /// How much to administer/supply/consume. /// [FhirElement("quantity", Order=190)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Extra info describing activity to perform. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Extra info describing activity to perform /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Scheduled != null) dest.Scheduled = (Hl7.Fhir.Model.DataType)Scheduled.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(DailyAmount != null) dest.DailyAmount = (Hl7.Fhir.Model.Quantity)DailyAmount.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Scheduled is not null) dest.Scheduled = (Hl7.Fhir.Model.DataType)_Scheduled.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_DailyAmount is not null) dest.DailyAmount = (Hl7.Fhir.Model.Quantity)_DailyAmount.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -815,146 +798,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Scheduled, otherT.Scheduled)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(DailyAmount, otherT.DailyAmount)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Scheduled, otherT._Scheduled)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_DailyAmount, otherT._DailyAmount)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "scheduled": - value = Scheduled; - return Scheduled is not null; + value = _Scheduled; + return _Scheduled is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "dailyAmount": - value = DailyAmount; - return DailyAmount is not null; + value = _DailyAmount; + return _DailyAmount is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "scheduled": - Scheduled = (Hl7.Fhir.Model.DataType)value; + Scheduled = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "dailyAmount": - DailyAmount = (Hl7.Fhir.Model.Quantity)value; + DailyAmount = (Hl7.Fhir.Model.Quantity?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -965,23 +948,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Scheduled is not null) yield return new KeyValuePair("scheduled",Scheduled); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (DailyAmount is not null) yield return new KeyValuePair("dailyAmount",DailyAmount); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Scheduled is not null) yield return new KeyValuePair("scheduled",_Scheduled); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_DailyAmount is not null) yield return new KeyValuePair("dailyAmount",_DailyAmount); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -994,11 +977,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -1008,24 +991,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1040,24 +1023,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1074,11 +1057,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// CarePlan replaced by this CarePlan. @@ -1090,11 +1073,11 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Part of referenced CarePlan. @@ -1106,11 +1089,11 @@ public List Replaces [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -1120,13 +1103,13 @@ public List PartOf [Binding("CarePlanStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -1135,13 +1118,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1154,13 +1134,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("CarePlanIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | option @@ -1169,13 +1149,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1189,39 +1166,36 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Human-friendly name for the care plan. /// [FhirElement("title", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human-friendly name for the care plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1231,28 +1205,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=190, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Summary of nature of plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1265,13 +1236,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -1280,54 +1251,51 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time period plan covers. /// [FhirElement("period", InSummary=true, Order=220, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Date record was first recorded. /// [FhirElement("created", InSummary=true, Order=230, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Date record was first recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1339,13 +1307,13 @@ public string Created [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Device","RelatedPerson","Organization","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Who provided the content of the care plan. @@ -1357,11 +1325,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Who's involved in plan?. @@ -1373,11 +1341,11 @@ public List Contributor [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Health issues this plan addresses. @@ -1389,11 +1357,11 @@ public List CareTeam [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Information considered as part of plan. @@ -1405,11 +1373,11 @@ public List Addresses [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Desired outcome of plan. @@ -1421,11 +1389,11 @@ public List SupportingInfo [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Action to occur as part of plan. @@ -1435,11 +1403,11 @@ public List Goal [DataMember] public List Activity { - get { if(_Activity==null) _Activity = new List(); return _Activity; } + get => _Activity ?? new List(); set { _Activity = value; OnPropertyChanged("Activity"); } } - private List _Activity; + private List? _Activity; /// /// Comments about the plan. @@ -1449,50 +1417,46 @@ public List Activity [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category.ToCodings(); + IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as CarePlan; - - if (dest == null) - { + if(other is not CarePlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Activity.Any()) dest.Activity = new List(Activity.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = new List(_Activity.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1504,188 +1468,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CarePlan; - if(otherT == null) return false; + if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "activity": - value = Activity; - return Activity?.Any() == true; + value = _Activity; + return _Activity?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "activity": - Activity = (List)value; + Activity = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1696,29 +1660,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Activity?.Any() == true) yield return new KeyValuePair("activity",Activity); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Activity?.Any() == true) yield return new KeyValuePair("activity",_Activity); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs index 7b47eddc9..506f7ad0e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -124,11 +127,11 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Who is involved. @@ -137,13 +140,13 @@ public List Role [CLSCompliant(false)] [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Organization","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Member + public Hl7.Fhir.Model.ResourceReference? Member { get { return _Member; } set { _Member = value; OnPropertyChanged("Member"); } } - private Hl7.Fhir.Model.ResourceReference _Member; + private Hl7.Fhir.Model.ResourceReference? _Member; /// /// Organization of the practitioner. @@ -152,41 +155,37 @@ public Hl7.Fhir.Model.ResourceReference Member [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// Time period of participant. /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Member != null) dest.Member = (Hl7.Fhir.Model.ResourceReference)Member.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Member is not null) dest.Member = (Hl7.Fhir.Model.ResourceReference)_Member.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -198,55 +197,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Member, otherT.Member)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Member, otherT._Member)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "member": - value = Member; - return Member is not null; + value = _Member; + return _Member is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (List)value; + Role = (List?)value!; return this; case "member": - Member = (Hl7.Fhir.Model.ResourceReference)value; + Member = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -257,10 +256,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Member is not null) yield return new KeyValuePair("member",Member); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Member is not null) yield return new KeyValuePair("member",_Member); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -273,11 +272,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | active | suspended | inactive | entered-in-error. @@ -286,13 +285,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("CareTeamStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | active | suspended | inactive | entered-in-error @@ -301,13 +300,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -321,39 +317,36 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Name of the team, such as crisis assessment team. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the team, such as crisis assessment team /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -365,13 +358,13 @@ public string Name [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -380,26 +373,26 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time period team covers. /// [FhirElement("period", InSummary=true, Order=150, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Members of the team. @@ -409,11 +402,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Why the care team exists. @@ -424,11 +417,11 @@ public List Participant [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why the care team exists. @@ -440,11 +433,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Organization responsible for the care team. @@ -456,11 +449,11 @@ public List ReasonReference [DataMember] public List ManagingOrganization { - get { if(_ManagingOrganization==null) _ManagingOrganization = new List(); return _ManagingOrganization; } + get => _ManagingOrganization ?? new List(); set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private List _ManagingOrganization; + private List? _ManagingOrganization; /// /// A contact detail for the care team (that applies to all members). @@ -470,11 +463,11 @@ public List ManagingOrganization [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Comments made about the CareTeam. @@ -484,40 +477,36 @@ public List Telecom [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category.ToCodings(); + IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeam; - - if (dest == null) - { + if(other is not CareTeam dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(ManagingOrganization.Any()) dest.ManagingOrganization = new List(ManagingOrganization.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = new List(_ManagingOrganization.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -529,118 +518,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeam; - if(otherT == null) return false; + if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization?.Any() == true; + value = _ManagingOrganization; + return _ManagingOrganization?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (List)value; + ManagingOrganization = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -651,19 +640,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs b/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs index 88f6d2901..5a8334684 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -105,13 +108,13 @@ public partial class RelatedEntryComponent : Hl7.Fhir.Model.BackboneElement [Binding("CatalogEntryRelationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationtypeElement + public Code? RelationtypeElement { get { return _RelationtypeElement; } set { _RelationtypeElement = value; OnPropertyChanged("RelationtypeElement"); } } - private Code _RelationtypeElement; + private Code? _RelationtypeElement; /// /// triggers | is-replaced-by @@ -120,13 +123,10 @@ public Code RelationtypeEl [IgnoreDataMember] public Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType? Relationtype { - get { return RelationtypeElement != null ? RelationtypeElement.Value : null; } + get => _RelationtypeElement?.Value; set { - if (value == null) - RelationtypeElement = null; - else - RelationtypeElement = new Code(value); + RelationtypeElement = value is null ? null : new Code(value); OnPropertyChanged("Relationtype"); } } @@ -139,26 +139,22 @@ public Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType? Relationtype [References("CatalogEntry")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Item + public Hl7.Fhir.Model.ResourceReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.ResourceReference _Item; + private Hl7.Fhir.Model.ResourceReference? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedEntryComponent; - - if (dest == null) - { + if(other is not RelatedEntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RelationtypeElement != null) dest.RelationtypeElement = (Code)RelationtypeElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.ResourceReference)Item.DeepCopyInternal(); + if(_RelationtypeElement is not null) dest.RelationtypeElement = (Code)_RelationtypeElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.ResourceReference)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -170,41 +166,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedEntryComponent; - if(otherT == null) return false; + if(other is not RelatedEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RelationtypeElement, otherT.RelationtypeElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationtypeElement, otherT._RelationtypeElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationtype": - value = RelationtypeElement; - return RelationtypeElement is not null; + value = _RelationtypeElement; + return _RelationtypeElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationtype": - RelationtypeElement = (Code)value; + RelationtypeElement = (Code?)value; return this; case "item": - Item = (Hl7.Fhir.Model.ResourceReference)value; + Item = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -215,8 +211,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RelationtypeElement is not null) yield return new KeyValuePair("relationtype",RelationtypeElement); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_RelationtypeElement is not null) yield return new KeyValuePair("relationtype",_RelationtypeElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -229,24 +225,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The type of item - medication, device, service, protocol or other. /// [FhirElement("type", Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Whether the entry represents an orderable item. @@ -254,13 +250,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("orderable", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OrderableElement + public Hl7.Fhir.Model.FhirBoolean? OrderableElement { get { return _OrderableElement; } set { _OrderableElement = value; OnPropertyChanged("OrderableElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OrderableElement; + private Hl7.Fhir.Model.FhirBoolean? _OrderableElement; /// /// Whether the entry represents an orderable item @@ -269,13 +265,10 @@ public Hl7.Fhir.Model.FhirBoolean OrderableElement [IgnoreDataMember] public bool? Orderable { - get { return OrderableElement != null ? OrderableElement.Value : null; } + get => _OrderableElement?.Value; set { - if (value == null) - OrderableElement = null; - else - OrderableElement = new Hl7.Fhir.Model.FhirBoolean(value); + OrderableElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Orderable"); } } @@ -288,13 +281,13 @@ public bool? Orderable [References("Medication","Device","Organization","Practitioner","PractitionerRole","HealthcareService","ActivityDefinition","PlanDefinition","SpecimenDefinition","ObservationDefinition","Binary")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReferencedItem + public Hl7.Fhir.Model.ResourceReference? ReferencedItem { get { return _ReferencedItem; } set { _ReferencedItem = value; OnPropertyChanged("ReferencedItem"); } } - private Hl7.Fhir.Model.ResourceReference _ReferencedItem; + private Hl7.Fhir.Model.ResourceReference? _ReferencedItem; /// /// Any additional identifier(s) for the catalog item, in the same granularity or concept. @@ -304,11 +297,11 @@ public Hl7.Fhir.Model.ResourceReference ReferencedItem [DataMember] public List AdditionalIdentifier { - get { if(_AdditionalIdentifier==null) _AdditionalIdentifier = new List(); return _AdditionalIdentifier; } + get => _AdditionalIdentifier ?? new List(); set { _AdditionalIdentifier = value; OnPropertyChanged("AdditionalIdentifier"); } } - private List _AdditionalIdentifier; + private List? _AdditionalIdentifier; /// /// Classification (category or class) of the item entry. @@ -318,11 +311,11 @@ public List AdditionalIdentifier [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// draft | active | retired | unknown. @@ -331,13 +324,13 @@ public List Classification [DeclaredType(Type = typeof(Code))] [Binding("PublicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -346,13 +339,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -362,41 +352,38 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("validityPeriod", Order=160)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// The date until which this catalog entry is expected to be active. /// [FhirElement("validTo", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValidToElement + public Hl7.Fhir.Model.FhirDateTime? ValidToElement { get { return _ValidToElement; } set { _ValidToElement = value; OnPropertyChanged("ValidToElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValidToElement; + private Hl7.Fhir.Model.FhirDateTime? _ValidToElement; /// /// The date until which this catalog entry is expected to be active /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidTo + public string? ValidTo { - get { return ValidToElement != null ? ValidToElement.Value : null; } + get => _ValidToElement?.Value; set { - if (value == null) - ValidToElement = null; - else - ValidToElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValidToElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ValidTo"); } } @@ -406,28 +393,25 @@ public string ValidTo /// [FhirElement("lastUpdated", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastUpdatedElement + public Hl7.Fhir.Model.FhirDateTime? LastUpdatedElement { get { return _LastUpdatedElement; } set { _LastUpdatedElement = value; OnPropertyChanged("LastUpdatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastUpdatedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastUpdatedElement; /// /// When was this catalog last updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastUpdated + public string? LastUpdated { - get { return LastUpdatedElement != null ? LastUpdatedElement.Value : null; } + get => _LastUpdatedElement?.Value; set { - if (value == null) - LastUpdatedElement = null; - else - LastUpdatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastUpdatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastUpdated"); } } @@ -440,11 +424,11 @@ public string LastUpdated [DataMember] public List AdditionalCharacteristic { - get { if(_AdditionalCharacteristic==null) _AdditionalCharacteristic = new List(); return _AdditionalCharacteristic; } + get => _AdditionalCharacteristic ?? new List(); set { _AdditionalCharacteristic = value; OnPropertyChanged("AdditionalCharacteristic"); } } - private List _AdditionalCharacteristic; + private List? _AdditionalCharacteristic; /// /// Additional classification of the catalog entry. @@ -454,11 +438,11 @@ public List AdditionalCharacteristic [DataMember] public List AdditionalClassification { - get { if(_AdditionalClassification==null) _AdditionalClassification = new List(); return _AdditionalClassification; } + get => _AdditionalClassification ?? new List(); set { _AdditionalClassification = value; OnPropertyChanged("AdditionalClassification"); } } - private List _AdditionalClassification; + private List? _AdditionalClassification; /// /// An item that this catalog entry is related to. @@ -468,37 +452,33 @@ public List AdditionalClassification [DataMember] public List RelatedEntry { - get { if(_RelatedEntry==null) _RelatedEntry = new List(); return _RelatedEntry; } + get => _RelatedEntry ?? new List(); set { _RelatedEntry = value; OnPropertyChanged("RelatedEntry"); } } - private List _RelatedEntry; + private List? _RelatedEntry; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CatalogEntry; - - if (dest == null) - { + if(other is not CatalogEntry dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(OrderableElement != null) dest.OrderableElement = (Hl7.Fhir.Model.FhirBoolean)OrderableElement.DeepCopyInternal(); - if(ReferencedItem != null) dest.ReferencedItem = (Hl7.Fhir.Model.ResourceReference)ReferencedItem.DeepCopyInternal(); - if(AdditionalIdentifier.Any()) dest.AdditionalIdentifier = new List(AdditionalIdentifier.DeepCopyInternal()); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(ValidToElement != null) dest.ValidToElement = (Hl7.Fhir.Model.FhirDateTime)ValidToElement.DeepCopyInternal(); - if(LastUpdatedElement != null) dest.LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime)LastUpdatedElement.DeepCopyInternal(); - if(AdditionalCharacteristic.Any()) dest.AdditionalCharacteristic = new List(AdditionalCharacteristic.DeepCopyInternal()); - if(AdditionalClassification.Any()) dest.AdditionalClassification = new List(AdditionalClassification.DeepCopyInternal()); - if(RelatedEntry.Any()) dest.RelatedEntry = new List(RelatedEntry.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_OrderableElement is not null) dest.OrderableElement = (Hl7.Fhir.Model.FhirBoolean)_OrderableElement.DeepCopyInternal(); + if(_ReferencedItem is not null) dest.ReferencedItem = (Hl7.Fhir.Model.ResourceReference)_ReferencedItem.DeepCopyInternal(); + if(_AdditionalIdentifier is not null) dest.AdditionalIdentifier = new List(_AdditionalIdentifier.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_ValidToElement is not null) dest.ValidToElement = (Hl7.Fhir.Model.FhirDateTime)_ValidToElement.DeepCopyInternal(); + if(_LastUpdatedElement is not null) dest.LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime)_LastUpdatedElement.DeepCopyInternal(); + if(_AdditionalCharacteristic is not null) dest.AdditionalCharacteristic = new List(_AdditionalCharacteristic.DeepCopyInternal()); + if(_AdditionalClassification is not null) dest.AdditionalClassification = new List(_AdditionalClassification.DeepCopyInternal()); + if(_RelatedEntry is not null) dest.RelatedEntry = new List(_RelatedEntry.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -510,118 +490,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CatalogEntry; - if(otherT == null) return false; + if(other is not CatalogEntry otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(OrderableElement, otherT.OrderableElement)) return false; - if(!comparer.Equals(ReferencedItem, otherT.ReferencedItem)) return false; - if(!comparer.ListEquals(AdditionalIdentifier, otherT.AdditionalIdentifier)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(ValidToElement, otherT.ValidToElement)) return false; - if(!comparer.Equals(LastUpdatedElement, otherT.LastUpdatedElement)) return false; - if(!comparer.ListEquals(AdditionalCharacteristic, otherT.AdditionalCharacteristic)) return false; - if(!comparer.ListEquals(AdditionalClassification, otherT.AdditionalClassification)) return false; - if(!comparer.ListEquals(RelatedEntry, otherT.RelatedEntry)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OrderableElement, otherT._OrderableElement)) return false; + if(!comparer.Equals(_ReferencedItem, otherT._ReferencedItem)) return false; + if(!comparer.ListEquals(_AdditionalIdentifier, otherT._AdditionalIdentifier)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_ValidToElement, otherT._ValidToElement)) return false; + if(!comparer.Equals(_LastUpdatedElement, otherT._LastUpdatedElement)) return false; + if(!comparer.ListEquals(_AdditionalCharacteristic, otherT._AdditionalCharacteristic)) return false; + if(!comparer.ListEquals(_AdditionalClassification, otherT._AdditionalClassification)) return false; + if(!comparer.ListEquals(_RelatedEntry, otherT._RelatedEntry)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "orderable": - value = OrderableElement; - return OrderableElement is not null; + value = _OrderableElement; + return _OrderableElement is not null; case "referencedItem": - value = ReferencedItem; - return ReferencedItem is not null; + value = _ReferencedItem; + return _ReferencedItem is not null; case "additionalIdentifier": - value = AdditionalIdentifier; - return AdditionalIdentifier?.Any() == true; + value = _AdditionalIdentifier; + return _AdditionalIdentifier?.Any() == true; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "validTo": - value = ValidToElement; - return ValidToElement is not null; + value = _ValidToElement; + return _ValidToElement is not null; case "lastUpdated": - value = LastUpdatedElement; - return LastUpdatedElement is not null; + value = _LastUpdatedElement; + return _LastUpdatedElement is not null; case "additionalCharacteristic": - value = AdditionalCharacteristic; - return AdditionalCharacteristic?.Any() == true; + value = _AdditionalCharacteristic; + return _AdditionalCharacteristic?.Any() == true; case "additionalClassification": - value = AdditionalClassification; - return AdditionalClassification?.Any() == true; + value = _AdditionalClassification; + return _AdditionalClassification?.Any() == true; case "relatedEntry": - value = RelatedEntry; - return RelatedEntry?.Any() == true; + value = _RelatedEntry; + return _RelatedEntry?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "orderable": - OrderableElement = (Hl7.Fhir.Model.FhirBoolean)value; + OrderableElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "referencedItem": - ReferencedItem = (Hl7.Fhir.Model.ResourceReference)value; + ReferencedItem = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "additionalIdentifier": - AdditionalIdentifier = (List)value; + AdditionalIdentifier = (List?)value!; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "validTo": - ValidToElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValidToElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastUpdated": - LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "additionalCharacteristic": - AdditionalCharacteristic = (List)value; + AdditionalCharacteristic = (List?)value!; return this; case "additionalClassification": - AdditionalClassification = (List)value; + AdditionalClassification = (List?)value!; return this; case "relatedEntry": - RelatedEntry = (List)value; + RelatedEntry = (List?)value!; return this; default: return base.SetValue(key, value); @@ -632,19 +612,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (OrderableElement is not null) yield return new KeyValuePair("orderable",OrderableElement); - if (ReferencedItem is not null) yield return new KeyValuePair("referencedItem",ReferencedItem); - if (AdditionalIdentifier?.Any() == true) yield return new KeyValuePair("additionalIdentifier",AdditionalIdentifier); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (ValidToElement is not null) yield return new KeyValuePair("validTo",ValidToElement); - if (LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",LastUpdatedElement); - if (AdditionalCharacteristic?.Any() == true) yield return new KeyValuePair("additionalCharacteristic",AdditionalCharacteristic); - if (AdditionalClassification?.Any() == true) yield return new KeyValuePair("additionalClassification",AdditionalClassification); - if (RelatedEntry?.Any() == true) yield return new KeyValuePair("relatedEntry",RelatedEntry); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_OrderableElement is not null) yield return new KeyValuePair("orderable",_OrderableElement); + if (_ReferencedItem is not null) yield return new KeyValuePair("referencedItem",_ReferencedItem); + if (_AdditionalIdentifier?.Any() == true) yield return new KeyValuePair("additionalIdentifier",_AdditionalIdentifier); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_ValidToElement is not null) yield return new KeyValuePair("validTo",_ValidToElement); + if (_LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",_LastUpdatedElement); + if (_AdditionalCharacteristic?.Any() == true) yield return new KeyValuePair("additionalCharacteristic",_AdditionalCharacteristic); + if (_AdditionalClassification?.Any() == true) yield return new KeyValuePair("additionalClassification",_AdditionalClassification); + if (_RelatedEntry?.Any() == true) yield return new KeyValuePair("relatedEntry",_RelatedEntry); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs index 08dd74216..385c508d2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ChargeItem","http://hl7.org/fhir/StructureDefinition/ChargeItem")] - public partial class ChargeItem : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class ChargeItem : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -133,13 +136,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("ChargeItemPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual who was performing. @@ -149,26 +152,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,41 +179,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -225,8 +224,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -239,11 +238,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Defining information about the code of this charge item. @@ -253,24 +252,24 @@ public List Identifier [DataMember] public List DefinitionUriElement { - get { if(_DefinitionUriElement==null) _DefinitionUriElement = new List(); return _DefinitionUriElement; } + get => _DefinitionUriElement ?? new List(); set { _DefinitionUriElement = value; OnPropertyChanged("DefinitionUriElement"); } } - private List _DefinitionUriElement; + private List? _DefinitionUriElement; /// /// Defining information about the code of this charge item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DefinitionUri + public IEnumerable? DefinitionUri { - get { return DefinitionUriElement != null ? DefinitionUriElement.Select(elem => elem.Value) : null; } + get => _DefinitionUriElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionUriElement = null; + DefinitionUriElement = null!; else DefinitionUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DefinitionUri"); @@ -285,24 +284,24 @@ public IEnumerable DefinitionUri [DataMember] public List DefinitionCanonicalElement { - get { if(_DefinitionCanonicalElement==null) _DefinitionCanonicalElement = new List(); return _DefinitionCanonicalElement; } + get => _DefinitionCanonicalElement ?? new List(); set { _DefinitionCanonicalElement = value; OnPropertyChanged("DefinitionCanonicalElement"); } } - private List _DefinitionCanonicalElement; + private List? _DefinitionCanonicalElement; /// /// Resource defining the code of this ChargeItem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DefinitionCanonical + public IEnumerable? DefinitionCanonical { - get { return DefinitionCanonicalElement != null ? DefinitionCanonicalElement.Select(elem => elem.Value) : null; } + get => _DefinitionCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionCanonicalElement = null; + DefinitionCanonicalElement = null!; else DefinitionCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DefinitionCanonical"); @@ -317,13 +316,13 @@ public IEnumerable DefinitionCanonical [Binding("ChargeItemStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | billable | not-billable | aborted | billed | entered-in-error | unknown @@ -332,13 +331,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -353,11 +349,11 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// A code that identifies the charge, like a billing code. @@ -366,13 +362,13 @@ public List PartOf [Binding("ChargeItemCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Individual service was done for/to. @@ -382,13 +378,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with event. @@ -397,13 +393,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When the charged service was applied. @@ -412,13 +408,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Who performed charged service. @@ -428,11 +424,11 @@ public Hl7.Fhir.Model.DataType Occurrence [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Organization providing the charged service. @@ -441,13 +437,13 @@ public List Performer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PerformingOrganization + public Hl7.Fhir.Model.ResourceReference? PerformingOrganization { get { return _PerformingOrganization; } set { _PerformingOrganization = value; OnPropertyChanged("PerformingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _PerformingOrganization; + private Hl7.Fhir.Model.ResourceReference? _PerformingOrganization; /// /// Organization requesting the charged service. @@ -456,13 +452,13 @@ public Hl7.Fhir.Model.ResourceReference PerformingOrganization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestingOrganization + public Hl7.Fhir.Model.ResourceReference? RequestingOrganization { get { return _RequestingOrganization; } set { _RequestingOrganization = value; OnPropertyChanged("RequestingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestingOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestingOrganization; /// /// Organization that has ownership of the (potential, future) revenue. @@ -471,26 +467,26 @@ public Hl7.Fhir.Model.ResourceReference RequestingOrganization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CostCenter + public Hl7.Fhir.Model.ResourceReference? CostCenter { get { return _CostCenter; } set { _CostCenter = value; OnPropertyChanged("CostCenter"); } } - private Hl7.Fhir.Model.ResourceReference _CostCenter; + private Hl7.Fhir.Model.ResourceReference? _CostCenter; /// /// Quantity of which the charge item has been serviced. /// [FhirElement("quantity", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Anatomical location, if relevant. @@ -501,24 +497,24 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Bodysite { - get { if(_Bodysite==null) _Bodysite = new List(); return _Bodysite; } + get => _Bodysite ?? new List(); set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } - private List _Bodysite; + private List? _Bodysite; /// /// Factor overriding the associated rules. /// [FhirElement("factorOverride", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorOverrideElement + public Hl7.Fhir.Model.FhirDecimal? FactorOverrideElement { get { return _FactorOverrideElement; } set { _FactorOverrideElement = value; OnPropertyChanged("FactorOverrideElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorOverrideElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorOverrideElement; /// /// Factor overriding the associated rules @@ -527,13 +523,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorOverrideElement [IgnoreDataMember] public decimal? FactorOverride { - get { return FactorOverrideElement != null ? FactorOverrideElement.Value : null; } + get => _FactorOverrideElement?.Value; set { - if (value == null) - FactorOverrideElement = null; - else - FactorOverrideElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorOverrideElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("FactorOverride"); } } @@ -543,41 +536,38 @@ public decimal? FactorOverride /// [FhirElement("priceOverride", Order=250)] [DataMember] - public Hl7.Fhir.Model.Money PriceOverride + public Hl7.Fhir.Model.Money? PriceOverride { get { return _PriceOverride; } set { _PriceOverride = value; OnPropertyChanged("PriceOverride"); } } - private Hl7.Fhir.Model.Money _PriceOverride; + private Hl7.Fhir.Model.Money? _PriceOverride; /// /// Reason for overriding the list price/factor. /// [FhirElement("overrideReason", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString OverrideReasonElement + public Hl7.Fhir.Model.FhirString? OverrideReasonElement { get { return _OverrideReasonElement; } set { _OverrideReasonElement = value; OnPropertyChanged("OverrideReasonElement"); } } - private Hl7.Fhir.Model.FhirString _OverrideReasonElement; + private Hl7.Fhir.Model.FhirString? _OverrideReasonElement; /// /// Reason for overriding the list price/factor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OverrideReason + public string? OverrideReason { - get { return OverrideReasonElement != null ? OverrideReasonElement.Value : null; } + get => _OverrideReasonElement?.Value; set { - if (value == null) - OverrideReasonElement = null; - else - OverrideReasonElement = new Hl7.Fhir.Model.FhirString(value); + OverrideReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OverrideReason"); } } @@ -589,41 +579,38 @@ public string OverrideReason [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Date the charge item was entered. /// [FhirElement("enteredDate", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EnteredDateElement + public Hl7.Fhir.Model.FhirDateTime? EnteredDateElement { get { return _EnteredDateElement; } set { _EnteredDateElement = value; OnPropertyChanged("EnteredDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EnteredDateElement; + private Hl7.Fhir.Model.FhirDateTime? _EnteredDateElement; /// /// Date the charge item was entered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EnteredDate + public string? EnteredDate { - get { return EnteredDateElement != null ? EnteredDateElement.Value : null; } + get => _EnteredDateElement?.Value; set { - if (value == null) - EnteredDateElement = null; - else - EnteredDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + EnteredDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EnteredDate"); } } @@ -637,11 +624,11 @@ public string EnteredDate [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Which rendered service is being charged?. @@ -653,11 +640,11 @@ public List Reason [DataMember] public List Service { - get { if(_Service==null) _Service = new List(); return _Service; } + get => _Service ?? new List(); set { _Service = value; OnPropertyChanged("Service"); } } - private List _Service; + private List? _Service; /// /// Product charged. @@ -668,13 +655,13 @@ public List Service [References("Device","Medication","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// Account to place this charge. @@ -686,11 +673,11 @@ public Hl7.Fhir.Model.DataType Product [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Comments made about the ChargeItem. @@ -700,11 +687,11 @@ public List Account [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Further information supporting this charge. @@ -716,53 +703,49 @@ public List Note [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItem; - - if (dest == null) - { + if(other is not ChargeItem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(DefinitionUriElement.Any()) dest.DefinitionUriElement = new List(DefinitionUriElement.DeepCopyInternal()); - if(DefinitionCanonicalElement.Any()) dest.DefinitionCanonicalElement = new List(DefinitionCanonicalElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(PerformingOrganization != null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)PerformingOrganization.DeepCopyInternal(); - if(RequestingOrganization != null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)RequestingOrganization.DeepCopyInternal(); - if(CostCenter != null) dest.CostCenter = (Hl7.Fhir.Model.ResourceReference)CostCenter.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Bodysite.Any()) dest.Bodysite = new List(Bodysite.DeepCopyInternal()); - if(FactorOverrideElement != null) dest.FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)FactorOverrideElement.DeepCopyInternal(); - if(PriceOverride != null) dest.PriceOverride = (Hl7.Fhir.Model.Money)PriceOverride.DeepCopyInternal(); - if(OverrideReasonElement != null) dest.OverrideReasonElement = (Hl7.Fhir.Model.FhirString)OverrideReasonElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(EnteredDateElement != null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)EnteredDateElement.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Service.Any()) dest.Service = new List(Service.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_DefinitionUriElement is not null) dest.DefinitionUriElement = new List(_DefinitionUriElement.DeepCopyInternal()); + if(_DefinitionCanonicalElement is not null) dest.DefinitionCanonicalElement = new List(_DefinitionCanonicalElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_PerformingOrganization is not null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)_PerformingOrganization.DeepCopyInternal(); + if(_RequestingOrganization is not null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestingOrganization.DeepCopyInternal(); + if(_CostCenter is not null) dest.CostCenter = (Hl7.Fhir.Model.ResourceReference)_CostCenter.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Bodysite is not null) dest.Bodysite = new List(_Bodysite.DeepCopyInternal()); + if(_FactorOverrideElement is not null) dest.FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)_FactorOverrideElement.DeepCopyInternal(); + if(_PriceOverride is not null) dest.PriceOverride = (Hl7.Fhir.Model.Money)_PriceOverride.DeepCopyInternal(); + if(_OverrideReasonElement is not null) dest.OverrideReasonElement = (Hl7.Fhir.Model.FhirString)_OverrideReasonElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_EnteredDateElement is not null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)_EnteredDateElement.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Service is not null) dest.Service = new List(_Service.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -774,209 +757,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItem; - if(otherT == null) return false; + if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(DefinitionUriElement, otherT.DefinitionUriElement)) return false; - if(!comparer.ListEquals(DefinitionCanonicalElement, otherT.DefinitionCanonicalElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(PerformingOrganization, otherT.PerformingOrganization)) return false; - if(!comparer.Equals(RequestingOrganization, otherT.RequestingOrganization)) return false; - if(!comparer.Equals(CostCenter, otherT.CostCenter)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Bodysite, otherT.Bodysite)) return false; - if(!comparer.Equals(FactorOverrideElement, otherT.FactorOverrideElement)) return false; - if(!comparer.Equals(PriceOverride, otherT.PriceOverride)) return false; - if(!comparer.Equals(OverrideReasonElement, otherT.OverrideReasonElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(EnteredDateElement, otherT.EnteredDateElement)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Service, otherT.Service)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_DefinitionUriElement, otherT._DefinitionUriElement)) return false; + if(!comparer.ListEquals(_DefinitionCanonicalElement, otherT._DefinitionCanonicalElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_PerformingOrganization, otherT._PerformingOrganization)) return false; + if(!comparer.Equals(_RequestingOrganization, otherT._RequestingOrganization)) return false; + if(!comparer.Equals(_CostCenter, otherT._CostCenter)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Bodysite, otherT._Bodysite)) return false; + if(!comparer.Equals(_FactorOverrideElement, otherT._FactorOverrideElement)) return false; + if(!comparer.Equals(_PriceOverride, otherT._PriceOverride)) return false; + if(!comparer.Equals(_OverrideReasonElement, otherT._OverrideReasonElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_EnteredDateElement, otherT._EnteredDateElement)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Service, otherT._Service)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definitionUri": - value = DefinitionUriElement; - return DefinitionUriElement?.Any() == true; + value = _DefinitionUriElement; + return _DefinitionUriElement?.Any() == true; case "definitionCanonical": - value = DefinitionCanonicalElement; - return DefinitionCanonicalElement?.Any() == true; + value = _DefinitionCanonicalElement; + return _DefinitionCanonicalElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "performingOrganization": - value = PerformingOrganization; - return PerformingOrganization is not null; + value = _PerformingOrganization; + return _PerformingOrganization is not null; case "requestingOrganization": - value = RequestingOrganization; - return RequestingOrganization is not null; + value = _RequestingOrganization; + return _RequestingOrganization is not null; case "costCenter": - value = CostCenter; - return CostCenter is not null; + value = _CostCenter; + return _CostCenter is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "bodysite": - value = Bodysite; - return Bodysite?.Any() == true; + value = _Bodysite; + return _Bodysite?.Any() == true; case "factorOverride": - value = FactorOverrideElement; - return FactorOverrideElement is not null; + value = _FactorOverrideElement; + return _FactorOverrideElement is not null; case "priceOverride": - value = PriceOverride; - return PriceOverride is not null; + value = _PriceOverride; + return _PriceOverride is not null; case "overrideReason": - value = OverrideReasonElement; - return OverrideReasonElement is not null; + value = _OverrideReasonElement; + return _OverrideReasonElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "enteredDate": - value = EnteredDateElement; - return EnteredDateElement is not null; + value = _EnteredDateElement; + return _EnteredDateElement is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "service": - value = Service; - return Service?.Any() == true; + value = _Service; + return _Service?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definitionUri": - DefinitionUriElement = (List)value; + DefinitionUriElement = (List?)value!; return this; case "definitionCanonical": - DefinitionCanonicalElement = (List)value; + DefinitionCanonicalElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "performingOrganization": - PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + PerformingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestingOrganization": - RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "costCenter": - CostCenter = (Hl7.Fhir.Model.ResourceReference)value; + CostCenter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "bodysite": - Bodysite = (List)value; + Bodysite = (List?)value!; return this; case "factorOverride": - FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "priceOverride": - PriceOverride = (Hl7.Fhir.Model.Money)value; + PriceOverride = (Hl7.Fhir.Model.Money?)value; return this; case "overrideReason": - OverrideReasonElement = (Hl7.Fhir.Model.FhirString)value; + OverrideReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "enteredDate": - EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "service": - Service = (List)value; + Service = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -987,32 +970,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (DefinitionUriElement?.Any() == true) yield return new KeyValuePair("definitionUri",DefinitionUriElement); - if (DefinitionCanonicalElement?.Any() == true) yield return new KeyValuePair("definitionCanonical",DefinitionCanonicalElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",PerformingOrganization); - if (RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",RequestingOrganization); - if (CostCenter is not null) yield return new KeyValuePair("costCenter",CostCenter); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",Bodysite); - if (FactorOverrideElement is not null) yield return new KeyValuePair("factorOverride",FactorOverrideElement); - if (PriceOverride is not null) yield return new KeyValuePair("priceOverride",PriceOverride); - if (OverrideReasonElement is not null) yield return new KeyValuePair("overrideReason",OverrideReasonElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",EnteredDateElement); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Service?.Any() == true) yield return new KeyValuePair("service",Service); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_DefinitionUriElement?.Any() == true) yield return new KeyValuePair("definitionUri",_DefinitionUriElement); + if (_DefinitionCanonicalElement?.Any() == true) yield return new KeyValuePair("definitionCanonical",_DefinitionCanonicalElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",_PerformingOrganization); + if (_RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",_RequestingOrganization); + if (_CostCenter is not null) yield return new KeyValuePair("costCenter",_CostCenter); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",_Bodysite); + if (_FactorOverrideElement is not null) yield return new KeyValuePair("factorOverride",_FactorOverrideElement); + if (_PriceOverride is not null) yield return new KeyValuePair("priceOverride",_PriceOverride); + if (_OverrideReasonElement is not null) yield return new KeyValuePair("overrideReason",_OverrideReasonElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",_EnteredDateElement); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Service?.Any() == true) yield return new KeyValuePair("service",_Service); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs index e2c775cac..288f730c7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ChargeItemDefinition","http://hl7.org/fhir/StructureDefinition/ChargeItemDefinition")] - public partial class ChargeItemDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class ChargeItemDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -81,28 +84,25 @@ public partial class ApplicabilityComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -112,28 +112,25 @@ public string Description /// [FhirElement("language", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString LanguageElement + public Hl7.Fhir.Model.FhirString? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.FhirString _LanguageElement; + private Hl7.Fhir.Model.FhirString? _LanguageElement; /// /// Language of the expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.FhirString(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Language"); } } @@ -143,45 +140,38 @@ public string Language /// [FhirElement("expression", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Boolean-valued expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ApplicabilityComponent; - - if (dest == null) - { + if(other is not ApplicabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -193,48 +183,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ApplicabilityComponent; - if(otherT == null) return false; + if(other is not ApplicabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.FhirString)value; + LanguageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -245,9 +235,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -276,11 +266,11 @@ public partial class PropertyGroupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Applicability { - get { if(_Applicability==null) _Applicability = new List(); return _Applicability; } + get => _Applicability ?? new List(); set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private List _Applicability; + private List? _Applicability; /// /// Components of total line item price. @@ -290,24 +280,20 @@ public List Applicab [DataMember] public List PriceComponent { - get { if(_PriceComponent==null) _PriceComponent = new List(); return _PriceComponent; } + get => _PriceComponent ?? new List(); set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } - private List _PriceComponent; + private List? _PriceComponent; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyGroupComponent; - - if (dest == null) - { + if(other is not PropertyGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Applicability.Any()) dest.Applicability = new List(Applicability.DeepCopyInternal()); - if(PriceComponent.Any()) dest.PriceComponent = new List(PriceComponent.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = new List(_Applicability.DeepCopyInternal()); + if(_PriceComponent is not null) dest.PriceComponent = new List(_PriceComponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -319,41 +305,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyGroupComponent; - if(otherT == null) return false; + if(other is not PropertyGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(PriceComponent, otherT.PriceComponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "applicability": - value = Applicability; - return Applicability?.Any() == true; + value = _Applicability; + return _Applicability?.Any() == true; case "priceComponent": - value = PriceComponent; - return PriceComponent?.Any() == true; + value = _PriceComponent; + return _PriceComponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "applicability": - Applicability = (List)value; + Applicability = (List?)value!; return this; case "priceComponent": - PriceComponent = (List)value; + PriceComponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -364,8 +350,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Applicability?.Any() == true) yield return new KeyValuePair("applicability",Applicability); - if (PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",PriceComponent); + if (_Applicability?.Any() == true) yield return new KeyValuePair("applicability",_Applicability); + if (_PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",_PriceComponent); } } @@ -394,13 +380,13 @@ public partial class PriceComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("ChargeItemDefinitionPriceComponentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// base | surcharge | deduction | discount | tax | informational @@ -409,13 +395,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.InvoicePriceComponentType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -425,26 +408,26 @@ public Hl7.Fhir.Model.InvoicePriceComponentType? Type /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Factor used for calculating this component. /// [FhirElement("factor", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Factor used for calculating this component @@ -453,13 +436,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -469,28 +449,24 @@ public decimal? Factor /// [FhirElement("amount", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as PriceComponentComponent; - - if (dest == null) - { + if(other is not PriceComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -502,55 +478,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PriceComponentComponent; - if(otherT == null) return false; + if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -561,10 +537,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -575,28 +551,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this charge item definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -609,39 +582,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the charge item definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -651,28 +621,25 @@ public string Version /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this charge item definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -685,24 +652,24 @@ public string Title [DataMember] public List DerivedFromUriElement { - get { if(_DerivedFromUriElement==null) _DerivedFromUriElement = new List(); return _DerivedFromUriElement; } + get => _DerivedFromUriElement ?? new List(); set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } - private List _DerivedFromUriElement; + private List? _DerivedFromUriElement; /// /// Underlying externally-defined charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFromUri + public IEnumerable? DerivedFromUri { - get { return DerivedFromUriElement != null ? DerivedFromUriElement.Select(elem => elem.Value) : null; } + get => _DerivedFromUriElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromUriElement = null; + DerivedFromUriElement = null!; else DerivedFromUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DerivedFromUri"); @@ -717,24 +684,24 @@ public IEnumerable DerivedFromUri [DataMember] public List PartOfElement { - get { if(_PartOfElement==null) _PartOfElement = new List(); return _PartOfElement; } + get => _PartOfElement ?? new List(); set { _PartOfElement = value; OnPropertyChanged("PartOfElement"); } } - private List _PartOfElement; + private List? _PartOfElement; /// /// A larger definition of which this particular definition is a component or step /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PartOf + public IEnumerable? PartOf { - get { return PartOfElement != null ? PartOfElement.Select(elem => elem.Value) : null; } + get => _PartOfElement?.Select(elem => elem.Value); set { if (value == null) - PartOfElement = null; + PartOfElement = null!; else PartOfElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("PartOf"); @@ -749,24 +716,24 @@ public IEnumerable PartOf [DataMember] public List ReplacesElement { - get { if(_ReplacesElement==null) _ReplacesElement = new List(); return _ReplacesElement; } + get => _ReplacesElement ?? new List(); set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } - private List _ReplacesElement; + private List? _ReplacesElement; /// /// Completed or terminated request(s) whose function is taken by this new request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Replaces + public IEnumerable? Replaces { - get { return ReplacesElement != null ? ReplacesElement.Select(elem => elem.Value) : null; } + get => _ReplacesElement?.Select(elem => elem.Value); set { if (value == null) - ReplacesElement = null; + ReplacesElement = null!; else ReplacesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Replaces"); @@ -781,13 +748,13 @@ public IEnumerable Replaces [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -796,13 +763,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -812,13 +776,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -827,13 +791,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -843,28 +804,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -874,28 +832,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -908,39 +863,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the charge item definition. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -953,11 +905,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for charge item definition (if applicable). @@ -968,39 +920,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1010,28 +959,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=250)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the charge item definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1041,28 +987,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the charge item definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1072,13 +1015,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Billing codes or product types this definition applies to. @@ -1086,13 +1029,13 @@ public Hl7.Fhir.Model.Period EffectivePeriod [FhirElement("code", InSummary=true, Order=280)] [Binding("ChargeItemDefinitionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Instances this definition applies to. @@ -1104,11 +1047,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Whether or not the billing code is applicable. @@ -1118,11 +1061,11 @@ public List Instance [DataMember] public List Applicability { - get { if(_Applicability==null) _Applicability = new List(); return _Applicability; } + get => _Applicability ?? new List(); set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private List _Applicability; + private List? _Applicability; /// /// Group of properties which are applicable under the same conditions. @@ -1132,50 +1075,46 @@ public List Applicab [DataMember] public List PropertyGroup { - get { if(_PropertyGroup==null) _PropertyGroup = new List(); return _PropertyGroup; } + get => _PropertyGroup ?? new List(); set { _PropertyGroup = value; OnPropertyChanged("PropertyGroup"); } } - private List _PropertyGroup; + private List? _PropertyGroup; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItemDefinition; - - if (dest == null) - { + if(other is not ChargeItemDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromUriElement.Any()) dest.DerivedFromUriElement = new List(DerivedFromUriElement.DeepCopyInternal()); - if(PartOfElement.Any()) dest.PartOfElement = new List(PartOfElement.DeepCopyInternal()); - if(ReplacesElement.Any()) dest.ReplacesElement = new List(ReplacesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Applicability.Any()) dest.Applicability = new List(Applicability.DeepCopyInternal()); - if(PropertyGroup.Any()) dest.PropertyGroup = new List(PropertyGroup.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromUriElement is not null) dest.DerivedFromUriElement = new List(_DerivedFromUriElement.DeepCopyInternal()); + if(_PartOfElement is not null) dest.PartOfElement = new List(_PartOfElement.DeepCopyInternal()); + if(_ReplacesElement is not null) dest.ReplacesElement = new List(_ReplacesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = new List(_Applicability.DeepCopyInternal()); + if(_PropertyGroup is not null) dest.PropertyGroup = new List(_PropertyGroup.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1187,188 +1126,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItemDefinition; - if(otherT == null) return false; + if(other is not ChargeItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromUriElement, otherT.DerivedFromUriElement)) return false; - if(!comparer.ListEquals(PartOfElement, otherT.PartOfElement)) return false; - if(!comparer.ListEquals(ReplacesElement, otherT.ReplacesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(PropertyGroup, otherT.PropertyGroup)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromUriElement, otherT._DerivedFromUriElement)) return false; + if(!comparer.ListEquals(_PartOfElement, otherT._PartOfElement)) return false; + if(!comparer.ListEquals(_ReplacesElement, otherT._ReplacesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_PropertyGroup, otherT._PropertyGroup)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFromUri": - value = DerivedFromUriElement; - return DerivedFromUriElement?.Any() == true; + value = _DerivedFromUriElement; + return _DerivedFromUriElement?.Any() == true; case "partOf": - value = PartOfElement; - return PartOfElement?.Any() == true; + value = _PartOfElement; + return _PartOfElement?.Any() == true; case "replaces": - value = ReplacesElement; - return ReplacesElement?.Any() == true; + value = _ReplacesElement; + return _ReplacesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "applicability": - value = Applicability; - return Applicability?.Any() == true; + value = _Applicability; + return _Applicability?.Any() == true; case "propertyGroup": - value = PropertyGroup; - return PropertyGroup?.Any() == true; + value = _PropertyGroup; + return _PropertyGroup?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFromUri": - DerivedFromUriElement = (List)value; + DerivedFromUriElement = (List?)value!; return this; case "partOf": - PartOfElement = (List)value; + PartOfElement = (List?)value!; return this; case "replaces": - ReplacesElement = (List)value; + ReplacesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "applicability": - Applicability = (List)value; + Applicability = (List?)value!; return this; case "propertyGroup": - PropertyGroup = (List)value; + PropertyGroup = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1379,29 +1318,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",DerivedFromUriElement); - if (PartOfElement?.Any() == true) yield return new KeyValuePair("partOf",PartOfElement); - if (ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",ReplacesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Applicability?.Any() == true) yield return new KeyValuePair("applicability",Applicability); - if (PropertyGroup?.Any() == true) yield return new KeyValuePair("propertyGroup",PropertyGroup); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",_DerivedFromUriElement); + if (_PartOfElement?.Any() == true) yield return new KeyValuePair("partOf",_PartOfElement); + if (_ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",_ReplacesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Applicability?.Any() == true) yield return new KeyValuePair("applicability",_Applicability); + if (_PropertyGroup?.Any() == true) yield return new KeyValuePair("propertyGroup",_PropertyGroup); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs index 0cf95a754..453b1e600 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Claim","http://hl7.org/fhir/StructureDefinition/Claim")] - public partial class Claim : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Claim : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -84,13 +87,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -98,40 +101,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// File or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -226,13 +225,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [Binding("PayeeType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient reference. @@ -241,26 +240,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,41 +267,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -317,8 +312,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -345,13 +340,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Order of care team @@ -360,13 +355,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -379,26 +371,26 @@ public int? Sequence [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Indicator of the lead practitioner. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Indicator of the lead practitioner @@ -407,13 +399,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -424,13 +413,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Practitioner credential or specialization. @@ -438,29 +427,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("qualification", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Qualification + public Hl7.Fhir.Model.CodeableConcept? Qualification { get { return _Qualification; } set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private Hl7.Fhir.Model.CodeableConcept _Qualification; + private Hl7.Fhir.Model.CodeableConcept? _Qualification; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Qualification != null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)Qualification.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Qualification is not null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)_Qualification.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -472,62 +457,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Qualification, otherT.Qualification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "qualification": - value = Qualification; - return Qualification is not null; + value = _Qualification; + return _Qualification is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualification": - Qualification = (Hl7.Fhir.Model.CodeableConcept)value; + Qualification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -538,11 +523,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Qualification is not null) yield return new KeyValuePair("qualification",Qualification); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Qualification is not null) yield return new KeyValuePair("qualification",_Qualification); } } @@ -570,13 +555,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -585,13 +570,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -603,13 +585,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -617,13 +599,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -632,13 +614,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Data to be provided. @@ -648,13 +630,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Explanation for the information. @@ -662,30 +644,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -697,69 +675,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -770,12 +748,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -802,13 +780,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Diagnosis instance identifier @@ -817,13 +795,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -838,13 +813,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -855,11 +830,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Present on admission. @@ -867,13 +842,13 @@ public List Type [FhirElement("onAdmission", Order=70)] [Binding("DiagnosisOnAdmission")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OnAdmission + public Hl7.Fhir.Model.CodeableConcept? OnAdmission { get { return _OnAdmission; } set { _OnAdmission = value; OnPropertyChanged("OnAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _OnAdmission; + private Hl7.Fhir.Model.CodeableConcept? _OnAdmission; /// /// Package billing code. @@ -881,29 +856,25 @@ public Hl7.Fhir.Model.CodeableConcept OnAdmission [FhirElement("packageCode", Order=80)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PackageCode + public Hl7.Fhir.Model.CodeableConcept? PackageCode { get { return _PackageCode; } set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private Hl7.Fhir.Model.CodeableConcept _PackageCode; + private Hl7.Fhir.Model.CodeableConcept? _PackageCode; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(OnAdmission != null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)OnAdmission.DeepCopyInternal(); - if(PackageCode != null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)PackageCode.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_OnAdmission is not null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)_OnAdmission.DeepCopyInternal(); + if(_PackageCode is not null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)_PackageCode.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -915,62 +886,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(OnAdmission, otherT.OnAdmission)) return false; - if(!comparer.Equals(PackageCode, otherT.PackageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; + if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "onAdmission": - value = OnAdmission; - return OnAdmission is not null; + value = _OnAdmission; + return _OnAdmission is not null; case "packageCode": - value = PackageCode; - return PackageCode is not null; + value = _PackageCode; + return _PackageCode is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "onAdmission": - OnAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + OnAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "packageCode": - PackageCode = (Hl7.Fhir.Model.CodeableConcept)value; + PackageCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -981,11 +952,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (OnAdmission is not null) yield return new KeyValuePair("onAdmission",OnAdmission); - if (PackageCode is not null) yield return new KeyValuePair("packageCode",PackageCode); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_OnAdmission is not null) yield return new KeyValuePair("onAdmission",_OnAdmission); + if (_PackageCode is not null) yield return new KeyValuePair("packageCode",_PackageCode); } } @@ -1012,13 +983,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure instance identifier @@ -1027,13 +998,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1047,39 +1015,36 @@ public int? Sequence [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// When the procedure was performed. /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1094,13 +1059,13 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; /// /// Unique device identifier. @@ -1112,27 +1077,23 @@ public Hl7.Fhir.Model.DataType Procedure [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1144,62 +1105,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1210,11 +1171,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -1242,13 +1203,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Insurance instance identifier @@ -1257,13 +1218,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1274,13 +1232,13 @@ public int? Sequence [FhirElement("focal", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -1289,13 +1247,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -1305,13 +1260,13 @@ public bool? Focal /// [FhirElement("identifier", Order=60, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Insurance information. @@ -1321,41 +1276,38 @@ public Hl7.Fhir.Model.Identifier Identifier [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -1368,24 +1320,24 @@ public string BusinessArrangement [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Prior authorization reference number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1399,31 +1351,27 @@ public IEnumerable PreAuthRef [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1435,76 +1383,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1515,13 +1463,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -1548,28 +1496,25 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("date", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the incident occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1580,13 +1525,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the event occurred. @@ -1596,27 +1541,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1628,48 +1569,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1680,9 +1621,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1709,13 +1650,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -1724,13 +1665,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1743,24 +1681,24 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get { if(_CareTeamSequenceElement==null) _CareTeamSequenceElement = new List(); return _CareTeamSequenceElement; } + get => _CareTeamSequenceElement ?? new List(); set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } - private List _CareTeamSequenceElement; + private List? _CareTeamSequenceElement; /// /// Applicable careTeam members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamSequence + public IEnumerable? CareTeamSequence { - get { return CareTeamSequenceElement != null ? CareTeamSequenceElement.Select(elem => elem.Value) : null; } + get => _CareTeamSequenceElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamSequenceElement = null; + CareTeamSequenceElement = null!; else CareTeamSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamSequence"); @@ -1775,24 +1713,24 @@ public IEnumerable CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get { if(_DiagnosisSequenceElement==null) _DiagnosisSequenceElement = new List(); return _DiagnosisSequenceElement; } + get => _DiagnosisSequenceElement ?? new List(); set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } - private List _DiagnosisSequenceElement; + private List? _DiagnosisSequenceElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisSequence + public IEnumerable? DiagnosisSequence { - get { return DiagnosisSequenceElement != null ? DiagnosisSequenceElement.Select(elem => elem.Value) : null; } + get => _DiagnosisSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisSequenceElement = null; + DiagnosisSequenceElement = null!; else DiagnosisSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisSequence"); @@ -1807,24 +1745,24 @@ public IEnumerable DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get { if(_ProcedureSequenceElement==null) _ProcedureSequenceElement = new List(); return _ProcedureSequenceElement; } + get => _ProcedureSequenceElement ?? new List(); set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } - private List _ProcedureSequenceElement; + private List? _ProcedureSequenceElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureSequence + public IEnumerable? ProcedureSequence { - get { return ProcedureSequenceElement != null ? ProcedureSequenceElement.Select(elem => elem.Value) : null; } + get => _ProcedureSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureSequenceElement = null; + ProcedureSequenceElement = null!; else ProcedureSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureSequence"); @@ -1839,24 +1777,24 @@ public IEnumerable ProcedureSequence [DataMember] public List InformationSequenceElement { - get { if(_InformationSequenceElement==null) _InformationSequenceElement = new List(); return _InformationSequenceElement; } + get => _InformationSequenceElement ?? new List(); set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } - private List _InformationSequenceElement; + private List? _InformationSequenceElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationSequence + public IEnumerable? InformationSequence { - get { return InformationSequenceElement != null ? InformationSequenceElement.Select(elem => elem.Value) : null; } + get => _InformationSequenceElement?.Select(elem => elem.Value); set { if (value == null) - InformationSequenceElement = null; + InformationSequenceElement = null!; else InformationSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationSequence"); @@ -1869,13 +1807,13 @@ public IEnumerable InformationSequence [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -1883,13 +1821,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=100)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -1898,13 +1836,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -1915,11 +1853,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -1930,11 +1868,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -1943,13 +1881,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -1960,52 +1898,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2014,13 +1952,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2030,13 +1965,13 @@ public decimal? Factor /// [FhirElement("net", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2048,11 +1983,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Anatomical location. @@ -2060,13 +1995,13 @@ public List Udi [FhirElement("bodySite", Order=210)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -2077,11 +2012,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Encounters related to this billed item. @@ -2093,11 +2028,11 @@ public List SubSite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Product or service provided. @@ -2107,43 +2042,39 @@ public List Encounter [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(CareTeamSequenceElement.Any()) dest.CareTeamSequenceElement = new List(CareTeamSequenceElement.DeepCopyInternal()); - if(DiagnosisSequenceElement.Any()) dest.DiagnosisSequenceElement = new List(DiagnosisSequenceElement.DeepCopyInternal()); - if(ProcedureSequenceElement.Any()) dest.ProcedureSequenceElement = new List(ProcedureSequenceElement.DeepCopyInternal()); - if(InformationSequenceElement.Any()) dest.InformationSequenceElement = new List(InformationSequenceElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_CareTeamSequenceElement is not null) dest.CareTeamSequenceElement = new List(_CareTeamSequenceElement.DeepCopyInternal()); + if(_DiagnosisSequenceElement is not null) dest.DiagnosisSequenceElement = new List(_DiagnosisSequenceElement.DeepCopyInternal()); + if(_ProcedureSequenceElement is not null) dest.ProcedureSequenceElement = new List(_ProcedureSequenceElement.DeepCopyInternal()); + if(_InformationSequenceElement is not null) dest.InformationSequenceElement = new List(_InformationSequenceElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2155,174 +2086,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(CareTeamSequenceElement, otherT.CareTeamSequenceElement)) return false; - if(!comparer.ListEquals(DiagnosisSequenceElement, otherT.DiagnosisSequenceElement)) return false; - if(!comparer.ListEquals(ProcedureSequenceElement, otherT.ProcedureSequenceElement)) return false; - if(!comparer.ListEquals(InformationSequenceElement, otherT.InformationSequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; + if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; + if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; + if(!comparer.ListEquals(_InformationSequenceElement, otherT._InformationSequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "careTeamSequence": - value = CareTeamSequenceElement; - return CareTeamSequenceElement?.Any() == true; + value = _CareTeamSequenceElement; + return _CareTeamSequenceElement?.Any() == true; case "diagnosisSequence": - value = DiagnosisSequenceElement; - return DiagnosisSequenceElement?.Any() == true; + value = _DiagnosisSequenceElement; + return _DiagnosisSequenceElement?.Any() == true; case "procedureSequence": - value = ProcedureSequenceElement; - return ProcedureSequenceElement?.Any() == true; + value = _ProcedureSequenceElement; + return _ProcedureSequenceElement?.Any() == true; case "informationSequence": - value = InformationSequenceElement; - return InformationSequenceElement?.Any() == true; + value = _InformationSequenceElement; + return _InformationSequenceElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "careTeamSequence": - CareTeamSequenceElement = (List)value; + CareTeamSequenceElement = (List?)value!; return this; case "diagnosisSequence": - DiagnosisSequenceElement = (List)value; + DiagnosisSequenceElement = (List?)value!; return this; case "procedureSequence": - ProcedureSequenceElement = (List)value; + ProcedureSequenceElement = (List?)value!; return this; case "informationSequence": - InformationSequenceElement = (List)value; + InformationSequenceElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2333,27 +2264,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",CareTeamSequenceElement); - if (DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",DiagnosisSequenceElement); - if (ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",ProcedureSequenceElement); - if (InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",InformationSequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",_CareTeamSequenceElement); + if (_DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",_DiagnosisSequenceElement); + if (_ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",_ProcedureSequenceElement); + if (_InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",_InformationSequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2380,13 +2311,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -2395,13 +2326,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2412,13 +2340,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -2426,13 +2354,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2441,13 +2369,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -2458,11 +2386,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2473,50 +2401,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2525,13 +2453,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2541,13 +2466,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2559,11 +2484,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Product or service provided. @@ -2573,34 +2498,30 @@ public List Udi [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2612,111 +2533,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2727,18 +2648,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -2765,13 +2686,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -2780,13 +2701,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2797,13 +2715,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -2811,13 +2729,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2826,13 +2744,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -2843,11 +2761,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2858,50 +2776,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2910,13 +2828,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2926,13 +2841,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2944,33 +2859,29 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2982,104 +2893,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3090,17 +3001,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -3113,11 +3024,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -3127,13 +3038,13 @@ public List Identifier [Binding("ClaimStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -3142,13 +3053,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3160,13 +3068,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -3174,13 +3082,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=120, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -3190,13 +3098,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -3205,13 +3113,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -3224,26 +3129,26 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Relevant time frame for the claim. /// [FhirElement("billablePeriod", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Resource creation date. @@ -3251,28 +3156,25 @@ public Hl7.Fhir.Model.Period BillablePeriod [FhirElement("created", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Resource creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -3284,13 +3186,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Target. @@ -3299,13 +3201,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -3315,13 +3217,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Desired processing ugency. @@ -3330,13 +3232,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [Binding("ProcessPriority")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// For whom to reserve funds. @@ -3344,13 +3246,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("fundsReserve", Order=210)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Prior or corollary claims. @@ -3360,11 +3262,11 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services and products. @@ -3373,13 +3275,13 @@ public List Related [CLSCompliant(false)] [References("DeviceRequest","MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superseded by fulfiller. @@ -3388,26 +3290,26 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("DeviceRequest","MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Recipient of benefits payable. /// [FhirElement("payee", Order=250)] [DataMember] - public Hl7.Fhir.Model.Claim.PayeeComponent Payee + public Hl7.Fhir.Model.Claim.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.Claim.PayeeComponent _Payee; + private Hl7.Fhir.Model.Claim.PayeeComponent? _Payee; /// /// Treatment referral. @@ -3416,13 +3318,13 @@ public Hl7.Fhir.Model.Claim.PayeeComponent Payee [CLSCompliant(false)] [References("ServiceRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Servicing facility. @@ -3431,13 +3333,13 @@ public Hl7.Fhir.Model.ResourceReference Referral [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Members of the care team. @@ -3447,11 +3349,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Supporting information. @@ -3461,11 +3363,11 @@ public List CareTeam [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Pertinent diagnosis information. @@ -3475,11 +3377,11 @@ public List SupportingInfo [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Clinical procedures performed. @@ -3489,11 +3391,11 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Patient insurance information. @@ -3503,24 +3405,24 @@ public List Procedure [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Details of the event. /// [FhirElement("accident", Order=330)] [DataMember] - public Hl7.Fhir.Model.Claim.AccidentComponent Accident + public Hl7.Fhir.Model.Claim.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.Claim.AccidentComponent _Accident; + private Hl7.Fhir.Model.Claim.AccidentComponent? _Accident; /// /// Product or service provided. @@ -3530,67 +3432,63 @@ public Hl7.Fhir.Model.Claim.AccidentComponent Accident [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Total claim cost. /// [FhirElement("total", Order=350)] [DataMember] - public Hl7.Fhir.Model.Money Total + public Hl7.Fhir.Model.Money? Total { get { return _Total; } set { _Total = value; OnPropertyChanged("Total"); } } - private Hl7.Fhir.Model.Money _Total; + private Hl7.Fhir.Model.Money? _Total; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Claim; - - if (dest == null) - { + if(other is not Claim dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)Payee.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)Accident.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(Total != null) dest.Total = (Hl7.Fhir.Model.Money)Total.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)_Accident.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_Total is not null) dest.Total = (Hl7.Fhir.Model.Money)_Total.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3602,216 +3500,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Claim; - if(otherT == null) return false; + if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.Equals(Total, otherT.Total)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Total, otherT._Total)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "total": - value = Total; - return Total is not null; + value = _Total; + return _Total is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.Claim.PayeeComponent?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "accident": - Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.Claim.AccidentComponent?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "total": - Total = (Hl7.Fhir.Model.Money)value; + Total = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -3822,33 +3720,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (Total is not null) yield return new KeyValuePair("total",Total); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_Total is not null) yield return new KeyValuePair("total",_Total); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs index 7415633d6..193734f0f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("itemSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ItemSequenceElement + public Hl7.Fhir.Model.PositiveInt? ItemSequenceElement { get { return _ItemSequenceElement; } set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _ItemSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _ItemSequenceElement; /// /// Claim item instance identifier @@ -96,13 +99,10 @@ public Hl7.Fhir.Model.PositiveInt ItemSequenceElement [IgnoreDataMember] public int? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Value : null; } + get => _ItemSequenceElement?.Value; set { - if (value == null) - ItemSequenceElement = null; - else - ItemSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + ItemSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("ItemSequence"); } } @@ -115,24 +115,24 @@ public int? ItemSequence [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -147,11 +147,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication for claim details. @@ -161,26 +161,22 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement != null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)ItemSequenceElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)_ItemSequenceElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -192,55 +188,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement is not null; + value = _ItemSequenceElement; + return _ItemSequenceElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -251,10 +247,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -282,13 +278,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of adjudication outcome. @@ -296,39 +292,39 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monetary value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Non-monetary value @@ -337,31 +333,24 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -373,55 +362,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -432,10 +421,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -462,13 +451,13 @@ public partial class ItemDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("detailSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? DetailSequenceElement { get { return _DetailSequenceElement; } set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DetailSequenceElement; /// /// Claim detail instance identifier @@ -477,13 +466,10 @@ public Hl7.Fhir.Model.PositiveInt DetailSequenceElement [IgnoreDataMember] public int? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Value : null; } + get => _DetailSequenceElement?.Value; set { - if (value == null) - DetailSequenceElement = null; - else - DetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DetailSequence"); } } @@ -496,24 +482,24 @@ public int? DetailSequence [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -528,11 +514,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication for claim sub-details. @@ -542,26 +528,22 @@ public List Adjudication [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemDetailComponent; - - if (dest == null) - { + if(other is not ItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DetailSequenceElement != null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)DetailSequenceElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DetailSequenceElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -573,55 +555,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemDetailComponent; - if(otherT == null) return false; + if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement is not null; + value = _DetailSequenceElement; + return _DetailSequenceElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "detailSequence": - DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -632,10 +614,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -662,13 +644,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("subDetailSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? SubDetailSequenceElement { get { return _SubDetailSequenceElement; } set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SubDetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SubDetailSequenceElement; /// /// Claim sub-detail instance identifier @@ -677,13 +659,10 @@ public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement [IgnoreDataMember] public int? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Value : null; } + get => _SubDetailSequenceElement?.Value; set { - if (value == null) - SubDetailSequenceElement = null; - else - SubDetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SubDetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SubDetailSequence"); } } @@ -696,24 +675,24 @@ public int? SubDetailSequence [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -728,25 +707,21 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubDetailSequenceElement != null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)SubDetailSequenceElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_SubDetailSequenceElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -758,48 +733,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement is not null; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subDetailSequence": - SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -810,9 +785,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -841,24 +816,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get { if(_ItemSequenceElement==null) _ItemSequenceElement = new List(); return _ItemSequenceElement; } + get => _ItemSequenceElement ?? new List(); set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private List _ItemSequenceElement; + private List? _ItemSequenceElement; /// /// Item sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ItemSequence + public IEnumerable? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Select(elem => elem.Value) : null; } + get => _ItemSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ItemSequenceElement = null; + ItemSequenceElement = null!; else ItemSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ItemSequence"); @@ -873,24 +848,24 @@ public IEnumerable ItemSequence [DataMember] public List DetailSequenceElement { - get { if(_DetailSequenceElement==null) _DetailSequenceElement = new List(); return _DetailSequenceElement; } + get => _DetailSequenceElement ?? new List(); set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private List _DetailSequenceElement; + private List? _DetailSequenceElement; /// /// Detail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DetailSequence + public IEnumerable? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Select(elem => elem.Value) : null; } + get => _DetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DetailSequenceElement = null; + DetailSequenceElement = null!; else DetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DetailSequence"); @@ -905,24 +880,24 @@ public IEnumerable DetailSequence [DataMember] public List SubdetailSequenceElement { - get { if(_SubdetailSequenceElement==null) _SubdetailSequenceElement = new List(); return _SubdetailSequenceElement; } + get => _SubdetailSequenceElement ?? new List(); set { _SubdetailSequenceElement = value; OnPropertyChanged("SubdetailSequenceElement"); } } - private List _SubdetailSequenceElement; + private List? _SubdetailSequenceElement; /// /// Subdetail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubdetailSequence + public IEnumerable? SubdetailSequence { - get { return SubdetailSequenceElement != null ? SubdetailSequenceElement.Select(elem => elem.Value) : null; } + get => _SubdetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SubdetailSequenceElement = null; + SubdetailSequenceElement = null!; else SubdetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SubdetailSequence"); @@ -939,11 +914,11 @@ public IEnumerable SubdetailSequence [DataMember] public List Provider { - get { if(_Provider==null) _Provider = new List(); return _Provider; } + get => _Provider ?? new List(); set { _Provider = value; OnPropertyChanged("Provider"); } } - private List _Provider; + private List? _Provider; /// /// Billing, service, product, or drug code. @@ -952,13 +927,13 @@ public List Provider [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -969,11 +944,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -984,11 +959,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -997,13 +972,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -1014,52 +989,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1068,13 +1043,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1084,13 +1056,13 @@ public decimal? Factor /// [FhirElement("net", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Anatomical location. @@ -1098,13 +1070,13 @@ public Hl7.Fhir.Model.Money Net [FhirElement("bodySite", Order=170)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -1115,11 +1087,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Applicable note numbers. @@ -1129,24 +1101,24 @@ public List SubSite [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1161,11 +1133,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line details. @@ -1175,40 +1147,36 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement.Any()) dest.ItemSequenceElement = new List(ItemSequenceElement.DeepCopyInternal()); - if(DetailSequenceElement.Any()) dest.DetailSequenceElement = new List(DetailSequenceElement.DeepCopyInternal()); - if(SubdetailSequenceElement.Any()) dest.SubdetailSequenceElement = new List(SubdetailSequenceElement.DeepCopyInternal()); - if(Provider.Any()) dest.Provider = new List(Provider.DeepCopyInternal()); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = new List(_ItemSequenceElement.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = new List(_DetailSequenceElement.DeepCopyInternal()); + if(_SubdetailSequenceElement is not null) dest.SubdetailSequenceElement = new List(_SubdetailSequenceElement.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = new List(_Provider.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1220,153 +1188,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(SubdetailSequenceElement, otherT.SubdetailSequenceElement)) return false; - if(!comparer.ListEquals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_SubdetailSequenceElement, otherT._SubdetailSequenceElement)) return false; + if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement?.Any() == true; + value = _ItemSequenceElement; + return _ItemSequenceElement?.Any() == true; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement?.Any() == true; + value = _DetailSequenceElement; + return _DetailSequenceElement?.Any() == true; case "subdetailSequence": - value = SubdetailSequenceElement; - return SubdetailSequenceElement?.Any() == true; + value = _SubdetailSequenceElement; + return _SubdetailSequenceElement?.Any() == true; case "provider": - value = Provider; - return Provider?.Any() == true; + value = _Provider; + return _Provider?.Any() == true; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (List)value; + ItemSequenceElement = (List?)value!; return this; case "detailSequence": - DetailSequenceElement = (List)value; + DetailSequenceElement = (List?)value!; return this; case "subdetailSequence": - SubdetailSequenceElement = (List)value; + SubdetailSequenceElement = (List?)value!; return this; case "provider": - Provider = (List)value; + Provider = (List?)value!; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1377,24 +1345,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubdetailSequenceElement?.Any() == true) yield return new KeyValuePair("subdetailSequence",SubdetailSequenceElement); - if (Provider?.Any() == true) yield return new KeyValuePair("provider",Provider); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubdetailSequenceElement?.Any() == true) yield return new KeyValuePair("subdetailSequence",_SubdetailSequenceElement); + if (_Provider?.Any() == true) yield return new KeyValuePair("provider",_Provider); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -1422,13 +1390,13 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -1439,50 +1407,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1491,13 +1459,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1507,13 +1472,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -1523,24 +1488,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1555,11 +1520,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -1569,31 +1534,27 @@ public List Adjudication [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1605,90 +1566,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1699,15 +1660,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -1735,13 +1696,13 @@ public partial class AddedItemSubDetailComponent : Hl7.Fhir.Model.BackboneElemen [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -1752,50 +1713,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1804,13 +1765,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1820,13 +1778,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -1836,24 +1794,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1868,30 +1826,26 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemSubDetailComponent; - - if (dest == null) - { + if(other is not AddedItemSubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1903,83 +1857,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemSubDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1990,14 +1944,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -2026,13 +1980,13 @@ public partial class TotalComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Financial total for the category. @@ -2040,26 +1994,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("amount", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as TotalComponent; - - if (dest == null) - { + if(other is not TotalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2071,41 +2021,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TotalComponent; - if(otherT == null) return false; + if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -2116,8 +2066,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -2145,26 +2095,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [Binding("PaymentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the adjustment. @@ -2172,41 +2122,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected date of payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected date of payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -2217,43 +2164,39 @@ public string Date [FhirElement("amount", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Business identifier for the payment. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2265,69 +2208,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -2338,12 +2281,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -2369,13 +2312,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Note instance identifier @@ -2384,13 +2327,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -2402,13 +2342,13 @@ public int? Number [DeclaredType(Type = typeof(Code))] [Binding("NoteType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// display | print | printoper @@ -2417,13 +2357,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NoteType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2434,28 +2371,25 @@ public Hl7.Fhir.Model.NoteType? Type [FhirElement("text", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -2466,28 +2400,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2499,55 +2429,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -2558,10 +2488,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -2589,13 +2519,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Insurance instance identifier @@ -2604,13 +2534,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2621,13 +2548,13 @@ public int? Sequence [FhirElement("focal", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -2636,13 +2563,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -2655,41 +2579,38 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -2701,29 +2622,25 @@ public string BusinessArrangement [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2735,62 +2652,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -2801,11 +2718,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -2832,13 +2749,13 @@ public partial class ErrorComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("itemSequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ItemSequenceElement + public Hl7.Fhir.Model.PositiveInt? ItemSequenceElement { get { return _ItemSequenceElement; } set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _ItemSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _ItemSequenceElement; /// /// Item sequence number @@ -2847,13 +2764,10 @@ public Hl7.Fhir.Model.PositiveInt ItemSequenceElement [IgnoreDataMember] public int? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Value : null; } + get => _ItemSequenceElement?.Value; set { - if (value == null) - ItemSequenceElement = null; - else - ItemSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + ItemSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("ItemSequence"); } } @@ -2863,13 +2777,13 @@ public int? ItemSequence /// [FhirElement("detailSequence", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? DetailSequenceElement { get { return _DetailSequenceElement; } set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DetailSequenceElement; /// /// Detail sequence number @@ -2878,13 +2792,10 @@ public Hl7.Fhir.Model.PositiveInt DetailSequenceElement [IgnoreDataMember] public int? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Value : null; } + get => _DetailSequenceElement?.Value; set { - if (value == null) - DetailSequenceElement = null; - else - DetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DetailSequence"); } } @@ -2894,13 +2805,13 @@ public int? DetailSequence /// [FhirElement("subDetailSequence", Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? SubDetailSequenceElement { get { return _SubDetailSequenceElement; } set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SubDetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SubDetailSequenceElement; /// /// Subdetail sequence number @@ -2909,13 +2820,10 @@ public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement [IgnoreDataMember] public int? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Value : null; } + get => _SubDetailSequenceElement?.Value; set { - if (value == null) - SubDetailSequenceElement = null; - else - SubDetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SubDetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SubDetailSequence"); } } @@ -2927,28 +2835,24 @@ public int? SubDetailSequence [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorComponent; - - if (dest == null) - { + if(other is not ErrorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement != null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)ItemSequenceElement.DeepCopyInternal(); - if(DetailSequenceElement != null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)DetailSequenceElement.DeepCopyInternal(); - if(SubDetailSequenceElement != null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)SubDetailSequenceElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)_ItemSequenceElement.DeepCopyInternal(); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DetailSequenceElement.DeepCopyInternal(); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_SubDetailSequenceElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2960,55 +2864,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorComponent; - if(otherT == null) return false; + if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.Equals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.Equals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement is not null; + value = _ItemSequenceElement; + return _ItemSequenceElement is not null; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement is not null; + value = _DetailSequenceElement; + return _DetailSequenceElement is not null; case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement is not null; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "detailSequence": - DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "subDetailSequence": - SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -3019,10 +2923,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -3035,11 +2939,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -3049,13 +2953,13 @@ public List Identifier [Binding("ClaimResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -3064,13 +2968,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3082,13 +2983,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -3096,13 +2997,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=120, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -3112,13 +3013,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -3127,13 +3028,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -3146,13 +3044,13 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Response creation date. @@ -3160,28 +3058,25 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("created", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -3194,13 +3089,13 @@ public string Created [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -3209,13 +3104,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// Id of resource triggering adjudication. @@ -3224,13 +3119,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -3240,13 +3135,13 @@ public Hl7.Fhir.Model.ResourceReference Request [Binding("RemittanceOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -3255,13 +3150,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -3271,28 +3163,25 @@ public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome /// [FhirElement("disposition", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -3302,28 +3191,25 @@ public string Disposition /// [FhirElement("preAuthRef", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -3333,13 +3219,13 @@ public string PreAuthRef /// [FhirElement("preAuthPeriod", Order=220)] [DataMember] - public Hl7.Fhir.Model.Period PreAuthPeriod + public Hl7.Fhir.Model.Period? PreAuthPeriod { get { return _PreAuthPeriod; } set { _PreAuthPeriod = value; OnPropertyChanged("PreAuthPeriod"); } } - private Hl7.Fhir.Model.Period _PreAuthPeriod; + private Hl7.Fhir.Model.Period? _PreAuthPeriod; /// /// Party to be paid any benefits payable. @@ -3347,13 +3233,13 @@ public Hl7.Fhir.Model.Period PreAuthPeriod [FhirElement("payeeType", Order=230)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PayeeType + public Hl7.Fhir.Model.CodeableConcept? PayeeType { get { return _PayeeType; } set { _PayeeType = value; OnPropertyChanged("PayeeType"); } } - private Hl7.Fhir.Model.CodeableConcept _PayeeType; + private Hl7.Fhir.Model.CodeableConcept? _PayeeType; /// /// Adjudication for claim line items. @@ -3363,11 +3249,11 @@ public Hl7.Fhir.Model.CodeableConcept PayeeType [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -3377,11 +3263,11 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Header-level adjudication. @@ -3391,11 +3277,11 @@ public List AddItem [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication totals. @@ -3405,24 +3291,24 @@ public List Adjudication [DataMember] public List Total { - get { if(_Total==null) _Total = new List(); return _Total; } + get => _Total ?? new List(); set { _Total = value; OnPropertyChanged("Total"); } } - private List _Total; + private List? _Total; /// /// Payment Details. /// [FhirElement("payment", Order=280)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment + public Hl7.Fhir.Model.ClaimResponse.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ClaimResponse.PaymentComponent _Payment; + private Hl7.Fhir.Model.ClaimResponse.PaymentComponent? _Payment; /// /// Funds reserved status. @@ -3430,13 +3316,13 @@ public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment [FhirElement("fundsReserve", Order=290)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Printed form identifier. @@ -3444,26 +3330,26 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [FhirElement("formCode", Order=300)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Printed reference or actual form. /// [FhirElement("form", Order=310)] [DataMember] - public Hl7.Fhir.Model.Attachment Form + public Hl7.Fhir.Model.Attachment? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.Attachment _Form; + private Hl7.Fhir.Model.Attachment? _Form; /// /// Note concerning adjudication. @@ -3473,11 +3359,11 @@ public Hl7.Fhir.Model.Attachment Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// Request for additional information. @@ -3489,11 +3375,11 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get { if(_CommunicationRequest==null) _CommunicationRequest = new List(); return _CommunicationRequest; } + get => _CommunicationRequest ?? new List(); set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } - private List _CommunicationRequest; + private List? _CommunicationRequest; /// /// Patient insurance information. @@ -3503,11 +3389,11 @@ public List CommunicationRequest [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Processing errors. @@ -3517,51 +3403,47 @@ public List Insurance [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClaimResponse; - - if (dest == null) - { + if(other is not ClaimResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(PreAuthPeriod != null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)PreAuthPeriod.DeepCopyInternal(); - if(PayeeType != null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)PayeeType.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Total.Any()) dest.Total = new List(Total.DeepCopyInternal()); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)Payment.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.Attachment)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(CommunicationRequest.Any()) dest.CommunicationRequest = new List(CommunicationRequest.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_PreAuthPeriod is not null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)_PreAuthPeriod.DeepCopyInternal(); + if(_PayeeType is not null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)_PayeeType.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Total is not null) dest.Total = new List(_Total.DeepCopyInternal()); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)_Payment.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.Attachment)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_CommunicationRequest is not null) dest.CommunicationRequest = new List(_CommunicationRequest.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3573,216 +3455,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClaimResponse; - if(otherT == null) return false; + if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(PreAuthPeriod, otherT.PreAuthPeriod)) return false; - if(!comparer.Equals(PayeeType, otherT.PayeeType)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Total, otherT.Total)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.ListEquals(CommunicationRequest, otherT.CommunicationRequest)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_PreAuthPeriod, otherT._PreAuthPeriod)) return false; + if(!comparer.Equals(_PayeeType, otherT._PayeeType)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Total, otherT._Total)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "preAuthPeriod": - value = PreAuthPeriod; - return PreAuthPeriod is not null; + value = _PreAuthPeriod; + return _PreAuthPeriod is not null; case "payeeType": - value = PayeeType; - return PayeeType is not null; + value = _PayeeType; + return _PayeeType is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "total": - value = Total; - return Total?.Any() == true; + value = _Total; + return _Total?.Any() == true; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "communicationRequest": - value = CommunicationRequest; - return CommunicationRequest?.Any() == true; + value = _CommunicationRequest; + return _CommunicationRequest?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthPeriod": - PreAuthPeriod = (Hl7.Fhir.Model.Period)value; + PreAuthPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "payeeType": - PayeeType = (Hl7.Fhir.Model.CodeableConcept)value; + PayeeType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "total": - Total = (List)value; + Total = (List?)value!; return this; case "payment": - Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "form": - Form = (Hl7.Fhir.Model.Attachment)value; + Form = (Hl7.Fhir.Model.Attachment?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "communicationRequest": - CommunicationRequest = (List)value; + CommunicationRequest = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3793,33 +3675,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",PreAuthPeriod); - if (PayeeType is not null) yield return new KeyValuePair("payeeType",PayeeType); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Total?.Any() == true) yield return new KeyValuePair("total",Total); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",CommunicationRequest); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",_PreAuthPeriod); + if (_PayeeType is not null) yield return new KeyValuePair("payeeType",_PayeeType); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Total?.Any() == true) yield return new KeyValuePair("total",_Total); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",_CommunicationRequest); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs index e6240a7df..efd86314d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ClinicalImpression","http://hl7.org/fhir/StructureDefinition/ClinicalImpression")] - public partial class ClinicalImpression : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class ClinicalImpression : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -110,13 +113,13 @@ public partial class InvestigationComponent : Hl7.Fhir.Model.BackboneElement [Binding("InvestigationGroupType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Record of a specific investigation. @@ -128,24 +131,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InvestigationComponent; - - if (dest == null) - { + if(other is not InvestigationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -157,41 +156,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InvestigationComponent; - if(otherT == null) return false; + if(other is not InvestigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -202,8 +201,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -230,13 +229,13 @@ public partial class FindingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("itemCodeableConcept", Order=40)] [Binding("ConditionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ItemCodeableConcept + public Hl7.Fhir.Model.CodeableConcept? ItemCodeableConcept { get { return _ItemCodeableConcept; } set { _ItemCodeableConcept = value; OnPropertyChanged("ItemCodeableConcept"); } } - private Hl7.Fhir.Model.CodeableConcept _ItemCodeableConcept; + private Hl7.Fhir.Model.CodeableConcept? _ItemCodeableConcept; /// /// What was found. @@ -245,58 +244,51 @@ public Hl7.Fhir.Model.CodeableConcept ItemCodeableConcept [CLSCompliant(false)] [References("Condition","Observation","Media")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ItemReference + public Hl7.Fhir.Model.ResourceReference? ItemReference { get { return _ItemReference; } set { _ItemReference = value; OnPropertyChanged("ItemReference"); } } - private Hl7.Fhir.Model.ResourceReference _ItemReference; + private Hl7.Fhir.Model.ResourceReference? _ItemReference; /// /// Which investigations support finding. /// [FhirElement("basis", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString BasisElement + public Hl7.Fhir.Model.FhirString? BasisElement { get { return _BasisElement; } set { _BasisElement = value; OnPropertyChanged("BasisElement"); } } - private Hl7.Fhir.Model.FhirString _BasisElement; + private Hl7.Fhir.Model.FhirString? _BasisElement; /// /// Which investigations support finding /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Basis + public string? Basis { - get { return BasisElement != null ? BasisElement.Value : null; } + get => _BasisElement?.Value; set { - if (value == null) - BasisElement = null; - else - BasisElement = new Hl7.Fhir.Model.FhirString(value); + BasisElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Basis"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FindingComponent; - - if (dest == null) - { + if(other is not FindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemCodeableConcept != null) dest.ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)ItemCodeableConcept.DeepCopyInternal(); - if(ItemReference != null) dest.ItemReference = (Hl7.Fhir.Model.ResourceReference)ItemReference.DeepCopyInternal(); - if(BasisElement != null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)BasisElement.DeepCopyInternal(); + if(_ItemCodeableConcept is not null) dest.ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)_ItemCodeableConcept.DeepCopyInternal(); + if(_ItemReference is not null) dest.ItemReference = (Hl7.Fhir.Model.ResourceReference)_ItemReference.DeepCopyInternal(); + if(_BasisElement is not null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)_BasisElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -308,48 +300,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FindingComponent; - if(otherT == null) return false; + if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemCodeableConcept, otherT.ItemCodeableConcept)) return false; - if(!comparer.Equals(ItemReference, otherT.ItemReference)) return false; - if(!comparer.Equals(BasisElement, otherT.BasisElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemCodeableConcept, otherT._ItemCodeableConcept)) return false; + if(!comparer.Equals(_ItemReference, otherT._ItemReference)) return false; + if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemCodeableConcept": - value = ItemCodeableConcept; - return ItemCodeableConcept is not null; + value = _ItemCodeableConcept; + return _ItemCodeableConcept is not null; case "itemReference": - value = ItemReference; - return ItemReference is not null; + value = _ItemReference; + return _ItemReference is not null; case "basis": - value = BasisElement; - return BasisElement is not null; + value = _BasisElement; + return _BasisElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemCodeableConcept": - ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)value; + ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "itemReference": - ItemReference = (Hl7.Fhir.Model.ResourceReference)value; + ItemReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "basis": - BasisElement = (Hl7.Fhir.Model.FhirString)value; + BasisElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -360,9 +352,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemCodeableConcept is not null) yield return new KeyValuePair("itemCodeableConcept",ItemCodeableConcept); - if (ItemReference is not null) yield return new KeyValuePair("itemReference",ItemReference); - if (BasisElement is not null) yield return new KeyValuePair("basis",BasisElement); + if (_ItemCodeableConcept is not null) yield return new KeyValuePair("itemCodeableConcept",_ItemCodeableConcept); + if (_ItemReference is not null) yield return new KeyValuePair("itemReference",_ItemReference); + if (_BasisElement is not null) yield return new KeyValuePair("basis",_BasisElement); } } @@ -375,11 +367,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// in-progress | completed | entered-in-error. @@ -389,13 +381,13 @@ public List Identifier [Binding("ClinicalImpressionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | entered-in-error @@ -404,13 +396,10 @@ public Code StatusEl [IgnoreDataMember] public Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -421,13 +410,13 @@ public Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus? Status [FhirElement("statusReason", Order=110)] [Binding("ClinicalImpressionStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Kind of assessment performed. @@ -435,41 +424,38 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [FhirElement("code", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("ClinicalImpressionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Why/how the assessment was performed. /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why/how the assessment was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -482,13 +468,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -497,13 +483,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time of assessment. @@ -512,41 +498,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the assessment was documented. /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the assessment was documented /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -558,13 +541,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Assessor + public Hl7.Fhir.Model.ResourceReference? Assessor { get { return _Assessor; } set { _Assessor = value; OnPropertyChanged("Assessor"); } } - private Hl7.Fhir.Model.ResourceReference _Assessor; + private Hl7.Fhir.Model.ResourceReference? _Assessor; /// /// Reference to last assessment. @@ -573,13 +556,13 @@ public Hl7.Fhir.Model.ResourceReference Assessor [CLSCompliant(false)] [References("ClinicalImpression")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Previous + public Hl7.Fhir.Model.ResourceReference? Previous { get { return _Previous; } set { _Previous = value; OnPropertyChanged("Previous"); } } - private Hl7.Fhir.Model.ResourceReference _Previous; + private Hl7.Fhir.Model.ResourceReference? _Previous; /// /// Relevant impressions of patient state. @@ -591,11 +574,11 @@ public Hl7.Fhir.Model.ResourceReference Previous [DataMember] public List Problem { - get { if(_Problem==null) _Problem = new List(); return _Problem; } + get => _Problem ?? new List(); set { _Problem = value; OnPropertyChanged("Problem"); } } - private List _Problem; + private List? _Problem; /// /// One or more sets of investigations (signs, symptoms, etc.). @@ -605,11 +588,11 @@ public List Problem [DataMember] public List Investigation { - get { if(_Investigation==null) _Investigation = new List(); return _Investigation; } + get => _Investigation ?? new List(); set { _Investigation = value; OnPropertyChanged("Investigation"); } } - private List _Investigation; + private List? _Investigation; /// /// Clinical Protocol followed. @@ -619,24 +602,24 @@ public List Investigat [DataMember] public List ProtocolElement { - get { if(_ProtocolElement==null) _ProtocolElement = new List(); return _ProtocolElement; } + get => _ProtocolElement ?? new List(); set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } - private List _ProtocolElement; + private List? _ProtocolElement; /// /// Clinical Protocol followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Protocol + public IEnumerable? Protocol { - get { return ProtocolElement != null ? ProtocolElement.Select(elem => elem.Value) : null; } + get => _ProtocolElement?.Select(elem => elem.Value); set { if (value == null) - ProtocolElement = null; + ProtocolElement = null!; else ProtocolElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Protocol"); @@ -648,28 +631,25 @@ public IEnumerable Protocol /// [FhirElement("summary", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString SummaryElement + public Hl7.Fhir.Model.FhirString? SummaryElement { get { return _SummaryElement; } set { _SummaryElement = value; OnPropertyChanged("SummaryElement"); } } - private Hl7.Fhir.Model.FhirString _SummaryElement; + private Hl7.Fhir.Model.FhirString? _SummaryElement; /// /// Summary of the assessment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Summary + public string? Summary { - get { return SummaryElement != null ? SummaryElement.Value : null; } + get => _SummaryElement?.Value; set { - if (value == null) - SummaryElement = null; - else - SummaryElement = new Hl7.Fhir.Model.FhirString(value); + SummaryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Summary"); } } @@ -682,11 +662,11 @@ public string Summary [DataMember] public List Finding { - get { if(_Finding==null) _Finding = new List(); return _Finding; } + get => _Finding ?? new List(); set { _Finding = value; OnPropertyChanged("Finding"); } } - private List _Finding; + private List? _Finding; /// /// Estimate of likely outcome. @@ -697,11 +677,11 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get { if(_PrognosisCodeableConcept==null) _PrognosisCodeableConcept = new List(); return _PrognosisCodeableConcept; } + get => _PrognosisCodeableConcept ?? new List(); set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } - private List _PrognosisCodeableConcept; + private List? _PrognosisCodeableConcept; /// /// RiskAssessment expressing likely outcome. @@ -713,11 +693,11 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get { if(_PrognosisReference==null) _PrognosisReference = new List(); return _PrognosisReference; } + get => _PrognosisReference ?? new List(); set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } - private List _PrognosisReference; + private List? _PrognosisReference; /// /// Information supporting the clinical impression. @@ -729,11 +709,11 @@ public List PrognosisReference [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Comments made about the ClinicalImpression. @@ -743,47 +723,43 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as ClinicalImpression; - - if (dest == null) - { + if(other is not ClinicalImpression dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Assessor != null) dest.Assessor = (Hl7.Fhir.Model.ResourceReference)Assessor.DeepCopyInternal(); - if(Previous != null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)Previous.DeepCopyInternal(); - if(Problem.Any()) dest.Problem = new List(Problem.DeepCopyInternal()); - if(Investigation.Any()) dest.Investigation = new List(Investigation.DeepCopyInternal()); - if(ProtocolElement.Any()) dest.ProtocolElement = new List(ProtocolElement.DeepCopyInternal()); - if(SummaryElement != null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)SummaryElement.DeepCopyInternal(); - if(Finding.Any()) dest.Finding = new List(Finding.DeepCopyInternal()); - if(PrognosisCodeableConcept.Any()) dest.PrognosisCodeableConcept = new List(PrognosisCodeableConcept.DeepCopyInternal()); - if(PrognosisReference.Any()) dest.PrognosisReference = new List(PrognosisReference.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Assessor is not null) dest.Assessor = (Hl7.Fhir.Model.ResourceReference)_Assessor.DeepCopyInternal(); + if(_Previous is not null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)_Previous.DeepCopyInternal(); + if(_Problem is not null) dest.Problem = new List(_Problem.DeepCopyInternal()); + if(_Investigation is not null) dest.Investigation = new List(_Investigation.DeepCopyInternal()); + if(_ProtocolElement is not null) dest.ProtocolElement = new List(_ProtocolElement.DeepCopyInternal()); + if(_SummaryElement is not null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)_SummaryElement.DeepCopyInternal(); + if(_Finding is not null) dest.Finding = new List(_Finding.DeepCopyInternal()); + if(_PrognosisCodeableConcept is not null) dest.PrognosisCodeableConcept = new List(_PrognosisCodeableConcept.DeepCopyInternal()); + if(_PrognosisReference is not null) dest.PrognosisReference = new List(_PrognosisReference.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -795,167 +771,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClinicalImpression; - if(otherT == null) return false; + if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Assessor, otherT.Assessor)) return false; - if(!comparer.Equals(Previous, otherT.Previous)) return false; - if(!comparer.ListEquals(Problem, otherT.Problem)) return false; - if(!comparer.ListEquals(Investigation, otherT.Investigation)) return false; - if(!comparer.ListEquals(ProtocolElement, otherT.ProtocolElement)) return false; - if(!comparer.Equals(SummaryElement, otherT.SummaryElement)) return false; - if(!comparer.ListEquals(Finding, otherT.Finding)) return false; - if(!comparer.ListEquals(PrognosisCodeableConcept, otherT.PrognosisCodeableConcept)) return false; - if(!comparer.ListEquals(PrognosisReference, otherT.PrognosisReference)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Assessor, otherT._Assessor)) return false; + if(!comparer.Equals(_Previous, otherT._Previous)) return false; + if(!comparer.ListEquals(_Problem, otherT._Problem)) return false; + if(!comparer.ListEquals(_Investigation, otherT._Investigation)) return false; + if(!comparer.ListEquals(_ProtocolElement, otherT._ProtocolElement)) return false; + if(!comparer.Equals(_SummaryElement, otherT._SummaryElement)) return false; + if(!comparer.ListEquals(_Finding, otherT._Finding)) return false; + if(!comparer.ListEquals(_PrognosisCodeableConcept, otherT._PrognosisCodeableConcept)) return false; + if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "assessor": - value = Assessor; - return Assessor is not null; + value = _Assessor; + return _Assessor is not null; case "previous": - value = Previous; - return Previous is not null; + value = _Previous; + return _Previous is not null; case "problem": - value = Problem; - return Problem?.Any() == true; + value = _Problem; + return _Problem?.Any() == true; case "investigation": - value = Investigation; - return Investigation?.Any() == true; + value = _Investigation; + return _Investigation?.Any() == true; case "protocol": - value = ProtocolElement; - return ProtocolElement?.Any() == true; + value = _ProtocolElement; + return _ProtocolElement?.Any() == true; case "summary": - value = SummaryElement; - return SummaryElement is not null; + value = _SummaryElement; + return _SummaryElement is not null; case "finding": - value = Finding; - return Finding?.Any() == true; + value = _Finding; + return _Finding?.Any() == true; case "prognosisCodeableConcept": - value = PrognosisCodeableConcept; - return PrognosisCodeableConcept?.Any() == true; + value = _PrognosisCodeableConcept; + return _PrognosisCodeableConcept?.Any() == true; case "prognosisReference": - value = PrognosisReference; - return PrognosisReference?.Any() == true; + value = _PrognosisReference; + return _PrognosisReference?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "assessor": - Assessor = (Hl7.Fhir.Model.ResourceReference)value; + Assessor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "previous": - Previous = (Hl7.Fhir.Model.ResourceReference)value; + Previous = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "problem": - Problem = (List)value; + Problem = (List?)value!; return this; case "investigation": - Investigation = (List)value; + Investigation = (List?)value!; return this; case "protocol": - ProtocolElement = (List)value; + ProtocolElement = (List?)value!; return this; case "summary": - SummaryElement = (Hl7.Fhir.Model.FhirString)value; + SummaryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "finding": - Finding = (List)value; + Finding = (List?)value!; return this; case "prognosisCodeableConcept": - PrognosisCodeableConcept = (List)value; + PrognosisCodeableConcept = (List?)value!; return this; case "prognosisReference": - PrognosisReference = (List)value; + PrognosisReference = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -966,26 +942,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Assessor is not null) yield return new KeyValuePair("assessor",Assessor); - if (Previous is not null) yield return new KeyValuePair("previous",Previous); - if (Problem?.Any() == true) yield return new KeyValuePair("problem",Problem); - if (Investigation?.Any() == true) yield return new KeyValuePair("investigation",Investigation); - if (ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",ProtocolElement); - if (SummaryElement is not null) yield return new KeyValuePair("summary",SummaryElement); - if (Finding?.Any() == true) yield return new KeyValuePair("finding",Finding); - if (PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",PrognosisCodeableConcept); - if (PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",PrognosisReference); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Assessor is not null) yield return new KeyValuePair("assessor",_Assessor); + if (_Previous is not null) yield return new KeyValuePair("previous",_Previous); + if (_Problem?.Any() == true) yield return new KeyValuePair("problem",_Problem); + if (_Investigation?.Any() == true) yield return new KeyValuePair("investigation",_Investigation); + if (_ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",_ProtocolElement); + if (_SummaryElement is not null) yield return new KeyValuePair("summary",_SummaryElement); + if (_Finding?.Any() == true) yield return new KeyValuePair("finding",_Finding); + if (_PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",_PrognosisCodeableConcept); + if (_PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",_PrognosisReference); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs index d7ae751c7..8e0c99b3c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -165,11 +164,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -179,24 +178,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -211,24 +210,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -245,11 +244,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of this action. @@ -261,11 +260,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Reply to. @@ -277,11 +276,11 @@ public List PartOf [DataMember] public List InResponseTo { - get { if(_InResponseTo==null) _InResponseTo = new List(); return _InResponseTo; } + get => _InResponseTo ?? new List(); set { _InResponseTo = value; OnPropertyChanged("InResponseTo"); } } - private List _InResponseTo; + private List? _InResponseTo; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -291,13 +290,13 @@ public List InResponseTo [Binding("CommunicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -306,13 +305,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -323,13 +319,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("statusReason", InSummary=true, Order=160)] [Binding("CommunicationNotDoneReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Message category. @@ -340,11 +336,11 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -353,13 +349,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("CommunicationPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -368,13 +364,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -388,11 +381,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -401,13 +394,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Description of the purpose/content. @@ -415,13 +408,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [FhirElement("topic", Order=210, FiveWs="FiveWs.context")] [Binding("CommunicationTopic")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Topic + public Hl7.Fhir.Model.CodeableConcept? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.CodeableConcept _Topic; + private Hl7.Fhir.Model.CodeableConcept? _Topic; /// /// Resources that pertain to this communication. @@ -433,11 +426,11 @@ public Hl7.Fhir.Model.CodeableConcept Topic [DataMember] public List About { - get { if(_About==null) _About = new List(); return _About; } + get => _About ?? new List(); set { _About = value; OnPropertyChanged("About"); } } - private List _About; + private List? _About; /// /// Encounter created as part of. @@ -446,41 +439,38 @@ public List About [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When sent. /// [FhirElement("sent", Order=240, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime SentElement + public Hl7.Fhir.Model.FhirDateTime? SentElement { get { return _SentElement; } set { _SentElement = value; OnPropertyChanged("SentElement"); } } - private Hl7.Fhir.Model.FhirDateTime _SentElement; + private Hl7.Fhir.Model.FhirDateTime? _SentElement; /// /// When sent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sent + public string? Sent { - get { return SentElement != null ? SentElement.Value : null; } + get => _SentElement?.Value; set { - if (value == null) - SentElement = null; - else - SentElement = new Hl7.Fhir.Model.FhirDateTime(value); + SentElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Sent"); } } @@ -490,28 +480,25 @@ public string Sent /// [FhirElement("received", Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedElement { get { return _ReceivedElement; } set { _ReceivedElement = value; OnPropertyChanged("ReceivedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedElement; /// /// When received /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Received + public string? Received { - get { return ReceivedElement != null ? ReceivedElement.Value : null; } + get => _ReceivedElement?.Value; set { - if (value == null) - ReceivedElement = null; - else - ReceivedElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Received"); } } @@ -526,11 +513,11 @@ public string Received [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Message sender. @@ -539,13 +526,13 @@ public List Recipient [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Indication for message. @@ -556,11 +543,11 @@ public Hl7.Fhir.Model.ResourceReference Sender [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was communication done?. @@ -572,11 +559,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Message payload. @@ -586,11 +573,11 @@ public List ReasonReference [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// Comments made about the communication. @@ -600,50 +587,46 @@ public List Payload [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category.ToCodings(); + IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Communication; - - if (dest == null) - { + if(other is not Communication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(InResponseTo.Any()) dest.InResponseTo = new List(InResponseTo.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.CodeableConcept)Topic.DeepCopyInternal(); - if(About.Any()) dest.About = new List(About.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SentElement != null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)SentElement.DeepCopyInternal(); - if(ReceivedElement != null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedElement.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_InResponseTo is not null) dest.InResponseTo = new List(_InResponseTo.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.CodeableConcept)_Topic.DeepCopyInternal(); + if(_About is not null) dest.About = new List(_About.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SentElement is not null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)_SentElement.DeepCopyInternal(); + if(_ReceivedElement is not null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedElement.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -655,188 +638,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Communication; - if(otherT == null) return false; + if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(InResponseTo, otherT.InResponseTo)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(About, otherT.About)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(SentElement, otherT.SentElement)) return false; - if(!comparer.Equals(ReceivedElement, otherT.ReceivedElement)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_InResponseTo, otherT._InResponseTo)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_About, otherT._About)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_SentElement, otherT._SentElement)) return false; + if(!comparer.Equals(_ReceivedElement, otherT._ReceivedElement)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "inResponseTo": - value = InResponseTo; - return InResponseTo?.Any() == true; + value = _InResponseTo; + return _InResponseTo?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "about": - value = About; - return About?.Any() == true; + value = _About; + return _About?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "sent": - value = SentElement; - return SentElement is not null; + value = _SentElement; + return _SentElement is not null; case "received": - value = ReceivedElement; - return ReceivedElement is not null; + value = _ReceivedElement; + return _ReceivedElement is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "inResponseTo": - InResponseTo = (List)value; + InResponseTo = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.CodeableConcept)value; + Topic = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "about": - About = (List)value; + About = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sent": - SentElement = (Hl7.Fhir.Model.FhirDateTime)value; + SentElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "received": - ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -847,29 +830,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (InResponseTo?.Any() == true) yield return new KeyValuePair("inResponseTo",InResponseTo); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (About?.Any() == true) yield return new KeyValuePair("about",About); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SentElement is not null) yield return new KeyValuePair("sent",SentElement); - if (ReceivedElement is not null) yield return new KeyValuePair("received",ReceivedElement); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_InResponseTo?.Any() == true) yield return new KeyValuePair("inResponseTo",_InResponseTo); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_About?.Any() == true) yield return new KeyValuePair("about",_About); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SentElement is not null) yield return new KeyValuePair("sent",_SentElement); + if (_ReceivedElement is not null) yield return new KeyValuePair("received",_ReceivedElement); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs index bdcc084a9..b9fdd43eb 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -165,11 +164,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan or proposal. @@ -181,11 +180,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -197,24 +196,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -224,13 +223,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("CommunicationRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -239,13 +238,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -256,13 +252,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [FhirElement("statusReason", Order=140)] [Binding("CommunicationRequestStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Message category. @@ -273,11 +269,11 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -286,13 +282,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("CommunicationPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -301,13 +297,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -317,13 +310,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if request is prohibiting action @@ -332,13 +325,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -352,11 +342,11 @@ public bool? DoNotPerform [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -365,13 +355,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Resources that pertain to this communication request. @@ -383,11 +373,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List About { - get { if(_About==null) _About = new List(); return _About; } + get => _About ?? new List(); set { _About = value; OnPropertyChanged("About"); } } - private List _About; + private List? _About; /// /// Encounter created as part of. @@ -396,13 +386,13 @@ public List About [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Message payload. @@ -412,11 +402,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// When scheduled. @@ -425,41 +415,38 @@ public List Payload [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When request transitioned to being actionable. /// [FhirElement("authoredOn", InSummary=true, Order=240, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request transitioned to being actionable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -471,13 +458,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Message recipient. @@ -489,11 +476,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Message sender. @@ -502,13 +489,13 @@ public List Recipient [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Why is communication needed?. @@ -519,11 +506,11 @@ public Hl7.Fhir.Model.ResourceReference Sender [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why is communication needed?. @@ -535,11 +522,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Comments made about communication request. @@ -549,49 +536,45 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category.ToCodings(); + IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationRequest; - - if (dest == null) - { + if(other is not CommunicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(About.Any()) dest.About = new List(About.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_About is not null) dest.About = new List(_About.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -603,181 +586,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationRequest; - if(otherT == null) return false; + if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(About, otherT.About)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_About, otherT._About)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "about": - value = About; - return About?.Any() == true; + value = _About; + return _About?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "about": - About = (List)value; + About = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -788,28 +771,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (About?.Any() == true) yield return new KeyValuePair("about",About); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_About?.Any() == true) yield return new KeyValuePair("about",_About); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs index dea31ec56..4735f3c56 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Name of resource type @@ -99,13 +102,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -118,24 +118,24 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get { if(_ParamElement==null) _ParamElement = new List(); return _ParamElement; } + get => _ParamElement ?? new List(); set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } - private List _ParamElement; + private List? _ParamElement; /// /// Search Parameter Name, or chained parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Param + public IEnumerable? Param { - get { return ParamElement != null ? ParamElement.Select(elem => elem.Value) : null; } + get => _ParamElement?.Select(elem => elem.Value); set { if (value == null) - ParamElement = null; + ParamElement = null!; else ParamElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Param"); @@ -147,45 +147,38 @@ public IEnumerable Param /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional documentation about the resource and compartment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ParamElement.Any()) dest.ParamElement = new List(ParamElement.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ParamElement is not null) dest.ParamElement = new List(_ParamElement.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -197,48 +190,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(ParamElement, otherT.ParamElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "param": - value = ParamElement; - return ParamElement?.Any() == true; + value = _ParamElement; + return _ParamElement?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "param": - ParamElement = (List)value; + ParamElement = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -249,9 +242,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ParamElement?.Any() == true) yield return new KeyValuePair("param",ParamElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ParamElement?.Any() == true) yield return new KeyValuePair("param",_ParamElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -262,28 +255,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this compartment definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -293,28 +283,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the compartment definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -325,28 +312,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this compartment definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -359,13 +343,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -374,13 +358,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -390,13 +371,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=130, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -405,13 +386,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -421,28 +399,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -452,28 +427,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -486,39 +458,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the compartment definition. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the compartment definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -531,39 +500,36 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Why this compartment definition is defined. /// [FhirElement("purpose", Order=190, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this compartment definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -576,13 +542,13 @@ public string Purpose [Binding("CompartmentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device @@ -591,13 +557,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -608,13 +571,13 @@ public Hl7.Fhir.Model.CompartmentType? Code [FhirElement("search", InSummary=true, Order=210)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SearchElement + public Hl7.Fhir.Model.FhirBoolean? SearchElement { get { return _SearchElement; } set { _SearchElement = value; OnPropertyChanged("SearchElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SearchElement; + private Hl7.Fhir.Model.FhirBoolean? _SearchElement; /// /// Whether the search syntax is supported @@ -623,13 +586,10 @@ public Hl7.Fhir.Model.FhirBoolean SearchElement [IgnoreDataMember] public bool? Search { - get { return SearchElement != null ? SearchElement.Value : null; } + get => _SearchElement?.Value; set { - if (value == null) - SearchElement = null; - else - SearchElement = new Hl7.Fhir.Model.FhirBoolean(value); + SearchElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Search"); } } @@ -642,36 +602,32 @@ public bool? Search [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentDefinition; - - if (dest == null) - { + if(other is not CompartmentDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(SearchElement != null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)SearchElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_SearchElement is not null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)_SearchElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -683,125 +639,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentDefinition; - if(otherT == null) return false; + if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(SearchElement, otherT.SearchElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "search": - value = SearchElement; - return SearchElement is not null; + value = _SearchElement; + return _SearchElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "search": - SearchElement = (Hl7.Fhir.Model.FhirBoolean)value; + SearchElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -812,20 +768,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (SearchElement is not null) yield return new KeyValuePair("search",SearchElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_SearchElement is not null) yield return new KeyValuePair("search",_SearchElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Composition.cs b/src/Hl7.Fhir.R4/Model/Generated/Composition.cs index 5413abd1b..1484944b6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Composition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Composition","http://hl7.org/fhir/StructureDefinition/Composition")] - public partial class Composition : Hl7.Fhir.Model.DomainResource, IIdentifiable, ICoded + public partial class Composition : Hl7.Fhir.Model.DomainResource, IIdentifiable, ICoded { /// /// FHIR Type Name @@ -182,13 +185,13 @@ public partial class AttesterComponent : Hl7.Fhir.Model.BackboneElement [Binding("CompositionAttestationMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// personal | professional | legal | official @@ -197,13 +200,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.Composition.CompositionAttestationMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -213,28 +213,25 @@ public Hl7.Fhir.Model.Composition.CompositionAttestationMode? Mode /// [FhirElement("time", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the composition was attested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -246,27 +243,23 @@ public string Time [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as AttesterComponent; - - if (dest == null) - { + if(other is not AttesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -278,48 +271,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttesterComponent; - if(otherT == null) return false; + if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -330,9 +323,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -362,13 +355,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | transforms | signs | appends @@ -377,13 +370,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -397,26 +387,22 @@ public Hl7.Fhir.Model.DocumentRelationshipType? Code [AllowedTypes(typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -428,41 +414,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -473,8 +459,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -505,24 +491,24 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// The period covered by the documentation. /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The event(s) being documented. @@ -534,25 +520,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -564,48 +546,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -616,9 +598,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -644,28 +626,25 @@ public partial class SectionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for section (e.g. for ToC) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -676,13 +655,13 @@ public string Title [FhirElement("code", Order=50)] [Binding("CompositionSectionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who and/or what authored the section. @@ -694,11 +673,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who/what the section is about, when it is not about the subject of composition. @@ -707,26 +686,26 @@ public List Author [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Text summary of the section, for human interpretation. /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.Narrative Text + public Hl7.Fhir.Model.Narrative? Text { get { return _Text; } set { _Text = value; OnPropertyChanged("Text"); } } - private Hl7.Fhir.Model.Narrative _Text; + private Hl7.Fhir.Model.Narrative? _Text; /// /// working | snapshot | changes. @@ -735,13 +714,13 @@ public Hl7.Fhir.Model.Narrative Text [DeclaredType(Type = typeof(Code))] [Binding("SectionMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -750,13 +729,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -767,13 +743,13 @@ public Hl7.Fhir.Model.ListMode? Mode [FhirElement("orderedBy", Order=100)] [Binding("SectionEntryOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// A reference to data that supports this section. @@ -785,11 +761,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why the section is empty. @@ -797,13 +773,13 @@ public List Entry [FhirElement("emptyReason", Order=120)] [Binding("SectionEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; /// /// Nested Section. @@ -813,32 +789,28 @@ public Hl7.Fhir.Model.CodeableConcept EmptyReason [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; protected internal override void CopyToInternal(Base other) { - var dest = other as SectionComponent; - - if (dest == null) - { + if(other is not SectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -850,97 +822,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SectionComponent; - if(otherT == null) return false; + if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Text, otherT.Text)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Text, otherT._Text)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "text": - value = Text; - return Text is not null; + value = _Text; + return _Text is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "text": - Text = (Hl7.Fhir.Model.Narrative)value; + Text = (Hl7.Fhir.Model.Narrative?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -951,16 +923,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (Text is not null) yield return new KeyValuePair("text",Text); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_Text is not null) yield return new KeyValuePair("text",_Text); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } @@ -970,13 +942,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// preliminary | final | amended | entered-in-error. @@ -986,13 +958,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("CompositionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preliminary | final | amended | entered-in-error @@ -1001,13 +973,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1019,13 +988,13 @@ public Hl7.Fhir.Model.CompositionStatus? Status [Binding("DocumentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of Composition. @@ -1036,11 +1005,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who and/or what the composition is about. @@ -1049,13 +1018,13 @@ public List Category [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Context of the Composition. @@ -1064,13 +1033,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Composition editing time. @@ -1078,28 +1047,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Composition editing time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1114,11 +1080,11 @@ public string Date [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Human Readable name/title. @@ -1126,28 +1092,25 @@ public List Author [FhirElement("title", InSummary=true, Order=170)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human Readable name/title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1159,13 +1122,13 @@ public string Title [DeclaredType(Type = typeof(Code))] [Binding("DocumentConfidentiality")] [DataMember] - public Code ConfidentialityElement + public Code? ConfidentialityElement { get { return _ConfidentialityElement; } set { _ConfidentialityElement = value; OnPropertyChanged("ConfidentialityElement"); } } - private Code _ConfidentialityElement; + private Code? _ConfidentialityElement; /// /// As defined by affinity domain @@ -1174,13 +1137,10 @@ public Code Confiden [IgnoreDataMember] public Hl7.Fhir.Model.Composition.V3ConfidentialityClassification? Confidentiality { - get { return ConfidentialityElement != null ? ConfidentialityElement.Value : null; } + get => _ConfidentialityElement?.Value; set { - if (value == null) - ConfidentialityElement = null; - else - ConfidentialityElement = new Code(value); + ConfidentialityElement = value is null ? null : new Code(value); OnPropertyChanged("Confidentiality"); } } @@ -1193,11 +1153,11 @@ public Hl7.Fhir.Model.Composition.V3ConfidentialityClassification? Confidentiali [DataMember] public List Attester { - get { if(_Attester==null) _Attester = new List(); return _Attester; } + get => _Attester ?? new List(); set { _Attester = value; OnPropertyChanged("Attester"); } } - private List _Attester; + private List? _Attester; /// /// Organization which maintains the composition. @@ -1206,13 +1166,13 @@ public List Attester [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other compositions/documents. @@ -1222,11 +1182,11 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// The clinical service(s) being documented. @@ -1236,11 +1196,11 @@ public List RelatesTo [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Composition is broken into sections. @@ -1250,42 +1210,38 @@ public List Event [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Composition; - - if (dest == null) - { + if(other is not Composition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ConfidentialityElement != null) dest.ConfidentialityElement = (Code)ConfidentialityElement.DeepCopyInternal(); - if(Attester.Any()) dest.Attester = new List(Attester.DeepCopyInternal()); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ConfidentialityElement is not null) dest.ConfidentialityElement = (Code)_ConfidentialityElement.DeepCopyInternal(); + if(_Attester is not null) dest.Attester = new List(_Attester.DeepCopyInternal()); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1297,132 +1253,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Composition; - if(otherT == null) return false; + if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ConfidentialityElement, otherT.ConfidentialityElement)) return false; - if(!comparer.ListEquals(Attester, otherT.Attester)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ConfidentialityElement, otherT._ConfidentialityElement)) return false; + if(!comparer.ListEquals(_Attester, otherT._Attester)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "confidentiality": - value = ConfidentialityElement; - return ConfidentialityElement is not null; + value = _ConfidentialityElement; + return _ConfidentialityElement is not null; case "attester": - value = Attester; - return Attester?.Any() == true; + value = _Attester; + return _Attester?.Any() == true; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "confidentiality": - ConfidentialityElement = (Code)value; + ConfidentialityElement = (Code?)value; return this; case "attester": - Attester = (List)value; + Attester = (List?)value!; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1433,21 +1389,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ConfidentialityElement is not null) yield return new KeyValuePair("confidentiality",ConfidentialityElement); - if (Attester?.Any() == true) yield return new KeyValuePair("attester",Attester); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ConfidentialityElement is not null) yield return new KeyValuePair("confidentiality",_ConfidentialityElement); + if (_Attester?.Any() == true) yield return new KeyValuePair("attester",_Attester); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs index 77350d936..4886882e0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ConceptMap","http://hl7.org/fhir/StructureDefinition/ConceptMap")] - public partial class ConceptMap : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ConceptMap : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -108,28 +111,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("source", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// Source system where concepts to be mapped are defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -139,28 +139,25 @@ public string Source /// [FhirElement("sourceVersion", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceVersionElement + public Hl7.Fhir.Model.FhirString? SourceVersionElement { get { return _SourceVersionElement; } set { _SourceVersionElement = value; OnPropertyChanged("SourceVersionElement"); } } - private Hl7.Fhir.Model.FhirString _SourceVersionElement; + private Hl7.Fhir.Model.FhirString? _SourceVersionElement; /// /// Specific version of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceVersion + public string? SourceVersion { - get { return SourceVersionElement != null ? SourceVersionElement.Value : null; } + get => _SourceVersionElement?.Value; set { - if (value == null) - SourceVersionElement = null; - else - SourceVersionElement = new Hl7.Fhir.Model.FhirString(value); + SourceVersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceVersion"); } } @@ -170,28 +167,25 @@ public string SourceVersion /// [FhirElement("target", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri TargetElement + public Hl7.Fhir.Model.FhirUri? TargetElement { get { return _TargetElement; } set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private Hl7.Fhir.Model.FhirUri _TargetElement; + private Hl7.Fhir.Model.FhirUri? _TargetElement; /// /// Target system that the concepts are to be mapped to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Target + public string? Target { - get { return TargetElement != null ? TargetElement.Value : null; } + get => _TargetElement?.Value; set { - if (value == null) - TargetElement = null; - else - TargetElement = new Hl7.Fhir.Model.FhirUri(value); + TargetElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Target"); } } @@ -201,28 +195,25 @@ public string Target /// [FhirElement("targetVersion", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TargetVersionElement + public Hl7.Fhir.Model.FhirString? TargetVersionElement { get { return _TargetVersionElement; } set { _TargetVersionElement = value; OnPropertyChanged("TargetVersionElement"); } } - private Hl7.Fhir.Model.FhirString _TargetVersionElement; + private Hl7.Fhir.Model.FhirString? _TargetVersionElement; /// /// Specific version of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetVersion + public string? TargetVersion { - get { return TargetVersionElement != null ? TargetVersionElement.Value : null; } + get => _TargetVersionElement?.Value; set { - if (value == null) - TargetVersionElement = null; - else - TargetVersionElement = new Hl7.Fhir.Model.FhirString(value); + TargetVersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TargetVersion"); } } @@ -235,41 +226,37 @@ public string TargetVersion [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; /// /// What to do when there is no mapping for the source concept. /// [FhirElement("unmapped", Order=90)] [DataMember] - public Hl7.Fhir.Model.ConceptMap.UnmappedComponent Unmapped + public Hl7.Fhir.Model.ConceptMap.UnmappedComponent? Unmapped { get { return _Unmapped; } set { _Unmapped = value; OnPropertyChanged("Unmapped"); } } - private Hl7.Fhir.Model.ConceptMap.UnmappedComponent _Unmapped; + private Hl7.Fhir.Model.ConceptMap.UnmappedComponent? _Unmapped; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(SourceVersionElement != null) dest.SourceVersionElement = (Hl7.Fhir.Model.FhirString)SourceVersionElement.DeepCopyInternal(); - if(TargetElement != null) dest.TargetElement = (Hl7.Fhir.Model.FhirUri)TargetElement.DeepCopyInternal(); - if(TargetVersionElement != null) dest.TargetVersionElement = (Hl7.Fhir.Model.FhirString)TargetVersionElement.DeepCopyInternal(); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); - if(Unmapped != null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)Unmapped.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_SourceVersionElement is not null) dest.SourceVersionElement = (Hl7.Fhir.Model.FhirString)_SourceVersionElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = (Hl7.Fhir.Model.FhirUri)_TargetElement.DeepCopyInternal(); + if(_TargetVersionElement is not null) dest.TargetVersionElement = (Hl7.Fhir.Model.FhirString)_TargetVersionElement.DeepCopyInternal(); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); + if(_Unmapped is not null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)_Unmapped.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -281,69 +268,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(SourceVersionElement, otherT.SourceVersionElement)) return false; - if(!comparer.Equals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.Equals(TargetVersionElement, otherT.TargetVersionElement)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; - if(!comparer.Equals(Unmapped, otherT.Unmapped)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_SourceVersionElement, otherT._SourceVersionElement)) return false; + if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.Equals(_TargetVersionElement, otherT._TargetVersionElement)) return false; + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "sourceVersion": - value = SourceVersionElement; - return SourceVersionElement is not null; + value = _SourceVersionElement; + return _SourceVersionElement is not null; case "target": - value = TargetElement; - return TargetElement is not null; + value = _TargetElement; + return _TargetElement is not null; case "targetVersion": - value = TargetVersionElement; - return TargetVersionElement is not null; + value = _TargetVersionElement; + return _TargetVersionElement is not null; case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; case "unmapped": - value = Unmapped; - return Unmapped is not null; + value = _Unmapped; + return _Unmapped is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "sourceVersion": - SourceVersionElement = (Hl7.Fhir.Model.FhirString)value; + SourceVersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - TargetElement = (Hl7.Fhir.Model.FhirUri)value; + TargetElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "targetVersion": - TargetVersionElement = (Hl7.Fhir.Model.FhirString)value; + TargetVersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "element": - Element = (List)value; + Element = (List?)value!; return this; case "unmapped": - Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)value; + Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent?)value; return this; default: return base.SetValue(key, value); @@ -354,12 +341,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (SourceVersionElement is not null) yield return new KeyValuePair("sourceVersion",SourceVersionElement); - if (TargetElement is not null) yield return new KeyValuePair("target",TargetElement); - if (TargetVersionElement is not null) yield return new KeyValuePair("targetVersion",TargetVersionElement); - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); - if (Unmapped is not null) yield return new KeyValuePair("unmapped",Unmapped); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_SourceVersionElement is not null) yield return new KeyValuePair("sourceVersion",_SourceVersionElement); + if (_TargetElement is not null) yield return new KeyValuePair("target",_TargetElement); + if (_TargetVersionElement is not null) yield return new KeyValuePair("targetVersion",_TargetVersionElement); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); + if (_Unmapped is not null) yield return new KeyValuePair("unmapped",_Unmapped); } } @@ -386,28 +373,25 @@ public partial class SourceElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies element being mapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -417,28 +401,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -451,25 +432,21 @@ public string Display [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceElementComponent; - - if (dest == null) - { + if(other is not SourceElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -481,48 +458,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceElementComponent; - if(otherT == null) return false; + if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -533,9 +510,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -562,28 +539,25 @@ public partial class TargetElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies the target element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -593,28 +567,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -627,13 +598,13 @@ public string Display [Binding("ConceptMapEquivalence")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code EquivalenceElement + public Code? EquivalenceElement { get { return _EquivalenceElement; } set { _EquivalenceElement = value; OnPropertyChanged("EquivalenceElement"); } } - private Code _EquivalenceElement; + private Code? _EquivalenceElement; /// /// relatedto | equivalent | equal | wider | subsumes | narrower | specializes | inexact | unmatched | disjoint @@ -642,13 +613,10 @@ public Code EquivalenceElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMapEquivalence? Equivalence { - get { return EquivalenceElement != null ? EquivalenceElement.Value : null; } + get => _EquivalenceElement?.Value; set { - if (value == null) - EquivalenceElement = null; - else - EquivalenceElement = new Code(value); + EquivalenceElement = value is null ? null : new Code(value); OnPropertyChanged("Equivalence"); } } @@ -658,28 +626,25 @@ public Hl7.Fhir.Model.ConceptMapEquivalence? Equivalence /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Description of status/issues in mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -692,11 +657,11 @@ public string Comment [DataMember] public List DependsOn { - get { if(_DependsOn==null) _DependsOn = new List(); return _DependsOn; } + get => _DependsOn ?? new List(); set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } - private List _DependsOn; + private List? _DependsOn; /// /// Other concepts that this mapping also produces. @@ -706,28 +671,24 @@ public List DependsOn [DataMember] public List Product { - get { if(_Product==null) _Product = new List(); return _Product; } + get => _Product ?? new List(); set { _Product = value; OnPropertyChanged("Product"); } } - private List _Product; + private List? _Product; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetElementComponent; - - if (dest == null) - { + if(other is not TargetElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(EquivalenceElement != null) dest.EquivalenceElement = (Code)EquivalenceElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(DependsOn.Any()) dest.DependsOn = new List(DependsOn.DeepCopyInternal()); - if(Product.Any()) dest.Product = new List(Product.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_EquivalenceElement is not null) dest.EquivalenceElement = (Code)_EquivalenceElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_DependsOn is not null) dest.DependsOn = new List(_DependsOn.DeepCopyInternal()); + if(_Product is not null) dest.Product = new List(_Product.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -739,69 +700,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetElementComponent; - if(otherT == null) return false; + if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(EquivalenceElement, otherT.EquivalenceElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(DependsOn, otherT.DependsOn)) return false; - if(!comparer.ListEquals(Product, otherT.Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_EquivalenceElement, otherT._EquivalenceElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; + if(!comparer.ListEquals(_Product, otherT._Product)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "equivalence": - value = EquivalenceElement; - return EquivalenceElement is not null; + value = _EquivalenceElement; + return _EquivalenceElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "dependsOn": - value = DependsOn; - return DependsOn?.Any() == true; + value = _DependsOn; + return _DependsOn?.Any() == true; case "product": - value = Product; - return Product?.Any() == true; + value = _Product; + return _Product?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "equivalence": - EquivalenceElement = (Code)value; + EquivalenceElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "dependsOn": - DependsOn = (List)value; + DependsOn = (List?)value!; return this; case "product": - Product = (List)value; + Product = (List?)value!; return this; default: return base.SetValue(key, value); @@ -812,12 +773,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (EquivalenceElement is not null) yield return new KeyValuePair("equivalence",EquivalenceElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",DependsOn); - if (Product?.Any() == true) yield return new KeyValuePair("product",Product); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_EquivalenceElement is not null) yield return new KeyValuePair("equivalence",_EquivalenceElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",_DependsOn); + if (_Product?.Any() == true) yield return new KeyValuePair("product",_Product); } } @@ -844,28 +805,25 @@ public partial class OtherElementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("property", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri PropertyElement + public Hl7.Fhir.Model.FhirUri? PropertyElement { get { return _PropertyElement; } set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private Hl7.Fhir.Model.FhirUri _PropertyElement; + private Hl7.Fhir.Model.FhirUri? _PropertyElement; /// /// Reference to property mapping depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Property + public string? Property { - get { return PropertyElement != null ? PropertyElement.Value : null; } + get => _PropertyElement?.Value; set { - if (value == null) - PropertyElement = null; - else - PropertyElement = new Hl7.Fhir.Model.FhirUri(value); + PropertyElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Property"); } } @@ -875,28 +833,25 @@ public string Property /// [FhirElement("system", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical SystemElement + public Hl7.Fhir.Model.Canonical? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.Canonical _SystemElement; + private Hl7.Fhir.Model.Canonical? _SystemElement; /// /// Code System (if necessary) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.Canonical(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("System"); } } @@ -907,28 +862,25 @@ public string System [FhirElement("value", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value of the referenced element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -938,46 +890,39 @@ public string Value /// [FhirElement("display", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code (if value is a code) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OtherElementComponent; - - if (dest == null) - { + if(other is not OtherElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PropertyElement != null) dest.PropertyElement = (Hl7.Fhir.Model.FhirUri)PropertyElement.DeepCopyInternal(); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.Canonical)SystemElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_PropertyElement is not null) dest.PropertyElement = (Hl7.Fhir.Model.FhirUri)_PropertyElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.Canonical)_SystemElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -989,55 +934,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherElementComponent; - if(otherT == null) return false; + if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PropertyElement, otherT.PropertyElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "property": - value = PropertyElement; - return PropertyElement is not null; + value = _PropertyElement; + return _PropertyElement is not null; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "property": - PropertyElement = (Hl7.Fhir.Model.FhirUri)value; + PropertyElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "system": - SystemElement = (Hl7.Fhir.Model.Canonical)value; + SystemElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1048,10 +993,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PropertyElement is not null) yield return new KeyValuePair("property",PropertyElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_PropertyElement is not null) yield return new KeyValuePair("property",_PropertyElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -1081,13 +1026,13 @@ public partial class UnmappedComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConceptMapGroupUnmappedMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// provided | fixed | other-map @@ -1096,13 +1041,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -1112,28 +1054,25 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Fixed code when mode = fixed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1143,28 +1082,25 @@ public string Code /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -1174,46 +1110,39 @@ public string Display /// [FhirElement("url", Order=70)] [DataMember] - public Hl7.Fhir.Model.Canonical UrlElement + public Hl7.Fhir.Model.Canonical? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.Canonical _UrlElement; + private Hl7.Fhir.Model.Canonical? _UrlElement; /// /// canonical reference to an additional ConceptMap to use for mapping if the source concept is unmapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.Canonical(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UnmappedComponent; - - if (dest == null) - { + if(other is not UnmappedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)UrlElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1225,55 +1154,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UnmappedComponent; - if(otherT == null) return false; + if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.Canonical)value; + UrlElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1284,10 +1213,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -1297,28 +1226,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this concept map, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1328,41 +1254,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the concept map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1372,28 +1295,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this concept map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1403,28 +1323,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this concept map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1437,13 +1354,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1452,13 +1369,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1468,13 +1382,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1483,13 +1397,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1499,28 +1410,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1530,28 +1438,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1564,39 +1469,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the concept map. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1609,11 +1511,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for concept map (if applicable). @@ -1624,39 +1526,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this concept map is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this concept map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1666,28 +1565,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1699,13 +1595,13 @@ public string Copyright [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// The target value set which provides context for the mappings. @@ -1714,13 +1610,13 @@ public Hl7.Fhir.Model.DataType Source [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; /// /// Same source and target systems. @@ -1730,42 +1626,38 @@ public Hl7.Fhir.Model.DataType Target [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptMap; - - if (dest == null) - { + if(other is not ConceptMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1777,153 +1669,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptMap; - if(otherT == null) return false; + if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1934,24 +1826,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Condition.cs b/src/Hl7.Fhir.R4/Model/Generated/Condition.cs index e1f3c8190..6f7807d8b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Condition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Condition","http://hl7.org/fhir/StructureDefinition/Condition")] - public partial class Condition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Condition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -173,13 +176,13 @@ public partial class StageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("summary", Order=40)] [Binding("ConditionStage")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Summary + public Hl7.Fhir.Model.CodeableConcept? Summary { get { return _Summary; } set { _Summary = value; OnPropertyChanged("Summary"); } } - private Hl7.Fhir.Model.CodeableConcept _Summary; + private Hl7.Fhir.Model.CodeableConcept? _Summary; /// /// Formal record of assessment. @@ -191,11 +194,11 @@ public Hl7.Fhir.Model.CodeableConcept Summary [DataMember] public List Assessment { - get { if(_Assessment==null) _Assessment = new List(); return _Assessment; } + get => _Assessment ?? new List(); set { _Assessment = value; OnPropertyChanged("Assessment"); } } - private List _Assessment; + private List? _Assessment; /// /// Kind of staging. @@ -203,27 +206,23 @@ public List Assessment [FhirElement("type", Order=60)] [Binding("ConditionStageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as StageComponent; - - if (dest == null) - { + if(other is not StageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Summary != null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)Summary.DeepCopyInternal(); - if(Assessment.Any()) dest.Assessment = new List(Assessment.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_Summary is not null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)_Summary.DeepCopyInternal(); + if(_Assessment is not null) dest.Assessment = new List(_Assessment.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -235,48 +234,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StageComponent; - if(otherT == null) return false; + if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Summary, otherT.Summary)) return false; - if(!comparer.ListEquals(Assessment, otherT.Assessment)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "summary": - value = Summary; - return Summary is not null; + value = _Summary; + return _Summary is not null; case "assessment": - value = Assessment; - return Assessment?.Any() == true; + value = _Assessment; + return _Assessment?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "summary": - Summary = (Hl7.Fhir.Model.CodeableConcept)value; + Summary = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "assessment": - Assessment = (List)value; + Assessment = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -287,9 +286,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Summary is not null) yield return new KeyValuePair("summary",Summary); - if (Assessment?.Any() == true) yield return new KeyValuePair("assessment",Assessment); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_Summary is not null) yield return new KeyValuePair("summary",_Summary); + if (_Assessment?.Any() == true) yield return new KeyValuePair("assessment",_Assessment); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -320,11 +319,11 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting information found elsewhere. @@ -336,24 +335,20 @@ public List Code [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceComponent; - - if (dest == null) - { + if(other is not EvidenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -365,41 +360,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceComponent; - if(otherT == null) return false; + if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -410,8 +405,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -424,11 +419,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | recurrence | relapse | inactive | remission | resolved. @@ -436,13 +431,13 @@ public List Identifier [FhirElement("clinicalStatus", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [Binding("ConditionClinicalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ClinicalStatus + public Hl7.Fhir.Model.CodeableConcept? ClinicalStatus { get { return _ClinicalStatus; } set { _ClinicalStatus = value; OnPropertyChanged("ClinicalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ClinicalStatus; + private Hl7.Fhir.Model.CodeableConcept? _ClinicalStatus; /// /// unconfirmed | provisional | differential | confirmed | refuted | entered-in-error. @@ -450,13 +445,13 @@ public Hl7.Fhir.Model.CodeableConcept ClinicalStatus [FhirElement("verificationStatus", InSummary=true, IsModifier=true, Order=110, FiveWs="FiveWs.status")] [Binding("ConditionVerificationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VerificationStatus + public Hl7.Fhir.Model.CodeableConcept? VerificationStatus { get { return _VerificationStatus; } set { _VerificationStatus = value; OnPropertyChanged("VerificationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _VerificationStatus; + private Hl7.Fhir.Model.CodeableConcept? _VerificationStatus; /// /// problem-list-item | encounter-diagnosis. @@ -467,11 +462,11 @@ public Hl7.Fhir.Model.CodeableConcept VerificationStatus [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Subjective severity of condition. @@ -479,13 +474,13 @@ public List Category [FhirElement("severity", Order=130, FiveWs="FiveWs.grade")] [Binding("ConditionSeverity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Severity + public Hl7.Fhir.Model.CodeableConcept? Severity { get { return _Severity; } set { _Severity = value; OnPropertyChanged("Severity"); } } - private Hl7.Fhir.Model.CodeableConcept _Severity; + private Hl7.Fhir.Model.CodeableConcept? _Severity; /// /// Identification of the condition, problem or diagnosis. @@ -493,13 +488,13 @@ public Hl7.Fhir.Model.CodeableConcept Severity [FhirElement("code", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [Binding("ConditionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Anatomical location, if relevant. @@ -510,11 +505,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Who has the condition?. @@ -524,13 +519,13 @@ public List BodySite [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -539,13 +534,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Estimated or actual date, date-time, or age. @@ -554,13 +549,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// When in resolution/remission. @@ -569,41 +564,38 @@ public Hl7.Fhir.Model.DataType Onset [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Abatement + public Hl7.Fhir.Model.DataType? Abatement { get { return _Abatement; } set { _Abatement = value; OnPropertyChanged("Abatement"); } } - private Hl7.Fhir.Model.DataType _Abatement; + private Hl7.Fhir.Model.DataType? _Abatement; /// /// Date record was first recorded. /// [FhirElement("recordedDate", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// Date record was first recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -615,13 +607,13 @@ public string RecordedDate [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Person who asserts this condition. @@ -630,13 +622,13 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// Stage/grade, usually assessed formally. @@ -646,11 +638,11 @@ public Hl7.Fhir.Model.ResourceReference Asserter [DataMember] public List Stage { - get { if(_Stage==null) _Stage = new List(); return _Stage; } + get => _Stage ?? new List(); set { _Stage = value; OnPropertyChanged("Stage"); } } - private List _Stage; + private List? _Stage; /// /// Supporting evidence. @@ -660,11 +652,11 @@ public List Stage [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; /// /// Additional information about the Condition. @@ -674,44 +666,40 @@ public List Evidence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Condition; - - if (dest == null) - { + if(other is not Condition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatus != null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)ClinicalStatus.DeepCopyInternal(); - if(VerificationStatus != null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)VerificationStatus.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Severity != null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)Severity.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Abatement != null) dest.Abatement = (Hl7.Fhir.Model.DataType)Abatement.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(Stage.Any()) dest.Stage = new List(Stage.DeepCopyInternal()); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatus is not null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)_ClinicalStatus.DeepCopyInternal(); + if(_VerificationStatus is not null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)_VerificationStatus.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Severity is not null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)_Severity.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Abatement is not null) dest.Abatement = (Hl7.Fhir.Model.DataType)_Abatement.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_Stage is not null) dest.Stage = new List(_Stage.DeepCopyInternal()); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -723,146 +711,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Condition; - if(otherT == null) return false; + if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatus, otherT.ClinicalStatus)) return false; - if(!comparer.Equals(VerificationStatus, otherT.VerificationStatus)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Severity, otherT.Severity)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(Abatement, otherT.Abatement)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.ListEquals(Stage, otherT.Stage)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; + if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Severity, otherT._Severity)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_Abatement, otherT._Abatement)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.ListEquals(_Stage, otherT._Stage)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatus; - return ClinicalStatus is not null; + value = _ClinicalStatus; + return _ClinicalStatus is not null; case "verificationStatus": - value = VerificationStatus; - return VerificationStatus is not null; + value = _VerificationStatus; + return _VerificationStatus is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "severity": - value = Severity; - return Severity is not null; + value = _Severity; + return _Severity is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "abatement": - value = Abatement; - return Abatement is not null; + value = _Abatement; + return _Abatement is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "stage": - value = Stage; - return Stage?.Any() == true; + value = _Stage; + return _Stage?.Any() == true; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verificationStatus": - VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + VerificationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "severity": - Severity = (Hl7.Fhir.Model.CodeableConcept)value; + Severity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "abatement": - Abatement = (Hl7.Fhir.Model.DataType)value; + Abatement = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "stage": - Stage = (List)value; + Stage = (List?)value!; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -873,23 +861,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatus); - if (VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",VerificationStatus); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Severity is not null) yield return new KeyValuePair("severity",Severity); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Abatement is not null) yield return new KeyValuePair("abatement",Abatement); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (Stage?.Any() == true) yield return new KeyValuePair("stage",Stage); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatus); + if (_VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatus); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Severity is not null) yield return new KeyValuePair("severity",_Severity); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Abatement is not null) yield return new KeyValuePair("abatement",_Abatement); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_Stage?.Any() == true) yield return new KeyValuePair("stage",_Stage); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Consent.cs b/src/Hl7.Fhir.R4/Model/Generated/Consent.cs index 17306de2f..64eaf7f04 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Consent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -183,28 +186,25 @@ public partial class PolicyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("authority", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri AuthorityElement + public Hl7.Fhir.Model.FhirUri? AuthorityElement { get { return _AuthorityElement; } set { _AuthorityElement = value; OnPropertyChanged("AuthorityElement"); } } - private Hl7.Fhir.Model.FhirUri _AuthorityElement; + private Hl7.Fhir.Model.FhirUri? _AuthorityElement; /// /// Enforcement source for policy /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authority + public string? Authority { - get { return AuthorityElement != null ? AuthorityElement.Value : null; } + get => _AuthorityElement?.Value; set { - if (value == null) - AuthorityElement = null; - else - AuthorityElement = new Hl7.Fhir.Model.FhirUri(value); + AuthorityElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Authority"); } } @@ -214,44 +214,37 @@ public string Authority /// [FhirElement("uri", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Specific policy covered by this consent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PolicyComponent; - - if (dest == null) - { + if(other is not PolicyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AuthorityElement != null) dest.AuthorityElement = (Hl7.Fhir.Model.FhirUri)AuthorityElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); + if(_AuthorityElement is not null) dest.AuthorityElement = (Hl7.Fhir.Model.FhirUri)_AuthorityElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -263,41 +256,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PolicyComponent; - if(otherT == null) return false; + if(other is not PolicyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AuthorityElement, otherT.AuthorityElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authority": - value = AuthorityElement; - return AuthorityElement is not null; + value = _AuthorityElement; + return _AuthorityElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authority": - AuthorityElement = (Hl7.Fhir.Model.FhirUri)value; + AuthorityElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -308,8 +301,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AuthorityElement is not null) yield return new KeyValuePair("authority",AuthorityElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); + if (_AuthorityElement is not null) yield return new KeyValuePair("authority",_AuthorityElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); } } @@ -336,13 +329,13 @@ public partial class VerificationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("verified", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean VerifiedElement + public Hl7.Fhir.Model.FhirBoolean? VerifiedElement { get { return _VerifiedElement; } set { _VerifiedElement = value; OnPropertyChanged("VerifiedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _VerifiedElement; + private Hl7.Fhir.Model.FhirBoolean? _VerifiedElement; /// /// Has been verified @@ -351,13 +344,10 @@ public Hl7.Fhir.Model.FhirBoolean VerifiedElement [IgnoreDataMember] public bool? Verified { - get { return VerifiedElement != null ? VerifiedElement.Value : null; } + get => _VerifiedElement?.Value; set { - if (value == null) - VerifiedElement = null; - else - VerifiedElement = new Hl7.Fhir.Model.FhirBoolean(value); + VerifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Verified"); } } @@ -369,58 +359,51 @@ public bool? Verified [CLSCompliant(false)] [References("Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference VerifiedWith + public Hl7.Fhir.Model.ResourceReference? VerifiedWith { get { return _VerifiedWith; } set { _VerifiedWith = value; OnPropertyChanged("VerifiedWith"); } } - private Hl7.Fhir.Model.ResourceReference _VerifiedWith; + private Hl7.Fhir.Model.ResourceReference? _VerifiedWith; /// /// When consent verified. /// [FhirElement("verificationDate", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime VerificationDateElement + public Hl7.Fhir.Model.FhirDateTime? VerificationDateElement { get { return _VerificationDateElement; } set { _VerificationDateElement = value; OnPropertyChanged("VerificationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _VerificationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _VerificationDateElement; /// /// When consent verified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VerificationDate + public string? VerificationDate { - get { return VerificationDateElement != null ? VerificationDateElement.Value : null; } + get => _VerificationDateElement?.Value; set { - if (value == null) - VerificationDateElement = null; - else - VerificationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + VerificationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("VerificationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VerificationComponent; - - if (dest == null) - { + if(other is not VerificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VerifiedElement != null) dest.VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)VerifiedElement.DeepCopyInternal(); - if(VerifiedWith != null) dest.VerifiedWith = (Hl7.Fhir.Model.ResourceReference)VerifiedWith.DeepCopyInternal(); - if(VerificationDateElement != null) dest.VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime)VerificationDateElement.DeepCopyInternal(); + if(_VerifiedElement is not null) dest.VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)_VerifiedElement.DeepCopyInternal(); + if(_VerifiedWith is not null) dest.VerifiedWith = (Hl7.Fhir.Model.ResourceReference)_VerifiedWith.DeepCopyInternal(); + if(_VerificationDateElement is not null) dest.VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime)_VerificationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -432,48 +415,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VerificationComponent; - if(otherT == null) return false; + if(other is not VerificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VerifiedElement, otherT.VerifiedElement)) return false; - if(!comparer.Equals(VerifiedWith, otherT.VerifiedWith)) return false; - if(!comparer.Equals(VerificationDateElement, otherT.VerificationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; + if(!comparer.Equals(_VerifiedWith, otherT._VerifiedWith)) return false; + if(!comparer.Equals(_VerificationDateElement, otherT._VerificationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "verified": - value = VerifiedElement; - return VerifiedElement is not null; + value = _VerifiedElement; + return _VerifiedElement is not null; case "verifiedWith": - value = VerifiedWith; - return VerifiedWith is not null; + value = _VerifiedWith; + return _VerifiedWith is not null; case "verificationDate": - value = VerificationDateElement; - return VerificationDateElement is not null; + value = _VerificationDateElement; + return _VerificationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "verified": - VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)value; + VerifiedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "verifiedWith": - VerifiedWith = (Hl7.Fhir.Model.ResourceReference)value; + VerifiedWith = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "verificationDate": - VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -484,9 +467,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VerifiedElement is not null) yield return new KeyValuePair("verified",VerifiedElement); - if (VerifiedWith is not null) yield return new KeyValuePair("verifiedWith",VerifiedWith); - if (VerificationDateElement is not null) yield return new KeyValuePair("verificationDate",VerificationDateElement); + if (_VerifiedElement is not null) yield return new KeyValuePair("verified",_VerifiedElement); + if (_VerifiedWith is not null) yield return new KeyValuePair("verifiedWith",_VerifiedWith); + if (_VerificationDateElement is not null) yield return new KeyValuePair("verificationDate",_VerificationDateElement); } } @@ -514,13 +497,13 @@ public partial class provisionComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ConsentProvisionType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// deny | permit @@ -529,13 +512,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentProvisionType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -545,13 +525,13 @@ public Hl7.Fhir.Model.Consent.ConsentProvisionType? Type /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Who|what controlled by this rule (or group, by role). @@ -561,11 +541,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Actions controlled by this rule. @@ -576,11 +556,11 @@ public List Actor [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Security Labels that define affected resources. @@ -591,11 +571,11 @@ public List Action [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of activities covered by this rule. @@ -606,11 +586,11 @@ public List SecurityLabel [DataMember] public List Purpose { - get { if(_Purpose==null) _Purpose = new List(); return _Purpose; } + get => _Purpose ?? new List(); set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private List _Purpose; + private List? _Purpose; /// /// e.g. Resource Type, Profile, CDA, etc. @@ -621,11 +601,11 @@ public List Purpose [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// e.g. LOINC or SNOMED CT code, etc. in the content. @@ -636,24 +616,24 @@ public List Class [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Timeframe for data controlled by this rule. /// [FhirElement("dataPeriod", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period DataPeriod + public Hl7.Fhir.Model.Period? DataPeriod { get { return _DataPeriod; } set { _DataPeriod = value; OnPropertyChanged("DataPeriod"); } } - private Hl7.Fhir.Model.Period _DataPeriod; + private Hl7.Fhir.Model.Period? _DataPeriod; /// /// Data controlled by this rule. @@ -663,11 +643,11 @@ public Hl7.Fhir.Model.Period DataPeriod [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// Nested Exception Rules. @@ -677,33 +657,29 @@ public List Data [DataMember] public List Provision { - get { if(_Provision==null) _Provision = new List(); return _Provision; } + get => _Provision ?? new List(); set { _Provision = value; OnPropertyChanged("Provision"); } } - private List _Provision; + private List? _Provision; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionComponent; - - if (dest == null) - { + if(other is not provisionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Purpose.Any()) dest.Purpose = new List(Purpose.DeepCopyInternal()); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(DataPeriod != null) dest.DataPeriod = (Hl7.Fhir.Model.Period)DataPeriod.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Provision.Any()) dest.Provision = new List(Provision.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Purpose is not null) dest.Purpose = new List(_Purpose.DeepCopyInternal()); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_DataPeriod is not null) dest.DataPeriod = (Hl7.Fhir.Model.Period)_DataPeriod.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Provision is not null) dest.Provision = new List(_Provision.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -715,104 +691,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionComponent; - if(otherT == null) return false; + if(other is not provisionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Purpose, otherT.Purpose)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(DataPeriod, otherT.DataPeriod)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.ListEquals(Provision, otherT.Provision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Purpose, otherT._Purpose)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "purpose": - value = Purpose; - return Purpose?.Any() == true; + value = _Purpose; + return _Purpose?.Any() == true; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "dataPeriod": - value = DataPeriod; - return DataPeriod is not null; + value = _DataPeriod; + return _DataPeriod is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "provision": - value = Provision; - return Provision?.Any() == true; + value = _Provision; + return _Provision?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "purpose": - Purpose = (List)value; + Purpose = (List?)value!; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "dataPeriod": - DataPeriod = (Hl7.Fhir.Model.Period)value; + DataPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "provision": - Provision = (List)value; + Provision = (List?)value!; return this; default: return base.SetValue(key, value); @@ -823,17 +799,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Purpose?.Any() == true) yield return new KeyValuePair("purpose",Purpose); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (DataPeriod is not null) yield return new KeyValuePair("dataPeriod",DataPeriod); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Provision?.Any() == true) yield return new KeyValuePair("provision",Provision); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Purpose?.Any() == true) yield return new KeyValuePair("purpose",_Purpose); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_DataPeriod is not null) yield return new KeyValuePair("dataPeriod",_DataPeriod); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Provision?.Any() == true) yield return new KeyValuePair("provision",_Provision); } } @@ -861,13 +837,13 @@ public partial class provisionActorComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentActorRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Resource for the actor (or group, by role). @@ -877,26 +853,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Device","Group","CareTeam","Organization","Patient","Practitioner","RelatedPerson","PractitionerRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionActorComponent; - - if (dest == null) - { + if(other is not provisionActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -908,41 +880,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionActorComponent; - if(otherT == null) return false; + if(other is not provisionActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -953,8 +925,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -983,13 +955,13 @@ public partial class provisionDataComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentDataMeaning")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MeaningElement + public Code? MeaningElement { get { return _MeaningElement; } set { _MeaningElement = value; OnPropertyChanged("MeaningElement"); } } - private Code _MeaningElement; + private Code? _MeaningElement; /// /// instance | related | dependents | authoredby @@ -998,13 +970,10 @@ public Code MeaningElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning { - get { return MeaningElement != null ? MeaningElement.Value : null; } + get => _MeaningElement?.Value; set { - if (value == null) - MeaningElement = null; - else - MeaningElement = new Code(value); + MeaningElement = value is null ? null : new Code(value); OnPropertyChanged("Meaning"); } } @@ -1017,26 +986,22 @@ public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionDataComponent; - - if (dest == null) - { + if(other is not provisionDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MeaningElement != null) dest.MeaningElement = (Code)MeaningElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_MeaningElement is not null) dest.MeaningElement = (Code)_MeaningElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1048,41 +1013,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionDataComponent; - if(otherT == null) return false; + if(other is not provisionDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MeaningElement, otherT.MeaningElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "meaning": - value = MeaningElement; - return MeaningElement is not null; + value = _MeaningElement; + return _MeaningElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "meaning": - MeaningElement = (Code)value; + MeaningElement = (Code?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1093,8 +1058,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MeaningElement is not null) yield return new KeyValuePair("meaning",MeaningElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_MeaningElement is not null) yield return new KeyValuePair("meaning",_MeaningElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -1107,11 +1072,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | proposed | active | rejected | inactive | entered-in-error. @@ -1121,13 +1086,13 @@ public List Identifier [Binding("ConsentState")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | proposed | active | rejected | inactive | entered-in-error @@ -1136,13 +1101,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentState? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1154,13 +1116,13 @@ public Hl7.Fhir.Model.Consent.ConsentState? Status [Binding("ConsentScope")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Classification of the consent statement - for indexing/retrieval. @@ -1171,11 +1133,11 @@ public Hl7.Fhir.Model.CodeableConcept Scope [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who the consent applies to. @@ -1184,41 +1146,38 @@ public List Category [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When this Consent was created or indexed. /// [FhirElement("dateTime", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateTimeElement + public Hl7.Fhir.Model.FhirDateTime? DateTimeElement { get { return _DateTimeElement; } set { _DateTimeElement = value; OnPropertyChanged("DateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _DateTimeElement; /// /// When this Consent was created or indexed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateTime + public string? DateTime { - get { return DateTimeElement != null ? DateTimeElement.Value : null; } + get => _DateTimeElement?.Value; set { - if (value == null) - DateTimeElement = null; - else - DateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateTime"); } } @@ -1233,11 +1192,11 @@ public string DateTime [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Custodian of the consent. @@ -1249,11 +1208,11 @@ public List Performer [DataMember] public List Organization { - get { if(_Organization==null) _Organization = new List(); return _Organization; } + get => _Organization ?? new List(); set { _Organization = value; OnPropertyChanged("Organization"); } } - private List _Organization; + private List? _Organization; /// /// Source from which this consent is taken. @@ -1263,13 +1222,13 @@ public List Organization [References("Consent","DocumentReference","Contract","QuestionnaireResponse")] [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// Policies covered by this consent. @@ -1279,11 +1238,11 @@ public Hl7.Fhir.Model.DataType Source [DataMember] public List Policy { - get { if(_Policy==null) _Policy = new List(); return _Policy; } + get => _Policy ?? new List(); set { _Policy = value; OnPropertyChanged("Policy"); } } - private List _Policy; + private List? _Policy; /// /// Regulation that this consents to. @@ -1291,13 +1250,13 @@ public List Policy [FhirElement("policyRule", InSummary=true, Order=190)] [Binding("ConsentPolicyRule")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PolicyRule + public Hl7.Fhir.Model.CodeableConcept? PolicyRule { get { return _PolicyRule; } set { _PolicyRule = value; OnPropertyChanged("PolicyRule"); } } - private Hl7.Fhir.Model.CodeableConcept _PolicyRule; + private Hl7.Fhir.Model.CodeableConcept? _PolicyRule; /// /// Consent Verified by patient or family. @@ -1307,53 +1266,49 @@ public Hl7.Fhir.Model.CodeableConcept PolicyRule [DataMember] public List Verification { - get { if(_Verification==null) _Verification = new List(); return _Verification; } + get => _Verification ?? new List(); set { _Verification = value; OnPropertyChanged("Verification"); } } - private List _Verification; + private List? _Verification; /// /// Constraints to the base Consent.policyRule. /// [FhirElement("provision", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Consent.provisionComponent Provision + public Hl7.Fhir.Model.Consent.provisionComponent? Provision { get { return _Provision; } set { _Provision = value; OnPropertyChanged("Provision"); } } - private Hl7.Fhir.Model.Consent.provisionComponent _Provision; + private Hl7.Fhir.Model.Consent.provisionComponent? _Provision; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category.ToCodings(); + IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Consent; - - if (dest == null) - { + if(other is not Consent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateTimeElement != null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Organization.Any()) dest.Organization = new List(Organization.DeepCopyInternal()); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(Policy.Any()) dest.Policy = new List(Policy.DeepCopyInternal()); - if(PolicyRule != null) dest.PolicyRule = (Hl7.Fhir.Model.CodeableConcept)PolicyRule.DeepCopyInternal(); - if(Verification.Any()) dest.Verification = new List(Verification.DeepCopyInternal()); - if(Provision != null) dest.Provision = (Hl7.Fhir.Model.Consent.provisionComponent)Provision.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateTimeElement is not null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_DateTimeElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Organization is not null) dest.Organization = new List(_Organization.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_Policy is not null) dest.Policy = new List(_Policy.DeepCopyInternal()); + if(_PolicyRule is not null) dest.PolicyRule = (Hl7.Fhir.Model.CodeableConcept)_PolicyRule.DeepCopyInternal(); + if(_Verification is not null) dest.Verification = new List(_Verification.DeepCopyInternal()); + if(_Provision is not null) dest.Provision = (Hl7.Fhir.Model.Consent.provisionComponent)_Provision.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1365,118 +1320,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Consent; - if(otherT == null) return false; + if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateTimeElement, otherT.DateTimeElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Policy, otherT.Policy)) return false; - if(!comparer.Equals(PolicyRule, otherT.PolicyRule)) return false; - if(!comparer.ListEquals(Verification, otherT.Verification)) return false; - if(!comparer.Equals(Provision, otherT.Provision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateTimeElement, otherT._DateTimeElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Policy, otherT._Policy)) return false; + if(!comparer.Equals(_PolicyRule, otherT._PolicyRule)) return false; + if(!comparer.ListEquals(_Verification, otherT._Verification)) return false; + if(!comparer.Equals(_Provision, otherT._Provision)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "dateTime": - value = DateTimeElement; - return DateTimeElement is not null; + value = _DateTimeElement; + return _DateTimeElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "organization": - value = Organization; - return Organization?.Any() == true; + value = _Organization; + return _Organization?.Any() == true; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "policy": - value = Policy; - return Policy?.Any() == true; + value = _Policy; + return _Policy?.Any() == true; case "policyRule": - value = PolicyRule; - return PolicyRule is not null; + value = _PolicyRule; + return _PolicyRule is not null; case "verification": - value = Verification; - return Verification?.Any() == true; + value = _Verification; + return _Verification?.Any() == true; case "provision": - value = Provision; - return Provision is not null; + value = _Provision; + return _Provision is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateTime": - DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "organization": - Organization = (List)value; + Organization = (List?)value!; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "policy": - Policy = (List)value; + Policy = (List?)value!; return this; case "policyRule": - PolicyRule = (Hl7.Fhir.Model.CodeableConcept)value; + PolicyRule = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verification": - Verification = (List)value; + Verification = (List?)value!; return this; case "provision": - Provision = (Hl7.Fhir.Model.Consent.provisionComponent)value; + Provision = (Hl7.Fhir.Model.Consent.provisionComponent?)value; return this; default: return base.SetValue(key, value); @@ -1487,19 +1442,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateTimeElement is not null) yield return new KeyValuePair("dateTime",DateTimeElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Organization?.Any() == true) yield return new KeyValuePair("organization",Organization); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Policy?.Any() == true) yield return new KeyValuePair("policy",Policy); - if (PolicyRule is not null) yield return new KeyValuePair("policyRule",PolicyRule); - if (Verification?.Any() == true) yield return new KeyValuePair("verification",Verification); - if (Provision is not null) yield return new KeyValuePair("provision",Provision); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateTimeElement is not null) yield return new KeyValuePair("dateTime",_DateTimeElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Organization?.Any() == true) yield return new KeyValuePair("organization",_Organization); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Policy?.Any() == true) yield return new KeyValuePair("policy",_Policy); + if (_PolicyRule is not null) yield return new KeyValuePair("policyRule",_PolicyRule); + if (_Verification?.Any() == true) yield return new KeyValuePair("verification",_Verification); + if (_Provision is not null) yield return new KeyValuePair("provision",_Provision); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs index 9e7a44182..0cb0d8fa1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -282,13 +285,13 @@ public partial class ContentDefinitionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ContractDefinitionType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Detailed Content Type Definition. @@ -296,13 +299,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=50)] [Binding("ContractDefinitionSubtype")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// Publisher Entity. @@ -311,41 +314,38 @@ public Hl7.Fhir.Model.CodeableConcept SubType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Publisher + public Hl7.Fhir.Model.ResourceReference? Publisher { get { return _Publisher; } set { _Publisher = value; OnPropertyChanged("Publisher"); } } - private Hl7.Fhir.Model.ResourceReference _Publisher; + private Hl7.Fhir.Model.ResourceReference? _Publisher; /// /// When published. /// [FhirElement("publicationDate", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PublicationDateElement + public Hl7.Fhir.Model.FhirDateTime? PublicationDateElement { get { return _PublicationDateElement; } set { _PublicationDateElement = value; OnPropertyChanged("PublicationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PublicationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PublicationDateElement; /// /// When published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDate + public string? PublicationDate { - get { return PublicationDateElement != null ? PublicationDateElement.Value : null; } + get => _PublicationDateElement?.Value; set { - if (value == null) - PublicationDateElement = null; - else - PublicationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PublicationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PublicationDate"); } } @@ -358,13 +358,13 @@ public string PublicationDate [Binding("ContractPublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PublicationStatusElement + public Code? PublicationStatusElement { get { return _PublicationStatusElement; } set { _PublicationStatusElement = value; OnPropertyChanged("PublicationStatusElement"); } } - private Code _PublicationStatusElement; + private Code? _PublicationStatusElement; /// /// amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated @@ -373,13 +373,10 @@ public Code Publ [IgnoreDataMember] public Hl7.Fhir.Model.Contract.ContractResourcePublicationStatusCodes? PublicationStatus { - get { return PublicationStatusElement != null ? PublicationStatusElement.Value : null; } + get => _PublicationStatusElement?.Value; set { - if (value == null) - PublicationStatusElement = null; - else - PublicationStatusElement = new Code(value); + PublicationStatusElement = value is null ? null : new Code(value); OnPropertyChanged("PublicationStatus"); } } @@ -389,48 +386,41 @@ public Hl7.Fhir.Model.Contract.ContractResourcePublicationStatusCodes? Publicati /// [FhirElement("copyright", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Publication Ownership /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContentDefinitionComponent; - - if (dest == null) - { + if(other is not ContentDefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(Publisher != null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)Publisher.DeepCopyInternal(); - if(PublicationDateElement != null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)PublicationDateElement.DeepCopyInternal(); - if(PublicationStatusElement != null) dest.PublicationStatusElement = (Code)PublicationStatusElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_Publisher is not null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)_Publisher.DeepCopyInternal(); + if(_PublicationDateElement is not null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)_PublicationDateElement.DeepCopyInternal(); + if(_PublicationStatusElement is not null) dest.PublicationStatusElement = (Code)_PublicationStatusElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -442,69 +432,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentDefinitionComponent; - if(otherT == null) return false; + if(other is not ContentDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(Publisher, otherT.Publisher)) return false; - if(!comparer.Equals(PublicationDateElement, otherT.PublicationDateElement)) return false; - if(!comparer.Equals(PublicationStatusElement, otherT.PublicationStatusElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; + if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; + if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "publisher": - value = Publisher; - return Publisher is not null; + value = _Publisher; + return _Publisher is not null; case "publicationDate": - value = PublicationDateElement; - return PublicationDateElement is not null; + value = _PublicationDateElement; + return _PublicationDateElement is not null; case "publicationStatus": - value = PublicationStatusElement; - return PublicationStatusElement is not null; + value = _PublicationStatusElement; + return _PublicationStatusElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "publisher": - Publisher = (Hl7.Fhir.Model.ResourceReference)value; + Publisher = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "publicationDate": - PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publicationStatus": - PublicationStatusElement = (Code)value; + PublicationStatusElement = (Code?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -515,12 +505,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (Publisher is not null) yield return new KeyValuePair("publisher",Publisher); - if (PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",PublicationDateElement); - if (PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",PublicationStatusElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_Publisher is not null) yield return new KeyValuePair("publisher",_Publisher); + if (_PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",_PublicationDateElement); + if (_PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",_PublicationStatusElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -546,41 +536,38 @@ public partial class TermComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Term Issue Date Time. /// [FhirElement("issued", InSummary=true, Order=50, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// Contract Term Issue Date Time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -590,13 +577,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=60, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Term Concern. @@ -606,13 +593,13 @@ public Hl7.Fhir.Model.Period Applies [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Topic + public Hl7.Fhir.Model.DataType? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.DataType _Topic; + private Hl7.Fhir.Model.DataType? _Topic; /// /// Contract Term Type or Form. @@ -620,13 +607,13 @@ public Hl7.Fhir.Model.DataType Topic [FhirElement("type", Order=80, FiveWs="FiveWs.what[x]")] [Binding("ContractTermType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Contract Term Type specific classification. @@ -634,41 +621,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=90, FiveWs="FiveWs.what[x]")] [Binding("ContractTermSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// Term Statement. /// [FhirElement("text", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Term Statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -681,11 +665,11 @@ public string Text [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of the Contract term. @@ -693,13 +677,13 @@ public List SecurityLabel [FhirElement("offer", Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Contract.ContractOfferComponent Offer + public Hl7.Fhir.Model.Contract.ContractOfferComponent? Offer { get { return _Offer; } set { _Offer = value; OnPropertyChanged("Offer"); } } - private Hl7.Fhir.Model.Contract.ContractOfferComponent _Offer; + private Hl7.Fhir.Model.Contract.ContractOfferComponent? _Offer; /// /// Contract Term Asset List. @@ -709,11 +693,11 @@ public Hl7.Fhir.Model.Contract.ContractOfferComponent Offer [DataMember] public List Asset { - get { if(_Asset==null) _Asset = new List(); return _Asset; } + get => _Asset ?? new List(); set { _Asset = value; OnPropertyChanged("Asset"); } } - private List _Asset; + private List? _Asset; /// /// Entity being ascribed responsibility. @@ -723,11 +707,11 @@ public List Asset [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Nested Contract Term Group. @@ -737,34 +721,30 @@ public List Action [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; protected internal override void CopyToInternal(Base other) { - var dest = other as TermComponent; - - if (dest == null) - { + if(other is not TermComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.DataType)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Offer != null) dest.Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)Offer.DeepCopyInternal(); - if(Asset.Any()) dest.Asset = new List(Asset.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.DataType)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Offer is not null) dest.Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)_Offer.DeepCopyInternal(); + if(_Asset is not null) dest.Asset = new List(_Asset.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -776,111 +756,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TermComponent; - if(otherT == null) return false; + if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.Equals(Offer, otherT.Offer)) return false; - if(!comparer.ListEquals(Asset, otherT.Asset)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.Equals(_Offer, otherT._Offer)) return false; + if(!comparer.ListEquals(_Asset, otherT._Asset)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "offer": - value = Offer; - return Offer is not null; + value = _Offer; + return _Offer is not null; case "asset": - value = Asset; - return Asset?.Any() == true; + value = _Asset; + return _Asset?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.DataType)value; + Topic = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "offer": - Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)value; + Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent?)value; return this; case "asset": - Asset = (List)value; + Asset = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -891,18 +871,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Offer is not null) yield return new KeyValuePair("offer",Offer); - if (Asset?.Any() == true) yield return new KeyValuePair("asset",Asset); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Offer is not null) yield return new KeyValuePair("offer",_Offer); + if (_Asset?.Any() == true) yield return new KeyValuePair("asset",_Asset); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } @@ -931,24 +911,24 @@ public partial class SecurityLabelComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List NumberElement { - get { if(_NumberElement==null) _NumberElement = new List(); return _NumberElement; } + get => _NumberElement ?? new List(); set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private List _NumberElement; + private List? _NumberElement; /// /// Link to Security Labels /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Number + public IEnumerable? Number { - get { return NumberElement != null ? NumberElement.Select(elem => elem.Value) : null; } + get => _NumberElement?.Select(elem => elem.Value); set { if (value == null) - NumberElement = null; + NumberElement = null!; else NumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("Number"); @@ -962,13 +942,13 @@ public IEnumerable Number [Binding("ContractSecurityClassification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Classification + public Hl7.Fhir.Model.Coding? Classification { get { return _Classification; } set { _Classification = value; OnPropertyChanged("Classification"); } } - private Hl7.Fhir.Model.Coding _Classification; + private Hl7.Fhir.Model.Coding? _Classification; /// /// Applicable Policy. @@ -979,11 +959,11 @@ public Hl7.Fhir.Model.Coding Classification [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Handling Instructions. @@ -994,26 +974,22 @@ public List Category [DataMember] public List Control { - get { if(_Control==null) _Control = new List(); return _Control; } + get => _Control ?? new List(); set { _Control = value; OnPropertyChanged("Control"); } } - private List _Control; + private List? _Control; protected internal override void CopyToInternal(Base other) { - var dest = other as SecurityLabelComponent; - - if (dest == null) - { + if(other is not SecurityLabelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement.Any()) dest.NumberElement = new List(NumberElement.DeepCopyInternal()); - if(Classification != null) dest.Classification = (Hl7.Fhir.Model.Coding)Classification.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Control.Any()) dest.Control = new List(Control.DeepCopyInternal()); + if(_NumberElement is not null) dest.NumberElement = new List(_NumberElement.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = (Hl7.Fhir.Model.Coding)_Classification.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Control is not null) dest.Control = new List(_Control.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1025,55 +1001,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SecurityLabelComponent; - if(otherT == null) return false; + if(other is not SecurityLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Control, otherT.Control)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Control, otherT._Control)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement?.Any() == true; + value = _NumberElement; + return _NumberElement?.Any() == true; case "classification": - value = Classification; - return Classification is not null; + value = _Classification; + return _Classification is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "control": - value = Control; - return Control?.Any() == true; + value = _Control; + return _Control?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (List)value; + NumberElement = (List?)value!; return this; case "classification": - Classification = (Hl7.Fhir.Model.Coding)value; + Classification = (Hl7.Fhir.Model.Coding?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "control": - Control = (List)value; + Control = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1084,10 +1060,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement?.Any() == true) yield return new KeyValuePair("number",NumberElement); - if (Classification is not null) yield return new KeyValuePair("classification",Classification); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Control?.Any() == true) yield return new KeyValuePair("control",Control); + if (_NumberElement?.Any() == true) yield return new KeyValuePair("number",_NumberElement); + if (_Classification is not null) yield return new KeyValuePair("classification",_Classification); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Control?.Any() == true) yield return new KeyValuePair("control",_Control); } } @@ -1116,11 +1092,11 @@ public partial class ContractOfferComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Offer Recipient. @@ -1130,11 +1106,11 @@ public List Identifier [DataMember] public List Party { - get { if(_Party==null) _Party = new List(); return _Party; } + get => _Party ?? new List(); set { _Party = value; OnPropertyChanged("Party"); } } - private List _Party; + private List? _Party; /// /// Negotiable offer asset. @@ -1143,13 +1119,13 @@ public List Party [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Topic + public Hl7.Fhir.Model.ResourceReference? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.ResourceReference _Topic; + private Hl7.Fhir.Model.ResourceReference? _Topic; /// /// Contract Offer Type or Form. @@ -1157,13 +1133,13 @@ public Hl7.Fhir.Model.ResourceReference Topic [FhirElement("type", Order=70, FiveWs="FiveWs.what[x]")] [Binding("ContractTermType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Accepting party choice. @@ -1171,13 +1147,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("decision", Order=80, FiveWs="FiveWs.what[x]")] [Binding("ContractDecisionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Decision + public Hl7.Fhir.Model.CodeableConcept? Decision { get { return _Decision; } set { _Decision = value; OnPropertyChanged("Decision"); } } - private Hl7.Fhir.Model.CodeableConcept _Decision; + private Hl7.Fhir.Model.CodeableConcept? _Decision; /// /// How decision is conveyed. @@ -1188,11 +1164,11 @@ public Hl7.Fhir.Model.CodeableConcept Decision [DataMember] public List DecisionMode { - get { if(_DecisionMode==null) _DecisionMode = new List(); return _DecisionMode; } + get => _DecisionMode ?? new List(); set { _DecisionMode = value; OnPropertyChanged("DecisionMode"); } } - private List _DecisionMode; + private List? _DecisionMode; /// /// Response to offer text. @@ -1202,39 +1178,36 @@ public List DecisionMode [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Human readable offer text. /// [FhirElement("text", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Human readable offer text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -1247,24 +1220,24 @@ public string Text [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -1279,24 +1252,24 @@ public IEnumerable LinkId [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Offer restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -1305,24 +1278,20 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ContractOfferComponent; - - if (dest == null) - { + if(other is not ContractOfferComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Party.Any()) dest.Party = new List(Party.DeepCopyInternal()); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.ResourceReference)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Decision != null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)Decision.DeepCopyInternal(); - if(DecisionMode.Any()) dest.DecisionMode = new List(DecisionMode.DeepCopyInternal()); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Party is not null) dest.Party = new List(_Party.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.ResourceReference)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Decision is not null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)_Decision.DeepCopyInternal(); + if(_DecisionMode is not null) dest.DecisionMode = new List(_DecisionMode.DeepCopyInternal()); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1334,97 +1303,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractOfferComponent; - if(otherT == null) return false; + if(other is not ContractOfferComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Party, otherT.Party)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Decision, otherT.Decision)) return false; - if(!comparer.ListEquals(DecisionMode, otherT.DecisionMode)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Decision, otherT._Decision)) return false; + if(!comparer.ListEquals(_DecisionMode, otherT._DecisionMode)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "party": - value = Party; - return Party?.Any() == true; + value = _Party; + return _Party?.Any() == true; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "decision": - value = Decision; - return Decision is not null; + value = _Decision; + return _Decision is not null; case "decisionMode": - value = DecisionMode; - return DecisionMode?.Any() == true; + value = _DecisionMode; + return _DecisionMode?.Any() == true; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "party": - Party = (List)value; + Party = (List?)value!; return this; case "topic": - Topic = (Hl7.Fhir.Model.ResourceReference)value; + Topic = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "decision": - Decision = (Hl7.Fhir.Model.CodeableConcept)value; + Decision = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "decisionMode": - DecisionMode = (List)value; + DecisionMode = (List?)value!; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1435,16 +1404,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Party?.Any() == true) yield return new KeyValuePair("party",Party); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Decision is not null) yield return new KeyValuePair("decision",Decision); - if (DecisionMode?.Any() == true) yield return new KeyValuePair("decisionMode",DecisionMode); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Party?.Any() == true) yield return new KeyValuePair("party",_Party); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Decision is not null) yield return new KeyValuePair("decision",_Decision); + if (_DecisionMode?.Any() == true) yield return new KeyValuePair("decisionMode",_DecisionMode); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -1472,11 +1441,11 @@ public partial class ContractPartyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; /// /// Participant engagement type. @@ -1485,26 +1454,22 @@ public List Reference [Binding("ContractPartyRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ContractPartyComponent; - - if (dest == null) - { + if(other is not ContractPartyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1516,41 +1481,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractPartyComponent; - if(otherT == null) return false; + if(other is not ContractPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1561,8 +1526,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -1589,25 +1554,21 @@ public partial class AnswerComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerComponent; - - if (dest == null) - { + if(other is not AnswerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1619,34 +1580,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerComponent; - if(otherT == null) return false; + if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1657,7 +1618,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1681,13 +1642,13 @@ public partial class ContractAssetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("scope", Order=40)] [Binding("ContractAssetScope")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Asset category. @@ -1698,11 +1659,11 @@ public Hl7.Fhir.Model.CodeableConcept Scope [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Associated entities. @@ -1714,11 +1675,11 @@ public List Type [DataMember] public List TypeReference { - get { if(_TypeReference==null) _TypeReference = new List(); return _TypeReference; } + get => _TypeReference ?? new List(); set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } - private List _TypeReference; + private List? _TypeReference; /// /// Asset sub-category. @@ -1729,11 +1690,11 @@ public List TypeReference [DataMember] public List Subtype { - get { if(_Subtype==null) _Subtype = new List(); return _Subtype; } + get => _Subtype ?? new List(); set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private List _Subtype; + private List? _Subtype; /// /// Kinship of the asset. @@ -1741,13 +1702,13 @@ public List Subtype [FhirElement("relationship", Order=80)] [Binding("ConsentContentClass")] [DataMember] - public Hl7.Fhir.Model.Coding Relationship + public Hl7.Fhir.Model.Coding? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.Coding _Relationship; + private Hl7.Fhir.Model.Coding? _Relationship; /// /// Circumstance of the asset. @@ -1757,39 +1718,36 @@ public Hl7.Fhir.Model.Coding Relationship [DataMember] public List Context { - get { if(_Context==null) _Context = new List(); return _Context; } + get => _Context ?? new List(); set { _Context = value; OnPropertyChanged("Context"); } } - private List _Context; + private List? _Context; /// /// Quality desctiption of asset. /// [FhirElement("condition", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// Quality desctiption of asset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -1803,11 +1761,11 @@ public string Condition [DataMember] public List PeriodType { - get { if(_PeriodType==null) _PeriodType = new List(); return _PeriodType; } + get => _PeriodType ?? new List(); set { _PeriodType = value; OnPropertyChanged("PeriodType"); } } - private List _PeriodType; + private List? _PeriodType; /// /// Time period of the asset. @@ -1817,11 +1775,11 @@ public List PeriodType [DataMember] public List Period { - get { if(_Period==null) _Period = new List(); return _Period; } + get => _Period ?? new List(); set { _Period = value; OnPropertyChanged("Period"); } } - private List _Period; + private List? _Period; /// /// Time period. @@ -1831,39 +1789,36 @@ public List Period [DataMember] public List UsePeriod { - get { if(_UsePeriod==null) _UsePeriod = new List(); return _UsePeriod; } + get => _UsePeriod ?? new List(); set { _UsePeriod = value; OnPropertyChanged("UsePeriod"); } } - private List _UsePeriod; + private List? _UsePeriod; /// /// Asset clause or question text. /// [FhirElement("text", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Asset clause or question text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -1876,24 +1831,24 @@ public string Text [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to asset text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -1908,11 +1863,11 @@ public IEnumerable LinkId [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Asset restriction numbers. @@ -1922,24 +1877,24 @@ public List Answer [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Asset restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -1954,37 +1909,33 @@ public IEnumerable SecurityLabelNumber [DataMember] public List ValuedItem { - get { if(_ValuedItem==null) _ValuedItem = new List(); return _ValuedItem; } + get => _ValuedItem ?? new List(); set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } - private List _ValuedItem; + private List? _ValuedItem; protected internal override void CopyToInternal(Base other) { - var dest = other as ContractAssetComponent; - - if (dest == null) - { + if(other is not ContractAssetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(TypeReference.Any()) dest.TypeReference = new List(TypeReference.DeepCopyInternal()); - if(Subtype.Any()) dest.Subtype = new List(Subtype.DeepCopyInternal()); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.Coding)Relationship.DeepCopyInternal(); - if(Context.Any()) dest.Context = new List(Context.DeepCopyInternal()); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(PeriodType.Any()) dest.PeriodType = new List(PeriodType.DeepCopyInternal()); - if(Period.Any()) dest.Period = new List(Period.DeepCopyInternal()); - if(UsePeriod.Any()) dest.UsePeriod = new List(UsePeriod.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); - if(ValuedItem.Any()) dest.ValuedItem = new List(ValuedItem.DeepCopyInternal()); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_TypeReference is not null) dest.TypeReference = new List(_TypeReference.DeepCopyInternal()); + if(_Subtype is not null) dest.Subtype = new List(_Subtype.DeepCopyInternal()); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.Coding)_Relationship.DeepCopyInternal(); + if(_Context is not null) dest.Context = new List(_Context.DeepCopyInternal()); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_PeriodType is not null) dest.PeriodType = new List(_PeriodType.DeepCopyInternal()); + if(_Period is not null) dest.Period = new List(_Period.DeepCopyInternal()); + if(_UsePeriod is not null) dest.UsePeriod = new List(_UsePeriod.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); + if(_ValuedItem is not null) dest.ValuedItem = new List(_ValuedItem.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1996,132 +1947,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractAssetComponent; - if(otherT == null) return false; + if(other is not ContractAssetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(TypeReference, otherT.TypeReference)) return false; - if(!comparer.ListEquals(Subtype, otherT.Subtype)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.ListEquals(Context, otherT.Context)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.ListEquals(PeriodType, otherT.PeriodType)) return false; - if(!comparer.ListEquals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(UsePeriod, otherT.UsePeriod)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; - if(!comparer.ListEquals(ValuedItem, otherT.ValuedItem)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_TypeReference, otherT._TypeReference)) return false; + if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.ListEquals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.ListEquals(_PeriodType, otherT._PeriodType)) return false; + if(!comparer.ListEquals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_UsePeriod, otherT._UsePeriod)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; + if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "typeReference": - value = TypeReference; - return TypeReference?.Any() == true; + value = _TypeReference; + return _TypeReference?.Any() == true; case "subtype": - value = Subtype; - return Subtype?.Any() == true; + value = _Subtype; + return _Subtype?.Any() == true; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "context": - value = Context; - return Context?.Any() == true; + value = _Context; + return _Context?.Any() == true; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "periodType": - value = PeriodType; - return PeriodType?.Any() == true; + value = _PeriodType; + return _PeriodType?.Any() == true; case "period": - value = Period; - return Period?.Any() == true; + value = _Period; + return _Period?.Any() == true; case "usePeriod": - value = UsePeriod; - return UsePeriod?.Any() == true; + value = _UsePeriod; + return _UsePeriod?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; case "valuedItem": - value = ValuedItem; - return ValuedItem?.Any() == true; + value = _ValuedItem; + return _ValuedItem?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "typeReference": - TypeReference = (List)value; + TypeReference = (List?)value!; return this; case "subtype": - Subtype = (List)value; + Subtype = (List?)value!; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.Coding)value; + Relationship = (Hl7.Fhir.Model.Coding?)value; return this; case "context": - Context = (List)value; + Context = (List?)value!; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "periodType": - PeriodType = (List)value; + PeriodType = (List?)value!; return this; case "period": - Period = (List)value; + Period = (List?)value!; return this; case "usePeriod": - UsePeriod = (List)value; + UsePeriod = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; case "valuedItem": - ValuedItem = (List)value; + ValuedItem = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2132,21 +2083,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (TypeReference?.Any() == true) yield return new KeyValuePair("typeReference",TypeReference); - if (Subtype?.Any() == true) yield return new KeyValuePair("subtype",Subtype); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Context?.Any() == true) yield return new KeyValuePair("context",Context); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (PeriodType?.Any() == true) yield return new KeyValuePair("periodType",PeriodType); - if (Period?.Any() == true) yield return new KeyValuePair("period",Period); - if (UsePeriod?.Any() == true) yield return new KeyValuePair("usePeriod",UsePeriod); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); - if (ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",ValuedItem); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_TypeReference?.Any() == true) yield return new KeyValuePair("typeReference",_TypeReference); + if (_Subtype?.Any() == true) yield return new KeyValuePair("subtype",_Subtype); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Context?.Any() == true) yield return new KeyValuePair("context",_Context); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_PeriodType?.Any() == true) yield return new KeyValuePair("periodType",_PeriodType); + if (_Period?.Any() == true) yield return new KeyValuePair("period",_Period); + if (_UsePeriod?.Any() == true) yield return new KeyValuePair("usePeriod",_UsePeriod); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); + if (_ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",_ValuedItem); } } @@ -2171,13 +2122,13 @@ public partial class AssetContextComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Codeable asset context. @@ -2188,56 +2139,49 @@ public Hl7.Fhir.Model.ResourceReference Reference [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Context description. /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Context description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssetContextComponent; - - if (dest == null) - { + if(other is not AssetContextComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2249,48 +2193,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssetContextComponent; - if(otherT == null) return false; + if(other is not AssetContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2301,9 +2245,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -2329,54 +2273,51 @@ public partial class ValuedItemComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Entity + public Hl7.Fhir.Model.DataType? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.DataType _Entity; + private Hl7.Fhir.Model.DataType? _Entity; /// /// Contract Valued Item Number. /// [FhirElement("identifier", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Valued Item Effective Tiem. /// [FhirElement("effectiveTime", Order=60, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EffectiveTimeElement + public Hl7.Fhir.Model.FhirDateTime? EffectiveTimeElement { get { return _EffectiveTimeElement; } set { _EffectiveTimeElement = value; OnPropertyChanged("EffectiveTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EffectiveTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _EffectiveTimeElement; /// /// Contract Valued Item Effective Tiem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EffectiveTime + public string? EffectiveTime { - get { return EffectiveTimeElement != null ? EffectiveTimeElement.Value : null; } + get => _EffectiveTimeElement?.Value; set { - if (value == null) - EffectiveTimeElement = null; - else - EffectiveTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + EffectiveTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EffectiveTime"); } } @@ -2386,39 +2327,39 @@ public string EffectiveTime /// [FhirElement("quantity", Order=70, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Contract Valued Item fee, charge, or cost. /// [FhirElement("unitPrice", Order=80, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Contract Valued Item Price Scaling Factor. /// [FhirElement("factor", Order=90, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Contract Valued Item Price Scaling Factor @@ -2427,13 +2368,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2443,13 +2381,13 @@ public decimal? Factor /// [FhirElement("points", Order=100, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PointsElement + public Hl7.Fhir.Model.FhirDecimal? PointsElement { get { return _PointsElement; } set { _PointsElement = value; OnPropertyChanged("PointsElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PointsElement; + private Hl7.Fhir.Model.FhirDecimal? _PointsElement; /// /// Contract Valued Item Difficulty Scaling Factor @@ -2458,13 +2396,10 @@ public Hl7.Fhir.Model.FhirDecimal PointsElement [IgnoreDataMember] public decimal? Points { - get { return PointsElement != null ? PointsElement.Value : null; } + get => _PointsElement?.Value; set { - if (value == null) - PointsElement = null; - else - PointsElement = new Hl7.Fhir.Model.FhirDecimal(value); + PointsElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Points"); } } @@ -2474,41 +2409,38 @@ public decimal? Points /// [FhirElement("net", Order=110, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Terms of valuation. /// [FhirElement("payment", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString PaymentElement + public Hl7.Fhir.Model.FhirString? PaymentElement { get { return _PaymentElement; } set { _PaymentElement = value; OnPropertyChanged("PaymentElement"); } } - private Hl7.Fhir.Model.FhirString _PaymentElement; + private Hl7.Fhir.Model.FhirString? _PaymentElement; /// /// Terms of valuation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Payment + public string? Payment { - get { return PaymentElement != null ? PaymentElement.Value : null; } + get => _PaymentElement?.Value; set { - if (value == null) - PaymentElement = null; - else - PaymentElement = new Hl7.Fhir.Model.FhirString(value); + PaymentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Payment"); } } @@ -2518,28 +2450,25 @@ public string Payment /// [FhirElement("paymentDate", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PaymentDateElement + public Hl7.Fhir.Model.FhirDateTime? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PaymentDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PaymentDateElement; /// /// When payment is due /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PaymentDate"); } } @@ -2551,13 +2480,13 @@ public string PaymentDate [CLSCompliant(false)] [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Who will receive payment. @@ -2566,13 +2495,13 @@ public Hl7.Fhir.Model.ResourceReference Responsible [CLSCompliant(false)] [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Pointer to specific item. @@ -2582,24 +2511,24 @@ public Hl7.Fhir.Model.ResourceReference Recipient [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -2614,24 +2543,24 @@ public IEnumerable LinkId [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Security Labels that define affected terms /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -2640,28 +2569,24 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ValuedItemComponent; - - if (dest == null) - { + if(other is not ValuedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.DataType)Entity.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(EffectiveTimeElement != null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)EffectiveTimeElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(PointsElement != null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)PointsElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(PaymentElement != null) dest.PaymentElement = (Hl7.Fhir.Model.FhirString)PaymentElement.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)PaymentDateElement.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.DataType)_Entity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_EffectiveTimeElement is not null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)_EffectiveTimeElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_PointsElement is not null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)_PointsElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_PaymentElement is not null) dest.PaymentElement = (Hl7.Fhir.Model.FhirString)_PaymentElement.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)_PaymentDateElement.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2673,125 +2598,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValuedItemComponent; - if(otherT == null) return false; + if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(EffectiveTimeElement, otherT.EffectiveTimeElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(PointsElement, otherT.PointsElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.Equals(PaymentElement, otherT.PaymentElement)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_PointsElement, otherT._PointsElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.Equals(_PaymentElement, otherT._PaymentElement)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "effectiveTime": - value = EffectiveTimeElement; - return EffectiveTimeElement is not null; + value = _EffectiveTimeElement; + return _EffectiveTimeElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "points": - value = PointsElement; - return PointsElement is not null; + value = _PointsElement; + return _PointsElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "payment": - value = PaymentElement; - return PaymentElement is not null; + value = _PaymentElement; + return _PaymentElement is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.DataType)value; + Entity = (Hl7.Fhir.Model.DataType?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "effectiveTime": - EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "points": - PointsElement = (Hl7.Fhir.Model.FhirDecimal)value; + PointsElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "payment": - PaymentElement = (Hl7.Fhir.Model.FhirString)value; + PaymentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2802,20 +2727,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",EffectiveTimeElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (PointsElement is not null) yield return new KeyValuePair("points",PointsElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (PaymentElement is not null) yield return new KeyValuePair("payment",PaymentElement); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",_EffectiveTimeElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_PointsElement is not null) yield return new KeyValuePair("points",_PointsElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_PaymentElement is not null) yield return new KeyValuePair("payment",_PaymentElement); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -2843,13 +2768,13 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("doNotPerform", IsModifier=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if the term prohibits the action @@ -2858,13 +2783,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -2876,13 +2798,13 @@ public bool? DoNotPerform [Binding("ContractAction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Entity of the action. @@ -2892,11 +2814,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Purpose for the Contract Term Action. @@ -2905,13 +2827,13 @@ public List Subject [Binding("ContractActionReason")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Intent + public Hl7.Fhir.Model.CodeableConcept? Intent { get { return _Intent; } set { _Intent = value; OnPropertyChanged("Intent"); } } - private Hl7.Fhir.Model.CodeableConcept _Intent; + private Hl7.Fhir.Model.CodeableConcept? _Intent; /// /// Pointer to specific item. @@ -2921,24 +2843,24 @@ public Hl7.Fhir.Model.CodeableConcept Intent [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -2952,13 +2874,13 @@ public IEnumerable LinkId [Binding("ContractActionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Episode associated with action. @@ -2967,13 +2889,13 @@ public Hl7.Fhir.Model.CodeableConcept Status [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Pointer to specific item. @@ -2983,24 +2905,24 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List ContextLinkIdElement { - get { if(_ContextLinkIdElement==null) _ContextLinkIdElement = new List(); return _ContextLinkIdElement; } + get => _ContextLinkIdElement ?? new List(); set { _ContextLinkIdElement = value; OnPropertyChanged("ContextLinkIdElement"); } } - private List _ContextLinkIdElement; + private List? _ContextLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ContextLinkId + public IEnumerable? ContextLinkId { - get { return ContextLinkIdElement != null ? ContextLinkIdElement.Select(elem => elem.Value) : null; } + get => _ContextLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ContextLinkIdElement = null; + ContextLinkIdElement = null!; else ContextLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ContextLinkId"); @@ -3014,13 +2936,13 @@ public IEnumerable ContextLinkId [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Who asked for action. @@ -3032,11 +2954,11 @@ public Hl7.Fhir.Model.DataType Occurrence [DataMember] public List Requester { - get { if(_Requester==null) _Requester = new List(); return _Requester; } + get => _Requester ?? new List(); set { _Requester = value; OnPropertyChanged("Requester"); } } - private List _Requester; + private List? _Requester; /// /// Pointer to specific item. @@ -3046,24 +2968,24 @@ public List Requester [DataMember] public List RequesterLinkIdElement { - get { if(_RequesterLinkIdElement==null) _RequesterLinkIdElement = new List(); return _RequesterLinkIdElement; } + get => _RequesterLinkIdElement ?? new List(); set { _RequesterLinkIdElement = value; OnPropertyChanged("RequesterLinkIdElement"); } } - private List _RequesterLinkIdElement; + private List? _RequesterLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable RequesterLinkId + public IEnumerable? RequesterLinkId { - get { return RequesterLinkIdElement != null ? RequesterLinkIdElement.Select(elem => elem.Value) : null; } + get => _RequesterLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - RequesterLinkIdElement = null; + RequesterLinkIdElement = null!; else RequesterLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("RequesterLinkId"); @@ -3079,11 +3001,11 @@ public IEnumerable RequesterLinkId [DataMember] public List PerformerType { - get { if(_PerformerType==null) _PerformerType = new List(); return _PerformerType; } + get => _PerformerType ?? new List(); set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private List _PerformerType; + private List? _PerformerType; /// /// Competency of the performer. @@ -3091,13 +3013,13 @@ public List PerformerType [FhirElement("performerRole", Order=160)] [Binding("ContractActionPerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerRole + public Hl7.Fhir.Model.CodeableConcept? PerformerRole { get { return _PerformerRole; } set { _PerformerRole = value; OnPropertyChanged("PerformerRole"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerRole; + private Hl7.Fhir.Model.CodeableConcept? _PerformerRole; /// /// Actor that wil execute (or not) the action. @@ -3106,13 +3028,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerRole [CLSCompliant(false)] [References("RelatedPerson","Patient","Practitioner","PractitionerRole","CareTeam","Device","Substance","Organization","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Pointer to specific item. @@ -3122,24 +3044,24 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List PerformerLinkIdElement { - get { if(_PerformerLinkIdElement==null) _PerformerLinkIdElement = new List(); return _PerformerLinkIdElement; } + get => _PerformerLinkIdElement ?? new List(); set { _PerformerLinkIdElement = value; OnPropertyChanged("PerformerLinkIdElement"); } } - private List _PerformerLinkIdElement; + private List? _PerformerLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PerformerLinkId + public IEnumerable? PerformerLinkId { - get { return PerformerLinkIdElement != null ? PerformerLinkIdElement.Select(elem => elem.Value) : null; } + get => _PerformerLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - PerformerLinkIdElement = null; + PerformerLinkIdElement = null!; else PerformerLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PerformerLinkId"); @@ -3155,11 +3077,11 @@ public IEnumerable PerformerLinkId [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why is action (not) needed?. @@ -3171,11 +3093,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Why action is to be performed. @@ -3185,24 +3107,24 @@ public List ReasonReference [DataMember] public List ReasonElement { - get { if(_ReasonElement==null) _ReasonElement = new List(); return _ReasonElement; } + get => _ReasonElement ?? new List(); set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private List _ReasonElement; + private List? _ReasonElement; /// /// Why action is to be performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Reason + public IEnumerable? Reason { - get { return ReasonElement != null ? ReasonElement.Select(elem => elem.Value) : null; } + get => _ReasonElement?.Select(elem => elem.Value); set { if (value == null) - ReasonElement = null; + ReasonElement = null!; else ReasonElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Reason"); @@ -3217,24 +3139,24 @@ public IEnumerable Reason [DataMember] public List ReasonLinkIdElement { - get { if(_ReasonLinkIdElement==null) _ReasonLinkIdElement = new List(); return _ReasonLinkIdElement; } + get => _ReasonLinkIdElement ?? new List(); set { _ReasonLinkIdElement = value; OnPropertyChanged("ReasonLinkIdElement"); } } - private List _ReasonLinkIdElement; + private List? _ReasonLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ReasonLinkId + public IEnumerable? ReasonLinkId { - get { return ReasonLinkIdElement != null ? ReasonLinkIdElement.Select(elem => elem.Value) : null; } + get => _ReasonLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ReasonLinkIdElement = null; + ReasonLinkIdElement = null!; else ReasonLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ReasonLinkId"); @@ -3249,11 +3171,11 @@ public IEnumerable ReasonLinkId [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Action restriction numbers. @@ -3263,24 +3185,24 @@ public List Note [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Action restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -3289,35 +3211,31 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Intent != null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)Intent.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(ContextLinkIdElement.Any()) dest.ContextLinkIdElement = new List(ContextLinkIdElement.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Requester.Any()) dest.Requester = new List(Requester.DeepCopyInternal()); - if(RequesterLinkIdElement.Any()) dest.RequesterLinkIdElement = new List(RequesterLinkIdElement.DeepCopyInternal()); - if(PerformerType.Any()) dest.PerformerType = new List(PerformerType.DeepCopyInternal()); - if(PerformerRole != null) dest.PerformerRole = (Hl7.Fhir.Model.CodeableConcept)PerformerRole.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(PerformerLinkIdElement.Any()) dest.PerformerLinkIdElement = new List(PerformerLinkIdElement.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(ReasonElement.Any()) dest.ReasonElement = new List(ReasonElement.DeepCopyInternal()); - if(ReasonLinkIdElement.Any()) dest.ReasonLinkIdElement = new List(ReasonLinkIdElement.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Intent is not null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)_Intent.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_ContextLinkIdElement is not null) dest.ContextLinkIdElement = new List(_ContextLinkIdElement.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = new List(_Requester.DeepCopyInternal()); + if(_RequesterLinkIdElement is not null) dest.RequesterLinkIdElement = new List(_RequesterLinkIdElement.DeepCopyInternal()); + if(_PerformerType is not null) dest.PerformerType = new List(_PerformerType.DeepCopyInternal()); + if(_PerformerRole is not null) dest.PerformerRole = (Hl7.Fhir.Model.CodeableConcept)_PerformerRole.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_PerformerLinkIdElement is not null) dest.PerformerLinkIdElement = new List(_PerformerLinkIdElement.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_ReasonElement is not null) dest.ReasonElement = new List(_ReasonElement.DeepCopyInternal()); + if(_ReasonLinkIdElement is not null) dest.ReasonLinkIdElement = new List(_ReasonLinkIdElement.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3329,174 +3247,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Intent, otherT.Intent)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(ContextLinkIdElement, otherT.ContextLinkIdElement)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.ListEquals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(RequesterLinkIdElement, otherT.RequesterLinkIdElement)) return false; - if(!comparer.ListEquals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(PerformerRole, otherT.PerformerRole)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(PerformerLinkIdElement, otherT.PerformerLinkIdElement)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(ReasonElement, otherT.ReasonElement)) return false; - if(!comparer.ListEquals(ReasonLinkIdElement, otherT.ReasonLinkIdElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Intent, otherT._Intent)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_ContextLinkIdElement, otherT._ContextLinkIdElement)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.ListEquals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_RequesterLinkIdElement, otherT._RequesterLinkIdElement)) return false; + if(!comparer.ListEquals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_PerformerRole, otherT._PerformerRole)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_PerformerLinkIdElement, otherT._PerformerLinkIdElement)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_ReasonElement, otherT._ReasonElement)) return false; + if(!comparer.ListEquals(_ReasonLinkIdElement, otherT._ReasonLinkIdElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "intent": - value = Intent; - return Intent is not null; + value = _Intent; + return _Intent is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "contextLinkId": - value = ContextLinkIdElement; - return ContextLinkIdElement?.Any() == true; + value = _ContextLinkIdElement; + return _ContextLinkIdElement?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "requester": - value = Requester; - return Requester?.Any() == true; + value = _Requester; + return _Requester?.Any() == true; case "requesterLinkId": - value = RequesterLinkIdElement; - return RequesterLinkIdElement?.Any() == true; + value = _RequesterLinkIdElement; + return _RequesterLinkIdElement?.Any() == true; case "performerType": - value = PerformerType; - return PerformerType?.Any() == true; + value = _PerformerType; + return _PerformerType?.Any() == true; case "performerRole": - value = PerformerRole; - return PerformerRole is not null; + value = _PerformerRole; + return _PerformerRole is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "performerLinkId": - value = PerformerLinkIdElement; - return PerformerLinkIdElement?.Any() == true; + value = _PerformerLinkIdElement; + return _PerformerLinkIdElement?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "reason": - value = ReasonElement; - return ReasonElement?.Any() == true; + value = _ReasonElement; + return _ReasonElement?.Any() == true; case "reasonLinkId": - value = ReasonLinkIdElement; - return ReasonLinkIdElement?.Any() == true; + value = _ReasonLinkIdElement; + return _ReasonLinkIdElement?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "intent": - Intent = (Hl7.Fhir.Model.CodeableConcept)value; + Intent = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contextLinkId": - ContextLinkIdElement = (List)value; + ContextLinkIdElement = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "requester": - Requester = (List)value; + Requester = (List?)value!; return this; case "requesterLinkId": - RequesterLinkIdElement = (List)value; + RequesterLinkIdElement = (List?)value!; return this; case "performerType": - PerformerType = (List)value; + PerformerType = (List?)value!; return this; case "performerRole": - PerformerRole = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerRole = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerLinkId": - PerformerLinkIdElement = (List)value; + PerformerLinkIdElement = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "reason": - ReasonElement = (List)value; + ReasonElement = (List?)value!; return this; case "reasonLinkId": - ReasonLinkIdElement = (List)value; + ReasonLinkIdElement = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3507,27 +3425,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Intent is not null) yield return new KeyValuePair("intent",Intent); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (ContextLinkIdElement?.Any() == true) yield return new KeyValuePair("contextLinkId",ContextLinkIdElement); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Requester?.Any() == true) yield return new KeyValuePair("requester",Requester); - if (RequesterLinkIdElement?.Any() == true) yield return new KeyValuePair("requesterLinkId",RequesterLinkIdElement); - if (PerformerType?.Any() == true) yield return new KeyValuePair("performerType",PerformerType); - if (PerformerRole is not null) yield return new KeyValuePair("performerRole",PerformerRole); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (PerformerLinkIdElement?.Any() == true) yield return new KeyValuePair("performerLinkId",PerformerLinkIdElement); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (ReasonElement?.Any() == true) yield return new KeyValuePair("reason",ReasonElement); - if (ReasonLinkIdElement?.Any() == true) yield return new KeyValuePair("reasonLinkId",ReasonLinkIdElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Intent is not null) yield return new KeyValuePair("intent",_Intent); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_ContextLinkIdElement?.Any() == true) yield return new KeyValuePair("contextLinkId",_ContextLinkIdElement); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Requester?.Any() == true) yield return new KeyValuePair("requester",_Requester); + if (_RequesterLinkIdElement?.Any() == true) yield return new KeyValuePair("requesterLinkId",_RequesterLinkIdElement); + if (_PerformerType?.Any() == true) yield return new KeyValuePair("performerType",_PerformerType); + if (_PerformerRole is not null) yield return new KeyValuePair("performerRole",_PerformerRole); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_PerformerLinkIdElement?.Any() == true) yield return new KeyValuePair("performerLinkId",_PerformerLinkIdElement); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_ReasonElement?.Any() == true) yield return new KeyValuePair("reason",_ReasonElement); + if (_ReasonLinkIdElement?.Any() == true) yield return new KeyValuePair("reasonLinkId",_ReasonLinkIdElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -3555,11 +3473,11 @@ public partial class ActionSubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; /// /// Role type of the agent. @@ -3567,26 +3485,22 @@ public List Reference [FhirElement("role", Order=50)] [Binding("ContractActorRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionSubjectComponent; - - if (dest == null) - { + if(other is not ActionSubjectComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3598,41 +3512,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionSubjectComponent; - if(otherT == null) return false; + if(other is not ActionSubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -3643,8 +3557,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -3674,13 +3588,13 @@ public partial class SignatoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("ContractSignerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Contract Signatory Party. @@ -3690,13 +3604,13 @@ public Hl7.Fhir.Model.Coding Type [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Contract Documentation Signature. @@ -3706,25 +3620,21 @@ public Hl7.Fhir.Model.ResourceReference Party [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as SignatoryComponent; - - if (dest == null) - { + if(other is not SignatoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3736,48 +3646,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SignatoryComponent; - if(otherT == null) return false; + if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3788,9 +3698,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } @@ -3820,25 +3730,21 @@ public partial class FriendlyLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as FriendlyLanguageComponent; - - if (dest == null) - { + if(other is not FriendlyLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3850,34 +3756,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FriendlyLanguageComponent; - if(otherT == null) return false; + if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -3888,7 +3794,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -3918,25 +3824,21 @@ public partial class LegalLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as LegalLanguageComponent; - - if (dest == null) - { + if(other is not LegalLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3948,34 +3850,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LegalLanguageComponent; - if(otherT == null) return false; + if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -3986,7 +3888,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -4016,25 +3918,21 @@ public partial class ComputableLanguageComponent : Hl7.Fhir.Model.BackboneElemen [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as ComputableLanguageComponent; - - if (dest == null) - { + if(other is not ComputableLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4046,34 +3944,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComputableLanguageComponent; - if(otherT == null) return false; + if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -4084,7 +3982,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -4097,39 +3995,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Basal definition. /// [FhirElement("url", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Basal definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4139,28 +4034,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business edition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4172,13 +4064,13 @@ public string Version [DeclaredType(Type = typeof(Code))] [Binding("ContractStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated @@ -4187,13 +4079,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4204,13 +4093,13 @@ public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status [FhirElement("legalState", Order=130)] [Binding("ContractLegalState")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalState + public Hl7.Fhir.Model.CodeableConcept? LegalState { get { return _LegalState; } set { _LegalState = value; OnPropertyChanged("LegalState"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalState; + private Hl7.Fhir.Model.CodeableConcept? _LegalState; /// /// Source Contract Definition. @@ -4219,41 +4108,38 @@ public Hl7.Fhir.Model.CodeableConcept LegalState [CLSCompliant(false)] [References("Contract")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InstantiatesCanonical + public Hl7.Fhir.Model.ResourceReference? InstantiatesCanonical { get { return _InstantiatesCanonical; } set { _InstantiatesCanonical = value; OnPropertyChanged("InstantiatesCanonical"); } } - private Hl7.Fhir.Model.ResourceReference _InstantiatesCanonical; + private Hl7.Fhir.Model.ResourceReference? _InstantiatesCanonical; /// /// External Contract Definition. /// [FhirElement("instantiatesUri", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// External Contract Definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -4264,41 +4150,38 @@ public string InstantiatesUri [FhirElement("contentDerivative", Order=160, FiveWs="FiveWs.what[x]")] [Binding("ContractContentDerivative")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ContentDerivative + public Hl7.Fhir.Model.CodeableConcept? ContentDerivative { get { return _ContentDerivative; } set { _ContentDerivative = value; OnPropertyChanged("ContentDerivative"); } } - private Hl7.Fhir.Model.CodeableConcept _ContentDerivative; + private Hl7.Fhir.Model.CodeableConcept? _ContentDerivative; /// /// When this Contract was issued. /// [FhirElement("issued", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When this Contract was issued /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -4308,13 +4191,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Contract cessation cause. @@ -4322,13 +4205,13 @@ public Hl7.Fhir.Model.Period Applies [FhirElement("expirationType", Order=190)] [Binding("ContractExpiration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ExpirationType + public Hl7.Fhir.Model.CodeableConcept? ExpirationType { get { return _ExpirationType; } set { _ExpirationType = value; OnPropertyChanged("ExpirationType"); } } - private Hl7.Fhir.Model.CodeableConcept _ExpirationType; + private Hl7.Fhir.Model.CodeableConcept? _ExpirationType; /// /// Contract Target Entity. @@ -4340,11 +4223,11 @@ public Hl7.Fhir.Model.CodeableConcept ExpirationType [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Authority under which this Contract has standing. @@ -4356,11 +4239,11 @@ public List Subject [DataMember] public List Authority { - get { if(_Authority==null) _Authority = new List(); return _Authority; } + get => _Authority ?? new List(); set { _Authority = value; OnPropertyChanged("Authority"); } } - private List _Authority; + private List? _Authority; /// /// A sphere of control governed by an authoritative jurisdiction, organization, or person. @@ -4372,11 +4255,11 @@ public List Authority [DataMember] public List Domain { - get { if(_Domain==null) _Domain = new List(); return _Domain; } + get => _Domain ?? new List(); set { _Domain = value; OnPropertyChanged("Domain"); } } - private List _Domain; + private List? _Domain; /// /// Specific Location. @@ -4388,39 +4271,36 @@ public List Domain [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Computer friendly designation. /// [FhirElement("name", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Computer friendly designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4430,28 +4310,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human Friendly name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4461,28 +4338,25 @@ public string Title /// [FhirElement("subtitle", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate Friendly name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -4495,24 +4369,24 @@ public string Subtitle [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Acronym or short name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -4526,13 +4400,13 @@ public IEnumerable Alias [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Range of Legal Concerns. @@ -4540,13 +4414,13 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("scope", Order=290)] [Binding("ContractScope")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Focus of contract interest. @@ -4556,13 +4430,13 @@ public Hl7.Fhir.Model.CodeableConcept Scope [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Topic + public Hl7.Fhir.Model.DataType? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.DataType _Topic; + private Hl7.Fhir.Model.DataType? _Topic; /// /// Legal instrument category. @@ -4570,13 +4444,13 @@ public Hl7.Fhir.Model.DataType Topic [FhirElement("type", InSummary=true, Order=310, FiveWs="FiveWs.what[x]")] [Binding("ContractType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Subtype within the context of type. @@ -4587,24 +4461,24 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List SubType { - get { if(_SubType==null) _SubType = new List(); return _SubType; } + get => _SubType ?? new List(); set { _SubType = value; OnPropertyChanged("SubType"); } } - private List _SubType; + private List? _SubType; /// /// Contract precursor content. /// [FhirElement("contentDefinition", Order=330)] [DataMember] - public Hl7.Fhir.Model.Contract.ContentDefinitionComponent ContentDefinition + public Hl7.Fhir.Model.Contract.ContentDefinitionComponent? ContentDefinition { get { return _ContentDefinition; } set { _ContentDefinition = value; OnPropertyChanged("ContentDefinition"); } } - private Hl7.Fhir.Model.Contract.ContentDefinitionComponent _ContentDefinition; + private Hl7.Fhir.Model.Contract.ContentDefinitionComponent? _ContentDefinition; /// /// Contract Term List. @@ -4614,11 +4488,11 @@ public Hl7.Fhir.Model.Contract.ContentDefinitionComponent ContentDefinition [DataMember] public List Term { - get { if(_Term==null) _Term = new List(); return _Term; } + get => _Term ?? new List(); set { _Term = value; OnPropertyChanged("Term"); } } - private List _Term; + private List? _Term; /// /// Extra Information. @@ -4630,11 +4504,11 @@ public List Term [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Key event in Contract History. @@ -4646,11 +4520,11 @@ public List SupportingInfo [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Contract Signatory. @@ -4660,11 +4534,11 @@ public List RelevantHistory [DataMember] public List Signer { - get { if(_Signer==null) _Signer = new List(); return _Signer; } + get => _Signer ?? new List(); set { _Signer = value; OnPropertyChanged("Signer"); } } - private List _Signer; + private List? _Signer; /// /// Contract Friendly Language. @@ -4674,11 +4548,11 @@ public List Signer [DataMember] public List Friendly { - get { if(_Friendly==null) _Friendly = new List(); return _Friendly; } + get => _Friendly ?? new List(); set { _Friendly = value; OnPropertyChanged("Friendly"); } } - private List _Friendly; + private List? _Friendly; /// /// Contract Legal Language. @@ -4688,11 +4562,11 @@ public List Friendly [DataMember] public List Legal { - get { if(_Legal==null) _Legal = new List(); return _Legal; } + get => _Legal ?? new List(); set { _Legal = value; OnPropertyChanged("Legal"); } } - private List _Legal; + private List? _Legal; /// /// Computable Contract Language. @@ -4702,11 +4576,11 @@ public List Legal [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Binding Contract. @@ -4716,59 +4590,55 @@ public List Rule [References("Composition","DocumentReference","QuestionnaireResponse","Contract")] [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType LegallyBinding + public Hl7.Fhir.Model.DataType? LegallyBinding { get { return _LegallyBinding; } set { _LegallyBinding = value; OnPropertyChanged("LegallyBinding"); } } - private Hl7.Fhir.Model.DataType _LegallyBinding; + private Hl7.Fhir.Model.DataType? _LegallyBinding; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Contract; - - if (dest == null) - { + if(other is not Contract dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(LegalState != null) dest.LegalState = (Hl7.Fhir.Model.CodeableConcept)LegalState.DeepCopyInternal(); - if(InstantiatesCanonical != null) dest.InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)InstantiatesCanonical.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(ContentDerivative != null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)ContentDerivative.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(ExpirationType != null) dest.ExpirationType = (Hl7.Fhir.Model.CodeableConcept)ExpirationType.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Authority.Any()) dest.Authority = new List(Authority.DeepCopyInternal()); - if(Domain.Any()) dest.Domain = new List(Domain.DeepCopyInternal()); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.DataType)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType.Any()) dest.SubType = new List(SubType.DeepCopyInternal()); - if(ContentDefinition != null) dest.ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)ContentDefinition.DeepCopyInternal(); - if(Term.Any()) dest.Term = new List(Term.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Signer.Any()) dest.Signer = new List(Signer.DeepCopyInternal()); - if(Friendly.Any()) dest.Friendly = new List(Friendly.DeepCopyInternal()); - if(Legal.Any()) dest.Legal = new List(Legal.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(LegallyBinding != null) dest.LegallyBinding = (Hl7.Fhir.Model.DataType)LegallyBinding.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_LegalState is not null) dest.LegalState = (Hl7.Fhir.Model.CodeableConcept)_LegalState.DeepCopyInternal(); + if(_InstantiatesCanonical is not null) dest.InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)_InstantiatesCanonical.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_ContentDerivative is not null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)_ContentDerivative.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_ExpirationType is not null) dest.ExpirationType = (Hl7.Fhir.Model.CodeableConcept)_ExpirationType.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Authority is not null) dest.Authority = new List(_Authority.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = new List(_Domain.DeepCopyInternal()); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.DataType)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = new List(_SubType.DeepCopyInternal()); + if(_ContentDefinition is not null) dest.ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)_ContentDefinition.DeepCopyInternal(); + if(_Term is not null) dest.Term = new List(_Term.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Signer is not null) dest.Signer = new List(_Signer.DeepCopyInternal()); + if(_Friendly is not null) dest.Friendly = new List(_Friendly.DeepCopyInternal()); + if(_Legal is not null) dest.Legal = new List(_Legal.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_LegallyBinding is not null) dest.LegallyBinding = (Hl7.Fhir.Model.DataType)_LegallyBinding.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4780,258 +4650,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contract; - if(otherT == null) return false; + if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(LegalState, otherT.LegalState)) return false; - if(!comparer.Equals(InstantiatesCanonical, otherT.InstantiatesCanonical)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(ContentDerivative, otherT.ContentDerivative)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.Equals(ExpirationType, otherT.ExpirationType)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(ContentDefinition, otherT.ContentDefinition)) return false; - if(!comparer.ListEquals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.ListEquals(Signer, otherT.Signer)) return false; - if(!comparer.ListEquals(Friendly, otherT.Friendly)) return false; - if(!comparer.ListEquals(Legal, otherT.Legal)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.Equals(LegallyBinding, otherT.LegallyBinding)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_LegalState, otherT._LegalState)) return false; + if(!comparer.Equals(_InstantiatesCanonical, otherT._InstantiatesCanonical)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_ContentDerivative, otherT._ContentDerivative)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.Equals(_ExpirationType, otherT._ExpirationType)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_ContentDefinition, otherT._ContentDefinition)) return false; + if(!comparer.ListEquals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.ListEquals(_Signer, otherT._Signer)) return false; + if(!comparer.ListEquals(_Friendly, otherT._Friendly)) return false; + if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.Equals(_LegallyBinding, otherT._LegallyBinding)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "legalState": - value = LegalState; - return LegalState is not null; + value = _LegalState; + return _LegalState is not null; case "instantiatesCanonical": - value = InstantiatesCanonical; - return InstantiatesCanonical is not null; + value = _InstantiatesCanonical; + return _InstantiatesCanonical is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "contentDerivative": - value = ContentDerivative; - return ContentDerivative is not null; + value = _ContentDerivative; + return _ContentDerivative is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "expirationType": - value = ExpirationType; - return ExpirationType is not null; + value = _ExpirationType; + return _ExpirationType is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "authority": - value = Authority; - return Authority?.Any() == true; + value = _Authority; + return _Authority?.Any() == true; case "domain": - value = Domain; - return Domain?.Any() == true; + value = _Domain; + return _Domain?.Any() == true; case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType?.Any() == true; + value = _SubType; + return _SubType?.Any() == true; case "contentDefinition": - value = ContentDefinition; - return ContentDefinition is not null; + value = _ContentDefinition; + return _ContentDefinition is not null; case "term": - value = Term; - return Term?.Any() == true; + value = _Term; + return _Term?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "signer": - value = Signer; - return Signer?.Any() == true; + value = _Signer; + return _Signer?.Any() == true; case "friendly": - value = Friendly; - return Friendly?.Any() == true; + value = _Friendly; + return _Friendly?.Any() == true; case "legal": - value = Legal; - return Legal?.Any() == true; + value = _Legal; + return _Legal?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "legallyBinding": - value = LegallyBinding; - return LegallyBinding is not null; + value = _LegallyBinding; + return _LegallyBinding is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "legalState": - LegalState = (Hl7.Fhir.Model.CodeableConcept)value; + LegalState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "instantiatesCanonical": - InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)value; + InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "contentDerivative": - ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)value; + ContentDerivative = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "expirationType": - ExpirationType = (Hl7.Fhir.Model.CodeableConcept)value; + ExpirationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "authority": - Authority = (List)value; + Authority = (List?)value!; return this; case "domain": - Domain = (List)value; + Domain = (List?)value!; return this; case "site": - Site = (List)value; + Site = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.DataType)value; + Topic = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (List)value; + SubType = (List?)value!; return this; case "contentDefinition": - ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)value; + ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent?)value; return this; case "term": - Term = (List)value; + Term = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "signer": - Signer = (List)value; + Signer = (List?)value!; return this; case "friendly": - Friendly = (List)value; + Friendly = (List?)value!; return this; case "legal": - Legal = (List)value; + Legal = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "legallyBinding": - LegallyBinding = (Hl7.Fhir.Model.DataType)value; + LegallyBinding = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -5042,39 +4912,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (LegalState is not null) yield return new KeyValuePair("legalState",LegalState); - if (InstantiatesCanonical is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonical); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",ContentDerivative); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (ExpirationType is not null) yield return new KeyValuePair("expirationType",ExpirationType); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Authority?.Any() == true) yield return new KeyValuePair("authority",Authority); - if (Domain?.Any() == true) yield return new KeyValuePair("domain",Domain); - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType?.Any() == true) yield return new KeyValuePair("subType",SubType); - if (ContentDefinition is not null) yield return new KeyValuePair("contentDefinition",ContentDefinition); - if (Term?.Any() == true) yield return new KeyValuePair("term",Term); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Signer?.Any() == true) yield return new KeyValuePair("signer",Signer); - if (Friendly?.Any() == true) yield return new KeyValuePair("friendly",Friendly); - if (Legal?.Any() == true) yield return new KeyValuePair("legal",Legal); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (LegallyBinding is not null) yield return new KeyValuePair("legallyBinding",LegallyBinding); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_LegalState is not null) yield return new KeyValuePair("legalState",_LegalState); + if (_InstantiatesCanonical is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonical); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",_ContentDerivative); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_ExpirationType is not null) yield return new KeyValuePair("expirationType",_ExpirationType); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Authority?.Any() == true) yield return new KeyValuePair("authority",_Authority); + if (_Domain?.Any() == true) yield return new KeyValuePair("domain",_Domain); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType?.Any() == true) yield return new KeyValuePair("subType",_SubType); + if (_ContentDefinition is not null) yield return new KeyValuePair("contentDefinition",_ContentDefinition); + if (_Term?.Any() == true) yield return new KeyValuePair("term",_Term); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Signer?.Any() == true) yield return new KeyValuePair("signer",_Signer); + if (_Friendly?.Any() == true) yield return new KeyValuePair("friendly",_Friendly); + if (_Legal?.Any() == true) yield return new KeyValuePair("legal",_Legal); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_LegallyBinding is not null) yield return new KeyValuePair("legallyBinding",_LegallyBinding); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs index faed7067b..a59e40c98 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -101,13 +104,13 @@ public enum ContributorType [Binding("ContributorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// author | editor | reviewer | endorser @@ -116,13 +119,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Contributor.ContributorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -133,28 +133,25 @@ public Hl7.Fhir.Model.Contributor.ContributorType? Type [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Who contributed the content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -167,25 +164,21 @@ public string Name [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; protected internal override void CopyToInternal(Base other) { - var dest = other as Contributor; - - if (dest == null) - { + if(other is not Contributor dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -197,48 +190,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contributor; - if(otherT == null) return false; + if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; default: return base.SetValue(key, value); @@ -249,9 +242,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Count.cs b/src/Hl7.Fhir.R4/Model/Generated/Count.cs index a737eb532..ea091d289 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Count.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Count.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs index 8ab529023..483624fb7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Coverage","http://hl7.org/fhir/StructureDefinition/Coverage")] - public partial class Coverage : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Coverage : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -84,13 +87,13 @@ public partial class ClassComponent : Hl7.Fhir.Model.BackboneElement [Binding("CoverageClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Value associated with the type. @@ -98,28 +101,25 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("value", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value associated with the type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -129,45 +129,38 @@ public string Value /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human readable description of the type and value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ClassComponent; - - if (dest == null) - { + if(other is not ClassComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,48 +172,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassComponent; - if(otherT == null) return false; + if(other is not ClassComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -231,9 +224,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); } } @@ -261,13 +254,13 @@ public partial class CostToBeneficiaryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("CopayTypes")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The amount or percentage due from the beneficiary. @@ -277,13 +270,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Money))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Exceptions for patient payments. @@ -293,25 +286,21 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Exception { - get { if(_Exception==null) _Exception = new List(); return _Exception; } + get => _Exception ?? new List(); set { _Exception = value; OnPropertyChanged("Exception"); } } - private List _Exception; + private List? _Exception; protected internal override void CopyToInternal(Base other) { - var dest = other as CostToBeneficiaryComponent; - - if (dest == null) - { + if(other is not CostToBeneficiaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Exception.Any()) dest.Exception = new List(Exception.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Exception is not null) dest.Exception = new List(_Exception.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -323,48 +312,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostToBeneficiaryComponent; - if(otherT == null) return false; + if(other is not CostToBeneficiaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Exception, otherT.Exception)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Exception, otherT._Exception)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exception": - value = Exception; - return Exception?.Any() == true; + value = _Exception; + return _Exception?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exception": - Exception = (List)value; + Exception = (List?)value!; return this; default: return base.SetValue(key, value); @@ -375,9 +364,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Exception?.Any() == true) yield return new KeyValuePair("exception",Exception); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Exception?.Any() == true) yield return new KeyValuePair("exception",_Exception); } } @@ -405,39 +394,35 @@ public partial class ExemptionComponent : Hl7.Fhir.Model.BackboneElement [Binding("CoverageFinancialException")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The effective period of the exception. /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ExemptionComponent; - - if (dest == null) - { + if(other is not ExemptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -449,41 +434,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExemptionComponent; - if(otherT == null) return false; + if(other is not ExemptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -494,8 +479,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -508,11 +493,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -522,13 +507,13 @@ public List Identifier [Binding("CoverageStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -537,13 +522,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -554,13 +536,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("type", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("CoverageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Owner of the policy. @@ -569,13 +551,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PolicyHolder + public Hl7.Fhir.Model.ResourceReference? PolicyHolder { get { return _PolicyHolder; } set { _PolicyHolder = value; OnPropertyChanged("PolicyHolder"); } } - private Hl7.Fhir.Model.ResourceReference _PolicyHolder; + private Hl7.Fhir.Model.ResourceReference? _PolicyHolder; /// /// Subscriber to the policy. @@ -584,41 +566,38 @@ public Hl7.Fhir.Model.ResourceReference PolicyHolder [CLSCompliant(false)] [References("Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subscriber + public Hl7.Fhir.Model.ResourceReference? Subscriber { get { return _Subscriber; } set { _Subscriber = value; OnPropertyChanged("Subscriber"); } } - private Hl7.Fhir.Model.ResourceReference _Subscriber; + private Hl7.Fhir.Model.ResourceReference? _Subscriber; /// /// ID assigned to the subscriber. /// [FhirElement("subscriberId", InSummary=true, Order=140, FiveWs="FiveWs.subject")] [DataMember] - public Hl7.Fhir.Model.FhirString SubscriberIdElement + public Hl7.Fhir.Model.FhirString? SubscriberIdElement { get { return _SubscriberIdElement; } set { _SubscriberIdElement = value; OnPropertyChanged("SubscriberIdElement"); } } - private Hl7.Fhir.Model.FhirString _SubscriberIdElement; + private Hl7.Fhir.Model.FhirString? _SubscriberIdElement; /// /// ID assigned to the subscriber /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubscriberId + public string? SubscriberId { - get { return SubscriberIdElement != null ? SubscriberIdElement.Value : null; } + get => _SubscriberIdElement?.Value; set { - if (value == null) - SubscriberIdElement = null; - else - SubscriberIdElement = new Hl7.Fhir.Model.FhirString(value); + SubscriberIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubscriberId"); } } @@ -631,41 +610,38 @@ public string SubscriberId [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Beneficiary + public Hl7.Fhir.Model.ResourceReference? Beneficiary { get { return _Beneficiary; } set { _Beneficiary = value; OnPropertyChanged("Beneficiary"); } } - private Hl7.Fhir.Model.ResourceReference _Beneficiary; + private Hl7.Fhir.Model.ResourceReference? _Beneficiary; /// /// Dependent number. /// [FhirElement("dependent", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString DependentElement + public Hl7.Fhir.Model.FhirString? DependentElement { get { return _DependentElement; } set { _DependentElement = value; OnPropertyChanged("DependentElement"); } } - private Hl7.Fhir.Model.FhirString _DependentElement; + private Hl7.Fhir.Model.FhirString? _DependentElement; /// /// Dependent number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Dependent + public string? Dependent { - get { return DependentElement != null ? DependentElement.Value : null; } + get => _DependentElement?.Value; set { - if (value == null) - DependentElement = null; - else - DependentElement = new Hl7.Fhir.Model.FhirString(value); + DependentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Dependent"); } } @@ -676,26 +652,26 @@ public string Dependent [FhirElement("relationship", Order=170)] [Binding("Relationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// Coverage start and end dates. /// [FhirElement("period", InSummary=true, Order=180, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Issuer of the policy. @@ -707,11 +683,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Payor { - get { if(_Payor==null) _Payor = new List(); return _Payor; } + get => _Payor ?? new List(); set { _Payor = value; OnPropertyChanged("Payor"); } } - private List _Payor; + private List? _Payor; /// /// Additional coverage classifications. @@ -721,24 +697,24 @@ public List Payor [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// Relative order of the coverage. /// [FhirElement("order", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.PositiveInt OrderElement + public Hl7.Fhir.Model.PositiveInt? OrderElement { get { return _OrderElement; } set { _OrderElement = value; OnPropertyChanged("OrderElement"); } } - private Hl7.Fhir.Model.PositiveInt _OrderElement; + private Hl7.Fhir.Model.PositiveInt? _OrderElement; /// /// Relative order of the coverage @@ -747,13 +723,10 @@ public Hl7.Fhir.Model.PositiveInt OrderElement [IgnoreDataMember] public int? Order { - get { return OrderElement != null ? OrderElement.Value : null; } + get => _OrderElement?.Value; set { - if (value == null) - OrderElement = null; - else - OrderElement = new Hl7.Fhir.Model.PositiveInt(value); + OrderElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Order"); } } @@ -763,28 +736,25 @@ public int? Order /// [FhirElement("network", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString NetworkElement + public Hl7.Fhir.Model.FhirString? NetworkElement { get { return _NetworkElement; } set { _NetworkElement = value; OnPropertyChanged("NetworkElement"); } } - private Hl7.Fhir.Model.FhirString _NetworkElement; + private Hl7.Fhir.Model.FhirString? _NetworkElement; /// /// Insurer network /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Network + public string? Network { - get { return NetworkElement != null ? NetworkElement.Value : null; } + get => _NetworkElement?.Value; set { - if (value == null) - NetworkElement = null; - else - NetworkElement = new Hl7.Fhir.Model.FhirString(value); + NetworkElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Network"); } } @@ -797,24 +767,24 @@ public string Network [DataMember] public List CostToBeneficiary { - get { if(_CostToBeneficiary==null) _CostToBeneficiary = new List(); return _CostToBeneficiary; } + get => _CostToBeneficiary ?? new List(); set { _CostToBeneficiary = value; OnPropertyChanged("CostToBeneficiary"); } } - private List _CostToBeneficiary; + private List? _CostToBeneficiary; /// /// Reimbursement to insurer. /// [FhirElement("subrogation", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SubrogationElement + public Hl7.Fhir.Model.FhirBoolean? SubrogationElement { get { return _SubrogationElement; } set { _SubrogationElement = value; OnPropertyChanged("SubrogationElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SubrogationElement; + private Hl7.Fhir.Model.FhirBoolean? _SubrogationElement; /// /// Reimbursement to insurer @@ -823,13 +793,10 @@ public Hl7.Fhir.Model.FhirBoolean SubrogationElement [IgnoreDataMember] public bool? Subrogation { - get { return SubrogationElement != null ? SubrogationElement.Value : null; } + get => _SubrogationElement?.Value; set { - if (value == null) - SubrogationElement = null; - else - SubrogationElement = new Hl7.Fhir.Model.FhirBoolean(value); + SubrogationElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Subrogation"); } } @@ -844,44 +811,40 @@ public bool? Subrogation [DataMember] public List Contract { - get { if(_Contract==null) _Contract = new List(); return _Contract; } + get => _Contract ?? new List(); set { _Contract = value; OnPropertyChanged("Contract"); } } - private List _Contract; + private List? _Contract; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Coverage; - - if (dest == null) - { + if(other is not Coverage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PolicyHolder != null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)PolicyHolder.DeepCopyInternal(); - if(Subscriber != null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)Subscriber.DeepCopyInternal(); - if(SubscriberIdElement != null) dest.SubscriberIdElement = (Hl7.Fhir.Model.FhirString)SubscriberIdElement.DeepCopyInternal(); - if(Beneficiary != null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)Beneficiary.DeepCopyInternal(); - if(DependentElement != null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)DependentElement.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Payor.Any()) dest.Payor = new List(Payor.DeepCopyInternal()); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(OrderElement != null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)OrderElement.DeepCopyInternal(); - if(NetworkElement != null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)NetworkElement.DeepCopyInternal(); - if(CostToBeneficiary.Any()) dest.CostToBeneficiary = new List(CostToBeneficiary.DeepCopyInternal()); - if(SubrogationElement != null) dest.SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)SubrogationElement.DeepCopyInternal(); - if(Contract.Any()) dest.Contract = new List(Contract.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PolicyHolder is not null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)_PolicyHolder.DeepCopyInternal(); + if(_Subscriber is not null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)_Subscriber.DeepCopyInternal(); + if(_SubscriberIdElement is not null) dest.SubscriberIdElement = (Hl7.Fhir.Model.FhirString)_SubscriberIdElement.DeepCopyInternal(); + if(_Beneficiary is not null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)_Beneficiary.DeepCopyInternal(); + if(_DependentElement is not null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)_DependentElement.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Payor is not null) dest.Payor = new List(_Payor.DeepCopyInternal()); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_OrderElement is not null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)_OrderElement.DeepCopyInternal(); + if(_NetworkElement is not null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)_NetworkElement.DeepCopyInternal(); + if(_CostToBeneficiary is not null) dest.CostToBeneficiary = new List(_CostToBeneficiary.DeepCopyInternal()); + if(_SubrogationElement is not null) dest.SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)_SubrogationElement.DeepCopyInternal(); + if(_Contract is not null) dest.Contract = new List(_Contract.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -893,146 +856,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Coverage; - if(otherT == null) return false; + if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PolicyHolder, otherT.PolicyHolder)) return false; - if(!comparer.Equals(Subscriber, otherT.Subscriber)) return false; - if(!comparer.Equals(SubscriberIdElement, otherT.SubscriberIdElement)) return false; - if(!comparer.Equals(Beneficiary, otherT.Beneficiary)) return false; - if(!comparer.Equals(DependentElement, otherT.DependentElement)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Payor, otherT.Payor)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.Equals(OrderElement, otherT.OrderElement)) return false; - if(!comparer.Equals(NetworkElement, otherT.NetworkElement)) return false; - if(!comparer.ListEquals(CostToBeneficiary, otherT.CostToBeneficiary)) return false; - if(!comparer.Equals(SubrogationElement, otherT.SubrogationElement)) return false; - if(!comparer.ListEquals(Contract, otherT.Contract)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PolicyHolder, otherT._PolicyHolder)) return false; + if(!comparer.Equals(_Subscriber, otherT._Subscriber)) return false; + if(!comparer.Equals(_SubscriberIdElement, otherT._SubscriberIdElement)) return false; + if(!comparer.Equals(_Beneficiary, otherT._Beneficiary)) return false; + if(!comparer.Equals(_DependentElement, otherT._DependentElement)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Payor, otherT._Payor)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_OrderElement, otherT._OrderElement)) return false; + if(!comparer.Equals(_NetworkElement, otherT._NetworkElement)) return false; + if(!comparer.ListEquals(_CostToBeneficiary, otherT._CostToBeneficiary)) return false; + if(!comparer.Equals(_SubrogationElement, otherT._SubrogationElement)) return false; + if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "policyHolder": - value = PolicyHolder; - return PolicyHolder is not null; + value = _PolicyHolder; + return _PolicyHolder is not null; case "subscriber": - value = Subscriber; - return Subscriber is not null; + value = _Subscriber; + return _Subscriber is not null; case "subscriberId": - value = SubscriberIdElement; - return SubscriberIdElement is not null; + value = _SubscriberIdElement; + return _SubscriberIdElement is not null; case "beneficiary": - value = Beneficiary; - return Beneficiary is not null; + value = _Beneficiary; + return _Beneficiary is not null; case "dependent": - value = DependentElement; - return DependentElement is not null; + value = _DependentElement; + return _DependentElement is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "payor": - value = Payor; - return Payor?.Any() == true; + value = _Payor; + return _Payor?.Any() == true; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "order": - value = OrderElement; - return OrderElement is not null; + value = _OrderElement; + return _OrderElement is not null; case "network": - value = NetworkElement; - return NetworkElement is not null; + value = _NetworkElement; + return _NetworkElement is not null; case "costToBeneficiary": - value = CostToBeneficiary; - return CostToBeneficiary?.Any() == true; + value = _CostToBeneficiary; + return _CostToBeneficiary?.Any() == true; case "subrogation": - value = SubrogationElement; - return SubrogationElement is not null; + value = _SubrogationElement; + return _SubrogationElement is not null; case "contract": - value = Contract; - return Contract?.Any() == true; + value = _Contract; + return _Contract?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "policyHolder": - PolicyHolder = (Hl7.Fhir.Model.ResourceReference)value; + PolicyHolder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriber": - Subscriber = (Hl7.Fhir.Model.ResourceReference)value; + Subscriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriberId": - SubscriberIdElement = (Hl7.Fhir.Model.FhirString)value; + SubscriberIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "beneficiary": - Beneficiary = (Hl7.Fhir.Model.ResourceReference)value; + Beneficiary = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dependent": - DependentElement = (Hl7.Fhir.Model.FhirString)value; + DependentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "payor": - Payor = (List)value; + Payor = (List?)value!; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "order": - OrderElement = (Hl7.Fhir.Model.PositiveInt)value; + OrderElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "network": - NetworkElement = (Hl7.Fhir.Model.FhirString)value; + NetworkElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "costToBeneficiary": - CostToBeneficiary = (List)value; + CostToBeneficiary = (List?)value!; return this; case "subrogation": - SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)value; + SubrogationElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "contract": - Contract = (List)value; + Contract = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1043,23 +1006,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PolicyHolder is not null) yield return new KeyValuePair("policyHolder",PolicyHolder); - if (Subscriber is not null) yield return new KeyValuePair("subscriber",Subscriber); - if (SubscriberIdElement is not null) yield return new KeyValuePair("subscriberId",SubscriberIdElement); - if (Beneficiary is not null) yield return new KeyValuePair("beneficiary",Beneficiary); - if (DependentElement is not null) yield return new KeyValuePair("dependent",DependentElement); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Payor?.Any() == true) yield return new KeyValuePair("payor",Payor); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (OrderElement is not null) yield return new KeyValuePair("order",OrderElement); - if (NetworkElement is not null) yield return new KeyValuePair("network",NetworkElement); - if (CostToBeneficiary?.Any() == true) yield return new KeyValuePair("costToBeneficiary",CostToBeneficiary); - if (SubrogationElement is not null) yield return new KeyValuePair("subrogation",SubrogationElement); - if (Contract?.Any() == true) yield return new KeyValuePair("contract",Contract); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PolicyHolder is not null) yield return new KeyValuePair("policyHolder",_PolicyHolder); + if (_Subscriber is not null) yield return new KeyValuePair("subscriber",_Subscriber); + if (_SubscriberIdElement is not null) yield return new KeyValuePair("subscriberId",_SubscriberIdElement); + if (_Beneficiary is not null) yield return new KeyValuePair("beneficiary",_Beneficiary); + if (_DependentElement is not null) yield return new KeyValuePair("dependent",_DependentElement); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Payor?.Any() == true) yield return new KeyValuePair("payor",_Payor); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_OrderElement is not null) yield return new KeyValuePair("order",_OrderElement); + if (_NetworkElement is not null) yield return new KeyValuePair("network",_NetworkElement); + if (_CostToBeneficiary?.Any() == true) yield return new KeyValuePair("costToBeneficiary",_CostToBeneficiary); + if (_SubrogationElement is not null) yield return new KeyValuePair("subrogation",_SubrogationElement); + if (_Contract?.Any() == true) yield return new KeyValuePair("contract",_Contract); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs index 1bc14287b..1a6fb6090 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -131,13 +134,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -150,26 +150,26 @@ public int? Sequence [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Information + public Hl7.Fhir.Model.ResourceReference? Information { get { return _Information; } set { _Information = value; OnPropertyChanged("Information"); } } - private Hl7.Fhir.Model.ResourceReference _Information; + private Hl7.Fhir.Model.ResourceReference? _Information; /// /// Applies to all items. /// [FhirElement("appliesToAll", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AppliesToAllElement + public Hl7.Fhir.Model.FhirBoolean? AppliesToAllElement { get { return _AppliesToAllElement; } set { _AppliesToAllElement = value; OnPropertyChanged("AppliesToAllElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AppliesToAllElement; + private Hl7.Fhir.Model.FhirBoolean? _AppliesToAllElement; /// /// Applies to all items @@ -178,30 +178,23 @@ public Hl7.Fhir.Model.FhirBoolean AppliesToAllElement [IgnoreDataMember] public bool? AppliesToAll { - get { return AppliesToAllElement != null ? AppliesToAllElement.Value : null; } + get => _AppliesToAllElement?.Value; set { - if (value == null) - AppliesToAllElement = null; - else - AppliesToAllElement = new Hl7.Fhir.Model.FhirBoolean(value); + AppliesToAllElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AppliesToAll"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Information != null) dest.Information = (Hl7.Fhir.Model.ResourceReference)Information.DeepCopyInternal(); - if(AppliesToAllElement != null) dest.AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)AppliesToAllElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Information is not null) dest.Information = (Hl7.Fhir.Model.ResourceReference)_Information.DeepCopyInternal(); + if(_AppliesToAllElement is not null) dest.AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)_AppliesToAllElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -213,48 +206,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Information, otherT.Information)) return false; - if(!comparer.Equals(AppliesToAllElement, otherT.AppliesToAllElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Information, otherT._Information)) return false; + if(!comparer.Equals(_AppliesToAllElement, otherT._AppliesToAllElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "information": - value = Information; - return Information is not null; + value = _Information; + return _Information is not null; case "appliesToAll": - value = AppliesToAllElement; - return AppliesToAllElement is not null; + value = _AppliesToAllElement; + return _AppliesToAllElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "information": - Information = (Hl7.Fhir.Model.ResourceReference)value; + Information = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "appliesToAll": - AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)value; + AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -265,9 +258,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Information is not null) yield return new KeyValuePair("information",Information); - if (AppliesToAllElement is not null) yield return new KeyValuePair("appliesToAll",AppliesToAllElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Information is not null) yield return new KeyValuePair("information",_Information); + if (_AppliesToAllElement is not null) yield return new KeyValuePair("appliesToAll",_AppliesToAllElement); } } @@ -294,13 +287,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("focal", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Applicable coverage @@ -309,13 +302,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -328,58 +318,51 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -391,48 +374,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -443,9 +426,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); } } @@ -474,24 +457,24 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SupportingInfoSequenceElement { - get { if(_SupportingInfoSequenceElement==null) _SupportingInfoSequenceElement = new List(); return _SupportingInfoSequenceElement; } + get => _SupportingInfoSequenceElement ?? new List(); set { _SupportingInfoSequenceElement = value; OnPropertyChanged("SupportingInfoSequenceElement"); } } - private List _SupportingInfoSequenceElement; + private List? _SupportingInfoSequenceElement; /// /// Applicable exception or supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SupportingInfoSequence + public IEnumerable? SupportingInfoSequence { - get { return SupportingInfoSequenceElement != null ? SupportingInfoSequenceElement.Select(elem => elem.Value) : null; } + get => _SupportingInfoSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SupportingInfoSequenceElement = null; + SupportingInfoSequenceElement = null!; else SupportingInfoSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SupportingInfoSequence"); @@ -504,13 +487,13 @@ public IEnumerable SupportingInfoSequence [FhirElement("category", Order=50)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -518,13 +501,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -535,11 +518,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Perfoming practitioner. @@ -548,39 +531,39 @@ public List Modifier [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Count of products or services. /// [FhirElement("quantity", Order=90)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=100)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Servicing facility. @@ -589,13 +572,13 @@ public Hl7.Fhir.Model.Money UnitPrice [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Applicable diagnosis. @@ -605,11 +588,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Product or service details. @@ -621,32 +604,28 @@ public List Diagno [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailsComponent; - - if (dest == null) - { + if(other is not DetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SupportingInfoSequenceElement.Any()) dest.SupportingInfoSequenceElement = new List(SupportingInfoSequenceElement.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SupportingInfoSequenceElement is not null) dest.SupportingInfoSequenceElement = new List(_SupportingInfoSequenceElement.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -658,97 +637,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailsComponent; - if(otherT == null) return false; + if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(SupportingInfoSequenceElement, otherT.SupportingInfoSequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "supportingInfoSequence": - value = SupportingInfoSequenceElement; - return SupportingInfoSequenceElement?.Any() == true; + value = _SupportingInfoSequenceElement; + return _SupportingInfoSequenceElement?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "supportingInfoSequence": - SupportingInfoSequenceElement = (List)value; + SupportingInfoSequenceElement = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -759,16 +738,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SupportingInfoSequenceElement?.Any() == true) yield return new KeyValuePair("supportingInfoSequence",SupportingInfoSequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SupportingInfoSequenceElement?.Any() == true) yield return new KeyValuePair("supportingInfoSequence",_SupportingInfoSequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -798,25 +777,21 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -828,34 +803,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -866,7 +841,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); } } @@ -879,11 +854,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -893,13 +868,13 @@ public List Identifier [Binding("EligibilityRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -908,13 +883,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -925,13 +897,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("priority", Order=110, FiveWs="FiveWs.class")] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// auth-requirements | benefits | discovery | validation. @@ -943,24 +915,24 @@ public Hl7.Fhir.Model.CodeableConcept Priority [DataMember] public List> PurposeElement { - get { if(_PurposeElement==null) _PurposeElement = new List>(); return _PurposeElement; } + get => _PurposeElement ?? new List>(); set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private List> _PurposeElement; + private List>? _PurposeElement; /// /// auth-requirements | benefits | discovery | validation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Purpose + public IEnumerable? Purpose { - get { return PurposeElement != null ? PurposeElement.Select(elem => elem.Value) : null; } + get => _PurposeElement?.Select(elem => elem.Value); set { if (value == null) - PurposeElement = null; + PurposeElement = null!; else PurposeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Purpose"); @@ -975,13 +947,13 @@ public IEnumerable /// Estimated date or dates of service. @@ -990,13 +962,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Creation date. @@ -1004,28 +976,25 @@ public Hl7.Fhir.Model.DataType Serviced [FhirElement("created", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1037,13 +1006,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Party responsible for the request. @@ -1052,13 +1021,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Coverage issuer. @@ -1068,13 +1037,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Servicing facility. @@ -1083,13 +1052,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Supporting information. @@ -1099,11 +1068,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Patient insurance information. @@ -1113,11 +1082,11 @@ public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Item to be evaluated for eligibiity. @@ -1127,38 +1096,34 @@ public List Insura [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageEligibilityRequest; - - if (dest == null) - { + if(other is not CoverageEligibilityRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(PurposeElement.Any()) dest.PurposeElement = new List>(PurposeElement.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = new List>(_PurposeElement.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1170,125 +1135,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageEligibilityRequest; - if(otherT == null) return false; + if(other is not CoverageEligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.ListEquals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "purpose": - value = PurposeElement; - return PurposeElement?.Any() == true; + value = _PurposeElement; + return _PurposeElement?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "purpose": - PurposeElement = (List>)value; + PurposeElement = (List>?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1299,20 +1264,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",PurposeElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs index 48700ddc5..4315cd31e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -118,26 +121,26 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Coverage inforce indicator. /// [FhirElement("inforce", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InforceElement + public Hl7.Fhir.Model.FhirBoolean? InforceElement { get { return _InforceElement; } set { _InforceElement = value; OnPropertyChanged("InforceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InforceElement; + private Hl7.Fhir.Model.FhirBoolean? _InforceElement; /// /// Coverage inforce indicator @@ -146,13 +149,10 @@ public Hl7.Fhir.Model.FhirBoolean InforceElement [IgnoreDataMember] public bool? Inforce { - get { return InforceElement != null ? InforceElement.Value : null; } + get => _InforceElement?.Value; set { - if (value == null) - InforceElement = null; - else - InforceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InforceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inforce"); } } @@ -162,13 +162,13 @@ public bool? Inforce /// [FhirElement("benefitPeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period BenefitPeriod + public Hl7.Fhir.Model.Period? BenefitPeriod { get { return _BenefitPeriod; } set { _BenefitPeriod = value; OnPropertyChanged("BenefitPeriod"); } } - private Hl7.Fhir.Model.Period _BenefitPeriod; + private Hl7.Fhir.Model.Period? _BenefitPeriod; /// /// Benefits and authorization details. @@ -178,26 +178,22 @@ public Hl7.Fhir.Model.Period BenefitPeriod [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(InforceElement != null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)InforceElement.DeepCopyInternal(); - if(BenefitPeriod != null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)BenefitPeriod.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_InforceElement is not null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)_InforceElement.DeepCopyInternal(); + if(_BenefitPeriod is not null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)_BenefitPeriod.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -209,55 +205,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(InforceElement, otherT.InforceElement)) return false; - if(!comparer.Equals(BenefitPeriod, otherT.BenefitPeriod)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_InforceElement, otherT._InforceElement)) return false; + if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "inforce": - value = InforceElement; - return InforceElement is not null; + value = _InforceElement; + return _InforceElement is not null; case "benefitPeriod": - value = BenefitPeriod; - return BenefitPeriod is not null; + value = _BenefitPeriod; + return _BenefitPeriod is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "inforce": - InforceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InforceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "benefitPeriod": - BenefitPeriod = (Hl7.Fhir.Model.Period)value; + BenefitPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -268,10 +264,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (InforceElement is not null) yield return new KeyValuePair("inforce",InforceElement); - if (BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",BenefitPeriod); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_InforceElement is not null) yield return new KeyValuePair("inforce",_InforceElement); + if (_BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",_BenefitPeriod); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -298,13 +294,13 @@ public partial class ItemsComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -312,13 +308,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=50)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -329,11 +325,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Performing practitioner. @@ -342,26 +338,26 @@ public List Modifier [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -370,13 +366,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -386,28 +379,25 @@ public bool? Excluded /// [FhirElement("name", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -417,28 +407,25 @@ public string Name /// [FhirElement("description", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -449,13 +436,13 @@ public string Description [FhirElement("network", Order=110)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -463,13 +450,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=120)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -477,13 +464,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=130)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -493,24 +480,24 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; /// /// Authorization required flag. /// [FhirElement("authorizationRequired", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AuthorizationRequiredElement + public Hl7.Fhir.Model.FhirBoolean? AuthorizationRequiredElement { get { return _AuthorizationRequiredElement; } set { _AuthorizationRequiredElement = value; OnPropertyChanged("AuthorizationRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AuthorizationRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _AuthorizationRequiredElement; /// /// Authorization required flag @@ -519,13 +506,10 @@ public Hl7.Fhir.Model.FhirBoolean AuthorizationRequiredElement [IgnoreDataMember] public bool? AuthorizationRequired { - get { return AuthorizationRequiredElement != null ? AuthorizationRequiredElement.Value : null; } + get => _AuthorizationRequiredElement?.Value; set { - if (value == null) - AuthorizationRequiredElement = null; - else - AuthorizationRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + AuthorizationRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AuthorizationRequired"); } } @@ -539,67 +523,60 @@ public bool? AuthorizationRequired [DataMember] public List AuthorizationSupporting { - get { if(_AuthorizationSupporting==null) _AuthorizationSupporting = new List(); return _AuthorizationSupporting; } + get => _AuthorizationSupporting ?? new List(); set { _AuthorizationSupporting = value; OnPropertyChanged("AuthorizationSupporting"); } } - private List _AuthorizationSupporting; + private List? _AuthorizationSupporting; /// /// Preauthorization requirements endpoint. /// [FhirElement("authorizationUrl", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirUri AuthorizationUrlElement + public Hl7.Fhir.Model.FhirUri? AuthorizationUrlElement { get { return _AuthorizationUrlElement; } set { _AuthorizationUrlElement = value; OnPropertyChanged("AuthorizationUrlElement"); } } - private Hl7.Fhir.Model.FhirUri _AuthorizationUrlElement; + private Hl7.Fhir.Model.FhirUri? _AuthorizationUrlElement; /// /// Preauthorization requirements endpoint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthorizationUrl + public string? AuthorizationUrl { - get { return AuthorizationUrlElement != null ? AuthorizationUrlElement.Value : null; } + get => _AuthorizationUrlElement?.Value; set { - if (value == null) - AuthorizationUrlElement = null; - else - AuthorizationUrlElement = new Hl7.Fhir.Model.FhirUri(value); + AuthorizationUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("AuthorizationUrl"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ItemsComponent; - - if (dest == null) - { + if(other is not ItemsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); - if(AuthorizationRequiredElement != null) dest.AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)AuthorizationRequiredElement.DeepCopyInternal(); - if(AuthorizationSupporting.Any()) dest.AuthorizationSupporting = new List(AuthorizationSupporting.DeepCopyInternal()); - if(AuthorizationUrlElement != null) dest.AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)AuthorizationUrlElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); + if(_AuthorizationRequiredElement is not null) dest.AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_AuthorizationRequiredElement.DeepCopyInternal(); + if(_AuthorizationSupporting is not null) dest.AuthorizationSupporting = new List(_AuthorizationSupporting.DeepCopyInternal()); + if(_AuthorizationUrlElement is not null) dest.AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)_AuthorizationUrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -611,125 +588,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemsComponent; - if(otherT == null) return false; + if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; - if(!comparer.Equals(AuthorizationRequiredElement, otherT.AuthorizationRequiredElement)) return false; - if(!comparer.ListEquals(AuthorizationSupporting, otherT.AuthorizationSupporting)) return false; - if(!comparer.Equals(AuthorizationUrlElement, otherT.AuthorizationUrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; + if(!comparer.Equals(_AuthorizationRequiredElement, otherT._AuthorizationRequiredElement)) return false; + if(!comparer.ListEquals(_AuthorizationSupporting, otherT._AuthorizationSupporting)) return false; + if(!comparer.Equals(_AuthorizationUrlElement, otherT._AuthorizationUrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; case "authorizationRequired": - value = AuthorizationRequiredElement; - return AuthorizationRequiredElement is not null; + value = _AuthorizationRequiredElement; + return _AuthorizationRequiredElement is not null; case "authorizationSupporting": - value = AuthorizationSupporting; - return AuthorizationSupporting?.Any() == true; + value = _AuthorizationSupporting; + return _AuthorizationSupporting?.Any() == true; case "authorizationUrl": - value = AuthorizationUrlElement; - return AuthorizationUrlElement is not null; + value = _AuthorizationUrlElement; + return _AuthorizationUrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; case "authorizationRequired": - AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "authorizationSupporting": - AuthorizationSupporting = (List)value; + AuthorizationSupporting = (List?)value!; return this; case "authorizationUrl": - AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)value; + AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -740,20 +717,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); - if (AuthorizationRequiredElement is not null) yield return new KeyValuePair("authorizationRequired",AuthorizationRequiredElement); - if (AuthorizationSupporting?.Any() == true) yield return new KeyValuePair("authorizationSupporting",AuthorizationSupporting); - if (AuthorizationUrlElement is not null) yield return new KeyValuePair("authorizationUrl",AuthorizationUrlElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); + if (_AuthorizationRequiredElement is not null) yield return new KeyValuePair("authorizationRequired",_AuthorizationRequiredElement); + if (_AuthorizationSupporting?.Any() == true) yield return new KeyValuePair("authorizationSupporting",_AuthorizationSupporting); + if (_AuthorizationUrlElement is not null) yield return new KeyValuePair("authorizationUrl",_AuthorizationUrlElement); } } @@ -781,13 +758,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -796,13 +773,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -811,27 +788,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -843,48 +816,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -895,9 +868,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -925,25 +898,21 @@ public partial class ErrorsComponent : Hl7.Fhir.Model.BackboneElement [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorsComponent; - - if (dest == null) - { + if(other is not ErrorsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -955,34 +924,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorsComponent; - if(otherT == null) return false; + if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -993,7 +962,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -1006,11 +975,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -1020,13 +989,13 @@ public List Identifier [Binding("EligibilityResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -1035,13 +1004,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1056,24 +1022,24 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [DataMember] public List> PurposeElement { - get { if(_PurposeElement==null) _PurposeElement = new List>(); return _PurposeElement; } + get => _PurposeElement ?? new List>(); set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private List> _PurposeElement; + private List>? _PurposeElement; /// /// auth-requirements | benefits | discovery | validation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Purpose + public IEnumerable? Purpose { - get { return PurposeElement != null ? PurposeElement.Select(elem => elem.Value) : null; } + get => _PurposeElement?.Select(elem => elem.Value); set { if (value == null) - PurposeElement = null; + PurposeElement = null!; else PurposeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Purpose"); @@ -1088,13 +1054,13 @@ public IEnumerable /// Estimated date or dates of service. @@ -1103,13 +1069,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Response creation date. @@ -1117,28 +1083,25 @@ public Hl7.Fhir.Model.DataType Serviced [FhirElement("created", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1150,13 +1113,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// Eligibility request reference. @@ -1166,13 +1129,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [References("CoverageEligibilityRequest")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -1182,13 +1145,13 @@ public Hl7.Fhir.Model.ResourceReference Request [Binding("RemittanceOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -1197,13 +1160,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -1213,28 +1173,25 @@ public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome /// [FhirElement("disposition", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -1247,13 +1204,13 @@ public string Disposition [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Patient insurance information. @@ -1263,39 +1220,36 @@ public Hl7.Fhir.Model.ResourceReference Insurer [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Preauthorization reference. /// [FhirElement("preAuthRef", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -1306,13 +1260,13 @@ public string PreAuthRef [FhirElement("form", Order=220)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Processing errors. @@ -1322,39 +1276,35 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageEligibilityResponse; - - if (dest == null) - { + if(other is not CoverageEligibilityResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PurposeElement.Any()) dest.PurposeElement = new List>(PurposeElement.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = new List>(_PurposeElement.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1366,132 +1316,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageEligibilityResponse; - if(otherT == null) return false; + if(other is not CoverageEligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement?.Any() == true; + value = _PurposeElement; + return _PurposeElement?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "purpose": - PurposeElement = (List>)value; + PurposeElement = (List>?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1502,21 +1452,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",PurposeElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs index 0dd55fab0..02a0a2600 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -102,28 +105,25 @@ public partial class CodeFilterComponent : Hl7.Fhir.Model.Element /// [FhirElement("path", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// A code-valued attribute to filter on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -133,28 +133,25 @@ public string Path /// [FhirElement("searchParam", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SearchParamElement + public Hl7.Fhir.Model.FhirString? SearchParamElement { get { return _SearchParamElement; } set { _SearchParamElement = value; OnPropertyChanged("SearchParamElement"); } } - private Hl7.Fhir.Model.FhirString _SearchParamElement; + private Hl7.Fhir.Model.FhirString? _SearchParamElement; /// /// A coded (token) parameter to search on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SearchParam + public string? SearchParam { - get { return SearchParamElement != null ? SearchParamElement.Value : null; } + get => _SearchParamElement?.Value; set { - if (value == null) - SearchParamElement = null; - else - SearchParamElement = new Hl7.Fhir.Model.FhirString(value); + SearchParamElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SearchParam"); } } @@ -164,28 +161,25 @@ public string SearchParam /// [FhirElement("valueSet", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Valueset for the filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -198,26 +192,22 @@ public string ValueSet [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as CodeFilterComponent; - - if (dest == null) - { + if(other is not CodeFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SearchParamElement != null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)SearchParamElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SearchParamElement is not null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)_SearchParamElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -229,55 +219,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeFilterComponent; - if(otherT == null) return false; + if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SearchParamElement, otherT.SearchParamElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "searchParam": - value = SearchParamElement; - return SearchParamElement is not null; + value = _SearchParamElement; + return _SearchParamElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "searchParam": - SearchParamElement = (Hl7.Fhir.Model.FhirString)value; + SearchParamElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; default: return base.SetValue(key, value); @@ -288,10 +278,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SearchParamElement is not null) yield return new KeyValuePair("searchParam",SearchParamElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SearchParamElement is not null) yield return new KeyValuePair("searchParam",_SearchParamElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); } } @@ -317,28 +307,25 @@ public partial class DateFilterComponent : Hl7.Fhir.Model.Element /// [FhirElement("path", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// A date-valued attribute to filter on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -348,28 +335,25 @@ public string Path /// [FhirElement("searchParam", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SearchParamElement + public Hl7.Fhir.Model.FhirString? SearchParamElement { get { return _SearchParamElement; } set { _SearchParamElement = value; OnPropertyChanged("SearchParamElement"); } } - private Hl7.Fhir.Model.FhirString _SearchParamElement; + private Hl7.Fhir.Model.FhirString? _SearchParamElement; /// /// A date valued parameter to search on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SearchParam + public string? SearchParam { - get { return SearchParamElement != null ? SearchParamElement.Value : null; } + get => _SearchParamElement?.Value; set { - if (value == null) - SearchParamElement = null; - else - SearchParamElement = new Hl7.Fhir.Model.FhirString(value); + SearchParamElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SearchParam"); } } @@ -381,27 +365,23 @@ public string SearchParam [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DateFilterComponent; - - if (dest == null) - { + if(other is not DateFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SearchParamElement != null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)SearchParamElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SearchParamElement is not null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)_SearchParamElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -413,48 +393,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateFilterComponent; - if(otherT == null) return false; + if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SearchParamElement, otherT.SearchParamElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "searchParam": - value = SearchParamElement; - return SearchParamElement is not null; + value = _SearchParamElement; + return _SearchParamElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "searchParam": - SearchParamElement = (Hl7.Fhir.Model.FhirString)value; + SearchParamElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -465,9 +445,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SearchParamElement is not null) yield return new KeyValuePair("searchParam",SearchParamElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SearchParamElement is not null) yield return new KeyValuePair("searchParam",_SearchParamElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -495,28 +475,25 @@ public partial class SortComponent : Hl7.Fhir.Model.Element [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The name of the attribute to perform the sort /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -529,13 +506,13 @@ public string Path [Binding("SortDirection")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code DirectionElement + public Code? DirectionElement { get { return _DirectionElement; } set { _DirectionElement = value; OnPropertyChanged("DirectionElement"); } } - private Code _DirectionElement; + private Code? _DirectionElement; /// /// ascending | descending @@ -544,29 +521,22 @@ public Code DirectionElement [IgnoreDataMember] public Hl7.Fhir.Model.DataRequirement.SortDirection? Direction { - get { return DirectionElement != null ? DirectionElement.Value : null; } + get => _DirectionElement?.Value; set { - if (value == null) - DirectionElement = null; - else - DirectionElement = new Code(value); + DirectionElement = value is null ? null : new Code(value); OnPropertyChanged("Direction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SortComponent; - - if (dest == null) - { + if(other is not SortComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(DirectionElement != null) dest.DirectionElement = (Code)DirectionElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_DirectionElement is not null) dest.DirectionElement = (Code)_DirectionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -578,41 +548,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SortComponent; - if(otherT == null) return false; + if(other is not SortComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(DirectionElement, otherT.DirectionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "direction": - value = DirectionElement; - return DirectionElement is not null; + value = _DirectionElement; + return _DirectionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "direction": - DirectionElement = (Code)value; + DirectionElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -623,8 +593,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (DirectionElement is not null) yield return new KeyValuePair("direction",DirectionElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_DirectionElement is not null) yield return new KeyValuePair("direction",_DirectionElement); } } @@ -637,13 +607,13 @@ public override IEnumerable> EnumerateElements() [Binding("FHIRAllTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// The type of the required data @@ -652,13 +622,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -671,24 +638,24 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// The profile of the required data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -704,13 +671,13 @@ public IEnumerable Profile [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Indicates specific structure elements that are referenced by the knowledge module. @@ -720,24 +687,24 @@ public Hl7.Fhir.Model.DataType Subject [DataMember] public List MustSupportElement { - get { if(_MustSupportElement==null) _MustSupportElement = new List(); return _MustSupportElement; } + get => _MustSupportElement ?? new List(); set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } - private List _MustSupportElement; + private List? _MustSupportElement; /// /// Indicates specific structure elements that are referenced by the knowledge module /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable MustSupport + public IEnumerable? MustSupport { - get { return MustSupportElement != null ? MustSupportElement.Select(elem => elem.Value) : null; } + get => _MustSupportElement?.Select(elem => elem.Value); set { if (value == null) - MustSupportElement = null; + MustSupportElement = null!; else MustSupportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("MustSupport"); @@ -752,11 +719,11 @@ public IEnumerable MustSupport [DataMember] public List CodeFilter { - get { if(_CodeFilter==null) _CodeFilter = new List(); return _CodeFilter; } + get => _CodeFilter ?? new List(); set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } - private List _CodeFilter; + private List? _CodeFilter; /// /// What dates/date ranges are expected. @@ -766,24 +733,24 @@ public List CodeFilter [DataMember] public List DateFilter { - get { if(_DateFilter==null) _DateFilter = new List(); return _DateFilter; } + get => _DateFilter ?? new List(); set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } - private List _DateFilter; + private List? _DateFilter; /// /// Number of results. /// [FhirElement("limit", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.PositiveInt LimitElement + public Hl7.Fhir.Model.PositiveInt? LimitElement { get { return _LimitElement; } set { _LimitElement = value; OnPropertyChanged("LimitElement"); } } - private Hl7.Fhir.Model.PositiveInt _LimitElement; + private Hl7.Fhir.Model.PositiveInt? _LimitElement; /// /// Number of results @@ -792,13 +759,10 @@ public Hl7.Fhir.Model.PositiveInt LimitElement [IgnoreDataMember] public int? Limit { - get { return LimitElement != null ? LimitElement.Value : null; } + get => _LimitElement?.Value; set { - if (value == null) - LimitElement = null; - else - LimitElement = new Hl7.Fhir.Model.PositiveInt(value); + LimitElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Limit"); } } @@ -811,30 +775,26 @@ public int? Limit [DataMember] public List Sort { - get { if(_Sort==null) _Sort = new List(); return _Sort; } + get => _Sort ?? new List(); set { _Sort = value; OnPropertyChanged("Sort"); } } - private List _Sort; + private List? _Sort; protected internal override void CopyToInternal(Base other) { - var dest = other as DataRequirement; - - if (dest == null) - { + if(other is not DataRequirement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(MustSupportElement.Any()) dest.MustSupportElement = new List(MustSupportElement.DeepCopyInternal()); - if(CodeFilter.Any()) dest.CodeFilter = new List(CodeFilter.DeepCopyInternal()); - if(DateFilter.Any()) dest.DateFilter = new List(DateFilter.DeepCopyInternal()); - if(LimitElement != null) dest.LimitElement = (Hl7.Fhir.Model.PositiveInt)LimitElement.DeepCopyInternal(); - if(Sort.Any()) dest.Sort = new List(Sort.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_MustSupportElement is not null) dest.MustSupportElement = new List(_MustSupportElement.DeepCopyInternal()); + if(_CodeFilter is not null) dest.CodeFilter = new List(_CodeFilter.DeepCopyInternal()); + if(_DateFilter is not null) dest.DateFilter = new List(_DateFilter.DeepCopyInternal()); + if(_LimitElement is not null) dest.LimitElement = (Hl7.Fhir.Model.PositiveInt)_LimitElement.DeepCopyInternal(); + if(_Sort is not null) dest.Sort = new List(_Sort.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -846,83 +806,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataRequirement; - if(otherT == null) return false; + if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(MustSupportElement, otherT.MustSupportElement)) return false; - if(!comparer.ListEquals(CodeFilter, otherT.CodeFilter)) return false; - if(!comparer.ListEquals(DateFilter, otherT.DateFilter)) return false; - if(!comparer.Equals(LimitElement, otherT.LimitElement)) return false; - if(!comparer.ListEquals(Sort, otherT.Sort)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; + if(!comparer.ListEquals(_CodeFilter, otherT._CodeFilter)) return false; + if(!comparer.ListEquals(_DateFilter, otherT._DateFilter)) return false; + if(!comparer.Equals(_LimitElement, otherT._LimitElement)) return false; + if(!comparer.ListEquals(_Sort, otherT._Sort)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "mustSupport": - value = MustSupportElement; - return MustSupportElement?.Any() == true; + value = _MustSupportElement; + return _MustSupportElement?.Any() == true; case "codeFilter": - value = CodeFilter; - return CodeFilter?.Any() == true; + value = _CodeFilter; + return _CodeFilter?.Any() == true; case "dateFilter": - value = DateFilter; - return DateFilter?.Any() == true; + value = _DateFilter; + return _DateFilter?.Any() == true; case "limit": - value = LimitElement; - return LimitElement is not null; + value = _LimitElement; + return _LimitElement is not null; case "sort": - value = Sort; - return Sort?.Any() == true; + value = _Sort; + return _Sort?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "mustSupport": - MustSupportElement = (List)value; + MustSupportElement = (List?)value!; return this; case "codeFilter": - CodeFilter = (List)value; + CodeFilter = (List?)value!; return this; case "dateFilter": - DateFilter = (List)value; + DateFilter = (List?)value!; return this; case "limit": - LimitElement = (Hl7.Fhir.Model.PositiveInt)value; + LimitElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "sort": - Sort = (List)value; + Sort = (List?)value!; return this; default: return base.SetValue(key, value); @@ -933,14 +893,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",MustSupportElement); - if (CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",CodeFilter); - if (DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",DateFilter); - if (LimitElement is not null) yield return new KeyValuePair("limit",LimitElement); - if (Sort?.Any() == true) yield return new KeyValuePair("sort",Sort); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",_MustSupportElement); + if (_CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",_CodeFilter); + if (_DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",_DateFilter); + if (_LimitElement is not null) yield return new KeyValuePair("limit",_LimitElement); + if (_Sort?.Any() == true) yield return new KeyValuePair("sort",_Sort); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs index 41eccec8f..41556e838 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("DetectedIssue","http://hl7.org/fhir/StructureDefinition/DetectedIssue")] - public partial class DetectedIssue : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class DetectedIssue : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -112,11 +115,11 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting information. @@ -128,24 +131,20 @@ public List Code [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceComponent; - - if (dest == null) - { + if(other is not EvidenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -157,41 +156,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceComponent; - if(otherT == null) return false; + if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -202,8 +201,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -231,41 +230,38 @@ public partial class MitigationComponent : Hl7.Fhir.Model.BackboneElement [Binding("DetectedIssueMitigationAction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Date committed. /// [FhirElement("date", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date committed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -277,27 +273,23 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; protected internal override void CopyToInternal(Base other) { - var dest = other as MitigationComponent; - - if (dest == null) - { + if(other is not MitigationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -309,48 +301,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MitigationComponent; - if(otherT == null) return false; + if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -361,9 +353,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } @@ -376,11 +368,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// registered | preliminary | final | amended +. @@ -390,13 +382,13 @@ public List Identifier [Binding("DetectedIssueStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -405,13 +397,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -422,13 +411,13 @@ public Hl7.Fhir.Model.ObservationStatus? Status [FhirElement("code", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("DetectedIssueCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// high | moderate | low. @@ -437,13 +426,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("DetectedIssueSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// high | moderate | low @@ -452,13 +441,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -470,13 +456,13 @@ public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When identified. @@ -485,13 +471,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Identified + public Hl7.Fhir.Model.DataType? Identified { get { return _Identified; } set { _Identified = value; OnPropertyChanged("Identified"); } } - private Hl7.Fhir.Model.DataType _Identified; + private Hl7.Fhir.Model.DataType? _Identified; /// /// The provider or device that identified the issue. @@ -500,13 +486,13 @@ public Hl7.Fhir.Model.DataType Identified [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Problem resource. @@ -518,11 +504,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Implicated { - get { if(_Implicated==null) _Implicated = new List(); return _Implicated; } + get => _Implicated ?? new List(); set { _Implicated = value; OnPropertyChanged("Implicated"); } } - private List _Implicated; + private List? _Implicated; /// /// Supporting evidence. @@ -532,39 +518,36 @@ public List Implicated [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; /// /// Description and context. /// [FhirElement("detail", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DetailElement + public Hl7.Fhir.Model.FhirString? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirString _DetailElement; + private Hl7.Fhir.Model.FhirString? _DetailElement; /// /// Description and context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirString(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Detail"); } } @@ -574,28 +557,25 @@ public string Detail /// [FhirElement("reference", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Authority for issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } @@ -608,39 +588,35 @@ public string Reference [DataMember] public List Mitigation { - get { if(_Mitigation==null) _Mitigation = new List(); return _Mitigation; } + get => _Mitigation ?? new List(); set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } - private List _Mitigation; + private List? _Mitigation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as DetectedIssue; - - if (dest == null) - { + if(other is not DetectedIssue dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Identified != null) dest.Identified = (Hl7.Fhir.Model.DataType)Identified.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Implicated.Any()) dest.Implicated = new List(Implicated.DeepCopyInternal()); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); - if(Mitigation.Any()) dest.Mitigation = new List(Mitigation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Identified is not null) dest.Identified = (Hl7.Fhir.Model.DataType)_Identified.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Implicated is not null) dest.Implicated = new List(_Implicated.DeepCopyInternal()); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)_DetailElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); + if(_Mitigation is not null) dest.Mitigation = new List(_Mitigation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -652,111 +628,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetectedIssue; - if(otherT == null) return false; + if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Identified, otherT.Identified)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Implicated, otherT.Implicated)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(Mitigation, otherT.Mitigation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Identified, otherT._Identified)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Implicated, otherT._Implicated)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "identified": - value = Identified; - return Identified is not null; + value = _Identified; + return _Identified is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "implicated": - value = Implicated; - return Implicated?.Any() == true; + value = _Implicated; + return _Implicated?.Any() == true; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "mitigation": - value = Mitigation; - return Mitigation?.Any() == true; + value = _Mitigation; + return _Mitigation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "identified": - Identified = (Hl7.Fhir.Model.DataType)value; + Identified = (Hl7.Fhir.Model.DataType?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "implicated": - Implicated = (List)value; + Implicated = (List?)value!; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirString)value; + DetailElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "mitigation": - Mitigation = (List)value; + Mitigation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -767,18 +743,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Identified is not null) yield return new KeyValuePair("identified",Identified); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Implicated?.Any() == true) yield return new KeyValuePair("implicated",Implicated); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",Mitigation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Identified is not null) yield return new KeyValuePair("identified",_Identified); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Implicated?.Any() == true) yield return new KeyValuePair("implicated",_Implicated); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",_Mitigation); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Device.cs b/src/Hl7.Fhir.R4/Model/Generated/Device.cs index 976c17ecc..ecb835d09 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Device.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Device","http://hl7.org/fhir/StructureDefinition/Device")] - public partial class Device : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Device : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -161,28 +164,25 @@ public partial class UdiCarrierComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("deviceIdentifier", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// Mandatory fixed portion of UDI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -192,28 +192,25 @@ public string DeviceIdentifier /// [FhirElement("issuer", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// UDI Issuing Organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -223,28 +220,25 @@ public string Issuer /// [FhirElement("jurisdiction", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// Regional UDI authority /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } @@ -254,28 +248,25 @@ public string Jurisdiction /// [FhirElement("carrierAIDC", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Base64Binary CarrierAIDCElement + public Hl7.Fhir.Model.Base64Binary? CarrierAIDCElement { get { return _CarrierAIDCElement; } set { _CarrierAIDCElement = value; OnPropertyChanged("CarrierAIDCElement"); } } - private Hl7.Fhir.Model.Base64Binary _CarrierAIDCElement; + private Hl7.Fhir.Model.Base64Binary? _CarrierAIDCElement; /// /// UDI Machine Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] CarrierAIDC + public byte[]? CarrierAIDC { - get { return CarrierAIDCElement != null ? CarrierAIDCElement.Value : null; } + get => _CarrierAIDCElement?.Value; set { - if (value == null) - CarrierAIDCElement = null; - else - CarrierAIDCElement = new Hl7.Fhir.Model.Base64Binary(value); + CarrierAIDCElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("CarrierAIDC"); } } @@ -285,28 +276,25 @@ public byte[] CarrierAIDC /// [FhirElement("carrierHRF", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CarrierHRFElement + public Hl7.Fhir.Model.FhirString? CarrierHRFElement { get { return _CarrierHRFElement; } set { _CarrierHRFElement = value; OnPropertyChanged("CarrierHRFElement"); } } - private Hl7.Fhir.Model.FhirString _CarrierHRFElement; + private Hl7.Fhir.Model.FhirString? _CarrierHRFElement; /// /// UDI Human Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CarrierHRF + public string? CarrierHRF { - get { return CarrierHRFElement != null ? CarrierHRFElement.Value : null; } + get => _CarrierHRFElement?.Value; set { - if (value == null) - CarrierHRFElement = null; - else - CarrierHRFElement = new Hl7.Fhir.Model.FhirString(value); + CarrierHRFElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CarrierHRF"); } } @@ -318,13 +306,13 @@ public string CarrierHRF [DeclaredType(Type = typeof(Code))] [Binding("UDIEntryType")] [DataMember] - public Code EntryTypeElement + public Code? EntryTypeElement { get { return _EntryTypeElement; } set { _EntryTypeElement = value; OnPropertyChanged("EntryTypeElement"); } } - private Code _EntryTypeElement; + private Code? _EntryTypeElement; /// /// barcode | rfid | manual + @@ -333,33 +321,26 @@ public Code EntryTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.UDIEntryType? EntryType { - get { return EntryTypeElement != null ? EntryTypeElement.Value : null; } + get => _EntryTypeElement?.Value; set { - if (value == null) - EntryTypeElement = null; - else - EntryTypeElement = new Code(value); + EntryTypeElement = value is null ? null : new Code(value); OnPropertyChanged("EntryType"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UdiCarrierComponent; - - if (dest == null) - { + if(other is not UdiCarrierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); - if(CarrierAIDCElement != null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)CarrierAIDCElement.DeepCopyInternal(); - if(CarrierHRFElement != null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)CarrierHRFElement.DeepCopyInternal(); - if(EntryTypeElement != null) dest.EntryTypeElement = (Code)EntryTypeElement.DeepCopyInternal(); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); + if(_CarrierAIDCElement is not null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)_CarrierAIDCElement.DeepCopyInternal(); + if(_CarrierHRFElement is not null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)_CarrierHRFElement.DeepCopyInternal(); + if(_EntryTypeElement is not null) dest.EntryTypeElement = (Code)_EntryTypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -371,69 +352,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiCarrierComponent; - if(otherT == null) return false; + if(other is not UdiCarrierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; - if(!comparer.Equals(CarrierAIDCElement, otherT.CarrierAIDCElement)) return false; - if(!comparer.Equals(CarrierHRFElement, otherT.CarrierHRFElement)) return false; - if(!comparer.Equals(EntryTypeElement, otherT.EntryTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; + if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; + if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; + if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; case "carrierAIDC": - value = CarrierAIDCElement; - return CarrierAIDCElement is not null; + value = _CarrierAIDCElement; + return _CarrierAIDCElement is not null; case "carrierHRF": - value = CarrierHRFElement; - return CarrierHRFElement is not null; + value = _CarrierHRFElement; + return _CarrierHRFElement is not null; case "entryType": - value = EntryTypeElement; - return EntryTypeElement is not null; + value = _EntryTypeElement; + return _EntryTypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "carrierAIDC": - CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)value; + CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "carrierHRF": - CarrierHRFElement = (Hl7.Fhir.Model.FhirString)value; + CarrierHRFElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "entryType": - EntryTypeElement = (Code)value; + EntryTypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -444,12 +425,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); - if (CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",CarrierAIDCElement); - if (CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",CarrierHRFElement); - if (EntryTypeElement is not null) yield return new KeyValuePair("entryType",EntryTypeElement); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); + if (_CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",_CarrierAIDCElement); + if (_CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",_CarrierHRFElement); + if (_EntryTypeElement is not null) yield return new KeyValuePair("entryType",_EntryTypeElement); } } @@ -476,28 +457,25 @@ public partial class DeviceNameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name of the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -510,13 +488,13 @@ public string Name [Binding("DeviceNameType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// udi-label-name | user-friendly-name | patient-reported-name | manufacturer-name | model-name | other @@ -525,29 +503,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceNameType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceNameComponent; - - if (dest == null) - { + if(other is not DeviceNameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -559,41 +530,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceNameComponent; - if(otherT == null) return false; + if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -604,8 +575,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -629,57 +600,50 @@ public partial class SpecializationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("systemType", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SystemType + public Hl7.Fhir.Model.CodeableConcept? SystemType { get { return _SystemType; } set { _SystemType = value; OnPropertyChanged("SystemType"); } } - private Hl7.Fhir.Model.CodeableConcept _SystemType; + private Hl7.Fhir.Model.CodeableConcept? _SystemType; /// /// The version of the standard that is used to operate and communicate. /// [FhirElement("version", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// The version of the standard that is used to operate and communicate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SpecializationComponent; - - if (dest == null) - { + if(other is not SpecializationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemType != null) dest.SystemType = (Hl7.Fhir.Model.CodeableConcept)SystemType.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_SystemType is not null) dest.SystemType = (Hl7.Fhir.Model.CodeableConcept)_SystemType.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -691,41 +655,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecializationComponent; - if(otherT == null) return false; + if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemType, otherT.SystemType)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemType, otherT._SystemType)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "systemType": - value = SystemType; - return SystemType is not null; + value = _SystemType; + return _SystemType is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "systemType": - SystemType = (Hl7.Fhir.Model.CodeableConcept)value; + SystemType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -736,8 +700,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemType is not null) yield return new KeyValuePair("systemType",SystemType); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_SystemType is not null) yield return new KeyValuePair("systemType",_SystemType); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -760,26 +724,26 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A single component of the device version. /// [FhirElement("component", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Identifier Component + public Hl7.Fhir.Model.Identifier? Component { get { return _Component; } set { _Component = value; OnPropertyChanged("Component"); } } - private Hl7.Fhir.Model.Identifier _Component; + private Hl7.Fhir.Model.Identifier? _Component; /// /// The version text. @@ -787,45 +751,38 @@ public Hl7.Fhir.Model.Identifier Component [FhirElement("value", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The version text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Component != null) dest.Component = (Hl7.Fhir.Model.Identifier)Component.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Component is not null) dest.Component = (Hl7.Fhir.Model.Identifier)_Component.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -837,48 +794,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Component, otherT.Component)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Component, otherT._Component)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "component": - value = Component; - return Component is not null; + value = _Component; + return _Component is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "component": - Component = (Hl7.Fhir.Model.Identifier)value; + Component = (Hl7.Fhir.Model.Identifier?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -889,9 +846,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Component is not null) yield return new KeyValuePair("component",Component); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Component is not null) yield return new KeyValuePair("component",_Component); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -915,13 +872,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Property value as a quantity. @@ -931,11 +888,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List ValueQuantity { - get { if(_ValueQuantity==null) _ValueQuantity = new List(); return _ValueQuantity; } + get => _ValueQuantity ?? new List(); set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } - private List _ValueQuantity; + private List? _ValueQuantity; /// /// Property value as a code, e.g., NTP4 (synced to NTP). @@ -945,25 +902,21 @@ public List ValueQuantity [DataMember] public List ValueCode { - get { if(_ValueCode==null) _ValueCode = new List(); return _ValueCode; } + get => _ValueCode ?? new List(); set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } - private List _ValueCode; + private List? _ValueCode; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueQuantity.Any()) dest.ValueQuantity = new List(ValueQuantity.DeepCopyInternal()); - if(ValueCode.Any()) dest.ValueCode = new List(ValueCode.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueQuantity is not null) dest.ValueQuantity = new List(_ValueQuantity.DeepCopyInternal()); + if(_ValueCode is not null) dest.ValueCode = new List(_ValueCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -975,48 +928,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(ValueQuantity, otherT.ValueQuantity)) return false; - if(!comparer.ListEquals(ValueCode, otherT.ValueCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; + if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "valueQuantity": - value = ValueQuantity; - return ValueQuantity?.Any() == true; + value = _ValueQuantity; + return _ValueQuantity?.Any() == true; case "valueCode": - value = ValueCode; - return ValueCode?.Any() == true; + value = _ValueCode; + return _ValueCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "valueQuantity": - ValueQuantity = (List)value; + ValueQuantity = (List?)value!; return this; case "valueCode": - ValueCode = (List)value; + ValueCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1027,9 +980,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",ValueQuantity); - if (ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",ValueCode); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",_ValueQuantity); + if (_ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",_ValueCode); } } @@ -1042,11 +995,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The reference to the definition for the device. @@ -1055,13 +1008,13 @@ public List Identifier [CLSCompliant(false)] [References("DeviceDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; /// /// Unique Device Identifier (UDI) Barcode string. @@ -1071,11 +1024,11 @@ public Hl7.Fhir.Model.ResourceReference Definition [DataMember] public List UdiCarrier { - get { if(_UdiCarrier==null) _UdiCarrier = new List(); return _UdiCarrier; } + get => _UdiCarrier ?? new List(); set { _UdiCarrier = value; OnPropertyChanged("UdiCarrier"); } } - private List _UdiCarrier; + private List? _UdiCarrier; /// /// active | inactive | entered-in-error | unknown. @@ -1084,13 +1037,13 @@ public List UdiCarrier [DeclaredType(Type = typeof(Code))] [Binding("FHIRDeviceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error | unknown @@ -1099,13 +1052,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1119,39 +1069,36 @@ public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// The distinct identification string. /// [FhirElement("distinctIdentifier", Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DistinctIdentifierElement + public Hl7.Fhir.Model.FhirString? DistinctIdentifierElement { get { return _DistinctIdentifierElement; } set { _DistinctIdentifierElement = value; OnPropertyChanged("DistinctIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DistinctIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DistinctIdentifierElement; /// /// The distinct identification string /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DistinctIdentifier + public string? DistinctIdentifier { - get { return DistinctIdentifierElement != null ? DistinctIdentifierElement.Value : null; } + get => _DistinctIdentifierElement?.Value; set { - if (value == null) - DistinctIdentifierElement = null; - else - DistinctIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DistinctIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DistinctIdentifier"); } } @@ -1161,28 +1108,25 @@ public string DistinctIdentifier /// [FhirElement("manufacturer", Order=150, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ManufacturerElement + public Hl7.Fhir.Model.FhirString? ManufacturerElement { get { return _ManufacturerElement; } set { _ManufacturerElement = value; OnPropertyChanged("ManufacturerElement"); } } - private Hl7.Fhir.Model.FhirString _ManufacturerElement; + private Hl7.Fhir.Model.FhirString? _ManufacturerElement; /// /// Name of device manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Manufacturer + public string? Manufacturer { - get { return ManufacturerElement != null ? ManufacturerElement.Value : null; } + get => _ManufacturerElement?.Value; set { - if (value == null) - ManufacturerElement = null; - else - ManufacturerElement = new Hl7.Fhir.Model.FhirString(value); + ManufacturerElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Manufacturer"); } } @@ -1192,28 +1136,25 @@ public string Manufacturer /// [FhirElement("manufactureDate", Order=160, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ManufactureDateElement + public Hl7.Fhir.Model.FhirDateTime? ManufactureDateElement { get { return _ManufactureDateElement; } set { _ManufactureDateElement = value; OnPropertyChanged("ManufactureDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ManufactureDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ManufactureDateElement; /// /// Date when the device was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ManufactureDate + public string? ManufactureDate { - get { return ManufactureDateElement != null ? ManufactureDateElement.Value : null; } + get => _ManufactureDateElement?.Value; set { - if (value == null) - ManufactureDateElement = null; - else - ManufactureDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ManufactureDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ManufactureDate"); } } @@ -1223,28 +1164,25 @@ public string ManufactureDate /// [FhirElement("expirationDate", Order=170, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// Date and time of expiry of this device (if applicable) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } @@ -1254,28 +1192,25 @@ public string ExpirationDate /// [FhirElement("lotNumber", Order=180, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Lot number of manufacture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -1285,28 +1220,25 @@ public string LotNumber /// [FhirElement("serialNumber", Order=190, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString SerialNumberElement + public Hl7.Fhir.Model.FhirString? SerialNumberElement { get { return _SerialNumberElement; } set { _SerialNumberElement = value; OnPropertyChanged("SerialNumberElement"); } } - private Hl7.Fhir.Model.FhirString _SerialNumberElement; + private Hl7.Fhir.Model.FhirString? _SerialNumberElement; /// /// Serial number assigned by the manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SerialNumber + public string? SerialNumber { - get { return SerialNumberElement != null ? SerialNumberElement.Value : null; } + get => _SerialNumberElement?.Value; set { - if (value == null) - SerialNumberElement = null; - else - SerialNumberElement = new Hl7.Fhir.Model.FhirString(value); + SerialNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SerialNumber"); } } @@ -1319,39 +1251,36 @@ public string SerialNumber [DataMember] public List DeviceName { - get { if(_DeviceName==null) _DeviceName = new List(); return _DeviceName; } + get => _DeviceName ?? new List(); set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } - private List _DeviceName; + private List? _DeviceName; /// /// The model number for the device. /// [FhirElement("modelNumber", Order=210, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ModelNumberElement + public Hl7.Fhir.Model.FhirString? ModelNumberElement { get { return _ModelNumberElement; } set { _ModelNumberElement = value; OnPropertyChanged("ModelNumberElement"); } } - private Hl7.Fhir.Model.FhirString _ModelNumberElement; + private Hl7.Fhir.Model.FhirString? _ModelNumberElement; /// /// The model number for the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ModelNumber + public string? ModelNumber { - get { return ModelNumberElement != null ? ModelNumberElement.Value : null; } + get => _ModelNumberElement?.Value; set { - if (value == null) - ModelNumberElement = null; - else - ModelNumberElement = new Hl7.Fhir.Model.FhirString(value); + ModelNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ModelNumber"); } } @@ -1361,28 +1290,25 @@ public string ModelNumber /// [FhirElement("partNumber", Order=220, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString PartNumberElement + public Hl7.Fhir.Model.FhirString? PartNumberElement { get { return _PartNumberElement; } set { _PartNumberElement = value; OnPropertyChanged("PartNumberElement"); } } - private Hl7.Fhir.Model.FhirString _PartNumberElement; + private Hl7.Fhir.Model.FhirString? _PartNumberElement; /// /// The part number of the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PartNumber + public string? PartNumber { - get { return PartNumberElement != null ? PartNumberElement.Value : null; } + get => _PartNumberElement?.Value; set { - if (value == null) - PartNumberElement = null; - else - PartNumberElement = new Hl7.Fhir.Model.FhirString(value); + PartNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PartNumber"); } } @@ -1393,13 +1319,13 @@ public string PartNumber [FhirElement("type", Order=230)] [Binding("DeviceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The capabilities supported on a device, the standards to which the device conforms for a particular purpose, and used for the communication. @@ -1409,11 +1335,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Specialization { - get { if(_Specialization==null) _Specialization = new List(); return _Specialization; } + get => _Specialization ?? new List(); set { _Specialization = value; OnPropertyChanged("Specialization"); } } - private List _Specialization; + private List? _Specialization; /// /// The actual design of the device or software version running on the device. @@ -1423,11 +1349,11 @@ public List Specialization [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties. @@ -1437,11 +1363,11 @@ public List Version [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Patient to whom Device is affixed. @@ -1450,13 +1376,13 @@ public List Property [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Organization responsible for device. @@ -1465,13 +1391,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Details for human/organization for support. @@ -1481,11 +1407,11 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Where the device is found. @@ -1494,41 +1420,38 @@ public List Contact [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Network address to contact device. /// [FhirElement("url", Order=310, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Network address to contact device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1541,11 +1464,11 @@ public string Url [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Safety Characteristics of Device. @@ -1555,11 +1478,11 @@ public List Note [DataMember] public List Safety { - get { if(_Safety==null) _Safety = new List(); return _Safety; } + get => _Safety ?? new List(); set { _Safety = value; OnPropertyChanged("Safety"); } } - private List _Safety; + private List? _Safety; /// /// The parent device. @@ -1568,55 +1491,51 @@ public List Safety [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Device; - - if (dest == null) - { + if(other is not Device dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); - if(UdiCarrier.Any()) dest.UdiCarrier = new List(UdiCarrier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(DistinctIdentifierElement != null) dest.DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString)DistinctIdentifierElement.DeepCopyInternal(); - if(ManufacturerElement != null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)ManufacturerElement.DeepCopyInternal(); - if(ManufactureDateElement != null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)ManufactureDateElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(SerialNumberElement != null) dest.SerialNumberElement = (Hl7.Fhir.Model.FhirString)SerialNumberElement.DeepCopyInternal(); - if(DeviceName.Any()) dest.DeviceName = new List(DeviceName.DeepCopyInternal()); - if(ModelNumberElement != null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)ModelNumberElement.DeepCopyInternal(); - if(PartNumberElement != null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)PartNumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Specialization.Any()) dest.Specialization = new List(Specialization.DeepCopyInternal()); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Safety.Any()) dest.Safety = new List(Safety.DeepCopyInternal()); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); + if(_UdiCarrier is not null) dest.UdiCarrier = new List(_UdiCarrier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_DistinctIdentifierElement is not null) dest.DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString)_DistinctIdentifierElement.DeepCopyInternal(); + if(_ManufacturerElement is not null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)_ManufacturerElement.DeepCopyInternal(); + if(_ManufactureDateElement is not null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)_ManufactureDateElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_SerialNumberElement is not null) dest.SerialNumberElement = (Hl7.Fhir.Model.FhirString)_SerialNumberElement.DeepCopyInternal(); + if(_DeviceName is not null) dest.DeviceName = new List(_DeviceName.DeepCopyInternal()); + if(_ModelNumberElement is not null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)_ModelNumberElement.DeepCopyInternal(); + if(_PartNumberElement is not null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)_PartNumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Specialization is not null) dest.Specialization = new List(_Specialization.DeepCopyInternal()); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Safety is not null) dest.Safety = new List(_Safety.DeepCopyInternal()); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1628,209 +1547,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Device; - if(otherT == null) return false; + if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(UdiCarrier, otherT.UdiCarrier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(DistinctIdentifierElement, otherT.DistinctIdentifierElement)) return false; - if(!comparer.Equals(ManufacturerElement, otherT.ManufacturerElement)) return false; - if(!comparer.Equals(ManufactureDateElement, otherT.ManufactureDateElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(SerialNumberElement, otherT.SerialNumberElement)) return false; - if(!comparer.ListEquals(DeviceName, otherT.DeviceName)) return false; - if(!comparer.Equals(ModelNumberElement, otherT.ModelNumberElement)) return false; - if(!comparer.Equals(PartNumberElement, otherT.PartNumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialization, otherT.Specialization)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Safety, otherT.Safety)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_UdiCarrier, otherT._UdiCarrier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_DistinctIdentifierElement, otherT._DistinctIdentifierElement)) return false; + if(!comparer.Equals(_ManufacturerElement, otherT._ManufacturerElement)) return false; + if(!comparer.Equals(_ManufactureDateElement, otherT._ManufactureDateElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_SerialNumberElement, otherT._SerialNumberElement)) return false; + if(!comparer.ListEquals(_DeviceName, otherT._DeviceName)) return false; + if(!comparer.Equals(_ModelNumberElement, otherT._ModelNumberElement)) return false; + if(!comparer.Equals(_PartNumberElement, otherT._PartNumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialization, otherT._Specialization)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "udiCarrier": - value = UdiCarrier; - return UdiCarrier?.Any() == true; + value = _UdiCarrier; + return _UdiCarrier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "distinctIdentifier": - value = DistinctIdentifierElement; - return DistinctIdentifierElement is not null; + value = _DistinctIdentifierElement; + return _DistinctIdentifierElement is not null; case "manufacturer": - value = ManufacturerElement; - return ManufacturerElement is not null; + value = _ManufacturerElement; + return _ManufacturerElement is not null; case "manufactureDate": - value = ManufactureDateElement; - return ManufactureDateElement is not null; + value = _ManufactureDateElement; + return _ManufactureDateElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "serialNumber": - value = SerialNumberElement; - return SerialNumberElement is not null; + value = _SerialNumberElement; + return _SerialNumberElement is not null; case "deviceName": - value = DeviceName; - return DeviceName?.Any() == true; + value = _DeviceName; + return _DeviceName?.Any() == true; case "modelNumber": - value = ModelNumberElement; - return ModelNumberElement is not null; + value = _ModelNumberElement; + return _ModelNumberElement is not null; case "partNumber": - value = PartNumberElement; - return PartNumberElement is not null; + value = _PartNumberElement; + return _PartNumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "specialization": - value = Specialization; - return Specialization?.Any() == true; + value = _Specialization; + return _Specialization?.Any() == true; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "safety": - value = Safety; - return Safety?.Any() == true; + value = _Safety; + return _Safety?.Any() == true; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "udiCarrier": - UdiCarrier = (List)value; + UdiCarrier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "distinctIdentifier": - DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufacturer": - ManufacturerElement = (Hl7.Fhir.Model.FhirString)value; + ManufacturerElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufactureDate": - ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "serialNumber": - SerialNumberElement = (Hl7.Fhir.Model.FhirString)value; + SerialNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "deviceName": - DeviceName = (List)value; + DeviceName = (List?)value!; return this; case "modelNumber": - ModelNumberElement = (Hl7.Fhir.Model.FhirString)value; + ModelNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "partNumber": - PartNumberElement = (Hl7.Fhir.Model.FhirString)value; + PartNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialization": - Specialization = (List)value; + Specialization = (List?)value!; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "safety": - Safety = (List)value; + Safety = (List?)value!; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1841,32 +1760,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (UdiCarrier?.Any() == true) yield return new KeyValuePair("udiCarrier",UdiCarrier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (DistinctIdentifierElement is not null) yield return new KeyValuePair("distinctIdentifier",DistinctIdentifierElement); - if (ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",ManufacturerElement); - if (ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",ManufactureDateElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (SerialNumberElement is not null) yield return new KeyValuePair("serialNumber",SerialNumberElement); - if (DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",DeviceName); - if (ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",ModelNumberElement); - if (PartNumberElement is not null) yield return new KeyValuePair("partNumber",PartNumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Specialization?.Any() == true) yield return new KeyValuePair("specialization",Specialization); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Safety?.Any() == true) yield return new KeyValuePair("safety",Safety); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_UdiCarrier?.Any() == true) yield return new KeyValuePair("udiCarrier",_UdiCarrier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_DistinctIdentifierElement is not null) yield return new KeyValuePair("distinctIdentifier",_DistinctIdentifierElement); + if (_ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",_ManufacturerElement); + if (_ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",_ManufactureDateElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_SerialNumberElement is not null) yield return new KeyValuePair("serialNumber",_SerialNumberElement); + if (_DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",_DeviceName); + if (_ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",_ModelNumberElement); + if (_PartNumberElement is not null) yield return new KeyValuePair("partNumber",_PartNumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Specialization?.Any() == true) yield return new KeyValuePair("specialization",_Specialization); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Safety?.Any() == true) yield return new KeyValuePair("safety",_Safety); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs index 4818907ee..545a3ca23 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,28 +85,25 @@ public partial class UdiDeviceIdentifierComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("deviceIdentifier", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdication porvided in the DeviceDefinition.udiDeviceIdentifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -114,28 +114,25 @@ public string DeviceIdentifier [FhirElement("issuer", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// The organization that assigns the identifier algorithm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -146,45 +143,38 @@ public string Issuer [FhirElement("jurisdiction", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// The jurisdiction to which the deviceIdentifier applies /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UdiDeviceIdentifierComponent; - - if (dest == null) - { + if(other is not UdiDeviceIdentifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -196,48 +186,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiDeviceIdentifierComponent; - if(otherT == null) return false; + if(other is not UdiDeviceIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -248,9 +238,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); } } @@ -274,28 +264,25 @@ public partial class DeviceNameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name of the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -308,13 +295,13 @@ public string Name [Binding("DeviceNameType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// udi-label-name | user-friendly-name | patient-reported-name | manufacturer-name | model-name | other @@ -323,29 +310,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceNameType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceNameComponent; - - if (dest == null) - { + if(other is not DeviceNameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -357,41 +337,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceNameComponent; - if(otherT == null) return false; + if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -402,8 +382,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -427,28 +407,25 @@ public partial class SpecializationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("systemType", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SystemTypeElement + public Hl7.Fhir.Model.FhirString? SystemTypeElement { get { return _SystemTypeElement; } set { _SystemTypeElement = value; OnPropertyChanged("SystemTypeElement"); } } - private Hl7.Fhir.Model.FhirString _SystemTypeElement; + private Hl7.Fhir.Model.FhirString? _SystemTypeElement; /// /// The standard that is used to operate and communicate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SystemType + public string? SystemType { - get { return SystemTypeElement != null ? SystemTypeElement.Value : null; } + get => _SystemTypeElement?.Value; set { - if (value == null) - SystemTypeElement = null; - else - SystemTypeElement = new Hl7.Fhir.Model.FhirString(value); + SystemTypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SystemType"); } } @@ -458,44 +435,37 @@ public string SystemType /// [FhirElement("version", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// The version of the standard that is used to operate and communicate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SpecializationComponent; - - if (dest == null) - { + if(other is not SpecializationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemTypeElement != null) dest.SystemTypeElement = (Hl7.Fhir.Model.FhirString)SystemTypeElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_SystemTypeElement is not null) dest.SystemTypeElement = (Hl7.Fhir.Model.FhirString)_SystemTypeElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -507,41 +477,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecializationComponent; - if(otherT == null) return false; + if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemTypeElement, otherT.SystemTypeElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemTypeElement, otherT._SystemTypeElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "systemType": - value = SystemTypeElement; - return SystemTypeElement is not null; + value = _SystemTypeElement; + return _SystemTypeElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "systemType": - SystemTypeElement = (Hl7.Fhir.Model.FhirString)value; + SystemTypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -552,8 +522,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemTypeElement is not null) yield return new KeyValuePair("systemType",SystemTypeElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_SystemTypeElement is not null) yield return new KeyValuePair("systemType",_SystemTypeElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -577,13 +547,13 @@ public partial class CapabilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Description of capability. @@ -593,24 +563,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Description { - get { if(_Description==null) _Description = new List(); return _Description; } + get => _Description ?? new List(); set { _Description = value; OnPropertyChanged("Description"); } } - private List _Description; + private List? _Description; protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityComponent; - - if (dest == null) - { + if(other is not CapabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Description.Any()) dest.Description = new List(Description.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Description is not null) dest.Description = new List(_Description.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -622,41 +588,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityComponent; - if(otherT == null) return false; + if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Description, otherT.Description)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Description, otherT._Description)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = Description; - return Description?.Any() == true; + value = _Description; + return _Description?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (List)value; + Description = (List?)value!; return this; default: return base.SetValue(key, value); @@ -667,8 +633,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Description?.Any() == true) yield return new KeyValuePair("description",Description); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Description?.Any() == true) yield return new KeyValuePair("description",_Description); } } @@ -692,13 +658,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Property value as a quantity. @@ -708,11 +674,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List ValueQuantity { - get { if(_ValueQuantity==null) _ValueQuantity = new List(); return _ValueQuantity; } + get => _ValueQuantity ?? new List(); set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } - private List _ValueQuantity; + private List? _ValueQuantity; /// /// Property value as a code, e.g., NTP4 (synced to NTP). @@ -722,25 +688,21 @@ public List ValueQuantity [DataMember] public List ValueCode { - get { if(_ValueCode==null) _ValueCode = new List(); return _ValueCode; } + get => _ValueCode ?? new List(); set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } - private List _ValueCode; + private List? _ValueCode; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueQuantity.Any()) dest.ValueQuantity = new List(ValueQuantity.DeepCopyInternal()); - if(ValueCode.Any()) dest.ValueCode = new List(ValueCode.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueQuantity is not null) dest.ValueQuantity = new List(_ValueQuantity.DeepCopyInternal()); + if(_ValueCode is not null) dest.ValueCode = new List(_ValueCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -752,48 +714,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(ValueQuantity, otherT.ValueQuantity)) return false; - if(!comparer.ListEquals(ValueCode, otherT.ValueCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; + if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "valueQuantity": - value = ValueQuantity; - return ValueQuantity?.Any() == true; + value = _ValueQuantity; + return _ValueQuantity?.Any() == true; case "valueCode": - value = ValueCode; - return ValueCode?.Any() == true; + value = _ValueCode; + return _ValueCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "valueQuantity": - ValueQuantity = (List)value; + ValueQuantity = (List?)value!; return this; case "valueCode": - ValueCode = (List)value; + ValueCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -804,9 +766,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",ValueQuantity); - if (ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",ValueCode); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",_ValueQuantity); + if (_ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",_ValueCode); } } @@ -830,26 +792,26 @@ public partial class MaterialComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Indicates an alternative material of the device. /// [FhirElement("alternate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AlternateElement + public Hl7.Fhir.Model.FhirBoolean? AlternateElement { get { return _AlternateElement; } set { _AlternateElement = value; OnPropertyChanged("AlternateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AlternateElement; + private Hl7.Fhir.Model.FhirBoolean? _AlternateElement; /// /// Indicates an alternative material of the device @@ -858,13 +820,10 @@ public Hl7.Fhir.Model.FhirBoolean AlternateElement [IgnoreDataMember] public bool? Alternate { - get { return AlternateElement != null ? AlternateElement.Value : null; } + get => _AlternateElement?.Value; set { - if (value == null) - AlternateElement = null; - else - AlternateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AlternateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Alternate"); } } @@ -874,13 +833,13 @@ public bool? Alternate /// [FhirElement("allergenicIndicator", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? AllergenicIndicatorElement { get { return _AllergenicIndicatorElement; } set { _AllergenicIndicatorElement = value; OnPropertyChanged("AllergenicIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllergenicIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _AllergenicIndicatorElement; /// /// Whether the substance is a known or suspected allergen @@ -889,30 +848,23 @@ public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement [IgnoreDataMember] public bool? AllergenicIndicator { - get { return AllergenicIndicatorElement != null ? AllergenicIndicatorElement.Value : null; } + get => _AllergenicIndicatorElement?.Value; set { - if (value == null) - AllergenicIndicatorElement = null; - else - AllergenicIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllergenicIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllergenicIndicator"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MaterialComponent; - - if (dest == null) - { + if(other is not MaterialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(AlternateElement != null) dest.AlternateElement = (Hl7.Fhir.Model.FhirBoolean)AlternateElement.DeepCopyInternal(); - if(AllergenicIndicatorElement != null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)AllergenicIndicatorElement.DeepCopyInternal(); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_AlternateElement is not null) dest.AlternateElement = (Hl7.Fhir.Model.FhirBoolean)_AlternateElement.DeepCopyInternal(); + if(_AllergenicIndicatorElement is not null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_AllergenicIndicatorElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -924,48 +876,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MaterialComponent; - if(otherT == null) return false; + if(other is not MaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.Equals(AlternateElement, otherT.AlternateElement)) return false; - if(!comparer.Equals(AllergenicIndicatorElement, otherT.AllergenicIndicatorElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.Equals(_AlternateElement, otherT._AlternateElement)) return false; + if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "alternate": - value = AlternateElement; - return AlternateElement is not null; + value = _AlternateElement; + return _AlternateElement is not null; case "allergenicIndicator": - value = AllergenicIndicatorElement; - return AllergenicIndicatorElement is not null; + value = _AllergenicIndicatorElement; + return _AllergenicIndicatorElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "alternate": - AlternateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AlternateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "allergenicIndicator": - AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -976,9 +928,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (AlternateElement is not null) yield return new KeyValuePair("alternate",AlternateElement); - if (AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",AllergenicIndicatorElement); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_AlternateElement is not null) yield return new KeyValuePair("alternate",_AlternateElement); + if (_AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",_AllergenicIndicatorElement); } } @@ -991,11 +943,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Unique Device Identifier (UDI) Barcode string. @@ -1005,11 +957,11 @@ public List Identifier [DataMember] public List UdiDeviceIdentifier { - get { if(_UdiDeviceIdentifier==null) _UdiDeviceIdentifier = new List(); return _UdiDeviceIdentifier; } + get => _UdiDeviceIdentifier ?? new List(); set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } - private List _UdiDeviceIdentifier; + private List? _UdiDeviceIdentifier; /// /// Name of device manufacturer. @@ -1019,13 +971,13 @@ public List UdiDev [References("Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Manufacturer + public Hl7.Fhir.Model.DataType? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.DataType _Manufacturer; + private Hl7.Fhir.Model.DataType? _Manufacturer; /// /// A name given to the device to identify it. @@ -1035,39 +987,36 @@ public Hl7.Fhir.Model.DataType Manufacturer [DataMember] public List DeviceName { - get { if(_DeviceName==null) _DeviceName = new List(); return _DeviceName; } + get => _DeviceName ?? new List(); set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } - private List _DeviceName; + private List? _DeviceName; /// /// The model number for the device. /// [FhirElement("modelNumber", Order=130, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ModelNumberElement + public Hl7.Fhir.Model.FhirString? ModelNumberElement { get { return _ModelNumberElement; } set { _ModelNumberElement = value; OnPropertyChanged("ModelNumberElement"); } } - private Hl7.Fhir.Model.FhirString _ModelNumberElement; + private Hl7.Fhir.Model.FhirString? _ModelNumberElement; /// /// The model number for the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ModelNumber + public string? ModelNumber { - get { return ModelNumberElement != null ? ModelNumberElement.Value : null; } + get => _ModelNumberElement?.Value; set { - if (value == null) - ModelNumberElement = null; - else - ModelNumberElement = new Hl7.Fhir.Model.FhirString(value); + ModelNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ModelNumber"); } } @@ -1078,13 +1027,13 @@ public string ModelNumber [FhirElement("type", Order=140)] [Binding("DeviceKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The capabilities supported on a device, the standards to which the device conforms for a particular purpose, and used for the communication. @@ -1094,11 +1043,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Specialization { - get { if(_Specialization==null) _Specialization = new List(); return _Specialization; } + get => _Specialization ?? new List(); set { _Specialization = value; OnPropertyChanged("Specialization"); } } - private List _Specialization; + private List? _Specialization; /// /// Available versions. @@ -1108,24 +1057,24 @@ public List Specializat [DataMember] public List VersionElement { - get { if(_VersionElement==null) _VersionElement = new List(); return _VersionElement; } + get => _VersionElement ?? new List(); set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private List _VersionElement; + private List? _VersionElement; /// /// Available versions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Version + public IEnumerable? Version { - get { return VersionElement != null ? VersionElement.Select(elem => elem.Value) : null; } + get => _VersionElement?.Select(elem => elem.Value); set { if (value == null) - VersionElement = null; + VersionElement = null!; else VersionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Version"); @@ -1141,11 +1090,11 @@ public IEnumerable Version [DataMember] public List Safety { - get { if(_Safety==null) _Safety = new List(); return _Safety; } + get => _Safety ?? new List(); set { _Safety = value; OnPropertyChanged("Safety"); } } - private List _Safety; + private List? _Safety; /// /// Shelf Life and storage information. @@ -1155,24 +1104,24 @@ public List Safety [DataMember] public List ShelfLifeStorage { - get { if(_ShelfLifeStorage==null) _ShelfLifeStorage = new List(); return _ShelfLifeStorage; } + get => _ShelfLifeStorage ?? new List(); set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } - private List _ShelfLifeStorage; + private List? _ShelfLifeStorage; /// /// Dimensions, color etc. /// [FhirElement("physicalCharacteristics", Order=190)] [DataMember] - public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics + public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics { get { return _PhysicalCharacteristics; } set { _PhysicalCharacteristics = value; OnPropertyChanged("PhysicalCharacteristics"); } } - private Hl7.Fhir.Model.ProdCharacteristic _PhysicalCharacteristics; + private Hl7.Fhir.Model.ProdCharacteristic? _PhysicalCharacteristics; /// /// Language code for the human-readable text strings produced by the device (all supported). @@ -1182,11 +1131,11 @@ public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics [DataMember] public List LanguageCode { - get { if(_LanguageCode==null) _LanguageCode = new List(); return _LanguageCode; } + get => _LanguageCode ?? new List(); set { _LanguageCode = value; OnPropertyChanged("LanguageCode"); } } - private List _LanguageCode; + private List? _LanguageCode; /// /// Device capabilities. @@ -1196,11 +1145,11 @@ public List LanguageCode [DataMember] public List Capability { - get { if(_Capability==null) _Capability = new List(); return _Capability; } + get => _Capability ?? new List(); set { _Capability = value; OnPropertyChanged("Capability"); } } - private List _Capability; + private List? _Capability; /// /// The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties. @@ -1210,11 +1159,11 @@ public List Capability [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Organization responsible for device. @@ -1223,13 +1172,13 @@ public List Property [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Details for human/organization for support. @@ -1239,39 +1188,36 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Network address to contact device. /// [FhirElement("url", Order=250, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Network address to contact device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1281,28 +1227,25 @@ public string Url /// [FhirElement("onlineInformation", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirUri OnlineInformationElement + public Hl7.Fhir.Model.FhirUri? OnlineInformationElement { get { return _OnlineInformationElement; } set { _OnlineInformationElement = value; OnPropertyChanged("OnlineInformationElement"); } } - private Hl7.Fhir.Model.FhirUri _OnlineInformationElement; + private Hl7.Fhir.Model.FhirUri? _OnlineInformationElement; /// /// Access to on-line information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OnlineInformation + public string? OnlineInformation { - get { return OnlineInformationElement != null ? OnlineInformationElement.Value : null; } + get => _OnlineInformationElement?.Value; set { - if (value == null) - OnlineInformationElement = null; - else - OnlineInformationElement = new Hl7.Fhir.Model.FhirUri(value); + OnlineInformationElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("OnlineInformation"); } } @@ -1315,24 +1258,24 @@ public string OnlineInformation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The quantity of the device present in the packaging (e.g. the number of devices present in a pack, or the number of devices in the same package of the medicinal product). /// [FhirElement("quantity", Order=280)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The parent device it can be part of. @@ -1341,13 +1284,13 @@ public Hl7.Fhir.Model.Quantity Quantity [CLSCompliant(false)] [References("DeviceDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ParentDevice + public Hl7.Fhir.Model.ResourceReference? ParentDevice { get { return _ParentDevice; } set { _ParentDevice = value; OnPropertyChanged("ParentDevice"); } } - private Hl7.Fhir.Model.ResourceReference _ParentDevice; + private Hl7.Fhir.Model.ResourceReference? _ParentDevice; /// /// A substance used to create the material(s) of which the device is made. @@ -1357,46 +1300,42 @@ public Hl7.Fhir.Model.ResourceReference ParentDevice [DataMember] public List Material { - get { if(_Material==null) _Material = new List(); return _Material; } + get => _Material ?? new List(); set { _Material = value; OnPropertyChanged("Material"); } } - private List _Material; + private List? _Material; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceDefinition; - - if (dest == null) - { + if(other is not DeviceDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(UdiDeviceIdentifier.Any()) dest.UdiDeviceIdentifier = new List(UdiDeviceIdentifier.DeepCopyInternal()); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.DataType)Manufacturer.DeepCopyInternal(); - if(DeviceName.Any()) dest.DeviceName = new List(DeviceName.DeepCopyInternal()); - if(ModelNumberElement != null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)ModelNumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Specialization.Any()) dest.Specialization = new List(Specialization.DeepCopyInternal()); - if(VersionElement.Any()) dest.VersionElement = new List(VersionElement.DeepCopyInternal()); - if(Safety.Any()) dest.Safety = new List(Safety.DeepCopyInternal()); - if(ShelfLifeStorage.Any()) dest.ShelfLifeStorage = new List(ShelfLifeStorage.DeepCopyInternal()); - if(PhysicalCharacteristics != null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)PhysicalCharacteristics.DeepCopyInternal(); - if(LanguageCode.Any()) dest.LanguageCode = new List(LanguageCode.DeepCopyInternal()); - if(Capability.Any()) dest.Capability = new List(Capability.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(OnlineInformationElement != null) dest.OnlineInformationElement = (Hl7.Fhir.Model.FhirUri)OnlineInformationElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ParentDevice != null) dest.ParentDevice = (Hl7.Fhir.Model.ResourceReference)ParentDevice.DeepCopyInternal(); - if(Material.Any()) dest.Material = new List(Material.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_UdiDeviceIdentifier is not null) dest.UdiDeviceIdentifier = new List(_UdiDeviceIdentifier.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.DataType)_Manufacturer.DeepCopyInternal(); + if(_DeviceName is not null) dest.DeviceName = new List(_DeviceName.DeepCopyInternal()); + if(_ModelNumberElement is not null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)_ModelNumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Specialization is not null) dest.Specialization = new List(_Specialization.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = new List(_VersionElement.DeepCopyInternal()); + if(_Safety is not null) dest.Safety = new List(_Safety.DeepCopyInternal()); + if(_ShelfLifeStorage is not null) dest.ShelfLifeStorage = new List(_ShelfLifeStorage.DeepCopyInternal()); + if(_PhysicalCharacteristics is not null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)_PhysicalCharacteristics.DeepCopyInternal(); + if(_LanguageCode is not null) dest.LanguageCode = new List(_LanguageCode.DeepCopyInternal()); + if(_Capability is not null) dest.Capability = new List(_Capability.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_OnlineInformationElement is not null) dest.OnlineInformationElement = (Hl7.Fhir.Model.FhirUri)_OnlineInformationElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ParentDevice is not null) dest.ParentDevice = (Hl7.Fhir.Model.ResourceReference)_ParentDevice.DeepCopyInternal(); + if(_Material is not null) dest.Material = new List(_Material.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1408,181 +1347,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceDefinition; - if(otherT == null) return false; + if(other is not DeviceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(UdiDeviceIdentifier, otherT.UdiDeviceIdentifier)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(DeviceName, otherT.DeviceName)) return false; - if(!comparer.Equals(ModelNumberElement, otherT.ModelNumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialization, otherT.Specialization)) return false; - if(!comparer.ListEquals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.ListEquals(Safety, otherT.Safety)) return false; - if(!comparer.ListEquals(ShelfLifeStorage, otherT.ShelfLifeStorage)) return false; - if(!comparer.Equals(PhysicalCharacteristics, otherT.PhysicalCharacteristics)) return false; - if(!comparer.ListEquals(LanguageCode, otherT.LanguageCode)) return false; - if(!comparer.ListEquals(Capability, otherT.Capability)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(OnlineInformationElement, otherT.OnlineInformationElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ParentDevice, otherT.ParentDevice)) return false; - if(!comparer.ListEquals(Material, otherT.Material)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_DeviceName, otherT._DeviceName)) return false; + if(!comparer.Equals(_ModelNumberElement, otherT._ModelNumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialization, otherT._Specialization)) return false; + if(!comparer.ListEquals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; + if(!comparer.ListEquals(_ShelfLifeStorage, otherT._ShelfLifeStorage)) return false; + if(!comparer.Equals(_PhysicalCharacteristics, otherT._PhysicalCharacteristics)) return false; + if(!comparer.ListEquals(_LanguageCode, otherT._LanguageCode)) return false; + if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_OnlineInformationElement, otherT._OnlineInformationElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ParentDevice, otherT._ParentDevice)) return false; + if(!comparer.ListEquals(_Material, otherT._Material)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "udiDeviceIdentifier": - value = UdiDeviceIdentifier; - return UdiDeviceIdentifier?.Any() == true; + value = _UdiDeviceIdentifier; + return _UdiDeviceIdentifier?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "deviceName": - value = DeviceName; - return DeviceName?.Any() == true; + value = _DeviceName; + return _DeviceName?.Any() == true; case "modelNumber": - value = ModelNumberElement; - return ModelNumberElement is not null; + value = _ModelNumberElement; + return _ModelNumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "specialization": - value = Specialization; - return Specialization?.Any() == true; + value = _Specialization; + return _Specialization?.Any() == true; case "version": - value = VersionElement; - return VersionElement?.Any() == true; + value = _VersionElement; + return _VersionElement?.Any() == true; case "safety": - value = Safety; - return Safety?.Any() == true; + value = _Safety; + return _Safety?.Any() == true; case "shelfLifeStorage": - value = ShelfLifeStorage; - return ShelfLifeStorage?.Any() == true; + value = _ShelfLifeStorage; + return _ShelfLifeStorage?.Any() == true; case "physicalCharacteristics": - value = PhysicalCharacteristics; - return PhysicalCharacteristics is not null; + value = _PhysicalCharacteristics; + return _PhysicalCharacteristics is not null; case "languageCode": - value = LanguageCode; - return LanguageCode?.Any() == true; + value = _LanguageCode; + return _LanguageCode?.Any() == true; case "capability": - value = Capability; - return Capability?.Any() == true; + value = _Capability; + return _Capability?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "onlineInformation": - value = OnlineInformationElement; - return OnlineInformationElement is not null; + value = _OnlineInformationElement; + return _OnlineInformationElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "parentDevice": - value = ParentDevice; - return ParentDevice is not null; + value = _ParentDevice; + return _ParentDevice is not null; case "material": - value = Material; - return Material?.Any() == true; + value = _Material; + return _Material?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "udiDeviceIdentifier": - UdiDeviceIdentifier = (List)value; + UdiDeviceIdentifier = (List?)value!; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.DataType)value; + Manufacturer = (Hl7.Fhir.Model.DataType?)value; return this; case "deviceName": - DeviceName = (List)value; + DeviceName = (List?)value!; return this; case "modelNumber": - ModelNumberElement = (Hl7.Fhir.Model.FhirString)value; + ModelNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialization": - Specialization = (List)value; + Specialization = (List?)value!; return this; case "version": - VersionElement = (List)value; + VersionElement = (List?)value!; return this; case "safety": - Safety = (List)value; + Safety = (List?)value!; return this; case "shelfLifeStorage": - ShelfLifeStorage = (List)value; + ShelfLifeStorage = (List?)value!; return this; case "physicalCharacteristics": - PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)value; + PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic?)value; return this; case "languageCode": - LanguageCode = (List)value; + LanguageCode = (List?)value!; return this; case "capability": - Capability = (List)value; + Capability = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "onlineInformation": - OnlineInformationElement = (Hl7.Fhir.Model.FhirUri)value; + OnlineInformationElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "parentDevice": - ParentDevice = (Hl7.Fhir.Model.ResourceReference)value; + ParentDevice = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "material": - Material = (List)value; + Material = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1593,28 +1532,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",UdiDeviceIdentifier); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",DeviceName); - if (ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",ModelNumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Specialization?.Any() == true) yield return new KeyValuePair("specialization",Specialization); - if (VersionElement?.Any() == true) yield return new KeyValuePair("version",VersionElement); - if (Safety?.Any() == true) yield return new KeyValuePair("safety",Safety); - if (ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",ShelfLifeStorage); - if (PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",PhysicalCharacteristics); - if (LanguageCode?.Any() == true) yield return new KeyValuePair("languageCode",LanguageCode); - if (Capability?.Any() == true) yield return new KeyValuePair("capability",Capability); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (OnlineInformationElement is not null) yield return new KeyValuePair("onlineInformation",OnlineInformationElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ParentDevice is not null) yield return new KeyValuePair("parentDevice",ParentDevice); - if (Material?.Any() == true) yield return new KeyValuePair("material",Material); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",_UdiDeviceIdentifier); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",_DeviceName); + if (_ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",_ModelNumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Specialization?.Any() == true) yield return new KeyValuePair("specialization",_Specialization); + if (_VersionElement?.Any() == true) yield return new KeyValuePair("version",_VersionElement); + if (_Safety?.Any() == true) yield return new KeyValuePair("safety",_Safety); + if (_ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",_ShelfLifeStorage); + if (_PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",_PhysicalCharacteristics); + if (_LanguageCode?.Any() == true) yield return new KeyValuePair("languageCode",_LanguageCode); + if (_Capability?.Any() == true) yield return new KeyValuePair("capability",_Capability); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_OnlineInformationElement is not null) yield return new KeyValuePair("onlineInformation",_OnlineInformationElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ParentDevice is not null) yield return new KeyValuePair("parentDevice",_ParentDevice); + if (_Material?.Any() == true) yield return new KeyValuePair("material",_Material); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs index fae716517..f9917889c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("DeviceMetric","http://hl7.org/fhir/StructureDefinition/DeviceMetric")] - public partial class DeviceMetric : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class DeviceMetric : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -274,13 +277,13 @@ public partial class CalibrationComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// unspecified | offset | gain | two-point @@ -289,13 +292,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -307,13 +307,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationState")] [DataMember] - public Code StateElement + public Code? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Code _StateElement; + private Code? _StateElement; /// /// not-calibrated | calibration-required | calibrated | unspecified @@ -322,13 +322,10 @@ public Code StateEleme [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Code(value); + StateElement = value is null ? null : new Code(value); OnPropertyChanged("State"); } } @@ -338,13 +335,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State /// [FhirElement("time", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Instant TimeElement + public Hl7.Fhir.Model.Instant? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.Instant _TimeElement; + private Hl7.Fhir.Model.Instant? _TimeElement; /// /// Describes the time last calibration has been performed @@ -353,30 +350,23 @@ public Hl7.Fhir.Model.Instant TimeElement [IgnoreDataMember] public DateTimeOffset? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.Instant(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Time"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CalibrationComponent; - - if (dest == null) - { + if(other is not CalibrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Code)StateElement.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.Instant)TimeElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Code)_StateElement.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.Instant)_TimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -388,48 +378,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CalibrationComponent; - if(otherT == null) return false; + if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "state": - StateElement = (Code)value; + StateElement = (Code?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.Instant)value; + TimeElement = (Hl7.Fhir.Model.Instant?)value; return this; default: return base.SetValue(key, value); @@ -440,9 +430,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); } } @@ -455,11 +445,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identity of metric, for example Heart Rate or PEEP Setting. @@ -468,13 +458,13 @@ public List Identifier [Binding("MetricType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Unit of Measure for the Metric. @@ -482,13 +472,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("unit", InSummary=true, Order=110)] [Binding("MetricUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Describes the link to the source Device. @@ -497,13 +487,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Describes the link to the parent Device. @@ -512,13 +502,13 @@ public Hl7.Fhir.Model.ResourceReference Source [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// on | off | standby | entered-in-error. @@ -527,13 +517,13 @@ public Hl7.Fhir.Model.ResourceReference Parent [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricOperationalStatus")] [DataMember] - public Code OperationalStatusElement + public Code? OperationalStatusElement { get { return _OperationalStatusElement; } set { _OperationalStatusElement = value; OnPropertyChanged("OperationalStatusElement"); } } - private Code _OperationalStatusElement; + private Code? _OperationalStatusElement; /// /// on | off | standby | entered-in-error @@ -542,13 +532,10 @@ public Code Operation [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalStatus { - get { return OperationalStatusElement != null ? OperationalStatusElement.Value : null; } + get => _OperationalStatusElement?.Value; set { - if (value == null) - OperationalStatusElement = null; - else - OperationalStatusElement = new Code(value); + OperationalStatusElement = value is null ? null : new Code(value); OnPropertyChanged("OperationalStatus"); } } @@ -560,13 +547,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalSta [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricColor")] [DataMember] - public Code ColorElement + public Code? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Code _ColorElement; + private Code? _ColorElement; /// /// black | red | green | yellow | blue | magenta | cyan | white @@ -575,13 +562,10 @@ public Code ColorElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricColor? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Code(value); + ColorElement = value is null ? null : new Code(value); OnPropertyChanged("Color"); } } @@ -594,13 +578,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricColor? Color [Binding("DeviceMetricCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// measurement | setting | calculation | unspecified @@ -609,13 +593,10 @@ public Code CategoryElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -625,13 +606,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category /// [FhirElement("measurementPeriod", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.Timing MeasurementPeriod + public Hl7.Fhir.Model.Timing? MeasurementPeriod { get { return _MeasurementPeriod; } set { _MeasurementPeriod = value; OnPropertyChanged("MeasurementPeriod"); } } - private Hl7.Fhir.Model.Timing _MeasurementPeriod; + private Hl7.Fhir.Model.Timing? _MeasurementPeriod; /// /// Describes the calibrations that have been performed or that are required to be performed. @@ -641,37 +622,33 @@ public Hl7.Fhir.Model.Timing MeasurementPeriod [DataMember] public List Calibration { - get { if(_Calibration==null) _Calibration = new List(); return _Calibration; } + get => _Calibration ?? new List(); set { _Calibration = value; OnPropertyChanged("Calibration"); } } - private List _Calibration; + private List? _Calibration; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceMetric; - - if (dest == null) - { + if(other is not DeviceMetric dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(OperationalStatusElement != null) dest.OperationalStatusElement = (Code)OperationalStatusElement.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Code)ColorElement.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(MeasurementPeriod != null) dest.MeasurementPeriod = (Hl7.Fhir.Model.Timing)MeasurementPeriod.DeepCopyInternal(); - if(Calibration.Any()) dest.Calibration = new List(Calibration.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_OperationalStatusElement is not null) dest.OperationalStatusElement = (Code)_OperationalStatusElement.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Code)_ColorElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_MeasurementPeriod is not null) dest.MeasurementPeriod = (Hl7.Fhir.Model.Timing)_MeasurementPeriod.DeepCopyInternal(); + if(_Calibration is not null) dest.Calibration = new List(_Calibration.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -683,97 +660,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceMetric; - if(otherT == null) return false; + if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(OperationalStatusElement, otherT.OperationalStatusElement)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(MeasurementPeriod, otherT.MeasurementPeriod)) return false; - if(!comparer.ListEquals(Calibration, otherT.Calibration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_OperationalStatusElement, otherT._OperationalStatusElement)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_MeasurementPeriod, otherT._MeasurementPeriod)) return false; + if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "operationalStatus": - value = OperationalStatusElement; - return OperationalStatusElement is not null; + value = _OperationalStatusElement; + return _OperationalStatusElement is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "measurementPeriod": - value = MeasurementPeriod; - return MeasurementPeriod is not null; + value = _MeasurementPeriod; + return _MeasurementPeriod is not null; case "calibration": - value = Calibration; - return Calibration?.Any() == true; + value = _Calibration; + return _Calibration?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "operationalStatus": - OperationalStatusElement = (Code)value; + OperationalStatusElement = (Code?)value; return this; case "color": - ColorElement = (Code)value; + ColorElement = (Code?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "measurementPeriod": - MeasurementPeriod = (Hl7.Fhir.Model.Timing)value; + MeasurementPeriod = (Hl7.Fhir.Model.Timing?)value; return this; case "calibration": - Calibration = (List)value; + Calibration = (List?)value!; return this; default: return base.SetValue(key, value); @@ -784,16 +761,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",OperationalStatusElement); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (MeasurementPeriod is not null) yield return new KeyValuePair("measurementPeriod",MeasurementPeriod); - if (Calibration?.Any() == true) yield return new KeyValuePair("calibration",Calibration); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatusElement); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_MeasurementPeriod is not null) yield return new KeyValuePair("measurementPeriod",_MeasurementPeriod); + if (_Calibration?.Any() == true) yield return new KeyValuePair("calibration",_Calibration); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs index 0d42ca4ee..c28bdb096 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("DeviceRequest","http://hl7.org/fhir/StructureDefinition/DeviceRequest")] - public partial class DeviceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class DeviceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -81,13 +84,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40, FiveWs="FiveWs.what[x]")] [Binding("ParameterCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value of detail. @@ -96,26 +99,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirBoolean))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -127,41 +126,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -172,8 +171,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -186,11 +185,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -200,24 +199,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -232,24 +231,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -266,11 +265,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -282,24 +281,24 @@ public List BasedOn [DataMember] public List PriorRequest { - get { if(_PriorRequest==null) _PriorRequest = new List(); return _PriorRequest; } + get => _PriorRequest ?? new List(); set { _PriorRequest = value; OnPropertyChanged("PriorRequest"); } } - private List _PriorRequest; + private List? _PriorRequest; /// /// Identifier of composite request. /// [FhirElement("groupIdentifier", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -308,13 +307,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DeclaredType(Type = typeof(Code))] [Binding("DeviceRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -323,13 +322,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -342,13 +338,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -357,13 +353,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -375,13 +368,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -390,13 +383,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -411,13 +401,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Code + public Hl7.Fhir.Model.DataType? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.DataType _Code; + private Hl7.Fhir.Model.DataType? _Code; /// /// Device details. @@ -427,11 +417,11 @@ public Hl7.Fhir.Model.DataType Code [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Focus of request. @@ -441,13 +431,13 @@ public List Parameter [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter motivating request. @@ -456,13 +446,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Desired time or schedule for use. @@ -471,41 +461,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When recorded. /// [FhirElement("authoredOn", InSummary=true, Order=230, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -517,13 +504,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Filler role. @@ -531,13 +518,13 @@ public Hl7.Fhir.Model.ResourceReference Requester [FhirElement("performerType", InSummary=true, Order=250, FiveWs="FiveWs.actor")] [Binding("DeviceRequestParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Requested Filler. @@ -546,13 +533,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","HealthcareService","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Coded Reason for request. @@ -563,11 +550,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Linked Reason for request. @@ -579,11 +566,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Associated insurance coverage. @@ -595,11 +582,11 @@ public List ReasonReference [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Additional clinical information. @@ -611,11 +598,11 @@ public List Insurance [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Notes or comments. @@ -625,11 +612,11 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Request provenance. @@ -641,51 +628,47 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.DataType ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.DataType? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceRequest; - - if (dest == null) - { + if(other is not DeviceRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PriorRequest.Any()) dest.PriorRequest = new List(PriorRequest.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.DataType)Code.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PriorRequest is not null) dest.PriorRequest = new List(_PriorRequest.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.DataType)_Code.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -697,195 +680,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceRequest; - if(otherT == null) return false; + if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PriorRequest, otherT.PriorRequest)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PriorRequest, otherT._PriorRequest)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "priorRequest": - value = PriorRequest; - return PriorRequest?.Any() == true; + value = _PriorRequest; + return _PriorRequest?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "priorRequest": - PriorRequest = (List)value; + PriorRequest = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.DataType)value; + Code = (Hl7.Fhir.Model.DataType?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -896,30 +879,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PriorRequest?.Any() == true) yield return new KeyValuePair("priorRequest",PriorRequest); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PriorRequest?.Any() == true) yield return new KeyValuePair("priorRequest",_PriorRequest); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs index d7224bc7c..b44466ccb 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,11 +116,11 @@ public enum DeviceUseStatementStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -129,11 +132,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// active | completed | entered-in-error +. @@ -143,13 +146,13 @@ public List BasedOn [Binding("DeviceUseStatementStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | completed | entered-in-error + @@ -158,13 +161,10 @@ public Code StatusEl [IgnoreDataMember] public Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -177,13 +177,13 @@ public Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus? Status [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Supporting information. @@ -195,11 +195,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// How often the device was used. @@ -208,41 +208,38 @@ public List DerivedFrom [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// When statement was recorded. /// [FhirElement("recordedOn", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedOnElement + public Hl7.Fhir.Model.FhirDateTime? RecordedOnElement { get { return _RecordedOnElement; } set { _RecordedOnElement = value; OnPropertyChanged("RecordedOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedOnElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedOnElement; /// /// When statement was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedOn + public string? RecordedOn { - get { return RecordedOnElement != null ? RecordedOnElement.Value : null; } + get => _RecordedOnElement?.Value; set { - if (value == null) - RecordedOnElement = null; - else - RecordedOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedOn"); } } @@ -254,13 +251,13 @@ public string RecordedOn [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Reference to device used. @@ -270,13 +267,13 @@ public Hl7.Fhir.Model.ResourceReference Source [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Why device was used. @@ -286,11 +283,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was DeviceUseStatement performed?. @@ -302,11 +299,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Target body site. @@ -314,13 +311,13 @@ public List ReasonReference [FhirElement("bodySite", InSummary=true, Order=200)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Addition details (comments, instructions). @@ -330,37 +327,33 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceUseStatement; - - if (dest == null) - { + if(other is not DeviceUseStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(RecordedOnElement != null) dest.RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)RecordedOnElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_RecordedOnElement is not null) dest.RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedOnElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -372,118 +365,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceUseStatement; - if(otherT == null) return false; + if(other is not DeviceUseStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(RecordedOnElement, otherT.RecordedOnElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_RecordedOnElement, otherT._RecordedOnElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "recordedOn": - value = RecordedOnElement; - return RecordedOnElement is not null; + value = _RecordedOnElement; + return _RecordedOnElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedOn": - RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -494,19 +487,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (RecordedOnElement is not null) yield return new KeyValuePair("recordedOn",RecordedOnElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_RecordedOnElement is not null) yield return new KeyValuePair("recordedOn",_RecordedOnElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs index 29073329d..0acbce623 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("DiagnosticReport","http://hl7.org/fhir/StructureDefinition/DiagnosticReport")] - public partial class DiagnosticReport : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class DiagnosticReport : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -151,28 +154,25 @@ public partial class MediaComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("comment", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comment about the image (e.g. explanation) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -185,26 +185,22 @@ public string Comment [References("Media")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Link + public Hl7.Fhir.Model.ResourceReference? Link { get { return _Link; } set { _Link = value; OnPropertyChanged("Link"); } } - private Hl7.Fhir.Model.ResourceReference _Link; + private Hl7.Fhir.Model.ResourceReference? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as MediaComponent; - - if (dest == null) - { + if(other is not MediaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Link != null) dest.Link = (Hl7.Fhir.Model.ResourceReference)Link.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = (Hl7.Fhir.Model.ResourceReference)_Link.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -216,41 +212,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MediaComponent; - if(otherT == null) return false; + if(other is not MediaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "link": - value = Link; - return Link is not null; + value = _Link; + return _Link is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "link": - Link = (Hl7.Fhir.Model.ResourceReference)value; + Link = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -261,8 +257,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Link is not null) yield return new KeyValuePair("link",Link); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Link is not null) yield return new KeyValuePair("link",_Link); } } @@ -275,11 +271,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// What was requested. @@ -291,11 +287,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// registered | partial | preliminary | final +. @@ -305,13 +301,13 @@ public List BasedOn [Binding("DiagnosticReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | partial | preliminary | final + @@ -320,13 +316,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -340,11 +333,11 @@ public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Name/Code for this diagnostic report. @@ -353,13 +346,13 @@ public List Category [Binding("DiagnosticReportCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The subject of the report - usually, but not always, the patient. @@ -368,13 +361,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Health care event when test ordered. @@ -383,13 +376,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Clinically relevant time/time-period for report. @@ -398,26 +391,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// DateTime this version was made. /// [FhirElement("issued", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// DateTime this version was made @@ -426,13 +419,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -447,11 +437,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Primary result interpreter. @@ -463,11 +453,11 @@ public List Performer [DataMember] public List ResultsInterpreter { - get { if(_ResultsInterpreter==null) _ResultsInterpreter = new List(); return _ResultsInterpreter; } + get => _ResultsInterpreter ?? new List(); set { _ResultsInterpreter = value; OnPropertyChanged("ResultsInterpreter"); } } - private List _ResultsInterpreter; + private List? _ResultsInterpreter; /// /// Specimens this report is based on. @@ -479,11 +469,11 @@ public List ResultsInterpreter [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Observations. @@ -495,11 +485,11 @@ public List Specimen [DataMember] public List Result { - get { if(_Result==null) _Result = new List(); return _Result; } + get => _Result ?? new List(); set { _Result = value; OnPropertyChanged("Result"); } } - private List _Result; + private List? _Result; /// /// Reference to full details of imaging associated with the diagnostic report. @@ -511,11 +501,11 @@ public List Result [DataMember] public List ImagingStudy { - get { if(_ImagingStudy==null) _ImagingStudy = new List(); return _ImagingStudy; } + get => _ImagingStudy ?? new List(); set { _ImagingStudy = value; OnPropertyChanged("ImagingStudy"); } } - private List _ImagingStudy; + private List? _ImagingStudy; /// /// Key images associated with this report. @@ -525,39 +515,36 @@ public List ImagingStudy [DataMember] public List Media { - get { if(_Media==null) _Media = new List(); return _Media; } + get => _Media ?? new List(); set { _Media = value; OnPropertyChanged("Media"); } } - private List _Media; + private List? _Media; /// /// Clinical conclusion (interpretation) of test results. /// [FhirElement("conclusion", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString ConclusionElement + public Hl7.Fhir.Model.FhirString? ConclusionElement { get { return _ConclusionElement; } set { _ConclusionElement = value; OnPropertyChanged("ConclusionElement"); } } - private Hl7.Fhir.Model.FhirString _ConclusionElement; + private Hl7.Fhir.Model.FhirString? _ConclusionElement; /// /// Clinical conclusion (interpretation) of test results /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Conclusion + public string? Conclusion { - get { return ConclusionElement != null ? ConclusionElement.Value : null; } + get => _ConclusionElement?.Value; set { - if (value == null) - ConclusionElement = null; - else - ConclusionElement = new Hl7.Fhir.Model.FhirString(value); + ConclusionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Conclusion"); } } @@ -571,11 +558,11 @@ public string Conclusion [DataMember] public List ConclusionCode { - get { if(_ConclusionCode==null) _ConclusionCode = new List(); return _ConclusionCode; } + get => _ConclusionCode ?? new List(); set { _ConclusionCode = value; OnPropertyChanged("ConclusionCode"); } } - private List _ConclusionCode; + private List? _ConclusionCode; /// /// Entire report as issued. @@ -585,45 +572,41 @@ public List ConclusionCode [DataMember] public List PresentedForm { - get { if(_PresentedForm==null) _PresentedForm = new List(); return _PresentedForm; } + get => _PresentedForm ?? new List(); set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } - private List _PresentedForm; + private List? _PresentedForm; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosticReport; - - if (dest == null) - { + if(other is not DiagnosticReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(ResultsInterpreter.Any()) dest.ResultsInterpreter = new List(ResultsInterpreter.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(Result.Any()) dest.Result = new List(Result.DeepCopyInternal()); - if(ImagingStudy.Any()) dest.ImagingStudy = new List(ImagingStudy.DeepCopyInternal()); - if(Media.Any()) dest.Media = new List(Media.DeepCopyInternal()); - if(ConclusionElement != null) dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)ConclusionElement.DeepCopyInternal(); - if(ConclusionCode.Any()) dest.ConclusionCode = new List(ConclusionCode.DeepCopyInternal()); - if(PresentedForm.Any()) dest.PresentedForm = new List(PresentedForm.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_ResultsInterpreter is not null) dest.ResultsInterpreter = new List(_ResultsInterpreter.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_Result is not null) dest.Result = new List(_Result.DeepCopyInternal()); + if(_ImagingStudy is not null) dest.ImagingStudy = new List(_ImagingStudy.DeepCopyInternal()); + if(_Media is not null) dest.Media = new List(_Media.DeepCopyInternal()); + if(_ConclusionElement is not null) dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)_ConclusionElement.DeepCopyInternal(); + if(_ConclusionCode is not null) dest.ConclusionCode = new List(_ConclusionCode.DeepCopyInternal()); + if(_PresentedForm is not null) dest.PresentedForm = new List(_PresentedForm.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -635,153 +618,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosticReport; - if(otherT == null) return false; + if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ResultsInterpreter, otherT.ResultsInterpreter)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(ImagingStudy, otherT.ImagingStudy)) return false; - if(!comparer.ListEquals(Media, otherT.Media)) return false; - if(!comparer.Equals(ConclusionElement, otherT.ConclusionElement)) return false; - if(!comparer.ListEquals(ConclusionCode, otherT.ConclusionCode)) return false; - if(!comparer.ListEquals(PresentedForm, otherT.PresentedForm)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ResultsInterpreter, otherT._ResultsInterpreter)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_ImagingStudy, otherT._ImagingStudy)) return false; + if(!comparer.ListEquals(_Media, otherT._Media)) return false; + if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; + if(!comparer.ListEquals(_ConclusionCode, otherT._ConclusionCode)) return false; + if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "resultsInterpreter": - value = ResultsInterpreter; - return ResultsInterpreter?.Any() == true; + value = _ResultsInterpreter; + return _ResultsInterpreter?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "result": - value = Result; - return Result?.Any() == true; + value = _Result; + return _Result?.Any() == true; case "imagingStudy": - value = ImagingStudy; - return ImagingStudy?.Any() == true; + value = _ImagingStudy; + return _ImagingStudy?.Any() == true; case "media": - value = Media; - return Media?.Any() == true; + value = _Media; + return _Media?.Any() == true; case "conclusion": - value = ConclusionElement; - return ConclusionElement is not null; + value = _ConclusionElement; + return _ConclusionElement is not null; case "conclusionCode": - value = ConclusionCode; - return ConclusionCode?.Any() == true; + value = _ConclusionCode; + return _ConclusionCode?.Any() == true; case "presentedForm": - value = PresentedForm; - return PresentedForm?.Any() == true; + value = _PresentedForm; + return _PresentedForm?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "resultsInterpreter": - ResultsInterpreter = (List)value; + ResultsInterpreter = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "result": - Result = (List)value; + Result = (List?)value!; return this; case "imagingStudy": - ImagingStudy = (List)value; + ImagingStudy = (List?)value!; return this; case "media": - Media = (List)value; + Media = (List?)value!; return this; case "conclusion": - ConclusionElement = (Hl7.Fhir.Model.FhirString)value; + ConclusionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "conclusionCode": - ConclusionCode = (List)value; + ConclusionCode = (List?)value!; return this; case "presentedForm": - PresentedForm = (List)value; + PresentedForm = (List?)value!; return this; default: return base.SetValue(key, value); @@ -792,24 +775,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (ResultsInterpreter?.Any() == true) yield return new KeyValuePair("resultsInterpreter",ResultsInterpreter); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (Result?.Any() == true) yield return new KeyValuePair("result",Result); - if (ImagingStudy?.Any() == true) yield return new KeyValuePair("imagingStudy",ImagingStudy); - if (Media?.Any() == true) yield return new KeyValuePair("media",Media); - if (ConclusionElement is not null) yield return new KeyValuePair("conclusion",ConclusionElement); - if (ConclusionCode?.Any() == true) yield return new KeyValuePair("conclusionCode",ConclusionCode); - if (PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",PresentedForm); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_ResultsInterpreter?.Any() == true) yield return new KeyValuePair("resultsInterpreter",_ResultsInterpreter); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_Result?.Any() == true) yield return new KeyValuePair("result",_Result); + if (_ImagingStudy?.Any() == true) yield return new KeyValuePair("imagingStudy",_ImagingStudy); + if (_Media?.Any() == true) yield return new KeyValuePair("media",_Media); + if (_ConclusionElement is not null) yield return new KeyValuePair("conclusion",_ConclusionElement); + if (_ConclusionCode?.Any() == true) yield return new KeyValuePair("conclusionCode",_ConclusionCode); + if (_PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",_PresentedForm); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Distance.cs b/src/Hl7.Fhir.R4/Model/Generated/Distance.cs index 9cf246d89..76dd8ff7d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Distance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Distance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs index cc74555db..e3619f514 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class RelatedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Related Resource. @@ -96,26 +99,22 @@ public Hl7.Fhir.Model.Identifier Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Ref + public Hl7.Fhir.Model.ResourceReference? Ref { get { return _Ref; } set { _Ref = value; OnPropertyChanged("Ref"); } } - private Hl7.Fhir.Model.ResourceReference _Ref; + private Hl7.Fhir.Model.ResourceReference? _Ref; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedComponent; - - if (dest == null) - { + if(other is not RelatedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Ref != null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)Ref.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Ref is not null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)_Ref.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -127,41 +126,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedComponent; - if(otherT == null) return false; + if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Ref, otherT.Ref)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Ref, otherT._Ref)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "ref": - value = Ref; - return Ref is not null; + value = _Ref; + return _Ref is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "ref": - Ref = (Hl7.Fhir.Model.ResourceReference)value; + Ref = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -172,8 +171,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Ref is not null) yield return new KeyValuePair("ref",Ref); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Ref is not null) yield return new KeyValuePair("ref",_Ref); } } @@ -183,13 +182,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("masterIdentifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier MasterIdentifier + public Hl7.Fhir.Model.Identifier? MasterIdentifier { get { return _MasterIdentifier; } set { _MasterIdentifier = value; OnPropertyChanged("MasterIdentifier"); } } - private Hl7.Fhir.Model.Identifier _MasterIdentifier; + private Hl7.Fhir.Model.Identifier? _MasterIdentifier; /// /// Other identifiers for the manifest. @@ -199,11 +198,11 @@ public Hl7.Fhir.Model.Identifier MasterIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | superseded | entered-in-error. @@ -213,13 +212,13 @@ public List Identifier [Binding("DocumentReferenceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | superseded | entered-in-error @@ -228,13 +227,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentReferenceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -245,13 +241,13 @@ public Hl7.Fhir.Model.DocumentReferenceStatus? Status [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Binding("v3Act")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The subject of the set of documents. @@ -260,41 +256,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Practitioner","Group","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When this document manifest created. /// [FhirElement("created", Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// When this document manifest created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -309,11 +302,11 @@ public string Created [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Intended to get notified about this set of documents. @@ -325,39 +318,36 @@ public List Author [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// The source system/application/software. /// [FhirElement("source", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// The source system/application/software /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -367,28 +357,25 @@ public string Source /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable description (title) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -403,11 +390,11 @@ public string Description [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// Related things. @@ -417,36 +404,32 @@ public List Content [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentManifest; - - if (dest == null) - { + if(other is not DocumentManifest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MasterIdentifier != null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); + if(_MasterIdentifier is not null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)_MasterIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -458,111 +441,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentManifest; - if(otherT == null) return false; + if(other is not DocumentManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MasterIdentifier, otherT.MasterIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "masterIdentifier": - value = MasterIdentifier; - return MasterIdentifier is not null; + value = _MasterIdentifier; + return _MasterIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "masterIdentifier": - MasterIdentifier = (Hl7.Fhir.Model.Identifier)value; + MasterIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; default: return base.SetValue(key, value); @@ -573,18 +556,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",MasterIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); + if (_MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",_MasterIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs index 16bf51f22..9f14f7a63 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -85,13 +88,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | transforms | signs | appends @@ -100,13 +103,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -119,26 +119,22 @@ public Hl7.Fhir.Model.DocumentRelationshipType? Code [References("DocumentReference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -150,41 +146,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -195,8 +191,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -223,13 +219,13 @@ public partial class ContentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("attachment", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Attachment Attachment + public Hl7.Fhir.Model.Attachment? Attachment { get { return _Attachment; } set { _Attachment = value; OnPropertyChanged("Attachment"); } } - private Hl7.Fhir.Model.Attachment _Attachment; + private Hl7.Fhir.Model.Attachment? _Attachment; /// /// Format/content rules for the document. @@ -237,26 +233,22 @@ public Hl7.Fhir.Model.Attachment Attachment [FhirElement("format", InSummary=true, Order=50)] [Binding("DocumentFormat")] [DataMember] - public Hl7.Fhir.Model.Coding Format + public Hl7.Fhir.Model.Coding? Format { get { return _Format; } set { _Format = value; OnPropertyChanged("Format"); } } - private Hl7.Fhir.Model.Coding _Format; + private Hl7.Fhir.Model.Coding? _Format; protected internal override void CopyToInternal(Base other) { - var dest = other as ContentComponent; - - if (dest == null) - { + if(other is not ContentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Attachment != null) dest.Attachment = (Hl7.Fhir.Model.Attachment)Attachment.DeepCopyInternal(); - if(Format != null) dest.Format = (Hl7.Fhir.Model.Coding)Format.DeepCopyInternal(); + if(_Attachment is not null) dest.Attachment = (Hl7.Fhir.Model.Attachment)_Attachment.DeepCopyInternal(); + if(_Format is not null) dest.Format = (Hl7.Fhir.Model.Coding)_Format.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -268,41 +260,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentComponent; - if(otherT == null) return false; + if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Attachment, otherT.Attachment)) return false; - if(!comparer.Equals(Format, otherT.Format)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + if(!comparer.Equals(_Format, otherT._Format)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "attachment": - value = Attachment; - return Attachment is not null; + value = _Attachment; + return _Attachment is not null; case "format": - value = Format; - return Format is not null; + value = _Format; + return _Format is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "attachment": - Attachment = (Hl7.Fhir.Model.Attachment)value; + Attachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "format": - Format = (Hl7.Fhir.Model.Coding)value; + Format = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -313,8 +305,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Attachment is not null) yield return new KeyValuePair("attachment",Attachment); - if (Format is not null) yield return new KeyValuePair("format",Format); + if (_Attachment is not null) yield return new KeyValuePair("attachment",_Attachment); + if (_Format is not null) yield return new KeyValuePair("format",_Format); } } @@ -346,11 +338,11 @@ public partial class ContextComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Main clinical acts documented. @@ -361,24 +353,24 @@ public List Encounter [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Time of service that is being documented. /// [FhirElement("period", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Kind of facility where patient was seen. @@ -386,13 +378,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("facilityType", Order=70)] [Binding("DocumentC80FacilityType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FacilityType + public Hl7.Fhir.Model.CodeableConcept? FacilityType { get { return _FacilityType; } set { _FacilityType = value; OnPropertyChanged("FacilityType"); } } - private Hl7.Fhir.Model.CodeableConcept _FacilityType; + private Hl7.Fhir.Model.CodeableConcept? _FacilityType; /// /// Additional details about where the content was created (e.g. clinical specialty). @@ -400,13 +392,13 @@ public Hl7.Fhir.Model.CodeableConcept FacilityType [FhirElement("practiceSetting", Order=80)] [Binding("DocumentC80PracticeSetting")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PracticeSetting + public Hl7.Fhir.Model.CodeableConcept? PracticeSetting { get { return _PracticeSetting; } set { _PracticeSetting = value; OnPropertyChanged("PracticeSetting"); } } - private Hl7.Fhir.Model.CodeableConcept _PracticeSetting; + private Hl7.Fhir.Model.CodeableConcept? _PracticeSetting; /// /// Patient demographics from source. @@ -415,13 +407,13 @@ public Hl7.Fhir.Model.CodeableConcept PracticeSetting [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SourcePatientInfo + public Hl7.Fhir.Model.ResourceReference? SourcePatientInfo { get { return _SourcePatientInfo; } set { _SourcePatientInfo = value; OnPropertyChanged("SourcePatientInfo"); } } - private Hl7.Fhir.Model.ResourceReference _SourcePatientInfo; + private Hl7.Fhir.Model.ResourceReference? _SourcePatientInfo; /// /// Related identifiers or resources. @@ -433,29 +425,25 @@ public Hl7.Fhir.Model.ResourceReference SourcePatientInfo [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; protected internal override void CopyToInternal(Base other) { - var dest = other as ContextComponent; - - if (dest == null) - { + if(other is not ContextComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(FacilityType != null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)FacilityType.DeepCopyInternal(); - if(PracticeSetting != null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)PracticeSetting.DeepCopyInternal(); - if(SourcePatientInfo != null) dest.SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)SourcePatientInfo.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_FacilityType is not null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)_FacilityType.DeepCopyInternal(); + if(_PracticeSetting is not null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)_PracticeSetting.DeepCopyInternal(); + if(_SourcePatientInfo is not null) dest.SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)_SourcePatientInfo.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -467,76 +455,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContextComponent; - if(otherT == null) return false; + if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(FacilityType, otherT.FacilityType)) return false; - if(!comparer.Equals(PracticeSetting, otherT.PracticeSetting)) return false; - if(!comparer.Equals(SourcePatientInfo, otherT.SourcePatientInfo)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_FacilityType, otherT._FacilityType)) return false; + if(!comparer.Equals(_PracticeSetting, otherT._PracticeSetting)) return false; + if(!comparer.Equals(_SourcePatientInfo, otherT._SourcePatientInfo)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "facilityType": - value = FacilityType; - return FacilityType is not null; + value = _FacilityType; + return _FacilityType is not null; case "practiceSetting": - value = PracticeSetting; - return PracticeSetting is not null; + value = _PracticeSetting; + return _PracticeSetting is not null; case "sourcePatientInfo": - value = SourcePatientInfo; - return SourcePatientInfo is not null; + value = _SourcePatientInfo; + return _SourcePatientInfo is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "facilityType": - FacilityType = (Hl7.Fhir.Model.CodeableConcept)value; + FacilityType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "practiceSetting": - PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)value; + PracticeSetting = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sourcePatientInfo": - SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)value; + SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; default: return base.SetValue(key, value); @@ -547,13 +535,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (FacilityType is not null) yield return new KeyValuePair("facilityType",FacilityType); - if (PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",PracticeSetting); - if (SourcePatientInfo is not null) yield return new KeyValuePair("sourcePatientInfo",SourcePatientInfo); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_FacilityType is not null) yield return new KeyValuePair("facilityType",_FacilityType); + if (_PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",_PracticeSetting); + if (_SourcePatientInfo is not null) yield return new KeyValuePair("sourcePatientInfo",_SourcePatientInfo); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); } } @@ -563,13 +551,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("masterIdentifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier MasterIdentifier + public Hl7.Fhir.Model.Identifier? MasterIdentifier { get { return _MasterIdentifier; } set { _MasterIdentifier = value; OnPropertyChanged("MasterIdentifier"); } } - private Hl7.Fhir.Model.Identifier _MasterIdentifier; + private Hl7.Fhir.Model.Identifier? _MasterIdentifier; /// /// Other identifiers for the document. @@ -579,11 +567,11 @@ public Hl7.Fhir.Model.Identifier MasterIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | superseded | entered-in-error. @@ -593,13 +581,13 @@ public List Identifier [Binding("DocumentReferenceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | superseded | entered-in-error @@ -608,13 +596,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentReferenceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -626,13 +611,13 @@ public Hl7.Fhir.Model.DocumentReferenceStatus? Status [DeclaredType(Type = typeof(Code))] [Binding("ReferredDocumentStatus")] [DataMember] - public Code DocStatusElement + public Code? DocStatusElement { get { return _DocStatusElement; } set { _DocStatusElement = value; OnPropertyChanged("DocStatusElement"); } } - private Code _DocStatusElement; + private Code? _DocStatusElement; /// /// preliminary | final | amended | entered-in-error @@ -641,13 +626,10 @@ public Code DocStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? DocStatus { - get { return DocStatusElement != null ? DocStatusElement.Value : null; } + get => _DocStatusElement?.Value; set { - if (value == null) - DocStatusElement = null; - else - DocStatusElement = new Code(value); + DocStatusElement = value is null ? null : new Code(value); OnPropertyChanged("DocStatus"); } } @@ -658,13 +640,13 @@ public Hl7.Fhir.Model.CompositionStatus? DocStatus [FhirElement("type", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("DocumentC80Type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of document. @@ -675,11 +657,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who/what is the subject of the document. @@ -688,26 +670,26 @@ public List Category [CLSCompliant(false)] [References("Patient","Practitioner","Group","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When this document reference was created. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant DateElement + public Hl7.Fhir.Model.Instant? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Instant _DateElement; + private Hl7.Fhir.Model.Instant? _DateElement; /// /// When this document reference was created @@ -716,13 +698,10 @@ public Hl7.Fhir.Model.Instant DateElement [IgnoreDataMember] public DateTimeOffset? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Instant(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Date"); } } @@ -737,11 +716,11 @@ public DateTimeOffset? Date [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who/what authenticated the document. @@ -750,13 +729,13 @@ public List Author [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authenticator + public Hl7.Fhir.Model.ResourceReference? Authenticator { get { return _Authenticator; } set { _Authenticator = value; OnPropertyChanged("Authenticator"); } } - private Hl7.Fhir.Model.ResourceReference _Authenticator; + private Hl7.Fhir.Model.ResourceReference? _Authenticator; /// /// Organization which maintains the document. @@ -765,13 +744,13 @@ public Hl7.Fhir.Model.ResourceReference Authenticator [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other documents. @@ -781,39 +760,36 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// Human-readable description. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -827,11 +803,11 @@ public string Description [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Document referenced. @@ -841,53 +817,49 @@ public List SecurityLabel [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// Clinical context of document. /// [FhirElement("context", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.DocumentReference.ContextComponent Context + public Hl7.Fhir.Model.DocumentReference.ContextComponent? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.DocumentReference.ContextComponent _Context; + private Hl7.Fhir.Model.DocumentReference.ContextComponent? _Context; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentReference; - - if (dest == null) - { + if(other is not DocumentReference dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MasterIdentifier != null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DocStatusElement != null) dest.DocStatusElement = (Code)DocStatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Instant)DateElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Authenticator != null) dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)Authenticator.DeepCopyInternal(); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(Context != null) dest.Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)Context.DeepCopyInternal(); + if(_MasterIdentifier is not null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)_MasterIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DocStatusElement is not null) dest.DocStatusElement = (Code)_DocStatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Instant)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Authenticator is not null) dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)_Authenticator.DeepCopyInternal(); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)_Context.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -899,139 +871,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentReference; - if(otherT == null) return false; + if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MasterIdentifier, otherT.MasterIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DocStatusElement, otherT.DocStatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Authenticator, otherT.Authenticator)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DocStatusElement, otherT._DocStatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Authenticator, otherT._Authenticator)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "masterIdentifier": - value = MasterIdentifier; - return MasterIdentifier is not null; + value = _MasterIdentifier; + return _MasterIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "docStatus": - value = DocStatusElement; - return DocStatusElement is not null; + value = _DocStatusElement; + return _DocStatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "authenticator": - value = Authenticator; - return Authenticator is not null; + value = _Authenticator; + return _Authenticator is not null; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "masterIdentifier": - MasterIdentifier = (Hl7.Fhir.Model.Identifier)value; + MasterIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "docStatus": - DocStatusElement = (Code)value; + DocStatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Instant)value; + DateElement = (Hl7.Fhir.Model.Instant?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "authenticator": - Authenticator = (Hl7.Fhir.Model.ResourceReference)value; + Authenticator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "context": - Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)value; + Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent?)value; return this; default: return base.SetValue(key, value); @@ -1042,22 +1014,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",MasterIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DocStatusElement is not null) yield return new KeyValuePair("docStatus",DocStatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Authenticator is not null) yield return new KeyValuePair("authenticator",Authenticator); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (Context is not null) yield return new KeyValuePair("context",Context); + if (_MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",_MasterIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DocStatusElement is not null) yield return new KeyValuePair("docStatus",_DocStatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Authenticator is not null) yield return new KeyValuePair("authenticator",_Authenticator); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_Context is not null) yield return new KeyValuePair("context",_Context); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs index cb6633e6f..ca82c7fc4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class DoseAndRateComponent : Hl7.Fhir.Model.Element [FhirElement("type", InSummary=true, Order=30)] [Binding("DoseAndRateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount of medication per dose. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Dose + public Hl7.Fhir.Model.DataType? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.DataType _Dose; + private Hl7.Fhir.Model.DataType? _Dose; /// /// Amount of medication per unit of time. @@ -111,27 +114,23 @@ public Hl7.Fhir.Model.DataType Dose [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as DoseAndRateComponent; - - if (dest == null) - { + if(other is not DoseAndRateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.DataType)Dose.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.DataType)_Dose.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DoseAndRateComponent; - if(otherT == null) return false; + if(other is not DoseAndRateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.DataType)value; + Dose = (Hl7.Fhir.Model.DataType?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -207,13 +206,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sequence", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SequenceElement + public Hl7.Fhir.Model.Integer? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.Integer _SequenceElement; + private Hl7.Fhir.Model.Integer? _SequenceElement; /// /// The order of the dosage instructions @@ -222,13 +221,10 @@ public Hl7.Fhir.Model.Integer SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.Integer(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Sequence"); } } @@ -238,28 +234,25 @@ public int? Sequence /// [FhirElement("text", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -273,39 +266,36 @@ public string Text [DataMember] public List AdditionalInstruction { - get { if(_AdditionalInstruction==null) _AdditionalInstruction = new List(); return _AdditionalInstruction; } + get => _AdditionalInstruction ?? new List(); set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } - private List _AdditionalInstruction; + private List? _AdditionalInstruction; /// /// Patient or consumer oriented instructions. /// [FhirElement("patientInstruction", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Patient or consumer oriented instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -315,13 +305,13 @@ public string PatientInstruction /// [FhirElement("timing", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Timing Timing + public Hl7.Fhir.Model.Timing? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.Timing _Timing; + private Hl7.Fhir.Model.Timing? _Timing; /// /// Take "as needed" (for x). @@ -331,13 +321,13 @@ public Hl7.Fhir.Model.Timing Timing [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Body site to administer to. @@ -345,13 +335,13 @@ public Hl7.Fhir.Model.DataType AsNeeded [FhirElement("site", InSummary=true, Order=100)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How drug should enter body. @@ -359,13 +349,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", InSummary=true, Order=110)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Technique for administering medication. @@ -373,13 +363,13 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", InSummary=true, Order=120)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication administered. @@ -389,74 +379,70 @@ public Hl7.Fhir.Model.CodeableConcept Method [DataMember] public List DoseAndRate { - get { if(_DoseAndRate==null) _DoseAndRate = new List(); return _DoseAndRate; } + get => _DoseAndRate ?? new List(); set { _DoseAndRate = value; OnPropertyChanged("DoseAndRate"); } } - private List _DoseAndRate; + private List? _DoseAndRate; /// /// Upper limit on medication per unit of time. /// [FhirElement("maxDosePerPeriod", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Ratio MaxDosePerPeriod + public Hl7.Fhir.Model.Ratio? MaxDosePerPeriod { get { return _MaxDosePerPeriod; } set { _MaxDosePerPeriod = value; OnPropertyChanged("MaxDosePerPeriod"); } } - private Hl7.Fhir.Model.Ratio _MaxDosePerPeriod; + private Hl7.Fhir.Model.Ratio? _MaxDosePerPeriod; /// /// Upper limit on medication per administration. /// [FhirElement("maxDosePerAdministration", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerAdministration + public Hl7.Fhir.Model.Quantity? MaxDosePerAdministration { get { return _MaxDosePerAdministration; } set { _MaxDosePerAdministration = value; OnPropertyChanged("MaxDosePerAdministration"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerAdministration; + private Hl7.Fhir.Model.Quantity? _MaxDosePerAdministration; /// /// Upper limit on medication per lifetime of the patient. /// [FhirElement("maxDosePerLifetime", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerLifetime + public Hl7.Fhir.Model.Quantity? MaxDosePerLifetime { get { return _MaxDosePerLifetime; } set { _MaxDosePerLifetime = value; OnPropertyChanged("MaxDosePerLifetime"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerLifetime; + private Hl7.Fhir.Model.Quantity? _MaxDosePerLifetime; protected internal override void CopyToInternal(Base other) { - var dest = other as Dosage; - - if (dest == null) - { + if(other is not Dosage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)SequenceElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(AdditionalInstruction.Any()) dest.AdditionalInstruction = new List(AdditionalInstruction.DeepCopyInternal()); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.Timing)Timing.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(DoseAndRate.Any()) dest.DoseAndRate = new List(DoseAndRate.DeepCopyInternal()); - if(MaxDosePerPeriod != null) dest.MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)MaxDosePerPeriod.DeepCopyInternal(); - if(MaxDosePerAdministration != null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)MaxDosePerAdministration.DeepCopyInternal(); - if(MaxDosePerLifetime != null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)MaxDosePerLifetime.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)_SequenceElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_AdditionalInstruction is not null) dest.AdditionalInstruction = new List(_AdditionalInstruction.DeepCopyInternal()); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.Timing)_Timing.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_DoseAndRate is not null) dest.DoseAndRate = new List(_DoseAndRate.DeepCopyInternal()); + if(_MaxDosePerPeriod is not null) dest.MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)_MaxDosePerPeriod.DeepCopyInternal(); + if(_MaxDosePerAdministration is not null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)_MaxDosePerAdministration.DeepCopyInternal(); + if(_MaxDosePerLifetime is not null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)_MaxDosePerLifetime.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -468,118 +454,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Dosage; - if(otherT == null) return false; + if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(AdditionalInstruction, otherT.AdditionalInstruction)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.ListEquals(DoseAndRate, otherT.DoseAndRate)) return false; - if(!comparer.Equals(MaxDosePerPeriod, otherT.MaxDosePerPeriod)) return false; - if(!comparer.Equals(MaxDosePerAdministration, otherT.MaxDosePerAdministration)) return false; - if(!comparer.Equals(MaxDosePerLifetime, otherT.MaxDosePerLifetime)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.ListEquals(_DoseAndRate, otherT._DoseAndRate)) return false; + if(!comparer.Equals(_MaxDosePerPeriod, otherT._MaxDosePerPeriod)) return false; + if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; + if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "additionalInstruction": - value = AdditionalInstruction; - return AdditionalInstruction?.Any() == true; + value = _AdditionalInstruction; + return _AdditionalInstruction?.Any() == true; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "doseAndRate": - value = DoseAndRate; - return DoseAndRate?.Any() == true; + value = _DoseAndRate; + return _DoseAndRate?.Any() == true; case "maxDosePerPeriod": - value = MaxDosePerPeriod; - return MaxDosePerPeriod is not null; + value = _MaxDosePerPeriod; + return _MaxDosePerPeriod is not null; case "maxDosePerAdministration": - value = MaxDosePerAdministration; - return MaxDosePerAdministration is not null; + value = _MaxDosePerAdministration; + return _MaxDosePerAdministration is not null; case "maxDosePerLifetime": - value = MaxDosePerLifetime; - return MaxDosePerLifetime is not null; + value = _MaxDosePerLifetime; + return _MaxDosePerLifetime is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.Integer)value; + SequenceElement = (Hl7.Fhir.Model.Integer?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "additionalInstruction": - AdditionalInstruction = (List)value; + AdditionalInstruction = (List?)value!; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.Timing)value; + Timing = (Hl7.Fhir.Model.Timing?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseAndRate": - DoseAndRate = (List)value; + DoseAndRate = (List?)value!; return this; case "maxDosePerPeriod": - MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)value; + MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio?)value; return this; case "maxDosePerAdministration": - MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerLifetime": - MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -590,19 +576,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",AdditionalInstruction); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (DoseAndRate?.Any() == true) yield return new KeyValuePair("doseAndRate",DoseAndRate); - if (MaxDosePerPeriod is not null) yield return new KeyValuePair("maxDosePerPeriod",MaxDosePerPeriod); - if (MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",MaxDosePerAdministration); - if (MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",MaxDosePerLifetime); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",_AdditionalInstruction); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_DoseAndRate?.Any() == true) yield return new KeyValuePair("doseAndRate",_DoseAndRate); + if (_MaxDosePerPeriod is not null) yield return new KeyValuePair("maxDosePerPeriod",_MaxDosePerPeriod); + if (_MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",_MaxDosePerAdministration); + if (_MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",_MaxDosePerLifetime); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Duration.cs b/src/Hl7.Fhir.R4/Model/Generated/Duration.cs index fcaf895ca..5736cfebb 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Duration.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Duration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs b/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs index 561bb1ff3..49944466d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -102,28 +105,25 @@ public partial class SampleSizeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of sample size /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -133,13 +133,13 @@ public string Description /// [FhirElement("numberOfStudies", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfStudiesElement + public Hl7.Fhir.Model.Integer? NumberOfStudiesElement { get { return _NumberOfStudiesElement; } set { _NumberOfStudiesElement = value; OnPropertyChanged("NumberOfStudiesElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfStudiesElement; + private Hl7.Fhir.Model.Integer? _NumberOfStudiesElement; /// /// How many studies? @@ -148,13 +148,10 @@ public Hl7.Fhir.Model.Integer NumberOfStudiesElement [IgnoreDataMember] public int? NumberOfStudies { - get { return NumberOfStudiesElement != null ? NumberOfStudiesElement.Value : null; } + get => _NumberOfStudiesElement?.Value; set { - if (value == null) - NumberOfStudiesElement = null; - else - NumberOfStudiesElement = new Hl7.Fhir.Model.Integer(value); + NumberOfStudiesElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfStudies"); } } @@ -164,13 +161,13 @@ public int? NumberOfStudies /// [FhirElement("numberOfParticipants", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfParticipantsElement + public Hl7.Fhir.Model.Integer? NumberOfParticipantsElement { get { return _NumberOfParticipantsElement; } set { _NumberOfParticipantsElement = value; OnPropertyChanged("NumberOfParticipantsElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfParticipantsElement; + private Hl7.Fhir.Model.Integer? _NumberOfParticipantsElement; /// /// How many participants? @@ -179,30 +176,23 @@ public Hl7.Fhir.Model.Integer NumberOfParticipantsElement [IgnoreDataMember] public int? NumberOfParticipants { - get { return NumberOfParticipantsElement != null ? NumberOfParticipantsElement.Value : null; } + get => _NumberOfParticipantsElement?.Value; set { - if (value == null) - NumberOfParticipantsElement = null; - else - NumberOfParticipantsElement = new Hl7.Fhir.Model.Integer(value); + NumberOfParticipantsElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfParticipants"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampleSizeComponent; - - if (dest == null) - { + if(other is not SampleSizeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NumberOfStudiesElement != null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.Integer)NumberOfStudiesElement.DeepCopyInternal(); - if(NumberOfParticipantsElement != null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer)NumberOfParticipantsElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NumberOfStudiesElement is not null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.Integer)_NumberOfStudiesElement.DeepCopyInternal(); + if(_NumberOfParticipantsElement is not null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer)_NumberOfParticipantsElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -214,48 +204,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampleSizeComponent; - if(otherT == null) return false; + if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NumberOfStudiesElement, otherT.NumberOfStudiesElement)) return false; - if(!comparer.Equals(NumberOfParticipantsElement, otherT.NumberOfParticipantsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; + if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "numberOfStudies": - value = NumberOfStudiesElement; - return NumberOfStudiesElement is not null; + value = _NumberOfStudiesElement; + return _NumberOfStudiesElement is not null; case "numberOfParticipants": - value = NumberOfParticipantsElement; - return NumberOfParticipantsElement is not null; + value = _NumberOfParticipantsElement; + return _NumberOfParticipantsElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "numberOfStudies": - NumberOfStudiesElement = (Hl7.Fhir.Model.Integer)value; + NumberOfStudiesElement = (Hl7.Fhir.Model.Integer?)value; return this; case "numberOfParticipants": - NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer)value; + NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -266,9 +256,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",NumberOfStudiesElement); - if (NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",NumberOfParticipantsElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",_NumberOfStudiesElement); + if (_NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",_NumberOfParticipantsElement); } } @@ -294,28 +284,25 @@ public partial class ResultsByExposureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of results by exposure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -327,13 +314,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("ExposureState")] [DataMember] - public Code ExposureStateElement + public Code? ExposureStateElement { get { return _ExposureStateElement; } set { _ExposureStateElement = value; OnPropertyChanged("ExposureStateElement"); } } - private Code _ExposureStateElement; + private Code? _ExposureStateElement; /// /// exposure | exposure-alternative @@ -342,13 +329,10 @@ public Code ExposureSt [IgnoreDataMember] public Hl7.Fhir.Model.EffectEvidenceSynthesis.ExposureStateCode? ExposureState { - get { return ExposureStateElement != null ? ExposureStateElement.Value : null; } + get => _ExposureStateElement?.Value; set { - if (value == null) - ExposureStateElement = null; - else - ExposureStateElement = new Code(value); + ExposureStateElement = value is null ? null : new Code(value); OnPropertyChanged("ExposureState"); } } @@ -359,13 +343,13 @@ public Hl7.Fhir.Model.EffectEvidenceSynthesis.ExposureStateCode? ExposureState [FhirElement("variantState", Order=60)] [Binding("EvidenceVariantState")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VariantState + public Hl7.Fhir.Model.CodeableConcept? VariantState { get { return _VariantState; } set { _VariantState = value; OnPropertyChanged("VariantState"); } } - private Hl7.Fhir.Model.CodeableConcept _VariantState; + private Hl7.Fhir.Model.CodeableConcept? _VariantState; /// /// Risk evidence synthesis. @@ -375,28 +359,24 @@ public Hl7.Fhir.Model.CodeableConcept VariantState [References("RiskEvidenceSynthesis")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference RiskEvidenceSynthesis + public Hl7.Fhir.Model.ResourceReference? RiskEvidenceSynthesis { get { return _RiskEvidenceSynthesis; } set { _RiskEvidenceSynthesis = value; OnPropertyChanged("RiskEvidenceSynthesis"); } } - private Hl7.Fhir.Model.ResourceReference _RiskEvidenceSynthesis; + private Hl7.Fhir.Model.ResourceReference? _RiskEvidenceSynthesis; protected internal override void CopyToInternal(Base other) { - var dest = other as ResultsByExposureComponent; - - if (dest == null) - { + if(other is not ResultsByExposureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ExposureStateElement != null) dest.ExposureStateElement = (Code)ExposureStateElement.DeepCopyInternal(); - if(VariantState != null) dest.VariantState = (Hl7.Fhir.Model.CodeableConcept)VariantState.DeepCopyInternal(); - if(RiskEvidenceSynthesis != null) dest.RiskEvidenceSynthesis = (Hl7.Fhir.Model.ResourceReference)RiskEvidenceSynthesis.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ExposureStateElement is not null) dest.ExposureStateElement = (Code)_ExposureStateElement.DeepCopyInternal(); + if(_VariantState is not null) dest.VariantState = (Hl7.Fhir.Model.CodeableConcept)_VariantState.DeepCopyInternal(); + if(_RiskEvidenceSynthesis is not null) dest.RiskEvidenceSynthesis = (Hl7.Fhir.Model.ResourceReference)_RiskEvidenceSynthesis.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -408,55 +388,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResultsByExposureComponent; - if(otherT == null) return false; + if(other is not ResultsByExposureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ExposureStateElement, otherT.ExposureStateElement)) return false; - if(!comparer.Equals(VariantState, otherT.VariantState)) return false; - if(!comparer.Equals(RiskEvidenceSynthesis, otherT.RiskEvidenceSynthesis)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ExposureStateElement, otherT._ExposureStateElement)) return false; + if(!comparer.Equals(_VariantState, otherT._VariantState)) return false; + if(!comparer.Equals(_RiskEvidenceSynthesis, otherT._RiskEvidenceSynthesis)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "exposureState": - value = ExposureStateElement; - return ExposureStateElement is not null; + value = _ExposureStateElement; + return _ExposureStateElement is not null; case "variantState": - value = VariantState; - return VariantState is not null; + value = _VariantState; + return _VariantState is not null; case "riskEvidenceSynthesis": - value = RiskEvidenceSynthesis; - return RiskEvidenceSynthesis is not null; + value = _RiskEvidenceSynthesis; + return _RiskEvidenceSynthesis is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "exposureState": - ExposureStateElement = (Code)value; + ExposureStateElement = (Code?)value; return this; case "variantState": - VariantState = (Hl7.Fhir.Model.CodeableConcept)value; + VariantState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "riskEvidenceSynthesis": - RiskEvidenceSynthesis = (Hl7.Fhir.Model.ResourceReference)value; + RiskEvidenceSynthesis = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -467,10 +447,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ExposureStateElement is not null) yield return new KeyValuePair("exposureState",ExposureStateElement); - if (VariantState is not null) yield return new KeyValuePair("variantState",VariantState); - if (RiskEvidenceSynthesis is not null) yield return new KeyValuePair("riskEvidenceSynthesis",RiskEvidenceSynthesis); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ExposureStateElement is not null) yield return new KeyValuePair("exposureState",_ExposureStateElement); + if (_VariantState is not null) yield return new KeyValuePair("variantState",_VariantState); + if (_RiskEvidenceSynthesis is not null) yield return new KeyValuePair("riskEvidenceSynthesis",_RiskEvidenceSynthesis); } } @@ -496,28 +476,25 @@ public partial class EffectEstimateComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of effect estimate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -528,13 +505,13 @@ public string Description [FhirElement("type", Order=50)] [Binding("EffectEstimateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Variant exposure states. @@ -542,26 +519,26 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("variantState", Order=60)] [Binding("EvidenceVariantState")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VariantState + public Hl7.Fhir.Model.CodeableConcept? VariantState { get { return _VariantState; } set { _VariantState = value; OnPropertyChanged("VariantState"); } } - private Hl7.Fhir.Model.CodeableConcept _VariantState; + private Hl7.Fhir.Model.CodeableConcept? _VariantState; /// /// Point estimate. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Point estimate @@ -570,13 +547,10 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } @@ -587,13 +561,13 @@ public decimal? Value [FhirElement("unitOfMeasure", Order=80)] [Binding("UCUMUnits")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfMeasure + public Hl7.Fhir.Model.CodeableConcept? UnitOfMeasure { get { return _UnitOfMeasure; } set { _UnitOfMeasure = value; OnPropertyChanged("UnitOfMeasure"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfMeasure; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfMeasure; /// /// How precise the estimate is. @@ -603,28 +577,24 @@ public Hl7.Fhir.Model.CodeableConcept UnitOfMeasure [DataMember] public List PrecisionEstimate { - get { if(_PrecisionEstimate==null) _PrecisionEstimate = new List(); return _PrecisionEstimate; } + get => _PrecisionEstimate ?? new List(); set { _PrecisionEstimate = value; OnPropertyChanged("PrecisionEstimate"); } } - private List _PrecisionEstimate; + private List? _PrecisionEstimate; protected internal override void CopyToInternal(Base other) { - var dest = other as EffectEstimateComponent; - - if (dest == null) - { + if(other is not EffectEstimateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(VariantState != null) dest.VariantState = (Hl7.Fhir.Model.CodeableConcept)VariantState.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); - if(UnitOfMeasure != null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)UnitOfMeasure.DeepCopyInternal(); - if(PrecisionEstimate.Any()) dest.PrecisionEstimate = new List(PrecisionEstimate.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_VariantState is not null) dest.VariantState = (Hl7.Fhir.Model.CodeableConcept)_VariantState.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); + if(_UnitOfMeasure is not null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)_UnitOfMeasure.DeepCopyInternal(); + if(_PrecisionEstimate is not null) dest.PrecisionEstimate = new List(_PrecisionEstimate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -636,69 +606,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EffectEstimateComponent; - if(otherT == null) return false; + if(other is not EffectEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(VariantState, otherT.VariantState)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(UnitOfMeasure, otherT.UnitOfMeasure)) return false; - if(!comparer.ListEquals(PrecisionEstimate, otherT.PrecisionEstimate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_VariantState, otherT._VariantState)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; + if(!comparer.ListEquals(_PrecisionEstimate, otherT._PrecisionEstimate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "variantState": - value = VariantState; - return VariantState is not null; + value = _VariantState; + return _VariantState is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "unitOfMeasure": - value = UnitOfMeasure; - return UnitOfMeasure is not null; + value = _UnitOfMeasure; + return _UnitOfMeasure is not null; case "precisionEstimate": - value = PrecisionEstimate; - return PrecisionEstimate?.Any() == true; + value = _PrecisionEstimate; + return _PrecisionEstimate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "variantState": - VariantState = (Hl7.Fhir.Model.CodeableConcept)value; + VariantState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "unitOfMeasure": - UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "precisionEstimate": - PrecisionEstimate = (List)value; + PrecisionEstimate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -709,12 +679,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (VariantState is not null) yield return new KeyValuePair("variantState",VariantState); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",UnitOfMeasure); - if (PrecisionEstimate?.Any() == true) yield return new KeyValuePair("precisionEstimate",PrecisionEstimate); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_VariantState is not null) yield return new KeyValuePair("variantState",_VariantState); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",_UnitOfMeasure); + if (_PrecisionEstimate?.Any() == true) yield return new KeyValuePair("precisionEstimate",_PrecisionEstimate); } } @@ -741,26 +711,26 @@ public partial class PrecisionEstimateComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PrecisionEstimateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Level of confidence interval. /// [FhirElement("level", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LevelElement + public Hl7.Fhir.Model.FhirDecimal? LevelElement { get { return _LevelElement; } set { _LevelElement = value; OnPropertyChanged("LevelElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LevelElement; + private Hl7.Fhir.Model.FhirDecimal? _LevelElement; /// /// Level of confidence interval @@ -769,13 +739,10 @@ public Hl7.Fhir.Model.FhirDecimal LevelElement [IgnoreDataMember] public decimal? Level { - get { return LevelElement != null ? LevelElement.Value : null; } + get => _LevelElement?.Value; set { - if (value == null) - LevelElement = null; - else - LevelElement = new Hl7.Fhir.Model.FhirDecimal(value); + LevelElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Level"); } } @@ -785,13 +752,13 @@ public decimal? Level /// [FhirElement("from", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FromElement + public Hl7.Fhir.Model.FhirDecimal? FromElement { get { return _FromElement; } set { _FromElement = value; OnPropertyChanged("FromElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FromElement; + private Hl7.Fhir.Model.FhirDecimal? _FromElement; /// /// Lower bound @@ -800,13 +767,10 @@ public Hl7.Fhir.Model.FhirDecimal FromElement [IgnoreDataMember] public decimal? From { - get { return FromElement != null ? FromElement.Value : null; } + get => _FromElement?.Value; set { - if (value == null) - FromElement = null; - else - FromElement = new Hl7.Fhir.Model.FhirDecimal(value); + FromElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("From"); } } @@ -816,13 +780,13 @@ public decimal? From /// [FhirElement("to", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ToElement + public Hl7.Fhir.Model.FhirDecimal? ToElement { get { return _ToElement; } set { _ToElement = value; OnPropertyChanged("ToElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ToElement; + private Hl7.Fhir.Model.FhirDecimal? _ToElement; /// /// Upper bound @@ -831,31 +795,24 @@ public Hl7.Fhir.Model.FhirDecimal ToElement [IgnoreDataMember] public decimal? To { - get { return ToElement != null ? ToElement.Value : null; } + get => _ToElement?.Value; set { - if (value == null) - ToElement = null; - else - ToElement = new Hl7.Fhir.Model.FhirDecimal(value); + ToElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("To"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PrecisionEstimateComponent; - - if (dest == null) - { + if(other is not PrecisionEstimateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(LevelElement != null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)LevelElement.DeepCopyInternal(); - if(FromElement != null) dest.FromElement = (Hl7.Fhir.Model.FhirDecimal)FromElement.DeepCopyInternal(); - if(ToElement != null) dest.ToElement = (Hl7.Fhir.Model.FhirDecimal)ToElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_LevelElement is not null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)_LevelElement.DeepCopyInternal(); + if(_FromElement is not null) dest.FromElement = (Hl7.Fhir.Model.FhirDecimal)_FromElement.DeepCopyInternal(); + if(_ToElement is not null) dest.ToElement = (Hl7.Fhir.Model.FhirDecimal)_ToElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -867,55 +824,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrecisionEstimateComponent; - if(otherT == null) return false; + if(other is not PrecisionEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(LevelElement, otherT.LevelElement)) return false; - if(!comparer.Equals(FromElement, otherT.FromElement)) return false; - if(!comparer.Equals(ToElement, otherT.ToElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; + if(!comparer.Equals(_FromElement, otherT._FromElement)) return false; + if(!comparer.Equals(_ToElement, otherT._ToElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "level": - value = LevelElement; - return LevelElement is not null; + value = _LevelElement; + return _LevelElement is not null; case "from": - value = FromElement; - return FromElement is not null; + value = _FromElement; + return _FromElement is not null; case "to": - value = ToElement; - return ToElement is not null; + value = _ToElement; + return _ToElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "level": - LevelElement = (Hl7.Fhir.Model.FhirDecimal)value; + LevelElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "from": - FromElement = (Hl7.Fhir.Model.FhirDecimal)value; + FromElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "to": - ToElement = (Hl7.Fhir.Model.FhirDecimal)value; + ToElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -926,10 +883,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (LevelElement is not null) yield return new KeyValuePair("level",LevelElement); - if (FromElement is not null) yield return new KeyValuePair("from",FromElement); - if (ToElement is not null) yield return new KeyValuePair("to",ToElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_LevelElement is not null) yield return new KeyValuePair("level",_LevelElement); + if (_FromElement is not null) yield return new KeyValuePair("from",_FromElement); + if (_ToElement is not null) yield return new KeyValuePair("to",_ToElement); } } @@ -959,11 +916,11 @@ public partial class CertaintyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Rating { - get { if(_Rating==null) _Rating = new List(); return _Rating; } + get => _Rating ?? new List(); set { _Rating = value; OnPropertyChanged("Rating"); } } - private List _Rating; + private List? _Rating; /// /// Used for footnotes or explanatory notes. @@ -973,11 +930,11 @@ public List Rating [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// A component that contributes to the overall certainty. @@ -987,25 +944,21 @@ public List Note [DataMember] public List CertaintySubcomponent { - get { if(_CertaintySubcomponent==null) _CertaintySubcomponent = new List(); return _CertaintySubcomponent; } + get => _CertaintySubcomponent ?? new List(); set { _CertaintySubcomponent = value; OnPropertyChanged("CertaintySubcomponent"); } } - private List _CertaintySubcomponent; + private List? _CertaintySubcomponent; protected internal override void CopyToInternal(Base other) { - var dest = other as CertaintyComponent; - - if (dest == null) - { + if(other is not CertaintyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Rating.Any()) dest.Rating = new List(Rating.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(CertaintySubcomponent.Any()) dest.CertaintySubcomponent = new List(CertaintySubcomponent.DeepCopyInternal()); + if(_Rating is not null) dest.Rating = new List(_Rating.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_CertaintySubcomponent is not null) dest.CertaintySubcomponent = new List(_CertaintySubcomponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1017,48 +970,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CertaintyComponent; - if(otherT == null) return false; + if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Rating, otherT.Rating)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(CertaintySubcomponent, otherT.CertaintySubcomponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_CertaintySubcomponent, otherT._CertaintySubcomponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "rating": - value = Rating; - return Rating?.Any() == true; + value = _Rating; + return _Rating?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "certaintySubcomponent": - value = CertaintySubcomponent; - return CertaintySubcomponent?.Any() == true; + value = _CertaintySubcomponent; + return _CertaintySubcomponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "rating": - Rating = (List)value; + Rating = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "certaintySubcomponent": - CertaintySubcomponent = (List)value; + CertaintySubcomponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1069,9 +1022,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Rating?.Any() == true) yield return new KeyValuePair("rating",Rating); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (CertaintySubcomponent?.Any() == true) yield return new KeyValuePair("certaintySubcomponent",CertaintySubcomponent); + if (_Rating?.Any() == true) yield return new KeyValuePair("rating",_Rating); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_CertaintySubcomponent?.Any() == true) yield return new KeyValuePair("certaintySubcomponent",_CertaintySubcomponent); } } @@ -1098,13 +1051,13 @@ public partial class CertaintySubcomponentComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("type", Order=40)] [Binding("CertaintySubcomponentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Subcomponent certainty rating. @@ -1115,11 +1068,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Rating { - get { if(_Rating==null) _Rating = new List(); return _Rating; } + get => _Rating ?? new List(); set { _Rating = value; OnPropertyChanged("Rating"); } } - private List _Rating; + private List? _Rating; /// /// Used for footnotes or explanatory notes. @@ -1129,25 +1082,21 @@ public List Rating [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as CertaintySubcomponentComponent; - - if (dest == null) - { + if(other is not CertaintySubcomponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Rating.Any()) dest.Rating = new List(Rating.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Rating is not null) dest.Rating = new List(_Rating.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1159,48 +1108,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CertaintySubcomponentComponent; - if(otherT == null) return false; + if(other is not CertaintySubcomponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Rating, otherT.Rating)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "rating": - value = Rating; - return Rating?.Any() == true; + value = _Rating; + return _Rating?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rating": - Rating = (List)value; + Rating = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1211,9 +1160,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Rating?.Any() == true) yield return new KeyValuePair("rating",Rating); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Rating?.Any() == true) yield return new KeyValuePair("rating",_Rating); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -1223,28 +1172,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this effect evidence synthesis, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1257,39 +1203,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the effect evidence synthesis. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the effect evidence synthesis /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1299,28 +1242,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this effect evidence synthesis (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1330,28 +1270,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this effect evidence synthesis (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1364,13 +1301,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1379,13 +1316,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1395,28 +1329,25 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1426,28 +1357,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1460,39 +1388,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the effect evidence synthesis. /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the effect evidence synthesis /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1505,11 +1430,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The context that the content is intended to support. @@ -1519,11 +1444,11 @@ public List Note [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for effect evidence synthesis (if applicable). @@ -1534,39 +1459,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1576,28 +1498,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=230)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the effect evidence synthesis was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1607,28 +1526,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=240)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the effect evidence synthesis was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1638,13 +1554,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the EffectEvidenceSynthesis, such as Education, Treatment, Assessment, etc. @@ -1655,11 +1571,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1669,11 +1585,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1683,11 +1599,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1697,11 +1613,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1711,11 +1627,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1725,11 +1641,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Type of synthesis. @@ -1737,13 +1653,13 @@ public List RelatedArtifact [FhirElement("synthesisType", Order=320)] [Binding("SynthesisType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SynthesisType + public Hl7.Fhir.Model.CodeableConcept? SynthesisType { get { return _SynthesisType; } set { _SynthesisType = value; OnPropertyChanged("SynthesisType"); } } - private Hl7.Fhir.Model.CodeableConcept _SynthesisType; + private Hl7.Fhir.Model.CodeableConcept? _SynthesisType; /// /// Type of study. @@ -1751,13 +1667,13 @@ public Hl7.Fhir.Model.CodeableConcept SynthesisType [FhirElement("studyType", Order=330)] [Binding("StudyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StudyType + public Hl7.Fhir.Model.CodeableConcept? StudyType { get { return _StudyType; } set { _StudyType = value; OnPropertyChanged("StudyType"); } } - private Hl7.Fhir.Model.CodeableConcept _StudyType; + private Hl7.Fhir.Model.CodeableConcept? _StudyType; /// /// What population?. @@ -1767,13 +1683,13 @@ public Hl7.Fhir.Model.CodeableConcept StudyType [References("EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Population + public Hl7.Fhir.Model.ResourceReference? Population { get { return _Population; } set { _Population = value; OnPropertyChanged("Population"); } } - private Hl7.Fhir.Model.ResourceReference _Population; + private Hl7.Fhir.Model.ResourceReference? _Population; /// /// What exposure?. @@ -1783,13 +1699,13 @@ public Hl7.Fhir.Model.ResourceReference Population [References("EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Exposure + public Hl7.Fhir.Model.ResourceReference? Exposure { get { return _Exposure; } set { _Exposure = value; OnPropertyChanged("Exposure"); } } - private Hl7.Fhir.Model.ResourceReference _Exposure; + private Hl7.Fhir.Model.ResourceReference? _Exposure; /// /// What comparison exposure?. @@ -1799,13 +1715,13 @@ public Hl7.Fhir.Model.ResourceReference Exposure [References("EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExposureAlternative + public Hl7.Fhir.Model.ResourceReference? ExposureAlternative { get { return _ExposureAlternative; } set { _ExposureAlternative = value; OnPropertyChanged("ExposureAlternative"); } } - private Hl7.Fhir.Model.ResourceReference _ExposureAlternative; + private Hl7.Fhir.Model.ResourceReference? _ExposureAlternative; /// /// What outcome?. @@ -1815,26 +1731,26 @@ public Hl7.Fhir.Model.ResourceReference ExposureAlternative [References("EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Outcome + public Hl7.Fhir.Model.ResourceReference? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.ResourceReference _Outcome; + private Hl7.Fhir.Model.ResourceReference? _Outcome; /// /// What sample size was involved?. /// [FhirElement("sampleSize", Order=380)] [DataMember] - public Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent SampleSize + public Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent? SampleSize { get { return _SampleSize; } set { _SampleSize = value; OnPropertyChanged("SampleSize"); } } - private Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent _SampleSize; + private Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent? _SampleSize; /// /// What was the result per exposure?. @@ -1844,11 +1760,11 @@ public Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent SampleSize [DataMember] public List ResultsByExposure { - get { if(_ResultsByExposure==null) _ResultsByExposure = new List(); return _ResultsByExposure; } + get => _ResultsByExposure ?? new List(); set { _ResultsByExposure = value; OnPropertyChanged("ResultsByExposure"); } } - private List _ResultsByExposure; + private List? _ResultsByExposure; /// /// What was the estimated effect. @@ -1858,11 +1774,11 @@ public List R [DataMember] public List EffectEstimate { - get { if(_EffectEstimate==null) _EffectEstimate = new List(); return _EffectEstimate; } + get => _EffectEstimate ?? new List(); set { _EffectEstimate = value; OnPropertyChanged("EffectEstimate"); } } - private List _EffectEstimate; + private List? _EffectEstimate; /// /// How certain is the effect. @@ -1872,57 +1788,53 @@ public List Effe [DataMember] public List Certainty { - get { if(_Certainty==null) _Certainty = new List(); return _Certainty; } + get => _Certainty ?? new List(); set { _Certainty = value; OnPropertyChanged("Certainty"); } } - private List _Certainty; + private List? _Certainty; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EffectEvidenceSynthesis; - - if (dest == null) - { + if(other is not EffectEvidenceSynthesis dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(SynthesisType != null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)SynthesisType.DeepCopyInternal(); - if(StudyType != null) dest.StudyType = (Hl7.Fhir.Model.CodeableConcept)StudyType.DeepCopyInternal(); - if(Population != null) dest.Population = (Hl7.Fhir.Model.ResourceReference)Population.DeepCopyInternal(); - if(Exposure != null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)Exposure.DeepCopyInternal(); - if(ExposureAlternative != null) dest.ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)ExposureAlternative.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)Outcome.DeepCopyInternal(); - if(SampleSize != null) dest.SampleSize = (Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent)SampleSize.DeepCopyInternal(); - if(ResultsByExposure.Any()) dest.ResultsByExposure = new List(ResultsByExposure.DeepCopyInternal()); - if(EffectEstimate.Any()) dest.EffectEstimate = new List(EffectEstimate.DeepCopyInternal()); - if(Certainty.Any()) dest.Certainty = new List(Certainty.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_SynthesisType is not null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)_SynthesisType.DeepCopyInternal(); + if(_StudyType is not null) dest.StudyType = (Hl7.Fhir.Model.CodeableConcept)_StudyType.DeepCopyInternal(); + if(_Population is not null) dest.Population = (Hl7.Fhir.Model.ResourceReference)_Population.DeepCopyInternal(); + if(_Exposure is not null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)_Exposure.DeepCopyInternal(); + if(_ExposureAlternative is not null) dest.ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)_ExposureAlternative.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)_Outcome.DeepCopyInternal(); + if(_SampleSize is not null) dest.SampleSize = (Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent)_SampleSize.DeepCopyInternal(); + if(_ResultsByExposure is not null) dest.ResultsByExposure = new List(_ResultsByExposure.DeepCopyInternal()); + if(_EffectEstimate is not null) dest.EffectEstimate = new List(_EffectEstimate.DeepCopyInternal()); + if(_Certainty is not null) dest.Certainty = new List(_Certainty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1934,258 +1846,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EffectEvidenceSynthesis; - if(otherT == null) return false; + if(other is not EffectEvidenceSynthesis otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(SynthesisType, otherT.SynthesisType)) return false; - if(!comparer.Equals(StudyType, otherT.StudyType)) return false; - if(!comparer.Equals(Population, otherT.Population)) return false; - if(!comparer.Equals(Exposure, otherT.Exposure)) return false; - if(!comparer.Equals(ExposureAlternative, otherT.ExposureAlternative)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(SampleSize, otherT.SampleSize)) return false; - if(!comparer.ListEquals(ResultsByExposure, otherT.ResultsByExposure)) return false; - if(!comparer.ListEquals(EffectEstimate, otherT.EffectEstimate)) return false; - if(!comparer.ListEquals(Certainty, otherT.Certainty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_SynthesisType, otherT._SynthesisType)) return false; + if(!comparer.Equals(_StudyType, otherT._StudyType)) return false; + if(!comparer.Equals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_Exposure, otherT._Exposure)) return false; + if(!comparer.Equals(_ExposureAlternative, otherT._ExposureAlternative)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_SampleSize, otherT._SampleSize)) return false; + if(!comparer.ListEquals(_ResultsByExposure, otherT._ResultsByExposure)) return false; + if(!comparer.ListEquals(_EffectEstimate, otherT._EffectEstimate)) return false; + if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "synthesisType": - value = SynthesisType; - return SynthesisType is not null; + value = _SynthesisType; + return _SynthesisType is not null; case "studyType": - value = StudyType; - return StudyType is not null; + value = _StudyType; + return _StudyType is not null; case "population": - value = Population; - return Population is not null; + value = _Population; + return _Population is not null; case "exposure": - value = Exposure; - return Exposure is not null; + value = _Exposure; + return _Exposure is not null; case "exposureAlternative": - value = ExposureAlternative; - return ExposureAlternative is not null; + value = _ExposureAlternative; + return _ExposureAlternative is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "sampleSize": - value = SampleSize; - return SampleSize is not null; + value = _SampleSize; + return _SampleSize is not null; case "resultsByExposure": - value = ResultsByExposure; - return ResultsByExposure?.Any() == true; + value = _ResultsByExposure; + return _ResultsByExposure?.Any() == true; case "effectEstimate": - value = EffectEstimate; - return EffectEstimate?.Any() == true; + value = _EffectEstimate; + return _EffectEstimate?.Any() == true; case "certainty": - value = Certainty; - return Certainty?.Any() == true; + value = _Certainty; + return _Certainty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "synthesisType": - SynthesisType = (Hl7.Fhir.Model.CodeableConcept)value; + SynthesisType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyType": - StudyType = (Hl7.Fhir.Model.CodeableConcept)value; + StudyType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "population": - Population = (Hl7.Fhir.Model.ResourceReference)value; + Population = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposure": - Exposure = (Hl7.Fhir.Model.ResourceReference)value; + Exposure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposureAlternative": - ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)value; + ExposureAlternative = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.ResourceReference)value; + Outcome = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sampleSize": - SampleSize = (Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent)value; + SampleSize = (Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent?)value; return this; case "resultsByExposure": - ResultsByExposure = (List)value; + ResultsByExposure = (List?)value!; return this; case "effectEstimate": - EffectEstimate = (List)value; + EffectEstimate = (List?)value!; return this; case "certainty": - Certainty = (List)value; + Certainty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2196,39 +2108,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (SynthesisType is not null) yield return new KeyValuePair("synthesisType",SynthesisType); - if (StudyType is not null) yield return new KeyValuePair("studyType",StudyType); - if (Population is not null) yield return new KeyValuePair("population",Population); - if (Exposure is not null) yield return new KeyValuePair("exposure",Exposure); - if (ExposureAlternative is not null) yield return new KeyValuePair("exposureAlternative",ExposureAlternative); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (SampleSize is not null) yield return new KeyValuePair("sampleSize",SampleSize); - if (ResultsByExposure?.Any() == true) yield return new KeyValuePair("resultsByExposure",ResultsByExposure); - if (EffectEstimate?.Any() == true) yield return new KeyValuePair("effectEstimate",EffectEstimate); - if (Certainty?.Any() == true) yield return new KeyValuePair("certainty",Certainty); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_SynthesisType is not null) yield return new KeyValuePair("synthesisType",_SynthesisType); + if (_StudyType is not null) yield return new KeyValuePair("studyType",_StudyType); + if (_Population is not null) yield return new KeyValuePair("population",_Population); + if (_Exposure is not null) yield return new KeyValuePair("exposure",_Exposure); + if (_ExposureAlternative is not null) yield return new KeyValuePair("exposureAlternative",_ExposureAlternative); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_SampleSize is not null) yield return new KeyValuePair("sampleSize",_SampleSize); + if (_ResultsByExposure?.Any() == true) yield return new KeyValuePair("resultsByExposure",_ResultsByExposure); + if (_EffectEstimate?.Any() == true) yield return new KeyValuePair("effectEstimate",_EffectEstimate); + if (_Certainty?.Any() == true) yield return new KeyValuePair("certainty",_Certainty); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs index 03ec91c6f..654b42f38 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -184,13 +187,13 @@ public partial class StatusHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled + @@ -199,13 +202,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -216,26 +216,22 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusHistoryComponent; - - if (dest == null) - { + if(other is not StatusHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -247,41 +243,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusHistoryComponent; - if(otherT == null) return false; + if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -292,8 +288,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -321,13 +317,13 @@ public partial class ClassHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EncounterClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Class + public Hl7.Fhir.Model.Coding? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.Coding _Class; + private Hl7.Fhir.Model.Coding? _Class; /// /// The time that the episode was in the specified class. @@ -335,26 +331,22 @@ public Hl7.Fhir.Model.Coding Class [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ClassHistoryComponent; - - if (dest == null) - { + if(other is not ClassHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Class != null) dest.Class = (Hl7.Fhir.Model.Coding)Class.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.Coding)_Class.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -366,41 +358,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassHistoryComponent; - if(otherT == null) return false; + if(other is not ClassHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "class": - Class = (Hl7.Fhir.Model.Coding)value; + Class = (Hl7.Fhir.Model.Coding?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -411,8 +403,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -442,24 +434,24 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Period of time during the encounter that the participant participated. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Persons involved in the encounter other than the patient. @@ -468,27 +460,23 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Individual + public Hl7.Fhir.Model.ResourceReference? Individual { get { return _Individual; } set { _Individual = value; OnPropertyChanged("Individual"); } } - private Hl7.Fhir.Model.ResourceReference _Individual; + private Hl7.Fhir.Model.ResourceReference? _Individual; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Individual != null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)Individual.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Individual is not null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)_Individual.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -500,48 +488,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Individual, otherT.Individual)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Individual, otherT._Individual)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "individual": - value = Individual; - return Individual is not null; + value = _Individual; + return _Individual is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "individual": - Individual = (Hl7.Fhir.Model.ResourceReference)value; + Individual = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -552,9 +540,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Individual is not null) yield return new KeyValuePair("individual",Individual); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Individual is not null) yield return new KeyValuePair("individual",_Individual); } } @@ -580,13 +568,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition","Procedure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …). @@ -594,26 +582,26 @@ public Hl7.Fhir.Model.ResourceReference Condition [FhirElement("use", Order=50)] [Binding("DiagnosisRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Use + public Hl7.Fhir.Model.CodeableConcept? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.CodeableConcept _Use; + private Hl7.Fhir.Model.CodeableConcept? _Use; /// /// Ranking of the diagnosis (for each role type). /// [FhirElement("rank", Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankElement + public Hl7.Fhir.Model.PositiveInt? RankElement { get { return _RankElement; } set { _RankElement = value; OnPropertyChanged("RankElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankElement; + private Hl7.Fhir.Model.PositiveInt? _RankElement; /// /// Ranking of the diagnosis (for each role type) @@ -622,30 +610,23 @@ public Hl7.Fhir.Model.PositiveInt RankElement [IgnoreDataMember] public int? Rank { - get { return RankElement != null ? RankElement.Value : null; } + get => _RankElement?.Value; set { - if (value == null) - RankElement = null; - else - RankElement = new Hl7.Fhir.Model.PositiveInt(value); + RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Rank"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)Use.DeepCopyInternal(); - if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)_Use.DeepCopyInternal(); + if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -657,48 +638,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; - if(!comparer.Equals(RankElement, otherT.RankElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; + if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; case "rank": - value = RankElement; - return RankElement is not null; + value = _RankElement; + return _RankElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "use": - Use = (Hl7.Fhir.Model.CodeableConcept)value; + Use = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rank": - RankElement = (Hl7.Fhir.Model.PositiveInt)value; + RankElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -709,9 +690,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Use is not null) yield return new KeyValuePair("use",Use); - if (RankElement is not null) yield return new KeyValuePair("rank",RankElement); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Use is not null) yield return new KeyValuePair("use",_Use); + if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement); } } @@ -738,13 +719,13 @@ public partial class HospitalizationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("preAdmissionIdentifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier + public Hl7.Fhir.Model.Identifier? PreAdmissionIdentifier { get { return _PreAdmissionIdentifier; } set { _PreAdmissionIdentifier = value; OnPropertyChanged("PreAdmissionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _PreAdmissionIdentifier; + private Hl7.Fhir.Model.Identifier? _PreAdmissionIdentifier; /// /// The location/organization from which the patient came before admission. @@ -753,13 +734,13 @@ public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Origin + public Hl7.Fhir.Model.ResourceReference? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.ResourceReference _Origin; + private Hl7.Fhir.Model.ResourceReference? _Origin; /// /// From where patient was admitted (physician referral, transfer). @@ -767,13 +748,13 @@ public Hl7.Fhir.Model.ResourceReference Origin [FhirElement("admitSource", Order=60)] [Binding("AdmitSource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdmitSource + public Hl7.Fhir.Model.CodeableConcept? AdmitSource { get { return _AdmitSource; } set { _AdmitSource = value; OnPropertyChanged("AdmitSource"); } } - private Hl7.Fhir.Model.CodeableConcept _AdmitSource; + private Hl7.Fhir.Model.CodeableConcept? _AdmitSource; /// /// The type of hospital re-admission that has occurred (if any). If the value is absent, then this is not identified as a readmission. @@ -781,13 +762,13 @@ public Hl7.Fhir.Model.CodeableConcept AdmitSource [FhirElement("reAdmission", Order=70)] [Binding("ReAdmissionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReAdmission + public Hl7.Fhir.Model.CodeableConcept? ReAdmission { get { return _ReAdmission; } set { _ReAdmission = value; OnPropertyChanged("ReAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _ReAdmission; + private Hl7.Fhir.Model.CodeableConcept? _ReAdmission; /// /// Diet preferences reported by the patient. @@ -798,11 +779,11 @@ public Hl7.Fhir.Model.CodeableConcept ReAdmission [DataMember] public List DietPreference { - get { if(_DietPreference==null) _DietPreference = new List(); return _DietPreference; } + get => _DietPreference ?? new List(); set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } - private List _DietPreference; + private List? _DietPreference; /// /// Special courtesies (VIP, board member). @@ -813,11 +794,11 @@ public List DietPreference [DataMember] public List SpecialCourtesy { - get { if(_SpecialCourtesy==null) _SpecialCourtesy = new List(); return _SpecialCourtesy; } + get => _SpecialCourtesy ?? new List(); set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } - private List _SpecialCourtesy; + private List? _SpecialCourtesy; /// /// Wheelchair, translator, stretcher, etc. @@ -828,11 +809,11 @@ public List SpecialCourtesy [DataMember] public List SpecialArrangement { - get { if(_SpecialArrangement==null) _SpecialArrangement = new List(); return _SpecialArrangement; } + get => _SpecialArrangement ?? new List(); set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } - private List _SpecialArrangement; + private List? _SpecialArrangement; /// /// Location/organization to which the patient is discharged. @@ -841,13 +822,13 @@ public List SpecialArrangement [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Category or kind of location after discharge. @@ -855,33 +836,29 @@ public Hl7.Fhir.Model.ResourceReference Destination [FhirElement("dischargeDisposition", Order=120)] [Binding("DischargeDisp")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DischargeDisposition + public Hl7.Fhir.Model.CodeableConcept? DischargeDisposition { get { return _DischargeDisposition; } set { _DischargeDisposition = value; OnPropertyChanged("DischargeDisposition"); } } - private Hl7.Fhir.Model.CodeableConcept _DischargeDisposition; + private Hl7.Fhir.Model.CodeableConcept? _DischargeDisposition; protected internal override void CopyToInternal(Base other) { - var dest = other as HospitalizationComponent; - - if (dest == null) - { + if(other is not HospitalizationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PreAdmissionIdentifier != null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)PreAdmissionIdentifier.DeepCopyInternal(); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)Origin.DeepCopyInternal(); - if(AdmitSource != null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)AdmitSource.DeepCopyInternal(); - if(ReAdmission != null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)ReAdmission.DeepCopyInternal(); - if(DietPreference.Any()) dest.DietPreference = new List(DietPreference.DeepCopyInternal()); - if(SpecialCourtesy.Any()) dest.SpecialCourtesy = new List(SpecialCourtesy.DeepCopyInternal()); - if(SpecialArrangement.Any()) dest.SpecialArrangement = new List(SpecialArrangement.DeepCopyInternal()); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(DischargeDisposition != null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)DischargeDisposition.DeepCopyInternal(); + if(_PreAdmissionIdentifier is not null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)_PreAdmissionIdentifier.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)_Origin.DeepCopyInternal(); + if(_AdmitSource is not null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)_AdmitSource.DeepCopyInternal(); + if(_ReAdmission is not null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)_ReAdmission.DeepCopyInternal(); + if(_DietPreference is not null) dest.DietPreference = new List(_DietPreference.DeepCopyInternal()); + if(_SpecialCourtesy is not null) dest.SpecialCourtesy = new List(_SpecialCourtesy.DeepCopyInternal()); + if(_SpecialArrangement is not null) dest.SpecialArrangement = new List(_SpecialArrangement.DeepCopyInternal()); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_DischargeDisposition is not null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)_DischargeDisposition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -893,90 +870,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HospitalizationComponent; - if(otherT == null) return false; + if(other is not HospitalizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PreAdmissionIdentifier, otherT.PreAdmissionIdentifier)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(AdmitSource, otherT.AdmitSource)) return false; - if(!comparer.Equals(ReAdmission, otherT.ReAdmission)) return false; - if(!comparer.ListEquals(DietPreference, otherT.DietPreference)) return false; - if(!comparer.ListEquals(SpecialCourtesy, otherT.SpecialCourtesy)) return false; - if(!comparer.ListEquals(SpecialArrangement, otherT.SpecialArrangement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(DischargeDisposition, otherT.DischargeDisposition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; + if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; + if(!comparer.ListEquals(_DietPreference, otherT._DietPreference)) return false; + if(!comparer.ListEquals(_SpecialCourtesy, otherT._SpecialCourtesy)) return false; + if(!comparer.ListEquals(_SpecialArrangement, otherT._SpecialArrangement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "preAdmissionIdentifier": - value = PreAdmissionIdentifier; - return PreAdmissionIdentifier is not null; + value = _PreAdmissionIdentifier; + return _PreAdmissionIdentifier is not null; case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "admitSource": - value = AdmitSource; - return AdmitSource is not null; + value = _AdmitSource; + return _AdmitSource is not null; case "reAdmission": - value = ReAdmission; - return ReAdmission is not null; + value = _ReAdmission; + return _ReAdmission is not null; case "dietPreference": - value = DietPreference; - return DietPreference?.Any() == true; + value = _DietPreference; + return _DietPreference?.Any() == true; case "specialCourtesy": - value = SpecialCourtesy; - return SpecialCourtesy?.Any() == true; + value = _SpecialCourtesy; + return _SpecialCourtesy?.Any() == true; case "specialArrangement": - value = SpecialArrangement; - return SpecialArrangement?.Any() == true; + value = _SpecialArrangement; + return _SpecialArrangement?.Any() == true; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "dischargeDisposition": - value = DischargeDisposition; - return DischargeDisposition is not null; + value = _DischargeDisposition; + return _DischargeDisposition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "preAdmissionIdentifier": - PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)value; + PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "origin": - Origin = (Hl7.Fhir.Model.ResourceReference)value; + Origin = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "admitSource": - AdmitSource = (Hl7.Fhir.Model.CodeableConcept)value; + AdmitSource = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reAdmission": - ReAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + ReAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dietPreference": - DietPreference = (List)value; + DietPreference = (List?)value!; return this; case "specialCourtesy": - SpecialCourtesy = (List)value; + SpecialCourtesy = (List?)value!; return this; case "specialArrangement": - SpecialArrangement = (List)value; + SpecialArrangement = (List?)value!; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dischargeDisposition": - DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)value; + DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -987,15 +964,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",PreAdmissionIdentifier); - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (AdmitSource is not null) yield return new KeyValuePair("admitSource",AdmitSource); - if (ReAdmission is not null) yield return new KeyValuePair("reAdmission",ReAdmission); - if (DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",DietPreference); - if (SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",SpecialCourtesy); - if (SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",SpecialArrangement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",DischargeDisposition); + if (_PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",_PreAdmissionIdentifier); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_AdmitSource is not null) yield return new KeyValuePair("admitSource",_AdmitSource); + if (_ReAdmission is not null) yield return new KeyValuePair("reAdmission",_ReAdmission); + if (_DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",_DietPreference); + if (_SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",_SpecialCourtesy); + if (_SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",_SpecialArrangement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",_DischargeDisposition); } } @@ -1025,13 +1002,13 @@ public partial class LocationComponent : Hl7.Fhir.Model.BackboneElement [References("Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// planned | active | reserved | completed. @@ -1040,13 +1017,13 @@ public Hl7.Fhir.Model.ResourceReference Location [DeclaredType(Type = typeof(Code))] [Binding("EncounterLocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | active | reserved | completed @@ -1055,13 +1032,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1072,41 +1046,37 @@ public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status [FhirElement("physicalType", Order=60)] [Binding("PhysicalType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PhysicalType + public Hl7.Fhir.Model.CodeableConcept? PhysicalType { get { return _PhysicalType; } set { _PhysicalType = value; OnPropertyChanged("PhysicalType"); } } - private Hl7.Fhir.Model.CodeableConcept _PhysicalType; + private Hl7.Fhir.Model.CodeableConcept? _PhysicalType; /// /// Time period during which the patient was present at the location. /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as LocationComponent; - - if (dest == null) - { + if(other is not LocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PhysicalType != null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)PhysicalType.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PhysicalType is not null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)_PhysicalType.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1118,55 +1088,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LocationComponent; - if(otherT == null) return false; + if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(PhysicalType, otherT.PhysicalType)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_PhysicalType, otherT._PhysicalType)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "physicalType": - value = PhysicalType; - return PhysicalType is not null; + value = _PhysicalType; + return _PhysicalType is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "physicalType": - PhysicalType = (Hl7.Fhir.Model.CodeableConcept)value; + PhysicalType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -1177,10 +1147,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Location is not null) yield return new KeyValuePair("location",Location); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PhysicalType is not null) yield return new KeyValuePair("physicalType",PhysicalType); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PhysicalType is not null) yield return new KeyValuePair("physicalType",_PhysicalType); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -1193,11 +1163,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled +. @@ -1207,13 +1177,13 @@ public List Identifier [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled + @@ -1222,13 +1192,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1241,11 +1208,11 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [DataMember] public List StatusHistory { - get { if(_StatusHistory==null) _StatusHistory = new List(); return _StatusHistory; } + get => _StatusHistory ?? new List(); set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } - private List _StatusHistory; + private List? _StatusHistory; /// /// Classification of patient encounter. @@ -1254,13 +1221,13 @@ public List StatusHistory [Binding("EncounterClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Class + public Hl7.Fhir.Model.Coding? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.Coding _Class; + private Hl7.Fhir.Model.Coding? _Class; /// /// List of past encounter classes. @@ -1270,11 +1237,11 @@ public Hl7.Fhir.Model.Coding Class [DataMember] public List ClassHistory { - get { if(_ClassHistory==null) _ClassHistory = new List(); return _ClassHistory; } + get => _ClassHistory ?? new List(); set { _ClassHistory = value; OnPropertyChanged("ClassHistory"); } } - private List _ClassHistory; + private List? _ClassHistory; /// /// Specific type of encounter. @@ -1285,11 +1252,11 @@ public List ClassHistory [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specific type of service. @@ -1297,13 +1264,13 @@ public List Type [FhirElement("serviceType", InSummary=true, Order=150)] [Binding("EncounterServiceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ServiceType + public Hl7.Fhir.Model.CodeableConcept? ServiceType { get { return _ServiceType; } set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private Hl7.Fhir.Model.CodeableConcept _ServiceType; + private Hl7.Fhir.Model.CodeableConcept? _ServiceType; /// /// Indicates the urgency of the encounter. @@ -1311,13 +1278,13 @@ public Hl7.Fhir.Model.CodeableConcept ServiceType [FhirElement("priority", Order=160, FiveWs="FiveWs.grade")] [Binding("Priority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// The patient or group present at the encounter. @@ -1326,13 +1293,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Episode(s) of care that this encounter should be recorded against. @@ -1344,11 +1311,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List EpisodeOfCare { - get { if(_EpisodeOfCare==null) _EpisodeOfCare = new List(); return _EpisodeOfCare; } + get => _EpisodeOfCare ?? new List(); set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } - private List _EpisodeOfCare; + private List? _EpisodeOfCare; /// /// The ServiceRequest that initiated this encounter. @@ -1360,11 +1327,11 @@ public List EpisodeOfCare [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// List of participants involved in the encounter. @@ -1374,11 +1341,11 @@ public List BasedOn [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The appointment that scheduled this encounter. @@ -1390,37 +1357,37 @@ public List Participant [DataMember] public List Appointment { - get { if(_Appointment==null) _Appointment = new List(); return _Appointment; } + get => _Appointment ?? new List(); set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private List _Appointment; + private List? _Appointment; /// /// The start and end time of the encounter. /// [FhirElement("period", Order=220, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Quantity of time the encounter lasted (less time absent). /// [FhirElement("length", Order=230)] [DataMember] - public Hl7.Fhir.Model.Duration Length + public Hl7.Fhir.Model.Duration? Length { get { return _Length; } set { _Length = value; OnPropertyChanged("Length"); } } - private Hl7.Fhir.Model.Duration _Length; + private Hl7.Fhir.Model.Duration? _Length; /// /// Coded reason the encounter takes place. @@ -1431,11 +1398,11 @@ public Hl7.Fhir.Model.Duration Length [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Reason the encounter takes place (reference). @@ -1447,11 +1414,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// The list of diagnosis relevant to this encounter. @@ -1461,11 +1428,11 @@ public List ReasonReference [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The set of accounts that may be used for billing for this Encounter. @@ -1477,24 +1444,24 @@ public List Diagnosis [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Details about the admission to a healthcare service. /// [FhirElement("hospitalization", Order=280)] [DataMember] - public Hl7.Fhir.Model.Encounter.HospitalizationComponent Hospitalization + public Hl7.Fhir.Model.Encounter.HospitalizationComponent? Hospitalization { get { return _Hospitalization; } set { _Hospitalization = value; OnPropertyChanged("Hospitalization"); } } - private Hl7.Fhir.Model.Encounter.HospitalizationComponent _Hospitalization; + private Hl7.Fhir.Model.Encounter.HospitalizationComponent? _Hospitalization; /// /// List of locations where the patient has been. @@ -1504,11 +1471,11 @@ public Hl7.Fhir.Model.Encounter.HospitalizationComponent Hospitalization [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// The organization (facility) responsible for this encounter. @@ -1517,13 +1484,13 @@ public List Location [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ServiceProvider + public Hl7.Fhir.Model.ResourceReference? ServiceProvider { get { return _ServiceProvider; } set { _ServiceProvider = value; OnPropertyChanged("ServiceProvider"); } } - private Hl7.Fhir.Model.ResourceReference _ServiceProvider; + private Hl7.Fhir.Model.ResourceReference? _ServiceProvider; /// /// Another Encounter this encounter is part of. @@ -1532,52 +1499,48 @@ public Hl7.Fhir.Model.ResourceReference ServiceProvider [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Encounter; - - if (dest == null) - { + if(other is not Encounter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusHistory.Any()) dest.StatusHistory = new List(StatusHistory.DeepCopyInternal()); - if(Class != null) dest.Class = (Hl7.Fhir.Model.Coding)Class.DeepCopyInternal(); - if(ClassHistory.Any()) dest.ClassHistory = new List(ClassHistory.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(ServiceType != null) dest.ServiceType = (Hl7.Fhir.Model.CodeableConcept)ServiceType.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(EpisodeOfCare.Any()) dest.EpisodeOfCare = new List(EpisodeOfCare.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Appointment.Any()) dest.Appointment = new List(Appointment.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Length != null) dest.Length = (Hl7.Fhir.Model.Duration)Length.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(Hospitalization != null) dest.Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)Hospitalization.DeepCopyInternal(); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(ServiceProvider != null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)ServiceProvider.DeepCopyInternal(); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusHistory is not null) dest.StatusHistory = new List(_StatusHistory.DeepCopyInternal()); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.Coding)_Class.DeepCopyInternal(); + if(_ClassHistory is not null) dest.ClassHistory = new List(_ClassHistory.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = (Hl7.Fhir.Model.CodeableConcept)_ServiceType.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_EpisodeOfCare is not null) dest.EpisodeOfCare = new List(_EpisodeOfCare.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = new List(_Appointment.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Length is not null) dest.Length = (Hl7.Fhir.Model.Duration)_Length.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_Hospitalization is not null) dest.Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)_Hospitalization.DeepCopyInternal(); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_ServiceProvider is not null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)_ServiceProvider.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1589,188 +1552,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Encounter; - if(otherT == null) return false; + if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusHistory, otherT.StatusHistory)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(ClassHistory, otherT.ClassHistory)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(EpisodeOfCare, otherT.EpisodeOfCare)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(Appointment, otherT.Appointment)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Length, otherT.Length)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.Equals(Hospitalization, otherT.Hospitalization)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(ServiceProvider, otherT.ServiceProvider)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_ClassHistory, otherT._ClassHistory)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_EpisodeOfCare, otherT._EpisodeOfCare)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_Appointment, otherT._Appointment)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Length, otherT._Length)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.Equals(_Hospitalization, otherT._Hospitalization)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_ServiceProvider, otherT._ServiceProvider)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusHistory": - value = StatusHistory; - return StatusHistory?.Any() == true; + value = _StatusHistory; + return _StatusHistory?.Any() == true; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "classHistory": - value = ClassHistory; - return ClassHistory?.Any() == true; + value = _ClassHistory; + return _ClassHistory?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType is not null; + value = _ServiceType; + return _ServiceType is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "episodeOfCare": - value = EpisodeOfCare; - return EpisodeOfCare?.Any() == true; + value = _EpisodeOfCare; + return _EpisodeOfCare?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "appointment": - value = Appointment; - return Appointment?.Any() == true; + value = _Appointment; + return _Appointment?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "length": - value = Length; - return Length is not null; + value = _Length; + return _Length is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "hospitalization": - value = Hospitalization; - return Hospitalization is not null; + value = _Hospitalization; + return _Hospitalization is not null; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "serviceProvider": - value = ServiceProvider; - return ServiceProvider is not null; + value = _ServiceProvider; + return _ServiceProvider is not null; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusHistory": - StatusHistory = (List)value; + StatusHistory = (List?)value!; return this; case "class": - Class = (Hl7.Fhir.Model.Coding)value; + Class = (Hl7.Fhir.Model.Coding?)value; return this; case "classHistory": - ClassHistory = (List)value; + ClassHistory = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "serviceType": - ServiceType = (Hl7.Fhir.Model.CodeableConcept)value; + ServiceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "episodeOfCare": - EpisodeOfCare = (List)value; + EpisodeOfCare = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "appointment": - Appointment = (List)value; + Appointment = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "length": - Length = (Hl7.Fhir.Model.Duration)value; + Length = (Hl7.Fhir.Model.Duration?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "hospitalization": - Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)value; + Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent?)value; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "serviceProvider": - ServiceProvider = (Hl7.Fhir.Model.ResourceReference)value; + ServiceProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1781,29 +1744,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",StatusHistory); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (ClassHistory?.Any() == true) yield return new KeyValuePair("classHistory",ClassHistory); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (ServiceType is not null) yield return new KeyValuePair("serviceType",ServiceType); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",EpisodeOfCare); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Appointment?.Any() == true) yield return new KeyValuePair("appointment",Appointment); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Length is not null) yield return new KeyValuePair("length",Length); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (Hospitalization is not null) yield return new KeyValuePair("hospitalization",Hospitalization); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",ServiceProvider); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",_StatusHistory); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_ClassHistory?.Any() == true) yield return new KeyValuePair("classHistory",_ClassHistory); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_ServiceType is not null) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",_EpisodeOfCare); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Appointment?.Any() == true) yield return new KeyValuePair("appointment",_Appointment); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Length is not null) yield return new KeyValuePair("length",_Length); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_Hospitalization is not null) yield return new KeyValuePair("hospitalization",_Hospitalization); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",_ServiceProvider); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs index a7caad5a0..e989a70bb 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,11 +116,11 @@ public enum EndpointStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | error | off | entered-in-error | test. @@ -127,13 +130,13 @@ public List Identifier [Binding("EndpointStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | error | off | entered-in-error | test @@ -142,13 +145,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -160,41 +160,38 @@ public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status [Binding("endpoint-contype")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding ConnectionType + public Hl7.Fhir.Model.Coding? ConnectionType { get { return _ConnectionType; } set { _ConnectionType = value; OnPropertyChanged("ConnectionType"); } } - private Hl7.Fhir.Model.Coding _ConnectionType; + private Hl7.Fhir.Model.Coding? _ConnectionType; /// /// A name that this endpoint can be identified by. /// [FhirElement("name", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name that this endpoint can be identified by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -206,13 +203,13 @@ public string Name [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Contact details for source (e.g. troubleshooting). @@ -222,24 +219,24 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Interval the endpoint is expected to be operational. /// [FhirElement("period", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The type of content that may be used at this endpoint (e.g. XDS Discharge summaries). @@ -250,11 +247,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List PayloadType { - get { if(_PayloadType==null) _PayloadType = new List(); return _PayloadType; } + get => _PayloadType ?? new List(); set { _PayloadType = value; OnPropertyChanged("PayloadType"); } } - private List _PayloadType; + private List? _PayloadType; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this). @@ -265,24 +262,24 @@ public List PayloadType [DataMember] public List PayloadMimeTypeElement { - get { if(_PayloadMimeTypeElement==null) _PayloadMimeTypeElement = new List(); return _PayloadMimeTypeElement; } + get => _PayloadMimeTypeElement ?? new List(); set { _PayloadMimeTypeElement = value; OnPropertyChanged("PayloadMimeTypeElement"); } } - private List _PayloadMimeTypeElement; + private List? _PayloadMimeTypeElement; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PayloadMimeType + public IEnumerable? PayloadMimeType { - get { return PayloadMimeTypeElement != null ? PayloadMimeTypeElement.Select(elem => elem.Value) : null; } + get => _PayloadMimeTypeElement?.Select(elem => elem.Value); set { if (value == null) - PayloadMimeTypeElement = null; + PayloadMimeTypeElement = null!; else PayloadMimeTypeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("PayloadMimeType"); @@ -295,28 +292,25 @@ public IEnumerable PayloadMimeType [FhirElement("address", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl AddressElement + public Hl7.Fhir.Model.FhirUrl? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirUrl _AddressElement; + private Hl7.Fhir.Model.FhirUrl? _AddressElement; /// /// The technical base address for connecting to this endpoint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirUrl(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Address"); } } @@ -329,24 +323,24 @@ public string Address [DataMember] public List HeaderElement { - get { if(_HeaderElement==null) _HeaderElement = new List(); return _HeaderElement; } + get => _HeaderElement ?? new List(); set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } - private List _HeaderElement; + private List? _HeaderElement; /// /// Usage depends on the channel type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Header + public IEnumerable? Header { - get { return HeaderElement != null ? HeaderElement.Select(elem => elem.Value) : null; } + get => _HeaderElement?.Select(elem => elem.Value); set { if (value == null) - HeaderElement = null; + HeaderElement = null!; else HeaderElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Header"); @@ -357,25 +351,21 @@ public IEnumerable Header protected internal override void CopyToInternal(Base other) { - var dest = other as Endpoint; - - if (dest == null) - { + if(other is not Endpoint dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ConnectionType != null) dest.ConnectionType = (Hl7.Fhir.Model.Coding)ConnectionType.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(PayloadType.Any()) dest.PayloadType = new List(PayloadType.DeepCopyInternal()); - if(PayloadMimeTypeElement.Any()) dest.PayloadMimeTypeElement = new List(PayloadMimeTypeElement.DeepCopyInternal()); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)AddressElement.DeepCopyInternal(); - if(HeaderElement.Any()) dest.HeaderElement = new List(HeaderElement.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ConnectionType is not null) dest.ConnectionType = (Hl7.Fhir.Model.Coding)_ConnectionType.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_PayloadType is not null) dest.PayloadType = new List(_PayloadType.DeepCopyInternal()); + if(_PayloadMimeTypeElement is not null) dest.PayloadMimeTypeElement = new List(_PayloadMimeTypeElement.DeepCopyInternal()); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)_AddressElement.DeepCopyInternal(); + if(_HeaderElement is not null) dest.HeaderElement = new List(_HeaderElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -387,104 +377,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Endpoint; - if(otherT == null) return false; + if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ConnectionType, otherT.ConnectionType)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(PayloadType, otherT.PayloadType)) return false; - if(!comparer.ListEquals(PayloadMimeTypeElement, otherT.PayloadMimeTypeElement)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; - if(!comparer.ListEquals(HeaderElement, otherT.HeaderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ConnectionType, otherT._ConnectionType)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_PayloadType, otherT._PayloadType)) return false; + if(!comparer.ListEquals(_PayloadMimeTypeElement, otherT._PayloadMimeTypeElement)) return false; + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "connectionType": - value = ConnectionType; - return ConnectionType is not null; + value = _ConnectionType; + return _ConnectionType is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "payloadType": - value = PayloadType; - return PayloadType?.Any() == true; + value = _PayloadType; + return _PayloadType?.Any() == true; case "payloadMimeType": - value = PayloadMimeTypeElement; - return PayloadMimeTypeElement?.Any() == true; + value = _PayloadMimeTypeElement; + return _PayloadMimeTypeElement?.Any() == true; case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; case "header": - value = HeaderElement; - return HeaderElement?.Any() == true; + value = _HeaderElement; + return _HeaderElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "connectionType": - ConnectionType = (Hl7.Fhir.Model.Coding)value; + ConnectionType = (Hl7.Fhir.Model.Coding?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "payloadType": - PayloadType = (List)value; + PayloadType = (List?)value!; return this; case "payloadMimeType": - PayloadMimeTypeElement = (List)value; + PayloadMimeTypeElement = (List?)value!; return this; case "address": - AddressElement = (Hl7.Fhir.Model.FhirUrl)value; + AddressElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "header": - HeaderElement = (List)value; + HeaderElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -495,17 +485,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ConnectionType is not null) yield return new KeyValuePair("connectionType",ConnectionType); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (PayloadType?.Any() == true) yield return new KeyValuePair("payloadType",PayloadType); - if (PayloadMimeTypeElement?.Any() == true) yield return new KeyValuePair("payloadMimeType",PayloadMimeTypeElement); - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); - if (HeaderElement?.Any() == true) yield return new KeyValuePair("header",HeaderElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ConnectionType is not null) yield return new KeyValuePair("connectionType",_ConnectionType); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_PayloadType?.Any() == true) yield return new KeyValuePair("payloadType",_PayloadType); + if (_PayloadMimeTypeElement?.Any() == true) yield return new KeyValuePair("payloadMimeType",_PayloadMimeTypeElement); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); + if (_HeaderElement?.Any() == true) yield return new KeyValuePair("header",_HeaderElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs index e7afa571e..611d7d182 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -111,28 +111,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("created", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -144,13 +141,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Responsible practitioner. @@ -159,13 +156,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// The subject to be enrolled. @@ -174,13 +171,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Candidate + public Hl7.Fhir.Model.ResourceReference? Candidate { get { return _Candidate; } set { _Candidate = value; OnPropertyChanged("Candidate"); } } - private Hl7.Fhir.Model.ResourceReference _Candidate; + private Hl7.Fhir.Model.ResourceReference? _Candidate; /// /// Insurance information. @@ -189,33 +186,29 @@ public Hl7.Fhir.Model.ResourceReference Candidate [CLSCompliant(false)] [References("Coverage")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentRequest; - - if (dest == null) - { + if(other is not EnrollmentRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Candidate != null) dest.Candidate = (Hl7.Fhir.Model.ResourceReference)Candidate.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Candidate is not null) dest.Candidate = (Hl7.Fhir.Model.ResourceReference)_Candidate.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -227,76 +220,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentRequest; - if(otherT == null) return false; + if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Candidate, otherT.Candidate)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Candidate, otherT._Candidate)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "candidate": - value = Candidate; - return Candidate is not null; + value = _Candidate; + return _Candidate is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "candidate": - Candidate = (Hl7.Fhir.Model.ResourceReference)value; + Candidate = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -307,13 +300,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Candidate is not null) yield return new KeyValuePair("candidate",Candidate); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Candidate is not null) yield return new KeyValuePair("candidate",_Candidate); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs index b422dde4f..271cee57c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EnrollmentResponse : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentResponseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -113,13 +113,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("EnrollmentRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -128,13 +128,13 @@ public Hl7.Fhir.Model.ResourceReference Request [DeclaredType(Type = typeof(Code))] [Binding("RemittanceOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -143,13 +143,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -159,28 +156,25 @@ public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome /// [FhirElement("disposition", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -190,28 +184,25 @@ public string Disposition /// [FhirElement("created", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -223,13 +214,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Responsible practitioner. @@ -238,34 +229,30 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentResponse; - - if (dest == null) - { + if(other is not EnrollmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -277,83 +264,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentResponse; - if(otherT == null) return false; + if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -364,14 +351,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs index 03edfb793..21f515117 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -135,13 +138,13 @@ public partial class StatusHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -150,13 +153,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -167,26 +167,22 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusHistoryComponent; - - if (dest == null) - { + if(other is not StatusHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -198,41 +194,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusHistoryComponent; - if(otherT == null) return false; + if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -243,8 +239,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -270,13 +266,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …). @@ -284,26 +280,26 @@ public Hl7.Fhir.Model.ResourceReference Condition [FhirElement("role", InSummary=true, Order=50)] [Binding("DiagnosisRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Ranking of the diagnosis (for each role type). /// [FhirElement("rank", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankElement + public Hl7.Fhir.Model.PositiveInt? RankElement { get { return _RankElement; } set { _RankElement = value; OnPropertyChanged("RankElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankElement; + private Hl7.Fhir.Model.PositiveInt? _RankElement; /// /// Ranking of the diagnosis (for each role type) @@ -312,30 +308,23 @@ public Hl7.Fhir.Model.PositiveInt RankElement [IgnoreDataMember] public int? Rank { - get { return RankElement != null ? RankElement.Value : null; } + get => _RankElement?.Value; set { - if (value == null) - RankElement = null; - else - RankElement = new Hl7.Fhir.Model.PositiveInt(value); + RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Rank"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -347,48 +336,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(RankElement, otherT.RankElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "rank": - value = RankElement; - return RankElement is not null; + value = _RankElement; + return _RankElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rank": - RankElement = (Hl7.Fhir.Model.PositiveInt)value; + RankElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -399,9 +388,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (RankElement is not null) yield return new KeyValuePair("rank",RankElement); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement); } } @@ -414,11 +403,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error. @@ -428,13 +417,13 @@ public List Identifier [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -443,13 +432,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -462,11 +448,11 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get { if(_StatusHistory==null) _StatusHistory = new List(); return _StatusHistory; } + get => _StatusHistory ?? new List(); set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } - private List _StatusHistory; + private List? _StatusHistory; /// /// Type/class - e.g. specialist referral, disease management. @@ -477,11 +463,11 @@ public List StatusHistory [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// The list of diagnosis relevant to this episode of care. @@ -491,11 +477,11 @@ public List Type [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The patient who is the focus of this episode of care. @@ -505,13 +491,13 @@ public List Diagnosis [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Organization that assumes care. @@ -520,26 +506,26 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Interval during responsibility is assumed. /// [FhirElement("period", InSummary=true, Order=160, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Originating Referral Request(s). @@ -551,11 +537,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List ReferralRequest { - get { if(_ReferralRequest==null) _ReferralRequest = new List(); return _ReferralRequest; } + get => _ReferralRequest ?? new List(); set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } - private List _ReferralRequest; + private List? _ReferralRequest; /// /// Care manager/care coordinator for the patient. @@ -564,13 +550,13 @@ public List ReferralRequest [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CareManager + public Hl7.Fhir.Model.ResourceReference? CareManager { get { return _CareManager; } set { _CareManager = value; OnPropertyChanged("CareManager"); } } - private Hl7.Fhir.Model.ResourceReference _CareManager; + private Hl7.Fhir.Model.ResourceReference? _CareManager; /// /// Other practitioners facilitating this episode of care. @@ -582,11 +568,11 @@ public Hl7.Fhir.Model.ResourceReference CareManager [DataMember] public List Team { - get { if(_Team==null) _Team = new List(); return _Team; } + get => _Team ?? new List(); set { _Team = value; OnPropertyChanged("Team"); } } - private List _Team; + private List? _Team; /// /// The set of accounts that may be used for billing for this EpisodeOfCare. @@ -598,39 +584,35 @@ public List Team [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as EpisodeOfCare; - - if (dest == null) - { + if(other is not EpisodeOfCare dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusHistory.Any()) dest.StatusHistory = new List(StatusHistory.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(ReferralRequest.Any()) dest.ReferralRequest = new List(ReferralRequest.DeepCopyInternal()); - if(CareManager != null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)CareManager.DeepCopyInternal(); - if(Team.Any()) dest.Team = new List(Team.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusHistory is not null) dest.StatusHistory = new List(_StatusHistory.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_ReferralRequest is not null) dest.ReferralRequest = new List(_ReferralRequest.DeepCopyInternal()); + if(_CareManager is not null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)_CareManager.DeepCopyInternal(); + if(_Team is not null) dest.Team = new List(_Team.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -642,111 +624,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EpisodeOfCare; - if(otherT == null) return false; + if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusHistory, otherT.StatusHistory)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(ReferralRequest, otherT.ReferralRequest)) return false; - if(!comparer.Equals(CareManager, otherT.CareManager)) return false; - if(!comparer.ListEquals(Team, otherT.Team)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_ReferralRequest, otherT._ReferralRequest)) return false; + if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; + if(!comparer.ListEquals(_Team, otherT._Team)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusHistory": - value = StatusHistory; - return StatusHistory?.Any() == true; + value = _StatusHistory; + return _StatusHistory?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "referralRequest": - value = ReferralRequest; - return ReferralRequest?.Any() == true; + value = _ReferralRequest; + return _ReferralRequest?.Any() == true; case "careManager": - value = CareManager; - return CareManager is not null; + value = _CareManager; + return _CareManager is not null; case "team": - value = Team; - return Team?.Any() == true; + value = _Team; + return _Team?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusHistory": - StatusHistory = (List)value; + StatusHistory = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "referralRequest": - ReferralRequest = (List)value; + ReferralRequest = (List?)value!; return this; case "careManager": - CareManager = (Hl7.Fhir.Model.ResourceReference)value; + CareManager = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "team": - Team = (List)value; + Team = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; default: return base.SetValue(key, value); @@ -757,18 +739,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",StatusHistory); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",ReferralRequest); - if (CareManager is not null) yield return new KeyValuePair("careManager",CareManager); - if (Team?.Any() == true) yield return new KeyValuePair("team",Team); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",_StatusHistory); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",_ReferralRequest); + if (_CareManager is not null) yield return new KeyValuePair("careManager",_CareManager); + if (_Team?.Any() == true) yield return new KeyValuePair("team",_Team); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs index 41ae047e9..9b422b393 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class EventDefinition : Hl7.Fhir.Model.DomainResource, IIdentifia /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this event definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the event definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this event definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this event definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -202,28 +193,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -236,13 +224,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -251,13 +239,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -267,13 +252,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -282,13 +267,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -302,41 +284,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -346,28 +325,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -380,39 +356,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the event definition. /// [FhirElement("description", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -425,11 +398,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for event definition (if applicable). @@ -440,39 +413,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this event definition is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this event definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -482,28 +452,25 @@ public string Purpose /// [FhirElement("usage", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -513,28 +480,25 @@ public string Usage /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -544,28 +508,25 @@ public string Copyright /// [FhirElement("approvalDate", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the event definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -575,28 +536,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the event definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -606,13 +564,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -623,11 +581,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -637,11 +595,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -651,11 +609,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -665,11 +623,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -679,11 +637,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -693,11 +651,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// "when" the event occurs (multiple = 'or'). @@ -707,52 +665,48 @@ public List RelatedArtifact [DataMember] public List Trigger { - get { if(_Trigger==null) _Trigger = new List(); return _Trigger; } + get => _Trigger ?? new List(); set { _Trigger = value; OnPropertyChanged("Trigger"); } } - private List _Trigger; + private List? _Trigger; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EventDefinition; - - if (dest == null) - { + if(other is not EventDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Trigger.Any()) dest.Trigger = new List(Trigger.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Trigger is not null) dest.Trigger = new List(_Trigger.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -764,223 +718,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventDefinition; - if(otherT == null) return false; + if(other is not EventDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Trigger, otherT.Trigger)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "trigger": - value = Trigger; - return Trigger?.Any() == true; + value = _Trigger; + return _Trigger?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "trigger": - Trigger = (List)value; + Trigger = (List?)value!; return this; default: return base.SetValue(key, value); @@ -991,34 +945,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Trigger?.Any() == true) yield return new KeyValuePair("trigger",Trigger); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Trigger?.Any() == true) yield return new KeyValuePair("trigger",_Trigger); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs index 4797d0c6e..f8ea99a67 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Evidence : Hl7.Fhir.Model.DomainResource, IIdentifiable [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this evidence, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the evidence. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the evidence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this evidence (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this evidence (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -202,28 +193,25 @@ public string Title /// [FhirElement("shortTitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -233,28 +221,25 @@ public string ShortTitle /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the Evidence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -267,13 +252,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -282,13 +267,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -298,28 +280,25 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -329,28 +308,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -363,39 +339,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the evidence. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the evidence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -408,11 +381,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The context that the content is intended to support. @@ -422,11 +395,11 @@ public List Note [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for evidence (if applicable). @@ -437,39 +410,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -479,28 +449,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=250)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the evidence was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -510,28 +477,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the evidence was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -541,13 +505,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the Evidence, such as Education, Treatment, Assessment, etc. @@ -558,11 +522,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -572,11 +536,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -586,11 +550,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -600,11 +564,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -614,11 +578,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -628,11 +592,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// What population?. @@ -642,13 +606,13 @@ public List RelatedArtifact [References("EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExposureBackground + public Hl7.Fhir.Model.ResourceReference? ExposureBackground { get { return _ExposureBackground; } set { _ExposureBackground = value; OnPropertyChanged("ExposureBackground"); } } - private Hl7.Fhir.Model.ResourceReference _ExposureBackground; + private Hl7.Fhir.Model.ResourceReference? _ExposureBackground; /// /// What exposure?. @@ -660,11 +624,11 @@ public Hl7.Fhir.Model.ResourceReference ExposureBackground [DataMember] public List ExposureVariant { - get { if(_ExposureVariant==null) _ExposureVariant = new List(); return _ExposureVariant; } + get => _ExposureVariant ?? new List(); set { _ExposureVariant = value; OnPropertyChanged("ExposureVariant"); } } - private List _ExposureVariant; + private List? _ExposureVariant; /// /// What outcome?. @@ -676,52 +640,48 @@ public List ExposureVariant [DataMember] public List Outcome { - get { if(_Outcome==null) _Outcome = new List(); return _Outcome; } + get => _Outcome ?? new List(); set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private List _Outcome; + private List? _Outcome; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Evidence; - - if (dest == null) - { + if(other is not Evidence dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(ExposureBackground != null) dest.ExposureBackground = (Hl7.Fhir.Model.ResourceReference)ExposureBackground.DeepCopyInternal(); - if(ExposureVariant.Any()) dest.ExposureVariant = new List(ExposureVariant.DeepCopyInternal()); - if(Outcome.Any()) dest.Outcome = new List(Outcome.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_ExposureBackground is not null) dest.ExposureBackground = (Hl7.Fhir.Model.ResourceReference)_ExposureBackground.DeepCopyInternal(); + if(_ExposureVariant is not null) dest.ExposureVariant = new List(_ExposureVariant.DeepCopyInternal()); + if(_Outcome is not null) dest.Outcome = new List(_Outcome.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -733,223 +693,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Evidence; - if(otherT == null) return false; + if(other is not Evidence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(ExposureBackground, otherT.ExposureBackground)) return false; - if(!comparer.ListEquals(ExposureVariant, otherT.ExposureVariant)) return false; - if(!comparer.ListEquals(Outcome, otherT.Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_ExposureBackground, otherT._ExposureBackground)) return false; + if(!comparer.ListEquals(_ExposureVariant, otherT._ExposureVariant)) return false; + if(!comparer.ListEquals(_Outcome, otherT._Outcome)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "exposureBackground": - value = ExposureBackground; - return ExposureBackground is not null; + value = _ExposureBackground; + return _ExposureBackground is not null; case "exposureVariant": - value = ExposureVariant; - return ExposureVariant?.Any() == true; + value = _ExposureVariant; + return _ExposureVariant?.Any() == true; case "outcome": - value = Outcome; - return Outcome?.Any() == true; + value = _Outcome; + return _Outcome?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "exposureBackground": - ExposureBackground = (Hl7.Fhir.Model.ResourceReference)value; + ExposureBackground = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposureVariant": - ExposureVariant = (List)value; + ExposureVariant = (List?)value!; return this; case "outcome": - Outcome = (List)value; + Outcome = (List?)value!; return this; default: return base.SetValue(key, value); @@ -960,34 +920,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (ExposureBackground is not null) yield return new KeyValuePair("exposureBackground",ExposureBackground); - if (ExposureVariant?.Any() == true) yield return new KeyValuePair("exposureVariant",ExposureVariant); - if (Outcome?.Any() == true) yield return new KeyValuePair("outcome",Outcome); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_ExposureBackground is not null) yield return new KeyValuePair("exposureBackground",_ExposureBackground); + if (_ExposureVariant?.Any() == true) yield return new KeyValuePair("exposureVariant",_ExposureVariant); + if (_Outcome?.Any() == true) yield return new KeyValuePair("outcome",_Outcome); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs index 0f5d7f687..c6583a367 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,28 +85,25 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the characteristic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -117,13 +117,13 @@ public string Description [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.TriggerDefinition))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// What code/value pairs define members?. @@ -133,24 +133,24 @@ public Hl7.Fhir.Model.DataType Definition [DataMember] public List UsageContext { - get { if(_UsageContext==null) _UsageContext = new List(); return _UsageContext; } + get => _UsageContext ?? new List(); set { _UsageContext = value; OnPropertyChanged("UsageContext"); } } - private List _UsageContext; + private List? _UsageContext; /// /// Whether the characteristic includes or excludes members. /// [FhirElement("exclude", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Whether the characteristic includes or excludes members @@ -159,13 +159,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -177,26 +174,26 @@ public bool? Exclude [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType ParticipantEffective + public Hl7.Fhir.Model.DataType? ParticipantEffective { get { return _ParticipantEffective; } set { _ParticipantEffective = value; OnPropertyChanged("ParticipantEffective"); } } - private Hl7.Fhir.Model.DataType _ParticipantEffective; + private Hl7.Fhir.Model.DataType? _ParticipantEffective; /// /// Observation time from study start. /// [FhirElement("timeFromStart", Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration TimeFromStart + public Hl7.Fhir.Model.Duration? TimeFromStart { get { return _TimeFromStart; } set { _TimeFromStart = value; OnPropertyChanged("TimeFromStart"); } } - private Hl7.Fhir.Model.Duration _TimeFromStart; + private Hl7.Fhir.Model.Duration? _TimeFromStart; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median. @@ -205,13 +202,13 @@ public Hl7.Fhir.Model.Duration TimeFromStart [DeclaredType(Type = typeof(Code))] [Binding("GroupMeasure")] [DataMember] - public Code GroupMeasureElement + public Code? GroupMeasureElement { get { return _GroupMeasureElement; } set { _GroupMeasureElement = value; OnPropertyChanged("GroupMeasureElement"); } } - private Code _GroupMeasureElement; + private Code? _GroupMeasureElement; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median @@ -220,34 +217,27 @@ public Code GroupMeasureElement [IgnoreDataMember] public Hl7.Fhir.Model.GroupMeasureCode? GroupMeasure { - get { return GroupMeasureElement != null ? GroupMeasureElement.Value : null; } + get => _GroupMeasureElement?.Value; set { - if (value == null) - GroupMeasureElement = null; - else - GroupMeasureElement = new Code(value); + GroupMeasureElement = value is null ? null : new Code(value); OnPropertyChanged("GroupMeasure"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(UsageContext.Any()) dest.UsageContext = new List(UsageContext.DeepCopyInternal()); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(ParticipantEffective != null) dest.ParticipantEffective = (Hl7.Fhir.Model.DataType)ParticipantEffective.DeepCopyInternal(); - if(TimeFromStart != null) dest.TimeFromStart = (Hl7.Fhir.Model.Duration)TimeFromStart.DeepCopyInternal(); - if(GroupMeasureElement != null) dest.GroupMeasureElement = (Code)GroupMeasureElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_UsageContext is not null) dest.UsageContext = new List(_UsageContext.DeepCopyInternal()); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_ParticipantEffective is not null) dest.ParticipantEffective = (Hl7.Fhir.Model.DataType)_ParticipantEffective.DeepCopyInternal(); + if(_TimeFromStart is not null) dest.TimeFromStart = (Hl7.Fhir.Model.Duration)_TimeFromStart.DeepCopyInternal(); + if(_GroupMeasureElement is not null) dest.GroupMeasureElement = (Code)_GroupMeasureElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -259,76 +249,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(UsageContext, otherT.UsageContext)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(ParticipantEffective, otherT.ParticipantEffective)) return false; - if(!comparer.Equals(TimeFromStart, otherT.TimeFromStart)) return false; - if(!comparer.Equals(GroupMeasureElement, otherT.GroupMeasureElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_UsageContext, otherT._UsageContext)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_ParticipantEffective, otherT._ParticipantEffective)) return false; + if(!comparer.Equals(_TimeFromStart, otherT._TimeFromStart)) return false; + if(!comparer.Equals(_GroupMeasureElement, otherT._GroupMeasureElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "usageContext": - value = UsageContext; - return UsageContext?.Any() == true; + value = _UsageContext; + return _UsageContext?.Any() == true; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "participantEffective": - value = ParticipantEffective; - return ParticipantEffective is not null; + value = _ParticipantEffective; + return _ParticipantEffective is not null; case "timeFromStart": - value = TimeFromStart; - return TimeFromStart is not null; + value = _TimeFromStart; + return _TimeFromStart is not null; case "groupMeasure": - value = GroupMeasureElement; - return GroupMeasureElement is not null; + value = _GroupMeasureElement; + return _GroupMeasureElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "usageContext": - UsageContext = (List)value; + UsageContext = (List?)value!; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "participantEffective": - ParticipantEffective = (Hl7.Fhir.Model.DataType)value; + ParticipantEffective = (Hl7.Fhir.Model.DataType?)value; return this; case "timeFromStart": - TimeFromStart = (Hl7.Fhir.Model.Duration)value; + TimeFromStart = (Hl7.Fhir.Model.Duration?)value; return this; case "groupMeasure": - GroupMeasureElement = (Code)value; + GroupMeasureElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -339,13 +329,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (UsageContext?.Any() == true) yield return new KeyValuePair("usageContext",UsageContext); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (ParticipantEffective is not null) yield return new KeyValuePair("participantEffective",ParticipantEffective); - if (TimeFromStart is not null) yield return new KeyValuePair("timeFromStart",TimeFromStart); - if (GroupMeasureElement is not null) yield return new KeyValuePair("groupMeasure",GroupMeasureElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_UsageContext?.Any() == true) yield return new KeyValuePair("usageContext",_UsageContext); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_ParticipantEffective is not null) yield return new KeyValuePair("participantEffective",_ParticipantEffective); + if (_TimeFromStart is not null) yield return new KeyValuePair("timeFromStart",_TimeFromStart); + if (_GroupMeasureElement is not null) yield return new KeyValuePair("groupMeasure",_GroupMeasureElement); } } @@ -355,28 +345,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this evidence variable, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -389,39 +376,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the evidence variable. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the evidence variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -431,28 +415,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this evidence variable (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -462,28 +443,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this evidence variable (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -493,28 +471,25 @@ public string Title /// [FhirElement("shortTitle", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -524,28 +499,25 @@ public string ShortTitle /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the EvidenceVariable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -558,13 +530,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -573,13 +545,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -589,28 +558,25 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -620,28 +586,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -654,39 +617,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the evidence variable. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the evidence variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -699,11 +659,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The context that the content is intended to support. @@ -713,11 +673,11 @@ public List Note [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for evidence variable (if applicable). @@ -728,39 +688,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -770,28 +727,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=250)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the evidence variable was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -801,28 +755,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the evidence variable was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -832,13 +783,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the EvidenceVariable, such as Education, Treatment, Assessment, etc. @@ -849,11 +800,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -863,11 +814,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -877,11 +828,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -891,11 +842,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -905,11 +856,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -919,11 +870,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// dichotomous | continuous | descriptive. @@ -932,13 +883,13 @@ public List RelatedArtifact [DeclaredType(Type = typeof(Code))] [Binding("EvidenceVariableType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// dichotomous | continuous | descriptive @@ -947,13 +898,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.VariableTypeCode? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -966,51 +914,47 @@ public Hl7.Fhir.Model.VariableTypeCode? Type [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceVariable; - - if (dest == null) - { + if(other is not EvidenceVariable dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1022,216 +966,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceVariable; - if(otherT == null) return false; + if(other is not EvidenceVariable otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1242,33 +1186,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs index 931de8035..49e9a5f49 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -97,28 +100,25 @@ public partial class ActorComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actorId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ActorIdElement + public Hl7.Fhir.Model.FhirString? ActorIdElement { get { return _ActorIdElement; } set { _ActorIdElement = value; OnPropertyChanged("ActorIdElement"); } } - private Hl7.Fhir.Model.FhirString _ActorIdElement; + private Hl7.Fhir.Model.FhirString? _ActorIdElement; /// /// ID or acronym of the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActorId + public string? ActorId { - get { return ActorIdElement != null ? ActorIdElement.Value : null; } + get => _ActorIdElement?.Value; set { - if (value == null) - ActorIdElement = null; - else - ActorIdElement = new Hl7.Fhir.Model.FhirString(value); + ActorIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ActorId"); } } @@ -131,13 +131,13 @@ public string ActorId [Binding("ExampleScenarioActorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | entity @@ -146,13 +146,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ExampleScenario.ExampleScenarioActorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -162,28 +159,25 @@ public Hl7.Fhir.Model.ExampleScenario.ExampleScenarioActorType? Type /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name of the actor as shown in the page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -193,46 +187,39 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The description of the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ActorComponent; - - if (dest == null) - { + if(other is not ActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActorIdElement != null) dest.ActorIdElement = (Hl7.Fhir.Model.FhirString)ActorIdElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_ActorIdElement is not null) dest.ActorIdElement = (Hl7.Fhir.Model.FhirString)_ActorIdElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -244,55 +231,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActorComponent; - if(otherT == null) return false; + if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActorIdElement, otherT.ActorIdElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actorId": - value = ActorIdElement; - return ActorIdElement is not null; + value = _ActorIdElement; + return _ActorIdElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actorId": - ActorIdElement = (Hl7.Fhir.Model.FhirString)value; + ActorIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -303,10 +290,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActorIdElement is not null) yield return new KeyValuePair("actorId",ActorIdElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_ActorIdElement is not null) yield return new KeyValuePair("actorId",_ActorIdElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -330,28 +317,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("resourceId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ResourceIdElement + public Hl7.Fhir.Model.FhirString? ResourceIdElement { get { return _ResourceIdElement; } set { _ResourceIdElement = value; OnPropertyChanged("ResourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _ResourceIdElement; + private Hl7.Fhir.Model.FhirString? _ResourceIdElement; /// /// The id of the resource for referencing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResourceId + public string? ResourceId { - get { return ResourceIdElement != null ? ResourceIdElement.Value : null; } + get => _ResourceIdElement?.Value; set { - if (value == null) - ResourceIdElement = null; - else - ResourceIdElement = new Hl7.Fhir.Model.FhirString(value); + ResourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResourceId"); } } @@ -364,13 +348,13 @@ public string ResourceId [Binding("FHIRResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResourceTypeElement + public Code? ResourceTypeElement { get { return _ResourceTypeElement; } set { _ResourceTypeElement = value; OnPropertyChanged("ResourceTypeElement"); } } - private Code _ResourceTypeElement; + private Code? _ResourceTypeElement; /// /// The type of the resource @@ -379,13 +363,10 @@ public Code ResourceTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? ResourceType { - get { return ResourceTypeElement != null ? ResourceTypeElement.Value : null; } + get => _ResourceTypeElement?.Value; set { - if (value == null) - ResourceTypeElement = null; - else - ResourceTypeElement = new Code(value); + ResourceTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ResourceType"); } } @@ -395,28 +376,25 @@ public Hl7.Fhir.Model.ResourceType? ResourceType /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A short name for the resource instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -426,28 +404,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human-friendly description of the resource instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -460,11 +435,11 @@ public string Description [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// Resources contained in the instance. @@ -474,28 +449,24 @@ public List Version [DataMember] public List ContainedInstance { - get { if(_ContainedInstance==null) _ContainedInstance = new List(); return _ContainedInstance; } + get => _ContainedInstance ?? new List(); set { _ContainedInstance = value; OnPropertyChanged("ContainedInstance"); } } - private List _ContainedInstance; + private List? _ContainedInstance; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResourceIdElement != null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)ResourceIdElement.DeepCopyInternal(); - if(ResourceTypeElement != null) dest.ResourceTypeElement = (Code)ResourceTypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(ContainedInstance.Any()) dest.ContainedInstance = new List(ContainedInstance.DeepCopyInternal()); + if(_ResourceIdElement is not null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)_ResourceIdElement.DeepCopyInternal(); + if(_ResourceTypeElement is not null) dest.ResourceTypeElement = (Code)_ResourceTypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_ContainedInstance is not null) dest.ContainedInstance = new List(_ContainedInstance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -507,69 +478,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResourceIdElement, otherT.ResourceIdElement)) return false; - if(!comparer.Equals(ResourceTypeElement, otherT.ResourceTypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(ContainedInstance, otherT.ContainedInstance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + if(!comparer.Equals(_ResourceTypeElement, otherT._ResourceTypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_ContainedInstance, otherT._ContainedInstance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resourceId": - value = ResourceIdElement; - return ResourceIdElement is not null; + value = _ResourceIdElement; + return _ResourceIdElement is not null; case "resourceType": - value = ResourceTypeElement; - return ResourceTypeElement is not null; + value = _ResourceTypeElement; + return _ResourceTypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "containedInstance": - value = ContainedInstance; - return ContainedInstance?.Any() == true; + value = _ContainedInstance; + return _ContainedInstance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resourceId": - ResourceIdElement = (Hl7.Fhir.Model.FhirString)value; + ResourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resourceType": - ResourceTypeElement = (Code)value; + ResourceTypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "containedInstance": - ContainedInstance = (List)value; + ContainedInstance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -580,12 +551,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResourceIdElement is not null) yield return new KeyValuePair("resourceId",ResourceIdElement); - if (ResourceTypeElement is not null) yield return new KeyValuePair("resourceType",ResourceTypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (ContainedInstance?.Any() == true) yield return new KeyValuePair("containedInstance",ContainedInstance); + if (_ResourceIdElement is not null) yield return new KeyValuePair("resourceId",_ResourceIdElement); + if (_ResourceTypeElement is not null) yield return new KeyValuePair("resourceType",_ResourceTypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_ContainedInstance?.Any() == true) yield return new KeyValuePair("containedInstance",_ContainedInstance); } } @@ -609,28 +580,25 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("versionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionIdElement + public Hl7.Fhir.Model.FhirString? VersionIdElement { get { return _VersionIdElement; } set { _VersionIdElement = value; OnPropertyChanged("VersionIdElement"); } } - private Hl7.Fhir.Model.FhirString _VersionIdElement; + private Hl7.Fhir.Model.FhirString? _VersionIdElement; /// /// The identifier of a specific version of a resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VersionId + public string? VersionId { - get { return VersionIdElement != null ? VersionIdElement.Value : null; } + get => _VersionIdElement?.Value; set { - if (value == null) - VersionIdElement = null; - else - VersionIdElement = new Hl7.Fhir.Model.FhirString(value); + VersionIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VersionId"); } } @@ -641,44 +609,37 @@ public string VersionId [FhirElement("description", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The description of the resource version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VersionIdElement != null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)VersionIdElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_VersionIdElement is not null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)_VersionIdElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -690,41 +651,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VersionIdElement, otherT.VersionIdElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "versionId": - value = VersionIdElement; - return VersionIdElement is not null; + value = _VersionIdElement; + return _VersionIdElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "versionId": - VersionIdElement = (Hl7.Fhir.Model.FhirString)value; + VersionIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -735,8 +696,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VersionIdElement is not null) yield return new KeyValuePair("versionId",VersionIdElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_VersionIdElement is not null) yield return new KeyValuePair("versionId",_VersionIdElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -763,28 +724,25 @@ public partial class ContainedInstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("resourceId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ResourceIdElement + public Hl7.Fhir.Model.FhirString? ResourceIdElement { get { return _ResourceIdElement; } set { _ResourceIdElement = value; OnPropertyChanged("ResourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _ResourceIdElement; + private Hl7.Fhir.Model.FhirString? _ResourceIdElement; /// /// Each resource contained in the instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResourceId + public string? ResourceId { - get { return ResourceIdElement != null ? ResourceIdElement.Value : null; } + get => _ResourceIdElement?.Value; set { - if (value == null) - ResourceIdElement = null; - else - ResourceIdElement = new Hl7.Fhir.Model.FhirString(value); + ResourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResourceId"); } } @@ -794,44 +752,37 @@ public string ResourceId /// [FhirElement("versionId", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionIdElement + public Hl7.Fhir.Model.FhirString? VersionIdElement { get { return _VersionIdElement; } set { _VersionIdElement = value; OnPropertyChanged("VersionIdElement"); } } - private Hl7.Fhir.Model.FhirString _VersionIdElement; + private Hl7.Fhir.Model.FhirString? _VersionIdElement; /// /// A specific version of a resource contained in the instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VersionId + public string? VersionId { - get { return VersionIdElement != null ? VersionIdElement.Value : null; } + get => _VersionIdElement?.Value; set { - if (value == null) - VersionIdElement = null; - else - VersionIdElement = new Hl7.Fhir.Model.FhirString(value); + VersionIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VersionId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContainedInstanceComponent; - - if (dest == null) - { + if(other is not ContainedInstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResourceIdElement != null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)ResourceIdElement.DeepCopyInternal(); - if(VersionIdElement != null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)VersionIdElement.DeepCopyInternal(); + if(_ResourceIdElement is not null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)_ResourceIdElement.DeepCopyInternal(); + if(_VersionIdElement is not null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)_VersionIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -843,41 +794,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainedInstanceComponent; - if(otherT == null) return false; + if(other is not ContainedInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResourceIdElement, otherT.ResourceIdElement)) return false; - if(!comparer.Equals(VersionIdElement, otherT.VersionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resourceId": - value = ResourceIdElement; - return ResourceIdElement is not null; + value = _ResourceIdElement; + return _ResourceIdElement is not null; case "versionId": - value = VersionIdElement; - return VersionIdElement is not null; + value = _VersionIdElement; + return _VersionIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resourceId": - ResourceIdElement = (Hl7.Fhir.Model.FhirString)value; + ResourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionId": - VersionIdElement = (Hl7.Fhir.Model.FhirString)value; + VersionIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -888,8 +839,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResourceIdElement is not null) yield return new KeyValuePair("resourceId",ResourceIdElement); - if (VersionIdElement is not null) yield return new KeyValuePair("versionId",VersionIdElement); + if (_ResourceIdElement is not null) yield return new KeyValuePair("resourceId",_ResourceIdElement); + if (_VersionIdElement is not null) yield return new KeyValuePair("versionId",_VersionIdElement); } } @@ -913,28 +864,25 @@ public partial class ProcessComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("title", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// The diagram title of the group of operations /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -944,28 +892,25 @@ public string Title /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A longer description of the group of operations /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -975,28 +920,25 @@ public string Description /// [FhirElement("preConditions", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown PreConditionsElement + public Hl7.Fhir.Model.Markdown? PreConditionsElement { get { return _PreConditionsElement; } set { _PreConditionsElement = value; OnPropertyChanged("PreConditionsElement"); } } - private Hl7.Fhir.Model.Markdown _PreConditionsElement; + private Hl7.Fhir.Model.Markdown? _PreConditionsElement; /// /// Description of initial status before the process starts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreConditions + public string? PreConditions { - get { return PreConditionsElement != null ? PreConditionsElement.Value : null; } + get => _PreConditionsElement?.Value; set { - if (value == null) - PreConditionsElement = null; - else - PreConditionsElement = new Hl7.Fhir.Model.Markdown(value); + PreConditionsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PreConditions"); } } @@ -1006,28 +948,25 @@ public string PreConditions /// [FhirElement("postConditions", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown PostConditionsElement + public Hl7.Fhir.Model.Markdown? PostConditionsElement { get { return _PostConditionsElement; } set { _PostConditionsElement = value; OnPropertyChanged("PostConditionsElement"); } } - private Hl7.Fhir.Model.Markdown _PostConditionsElement; + private Hl7.Fhir.Model.Markdown? _PostConditionsElement; /// /// Description of final status after the process ends /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PostConditions + public string? PostConditions { - get { return PostConditionsElement != null ? PostConditionsElement.Value : null; } + get => _PostConditionsElement?.Value; set { - if (value == null) - PostConditionsElement = null; - else - PostConditionsElement = new Hl7.Fhir.Model.Markdown(value); + PostConditionsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PostConditions"); } } @@ -1040,27 +979,23 @@ public string PostConditions [DataMember] public List Step { - get { if(_Step==null) _Step = new List(); return _Step; } + get => _Step ?? new List(); set { _Step = value; OnPropertyChanged("Step"); } } - private List _Step; + private List? _Step; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessComponent; - - if (dest == null) - { + if(other is not ProcessComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PreConditionsElement != null) dest.PreConditionsElement = (Hl7.Fhir.Model.Markdown)PreConditionsElement.DeepCopyInternal(); - if(PostConditionsElement != null) dest.PostConditionsElement = (Hl7.Fhir.Model.Markdown)PostConditionsElement.DeepCopyInternal(); - if(Step.Any()) dest.Step = new List(Step.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PreConditionsElement is not null) dest.PreConditionsElement = (Hl7.Fhir.Model.Markdown)_PreConditionsElement.DeepCopyInternal(); + if(_PostConditionsElement is not null) dest.PostConditionsElement = (Hl7.Fhir.Model.Markdown)_PostConditionsElement.DeepCopyInternal(); + if(_Step is not null) dest.Step = new List(_Step.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1072,62 +1007,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessComponent; - if(otherT == null) return false; + if(other is not ProcessComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PreConditionsElement, otherT.PreConditionsElement)) return false; - if(!comparer.Equals(PostConditionsElement, otherT.PostConditionsElement)) return false; - if(!comparer.ListEquals(Step, otherT.Step)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PreConditionsElement, otherT._PreConditionsElement)) return false; + if(!comparer.Equals(_PostConditionsElement, otherT._PostConditionsElement)) return false; + if(!comparer.ListEquals(_Step, otherT._Step)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "preConditions": - value = PreConditionsElement; - return PreConditionsElement is not null; + value = _PreConditionsElement; + return _PreConditionsElement is not null; case "postConditions": - value = PostConditionsElement; - return PostConditionsElement is not null; + value = _PostConditionsElement; + return _PostConditionsElement is not null; case "step": - value = Step; - return Step?.Any() == true; + value = _Step; + return _Step?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "preConditions": - PreConditionsElement = (Hl7.Fhir.Model.Markdown)value; + PreConditionsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "postConditions": - PostConditionsElement = (Hl7.Fhir.Model.Markdown)value; + PostConditionsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "step": - Step = (List)value; + Step = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1138,11 +1073,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PreConditionsElement is not null) yield return new KeyValuePair("preConditions",PreConditionsElement); - if (PostConditionsElement is not null) yield return new KeyValuePair("postConditions",PostConditionsElement); - if (Step?.Any() == true) yield return new KeyValuePair("step",Step); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PreConditionsElement is not null) yield return new KeyValuePair("preConditions",_PreConditionsElement); + if (_PostConditionsElement is not null) yield return new KeyValuePair("postConditions",_PostConditionsElement); + if (_Step?.Any() == true) yield return new KeyValuePair("step",_Step); } } @@ -1168,24 +1103,24 @@ public partial class StepComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Process { - get { if(_Process==null) _Process = new List(); return _Process; } + get => _Process ?? new List(); set { _Process = value; OnPropertyChanged("Process"); } } - private List _Process; + private List? _Process; /// /// If there is a pause in the flow. /// [FhirElement("pause", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PauseElement + public Hl7.Fhir.Model.FhirBoolean? PauseElement { get { return _PauseElement; } set { _PauseElement = value; OnPropertyChanged("PauseElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PauseElement; + private Hl7.Fhir.Model.FhirBoolean? _PauseElement; /// /// If there is a pause in the flow @@ -1194,13 +1129,10 @@ public Hl7.Fhir.Model.FhirBoolean PauseElement [IgnoreDataMember] public bool? Pause { - get { return PauseElement != null ? PauseElement.Value : null; } + get => _PauseElement?.Value; set { - if (value == null) - PauseElement = null; - else - PauseElement = new Hl7.Fhir.Model.FhirBoolean(value); + PauseElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Pause"); } } @@ -1210,13 +1142,13 @@ public bool? Pause /// [FhirElement("operation", Order=60)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.OperationComponent Operation + public Hl7.Fhir.Model.ExampleScenario.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.ExampleScenario.OperationComponent _Operation; + private Hl7.Fhir.Model.ExampleScenario.OperationComponent? _Operation; /// /// Alternate non-typical step action. @@ -1226,26 +1158,22 @@ public Hl7.Fhir.Model.ExampleScenario.OperationComponent Operation [DataMember] public List Alternative { - get { if(_Alternative==null) _Alternative = new List(); return _Alternative; } + get => _Alternative ?? new List(); set { _Alternative = value; OnPropertyChanged("Alternative"); } } - private List _Alternative; + private List? _Alternative; protected internal override void CopyToInternal(Base other) { - var dest = other as StepComponent; - - if (dest == null) - { + if(other is not StepComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Process.Any()) dest.Process = new List(Process.DeepCopyInternal()); - if(PauseElement != null) dest.PauseElement = (Hl7.Fhir.Model.FhirBoolean)PauseElement.DeepCopyInternal(); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)Operation.DeepCopyInternal(); - if(Alternative.Any()) dest.Alternative = new List(Alternative.DeepCopyInternal()); + if(_Process is not null) dest.Process = new List(_Process.DeepCopyInternal()); + if(_PauseElement is not null) dest.PauseElement = (Hl7.Fhir.Model.FhirBoolean)_PauseElement.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)_Operation.DeepCopyInternal(); + if(_Alternative is not null) dest.Alternative = new List(_Alternative.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1257,55 +1185,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StepComponent; - if(otherT == null) return false; + if(other is not StepComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Process, otherT.Process)) return false; - if(!comparer.Equals(PauseElement, otherT.PauseElement)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.ListEquals(Alternative, otherT.Alternative)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Process, otherT._Process)) return false; + if(!comparer.Equals(_PauseElement, otherT._PauseElement)) return false; + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.ListEquals(_Alternative, otherT._Alternative)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "process": - value = Process; - return Process?.Any() == true; + value = _Process; + return _Process?.Any() == true; case "pause": - value = PauseElement; - return PauseElement is not null; + value = _PauseElement; + return _PauseElement is not null; case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "alternative": - value = Alternative; - return Alternative?.Any() == true; + value = _Alternative; + return _Alternative?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "process": - Process = (List)value; + Process = (List?)value!; return this; case "pause": - PauseElement = (Hl7.Fhir.Model.FhirBoolean)value; + PauseElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "operation": - Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)value; + Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent?)value; return this; case "alternative": - Alternative = (List)value; + Alternative = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1316,10 +1244,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Process?.Any() == true) yield return new KeyValuePair("process",Process); - if (PauseElement is not null) yield return new KeyValuePair("pause",PauseElement); - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Alternative?.Any() == true) yield return new KeyValuePair("alternative",Alternative); + if (_Process?.Any() == true) yield return new KeyValuePair("process",_Process); + if (_PauseElement is not null) yield return new KeyValuePair("pause",_PauseElement); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Alternative?.Any() == true) yield return new KeyValuePair("alternative",_Alternative); } } @@ -1343,28 +1271,25 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("number", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NumberElement + public Hl7.Fhir.Model.FhirString? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.FhirString _NumberElement; + private Hl7.Fhir.Model.FhirString? _NumberElement; /// /// The sequential number of the interaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Number + public string? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.FhirString(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Number"); } } @@ -1374,28 +1299,25 @@ public string Number /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// The type of operation - CRUD /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1405,28 +1327,25 @@ public string Type /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The human-friendly name of the interaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1436,28 +1355,25 @@ public string Name /// [FhirElement("initiator", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString InitiatorElement + public Hl7.Fhir.Model.FhirString? InitiatorElement { get { return _InitiatorElement; } set { _InitiatorElement = value; OnPropertyChanged("InitiatorElement"); } } - private Hl7.Fhir.Model.FhirString _InitiatorElement; + private Hl7.Fhir.Model.FhirString? _InitiatorElement; /// /// Who starts the transaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Initiator + public string? Initiator { - get { return InitiatorElement != null ? InitiatorElement.Value : null; } + get => _InitiatorElement?.Value; set { - if (value == null) - InitiatorElement = null; - else - InitiatorElement = new Hl7.Fhir.Model.FhirString(value); + InitiatorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Initiator"); } } @@ -1467,28 +1383,25 @@ public string Initiator /// [FhirElement("receiver", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString ReceiverElement + public Hl7.Fhir.Model.FhirString? ReceiverElement { get { return _ReceiverElement; } set { _ReceiverElement = value; OnPropertyChanged("ReceiverElement"); } } - private Hl7.Fhir.Model.FhirString _ReceiverElement; + private Hl7.Fhir.Model.FhirString? _ReceiverElement; /// /// Who receives the transaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Receiver + public string? Receiver { - get { return ReceiverElement != null ? ReceiverElement.Value : null; } + get => _ReceiverElement?.Value; set { - if (value == null) - ReceiverElement = null; - else - ReceiverElement = new Hl7.Fhir.Model.FhirString(value); + ReceiverElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Receiver"); } } @@ -1498,28 +1411,25 @@ public string Receiver /// [FhirElement("description", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A comment to be inserted in the diagram /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1529,13 +1439,13 @@ public string Description /// [FhirElement("initiatorActive", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InitiatorActiveElement + public Hl7.Fhir.Model.FhirBoolean? InitiatorActiveElement { get { return _InitiatorActiveElement; } set { _InitiatorActiveElement = value; OnPropertyChanged("InitiatorActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InitiatorActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InitiatorActiveElement; /// /// Whether the initiator is deactivated right after the transaction @@ -1544,13 +1454,10 @@ public Hl7.Fhir.Model.FhirBoolean InitiatorActiveElement [IgnoreDataMember] public bool? InitiatorActive { - get { return InitiatorActiveElement != null ? InitiatorActiveElement.Value : null; } + get => _InitiatorActiveElement?.Value; set { - if (value == null) - InitiatorActiveElement = null; - else - InitiatorActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InitiatorActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("InitiatorActive"); } } @@ -1560,13 +1467,13 @@ public bool? InitiatorActive /// [FhirElement("receiverActive", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReceiverActiveElement + public Hl7.Fhir.Model.FhirBoolean? ReceiverActiveElement { get { return _ReceiverActiveElement; } set { _ReceiverActiveElement = value; OnPropertyChanged("ReceiverActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReceiverActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ReceiverActiveElement; /// /// Whether the receiver is deactivated right after the transaction @@ -1575,13 +1482,10 @@ public Hl7.Fhir.Model.FhirBoolean ReceiverActiveElement [IgnoreDataMember] public bool? ReceiverActive { - get { return ReceiverActiveElement != null ? ReceiverActiveElement.Value : null; } + get => _ReceiverActiveElement?.Value; set { - if (value == null) - ReceiverActiveElement = null; - else - ReceiverActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReceiverActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReceiverActive"); } } @@ -1591,47 +1495,43 @@ public bool? ReceiverActive /// [FhirElement("request", Order=120)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent Request + public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent _Request; + private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? _Request; /// /// Each resource instance used by the responder. /// [FhirElement("response", Order=130)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent Response + public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent _Response; + private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? _Response; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.FhirString)NumberElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(InitiatorElement != null) dest.InitiatorElement = (Hl7.Fhir.Model.FhirString)InitiatorElement.DeepCopyInternal(); - if(ReceiverElement != null) dest.ReceiverElement = (Hl7.Fhir.Model.FhirString)ReceiverElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(InitiatorActiveElement != null) dest.InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)InitiatorActiveElement.DeepCopyInternal(); - if(ReceiverActiveElement != null) dest.ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)ReceiverActiveElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)Response.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.FhirString)_NumberElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_InitiatorElement is not null) dest.InitiatorElement = (Hl7.Fhir.Model.FhirString)_InitiatorElement.DeepCopyInternal(); + if(_ReceiverElement is not null) dest.ReceiverElement = (Hl7.Fhir.Model.FhirString)_ReceiverElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_InitiatorActiveElement is not null) dest.InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)_InitiatorActiveElement.DeepCopyInternal(); + if(_ReceiverActiveElement is not null) dest.ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ReceiverActiveElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)_Response.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1643,97 +1543,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(InitiatorElement, otherT.InitiatorElement)) return false; - if(!comparer.Equals(ReceiverElement, otherT.ReceiverElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(InitiatorActiveElement, otherT.InitiatorActiveElement)) return false; - if(!comparer.Equals(ReceiverActiveElement, otherT.ReceiverActiveElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_InitiatorElement, otherT._InitiatorElement)) return false; + if(!comparer.Equals(_ReceiverElement, otherT._ReceiverElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_InitiatorActiveElement, otherT._InitiatorActiveElement)) return false; + if(!comparer.Equals(_ReceiverActiveElement, otherT._ReceiverActiveElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "initiator": - value = InitiatorElement; - return InitiatorElement is not null; + value = _InitiatorElement; + return _InitiatorElement is not null; case "receiver": - value = ReceiverElement; - return ReceiverElement is not null; + value = _ReceiverElement; + return _ReceiverElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "initiatorActive": - value = InitiatorActiveElement; - return InitiatorActiveElement is not null; + value = _InitiatorActiveElement; + return _InitiatorActiveElement is not null; case "receiverActive": - value = ReceiverActiveElement; - return ReceiverActiveElement is not null; + value = _ReceiverActiveElement; + return _ReceiverActiveElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.FhirString)value; + NumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "initiator": - InitiatorElement = (Hl7.Fhir.Model.FhirString)value; + InitiatorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "receiver": - ReceiverElement = (Hl7.Fhir.Model.FhirString)value; + ReceiverElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "initiatorActive": - InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "receiverActive": - ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)value; + Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)value; + Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent?)value; return this; default: return base.SetValue(key, value); @@ -1744,16 +1644,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (InitiatorElement is not null) yield return new KeyValuePair("initiator",InitiatorElement); - if (ReceiverElement is not null) yield return new KeyValuePair("receiver",ReceiverElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (InitiatorActiveElement is not null) yield return new KeyValuePair("initiatorActive",InitiatorActiveElement); - if (ReceiverActiveElement is not null) yield return new KeyValuePair("receiverActive",ReceiverActiveElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_InitiatorElement is not null) yield return new KeyValuePair("initiator",_InitiatorElement); + if (_ReceiverElement is not null) yield return new KeyValuePair("receiver",_ReceiverElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_InitiatorActiveElement is not null) yield return new KeyValuePair("initiatorActive",_InitiatorActiveElement); + if (_ReceiverActiveElement is not null) yield return new KeyValuePair("receiverActive",_ReceiverActiveElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); } } @@ -1780,28 +1680,25 @@ public partial class AlternativeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("title", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for alternative /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1811,28 +1708,25 @@ public string Title /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A human-readable description of each option /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1845,25 +1739,21 @@ public string Description [DataMember] public List Step { - get { if(_Step==null) _Step = new List(); return _Step; } + get => _Step ?? new List(); set { _Step = value; OnPropertyChanged("Step"); } } - private List _Step; + private List? _Step; protected internal override void CopyToInternal(Base other) { - var dest = other as AlternativeComponent; - - if (dest == null) - { + if(other is not AlternativeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Step.Any()) dest.Step = new List(Step.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Step is not null) dest.Step = new List(_Step.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1875,48 +1765,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AlternativeComponent; - if(otherT == null) return false; + if(other is not AlternativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Step, otherT.Step)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Step, otherT._Step)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "step": - value = Step; - return Step?.Any() == true; + value = _Step; + return _Step?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "step": - Step = (List)value; + Step = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1927,9 +1817,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Step?.Any() == true) yield return new KeyValuePair("step",Step); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Step?.Any() == true) yield return new KeyValuePair("step",_Step); } } @@ -1939,28 +1829,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this example scenario, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1973,39 +1860,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the example scenario. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the example scenario /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2015,28 +1899,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this example scenario (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2049,13 +1930,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2064,13 +1945,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2080,13 +1958,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2095,13 +1973,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2111,28 +1986,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2142,28 +2014,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2176,11 +2045,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// The context that the content is intended to support. @@ -2190,11 +2059,11 @@ public List Contact [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for example scenario (if applicable). @@ -2205,39 +2074,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2247,28 +2113,25 @@ public string Copyright /// [FhirElement("purpose", Order=210, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// The purpose of the example, e.g. to illustrate a scenario /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2281,11 +2144,11 @@ public string Purpose [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Each resource and each version that is present in the workflow. @@ -2295,11 +2158,11 @@ public List Actor [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Each major process - a group of operations. @@ -2309,11 +2172,11 @@ public List Instance [DataMember] public List Process { - get { if(_Process==null) _Process = new List(); return _Process; } + get => _Process ?? new List(); set { _Process = value; OnPropertyChanged("Process"); } } - private List _Process; + private List? _Process; /// /// Another nested workflow. @@ -2323,24 +2186,24 @@ public List Process [DataMember] public List WorkflowElement { - get { if(_WorkflowElement==null) _WorkflowElement = new List(); return _WorkflowElement; } + get => _WorkflowElement ?? new List(); set { _WorkflowElement = value; OnPropertyChanged("WorkflowElement"); } } - private List _WorkflowElement; + private List? _WorkflowElement; /// /// Another nested workflow /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Workflow + public IEnumerable? Workflow { - get { return WorkflowElement != null ? WorkflowElement.Select(elem => elem.Value) : null; } + get => _WorkflowElement?.Select(elem => elem.Value); set { if (value == null) - WorkflowElement = null; + WorkflowElement = null!; else WorkflowElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Workflow"); @@ -2351,31 +2214,27 @@ public IEnumerable Workflow protected internal override void CopyToInternal(Base other) { - var dest = other as ExampleScenario; - - if (dest == null) - { + if(other is not ExampleScenario dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Process.Any()) dest.Process = new List(Process.DeepCopyInternal()); - if(WorkflowElement.Any()) dest.WorkflowElement = new List(WorkflowElement.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Process is not null) dest.Process = new List(_Process.DeepCopyInternal()); + if(_WorkflowElement is not null) dest.WorkflowElement = new List(_WorkflowElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2387,146 +2246,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExampleScenario; - if(otherT == null) return false; + if(other is not ExampleScenario otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Process, otherT.Process)) return false; - if(!comparer.ListEquals(WorkflowElement, otherT.WorkflowElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Process, otherT._Process)) return false; + if(!comparer.ListEquals(_WorkflowElement, otherT._WorkflowElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "process": - value = Process; - return Process?.Any() == true; + value = _Process; + return _Process?.Any() == true; case "workflow": - value = WorkflowElement; - return WorkflowElement?.Any() == true; + value = _WorkflowElement; + return _WorkflowElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "process": - Process = (List)value; + Process = (List?)value!; return this; case "workflow": - WorkflowElement = (List)value; + WorkflowElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2537,23 +2396,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Process?.Any() == true) yield return new KeyValuePair("process",Process); - if (WorkflowElement?.Any() == true) yield return new KeyValuePair("workflow",WorkflowElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Process?.Any() == true) yield return new KeyValuePair("process",_Process); + if (_WorkflowElement?.Any() == true) yield return new KeyValuePair("workflow",_WorkflowElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs index b20ee783c..df7a4ce33 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ExplanationOfBenefit","http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit")] - public partial class ExplanationOfBenefit : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class ExplanationOfBenefit : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -117,13 +120,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -131,40 +134,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// File or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -176,48 +175,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -228,9 +227,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -258,13 +257,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient reference. @@ -273,26 +272,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -304,41 +299,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -349,8 +344,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -377,13 +372,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Order of care team @@ -392,13 +387,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -411,26 +403,26 @@ public int? Sequence [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Indicator of the lead practitioner. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Indicator of the lead practitioner @@ -439,13 +431,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -456,13 +445,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Practitioner credential or specialization. @@ -470,29 +459,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("qualification", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Qualification + public Hl7.Fhir.Model.CodeableConcept? Qualification { get { return _Qualification; } set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private Hl7.Fhir.Model.CodeableConcept _Qualification; + private Hl7.Fhir.Model.CodeableConcept? _Qualification; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Qualification != null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)Qualification.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Qualification is not null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)_Qualification.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -504,62 +489,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Qualification, otherT.Qualification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "qualification": - value = Qualification; - return Qualification is not null; + value = _Qualification; + return _Qualification is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualification": - Qualification = (Hl7.Fhir.Model.CodeableConcept)value; + Qualification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -570,11 +555,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Qualification is not null) yield return new KeyValuePair("qualification",Qualification); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Qualification is not null) yield return new KeyValuePair("qualification",_Qualification); } } @@ -602,13 +587,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -617,13 +602,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -635,13 +617,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -649,13 +631,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -664,13 +646,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Data to be provided. @@ -680,13 +662,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Explanation for the information. @@ -694,30 +676,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.Coding Reason + public Hl7.Fhir.Model.Coding? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.Coding _Reason; + private Hl7.Fhir.Model.Coding? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.Coding)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.Coding)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -729,69 +707,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.Coding)value; + Reason = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -802,12 +780,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -834,13 +812,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Diagnosis instance identifier @@ -849,13 +827,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -870,13 +845,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -887,11 +862,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Present on admission. @@ -899,13 +874,13 @@ public List Type [FhirElement("onAdmission", Order=70)] [Binding("DiagnosisOnAdmission")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OnAdmission + public Hl7.Fhir.Model.CodeableConcept? OnAdmission { get { return _OnAdmission; } set { _OnAdmission = value; OnPropertyChanged("OnAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _OnAdmission; + private Hl7.Fhir.Model.CodeableConcept? _OnAdmission; /// /// Package billing code. @@ -913,29 +888,25 @@ public Hl7.Fhir.Model.CodeableConcept OnAdmission [FhirElement("packageCode", Order=80)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PackageCode + public Hl7.Fhir.Model.CodeableConcept? PackageCode { get { return _PackageCode; } set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private Hl7.Fhir.Model.CodeableConcept _PackageCode; + private Hl7.Fhir.Model.CodeableConcept? _PackageCode; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(OnAdmission != null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)OnAdmission.DeepCopyInternal(); - if(PackageCode != null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)PackageCode.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_OnAdmission is not null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)_OnAdmission.DeepCopyInternal(); + if(_PackageCode is not null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)_PackageCode.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -947,62 +918,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(OnAdmission, otherT.OnAdmission)) return false; - if(!comparer.Equals(PackageCode, otherT.PackageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; + if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "onAdmission": - value = OnAdmission; - return OnAdmission is not null; + value = _OnAdmission; + return _OnAdmission is not null; case "packageCode": - value = PackageCode; - return PackageCode is not null; + value = _PackageCode; + return _PackageCode is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "onAdmission": - OnAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + OnAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "packageCode": - PackageCode = (Hl7.Fhir.Model.CodeableConcept)value; + PackageCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1013,11 +984,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (OnAdmission is not null) yield return new KeyValuePair("onAdmission",OnAdmission); - if (PackageCode is not null) yield return new KeyValuePair("packageCode",PackageCode); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_OnAdmission is not null) yield return new KeyValuePair("onAdmission",_OnAdmission); + if (_PackageCode is not null) yield return new KeyValuePair("packageCode",_PackageCode); } } @@ -1044,13 +1015,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure instance identifier @@ -1059,13 +1030,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1079,39 +1047,36 @@ public int? Sequence [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// When the procedure was performed. /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1126,13 +1091,13 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; /// /// Unique device identifier. @@ -1144,27 +1109,23 @@ public Hl7.Fhir.Model.DataType Procedure [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1176,62 +1137,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1242,11 +1203,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -1274,13 +1235,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("focal", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -1289,13 +1250,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -1308,13 +1266,13 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Prior authorization reference number. @@ -1324,24 +1282,24 @@ public Hl7.Fhir.Model.ResourceReference Coverage [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Prior authorization reference number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1350,17 +1308,13 @@ public IEnumerable PreAuthRef protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1372,48 +1326,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1424,9 +1378,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); } } @@ -1452,28 +1406,25 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the incident occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1484,13 +1435,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the event occurred. @@ -1500,27 +1451,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1532,48 +1479,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1584,9 +1531,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1613,13 +1560,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -1628,13 +1575,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1647,24 +1591,24 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get { if(_CareTeamSequenceElement==null) _CareTeamSequenceElement = new List(); return _CareTeamSequenceElement; } + get => _CareTeamSequenceElement ?? new List(); set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } - private List _CareTeamSequenceElement; + private List? _CareTeamSequenceElement; /// /// Applicable care team members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamSequence + public IEnumerable? CareTeamSequence { - get { return CareTeamSequenceElement != null ? CareTeamSequenceElement.Select(elem => elem.Value) : null; } + get => _CareTeamSequenceElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamSequenceElement = null; + CareTeamSequenceElement = null!; else CareTeamSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamSequence"); @@ -1679,24 +1623,24 @@ public IEnumerable CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get { if(_DiagnosisSequenceElement==null) _DiagnosisSequenceElement = new List(); return _DiagnosisSequenceElement; } + get => _DiagnosisSequenceElement ?? new List(); set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } - private List _DiagnosisSequenceElement; + private List? _DiagnosisSequenceElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisSequence + public IEnumerable? DiagnosisSequence { - get { return DiagnosisSequenceElement != null ? DiagnosisSequenceElement.Select(elem => elem.Value) : null; } + get => _DiagnosisSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisSequenceElement = null; + DiagnosisSequenceElement = null!; else DiagnosisSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisSequence"); @@ -1711,24 +1655,24 @@ public IEnumerable DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get { if(_ProcedureSequenceElement==null) _ProcedureSequenceElement = new List(); return _ProcedureSequenceElement; } + get => _ProcedureSequenceElement ?? new List(); set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } - private List _ProcedureSequenceElement; + private List? _ProcedureSequenceElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureSequence + public IEnumerable? ProcedureSequence { - get { return ProcedureSequenceElement != null ? ProcedureSequenceElement.Select(elem => elem.Value) : null; } + get => _ProcedureSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureSequenceElement = null; + ProcedureSequenceElement = null!; else ProcedureSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureSequence"); @@ -1743,24 +1687,24 @@ public IEnumerable ProcedureSequence [DataMember] public List InformationSequenceElement { - get { if(_InformationSequenceElement==null) _InformationSequenceElement = new List(); return _InformationSequenceElement; } + get => _InformationSequenceElement ?? new List(); set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } - private List _InformationSequenceElement; + private List? _InformationSequenceElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationSequence + public IEnumerable? InformationSequence { - get { return InformationSequenceElement != null ? InformationSequenceElement.Select(elem => elem.Value) : null; } + get => _InformationSequenceElement?.Select(elem => elem.Value); set { if (value == null) - InformationSequenceElement = null; + InformationSequenceElement = null!; else InformationSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationSequence"); @@ -1773,13 +1717,13 @@ public IEnumerable InformationSequence [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -1787,13 +1731,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=100)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -1802,13 +1746,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -1819,11 +1763,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -1834,11 +1778,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -1847,13 +1791,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -1864,52 +1808,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1918,13 +1862,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1934,13 +1875,13 @@ public decimal? Factor /// [FhirElement("net", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -1952,11 +1893,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Anatomical location. @@ -1964,13 +1905,13 @@ public List Udi [FhirElement("bodySite", Order=210)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -1981,11 +1922,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Encounters related to this billed item. @@ -1997,11 +1938,11 @@ public List SubSite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Applicable note numbers. @@ -2011,24 +1952,24 @@ public List Encounter [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2043,11 +1984,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -2057,45 +1998,41 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(CareTeamSequenceElement.Any()) dest.CareTeamSequenceElement = new List(CareTeamSequenceElement.DeepCopyInternal()); - if(DiagnosisSequenceElement.Any()) dest.DiagnosisSequenceElement = new List(DiagnosisSequenceElement.DeepCopyInternal()); - if(ProcedureSequenceElement.Any()) dest.ProcedureSequenceElement = new List(ProcedureSequenceElement.DeepCopyInternal()); - if(InformationSequenceElement.Any()) dest.InformationSequenceElement = new List(InformationSequenceElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_CareTeamSequenceElement is not null) dest.CareTeamSequenceElement = new List(_CareTeamSequenceElement.DeepCopyInternal()); + if(_DiagnosisSequenceElement is not null) dest.DiagnosisSequenceElement = new List(_DiagnosisSequenceElement.DeepCopyInternal()); + if(_ProcedureSequenceElement is not null) dest.ProcedureSequenceElement = new List(_ProcedureSequenceElement.DeepCopyInternal()); + if(_InformationSequenceElement is not null) dest.InformationSequenceElement = new List(_InformationSequenceElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2107,188 +2044,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(CareTeamSequenceElement, otherT.CareTeamSequenceElement)) return false; - if(!comparer.ListEquals(DiagnosisSequenceElement, otherT.DiagnosisSequenceElement)) return false; - if(!comparer.ListEquals(ProcedureSequenceElement, otherT.ProcedureSequenceElement)) return false; - if(!comparer.ListEquals(InformationSequenceElement, otherT.InformationSequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; + if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; + if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; + if(!comparer.ListEquals(_InformationSequenceElement, otherT._InformationSequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "careTeamSequence": - value = CareTeamSequenceElement; - return CareTeamSequenceElement?.Any() == true; + value = _CareTeamSequenceElement; + return _CareTeamSequenceElement?.Any() == true; case "diagnosisSequence": - value = DiagnosisSequenceElement; - return DiagnosisSequenceElement?.Any() == true; + value = _DiagnosisSequenceElement; + return _DiagnosisSequenceElement?.Any() == true; case "procedureSequence": - value = ProcedureSequenceElement; - return ProcedureSequenceElement?.Any() == true; + value = _ProcedureSequenceElement; + return _ProcedureSequenceElement?.Any() == true; case "informationSequence": - value = InformationSequenceElement; - return InformationSequenceElement?.Any() == true; + value = _InformationSequenceElement; + return _InformationSequenceElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "careTeamSequence": - CareTeamSequenceElement = (List)value; + CareTeamSequenceElement = (List?)value!; return this; case "diagnosisSequence": - DiagnosisSequenceElement = (List)value; + DiagnosisSequenceElement = (List?)value!; return this; case "procedureSequence": - ProcedureSequenceElement = (List)value; + ProcedureSequenceElement = (List?)value!; return this; case "informationSequence": - InformationSequenceElement = (List)value; + InformationSequenceElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2299,29 +2236,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",CareTeamSequenceElement); - if (DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",DiagnosisSequenceElement); - if (ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",ProcedureSequenceElement); - if (InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",InformationSequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",_CareTeamSequenceElement); + if (_DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",_DiagnosisSequenceElement); + if (_ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",_ProcedureSequenceElement); + if (_InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",_InformationSequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2349,13 +2286,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of adjudication outcome. @@ -2363,39 +2300,39 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monitary value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Non-monitary value @@ -2404,31 +2341,24 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2440,55 +2370,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -2499,10 +2429,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -2529,13 +2459,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Product or service provided @@ -2544,13 +2474,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2561,13 +2488,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -2575,13 +2502,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2590,13 +2517,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -2607,11 +2534,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2622,50 +2549,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2674,13 +2601,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2690,13 +2614,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2708,11 +2632,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Applicable note numbers. @@ -2722,24 +2646,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2754,11 +2678,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -2768,36 +2692,32 @@ public List Adjudicat [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2809,125 +2729,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2938,20 +2858,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -2978,13 +2898,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Product or service provided @@ -2993,13 +2913,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -3010,13 +2927,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -3024,13 +2941,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -3039,13 +2956,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -3056,11 +2973,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -3071,50 +2988,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3123,13 +3040,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3139,13 +3053,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -3157,11 +3071,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Applicable note numbers. @@ -3171,24 +3085,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3203,35 +3117,31 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3243,118 +3153,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3365,19 +3275,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -3406,24 +3316,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get { if(_ItemSequenceElement==null) _ItemSequenceElement = new List(); return _ItemSequenceElement; } + get => _ItemSequenceElement ?? new List(); set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private List _ItemSequenceElement; + private List? _ItemSequenceElement; /// /// Item sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ItemSequence + public IEnumerable? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Select(elem => elem.Value) : null; } + get => _ItemSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ItemSequenceElement = null; + ItemSequenceElement = null!; else ItemSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ItemSequence"); @@ -3438,24 +3348,24 @@ public IEnumerable ItemSequence [DataMember] public List DetailSequenceElement { - get { if(_DetailSequenceElement==null) _DetailSequenceElement = new List(); return _DetailSequenceElement; } + get => _DetailSequenceElement ?? new List(); set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private List _DetailSequenceElement; + private List? _DetailSequenceElement; /// /// Detail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DetailSequence + public IEnumerable? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Select(elem => elem.Value) : null; } + get => _DetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DetailSequenceElement = null; + DetailSequenceElement = null!; else DetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DetailSequence"); @@ -3470,24 +3380,24 @@ public IEnumerable DetailSequence [DataMember] public List SubDetailSequenceElement { - get { if(_SubDetailSequenceElement==null) _SubDetailSequenceElement = new List(); return _SubDetailSequenceElement; } + get => _SubDetailSequenceElement ?? new List(); set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private List _SubDetailSequenceElement; + private List? _SubDetailSequenceElement; /// /// Subdetail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubDetailSequence + public IEnumerable? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Select(elem => elem.Value) : null; } + get => _SubDetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SubDetailSequenceElement = null; + SubDetailSequenceElement = null!; else SubDetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SubDetailSequence"); @@ -3504,11 +3414,11 @@ public IEnumerable SubDetailSequence [DataMember] public List Provider { - get { if(_Provider==null) _Provider = new List(); return _Provider; } + get => _Provider ?? new List(); set { _Provider = value; OnPropertyChanged("Provider"); } } - private List _Provider; + private List? _Provider; /// /// Billing, service, product, or drug code. @@ -3517,13 +3427,13 @@ public List Provider [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -3534,11 +3444,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -3549,11 +3459,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -3562,13 +3472,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -3579,52 +3489,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3633,13 +3543,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3649,13 +3556,13 @@ public decimal? Factor /// [FhirElement("net", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Anatomical location. @@ -3663,13 +3570,13 @@ public Hl7.Fhir.Model.Money Net [FhirElement("bodySite", Order=170)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -3680,11 +3587,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Applicable note numbers. @@ -3694,24 +3601,24 @@ public List SubSite [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3726,11 +3633,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -3740,40 +3647,36 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement.Any()) dest.ItemSequenceElement = new List(ItemSequenceElement.DeepCopyInternal()); - if(DetailSequenceElement.Any()) dest.DetailSequenceElement = new List(DetailSequenceElement.DeepCopyInternal()); - if(SubDetailSequenceElement.Any()) dest.SubDetailSequenceElement = new List(SubDetailSequenceElement.DeepCopyInternal()); - if(Provider.Any()) dest.Provider = new List(Provider.DeepCopyInternal()); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = new List(_ItemSequenceElement.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = new List(_DetailSequenceElement.DeepCopyInternal()); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = new List(_SubDetailSequenceElement.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = new List(_Provider.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3785,153 +3688,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.ListEquals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement?.Any() == true; + value = _ItemSequenceElement; + return _ItemSequenceElement?.Any() == true; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement?.Any() == true; + value = _DetailSequenceElement; + return _DetailSequenceElement?.Any() == true; case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement?.Any() == true; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement?.Any() == true; case "provider": - value = Provider; - return Provider?.Any() == true; + value = _Provider; + return _Provider?.Any() == true; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (List)value; + ItemSequenceElement = (List?)value!; return this; case "detailSequence": - DetailSequenceElement = (List)value; + DetailSequenceElement = (List?)value!; return this; case "subDetailSequence": - SubDetailSequenceElement = (List)value; + SubDetailSequenceElement = (List?)value!; return this; case "provider": - Provider = (List)value; + Provider = (List?)value!; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3942,24 +3845,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubDetailSequenceElement?.Any() == true) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (Provider?.Any() == true) yield return new KeyValuePair("provider",Provider); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubDetailSequenceElement?.Any() == true) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_Provider?.Any() == true) yield return new KeyValuePair("provider",_Provider); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -3987,13 +3890,13 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -4004,50 +3907,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -4056,13 +3959,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -4072,13 +3972,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -4088,24 +3988,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -4120,11 +4020,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -4134,31 +4034,27 @@ public List Adjudicat [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4170,90 +4066,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4264,15 +4160,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -4300,13 +4196,13 @@ public partial class AddedItemDetailSubDetailComponent : Hl7.Fhir.Model.Backbone [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -4317,50 +4213,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -4369,13 +4265,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -4385,13 +4278,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -4401,24 +4294,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -4433,30 +4326,26 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailSubDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailSubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4468,83 +4357,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailSubDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4555,14 +4444,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -4591,13 +4480,13 @@ public partial class TotalComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Financial total for the category. @@ -4605,26 +4494,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("amount", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as TotalComponent; - - if (dest == null) - { + if(other is not TotalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4636,41 +4521,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TotalComponent; - if(otherT == null) return false; + if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -4681,8 +4566,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -4709,26 +4594,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PaymentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the variance. @@ -4736,41 +4621,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected date of payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected date of payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -4780,43 +4662,39 @@ public string Date /// [FhirElement("amount", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Business identifier for the payment. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4828,69 +4706,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -4901,12 +4779,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -4932,13 +4810,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Note instance identifier @@ -4947,13 +4825,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -4965,13 +4840,13 @@ public int? Number [DeclaredType(Type = typeof(Code))] [Binding("NoteType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// display | print | printoper @@ -4980,13 +4855,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NoteType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -4996,28 +4868,25 @@ public Hl7.Fhir.Model.NoteType? Type /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -5028,28 +4897,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5061,55 +4926,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -5120,10 +4985,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -5148,26 +5013,26 @@ public partial class BenefitBalanceComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -5176,13 +5041,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -5192,28 +5054,25 @@ public bool? Excluded /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -5223,28 +5082,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -5255,13 +5111,13 @@ public string Description [FhirElement("network", Order=80)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -5269,13 +5125,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=90)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -5283,13 +5139,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=100)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -5299,30 +5155,26 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Financial { - get { if(_Financial==null) _Financial = new List(); return _Financial; } + get => _Financial ?? new List(); set { _Financial = value; OnPropertyChanged("Financial"); } } - private List _Financial; + private List? _Financial; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitBalanceComponent; - - if (dest == null) - { + if(other is not BenefitBalanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Financial.Any()) dest.Financial = new List(Financial.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Financial is not null) dest.Financial = new List(_Financial.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5334,83 +5186,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitBalanceComponent; - if(otherT == null) return false; + if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Financial, otherT.Financial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "financial": - value = Financial; - return Financial?.Any() == true; + value = _Financial; + return _Financial?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "financial": - Financial = (List)value; + Financial = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5421,14 +5273,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Financial?.Any() == true) yield return new KeyValuePair("financial",Financial); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Financial?.Any() == true) yield return new KeyValuePair("financial",_Financial); } } @@ -5456,13 +5308,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -5471,13 +5323,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -5486,27 +5338,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5518,48 +5366,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -5570,9 +5418,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -5585,11 +5433,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -5599,13 +5447,13 @@ public List Identifier [Binding("ExplanationOfBenefitStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -5614,13 +5462,10 @@ public Code Stat [IgnoreDataMember] public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -5632,13 +5477,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -5646,13 +5491,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=120, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -5662,13 +5507,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -5677,13 +5522,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -5696,26 +5538,26 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Relevant time frame for the claim. /// [FhirElement("billablePeriod", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Response creation date. @@ -5723,28 +5565,25 @@ public Hl7.Fhir.Model.Period BillablePeriod [FhirElement("created", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -5756,13 +5595,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Party responsible for reimbursement. @@ -5772,13 +5611,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -5788,13 +5627,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Desired processing urgency. @@ -5802,13 +5641,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [FhirElement("priority", Order=200)] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// For whom to reserve funds. @@ -5816,13 +5655,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("fundsReserveRequested", Order=210)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserveRequested + public Hl7.Fhir.Model.CodeableConcept? FundsReserveRequested { get { return _FundsReserveRequested; } set { _FundsReserveRequested = value; OnPropertyChanged("FundsReserveRequested"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserveRequested; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserveRequested; /// /// Funds reserved status. @@ -5830,13 +5669,13 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserveRequested [FhirElement("fundsReserve", Order=220)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Prior or corollary claims. @@ -5846,11 +5685,11 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services or products. @@ -5859,13 +5698,13 @@ public List Related [CLSCompliant(false)] [References("MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superceded by fulfiller. @@ -5874,26 +5713,26 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Recipient of benefits payable. /// [FhirElement("payee", Order=260)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee + public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent _Payee; + private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? _Payee; /// /// Treatment Referral. @@ -5902,13 +5741,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee [CLSCompliant(false)] [References("ServiceRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Servicing Facility. @@ -5917,13 +5756,13 @@ public Hl7.Fhir.Model.ResourceReference Referral [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Claim reference. @@ -5932,13 +5771,13 @@ public Hl7.Fhir.Model.ResourceReference Facility [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// Claim response reference. @@ -5947,13 +5786,13 @@ public Hl7.Fhir.Model.ResourceReference Claim [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; /// /// queued | complete | error | partial. @@ -5963,13 +5802,13 @@ public Hl7.Fhir.Model.ResourceReference ClaimResponse [Binding("RemittanceOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -5978,13 +5817,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -5994,28 +5830,25 @@ public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome /// [FhirElement("disposition", Order=320)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -6028,24 +5861,24 @@ public string Disposition [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -6060,11 +5893,11 @@ public IEnumerable PreAuthRef [DataMember] public List PreAuthRefPeriod { - get { if(_PreAuthRefPeriod==null) _PreAuthRefPeriod = new List(); return _PreAuthRefPeriod; } + get => _PreAuthRefPeriod ?? new List(); set { _PreAuthRefPeriod = value; OnPropertyChanged("PreAuthRefPeriod"); } } - private List _PreAuthRefPeriod; + private List? _PreAuthRefPeriod; /// /// Care Team members. @@ -6074,11 +5907,11 @@ public List PreAuthRefPeriod [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Supporting information. @@ -6088,11 +5921,11 @@ public List CareTeam [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Pertinent diagnosis information. @@ -6102,11 +5935,11 @@ public List [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Clinical procedures performed. @@ -6116,24 +5949,24 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Precedence (primary, secondary, etc.). /// [FhirElement("precedence", Order=390)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PrecedenceElement + public Hl7.Fhir.Model.PositiveInt? PrecedenceElement { get { return _PrecedenceElement; } set { _PrecedenceElement = value; OnPropertyChanged("PrecedenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _PrecedenceElement; + private Hl7.Fhir.Model.PositiveInt? _PrecedenceElement; /// /// Precedence (primary, secondary, etc.) @@ -6142,13 +5975,10 @@ public Hl7.Fhir.Model.PositiveInt PrecedenceElement [IgnoreDataMember] public int? Precedence { - get { return PrecedenceElement != null ? PrecedenceElement.Value : null; } + get => _PrecedenceElement?.Value; set { - if (value == null) - PrecedenceElement = null; - else - PrecedenceElement = new Hl7.Fhir.Model.PositiveInt(value); + PrecedenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Precedence"); } } @@ -6161,24 +5991,24 @@ public int? Precedence [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Details of the event. /// [FhirElement("accident", Order=410)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent Accident + public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent _Accident; + private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? _Accident; /// /// Product or service provided. @@ -6188,11 +6018,11 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent Accident [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -6202,11 +6032,11 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Header-level adjudication. @@ -6216,11 +6046,11 @@ public List AddItem [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication totals. @@ -6230,24 +6060,24 @@ public List Adjudicat [DataMember] public List Total { - get { if(_Total==null) _Total = new List(); return _Total; } + get => _Total ?? new List(); set { _Total = value; OnPropertyChanged("Total"); } } - private List _Total; + private List? _Total; /// /// Payment Details. /// [FhirElement("payment", Order=460)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment + public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent _Payment; + private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? _Payment; /// /// Printed form identifier. @@ -6255,26 +6085,26 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment [FhirElement("formCode", Order=470)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Printed reference or actual form. /// [FhirElement("form", Order=480)] [DataMember] - public Hl7.Fhir.Model.Attachment Form + public Hl7.Fhir.Model.Attachment? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.Attachment _Form; + private Hl7.Fhir.Model.Attachment? _Form; /// /// Note concerning adjudication. @@ -6284,24 +6114,24 @@ public Hl7.Fhir.Model.Attachment Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// When the benefits are applicable. /// [FhirElement("benefitPeriod", Order=500)] [DataMember] - public Hl7.Fhir.Model.Period BenefitPeriod + public Hl7.Fhir.Model.Period? BenefitPeriod { get { return _BenefitPeriod; } set { _BenefitPeriod = value; OnPropertyChanged("BenefitPeriod"); } } - private Hl7.Fhir.Model.Period _BenefitPeriod; + private Hl7.Fhir.Model.Period? _BenefitPeriod; /// /// Balance by Benefit Category. @@ -6311,70 +6141,66 @@ public Hl7.Fhir.Model.Period BenefitPeriod [DataMember] public List BenefitBalance { - get { if(_BenefitBalance==null) _BenefitBalance = new List(); return _BenefitBalance; } + get => _BenefitBalance ?? new List(); set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } - private List _BenefitBalance; + private List? _BenefitBalance; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as ExplanationOfBenefit; - - if (dest == null) - { + if(other is not ExplanationOfBenefit dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(FundsReserveRequested != null) dest.FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)FundsReserveRequested.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)Payee.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(PreAuthRefPeriod.Any()) dest.PreAuthRefPeriod = new List(PreAuthRefPeriod.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(PrecedenceElement != null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)PrecedenceElement.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)Accident.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Total.Any()) dest.Total = new List(Total.DeepCopyInternal()); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)Payment.DeepCopyInternal(); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.Attachment)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(BenefitPeriod != null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)BenefitPeriod.DeepCopyInternal(); - if(BenefitBalance.Any()) dest.BenefitBalance = new List(BenefitBalance.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_FundsReserveRequested is not null) dest.FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)_FundsReserveRequested.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_PreAuthRefPeriod is not null) dest.PreAuthRefPeriod = new List(_PreAuthRefPeriod.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_PrecedenceElement is not null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)_PrecedenceElement.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)_Accident.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Total is not null) dest.Total = new List(_Total.DeepCopyInternal()); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)_Payment.DeepCopyInternal(); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.Attachment)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_BenefitPeriod is not null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)_BenefitPeriod.DeepCopyInternal(); + if(_BenefitBalance is not null) dest.BenefitBalance = new List(_BenefitBalance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -6386,328 +6212,328 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExplanationOfBenefit; - if(otherT == null) return false; + if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(FundsReserveRequested, otherT.FundsReserveRequested)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.ListEquals(PreAuthRefPeriod, otherT.PreAuthRefPeriod)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(PrecedenceElement, otherT.PrecedenceElement)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Total, otherT.Total)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.Equals(BenefitPeriod, otherT.BenefitPeriod)) return false; - if(!comparer.ListEquals(BenefitBalance, otherT.BenefitBalance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_FundsReserveRequested, otherT._FundsReserveRequested)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.ListEquals(_PreAuthRefPeriod, otherT._PreAuthRefPeriod)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_PrecedenceElement, otherT._PrecedenceElement)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Total, otherT._Total)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; + if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "fundsReserveRequested": - value = FundsReserveRequested; - return FundsReserveRequested is not null; + value = _FundsReserveRequested; + return _FundsReserveRequested is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "preAuthRefPeriod": - value = PreAuthRefPeriod; - return PreAuthRefPeriod?.Any() == true; + value = _PreAuthRefPeriod; + return _PreAuthRefPeriod?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "precedence": - value = PrecedenceElement; - return PrecedenceElement is not null; + value = _PrecedenceElement; + return _PrecedenceElement is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "total": - value = Total; - return Total?.Any() == true; + value = _Total; + return _Total?.Any() == true; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "benefitPeriod": - value = BenefitPeriod; - return BenefitPeriod is not null; + value = _BenefitPeriod; + return _BenefitPeriod is not null; case "benefitBalance": - value = BenefitBalance; - return BenefitBalance?.Any() == true; + value = _BenefitBalance; + return _BenefitBalance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserveRequested": - FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "preAuthRefPeriod": - PreAuthRefPeriod = (List)value; + PreAuthRefPeriod = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "precedence": - PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)value; + PrecedenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "accident": - Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "total": - Total = (List)value; + Total = (List?)value!; return this; case "payment": - Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent?)value; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "form": - Form = (Hl7.Fhir.Model.Attachment)value; + Form = (Hl7.Fhir.Model.Attachment?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "benefitPeriod": - BenefitPeriod = (Hl7.Fhir.Model.Period)value; + BenefitPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "benefitBalance": - BenefitBalance = (List)value; + BenefitBalance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -6718,49 +6544,49 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (FundsReserveRequested is not null) yield return new KeyValuePair("fundsReserveRequested",FundsReserveRequested); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthRefPeriod?.Any() == true) yield return new KeyValuePair("preAuthRefPeriod",PreAuthRefPeriod); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (PrecedenceElement is not null) yield return new KeyValuePair("precedence",PrecedenceElement); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Total?.Any() == true) yield return new KeyValuePair("total",Total); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",BenefitPeriod); - if (BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",BenefitBalance); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_FundsReserveRequested is not null) yield return new KeyValuePair("fundsReserveRequested",_FundsReserveRequested); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthRefPeriod?.Any() == true) yield return new KeyValuePair("preAuthRefPeriod",_PreAuthRefPeriod); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_PrecedenceElement is not null) yield return new KeyValuePair("precedence",_PrecedenceElement); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Total?.Any() == true) yield return new KeyValuePair("total",_Total); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",_BenefitPeriod); + if (_BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",_BenefitBalance); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Expression.cs b/src/Hl7.Fhir.R4/Model/Generated/Expression.cs index ce841473b..e22706524 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Expression.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Expression.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Expression : Hl7.Fhir.Model.DataType /// [FhirElement("description", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -95,28 +95,25 @@ public string Description /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Short name assigned to expression for reuse /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -128,28 +125,25 @@ public string Name [Binding("ExpressionLanguage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// text/cql | text/fhirpath | application/x-fhir-query | etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -159,28 +153,25 @@ public string Language /// [FhirElement("expression", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Expression in specified language /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression_ + public string? Expression_ { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression_"); } } @@ -190,47 +181,40 @@ public string Expression_ /// [FhirElement("reference", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Where the expression is found /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Expression; - - if (dest == null) - { + if(other is not Expression dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -242,62 +226,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Expression; - if(otherT == null) return false; + if(other is not Expression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -308,11 +292,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs index 5a29742fa..68a7ff753 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConditionCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// deceased | permanent disability | etc. @@ -130,26 +133,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("outcome", Order=50)] [Binding("ConditionOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Whether the condition contributed to the cause of death. /// [FhirElement("contributedToDeath", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement + public Hl7.Fhir.Model.FhirBoolean? ContributedToDeathElement { get { return _ContributedToDeathElement; } set { _ContributedToDeathElement = value; OnPropertyChanged("ContributedToDeathElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ContributedToDeathElement; + private Hl7.Fhir.Model.FhirBoolean? _ContributedToDeathElement; /// /// Whether the condition contributed to the cause of death @@ -158,13 +161,10 @@ public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement [IgnoreDataMember] public bool? ContributedToDeath { - get { return ContributedToDeathElement != null ? ContributedToDeathElement.Value : null; } + get => _ContributedToDeathElement?.Value; set { - if (value == null) - ContributedToDeathElement = null; - else - ContributedToDeathElement = new Hl7.Fhir.Model.FhirBoolean(value); + ContributedToDeathElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ContributedToDeath"); } } @@ -176,13 +176,13 @@ public bool? ContributedToDeath [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Extra information about condition. @@ -192,27 +192,23 @@ public Hl7.Fhir.Model.DataType Onset [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(ContributedToDeathElement != null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)ContributedToDeathElement.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_ContributedToDeathElement is not null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)_ContributedToDeathElement.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -224,62 +220,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(ContributedToDeathElement, otherT.ContributedToDeathElement)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "contributedToDeath": - value = ContributedToDeathElement; - return ContributedToDeathElement is not null; + value = _ContributedToDeathElement; + return _ContributedToDeathElement is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contributedToDeath": - ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)value; + ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -290,11 +286,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",ContributedToDeathElement); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",_ContributedToDeathElement); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -307,11 +303,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -321,24 +317,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -353,24 +349,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -385,13 +381,13 @@ public IEnumerable InstantiatesUri [Binding("FamilyHistoryStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// partial | completed | entered-in-error | health-unknown @@ -400,13 +396,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -417,13 +410,13 @@ public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status [FhirElement("dataAbsentReason", InSummary=true, Order=130)] [Binding("FamilyHistoryAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// Patient history is about. @@ -433,41 +426,38 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When history was recorded or last updated. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When history was recorded or last updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -477,28 +467,25 @@ public string Date /// [FhirElement("name", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The family member described /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -510,13 +497,13 @@ public string Name [Binding("FamilialRelationship")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// male | female | other | unknown. @@ -524,13 +511,13 @@ public Hl7.Fhir.Model.CodeableConcept Relationship [FhirElement("sex", InSummary=true, Order=180)] [Binding("Sex")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Sex + public Hl7.Fhir.Model.CodeableConcept? Sex { get { return _Sex; } set { _Sex = value; OnPropertyChanged("Sex"); } } - private Hl7.Fhir.Model.CodeableConcept _Sex; + private Hl7.Fhir.Model.CodeableConcept? _Sex; /// /// (approximate) date of birth. @@ -539,13 +526,13 @@ public Hl7.Fhir.Model.CodeableConcept Sex [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Born + public Hl7.Fhir.Model.DataType? Born { get { return _Born; } set { _Born = value; OnPropertyChanged("Born"); } } - private Hl7.Fhir.Model.DataType _Born; + private Hl7.Fhir.Model.DataType? _Born; /// /// (approximate) age. @@ -554,26 +541,26 @@ public Hl7.Fhir.Model.DataType Born [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Age + public Hl7.Fhir.Model.DataType? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.DataType _Age; + private Hl7.Fhir.Model.DataType? _Age; /// /// Age is estimated?. /// [FhirElement("estimatedAge", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement + public Hl7.Fhir.Model.FhirBoolean? EstimatedAgeElement { get { return _EstimatedAgeElement; } set { _EstimatedAgeElement = value; OnPropertyChanged("EstimatedAgeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EstimatedAgeElement; + private Hl7.Fhir.Model.FhirBoolean? _EstimatedAgeElement; /// /// Age is estimated? @@ -582,13 +569,10 @@ public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement [IgnoreDataMember] public bool? EstimatedAge { - get { return EstimatedAgeElement != null ? EstimatedAgeElement.Value : null; } + get => _EstimatedAgeElement?.Value; set { - if (value == null) - EstimatedAgeElement = null; - else - EstimatedAgeElement = new Hl7.Fhir.Model.FhirBoolean(value); + EstimatedAgeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EstimatedAge"); } } @@ -600,13 +584,13 @@ public bool? EstimatedAge [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// Why was family member history performed?. @@ -617,11 +601,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was family member history performed?. @@ -633,11 +617,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// General note about related person. @@ -647,11 +631,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Condition that the related person had. @@ -661,42 +645,38 @@ public List Note [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as FamilyMemberHistory; - - if (dest == null) - { + if(other is not FamilyMemberHistory dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Sex != null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)Sex.DeepCopyInternal(); - if(Born != null) dest.Born = (Hl7.Fhir.Model.DataType)Born.DeepCopyInternal(); - if(Age != null) dest.Age = (Hl7.Fhir.Model.DataType)Age.DeepCopyInternal(); - if(EstimatedAgeElement != null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)EstimatedAgeElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Sex is not null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)_Sex.DeepCopyInternal(); + if(_Born is not null) dest.Born = (Hl7.Fhir.Model.DataType)_Born.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.DataType)_Age.DeepCopyInternal(); + if(_EstimatedAgeElement is not null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)_EstimatedAgeElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -708,153 +688,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FamilyMemberHistory; - if(otherT == null) return false; + if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Sex, otherT.Sex)) return false; - if(!comparer.Equals(Born, otherT.Born)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(EstimatedAgeElement, otherT.EstimatedAgeElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Sex, otherT._Sex)) return false; + if(!comparer.Equals(_Born, otherT._Born)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_EstimatedAgeElement, otherT._EstimatedAgeElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "sex": - value = Sex; - return Sex is not null; + value = _Sex; + return _Sex is not null; case "born": - value = Born; - return Born is not null; + value = _Born; + return _Born is not null; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "estimatedAge": - value = EstimatedAgeElement; - return EstimatedAgeElement is not null; + value = _EstimatedAgeElement; + return _EstimatedAgeElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sex": - Sex = (Hl7.Fhir.Model.CodeableConcept)value; + Sex = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "born": - Born = (Hl7.Fhir.Model.DataType)value; + Born = (Hl7.Fhir.Model.DataType?)value; return this; case "age": - Age = (Hl7.Fhir.Model.DataType)value; + Age = (Hl7.Fhir.Model.DataType?)value; return this; case "estimatedAge": - EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)value; + EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; default: return base.SetValue(key, value); @@ -865,24 +845,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Sex is not null) yield return new KeyValuePair("sex",Sex); - if (Born is not null) yield return new KeyValuePair("born",Born); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",EstimatedAgeElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Sex is not null) yield return new KeyValuePair("sex",_Sex); + if (_Born is not null) yield return new KeyValuePair("born",_Born); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",_EstimatedAgeElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Flag.cs b/src/Hl7.Fhir.R4/Model/Generated/Flag.cs index a5ec70732..266e7dc6e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Flag.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Flag","http://hl7.org/fhir/StructureDefinition/Flag")] - public partial class Flag : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Flag : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -95,11 +98,11 @@ public enum FlagStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -109,13 +112,13 @@ public List Identifier [Binding("FlagStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -124,13 +127,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Flag.FlagStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -144,11 +144,11 @@ public Hl7.Fhir.Model.Flag.FlagStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Coded or textual message to display to user. @@ -157,13 +157,13 @@ public List Category [Binding("FlagCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/What is flag about?. @@ -173,26 +173,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Location","Group","Organization","Practitioner","PlanDefinition","Medication","Procedure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Time period when flag is active. /// [FhirElement("period", InSummary=true, Order=140, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Alert relevant during encounter. @@ -201,13 +201,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Flag creator. @@ -216,37 +216,33 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Flag; - - if (dest == null) - { + if(other is not Flag dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -258,83 +254,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Flag; - if(otherT == null) return false; + if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -345,14 +341,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Goal.cs b/src/Hl7.Fhir.R4/Model/Generated/Goal.cs index 03000dab2..380af5f4f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Goal.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -147,13 +150,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", InSummary=true, Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -163,13 +166,13 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal on or before. @@ -178,27 +181,23 @@ public Hl7.Fhir.Model.DataType Detail [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Due + public Hl7.Fhir.Model.DataType? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.DataType _Due; + private Hl7.Fhir.Model.DataType? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.DataType)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.DataType)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -210,48 +209,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.DataType)value; + Due = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -262,9 +261,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -277,11 +276,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected. @@ -291,13 +290,13 @@ public List Identifier [Binding("GoalLifecycleStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code LifecycleStatusElement + public Code? LifecycleStatusElement { get { return _LifecycleStatusElement; } set { _LifecycleStatusElement = value; OnPropertyChanged("LifecycleStatusElement"); } } - private Code _LifecycleStatusElement; + private Code? _LifecycleStatusElement; /// /// proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected @@ -306,13 +305,10 @@ public Code LifecycleStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Goal.GoalLifecycleStatus? LifecycleStatus { - get { return LifecycleStatusElement != null ? LifecycleStatusElement.Value : null; } + get => _LifecycleStatusElement?.Value; set { - if (value == null) - LifecycleStatusElement = null; - else - LifecycleStatusElement = new Code(value); + LifecycleStatusElement = value is null ? null : new Code(value); OnPropertyChanged("LifecycleStatus"); } } @@ -323,13 +319,13 @@ public Hl7.Fhir.Model.Goal.GoalLifecycleStatus? LifecycleStatus [FhirElement("achievementStatus", InSummary=true, Order=110)] [Binding("GoalAchievementStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AchievementStatus + public Hl7.Fhir.Model.CodeableConcept? AchievementStatus { get { return _AchievementStatus; } set { _AchievementStatus = value; OnPropertyChanged("AchievementStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _AchievementStatus; + private Hl7.Fhir.Model.CodeableConcept? _AchievementStatus; /// /// E.g. Treatment, dietary, behavioral, etc. @@ -340,11 +336,11 @@ public Hl7.Fhir.Model.CodeableConcept AchievementStatus [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// high-priority | medium-priority | low-priority. @@ -352,13 +348,13 @@ public List Category [FhirElement("priority", InSummary=true, Order=130, FiveWs="FiveWs.grade")] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// Code or text describing goal. @@ -367,13 +363,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// Who this goal is intended for. @@ -383,13 +379,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [References("Patient","Group","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When goal pursuit begins. @@ -399,13 +395,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Start + public Hl7.Fhir.Model.DataType? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.DataType _Start; + private Hl7.Fhir.Model.DataType? _Start; /// /// Target outcome for the goal. @@ -415,39 +411,36 @@ public Hl7.Fhir.Model.DataType Start [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// When goal status took effect. /// [FhirElement("statusDate", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Date StatusDateElement + public Hl7.Fhir.Model.Date? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.Date _StatusDateElement; + private Hl7.Fhir.Model.Date? _StatusDateElement; /// /// When goal status took effect /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.Date(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("StatusDate"); } } @@ -457,28 +450,25 @@ public string StatusDate /// [FhirElement("statusReason", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString StatusReasonElement + public Hl7.Fhir.Model.FhirString? StatusReasonElement { get { return _StatusReasonElement; } set { _StatusReasonElement = value; OnPropertyChanged("StatusReasonElement"); } } - private Hl7.Fhir.Model.FhirString _StatusReasonElement; + private Hl7.Fhir.Model.FhirString? _StatusReasonElement; /// /// Reason for current status /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusReason + public string? StatusReason { - get { return StatusReasonElement != null ? StatusReasonElement.Value : null; } + get => _StatusReasonElement?.Value; set { - if (value == null) - StatusReasonElement = null; - else - StatusReasonElement = new Hl7.Fhir.Model.FhirString(value); + StatusReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StatusReason"); } } @@ -490,13 +480,13 @@ public string StatusReason [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExpressedBy + public Hl7.Fhir.Model.ResourceReference? ExpressedBy { get { return _ExpressedBy; } set { _ExpressedBy = value; OnPropertyChanged("ExpressedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ExpressedBy; + private Hl7.Fhir.Model.ResourceReference? _ExpressedBy; /// /// Issues addressed by this goal. @@ -508,11 +498,11 @@ public Hl7.Fhir.Model.ResourceReference ExpressedBy [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Comments about the goal. @@ -522,11 +512,11 @@ public List Addresses [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// What result was achieved regarding the goal?. @@ -537,11 +527,11 @@ public List Note [DataMember] public List OutcomeCode { - get { if(_OutcomeCode==null) _OutcomeCode = new List(); return _OutcomeCode; } + get => _OutcomeCode ?? new List(); set { _OutcomeCode = value; OnPropertyChanged("OutcomeCode"); } } - private List _OutcomeCode; + private List? _OutcomeCode; /// /// Observation that resulted from goal. @@ -553,43 +543,39 @@ public List OutcomeCode [DataMember] public List OutcomeReference { - get { if(_OutcomeReference==null) _OutcomeReference = new List(); return _OutcomeReference; } + get => _OutcomeReference ?? new List(); set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } - private List _OutcomeReference; + private List? _OutcomeReference; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category.ToCodings(); + IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Goal; - - if (dest == null) - { + if(other is not Goal dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(LifecycleStatusElement != null) dest.LifecycleStatusElement = (Code)LifecycleStatusElement.DeepCopyInternal(); - if(AchievementStatus != null) dest.AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)AchievementStatus.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.DataType)Start.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)StatusDateElement.DeepCopyInternal(); - if(StatusReasonElement != null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)StatusReasonElement.DeepCopyInternal(); - if(ExpressedBy != null) dest.ExpressedBy = (Hl7.Fhir.Model.ResourceReference)ExpressedBy.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(OutcomeCode.Any()) dest.OutcomeCode = new List(OutcomeCode.DeepCopyInternal()); - if(OutcomeReference.Any()) dest.OutcomeReference = new List(OutcomeReference.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_LifecycleStatusElement is not null) dest.LifecycleStatusElement = (Code)_LifecycleStatusElement.DeepCopyInternal(); + if(_AchievementStatus is not null) dest.AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)_AchievementStatus.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.DataType)_Start.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)_StatusDateElement.DeepCopyInternal(); + if(_StatusReasonElement is not null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)_StatusReasonElement.DeepCopyInternal(); + if(_ExpressedBy is not null) dest.ExpressedBy = (Hl7.Fhir.Model.ResourceReference)_ExpressedBy.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_OutcomeCode is not null) dest.OutcomeCode = new List(_OutcomeCode.DeepCopyInternal()); + if(_OutcomeReference is not null) dest.OutcomeReference = new List(_OutcomeReference.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -601,139 +587,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Goal; - if(otherT == null) return false; + if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(LifecycleStatusElement, otherT.LifecycleStatusElement)) return false; - if(!comparer.Equals(AchievementStatus, otherT.AchievementStatus)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(StatusReasonElement, otherT.StatusReasonElement)) return false; - if(!comparer.Equals(ExpressedBy, otherT.ExpressedBy)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(OutcomeCode, otherT.OutcomeCode)) return false; - if(!comparer.ListEquals(OutcomeReference, otherT.OutcomeReference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_LifecycleStatusElement, otherT._LifecycleStatusElement)) return false; + if(!comparer.Equals(_AchievementStatus, otherT._AchievementStatus)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_StatusReasonElement, otherT._StatusReasonElement)) return false; + if(!comparer.Equals(_ExpressedBy, otherT._ExpressedBy)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_OutcomeCode, otherT._OutcomeCode)) return false; + if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "lifecycleStatus": - value = LifecycleStatusElement; - return LifecycleStatusElement is not null; + value = _LifecycleStatusElement; + return _LifecycleStatusElement is not null; case "achievementStatus": - value = AchievementStatus; - return AchievementStatus is not null; + value = _AchievementStatus; + return _AchievementStatus is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "statusReason": - value = StatusReasonElement; - return StatusReasonElement is not null; + value = _StatusReasonElement; + return _StatusReasonElement is not null; case "expressedBy": - value = ExpressedBy; - return ExpressedBy is not null; + value = _ExpressedBy; + return _ExpressedBy is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "outcomeCode": - value = OutcomeCode; - return OutcomeCode?.Any() == true; + value = _OutcomeCode; + return _OutcomeCode?.Any() == true; case "outcomeReference": - value = OutcomeReference; - return OutcomeReference?.Any() == true; + value = _OutcomeReference; + return _OutcomeReference?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "lifecycleStatus": - LifecycleStatusElement = (Code)value; + LifecycleStatusElement = (Code?)value; return this; case "achievementStatus": - AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)value; + AchievementStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - Start = (Hl7.Fhir.Model.DataType)value; + Start = (Hl7.Fhir.Model.DataType?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.Date)value; + StatusDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "statusReason": - StatusReasonElement = (Hl7.Fhir.Model.FhirString)value; + StatusReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expressedBy": - ExpressedBy = (Hl7.Fhir.Model.ResourceReference)value; + ExpressedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "outcomeCode": - OutcomeCode = (List)value; + OutcomeCode = (List?)value!; return this; case "outcomeReference": - OutcomeReference = (List)value; + OutcomeReference = (List?)value!; return this; default: return base.SetValue(key, value); @@ -744,22 +730,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (LifecycleStatusElement is not null) yield return new KeyValuePair("lifecycleStatus",LifecycleStatusElement); - if (AchievementStatus is not null) yield return new KeyValuePair("achievementStatus",AchievementStatus); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (StatusReasonElement is not null) yield return new KeyValuePair("statusReason",StatusReasonElement); - if (ExpressedBy is not null) yield return new KeyValuePair("expressedBy",ExpressedBy); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (OutcomeCode?.Any() == true) yield return new KeyValuePair("outcomeCode",OutcomeCode); - if (OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",OutcomeReference); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_LifecycleStatusElement is not null) yield return new KeyValuePair("lifecycleStatus",_LifecycleStatusElement); + if (_AchievementStatus is not null) yield return new KeyValuePair("achievementStatus",_AchievementStatus); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_StatusReasonElement is not null) yield return new KeyValuePair("statusReason",_StatusReasonElement); + if (_ExpressedBy is not null) yield return new KeyValuePair("expressedBy",_ExpressedBy); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_OutcomeCode?.Any() == true) yield return new KeyValuePair("outcomeCode",_OutcomeCode); + if (_OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",_OutcomeReference); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs index 63f322a20..e68ecb4ce 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,28 +136,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("path", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path in the resource that contains the link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -164,28 +164,25 @@ public string Path /// [FhirElement("sliceName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SliceNameElement + public Hl7.Fhir.Model.FhirString? SliceNameElement { get { return _SliceNameElement; } set { _SliceNameElement = value; OnPropertyChanged("SliceNameElement"); } } - private Hl7.Fhir.Model.FhirString _SliceNameElement; + private Hl7.Fhir.Model.FhirString? _SliceNameElement; /// /// Which slice (if profiled) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SliceName + public string? SliceName { - get { return SliceNameElement != null ? SliceNameElement.Value : null; } + get => _SliceNameElement?.Value; set { - if (value == null) - SliceNameElement = null; - else - SliceNameElement = new Hl7.Fhir.Model.FhirString(value); + SliceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SliceName"); } } @@ -195,13 +192,13 @@ public string SliceName /// [FhirElement("min", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum occurrences for this link @@ -210,13 +207,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -226,28 +220,25 @@ public int? Min /// [FhirElement("max", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum occurrences for this link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -257,28 +248,25 @@ public string Max /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why this link is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -291,28 +279,24 @@ public string Description [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SliceNameElement != null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)SliceNameElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SliceNameElement is not null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)_SliceNameElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -324,69 +308,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SliceNameElement, otherT.SliceNameElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sliceName": - value = SliceNameElement; - return SliceNameElement is not null; + value = _SliceNameElement; + return _SliceNameElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sliceName": - SliceNameElement = (Hl7.Fhir.Model.FhirString)value; + SliceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -397,12 +381,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SliceNameElement is not null) yield return new KeyValuePair("sliceName",SliceNameElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SliceNameElement is not null) yield return new KeyValuePair("sliceName",_SliceNameElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -428,13 +412,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type of resource this link refers to @@ -443,13 +427,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -459,28 +440,25 @@ public Hl7.Fhir.Model.ResourceType? Type /// [FhirElement("params", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ParamsElement + public Hl7.Fhir.Model.FhirString? ParamsElement { get { return _ParamsElement; } set { _ParamsElement = value; OnPropertyChanged("ParamsElement"); } } - private Hl7.Fhir.Model.FhirString _ParamsElement; + private Hl7.Fhir.Model.FhirString? _ParamsElement; /// /// Criteria for reverse lookup /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Params + public string? Params { - get { return ParamsElement != null ? ParamsElement.Value : null; } + get => _ParamsElement?.Value; set { - if (value == null) - ParamsElement = null; - else - ParamsElement = new Hl7.Fhir.Model.FhirString(value); + ParamsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Params"); } } @@ -490,28 +468,25 @@ public string Params /// [FhirElement("profile", Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile for the target resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -524,11 +499,11 @@ public string Profile [DataMember] public List Compartment { - get { if(_Compartment==null) _Compartment = new List(); return _Compartment; } + get => _Compartment ?? new List(); set { _Compartment = value; OnPropertyChanged("Compartment"); } } - private List _Compartment; + private List? _Compartment; /// /// Additional links from target resource. @@ -538,27 +513,23 @@ public List Compartment [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ParamsElement != null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)ParamsElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(Compartment.Any()) dest.Compartment = new List(Compartment.DeepCopyInternal()); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ParamsElement is not null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)_ParamsElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_Compartment is not null) dest.Compartment = new List(_Compartment.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -570,62 +541,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ParamsElement, otherT.ParamsElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Compartment, otherT.Compartment)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "params": - value = ParamsElement; - return ParamsElement is not null; + value = _ParamsElement; + return _ParamsElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "compartment": - value = Compartment; - return Compartment?.Any() == true; + value = _Compartment; + return _Compartment?.Any() == true; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "params": - ParamsElement = (Hl7.Fhir.Model.FhirString)value; + ParamsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "compartment": - Compartment = (List)value; + Compartment = (List?)value!; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -636,11 +607,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ParamsElement is not null) yield return new KeyValuePair("params",ParamsElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Compartment?.Any() == true) yield return new KeyValuePair("compartment",Compartment); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ParamsElement is not null) yield return new KeyValuePair("params",_ParamsElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Compartment?.Any() == true) yield return new KeyValuePair("compartment",_Compartment); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } @@ -666,13 +637,13 @@ public partial class CompartmentComponent : Hl7.Fhir.Model.BackboneElement [Binding("GraphCompartmentUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// condition | requirement @@ -681,13 +652,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -700,13 +668,13 @@ public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentUse? Use [Binding("CompartmentCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device @@ -715,13 +683,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -734,13 +699,13 @@ public Hl7.Fhir.Model.CompartmentType? Code [Binding("GraphCompartmentRule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RuleElement + public Code? RuleElement { get { return _RuleElement; } set { _RuleElement = value; OnPropertyChanged("RuleElement"); } } - private Code _RuleElement; + private Code? _RuleElement; /// /// identical | matching | different | custom @@ -749,13 +714,10 @@ public Code RuleElement [IgnoreDataMember] public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule { - get { return RuleElement != null ? RuleElement.Value : null; } + get => _RuleElement?.Value; set { - if (value == null) - RuleElement = null; - else - RuleElement = new Code(value); + RuleElement = value is null ? null : new Code(value); OnPropertyChanged("Rule"); } } @@ -765,28 +727,25 @@ public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Custom rule, as a FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -796,47 +755,40 @@ public string Expression /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Documentation for FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentComponent; - - if (dest == null) - { + if(other is not CompartmentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(RuleElement != null) dest.RuleElement = (Code)RuleElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_RuleElement is not null) dest.RuleElement = (Code)_RuleElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -848,62 +800,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentComponent; - if(otherT == null) return false; + if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(RuleElement, otherT.RuleElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "rule": - value = RuleElement; - return RuleElement is not null; + value = _RuleElement; + return _RuleElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "rule": - RuleElement = (Code)value; + RuleElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -914,11 +866,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (RuleElement is not null) yield return new KeyValuePair("rule",RuleElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_RuleElement is not null) yield return new KeyValuePair("rule",_RuleElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -928,28 +880,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this graph definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -959,28 +908,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -991,28 +937,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this graph definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1025,13 +968,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1040,13 +983,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1056,13 +996,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=130, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1071,13 +1011,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1087,28 +1024,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1118,28 +1052,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1152,39 +1083,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the graph definition. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1197,11 +1125,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for graph definition (if applicable). @@ -1212,39 +1140,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this graph definition is defined. /// [FhirElement("purpose", Order=200, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this graph definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1257,13 +1182,13 @@ public string Purpose [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StartElement + public Code? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Code _StartElement; + private Code? _StartElement; /// /// Type of resource at which the graph starts @@ -1272,13 +1197,10 @@ public Code StartElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Code(value); + StartElement = value is null ? null : new Code(value); OnPropertyChanged("Start"); } } @@ -1288,28 +1210,25 @@ public Hl7.Fhir.Model.ResourceType? Start /// [FhirElement("profile", Order=220)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile on base resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -1322,37 +1241,33 @@ public string Profile [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as GraphDefinition; - - if (dest == null) - { + if(other is not GraphDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Code)StartElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Code)_StartElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1364,132 +1279,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GraphDefinition; - if(otherT == null) return false; + if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "start": - StartElement = (Code)value; + StartElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1500,21 +1415,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Group.cs b/src/Hl7.Fhir.R4/Model/Generated/Group.cs index 2b415c5e1..9e4b8526b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Group.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Group","http://hl7.org/fhir/StructureDefinition/Group")] - public partial class Group : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Group : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -130,13 +133,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("GroupCharacteristicKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value held by characteristic. @@ -147,13 +150,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Group includes or excludes. @@ -161,13 +164,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("exclude", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Group includes or excludes @@ -176,13 +179,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -192,28 +192,24 @@ public bool? Exclude /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -225,55 +221,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -284,10 +280,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -316,39 +312,39 @@ public partial class MemberComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","Practitioner","PractitionerRole","Device","Medication","Substance","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Entity + public Hl7.Fhir.Model.ResourceReference? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.ResourceReference _Entity; + private Hl7.Fhir.Model.ResourceReference? _Entity; /// /// Period member belonged to the group. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// If member is no longer in group. /// [FhirElement("inactive", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// If member is no longer in group @@ -357,30 +353,23 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MemberComponent; - - if (dest == null) - { + if(other is not MemberComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)Entity.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)_Entity.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -392,48 +381,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MemberComponent; - if(otherT == null) return false; + if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.ResourceReference)value; + Entity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -444,9 +433,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); } } @@ -459,24 +448,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this group's record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this group's record is in active use @@ -485,13 +474,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -504,13 +490,13 @@ public bool? Active [Binding("GroupType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | animal | practitioner | device | medication | substance @@ -519,13 +505,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Group.GroupType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -536,13 +519,13 @@ public Hl7.Fhir.Model.Group.GroupType? Type [FhirElement("actual", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Descriptive or actual @@ -551,13 +534,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -568,41 +548,38 @@ public bool? Actual [FhirElement("code", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [Binding("GroupKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Label for Group. /// [FhirElement("name", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for Group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -612,13 +589,13 @@ public string Name /// [FhirElement("quantity", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt QuantityElement + public Hl7.Fhir.Model.UnsignedInt? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.UnsignedInt _QuantityElement; + private Hl7.Fhir.Model.UnsignedInt? _QuantityElement; /// /// Number of members @@ -627,13 +604,10 @@ public Hl7.Fhir.Model.UnsignedInt QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.UnsignedInt(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Quantity"); } } @@ -645,13 +619,13 @@ public int? Quantity [CLSCompliant(false)] [References("Organization","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingEntity + public Hl7.Fhir.Model.ResourceReference? ManagingEntity { get { return _ManagingEntity; } set { _ManagingEntity = value; OnPropertyChanged("ManagingEntity"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingEntity; + private Hl7.Fhir.Model.ResourceReference? _ManagingEntity; /// /// Include / Exclude group members by Trait. @@ -661,11 +635,11 @@ public Hl7.Fhir.Model.ResourceReference ManagingEntity [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Who or what is in group. @@ -675,37 +649,33 @@ public List Characteristic [DataMember] public List Member { - get { if(_Member==null) _Member = new List(); return _Member; } + get => _Member ?? new List(); set { _Member = value; OnPropertyChanged("Member"); } } - private List _Member; + private List? _Member; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Group; - - if (dest == null) - { + if(other is not Group dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)QuantityElement.DeepCopyInternal(); - if(ManagingEntity != null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)ManagingEntity.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Member.Any()) dest.Member = new List(Member.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)_QuantityElement.DeepCopyInternal(); + if(_ManagingEntity is not null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)_ManagingEntity.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Member is not null) dest.Member = new List(_Member.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -717,97 +687,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Group; - if(otherT == null) return false; + if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.Equals(ManagingEntity, otherT.ManagingEntity)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Member, otherT.Member)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.Equals(_ManagingEntity, otherT._ManagingEntity)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Member, otherT._Member)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "managingEntity": - value = ManagingEntity; - return ManagingEntity is not null; + value = _ManagingEntity; + return _ManagingEntity is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "member": - value = Member; - return Member?.Any() == true; + value = _Member; + return _Member?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.UnsignedInt)value; + QuantityElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "managingEntity": - ManagingEntity = (Hl7.Fhir.Model.ResourceReference)value; + ManagingEntity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "member": - Member = (List)value; + Member = (List?)value!; return this; default: return base.SetValue(key, value); @@ -818,16 +788,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (ManagingEntity is not null) yield return new KeyValuePair("managingEntity",ManagingEntity); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Member?.Any() == true) yield return new KeyValuePair("member",Member); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_ManagingEntity is not null) yield return new KeyValuePair("managingEntity",_ManagingEntity); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Member?.Any() == true) yield return new KeyValuePair("member",_Member); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs index 423649a2f..7e814684e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("GuidanceResponse","http://hl7.org/fhir/StructureDefinition/GuidanceResponse")] - public partial class GuidanceResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class GuidanceResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -110,13 +113,13 @@ public enum GuidanceResponseStatus /// [FhirElement("requestIdentifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier RequestIdentifier + public Hl7.Fhir.Model.Identifier? RequestIdentifier { get { return _RequestIdentifier; } set { _RequestIdentifier = value; OnPropertyChanged("RequestIdentifier"); } } - private Hl7.Fhir.Model.Identifier _RequestIdentifier; + private Hl7.Fhir.Model.Identifier? _RequestIdentifier; /// /// Business identifier. @@ -126,11 +129,11 @@ public Hl7.Fhir.Model.Identifier RequestIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// What guidance was requested. @@ -140,13 +143,13 @@ public List Identifier [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Module + public Hl7.Fhir.Model.DataType? Module { get { return _Module; } set { _Module = value; OnPropertyChanged("Module"); } } - private Hl7.Fhir.Model.DataType _Module; + private Hl7.Fhir.Model.DataType? _Module; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error. @@ -156,13 +159,13 @@ public Hl7.Fhir.Model.DataType Module [Binding("GuidanceResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error @@ -171,13 +174,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -189,13 +189,13 @@ public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter during which the response was returned. @@ -204,41 +204,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the guidance response was processed. /// [FhirElement("occurrenceDateTime", Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OccurrenceDateTimeElement + public Hl7.Fhir.Model.FhirDateTime? OccurrenceDateTimeElement { get { return _OccurrenceDateTimeElement; } set { _OccurrenceDateTimeElement = value; OnPropertyChanged("OccurrenceDateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OccurrenceDateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _OccurrenceDateTimeElement; /// /// When the guidance response was processed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OccurrenceDateTime + public string? OccurrenceDateTime { - get { return OccurrenceDateTimeElement != null ? OccurrenceDateTimeElement.Value : null; } + get => _OccurrenceDateTimeElement?.Value; set { - if (value == null) - OccurrenceDateTimeElement = null; - else - OccurrenceDateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + OccurrenceDateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("OccurrenceDateTime"); } } @@ -250,13 +247,13 @@ public string OccurrenceDateTime [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Why guidance is needed. @@ -266,11 +263,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why guidance is needed. @@ -282,11 +279,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Additional notes about the response. @@ -296,11 +293,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Messages resulting from the evaluation of the artifact or artifacts. @@ -312,11 +309,11 @@ public List Note [DataMember] public List EvaluationMessage { - get { if(_EvaluationMessage==null) _EvaluationMessage = new List(); return _EvaluationMessage; } + get => _EvaluationMessage ?? new List(); set { _EvaluationMessage = value; OnPropertyChanged("EvaluationMessage"); } } - private List _EvaluationMessage; + private List? _EvaluationMessage; /// /// The output parameters of the evaluation, if any. @@ -325,13 +322,13 @@ public List EvaluationMessage [CLSCompliant(false)] [References("Parameters")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OutputParameters + public Hl7.Fhir.Model.ResourceReference? OutputParameters { get { return _OutputParameters; } set { _OutputParameters = value; OnPropertyChanged("OutputParameters"); } } - private Hl7.Fhir.Model.ResourceReference _OutputParameters; + private Hl7.Fhir.Model.ResourceReference? _OutputParameters; /// /// Proposed actions, if any. @@ -340,13 +337,13 @@ public Hl7.Fhir.Model.ResourceReference OutputParameters [CLSCompliant(false)] [References("CarePlan","RequestGroup")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Result + public Hl7.Fhir.Model.ResourceReference? Result { get { return _Result; } set { _Result = value; OnPropertyChanged("Result"); } } - private Hl7.Fhir.Model.ResourceReference _Result; + private Hl7.Fhir.Model.ResourceReference? _Result; /// /// Additional required data. @@ -356,42 +353,38 @@ public Hl7.Fhir.Model.ResourceReference Result [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.DataType ICoded.Code { get => Module; set => Module = value; } - IEnumerable ICoded.ToCodings() => Module.ToCodings(); + Hl7.Fhir.Model.DataType? ICoded.Code { get => Module; set => Module = value!; } + IEnumerable ICoded.ToCodings() => Module?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as GuidanceResponse; - - if (dest == null) - { + if(other is not GuidanceResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequestIdentifier != null) dest.RequestIdentifier = (Hl7.Fhir.Model.Identifier)RequestIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Module != null) dest.Module = (Hl7.Fhir.Model.DataType)Module.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(OccurrenceDateTimeElement != null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)OccurrenceDateTimeElement.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(EvaluationMessage.Any()) dest.EvaluationMessage = new List(EvaluationMessage.DeepCopyInternal()); - if(OutputParameters != null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)OutputParameters.DeepCopyInternal(); - if(Result != null) dest.Result = (Hl7.Fhir.Model.ResourceReference)Result.DeepCopyInternal(); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); + if(_RequestIdentifier is not null) dest.RequestIdentifier = (Hl7.Fhir.Model.Identifier)_RequestIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Module is not null) dest.Module = (Hl7.Fhir.Model.DataType)_Module.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_OccurrenceDateTimeElement is not null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_OccurrenceDateTimeElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_EvaluationMessage is not null) dest.EvaluationMessage = new List(_EvaluationMessage.DeepCopyInternal()); + if(_OutputParameters is not null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)_OutputParameters.DeepCopyInternal(); + if(_Result is not null) dest.Result = (Hl7.Fhir.Model.ResourceReference)_Result.DeepCopyInternal(); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -403,132 +396,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuidanceResponse; - if(otherT == null) return false; + if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequestIdentifier, otherT.RequestIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Module, otherT.Module)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(OccurrenceDateTimeElement, otherT.OccurrenceDateTimeElement)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(EvaluationMessage, otherT.EvaluationMessage)) return false; - if(!comparer.Equals(OutputParameters, otherT.OutputParameters)) return false; - if(!comparer.Equals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Module, otherT._Module)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_OccurrenceDateTimeElement, otherT._OccurrenceDateTimeElement)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_EvaluationMessage, otherT._EvaluationMessage)) return false; + if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; + if(!comparer.Equals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "requestIdentifier": - value = RequestIdentifier; - return RequestIdentifier is not null; + value = _RequestIdentifier; + return _RequestIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "module": - value = Module; - return Module is not null; + value = _Module; + return _Module is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrenceDateTime": - value = OccurrenceDateTimeElement; - return OccurrenceDateTimeElement is not null; + value = _OccurrenceDateTimeElement; + return _OccurrenceDateTimeElement is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "evaluationMessage": - value = EvaluationMessage; - return EvaluationMessage?.Any() == true; + value = _EvaluationMessage; + return _EvaluationMessage?.Any() == true; case "outputParameters": - value = OutputParameters; - return OutputParameters is not null; + value = _OutputParameters; + return _OutputParameters is not null; case "result": - value = Result; - return Result is not null; + value = _Result; + return _Result is not null; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "requestIdentifier": - RequestIdentifier = (Hl7.Fhir.Model.Identifier)value; + RequestIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "module": - Module = (Hl7.Fhir.Model.DataType)value; + Module = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrenceDateTime": - OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "evaluationMessage": - EvaluationMessage = (List)value; + EvaluationMessage = (List?)value!; return this; case "outputParameters": - OutputParameters = (Hl7.Fhir.Model.ResourceReference)value; + OutputParameters = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "result": - Result = (Hl7.Fhir.Model.ResourceReference)value; + Result = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -539,21 +532,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequestIdentifier is not null) yield return new KeyValuePair("requestIdentifier",RequestIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Module is not null) yield return new KeyValuePair("module",Module); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",OccurrenceDateTimeElement); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (EvaluationMessage?.Any() == true) yield return new KeyValuePair("evaluationMessage",EvaluationMessage); - if (OutputParameters is not null) yield return new KeyValuePair("outputParameters",OutputParameters); - if (Result is not null) yield return new KeyValuePair("result",Result); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); + if (_RequestIdentifier is not null) yield return new KeyValuePair("requestIdentifier",_RequestIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Module is not null) yield return new KeyValuePair("module",_Module); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",_OccurrenceDateTimeElement); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_EvaluationMessage?.Any() == true) yield return new KeyValuePair("evaluationMessage",_EvaluationMessage); + if (_OutputParameters is not null) yield return new KeyValuePair("outputParameters",_OutputParameters); + if (_Result is not null) yield return new KeyValuePair("result",_Result); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs index 9980bcf2f..2bf4f1cc3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,57 +81,50 @@ public partial class EligibilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("ServiceEligibility")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Describes the eligibility conditions for the service. /// [FhirElement("comment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Describes the eligibility conditions for the service /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EligibilityComponent; - - if (dest == null) - { + if(other is not EligibilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -140,41 +136,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EligibilityComponent; - if(otherT == null) return false; + if(other is not EligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -185,8 +181,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -218,24 +214,24 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -247,13 +243,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// Always available? e.g. 24 hour service @@ -262,13 +258,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -278,28 +271,25 @@ public bool? AllDay /// [FhirElement("availableStartTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time AvailableStartTimeElement + public Hl7.Fhir.Model.Time? AvailableStartTimeElement { get { return _AvailableStartTimeElement; } set { _AvailableStartTimeElement = value; OnPropertyChanged("AvailableStartTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableStartTimeElement; + private Hl7.Fhir.Model.Time? _AvailableStartTimeElement; /// /// Opening time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableStartTime + public string? AvailableStartTime { - get { return AvailableStartTimeElement != null ? AvailableStartTimeElement.Value : null; } + get => _AvailableStartTimeElement?.Value; set { - if (value == null) - AvailableStartTimeElement = null; - else - AvailableStartTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableStartTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableStartTime"); } } @@ -309,46 +299,39 @@ public string AvailableStartTime /// [FhirElement("availableEndTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time AvailableEndTimeElement + public Hl7.Fhir.Model.Time? AvailableEndTimeElement { get { return _AvailableEndTimeElement; } set { _AvailableEndTimeElement = value; OnPropertyChanged("AvailableEndTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableEndTimeElement; + private Hl7.Fhir.Model.Time? _AvailableEndTimeElement; /// /// Closing time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableEndTime + public string? AvailableEndTime { - get { return AvailableEndTimeElement != null ? AvailableEndTimeElement.Value : null; } + get => _AvailableEndTimeElement?.Value; set { - if (value == null) - AvailableEndTimeElement = null; - else - AvailableEndTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableEndTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableEndTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AvailableTimeComponent; - - if (dest == null) - { + if(other is not AvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(AvailableStartTimeElement != null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)AvailableStartTimeElement.DeepCopyInternal(); - if(AvailableEndTimeElement != null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)AvailableEndTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_AvailableStartTimeElement is not null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)_AvailableStartTimeElement.DeepCopyInternal(); + if(_AvailableEndTimeElement is not null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)_AvailableEndTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -360,55 +343,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AvailableTimeComponent; - if(otherT == null) return false; + if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(AvailableStartTimeElement, otherT.AvailableStartTimeElement)) return false; - if(!comparer.Equals(AvailableEndTimeElement, otherT.AvailableEndTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; + if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "availableStartTime": - value = AvailableStartTimeElement; - return AvailableStartTimeElement is not null; + value = _AvailableStartTimeElement; + return _AvailableStartTimeElement is not null; case "availableEndTime": - value = AvailableEndTimeElement; - return AvailableEndTimeElement is not null; + value = _AvailableEndTimeElement; + return _AvailableEndTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableStartTime": - AvailableStartTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableStartTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "availableEndTime": - AvailableEndTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableEndTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -419,10 +402,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",AvailableStartTimeElement); - if (AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",AvailableEndTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",_AvailableStartTimeElement); + if (_AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",_AvailableEndTimeElement); } } @@ -449,28 +432,25 @@ public partial class NotAvailableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason presented to the user explaining why time not available /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -480,26 +460,22 @@ public string Description /// [FhirElement("during", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period During + public Hl7.Fhir.Model.Period? During { get { return _During; } set { _During = value; OnPropertyChanged("During"); } } - private Hl7.Fhir.Model.Period _During; + private Hl7.Fhir.Model.Period? _During; protected internal override void CopyToInternal(Base other) { - var dest = other as NotAvailableComponent; - - if (dest == null) - { + if(other is not NotAvailableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(During != null) dest.During = (Hl7.Fhir.Model.Period)During.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_During is not null) dest.During = (Hl7.Fhir.Model.Period)_During.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -511,41 +487,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotAvailableComponent; - if(otherT == null) return false; + if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(During, otherT.During)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_During, otherT._During)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "during": - value = During; - return During is not null; + value = _During; + return _During is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "during": - During = (Hl7.Fhir.Model.Period)value; + During = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -556,8 +532,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (During is not null) yield return new KeyValuePair("during",During); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_During is not null) yield return new KeyValuePair("during",_During); } } @@ -570,24 +546,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this HealthcareService record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this HealthcareService record is in active use @@ -596,13 +572,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -614,13 +587,13 @@ public bool? Active [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProvidedBy + public Hl7.Fhir.Model.ResourceReference? ProvidedBy { get { return _ProvidedBy; } set { _ProvidedBy = value; OnPropertyChanged("ProvidedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ProvidedBy; + private Hl7.Fhir.Model.ResourceReference? _ProvidedBy; /// /// Broad category of service being performed or delivered. @@ -631,11 +604,11 @@ public Hl7.Fhir.Model.ResourceReference ProvidedBy [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of service that may be delivered or performed. @@ -646,11 +619,11 @@ public List Category [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specialties handled by the HealthcareService. @@ -661,11 +634,11 @@ public List Type [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Location(s) where service may be provided. @@ -677,39 +650,36 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Description of service as presented to a consumer while searching. /// [FhirElement("name", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Description of service as presented to a consumer while searching /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -719,28 +689,25 @@ public string Name /// [FhirElement("comment", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional description and/or any specific issues not covered elsewhere /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -750,28 +717,25 @@ public string Comment /// [FhirElement("extraDetails", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown ExtraDetailsElement + public Hl7.Fhir.Model.Markdown? ExtraDetailsElement { get { return _ExtraDetailsElement; } set { _ExtraDetailsElement = value; OnPropertyChanged("ExtraDetailsElement"); } } - private Hl7.Fhir.Model.Markdown _ExtraDetailsElement; + private Hl7.Fhir.Model.Markdown? _ExtraDetailsElement; /// /// Extra details about the service that can't be placed in the other fields /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExtraDetails + public string? ExtraDetails { - get { return ExtraDetailsElement != null ? ExtraDetailsElement.Value : null; } + get => _ExtraDetailsElement?.Value; set { - if (value == null) - ExtraDetailsElement = null; - else - ExtraDetailsElement = new Hl7.Fhir.Model.Markdown(value); + ExtraDetailsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ExtraDetails"); } } @@ -781,13 +745,13 @@ public string ExtraDetails /// [FhirElement("photo", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Attachment Photo + public Hl7.Fhir.Model.Attachment? Photo { get { return _Photo; } set { _Photo = value; OnPropertyChanged("Photo"); } } - private Hl7.Fhir.Model.Attachment _Photo; + private Hl7.Fhir.Model.Attachment? _Photo; /// /// Contacts related to the healthcare service. @@ -797,11 +761,11 @@ public Hl7.Fhir.Model.Attachment Photo [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Location(s) service is intended for/available to. @@ -813,11 +777,11 @@ public List Telecom [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// Conditions under which service is available/offered. @@ -828,11 +792,11 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get { if(_ServiceProvisionCode==null) _ServiceProvisionCode = new List(); return _ServiceProvisionCode; } + get => _ServiceProvisionCode ?? new List(); set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } - private List _ServiceProvisionCode; + private List? _ServiceProvisionCode; /// /// Specific eligibility requirements required to use the service. @@ -842,11 +806,11 @@ public List ServiceProvisionCode [DataMember] public List Eligibility { - get { if(_Eligibility==null) _Eligibility = new List(); return _Eligibility; } + get => _Eligibility ?? new List(); set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } - private List _Eligibility; + private List? _Eligibility; /// /// Programs that this service is applicable to. @@ -857,11 +821,11 @@ public List Eligibility [DataMember] public List Program { - get { if(_Program==null) _Program = new List(); return _Program; } + get => _Program ?? new List(); set { _Program = value; OnPropertyChanged("Program"); } } - private List _Program; + private List? _Program; /// /// Collection of characteristics (attributes). @@ -872,11 +836,11 @@ public List Program [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// The language that this service is offered in. @@ -887,11 +851,11 @@ public List Characteristic [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Ways that the service accepts referrals. @@ -902,24 +866,24 @@ public List Communication [DataMember] public List ReferralMethod { - get { if(_ReferralMethod==null) _ReferralMethod = new List(); return _ReferralMethod; } + get => _ReferralMethod ?? new List(); set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } - private List _ReferralMethod; + private List? _ReferralMethod; /// /// If an appointment is required for access to this service. /// [FhirElement("appointmentRequired", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement + public Hl7.Fhir.Model.FhirBoolean? AppointmentRequiredElement { get { return _AppointmentRequiredElement; } set { _AppointmentRequiredElement = value; OnPropertyChanged("AppointmentRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AppointmentRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _AppointmentRequiredElement; /// /// If an appointment is required for access to this service @@ -928,13 +892,10 @@ public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement [IgnoreDataMember] public bool? AppointmentRequired { - get { return AppointmentRequiredElement != null ? AppointmentRequiredElement.Value : null; } + get => _AppointmentRequiredElement?.Value; set { - if (value == null) - AppointmentRequiredElement = null; - else - AppointmentRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + AppointmentRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AppointmentRequired"); } } @@ -947,11 +908,11 @@ public bool? AppointmentRequired [DataMember] public List AvailableTime { - get { if(_AvailableTime==null) _AvailableTime = new List(); return _AvailableTime; } + get => _AvailableTime ?? new List(); set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } - private List _AvailableTime; + private List? _AvailableTime; /// /// Not available during this time due to provided reason. @@ -961,39 +922,36 @@ public List AvailableTi [DataMember] public List NotAvailable { - get { if(_NotAvailable==null) _NotAvailable = new List(); return _NotAvailable; } + get => _NotAvailable ?? new List(); set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } - private List _NotAvailable; + private List? _NotAvailable; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=310)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -1008,51 +966,47 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as HealthcareService; - - if (dest == null) - { + if(other is not HealthcareService dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ProvidedBy != null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)ProvidedBy.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(ExtraDetailsElement != null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)ExtraDetailsElement.DeepCopyInternal(); - if(Photo != null) dest.Photo = (Hl7.Fhir.Model.Attachment)Photo.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(ServiceProvisionCode.Any()) dest.ServiceProvisionCode = new List(ServiceProvisionCode.DeepCopyInternal()); - if(Eligibility.Any()) dest.Eligibility = new List(Eligibility.DeepCopyInternal()); - if(Program.Any()) dest.Program = new List(Program.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(ReferralMethod.Any()) dest.ReferralMethod = new List(ReferralMethod.DeepCopyInternal()); - if(AppointmentRequiredElement != null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)AppointmentRequiredElement.DeepCopyInternal(); - if(AvailableTime.Any()) dest.AvailableTime = new List(AvailableTime.DeepCopyInternal()); - if(NotAvailable.Any()) dest.NotAvailable = new List(NotAvailable.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ProvidedBy is not null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)_ProvidedBy.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_ExtraDetailsElement is not null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)_ExtraDetailsElement.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = (Hl7.Fhir.Model.Attachment)_Photo.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_ServiceProvisionCode is not null) dest.ServiceProvisionCode = new List(_ServiceProvisionCode.DeepCopyInternal()); + if(_Eligibility is not null) dest.Eligibility = new List(_Eligibility.DeepCopyInternal()); + if(_Program is not null) dest.Program = new List(_Program.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_ReferralMethod is not null) dest.ReferralMethod = new List(_ReferralMethod.DeepCopyInternal()); + if(_AppointmentRequiredElement is not null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_AppointmentRequiredElement.DeepCopyInternal(); + if(_AvailableTime is not null) dest.AvailableTime = new List(_AvailableTime.DeepCopyInternal()); + if(_NotAvailable is not null) dest.NotAvailable = new List(_NotAvailable.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1064,195 +1018,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HealthcareService; - if(otherT == null) return false; + if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(ProvidedBy, otherT.ProvidedBy)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(ExtraDetailsElement, otherT.ExtraDetailsElement)) return false; - if(!comparer.Equals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(ServiceProvisionCode, otherT.ServiceProvisionCode)) return false; - if(!comparer.ListEquals(Eligibility, otherT.Eligibility)) return false; - if(!comparer.ListEquals(Program, otherT.Program)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(ReferralMethod, otherT.ReferralMethod)) return false; - if(!comparer.Equals(AppointmentRequiredElement, otherT.AppointmentRequiredElement)) return false; - if(!comparer.ListEquals(AvailableTime, otherT.AvailableTime)) return false; - if(!comparer.ListEquals(NotAvailable, otherT.NotAvailable)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_ExtraDetailsElement, otherT._ExtraDetailsElement)) return false; + if(!comparer.Equals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_ServiceProvisionCode, otherT._ServiceProvisionCode)) return false; + if(!comparer.ListEquals(_Eligibility, otherT._Eligibility)) return false; + if(!comparer.ListEquals(_Program, otherT._Program)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_ReferralMethod, otherT._ReferralMethod)) return false; + if(!comparer.Equals(_AppointmentRequiredElement, otherT._AppointmentRequiredElement)) return false; + if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "providedBy": - value = ProvidedBy; - return ProvidedBy is not null; + value = _ProvidedBy; + return _ProvidedBy is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "extraDetails": - value = ExtraDetailsElement; - return ExtraDetailsElement is not null; + value = _ExtraDetailsElement; + return _ExtraDetailsElement is not null; case "photo": - value = Photo; - return Photo is not null; + value = _Photo; + return _Photo is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "serviceProvisionCode": - value = ServiceProvisionCode; - return ServiceProvisionCode?.Any() == true; + value = _ServiceProvisionCode; + return _ServiceProvisionCode?.Any() == true; case "eligibility": - value = Eligibility; - return Eligibility?.Any() == true; + value = _Eligibility; + return _Eligibility?.Any() == true; case "program": - value = Program; - return Program?.Any() == true; + value = _Program; + return _Program?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "referralMethod": - value = ReferralMethod; - return ReferralMethod?.Any() == true; + value = _ReferralMethod; + return _ReferralMethod?.Any() == true; case "appointmentRequired": - value = AppointmentRequiredElement; - return AppointmentRequiredElement is not null; + value = _AppointmentRequiredElement; + return _AppointmentRequiredElement is not null; case "availableTime": - value = AvailableTime; - return AvailableTime?.Any() == true; + value = _AvailableTime; + return _AvailableTime?.Any() == true; case "notAvailable": - value = NotAvailable; - return NotAvailable?.Any() == true; + value = _NotAvailable; + return _NotAvailable?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "providedBy": - ProvidedBy = (Hl7.Fhir.Model.ResourceReference)value; + ProvidedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "extraDetails": - ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)value; + ExtraDetailsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "photo": - Photo = (Hl7.Fhir.Model.Attachment)value; + Photo = (Hl7.Fhir.Model.Attachment?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "serviceProvisionCode": - ServiceProvisionCode = (List)value; + ServiceProvisionCode = (List?)value!; return this; case "eligibility": - Eligibility = (List)value; + Eligibility = (List?)value!; return this; case "program": - Program = (List)value; + Program = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "referralMethod": - ReferralMethod = (List)value; + ReferralMethod = (List?)value!; return this; case "appointmentRequired": - AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableTime": - AvailableTime = (List)value; + AvailableTime = (List?)value!; return this; case "notAvailable": - NotAvailable = (List)value; + NotAvailable = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1263,30 +1217,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ProvidedBy is not null) yield return new KeyValuePair("providedBy",ProvidedBy); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",ExtraDetailsElement); - if (Photo is not null) yield return new KeyValuePair("photo",Photo); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",ServiceProvisionCode); - if (Eligibility?.Any() == true) yield return new KeyValuePair("eligibility",Eligibility); - if (Program?.Any() == true) yield return new KeyValuePair("program",Program); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",ReferralMethod); - if (AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",AppointmentRequiredElement); - if (AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",AvailableTime); - if (NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",NotAvailable); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ProvidedBy is not null) yield return new KeyValuePair("providedBy",_ProvidedBy); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",_ExtraDetailsElement); + if (_Photo is not null) yield return new KeyValuePair("photo",_Photo); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",_ServiceProvisionCode); + if (_Eligibility?.Any() == true) yield return new KeyValuePair("eligibility",_Eligibility); + if (_Program?.Any() == true) yield return new KeyValuePair("program",_Program); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",_ReferralMethod); + if (_AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",_AppointmentRequiredElement); + if (_AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",_AvailableTime); + if (_NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",_NotAvailable); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs index 3d7bebaa1..f3f15cc66 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -119,13 +122,13 @@ public enum NameUse [DeclaredType(Type = typeof(Code))] [Binding("NameUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// usual | official | temp | nickname | anonymous | old | maiden @@ -134,13 +137,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.HumanName.NameUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -150,28 +150,25 @@ public Hl7.Fhir.Model.HumanName.NameUse? Use /// [FhirElement("text", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the full name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -181,28 +178,25 @@ public string Text /// [FhirElement("family", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString FamilyElement + public Hl7.Fhir.Model.FhirString? FamilyElement { get { return _FamilyElement; } set { _FamilyElement = value; OnPropertyChanged("FamilyElement"); } } - private Hl7.Fhir.Model.FhirString _FamilyElement; + private Hl7.Fhir.Model.FhirString? _FamilyElement; /// /// Family name (often called 'Surname') /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Family + public string? Family { - get { return FamilyElement != null ? FamilyElement.Value : null; } + get => _FamilyElement?.Value; set { - if (value == null) - FamilyElement = null; - else - FamilyElement = new Hl7.Fhir.Model.FhirString(value); + FamilyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Family"); } } @@ -215,24 +209,24 @@ public string Family [DataMember] public List GivenElement { - get { if(_GivenElement==null) _GivenElement = new List(); return _GivenElement; } + get => _GivenElement ?? new List(); set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } - private List _GivenElement; + private List? _GivenElement; /// /// Given names (not always 'first'). Includes middle names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Given + public IEnumerable? Given { - get { return GivenElement != null ? GivenElement.Select(elem => elem.Value) : null; } + get => _GivenElement?.Select(elem => elem.Value); set { if (value == null) - GivenElement = null; + GivenElement = null!; else GivenElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Given"); @@ -247,24 +241,24 @@ public IEnumerable Given [DataMember] public List PrefixElement { - get { if(_PrefixElement==null) _PrefixElement = new List(); return _PrefixElement; } + get => _PrefixElement ?? new List(); set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private List _PrefixElement; + private List? _PrefixElement; /// /// Parts that come before the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Prefix + public IEnumerable? Prefix { - get { return PrefixElement != null ? PrefixElement.Select(elem => elem.Value) : null; } + get => _PrefixElement?.Select(elem => elem.Value); set { if (value == null) - PrefixElement = null; + PrefixElement = null!; else PrefixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Prefix"); @@ -279,24 +273,24 @@ public IEnumerable Prefix [DataMember] public List SuffixElement { - get { if(_SuffixElement==null) _SuffixElement = new List(); return _SuffixElement; } + get => _SuffixElement ?? new List(); set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } - private List _SuffixElement; + private List? _SuffixElement; /// /// Parts that come after the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Suffix + public IEnumerable? Suffix { - get { return SuffixElement != null ? SuffixElement.Select(elem => elem.Value) : null; } + get => _SuffixElement?.Select(elem => elem.Value); set { if (value == null) - SuffixElement = null; + SuffixElement = null!; else SuffixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Suffix"); @@ -308,31 +302,27 @@ public IEnumerable Suffix /// [FhirElement("period", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as HumanName; - - if (dest == null) - { + if(other is not HumanName dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(FamilyElement != null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)FamilyElement.DeepCopyInternal(); - if(GivenElement.Any()) dest.GivenElement = new List(GivenElement.DeepCopyInternal()); - if(PrefixElement.Any()) dest.PrefixElement = new List(PrefixElement.DeepCopyInternal()); - if(SuffixElement.Any()) dest.SuffixElement = new List(SuffixElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_FamilyElement is not null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)_FamilyElement.DeepCopyInternal(); + if(_GivenElement is not null) dest.GivenElement = new List(_GivenElement.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = new List(_PrefixElement.DeepCopyInternal()); + if(_SuffixElement is not null) dest.SuffixElement = new List(_SuffixElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -344,76 +334,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HumanName; - if(otherT == null) return false; + if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(FamilyElement, otherT.FamilyElement)) return false; - if(!comparer.ListEquals(GivenElement, otherT.GivenElement)) return false; - if(!comparer.ListEquals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.ListEquals(SuffixElement, otherT.SuffixElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; + if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; + if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "family": - value = FamilyElement; - return FamilyElement is not null; + value = _FamilyElement; + return _FamilyElement is not null; case "given": - value = GivenElement; - return GivenElement?.Any() == true; + value = _GivenElement; + return _GivenElement?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement?.Any() == true; + value = _PrefixElement; + return _PrefixElement?.Any() == true; case "suffix": - value = SuffixElement; - return SuffixElement?.Any() == true; + value = _SuffixElement; + return _SuffixElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "family": - FamilyElement = (Hl7.Fhir.Model.FhirString)value; + FamilyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "given": - GivenElement = (List)value; + GivenElement = (List?)value!; return this; case "prefix": - PrefixElement = (List)value; + PrefixElement = (List?)value!; return this; case "suffix": - SuffixElement = (List)value; + SuffixElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -424,13 +414,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (FamilyElement is not null) yield return new KeyValuePair("family",FamilyElement); - if (GivenElement?.Any() == true) yield return new KeyValuePair("given",GivenElement); - if (PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",PrefixElement); - if (SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",SuffixElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_FamilyElement is not null) yield return new KeyValuePair("family",_FamilyElement); + if (_GivenElement?.Any() == true) yield return new KeyValuePair("given",_GivenElement); + if (_PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",_PrefixElement); + if (_SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",_SuffixElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs index d8c0f487e..23c9c8a93 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,28 +124,25 @@ public partial class SeriesComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id UidElement + public Hl7.Fhir.Model.Id? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Id _UidElement; + private Hl7.Fhir.Model.Id? _UidElement; /// /// DICOM Series Instance UID for the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Id(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Uid"); } } @@ -152,13 +152,13 @@ public string Uid /// [FhirElement("number", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// Numeric identifier of this series @@ -167,13 +167,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -185,41 +182,38 @@ public int? Number [Binding("ImagingModality")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Modality + public Hl7.Fhir.Model.Coding? Modality { get { return _Modality; } set { _Modality = value; OnPropertyChanged("Modality"); } } - private Hl7.Fhir.Model.Coding _Modality; + private Hl7.Fhir.Model.Coding? _Modality; /// /// A short human readable summary of the series. /// [FhirElement("description", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// A short human readable summary of the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -229,13 +223,13 @@ public string Description /// [FhirElement("numberOfInstances", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Series Related Instances @@ -244,13 +238,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -265,11 +256,11 @@ public int? NumberOfInstances [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Body part examined. @@ -277,13 +268,13 @@ public List Endpoint [FhirElement("bodySite", InSummary=true, Order=100)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.Coding BodySite + public Hl7.Fhir.Model.Coding? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.Coding _BodySite; + private Hl7.Fhir.Model.Coding? _BodySite; /// /// Body part laterality. @@ -291,13 +282,13 @@ public Hl7.Fhir.Model.Coding BodySite [FhirElement("laterality", InSummary=true, Order=110)] [Binding("Laterality")] [DataMember] - public Hl7.Fhir.Model.Coding Laterality + public Hl7.Fhir.Model.Coding? Laterality { get { return _Laterality; } set { _Laterality = value; OnPropertyChanged("Laterality"); } } - private Hl7.Fhir.Model.Coding _Laterality; + private Hl7.Fhir.Model.Coding? _Laterality; /// /// Specimen imaged. @@ -309,39 +300,36 @@ public Hl7.Fhir.Model.Coding Laterality [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// When the series started. /// [FhirElement("started", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the series started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -354,11 +342,11 @@ public string Started [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// A single SOP instance from the series. @@ -368,34 +356,30 @@ public List Performer [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; protected internal override void CopyToInternal(Base other) { - var dest = other as SeriesComponent; - - if (dest == null) - { + if(other is not SeriesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Id)UidElement.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(Modality != null) dest.Modality = (Hl7.Fhir.Model.Coding)Modality.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.Coding)BodySite.DeepCopyInternal(); - if(Laterality != null) dest.Laterality = (Hl7.Fhir.Model.Coding)Laterality.DeepCopyInternal(); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Id)_UidElement.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = (Hl7.Fhir.Model.Coding)_Modality.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.Coding)_BodySite.DeepCopyInternal(); + if(_Laterality is not null) dest.Laterality = (Hl7.Fhir.Model.Coding)_Laterality.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -407,111 +391,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SeriesComponent; - if(otherT == null) return false; + if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Laterality, otherT.Laterality)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Laterality, otherT._Laterality)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "modality": - value = Modality; - return Modality is not null; + value = _Modality; + return _Modality is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "laterality": - value = Laterality; - return Laterality is not null; + value = _Laterality; + return _Laterality is not null; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Id)value; + UidElement = (Hl7.Fhir.Model.Id?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "modality": - Modality = (Hl7.Fhir.Model.Coding)value; + Modality = (Hl7.Fhir.Model.Coding?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.Coding)value; + BodySite = (Hl7.Fhir.Model.Coding?)value; return this; case "laterality": - Laterality = (Hl7.Fhir.Model.Coding)value; + Laterality = (Hl7.Fhir.Model.Coding?)value; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -522,18 +506,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Modality is not null) yield return new KeyValuePair("modality",Modality); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Laterality is not null) yield return new KeyValuePair("laterality",Laterality); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Modality is not null) yield return new KeyValuePair("modality",_Modality); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Laterality is not null) yield return new KeyValuePair("laterality",_Laterality); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); } } @@ -561,13 +545,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("EventPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the series. @@ -577,26 +561,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -608,41 +588,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -653,8 +633,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -681,28 +661,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id UidElement + public Hl7.Fhir.Model.Id? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Id _UidElement; + private Hl7.Fhir.Model.Id? _UidElement; /// /// DICOM SOP Instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Id(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Uid"); } } @@ -714,26 +691,26 @@ public string Uid [Binding("sopClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding SopClass + public Hl7.Fhir.Model.Coding? SopClass { get { return _SopClass; } set { _SopClass = value; OnPropertyChanged("SopClass"); } } - private Hl7.Fhir.Model.Coding _SopClass; + private Hl7.Fhir.Model.Coding? _SopClass; /// /// The number of this instance in the series. /// [FhirElement("number", Order=60)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// The number of this instance in the series @@ -742,13 +719,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -758,46 +732,39 @@ public int? Number /// [FhirElement("title", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Description of instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Id)UidElement.DeepCopyInternal(); - if(SopClass != null) dest.SopClass = (Hl7.Fhir.Model.Coding)SopClass.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Id)_UidElement.DeepCopyInternal(); + if(_SopClass is not null) dest.SopClass = (Hl7.Fhir.Model.Coding)_SopClass.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -809,55 +776,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(SopClass, otherT.SopClass)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "sopClass": - value = SopClass; - return SopClass is not null; + value = _SopClass; + return _SopClass is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Id)value; + UidElement = (Hl7.Fhir.Model.Id?)value; return this; case "sopClass": - SopClass = (Hl7.Fhir.Model.Coding)value; + SopClass = (Hl7.Fhir.Model.Coding?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -868,10 +835,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (SopClass is not null) yield return new KeyValuePair("sopClass",SopClass); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_SopClass is not null) yield return new KeyValuePair("sopClass",_SopClass); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); } } @@ -884,11 +851,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// registered | available | cancelled | entered-in-error | unknown. @@ -898,13 +865,13 @@ public List Identifier [Binding("ImagingStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | available | cancelled | entered-in-error | unknown @@ -913,13 +880,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -933,11 +897,11 @@ public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status [DataMember] public List Modality { - get { if(_Modality==null) _Modality = new List(); return _Modality; } + get => _Modality ?? new List(); set { _Modality = value; OnPropertyChanged("Modality"); } } - private List _Modality; + private List? _Modality; /// /// Who or what is the subject of the study. @@ -947,13 +911,13 @@ public List Modality [References("Patient","Device","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter with which this imaging study is associated. @@ -962,41 +926,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the study was started. /// [FhirElement("started", InSummary=true, Order=140, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the study was started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -1011,11 +972,11 @@ public string Started [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Referring physician. @@ -1024,13 +985,13 @@ public List BasedOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referrer + public Hl7.Fhir.Model.ResourceReference? Referrer { get { return _Referrer; } set { _Referrer = value; OnPropertyChanged("Referrer"); } } - private Hl7.Fhir.Model.ResourceReference _Referrer; + private Hl7.Fhir.Model.ResourceReference? _Referrer; /// /// Who interpreted images. @@ -1042,11 +1003,11 @@ public Hl7.Fhir.Model.ResourceReference Referrer [DataMember] public List Interpreter { - get { if(_Interpreter==null) _Interpreter = new List(); return _Interpreter; } + get => _Interpreter ?? new List(); set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } - private List _Interpreter; + private List? _Interpreter; /// /// Study access endpoint. @@ -1058,24 +1019,24 @@ public List Interpreter [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Number of Study Related Series. /// [FhirElement("numberOfSeries", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfSeriesElement { get { return _NumberOfSeriesElement; } set { _NumberOfSeriesElement = value; OnPropertyChanged("NumberOfSeriesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfSeriesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfSeriesElement; /// /// Number of Study Related Series @@ -1084,13 +1045,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement [IgnoreDataMember] public int? NumberOfSeries { - get { return NumberOfSeriesElement != null ? NumberOfSeriesElement.Value : null; } + get => _NumberOfSeriesElement?.Value; set { - if (value == null) - NumberOfSeriesElement = null; - else - NumberOfSeriesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfSeriesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfSeries"); } } @@ -1100,13 +1058,13 @@ public int? NumberOfSeries /// [FhirElement("numberOfInstances", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Study Related Instances @@ -1115,13 +1073,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -1133,13 +1088,13 @@ public int? NumberOfInstances [CLSCompliant(false)] [References("Procedure")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProcedureReference + public Hl7.Fhir.Model.ResourceReference? ProcedureReference { get { return _ProcedureReference; } set { _ProcedureReference = value; OnPropertyChanged("ProcedureReference"); } } - private Hl7.Fhir.Model.ResourceReference _ProcedureReference; + private Hl7.Fhir.Model.ResourceReference? _ProcedureReference; /// /// The performed procedure code. @@ -1150,11 +1105,11 @@ public Hl7.Fhir.Model.ResourceReference ProcedureReference [DataMember] public List ProcedureCode { - get { if(_ProcedureCode==null) _ProcedureCode = new List(); return _ProcedureCode; } + get => _ProcedureCode ?? new List(); set { _ProcedureCode = value; OnPropertyChanged("ProcedureCode"); } } - private List _ProcedureCode; + private List? _ProcedureCode; /// /// Where ImagingStudy occurred. @@ -1163,13 +1118,13 @@ public List ProcedureCode [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Why the study was requested. @@ -1180,11 +1135,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was study performed. @@ -1196,11 +1151,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// User-defined comments. @@ -1210,39 +1165,36 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Institution-generated description. /// [FhirElement("description", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Institution-generated description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1255,44 +1207,40 @@ public string Description [DataMember] public List Series { - get { if(_Series==null) _Series = new List(); return _Series; } + get => _Series ?? new List(); set { _Series = value; OnPropertyChanged("Series"); } } - private List _Series; + private List? _Series; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImagingStudy; - - if (dest == null) - { + if(other is not ImagingStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Modality.Any()) dest.Modality = new List(Modality.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Referrer != null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)Referrer.DeepCopyInternal(); - if(Interpreter.Any()) dest.Interpreter = new List(Interpreter.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(NumberOfSeriesElement != null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfSeriesElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(ProcedureReference != null) dest.ProcedureReference = (Hl7.Fhir.Model.ResourceReference)ProcedureReference.DeepCopyInternal(); - if(ProcedureCode.Any()) dest.ProcedureCode = new List(ProcedureCode.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Series.Any()) dest.Series = new List(Series.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = new List(_Modality.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Referrer is not null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)_Referrer.DeepCopyInternal(); + if(_Interpreter is not null) dest.Interpreter = new List(_Interpreter.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_NumberOfSeriesElement is not null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfSeriesElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_ProcedureReference is not null) dest.ProcedureReference = (Hl7.Fhir.Model.ResourceReference)_ProcedureReference.DeepCopyInternal(); + if(_ProcedureCode is not null) dest.ProcedureCode = new List(_ProcedureCode.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Series is not null) dest.Series = new List(_Series.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1304,167 +1252,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImagingStudy; - if(otherT == null) return false; + if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Referrer, otherT.Referrer)) return false; - if(!comparer.ListEquals(Interpreter, otherT.Interpreter)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(NumberOfSeriesElement, otherT.NumberOfSeriesElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.Equals(ProcedureReference, otherT.ProcedureReference)) return false; - if(!comparer.ListEquals(ProcedureCode, otherT.ProcedureCode)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Series, otherT.Series)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Referrer, otherT._Referrer)) return false; + if(!comparer.ListEquals(_Interpreter, otherT._Interpreter)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_NumberOfSeriesElement, otherT._NumberOfSeriesElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.Equals(_ProcedureReference, otherT._ProcedureReference)) return false; + if(!comparer.ListEquals(_ProcedureCode, otherT._ProcedureCode)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Series, otherT._Series)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "modality": - value = Modality; - return Modality?.Any() == true; + value = _Modality; + return _Modality?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "referrer": - value = Referrer; - return Referrer is not null; + value = _Referrer; + return _Referrer is not null; case "interpreter": - value = Interpreter; - return Interpreter?.Any() == true; + value = _Interpreter; + return _Interpreter?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "numberOfSeries": - value = NumberOfSeriesElement; - return NumberOfSeriesElement is not null; + value = _NumberOfSeriesElement; + return _NumberOfSeriesElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "procedureReference": - value = ProcedureReference; - return ProcedureReference is not null; + value = _ProcedureReference; + return _ProcedureReference is not null; case "procedureCode": - value = ProcedureCode; - return ProcedureCode?.Any() == true; + value = _ProcedureCode; + return _ProcedureCode?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = Series; - return Series?.Any() == true; + value = _Series; + return _Series?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "modality": - Modality = (List)value; + Modality = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "referrer": - Referrer = (Hl7.Fhir.Model.ResourceReference)value; + Referrer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "interpreter": - Interpreter = (List)value; + Interpreter = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "numberOfSeries": - NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "procedureReference": - ProcedureReference = (Hl7.Fhir.Model.ResourceReference)value; + ProcedureReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "procedureCode": - ProcedureCode = (List)value; + ProcedureCode = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - Series = (List)value; + Series = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1475,26 +1423,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Modality?.Any() == true) yield return new KeyValuePair("modality",Modality); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Referrer is not null) yield return new KeyValuePair("referrer",Referrer); - if (Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",Interpreter); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",NumberOfSeriesElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (ProcedureReference is not null) yield return new KeyValuePair("procedureReference",ProcedureReference); - if (ProcedureCode?.Any() == true) yield return new KeyValuePair("procedureCode",ProcedureCode); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Series?.Any() == true) yield return new KeyValuePair("series",Series); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Modality?.Any() == true) yield return new KeyValuePair("modality",_Modality); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Referrer is not null) yield return new KeyValuePair("referrer",_Referrer); + if (_Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",_Interpreter); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",_NumberOfSeriesElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_ProcedureReference is not null) yield return new KeyValuePair("procedureReference",_ProcedureReference); + if (_ProcedureCode?.Any() == true) yield return new KeyValuePair("procedureCode",_ProcedureCode); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Series?.Any() == true) yield return new KeyValuePair("series",_Series); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs index 8aedff538..78b6cdce3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Immunization","http://hl7.org/fhir/StructureDefinition/Immunization")] - public partial class Immunization : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Immunization : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -109,13 +112,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("ImmunizationFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual or organization who was performing. @@ -125,26 +128,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -156,41 +155,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -201,8 +200,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -228,28 +227,25 @@ public partial class EducationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("documentType", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentTypeElement + public Hl7.Fhir.Model.FhirString? DocumentTypeElement { get { return _DocumentTypeElement; } set { _DocumentTypeElement = value; OnPropertyChanged("DocumentTypeElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentTypeElement; + private Hl7.Fhir.Model.FhirString? _DocumentTypeElement; /// /// Educational material document identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DocumentType + public string? DocumentType { - get { return DocumentTypeElement != null ? DocumentTypeElement.Value : null; } + get => _DocumentTypeElement?.Value; set { - if (value == null) - DocumentTypeElement = null; - else - DocumentTypeElement = new Hl7.Fhir.Model.FhirString(value); + DocumentTypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DocumentType"); } } @@ -259,28 +255,25 @@ public string DocumentType /// [FhirElement("reference", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Educational material reference pointer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } @@ -290,28 +283,25 @@ public string Reference /// [FhirElement("publicationDate", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PublicationDateElement + public Hl7.Fhir.Model.FhirDateTime? PublicationDateElement { get { return _PublicationDateElement; } set { _PublicationDateElement = value; OnPropertyChanged("PublicationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PublicationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PublicationDateElement; /// /// Educational material publication date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDate + public string? PublicationDate { - get { return PublicationDateElement != null ? PublicationDateElement.Value : null; } + get => _PublicationDateElement?.Value; set { - if (value == null) - PublicationDateElement = null; - else - PublicationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PublicationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PublicationDate"); } } @@ -321,46 +311,39 @@ public string PublicationDate /// [FhirElement("presentationDate", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PresentationDateElement + public Hl7.Fhir.Model.FhirDateTime? PresentationDateElement { get { return _PresentationDateElement; } set { _PresentationDateElement = value; OnPropertyChanged("PresentationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PresentationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PresentationDateElement; /// /// Educational material presentation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PresentationDate + public string? PresentationDate { - get { return PresentationDateElement != null ? PresentationDateElement.Value : null; } + get => _PresentationDateElement?.Value; set { - if (value == null) - PresentationDateElement = null; - else - PresentationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PresentationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PresentationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EducationComponent; - - if (dest == null) - { + if(other is not EducationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DocumentTypeElement != null) dest.DocumentTypeElement = (Hl7.Fhir.Model.FhirString)DocumentTypeElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); - if(PublicationDateElement != null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)PublicationDateElement.DeepCopyInternal(); - if(PresentationDateElement != null) dest.PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime)PresentationDateElement.DeepCopyInternal(); + if(_DocumentTypeElement is not null) dest.DocumentTypeElement = (Hl7.Fhir.Model.FhirString)_DocumentTypeElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); + if(_PublicationDateElement is not null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)_PublicationDateElement.DeepCopyInternal(); + if(_PresentationDateElement is not null) dest.PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime)_PresentationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -372,55 +355,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EducationComponent; - if(otherT == null) return false; + if(other is not EducationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DocumentTypeElement, otherT.DocumentTypeElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.Equals(PublicationDateElement, otherT.PublicationDateElement)) return false; - if(!comparer.Equals(PresentationDateElement, otherT.PresentationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DocumentTypeElement, otherT._DocumentTypeElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; + if(!comparer.Equals(_PresentationDateElement, otherT._PresentationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "documentType": - value = DocumentTypeElement; - return DocumentTypeElement is not null; + value = _DocumentTypeElement; + return _DocumentTypeElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "publicationDate": - value = PublicationDateElement; - return PublicationDateElement is not null; + value = _PublicationDateElement; + return _PublicationDateElement is not null; case "presentationDate": - value = PresentationDateElement; - return PresentationDateElement is not null; + value = _PresentationDateElement; + return _PresentationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "documentType": - DocumentTypeElement = (Hl7.Fhir.Model.FhirString)value; + DocumentTypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "publicationDate": - PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "presentationDate": - PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -431,10 +414,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DocumentTypeElement is not null) yield return new KeyValuePair("documentType",DocumentTypeElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",PublicationDateElement); - if (PresentationDateElement is not null) yield return new KeyValuePair("presentationDate",PresentationDateElement); + if (_DocumentTypeElement is not null) yield return new KeyValuePair("documentType",_DocumentTypeElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",_PublicationDateElement); + if (_PresentationDateElement is not null) yield return new KeyValuePair("presentationDate",_PresentationDateElement); } } @@ -461,28 +444,25 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When reaction started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -494,26 +474,26 @@ public string Date [CLSCompliant(false)] [References("Observation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Detail + public Hl7.Fhir.Model.ResourceReference? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.ResourceReference _Detail; + private Hl7.Fhir.Model.ResourceReference? _Detail; /// /// Indicates self-reported reaction. /// [FhirElement("reported", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReportedElement + public Hl7.Fhir.Model.FhirBoolean? ReportedElement { get { return _ReportedElement; } set { _ReportedElement = value; OnPropertyChanged("ReportedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReportedElement; + private Hl7.Fhir.Model.FhirBoolean? _ReportedElement; /// /// Indicates self-reported reaction @@ -522,30 +502,23 @@ public Hl7.Fhir.Model.FhirBoolean ReportedElement [IgnoreDataMember] public bool? Reported { - get { return ReportedElement != null ? ReportedElement.Value : null; } + get => _ReportedElement?.Value; set { - if (value == null) - ReportedElement = null; - else - ReportedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReportedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Reported"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.ResourceReference)Detail.DeepCopyInternal(); - if(ReportedElement != null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)ReportedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.ResourceReference)_Detail.DeepCopyInternal(); + if(_ReportedElement is not null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)_ReportedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -557,48 +530,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(ReportedElement, otherT.ReportedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "reported": - value = ReportedElement; - return ReportedElement is not null; + value = _ReportedElement; + return _ReportedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.ResourceReference)value; + Detail = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reported": - ReportedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReportedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -609,9 +582,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (ReportedElement is not null) yield return new KeyValuePair("reported",ReportedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_ReportedElement is not null) yield return new KeyValuePair("reported",_ReportedElement); } } @@ -637,28 +610,25 @@ public partial class ProtocolAppliedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("series", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccine series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -670,13 +640,13 @@ public string Series [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Vaccine preventatable disease being targetted. @@ -687,11 +657,11 @@ public Hl7.Fhir.Model.ResourceReference Authority [DataMember] public List TargetDisease { - get { if(_TargetDisease==null) _TargetDisease = new List(); return _TargetDisease; } + get => _TargetDisease ?? new List(); set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private List _TargetDisease; + private List? _TargetDisease; /// /// Dose number within series. @@ -701,13 +671,13 @@ public List TargetDisease [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType DoseNumber + public Hl7.Fhir.Model.DataType? DoseNumber { get { return _DoseNumber; } set { _DoseNumber = value; OnPropertyChanged("DoseNumber"); } } - private Hl7.Fhir.Model.DataType _DoseNumber; + private Hl7.Fhir.Model.DataType? _DoseNumber; /// /// Recommended number of doses for immunity. @@ -716,29 +686,25 @@ public Hl7.Fhir.Model.DataType DoseNumber [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType SeriesDoses + public Hl7.Fhir.Model.DataType? SeriesDoses { get { return _SeriesDoses; } set { _SeriesDoses = value; OnPropertyChanged("SeriesDoses"); } } - private Hl7.Fhir.Model.DataType _SeriesDoses; + private Hl7.Fhir.Model.DataType? _SeriesDoses; protected internal override void CopyToInternal(Base other) { - var dest = other as ProtocolAppliedComponent; - - if (dest == null) - { + if(other is not ProtocolAppliedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(TargetDisease.Any()) dest.TargetDisease = new List(TargetDisease.DeepCopyInternal()); - if(DoseNumber != null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)DoseNumber.DeepCopyInternal(); - if(SeriesDoses != null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)SeriesDoses.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = new List(_TargetDisease.DeepCopyInternal()); + if(_DoseNumber is not null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)_DoseNumber.DeepCopyInternal(); + if(_SeriesDoses is not null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)_SeriesDoses.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -750,62 +716,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProtocolAppliedComponent; - if(otherT == null) return false; + if(other is not ProtocolAppliedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(DoseNumber, otherT.DoseNumber)) return false; - if(!comparer.Equals(SeriesDoses, otherT.SeriesDoses)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; + if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease?.Any() == true; + value = _TargetDisease; + return _TargetDisease?.Any() == true; case "doseNumber": - value = DoseNumber; - return DoseNumber is not null; + value = _DoseNumber; + return _DoseNumber is not null; case "seriesDoses": - value = SeriesDoses; - return SeriesDoses is not null; + value = _SeriesDoses; + return _SeriesDoses is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "targetDisease": - TargetDisease = (List)value; + TargetDisease = (List?)value!; return this; case "doseNumber": - DoseNumber = (Hl7.Fhir.Model.DataType)value; + DoseNumber = (Hl7.Fhir.Model.DataType?)value; return this; case "seriesDoses": - SeriesDoses = (Hl7.Fhir.Model.DataType)value; + SeriesDoses = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -816,11 +782,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",TargetDisease); - if (DoseNumber is not null) yield return new KeyValuePair("doseNumber",DoseNumber); - if (SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",SeriesDoses); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_DoseNumber is not null) yield return new KeyValuePair("doseNumber",_DoseNumber); + if (_SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",_SeriesDoses); } } @@ -833,11 +799,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// completed | entered-in-error | not-done. @@ -847,13 +813,13 @@ public List Identifier [Binding("ImmunizationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | entered-in-error | not-done @@ -862,13 +828,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -879,13 +842,13 @@ public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status [FhirElement("statusReason", Order=110)] [Binding("ImmunizationStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Vaccine product administered. @@ -894,13 +857,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [Binding("VaccineCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VaccineCode + public Hl7.Fhir.Model.CodeableConcept? VaccineCode { get { return _VaccineCode; } set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private Hl7.Fhir.Model.CodeableConcept _VaccineCode; + private Hl7.Fhir.Model.CodeableConcept? _VaccineCode; /// /// Who was immunized. @@ -910,13 +873,13 @@ public Hl7.Fhir.Model.CodeableConcept VaccineCode [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter immunization was part of. @@ -925,13 +888,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Vaccine administration date. @@ -941,41 +904,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirString))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the immunization was first captured in the subject's record. /// [FhirElement("recorded", Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedElement + public Hl7.Fhir.Model.FhirDateTime? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedElement; /// /// When the immunization was first captured in the subject's record /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Recorded + public string? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Recorded"); } } @@ -985,13 +945,13 @@ public string Recorded /// [FhirElement("primarySource", InSummary=true, Order=170, FiveWs="FiveWs.source")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement + public Hl7.Fhir.Model.FhirBoolean? PrimarySourceElement { get { return _PrimarySourceElement; } set { _PrimarySourceElement = value; OnPropertyChanged("PrimarySourceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PrimarySourceElement; + private Hl7.Fhir.Model.FhirBoolean? _PrimarySourceElement; /// /// Indicates context the data was recorded in @@ -1000,13 +960,10 @@ public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement [IgnoreDataMember] public bool? PrimarySource { - get { return PrimarySourceElement != null ? PrimarySourceElement.Value : null; } + get => _PrimarySourceElement?.Value; set { - if (value == null) - PrimarySourceElement = null; - else - PrimarySourceElement = new Hl7.Fhir.Model.FhirBoolean(value); + PrimarySourceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("PrimarySource"); } } @@ -1017,13 +974,13 @@ public bool? PrimarySource [FhirElement("reportOrigin", Order=180, FiveWs="FiveWs.source")] [Binding("ImmunizationReportOrigin")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReportOrigin + public Hl7.Fhir.Model.CodeableConcept? ReportOrigin { get { return _ReportOrigin; } set { _ReportOrigin = value; OnPropertyChanged("ReportOrigin"); } } - private Hl7.Fhir.Model.CodeableConcept _ReportOrigin; + private Hl7.Fhir.Model.CodeableConcept? _ReportOrigin; /// /// Where immunization occurred. @@ -1032,13 +989,13 @@ public Hl7.Fhir.Model.CodeableConcept ReportOrigin [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Vaccine manufacturer. @@ -1047,41 +1004,38 @@ public Hl7.Fhir.Model.ResourceReference Location [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// Vaccine lot number. /// [FhirElement("lotNumber", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Vaccine lot number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -1091,28 +1045,25 @@ public string LotNumber /// [FhirElement("expirationDate", Order=220)] [DataMember] - public Hl7.Fhir.Model.Date ExpirationDateElement + public Hl7.Fhir.Model.Date? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.Date _ExpirationDateElement; + private Hl7.Fhir.Model.Date? _ExpirationDateElement; /// /// Vaccine expiration date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.Date(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ExpirationDate"); } } @@ -1123,13 +1074,13 @@ public string ExpirationDate [FhirElement("site", Order=230)] [Binding("ImmunizationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How vaccine entered body. @@ -1137,26 +1088,26 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=240)] [Binding("ImmunizationRoute")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Amount of vaccine administered. /// [FhirElement("doseQuantity", Order=250)] [DataMember] - public Hl7.Fhir.Model.Quantity DoseQuantity + public Hl7.Fhir.Model.Quantity? DoseQuantity { get { return _DoseQuantity; } set { _DoseQuantity = value; OnPropertyChanged("DoseQuantity"); } } - private Hl7.Fhir.Model.Quantity _DoseQuantity; + private Hl7.Fhir.Model.Quantity? _DoseQuantity; /// /// Who performed event. @@ -1166,11 +1117,11 @@ public Hl7.Fhir.Model.Quantity DoseQuantity [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Additional immunization notes. @@ -1180,11 +1131,11 @@ public List Performer [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Why immunization occurred. @@ -1195,11 +1146,11 @@ public List Note [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why immunization occurred. @@ -1211,24 +1162,24 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Dose potency. /// [FhirElement("isSubpotent", InSummary=true, IsModifier=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsSubpotentElement + public Hl7.Fhir.Model.FhirBoolean? IsSubpotentElement { get { return _IsSubpotentElement; } set { _IsSubpotentElement = value; OnPropertyChanged("IsSubpotentElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsSubpotentElement; + private Hl7.Fhir.Model.FhirBoolean? _IsSubpotentElement; /// /// Dose potency @@ -1237,13 +1188,10 @@ public Hl7.Fhir.Model.FhirBoolean IsSubpotentElement [IgnoreDataMember] public bool? IsSubpotent { - get { return IsSubpotentElement != null ? IsSubpotentElement.Value : null; } + get => _IsSubpotentElement?.Value; set { - if (value == null) - IsSubpotentElement = null; - else - IsSubpotentElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsSubpotentElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsSubpotent"); } } @@ -1257,11 +1205,11 @@ public bool? IsSubpotent [DataMember] public List SubpotentReason { - get { if(_SubpotentReason==null) _SubpotentReason = new List(); return _SubpotentReason; } + get => _SubpotentReason ?? new List(); set { _SubpotentReason = value; OnPropertyChanged("SubpotentReason"); } } - private List _SubpotentReason; + private List? _SubpotentReason; /// /// Educational material presented to patient. @@ -1271,11 +1219,11 @@ public List SubpotentReason [DataMember] public List Education { - get { if(_Education==null) _Education = new List(); return _Education; } + get => _Education ?? new List(); set { _Education = value; OnPropertyChanged("Education"); } } - private List _Education; + private List? _Education; /// /// Patient eligibility for a vaccination program. @@ -1286,11 +1234,11 @@ public List Education [DataMember] public List ProgramEligibility { - get { if(_ProgramEligibility==null) _ProgramEligibility = new List(); return _ProgramEligibility; } + get => _ProgramEligibility ?? new List(); set { _ProgramEligibility = value; OnPropertyChanged("ProgramEligibility"); } } - private List _ProgramEligibility; + private List? _ProgramEligibility; /// /// Funding source for the vaccine. @@ -1298,13 +1246,13 @@ public List ProgramEligibility [FhirElement("fundingSource", Order=340)] [Binding("FundingSource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundingSource + public Hl7.Fhir.Model.CodeableConcept? FundingSource { get { return _FundingSource; } set { _FundingSource = value; OnPropertyChanged("FundingSource"); } } - private Hl7.Fhir.Model.CodeableConcept _FundingSource; + private Hl7.Fhir.Model.CodeableConcept? _FundingSource; /// /// Details of a reaction that follows immunization. @@ -1314,11 +1262,11 @@ public Hl7.Fhir.Model.CodeableConcept FundingSource [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; /// /// Protocol followed by the provider. @@ -1328,55 +1276,51 @@ public List Reaction [DataMember] public List ProtocolApplied { - get { if(_ProtocolApplied==null) _ProtocolApplied = new List(); return _ProtocolApplied; } + get => _ProtocolApplied ?? new List(); set { _ProtocolApplied = value; OnPropertyChanged("ProtocolApplied"); } } - private List _ProtocolApplied; + private List? _ProtocolApplied; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => VaccineCode; set => VaccineCode = value; } - IEnumerable ICoded.ToCodings() => VaccineCode.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => VaccineCode; set => VaccineCode = value!; } + IEnumerable ICoded.ToCodings() => VaccineCode?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Immunization; - - if (dest == null) - { + if(other is not Immunization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(VaccineCode != null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)VaccineCode.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)RecordedElement.DeepCopyInternal(); - if(PrimarySourceElement != null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)PrimarySourceElement.DeepCopyInternal(); - if(ReportOrigin != null) dest.ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)ReportOrigin.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)ExpirationDateElement.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(DoseQuantity != null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)DoseQuantity.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(IsSubpotentElement != null) dest.IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)IsSubpotentElement.DeepCopyInternal(); - if(SubpotentReason.Any()) dest.SubpotentReason = new List(SubpotentReason.DeepCopyInternal()); - if(Education.Any()) dest.Education = new List(Education.DeepCopyInternal()); - if(ProgramEligibility.Any()) dest.ProgramEligibility = new List(ProgramEligibility.DeepCopyInternal()); - if(FundingSource != null) dest.FundingSource = (Hl7.Fhir.Model.CodeableConcept)FundingSource.DeepCopyInternal(); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); - if(ProtocolApplied.Any()) dest.ProtocolApplied = new List(ProtocolApplied.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_VaccineCode is not null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)_VaccineCode.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedElement.DeepCopyInternal(); + if(_PrimarySourceElement is not null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)_PrimarySourceElement.DeepCopyInternal(); + if(_ReportOrigin is not null) dest.ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)_ReportOrigin.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)_ExpirationDateElement.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_DoseQuantity is not null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)_DoseQuantity.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_IsSubpotentElement is not null) dest.IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)_IsSubpotentElement.DeepCopyInternal(); + if(_SubpotentReason is not null) dest.SubpotentReason = new List(_SubpotentReason.DeepCopyInternal()); + if(_Education is not null) dest.Education = new List(_Education.DeepCopyInternal()); + if(_ProgramEligibility is not null) dest.ProgramEligibility = new List(_ProgramEligibility.DeepCopyInternal()); + if(_FundingSource is not null) dest.FundingSource = (Hl7.Fhir.Model.CodeableConcept)_FundingSource.DeepCopyInternal(); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); + if(_ProtocolApplied is not null) dest.ProtocolApplied = new List(_ProtocolApplied.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1388,223 +1332,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Immunization; - if(otherT == null) return false; + if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(PrimarySourceElement, otherT.PrimarySourceElement)) return false; - if(!comparer.Equals(ReportOrigin, otherT.ReportOrigin)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(DoseQuantity, otherT.DoseQuantity)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(IsSubpotentElement, otherT.IsSubpotentElement)) return false; - if(!comparer.ListEquals(SubpotentReason, otherT.SubpotentReason)) return false; - if(!comparer.ListEquals(Education, otherT.Education)) return false; - if(!comparer.ListEquals(ProgramEligibility, otherT.ProgramEligibility)) return false; - if(!comparer.Equals(FundingSource, otherT.FundingSource)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; - if(!comparer.ListEquals(ProtocolApplied, otherT.ProtocolApplied)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_PrimarySourceElement, otherT._PrimarySourceElement)) return false; + if(!comparer.Equals(_ReportOrigin, otherT._ReportOrigin)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_DoseQuantity, otherT._DoseQuantity)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_IsSubpotentElement, otherT._IsSubpotentElement)) return false; + if(!comparer.ListEquals(_SubpotentReason, otherT._SubpotentReason)) return false; + if(!comparer.ListEquals(_Education, otherT._Education)) return false; + if(!comparer.ListEquals(_ProgramEligibility, otherT._ProgramEligibility)) return false; + if(!comparer.Equals(_FundingSource, otherT._FundingSource)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; + if(!comparer.ListEquals(_ProtocolApplied, otherT._ProtocolApplied)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "vaccineCode": - value = VaccineCode; - return VaccineCode is not null; + value = _VaccineCode; + return _VaccineCode is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "primarySource": - value = PrimarySourceElement; - return PrimarySourceElement is not null; + value = _PrimarySourceElement; + return _PrimarySourceElement is not null; case "reportOrigin": - value = ReportOrigin; - return ReportOrigin is not null; + value = _ReportOrigin; + return _ReportOrigin is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "doseQuantity": - value = DoseQuantity; - return DoseQuantity is not null; + value = _DoseQuantity; + return _DoseQuantity is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "isSubpotent": - value = IsSubpotentElement; - return IsSubpotentElement is not null; + value = _IsSubpotentElement; + return _IsSubpotentElement is not null; case "subpotentReason": - value = SubpotentReason; - return SubpotentReason?.Any() == true; + value = _SubpotentReason; + return _SubpotentReason?.Any() == true; case "education": - value = Education; - return Education?.Any() == true; + value = _Education; + return _Education?.Any() == true; case "programEligibility": - value = ProgramEligibility; - return ProgramEligibility?.Any() == true; + value = _ProgramEligibility; + return _ProgramEligibility?.Any() == true; case "fundingSource": - value = FundingSource; - return FundingSource is not null; + value = _FundingSource; + return _FundingSource is not null; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; case "protocolApplied": - value = ProtocolApplied; - return ProtocolApplied?.Any() == true; + value = _ProtocolApplied; + return _ProtocolApplied?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "vaccineCode": - VaccineCode = (Hl7.Fhir.Model.CodeableConcept)value; + VaccineCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "primarySource": - PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)value; + PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reportOrigin": - ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)value; + ReportOrigin = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.Date)value; + ExpirationDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseQuantity": - DoseQuantity = (Hl7.Fhir.Model.Quantity)value; + DoseQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "isSubpotent": - IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subpotentReason": - SubpotentReason = (List)value; + SubpotentReason = (List?)value!; return this; case "education": - Education = (List)value; + Education = (List?)value!; return this; case "programEligibility": - ProgramEligibility = (List)value; + ProgramEligibility = (List?)value!; return this; case "fundingSource": - FundingSource = (Hl7.Fhir.Model.CodeableConcept)value; + FundingSource = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; case "protocolApplied": - ProtocolApplied = (List)value; + ProtocolApplied = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1615,34 +1559,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (VaccineCode is not null) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",PrimarySourceElement); - if (ReportOrigin is not null) yield return new KeyValuePair("reportOrigin",ReportOrigin); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",DoseQuantity); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (IsSubpotentElement is not null) yield return new KeyValuePair("isSubpotent",IsSubpotentElement); - if (SubpotentReason?.Any() == true) yield return new KeyValuePair("subpotentReason",SubpotentReason); - if (Education?.Any() == true) yield return new KeyValuePair("education",Education); - if (ProgramEligibility?.Any() == true) yield return new KeyValuePair("programEligibility",ProgramEligibility); - if (FundingSource is not null) yield return new KeyValuePair("fundingSource",FundingSource); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); - if (ProtocolApplied?.Any() == true) yield return new KeyValuePair("protocolApplied",ProtocolApplied); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_VaccineCode is not null) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",_PrimarySourceElement); + if (_ReportOrigin is not null) yield return new KeyValuePair("reportOrigin",_ReportOrigin); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",_DoseQuantity); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_IsSubpotentElement is not null) yield return new KeyValuePair("isSubpotent",_IsSubpotentElement); + if (_SubpotentReason?.Any() == true) yield return new KeyValuePair("subpotentReason",_SubpotentReason); + if (_Education?.Any() == true) yield return new KeyValuePair("education",_Education); + if (_ProgramEligibility?.Any() == true) yield return new KeyValuePair("programEligibility",_ProgramEligibility); + if (_FundingSource is not null) yield return new KeyValuePair("fundingSource",_FundingSource); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); + if (_ProtocolApplied?.Any() == true) yield return new KeyValuePair("protocolApplied",_ProtocolApplied); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs index cbe7d4b49..b6dd8f5f3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -89,11 +92,11 @@ public enum ImmunizationEvaluationStatusCodes [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// completed | entered-in-error. @@ -103,13 +106,13 @@ public List Identifier [Binding("ImmunizationEvaluationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | entered-in-error @@ -118,13 +121,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -137,41 +137,38 @@ public Hl7.Fhir.Model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes? [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Date evaluation was performed. /// [FhirElement("date", Order=120, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date evaluation was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -183,13 +180,13 @@ public string Date [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Evaluation target disease. @@ -198,13 +195,13 @@ public Hl7.Fhir.Model.ResourceReference Authority [Binding("EvaluationTargetDisease")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TargetDisease + public Hl7.Fhir.Model.CodeableConcept? TargetDisease { get { return _TargetDisease; } set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private Hl7.Fhir.Model.CodeableConcept _TargetDisease; + private Hl7.Fhir.Model.CodeableConcept? _TargetDisease; /// /// Immunization being evaluated. @@ -214,13 +211,13 @@ public Hl7.Fhir.Model.CodeableConcept TargetDisease [References("Immunization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ImmunizationEvent + public Hl7.Fhir.Model.ResourceReference? ImmunizationEvent { get { return _ImmunizationEvent; } set { _ImmunizationEvent = value; OnPropertyChanged("ImmunizationEvent"); } } - private Hl7.Fhir.Model.ResourceReference _ImmunizationEvent; + private Hl7.Fhir.Model.ResourceReference? _ImmunizationEvent; /// /// Status of the dose relative to published recommendations. @@ -229,13 +226,13 @@ public Hl7.Fhir.Model.ResourceReference ImmunizationEvent [Binding("EvaluationDoseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseStatus + public Hl7.Fhir.Model.CodeableConcept? DoseStatus { get { return _DoseStatus; } set { _DoseStatus = value; OnPropertyChanged("DoseStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseStatus; + private Hl7.Fhir.Model.CodeableConcept? _DoseStatus; /// /// Reason for the dose status. @@ -246,39 +243,36 @@ public Hl7.Fhir.Model.CodeableConcept DoseStatus [DataMember] public List DoseStatusReason { - get { if(_DoseStatusReason==null) _DoseStatusReason = new List(); return _DoseStatusReason; } + get => _DoseStatusReason ?? new List(); set { _DoseStatusReason = value; OnPropertyChanged("DoseStatusReason"); } } - private List _DoseStatusReason; + private List? _DoseStatusReason; /// /// Evaluation notes. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Evaluation notes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -288,28 +282,25 @@ public string Description /// [FhirElement("series", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccine series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -321,13 +312,13 @@ public string Series [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType DoseNumber + public Hl7.Fhir.Model.DataType? DoseNumber { get { return _DoseNumber; } set { _DoseNumber = value; OnPropertyChanged("DoseNumber"); } } - private Hl7.Fhir.Model.DataType _DoseNumber; + private Hl7.Fhir.Model.DataType? _DoseNumber; /// /// Recommended number of doses for immunity. @@ -336,39 +327,35 @@ public Hl7.Fhir.Model.DataType DoseNumber [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType SeriesDoses + public Hl7.Fhir.Model.DataType? SeriesDoses { get { return _SeriesDoses; } set { _SeriesDoses = value; OnPropertyChanged("SeriesDoses"); } } - private Hl7.Fhir.Model.DataType _SeriesDoses; + private Hl7.Fhir.Model.DataType? _SeriesDoses; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImmunizationEvaluation; - - if (dest == null) - { + if(other is not ImmunizationEvaluation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(TargetDisease != null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopyInternal(); - if(ImmunizationEvent != null) dest.ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)ImmunizationEvent.DeepCopyInternal(); - if(DoseStatus != null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)DoseStatus.DeepCopyInternal(); - if(DoseStatusReason.Any()) dest.DoseStatusReason = new List(DoseStatusReason.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(DoseNumber != null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)DoseNumber.DeepCopyInternal(); - if(SeriesDoses != null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)SeriesDoses.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)_TargetDisease.DeepCopyInternal(); + if(_ImmunizationEvent is not null) dest.ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)_ImmunizationEvent.DeepCopyInternal(); + if(_DoseStatus is not null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)_DoseStatus.DeepCopyInternal(); + if(_DoseStatusReason is not null) dest.DoseStatusReason = new List(_DoseStatusReason.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_DoseNumber is not null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)_DoseNumber.DeepCopyInternal(); + if(_SeriesDoses is not null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)_SeriesDoses.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -380,118 +367,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImmunizationEvaluation; - if(otherT == null) return false; + if(other is not ImmunizationEvaluation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(ImmunizationEvent, otherT.ImmunizationEvent)) return false; - if(!comparer.Equals(DoseStatus, otherT.DoseStatus)) return false; - if(!comparer.ListEquals(DoseStatusReason, otherT.DoseStatusReason)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(DoseNumber, otherT.DoseNumber)) return false; - if(!comparer.Equals(SeriesDoses, otherT.SeriesDoses)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_ImmunizationEvent, otherT._ImmunizationEvent)) return false; + if(!comparer.Equals(_DoseStatus, otherT._DoseStatus)) return false; + if(!comparer.ListEquals(_DoseStatusReason, otherT._DoseStatusReason)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; + if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease is not null; + value = _TargetDisease; + return _TargetDisease is not null; case "immunizationEvent": - value = ImmunizationEvent; - return ImmunizationEvent is not null; + value = _ImmunizationEvent; + return _ImmunizationEvent is not null; case "doseStatus": - value = DoseStatus; - return DoseStatus is not null; + value = _DoseStatus; + return _DoseStatus is not null; case "doseStatusReason": - value = DoseStatusReason; - return DoseStatusReason?.Any() == true; + value = _DoseStatusReason; + return _DoseStatusReason?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "doseNumber": - value = DoseNumber; - return DoseNumber is not null; + value = _DoseNumber; + return _DoseNumber is not null; case "seriesDoses": - value = SeriesDoses; - return SeriesDoses is not null; + value = _SeriesDoses; + return _SeriesDoses is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "targetDisease": - TargetDisease = (Hl7.Fhir.Model.CodeableConcept)value; + TargetDisease = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "immunizationEvent": - ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)value; + ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "doseStatus": - DoseStatus = (Hl7.Fhir.Model.CodeableConcept)value; + DoseStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseStatusReason": - DoseStatusReason = (List)value; + DoseStatusReason = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "doseNumber": - DoseNumber = (Hl7.Fhir.Model.DataType)value; + DoseNumber = (Hl7.Fhir.Model.DataType?)value; return this; case "seriesDoses": - SeriesDoses = (Hl7.Fhir.Model.DataType)value; + SeriesDoses = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -502,19 +489,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (TargetDisease is not null) yield return new KeyValuePair("targetDisease",TargetDisease); - if (ImmunizationEvent is not null) yield return new KeyValuePair("immunizationEvent",ImmunizationEvent); - if (DoseStatus is not null) yield return new KeyValuePair("doseStatus",DoseStatus); - if (DoseStatusReason?.Any() == true) yield return new KeyValuePair("doseStatusReason",DoseStatusReason); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (DoseNumber is not null) yield return new KeyValuePair("doseNumber",DoseNumber); - if (SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",SeriesDoses); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_TargetDisease is not null) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_ImmunizationEvent is not null) yield return new KeyValuePair("immunizationEvent",_ImmunizationEvent); + if (_DoseStatus is not null) yield return new KeyValuePair("doseStatus",_DoseStatus); + if (_DoseStatusReason?.Any() == true) yield return new KeyValuePair("doseStatusReason",_DoseStatusReason); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_DoseNumber is not null) yield return new KeyValuePair("doseNumber",_DoseNumber); + if (_SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",_SeriesDoses); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs index dcb7c2e6c..7f754ee4d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,11 +84,11 @@ public partial class RecommendationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List VaccineCode { - get { if(_VaccineCode==null) _VaccineCode = new List(); return _VaccineCode; } + get => _VaccineCode ?? new List(); set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private List _VaccineCode; + private List? _VaccineCode; /// /// Disease to be immunized against. @@ -93,13 +96,13 @@ public List VaccineCode [FhirElement("targetDisease", InSummary=true, Order=50)] [Binding("TargetDisease")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TargetDisease + public Hl7.Fhir.Model.CodeableConcept? TargetDisease { get { return _TargetDisease; } set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private Hl7.Fhir.Model.CodeableConcept _TargetDisease; + private Hl7.Fhir.Model.CodeableConcept? _TargetDisease; /// /// Vaccine which is contraindicated to fulfill the recommendation. @@ -110,11 +113,11 @@ public Hl7.Fhir.Model.CodeableConcept TargetDisease [DataMember] public List ContraindicatedVaccineCode { - get { if(_ContraindicatedVaccineCode==null) _ContraindicatedVaccineCode = new List(); return _ContraindicatedVaccineCode; } + get => _ContraindicatedVaccineCode ?? new List(); set { _ContraindicatedVaccineCode = value; OnPropertyChanged("ContraindicatedVaccineCode"); } } - private List _ContraindicatedVaccineCode; + private List? _ContraindicatedVaccineCode; /// /// Vaccine recommendation status. @@ -123,13 +126,13 @@ public List ContraindicatedVaccineCode [Binding("ImmunizationRecommendationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ForecastStatus + public Hl7.Fhir.Model.CodeableConcept? ForecastStatus { get { return _ForecastStatus; } set { _ForecastStatus = value; OnPropertyChanged("ForecastStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ForecastStatus; + private Hl7.Fhir.Model.CodeableConcept? _ForecastStatus; /// /// Vaccine administration status reason. @@ -140,11 +143,11 @@ public Hl7.Fhir.Model.CodeableConcept ForecastStatus [DataMember] public List ForecastReason { - get { if(_ForecastReason==null) _ForecastReason = new List(); return _ForecastReason; } + get => _ForecastReason ?? new List(); set { _ForecastReason = value; OnPropertyChanged("ForecastReason"); } } - private List _ForecastReason; + private List? _ForecastReason; /// /// Dates governing proposed immunization. @@ -154,39 +157,36 @@ public List ForecastReason [DataMember] public List DateCriterion { - get { if(_DateCriterion==null) _DateCriterion = new List(); return _DateCriterion; } + get => _DateCriterion ?? new List(); set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } - private List _DateCriterion; + private List? _DateCriterion; /// /// Protocol details. /// [FhirElement("description", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Protocol details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -196,28 +196,25 @@ public string Description /// [FhirElement("series", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccination series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -229,13 +226,13 @@ public string Series [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType DoseNumber + public Hl7.Fhir.Model.DataType? DoseNumber { get { return _DoseNumber; } set { _DoseNumber = value; OnPropertyChanged("DoseNumber"); } } - private Hl7.Fhir.Model.DataType _DoseNumber; + private Hl7.Fhir.Model.DataType? _DoseNumber; /// /// Recommended number of doses for immunity. @@ -244,13 +241,13 @@ public Hl7.Fhir.Model.DataType DoseNumber [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType SeriesDoses + public Hl7.Fhir.Model.DataType? SeriesDoses { get { return _SeriesDoses; } set { _SeriesDoses = value; OnPropertyChanged("SeriesDoses"); } } - private Hl7.Fhir.Model.DataType _SeriesDoses; + private Hl7.Fhir.Model.DataType? _SeriesDoses; /// /// Past immunizations supporting recommendation. @@ -262,11 +259,11 @@ public Hl7.Fhir.Model.DataType SeriesDoses [DataMember] public List SupportingImmunization { - get { if(_SupportingImmunization==null) _SupportingImmunization = new List(); return _SupportingImmunization; } + get => _SupportingImmunization ?? new List(); set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } - private List _SupportingImmunization; + private List? _SupportingImmunization; /// /// Patient observations supporting recommendation. @@ -278,34 +275,30 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get { if(_SupportingPatientInformation==null) _SupportingPatientInformation = new List(); return _SupportingPatientInformation; } + get => _SupportingPatientInformation ?? new List(); set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } - private List _SupportingPatientInformation; + private List? _SupportingPatientInformation; protected internal override void CopyToInternal(Base other) { - var dest = other as RecommendationComponent; - - if (dest == null) - { + if(other is not RecommendationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VaccineCode.Any()) dest.VaccineCode = new List(VaccineCode.DeepCopyInternal()); - if(TargetDisease != null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopyInternal(); - if(ContraindicatedVaccineCode.Any()) dest.ContraindicatedVaccineCode = new List(ContraindicatedVaccineCode.DeepCopyInternal()); - if(ForecastStatus != null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)ForecastStatus.DeepCopyInternal(); - if(ForecastReason.Any()) dest.ForecastReason = new List(ForecastReason.DeepCopyInternal()); - if(DateCriterion.Any()) dest.DateCriterion = new List(DateCriterion.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(DoseNumber != null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)DoseNumber.DeepCopyInternal(); - if(SeriesDoses != null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)SeriesDoses.DeepCopyInternal(); - if(SupportingImmunization.Any()) dest.SupportingImmunization = new List(SupportingImmunization.DeepCopyInternal()); - if(SupportingPatientInformation.Any()) dest.SupportingPatientInformation = new List(SupportingPatientInformation.DeepCopyInternal()); + if(_VaccineCode is not null) dest.VaccineCode = new List(_VaccineCode.DeepCopyInternal()); + if(_TargetDisease is not null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)_TargetDisease.DeepCopyInternal(); + if(_ContraindicatedVaccineCode is not null) dest.ContraindicatedVaccineCode = new List(_ContraindicatedVaccineCode.DeepCopyInternal()); + if(_ForecastStatus is not null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)_ForecastStatus.DeepCopyInternal(); + if(_ForecastReason is not null) dest.ForecastReason = new List(_ForecastReason.DeepCopyInternal()); + if(_DateCriterion is not null) dest.DateCriterion = new List(_DateCriterion.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_DoseNumber is not null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)_DoseNumber.DeepCopyInternal(); + if(_SeriesDoses is not null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)_SeriesDoses.DeepCopyInternal(); + if(_SupportingImmunization is not null) dest.SupportingImmunization = new List(_SupportingImmunization.DeepCopyInternal()); + if(_SupportingPatientInformation is not null) dest.SupportingPatientInformation = new List(_SupportingPatientInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -317,111 +310,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RecommendationComponent; - if(otherT == null) return false; + if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.Equals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.ListEquals(ContraindicatedVaccineCode, otherT.ContraindicatedVaccineCode)) return false; - if(!comparer.Equals(ForecastStatus, otherT.ForecastStatus)) return false; - if(!comparer.ListEquals(ForecastReason, otherT.ForecastReason)) return false; - if(!comparer.ListEquals(DateCriterion, otherT.DateCriterion)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(DoseNumber, otherT.DoseNumber)) return false; - if(!comparer.Equals(SeriesDoses, otherT.SeriesDoses)) return false; - if(!comparer.ListEquals(SupportingImmunization, otherT.SupportingImmunization)) return false; - if(!comparer.ListEquals(SupportingPatientInformation, otherT.SupportingPatientInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.ListEquals(_ContraindicatedVaccineCode, otherT._ContraindicatedVaccineCode)) return false; + if(!comparer.Equals(_ForecastStatus, otherT._ForecastStatus)) return false; + if(!comparer.ListEquals(_ForecastReason, otherT._ForecastReason)) return false; + if(!comparer.ListEquals(_DateCriterion, otherT._DateCriterion)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; + if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; + if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; + if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "vaccineCode": - value = VaccineCode; - return VaccineCode?.Any() == true; + value = _VaccineCode; + return _VaccineCode?.Any() == true; case "targetDisease": - value = TargetDisease; - return TargetDisease is not null; + value = _TargetDisease; + return _TargetDisease is not null; case "contraindicatedVaccineCode": - value = ContraindicatedVaccineCode; - return ContraindicatedVaccineCode?.Any() == true; + value = _ContraindicatedVaccineCode; + return _ContraindicatedVaccineCode?.Any() == true; case "forecastStatus": - value = ForecastStatus; - return ForecastStatus is not null; + value = _ForecastStatus; + return _ForecastStatus is not null; case "forecastReason": - value = ForecastReason; - return ForecastReason?.Any() == true; + value = _ForecastReason; + return _ForecastReason?.Any() == true; case "dateCriterion": - value = DateCriterion; - return DateCriterion?.Any() == true; + value = _DateCriterion; + return _DateCriterion?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "doseNumber": - value = DoseNumber; - return DoseNumber is not null; + value = _DoseNumber; + return _DoseNumber is not null; case "seriesDoses": - value = SeriesDoses; - return SeriesDoses is not null; + value = _SeriesDoses; + return _SeriesDoses is not null; case "supportingImmunization": - value = SupportingImmunization; - return SupportingImmunization?.Any() == true; + value = _SupportingImmunization; + return _SupportingImmunization?.Any() == true; case "supportingPatientInformation": - value = SupportingPatientInformation; - return SupportingPatientInformation?.Any() == true; + value = _SupportingPatientInformation; + return _SupportingPatientInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "vaccineCode": - VaccineCode = (List)value; + VaccineCode = (List?)value!; return this; case "targetDisease": - TargetDisease = (Hl7.Fhir.Model.CodeableConcept)value; + TargetDisease = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contraindicatedVaccineCode": - ContraindicatedVaccineCode = (List)value; + ContraindicatedVaccineCode = (List?)value!; return this; case "forecastStatus": - ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ForecastStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "forecastReason": - ForecastReason = (List)value; + ForecastReason = (List?)value!; return this; case "dateCriterion": - DateCriterion = (List)value; + DateCriterion = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "doseNumber": - DoseNumber = (Hl7.Fhir.Model.DataType)value; + DoseNumber = (Hl7.Fhir.Model.DataType?)value; return this; case "seriesDoses": - SeriesDoses = (Hl7.Fhir.Model.DataType)value; + SeriesDoses = (Hl7.Fhir.Model.DataType?)value; return this; case "supportingImmunization": - SupportingImmunization = (List)value; + SupportingImmunization = (List?)value!; return this; case "supportingPatientInformation": - SupportingPatientInformation = (List)value; + SupportingPatientInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -432,18 +425,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VaccineCode?.Any() == true) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (TargetDisease is not null) yield return new KeyValuePair("targetDisease",TargetDisease); - if (ContraindicatedVaccineCode?.Any() == true) yield return new KeyValuePair("contraindicatedVaccineCode",ContraindicatedVaccineCode); - if (ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",ForecastStatus); - if (ForecastReason?.Any() == true) yield return new KeyValuePair("forecastReason",ForecastReason); - if (DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",DateCriterion); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (DoseNumber is not null) yield return new KeyValuePair("doseNumber",DoseNumber); - if (SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",SeriesDoses); - if (SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",SupportingImmunization); - if (SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",SupportingPatientInformation); + if (_VaccineCode?.Any() == true) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_TargetDisease is not null) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_ContraindicatedVaccineCode?.Any() == true) yield return new KeyValuePair("contraindicatedVaccineCode",_ContraindicatedVaccineCode); + if (_ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",_ForecastStatus); + if (_ForecastReason?.Any() == true) yield return new KeyValuePair("forecastReason",_ForecastReason); + if (_DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",_DateCriterion); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_DoseNumber is not null) yield return new KeyValuePair("doseNumber",_DoseNumber); + if (_SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",_SeriesDoses); + if (_SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",_SupportingImmunization); + if (_SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",_SupportingPatientInformation); } } @@ -471,13 +464,13 @@ public partial class DateCriterionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ImmunizationRecommendationDateCriterion")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Recommended date. @@ -485,44 +478,37 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValueElement + public Hl7.Fhir.Model.FhirDateTime? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValueElement; + private Hl7.Fhir.Model.FhirDateTime? _ValueElement; /// /// Recommended date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DateCriterionComponent; - - if (dest == null) - { + if(other is not DateCriterionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)ValueElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -534,41 +520,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateCriterionComponent; - if(otherT == null) return false; + if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValueElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -579,8 +565,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -593,11 +579,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Who this profile is for. @@ -607,13 +593,13 @@ public List Identifier [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Date recommendation(s) created. @@ -621,28 +607,25 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("date", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date recommendation(s) created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -654,13 +637,13 @@ public string Date [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Vaccine administration recommendations. @@ -670,29 +653,25 @@ public Hl7.Fhir.Model.ResourceReference Authority [DataMember] public List Recommendation { - get { if(_Recommendation==null) _Recommendation = new List(); return _Recommendation; } + get => _Recommendation ?? new List(); set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } - private List _Recommendation; + private List? _Recommendation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImmunizationRecommendation; - - if (dest == null) - { + if(other is not ImmunizationRecommendation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(Recommendation.Any()) dest.Recommendation = new List(Recommendation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_Recommendation is not null) dest.Recommendation = new List(_Recommendation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -704,62 +683,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImmunizationRecommendation; - if(otherT == null) return false; + if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(Recommendation, otherT.Recommendation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "recommendation": - value = Recommendation; - return Recommendation?.Any() == true; + value = _Recommendation; + return _Recommendation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recommendation": - Recommendation = (List)value; + Recommendation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -770,11 +749,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",Recommendation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",_Recommendation); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs index 7e5fe120f..9d654dd12 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -2271,28 +2274,25 @@ public partial class DependsOnComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uri", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical UriElement + public Hl7.Fhir.Model.Canonical? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.Canonical _UriElement; + private Hl7.Fhir.Model.Canonical? _UriElement; /// /// Identity of the IG that this depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.Canonical(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Uri"); } } @@ -2302,28 +2302,25 @@ public string Uri /// [FhirElement("packageId", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Id PackageIdElement + public Hl7.Fhir.Model.Id? PackageIdElement { get { return _PackageIdElement; } set { _PackageIdElement = value; OnPropertyChanged("PackageIdElement"); } } - private Hl7.Fhir.Model.Id _PackageIdElement; + private Hl7.Fhir.Model.Id? _PackageIdElement; /// /// NPM Package name for IG this depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PackageId + public string? PackageId { - get { return PackageIdElement != null ? PackageIdElement.Value : null; } + get => _PackageIdElement?.Value; set { - if (value == null) - PackageIdElement = null; - else - PackageIdElement = new Hl7.Fhir.Model.Id(value); + PackageIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("PackageId"); } } @@ -2333,45 +2330,38 @@ public string PackageId /// [FhirElement("version", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of the IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DependsOnComponent; - - if (dest == null) - { + if(other is not DependsOnComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.Canonical)UriElement.DeepCopyInternal(); - if(PackageIdElement != null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)PackageIdElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.Canonical)_UriElement.DeepCopyInternal(); + if(_PackageIdElement is not null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)_PackageIdElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2383,48 +2373,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependsOnComponent; - if(otherT == null) return false; + if(other is not DependsOnComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(PackageIdElement, otherT.PackageIdElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "packageId": - value = PackageIdElement; - return PackageIdElement is not null; + value = _PackageIdElement; + return _PackageIdElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uri": - UriElement = (Hl7.Fhir.Model.Canonical)value; + UriElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "packageId": - PackageIdElement = (Hl7.Fhir.Model.Id)value; + PackageIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2435,9 +2425,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (PackageIdElement is not null) yield return new KeyValuePair("packageId",PackageIdElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_PackageIdElement is not null) yield return new KeyValuePair("packageId",_PackageIdElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -2467,13 +2457,13 @@ public partial class GlobalComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type this profile applies to @@ -2482,13 +2472,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2499,44 +2486,37 @@ public Hl7.Fhir.Model.ResourceType? Type [FhirElement("profile", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile that all resources must conform to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GlobalComponent; - - if (dest == null) - { + if(other is not GlobalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2548,41 +2528,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GlobalComponent; - if(otherT == null) return false; + if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -2593,8 +2573,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } @@ -2624,11 +2604,11 @@ public partial class DefinitionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Grouping { - get { if(_Grouping==null) _Grouping = new List(); return _Grouping; } + get => _Grouping ?? new List(); set { _Grouping = value; OnPropertyChanged("Grouping"); } } - private List _Grouping; + private List? _Grouping; /// /// Resource in the implementation guide. @@ -2638,24 +2618,24 @@ public List Grouping [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// Page/Section in the Guide. /// [FhirElement("page", Order=60)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.PageComponent Page + public Hl7.Fhir.Model.ImplementationGuide.PageComponent? Page { get { return _Page; } set { _Page = value; OnPropertyChanged("Page"); } } - private Hl7.Fhir.Model.ImplementationGuide.PageComponent _Page; + private Hl7.Fhir.Model.ImplementationGuide.PageComponent? _Page; /// /// Defines how IG is built by tools. @@ -2665,11 +2645,11 @@ public Hl7.Fhir.Model.ImplementationGuide.PageComponent Page [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// A template for building resources. @@ -2679,27 +2659,23 @@ public List Parameter [DataMember] public List Template { - get { if(_Template==null) _Template = new List(); return _Template; } + get => _Template ?? new List(); set { _Template = value; OnPropertyChanged("Template"); } } - private List _Template; + private List? _Template; protected internal override void CopyToInternal(Base other) { - var dest = other as DefinitionComponent; - - if (dest == null) - { + if(other is not DefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Grouping.Any()) dest.Grouping = new List(Grouping.DeepCopyInternal()); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Page != null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)Page.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Template.Any()) dest.Template = new List(Template.DeepCopyInternal()); + if(_Grouping is not null) dest.Grouping = new List(_Grouping.DeepCopyInternal()); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Page is not null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)_Page.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Template is not null) dest.Template = new List(_Template.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2711,62 +2687,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DefinitionComponent; - if(otherT == null) return false; + if(other is not DefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Grouping, otherT.Grouping)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.Equals(Page, otherT.Page)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Template, otherT.Template)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.Equals(_Page, otherT._Page)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Template, otherT._Template)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "grouping": - value = Grouping; - return Grouping?.Any() == true; + value = _Grouping; + return _Grouping?.Any() == true; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "page": - value = Page; - return Page is not null; + value = _Page; + return _Page is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "template": - value = Template; - return Template?.Any() == true; + value = _Template; + return _Template?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "grouping": - Grouping = (List)value; + Grouping = (List?)value!; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "page": - Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)value; + Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "template": - Template = (List)value; + Template = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2777,11 +2753,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Grouping?.Any() == true) yield return new KeyValuePair("grouping",Grouping); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Page is not null) yield return new KeyValuePair("page",Page); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Template?.Any() == true) yield return new KeyValuePair("template",Template); + if (_Grouping?.Any() == true) yield return new KeyValuePair("grouping",_Grouping); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Page is not null) yield return new KeyValuePair("page",_Page); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Template?.Any() == true) yield return new KeyValuePair("template",_Template); } } @@ -2809,28 +2785,25 @@ public partial class GroupingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptive name for the package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2840,44 +2813,37 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human readable text describing the package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GroupingComponent; - - if (dest == null) - { + if(other is not GroupingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2889,41 +2855,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupingComponent; - if(otherT == null) return false; + if(other is not GroupingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2934,8 +2900,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -2964,13 +2930,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Versions this applies to (if different to IG). @@ -2982,24 +2948,24 @@ public Hl7.Fhir.Model.ResourceReference Reference [DataMember] public List> FhirVersionElement { - get { if(_FhirVersionElement==null) _FhirVersionElement = new List>(); return _FhirVersionElement; } + get => _FhirVersionElement ?? new List>(); set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private List> _FhirVersionElement; + private List>? _FhirVersionElement; /// /// Versions this applies to (if different to IG) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FhirVersion + public IEnumerable? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Select(elem => elem.Value) : null; } + get => _FhirVersionElement?.Select(elem => elem.Value); set { if (value == null) - FhirVersionElement = null; + FhirVersionElement = null!; else FhirVersionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("FhirVersion"); @@ -3011,28 +2977,25 @@ public IEnumerable FhirVersion /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human Name for the resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3042,28 +3005,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason why included in guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -3075,61 +3035,54 @@ public string Description [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Example + public Hl7.Fhir.Model.DataType? Example { get { return _Example; } set { _Example = value; OnPropertyChanged("Example"); } } - private Hl7.Fhir.Model.DataType _Example; + private Hl7.Fhir.Model.DataType? _Example; /// /// Grouping this is part of. /// [FhirElement("groupingId", Order=90)] [DataMember] - public Hl7.Fhir.Model.Id GroupingIdElement + public Hl7.Fhir.Model.Id? GroupingIdElement { get { return _GroupingIdElement; } set { _GroupingIdElement = value; OnPropertyChanged("GroupingIdElement"); } } - private Hl7.Fhir.Model.Id _GroupingIdElement; + private Hl7.Fhir.Model.Id? _GroupingIdElement; /// /// Grouping this is part of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string GroupingId + public string? GroupingId { - get { return GroupingIdElement != null ? GroupingIdElement.Value : null; } + get => _GroupingIdElement?.Value; set { - if (value == null) - GroupingIdElement = null; - else - GroupingIdElement = new Hl7.Fhir.Model.Id(value); + GroupingIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("GroupingId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(FhirVersionElement.Any()) dest.FhirVersionElement = new List>(FhirVersionElement.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Example != null) dest.Example = (Hl7.Fhir.Model.DataType)Example.DeepCopyInternal(); - if(GroupingIdElement != null) dest.GroupingIdElement = (Hl7.Fhir.Model.Id)GroupingIdElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = new List>(_FhirVersionElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Example is not null) dest.Example = (Hl7.Fhir.Model.DataType)_Example.DeepCopyInternal(); + if(_GroupingIdElement is not null) dest.GroupingIdElement = (Hl7.Fhir.Model.Id)_GroupingIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3141,69 +3094,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.ListEquals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Example, otherT.Example)) return false; - if(!comparer.Equals(GroupingIdElement, otherT.GroupingIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Example, otherT._Example)) return false; + if(!comparer.Equals(_GroupingIdElement, otherT._GroupingIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement?.Any() == true; + value = _FhirVersionElement; + return _FhirVersionElement?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "example": - value = Example; - return Example is not null; + value = _Example; + return _Example is not null; case "groupingId": - value = GroupingIdElement; - return GroupingIdElement is not null; + value = _GroupingIdElement; + return _GroupingIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "fhirVersion": - FhirVersionElement = (List>)value; + FhirVersionElement = (List>?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "example": - Example = (Hl7.Fhir.Model.DataType)value; + Example = (Hl7.Fhir.Model.DataType?)value; return this; case "groupingId": - GroupingIdElement = (Hl7.Fhir.Model.Id)value; + GroupingIdElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -3214,12 +3167,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Example is not null) yield return new KeyValuePair("example",Example); - if (GroupingIdElement is not null) yield return new KeyValuePair("groupingId",GroupingIdElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Example is not null) yield return new KeyValuePair("example",_Example); + if (_GroupingIdElement is not null) yield return new KeyValuePair("groupingId",_GroupingIdElement); } } @@ -3250,13 +3203,13 @@ public partial class PageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Name + public Hl7.Fhir.Model.DataType? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.DataType _Name; + private Hl7.Fhir.Model.DataType? _Name; /// /// Short title shown for navigational assistance. @@ -3264,28 +3217,25 @@ public Hl7.Fhir.Model.DataType Name [FhirElement("title", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Short title shown for navigational assistance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -3298,13 +3248,13 @@ public string Title [Binding("GuidePageGeneration")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code GenerationElement + public Code? GenerationElement { get { return _GenerationElement; } set { _GenerationElement = value; OnPropertyChanged("GenerationElement"); } } - private Code _GenerationElement; + private Code? _GenerationElement; /// /// html | markdown | xml | generated @@ -3313,13 +3263,10 @@ public Code GenerationEl [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation { - get { return GenerationElement != null ? GenerationElement.Value : null; } + get => _GenerationElement?.Value; set { - if (value == null) - GenerationElement = null; - else - GenerationElement = new Code(value); + GenerationElement = value is null ? null : new Code(value); OnPropertyChanged("Generation"); } } @@ -3332,26 +3279,22 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation [DataMember] public List Page { - get { if(_Page==null) _Page = new List(); return _Page; } + get => _Page ?? new List(); set { _Page = value; OnPropertyChanged("Page"); } } - private List _Page; + private List? _Page; protected internal override void CopyToInternal(Base other) { - var dest = other as PageComponent; - - if (dest == null) - { + if(other is not PageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Name != null) dest.Name = (Hl7.Fhir.Model.DataType)Name.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(GenerationElement != null) dest.GenerationElement = (Code)GenerationElement.DeepCopyInternal(); - if(Page.Any()) dest.Page = new List(Page.DeepCopyInternal()); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.DataType)_Name.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_GenerationElement is not null) dest.GenerationElement = (Code)_GenerationElement.DeepCopyInternal(); + if(_Page is not null) dest.Page = new List(_Page.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3363,55 +3306,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PageComponent; - if(otherT == null) return false; + if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(GenerationElement, otherT.GenerationElement)) return false; - if(!comparer.ListEquals(Page, otherT.Page)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_GenerationElement, otherT._GenerationElement)) return false; + if(!comparer.ListEquals(_Page, otherT._Page)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "generation": - value = GenerationElement; - return GenerationElement is not null; + value = _GenerationElement; + return _GenerationElement is not null; case "page": - value = Page; - return Page?.Any() == true; + value = _Page; + return _Page?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - Name = (Hl7.Fhir.Model.DataType)value; + Name = (Hl7.Fhir.Model.DataType?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "generation": - GenerationElement = (Code)value; + GenerationElement = (Code?)value; return this; case "page": - Page = (List)value; + Page = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3422,10 +3365,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Name is not null) yield return new KeyValuePair("name",Name); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (GenerationElement is not null) yield return new KeyValuePair("generation",GenerationElement); - if (Page?.Any() == true) yield return new KeyValuePair("page",Page); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_GenerationElement is not null) yield return new KeyValuePair("generation",_GenerationElement); + if (_Page?.Any() == true) yield return new KeyValuePair("page",_Page); } } @@ -3451,13 +3394,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [Binding("GuideParameterCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template @@ -3466,13 +3409,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.GuideParameterCode? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -3483,44 +3423,37 @@ public Hl7.Fhir.Model.ImplementationGuide.GuideParameterCode? Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value for named type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3532,41 +3465,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3577,8 +3510,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -3602,28 +3535,25 @@ public partial class TemplateComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Type of template specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -3634,28 +3564,25 @@ public string Code [FhirElement("source", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// The source location for the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -3665,45 +3592,38 @@ public string Source /// [FhirElement("scope", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ScopeElement + public Hl7.Fhir.Model.FhirString? ScopeElement { get { return _ScopeElement; } set { _ScopeElement = value; OnPropertyChanged("ScopeElement"); } } - private Hl7.Fhir.Model.FhirString _ScopeElement; + private Hl7.Fhir.Model.FhirString? _ScopeElement; /// /// The scope in which the template applies /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Scope + public string? Scope { - get { return ScopeElement != null ? ScopeElement.Value : null; } + get => _ScopeElement?.Value; set { - if (value == null) - ScopeElement = null; - else - ScopeElement = new Hl7.Fhir.Model.FhirString(value); + ScopeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Scope"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TemplateComponent; - - if (dest == null) - { + if(other is not TemplateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(ScopeElement != null) dest.ScopeElement = (Hl7.Fhir.Model.FhirString)ScopeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_ScopeElement is not null) dest.ScopeElement = (Hl7.Fhir.Model.FhirString)_ScopeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3715,48 +3635,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TemplateComponent; - if(otherT == null) return false; + if(other is not TemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(ScopeElement, otherT.ScopeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "scope": - value = ScopeElement; - return ScopeElement is not null; + value = _ScopeElement; + return _ScopeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "scope": - ScopeElement = (Hl7.Fhir.Model.FhirString)value; + ScopeElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3767,9 +3687,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (ScopeElement is not null) yield return new KeyValuePair("scope",ScopeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_ScopeElement is not null) yield return new KeyValuePair("scope",_ScopeElement); } } @@ -3795,28 +3715,25 @@ public partial class ManifestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("rendering", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUrl RenderingElement + public Hl7.Fhir.Model.FhirUrl? RenderingElement { get { return _RenderingElement; } set { _RenderingElement = value; OnPropertyChanged("RenderingElement"); } } - private Hl7.Fhir.Model.FhirUrl _RenderingElement; + private Hl7.Fhir.Model.FhirUrl? _RenderingElement; /// /// Location of rendered implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rendering + public string? Rendering { - get { return RenderingElement != null ? RenderingElement.Value : null; } + get => _RenderingElement?.Value; set { - if (value == null) - RenderingElement = null; - else - RenderingElement = new Hl7.Fhir.Model.FhirUrl(value); + RenderingElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Rendering"); } } @@ -3829,11 +3746,11 @@ public string Rendering [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// HTML page within the parent IG. @@ -3843,11 +3760,11 @@ public List Resour [DataMember] public List Page { - get { if(_Page==null) _Page = new List(); return _Page; } + get => _Page ?? new List(); set { _Page = value; OnPropertyChanged("Page"); } } - private List _Page; + private List? _Page; /// /// Image within the IG. @@ -3857,24 +3774,24 @@ public List Page [DataMember] public List ImageElement { - get { if(_ImageElement==null) _ImageElement = new List(); return _ImageElement; } + get => _ImageElement ?? new List(); set { _ImageElement = value; OnPropertyChanged("ImageElement"); } } - private List _ImageElement; + private List? _ImageElement; /// /// Image within the IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Image + public IEnumerable? Image { - get { return ImageElement != null ? ImageElement.Select(elem => elem.Value) : null; } + get => _ImageElement?.Select(elem => elem.Value); set { if (value == null) - ImageElement = null; + ImageElement = null!; else ImageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Image"); @@ -3889,24 +3806,24 @@ public IEnumerable Image [DataMember] public List OtherElement { - get { if(_OtherElement==null) _OtherElement = new List(); return _OtherElement; } + get => _OtherElement ?? new List(); set { _OtherElement = value; OnPropertyChanged("OtherElement"); } } - private List _OtherElement; + private List? _OtherElement; /// /// Additional linkable file in IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Other + public IEnumerable? Other { - get { return OtherElement != null ? OtherElement.Select(elem => elem.Value) : null; } + get => _OtherElement?.Select(elem => elem.Value); set { if (value == null) - OtherElement = null; + OtherElement = null!; else OtherElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Other"); @@ -3915,19 +3832,15 @@ public IEnumerable Other protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestComponent; - - if (dest == null) - { + if(other is not ManifestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RenderingElement != null) dest.RenderingElement = (Hl7.Fhir.Model.FhirUrl)RenderingElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Page.Any()) dest.Page = new List(Page.DeepCopyInternal()); - if(ImageElement.Any()) dest.ImageElement = new List(ImageElement.DeepCopyInternal()); - if(OtherElement.Any()) dest.OtherElement = new List(OtherElement.DeepCopyInternal()); + if(_RenderingElement is not null) dest.RenderingElement = (Hl7.Fhir.Model.FhirUrl)_RenderingElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Page is not null) dest.Page = new List(_Page.DeepCopyInternal()); + if(_ImageElement is not null) dest.ImageElement = new List(_ImageElement.DeepCopyInternal()); + if(_OtherElement is not null) dest.OtherElement = new List(_OtherElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3939,62 +3852,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestComponent; - if(otherT == null) return false; + if(other is not ManifestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RenderingElement, otherT.RenderingElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Page, otherT.Page)) return false; - if(!comparer.ListEquals(ImageElement, otherT.ImageElement)) return false; - if(!comparer.ListEquals(OtherElement, otherT.OtherElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Page, otherT._Page)) return false; + if(!comparer.ListEquals(_ImageElement, otherT._ImageElement)) return false; + if(!comparer.ListEquals(_OtherElement, otherT._OtherElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "rendering": - value = RenderingElement; - return RenderingElement is not null; + value = _RenderingElement; + return _RenderingElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "page": - value = Page; - return Page?.Any() == true; + value = _Page; + return _Page?.Any() == true; case "image": - value = ImageElement; - return ImageElement?.Any() == true; + value = _ImageElement; + return _ImageElement?.Any() == true; case "other": - value = OtherElement; - return OtherElement?.Any() == true; + value = _OtherElement; + return _OtherElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "rendering": - RenderingElement = (Hl7.Fhir.Model.FhirUrl)value; + RenderingElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "page": - Page = (List)value; + Page = (List?)value!; return this; case "image": - ImageElement = (List)value; + ImageElement = (List?)value!; return this; case "other": - OtherElement = (List)value; + OtherElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4005,11 +3918,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RenderingElement is not null) yield return new KeyValuePair("rendering",RenderingElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Page?.Any() == true) yield return new KeyValuePair("page",Page); - if (ImageElement?.Any() == true) yield return new KeyValuePair("image",ImageElement); - if (OtherElement?.Any() == true) yield return new KeyValuePair("other",OtherElement); + if (_RenderingElement is not null) yield return new KeyValuePair("rendering",_RenderingElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Page?.Any() == true) yield return new KeyValuePair("page",_Page); + if (_ImageElement?.Any() == true) yield return new KeyValuePair("image",_ImageElement); + if (_OtherElement?.Any() == true) yield return new KeyValuePair("other",_OtherElement); } } @@ -4038,13 +3951,13 @@ public partial class ManifestResourceComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Is an example/What is this an example of?. @@ -4053,58 +3966,51 @@ public Hl7.Fhir.Model.ResourceReference Reference [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Example + public Hl7.Fhir.Model.DataType? Example { get { return _Example; } set { _Example = value; OnPropertyChanged("Example"); } } - private Hl7.Fhir.Model.DataType _Example; + private Hl7.Fhir.Model.DataType? _Example; /// /// Relative path for page in IG. /// [FhirElement("relativePath", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUrl RelativePathElement + public Hl7.Fhir.Model.FhirUrl? RelativePathElement { get { return _RelativePathElement; } set { _RelativePathElement = value; OnPropertyChanged("RelativePathElement"); } } - private Hl7.Fhir.Model.FhirUrl _RelativePathElement; + private Hl7.Fhir.Model.FhirUrl? _RelativePathElement; /// /// Relative path for page in IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelativePath + public string? RelativePath { - get { return RelativePathElement != null ? RelativePathElement.Value : null; } + get => _RelativePathElement?.Value; set { - if (value == null) - RelativePathElement = null; - else - RelativePathElement = new Hl7.Fhir.Model.FhirUrl(value); + RelativePathElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("RelativePath"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestResourceComponent; - - if (dest == null) - { + if(other is not ManifestResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Example != null) dest.Example = (Hl7.Fhir.Model.DataType)Example.DeepCopyInternal(); - if(RelativePathElement != null) dest.RelativePathElement = (Hl7.Fhir.Model.FhirUrl)RelativePathElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Example is not null) dest.Example = (Hl7.Fhir.Model.DataType)_Example.DeepCopyInternal(); + if(_RelativePathElement is not null) dest.RelativePathElement = (Hl7.Fhir.Model.FhirUrl)_RelativePathElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4116,48 +4022,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestResourceComponent; - if(otherT == null) return false; + if(other is not ManifestResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Example, otherT.Example)) return false; - if(!comparer.Equals(RelativePathElement, otherT.RelativePathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Example, otherT._Example)) return false; + if(!comparer.Equals(_RelativePathElement, otherT._RelativePathElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "example": - value = Example; - return Example is not null; + value = _Example; + return _Example is not null; case "relativePath": - value = RelativePathElement; - return RelativePathElement is not null; + value = _RelativePathElement; + return _RelativePathElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "example": - Example = (Hl7.Fhir.Model.DataType)value; + Example = (Hl7.Fhir.Model.DataType?)value; return this; case "relativePath": - RelativePathElement = (Hl7.Fhir.Model.FhirUrl)value; + RelativePathElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -4168,9 +4074,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Example is not null) yield return new KeyValuePair("example",Example); - if (RelativePathElement is not null) yield return new KeyValuePair("relativePath",RelativePathElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Example is not null) yield return new KeyValuePair("example",_Example); + if (_RelativePathElement is not null) yield return new KeyValuePair("relativePath",_RelativePathElement); } } @@ -4197,28 +4103,25 @@ public partial class ManifestPageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// HTML page name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4228,28 +4131,25 @@ public string Name /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Title of the page, for references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4262,24 +4162,24 @@ public string Title [DataMember] public List AnchorElement { - get { if(_AnchorElement==null) _AnchorElement = new List(); return _AnchorElement; } + get => _AnchorElement ?? new List(); set { _AnchorElement = value; OnPropertyChanged("AnchorElement"); } } - private List _AnchorElement; + private List? _AnchorElement; /// /// Anchor available on the page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Anchor + public IEnumerable? Anchor { - get { return AnchorElement != null ? AnchorElement.Select(elem => elem.Value) : null; } + get => _AnchorElement?.Select(elem => elem.Value); set { if (value == null) - AnchorElement = null; + AnchorElement = null!; else AnchorElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Anchor"); @@ -4288,17 +4188,13 @@ public IEnumerable Anchor protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestPageComponent; - - if (dest == null) - { + if(other is not ManifestPageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(AnchorElement.Any()) dest.AnchorElement = new List(AnchorElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_AnchorElement is not null) dest.AnchorElement = new List(_AnchorElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4310,48 +4206,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestPageComponent; - if(otherT == null) return false; + if(other is not ManifestPageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(AnchorElement, otherT.AnchorElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_AnchorElement, otherT._AnchorElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "anchor": - value = AnchorElement; - return AnchorElement?.Any() == true; + value = _AnchorElement; + return _AnchorElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "anchor": - AnchorElement = (List)value; + AnchorElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4362,9 +4258,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (AnchorElement?.Any() == true) yield return new KeyValuePair("anchor",AnchorElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_AnchorElement?.Any() == true) yield return new KeyValuePair("anchor",_AnchorElement); } } @@ -4375,28 +4271,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this implementation guide, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4406,28 +4299,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4438,28 +4328,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this implementation guide (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4469,28 +4356,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this implementation guide (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4503,13 +4387,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -4518,13 +4402,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4534,13 +4415,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -4549,13 +4430,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -4565,28 +4443,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -4596,28 +4471,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -4630,39 +4502,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the implementation guide. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -4675,11 +4544,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for implementation guide (if applicable). @@ -4690,39 +4559,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -4733,28 +4599,25 @@ public string Copyright [FhirElement("packageId", InSummary=true, Order=220)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id PackageIdElement + public Hl7.Fhir.Model.Id? PackageIdElement { get { return _PackageIdElement; } set { _PackageIdElement = value; OnPropertyChanged("PackageIdElement"); } } - private Hl7.Fhir.Model.Id _PackageIdElement; + private Hl7.Fhir.Model.Id? _PackageIdElement; /// /// NPM Package name for IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PackageId + public string? PackageId { - get { return PackageIdElement != null ? PackageIdElement.Value : null; } + get => _PackageIdElement?.Value; set { - if (value == null) - PackageIdElement = null; - else - PackageIdElement = new Hl7.Fhir.Model.Id(value); + PackageIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("PackageId"); } } @@ -4766,13 +4629,13 @@ public string PackageId [DeclaredType(Type = typeof(Code))] [Binding("SPDXLicense")] [DataMember] - public Code LicenseElement + public Code? LicenseElement { get { return _LicenseElement; } set { _LicenseElement = value; OnPropertyChanged("LicenseElement"); } } - private Code _LicenseElement; + private Code? _LicenseElement; /// /// SPDX license code for this IG (or not-open-source) @@ -4781,13 +4644,10 @@ public Code LicenseElement [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License { - get { return LicenseElement != null ? LicenseElement.Value : null; } + get => _LicenseElement?.Value; set { - if (value == null) - LicenseElement = null; - else - LicenseElement = new Code(value); + LicenseElement = value is null ? null : new Code(value); OnPropertyChanged("License"); } } @@ -4802,24 +4662,24 @@ public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License [DataMember] public List> FhirVersionElement { - get { if(_FhirVersionElement==null) _FhirVersionElement = new List>(); return _FhirVersionElement; } + get => _FhirVersionElement ?? new List>(); set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private List> _FhirVersionElement; + private List>? _FhirVersionElement; /// /// FHIR Version(s) this Implementation Guide targets /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FhirVersion + public IEnumerable? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Select(elem => elem.Value) : null; } + get => _FhirVersionElement?.Select(elem => elem.Value); set { if (value == null) - FhirVersionElement = null; + FhirVersionElement = null!; else FhirVersionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("FhirVersion"); @@ -4834,11 +4694,11 @@ public IEnumerable FhirVersion [DataMember] public List DependsOn { - get { if(_DependsOn==null) _DependsOn = new List(); return _DependsOn; } + get => _DependsOn ?? new List(); set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } - private List _DependsOn; + private List? _DependsOn; /// /// Profiles that apply globally. @@ -4848,68 +4708,64 @@ public List DependsOn [DataMember] public List Global { - get { if(_Global==null) _Global = new List(); return _Global; } + get => _Global ?? new List(); set { _Global = value; OnPropertyChanged("Global"); } } - private List _Global; + private List? _Global; /// /// Information needed to build the IG. /// [FhirElement("definition", Order=270)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent Definition + public Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent _Definition; + private Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent? _Definition; /// /// Information about an assembled IG. /// [FhirElement("manifest", Order=280)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.ManifestComponent Manifest + public Hl7.Fhir.Model.ImplementationGuide.ManifestComponent? Manifest { get { return _Manifest; } set { _Manifest = value; OnPropertyChanged("Manifest"); } } - private Hl7.Fhir.Model.ImplementationGuide.ManifestComponent _Manifest; + private Hl7.Fhir.Model.ImplementationGuide.ManifestComponent? _Manifest; protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationGuide; - - if (dest == null) - { + if(other is not ImplementationGuide dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(PackageIdElement != null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)PackageIdElement.DeepCopyInternal(); - if(LicenseElement != null) dest.LicenseElement = (Code)LicenseElement.DeepCopyInternal(); - if(FhirVersionElement.Any()) dest.FhirVersionElement = new List>(FhirVersionElement.DeepCopyInternal()); - if(DependsOn.Any()) dest.DependsOn = new List(DependsOn.DeepCopyInternal()); - if(Global.Any()) dest.Global = new List(Global.DeepCopyInternal()); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)Definition.DeepCopyInternal(); - if(Manifest != null) dest.Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)Manifest.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_PackageIdElement is not null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)_PackageIdElement.DeepCopyInternal(); + if(_LicenseElement is not null) dest.LicenseElement = (Code)_LicenseElement.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = new List>(_FhirVersionElement.DeepCopyInternal()); + if(_DependsOn is not null) dest.DependsOn = new List(_DependsOn.DeepCopyInternal()); + if(_Global is not null) dest.Global = new List(_Global.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)_Definition.DeepCopyInternal(); + if(_Manifest is not null) dest.Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)_Manifest.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4921,167 +4777,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationGuide; - if(otherT == null) return false; + if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(PackageIdElement, otherT.PackageIdElement)) return false; - if(!comparer.Equals(LicenseElement, otherT.LicenseElement)) return false; - if(!comparer.ListEquals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.ListEquals(DependsOn, otherT.DependsOn)) return false; - if(!comparer.ListEquals(Global, otherT.Global)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(Manifest, otherT.Manifest)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; + if(!comparer.Equals(_LicenseElement, otherT._LicenseElement)) return false; + if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; + if(!comparer.ListEquals(_Global, otherT._Global)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_Manifest, otherT._Manifest)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "packageId": - value = PackageIdElement; - return PackageIdElement is not null; + value = _PackageIdElement; + return _PackageIdElement is not null; case "license": - value = LicenseElement; - return LicenseElement is not null; + value = _LicenseElement; + return _LicenseElement is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement?.Any() == true; + value = _FhirVersionElement; + return _FhirVersionElement?.Any() == true; case "dependsOn": - value = DependsOn; - return DependsOn?.Any() == true; + value = _DependsOn; + return _DependsOn?.Any() == true; case "global": - value = Global; - return Global?.Any() == true; + value = _Global; + return _Global?.Any() == true; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "manifest": - value = Manifest; - return Manifest is not null; + value = _Manifest; + return _Manifest is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "packageId": - PackageIdElement = (Hl7.Fhir.Model.Id)value; + PackageIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "license": - LicenseElement = (Code)value; + LicenseElement = (Code?)value; return this; case "fhirVersion": - FhirVersionElement = (List>)value; + FhirVersionElement = (List>?)value!; return this; case "dependsOn": - DependsOn = (List)value; + DependsOn = (List?)value!; return this; case "global": - Global = (List)value; + Global = (List?)value!; return this; case "definition": - Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)value; + Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent?)value; return this; case "manifest": - Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)value; + Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent?)value; return this; default: return base.SetValue(key, value); @@ -5092,26 +4948,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (PackageIdElement is not null) yield return new KeyValuePair("packageId",PackageIdElement); - if (LicenseElement is not null) yield return new KeyValuePair("license",LicenseElement); - if (FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",DependsOn); - if (Global?.Any() == true) yield return new KeyValuePair("global",Global); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (Manifest is not null) yield return new KeyValuePair("manifest",Manifest); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_PackageIdElement is not null) yield return new KeyValuePair("packageId",_PackageIdElement); + if (_LicenseElement is not null) yield return new KeyValuePair("license",_LicenseElement); + if (_FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",_DependsOn); + if (_Global?.Any() == true) yield return new KeyValuePair("global",_Global); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_Manifest is not null) yield return new KeyValuePair("manifest",_Manifest); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs index df3fa4fa4..7fb26d055 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -107,26 +110,26 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("purpose", Order=40)] [Binding("ContactPartyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Purpose + public Hl7.Fhir.Model.CodeableConcept? Purpose { get { return _Purpose; } set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private Hl7.Fhir.Model.CodeableConcept _Purpose; + private Hl7.Fhir.Model.CodeableConcept? _Purpose; /// /// A name associated with the contact. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// Contact details (telephone, email, etc.) for a contact. @@ -136,39 +139,35 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Visiting or postal addresses for the contact. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Purpose != null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)Purpose.DeepCopyInternal(); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); + if(_Purpose is not null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)_Purpose.DeepCopyInternal(); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,55 +179,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Purpose, otherT.Purpose)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = Purpose; - return Purpose is not null; + value = _Purpose; + return _Purpose is not null; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - Purpose = (Hl7.Fhir.Model.CodeableConcept)value; + Purpose = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; default: return base.SetValue(key, value); @@ -239,10 +238,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Purpose is not null) yield return new KeyValuePair("purpose",Purpose); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); + if (_Purpose is not null) yield return new KeyValuePair("purpose",_Purpose); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); } } @@ -269,13 +268,13 @@ public partial class CoverageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// What networks provide coverage. @@ -287,11 +286,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// List of benefits. @@ -301,25 +300,21 @@ public List Network [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageComponent; - - if (dest == null) - { + if(other is not CoverageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -331,48 +326,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageComponent; - if(otherT == null) return false; + if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -383,9 +378,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); } } @@ -412,41 +407,38 @@ public partial class CoverageBenefitComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Referral requirements. /// [FhirElement("requirement", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RequirementElement + public Hl7.Fhir.Model.FhirString? RequirementElement { get { return _RequirementElement; } set { _RequirementElement = value; OnPropertyChanged("RequirementElement"); } } - private Hl7.Fhir.Model.FhirString _RequirementElement; + private Hl7.Fhir.Model.FhirString? _RequirementElement; /// /// Referral requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirement + public string? Requirement { - get { return RequirementElement != null ? RequirementElement.Value : null; } + get => _RequirementElement?.Value; set { - if (value == null) - RequirementElement = null; - else - RequirementElement = new Hl7.Fhir.Model.FhirString(value); + RequirementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Requirement"); } } @@ -459,25 +451,21 @@ public string Requirement [DataMember] public List Limit { - get { if(_Limit==null) _Limit = new List(); return _Limit; } + get => _Limit ?? new List(); set { _Limit = value; OnPropertyChanged("Limit"); } } - private List _Limit; + private List? _Limit; protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageBenefitComponent; - - if (dest == null) - { + if(other is not CoverageBenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RequirementElement != null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)RequirementElement.DeepCopyInternal(); - if(Limit.Any()) dest.Limit = new List(Limit.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RequirementElement is not null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)_RequirementElement.DeepCopyInternal(); + if(_Limit is not null) dest.Limit = new List(_Limit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -489,48 +477,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageBenefitComponent; - if(otherT == null) return false; + if(other is not CoverageBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RequirementElement, otherT.RequirementElement)) return false; - if(!comparer.ListEquals(Limit, otherT.Limit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; + if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "requirement": - value = RequirementElement; - return RequirementElement is not null; + value = _RequirementElement; + return _RequirementElement is not null; case "limit": - value = Limit; - return Limit?.Any() == true; + value = _Limit; + return _Limit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "requirement": - RequirementElement = (Hl7.Fhir.Model.FhirString)value; + RequirementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "limit": - Limit = (List)value; + Limit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -541,9 +529,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RequirementElement is not null) yield return new KeyValuePair("requirement",RequirementElement); - if (Limit?.Any() == true) yield return new KeyValuePair("limit",Limit); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RequirementElement is not null) yield return new KeyValuePair("requirement",_RequirementElement); + if (_Limit?.Any() == true) yield return new KeyValuePair("limit",_Limit); } } @@ -569,39 +557,35 @@ public partial class LimitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("value", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// Benefit limit details. /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as LimitComponent; - - if (dest == null) - { + if(other is not LimitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -613,41 +597,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LimitComponent; - if(otherT == null) return false; + if(other is not LimitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -658,8 +642,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -688,24 +672,24 @@ public partial class PlanComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Type of plan. /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where product applies. @@ -717,11 +701,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// What networks provide coverage. @@ -733,11 +717,11 @@ public List CoverageArea [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Overall costs. @@ -747,11 +731,11 @@ public List Network [DataMember] public List GeneralCost { - get { if(_GeneralCost==null) _GeneralCost = new List(); return _GeneralCost; } + get => _GeneralCost ?? new List(); set { _GeneralCost = value; OnPropertyChanged("GeneralCost"); } } - private List _GeneralCost; + private List? _GeneralCost; /// /// Specific costs. @@ -761,28 +745,24 @@ public List GeneralCost [DataMember] public List SpecificCost { - get { if(_SpecificCost==null) _SpecificCost = new List(); return _SpecificCost; } + get => _SpecificCost ?? new List(); set { _SpecificCost = value; OnPropertyChanged("SpecificCost"); } } - private List _SpecificCost; + private List? _SpecificCost; protected internal override void CopyToInternal(Base other) { - var dest = other as PlanComponent; - - if (dest == null) - { + if(other is not PlanComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(GeneralCost.Any()) dest.GeneralCost = new List(GeneralCost.DeepCopyInternal()); - if(SpecificCost.Any()) dest.SpecificCost = new List(SpecificCost.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_GeneralCost is not null) dest.GeneralCost = new List(_GeneralCost.DeepCopyInternal()); + if(_SpecificCost is not null) dest.SpecificCost = new List(_SpecificCost.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -794,69 +774,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanComponent; - if(otherT == null) return false; + if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(GeneralCost, otherT.GeneralCost)) return false; - if(!comparer.ListEquals(SpecificCost, otherT.SpecificCost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_GeneralCost, otherT._GeneralCost)) return false; + if(!comparer.ListEquals(_SpecificCost, otherT._SpecificCost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "generalCost": - value = GeneralCost; - return GeneralCost?.Any() == true; + value = _GeneralCost; + return _GeneralCost?.Any() == true; case "specificCost": - value = SpecificCost; - return SpecificCost?.Any() == true; + value = _SpecificCost; + return _SpecificCost?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "generalCost": - GeneralCost = (List)value; + GeneralCost = (List?)value!; return this; case "specificCost": - SpecificCost = (List)value; + SpecificCost = (List?)value!; return this; default: return base.SetValue(key, value); @@ -867,12 +847,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (GeneralCost?.Any() == true) yield return new KeyValuePair("generalCost",GeneralCost); - if (SpecificCost?.Any() == true) yield return new KeyValuePair("specificCost",SpecificCost); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_GeneralCost?.Any() == true) yield return new KeyValuePair("generalCost",_GeneralCost); + if (_SpecificCost?.Any() == true) yield return new KeyValuePair("specificCost",_SpecificCost); } } @@ -898,26 +878,26 @@ public partial class GeneralCostComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Number of enrollees. /// [FhirElement("groupSize", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt GroupSizeElement + public Hl7.Fhir.Model.PositiveInt? GroupSizeElement { get { return _GroupSizeElement; } set { _GroupSizeElement = value; OnPropertyChanged("GroupSizeElement"); } } - private Hl7.Fhir.Model.PositiveInt _GroupSizeElement; + private Hl7.Fhir.Model.PositiveInt? _GroupSizeElement; /// /// Number of enrollees @@ -926,13 +906,10 @@ public Hl7.Fhir.Model.PositiveInt GroupSizeElement [IgnoreDataMember] public int? GroupSize { - get { return GroupSizeElement != null ? GroupSizeElement.Value : null; } + get => _GroupSizeElement?.Value; set { - if (value == null) - GroupSizeElement = null; - else - GroupSizeElement = new Hl7.Fhir.Model.PositiveInt(value); + GroupSizeElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("GroupSize"); } } @@ -942,59 +919,52 @@ public int? GroupSize /// [FhirElement("cost", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Cost + public Hl7.Fhir.Model.Money? Cost { get { return _Cost; } set { _Cost = value; OnPropertyChanged("Cost"); } } - private Hl7.Fhir.Model.Money _Cost; + private Hl7.Fhir.Model.Money? _Cost; /// /// Additional cost information. /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional cost information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GeneralCostComponent; - - if (dest == null) - { + if(other is not GeneralCostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupSizeElement != null) dest.GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)GroupSizeElement.DeepCopyInternal(); - if(Cost != null) dest.Cost = (Hl7.Fhir.Model.Money)Cost.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupSizeElement is not null) dest.GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)_GroupSizeElement.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = (Hl7.Fhir.Model.Money)_Cost.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1006,55 +976,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GeneralCostComponent; - if(otherT == null) return false; + if(other is not GeneralCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupSizeElement, otherT.GroupSizeElement)) return false; - if(!comparer.Equals(Cost, otherT.Cost)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupSizeElement, otherT._GroupSizeElement)) return false; + if(!comparer.Equals(_Cost, otherT._Cost)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupSize": - value = GroupSizeElement; - return GroupSizeElement is not null; + value = _GroupSizeElement; + return _GroupSizeElement is not null; case "cost": - value = Cost; - return Cost is not null; + value = _Cost; + return _Cost is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupSize": - GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)value; + GroupSizeElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "cost": - Cost = (Hl7.Fhir.Model.Money)value; + Cost = (Hl7.Fhir.Model.Money?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1065,10 +1035,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupSizeElement is not null) yield return new KeyValuePair("groupSize",GroupSizeElement); - if (Cost is not null) yield return new KeyValuePair("cost",Cost); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupSizeElement is not null) yield return new KeyValuePair("groupSize",_GroupSizeElement); + if (_Cost is not null) yield return new KeyValuePair("cost",_Cost); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -1095,13 +1065,13 @@ public partial class SpecificCostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Benefits list. @@ -1111,24 +1081,20 @@ public Hl7.Fhir.Model.CodeableConcept Category [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; protected internal override void CopyToInternal(Base other) { - var dest = other as SpecificCostComponent; - - if (dest == null) - { + if(other is not SpecificCostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1140,41 +1106,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecificCostComponent; - if(otherT == null) return false; + if(other is not SpecificCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1185,8 +1151,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); } } @@ -1213,13 +1179,13 @@ public partial class PlanBenefitComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// List of the costs. @@ -1229,24 +1195,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Cost { - get { if(_Cost==null) _Cost = new List(); return _Cost; } + get => _Cost ?? new List(); set { _Cost = value; OnPropertyChanged("Cost"); } } - private List _Cost; + private List? _Cost; protected internal override void CopyToInternal(Base other) { - var dest = other as PlanBenefitComponent; - - if (dest == null) - { + if(other is not PlanBenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Cost.Any()) dest.Cost = new List(Cost.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = new List(_Cost.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1258,41 +1220,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanBenefitComponent; - if(otherT == null) return false; + if(other is not PlanBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Cost, otherT.Cost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "cost": - value = Cost; - return Cost?.Any() == true; + value = _Cost; + return _Cost?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cost": - Cost = (List)value; + Cost = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1303,8 +1265,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Cost?.Any() == true) yield return new KeyValuePair("cost",Cost); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Cost?.Any() == true) yield return new KeyValuePair("cost",_Cost); } } @@ -1331,13 +1293,13 @@ public partial class CostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// in-network | out-of-network | other. @@ -1345,13 +1307,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("applicability", Order=50)] [Binding("BenefitCostApplicability")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Applicability + public Hl7.Fhir.Model.CodeableConcept? Applicability { get { return _Applicability; } set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private Hl7.Fhir.Model.CodeableConcept _Applicability; + private Hl7.Fhir.Model.CodeableConcept? _Applicability; /// /// Additional information about the cost. @@ -1361,39 +1323,35 @@ public Hl7.Fhir.Model.CodeableConcept Applicability [DataMember] public List Qualifiers { - get { if(_Qualifiers==null) _Qualifiers = new List(); return _Qualifiers; } + get => _Qualifiers ?? new List(); set { _Qualifiers = value; OnPropertyChanged("Qualifiers"); } } - private List _Qualifiers; + private List? _Qualifiers; /// /// The actual cost value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CostComponent; - - if (dest == null) - { + if(other is not CostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Applicability != null) dest.Applicability = (Hl7.Fhir.Model.CodeableConcept)Applicability.DeepCopyInternal(); - if(Qualifiers.Any()) dest.Qualifiers = new List(Qualifiers.DeepCopyInternal()); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Applicability is not null) dest.Applicability = (Hl7.Fhir.Model.CodeableConcept)_Applicability.DeepCopyInternal(); + if(_Qualifiers is not null) dest.Qualifiers = new List(_Qualifiers.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1405,55 +1363,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostComponent; - if(otherT == null) return false; + if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(Qualifiers, otherT.Qualifiers)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_Qualifiers, otherT._Qualifiers)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "applicability": - value = Applicability; - return Applicability is not null; + value = _Applicability; + return _Applicability is not null; case "qualifiers": - value = Qualifiers; - return Qualifiers?.Any() == true; + value = _Qualifiers; + return _Qualifiers?.Any() == true; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "applicability": - Applicability = (Hl7.Fhir.Model.CodeableConcept)value; + Applicability = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualifiers": - Qualifiers = (List)value; + Qualifiers = (List?)value!; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -1464,10 +1422,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Applicability is not null) yield return new KeyValuePair("applicability",Applicability); - if (Qualifiers?.Any() == true) yield return new KeyValuePair("qualifiers",Qualifiers); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Applicability is not null) yield return new KeyValuePair("applicability",_Applicability); + if (_Qualifiers?.Any() == true) yield return new KeyValuePair("qualifiers",_Qualifiers); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1480,11 +1438,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -1493,13 +1451,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("PublicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1508,13 +1466,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1528,39 +1483,36 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Official name. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Official name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1573,24 +1525,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Alternate names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -1602,13 +1554,13 @@ public IEnumerable Alias /// [FhirElement("period", Order=140)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Plan issuer. @@ -1617,13 +1569,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OwnedBy + public Hl7.Fhir.Model.ResourceReference? OwnedBy { get { return _OwnedBy; } set { _OwnedBy = value; OnPropertyChanged("OwnedBy"); } } - private Hl7.Fhir.Model.ResourceReference _OwnedBy; + private Hl7.Fhir.Model.ResourceReference? _OwnedBy; /// /// Product administrator. @@ -1632,13 +1584,13 @@ public Hl7.Fhir.Model.ResourceReference OwnedBy [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference AdministeredBy + public Hl7.Fhir.Model.ResourceReference? AdministeredBy { get { return _AdministeredBy; } set { _AdministeredBy = value; OnPropertyChanged("AdministeredBy"); } } - private Hl7.Fhir.Model.ResourceReference _AdministeredBy; + private Hl7.Fhir.Model.ResourceReference? _AdministeredBy; /// /// Where product applies. @@ -1650,11 +1602,11 @@ public Hl7.Fhir.Model.ResourceReference AdministeredBy [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// Contact for the product. @@ -1664,11 +1616,11 @@ public List CoverageArea [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Technical endpoint. @@ -1680,11 +1632,11 @@ public List Contact [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// What networks are Included. @@ -1696,11 +1648,11 @@ public List Endpoint [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Coverage details. @@ -1710,11 +1662,11 @@ public List Network [DataMember] public List Coverage { - get { if(_Coverage==null) _Coverage = new List(); return _Coverage; } + get => _Coverage ?? new List(); set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private List _Coverage; + private List? _Coverage; /// /// Plan details. @@ -1724,38 +1676,34 @@ public List Coverage [DataMember] public List Plan { - get { if(_Plan==null) _Plan = new List(); return _Plan; } + get => _Plan ?? new List(); set { _Plan = value; OnPropertyChanged("Plan"); } } - private List _Plan; + private List? _Plan; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as InsurancePlan; - - if (dest == null) - { + if(other is not InsurancePlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(OwnedBy != null) dest.OwnedBy = (Hl7.Fhir.Model.ResourceReference)OwnedBy.DeepCopyInternal(); - if(AdministeredBy != null) dest.AdministeredBy = (Hl7.Fhir.Model.ResourceReference)AdministeredBy.DeepCopyInternal(); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Coverage.Any()) dest.Coverage = new List(Coverage.DeepCopyInternal()); - if(Plan.Any()) dest.Plan = new List(Plan.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_OwnedBy is not null) dest.OwnedBy = (Hl7.Fhir.Model.ResourceReference)_OwnedBy.DeepCopyInternal(); + if(_AdministeredBy is not null) dest.AdministeredBy = (Hl7.Fhir.Model.ResourceReference)_AdministeredBy.DeepCopyInternal(); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = new List(_Coverage.DeepCopyInternal()); + if(_Plan is not null) dest.Plan = new List(_Plan.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1767,125 +1715,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsurancePlan; - if(otherT == null) return false; + if(other is not InsurancePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(OwnedBy, otherT.OwnedBy)) return false; - if(!comparer.Equals(AdministeredBy, otherT.AdministeredBy)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Coverage, otherT.Coverage)) return false; - if(!comparer.ListEquals(Plan, otherT.Plan)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_OwnedBy, otherT._OwnedBy)) return false; + if(!comparer.Equals(_AdministeredBy, otherT._AdministeredBy)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; + if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "ownedBy": - value = OwnedBy; - return OwnedBy is not null; + value = _OwnedBy; + return _OwnedBy is not null; case "administeredBy": - value = AdministeredBy; - return AdministeredBy is not null; + value = _AdministeredBy; + return _AdministeredBy is not null; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "coverage": - value = Coverage; - return Coverage?.Any() == true; + value = _Coverage; + return _Coverage?.Any() == true; case "plan": - value = Plan; - return Plan?.Any() == true; + value = _Plan; + return _Plan?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "ownedBy": - OwnedBy = (Hl7.Fhir.Model.ResourceReference)value; + OwnedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "administeredBy": - AdministeredBy = (Hl7.Fhir.Model.ResourceReference)value; + AdministeredBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "coverage": - Coverage = (List)value; + Coverage = (List?)value!; return this; case "plan": - Plan = (List)value; + Plan = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1896,20 +1844,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (OwnedBy is not null) yield return new KeyValuePair("ownedBy",OwnedBy); - if (AdministeredBy is not null) yield return new KeyValuePair("administeredBy",AdministeredBy); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Coverage?.Any() == true) yield return new KeyValuePair("coverage",Coverage); - if (Plan?.Any() == true) yield return new KeyValuePair("plan",Plan); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_OwnedBy is not null) yield return new KeyValuePair("ownedBy",_OwnedBy); + if (_AdministeredBy is not null) yield return new KeyValuePair("administeredBy",_AdministeredBy); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Coverage?.Any() == true) yield return new KeyValuePair("coverage",_Coverage); + if (_Plan?.Any() == true) yield return new KeyValuePair("plan",_Plan); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs index 41d1611de..8f2780a1a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -120,13 +123,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("role", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Individual who was involved. @@ -136,26 +139,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Practitioner","Organization","Patient","PractitionerRole","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -167,41 +166,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -212,8 +211,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -239,13 +238,13 @@ public partial class LineItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("sequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Sequence number of line item @@ -254,13 +253,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -274,13 +270,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType ChargeItem + public Hl7.Fhir.Model.DataType? ChargeItem { get { return _ChargeItem; } set { _ChargeItem = value; OnPropertyChanged("ChargeItem"); } } - private Hl7.Fhir.Model.DataType _ChargeItem; + private Hl7.Fhir.Model.DataType? _ChargeItem; /// /// Components of total line item price. @@ -290,25 +286,21 @@ public Hl7.Fhir.Model.DataType ChargeItem [DataMember] public List PriceComponent { - get { if(_PriceComponent==null) _PriceComponent = new List(); return _PriceComponent; } + get => _PriceComponent ?? new List(); set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } - private List _PriceComponent; + private List? _PriceComponent; protected internal override void CopyToInternal(Base other) { - var dest = other as LineItemComponent; - - if (dest == null) - { + if(other is not LineItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(ChargeItem != null) dest.ChargeItem = (Hl7.Fhir.Model.DataType)ChargeItem.DeepCopyInternal(); - if(PriceComponent.Any()) dest.PriceComponent = new List(PriceComponent.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_ChargeItem is not null) dest.ChargeItem = (Hl7.Fhir.Model.DataType)_ChargeItem.DeepCopyInternal(); + if(_PriceComponent is not null) dest.PriceComponent = new List(_PriceComponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -320,48 +312,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LineItemComponent; - if(otherT == null) return false; + if(other is not LineItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(ChargeItem, otherT.ChargeItem)) return false; - if(!comparer.ListEquals(PriceComponent, otherT.PriceComponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_ChargeItem, otherT._ChargeItem)) return false; + if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "chargeItem": - value = ChargeItem; - return ChargeItem is not null; + value = _ChargeItem; + return _ChargeItem is not null; case "priceComponent": - value = PriceComponent; - return PriceComponent?.Any() == true; + value = _PriceComponent; + return _PriceComponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "chargeItem": - ChargeItem = (Hl7.Fhir.Model.DataType)value; + ChargeItem = (Hl7.Fhir.Model.DataType?)value; return this; case "priceComponent": - PriceComponent = (List)value; + PriceComponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -372,9 +364,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (ChargeItem is not null) yield return new KeyValuePair("chargeItem",ChargeItem); - if (PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",PriceComponent); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_ChargeItem is not null) yield return new KeyValuePair("chargeItem",_ChargeItem); + if (_PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",_PriceComponent); } } @@ -403,13 +395,13 @@ public partial class PriceComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("InvoicePriceComponentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// base | surcharge | deduction | discount | tax | informational @@ -418,13 +410,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.InvoicePriceComponentType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -434,26 +423,26 @@ public Hl7.Fhir.Model.InvoicePriceComponentType? Type /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Factor used for calculating this component. /// [FhirElement("factor", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Factor used for calculating this component @@ -462,13 +451,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -478,28 +464,24 @@ public decimal? Factor /// [FhirElement("amount", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as PriceComponentComponent; - - if (dest == null) - { + if(other is not PriceComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -511,55 +493,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PriceComponentComponent; - if(otherT == null) return false; + if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -570,10 +552,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -586,11 +568,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | issued | balanced | cancelled | entered-in-error. @@ -600,13 +582,13 @@ public List Identifier [Binding("InvoiceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | issued | balanced | cancelled | entered-in-error @@ -615,13 +597,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Invoice.InvoiceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -631,28 +610,25 @@ public Hl7.Fhir.Model.Invoice.InvoiceStatus? Status /// [FhirElement("cancelledReason", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CancelledReasonElement + public Hl7.Fhir.Model.FhirString? CancelledReasonElement { get { return _CancelledReasonElement; } set { _CancelledReasonElement = value; OnPropertyChanged("CancelledReasonElement"); } } - private Hl7.Fhir.Model.FhirString _CancelledReasonElement; + private Hl7.Fhir.Model.FhirString? _CancelledReasonElement; /// /// Reason for cancellation of this Invoice /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CancelledReason + public string? CancelledReason { - get { return CancelledReasonElement != null ? CancelledReasonElement.Value : null; } + get => _CancelledReasonElement?.Value; set { - if (value == null) - CancelledReasonElement = null; - else - CancelledReasonElement = new Hl7.Fhir.Model.FhirString(value); + CancelledReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CancelledReason"); } } @@ -662,13 +638,13 @@ public string CancelledReason /// [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient(s) of goods and services. @@ -677,13 +653,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Recipient of this invoice. @@ -692,41 +668,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Invoice date / posting date. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Invoice date / posting date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -739,11 +712,11 @@ public string Date [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Issuing Organization of Invoice. @@ -752,13 +725,13 @@ public List Participant [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; /// /// Account that is being balanced. @@ -767,13 +740,13 @@ public Hl7.Fhir.Model.ResourceReference Issuer [CLSCompliant(false)] [References("Account")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Account + public Hl7.Fhir.Model.ResourceReference? Account { get { return _Account; } set { _Account = value; OnPropertyChanged("Account"); } } - private Hl7.Fhir.Model.ResourceReference _Account; + private Hl7.Fhir.Model.ResourceReference? _Account; /// /// Line items of this Invoice. @@ -783,11 +756,11 @@ public Hl7.Fhir.Model.ResourceReference Account [DataMember] public List LineItem { - get { if(_LineItem==null) _LineItem = new List(); return _LineItem; } + get => _LineItem ?? new List(); set { _LineItem = value; OnPropertyChanged("LineItem"); } } - private List _LineItem; + private List? _LineItem; /// /// Components of Invoice total. @@ -797,65 +770,62 @@ public List LineItem [DataMember] public List TotalPriceComponent { - get { if(_TotalPriceComponent==null) _TotalPriceComponent = new List(); return _TotalPriceComponent; } + get => _TotalPriceComponent ?? new List(); set { _TotalPriceComponent = value; OnPropertyChanged("TotalPriceComponent"); } } - private List _TotalPriceComponent; + private List? _TotalPriceComponent; /// /// Net total of this Invoice. /// [FhirElement("totalNet", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Money TotalNet + public Hl7.Fhir.Model.Money? TotalNet { get { return _TotalNet; } set { _TotalNet = value; OnPropertyChanged("TotalNet"); } } - private Hl7.Fhir.Model.Money _TotalNet; + private Hl7.Fhir.Model.Money? _TotalNet; /// /// Gross total of this Invoice. /// [FhirElement("totalGross", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Money TotalGross + public Hl7.Fhir.Model.Money? TotalGross { get { return _TotalGross; } set { _TotalGross = value; OnPropertyChanged("TotalGross"); } } - private Hl7.Fhir.Model.Money _TotalGross; + private Hl7.Fhir.Model.Money? _TotalGross; /// /// Payment details. /// [FhirElement("paymentTerms", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown PaymentTermsElement + public Hl7.Fhir.Model.Markdown? PaymentTermsElement { get { return _PaymentTermsElement; } set { _PaymentTermsElement = value; OnPropertyChanged("PaymentTermsElement"); } } - private Hl7.Fhir.Model.Markdown _PaymentTermsElement; + private Hl7.Fhir.Model.Markdown? _PaymentTermsElement; /// /// Payment details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentTerms + public string? PaymentTerms { - get { return PaymentTermsElement != null ? PaymentTermsElement.Value : null; } + get => _PaymentTermsElement?.Value; set { - if (value == null) - PaymentTermsElement = null; - else - PaymentTermsElement = new Hl7.Fhir.Model.Markdown(value); + PaymentTermsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PaymentTerms"); } } @@ -868,40 +838,36 @@ public string PaymentTerms [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Invoice; - - if (dest == null) - { + if(other is not Invoice dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CancelledReasonElement != null) dest.CancelledReasonElement = (Hl7.Fhir.Model.FhirString)CancelledReasonElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); - if(Account != null) dest.Account = (Hl7.Fhir.Model.ResourceReference)Account.DeepCopyInternal(); - if(LineItem.Any()) dest.LineItem = new List(LineItem.DeepCopyInternal()); - if(TotalPriceComponent.Any()) dest.TotalPriceComponent = new List(TotalPriceComponent.DeepCopyInternal()); - if(TotalNet != null) dest.TotalNet = (Hl7.Fhir.Model.Money)TotalNet.DeepCopyInternal(); - if(TotalGross != null) dest.TotalGross = (Hl7.Fhir.Model.Money)TotalGross.DeepCopyInternal(); - if(PaymentTermsElement != null) dest.PaymentTermsElement = (Hl7.Fhir.Model.Markdown)PaymentTermsElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CancelledReasonElement is not null) dest.CancelledReasonElement = (Hl7.Fhir.Model.FhirString)_CancelledReasonElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); + if(_Account is not null) dest.Account = (Hl7.Fhir.Model.ResourceReference)_Account.DeepCopyInternal(); + if(_LineItem is not null) dest.LineItem = new List(_LineItem.DeepCopyInternal()); + if(_TotalPriceComponent is not null) dest.TotalPriceComponent = new List(_TotalPriceComponent.DeepCopyInternal()); + if(_TotalNet is not null) dest.TotalNet = (Hl7.Fhir.Model.Money)_TotalNet.DeepCopyInternal(); + if(_TotalGross is not null) dest.TotalGross = (Hl7.Fhir.Model.Money)_TotalGross.DeepCopyInternal(); + if(_PaymentTermsElement is not null) dest.PaymentTermsElement = (Hl7.Fhir.Model.Markdown)_PaymentTermsElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -913,139 +879,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Invoice; - if(otherT == null) return false; + if(other is not Invoice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CancelledReasonElement, otherT.CancelledReasonElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; - if(!comparer.Equals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(LineItem, otherT.LineItem)) return false; - if(!comparer.ListEquals(TotalPriceComponent, otherT.TotalPriceComponent)) return false; - if(!comparer.Equals(TotalNet, otherT.TotalNet)) return false; - if(!comparer.Equals(TotalGross, otherT.TotalGross)) return false; - if(!comparer.Equals(PaymentTermsElement, otherT.PaymentTermsElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CancelledReasonElement, otherT._CancelledReasonElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; + if(!comparer.Equals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_LineItem, otherT._LineItem)) return false; + if(!comparer.ListEquals(_TotalPriceComponent, otherT._TotalPriceComponent)) return false; + if(!comparer.Equals(_TotalNet, otherT._TotalNet)) return false; + if(!comparer.Equals(_TotalGross, otherT._TotalGross)) return false; + if(!comparer.Equals(_PaymentTermsElement, otherT._PaymentTermsElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "cancelledReason": - value = CancelledReasonElement; - return CancelledReasonElement is not null; + value = _CancelledReasonElement; + return _CancelledReasonElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; case "account": - value = Account; - return Account is not null; + value = _Account; + return _Account is not null; case "lineItem": - value = LineItem; - return LineItem?.Any() == true; + value = _LineItem; + return _LineItem?.Any() == true; case "totalPriceComponent": - value = TotalPriceComponent; - return TotalPriceComponent?.Any() == true; + value = _TotalPriceComponent; + return _TotalPriceComponent?.Any() == true; case "totalNet": - value = TotalNet; - return TotalNet is not null; + value = _TotalNet; + return _TotalNet is not null; case "totalGross": - value = TotalGross; - return TotalGross is not null; + value = _TotalGross; + return _TotalGross is not null; case "paymentTerms": - value = PaymentTermsElement; - return PaymentTermsElement is not null; + value = _PaymentTermsElement; + return _PaymentTermsElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "cancelledReason": - CancelledReasonElement = (Hl7.Fhir.Model.FhirString)value; + CancelledReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "account": - Account = (Hl7.Fhir.Model.ResourceReference)value; + Account = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lineItem": - LineItem = (List)value; + LineItem = (List?)value!; return this; case "totalPriceComponent": - TotalPriceComponent = (List)value; + TotalPriceComponent = (List?)value!; return this; case "totalNet": - TotalNet = (Hl7.Fhir.Model.Money)value; + TotalNet = (Hl7.Fhir.Model.Money?)value; return this; case "totalGross": - TotalGross = (Hl7.Fhir.Model.Money)value; + TotalGross = (Hl7.Fhir.Model.Money?)value; return this; case "paymentTerms": - PaymentTermsElement = (Hl7.Fhir.Model.Markdown)value; + PaymentTermsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1056,22 +1022,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CancelledReasonElement is not null) yield return new KeyValuePair("cancelledReason",CancelledReasonElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); - if (Account is not null) yield return new KeyValuePair("account",Account); - if (LineItem?.Any() == true) yield return new KeyValuePair("lineItem",LineItem); - if (TotalPriceComponent?.Any() == true) yield return new KeyValuePair("totalPriceComponent",TotalPriceComponent); - if (TotalNet is not null) yield return new KeyValuePair("totalNet",TotalNet); - if (TotalGross is not null) yield return new KeyValuePair("totalGross",TotalGross); - if (PaymentTermsElement is not null) yield return new KeyValuePair("paymentTerms",PaymentTermsElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CancelledReasonElement is not null) yield return new KeyValuePair("cancelledReason",_CancelledReasonElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); + if (_Account is not null) yield return new KeyValuePair("account",_Account); + if (_LineItem?.Any() == true) yield return new KeyValuePair("lineItem",_LineItem); + if (_TotalPriceComponent?.Any() == true) yield return new KeyValuePair("totalPriceComponent",_TotalPriceComponent); + if (_TotalNet is not null) yield return new KeyValuePair("totalNet",_TotalNet); + if (_TotalGross is not null) yield return new KeyValuePair("totalGross",_TotalGross); + if (_PaymentTermsElement is not null) yield return new KeyValuePair("paymentTerms",_PaymentTermsElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Library.cs b/src/Hl7.Fhir.R4/Model/Generated/Library.cs index 508bc8fb5..f579d1f7c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Library.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Library : Hl7.Fhir.Model.DomainResource, IIdentifiable [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this library, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the library. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this library (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this library (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -202,28 +193,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -236,13 +224,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -251,13 +239,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -267,13 +252,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -282,13 +267,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -300,13 +282,13 @@ public bool? Experimental [Binding("LibraryType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Type of individual the library content is focused on. @@ -317,41 +299,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -361,28 +340,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -395,39 +371,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the library. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -440,11 +413,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for library (if applicable). @@ -455,39 +428,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this library is defined. /// [FhirElement("purpose", Order=250, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this library is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -497,28 +467,25 @@ public string Purpose /// [FhirElement("usage", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -528,28 +495,25 @@ public string Usage /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -559,28 +523,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the library was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -590,28 +551,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the library was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -621,13 +579,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -638,11 +596,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -652,11 +610,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -666,11 +624,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -680,11 +638,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -694,11 +652,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -708,11 +666,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Parameters defined by the library. @@ -722,11 +680,11 @@ public List RelatedArtifact [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// What data is referenced by this library. @@ -736,11 +694,11 @@ public List Parameter [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; /// /// Contents of the library, either embedded or referenced. @@ -750,58 +708,54 @@ public List DataRequirement [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Topic; set => Topic = value; } - IEnumerable ICoded.ToCodings() => Topic.ToCodings(); + IEnumerable ICoded.ToCodings() => Topic?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Library; - - if (dest == null) - { + if(other is not Library dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -813,244 +767,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Library; - if(otherT == null) return false; + if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1061,37 +1015,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs index 94dc598cc..284a7d24a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -111,13 +114,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [Binding("LinkageType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// source | alternate | historical @@ -126,13 +129,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Linkage.LinkageType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -145,26 +145,22 @@ public Hl7.Fhir.Model.Linkage.LinkageType? Type [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -176,41 +172,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -221,8 +217,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -232,13 +228,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("active", InSummary=true, Order=90, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this linkage assertion is active or not @@ -247,13 +243,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -265,13 +258,13 @@ public bool? Active [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Item to be linked. @@ -281,25 +274,21 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as Linkage; - - if (dest == null) - { + if(other is not Linkage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -311,48 +300,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Linkage; - if(otherT == null) return false; + if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -363,9 +352,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/List.cs b/src/Hl7.Fhir.R4/Model/Generated/List.cs index f90d150ef..0f3e7244c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/List.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("List","http://hl7.org/fhir/StructureDefinition/List")] - public partial class List : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class List : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -107,26 +110,26 @@ public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("flag", Order=40)] [Binding("ListItemFlag")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Flag + public Hl7.Fhir.Model.CodeableConcept? Flag { get { return _Flag; } set { _Flag = value; OnPropertyChanged("Flag"); } } - private Hl7.Fhir.Model.CodeableConcept _Flag; + private Hl7.Fhir.Model.CodeableConcept? _Flag; /// /// If this item is actually marked as deleted. /// [FhirElement("deleted", IsModifier=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DeletedElement + public Hl7.Fhir.Model.FhirBoolean? DeletedElement { get { return _DeletedElement; } set { _DeletedElement = value; OnPropertyChanged("DeletedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DeletedElement; + private Hl7.Fhir.Model.FhirBoolean? _DeletedElement; /// /// If this item is actually marked as deleted @@ -135,13 +138,10 @@ public Hl7.Fhir.Model.FhirBoolean DeletedElement [IgnoreDataMember] public bool? Deleted { - get { return DeletedElement != null ? DeletedElement.Value : null; } + get => _DeletedElement?.Value; set { - if (value == null) - DeletedElement = null; - else - DeletedElement = new Hl7.Fhir.Model.FhirBoolean(value); + DeletedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Deleted"); } } @@ -151,28 +151,25 @@ public bool? Deleted /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When item added to list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -185,28 +182,24 @@ public string Date [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Item + public Hl7.Fhir.Model.ResourceReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.ResourceReference _Item; + private Hl7.Fhir.Model.ResourceReference? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as EntryComponent; - - if (dest == null) - { + if(other is not EntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Flag != null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)Flag.DeepCopyInternal(); - if(DeletedElement != null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)DeletedElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.ResourceReference)Item.DeepCopyInternal(); + if(_Flag is not null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)_Flag.DeepCopyInternal(); + if(_DeletedElement is not null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)_DeletedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.ResourceReference)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -218,55 +211,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntryComponent; - if(otherT == null) return false; + if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Flag, otherT.Flag)) return false; - if(!comparer.Equals(DeletedElement, otherT.DeletedElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "flag": - value = Flag; - return Flag is not null; + value = _Flag; + return _Flag is not null; case "deleted": - value = DeletedElement; - return DeletedElement is not null; + value = _DeletedElement; + return _DeletedElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "flag": - Flag = (Hl7.Fhir.Model.CodeableConcept)value; + Flag = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "deleted": - DeletedElement = (Hl7.Fhir.Model.FhirBoolean)value; + DeletedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "item": - Item = (Hl7.Fhir.Model.ResourceReference)value; + Item = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -277,10 +270,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Flag is not null) yield return new KeyValuePair("flag",Flag); - if (DeletedElement is not null) yield return new KeyValuePair("deleted",DeletedElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Flag is not null) yield return new KeyValuePair("flag",_Flag); + if (_DeletedElement is not null) yield return new KeyValuePair("deleted",_DeletedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -293,11 +286,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | retired | entered-in-error. @@ -307,13 +300,13 @@ public List Identifier [Binding("ListStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | retired | entered-in-error @@ -322,13 +315,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.List.ListStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -341,13 +331,13 @@ public Hl7.Fhir.Model.List.ListStatus? Status [Binding("ListMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -356,13 +346,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -372,28 +359,25 @@ public Hl7.Fhir.Model.ListMode? Mode /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Descriptive name for the list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -404,13 +388,13 @@ public string Title [FhirElement("code", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [Binding("ListPurpose")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// If all resources have the same subject. @@ -419,13 +403,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Context in which list created. @@ -434,41 +418,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the list was prepared. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the list was prepared /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -480,13 +461,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// What order the list has. @@ -494,13 +475,13 @@ public Hl7.Fhir.Model.ResourceReference Source [FhirElement("orderedBy", Order=180)] [Binding("ListOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// Comments about the list. @@ -510,11 +491,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Entries in the list. @@ -524,11 +505,11 @@ public List Note [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why list is empty. @@ -536,42 +517,38 @@ public List Entry [FhirElement("emptyReason", Order=210)] [Binding("ListEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as List; - - if (dest == null) - { + if(other is not List dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -583,118 +560,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as List; - if(otherT == null) return false; + if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -705,19 +682,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Location.cs b/src/Hl7.Fhir.R4/Model/Generated/Location.cs index 9deb92911..e5a43aa79 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Location.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -131,13 +134,13 @@ public partial class PositionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("longitude", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LongitudeElement + public Hl7.Fhir.Model.FhirDecimal? LongitudeElement { get { return _LongitudeElement; } set { _LongitudeElement = value; OnPropertyChanged("LongitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LongitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LongitudeElement; /// /// Longitude with WGS84 datum @@ -146,13 +149,10 @@ public Hl7.Fhir.Model.FhirDecimal LongitudeElement [IgnoreDataMember] public decimal? Longitude { - get { return LongitudeElement != null ? LongitudeElement.Value : null; } + get => _LongitudeElement?.Value; set { - if (value == null) - LongitudeElement = null; - else - LongitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LongitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Longitude"); } } @@ -163,13 +163,13 @@ public decimal? Longitude [FhirElement("latitude", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LatitudeElement + public Hl7.Fhir.Model.FhirDecimal? LatitudeElement { get { return _LatitudeElement; } set { _LatitudeElement = value; OnPropertyChanged("LatitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LatitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LatitudeElement; /// /// Latitude with WGS84 datum @@ -178,13 +178,10 @@ public Hl7.Fhir.Model.FhirDecimal LatitudeElement [IgnoreDataMember] public decimal? Latitude { - get { return LatitudeElement != null ? LatitudeElement.Value : null; } + get => _LatitudeElement?.Value; set { - if (value == null) - LatitudeElement = null; - else - LatitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LatitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Latitude"); } } @@ -194,13 +191,13 @@ public decimal? Latitude /// [FhirElement("altitude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AltitudeElement + public Hl7.Fhir.Model.FhirDecimal? AltitudeElement { get { return _AltitudeElement; } set { _AltitudeElement = value; OnPropertyChanged("AltitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AltitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _AltitudeElement; /// /// Altitude with WGS84 datum @@ -209,30 +206,23 @@ public Hl7.Fhir.Model.FhirDecimal AltitudeElement [IgnoreDataMember] public decimal? Altitude { - get { return AltitudeElement != null ? AltitudeElement.Value : null; } + get => _AltitudeElement?.Value; set { - if (value == null) - AltitudeElement = null; - else - AltitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + AltitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Altitude"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PositionComponent; - - if (dest == null) - { + if(other is not PositionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LongitudeElement != null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)LongitudeElement.DeepCopyInternal(); - if(LatitudeElement != null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)LatitudeElement.DeepCopyInternal(); - if(AltitudeElement != null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)AltitudeElement.DeepCopyInternal(); + if(_LongitudeElement is not null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LongitudeElement.DeepCopyInternal(); + if(_LatitudeElement is not null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LatitudeElement.DeepCopyInternal(); + if(_AltitudeElement is not null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)_AltitudeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -244,48 +234,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PositionComponent; - if(otherT == null) return false; + if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LongitudeElement, otherT.LongitudeElement)) return false; - if(!comparer.Equals(LatitudeElement, otherT.LatitudeElement)) return false; - if(!comparer.Equals(AltitudeElement, otherT.AltitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; + if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "longitude": - value = LongitudeElement; - return LongitudeElement is not null; + value = _LongitudeElement; + return _LongitudeElement is not null; case "latitude": - value = LatitudeElement; - return LatitudeElement is not null; + value = _LatitudeElement; + return _LatitudeElement is not null; case "altitude": - value = AltitudeElement; - return AltitudeElement is not null; + value = _AltitudeElement; + return _AltitudeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "longitude": - LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LongitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "latitude": - LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LatitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "altitude": - AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + AltitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -296,9 +286,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LongitudeElement is not null) yield return new KeyValuePair("longitude",LongitudeElement); - if (LatitudeElement is not null) yield return new KeyValuePair("latitude",LatitudeElement); - if (AltitudeElement is not null) yield return new KeyValuePair("altitude",AltitudeElement); + if (_LongitudeElement is not null) yield return new KeyValuePair("longitude",_LongitudeElement); + if (_LatitudeElement is not null) yield return new KeyValuePair("latitude",_LatitudeElement); + if (_AltitudeElement is not null) yield return new KeyValuePair("altitude",_AltitudeElement); } } @@ -330,24 +320,24 @@ public partial class HoursOfOperationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -359,13 +349,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// The Location is open all day @@ -374,13 +364,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -390,28 +377,25 @@ public bool? AllDay /// [FhirElement("openingTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time OpeningTimeElement + public Hl7.Fhir.Model.Time? OpeningTimeElement { get { return _OpeningTimeElement; } set { _OpeningTimeElement = value; OnPropertyChanged("OpeningTimeElement"); } } - private Hl7.Fhir.Model.Time _OpeningTimeElement; + private Hl7.Fhir.Model.Time? _OpeningTimeElement; /// /// Time that the Location opens /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OpeningTime + public string? OpeningTime { - get { return OpeningTimeElement != null ? OpeningTimeElement.Value : null; } + get => _OpeningTimeElement?.Value; set { - if (value == null) - OpeningTimeElement = null; - else - OpeningTimeElement = new Hl7.Fhir.Model.Time(value); + OpeningTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("OpeningTime"); } } @@ -421,46 +405,39 @@ public string OpeningTime /// [FhirElement("closingTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time ClosingTimeElement + public Hl7.Fhir.Model.Time? ClosingTimeElement { get { return _ClosingTimeElement; } set { _ClosingTimeElement = value; OnPropertyChanged("ClosingTimeElement"); } } - private Hl7.Fhir.Model.Time _ClosingTimeElement; + private Hl7.Fhir.Model.Time? _ClosingTimeElement; /// /// Time that the Location closes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClosingTime + public string? ClosingTime { - get { return ClosingTimeElement != null ? ClosingTimeElement.Value : null; } + get => _ClosingTimeElement?.Value; set { - if (value == null) - ClosingTimeElement = null; - else - ClosingTimeElement = new Hl7.Fhir.Model.Time(value); + ClosingTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("ClosingTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as HoursOfOperationComponent; - - if (dest == null) - { + if(other is not HoursOfOperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(OpeningTimeElement != null) dest.OpeningTimeElement = (Hl7.Fhir.Model.Time)OpeningTimeElement.DeepCopyInternal(); - if(ClosingTimeElement != null) dest.ClosingTimeElement = (Hl7.Fhir.Model.Time)ClosingTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_OpeningTimeElement is not null) dest.OpeningTimeElement = (Hl7.Fhir.Model.Time)_OpeningTimeElement.DeepCopyInternal(); + if(_ClosingTimeElement is not null) dest.ClosingTimeElement = (Hl7.Fhir.Model.Time)_ClosingTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -472,55 +449,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HoursOfOperationComponent; - if(otherT == null) return false; + if(other is not HoursOfOperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(OpeningTimeElement, otherT.OpeningTimeElement)) return false; - if(!comparer.Equals(ClosingTimeElement, otherT.ClosingTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_OpeningTimeElement, otherT._OpeningTimeElement)) return false; + if(!comparer.Equals(_ClosingTimeElement, otherT._ClosingTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "openingTime": - value = OpeningTimeElement; - return OpeningTimeElement is not null; + value = _OpeningTimeElement; + return _OpeningTimeElement is not null; case "closingTime": - value = ClosingTimeElement; - return ClosingTimeElement is not null; + value = _ClosingTimeElement; + return _ClosingTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "openingTime": - OpeningTimeElement = (Hl7.Fhir.Model.Time)value; + OpeningTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "closingTime": - ClosingTimeElement = (Hl7.Fhir.Model.Time)value; + ClosingTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -531,10 +508,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (OpeningTimeElement is not null) yield return new KeyValuePair("openingTime",OpeningTimeElement); - if (ClosingTimeElement is not null) yield return new KeyValuePair("closingTime",ClosingTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_OpeningTimeElement is not null) yield return new KeyValuePair("openingTime",_OpeningTimeElement); + if (_ClosingTimeElement is not null) yield return new KeyValuePair("closingTime",_ClosingTimeElement); } } @@ -547,11 +524,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | inactive. @@ -560,13 +537,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("LocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | inactive @@ -575,13 +552,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -592,41 +566,38 @@ public Hl7.Fhir.Model.Location.LocationStatus? Status [FhirElement("operationalStatus", InSummary=true, Order=110, FiveWs="FiveWs.status")] [Binding("OperationalStatus")] [DataMember] - public Hl7.Fhir.Model.Coding OperationalStatus + public Hl7.Fhir.Model.Coding? OperationalStatus { get { return _OperationalStatus; } set { _OperationalStatus = value; OnPropertyChanged("OperationalStatus"); } } - private Hl7.Fhir.Model.Coding _OperationalStatus; + private Hl7.Fhir.Model.Coding? _OperationalStatus; /// /// Name of the location as used by humans. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the location as used by humans /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -639,24 +610,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the location is known as, or was known as, in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -668,28 +639,25 @@ public IEnumerable Alias /// [FhirElement("description", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Additional details about the location that could be displayed as further information to identify the location beyond its name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -701,13 +669,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("LocationMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// instance | kind @@ -716,13 +684,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -736,11 +701,11 @@ public Hl7.Fhir.Model.Location.LocationMode? Mode [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Contact details of the location. @@ -750,24 +715,24 @@ public List Type [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Physical location. /// [FhirElement("address", Order=180)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// Physical form of the location. @@ -775,26 +740,26 @@ public Hl7.Fhir.Model.Address Address [FhirElement("physicalType", InSummary=true, Order=190, FiveWs="FiveWs.class")] [Binding("PhysicalType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PhysicalType + public Hl7.Fhir.Model.CodeableConcept? PhysicalType { get { return _PhysicalType; } set { _PhysicalType = value; OnPropertyChanged("PhysicalType"); } } - private Hl7.Fhir.Model.CodeableConcept _PhysicalType; + private Hl7.Fhir.Model.CodeableConcept? _PhysicalType; /// /// The absolute geographic location. /// [FhirElement("position", Order=200)] [DataMember] - public Hl7.Fhir.Model.Location.PositionComponent Position + public Hl7.Fhir.Model.Location.PositionComponent? Position { get { return _Position; } set { _Position = value; OnPropertyChanged("Position"); } } - private Hl7.Fhir.Model.Location.PositionComponent _Position; + private Hl7.Fhir.Model.Location.PositionComponent? _Position; /// /// Organization responsible for provisioning and upkeep. @@ -803,13 +768,13 @@ public Hl7.Fhir.Model.Location.PositionComponent Position [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Another Location this one is physically a part of. @@ -818,13 +783,13 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// What days/times during a week is this location usually open. @@ -834,39 +799,36 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List HoursOfOperation { - get { if(_HoursOfOperation==null) _HoursOfOperation = new List(); return _HoursOfOperation; } + get => _HoursOfOperation ?? new List(); set { _HoursOfOperation = value; OnPropertyChanged("HoursOfOperation"); } } - private List _HoursOfOperation; + private List? _HoursOfOperation; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -881,44 +843,40 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Location; - - if (dest == null) - { + if(other is not Location dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(OperationalStatus != null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)OperationalStatus.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(PhysicalType != null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)PhysicalType.DeepCopyInternal(); - if(Position != null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)Position.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(HoursOfOperation.Any()) dest.HoursOfOperation = new List(HoursOfOperation.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_OperationalStatus is not null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)_OperationalStatus.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_PhysicalType is not null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)_PhysicalType.DeepCopyInternal(); + if(_Position is not null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)_Position.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_HoursOfOperation is not null) dest.HoursOfOperation = new List(_HoursOfOperation.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -930,146 +888,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Location; - if(otherT == null) return false; + if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(OperationalStatus, otherT.OperationalStatus)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(PhysicalType, otherT.PhysicalType)) return false; - if(!comparer.Equals(Position, otherT.Position)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(HoursOfOperation, otherT.HoursOfOperation)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_PhysicalType, otherT._PhysicalType)) return false; + if(!comparer.Equals(_Position, otherT._Position)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_HoursOfOperation, otherT._HoursOfOperation)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "operationalStatus": - value = OperationalStatus; - return OperationalStatus is not null; + value = _OperationalStatus; + return _OperationalStatus is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "physicalType": - value = PhysicalType; - return PhysicalType is not null; + value = _PhysicalType; + return _PhysicalType is not null; case "position": - value = Position; - return Position is not null; + value = _Position; + return _Position is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "hoursOfOperation": - value = HoursOfOperation; - return HoursOfOperation?.Any() == true; + value = _HoursOfOperation; + return _HoursOfOperation?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "operationalStatus": - OperationalStatus = (Hl7.Fhir.Model.Coding)value; + OperationalStatus = (Hl7.Fhir.Model.Coding?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "physicalType": - PhysicalType = (Hl7.Fhir.Model.CodeableConcept)value; + PhysicalType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "position": - Position = (Hl7.Fhir.Model.Location.PositionComponent)value; + Position = (Hl7.Fhir.Model.Location.PositionComponent?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "hoursOfOperation": - HoursOfOperation = (List)value; + HoursOfOperation = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1080,23 +1038,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",OperationalStatus); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (PhysicalType is not null) yield return new KeyValuePair("physicalType",PhysicalType); - if (Position is not null) yield return new KeyValuePair("position",Position); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (HoursOfOperation?.Any() == true) yield return new KeyValuePair("hoursOfOperation",HoursOfOperation); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatus); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_PhysicalType is not null) yield return new KeyValuePair("physicalType",_PhysicalType); + if (_Position is not null) yield return new KeyValuePair("position",_Position); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_HoursOfOperation?.Any() == true) yield return new KeyValuePair("hoursOfOperation",_HoursOfOperation); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs b/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs index 8c70534a6..8a2cb448a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,26 +65,26 @@ public partial class MarketingStatus : Hl7.Fhir.Model.BackboneType [FhirElement("country", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Country + public Hl7.Fhir.Model.CodeableConcept? Country { get { return _Country; } set { _Country = value; OnPropertyChanged("Country"); } } - private Hl7.Fhir.Model.CodeableConcept _Country; + private Hl7.Fhir.Model.CodeableConcept? _Country; /// /// Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified. /// [FhirElement("jurisdiction", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; /// /// This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples. @@ -89,13 +92,13 @@ public Hl7.Fhir.Model.CodeableConcept Jurisdiction [FhirElement("status", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. @@ -103,60 +106,53 @@ public Hl7.Fhir.Model.CodeableConcept Status [FhirElement("dateRange", InSummary=true, Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period DateRange + public Hl7.Fhir.Model.Period? DateRange { get { return _DateRange; } set { _DateRange = value; OnPropertyChanged("DateRange"); } } - private Hl7.Fhir.Model.Period _DateRange; + private Hl7.Fhir.Model.Period? _DateRange; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. /// [FhirElement("restoreDate", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RestoreDateElement + public Hl7.Fhir.Model.FhirDateTime? RestoreDateElement { get { return _RestoreDateElement; } set { _RestoreDateElement = value; OnPropertyChanged("RestoreDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RestoreDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RestoreDateElement; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RestoreDate + public string? RestoreDate { - get { return RestoreDateElement != null ? RestoreDateElement.Value : null; } + get => _RestoreDateElement?.Value; set { - if (value == null) - RestoreDateElement = null; - else - RestoreDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RestoreDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RestoreDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MarketingStatus; - - if (dest == null) - { + if(other is not MarketingStatus dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Country != null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)Country.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(DateRange != null) dest.DateRange = (Hl7.Fhir.Model.Period)DateRange.DeepCopyInternal(); - if(RestoreDateElement != null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)RestoreDateElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)_Country.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_DateRange is not null) dest.DateRange = (Hl7.Fhir.Model.Period)_DateRange.DeepCopyInternal(); + if(_RestoreDateElement is not null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)_RestoreDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -168,62 +164,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MarketingStatus; - if(otherT == null) return false; + if(other is not MarketingStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Country, otherT.Country)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(DateRange, otherT.DateRange)) return false; - if(!comparer.Equals(RestoreDateElement, otherT.RestoreDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_DateRange, otherT._DateRange)) return false; + if(!comparer.Equals(_RestoreDateElement, otherT._RestoreDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "country": - value = Country; - return Country is not null; + value = _Country; + return _Country is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "dateRange": - value = DateRange; - return DateRange is not null; + value = _DateRange; + return _DateRange is not null; case "restoreDate": - value = RestoreDateElement; - return RestoreDateElement is not null; + value = _RestoreDateElement; + return _RestoreDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "country": - Country = (Hl7.Fhir.Model.CodeableConcept)value; + Country = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dateRange": - DateRange = (Hl7.Fhir.Model.Period)value; + DateRange = (Hl7.Fhir.Model.Period?)value; return this; case "restoreDate": - RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -234,11 +230,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Country is not null) yield return new KeyValuePair("country",Country); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (DateRange is not null) yield return new KeyValuePair("dateRange",DateRange); - if (RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",RestoreDateElement); + if (_Country is not null) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_DateRange is not null) yield return new KeyValuePair("dateRange",_DateRange); + if (_RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",_RestoreDateElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs index 56432fe91..f08bac39c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,41 +83,38 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Summary description. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Summary description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -127,11 +127,11 @@ public string Description [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// Stratifier criteria for the measure. @@ -141,26 +141,22 @@ public List Population [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -172,55 +168,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -231,10 +227,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -261,41 +257,38 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("MeasurePopulationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this population criteria. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this population criteria /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -306,27 +299,23 @@ public string Description [FhirElement("criteria", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -338,48 +327,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -390,9 +379,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); } } @@ -418,41 +407,38 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this stratifier. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this stratifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -462,13 +448,13 @@ public string Description /// [FhirElement("criteria", Order=60)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; /// /// Stratifier criteria component for the measure. @@ -478,26 +464,22 @@ public Hl7.Fhir.Model.Expression Criteria [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -509,55 +491,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -568,10 +550,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } @@ -598,41 +580,38 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this stratifier component. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this stratifier component /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -643,27 +622,23 @@ public string Description [FhirElement("criteria", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -675,48 +650,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -727,9 +702,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); } } @@ -756,13 +731,13 @@ public partial class SupplementalDataComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// supplemental-data | risk-adjustment-factor. @@ -773,39 +748,36 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Usage { - get { if(_Usage==null) _Usage = new List(); return _Usage; } + get => _Usage ?? new List(); set { _Usage = value; OnPropertyChanged("Usage"); } } - private List _Usage; + private List? _Usage; /// /// The human readable description of this supplemental data. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this supplemental data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -816,28 +788,24 @@ public string Description [FhirElement("criteria", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementalDataComponent; - - if (dest == null) - { + if(other is not SupplementalDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Usage.Any()) dest.Usage = new List(Usage.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Usage is not null) dest.Usage = new List(_Usage.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -849,55 +817,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementalDataComponent; - if(otherT == null) return false; + if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Usage, otherT.Usage)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "usage": - value = Usage; - return Usage?.Any() == true; + value = _Usage; + return _Usage?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "usage": - Usage = (List)value; + Usage = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -908,10 +876,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Usage?.Any() == true) yield return new KeyValuePair("usage",Usage); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Usage?.Any() == true) yield return new KeyValuePair("usage",_Usage); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); } } @@ -921,28 +889,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this measure, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -955,39 +920,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the measure. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -997,28 +959,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this measure (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1028,28 +987,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this measure (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1059,28 +1015,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -1093,13 +1046,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1108,13 +1061,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1124,13 +1074,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1139,13 +1089,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1159,41 +1106,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1203,28 +1147,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1237,39 +1178,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the measure. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1282,11 +1220,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for measure (if applicable). @@ -1297,39 +1235,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this measure is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this measure is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1339,28 +1274,25 @@ public string Purpose /// [FhirElement("usage", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -1370,28 +1302,25 @@ public string Usage /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1401,28 +1330,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the measure was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1432,28 +1358,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the measure was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1463,13 +1386,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the measure, such as Education, Treatment, Assessment, etc. @@ -1480,11 +1403,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1494,11 +1417,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1508,11 +1431,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1522,11 +1445,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1536,11 +1459,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1550,11 +1473,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the measure. @@ -1564,24 +1487,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1593,28 +1516,25 @@ public IEnumerable Library /// [FhirElement("disclaimer", InSummary=true, Order=370)] [DataMember] - public Hl7.Fhir.Model.Markdown DisclaimerElement + public Hl7.Fhir.Model.Markdown? DisclaimerElement { get { return _DisclaimerElement; } set { _DisclaimerElement = value; OnPropertyChanged("DisclaimerElement"); } } - private Hl7.Fhir.Model.Markdown _DisclaimerElement; + private Hl7.Fhir.Model.Markdown? _DisclaimerElement; /// /// Disclaimer for use of the measure or its referenced content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disclaimer + public string? Disclaimer { - get { return DisclaimerElement != null ? DisclaimerElement.Value : null; } + get => _DisclaimerElement?.Value; set { - if (value == null) - DisclaimerElement = null; - else - DisclaimerElement = new Hl7.Fhir.Model.Markdown(value); + DisclaimerElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Disclaimer"); } } @@ -1625,13 +1545,13 @@ public string Disclaimer [FhirElement("scoring", InSummary=true, Order=380)] [Binding("MeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; /// /// opportunity | all-or-nothing | linear | weighted. @@ -1639,13 +1559,13 @@ public Hl7.Fhir.Model.CodeableConcept Scoring [FhirElement("compositeScoring", InSummary=true, Order=390)] [Binding("CompositeMeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CompositeScoring + public Hl7.Fhir.Model.CodeableConcept? CompositeScoring { get { return _CompositeScoring; } set { _CompositeScoring = value; OnPropertyChanged("CompositeScoring"); } } - private Hl7.Fhir.Model.CodeableConcept _CompositeScoring; + private Hl7.Fhir.Model.CodeableConcept? _CompositeScoring; /// /// process | outcome | structure | patient-reported-outcome | composite. @@ -1656,39 +1576,36 @@ public Hl7.Fhir.Model.CodeableConcept CompositeScoring [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// How risk adjustment is applied for this measure. /// [FhirElement("riskAdjustment", InSummary=true, Order=410)] [DataMember] - public Hl7.Fhir.Model.FhirString RiskAdjustmentElement + public Hl7.Fhir.Model.FhirString? RiskAdjustmentElement { get { return _RiskAdjustmentElement; } set { _RiskAdjustmentElement = value; OnPropertyChanged("RiskAdjustmentElement"); } } - private Hl7.Fhir.Model.FhirString _RiskAdjustmentElement; + private Hl7.Fhir.Model.FhirString? _RiskAdjustmentElement; /// /// How risk adjustment is applied for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RiskAdjustment + public string? RiskAdjustment { - get { return RiskAdjustmentElement != null ? RiskAdjustmentElement.Value : null; } + get => _RiskAdjustmentElement?.Value; set { - if (value == null) - RiskAdjustmentElement = null; - else - RiskAdjustmentElement = new Hl7.Fhir.Model.FhirString(value); + RiskAdjustmentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RiskAdjustment"); } } @@ -1698,28 +1615,25 @@ public string RiskAdjustment /// [FhirElement("rateAggregation", InSummary=true, Order=420)] [DataMember] - public Hl7.Fhir.Model.FhirString RateAggregationElement + public Hl7.Fhir.Model.FhirString? RateAggregationElement { get { return _RateAggregationElement; } set { _RateAggregationElement = value; OnPropertyChanged("RateAggregationElement"); } } - private Hl7.Fhir.Model.FhirString _RateAggregationElement; + private Hl7.Fhir.Model.FhirString? _RateAggregationElement; /// /// How is rate aggregation performed for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RateAggregation + public string? RateAggregation { - get { return RateAggregationElement != null ? RateAggregationElement.Value : null; } + get => _RateAggregationElement?.Value; set { - if (value == null) - RateAggregationElement = null; - else - RateAggregationElement = new Hl7.Fhir.Model.FhirString(value); + RateAggregationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RateAggregation"); } } @@ -1729,28 +1643,25 @@ public string RateAggregation /// [FhirElement("rationale", InSummary=true, Order=430)] [DataMember] - public Hl7.Fhir.Model.Markdown RationaleElement + public Hl7.Fhir.Model.Markdown? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.Markdown _RationaleElement; + private Hl7.Fhir.Model.Markdown? _RationaleElement; /// /// Detailed description of why the measure exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.Markdown(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Rationale"); } } @@ -1760,28 +1671,25 @@ public string Rationale /// [FhirElement("clinicalRecommendationStatement", InSummary=true, Order=440)] [DataMember] - public Hl7.Fhir.Model.Markdown ClinicalRecommendationStatementElement + public Hl7.Fhir.Model.Markdown? ClinicalRecommendationStatementElement { get { return _ClinicalRecommendationStatementElement; } set { _ClinicalRecommendationStatementElement = value; OnPropertyChanged("ClinicalRecommendationStatementElement"); } } - private Hl7.Fhir.Model.Markdown _ClinicalRecommendationStatementElement; + private Hl7.Fhir.Model.Markdown? _ClinicalRecommendationStatementElement; /// /// Summary of clinical guidelines /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClinicalRecommendationStatement + public string? ClinicalRecommendationStatement { - get { return ClinicalRecommendationStatementElement != null ? ClinicalRecommendationStatementElement.Value : null; } + get => _ClinicalRecommendationStatementElement?.Value; set { - if (value == null) - ClinicalRecommendationStatementElement = null; - else - ClinicalRecommendationStatementElement = new Hl7.Fhir.Model.Markdown(value); + ClinicalRecommendationStatementElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ClinicalRecommendationStatement"); } } @@ -1792,13 +1700,13 @@ public string ClinicalRecommendationStatement [FhirElement("improvementNotation", InSummary=true, Order=450)] [Binding("MeasureImprovementNotation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ImprovementNotation + public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation { get { return _ImprovementNotation; } set { _ImprovementNotation = value; OnPropertyChanged("ImprovementNotation"); } } - private Hl7.Fhir.Model.CodeableConcept _ImprovementNotation; + private Hl7.Fhir.Model.CodeableConcept? _ImprovementNotation; /// /// Defined terms used in the measure documentation. @@ -1808,24 +1716,24 @@ public Hl7.Fhir.Model.CodeableConcept ImprovementNotation [DataMember] public List DefinitionElement { - get { if(_DefinitionElement==null) _DefinitionElement = new List(); return _DefinitionElement; } + get => _DefinitionElement ?? new List(); set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private List _DefinitionElement; + private List? _DefinitionElement; /// /// Defined terms used in the measure documentation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Definition + public IEnumerable? Definition { - get { return DefinitionElement != null ? DefinitionElement.Select(elem => elem.Value) : null; } + get => _DefinitionElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionElement = null; + DefinitionElement = null!; else DefinitionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Markdown(elem))); OnPropertyChanged("Definition"); @@ -1837,28 +1745,25 @@ public IEnumerable Definition /// [FhirElement("guidance", InSummary=true, Order=470)] [DataMember] - public Hl7.Fhir.Model.Markdown GuidanceElement + public Hl7.Fhir.Model.Markdown? GuidanceElement { get { return _GuidanceElement; } set { _GuidanceElement = value; OnPropertyChanged("GuidanceElement"); } } - private Hl7.Fhir.Model.Markdown _GuidanceElement; + private Hl7.Fhir.Model.Markdown? _GuidanceElement; /// /// Additional guidance for implementers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Guidance + public string? Guidance { - get { return GuidanceElement != null ? GuidanceElement.Value : null; } + get => _GuidanceElement?.Value; set { - if (value == null) - GuidanceElement = null; - else - GuidanceElement = new Hl7.Fhir.Model.Markdown(value); + GuidanceElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Guidance"); } } @@ -1871,11 +1776,11 @@ public string Guidance [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// What other data should be reported with the measure. @@ -1885,68 +1790,64 @@ public List Group [DataMember] public List SupplementalData { - get { if(_SupplementalData==null) _SupplementalData = new List(); return _SupplementalData; } + get => _SupplementalData ?? new List(); set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } - private List _SupplementalData; + private List? _SupplementalData; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Topic; set => Topic = value; } - IEnumerable ICoded.ToCodings() => Topic.ToCodings(); + IEnumerable ICoded.ToCodings() => Topic?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Measure; - - if (dest == null) - { + if(other is not Measure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(DisclaimerElement != null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)DisclaimerElement.DeepCopyInternal(); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); - if(CompositeScoring != null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)CompositeScoring.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(RiskAdjustmentElement != null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)RiskAdjustmentElement.DeepCopyInternal(); - if(RateAggregationElement != null) dest.RateAggregationElement = (Hl7.Fhir.Model.FhirString)RateAggregationElement.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)RationaleElement.DeepCopyInternal(); - if(ClinicalRecommendationStatementElement != null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)ClinicalRecommendationStatementElement.DeepCopyInternal(); - if(ImprovementNotation != null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)ImprovementNotation.DeepCopyInternal(); - if(DefinitionElement.Any()) dest.DefinitionElement = new List(DefinitionElement.DeepCopyInternal()); - if(GuidanceElement != null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)GuidanceElement.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(SupplementalData.Any()) dest.SupplementalData = new List(SupplementalData.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_DisclaimerElement is not null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)_DisclaimerElement.DeepCopyInternal(); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); + if(_CompositeScoring is not null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)_CompositeScoring.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_RiskAdjustmentElement is not null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)_RiskAdjustmentElement.DeepCopyInternal(); + if(_RateAggregationElement is not null) dest.RateAggregationElement = (Hl7.Fhir.Model.FhirString)_RateAggregationElement.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)_RationaleElement.DeepCopyInternal(); + if(_ClinicalRecommendationStatementElement is not null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)_ClinicalRecommendationStatementElement.DeepCopyInternal(); + if(_ImprovementNotation is not null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)_ImprovementNotation.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = new List(_DefinitionElement.DeepCopyInternal()); + if(_GuidanceElement is not null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)_GuidanceElement.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_SupplementalData is not null) dest.SupplementalData = new List(_SupplementalData.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1958,314 +1859,314 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Measure; - if(otherT == null) return false; + if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(DisclaimerElement, otherT.DisclaimerElement)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; - if(!comparer.Equals(CompositeScoring, otherT.CompositeScoring)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(RiskAdjustmentElement, otherT.RiskAdjustmentElement)) return false; - if(!comparer.Equals(RateAggregationElement, otherT.RateAggregationElement)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; - if(!comparer.Equals(ClinicalRecommendationStatementElement, otherT.ClinicalRecommendationStatementElement)) return false; - if(!comparer.Equals(ImprovementNotation, otherT.ImprovementNotation)) return false; - if(!comparer.ListEquals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(GuidanceElement, otherT.GuidanceElement)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.ListEquals(SupplementalData, otherT.SupplementalData)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_DisclaimerElement, otherT._DisclaimerElement)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; + if(!comparer.Equals(_CompositeScoring, otherT._CompositeScoring)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RiskAdjustmentElement, otherT._RiskAdjustmentElement)) return false; + if(!comparer.Equals(_RateAggregationElement, otherT._RateAggregationElement)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; + if(!comparer.Equals(_ClinicalRecommendationStatementElement, otherT._ClinicalRecommendationStatementElement)) return false; + if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; + if(!comparer.ListEquals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_GuidanceElement, otherT._GuidanceElement)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "disclaimer": - value = DisclaimerElement; - return DisclaimerElement is not null; + value = _DisclaimerElement; + return _DisclaimerElement is not null; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; case "compositeScoring": - value = CompositeScoring; - return CompositeScoring is not null; + value = _CompositeScoring; + return _CompositeScoring is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "riskAdjustment": - value = RiskAdjustmentElement; - return RiskAdjustmentElement is not null; + value = _RiskAdjustmentElement; + return _RiskAdjustmentElement is not null; case "rateAggregation": - value = RateAggregationElement; - return RateAggregationElement is not null; + value = _RateAggregationElement; + return _RateAggregationElement is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; case "clinicalRecommendationStatement": - value = ClinicalRecommendationStatementElement; - return ClinicalRecommendationStatementElement is not null; + value = _ClinicalRecommendationStatementElement; + return _ClinicalRecommendationStatementElement is not null; case "improvementNotation": - value = ImprovementNotation; - return ImprovementNotation is not null; + value = _ImprovementNotation; + return _ImprovementNotation is not null; case "definition": - value = DefinitionElement; - return DefinitionElement?.Any() == true; + value = _DefinitionElement; + return _DefinitionElement?.Any() == true; case "guidance": - value = GuidanceElement; - return GuidanceElement is not null; + value = _GuidanceElement; + return _GuidanceElement is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "supplementalData": - value = SupplementalData; - return SupplementalData?.Any() == true; + value = _SupplementalData; + return _SupplementalData?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "disclaimer": - DisclaimerElement = (Hl7.Fhir.Model.Markdown)value; + DisclaimerElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "compositeScoring": - CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)value; + CompositeScoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "riskAdjustment": - RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)value; + RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rateAggregation": - RateAggregationElement = (Hl7.Fhir.Model.FhirString)value; + RateAggregationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.Markdown)value; + RationaleElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "clinicalRecommendationStatement": - ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)value; + ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "improvementNotation": - ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)value; + ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "definition": - DefinitionElement = (List)value; + DefinitionElement = (List?)value!; return this; case "guidance": - GuidanceElement = (Hl7.Fhir.Model.Markdown)value; + GuidanceElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "supplementalData": - SupplementalData = (List)value; + SupplementalData = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2276,47 +2177,47 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",DisclaimerElement); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); - if (CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",CompositeScoring); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",RiskAdjustmentElement); - if (RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",RateAggregationElement); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); - if (ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",ClinicalRecommendationStatementElement); - if (ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotation); - if (DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",DefinitionElement); - if (GuidanceElement is not null) yield return new KeyValuePair("guidance",GuidanceElement); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",SupplementalData); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",_DisclaimerElement); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); + if (_CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",_CompositeScoring); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",_RiskAdjustmentElement); + if (_RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",_RateAggregationElement); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); + if (_ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",_ClinicalRecommendationStatementElement); + if (_ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotation); + if (_DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",_DefinitionElement); + if (_GuidanceElement is not null) yield return new KeyValuePair("guidance",_GuidanceElement); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",_SupplementalData); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs index 9f191e6b6..df6087f88 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -142,13 +145,13 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The populations in the group. @@ -158,24 +161,24 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this group achieved. /// [FhirElement("measureScore", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity MeasureScore + public Hl7.Fhir.Model.Quantity? MeasureScore { get { return _MeasureScore; } set { _MeasureScore = value; OnPropertyChanged("MeasureScore"); } } - private Hl7.Fhir.Model.Quantity _MeasureScore; + private Hl7.Fhir.Model.Quantity? _MeasureScore; /// /// Stratification results. @@ -185,26 +188,22 @@ public Hl7.Fhir.Model.Quantity MeasureScore [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScore != null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)MeasureScore.DeepCopyInternal(); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScore is not null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)_MeasureScore.DeepCopyInternal(); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -216,55 +215,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScore, otherT.MeasureScore)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScore; - return MeasureScore is not null; + value = _MeasureScore; + return _MeasureScore is not null; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScore = (Hl7.Fhir.Model.Quantity)value; + MeasureScore = (Hl7.Fhir.Model.Quantity?)value; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -275,10 +274,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScore is not null) yield return new KeyValuePair("measureScore",MeasureScore); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScore is not null) yield return new KeyValuePair("measureScore",_MeasureScore); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -305,26 +304,26 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -333,13 +332,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -351,27 +347,23 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SubjectResults + public Hl7.Fhir.Model.ResourceReference? SubjectResults { get { return _SubjectResults; } set { _SubjectResults = value; OnPropertyChanged("SubjectResults"); } } - private Hl7.Fhir.Model.ResourceReference _SubjectResults; + private Hl7.Fhir.Model.ResourceReference? _SubjectResults; protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(SubjectResults != null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)SubjectResults.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_SubjectResults is not null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)_SubjectResults.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -383,48 +375,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(SubjectResults, otherT.SubjectResults)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "subjectResults": - value = SubjectResults; - return SubjectResults is not null; + value = _SubjectResults; + return _SubjectResults is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "subjectResults": - SubjectResults = (Hl7.Fhir.Model.ResourceReference)value; + SubjectResults = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -435,9 +427,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (SubjectResults is not null) yield return new KeyValuePair("subjectResults",SubjectResults); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_SubjectResults is not null) yield return new KeyValuePair("subjectResults",_SubjectResults); } } @@ -466,11 +458,11 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Stratum results, one for each unique value, or set of values, in the stratifier, or stratifier components. @@ -480,24 +472,20 @@ public List Code [DataMember] public List Stratum { - get { if(_Stratum==null) _Stratum = new List(); return _Stratum; } + get => _Stratum ?? new List(); set { _Stratum = value; OnPropertyChanged("Stratum"); } } - private List _Stratum; + private List? _Stratum; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Stratum.Any()) dest.Stratum = new List(Stratum.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Stratum is not null) dest.Stratum = new List(_Stratum.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -509,41 +497,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Stratum, otherT.Stratum)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "stratum": - value = Stratum; - return Stratum?.Any() == true; + value = _Stratum; + return _Stratum?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "stratum": - Stratum = (List)value; + Stratum = (List?)value!; return this; default: return base.SetValue(key, value); @@ -554,8 +542,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Stratum?.Any() == true) yield return new KeyValuePair("stratum",Stratum); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Stratum?.Any() == true) yield return new KeyValuePair("stratum",_Stratum); } } @@ -581,13 +569,13 @@ public partial class StratifierGroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("value", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Value + public Hl7.Fhir.Model.CodeableConcept? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.CodeableConcept _Value; + private Hl7.Fhir.Model.CodeableConcept? _Value; /// /// Stratifier component values. @@ -597,11 +585,11 @@ public Hl7.Fhir.Model.CodeableConcept Value [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; /// /// Population results in this stratum. @@ -611,39 +599,35 @@ public List Component [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this stratum achieved. /// [FhirElement("measureScore", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity MeasureScore + public Hl7.Fhir.Model.Quantity? MeasureScore { get { return _MeasureScore; } set { _MeasureScore = value; OnPropertyChanged("MeasureScore"); } } - private Hl7.Fhir.Model.Quantity _MeasureScore; + private Hl7.Fhir.Model.Quantity? _MeasureScore; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupComponent; - - if (dest == null) - { + if(other is not StratifierGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)Value.DeepCopyInternal(); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScore != null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)MeasureScore.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)_Value.DeepCopyInternal(); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScore is not null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)_MeasureScore.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -655,55 +639,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupComponent; - if(otherT == null) return false; + if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScore, otherT.MeasureScore)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScore; - return MeasureScore is not null; + value = _MeasureScore; + return _MeasureScore is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.CodeableConcept)value; + Value = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScore = (Hl7.Fhir.Model.Quantity)value; + MeasureScore = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -714,10 +698,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScore is not null) yield return new KeyValuePair("measureScore",MeasureScore); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScore is not null) yield return new KeyValuePair("measureScore",_MeasureScore); } } @@ -744,13 +728,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The stratum component value, e.g. male. @@ -758,26 +742,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Value + public Hl7.Fhir.Model.CodeableConcept? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.CodeableConcept _Value; + private Hl7.Fhir.Model.CodeableConcept? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -789,41 +769,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.CodeableConcept)value; + Value = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -834,8 +814,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -862,26 +842,26 @@ public partial class StratifierGroupPopulationComponent : Hl7.Fhir.Model.Backbon [FhirElement("code", Order=40)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -890,13 +870,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -908,27 +885,23 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SubjectResults + public Hl7.Fhir.Model.ResourceReference? SubjectResults { get { return _SubjectResults; } set { _SubjectResults = value; OnPropertyChanged("SubjectResults"); } } - private Hl7.Fhir.Model.ResourceReference _SubjectResults; + private Hl7.Fhir.Model.ResourceReference? _SubjectResults; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupPopulationComponent; - - if (dest == null) - { + if(other is not StratifierGroupPopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(SubjectResults != null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)SubjectResults.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_SubjectResults is not null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)_SubjectResults.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -940,48 +913,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupPopulationComponent; - if(otherT == null) return false; + if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(SubjectResults, otherT.SubjectResults)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "subjectResults": - value = SubjectResults; - return SubjectResults is not null; + value = _SubjectResults; + return _SubjectResults is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "subjectResults": - SubjectResults = (Hl7.Fhir.Model.ResourceReference)value; + SubjectResults = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -992,9 +965,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (SubjectResults is not null) yield return new KeyValuePair("subjectResults",SubjectResults); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_SubjectResults is not null) yield return new KeyValuePair("subjectResults",_SubjectResults); } } @@ -1007,11 +980,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// complete | pending | error. @@ -1021,13 +994,13 @@ public List Identifier [Binding("MeasureReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// complete | pending | error @@ -1036,13 +1009,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1055,13 +1025,13 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status [Binding("MeasureReportType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// individual | subject-list | summary | data-collection @@ -1070,13 +1040,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1087,28 +1054,25 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type [FhirElement("measure", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical MeasureElement + public Hl7.Fhir.Model.Canonical? MeasureElement { get { return _MeasureElement; } set { _MeasureElement = value; OnPropertyChanged("MeasureElement"); } } - private Hl7.Fhir.Model.Canonical _MeasureElement; + private Hl7.Fhir.Model.Canonical? _MeasureElement; /// /// What measure was calculated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Measure + public string? Measure { - get { return MeasureElement != null ? MeasureElement.Value : null; } + get => _MeasureElement?.Value; set { - if (value == null) - MeasureElement = null; - else - MeasureElement = new Hl7.Fhir.Model.Canonical(value); + MeasureElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Measure"); } } @@ -1120,41 +1084,38 @@ public string Measure [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Location","Device","RelatedPerson","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When the report was generated. /// [FhirElement("date", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the report was generated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1166,13 +1127,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reporter + public Hl7.Fhir.Model.ResourceReference? Reporter { get { return _Reporter; } set { _Reporter = value; OnPropertyChanged("Reporter"); } } - private Hl7.Fhir.Model.ResourceReference _Reporter; + private Hl7.Fhir.Model.ResourceReference? _Reporter; /// /// What period the report covers. @@ -1180,13 +1141,13 @@ public Hl7.Fhir.Model.ResourceReference Reporter [FhirElement("period", InSummary=true, Order=160)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// increase | decrease. @@ -1194,13 +1155,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("improvementNotation", InSummary=true, IsModifier=true, Order=170)] [Binding("MeasureImprovementNotation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ImprovementNotation + public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation { get { return _ImprovementNotation; } set { _ImprovementNotation = value; OnPropertyChanged("ImprovementNotation"); } } - private Hl7.Fhir.Model.CodeableConcept _ImprovementNotation; + private Hl7.Fhir.Model.CodeableConcept? _ImprovementNotation; /// /// Measure results for each group. @@ -1210,11 +1171,11 @@ public Hl7.Fhir.Model.CodeableConcept ImprovementNotation [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// What data was used to calculate the measure score. @@ -1226,35 +1187,31 @@ public List Group [DataMember] public List EvaluatedResource { - get { if(_EvaluatedResource==null) _EvaluatedResource = new List(); return _EvaluatedResource; } + get => _EvaluatedResource ?? new List(); set { _EvaluatedResource = value; OnPropertyChanged("EvaluatedResource"); } } - private List _EvaluatedResource; + private List? _EvaluatedResource; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MeasureReport; - - if (dest == null) - { + if(other is not MeasureReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(MeasureElement != null) dest.MeasureElement = (Hl7.Fhir.Model.Canonical)MeasureElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Reporter != null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)Reporter.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(ImprovementNotation != null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)ImprovementNotation.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(EvaluatedResource.Any()) dest.EvaluatedResource = new List(EvaluatedResource.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_MeasureElement is not null) dest.MeasureElement = (Hl7.Fhir.Model.Canonical)_MeasureElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Reporter is not null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)_Reporter.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_ImprovementNotation is not null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)_ImprovementNotation.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_EvaluatedResource is not null) dest.EvaluatedResource = new List(_EvaluatedResource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1266,104 +1223,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MeasureReport; - if(otherT == null) return false; + if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(MeasureElement, otherT.MeasureElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Reporter, otherT.Reporter)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(ImprovementNotation, otherT.ImprovementNotation)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.ListEquals(EvaluatedResource, otherT.EvaluatedResource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_MeasureElement, otherT._MeasureElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Reporter, otherT._Reporter)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.ListEquals(_EvaluatedResource, otherT._EvaluatedResource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "measure": - value = MeasureElement; - return MeasureElement is not null; + value = _MeasureElement; + return _MeasureElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "reporter": - value = Reporter; - return Reporter is not null; + value = _Reporter; + return _Reporter is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "improvementNotation": - value = ImprovementNotation; - return ImprovementNotation is not null; + value = _ImprovementNotation; + return _ImprovementNotation is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "evaluatedResource": - value = EvaluatedResource; - return EvaluatedResource?.Any() == true; + value = _EvaluatedResource; + return _EvaluatedResource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "measure": - MeasureElement = (Hl7.Fhir.Model.Canonical)value; + MeasureElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reporter": - Reporter = (Hl7.Fhir.Model.ResourceReference)value; + Reporter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "improvementNotation": - ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)value; + ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "evaluatedResource": - EvaluatedResource = (List)value; + EvaluatedResource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1374,17 +1331,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (MeasureElement is not null) yield return new KeyValuePair("measure",MeasureElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Reporter is not null) yield return new KeyValuePair("reporter",Reporter); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotation); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (EvaluatedResource?.Any() == true) yield return new KeyValuePair("evaluatedResource",EvaluatedResource); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_MeasureElement is not null) yield return new KeyValuePair("measure",_MeasureElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Reporter is not null) yield return new KeyValuePair("reporter",_Reporter); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotation); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_EvaluatedResource?.Any() == true) yield return new KeyValuePair("evaluatedResource",_EvaluatedResource); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Media.cs b/src/Hl7.Fhir.R4/Model/Generated/Media.cs index aa12f9a80..85e47159f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Media.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,11 +67,11 @@ public partial class Media : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Procedure that caused this media to be created. @@ -80,11 +83,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -96,11 +99,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -110,13 +113,13 @@ public List PartOf [Binding("MediaStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -125,13 +128,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -142,13 +142,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("type", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("MediaType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The type of acquisition equipment/process. @@ -156,13 +156,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("modality", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [Binding("MediaModality")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modality + public Hl7.Fhir.Model.CodeableConcept? Modality { get { return _Modality; } set { _Modality = value; OnPropertyChanged("Modality"); } } - private Hl7.Fhir.Model.CodeableConcept _Modality; + private Hl7.Fhir.Model.CodeableConcept? _Modality; /// /// Imaging view, e.g. Lateral or Antero-posterior. @@ -170,13 +170,13 @@ public Hl7.Fhir.Model.CodeableConcept Modality [FhirElement("view", InSummary=true, Order=150)] [Binding("MediaView")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept View + public Hl7.Fhir.Model.CodeableConcept? View { get { return _View; } set { _View = value; OnPropertyChanged("View"); } } - private Hl7.Fhir.Model.CodeableConcept _View; + private Hl7.Fhir.Model.CodeableConcept? _View; /// /// Who/What this Media is a record of. @@ -185,13 +185,13 @@ public Hl7.Fhir.Model.CodeableConcept View [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Group","Device","Specimen","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter associated with media. @@ -200,13 +200,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When Media was collected. @@ -215,26 +215,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Created + public Hl7.Fhir.Model.DataType? Created { get { return _Created; } set { _Created = value; OnPropertyChanged("Created"); } } - private Hl7.Fhir.Model.DataType _Created; + private Hl7.Fhir.Model.DataType? _Created; /// /// Date/Time this version was made available. /// [FhirElement("issued", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// Date/Time this version was made available @@ -243,13 +243,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -261,13 +258,13 @@ public DateTimeOffset? Issued [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Operator + public Hl7.Fhir.Model.ResourceReference? Operator { get { return _Operator; } set { _Operator = value; OnPropertyChanged("Operator"); } } - private Hl7.Fhir.Model.ResourceReference _Operator; + private Hl7.Fhir.Model.ResourceReference? _Operator; /// /// Why was event performed?. @@ -278,11 +275,11 @@ public Hl7.Fhir.Model.ResourceReference Operator [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Observed body part. @@ -290,41 +287,38 @@ public List ReasonCode [FhirElement("bodySite", InSummary=true, Order=220)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Name of the device/manufacturer. /// [FhirElement("deviceName", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceNameElement + public Hl7.Fhir.Model.FhirString? DeviceNameElement { get { return _DeviceNameElement; } set { _DeviceNameElement = value; OnPropertyChanged("DeviceNameElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceNameElement; + private Hl7.Fhir.Model.FhirString? _DeviceNameElement; /// /// Name of the device/manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceName + public string? DeviceName { - get { return DeviceNameElement != null ? DeviceNameElement.Value : null; } + get => _DeviceNameElement?.Value; set { - if (value == null) - DeviceNameElement = null; - else - DeviceNameElement = new Hl7.Fhir.Model.FhirString(value); + DeviceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceName"); } } @@ -336,26 +330,26 @@ public string DeviceName [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Height of the image in pixels (photo/video). /// [FhirElement("height", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.PositiveInt HeightElement + public Hl7.Fhir.Model.PositiveInt? HeightElement { get { return _HeightElement; } set { _HeightElement = value; OnPropertyChanged("HeightElement"); } } - private Hl7.Fhir.Model.PositiveInt _HeightElement; + private Hl7.Fhir.Model.PositiveInt? _HeightElement; /// /// Height of the image in pixels (photo/video) @@ -364,13 +358,10 @@ public Hl7.Fhir.Model.PositiveInt HeightElement [IgnoreDataMember] public int? Height { - get { return HeightElement != null ? HeightElement.Value : null; } + get => _HeightElement?.Value; set { - if (value == null) - HeightElement = null; - else - HeightElement = new Hl7.Fhir.Model.PositiveInt(value); + HeightElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Height"); } } @@ -380,13 +371,13 @@ public int? Height /// [FhirElement("width", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.PositiveInt WidthElement + public Hl7.Fhir.Model.PositiveInt? WidthElement { get { return _WidthElement; } set { _WidthElement = value; OnPropertyChanged("WidthElement"); } } - private Hl7.Fhir.Model.PositiveInt _WidthElement; + private Hl7.Fhir.Model.PositiveInt? _WidthElement; /// /// Width of the image in pixels (photo/video) @@ -395,13 +386,10 @@ public Hl7.Fhir.Model.PositiveInt WidthElement [IgnoreDataMember] public int? Width { - get { return WidthElement != null ? WidthElement.Value : null; } + get => _WidthElement?.Value; set { - if (value == null) - WidthElement = null; - else - WidthElement = new Hl7.Fhir.Model.PositiveInt(value); + WidthElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Width"); } } @@ -411,13 +399,13 @@ public int? Width /// [FhirElement("frames", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FramesElement + public Hl7.Fhir.Model.PositiveInt? FramesElement { get { return _FramesElement; } set { _FramesElement = value; OnPropertyChanged("FramesElement"); } } - private Hl7.Fhir.Model.PositiveInt _FramesElement; + private Hl7.Fhir.Model.PositiveInt? _FramesElement; /// /// Number of frames if > 1 (photo) @@ -426,13 +414,10 @@ public Hl7.Fhir.Model.PositiveInt FramesElement [IgnoreDataMember] public int? Frames { - get { return FramesElement != null ? FramesElement.Value : null; } + get => _FramesElement?.Value; set { - if (value == null) - FramesElement = null; - else - FramesElement = new Hl7.Fhir.Model.PositiveInt(value); + FramesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Frames"); } } @@ -442,13 +427,13 @@ public int? Frames /// [FhirElement("duration", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationElement + public Hl7.Fhir.Model.FhirDecimal? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationElement; /// /// Length in seconds (audio / video) @@ -457,13 +442,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement [IgnoreDataMember] public decimal? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Duration"); } } @@ -474,13 +456,13 @@ public decimal? Duration [FhirElement("content", InSummary=true, Order=290)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Attachment Content + public Hl7.Fhir.Model.Attachment? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.Attachment _Content; + private Hl7.Fhir.Model.Attachment? _Content; /// /// Comments made about the media. @@ -490,46 +472,42 @@ public Hl7.Fhir.Model.Attachment Content [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Media; - - if (dest == null) - { + if(other is not Media dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Modality != null) dest.Modality = (Hl7.Fhir.Model.CodeableConcept)Modality.DeepCopyInternal(); - if(View != null) dest.View = (Hl7.Fhir.Model.CodeableConcept)View.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Created != null) dest.Created = (Hl7.Fhir.Model.DataType)Created.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Operator != null) dest.Operator = (Hl7.Fhir.Model.ResourceReference)Operator.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(DeviceNameElement != null) dest.DeviceNameElement = (Hl7.Fhir.Model.FhirString)DeviceNameElement.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(HeightElement != null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)HeightElement.DeepCopyInternal(); - if(WidthElement != null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)WidthElement.DeepCopyInternal(); - if(FramesElement != null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)FramesElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal(); - if(Content != null) dest.Content = (Hl7.Fhir.Model.Attachment)Content.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = (Hl7.Fhir.Model.CodeableConcept)_Modality.DeepCopyInternal(); + if(_View is not null) dest.View = (Hl7.Fhir.Model.CodeableConcept)_View.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Created is not null) dest.Created = (Hl7.Fhir.Model.DataType)_Created.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Operator is not null) dest.Operator = (Hl7.Fhir.Model.ResourceReference)_Operator.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_DeviceNameElement is not null) dest.DeviceNameElement = (Hl7.Fhir.Model.FhirString)_DeviceNameElement.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_HeightElement is not null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)_HeightElement.DeepCopyInternal(); + if(_WidthElement is not null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)_WidthElement.DeepCopyInternal(); + if(_FramesElement is not null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)_FramesElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.Attachment)_Content.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -541,181 +519,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Media; - if(otherT == null) return false; + if(other is not Media otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(View, otherT.View)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Created, otherT.Created)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Operator, otherT.Operator)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(DeviceNameElement, otherT.DeviceNameElement)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(HeightElement, otherT.HeightElement)) return false; - if(!comparer.Equals(WidthElement, otherT.WidthElement)) return false; - if(!comparer.Equals(FramesElement, otherT.FramesElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_View, otherT._View)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Created, otherT._Created)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Operator, otherT._Operator)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_DeviceNameElement, otherT._DeviceNameElement)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_HeightElement, otherT._HeightElement)) return false; + if(!comparer.Equals(_WidthElement, otherT._WidthElement)) return false; + if(!comparer.Equals(_FramesElement, otherT._FramesElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "modality": - value = Modality; - return Modality is not null; + value = _Modality; + return _Modality is not null; case "view": - value = View; - return View is not null; + value = _View; + return _View is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "created": - value = Created; - return Created is not null; + value = _Created; + return _Created is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "operator": - value = Operator; - return Operator is not null; + value = _Operator; + return _Operator is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "deviceName": - value = DeviceNameElement; - return DeviceNameElement is not null; + value = _DeviceNameElement; + return _DeviceNameElement is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "height": - value = HeightElement; - return HeightElement is not null; + value = _HeightElement; + return _HeightElement is not null; case "width": - value = WidthElement; - return WidthElement is not null; + value = _WidthElement; + return _WidthElement is not null; case "frames": - value = FramesElement; - return FramesElement is not null; + value = _FramesElement; + return _FramesElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modality": - Modality = (Hl7.Fhir.Model.CodeableConcept)value; + Modality = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "view": - View = (Hl7.Fhir.Model.CodeableConcept)value; + View = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - Created = (Hl7.Fhir.Model.DataType)value; + Created = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "operator": - Operator = (Hl7.Fhir.Model.ResourceReference)value; + Operator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "deviceName": - DeviceNameElement = (Hl7.Fhir.Model.FhirString)value; + DeviceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "height": - HeightElement = (Hl7.Fhir.Model.PositiveInt)value; + HeightElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "width": - WidthElement = (Hl7.Fhir.Model.PositiveInt)value; + WidthElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "frames": - FramesElement = (Hl7.Fhir.Model.PositiveInt)value; + FramesElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "content": - Content = (Hl7.Fhir.Model.Attachment)value; + Content = (Hl7.Fhir.Model.Attachment?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -726,28 +704,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Modality is not null) yield return new KeyValuePair("modality",Modality); - if (View is not null) yield return new KeyValuePair("view",View); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Created is not null) yield return new KeyValuePair("created",Created); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Operator is not null) yield return new KeyValuePair("operator",Operator); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (DeviceNameElement is not null) yield return new KeyValuePair("deviceName",DeviceNameElement); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (HeightElement is not null) yield return new KeyValuePair("height",HeightElement); - if (WidthElement is not null) yield return new KeyValuePair("width",WidthElement); - if (FramesElement is not null) yield return new KeyValuePair("frames",FramesElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (Content is not null) yield return new KeyValuePair("content",Content); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Modality is not null) yield return new KeyValuePair("modality",_Modality); + if (_View is not null) yield return new KeyValuePair("view",_View); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Created is not null) yield return new KeyValuePair("created",_Created); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Operator is not null) yield return new KeyValuePair("operator",_Operator); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_DeviceNameElement is not null) yield return new KeyValuePair("deviceName",_DeviceNameElement); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_HeightElement is not null) yield return new KeyValuePair("height",_HeightElement); + if (_WidthElement is not null) yield return new KeyValuePair("width",_WidthElement); + if (_FramesElement is not null) yield return new KeyValuePair("frames",_FramesElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_Content is not null) yield return new KeyValuePair("content",_Content); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Medication.cs b/src/Hl7.Fhir.R4/Model/Generated/Medication.cs index 73e15c38d..42a34fd89 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Medication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Medication","http://hl7.org/fhir/StructureDefinition/Medication")] - public partial class Medication : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Medication : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -113,26 +116,26 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// Active ingredient indicator. /// [FhirElement("isActive", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsActiveElement + public Hl7.Fhir.Model.FhirBoolean? IsActiveElement { get { return _IsActiveElement; } set { _IsActiveElement = value; OnPropertyChanged("IsActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _IsActiveElement; /// /// Active ingredient indicator @@ -141,13 +144,10 @@ public Hl7.Fhir.Model.FhirBoolean IsActiveElement [IgnoreDataMember] public bool? IsActive { - get { return IsActiveElement != null ? IsActiveElement.Value : null; } + get => _IsActiveElement?.Value; set { - if (value == null) - IsActiveElement = null; - else - IsActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsActive"); } } @@ -157,27 +157,23 @@ public bool? IsActive /// [FhirElement("strength", Order=60)] [DataMember] - public Hl7.Fhir.Model.Ratio Strength + public Hl7.Fhir.Model.Ratio? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.Ratio _Strength; + private Hl7.Fhir.Model.Ratio? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(IsActiveElement != null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)IsActiveElement.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.Ratio)Strength.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_IsActiveElement is not null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)_IsActiveElement.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.Ratio)_Strength.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -189,48 +185,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(IsActiveElement, otherT.IsActiveElement)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "isActive": - value = IsActiveElement; - return IsActiveElement is not null; + value = _IsActiveElement; + return _IsActiveElement is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "isActive": - IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.Ratio)value; + Strength = (Hl7.Fhir.Model.Ratio?)value; return this; default: return base.SetValue(key, value); @@ -241,9 +237,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (IsActiveElement is not null) yield return new KeyValuePair("isActive",IsActiveElement); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_IsActiveElement is not null) yield return new KeyValuePair("isActive",_IsActiveElement); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); } } @@ -269,28 +265,25 @@ public partial class BatchComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("lotNumber", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Identifier assigned to batch /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -300,44 +293,37 @@ public string LotNumber /// [FhirElement("expirationDate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// When batch will expire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BatchComponent; - - if (dest == null) - { + if(other is not BatchComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,41 +335,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BatchComponent; - if(otherT == null) return false; + if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -394,8 +380,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); } } @@ -408,11 +394,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Codes that identify this medication. @@ -420,13 +406,13 @@ public List Identifier [FhirElement("code", InSummary=true, Order=100, FiveWs="FiveWs.class")] [Binding("MedicationFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | inactive | entered-in-error. @@ -435,13 +421,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("MedicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -450,13 +436,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Medication.MedicationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -468,13 +451,13 @@ public Hl7.Fhir.Model.Medication.MedicationStatusCodes? Status [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// powder | tablets | capsule +. @@ -482,26 +465,26 @@ public Hl7.Fhir.Model.ResourceReference Manufacturer [FhirElement("form", Order=130)] [Binding("MedicationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Amount of drug in package. /// [FhirElement("amount", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Ratio Amount + public Hl7.Fhir.Model.Ratio? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Ratio _Amount; + private Hl7.Fhir.Model.Ratio? _Amount; /// /// Active or inactive ingredient. @@ -511,48 +494,44 @@ public Hl7.Fhir.Model.Ratio Amount [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Details about packaged medications. /// [FhirElement("batch", Order=160)] [DataMember] - public Hl7.Fhir.Model.Medication.BatchComponent Batch + public Hl7.Fhir.Model.Medication.BatchComponent? Batch { get { return _Batch; } set { _Batch = value; OnPropertyChanged("Batch"); } } - private Hl7.Fhir.Model.Medication.BatchComponent _Batch; + private Hl7.Fhir.Model.Medication.BatchComponent? _Batch; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Medication; - - if (dest == null) - { + if(other is not Medication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Ratio)Amount.DeepCopyInternal(); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Batch != null) dest.Batch = (Hl7.Fhir.Model.Medication.BatchComponent)Batch.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Ratio)_Amount.DeepCopyInternal(); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Batch is not null) dest.Batch = (Hl7.Fhir.Model.Medication.BatchComponent)_Batch.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -564,83 +543,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Medication; - if(otherT == null) return false; + if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(Batch, otherT.Batch)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_Batch, otherT._Batch)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "batch": - value = Batch; - return Batch is not null; + value = _Batch; + return _Batch is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Ratio)value; + Amount = (Hl7.Fhir.Model.Ratio?)value; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "batch": - Batch = (Hl7.Fhir.Model.Medication.BatchComponent)value; + Batch = (Hl7.Fhir.Model.Medication.BatchComponent?)value; return this; default: return base.SetValue(key, value); @@ -651,14 +630,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Batch is not null) yield return new KeyValuePair("batch",Batch); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Batch is not null) yield return new KeyValuePair("batch",_Batch); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs index 411c730e2..04021a4f1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MedicationAdministration","http://hl7.org/fhir/StructureDefinition/MedicationAdministration")] - public partial class MedicationAdministration : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class MedicationAdministration : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -133,13 +136,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("MedicationAdministrationPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the medication administration. @@ -149,26 +152,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,41 +179,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -225,8 +224,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -252,28 +251,25 @@ public partial class DosageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("text", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -284,13 +280,13 @@ public string Text [FhirElement("site", Order=50)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// Path of substance into body. @@ -298,13 +294,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=60)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// How drug was administered. @@ -312,26 +308,26 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", Order=70)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication per dose. /// [FhirElement("dose", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Dose + public Hl7.Fhir.Model.Quantity? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.Quantity _Dose; + private Hl7.Fhir.Model.Quantity? _Dose; /// /// Dose quantity per unit of time. @@ -340,30 +336,26 @@ public Hl7.Fhir.Model.Quantity Dose [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as DosageComponent; - - if (dest == null) - { + if(other is not DosageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.Quantity)Dose.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.Quantity)_Dose.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -375,69 +367,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosageComponent; - if(otherT == null) return false; + if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.Quantity)value; + Dose = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -448,12 +440,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -466,11 +458,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -480,24 +472,24 @@ public List Identifier [DataMember] public List InstantiatesElement { - get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; } + get => _InstantiatesElement ?? new List(); set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } - private List _InstantiatesElement; + private List? _InstantiatesElement; /// /// Instantiates protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Instantiates + public IEnumerable? Instantiates { - get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; } + get => _InstantiatesElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesElement = null; + InstantiatesElement = null!; else InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Instantiates"); @@ -514,11 +506,11 @@ public IEnumerable Instantiates [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | not-done | on-hold | completed | entered-in-error | stopped | unknown. @@ -528,13 +520,13 @@ public List PartOf [Binding("MedicationAdministrationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | not-done | on-hold | completed | entered-in-error | stopped | unknown @@ -543,13 +535,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -563,11 +552,11 @@ public Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCod [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// Type of medication usage. @@ -575,13 +564,13 @@ public List StatusReason [FhirElement("category", Order=140)] [Binding("MedicationAdministrationCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What was administered. @@ -593,13 +582,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who received medication. @@ -609,13 +598,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode of Care administered as part of. @@ -624,13 +613,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Additional information to support administration. @@ -642,11 +631,11 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Start and end time of administration. @@ -656,13 +645,13 @@ public List SupportingInformation [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// Who performed the medication administration and what they did. @@ -672,11 +661,11 @@ public Hl7.Fhir.Model.DataType Effective [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Reason administration performed. @@ -687,11 +676,11 @@ public List Performe [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or observation that supports why the medication was administered. @@ -703,11 +692,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Request administration performed against. @@ -716,13 +705,13 @@ public List ReasonReference [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Device used to administer. @@ -734,11 +723,11 @@ public Hl7.Fhir.Model.ResourceReference Request [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// Information about the administration. @@ -748,24 +737,24 @@ public List Device [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Details of how medication was taken. /// [FhirElement("dosage", Order=260)] [DataMember] - public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage + public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage { get { return _Dosage; } set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private Hl7.Fhir.Model.MedicationAdministration.DosageComponent _Dosage; + private Hl7.Fhir.Model.MedicationAdministration.DosageComponent? _Dosage; /// /// A list of events of interest in the lifecycle. @@ -777,46 +766,42 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.DataType ICoded.Code { get => Medication; set => Medication = value; } - IEnumerable ICoded.ToCodings() => Medication.ToCodings(); + Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } + IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationAdministration; - - if (dest == null) - { + if(other is not MedicationAdministration dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Dosage != null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)Dosage.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesElement is not null) dest.InstantiatesElement = new List(_InstantiatesElement.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)_Dosage.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -828,160 +813,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationAdministration; - if(otherT == null) return false; + if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesElement, otherT.InstantiatesElement)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiates": - value = InstantiatesElement; - return InstantiatesElement?.Any() == true; + value = _InstantiatesElement; + return _InstantiatesElement?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosage": - value = Dosage; - return Dosage is not null; + value = _Dosage; + return _Dosage is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiates": - InstantiatesElement = (List)value; + InstantiatesElement = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosage": - Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)value; + Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -992,25 +977,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",InstantiatesElement); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Dosage is not null) yield return new KeyValuePair("dosage",Dosage); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",_InstantiatesElement); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Dosage is not null) yield return new KeyValuePair("dosage",_Dosage); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs index fbbed55ef..043f65949 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MedicationDispense","http://hl7.org/fhir/StructureDefinition/MedicationDispense")] - public partial class MedicationDispense : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class MedicationDispense : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -145,13 +148,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("MedicationDispensePerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual who was performing. @@ -161,26 +164,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -192,41 +191,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -237,8 +236,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -265,13 +264,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("wasSubstituted", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement + public Hl7.Fhir.Model.FhirBoolean? WasSubstitutedElement { get { return _WasSubstitutedElement; } set { _WasSubstitutedElement = value; OnPropertyChanged("WasSubstitutedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WasSubstitutedElement; + private Hl7.Fhir.Model.FhirBoolean? _WasSubstitutedElement; /// /// Whether a substitution was or was not performed on the dispense @@ -280,13 +279,10 @@ public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement [IgnoreDataMember] public bool? WasSubstituted { - get { return WasSubstitutedElement != null ? WasSubstitutedElement.Value : null; } + get => _WasSubstitutedElement?.Value; set { - if (value == null) - WasSubstitutedElement = null; - else - WasSubstitutedElement = new Hl7.Fhir.Model.FhirBoolean(value); + WasSubstitutedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WasSubstituted"); } } @@ -297,13 +293,13 @@ public bool? WasSubstituted [FhirElement("type", Order=50)] [Binding("MedicationIntendedSubstitutionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Why was substitution made. @@ -314,11 +310,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Who is responsible for the substitution. @@ -330,26 +326,22 @@ public List Reason [DataMember] public List ResponsibleParty { - get { if(_ResponsibleParty==null) _ResponsibleParty = new List(); return _ResponsibleParty; } + get => _ResponsibleParty ?? new List(); set { _ResponsibleParty = value; OnPropertyChanged("ResponsibleParty"); } } - private List _ResponsibleParty; + private List? _ResponsibleParty; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(WasSubstitutedElement != null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)WasSubstitutedElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(ResponsibleParty.Any()) dest.ResponsibleParty = new List(ResponsibleParty.DeepCopyInternal()); + if(_WasSubstitutedElement is not null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)_WasSubstitutedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_ResponsibleParty is not null) dest.ResponsibleParty = new List(_ResponsibleParty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -361,55 +353,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(WasSubstitutedElement, otherT.WasSubstitutedElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(ResponsibleParty, otherT.ResponsibleParty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_ResponsibleParty, otherT._ResponsibleParty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "wasSubstituted": - value = WasSubstitutedElement; - return WasSubstitutedElement is not null; + value = _WasSubstitutedElement; + return _WasSubstitutedElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "responsibleParty": - value = ResponsibleParty; - return ResponsibleParty?.Any() == true; + value = _ResponsibleParty; + return _ResponsibleParty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "wasSubstituted": - WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)value; + WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "responsibleParty": - ResponsibleParty = (List)value; + ResponsibleParty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -420,10 +412,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",WasSubstitutedElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (ResponsibleParty?.Any() == true) yield return new KeyValuePair("responsibleParty",ResponsibleParty); + if (_WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",_WasSubstitutedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_ResponsibleParty?.Any() == true) yield return new KeyValuePair("responsibleParty",_ResponsibleParty); } } @@ -436,11 +428,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Event that dispense is part of. @@ -452,11 +444,11 @@ public List Identifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown. @@ -466,13 +458,13 @@ public List PartOf [Binding("MedicationDispenseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown @@ -481,13 +473,10 @@ public Code Sta [IgnoreDataMember] public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -501,13 +490,13 @@ public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes? Status [References("DetectedIssue")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType StatusReason + public Hl7.Fhir.Model.DataType? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.DataType _StatusReason; + private Hl7.Fhir.Model.DataType? _StatusReason; /// /// Type of medication dispense. @@ -515,13 +504,13 @@ public Hl7.Fhir.Model.DataType StatusReason [FhirElement("category", Order=130)] [Binding("MedicationDispenseCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What medication was supplied. @@ -533,13 +522,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who the dispense is for. @@ -548,13 +537,13 @@ public Hl7.Fhir.Model.DataType Medication [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with event. @@ -563,13 +552,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Information that supports the dispensing of the medication. @@ -581,11 +570,11 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Who performed event. @@ -595,11 +584,11 @@ public List SupportingInformation [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the dispense occurred. @@ -608,13 +597,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Medication order that authorizes the dispense. @@ -626,11 +615,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List AuthorizingPrescription { - get { if(_AuthorizingPrescription==null) _AuthorizingPrescription = new List(); return _AuthorizingPrescription; } + get => _AuthorizingPrescription ?? new List(); set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } - private List _AuthorizingPrescription; + private List? _AuthorizingPrescription; /// /// Trial fill, partial fill, emergency fill, etc. @@ -638,67 +627,64 @@ public List AuthorizingPrescription [FhirElement("type", Order=210)] [Binding("MedicationDispenseType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount dispensed. /// [FhirElement("quantity", Order=220)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Amount of medication expressed as a timing amount. /// [FhirElement("daysSupply", Order=230)] [DataMember] - public Hl7.Fhir.Model.Quantity DaysSupply + public Hl7.Fhir.Model.Quantity? DaysSupply { get { return _DaysSupply; } set { _DaysSupply = value; OnPropertyChanged("DaysSupply"); } } - private Hl7.Fhir.Model.Quantity _DaysSupply; + private Hl7.Fhir.Model.Quantity? _DaysSupply; /// /// When product was packaged and reviewed. /// [FhirElement("whenPrepared", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenPreparedElement + public Hl7.Fhir.Model.FhirDateTime? WhenPreparedElement { get { return _WhenPreparedElement; } set { _WhenPreparedElement = value; OnPropertyChanged("WhenPreparedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenPreparedElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenPreparedElement; /// /// When product was packaged and reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenPrepared + public string? WhenPrepared { - get { return WhenPreparedElement != null ? WhenPreparedElement.Value : null; } + get => _WhenPreparedElement?.Value; set { - if (value == null) - WhenPreparedElement = null; - else - WhenPreparedElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenPreparedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenPrepared"); } } @@ -708,28 +694,25 @@ public string WhenPrepared /// [FhirElement("whenHandedOver", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenHandedOverElement + public Hl7.Fhir.Model.FhirDateTime? WhenHandedOverElement { get { return _WhenHandedOverElement; } set { _WhenHandedOverElement = value; OnPropertyChanged("WhenHandedOverElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenHandedOverElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenHandedOverElement; /// /// When product was given out /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenHandedOver + public string? WhenHandedOver { - get { return WhenHandedOverElement != null ? WhenHandedOverElement.Value : null; } + get => _WhenHandedOverElement?.Value; set { - if (value == null) - WhenHandedOverElement = null; - else - WhenHandedOverElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenHandedOverElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenHandedOver"); } } @@ -741,13 +724,13 @@ public string WhenHandedOver [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who collected the medication. @@ -759,11 +742,11 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; /// /// Information about the dispense. @@ -773,11 +756,11 @@ public List Receiver [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// How the medication is to be used by the patient or administered by the caregiver. @@ -787,24 +770,24 @@ public List Note [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Whether a substitution was performed on the dispense. /// [FhirElement("substitution", Order=300)] [DataMember] - public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? _Substitution; /// /// Clinical issue with action. @@ -816,11 +799,11 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution [DataMember] public List DetectedIssue { - get { if(_DetectedIssue==null) _DetectedIssue = new List(); return _DetectedIssue; } + get => _DetectedIssue ?? new List(); set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } - private List _DetectedIssue; + private List? _DetectedIssue; /// /// A list of relevant lifecycle events. @@ -832,51 +815,47 @@ public List DetectedIssue [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.DataType ICoded.Code { get => Medication; set => Medication = value; } - IEnumerable ICoded.ToCodings() => Medication.ToCodings(); + Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } + IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationDispense; - - if (dest == null) - { + if(other is not MedicationDispense dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.DataType)StatusReason.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(AuthorizingPrescription.Any()) dest.AuthorizingPrescription = new List(AuthorizingPrescription.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(DaysSupply != null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)DaysSupply.DeepCopyInternal(); - if(WhenPreparedElement != null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)WhenPreparedElement.DeepCopyInternal(); - if(WhenHandedOverElement != null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(DetectedIssue.Any()) dest.DetectedIssue = new List(DetectedIssue.DeepCopyInternal()); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.DataType)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_AuthorizingPrescription is not null) dest.AuthorizingPrescription = new List(_AuthorizingPrescription.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_DaysSupply is not null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)_DaysSupply.DeepCopyInternal(); + if(_WhenPreparedElement is not null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)_WhenPreparedElement.DeepCopyInternal(); + if(_WhenHandedOverElement is not null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)_WhenHandedOverElement.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_DetectedIssue is not null) dest.DetectedIssue = new List(_DetectedIssue.DeepCopyInternal()); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -888,195 +867,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationDispense; - if(otherT == null) return false; + if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(AuthorizingPrescription, otherT.AuthorizingPrescription)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(DaysSupply, otherT.DaysSupply)) return false; - if(!comparer.Equals(WhenPreparedElement, otherT.WhenPreparedElement)) return false; - if(!comparer.Equals(WhenHandedOverElement, otherT.WhenHandedOverElement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(DetectedIssue, otherT.DetectedIssue)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_AuthorizingPrescription, otherT._AuthorizingPrescription)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_DaysSupply, otherT._DaysSupply)) return false; + if(!comparer.Equals(_WhenPreparedElement, otherT._WhenPreparedElement)) return false; + if(!comparer.Equals(_WhenHandedOverElement, otherT._WhenHandedOverElement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "authorizingPrescription": - value = AuthorizingPrescription; - return AuthorizingPrescription?.Any() == true; + value = _AuthorizingPrescription; + return _AuthorizingPrescription?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "daysSupply": - value = DaysSupply; - return DaysSupply is not null; + value = _DaysSupply; + return _DaysSupply is not null; case "whenPrepared": - value = WhenPreparedElement; - return WhenPreparedElement is not null; + value = _WhenPreparedElement; + return _WhenPreparedElement is not null; case "whenHandedOver": - value = WhenHandedOverElement; - return WhenHandedOverElement is not null; + value = _WhenHandedOverElement; + return _WhenHandedOverElement is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "detectedIssue": - value = DetectedIssue; - return DetectedIssue?.Any() == true; + value = _DetectedIssue; + return _DetectedIssue?.Any() == true; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.DataType)value; + StatusReason = (Hl7.Fhir.Model.DataType?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authorizingPrescription": - AuthorizingPrescription = (List)value; + AuthorizingPrescription = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "daysSupply": - DaysSupply = (Hl7.Fhir.Model.Quantity)value; + DaysSupply = (Hl7.Fhir.Model.Quantity?)value; return this; case "whenPrepared": - WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "whenHandedOver": - WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent?)value; return this; case "detectedIssue": - DetectedIssue = (List)value; + DetectedIssue = (List?)value!; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1087,30 +1066,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",AuthorizingPrescription); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (DaysSupply is not null) yield return new KeyValuePair("daysSupply",DaysSupply); - if (WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",WhenPreparedElement); - if (WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",WhenHandedOverElement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",DetectedIssue); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",_AuthorizingPrescription); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_DaysSupply is not null) yield return new KeyValuePair("daysSupply",_DaysSupply); + if (_WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",_WhenPreparedElement); + if (_WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",_WhenHandedOverElement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",_DetectedIssue); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs index 337946d82..42695a355 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MedicationKnowledge","http://hl7.org/fhir/StructureDefinition/MedicationKnowledge")] - public partial class MedicationKnowledge : Hl7.Fhir.Model.DomainResource, ICoded + public partial class MedicationKnowledge : Hl7.Fhir.Model.DomainResource, ICoded { /// /// FHIR Type Name @@ -109,13 +112,13 @@ public partial class RelatedMedicationKnowledgeComponent : Hl7.Fhir.Model.Backbo [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Associated documentation about the associated medication knowledge. @@ -127,24 +130,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedMedicationKnowledgeComponent; - - if (dest == null) - { + if(other is not RelatedMedicationKnowledgeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -156,41 +155,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedMedicationKnowledgeComponent; - if(otherT == null) return false; + if(other is not RelatedMedicationKnowledgeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; default: return base.SetValue(key, value); @@ -201,8 +200,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); } } @@ -225,13 +224,13 @@ public partial class MonographComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Associated documentation about the medication. @@ -240,26 +239,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("DocumentReference","Media")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as MonographComponent; - - if (dest == null) - { + if(other is not MonographComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -271,41 +266,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonographComponent; - if(otherT == null) return false; + if(other is not MonographComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -316,8 +311,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Source is not null) yield return new KeyValuePair("source",Source); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Source is not null) yield return new KeyValuePair("source",_Source); } } @@ -347,26 +342,26 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// Active ingredient indicator. /// [FhirElement("isActive", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsActiveElement + public Hl7.Fhir.Model.FhirBoolean? IsActiveElement { get { return _IsActiveElement; } set { _IsActiveElement = value; OnPropertyChanged("IsActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _IsActiveElement; /// /// Active ingredient indicator @@ -375,13 +370,10 @@ public Hl7.Fhir.Model.FhirBoolean IsActiveElement [IgnoreDataMember] public bool? IsActive { - get { return IsActiveElement != null ? IsActiveElement.Value : null; } + get => _IsActiveElement?.Value; set { - if (value == null) - IsActiveElement = null; - else - IsActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsActive"); } } @@ -391,27 +383,23 @@ public bool? IsActive /// [FhirElement("strength", Order=60)] [DataMember] - public Hl7.Fhir.Model.Ratio Strength + public Hl7.Fhir.Model.Ratio? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.Ratio _Strength; + private Hl7.Fhir.Model.Ratio? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(IsActiveElement != null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)IsActiveElement.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.Ratio)Strength.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_IsActiveElement is not null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)_IsActiveElement.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.Ratio)_Strength.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -423,48 +411,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(IsActiveElement, otherT.IsActiveElement)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "isActive": - value = IsActiveElement; - return IsActiveElement is not null; + value = _IsActiveElement; + return _IsActiveElement is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "isActive": - IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.Ratio)value; + Strength = (Hl7.Fhir.Model.Ratio?)value; return this; default: return base.SetValue(key, value); @@ -475,9 +463,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (IsActiveElement is not null) yield return new KeyValuePair("isActive",IsActiveElement); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_IsActiveElement is not null) yield return new KeyValuePair("isActive",_IsActiveElement); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); } } @@ -504,41 +492,38 @@ public partial class CostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The source or owner for the price information. /// [FhirElement("source", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// The source or owner for the price information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -549,27 +534,23 @@ public string Source [FhirElement("cost", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Cost + public Hl7.Fhir.Model.Money? Cost { get { return _Cost; } set { _Cost = value; OnPropertyChanged("Cost"); } } - private Hl7.Fhir.Model.Money _Cost; + private Hl7.Fhir.Model.Money? _Cost; protected internal override void CopyToInternal(Base other) { - var dest = other as CostComponent; - - if (dest == null) - { + if(other is not CostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(Cost != null) dest.Cost = (Hl7.Fhir.Model.Money)Cost.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = (Hl7.Fhir.Model.Money)_Cost.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -581,48 +562,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostComponent; - if(otherT == null) return false; + if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(Cost, otherT.Cost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_Cost, otherT._Cost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "cost": - value = Cost; - return Cost is not null; + value = _Cost; + return _Cost is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cost": - Cost = (Hl7.Fhir.Model.Money)value; + Cost = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -633,9 +614,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (Cost is not null) yield return new KeyValuePair("cost",Cost); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_Cost is not null) yield return new KeyValuePair("cost",_Cost); } } @@ -661,57 +642,50 @@ public partial class MonitoringProgramComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Name of the reviewing program. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the reviewing program /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MonitoringProgramComponent; - - if (dest == null) - { + if(other is not MonitoringProgramComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -723,41 +697,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonitoringProgramComponent; - if(otherT == null) return false; + if(other is not MonitoringProgramComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -768,8 +742,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); } } @@ -798,11 +772,11 @@ public partial class AdministrationGuidelinesComponent : Hl7.Fhir.Model.Backbone [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// Indication for use that apply to the specific administration guidelines. @@ -812,13 +786,13 @@ public List Dosage [References("ObservationDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Indication + public Hl7.Fhir.Model.DataType? Indication { get { return _Indication; } set { _Indication = value; OnPropertyChanged("Indication"); } } - private Hl7.Fhir.Model.DataType _Indication; + private Hl7.Fhir.Model.DataType? _Indication; /// /// Characteristics of the patient that are relevant to the administration guidelines. @@ -828,25 +802,21 @@ public Hl7.Fhir.Model.DataType Indication [DataMember] public List PatientCharacteristics { - get { if(_PatientCharacteristics==null) _PatientCharacteristics = new List(); return _PatientCharacteristics; } + get => _PatientCharacteristics ?? new List(); set { _PatientCharacteristics = value; OnPropertyChanged("PatientCharacteristics"); } } - private List _PatientCharacteristics; + private List? _PatientCharacteristics; protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrationGuidelinesComponent; - - if (dest == null) - { + if(other is not AdministrationGuidelinesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(Indication != null) dest.Indication = (Hl7.Fhir.Model.DataType)Indication.DeepCopyInternal(); - if(PatientCharacteristics.Any()) dest.PatientCharacteristics = new List(PatientCharacteristics.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_Indication is not null) dest.Indication = (Hl7.Fhir.Model.DataType)_Indication.DeepCopyInternal(); + if(_PatientCharacteristics is not null) dest.PatientCharacteristics = new List(_PatientCharacteristics.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -858,48 +828,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrationGuidelinesComponent; - if(otherT == null) return false; + if(other is not AdministrationGuidelinesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.Equals(Indication, otherT.Indication)) return false; - if(!comparer.ListEquals(PatientCharacteristics, otherT.PatientCharacteristics)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.Equals(_Indication, otherT._Indication)) return false; + if(!comparer.ListEquals(_PatientCharacteristics, otherT._PatientCharacteristics)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "indication": - value = Indication; - return Indication is not null; + value = _Indication; + return _Indication is not null; case "patientCharacteristics": - value = PatientCharacteristics; - return PatientCharacteristics?.Any() == true; + value = _PatientCharacteristics; + return _PatientCharacteristics?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "indication": - Indication = (Hl7.Fhir.Model.DataType)value; + Indication = (Hl7.Fhir.Model.DataType?)value; return this; case "patientCharacteristics": - PatientCharacteristics = (List)value; + PatientCharacteristics = (List?)value!; return this; default: return base.SetValue(key, value); @@ -910,9 +880,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (Indication is not null) yield return new KeyValuePair("indication",Indication); - if (PatientCharacteristics?.Any() == true) yield return new KeyValuePair("patientCharacteristics",PatientCharacteristics); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_Indication is not null) yield return new KeyValuePair("indication",_Indication); + if (_PatientCharacteristics?.Any() == true) yield return new KeyValuePair("patientCharacteristics",_PatientCharacteristics); } } @@ -936,13 +906,13 @@ public partial class DosageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Dosage for the medication for the specific guidelines. @@ -952,24 +922,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; protected internal override void CopyToInternal(Base other) { - var dest = other as DosageComponent; - - if (dest == null) - { + if(other is not DosageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -981,41 +947,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosageComponent; - if(otherT == null) return false; + if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1026,8 +992,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); } } @@ -1056,13 +1022,13 @@ public partial class PatientCharacteristicsComponent : Hl7.Fhir.Model.BackboneEl [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Characteristic + public Hl7.Fhir.Model.DataType? Characteristic { get { return _Characteristic; } set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private Hl7.Fhir.Model.DataType _Characteristic; + private Hl7.Fhir.Model.DataType? _Characteristic; /// /// The specific characteristic. @@ -1072,24 +1038,24 @@ public Hl7.Fhir.Model.DataType Characteristic [DataMember] public List ValueElement { - get { if(_ValueElement==null) _ValueElement = new List(); return _ValueElement; } + get => _ValueElement ?? new List(); set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private List _ValueElement; + private List? _ValueElement; /// /// The specific characteristic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Value + public IEnumerable? Value { - get { return ValueElement != null ? ValueElement.Select(elem => elem.Value) : null; } + get => _ValueElement?.Select(elem => elem.Value); set { if (value == null) - ValueElement = null; + ValueElement = null!; else ValueElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Value"); @@ -1098,16 +1064,12 @@ public IEnumerable Value protected internal override void CopyToInternal(Base other) { - var dest = other as PatientCharacteristicsComponent; - - if (dest == null) - { + if(other is not PatientCharacteristicsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Characteristic != null) dest.Characteristic = (Hl7.Fhir.Model.DataType)Characteristic.DeepCopyInternal(); - if(ValueElement.Any()) dest.ValueElement = new List(ValueElement.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = (Hl7.Fhir.Model.DataType)_Characteristic.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = new List(_ValueElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1119,41 +1081,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PatientCharacteristicsComponent; - if(otherT == null) return false; + if(other is not PatientCharacteristicsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "characteristic": - value = Characteristic; - return Characteristic is not null; + value = _Characteristic; + return _Characteristic is not null; case "value": - value = ValueElement; - return ValueElement?.Any() == true; + value = _ValueElement; + return _ValueElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "characteristic": - Characteristic = (Hl7.Fhir.Model.DataType)value; + Characteristic = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - ValueElement = (List)value; + ValueElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1164,8 +1126,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Characteristic is not null) yield return new KeyValuePair("characteristic",Characteristic); - if (ValueElement?.Any() == true) yield return new KeyValuePair("value",ValueElement); + if (_Characteristic is not null) yield return new KeyValuePair("characteristic",_Characteristic); + if (_ValueElement?.Any() == true) yield return new KeyValuePair("value",_ValueElement); } } @@ -1189,13 +1151,13 @@ public partial class MedicineClassificationComponent : Hl7.Fhir.Model.BackboneEl [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Specific category assigned to the medication. @@ -1205,24 +1167,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicineClassificationComponent; - - if (dest == null) - { + if(other is not MedicineClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1234,41 +1192,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicineClassificationComponent; - if(otherT == null) return false; + if(other is not MedicineClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1279,8 +1237,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); } } @@ -1307,39 +1265,35 @@ public partial class PackagingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("MedicationPackageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The number of product units the package would contain if fully loaded. /// [FhirElement("quantity", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as PackagingComponent; - - if (dest == null) - { + if(other is not PackagingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1351,41 +1305,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagingComponent; - if(otherT == null) return false; + if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -1396,8 +1350,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -1424,13 +1378,13 @@ public partial class DrugCharacteristicComponent : Hl7.Fhir.Model.BackboneElemen [FhirElement("type", Order=40)] [Binding("MedicationCharacteristic")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Description of the characteristic. @@ -1439,26 +1393,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Base64Binary))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DrugCharacteristicComponent; - - if (dest == null) - { + if(other is not DrugCharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1470,41 +1420,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DrugCharacteristicComponent; - if(otherT == null) return false; + if(other is not DrugCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1515,8 +1465,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1542,13 +1492,13 @@ public partial class RegulatoryComponent : Hl7.Fhir.Model.BackboneElement [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference RegulatoryAuthority + public Hl7.Fhir.Model.ResourceReference? RegulatoryAuthority { get { return _RegulatoryAuthority; } set { _RegulatoryAuthority = value; OnPropertyChanged("RegulatoryAuthority"); } } - private Hl7.Fhir.Model.ResourceReference _RegulatoryAuthority; + private Hl7.Fhir.Model.ResourceReference? _RegulatoryAuthority; /// /// Specifies if changes are allowed when dispensing a medication from a regulatory perspective. @@ -1558,11 +1508,11 @@ public Hl7.Fhir.Model.ResourceReference RegulatoryAuthority [DataMember] public List Substitution { - get { if(_Substitution==null) _Substitution = new List(); return _Substitution; } + get => _Substitution ?? new List(); set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private List _Substitution; + private List? _Substitution; /// /// Specifies the schedule of a medication in jurisdiction. @@ -1572,39 +1522,35 @@ public List Substituti [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// The maximum number of units of the medication that can be dispensed in a period. /// [FhirElement("maxDispense", Order=70)] [DataMember] - public Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent MaxDispense + public Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent? MaxDispense { get { return _MaxDispense; } set { _MaxDispense = value; OnPropertyChanged("MaxDispense"); } } - private Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent _MaxDispense; + private Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent? _MaxDispense; protected internal override void CopyToInternal(Base other) { - var dest = other as RegulatoryComponent; - - if (dest == null) - { + if(other is not RegulatoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RegulatoryAuthority != null) dest.RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)RegulatoryAuthority.DeepCopyInternal(); - if(Substitution.Any()) dest.Substitution = new List(Substitution.DeepCopyInternal()); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(MaxDispense != null) dest.MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)MaxDispense.DeepCopyInternal(); + if(_RegulatoryAuthority is not null) dest.RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)_RegulatoryAuthority.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = new List(_Substitution.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_MaxDispense is not null) dest.MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)_MaxDispense.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1616,55 +1562,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RegulatoryComponent; - if(otherT == null) return false; + if(other is not RegulatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RegulatoryAuthority, otherT.RegulatoryAuthority)) return false; - if(!comparer.ListEquals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(MaxDispense, otherT.MaxDispense)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; + if(!comparer.ListEquals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_MaxDispense, otherT._MaxDispense)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "regulatoryAuthority": - value = RegulatoryAuthority; - return RegulatoryAuthority is not null; + value = _RegulatoryAuthority; + return _RegulatoryAuthority is not null; case "substitution": - value = Substitution; - return Substitution?.Any() == true; + value = _Substitution; + return _Substitution?.Any() == true; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "maxDispense": - value = MaxDispense; - return MaxDispense is not null; + value = _MaxDispense; + return _MaxDispense is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "regulatoryAuthority": - RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)value; + RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "substitution": - Substitution = (List)value; + Substitution = (List?)value!; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "maxDispense": - MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)value; + MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent?)value; return this; default: return base.SetValue(key, value); @@ -1675,10 +1621,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RegulatoryAuthority is not null) yield return new KeyValuePair("regulatoryAuthority",RegulatoryAuthority); - if (Substitution?.Any() == true) yield return new KeyValuePair("substitution",Substitution); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (MaxDispense is not null) yield return new KeyValuePair("maxDispense",MaxDispense); + if (_RegulatoryAuthority is not null) yield return new KeyValuePair("regulatoryAuthority",_RegulatoryAuthority); + if (_Substitution?.Any() == true) yield return new KeyValuePair("substitution",_Substitution); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_MaxDispense is not null) yield return new KeyValuePair("maxDispense",_MaxDispense); } } @@ -1702,13 +1648,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Specifies if regulation allows for changes in the medication when dispensing. @@ -1716,13 +1662,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("allowed", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllowedElement + public Hl7.Fhir.Model.FhirBoolean? AllowedElement { get { return _AllowedElement; } set { _AllowedElement = value; OnPropertyChanged("AllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _AllowedElement; /// /// Specifies if regulation allows for changes in the medication when dispensing @@ -1731,29 +1677,22 @@ public Hl7.Fhir.Model.FhirBoolean AllowedElement [IgnoreDataMember] public bool? Allowed { - get { return AllowedElement != null ? AllowedElement.Value : null; } + get => _AllowedElement?.Value; set { - if (value == null) - AllowedElement = null; - else - AllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Allowed"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AllowedElement != null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)AllowedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AllowedElement is not null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)_AllowedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1765,41 +1704,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(AllowedElement, otherT.AllowedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = AllowedElement; - return AllowedElement is not null; + value = _AllowedElement; + return _AllowedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - AllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1810,8 +1749,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AllowedElement is not null) yield return new KeyValuePair("allowed",AllowedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AllowedElement is not null) yield return new KeyValuePair("allowed",_AllowedElement); } } @@ -1835,25 +1774,21 @@ public partial class ScheduleComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("schedule", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Schedule + public Hl7.Fhir.Model.CodeableConcept? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.CodeableConcept _Schedule; + private Hl7.Fhir.Model.CodeableConcept? _Schedule; protected internal override void CopyToInternal(Base other) { - var dest = other as ScheduleComponent; - - if (dest == null) - { + if(other is not ScheduleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.CodeableConcept)Schedule.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.CodeableConcept)_Schedule.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1865,34 +1800,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ScheduleComponent; - if(otherT == null) return false; + if(other is not ScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "schedule": - Schedule = (Hl7.Fhir.Model.CodeableConcept)value; + Schedule = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1903,7 +1838,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); } } @@ -1927,39 +1862,35 @@ public partial class MaxDispenseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("quantity", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The period that applies to the maximum number of units. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration Period + public Hl7.Fhir.Model.Duration? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Duration _Period; + private Hl7.Fhir.Model.Duration? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as MaxDispenseComponent; - - if (dest == null) - { + if(other is not MaxDispenseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Duration)Period.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Duration)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1971,41 +1902,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MaxDispenseComponent; - if(otherT == null) return false; + if(other is not MaxDispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Duration)value; + Period = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -2016,8 +1947,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -2043,11 +1974,11 @@ public partial class KineticsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List AreaUnderCurve { - get { if(_AreaUnderCurve==null) _AreaUnderCurve = new List(); return _AreaUnderCurve; } + get => _AreaUnderCurve ?? new List(); set { _AreaUnderCurve = value; OnPropertyChanged("AreaUnderCurve"); } } - private List _AreaUnderCurve; + private List? _AreaUnderCurve; /// /// The median lethal dose of a drug. @@ -2057,38 +1988,34 @@ public List AreaUnderCurve [DataMember] public List LethalDose50 { - get { if(_LethalDose50==null) _LethalDose50 = new List(); return _LethalDose50; } + get => _LethalDose50 ?? new List(); set { _LethalDose50 = value; OnPropertyChanged("LethalDose50"); } } - private List _LethalDose50; + private List? _LethalDose50; /// /// Time required for concentration in the body to decrease by half. /// [FhirElement("halfLifePeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration HalfLifePeriod + public Hl7.Fhir.Model.Duration? HalfLifePeriod { get { return _HalfLifePeriod; } set { _HalfLifePeriod = value; OnPropertyChanged("HalfLifePeriod"); } } - private Hl7.Fhir.Model.Duration _HalfLifePeriod; + private Hl7.Fhir.Model.Duration? _HalfLifePeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as KineticsComponent; - - if (dest == null) - { + if(other is not KineticsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AreaUnderCurve.Any()) dest.AreaUnderCurve = new List(AreaUnderCurve.DeepCopyInternal()); - if(LethalDose50.Any()) dest.LethalDose50 = new List(LethalDose50.DeepCopyInternal()); - if(HalfLifePeriod != null) dest.HalfLifePeriod = (Hl7.Fhir.Model.Duration)HalfLifePeriod.DeepCopyInternal(); + if(_AreaUnderCurve is not null) dest.AreaUnderCurve = new List(_AreaUnderCurve.DeepCopyInternal()); + if(_LethalDose50 is not null) dest.LethalDose50 = new List(_LethalDose50.DeepCopyInternal()); + if(_HalfLifePeriod is not null) dest.HalfLifePeriod = (Hl7.Fhir.Model.Duration)_HalfLifePeriod.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2100,48 +2027,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as KineticsComponent; - if(otherT == null) return false; + if(other is not KineticsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(AreaUnderCurve, otherT.AreaUnderCurve)) return false; - if(!comparer.ListEquals(LethalDose50, otherT.LethalDose50)) return false; - if(!comparer.Equals(HalfLifePeriod, otherT.HalfLifePeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_AreaUnderCurve, otherT._AreaUnderCurve)) return false; + if(!comparer.ListEquals(_LethalDose50, otherT._LethalDose50)) return false; + if(!comparer.Equals(_HalfLifePeriod, otherT._HalfLifePeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "areaUnderCurve": - value = AreaUnderCurve; - return AreaUnderCurve?.Any() == true; + value = _AreaUnderCurve; + return _AreaUnderCurve?.Any() == true; case "lethalDose50": - value = LethalDose50; - return LethalDose50?.Any() == true; + value = _LethalDose50; + return _LethalDose50?.Any() == true; case "halfLifePeriod": - value = HalfLifePeriod; - return HalfLifePeriod is not null; + value = _HalfLifePeriod; + return _HalfLifePeriod is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "areaUnderCurve": - AreaUnderCurve = (List)value; + AreaUnderCurve = (List?)value!; return this; case "lethalDose50": - LethalDose50 = (List)value; + LethalDose50 = (List?)value!; return this; case "halfLifePeriod": - HalfLifePeriod = (Hl7.Fhir.Model.Duration)value; + HalfLifePeriod = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -2152,9 +2079,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AreaUnderCurve?.Any() == true) yield return new KeyValuePair("areaUnderCurve",AreaUnderCurve); - if (LethalDose50?.Any() == true) yield return new KeyValuePair("lethalDose50",LethalDose50); - if (HalfLifePeriod is not null) yield return new KeyValuePair("halfLifePeriod",HalfLifePeriod); + if (_AreaUnderCurve?.Any() == true) yield return new KeyValuePair("areaUnderCurve",_AreaUnderCurve); + if (_LethalDose50?.Any() == true) yield return new KeyValuePair("lethalDose50",_LethalDose50); + if (_HalfLifePeriod is not null) yield return new KeyValuePair("halfLifePeriod",_HalfLifePeriod); } } @@ -2165,13 +2092,13 @@ public override IEnumerable> EnumerateElements() [FhirElement("code", InSummary=true, Order=90, FiveWs="FiveWs.class")] [Binding("MedicationFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | inactive | entered-in-error. @@ -2180,13 +2107,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("MedicationKnowledgeStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -2195,13 +2122,10 @@ public Code S [IgnoreDataMember] public Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2213,13 +2137,13 @@ public Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes? Status [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// powder | tablets | capsule +. @@ -2227,26 +2151,26 @@ public Hl7.Fhir.Model.ResourceReference Manufacturer [FhirElement("doseForm", Order=120)] [Binding("MedicationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseForm + public Hl7.Fhir.Model.CodeableConcept? DoseForm { get { return _DoseForm; } set { _DoseForm = value; OnPropertyChanged("DoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseForm; + private Hl7.Fhir.Model.CodeableConcept? _DoseForm; /// /// Amount of drug in package. /// [FhirElement("amount", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; /// /// Additional names for a medication. @@ -2256,24 +2180,24 @@ public Hl7.Fhir.Model.Quantity Amount [DataMember] public List SynonymElement { - get { if(_SynonymElement==null) _SynonymElement = new List(); return _SynonymElement; } + get => _SynonymElement ?? new List(); set { _SynonymElement = value; OnPropertyChanged("SynonymElement"); } } - private List _SynonymElement; + private List? _SynonymElement; /// /// Additional names for a medication /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Synonym + public IEnumerable? Synonym { - get { return SynonymElement != null ? SynonymElement.Select(elem => elem.Value) : null; } + get => _SynonymElement?.Select(elem => elem.Value); set { if (value == null) - SynonymElement = null; + SynonymElement = null!; else SynonymElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Synonym"); @@ -2288,11 +2212,11 @@ public IEnumerable Synonym [DataMember] public List RelatedMedicationKnowledge { - get { if(_RelatedMedicationKnowledge==null) _RelatedMedicationKnowledge = new List(); return _RelatedMedicationKnowledge; } + get => _RelatedMedicationKnowledge ?? new List(); set { _RelatedMedicationKnowledge = value; OnPropertyChanged("RelatedMedicationKnowledge"); } } - private List _RelatedMedicationKnowledge; + private List? _RelatedMedicationKnowledge; /// /// A medication resource that is associated with this medication. @@ -2304,11 +2228,11 @@ public List AssociatedMedication { - get { if(_AssociatedMedication==null) _AssociatedMedication = new List(); return _AssociatedMedication; } + get => _AssociatedMedication ?? new List(); set { _AssociatedMedication = value; OnPropertyChanged("AssociatedMedication"); } } - private List _AssociatedMedication; + private List? _AssociatedMedication; /// /// Category of the medication or product. @@ -2318,11 +2242,11 @@ public List AssociatedMedication [DataMember] public List ProductType { - get { if(_ProductType==null) _ProductType = new List(); return _ProductType; } + get => _ProductType ?? new List(); set { _ProductType = value; OnPropertyChanged("ProductType"); } } - private List _ProductType; + private List? _ProductType; /// /// Associated documentation about the medication. @@ -2332,11 +2256,11 @@ public List ProductType [DataMember] public List Monograph { - get { if(_Monograph==null) _Monograph = new List(); return _Monograph; } + get => _Monograph ?? new List(); set { _Monograph = value; OnPropertyChanged("Monograph"); } } - private List _Monograph; + private List? _Monograph; /// /// Active or inactive ingredient. @@ -2346,39 +2270,36 @@ public List Monograph [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// The instructions for preparing the medication. /// [FhirElement("preparationInstruction", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown PreparationInstructionElement + public Hl7.Fhir.Model.Markdown? PreparationInstructionElement { get { return _PreparationInstructionElement; } set { _PreparationInstructionElement = value; OnPropertyChanged("PreparationInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _PreparationInstructionElement; + private Hl7.Fhir.Model.Markdown? _PreparationInstructionElement; /// /// The instructions for preparing the medication /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreparationInstruction + public string? PreparationInstruction { - get { return PreparationInstructionElement != null ? PreparationInstructionElement.Value : null; } + get => _PreparationInstructionElement?.Value; set { - if (value == null) - PreparationInstructionElement = null; - else - PreparationInstructionElement = new Hl7.Fhir.Model.Markdown(value); + PreparationInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PreparationInstruction"); } } @@ -2392,11 +2313,11 @@ public string PreparationInstruction [DataMember] public List IntendedRoute { - get { if(_IntendedRoute==null) _IntendedRoute = new List(); return _IntendedRoute; } + get => _IntendedRoute ?? new List(); set { _IntendedRoute = value; OnPropertyChanged("IntendedRoute"); } } - private List _IntendedRoute; + private List? _IntendedRoute; /// /// The pricing of the medication. @@ -2406,11 +2327,11 @@ public List IntendedRoute [DataMember] public List Cost { - get { if(_Cost==null) _Cost = new List(); return _Cost; } + get => _Cost ?? new List(); set { _Cost = value; OnPropertyChanged("Cost"); } } - private List _Cost; + private List? _Cost; /// /// Program under which a medication is reviewed. @@ -2420,11 +2341,11 @@ public List Cost [DataMember] public List MonitoringProgram { - get { if(_MonitoringProgram==null) _MonitoringProgram = new List(); return _MonitoringProgram; } + get => _MonitoringProgram ?? new List(); set { _MonitoringProgram = value; OnPropertyChanged("MonitoringProgram"); } } - private List _MonitoringProgram; + private List? _MonitoringProgram; /// /// Guidelines for administration of the medication. @@ -2434,11 +2355,11 @@ public List Monit [DataMember] public List AdministrationGuidelines { - get { if(_AdministrationGuidelines==null) _AdministrationGuidelines = new List(); return _AdministrationGuidelines; } + get => _AdministrationGuidelines ?? new List(); set { _AdministrationGuidelines = value; OnPropertyChanged("AdministrationGuidelines"); } } - private List _AdministrationGuidelines; + private List? _AdministrationGuidelines; /// /// Categorization of the medication within a formulary or classification system. @@ -2448,24 +2369,24 @@ public List MedicineClassification { - get { if(_MedicineClassification==null) _MedicineClassification = new List(); return _MedicineClassification; } + get => _MedicineClassification ?? new List(); set { _MedicineClassification = value; OnPropertyChanged("MedicineClassification"); } } - private List _MedicineClassification; + private List? _MedicineClassification; /// /// Details about packaged medications. /// [FhirElement("packaging", Order=260)] [DataMember] - public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent Packaging + public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent? Packaging { get { return _Packaging; } set { _Packaging = value; OnPropertyChanged("Packaging"); } } - private Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent _Packaging; + private Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent? _Packaging; /// /// Specifies descriptive properties of the medicine. @@ -2475,11 +2396,11 @@ public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent Packaging [DataMember] public List DrugCharacteristic { - get { if(_DrugCharacteristic==null) _DrugCharacteristic = new List(); return _DrugCharacteristic; } + get => _DrugCharacteristic ?? new List(); set { _DrugCharacteristic = value; OnPropertyChanged("DrugCharacteristic"); } } - private List _DrugCharacteristic; + private List? _DrugCharacteristic; /// /// Potential clinical issue with or between medication(s). @@ -2491,11 +2412,11 @@ public List Drug [DataMember] public List Contraindication { - get { if(_Contraindication==null) _Contraindication = new List(); return _Contraindication; } + get => _Contraindication ?? new List(); set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } - private List _Contraindication; + private List? _Contraindication; /// /// Regulatory information about a medication. @@ -2505,11 +2426,11 @@ public List Contraindication [DataMember] public List Regulatory { - get { if(_Regulatory==null) _Regulatory = new List(); return _Regulatory; } + get => _Regulatory ?? new List(); set { _Regulatory = value; OnPropertyChanged("Regulatory"); } } - private List _Regulatory; + private List? _Regulatory; /// /// The time course of drug absorption, distribution, metabolism and excretion of a medication from the body. @@ -2519,47 +2440,43 @@ public List Regulatory [DataMember] public List Kinetics { - get { if(_Kinetics==null) _Kinetics = new List(); return _Kinetics; } + get => _Kinetics ?? new List(); set { _Kinetics = value; OnPropertyChanged("Kinetics"); } } - private List _Kinetics; + private List? _Kinetics; - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationKnowledge; - - if (dest == null) - { + if(other is not MedicationKnowledge dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(DoseForm != null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)DoseForm.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); - if(SynonymElement.Any()) dest.SynonymElement = new List(SynonymElement.DeepCopyInternal()); - if(RelatedMedicationKnowledge.Any()) dest.RelatedMedicationKnowledge = new List(RelatedMedicationKnowledge.DeepCopyInternal()); - if(AssociatedMedication.Any()) dest.AssociatedMedication = new List(AssociatedMedication.DeepCopyInternal()); - if(ProductType.Any()) dest.ProductType = new List(ProductType.DeepCopyInternal()); - if(Monograph.Any()) dest.Monograph = new List(Monograph.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(PreparationInstructionElement != null) dest.PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)PreparationInstructionElement.DeepCopyInternal(); - if(IntendedRoute.Any()) dest.IntendedRoute = new List(IntendedRoute.DeepCopyInternal()); - if(Cost.Any()) dest.Cost = new List(Cost.DeepCopyInternal()); - if(MonitoringProgram.Any()) dest.MonitoringProgram = new List(MonitoringProgram.DeepCopyInternal()); - if(AdministrationGuidelines.Any()) dest.AdministrationGuidelines = new List(AdministrationGuidelines.DeepCopyInternal()); - if(MedicineClassification.Any()) dest.MedicineClassification = new List(MedicineClassification.DeepCopyInternal()); - if(Packaging != null) dest.Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent)Packaging.DeepCopyInternal(); - if(DrugCharacteristic.Any()) dest.DrugCharacteristic = new List(DrugCharacteristic.DeepCopyInternal()); - if(Contraindication.Any()) dest.Contraindication = new List(Contraindication.DeepCopyInternal()); - if(Regulatory.Any()) dest.Regulatory = new List(Regulatory.DeepCopyInternal()); - if(Kinetics.Any()) dest.Kinetics = new List(Kinetics.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_DoseForm is not null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)_DoseForm.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); + if(_SynonymElement is not null) dest.SynonymElement = new List(_SynonymElement.DeepCopyInternal()); + if(_RelatedMedicationKnowledge is not null) dest.RelatedMedicationKnowledge = new List(_RelatedMedicationKnowledge.DeepCopyInternal()); + if(_AssociatedMedication is not null) dest.AssociatedMedication = new List(_AssociatedMedication.DeepCopyInternal()); + if(_ProductType is not null) dest.ProductType = new List(_ProductType.DeepCopyInternal()); + if(_Monograph is not null) dest.Monograph = new List(_Monograph.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_PreparationInstructionElement is not null) dest.PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)_PreparationInstructionElement.DeepCopyInternal(); + if(_IntendedRoute is not null) dest.IntendedRoute = new List(_IntendedRoute.DeepCopyInternal()); + if(_Cost is not null) dest.Cost = new List(_Cost.DeepCopyInternal()); + if(_MonitoringProgram is not null) dest.MonitoringProgram = new List(_MonitoringProgram.DeepCopyInternal()); + if(_AdministrationGuidelines is not null) dest.AdministrationGuidelines = new List(_AdministrationGuidelines.DeepCopyInternal()); + if(_MedicineClassification is not null) dest.MedicineClassification = new List(_MedicineClassification.DeepCopyInternal()); + if(_Packaging is not null) dest.Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent)_Packaging.DeepCopyInternal(); + if(_DrugCharacteristic is not null) dest.DrugCharacteristic = new List(_DrugCharacteristic.DeepCopyInternal()); + if(_Contraindication is not null) dest.Contraindication = new List(_Contraindication.DeepCopyInternal()); + if(_Regulatory is not null) dest.Regulatory = new List(_Regulatory.DeepCopyInternal()); + if(_Kinetics is not null) dest.Kinetics = new List(_Kinetics.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2571,181 +2488,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationKnowledge; - if(otherT == null) return false; + if(other is not MedicationKnowledge otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(DoseForm, otherT.DoseForm)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.ListEquals(SynonymElement, otherT.SynonymElement)) return false; - if(!comparer.ListEquals(RelatedMedicationKnowledge, otherT.RelatedMedicationKnowledge)) return false; - if(!comparer.ListEquals(AssociatedMedication, otherT.AssociatedMedication)) return false; - if(!comparer.ListEquals(ProductType, otherT.ProductType)) return false; - if(!comparer.ListEquals(Monograph, otherT.Monograph)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(PreparationInstructionElement, otherT.PreparationInstructionElement)) return false; - if(!comparer.ListEquals(IntendedRoute, otherT.IntendedRoute)) return false; - if(!comparer.ListEquals(Cost, otherT.Cost)) return false; - if(!comparer.ListEquals(MonitoringProgram, otherT.MonitoringProgram)) return false; - if(!comparer.ListEquals(AdministrationGuidelines, otherT.AdministrationGuidelines)) return false; - if(!comparer.ListEquals(MedicineClassification, otherT.MedicineClassification)) return false; - if(!comparer.Equals(Packaging, otherT.Packaging)) return false; - if(!comparer.ListEquals(DrugCharacteristic, otherT.DrugCharacteristic)) return false; - if(!comparer.ListEquals(Contraindication, otherT.Contraindication)) return false; - if(!comparer.ListEquals(Regulatory, otherT.Regulatory)) return false; - if(!comparer.ListEquals(Kinetics, otherT.Kinetics)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_DoseForm, otherT._DoseForm)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.ListEquals(_SynonymElement, otherT._SynonymElement)) return false; + if(!comparer.ListEquals(_RelatedMedicationKnowledge, otherT._RelatedMedicationKnowledge)) return false; + if(!comparer.ListEquals(_AssociatedMedication, otherT._AssociatedMedication)) return false; + if(!comparer.ListEquals(_ProductType, otherT._ProductType)) return false; + if(!comparer.ListEquals(_Monograph, otherT._Monograph)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_PreparationInstructionElement, otherT._PreparationInstructionElement)) return false; + if(!comparer.ListEquals(_IntendedRoute, otherT._IntendedRoute)) return false; + if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; + if(!comparer.ListEquals(_MonitoringProgram, otherT._MonitoringProgram)) return false; + if(!comparer.ListEquals(_AdministrationGuidelines, otherT._AdministrationGuidelines)) return false; + if(!comparer.ListEquals(_MedicineClassification, otherT._MedicineClassification)) return false; + if(!comparer.Equals(_Packaging, otherT._Packaging)) return false; + if(!comparer.ListEquals(_DrugCharacteristic, otherT._DrugCharacteristic)) return false; + if(!comparer.ListEquals(_Contraindication, otherT._Contraindication)) return false; + if(!comparer.ListEquals(_Regulatory, otherT._Regulatory)) return false; + if(!comparer.ListEquals(_Kinetics, otherT._Kinetics)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "doseForm": - value = DoseForm; - return DoseForm is not null; + value = _DoseForm; + return _DoseForm is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "synonym": - value = SynonymElement; - return SynonymElement?.Any() == true; + value = _SynonymElement; + return _SynonymElement?.Any() == true; case "relatedMedicationKnowledge": - value = RelatedMedicationKnowledge; - return RelatedMedicationKnowledge?.Any() == true; + value = _RelatedMedicationKnowledge; + return _RelatedMedicationKnowledge?.Any() == true; case "associatedMedication": - value = AssociatedMedication; - return AssociatedMedication?.Any() == true; + value = _AssociatedMedication; + return _AssociatedMedication?.Any() == true; case "productType": - value = ProductType; - return ProductType?.Any() == true; + value = _ProductType; + return _ProductType?.Any() == true; case "monograph": - value = Monograph; - return Monograph?.Any() == true; + value = _Monograph; + return _Monograph?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "preparationInstruction": - value = PreparationInstructionElement; - return PreparationInstructionElement is not null; + value = _PreparationInstructionElement; + return _PreparationInstructionElement is not null; case "intendedRoute": - value = IntendedRoute; - return IntendedRoute?.Any() == true; + value = _IntendedRoute; + return _IntendedRoute?.Any() == true; case "cost": - value = Cost; - return Cost?.Any() == true; + value = _Cost; + return _Cost?.Any() == true; case "monitoringProgram": - value = MonitoringProgram; - return MonitoringProgram?.Any() == true; + value = _MonitoringProgram; + return _MonitoringProgram?.Any() == true; case "administrationGuidelines": - value = AdministrationGuidelines; - return AdministrationGuidelines?.Any() == true; + value = _AdministrationGuidelines; + return _AdministrationGuidelines?.Any() == true; case "medicineClassification": - value = MedicineClassification; - return MedicineClassification?.Any() == true; + value = _MedicineClassification; + return _MedicineClassification?.Any() == true; case "packaging": - value = Packaging; - return Packaging is not null; + value = _Packaging; + return _Packaging is not null; case "drugCharacteristic": - value = DrugCharacteristic; - return DrugCharacteristic?.Any() == true; + value = _DrugCharacteristic; + return _DrugCharacteristic?.Any() == true; case "contraindication": - value = Contraindication; - return Contraindication?.Any() == true; + value = _Contraindication; + return _Contraindication?.Any() == true; case "regulatory": - value = Regulatory; - return Regulatory?.Any() == true; + value = _Regulatory; + return _Regulatory?.Any() == true; case "kinetics": - value = Kinetics; - return Kinetics?.Any() == true; + value = _Kinetics; + return _Kinetics?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "doseForm": - DoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + DoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; case "synonym": - SynonymElement = (List)value; + SynonymElement = (List?)value!; return this; case "relatedMedicationKnowledge": - RelatedMedicationKnowledge = (List)value; + RelatedMedicationKnowledge = (List?)value!; return this; case "associatedMedication": - AssociatedMedication = (List)value; + AssociatedMedication = (List?)value!; return this; case "productType": - ProductType = (List)value; + ProductType = (List?)value!; return this; case "monograph": - Monograph = (List)value; + Monograph = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "preparationInstruction": - PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)value; + PreparationInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "intendedRoute": - IntendedRoute = (List)value; + IntendedRoute = (List?)value!; return this; case "cost": - Cost = (List)value; + Cost = (List?)value!; return this; case "monitoringProgram": - MonitoringProgram = (List)value; + MonitoringProgram = (List?)value!; return this; case "administrationGuidelines": - AdministrationGuidelines = (List)value; + AdministrationGuidelines = (List?)value!; return this; case "medicineClassification": - MedicineClassification = (List)value; + MedicineClassification = (List?)value!; return this; case "packaging": - Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent)value; + Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent?)value; return this; case "drugCharacteristic": - DrugCharacteristic = (List)value; + DrugCharacteristic = (List?)value!; return this; case "contraindication": - Contraindication = (List)value; + Contraindication = (List?)value!; return this; case "regulatory": - Regulatory = (List)value; + Regulatory = (List?)value!; return this; case "kinetics": - Kinetics = (List)value; + Kinetics = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2756,28 +2673,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (DoseForm is not null) yield return new KeyValuePair("doseForm",DoseForm); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (SynonymElement?.Any() == true) yield return new KeyValuePair("synonym",SynonymElement); - if (RelatedMedicationKnowledge?.Any() == true) yield return new KeyValuePair("relatedMedicationKnowledge",RelatedMedicationKnowledge); - if (AssociatedMedication?.Any() == true) yield return new KeyValuePair("associatedMedication",AssociatedMedication); - if (ProductType?.Any() == true) yield return new KeyValuePair("productType",ProductType); - if (Monograph?.Any() == true) yield return new KeyValuePair("monograph",Monograph); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (PreparationInstructionElement is not null) yield return new KeyValuePair("preparationInstruction",PreparationInstructionElement); - if (IntendedRoute?.Any() == true) yield return new KeyValuePair("intendedRoute",IntendedRoute); - if (Cost?.Any() == true) yield return new KeyValuePair("cost",Cost); - if (MonitoringProgram?.Any() == true) yield return new KeyValuePair("monitoringProgram",MonitoringProgram); - if (AdministrationGuidelines?.Any() == true) yield return new KeyValuePair("administrationGuidelines",AdministrationGuidelines); - if (MedicineClassification?.Any() == true) yield return new KeyValuePair("medicineClassification",MedicineClassification); - if (Packaging is not null) yield return new KeyValuePair("packaging",Packaging); - if (DrugCharacteristic?.Any() == true) yield return new KeyValuePair("drugCharacteristic",DrugCharacteristic); - if (Contraindication?.Any() == true) yield return new KeyValuePair("contraindication",Contraindication); - if (Regulatory?.Any() == true) yield return new KeyValuePair("regulatory",Regulatory); - if (Kinetics?.Any() == true) yield return new KeyValuePair("kinetics",Kinetics); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_DoseForm is not null) yield return new KeyValuePair("doseForm",_DoseForm); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_SynonymElement?.Any() == true) yield return new KeyValuePair("synonym",_SynonymElement); + if (_RelatedMedicationKnowledge?.Any() == true) yield return new KeyValuePair("relatedMedicationKnowledge",_RelatedMedicationKnowledge); + if (_AssociatedMedication?.Any() == true) yield return new KeyValuePair("associatedMedication",_AssociatedMedication); + if (_ProductType?.Any() == true) yield return new KeyValuePair("productType",_ProductType); + if (_Monograph?.Any() == true) yield return new KeyValuePair("monograph",_Monograph); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_PreparationInstructionElement is not null) yield return new KeyValuePair("preparationInstruction",_PreparationInstructionElement); + if (_IntendedRoute?.Any() == true) yield return new KeyValuePair("intendedRoute",_IntendedRoute); + if (_Cost?.Any() == true) yield return new KeyValuePair("cost",_Cost); + if (_MonitoringProgram?.Any() == true) yield return new KeyValuePair("monitoringProgram",_MonitoringProgram); + if (_AdministrationGuidelines?.Any() == true) yield return new KeyValuePair("administrationGuidelines",_AdministrationGuidelines); + if (_MedicineClassification?.Any() == true) yield return new KeyValuePair("medicineClassification",_MedicineClassification); + if (_Packaging is not null) yield return new KeyValuePair("packaging",_Packaging); + if (_DrugCharacteristic?.Any() == true) yield return new KeyValuePair("drugCharacteristic",_DrugCharacteristic); + if (_Contraindication?.Any() == true) yield return new KeyValuePair("contraindication",_Contraindication); + if (_Regulatory?.Any() == true) yield return new KeyValuePair("regulatory",_Regulatory); + if (_Kinetics?.Any() == true) yield return new KeyValuePair("kinetics",_Kinetics); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs index 44fbac954..081ac9c51 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MedicationRequest","http://hl7.org/fhir/StructureDefinition/MedicationRequest")] - public partial class MedicationRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class MedicationRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -196,52 +199,52 @@ public partial class DispenseRequestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("initialFill", Order=40)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.InitialFillComponent InitialFill + public Hl7.Fhir.Model.MedicationRequest.InitialFillComponent? InitialFill { get { return _InitialFill; } set { _InitialFill = value; OnPropertyChanged("InitialFill"); } } - private Hl7.Fhir.Model.MedicationRequest.InitialFillComponent _InitialFill; + private Hl7.Fhir.Model.MedicationRequest.InitialFillComponent? _InitialFill; /// /// Minimum period of time between dispenses. /// [FhirElement("dispenseInterval", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration DispenseInterval + public Hl7.Fhir.Model.Duration? DispenseInterval { get { return _DispenseInterval; } set { _DispenseInterval = value; OnPropertyChanged("DispenseInterval"); } } - private Hl7.Fhir.Model.Duration _DispenseInterval; + private Hl7.Fhir.Model.Duration? _DispenseInterval; /// /// Time period supply is authorized for. /// [FhirElement("validityPeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// Number of refills authorized. /// [FhirElement("numberOfRepeatsAllowed", Order=70)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfRepeatsAllowedElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfRepeatsAllowedElement { get { return _NumberOfRepeatsAllowedElement; } set { _NumberOfRepeatsAllowedElement = value; OnPropertyChanged("NumberOfRepeatsAllowedElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfRepeatsAllowedElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfRepeatsAllowedElement; /// /// Number of refills authorized @@ -250,13 +253,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfRepeatsAllowedElement [IgnoreDataMember] public int? NumberOfRepeatsAllowed { - get { return NumberOfRepeatsAllowedElement != null ? NumberOfRepeatsAllowedElement.Value : null; } + get => _NumberOfRepeatsAllowedElement?.Value; set { - if (value == null) - NumberOfRepeatsAllowedElement = null; - else - NumberOfRepeatsAllowedElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfRepeatsAllowedElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfRepeatsAllowed"); } } @@ -266,26 +266,26 @@ public int? NumberOfRepeatsAllowed /// [FhirElement("quantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Number of days supply per dispense. /// [FhirElement("expectedSupplyDuration", Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration ExpectedSupplyDuration + public Hl7.Fhir.Model.Duration? ExpectedSupplyDuration { get { return _ExpectedSupplyDuration; } set { _ExpectedSupplyDuration = value; OnPropertyChanged("ExpectedSupplyDuration"); } } - private Hl7.Fhir.Model.Duration _ExpectedSupplyDuration; + private Hl7.Fhir.Model.Duration? _ExpectedSupplyDuration; /// /// Intended dispenser. @@ -294,31 +294,27 @@ public Hl7.Fhir.Model.Duration ExpectedSupplyDuration [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; protected internal override void CopyToInternal(Base other) { - var dest = other as DispenseRequestComponent; - - if (dest == null) - { + if(other is not DispenseRequestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(InitialFill != null) dest.InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)InitialFill.DeepCopyInternal(); - if(DispenseInterval != null) dest.DispenseInterval = (Hl7.Fhir.Model.Duration)DispenseInterval.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(NumberOfRepeatsAllowedElement != null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfRepeatsAllowedElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ExpectedSupplyDuration != null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)ExpectedSupplyDuration.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); + if(_InitialFill is not null) dest.InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)_InitialFill.DeepCopyInternal(); + if(_DispenseInterval is not null) dest.DispenseInterval = (Hl7.Fhir.Model.Duration)_DispenseInterval.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_NumberOfRepeatsAllowedElement is not null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfRepeatsAllowedElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ExpectedSupplyDuration is not null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)_ExpectedSupplyDuration.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -330,76 +326,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DispenseRequestComponent; - if(otherT == null) return false; + if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(InitialFill, otherT.InitialFill)) return false; - if(!comparer.Equals(DispenseInterval, otherT.DispenseInterval)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(NumberOfRepeatsAllowedElement, otherT.NumberOfRepeatsAllowedElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ExpectedSupplyDuration, otherT.ExpectedSupplyDuration)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; + if(!comparer.Equals(_DispenseInterval, otherT._DispenseInterval)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ExpectedSupplyDuration, otherT._ExpectedSupplyDuration)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "initialFill": - value = InitialFill; - return InitialFill is not null; + value = _InitialFill; + return _InitialFill is not null; case "dispenseInterval": - value = DispenseInterval; - return DispenseInterval is not null; + value = _DispenseInterval; + return _DispenseInterval is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "numberOfRepeatsAllowed": - value = NumberOfRepeatsAllowedElement; - return NumberOfRepeatsAllowedElement is not null; + value = _NumberOfRepeatsAllowedElement; + return _NumberOfRepeatsAllowedElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "expectedSupplyDuration": - value = ExpectedSupplyDuration; - return ExpectedSupplyDuration is not null; + value = _ExpectedSupplyDuration; + return _ExpectedSupplyDuration is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "initialFill": - InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)value; + InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent?)value; return this; case "dispenseInterval": - DispenseInterval = (Hl7.Fhir.Model.Duration)value; + DispenseInterval = (Hl7.Fhir.Model.Duration?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "numberOfRepeatsAllowed": - NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "expectedSupplyDuration": - ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)value; + ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -410,13 +406,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (InitialFill is not null) yield return new KeyValuePair("initialFill",InitialFill); - if (DispenseInterval is not null) yield return new KeyValuePair("dispenseInterval",DispenseInterval); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",NumberOfRepeatsAllowedElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",ExpectedSupplyDuration); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); + if (_InitialFill is not null) yield return new KeyValuePair("initialFill",_InitialFill); + if (_DispenseInterval is not null) yield return new KeyValuePair("dispenseInterval",_DispenseInterval); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",_NumberOfRepeatsAllowedElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",_ExpectedSupplyDuration); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); } } @@ -443,39 +439,35 @@ public partial class InitialFillComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// First fill duration. /// [FhirElement("duration", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration Duration + public Hl7.Fhir.Model.Duration? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Duration _Duration; + private Hl7.Fhir.Model.Duration? _Duration; protected internal override void CopyToInternal(Base other) { - var dest = other as InitialFillComponent; - - if (dest == null) - { + if(other is not InitialFillComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Duration)_Duration.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -487,41 +479,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InitialFillComponent; - if(otherT == null) return false; + if(other is not InitialFillComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Duration)value; + Duration = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -532,8 +524,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); } } @@ -563,13 +555,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Why should (not) substitution be made. @@ -577,26 +569,22 @@ public Hl7.Fhir.Model.DataType Allowed [FhirElement("reason", Order=50)] [Binding("MedicationIntendedSubstitutionReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -608,41 +596,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -653,8 +641,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -667,11 +655,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown. @@ -681,13 +669,13 @@ public List Identifier [Binding("MedicationRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown @@ -696,13 +684,10 @@ public Code StatusElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationrequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -713,13 +698,13 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationrequestStatus? Status [FhirElement("statusReason", Order=110)] [Binding("MedicationRequestStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option. @@ -729,13 +714,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [Binding("MedicationRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option @@ -744,13 +729,10 @@ public Code IntentElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -764,11 +746,11 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -777,13 +759,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("MedicationRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -792,13 +774,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -808,13 +787,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if request is prohibiting action @@ -823,13 +802,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -842,13 +818,13 @@ public bool? DoNotPerform [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reported + public Hl7.Fhir.Model.DataType? Reported { get { return _Reported; } set { _Reported = value; OnPropertyChanged("Reported"); } } - private Hl7.Fhir.Model.DataType _Reported; + private Hl7.Fhir.Model.DataType? _Reported; /// /// Medication to be taken. @@ -860,13 +836,13 @@ public Hl7.Fhir.Model.DataType Reported [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who or group medication request is for. @@ -876,13 +852,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of encounter/admission/stay. @@ -891,13 +867,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Information to support ordering of the medication. @@ -909,39 +885,36 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// When request was initially authored. /// [FhirElement("authoredOn", InSummary=true, Order=210, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request was initially authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -953,13 +926,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Intended performer of administration. @@ -968,13 +941,13 @@ public Hl7.Fhir.Model.ResourceReference Requester [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Desired kind of performer of the medication administration. @@ -982,13 +955,13 @@ public Hl7.Fhir.Model.ResourceReference Performer [FhirElement("performerType", InSummary=true, Order=240)] [Binding("MedicationRequestPerformerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Person who entered the request. @@ -997,13 +970,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Reason or indication for ordering or not ordering the medication. @@ -1014,11 +987,11 @@ public Hl7.Fhir.Model.ResourceReference Recorder [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or observation that supports why the prescription is being written. @@ -1030,11 +1003,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Instantiates FHIR protocol or definition. @@ -1044,24 +1017,24 @@ public List ReasonReference [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1076,24 +1049,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1110,24 +1083,24 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// Overall pattern of medication administration. @@ -1135,13 +1108,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [FhirElement("courseOfTherapyType", Order=320)] [Binding("MedicationRequestCourseOfTherapy")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CourseOfTherapyType + public Hl7.Fhir.Model.CodeableConcept? CourseOfTherapyType { get { return _CourseOfTherapyType; } set { _CourseOfTherapyType = value; OnPropertyChanged("CourseOfTherapyType"); } } - private Hl7.Fhir.Model.CodeableConcept _CourseOfTherapyType; + private Hl7.Fhir.Model.CodeableConcept? _CourseOfTherapyType; /// /// Associated insurance coverage. @@ -1153,11 +1126,11 @@ public Hl7.Fhir.Model.CodeableConcept CourseOfTherapyType [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Information about the prescription. @@ -1167,11 +1140,11 @@ public List Insurance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// How the medication should be taken. @@ -1181,37 +1154,37 @@ public List Note [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Medication supply authorization. /// [FhirElement("dispenseRequest", Order=360)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent DispenseRequest + public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? DispenseRequest { get { return _DispenseRequest; } set { _DispenseRequest = value; OnPropertyChanged("DispenseRequest"); } } - private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent _DispenseRequest; + private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? _DispenseRequest; /// /// Any restrictions on medication substitution. /// [FhirElement("substitution", Order=370)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? _Substitution; /// /// An order/prescription that is being replaced. @@ -1220,13 +1193,13 @@ public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PriorPrescription + public Hl7.Fhir.Model.ResourceReference? PriorPrescription { get { return _PriorPrescription; } set { _PriorPrescription = value; OnPropertyChanged("PriorPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _PriorPrescription; + private Hl7.Fhir.Model.ResourceReference? _PriorPrescription; /// /// Clinical Issue with action. @@ -1238,11 +1211,11 @@ public Hl7.Fhir.Model.ResourceReference PriorPrescription [DataMember] public List DetectedIssue { - get { if(_DetectedIssue==null) _DetectedIssue = new List(); return _DetectedIssue; } + get => _DetectedIssue ?? new List(); set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } - private List _DetectedIssue; + private List? _DetectedIssue; /// /// A list of events of interest in the lifecycle. @@ -1254,59 +1227,55 @@ public List DetectedIssue [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.DataType ICoded.Code { get => Medication; set => Medication = value; } - IEnumerable ICoded.ToCodings() => Medication.ToCodings(); + Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } + IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationRequest; - - if (dest == null) - { + if(other is not MedicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Reported != null) dest.Reported = (Hl7.Fhir.Model.DataType)Reported.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(CourseOfTherapyType != null) dest.CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)CourseOfTherapyType.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(DispenseRequest != null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)DispenseRequest.DeepCopyInternal(); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(PriorPrescription != null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)PriorPrescription.DeepCopyInternal(); - if(DetectedIssue.Any()) dest.DetectedIssue = new List(DetectedIssue.DeepCopyInternal()); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Reported is not null) dest.Reported = (Hl7.Fhir.Model.DataType)_Reported.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_CourseOfTherapyType is not null) dest.CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)_CourseOfTherapyType.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_DispenseRequest is not null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)_DispenseRequest.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_PriorPrescription is not null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)_PriorPrescription.DeepCopyInternal(); + if(_DetectedIssue is not null) dest.DetectedIssue = new List(_DetectedIssue.DeepCopyInternal()); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1318,251 +1287,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationRequest; - if(otherT == null) return false; + if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Reported, otherT.Reported)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(CourseOfTherapyType, otherT.CourseOfTherapyType)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(DispenseRequest, otherT.DispenseRequest)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.Equals(PriorPrescription, otherT.PriorPrescription)) return false; - if(!comparer.ListEquals(DetectedIssue, otherT.DetectedIssue)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Reported, otherT._Reported)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_CourseOfTherapyType, otherT._CourseOfTherapyType)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_DispenseRequest, otherT._DispenseRequest)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; + if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "reported": - value = Reported; - return Reported is not null; + value = _Reported; + return _Reported is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "courseOfTherapyType": - value = CourseOfTherapyType; - return CourseOfTherapyType is not null; + value = _CourseOfTherapyType; + return _CourseOfTherapyType is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "dispenseRequest": - value = DispenseRequest; - return DispenseRequest is not null; + value = _DispenseRequest; + return _DispenseRequest is not null; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "priorPrescription": - value = PriorPrescription; - return PriorPrescription is not null; + value = _PriorPrescription; + return _PriorPrescription is not null; case "detectedIssue": - value = DetectedIssue; - return DetectedIssue?.Any() == true; + value = _DetectedIssue; + return _DetectedIssue?.Any() == true; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reported": - Reported = (Hl7.Fhir.Model.DataType)value; + Reported = (Hl7.Fhir.Model.DataType?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "courseOfTherapyType": - CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)value; + CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "dispenseRequest": - DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)value; + DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent?)value; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent?)value; return this; case "priorPrescription": - PriorPrescription = (Hl7.Fhir.Model.ResourceReference)value; + PriorPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "detectedIssue": - DetectedIssue = (List)value; + DetectedIssue = (List?)value!; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1573,38 +1542,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Reported is not null) yield return new KeyValuePair("reported",Reported); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (CourseOfTherapyType is not null) yield return new KeyValuePair("courseOfTherapyType",CourseOfTherapyType); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",DispenseRequest); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",PriorPrescription); - if (DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",DetectedIssue); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Reported is not null) yield return new KeyValuePair("reported",_Reported); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_CourseOfTherapyType is not null) yield return new KeyValuePair("courseOfTherapyType",_CourseOfTherapyType); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",_DispenseRequest); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",_PriorPrescription); + if (_DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",_DetectedIssue); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs index 2fd70a07e..dffd793a9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -63,7 +66,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MedicationStatement","http://hl7.org/fhir/StructureDefinition/MedicationStatement")] - public partial class MedicationStatement : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class MedicationStatement : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -136,11 +139,11 @@ public enum MedicationStatusCodes [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfils plan, proposal or order. @@ -152,11 +155,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -168,11 +171,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken. @@ -182,13 +185,13 @@ public List PartOf [Binding("MedicationStatementStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken @@ -197,13 +200,10 @@ public Code StatusElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -217,11 +217,11 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes? Status [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// Type of medication usage. @@ -229,13 +229,13 @@ public List StatusReason [FhirElement("category", InSummary=true, Order=140, FiveWs="FiveWs.class")] [Binding("MedicationStatementCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What medication was taken. @@ -247,13 +247,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who is/was taking the medication. @@ -263,13 +263,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with MedicationStatement. @@ -278,13 +278,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// The date/time or interval when the medication is/was/will be taken. @@ -293,41 +293,38 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the statement was asserted?. /// [FhirElement("dateAsserted", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateAssertedElement + public Hl7.Fhir.Model.FhirDateTime? DateAssertedElement { get { return _DateAssertedElement; } set { _DateAssertedElement = value; OnPropertyChanged("DateAssertedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateAssertedElement; + private Hl7.Fhir.Model.FhirDateTime? _DateAssertedElement; /// /// When the statement was asserted? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateAsserted + public string? DateAsserted { - get { return DateAssertedElement != null ? DateAssertedElement.Value : null; } + get => _DateAssertedElement?.Value; set { - if (value == null) - DateAssertedElement = null; - else - DateAssertedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateAssertedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateAsserted"); } } @@ -339,13 +336,13 @@ public string DateAsserted [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InformationSource + public Hl7.Fhir.Model.ResourceReference? InformationSource { get { return _InformationSource; } set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private Hl7.Fhir.Model.ResourceReference _InformationSource; + private Hl7.Fhir.Model.ResourceReference? _InformationSource; /// /// Additional supporting information. @@ -357,11 +354,11 @@ public Hl7.Fhir.Model.ResourceReference InformationSource [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// Reason for why the medication is being/was taken. @@ -372,11 +369,11 @@ public List DerivedFrom [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or observation that supports why the medication is being/was taken. @@ -388,11 +385,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Further information about the statement. @@ -402,11 +399,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Details of how medication is/was taken or should be taken. @@ -416,44 +413,40 @@ public List Note [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.DataType ICoded.Code { get => Medication; set => Medication = value; } - IEnumerable ICoded.ToCodings() => Medication.ToCodings(); + Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } + IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationStatement; - - if (dest == null) - { + if(other is not MedicationStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateAssertedElement != null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopyInternal(); - if(InformationSource != null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateAssertedElement is not null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)_DateAssertedElement.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)_InformationSource.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -465,146 +458,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationStatement; - if(otherT == null) return false; + if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateAssertedElement, otherT.DateAssertedElement)) return false; - if(!comparer.Equals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateAssertedElement, otherT._DateAssertedElement)) return false; + if(!comparer.Equals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "dateAsserted": - value = DateAssertedElement; - return DateAssertedElement is not null; + value = _DateAssertedElement; + return _DateAssertedElement is not null; case "informationSource": - value = InformationSource; - return InformationSource is not null; + value = _InformationSource; + return _InformationSource is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "dateAsserted": - DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "informationSource": - InformationSource = (Hl7.Fhir.Model.ResourceReference)value; + InformationSource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -615,23 +608,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",DateAssertedElement); - if (InformationSource is not null) yield return new KeyValuePair("informationSource",InformationSource); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",_DateAssertedElement); + if (_InformationSource is not null) yield return new KeyValuePair("informationSource",_InformationSource); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs index d76fc835f..ca20691df 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -75,28 +78,25 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("productName", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// The full product name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -109,11 +109,11 @@ public string ProductName [DataMember] public List NamePart { - get { if(_NamePart==null) _NamePart = new List(); return _NamePart; } + get => _NamePart ?? new List(); set { _NamePart = value; OnPropertyChanged("NamePart"); } } - private List _NamePart; + private List? _NamePart; /// /// Country where the name applies. @@ -123,25 +123,21 @@ public List NamePart [DataMember] public List CountryLanguage { - get { if(_CountryLanguage==null) _CountryLanguage = new List(); return _CountryLanguage; } + get => _CountryLanguage ?? new List(); set { _CountryLanguage = value; OnPropertyChanged("CountryLanguage"); } } - private List _CountryLanguage; + private List? _CountryLanguage; protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(NamePart.Any()) dest.NamePart = new List(NamePart.DeepCopyInternal()); - if(CountryLanguage.Any()) dest.CountryLanguage = new List(CountryLanguage.DeepCopyInternal()); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_NamePart is not null) dest.NamePart = new List(_NamePart.DeepCopyInternal()); + if(_CountryLanguage is not null) dest.CountryLanguage = new List(_CountryLanguage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -153,48 +149,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.ListEquals(NamePart, otherT.NamePart)) return false; - if(!comparer.ListEquals(CountryLanguage, otherT.CountryLanguage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.ListEquals(_NamePart, otherT._NamePart)) return false; + if(!comparer.ListEquals(_CountryLanguage, otherT._CountryLanguage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "namePart": - value = NamePart; - return NamePart?.Any() == true; + value = _NamePart; + return _NamePart?.Any() == true; case "countryLanguage": - value = CountryLanguage; - return CountryLanguage?.Any() == true; + value = _CountryLanguage; + return _CountryLanguage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "namePart": - NamePart = (List)value; + NamePart = (List?)value!; return this; case "countryLanguage": - CountryLanguage = (List)value; + CountryLanguage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -205,9 +201,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (NamePart?.Any() == true) yield return new KeyValuePair("namePart",NamePart); - if (CountryLanguage?.Any() == true) yield return new KeyValuePair("countryLanguage",CountryLanguage); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_NamePart?.Any() == true) yield return new KeyValuePair("namePart",_NamePart); + if (_CountryLanguage?.Any() == true) yield return new KeyValuePair("countryLanguage",_CountryLanguage); } } @@ -231,28 +227,25 @@ public partial class NamePartComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("part", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PartElement + public Hl7.Fhir.Model.FhirString? PartElement { get { return _PartElement; } set { _PartElement = value; OnPropertyChanged("PartElement"); } } - private Hl7.Fhir.Model.FhirString _PartElement; + private Hl7.Fhir.Model.FhirString? _PartElement; /// /// A fragment of a product name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Part + public string? Part { - get { return PartElement != null ? PartElement.Value : null; } + get => _PartElement?.Value; set { - if (value == null) - PartElement = null; - else - PartElement = new Hl7.Fhir.Model.FhirString(value); + PartElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Part"); } } @@ -263,26 +256,22 @@ public string Part [FhirElement("type", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as NamePartComponent; - - if (dest == null) - { + if(other is not NamePartComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PartElement != null) dest.PartElement = (Hl7.Fhir.Model.FhirString)PartElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); + if(_PartElement is not null) dest.PartElement = (Hl7.Fhir.Model.FhirString)_PartElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -294,41 +283,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NamePartComponent; - if(otherT == null) return false; + if(other is not NamePartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PartElement, otherT.PartElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "part": - value = PartElement; - return PartElement is not null; + value = _PartElement; + return _PartElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "part": - PartElement = (Hl7.Fhir.Model.FhirString)value; + PartElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -339,8 +328,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PartElement is not null) yield return new KeyValuePair("part",PartElement); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_PartElement is not null) yield return new KeyValuePair("part",_PartElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -364,26 +353,26 @@ public partial class CountryLanguageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("country", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Country + public Hl7.Fhir.Model.CodeableConcept? Country { get { return _Country; } set { _Country = value; OnPropertyChanged("Country"); } } - private Hl7.Fhir.Model.CodeableConcept _Country; + private Hl7.Fhir.Model.CodeableConcept? _Country; /// /// Jurisdiction code for where this name applies. /// [FhirElement("jurisdiction", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; /// /// Language code for this name. @@ -391,27 +380,23 @@ public Hl7.Fhir.Model.CodeableConcept Jurisdiction [FhirElement("language", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as CountryLanguageComponent; - - if (dest == null) - { + if(other is not CountryLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Country != null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)Country.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_Country is not null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)_Country.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -423,48 +408,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CountryLanguageComponent; - if(otherT == null) return false; + if(other is not CountryLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Country, otherT.Country)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "country": - value = Country; - return Country is not null; + value = _Country; + return _Country is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "country": - Country = (Hl7.Fhir.Model.CodeableConcept)value; + Country = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -475,9 +460,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Country is not null) yield return new KeyValuePair("country",Country); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_Country is not null) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -500,54 +485,51 @@ public partial class ManufacturingBusinessOperationComponent : Hl7.Fhir.Model.Ba /// [FhirElement("operationType", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OperationType + public Hl7.Fhir.Model.CodeableConcept? OperationType { get { return _OperationType; } set { _OperationType = value; OnPropertyChanged("OperationType"); } } - private Hl7.Fhir.Model.CodeableConcept _OperationType; + private Hl7.Fhir.Model.CodeableConcept? _OperationType; /// /// Regulatory authorization reference number. /// [FhirElement("authorisationReferenceNumber", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier AuthorisationReferenceNumber + public Hl7.Fhir.Model.Identifier? AuthorisationReferenceNumber { get { return _AuthorisationReferenceNumber; } set { _AuthorisationReferenceNumber = value; OnPropertyChanged("AuthorisationReferenceNumber"); } } - private Hl7.Fhir.Model.Identifier _AuthorisationReferenceNumber; + private Hl7.Fhir.Model.Identifier? _AuthorisationReferenceNumber; /// /// Regulatory authorization date. /// [FhirElement("effectiveDate", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EffectiveDateElement + public Hl7.Fhir.Model.FhirDateTime? EffectiveDateElement { get { return _EffectiveDateElement; } set { _EffectiveDateElement = value; OnPropertyChanged("EffectiveDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EffectiveDateElement; + private Hl7.Fhir.Model.FhirDateTime? _EffectiveDateElement; /// /// Regulatory authorization date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EffectiveDate + public string? EffectiveDate { - get { return EffectiveDateElement != null ? EffectiveDateElement.Value : null; } + get => _EffectiveDateElement?.Value; set { - if (value == null) - EffectiveDateElement = null; - else - EffectiveDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + EffectiveDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EffectiveDate"); } } @@ -557,13 +539,13 @@ public string EffectiveDate /// [FhirElement("confidentialityIndicator", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ConfidentialityIndicator + public Hl7.Fhir.Model.CodeableConcept? ConfidentialityIndicator { get { return _ConfidentialityIndicator; } set { _ConfidentialityIndicator = value; OnPropertyChanged("ConfidentialityIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _ConfidentialityIndicator; + private Hl7.Fhir.Model.CodeableConcept? _ConfidentialityIndicator; /// /// The manufacturer or establishment associated with the process. @@ -575,11 +557,11 @@ public Hl7.Fhir.Model.CodeableConcept ConfidentialityIndicator [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// A regulator which oversees the operation. @@ -588,30 +570,26 @@ public List Manufacturer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Regulator + public Hl7.Fhir.Model.ResourceReference? Regulator { get { return _Regulator; } set { _Regulator = value; OnPropertyChanged("Regulator"); } } - private Hl7.Fhir.Model.ResourceReference _Regulator; + private Hl7.Fhir.Model.ResourceReference? _Regulator; protected internal override void CopyToInternal(Base other) { - var dest = other as ManufacturingBusinessOperationComponent; - - if (dest == null) - { + if(other is not ManufacturingBusinessOperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(OperationType != null) dest.OperationType = (Hl7.Fhir.Model.CodeableConcept)OperationType.DeepCopyInternal(); - if(AuthorisationReferenceNumber != null) dest.AuthorisationReferenceNumber = (Hl7.Fhir.Model.Identifier)AuthorisationReferenceNumber.DeepCopyInternal(); - if(EffectiveDateElement != null) dest.EffectiveDateElement = (Hl7.Fhir.Model.FhirDateTime)EffectiveDateElement.DeepCopyInternal(); - if(ConfidentialityIndicator != null) dest.ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)ConfidentialityIndicator.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Regulator != null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)Regulator.DeepCopyInternal(); + if(_OperationType is not null) dest.OperationType = (Hl7.Fhir.Model.CodeableConcept)_OperationType.DeepCopyInternal(); + if(_AuthorisationReferenceNumber is not null) dest.AuthorisationReferenceNumber = (Hl7.Fhir.Model.Identifier)_AuthorisationReferenceNumber.DeepCopyInternal(); + if(_EffectiveDateElement is not null) dest.EffectiveDateElement = (Hl7.Fhir.Model.FhirDateTime)_EffectiveDateElement.DeepCopyInternal(); + if(_ConfidentialityIndicator is not null) dest.ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)_ConfidentialityIndicator.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Regulator is not null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)_Regulator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -623,69 +601,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManufacturingBusinessOperationComponent; - if(otherT == null) return false; + if(other is not ManufacturingBusinessOperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(OperationType, otherT.OperationType)) return false; - if(!comparer.Equals(AuthorisationReferenceNumber, otherT.AuthorisationReferenceNumber)) return false; - if(!comparer.Equals(EffectiveDateElement, otherT.EffectiveDateElement)) return false; - if(!comparer.Equals(ConfidentialityIndicator, otherT.ConfidentialityIndicator)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(Regulator, otherT.Regulator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_OperationType, otherT._OperationType)) return false; + if(!comparer.Equals(_AuthorisationReferenceNumber, otherT._AuthorisationReferenceNumber)) return false; + if(!comparer.Equals(_EffectiveDateElement, otherT._EffectiveDateElement)) return false; + if(!comparer.Equals(_ConfidentialityIndicator, otherT._ConfidentialityIndicator)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operationType": - value = OperationType; - return OperationType is not null; + value = _OperationType; + return _OperationType is not null; case "authorisationReferenceNumber": - value = AuthorisationReferenceNumber; - return AuthorisationReferenceNumber is not null; + value = _AuthorisationReferenceNumber; + return _AuthorisationReferenceNumber is not null; case "effectiveDate": - value = EffectiveDateElement; - return EffectiveDateElement is not null; + value = _EffectiveDateElement; + return _EffectiveDateElement is not null; case "confidentialityIndicator": - value = ConfidentialityIndicator; - return ConfidentialityIndicator is not null; + value = _ConfidentialityIndicator; + return _ConfidentialityIndicator is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "regulator": - value = Regulator; - return Regulator is not null; + value = _Regulator; + return _Regulator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operationType": - OperationType = (Hl7.Fhir.Model.CodeableConcept)value; + OperationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "authorisationReferenceNumber": - AuthorisationReferenceNumber = (Hl7.Fhir.Model.Identifier)value; + AuthorisationReferenceNumber = (Hl7.Fhir.Model.Identifier?)value; return this; case "effectiveDate": - EffectiveDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + EffectiveDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "confidentialityIndicator": - ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "regulator": - Regulator = (Hl7.Fhir.Model.ResourceReference)value; + Regulator = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -696,12 +674,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (OperationType is not null) yield return new KeyValuePair("operationType",OperationType); - if (AuthorisationReferenceNumber is not null) yield return new KeyValuePair("authorisationReferenceNumber",AuthorisationReferenceNumber); - if (EffectiveDateElement is not null) yield return new KeyValuePair("effectiveDate",EffectiveDateElement); - if (ConfidentialityIndicator is not null) yield return new KeyValuePair("confidentialityIndicator",ConfidentialityIndicator); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Regulator is not null) yield return new KeyValuePair("regulator",Regulator); + if (_OperationType is not null) yield return new KeyValuePair("operationType",_OperationType); + if (_AuthorisationReferenceNumber is not null) yield return new KeyValuePair("authorisationReferenceNumber",_AuthorisationReferenceNumber); + if (_EffectiveDateElement is not null) yield return new KeyValuePair("effectiveDate",_EffectiveDateElement); + if (_ConfidentialityIndicator is not null) yield return new KeyValuePair("confidentialityIndicator",_ConfidentialityIndicator); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Regulator is not null) yield return new KeyValuePair("regulator",_Regulator); } } @@ -727,37 +705,37 @@ public partial class SpecialDesignationComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The type of special designation, e.g. orphan drug, minor use. /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The intended use of the product, e.g. prevention, treatment. /// [FhirElement("intendedUse", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept IntendedUse + public Hl7.Fhir.Model.CodeableConcept? IntendedUse { get { return _IntendedUse; } set { _IntendedUse = value; OnPropertyChanged("IntendedUse"); } } - private Hl7.Fhir.Model.CodeableConcept _IntendedUse; + private Hl7.Fhir.Model.CodeableConcept? _IntendedUse; /// /// Condition for which the medicinal use applies. @@ -767,54 +745,51 @@ public Hl7.Fhir.Model.CodeableConcept IntendedUse [References("MedicinalProductIndication")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Indication + public Hl7.Fhir.Model.DataType? Indication { get { return _Indication; } set { _Indication = value; OnPropertyChanged("Indication"); } } - private Hl7.Fhir.Model.DataType _Indication; + private Hl7.Fhir.Model.DataType? _Indication; /// /// For example granted, pending, expired or withdrawn. /// [FhirElement("status", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Date when the designation was granted. /// [FhirElement("date", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date when the designation was granted /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -824,31 +799,27 @@ public string Date /// [FhirElement("species", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Species + public Hl7.Fhir.Model.CodeableConcept? Species { get { return _Species; } set { _Species = value; OnPropertyChanged("Species"); } } - private Hl7.Fhir.Model.CodeableConcept _Species; + private Hl7.Fhir.Model.CodeableConcept? _Species; protected internal override void CopyToInternal(Base other) { - var dest = other as SpecialDesignationComponent; - - if (dest == null) - { + if(other is not SpecialDesignationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(IntendedUse != null) dest.IntendedUse = (Hl7.Fhir.Model.CodeableConcept)IntendedUse.DeepCopyInternal(); - if(Indication != null) dest.Indication = (Hl7.Fhir.Model.DataType)Indication.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Species != null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)Species.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_IntendedUse is not null) dest.IntendedUse = (Hl7.Fhir.Model.CodeableConcept)_IntendedUse.DeepCopyInternal(); + if(_Indication is not null) dest.Indication = (Hl7.Fhir.Model.DataType)_Indication.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Species is not null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)_Species.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -860,76 +831,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecialDesignationComponent; - if(otherT == null) return false; + if(other is not SpecialDesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(IntendedUse, otherT.IntendedUse)) return false; - if(!comparer.Equals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Species, otherT.Species)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_IntendedUse, otherT._IntendedUse)) return false; + if(!comparer.Equals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Species, otherT._Species)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "intendedUse": - value = IntendedUse; - return IntendedUse is not null; + value = _IntendedUse; + return _IntendedUse is not null; case "indication": - value = Indication; - return Indication is not null; + value = _Indication; + return _Indication is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "species": - value = Species; - return Species is not null; + value = _Species; + return _Species is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intendedUse": - IntendedUse = (Hl7.Fhir.Model.CodeableConcept)value; + IntendedUse = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "indication": - Indication = (Hl7.Fhir.Model.DataType)value; + Indication = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "species": - Species = (Hl7.Fhir.Model.CodeableConcept)value; + Species = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -940,13 +911,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (IntendedUse is not null) yield return new KeyValuePair("intendedUse",IntendedUse); - if (Indication is not null) yield return new KeyValuePair("indication",Indication); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Species is not null) yield return new KeyValuePair("species",Species); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_IntendedUse is not null) yield return new KeyValuePair("intendedUse",_IntendedUse); + if (_Indication is not null) yield return new KeyValuePair("indication",_Indication); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Species is not null) yield return new KeyValuePair("species",_Species); } } @@ -959,76 +930,76 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Regulatory type, e.g. Investigational or Authorized. /// [FhirElement("type", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// If this medicine applies to human or veterinary uses. /// [FhirElement("domain", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Coding Domain + public Hl7.Fhir.Model.Coding? Domain { get { return _Domain; } set { _Domain = value; OnPropertyChanged("Domain"); } } - private Hl7.Fhir.Model.Coding _Domain; + private Hl7.Fhir.Model.Coding? _Domain; /// /// The dose form for a single part product, or combined form of a multiple part product. /// [FhirElement("combinedPharmaceuticalDoseForm", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CombinedPharmaceuticalDoseForm + public Hl7.Fhir.Model.CodeableConcept? CombinedPharmaceuticalDoseForm { get { return _CombinedPharmaceuticalDoseForm; } set { _CombinedPharmaceuticalDoseForm = value; OnPropertyChanged("CombinedPharmaceuticalDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _CombinedPharmaceuticalDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _CombinedPharmaceuticalDoseForm; /// /// The legal status of supply of the medicinal product as classified by the regulator. /// [FhirElement("legalStatusOfSupply", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply + public Hl7.Fhir.Model.CodeableConcept? LegalStatusOfSupply { get { return _LegalStatusOfSupply; } set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalStatusOfSupply; + private Hl7.Fhir.Model.CodeableConcept? _LegalStatusOfSupply; /// /// Whether the Medicinal Product is subject to additional monitoring for regulatory reasons. /// [FhirElement("additionalMonitoringIndicator", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdditionalMonitoringIndicator + public Hl7.Fhir.Model.CodeableConcept? AdditionalMonitoringIndicator { get { return _AdditionalMonitoringIndicator; } set { _AdditionalMonitoringIndicator = value; OnPropertyChanged("AdditionalMonitoringIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _AdditionalMonitoringIndicator; + private Hl7.Fhir.Model.CodeableConcept? _AdditionalMonitoringIndicator; /// /// Whether the Medicinal Product is subject to special measures for regulatory reasons. @@ -1038,24 +1009,24 @@ public Hl7.Fhir.Model.CodeableConcept AdditionalMonitoringIndicator [DataMember] public List SpecialMeasuresElement { - get { if(_SpecialMeasuresElement==null) _SpecialMeasuresElement = new List(); return _SpecialMeasuresElement; } + get => _SpecialMeasuresElement ?? new List(); set { _SpecialMeasuresElement = value; OnPropertyChanged("SpecialMeasuresElement"); } } - private List _SpecialMeasuresElement; + private List? _SpecialMeasuresElement; /// /// Whether the Medicinal Product is subject to special measures for regulatory reasons /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SpecialMeasures + public IEnumerable? SpecialMeasures { - get { return SpecialMeasuresElement != null ? SpecialMeasuresElement.Select(elem => elem.Value) : null; } + get => _SpecialMeasuresElement?.Select(elem => elem.Value); set { if (value == null) - SpecialMeasuresElement = null; + SpecialMeasuresElement = null!; else SpecialMeasuresElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("SpecialMeasures"); @@ -1067,13 +1038,13 @@ public IEnumerable SpecialMeasures /// [FhirElement("paediatricUseIndicator", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PaediatricUseIndicator + public Hl7.Fhir.Model.CodeableConcept? PaediatricUseIndicator { get { return _PaediatricUseIndicator; } set { _PaediatricUseIndicator = value; OnPropertyChanged("PaediatricUseIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _PaediatricUseIndicator; + private Hl7.Fhir.Model.CodeableConcept? _PaediatricUseIndicator; /// /// Allows the product to be classified by various systems. @@ -1083,11 +1054,11 @@ public Hl7.Fhir.Model.CodeableConcept PaediatricUseIndicator [DataMember] public List ProductClassification { - get { if(_ProductClassification==null) _ProductClassification = new List(); return _ProductClassification; } + get => _ProductClassification ?? new List(); set { _ProductClassification = value; OnPropertyChanged("ProductClassification"); } } - private List _ProductClassification; + private List? _ProductClassification; /// /// Marketing status of the medicinal product, in contrast to marketing authorizaton. @@ -1097,11 +1068,11 @@ public List ProductClassification [DataMember] public List MarketingStatus { - get { if(_MarketingStatus==null) _MarketingStatus = new List(); return _MarketingStatus; } + get => _MarketingStatus ?? new List(); set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } - private List _MarketingStatus; + private List? _MarketingStatus; /// /// Pharmaceutical aspects of product. @@ -1113,11 +1084,11 @@ public List MarketingStatus [DataMember] public List PharmaceuticalProduct { - get { if(_PharmaceuticalProduct==null) _PharmaceuticalProduct = new List(); return _PharmaceuticalProduct; } + get => _PharmaceuticalProduct ?? new List(); set { _PharmaceuticalProduct = value; OnPropertyChanged("PharmaceuticalProduct"); } } - private List _PharmaceuticalProduct; + private List? _PharmaceuticalProduct; /// /// Package representation for the product. @@ -1129,11 +1100,11 @@ public List PharmaceuticalProduct [DataMember] public List PackagedMedicinalProduct { - get { if(_PackagedMedicinalProduct==null) _PackagedMedicinalProduct = new List(); return _PackagedMedicinalProduct; } + get => _PackagedMedicinalProduct ?? new List(); set { _PackagedMedicinalProduct = value; OnPropertyChanged("PackagedMedicinalProduct"); } } - private List _PackagedMedicinalProduct; + private List? _PackagedMedicinalProduct; /// /// Supporting documentation, typically for regulatory submission. @@ -1145,11 +1116,11 @@ public List PackagedMedicinalProduct [DataMember] public List AttachedDocument { - get { if(_AttachedDocument==null) _AttachedDocument = new List(); return _AttachedDocument; } + get => _AttachedDocument ?? new List(); set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } - private List _AttachedDocument; + private List? _AttachedDocument; /// /// A master file for to the medicinal product (e.g. Pharmacovigilance System Master File). @@ -1161,11 +1132,11 @@ public List AttachedDocument [DataMember] public List MasterFile { - get { if(_MasterFile==null) _MasterFile = new List(); return _MasterFile; } + get => _MasterFile ?? new List(); set { _MasterFile = value; OnPropertyChanged("MasterFile"); } } - private List _MasterFile; + private List? _MasterFile; /// /// A product specific contact, person (in a role), or an organization. @@ -1177,11 +1148,11 @@ public List MasterFile [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Clinical trials or studies that this product is involved in. @@ -1193,11 +1164,11 @@ public List Contact [DataMember] public List ClinicalTrial { - get { if(_ClinicalTrial==null) _ClinicalTrial = new List(); return _ClinicalTrial; } + get => _ClinicalTrial ?? new List(); set { _ClinicalTrial = value; OnPropertyChanged("ClinicalTrial"); } } - private List _ClinicalTrial; + private List? _ClinicalTrial; /// /// The product's name, including full name and possibly coded parts. @@ -1207,11 +1178,11 @@ public List ClinicalTrial [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// Reference to another product, e.g. for linking authorised to investigational product. @@ -1221,11 +1192,11 @@ public List Name [DataMember] public List CrossReference { - get { if(_CrossReference==null) _CrossReference = new List(); return _CrossReference; } + get => _CrossReference ?? new List(); set { _CrossReference = value; OnPropertyChanged("CrossReference"); } } - private List _CrossReference; + private List? _CrossReference; /// /// An operation applied to the product, for manufacturing or adminsitrative purpose. @@ -1235,11 +1206,11 @@ public List CrossReference [DataMember] public List ManufacturingBusinessOperation { - get { if(_ManufacturingBusinessOperation==null) _ManufacturingBusinessOperation = new List(); return _ManufacturingBusinessOperation; } + get => _ManufacturingBusinessOperation ?? new List(); set { _ManufacturingBusinessOperation = value; OnPropertyChanged("ManufacturingBusinessOperation"); } } - private List _ManufacturingBusinessOperation; + private List? _ManufacturingBusinessOperation; /// /// Indicates if the medicinal product has an orphan designation for the treatment of a rare disease. @@ -1249,44 +1220,40 @@ public List SpecialDesignation { - get { if(_SpecialDesignation==null) _SpecialDesignation = new List(); return _SpecialDesignation; } + get => _SpecialDesignation ?? new List(); set { _SpecialDesignation = value; OnPropertyChanged("SpecialDesignation"); } } - private List _SpecialDesignation; + private List? _SpecialDesignation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProduct; - - if (dest == null) - { + if(other is not MedicinalProduct dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Domain != null) dest.Domain = (Hl7.Fhir.Model.Coding)Domain.DeepCopyInternal(); - if(CombinedPharmaceuticalDoseForm != null) dest.CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)CombinedPharmaceuticalDoseForm.DeepCopyInternal(); - if(LegalStatusOfSupply != null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)LegalStatusOfSupply.DeepCopyInternal(); - if(AdditionalMonitoringIndicator != null) dest.AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)AdditionalMonitoringIndicator.DeepCopyInternal(); - if(SpecialMeasuresElement.Any()) dest.SpecialMeasuresElement = new List(SpecialMeasuresElement.DeepCopyInternal()); - if(PaediatricUseIndicator != null) dest.PaediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)PaediatricUseIndicator.DeepCopyInternal(); - if(ProductClassification.Any()) dest.ProductClassification = new List(ProductClassification.DeepCopyInternal()); - if(MarketingStatus.Any()) dest.MarketingStatus = new List(MarketingStatus.DeepCopyInternal()); - if(PharmaceuticalProduct.Any()) dest.PharmaceuticalProduct = new List(PharmaceuticalProduct.DeepCopyInternal()); - if(PackagedMedicinalProduct.Any()) dest.PackagedMedicinalProduct = new List(PackagedMedicinalProduct.DeepCopyInternal()); - if(AttachedDocument.Any()) dest.AttachedDocument = new List(AttachedDocument.DeepCopyInternal()); - if(MasterFile.Any()) dest.MasterFile = new List(MasterFile.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(ClinicalTrial.Any()) dest.ClinicalTrial = new List(ClinicalTrial.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(CrossReference.Any()) dest.CrossReference = new List(CrossReference.DeepCopyInternal()); - if(ManufacturingBusinessOperation.Any()) dest.ManufacturingBusinessOperation = new List(ManufacturingBusinessOperation.DeepCopyInternal()); - if(SpecialDesignation.Any()) dest.SpecialDesignation = new List(SpecialDesignation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Domain is not null) dest.Domain = (Hl7.Fhir.Model.Coding)_Domain.DeepCopyInternal(); + if(_CombinedPharmaceuticalDoseForm is not null) dest.CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)_CombinedPharmaceuticalDoseForm.DeepCopyInternal(); + if(_LegalStatusOfSupply is not null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)_LegalStatusOfSupply.DeepCopyInternal(); + if(_AdditionalMonitoringIndicator is not null) dest.AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)_AdditionalMonitoringIndicator.DeepCopyInternal(); + if(_SpecialMeasuresElement is not null) dest.SpecialMeasuresElement = new List(_SpecialMeasuresElement.DeepCopyInternal()); + if(_PaediatricUseIndicator is not null) dest.PaediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)_PaediatricUseIndicator.DeepCopyInternal(); + if(_ProductClassification is not null) dest.ProductClassification = new List(_ProductClassification.DeepCopyInternal()); + if(_MarketingStatus is not null) dest.MarketingStatus = new List(_MarketingStatus.DeepCopyInternal()); + if(_PharmaceuticalProduct is not null) dest.PharmaceuticalProduct = new List(_PharmaceuticalProduct.DeepCopyInternal()); + if(_PackagedMedicinalProduct is not null) dest.PackagedMedicinalProduct = new List(_PackagedMedicinalProduct.DeepCopyInternal()); + if(_AttachedDocument is not null) dest.AttachedDocument = new List(_AttachedDocument.DeepCopyInternal()); + if(_MasterFile is not null) dest.MasterFile = new List(_MasterFile.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_ClinicalTrial is not null) dest.ClinicalTrial = new List(_ClinicalTrial.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_CrossReference is not null) dest.CrossReference = new List(_CrossReference.DeepCopyInternal()); + if(_ManufacturingBusinessOperation is not null) dest.ManufacturingBusinessOperation = new List(_ManufacturingBusinessOperation.DeepCopyInternal()); + if(_SpecialDesignation is not null) dest.SpecialDesignation = new List(_SpecialDesignation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1298,167 +1265,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProduct; - if(otherT == null) return false; + if(other is not MedicinalProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Domain, otherT.Domain)) return false; - if(!comparer.Equals(CombinedPharmaceuticalDoseForm, otherT.CombinedPharmaceuticalDoseForm)) return false; - if(!comparer.Equals(LegalStatusOfSupply, otherT.LegalStatusOfSupply)) return false; - if(!comparer.Equals(AdditionalMonitoringIndicator, otherT.AdditionalMonitoringIndicator)) return false; - if(!comparer.ListEquals(SpecialMeasuresElement, otherT.SpecialMeasuresElement)) return false; - if(!comparer.Equals(PaediatricUseIndicator, otherT.PaediatricUseIndicator)) return false; - if(!comparer.ListEquals(ProductClassification, otherT.ProductClassification)) return false; - if(!comparer.ListEquals(MarketingStatus, otherT.MarketingStatus)) return false; - if(!comparer.ListEquals(PharmaceuticalProduct, otherT.PharmaceuticalProduct)) return false; - if(!comparer.ListEquals(PackagedMedicinalProduct, otherT.PackagedMedicinalProduct)) return false; - if(!comparer.ListEquals(AttachedDocument, otherT.AttachedDocument)) return false; - if(!comparer.ListEquals(MasterFile, otherT.MasterFile)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(ClinicalTrial, otherT.ClinicalTrial)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(CrossReference, otherT.CrossReference)) return false; - if(!comparer.ListEquals(ManufacturingBusinessOperation, otherT.ManufacturingBusinessOperation)) return false; - if(!comparer.ListEquals(SpecialDesignation, otherT.SpecialDesignation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Domain, otherT._Domain)) return false; + if(!comparer.Equals(_CombinedPharmaceuticalDoseForm, otherT._CombinedPharmaceuticalDoseForm)) return false; + if(!comparer.Equals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; + if(!comparer.Equals(_AdditionalMonitoringIndicator, otherT._AdditionalMonitoringIndicator)) return false; + if(!comparer.ListEquals(_SpecialMeasuresElement, otherT._SpecialMeasuresElement)) return false; + if(!comparer.Equals(_PaediatricUseIndicator, otherT._PaediatricUseIndicator)) return false; + if(!comparer.ListEquals(_ProductClassification, otherT._ProductClassification)) return false; + if(!comparer.ListEquals(_MarketingStatus, otherT._MarketingStatus)) return false; + if(!comparer.ListEquals(_PharmaceuticalProduct, otherT._PharmaceuticalProduct)) return false; + if(!comparer.ListEquals(_PackagedMedicinalProduct, otherT._PackagedMedicinalProduct)) return false; + if(!comparer.ListEquals(_AttachedDocument, otherT._AttachedDocument)) return false; + if(!comparer.ListEquals(_MasterFile, otherT._MasterFile)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_ClinicalTrial, otherT._ClinicalTrial)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_CrossReference, otherT._CrossReference)) return false; + if(!comparer.ListEquals(_ManufacturingBusinessOperation, otherT._ManufacturingBusinessOperation)) return false; + if(!comparer.ListEquals(_SpecialDesignation, otherT._SpecialDesignation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "domain": - value = Domain; - return Domain is not null; + value = _Domain; + return _Domain is not null; case "combinedPharmaceuticalDoseForm": - value = CombinedPharmaceuticalDoseForm; - return CombinedPharmaceuticalDoseForm is not null; + value = _CombinedPharmaceuticalDoseForm; + return _CombinedPharmaceuticalDoseForm is not null; case "legalStatusOfSupply": - value = LegalStatusOfSupply; - return LegalStatusOfSupply is not null; + value = _LegalStatusOfSupply; + return _LegalStatusOfSupply is not null; case "additionalMonitoringIndicator": - value = AdditionalMonitoringIndicator; - return AdditionalMonitoringIndicator is not null; + value = _AdditionalMonitoringIndicator; + return _AdditionalMonitoringIndicator is not null; case "specialMeasures": - value = SpecialMeasuresElement; - return SpecialMeasuresElement?.Any() == true; + value = _SpecialMeasuresElement; + return _SpecialMeasuresElement?.Any() == true; case "paediatricUseIndicator": - value = PaediatricUseIndicator; - return PaediatricUseIndicator is not null; + value = _PaediatricUseIndicator; + return _PaediatricUseIndicator is not null; case "productClassification": - value = ProductClassification; - return ProductClassification?.Any() == true; + value = _ProductClassification; + return _ProductClassification?.Any() == true; case "marketingStatus": - value = MarketingStatus; - return MarketingStatus?.Any() == true; + value = _MarketingStatus; + return _MarketingStatus?.Any() == true; case "pharmaceuticalProduct": - value = PharmaceuticalProduct; - return PharmaceuticalProduct?.Any() == true; + value = _PharmaceuticalProduct; + return _PharmaceuticalProduct?.Any() == true; case "packagedMedicinalProduct": - value = PackagedMedicinalProduct; - return PackagedMedicinalProduct?.Any() == true; + value = _PackagedMedicinalProduct; + return _PackagedMedicinalProduct?.Any() == true; case "attachedDocument": - value = AttachedDocument; - return AttachedDocument?.Any() == true; + value = _AttachedDocument; + return _AttachedDocument?.Any() == true; case "masterFile": - value = MasterFile; - return MasterFile?.Any() == true; + value = _MasterFile; + return _MasterFile?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "clinicalTrial": - value = ClinicalTrial; - return ClinicalTrial?.Any() == true; + value = _ClinicalTrial; + return _ClinicalTrial?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "crossReference": - value = CrossReference; - return CrossReference?.Any() == true; + value = _CrossReference; + return _CrossReference?.Any() == true; case "manufacturingBusinessOperation": - value = ManufacturingBusinessOperation; - return ManufacturingBusinessOperation?.Any() == true; + value = _ManufacturingBusinessOperation; + return _ManufacturingBusinessOperation?.Any() == true; case "specialDesignation": - value = SpecialDesignation; - return SpecialDesignation?.Any() == true; + value = _SpecialDesignation; + return _SpecialDesignation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "domain": - Domain = (Hl7.Fhir.Model.Coding)value; + Domain = (Hl7.Fhir.Model.Coding?)value; return this; case "combinedPharmaceuticalDoseForm": - CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "legalStatusOfSupply": - LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)value; + LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additionalMonitoringIndicator": - AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialMeasures": - SpecialMeasuresElement = (List)value; + SpecialMeasuresElement = (List?)value!; return this; case "paediatricUseIndicator": - PaediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + PaediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productClassification": - ProductClassification = (List)value; + ProductClassification = (List?)value!; return this; case "marketingStatus": - MarketingStatus = (List)value; + MarketingStatus = (List?)value!; return this; case "pharmaceuticalProduct": - PharmaceuticalProduct = (List)value; + PharmaceuticalProduct = (List?)value!; return this; case "packagedMedicinalProduct": - PackagedMedicinalProduct = (List)value; + PackagedMedicinalProduct = (List?)value!; return this; case "attachedDocument": - AttachedDocument = (List)value; + AttachedDocument = (List?)value!; return this; case "masterFile": - MasterFile = (List)value; + MasterFile = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "clinicalTrial": - ClinicalTrial = (List)value; + ClinicalTrial = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "crossReference": - CrossReference = (List)value; + CrossReference = (List?)value!; return this; case "manufacturingBusinessOperation": - ManufacturingBusinessOperation = (List)value; + ManufacturingBusinessOperation = (List?)value!; return this; case "specialDesignation": - SpecialDesignation = (List)value; + SpecialDesignation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1469,26 +1436,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Domain is not null) yield return new KeyValuePair("domain",Domain); - if (CombinedPharmaceuticalDoseForm is not null) yield return new KeyValuePair("combinedPharmaceuticalDoseForm",CombinedPharmaceuticalDoseForm); - if (LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",LegalStatusOfSupply); - if (AdditionalMonitoringIndicator is not null) yield return new KeyValuePair("additionalMonitoringIndicator",AdditionalMonitoringIndicator); - if (SpecialMeasuresElement?.Any() == true) yield return new KeyValuePair("specialMeasures",SpecialMeasuresElement); - if (PaediatricUseIndicator is not null) yield return new KeyValuePair("paediatricUseIndicator",PaediatricUseIndicator); - if (ProductClassification?.Any() == true) yield return new KeyValuePair("productClassification",ProductClassification); - if (MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",MarketingStatus); - if (PharmaceuticalProduct?.Any() == true) yield return new KeyValuePair("pharmaceuticalProduct",PharmaceuticalProduct); - if (PackagedMedicinalProduct?.Any() == true) yield return new KeyValuePair("packagedMedicinalProduct",PackagedMedicinalProduct); - if (AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",AttachedDocument); - if (MasterFile?.Any() == true) yield return new KeyValuePair("masterFile",MasterFile); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (ClinicalTrial?.Any() == true) yield return new KeyValuePair("clinicalTrial",ClinicalTrial); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (CrossReference?.Any() == true) yield return new KeyValuePair("crossReference",CrossReference); - if (ManufacturingBusinessOperation?.Any() == true) yield return new KeyValuePair("manufacturingBusinessOperation",ManufacturingBusinessOperation); - if (SpecialDesignation?.Any() == true) yield return new KeyValuePair("specialDesignation",SpecialDesignation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Domain is not null) yield return new KeyValuePair("domain",_Domain); + if (_CombinedPharmaceuticalDoseForm is not null) yield return new KeyValuePair("combinedPharmaceuticalDoseForm",_CombinedPharmaceuticalDoseForm); + if (_LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",_LegalStatusOfSupply); + if (_AdditionalMonitoringIndicator is not null) yield return new KeyValuePair("additionalMonitoringIndicator",_AdditionalMonitoringIndicator); + if (_SpecialMeasuresElement?.Any() == true) yield return new KeyValuePair("specialMeasures",_SpecialMeasuresElement); + if (_PaediatricUseIndicator is not null) yield return new KeyValuePair("paediatricUseIndicator",_PaediatricUseIndicator); + if (_ProductClassification?.Any() == true) yield return new KeyValuePair("productClassification",_ProductClassification); + if (_MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",_MarketingStatus); + if (_PharmaceuticalProduct?.Any() == true) yield return new KeyValuePair("pharmaceuticalProduct",_PharmaceuticalProduct); + if (_PackagedMedicinalProduct?.Any() == true) yield return new KeyValuePair("packagedMedicinalProduct",_PackagedMedicinalProduct); + if (_AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",_AttachedDocument); + if (_MasterFile?.Any() == true) yield return new KeyValuePair("masterFile",_MasterFile); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_ClinicalTrial?.Any() == true) yield return new KeyValuePair("clinicalTrial",_ClinicalTrial); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_CrossReference?.Any() == true) yield return new KeyValuePair("crossReference",_CrossReference); + if (_ManufacturingBusinessOperation?.Any() == true) yield return new KeyValuePair("manufacturingBusinessOperation",_ManufacturingBusinessOperation); + if (_SpecialDesignation?.Any() == true) yield return new KeyValuePair("specialDesignation",_SpecialDesignation); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs index e457ccdc8..cd8917ea0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -77,24 +80,24 @@ public partial class JurisdictionalAuthorizationComponent : Hl7.Fhir.Model.Backb [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Country of authorization. /// [FhirElement("country", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Country + public Hl7.Fhir.Model.CodeableConcept? Country { get { return _Country; } set { _Country = value; OnPropertyChanged("Country"); } } - private Hl7.Fhir.Model.CodeableConcept _Country; + private Hl7.Fhir.Model.CodeableConcept? _Country; /// /// Jurisdiction within a country. @@ -104,53 +107,49 @@ public Hl7.Fhir.Model.CodeableConcept Country [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// The legal status of supply in a jurisdiction or region. /// [FhirElement("legalStatusOfSupply", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply + public Hl7.Fhir.Model.CodeableConcept? LegalStatusOfSupply { get { return _LegalStatusOfSupply; } set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalStatusOfSupply; + private Hl7.Fhir.Model.CodeableConcept? _LegalStatusOfSupply; /// /// The start and expected end date of the authorization. /// [FhirElement("validityPeriod", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as JurisdictionalAuthorizationComponent; - - if (dest == null) - { + if(other is not JurisdictionalAuthorizationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Country != null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)Country.DeepCopyInternal(); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(LegalStatusOfSupply != null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)LegalStatusOfSupply.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Country is not null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)_Country.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_LegalStatusOfSupply is not null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)_LegalStatusOfSupply.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -162,62 +161,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as JurisdictionalAuthorizationComponent; - if(otherT == null) return false; + if(other is not JurisdictionalAuthorizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Country, otherT.Country)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(LegalStatusOfSupply, otherT.LegalStatusOfSupply)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Country, otherT._Country)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "country": - value = Country; - return Country is not null; + value = _Country; + return _Country is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "legalStatusOfSupply": - value = LegalStatusOfSupply; - return LegalStatusOfSupply is not null; + value = _LegalStatusOfSupply; + return _LegalStatusOfSupply is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "country": - Country = (Hl7.Fhir.Model.CodeableConcept)value; + Country = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "legalStatusOfSupply": - LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)value; + LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -228,11 +227,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Country is not null) yield return new KeyValuePair("country",Country); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",LegalStatusOfSupply); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Country is not null) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",_LegalStatusOfSupply); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); } } @@ -255,13 +254,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Type of procedure. @@ -269,13 +268,13 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("type", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Date of procedure. @@ -284,13 +283,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Date + public Hl7.Fhir.Model.DataType? Date { get { return _Date; } set { _Date = value; OnPropertyChanged("Date"); } } - private Hl7.Fhir.Model.DataType _Date; + private Hl7.Fhir.Model.DataType? _Date; /// /// Applcations submitted to obtain a marketing authorization. @@ -300,26 +299,22 @@ public Hl7.Fhir.Model.DataType Date [DataMember] public List Application { - get { if(_Application==null) _Application = new List(); return _Application; } + get => _Application ?? new List(); set { _Application = value; OnPropertyChanged("Application"); } } - private List _Application; + private List? _Application; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Date != null) dest.Date = (Hl7.Fhir.Model.DataType)Date.DeepCopyInternal(); - if(Application.Any()) dest.Application = new List(Application.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Date is not null) dest.Date = (Hl7.Fhir.Model.DataType)_Date.DeepCopyInternal(); + if(_Application is not null) dest.Application = new List(_Application.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -331,55 +326,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Date, otherT.Date)) return false; - if(!comparer.ListEquals(Application, otherT.Application)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Date, otherT._Date)) return false; + if(!comparer.ListEquals(_Application, otherT._Application)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "date": - value = Date; - return Date is not null; + value = _Date; + return _Date is not null; case "application": - value = Application; - return Application?.Any() == true; + value = _Application; + return _Application?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - Date = (Hl7.Fhir.Model.DataType)value; + Date = (Hl7.Fhir.Model.DataType?)value; return this; case "application": - Application = (List)value; + Application = (List?)value!; return this; default: return base.SetValue(key, value); @@ -390,10 +385,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Date is not null) yield return new KeyValuePair("date",Date); - if (Application?.Any() == true) yield return new KeyValuePair("application",Application); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Date is not null) yield return new KeyValuePair("date",_Date); + if (_Application?.Any() == true) yield return new KeyValuePair("application",_Application); } } @@ -406,11 +401,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The medicinal product that is being authorized. @@ -419,13 +414,13 @@ public List Identifier [CLSCompliant(false)] [References("MedicinalProduct","MedicinalProductPackaged")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The country in which the marketing authorization has been granted. @@ -435,11 +430,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Country { - get { if(_Country==null) _Country = new List(); return _Country; } + get => _Country ?? new List(); set { _Country = value; OnPropertyChanged("Country"); } } - private List _Country; + private List? _Country; /// /// Jurisdiction within a country. @@ -449,52 +444,49 @@ public List Country [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// The status of the marketing authorization. /// [FhirElement("status", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the given status has become applicable. /// [FhirElement("statusDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the given status has become applicable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -504,28 +496,25 @@ public string StatusDate /// [FhirElement("restoreDate", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RestoreDateElement + public Hl7.Fhir.Model.FhirDateTime? RestoreDateElement { get { return _RestoreDateElement; } set { _RestoreDateElement = value; OnPropertyChanged("RestoreDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RestoreDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RestoreDateElement; /// /// The date when a suspended the marketing or the marketing authorization of the product is anticipated to be restored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RestoreDate + public string? RestoreDate { - get { return RestoreDateElement != null ? RestoreDateElement.Value : null; } + get => _RestoreDateElement?.Value; set { - if (value == null) - RestoreDateElement = null; - else - RestoreDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RestoreDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RestoreDate"); } } @@ -535,54 +524,51 @@ public string RestoreDate /// [FhirElement("validityPeriod", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// A period of time after authorization before generic product applicatiosn can be submitted. /// [FhirElement("dataExclusivityPeriod", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.Period DataExclusivityPeriod + public Hl7.Fhir.Model.Period? DataExclusivityPeriod { get { return _DataExclusivityPeriod; } set { _DataExclusivityPeriod = value; OnPropertyChanged("DataExclusivityPeriod"); } } - private Hl7.Fhir.Model.Period _DataExclusivityPeriod; + private Hl7.Fhir.Model.Period? _DataExclusivityPeriod; /// /// The date when the first authorization was granted by a Medicines Regulatory Agency. /// [FhirElement("dateOfFirstAuthorization", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateOfFirstAuthorizationElement + public Hl7.Fhir.Model.FhirDateTime? DateOfFirstAuthorizationElement { get { return _DateOfFirstAuthorizationElement; } set { _DateOfFirstAuthorizationElement = value; OnPropertyChanged("DateOfFirstAuthorizationElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateOfFirstAuthorizationElement; + private Hl7.Fhir.Model.FhirDateTime? _DateOfFirstAuthorizationElement; /// /// The date when the first authorization was granted by a Medicines Regulatory Agency /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateOfFirstAuthorization + public string? DateOfFirstAuthorization { - get { return DateOfFirstAuthorizationElement != null ? DateOfFirstAuthorizationElement.Value : null; } + get => _DateOfFirstAuthorizationElement?.Value; set { - if (value == null) - DateOfFirstAuthorizationElement = null; - else - DateOfFirstAuthorizationElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateOfFirstAuthorizationElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateOfFirstAuthorization"); } } @@ -592,28 +578,25 @@ public string DateOfFirstAuthorization /// [FhirElement("internationalBirthDate", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime InternationalBirthDateElement + public Hl7.Fhir.Model.FhirDateTime? InternationalBirthDateElement { get { return _InternationalBirthDateElement; } set { _InternationalBirthDateElement = value; OnPropertyChanged("InternationalBirthDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _InternationalBirthDateElement; + private Hl7.Fhir.Model.FhirDateTime? _InternationalBirthDateElement; /// /// Date of first marketing authorization for a company's new medicinal product in any country in the World /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InternationalBirthDate + public string? InternationalBirthDate { - get { return InternationalBirthDateElement != null ? InternationalBirthDateElement.Value : null; } + get => _InternationalBirthDateElement?.Value; set { - if (value == null) - InternationalBirthDateElement = null; - else - InternationalBirthDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + InternationalBirthDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("InternationalBirthDate"); } } @@ -623,13 +606,13 @@ public string InternationalBirthDate /// [FhirElement("legalBasis", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalBasis + public Hl7.Fhir.Model.CodeableConcept? LegalBasis { get { return _LegalBasis; } set { _LegalBasis = value; OnPropertyChanged("LegalBasis"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalBasis; + private Hl7.Fhir.Model.CodeableConcept? _LegalBasis; /// /// Authorization in areas within a country. @@ -639,11 +622,11 @@ public Hl7.Fhir.Model.CodeableConcept LegalBasis [DataMember] public List JurisdictionalAuthorization { - get { if(_JurisdictionalAuthorization==null) _JurisdictionalAuthorization = new List(); return _JurisdictionalAuthorization; } + get => _JurisdictionalAuthorization ?? new List(); set { _JurisdictionalAuthorization = value; OnPropertyChanged("JurisdictionalAuthorization"); } } - private List _JurisdictionalAuthorization; + private List? _JurisdictionalAuthorization; /// /// Marketing Authorization Holder. @@ -652,13 +635,13 @@ public List /// Medicines Regulatory Agency. @@ -667,55 +650,51 @@ public Hl7.Fhir.Model.ResourceReference Holder [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Regulator + public Hl7.Fhir.Model.ResourceReference? Regulator { get { return _Regulator; } set { _Regulator = value; OnPropertyChanged("Regulator"); } } - private Hl7.Fhir.Model.ResourceReference _Regulator; + private Hl7.Fhir.Model.ResourceReference? _Regulator; /// /// The regulatory procedure for granting or amending a marketing authorization. /// [FhirElement("procedure", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent Procedure + public Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent _Procedure; + private Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent? _Procedure; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductAuthorization; - - if (dest == null) - { + if(other is not MedicinalProductAuthorization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Country.Any()) dest.Country = new List(Country.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(RestoreDateElement != null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)RestoreDateElement.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(DataExclusivityPeriod != null) dest.DataExclusivityPeriod = (Hl7.Fhir.Model.Period)DataExclusivityPeriod.DeepCopyInternal(); - if(DateOfFirstAuthorizationElement != null) dest.DateOfFirstAuthorizationElement = (Hl7.Fhir.Model.FhirDateTime)DateOfFirstAuthorizationElement.DeepCopyInternal(); - if(InternationalBirthDateElement != null) dest.InternationalBirthDateElement = (Hl7.Fhir.Model.FhirDateTime)InternationalBirthDateElement.DeepCopyInternal(); - if(LegalBasis != null) dest.LegalBasis = (Hl7.Fhir.Model.CodeableConcept)LegalBasis.DeepCopyInternal(); - if(JurisdictionalAuthorization.Any()) dest.JurisdictionalAuthorization = new List(JurisdictionalAuthorization.DeepCopyInternal()); - if(Holder != null) dest.Holder = (Hl7.Fhir.Model.ResourceReference)Holder.DeepCopyInternal(); - if(Regulator != null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)Regulator.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent)Procedure.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Country is not null) dest.Country = new List(_Country.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_RestoreDateElement is not null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)_RestoreDateElement.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_DataExclusivityPeriod is not null) dest.DataExclusivityPeriod = (Hl7.Fhir.Model.Period)_DataExclusivityPeriod.DeepCopyInternal(); + if(_DateOfFirstAuthorizationElement is not null) dest.DateOfFirstAuthorizationElement = (Hl7.Fhir.Model.FhirDateTime)_DateOfFirstAuthorizationElement.DeepCopyInternal(); + if(_InternationalBirthDateElement is not null) dest.InternationalBirthDateElement = (Hl7.Fhir.Model.FhirDateTime)_InternationalBirthDateElement.DeepCopyInternal(); + if(_LegalBasis is not null) dest.LegalBasis = (Hl7.Fhir.Model.CodeableConcept)_LegalBasis.DeepCopyInternal(); + if(_JurisdictionalAuthorization is not null) dest.JurisdictionalAuthorization = new List(_JurisdictionalAuthorization.DeepCopyInternal()); + if(_Holder is not null) dest.Holder = (Hl7.Fhir.Model.ResourceReference)_Holder.DeepCopyInternal(); + if(_Regulator is not null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)_Regulator.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent)_Procedure.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -727,139 +706,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductAuthorization; - if(otherT == null) return false; + if(other is not MedicinalProductAuthorization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Country, otherT.Country)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(RestoreDateElement, otherT.RestoreDateElement)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(DataExclusivityPeriod, otherT.DataExclusivityPeriod)) return false; - if(!comparer.Equals(DateOfFirstAuthorizationElement, otherT.DateOfFirstAuthorizationElement)) return false; - if(!comparer.Equals(InternationalBirthDateElement, otherT.InternationalBirthDateElement)) return false; - if(!comparer.Equals(LegalBasis, otherT.LegalBasis)) return false; - if(!comparer.ListEquals(JurisdictionalAuthorization, otherT.JurisdictionalAuthorization)) return false; - if(!comparer.Equals(Holder, otherT.Holder)) return false; - if(!comparer.Equals(Regulator, otherT.Regulator)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Country, otherT._Country)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_RestoreDateElement, otherT._RestoreDateElement)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_DataExclusivityPeriod, otherT._DataExclusivityPeriod)) return false; + if(!comparer.Equals(_DateOfFirstAuthorizationElement, otherT._DateOfFirstAuthorizationElement)) return false; + if(!comparer.Equals(_InternationalBirthDateElement, otherT._InternationalBirthDateElement)) return false; + if(!comparer.Equals(_LegalBasis, otherT._LegalBasis)) return false; + if(!comparer.ListEquals(_JurisdictionalAuthorization, otherT._JurisdictionalAuthorization)) return false; + if(!comparer.Equals(_Holder, otherT._Holder)) return false; + if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "country": - value = Country; - return Country?.Any() == true; + value = _Country; + return _Country?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "restoreDate": - value = RestoreDateElement; - return RestoreDateElement is not null; + value = _RestoreDateElement; + return _RestoreDateElement is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "dataExclusivityPeriod": - value = DataExclusivityPeriod; - return DataExclusivityPeriod is not null; + value = _DataExclusivityPeriod; + return _DataExclusivityPeriod is not null; case "dateOfFirstAuthorization": - value = DateOfFirstAuthorizationElement; - return DateOfFirstAuthorizationElement is not null; + value = _DateOfFirstAuthorizationElement; + return _DateOfFirstAuthorizationElement is not null; case "internationalBirthDate": - value = InternationalBirthDateElement; - return InternationalBirthDateElement is not null; + value = _InternationalBirthDateElement; + return _InternationalBirthDateElement is not null; case "legalBasis": - value = LegalBasis; - return LegalBasis is not null; + value = _LegalBasis; + return _LegalBasis is not null; case "jurisdictionalAuthorization": - value = JurisdictionalAuthorization; - return JurisdictionalAuthorization?.Any() == true; + value = _JurisdictionalAuthorization; + return _JurisdictionalAuthorization?.Any() == true; case "holder": - value = Holder; - return Holder is not null; + value = _Holder; + return _Holder is not null; case "regulator": - value = Regulator; - return Regulator is not null; + value = _Regulator; + return _Regulator is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "country": - Country = (List)value; + Country = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "restoreDate": - RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "dataExclusivityPeriod": - DataExclusivityPeriod = (Hl7.Fhir.Model.Period)value; + DataExclusivityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "dateOfFirstAuthorization": - DateOfFirstAuthorizationElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateOfFirstAuthorizationElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "internationalBirthDate": - InternationalBirthDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + InternationalBirthDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "legalBasis": - LegalBasis = (Hl7.Fhir.Model.CodeableConcept)value; + LegalBasis = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdictionalAuthorization": - JurisdictionalAuthorization = (List)value; + JurisdictionalAuthorization = (List?)value!; return this; case "holder": - Holder = (Hl7.Fhir.Model.ResourceReference)value; + Holder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "regulator": - Regulator = (Hl7.Fhir.Model.ResourceReference)value; + Regulator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent)value; + Procedure = (Hl7.Fhir.Model.MedicinalProductAuthorization.ProcedureComponent?)value; return this; default: return base.SetValue(key, value); @@ -870,22 +849,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Country?.Any() == true) yield return new KeyValuePair("country",Country); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",RestoreDateElement); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (DataExclusivityPeriod is not null) yield return new KeyValuePair("dataExclusivityPeriod",DataExclusivityPeriod); - if (DateOfFirstAuthorizationElement is not null) yield return new KeyValuePair("dateOfFirstAuthorization",DateOfFirstAuthorizationElement); - if (InternationalBirthDateElement is not null) yield return new KeyValuePair("internationalBirthDate",InternationalBirthDateElement); - if (LegalBasis is not null) yield return new KeyValuePair("legalBasis",LegalBasis); - if (JurisdictionalAuthorization?.Any() == true) yield return new KeyValuePair("jurisdictionalAuthorization",JurisdictionalAuthorization); - if (Holder is not null) yield return new KeyValuePair("holder",Holder); - if (Regulator is not null) yield return new KeyValuePair("regulator",Regulator); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Country?.Any() == true) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",_RestoreDateElement); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_DataExclusivityPeriod is not null) yield return new KeyValuePair("dataExclusivityPeriod",_DataExclusivityPeriod); + if (_DateOfFirstAuthorizationElement is not null) yield return new KeyValuePair("dateOfFirstAuthorization",_DateOfFirstAuthorizationElement); + if (_InternationalBirthDateElement is not null) yield return new KeyValuePair("internationalBirthDate",_InternationalBirthDateElement); + if (_LegalBasis is not null) yield return new KeyValuePair("legalBasis",_LegalBasis); + if (_JurisdictionalAuthorization?.Any() == true) yield return new KeyValuePair("jurisdictionalAuthorization",_JurisdictionalAuthorization); + if (_Holder is not null) yield return new KeyValuePair("holder",_Holder); + if (_Regulator is not null) yield return new KeyValuePair("regulator",_Regulator); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs index 84ff5ccde..881d9ccbd 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,13 +81,13 @@ public partial class OtherTherapyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("therapyRelationshipType", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TherapyRelationshipType + public Hl7.Fhir.Model.CodeableConcept? TherapyRelationshipType { get { return _TherapyRelationshipType; } set { _TherapyRelationshipType = value; OnPropertyChanged("TherapyRelationshipType"); } } - private Hl7.Fhir.Model.CodeableConcept _TherapyRelationshipType; + private Hl7.Fhir.Model.CodeableConcept? _TherapyRelationshipType; /// /// Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication. @@ -95,26 +98,22 @@ public Hl7.Fhir.Model.CodeableConcept TherapyRelationshipType [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; protected internal override void CopyToInternal(Base other) { - var dest = other as OtherTherapyComponent; - - if (dest == null) - { + if(other is not OtherTherapyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TherapyRelationshipType != null) dest.TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept)TherapyRelationshipType.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); + if(_TherapyRelationshipType is not null) dest.TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept)_TherapyRelationshipType.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -126,41 +125,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherTherapyComponent; - if(otherT == null) return false; + if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TherapyRelationshipType, otherT.TherapyRelationshipType)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TherapyRelationshipType, otherT._TherapyRelationshipType)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "therapyRelationshipType": - value = TherapyRelationshipType; - return TherapyRelationshipType is not null; + value = _TherapyRelationshipType; + return _TherapyRelationshipType is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "therapyRelationshipType": - TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept)value; + TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -171,8 +170,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TherapyRelationshipType is not null) yield return new KeyValuePair("therapyRelationshipType",TherapyRelationshipType); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); + if (_TherapyRelationshipType is not null) yield return new KeyValuePair("therapyRelationshipType",_TherapyRelationshipType); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); } } @@ -187,37 +186,37 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// The disease, symptom or procedure for the contraindication. /// [FhirElement("disease", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Disease + public Hl7.Fhir.Model.CodeableConcept? Disease { get { return _Disease; } set { _Disease = value; OnPropertyChanged("Disease"); } } - private Hl7.Fhir.Model.CodeableConcept _Disease; + private Hl7.Fhir.Model.CodeableConcept? _Disease; /// /// The status of the disease or symptom for the contraindication. /// [FhirElement("diseaseStatus", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DiseaseStatus + public Hl7.Fhir.Model.CodeableConcept? DiseaseStatus { get { return _DiseaseStatus; } set { _DiseaseStatus = value; OnPropertyChanged("DiseaseStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _DiseaseStatus; + private Hl7.Fhir.Model.CodeableConcept? _DiseaseStatus; /// /// A comorbidity (concurrent condition) or coinfection. @@ -227,11 +226,11 @@ public Hl7.Fhir.Model.CodeableConcept DiseaseStatus [DataMember] public List Comorbidity { - get { if(_Comorbidity==null) _Comorbidity = new List(); return _Comorbidity; } + get => _Comorbidity ?? new List(); set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } - private List _Comorbidity; + private List? _Comorbidity; /// /// Information about the use of the medicinal product in relation to other therapies as part of the indication. @@ -243,11 +242,11 @@ public List Comorbidity [DataMember] public List TherapeuticIndication { - get { if(_TherapeuticIndication==null) _TherapeuticIndication = new List(); return _TherapeuticIndication; } + get => _TherapeuticIndication ?? new List(); set { _TherapeuticIndication = value; OnPropertyChanged("TherapeuticIndication"); } } - private List _TherapeuticIndication; + private List? _TherapeuticIndication; /// /// Information about the use of the medicinal product in relation to other therapies described as part of the indication. @@ -257,11 +256,11 @@ public List TherapeuticIndication [DataMember] public List OtherTherapy { - get { if(_OtherTherapy==null) _OtherTherapy = new List(); return _OtherTherapy; } + get => _OtherTherapy ?? new List(); set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } - private List _OtherTherapy; + private List? _OtherTherapy; /// /// The population group to which this applies. @@ -271,29 +270,25 @@ public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductContraindication; - - if (dest == null) - { + if(other is not MedicinalProductContraindication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Disease != null) dest.Disease = (Hl7.Fhir.Model.CodeableConcept)Disease.DeepCopyInternal(); - if(DiseaseStatus != null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept)DiseaseStatus.DeepCopyInternal(); - if(Comorbidity.Any()) dest.Comorbidity = new List(Comorbidity.DeepCopyInternal()); - if(TherapeuticIndication.Any()) dest.TherapeuticIndication = new List(TherapeuticIndication.DeepCopyInternal()); - if(OtherTherapy.Any()) dest.OtherTherapy = new List(OtherTherapy.DeepCopyInternal()); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Disease is not null) dest.Disease = (Hl7.Fhir.Model.CodeableConcept)_Disease.DeepCopyInternal(); + if(_DiseaseStatus is not null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept)_DiseaseStatus.DeepCopyInternal(); + if(_Comorbidity is not null) dest.Comorbidity = new List(_Comorbidity.DeepCopyInternal()); + if(_TherapeuticIndication is not null) dest.TherapeuticIndication = new List(_TherapeuticIndication.DeepCopyInternal()); + if(_OtherTherapy is not null) dest.OtherTherapy = new List(_OtherTherapy.DeepCopyInternal()); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -305,76 +300,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductContraindication; - if(otherT == null) return false; + if(other is not MedicinalProductContraindication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Disease, otherT.Disease)) return false; - if(!comparer.Equals(DiseaseStatus, otherT.DiseaseStatus)) return false; - if(!comparer.ListEquals(Comorbidity, otherT.Comorbidity)) return false; - if(!comparer.ListEquals(TherapeuticIndication, otherT.TherapeuticIndication)) return false; - if(!comparer.ListEquals(OtherTherapy, otherT.OtherTherapy)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Disease, otherT._Disease)) return false; + if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; + if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; + if(!comparer.ListEquals(_TherapeuticIndication, otherT._TherapeuticIndication)) return false; + if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "disease": - value = Disease; - return Disease is not null; + value = _Disease; + return _Disease is not null; case "diseaseStatus": - value = DiseaseStatus; - return DiseaseStatus is not null; + value = _DiseaseStatus; + return _DiseaseStatus is not null; case "comorbidity": - value = Comorbidity; - return Comorbidity?.Any() == true; + value = _Comorbidity; + return _Comorbidity?.Any() == true; case "therapeuticIndication": - value = TherapeuticIndication; - return TherapeuticIndication?.Any() == true; + value = _TherapeuticIndication; + return _TherapeuticIndication?.Any() == true; case "otherTherapy": - value = OtherTherapy; - return OtherTherapy?.Any() == true; + value = _OtherTherapy; + return _OtherTherapy?.Any() == true; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "disease": - Disease = (Hl7.Fhir.Model.CodeableConcept)value; + Disease = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "diseaseStatus": - DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept)value; + DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "comorbidity": - Comorbidity = (List)value; + Comorbidity = (List?)value!; return this; case "therapeuticIndication": - TherapeuticIndication = (List)value; + TherapeuticIndication = (List?)value!; return this; case "otherTherapy": - OtherTherapy = (List)value; + OtherTherapy = (List?)value!; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; default: return base.SetValue(key, value); @@ -385,13 +380,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Disease is not null) yield return new KeyValuePair("disease",Disease); - if (DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",DiseaseStatus); - if (Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",Comorbidity); - if (TherapeuticIndication?.Any() == true) yield return new KeyValuePair("therapeuticIndication",TherapeuticIndication); - if (OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",OtherTherapy); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Disease is not null) yield return new KeyValuePair("disease",_Disease); + if (_DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",_DiseaseStatus); + if (_Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",_Comorbidity); + if (_TherapeuticIndication?.Any() == true) yield return new KeyValuePair("therapeuticIndication",_TherapeuticIndication); + if (_OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",_OtherTherapy); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs index f95dde9be..1cc1d28ab 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,13 +81,13 @@ public partial class OtherTherapyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("therapyRelationshipType", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TherapyRelationshipType + public Hl7.Fhir.Model.CodeableConcept? TherapyRelationshipType { get { return _TherapyRelationshipType; } set { _TherapyRelationshipType = value; OnPropertyChanged("TherapyRelationshipType"); } } - private Hl7.Fhir.Model.CodeableConcept _TherapyRelationshipType; + private Hl7.Fhir.Model.CodeableConcept? _TherapyRelationshipType; /// /// Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication. @@ -95,26 +98,22 @@ public Hl7.Fhir.Model.CodeableConcept TherapyRelationshipType [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; protected internal override void CopyToInternal(Base other) { - var dest = other as OtherTherapyComponent; - - if (dest == null) - { + if(other is not OtherTherapyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TherapyRelationshipType != null) dest.TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept)TherapyRelationshipType.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); + if(_TherapyRelationshipType is not null) dest.TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept)_TherapyRelationshipType.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -126,41 +125,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherTherapyComponent; - if(otherT == null) return false; + if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TherapyRelationshipType, otherT.TherapyRelationshipType)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TherapyRelationshipType, otherT._TherapyRelationshipType)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "therapyRelationshipType": - value = TherapyRelationshipType; - return TherapyRelationshipType is not null; + value = _TherapyRelationshipType; + return _TherapyRelationshipType is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "therapyRelationshipType": - TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept)value; + TherapyRelationshipType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -171,8 +170,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TherapyRelationshipType is not null) yield return new KeyValuePair("therapyRelationshipType",TherapyRelationshipType); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); + if (_TherapyRelationshipType is not null) yield return new KeyValuePair("therapyRelationshipType",_TherapyRelationshipType); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); } } @@ -187,37 +186,37 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// The disease, symptom or procedure that is the indication for treatment. /// [FhirElement("diseaseSymptomProcedure", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DiseaseSymptomProcedure + public Hl7.Fhir.Model.CodeableConcept? DiseaseSymptomProcedure { get { return _DiseaseSymptomProcedure; } set { _DiseaseSymptomProcedure = value; OnPropertyChanged("DiseaseSymptomProcedure"); } } - private Hl7.Fhir.Model.CodeableConcept _DiseaseSymptomProcedure; + private Hl7.Fhir.Model.CodeableConcept? _DiseaseSymptomProcedure; /// /// The status of the disease or symptom for which the indication applies. /// [FhirElement("diseaseStatus", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DiseaseStatus + public Hl7.Fhir.Model.CodeableConcept? DiseaseStatus { get { return _DiseaseStatus; } set { _DiseaseStatus = value; OnPropertyChanged("DiseaseStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _DiseaseStatus; + private Hl7.Fhir.Model.CodeableConcept? _DiseaseStatus; /// /// Comorbidity (concurrent condition) or co-infection as part of the indication. @@ -227,37 +226,37 @@ public Hl7.Fhir.Model.CodeableConcept DiseaseStatus [DataMember] public List Comorbidity { - get { if(_Comorbidity==null) _Comorbidity = new List(); return _Comorbidity; } + get => _Comorbidity ?? new List(); set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } - private List _Comorbidity; + private List? _Comorbidity; /// /// The intended effect, aim or strategy to be achieved by the indication. /// [FhirElement("intendedEffect", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept IntendedEffect + public Hl7.Fhir.Model.CodeableConcept? IntendedEffect { get { return _IntendedEffect; } set { _IntendedEffect = value; OnPropertyChanged("IntendedEffect"); } } - private Hl7.Fhir.Model.CodeableConcept _IntendedEffect; + private Hl7.Fhir.Model.CodeableConcept? _IntendedEffect; /// /// Timing or duration information as part of the indication. /// [FhirElement("duration", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Quantity Duration + public Hl7.Fhir.Model.Quantity? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Quantity _Duration; + private Hl7.Fhir.Model.Quantity? _Duration; /// /// Information about the use of the medicinal product in relation to other therapies described as part of the indication. @@ -267,11 +266,11 @@ public Hl7.Fhir.Model.Quantity Duration [DataMember] public List OtherTherapy { - get { if(_OtherTherapy==null) _OtherTherapy = new List(); return _OtherTherapy; } + get => _OtherTherapy ?? new List(); set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } - private List _OtherTherapy; + private List? _OtherTherapy; /// /// Describe the undesirable effects of the medicinal product. @@ -283,11 +282,11 @@ public List Oth [DataMember] public List UndesirableEffect { - get { if(_UndesirableEffect==null) _UndesirableEffect = new List(); return _UndesirableEffect; } + get => _UndesirableEffect ?? new List(); set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } - private List _UndesirableEffect; + private List? _UndesirableEffect; /// /// The population group to which this applies. @@ -297,31 +296,27 @@ public List UndesirableEffect [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductIndication; - - if (dest == null) - { + if(other is not MedicinalProductIndication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(DiseaseSymptomProcedure != null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableConcept)DiseaseSymptomProcedure.DeepCopyInternal(); - if(DiseaseStatus != null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept)DiseaseStatus.DeepCopyInternal(); - if(Comorbidity.Any()) dest.Comorbidity = new List(Comorbidity.DeepCopyInternal()); - if(IntendedEffect != null) dest.IntendedEffect = (Hl7.Fhir.Model.CodeableConcept)IntendedEffect.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Quantity)Duration.DeepCopyInternal(); - if(OtherTherapy.Any()) dest.OtherTherapy = new List(OtherTherapy.DeepCopyInternal()); - if(UndesirableEffect.Any()) dest.UndesirableEffect = new List(UndesirableEffect.DeepCopyInternal()); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_DiseaseSymptomProcedure is not null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableConcept)_DiseaseSymptomProcedure.DeepCopyInternal(); + if(_DiseaseStatus is not null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept)_DiseaseStatus.DeepCopyInternal(); + if(_Comorbidity is not null) dest.Comorbidity = new List(_Comorbidity.DeepCopyInternal()); + if(_IntendedEffect is not null) dest.IntendedEffect = (Hl7.Fhir.Model.CodeableConcept)_IntendedEffect.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Quantity)_Duration.DeepCopyInternal(); + if(_OtherTherapy is not null) dest.OtherTherapy = new List(_OtherTherapy.DeepCopyInternal()); + if(_UndesirableEffect is not null) dest.UndesirableEffect = new List(_UndesirableEffect.DeepCopyInternal()); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -333,90 +328,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductIndication; - if(otherT == null) return false; + if(other is not MedicinalProductIndication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DiseaseSymptomProcedure, otherT.DiseaseSymptomProcedure)) return false; - if(!comparer.Equals(DiseaseStatus, otherT.DiseaseStatus)) return false; - if(!comparer.ListEquals(Comorbidity, otherT.Comorbidity)) return false; - if(!comparer.Equals(IntendedEffect, otherT.IntendedEffect)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.ListEquals(OtherTherapy, otherT.OtherTherapy)) return false; - if(!comparer.ListEquals(UndesirableEffect, otherT.UndesirableEffect)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; + if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; + if(!comparer.Equals(_IntendedEffect, otherT._IntendedEffect)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; + if(!comparer.ListEquals(_UndesirableEffect, otherT._UndesirableEffect)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "diseaseSymptomProcedure": - value = DiseaseSymptomProcedure; - return DiseaseSymptomProcedure is not null; + value = _DiseaseSymptomProcedure; + return _DiseaseSymptomProcedure is not null; case "diseaseStatus": - value = DiseaseStatus; - return DiseaseStatus is not null; + value = _DiseaseStatus; + return _DiseaseStatus is not null; case "comorbidity": - value = Comorbidity; - return Comorbidity?.Any() == true; + value = _Comorbidity; + return _Comorbidity?.Any() == true; case "intendedEffect": - value = IntendedEffect; - return IntendedEffect is not null; + value = _IntendedEffect; + return _IntendedEffect is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "otherTherapy": - value = OtherTherapy; - return OtherTherapy?.Any() == true; + value = _OtherTherapy; + return _OtherTherapy?.Any() == true; case "undesirableEffect": - value = UndesirableEffect; - return UndesirableEffect?.Any() == true; + value = _UndesirableEffect; + return _UndesirableEffect?.Any() == true; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "diseaseSymptomProcedure": - DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableConcept)value; + DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "diseaseStatus": - DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept)value; + DiseaseStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "comorbidity": - Comorbidity = (List)value; + Comorbidity = (List?)value!; return this; case "intendedEffect": - IntendedEffect = (Hl7.Fhir.Model.CodeableConcept)value; + IntendedEffect = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Quantity)value; + Duration = (Hl7.Fhir.Model.Quantity?)value; return this; case "otherTherapy": - OtherTherapy = (List)value; + OtherTherapy = (List?)value!; return this; case "undesirableEffect": - UndesirableEffect = (List)value; + UndesirableEffect = (List?)value!; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; default: return base.SetValue(key, value); @@ -427,15 +422,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",DiseaseSymptomProcedure); - if (DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",DiseaseStatus); - if (Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",Comorbidity); - if (IntendedEffect is not null) yield return new KeyValuePair("intendedEffect",IntendedEffect); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",OtherTherapy); - if (UndesirableEffect?.Any() == true) yield return new KeyValuePair("undesirableEffect",UndesirableEffect); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",_DiseaseSymptomProcedure); + if (_DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",_DiseaseStatus); + if (_Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",_Comorbidity); + if (_IntendedEffect is not null) yield return new KeyValuePair("intendedEffect",_IntendedEffect); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",_OtherTherapy); + if (_UndesirableEffect?.Any() == true) yield return new KeyValuePair("undesirableEffect",_UndesirableEffect); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs index b6d88548d..f452b842a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MedicinalProductIngredient","http://hl7.org/fhir/StructureDefinition/MedicinalProductIngredient")] - public partial class MedicinalProductIngredient : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class MedicinalProductIngredient : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -75,13 +78,13 @@ public partial class SpecifiedSubstanceComponent : Hl7.Fhir.Model.BackboneElemen [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The group of specified substance, e.g. group 1 to 4. @@ -89,26 +92,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("group", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Group + public Hl7.Fhir.Model.CodeableConcept? Group { get { return _Group; } set { _Group = value; OnPropertyChanged("Group"); } } - private Hl7.Fhir.Model.CodeableConcept _Group; + private Hl7.Fhir.Model.CodeableConcept? _Group; /// /// Confidentiality level of the specified substance as the ingredient. /// [FhirElement("confidentiality", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Confidentiality + public Hl7.Fhir.Model.CodeableConcept? Confidentiality { get { return _Confidentiality; } set { _Confidentiality = value; OnPropertyChanged("Confidentiality"); } } - private Hl7.Fhir.Model.CodeableConcept _Confidentiality; + private Hl7.Fhir.Model.CodeableConcept? _Confidentiality; /// /// Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product. @@ -118,26 +121,22 @@ public Hl7.Fhir.Model.CodeableConcept Confidentiality [DataMember] public List Strength { - get { if(_Strength==null) _Strength = new List(); return _Strength; } + get => _Strength ?? new List(); set { _Strength = value; OnPropertyChanged("Strength"); } } - private List _Strength; + private List? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as SpecifiedSubstanceComponent; - - if (dest == null) - { + if(other is not SpecifiedSubstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Group != null) dest.Group = (Hl7.Fhir.Model.CodeableConcept)Group.DeepCopyInternal(); - if(Confidentiality != null) dest.Confidentiality = (Hl7.Fhir.Model.CodeableConcept)Confidentiality.DeepCopyInternal(); - if(Strength.Any()) dest.Strength = new List(Strength.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Group is not null) dest.Group = (Hl7.Fhir.Model.CodeableConcept)_Group.DeepCopyInternal(); + if(_Confidentiality is not null) dest.Confidentiality = (Hl7.Fhir.Model.CodeableConcept)_Confidentiality.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = new List(_Strength.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -149,55 +148,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecifiedSubstanceComponent; - if(otherT == null) return false; + if(other is not SpecifiedSubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Group, otherT.Group)) return false; - if(!comparer.Equals(Confidentiality, otherT.Confidentiality)) return false; - if(!comparer.ListEquals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Group, otherT._Group)) return false; + if(!comparer.Equals(_Confidentiality, otherT._Confidentiality)) return false; + if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "group": - value = Group; - return Group is not null; + value = _Group; + return _Group is not null; case "confidentiality": - value = Confidentiality; - return Confidentiality is not null; + value = _Confidentiality; + return _Confidentiality is not null; case "strength": - value = Strength; - return Strength?.Any() == true; + value = _Strength; + return _Strength?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "group": - Group = (Hl7.Fhir.Model.CodeableConcept)value; + Group = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "confidentiality": - Confidentiality = (Hl7.Fhir.Model.CodeableConcept)value; + Confidentiality = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "strength": - Strength = (List)value; + Strength = (List?)value!; return this; default: return base.SetValue(key, value); @@ -208,10 +207,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Group is not null) yield return new KeyValuePair("group",Group); - if (Confidentiality is not null) yield return new KeyValuePair("confidentiality",Confidentiality); - if (Strength?.Any() == true) yield return new KeyValuePair("strength",Strength); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Group is not null) yield return new KeyValuePair("group",_Group); + if (_Confidentiality is not null) yield return new KeyValuePair("confidentiality",_Confidentiality); + if (_Strength?.Any() == true) yield return new KeyValuePair("strength",_Strength); } } @@ -235,80 +234,77 @@ public partial class StrengthComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("presentation", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Ratio Presentation + public Hl7.Fhir.Model.Ratio? Presentation { get { return _Presentation; } set { _Presentation = value; OnPropertyChanged("Presentation"); } } - private Hl7.Fhir.Model.Ratio _Presentation; + private Hl7.Fhir.Model.Ratio? _Presentation; /// /// A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit. /// [FhirElement("presentationLowLimit", InSummary=true, IsModifier=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Ratio PresentationLowLimit + public Hl7.Fhir.Model.Ratio? PresentationLowLimit { get { return _PresentationLowLimit; } set { _PresentationLowLimit = value; OnPropertyChanged("PresentationLowLimit"); } } - private Hl7.Fhir.Model.Ratio _PresentationLowLimit; + private Hl7.Fhir.Model.Ratio? _PresentationLowLimit; /// /// The strength per unitary volume (or mass). /// [FhirElement("concentration", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Ratio Concentration + public Hl7.Fhir.Model.Ratio? Concentration { get { return _Concentration; } set { _Concentration = value; OnPropertyChanged("Concentration"); } } - private Hl7.Fhir.Model.Ratio _Concentration; + private Hl7.Fhir.Model.Ratio? _Concentration; /// /// A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit. /// [FhirElement("concentrationLowLimit", InSummary=true, IsModifier=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Ratio ConcentrationLowLimit + public Hl7.Fhir.Model.Ratio? ConcentrationLowLimit { get { return _ConcentrationLowLimit; } set { _ConcentrationLowLimit = value; OnPropertyChanged("ConcentrationLowLimit"); } } - private Hl7.Fhir.Model.Ratio _ConcentrationLowLimit; + private Hl7.Fhir.Model.Ratio? _ConcentrationLowLimit; /// /// For when strength is measured at a particular point or distance. /// [FhirElement("measurementPoint", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString MeasurementPointElement + public Hl7.Fhir.Model.FhirString? MeasurementPointElement { get { return _MeasurementPointElement; } set { _MeasurementPointElement = value; OnPropertyChanged("MeasurementPointElement"); } } - private Hl7.Fhir.Model.FhirString _MeasurementPointElement; + private Hl7.Fhir.Model.FhirString? _MeasurementPointElement; /// /// For when strength is measured at a particular point or distance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeasurementPoint + public string? MeasurementPoint { - get { return MeasurementPointElement != null ? MeasurementPointElement.Value : null; } + get => _MeasurementPointElement?.Value; set { - if (value == null) - MeasurementPointElement = null; - else - MeasurementPointElement = new Hl7.Fhir.Model.FhirString(value); + MeasurementPointElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MeasurementPoint"); } } @@ -321,11 +317,11 @@ public string MeasurementPoint [DataMember] public List Country { - get { if(_Country==null) _Country = new List(); return _Country; } + get => _Country ?? new List(); set { _Country = value; OnPropertyChanged("Country"); } } - private List _Country; + private List? _Country; /// /// Strength expressed in terms of a reference substance. @@ -335,29 +331,25 @@ public List Country [DataMember] public List ReferenceStrength { - get { if(_ReferenceStrength==null) _ReferenceStrength = new List(); return _ReferenceStrength; } + get => _ReferenceStrength ?? new List(); set { _ReferenceStrength = value; OnPropertyChanged("ReferenceStrength"); } } - private List _ReferenceStrength; + private List? _ReferenceStrength; protected internal override void CopyToInternal(Base other) { - var dest = other as StrengthComponent; - - if (dest == null) - { + if(other is not StrengthComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Presentation != null) dest.Presentation = (Hl7.Fhir.Model.Ratio)Presentation.DeepCopyInternal(); - if(PresentationLowLimit != null) dest.PresentationLowLimit = (Hl7.Fhir.Model.Ratio)PresentationLowLimit.DeepCopyInternal(); - if(Concentration != null) dest.Concentration = (Hl7.Fhir.Model.Ratio)Concentration.DeepCopyInternal(); - if(ConcentrationLowLimit != null) dest.ConcentrationLowLimit = (Hl7.Fhir.Model.Ratio)ConcentrationLowLimit.DeepCopyInternal(); - if(MeasurementPointElement != null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)MeasurementPointElement.DeepCopyInternal(); - if(Country.Any()) dest.Country = new List(Country.DeepCopyInternal()); - if(ReferenceStrength.Any()) dest.ReferenceStrength = new List(ReferenceStrength.DeepCopyInternal()); + if(_Presentation is not null) dest.Presentation = (Hl7.Fhir.Model.Ratio)_Presentation.DeepCopyInternal(); + if(_PresentationLowLimit is not null) dest.PresentationLowLimit = (Hl7.Fhir.Model.Ratio)_PresentationLowLimit.DeepCopyInternal(); + if(_Concentration is not null) dest.Concentration = (Hl7.Fhir.Model.Ratio)_Concentration.DeepCopyInternal(); + if(_ConcentrationLowLimit is not null) dest.ConcentrationLowLimit = (Hl7.Fhir.Model.Ratio)_ConcentrationLowLimit.DeepCopyInternal(); + if(_MeasurementPointElement is not null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)_MeasurementPointElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = new List(_Country.DeepCopyInternal()); + if(_ReferenceStrength is not null) dest.ReferenceStrength = new List(_ReferenceStrength.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -369,76 +361,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StrengthComponent; - if(otherT == null) return false; + if(other is not StrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Presentation, otherT.Presentation)) return false; - if(!comparer.Equals(PresentationLowLimit, otherT.PresentationLowLimit)) return false; - if(!comparer.Equals(Concentration, otherT.Concentration)) return false; - if(!comparer.Equals(ConcentrationLowLimit, otherT.ConcentrationLowLimit)) return false; - if(!comparer.Equals(MeasurementPointElement, otherT.MeasurementPointElement)) return false; - if(!comparer.ListEquals(Country, otherT.Country)) return false; - if(!comparer.ListEquals(ReferenceStrength, otherT.ReferenceStrength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; + if(!comparer.Equals(_PresentationLowLimit, otherT._PresentationLowLimit)) return false; + if(!comparer.Equals(_Concentration, otherT._Concentration)) return false; + if(!comparer.Equals(_ConcentrationLowLimit, otherT._ConcentrationLowLimit)) return false; + if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; + if(!comparer.ListEquals(_Country, otherT._Country)) return false; + if(!comparer.ListEquals(_ReferenceStrength, otherT._ReferenceStrength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "presentation": - value = Presentation; - return Presentation is not null; + value = _Presentation; + return _Presentation is not null; case "presentationLowLimit": - value = PresentationLowLimit; - return PresentationLowLimit is not null; + value = _PresentationLowLimit; + return _PresentationLowLimit is not null; case "concentration": - value = Concentration; - return Concentration is not null; + value = _Concentration; + return _Concentration is not null; case "concentrationLowLimit": - value = ConcentrationLowLimit; - return ConcentrationLowLimit is not null; + value = _ConcentrationLowLimit; + return _ConcentrationLowLimit is not null; case "measurementPoint": - value = MeasurementPointElement; - return MeasurementPointElement is not null; + value = _MeasurementPointElement; + return _MeasurementPointElement is not null; case "country": - value = Country; - return Country?.Any() == true; + value = _Country; + return _Country?.Any() == true; case "referenceStrength": - value = ReferenceStrength; - return ReferenceStrength?.Any() == true; + value = _ReferenceStrength; + return _ReferenceStrength?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "presentation": - Presentation = (Hl7.Fhir.Model.Ratio)value; + Presentation = (Hl7.Fhir.Model.Ratio?)value; return this; case "presentationLowLimit": - PresentationLowLimit = (Hl7.Fhir.Model.Ratio)value; + PresentationLowLimit = (Hl7.Fhir.Model.Ratio?)value; return this; case "concentration": - Concentration = (Hl7.Fhir.Model.Ratio)value; + Concentration = (Hl7.Fhir.Model.Ratio?)value; return this; case "concentrationLowLimit": - ConcentrationLowLimit = (Hl7.Fhir.Model.Ratio)value; + ConcentrationLowLimit = (Hl7.Fhir.Model.Ratio?)value; return this; case "measurementPoint": - MeasurementPointElement = (Hl7.Fhir.Model.FhirString)value; + MeasurementPointElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - Country = (List)value; + Country = (List?)value!; return this; case "referenceStrength": - ReferenceStrength = (List)value; + ReferenceStrength = (List?)value!; return this; default: return base.SetValue(key, value); @@ -449,13 +441,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Presentation is not null) yield return new KeyValuePair("presentation",Presentation); - if (PresentationLowLimit is not null) yield return new KeyValuePair("presentationLowLimit",PresentationLowLimit); - if (Concentration is not null) yield return new KeyValuePair("concentration",Concentration); - if (ConcentrationLowLimit is not null) yield return new KeyValuePair("concentrationLowLimit",ConcentrationLowLimit); - if (MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",MeasurementPointElement); - if (Country?.Any() == true) yield return new KeyValuePair("country",Country); - if (ReferenceStrength?.Any() == true) yield return new KeyValuePair("referenceStrength",ReferenceStrength); + if (_Presentation is not null) yield return new KeyValuePair("presentation",_Presentation); + if (_PresentationLowLimit is not null) yield return new KeyValuePair("presentationLowLimit",_PresentationLowLimit); + if (_Concentration is not null) yield return new KeyValuePair("concentration",_Concentration); + if (_ConcentrationLowLimit is not null) yield return new KeyValuePair("concentrationLowLimit",_ConcentrationLowLimit); + if (_MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",_MeasurementPointElement); + if (_Country?.Any() == true) yield return new KeyValuePair("country",_Country); + if (_ReferenceStrength?.Any() == true) yield return new KeyValuePair("referenceStrength",_ReferenceStrength); } } @@ -478,13 +470,13 @@ public partial class ReferenceStrengthComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("substance", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Strength expressed in terms of a reference substance. @@ -492,54 +484,51 @@ public Hl7.Fhir.Model.CodeableConcept Substance [FhirElement("strength", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Ratio Strength + public Hl7.Fhir.Model.Ratio? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.Ratio _Strength; + private Hl7.Fhir.Model.Ratio? _Strength; /// /// Strength expressed in terms of a reference substance. /// [FhirElement("strengthLowLimit", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Ratio StrengthLowLimit + public Hl7.Fhir.Model.Ratio? StrengthLowLimit { get { return _StrengthLowLimit; } set { _StrengthLowLimit = value; OnPropertyChanged("StrengthLowLimit"); } } - private Hl7.Fhir.Model.Ratio _StrengthLowLimit; + private Hl7.Fhir.Model.Ratio? _StrengthLowLimit; /// /// For when strength is measured at a particular point or distance. /// [FhirElement("measurementPoint", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MeasurementPointElement + public Hl7.Fhir.Model.FhirString? MeasurementPointElement { get { return _MeasurementPointElement; } set { _MeasurementPointElement = value; OnPropertyChanged("MeasurementPointElement"); } } - private Hl7.Fhir.Model.FhirString _MeasurementPointElement; + private Hl7.Fhir.Model.FhirString? _MeasurementPointElement; /// /// For when strength is measured at a particular point or distance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeasurementPoint + public string? MeasurementPoint { - get { return MeasurementPointElement != null ? MeasurementPointElement.Value : null; } + get => _MeasurementPointElement?.Value; set { - if (value == null) - MeasurementPointElement = null; - else - MeasurementPointElement = new Hl7.Fhir.Model.FhirString(value); + MeasurementPointElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MeasurementPoint"); } } @@ -552,27 +541,23 @@ public string MeasurementPoint [DataMember] public List Country { - get { if(_Country==null) _Country = new List(); return _Country; } + get => _Country ?? new List(); set { _Country = value; OnPropertyChanged("Country"); } } - private List _Country; + private List? _Country; protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceStrengthComponent; - - if (dest == null) - { + if(other is not ReferenceStrengthComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.Ratio)Strength.DeepCopyInternal(); - if(StrengthLowLimit != null) dest.StrengthLowLimit = (Hl7.Fhir.Model.Ratio)StrengthLowLimit.DeepCopyInternal(); - if(MeasurementPointElement != null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)MeasurementPointElement.DeepCopyInternal(); - if(Country.Any()) dest.Country = new List(Country.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.Ratio)_Strength.DeepCopyInternal(); + if(_StrengthLowLimit is not null) dest.StrengthLowLimit = (Hl7.Fhir.Model.Ratio)_StrengthLowLimit.DeepCopyInternal(); + if(_MeasurementPointElement is not null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)_MeasurementPointElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = new List(_Country.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -584,62 +569,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceStrengthComponent; - if(otherT == null) return false; + if(other is not ReferenceStrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; - if(!comparer.Equals(StrengthLowLimit, otherT.StrengthLowLimit)) return false; - if(!comparer.Equals(MeasurementPointElement, otherT.MeasurementPointElement)) return false; - if(!comparer.ListEquals(Country, otherT.Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; + if(!comparer.Equals(_StrengthLowLimit, otherT._StrengthLowLimit)) return false; + if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; + if(!comparer.ListEquals(_Country, otherT._Country)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; case "strengthLowLimit": - value = StrengthLowLimit; - return StrengthLowLimit is not null; + value = _StrengthLowLimit; + return _StrengthLowLimit is not null; case "measurementPoint": - value = MeasurementPointElement; - return MeasurementPointElement is not null; + value = _MeasurementPointElement; + return _MeasurementPointElement is not null; case "country": - value = Country; - return Country?.Any() == true; + value = _Country; + return _Country?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.Ratio)value; + Strength = (Hl7.Fhir.Model.Ratio?)value; return this; case "strengthLowLimit": - StrengthLowLimit = (Hl7.Fhir.Model.Ratio)value; + StrengthLowLimit = (Hl7.Fhir.Model.Ratio?)value; return this; case "measurementPoint": - MeasurementPointElement = (Hl7.Fhir.Model.FhirString)value; + MeasurementPointElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - Country = (List)value; + Country = (List?)value!; return this; default: return base.SetValue(key, value); @@ -650,11 +635,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); - if (StrengthLowLimit is not null) yield return new KeyValuePair("strengthLowLimit",StrengthLowLimit); - if (MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",MeasurementPointElement); - if (Country?.Any() == true) yield return new KeyValuePair("country",Country); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); + if (_StrengthLowLimit is not null) yield return new KeyValuePair("strengthLowLimit",_StrengthLowLimit); + if (_MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",_MeasurementPointElement); + if (_Country?.Any() == true) yield return new KeyValuePair("country",_Country); } } @@ -678,13 +663,13 @@ public partial class SubstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product. @@ -694,24 +679,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Strength { - get { if(_Strength==null) _Strength = new List(); return _Strength; } + get => _Strength ?? new List(); set { _Strength = value; OnPropertyChanged("Strength"); } } - private List _Strength; + private List? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceComponent; - - if (dest == null) - { + if(other is not SubstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Strength.Any()) dest.Strength = new List(Strength.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = new List(_Strength.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -723,41 +704,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceComponent; - if(otherT == null) return false; + if(other is not SubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "strength": - value = Strength; - return Strength?.Any() == true; + value = _Strength; + return _Strength?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "strength": - Strength = (List)value; + Strength = (List?)value!; return this; default: return base.SetValue(key, value); @@ -768,8 +749,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Strength?.Any() == true) yield return new KeyValuePair("strength",Strength); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Strength?.Any() == true) yield return new KeyValuePair("strength",_Strength); } } @@ -779,13 +760,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Ingredient role e.g. Active ingredient, excipient. @@ -793,26 +774,26 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("role", InSummary=true, Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// If the ingredient is a known or suspected allergen. /// [FhirElement("allergenicIndicator", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? AllergenicIndicatorElement { get { return _AllergenicIndicatorElement; } set { _AllergenicIndicatorElement = value; OnPropertyChanged("AllergenicIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllergenicIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _AllergenicIndicatorElement; /// /// If the ingredient is a known or suspected allergen @@ -821,13 +802,10 @@ public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement [IgnoreDataMember] public bool? AllergenicIndicator { - get { return AllergenicIndicatorElement != null ? AllergenicIndicatorElement.Value : null; } + get => _AllergenicIndicatorElement?.Value; set { - if (value == null) - AllergenicIndicatorElement = null; - else - AllergenicIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllergenicIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllergenicIndicator"); } } @@ -842,11 +820,11 @@ public bool? AllergenicIndicator [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// A specified substance that comprises this ingredient. @@ -856,43 +834,39 @@ public List Manufacturer [DataMember] public List SpecifiedSubstance { - get { if(_SpecifiedSubstance==null) _SpecifiedSubstance = new List(); return _SpecifiedSubstance; } + get => _SpecifiedSubstance ?? new List(); set { _SpecifiedSubstance = value; OnPropertyChanged("SpecifiedSubstance"); } } - private List _SpecifiedSubstance; + private List? _SpecifiedSubstance; /// /// The ingredient substance. /// [FhirElement("substance", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent Substance + public Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent _Substance; + private Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent? _Substance; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductIngredient; - - if (dest == null) - { + if(other is not MedicinalProductIngredient dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(AllergenicIndicatorElement != null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)AllergenicIndicatorElement.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(SpecifiedSubstance.Any()) dest.SpecifiedSubstance = new List(SpecifiedSubstance.DeepCopyInternal()); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent)Substance.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_AllergenicIndicatorElement is not null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_AllergenicIndicatorElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_SpecifiedSubstance is not null) dest.SpecifiedSubstance = new List(_SpecifiedSubstance.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent)_Substance.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -904,69 +878,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductIngredient; - if(otherT == null) return false; + if(other is not MedicinalProductIngredient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(AllergenicIndicatorElement, otherT.AllergenicIndicatorElement)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(SpecifiedSubstance, otherT.SpecifiedSubstance)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_SpecifiedSubstance, otherT._SpecifiedSubstance)) return false; + if(!comparer.Equals(_Substance, otherT._Substance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "allergenicIndicator": - value = AllergenicIndicatorElement; - return AllergenicIndicatorElement is not null; + value = _AllergenicIndicatorElement; + return _AllergenicIndicatorElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "specifiedSubstance": - value = SpecifiedSubstance; - return SpecifiedSubstance?.Any() == true; + value = _SpecifiedSubstance; + return _SpecifiedSubstance?.Any() == true; case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allergenicIndicator": - AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "specifiedSubstance": - SpecifiedSubstance = (List)value; + SpecifiedSubstance = (List?)value!; return this; case "substance": - Substance = (Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent)value; + Substance = (Hl7.Fhir.Model.MedicinalProductIngredient.SubstanceComponent?)value; return this; default: return base.SetValue(key, value); @@ -977,12 +951,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",AllergenicIndicatorElement); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (SpecifiedSubstance?.Any() == true) yield return new KeyValuePair("specifiedSubstance",SpecifiedSubstance); - if (Substance is not null) yield return new KeyValuePair("substance",Substance); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",_AllergenicIndicatorElement); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_SpecifiedSubstance?.Any() == true) yield return new KeyValuePair("specifiedSubstance",_SpecifiedSubstance); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs index 481525d9c..c9dafaa50 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,25 +84,21 @@ public partial class InteractantComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InteractantComponent; - - if (dest == null) - { + if(other is not InteractantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -111,34 +110,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InteractantComponent; - if(otherT == null) return false; + if(other is not InteractantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -149,7 +148,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -164,39 +163,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// The interaction described. /// [FhirElement("description", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The interaction described /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -209,81 +205,77 @@ public string Description [DataMember] public List Interactant { - get { if(_Interactant==null) _Interactant = new List(); return _Interactant; } + get => _Interactant ?? new List(); set { _Interactant = value; OnPropertyChanged("Interactant"); } } - private List _Interactant; + private List? _Interactant; /// /// The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction. /// [FhirElement("type", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The effect of the interaction, for example "reduced gastric absorption of primary medication". /// [FhirElement("effect", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Effect + public Hl7.Fhir.Model.CodeableConcept? Effect { get { return _Effect; } set { _Effect = value; OnPropertyChanged("Effect"); } } - private Hl7.Fhir.Model.CodeableConcept _Effect; + private Hl7.Fhir.Model.CodeableConcept? _Effect; /// /// The incidence of the interaction, e.g. theoretical, observed. /// [FhirElement("incidence", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Incidence + public Hl7.Fhir.Model.CodeableConcept? Incidence { get { return _Incidence; } set { _Incidence = value; OnPropertyChanged("Incidence"); } } - private Hl7.Fhir.Model.CodeableConcept _Incidence; + private Hl7.Fhir.Model.CodeableConcept? _Incidence; /// /// Actions for managing the interaction. /// [FhirElement("management", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Management + public Hl7.Fhir.Model.CodeableConcept? Management { get { return _Management; } set { _Management = value; OnPropertyChanged("Management"); } } - private Hl7.Fhir.Model.CodeableConcept _Management; + private Hl7.Fhir.Model.CodeableConcept? _Management; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductInteraction; - - if (dest == null) - { + if(other is not MedicinalProductInteraction dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Interactant.Any()) dest.Interactant = new List(Interactant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Effect != null) dest.Effect = (Hl7.Fhir.Model.CodeableConcept)Effect.DeepCopyInternal(); - if(Incidence != null) dest.Incidence = (Hl7.Fhir.Model.CodeableConcept)Incidence.DeepCopyInternal(); - if(Management != null) dest.Management = (Hl7.Fhir.Model.CodeableConcept)Management.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Interactant is not null) dest.Interactant = new List(_Interactant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Effect is not null) dest.Effect = (Hl7.Fhir.Model.CodeableConcept)_Effect.DeepCopyInternal(); + if(_Incidence is not null) dest.Incidence = (Hl7.Fhir.Model.CodeableConcept)_Incidence.DeepCopyInternal(); + if(_Management is not null) dest.Management = (Hl7.Fhir.Model.CodeableConcept)_Management.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -295,76 +287,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductInteraction; - if(otherT == null) return false; + if(other is not MedicinalProductInteraction otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Interactant, otherT.Interactant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Effect, otherT.Effect)) return false; - if(!comparer.Equals(Incidence, otherT.Incidence)) return false; - if(!comparer.Equals(Management, otherT.Management)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Effect, otherT._Effect)) return false; + if(!comparer.Equals(_Incidence, otherT._Incidence)) return false; + if(!comparer.Equals(_Management, otherT._Management)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "interactant": - value = Interactant; - return Interactant?.Any() == true; + value = _Interactant; + return _Interactant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "effect": - value = Effect; - return Effect is not null; + value = _Effect; + return _Effect is not null; case "incidence": - value = Incidence; - return Incidence is not null; + value = _Incidence; + return _Incidence is not null; case "management": - value = Management; - return Management is not null; + value = _Management; + return _Management is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "interactant": - Interactant = (List)value; + Interactant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "effect": - Effect = (Hl7.Fhir.Model.CodeableConcept)value; + Effect = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "incidence": - Incidence = (Hl7.Fhir.Model.CodeableConcept)value; + Incidence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "management": - Management = (Hl7.Fhir.Model.CodeableConcept)value; + Management = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -375,13 +367,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Interactant?.Any() == true) yield return new KeyValuePair("interactant",Interactant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Effect is not null) yield return new KeyValuePair("effect",Effect); - if (Incidence is not null) yield return new KeyValuePair("incidence",Incidence); - if (Management is not null) yield return new KeyValuePair("management",Management); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Interactant?.Any() == true) yield return new KeyValuePair("interactant",_Interactant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Effect is not null) yield return new KeyValuePair("effect",_Effect); + if (_Incidence is not null) yield return new KeyValuePair("incidence",_Incidence); + if (_Management is not null) yield return new KeyValuePair("management",_Management); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs index a8e705354..8b7033f5a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,26 +65,26 @@ public partial class MedicinalProductManufactured : Hl7.Fhir.Model.DomainResourc [FhirElement("manufacturedDoseForm", InSummary=true, Order=90)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ManufacturedDoseForm + public Hl7.Fhir.Model.CodeableConcept? ManufacturedDoseForm { get { return _ManufacturedDoseForm; } set { _ManufacturedDoseForm = value; OnPropertyChanged("ManufacturedDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _ManufacturedDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _ManufacturedDoseForm; /// /// The “real world” units in which the quantity of the manufactured item is described. /// [FhirElement("unitOfPresentation", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation + public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation { get { return _UnitOfPresentation; } set { _UnitOfPresentation = value; OnPropertyChanged("UnitOfPresentation"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfPresentation; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfPresentation; /// /// The quantity or "count number" of the manufactured item. @@ -89,13 +92,13 @@ public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation [FhirElement("quantity", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Manufacturer of the item (Note that this should be named "manufacturer" but it currently causes technical issues). @@ -107,11 +110,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// Ingredient. @@ -123,24 +126,24 @@ public List Manufacturer [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Dimensions, color etc. /// [FhirElement("physicalCharacteristics", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics + public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics { get { return _PhysicalCharacteristics; } set { _PhysicalCharacteristics = value; OnPropertyChanged("PhysicalCharacteristics"); } } - private Hl7.Fhir.Model.ProdCharacteristic _PhysicalCharacteristics; + private Hl7.Fhir.Model.ProdCharacteristic? _PhysicalCharacteristics; /// /// Other codeable characteristics. @@ -150,29 +153,25 @@ public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics [DataMember] public List OtherCharacteristics { - get { if(_OtherCharacteristics==null) _OtherCharacteristics = new List(); return _OtherCharacteristics; } + get => _OtherCharacteristics ?? new List(); set { _OtherCharacteristics = value; OnPropertyChanged("OtherCharacteristics"); } } - private List _OtherCharacteristics; + private List? _OtherCharacteristics; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductManufactured; - - if (dest == null) - { + if(other is not MedicinalProductManufactured dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ManufacturedDoseForm != null) dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)ManufacturedDoseForm.DeepCopyInternal(); - if(UnitOfPresentation != null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(PhysicalCharacteristics != null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)PhysicalCharacteristics.DeepCopyInternal(); - if(OtherCharacteristics.Any()) dest.OtherCharacteristics = new List(OtherCharacteristics.DeepCopyInternal()); + if(_ManufacturedDoseForm is not null) dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)_ManufacturedDoseForm.DeepCopyInternal(); + if(_UnitOfPresentation is not null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)_UnitOfPresentation.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_PhysicalCharacteristics is not null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)_PhysicalCharacteristics.DeepCopyInternal(); + if(_OtherCharacteristics is not null) dest.OtherCharacteristics = new List(_OtherCharacteristics.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -184,76 +183,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductManufactured; - if(otherT == null) return false; + if(other is not MedicinalProductManufactured otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ManufacturedDoseForm, otherT.ManufacturedDoseForm)) return false; - if(!comparer.Equals(UnitOfPresentation, otherT.UnitOfPresentation)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(PhysicalCharacteristics, otherT.PhysicalCharacteristics)) return false; - if(!comparer.ListEquals(OtherCharacteristics, otherT.OtherCharacteristics)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ManufacturedDoseForm, otherT._ManufacturedDoseForm)) return false; + if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_PhysicalCharacteristics, otherT._PhysicalCharacteristics)) return false; + if(!comparer.ListEquals(_OtherCharacteristics, otherT._OtherCharacteristics)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "manufacturedDoseForm": - value = ManufacturedDoseForm; - return ManufacturedDoseForm is not null; + value = _ManufacturedDoseForm; + return _ManufacturedDoseForm is not null; case "unitOfPresentation": - value = UnitOfPresentation; - return UnitOfPresentation is not null; + value = _UnitOfPresentation; + return _UnitOfPresentation is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "physicalCharacteristics": - value = PhysicalCharacteristics; - return PhysicalCharacteristics is not null; + value = _PhysicalCharacteristics; + return _PhysicalCharacteristics is not null; case "otherCharacteristics": - value = OtherCharacteristics; - return OtherCharacteristics?.Any() == true; + value = _OtherCharacteristics; + return _OtherCharacteristics?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "manufacturedDoseForm": - ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unitOfPresentation": - UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "physicalCharacteristics": - PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)value; + PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic?)value; return this; case "otherCharacteristics": - OtherCharacteristics = (List)value; + OtherCharacteristics = (List?)value!; return this; default: return base.SetValue(key, value); @@ -264,13 +263,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ManufacturedDoseForm is not null) yield return new KeyValuePair("manufacturedDoseForm",ManufacturedDoseForm); - if (UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",UnitOfPresentation); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",PhysicalCharacteristics); - if (OtherCharacteristics?.Any() == true) yield return new KeyValuePair("otherCharacteristics",OtherCharacteristics); + if (_ManufacturedDoseForm is not null) yield return new KeyValuePair("manufacturedDoseForm",_ManufacturedDoseForm); + if (_UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",_UnitOfPresentation); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",_PhysicalCharacteristics); + if (_OtherCharacteristics?.Any() == true) yield return new KeyValuePair("otherCharacteristics",_OtherCharacteristics); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs index d01428acc..0f6c628d1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -75,39 +78,35 @@ public partial class BatchIdentifierComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("outerPackaging", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier OuterPackaging + public Hl7.Fhir.Model.Identifier? OuterPackaging { get { return _OuterPackaging; } set { _OuterPackaging = value; OnPropertyChanged("OuterPackaging"); } } - private Hl7.Fhir.Model.Identifier _OuterPackaging; + private Hl7.Fhir.Model.Identifier? _OuterPackaging; /// /// A number appearing on the immediate packaging (and not the outer packaging). /// [FhirElement("immediatePackaging", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier ImmediatePackaging + public Hl7.Fhir.Model.Identifier? ImmediatePackaging { get { return _ImmediatePackaging; } set { _ImmediatePackaging = value; OnPropertyChanged("ImmediatePackaging"); } } - private Hl7.Fhir.Model.Identifier _ImmediatePackaging; + private Hl7.Fhir.Model.Identifier? _ImmediatePackaging; protected internal override void CopyToInternal(Base other) { - var dest = other as BatchIdentifierComponent; - - if (dest == null) - { + if(other is not BatchIdentifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(OuterPackaging != null) dest.OuterPackaging = (Hl7.Fhir.Model.Identifier)OuterPackaging.DeepCopyInternal(); - if(ImmediatePackaging != null) dest.ImmediatePackaging = (Hl7.Fhir.Model.Identifier)ImmediatePackaging.DeepCopyInternal(); + if(_OuterPackaging is not null) dest.OuterPackaging = (Hl7.Fhir.Model.Identifier)_OuterPackaging.DeepCopyInternal(); + if(_ImmediatePackaging is not null) dest.ImmediatePackaging = (Hl7.Fhir.Model.Identifier)_ImmediatePackaging.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -119,41 +118,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BatchIdentifierComponent; - if(otherT == null) return false; + if(other is not BatchIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(OuterPackaging, otherT.OuterPackaging)) return false; - if(!comparer.Equals(ImmediatePackaging, otherT.ImmediatePackaging)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_OuterPackaging, otherT._OuterPackaging)) return false; + if(!comparer.Equals(_ImmediatePackaging, otherT._ImmediatePackaging)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outerPackaging": - value = OuterPackaging; - return OuterPackaging is not null; + value = _OuterPackaging; + return _OuterPackaging is not null; case "immediatePackaging": - value = ImmediatePackaging; - return ImmediatePackaging is not null; + value = _ImmediatePackaging; + return _ImmediatePackaging is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outerPackaging": - OuterPackaging = (Hl7.Fhir.Model.Identifier)value; + OuterPackaging = (Hl7.Fhir.Model.Identifier?)value; return this; case "immediatePackaging": - ImmediatePackaging = (Hl7.Fhir.Model.Identifier)value; + ImmediatePackaging = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -164,8 +163,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (OuterPackaging is not null) yield return new KeyValuePair("outerPackaging",OuterPackaging); - if (ImmediatePackaging is not null) yield return new KeyValuePair("immediatePackaging",ImmediatePackaging); + if (_OuterPackaging is not null) yield return new KeyValuePair("outerPackaging",_OuterPackaging); + if (_ImmediatePackaging is not null) yield return new KeyValuePair("immediatePackaging",_ImmediatePackaging); } } @@ -191,11 +190,11 @@ public partial class PackageItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The physical type of the container of the medicine. @@ -203,13 +202,13 @@ public List Identifier [FhirElement("type", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1. @@ -217,13 +216,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("quantity", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Material type of the package item. @@ -233,11 +232,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Material { - get { if(_Material==null) _Material = new List(); return _Material; } + get => _Material ?? new List(); set { _Material = value; OnPropertyChanged("Material"); } } - private List _Material; + private List? _Material; /// /// A possible alternate material for the packaging. @@ -247,11 +246,11 @@ public List Material [DataMember] public List AlternateMaterial { - get { if(_AlternateMaterial==null) _AlternateMaterial = new List(); return _AlternateMaterial; } + get => _AlternateMaterial ?? new List(); set { _AlternateMaterial = value; OnPropertyChanged("AlternateMaterial"); } } - private List _AlternateMaterial; + private List? _AlternateMaterial; /// /// A device accompanying a medicinal product. @@ -263,11 +262,11 @@ public List AlternateMaterial [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// The manufactured item as contained in the packaged medicinal product. @@ -279,11 +278,11 @@ public List Device [DataMember] public List ManufacturedItem { - get { if(_ManufacturedItem==null) _ManufacturedItem = new List(); return _ManufacturedItem; } + get => _ManufacturedItem ?? new List(); set { _ManufacturedItem = value; OnPropertyChanged("ManufacturedItem"); } } - private List _ManufacturedItem; + private List? _ManufacturedItem; /// /// Allows containers within containers. @@ -293,24 +292,24 @@ public List ManufacturedItem [DataMember] public List PackageItem { - get { if(_PackageItem==null) _PackageItem = new List(); return _PackageItem; } + get => _PackageItem ?? new List(); set { _PackageItem = value; OnPropertyChanged("PackageItem"); } } - private List _PackageItem; + private List? _PackageItem; /// /// Dimensions, color etc. /// [FhirElement("physicalCharacteristics", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics + public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics { get { return _PhysicalCharacteristics; } set { _PhysicalCharacteristics = value; OnPropertyChanged("PhysicalCharacteristics"); } } - private Hl7.Fhir.Model.ProdCharacteristic _PhysicalCharacteristics; + private Hl7.Fhir.Model.ProdCharacteristic? _PhysicalCharacteristics; /// /// Other codeable characteristics. @@ -320,11 +319,11 @@ public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics [DataMember] public List OtherCharacteristics { - get { if(_OtherCharacteristics==null) _OtherCharacteristics = new List(); return _OtherCharacteristics; } + get => _OtherCharacteristics ?? new List(); set { _OtherCharacteristics = value; OnPropertyChanged("OtherCharacteristics"); } } - private List _OtherCharacteristics; + private List? _OtherCharacteristics; /// /// Shelf Life and storage information. @@ -334,11 +333,11 @@ public List OtherCharacteristics [DataMember] public List ShelfLifeStorage { - get { if(_ShelfLifeStorage==null) _ShelfLifeStorage = new List(); return _ShelfLifeStorage; } + get => _ShelfLifeStorage ?? new List(); set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } - private List _ShelfLifeStorage; + private List? _ShelfLifeStorage; /// /// Manufacturer of this Package Item. @@ -350,34 +349,30 @@ public List ShelfLifeStorage [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; protected internal override void CopyToInternal(Base other) { - var dest = other as PackageItemComponent; - - if (dest == null) - { + if(other is not PackageItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Material.Any()) dest.Material = new List(Material.DeepCopyInternal()); - if(AlternateMaterial.Any()) dest.AlternateMaterial = new List(AlternateMaterial.DeepCopyInternal()); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(ManufacturedItem.Any()) dest.ManufacturedItem = new List(ManufacturedItem.DeepCopyInternal()); - if(PackageItem.Any()) dest.PackageItem = new List(PackageItem.DeepCopyInternal()); - if(PhysicalCharacteristics != null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)PhysicalCharacteristics.DeepCopyInternal(); - if(OtherCharacteristics.Any()) dest.OtherCharacteristics = new List(OtherCharacteristics.DeepCopyInternal()); - if(ShelfLifeStorage.Any()) dest.ShelfLifeStorage = new List(ShelfLifeStorage.DeepCopyInternal()); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Material is not null) dest.Material = new List(_Material.DeepCopyInternal()); + if(_AlternateMaterial is not null) dest.AlternateMaterial = new List(_AlternateMaterial.DeepCopyInternal()); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_ManufacturedItem is not null) dest.ManufacturedItem = new List(_ManufacturedItem.DeepCopyInternal()); + if(_PackageItem is not null) dest.PackageItem = new List(_PackageItem.DeepCopyInternal()); + if(_PhysicalCharacteristics is not null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)_PhysicalCharacteristics.DeepCopyInternal(); + if(_OtherCharacteristics is not null) dest.OtherCharacteristics = new List(_OtherCharacteristics.DeepCopyInternal()); + if(_ShelfLifeStorage is not null) dest.ShelfLifeStorage = new List(_ShelfLifeStorage.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -389,111 +384,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackageItemComponent; - if(otherT == null) return false; + if(other is not PackageItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Material, otherT.Material)) return false; - if(!comparer.ListEquals(AlternateMaterial, otherT.AlternateMaterial)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(ManufacturedItem, otherT.ManufacturedItem)) return false; - if(!comparer.ListEquals(PackageItem, otherT.PackageItem)) return false; - if(!comparer.Equals(PhysicalCharacteristics, otherT.PhysicalCharacteristics)) return false; - if(!comparer.ListEquals(OtherCharacteristics, otherT.OtherCharacteristics)) return false; - if(!comparer.ListEquals(ShelfLifeStorage, otherT.ShelfLifeStorage)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Material, otherT._Material)) return false; + if(!comparer.ListEquals(_AlternateMaterial, otherT._AlternateMaterial)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_ManufacturedItem, otherT._ManufacturedItem)) return false; + if(!comparer.ListEquals(_PackageItem, otherT._PackageItem)) return false; + if(!comparer.Equals(_PhysicalCharacteristics, otherT._PhysicalCharacteristics)) return false; + if(!comparer.ListEquals(_OtherCharacteristics, otherT._OtherCharacteristics)) return false; + if(!comparer.ListEquals(_ShelfLifeStorage, otherT._ShelfLifeStorage)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "material": - value = Material; - return Material?.Any() == true; + value = _Material; + return _Material?.Any() == true; case "alternateMaterial": - value = AlternateMaterial; - return AlternateMaterial?.Any() == true; + value = _AlternateMaterial; + return _AlternateMaterial?.Any() == true; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "manufacturedItem": - value = ManufacturedItem; - return ManufacturedItem?.Any() == true; + value = _ManufacturedItem; + return _ManufacturedItem?.Any() == true; case "packageItem": - value = PackageItem; - return PackageItem?.Any() == true; + value = _PackageItem; + return _PackageItem?.Any() == true; case "physicalCharacteristics": - value = PhysicalCharacteristics; - return PhysicalCharacteristics is not null; + value = _PhysicalCharacteristics; + return _PhysicalCharacteristics is not null; case "otherCharacteristics": - value = OtherCharacteristics; - return OtherCharacteristics?.Any() == true; + value = _OtherCharacteristics; + return _OtherCharacteristics?.Any() == true; case "shelfLifeStorage": - value = ShelfLifeStorage; - return ShelfLifeStorage?.Any() == true; + value = _ShelfLifeStorage; + return _ShelfLifeStorage?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "material": - Material = (List)value; + Material = (List?)value!; return this; case "alternateMaterial": - AlternateMaterial = (List)value; + AlternateMaterial = (List?)value!; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "manufacturedItem": - ManufacturedItem = (List)value; + ManufacturedItem = (List?)value!; return this; case "packageItem": - PackageItem = (List)value; + PackageItem = (List?)value!; return this; case "physicalCharacteristics": - PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)value; + PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic?)value; return this; case "otherCharacteristics": - OtherCharacteristics = (List)value; + OtherCharacteristics = (List?)value!; return this; case "shelfLifeStorage": - ShelfLifeStorage = (List)value; + ShelfLifeStorage = (List?)value!; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; default: return base.SetValue(key, value); @@ -504,18 +499,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Material?.Any() == true) yield return new KeyValuePair("material",Material); - if (AlternateMaterial?.Any() == true) yield return new KeyValuePair("alternateMaterial",AlternateMaterial); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (ManufacturedItem?.Any() == true) yield return new KeyValuePair("manufacturedItem",ManufacturedItem); - if (PackageItem?.Any() == true) yield return new KeyValuePair("packageItem",PackageItem); - if (PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",PhysicalCharacteristics); - if (OtherCharacteristics?.Any() == true) yield return new KeyValuePair("otherCharacteristics",OtherCharacteristics); - if (ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",ShelfLifeStorage); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Material?.Any() == true) yield return new KeyValuePair("material",_Material); + if (_AlternateMaterial?.Any() == true) yield return new KeyValuePair("alternateMaterial",_AlternateMaterial); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_ManufacturedItem?.Any() == true) yield return new KeyValuePair("manufacturedItem",_ManufacturedItem); + if (_PackageItem?.Any() == true) yield return new KeyValuePair("packageItem",_PackageItem); + if (_PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",_PhysicalCharacteristics); + if (_OtherCharacteristics?.Any() == true) yield return new KeyValuePair("otherCharacteristics",_OtherCharacteristics); + if (_ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",_ShelfLifeStorage); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); } } @@ -528,11 +523,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The product with this is a pack for. @@ -544,39 +539,36 @@ public List Identifier [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Textual description. /// [FhirElement("description", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -586,13 +578,13 @@ public string Description /// [FhirElement("legalStatusOfSupply", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply + public Hl7.Fhir.Model.CodeableConcept? LegalStatusOfSupply { get { return _LegalStatusOfSupply; } set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalStatusOfSupply; + private Hl7.Fhir.Model.CodeableConcept? _LegalStatusOfSupply; /// /// Marketing information. @@ -602,11 +594,11 @@ public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply [DataMember] public List MarketingStatus { - get { if(_MarketingStatus==null) _MarketingStatus = new List(); return _MarketingStatus; } + get => _MarketingStatus ?? new List(); set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } - private List _MarketingStatus; + private List? _MarketingStatus; /// /// Manufacturer of this Package Item. @@ -615,13 +607,13 @@ public List MarketingStatus [CLSCompliant(false)] [References("MedicinalProductAuthorization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference MarketingAuthorization + public Hl7.Fhir.Model.ResourceReference? MarketingAuthorization { get { return _MarketingAuthorization; } set { _MarketingAuthorization = value; OnPropertyChanged("MarketingAuthorization"); } } - private Hl7.Fhir.Model.ResourceReference _MarketingAuthorization; + private Hl7.Fhir.Model.ResourceReference? _MarketingAuthorization; /// /// Manufacturer of this Package Item. @@ -633,11 +625,11 @@ public Hl7.Fhir.Model.ResourceReference MarketingAuthorization [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// Batch numbering. @@ -647,11 +639,11 @@ public List Manufacturer [DataMember] public List BatchIdentifier { - get { if(_BatchIdentifier==null) _BatchIdentifier = new List(); return _BatchIdentifier; } + get => _BatchIdentifier ?? new List(); set { _BatchIdentifier = value; OnPropertyChanged("BatchIdentifier"); } } - private List _BatchIdentifier; + private List? _BatchIdentifier; /// /// A packaging item, as a contained for medicine, possibly with other packaging items within. @@ -661,33 +653,29 @@ public List Ba [DataMember] public List PackageItem { - get { if(_PackageItem==null) _PackageItem = new List(); return _PackageItem; } + get => _PackageItem ?? new List(); set { _PackageItem = value; OnPropertyChanged("PackageItem"); } } - private List _PackageItem; + private List? _PackageItem; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductPackaged; - - if (dest == null) - { + if(other is not MedicinalProductPackaged dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(LegalStatusOfSupply != null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)LegalStatusOfSupply.DeepCopyInternal(); - if(MarketingStatus.Any()) dest.MarketingStatus = new List(MarketingStatus.DeepCopyInternal()); - if(MarketingAuthorization != null) dest.MarketingAuthorization = (Hl7.Fhir.Model.ResourceReference)MarketingAuthorization.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(BatchIdentifier.Any()) dest.BatchIdentifier = new List(BatchIdentifier.DeepCopyInternal()); - if(PackageItem.Any()) dest.PackageItem = new List(PackageItem.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_LegalStatusOfSupply is not null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)_LegalStatusOfSupply.DeepCopyInternal(); + if(_MarketingStatus is not null) dest.MarketingStatus = new List(_MarketingStatus.DeepCopyInternal()); + if(_MarketingAuthorization is not null) dest.MarketingAuthorization = (Hl7.Fhir.Model.ResourceReference)_MarketingAuthorization.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_BatchIdentifier is not null) dest.BatchIdentifier = new List(_BatchIdentifier.DeepCopyInternal()); + if(_PackageItem is not null) dest.PackageItem = new List(_PackageItem.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -699,90 +687,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductPackaged; - if(otherT == null) return false; + if(other is not MedicinalProductPackaged otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(LegalStatusOfSupply, otherT.LegalStatusOfSupply)) return false; - if(!comparer.ListEquals(MarketingStatus, otherT.MarketingStatus)) return false; - if(!comparer.Equals(MarketingAuthorization, otherT.MarketingAuthorization)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(BatchIdentifier, otherT.BatchIdentifier)) return false; - if(!comparer.ListEquals(PackageItem, otherT.PackageItem)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; + if(!comparer.ListEquals(_MarketingStatus, otherT._MarketingStatus)) return false; + if(!comparer.Equals(_MarketingAuthorization, otherT._MarketingAuthorization)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_BatchIdentifier, otherT._BatchIdentifier)) return false; + if(!comparer.ListEquals(_PackageItem, otherT._PackageItem)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "legalStatusOfSupply": - value = LegalStatusOfSupply; - return LegalStatusOfSupply is not null; + value = _LegalStatusOfSupply; + return _LegalStatusOfSupply is not null; case "marketingStatus": - value = MarketingStatus; - return MarketingStatus?.Any() == true; + value = _MarketingStatus; + return _MarketingStatus?.Any() == true; case "marketingAuthorization": - value = MarketingAuthorization; - return MarketingAuthorization is not null; + value = _MarketingAuthorization; + return _MarketingAuthorization is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "batchIdentifier": - value = BatchIdentifier; - return BatchIdentifier?.Any() == true; + value = _BatchIdentifier; + return _BatchIdentifier?.Any() == true; case "packageItem": - value = PackageItem; - return PackageItem?.Any() == true; + value = _PackageItem; + return _PackageItem?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "legalStatusOfSupply": - LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)value; + LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "marketingStatus": - MarketingStatus = (List)value; + MarketingStatus = (List?)value!; return this; case "marketingAuthorization": - MarketingAuthorization = (Hl7.Fhir.Model.ResourceReference)value; + MarketingAuthorization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "batchIdentifier": - BatchIdentifier = (List)value; + BatchIdentifier = (List?)value!; return this; case "packageItem": - PackageItem = (List)value; + PackageItem = (List?)value!; return this; default: return base.SetValue(key, value); @@ -793,15 +781,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",LegalStatusOfSupply); - if (MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",MarketingStatus); - if (MarketingAuthorization is not null) yield return new KeyValuePair("marketingAuthorization",MarketingAuthorization); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (BatchIdentifier?.Any() == true) yield return new KeyValuePair("batchIdentifier",BatchIdentifier); - if (PackageItem?.Any() == true) yield return new KeyValuePair("packageItem",PackageItem); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",_LegalStatusOfSupply); + if (_MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",_MarketingStatus); + if (_MarketingAuthorization is not null) yield return new KeyValuePair("marketingAuthorization",_MarketingAuthorization); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_BatchIdentifier?.Any() == true) yield return new KeyValuePair("batchIdentifier",_BatchIdentifier); + if (_PackageItem?.Any() == true) yield return new KeyValuePair("packageItem",_PackageItem); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs index 1726888e7..c6c318086 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -75,39 +78,35 @@ public partial class CharacteristicsComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The status of characteristic e.g. assigned or pending. /// [FhirElement("status", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicsComponent; - - if (dest == null) - { + if(other is not CharacteristicsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -119,41 +118,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicsComponent; - if(otherT == null) return false; + if(other is not CharacteristicsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -164,8 +163,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Status is not null) yield return new KeyValuePair("status",Status); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Status is not null) yield return new KeyValuePair("status",_Status); } } @@ -189,78 +188,78 @@ public partial class RouteOfAdministrationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement. /// [FhirElement("firstDose", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity FirstDose + public Hl7.Fhir.Model.Quantity? FirstDose { get { return _FirstDose; } set { _FirstDose = value; OnPropertyChanged("FirstDose"); } } - private Hl7.Fhir.Model.Quantity _FirstDose; + private Hl7.Fhir.Model.Quantity? _FirstDose; /// /// The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement. /// [FhirElement("maxSingleDose", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxSingleDose + public Hl7.Fhir.Model.Quantity? MaxSingleDose { get { return _MaxSingleDose; } set { _MaxSingleDose = value; OnPropertyChanged("MaxSingleDose"); } } - private Hl7.Fhir.Model.Quantity _MaxSingleDose; + private Hl7.Fhir.Model.Quantity? _MaxSingleDose; /// /// The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation. /// [FhirElement("maxDosePerDay", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerDay + public Hl7.Fhir.Model.Quantity? MaxDosePerDay { get { return _MaxDosePerDay; } set { _MaxDosePerDay = value; OnPropertyChanged("MaxDosePerDay"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerDay; + private Hl7.Fhir.Model.Quantity? _MaxDosePerDay; /// /// The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation. /// [FhirElement("maxDosePerTreatmentPeriod", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Ratio MaxDosePerTreatmentPeriod + public Hl7.Fhir.Model.Ratio? MaxDosePerTreatmentPeriod { get { return _MaxDosePerTreatmentPeriod; } set { _MaxDosePerTreatmentPeriod = value; OnPropertyChanged("MaxDosePerTreatmentPeriod"); } } - private Hl7.Fhir.Model.Ratio _MaxDosePerTreatmentPeriod; + private Hl7.Fhir.Model.Ratio? _MaxDosePerTreatmentPeriod; /// /// The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation. /// [FhirElement("maxTreatmentPeriod", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration MaxTreatmentPeriod + public Hl7.Fhir.Model.Duration? MaxTreatmentPeriod { get { return _MaxTreatmentPeriod; } set { _MaxTreatmentPeriod = value; OnPropertyChanged("MaxTreatmentPeriod"); } } - private Hl7.Fhir.Model.Duration _MaxTreatmentPeriod; + private Hl7.Fhir.Model.Duration? _MaxTreatmentPeriod; /// /// A species for which this route applies. @@ -270,29 +269,25 @@ public Hl7.Fhir.Model.Duration MaxTreatmentPeriod [DataMember] public List TargetSpecies { - get { if(_TargetSpecies==null) _TargetSpecies = new List(); return _TargetSpecies; } + get => _TargetSpecies ?? new List(); set { _TargetSpecies = value; OnPropertyChanged("TargetSpecies"); } } - private List _TargetSpecies; + private List? _TargetSpecies; protected internal override void CopyToInternal(Base other) { - var dest = other as RouteOfAdministrationComponent; - - if (dest == null) - { + if(other is not RouteOfAdministrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FirstDose != null) dest.FirstDose = (Hl7.Fhir.Model.Quantity)FirstDose.DeepCopyInternal(); - if(MaxSingleDose != null) dest.MaxSingleDose = (Hl7.Fhir.Model.Quantity)MaxSingleDose.DeepCopyInternal(); - if(MaxDosePerDay != null) dest.MaxDosePerDay = (Hl7.Fhir.Model.Quantity)MaxDosePerDay.DeepCopyInternal(); - if(MaxDosePerTreatmentPeriod != null) dest.MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)MaxDosePerTreatmentPeriod.DeepCopyInternal(); - if(MaxTreatmentPeriod != null) dest.MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)MaxTreatmentPeriod.DeepCopyInternal(); - if(TargetSpecies.Any()) dest.TargetSpecies = new List(TargetSpecies.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FirstDose is not null) dest.FirstDose = (Hl7.Fhir.Model.Quantity)_FirstDose.DeepCopyInternal(); + if(_MaxSingleDose is not null) dest.MaxSingleDose = (Hl7.Fhir.Model.Quantity)_MaxSingleDose.DeepCopyInternal(); + if(_MaxDosePerDay is not null) dest.MaxDosePerDay = (Hl7.Fhir.Model.Quantity)_MaxDosePerDay.DeepCopyInternal(); + if(_MaxDosePerTreatmentPeriod is not null) dest.MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)_MaxDosePerTreatmentPeriod.DeepCopyInternal(); + if(_MaxTreatmentPeriod is not null) dest.MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)_MaxTreatmentPeriod.DeepCopyInternal(); + if(_TargetSpecies is not null) dest.TargetSpecies = new List(_TargetSpecies.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -304,76 +299,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RouteOfAdministrationComponent; - if(otherT == null) return false; + if(other is not RouteOfAdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FirstDose, otherT.FirstDose)) return false; - if(!comparer.Equals(MaxSingleDose, otherT.MaxSingleDose)) return false; - if(!comparer.Equals(MaxDosePerDay, otherT.MaxDosePerDay)) return false; - if(!comparer.Equals(MaxDosePerTreatmentPeriod, otherT.MaxDosePerTreatmentPeriod)) return false; - if(!comparer.Equals(MaxTreatmentPeriod, otherT.MaxTreatmentPeriod)) return false; - if(!comparer.ListEquals(TargetSpecies, otherT.TargetSpecies)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FirstDose, otherT._FirstDose)) return false; + if(!comparer.Equals(_MaxSingleDose, otherT._MaxSingleDose)) return false; + if(!comparer.Equals(_MaxDosePerDay, otherT._MaxDosePerDay)) return false; + if(!comparer.Equals(_MaxDosePerTreatmentPeriod, otherT._MaxDosePerTreatmentPeriod)) return false; + if(!comparer.Equals(_MaxTreatmentPeriod, otherT._MaxTreatmentPeriod)) return false; + if(!comparer.ListEquals(_TargetSpecies, otherT._TargetSpecies)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "firstDose": - value = FirstDose; - return FirstDose is not null; + value = _FirstDose; + return _FirstDose is not null; case "maxSingleDose": - value = MaxSingleDose; - return MaxSingleDose is not null; + value = _MaxSingleDose; + return _MaxSingleDose is not null; case "maxDosePerDay": - value = MaxDosePerDay; - return MaxDosePerDay is not null; + value = _MaxDosePerDay; + return _MaxDosePerDay is not null; case "maxDosePerTreatmentPeriod": - value = MaxDosePerTreatmentPeriod; - return MaxDosePerTreatmentPeriod is not null; + value = _MaxDosePerTreatmentPeriod; + return _MaxDosePerTreatmentPeriod is not null; case "maxTreatmentPeriod": - value = MaxTreatmentPeriod; - return MaxTreatmentPeriod is not null; + value = _MaxTreatmentPeriod; + return _MaxTreatmentPeriod is not null; case "targetSpecies": - value = TargetSpecies; - return TargetSpecies?.Any() == true; + value = _TargetSpecies; + return _TargetSpecies?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "firstDose": - FirstDose = (Hl7.Fhir.Model.Quantity)value; + FirstDose = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxSingleDose": - MaxSingleDose = (Hl7.Fhir.Model.Quantity)value; + MaxSingleDose = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerDay": - MaxDosePerDay = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerDay = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerTreatmentPeriod": - MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)value; + MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio?)value; return this; case "maxTreatmentPeriod": - MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)value; + MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration?)value; return this; case "targetSpecies": - TargetSpecies = (List)value; + TargetSpecies = (List?)value!; return this; default: return base.SetValue(key, value); @@ -384,13 +379,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FirstDose is not null) yield return new KeyValuePair("firstDose",FirstDose); - if (MaxSingleDose is not null) yield return new KeyValuePair("maxSingleDose",MaxSingleDose); - if (MaxDosePerDay is not null) yield return new KeyValuePair("maxDosePerDay",MaxDosePerDay); - if (MaxDosePerTreatmentPeriod is not null) yield return new KeyValuePair("maxDosePerTreatmentPeriod",MaxDosePerTreatmentPeriod); - if (MaxTreatmentPeriod is not null) yield return new KeyValuePair("maxTreatmentPeriod",MaxTreatmentPeriod); - if (TargetSpecies?.Any() == true) yield return new KeyValuePair("targetSpecies",TargetSpecies); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FirstDose is not null) yield return new KeyValuePair("firstDose",_FirstDose); + if (_MaxSingleDose is not null) yield return new KeyValuePair("maxSingleDose",_MaxSingleDose); + if (_MaxDosePerDay is not null) yield return new KeyValuePair("maxDosePerDay",_MaxDosePerDay); + if (_MaxDosePerTreatmentPeriod is not null) yield return new KeyValuePair("maxDosePerTreatmentPeriod",_MaxDosePerTreatmentPeriod); + if (_MaxTreatmentPeriod is not null) yield return new KeyValuePair("maxTreatmentPeriod",_MaxTreatmentPeriod); + if (_TargetSpecies?.Any() == true) yield return new KeyValuePair("targetSpecies",_TargetSpecies); } } @@ -414,13 +409,13 @@ public partial class TargetSpeciesComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// A species specific time during which consumption of animal product is not appropriate. @@ -430,24 +425,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List WithdrawalPeriod { - get { if(_WithdrawalPeriod==null) _WithdrawalPeriod = new List(); return _WithdrawalPeriod; } + get => _WithdrawalPeriod ?? new List(); set { _WithdrawalPeriod = value; OnPropertyChanged("WithdrawalPeriod"); } } - private List _WithdrawalPeriod; + private List? _WithdrawalPeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetSpeciesComponent; - - if (dest == null) - { + if(other is not TargetSpeciesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(WithdrawalPeriod.Any()) dest.WithdrawalPeriod = new List(WithdrawalPeriod.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_WithdrawalPeriod is not null) dest.WithdrawalPeriod = new List(_WithdrawalPeriod.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -459,41 +450,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetSpeciesComponent; - if(otherT == null) return false; + if(other is not TargetSpeciesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(WithdrawalPeriod, otherT.WithdrawalPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_WithdrawalPeriod, otherT._WithdrawalPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "withdrawalPeriod": - value = WithdrawalPeriod; - return WithdrawalPeriod?.Any() == true; + value = _WithdrawalPeriod; + return _WithdrawalPeriod?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "withdrawalPeriod": - WithdrawalPeriod = (List)value; + WithdrawalPeriod = (List?)value!; return this; default: return base.SetValue(key, value); @@ -504,8 +495,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (WithdrawalPeriod?.Any() == true) yield return new KeyValuePair("withdrawalPeriod",WithdrawalPeriod); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_WithdrawalPeriod?.Any() == true) yield return new KeyValuePair("withdrawalPeriod",_WithdrawalPeriod); } } @@ -529,13 +520,13 @@ public partial class WithdrawalPeriodComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("tissue", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Tissue + public Hl7.Fhir.Model.CodeableConcept? Tissue { get { return _Tissue; } set { _Tissue = value; OnPropertyChanged("Tissue"); } } - private Hl7.Fhir.Model.CodeableConcept _Tissue; + private Hl7.Fhir.Model.CodeableConcept? _Tissue; /// /// A value for the time. @@ -543,58 +534,51 @@ public Hl7.Fhir.Model.CodeableConcept Tissue [FhirElement("value", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// Extra information about the withdrawal period. /// [FhirElement("supportingInformation", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString SupportingInformationElement + public Hl7.Fhir.Model.FhirString? SupportingInformationElement { get { return _SupportingInformationElement; } set { _SupportingInformationElement = value; OnPropertyChanged("SupportingInformationElement"); } } - private Hl7.Fhir.Model.FhirString _SupportingInformationElement; + private Hl7.Fhir.Model.FhirString? _SupportingInformationElement; /// /// Extra information about the withdrawal period /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SupportingInformation + public string? SupportingInformation { - get { return SupportingInformationElement != null ? SupportingInformationElement.Value : null; } + get => _SupportingInformationElement?.Value; set { - if (value == null) - SupportingInformationElement = null; - else - SupportingInformationElement = new Hl7.Fhir.Model.FhirString(value); + SupportingInformationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SupportingInformation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as WithdrawalPeriodComponent; - - if (dest == null) - { + if(other is not WithdrawalPeriodComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Tissue != null) dest.Tissue = (Hl7.Fhir.Model.CodeableConcept)Tissue.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(SupportingInformationElement != null) dest.SupportingInformationElement = (Hl7.Fhir.Model.FhirString)SupportingInformationElement.DeepCopyInternal(); + if(_Tissue is not null) dest.Tissue = (Hl7.Fhir.Model.CodeableConcept)_Tissue.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_SupportingInformationElement is not null) dest.SupportingInformationElement = (Hl7.Fhir.Model.FhirString)_SupportingInformationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -606,48 +590,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as WithdrawalPeriodComponent; - if(otherT == null) return false; + if(other is not WithdrawalPeriodComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Tissue, otherT.Tissue)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(SupportingInformationElement, otherT.SupportingInformationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_SupportingInformationElement, otherT._SupportingInformationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "tissue": - value = Tissue; - return Tissue is not null; + value = _Tissue; + return _Tissue is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "supportingInformation": - value = SupportingInformationElement; - return SupportingInformationElement is not null; + value = _SupportingInformationElement; + return _SupportingInformationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "tissue": - Tissue = (Hl7.Fhir.Model.CodeableConcept)value; + Tissue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "supportingInformation": - SupportingInformationElement = (Hl7.Fhir.Model.FhirString)value; + SupportingInformationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -658,9 +642,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Tissue is not null) yield return new KeyValuePair("tissue",Tissue); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (SupportingInformationElement is not null) yield return new KeyValuePair("supportingInformation",SupportingInformationElement); + if (_Tissue is not null) yield return new KeyValuePair("tissue",_Tissue); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_SupportingInformationElement is not null) yield return new KeyValuePair("supportingInformation",_SupportingInformationElement); } } @@ -673,11 +657,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The administrable dose form, after necessary reconstitution. @@ -685,26 +669,26 @@ public List Identifier [FhirElement("administrableDoseForm", InSummary=true, Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdministrableDoseForm + public Hl7.Fhir.Model.CodeableConcept? AdministrableDoseForm { get { return _AdministrableDoseForm; } set { _AdministrableDoseForm = value; OnPropertyChanged("AdministrableDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _AdministrableDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _AdministrableDoseForm; /// /// Todo. /// [FhirElement("unitOfPresentation", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation + public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation { get { return _UnitOfPresentation; } set { _UnitOfPresentation = value; OnPropertyChanged("UnitOfPresentation"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfPresentation; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfPresentation; /// /// Ingredient. @@ -716,11 +700,11 @@ public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Accompanying device. @@ -732,11 +716,11 @@ public List Ingredient [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// Characteristics e.g. a products onset of action. @@ -746,11 +730,11 @@ public List Device [DataMember] public List Characteristics { - get { if(_Characteristics==null) _Characteristics = new List(); return _Characteristics; } + get => _Characteristics ?? new List(); set { _Characteristics = value; OnPropertyChanged("Characteristics"); } } - private List _Characteristics; + private List? _Characteristics; /// /// The path by which the pharmaceutical product is taken into or makes contact with the body. @@ -760,31 +744,27 @@ public List RouteOfAdministration { - get { if(_RouteOfAdministration==null) _RouteOfAdministration = new List(); return _RouteOfAdministration; } + get => _RouteOfAdministration ?? new List(); set { _RouteOfAdministration = value; OnPropertyChanged("RouteOfAdministration"); } } - private List _RouteOfAdministration; + private List? _RouteOfAdministration; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductPharmaceutical; - - if (dest == null) - { + if(other is not MedicinalProductPharmaceutical dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(AdministrableDoseForm != null) dest.AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)AdministrableDoseForm.DeepCopyInternal(); - if(UnitOfPresentation != null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopyInternal(); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(Characteristics.Any()) dest.Characteristics = new List(Characteristics.DeepCopyInternal()); - if(RouteOfAdministration.Any()) dest.RouteOfAdministration = new List(RouteOfAdministration.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_AdministrableDoseForm is not null) dest.AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)_AdministrableDoseForm.DeepCopyInternal(); + if(_UnitOfPresentation is not null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)_UnitOfPresentation.DeepCopyInternal(); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_Characteristics is not null) dest.Characteristics = new List(_Characteristics.DeepCopyInternal()); + if(_RouteOfAdministration is not null) dest.RouteOfAdministration = new List(_RouteOfAdministration.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -796,76 +776,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductPharmaceutical; - if(otherT == null) return false; + if(other is not MedicinalProductPharmaceutical otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(AdministrableDoseForm, otherT.AdministrableDoseForm)) return false; - if(!comparer.Equals(UnitOfPresentation, otherT.UnitOfPresentation)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Characteristics, otherT.Characteristics)) return false; - if(!comparer.ListEquals(RouteOfAdministration, otherT.RouteOfAdministration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_AdministrableDoseForm, otherT._AdministrableDoseForm)) return false; + if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Characteristics, otherT._Characteristics)) return false; + if(!comparer.ListEquals(_RouteOfAdministration, otherT._RouteOfAdministration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "administrableDoseForm": - value = AdministrableDoseForm; - return AdministrableDoseForm is not null; + value = _AdministrableDoseForm; + return _AdministrableDoseForm is not null; case "unitOfPresentation": - value = UnitOfPresentation; - return UnitOfPresentation is not null; + value = _UnitOfPresentation; + return _UnitOfPresentation is not null; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "characteristics": - value = Characteristics; - return Characteristics?.Any() == true; + value = _Characteristics; + return _Characteristics?.Any() == true; case "routeOfAdministration": - value = RouteOfAdministration; - return RouteOfAdministration?.Any() == true; + value = _RouteOfAdministration; + return _RouteOfAdministration?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "administrableDoseForm": - AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unitOfPresentation": - UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "characteristics": - Characteristics = (List)value; + Characteristics = (List?)value!; return this; case "routeOfAdministration": - RouteOfAdministration = (List)value; + RouteOfAdministration = (List?)value!; return this; default: return base.SetValue(key, value); @@ -876,13 +856,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (AdministrableDoseForm is not null) yield return new KeyValuePair("administrableDoseForm",AdministrableDoseForm); - if (UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",UnitOfPresentation); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (Characteristics?.Any() == true) yield return new KeyValuePair("characteristics",Characteristics); - if (RouteOfAdministration?.Any() == true) yield return new KeyValuePair("routeOfAdministration",RouteOfAdministration); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_AdministrableDoseForm is not null) yield return new KeyValuePair("administrableDoseForm",_AdministrableDoseForm); + if (_UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",_UnitOfPresentation); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_Characteristics?.Any() == true) yield return new KeyValuePair("characteristics",_Characteristics); + if (_RouteOfAdministration?.Any() == true) yield return new KeyValuePair("routeOfAdministration",_RouteOfAdministration); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs index 393ef963a..1c59c4f1b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -69,50 +72,50 @@ public partial class MedicinalProductUndesirableEffect : Hl7.Fhir.Model.DomainRe [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// The symptom, condition or undesirable effect. /// [FhirElement("symptomConditionEffect", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SymptomConditionEffect + public Hl7.Fhir.Model.CodeableConcept? SymptomConditionEffect { get { return _SymptomConditionEffect; } set { _SymptomConditionEffect = value; OnPropertyChanged("SymptomConditionEffect"); } } - private Hl7.Fhir.Model.CodeableConcept _SymptomConditionEffect; + private Hl7.Fhir.Model.CodeableConcept? _SymptomConditionEffect; /// /// Classification of the effect. /// [FhirElement("classification", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Classification + public Hl7.Fhir.Model.CodeableConcept? Classification { get { return _Classification; } set { _Classification = value; OnPropertyChanged("Classification"); } } - private Hl7.Fhir.Model.CodeableConcept _Classification; + private Hl7.Fhir.Model.CodeableConcept? _Classification; /// /// The frequency of occurrence of the effect. /// [FhirElement("frequencyOfOccurrence", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FrequencyOfOccurrence + public Hl7.Fhir.Model.CodeableConcept? FrequencyOfOccurrence { get { return _FrequencyOfOccurrence; } set { _FrequencyOfOccurrence = value; OnPropertyChanged("FrequencyOfOccurrence"); } } - private Hl7.Fhir.Model.CodeableConcept _FrequencyOfOccurrence; + private Hl7.Fhir.Model.CodeableConcept? _FrequencyOfOccurrence; /// /// The population group to which this applies. @@ -122,27 +125,23 @@ public Hl7.Fhir.Model.CodeableConcept FrequencyOfOccurrence [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductUndesirableEffect; - - if (dest == null) - { + if(other is not MedicinalProductUndesirableEffect dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(SymptomConditionEffect != null) dest.SymptomConditionEffect = (Hl7.Fhir.Model.CodeableConcept)SymptomConditionEffect.DeepCopyInternal(); - if(Classification != null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)Classification.DeepCopyInternal(); - if(FrequencyOfOccurrence != null) dest.FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)FrequencyOfOccurrence.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_SymptomConditionEffect is not null) dest.SymptomConditionEffect = (Hl7.Fhir.Model.CodeableConcept)_SymptomConditionEffect.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)_Classification.DeepCopyInternal(); + if(_FrequencyOfOccurrence is not null) dest.FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)_FrequencyOfOccurrence.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -154,62 +153,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductUndesirableEffect; - if(otherT == null) return false; + if(other is not MedicinalProductUndesirableEffect otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(SymptomConditionEffect, otherT.SymptomConditionEffect)) return false; - if(!comparer.Equals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(FrequencyOfOccurrence, otherT.FrequencyOfOccurrence)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; + if(!comparer.Equals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_FrequencyOfOccurrence, otherT._FrequencyOfOccurrence)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "symptomConditionEffect": - value = SymptomConditionEffect; - return SymptomConditionEffect is not null; + value = _SymptomConditionEffect; + return _SymptomConditionEffect is not null; case "classification": - value = Classification; - return Classification is not null; + value = _Classification; + return _Classification is not null; case "frequencyOfOccurrence": - value = FrequencyOfOccurrence; - return FrequencyOfOccurrence is not null; + value = _FrequencyOfOccurrence; + return _FrequencyOfOccurrence is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "symptomConditionEffect": - SymptomConditionEffect = (Hl7.Fhir.Model.CodeableConcept)value; + SymptomConditionEffect = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (Hl7.Fhir.Model.CodeableConcept)value; + Classification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "frequencyOfOccurrence": - FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)value; + FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; default: return base.SetValue(key, value); @@ -220,11 +219,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (SymptomConditionEffect is not null) yield return new KeyValuePair("symptomConditionEffect",SymptomConditionEffect); - if (Classification is not null) yield return new KeyValuePair("classification",Classification); - if (FrequencyOfOccurrence is not null) yield return new KeyValuePair("frequencyOfOccurrence",FrequencyOfOccurrence); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_SymptomConditionEffect is not null) yield return new KeyValuePair("symptomConditionEffect",_SymptomConditionEffect); + if (_Classification is not null) yield return new KeyValuePair("classification",_Classification); + if (_FrequencyOfOccurrence is not null) yield return new KeyValuePair("frequencyOfOccurrence",_FrequencyOfOccurrence); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs index 52ce27ab6..416520972 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MessageDefinition","http://hl7.org/fhir/StructureDefinition/MessageDefinition")] - public partial class MessageDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class MessageDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -112,13 +115,13 @@ public partial class FocusComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Type of resource @@ -127,13 +130,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -143,28 +143,25 @@ public Hl7.Fhir.Model.ResourceType? Code /// [FhirElement("profile", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile that must be adhered to by focus /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -175,13 +172,13 @@ public string Profile [FhirElement("min", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Minimum number of focuses of this type @@ -190,13 +187,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -206,46 +200,39 @@ public int? Min /// [FhirElement("max", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum number of focuses of this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FocusComponent; - - if (dest == null) - { + if(other is not FocusComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -257,55 +244,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocusComponent; - if(otherT == null) return false; + if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -316,10 +303,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); } } @@ -347,28 +334,25 @@ public partial class AllowedResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("message", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical MessageElement + public Hl7.Fhir.Model.Canonical? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Canonical _MessageElement; + private Hl7.Fhir.Model.Canonical? _MessageElement; /// /// Reference to allowed message definition response /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Canonical(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Message"); } } @@ -378,44 +362,37 @@ public string Message /// [FhirElement("situation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown SituationElement + public Hl7.Fhir.Model.Markdown? SituationElement { get { return _SituationElement; } set { _SituationElement = value; OnPropertyChanged("SituationElement"); } } - private Hl7.Fhir.Model.Markdown _SituationElement; + private Hl7.Fhir.Model.Markdown? _SituationElement; /// /// When should this response be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Situation + public string? Situation { - get { return SituationElement != null ? SituationElement.Value : null; } + get => _SituationElement?.Value; set { - if (value == null) - SituationElement = null; - else - SituationElement = new Hl7.Fhir.Model.Markdown(value); + SituationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Situation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AllowedResponseComponent; - - if (dest == null) - { + if(other is not AllowedResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Canonical)MessageElement.DeepCopyInternal(); - if(SituationElement != null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)SituationElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Canonical)_MessageElement.DeepCopyInternal(); + if(_SituationElement is not null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)_SituationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -427,41 +404,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllowedResponseComponent; - if(otherT == null) return false; + if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(SituationElement, otherT.SituationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "situation": - value = SituationElement; - return SituationElement is not null; + value = _SituationElement; + return _SituationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "message": - MessageElement = (Hl7.Fhir.Model.Canonical)value; + MessageElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "situation": - SituationElement = (Hl7.Fhir.Model.Markdown)value; + SituationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -472,8 +449,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (SituationElement is not null) yield return new KeyValuePair("situation",SituationElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_SituationElement is not null) yield return new KeyValuePair("situation",_SituationElement); } } @@ -483,28 +460,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Business Identifier for a given MessageDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -517,39 +491,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the message definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -559,28 +530,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this message definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -590,28 +558,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this message definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -624,24 +589,24 @@ public string Title [DataMember] public List ReplacesElement { - get { if(_ReplacesElement==null) _ReplacesElement = new List(); return _ReplacesElement; } + get => _ReplacesElement ?? new List(); set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } - private List _ReplacesElement; + private List? _ReplacesElement; /// /// Takes the place of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Replaces + public IEnumerable? Replaces { - get { return ReplacesElement != null ? ReplacesElement.Select(elem => elem.Value) : null; } + get => _ReplacesElement?.Select(elem => elem.Value); set { if (value == null) - ReplacesElement = null; + ReplacesElement = null!; else ReplacesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Replaces"); @@ -656,13 +621,13 @@ public IEnumerable Replaces [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -671,13 +636,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -687,13 +649,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -702,13 +664,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -719,28 +678,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -750,28 +706,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -784,39 +737,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the message definition. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -829,11 +779,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for message definition (if applicable). @@ -844,39 +794,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this message definition is defined. /// [FhirElement("purpose", InSummary=true, Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this message definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -886,28 +833,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -917,28 +861,25 @@ public string Copyright /// [FhirElement("base", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.Canonical BaseElement + public Hl7.Fhir.Model.Canonical? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Hl7.Fhir.Model.Canonical _BaseElement; + private Hl7.Fhir.Model.Canonical? _BaseElement; /// /// Definition this one is based on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Base + public string? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Hl7.Fhir.Model.Canonical(value); + BaseElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Base"); } } @@ -951,24 +892,24 @@ public string Base [DataMember] public List ParentElement { - get { if(_ParentElement==null) _ParentElement = new List(); return _ParentElement; } + get => _ParentElement ?? new List(); set { _ParentElement = value; OnPropertyChanged("ParentElement"); } } - private List _ParentElement; + private List? _ParentElement; /// /// Protocol/workflow this is part of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Parent + public IEnumerable? Parent { - get { return ParentElement != null ? ParentElement.Select(elem => elem.Value) : null; } + get => _ParentElement?.Select(elem => elem.Value); set { if (value == null) - ParentElement = null; + ParentElement = null!; else ParentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Parent"); @@ -984,13 +925,13 @@ public IEnumerable Parent [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirUri))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Event + public Hl7.Fhir.Model.DataType? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.DataType _Event; + private Hl7.Fhir.Model.DataType? _Event; /// /// consequence | currency | notification. @@ -999,13 +940,13 @@ public Hl7.Fhir.Model.DataType Event [DeclaredType(Type = typeof(Code))] [Binding("MessageSignificanceCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// consequence | currency | notification @@ -1014,13 +955,10 @@ public Code Catego [IgnoreDataMember] public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -1033,11 +971,11 @@ public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// always | on-error | never | on-success. @@ -1046,13 +984,13 @@ public List Focus [DeclaredType(Type = typeof(Code))] [Binding("messageheader-response-request")] [DataMember] - public Code ResponseRequiredElement + public Code? ResponseRequiredElement { get { return _ResponseRequiredElement; } set { _ResponseRequiredElement = value; OnPropertyChanged("ResponseRequiredElement"); } } - private Code _ResponseRequiredElement; + private Code? _ResponseRequiredElement; /// /// always | on-error | never | on-success @@ -1061,13 +999,10 @@ public Code ResponseRequiredElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageheaderResponseRequest? ResponseRequired { - get { return ResponseRequiredElement != null ? ResponseRequiredElement.Value : null; } + get => _ResponseRequiredElement?.Value; set { - if (value == null) - ResponseRequiredElement = null; - else - ResponseRequiredElement = new Code(value); + ResponseRequiredElement = value is null ? null : new Code(value); OnPropertyChanged("ResponseRequired"); } } @@ -1080,11 +1015,11 @@ public Hl7.Fhir.Model.MessageheaderResponseRequest? ResponseRequired [DataMember] public List AllowedResponse { - get { if(_AllowedResponse==null) _AllowedResponse = new List(); return _AllowedResponse; } + get => _AllowedResponse ?? new List(); set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } - private List _AllowedResponse; + private List? _AllowedResponse; /// /// Canonical reference to a GraphDefinition. @@ -1094,24 +1029,24 @@ public List AllowedRe [DataMember] public List GraphElement { - get { if(_GraphElement==null) _GraphElement = new List(); return _GraphElement; } + get => _GraphElement ?? new List(); set { _GraphElement = value; OnPropertyChanged("GraphElement"); } } - private List _GraphElement; + private List? _GraphElement; /// /// Canonical reference to a GraphDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Graph + public IEnumerable? Graph { - get { return GraphElement != null ? GraphElement.Select(elem => elem.Value) : null; } + get => _GraphElement?.Select(elem => elem.Value); set { if (value == null) - GraphElement = null; + GraphElement = null!; else GraphElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Graph"); @@ -1120,43 +1055,39 @@ public IEnumerable Graph List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.DataType ICoded.Code { get => Event; set => Event = value; } - IEnumerable ICoded.ToCodings() => Event.ToCodings(); + Hl7.Fhir.Model.DataType? ICoded.Code { get => Event; set => Event = value!; } + IEnumerable ICoded.ToCodings() => Event?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDefinition; - - if (dest == null) - { + if(other is not MessageDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ReplacesElement.Any()) dest.ReplacesElement = new List(ReplacesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)BaseElement.DeepCopyInternal(); - if(ParentElement.Any()) dest.ParentElement = new List(ParentElement.DeepCopyInternal()); - if(Event != null) dest.Event = (Hl7.Fhir.Model.DataType)Event.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(ResponseRequiredElement != null) dest.ResponseRequiredElement = (Code)ResponseRequiredElement.DeepCopyInternal(); - if(AllowedResponse.Any()) dest.AllowedResponse = new List(AllowedResponse.DeepCopyInternal()); - if(GraphElement.Any()) dest.GraphElement = new List(GraphElement.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ReplacesElement is not null) dest.ReplacesElement = new List(_ReplacesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)_BaseElement.DeepCopyInternal(); + if(_ParentElement is not null) dest.ParentElement = new List(_ParentElement.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.DataType)_Event.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_ResponseRequiredElement is not null) dest.ResponseRequiredElement = (Code)_ResponseRequiredElement.DeepCopyInternal(); + if(_AllowedResponse is not null) dest.AllowedResponse = new List(_AllowedResponse.DeepCopyInternal()); + if(_GraphElement is not null) dest.GraphElement = new List(_GraphElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1168,195 +1099,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDefinition; - if(otherT == null) return false; + if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(ReplacesElement, otherT.ReplacesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.ListEquals(ParentElement, otherT.ParentElement)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(ResponseRequiredElement, otherT.ResponseRequiredElement)) return false; - if(!comparer.ListEquals(AllowedResponse, otherT.AllowedResponse)) return false; - if(!comparer.ListEquals(GraphElement, otherT.GraphElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_ReplacesElement, otherT._ReplacesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.ListEquals(_ParentElement, otherT._ParentElement)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; + if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; + if(!comparer.ListEquals(_GraphElement, otherT._GraphElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "replaces": - value = ReplacesElement; - return ReplacesElement?.Any() == true; + value = _ReplacesElement; + return _ReplacesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; case "parent": - value = ParentElement; - return ParentElement?.Any() == true; + value = _ParentElement; + return _ParentElement?.Any() == true; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "responseRequired": - value = ResponseRequiredElement; - return ResponseRequiredElement is not null; + value = _ResponseRequiredElement; + return _ResponseRequiredElement is not null; case "allowedResponse": - value = AllowedResponse; - return AllowedResponse?.Any() == true; + value = _AllowedResponse; + return _AllowedResponse?.Any() == true; case "graph": - value = GraphElement; - return GraphElement?.Any() == true; + value = _GraphElement; + return _GraphElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "replaces": - ReplacesElement = (List)value; + ReplacesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "base": - BaseElement = (Hl7.Fhir.Model.Canonical)value; + BaseElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "parent": - ParentElement = (List)value; + ParentElement = (List?)value!; return this; case "event": - Event = (Hl7.Fhir.Model.DataType)value; + Event = (Hl7.Fhir.Model.DataType?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "responseRequired": - ResponseRequiredElement = (Code)value; + ResponseRequiredElement = (Code?)value; return this; case "allowedResponse": - AllowedResponse = (List)value; + AllowedResponse = (List?)value!; return this; case "graph": - GraphElement = (List)value; + GraphElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1367,30 +1298,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",ReplacesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); - if (ParentElement?.Any() == true) yield return new KeyValuePair("parent",ParentElement); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",ResponseRequiredElement); - if (AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",AllowedResponse); - if (GraphElement?.Any() == true) yield return new KeyValuePair("graph",GraphElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",_ReplacesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); + if (_ParentElement?.Any() == true) yield return new KeyValuePair("parent",_ParentElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",_ResponseRequiredElement); + if (_AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",_AllowedResponse); + if (_GraphElement?.Any() == true) yield return new KeyValuePair("graph",_GraphElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs index 927e3d68e..d53596169 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,28 +112,25 @@ public partial class MessageDestinationComponent : Hl7.Fhir.Model.BackboneElemen /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -142,13 +142,13 @@ public string Name [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// Actual destination address or id. @@ -156,28 +156,25 @@ public Hl7.Fhir.Model.ResourceReference Target [FhirElement("endpoint", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl EndpointElement + public Hl7.Fhir.Model.FhirUrl? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUrl _EndpointElement; + private Hl7.Fhir.Model.FhirUrl? _EndpointElement; /// /// Actual destination address or id /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUrl(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Endpoint"); } } @@ -189,28 +186,24 @@ public string Endpoint [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Receiver + public Hl7.Fhir.Model.ResourceReference? Receiver { get { return _Receiver; } set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private Hl7.Fhir.Model.ResourceReference _Receiver; + private Hl7.Fhir.Model.ResourceReference? _Receiver; protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDestinationComponent; - - if (dest == null) - { + if(other is not MessageDestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopyInternal(); - if(Receiver != null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)Receiver.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)_EndpointElement.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)_Receiver.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -222,55 +215,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDestinationComponent; - if(otherT == null) return false; + if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; - if(!comparer.Equals(Receiver, otherT.Receiver)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; + if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; case "receiver": - value = Receiver; - return Receiver is not null; + value = _Receiver; + return _Receiver is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUrl)value; + EndpointElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "receiver": - Receiver = (Hl7.Fhir.Model.ResourceReference)value; + Receiver = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -281,10 +274,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); - if (Receiver is not null) yield return new KeyValuePair("receiver",Receiver); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); + if (_Receiver is not null) yield return new KeyValuePair("receiver",_Receiver); } } @@ -310,28 +303,25 @@ public partial class MessageSourceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -341,28 +331,25 @@ public string Name /// [FhirElement("software", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SoftwareElement + public Hl7.Fhir.Model.FhirString? SoftwareElement { get { return _SoftwareElement; } set { _SoftwareElement = value; OnPropertyChanged("SoftwareElement"); } } - private Hl7.Fhir.Model.FhirString _SoftwareElement; + private Hl7.Fhir.Model.FhirString? _SoftwareElement; /// /// Name of software running the system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Software + public string? Software { - get { return SoftwareElement != null ? SoftwareElement.Value : null; } + get => _SoftwareElement?.Value; set { - if (value == null) - SoftwareElement = null; - else - SoftwareElement = new Hl7.Fhir.Model.FhirString(value); + SoftwareElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Software"); } } @@ -372,28 +359,25 @@ public string Software /// [FhirElement("version", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of software running /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -403,13 +387,13 @@ public string Version /// [FhirElement("contact", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.ContactPoint Contact + public Hl7.Fhir.Model.ContactPoint? Contact { get { return _Contact; } set { _Contact = value; OnPropertyChanged("Contact"); } } - private Hl7.Fhir.Model.ContactPoint _Contact; + private Hl7.Fhir.Model.ContactPoint? _Contact; /// /// Actual message source address or id. @@ -417,47 +401,40 @@ public Hl7.Fhir.Model.ContactPoint Contact [FhirElement("endpoint", InSummary=true, Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl EndpointElement + public Hl7.Fhir.Model.FhirUrl? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUrl _EndpointElement; + private Hl7.Fhir.Model.FhirUrl? _EndpointElement; /// /// Actual message source address or id /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUrl(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Endpoint"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageSourceComponent; - - if (dest == null) - { + if(other is not MessageSourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(SoftwareElement != null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)SoftwareElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Contact != null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)Contact.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_SoftwareElement is not null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)_SoftwareElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)_Contact.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)_EndpointElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -469,62 +446,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageSourceComponent; - if(otherT == null) return false; + if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(SoftwareElement, otherT.SoftwareElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "software": - value = SoftwareElement; - return SoftwareElement is not null; + value = _SoftwareElement; + return _SoftwareElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "contact": - value = Contact; - return Contact is not null; + value = _Contact; + return _Contact is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "software": - SoftwareElement = (Hl7.Fhir.Model.FhirString)value; + SoftwareElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (Hl7.Fhir.Model.ContactPoint)value; + Contact = (Hl7.Fhir.Model.ContactPoint?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUrl)value; + EndpointElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -535,11 +512,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (SoftwareElement is not null) yield return new KeyValuePair("software",SoftwareElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Contact is not null) yield return new KeyValuePair("contact",Contact); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_SoftwareElement is not null) yield return new KeyValuePair("software",_SoftwareElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Contact is not null) yield return new KeyValuePair("contact",_Contact); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); } } @@ -566,28 +543,25 @@ public partial class ResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identifier", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentifierElement + public Hl7.Fhir.Model.Id? IdentifierElement { get { return _IdentifierElement; } set { _IdentifierElement = value; OnPropertyChanged("IdentifierElement"); } } - private Hl7.Fhir.Model.Id _IdentifierElement; + private Hl7.Fhir.Model.Id? _IdentifierElement; /// /// Id of original message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identifier + public string? Identifier { - get { return IdentifierElement != null ? IdentifierElement.Value : null; } + get => _IdentifierElement?.Value; set { - if (value == null) - IdentifierElement = null; - else - IdentifierElement = new Hl7.Fhir.Model.Id(value); + IdentifierElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identifier"); } } @@ -600,13 +574,13 @@ public string Identifier [Binding("ResponseType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// ok | transient-error | fatal-error @@ -615,13 +589,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageHeader.ResponseType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -633,27 +604,23 @@ public Hl7.Fhir.Model.MessageHeader.ResponseType? Code [CLSCompliant(false)] [References("OperationOutcome")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Details + public Hl7.Fhir.Model.ResourceReference? Details { get { return _Details; } set { _Details = value; OnPropertyChanged("Details"); } } - private Hl7.Fhir.Model.ResourceReference _Details; + private Hl7.Fhir.Model.ResourceReference? _Details; protected internal override void CopyToInternal(Base other) { - var dest = other as ResponseComponent; - - if (dest == null) - { + if(other is not ResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdentifierElement != null) dest.IdentifierElement = (Hl7.Fhir.Model.Id)IdentifierElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Details != null) dest.Details = (Hl7.Fhir.Model.ResourceReference)Details.DeepCopyInternal(); + if(_IdentifierElement is not null) dest.IdentifierElement = (Hl7.Fhir.Model.Id)_IdentifierElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Details is not null) dest.Details = (Hl7.Fhir.Model.ResourceReference)_Details.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -665,48 +632,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResponseComponent; - if(otherT == null) return false; + if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentifierElement, otherT.IdentifierElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Details, otherT.Details)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Details, otherT._Details)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = IdentifierElement; - return IdentifierElement is not null; + value = _IdentifierElement; + return _IdentifierElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "details": - value = Details; - return Details is not null; + value = _Details; + return _Details is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - IdentifierElement = (Hl7.Fhir.Model.Id)value; + IdentifierElement = (Hl7.Fhir.Model.Id?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "details": - Details = (Hl7.Fhir.Model.ResourceReference)value; + Details = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -717,9 +684,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentifierElement is not null) yield return new KeyValuePair("identifier",IdentifierElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Details is not null) yield return new KeyValuePair("details",Details); + if (_IdentifierElement is not null) yield return new KeyValuePair("identifier",_IdentifierElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Details is not null) yield return new KeyValuePair("details",_Details); } } @@ -733,13 +700,13 @@ public override IEnumerable> EnumerateElements() [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirUri))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Event + public Hl7.Fhir.Model.DataType? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.DataType _Event; + private Hl7.Fhir.Model.DataType? _Event; /// /// Message destination application(s). @@ -749,11 +716,11 @@ public Hl7.Fhir.Model.DataType Event [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Real world sender of the message. @@ -762,13 +729,13 @@ public List Destinatio [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// The source of the data entry. @@ -777,13 +744,13 @@ public Hl7.Fhir.Model.ResourceReference Sender [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// The source of the decision. @@ -792,13 +759,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Message source application. @@ -806,13 +773,13 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("source", InSummary=true, Order=140, FiveWs="FiveWs.actor")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source + public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent _Source; + private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? _Source; /// /// Final responsibility for event. @@ -821,13 +788,13 @@ public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Cause of event. @@ -835,26 +802,26 @@ public Hl7.Fhir.Model.ResourceReference Responsible [FhirElement("reason", InSummary=true, Order=160, FiveWs="FiveWs.why[x]")] [Binding("EventReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// If this is a reply to prior message. /// [FhirElement("response", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response + public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.MessageHeader.ResponseComponent _Response; + private Hl7.Fhir.Model.MessageHeader.ResponseComponent? _Response; /// /// The actual content of the message. @@ -866,64 +833,57 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Link to the definition for this message. /// [FhirElement("definition", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Link to the definition for this message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageHeader; - - if (dest == null) - { + if(other is not MessageHeader dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Event != null) dest.Event = (Hl7.Fhir.Model.DataType)Event.DeepCopyInternal(); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)Source.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)Response.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.DataType)_Event.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)_Source.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)_Response.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -935,104 +895,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageHeader; - if(otherT == null) return false; + if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - Event = (Hl7.Fhir.Model.DataType)value; + Event = (Hl7.Fhir.Model.DataType?)value; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)value; + Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "response": - Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)value; + Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1043,17 +1003,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Event is not null) yield return new KeyValuePair("event",Event); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs index ffe448225..cb20b79f5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -221,41 +224,38 @@ public partial class ReferenceSeqComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("chromosome", InSummary=true, Order=40)] [Binding("chromosome-human")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Chromosome + public Hl7.Fhir.Model.CodeableConcept? Chromosome { get { return _Chromosome; } set { _Chromosome = value; OnPropertyChanged("Chromosome"); } } - private Hl7.Fhir.Model.CodeableConcept _Chromosome; + private Hl7.Fhir.Model.CodeableConcept? _Chromosome; /// /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37'. /// [FhirElement("genomeBuild", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString GenomeBuildElement + public Hl7.Fhir.Model.FhirString? GenomeBuildElement { get { return _GenomeBuildElement; } set { _GenomeBuildElement = value; OnPropertyChanged("GenomeBuildElement"); } } - private Hl7.Fhir.Model.FhirString _GenomeBuildElement; + private Hl7.Fhir.Model.FhirString? _GenomeBuildElement; /// /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37' /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string GenomeBuild + public string? GenomeBuild { - get { return GenomeBuildElement != null ? GenomeBuildElement.Value : null; } + get => _GenomeBuildElement?.Value; set { - if (value == null) - GenomeBuildElement = null; - else - GenomeBuildElement = new Hl7.Fhir.Model.FhirString(value); + GenomeBuildElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("GenomeBuild"); } } @@ -267,13 +267,13 @@ public string GenomeBuild [DeclaredType(Type = typeof(Code))] [Binding("orientationType")] [DataMember] - public Code OrientationElement + public Code? OrientationElement { get { return _OrientationElement; } set { _OrientationElement = value; OnPropertyChanged("OrientationElement"); } } - private Code _OrientationElement; + private Code? _OrientationElement; /// /// sense | antisense @@ -282,13 +282,10 @@ public Code OrientationElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.OrientationType? Orientation { - get { return OrientationElement != null ? OrientationElement.Value : null; } + get => _OrientationElement?.Value; set { - if (value == null) - OrientationElement = null; - else - OrientationElement = new Code(value); + OrientationElement = value is null ? null : new Code(value); OnPropertyChanged("Orientation"); } } @@ -299,13 +296,13 @@ public Hl7.Fhir.Model.MolecularSequence.OrientationType? Orientation [FhirElement("referenceSeqId", InSummary=true, Order=70)] [Binding("sequenceReference")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReferenceSeqId + public Hl7.Fhir.Model.CodeableConcept? ReferenceSeqId { get { return _ReferenceSeqId; } set { _ReferenceSeqId = value; OnPropertyChanged("ReferenceSeqId"); } } - private Hl7.Fhir.Model.CodeableConcept _ReferenceSeqId; + private Hl7.Fhir.Model.CodeableConcept? _ReferenceSeqId; /// /// A pointer to another MolecularSequence entity as reference sequence. @@ -314,41 +311,38 @@ public Hl7.Fhir.Model.CodeableConcept ReferenceSeqId [CLSCompliant(false)] [References("MolecularSequence")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReferenceSeqPointer + public Hl7.Fhir.Model.ResourceReference? ReferenceSeqPointer { get { return _ReferenceSeqPointer; } set { _ReferenceSeqPointer = value; OnPropertyChanged("ReferenceSeqPointer"); } } - private Hl7.Fhir.Model.ResourceReference _ReferenceSeqPointer; + private Hl7.Fhir.Model.ResourceReference? _ReferenceSeqPointer; /// /// A string to represent reference sequence. /// [FhirElement("referenceSeqString", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceSeqStringElement + public Hl7.Fhir.Model.FhirString? ReferenceSeqStringElement { get { return _ReferenceSeqStringElement; } set { _ReferenceSeqStringElement = value; OnPropertyChanged("ReferenceSeqStringElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceSeqStringElement; + private Hl7.Fhir.Model.FhirString? _ReferenceSeqStringElement; /// /// A string to represent reference sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReferenceSeqString + public string? ReferenceSeqString { - get { return ReferenceSeqStringElement != null ? ReferenceSeqStringElement.Value : null; } + get => _ReferenceSeqStringElement?.Value; set { - if (value == null) - ReferenceSeqStringElement = null; - else - ReferenceSeqStringElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceSeqStringElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReferenceSeqString"); } } @@ -360,13 +354,13 @@ public string ReferenceSeqString [DeclaredType(Type = typeof(Code))] [Binding("strandType")] [DataMember] - public Code StrandElement + public Code? StrandElement { get { return _StrandElement; } set { _StrandElement = value; OnPropertyChanged("StrandElement"); } } - private Code _StrandElement; + private Code? _StrandElement; /// /// watson | crick @@ -375,13 +369,10 @@ public Code StrandElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.StrandType? Strand { - get { return StrandElement != null ? StrandElement.Value : null; } + get => _StrandElement?.Value; set { - if (value == null) - StrandElement = null; - else - StrandElement = new Code(value); + StrandElement = value is null ? null : new Code(value); OnPropertyChanged("Strand"); } } @@ -391,13 +382,13 @@ public Hl7.Fhir.Model.MolecularSequence.StrandType? Strand /// [FhirElement("windowStart", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Integer WindowStartElement + public Hl7.Fhir.Model.Integer? WindowStartElement { get { return _WindowStartElement; } set { _WindowStartElement = value; OnPropertyChanged("WindowStartElement"); } } - private Hl7.Fhir.Model.Integer _WindowStartElement; + private Hl7.Fhir.Model.Integer? _WindowStartElement; /// /// Start position of the window on the reference sequence @@ -406,13 +397,10 @@ public Hl7.Fhir.Model.Integer WindowStartElement [IgnoreDataMember] public int? WindowStart { - get { return WindowStartElement != null ? WindowStartElement.Value : null; } + get => _WindowStartElement?.Value; set { - if (value == null) - WindowStartElement = null; - else - WindowStartElement = new Hl7.Fhir.Model.Integer(value); + WindowStartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowStart"); } } @@ -422,13 +410,13 @@ public int? WindowStart /// [FhirElement("windowEnd", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Integer WindowEndElement + public Hl7.Fhir.Model.Integer? WindowEndElement { get { return _WindowEndElement; } set { _WindowEndElement = value; OnPropertyChanged("WindowEndElement"); } } - private Hl7.Fhir.Model.Integer _WindowEndElement; + private Hl7.Fhir.Model.Integer? _WindowEndElement; /// /// End position of the window on the reference sequence @@ -437,36 +425,29 @@ public Hl7.Fhir.Model.Integer WindowEndElement [IgnoreDataMember] public int? WindowEnd { - get { return WindowEndElement != null ? WindowEndElement.Value : null; } + get => _WindowEndElement?.Value; set { - if (value == null) - WindowEndElement = null; - else - WindowEndElement = new Hl7.Fhir.Model.Integer(value); + WindowEndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowEnd"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceSeqComponent; - - if (dest == null) - { + if(other is not ReferenceSeqComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Chromosome != null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)Chromosome.DeepCopyInternal(); - if(GenomeBuildElement != null) dest.GenomeBuildElement = (Hl7.Fhir.Model.FhirString)GenomeBuildElement.DeepCopyInternal(); - if(OrientationElement != null) dest.OrientationElement = (Code)OrientationElement.DeepCopyInternal(); - if(ReferenceSeqId != null) dest.ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)ReferenceSeqId.DeepCopyInternal(); - if(ReferenceSeqPointer != null) dest.ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)ReferenceSeqPointer.DeepCopyInternal(); - if(ReferenceSeqStringElement != null) dest.ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)ReferenceSeqStringElement.DeepCopyInternal(); - if(StrandElement != null) dest.StrandElement = (Code)StrandElement.DeepCopyInternal(); - if(WindowStartElement != null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)WindowStartElement.DeepCopyInternal(); - if(WindowEndElement != null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)WindowEndElement.DeepCopyInternal(); + if(_Chromosome is not null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)_Chromosome.DeepCopyInternal(); + if(_GenomeBuildElement is not null) dest.GenomeBuildElement = (Hl7.Fhir.Model.FhirString)_GenomeBuildElement.DeepCopyInternal(); + if(_OrientationElement is not null) dest.OrientationElement = (Code)_OrientationElement.DeepCopyInternal(); + if(_ReferenceSeqId is not null) dest.ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)_ReferenceSeqId.DeepCopyInternal(); + if(_ReferenceSeqPointer is not null) dest.ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)_ReferenceSeqPointer.DeepCopyInternal(); + if(_ReferenceSeqStringElement is not null) dest.ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)_ReferenceSeqStringElement.DeepCopyInternal(); + if(_StrandElement is not null) dest.StrandElement = (Code)_StrandElement.DeepCopyInternal(); + if(_WindowStartElement is not null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)_WindowStartElement.DeepCopyInternal(); + if(_WindowEndElement is not null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)_WindowEndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -478,90 +459,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceSeqComponent; - if(otherT == null) return false; + if(other is not ReferenceSeqComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Chromosome, otherT.Chromosome)) return false; - if(!comparer.Equals(GenomeBuildElement, otherT.GenomeBuildElement)) return false; - if(!comparer.Equals(OrientationElement, otherT.OrientationElement)) return false; - if(!comparer.Equals(ReferenceSeqId, otherT.ReferenceSeqId)) return false; - if(!comparer.Equals(ReferenceSeqPointer, otherT.ReferenceSeqPointer)) return false; - if(!comparer.Equals(ReferenceSeqStringElement, otherT.ReferenceSeqStringElement)) return false; - if(!comparer.Equals(StrandElement, otherT.StrandElement)) return false; - if(!comparer.Equals(WindowStartElement, otherT.WindowStartElement)) return false; - if(!comparer.Equals(WindowEndElement, otherT.WindowEndElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; + if(!comparer.Equals(_GenomeBuildElement, otherT._GenomeBuildElement)) return false; + if(!comparer.Equals(_OrientationElement, otherT._OrientationElement)) return false; + if(!comparer.Equals(_ReferenceSeqId, otherT._ReferenceSeqId)) return false; + if(!comparer.Equals(_ReferenceSeqPointer, otherT._ReferenceSeqPointer)) return false; + if(!comparer.Equals(_ReferenceSeqStringElement, otherT._ReferenceSeqStringElement)) return false; + if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; + if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; + if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "chromosome": - value = Chromosome; - return Chromosome is not null; + value = _Chromosome; + return _Chromosome is not null; case "genomeBuild": - value = GenomeBuildElement; - return GenomeBuildElement is not null; + value = _GenomeBuildElement; + return _GenomeBuildElement is not null; case "orientation": - value = OrientationElement; - return OrientationElement is not null; + value = _OrientationElement; + return _OrientationElement is not null; case "referenceSeqId": - value = ReferenceSeqId; - return ReferenceSeqId is not null; + value = _ReferenceSeqId; + return _ReferenceSeqId is not null; case "referenceSeqPointer": - value = ReferenceSeqPointer; - return ReferenceSeqPointer is not null; + value = _ReferenceSeqPointer; + return _ReferenceSeqPointer is not null; case "referenceSeqString": - value = ReferenceSeqStringElement; - return ReferenceSeqStringElement is not null; + value = _ReferenceSeqStringElement; + return _ReferenceSeqStringElement is not null; case "strand": - value = StrandElement; - return StrandElement is not null; + value = _StrandElement; + return _StrandElement is not null; case "windowStart": - value = WindowStartElement; - return WindowStartElement is not null; + value = _WindowStartElement; + return _WindowStartElement is not null; case "windowEnd": - value = WindowEndElement; - return WindowEndElement is not null; + value = _WindowEndElement; + return _WindowEndElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "chromosome": - Chromosome = (Hl7.Fhir.Model.CodeableConcept)value; + Chromosome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genomeBuild": - GenomeBuildElement = (Hl7.Fhir.Model.FhirString)value; + GenomeBuildElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "orientation": - OrientationElement = (Code)value; + OrientationElement = (Code?)value; return this; case "referenceSeqId": - ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)value; + ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "referenceSeqPointer": - ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)value; + ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referenceSeqString": - ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "strand": - StrandElement = (Code)value; + StrandElement = (Code?)value; return this; case "windowStart": - WindowStartElement = (Hl7.Fhir.Model.Integer)value; + WindowStartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "windowEnd": - WindowEndElement = (Hl7.Fhir.Model.Integer)value; + WindowEndElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -572,15 +553,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Chromosome is not null) yield return new KeyValuePair("chromosome",Chromosome); - if (GenomeBuildElement is not null) yield return new KeyValuePair("genomeBuild",GenomeBuildElement); - if (OrientationElement is not null) yield return new KeyValuePair("orientation",OrientationElement); - if (ReferenceSeqId is not null) yield return new KeyValuePair("referenceSeqId",ReferenceSeqId); - if (ReferenceSeqPointer is not null) yield return new KeyValuePair("referenceSeqPointer",ReferenceSeqPointer); - if (ReferenceSeqStringElement is not null) yield return new KeyValuePair("referenceSeqString",ReferenceSeqStringElement); - if (StrandElement is not null) yield return new KeyValuePair("strand",StrandElement); - if (WindowStartElement is not null) yield return new KeyValuePair("windowStart",WindowStartElement); - if (WindowEndElement is not null) yield return new KeyValuePair("windowEnd",WindowEndElement); + if (_Chromosome is not null) yield return new KeyValuePair("chromosome",_Chromosome); + if (_GenomeBuildElement is not null) yield return new KeyValuePair("genomeBuild",_GenomeBuildElement); + if (_OrientationElement is not null) yield return new KeyValuePair("orientation",_OrientationElement); + if (_ReferenceSeqId is not null) yield return new KeyValuePair("referenceSeqId",_ReferenceSeqId); + if (_ReferenceSeqPointer is not null) yield return new KeyValuePair("referenceSeqPointer",_ReferenceSeqPointer); + if (_ReferenceSeqStringElement is not null) yield return new KeyValuePair("referenceSeqString",_ReferenceSeqStringElement); + if (_StrandElement is not null) yield return new KeyValuePair("strand",_StrandElement); + if (_WindowStartElement is not null) yield return new KeyValuePair("windowStart",_WindowStartElement); + if (_WindowEndElement is not null) yield return new KeyValuePair("windowEnd",_WindowEndElement); } } @@ -606,13 +587,13 @@ public partial class VariantComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Start position of the variant on the reference sequence @@ -621,13 +602,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -637,13 +615,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// End position of the variant on the reference sequence @@ -652,13 +630,10 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } @@ -668,28 +643,25 @@ public int? End /// [FhirElement("observedAllele", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ObservedAlleleElement + public Hl7.Fhir.Model.FhirString? ObservedAlleleElement { get { return _ObservedAlleleElement; } set { _ObservedAlleleElement = value; OnPropertyChanged("ObservedAlleleElement"); } } - private Hl7.Fhir.Model.FhirString _ObservedAlleleElement; + private Hl7.Fhir.Model.FhirString? _ObservedAlleleElement; /// /// Allele that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ObservedAllele + public string? ObservedAllele { - get { return ObservedAlleleElement != null ? ObservedAlleleElement.Value : null; } + get => _ObservedAlleleElement?.Value; set { - if (value == null) - ObservedAlleleElement = null; - else - ObservedAlleleElement = new Hl7.Fhir.Model.FhirString(value); + ObservedAlleleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ObservedAllele"); } } @@ -699,28 +671,25 @@ public string ObservedAllele /// [FhirElement("referenceAllele", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceAlleleElement + public Hl7.Fhir.Model.FhirString? ReferenceAlleleElement { get { return _ReferenceAlleleElement; } set { _ReferenceAlleleElement = value; OnPropertyChanged("ReferenceAlleleElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceAlleleElement; + private Hl7.Fhir.Model.FhirString? _ReferenceAlleleElement; /// /// Allele in the reference sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReferenceAllele + public string? ReferenceAllele { - get { return ReferenceAlleleElement != null ? ReferenceAlleleElement.Value : null; } + get => _ReferenceAlleleElement?.Value; set { - if (value == null) - ReferenceAlleleElement = null; - else - ReferenceAlleleElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceAlleleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReferenceAllele"); } } @@ -730,28 +699,25 @@ public string ReferenceAllele /// [FhirElement("cigar", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CigarElement + public Hl7.Fhir.Model.FhirString? CigarElement { get { return _CigarElement; } set { _CigarElement = value; OnPropertyChanged("CigarElement"); } } - private Hl7.Fhir.Model.FhirString _CigarElement; + private Hl7.Fhir.Model.FhirString? _CigarElement; /// /// Extended CIGAR string for aligning the sequence with reference bases /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Cigar + public string? Cigar { - get { return CigarElement != null ? CigarElement.Value : null; } + get => _CigarElement?.Value; set { - if (value == null) - CigarElement = null; - else - CigarElement = new Hl7.Fhir.Model.FhirString(value); + CigarElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Cigar"); } } @@ -763,30 +729,26 @@ public string Cigar [CLSCompliant(false)] [References("Observation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference VariantPointer + public Hl7.Fhir.Model.ResourceReference? VariantPointer { get { return _VariantPointer; } set { _VariantPointer = value; OnPropertyChanged("VariantPointer"); } } - private Hl7.Fhir.Model.ResourceReference _VariantPointer; + private Hl7.Fhir.Model.ResourceReference? _VariantPointer; protected internal override void CopyToInternal(Base other) { - var dest = other as VariantComponent; - - if (dest == null) - { + if(other is not VariantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); - if(ObservedAlleleElement != null) dest.ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)ObservedAlleleElement.DeepCopyInternal(); - if(ReferenceAlleleElement != null) dest.ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)ReferenceAlleleElement.DeepCopyInternal(); - if(CigarElement != null) dest.CigarElement = (Hl7.Fhir.Model.FhirString)CigarElement.DeepCopyInternal(); - if(VariantPointer != null) dest.VariantPointer = (Hl7.Fhir.Model.ResourceReference)VariantPointer.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); + if(_ObservedAlleleElement is not null) dest.ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)_ObservedAlleleElement.DeepCopyInternal(); + if(_ReferenceAlleleElement is not null) dest.ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)_ReferenceAlleleElement.DeepCopyInternal(); + if(_CigarElement is not null) dest.CigarElement = (Hl7.Fhir.Model.FhirString)_CigarElement.DeepCopyInternal(); + if(_VariantPointer is not null) dest.VariantPointer = (Hl7.Fhir.Model.ResourceReference)_VariantPointer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -798,69 +760,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariantComponent; - if(otherT == null) return false; + if(other is not VariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ObservedAlleleElement, otherT.ObservedAlleleElement)) return false; - if(!comparer.Equals(ReferenceAlleleElement, otherT.ReferenceAlleleElement)) return false; - if(!comparer.Equals(CigarElement, otherT.CigarElement)) return false; - if(!comparer.Equals(VariantPointer, otherT.VariantPointer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ObservedAlleleElement, otherT._ObservedAlleleElement)) return false; + if(!comparer.Equals(_ReferenceAlleleElement, otherT._ReferenceAlleleElement)) return false; + if(!comparer.Equals(_CigarElement, otherT._CigarElement)) return false; + if(!comparer.Equals(_VariantPointer, otherT._VariantPointer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "observedAllele": - value = ObservedAlleleElement; - return ObservedAlleleElement is not null; + value = _ObservedAlleleElement; + return _ObservedAlleleElement is not null; case "referenceAllele": - value = ReferenceAlleleElement; - return ReferenceAlleleElement is not null; + value = _ReferenceAlleleElement; + return _ReferenceAlleleElement is not null; case "cigar": - value = CigarElement; - return CigarElement is not null; + value = _CigarElement; + return _CigarElement is not null; case "variantPointer": - value = VariantPointer; - return VariantPointer is not null; + value = _VariantPointer; + return _VariantPointer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "observedAllele": - ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)value; + ObservedAlleleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "referenceAllele": - ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cigar": - CigarElement = (Hl7.Fhir.Model.FhirString)value; + CigarElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variantPointer": - VariantPointer = (Hl7.Fhir.Model.ResourceReference)value; + VariantPointer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -871,12 +833,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ObservedAlleleElement is not null) yield return new KeyValuePair("observedAllele",ObservedAlleleElement); - if (ReferenceAlleleElement is not null) yield return new KeyValuePair("referenceAllele",ReferenceAlleleElement); - if (CigarElement is not null) yield return new KeyValuePair("cigar",CigarElement); - if (VariantPointer is not null) yield return new KeyValuePair("variantPointer",VariantPointer); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ObservedAlleleElement is not null) yield return new KeyValuePair("observedAllele",_ObservedAlleleElement); + if (_ReferenceAlleleElement is not null) yield return new KeyValuePair("referenceAllele",_ReferenceAlleleElement); + if (_CigarElement is not null) yield return new KeyValuePair("cigar",_CigarElement); + if (_VariantPointer is not null) yield return new KeyValuePair("variantPointer",_VariantPointer); } } @@ -905,13 +867,13 @@ public partial class QualityComponent : Hl7.Fhir.Model.BackboneElement [Binding("qualityType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// indel | snp | unknown @@ -920,13 +882,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.QualityType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -937,26 +896,26 @@ public Hl7.Fhir.Model.MolecularSequence.QualityType? Type [FhirElement("standardSequence", InSummary=true, Order=50)] [Binding("qualityStandardSequence")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StandardSequence + public Hl7.Fhir.Model.CodeableConcept? StandardSequence { get { return _StandardSequence; } set { _StandardSequence = value; OnPropertyChanged("StandardSequence"); } } - private Hl7.Fhir.Model.CodeableConcept _StandardSequence; + private Hl7.Fhir.Model.CodeableConcept? _StandardSequence; /// /// Start position of the sequence. /// [FhirElement("start", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Start position of the sequence @@ -965,13 +924,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -981,13 +937,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// End position of the sequence @@ -996,13 +952,10 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } @@ -1012,13 +965,13 @@ public int? End /// [FhirElement("score", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Score + public Hl7.Fhir.Model.Quantity? Score { get { return _Score; } set { _Score = value; OnPropertyChanged("Score"); } } - private Hl7.Fhir.Model.Quantity _Score; + private Hl7.Fhir.Model.Quantity? _Score; /// /// Method to get quality. @@ -1026,26 +979,26 @@ public Hl7.Fhir.Model.Quantity Score [FhirElement("method", InSummary=true, Order=90)] [Binding("qualityMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// True positives from the perspective of the truth data. /// [FhirElement("truthTP", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TruthTPElement + public Hl7.Fhir.Model.FhirDecimal? TruthTPElement { get { return _TruthTPElement; } set { _TruthTPElement = value; OnPropertyChanged("TruthTPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TruthTPElement; + private Hl7.Fhir.Model.FhirDecimal? _TruthTPElement; /// /// True positives from the perspective of the truth data @@ -1054,13 +1007,10 @@ public Hl7.Fhir.Model.FhirDecimal TruthTPElement [IgnoreDataMember] public decimal? TruthTP { - get { return TruthTPElement != null ? TruthTPElement.Value : null; } + get => _TruthTPElement?.Value; set { - if (value == null) - TruthTPElement = null; - else - TruthTPElement = new Hl7.Fhir.Model.FhirDecimal(value); + TruthTPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("TruthTP"); } } @@ -1070,13 +1020,13 @@ public decimal? TruthTP /// [FhirElement("queryTP", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal QueryTPElement + public Hl7.Fhir.Model.FhirDecimal? QueryTPElement { get { return _QueryTPElement; } set { _QueryTPElement = value; OnPropertyChanged("QueryTPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _QueryTPElement; + private Hl7.Fhir.Model.FhirDecimal? _QueryTPElement; /// /// True positives from the perspective of the query data @@ -1085,13 +1035,10 @@ public Hl7.Fhir.Model.FhirDecimal QueryTPElement [IgnoreDataMember] public decimal? QueryTP { - get { return QueryTPElement != null ? QueryTPElement.Value : null; } + get => _QueryTPElement?.Value; set { - if (value == null) - QueryTPElement = null; - else - QueryTPElement = new Hl7.Fhir.Model.FhirDecimal(value); + QueryTPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("QueryTP"); } } @@ -1101,13 +1048,13 @@ public decimal? QueryTP /// [FhirElement("truthFN", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TruthFNElement + public Hl7.Fhir.Model.FhirDecimal? TruthFNElement { get { return _TruthFNElement; } set { _TruthFNElement = value; OnPropertyChanged("TruthFNElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TruthFNElement; + private Hl7.Fhir.Model.FhirDecimal? _TruthFNElement; /// /// False negatives @@ -1116,13 +1063,10 @@ public Hl7.Fhir.Model.FhirDecimal TruthFNElement [IgnoreDataMember] public decimal? TruthFN { - get { return TruthFNElement != null ? TruthFNElement.Value : null; } + get => _TruthFNElement?.Value; set { - if (value == null) - TruthFNElement = null; - else - TruthFNElement = new Hl7.Fhir.Model.FhirDecimal(value); + TruthFNElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("TruthFN"); } } @@ -1132,13 +1076,13 @@ public decimal? TruthFN /// [FhirElement("queryFP", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal QueryFPElement + public Hl7.Fhir.Model.FhirDecimal? QueryFPElement { get { return _QueryFPElement; } set { _QueryFPElement = value; OnPropertyChanged("QueryFPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _QueryFPElement; + private Hl7.Fhir.Model.FhirDecimal? _QueryFPElement; /// /// False positives @@ -1147,13 +1091,10 @@ public Hl7.Fhir.Model.FhirDecimal QueryFPElement [IgnoreDataMember] public decimal? QueryFP { - get { return QueryFPElement != null ? QueryFPElement.Value : null; } + get => _QueryFPElement?.Value; set { - if (value == null) - QueryFPElement = null; - else - QueryFPElement = new Hl7.Fhir.Model.FhirDecimal(value); + QueryFPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("QueryFP"); } } @@ -1163,13 +1104,13 @@ public decimal? QueryFP /// [FhirElement("gtFP", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal GtFPElement + public Hl7.Fhir.Model.FhirDecimal? GtFPElement { get { return _GtFPElement; } set { _GtFPElement = value; OnPropertyChanged("GtFPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _GtFPElement; + private Hl7.Fhir.Model.FhirDecimal? _GtFPElement; /// /// False positives where the non-REF alleles in the Truth and Query Call Sets match @@ -1178,13 +1119,10 @@ public Hl7.Fhir.Model.FhirDecimal GtFPElement [IgnoreDataMember] public decimal? GtFP { - get { return GtFPElement != null ? GtFPElement.Value : null; } + get => _GtFPElement?.Value; set { - if (value == null) - GtFPElement = null; - else - GtFPElement = new Hl7.Fhir.Model.FhirDecimal(value); + GtFPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("GtFP"); } } @@ -1194,13 +1132,13 @@ public decimal? GtFP /// [FhirElement("precision", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PrecisionElement + public Hl7.Fhir.Model.FhirDecimal? PrecisionElement { get { return _PrecisionElement; } set { _PrecisionElement = value; OnPropertyChanged("PrecisionElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PrecisionElement; + private Hl7.Fhir.Model.FhirDecimal? _PrecisionElement; /// /// Precision of comparison @@ -1209,13 +1147,10 @@ public Hl7.Fhir.Model.FhirDecimal PrecisionElement [IgnoreDataMember] public decimal? Precision { - get { return PrecisionElement != null ? PrecisionElement.Value : null; } + get => _PrecisionElement?.Value; set { - if (value == null) - PrecisionElement = null; - else - PrecisionElement = new Hl7.Fhir.Model.FhirDecimal(value); + PrecisionElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Precision"); } } @@ -1225,13 +1160,13 @@ public decimal? Precision /// [FhirElement("recall", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal RecallElement + public Hl7.Fhir.Model.FhirDecimal? RecallElement { get { return _RecallElement; } set { _RecallElement = value; OnPropertyChanged("RecallElement"); } } - private Hl7.Fhir.Model.FhirDecimal _RecallElement; + private Hl7.Fhir.Model.FhirDecimal? _RecallElement; /// /// Recall of comparison @@ -1240,13 +1175,10 @@ public Hl7.Fhir.Model.FhirDecimal RecallElement [IgnoreDataMember] public decimal? Recall { - get { return RecallElement != null ? RecallElement.Value : null; } + get => _RecallElement?.Value; set { - if (value == null) - RecallElement = null; - else - RecallElement = new Hl7.Fhir.Model.FhirDecimal(value); + RecallElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Recall"); } } @@ -1256,13 +1188,13 @@ public decimal? Recall /// [FhirElement("fScore", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FScoreElement + public Hl7.Fhir.Model.FhirDecimal? FScoreElement { get { return _FScoreElement; } set { _FScoreElement = value; OnPropertyChanged("FScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _FScoreElement; /// /// F-score @@ -1271,13 +1203,10 @@ public Hl7.Fhir.Model.FhirDecimal FScoreElement [IgnoreDataMember] public decimal? FScore { - get { return FScoreElement != null ? FScoreElement.Value : null; } + get => _FScoreElement?.Value; set { - if (value == null) - FScoreElement = null; - else - FScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + FScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("FScore"); } } @@ -1287,39 +1216,35 @@ public decimal? FScore /// [FhirElement("roc", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.RocComponent Roc + public Hl7.Fhir.Model.MolecularSequence.RocComponent? Roc { get { return _Roc; } set { _Roc = value; OnPropertyChanged("Roc"); } } - private Hl7.Fhir.Model.MolecularSequence.RocComponent _Roc; + private Hl7.Fhir.Model.MolecularSequence.RocComponent? _Roc; protected internal override void CopyToInternal(Base other) { - var dest = other as QualityComponent; - - if (dest == null) - { + if(other is not QualityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(StandardSequence != null) dest.StandardSequence = (Hl7.Fhir.Model.CodeableConcept)StandardSequence.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); - if(Score != null) dest.Score = (Hl7.Fhir.Model.Quantity)Score.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(TruthTPElement != null) dest.TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)TruthTPElement.DeepCopyInternal(); - if(QueryTPElement != null) dest.QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)QueryTPElement.DeepCopyInternal(); - if(TruthFNElement != null) dest.TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)TruthFNElement.DeepCopyInternal(); - if(QueryFPElement != null) dest.QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)QueryFPElement.DeepCopyInternal(); - if(GtFPElement != null) dest.GtFPElement = (Hl7.Fhir.Model.FhirDecimal)GtFPElement.DeepCopyInternal(); - if(PrecisionElement != null) dest.PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)PrecisionElement.DeepCopyInternal(); - if(RecallElement != null) dest.RecallElement = (Hl7.Fhir.Model.FhirDecimal)RecallElement.DeepCopyInternal(); - if(FScoreElement != null) dest.FScoreElement = (Hl7.Fhir.Model.FhirDecimal)FScoreElement.DeepCopyInternal(); - if(Roc != null) dest.Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent)Roc.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_StandardSequence is not null) dest.StandardSequence = (Hl7.Fhir.Model.CodeableConcept)_StandardSequence.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); + if(_Score is not null) dest.Score = (Hl7.Fhir.Model.Quantity)_Score.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_TruthTPElement is not null) dest.TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)_TruthTPElement.DeepCopyInternal(); + if(_QueryTPElement is not null) dest.QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)_QueryTPElement.DeepCopyInternal(); + if(_TruthFNElement is not null) dest.TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)_TruthFNElement.DeepCopyInternal(); + if(_QueryFPElement is not null) dest.QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)_QueryFPElement.DeepCopyInternal(); + if(_GtFPElement is not null) dest.GtFPElement = (Hl7.Fhir.Model.FhirDecimal)_GtFPElement.DeepCopyInternal(); + if(_PrecisionElement is not null) dest.PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)_PrecisionElement.DeepCopyInternal(); + if(_RecallElement is not null) dest.RecallElement = (Hl7.Fhir.Model.FhirDecimal)_RecallElement.DeepCopyInternal(); + if(_FScoreElement is not null) dest.FScoreElement = (Hl7.Fhir.Model.FhirDecimal)_FScoreElement.DeepCopyInternal(); + if(_Roc is not null) dest.Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent)_Roc.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1331,132 +1256,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualityComponent; - if(otherT == null) return false; + if(other is not QualityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(StandardSequence, otherT.StandardSequence)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(Score, otherT.Score)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(TruthTPElement, otherT.TruthTPElement)) return false; - if(!comparer.Equals(QueryTPElement, otherT.QueryTPElement)) return false; - if(!comparer.Equals(TruthFNElement, otherT.TruthFNElement)) return false; - if(!comparer.Equals(QueryFPElement, otherT.QueryFPElement)) return false; - if(!comparer.Equals(GtFPElement, otherT.GtFPElement)) return false; - if(!comparer.Equals(PrecisionElement, otherT.PrecisionElement)) return false; - if(!comparer.Equals(RecallElement, otherT.RecallElement)) return false; - if(!comparer.Equals(FScoreElement, otherT.FScoreElement)) return false; - if(!comparer.Equals(Roc, otherT.Roc)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_StandardSequence, otherT._StandardSequence)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_Score, otherT._Score)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_TruthTPElement, otherT._TruthTPElement)) return false; + if(!comparer.Equals(_QueryTPElement, otherT._QueryTPElement)) return false; + if(!comparer.Equals(_TruthFNElement, otherT._TruthFNElement)) return false; + if(!comparer.Equals(_QueryFPElement, otherT._QueryFPElement)) return false; + if(!comparer.Equals(_GtFPElement, otherT._GtFPElement)) return false; + if(!comparer.Equals(_PrecisionElement, otherT._PrecisionElement)) return false; + if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; + if(!comparer.Equals(_FScoreElement, otherT._FScoreElement)) return false; + if(!comparer.Equals(_Roc, otherT._Roc)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "standardSequence": - value = StandardSequence; - return StandardSequence is not null; + value = _StandardSequence; + return _StandardSequence is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "score": - value = Score; - return Score is not null; + value = _Score; + return _Score is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "truthTP": - value = TruthTPElement; - return TruthTPElement is not null; + value = _TruthTPElement; + return _TruthTPElement is not null; case "queryTP": - value = QueryTPElement; - return QueryTPElement is not null; + value = _QueryTPElement; + return _QueryTPElement is not null; case "truthFN": - value = TruthFNElement; - return TruthFNElement is not null; + value = _TruthFNElement; + return _TruthFNElement is not null; case "queryFP": - value = QueryFPElement; - return QueryFPElement is not null; + value = _QueryFPElement; + return _QueryFPElement is not null; case "gtFP": - value = GtFPElement; - return GtFPElement is not null; + value = _GtFPElement; + return _GtFPElement is not null; case "precision": - value = PrecisionElement; - return PrecisionElement is not null; + value = _PrecisionElement; + return _PrecisionElement is not null; case "recall": - value = RecallElement; - return RecallElement is not null; + value = _RecallElement; + return _RecallElement is not null; case "fScore": - value = FScoreElement; - return FScoreElement is not null; + value = _FScoreElement; + return _FScoreElement is not null; case "roc": - value = Roc; - return Roc is not null; + value = _Roc; + return _Roc is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "standardSequence": - StandardSequence = (Hl7.Fhir.Model.CodeableConcept)value; + StandardSequence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "score": - Score = (Hl7.Fhir.Model.Quantity)value; + Score = (Hl7.Fhir.Model.Quantity?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "truthTP": - TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)value; + TruthTPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "queryTP": - QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)value; + QueryTPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "truthFN": - TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)value; + TruthFNElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "queryFP": - QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)value; + QueryFPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "gtFP": - GtFPElement = (Hl7.Fhir.Model.FhirDecimal)value; + GtFPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "precision": - PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)value; + PrecisionElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "recall": - RecallElement = (Hl7.Fhir.Model.FhirDecimal)value; + RecallElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "fScore": - FScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + FScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "roc": - Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent)value; + Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent?)value; return this; default: return base.SetValue(key, value); @@ -1467,21 +1392,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (StandardSequence is not null) yield return new KeyValuePair("standardSequence",StandardSequence); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (Score is not null) yield return new KeyValuePair("score",Score); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (TruthTPElement is not null) yield return new KeyValuePair("truthTP",TruthTPElement); - if (QueryTPElement is not null) yield return new KeyValuePair("queryTP",QueryTPElement); - if (TruthFNElement is not null) yield return new KeyValuePair("truthFN",TruthFNElement); - if (QueryFPElement is not null) yield return new KeyValuePair("queryFP",QueryFPElement); - if (GtFPElement is not null) yield return new KeyValuePair("gtFP",GtFPElement); - if (PrecisionElement is not null) yield return new KeyValuePair("precision",PrecisionElement); - if (RecallElement is not null) yield return new KeyValuePair("recall",RecallElement); - if (FScoreElement is not null) yield return new KeyValuePair("fScore",FScoreElement); - if (Roc is not null) yield return new KeyValuePair("roc",Roc); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_StandardSequence is not null) yield return new KeyValuePair("standardSequence",_StandardSequence); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_Score is not null) yield return new KeyValuePair("score",_Score); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_TruthTPElement is not null) yield return new KeyValuePair("truthTP",_TruthTPElement); + if (_QueryTPElement is not null) yield return new KeyValuePair("queryTP",_QueryTPElement); + if (_TruthFNElement is not null) yield return new KeyValuePair("truthFN",_TruthFNElement); + if (_QueryFPElement is not null) yield return new KeyValuePair("queryFP",_QueryFPElement); + if (_GtFPElement is not null) yield return new KeyValuePair("gtFP",_GtFPElement); + if (_PrecisionElement is not null) yield return new KeyValuePair("precision",_PrecisionElement); + if (_RecallElement is not null) yield return new KeyValuePair("recall",_RecallElement); + if (_FScoreElement is not null) yield return new KeyValuePair("fScore",_FScoreElement); + if (_Roc is not null) yield return new KeyValuePair("roc",_Roc); } } @@ -1510,24 +1435,24 @@ public partial class RocComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ScoreElement { - get { if(_ScoreElement==null) _ScoreElement = new List(); return _ScoreElement; } + get => _ScoreElement ?? new List(); set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } - private List _ScoreElement; + private List? _ScoreElement; /// /// Genotype quality score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Score + public IEnumerable? Score { - get { return ScoreElement != null ? ScoreElement.Select(elem => elem.Value) : null; } + get => _ScoreElement?.Select(elem => elem.Value); set { if (value == null) - ScoreElement = null; + ScoreElement = null!; else ScoreElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("Score"); @@ -1542,24 +1467,24 @@ public IEnumerable Score [DataMember] public List NumTPElement { - get { if(_NumTPElement==null) _NumTPElement = new List(); return _NumTPElement; } + get => _NumTPElement ?? new List(); set { _NumTPElement = value; OnPropertyChanged("NumTPElement"); } } - private List _NumTPElement; + private List? _NumTPElement; /// /// Roc score true positive numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NumTP + public IEnumerable? NumTP { - get { return NumTPElement != null ? NumTPElement.Select(elem => elem.Value) : null; } + get => _NumTPElement?.Select(elem => elem.Value); set { if (value == null) - NumTPElement = null; + NumTPElement = null!; else NumTPElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("NumTP"); @@ -1574,24 +1499,24 @@ public IEnumerable NumTP [DataMember] public List NumFPElement { - get { if(_NumFPElement==null) _NumFPElement = new List(); return _NumFPElement; } + get => _NumFPElement ?? new List(); set { _NumFPElement = value; OnPropertyChanged("NumFPElement"); } } - private List _NumFPElement; + private List? _NumFPElement; /// /// Roc score false positive numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NumFP + public IEnumerable? NumFP { - get { return NumFPElement != null ? NumFPElement.Select(elem => elem.Value) : null; } + get => _NumFPElement?.Select(elem => elem.Value); set { if (value == null) - NumFPElement = null; + NumFPElement = null!; else NumFPElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("NumFP"); @@ -1606,24 +1531,24 @@ public IEnumerable NumFP [DataMember] public List NumFNElement { - get { if(_NumFNElement==null) _NumFNElement = new List(); return _NumFNElement; } + get => _NumFNElement ?? new List(); set { _NumFNElement = value; OnPropertyChanged("NumFNElement"); } } - private List _NumFNElement; + private List? _NumFNElement; /// /// Roc score false negative numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NumFN + public IEnumerable? NumFN { - get { return NumFNElement != null ? NumFNElement.Select(elem => elem.Value) : null; } + get => _NumFNElement?.Select(elem => elem.Value); set { if (value == null) - NumFNElement = null; + NumFNElement = null!; else NumFNElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("NumFN"); @@ -1638,24 +1563,24 @@ public IEnumerable NumFN [DataMember] public List PrecisionElement { - get { if(_PrecisionElement==null) _PrecisionElement = new List(); return _PrecisionElement; } + get => _PrecisionElement ?? new List(); set { _PrecisionElement = value; OnPropertyChanged("PrecisionElement"); } } - private List _PrecisionElement; + private List? _PrecisionElement; /// /// Precision of the GQ score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Precision + public IEnumerable? Precision { - get { return PrecisionElement != null ? PrecisionElement.Select(elem => elem.Value) : null; } + get => _PrecisionElement?.Select(elem => elem.Value); set { if (value == null) - PrecisionElement = null; + PrecisionElement = null!; else PrecisionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("Precision"); @@ -1670,24 +1595,24 @@ public IEnumerable Precision [DataMember] public List SensitivityElement { - get { if(_SensitivityElement==null) _SensitivityElement = new List(); return _SensitivityElement; } + get => _SensitivityElement ?? new List(); set { _SensitivityElement = value; OnPropertyChanged("SensitivityElement"); } } - private List _SensitivityElement; + private List? _SensitivityElement; /// /// Sensitivity of the GQ score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Sensitivity + public IEnumerable? Sensitivity { - get { return SensitivityElement != null ? SensitivityElement.Select(elem => elem.Value) : null; } + get => _SensitivityElement?.Select(elem => elem.Value); set { if (value == null) - SensitivityElement = null; + SensitivityElement = null!; else SensitivityElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("Sensitivity"); @@ -1702,24 +1627,24 @@ public IEnumerable Sensitivity [DataMember] public List FMeasureElement { - get { if(_FMeasureElement==null) _FMeasureElement = new List(); return _FMeasureElement; } + get => _FMeasureElement ?? new List(); set { _FMeasureElement = value; OnPropertyChanged("FMeasureElement"); } } - private List _FMeasureElement; + private List? _FMeasureElement; /// /// FScore of the GQ score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FMeasure + public IEnumerable? FMeasure { - get { return FMeasureElement != null ? FMeasureElement.Select(elem => elem.Value) : null; } + get => _FMeasureElement?.Select(elem => elem.Value); set { if (value == null) - FMeasureElement = null; + FMeasureElement = null!; else FMeasureElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("FMeasure"); @@ -1728,21 +1653,17 @@ public IEnumerable FMeasure protected internal override void CopyToInternal(Base other) { - var dest = other as RocComponent; - - if (dest == null) - { + if(other is not RocComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ScoreElement.Any()) dest.ScoreElement = new List(ScoreElement.DeepCopyInternal()); - if(NumTPElement.Any()) dest.NumTPElement = new List(NumTPElement.DeepCopyInternal()); - if(NumFPElement.Any()) dest.NumFPElement = new List(NumFPElement.DeepCopyInternal()); - if(NumFNElement.Any()) dest.NumFNElement = new List(NumFNElement.DeepCopyInternal()); - if(PrecisionElement.Any()) dest.PrecisionElement = new List(PrecisionElement.DeepCopyInternal()); - if(SensitivityElement.Any()) dest.SensitivityElement = new List(SensitivityElement.DeepCopyInternal()); - if(FMeasureElement.Any()) dest.FMeasureElement = new List(FMeasureElement.DeepCopyInternal()); + if(_ScoreElement is not null) dest.ScoreElement = new List(_ScoreElement.DeepCopyInternal()); + if(_NumTPElement is not null) dest.NumTPElement = new List(_NumTPElement.DeepCopyInternal()); + if(_NumFPElement is not null) dest.NumFPElement = new List(_NumFPElement.DeepCopyInternal()); + if(_NumFNElement is not null) dest.NumFNElement = new List(_NumFNElement.DeepCopyInternal()); + if(_PrecisionElement is not null) dest.PrecisionElement = new List(_PrecisionElement.DeepCopyInternal()); + if(_SensitivityElement is not null) dest.SensitivityElement = new List(_SensitivityElement.DeepCopyInternal()); + if(_FMeasureElement is not null) dest.FMeasureElement = new List(_FMeasureElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1754,76 +1675,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RocComponent; - if(otherT == null) return false; + if(other is not RocComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ScoreElement, otherT.ScoreElement)) return false; - if(!comparer.ListEquals(NumTPElement, otherT.NumTPElement)) return false; - if(!comparer.ListEquals(NumFPElement, otherT.NumFPElement)) return false; - if(!comparer.ListEquals(NumFNElement, otherT.NumFNElement)) return false; - if(!comparer.ListEquals(PrecisionElement, otherT.PrecisionElement)) return false; - if(!comparer.ListEquals(SensitivityElement, otherT.SensitivityElement)) return false; - if(!comparer.ListEquals(FMeasureElement, otherT.FMeasureElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ScoreElement, otherT._ScoreElement)) return false; + if(!comparer.ListEquals(_NumTPElement, otherT._NumTPElement)) return false; + if(!comparer.ListEquals(_NumFPElement, otherT._NumFPElement)) return false; + if(!comparer.ListEquals(_NumFNElement, otherT._NumFNElement)) return false; + if(!comparer.ListEquals(_PrecisionElement, otherT._PrecisionElement)) return false; + if(!comparer.ListEquals(_SensitivityElement, otherT._SensitivityElement)) return false; + if(!comparer.ListEquals(_FMeasureElement, otherT._FMeasureElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "score": - value = ScoreElement; - return ScoreElement?.Any() == true; + value = _ScoreElement; + return _ScoreElement?.Any() == true; case "numTP": - value = NumTPElement; - return NumTPElement?.Any() == true; + value = _NumTPElement; + return _NumTPElement?.Any() == true; case "numFP": - value = NumFPElement; - return NumFPElement?.Any() == true; + value = _NumFPElement; + return _NumFPElement?.Any() == true; case "numFN": - value = NumFNElement; - return NumFNElement?.Any() == true; + value = _NumFNElement; + return _NumFNElement?.Any() == true; case "precision": - value = PrecisionElement; - return PrecisionElement?.Any() == true; + value = _PrecisionElement; + return _PrecisionElement?.Any() == true; case "sensitivity": - value = SensitivityElement; - return SensitivityElement?.Any() == true; + value = _SensitivityElement; + return _SensitivityElement?.Any() == true; case "fMeasure": - value = FMeasureElement; - return FMeasureElement?.Any() == true; + value = _FMeasureElement; + return _FMeasureElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "score": - ScoreElement = (List)value; + ScoreElement = (List?)value!; return this; case "numTP": - NumTPElement = (List)value; + NumTPElement = (List?)value!; return this; case "numFP": - NumFPElement = (List)value; + NumFPElement = (List?)value!; return this; case "numFN": - NumFNElement = (List)value; + NumFNElement = (List?)value!; return this; case "precision": - PrecisionElement = (List)value; + PrecisionElement = (List?)value!; return this; case "sensitivity": - SensitivityElement = (List)value; + SensitivityElement = (List?)value!; return this; case "fMeasure": - FMeasureElement = (List)value; + FMeasureElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1834,13 +1755,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ScoreElement?.Any() == true) yield return new KeyValuePair("score",ScoreElement); - if (NumTPElement?.Any() == true) yield return new KeyValuePair("numTP",NumTPElement); - if (NumFPElement?.Any() == true) yield return new KeyValuePair("numFP",NumFPElement); - if (NumFNElement?.Any() == true) yield return new KeyValuePair("numFN",NumFNElement); - if (PrecisionElement?.Any() == true) yield return new KeyValuePair("precision",PrecisionElement); - if (SensitivityElement?.Any() == true) yield return new KeyValuePair("sensitivity",SensitivityElement); - if (FMeasureElement?.Any() == true) yield return new KeyValuePair("fMeasure",FMeasureElement); + if (_ScoreElement?.Any() == true) yield return new KeyValuePair("score",_ScoreElement); + if (_NumTPElement?.Any() == true) yield return new KeyValuePair("numTP",_NumTPElement); + if (_NumFPElement?.Any() == true) yield return new KeyValuePair("numFP",_NumFPElement); + if (_NumFNElement?.Any() == true) yield return new KeyValuePair("numFN",_NumFNElement); + if (_PrecisionElement?.Any() == true) yield return new KeyValuePair("precision",_PrecisionElement); + if (_SensitivityElement?.Any() == true) yield return new KeyValuePair("sensitivity",_SensitivityElement); + if (_FMeasureElement?.Any() == true) yield return new KeyValuePair("fMeasure",_FMeasureElement); } } @@ -1869,13 +1790,13 @@ public partial class RepositoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("repositoryType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// directlink | openapi | login | oauth | other @@ -1884,13 +1805,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.RepositoryType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1900,28 +1818,25 @@ public Hl7.Fhir.Model.MolecularSequence.RepositoryType? Type /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URI of the repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1931,28 +1846,25 @@ public string Url /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Repository's name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1962,28 +1874,25 @@ public string Name /// [FhirElement("datasetId", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DatasetIdElement + public Hl7.Fhir.Model.FhirString? DatasetIdElement { get { return _DatasetIdElement; } set { _DatasetIdElement = value; OnPropertyChanged("DatasetIdElement"); } } - private Hl7.Fhir.Model.FhirString _DatasetIdElement; + private Hl7.Fhir.Model.FhirString? _DatasetIdElement; /// /// Id of the dataset that used to call for dataset in repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DatasetId + public string? DatasetId { - get { return DatasetIdElement != null ? DatasetIdElement.Value : null; } + get => _DatasetIdElement?.Value; set { - if (value == null) - DatasetIdElement = null; - else - DatasetIdElement = new Hl7.Fhir.Model.FhirString(value); + DatasetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DatasetId"); } } @@ -1993,28 +1902,25 @@ public string DatasetId /// [FhirElement("variantsetId", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString VariantsetIdElement + public Hl7.Fhir.Model.FhirString? VariantsetIdElement { get { return _VariantsetIdElement; } set { _VariantsetIdElement = value; OnPropertyChanged("VariantsetIdElement"); } } - private Hl7.Fhir.Model.FhirString _VariantsetIdElement; + private Hl7.Fhir.Model.FhirString? _VariantsetIdElement; /// /// Id of the variantset that used to call for variantset in repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VariantsetId + public string? VariantsetId { - get { return VariantsetIdElement != null ? VariantsetIdElement.Value : null; } + get => _VariantsetIdElement?.Value; set { - if (value == null) - VariantsetIdElement = null; - else - VariantsetIdElement = new Hl7.Fhir.Model.FhirString(value); + VariantsetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VariantsetId"); } } @@ -2024,48 +1930,41 @@ public string VariantsetId /// [FhirElement("readsetId", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ReadsetIdElement + public Hl7.Fhir.Model.FhirString? ReadsetIdElement { get { return _ReadsetIdElement; } set { _ReadsetIdElement = value; OnPropertyChanged("ReadsetIdElement"); } } - private Hl7.Fhir.Model.FhirString _ReadsetIdElement; + private Hl7.Fhir.Model.FhirString? _ReadsetIdElement; /// /// Id of the read /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReadsetId + public string? ReadsetId { - get { return ReadsetIdElement != null ? ReadsetIdElement.Value : null; } + get => _ReadsetIdElement?.Value; set { - if (value == null) - ReadsetIdElement = null; - else - ReadsetIdElement = new Hl7.Fhir.Model.FhirString(value); + ReadsetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReadsetId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RepositoryComponent; - - if (dest == null) - { + if(other is not RepositoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DatasetIdElement != null) dest.DatasetIdElement = (Hl7.Fhir.Model.FhirString)DatasetIdElement.DeepCopyInternal(); - if(VariantsetIdElement != null) dest.VariantsetIdElement = (Hl7.Fhir.Model.FhirString)VariantsetIdElement.DeepCopyInternal(); - if(ReadsetIdElement != null) dest.ReadsetIdElement = (Hl7.Fhir.Model.FhirString)ReadsetIdElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DatasetIdElement is not null) dest.DatasetIdElement = (Hl7.Fhir.Model.FhirString)_DatasetIdElement.DeepCopyInternal(); + if(_VariantsetIdElement is not null) dest.VariantsetIdElement = (Hl7.Fhir.Model.FhirString)_VariantsetIdElement.DeepCopyInternal(); + if(_ReadsetIdElement is not null) dest.ReadsetIdElement = (Hl7.Fhir.Model.FhirString)_ReadsetIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2077,69 +1976,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepositoryComponent; - if(otherT == null) return false; + if(other is not RepositoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DatasetIdElement, otherT.DatasetIdElement)) return false; - if(!comparer.Equals(VariantsetIdElement, otherT.VariantsetIdElement)) return false; - if(!comparer.Equals(ReadsetIdElement, otherT.ReadsetIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DatasetIdElement, otherT._DatasetIdElement)) return false; + if(!comparer.Equals(_VariantsetIdElement, otherT._VariantsetIdElement)) return false; + if(!comparer.Equals(_ReadsetIdElement, otherT._ReadsetIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "datasetId": - value = DatasetIdElement; - return DatasetIdElement is not null; + value = _DatasetIdElement; + return _DatasetIdElement is not null; case "variantsetId": - value = VariantsetIdElement; - return VariantsetIdElement is not null; + value = _VariantsetIdElement; + return _VariantsetIdElement is not null; case "readsetId": - value = ReadsetIdElement; - return ReadsetIdElement is not null; + value = _ReadsetIdElement; + return _ReadsetIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "datasetId": - DatasetIdElement = (Hl7.Fhir.Model.FhirString)value; + DatasetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variantsetId": - VariantsetIdElement = (Hl7.Fhir.Model.FhirString)value; + VariantsetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "readsetId": - ReadsetIdElement = (Hl7.Fhir.Model.FhirString)value; + ReadsetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2150,12 +2049,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DatasetIdElement is not null) yield return new KeyValuePair("datasetId",DatasetIdElement); - if (VariantsetIdElement is not null) yield return new KeyValuePair("variantsetId",VariantsetIdElement); - if (ReadsetIdElement is not null) yield return new KeyValuePair("readsetId",ReadsetIdElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DatasetIdElement is not null) yield return new KeyValuePair("datasetId",_DatasetIdElement); + if (_VariantsetIdElement is not null) yield return new KeyValuePair("variantsetId",_VariantsetIdElement); + if (_ReadsetIdElement is not null) yield return new KeyValuePair("readsetId",_ReadsetIdElement); } } @@ -2182,26 +2081,26 @@ public partial class StructureVariantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("variantType", InSummary=true, Order=40)] [Binding("LOINC LL379-9 answerlist")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VariantType + public Hl7.Fhir.Model.CodeableConcept? VariantType { get { return _VariantType; } set { _VariantType = value; OnPropertyChanged("VariantType"); } } - private Hl7.Fhir.Model.CodeableConcept _VariantType; + private Hl7.Fhir.Model.CodeableConcept? _VariantType; /// /// Does the structural variant have base pair resolution breakpoints?. /// [FhirElement("exact", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExactElement + public Hl7.Fhir.Model.FhirBoolean? ExactElement { get { return _ExactElement; } set { _ExactElement = value; OnPropertyChanged("ExactElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExactElement; + private Hl7.Fhir.Model.FhirBoolean? _ExactElement; /// /// Does the structural variant have base pair resolution breakpoints? @@ -2210,13 +2109,10 @@ public Hl7.Fhir.Model.FhirBoolean ExactElement [IgnoreDataMember] public bool? Exact { - get { return ExactElement != null ? ExactElement.Value : null; } + get => _ExactElement?.Value; set { - if (value == null) - ExactElement = null; - else - ExactElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExactElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exact"); } } @@ -2226,13 +2122,13 @@ public bool? Exact /// [FhirElement("length", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer LengthElement + public Hl7.Fhir.Model.Integer? LengthElement { get { return _LengthElement; } set { _LengthElement = value; OnPropertyChanged("LengthElement"); } } - private Hl7.Fhir.Model.Integer _LengthElement; + private Hl7.Fhir.Model.Integer? _LengthElement; /// /// Structural variant length @@ -2241,13 +2137,10 @@ public Hl7.Fhir.Model.Integer LengthElement [IgnoreDataMember] public int? Length { - get { return LengthElement != null ? LengthElement.Value : null; } + get => _LengthElement?.Value; set { - if (value == null) - LengthElement = null; - else - LengthElement = new Hl7.Fhir.Model.Integer(value); + LengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Length"); } } @@ -2257,42 +2150,38 @@ public int? Length /// [FhirElement("outer", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.OuterComponent Outer + public Hl7.Fhir.Model.MolecularSequence.OuterComponent? Outer { get { return _Outer; } set { _Outer = value; OnPropertyChanged("Outer"); } } - private Hl7.Fhir.Model.MolecularSequence.OuterComponent _Outer; + private Hl7.Fhir.Model.MolecularSequence.OuterComponent? _Outer; /// /// Structural variant inner. /// [FhirElement("inner", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.InnerComponent Inner + public Hl7.Fhir.Model.MolecularSequence.InnerComponent? Inner { get { return _Inner; } set { _Inner = value; OnPropertyChanged("Inner"); } } - private Hl7.Fhir.Model.MolecularSequence.InnerComponent _Inner; + private Hl7.Fhir.Model.MolecularSequence.InnerComponent? _Inner; protected internal override void CopyToInternal(Base other) { - var dest = other as StructureVariantComponent; - - if (dest == null) - { + if(other is not StructureVariantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VariantType != null) dest.VariantType = (Hl7.Fhir.Model.CodeableConcept)VariantType.DeepCopyInternal(); - if(ExactElement != null) dest.ExactElement = (Hl7.Fhir.Model.FhirBoolean)ExactElement.DeepCopyInternal(); - if(LengthElement != null) dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopyInternal(); - if(Outer != null) dest.Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent)Outer.DeepCopyInternal(); - if(Inner != null) dest.Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent)Inner.DeepCopyInternal(); + if(_VariantType is not null) dest.VariantType = (Hl7.Fhir.Model.CodeableConcept)_VariantType.DeepCopyInternal(); + if(_ExactElement is not null) dest.ExactElement = (Hl7.Fhir.Model.FhirBoolean)_ExactElement.DeepCopyInternal(); + if(_LengthElement is not null) dest.LengthElement = (Hl7.Fhir.Model.Integer)_LengthElement.DeepCopyInternal(); + if(_Outer is not null) dest.Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent)_Outer.DeepCopyInternal(); + if(_Inner is not null) dest.Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent)_Inner.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2304,62 +2193,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureVariantComponent; - if(otherT == null) return false; + if(other is not StructureVariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VariantType, otherT.VariantType)) return false; - if(!comparer.Equals(ExactElement, otherT.ExactElement)) return false; - if(!comparer.Equals(LengthElement, otherT.LengthElement)) return false; - if(!comparer.Equals(Outer, otherT.Outer)) return false; - if(!comparer.Equals(Inner, otherT.Inner)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariantType, otherT._VariantType)) return false; + if(!comparer.Equals(_ExactElement, otherT._ExactElement)) return false; + if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; + if(!comparer.Equals(_Outer, otherT._Outer)) return false; + if(!comparer.Equals(_Inner, otherT._Inner)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "variantType": - value = VariantType; - return VariantType is not null; + value = _VariantType; + return _VariantType is not null; case "exact": - value = ExactElement; - return ExactElement is not null; + value = _ExactElement; + return _ExactElement is not null; case "length": - value = LengthElement; - return LengthElement is not null; + value = _LengthElement; + return _LengthElement is not null; case "outer": - value = Outer; - return Outer is not null; + value = _Outer; + return _Outer is not null; case "inner": - value = Inner; - return Inner is not null; + value = _Inner; + return _Inner is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "variantType": - VariantType = (Hl7.Fhir.Model.CodeableConcept)value; + VariantType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "exact": - ExactElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExactElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "length": - LengthElement = (Hl7.Fhir.Model.Integer)value; + LengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "outer": - Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent)value; + Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent?)value; return this; case "inner": - Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent)value; + Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent?)value; return this; default: return base.SetValue(key, value); @@ -2370,11 +2259,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VariantType is not null) yield return new KeyValuePair("variantType",VariantType); - if (ExactElement is not null) yield return new KeyValuePair("exact",ExactElement); - if (LengthElement is not null) yield return new KeyValuePair("length",LengthElement); - if (Outer is not null) yield return new KeyValuePair("outer",Outer); - if (Inner is not null) yield return new KeyValuePair("inner",Inner); + if (_VariantType is not null) yield return new KeyValuePair("variantType",_VariantType); + if (_ExactElement is not null) yield return new KeyValuePair("exact",_ExactElement); + if (_LengthElement is not null) yield return new KeyValuePair("length",_LengthElement); + if (_Outer is not null) yield return new KeyValuePair("outer",_Outer); + if (_Inner is not null) yield return new KeyValuePair("inner",_Inner); } } @@ -2397,13 +2286,13 @@ public partial class OuterComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Structural variant outer start @@ -2412,13 +2301,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -2428,13 +2314,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// Structural variant outer end @@ -2443,29 +2329,22 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OuterComponent; - - if (dest == null) - { + if(other is not OuterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2477,41 +2356,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OuterComponent; - if(otherT == null) return false; + if(other is not OuterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -2522,8 +2401,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); } } @@ -2546,13 +2425,13 @@ public partial class InnerComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Structural variant inner start @@ -2561,13 +2440,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -2577,13 +2453,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// Structural variant inner end @@ -2592,29 +2468,22 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InnerComponent; - - if (dest == null) - { + if(other is not InnerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2626,41 +2495,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InnerComponent; - if(otherT == null) return false; + if(other is not InnerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -2671,8 +2540,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); } } @@ -2685,11 +2554,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// aa | dna | rna. @@ -2698,13 +2567,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("sequenceType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// aa | dna | rna @@ -2713,13 +2582,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.SequenceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2730,13 +2596,13 @@ public Hl7.Fhir.Model.MolecularSequence.SequenceType? Type [FhirElement("coordinateSystem", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer CoordinateSystemElement + public Hl7.Fhir.Model.Integer? CoordinateSystemElement { get { return _CoordinateSystemElement; } set { _CoordinateSystemElement = value; OnPropertyChanged("CoordinateSystemElement"); } } - private Hl7.Fhir.Model.Integer _CoordinateSystemElement; + private Hl7.Fhir.Model.Integer? _CoordinateSystemElement; /// /// Base number of coordinate system (0 for 0-based numbering or coordinates, inclusive start, exclusive end, 1 for 1-based numbering, inclusive start, inclusive end) @@ -2745,13 +2611,10 @@ public Hl7.Fhir.Model.Integer CoordinateSystemElement [IgnoreDataMember] public int? CoordinateSystem { - get { return CoordinateSystemElement != null ? CoordinateSystemElement.Value : null; } + get => _CoordinateSystemElement?.Value; set { - if (value == null) - CoordinateSystemElement = null; - else - CoordinateSystemElement = new Hl7.Fhir.Model.Integer(value); + CoordinateSystemElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("CoordinateSystem"); } } @@ -2763,13 +2626,13 @@ public int? CoordinateSystem [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Specimen used for sequencing. @@ -2778,13 +2641,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// The method for sequencing. @@ -2793,13 +2656,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Who should be responsible for test result. @@ -2808,39 +2671,39 @@ public Hl7.Fhir.Model.ResourceReference Device [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// The number of copies of the sequence of interest. (RNASeq). /// [FhirElement("quantity", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// A sequence used as reference. /// [FhirElement("referenceSeq", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent ReferenceSeq + public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent? ReferenceSeq { get { return _ReferenceSeq; } set { _ReferenceSeq = value; OnPropertyChanged("ReferenceSeq"); } } - private Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent _ReferenceSeq; + private Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent? _ReferenceSeq; /// /// Variant in sequence. @@ -2850,39 +2713,36 @@ public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent ReferenceSeq [DataMember] public List Variant { - get { if(_Variant==null) _Variant = new List(); return _Variant; } + get => _Variant ?? new List(); set { _Variant = value; OnPropertyChanged("Variant"); } } - private List _Variant; + private List? _Variant; /// /// Sequence that was observed. /// [FhirElement("observedSeq", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString ObservedSeqElement + public Hl7.Fhir.Model.FhirString? ObservedSeqElement { get { return _ObservedSeqElement; } set { _ObservedSeqElement = value; OnPropertyChanged("ObservedSeqElement"); } } - private Hl7.Fhir.Model.FhirString _ObservedSeqElement; + private Hl7.Fhir.Model.FhirString? _ObservedSeqElement; /// /// Sequence that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ObservedSeq + public string? ObservedSeq { - get { return ObservedSeqElement != null ? ObservedSeqElement.Value : null; } + get => _ObservedSeqElement?.Value; set { - if (value == null) - ObservedSeqElement = null; - else - ObservedSeqElement = new Hl7.Fhir.Model.FhirString(value); + ObservedSeqElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ObservedSeq"); } } @@ -2895,24 +2755,24 @@ public string ObservedSeq [DataMember] public List Quality { - get { if(_Quality==null) _Quality = new List(); return _Quality; } + get => _Quality ?? new List(); set { _Quality = value; OnPropertyChanged("Quality"); } } - private List _Quality; + private List? _Quality; /// /// Average number of reads representing a given nucleotide in the reconstructed sequence. /// [FhirElement("readCoverage", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Integer ReadCoverageElement + public Hl7.Fhir.Model.Integer? ReadCoverageElement { get { return _ReadCoverageElement; } set { _ReadCoverageElement = value; OnPropertyChanged("ReadCoverageElement"); } } - private Hl7.Fhir.Model.Integer _ReadCoverageElement; + private Hl7.Fhir.Model.Integer? _ReadCoverageElement; /// /// Average number of reads representing a given nucleotide in the reconstructed sequence @@ -2921,13 +2781,10 @@ public Hl7.Fhir.Model.Integer ReadCoverageElement [IgnoreDataMember] public int? ReadCoverage { - get { return ReadCoverageElement != null ? ReadCoverageElement.Value : null; } + get => _ReadCoverageElement?.Value; set { - if (value == null) - ReadCoverageElement = null; - else - ReadCoverageElement = new Hl7.Fhir.Model.Integer(value); + ReadCoverageElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("ReadCoverage"); } } @@ -2940,11 +2797,11 @@ public int? ReadCoverage [DataMember] public List Repository { - get { if(_Repository==null) _Repository = new List(); return _Repository; } + get => _Repository ?? new List(); set { _Repository = value; OnPropertyChanged("Repository"); } } - private List _Repository; + private List? _Repository; /// /// Pointer to next atomic sequence. @@ -2956,11 +2813,11 @@ public List Repository [DataMember] public List Pointer { - get { if(_Pointer==null) _Pointer = new List(); return _Pointer; } + get => _Pointer ?? new List(); set { _Pointer = value; OnPropertyChanged("Pointer"); } } - private List _Pointer; + private List? _Pointer; /// /// Structural variant. @@ -2970,40 +2827,36 @@ public List Pointer [DataMember] public List StructureVariant { - get { if(_StructureVariant==null) _StructureVariant = new List(); return _StructureVariant; } + get => _StructureVariant ?? new List(); set { _StructureVariant = value; OnPropertyChanged("StructureVariant"); } } - private List _StructureVariant; + private List? _StructureVariant; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MolecularSequence; - - if (dest == null) - { + if(other is not MolecularSequence dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(CoordinateSystemElement != null) dest.CoordinateSystemElement = (Hl7.Fhir.Model.Integer)CoordinateSystemElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ReferenceSeq != null) dest.ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent)ReferenceSeq.DeepCopyInternal(); - if(Variant.Any()) dest.Variant = new List(Variant.DeepCopyInternal()); - if(ObservedSeqElement != null) dest.ObservedSeqElement = (Hl7.Fhir.Model.FhirString)ObservedSeqElement.DeepCopyInternal(); - if(Quality.Any()) dest.Quality = new List(Quality.DeepCopyInternal()); - if(ReadCoverageElement != null) dest.ReadCoverageElement = (Hl7.Fhir.Model.Integer)ReadCoverageElement.DeepCopyInternal(); - if(Repository.Any()) dest.Repository = new List(Repository.DeepCopyInternal()); - if(Pointer.Any()) dest.Pointer = new List(Pointer.DeepCopyInternal()); - if(StructureVariant.Any()) dest.StructureVariant = new List(StructureVariant.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_CoordinateSystemElement is not null) dest.CoordinateSystemElement = (Hl7.Fhir.Model.Integer)_CoordinateSystemElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ReferenceSeq is not null) dest.ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent)_ReferenceSeq.DeepCopyInternal(); + if(_Variant is not null) dest.Variant = new List(_Variant.DeepCopyInternal()); + if(_ObservedSeqElement is not null) dest.ObservedSeqElement = (Hl7.Fhir.Model.FhirString)_ObservedSeqElement.DeepCopyInternal(); + if(_Quality is not null) dest.Quality = new List(_Quality.DeepCopyInternal()); + if(_ReadCoverageElement is not null) dest.ReadCoverageElement = (Hl7.Fhir.Model.Integer)_ReadCoverageElement.DeepCopyInternal(); + if(_Repository is not null) dest.Repository = new List(_Repository.DeepCopyInternal()); + if(_Pointer is not null) dest.Pointer = new List(_Pointer.DeepCopyInternal()); + if(_StructureVariant is not null) dest.StructureVariant = new List(_StructureVariant.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3015,139 +2868,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MolecularSequence; - if(otherT == null) return false; + if(other is not MolecularSequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(CoordinateSystemElement, otherT.CoordinateSystemElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ReferenceSeq, otherT.ReferenceSeq)) return false; - if(!comparer.ListEquals(Variant, otherT.Variant)) return false; - if(!comparer.Equals(ObservedSeqElement, otherT.ObservedSeqElement)) return false; - if(!comparer.ListEquals(Quality, otherT.Quality)) return false; - if(!comparer.Equals(ReadCoverageElement, otherT.ReadCoverageElement)) return false; - if(!comparer.ListEquals(Repository, otherT.Repository)) return false; - if(!comparer.ListEquals(Pointer, otherT.Pointer)) return false; - if(!comparer.ListEquals(StructureVariant, otherT.StructureVariant)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_CoordinateSystemElement, otherT._CoordinateSystemElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ReferenceSeq, otherT._ReferenceSeq)) return false; + if(!comparer.ListEquals(_Variant, otherT._Variant)) return false; + if(!comparer.Equals(_ObservedSeqElement, otherT._ObservedSeqElement)) return false; + if(!comparer.ListEquals(_Quality, otherT._Quality)) return false; + if(!comparer.Equals(_ReadCoverageElement, otherT._ReadCoverageElement)) return false; + if(!comparer.ListEquals(_Repository, otherT._Repository)) return false; + if(!comparer.ListEquals(_Pointer, otherT._Pointer)) return false; + if(!comparer.ListEquals(_StructureVariant, otherT._StructureVariant)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "coordinateSystem": - value = CoordinateSystemElement; - return CoordinateSystemElement is not null; + value = _CoordinateSystemElement; + return _CoordinateSystemElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "referenceSeq": - value = ReferenceSeq; - return ReferenceSeq is not null; + value = _ReferenceSeq; + return _ReferenceSeq is not null; case "variant": - value = Variant; - return Variant?.Any() == true; + value = _Variant; + return _Variant?.Any() == true; case "observedSeq": - value = ObservedSeqElement; - return ObservedSeqElement is not null; + value = _ObservedSeqElement; + return _ObservedSeqElement is not null; case "quality": - value = Quality; - return Quality?.Any() == true; + value = _Quality; + return _Quality?.Any() == true; case "readCoverage": - value = ReadCoverageElement; - return ReadCoverageElement is not null; + value = _ReadCoverageElement; + return _ReadCoverageElement is not null; case "repository": - value = Repository; - return Repository?.Any() == true; + value = _Repository; + return _Repository?.Any() == true; case "pointer": - value = Pointer; - return Pointer?.Any() == true; + value = _Pointer; + return _Pointer?.Any() == true; case "structureVariant": - value = StructureVariant; - return StructureVariant?.Any() == true; + value = _StructureVariant; + return _StructureVariant?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "coordinateSystem": - CoordinateSystemElement = (Hl7.Fhir.Model.Integer)value; + CoordinateSystemElement = (Hl7.Fhir.Model.Integer?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "referenceSeq": - ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent)value; + ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent?)value; return this; case "variant": - Variant = (List)value; + Variant = (List?)value!; return this; case "observedSeq": - ObservedSeqElement = (Hl7.Fhir.Model.FhirString)value; + ObservedSeqElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quality": - Quality = (List)value; + Quality = (List?)value!; return this; case "readCoverage": - ReadCoverageElement = (Hl7.Fhir.Model.Integer)value; + ReadCoverageElement = (Hl7.Fhir.Model.Integer?)value; return this; case "repository": - Repository = (List)value; + Repository = (List?)value!; return this; case "pointer": - Pointer = (List)value; + Pointer = (List?)value!; return this; case "structureVariant": - StructureVariant = (List)value; + StructureVariant = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3158,22 +3011,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (CoordinateSystemElement is not null) yield return new KeyValuePair("coordinateSystem",CoordinateSystemElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ReferenceSeq is not null) yield return new KeyValuePair("referenceSeq",ReferenceSeq); - if (Variant?.Any() == true) yield return new KeyValuePair("variant",Variant); - if (ObservedSeqElement is not null) yield return new KeyValuePair("observedSeq",ObservedSeqElement); - if (Quality?.Any() == true) yield return new KeyValuePair("quality",Quality); - if (ReadCoverageElement is not null) yield return new KeyValuePair("readCoverage",ReadCoverageElement); - if (Repository?.Any() == true) yield return new KeyValuePair("repository",Repository); - if (Pointer?.Any() == true) yield return new KeyValuePair("pointer",Pointer); - if (StructureVariant?.Any() == true) yield return new KeyValuePair("structureVariant",StructureVariant); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_CoordinateSystemElement is not null) yield return new KeyValuePair("coordinateSystem",_CoordinateSystemElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ReferenceSeq is not null) yield return new KeyValuePair("referenceSeq",_ReferenceSeq); + if (_Variant?.Any() == true) yield return new KeyValuePair("variant",_Variant); + if (_ObservedSeqElement is not null) yield return new KeyValuePair("observedSeq",_ObservedSeqElement); + if (_Quality?.Any() == true) yield return new KeyValuePair("quality",_Quality); + if (_ReadCoverageElement is not null) yield return new KeyValuePair("readCoverage",_ReadCoverageElement); + if (_Repository?.Any() == true) yield return new KeyValuePair("repository",_Repository); + if (_Pointer?.Any() == true) yield return new KeyValuePair("pointer",_Pointer); + if (_StructureVariant?.Any() == true) yield return new KeyValuePair("structureVariant",_StructureVariant); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Money.cs b/src/Hl7.Fhir.R4/Model/Generated/Money.cs index b8b93935d..8e4b91d18 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Money.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Money.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -1163,13 +1166,13 @@ public enum Currencies /// [FhirElement("value", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Numerical value (with implicit precision) @@ -1178,13 +1181,10 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } @@ -1196,13 +1196,13 @@ public decimal? Value [DeclaredType(Type = typeof(Code))] [Binding("CurrencyCode")] [DataMember] - public Code CurrencyElement + public Code? CurrencyElement { get { return _CurrencyElement; } set { _CurrencyElement = value; OnPropertyChanged("CurrencyElement"); } } - private Code _CurrencyElement; + private Code? _CurrencyElement; /// /// ISO 4217 Currency Code @@ -1211,29 +1211,22 @@ public Code CurrencyElement [IgnoreDataMember] public Hl7.Fhir.Model.Money.Currencies? Currency { - get { return CurrencyElement != null ? CurrencyElement.Value : null; } + get => _CurrencyElement?.Value; set { - if (value == null) - CurrencyElement = null; - else - CurrencyElement = new Code(value); + CurrencyElement = value is null ? null : new Code(value); OnPropertyChanged("Currency"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Money; - - if (dest == null) - { + if(other is not Money dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); - if(CurrencyElement != null) dest.CurrencyElement = (Code)CurrencyElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); + if(_CurrencyElement is not null) dest.CurrencyElement = (Code)_CurrencyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1245,41 +1238,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Money; - if(otherT == null) return false; + if(other is not Money otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(CurrencyElement, otherT.CurrencyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_CurrencyElement, otherT._CurrencyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "currency": - value = CurrencyElement; - return CurrencyElement is not null; + value = _CurrencyElement; + return _CurrencyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "currency": - CurrencyElement = (Code)value; + CurrencyElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -1290,8 +1283,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (CurrencyElement is not null) yield return new KeyValuePair("currency",CurrencyElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_CurrencyElement is not null) yield return new KeyValuePair("currency",_CurrencyElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs index 9650fd146..abb41b228 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -146,13 +149,13 @@ public partial class UniqueIdComponent : Hl7.Fhir.Model.BackboneElement [Binding("NamingSystemIdentifierType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// oid | uuid | uri | other @@ -161,13 +164,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -178,28 +178,25 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type [FhirElement("value", InSummary=true, Order=50, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The unique identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -209,13 +206,13 @@ public string Value /// [FhirElement("preferred", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Is this the id that should be used for this type @@ -224,13 +221,10 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } @@ -240,28 +234,25 @@ public bool? Preferred /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Notes about identifier usage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -271,29 +262,25 @@ public string Comment /// [FhirElement("period", Order=80)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as UniqueIdComponent; - - if (dest == null) - { + if(other is not UniqueIdComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -305,62 +292,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UniqueIdComponent; - if(otherT == null) return false; + if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -371,11 +358,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -386,28 +373,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("name", InSummary=true, Order=90)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this naming system (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -420,13 +404,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -435,13 +419,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -454,13 +435,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("NamingSystemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// codesystem | identifier | root @@ -469,13 +450,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -486,28 +464,25 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind [FhirElement("date", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -517,28 +492,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=130, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -551,39 +523,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who maintains system namespace?. /// [FhirElement("responsible", Order=150, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString ResponsibleElement + public Hl7.Fhir.Model.FhirString? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirString _ResponsibleElement; + private Hl7.Fhir.Model.FhirString? _ResponsibleElement; /// /// Who maintains system namespace? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Responsible + public string? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirString(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Responsible"); } } @@ -594,41 +563,38 @@ public string Responsible [FhirElement("type", Order=160)] [Binding("IdentifierType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Natural language description of the naming system. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the naming system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -641,11 +607,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for naming system (if applicable). @@ -656,39 +622,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// How/where is it used. /// [FhirElement("usage", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// How/where is it used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -701,35 +664,31 @@ public string Usage [DataMember] public List UniqueId { - get { if(_UniqueId==null) _UniqueId = new List(); return _UniqueId; } + get => _UniqueId ?? new List(); set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } - private List _UniqueId; + private List? _UniqueId; protected internal override void CopyToInternal(Base other) { - var dest = other as NamingSystem; - - if (dest == null) - { + if(other is not NamingSystem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)ResponsibleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(UniqueId.Any()) dest.UniqueId = new List(UniqueId.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)_ResponsibleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_UniqueId is not null) dest.UniqueId = new List(_UniqueId.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -741,118 +700,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NamingSystem; - if(otherT == null) return false; + if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.ListEquals(UniqueId, otherT.UniqueId)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "uniqueId": - value = UniqueId; - return UniqueId?.Any() == true; + value = _UniqueId; + return _UniqueId?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirString)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "uniqueId": - UniqueId = (List)value; + UniqueId = (List?)value!; return this; default: return base.SetValue(key, value); @@ -863,19 +822,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",UniqueId); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",_UniqueId); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs index fb474676a..a6df831df 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -85,11 +88,11 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Scheduled frequency of diet. @@ -99,11 +102,11 @@ public List Type [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// Required nutrient modifications. @@ -113,11 +116,11 @@ public List Schedule [DataMember] public List Nutrient { - get { if(_Nutrient==null) _Nutrient = new List(); return _Nutrient; } + get => _Nutrient ?? new List(); set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } - private List _Nutrient; + private List? _Nutrient; /// /// Required texture modifications. @@ -127,11 +130,11 @@ public List Nutrient [DataMember] public List Texture { - get { if(_Texture==null) _Texture = new List(); return _Texture; } + get => _Texture ?? new List(); set { _Texture = value; OnPropertyChanged("Texture"); } } - private List _Texture; + private List? _Texture; /// /// The required consistency of fluids and liquids provided to the patient. @@ -142,59 +145,52 @@ public List Texture [DataMember] public List FluidConsistencyType { - get { if(_FluidConsistencyType==null) _FluidConsistencyType = new List(); return _FluidConsistencyType; } + get => _FluidConsistencyType ?? new List(); set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } - private List _FluidConsistencyType; + private List? _FluidConsistencyType; /// /// Instructions or additional information about the oral diet. /// [FhirElement("instruction", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral diet /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OralDietComponent; - - if (dest == null) - { + if(other is not OralDietComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(Nutrient.Any()) dest.Nutrient = new List(Nutrient.DeepCopyInternal()); - if(Texture.Any()) dest.Texture = new List(Texture.DeepCopyInternal()); - if(FluidConsistencyType.Any()) dest.FluidConsistencyType = new List(FluidConsistencyType.DeepCopyInternal()); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_Nutrient is not null) dest.Nutrient = new List(_Nutrient.DeepCopyInternal()); + if(_Texture is not null) dest.Texture = new List(_Texture.DeepCopyInternal()); + if(_FluidConsistencyType is not null) dest.FluidConsistencyType = new List(_FluidConsistencyType.DeepCopyInternal()); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -206,69 +202,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OralDietComponent; - if(otherT == null) return false; + if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.ListEquals(Nutrient, otherT.Nutrient)) return false; - if(!comparer.ListEquals(Texture, otherT.Texture)) return false; - if(!comparer.ListEquals(FluidConsistencyType, otherT.FluidConsistencyType)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; + if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; + if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "nutrient": - value = Nutrient; - return Nutrient?.Any() == true; + value = _Nutrient; + return _Nutrient?.Any() == true; case "texture": - value = Texture; - return Texture?.Any() == true; + value = _Texture; + return _Texture?.Any() == true; case "fluidConsistencyType": - value = FluidConsistencyType; - return FluidConsistencyType?.Any() == true; + value = _FluidConsistencyType; + return _FluidConsistencyType?.Any() == true; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "nutrient": - Nutrient = (List)value; + Nutrient = (List?)value!; return this; case "texture": - Texture = (List)value; + Texture = (List?)value!; return this; case "fluidConsistencyType": - FluidConsistencyType = (List)value; + FluidConsistencyType = (List?)value!; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -279,12 +275,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",Nutrient); - if (Texture?.Any() == true) yield return new KeyValuePair("texture",Texture); - if (FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",FluidConsistencyType); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",_Nutrient); + if (_Texture?.Any() == true) yield return new KeyValuePair("texture",_Texture); + if (_FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",_FluidConsistencyType); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -311,39 +307,35 @@ public partial class NutrientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40, FiveWs="FiveWs.what[x]")] [Binding("NutrientModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Quantity of the specified nutrient. /// [FhirElement("amount", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as NutrientComponent; - - if (dest == null) - { + if(other is not NutrientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -355,41 +347,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutrientComponent; - if(otherT == null) return false; + if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -400,8 +392,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -428,13 +420,13 @@ public partial class TextureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40)] [Binding("TextureModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Concepts that are used to identify an entity that is ingested for nutritional purposes. @@ -442,26 +434,22 @@ public Hl7.Fhir.Model.CodeableConcept Modifier [FhirElement("foodType", Order=50)] [Binding("TextureModifiedFoodType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FoodType + public Hl7.Fhir.Model.CodeableConcept? FoodType { get { return _FoodType; } set { _FoodType = value; OnPropertyChanged("FoodType"); } } - private Hl7.Fhir.Model.CodeableConcept _FoodType; + private Hl7.Fhir.Model.CodeableConcept? _FoodType; protected internal override void CopyToInternal(Base other) { - var dest = other as TextureComponent; - - if (dest == null) - { + if(other is not TextureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(FoodType != null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)FoodType.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_FoodType is not null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)_FoodType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -473,41 +461,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TextureComponent; - if(otherT == null) return false; + if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(FoodType, otherT.FoodType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "foodType": - value = FoodType; - return FoodType is not null; + value = _FoodType; + return _FoodType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "foodType": - FoodType = (Hl7.Fhir.Model.CodeableConcept)value; + FoodType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -518,8 +506,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (FoodType is not null) yield return new KeyValuePair("foodType",FoodType); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_FoodType is not null) yield return new KeyValuePair("foodType",_FoodType); } } @@ -546,41 +534,38 @@ public partial class SupplementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [Binding("SupplementType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Product or brand name of the nutritional supplement. /// [FhirElement("productName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// Product or brand name of the nutritional supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -593,71 +578,64 @@ public string ProductName [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// Amount of the nutritional supplement. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Instructions or additional information about the oral supplement. /// [FhirElement("instruction", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementComponent; - - if (dest == null) - { + if(other is not SupplementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -669,62 +647,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementComponent; - if(otherT == null) return false; + if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -735,11 +713,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -766,41 +744,38 @@ public partial class EnteralFormulaComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("baseFormulaType", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [Binding("EnteralFormulaType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BaseFormulaType + public Hl7.Fhir.Model.CodeableConcept? BaseFormulaType { get { return _BaseFormulaType; } set { _BaseFormulaType = value; OnPropertyChanged("BaseFormulaType"); } } - private Hl7.Fhir.Model.CodeableConcept _BaseFormulaType; + private Hl7.Fhir.Model.CodeableConcept? _BaseFormulaType; /// /// Product or brand name of the enteral or infant formula. /// [FhirElement("baseFormulaProductName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString BaseFormulaProductNameElement + public Hl7.Fhir.Model.FhirString? BaseFormulaProductNameElement { get { return _BaseFormulaProductNameElement; } set { _BaseFormulaProductNameElement = value; OnPropertyChanged("BaseFormulaProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _BaseFormulaProductNameElement; + private Hl7.Fhir.Model.FhirString? _BaseFormulaProductNameElement; /// /// Product or brand name of the enteral or infant formula /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BaseFormulaProductName + public string? BaseFormulaProductName { - get { return BaseFormulaProductNameElement != null ? BaseFormulaProductNameElement.Value : null; } + get => _BaseFormulaProductNameElement?.Value; set { - if (value == null) - BaseFormulaProductNameElement = null; - else - BaseFormulaProductNameElement = new Hl7.Fhir.Model.FhirString(value); + BaseFormulaProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BaseFormulaProductName"); } } @@ -811,41 +786,38 @@ public string BaseFormulaProductName [FhirElement("additiveType", Order=60, FiveWs="FiveWs.what[x]")] [Binding("EnteralFormulaAdditiveType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdditiveType + public Hl7.Fhir.Model.CodeableConcept? AdditiveType { get { return _AdditiveType; } set { _AdditiveType = value; OnPropertyChanged("AdditiveType"); } } - private Hl7.Fhir.Model.CodeableConcept _AdditiveType; + private Hl7.Fhir.Model.CodeableConcept? _AdditiveType; /// /// Product or brand name of the modular additive. /// [FhirElement("additiveProductName", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString AdditiveProductNameElement + public Hl7.Fhir.Model.FhirString? AdditiveProductNameElement { get { return _AdditiveProductNameElement; } set { _AdditiveProductNameElement = value; OnPropertyChanged("AdditiveProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _AdditiveProductNameElement; + private Hl7.Fhir.Model.FhirString? _AdditiveProductNameElement; /// /// Product or brand name of the modular additive /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AdditiveProductName + public string? AdditiveProductName { - get { return AdditiveProductNameElement != null ? AdditiveProductNameElement.Value : null; } + get => _AdditiveProductNameElement?.Value; set { - if (value == null) - AdditiveProductNameElement = null; - else - AdditiveProductNameElement = new Hl7.Fhir.Model.FhirString(value); + AdditiveProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AdditiveProductName"); } } @@ -855,13 +827,13 @@ public string AdditiveProductName /// [FhirElement("caloricDensity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity CaloricDensity + public Hl7.Fhir.Model.Quantity? CaloricDensity { get { return _CaloricDensity; } set { _CaloricDensity = value; OnPropertyChanged("CaloricDensity"); } } - private Hl7.Fhir.Model.Quantity _CaloricDensity; + private Hl7.Fhir.Model.Quantity? _CaloricDensity; /// /// How the formula should enter the patient's gastrointestinal tract. @@ -869,13 +841,13 @@ public Hl7.Fhir.Model.Quantity CaloricDensity [FhirElement("routeofAdministration", Order=90)] [Binding("EnteralRouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RouteofAdministration + public Hl7.Fhir.Model.CodeableConcept? RouteofAdministration { get { return _RouteofAdministration; } set { _RouteofAdministration = value; OnPropertyChanged("RouteofAdministration"); } } - private Hl7.Fhir.Model.CodeableConcept _RouteofAdministration; + private Hl7.Fhir.Model.CodeableConcept? _RouteofAdministration; /// /// Formula feeding instruction as structured data. @@ -885,75 +857,68 @@ public Hl7.Fhir.Model.CodeableConcept RouteofAdministration [DataMember] public List Administration { - get { if(_Administration==null) _Administration = new List(); return _Administration; } + get => _Administration ?? new List(); set { _Administration = value; OnPropertyChanged("Administration"); } } - private List _Administration; + private List? _Administration; /// /// Upper limit on formula volume per unit of time. /// [FhirElement("maxVolumeToDeliver", Order=110)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxVolumeToDeliver + public Hl7.Fhir.Model.Quantity? MaxVolumeToDeliver { get { return _MaxVolumeToDeliver; } set { _MaxVolumeToDeliver = value; OnPropertyChanged("MaxVolumeToDeliver"); } } - private Hl7.Fhir.Model.Quantity _MaxVolumeToDeliver; + private Hl7.Fhir.Model.Quantity? _MaxVolumeToDeliver; /// /// Formula feeding instructions expressed as text. /// [FhirElement("administrationInstruction", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString AdministrationInstructionElement + public Hl7.Fhir.Model.FhirString? AdministrationInstructionElement { get { return _AdministrationInstructionElement; } set { _AdministrationInstructionElement = value; OnPropertyChanged("AdministrationInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _AdministrationInstructionElement; + private Hl7.Fhir.Model.FhirString? _AdministrationInstructionElement; /// /// Formula feeding instructions expressed as text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AdministrationInstruction + public string? AdministrationInstruction { - get { return AdministrationInstructionElement != null ? AdministrationInstructionElement.Value : null; } + get => _AdministrationInstructionElement?.Value; set { - if (value == null) - AdministrationInstructionElement = null; - else - AdministrationInstructionElement = new Hl7.Fhir.Model.FhirString(value); + AdministrationInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AdministrationInstruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EnteralFormulaComponent; - - if (dest == null) - { + if(other is not EnteralFormulaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(BaseFormulaType != null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)BaseFormulaType.DeepCopyInternal(); - if(BaseFormulaProductNameElement != null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)BaseFormulaProductNameElement.DeepCopyInternal(); - if(AdditiveType != null) dest.AdditiveType = (Hl7.Fhir.Model.CodeableConcept)AdditiveType.DeepCopyInternal(); - if(AdditiveProductNameElement != null) dest.AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)AdditiveProductNameElement.DeepCopyInternal(); - if(CaloricDensity != null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)CaloricDensity.DeepCopyInternal(); - if(RouteofAdministration != null) dest.RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)RouteofAdministration.DeepCopyInternal(); - if(Administration.Any()) dest.Administration = new List(Administration.DeepCopyInternal()); - if(MaxVolumeToDeliver != null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)MaxVolumeToDeliver.DeepCopyInternal(); - if(AdministrationInstructionElement != null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)AdministrationInstructionElement.DeepCopyInternal(); + if(_BaseFormulaType is not null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)_BaseFormulaType.DeepCopyInternal(); + if(_BaseFormulaProductNameElement is not null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)_BaseFormulaProductNameElement.DeepCopyInternal(); + if(_AdditiveType is not null) dest.AdditiveType = (Hl7.Fhir.Model.CodeableConcept)_AdditiveType.DeepCopyInternal(); + if(_AdditiveProductNameElement is not null) dest.AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)_AdditiveProductNameElement.DeepCopyInternal(); + if(_CaloricDensity is not null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)_CaloricDensity.DeepCopyInternal(); + if(_RouteofAdministration is not null) dest.RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)_RouteofAdministration.DeepCopyInternal(); + if(_Administration is not null) dest.Administration = new List(_Administration.DeepCopyInternal()); + if(_MaxVolumeToDeliver is not null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)_MaxVolumeToDeliver.DeepCopyInternal(); + if(_AdministrationInstructionElement is not null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)_AdministrationInstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -965,90 +930,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnteralFormulaComponent; - if(otherT == null) return false; + if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(BaseFormulaType, otherT.BaseFormulaType)) return false; - if(!comparer.Equals(BaseFormulaProductNameElement, otherT.BaseFormulaProductNameElement)) return false; - if(!comparer.Equals(AdditiveType, otherT.AdditiveType)) return false; - if(!comparer.Equals(AdditiveProductNameElement, otherT.AdditiveProductNameElement)) return false; - if(!comparer.Equals(CaloricDensity, otherT.CaloricDensity)) return false; - if(!comparer.Equals(RouteofAdministration, otherT.RouteofAdministration)) return false; - if(!comparer.ListEquals(Administration, otherT.Administration)) return false; - if(!comparer.Equals(MaxVolumeToDeliver, otherT.MaxVolumeToDeliver)) return false; - if(!comparer.Equals(AdministrationInstructionElement, otherT.AdministrationInstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; + if(!comparer.Equals(_AdditiveType, otherT._AdditiveType)) return false; + if(!comparer.Equals(_AdditiveProductNameElement, otherT._AdditiveProductNameElement)) return false; + if(!comparer.Equals(_CaloricDensity, otherT._CaloricDensity)) return false; + if(!comparer.Equals(_RouteofAdministration, otherT._RouteofAdministration)) return false; + if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; + if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; + if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "baseFormulaType": - value = BaseFormulaType; - return BaseFormulaType is not null; + value = _BaseFormulaType; + return _BaseFormulaType is not null; case "baseFormulaProductName": - value = BaseFormulaProductNameElement; - return BaseFormulaProductNameElement is not null; + value = _BaseFormulaProductNameElement; + return _BaseFormulaProductNameElement is not null; case "additiveType": - value = AdditiveType; - return AdditiveType is not null; + value = _AdditiveType; + return _AdditiveType is not null; case "additiveProductName": - value = AdditiveProductNameElement; - return AdditiveProductNameElement is not null; + value = _AdditiveProductNameElement; + return _AdditiveProductNameElement is not null; case "caloricDensity": - value = CaloricDensity; - return CaloricDensity is not null; + value = _CaloricDensity; + return _CaloricDensity is not null; case "routeofAdministration": - value = RouteofAdministration; - return RouteofAdministration is not null; + value = _RouteofAdministration; + return _RouteofAdministration is not null; case "administration": - value = Administration; - return Administration?.Any() == true; + value = _Administration; + return _Administration?.Any() == true; case "maxVolumeToDeliver": - value = MaxVolumeToDeliver; - return MaxVolumeToDeliver is not null; + value = _MaxVolumeToDeliver; + return _MaxVolumeToDeliver is not null; case "administrationInstruction": - value = AdministrationInstructionElement; - return AdministrationInstructionElement is not null; + value = _AdministrationInstructionElement; + return _AdministrationInstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "baseFormulaType": - BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)value; + BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "baseFormulaProductName": - BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)value; + BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "additiveType": - AdditiveType = (Hl7.Fhir.Model.CodeableConcept)value; + AdditiveType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additiveProductName": - AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)value; + AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "caloricDensity": - CaloricDensity = (Hl7.Fhir.Model.Quantity)value; + CaloricDensity = (Hl7.Fhir.Model.Quantity?)value; return this; case "routeofAdministration": - RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)value; + RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "administration": - Administration = (List)value; + Administration = (List?)value!; return this; case "maxVolumeToDeliver": - MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)value; + MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity?)value; return this; case "administrationInstruction": - AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)value; + AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1059,15 +1024,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",BaseFormulaType); - if (BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",BaseFormulaProductNameElement); - if (AdditiveType is not null) yield return new KeyValuePair("additiveType",AdditiveType); - if (AdditiveProductNameElement is not null) yield return new KeyValuePair("additiveProductName",AdditiveProductNameElement); - if (CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",CaloricDensity); - if (RouteofAdministration is not null) yield return new KeyValuePair("routeofAdministration",RouteofAdministration); - if (Administration?.Any() == true) yield return new KeyValuePair("administration",Administration); - if (MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",MaxVolumeToDeliver); - if (AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",AdministrationInstructionElement); + if (_BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",_BaseFormulaType); + if (_BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",_BaseFormulaProductNameElement); + if (_AdditiveType is not null) yield return new KeyValuePair("additiveType",_AdditiveType); + if (_AdditiveProductNameElement is not null) yield return new KeyValuePair("additiveProductName",_AdditiveProductNameElement); + if (_CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",_CaloricDensity); + if (_RouteofAdministration is not null) yield return new KeyValuePair("routeofAdministration",_RouteofAdministration); + if (_Administration?.Any() == true) yield return new KeyValuePair("administration",_Administration); + if (_MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",_MaxVolumeToDeliver); + if (_AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",_AdministrationInstructionElement); } } @@ -1094,26 +1059,26 @@ public partial class AdministrationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("schedule", Order=40)] [DataMember] - public Hl7.Fhir.Model.Timing Schedule + public Hl7.Fhir.Model.Timing? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.Timing _Schedule; + private Hl7.Fhir.Model.Timing? _Schedule; /// /// The volume of formula to provide. /// [FhirElement("quantity", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Speed with which the formula is provided per period of time. @@ -1122,27 +1087,23 @@ public Hl7.Fhir.Model.Quantity Quantity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrationComponent; - - if (dest == null) - { + if(other is not AdministrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.Timing)Schedule.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.Timing)_Schedule.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1154,48 +1115,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrationComponent; - if(otherT == null) return false; + if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "schedule": - Schedule = (Hl7.Fhir.Model.Timing)value; + Schedule = (Hl7.Fhir.Model.Timing?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1206,9 +1167,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -1221,11 +1182,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -1235,24 +1196,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1267,24 +1228,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1299,24 +1260,24 @@ public IEnumerable InstantiatesUri [DataMember] public List InstantiatesElement { - get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; } + get => _InstantiatesElement ?? new List(); set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } - private List _InstantiatesElement; + private List? _InstantiatesElement; /// /// Instantiates protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Instantiates + public IEnumerable? Instantiates { - get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; } + get => _InstantiatesElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesElement = null; + InstantiatesElement = null!; else InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Instantiates"); @@ -1331,13 +1292,13 @@ public IEnumerable Instantiates [Binding("NutritionOrderStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -1346,13 +1307,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1365,13 +1323,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("NutritiionOrderIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -1380,13 +1338,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1399,13 +1354,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// The encounter associated with this nutrition order. @@ -1414,13 +1369,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Date and time the nutrition order was requested. @@ -1428,28 +1383,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("dateTime", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateTimeElement + public Hl7.Fhir.Model.FhirDateTime? DateTimeElement { get { return _DateTimeElement; } set { _DateTimeElement = value; OnPropertyChanged("DateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _DateTimeElement; /// /// Date and time the nutrition order was requested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateTime + public string? DateTime { - get { return DateTimeElement != null ? DateTimeElement.Value : null; } + get => _DateTimeElement?.Value; set { - if (value == null) - DateTimeElement = null; - else - DateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateTime"); } } @@ -1461,13 +1413,13 @@ public string DateTime [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Orderer + public Hl7.Fhir.Model.ResourceReference? Orderer { get { return _Orderer; } set { _Orderer = value; OnPropertyChanged("Orderer"); } } - private Hl7.Fhir.Model.ResourceReference _Orderer; + private Hl7.Fhir.Model.ResourceReference? _Orderer; /// /// List of the patient's food and nutrition-related allergies and intolerances. @@ -1479,11 +1431,11 @@ public Hl7.Fhir.Model.ResourceReference Orderer [DataMember] public List AllergyIntolerance { - get { if(_AllergyIntolerance==null) _AllergyIntolerance = new List(); return _AllergyIntolerance; } + get => _AllergyIntolerance ?? new List(); set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } - private List _AllergyIntolerance; + private List? _AllergyIntolerance; /// /// Order-specific modifier about the type of food that should be given. @@ -1494,11 +1446,11 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get { if(_FoodPreferenceModifier==null) _FoodPreferenceModifier = new List(); return _FoodPreferenceModifier; } + get => _FoodPreferenceModifier ?? new List(); set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } - private List _FoodPreferenceModifier; + private List? _FoodPreferenceModifier; /// /// Order-specific modifier about the type of food that should not be given. @@ -1509,24 +1461,24 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get { if(_ExcludeFoodModifier==null) _ExcludeFoodModifier = new List(); return _ExcludeFoodModifier; } + get => _ExcludeFoodModifier ?? new List(); set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } - private List _ExcludeFoodModifier; + private List? _ExcludeFoodModifier; /// /// Oral diet components. /// [FhirElement("oralDiet", Order=220)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet + public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet { get { return _OralDiet; } set { _OralDiet = value; OnPropertyChanged("OralDiet"); } } - private Hl7.Fhir.Model.NutritionOrder.OralDietComponent _OralDiet; + private Hl7.Fhir.Model.NutritionOrder.OralDietComponent? _OralDiet; /// /// Supplement components. @@ -1536,24 +1488,24 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet [DataMember] public List Supplement { - get { if(_Supplement==null) _Supplement = new List(); return _Supplement; } + get => _Supplement ?? new List(); set { _Supplement = value; OnPropertyChanged("Supplement"); } } - private List _Supplement; + private List? _Supplement; /// /// Enteral formula components. /// [FhirElement("enteralFormula", Order=240)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent EnteralFormula + public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? EnteralFormula { get { return _EnteralFormula; } set { _EnteralFormula = value; OnPropertyChanged("EnteralFormula"); } } - private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent _EnteralFormula; + private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? _EnteralFormula; /// /// Comments. @@ -1563,41 +1515,37 @@ public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent EnteralFormula [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as NutritionOrder; - - if (dest == null) - { + if(other is not NutritionOrder dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateTimeElement != null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopyInternal(); - if(Orderer != null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)Orderer.DeepCopyInternal(); - if(AllergyIntolerance.Any()) dest.AllergyIntolerance = new List(AllergyIntolerance.DeepCopyInternal()); - if(FoodPreferenceModifier.Any()) dest.FoodPreferenceModifier = new List(FoodPreferenceModifier.DeepCopyInternal()); - if(ExcludeFoodModifier.Any()) dest.ExcludeFoodModifier = new List(ExcludeFoodModifier.DeepCopyInternal()); - if(OralDiet != null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)OralDiet.DeepCopyInternal(); - if(Supplement.Any()) dest.Supplement = new List(Supplement.DeepCopyInternal()); - if(EnteralFormula != null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)EnteralFormula.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_InstantiatesElement is not null) dest.InstantiatesElement = new List(_InstantiatesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateTimeElement is not null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_DateTimeElement.DeepCopyInternal(); + if(_Orderer is not null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)_Orderer.DeepCopyInternal(); + if(_AllergyIntolerance is not null) dest.AllergyIntolerance = new List(_AllergyIntolerance.DeepCopyInternal()); + if(_FoodPreferenceModifier is not null) dest.FoodPreferenceModifier = new List(_FoodPreferenceModifier.DeepCopyInternal()); + if(_ExcludeFoodModifier is not null) dest.ExcludeFoodModifier = new List(_ExcludeFoodModifier.DeepCopyInternal()); + if(_OralDiet is not null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)_OralDiet.DeepCopyInternal(); + if(_Supplement is not null) dest.Supplement = new List(_Supplement.DeepCopyInternal()); + if(_EnteralFormula is not null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)_EnteralFormula.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1609,146 +1557,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutritionOrder; - if(otherT == null) return false; + if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(InstantiatesElement, otherT.InstantiatesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateTimeElement, otherT.DateTimeElement)) return false; - if(!comparer.Equals(Orderer, otherT.Orderer)) return false; - if(!comparer.ListEquals(AllergyIntolerance, otherT.AllergyIntolerance)) return false; - if(!comparer.ListEquals(FoodPreferenceModifier, otherT.FoodPreferenceModifier)) return false; - if(!comparer.ListEquals(ExcludeFoodModifier, otherT.ExcludeFoodModifier)) return false; - if(!comparer.Equals(OralDiet, otherT.OralDiet)) return false; - if(!comparer.ListEquals(Supplement, otherT.Supplement)) return false; - if(!comparer.Equals(EnteralFormula, otherT.EnteralFormula)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateTimeElement, otherT._DateTimeElement)) return false; + if(!comparer.Equals(_Orderer, otherT._Orderer)) return false; + if(!comparer.ListEquals(_AllergyIntolerance, otherT._AllergyIntolerance)) return false; + if(!comparer.ListEquals(_FoodPreferenceModifier, otherT._FoodPreferenceModifier)) return false; + if(!comparer.ListEquals(_ExcludeFoodModifier, otherT._ExcludeFoodModifier)) return false; + if(!comparer.Equals(_OralDiet, otherT._OralDiet)) return false; + if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; + if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "instantiates": - value = InstantiatesElement; - return InstantiatesElement?.Any() == true; + value = _InstantiatesElement; + return _InstantiatesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "dateTime": - value = DateTimeElement; - return DateTimeElement is not null; + value = _DateTimeElement; + return _DateTimeElement is not null; case "orderer": - value = Orderer; - return Orderer is not null; + value = _Orderer; + return _Orderer is not null; case "allergyIntolerance": - value = AllergyIntolerance; - return AllergyIntolerance?.Any() == true; + value = _AllergyIntolerance; + return _AllergyIntolerance?.Any() == true; case "foodPreferenceModifier": - value = FoodPreferenceModifier; - return FoodPreferenceModifier?.Any() == true; + value = _FoodPreferenceModifier; + return _FoodPreferenceModifier?.Any() == true; case "excludeFoodModifier": - value = ExcludeFoodModifier; - return ExcludeFoodModifier?.Any() == true; + value = _ExcludeFoodModifier; + return _ExcludeFoodModifier?.Any() == true; case "oralDiet": - value = OralDiet; - return OralDiet is not null; + value = _OralDiet; + return _OralDiet is not null; case "supplement": - value = Supplement; - return Supplement?.Any() == true; + value = _Supplement; + return _Supplement?.Any() == true; case "enteralFormula": - value = EnteralFormula; - return EnteralFormula is not null; + value = _EnteralFormula; + return _EnteralFormula is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "instantiates": - InstantiatesElement = (List)value; + InstantiatesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateTime": - DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "orderer": - Orderer = (Hl7.Fhir.Model.ResourceReference)value; + Orderer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "allergyIntolerance": - AllergyIntolerance = (List)value; + AllergyIntolerance = (List?)value!; return this; case "foodPreferenceModifier": - FoodPreferenceModifier = (List)value; + FoodPreferenceModifier = (List?)value!; return this; case "excludeFoodModifier": - ExcludeFoodModifier = (List)value; + ExcludeFoodModifier = (List?)value!; return this; case "oralDiet": - OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)value; + OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent?)value; return this; case "supplement": - Supplement = (List)value; + Supplement = (List?)value!; return this; case "enteralFormula": - EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)value; + EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1759,23 +1707,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",InstantiatesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateTimeElement is not null) yield return new KeyValuePair("dateTime",DateTimeElement); - if (Orderer is not null) yield return new KeyValuePair("orderer",Orderer); - if (AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",AllergyIntolerance); - if (FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",FoodPreferenceModifier); - if (ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",ExcludeFoodModifier); - if (OralDiet is not null) yield return new KeyValuePair("oralDiet",OralDiet); - if (Supplement?.Any() == true) yield return new KeyValuePair("supplement",Supplement); - if (EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",EnteralFormula); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",_InstantiatesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateTimeElement is not null) yield return new KeyValuePair("dateTime",_DateTimeElement); + if (_Orderer is not null) yield return new KeyValuePair("orderer",_Orderer); + if (_AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",_AllergyIntolerance); + if (_FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",_FoodPreferenceModifier); + if (_ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",_ExcludeFoodModifier); + if (_OralDiet is not null) yield return new KeyValuePair("oralDiet",_OralDiet); + if (_Supplement?.Any() == true) yield return new KeyValuePair("supplement",_Supplement); + if (_EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",_EnteralFormula); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Observation.cs b/src/Hl7.Fhir.R4/Model/Generated/Observation.cs index 42eca7b19..dc045b88c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Observation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Observation","http://hl7.org/fhir/StructureDefinition/Observation")] - public partial class Observation : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Observation : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -82,26 +85,26 @@ public partial class ReferenceRangeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("low", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Low + public Hl7.Fhir.Model.Quantity? Low { get { return _Low; } set { _Low = value; OnPropertyChanged("Low"); } } - private Hl7.Fhir.Model.Quantity _Low; + private Hl7.Fhir.Model.Quantity? _Low; /// /// High Range, if relevant. /// [FhirElement("high", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity High + public Hl7.Fhir.Model.Quantity? High { get { return _High; } set { _High = value; OnPropertyChanged("High"); } } - private Hl7.Fhir.Model.Quantity _High; + private Hl7.Fhir.Model.Quantity? _High; /// /// Reference range qualifier. @@ -109,13 +112,13 @@ public Hl7.Fhir.Model.Quantity High [FhirElement("type", Order=60)] [Binding("ObservationRangeMeaning")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Reference range population. @@ -126,72 +129,65 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List AppliesTo { - get { if(_AppliesTo==null) _AppliesTo = new List(); return _AppliesTo; } + get => _AppliesTo ?? new List(); set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } - private List _AppliesTo; + private List? _AppliesTo; /// /// Applicable age range, if relevant. /// [FhirElement("age", Order=80)] [DataMember] - public Hl7.Fhir.Model.Range Age + public Hl7.Fhir.Model.Range? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.Range _Age; + private Hl7.Fhir.Model.Range? _Age; /// /// Text based reference range in an observation. /// [FhirElement("text", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text based reference range in an observation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceRangeComponent; - - if (dest == null) - { + if(other is not ReferenceRangeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Low != null) dest.Low = (Hl7.Fhir.Model.Quantity)Low.DeepCopyInternal(); - if(High != null) dest.High = (Hl7.Fhir.Model.Quantity)High.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AppliesTo.Any()) dest.AppliesTo = new List(AppliesTo.DeepCopyInternal()); - if(Age != null) dest.Age = (Hl7.Fhir.Model.Range)Age.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Low is not null) dest.Low = (Hl7.Fhir.Model.Quantity)_Low.DeepCopyInternal(); + if(_High is not null) dest.High = (Hl7.Fhir.Model.Quantity)_High.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AppliesTo is not null) dest.AppliesTo = new List(_AppliesTo.DeepCopyInternal()); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.Range)_Age.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -203,69 +199,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceRangeComponent; - if(otherT == null) return false; + if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Low, otherT.Low)) return false; - if(!comparer.Equals(High, otherT.High)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(AppliesTo, otherT.AppliesTo)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + if(!comparer.Equals(_High, otherT._High)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "low": - value = Low; - return Low is not null; + value = _Low; + return _Low is not null; case "high": - value = High; - return High is not null; + value = _High; + return _High is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "appliesTo": - value = AppliesTo; - return AppliesTo?.Any() == true; + value = _AppliesTo; + return _AppliesTo?.Any() == true; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "low": - Low = (Hl7.Fhir.Model.Quantity)value; + Low = (Hl7.Fhir.Model.Quantity?)value; return this; case "high": - High = (Hl7.Fhir.Model.Quantity)value; + High = (Hl7.Fhir.Model.Quantity?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "appliesTo": - AppliesTo = (List)value; + AppliesTo = (List?)value!; return this; case "age": - Age = (Hl7.Fhir.Model.Range)value; + Age = (Hl7.Fhir.Model.Range?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -276,12 +272,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Low is not null) yield return new KeyValuePair("low",Low); - if (High is not null) yield return new KeyValuePair("high",High); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",AppliesTo); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Low is not null) yield return new KeyValuePair("low",_Low); + if (_High is not null) yield return new KeyValuePair("high",_High); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",_AppliesTo); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -310,13 +306,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Actual component result. @@ -325,13 +321,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the component result is missing. @@ -339,13 +335,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=60)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -356,11 +352,11 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [DataMember] public List Interpretation { - get { if(_Interpretation==null) _Interpretation = new List(); return _Interpretation; } + get => _Interpretation ?? new List(); set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private List _Interpretation; + private List? _Interpretation; /// /// Provides guide for interpretation of component result. @@ -370,27 +366,23 @@ public List Interpretation [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation.Any()) dest.Interpretation = new List(Interpretation.DeepCopyInternal()); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = new List(_Interpretation.DeepCopyInternal()); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -402,62 +394,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.ListEquals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation?.Any() == true; + value = _Interpretation; + return _Interpretation?.Any() == true; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (List)value; + Interpretation = (List?)value!; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; default: return base.SetValue(key, value); @@ -468,11 +460,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",Interpretation); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",_Interpretation); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); } } @@ -485,11 +477,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -501,11 +493,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -517,11 +509,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// registered | preliminary | final | amended +. @@ -531,13 +523,13 @@ public List PartOf [Binding("ObservationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -546,13 +538,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -566,11 +555,11 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of observation (code / type). @@ -579,13 +568,13 @@ public List Category [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who and/or what the observation is about. @@ -594,13 +583,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// What the observation is about, when it is not about the subject of record. @@ -612,11 +601,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Healthcare event during which this observation is made. @@ -625,13 +614,13 @@ public List Focus [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Clinically relevant time/time-period for observation. @@ -640,26 +629,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Instant))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// Date/Time this version was made available. /// [FhirElement("issued", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// Date/Time this version was made available @@ -668,13 +657,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -689,11 +675,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Actual result. @@ -702,13 +688,13 @@ public List Performer [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the result is missing. @@ -716,13 +702,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=220)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -733,11 +719,11 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [DataMember] public List Interpretation { - get { if(_Interpretation==null) _Interpretation = new List(); return _Interpretation; } + get => _Interpretation ?? new List(); set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private List _Interpretation; + private List? _Interpretation; /// /// Comments about the observation. @@ -747,11 +733,11 @@ public List Interpretation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Observed body part. @@ -759,13 +745,13 @@ public List Note [FhirElement("bodySite", Order=250)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// How it was done. @@ -773,13 +759,13 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [FhirElement("method", Order=260)] [Binding("ObservationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Specimen used for this observation. @@ -788,13 +774,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [CLSCompliant(false)] [References("Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// (Measurement) Device. @@ -803,13 +789,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Provides guide for interpretation. @@ -819,11 +805,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; /// /// Related resource that belongs to the Observation group. @@ -835,11 +821,11 @@ public List ReferenceRange [DataMember] public List HasMember { - get { if(_HasMember==null) _HasMember = new List(); return _HasMember; } + get => _HasMember ?? new List(); set { _HasMember = value; OnPropertyChanged("HasMember"); } } - private List _HasMember; + private List? _HasMember; /// /// Related measurements the observation is made from. @@ -851,11 +837,11 @@ public List HasMember [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// Component results. @@ -865,51 +851,47 @@ public List DerivedFrom [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Observation; - - if (dest == null) - { + if(other is not Observation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation.Any()) dest.Interpretation = new List(Interpretation.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); - if(HasMember.Any()) dest.HasMember = new List(HasMember.DeepCopyInternal()); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = new List(_Interpretation.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); + if(_HasMember is not null) dest.HasMember = new List(_HasMember.DeepCopyInternal()); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -921,195 +903,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Observation; - if(otherT == null) return false; + if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.ListEquals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; - if(!comparer.ListEquals(HasMember, otherT.HasMember)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; + if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation?.Any() == true; + value = _Interpretation; + return _Interpretation?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; case "hasMember": - value = HasMember; - return HasMember?.Any() == true; + value = _HasMember; + return _HasMember?.Any() == true; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (List)value; + Interpretation = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; case "hasMember": - HasMember = (List)value; + HasMember = (List?)value!; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1120,30 +1102,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",Interpretation); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); - if (HasMember?.Any() == true) yield return new KeyValuePair("hasMember",HasMember); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",_Interpretation); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); + if (_HasMember?.Any() == true) yield return new KeyValuePair("hasMember",_HasMember); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs index bdf554b25..3611fbede 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ObservationDefinition","http://hl7.org/fhir/StructureDefinition/ObservationDefinition")] - public partial class ObservationDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class ObservationDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -186,13 +189,13 @@ public partial class QuantitativeDetailsComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("customaryUnit", Order=40)] [Binding("ObservationUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CustomaryUnit + public Hl7.Fhir.Model.CodeableConcept? CustomaryUnit { get { return _CustomaryUnit; } set { _CustomaryUnit = value; OnPropertyChanged("CustomaryUnit"); } } - private Hl7.Fhir.Model.CodeableConcept _CustomaryUnit; + private Hl7.Fhir.Model.CodeableConcept? _CustomaryUnit; /// /// SI unit for quantitative results. @@ -200,26 +203,26 @@ public Hl7.Fhir.Model.CodeableConcept CustomaryUnit [FhirElement("unit", Order=50)] [Binding("ObservationUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// SI to Customary unit conversion factor. /// [FhirElement("conversionFactor", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ConversionFactorElement + public Hl7.Fhir.Model.FhirDecimal? ConversionFactorElement { get { return _ConversionFactorElement; } set { _ConversionFactorElement = value; OnPropertyChanged("ConversionFactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ConversionFactorElement; + private Hl7.Fhir.Model.FhirDecimal? _ConversionFactorElement; /// /// SI to Customary unit conversion factor @@ -228,13 +231,10 @@ public Hl7.Fhir.Model.FhirDecimal ConversionFactorElement [IgnoreDataMember] public decimal? ConversionFactor { - get { return ConversionFactorElement != null ? ConversionFactorElement.Value : null; } + get => _ConversionFactorElement?.Value; set { - if (value == null) - ConversionFactorElement = null; - else - ConversionFactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + ConversionFactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("ConversionFactor"); } } @@ -244,13 +244,13 @@ public decimal? ConversionFactor /// [FhirElement("decimalPrecision", Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer DecimalPrecisionElement + public Hl7.Fhir.Model.Integer? DecimalPrecisionElement { get { return _DecimalPrecisionElement; } set { _DecimalPrecisionElement = value; OnPropertyChanged("DecimalPrecisionElement"); } } - private Hl7.Fhir.Model.Integer _DecimalPrecisionElement; + private Hl7.Fhir.Model.Integer? _DecimalPrecisionElement; /// /// Decimal precision of observation quantitative results @@ -259,31 +259,24 @@ public Hl7.Fhir.Model.Integer DecimalPrecisionElement [IgnoreDataMember] public int? DecimalPrecision { - get { return DecimalPrecisionElement != null ? DecimalPrecisionElement.Value : null; } + get => _DecimalPrecisionElement?.Value; set { - if (value == null) - DecimalPrecisionElement = null; - else - DecimalPrecisionElement = new Hl7.Fhir.Model.Integer(value); + DecimalPrecisionElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("DecimalPrecision"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QuantitativeDetailsComponent; - - if (dest == null) - { + if(other is not QuantitativeDetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CustomaryUnit != null) dest.CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept)CustomaryUnit.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(ConversionFactorElement != null) dest.ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal)ConversionFactorElement.DeepCopyInternal(); - if(DecimalPrecisionElement != null) dest.DecimalPrecisionElement = (Hl7.Fhir.Model.Integer)DecimalPrecisionElement.DeepCopyInternal(); + if(_CustomaryUnit is not null) dest.CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept)_CustomaryUnit.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_ConversionFactorElement is not null) dest.ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal)_ConversionFactorElement.DeepCopyInternal(); + if(_DecimalPrecisionElement is not null) dest.DecimalPrecisionElement = (Hl7.Fhir.Model.Integer)_DecimalPrecisionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -295,55 +288,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QuantitativeDetailsComponent; - if(otherT == null) return false; + if(other is not QuantitativeDetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CustomaryUnit, otherT.CustomaryUnit)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(ConversionFactorElement, otherT.ConversionFactorElement)) return false; - if(!comparer.Equals(DecimalPrecisionElement, otherT.DecimalPrecisionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CustomaryUnit, otherT._CustomaryUnit)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_ConversionFactorElement, otherT._ConversionFactorElement)) return false; + if(!comparer.Equals(_DecimalPrecisionElement, otherT._DecimalPrecisionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "customaryUnit": - value = CustomaryUnit; - return CustomaryUnit is not null; + value = _CustomaryUnit; + return _CustomaryUnit is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "conversionFactor": - value = ConversionFactorElement; - return ConversionFactorElement is not null; + value = _ConversionFactorElement; + return _ConversionFactorElement is not null; case "decimalPrecision": - value = DecimalPrecisionElement; - return DecimalPrecisionElement is not null; + value = _DecimalPrecisionElement; + return _DecimalPrecisionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "customaryUnit": - CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept)value; + CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "conversionFactor": - ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "decimalPrecision": - DecimalPrecisionElement = (Hl7.Fhir.Model.Integer)value; + DecimalPrecisionElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -354,10 +347,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CustomaryUnit is not null) yield return new KeyValuePair("customaryUnit",CustomaryUnit); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (ConversionFactorElement is not null) yield return new KeyValuePair("conversionFactor",ConversionFactorElement); - if (DecimalPrecisionElement is not null) yield return new KeyValuePair("decimalPrecision",DecimalPrecisionElement); + if (_CustomaryUnit is not null) yield return new KeyValuePair("customaryUnit",_CustomaryUnit); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_ConversionFactorElement is not null) yield return new KeyValuePair("conversionFactor",_ConversionFactorElement); + if (_DecimalPrecisionElement is not null) yield return new KeyValuePair("decimalPrecision",_DecimalPrecisionElement); } } @@ -385,13 +378,13 @@ public partial class QualifiedIntervalComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ObservationRangeCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// reference | critical | absolute @@ -400,13 +393,10 @@ public Code Categ [IgnoreDataMember] public Hl7.Fhir.Model.ObservationDefinition.ObservationRangeCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -416,13 +406,13 @@ public Hl7.Fhir.Model.ObservationDefinition.ObservationRangeCategory? Category /// [FhirElement("range", Order=50)] [DataMember] - public Hl7.Fhir.Model.Range Range + public Hl7.Fhir.Model.Range? Range { get { return _Range; } set { _Range = value; OnPropertyChanged("Range"); } } - private Hl7.Fhir.Model.Range _Range; + private Hl7.Fhir.Model.Range? _Range; /// /// Range context qualifier. @@ -430,13 +420,13 @@ public Hl7.Fhir.Model.Range Range [FhirElement("context", Order=60)] [Binding("ObservationRangeMeaning")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Context + public Hl7.Fhir.Model.CodeableConcept? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.CodeableConcept _Context; + private Hl7.Fhir.Model.CodeableConcept? _Context; /// /// Targetted population of the range. @@ -447,11 +437,11 @@ public Hl7.Fhir.Model.CodeableConcept Context [DataMember] public List AppliesTo { - get { if(_AppliesTo==null) _AppliesTo = new List(); return _AppliesTo; } + get => _AppliesTo ?? new List(); set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } - private List _AppliesTo; + private List? _AppliesTo; /// /// male | female | other | unknown. @@ -460,13 +450,13 @@ public List AppliesTo [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -475,13 +465,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -491,76 +478,69 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("age", Order=90)] [DataMember] - public Hl7.Fhir.Model.Range Age + public Hl7.Fhir.Model.Range? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.Range _Age; + private Hl7.Fhir.Model.Range? _Age; /// /// Applicable gestational age range, if relevant. /// [FhirElement("gestationalAge", Order=100)] [DataMember] - public Hl7.Fhir.Model.Range GestationalAge + public Hl7.Fhir.Model.Range? GestationalAge { get { return _GestationalAge; } set { _GestationalAge = value; OnPropertyChanged("GestationalAge"); } } - private Hl7.Fhir.Model.Range _GestationalAge; + private Hl7.Fhir.Model.Range? _GestationalAge; /// /// Condition associated with the reference range. /// [FhirElement("condition", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// Condition associated with the reference range /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QualifiedIntervalComponent; - - if (dest == null) - { + if(other is not QualifiedIntervalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(Range != null) dest.Range = (Hl7.Fhir.Model.Range)Range.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.CodeableConcept)Context.DeepCopyInternal(); - if(AppliesTo.Any()) dest.AppliesTo = new List(AppliesTo.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Age != null) dest.Age = (Hl7.Fhir.Model.Range)Age.DeepCopyInternal(); - if(GestationalAge != null) dest.GestationalAge = (Hl7.Fhir.Model.Range)GestationalAge.DeepCopyInternal(); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_Range is not null) dest.Range = (Hl7.Fhir.Model.Range)_Range.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.CodeableConcept)_Context.DeepCopyInternal(); + if(_AppliesTo is not null) dest.AppliesTo = new List(_AppliesTo.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.Range)_Age.DeepCopyInternal(); + if(_GestationalAge is not null) dest.GestationalAge = (Hl7.Fhir.Model.Range)_GestationalAge.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -572,83 +552,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualifiedIntervalComponent; - if(otherT == null) return false; + if(other is not QualifiedIntervalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(Range, otherT.Range)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(AppliesTo, otherT.AppliesTo)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(GestationalAge, otherT.GestationalAge)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_Range, otherT._Range)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_GestationalAge, otherT._GestationalAge)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "range": - value = Range; - return Range is not null; + value = _Range; + return _Range is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "appliesTo": - value = AppliesTo; - return AppliesTo?.Any() == true; + value = _AppliesTo; + return _AppliesTo?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "gestationalAge": - value = GestationalAge; - return GestationalAge is not null; + value = _GestationalAge; + return _GestationalAge is not null; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "range": - Range = (Hl7.Fhir.Model.Range)value; + Range = (Hl7.Fhir.Model.Range?)value; return this; case "context": - Context = (Hl7.Fhir.Model.CodeableConcept)value; + Context = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "appliesTo": - AppliesTo = (List)value; + AppliesTo = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "age": - Age = (Hl7.Fhir.Model.Range)value; + Age = (Hl7.Fhir.Model.Range?)value; return this; case "gestationalAge": - GestationalAge = (Hl7.Fhir.Model.Range)value; + GestationalAge = (Hl7.Fhir.Model.Range?)value; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -659,14 +639,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (Range is not null) yield return new KeyValuePair("range",Range); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",AppliesTo); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (GestationalAge is not null) yield return new KeyValuePair("gestationalAge",GestationalAge); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_Range is not null) yield return new KeyValuePair("range",_Range); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",_AppliesTo); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_GestationalAge is not null) yield return new KeyValuePair("gestationalAge",_GestationalAge); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); } } @@ -680,11 +660,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of observation (code / type). @@ -693,13 +673,13 @@ public List Category [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Business identifier for this ObservationDefinition instance. @@ -709,11 +689,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period. @@ -725,24 +705,24 @@ public List Identifier [DataMember] public List> PermittedDataTypeElement { - get { if(_PermittedDataTypeElement==null) _PermittedDataTypeElement = new List>(); return _PermittedDataTypeElement; } + get => _PermittedDataTypeElement ?? new List>(); set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } - private List> _PermittedDataTypeElement; + private List>? _PermittedDataTypeElement; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PermittedDataType + public IEnumerable? PermittedDataType { - get { return PermittedDataTypeElement != null ? PermittedDataTypeElement.Select(elem => elem.Value) : null; } + get => _PermittedDataTypeElement?.Select(elem => elem.Value); set { if (value == null) - PermittedDataTypeElement = null; + PermittedDataTypeElement = null!; else PermittedDataTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("PermittedDataType"); @@ -754,13 +734,13 @@ public IEnumerable Pe /// [FhirElement("multipleResultsAllowed", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleResultsAllowedElement + public Hl7.Fhir.Model.FhirBoolean? MultipleResultsAllowedElement { get { return _MultipleResultsAllowedElement; } set { _MultipleResultsAllowedElement = value; OnPropertyChanged("MultipleResultsAllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleResultsAllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleResultsAllowedElement; /// /// Multiple results allowed @@ -769,13 +749,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleResultsAllowedElement [IgnoreDataMember] public bool? MultipleResultsAllowed { - get { return MultipleResultsAllowedElement != null ? MultipleResultsAllowedElement.Value : null; } + get => _MultipleResultsAllowedElement?.Value; set { - if (value == null) - MultipleResultsAllowedElement = null; - else - MultipleResultsAllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleResultsAllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleResultsAllowed"); } } @@ -786,41 +763,38 @@ public bool? MultipleResultsAllowed [FhirElement("method", Order=140)] [Binding("ObservationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Preferred report name. /// [FhirElement("preferredReportName", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString PreferredReportNameElement + public Hl7.Fhir.Model.FhirString? PreferredReportNameElement { get { return _PreferredReportNameElement; } set { _PreferredReportNameElement = value; OnPropertyChanged("PreferredReportNameElement"); } } - private Hl7.Fhir.Model.FhirString _PreferredReportNameElement; + private Hl7.Fhir.Model.FhirString? _PreferredReportNameElement; /// /// Preferred report name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreferredReportName + public string? PreferredReportName { - get { return PreferredReportNameElement != null ? PreferredReportNameElement.Value : null; } + get => _PreferredReportNameElement?.Value; set { - if (value == null) - PreferredReportNameElement = null; - else - PreferredReportNameElement = new Hl7.Fhir.Model.FhirString(value); + PreferredReportNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreferredReportName"); } } @@ -830,13 +804,13 @@ public string PreferredReportName /// [FhirElement("quantitativeDetails", Order=160)] [DataMember] - public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent QuantitativeDetails + public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent? QuantitativeDetails { get { return _QuantitativeDetails; } set { _QuantitativeDetails = value; OnPropertyChanged("QuantitativeDetails"); } } - private Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent _QuantitativeDetails; + private Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent? _QuantitativeDetails; /// /// Qualified range for continuous and ordinal observation results. @@ -846,11 +820,11 @@ public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent Quantit [DataMember] public List QualifiedInterval { - get { if(_QualifiedInterval==null) _QualifiedInterval = new List(); return _QualifiedInterval; } + get => _QualifiedInterval ?? new List(); set { _QualifiedInterval = value; OnPropertyChanged("QualifiedInterval"); } } - private List _QualifiedInterval; + private List? _QualifiedInterval; /// /// Value set of valid coded values for the observations conforming to this ObservationDefinition. @@ -859,13 +833,13 @@ public List Qua [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ValidCodedValueSet + public Hl7.Fhir.Model.ResourceReference? ValidCodedValueSet { get { return _ValidCodedValueSet; } set { _ValidCodedValueSet = value; OnPropertyChanged("ValidCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _ValidCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _ValidCodedValueSet; /// /// Value set of normal coded values for the observations conforming to this ObservationDefinition. @@ -874,13 +848,13 @@ public Hl7.Fhir.Model.ResourceReference ValidCodedValueSet [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference NormalCodedValueSet + public Hl7.Fhir.Model.ResourceReference? NormalCodedValueSet { get { return _NormalCodedValueSet; } set { _NormalCodedValueSet = value; OnPropertyChanged("NormalCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _NormalCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _NormalCodedValueSet; /// /// Value set of abnormal coded values for the observations conforming to this ObservationDefinition. @@ -889,13 +863,13 @@ public Hl7.Fhir.Model.ResourceReference NormalCodedValueSet [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference AbnormalCodedValueSet + public Hl7.Fhir.Model.ResourceReference? AbnormalCodedValueSet { get { return _AbnormalCodedValueSet; } set { _AbnormalCodedValueSet = value; OnPropertyChanged("AbnormalCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _AbnormalCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _AbnormalCodedValueSet; /// /// Value set of critical coded values for the observations conforming to this ObservationDefinition. @@ -904,42 +878,38 @@ public Hl7.Fhir.Model.ResourceReference AbnormalCodedValueSet [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CriticalCodedValueSet + public Hl7.Fhir.Model.ResourceReference? CriticalCodedValueSet { get { return _CriticalCodedValueSet; } set { _CriticalCodedValueSet = value; OnPropertyChanged("CriticalCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _CriticalCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _CriticalCodedValueSet; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as ObservationDefinition; - - if (dest == null) - { + if(other is not ObservationDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(PermittedDataTypeElement.Any()) dest.PermittedDataTypeElement = new List>(PermittedDataTypeElement.DeepCopyInternal()); - if(MultipleResultsAllowedElement != null) dest.MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)MultipleResultsAllowedElement.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(PreferredReportNameElement != null) dest.PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)PreferredReportNameElement.DeepCopyInternal(); - if(QuantitativeDetails != null) dest.QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent)QuantitativeDetails.DeepCopyInternal(); - if(QualifiedInterval.Any()) dest.QualifiedInterval = new List(QualifiedInterval.DeepCopyInternal()); - if(ValidCodedValueSet != null) dest.ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference)ValidCodedValueSet.DeepCopyInternal(); - if(NormalCodedValueSet != null) dest.NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)NormalCodedValueSet.DeepCopyInternal(); - if(AbnormalCodedValueSet != null) dest.AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)AbnormalCodedValueSet.DeepCopyInternal(); - if(CriticalCodedValueSet != null) dest.CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)CriticalCodedValueSet.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_PermittedDataTypeElement is not null) dest.PermittedDataTypeElement = new List>(_PermittedDataTypeElement.DeepCopyInternal()); + if(_MultipleResultsAllowedElement is not null) dest.MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleResultsAllowedElement.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_PreferredReportNameElement is not null) dest.PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)_PreferredReportNameElement.DeepCopyInternal(); + if(_QuantitativeDetails is not null) dest.QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent)_QuantitativeDetails.DeepCopyInternal(); + if(_QualifiedInterval is not null) dest.QualifiedInterval = new List(_QualifiedInterval.DeepCopyInternal()); + if(_ValidCodedValueSet is not null) dest.ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_ValidCodedValueSet.DeepCopyInternal(); + if(_NormalCodedValueSet is not null) dest.NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_NormalCodedValueSet.DeepCopyInternal(); + if(_AbnormalCodedValueSet is not null) dest.AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_AbnormalCodedValueSet.DeepCopyInternal(); + if(_CriticalCodedValueSet is not null) dest.CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_CriticalCodedValueSet.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -951,118 +921,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ObservationDefinition; - if(otherT == null) return false; + if(other is not ObservationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(PermittedDataTypeElement, otherT.PermittedDataTypeElement)) return false; - if(!comparer.Equals(MultipleResultsAllowedElement, otherT.MultipleResultsAllowedElement)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(PreferredReportNameElement, otherT.PreferredReportNameElement)) return false; - if(!comparer.Equals(QuantitativeDetails, otherT.QuantitativeDetails)) return false; - if(!comparer.ListEquals(QualifiedInterval, otherT.QualifiedInterval)) return false; - if(!comparer.Equals(ValidCodedValueSet, otherT.ValidCodedValueSet)) return false; - if(!comparer.Equals(NormalCodedValueSet, otherT.NormalCodedValueSet)) return false; - if(!comparer.Equals(AbnormalCodedValueSet, otherT.AbnormalCodedValueSet)) return false; - if(!comparer.Equals(CriticalCodedValueSet, otherT.CriticalCodedValueSet)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_PermittedDataTypeElement, otherT._PermittedDataTypeElement)) return false; + if(!comparer.Equals(_MultipleResultsAllowedElement, otherT._MultipleResultsAllowedElement)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_PreferredReportNameElement, otherT._PreferredReportNameElement)) return false; + if(!comparer.Equals(_QuantitativeDetails, otherT._QuantitativeDetails)) return false; + if(!comparer.ListEquals(_QualifiedInterval, otherT._QualifiedInterval)) return false; + if(!comparer.Equals(_ValidCodedValueSet, otherT._ValidCodedValueSet)) return false; + if(!comparer.Equals(_NormalCodedValueSet, otherT._NormalCodedValueSet)) return false; + if(!comparer.Equals(_AbnormalCodedValueSet, otherT._AbnormalCodedValueSet)) return false; + if(!comparer.Equals(_CriticalCodedValueSet, otherT._CriticalCodedValueSet)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "permittedDataType": - value = PermittedDataTypeElement; - return PermittedDataTypeElement?.Any() == true; + value = _PermittedDataTypeElement; + return _PermittedDataTypeElement?.Any() == true; case "multipleResultsAllowed": - value = MultipleResultsAllowedElement; - return MultipleResultsAllowedElement is not null; + value = _MultipleResultsAllowedElement; + return _MultipleResultsAllowedElement is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "preferredReportName": - value = PreferredReportNameElement; - return PreferredReportNameElement is not null; + value = _PreferredReportNameElement; + return _PreferredReportNameElement is not null; case "quantitativeDetails": - value = QuantitativeDetails; - return QuantitativeDetails is not null; + value = _QuantitativeDetails; + return _QuantitativeDetails is not null; case "qualifiedInterval": - value = QualifiedInterval; - return QualifiedInterval?.Any() == true; + value = _QualifiedInterval; + return _QualifiedInterval?.Any() == true; case "validCodedValueSet": - value = ValidCodedValueSet; - return ValidCodedValueSet is not null; + value = _ValidCodedValueSet; + return _ValidCodedValueSet is not null; case "normalCodedValueSet": - value = NormalCodedValueSet; - return NormalCodedValueSet is not null; + value = _NormalCodedValueSet; + return _NormalCodedValueSet is not null; case "abnormalCodedValueSet": - value = AbnormalCodedValueSet; - return AbnormalCodedValueSet is not null; + value = _AbnormalCodedValueSet; + return _AbnormalCodedValueSet is not null; case "criticalCodedValueSet": - value = CriticalCodedValueSet; - return CriticalCodedValueSet is not null; + value = _CriticalCodedValueSet; + return _CriticalCodedValueSet is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "permittedDataType": - PermittedDataTypeElement = (List>)value; + PermittedDataTypeElement = (List>?)value!; return this; case "multipleResultsAllowed": - MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferredReportName": - PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)value; + PreferredReportNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quantitativeDetails": - QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent)value; + QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent?)value; return this; case "qualifiedInterval": - QualifiedInterval = (List)value; + QualifiedInterval = (List?)value!; return this; case "validCodedValueSet": - ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "normalCodedValueSet": - NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "abnormalCodedValueSet": - AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "criticalCodedValueSet": - CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1073,19 +1043,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",PermittedDataTypeElement); - if (MultipleResultsAllowedElement is not null) yield return new KeyValuePair("multipleResultsAllowed",MultipleResultsAllowedElement); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (PreferredReportNameElement is not null) yield return new KeyValuePair("preferredReportName",PreferredReportNameElement); - if (QuantitativeDetails is not null) yield return new KeyValuePair("quantitativeDetails",QuantitativeDetails); - if (QualifiedInterval?.Any() == true) yield return new KeyValuePair("qualifiedInterval",QualifiedInterval); - if (ValidCodedValueSet is not null) yield return new KeyValuePair("validCodedValueSet",ValidCodedValueSet); - if (NormalCodedValueSet is not null) yield return new KeyValuePair("normalCodedValueSet",NormalCodedValueSet); - if (AbnormalCodedValueSet is not null) yield return new KeyValuePair("abnormalCodedValueSet",AbnormalCodedValueSet); - if (CriticalCodedValueSet is not null) yield return new KeyValuePair("criticalCodedValueSet",CriticalCodedValueSet); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",_PermittedDataTypeElement); + if (_MultipleResultsAllowedElement is not null) yield return new KeyValuePair("multipleResultsAllowed",_MultipleResultsAllowedElement); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_PreferredReportNameElement is not null) yield return new KeyValuePair("preferredReportName",_PreferredReportNameElement); + if (_QuantitativeDetails is not null) yield return new KeyValuePair("quantitativeDetails",_QuantitativeDetails); + if (_QualifiedInterval?.Any() == true) yield return new KeyValuePair("qualifiedInterval",_QualifiedInterval); + if (_ValidCodedValueSet is not null) yield return new KeyValuePair("validCodedValueSet",_ValidCodedValueSet); + if (_NormalCodedValueSet is not null) yield return new KeyValuePair("normalCodedValueSet",_NormalCodedValueSet); + if (_AbnormalCodedValueSet is not null) yield return new KeyValuePair("abnormalCodedValueSet",_AbnormalCodedValueSet); + if (_CriticalCodedValueSet is not null) yield return new KeyValuePair("criticalCodedValueSet",_CriticalCodedValueSet); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs index ccbb1ffe4..a902888cf 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("OperationDefinition","http://hl7.org/fhir/StructureDefinition/OperationDefinition")] - public partial class OperationDefinition : Hl7.Fhir.Model.DomainResource, ICoded + public partial class OperationDefinition : Hl7.Fhir.Model.DomainResource, ICoded { /// /// FHIR Type Name @@ -104,28 +107,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name in Parameters.parameter.name or in URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -138,13 +138,13 @@ public string Name [Binding("OperationParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -153,13 +153,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -170,13 +167,13 @@ public Hl7.Fhir.Model.OperationParameterUse? Use [FhirElement("min", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum Cardinality @@ -185,13 +182,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -202,28 +196,25 @@ public int? Min [FhirElement("max", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum Cardinality (a number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -233,28 +224,25 @@ public string Max /// [FhirElement("documentation", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Description of meaning/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -266,13 +254,13 @@ public string Documentation [DeclaredType(Type = typeof(Code))] [Binding("FHIRAllTypes")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type this parameter has @@ -281,13 +269,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -300,24 +285,24 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List TargetProfileElement { - get { if(_TargetProfileElement==null) _TargetProfileElement = new List(); return _TargetProfileElement; } + get => _TargetProfileElement ?? new List(); set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } - private List _TargetProfileElement; + private List? _TargetProfileElement; /// /// If type is Reference | canonical, allowed targets /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TargetProfile + public IEnumerable? TargetProfile { - get { return TargetProfileElement != null ? TargetProfileElement.Select(elem => elem.Value) : null; } + get => _TargetProfileElement?.Select(elem => elem.Value); set { if (value == null) - TargetProfileElement = null; + TargetProfileElement = null!; else TargetProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("TargetProfile"); @@ -331,13 +316,13 @@ public IEnumerable TargetProfile [DeclaredType(Type = typeof(Code))] [Binding("SearchParamType")] [DataMember] - public Code SearchTypeElement + public Code? SearchTypeElement { get { return _SearchTypeElement; } set { _SearchTypeElement = value; OnPropertyChanged("SearchTypeElement"); } } - private Code _SearchTypeElement; + private Code? _SearchTypeElement; /// /// number | date | string | token | reference | composite | quantity | uri | special @@ -346,13 +331,10 @@ public Code SearchTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? SearchType { - get { return SearchTypeElement != null ? SearchTypeElement.Value : null; } + get => _SearchTypeElement?.Value; set { - if (value == null) - SearchTypeElement = null; - else - SearchTypeElement = new Code(value); + SearchTypeElement = value is null ? null : new Code(value); OnPropertyChanged("SearchType"); } } @@ -362,13 +344,13 @@ public Hl7.Fhir.Model.SearchParamType? SearchType /// [FhirElement("binding", Order=120)] [DataMember] - public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding + public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding { get { return _Binding; } set { _Binding = value; OnPropertyChanged("Binding"); } } - private Hl7.Fhir.Model.OperationDefinition.BindingComponent _Binding; + private Hl7.Fhir.Model.OperationDefinition.BindingComponent? _Binding; /// /// References to this parameter. @@ -378,11 +360,11 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding [DataMember] public List ReferencedFrom { - get { if(_ReferencedFrom==null) _ReferencedFrom = new List(); return _ReferencedFrom; } + get => _ReferencedFrom ?? new List(); set { _ReferencedFrom = value; OnPropertyChanged("ReferencedFrom"); } } - private List _ReferencedFrom; + private List? _ReferencedFrom; /// /// Parts of a nested Parameter. @@ -392,33 +374,29 @@ public List Referenc [DataMember] public List Part { - get { if(_Part==null) _Part = new List(); return _Part; } + get => _Part ?? new List(); set { _Part = value; OnPropertyChanged("Part"); } } - private List _Part; + private List? _Part; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TargetProfileElement.Any()) dest.TargetProfileElement = new List(TargetProfileElement.DeepCopyInternal()); - if(SearchTypeElement != null) dest.SearchTypeElement = (Code)SearchTypeElement.DeepCopyInternal(); - if(Binding != null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)Binding.DeepCopyInternal(); - if(ReferencedFrom.Any()) dest.ReferencedFrom = new List(ReferencedFrom.DeepCopyInternal()); - if(Part.Any()) dest.Part = new List(Part.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TargetProfileElement is not null) dest.TargetProfileElement = new List(_TargetProfileElement.DeepCopyInternal()); + if(_SearchTypeElement is not null) dest.SearchTypeElement = (Code)_SearchTypeElement.DeepCopyInternal(); + if(_Binding is not null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)_Binding.DeepCopyInternal(); + if(_ReferencedFrom is not null) dest.ReferencedFrom = new List(_ReferencedFrom.DeepCopyInternal()); + if(_Part is not null) dest.Part = new List(_Part.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -430,104 +408,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(TargetProfileElement, otherT.TargetProfileElement)) return false; - if(!comparer.Equals(SearchTypeElement, otherT.SearchTypeElement)) return false; - if(!comparer.Equals(Binding, otherT.Binding)) return false; - if(!comparer.ListEquals(ReferencedFrom, otherT.ReferencedFrom)) return false; - if(!comparer.ListEquals(Part, otherT.Part)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_TargetProfileElement, otherT._TargetProfileElement)) return false; + if(!comparer.Equals(_SearchTypeElement, otherT._SearchTypeElement)) return false; + if(!comparer.Equals(_Binding, otherT._Binding)) return false; + if(!comparer.ListEquals(_ReferencedFrom, otherT._ReferencedFrom)) return false; + if(!comparer.ListEquals(_Part, otherT._Part)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "targetProfile": - value = TargetProfileElement; - return TargetProfileElement?.Any() == true; + value = _TargetProfileElement; + return _TargetProfileElement?.Any() == true; case "searchType": - value = SearchTypeElement; - return SearchTypeElement is not null; + value = _SearchTypeElement; + return _SearchTypeElement is not null; case "binding": - value = Binding; - return Binding is not null; + value = _Binding; + return _Binding is not null; case "referencedFrom": - value = ReferencedFrom; - return ReferencedFrom?.Any() == true; + value = _ReferencedFrom; + return _ReferencedFrom?.Any() == true; case "part": - value = Part; - return Part?.Any() == true; + value = _Part; + return _Part?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "targetProfile": - TargetProfileElement = (List)value; + TargetProfileElement = (List?)value!; return this; case "searchType": - SearchTypeElement = (Code)value; + SearchTypeElement = (Code?)value; return this; case "binding": - Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)value; + Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent?)value; return this; case "referencedFrom": - ReferencedFrom = (List)value; + ReferencedFrom = (List?)value!; return this; case "part": - Part = (List)value; + Part = (List?)value!; return this; default: return base.SetValue(key, value); @@ -538,17 +516,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",TargetProfileElement); - if (SearchTypeElement is not null) yield return new KeyValuePair("searchType",SearchTypeElement); - if (Binding is not null) yield return new KeyValuePair("binding",Binding); - if (ReferencedFrom?.Any() == true) yield return new KeyValuePair("referencedFrom",ReferencedFrom); - if (Part?.Any() == true) yield return new KeyValuePair("part",Part); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",_TargetProfileElement); + if (_SearchTypeElement is not null) yield return new KeyValuePair("searchType",_SearchTypeElement); + if (_Binding is not null) yield return new KeyValuePair("binding",_Binding); + if (_ReferencedFrom?.Any() == true) yield return new KeyValuePair("referencedFrom",_ReferencedFrom); + if (_Part?.Any() == true) yield return new KeyValuePair("part",_Part); } } @@ -577,13 +555,13 @@ public partial class BindingComponent : Hl7.Fhir.Model.BackboneElement [Binding("BindingStrength")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StrengthElement + public Code? StrengthElement { get { return _StrengthElement; } set { _StrengthElement = value; OnPropertyChanged("StrengthElement"); } } - private Code _StrengthElement; + private Code? _StrengthElement; /// /// required | extensible | preferred | example @@ -592,13 +570,10 @@ public Code StrengthElement [IgnoreDataMember] public Hl7.Fhir.Model.BindingStrength? Strength { - get { return StrengthElement != null ? StrengthElement.Value : null; } + get => _StrengthElement?.Value; set { - if (value == null) - StrengthElement = null; - else - StrengthElement = new Code(value); + StrengthElement = value is null ? null : new Code(value); OnPropertyChanged("Strength"); } } @@ -609,44 +584,37 @@ public Hl7.Fhir.Model.BindingStrength? Strength [FhirElement("valueSet", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Source of value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BindingComponent; - - if (dest == null) - { + if(other is not BindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StrengthElement != null) dest.StrengthElement = (Code)StrengthElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); + if(_StrengthElement is not null) dest.StrengthElement = (Code)_StrengthElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -658,41 +626,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BindingComponent; - if(otherT == null) return false; + if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StrengthElement, otherT.StrengthElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "strength": - value = StrengthElement; - return StrengthElement is not null; + value = _StrengthElement; + return _StrengthElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "strength": - StrengthElement = (Code)value; + StrengthElement = (Code?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -703,8 +671,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StrengthElement is not null) yield return new KeyValuePair("strength",StrengthElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); + if (_StrengthElement is not null) yield return new KeyValuePair("strength",_StrengthElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); } } @@ -732,28 +700,25 @@ public partial class ReferencedFromComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("source", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// Referencing parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -763,44 +728,37 @@ public string Source /// [FhirElement("sourceId", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceIdElement + public Hl7.Fhir.Model.FhirString? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _SourceIdElement; + private Hl7.Fhir.Model.FhirString? _SourceIdElement; /// /// Element id of reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.FhirString(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferencedFromComponent; - - if (dest == null) - { + if(other is not ReferencedFromComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.FhirString)SourceIdElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.FhirString)_SourceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -812,41 +770,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferencedFromComponent; - if(otherT == null) return false; + if(other is not ReferencedFromComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.FhirString)value; + SourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -857,8 +815,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); } } @@ -888,24 +846,24 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get { if(_ParameterNameElement==null) _ParameterNameElement = new List(); return _ParameterNameElement; } + get => _ParameterNameElement ?? new List(); set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } - private List _ParameterNameElement; + private List? _ParameterNameElement; /// /// Name of parameter to include in overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ParameterName + public IEnumerable? ParameterName { - get { return ParameterNameElement != null ? ParameterNameElement.Select(elem => elem.Value) : null; } + get => _ParameterNameElement?.Select(elem => elem.Value); set { if (value == null) - ParameterNameElement = null; + ParameterNameElement = null!; else ParameterNameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ParameterName"); @@ -917,44 +875,37 @@ public IEnumerable ParameterName /// [FhirElement("comment", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments to go on overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OverloadComponent; - - if (dest == null) - { + if(other is not OverloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ParameterNameElement.Any()) dest.ParameterNameElement = new List(ParameterNameElement.DeepCopyInternal()); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_ParameterNameElement is not null) dest.ParameterNameElement = new List(_ParameterNameElement.DeepCopyInternal()); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -966,41 +917,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OverloadComponent; - if(otherT == null) return false; + if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ParameterNameElement, otherT.ParameterNameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "parameterName": - value = ParameterNameElement; - return ParameterNameElement?.Any() == true; + value = _ParameterNameElement; + return _ParameterNameElement?.Any() == true; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "parameterName": - ParameterNameElement = (List)value; + ParameterNameElement = (List?)value!; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1011,8 +962,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",ParameterNameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",_ParameterNameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -1022,28 +973,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this operation definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1053,28 +1001,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1085,28 +1030,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this operation definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1116,28 +1058,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this operation definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1150,13 +1089,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1165,13 +1104,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1184,13 +1120,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("OperationKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// operation | query @@ -1199,13 +1135,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1215,13 +1148,13 @@ public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1230,13 +1163,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1246,28 +1176,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1277,28 +1204,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1311,39 +1235,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the operation definition. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1356,11 +1277,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for operation definition (if applicable). @@ -1371,39 +1292,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this operation definition is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this operation definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1413,13 +1331,13 @@ public string Purpose /// [FhirElement("affectsState", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AffectsStateElement + public Hl7.Fhir.Model.FhirBoolean? AffectsStateElement { get { return _AffectsStateElement; } set { _AffectsStateElement = value; OnPropertyChanged("AffectsStateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AffectsStateElement; + private Hl7.Fhir.Model.FhirBoolean? _AffectsStateElement; /// /// Whether content is changed by the operation @@ -1428,13 +1346,10 @@ public Hl7.Fhir.Model.FhirBoolean AffectsStateElement [IgnoreDataMember] public bool? AffectsState { - get { return AffectsStateElement != null ? AffectsStateElement.Value : null; } + get => _AffectsStateElement?.Value; set { - if (value == null) - AffectsStateElement = null; - else - AffectsStateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AffectsStateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AffectsState"); } } @@ -1445,28 +1360,25 @@ public bool? AffectsState [FhirElement("code", InSummary=true, Order=240)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Name used to invoke the operation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1476,28 +1388,25 @@ public string Code /// [FhirElement("comment", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Additional information about use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -1507,28 +1416,25 @@ public string Comment /// [FhirElement("base", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.Canonical BaseElement + public Hl7.Fhir.Model.Canonical? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Hl7.Fhir.Model.Canonical _BaseElement; + private Hl7.Fhir.Model.Canonical? _BaseElement; /// /// Marks this as a profile of the base /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Base + public string? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Hl7.Fhir.Model.Canonical(value); + BaseElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Base"); } } @@ -1543,24 +1449,24 @@ public string Base [DataMember] public List> ResourceElement { - get { if(_ResourceElement==null) _ResourceElement = new List>(); return _ResourceElement; } + get => _ResourceElement ?? new List>(); set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private List> _ResourceElement; + private List>? _ResourceElement; /// /// Types this operation applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Resource + public IEnumerable? Resource { - get { return ResourceElement != null ? ResourceElement.Select(elem => elem.Value) : null; } + get => _ResourceElement?.Select(elem => elem.Value); set { if (value == null) - ResourceElement = null; + ResourceElement = null!; else ResourceElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Resource"); @@ -1573,13 +1479,13 @@ public IEnumerable Resource [FhirElement("system", InSummary=true, Order=280)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SystemElement + public Hl7.Fhir.Model.FhirBoolean? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SystemElement; + private Hl7.Fhir.Model.FhirBoolean? _SystemElement; /// /// Invoke at the system level? @@ -1588,13 +1494,10 @@ public Hl7.Fhir.Model.FhirBoolean SystemElement [IgnoreDataMember] public bool? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirBoolean(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("System"); } } @@ -1605,13 +1508,13 @@ public bool? System [FhirElement("type", InSummary=true, Order=290)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TypeElement + public Hl7.Fhir.Model.FhirBoolean? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TypeElement; + private Hl7.Fhir.Model.FhirBoolean? _TypeElement; /// /// Invoke at the type level? @@ -1620,13 +1523,10 @@ public Hl7.Fhir.Model.FhirBoolean TypeElement [IgnoreDataMember] public bool? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirBoolean(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Type"); } } @@ -1637,13 +1537,13 @@ public bool? Type [FhirElement("instance", InSummary=true, Order=300)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InstanceElement + public Hl7.Fhir.Model.FhirBoolean? InstanceElement { get { return _InstanceElement; } set { _InstanceElement = value; OnPropertyChanged("InstanceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InstanceElement; + private Hl7.Fhir.Model.FhirBoolean? _InstanceElement; /// /// Invoke on an instance? @@ -1652,13 +1552,10 @@ public Hl7.Fhir.Model.FhirBoolean InstanceElement [IgnoreDataMember] public bool? Instance { - get { return InstanceElement != null ? InstanceElement.Value : null; } + get => _InstanceElement?.Value; set { - if (value == null) - InstanceElement = null; - else - InstanceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InstanceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Instance"); } } @@ -1668,28 +1565,25 @@ public bool? Instance /// [FhirElement("inputProfile", Order=310)] [DataMember] - public Hl7.Fhir.Model.Canonical InputProfileElement + public Hl7.Fhir.Model.Canonical? InputProfileElement { get { return _InputProfileElement; } set { _InputProfileElement = value; OnPropertyChanged("InputProfileElement"); } } - private Hl7.Fhir.Model.Canonical _InputProfileElement; + private Hl7.Fhir.Model.Canonical? _InputProfileElement; /// /// Validation information for in parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InputProfile + public string? InputProfile { - get { return InputProfileElement != null ? InputProfileElement.Value : null; } + get => _InputProfileElement?.Value; set { - if (value == null) - InputProfileElement = null; - else - InputProfileElement = new Hl7.Fhir.Model.Canonical(value); + InputProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InputProfile"); } } @@ -1699,28 +1593,25 @@ public string InputProfile /// [FhirElement("outputProfile", Order=320)] [DataMember] - public Hl7.Fhir.Model.Canonical OutputProfileElement + public Hl7.Fhir.Model.Canonical? OutputProfileElement { get { return _OutputProfileElement; } set { _OutputProfileElement = value; OnPropertyChanged("OutputProfileElement"); } } - private Hl7.Fhir.Model.Canonical _OutputProfileElement; + private Hl7.Fhir.Model.Canonical? _OutputProfileElement; /// /// Validation information for out parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OutputProfile + public string? OutputProfile { - get { return OutputProfileElement != null ? OutputProfileElement.Value : null; } + get => _OutputProfileElement?.Value; set { - if (value == null) - OutputProfileElement = null; - else - OutputProfileElement = new Hl7.Fhir.Model.Canonical(value); + OutputProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("OutputProfile"); } } @@ -1733,11 +1624,11 @@ public string OutputProfile [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Define overloaded variants for when generating code. @@ -1747,51 +1638,47 @@ public List Parameter [DataMember] public List Overload { - get { if(_Overload==null) _Overload = new List(); return _Overload; } + get => _Overload ?? new List(); set { _Overload = value; OnPropertyChanged("Overload"); } } - private List _Overload; + private List? _Overload; - Hl7.Fhir.Model.Code ICoded.Code { get => CodeElement; set => CodeElement = value; } - IEnumerable ICoded.ToCodings() => CodeElement.ToCodings(); + Hl7.Fhir.Model.Code? ICoded.Code { get => CodeElement; set => CodeElement = value!; } + IEnumerable ICoded.ToCodings() => CodeElement?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationDefinition; - - if (dest == null) - { + if(other is not OperationDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(AffectsStateElement != null) dest.AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)AffectsStateElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)BaseElement.DeepCopyInternal(); - if(ResourceElement.Any()) dest.ResourceElement = new List>(ResourceElement.DeepCopyInternal()); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)SystemElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)TypeElement.DeepCopyInternal(); - if(InstanceElement != null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)InstanceElement.DeepCopyInternal(); - if(InputProfileElement != null) dest.InputProfileElement = (Hl7.Fhir.Model.Canonical)InputProfileElement.DeepCopyInternal(); - if(OutputProfileElement != null) dest.OutputProfileElement = (Hl7.Fhir.Model.Canonical)OutputProfileElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Overload.Any()) dest.Overload = new List(Overload.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_AffectsStateElement is not null) dest.AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)_AffectsStateElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)_BaseElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = new List>(_ResourceElement.DeepCopyInternal()); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)_SystemElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)_TypeElement.DeepCopyInternal(); + if(_InstanceElement is not null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)_InstanceElement.DeepCopyInternal(); + if(_InputProfileElement is not null) dest.InputProfileElement = (Hl7.Fhir.Model.Canonical)_InputProfileElement.DeepCopyInternal(); + if(_OutputProfileElement is not null) dest.OutputProfileElement = (Hl7.Fhir.Model.Canonical)_OutputProfileElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Overload is not null) dest.Overload = new List(_Overload.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1803,209 +1690,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationDefinition; - if(otherT == null) return false; + if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(AffectsStateElement, otherT.AffectsStateElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.ListEquals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(InstanceElement, otherT.InstanceElement)) return false; - if(!comparer.Equals(InputProfileElement, otherT.InputProfileElement)) return false; - if(!comparer.Equals(OutputProfileElement, otherT.OutputProfileElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Overload, otherT.Overload)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_AffectsStateElement, otherT._AffectsStateElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.ListEquals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_InstanceElement, otherT._InstanceElement)) return false; + if(!comparer.Equals(_InputProfileElement, otherT._InputProfileElement)) return false; + if(!comparer.Equals(_OutputProfileElement, otherT._OutputProfileElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "affectsState": - value = AffectsStateElement; - return AffectsStateElement is not null; + value = _AffectsStateElement; + return _AffectsStateElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; case "resource": - value = ResourceElement; - return ResourceElement?.Any() == true; + value = _ResourceElement; + return _ResourceElement?.Any() == true; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "instance": - value = InstanceElement; - return InstanceElement is not null; + value = _InstanceElement; + return _InstanceElement is not null; case "inputProfile": - value = InputProfileElement; - return InputProfileElement is not null; + value = _InputProfileElement; + return _InputProfileElement is not null; case "outputProfile": - value = OutputProfileElement; - return OutputProfileElement is not null; + value = _OutputProfileElement; + return _OutputProfileElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "overload": - value = Overload; - return Overload?.Any() == true; + value = _Overload; + return _Overload?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "affectsState": - AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "base": - BaseElement = (Hl7.Fhir.Model.Canonical)value; + BaseElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "resource": - ResourceElement = (List>)value; + ResourceElement = (List>?)value!; return this; case "system": - SystemElement = (Hl7.Fhir.Model.FhirBoolean)value; + SystemElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirBoolean)value; + TypeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "instance": - InstanceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InstanceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "inputProfile": - InputProfileElement = (Hl7.Fhir.Model.Canonical)value; + InputProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "outputProfile": - OutputProfileElement = (Hl7.Fhir.Model.Canonical)value; + OutputProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "overload": - Overload = (List)value; + Overload = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2016,32 +1903,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (AffectsStateElement is not null) yield return new KeyValuePair("affectsState",AffectsStateElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); - if (ResourceElement?.Any() == true) yield return new KeyValuePair("resource",ResourceElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (InstanceElement is not null) yield return new KeyValuePair("instance",InstanceElement); - if (InputProfileElement is not null) yield return new KeyValuePair("inputProfile",InputProfileElement); - if (OutputProfileElement is not null) yield return new KeyValuePair("outputProfile",OutputProfileElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Overload?.Any() == true) yield return new KeyValuePair("overload",Overload); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_AffectsStateElement is not null) yield return new KeyValuePair("affectsState",_AffectsStateElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); + if (_ResourceElement?.Any() == true) yield return new KeyValuePair("resource",_ResourceElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_InstanceElement is not null) yield return new KeyValuePair("instance",_InstanceElement); + if (_InputProfileElement is not null) yield return new KeyValuePair("inputProfile",_InputProfileElement); + if (_OutputProfileElement is not null) yield return new KeyValuePair("outputProfile",_OutputProfileElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Overload?.Any() == true) yield return new KeyValuePair("overload",_Overload); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs index a432c9c4c..95dd6dec2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,26 +84,26 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("purpose", Order=40)] [Binding("ContactPartyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Purpose + public Hl7.Fhir.Model.CodeableConcept? Purpose { get { return _Purpose; } set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private Hl7.Fhir.Model.CodeableConcept _Purpose; + private Hl7.Fhir.Model.CodeableConcept? _Purpose; /// /// A name associated with the contact. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// Contact details (telephone, email, etc.) for a contact. @@ -110,39 +113,35 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Visiting or postal addresses for the contact. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Purpose != null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)Purpose.DeepCopyInternal(); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); + if(_Purpose is not null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)_Purpose.DeepCopyInternal(); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -154,55 +153,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Purpose, otherT.Purpose)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = Purpose; - return Purpose is not null; + value = _Purpose; + return _Purpose is not null; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - Purpose = (Hl7.Fhir.Model.CodeableConcept)value; + Purpose = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; default: return base.SetValue(key, value); @@ -213,10 +212,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Purpose is not null) yield return new KeyValuePair("purpose",Purpose); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); + if (_Purpose is not null) yield return new KeyValuePair("purpose",_Purpose); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); } } @@ -229,24 +228,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether the organization's record is still in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether the organization's record is still in active use @@ -255,13 +254,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -275,39 +271,36 @@ public bool? Active [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Name used for the organization. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name used for the organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -320,24 +313,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the organization is known as, or was known as in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -352,11 +345,11 @@ public IEnumerable Alias [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// An address for the organization. @@ -366,11 +359,11 @@ public List Telecom [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// The organization of which this organization forms a part. @@ -379,13 +372,13 @@ public List Address [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// Contact for the organization for a certain purpose. @@ -395,11 +388,11 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Technical endpoints providing access to services operated for the organization. @@ -411,34 +404,30 @@ public List Contact [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Organization; - - if (dest == null) - { + if(other is not Organization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -450,97 +439,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Organization; - if(otherT == null) return false; + if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -551,16 +540,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs index 57225b22f..64d7368b2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,24 +67,24 @@ public partial class OrganizationAffiliation : Hl7.Fhir.Model.DomainResource, II [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this organization affiliation record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this organization affiliation record is in active use @@ -90,13 +93,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -106,13 +106,13 @@ public bool? Active /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization where the role is available. @@ -121,13 +121,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Organization that provides/performs the role (e.g. providing services or is a member of). @@ -136,13 +136,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ParticipatingOrganization + public Hl7.Fhir.Model.ResourceReference? ParticipatingOrganization { get { return _ParticipatingOrganization; } set { _ParticipatingOrganization = value; OnPropertyChanged("ParticipatingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ParticipatingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ParticipatingOrganization; /// /// Health insurance provider network in which the participatingOrganization provides the role's services (if defined) at the indicated locations (if defined). @@ -154,11 +154,11 @@ public Hl7.Fhir.Model.ResourceReference ParticipatingOrganization [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Definition of the role the participatingOrganization plays. @@ -169,11 +169,11 @@ public List Network [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Specific specialty of the participatingOrganization in the context of the role. @@ -184,11 +184,11 @@ public List Code [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The location(s) at which the role occurs. @@ -200,11 +200,11 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Healthcare services provided through the role. @@ -216,11 +216,11 @@ public List Location [DataMember] public List HealthcareService { - get { if(_HealthcareService==null) _HealthcareService = new List(); return _HealthcareService; } + get => _HealthcareService ?? new List(); set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } - private List _HealthcareService; + private List? _HealthcareService; /// /// Contact details at the participatingOrganization relevant to this Affiliation. @@ -230,11 +230,11 @@ public List HealthcareService [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Technical endpoints providing access to services operated for this role. @@ -246,36 +246,32 @@ public List Telecom [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as OrganizationAffiliation; - - if (dest == null) - { + if(other is not OrganizationAffiliation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(ParticipatingOrganization != null) dest.ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)ParticipatingOrganization.DeepCopyInternal(); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(HealthcareService.Any()) dest.HealthcareService = new List(HealthcareService.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_ParticipatingOrganization is not null) dest.ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)_ParticipatingOrganization.DeepCopyInternal(); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_HealthcareService is not null) dest.HealthcareService = new List(_HealthcareService.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -287,111 +283,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrganizationAffiliation; - if(otherT == null) return false; + if(other is not OrganizationAffiliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(ParticipatingOrganization, otherT.ParticipatingOrganization)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(HealthcareService, otherT.HealthcareService)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_ParticipatingOrganization, otherT._ParticipatingOrganization)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "participatingOrganization": - value = ParticipatingOrganization; - return ParticipatingOrganization is not null; + value = _ParticipatingOrganization; + return _ParticipatingOrganization is not null; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "healthcareService": - value = HealthcareService; - return HealthcareService?.Any() == true; + value = _HealthcareService; + return _HealthcareService?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participatingOrganization": - ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "healthcareService": - HealthcareService = (List)value; + HealthcareService = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -402,18 +398,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (ParticipatingOrganization is not null) yield return new KeyValuePair("participatingOrganization",ParticipatingOrganization); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",HealthcareService); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_ParticipatingOrganization is not null) yield return new KeyValuePair("participatingOrganization",_ParticipatingOrganization); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",_HealthcareService); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs index 2b1a4c49e..644b21642 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ParameterDefinition : Hl7.Fhir.Model.DataType /// [FhirElement("name", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name used to access the parameter value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -98,13 +98,13 @@ public string Name [Binding("ParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -113,13 +113,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -129,13 +126,13 @@ public Hl7.Fhir.Model.OperationParameterUse? Use /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum cardinality @@ -144,13 +141,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -160,28 +154,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum cardinality (a number of *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -191,28 +182,25 @@ public string Max /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// A brief description of the parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -225,13 +213,13 @@ public string Documentation [Binding("FHIRAllTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type of value @@ -240,13 +228,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -256,49 +241,42 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type /// [FhirElement("profile", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// What profile the value is expected to be /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterDefinition; - - if (dest == null) - { + if(other is not ParameterDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -310,76 +288,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterDefinition; - if(otherT == null) return false; + if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -390,13 +368,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Patient.cs b/src/Hl7.Fhir.R4/Model/Generated/Patient.cs index 1cb050c08..09154cb10 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Patient.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -118,24 +121,24 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// A name associated with the contact person. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// A contact detail for the person. @@ -145,24 +148,24 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address for the contact person. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// male | female | other | unknown. @@ -171,13 +174,13 @@ public Hl7.Fhir.Model.Address Address [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -186,13 +189,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -204,44 +204,40 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// The period during which this contact person or organization is valid to be contacted relating to this patient. /// [FhirElement("period", Order=100)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -253,76 +249,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -333,13 +329,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -367,26 +363,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -395,29 +391,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -429,41 +418,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -474,8 +463,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -505,13 +494,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Other + public Hl7.Fhir.Model.ResourceReference? Other { get { return _Other; } set { _Other = value; OnPropertyChanged("Other"); } } - private Hl7.Fhir.Model.ResourceReference _Other; + private Hl7.Fhir.Model.ResourceReference? _Other; /// /// replaced-by | replaces | refer | seealso. @@ -521,13 +510,13 @@ public Hl7.Fhir.Model.ResourceReference Other [Binding("LinkType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// replaced-by | replaces | refer | seealso @@ -536,29 +525,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Patient.LinkType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Other != null) dest.Other = (Hl7.Fhir.Model.ResourceReference)Other.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_Other is not null) dest.Other = (Hl7.Fhir.Model.ResourceReference)_Other.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -570,41 +552,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Other, otherT.Other)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "other": - value = Other; - return Other is not null; + value = _Other; + return _Other is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "other": - Other = (Hl7.Fhir.Model.ResourceReference)value; + Other = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -615,8 +597,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Other is not null) yield return new KeyValuePair("other",Other); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_Other is not null) yield return new KeyValuePair("other",_Other); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -629,24 +611,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this patient's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this patient's record is in active use @@ -655,13 +637,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -674,11 +653,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the individual. @@ -688,11 +667,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -701,13 +680,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -716,13 +695,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -732,28 +708,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date of birth for the individual /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -765,13 +738,13 @@ public string BirthDate [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// An address for the individual. @@ -781,11 +754,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Marital (civil) status of a patient. @@ -793,13 +766,13 @@ public List Address [FhirElement("maritalStatus", Order=170)] [Binding("MaritalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MaritalStatus + public Hl7.Fhir.Model.CodeableConcept? MaritalStatus { get { return _MaritalStatus; } set { _MaritalStatus = value; OnPropertyChanged("MaritalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _MaritalStatus; + private Hl7.Fhir.Model.CodeableConcept? _MaritalStatus; /// /// Whether patient is part of a multiple birth. @@ -808,13 +781,13 @@ public Hl7.Fhir.Model.CodeableConcept MaritalStatus [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer))] [DataMember] - public Hl7.Fhir.Model.DataType MultipleBirth + public Hl7.Fhir.Model.DataType? MultipleBirth { get { return _MultipleBirth; } set { _MultipleBirth = value; OnPropertyChanged("MultipleBirth"); } } - private Hl7.Fhir.Model.DataType _MultipleBirth; + private Hl7.Fhir.Model.DataType? _MultipleBirth; /// /// Image of the patient. @@ -824,11 +797,11 @@ public Hl7.Fhir.Model.DataType MultipleBirth [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// A contact party (e.g. guardian, partner, friend) for the patient. @@ -838,11 +811,11 @@ public List Photo [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// A language which may be used to communicate with the patient about his or her health. @@ -852,11 +825,11 @@ public List Contact [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Patient's nominated primary care provider. @@ -868,11 +841,11 @@ public List Communication [DataMember] public List GeneralPractitioner { - get { if(_GeneralPractitioner==null) _GeneralPractitioner = new List(); return _GeneralPractitioner; } + get => _GeneralPractitioner ?? new List(); set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } - private List _GeneralPractitioner; + private List? _GeneralPractitioner; /// /// Organization that is the custodian of the patient record. @@ -881,13 +854,13 @@ public List GeneralPractitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Link to another patient resource that concerns the same actual person. @@ -897,42 +870,38 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.Date Hl7.Fhir.Model.IPatient.BirthDate => BirthDateElement; + Hl7.Fhir.Model.Date? Hl7.Fhir.Model.IPatient.BirthDate => BirthDateElement; protected internal override void CopyToInternal(Base other) { - var dest = other as Patient; - - if (dest == null) - { + if(other is not Patient dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(MaritalStatus != null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)MaritalStatus.DeepCopyInternal(); - if(MultipleBirth != null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)MultipleBirth.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(GeneralPractitioner.Any()) dest.GeneralPractitioner = new List(GeneralPractitioner.DeepCopyInternal()); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_MaritalStatus is not null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)_MaritalStatus.DeepCopyInternal(); + if(_MultipleBirth is not null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)_MultipleBirth.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_GeneralPractitioner is not null) dest.GeneralPractitioner = new List(_GeneralPractitioner.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -944,139 +913,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Patient; - if(otherT == null) return false; + if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(MaritalStatus, otherT.MaritalStatus)) return false; - if(!comparer.Equals(MultipleBirth, otherT.MultipleBirth)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(GeneralPractitioner, otherT.GeneralPractitioner)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_MaritalStatus, otherT._MaritalStatus)) return false; + if(!comparer.Equals(_MultipleBirth, otherT._MultipleBirth)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "maritalStatus": - value = MaritalStatus; - return MaritalStatus is not null; + value = _MaritalStatus; + return _MaritalStatus is not null; case "multipleBirth": - value = MultipleBirth; - return MultipleBirth is not null; + value = _MultipleBirth; + return _MultipleBirth is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "generalPractitioner": - value = GeneralPractitioner; - return GeneralPractitioner?.Any() == true; + value = _GeneralPractitioner; + return _GeneralPractitioner?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "maritalStatus": - MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + MaritalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "multipleBirth": - MultipleBirth = (Hl7.Fhir.Model.DataType)value; + MultipleBirth = (Hl7.Fhir.Model.DataType?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "generalPractitioner": - GeneralPractitioner = (List)value; + GeneralPractitioner = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1087,22 +1056,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",MaritalStatus); - if (MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",MultipleBirth); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",GeneralPractitioner); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",_MaritalStatus); + if (_MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",_MultipleBirth); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",_GeneralPractitioner); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs index 78e8a692d..0253db4a0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -81,13 +84,13 @@ public List Identifier [Binding("PaymentNoticeStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -96,13 +99,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -114,13 +114,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Response reference. @@ -129,13 +129,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Creation date. @@ -143,28 +143,25 @@ public Hl7.Fhir.Model.ResourceReference Response [FhirElement("created", InSummary=true, Order=130, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -176,13 +173,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Payment reference. @@ -192,41 +189,38 @@ public Hl7.Fhir.Model.ResourceReference Provider [References("PaymentReconciliation")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payment + public Hl7.Fhir.Model.ResourceReference? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ResourceReference _Payment; + private Hl7.Fhir.Model.ResourceReference? _Payment; /// /// Payment or clearing date. /// [FhirElement("paymentDate", Order=160)] [DataMember] - public Hl7.Fhir.Model.Date PaymentDateElement + public Hl7.Fhir.Model.Date? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.Date _PaymentDateElement; + private Hl7.Fhir.Model.Date? _PaymentDateElement; /// /// Payment or clearing date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.Date(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("PaymentDate"); } } @@ -238,13 +232,13 @@ public string PaymentDate [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payee + public Hl7.Fhir.Model.ResourceReference? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ResourceReference _Payee; + private Hl7.Fhir.Model.ResourceReference? _Payee; /// /// Party being notified. @@ -254,13 +248,13 @@ public Hl7.Fhir.Model.ResourceReference Payee [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Monetary amount of the payment. @@ -268,13 +262,13 @@ public Hl7.Fhir.Model.ResourceReference Recipient [FhirElement("amount", InSummary=true, Order=190)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Issued or cleared Status of the payment. @@ -282,38 +276,34 @@ public Hl7.Fhir.Model.Money Amount [FhirElement("paymentStatus", Order=200)] [Binding("PaymentStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PaymentStatus + public Hl7.Fhir.Model.CodeableConcept? PaymentStatus { get { return _PaymentStatus; } set { _PaymentStatus = value; OnPropertyChanged("PaymentStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _PaymentStatus; + private Hl7.Fhir.Model.CodeableConcept? _PaymentStatus; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentNotice; - - if (dest == null) - { + if(other is not PaymentNotice dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ResourceReference)Payment.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)PaymentDateElement.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(PaymentStatus != null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)PaymentStatus.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ResourceReference)_Payment.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)_PaymentDateElement.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)_Payee.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_PaymentStatus is not null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)_PaymentStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -325,111 +315,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentNotice; - if(otherT == null) return false; + if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(PaymentStatus, otherT.PaymentStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "paymentStatus": - value = PaymentStatus; - return PaymentStatus is not null; + value = _PaymentStatus; + return _PaymentStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payment": - Payment = (Hl7.Fhir.Model.ResourceReference)value; + Payment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.Date)value; + PaymentDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ResourceReference)value; + Payee = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "paymentStatus": - PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)value; + PaymentStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -440,18 +430,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",PaymentStatus); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",_PaymentStatus); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs index 0553ece78..d9bca9e50 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,26 +83,26 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business identifier of the prior payment detail. /// [FhirElement("predecessor", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Predecessor + public Hl7.Fhir.Model.Identifier? Predecessor { get { return _Predecessor; } set { _Predecessor = value; OnPropertyChanged("Predecessor"); } } - private Hl7.Fhir.Model.Identifier _Predecessor; + private Hl7.Fhir.Model.Identifier? _Predecessor; /// /// Category of payment. @@ -108,13 +111,13 @@ public Hl7.Fhir.Model.Identifier Predecessor [Binding("PaymentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Request giving rise to the payment. @@ -123,13 +126,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Submitter of the request. @@ -138,13 +141,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Submitter + public Hl7.Fhir.Model.ResourceReference? Submitter { get { return _Submitter; } set { _Submitter = value; OnPropertyChanged("Submitter"); } } - private Hl7.Fhir.Model.ResourceReference _Submitter; + private Hl7.Fhir.Model.ResourceReference? _Submitter; /// /// Response committing to a payment. @@ -153,41 +156,38 @@ public Hl7.Fhir.Model.ResourceReference Submitter [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Date of commitment to pay. /// [FhirElement("date", Order=100)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Date of commitment to pay /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -199,13 +199,13 @@ public string Date [CLSCompliant(false)] [References("PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Recipient of the payment. @@ -214,47 +214,43 @@ public Hl7.Fhir.Model.ResourceReference Responsible [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payee + public Hl7.Fhir.Model.ResourceReference? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ResourceReference _Payee; + private Hl7.Fhir.Model.ResourceReference? _Payee; /// /// Amount allocated to this payable. /// [FhirElement("amount", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailsComponent; - - if (dest == null) - { + if(other is not DetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Predecessor != null) dest.Predecessor = (Hl7.Fhir.Model.Identifier)Predecessor.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Submitter != null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)Submitter.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Predecessor is not null) dest.Predecessor = (Hl7.Fhir.Model.Identifier)_Predecessor.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Submitter is not null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)_Submitter.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)_Payee.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -266,97 +262,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailsComponent; - if(otherT == null) return false; + if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Predecessor, otherT.Predecessor)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Submitter, otherT.Submitter)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Submitter, otherT._Submitter)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "predecessor": - value = Predecessor; - return Predecessor is not null; + value = _Predecessor; + return _Predecessor is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "submitter": - value = Submitter; - return Submitter is not null; + value = _Submitter; + return _Submitter is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "predecessor": - Predecessor = (Hl7.Fhir.Model.Identifier)value; + Predecessor = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "submitter": - Submitter = (Hl7.Fhir.Model.ResourceReference)value; + Submitter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ResourceReference)value; + Payee = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -367,16 +363,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Predecessor is not null) yield return new KeyValuePair("predecessor",Predecessor); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Submitter is not null) yield return new KeyValuePair("submitter",Submitter); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Predecessor is not null) yield return new KeyValuePair("predecessor",_Predecessor); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Submitter is not null) yield return new KeyValuePair("submitter",_Submitter); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -404,13 +400,13 @@ public partial class NotesComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("NoteType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// display | print | printoper @@ -419,13 +415,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NoteType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -435,44 +428,37 @@ public Hl7.Fhir.Model.NoteType? Type /// [FhirElement("text", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NotesComponent; - - if (dest == null) - { + if(other is not NotesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -484,41 +470,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotesComponent; - if(otherT == null) return false; + if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -529,8 +515,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -543,11 +529,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -557,13 +543,13 @@ public List Identifier [Binding("PaymentReconciliationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -572,13 +558,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -588,13 +571,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Creation date. @@ -602,28 +585,25 @@ public Hl7.Fhir.Model.Period Period [FhirElement("created", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -635,13 +615,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PaymentIssuer + public Hl7.Fhir.Model.ResourceReference? PaymentIssuer { get { return _PaymentIssuer; } set { _PaymentIssuer = value; OnPropertyChanged("PaymentIssuer"); } } - private Hl7.Fhir.Model.ResourceReference _PaymentIssuer; + private Hl7.Fhir.Model.ResourceReference? _PaymentIssuer; /// /// Reference to requesting resource. @@ -650,13 +630,13 @@ public Hl7.Fhir.Model.ResourceReference PaymentIssuer [CLSCompliant(false)] [References("Task")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Responsible practitioner. @@ -665,13 +645,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// queued | complete | error | partial. @@ -680,13 +660,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [DeclaredType(Type = typeof(Code))] [Binding("RemittanceOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -695,13 +675,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -711,28 +688,25 @@ public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome /// [FhirElement("disposition", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -743,28 +717,25 @@ public string Disposition [FhirElement("paymentDate", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Date PaymentDateElement + public Hl7.Fhir.Model.Date? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.Date _PaymentDateElement; + private Hl7.Fhir.Model.Date? _PaymentDateElement; /// /// When payment issued /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.Date(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("PaymentDate"); } } @@ -775,26 +746,26 @@ public string PaymentDate [FhirElement("paymentAmount", InSummary=true, Order=190)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money PaymentAmount + public Hl7.Fhir.Model.Money? PaymentAmount { get { return _PaymentAmount; } set { _PaymentAmount = value; OnPropertyChanged("PaymentAmount"); } } - private Hl7.Fhir.Model.Money _PaymentAmount; + private Hl7.Fhir.Model.Money? _PaymentAmount; /// /// Business identifier for the payment. /// [FhirElement("paymentIdentifier", Order=200)] [DataMember] - public Hl7.Fhir.Model.Identifier PaymentIdentifier + public Hl7.Fhir.Model.Identifier? PaymentIdentifier { get { return _PaymentIdentifier; } set { _PaymentIdentifier = value; OnPropertyChanged("PaymentIdentifier"); } } - private Hl7.Fhir.Model.Identifier _PaymentIdentifier; + private Hl7.Fhir.Model.Identifier? _PaymentIdentifier; /// /// Settlement particulars. @@ -804,11 +775,11 @@ public Hl7.Fhir.Model.Identifier PaymentIdentifier [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; /// /// Printed form identifier. @@ -816,13 +787,13 @@ public List Detail [FhirElement("formCode", Order=220)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Note concerning processing. @@ -832,39 +803,35 @@ public Hl7.Fhir.Model.CodeableConcept FormCode [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentReconciliation; - - if (dest == null) - { + if(other is not PaymentReconciliation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(PaymentIssuer != null) dest.PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)PaymentIssuer.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)PaymentDateElement.DeepCopyInternal(); - if(PaymentAmount != null) dest.PaymentAmount = (Hl7.Fhir.Model.Money)PaymentAmount.DeepCopyInternal(); - if(PaymentIdentifier != null) dest.PaymentIdentifier = (Hl7.Fhir.Model.Identifier)PaymentIdentifier.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_PaymentIssuer is not null) dest.PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)_PaymentIssuer.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)_PaymentDateElement.DeepCopyInternal(); + if(_PaymentAmount is not null) dest.PaymentAmount = (Hl7.Fhir.Model.Money)_PaymentAmount.DeepCopyInternal(); + if(_PaymentIdentifier is not null) dest.PaymentIdentifier = (Hl7.Fhir.Model.Identifier)_PaymentIdentifier.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -876,132 +843,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentReconciliation; - if(otherT == null) return false; + if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(PaymentIssuer, otherT.PaymentIssuer)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(PaymentAmount, otherT.PaymentAmount)) return false; - if(!comparer.Equals(PaymentIdentifier, otherT.PaymentIdentifier)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_PaymentIssuer, otherT._PaymentIssuer)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_PaymentAmount, otherT._PaymentAmount)) return false; + if(!comparer.Equals(_PaymentIdentifier, otherT._PaymentIdentifier)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "paymentIssuer": - value = PaymentIssuer; - return PaymentIssuer is not null; + value = _PaymentIssuer; + return _PaymentIssuer is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "paymentAmount": - value = PaymentAmount; - return PaymentAmount is not null; + value = _PaymentAmount; + return _PaymentAmount is not null; case "paymentIdentifier": - value = PaymentIdentifier; - return PaymentIdentifier is not null; + value = _PaymentIdentifier; + return _PaymentIdentifier is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "paymentIssuer": - PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)value; + PaymentIssuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.Date)value; + PaymentDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "paymentAmount": - PaymentAmount = (Hl7.Fhir.Model.Money)value; + PaymentAmount = (Hl7.Fhir.Model.Money?)value; return this; case "paymentIdentifier": - PaymentIdentifier = (Hl7.Fhir.Model.Identifier)value; + PaymentIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1012,21 +979,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (PaymentIssuer is not null) yield return new KeyValuePair("paymentIssuer",PaymentIssuer); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (PaymentAmount is not null) yield return new KeyValuePair("paymentAmount",PaymentAmount); - if (PaymentIdentifier is not null) yield return new KeyValuePair("paymentIdentifier",PaymentIdentifier); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_PaymentIssuer is not null) yield return new KeyValuePair("paymentIssuer",_PaymentIssuer); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_PaymentAmount is not null) yield return new KeyValuePair("paymentAmount",_PaymentAmount); + if (_PaymentIdentifier is not null) yield return new KeyValuePair("paymentIdentifier",_PaymentIdentifier); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Person.cs b/src/Hl7.Fhir.R4/Model/Generated/Person.cs index 4d9e79915..5a450053d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Person.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,13 +118,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","Practitioner","RelatedPerson","Person")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// level1 | level2 | level3 | level4. @@ -130,13 +133,13 @@ public Hl7.Fhir.Model.ResourceReference Target [DeclaredType(Type = typeof(Code))] [Binding("IdentityAssuranceLevel")] [DataMember] - public Code AssuranceElement + public Code? AssuranceElement { get { return _AssuranceElement; } set { _AssuranceElement = value; OnPropertyChanged("AssuranceElement"); } } - private Code _AssuranceElement; + private Code? _AssuranceElement; /// /// level1 | level2 | level3 | level4 @@ -145,29 +148,22 @@ public Code AssuranceElement [IgnoreDataMember] public Hl7.Fhir.Model.Person.IdentityAssuranceLevel? Assurance { - get { return AssuranceElement != null ? AssuranceElement.Value : null; } + get => _AssuranceElement?.Value; set { - if (value == null) - AssuranceElement = null; - else - AssuranceElement = new Code(value); + AssuranceElement = value is null ? null : new Code(value); OnPropertyChanged("Assurance"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(AssuranceElement != null) dest.AssuranceElement = (Code)AssuranceElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_AssuranceElement is not null) dest.AssuranceElement = (Code)_AssuranceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,41 +175,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(AssuranceElement, otherT.AssuranceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "assurance": - value = AssuranceElement; - return AssuranceElement is not null; + value = _AssuranceElement; + return _AssuranceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assurance": - AssuranceElement = (Code)value; + AssuranceElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -224,8 +220,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target is not null) yield return new KeyValuePair("target",Target); - if (AssuranceElement is not null) yield return new KeyValuePair("assurance",AssuranceElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_AssuranceElement is not null) yield return new KeyValuePair("assurance",_AssuranceElement); } } @@ -238,11 +234,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A name associated with the person. @@ -252,11 +248,11 @@ public List Identifier [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -266,11 +262,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -279,13 +275,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -294,13 +290,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -310,28 +303,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -344,24 +334,24 @@ public string BirthDate [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. /// [FhirElement("photo", Order=150)] [DataMember] - public Hl7.Fhir.Model.Attachment Photo + public Hl7.Fhir.Model.Attachment? Photo { get { return _Photo; } set { _Photo = value; OnPropertyChanged("Photo"); } } - private Hl7.Fhir.Model.Attachment _Photo; + private Hl7.Fhir.Model.Attachment? _Photo; /// /// The organization that is the custodian of the person record. @@ -370,26 +360,26 @@ public Hl7.Fhir.Model.Attachment Photo [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// This person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=170, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// This person's record is in active use @@ -398,13 +388,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -417,34 +404,30 @@ public bool? Active [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Person; - - if (dest == null) - { + if(other is not Person dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo != null) dest.Photo = (Hl7.Fhir.Model.Attachment)Photo.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = (Hl7.Fhir.Model.Attachment)_Photo.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -456,97 +439,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Person; - if(otherT == null) return false; + if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(Photo, otherT.Photo)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_Photo, otherT._Photo)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo is not null; + value = _Photo; + return _Photo is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (Hl7.Fhir.Model.Attachment)value; + Photo = (Hl7.Fhir.Model.Attachment?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -557,16 +540,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo is not null) yield return new KeyValuePair("photo",Photo); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo is not null) yield return new KeyValuePair("photo",_Photo); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs index b4aaaa65b..506e3e461 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class GoalComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("GoalCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Code or text describing the goal. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// high-priority | medium-priority | low-priority. @@ -110,13 +113,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [FhirElement("priority", Order=60)] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// When goal pursuit begins. @@ -124,13 +127,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("start", Order=70)] [Binding("GoalStartEvent")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Start + public Hl7.Fhir.Model.CodeableConcept? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.CodeableConcept _Start; + private Hl7.Fhir.Model.CodeableConcept? _Start; /// /// What does the goal address. @@ -141,11 +144,11 @@ public Hl7.Fhir.Model.CodeableConcept Start [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Supporting documentation for the goal. @@ -155,11 +158,11 @@ public List Addresses [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// Target outcome for the goal. @@ -169,29 +172,25 @@ public List Documentation [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as GoalComponent; - - if (dest == null) - { + if(other is not GoalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)Start.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)_Start.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -203,76 +202,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GoalComponent; - if(otherT == null) return false; + if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "start": - Start = (Hl7.Fhir.Model.CodeableConcept)value; + Start = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -283,13 +282,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -316,13 +315,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -331,40 +330,36 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal within. /// [FhirElement("due", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration Due + public Hl7.Fhir.Model.Duration? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.Duration _Due; + private Hl7.Fhir.Model.Duration? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.Duration)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.Duration)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -376,48 +371,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.Duration)value; + Due = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -428,9 +423,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -457,28 +452,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("prefix", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// User-visible prefix for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -488,28 +480,25 @@ public string Prefix /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -519,28 +508,25 @@ public string Title /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Brief description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -550,28 +536,25 @@ public string Description /// [FhirElement("textEquivalent", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextEquivalentElement + public Hl7.Fhir.Model.FhirString? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.FhirString _TextEquivalentElement; + private Hl7.Fhir.Model.FhirString? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.FhirString(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextEquivalent"); } } @@ -583,13 +566,13 @@ public string TextEquivalent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -598,13 +581,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -617,11 +597,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Why the action should be performed. @@ -631,11 +611,11 @@ public List Code [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Supporting documentation for the intended performer of the action. @@ -645,11 +625,11 @@ public List Reason [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// What goals this action supports. @@ -659,24 +639,24 @@ public List Documentation [DataMember] public List GoalIdElement { - get { if(_GoalIdElement==null) _GoalIdElement = new List(); return _GoalIdElement; } + get => _GoalIdElement ?? new List(); set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } - private List _GoalIdElement; + private List? _GoalIdElement; /// /// What goals this action supports /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable GoalId + public IEnumerable? GoalId { - get { return GoalIdElement != null ? GoalIdElement.Select(elem => elem.Value) : null; } + get => _GoalIdElement?.Select(elem => elem.Value); set { if (value == null) - GoalIdElement = null; + GoalIdElement = null!; else GoalIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Id(elem))); OnPropertyChanged("GoalId"); @@ -692,13 +672,13 @@ public IEnumerable GoalId [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// When the action should be triggered. @@ -708,11 +688,11 @@ public Hl7.Fhir.Model.DataType Subject [DataMember] public List Trigger { - get { if(_Trigger==null) _Trigger = new List(); return _Trigger; } + get => _Trigger ?? new List(); set { _Trigger = value; OnPropertyChanged("Trigger"); } } - private List _Trigger; + private List? _Trigger; /// /// Whether or not the action is applicable. @@ -722,11 +702,11 @@ public List Trigger [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Input data requirements. @@ -736,11 +716,11 @@ public List Condition [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Output data definition. @@ -750,11 +730,11 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; /// /// Relationship to another action. @@ -764,11 +744,11 @@ public List Output [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -777,13 +757,13 @@ public List RelatedAction [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Who should participate in the action. @@ -793,11 +773,11 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -805,13 +785,13 @@ public List Participant [FhirElement("type", Order=210)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// visual-group | logical-group | sentence-group. @@ -820,13 +800,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -835,13 +815,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -853,13 +830,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -868,13 +845,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -886,13 +860,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -901,13 +875,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -919,13 +890,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -934,13 +905,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -952,13 +920,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -967,13 +935,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -985,41 +950,38 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// Transform to apply the template. /// [FhirElement("transform", Order=280)] [DataMember] - public Hl7.Fhir.Model.Canonical TransformElement + public Hl7.Fhir.Model.Canonical? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Hl7.Fhir.Model.Canonical _TransformElement; + private Hl7.Fhir.Model.Canonical? _TransformElement; /// /// Transform to apply the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Transform + public string? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Hl7.Fhir.Model.Canonical(value); + TransformElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Transform"); } } @@ -1032,11 +994,11 @@ public string Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; /// /// A sub-action. @@ -1046,49 +1008,45 @@ public List DynamicValue [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)TextEquivalentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(GoalIdElement.Any()) dest.GoalIdElement = new List(GoalIdElement.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(Trigger.Any()) dest.Trigger = new List(Trigger.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)TransformElement.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)_TextEquivalentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_GoalIdElement is not null) dest.GoalIdElement = new List(_GoalIdElement.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_Trigger is not null) dest.Trigger = new List(_Trigger.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)_TransformElement.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1100,216 +1058,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(GoalIdElement, otherT.GoalIdElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Trigger, otherT.Trigger)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_GoalIdElement, otherT._GoalIdElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "goalId": - value = GoalIdElement; - return GoalIdElement?.Any() == true; + value = _GoalIdElement; + return _GoalIdElement?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "trigger": - value = Trigger; - return Trigger?.Any() == true; + value = _Trigger; + return _Trigger?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.FhirString)value; + TextEquivalentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "goalId": - GoalIdElement = (List)value; + GoalIdElement = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "trigger": - Trigger = (List)value; + Trigger = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "transform": - TransformElement = (Hl7.Fhir.Model.Canonical)value; + TransformElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1320,33 +1278,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",GoalIdElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Trigger?.Any() == true) yield return new KeyValuePair("trigger",Trigger); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",_GoalIdElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Trigger?.Any() == true) yield return new KeyValuePair("trigger",_Trigger); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1376,13 +1334,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -1391,13 +1349,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1407,26 +1362,22 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1438,41 +1389,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -1483,8 +1434,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -1512,28 +1463,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ActionIdElement + public Hl7.Fhir.Model.Id? ActionIdElement { get { return _ActionIdElement; } set { _ActionIdElement = value; OnPropertyChanged("ActionIdElement"); } } - private Hl7.Fhir.Model.Id _ActionIdElement; + private Hl7.Fhir.Model.Id? _ActionIdElement; /// /// What action is this related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActionId + public string? ActionId { - get { return ActionIdElement != null ? ActionIdElement.Value : null; } + get => _ActionIdElement?.Value; set { - if (value == null) - ActionIdElement = null; - else - ActionIdElement = new Hl7.Fhir.Model.Id(value); + ActionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ActionId"); } } @@ -1546,13 +1494,13 @@ public string ActionId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end @@ -1561,13 +1509,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -1579,27 +1524,23 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActionIdElement != null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)ActionIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_ActionIdElement is not null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)_ActionIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1611,48 +1552,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActionIdElement, otherT.ActionIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actionId": - value = ActionIdElement; - return ActionIdElement is not null; + value = _ActionIdElement; + return _ActionIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actionId": - ActionIdElement = (Hl7.Fhir.Model.Id)value; + ActionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1663,9 +1604,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActionIdElement is not null) yield return new KeyValuePair("actionId",ActionIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_ActionIdElement is not null) yield return new KeyValuePair("actionId",_ActionIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -1694,13 +1635,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// patient | practitioner | related-person | device @@ -1709,13 +1650,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1726,26 +1664,22 @@ public Hl7.Fhir.Model.ActionParticipantType? Type [FhirElement("role", Order=50)] [Binding("ActionParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1757,41 +1691,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1802,8 +1736,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -1830,28 +1764,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("path", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -1861,26 +1792,22 @@ public string Path /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1892,41 +1819,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -1937,8 +1864,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -1948,28 +1875,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this plan definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1982,39 +1906,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the plan definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2024,28 +1945,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this plan definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2055,28 +1973,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this plan definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2086,28 +2001,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -2118,13 +2030,13 @@ public string Subtitle [FhirElement("type", InSummary=true, Order=150)] [Binding("PlanDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// draft | active | retired | unknown. @@ -2134,13 +2046,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2149,13 +2061,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2165,13 +2074,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2180,13 +2089,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2200,41 +2106,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2244,28 +2147,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2278,39 +2178,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the plan definition. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2323,11 +2220,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for plan definition (if applicable). @@ -2338,39 +2235,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this plan definition is defined. /// [FhirElement("purpose", Order=250, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this plan definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2380,28 +2274,25 @@ public string Purpose /// [FhirElement("usage", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -2411,28 +2302,25 @@ public string Usage /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2442,28 +2330,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the plan definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -2473,28 +2358,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the plan definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2504,13 +2386,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment. @@ -2521,11 +2403,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -2535,11 +2417,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -2549,11 +2431,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -2563,11 +2445,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -2577,11 +2459,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations. @@ -2591,11 +2473,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the plan definition. @@ -2605,24 +2487,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -2637,11 +2519,11 @@ public IEnumerable Library [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Action defined by the plan. @@ -2651,55 +2533,51 @@ public List Goal [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PlanDefinition; - - if (dest == null) - { + if(other is not PlanDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2711,244 +2589,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanDefinition; - if(otherT == null) return false; + if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2959,37 +2837,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Population.cs b/src/Hl7.Fhir.R4/Model/Generated/Population.cs index dea7ca0ee..c0d96ef5e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Population.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Population.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,67 +69,63 @@ public partial class Population : Hl7.Fhir.Model.BackboneType [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Age + public Hl7.Fhir.Model.DataType? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.DataType _Age; + private Hl7.Fhir.Model.DataType? _Age; /// /// The gender of the specific population. /// [FhirElement("gender", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Gender + public Hl7.Fhir.Model.CodeableConcept? Gender { get { return _Gender; } set { _Gender = value; OnPropertyChanged("Gender"); } } - private Hl7.Fhir.Model.CodeableConcept _Gender; + private Hl7.Fhir.Model.CodeableConcept? _Gender; /// /// Race of the specific population. /// [FhirElement("race", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Race + public Hl7.Fhir.Model.CodeableConcept? Race { get { return _Race; } set { _Race = value; OnPropertyChanged("Race"); } } - private Hl7.Fhir.Model.CodeableConcept _Race; + private Hl7.Fhir.Model.CodeableConcept? _Race; /// /// The existing physiological conditions of the specific population to which this applies. /// [FhirElement("physiologicalCondition", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PhysiologicalCondition + public Hl7.Fhir.Model.CodeableConcept? PhysiologicalCondition { get { return _PhysiologicalCondition; } set { _PhysiologicalCondition = value; OnPropertyChanged("PhysiologicalCondition"); } } - private Hl7.Fhir.Model.CodeableConcept _PhysiologicalCondition; + private Hl7.Fhir.Model.CodeableConcept? _PhysiologicalCondition; protected internal override void CopyToInternal(Base other) { - var dest = other as Population; - - if (dest == null) - { + if(other is not Population dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Age != null) dest.Age = (Hl7.Fhir.Model.DataType)Age.DeepCopyInternal(); - if(Gender != null) dest.Gender = (Hl7.Fhir.Model.CodeableConcept)Gender.DeepCopyInternal(); - if(Race != null) dest.Race = (Hl7.Fhir.Model.CodeableConcept)Race.DeepCopyInternal(); - if(PhysiologicalCondition != null) dest.PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept)PhysiologicalCondition.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.DataType)_Age.DeepCopyInternal(); + if(_Gender is not null) dest.Gender = (Hl7.Fhir.Model.CodeableConcept)_Gender.DeepCopyInternal(); + if(_Race is not null) dest.Race = (Hl7.Fhir.Model.CodeableConcept)_Race.DeepCopyInternal(); + if(_PhysiologicalCondition is not null) dest.PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept)_PhysiologicalCondition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -138,55 +137,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Population; - if(otherT == null) return false; + if(other is not Population otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(Gender, otherT.Gender)) return false; - if(!comparer.Equals(Race, otherT.Race)) return false; - if(!comparer.Equals(PhysiologicalCondition, otherT.PhysiologicalCondition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_Gender, otherT._Gender)) return false; + if(!comparer.Equals(_Race, otherT._Race)) return false; + if(!comparer.Equals(_PhysiologicalCondition, otherT._PhysiologicalCondition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "gender": - value = Gender; - return Gender is not null; + value = _Gender; + return _Gender is not null; case "race": - value = Race; - return Race is not null; + value = _Race; + return _Race is not null; case "physiologicalCondition": - value = PhysiologicalCondition; - return PhysiologicalCondition is not null; + value = _PhysiologicalCondition; + return _PhysiologicalCondition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "age": - Age = (Hl7.Fhir.Model.DataType)value; + Age = (Hl7.Fhir.Model.DataType?)value; return this; case "gender": - Gender = (Hl7.Fhir.Model.CodeableConcept)value; + Gender = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "race": - Race = (Hl7.Fhir.Model.CodeableConcept)value; + Race = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "physiologicalCondition": - PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept)value; + PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -197,10 +196,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Age is not null) yield return new KeyValuePair("age",Age); - if (Gender is not null) yield return new KeyValuePair("gender",Gender); - if (Race is not null) yield return new KeyValuePair("race",Race); - if (PhysiologicalCondition is not null) yield return new KeyValuePair("physiologicalCondition",PhysiologicalCondition); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_Gender is not null) yield return new KeyValuePair("gender",_Gender); + if (_Race is not null) yield return new KeyValuePair("race",_Race); + if (_PhysiologicalCondition is not null) yield return new KeyValuePair("physiologicalCondition",_PhysiologicalCondition); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs index 4c7a7183b..59b76aa3e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -83,11 +86,11 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Coded representation of the qualification. @@ -96,26 +99,26 @@ public List Identifier [Binding("Qualification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Period during which the qualification is valid. /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that regulates and issues the qualification. @@ -124,28 +127,24 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; protected internal override void CopyToInternal(Base other) { - var dest = other as QualificationComponent; - - if (dest == null) - { + if(other is not QualificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -157,55 +156,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualificationComponent; - if(otherT == null) return false; + if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -216,10 +215,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); } } @@ -232,24 +231,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner's record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner's record is in active use @@ -258,13 +257,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -277,11 +273,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the practitioner (that apply to all roles). @@ -291,11 +287,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address(es) of the practitioner that are not role specific (typically home address). @@ -305,11 +301,11 @@ public List Telecom [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// male | female | other | unknown. @@ -318,13 +314,13 @@ public List Address [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -333,13 +329,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -349,28 +342,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the practitioner was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -383,11 +373,11 @@ public string BirthDate [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Certification, licenses, or training pertaining to the provision of care. @@ -397,11 +387,11 @@ public List Photo [DataMember] public List Qualification { - get { if(_Qualification==null) _Qualification = new List(); return _Qualification; } + get => _Qualification ?? new List(); set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private List _Qualification; + private List? _Qualification; /// /// A language the practitioner can use in patient communication. @@ -412,34 +402,30 @@ public List Qualification [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Practitioner; - - if (dest == null) - { + if(other is not Practitioner dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Qualification.Any()) dest.Qualification = new List(Qualification.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Qualification is not null) dest.Qualification = new List(_Qualification.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -451,97 +437,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Practitioner; - if(otherT == null) return false; + if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Qualification, otherT.Qualification)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "qualification": - value = Qualification; - return Qualification?.Any() == true; + value = _Qualification; + return _Qualification?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "qualification": - Qualification = (List)value; + Qualification = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -552,16 +538,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Qualification?.Any() == true) yield return new KeyValuePair("qualification",Qualification); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Qualification?.Any() == true) yield return new KeyValuePair("qualification",_Qualification); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs index 1b2541a6b..0af24c393 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -86,24 +89,24 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -115,13 +118,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// Always available? e.g. 24 hour service @@ -130,13 +133,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -146,28 +146,25 @@ public bool? AllDay /// [FhirElement("availableStartTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time AvailableStartTimeElement + public Hl7.Fhir.Model.Time? AvailableStartTimeElement { get { return _AvailableStartTimeElement; } set { _AvailableStartTimeElement = value; OnPropertyChanged("AvailableStartTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableStartTimeElement; + private Hl7.Fhir.Model.Time? _AvailableStartTimeElement; /// /// Opening time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableStartTime + public string? AvailableStartTime { - get { return AvailableStartTimeElement != null ? AvailableStartTimeElement.Value : null; } + get => _AvailableStartTimeElement?.Value; set { - if (value == null) - AvailableStartTimeElement = null; - else - AvailableStartTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableStartTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableStartTime"); } } @@ -177,46 +174,39 @@ public string AvailableStartTime /// [FhirElement("availableEndTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time AvailableEndTimeElement + public Hl7.Fhir.Model.Time? AvailableEndTimeElement { get { return _AvailableEndTimeElement; } set { _AvailableEndTimeElement = value; OnPropertyChanged("AvailableEndTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableEndTimeElement; + private Hl7.Fhir.Model.Time? _AvailableEndTimeElement; /// /// Closing time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableEndTime + public string? AvailableEndTime { - get { return AvailableEndTimeElement != null ? AvailableEndTimeElement.Value : null; } + get => _AvailableEndTimeElement?.Value; set { - if (value == null) - AvailableEndTimeElement = null; - else - AvailableEndTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableEndTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableEndTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AvailableTimeComponent; - - if (dest == null) - { + if(other is not AvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(AvailableStartTimeElement != null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)AvailableStartTimeElement.DeepCopyInternal(); - if(AvailableEndTimeElement != null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)AvailableEndTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_AvailableStartTimeElement is not null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)_AvailableStartTimeElement.DeepCopyInternal(); + if(_AvailableEndTimeElement is not null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)_AvailableEndTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -228,55 +218,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AvailableTimeComponent; - if(otherT == null) return false; + if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(AvailableStartTimeElement, otherT.AvailableStartTimeElement)) return false; - if(!comparer.Equals(AvailableEndTimeElement, otherT.AvailableEndTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; + if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "availableStartTime": - value = AvailableStartTimeElement; - return AvailableStartTimeElement is not null; + value = _AvailableStartTimeElement; + return _AvailableStartTimeElement is not null; case "availableEndTime": - value = AvailableEndTimeElement; - return AvailableEndTimeElement is not null; + value = _AvailableEndTimeElement; + return _AvailableEndTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableStartTime": - AvailableStartTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableStartTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "availableEndTime": - AvailableEndTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableEndTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -287,10 +277,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",AvailableStartTimeElement); - if (AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",AvailableEndTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",_AvailableStartTimeElement); + if (_AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",_AvailableEndTimeElement); } } @@ -317,28 +307,25 @@ public partial class NotAvailableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason presented to the user explaining why time not available /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -348,26 +335,22 @@ public string Description /// [FhirElement("during", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period During + public Hl7.Fhir.Model.Period? During { get { return _During; } set { _During = value; OnPropertyChanged("During"); } } - private Hl7.Fhir.Model.Period _During; + private Hl7.Fhir.Model.Period? _During; protected internal override void CopyToInternal(Base other) { - var dest = other as NotAvailableComponent; - - if (dest == null) - { + if(other is not NotAvailableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(During != null) dest.During = (Hl7.Fhir.Model.Period)During.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_During is not null) dest.During = (Hl7.Fhir.Model.Period)_During.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -379,41 +362,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotAvailableComponent; - if(otherT == null) return false; + if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(During, otherT.During)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_During, otherT._During)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "during": - value = During; - return During is not null; + value = _During; + return _During is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "during": - During = (Hl7.Fhir.Model.Period)value; + During = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -424,8 +407,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (During is not null) yield return new KeyValuePair("during",During); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_During is not null) yield return new KeyValuePair("during",_During); } } @@ -438,24 +421,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner role record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner role record is in active use @@ -464,13 +447,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -480,13 +460,13 @@ public bool? Active /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Practitioner that is able to provide the defined services for the organization. @@ -495,13 +475,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Practitioner + public Hl7.Fhir.Model.ResourceReference? Practitioner { get { return _Practitioner; } set { _Practitioner = value; OnPropertyChanged("Practitioner"); } } - private Hl7.Fhir.Model.ResourceReference _Practitioner; + private Hl7.Fhir.Model.ResourceReference? _Practitioner; /// /// Organization where the roles are available. @@ -510,13 +490,13 @@ public Hl7.Fhir.Model.ResourceReference Practitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Roles which this practitioner may perform. @@ -527,11 +507,11 @@ public Hl7.Fhir.Model.ResourceReference Organization [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Specific specialty of the practitioner. @@ -542,11 +522,11 @@ public List Code [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The location(s) at which this practitioner provides care. @@ -558,11 +538,11 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// The list of healthcare services that this worker provides for this role's Organization/Location(s). @@ -574,11 +554,11 @@ public List Location [DataMember] public List HealthcareService { - get { if(_HealthcareService==null) _HealthcareService = new List(); return _HealthcareService; } + get => _HealthcareService ?? new List(); set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } - private List _HealthcareService; + private List? _HealthcareService; /// /// Contact details that are specific to the role/location/service. @@ -588,11 +568,11 @@ public List HealthcareService [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Times the Service Site is available. @@ -602,11 +582,11 @@ public List Telecom [DataMember] public List AvailableTime { - get { if(_AvailableTime==null) _AvailableTime = new List(); return _AvailableTime; } + get => _AvailableTime ?? new List(); set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } - private List _AvailableTime; + private List? _AvailableTime; /// /// Not available during this time due to provided reason. @@ -616,39 +596,36 @@ public List AvailableTim [DataMember] public List NotAvailable { - get { if(_NotAvailable==null) _NotAvailable = new List(); return _NotAvailable; } + get => _NotAvailable ?? new List(); set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } - private List _NotAvailable; + private List? _NotAvailable; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -663,41 +640,37 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as PractitionerRole; - - if (dest == null) - { + if(other is not PractitionerRole dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Practitioner != null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)Practitioner.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(HealthcareService.Any()) dest.HealthcareService = new List(HealthcareService.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(AvailableTime.Any()) dest.AvailableTime = new List(AvailableTime.DeepCopyInternal()); - if(NotAvailable.Any()) dest.NotAvailable = new List(NotAvailable.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Practitioner is not null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)_Practitioner.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_HealthcareService is not null) dest.HealthcareService = new List(_HealthcareService.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_AvailableTime is not null) dest.AvailableTime = new List(_AvailableTime.DeepCopyInternal()); + if(_NotAvailable is not null) dest.NotAvailable = new List(_NotAvailable.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -709,125 +682,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PractitionerRole; - if(otherT == null) return false; + if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Practitioner, otherT.Practitioner)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(HealthcareService, otherT.HealthcareService)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(AvailableTime, otherT.AvailableTime)) return false; - if(!comparer.ListEquals(NotAvailable, otherT.NotAvailable)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "practitioner": - value = Practitioner; - return Practitioner is not null; + value = _Practitioner; + return _Practitioner is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "healthcareService": - value = HealthcareService; - return HealthcareService?.Any() == true; + value = _HealthcareService; + return _HealthcareService?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "availableTime": - value = AvailableTime; - return AvailableTime?.Any() == true; + value = _AvailableTime; + return _AvailableTime?.Any() == true; case "notAvailable": - value = NotAvailable; - return NotAvailable?.Any() == true; + value = _NotAvailable; + return _NotAvailable?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "practitioner": - Practitioner = (Hl7.Fhir.Model.ResourceReference)value; + Practitioner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "healthcareService": - HealthcareService = (List)value; + HealthcareService = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "availableTime": - AvailableTime = (List)value; + AvailableTime = (List?)value!; return this; case "notAvailable": - NotAvailable = (List)value; + NotAvailable = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -838,20 +811,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Practitioner is not null) yield return new KeyValuePair("practitioner",Practitioner); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",HealthcareService); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",AvailableTime); - if (NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",NotAvailable); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Practitioner is not null) yield return new KeyValuePair("practitioner",_Practitioner); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",_HealthcareService); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",_AvailableTime); + if (_NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",_NotAvailable); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs index 501167be9..a10ffd4da 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Procedure","http://hl7.org/fhir/StructureDefinition/Procedure")] - public partial class Procedure : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Procedure : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -81,13 +84,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("ProcedurePerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// The reference to the practitioner. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Organization the device or practitioner was acting for. @@ -112,27 +115,23 @@ public Hl7.Fhir.Model.ResourceReference Actor [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -144,48 +143,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -196,9 +195,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -225,13 +224,13 @@ public partial class FocalDeviceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("action", Order=40)] [Binding("DeviceActionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Device that was changed. @@ -241,26 +240,22 @@ public Hl7.Fhir.Model.CodeableConcept Action [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manipulated + public Hl7.Fhir.Model.ResourceReference? Manipulated { get { return _Manipulated; } set { _Manipulated = value; OnPropertyChanged("Manipulated"); } } - private Hl7.Fhir.Model.ResourceReference _Manipulated; + private Hl7.Fhir.Model.ResourceReference? _Manipulated; protected internal override void CopyToInternal(Base other) { - var dest = other as FocalDeviceComponent; - - if (dest == null) - { + if(other is not FocalDeviceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(Manipulated != null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)Manipulated.DeepCopyInternal(); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_Manipulated is not null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)_Manipulated.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,41 +267,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocalDeviceComponent; - if(otherT == null) return false; + if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(Manipulated, otherT.Manipulated)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "manipulated": - value = Manipulated; - return Manipulated is not null; + value = _Manipulated; + return _Manipulated is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manipulated": - Manipulated = (Hl7.Fhir.Model.ResourceReference)value; + Manipulated = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -317,8 +312,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (Manipulated is not null) yield return new KeyValuePair("manipulated",Manipulated); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_Manipulated is not null) yield return new KeyValuePair("manipulated",_Manipulated); } } @@ -331,11 +326,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -345,24 +340,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -377,24 +372,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -411,11 +406,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -427,11 +422,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -441,13 +436,13 @@ public List PartOf [Binding("ProcedureStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -456,13 +451,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -473,13 +465,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("statusReason", InSummary=true, Order=150)] [Binding("ProcedureNegationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Classification of the procedure. @@ -487,13 +479,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [FhirElement("category", InSummary=true, Order=160, FiveWs="FiveWs.class")] [Binding("ProcedureCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Identification of the procedure. @@ -501,13 +493,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", InSummary=true, Order=170, FiveWs="FiveWs.what[x]")] [Binding("ProcedureCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the procedure was performed on. @@ -517,13 +509,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -532,13 +524,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the procedure was performed. @@ -547,13 +539,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Performed + public Hl7.Fhir.Model.DataType? Performed { get { return _Performed; } set { _Performed = value; OnPropertyChanged("Performed"); } } - private Hl7.Fhir.Model.DataType _Performed; + private Hl7.Fhir.Model.DataType? _Performed; /// /// Who recorded the procedure. @@ -562,13 +554,13 @@ public Hl7.Fhir.Model.DataType Performed [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Person who asserts this procedure. @@ -577,13 +569,13 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// The people who performed the procedure. @@ -593,11 +585,11 @@ public Hl7.Fhir.Model.ResourceReference Asserter [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the procedure happened. @@ -606,13 +598,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Coded reason procedure performed. @@ -623,11 +615,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// The justification that the procedure was performed. @@ -639,11 +631,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Target body sites. @@ -654,11 +646,11 @@ public List ReasonReference [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// The result of procedure. @@ -666,13 +658,13 @@ public List BodySite [FhirElement("outcome", InSummary=true, Order=280)] [Binding("ProcedureOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Any report resulting from the procedure. @@ -684,11 +676,11 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [DataMember] public List Report { - get { if(_Report==null) _Report = new List(); return _Report; } + get => _Report ?? new List(); set { _Report = value; OnPropertyChanged("Report"); } } - private List _Report; + private List? _Report; /// /// Complication following the procedure. @@ -699,11 +691,11 @@ public List Report [DataMember] public List Complication { - get { if(_Complication==null) _Complication = new List(); return _Complication; } + get => _Complication ?? new List(); set { _Complication = value; OnPropertyChanged("Complication"); } } - private List _Complication; + private List? _Complication; /// /// A condition that is a result of the procedure. @@ -715,11 +707,11 @@ public List Complication [DataMember] public List ComplicationDetail { - get { if(_ComplicationDetail==null) _ComplicationDetail = new List(); return _ComplicationDetail; } + get => _ComplicationDetail ?? new List(); set { _ComplicationDetail = value; OnPropertyChanged("ComplicationDetail"); } } - private List _ComplicationDetail; + private List? _ComplicationDetail; /// /// Instructions for follow up. @@ -730,11 +722,11 @@ public List ComplicationDetail [DataMember] public List FollowUp { - get { if(_FollowUp==null) _FollowUp = new List(); return _FollowUp; } + get => _FollowUp ?? new List(); set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } - private List _FollowUp; + private List? _FollowUp; /// /// Additional information about the procedure. @@ -744,11 +736,11 @@ public List FollowUp [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Manipulated, implanted, or removed device. @@ -758,11 +750,11 @@ public List Note [DataMember] public List FocalDevice { - get { if(_FocalDevice==null) _FocalDevice = new List(); return _FocalDevice; } + get => _FocalDevice ?? new List(); set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } - private List _FocalDevice; + private List? _FocalDevice; /// /// Items used during procedure. @@ -774,11 +766,11 @@ public List FocalDevice [DataMember] public List UsedReference { - get { if(_UsedReference==null) _UsedReference = new List(); return _UsedReference; } + get => _UsedReference ?? new List(); set { _UsedReference = value; OnPropertyChanged("UsedReference"); } } - private List _UsedReference; + private List? _UsedReference; /// /// Coded items used during the procedure. @@ -789,55 +781,51 @@ public List UsedReference [DataMember] public List UsedCode { - get { if(_UsedCode==null) _UsedCode = new List(); return _UsedCode; } + get => _UsedCode ?? new List(); set { _UsedCode = value; OnPropertyChanged("UsedCode"); } } - private List _UsedCode; + private List? _UsedCode; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Procedure; - - if (dest == null) - { + if(other is not Procedure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Performed != null) dest.Performed = (Hl7.Fhir.Model.DataType)Performed.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Report.Any()) dest.Report = new List(Report.DeepCopyInternal()); - if(Complication.Any()) dest.Complication = new List(Complication.DeepCopyInternal()); - if(ComplicationDetail.Any()) dest.ComplicationDetail = new List(ComplicationDetail.DeepCopyInternal()); - if(FollowUp.Any()) dest.FollowUp = new List(FollowUp.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(FocalDevice.Any()) dest.FocalDevice = new List(FocalDevice.DeepCopyInternal()); - if(UsedReference.Any()) dest.UsedReference = new List(UsedReference.DeepCopyInternal()); - if(UsedCode.Any()) dest.UsedCode = new List(UsedCode.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Performed is not null) dest.Performed = (Hl7.Fhir.Model.DataType)_Performed.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Report is not null) dest.Report = new List(_Report.DeepCopyInternal()); + if(_Complication is not null) dest.Complication = new List(_Complication.DeepCopyInternal()); + if(_ComplicationDetail is not null) dest.ComplicationDetail = new List(_ComplicationDetail.DeepCopyInternal()); + if(_FollowUp is not null) dest.FollowUp = new List(_FollowUp.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_FocalDevice is not null) dest.FocalDevice = new List(_FocalDevice.DeepCopyInternal()); + if(_UsedReference is not null) dest.UsedReference = new List(_UsedReference.DeepCopyInternal()); + if(_UsedCode is not null) dest.UsedCode = new List(_UsedCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -849,223 +837,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Procedure; - if(otherT == null) return false; + if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Performed, otherT.Performed)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.ListEquals(Report, otherT.Report)) return false; - if(!comparer.ListEquals(Complication, otherT.Complication)) return false; - if(!comparer.ListEquals(ComplicationDetail, otherT.ComplicationDetail)) return false; - if(!comparer.ListEquals(FollowUp, otherT.FollowUp)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(FocalDevice, otherT.FocalDevice)) return false; - if(!comparer.ListEquals(UsedReference, otherT.UsedReference)) return false; - if(!comparer.ListEquals(UsedCode, otherT.UsedCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Performed, otherT._Performed)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.ListEquals(_Report, otherT._Report)) return false; + if(!comparer.ListEquals(_Complication, otherT._Complication)) return false; + if(!comparer.ListEquals(_ComplicationDetail, otherT._ComplicationDetail)) return false; + if(!comparer.ListEquals(_FollowUp, otherT._FollowUp)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; + if(!comparer.ListEquals(_UsedReference, otherT._UsedReference)) return false; + if(!comparer.ListEquals(_UsedCode, otherT._UsedCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "performed": - value = Performed; - return Performed is not null; + value = _Performed; + return _Performed is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "report": - value = Report; - return Report?.Any() == true; + value = _Report; + return _Report?.Any() == true; case "complication": - value = Complication; - return Complication?.Any() == true; + value = _Complication; + return _Complication?.Any() == true; case "complicationDetail": - value = ComplicationDetail; - return ComplicationDetail?.Any() == true; + value = _ComplicationDetail; + return _ComplicationDetail?.Any() == true; case "followUp": - value = FollowUp; - return FollowUp?.Any() == true; + value = _FollowUp; + return _FollowUp?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "focalDevice": - value = FocalDevice; - return FocalDevice?.Any() == true; + value = _FocalDevice; + return _FocalDevice?.Any() == true; case "usedReference": - value = UsedReference; - return UsedReference?.Any() == true; + value = _UsedReference; + return _UsedReference?.Any() == true; case "usedCode": - value = UsedCode; - return UsedCode?.Any() == true; + value = _UsedCode; + return _UsedCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performed": - Performed = (Hl7.Fhir.Model.DataType)value; + Performed = (Hl7.Fhir.Model.DataType?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "report": - Report = (List)value; + Report = (List?)value!; return this; case "complication": - Complication = (List)value; + Complication = (List?)value!; return this; case "complicationDetail": - ComplicationDetail = (List)value; + ComplicationDetail = (List?)value!; return this; case "followUp": - FollowUp = (List)value; + FollowUp = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "focalDevice": - FocalDevice = (List)value; + FocalDevice = (List?)value!; return this; case "usedReference": - UsedReference = (List)value; + UsedReference = (List?)value!; return this; case "usedCode": - UsedCode = (List)value; + UsedCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1076,34 +1064,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Performed is not null) yield return new KeyValuePair("performed",Performed); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Report?.Any() == true) yield return new KeyValuePair("report",Report); - if (Complication?.Any() == true) yield return new KeyValuePair("complication",Complication); - if (ComplicationDetail?.Any() == true) yield return new KeyValuePair("complicationDetail",ComplicationDetail); - if (FollowUp?.Any() == true) yield return new KeyValuePair("followUp",FollowUp); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",FocalDevice); - if (UsedReference?.Any() == true) yield return new KeyValuePair("usedReference",UsedReference); - if (UsedCode?.Any() == true) yield return new KeyValuePair("usedCode",UsedCode); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Performed is not null) yield return new KeyValuePair("performed",_Performed); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Report?.Any() == true) yield return new KeyValuePair("report",_Report); + if (_Complication?.Any() == true) yield return new KeyValuePair("complication",_Complication); + if (_ComplicationDetail?.Any() == true) yield return new KeyValuePair("complicationDetail",_ComplicationDetail); + if (_FollowUp?.Any() == true) yield return new KeyValuePair("followUp",_FollowUp); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",_FocalDevice); + if (_UsedReference?.Any() == true) yield return new KeyValuePair("usedReference",_UsedReference); + if (_UsedCode?.Any() == true) yield return new KeyValuePair("usedCode",_UsedCode); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs index 48136d566..ca0380bba 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,106 +64,103 @@ public partial class ProdCharacteristic : Hl7.Fhir.Model.BackboneType /// [FhirElement("height", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Height + public Hl7.Fhir.Model.Quantity? Height { get { return _Height; } set { _Height = value; OnPropertyChanged("Height"); } } - private Hl7.Fhir.Model.Quantity _Height; + private Hl7.Fhir.Model.Quantity? _Height; /// /// Where applicable, the width can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("width", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Width + public Hl7.Fhir.Model.Quantity? Width { get { return _Width; } set { _Width = value; OnPropertyChanged("Width"); } } - private Hl7.Fhir.Model.Quantity _Width; + private Hl7.Fhir.Model.Quantity? _Width; /// /// Where applicable, the depth can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("depth", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Depth + public Hl7.Fhir.Model.Quantity? Depth { get { return _Depth; } set { _Depth = value; OnPropertyChanged("Depth"); } } - private Hl7.Fhir.Model.Quantity _Depth; + private Hl7.Fhir.Model.Quantity? _Depth; /// /// Where applicable, the weight can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("weight", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Weight + public Hl7.Fhir.Model.Quantity? Weight { get { return _Weight; } set { _Weight = value; OnPropertyChanged("Weight"); } } - private Hl7.Fhir.Model.Quantity _Weight; + private Hl7.Fhir.Model.Quantity? _Weight; /// /// Where applicable, the nominal volume can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("nominalVolume", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity NominalVolume + public Hl7.Fhir.Model.Quantity? NominalVolume { get { return _NominalVolume; } set { _NominalVolume = value; OnPropertyChanged("NominalVolume"); } } - private Hl7.Fhir.Model.Quantity _NominalVolume; + private Hl7.Fhir.Model.Quantity? _NominalVolume; /// /// Where applicable, the external diameter can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("externalDiameter", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Quantity ExternalDiameter + public Hl7.Fhir.Model.Quantity? ExternalDiameter { get { return _ExternalDiameter; } set { _ExternalDiameter = value; OnPropertyChanged("ExternalDiameter"); } } - private Hl7.Fhir.Model.Quantity _ExternalDiameter; + private Hl7.Fhir.Model.Quantity? _ExternalDiameter; /// /// Where applicable, the shape can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used. /// [FhirElement("shape", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString ShapeElement + public Hl7.Fhir.Model.FhirString? ShapeElement { get { return _ShapeElement; } set { _ShapeElement = value; OnPropertyChanged("ShapeElement"); } } - private Hl7.Fhir.Model.FhirString _ShapeElement; + private Hl7.Fhir.Model.FhirString? _ShapeElement; /// /// Where applicable, the shape can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Shape + public string? Shape { - get { return ShapeElement != null ? ShapeElement.Value : null; } + get => _ShapeElement?.Value; set { - if (value == null) - ShapeElement = null; - else - ShapeElement = new Hl7.Fhir.Model.FhirString(value); + ShapeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Shape"); } } @@ -173,24 +173,24 @@ public string Shape [DataMember] public List ColorElement { - get { if(_ColorElement==null) _ColorElement = new List(); return _ColorElement; } + get => _ColorElement ?? new List(); set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private List _ColorElement; + private List? _ColorElement; /// /// Where applicable, the color can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Color + public IEnumerable? Color { - get { return ColorElement != null ? ColorElement.Select(elem => elem.Value) : null; } + get => _ColorElement?.Select(elem => elem.Value); set { if (value == null) - ColorElement = null; + ColorElement = null!; else ColorElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Color"); @@ -205,24 +205,24 @@ public IEnumerable Color [DataMember] public List ImprintElement { - get { if(_ImprintElement==null) _ImprintElement = new List(); return _ImprintElement; } + get => _ImprintElement ?? new List(); set { _ImprintElement = value; OnPropertyChanged("ImprintElement"); } } - private List _ImprintElement; + private List? _ImprintElement; /// /// Where applicable, the imprint can be specified as text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Imprint + public IEnumerable? Imprint { - get { return ImprintElement != null ? ImprintElement.Select(elem => elem.Value) : null; } + get => _ImprintElement?.Select(elem => elem.Value); set { if (value == null) - ImprintElement = null; + ImprintElement = null!; else ImprintElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Imprint"); @@ -237,46 +237,42 @@ public IEnumerable Imprint [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; /// /// Where applicable, the scoring can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used. /// [FhirElement("scoring", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; protected internal override void CopyToInternal(Base other) { - var dest = other as ProdCharacteristic; - - if (dest == null) - { + if(other is not ProdCharacteristic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Height != null) dest.Height = (Hl7.Fhir.Model.Quantity)Height.DeepCopyInternal(); - if(Width != null) dest.Width = (Hl7.Fhir.Model.Quantity)Width.DeepCopyInternal(); - if(Depth != null) dest.Depth = (Hl7.Fhir.Model.Quantity)Depth.DeepCopyInternal(); - if(Weight != null) dest.Weight = (Hl7.Fhir.Model.Quantity)Weight.DeepCopyInternal(); - if(NominalVolume != null) dest.NominalVolume = (Hl7.Fhir.Model.Quantity)NominalVolume.DeepCopyInternal(); - if(ExternalDiameter != null) dest.ExternalDiameter = (Hl7.Fhir.Model.Quantity)ExternalDiameter.DeepCopyInternal(); - if(ShapeElement != null) dest.ShapeElement = (Hl7.Fhir.Model.FhirString)ShapeElement.DeepCopyInternal(); - if(ColorElement.Any()) dest.ColorElement = new List(ColorElement.DeepCopyInternal()); - if(ImprintElement.Any()) dest.ImprintElement = new List(ImprintElement.DeepCopyInternal()); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); + if(_Height is not null) dest.Height = (Hl7.Fhir.Model.Quantity)_Height.DeepCopyInternal(); + if(_Width is not null) dest.Width = (Hl7.Fhir.Model.Quantity)_Width.DeepCopyInternal(); + if(_Depth is not null) dest.Depth = (Hl7.Fhir.Model.Quantity)_Depth.DeepCopyInternal(); + if(_Weight is not null) dest.Weight = (Hl7.Fhir.Model.Quantity)_Weight.DeepCopyInternal(); + if(_NominalVolume is not null) dest.NominalVolume = (Hl7.Fhir.Model.Quantity)_NominalVolume.DeepCopyInternal(); + if(_ExternalDiameter is not null) dest.ExternalDiameter = (Hl7.Fhir.Model.Quantity)_ExternalDiameter.DeepCopyInternal(); + if(_ShapeElement is not null) dest.ShapeElement = (Hl7.Fhir.Model.FhirString)_ShapeElement.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = new List(_ColorElement.DeepCopyInternal()); + if(_ImprintElement is not null) dest.ImprintElement = new List(_ImprintElement.DeepCopyInternal()); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -288,104 +284,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProdCharacteristic; - if(otherT == null) return false; + if(other is not ProdCharacteristic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Height, otherT.Height)) return false; - if(!comparer.Equals(Width, otherT.Width)) return false; - if(!comparer.Equals(Depth, otherT.Depth)) return false; - if(!comparer.Equals(Weight, otherT.Weight)) return false; - if(!comparer.Equals(NominalVolume, otherT.NominalVolume)) return false; - if(!comparer.Equals(ExternalDiameter, otherT.ExternalDiameter)) return false; - if(!comparer.Equals(ShapeElement, otherT.ShapeElement)) return false; - if(!comparer.ListEquals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.ListEquals(ImprintElement, otherT.ImprintElement)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Height, otherT._Height)) return false; + if(!comparer.Equals(_Width, otherT._Width)) return false; + if(!comparer.Equals(_Depth, otherT._Depth)) return false; + if(!comparer.Equals(_Weight, otherT._Weight)) return false; + if(!comparer.Equals(_NominalVolume, otherT._NominalVolume)) return false; + if(!comparer.Equals(_ExternalDiameter, otherT._ExternalDiameter)) return false; + if(!comparer.Equals(_ShapeElement, otherT._ShapeElement)) return false; + if(!comparer.ListEquals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.ListEquals(_ImprintElement, otherT._ImprintElement)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "height": - value = Height; - return Height is not null; + value = _Height; + return _Height is not null; case "width": - value = Width; - return Width is not null; + value = _Width; + return _Width is not null; case "depth": - value = Depth; - return Depth is not null; + value = _Depth; + return _Depth is not null; case "weight": - value = Weight; - return Weight is not null; + value = _Weight; + return _Weight is not null; case "nominalVolume": - value = NominalVolume; - return NominalVolume is not null; + value = _NominalVolume; + return _NominalVolume is not null; case "externalDiameter": - value = ExternalDiameter; - return ExternalDiameter is not null; + value = _ExternalDiameter; + return _ExternalDiameter is not null; case "shape": - value = ShapeElement; - return ShapeElement is not null; + value = _ShapeElement; + return _ShapeElement is not null; case "color": - value = ColorElement; - return ColorElement?.Any() == true; + value = _ColorElement; + return _ColorElement?.Any() == true; case "imprint": - value = ImprintElement; - return ImprintElement?.Any() == true; + value = _ImprintElement; + return _ImprintElement?.Any() == true; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "height": - Height = (Hl7.Fhir.Model.Quantity)value; + Height = (Hl7.Fhir.Model.Quantity?)value; return this; case "width": - Width = (Hl7.Fhir.Model.Quantity)value; + Width = (Hl7.Fhir.Model.Quantity?)value; return this; case "depth": - Depth = (Hl7.Fhir.Model.Quantity)value; + Depth = (Hl7.Fhir.Model.Quantity?)value; return this; case "weight": - Weight = (Hl7.Fhir.Model.Quantity)value; + Weight = (Hl7.Fhir.Model.Quantity?)value; return this; case "nominalVolume": - NominalVolume = (Hl7.Fhir.Model.Quantity)value; + NominalVolume = (Hl7.Fhir.Model.Quantity?)value; return this; case "externalDiameter": - ExternalDiameter = (Hl7.Fhir.Model.Quantity)value; + ExternalDiameter = (Hl7.Fhir.Model.Quantity?)value; return this; case "shape": - ShapeElement = (Hl7.Fhir.Model.FhirString)value; + ShapeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "color": - ColorElement = (List)value; + ColorElement = (List?)value!; return this; case "imprint": - ImprintElement = (List)value; + ImprintElement = (List?)value!; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -396,17 +392,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Height is not null) yield return new KeyValuePair("height",Height); - if (Width is not null) yield return new KeyValuePair("width",Width); - if (Depth is not null) yield return new KeyValuePair("depth",Depth); - if (Weight is not null) yield return new KeyValuePair("weight",Weight); - if (NominalVolume is not null) yield return new KeyValuePair("nominalVolume",NominalVolume); - if (ExternalDiameter is not null) yield return new KeyValuePair("externalDiameter",ExternalDiameter); - if (ShapeElement is not null) yield return new KeyValuePair("shape",ShapeElement); - if (ColorElement?.Any() == true) yield return new KeyValuePair("color",ColorElement); - if (ImprintElement?.Any() == true) yield return new KeyValuePair("imprint",ImprintElement); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); + if (_Height is not null) yield return new KeyValuePair("height",_Height); + if (_Width is not null) yield return new KeyValuePair("width",_Width); + if (_Depth is not null) yield return new KeyValuePair("depth",_Depth); + if (_Weight is not null) yield return new KeyValuePair("weight",_Weight); + if (_NominalVolume is not null) yield return new KeyValuePair("nominalVolume",_NominalVolume); + if (_ExternalDiameter is not null) yield return new KeyValuePair("externalDiameter",_ExternalDiameter); + if (_ShapeElement is not null) yield return new KeyValuePair("shape",_ShapeElement); + if (_ColorElement?.Any() == true) yield return new KeyValuePair("color",_ColorElement); + if (_ImprintElement?.Any() == true) yield return new KeyValuePair("imprint",_ImprintElement); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs index fffaf79a9..66d285163 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,13 +64,13 @@ public partial class ProductShelfLife : Hl7.Fhir.Model.BackboneType /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// This describes the shelf life, taking into account various scenarios such as shelf life of the packaged Medicinal Product itself, shelf life after transformation where necessary and shelf life after the first opening of a bottle, etc. The shelf life type shall be specified using an appropriate controlled vocabulary The controlled term and the controlled term identifier shall be specified. @@ -75,13 +78,13 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("type", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The shelf life time period can be specified using a numerical value for the period of time and its unit of time measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. @@ -89,13 +92,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("period", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Period + public Hl7.Fhir.Model.Quantity? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Quantity _Period; + private Hl7.Fhir.Model.Quantity? _Period; /// /// Special precautions for storage, if any, can be specified using an appropriate controlled vocabulary The controlled term and the controlled term identifier shall be specified. @@ -105,26 +108,22 @@ public Hl7.Fhir.Model.Quantity Period [DataMember] public List SpecialPrecautionsForStorage { - get { if(_SpecialPrecautionsForStorage==null) _SpecialPrecautionsForStorage = new List(); return _SpecialPrecautionsForStorage; } + get => _SpecialPrecautionsForStorage ?? new List(); set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } - private List _SpecialPrecautionsForStorage; + private List? _SpecialPrecautionsForStorage; protected internal override void CopyToInternal(Base other) { - var dest = other as ProductShelfLife; - - if (dest == null) - { + if(other is not ProductShelfLife dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Quantity)Period.DeepCopyInternal(); - if(SpecialPrecautionsForStorage.Any()) dest.SpecialPrecautionsForStorage = new List(SpecialPrecautionsForStorage.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Quantity)_Period.DeepCopyInternal(); + if(_SpecialPrecautionsForStorage is not null) dest.SpecialPrecautionsForStorage = new List(_SpecialPrecautionsForStorage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -136,55 +135,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProductShelfLife; - if(otherT == null) return false; + if(other is not ProductShelfLife otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(SpecialPrecautionsForStorage, otherT.SpecialPrecautionsForStorage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "specialPrecautionsForStorage": - value = SpecialPrecautionsForStorage; - return SpecialPrecautionsForStorage?.Any() == true; + value = _SpecialPrecautionsForStorage; + return _SpecialPrecautionsForStorage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Quantity)value; + Period = (Hl7.Fhir.Model.Quantity?)value; return this; case "specialPrecautionsForStorage": - SpecialPrecautionsForStorage = (List)value; + SpecialPrecautionsForStorage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -195,10 +194,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",SpecialPrecautionsForStorage); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",_SpecialPrecautionsForStorage); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs index 73404d6d4..f0e015489 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -123,13 +126,13 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("ProvenanceAgentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// What the agents role was. @@ -140,11 +143,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Who participated. @@ -154,13 +157,13 @@ public List Role [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Who the agent is representing. @@ -169,28 +172,24 @@ public Hl7.Fhir.Model.ResourceReference Who [CLSCompliant(false)] [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -202,55 +201,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -261,10 +260,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -290,13 +289,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProvenanceEntityRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RoleElement + public Code? RoleElement { get { return _RoleElement; } set { _RoleElement = value; OnPropertyChanged("RoleElement"); } } - private Code _RoleElement; + private Code? _RoleElement; /// /// derivation | revision | quotation | source | removal @@ -305,13 +304,10 @@ public Code RoleElement [IgnoreDataMember] public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role { - get { return RoleElement != null ? RoleElement.Value : null; } + get => _RoleElement?.Value; set { - if (value == null) - RoleElement = null; - else - RoleElement = new Code(value); + RoleElement = value is null ? null : new Code(value); OnPropertyChanged("Role"); } } @@ -324,13 +320,13 @@ public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference What + public Hl7.Fhir.Model.ResourceReference? What { get { return _What; } set { _What = value; OnPropertyChanged("What"); } } - private Hl7.Fhir.Model.ResourceReference _What; + private Hl7.Fhir.Model.ResourceReference? _What; /// /// Entity is attributed to this agent. @@ -340,25 +336,21 @@ public Hl7.Fhir.Model.ResourceReference What [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RoleElement != null) dest.RoleElement = (Code)RoleElement.DeepCopyInternal(); - if(What != null) dest.What = (Hl7.Fhir.Model.ResourceReference)What.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); + if(_RoleElement is not null) dest.RoleElement = (Code)_RoleElement.DeepCopyInternal(); + if(_What is not null) dest.What = (Hl7.Fhir.Model.ResourceReference)_What.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -370,48 +362,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RoleElement, otherT.RoleElement)) return false; - if(!comparer.Equals(What, otherT.What)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + if(!comparer.Equals(_What, otherT._What)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = RoleElement; - return RoleElement is not null; + value = _RoleElement; + return _RoleElement is not null; case "what": - value = What; - return What is not null; + value = _What; + return _What is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - RoleElement = (Code)value; + RoleElement = (Code?)value; return this; case "what": - What = (Hl7.Fhir.Model.ResourceReference)value; + What = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -422,9 +414,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RoleElement is not null) yield return new KeyValuePair("role",RoleElement); - if (What is not null) yield return new KeyValuePair("what",What); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); + if (_RoleElement is not null) yield return new KeyValuePair("role",_RoleElement); + if (_What is not null) yield return new KeyValuePair("what",_What); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); } } @@ -439,11 +431,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// When the activity occurred. @@ -452,13 +444,13 @@ public List Target [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Occurred + public Hl7.Fhir.Model.DataType? Occurred { get { return _Occurred; } set { _Occurred = value; OnPropertyChanged("Occurred"); } } - private Hl7.Fhir.Model.DataType _Occurred; + private Hl7.Fhir.Model.DataType? _Occurred; /// /// When the activity was recorded / updated. @@ -466,13 +458,13 @@ public Hl7.Fhir.Model.DataType Occurred [FhirElement("recorded", InSummary=true, Order=110, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// When the activity was recorded / updated @@ -481,13 +473,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -500,24 +489,24 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy or plan the activity was defined by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -531,13 +520,13 @@ public IEnumerable Policy [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Reason the activity is occurring. @@ -548,11 +537,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Activity that occurred. @@ -560,13 +549,13 @@ public List Reason [FhirElement("activity", Order=150, FiveWs="FiveWs.why[x]")] [Binding("ProvenanceActivity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Activity + public Hl7.Fhir.Model.CodeableConcept? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.CodeableConcept _Activity; + private Hl7.Fhir.Model.CodeableConcept? _Activity; /// /// Actor involved. @@ -576,11 +565,11 @@ public Hl7.Fhir.Model.CodeableConcept Activity [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// An entity used in this activity. @@ -590,11 +579,11 @@ public List Agent [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; /// /// Signature on target. @@ -604,32 +593,28 @@ public List Entity [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as Provenance; - - if (dest == null) - { + if(other is not Provenance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Occurred != null) dest.Occurred = (Hl7.Fhir.Model.DataType)Occurred.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Occurred is not null) dest.Occurred = (Hl7.Fhir.Model.DataType)_Occurred.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)_Activity.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -641,97 +626,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Provenance; - if(otherT == null) return false; + if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.Equals(Occurred, otherT.Occurred)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Occurred, otherT._Occurred)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "occurred": - value = Occurred; - return Occurred is not null; + value = _Occurred; + return _Occurred is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (List)value; + Target = (List?)value!; return this; case "occurred": - Occurred = (Hl7.Fhir.Model.DataType)value; + Occurred = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "activity": - Activity = (Hl7.Fhir.Model.CodeableConcept)value; + Activity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -742,16 +727,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Occurred is not null) yield return new KeyValuePair("occurred",Occurred); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Occurred is not null) yield return new KeyValuePair("occurred",_Occurred); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs index 046412a34..9eae64631 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Questionnaire","http://hl7.org/fhir/StructureDefinition/Questionnaire")] - public partial class Questionnaire : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Questionnaire : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -262,28 +265,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for item in questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -293,28 +293,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -328,39 +325,36 @@ public string Definition [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// E.g. "1(a)", "2.5.3". /// [FhirElement("prefix", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// E.g. "1(a)", "2.5.3" /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -370,28 +364,25 @@ public string Prefix /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Primary text for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -404,13 +395,13 @@ public string Text [Binding("QuestionnaireItemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// group | display | boolean | decimal | integer | date | dateTime + @@ -419,13 +410,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -438,11 +426,11 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get { if(_EnableWhen==null) _EnableWhen = new List(); return _EnableWhen; } + get => _EnableWhen ?? new List(); set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } - private List _EnableWhen; + private List? _EnableWhen; /// /// all | any. @@ -451,13 +439,13 @@ public List EnableWhen [DeclaredType(Type = typeof(Code))] [Binding("EnableWhenBehavior")] [DataMember] - public Code EnableBehaviorElement + public Code? EnableBehaviorElement { get { return _EnableBehaviorElement; } set { _EnableBehaviorElement = value; OnPropertyChanged("EnableBehaviorElement"); } } - private Code _EnableBehaviorElement; + private Code? _EnableBehaviorElement; /// /// all | any @@ -466,13 +454,10 @@ public Code EnableBehaviorEleme [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.EnableWhenBehavior? EnableBehavior { - get { return EnableBehaviorElement != null ? EnableBehaviorElement.Value : null; } + get => _EnableBehaviorElement?.Value; set { - if (value == null) - EnableBehaviorElement = null; - else - EnableBehaviorElement = new Code(value); + EnableBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("EnableBehavior"); } } @@ -482,13 +467,13 @@ public Hl7.Fhir.Model.Questionnaire.EnableWhenBehavior? EnableBehavior /// [FhirElement("required", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Whether the item must be included in data results @@ -497,13 +482,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -513,13 +495,13 @@ public bool? Required /// [FhirElement("repeats", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RepeatsElement + public Hl7.Fhir.Model.FhirBoolean? RepeatsElement { get { return _RepeatsElement; } set { _RepeatsElement = value; OnPropertyChanged("RepeatsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RepeatsElement; + private Hl7.Fhir.Model.FhirBoolean? _RepeatsElement; /// /// Whether the item may repeat @@ -528,13 +510,10 @@ public Hl7.Fhir.Model.FhirBoolean RepeatsElement [IgnoreDataMember] public bool? Repeats { - get { return RepeatsElement != null ? RepeatsElement.Value : null; } + get => _RepeatsElement?.Value; set { - if (value == null) - RepeatsElement = null; - else - RepeatsElement = new Hl7.Fhir.Model.FhirBoolean(value); + RepeatsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Repeats"); } } @@ -544,13 +523,13 @@ public bool? Repeats /// [FhirElement("readOnly", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement + public Hl7.Fhir.Model.FhirBoolean? ReadOnlyElement { get { return _ReadOnlyElement; } set { _ReadOnlyElement = value; OnPropertyChanged("ReadOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReadOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _ReadOnlyElement; /// /// Don't allow human editing @@ -559,13 +538,10 @@ public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement [IgnoreDataMember] public bool? ReadOnly { - get { return ReadOnlyElement != null ? ReadOnlyElement.Value : null; } + get => _ReadOnlyElement?.Value; set { - if (value == null) - ReadOnlyElement = null; - else - ReadOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReadOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReadOnly"); } } @@ -575,13 +551,13 @@ public bool? ReadOnly /// [FhirElement("maxLength", Order=150)] [DataMember] - public Hl7.Fhir.Model.Integer MaxLengthElement + public Hl7.Fhir.Model.Integer? MaxLengthElement { get { return _MaxLengthElement; } set { _MaxLengthElement = value; OnPropertyChanged("MaxLengthElement"); } } - private Hl7.Fhir.Model.Integer _MaxLengthElement; + private Hl7.Fhir.Model.Integer? _MaxLengthElement; /// /// No more than this many characters @@ -590,13 +566,10 @@ public Hl7.Fhir.Model.Integer MaxLengthElement [IgnoreDataMember] public int? MaxLength { - get { return MaxLengthElement != null ? MaxLengthElement.Value : null; } + get => _MaxLengthElement?.Value; set { - if (value == null) - MaxLengthElement = null; - else - MaxLengthElement = new Hl7.Fhir.Model.Integer(value); + MaxLengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("MaxLength"); } } @@ -606,28 +579,25 @@ public int? MaxLength /// [FhirElement("answerValueSet", Order=160)] [DataMember] - public Hl7.Fhir.Model.Canonical AnswerValueSetElement + public Hl7.Fhir.Model.Canonical? AnswerValueSetElement { get { return _AnswerValueSetElement; } set { _AnswerValueSetElement = value; OnPropertyChanged("AnswerValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _AnswerValueSetElement; + private Hl7.Fhir.Model.Canonical? _AnswerValueSetElement; /// /// Valueset containing permitted answers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AnswerValueSet + public string? AnswerValueSet { - get { return AnswerValueSetElement != null ? AnswerValueSetElement.Value : null; } + get => _AnswerValueSetElement?.Value; set { - if (value == null) - AnswerValueSetElement = null; - else - AnswerValueSetElement = new Hl7.Fhir.Model.Canonical(value); + AnswerValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("AnswerValueSet"); } } @@ -640,11 +610,11 @@ public string AnswerValueSet [DataMember] public List AnswerOption { - get { if(_AnswerOption==null) _AnswerOption = new List(); return _AnswerOption; } + get => _AnswerOption ?? new List(); set { _AnswerOption = value; OnPropertyChanged("AnswerOption"); } } - private List _AnswerOption; + private List? _AnswerOption; /// /// Initial value(s) when item is first rendered. @@ -654,11 +624,11 @@ public List AnswerOption [DataMember] public List Initial { - get { if(_Initial==null) _Initial = new List(); return _Initial; } + get => _Initial ?? new List(); set { _Initial = value; OnPropertyChanged("Initial"); } } - private List _Initial; + private List? _Initial; /// /// Nested questionnaire items. @@ -668,38 +638,34 @@ public List Initial [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EnableWhen.Any()) dest.EnableWhen = new List(EnableWhen.DeepCopyInternal()); - if(EnableBehaviorElement != null) dest.EnableBehaviorElement = (Code)EnableBehaviorElement.DeepCopyInternal(); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(RepeatsElement != null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)RepeatsElement.DeepCopyInternal(); - if(ReadOnlyElement != null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)ReadOnlyElement.DeepCopyInternal(); - if(MaxLengthElement != null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)MaxLengthElement.DeepCopyInternal(); - if(AnswerValueSetElement != null) dest.AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)AnswerValueSetElement.DeepCopyInternal(); - if(AnswerOption.Any()) dest.AnswerOption = new List(AnswerOption.DeepCopyInternal()); - if(Initial.Any()) dest.Initial = new List(Initial.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EnableWhen is not null) dest.EnableWhen = new List(_EnableWhen.DeepCopyInternal()); + if(_EnableBehaviorElement is not null) dest.EnableBehaviorElement = (Code)_EnableBehaviorElement.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_RepeatsElement is not null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)_RepeatsElement.DeepCopyInternal(); + if(_ReadOnlyElement is not null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_ReadOnlyElement.DeepCopyInternal(); + if(_MaxLengthElement is not null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)_MaxLengthElement.DeepCopyInternal(); + if(_AnswerValueSetElement is not null) dest.AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)_AnswerValueSetElement.DeepCopyInternal(); + if(_AnswerOption is not null) dest.AnswerOption = new List(_AnswerOption.DeepCopyInternal()); + if(_Initial is not null) dest.Initial = new List(_Initial.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -711,139 +677,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(EnableWhen, otherT.EnableWhen)) return false; - if(!comparer.Equals(EnableBehaviorElement, otherT.EnableBehaviorElement)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(RepeatsElement, otherT.RepeatsElement)) return false; - if(!comparer.Equals(ReadOnlyElement, otherT.ReadOnlyElement)) return false; - if(!comparer.Equals(MaxLengthElement, otherT.MaxLengthElement)) return false; - if(!comparer.Equals(AnswerValueSetElement, otherT.AnswerValueSetElement)) return false; - if(!comparer.ListEquals(AnswerOption, otherT.AnswerOption)) return false; - if(!comparer.ListEquals(Initial, otherT.Initial)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_EnableWhen, otherT._EnableWhen)) return false; + if(!comparer.Equals(_EnableBehaviorElement, otherT._EnableBehaviorElement)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_RepeatsElement, otherT._RepeatsElement)) return false; + if(!comparer.Equals(_ReadOnlyElement, otherT._ReadOnlyElement)) return false; + if(!comparer.Equals(_MaxLengthElement, otherT._MaxLengthElement)) return false; + if(!comparer.Equals(_AnswerValueSetElement, otherT._AnswerValueSetElement)) return false; + if(!comparer.ListEquals(_AnswerOption, otherT._AnswerOption)) return false; + if(!comparer.ListEquals(_Initial, otherT._Initial)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "enableWhen": - value = EnableWhen; - return EnableWhen?.Any() == true; + value = _EnableWhen; + return _EnableWhen?.Any() == true; case "enableBehavior": - value = EnableBehaviorElement; - return EnableBehaviorElement is not null; + value = _EnableBehaviorElement; + return _EnableBehaviorElement is not null; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "repeats": - value = RepeatsElement; - return RepeatsElement is not null; + value = _RepeatsElement; + return _RepeatsElement is not null; case "readOnly": - value = ReadOnlyElement; - return ReadOnlyElement is not null; + value = _ReadOnlyElement; + return _ReadOnlyElement is not null; case "maxLength": - value = MaxLengthElement; - return MaxLengthElement is not null; + value = _MaxLengthElement; + return _MaxLengthElement is not null; case "answerValueSet": - value = AnswerValueSetElement; - return AnswerValueSetElement is not null; + value = _AnswerValueSetElement; + return _AnswerValueSetElement is not null; case "answerOption": - value = AnswerOption; - return AnswerOption?.Any() == true; + value = _AnswerOption; + return _AnswerOption?.Any() == true; case "initial": - value = Initial; - return Initial?.Any() == true; + value = _Initial; + return _Initial?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "enableWhen": - EnableWhen = (List)value; + EnableWhen = (List?)value!; return this; case "enableBehavior": - EnableBehaviorElement = (Code)value; + EnableBehaviorElement = (Code?)value; return this; case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "repeats": - RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)value; + RepeatsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "readOnly": - ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "maxLength": - MaxLengthElement = (Hl7.Fhir.Model.Integer)value; + MaxLengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "answerValueSet": - AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)value; + AnswerValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "answerOption": - AnswerOption = (List)value; + AnswerOption = (List?)value!; return this; case "initial": - Initial = (List)value; + Initial = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -854,22 +820,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",EnableWhen); - if (EnableBehaviorElement is not null) yield return new KeyValuePair("enableBehavior",EnableBehaviorElement); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (RepeatsElement is not null) yield return new KeyValuePair("repeats",RepeatsElement); - if (ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",ReadOnlyElement); - if (MaxLengthElement is not null) yield return new KeyValuePair("maxLength",MaxLengthElement); - if (AnswerValueSetElement is not null) yield return new KeyValuePair("answerValueSet",AnswerValueSetElement); - if (AnswerOption?.Any() == true) yield return new KeyValuePair("answerOption",AnswerOption); - if (Initial?.Any() == true) yield return new KeyValuePair("initial",Initial); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",_EnableWhen); + if (_EnableBehaviorElement is not null) yield return new KeyValuePair("enableBehavior",_EnableBehaviorElement); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_RepeatsElement is not null) yield return new KeyValuePair("repeats",_RepeatsElement); + if (_ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",_ReadOnlyElement); + if (_MaxLengthElement is not null) yield return new KeyValuePair("maxLength",_MaxLengthElement); + if (_AnswerValueSetElement is not null) yield return new KeyValuePair("answerValueSet",_AnswerValueSetElement); + if (_AnswerOption?.Any() == true) yield return new KeyValuePair("answerOption",_AnswerOption); + if (_Initial?.Any() == true) yield return new KeyValuePair("initial",_Initial); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -897,28 +863,25 @@ public partial class EnableWhenComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("question", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString QuestionElement + public Hl7.Fhir.Model.FhirString? QuestionElement { get { return _QuestionElement; } set { _QuestionElement = value; OnPropertyChanged("QuestionElement"); } } - private Hl7.Fhir.Model.FhirString _QuestionElement; + private Hl7.Fhir.Model.FhirString? _QuestionElement; /// /// Question that determines whether item is enabled /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Question + public string? Question { - get { return QuestionElement != null ? QuestionElement.Value : null; } + get => _QuestionElement?.Value; set { - if (value == null) - QuestionElement = null; - else - QuestionElement = new Hl7.Fhir.Model.FhirString(value); + QuestionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Question"); } } @@ -931,13 +894,13 @@ public string Question [Binding("QuestionnaireItemOperator")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OperatorElement + public Code? OperatorElement { get { return _OperatorElement; } set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private Code _OperatorElement; + private Code? _OperatorElement; /// /// exists | = | != | > | < | >= | <= @@ -946,13 +909,10 @@ public Code OperatorElem [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemOperator? Operator { - get { return OperatorElement != null ? OperatorElement.Value : null; } + get => _OperatorElement?.Value; set { - if (value == null) - OperatorElement = null; - else - OperatorElement = new Code(value); + OperatorElement = value is null ? null : new Code(value); OnPropertyChanged("Operator"); } } @@ -967,27 +927,23 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemOperator? Operator [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Answer + public Hl7.Fhir.Model.DataType? Answer { get { return _Answer; } set { _Answer = value; OnPropertyChanged("Answer"); } } - private Hl7.Fhir.Model.DataType _Answer; + private Hl7.Fhir.Model.DataType? _Answer; protected internal override void CopyToInternal(Base other) { - var dest = other as EnableWhenComponent; - - if (dest == null) - { + if(other is not EnableWhenComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(QuestionElement != null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)QuestionElement.DeepCopyInternal(); - if(OperatorElement != null) dest.OperatorElement = (Code)OperatorElement.DeepCopyInternal(); - if(Answer != null) dest.Answer = (Hl7.Fhir.Model.DataType)Answer.DeepCopyInternal(); + if(_QuestionElement is not null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)_QuestionElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = (Code)_OperatorElement.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = (Hl7.Fhir.Model.DataType)_Answer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -999,48 +955,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnableWhenComponent; - if(otherT == null) return false; + if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(QuestionElement, otherT.QuestionElement)) return false; - if(!comparer.Equals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(Answer, otherT.Answer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_Answer, otherT._Answer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "question": - value = QuestionElement; - return QuestionElement is not null; + value = _QuestionElement; + return _QuestionElement is not null; case "operator": - value = OperatorElement; - return OperatorElement is not null; + value = _OperatorElement; + return _OperatorElement is not null; case "answer": - value = Answer; - return Answer is not null; + value = _Answer; + return _Answer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "question": - QuestionElement = (Hl7.Fhir.Model.FhirString)value; + QuestionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "operator": - OperatorElement = (Code)value; + OperatorElement = (Code?)value; return this; case "answer": - Answer = (Hl7.Fhir.Model.DataType)value; + Answer = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1051,9 +1007,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (QuestionElement is not null) yield return new KeyValuePair("question",QuestionElement); - if (OperatorElement is not null) yield return new KeyValuePair("operator",OperatorElement); - if (Answer is not null) yield return new KeyValuePair("answer",Answer); + if (_QuestionElement is not null) yield return new KeyValuePair("question",_QuestionElement); + if (_OperatorElement is not null) yield return new KeyValuePair("operator",_OperatorElement); + if (_Answer is not null) yield return new KeyValuePair("answer",_Answer); } } @@ -1085,26 +1041,26 @@ public partial class AnswerOptionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Whether option is selected by default. /// [FhirElement("initialSelected", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InitialSelectedElement + public Hl7.Fhir.Model.FhirBoolean? InitialSelectedElement { get { return _InitialSelectedElement; } set { _InitialSelectedElement = value; OnPropertyChanged("InitialSelectedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InitialSelectedElement; + private Hl7.Fhir.Model.FhirBoolean? _InitialSelectedElement; /// /// Whether option is selected by default @@ -1113,29 +1069,22 @@ public Hl7.Fhir.Model.FhirBoolean InitialSelectedElement [IgnoreDataMember] public bool? InitialSelected { - get { return InitialSelectedElement != null ? InitialSelectedElement.Value : null; } + get => _InitialSelectedElement?.Value; set { - if (value == null) - InitialSelectedElement = null; - else - InitialSelectedElement = new Hl7.Fhir.Model.FhirBoolean(value); + InitialSelectedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("InitialSelected"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerOptionComponent; - - if (dest == null) - { + if(other is not AnswerOptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(InitialSelectedElement != null) dest.InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)InitialSelectedElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_InitialSelectedElement is not null) dest.InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)_InitialSelectedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1147,41 +1096,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerOptionComponent; - if(otherT == null) return false; + if(other is not AnswerOptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(InitialSelectedElement, otherT.InitialSelectedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_InitialSelectedElement, otherT._InitialSelectedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "initialSelected": - value = InitialSelectedElement; - return InitialSelectedElement is not null; + value = _InitialSelectedElement; + return _InitialSelectedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "initialSelected": - InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)value; + InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1192,8 +1141,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (InitialSelectedElement is not null) yield return new KeyValuePair("initialSelected",InitialSelectedElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_InitialSelectedElement is not null) yield return new KeyValuePair("initialSelected",_InitialSelectedElement); } } @@ -1225,25 +1174,21 @@ public partial class InitialComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as InitialComponent; - - if (dest == null) - { + if(other is not InitialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1255,34 +1200,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InitialComponent; - if(otherT == null) return false; + if(other is not InitialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1293,7 +1238,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1303,28 +1248,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this questionnaire, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1337,39 +1279,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the questionnaire. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1379,28 +1318,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this questionnaire (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1410,28 +1346,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this questionnaire (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1444,24 +1377,24 @@ public string Title [DataMember] public List DerivedFromElement { - get { if(_DerivedFromElement==null) _DerivedFromElement = new List(); return _DerivedFromElement; } + get => _DerivedFromElement ?? new List(); set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private List _DerivedFromElement; + private List? _DerivedFromElement; /// /// Instantiates protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFrom + public IEnumerable? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Select(elem => elem.Value) : null; } + get => _DerivedFromElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromElement = null; + DerivedFromElement = null!; else DerivedFromElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFrom"); @@ -1476,13 +1409,13 @@ public IEnumerable DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1491,13 +1424,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1507,13 +1437,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1522,13 +1452,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1543,24 +1470,24 @@ public bool? Experimental [DataMember] public List> SubjectTypeElement { - get { if(_SubjectTypeElement==null) _SubjectTypeElement = new List>(); return _SubjectTypeElement; } + get => _SubjectTypeElement ?? new List>(); set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } - private List> _SubjectTypeElement; + private List>? _SubjectTypeElement; /// /// Resource that can be subject of QuestionnaireResponse /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubjectType + public IEnumerable? SubjectType { - get { return SubjectTypeElement != null ? SubjectTypeElement.Select(elem => elem.Value) : null; } + get => _SubjectTypeElement?.Select(elem => elem.Value); set { if (value == null) - SubjectTypeElement = null; + SubjectTypeElement = null!; else SubjectTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("SubjectType"); @@ -1572,28 +1499,25 @@ public IEnumerable SubjectType /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1603,28 +1527,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1637,39 +1558,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the questionnaire. /// [FhirElement("description", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1682,11 +1600,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for questionnaire (if applicable). @@ -1697,39 +1615,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this questionnaire is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this questionnaire is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1739,28 +1654,25 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1770,28 +1682,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the questionnaire was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1801,28 +1710,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the questionnaire was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1832,13 +1738,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Concept that represents the overall questionnaire. @@ -1849,11 +1755,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Questions and sections within the Questionnaire. @@ -1863,49 +1769,45 @@ public List Code [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.FhirString ICoded.Code { get => NameElement; set => NameElement = value; } - IEnumerable ICoded.ToCodings() => NameElement.ToCodings(); + Hl7.Fhir.Model.FhirString? ICoded.Code { get => NameElement; set => NameElement = value!; } + IEnumerable ICoded.ToCodings() => NameElement?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Questionnaire; - - if (dest == null) - { + if(other is not Questionnaire dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromElement.Any()) dest.DerivedFromElement = new List(DerivedFromElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(SubjectTypeElement.Any()) dest.SubjectTypeElement = new List>(SubjectTypeElement.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = new List(_DerivedFromElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_SubjectTypeElement is not null) dest.SubjectTypeElement = new List>(_SubjectTypeElement.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1917,181 +1819,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Questionnaire; - if(otherT == null) return false; + if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.ListEquals(SubjectTypeElement, otherT.SubjectTypeElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.ListEquals(_SubjectTypeElement, otherT._SubjectTypeElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement?.Any() == true; + value = _DerivedFromElement; + return _DerivedFromElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subjectType": - value = SubjectTypeElement; - return SubjectTypeElement?.Any() == true; + value = _SubjectTypeElement; + return _SubjectTypeElement?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (List)value; + DerivedFromElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subjectType": - SubjectTypeElement = (List>)value; + SubjectTypeElement = (List>?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2102,28 +2004,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",SubjectTypeElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",_SubjectTypeElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs index cd7962400..567e90946 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("QuestionnaireResponse","http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse")] - public partial class QuestionnaireResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class QuestionnaireResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -123,28 +126,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific item from Questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -154,28 +154,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -185,28 +182,25 @@ public string Definition /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Name for group or question text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -219,11 +213,11 @@ public string Text [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Nested questionnaire response items. @@ -233,27 +227,23 @@ public List Answer [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -265,62 +255,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -331,11 +321,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -366,13 +356,13 @@ public partial class AnswerComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Nested groups and questions. @@ -382,24 +372,20 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerComponent; - - if (dest == null) - { + if(other is not AnswerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -411,41 +397,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerComponent; - if(otherT == null) return false; + if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -456,8 +442,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -467,13 +453,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Request fulfilled by this QuestionnaireResponse. @@ -485,11 +471,11 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of this action. @@ -501,39 +487,36 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Form being answered. /// [FhirElement("questionnaire", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Canonical QuestionnaireElement + public Hl7.Fhir.Model.Canonical? QuestionnaireElement { get { return _QuestionnaireElement; } set { _QuestionnaireElement = value; OnPropertyChanged("QuestionnaireElement"); } } - private Hl7.Fhir.Model.Canonical _QuestionnaireElement; + private Hl7.Fhir.Model.Canonical? _QuestionnaireElement; /// /// Form being answered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Questionnaire + public string? Questionnaire { - get { return QuestionnaireElement != null ? QuestionnaireElement.Value : null; } + get => _QuestionnaireElement?.Value; set { - if (value == null) - QuestionnaireElement = null; - else - QuestionnaireElement = new Hl7.Fhir.Model.Canonical(value); + QuestionnaireElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Questionnaire"); } } @@ -546,13 +529,13 @@ public string Questionnaire [Binding("QuestionnaireResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | amended | entered-in-error | stopped @@ -561,13 +544,10 @@ public Code St [IgnoreDataMember] public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -579,13 +559,13 @@ public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -594,41 +574,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Date the answers were gathered. /// [FhirElement("authored", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredElement { get { return _AuthoredElement; } set { _AuthoredElement = value; OnPropertyChanged("AuthoredElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredElement; /// /// Date the answers were gathered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authored + public string? Authored { - get { return AuthoredElement != null ? AuthoredElement.Value : null; } + get => _AuthoredElement?.Value; set { - if (value == null) - AuthoredElement = null; - else - AuthoredElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Authored"); } } @@ -640,13 +617,13 @@ public string Authored [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole","Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// The person who answered the questions. @@ -655,13 +632,13 @@ public Hl7.Fhir.Model.ResourceReference Author [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Groups and questions. @@ -671,35 +648,31 @@ public Hl7.Fhir.Model.ResourceReference Source [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as QuestionnaireResponse; - - if (dest == null) - { + if(other is not QuestionnaireResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(QuestionnaireElement != null) dest.QuestionnaireElement = (Hl7.Fhir.Model.Canonical)QuestionnaireElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(AuthoredElement != null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_QuestionnaireElement is not null) dest.QuestionnaireElement = (Hl7.Fhir.Model.Canonical)_QuestionnaireElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_AuthoredElement is not null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -711,104 +684,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QuestionnaireResponse; - if(otherT == null) return false; + if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(QuestionnaireElement, otherT.QuestionnaireElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(AuthoredElement, otherT.AuthoredElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_QuestionnaireElement, otherT._QuestionnaireElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_AuthoredElement, otherT._AuthoredElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "questionnaire": - value = QuestionnaireElement; - return QuestionnaireElement is not null; + value = _QuestionnaireElement; + return _QuestionnaireElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "authored": - value = AuthoredElement; - return AuthoredElement is not null; + value = _AuthoredElement; + return _AuthoredElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "questionnaire": - QuestionnaireElement = (Hl7.Fhir.Model.Canonical)value; + QuestionnaireElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authored": - AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -819,17 +792,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (QuestionnaireElement is not null) yield return new KeyValuePair("questionnaire",QuestionnaireElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (AuthoredElement is not null) yield return new KeyValuePair("authored",AuthoredElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_QuestionnaireElement is not null) yield return new KeyValuePair("questionnaire",_QuestionnaireElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_AuthoredElement is not null) yield return new KeyValuePair("authored",_AuthoredElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs b/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs index 0930eb997..dd9fff02e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -65,39 +68,35 @@ public partial class Ratio : Hl7.Fhir.Model.DataType /// [FhirElement("numerator", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity Numerator + public Hl7.Fhir.Model.Quantity? Numerator { get { return _Numerator; } set { _Numerator = value; OnPropertyChanged("Numerator"); } } - private Hl7.Fhir.Model.Quantity _Numerator; + private Hl7.Fhir.Model.Quantity? _Numerator; /// /// Denominator value. /// [FhirElement("denominator", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Denominator + public Hl7.Fhir.Model.Quantity? Denominator { get { return _Denominator; } set { _Denominator = value; OnPropertyChanged("Denominator"); } } - private Hl7.Fhir.Model.Quantity _Denominator; + private Hl7.Fhir.Model.Quantity? _Denominator; protected internal override void CopyToInternal(Base other) { - var dest = other as Ratio; - - if (dest == null) - { + if(other is not Ratio dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Numerator != null) dest.Numerator = (Hl7.Fhir.Model.Quantity)Numerator.DeepCopyInternal(); - if(Denominator != null) dest.Denominator = (Hl7.Fhir.Model.Quantity)Denominator.DeepCopyInternal(); + if(_Numerator is not null) dest.Numerator = (Hl7.Fhir.Model.Quantity)_Numerator.DeepCopyInternal(); + if(_Denominator is not null) dest.Denominator = (Hl7.Fhir.Model.Quantity)_Denominator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -109,41 +108,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Ratio; - if(otherT == null) return false; + if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Numerator, otherT.Numerator)) return false; - if(!comparer.Equals(Denominator, otherT.Denominator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "numerator": - value = Numerator; - return Numerator is not null; + value = _Numerator; + return _Numerator is not null; case "denominator": - value = Denominator; - return Denominator is not null; + value = _Denominator; + return _Denominator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "numerator": - Numerator = (Hl7.Fhir.Model.Quantity)value; + Numerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "denominator": - Denominator = (Hl7.Fhir.Model.Quantity)value; + Denominator = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -154,8 +153,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Numerator is not null) yield return new KeyValuePair("numerator",Numerator); - if (Denominator is not null) yield return new KeyValuePair("denominator",Denominator); + if (_Numerator is not null) yield return new KeyValuePair("numerator",_Numerator); + if (_Denominator is not null) yield return new KeyValuePair("denominator",_Denominator); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs index 896d48a6c..fa1a4f7ac 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,26 +85,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -110,29 +113,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -144,41 +140,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -189,8 +185,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -203,24 +199,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this related person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this related person's record is in active use @@ -229,13 +225,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -248,13 +241,13 @@ public bool? Active [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// The nature of the relationship. @@ -265,11 +258,11 @@ public Hl7.Fhir.Model.ResourceReference Patient [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// A name associated with the person. @@ -279,11 +272,11 @@ public List Relationship [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -293,11 +286,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -306,13 +299,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -321,13 +314,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -337,28 +327,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the related person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -371,11 +358,11 @@ public string BirthDate [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. @@ -385,24 +372,24 @@ public List Address [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Period of time that this relationship is considered valid. /// [FhirElement("period", Order=190, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// A language which may be used to communicate with about the patient's health. @@ -412,39 +399,35 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Relationship; set => Relationship = value; } - IEnumerable ICoded.ToCodings() => Relationship.ToCodings(); + IEnumerable ICoded.ToCodings() => Relationship?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedPerson; - - if (dest == null) - { + if(other is not RelatedPerson dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -456,111 +439,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedPerson; - if(otherT == null) return false; + if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -571,18 +554,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs index 1bd11c7f2..2fbc15656 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("RequestGroup","http://hl7.org/fhir/StructureDefinition/RequestGroup")] - public partial class RequestGroup : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class RequestGroup : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -80,28 +83,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("prefix", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// User-visible prefix for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -111,28 +111,25 @@ public string Prefix /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -142,28 +139,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -173,28 +167,25 @@ public string Description /// [FhirElement("textEquivalent", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextEquivalentElement + public Hl7.Fhir.Model.FhirString? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.FhirString _TextEquivalentElement; + private Hl7.Fhir.Model.FhirString? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.FhirString(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextEquivalent"); } } @@ -206,13 +197,13 @@ public string TextEquivalent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -221,13 +212,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -240,11 +228,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting documentation for the intended performer of the action. @@ -254,11 +242,11 @@ public List Code [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// Whether or not the action is applicable. @@ -268,11 +256,11 @@ public List Documentation [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Relationship to another action. @@ -282,11 +270,11 @@ public List Condition [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -295,13 +283,13 @@ public List RelatedAction [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Who should perform the action. @@ -313,11 +301,11 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -325,13 +313,13 @@ public List Participant [FhirElement("type", Order=150)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// visual-group | logical-group | sentence-group. @@ -340,13 +328,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -355,13 +343,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -373,13 +358,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -388,13 +373,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -406,13 +388,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -421,13 +403,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -439,13 +418,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -454,13 +433,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -472,13 +448,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -487,13 +463,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -505,13 +478,13 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; /// /// Sub action. @@ -521,41 +494,37 @@ public Hl7.Fhir.Model.ResourceReference Resource [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)TextEquivalentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)_TextEquivalentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -567,160 +536,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.FhirString)value; + TextEquivalentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -731,25 +700,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -779,13 +748,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -794,13 +763,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -810,26 +776,22 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -841,41 +803,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -886,8 +848,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -914,28 +876,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ActionIdElement + public Hl7.Fhir.Model.Id? ActionIdElement { get { return _ActionIdElement; } set { _ActionIdElement = value; OnPropertyChanged("ActionIdElement"); } } - private Hl7.Fhir.Model.Id _ActionIdElement; + private Hl7.Fhir.Model.Id? _ActionIdElement; /// /// What action this is related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActionId + public string? ActionId { - get { return ActionIdElement != null ? ActionIdElement.Value : null; } + get => _ActionIdElement?.Value; set { - if (value == null) - ActionIdElement = null; - else - ActionIdElement = new Hl7.Fhir.Model.Id(value); + ActionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ActionId"); } } @@ -948,13 +907,13 @@ public string ActionId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end @@ -963,13 +922,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -981,27 +937,23 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActionIdElement != null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)ActionIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_ActionIdElement is not null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)_ActionIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1013,48 +965,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActionIdElement, otherT.ActionIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actionId": - value = ActionIdElement; - return ActionIdElement is not null; + value = _ActionIdElement; + return _ActionIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actionId": - ActionIdElement = (Hl7.Fhir.Model.Id)value; + ActionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1065,9 +1017,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActionIdElement is not null) yield return new KeyValuePair("actionId",ActionIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_ActionIdElement is not null) yield return new KeyValuePair("actionId",_ActionIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -1080,11 +1032,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -1094,24 +1046,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1126,24 +1078,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1160,11 +1112,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -1176,24 +1128,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -1203,13 +1155,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("RequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -1218,13 +1170,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1237,13 +1186,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -1252,13 +1201,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1270,13 +1216,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -1285,13 +1231,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -1301,13 +1244,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("code", InSummary=true, Order=180, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the request group is about. @@ -1316,13 +1259,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Created as part of. @@ -1331,41 +1274,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the request group was authored. /// [FhirElement("authoredOn", Order=210, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request group was authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -1377,13 +1317,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Why the request group is needed. @@ -1393,11 +1333,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why the request group is needed. @@ -1409,11 +1349,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Additional notes about the response. @@ -1423,11 +1363,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Proposed actions, if any. @@ -1437,45 +1377,41 @@ public List Note [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as RequestGroup; - - if (dest == null) - { + if(other is not RequestGroup dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1487,153 +1423,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestGroup; - if(otherT == null) return false; + if(other is not RequestGroup otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1644,24 +1580,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs index 03007f9c2..9fbe9cf5a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ResearchDefinition : Hl7.Fhir.Model.DomainResource, IIdenti /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this research definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the research definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the research definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this research definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this research definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -202,28 +193,25 @@ public string Title /// [FhirElement("shortTitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -233,28 +221,25 @@ public string ShortTitle /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the ResearchDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -267,13 +252,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -282,13 +267,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -298,13 +280,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -313,13 +295,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -333,41 +312,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -377,28 +353,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -411,39 +384,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the research definition. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the research definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -456,24 +426,24 @@ public string Description [DataMember] public List CommentElement { - get { if(_CommentElement==null) _CommentElement = new List(); return _CommentElement; } + get => _CommentElement ?? new List(); set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private List _CommentElement; + private List? _CommentElement; /// /// Used for footnotes or explanatory notes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comment + public IEnumerable? Comment { - get { return CommentElement != null ? CommentElement.Select(elem => elem.Value) : null; } + get => _CommentElement?.Select(elem => elem.Value); set { if (value == null) - CommentElement = null; + CommentElement = null!; else CommentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Comment"); @@ -488,11 +458,11 @@ public IEnumerable Comment [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for research definition (if applicable). @@ -503,39 +473,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this research definition is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this research definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -545,28 +512,25 @@ public string Purpose /// [FhirElement("usage", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the ResearchDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -576,28 +540,25 @@ public string Usage /// [FhirElement("copyright", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -607,28 +568,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the research definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -638,28 +596,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the research definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -669,13 +624,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the ResearchDefinition, such as Education, Treatment, Assessment, etc. @@ -686,11 +641,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -700,11 +655,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -714,11 +669,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -728,11 +683,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -742,11 +697,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -756,11 +711,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the ResearchDefinition. @@ -770,24 +725,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the ResearchDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -802,13 +757,13 @@ public IEnumerable Library [References("ResearchElementDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Population + public Hl7.Fhir.Model.ResourceReference? Population { get { return _Population; } set { _Population = value; OnPropertyChanged("Population"); } } - private Hl7.Fhir.Model.ResourceReference _Population; + private Hl7.Fhir.Model.ResourceReference? _Population; /// /// What exposure?. @@ -817,13 +772,13 @@ public Hl7.Fhir.Model.ResourceReference Population [CLSCompliant(false)] [References("ResearchElementDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Exposure + public Hl7.Fhir.Model.ResourceReference? Exposure { get { return _Exposure; } set { _Exposure = value; OnPropertyChanged("Exposure"); } } - private Hl7.Fhir.Model.ResourceReference _Exposure; + private Hl7.Fhir.Model.ResourceReference? _Exposure; /// /// What alternative exposure state?. @@ -832,13 +787,13 @@ public Hl7.Fhir.Model.ResourceReference Exposure [CLSCompliant(false)] [References("ResearchElementDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExposureAlternative + public Hl7.Fhir.Model.ResourceReference? ExposureAlternative { get { return _ExposureAlternative; } set { _ExposureAlternative = value; OnPropertyChanged("ExposureAlternative"); } } - private Hl7.Fhir.Model.ResourceReference _ExposureAlternative; + private Hl7.Fhir.Model.ResourceReference? _ExposureAlternative; /// /// What outcome?. @@ -847,60 +802,56 @@ public Hl7.Fhir.Model.ResourceReference ExposureAlternative [CLSCompliant(false)] [References("ResearchElementDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Outcome + public Hl7.Fhir.Model.ResourceReference? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.ResourceReference _Outcome; + private Hl7.Fhir.Model.ResourceReference? _Outcome; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchDefinition; - - if (dest == null) - { + if(other is not ResearchDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(CommentElement.Any()) dest.CommentElement = new List(CommentElement.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(Population != null) dest.Population = (Hl7.Fhir.Model.ResourceReference)Population.DeepCopyInternal(); - if(Exposure != null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)Exposure.DeepCopyInternal(); - if(ExposureAlternative != null) dest.ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)ExposureAlternative.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)Outcome.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = new List(_CommentElement.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_Population is not null) dest.Population = (Hl7.Fhir.Model.ResourceReference)_Population.DeepCopyInternal(); + if(_Exposure is not null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)_Exposure.DeepCopyInternal(); + if(_ExposureAlternative is not null) dest.ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)_ExposureAlternative.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)_Outcome.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -912,265 +863,265 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchDefinition; - if(otherT == null) return false; + if(other is not ResearchDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(Population, otherT.Population)) return false; - if(!comparer.Equals(Exposure, otherT.Exposure)) return false; - if(!comparer.Equals(ExposureAlternative, otherT.ExposureAlternative)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_Exposure, otherT._Exposure)) return false; + if(!comparer.Equals(_ExposureAlternative, otherT._ExposureAlternative)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "comment": - value = CommentElement; - return CommentElement?.Any() == true; + value = _CommentElement; + return _CommentElement?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "population": - value = Population; - return Population is not null; + value = _Population; + return _Population is not null; case "exposure": - value = Exposure; - return Exposure is not null; + value = _Exposure; + return _Exposure is not null; case "exposureAlternative": - value = ExposureAlternative; - return ExposureAlternative is not null; + value = _ExposureAlternative; + return _ExposureAlternative is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "comment": - CommentElement = (List)value; + CommentElement = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "population": - Population = (Hl7.Fhir.Model.ResourceReference)value; + Population = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposure": - Exposure = (Hl7.Fhir.Model.ResourceReference)value; + Exposure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposureAlternative": - ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)value; + ExposureAlternative = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.ResourceReference)value; + Outcome = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1181,40 +1132,40 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (CommentElement?.Any() == true) yield return new KeyValuePair("comment",CommentElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (Population is not null) yield return new KeyValuePair("population",Population); - if (Exposure is not null) yield return new KeyValuePair("exposure",Exposure); - if (ExposureAlternative is not null) yield return new KeyValuePair("exposureAlternative",ExposureAlternative); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_CommentElement?.Any() == true) yield return new KeyValuePair("comment",_CommentElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_Population is not null) yield return new KeyValuePair("population",_Population); + if (_Exposure is not null) yield return new KeyValuePair("exposure",_Exposure); + if (_ExposureAlternative is not null) yield return new KeyValuePair("exposureAlternative",_ExposureAlternative); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs index b2ebe67f4..bdbf8b635 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,13 +116,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.DataRequirement))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// What code/value pairs define members?. @@ -129,24 +132,24 @@ public Hl7.Fhir.Model.DataType Definition [DataMember] public List UsageContext { - get { if(_UsageContext==null) _UsageContext = new List(); return _UsageContext; } + get => _UsageContext ?? new List(); set { _UsageContext = value; OnPropertyChanged("UsageContext"); } } - private List _UsageContext; + private List? _UsageContext; /// /// Whether the characteristic includes or excludes members. /// [FhirElement("exclude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Whether the characteristic includes or excludes members @@ -155,13 +158,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -172,41 +172,38 @@ public bool? Exclude [FhirElement("unitOfMeasure", Order=70)] [Binding("UCUMUnits")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfMeasure + public Hl7.Fhir.Model.CodeableConcept? UnitOfMeasure { get { return _UnitOfMeasure; } set { _UnitOfMeasure = value; OnPropertyChanged("UnitOfMeasure"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfMeasure; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfMeasure; /// /// What time period does the study cover. /// [FhirElement("studyEffectiveDescription", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString StudyEffectiveDescriptionElement + public Hl7.Fhir.Model.FhirString? StudyEffectiveDescriptionElement { get { return _StudyEffectiveDescriptionElement; } set { _StudyEffectiveDescriptionElement = value; OnPropertyChanged("StudyEffectiveDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _StudyEffectiveDescriptionElement; + private Hl7.Fhir.Model.FhirString? _StudyEffectiveDescriptionElement; /// /// What time period does the study cover /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StudyEffectiveDescription + public string? StudyEffectiveDescription { - get { return StudyEffectiveDescriptionElement != null ? StudyEffectiveDescriptionElement.Value : null; } + get => _StudyEffectiveDescriptionElement?.Value; set { - if (value == null) - StudyEffectiveDescriptionElement = null; - else - StudyEffectiveDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + StudyEffectiveDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StudyEffectiveDescription"); } } @@ -218,26 +215,26 @@ public string StudyEffectiveDescription [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType StudyEffective + public Hl7.Fhir.Model.DataType? StudyEffective { get { return _StudyEffective; } set { _StudyEffective = value; OnPropertyChanged("StudyEffective"); } } - private Hl7.Fhir.Model.DataType _StudyEffective; + private Hl7.Fhir.Model.DataType? _StudyEffective; /// /// Observation time from study start. /// [FhirElement("studyEffectiveTimeFromStart", Order=100)] [DataMember] - public Hl7.Fhir.Model.Duration StudyEffectiveTimeFromStart + public Hl7.Fhir.Model.Duration? StudyEffectiveTimeFromStart { get { return _StudyEffectiveTimeFromStart; } set { _StudyEffectiveTimeFromStart = value; OnPropertyChanged("StudyEffectiveTimeFromStart"); } } - private Hl7.Fhir.Model.Duration _StudyEffectiveTimeFromStart; + private Hl7.Fhir.Model.Duration? _StudyEffectiveTimeFromStart; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median. @@ -246,13 +243,13 @@ public Hl7.Fhir.Model.Duration StudyEffectiveTimeFromStart [DeclaredType(Type = typeof(Code))] [Binding("GroupMeasure")] [DataMember] - public Code StudyEffectiveGroupMeasureElement + public Code? StudyEffectiveGroupMeasureElement { get { return _StudyEffectiveGroupMeasureElement; } set { _StudyEffectiveGroupMeasureElement = value; OnPropertyChanged("StudyEffectiveGroupMeasureElement"); } } - private Code _StudyEffectiveGroupMeasureElement; + private Code? _StudyEffectiveGroupMeasureElement; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median @@ -261,13 +258,10 @@ public Code StudyEffectiveGroupMeasureElement [IgnoreDataMember] public Hl7.Fhir.Model.GroupMeasureCode? StudyEffectiveGroupMeasure { - get { return StudyEffectiveGroupMeasureElement != null ? StudyEffectiveGroupMeasureElement.Value : null; } + get => _StudyEffectiveGroupMeasureElement?.Value; set { - if (value == null) - StudyEffectiveGroupMeasureElement = null; - else - StudyEffectiveGroupMeasureElement = new Code(value); + StudyEffectiveGroupMeasureElement = value is null ? null : new Code(value); OnPropertyChanged("StudyEffectiveGroupMeasure"); } } @@ -277,28 +271,25 @@ public Hl7.Fhir.Model.GroupMeasureCode? StudyEffectiveGroupMeasure /// [FhirElement("participantEffectiveDescription", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ParticipantEffectiveDescriptionElement + public Hl7.Fhir.Model.FhirString? ParticipantEffectiveDescriptionElement { get { return _ParticipantEffectiveDescriptionElement; } set { _ParticipantEffectiveDescriptionElement = value; OnPropertyChanged("ParticipantEffectiveDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _ParticipantEffectiveDescriptionElement; + private Hl7.Fhir.Model.FhirString? _ParticipantEffectiveDescriptionElement; /// /// What time period do participants cover /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ParticipantEffectiveDescription + public string? ParticipantEffectiveDescription { - get { return ParticipantEffectiveDescriptionElement != null ? ParticipantEffectiveDescriptionElement.Value : null; } + get => _ParticipantEffectiveDescriptionElement?.Value; set { - if (value == null) - ParticipantEffectiveDescriptionElement = null; - else - ParticipantEffectiveDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + ParticipantEffectiveDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ParticipantEffectiveDescription"); } } @@ -310,26 +301,26 @@ public string ParticipantEffectiveDescription [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType ParticipantEffective + public Hl7.Fhir.Model.DataType? ParticipantEffective { get { return _ParticipantEffective; } set { _ParticipantEffective = value; OnPropertyChanged("ParticipantEffective"); } } - private Hl7.Fhir.Model.DataType _ParticipantEffective; + private Hl7.Fhir.Model.DataType? _ParticipantEffective; /// /// Observation time from study start. /// [FhirElement("participantEffectiveTimeFromStart", Order=140)] [DataMember] - public Hl7.Fhir.Model.Duration ParticipantEffectiveTimeFromStart + public Hl7.Fhir.Model.Duration? ParticipantEffectiveTimeFromStart { get { return _ParticipantEffectiveTimeFromStart; } set { _ParticipantEffectiveTimeFromStart = value; OnPropertyChanged("ParticipantEffectiveTimeFromStart"); } } - private Hl7.Fhir.Model.Duration _ParticipantEffectiveTimeFromStart; + private Hl7.Fhir.Model.Duration? _ParticipantEffectiveTimeFromStart; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median. @@ -338,13 +329,13 @@ public Hl7.Fhir.Model.Duration ParticipantEffectiveTimeFromStart [DeclaredType(Type = typeof(Code))] [Binding("GroupMeasure")] [DataMember] - public Code ParticipantEffectiveGroupMeasureElement + public Code? ParticipantEffectiveGroupMeasureElement { get { return _ParticipantEffectiveGroupMeasureElement; } set { _ParticipantEffectiveGroupMeasureElement = value; OnPropertyChanged("ParticipantEffectiveGroupMeasureElement"); } } - private Code _ParticipantEffectiveGroupMeasureElement; + private Code? _ParticipantEffectiveGroupMeasureElement; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median @@ -353,39 +344,32 @@ public Code ParticipantEffectiveGroupMeasureEle [IgnoreDataMember] public Hl7.Fhir.Model.GroupMeasureCode? ParticipantEffectiveGroupMeasure { - get { return ParticipantEffectiveGroupMeasureElement != null ? ParticipantEffectiveGroupMeasureElement.Value : null; } + get => _ParticipantEffectiveGroupMeasureElement?.Value; set { - if (value == null) - ParticipantEffectiveGroupMeasureElement = null; - else - ParticipantEffectiveGroupMeasureElement = new Code(value); + ParticipantEffectiveGroupMeasureElement = value is null ? null : new Code(value); OnPropertyChanged("ParticipantEffectiveGroupMeasure"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(UsageContext.Any()) dest.UsageContext = new List(UsageContext.DeepCopyInternal()); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(UnitOfMeasure != null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)UnitOfMeasure.DeepCopyInternal(); - if(StudyEffectiveDescriptionElement != null) dest.StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)StudyEffectiveDescriptionElement.DeepCopyInternal(); - if(StudyEffective != null) dest.StudyEffective = (Hl7.Fhir.Model.DataType)StudyEffective.DeepCopyInternal(); - if(StudyEffectiveTimeFromStart != null) dest.StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)StudyEffectiveTimeFromStart.DeepCopyInternal(); - if(StudyEffectiveGroupMeasureElement != null) dest.StudyEffectiveGroupMeasureElement = (Code)StudyEffectiveGroupMeasureElement.DeepCopyInternal(); - if(ParticipantEffectiveDescriptionElement != null) dest.ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)ParticipantEffectiveDescriptionElement.DeepCopyInternal(); - if(ParticipantEffective != null) dest.ParticipantEffective = (Hl7.Fhir.Model.DataType)ParticipantEffective.DeepCopyInternal(); - if(ParticipantEffectiveTimeFromStart != null) dest.ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)ParticipantEffectiveTimeFromStart.DeepCopyInternal(); - if(ParticipantEffectiveGroupMeasureElement != null) dest.ParticipantEffectiveGroupMeasureElement = (Code)ParticipantEffectiveGroupMeasureElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_UsageContext is not null) dest.UsageContext = new List(_UsageContext.DeepCopyInternal()); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_UnitOfMeasure is not null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)_UnitOfMeasure.DeepCopyInternal(); + if(_StudyEffectiveDescriptionElement is not null) dest.StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)_StudyEffectiveDescriptionElement.DeepCopyInternal(); + if(_StudyEffective is not null) dest.StudyEffective = (Hl7.Fhir.Model.DataType)_StudyEffective.DeepCopyInternal(); + if(_StudyEffectiveTimeFromStart is not null) dest.StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)_StudyEffectiveTimeFromStart.DeepCopyInternal(); + if(_StudyEffectiveGroupMeasureElement is not null) dest.StudyEffectiveGroupMeasureElement = (Code)_StudyEffectiveGroupMeasureElement.DeepCopyInternal(); + if(_ParticipantEffectiveDescriptionElement is not null) dest.ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)_ParticipantEffectiveDescriptionElement.DeepCopyInternal(); + if(_ParticipantEffective is not null) dest.ParticipantEffective = (Hl7.Fhir.Model.DataType)_ParticipantEffective.DeepCopyInternal(); + if(_ParticipantEffectiveTimeFromStart is not null) dest.ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)_ParticipantEffectiveTimeFromStart.DeepCopyInternal(); + if(_ParticipantEffectiveGroupMeasureElement is not null) dest.ParticipantEffectiveGroupMeasureElement = (Code)_ParticipantEffectiveGroupMeasureElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -397,111 +381,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(UsageContext, otherT.UsageContext)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(UnitOfMeasure, otherT.UnitOfMeasure)) return false; - if(!comparer.Equals(StudyEffectiveDescriptionElement, otherT.StudyEffectiveDescriptionElement)) return false; - if(!comparer.Equals(StudyEffective, otherT.StudyEffective)) return false; - if(!comparer.Equals(StudyEffectiveTimeFromStart, otherT.StudyEffectiveTimeFromStart)) return false; - if(!comparer.Equals(StudyEffectiveGroupMeasureElement, otherT.StudyEffectiveGroupMeasureElement)) return false; - if(!comparer.Equals(ParticipantEffectiveDescriptionElement, otherT.ParticipantEffectiveDescriptionElement)) return false; - if(!comparer.Equals(ParticipantEffective, otherT.ParticipantEffective)) return false; - if(!comparer.Equals(ParticipantEffectiveTimeFromStart, otherT.ParticipantEffectiveTimeFromStart)) return false; - if(!comparer.Equals(ParticipantEffectiveGroupMeasureElement, otherT.ParticipantEffectiveGroupMeasureElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_UsageContext, otherT._UsageContext)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; + if(!comparer.Equals(_StudyEffectiveDescriptionElement, otherT._StudyEffectiveDescriptionElement)) return false; + if(!comparer.Equals(_StudyEffective, otherT._StudyEffective)) return false; + if(!comparer.Equals(_StudyEffectiveTimeFromStart, otherT._StudyEffectiveTimeFromStart)) return false; + if(!comparer.Equals(_StudyEffectiveGroupMeasureElement, otherT._StudyEffectiveGroupMeasureElement)) return false; + if(!comparer.Equals(_ParticipantEffectiveDescriptionElement, otherT._ParticipantEffectiveDescriptionElement)) return false; + if(!comparer.Equals(_ParticipantEffective, otherT._ParticipantEffective)) return false; + if(!comparer.Equals(_ParticipantEffectiveTimeFromStart, otherT._ParticipantEffectiveTimeFromStart)) return false; + if(!comparer.Equals(_ParticipantEffectiveGroupMeasureElement, otherT._ParticipantEffectiveGroupMeasureElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "usageContext": - value = UsageContext; - return UsageContext?.Any() == true; + value = _UsageContext; + return _UsageContext?.Any() == true; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "unitOfMeasure": - value = UnitOfMeasure; - return UnitOfMeasure is not null; + value = _UnitOfMeasure; + return _UnitOfMeasure is not null; case "studyEffectiveDescription": - value = StudyEffectiveDescriptionElement; - return StudyEffectiveDescriptionElement is not null; + value = _StudyEffectiveDescriptionElement; + return _StudyEffectiveDescriptionElement is not null; case "studyEffective": - value = StudyEffective; - return StudyEffective is not null; + value = _StudyEffective; + return _StudyEffective is not null; case "studyEffectiveTimeFromStart": - value = StudyEffectiveTimeFromStart; - return StudyEffectiveTimeFromStart is not null; + value = _StudyEffectiveTimeFromStart; + return _StudyEffectiveTimeFromStart is not null; case "studyEffectiveGroupMeasure": - value = StudyEffectiveGroupMeasureElement; - return StudyEffectiveGroupMeasureElement is not null; + value = _StudyEffectiveGroupMeasureElement; + return _StudyEffectiveGroupMeasureElement is not null; case "participantEffectiveDescription": - value = ParticipantEffectiveDescriptionElement; - return ParticipantEffectiveDescriptionElement is not null; + value = _ParticipantEffectiveDescriptionElement; + return _ParticipantEffectiveDescriptionElement is not null; case "participantEffective": - value = ParticipantEffective; - return ParticipantEffective is not null; + value = _ParticipantEffective; + return _ParticipantEffective is not null; case "participantEffectiveTimeFromStart": - value = ParticipantEffectiveTimeFromStart; - return ParticipantEffectiveTimeFromStart is not null; + value = _ParticipantEffectiveTimeFromStart; + return _ParticipantEffectiveTimeFromStart is not null; case "participantEffectiveGroupMeasure": - value = ParticipantEffectiveGroupMeasureElement; - return ParticipantEffectiveGroupMeasureElement is not null; + value = _ParticipantEffectiveGroupMeasureElement; + return _ParticipantEffectiveGroupMeasureElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "usageContext": - UsageContext = (List)value; + UsageContext = (List?)value!; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "unitOfMeasure": - UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyEffectiveDescription": - StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "studyEffective": - StudyEffective = (Hl7.Fhir.Model.DataType)value; + StudyEffective = (Hl7.Fhir.Model.DataType?)value; return this; case "studyEffectiveTimeFromStart": - StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)value; + StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration?)value; return this; case "studyEffectiveGroupMeasure": - StudyEffectiveGroupMeasureElement = (Code)value; + StudyEffectiveGroupMeasureElement = (Code?)value; return this; case "participantEffectiveDescription": - ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "participantEffective": - ParticipantEffective = (Hl7.Fhir.Model.DataType)value; + ParticipantEffective = (Hl7.Fhir.Model.DataType?)value; return this; case "participantEffectiveTimeFromStart": - ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)value; + ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration?)value; return this; case "participantEffectiveGroupMeasure": - ParticipantEffectiveGroupMeasureElement = (Code)value; + ParticipantEffectiveGroupMeasureElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -512,18 +496,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (UsageContext?.Any() == true) yield return new KeyValuePair("usageContext",UsageContext); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",UnitOfMeasure); - if (StudyEffectiveDescriptionElement is not null) yield return new KeyValuePair("studyEffectiveDescription",StudyEffectiveDescriptionElement); - if (StudyEffective is not null) yield return new KeyValuePair("studyEffective",StudyEffective); - if (StudyEffectiveTimeFromStart is not null) yield return new KeyValuePair("studyEffectiveTimeFromStart",StudyEffectiveTimeFromStart); - if (StudyEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("studyEffectiveGroupMeasure",StudyEffectiveGroupMeasureElement); - if (ParticipantEffectiveDescriptionElement is not null) yield return new KeyValuePair("participantEffectiveDescription",ParticipantEffectiveDescriptionElement); - if (ParticipantEffective is not null) yield return new KeyValuePair("participantEffective",ParticipantEffective); - if (ParticipantEffectiveTimeFromStart is not null) yield return new KeyValuePair("participantEffectiveTimeFromStart",ParticipantEffectiveTimeFromStart); - if (ParticipantEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("participantEffectiveGroupMeasure",ParticipantEffectiveGroupMeasureElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_UsageContext?.Any() == true) yield return new KeyValuePair("usageContext",_UsageContext); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",_UnitOfMeasure); + if (_StudyEffectiveDescriptionElement is not null) yield return new KeyValuePair("studyEffectiveDescription",_StudyEffectiveDescriptionElement); + if (_StudyEffective is not null) yield return new KeyValuePair("studyEffective",_StudyEffective); + if (_StudyEffectiveTimeFromStart is not null) yield return new KeyValuePair("studyEffectiveTimeFromStart",_StudyEffectiveTimeFromStart); + if (_StudyEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("studyEffectiveGroupMeasure",_StudyEffectiveGroupMeasureElement); + if (_ParticipantEffectiveDescriptionElement is not null) yield return new KeyValuePair("participantEffectiveDescription",_ParticipantEffectiveDescriptionElement); + if (_ParticipantEffective is not null) yield return new KeyValuePair("participantEffective",_ParticipantEffective); + if (_ParticipantEffectiveTimeFromStart is not null) yield return new KeyValuePair("participantEffectiveTimeFromStart",_ParticipantEffectiveTimeFromStart); + if (_ParticipantEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("participantEffectiveGroupMeasure",_ParticipantEffectiveGroupMeasureElement); } } @@ -533,28 +517,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this research element definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -567,39 +548,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the research element definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the research element definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -609,28 +587,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this research element definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -640,28 +615,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this research element definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -671,28 +643,25 @@ public string Title /// [FhirElement("shortTitle", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -702,28 +671,25 @@ public string ShortTitle /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the ResearchElementDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -736,13 +702,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -751,13 +717,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -767,13 +730,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -782,13 +745,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -802,41 +762,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -846,28 +803,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -880,39 +834,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the research element definition. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the research element definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -925,24 +876,24 @@ public string Description [DataMember] public List CommentElement { - get { if(_CommentElement==null) _CommentElement = new List(); return _CommentElement; } + get => _CommentElement ?? new List(); set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private List _CommentElement; + private List? _CommentElement; /// /// Used for footnotes or explanatory notes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comment + public IEnumerable? Comment { - get { return CommentElement != null ? CommentElement.Select(elem => elem.Value) : null; } + get => _CommentElement?.Select(elem => elem.Value); set { if (value == null) - CommentElement = null; + CommentElement = null!; else CommentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Comment"); @@ -957,11 +908,11 @@ public IEnumerable Comment [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for research element definition (if applicable). @@ -972,39 +923,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this research element definition is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this research element definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1014,28 +962,25 @@ public string Purpose /// [FhirElement("usage", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the ResearchElementDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -1045,28 +990,25 @@ public string Usage /// [FhirElement("copyright", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1076,28 +1018,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the research element definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1107,28 +1046,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the research element definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1138,13 +1074,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the ResearchElementDefinition, such as Education, Treatment, Assessment, etc. @@ -1155,11 +1091,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1169,11 +1105,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1183,11 +1119,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1197,11 +1133,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1211,11 +1147,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1225,11 +1161,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the ResearchElementDefinition. @@ -1239,24 +1175,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the ResearchElementDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1271,13 +1207,13 @@ public IEnumerable Library [Binding("ResearchElementType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// population | exposure | outcome @@ -1286,13 +1222,10 @@ public Code TypeEl [IgnoreDataMember] public Hl7.Fhir.Model.ResearchElementDefinition.ResearchElementType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1304,13 +1237,13 @@ public Hl7.Fhir.Model.ResearchElementDefinition.ResearchElementType? Type [DeclaredType(Type = typeof(Code))] [Binding("VariableType")] [DataMember] - public Code VariableTypeElement + public Code? VariableTypeElement { get { return _VariableTypeElement; } set { _VariableTypeElement = value; OnPropertyChanged("VariableTypeElement"); } } - private Code _VariableTypeElement; + private Code? _VariableTypeElement; /// /// dichotomous | continuous | descriptive @@ -1319,13 +1252,10 @@ public Code VariableTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.VariableTypeCode? VariableType { - get { return VariableTypeElement != null ? VariableTypeElement.Value : null; } + get => _VariableTypeElement?.Value; set { - if (value == null) - VariableTypeElement = null; - else - VariableTypeElement = new Code(value); + VariableTypeElement = value is null ? null : new Code(value); OnPropertyChanged("VariableType"); } } @@ -1338,57 +1268,53 @@ public Hl7.Fhir.Model.VariableTypeCode? VariableType [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchElementDefinition; - - if (dest == null) - { + if(other is not ResearchElementDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(CommentElement.Any()) dest.CommentElement = new List(CommentElement.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(VariableTypeElement != null) dest.VariableTypeElement = (Code)VariableTypeElement.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = new List(_CommentElement.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_VariableTypeElement is not null) dest.VariableTypeElement = (Code)_VariableTypeElement.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1400,258 +1326,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchElementDefinition; - if(otherT == null) return false; + if(other is not ResearchElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(VariableTypeElement, otherT.VariableTypeElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_VariableTypeElement, otherT._VariableTypeElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "comment": - value = CommentElement; - return CommentElement?.Any() == true; + value = _CommentElement; + return _CommentElement?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "variableType": - value = VariableTypeElement; - return VariableTypeElement is not null; + value = _VariableTypeElement; + return _VariableTypeElement is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "comment": - CommentElement = (List)value; + CommentElement = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "variableType": - VariableTypeElement = (Code)value; + VariableTypeElement = (Code?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1662,39 +1588,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (CommentElement?.Any() == true) yield return new KeyValuePair("comment",CommentElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (VariableTypeElement is not null) yield return new KeyValuePair("variableType",VariableTypeElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_CommentElement?.Any() == true) yield return new KeyValuePair("comment",_CommentElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_VariableTypeElement is not null) yield return new KeyValuePair("variableType",_VariableTypeElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs index ed9051cc9..17e9044e8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -158,28 +161,25 @@ public partial class ArmComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for study arm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -189,58 +189,51 @@ public string Name /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Short explanation of study path. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short explanation of study path /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ArmComponent; - - if (dest == null) - { + if(other is not ArmComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -252,48 +245,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ArmComponent; - if(otherT == null) return false; + if(other is not ArmComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -304,9 +297,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -332,28 +325,25 @@ public partial class ObjectiveComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for the objective /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -364,26 +354,22 @@ public string Name [FhirElement("type", Order=50)] [Binding("ResearchStudyObjectiveType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as ObjectiveComponent; - - if (dest == null) - { + if(other is not ObjectiveComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -395,41 +381,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ObjectiveComponent; - if(otherT == null) return false; + if(other is not ObjectiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -440,8 +426,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -454,39 +440,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Name for this study. /// [FhirElement("title", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -501,11 +484,11 @@ public string Title [DataMember] public List Protocol { - get { if(_Protocol==null) _Protocol = new List(); return _Protocol; } + get => _Protocol ?? new List(); set { _Protocol = value; OnPropertyChanged("Protocol"); } } - private List _Protocol; + private List? _Protocol; /// /// Part of larger study. @@ -517,11 +500,11 @@ public List Protocol [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn. @@ -531,13 +514,13 @@ public List PartOf [Binding("ResearchStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn @@ -546,13 +529,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -563,13 +543,13 @@ public Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus? Status [FhirElement("primaryPurposeType", InSummary=true, Order=140)] [Binding("ResearchStudyPrimaryPurposeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PrimaryPurposeType + public Hl7.Fhir.Model.CodeableConcept? PrimaryPurposeType { get { return _PrimaryPurposeType; } set { _PrimaryPurposeType = value; OnPropertyChanged("PrimaryPurposeType"); } } - private Hl7.Fhir.Model.CodeableConcept _PrimaryPurposeType; + private Hl7.Fhir.Model.CodeableConcept? _PrimaryPurposeType; /// /// n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4. @@ -577,13 +557,13 @@ public Hl7.Fhir.Model.CodeableConcept PrimaryPurposeType [FhirElement("phase", InSummary=true, Order=150)] [Binding("ResearchStudyPhase")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Phase + public Hl7.Fhir.Model.CodeableConcept? Phase { get { return _Phase; } set { _Phase = value; OnPropertyChanged("Phase"); } } - private Hl7.Fhir.Model.CodeableConcept _Phase; + private Hl7.Fhir.Model.CodeableConcept? _Phase; /// /// Classifications for the study. @@ -594,11 +574,11 @@ public Hl7.Fhir.Model.CodeableConcept Phase [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Drugs, devices, etc. under study. @@ -609,11 +589,11 @@ public List Category [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Condition being studied. @@ -624,11 +604,11 @@ public List Focus [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Contact details for the study. @@ -638,11 +618,11 @@ public List Condition [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// References and dependencies. @@ -652,11 +632,11 @@ public List Contact [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Used to search for the study. @@ -667,11 +647,11 @@ public List RelatedArtifact [DataMember] public List Keyword { - get { if(_Keyword==null) _Keyword = new List(); return _Keyword; } + get => _Keyword ?? new List(); set { _Keyword = value; OnPropertyChanged("Keyword"); } } - private List _Keyword; + private List? _Keyword; /// /// Geographic region(s) for study. @@ -682,39 +662,36 @@ public List Keyword [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// What this is study doing. /// [FhirElement("description", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// What this is study doing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -729,24 +706,24 @@ public string Description [DataMember] public List Enrollment { - get { if(_Enrollment==null) _Enrollment = new List(); return _Enrollment; } + get => _Enrollment ?? new List(); set { _Enrollment = value; OnPropertyChanged("Enrollment"); } } - private List _Enrollment; + private List? _Enrollment; /// /// When the study began and ended. /// [FhirElement("period", InSummary=true, Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that initiates and is legally responsible for the study. @@ -755,13 +732,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sponsor + public Hl7.Fhir.Model.ResourceReference? Sponsor { get { return _Sponsor; } set { _Sponsor = value; OnPropertyChanged("Sponsor"); } } - private Hl7.Fhir.Model.ResourceReference _Sponsor; + private Hl7.Fhir.Model.ResourceReference? _Sponsor; /// /// Researcher who oversees multiple aspects of the study. @@ -770,13 +747,13 @@ public Hl7.Fhir.Model.ResourceReference Sponsor [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PrincipalInvestigator + public Hl7.Fhir.Model.ResourceReference? PrincipalInvestigator { get { return _PrincipalInvestigator; } set { _PrincipalInvestigator = value; OnPropertyChanged("PrincipalInvestigator"); } } - private Hl7.Fhir.Model.ResourceReference _PrincipalInvestigator; + private Hl7.Fhir.Model.ResourceReference? _PrincipalInvestigator; /// /// Facility where study activities are conducted. @@ -788,11 +765,11 @@ public Hl7.Fhir.Model.ResourceReference PrincipalInvestigator [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// accrual-goal-met | closed-due-to-toxicity | closed-due-to-lack-of-study-progress | temporarily-closed-per-study-design. @@ -800,13 +777,13 @@ public List Site [FhirElement("reasonStopped", InSummary=true, Order=290, FiveWs="FiveWs.why[x]")] [Binding("ResearchStudyReasonStopped")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReasonStopped + public Hl7.Fhir.Model.CodeableConcept? ReasonStopped { get { return _ReasonStopped; } set { _ReasonStopped = value; OnPropertyChanged("ReasonStopped"); } } - private Hl7.Fhir.Model.CodeableConcept _ReasonStopped; + private Hl7.Fhir.Model.CodeableConcept? _ReasonStopped; /// /// Comments made about the study. @@ -816,11 +793,11 @@ public Hl7.Fhir.Model.CodeableConcept ReasonStopped [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Defined path through the study for a subject. @@ -830,11 +807,11 @@ public List Note [DataMember] public List Arm { - get { if(_Arm==null) _Arm = new List(); return _Arm; } + get => _Arm ?? new List(); set { _Arm = value; OnPropertyChanged("Arm"); } } - private List _Arm; + private List? _Arm; /// /// A goal for the study. @@ -844,48 +821,44 @@ public List Arm [DataMember] public List Objective { - get { if(_Objective==null) _Objective = new List(); return _Objective; } + get => _Objective ?? new List(); set { _Objective = value; OnPropertyChanged("Objective"); } } - private List _Objective; + private List? _Objective; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchStudy; - - if (dest == null) - { + if(other is not ResearchStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Protocol.Any()) dest.Protocol = new List(Protocol.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PrimaryPurposeType != null) dest.PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)PrimaryPurposeType.DeepCopyInternal(); - if(Phase != null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)Phase.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Keyword.Any()) dest.Keyword = new List(Keyword.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Enrollment.Any()) dest.Enrollment = new List(Enrollment.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Sponsor != null) dest.Sponsor = (Hl7.Fhir.Model.ResourceReference)Sponsor.DeepCopyInternal(); - if(PrincipalInvestigator != null) dest.PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)PrincipalInvestigator.DeepCopyInternal(); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(ReasonStopped != null) dest.ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)ReasonStopped.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Arm.Any()) dest.Arm = new List(Arm.DeepCopyInternal()); - if(Objective.Any()) dest.Objective = new List(Objective.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Protocol is not null) dest.Protocol = new List(_Protocol.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PrimaryPurposeType is not null) dest.PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)_PrimaryPurposeType.DeepCopyInternal(); + if(_Phase is not null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)_Phase.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Keyword is not null) dest.Keyword = new List(_Keyword.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Enrollment is not null) dest.Enrollment = new List(_Enrollment.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Sponsor is not null) dest.Sponsor = (Hl7.Fhir.Model.ResourceReference)_Sponsor.DeepCopyInternal(); + if(_PrincipalInvestigator is not null) dest.PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)_PrincipalInvestigator.DeepCopyInternal(); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_ReasonStopped is not null) dest.ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)_ReasonStopped.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Arm is not null) dest.Arm = new List(_Arm.DeepCopyInternal()); + if(_Objective is not null) dest.Objective = new List(_Objective.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -897,195 +870,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchStudy; - if(otherT == null) return false; + if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(Protocol, otherT.Protocol)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(PrimaryPurposeType, otherT.PrimaryPurposeType)) return false; - if(!comparer.Equals(Phase, otherT.Phase)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Keyword, otherT.Keyword)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Enrollment, otherT.Enrollment)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Sponsor, otherT.Sponsor)) return false; - if(!comparer.Equals(PrincipalInvestigator, otherT.PrincipalInvestigator)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.Equals(ReasonStopped, otherT.ReasonStopped)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Arm, otherT.Arm)) return false; - if(!comparer.ListEquals(Objective, otherT.Objective)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_Protocol, otherT._Protocol)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_PrimaryPurposeType, otherT._PrimaryPurposeType)) return false; + if(!comparer.Equals(_Phase, otherT._Phase)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Keyword, otherT._Keyword)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Enrollment, otherT._Enrollment)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Sponsor, otherT._Sponsor)) return false; + if(!comparer.Equals(_PrincipalInvestigator, otherT._PrincipalInvestigator)) return false; + if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_ReasonStopped, otherT._ReasonStopped)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Arm, otherT._Arm)) return false; + if(!comparer.ListEquals(_Objective, otherT._Objective)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "protocol": - value = Protocol; - return Protocol?.Any() == true; + value = _Protocol; + return _Protocol?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "primaryPurposeType": - value = PrimaryPurposeType; - return PrimaryPurposeType is not null; + value = _PrimaryPurposeType; + return _PrimaryPurposeType is not null; case "phase": - value = Phase; - return Phase is not null; + value = _Phase; + return _Phase is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "keyword": - value = Keyword; - return Keyword?.Any() == true; + value = _Keyword; + return _Keyword?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "enrollment": - value = Enrollment; - return Enrollment?.Any() == true; + value = _Enrollment; + return _Enrollment?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "sponsor": - value = Sponsor; - return Sponsor is not null; + value = _Sponsor; + return _Sponsor is not null; case "principalInvestigator": - value = PrincipalInvestigator; - return PrincipalInvestigator is not null; + value = _PrincipalInvestigator; + return _PrincipalInvestigator is not null; case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "reasonStopped": - value = ReasonStopped; - return ReasonStopped is not null; + value = _ReasonStopped; + return _ReasonStopped is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "arm": - value = Arm; - return Arm?.Any() == true; + value = _Arm; + return _Arm?.Any() == true; case "objective": - value = Objective; - return Objective?.Any() == true; + value = _Objective; + return _Objective?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "protocol": - Protocol = (List)value; + Protocol = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "primaryPurposeType": - PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)value; + PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "phase": - Phase = (Hl7.Fhir.Model.CodeableConcept)value; + Phase = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "keyword": - Keyword = (List)value; + Keyword = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "enrollment": - Enrollment = (List)value; + Enrollment = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "sponsor": - Sponsor = (Hl7.Fhir.Model.ResourceReference)value; + Sponsor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "principalInvestigator": - PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)value; + PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "site": - Site = (List)value; + Site = (List?)value!; return this; case "reasonStopped": - ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)value; + ReasonStopped = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "arm": - Arm = (List)value; + Arm = (List?)value!; return this; case "objective": - Objective = (List)value; + Objective = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1096,30 +1069,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Protocol?.Any() == true) yield return new KeyValuePair("protocol",Protocol); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PrimaryPurposeType is not null) yield return new KeyValuePair("primaryPurposeType",PrimaryPurposeType); - if (Phase is not null) yield return new KeyValuePair("phase",Phase); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Keyword?.Any() == true) yield return new KeyValuePair("keyword",Keyword); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Enrollment?.Any() == true) yield return new KeyValuePair("enrollment",Enrollment); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Sponsor is not null) yield return new KeyValuePair("sponsor",Sponsor); - if (PrincipalInvestigator is not null) yield return new KeyValuePair("principalInvestigator",PrincipalInvestigator); - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (ReasonStopped is not null) yield return new KeyValuePair("reasonStopped",ReasonStopped); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Arm?.Any() == true) yield return new KeyValuePair("arm",Arm); - if (Objective?.Any() == true) yield return new KeyValuePair("objective",Objective); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Protocol?.Any() == true) yield return new KeyValuePair("protocol",_Protocol); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PrimaryPurposeType is not null) yield return new KeyValuePair("primaryPurposeType",_PrimaryPurposeType); + if (_Phase is not null) yield return new KeyValuePair("phase",_Phase); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Keyword?.Any() == true) yield return new KeyValuePair("keyword",_Keyword); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Enrollment?.Any() == true) yield return new KeyValuePair("enrollment",_Enrollment); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Sponsor is not null) yield return new KeyValuePair("sponsor",_Sponsor); + if (_PrincipalInvestigator is not null) yield return new KeyValuePair("principalInvestigator",_PrincipalInvestigator); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_ReasonStopped is not null) yield return new KeyValuePair("reasonStopped",_ReasonStopped); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Arm?.Any() == true) yield return new KeyValuePair("arm",_Arm); + if (_Objective?.Any() == true) yield return new KeyValuePair("objective",_Objective); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs index 6b1dad43d..87a276b84 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -156,11 +159,11 @@ public enum ResearchSubjectStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn. @@ -170,13 +173,13 @@ public List Identifier [Binding("ResearchSubjectStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn @@ -185,13 +188,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ResearchSubject.ResearchSubjectStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -201,13 +201,13 @@ public Hl7.Fhir.Model.ResearchSubject.ResearchSubjectStatus? Status /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Study subject is part of. @@ -217,13 +217,13 @@ public Hl7.Fhir.Model.Period Period [References("ResearchStudy")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Study + public Hl7.Fhir.Model.ResourceReference? Study { get { return _Study; } set { _Study = value; OnPropertyChanged("Study"); } } - private Hl7.Fhir.Model.ResourceReference _Study; + private Hl7.Fhir.Model.ResourceReference? _Study; /// /// Who is part of study. @@ -233,41 +233,38 @@ public Hl7.Fhir.Model.ResourceReference Study [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Individual + public Hl7.Fhir.Model.ResourceReference? Individual { get { return _Individual; } set { _Individual = value; OnPropertyChanged("Individual"); } } - private Hl7.Fhir.Model.ResourceReference _Individual; + private Hl7.Fhir.Model.ResourceReference? _Individual; /// /// What path should be followed. /// [FhirElement("assignedArm", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString AssignedArmElement + public Hl7.Fhir.Model.FhirString? AssignedArmElement { get { return _AssignedArmElement; } set { _AssignedArmElement = value; OnPropertyChanged("AssignedArmElement"); } } - private Hl7.Fhir.Model.FhirString _AssignedArmElement; + private Hl7.Fhir.Model.FhirString? _AssignedArmElement; /// /// What path should be followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AssignedArm + public string? AssignedArm { - get { return AssignedArmElement != null ? AssignedArmElement.Value : null; } + get => _AssignedArmElement?.Value; set { - if (value == null) - AssignedArmElement = null; - else - AssignedArmElement = new Hl7.Fhir.Model.FhirString(value); + AssignedArmElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AssignedArm"); } } @@ -277,28 +274,25 @@ public string AssignedArm /// [FhirElement("actualArm", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString ActualArmElement + public Hl7.Fhir.Model.FhirString? ActualArmElement { get { return _ActualArmElement; } set { _ActualArmElement = value; OnPropertyChanged("ActualArmElement"); } } - private Hl7.Fhir.Model.FhirString _ActualArmElement; + private Hl7.Fhir.Model.FhirString? _ActualArmElement; /// /// What path was followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActualArm + public string? ActualArm { - get { return ActualArmElement != null ? ActualArmElement.Value : null; } + get => _ActualArmElement?.Value; set { - if (value == null) - ActualArmElement = null; - else - ActualArmElement = new Hl7.Fhir.Model.FhirString(value); + ActualArmElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ActualArm"); } } @@ -310,34 +304,30 @@ public string ActualArm [CLSCompliant(false)] [References("Consent")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Consent + public Hl7.Fhir.Model.ResourceReference? Consent { get { return _Consent; } set { _Consent = value; OnPropertyChanged("Consent"); } } - private Hl7.Fhir.Model.ResourceReference _Consent; + private Hl7.Fhir.Model.ResourceReference? _Consent; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchSubject; - - if (dest == null) - { + if(other is not ResearchSubject dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Study != null) dest.Study = (Hl7.Fhir.Model.ResourceReference)Study.DeepCopyInternal(); - if(Individual != null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)Individual.DeepCopyInternal(); - if(AssignedArmElement != null) dest.AssignedArmElement = (Hl7.Fhir.Model.FhirString)AssignedArmElement.DeepCopyInternal(); - if(ActualArmElement != null) dest.ActualArmElement = (Hl7.Fhir.Model.FhirString)ActualArmElement.DeepCopyInternal(); - if(Consent != null) dest.Consent = (Hl7.Fhir.Model.ResourceReference)Consent.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Study is not null) dest.Study = (Hl7.Fhir.Model.ResourceReference)_Study.DeepCopyInternal(); + if(_Individual is not null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)_Individual.DeepCopyInternal(); + if(_AssignedArmElement is not null) dest.AssignedArmElement = (Hl7.Fhir.Model.FhirString)_AssignedArmElement.DeepCopyInternal(); + if(_ActualArmElement is not null) dest.ActualArmElement = (Hl7.Fhir.Model.FhirString)_ActualArmElement.DeepCopyInternal(); + if(_Consent is not null) dest.Consent = (Hl7.Fhir.Model.ResourceReference)_Consent.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,83 +339,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchSubject; - if(otherT == null) return false; + if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Study, otherT.Study)) return false; - if(!comparer.Equals(Individual, otherT.Individual)) return false; - if(!comparer.Equals(AssignedArmElement, otherT.AssignedArmElement)) return false; - if(!comparer.Equals(ActualArmElement, otherT.ActualArmElement)) return false; - if(!comparer.Equals(Consent, otherT.Consent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Study, otherT._Study)) return false; + if(!comparer.Equals(_Individual, otherT._Individual)) return false; + if(!comparer.Equals(_AssignedArmElement, otherT._AssignedArmElement)) return false; + if(!comparer.Equals(_ActualArmElement, otherT._ActualArmElement)) return false; + if(!comparer.Equals(_Consent, otherT._Consent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "study": - value = Study; - return Study is not null; + value = _Study; + return _Study is not null; case "individual": - value = Individual; - return Individual is not null; + value = _Individual; + return _Individual is not null; case "assignedArm": - value = AssignedArmElement; - return AssignedArmElement is not null; + value = _AssignedArmElement; + return _AssignedArmElement is not null; case "actualArm": - value = ActualArmElement; - return ActualArmElement is not null; + value = _ActualArmElement; + return _ActualArmElement is not null; case "consent": - value = Consent; - return Consent is not null; + value = _Consent; + return _Consent is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "study": - Study = (Hl7.Fhir.Model.ResourceReference)value; + Study = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "individual": - Individual = (Hl7.Fhir.Model.ResourceReference)value; + Individual = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assignedArm": - AssignedArmElement = (Hl7.Fhir.Model.FhirString)value; + AssignedArmElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "actualArm": - ActualArmElement = (Hl7.Fhir.Model.FhirString)value; + ActualArmElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "consent": - Consent = (Hl7.Fhir.Model.ResourceReference)value; + Consent = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -436,14 +426,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Study is not null) yield return new KeyValuePair("study",Study); - if (Individual is not null) yield return new KeyValuePair("individual",Individual); - if (AssignedArmElement is not null) yield return new KeyValuePair("assignedArm",AssignedArmElement); - if (ActualArmElement is not null) yield return new KeyValuePair("actualArm",ActualArmElement); - if (Consent is not null) yield return new KeyValuePair("consent",Consent); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Study is not null) yield return new KeyValuePair("study",_Study); + if (_Individual is not null) yield return new KeyValuePair("individual",_Individual); + if (_AssignedArmElement is not null) yield return new KeyValuePair("assignedArm",_AssignedArmElement); + if (_ActualArmElement is not null) yield return new KeyValuePair("actualArm",_ActualArmElement); + if (_Consent is not null) yield return new KeyValuePair("consent",_Consent); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs index 5e2467d06..cb25add02 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("RiskAssessment","http://hl7.org/fhir/StructureDefinition/RiskAssessment")] - public partial class RiskAssessment : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class RiskAssessment : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -82,13 +85,13 @@ public partial class PredictionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("outcome", Order=40)] [Binding("RiskAssessmentOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Likelihood of specified outcome. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Probability + public Hl7.Fhir.Model.DataType? Probability { get { return _Probability; } set { _Probability = value; OnPropertyChanged("Probability"); } } - private Hl7.Fhir.Model.DataType _Probability; + private Hl7.Fhir.Model.DataType? _Probability; /// /// Likelihood of specified outcome as a qualitative value. @@ -111,26 +114,26 @@ public Hl7.Fhir.Model.DataType Probability [FhirElement("qualitativeRisk", Order=60)] [Binding("RiskAssessmentProbability")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept QualitativeRisk + public Hl7.Fhir.Model.CodeableConcept? QualitativeRisk { get { return _QualitativeRisk; } set { _QualitativeRisk = value; OnPropertyChanged("QualitativeRisk"); } } - private Hl7.Fhir.Model.CodeableConcept _QualitativeRisk; + private Hl7.Fhir.Model.CodeableConcept? _QualitativeRisk; /// /// Relative likelihood. /// [FhirElement("relativeRisk", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement + public Hl7.Fhir.Model.FhirDecimal? RelativeRiskElement { get { return _RelativeRiskElement; } set { _RelativeRiskElement = value; OnPropertyChanged("RelativeRiskElement"); } } - private Hl7.Fhir.Model.FhirDecimal _RelativeRiskElement; + private Hl7.Fhir.Model.FhirDecimal? _RelativeRiskElement; /// /// Relative likelihood @@ -139,13 +142,10 @@ public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement [IgnoreDataMember] public decimal? RelativeRisk { - get { return RelativeRiskElement != null ? RelativeRiskElement.Value : null; } + get => _RelativeRiskElement?.Value; set { - if (value == null) - RelativeRiskElement = null; - else - RelativeRiskElement = new Hl7.Fhir.Model.FhirDecimal(value); + RelativeRiskElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("RelativeRisk"); } } @@ -157,61 +157,54 @@ public decimal? RelativeRisk [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; /// /// Explanation of prediction. /// [FhirElement("rationale", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString RationaleElement + public Hl7.Fhir.Model.FhirString? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.FhirString _RationaleElement; + private Hl7.Fhir.Model.FhirString? _RationaleElement; /// /// Explanation of prediction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.FhirString(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Rationale"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PredictionComponent; - - if (dest == null) - { + if(other is not PredictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Probability != null) dest.Probability = (Hl7.Fhir.Model.DataType)Probability.DeepCopyInternal(); - if(QualitativeRisk != null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)QualitativeRisk.DeepCopyInternal(); - if(RelativeRiskElement != null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)RelativeRiskElement.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)RationaleElement.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Probability is not null) dest.Probability = (Hl7.Fhir.Model.DataType)_Probability.DeepCopyInternal(); + if(_QualitativeRisk is not null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)_QualitativeRisk.DeepCopyInternal(); + if(_RelativeRiskElement is not null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)_RelativeRiskElement.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)_RationaleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -223,69 +216,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PredictionComponent; - if(otherT == null) return false; + if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Probability, otherT.Probability)) return false; - if(!comparer.Equals(QualitativeRisk, otherT.QualitativeRisk)) return false; - if(!comparer.Equals(RelativeRiskElement, otherT.RelativeRiskElement)) return false; - if(!comparer.Equals(When, otherT.When)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Probability, otherT._Probability)) return false; + if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; + if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "probability": - value = Probability; - return Probability is not null; + value = _Probability; + return _Probability is not null; case "qualitativeRisk": - value = QualitativeRisk; - return QualitativeRisk is not null; + value = _QualitativeRisk; + return _QualitativeRisk is not null; case "relativeRisk": - value = RelativeRiskElement; - return RelativeRiskElement is not null; + value = _RelativeRiskElement; + return _RelativeRiskElement is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "probability": - Probability = (Hl7.Fhir.Model.DataType)value; + Probability = (Hl7.Fhir.Model.DataType?)value; return this; case "qualitativeRisk": - QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)value; + QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "relativeRisk": - RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)value; + RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.FhirString)value; + RationaleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -296,12 +289,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Probability is not null) yield return new KeyValuePair("probability",Probability); - if (QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",QualitativeRisk); - if (RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",RelativeRiskElement); - if (When is not null) yield return new KeyValuePair("when",When); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Probability is not null) yield return new KeyValuePair("probability",_Probability); + if (_QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",_QualitativeRisk); + if (_RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",_RelativeRiskElement); + if (_When is not null) yield return new KeyValuePair("when",_When); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); } } @@ -314,11 +307,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Request fulfilled by this assessment. @@ -327,13 +320,13 @@ public List Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BasedOn + public Hl7.Fhir.Model.ResourceReference? BasedOn { get { return _BasedOn; } set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private Hl7.Fhir.Model.ResourceReference _BasedOn; + private Hl7.Fhir.Model.ResourceReference? _BasedOn; /// /// Part of this occurrence. @@ -342,13 +335,13 @@ public Hl7.Fhir.Model.ResourceReference BasedOn [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// registered | preliminary | final | amended +. @@ -358,13 +351,13 @@ public Hl7.Fhir.Model.ResourceReference Parent [Binding("RiskAssessmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -373,13 +366,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -390,26 +380,26 @@ public Hl7.Fhir.Model.ObservationStatus? Status [FhirElement("method", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("RiskAssessmentMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of assessment. /// [FhirElement("code", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/what does assessment apply to?. @@ -419,13 +409,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Where was assessment performed?. @@ -434,13 +424,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When was assessment made?. @@ -449,13 +439,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Condition assessed. @@ -464,13 +454,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Condition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Who did assessment?. @@ -479,13 +469,13 @@ public Hl7.Fhir.Model.ResourceReference Condition [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Why the assessment was necessary?. @@ -495,11 +485,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why the assessment was necessary?. @@ -511,11 +501,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Information used in assessment. @@ -527,11 +517,11 @@ public List ReasonReference [DataMember] public List Basis { - get { if(_Basis==null) _Basis = new List(); return _Basis; } + get => _Basis ?? new List(); set { _Basis = value; OnPropertyChanged("Basis"); } } - private List _Basis; + private List? _Basis; /// /// Outcome predicted. @@ -541,39 +531,36 @@ public List Basis [DataMember] public List Prediction { - get { if(_Prediction==null) _Prediction = new List(); return _Prediction; } + get => _Prediction ?? new List(); set { _Prediction = value; OnPropertyChanged("Prediction"); } } - private List _Prediction; + private List? _Prediction; /// /// How to reduce risk. /// [FhirElement("mitigation", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString MitigationElement + public Hl7.Fhir.Model.FhirString? MitigationElement { get { return _MitigationElement; } set { _MitigationElement = value; OnPropertyChanged("MitigationElement"); } } - private Hl7.Fhir.Model.FhirString _MitigationElement; + private Hl7.Fhir.Model.FhirString? _MitigationElement; /// /// How to reduce risk /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Mitigation + public string? Mitigation { - get { return MitigationElement != null ? MitigationElement.Value : null; } + get => _MitigationElement?.Value; set { - if (value == null) - MitigationElement = null; - else - MitigationElement = new Hl7.Fhir.Model.FhirString(value); + MitigationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Mitigation"); } } @@ -586,44 +573,40 @@ public string Mitigation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as RiskAssessment; - - if (dest == null) - { + if(other is not RiskAssessment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn != null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)BasedOn.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Basis.Any()) dest.Basis = new List(Basis.DeepCopyInternal()); - if(Prediction.Any()) dest.Prediction = new List(Prediction.DeepCopyInternal()); - if(MitigationElement != null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)MitigationElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)_BasedOn.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Basis is not null) dest.Basis = new List(_Basis.DeepCopyInternal()); + if(_Prediction is not null) dest.Prediction = new List(_Prediction.DeepCopyInternal()); + if(_MitigationElement is not null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)_MitigationElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -635,146 +618,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RiskAssessment; - if(otherT == null) return false; + if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Basis, otherT.Basis)) return false; - if(!comparer.ListEquals(Prediction, otherT.Prediction)) return false; - if(!comparer.Equals(MitigationElement, otherT.MitigationElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; + if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn is not null; + value = _BasedOn; + return _BasedOn is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "basis": - value = Basis; - return Basis?.Any() == true; + value = _Basis; + return _Basis?.Any() == true; case "prediction": - value = Prediction; - return Prediction?.Any() == true; + value = _Prediction; + return _Prediction?.Any() == true; case "mitigation": - value = MitigationElement; - return MitigationElement is not null; + value = _MitigationElement; + return _MitigationElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (Hl7.Fhir.Model.ResourceReference)value; + BasedOn = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "basis": - Basis = (List)value; + Basis = (List?)value!; return this; case "prediction": - Prediction = (List)value; + Prediction = (List?)value!; return this; case "mitigation": - MitigationElement = (Hl7.Fhir.Model.FhirString)value; + MitigationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -785,23 +768,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn is not null) yield return new KeyValuePair("basedOn",BasedOn); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Basis?.Any() == true) yield return new KeyValuePair("basis",Basis); - if (Prediction?.Any() == true) yield return new KeyValuePair("prediction",Prediction); - if (MitigationElement is not null) yield return new KeyValuePair("mitigation",MitigationElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn is not null) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Basis?.Any() == true) yield return new KeyValuePair("basis",_Basis); + if (_Prediction?.Any() == true) yield return new KeyValuePair("prediction",_Prediction); + if (_MitigationElement is not null) yield return new KeyValuePair("mitigation",_MitigationElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs b/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs index 67b5b39cb..b14ba2bdc 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,28 +83,25 @@ public partial class SampleSizeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of sample size /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -111,13 +111,13 @@ public string Description /// [FhirElement("numberOfStudies", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfStudiesElement + public Hl7.Fhir.Model.Integer? NumberOfStudiesElement { get { return _NumberOfStudiesElement; } set { _NumberOfStudiesElement = value; OnPropertyChanged("NumberOfStudiesElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfStudiesElement; + private Hl7.Fhir.Model.Integer? _NumberOfStudiesElement; /// /// How many studies? @@ -126,13 +126,10 @@ public Hl7.Fhir.Model.Integer NumberOfStudiesElement [IgnoreDataMember] public int? NumberOfStudies { - get { return NumberOfStudiesElement != null ? NumberOfStudiesElement.Value : null; } + get => _NumberOfStudiesElement?.Value; set { - if (value == null) - NumberOfStudiesElement = null; - else - NumberOfStudiesElement = new Hl7.Fhir.Model.Integer(value); + NumberOfStudiesElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfStudies"); } } @@ -142,13 +139,13 @@ public int? NumberOfStudies /// [FhirElement("numberOfParticipants", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfParticipantsElement + public Hl7.Fhir.Model.Integer? NumberOfParticipantsElement { get { return _NumberOfParticipantsElement; } set { _NumberOfParticipantsElement = value; OnPropertyChanged("NumberOfParticipantsElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfParticipantsElement; + private Hl7.Fhir.Model.Integer? _NumberOfParticipantsElement; /// /// How many participants? @@ -157,30 +154,23 @@ public Hl7.Fhir.Model.Integer NumberOfParticipantsElement [IgnoreDataMember] public int? NumberOfParticipants { - get { return NumberOfParticipantsElement != null ? NumberOfParticipantsElement.Value : null; } + get => _NumberOfParticipantsElement?.Value; set { - if (value == null) - NumberOfParticipantsElement = null; - else - NumberOfParticipantsElement = new Hl7.Fhir.Model.Integer(value); + NumberOfParticipantsElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfParticipants"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampleSizeComponent; - - if (dest == null) - { + if(other is not SampleSizeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NumberOfStudiesElement != null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.Integer)NumberOfStudiesElement.DeepCopyInternal(); - if(NumberOfParticipantsElement != null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer)NumberOfParticipantsElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NumberOfStudiesElement is not null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.Integer)_NumberOfStudiesElement.DeepCopyInternal(); + if(_NumberOfParticipantsElement is not null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer)_NumberOfParticipantsElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -192,48 +182,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampleSizeComponent; - if(otherT == null) return false; + if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NumberOfStudiesElement, otherT.NumberOfStudiesElement)) return false; - if(!comparer.Equals(NumberOfParticipantsElement, otherT.NumberOfParticipantsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; + if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "numberOfStudies": - value = NumberOfStudiesElement; - return NumberOfStudiesElement is not null; + value = _NumberOfStudiesElement; + return _NumberOfStudiesElement is not null; case "numberOfParticipants": - value = NumberOfParticipantsElement; - return NumberOfParticipantsElement is not null; + value = _NumberOfParticipantsElement; + return _NumberOfParticipantsElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "numberOfStudies": - NumberOfStudiesElement = (Hl7.Fhir.Model.Integer)value; + NumberOfStudiesElement = (Hl7.Fhir.Model.Integer?)value; return this; case "numberOfParticipants": - NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer)value; + NumberOfParticipantsElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -244,9 +234,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",NumberOfStudiesElement); - if (NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",NumberOfParticipantsElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",_NumberOfStudiesElement); + if (_NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",_NumberOfParticipantsElement); } } @@ -272,28 +262,25 @@ public partial class RiskEstimateComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of risk estimate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -304,26 +291,26 @@ public string Description [FhirElement("type", Order=50)] [Binding("RiskEstimateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Point estimate. /// [FhirElement("value", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Point estimate @@ -332,13 +319,10 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } @@ -349,26 +333,26 @@ public decimal? Value [FhirElement("unitOfMeasure", Order=70)] [Binding("UCUMUnits")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfMeasure + public Hl7.Fhir.Model.CodeableConcept? UnitOfMeasure { get { return _UnitOfMeasure; } set { _UnitOfMeasure = value; OnPropertyChanged("UnitOfMeasure"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfMeasure; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfMeasure; /// /// Sample size for group measured. /// [FhirElement("denominatorCount", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer DenominatorCountElement + public Hl7.Fhir.Model.Integer? DenominatorCountElement { get { return _DenominatorCountElement; } set { _DenominatorCountElement = value; OnPropertyChanged("DenominatorCountElement"); } } - private Hl7.Fhir.Model.Integer _DenominatorCountElement; + private Hl7.Fhir.Model.Integer? _DenominatorCountElement; /// /// Sample size for group measured @@ -377,13 +361,10 @@ public Hl7.Fhir.Model.Integer DenominatorCountElement [IgnoreDataMember] public int? DenominatorCount { - get { return DenominatorCountElement != null ? DenominatorCountElement.Value : null; } + get => _DenominatorCountElement?.Value; set { - if (value == null) - DenominatorCountElement = null; - else - DenominatorCountElement = new Hl7.Fhir.Model.Integer(value); + DenominatorCountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("DenominatorCount"); } } @@ -393,13 +374,13 @@ public int? DenominatorCount /// [FhirElement("numeratorCount", Order=90)] [DataMember] - public Hl7.Fhir.Model.Integer NumeratorCountElement + public Hl7.Fhir.Model.Integer? NumeratorCountElement { get { return _NumeratorCountElement; } set { _NumeratorCountElement = value; OnPropertyChanged("NumeratorCountElement"); } } - private Hl7.Fhir.Model.Integer _NumeratorCountElement; + private Hl7.Fhir.Model.Integer? _NumeratorCountElement; /// /// Number with the outcome @@ -408,13 +389,10 @@ public Hl7.Fhir.Model.Integer NumeratorCountElement [IgnoreDataMember] public int? NumeratorCount { - get { return NumeratorCountElement != null ? NumeratorCountElement.Value : null; } + get => _NumeratorCountElement?.Value; set { - if (value == null) - NumeratorCountElement = null; - else - NumeratorCountElement = new Hl7.Fhir.Model.Integer(value); + NumeratorCountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumeratorCount"); } } @@ -427,29 +405,25 @@ public int? NumeratorCount [DataMember] public List PrecisionEstimate { - get { if(_PrecisionEstimate==null) _PrecisionEstimate = new List(); return _PrecisionEstimate; } + get => _PrecisionEstimate ?? new List(); set { _PrecisionEstimate = value; OnPropertyChanged("PrecisionEstimate"); } } - private List _PrecisionEstimate; + private List? _PrecisionEstimate; protected internal override void CopyToInternal(Base other) { - var dest = other as RiskEstimateComponent; - - if (dest == null) - { + if(other is not RiskEstimateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); - if(UnitOfMeasure != null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)UnitOfMeasure.DeepCopyInternal(); - if(DenominatorCountElement != null) dest.DenominatorCountElement = (Hl7.Fhir.Model.Integer)DenominatorCountElement.DeepCopyInternal(); - if(NumeratorCountElement != null) dest.NumeratorCountElement = (Hl7.Fhir.Model.Integer)NumeratorCountElement.DeepCopyInternal(); - if(PrecisionEstimate.Any()) dest.PrecisionEstimate = new List(PrecisionEstimate.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); + if(_UnitOfMeasure is not null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)_UnitOfMeasure.DeepCopyInternal(); + if(_DenominatorCountElement is not null) dest.DenominatorCountElement = (Hl7.Fhir.Model.Integer)_DenominatorCountElement.DeepCopyInternal(); + if(_NumeratorCountElement is not null) dest.NumeratorCountElement = (Hl7.Fhir.Model.Integer)_NumeratorCountElement.DeepCopyInternal(); + if(_PrecisionEstimate is not null) dest.PrecisionEstimate = new List(_PrecisionEstimate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -461,76 +435,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RiskEstimateComponent; - if(otherT == null) return false; + if(other is not RiskEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(UnitOfMeasure, otherT.UnitOfMeasure)) return false; - if(!comparer.Equals(DenominatorCountElement, otherT.DenominatorCountElement)) return false; - if(!comparer.Equals(NumeratorCountElement, otherT.NumeratorCountElement)) return false; - if(!comparer.ListEquals(PrecisionEstimate, otherT.PrecisionEstimate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; + if(!comparer.Equals(_DenominatorCountElement, otherT._DenominatorCountElement)) return false; + if(!comparer.Equals(_NumeratorCountElement, otherT._NumeratorCountElement)) return false; + if(!comparer.ListEquals(_PrecisionEstimate, otherT._PrecisionEstimate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "unitOfMeasure": - value = UnitOfMeasure; - return UnitOfMeasure is not null; + value = _UnitOfMeasure; + return _UnitOfMeasure is not null; case "denominatorCount": - value = DenominatorCountElement; - return DenominatorCountElement is not null; + value = _DenominatorCountElement; + return _DenominatorCountElement is not null; case "numeratorCount": - value = NumeratorCountElement; - return NumeratorCountElement is not null; + value = _NumeratorCountElement; + return _NumeratorCountElement is not null; case "precisionEstimate": - value = PrecisionEstimate; - return PrecisionEstimate?.Any() == true; + value = _PrecisionEstimate; + return _PrecisionEstimate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "unitOfMeasure": - UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "denominatorCount": - DenominatorCountElement = (Hl7.Fhir.Model.Integer)value; + DenominatorCountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "numeratorCount": - NumeratorCountElement = (Hl7.Fhir.Model.Integer)value; + NumeratorCountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "precisionEstimate": - PrecisionEstimate = (List)value; + PrecisionEstimate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -541,13 +515,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",UnitOfMeasure); - if (DenominatorCountElement is not null) yield return new KeyValuePair("denominatorCount",DenominatorCountElement); - if (NumeratorCountElement is not null) yield return new KeyValuePair("numeratorCount",NumeratorCountElement); - if (PrecisionEstimate?.Any() == true) yield return new KeyValuePair("precisionEstimate",PrecisionEstimate); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",_UnitOfMeasure); + if (_DenominatorCountElement is not null) yield return new KeyValuePair("denominatorCount",_DenominatorCountElement); + if (_NumeratorCountElement is not null) yield return new KeyValuePair("numeratorCount",_NumeratorCountElement); + if (_PrecisionEstimate?.Any() == true) yield return new KeyValuePair("precisionEstimate",_PrecisionEstimate); } } @@ -574,26 +548,26 @@ public partial class PrecisionEstimateComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PrecisionEstimateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Level of confidence interval. /// [FhirElement("level", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LevelElement + public Hl7.Fhir.Model.FhirDecimal? LevelElement { get { return _LevelElement; } set { _LevelElement = value; OnPropertyChanged("LevelElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LevelElement; + private Hl7.Fhir.Model.FhirDecimal? _LevelElement; /// /// Level of confidence interval @@ -602,13 +576,10 @@ public Hl7.Fhir.Model.FhirDecimal LevelElement [IgnoreDataMember] public decimal? Level { - get { return LevelElement != null ? LevelElement.Value : null; } + get => _LevelElement?.Value; set { - if (value == null) - LevelElement = null; - else - LevelElement = new Hl7.Fhir.Model.FhirDecimal(value); + LevelElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Level"); } } @@ -618,13 +589,13 @@ public decimal? Level /// [FhirElement("from", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FromElement + public Hl7.Fhir.Model.FhirDecimal? FromElement { get { return _FromElement; } set { _FromElement = value; OnPropertyChanged("FromElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FromElement; + private Hl7.Fhir.Model.FhirDecimal? _FromElement; /// /// Lower bound @@ -633,13 +604,10 @@ public Hl7.Fhir.Model.FhirDecimal FromElement [IgnoreDataMember] public decimal? From { - get { return FromElement != null ? FromElement.Value : null; } + get => _FromElement?.Value; set { - if (value == null) - FromElement = null; - else - FromElement = new Hl7.Fhir.Model.FhirDecimal(value); + FromElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("From"); } } @@ -649,13 +617,13 @@ public decimal? From /// [FhirElement("to", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ToElement + public Hl7.Fhir.Model.FhirDecimal? ToElement { get { return _ToElement; } set { _ToElement = value; OnPropertyChanged("ToElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ToElement; + private Hl7.Fhir.Model.FhirDecimal? _ToElement; /// /// Upper bound @@ -664,31 +632,24 @@ public Hl7.Fhir.Model.FhirDecimal ToElement [IgnoreDataMember] public decimal? To { - get { return ToElement != null ? ToElement.Value : null; } + get => _ToElement?.Value; set { - if (value == null) - ToElement = null; - else - ToElement = new Hl7.Fhir.Model.FhirDecimal(value); + ToElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("To"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PrecisionEstimateComponent; - - if (dest == null) - { + if(other is not PrecisionEstimateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(LevelElement != null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)LevelElement.DeepCopyInternal(); - if(FromElement != null) dest.FromElement = (Hl7.Fhir.Model.FhirDecimal)FromElement.DeepCopyInternal(); - if(ToElement != null) dest.ToElement = (Hl7.Fhir.Model.FhirDecimal)ToElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_LevelElement is not null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)_LevelElement.DeepCopyInternal(); + if(_FromElement is not null) dest.FromElement = (Hl7.Fhir.Model.FhirDecimal)_FromElement.DeepCopyInternal(); + if(_ToElement is not null) dest.ToElement = (Hl7.Fhir.Model.FhirDecimal)_ToElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -700,55 +661,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrecisionEstimateComponent; - if(otherT == null) return false; + if(other is not PrecisionEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(LevelElement, otherT.LevelElement)) return false; - if(!comparer.Equals(FromElement, otherT.FromElement)) return false; - if(!comparer.Equals(ToElement, otherT.ToElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; + if(!comparer.Equals(_FromElement, otherT._FromElement)) return false; + if(!comparer.Equals(_ToElement, otherT._ToElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "level": - value = LevelElement; - return LevelElement is not null; + value = _LevelElement; + return _LevelElement is not null; case "from": - value = FromElement; - return FromElement is not null; + value = _FromElement; + return _FromElement is not null; case "to": - value = ToElement; - return ToElement is not null; + value = _ToElement; + return _ToElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "level": - LevelElement = (Hl7.Fhir.Model.FhirDecimal)value; + LevelElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "from": - FromElement = (Hl7.Fhir.Model.FhirDecimal)value; + FromElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "to": - ToElement = (Hl7.Fhir.Model.FhirDecimal)value; + ToElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -759,10 +720,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (LevelElement is not null) yield return new KeyValuePair("level",LevelElement); - if (FromElement is not null) yield return new KeyValuePair("from",FromElement); - if (ToElement is not null) yield return new KeyValuePair("to",ToElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_LevelElement is not null) yield return new KeyValuePair("level",_LevelElement); + if (_FromElement is not null) yield return new KeyValuePair("from",_FromElement); + if (_ToElement is not null) yield return new KeyValuePair("to",_ToElement); } } @@ -792,11 +753,11 @@ public partial class CertaintyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Rating { - get { if(_Rating==null) _Rating = new List(); return _Rating; } + get => _Rating ?? new List(); set { _Rating = value; OnPropertyChanged("Rating"); } } - private List _Rating; + private List? _Rating; /// /// Used for footnotes or explanatory notes. @@ -806,11 +767,11 @@ public List Rating [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// A component that contributes to the overall certainty. @@ -820,25 +781,21 @@ public List Note [DataMember] public List CertaintySubcomponent { - get { if(_CertaintySubcomponent==null) _CertaintySubcomponent = new List(); return _CertaintySubcomponent; } + get => _CertaintySubcomponent ?? new List(); set { _CertaintySubcomponent = value; OnPropertyChanged("CertaintySubcomponent"); } } - private List _CertaintySubcomponent; + private List? _CertaintySubcomponent; protected internal override void CopyToInternal(Base other) { - var dest = other as CertaintyComponent; - - if (dest == null) - { + if(other is not CertaintyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Rating.Any()) dest.Rating = new List(Rating.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(CertaintySubcomponent.Any()) dest.CertaintySubcomponent = new List(CertaintySubcomponent.DeepCopyInternal()); + if(_Rating is not null) dest.Rating = new List(_Rating.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_CertaintySubcomponent is not null) dest.CertaintySubcomponent = new List(_CertaintySubcomponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -850,48 +807,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CertaintyComponent; - if(otherT == null) return false; + if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Rating, otherT.Rating)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(CertaintySubcomponent, otherT.CertaintySubcomponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_CertaintySubcomponent, otherT._CertaintySubcomponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "rating": - value = Rating; - return Rating?.Any() == true; + value = _Rating; + return _Rating?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "certaintySubcomponent": - value = CertaintySubcomponent; - return CertaintySubcomponent?.Any() == true; + value = _CertaintySubcomponent; + return _CertaintySubcomponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "rating": - Rating = (List)value; + Rating = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "certaintySubcomponent": - CertaintySubcomponent = (List)value; + CertaintySubcomponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -902,9 +859,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Rating?.Any() == true) yield return new KeyValuePair("rating",Rating); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (CertaintySubcomponent?.Any() == true) yield return new KeyValuePair("certaintySubcomponent",CertaintySubcomponent); + if (_Rating?.Any() == true) yield return new KeyValuePair("rating",_Rating); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_CertaintySubcomponent?.Any() == true) yield return new KeyValuePair("certaintySubcomponent",_CertaintySubcomponent); } } @@ -931,13 +888,13 @@ public partial class CertaintySubcomponentComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("type", Order=40)] [Binding("CertaintySubcomponentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Subcomponent certainty rating. @@ -948,11 +905,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Rating { - get { if(_Rating==null) _Rating = new List(); return _Rating; } + get => _Rating ?? new List(); set { _Rating = value; OnPropertyChanged("Rating"); } } - private List _Rating; + private List? _Rating; /// /// Used for footnotes or explanatory notes. @@ -962,25 +919,21 @@ public List Rating [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as CertaintySubcomponentComponent; - - if (dest == null) - { + if(other is not CertaintySubcomponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Rating.Any()) dest.Rating = new List(Rating.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Rating is not null) dest.Rating = new List(_Rating.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -992,48 +945,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CertaintySubcomponentComponent; - if(otherT == null) return false; + if(other is not CertaintySubcomponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Rating, otherT.Rating)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "rating": - value = Rating; - return Rating?.Any() == true; + value = _Rating; + return _Rating?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rating": - Rating = (List)value; + Rating = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1044,9 +997,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Rating?.Any() == true) yield return new KeyValuePair("rating",Rating); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Rating?.Any() == true) yield return new KeyValuePair("rating",_Rating); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -1056,28 +1009,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this risk evidence synthesis, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1090,39 +1040,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the risk evidence synthesis. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the risk evidence synthesis /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1132,28 +1079,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this risk evidence synthesis (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1163,28 +1107,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this risk evidence synthesis (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1197,13 +1138,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1212,13 +1153,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1228,28 +1166,25 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1259,28 +1194,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1293,39 +1225,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the risk evidence synthesis. /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the risk evidence synthesis /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1338,11 +1267,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The context that the content is intended to support. @@ -1352,11 +1281,11 @@ public List Note [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for risk evidence synthesis (if applicable). @@ -1367,39 +1296,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1409,28 +1335,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=230)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the risk evidence synthesis was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1440,28 +1363,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=240)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the risk evidence synthesis was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1471,13 +1391,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the EffectEvidenceSynthesis, such as Education, Treatment, Assessment, etc. @@ -1488,11 +1408,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1502,11 +1422,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1516,11 +1436,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1530,11 +1450,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1544,11 +1464,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1558,11 +1478,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Type of synthesis. @@ -1570,13 +1490,13 @@ public List RelatedArtifact [FhirElement("synthesisType", Order=320)] [Binding("SynthesisType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SynthesisType + public Hl7.Fhir.Model.CodeableConcept? SynthesisType { get { return _SynthesisType; } set { _SynthesisType = value; OnPropertyChanged("SynthesisType"); } } - private Hl7.Fhir.Model.CodeableConcept _SynthesisType; + private Hl7.Fhir.Model.CodeableConcept? _SynthesisType; /// /// Type of study. @@ -1584,13 +1504,13 @@ public Hl7.Fhir.Model.CodeableConcept SynthesisType [FhirElement("studyType", Order=330)] [Binding("StudyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StudyType + public Hl7.Fhir.Model.CodeableConcept? StudyType { get { return _StudyType; } set { _StudyType = value; OnPropertyChanged("StudyType"); } } - private Hl7.Fhir.Model.CodeableConcept _StudyType; + private Hl7.Fhir.Model.CodeableConcept? _StudyType; /// /// What population?. @@ -1600,13 +1520,13 @@ public Hl7.Fhir.Model.CodeableConcept StudyType [References("EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Population + public Hl7.Fhir.Model.ResourceReference? Population { get { return _Population; } set { _Population = value; OnPropertyChanged("Population"); } } - private Hl7.Fhir.Model.ResourceReference _Population; + private Hl7.Fhir.Model.ResourceReference? _Population; /// /// What exposure?. @@ -1615,13 +1535,13 @@ public Hl7.Fhir.Model.ResourceReference Population [CLSCompliant(false)] [References("EvidenceVariable")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Exposure + public Hl7.Fhir.Model.ResourceReference? Exposure { get { return _Exposure; } set { _Exposure = value; OnPropertyChanged("Exposure"); } } - private Hl7.Fhir.Model.ResourceReference _Exposure; + private Hl7.Fhir.Model.ResourceReference? _Exposure; /// /// What outcome?. @@ -1631,39 +1551,39 @@ public Hl7.Fhir.Model.ResourceReference Exposure [References("EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Outcome + public Hl7.Fhir.Model.ResourceReference? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.ResourceReference _Outcome; + private Hl7.Fhir.Model.ResourceReference? _Outcome; /// /// What sample size was involved?. /// [FhirElement("sampleSize", Order=370)] [DataMember] - public Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent SampleSize + public Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent? SampleSize { get { return _SampleSize; } set { _SampleSize = value; OnPropertyChanged("SampleSize"); } } - private Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent _SampleSize; + private Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent? _SampleSize; /// /// What was the estimated risk. /// [FhirElement("riskEstimate", InSummary=true, Order=380)] [DataMember] - public Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent RiskEstimate + public Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent? RiskEstimate { get { return _RiskEstimate; } set { _RiskEstimate = value; OnPropertyChanged("RiskEstimate"); } } - private Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent _RiskEstimate; + private Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent? _RiskEstimate; /// /// How certain is the risk. @@ -1673,55 +1593,51 @@ public Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent RiskEstimate [DataMember] public List Certainty { - get { if(_Certainty==null) _Certainty = new List(); return _Certainty; } + get => _Certainty ?? new List(); set { _Certainty = value; OnPropertyChanged("Certainty"); } } - private List _Certainty; + private List? _Certainty; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RiskEvidenceSynthesis; - - if (dest == null) - { + if(other is not RiskEvidenceSynthesis dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(SynthesisType != null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)SynthesisType.DeepCopyInternal(); - if(StudyType != null) dest.StudyType = (Hl7.Fhir.Model.CodeableConcept)StudyType.DeepCopyInternal(); - if(Population != null) dest.Population = (Hl7.Fhir.Model.ResourceReference)Population.DeepCopyInternal(); - if(Exposure != null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)Exposure.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)Outcome.DeepCopyInternal(); - if(SampleSize != null) dest.SampleSize = (Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent)SampleSize.DeepCopyInternal(); - if(RiskEstimate != null) dest.RiskEstimate = (Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent)RiskEstimate.DeepCopyInternal(); - if(Certainty.Any()) dest.Certainty = new List(Certainty.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_SynthesisType is not null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)_SynthesisType.DeepCopyInternal(); + if(_StudyType is not null) dest.StudyType = (Hl7.Fhir.Model.CodeableConcept)_StudyType.DeepCopyInternal(); + if(_Population is not null) dest.Population = (Hl7.Fhir.Model.ResourceReference)_Population.DeepCopyInternal(); + if(_Exposure is not null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)_Exposure.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)_Outcome.DeepCopyInternal(); + if(_SampleSize is not null) dest.SampleSize = (Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent)_SampleSize.DeepCopyInternal(); + if(_RiskEstimate is not null) dest.RiskEstimate = (Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent)_RiskEstimate.DeepCopyInternal(); + if(_Certainty is not null) dest.Certainty = new List(_Certainty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1733,244 +1649,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RiskEvidenceSynthesis; - if(otherT == null) return false; + if(other is not RiskEvidenceSynthesis otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(SynthesisType, otherT.SynthesisType)) return false; - if(!comparer.Equals(StudyType, otherT.StudyType)) return false; - if(!comparer.Equals(Population, otherT.Population)) return false; - if(!comparer.Equals(Exposure, otherT.Exposure)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(SampleSize, otherT.SampleSize)) return false; - if(!comparer.Equals(RiskEstimate, otherT.RiskEstimate)) return false; - if(!comparer.ListEquals(Certainty, otherT.Certainty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_SynthesisType, otherT._SynthesisType)) return false; + if(!comparer.Equals(_StudyType, otherT._StudyType)) return false; + if(!comparer.Equals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_Exposure, otherT._Exposure)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_SampleSize, otherT._SampleSize)) return false; + if(!comparer.Equals(_RiskEstimate, otherT._RiskEstimate)) return false; + if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "synthesisType": - value = SynthesisType; - return SynthesisType is not null; + value = _SynthesisType; + return _SynthesisType is not null; case "studyType": - value = StudyType; - return StudyType is not null; + value = _StudyType; + return _StudyType is not null; case "population": - value = Population; - return Population is not null; + value = _Population; + return _Population is not null; case "exposure": - value = Exposure; - return Exposure is not null; + value = _Exposure; + return _Exposure is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "sampleSize": - value = SampleSize; - return SampleSize is not null; + value = _SampleSize; + return _SampleSize is not null; case "riskEstimate": - value = RiskEstimate; - return RiskEstimate is not null; + value = _RiskEstimate; + return _RiskEstimate is not null; case "certainty": - value = Certainty; - return Certainty?.Any() == true; + value = _Certainty; + return _Certainty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "synthesisType": - SynthesisType = (Hl7.Fhir.Model.CodeableConcept)value; + SynthesisType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyType": - StudyType = (Hl7.Fhir.Model.CodeableConcept)value; + StudyType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "population": - Population = (Hl7.Fhir.Model.ResourceReference)value; + Population = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposure": - Exposure = (Hl7.Fhir.Model.ResourceReference)value; + Exposure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.ResourceReference)value; + Outcome = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sampleSize": - SampleSize = (Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent)value; + SampleSize = (Hl7.Fhir.Model.RiskEvidenceSynthesis.SampleSizeComponent?)value; return this; case "riskEstimate": - RiskEstimate = (Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent)value; + RiskEstimate = (Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent?)value; return this; case "certainty": - Certainty = (List)value; + Certainty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1981,37 +1897,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (SynthesisType is not null) yield return new KeyValuePair("synthesisType",SynthesisType); - if (StudyType is not null) yield return new KeyValuePair("studyType",StudyType); - if (Population is not null) yield return new KeyValuePair("population",Population); - if (Exposure is not null) yield return new KeyValuePair("exposure",Exposure); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (SampleSize is not null) yield return new KeyValuePair("sampleSize",SampleSize); - if (RiskEstimate is not null) yield return new KeyValuePair("riskEstimate",RiskEstimate); - if (Certainty?.Any() == true) yield return new KeyValuePair("certainty",Certainty); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_SynthesisType is not null) yield return new KeyValuePair("synthesisType",_SynthesisType); + if (_StudyType is not null) yield return new KeyValuePair("studyType",_StudyType); + if (_Population is not null) yield return new KeyValuePair("population",_Population); + if (_Exposure is not null) yield return new KeyValuePair("exposure",_Exposure); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_SampleSize is not null) yield return new KeyValuePair("sampleSize",_SampleSize); + if (_RiskEstimate is not null) yield return new KeyValuePair("riskEstimate",_RiskEstimate); + if (_Certainty?.Any() == true) yield return new KeyValuePair("certainty",_Certainty); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs b/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs index 2a131bf41..bc0514cf9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,13 +69,13 @@ public partial class SampledData : Hl7.Fhir.Model.DataType [FhirElement("origin", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Origin + public Hl7.Fhir.Model.Quantity? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.Quantity _Origin; + private Hl7.Fhir.Model.Quantity? _Origin; /// /// Number of milliseconds between samples. @@ -80,13 +83,13 @@ public Hl7.Fhir.Model.Quantity Origin [FhirElement("period", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodElement + public Hl7.Fhir.Model.FhirDecimal? PeriodElement { get { return _PeriodElement; } set { _PeriodElement = value; OnPropertyChanged("PeriodElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodElement; /// /// Number of milliseconds between samples @@ -95,13 +98,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodElement [IgnoreDataMember] public decimal? Period { - get { return PeriodElement != null ? PeriodElement.Value : null; } + get => _PeriodElement?.Value; set { - if (value == null) - PeriodElement = null; - else - PeriodElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Period"); } } @@ -111,13 +111,13 @@ public decimal? Period /// [FhirElement("factor", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Multiply data by this before adding to origin @@ -126,13 +126,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -142,13 +139,13 @@ public decimal? Factor /// [FhirElement("lowerLimit", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LowerLimitElement + public Hl7.Fhir.Model.FhirDecimal? LowerLimitElement { get { return _LowerLimitElement; } set { _LowerLimitElement = value; OnPropertyChanged("LowerLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LowerLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _LowerLimitElement; /// /// Lower limit of detection @@ -157,13 +154,10 @@ public Hl7.Fhir.Model.FhirDecimal LowerLimitElement [IgnoreDataMember] public decimal? LowerLimit { - get { return LowerLimitElement != null ? LowerLimitElement.Value : null; } + get => _LowerLimitElement?.Value; set { - if (value == null) - LowerLimitElement = null; - else - LowerLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + LowerLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("LowerLimit"); } } @@ -173,13 +167,13 @@ public decimal? LowerLimit /// [FhirElement("upperLimit", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal UpperLimitElement + public Hl7.Fhir.Model.FhirDecimal? UpperLimitElement { get { return _UpperLimitElement; } set { _UpperLimitElement = value; OnPropertyChanged("UpperLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _UpperLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _UpperLimitElement; /// /// Upper limit of detection @@ -188,13 +182,10 @@ public Hl7.Fhir.Model.FhirDecimal UpperLimitElement [IgnoreDataMember] public decimal? UpperLimit { - get { return UpperLimitElement != null ? UpperLimitElement.Value : null; } + get => _UpperLimitElement?.Value; set { - if (value == null) - UpperLimitElement = null; - else - UpperLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + UpperLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("UpperLimit"); } } @@ -205,13 +196,13 @@ public decimal? UpperLimit [FhirElement("dimensions", InSummary=true, Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DimensionsElement + public Hl7.Fhir.Model.PositiveInt? DimensionsElement { get { return _DimensionsElement; } set { _DimensionsElement = value; OnPropertyChanged("DimensionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _DimensionsElement; + private Hl7.Fhir.Model.PositiveInt? _DimensionsElement; /// /// Number of sample points at each time point @@ -220,13 +211,10 @@ public Hl7.Fhir.Model.PositiveInt DimensionsElement [IgnoreDataMember] public int? Dimensions { - get { return DimensionsElement != null ? DimensionsElement.Value : null; } + get => _DimensionsElement?.Value; set { - if (value == null) - DimensionsElement = null; - else - DimensionsElement = new Hl7.Fhir.Model.PositiveInt(value); + DimensionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Dimensions"); } } @@ -236,49 +224,42 @@ public int? Dimensions /// [FhirElement("data", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DataElement + public Hl7.Fhir.Model.FhirString? DataElement { get { return _DataElement; } set { _DataElement = value; OnPropertyChanged("DataElement"); } } - private Hl7.Fhir.Model.FhirString _DataElement; + private Hl7.Fhir.Model.FhirString? _DataElement; /// /// Decimal values with spaces, or "E" | "U" | "L" /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Data + public string? Data { - get { return DataElement != null ? DataElement.Value : null; } + get => _DataElement?.Value; set { - if (value == null) - DataElement = null; - else - DataElement = new Hl7.Fhir.Model.FhirString(value); + DataElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Data"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampledData; - - if (dest == null) - { + if(other is not SampledData dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.Quantity)Origin.DeepCopyInternal(); - if(PeriodElement != null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)PeriodElement.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(LowerLimitElement != null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)LowerLimitElement.DeepCopyInternal(); - if(UpperLimitElement != null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)UpperLimitElement.DeepCopyInternal(); - if(DimensionsElement != null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)DimensionsElement.DeepCopyInternal(); - if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.FhirString)DataElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.Quantity)_Origin.DeepCopyInternal(); + if(_PeriodElement is not null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodElement.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_LowerLimitElement is not null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)_LowerLimitElement.DeepCopyInternal(); + if(_UpperLimitElement is not null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)_UpperLimitElement.DeepCopyInternal(); + if(_DimensionsElement is not null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)_DimensionsElement.DeepCopyInternal(); + if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.FhirString)_DataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -290,76 +271,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampledData; - if(otherT == null) return false; + if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(PeriodElement, otherT.PeriodElement)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(LowerLimitElement, otherT.LowerLimitElement)) return false; - if(!comparer.Equals(UpperLimitElement, otherT.UpperLimitElement)) return false; - if(!comparer.Equals(DimensionsElement, otherT.DimensionsElement)) return false; - if(!comparer.Equals(DataElement, otherT.DataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_LowerLimitElement, otherT._LowerLimitElement)) return false; + if(!comparer.Equals(_UpperLimitElement, otherT._UpperLimitElement)) return false; + if(!comparer.Equals(_DimensionsElement, otherT._DimensionsElement)) return false; + if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "period": - value = PeriodElement; - return PeriodElement is not null; + value = _PeriodElement; + return _PeriodElement is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "lowerLimit": - value = LowerLimitElement; - return LowerLimitElement is not null; + value = _LowerLimitElement; + return _LowerLimitElement is not null; case "upperLimit": - value = UpperLimitElement; - return UpperLimitElement is not null; + value = _UpperLimitElement; + return _UpperLimitElement is not null; case "dimensions": - value = DimensionsElement; - return DimensionsElement is not null; + value = _DimensionsElement; + return _DimensionsElement is not null; case "data": - value = DataElement; - return DataElement is not null; + value = _DataElement; + return _DataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "origin": - Origin = (Hl7.Fhir.Model.Quantity)value; + Origin = (Hl7.Fhir.Model.Quantity?)value; return this; case "period": - PeriodElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "lowerLimit": - LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "upperLimit": - UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "dimensions": - DimensionsElement = (Hl7.Fhir.Model.PositiveInt)value; + DimensionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "data": - DataElement = (Hl7.Fhir.Model.FhirString)value; + DataElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -370,13 +351,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (PeriodElement is not null) yield return new KeyValuePair("period",PeriodElement); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",LowerLimitElement); - if (UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",UpperLimitElement); - if (DimensionsElement is not null) yield return new KeyValuePair("dimensions",DimensionsElement); - if (DataElement is not null) yield return new KeyValuePair("data",DataElement); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_PeriodElement is not null) yield return new KeyValuePair("period",_PeriodElement); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",_LowerLimitElement); + if (_UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",_UpperLimitElement); + if (_DimensionsElement is not null) yield return new KeyValuePair("dimensions",_DimensionsElement); + if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs index bd623df7d..e28394979 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,24 +67,24 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this schedule is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this schedule is in active use @@ -90,13 +93,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -110,11 +110,11 @@ public bool? Active [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// Specific service. @@ -125,11 +125,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// Type of specialty needed. @@ -140,11 +140,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Resource(s) that availability information is being provided for. @@ -156,52 +156,49 @@ public List Specialty [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Period of time covered by schedule. /// [FhirElement("planningHorizon", InSummary=true, Order=150, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period PlanningHorizon + public Hl7.Fhir.Model.Period? PlanningHorizon { get { return _PlanningHorizon; } set { _PlanningHorizon = value; OnPropertyChanged("PlanningHorizon"); } } - private Hl7.Fhir.Model.Period _PlanningHorizon; + private Hl7.Fhir.Model.Period? _PlanningHorizon; /// /// Comments on availability. /// [FhirElement("comment", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on availability /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -210,22 +207,18 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Schedule; - - if (dest == null) - { + if(other is not Schedule dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(PlanningHorizon != null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)PlanningHorizon.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_PlanningHorizon is not null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)_PlanningHorizon.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -237,83 +230,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Schedule; - if(otherT == null) return false; + if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(PlanningHorizon, otherT.PlanningHorizon)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "planningHorizon": - value = PlanningHorizon; - return PlanningHorizon is not null; + value = _PlanningHorizon; + return _PlanningHorizon is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "planningHorizon": - PlanningHorizon = (Hl7.Fhir.Model.Period)value; + PlanningHorizon = (Hl7.Fhir.Model.Period?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -324,14 +317,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",PlanningHorizon); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",_PlanningHorizon); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs index e2bbbb0fc..88a5b3994 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -268,28 +271,25 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("definition", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Defines how the part works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } @@ -300,44 +300,37 @@ public string Definition [FhirElement("expression", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Subexpression relative to main expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,41 +342,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -394,8 +387,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -406,28 +399,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this search parameter, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -437,28 +427,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -469,28 +456,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this search parameter (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -500,28 +484,25 @@ public string Name /// [FhirElement("derivedFrom", Order=120)] [DataMember] - public Hl7.Fhir.Model.Canonical DerivedFromElement + public Hl7.Fhir.Model.Canonical? DerivedFromElement { get { return _DerivedFromElement; } set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private Hl7.Fhir.Model.Canonical _DerivedFromElement; + private Hl7.Fhir.Model.Canonical? _DerivedFromElement; /// /// Original definition for the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DerivedFrom + public string? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Value : null; } + get => _DerivedFromElement?.Value; set { - if (value == null) - DerivedFromElement = null; - else - DerivedFromElement = new Hl7.Fhir.Model.Canonical(value); + DerivedFromElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("DerivedFrom"); } } @@ -534,13 +515,13 @@ public string DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -549,13 +530,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -565,13 +543,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -580,13 +558,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -596,28 +571,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -627,28 +599,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -661,11 +630,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the search parameter. @@ -673,28 +642,25 @@ public List Contact [FhirElement("description", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -707,11 +673,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for search parameter (if applicable). @@ -722,39 +688,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this search parameter is defined. /// [FhirElement("purpose", Order=210, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this search parameter is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -765,28 +728,25 @@ public string Purpose [FhirElement("code", InSummary=true, Order=220)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code used in URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -801,24 +761,24 @@ public string Code [DataMember] public List> BaseElement { - get { if(_BaseElement==null) _BaseElement = new List>(); return _BaseElement; } + get => _BaseElement ?? new List>(); set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private List> _BaseElement; + private List>? _BaseElement; /// /// The resource type(s) this search parameter applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Base + public IEnumerable? Base { - get { return BaseElement != null ? BaseElement.Select(elem => elem.Value) : null; } + get => _BaseElement?.Select(elem => elem.Value); set { if (value == null) - BaseElement = null; + BaseElement = null!; else BaseElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Base"); @@ -833,13 +793,13 @@ public IEnumerable Base [Binding("SearchParamType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// number | date | string | token | reference | composite | quantity | uri | special @@ -848,13 +808,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -864,28 +821,25 @@ public Hl7.Fhir.Model.SearchParamType? Type /// [FhirElement("expression", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// FHIRPath expression that extracts the values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -895,28 +849,25 @@ public string Expression /// [FhirElement("xpath", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString XpathElement + public Hl7.Fhir.Model.FhirString? XpathElement { get { return _XpathElement; } set { _XpathElement = value; OnPropertyChanged("XpathElement"); } } - private Hl7.Fhir.Model.FhirString _XpathElement; + private Hl7.Fhir.Model.FhirString? _XpathElement; /// /// XPath that extracts the values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Xpath + public string? Xpath { - get { return XpathElement != null ? XpathElement.Value : null; } + get => _XpathElement?.Value; set { - if (value == null) - XpathElement = null; - else - XpathElement = new Hl7.Fhir.Model.FhirString(value); + XpathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Xpath"); } } @@ -928,13 +879,13 @@ public string Xpath [DeclaredType(Type = typeof(Code))] [Binding("XPathUsageType")] [DataMember] - public Code XpathUsageElement + public Code? XpathUsageElement { get { return _XpathUsageElement; } set { _XpathUsageElement = value; OnPropertyChanged("XpathUsageElement"); } } - private Code _XpathUsageElement; + private Code? _XpathUsageElement; /// /// normal | phonetic | nearby | distance | other @@ -943,13 +894,10 @@ public Code XpathUsageElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage { - get { return XpathUsageElement != null ? XpathUsageElement.Value : null; } + get => _XpathUsageElement?.Value; set { - if (value == null) - XpathUsageElement = null; - else - XpathUsageElement = new Code(value); + XpathUsageElement = value is null ? null : new Code(value); OnPropertyChanged("XpathUsage"); } } @@ -964,24 +912,24 @@ public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage [DataMember] public List> TargetElement { - get { if(_TargetElement==null) _TargetElement = new List>(); return _TargetElement; } + get => _TargetElement ?? new List>(); set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private List> _TargetElement; + private List>? _TargetElement; /// /// Types of resource (if a resource reference) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Target + public IEnumerable? Target { - get { return TargetElement != null ? TargetElement.Select(elem => elem.Value) : null; } + get => _TargetElement?.Select(elem => elem.Value); set { if (value == null) - TargetElement = null; + TargetElement = null!; else TargetElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Target"); @@ -993,13 +941,13 @@ public IEnumerable Target /// [FhirElement("multipleOr", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleOrElement + public Hl7.Fhir.Model.FhirBoolean? MultipleOrElement { get { return _MultipleOrElement; } set { _MultipleOrElement = value; OnPropertyChanged("MultipleOrElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleOrElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleOrElement; /// /// Allow multiple values per parameter (or) @@ -1008,13 +956,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleOrElement [IgnoreDataMember] public bool? MultipleOr { - get { return MultipleOrElement != null ? MultipleOrElement.Value : null; } + get => _MultipleOrElement?.Value; set { - if (value == null) - MultipleOrElement = null; - else - MultipleOrElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleOrElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleOr"); } } @@ -1024,13 +969,13 @@ public bool? MultipleOr /// [FhirElement("multipleAnd", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleAndElement + public Hl7.Fhir.Model.FhirBoolean? MultipleAndElement { get { return _MultipleAndElement; } set { _MultipleAndElement = value; OnPropertyChanged("MultipleAndElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleAndElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleAndElement; /// /// Allow multiple parameters (and) @@ -1039,13 +984,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleAndElement [IgnoreDataMember] public bool? MultipleAnd { - get { return MultipleAndElement != null ? MultipleAndElement.Value : null; } + get => _MultipleAndElement?.Value; set { - if (value == null) - MultipleAndElement = null; - else - MultipleAndElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleAndElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleAnd"); } } @@ -1060,24 +1002,24 @@ public bool? MultipleAnd [DataMember] public List> ComparatorElement { - get { if(_ComparatorElement==null) _ComparatorElement = new List>(); return _ComparatorElement; } + get => _ComparatorElement ?? new List>(); set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private List> _ComparatorElement; + private List>? _ComparatorElement; /// /// eq | ne | gt | lt | ge | le | sa | eb | ap /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comparator + public IEnumerable? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Select(elem => elem.Value) : null; } + get => _ComparatorElement?.Select(elem => elem.Value); set { if (value == null) - ComparatorElement = null; + ComparatorElement = null!; else ComparatorElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Comparator"); @@ -1094,24 +1036,24 @@ public IEnumerable Comparator [DataMember] public List> ModifierElement { - get { if(_ModifierElement==null) _ModifierElement = new List>(); return _ModifierElement; } + get => _ModifierElement ?? new List>(); set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } - private List> _ModifierElement; + private List>? _ModifierElement; /// /// missing | exact | contains | not | text | in | not-in | below | above | type | identifier | ofType /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Modifier + public IEnumerable? Modifier { - get { return ModifierElement != null ? ModifierElement.Select(elem => elem.Value) : null; } + get => _ModifierElement?.Select(elem => elem.Value); set { if (value == null) - ModifierElement = null; + ModifierElement = null!; else ModifierElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Modifier"); @@ -1126,24 +1068,24 @@ public IEnumerable Modifier [DataMember] public List ChainElement { - get { if(_ChainElement==null) _ChainElement = new List(); return _ChainElement; } + get => _ChainElement ?? new List(); set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } - private List _ChainElement; + private List? _ChainElement; /// /// Chained names supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Chain + public IEnumerable? Chain { - get { return ChainElement != null ? ChainElement.Select(elem => elem.Value) : null; } + get => _ChainElement?.Select(elem => elem.Value); set { if (value == null) - ChainElement = null; + ChainElement = null!; else ChainElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Chain"); @@ -1158,51 +1100,47 @@ public IEnumerable Chain [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; List> ICoded>>.Code { get => TargetElement; set => TargetElement = value; } - IEnumerable ICoded.ToCodings() => TargetElement.ToCodings(); + IEnumerable ICoded.ToCodings() => TargetElement?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as SearchParameter; - - if (dest == null) - { + if(other is not SearchParameter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DerivedFromElement != null) dest.DerivedFromElement = (Hl7.Fhir.Model.Canonical)DerivedFromElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(BaseElement.Any()) dest.BaseElement = new List>(BaseElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(XpathElement != null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)XpathElement.DeepCopyInternal(); - if(XpathUsageElement != null) dest.XpathUsageElement = (Code)XpathUsageElement.DeepCopyInternal(); - if(TargetElement.Any()) dest.TargetElement = new List>(TargetElement.DeepCopyInternal()); - if(MultipleOrElement != null) dest.MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)MultipleOrElement.DeepCopyInternal(); - if(MultipleAndElement != null) dest.MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)MultipleAndElement.DeepCopyInternal(); - if(ComparatorElement.Any()) dest.ComparatorElement = new List>(ComparatorElement.DeepCopyInternal()); - if(ModifierElement.Any()) dest.ModifierElement = new List>(ModifierElement.DeepCopyInternal()); - if(ChainElement.Any()) dest.ChainElement = new List(ChainElement.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = (Hl7.Fhir.Model.Canonical)_DerivedFromElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = new List>(_BaseElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_XpathElement is not null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)_XpathElement.DeepCopyInternal(); + if(_XpathUsageElement is not null) dest.XpathUsageElement = (Code)_XpathUsageElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = new List>(_TargetElement.DeepCopyInternal()); + if(_MultipleOrElement is not null) dest.MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleOrElement.DeepCopyInternal(); + if(_MultipleAndElement is not null) dest.MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleAndElement.DeepCopyInternal(); + if(_ComparatorElement is not null) dest.ComparatorElement = new List>(_ComparatorElement.DeepCopyInternal()); + if(_ModifierElement is not null) dest.ModifierElement = new List>(_ModifierElement.DeepCopyInternal()); + if(_ChainElement is not null) dest.ChainElement = new List(_ChainElement.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1214,209 +1152,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SearchParameter; - if(otherT == null) return false; + if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(XpathElement, otherT.XpathElement)) return false; - if(!comparer.Equals(XpathUsageElement, otherT.XpathUsageElement)) return false; - if(!comparer.ListEquals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.Equals(MultipleOrElement, otherT.MultipleOrElement)) return false; - if(!comparer.Equals(MultipleAndElement, otherT.MultipleAndElement)) return false; - if(!comparer.ListEquals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.ListEquals(ModifierElement, otherT.ModifierElement)) return false; - if(!comparer.ListEquals(ChainElement, otherT.ChainElement)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; + if(!comparer.Equals(_XpathUsageElement, otherT._XpathUsageElement)) return false; + if(!comparer.ListEquals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.Equals(_MultipleOrElement, otherT._MultipleOrElement)) return false; + if(!comparer.Equals(_MultipleAndElement, otherT._MultipleAndElement)) return false; + if(!comparer.ListEquals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; + if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement is not null; + value = _DerivedFromElement; + return _DerivedFromElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "base": - value = BaseElement; - return BaseElement?.Any() == true; + value = _BaseElement; + return _BaseElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "xpath": - value = XpathElement; - return XpathElement is not null; + value = _XpathElement; + return _XpathElement is not null; case "xpathUsage": - value = XpathUsageElement; - return XpathUsageElement is not null; + value = _XpathUsageElement; + return _XpathUsageElement is not null; case "target": - value = TargetElement; - return TargetElement?.Any() == true; + value = _TargetElement; + return _TargetElement?.Any() == true; case "multipleOr": - value = MultipleOrElement; - return MultipleOrElement is not null; + value = _MultipleOrElement; + return _MultipleOrElement is not null; case "multipleAnd": - value = MultipleAndElement; - return MultipleAndElement is not null; + value = _MultipleAndElement; + return _MultipleAndElement is not null; case "comparator": - value = ComparatorElement; - return ComparatorElement?.Any() == true; + value = _ComparatorElement; + return _ComparatorElement?.Any() == true; case "modifier": - value = ModifierElement; - return ModifierElement?.Any() == true; + value = _ModifierElement; + return _ModifierElement?.Any() == true; case "chain": - value = ChainElement; - return ChainElement?.Any() == true; + value = _ChainElement; + return _ChainElement?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (Hl7.Fhir.Model.Canonical)value; + DerivedFromElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "base": - BaseElement = (List>)value; + BaseElement = (List>?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpath": - XpathElement = (Hl7.Fhir.Model.FhirString)value; + XpathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpathUsage": - XpathUsageElement = (Code)value; + XpathUsageElement = (Code?)value; return this; case "target": - TargetElement = (List>)value; + TargetElement = (List>?)value!; return this; case "multipleOr": - MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "multipleAnd": - MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comparator": - ComparatorElement = (List>)value; + ComparatorElement = (List>?)value!; return this; case "modifier": - ModifierElement = (List>)value; + ModifierElement = (List>?)value!; return this; case "chain": - ChainElement = (List)value; + ChainElement = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1427,32 +1365,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (BaseElement?.Any() == true) yield return new KeyValuePair("base",BaseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (XpathElement is not null) yield return new KeyValuePair("xpath",XpathElement); - if (XpathUsageElement is not null) yield return new KeyValuePair("xpathUsage",XpathUsageElement); - if (TargetElement?.Any() == true) yield return new KeyValuePair("target",TargetElement); - if (MultipleOrElement is not null) yield return new KeyValuePair("multipleOr",MultipleOrElement); - if (MultipleAndElement is not null) yield return new KeyValuePair("multipleAnd",MultipleAndElement); - if (ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",ComparatorElement); - if (ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",ModifierElement); - if (ChainElement?.Any() == true) yield return new KeyValuePair("chain",ChainElement); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_BaseElement?.Any() == true) yield return new KeyValuePair("base",_BaseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_XpathElement is not null) yield return new KeyValuePair("xpath",_XpathElement); + if (_XpathUsageElement is not null) yield return new KeyValuePair("xpathUsage",_XpathUsageElement); + if (_TargetElement?.Any() == true) yield return new KeyValuePair("target",_TargetElement); + if (_MultipleOrElement is not null) yield return new KeyValuePair("multipleOr",_MultipleOrElement); + if (_MultipleAndElement is not null) yield return new KeyValuePair("multipleAnd",_MultipleAndElement); + if (_ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",_ModifierElement); + if (_ChainElement?.Any() == true) yield return new KeyValuePair("chain",_ChainElement); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs index 60e198094..d15d1ab10 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ServiceRequest","http://hl7.org/fhir/StructureDefinition/ServiceRequest")] - public partial class ServiceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class ServiceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -67,11 +70,11 @@ public partial class ServiceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiab [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -81,24 +84,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -113,24 +116,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -147,11 +150,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -163,24 +166,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite Request ID. /// [FhirElement("requisition", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier Requisition + public Hl7.Fhir.Model.Identifier? Requisition { get { return _Requisition; } set { _Requisition = value; OnPropertyChanged("Requisition"); } } - private Hl7.Fhir.Model.Identifier _Requisition; + private Hl7.Fhir.Model.Identifier? _Requisition; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -190,13 +193,13 @@ public Hl7.Fhir.Model.Identifier Requisition [Binding("ServiceRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -205,13 +208,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -224,13 +224,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("ServiceRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -239,13 +239,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -259,11 +256,11 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -272,13 +269,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("ServiceRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -287,13 +284,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -303,13 +297,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if service/procedure should not be performed @@ -318,13 +312,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -335,13 +326,13 @@ public bool? DoNotPerform [FhirElement("code", InSummary=true, Order=200, FiveWs="FiveWs.what[x]")] [Binding("ServiceRequestCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Additional order information. @@ -352,11 +343,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List OrderDetail { - get { if(_OrderDetail==null) _OrderDetail = new List(); return _OrderDetail; } + get => _OrderDetail ?? new List(); set { _OrderDetail = value; OnPropertyChanged("OrderDetail"); } } - private List _OrderDetail; + private List? _OrderDetail; /// /// Service amount. @@ -365,13 +356,13 @@ public List OrderDetail [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Quantity + public Hl7.Fhir.Model.DataType? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.DataType _Quantity; + private Hl7.Fhir.Model.DataType? _Quantity; /// /// Individual or Entity the service is ordered for. @@ -381,13 +372,13 @@ public Hl7.Fhir.Model.DataType Quantity [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter in which the request was created. @@ -396,13 +387,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When service should occur. @@ -411,13 +402,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Preconditions for service. @@ -427,41 +418,38 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Date request signed. /// [FhirElement("authoredOn", InSummary=true, Order=270, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Date request signed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -473,13 +461,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Performer role. @@ -487,13 +475,13 @@ public Hl7.Fhir.Model.ResourceReference Requester [FhirElement("performerType", InSummary=true, Order=290, FiveWs="FiveWs.actor")] [Binding("ServiceRequestParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Requested performer. @@ -505,11 +493,11 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Requested location. @@ -520,11 +508,11 @@ public List Performer [DataMember] public List LocationCode { - get { if(_LocationCode==null) _LocationCode = new List(); return _LocationCode; } + get => _LocationCode ?? new List(); set { _LocationCode = value; OnPropertyChanged("LocationCode"); } } - private List _LocationCode; + private List? _LocationCode; /// /// Requested location. @@ -536,11 +524,11 @@ public List LocationCode [DataMember] public List LocationReference { - get { if(_LocationReference==null) _LocationReference = new List(); return _LocationReference; } + get => _LocationReference ?? new List(); set { _LocationReference = value; OnPropertyChanged("LocationReference"); } } - private List _LocationReference; + private List? _LocationReference; /// /// Explanation/Justification for procedure or service. @@ -551,11 +539,11 @@ public List LocationReference [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Explanation/Justification for service or service. @@ -567,11 +555,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Associated insurance coverage. @@ -583,11 +571,11 @@ public List ReasonReference [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Additional clinical information. @@ -599,11 +587,11 @@ public List Insurance [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Procedure Samples. @@ -615,11 +603,11 @@ public List SupportingInfo [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Location on Body. @@ -630,11 +618,11 @@ public List Specimen [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Comments. @@ -644,39 +632,36 @@ public List BodySite [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Patient or consumer-oriented instructions. /// [FhirElement("patientInstruction", InSummary=true, Order=400)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Patient or consumer-oriented instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -691,60 +676,56 @@ public string PatientInstruction [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as ServiceRequest; - - if (dest == null) - { + if(other is not ServiceRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(Requisition != null) dest.Requisition = (Hl7.Fhir.Model.Identifier)Requisition.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(OrderDetail.Any()) dest.OrderDetail = new List(OrderDetail.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.DataType)Quantity.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(LocationCode.Any()) dest.LocationCode = new List(LocationCode.DeepCopyInternal()); - if(LocationReference.Any()) dest.LocationReference = new List(LocationReference.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_Requisition is not null) dest.Requisition = (Hl7.Fhir.Model.Identifier)_Requisition.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_OrderDetail is not null) dest.OrderDetail = new List(_OrderDetail.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.DataType)_Quantity.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_LocationCode is not null) dest.LocationCode = new List(_LocationCode.DeepCopyInternal()); + if(_LocationReference is not null) dest.LocationReference = new List(_LocationReference.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -756,258 +737,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ServiceRequest; - if(otherT == null) return false; + if(other is not ServiceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(Requisition, otherT.Requisition)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(OrderDetail, otherT.OrderDetail)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(LocationCode, otherT.LocationCode)) return false; - if(!comparer.ListEquals(LocationReference, otherT.LocationReference)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_Requisition, otherT._Requisition)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_OrderDetail, otherT._OrderDetail)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_LocationCode, otherT._LocationCode)) return false; + if(!comparer.ListEquals(_LocationReference, otherT._LocationReference)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "requisition": - value = Requisition; - return Requisition is not null; + value = _Requisition; + return _Requisition is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "orderDetail": - value = OrderDetail; - return OrderDetail?.Any() == true; + value = _OrderDetail; + return _OrderDetail?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "locationCode": - value = LocationCode; - return LocationCode?.Any() == true; + value = _LocationCode; + return _LocationCode?.Any() == true; case "locationReference": - value = LocationReference; - return LocationReference?.Any() == true; + value = _LocationReference; + return _LocationReference?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "requisition": - Requisition = (Hl7.Fhir.Model.Identifier)value; + Requisition = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "orderDetail": - OrderDetail = (List)value; + OrderDetail = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.DataType)value; + Quantity = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "locationCode": - LocationCode = (List)value; + LocationCode = (List?)value!; return this; case "locationReference": - LocationReference = (List)value; + LocationReference = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1018,39 +999,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (Requisition is not null) yield return new KeyValuePair("requisition",Requisition); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (OrderDetail?.Any() == true) yield return new KeyValuePair("orderDetail",OrderDetail); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (LocationCode?.Any() == true) yield return new KeyValuePair("locationCode",LocationCode); - if (LocationReference?.Any() == true) yield return new KeyValuePair("locationReference",LocationReference); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_Requisition is not null) yield return new KeyValuePair("requisition",_Requisition); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_OrderDetail?.Any() == true) yield return new KeyValuePair("orderDetail",_OrderDetail); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_LocationCode?.Any() == true) yield return new KeyValuePair("locationCode",_LocationCode); + if (_LocationReference?.Any() == true) yield return new KeyValuePair("locationReference",_LocationReference); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Slot.cs b/src/Hl7.Fhir.R4/Model/Generated/Slot.cs index afeb89297..4dc435a0a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Slot.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,11 +107,11 @@ public enum SlotStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A broad categorization of the service that is to be performed during this appointment. @@ -119,11 +122,11 @@ public List Identifier [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource. @@ -134,11 +137,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -149,11 +152,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that may be booked in the slot (not service type). @@ -161,13 +164,13 @@ public List Specialty [FhirElement("appointmentType", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("appointment-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AppointmentType + public Hl7.Fhir.Model.CodeableConcept? AppointmentType { get { return _AppointmentType; } set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private Hl7.Fhir.Model.CodeableConcept _AppointmentType; + private Hl7.Fhir.Model.CodeableConcept? _AppointmentType; /// /// The schedule resource that this slot defines an interval of status information. @@ -177,13 +180,13 @@ public Hl7.Fhir.Model.CodeableConcept AppointmentType [References("Schedule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Schedule + public Hl7.Fhir.Model.ResourceReference? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.ResourceReference _Schedule; + private Hl7.Fhir.Model.ResourceReference? _Schedule; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error. @@ -193,13 +196,13 @@ public Hl7.Fhir.Model.ResourceReference Schedule [Binding("SlotStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error @@ -208,13 +211,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Slot.SlotStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -225,13 +225,13 @@ public Hl7.Fhir.Model.Slot.SlotStatus? Status [FhirElement("start", InSummary=true, Order=160, FiveWs="FiveWs.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Date/Time that the slot is to begin @@ -240,13 +240,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -257,13 +254,13 @@ public DateTimeOffset? Start [FhirElement("end", InSummary=true, Order=170, FiveWs="FiveWs.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Date/Time that the slot is to conclude @@ -272,13 +269,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -288,13 +282,13 @@ public DateTimeOffset? End /// [FhirElement("overbooked", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OverbookedElement + public Hl7.Fhir.Model.FhirBoolean? OverbookedElement { get { return _OverbookedElement; } set { _OverbookedElement = value; OnPropertyChanged("OverbookedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OverbookedElement; + private Hl7.Fhir.Model.FhirBoolean? _OverbookedElement; /// /// This slot has already been overbooked, appointments are unlikely to be accepted for this time @@ -303,13 +297,10 @@ public Hl7.Fhir.Model.FhirBoolean OverbookedElement [IgnoreDataMember] public bool? Overbooked { - get { return OverbookedElement != null ? OverbookedElement.Value : null; } + get => _OverbookedElement?.Value; set { - if (value == null) - OverbookedElement = null; - else - OverbookedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OverbookedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Overbooked"); } } @@ -319,28 +310,25 @@ public bool? Overbooked /// [FhirElement("comment", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on the slot to describe any extended information. Such as custom constraints on the slot /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -349,25 +337,21 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Slot; - - if (dest == null) - { + if(other is not Slot dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType != null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)AppointmentType.DeepCopyInternal(); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)Schedule.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(OverbookedElement != null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)OverbookedElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)_AppointmentType.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)_Schedule.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_OverbookedElement is not null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)_OverbookedElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -379,104 +363,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Slot; - if(otherT == null) return false; + if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(OverbookedElement, otherT.OverbookedElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType is not null; + value = _AppointmentType; + return _AppointmentType is not null; case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "overbooked": - value = OverbookedElement; - return OverbookedElement is not null; + value = _OverbookedElement; + return _OverbookedElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (Hl7.Fhir.Model.CodeableConcept)value; + AppointmentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "schedule": - Schedule = (Hl7.Fhir.Model.ResourceReference)value; + Schedule = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "overbooked": - OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OverbookedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -487,17 +471,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType is not null) yield return new KeyValuePair("appointmentType",AppointmentType); - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (OverbookedElement is not null) yield return new KeyValuePair("overbooked",OverbookedElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType is not null) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_OverbookedElement is not null) yield return new KeyValuePair("overbooked",_OverbookedElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs index b4132223f..3c25a8243 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Specimen","http://hl7.org/fhir/StructureDefinition/Specimen")] - public partial class Specimen : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Specimen : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -116,13 +119,13 @@ public partial class CollectionComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Collector + public Hl7.Fhir.Model.ResourceReference? Collector { get { return _Collector; } set { _Collector = value; OnPropertyChanged("Collector"); } } - private Hl7.Fhir.Model.ResourceReference _Collector; + private Hl7.Fhir.Model.ResourceReference? _Collector; /// /// Collection time. @@ -131,39 +134,39 @@ public Hl7.Fhir.Model.ResourceReference Collector [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Collected + public Hl7.Fhir.Model.DataType? Collected { get { return _Collected; } set { _Collected = value; OnPropertyChanged("Collected"); } } - private Hl7.Fhir.Model.DataType _Collected; + private Hl7.Fhir.Model.DataType? _Collected; /// /// How long it took to collect specimen. /// [FhirElement("duration", InSummary=true, Order=60, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Duration Duration + public Hl7.Fhir.Model.Duration? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Duration _Duration; + private Hl7.Fhir.Model.Duration? _Duration; /// /// The quantity of specimen collected. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Technique used to perform collection. @@ -171,13 +174,13 @@ public Hl7.Fhir.Model.Quantity Quantity [FhirElement("method", Order=80)] [Binding("SpecimenCollectionMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Anatomical collection site. @@ -185,13 +188,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [FhirElement("bodySite", Order=90)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Whether or how long patient abstained from food and/or drink. @@ -201,31 +204,27 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType FastingStatus + public Hl7.Fhir.Model.DataType? FastingStatus { get { return _FastingStatus; } set { _FastingStatus = value; OnPropertyChanged("FastingStatus"); } } - private Hl7.Fhir.Model.DataType _FastingStatus; + private Hl7.Fhir.Model.DataType? _FastingStatus; protected internal override void CopyToInternal(Base other) { - var dest = other as CollectionComponent; - - if (dest == null) - { + if(other is not CollectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Collector != null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)Collector.DeepCopyInternal(); - if(Collected != null) dest.Collected = (Hl7.Fhir.Model.DataType)Collected.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(FastingStatus != null) dest.FastingStatus = (Hl7.Fhir.Model.DataType)FastingStatus.DeepCopyInternal(); + if(_Collector is not null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)_Collector.DeepCopyInternal(); + if(_Collected is not null) dest.Collected = (Hl7.Fhir.Model.DataType)_Collected.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Duration)_Duration.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_FastingStatus is not null) dest.FastingStatus = (Hl7.Fhir.Model.DataType)_FastingStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -237,76 +236,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CollectionComponent; - if(otherT == null) return false; + if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Collector, otherT.Collector)) return false; - if(!comparer.Equals(Collected, otherT.Collected)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(FastingStatus, otherT.FastingStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + if(!comparer.Equals(_Collected, otherT._Collected)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_FastingStatus, otherT._FastingStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "collector": - value = Collector; - return Collector is not null; + value = _Collector; + return _Collector is not null; case "collected": - value = Collected; - return Collected is not null; + value = _Collected; + return _Collected is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "fastingStatus": - value = FastingStatus; - return FastingStatus is not null; + value = _FastingStatus; + return _FastingStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "collector": - Collector = (Hl7.Fhir.Model.ResourceReference)value; + Collector = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "collected": - Collected = (Hl7.Fhir.Model.DataType)value; + Collected = (Hl7.Fhir.Model.DataType?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Duration)value; + Duration = (Hl7.Fhir.Model.Duration?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fastingStatus": - FastingStatus = (Hl7.Fhir.Model.DataType)value; + FastingStatus = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -317,13 +316,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Collector is not null) yield return new KeyValuePair("collector",Collector); - if (Collected is not null) yield return new KeyValuePair("collected",Collected); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (FastingStatus is not null) yield return new KeyValuePair("fastingStatus",FastingStatus); + if (_Collector is not null) yield return new KeyValuePair("collector",_Collector); + if (_Collected is not null) yield return new KeyValuePair("collected",_Collected); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_FastingStatus is not null) yield return new KeyValuePair("fastingStatus",_FastingStatus); } } @@ -349,28 +348,25 @@ public partial class ProcessingComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of procedure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -381,13 +377,13 @@ public string Description [FhirElement("procedure", Order=50)] [Binding("SpecimenProcessingProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Procedure + public Hl7.Fhir.Model.CodeableConcept? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.CodeableConcept _Procedure; + private Hl7.Fhir.Model.CodeableConcept? _Procedure; /// /// Material used in the processing step. @@ -399,11 +395,11 @@ public Hl7.Fhir.Model.CodeableConcept Procedure [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Date and time of specimen processing. @@ -412,28 +408,24 @@ public List Additive [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessingComponent; - - if (dest == null) - { + if(other is not ProcessingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)Procedure.DeepCopyInternal(); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)_Procedure.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -445,55 +437,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessingComponent; - if(otherT == null) return false; + if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.CodeableConcept)value; + Procedure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -504,10 +496,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -536,39 +528,36 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Textual description of the container. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the container /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -579,39 +568,39 @@ public string Description [FhirElement("type", Order=60)] [Binding("SpecimenContainerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Container volume or size. /// [FhirElement("capacity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Capacity + public Hl7.Fhir.Model.Quantity? Capacity { get { return _Capacity; } set { _Capacity = value; OnPropertyChanged("Capacity"); } } - private Hl7.Fhir.Model.Quantity _Capacity; + private Hl7.Fhir.Model.Quantity? _Capacity; /// /// Quantity of specimen within container. /// [FhirElement("specimenQuantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity SpecimenQuantity + public Hl7.Fhir.Model.Quantity? SpecimenQuantity { get { return _SpecimenQuantity; } set { _SpecimenQuantity = value; OnPropertyChanged("SpecimenQuantity"); } } - private Hl7.Fhir.Model.Quantity _SpecimenQuantity; + private Hl7.Fhir.Model.Quantity? _SpecimenQuantity; /// /// Additive associated with container. @@ -622,30 +611,26 @@ public Hl7.Fhir.Model.Quantity SpecimenQuantity [References("Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Additive + public Hl7.Fhir.Model.DataType? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.DataType _Additive; + private Hl7.Fhir.Model.DataType? _Additive; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainerComponent; - - if (dest == null) - { + if(other is not ContainerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Capacity != null) dest.Capacity = (Hl7.Fhir.Model.Quantity)Capacity.DeepCopyInternal(); - if(SpecimenQuantity != null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)SpecimenQuantity.DeepCopyInternal(); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.DataType)Additive.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Capacity is not null) dest.Capacity = (Hl7.Fhir.Model.Quantity)_Capacity.DeepCopyInternal(); + if(_SpecimenQuantity is not null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)_SpecimenQuantity.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.DataType)_Additive.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -657,69 +642,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainerComponent; - if(otherT == null) return false; + if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Capacity, otherT.Capacity)) return false; - if(!comparer.Equals(SpecimenQuantity, otherT.SpecimenQuantity)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; + if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; + if(!comparer.Equals(_Additive, otherT._Additive)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "capacity": - value = Capacity; - return Capacity is not null; + value = _Capacity; + return _Capacity is not null; case "specimenQuantity": - value = SpecimenQuantity; - return SpecimenQuantity is not null; + value = _SpecimenQuantity; + return _SpecimenQuantity is not null; case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "capacity": - Capacity = (Hl7.Fhir.Model.Quantity)value; + Capacity = (Hl7.Fhir.Model.Quantity?)value; return this; case "specimenQuantity": - SpecimenQuantity = (Hl7.Fhir.Model.Quantity)value; + SpecimenQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "additive": - Additive = (Hl7.Fhir.Model.DataType)value; + Additive = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -730,12 +715,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Capacity is not null) yield return new KeyValuePair("capacity",Capacity); - if (SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",SpecimenQuantity); - if (Additive is not null) yield return new KeyValuePair("additive",Additive); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Capacity is not null) yield return new KeyValuePair("capacity",_Capacity); + if (_SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",_SpecimenQuantity); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); } } @@ -748,24 +733,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identifier assigned by the lab. /// [FhirElement("accessionIdentifier", InSummary=true, Order=100, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier AccessionIdentifier + public Hl7.Fhir.Model.Identifier? AccessionIdentifier { get { return _AccessionIdentifier; } set { _AccessionIdentifier = value; OnPropertyChanged("AccessionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _AccessionIdentifier; + private Hl7.Fhir.Model.Identifier? _AccessionIdentifier; /// /// available | unavailable | unsatisfactory | entered-in-error. @@ -774,13 +759,13 @@ public Hl7.Fhir.Model.Identifier AccessionIdentifier [DeclaredType(Type = typeof(Code))] [Binding("SpecimenStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// available | unavailable | unsatisfactory | entered-in-error @@ -789,13 +774,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -806,13 +788,13 @@ public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("SpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device. @@ -821,41 +803,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Group","Device","Substance","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The time when specimen was received for processing. /// [FhirElement("receivedTime", InSummary=true, Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedTimeElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedTimeElement { get { return _ReceivedTimeElement; } set { _ReceivedTimeElement = value; OnPropertyChanged("ReceivedTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedTimeElement; /// /// The time when specimen was received for processing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReceivedTime + public string? ReceivedTime { - get { return ReceivedTimeElement != null ? ReceivedTimeElement.Value : null; } + get => _ReceivedTimeElement?.Value; set { - if (value == null) - ReceivedTimeElement = null; - else - ReceivedTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ReceivedTime"); } } @@ -870,11 +849,11 @@ public string ReceivedTime [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// Why the specimen was collected. @@ -886,24 +865,24 @@ public List Parent [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Collection details. /// [FhirElement("collection", Order=170)] [DataMember] - public Hl7.Fhir.Model.Specimen.CollectionComponent Collection + public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection { get { return _Collection; } set { _Collection = value; OnPropertyChanged("Collection"); } } - private Hl7.Fhir.Model.Specimen.CollectionComponent _Collection; + private Hl7.Fhir.Model.Specimen.CollectionComponent? _Collection; /// /// Processing and processing step details. @@ -913,11 +892,11 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent Collection [DataMember] public List Processing { - get { if(_Processing==null) _Processing = new List(); return _Processing; } + get => _Processing ?? new List(); set { _Processing = value; OnPropertyChanged("Processing"); } } - private List _Processing; + private List? _Processing; /// /// Direct container of specimen (tube/slide, etc.). @@ -927,11 +906,11 @@ public List Processing [DataMember] public List Container { - get { if(_Container==null) _Container = new List(); return _Container; } + get => _Container ?? new List(); set { _Container = value; OnPropertyChanged("Container"); } } - private List _Container; + private List? _Container; /// /// State of the specimen. @@ -942,11 +921,11 @@ public List Container [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Comments. @@ -956,40 +935,36 @@ public List Condition [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Specimen; - - if (dest == null) - { + if(other is not Specimen dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(AccessionIdentifier != null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)AccessionIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(ReceivedTimeElement != null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedTimeElement.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Collection != null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)Collection.DeepCopyInternal(); - if(Processing.Any()) dest.Processing = new List(Processing.DeepCopyInternal()); - if(Container.Any()) dest.Container = new List(Container.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_AccessionIdentifier is not null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)_AccessionIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_ReceivedTimeElement is not null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedTimeElement.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Collection is not null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)_Collection.DeepCopyInternal(); + if(_Processing is not null) dest.Processing = new List(_Processing.DeepCopyInternal()); + if(_Container is not null) dest.Container = new List(_Container.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1001,118 +976,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Specimen; - if(otherT == null) return false; + if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(AccessionIdentifier, otherT.AccessionIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(ReceivedTimeElement, otherT.ReceivedTimeElement)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.Equals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(Processing, otherT.Processing)) return false; - if(!comparer.ListEquals(Container, otherT.Container)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_ReceivedTimeElement, otherT._ReceivedTimeElement)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; + if(!comparer.ListEquals(_Container, otherT._Container)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "accessionIdentifier": - value = AccessionIdentifier; - return AccessionIdentifier is not null; + value = _AccessionIdentifier; + return _AccessionIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "receivedTime": - value = ReceivedTimeElement; - return ReceivedTimeElement is not null; + value = _ReceivedTimeElement; + return _ReceivedTimeElement is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "collection": - value = Collection; - return Collection is not null; + value = _Collection; + return _Collection is not null; case "processing": - value = Processing; - return Processing?.Any() == true; + value = _Processing; + return _Processing?.Any() == true; case "container": - value = Container; - return Container?.Any() == true; + value = _Container; + return _Container?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "accessionIdentifier": - AccessionIdentifier = (Hl7.Fhir.Model.Identifier)value; + AccessionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receivedTime": - ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "collection": - Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)value; + Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent?)value; return this; case "processing": - Processing = (List)value; + Processing = (List?)value!; return this; case "container": - Container = (List)value; + Container = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1123,19 +1098,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",AccessionIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",ReceivedTimeElement); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Collection is not null) yield return new KeyValuePair("collection",Collection); - if (Processing?.Any() == true) yield return new KeyValuePair("processing",Processing); - if (Container?.Any() == true) yield return new KeyValuePair("container",Container); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",_AccessionIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",_ReceivedTimeElement); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Collection is not null) yield return new KeyValuePair("collection",_Collection); + if (_Processing?.Any() == true) yield return new KeyValuePair("processing",_Processing); + if (_Container?.Any() == true) yield return new KeyValuePair("container",_Container); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs index 1c4905120..36c06c6a3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SpecimenDefinition","http://hl7.org/fhir/StructureDefinition/SpecimenDefinition")] - public partial class SpecimenDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class SpecimenDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -102,13 +105,13 @@ public partial class TypeTestedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("isDerived", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDerivedElement + public Hl7.Fhir.Model.FhirBoolean? IsDerivedElement { get { return _IsDerivedElement; } set { _IsDerivedElement = value; OnPropertyChanged("IsDerivedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDerivedElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDerivedElement; /// /// Primary or secondary specimen @@ -117,13 +120,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDerivedElement [IgnoreDataMember] public bool? IsDerived { - get { return IsDerivedElement != null ? IsDerivedElement.Value : null; } + get => _IsDerivedElement?.Value; set { - if (value == null) - IsDerivedElement = null; - else - IsDerivedElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDerivedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDerived"); } } @@ -134,13 +134,13 @@ public bool? IsDerived [FhirElement("type", Order=50)] [Binding("IntendedSpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// preferred | alternate. @@ -150,13 +150,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("SpecimenContainedPreference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PreferenceElement + public Code? PreferenceElement { get { return _PreferenceElement; } set { _PreferenceElement = value; OnPropertyChanged("PreferenceElement"); } } - private Code _PreferenceElement; + private Code? _PreferenceElement; /// /// preferred | alternate @@ -165,13 +165,10 @@ public Code Prefe [IgnoreDataMember] public Hl7.Fhir.Model.SpecimenDefinition.SpecimenContainedPreference? Preference { - get { return PreferenceElement != null ? PreferenceElement.Value : null; } + get => _PreferenceElement?.Value; set { - if (value == null) - PreferenceElement = null; - else - PreferenceElement = new Code(value); + PreferenceElement = value is null ? null : new Code(value); OnPropertyChanged("Preference"); } } @@ -181,41 +178,38 @@ public Hl7.Fhir.Model.SpecimenDefinition.SpecimenContainedPreference? Preference /// [FhirElement("container", Order=70)] [DataMember] - public Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent Container + public Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent? Container { get { return _Container; } set { _Container = value; OnPropertyChanged("Container"); } } - private Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent _Container; + private Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent? _Container; /// /// Specimen requirements. /// [FhirElement("requirement", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString RequirementElement + public Hl7.Fhir.Model.FhirString? RequirementElement { get { return _RequirementElement; } set { _RequirementElement = value; OnPropertyChanged("RequirementElement"); } } - private Hl7.Fhir.Model.FhirString _RequirementElement; + private Hl7.Fhir.Model.FhirString? _RequirementElement; /// /// Specimen requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirement + public string? Requirement { - get { return RequirementElement != null ? RequirementElement.Value : null; } + get => _RequirementElement?.Value; set { - if (value == null) - RequirementElement = null; - else - RequirementElement = new Hl7.Fhir.Model.FhirString(value); + RequirementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Requirement"); } } @@ -225,13 +219,13 @@ public string Requirement /// [FhirElement("retentionTime", Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration RetentionTime + public Hl7.Fhir.Model.Duration? RetentionTime { get { return _RetentionTime; } set { _RetentionTime = value; OnPropertyChanged("RetentionTime"); } } - private Hl7.Fhir.Model.Duration _RetentionTime; + private Hl7.Fhir.Model.Duration? _RetentionTime; /// /// Rejection criterion. @@ -242,11 +236,11 @@ public Hl7.Fhir.Model.Duration RetentionTime [DataMember] public List RejectionCriterion { - get { if(_RejectionCriterion==null) _RejectionCriterion = new List(); return _RejectionCriterion; } + get => _RejectionCriterion ?? new List(); set { _RejectionCriterion = value; OnPropertyChanged("RejectionCriterion"); } } - private List _RejectionCriterion; + private List? _RejectionCriterion; /// /// Specimen handling before testing. @@ -256,30 +250,26 @@ public List RejectionCriterion [DataMember] public List Handling { - get { if(_Handling==null) _Handling = new List(); return _Handling; } + get => _Handling ?? new List(); set { _Handling = value; OnPropertyChanged("Handling"); } } - private List _Handling; + private List? _Handling; protected internal override void CopyToInternal(Base other) { - var dest = other as TypeTestedComponent; - - if (dest == null) - { + if(other is not TypeTestedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IsDerivedElement != null) dest.IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)IsDerivedElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PreferenceElement != null) dest.PreferenceElement = (Code)PreferenceElement.DeepCopyInternal(); - if(Container != null) dest.Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)Container.DeepCopyInternal(); - if(RequirementElement != null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)RequirementElement.DeepCopyInternal(); - if(RetentionTime != null) dest.RetentionTime = (Hl7.Fhir.Model.Duration)RetentionTime.DeepCopyInternal(); - if(RejectionCriterion.Any()) dest.RejectionCriterion = new List(RejectionCriterion.DeepCopyInternal()); - if(Handling.Any()) dest.Handling = new List(Handling.DeepCopyInternal()); + if(_IsDerivedElement is not null) dest.IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)_IsDerivedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PreferenceElement is not null) dest.PreferenceElement = (Code)_PreferenceElement.DeepCopyInternal(); + if(_Container is not null) dest.Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)_Container.DeepCopyInternal(); + if(_RequirementElement is not null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)_RequirementElement.DeepCopyInternal(); + if(_RetentionTime is not null) dest.RetentionTime = (Hl7.Fhir.Model.Duration)_RetentionTime.DeepCopyInternal(); + if(_RejectionCriterion is not null) dest.RejectionCriterion = new List(_RejectionCriterion.DeepCopyInternal()); + if(_Handling is not null) dest.Handling = new List(_Handling.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -291,83 +281,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TypeTestedComponent; - if(otherT == null) return false; + if(other is not TypeTestedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IsDerivedElement, otherT.IsDerivedElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PreferenceElement, otherT.PreferenceElement)) return false; - if(!comparer.Equals(Container, otherT.Container)) return false; - if(!comparer.Equals(RequirementElement, otherT.RequirementElement)) return false; - if(!comparer.Equals(RetentionTime, otherT.RetentionTime)) return false; - if(!comparer.ListEquals(RejectionCriterion, otherT.RejectionCriterion)) return false; - if(!comparer.ListEquals(Handling, otherT.Handling)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PreferenceElement, otherT._PreferenceElement)) return false; + if(!comparer.Equals(_Container, otherT._Container)) return false; + if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; + if(!comparer.Equals(_RetentionTime, otherT._RetentionTime)) return false; + if(!comparer.ListEquals(_RejectionCriterion, otherT._RejectionCriterion)) return false; + if(!comparer.ListEquals(_Handling, otherT._Handling)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "isDerived": - value = IsDerivedElement; - return IsDerivedElement is not null; + value = _IsDerivedElement; + return _IsDerivedElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "preference": - value = PreferenceElement; - return PreferenceElement is not null; + value = _PreferenceElement; + return _PreferenceElement is not null; case "container": - value = Container; - return Container is not null; + value = _Container; + return _Container is not null; case "requirement": - value = RequirementElement; - return RequirementElement is not null; + value = _RequirementElement; + return _RequirementElement is not null; case "retentionTime": - value = RetentionTime; - return RetentionTime is not null; + value = _RetentionTime; + return _RetentionTime is not null; case "rejectionCriterion": - value = RejectionCriterion; - return RejectionCriterion?.Any() == true; + value = _RejectionCriterion; + return _RejectionCriterion?.Any() == true; case "handling": - value = Handling; - return Handling?.Any() == true; + value = _Handling; + return _Handling?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "isDerived": - IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preference": - PreferenceElement = (Code)value; + PreferenceElement = (Code?)value; return this; case "container": - Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)value; + Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent?)value; return this; case "requirement": - RequirementElement = (Hl7.Fhir.Model.FhirString)value; + RequirementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "retentionTime": - RetentionTime = (Hl7.Fhir.Model.Duration)value; + RetentionTime = (Hl7.Fhir.Model.Duration?)value; return this; case "rejectionCriterion": - RejectionCriterion = (List)value; + RejectionCriterion = (List?)value!; return this; case "handling": - Handling = (List)value; + Handling = (List?)value!; return this; default: return base.SetValue(key, value); @@ -378,14 +368,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IsDerivedElement is not null) yield return new KeyValuePair("isDerived",IsDerivedElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PreferenceElement is not null) yield return new KeyValuePair("preference",PreferenceElement); - if (Container is not null) yield return new KeyValuePair("container",Container); - if (RequirementElement is not null) yield return new KeyValuePair("requirement",RequirementElement); - if (RetentionTime is not null) yield return new KeyValuePair("retentionTime",RetentionTime); - if (RejectionCriterion?.Any() == true) yield return new KeyValuePair("rejectionCriterion",RejectionCriterion); - if (Handling?.Any() == true) yield return new KeyValuePair("handling",Handling); + if (_IsDerivedElement is not null) yield return new KeyValuePair("isDerived",_IsDerivedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PreferenceElement is not null) yield return new KeyValuePair("preference",_PreferenceElement); + if (_Container is not null) yield return new KeyValuePair("container",_Container); + if (_RequirementElement is not null) yield return new KeyValuePair("requirement",_RequirementElement); + if (_RetentionTime is not null) yield return new KeyValuePair("retentionTime",_RetentionTime); + if (_RejectionCriterion?.Any() == true) yield return new KeyValuePair("rejectionCriterion",_RejectionCriterion); + if (_Handling?.Any() == true) yield return new KeyValuePair("handling",_Handling); } } @@ -409,13 +399,13 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("material", Order=40)] [Binding("ContainerMaterial")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Material + public Hl7.Fhir.Model.CodeableConcept? Material { get { return _Material; } set { _Material = value; OnPropertyChanged("Material"); } } - private Hl7.Fhir.Model.CodeableConcept _Material; + private Hl7.Fhir.Model.CodeableConcept? _Material; /// /// Kind of container associated with the kind of specimen. @@ -423,13 +413,13 @@ public Hl7.Fhir.Model.CodeableConcept Material [FhirElement("type", Order=50)] [Binding("ContainerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Color of container cap. @@ -437,41 +427,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("cap", Order=60)] [Binding("ContainerCap")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Cap + public Hl7.Fhir.Model.CodeableConcept? Cap { get { return _Cap; } set { _Cap = value; OnPropertyChanged("Cap"); } } - private Hl7.Fhir.Model.CodeableConcept _Cap; + private Hl7.Fhir.Model.CodeableConcept? _Cap; /// /// Container description. /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Container description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -481,13 +468,13 @@ public string Description /// [FhirElement("capacity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Capacity + public Hl7.Fhir.Model.Quantity? Capacity { get { return _Capacity; } set { _Capacity = value; OnPropertyChanged("Capacity"); } } - private Hl7.Fhir.Model.Quantity _Capacity; + private Hl7.Fhir.Model.Quantity? _Capacity; /// /// Minimum volume. @@ -496,13 +483,13 @@ public Hl7.Fhir.Model.Quantity Capacity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType MinimumVolume + public Hl7.Fhir.Model.DataType? MinimumVolume { get { return _MinimumVolume; } set { _MinimumVolume = value; OnPropertyChanged("MinimumVolume"); } } - private Hl7.Fhir.Model.DataType _MinimumVolume; + private Hl7.Fhir.Model.DataType? _MinimumVolume; /// /// Additive associated with container. @@ -512,61 +499,54 @@ public Hl7.Fhir.Model.DataType MinimumVolume [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Specimen container preparation. /// [FhirElement("preparation", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString PreparationElement + public Hl7.Fhir.Model.FhirString? PreparationElement { get { return _PreparationElement; } set { _PreparationElement = value; OnPropertyChanged("PreparationElement"); } } - private Hl7.Fhir.Model.FhirString _PreparationElement; + private Hl7.Fhir.Model.FhirString? _PreparationElement; /// /// Specimen container preparation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Preparation + public string? Preparation { - get { return PreparationElement != null ? PreparationElement.Value : null; } + get => _PreparationElement?.Value; set { - if (value == null) - PreparationElement = null; - else - PreparationElement = new Hl7.Fhir.Model.FhirString(value); + PreparationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Preparation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContainerComponent; - - if (dest == null) - { + if(other is not ContainerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Material != null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)Material.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Cap != null) dest.Cap = (Hl7.Fhir.Model.CodeableConcept)Cap.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Capacity != null) dest.Capacity = (Hl7.Fhir.Model.Quantity)Capacity.DeepCopyInternal(); - if(MinimumVolume != null) dest.MinimumVolume = (Hl7.Fhir.Model.DataType)MinimumVolume.DeepCopyInternal(); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(PreparationElement != null) dest.PreparationElement = (Hl7.Fhir.Model.FhirString)PreparationElement.DeepCopyInternal(); + if(_Material is not null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)_Material.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Cap is not null) dest.Cap = (Hl7.Fhir.Model.CodeableConcept)_Cap.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Capacity is not null) dest.Capacity = (Hl7.Fhir.Model.Quantity)_Capacity.DeepCopyInternal(); + if(_MinimumVolume is not null) dest.MinimumVolume = (Hl7.Fhir.Model.DataType)_MinimumVolume.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_PreparationElement is not null) dest.PreparationElement = (Hl7.Fhir.Model.FhirString)_PreparationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -578,83 +558,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainerComponent; - if(otherT == null) return false; + if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Material, otherT.Material)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Cap, otherT.Cap)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Capacity, otherT.Capacity)) return false; - if(!comparer.Equals(MinimumVolume, otherT.MinimumVolume)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(PreparationElement, otherT.PreparationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Cap, otherT._Cap)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; + if(!comparer.Equals(_MinimumVolume, otherT._MinimumVolume)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_PreparationElement, otherT._PreparationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "material": - value = Material; - return Material is not null; + value = _Material; + return _Material is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "cap": - value = Cap; - return Cap is not null; + value = _Cap; + return _Cap is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "capacity": - value = Capacity; - return Capacity is not null; + value = _Capacity; + return _Capacity is not null; case "minimumVolume": - value = MinimumVolume; - return MinimumVolume is not null; + value = _MinimumVolume; + return _MinimumVolume is not null; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "preparation": - value = PreparationElement; - return PreparationElement is not null; + value = _PreparationElement; + return _PreparationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "material": - Material = (Hl7.Fhir.Model.CodeableConcept)value; + Material = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cap": - Cap = (Hl7.Fhir.Model.CodeableConcept)value; + Cap = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "capacity": - Capacity = (Hl7.Fhir.Model.Quantity)value; + Capacity = (Hl7.Fhir.Model.Quantity?)value; return this; case "minimumVolume": - MinimumVolume = (Hl7.Fhir.Model.DataType)value; + MinimumVolume = (Hl7.Fhir.Model.DataType?)value; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "preparation": - PreparationElement = (Hl7.Fhir.Model.FhirString)value; + PreparationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -665,14 +645,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Material is not null) yield return new KeyValuePair("material",Material); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Cap is not null) yield return new KeyValuePair("cap",Cap); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Capacity is not null) yield return new KeyValuePair("capacity",Capacity); - if (MinimumVolume is not null) yield return new KeyValuePair("minimumVolume",MinimumVolume); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (PreparationElement is not null) yield return new KeyValuePair("preparation",PreparationElement); + if (_Material is not null) yield return new KeyValuePair("material",_Material); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Cap is not null) yield return new KeyValuePair("cap",_Cap); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Capacity is not null) yield return new KeyValuePair("capacity",_Capacity); + if (_MinimumVolume is not null) yield return new KeyValuePair("minimumVolume",_MinimumVolume); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_PreparationElement is not null) yield return new KeyValuePair("preparation",_PreparationElement); } } @@ -703,25 +683,21 @@ public partial class AdditiveComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Additive + public Hl7.Fhir.Model.DataType? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.DataType _Additive; + private Hl7.Fhir.Model.DataType? _Additive; protected internal override void CopyToInternal(Base other) { - var dest = other as AdditiveComponent; - - if (dest == null) - { + if(other is not AdditiveComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.DataType)Additive.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.DataType)_Additive.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -733,34 +709,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdditiveComponent; - if(otherT == null) return false; + if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Additive, otherT._Additive)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "additive": - Additive = (Hl7.Fhir.Model.DataType)value; + Additive = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -771,7 +747,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Additive is not null) yield return new KeyValuePair("additive",Additive); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); } } @@ -798,85 +774,78 @@ public partial class HandlingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("temperatureQualifier", Order=40)] [Binding("HandlingConditionSet")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TemperatureQualifier + public Hl7.Fhir.Model.CodeableConcept? TemperatureQualifier { get { return _TemperatureQualifier; } set { _TemperatureQualifier = value; OnPropertyChanged("TemperatureQualifier"); } } - private Hl7.Fhir.Model.CodeableConcept _TemperatureQualifier; + private Hl7.Fhir.Model.CodeableConcept? _TemperatureQualifier; /// /// Temperature range. /// [FhirElement("temperatureRange", Order=50)] [DataMember] - public Hl7.Fhir.Model.Range TemperatureRange + public Hl7.Fhir.Model.Range? TemperatureRange { get { return _TemperatureRange; } set { _TemperatureRange = value; OnPropertyChanged("TemperatureRange"); } } - private Hl7.Fhir.Model.Range _TemperatureRange; + private Hl7.Fhir.Model.Range? _TemperatureRange; /// /// Maximum preservation time. /// [FhirElement("maxDuration", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration MaxDuration + public Hl7.Fhir.Model.Duration? MaxDuration { get { return _MaxDuration; } set { _MaxDuration = value; OnPropertyChanged("MaxDuration"); } } - private Hl7.Fhir.Model.Duration _MaxDuration; + private Hl7.Fhir.Model.Duration? _MaxDuration; /// /// Preservation instruction. /// [FhirElement("instruction", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Preservation instruction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as HandlingComponent; - - if (dest == null) - { + if(other is not HandlingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TemperatureQualifier != null) dest.TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)TemperatureQualifier.DeepCopyInternal(); - if(TemperatureRange != null) dest.TemperatureRange = (Hl7.Fhir.Model.Range)TemperatureRange.DeepCopyInternal(); - if(MaxDuration != null) dest.MaxDuration = (Hl7.Fhir.Model.Duration)MaxDuration.DeepCopyInternal(); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_TemperatureQualifier is not null) dest.TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)_TemperatureQualifier.DeepCopyInternal(); + if(_TemperatureRange is not null) dest.TemperatureRange = (Hl7.Fhir.Model.Range)_TemperatureRange.DeepCopyInternal(); + if(_MaxDuration is not null) dest.MaxDuration = (Hl7.Fhir.Model.Duration)_MaxDuration.DeepCopyInternal(); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -888,55 +857,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HandlingComponent; - if(otherT == null) return false; + if(other is not HandlingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TemperatureQualifier, otherT.TemperatureQualifier)) return false; - if(!comparer.Equals(TemperatureRange, otherT.TemperatureRange)) return false; - if(!comparer.Equals(MaxDuration, otherT.MaxDuration)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; + if(!comparer.Equals(_TemperatureRange, otherT._TemperatureRange)) return false; + if(!comparer.Equals(_MaxDuration, otherT._MaxDuration)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "temperatureQualifier": - value = TemperatureQualifier; - return TemperatureQualifier is not null; + value = _TemperatureQualifier; + return _TemperatureQualifier is not null; case "temperatureRange": - value = TemperatureRange; - return TemperatureRange is not null; + value = _TemperatureRange; + return _TemperatureRange is not null; case "maxDuration": - value = MaxDuration; - return MaxDuration is not null; + value = _MaxDuration; + return _MaxDuration is not null; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "temperatureQualifier": - TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)value; + TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "temperatureRange": - TemperatureRange = (Hl7.Fhir.Model.Range)value; + TemperatureRange = (Hl7.Fhir.Model.Range?)value; return this; case "maxDuration": - MaxDuration = (Hl7.Fhir.Model.Duration)value; + MaxDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -947,10 +916,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TemperatureQualifier is not null) yield return new KeyValuePair("temperatureQualifier",TemperatureQualifier); - if (TemperatureRange is not null) yield return new KeyValuePair("temperatureRange",TemperatureRange); - if (MaxDuration is not null) yield return new KeyValuePair("maxDuration",MaxDuration); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_TemperatureQualifier is not null) yield return new KeyValuePair("temperatureQualifier",_TemperatureQualifier); + if (_TemperatureRange is not null) yield return new KeyValuePair("temperatureRange",_TemperatureRange); + if (_MaxDuration is not null) yield return new KeyValuePair("maxDuration",_MaxDuration); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -960,13 +929,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Kind of material to collect. @@ -974,13 +943,13 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("typeCollected", InSummary=true, Order=100)] [Binding("CollectedSpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TypeCollected + public Hl7.Fhir.Model.CodeableConcept? TypeCollected { get { return _TypeCollected; } set { _TypeCollected = value; OnPropertyChanged("TypeCollected"); } } - private Hl7.Fhir.Model.CodeableConcept _TypeCollected; + private Hl7.Fhir.Model.CodeableConcept? _TypeCollected; /// /// Patient preparation for collection. @@ -991,39 +960,36 @@ public Hl7.Fhir.Model.CodeableConcept TypeCollected [DataMember] public List PatientPreparation { - get { if(_PatientPreparation==null) _PatientPreparation = new List(); return _PatientPreparation; } + get => _PatientPreparation ?? new List(); set { _PatientPreparation = value; OnPropertyChanged("PatientPreparation"); } } - private List _PatientPreparation; + private List? _PatientPreparation; /// /// Time aspect for collection. /// [FhirElement("timeAspect", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TimeAspectElement + public Hl7.Fhir.Model.FhirString? TimeAspectElement { get { return _TimeAspectElement; } set { _TimeAspectElement = value; OnPropertyChanged("TimeAspectElement"); } } - private Hl7.Fhir.Model.FhirString _TimeAspectElement; + private Hl7.Fhir.Model.FhirString? _TimeAspectElement; /// /// Time aspect for collection /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TimeAspect + public string? TimeAspect { - get { return TimeAspectElement != null ? TimeAspectElement.Value : null; } + get => _TimeAspectElement?.Value; set { - if (value == null) - TimeAspectElement = null; - else - TimeAspectElement = new Hl7.Fhir.Model.FhirString(value); + TimeAspectElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TimeAspect"); } } @@ -1037,11 +1003,11 @@ public string TimeAspect [DataMember] public List Collection { - get { if(_Collection==null) _Collection = new List(); return _Collection; } + get => _Collection ?? new List(); set { _Collection = value; OnPropertyChanged("Collection"); } } - private List _Collection; + private List? _Collection; /// /// Specimen in container intended for testing by lab. @@ -1051,30 +1017,26 @@ public List Collection [DataMember] public List TypeTested { - get { if(_TypeTested==null) _TypeTested = new List(); return _TypeTested; } + get => _TypeTested ?? new List(); set { _TypeTested = value; OnPropertyChanged("TypeTested"); } } - private List _TypeTested; + private List? _TypeTested; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SpecimenDefinition; - - if (dest == null) - { + if(other is not SpecimenDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(TypeCollected != null) dest.TypeCollected = (Hl7.Fhir.Model.CodeableConcept)TypeCollected.DeepCopyInternal(); - if(PatientPreparation.Any()) dest.PatientPreparation = new List(PatientPreparation.DeepCopyInternal()); - if(TimeAspectElement != null) dest.TimeAspectElement = (Hl7.Fhir.Model.FhirString)TimeAspectElement.DeepCopyInternal(); - if(Collection.Any()) dest.Collection = new List(Collection.DeepCopyInternal()); - if(TypeTested.Any()) dest.TypeTested = new List(TypeTested.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_TypeCollected is not null) dest.TypeCollected = (Hl7.Fhir.Model.CodeableConcept)_TypeCollected.DeepCopyInternal(); + if(_PatientPreparation is not null) dest.PatientPreparation = new List(_PatientPreparation.DeepCopyInternal()); + if(_TimeAspectElement is not null) dest.TimeAspectElement = (Hl7.Fhir.Model.FhirString)_TimeAspectElement.DeepCopyInternal(); + if(_Collection is not null) dest.Collection = new List(_Collection.DeepCopyInternal()); + if(_TypeTested is not null) dest.TypeTested = new List(_TypeTested.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1086,69 +1048,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecimenDefinition; - if(otherT == null) return false; + if(other is not SpecimenDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeCollected, otherT.TypeCollected)) return false; - if(!comparer.ListEquals(PatientPreparation, otherT.PatientPreparation)) return false; - if(!comparer.Equals(TimeAspectElement, otherT.TimeAspectElement)) return false; - if(!comparer.ListEquals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(TypeTested, otherT.TypeTested)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeCollected, otherT._TypeCollected)) return false; + if(!comparer.ListEquals(_PatientPreparation, otherT._PatientPreparation)) return false; + if(!comparer.Equals(_TimeAspectElement, otherT._TimeAspectElement)) return false; + if(!comparer.ListEquals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_TypeTested, otherT._TypeTested)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "typeCollected": - value = TypeCollected; - return TypeCollected is not null; + value = _TypeCollected; + return _TypeCollected is not null; case "patientPreparation": - value = PatientPreparation; - return PatientPreparation?.Any() == true; + value = _PatientPreparation; + return _PatientPreparation?.Any() == true; case "timeAspect": - value = TimeAspectElement; - return TimeAspectElement is not null; + value = _TimeAspectElement; + return _TimeAspectElement is not null; case "collection": - value = Collection; - return Collection?.Any() == true; + value = _Collection; + return _Collection?.Any() == true; case "typeTested": - value = TypeTested; - return TypeTested?.Any() == true; + value = _TypeTested; + return _TypeTested?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "typeCollected": - TypeCollected = (Hl7.Fhir.Model.CodeableConcept)value; + TypeCollected = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patientPreparation": - PatientPreparation = (List)value; + PatientPreparation = (List?)value!; return this; case "timeAspect": - TimeAspectElement = (Hl7.Fhir.Model.FhirString)value; + TimeAspectElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "collection": - Collection = (List)value; + Collection = (List?)value!; return this; case "typeTested": - TypeTested = (List)value; + TypeTested = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1159,12 +1121,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (TypeCollected is not null) yield return new KeyValuePair("typeCollected",TypeCollected); - if (PatientPreparation?.Any() == true) yield return new KeyValuePair("patientPreparation",PatientPreparation); - if (TimeAspectElement is not null) yield return new KeyValuePair("timeAspect",TimeAspectElement); - if (Collection?.Any() == true) yield return new KeyValuePair("collection",Collection); - if (TypeTested?.Any() == true) yield return new KeyValuePair("typeTested",TypeTested); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeCollected is not null) yield return new KeyValuePair("typeCollected",_TypeCollected); + if (_PatientPreparation?.Any() == true) yield return new KeyValuePair("patientPreparation",_PatientPreparation); + if (_TimeAspectElement is not null) yield return new KeyValuePair("timeAspect",_TimeAspectElement); + if (_Collection?.Any() == true) yield return new KeyValuePair("collection",_Collection); + if (_TypeTested?.Any() == true) yield return new KeyValuePair("typeTested",_TypeTested); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs index aacc5a18a..851bf3e96 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -371,28 +374,25 @@ public partial class StructureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical UrlElement + public Hl7.Fhir.Model.Canonical? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.Canonical _UrlElement; + private Hl7.Fhir.Model.Canonical? _UrlElement; /// /// Canonical reference to structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.Canonical(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Url"); } } @@ -405,13 +405,13 @@ public string Url [Binding("StructureMapModelMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | queried | target | produced @@ -420,13 +420,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -436,28 +433,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode /// [FhirElement("alias", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString AliasElement + public Hl7.Fhir.Model.FhirString? AliasElement { get { return _AliasElement; } set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private Hl7.Fhir.Model.FhirString _AliasElement; + private Hl7.Fhir.Model.FhirString? _AliasElement; /// /// Name for type in this map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Alias + public string? Alias { - get { return AliasElement != null ? AliasElement.Value : null; } + get => _AliasElement?.Value; set { - if (value == null) - AliasElement = null; - else - AliasElement = new Hl7.Fhir.Model.FhirString(value); + AliasElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Alias"); } } @@ -467,46 +461,39 @@ public string Alias /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation on use of structure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureComponent; - - if (dest == null) - { + if(other is not StructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)UrlElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(AliasElement != null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)AliasElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)_UrlElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)_AliasElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -518,55 +505,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureComponent; - if(otherT == null) return false; + if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "alias": - value = AliasElement; - return AliasElement is not null; + value = _AliasElement; + return _AliasElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.Canonical)value; + UrlElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "alias": - AliasElement = (Hl7.Fhir.Model.FhirString)value; + AliasElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -577,10 +564,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (AliasElement is not null) yield return new KeyValuePair("alias",AliasElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_AliasElement is not null) yield return new KeyValuePair("alias",_AliasElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -607,28 +594,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -638,28 +622,25 @@ public string Name /// [FhirElement("extends", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Id ExtendsElement + public Hl7.Fhir.Model.Id? ExtendsElement { get { return _ExtendsElement; } set { _ExtendsElement = value; OnPropertyChanged("ExtendsElement"); } } - private Hl7.Fhir.Model.Id _ExtendsElement; + private Hl7.Fhir.Model.Id? _ExtendsElement; /// /// Another group that this group adds rules to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Extends + public string? Extends { - get { return ExtendsElement != null ? ExtendsElement.Value : null; } + get => _ExtendsElement?.Value; set { - if (value == null) - ExtendsElement = null; - else - ExtendsElement = new Hl7.Fhir.Model.Id(value); + ExtendsElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Extends"); } } @@ -672,13 +653,13 @@ public string Extends [Binding("StructureMapGroupTypeMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeModeElement + public Code? TypeModeElement { get { return _TypeModeElement; } set { _TypeModeElement = value; OnPropertyChanged("TypeModeElement"); } } - private Code _TypeModeElement; + private Code? _TypeModeElement; /// /// none | types | type-and-types @@ -687,13 +668,10 @@ public Code TypeModeEleme [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode { - get { return TypeModeElement != null ? TypeModeElement.Value : null; } + get => _TypeModeElement?.Value; set { - if (value == null) - TypeModeElement = null; - else - TypeModeElement = new Code(value); + TypeModeElement = value is null ? null : new Code(value); OnPropertyChanged("TypeMode"); } } @@ -703,28 +681,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional description/explanation for group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -737,11 +712,11 @@ public string Documentation [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Transform Rule from source to target. @@ -751,28 +726,24 @@ public List Input [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(ExtendsElement != null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)ExtendsElement.DeepCopyInternal(); - if(TypeModeElement != null) dest.TypeModeElement = (Code)TypeModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_ExtendsElement is not null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)_ExtendsElement.DeepCopyInternal(); + if(_TypeModeElement is not null) dest.TypeModeElement = (Code)_TypeModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -784,69 +755,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ExtendsElement, otherT.ExtendsElement)) return false; - if(!comparer.Equals(TypeModeElement, otherT.TypeModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; + if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "extends": - value = ExtendsElement; - return ExtendsElement is not null; + value = _ExtendsElement; + return _ExtendsElement is not null; case "typeMode": - value = TypeModeElement; - return TypeModeElement is not null; + value = _TypeModeElement; + return _TypeModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "extends": - ExtendsElement = (Hl7.Fhir.Model.Id)value; + ExtendsElement = (Hl7.Fhir.Model.Id?)value; return this; case "typeMode": - TypeModeElement = (Code)value; + TypeModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -857,12 +828,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ExtendsElement is not null) yield return new KeyValuePair("extends",ExtendsElement); - if (TypeModeElement is not null) yield return new KeyValuePair("typeMode",TypeModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ExtendsElement is not null) yield return new KeyValuePair("extends",_ExtendsElement); + if (_TypeModeElement is not null) yield return new KeyValuePair("typeMode",_TypeModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } @@ -890,28 +861,25 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -921,28 +889,25 @@ public string Name /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Type for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -955,13 +920,13 @@ public string Type [Binding("StructureMapInputMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | target @@ -970,13 +935,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -986,46 +948,39 @@ public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1037,55 +992,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1096,10 +1051,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1123,28 +1078,25 @@ public partial class RuleComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of the rule for internal references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -1157,11 +1109,11 @@ public string Name [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; /// /// Content to create because of this mapping rule. @@ -1171,11 +1123,11 @@ public List Source [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// Rules contained in this rule. @@ -1185,11 +1137,11 @@ public List Target [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Which other rules to apply in the context of this rule. @@ -1199,59 +1151,52 @@ public List Rule [DataMember] public List Dependent { - get { if(_Dependent==null) _Dependent = new List(); return _Dependent; } + get => _Dependent ?? new List(); set { _Dependent = value; OnPropertyChanged("Dependent"); } } - private List _Dependent; + private List? _Dependent; /// /// Documentation for this instance of data. /// [FhirElement("documentation", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RuleComponent; - - if (dest == null) - { + if(other is not RuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(Dependent.Any()) dest.Dependent = new List(Dependent.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_Dependent is not null) dest.Dependent = new List(_Dependent.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1263,69 +1208,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RuleComponent; - if(otherT == null) return false; + if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.ListEquals(Dependent, otherT.Dependent)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "dependent": - value = Dependent; - return Dependent?.Any() == true; + value = _Dependent; + return _Dependent?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "dependent": - Dependent = (List)value; + Dependent = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1336,12 +1281,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (Dependent?.Any() == true) yield return new KeyValuePair("dependent",Dependent); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_Dependent?.Any() == true) yield return new KeyValuePair("dependent",_Dependent); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1365,28 +1310,25 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("context", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ContextElement + public Hl7.Fhir.Model.Id? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.Id _ContextElement; + private Hl7.Fhir.Model.Id? _ContextElement; /// /// Type or variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.Id(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Context"); } } @@ -1396,13 +1338,13 @@ public string Context /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Specified minimum cardinality @@ -1411,13 +1353,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -1427,28 +1366,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Specified maximum cardinality (number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -1458,28 +1394,25 @@ public string Max /// [FhirElement("type", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Rule only applies if source has this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1491,41 +1424,38 @@ public string Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.Contributor),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [DataMember] - public Hl7.Fhir.Model.DataType DefaultValue + public Hl7.Fhir.Model.DataType? DefaultValue { get { return _DefaultValue; } set { _DefaultValue = value; OnPropertyChanged("DefaultValue"); } } - private Hl7.Fhir.Model.DataType _DefaultValue; + private Hl7.Fhir.Model.DataType? _DefaultValue; /// /// Optional field for this source. /// [FhirElement("element", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Optional field for this source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -1537,13 +1467,13 @@ public string Element [DeclaredType(Type = typeof(Code))] [Binding("StructureMapSourceListMode")] [DataMember] - public Code ListModeElement + public Code? ListModeElement { get { return _ListModeElement; } set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private Code _ListModeElement; + private Code? _ListModeElement; /// /// first | not_first | last | not_last | only_one @@ -1552,13 +1482,10 @@ public Code ListModeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode { - get { return ListModeElement != null ? ListModeElement.Value : null; } + get => _ListModeElement?.Value; set { - if (value == null) - ListModeElement = null; - else - ListModeElement = new Code(value); + ListModeElement = value is null ? null : new Code(value); OnPropertyChanged("ListMode"); } } @@ -1568,28 +1495,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode /// [FhirElement("variable", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -1599,28 +1523,25 @@ public string Variable /// [FhirElement("condition", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// FHIRPath expression - must be true or the rule does not apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -1630,28 +1551,25 @@ public string Condition /// [FhirElement("check", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString CheckElement + public Hl7.Fhir.Model.FhirString? CheckElement { get { return _CheckElement; } set { _CheckElement = value; OnPropertyChanged("CheckElement"); } } - private Hl7.Fhir.Model.FhirString _CheckElement; + private Hl7.Fhir.Model.FhirString? _CheckElement; /// /// FHIRPath expression - must be true or the mapping engine throws an error instead of completing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Check + public string? Check { - get { return CheckElement != null ? CheckElement.Value : null; } + get => _CheckElement?.Value; set { - if (value == null) - CheckElement = null; - else - CheckElement = new Hl7.Fhir.Model.FhirString(value); + CheckElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Check"); } } @@ -1661,53 +1579,46 @@ public string Check /// [FhirElement("logMessage", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString LogMessageElement + public Hl7.Fhir.Model.FhirString? LogMessageElement { get { return _LogMessageElement; } set { _LogMessageElement = value; OnPropertyChanged("LogMessageElement"); } } - private Hl7.Fhir.Model.FhirString _LogMessageElement; + private Hl7.Fhir.Model.FhirString? _LogMessageElement; /// /// Message to put in log if source exists (FHIRPath) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LogMessage + public string? LogMessage { - get { return LogMessageElement != null ? LogMessageElement.Value : null; } + get => _LogMessageElement?.Value; set { - if (value == null) - LogMessageElement = null; - else - LogMessageElement = new Hl7.Fhir.Model.FhirString(value); + LogMessageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LogMessage"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.Id)ContextElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(DefaultValue != null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)DefaultValue.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(ListModeElement != null) dest.ListModeElement = (Code)ListModeElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(CheckElement != null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)CheckElement.DeepCopyInternal(); - if(LogMessageElement != null) dest.LogMessageElement = (Hl7.Fhir.Model.FhirString)LogMessageElement.DeepCopyInternal(); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.Id)_ContextElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_DefaultValue is not null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)_DefaultValue.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = (Code)_ListModeElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_CheckElement is not null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)_CheckElement.DeepCopyInternal(); + if(_LogMessageElement is not null) dest.LogMessageElement = (Hl7.Fhir.Model.FhirString)_LogMessageElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1719,104 +1630,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DefaultValue, otherT.DefaultValue)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.Equals(CheckElement, otherT.CheckElement)) return false; - if(!comparer.Equals(LogMessageElement, otherT.LogMessageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DefaultValue, otherT._DefaultValue)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; + if(!comparer.Equals(_LogMessageElement, otherT._LogMessageElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "defaultValue": - value = DefaultValue; - return DefaultValue is not null; + value = _DefaultValue; + return _DefaultValue is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement is not null; + value = _ListModeElement; + return _ListModeElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "check": - value = CheckElement; - return CheckElement is not null; + value = _CheckElement; + return _CheckElement is not null; case "logMessage": - value = LogMessageElement; - return LogMessageElement is not null; + value = _LogMessageElement; + return _LogMessageElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.Id)value; + ContextElement = (Hl7.Fhir.Model.Id?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValue = (Hl7.Fhir.Model.DataType)value; + DefaultValue = (Hl7.Fhir.Model.DataType?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "listMode": - ListModeElement = (Code)value; + ListModeElement = (Code?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "check": - CheckElement = (Hl7.Fhir.Model.FhirString)value; + CheckElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "logMessage": - LogMessageElement = (Hl7.Fhir.Model.FhirString)value; + LogMessageElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1827,17 +1738,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DefaultValue is not null) yield return new KeyValuePair("defaultValue",DefaultValue); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (ListModeElement is not null) yield return new KeyValuePair("listMode",ListModeElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (CheckElement is not null) yield return new KeyValuePair("check",CheckElement); - if (LogMessageElement is not null) yield return new KeyValuePair("logMessage",LogMessageElement); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DefaultValue is not null) yield return new KeyValuePair("defaultValue",_DefaultValue); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_ListModeElement is not null) yield return new KeyValuePair("listMode",_ListModeElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_CheckElement is not null) yield return new KeyValuePair("check",_CheckElement); + if (_LogMessageElement is not null) yield return new KeyValuePair("logMessage",_LogMessageElement); } } @@ -1860,28 +1771,25 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("context", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Id ContextElement + public Hl7.Fhir.Model.Id? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.Id _ContextElement; + private Hl7.Fhir.Model.Id? _ContextElement; /// /// Type or variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.Id(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Context"); } } @@ -1893,13 +1801,13 @@ public string Context [DeclaredType(Type = typeof(Code))] [Binding("StructureMapContextType")] [DataMember] - public Code ContextTypeElement + public Code? ContextTypeElement { get { return _ContextTypeElement; } set { _ContextTypeElement = value; OnPropertyChanged("ContextTypeElement"); } } - private Code _ContextTypeElement; + private Code? _ContextTypeElement; /// /// type | variable @@ -1908,13 +1816,10 @@ public Code ContextTypeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapContextType? ContextType { - get { return ContextTypeElement != null ? ContextTypeElement.Value : null; } + get => _ContextTypeElement?.Value; set { - if (value == null) - ContextTypeElement = null; - else - ContextTypeElement = new Code(value); + ContextTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ContextType"); } } @@ -1924,28 +1829,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapContextType? ContextType /// [FhirElement("element", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Field to create in the context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -1955,28 +1857,25 @@ public string Element /// [FhirElement("variable", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if desired, and a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -1991,24 +1890,24 @@ public string Variable [DataMember] public List> ListModeElement { - get { if(_ListModeElement==null) _ListModeElement = new List>(); return _ListModeElement; } + get => _ListModeElement ?? new List>(); set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private List> _ListModeElement; + private List>? _ListModeElement; /// /// first | share | last | collate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ListMode + public IEnumerable? ListMode { - get { return ListModeElement != null ? ListModeElement.Select(elem => elem.Value) : null; } + get => _ListModeElement?.Select(elem => elem.Value); set { if (value == null) - ListModeElement = null; + ListModeElement = null!; else ListModeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("ListMode"); @@ -2020,28 +1919,25 @@ public IEnumerable List /// [FhirElement("listRuleId", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Id ListRuleIdElement + public Hl7.Fhir.Model.Id? ListRuleIdElement { get { return _ListRuleIdElement; } set { _ListRuleIdElement = value; OnPropertyChanged("ListRuleIdElement"); } } - private Hl7.Fhir.Model.Id _ListRuleIdElement; + private Hl7.Fhir.Model.Id? _ListRuleIdElement; /// /// Internal rule reference for shared list items /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ListRuleId + public string? ListRuleId { - get { return ListRuleIdElement != null ? ListRuleIdElement.Value : null; } + get => _ListRuleIdElement?.Value; set { - if (value == null) - ListRuleIdElement = null; - else - ListRuleIdElement = new Hl7.Fhir.Model.Id(value); + ListRuleIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ListRuleId"); } } @@ -2053,13 +1949,13 @@ public string ListRuleId [DeclaredType(Type = typeof(Code))] [Binding("StructureMapTransform")] [DataMember] - public Code TransformElement + public Code? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Code _TransformElement; + private Code? _TransformElement; /// /// create | copy + @@ -2068,13 +1964,10 @@ public Code TransformElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Code(value); + TransformElement = value is null ? null : new Code(value); OnPropertyChanged("Transform"); } } @@ -2087,30 +1980,26 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.Id)ContextElement.DeepCopyInternal(); - if(ContextTypeElement != null) dest.ContextTypeElement = (Code)ContextTypeElement.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ListModeElement.Any()) dest.ListModeElement = new List>(ListModeElement.DeepCopyInternal()); - if(ListRuleIdElement != null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)ListRuleIdElement.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Code)TransformElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.Id)_ContextElement.DeepCopyInternal(); + if(_ContextTypeElement is not null) dest.ContextTypeElement = (Code)_ContextTypeElement.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = new List>(_ListModeElement.DeepCopyInternal()); + if(_ListRuleIdElement is not null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)_ListRuleIdElement.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Code)_TransformElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2122,83 +2011,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(ContextTypeElement, otherT.ContextTypeElement)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.ListEquals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(ListRuleIdElement, otherT.ListRuleIdElement)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_ContextTypeElement, otherT._ContextTypeElement)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.ListEquals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "contextType": - value = ContextTypeElement; - return ContextTypeElement is not null; + value = _ContextTypeElement; + return _ContextTypeElement is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement?.Any() == true; + value = _ListModeElement; + return _ListModeElement?.Any() == true; case "listRuleId": - value = ListRuleIdElement; - return ListRuleIdElement is not null; + value = _ListRuleIdElement; + return _ListRuleIdElement is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.Id)value; + ContextElement = (Hl7.Fhir.Model.Id?)value; return this; case "contextType": - ContextTypeElement = (Code)value; + ContextTypeElement = (Code?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "listMode": - ListModeElement = (List>)value; + ListModeElement = (List>?)value!; return this; case "listRuleId": - ListRuleIdElement = (Hl7.Fhir.Model.Id)value; + ListRuleIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "transform": - TransformElement = (Code)value; + TransformElement = (Code?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2209,14 +2098,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (ContextTypeElement is not null) yield return new KeyValuePair("contextType",ContextTypeElement); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",ListModeElement); - if (ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",ListRuleIdElement); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_ContextTypeElement is not null) yield return new KeyValuePair("contextType",_ContextTypeElement); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",_ListModeElement); + if (_ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",_ListRuleIdElement); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); } } @@ -2242,25 +2131,21 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirDecimal))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2272,34 +2157,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2310,7 +2195,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -2334,28 +2219,25 @@ public partial class DependentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of a rule or group to apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -2368,24 +2250,24 @@ public string Name [DataMember] public List VariableElement { - get { if(_VariableElement==null) _VariableElement = new List(); return _VariableElement; } + get => _VariableElement ?? new List(); set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private List _VariableElement; + private List? _VariableElement; /// /// Variable to pass to the rule or group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Variable + public IEnumerable? Variable { - get { return VariableElement != null ? VariableElement.Select(elem => elem.Value) : null; } + get => _VariableElement?.Select(elem => elem.Value); set { if (value == null) - VariableElement = null; + VariableElement = null!; else VariableElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Variable"); @@ -2394,16 +2276,12 @@ public IEnumerable Variable protected internal override void CopyToInternal(Base other) { - var dest = other as DependentComponent; - - if (dest == null) - { + if(other is not DependentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(VariableElement.Any()) dest.VariableElement = new List(VariableElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = new List(_VariableElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2415,41 +2293,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependentComponent; - if(otherT == null) return false; + if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(VariableElement, otherT.VariableElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_VariableElement, otherT._VariableElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "variable": - value = VariableElement; - return VariableElement?.Any() == true; + value = _VariableElement; + return _VariableElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "variable": - VariableElement = (List)value; + VariableElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2460,8 +2338,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VariableElement?.Any() == true) yield return new KeyValuePair("variable",VariableElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VariableElement?.Any() == true) yield return new KeyValuePair("variable",_VariableElement); } } @@ -2472,28 +2350,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this structure map, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2506,39 +2381,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the structure map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2549,28 +2421,25 @@ public string Version [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this structure map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2580,28 +2449,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this structure map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2614,13 +2480,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2629,13 +2495,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2645,13 +2508,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2660,13 +2523,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2676,28 +2536,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2707,28 +2564,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2741,39 +2595,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the structure map. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2786,11 +2637,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for structure map (if applicable). @@ -2801,39 +2652,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this structure map is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this structure map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2843,28 +2691,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2877,11 +2722,11 @@ public string Copyright [DataMember] public List Structure { - get { if(_Structure==null) _Structure = new List(); return _Structure; } + get => _Structure ?? new List(); set { _Structure = value; OnPropertyChanged("Structure"); } } - private List _Structure; + private List? _Structure; /// /// Other maps used by this map (canonical URLs). @@ -2891,24 +2736,24 @@ public List Structure [DataMember] public List ImportElement { - get { if(_ImportElement==null) _ImportElement = new List(); return _ImportElement; } + get => _ImportElement ?? new List(); set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } - private List _ImportElement; + private List? _ImportElement; /// /// Other maps used by this map (canonical URLs) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Import + public IEnumerable? Import { - get { return ImportElement != null ? ImportElement.Select(elem => elem.Value) : null; } + get => _ImportElement?.Select(elem => elem.Value); set { if (value == null) - ImportElement = null; + ImportElement = null!; else ImportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Import"); @@ -2923,42 +2768,38 @@ public IEnumerable Import [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureMap; - - if (dest == null) - { + if(other is not StructureMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Structure.Any()) dest.Structure = new List(Structure.DeepCopyInternal()); - if(ImportElement.Any()) dest.ImportElement = new List(ImportElement.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Structure is not null) dest.Structure = new List(_Structure.DeepCopyInternal()); + if(_ImportElement is not null) dest.ImportElement = new List(_ImportElement.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2970,153 +2811,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureMap; - if(otherT == null) return false; + if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Structure, otherT.Structure)) return false; - if(!comparer.ListEquals(ImportElement, otherT.ImportElement)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Structure, otherT._Structure)) return false; + if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "structure": - value = Structure; - return Structure?.Any() == true; + value = _Structure; + return _Structure?.Any() == true; case "import": - value = ImportElement; - return ImportElement?.Any() == true; + value = _ImportElement; + return _ImportElement?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "structure": - Structure = (List)value; + Structure = (List?)value!; return this; case "import": - ImportElement = (List)value; + ImportElement = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3127,24 +2968,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Structure?.Any() == true) yield return new KeyValuePair("structure",Structure); - if (ImportElement?.Any() == true) yield return new KeyValuePair("import",ImportElement); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Structure?.Any() == true) yield return new KeyValuePair("structure",_Structure); + if (_ImportElement?.Any() == true) yield return new KeyValuePair("import",_ImportElement); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs index bf645f20d..cf161543e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -157,13 +160,13 @@ public partial class ChannelComponent : Hl7.Fhir.Model.BackboneElement [Binding("SubscriptionChannelType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// rest-hook | websocket | email | sms | message @@ -172,13 +175,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Subscription.SubscriptionChannelType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -188,28 +188,25 @@ public Hl7.Fhir.Model.Subscription.SubscriptionChannelType? Type /// [FhirElement("endpoint", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUrl EndpointElement + public Hl7.Fhir.Model.FhirUrl? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUrl _EndpointElement; + private Hl7.Fhir.Model.FhirUrl? _EndpointElement; /// /// Where the channel points to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUrl(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Endpoint"); } } @@ -220,28 +217,25 @@ public string Endpoint [FhirElement("payload", InSummary=true, Order=60)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code PayloadElement + public Hl7.Fhir.Model.Code? PayloadElement { get { return _PayloadElement; } set { _PayloadElement = value; OnPropertyChanged("PayloadElement"); } } - private Hl7.Fhir.Model.Code _PayloadElement; + private Hl7.Fhir.Model.Code? _PayloadElement; /// /// MIME type to send, or omit for no payload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Payload + public string? Payload { - get { return PayloadElement != null ? PayloadElement.Value : null; } + get => _PayloadElement?.Value; set { - if (value == null) - PayloadElement = null; - else - PayloadElement = new Hl7.Fhir.Model.Code(value); + PayloadElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Payload"); } } @@ -254,24 +248,24 @@ public string Payload [DataMember] public List HeaderElement { - get { if(_HeaderElement==null) _HeaderElement = new List(); return _HeaderElement; } + get => _HeaderElement ?? new List(); set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } - private List _HeaderElement; + private List? _HeaderElement; /// /// Usage depends on the channel type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Header + public IEnumerable? Header { - get { return HeaderElement != null ? HeaderElement.Select(elem => elem.Value) : null; } + get => _HeaderElement?.Select(elem => elem.Value); set { if (value == null) - HeaderElement = null; + HeaderElement = null!; else HeaderElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Header"); @@ -280,18 +274,14 @@ public IEnumerable Header protected internal override void CopyToInternal(Base other) { - var dest = other as ChannelComponent; - - if (dest == null) - { + if(other is not ChannelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopyInternal(); - if(PayloadElement != null) dest.PayloadElement = (Hl7.Fhir.Model.Code)PayloadElement.DeepCopyInternal(); - if(HeaderElement.Any()) dest.HeaderElement = new List(HeaderElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)_EndpointElement.DeepCopyInternal(); + if(_PayloadElement is not null) dest.PayloadElement = (Hl7.Fhir.Model.Code)_PayloadElement.DeepCopyInternal(); + if(_HeaderElement is not null) dest.HeaderElement = new List(_HeaderElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -303,55 +293,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChannelComponent; - if(otherT == null) return false; + if(other is not ChannelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; - if(!comparer.Equals(PayloadElement, otherT.PayloadElement)) return false; - if(!comparer.ListEquals(HeaderElement, otherT.HeaderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; + if(!comparer.Equals(_PayloadElement, otherT._PayloadElement)) return false; + if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; case "payload": - value = PayloadElement; - return PayloadElement is not null; + value = _PayloadElement; + return _PayloadElement is not null; case "header": - value = HeaderElement; - return HeaderElement?.Any() == true; + value = _HeaderElement; + return _HeaderElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUrl)value; + EndpointElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "payload": - PayloadElement = (Hl7.Fhir.Model.Code)value; + PayloadElement = (Hl7.Fhir.Model.Code?)value; return this; case "header": - HeaderElement = (List)value; + HeaderElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -362,10 +352,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); - if (PayloadElement is not null) yield return new KeyValuePair("payload",PayloadElement); - if (HeaderElement?.Any() == true) yield return new KeyValuePair("header",HeaderElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); + if (_PayloadElement is not null) yield return new KeyValuePair("payload",_PayloadElement); + if (_HeaderElement?.Any() == true) yield return new KeyValuePair("header",_HeaderElement); } } @@ -378,13 +368,13 @@ public override IEnumerable> EnumerateElements() [Binding("SubscriptionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// requested | active | error | off @@ -393,13 +383,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Subscription.SubscriptionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -412,24 +399,24 @@ public Hl7.Fhir.Model.Subscription.SubscriptionStatus? Status [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// When to automatically delete the subscription. /// [FhirElement("end", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When to automatically delete the subscription @@ -438,13 +425,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -455,28 +439,25 @@ public DateTimeOffset? End [FhirElement("reason", InSummary=true, Order=120, FiveWs="FiveWs.why[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ReasonElement + public Hl7.Fhir.Model.FhirString? ReasonElement { get { return _ReasonElement; } set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private Hl7.Fhir.Model.FhirString _ReasonElement; + private Hl7.Fhir.Model.FhirString? _ReasonElement; /// /// Description of why this subscription was created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reason + public string? Reason { - get { return ReasonElement != null ? ReasonElement.Value : null; } + get => _ReasonElement?.Value; set { - if (value == null) - ReasonElement = null; - else - ReasonElement = new Hl7.Fhir.Model.FhirString(value); + ReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Reason"); } } @@ -487,28 +468,25 @@ public string Reason [FhirElement("criteria", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString CriteriaElement + public Hl7.Fhir.Model.FhirString? CriteriaElement { get { return _CriteriaElement; } set { _CriteriaElement = value; OnPropertyChanged("CriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _CriteriaElement; + private Hl7.Fhir.Model.FhirString? _CriteriaElement; /// /// Rule for server push /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Criteria + public string? Criteria { - get { return CriteriaElement != null ? CriteriaElement.Value : null; } + get => _CriteriaElement?.Value; set { - if (value == null) - CriteriaElement = null; - else - CriteriaElement = new Hl7.Fhir.Model.FhirString(value); + CriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Criteria"); } } @@ -518,28 +496,25 @@ public string Criteria /// [FhirElement("error", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ErrorElement + public Hl7.Fhir.Model.FhirString? ErrorElement { get { return _ErrorElement; } set { _ErrorElement = value; OnPropertyChanged("ErrorElement"); } } - private Hl7.Fhir.Model.FhirString _ErrorElement; + private Hl7.Fhir.Model.FhirString? _ErrorElement; /// /// Latest error note /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Error + public string? Error { - get { return ErrorElement != null ? ErrorElement.Value : null; } + get => _ErrorElement?.Value; set { - if (value == null) - ErrorElement = null; - else - ErrorElement = new Hl7.Fhir.Model.FhirString(value); + ErrorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Error"); } } @@ -550,31 +525,27 @@ public string Error [FhirElement("channel", InSummary=true, Order=150)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Subscription.ChannelComponent Channel + public Hl7.Fhir.Model.Subscription.ChannelComponent? Channel { get { return _Channel; } set { _Channel = value; OnPropertyChanged("Channel"); } } - private Hl7.Fhir.Model.Subscription.ChannelComponent _Channel; + private Hl7.Fhir.Model.Subscription.ChannelComponent? _Channel; protected internal override void CopyToInternal(Base other) { - var dest = other as Subscription; - - if (dest == null) - { + if(other is not Subscription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ReasonElement != null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)ReasonElement.DeepCopyInternal(); - if(CriteriaElement != null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)CriteriaElement.DeepCopyInternal(); - if(ErrorElement != null) dest.ErrorElement = (Hl7.Fhir.Model.FhirString)ErrorElement.DeepCopyInternal(); - if(Channel != null) dest.Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)Channel.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ReasonElement is not null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)_ReasonElement.DeepCopyInternal(); + if(_CriteriaElement is not null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)_CriteriaElement.DeepCopyInternal(); + if(_ErrorElement is not null) dest.ErrorElement = (Hl7.Fhir.Model.FhirString)_ErrorElement.DeepCopyInternal(); + if(_Channel is not null) dest.Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)_Channel.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -586,76 +557,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Subscription; - if(otherT == null) return false; + if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ReasonElement, otherT.ReasonElement)) return false; - if(!comparer.Equals(CriteriaElement, otherT.CriteriaElement)) return false; - if(!comparer.Equals(ErrorElement, otherT.ErrorElement)) return false; - if(!comparer.Equals(Channel, otherT.Channel)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; + if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; + if(!comparer.Equals(_ErrorElement, otherT._ErrorElement)) return false; + if(!comparer.Equals(_Channel, otherT._Channel)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "reason": - value = ReasonElement; - return ReasonElement is not null; + value = _ReasonElement; + return _ReasonElement is not null; case "criteria": - value = CriteriaElement; - return CriteriaElement is not null; + value = _CriteriaElement; + return _CriteriaElement is not null; case "error": - value = ErrorElement; - return ErrorElement is not null; + value = _ErrorElement; + return _ErrorElement is not null; case "channel": - value = Channel; - return Channel is not null; + value = _Channel; + return _Channel is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "reason": - ReasonElement = (Hl7.Fhir.Model.FhirString)value; + ReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - CriteriaElement = (Hl7.Fhir.Model.FhirString)value; + CriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "error": - ErrorElement = (Hl7.Fhir.Model.FhirString)value; + ErrorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "channel": - Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)value; + Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent?)value; return this; default: return base.SetValue(key, value); @@ -666,13 +637,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ReasonElement is not null) yield return new KeyValuePair("reason",ReasonElement); - if (CriteriaElement is not null) yield return new KeyValuePair("criteria",CriteriaElement); - if (ErrorElement is not null) yield return new KeyValuePair("error",ErrorElement); - if (Channel is not null) yield return new KeyValuePair("channel",Channel); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ReasonElement is not null) yield return new KeyValuePair("reason",_ReasonElement); + if (_CriteriaElement is not null) yield return new KeyValuePair("criteria",_CriteriaElement); + if (_ErrorElement is not null) yield return new KeyValuePair("error",_ErrorElement); + if (_Channel is not null) yield return new KeyValuePair("channel",_Channel); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Substance.cs b/src/Hl7.Fhir.R4/Model/Generated/Substance.cs index e4cba8e2c..32414b5ea 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Substance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Substance","http://hl7.org/fhir/StructureDefinition/Substance")] - public partial class Substance : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Substance : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -105,41 +108,38 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// When no longer valid to use. /// [FhirElement("expiry", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpiryElement + public Hl7.Fhir.Model.FhirDateTime? ExpiryElement { get { return _ExpiryElement; } set { _ExpiryElement = value; OnPropertyChanged("ExpiryElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpiryElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpiryElement; /// /// When no longer valid to use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expiry + public string? Expiry { - get { return ExpiryElement != null ? ExpiryElement.Value : null; } + get => _ExpiryElement?.Value; set { - if (value == null) - ExpiryElement = null; - else - ExpiryElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpiryElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Expiry"); } } @@ -149,27 +149,23 @@ public string Expiry /// [FhirElement("quantity", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(ExpiryElement != null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)ExpiryElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_ExpiryElement is not null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)_ExpiryElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -181,48 +177,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ExpiryElement, otherT.ExpiryElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "expiry": - value = ExpiryElement; - return ExpiryElement is not null; + value = _ExpiryElement; + return _ExpiryElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "expiry": - ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpiryElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -233,9 +229,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (ExpiryElement is not null) yield return new KeyValuePair("expiry",ExpiryElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_ExpiryElement is not null) yield return new KeyValuePair("expiry",_ExpiryElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -261,13 +257,13 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Ratio Quantity + public Hl7.Fhir.Model.Ratio? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Ratio _Quantity; + private Hl7.Fhir.Model.Ratio? _Quantity; /// /// A component of the substance. @@ -279,26 +275,22 @@ public Hl7.Fhir.Model.Ratio Quantity [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Substance + public Hl7.Fhir.Model.DataType? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.DataType _Substance; + private Hl7.Fhir.Model.DataType? _Substance; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Ratio)Quantity.DeepCopyInternal(); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.DataType)Substance.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Ratio)_Quantity.DeepCopyInternal(); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.DataType)_Substance.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -310,41 +302,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Substance, otherT._Substance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Ratio)value; + Quantity = (Hl7.Fhir.Model.Ratio?)value; return this; case "substance": - Substance = (Hl7.Fhir.Model.DataType)value; + Substance = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -355,8 +347,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Substance is not null) yield return new KeyValuePair("substance",Substance); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); } } @@ -369,11 +361,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -382,13 +374,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("FHIRSubstanceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -397,13 +389,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -417,11 +406,11 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What substance this is. @@ -430,41 +419,38 @@ public List Category [Binding("SubstanceCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Textual description of the substance, comments. /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the substance, comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -477,11 +463,11 @@ public string Description [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Composition information about the substance. @@ -491,34 +477,30 @@ public List Instance [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Substance; - - if (dest == null) - { + if(other is not Substance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -530,76 +512,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Substance; - if(otherT == null) return false; + if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -610,13 +592,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs index d290c374a..b2feb2a7f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,39 +77,35 @@ public partial class ReferenceRangeComponent : Hl7.Fhir.Model.Element /// [FhirElement("lowLimit", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity LowLimit + public Hl7.Fhir.Model.Quantity? LowLimit { get { return _LowLimit; } set { _LowLimit = value; OnPropertyChanged("LowLimit"); } } - private Hl7.Fhir.Model.Quantity _LowLimit; + private Hl7.Fhir.Model.Quantity? _LowLimit; /// /// Upper limit possible or expected. /// [FhirElement("highLimit", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity HighLimit + public Hl7.Fhir.Model.Quantity? HighLimit { get { return _HighLimit; } set { _HighLimit = value; OnPropertyChanged("HighLimit"); } } - private Hl7.Fhir.Model.Quantity _HighLimit; + private Hl7.Fhir.Model.Quantity? _HighLimit; protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceRangeComponent; - - if (dest == null) - { + if(other is not ReferenceRangeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LowLimit != null) dest.LowLimit = (Hl7.Fhir.Model.Quantity)LowLimit.DeepCopyInternal(); - if(HighLimit != null) dest.HighLimit = (Hl7.Fhir.Model.Quantity)HighLimit.DeepCopyInternal(); + if(_LowLimit is not null) dest.LowLimit = (Hl7.Fhir.Model.Quantity)_LowLimit.DeepCopyInternal(); + if(_HighLimit is not null) dest.HighLimit = (Hl7.Fhir.Model.Quantity)_HighLimit.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -118,41 +117,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceRangeComponent; - if(otherT == null) return false; + if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LowLimit, otherT.LowLimit)) return false; - if(!comparer.Equals(HighLimit, otherT.HighLimit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LowLimit, otherT._LowLimit)) return false; + if(!comparer.Equals(_HighLimit, otherT._HighLimit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lowLimit": - value = LowLimit; - return LowLimit is not null; + value = _LowLimit; + return _LowLimit is not null; case "highLimit": - value = HighLimit; - return HighLimit is not null; + value = _HighLimit; + return _HighLimit is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lowLimit": - LowLimit = (Hl7.Fhir.Model.Quantity)value; + LowLimit = (Hl7.Fhir.Model.Quantity?)value; return this; case "highLimit": - HighLimit = (Hl7.Fhir.Model.Quantity)value; + HighLimit = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -163,8 +162,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LowLimit is not null) yield return new KeyValuePair("lowLimit",LowLimit); - if (HighLimit is not null) yield return new KeyValuePair("highLimit",HighLimit); + if (_LowLimit is not null) yield return new KeyValuePair("lowLimit",_LowLimit); + if (_HighLimit is not null) yield return new KeyValuePair("highLimit",_HighLimit); } } @@ -176,54 +175,51 @@ public override IEnumerable> EnumerateElements() [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements. /// [FhirElement("amountType", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AmountType + public Hl7.Fhir.Model.CodeableConcept? AmountType { get { return _AmountType; } set { _AmountType = value; OnPropertyChanged("AmountType"); } } - private Hl7.Fhir.Model.CodeableConcept _AmountType; + private Hl7.Fhir.Model.CodeableConcept? _AmountType; /// /// A textual comment on a numeric value. /// [FhirElement("amountText", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString AmountTextElement + public Hl7.Fhir.Model.FhirString? AmountTextElement { get { return _AmountTextElement; } set { _AmountTextElement = value; OnPropertyChanged("AmountTextElement"); } } - private Hl7.Fhir.Model.FhirString _AmountTextElement; + private Hl7.Fhir.Model.FhirString? _AmountTextElement; /// /// A textual comment on a numeric value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AmountText + public string? AmountText { - get { return AmountTextElement != null ? AmountTextElement.Value : null; } + get => _AmountTextElement?.Value; set { - if (value == null) - AmountTextElement = null; - else - AmountTextElement = new Hl7.Fhir.Model.FhirString(value); + AmountTextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AmountText"); } } @@ -233,28 +229,24 @@ public string AmountText /// [FhirElement("referenceRange", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent ReferenceRange + public Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent? ReferenceRange { get { return _ReferenceRange; } set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent _ReferenceRange; + private Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent? _ReferenceRange; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceAmount; - - if (dest == null) - { + if(other is not SubstanceAmount dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(AmountType != null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)AmountType.DeepCopyInternal(); - if(AmountTextElement != null) dest.AmountTextElement = (Hl7.Fhir.Model.FhirString)AmountTextElement.DeepCopyInternal(); - if(ReferenceRange != null) dest.ReferenceRange = (Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent)ReferenceRange.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_AmountType is not null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)_AmountType.DeepCopyInternal(); + if(_AmountTextElement is not null) dest.AmountTextElement = (Hl7.Fhir.Model.FhirString)_AmountTextElement.DeepCopyInternal(); + if(_ReferenceRange is not null) dest.ReferenceRange = (Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent)_ReferenceRange.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -266,55 +258,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceAmount; - if(otherT == null) return false; + if(other is not SubstanceAmount otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(AmountType, otherT.AmountType)) return false; - if(!comparer.Equals(AmountTextElement, otherT.AmountTextElement)) return false; - if(!comparer.Equals(ReferenceRange, otherT.ReferenceRange)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; + if(!comparer.Equals(_AmountTextElement, otherT._AmountTextElement)) return false; + if(!comparer.Equals(_ReferenceRange, otherT._ReferenceRange)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "amountType": - value = AmountType; - return AmountType is not null; + value = _AmountType; + return _AmountType is not null; case "amountText": - value = AmountTextElement; - return AmountTextElement is not null; + value = _AmountTextElement; + return _AmountTextElement is not null; case "referenceRange": - value = ReferenceRange; - return ReferenceRange is not null; + value = _ReferenceRange; + return _ReferenceRange is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "amountType": - AmountType = (Hl7.Fhir.Model.CodeableConcept)value; + AmountType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amountText": - AmountTextElement = (Hl7.Fhir.Model.FhirString)value; + AmountTextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "referenceRange": - ReferenceRange = (Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent)value; + ReferenceRange = (Hl7.Fhir.Model.SubstanceAmount.ReferenceRangeComponent?)value; return this; default: return base.SetValue(key, value); @@ -325,10 +317,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (AmountType is not null) yield return new KeyValuePair("amountType",AmountType); - if (AmountTextElement is not null) yield return new KeyValuePair("amountText",AmountTextElement); - if (ReferenceRange is not null) yield return new KeyValuePair("referenceRange",ReferenceRange); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_AmountType is not null) yield return new KeyValuePair("amountType",_AmountType); + if (_AmountTextElement is not null) yield return new KeyValuePair("amountText",_AmountTextElement); + if (_ReferenceRange is not null) yield return new KeyValuePair("referenceRange",_ReferenceRange); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs index 23bb15e24..8b82e61aa 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,13 +77,13 @@ public partial class SubunitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("subunit", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SubunitElement + public Hl7.Fhir.Model.Integer? SubunitElement { get { return _SubunitElement; } set { _SubunitElement = value; OnPropertyChanged("SubunitElement"); } } - private Hl7.Fhir.Model.Integer _SubunitElement; + private Hl7.Fhir.Model.Integer? _SubunitElement; /// /// Index of linear sequences of nucleic acids in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts @@ -89,13 +92,10 @@ public Hl7.Fhir.Model.Integer SubunitElement [IgnoreDataMember] public int? Subunit { - get { return SubunitElement != null ? SubunitElement.Value : null; } + get => _SubunitElement?.Value; set { - if (value == null) - SubunitElement = null; - else - SubunitElement = new Hl7.Fhir.Model.Integer(value); + SubunitElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Subunit"); } } @@ -105,28 +105,25 @@ public int? Subunit /// [FhirElement("sequence", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SequenceElement + public Hl7.Fhir.Model.FhirString? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.FhirString _SequenceElement; + private Hl7.Fhir.Model.FhirString? _SequenceElement; /// /// Actual nucleotide sequence notation from 5' to 3' end using standard single letter codes. In addition to the base sequence, sugar and type of phosphate or non-phosphate linkage should also be captured /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sequence + public string? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.FhirString(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Sequence"); } } @@ -136,13 +133,13 @@ public string Sequence /// [FhirElement("length", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer LengthElement + public Hl7.Fhir.Model.Integer? LengthElement { get { return _LengthElement; } set { _LengthElement = value; OnPropertyChanged("LengthElement"); } } - private Hl7.Fhir.Model.Integer _LengthElement; + private Hl7.Fhir.Model.Integer? _LengthElement; /// /// The length of the sequence shall be captured @@ -151,13 +148,10 @@ public Hl7.Fhir.Model.Integer LengthElement [IgnoreDataMember] public int? Length { - get { return LengthElement != null ? LengthElement.Value : null; } + get => _LengthElement?.Value; set { - if (value == null) - LengthElement = null; - else - LengthElement = new Hl7.Fhir.Model.Integer(value); + LengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Length"); } } @@ -167,39 +161,39 @@ public int? Length /// [FhirElement("sequenceAttachment", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Attachment SequenceAttachment + public Hl7.Fhir.Model.Attachment? SequenceAttachment { get { return _SequenceAttachment; } set { _SequenceAttachment = value; OnPropertyChanged("SequenceAttachment"); } } - private Hl7.Fhir.Model.Attachment _SequenceAttachment; + private Hl7.Fhir.Model.Attachment? _SequenceAttachment; /// /// The nucleotide present at the 5’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the first position in the sequence. A separate representation would be redundant. /// [FhirElement("fivePrime", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FivePrime + public Hl7.Fhir.Model.CodeableConcept? FivePrime { get { return _FivePrime; } set { _FivePrime = value; OnPropertyChanged("FivePrime"); } } - private Hl7.Fhir.Model.CodeableConcept _FivePrime; + private Hl7.Fhir.Model.CodeableConcept? _FivePrime; /// /// The nucleotide present at the 3’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the last position in the sequence. A separate representation would be redundant. /// [FhirElement("threePrime", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ThreePrime + public Hl7.Fhir.Model.CodeableConcept? ThreePrime { get { return _ThreePrime; } set { _ThreePrime = value; OnPropertyChanged("ThreePrime"); } } - private Hl7.Fhir.Model.CodeableConcept _ThreePrime; + private Hl7.Fhir.Model.CodeableConcept? _ThreePrime; /// /// The linkages between sugar residues will also be captured. @@ -209,11 +203,11 @@ public Hl7.Fhir.Model.CodeableConcept ThreePrime [DataMember] public List Linkage { - get { if(_Linkage==null) _Linkage = new List(); return _Linkage; } + get => _Linkage ?? new List(); set { _Linkage = value; OnPropertyChanged("Linkage"); } } - private List _Linkage; + private List? _Linkage; /// /// 5.3.6.8.1 Sugar ID (Mandatory). @@ -223,30 +217,26 @@ public List Linkage [DataMember] public List Sugar { - get { if(_Sugar==null) _Sugar = new List(); return _Sugar; } + get => _Sugar ?? new List(); set { _Sugar = value; OnPropertyChanged("Sugar"); } } - private List _Sugar; + private List? _Sugar; protected internal override void CopyToInternal(Base other) { - var dest = other as SubunitComponent; - - if (dest == null) - { + if(other is not SubunitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubunitElement != null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)SubunitElement.DeepCopyInternal(); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)SequenceElement.DeepCopyInternal(); - if(LengthElement != null) dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopyInternal(); - if(SequenceAttachment != null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)SequenceAttachment.DeepCopyInternal(); - if(FivePrime != null) dest.FivePrime = (Hl7.Fhir.Model.CodeableConcept)FivePrime.DeepCopyInternal(); - if(ThreePrime != null) dest.ThreePrime = (Hl7.Fhir.Model.CodeableConcept)ThreePrime.DeepCopyInternal(); - if(Linkage.Any()) dest.Linkage = new List(Linkage.DeepCopyInternal()); - if(Sugar.Any()) dest.Sugar = new List(Sugar.DeepCopyInternal()); + if(_SubunitElement is not null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)_SubunitElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)_SequenceElement.DeepCopyInternal(); + if(_LengthElement is not null) dest.LengthElement = (Hl7.Fhir.Model.Integer)_LengthElement.DeepCopyInternal(); + if(_SequenceAttachment is not null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)_SequenceAttachment.DeepCopyInternal(); + if(_FivePrime is not null) dest.FivePrime = (Hl7.Fhir.Model.CodeableConcept)_FivePrime.DeepCopyInternal(); + if(_ThreePrime is not null) dest.ThreePrime = (Hl7.Fhir.Model.CodeableConcept)_ThreePrime.DeepCopyInternal(); + if(_Linkage is not null) dest.Linkage = new List(_Linkage.DeepCopyInternal()); + if(_Sugar is not null) dest.Sugar = new List(_Sugar.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -258,83 +248,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubunitComponent; - if(otherT == null) return false; + if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubunitElement, otherT.SubunitElement)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(LengthElement, otherT.LengthElement)) return false; - if(!comparer.Equals(SequenceAttachment, otherT.SequenceAttachment)) return false; - if(!comparer.Equals(FivePrime, otherT.FivePrime)) return false; - if(!comparer.Equals(ThreePrime, otherT.ThreePrime)) return false; - if(!comparer.ListEquals(Linkage, otherT.Linkage)) return false; - if(!comparer.ListEquals(Sugar, otherT.Sugar)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; + if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; + if(!comparer.Equals(_FivePrime, otherT._FivePrime)) return false; + if(!comparer.Equals(_ThreePrime, otherT._ThreePrime)) return false; + if(!comparer.ListEquals(_Linkage, otherT._Linkage)) return false; + if(!comparer.ListEquals(_Sugar, otherT._Sugar)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subunit": - value = SubunitElement; - return SubunitElement is not null; + value = _SubunitElement; + return _SubunitElement is not null; case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "length": - value = LengthElement; - return LengthElement is not null; + value = _LengthElement; + return _LengthElement is not null; case "sequenceAttachment": - value = SequenceAttachment; - return SequenceAttachment is not null; + value = _SequenceAttachment; + return _SequenceAttachment is not null; case "fivePrime": - value = FivePrime; - return FivePrime is not null; + value = _FivePrime; + return _FivePrime is not null; case "threePrime": - value = ThreePrime; - return ThreePrime is not null; + value = _ThreePrime; + return _ThreePrime is not null; case "linkage": - value = Linkage; - return Linkage?.Any() == true; + value = _Linkage; + return _Linkage?.Any() == true; case "sugar": - value = Sugar; - return Sugar?.Any() == true; + value = _Sugar; + return _Sugar?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subunit": - SubunitElement = (Hl7.Fhir.Model.Integer)value; + SubunitElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequence": - SequenceElement = (Hl7.Fhir.Model.FhirString)value; + SequenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "length": - LengthElement = (Hl7.Fhir.Model.Integer)value; + LengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequenceAttachment": - SequenceAttachment = (Hl7.Fhir.Model.Attachment)value; + SequenceAttachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "fivePrime": - FivePrime = (Hl7.Fhir.Model.CodeableConcept)value; + FivePrime = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "threePrime": - ThreePrime = (Hl7.Fhir.Model.CodeableConcept)value; + ThreePrime = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "linkage": - Linkage = (List)value; + Linkage = (List?)value!; return this; case "sugar": - Sugar = (List)value; + Sugar = (List?)value!; return this; default: return base.SetValue(key, value); @@ -345,14 +335,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubunitElement is not null) yield return new KeyValuePair("subunit",SubunitElement); - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (LengthElement is not null) yield return new KeyValuePair("length",LengthElement); - if (SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",SequenceAttachment); - if (FivePrime is not null) yield return new KeyValuePair("fivePrime",FivePrime); - if (ThreePrime is not null) yield return new KeyValuePair("threePrime",ThreePrime); - if (Linkage?.Any() == true) yield return new KeyValuePair("linkage",Linkage); - if (Sugar?.Any() == true) yield return new KeyValuePair("sugar",Sugar); + if (_SubunitElement is not null) yield return new KeyValuePair("subunit",_SubunitElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_LengthElement is not null) yield return new KeyValuePair("length",_LengthElement); + if (_SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",_SequenceAttachment); + if (_FivePrime is not null) yield return new KeyValuePair("fivePrime",_FivePrime); + if (_ThreePrime is not null) yield return new KeyValuePair("threePrime",_ThreePrime); + if (_Linkage?.Any() == true) yield return new KeyValuePair("linkage",_Linkage); + if (_Sugar?.Any() == true) yield return new KeyValuePair("sugar",_Sugar); } } @@ -375,28 +365,25 @@ public partial class LinkageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("connectivity", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString ConnectivityElement + public Hl7.Fhir.Model.FhirString? ConnectivityElement { get { return _ConnectivityElement; } set { _ConnectivityElement = value; OnPropertyChanged("ConnectivityElement"); } } - private Hl7.Fhir.Model.FhirString _ConnectivityElement; + private Hl7.Fhir.Model.FhirString? _ConnectivityElement; /// /// The entity that links the sugar residues together should also be captured for nearly all naturally occurring nucleic acid the linkage is a phosphate group. For many synthetic oligonucleotides phosphorothioate linkages are often seen. Linkage connectivity is assumed to be 3’-5’. If the linkage is either 3’-3’ or 5’-5’ this should be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Connectivity + public string? Connectivity { - get { return ConnectivityElement != null ? ConnectivityElement.Value : null; } + get => _ConnectivityElement?.Value; set { - if (value == null) - ConnectivityElement = null; - else - ConnectivityElement = new Hl7.Fhir.Model.FhirString(value); + ConnectivityElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Connectivity"); } } @@ -406,41 +393,38 @@ public string Connectivity /// [FhirElement("identifier", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Each linkage will be registered as a fragment and have at least one name. A single name shall be assigned to each linkage. /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Each linkage will be registered as a fragment and have at least one name. A single name shall be assigned to each linkage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -450,46 +434,39 @@ public string Name /// [FhirElement("residueSite", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ResidueSiteElement + public Hl7.Fhir.Model.FhirString? ResidueSiteElement { get { return _ResidueSiteElement; } set { _ResidueSiteElement = value; OnPropertyChanged("ResidueSiteElement"); } } - private Hl7.Fhir.Model.FhirString _ResidueSiteElement; + private Hl7.Fhir.Model.FhirString? _ResidueSiteElement; /// /// Residues shall be captured as described in 5.3.6.8.3 /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResidueSite + public string? ResidueSite { - get { return ResidueSiteElement != null ? ResidueSiteElement.Value : null; } + get => _ResidueSiteElement?.Value; set { - if (value == null) - ResidueSiteElement = null; - else - ResidueSiteElement = new Hl7.Fhir.Model.FhirString(value); + ResidueSiteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResidueSite"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkageComponent; - - if (dest == null) - { + if(other is not LinkageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ConnectivityElement != null) dest.ConnectivityElement = (Hl7.Fhir.Model.FhirString)ConnectivityElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ResidueSiteElement != null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)ResidueSiteElement.DeepCopyInternal(); + if(_ConnectivityElement is not null) dest.ConnectivityElement = (Hl7.Fhir.Model.FhirString)_ConnectivityElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ResidueSiteElement is not null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)_ResidueSiteElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -501,55 +478,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkageComponent; - if(otherT == null) return false; + if(other is not LinkageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ConnectivityElement, otherT.ConnectivityElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ResidueSiteElement, otherT.ResidueSiteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ConnectivityElement, otherT._ConnectivityElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "connectivity": - value = ConnectivityElement; - return ConnectivityElement is not null; + value = _ConnectivityElement; + return _ConnectivityElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "residueSite": - value = ResidueSiteElement; - return ResidueSiteElement is not null; + value = _ResidueSiteElement; + return _ResidueSiteElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "connectivity": - ConnectivityElement = (Hl7.Fhir.Model.FhirString)value; + ConnectivityElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "residueSite": - ResidueSiteElement = (Hl7.Fhir.Model.FhirString)value; + ResidueSiteElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -560,10 +537,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ConnectivityElement is not null) yield return new KeyValuePair("connectivity",ConnectivityElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",ResidueSiteElement); + if (_ConnectivityElement is not null) yield return new KeyValuePair("connectivity",_ConnectivityElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",_ResidueSiteElement); } } @@ -586,41 +563,38 @@ public partial class SugarComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// The name of the sugar or sugar-like component that make up the nucleotide. /// [FhirElement("name", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name of the sugar or sugar-like component that make up the nucleotide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -630,45 +604,38 @@ public string Name /// [FhirElement("residueSite", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ResidueSiteElement + public Hl7.Fhir.Model.FhirString? ResidueSiteElement { get { return _ResidueSiteElement; } set { _ResidueSiteElement = value; OnPropertyChanged("ResidueSiteElement"); } } - private Hl7.Fhir.Model.FhirString _ResidueSiteElement; + private Hl7.Fhir.Model.FhirString? _ResidueSiteElement; /// /// The residues that contain a given sugar will be captured. The order of given residues will be captured in the 5‘-3‘direction consistent with the base sequences listed above /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResidueSite + public string? ResidueSite { - get { return ResidueSiteElement != null ? ResidueSiteElement.Value : null; } + get => _ResidueSiteElement?.Value; set { - if (value == null) - ResidueSiteElement = null; - else - ResidueSiteElement = new Hl7.Fhir.Model.FhirString(value); + ResidueSiteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResidueSite"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SugarComponent; - - if (dest == null) - { + if(other is not SugarComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ResidueSiteElement != null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)ResidueSiteElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ResidueSiteElement is not null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)_ResidueSiteElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -680,48 +647,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SugarComponent; - if(otherT == null) return false; + if(other is not SugarComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ResidueSiteElement, otherT.ResidueSiteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "residueSite": - value = ResidueSiteElement; - return ResidueSiteElement is not null; + value = _ResidueSiteElement; + return _ResidueSiteElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "residueSite": - ResidueSiteElement = (Hl7.Fhir.Model.FhirString)value; + ResidueSiteElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -732,9 +699,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",ResidueSiteElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",_ResidueSiteElement); } } @@ -744,26 +711,26 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sequenceType", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SequenceType + public Hl7.Fhir.Model.CodeableConcept? SequenceType { get { return _SequenceType; } set { _SequenceType = value; OnPropertyChanged("SequenceType"); } } - private Hl7.Fhir.Model.CodeableConcept _SequenceType; + private Hl7.Fhir.Model.CodeableConcept? _SequenceType; /// /// The number of linear sequences of nucleotides linked through phosphodiester bonds shall be described. Subunits would be strands of nucleic acids that are tightly associated typically through Watson-Crick base pairing. NOTE: If not specified in the reference source, the assumption is that there is 1 subunit. /// [FhirElement("numberOfSubunits", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfSubunitsElement + public Hl7.Fhir.Model.Integer? NumberOfSubunitsElement { get { return _NumberOfSubunitsElement; } set { _NumberOfSubunitsElement = value; OnPropertyChanged("NumberOfSubunitsElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfSubunitsElement; + private Hl7.Fhir.Model.Integer? _NumberOfSubunitsElement; /// /// The number of linear sequences of nucleotides linked through phosphodiester bonds shall be described. Subunits would be strands of nucleic acids that are tightly associated typically through Watson-Crick base pairing. NOTE: If not specified in the reference source, the assumption is that there is 1 subunit @@ -772,13 +739,10 @@ public Hl7.Fhir.Model.Integer NumberOfSubunitsElement [IgnoreDataMember] public int? NumberOfSubunits { - get { return NumberOfSubunitsElement != null ? NumberOfSubunitsElement.Value : null; } + get => _NumberOfSubunitsElement?.Value; set { - if (value == null) - NumberOfSubunitsElement = null; - else - NumberOfSubunitsElement = new Hl7.Fhir.Model.Integer(value); + NumberOfSubunitsElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfSubunits"); } } @@ -788,28 +752,25 @@ public int? NumberOfSubunits /// [FhirElement("areaOfHybridisation", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString AreaOfHybridisationElement + public Hl7.Fhir.Model.FhirString? AreaOfHybridisationElement { get { return _AreaOfHybridisationElement; } set { _AreaOfHybridisationElement = value; OnPropertyChanged("AreaOfHybridisationElement"); } } - private Hl7.Fhir.Model.FhirString _AreaOfHybridisationElement; + private Hl7.Fhir.Model.FhirString? _AreaOfHybridisationElement; /// /// The area of hybridisation shall be described if applicable for double stranded RNA or DNA. The number associated with the subunit followed by the number associated to the residue shall be specified in increasing order. The underscore “” shall be used as separator as follows: “Subunitnumber Residue” /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AreaOfHybridisation + public string? AreaOfHybridisation { - get { return AreaOfHybridisationElement != null ? AreaOfHybridisationElement.Value : null; } + get => _AreaOfHybridisationElement?.Value; set { - if (value == null) - AreaOfHybridisationElement = null; - else - AreaOfHybridisationElement = new Hl7.Fhir.Model.FhirString(value); + AreaOfHybridisationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AreaOfHybridisation"); } } @@ -819,13 +780,13 @@ public string AreaOfHybridisation /// [FhirElement("oligoNucleotideType", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OligoNucleotideType + public Hl7.Fhir.Model.CodeableConcept? OligoNucleotideType { get { return _OligoNucleotideType; } set { _OligoNucleotideType = value; OnPropertyChanged("OligoNucleotideType"); } } - private Hl7.Fhir.Model.CodeableConcept _OligoNucleotideType; + private Hl7.Fhir.Model.CodeableConcept? _OligoNucleotideType; /// /// Subunits are listed in order of decreasing length; sequences of the same length will be ordered by molecular weight; subunits that have identical sequences will be repeated multiple times. @@ -835,27 +796,23 @@ public Hl7.Fhir.Model.CodeableConcept OligoNucleotideType [DataMember] public List Subunit { - get { if(_Subunit==null) _Subunit = new List(); return _Subunit; } + get => _Subunit ?? new List(); set { _Subunit = value; OnPropertyChanged("Subunit"); } } - private List _Subunit; + private List? _Subunit; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceNucleicAcid; - - if (dest == null) - { + if(other is not SubstanceNucleicAcid dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceType != null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)SequenceType.DeepCopyInternal(); - if(NumberOfSubunitsElement != null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)NumberOfSubunitsElement.DeepCopyInternal(); - if(AreaOfHybridisationElement != null) dest.AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString)AreaOfHybridisationElement.DeepCopyInternal(); - if(OligoNucleotideType != null) dest.OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept)OligoNucleotideType.DeepCopyInternal(); - if(Subunit.Any()) dest.Subunit = new List(Subunit.DeepCopyInternal()); + if(_SequenceType is not null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)_SequenceType.DeepCopyInternal(); + if(_NumberOfSubunitsElement is not null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)_NumberOfSubunitsElement.DeepCopyInternal(); + if(_AreaOfHybridisationElement is not null) dest.AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString)_AreaOfHybridisationElement.DeepCopyInternal(); + if(_OligoNucleotideType is not null) dest.OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept)_OligoNucleotideType.DeepCopyInternal(); + if(_Subunit is not null) dest.Subunit = new List(_Subunit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -867,62 +824,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceNucleicAcid; - if(otherT == null) return false; + if(other is not SubstanceNucleicAcid otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceType, otherT.SequenceType)) return false; - if(!comparer.Equals(NumberOfSubunitsElement, otherT.NumberOfSubunitsElement)) return false; - if(!comparer.Equals(AreaOfHybridisationElement, otherT.AreaOfHybridisationElement)) return false; - if(!comparer.Equals(OligoNucleotideType, otherT.OligoNucleotideType)) return false; - if(!comparer.ListEquals(Subunit, otherT.Subunit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; + if(!comparer.Equals(_AreaOfHybridisationElement, otherT._AreaOfHybridisationElement)) return false; + if(!comparer.Equals(_OligoNucleotideType, otherT._OligoNucleotideType)) return false; + if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceType": - value = SequenceType; - return SequenceType is not null; + value = _SequenceType; + return _SequenceType is not null; case "numberOfSubunits": - value = NumberOfSubunitsElement; - return NumberOfSubunitsElement is not null; + value = _NumberOfSubunitsElement; + return _NumberOfSubunitsElement is not null; case "areaOfHybridisation": - value = AreaOfHybridisationElement; - return AreaOfHybridisationElement is not null; + value = _AreaOfHybridisationElement; + return _AreaOfHybridisationElement is not null; case "oligoNucleotideType": - value = OligoNucleotideType; - return OligoNucleotideType is not null; + value = _OligoNucleotideType; + return _OligoNucleotideType is not null; case "subunit": - value = Subunit; - return Subunit?.Any() == true; + value = _Subunit; + return _Subunit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceType": - SequenceType = (Hl7.Fhir.Model.CodeableConcept)value; + SequenceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "numberOfSubunits": - NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)value; + NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer?)value; return this; case "areaOfHybridisation": - AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString)value; + AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "oligoNucleotideType": - OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept)value; + OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subunit": - Subunit = (List)value; + Subunit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -933,11 +890,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceType is not null) yield return new KeyValuePair("sequenceType",SequenceType); - if (NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",NumberOfSubunitsElement); - if (AreaOfHybridisationElement is not null) yield return new KeyValuePair("areaOfHybridisation",AreaOfHybridisationElement); - if (OligoNucleotideType is not null) yield return new KeyValuePair("oligoNucleotideType",OligoNucleotideType); - if (Subunit?.Any() == true) yield return new KeyValuePair("subunit",Subunit); + if (_SequenceType is not null) yield return new KeyValuePair("sequenceType",_SequenceType); + if (_NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",_NumberOfSubunitsElement); + if (_AreaOfHybridisationElement is not null) yield return new KeyValuePair("areaOfHybridisation",_AreaOfHybridisationElement); + if (_OligoNucleotideType is not null) yield return new KeyValuePair("oligoNucleotideType",_OligoNucleotideType); + if (_Subunit?.Any() == true) yield return new KeyValuePair("subunit",_Subunit); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs index 87287c7a8..8cfd93eea 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,13 +77,13 @@ public partial class MonomerSetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("ratioType", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RatioType + public Hl7.Fhir.Model.CodeableConcept? RatioType { get { return _RatioType; } set { _RatioType = value; OnPropertyChanged("RatioType"); } } - private Hl7.Fhir.Model.CodeableConcept _RatioType; + private Hl7.Fhir.Model.CodeableConcept? _RatioType; /// /// Todo. @@ -90,24 +93,20 @@ public Hl7.Fhir.Model.CodeableConcept RatioType [DataMember] public List StartingMaterial { - get { if(_StartingMaterial==null) _StartingMaterial = new List(); return _StartingMaterial; } + get => _StartingMaterial ?? new List(); set { _StartingMaterial = value; OnPropertyChanged("StartingMaterial"); } } - private List _StartingMaterial; + private List? _StartingMaterial; protected internal override void CopyToInternal(Base other) { - var dest = other as MonomerSetComponent; - - if (dest == null) - { + if(other is not MonomerSetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RatioType != null) dest.RatioType = (Hl7.Fhir.Model.CodeableConcept)RatioType.DeepCopyInternal(); - if(StartingMaterial.Any()) dest.StartingMaterial = new List(StartingMaterial.DeepCopyInternal()); + if(_RatioType is not null) dest.RatioType = (Hl7.Fhir.Model.CodeableConcept)_RatioType.DeepCopyInternal(); + if(_StartingMaterial is not null) dest.StartingMaterial = new List(_StartingMaterial.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -119,41 +118,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonomerSetComponent; - if(otherT == null) return false; + if(other is not MonomerSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RatioType, otherT.RatioType)) return false; - if(!comparer.ListEquals(StartingMaterial, otherT.StartingMaterial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RatioType, otherT._RatioType)) return false; + if(!comparer.ListEquals(_StartingMaterial, otherT._StartingMaterial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "ratioType": - value = RatioType; - return RatioType is not null; + value = _RatioType; + return _RatioType is not null; case "startingMaterial": - value = StartingMaterial; - return StartingMaterial?.Any() == true; + value = _StartingMaterial; + return _StartingMaterial?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "ratioType": - RatioType = (Hl7.Fhir.Model.CodeableConcept)value; + RatioType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "startingMaterial": - StartingMaterial = (List)value; + StartingMaterial = (List?)value!; return this; default: return base.SetValue(key, value); @@ -164,8 +163,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RatioType is not null) yield return new KeyValuePair("ratioType",RatioType); - if (StartingMaterial?.Any() == true) yield return new KeyValuePair("startingMaterial",StartingMaterial); + if (_RatioType is not null) yield return new KeyValuePair("ratioType",_RatioType); + if (_StartingMaterial?.Any() == true) yield return new KeyValuePair("startingMaterial",_StartingMaterial); } } @@ -188,39 +187,39 @@ public partial class StartingMaterialComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("material", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Material + public Hl7.Fhir.Model.CodeableConcept? Material { get { return _Material; } set { _Material = value; OnPropertyChanged("Material"); } } - private Hl7.Fhir.Model.CodeableConcept _Material; + private Hl7.Fhir.Model.CodeableConcept? _Material; /// /// Todo. /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Todo. /// [FhirElement("isDefining", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefiningElement + public Hl7.Fhir.Model.FhirBoolean? IsDefiningElement { get { return _IsDefiningElement; } set { _IsDefiningElement = value; OnPropertyChanged("IsDefiningElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefiningElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefiningElement; /// /// Todo @@ -229,13 +228,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefiningElement [IgnoreDataMember] public bool? IsDefining { - get { return IsDefiningElement != null ? IsDefiningElement.Value : null; } + get => _IsDefiningElement?.Value; set { - if (value == null) - IsDefiningElement = null; - else - IsDefiningElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefiningElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefining"); } } @@ -245,28 +241,24 @@ public bool? IsDefining /// [FhirElement("amount", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.SubstanceAmount Amount + public Hl7.Fhir.Model.SubstanceAmount? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.SubstanceAmount _Amount; + private Hl7.Fhir.Model.SubstanceAmount? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as StartingMaterialComponent; - - if (dest == null) - { + if(other is not StartingMaterialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Material != null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)Material.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(IsDefiningElement != null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)IsDefiningElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.SubstanceAmount)Amount.DeepCopyInternal(); + if(_Material is not null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)_Material.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_IsDefiningElement is not null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefiningElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.SubstanceAmount)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -278,55 +270,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StartingMaterialComponent; - if(otherT == null) return false; + if(other is not StartingMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Material, otherT.Material)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(IsDefiningElement, otherT.IsDefiningElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "material": - value = Material; - return Material is not null; + value = _Material; + return _Material is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "isDefining": - value = IsDefiningElement; - return IsDefiningElement is not null; + value = _IsDefiningElement; + return _IsDefiningElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "material": - Material = (Hl7.Fhir.Model.CodeableConcept)value; + Material = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "isDefining": - IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.SubstanceAmount)value; + Amount = (Hl7.Fhir.Model.SubstanceAmount?)value; return this; default: return base.SetValue(key, value); @@ -337,10 +329,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Material is not null) yield return new KeyValuePair("material",Material); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (IsDefiningElement is not null) yield return new KeyValuePair("isDefining",IsDefiningElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Material is not null) yield return new KeyValuePair("material",_Material); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_IsDefiningElement is not null) yield return new KeyValuePair("isDefining",_IsDefiningElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -363,13 +355,13 @@ public partial class RepeatComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("numberOfUnits", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfUnitsElement + public Hl7.Fhir.Model.Integer? NumberOfUnitsElement { get { return _NumberOfUnitsElement; } set { _NumberOfUnitsElement = value; OnPropertyChanged("NumberOfUnitsElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfUnitsElement; + private Hl7.Fhir.Model.Integer? _NumberOfUnitsElement; /// /// Todo @@ -378,13 +370,10 @@ public Hl7.Fhir.Model.Integer NumberOfUnitsElement [IgnoreDataMember] public int? NumberOfUnits { - get { return NumberOfUnitsElement != null ? NumberOfUnitsElement.Value : null; } + get => _NumberOfUnitsElement?.Value; set { - if (value == null) - NumberOfUnitsElement = null; - else - NumberOfUnitsElement = new Hl7.Fhir.Model.Integer(value); + NumberOfUnitsElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfUnits"); } } @@ -394,28 +383,25 @@ public int? NumberOfUnits /// [FhirElement("averageMolecularFormula", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString AverageMolecularFormulaElement + public Hl7.Fhir.Model.FhirString? AverageMolecularFormulaElement { get { return _AverageMolecularFormulaElement; } set { _AverageMolecularFormulaElement = value; OnPropertyChanged("AverageMolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _AverageMolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _AverageMolecularFormulaElement; /// /// Todo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AverageMolecularFormula + public string? AverageMolecularFormula { - get { return AverageMolecularFormulaElement != null ? AverageMolecularFormulaElement.Value : null; } + get => _AverageMolecularFormulaElement?.Value; set { - if (value == null) - AverageMolecularFormulaElement = null; - else - AverageMolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + AverageMolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AverageMolecularFormula"); } } @@ -425,13 +411,13 @@ public string AverageMolecularFormula /// [FhirElement("repeatUnitAmountType", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RepeatUnitAmountType + public Hl7.Fhir.Model.CodeableConcept? RepeatUnitAmountType { get { return _RepeatUnitAmountType; } set { _RepeatUnitAmountType = value; OnPropertyChanged("RepeatUnitAmountType"); } } - private Hl7.Fhir.Model.CodeableConcept _RepeatUnitAmountType; + private Hl7.Fhir.Model.CodeableConcept? _RepeatUnitAmountType; /// /// Todo. @@ -441,26 +427,22 @@ public Hl7.Fhir.Model.CodeableConcept RepeatUnitAmountType [DataMember] public List RepeatUnit { - get { if(_RepeatUnit==null) _RepeatUnit = new List(); return _RepeatUnit; } + get => _RepeatUnit ?? new List(); set { _RepeatUnit = value; OnPropertyChanged("RepeatUnit"); } } - private List _RepeatUnit; + private List? _RepeatUnit; protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatComponent; - - if (dest == null) - { + if(other is not RepeatComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberOfUnitsElement != null) dest.NumberOfUnitsElement = (Hl7.Fhir.Model.Integer)NumberOfUnitsElement.DeepCopyInternal(); - if(AverageMolecularFormulaElement != null) dest.AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString)AverageMolecularFormulaElement.DeepCopyInternal(); - if(RepeatUnitAmountType != null) dest.RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept)RepeatUnitAmountType.DeepCopyInternal(); - if(RepeatUnit.Any()) dest.RepeatUnit = new List(RepeatUnit.DeepCopyInternal()); + if(_NumberOfUnitsElement is not null) dest.NumberOfUnitsElement = (Hl7.Fhir.Model.Integer)_NumberOfUnitsElement.DeepCopyInternal(); + if(_AverageMolecularFormulaElement is not null) dest.AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_AverageMolecularFormulaElement.DeepCopyInternal(); + if(_RepeatUnitAmountType is not null) dest.RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept)_RepeatUnitAmountType.DeepCopyInternal(); + if(_RepeatUnit is not null) dest.RepeatUnit = new List(_RepeatUnit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -472,55 +454,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatComponent; - if(otherT == null) return false; + if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberOfUnitsElement, otherT.NumberOfUnitsElement)) return false; - if(!comparer.Equals(AverageMolecularFormulaElement, otherT.AverageMolecularFormulaElement)) return false; - if(!comparer.Equals(RepeatUnitAmountType, otherT.RepeatUnitAmountType)) return false; - if(!comparer.ListEquals(RepeatUnit, otherT.RepeatUnit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberOfUnitsElement, otherT._NumberOfUnitsElement)) return false; + if(!comparer.Equals(_AverageMolecularFormulaElement, otherT._AverageMolecularFormulaElement)) return false; + if(!comparer.Equals(_RepeatUnitAmountType, otherT._RepeatUnitAmountType)) return false; + if(!comparer.ListEquals(_RepeatUnit, otherT._RepeatUnit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "numberOfUnits": - value = NumberOfUnitsElement; - return NumberOfUnitsElement is not null; + value = _NumberOfUnitsElement; + return _NumberOfUnitsElement is not null; case "averageMolecularFormula": - value = AverageMolecularFormulaElement; - return AverageMolecularFormulaElement is not null; + value = _AverageMolecularFormulaElement; + return _AverageMolecularFormulaElement is not null; case "repeatUnitAmountType": - value = RepeatUnitAmountType; - return RepeatUnitAmountType is not null; + value = _RepeatUnitAmountType; + return _RepeatUnitAmountType is not null; case "repeatUnit": - value = RepeatUnit; - return RepeatUnit?.Any() == true; + value = _RepeatUnit; + return _RepeatUnit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "numberOfUnits": - NumberOfUnitsElement = (Hl7.Fhir.Model.Integer)value; + NumberOfUnitsElement = (Hl7.Fhir.Model.Integer?)value; return this; case "averageMolecularFormula": - AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "repeatUnitAmountType": - RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept)value; + RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "repeatUnit": - RepeatUnit = (List)value; + RepeatUnit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -531,10 +513,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberOfUnitsElement is not null) yield return new KeyValuePair("numberOfUnits",NumberOfUnitsElement); - if (AverageMolecularFormulaElement is not null) yield return new KeyValuePair("averageMolecularFormula",AverageMolecularFormulaElement); - if (RepeatUnitAmountType is not null) yield return new KeyValuePair("repeatUnitAmountType",RepeatUnitAmountType); - if (RepeatUnit?.Any() == true) yield return new KeyValuePair("repeatUnit",RepeatUnit); + if (_NumberOfUnitsElement is not null) yield return new KeyValuePair("numberOfUnits",_NumberOfUnitsElement); + if (_AverageMolecularFormulaElement is not null) yield return new KeyValuePair("averageMolecularFormula",_AverageMolecularFormulaElement); + if (_RepeatUnitAmountType is not null) yield return new KeyValuePair("repeatUnitAmountType",_RepeatUnitAmountType); + if (_RepeatUnit?.Any() == true) yield return new KeyValuePair("repeatUnit",_RepeatUnit); } } @@ -557,41 +539,38 @@ public partial class RepeatUnitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("orientationOfPolymerisation", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrientationOfPolymerisation + public Hl7.Fhir.Model.CodeableConcept? OrientationOfPolymerisation { get { return _OrientationOfPolymerisation; } set { _OrientationOfPolymerisation = value; OnPropertyChanged("OrientationOfPolymerisation"); } } - private Hl7.Fhir.Model.CodeableConcept _OrientationOfPolymerisation; + private Hl7.Fhir.Model.CodeableConcept? _OrientationOfPolymerisation; /// /// Todo. /// [FhirElement("repeatUnit", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RepeatUnitElement + public Hl7.Fhir.Model.FhirString? RepeatUnitElement { get { return _RepeatUnitElement; } set { _RepeatUnitElement = value; OnPropertyChanged("RepeatUnitElement"); } } - private Hl7.Fhir.Model.FhirString _RepeatUnitElement; + private Hl7.Fhir.Model.FhirString? _RepeatUnitElement; /// /// Todo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RepeatUnit + public string? RepeatUnit { - get { return RepeatUnitElement != null ? RepeatUnitElement.Value : null; } + get => _RepeatUnitElement?.Value; set { - if (value == null) - RepeatUnitElement = null; - else - RepeatUnitElement = new Hl7.Fhir.Model.FhirString(value); + RepeatUnitElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RepeatUnit"); } } @@ -601,13 +580,13 @@ public string RepeatUnit /// [FhirElement("amount", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.SubstanceAmount Amount + public Hl7.Fhir.Model.SubstanceAmount? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.SubstanceAmount _Amount; + private Hl7.Fhir.Model.SubstanceAmount? _Amount; /// /// Todo. @@ -617,11 +596,11 @@ public Hl7.Fhir.Model.SubstanceAmount Amount [DataMember] public List DegreeOfPolymerisation { - get { if(_DegreeOfPolymerisation==null) _DegreeOfPolymerisation = new List(); return _DegreeOfPolymerisation; } + get => _DegreeOfPolymerisation ?? new List(); set { _DegreeOfPolymerisation = value; OnPropertyChanged("DegreeOfPolymerisation"); } } - private List _DegreeOfPolymerisation; + private List? _DegreeOfPolymerisation; /// /// Todo. @@ -631,27 +610,23 @@ public List Deg [DataMember] public List StructuralRepresentation { - get { if(_StructuralRepresentation==null) _StructuralRepresentation = new List(); return _StructuralRepresentation; } + get => _StructuralRepresentation ?? new List(); set { _StructuralRepresentation = value; OnPropertyChanged("StructuralRepresentation"); } } - private List _StructuralRepresentation; + private List? _StructuralRepresentation; protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatUnitComponent; - - if (dest == null) - { + if(other is not RepeatUnitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(OrientationOfPolymerisation != null) dest.OrientationOfPolymerisation = (Hl7.Fhir.Model.CodeableConcept)OrientationOfPolymerisation.DeepCopyInternal(); - if(RepeatUnitElement != null) dest.RepeatUnitElement = (Hl7.Fhir.Model.FhirString)RepeatUnitElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.SubstanceAmount)Amount.DeepCopyInternal(); - if(DegreeOfPolymerisation.Any()) dest.DegreeOfPolymerisation = new List(DegreeOfPolymerisation.DeepCopyInternal()); - if(StructuralRepresentation.Any()) dest.StructuralRepresentation = new List(StructuralRepresentation.DeepCopyInternal()); + if(_OrientationOfPolymerisation is not null) dest.OrientationOfPolymerisation = (Hl7.Fhir.Model.CodeableConcept)_OrientationOfPolymerisation.DeepCopyInternal(); + if(_RepeatUnitElement is not null) dest.RepeatUnitElement = (Hl7.Fhir.Model.FhirString)_RepeatUnitElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.SubstanceAmount)_Amount.DeepCopyInternal(); + if(_DegreeOfPolymerisation is not null) dest.DegreeOfPolymerisation = new List(_DegreeOfPolymerisation.DeepCopyInternal()); + if(_StructuralRepresentation is not null) dest.StructuralRepresentation = new List(_StructuralRepresentation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -663,62 +638,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatUnitComponent; - if(otherT == null) return false; + if(other is not RepeatUnitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(OrientationOfPolymerisation, otherT.OrientationOfPolymerisation)) return false; - if(!comparer.Equals(RepeatUnitElement, otherT.RepeatUnitElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.ListEquals(DegreeOfPolymerisation, otherT.DegreeOfPolymerisation)) return false; - if(!comparer.ListEquals(StructuralRepresentation, otherT.StructuralRepresentation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_OrientationOfPolymerisation, otherT._OrientationOfPolymerisation)) return false; + if(!comparer.Equals(_RepeatUnitElement, otherT._RepeatUnitElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.ListEquals(_DegreeOfPolymerisation, otherT._DegreeOfPolymerisation)) return false; + if(!comparer.ListEquals(_StructuralRepresentation, otherT._StructuralRepresentation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "orientationOfPolymerisation": - value = OrientationOfPolymerisation; - return OrientationOfPolymerisation is not null; + value = _OrientationOfPolymerisation; + return _OrientationOfPolymerisation is not null; case "repeatUnit": - value = RepeatUnitElement; - return RepeatUnitElement is not null; + value = _RepeatUnitElement; + return _RepeatUnitElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "degreeOfPolymerisation": - value = DegreeOfPolymerisation; - return DegreeOfPolymerisation?.Any() == true; + value = _DegreeOfPolymerisation; + return _DegreeOfPolymerisation?.Any() == true; case "structuralRepresentation": - value = StructuralRepresentation; - return StructuralRepresentation?.Any() == true; + value = _StructuralRepresentation; + return _StructuralRepresentation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "orientationOfPolymerisation": - OrientationOfPolymerisation = (Hl7.Fhir.Model.CodeableConcept)value; + OrientationOfPolymerisation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "repeatUnit": - RepeatUnitElement = (Hl7.Fhir.Model.FhirString)value; + RepeatUnitElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.SubstanceAmount)value; + Amount = (Hl7.Fhir.Model.SubstanceAmount?)value; return this; case "degreeOfPolymerisation": - DegreeOfPolymerisation = (List)value; + DegreeOfPolymerisation = (List?)value!; return this; case "structuralRepresentation": - StructuralRepresentation = (List)value; + StructuralRepresentation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -729,11 +704,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (OrientationOfPolymerisation is not null) yield return new KeyValuePair("orientationOfPolymerisation",OrientationOfPolymerisation); - if (RepeatUnitElement is not null) yield return new KeyValuePair("repeatUnit",RepeatUnitElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (DegreeOfPolymerisation?.Any() == true) yield return new KeyValuePair("degreeOfPolymerisation",DegreeOfPolymerisation); - if (StructuralRepresentation?.Any() == true) yield return new KeyValuePair("structuralRepresentation",StructuralRepresentation); + if (_OrientationOfPolymerisation is not null) yield return new KeyValuePair("orientationOfPolymerisation",_OrientationOfPolymerisation); + if (_RepeatUnitElement is not null) yield return new KeyValuePair("repeatUnit",_RepeatUnitElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_DegreeOfPolymerisation?.Any() == true) yield return new KeyValuePair("degreeOfPolymerisation",_DegreeOfPolymerisation); + if (_StructuralRepresentation?.Any() == true) yield return new KeyValuePair("structuralRepresentation",_StructuralRepresentation); } } @@ -756,39 +731,35 @@ public partial class DegreeOfPolymerisationComponent : Hl7.Fhir.Model.BackboneEl /// [FhirElement("degree", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Degree + public Hl7.Fhir.Model.CodeableConcept? Degree { get { return _Degree; } set { _Degree = value; OnPropertyChanged("Degree"); } } - private Hl7.Fhir.Model.CodeableConcept _Degree; + private Hl7.Fhir.Model.CodeableConcept? _Degree; /// /// Todo. /// [FhirElement("amount", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.SubstanceAmount Amount + public Hl7.Fhir.Model.SubstanceAmount? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.SubstanceAmount _Amount; + private Hl7.Fhir.Model.SubstanceAmount? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as DegreeOfPolymerisationComponent; - - if (dest == null) - { + if(other is not DegreeOfPolymerisationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Degree != null) dest.Degree = (Hl7.Fhir.Model.CodeableConcept)Degree.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.SubstanceAmount)Amount.DeepCopyInternal(); + if(_Degree is not null) dest.Degree = (Hl7.Fhir.Model.CodeableConcept)_Degree.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.SubstanceAmount)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -800,41 +771,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DegreeOfPolymerisationComponent; - if(otherT == null) return false; + if(other is not DegreeOfPolymerisationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Degree, otherT.Degree)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Degree, otherT._Degree)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "degree": - value = Degree; - return Degree is not null; + value = _Degree; + return _Degree is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "degree": - Degree = (Hl7.Fhir.Model.CodeableConcept)value; + Degree = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.SubstanceAmount)value; + Amount = (Hl7.Fhir.Model.SubstanceAmount?)value; return this; default: return base.SetValue(key, value); @@ -845,8 +816,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Degree is not null) yield return new KeyValuePair("degree",Degree); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Degree is not null) yield return new KeyValuePair("degree",_Degree); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -869,41 +840,38 @@ public partial class StructuralRepresentationComponent : Hl7.Fhir.Model.Backbone /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Todo. /// [FhirElement("representation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RepresentationElement + public Hl7.Fhir.Model.FhirString? RepresentationElement { get { return _RepresentationElement; } set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } - private Hl7.Fhir.Model.FhirString _RepresentationElement; + private Hl7.Fhir.Model.FhirString? _RepresentationElement; /// /// Todo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Representation + public string? Representation { - get { return RepresentationElement != null ? RepresentationElement.Value : null; } + get => _RepresentationElement?.Value; set { - if (value == null) - RepresentationElement = null; - else - RepresentationElement = new Hl7.Fhir.Model.FhirString(value); + RepresentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Representation"); } } @@ -913,27 +881,23 @@ public string Representation /// [FhirElement("attachment", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Attachment Attachment + public Hl7.Fhir.Model.Attachment? Attachment { get { return _Attachment; } set { _Attachment = value; OnPropertyChanged("Attachment"); } } - private Hl7.Fhir.Model.Attachment _Attachment; + private Hl7.Fhir.Model.Attachment? _Attachment; protected internal override void CopyToInternal(Base other) { - var dest = other as StructuralRepresentationComponent; - - if (dest == null) - { + if(other is not StructuralRepresentationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RepresentationElement != null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)RepresentationElement.DeepCopyInternal(); - if(Attachment != null) dest.Attachment = (Hl7.Fhir.Model.Attachment)Attachment.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RepresentationElement is not null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)_RepresentationElement.DeepCopyInternal(); + if(_Attachment is not null) dest.Attachment = (Hl7.Fhir.Model.Attachment)_Attachment.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -945,48 +909,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructuralRepresentationComponent; - if(otherT == null) return false; + if(other is not StructuralRepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RepresentationElement, otherT.RepresentationElement)) return false; - if(!comparer.Equals(Attachment, otherT.Attachment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; + if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "representation": - value = RepresentationElement; - return RepresentationElement is not null; + value = _RepresentationElement; + return _RepresentationElement is not null; case "attachment": - value = Attachment; - return Attachment is not null; + value = _Attachment; + return _Attachment is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "representation": - RepresentationElement = (Hl7.Fhir.Model.FhirString)value; + RepresentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "attachment": - Attachment = (Hl7.Fhir.Model.Attachment)value; + Attachment = (Hl7.Fhir.Model.Attachment?)value; return this; default: return base.SetValue(key, value); @@ -997,9 +961,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RepresentationElement is not null) yield return new KeyValuePair("representation",RepresentationElement); - if (Attachment is not null) yield return new KeyValuePair("attachment",Attachment); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RepresentationElement is not null) yield return new KeyValuePair("representation",_RepresentationElement); + if (_Attachment is not null) yield return new KeyValuePair("attachment",_Attachment); } } @@ -1009,26 +973,26 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("class", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Class + public Hl7.Fhir.Model.CodeableConcept? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.CodeableConcept _Class; + private Hl7.Fhir.Model.CodeableConcept? _Class; /// /// Todo. /// [FhirElement("geometry", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Geometry + public Hl7.Fhir.Model.CodeableConcept? Geometry { get { return _Geometry; } set { _Geometry = value; OnPropertyChanged("Geometry"); } } - private Hl7.Fhir.Model.CodeableConcept _Geometry; + private Hl7.Fhir.Model.CodeableConcept? _Geometry; /// /// Todo. @@ -1038,11 +1002,11 @@ public Hl7.Fhir.Model.CodeableConcept Geometry [DataMember] public List CopolymerConnectivity { - get { if(_CopolymerConnectivity==null) _CopolymerConnectivity = new List(); return _CopolymerConnectivity; } + get => _CopolymerConnectivity ?? new List(); set { _CopolymerConnectivity = value; OnPropertyChanged("CopolymerConnectivity"); } } - private List _CopolymerConnectivity; + private List? _CopolymerConnectivity; /// /// Todo. @@ -1052,24 +1016,24 @@ public List CopolymerConnectivity [DataMember] public List ModificationElement { - get { if(_ModificationElement==null) _ModificationElement = new List(); return _ModificationElement; } + get => _ModificationElement ?? new List(); set { _ModificationElement = value; OnPropertyChanged("ModificationElement"); } } - private List _ModificationElement; + private List? _ModificationElement; /// /// Todo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Modification + public IEnumerable? Modification { - get { return ModificationElement != null ? ModificationElement.Select(elem => elem.Value) : null; } + get => _ModificationElement?.Select(elem => elem.Value); set { if (value == null) - ModificationElement = null; + ModificationElement = null!; else ModificationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Modification"); @@ -1084,11 +1048,11 @@ public IEnumerable Modification [DataMember] public List MonomerSet { - get { if(_MonomerSet==null) _MonomerSet = new List(); return _MonomerSet; } + get => _MonomerSet ?? new List(); set { _MonomerSet = value; OnPropertyChanged("MonomerSet"); } } - private List _MonomerSet; + private List? _MonomerSet; /// /// Todo. @@ -1098,28 +1062,24 @@ public List MonomerSet [DataMember] public List Repeat { - get { if(_Repeat==null) _Repeat = new List(); return _Repeat; } + get => _Repeat ?? new List(); set { _Repeat = value; OnPropertyChanged("Repeat"); } } - private List _Repeat; + private List? _Repeat; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstancePolymer; - - if (dest == null) - { + if(other is not SubstancePolymer dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Class != null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopyInternal(); - if(Geometry != null) dest.Geometry = (Hl7.Fhir.Model.CodeableConcept)Geometry.DeepCopyInternal(); - if(CopolymerConnectivity.Any()) dest.CopolymerConnectivity = new List(CopolymerConnectivity.DeepCopyInternal()); - if(ModificationElement.Any()) dest.ModificationElement = new List(ModificationElement.DeepCopyInternal()); - if(MonomerSet.Any()) dest.MonomerSet = new List(MonomerSet.DeepCopyInternal()); - if(Repeat.Any()) dest.Repeat = new List(Repeat.DeepCopyInternal()); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)_Class.DeepCopyInternal(); + if(_Geometry is not null) dest.Geometry = (Hl7.Fhir.Model.CodeableConcept)_Geometry.DeepCopyInternal(); + if(_CopolymerConnectivity is not null) dest.CopolymerConnectivity = new List(_CopolymerConnectivity.DeepCopyInternal()); + if(_ModificationElement is not null) dest.ModificationElement = new List(_ModificationElement.DeepCopyInternal()); + if(_MonomerSet is not null) dest.MonomerSet = new List(_MonomerSet.DeepCopyInternal()); + if(_Repeat is not null) dest.Repeat = new List(_Repeat.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1131,69 +1091,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstancePolymer; - if(otherT == null) return false; + if(other is not SubstancePolymer otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Geometry, otherT.Geometry)) return false; - if(!comparer.ListEquals(CopolymerConnectivity, otherT.CopolymerConnectivity)) return false; - if(!comparer.ListEquals(ModificationElement, otherT.ModificationElement)) return false; - if(!comparer.ListEquals(MonomerSet, otherT.MonomerSet)) return false; - if(!comparer.ListEquals(Repeat, otherT.Repeat)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Geometry, otherT._Geometry)) return false; + if(!comparer.ListEquals(_CopolymerConnectivity, otherT._CopolymerConnectivity)) return false; + if(!comparer.ListEquals(_ModificationElement, otherT._ModificationElement)) return false; + if(!comparer.ListEquals(_MonomerSet, otherT._MonomerSet)) return false; + if(!comparer.ListEquals(_Repeat, otherT._Repeat)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "geometry": - value = Geometry; - return Geometry is not null; + value = _Geometry; + return _Geometry is not null; case "copolymerConnectivity": - value = CopolymerConnectivity; - return CopolymerConnectivity?.Any() == true; + value = _CopolymerConnectivity; + return _CopolymerConnectivity?.Any() == true; case "modification": - value = ModificationElement; - return ModificationElement?.Any() == true; + value = _ModificationElement; + return _ModificationElement?.Any() == true; case "monomerSet": - value = MonomerSet; - return MonomerSet?.Any() == true; + value = _MonomerSet; + return _MonomerSet?.Any() == true; case "repeat": - value = Repeat; - return Repeat?.Any() == true; + value = _Repeat; + return _Repeat?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "class": - Class = (Hl7.Fhir.Model.CodeableConcept)value; + Class = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "geometry": - Geometry = (Hl7.Fhir.Model.CodeableConcept)value; + Geometry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "copolymerConnectivity": - CopolymerConnectivity = (List)value; + CopolymerConnectivity = (List?)value!; return this; case "modification": - ModificationElement = (List)value; + ModificationElement = (List?)value!; return this; case "monomerSet": - MonomerSet = (List)value; + MonomerSet = (List?)value!; return this; case "repeat": - Repeat = (List)value; + Repeat = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1204,12 +1164,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Geometry is not null) yield return new KeyValuePair("geometry",Geometry); - if (CopolymerConnectivity?.Any() == true) yield return new KeyValuePair("copolymerConnectivity",CopolymerConnectivity); - if (ModificationElement?.Any() == true) yield return new KeyValuePair("modification",ModificationElement); - if (MonomerSet?.Any() == true) yield return new KeyValuePair("monomerSet",MonomerSet); - if (Repeat?.Any() == true) yield return new KeyValuePair("repeat",Repeat); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Geometry is not null) yield return new KeyValuePair("geometry",_Geometry); + if (_CopolymerConnectivity?.Any() == true) yield return new KeyValuePair("copolymerConnectivity",_CopolymerConnectivity); + if (_ModificationElement?.Any() == true) yield return new KeyValuePair("modification",_ModificationElement); + if (_MonomerSet?.Any() == true) yield return new KeyValuePair("monomerSet",_MonomerSet); + if (_Repeat?.Any() == true) yield return new KeyValuePair("repeat",_Repeat); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs index 834b65bdf..980e68129 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,13 +77,13 @@ public partial class SubunitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("subunit", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SubunitElement + public Hl7.Fhir.Model.Integer? SubunitElement { get { return _SubunitElement; } set { _SubunitElement = value; OnPropertyChanged("SubunitElement"); } } - private Hl7.Fhir.Model.Integer _SubunitElement; + private Hl7.Fhir.Model.Integer? _SubunitElement; /// /// Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts @@ -89,13 +92,10 @@ public Hl7.Fhir.Model.Integer SubunitElement [IgnoreDataMember] public int? Subunit { - get { return SubunitElement != null ? SubunitElement.Value : null; } + get => _SubunitElement?.Value; set { - if (value == null) - SubunitElement = null; - else - SubunitElement = new Hl7.Fhir.Model.Integer(value); + SubunitElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Subunit"); } } @@ -105,28 +105,25 @@ public int? Subunit /// [FhirElement("sequence", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SequenceElement + public Hl7.Fhir.Model.FhirString? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.FhirString _SequenceElement; + private Hl7.Fhir.Model.FhirString? _SequenceElement; /// /// The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sequence + public string? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.FhirString(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Sequence"); } } @@ -136,13 +133,13 @@ public string Sequence /// [FhirElement("length", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer LengthElement + public Hl7.Fhir.Model.Integer? LengthElement { get { return _LengthElement; } set { _LengthElement = value; OnPropertyChanged("LengthElement"); } } - private Hl7.Fhir.Model.Integer _LengthElement; + private Hl7.Fhir.Model.Integer? _LengthElement; /// /// Length of linear sequences of amino acids contained in the subunit @@ -151,13 +148,10 @@ public Hl7.Fhir.Model.Integer LengthElement [IgnoreDataMember] public int? Length { - get { return LengthElement != null ? LengthElement.Value : null; } + get => _LengthElement?.Value; set { - if (value == null) - LengthElement = null; - else - LengthElement = new Hl7.Fhir.Model.Integer(value); + LengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Length"); } } @@ -167,54 +161,51 @@ public int? Length /// [FhirElement("sequenceAttachment", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Attachment SequenceAttachment + public Hl7.Fhir.Model.Attachment? SequenceAttachment { get { return _SequenceAttachment; } set { _SequenceAttachment = value; OnPropertyChanged("SequenceAttachment"); } } - private Hl7.Fhir.Model.Attachment _SequenceAttachment; + private Hl7.Fhir.Model.Attachment? _SequenceAttachment; /// /// Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID. /// [FhirElement("nTerminalModificationId", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Identifier NTerminalModificationId + public Hl7.Fhir.Model.Identifier? NTerminalModificationId { get { return _NTerminalModificationId; } set { _NTerminalModificationId = value; OnPropertyChanged("NTerminalModificationId"); } } - private Hl7.Fhir.Model.Identifier _NTerminalModificationId; + private Hl7.Fhir.Model.Identifier? _NTerminalModificationId; /// /// The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified. /// [FhirElement("nTerminalModification", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString NTerminalModificationElement + public Hl7.Fhir.Model.FhirString? NTerminalModificationElement { get { return _NTerminalModificationElement; } set { _NTerminalModificationElement = value; OnPropertyChanged("NTerminalModificationElement"); } } - private Hl7.Fhir.Model.FhirString _NTerminalModificationElement; + private Hl7.Fhir.Model.FhirString? _NTerminalModificationElement; /// /// The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string NTerminalModification + public string? NTerminalModification { - get { return NTerminalModificationElement != null ? NTerminalModificationElement.Value : null; } + get => _NTerminalModificationElement?.Value; set { - if (value == null) - NTerminalModificationElement = null; - else - NTerminalModificationElement = new Hl7.Fhir.Model.FhirString(value); + NTerminalModificationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("NTerminalModification"); } } @@ -224,63 +215,56 @@ public string NTerminalModification /// [FhirElement("cTerminalModificationId", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Identifier CTerminalModificationId + public Hl7.Fhir.Model.Identifier? CTerminalModificationId { get { return _CTerminalModificationId; } set { _CTerminalModificationId = value; OnPropertyChanged("CTerminalModificationId"); } } - private Hl7.Fhir.Model.Identifier _CTerminalModificationId; + private Hl7.Fhir.Model.Identifier? _CTerminalModificationId; /// /// The modification at the C-terminal shall be specified. /// [FhirElement("cTerminalModification", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CTerminalModificationElement + public Hl7.Fhir.Model.FhirString? CTerminalModificationElement { get { return _CTerminalModificationElement; } set { _CTerminalModificationElement = value; OnPropertyChanged("CTerminalModificationElement"); } } - private Hl7.Fhir.Model.FhirString _CTerminalModificationElement; + private Hl7.Fhir.Model.FhirString? _CTerminalModificationElement; /// /// The modification at the C-terminal shall be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CTerminalModification + public string? CTerminalModification { - get { return CTerminalModificationElement != null ? CTerminalModificationElement.Value : null; } + get => _CTerminalModificationElement?.Value; set { - if (value == null) - CTerminalModificationElement = null; - else - CTerminalModificationElement = new Hl7.Fhir.Model.FhirString(value); + CTerminalModificationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CTerminalModification"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SubunitComponent; - - if (dest == null) - { + if(other is not SubunitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubunitElement != null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)SubunitElement.DeepCopyInternal(); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)SequenceElement.DeepCopyInternal(); - if(LengthElement != null) dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopyInternal(); - if(SequenceAttachment != null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)SequenceAttachment.DeepCopyInternal(); - if(NTerminalModificationId != null) dest.NTerminalModificationId = (Hl7.Fhir.Model.Identifier)NTerminalModificationId.DeepCopyInternal(); - if(NTerminalModificationElement != null) dest.NTerminalModificationElement = (Hl7.Fhir.Model.FhirString)NTerminalModificationElement.DeepCopyInternal(); - if(CTerminalModificationId != null) dest.CTerminalModificationId = (Hl7.Fhir.Model.Identifier)CTerminalModificationId.DeepCopyInternal(); - if(CTerminalModificationElement != null) dest.CTerminalModificationElement = (Hl7.Fhir.Model.FhirString)CTerminalModificationElement.DeepCopyInternal(); + if(_SubunitElement is not null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)_SubunitElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)_SequenceElement.DeepCopyInternal(); + if(_LengthElement is not null) dest.LengthElement = (Hl7.Fhir.Model.Integer)_LengthElement.DeepCopyInternal(); + if(_SequenceAttachment is not null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)_SequenceAttachment.DeepCopyInternal(); + if(_NTerminalModificationId is not null) dest.NTerminalModificationId = (Hl7.Fhir.Model.Identifier)_NTerminalModificationId.DeepCopyInternal(); + if(_NTerminalModificationElement is not null) dest.NTerminalModificationElement = (Hl7.Fhir.Model.FhirString)_NTerminalModificationElement.DeepCopyInternal(); + if(_CTerminalModificationId is not null) dest.CTerminalModificationId = (Hl7.Fhir.Model.Identifier)_CTerminalModificationId.DeepCopyInternal(); + if(_CTerminalModificationElement is not null) dest.CTerminalModificationElement = (Hl7.Fhir.Model.FhirString)_CTerminalModificationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -292,83 +276,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubunitComponent; - if(otherT == null) return false; + if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubunitElement, otherT.SubunitElement)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(LengthElement, otherT.LengthElement)) return false; - if(!comparer.Equals(SequenceAttachment, otherT.SequenceAttachment)) return false; - if(!comparer.Equals(NTerminalModificationId, otherT.NTerminalModificationId)) return false; - if(!comparer.Equals(NTerminalModificationElement, otherT.NTerminalModificationElement)) return false; - if(!comparer.Equals(CTerminalModificationId, otherT.CTerminalModificationId)) return false; - if(!comparer.Equals(CTerminalModificationElement, otherT.CTerminalModificationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; + if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; + if(!comparer.Equals(_NTerminalModificationId, otherT._NTerminalModificationId)) return false; + if(!comparer.Equals(_NTerminalModificationElement, otherT._NTerminalModificationElement)) return false; + if(!comparer.Equals(_CTerminalModificationId, otherT._CTerminalModificationId)) return false; + if(!comparer.Equals(_CTerminalModificationElement, otherT._CTerminalModificationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subunit": - value = SubunitElement; - return SubunitElement is not null; + value = _SubunitElement; + return _SubunitElement is not null; case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "length": - value = LengthElement; - return LengthElement is not null; + value = _LengthElement; + return _LengthElement is not null; case "sequenceAttachment": - value = SequenceAttachment; - return SequenceAttachment is not null; + value = _SequenceAttachment; + return _SequenceAttachment is not null; case "nTerminalModificationId": - value = NTerminalModificationId; - return NTerminalModificationId is not null; + value = _NTerminalModificationId; + return _NTerminalModificationId is not null; case "nTerminalModification": - value = NTerminalModificationElement; - return NTerminalModificationElement is not null; + value = _NTerminalModificationElement; + return _NTerminalModificationElement is not null; case "cTerminalModificationId": - value = CTerminalModificationId; - return CTerminalModificationId is not null; + value = _CTerminalModificationId; + return _CTerminalModificationId is not null; case "cTerminalModification": - value = CTerminalModificationElement; - return CTerminalModificationElement is not null; + value = _CTerminalModificationElement; + return _CTerminalModificationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subunit": - SubunitElement = (Hl7.Fhir.Model.Integer)value; + SubunitElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequence": - SequenceElement = (Hl7.Fhir.Model.FhirString)value; + SequenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "length": - LengthElement = (Hl7.Fhir.Model.Integer)value; + LengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequenceAttachment": - SequenceAttachment = (Hl7.Fhir.Model.Attachment)value; + SequenceAttachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "nTerminalModificationId": - NTerminalModificationId = (Hl7.Fhir.Model.Identifier)value; + NTerminalModificationId = (Hl7.Fhir.Model.Identifier?)value; return this; case "nTerminalModification": - NTerminalModificationElement = (Hl7.Fhir.Model.FhirString)value; + NTerminalModificationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cTerminalModificationId": - CTerminalModificationId = (Hl7.Fhir.Model.Identifier)value; + CTerminalModificationId = (Hl7.Fhir.Model.Identifier?)value; return this; case "cTerminalModification": - CTerminalModificationElement = (Hl7.Fhir.Model.FhirString)value; + CTerminalModificationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -379,14 +363,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubunitElement is not null) yield return new KeyValuePair("subunit",SubunitElement); - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (LengthElement is not null) yield return new KeyValuePair("length",LengthElement); - if (SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",SequenceAttachment); - if (NTerminalModificationId is not null) yield return new KeyValuePair("nTerminalModificationId",NTerminalModificationId); - if (NTerminalModificationElement is not null) yield return new KeyValuePair("nTerminalModification",NTerminalModificationElement); - if (CTerminalModificationId is not null) yield return new KeyValuePair("cTerminalModificationId",CTerminalModificationId); - if (CTerminalModificationElement is not null) yield return new KeyValuePair("cTerminalModification",CTerminalModificationElement); + if (_SubunitElement is not null) yield return new KeyValuePair("subunit",_SubunitElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_LengthElement is not null) yield return new KeyValuePair("length",_LengthElement); + if (_SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",_SequenceAttachment); + if (_NTerminalModificationId is not null) yield return new KeyValuePair("nTerminalModificationId",_NTerminalModificationId); + if (_NTerminalModificationElement is not null) yield return new KeyValuePair("nTerminalModification",_NTerminalModificationElement); + if (_CTerminalModificationId is not null) yield return new KeyValuePair("cTerminalModificationId",_CTerminalModificationId); + if (_CTerminalModificationElement is not null) yield return new KeyValuePair("cTerminalModification",_CTerminalModificationElement); } } @@ -396,26 +380,26 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sequenceType", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SequenceType + public Hl7.Fhir.Model.CodeableConcept? SequenceType { get { return _SequenceType; } set { _SequenceType = value; OnPropertyChanged("SequenceType"); } } - private Hl7.Fhir.Model.CodeableConcept _SequenceType; + private Hl7.Fhir.Model.CodeableConcept? _SequenceType; /// /// Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable. /// [FhirElement("numberOfSubunits", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfSubunitsElement + public Hl7.Fhir.Model.Integer? NumberOfSubunitsElement { get { return _NumberOfSubunitsElement; } set { _NumberOfSubunitsElement = value; OnPropertyChanged("NumberOfSubunitsElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfSubunitsElement; + private Hl7.Fhir.Model.Integer? _NumberOfSubunitsElement; /// /// Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable @@ -424,13 +408,10 @@ public Hl7.Fhir.Model.Integer NumberOfSubunitsElement [IgnoreDataMember] public int? NumberOfSubunits { - get { return NumberOfSubunitsElement != null ? NumberOfSubunitsElement.Value : null; } + get => _NumberOfSubunitsElement?.Value; set { - if (value == null) - NumberOfSubunitsElement = null; - else - NumberOfSubunitsElement = new Hl7.Fhir.Model.Integer(value); + NumberOfSubunitsElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfSubunits"); } } @@ -443,24 +424,24 @@ public int? NumberOfSubunits [DataMember] public List DisulfideLinkageElement { - get { if(_DisulfideLinkageElement==null) _DisulfideLinkageElement = new List(); return _DisulfideLinkageElement; } + get => _DisulfideLinkageElement ?? new List(); set { _DisulfideLinkageElement = value; OnPropertyChanged("DisulfideLinkageElement"); } } - private List _DisulfideLinkageElement; + private List? _DisulfideLinkageElement; /// /// The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DisulfideLinkage + public IEnumerable? DisulfideLinkage { - get { return DisulfideLinkageElement != null ? DisulfideLinkageElement.Select(elem => elem.Value) : null; } + get => _DisulfideLinkageElement?.Select(elem => elem.Value); set { if (value == null) - DisulfideLinkageElement = null; + DisulfideLinkageElement = null!; else DisulfideLinkageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("DisulfideLinkage"); @@ -475,26 +456,22 @@ public IEnumerable DisulfideLinkage [DataMember] public List Subunit { - get { if(_Subunit==null) _Subunit = new List(); return _Subunit; } + get => _Subunit ?? new List(); set { _Subunit = value; OnPropertyChanged("Subunit"); } } - private List _Subunit; + private List? _Subunit; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceProtein; - - if (dest == null) - { + if(other is not SubstanceProtein dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceType != null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)SequenceType.DeepCopyInternal(); - if(NumberOfSubunitsElement != null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)NumberOfSubunitsElement.DeepCopyInternal(); - if(DisulfideLinkageElement.Any()) dest.DisulfideLinkageElement = new List(DisulfideLinkageElement.DeepCopyInternal()); - if(Subunit.Any()) dest.Subunit = new List(Subunit.DeepCopyInternal()); + if(_SequenceType is not null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)_SequenceType.DeepCopyInternal(); + if(_NumberOfSubunitsElement is not null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)_NumberOfSubunitsElement.DeepCopyInternal(); + if(_DisulfideLinkageElement is not null) dest.DisulfideLinkageElement = new List(_DisulfideLinkageElement.DeepCopyInternal()); + if(_Subunit is not null) dest.Subunit = new List(_Subunit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -506,55 +483,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceProtein; - if(otherT == null) return false; + if(other is not SubstanceProtein otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceType, otherT.SequenceType)) return false; - if(!comparer.Equals(NumberOfSubunitsElement, otherT.NumberOfSubunitsElement)) return false; - if(!comparer.ListEquals(DisulfideLinkageElement, otherT.DisulfideLinkageElement)) return false; - if(!comparer.ListEquals(Subunit, otherT.Subunit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; + if(!comparer.ListEquals(_DisulfideLinkageElement, otherT._DisulfideLinkageElement)) return false; + if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceType": - value = SequenceType; - return SequenceType is not null; + value = _SequenceType; + return _SequenceType is not null; case "numberOfSubunits": - value = NumberOfSubunitsElement; - return NumberOfSubunitsElement is not null; + value = _NumberOfSubunitsElement; + return _NumberOfSubunitsElement is not null; case "disulfideLinkage": - value = DisulfideLinkageElement; - return DisulfideLinkageElement?.Any() == true; + value = _DisulfideLinkageElement; + return _DisulfideLinkageElement?.Any() == true; case "subunit": - value = Subunit; - return Subunit?.Any() == true; + value = _Subunit; + return _Subunit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceType": - SequenceType = (Hl7.Fhir.Model.CodeableConcept)value; + SequenceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "numberOfSubunits": - NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)value; + NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer?)value; return this; case "disulfideLinkage": - DisulfideLinkageElement = (List)value; + DisulfideLinkageElement = (List?)value!; return this; case "subunit": - Subunit = (List)value; + Subunit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -565,10 +542,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceType is not null) yield return new KeyValuePair("sequenceType",SequenceType); - if (NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",NumberOfSubunitsElement); - if (DisulfideLinkageElement?.Any() == true) yield return new KeyValuePair("disulfideLinkage",DisulfideLinkageElement); - if (Subunit?.Any() == true) yield return new KeyValuePair("subunit",Subunit); + if (_SequenceType is not null) yield return new KeyValuePair("sequenceType",_SequenceType); + if (_NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",_NumberOfSubunitsElement); + if (_DisulfideLinkageElement?.Any() == true) yield return new KeyValuePair("disulfideLinkage",_DisulfideLinkageElement); + if (_Subunit?.Any() == true) yield return new KeyValuePair("subunit",_Subunit); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs index 99dcc790a..1e72d987d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,26 +77,26 @@ public partial class GeneComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("geneSequenceOrigin", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept GeneSequenceOrigin + public Hl7.Fhir.Model.CodeableConcept? GeneSequenceOrigin { get { return _GeneSequenceOrigin; } set { _GeneSequenceOrigin = value; OnPropertyChanged("GeneSequenceOrigin"); } } - private Hl7.Fhir.Model.CodeableConcept _GeneSequenceOrigin; + private Hl7.Fhir.Model.CodeableConcept? _GeneSequenceOrigin; /// /// Todo. /// [FhirElement("gene", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Gene + public Hl7.Fhir.Model.CodeableConcept? Gene { get { return _Gene; } set { _Gene = value; OnPropertyChanged("Gene"); } } - private Hl7.Fhir.Model.CodeableConcept _Gene; + private Hl7.Fhir.Model.CodeableConcept? _Gene; /// /// Todo. @@ -105,25 +108,21 @@ public Hl7.Fhir.Model.CodeableConcept Gene [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as GeneComponent; - - if (dest == null) - { + if(other is not GeneComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(GeneSequenceOrigin != null) dest.GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept)GeneSequenceOrigin.DeepCopyInternal(); - if(Gene != null) dest.Gene = (Hl7.Fhir.Model.CodeableConcept)Gene.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_GeneSequenceOrigin is not null) dest.GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept)_GeneSequenceOrigin.DeepCopyInternal(); + if(_Gene is not null) dest.Gene = (Hl7.Fhir.Model.CodeableConcept)_Gene.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -135,48 +134,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GeneComponent; - if(otherT == null) return false; + if(other is not GeneComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(GeneSequenceOrigin, otherT.GeneSequenceOrigin)) return false; - if(!comparer.Equals(Gene, otherT.Gene)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GeneSequenceOrigin, otherT._GeneSequenceOrigin)) return false; + if(!comparer.Equals(_Gene, otherT._Gene)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "geneSequenceOrigin": - value = GeneSequenceOrigin; - return GeneSequenceOrigin is not null; + value = _GeneSequenceOrigin; + return _GeneSequenceOrigin is not null; case "gene": - value = Gene; - return Gene is not null; + value = _Gene; + return _Gene is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "geneSequenceOrigin": - GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept)value; + GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "gene": - Gene = (Hl7.Fhir.Model.CodeableConcept)value; + Gene = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -187,9 +186,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (GeneSequenceOrigin is not null) yield return new KeyValuePair("geneSequenceOrigin",GeneSequenceOrigin); - if (Gene is not null) yield return new KeyValuePair("gene",Gene); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_GeneSequenceOrigin is not null) yield return new KeyValuePair("geneSequenceOrigin",_GeneSequenceOrigin); + if (_Gene is not null) yield return new KeyValuePair("gene",_Gene); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -212,26 +211,26 @@ public partial class GeneElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Todo. /// [FhirElement("element", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Element + public Hl7.Fhir.Model.Identifier? Element { get { return _Element; } set { _Element = value; OnPropertyChanged("Element"); } } - private Hl7.Fhir.Model.Identifier _Element; + private Hl7.Fhir.Model.Identifier? _Element; /// /// Todo. @@ -243,25 +242,21 @@ public Hl7.Fhir.Model.Identifier Element [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as GeneElementComponent; - - if (dest == null) - { + if(other is not GeneElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Element != null) dest.Element = (Hl7.Fhir.Model.Identifier)Element.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Element is not null) dest.Element = (Hl7.Fhir.Model.Identifier)_Element.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -273,48 +268,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GeneElementComponent; - if(otherT == null) return false; + if(other is not GeneElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Element, otherT.Element)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Element, otherT._Element)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "element": - value = Element; - return Element is not null; + value = _Element; + return _Element is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "element": - Element = (Hl7.Fhir.Model.Identifier)value; + Element = (Hl7.Fhir.Model.Identifier?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -325,9 +320,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Element is not null) yield return new KeyValuePair("element",Element); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Element is not null) yield return new KeyValuePair("element",_Element); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -350,26 +345,26 @@ public partial class ClassificationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("domain", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Domain + public Hl7.Fhir.Model.CodeableConcept? Domain { get { return _Domain; } set { _Domain = value; OnPropertyChanged("Domain"); } } - private Hl7.Fhir.Model.CodeableConcept _Domain; + private Hl7.Fhir.Model.CodeableConcept? _Domain; /// /// Todo. /// [FhirElement("classification", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Classification + public Hl7.Fhir.Model.CodeableConcept? Classification { get { return _Classification; } set { _Classification = value; OnPropertyChanged("Classification"); } } - private Hl7.Fhir.Model.CodeableConcept _Classification; + private Hl7.Fhir.Model.CodeableConcept? _Classification; /// /// Todo. @@ -379,11 +374,11 @@ public Hl7.Fhir.Model.CodeableConcept Classification [DataMember] public List Subtype { - get { if(_Subtype==null) _Subtype = new List(); return _Subtype; } + get => _Subtype ?? new List(); set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private List _Subtype; + private List? _Subtype; /// /// Todo. @@ -395,26 +390,22 @@ public List Subtype [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as ClassificationComponent; - - if (dest == null) - { + if(other is not ClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Domain != null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)Domain.DeepCopyInternal(); - if(Classification != null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)Classification.DeepCopyInternal(); - if(Subtype.Any()) dest.Subtype = new List(Subtype.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)_Domain.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)_Classification.DeepCopyInternal(); + if(_Subtype is not null) dest.Subtype = new List(_Subtype.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -426,55 +417,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassificationComponent; - if(otherT == null) return false; + if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Domain, otherT.Domain)) return false; - if(!comparer.Equals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(Subtype, otherT.Subtype)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Domain, otherT._Domain)) return false; + if(!comparer.Equals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "domain": - value = Domain; - return Domain is not null; + value = _Domain; + return _Domain is not null; case "classification": - value = Classification; - return Classification is not null; + value = _Classification; + return _Classification is not null; case "subtype": - value = Subtype; - return Subtype?.Any() == true; + value = _Subtype; + return _Subtype?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "domain": - Domain = (Hl7.Fhir.Model.CodeableConcept)value; + Domain = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (Hl7.Fhir.Model.CodeableConcept)value; + Classification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subtype": - Subtype = (List)value; + Subtype = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -485,10 +476,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Domain is not null) yield return new KeyValuePair("domain",Domain); - if (Classification is not null) yield return new KeyValuePair("classification",Classification); - if (Subtype?.Any() == true) yield return new KeyValuePair("subtype",Subtype); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Domain is not null) yield return new KeyValuePair("domain",_Domain); + if (_Classification is not null) yield return new KeyValuePair("classification",_Classification); + if (_Subtype?.Any() == true) yield return new KeyValuePair("subtype",_Subtype); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -511,65 +502,65 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("target", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Target + public Hl7.Fhir.Model.Identifier? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.Identifier _Target; + private Hl7.Fhir.Model.Identifier? _Target; /// /// Todo. /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Todo. /// [FhirElement("interaction", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Interaction + public Hl7.Fhir.Model.CodeableConcept? Interaction { get { return _Interaction; } set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private Hl7.Fhir.Model.CodeableConcept _Interaction; + private Hl7.Fhir.Model.CodeableConcept? _Interaction; /// /// Todo. /// [FhirElement("organism", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Organism + public Hl7.Fhir.Model.CodeableConcept? Organism { get { return _Organism; } set { _Organism = value; OnPropertyChanged("Organism"); } } - private Hl7.Fhir.Model.CodeableConcept _Organism; + private Hl7.Fhir.Model.CodeableConcept? _Organism; /// /// Todo. /// [FhirElement("organismType", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrganismType + public Hl7.Fhir.Model.CodeableConcept? OrganismType { get { return _OrganismType; } set { _OrganismType = value; OnPropertyChanged("OrganismType"); } } - private Hl7.Fhir.Model.CodeableConcept _OrganismType; + private Hl7.Fhir.Model.CodeableConcept? _OrganismType; /// /// Todo. @@ -578,26 +569,26 @@ public Hl7.Fhir.Model.CodeableConcept OrganismType [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// Todo. /// [FhirElement("amountType", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AmountType + public Hl7.Fhir.Model.CodeableConcept? AmountType { get { return _AmountType; } set { _AmountType = value; OnPropertyChanged("AmountType"); } } - private Hl7.Fhir.Model.CodeableConcept _AmountType; + private Hl7.Fhir.Model.CodeableConcept? _AmountType; /// /// Todo. @@ -609,30 +600,26 @@ public Hl7.Fhir.Model.CodeableConcept AmountType [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target != null) dest.Target = (Hl7.Fhir.Model.Identifier)Target.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Interaction != null) dest.Interaction = (Hl7.Fhir.Model.CodeableConcept)Interaction.DeepCopyInternal(); - if(Organism != null) dest.Organism = (Hl7.Fhir.Model.CodeableConcept)Organism.DeepCopyInternal(); - if(OrganismType != null) dest.OrganismType = (Hl7.Fhir.Model.CodeableConcept)OrganismType.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(AmountType != null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)AmountType.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.Identifier)_Target.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Interaction is not null) dest.Interaction = (Hl7.Fhir.Model.CodeableConcept)_Interaction.DeepCopyInternal(); + if(_Organism is not null) dest.Organism = (Hl7.Fhir.Model.CodeableConcept)_Organism.DeepCopyInternal(); + if(_OrganismType is not null) dest.OrganismType = (Hl7.Fhir.Model.CodeableConcept)_OrganismType.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_AmountType is not null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)_AmountType.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -644,83 +631,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Interaction, otherT.Interaction)) return false; - if(!comparer.Equals(Organism, otherT.Organism)) return false; - if(!comparer.Equals(OrganismType, otherT.OrganismType)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(AmountType, otherT.AmountType)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Interaction, otherT._Interaction)) return false; + if(!comparer.Equals(_Organism, otherT._Organism)) return false; + if(!comparer.Equals(_OrganismType, otherT._OrganismType)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "interaction": - value = Interaction; - return Interaction is not null; + value = _Interaction; + return _Interaction is not null; case "organism": - value = Organism; - return Organism is not null; + value = _Organism; + return _Organism is not null; case "organismType": - value = OrganismType; - return OrganismType is not null; + value = _OrganismType; + return _OrganismType is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "amountType": - value = AmountType; - return AmountType is not null; + value = _AmountType; + return _AmountType is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (Hl7.Fhir.Model.Identifier)value; + Target = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interaction": - Interaction = (Hl7.Fhir.Model.CodeableConcept)value; + Interaction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "organism": - Organism = (Hl7.Fhir.Model.CodeableConcept)value; + Organism = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "organismType": - OrganismType = (Hl7.Fhir.Model.CodeableConcept)value; + OrganismType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "amountType": - AmountType = (Hl7.Fhir.Model.CodeableConcept)value; + AmountType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -731,14 +718,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target is not null) yield return new KeyValuePair("target",Target); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Interaction is not null) yield return new KeyValuePair("interaction",Interaction); - if (Organism is not null) yield return new KeyValuePair("organism",Organism); - if (OrganismType is not null) yield return new KeyValuePair("organismType",OrganismType); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (AmountType is not null) yield return new KeyValuePair("amountType",AmountType); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Interaction is not null) yield return new KeyValuePair("interaction",_Interaction); + if (_Organism is not null) yield return new KeyValuePair("organism",_Organism); + if (_OrganismType is not null) yield return new KeyValuePair("organismType",_OrganismType); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_AmountType is not null) yield return new KeyValuePair("amountType",_AmountType); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -748,28 +735,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("comment", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Todo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -782,11 +766,11 @@ public string Comment [DataMember] public List Gene { - get { if(_Gene==null) _Gene = new List(); return _Gene; } + get => _Gene ?? new List(); set { _Gene = value; OnPropertyChanged("Gene"); } } - private List _Gene; + private List? _Gene; /// /// Todo. @@ -796,11 +780,11 @@ public List Gene [DataMember] public List GeneElement { - get { if(_GeneElement==null) _GeneElement = new List(); return _GeneElement; } + get => _GeneElement ?? new List(); set { _GeneElement = value; OnPropertyChanged("GeneElement"); } } - private List _GeneElement; + private List? _GeneElement; /// /// Todo. @@ -810,11 +794,11 @@ public List G [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Todo. @@ -824,27 +808,23 @@ public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceReferenceInformation; - - if (dest == null) - { + if(other is not SubstanceReferenceInformation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Gene.Any()) dest.Gene = new List(Gene.DeepCopyInternal()); - if(GeneElement.Any()) dest.GeneElement = new List(GeneElement.DeepCopyInternal()); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Gene is not null) dest.Gene = new List(_Gene.DeepCopyInternal()); + if(_GeneElement is not null) dest.GeneElement = new List(_GeneElement.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -856,62 +836,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceReferenceInformation; - if(otherT == null) return false; + if(other is not SubstanceReferenceInformation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(Gene, otherT.Gene)) return false; - if(!comparer.ListEquals(GeneElement, otherT.GeneElement)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_Gene, otherT._Gene)) return false; + if(!comparer.ListEquals(_GeneElement, otherT._GeneElement)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "gene": - value = Gene; - return Gene?.Any() == true; + value = _Gene; + return _Gene?.Any() == true; case "geneElement": - value = GeneElement; - return GeneElement?.Any() == true; + value = _GeneElement; + return _GeneElement?.Any() == true; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "gene": - Gene = (List)value; + Gene = (List?)value!; return this; case "geneElement": - GeneElement = (List)value; + GeneElement = (List?)value!; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -922,11 +902,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Gene?.Any() == true) yield return new KeyValuePair("gene",Gene); - if (GeneElement?.Any() == true) yield return new KeyValuePair("geneElement",GeneElement); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Gene?.Any() == true) yield return new KeyValuePair("gene",_Gene); + if (_GeneElement?.Any() == true) yield return new KeyValuePair("geneElement",_GeneElement); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs index 9d438cf31..d57fbc4e2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,28 +77,25 @@ public partial class FractionDescriptionComponent : Hl7.Fhir.Model.BackboneEleme /// [FhirElement("fraction", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString FractionElement + public Hl7.Fhir.Model.FhirString? FractionElement { get { return _FractionElement; } set { _FractionElement = value; OnPropertyChanged("FractionElement"); } } - private Hl7.Fhir.Model.FhirString _FractionElement; + private Hl7.Fhir.Model.FhirString? _FractionElement; /// /// This element is capturing information about the fraction of a plant part, or human plasma for fractionation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Fraction + public string? Fraction { - get { return FractionElement != null ? FractionElement.Value : null; } + get => _FractionElement?.Value; set { - if (value == null) - FractionElement = null; - else - FractionElement = new Hl7.Fhir.Model.FhirString(value); + FractionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Fraction"); } } @@ -105,26 +105,22 @@ public string Fraction /// [FhirElement("materialType", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MaterialType + public Hl7.Fhir.Model.CodeableConcept? MaterialType { get { return _MaterialType; } set { _MaterialType = value; OnPropertyChanged("MaterialType"); } } - private Hl7.Fhir.Model.CodeableConcept _MaterialType; + private Hl7.Fhir.Model.CodeableConcept? _MaterialType; protected internal override void CopyToInternal(Base other) { - var dest = other as FractionDescriptionComponent; - - if (dest == null) - { + if(other is not FractionDescriptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FractionElement != null) dest.FractionElement = (Hl7.Fhir.Model.FhirString)FractionElement.DeepCopyInternal(); - if(MaterialType != null) dest.MaterialType = (Hl7.Fhir.Model.CodeableConcept)MaterialType.DeepCopyInternal(); + if(_FractionElement is not null) dest.FractionElement = (Hl7.Fhir.Model.FhirString)_FractionElement.DeepCopyInternal(); + if(_MaterialType is not null) dest.MaterialType = (Hl7.Fhir.Model.CodeableConcept)_MaterialType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -136,41 +132,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FractionDescriptionComponent; - if(otherT == null) return false; + if(other is not FractionDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FractionElement, otherT.FractionElement)) return false; - if(!comparer.Equals(MaterialType, otherT.MaterialType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FractionElement, otherT._FractionElement)) return false; + if(!comparer.Equals(_MaterialType, otherT._MaterialType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "fraction": - value = FractionElement; - return FractionElement is not null; + value = _FractionElement; + return _FractionElement is not null; case "materialType": - value = MaterialType; - return MaterialType is not null; + value = _MaterialType; + return _MaterialType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "fraction": - FractionElement = (Hl7.Fhir.Model.FhirString)value; + FractionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "materialType": - MaterialType = (Hl7.Fhir.Model.CodeableConcept)value; + MaterialType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -181,8 +177,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FractionElement is not null) yield return new KeyValuePair("fraction",FractionElement); - if (MaterialType is not null) yield return new KeyValuePair("materialType",MaterialType); + if (_FractionElement is not null) yield return new KeyValuePair("fraction",_FractionElement); + if (_MaterialType is not null) yield return new KeyValuePair("materialType",_MaterialType); } } @@ -205,80 +201,77 @@ public partial class OrganismComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("family", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Family + public Hl7.Fhir.Model.CodeableConcept? Family { get { return _Family; } set { _Family = value; OnPropertyChanged("Family"); } } - private Hl7.Fhir.Model.CodeableConcept _Family; + private Hl7.Fhir.Model.CodeableConcept? _Family; /// /// The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies. /// [FhirElement("genus", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Genus + public Hl7.Fhir.Model.CodeableConcept? Genus { get { return _Genus; } set { _Genus = value; OnPropertyChanged("Genus"); } } - private Hl7.Fhir.Model.CodeableConcept _Genus; + private Hl7.Fhir.Model.CodeableConcept? _Genus; /// /// The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies. /// [FhirElement("species", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Species + public Hl7.Fhir.Model.CodeableConcept? Species { get { return _Species; } set { _Species = value; OnPropertyChanged("Species"); } } - private Hl7.Fhir.Model.CodeableConcept _Species; + private Hl7.Fhir.Model.CodeableConcept? _Species; /// /// The Intraspecific type of an organism shall be specified. /// [FhirElement("intraspecificType", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept IntraspecificType + public Hl7.Fhir.Model.CodeableConcept? IntraspecificType { get { return _IntraspecificType; } set { _IntraspecificType = value; OnPropertyChanged("IntraspecificType"); } } - private Hl7.Fhir.Model.CodeableConcept _IntraspecificType; + private Hl7.Fhir.Model.CodeableConcept? _IntraspecificType; /// /// The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention. /// [FhirElement("intraspecificDescription", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString IntraspecificDescriptionElement + public Hl7.Fhir.Model.FhirString? IntraspecificDescriptionElement { get { return _IntraspecificDescriptionElement; } set { _IntraspecificDescriptionElement = value; OnPropertyChanged("IntraspecificDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _IntraspecificDescriptionElement; + private Hl7.Fhir.Model.FhirString? _IntraspecificDescriptionElement; /// /// The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IntraspecificDescription + public string? IntraspecificDescription { - get { return IntraspecificDescriptionElement != null ? IntraspecificDescriptionElement.Value : null; } + get => _IntraspecificDescriptionElement?.Value; set { - if (value == null) - IntraspecificDescriptionElement = null; - else - IntraspecificDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + IntraspecificDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IntraspecificDescription"); } } @@ -291,56 +284,52 @@ public string IntraspecificDescription [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// 4.9.13.8.1 Hybrid species maternal organism ID (Optional). /// [FhirElement("hybrid", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent Hybrid + public Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent? Hybrid { get { return _Hybrid; } set { _Hybrid = value; OnPropertyChanged("Hybrid"); } } - private Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent _Hybrid; + private Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent? _Hybrid; /// /// 4.9.13.7.1 Kingdom (Conditional). /// [FhirElement("organismGeneral", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent OrganismGeneral + public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent? OrganismGeneral { get { return _OrganismGeneral; } set { _OrganismGeneral = value; OnPropertyChanged("OrganismGeneral"); } } - private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent _OrganismGeneral; + private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent? _OrganismGeneral; protected internal override void CopyToInternal(Base other) { - var dest = other as OrganismComponent; - - if (dest == null) - { + if(other is not OrganismComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Family != null) dest.Family = (Hl7.Fhir.Model.CodeableConcept)Family.DeepCopyInternal(); - if(Genus != null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)Genus.DeepCopyInternal(); - if(Species != null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)Species.DeepCopyInternal(); - if(IntraspecificType != null) dest.IntraspecificType = (Hl7.Fhir.Model.CodeableConcept)IntraspecificType.DeepCopyInternal(); - if(IntraspecificDescriptionElement != null) dest.IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString)IntraspecificDescriptionElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Hybrid != null) dest.Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent)Hybrid.DeepCopyInternal(); - if(OrganismGeneral != null) dest.OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent)OrganismGeneral.DeepCopyInternal(); + if(_Family is not null) dest.Family = (Hl7.Fhir.Model.CodeableConcept)_Family.DeepCopyInternal(); + if(_Genus is not null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)_Genus.DeepCopyInternal(); + if(_Species is not null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)_Species.DeepCopyInternal(); + if(_IntraspecificType is not null) dest.IntraspecificType = (Hl7.Fhir.Model.CodeableConcept)_IntraspecificType.DeepCopyInternal(); + if(_IntraspecificDescriptionElement is not null) dest.IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString)_IntraspecificDescriptionElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Hybrid is not null) dest.Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent)_Hybrid.DeepCopyInternal(); + if(_OrganismGeneral is not null) dest.OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent)_OrganismGeneral.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -352,83 +341,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrganismComponent; - if(otherT == null) return false; + if(other is not OrganismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Family, otherT.Family)) return false; - if(!comparer.Equals(Genus, otherT.Genus)) return false; - if(!comparer.Equals(Species, otherT.Species)) return false; - if(!comparer.Equals(IntraspecificType, otherT.IntraspecificType)) return false; - if(!comparer.Equals(IntraspecificDescriptionElement, otherT.IntraspecificDescriptionElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Hybrid, otherT.Hybrid)) return false; - if(!comparer.Equals(OrganismGeneral, otherT.OrganismGeneral)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Family, otherT._Family)) return false; + if(!comparer.Equals(_Genus, otherT._Genus)) return false; + if(!comparer.Equals(_Species, otherT._Species)) return false; + if(!comparer.Equals(_IntraspecificType, otherT._IntraspecificType)) return false; + if(!comparer.Equals(_IntraspecificDescriptionElement, otherT._IntraspecificDescriptionElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Hybrid, otherT._Hybrid)) return false; + if(!comparer.Equals(_OrganismGeneral, otherT._OrganismGeneral)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "family": - value = Family; - return Family is not null; + value = _Family; + return _Family is not null; case "genus": - value = Genus; - return Genus is not null; + value = _Genus; + return _Genus is not null; case "species": - value = Species; - return Species is not null; + value = _Species; + return _Species is not null; case "intraspecificType": - value = IntraspecificType; - return IntraspecificType is not null; + value = _IntraspecificType; + return _IntraspecificType is not null; case "intraspecificDescription": - value = IntraspecificDescriptionElement; - return IntraspecificDescriptionElement is not null; + value = _IntraspecificDescriptionElement; + return _IntraspecificDescriptionElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "hybrid": - value = Hybrid; - return Hybrid is not null; + value = _Hybrid; + return _Hybrid is not null; case "organismGeneral": - value = OrganismGeneral; - return OrganismGeneral is not null; + value = _OrganismGeneral; + return _OrganismGeneral is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "family": - Family = (Hl7.Fhir.Model.CodeableConcept)value; + Family = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genus": - Genus = (Hl7.Fhir.Model.CodeableConcept)value; + Genus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "species": - Species = (Hl7.Fhir.Model.CodeableConcept)value; + Species = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intraspecificType": - IntraspecificType = (Hl7.Fhir.Model.CodeableConcept)value; + IntraspecificType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intraspecificDescription": - IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "hybrid": - Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent)value; + Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent?)value; return this; case "organismGeneral": - OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent)value; + OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent?)value; return this; default: return base.SetValue(key, value); @@ -439,14 +428,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Family is not null) yield return new KeyValuePair("family",Family); - if (Genus is not null) yield return new KeyValuePair("genus",Genus); - if (Species is not null) yield return new KeyValuePair("species",Species); - if (IntraspecificType is not null) yield return new KeyValuePair("intraspecificType",IntraspecificType); - if (IntraspecificDescriptionElement is not null) yield return new KeyValuePair("intraspecificDescription",IntraspecificDescriptionElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Hybrid is not null) yield return new KeyValuePair("hybrid",Hybrid); - if (OrganismGeneral is not null) yield return new KeyValuePair("organismGeneral",OrganismGeneral); + if (_Family is not null) yield return new KeyValuePair("family",_Family); + if (_Genus is not null) yield return new KeyValuePair("genus",_Genus); + if (_Species is not null) yield return new KeyValuePair("species",_Species); + if (_IntraspecificType is not null) yield return new KeyValuePair("intraspecificType",_IntraspecificType); + if (_IntraspecificDescriptionElement is not null) yield return new KeyValuePair("intraspecificDescription",_IntraspecificDescriptionElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Hybrid is not null) yield return new KeyValuePair("hybrid",_Hybrid); + if (_OrganismGeneral is not null) yield return new KeyValuePair("organismGeneral",_OrganismGeneral); } } @@ -469,57 +458,50 @@ public partial class AuthorComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("authorType", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AuthorType + public Hl7.Fhir.Model.CodeableConcept? AuthorType { get { return _AuthorType; } set { _AuthorType = value; OnPropertyChanged("AuthorType"); } } - private Hl7.Fhir.Model.CodeableConcept _AuthorType; + private Hl7.Fhir.Model.CodeableConcept? _AuthorType; /// /// The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank). /// [FhirElement("authorDescription", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString AuthorDescriptionElement + public Hl7.Fhir.Model.FhirString? AuthorDescriptionElement { get { return _AuthorDescriptionElement; } set { _AuthorDescriptionElement = value; OnPropertyChanged("AuthorDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _AuthorDescriptionElement; + private Hl7.Fhir.Model.FhirString? _AuthorDescriptionElement; /// /// The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthorDescription + public string? AuthorDescription { - get { return AuthorDescriptionElement != null ? AuthorDescriptionElement.Value : null; } + get => _AuthorDescriptionElement?.Value; set { - if (value == null) - AuthorDescriptionElement = null; - else - AuthorDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + AuthorDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AuthorDescription"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AuthorComponent; - - if (dest == null) - { + if(other is not AuthorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AuthorType != null) dest.AuthorType = (Hl7.Fhir.Model.CodeableConcept)AuthorType.DeepCopyInternal(); - if(AuthorDescriptionElement != null) dest.AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString)AuthorDescriptionElement.DeepCopyInternal(); + if(_AuthorType is not null) dest.AuthorType = (Hl7.Fhir.Model.CodeableConcept)_AuthorType.DeepCopyInternal(); + if(_AuthorDescriptionElement is not null) dest.AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString)_AuthorDescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -531,41 +513,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AuthorComponent; - if(otherT == null) return false; + if(other is not AuthorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AuthorType, otherT.AuthorType)) return false; - if(!comparer.Equals(AuthorDescriptionElement, otherT.AuthorDescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorType, otherT._AuthorType)) return false; + if(!comparer.Equals(_AuthorDescriptionElement, otherT._AuthorDescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authorType": - value = AuthorType; - return AuthorType is not null; + value = _AuthorType; + return _AuthorType is not null; case "authorDescription": - value = AuthorDescriptionElement; - return AuthorDescriptionElement is not null; + value = _AuthorDescriptionElement; + return _AuthorDescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authorType": - AuthorType = (Hl7.Fhir.Model.CodeableConcept)value; + AuthorType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "authorDescription": - AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -576,8 +558,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AuthorType is not null) yield return new KeyValuePair("authorType",AuthorType); - if (AuthorDescriptionElement is not null) yield return new KeyValuePair("authorDescription",AuthorDescriptionElement); + if (_AuthorType is not null) yield return new KeyValuePair("authorType",_AuthorType); + if (_AuthorDescriptionElement is not null) yield return new KeyValuePair("authorDescription",_AuthorDescriptionElement); } } @@ -600,28 +582,25 @@ public partial class HybridComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("maternalOrganismId", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString MaternalOrganismIdElement + public Hl7.Fhir.Model.FhirString? MaternalOrganismIdElement { get { return _MaternalOrganismIdElement; } set { _MaternalOrganismIdElement = value; OnPropertyChanged("MaternalOrganismIdElement"); } } - private Hl7.Fhir.Model.FhirString _MaternalOrganismIdElement; + private Hl7.Fhir.Model.FhirString? _MaternalOrganismIdElement; /// /// The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MaternalOrganismId + public string? MaternalOrganismId { - get { return MaternalOrganismIdElement != null ? MaternalOrganismIdElement.Value : null; } + get => _MaternalOrganismIdElement?.Value; set { - if (value == null) - MaternalOrganismIdElement = null; - else - MaternalOrganismIdElement = new Hl7.Fhir.Model.FhirString(value); + MaternalOrganismIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MaternalOrganismId"); } } @@ -631,28 +610,25 @@ public string MaternalOrganismId /// [FhirElement("maternalOrganismName", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString MaternalOrganismNameElement + public Hl7.Fhir.Model.FhirString? MaternalOrganismNameElement { get { return _MaternalOrganismNameElement; } set { _MaternalOrganismNameElement = value; OnPropertyChanged("MaternalOrganismNameElement"); } } - private Hl7.Fhir.Model.FhirString _MaternalOrganismNameElement; + private Hl7.Fhir.Model.FhirString? _MaternalOrganismNameElement; /// /// The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MaternalOrganismName + public string? MaternalOrganismName { - get { return MaternalOrganismNameElement != null ? MaternalOrganismNameElement.Value : null; } + get => _MaternalOrganismNameElement?.Value; set { - if (value == null) - MaternalOrganismNameElement = null; - else - MaternalOrganismNameElement = new Hl7.Fhir.Model.FhirString(value); + MaternalOrganismNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MaternalOrganismName"); } } @@ -662,28 +638,25 @@ public string MaternalOrganismName /// [FhirElement("paternalOrganismId", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString PaternalOrganismIdElement + public Hl7.Fhir.Model.FhirString? PaternalOrganismIdElement { get { return _PaternalOrganismIdElement; } set { _PaternalOrganismIdElement = value; OnPropertyChanged("PaternalOrganismIdElement"); } } - private Hl7.Fhir.Model.FhirString _PaternalOrganismIdElement; + private Hl7.Fhir.Model.FhirString? _PaternalOrganismIdElement; /// /// The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaternalOrganismId + public string? PaternalOrganismId { - get { return PaternalOrganismIdElement != null ? PaternalOrganismIdElement.Value : null; } + get => _PaternalOrganismIdElement?.Value; set { - if (value == null) - PaternalOrganismIdElement = null; - else - PaternalOrganismIdElement = new Hl7.Fhir.Model.FhirString(value); + PaternalOrganismIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PaternalOrganismId"); } } @@ -693,28 +666,25 @@ public string PaternalOrganismId /// [FhirElement("paternalOrganismName", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PaternalOrganismNameElement + public Hl7.Fhir.Model.FhirString? PaternalOrganismNameElement { get { return _PaternalOrganismNameElement; } set { _PaternalOrganismNameElement = value; OnPropertyChanged("PaternalOrganismNameElement"); } } - private Hl7.Fhir.Model.FhirString _PaternalOrganismNameElement; + private Hl7.Fhir.Model.FhirString? _PaternalOrganismNameElement; /// /// The name of the paternal species constituting the hybrid organism shall be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaternalOrganismName + public string? PaternalOrganismName { - get { return PaternalOrganismNameElement != null ? PaternalOrganismNameElement.Value : null; } + get => _PaternalOrganismNameElement?.Value; set { - if (value == null) - PaternalOrganismNameElement = null; - else - PaternalOrganismNameElement = new Hl7.Fhir.Model.FhirString(value); + PaternalOrganismNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PaternalOrganismName"); } } @@ -724,29 +694,25 @@ public string PaternalOrganismName /// [FhirElement("hybridType", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept HybridType + public Hl7.Fhir.Model.CodeableConcept? HybridType { get { return _HybridType; } set { _HybridType = value; OnPropertyChanged("HybridType"); } } - private Hl7.Fhir.Model.CodeableConcept _HybridType; + private Hl7.Fhir.Model.CodeableConcept? _HybridType; protected internal override void CopyToInternal(Base other) { - var dest = other as HybridComponent; - - if (dest == null) - { + if(other is not HybridComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MaternalOrganismIdElement != null) dest.MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)MaternalOrganismIdElement.DeepCopyInternal(); - if(MaternalOrganismNameElement != null) dest.MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)MaternalOrganismNameElement.DeepCopyInternal(); - if(PaternalOrganismIdElement != null) dest.PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)PaternalOrganismIdElement.DeepCopyInternal(); - if(PaternalOrganismNameElement != null) dest.PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)PaternalOrganismNameElement.DeepCopyInternal(); - if(HybridType != null) dest.HybridType = (Hl7.Fhir.Model.CodeableConcept)HybridType.DeepCopyInternal(); + if(_MaternalOrganismIdElement is not null) dest.MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)_MaternalOrganismIdElement.DeepCopyInternal(); + if(_MaternalOrganismNameElement is not null) dest.MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)_MaternalOrganismNameElement.DeepCopyInternal(); + if(_PaternalOrganismIdElement is not null) dest.PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)_PaternalOrganismIdElement.DeepCopyInternal(); + if(_PaternalOrganismNameElement is not null) dest.PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)_PaternalOrganismNameElement.DeepCopyInternal(); + if(_HybridType is not null) dest.HybridType = (Hl7.Fhir.Model.CodeableConcept)_HybridType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -758,62 +724,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HybridComponent; - if(otherT == null) return false; + if(other is not HybridComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MaternalOrganismIdElement, otherT.MaternalOrganismIdElement)) return false; - if(!comparer.Equals(MaternalOrganismNameElement, otherT.MaternalOrganismNameElement)) return false; - if(!comparer.Equals(PaternalOrganismIdElement, otherT.PaternalOrganismIdElement)) return false; - if(!comparer.Equals(PaternalOrganismNameElement, otherT.PaternalOrganismNameElement)) return false; - if(!comparer.Equals(HybridType, otherT.HybridType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MaternalOrganismIdElement, otherT._MaternalOrganismIdElement)) return false; + if(!comparer.Equals(_MaternalOrganismNameElement, otherT._MaternalOrganismNameElement)) return false; + if(!comparer.Equals(_PaternalOrganismIdElement, otherT._PaternalOrganismIdElement)) return false; + if(!comparer.Equals(_PaternalOrganismNameElement, otherT._PaternalOrganismNameElement)) return false; + if(!comparer.Equals(_HybridType, otherT._HybridType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "maternalOrganismId": - value = MaternalOrganismIdElement; - return MaternalOrganismIdElement is not null; + value = _MaternalOrganismIdElement; + return _MaternalOrganismIdElement is not null; case "maternalOrganismName": - value = MaternalOrganismNameElement; - return MaternalOrganismNameElement is not null; + value = _MaternalOrganismNameElement; + return _MaternalOrganismNameElement is not null; case "paternalOrganismId": - value = PaternalOrganismIdElement; - return PaternalOrganismIdElement is not null; + value = _PaternalOrganismIdElement; + return _PaternalOrganismIdElement is not null; case "paternalOrganismName": - value = PaternalOrganismNameElement; - return PaternalOrganismNameElement is not null; + value = _PaternalOrganismNameElement; + return _PaternalOrganismNameElement is not null; case "hybridType": - value = HybridType; - return HybridType is not null; + value = _HybridType; + return _HybridType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "maternalOrganismId": - MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)value; + MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "maternalOrganismName": - MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)value; + MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paternalOrganismId": - PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)value; + PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paternalOrganismName": - PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)value; + PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "hybridType": - HybridType = (Hl7.Fhir.Model.CodeableConcept)value; + HybridType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -824,11 +790,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MaternalOrganismIdElement is not null) yield return new KeyValuePair("maternalOrganismId",MaternalOrganismIdElement); - if (MaternalOrganismNameElement is not null) yield return new KeyValuePair("maternalOrganismName",MaternalOrganismNameElement); - if (PaternalOrganismIdElement is not null) yield return new KeyValuePair("paternalOrganismId",PaternalOrganismIdElement); - if (PaternalOrganismNameElement is not null) yield return new KeyValuePair("paternalOrganismName",PaternalOrganismNameElement); - if (HybridType is not null) yield return new KeyValuePair("hybridType",HybridType); + if (_MaternalOrganismIdElement is not null) yield return new KeyValuePair("maternalOrganismId",_MaternalOrganismIdElement); + if (_MaternalOrganismNameElement is not null) yield return new KeyValuePair("maternalOrganismName",_MaternalOrganismNameElement); + if (_PaternalOrganismIdElement is not null) yield return new KeyValuePair("paternalOrganismId",_PaternalOrganismIdElement); + if (_PaternalOrganismNameElement is not null) yield return new KeyValuePair("paternalOrganismName",_PaternalOrganismNameElement); + if (_HybridType is not null) yield return new KeyValuePair("hybridType",_HybridType); } } @@ -851,67 +817,63 @@ public partial class OrganismGeneralComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("kingdom", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Kingdom + public Hl7.Fhir.Model.CodeableConcept? Kingdom { get { return _Kingdom; } set { _Kingdom = value; OnPropertyChanged("Kingdom"); } } - private Hl7.Fhir.Model.CodeableConcept _Kingdom; + private Hl7.Fhir.Model.CodeableConcept? _Kingdom; /// /// The phylum of an organism shall be specified. /// [FhirElement("phylum", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Phylum + public Hl7.Fhir.Model.CodeableConcept? Phylum { get { return _Phylum; } set { _Phylum = value; OnPropertyChanged("Phylum"); } } - private Hl7.Fhir.Model.CodeableConcept _Phylum; + private Hl7.Fhir.Model.CodeableConcept? _Phylum; /// /// The class of an organism shall be specified. /// [FhirElement("class", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Class + public Hl7.Fhir.Model.CodeableConcept? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.CodeableConcept _Class; + private Hl7.Fhir.Model.CodeableConcept? _Class; /// /// The order of an organism shall be specified,. /// [FhirElement("order", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Order + public Hl7.Fhir.Model.CodeableConcept? Order { get { return _Order; } set { _Order = value; OnPropertyChanged("Order"); } } - private Hl7.Fhir.Model.CodeableConcept _Order; + private Hl7.Fhir.Model.CodeableConcept? _Order; protected internal override void CopyToInternal(Base other) { - var dest = other as OrganismGeneralComponent; - - if (dest == null) - { + if(other is not OrganismGeneralComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Kingdom != null) dest.Kingdom = (Hl7.Fhir.Model.CodeableConcept)Kingdom.DeepCopyInternal(); - if(Phylum != null) dest.Phylum = (Hl7.Fhir.Model.CodeableConcept)Phylum.DeepCopyInternal(); - if(Class != null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopyInternal(); - if(Order != null) dest.Order = (Hl7.Fhir.Model.CodeableConcept)Order.DeepCopyInternal(); + if(_Kingdom is not null) dest.Kingdom = (Hl7.Fhir.Model.CodeableConcept)_Kingdom.DeepCopyInternal(); + if(_Phylum is not null) dest.Phylum = (Hl7.Fhir.Model.CodeableConcept)_Phylum.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)_Class.DeepCopyInternal(); + if(_Order is not null) dest.Order = (Hl7.Fhir.Model.CodeableConcept)_Order.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -923,55 +885,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrganismGeneralComponent; - if(otherT == null) return false; + if(other is not OrganismGeneralComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Kingdom, otherT.Kingdom)) return false; - if(!comparer.Equals(Phylum, otherT.Phylum)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Order, otherT.Order)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Kingdom, otherT._Kingdom)) return false; + if(!comparer.Equals(_Phylum, otherT._Phylum)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Order, otherT._Order)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kingdom": - value = Kingdom; - return Kingdom is not null; + value = _Kingdom; + return _Kingdom is not null; case "phylum": - value = Phylum; - return Phylum is not null; + value = _Phylum; + return _Phylum is not null; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "order": - value = Order; - return Order is not null; + value = _Order; + return _Order is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kingdom": - Kingdom = (Hl7.Fhir.Model.CodeableConcept)value; + Kingdom = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "phylum": - Phylum = (Hl7.Fhir.Model.CodeableConcept)value; + Phylum = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "class": - Class = (Hl7.Fhir.Model.CodeableConcept)value; + Class = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "order": - Order = (Hl7.Fhir.Model.CodeableConcept)value; + Order = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -982,10 +944,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Kingdom is not null) yield return new KeyValuePair("kingdom",Kingdom); - if (Phylum is not null) yield return new KeyValuePair("phylum",Phylum); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Order is not null) yield return new KeyValuePair("order",Order); + if (_Kingdom is not null) yield return new KeyValuePair("kingdom",_Kingdom); + if (_Phylum is not null) yield return new KeyValuePair("phylum",_Phylum); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Order is not null) yield return new KeyValuePair("order",_Order); } } @@ -1008,39 +970,35 @@ public partial class PartDescriptionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("part", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Part + public Hl7.Fhir.Model.CodeableConcept? Part { get { return _Part; } set { _Part = value; OnPropertyChanged("Part"); } } - private Hl7.Fhir.Model.CodeableConcept _Part; + private Hl7.Fhir.Model.CodeableConcept? _Part; /// /// The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply. /// [FhirElement("partLocation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PartLocation + public Hl7.Fhir.Model.CodeableConcept? PartLocation { get { return _PartLocation; } set { _PartLocation = value; OnPropertyChanged("PartLocation"); } } - private Hl7.Fhir.Model.CodeableConcept _PartLocation; + private Hl7.Fhir.Model.CodeableConcept? _PartLocation; protected internal override void CopyToInternal(Base other) { - var dest = other as PartDescriptionComponent; - - if (dest == null) - { + if(other is not PartDescriptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Part != null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)Part.DeepCopyInternal(); - if(PartLocation != null) dest.PartLocation = (Hl7.Fhir.Model.CodeableConcept)PartLocation.DeepCopyInternal(); + if(_Part is not null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)_Part.DeepCopyInternal(); + if(_PartLocation is not null) dest.PartLocation = (Hl7.Fhir.Model.CodeableConcept)_PartLocation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1052,41 +1010,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PartDescriptionComponent; - if(otherT == null) return false; + if(other is not PartDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Part, otherT.Part)) return false; - if(!comparer.Equals(PartLocation, otherT.PartLocation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Part, otherT._Part)) return false; + if(!comparer.Equals(_PartLocation, otherT._PartLocation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "part": - value = Part; - return Part is not null; + value = _Part; + return _Part is not null; case "partLocation": - value = PartLocation; - return PartLocation is not null; + value = _PartLocation; + return _PartLocation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "part": - Part = (Hl7.Fhir.Model.CodeableConcept)value; + Part = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "partLocation": - PartLocation = (Hl7.Fhir.Model.CodeableConcept)value; + PartLocation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1097,8 +1055,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Part is not null) yield return new KeyValuePair("part",Part); - if (PartLocation is not null) yield return new KeyValuePair("partLocation",PartLocation); + if (_Part is not null) yield return new KeyValuePair("part",_Part); + if (_PartLocation is not null) yield return new KeyValuePair("partLocation",_PartLocation); } } @@ -1108,80 +1066,77 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sourceMaterialClass", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SourceMaterialClass + public Hl7.Fhir.Model.CodeableConcept? SourceMaterialClass { get { return _SourceMaterialClass; } set { _SourceMaterialClass = value; OnPropertyChanged("SourceMaterialClass"); } } - private Hl7.Fhir.Model.CodeableConcept _SourceMaterialClass; + private Hl7.Fhir.Model.CodeableConcept? _SourceMaterialClass; /// /// The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent. /// [FhirElement("sourceMaterialType", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SourceMaterialType + public Hl7.Fhir.Model.CodeableConcept? SourceMaterialType { get { return _SourceMaterialType; } set { _SourceMaterialType = value; OnPropertyChanged("SourceMaterialType"); } } - private Hl7.Fhir.Model.CodeableConcept _SourceMaterialType; + private Hl7.Fhir.Model.CodeableConcept? _SourceMaterialType; /// /// The state of the source material when extracted. /// [FhirElement("sourceMaterialState", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SourceMaterialState + public Hl7.Fhir.Model.CodeableConcept? SourceMaterialState { get { return _SourceMaterialState; } set { _SourceMaterialState = value; OnPropertyChanged("SourceMaterialState"); } } - private Hl7.Fhir.Model.CodeableConcept _SourceMaterialState; + private Hl7.Fhir.Model.CodeableConcept? _SourceMaterialState; /// /// The unique identifier associated with the source material parent organism shall be specified. /// [FhirElement("organismId", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier OrganismId + public Hl7.Fhir.Model.Identifier? OrganismId { get { return _OrganismId; } set { _OrganismId = value; OnPropertyChanged("OrganismId"); } } - private Hl7.Fhir.Model.Identifier _OrganismId; + private Hl7.Fhir.Model.Identifier? _OrganismId; /// /// The organism accepted Scientific name shall be provided based on the organism taxonomy. /// [FhirElement("organismName", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString OrganismNameElement + public Hl7.Fhir.Model.FhirString? OrganismNameElement { get { return _OrganismNameElement; } set { _OrganismNameElement = value; OnPropertyChanged("OrganismNameElement"); } } - private Hl7.Fhir.Model.FhirString _OrganismNameElement; + private Hl7.Fhir.Model.FhirString? _OrganismNameElement; /// /// The organism accepted Scientific name shall be provided based on the organism taxonomy /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OrganismName + public string? OrganismName { - get { return OrganismNameElement != null ? OrganismNameElement.Value : null; } + get => _OrganismNameElement?.Value; set { - if (value == null) - OrganismNameElement = null; - else - OrganismNameElement = new Hl7.Fhir.Model.FhirString(value); + OrganismNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OrganismName"); } } @@ -1194,11 +1149,11 @@ public string OrganismName [DataMember] public List ParentSubstanceId { - get { if(_ParentSubstanceId==null) _ParentSubstanceId = new List(); return _ParentSubstanceId; } + get => _ParentSubstanceId ?? new List(); set { _ParentSubstanceId = value; OnPropertyChanged("ParentSubstanceId"); } } - private List _ParentSubstanceId; + private List? _ParentSubstanceId; /// /// The parent substance of the Herbal Drug, or Herbal preparation. @@ -1208,24 +1163,24 @@ public List ParentSubstanceId [DataMember] public List ParentSubstanceNameElement { - get { if(_ParentSubstanceNameElement==null) _ParentSubstanceNameElement = new List(); return _ParentSubstanceNameElement; } + get => _ParentSubstanceNameElement ?? new List(); set { _ParentSubstanceNameElement = value; OnPropertyChanged("ParentSubstanceNameElement"); } } - private List _ParentSubstanceNameElement; + private List? _ParentSubstanceNameElement; /// /// The parent substance of the Herbal Drug, or Herbal preparation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ParentSubstanceName + public IEnumerable? ParentSubstanceName { - get { return ParentSubstanceNameElement != null ? ParentSubstanceNameElement.Select(elem => elem.Value) : null; } + get => _ParentSubstanceNameElement?.Select(elem => elem.Value); set { if (value == null) - ParentSubstanceNameElement = null; + ParentSubstanceNameElement = null!; else ParentSubstanceNameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ParentSubstanceName"); @@ -1240,11 +1195,11 @@ public IEnumerable ParentSubstanceName [DataMember] public List CountryOfOrigin { - get { if(_CountryOfOrigin==null) _CountryOfOrigin = new List(); return _CountryOfOrigin; } + get => _CountryOfOrigin ?? new List(); set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } - private List _CountryOfOrigin; + private List? _CountryOfOrigin; /// /// The place/region where the plant is harvested or the places/regions where the animal source material has its habitat. @@ -1254,24 +1209,24 @@ public List CountryOfOrigin [DataMember] public List GeographicalLocationElement { - get { if(_GeographicalLocationElement==null) _GeographicalLocationElement = new List(); return _GeographicalLocationElement; } + get => _GeographicalLocationElement ?? new List(); set { _GeographicalLocationElement = value; OnPropertyChanged("GeographicalLocationElement"); } } - private List _GeographicalLocationElement; + private List? _GeographicalLocationElement; /// /// The place/region where the plant is harvested or the places/regions where the animal source material has its habitat /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable GeographicalLocation + public IEnumerable? GeographicalLocation { - get { return GeographicalLocationElement != null ? GeographicalLocationElement.Select(elem => elem.Value) : null; } + get => _GeographicalLocationElement?.Select(elem => elem.Value); set { if (value == null) - GeographicalLocationElement = null; + GeographicalLocationElement = null!; else GeographicalLocationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("GeographicalLocation"); @@ -1283,13 +1238,13 @@ public IEnumerable GeographicalLocation /// [FhirElement("developmentStage", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DevelopmentStage + public Hl7.Fhir.Model.CodeableConcept? DevelopmentStage { get { return _DevelopmentStage; } set { _DevelopmentStage = value; OnPropertyChanged("DevelopmentStage"); } } - private Hl7.Fhir.Model.CodeableConcept _DevelopmentStage; + private Hl7.Fhir.Model.CodeableConcept? _DevelopmentStage; /// /// Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels. @@ -1299,24 +1254,24 @@ public Hl7.Fhir.Model.CodeableConcept DevelopmentStage [DataMember] public List FractionDescription { - get { if(_FractionDescription==null) _FractionDescription = new List(); return _FractionDescription; } + get => _FractionDescription ?? new List(); set { _FractionDescription = value; OnPropertyChanged("FractionDescription"); } } - private List _FractionDescription; + private List? _FractionDescription; /// /// This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf. /// [FhirElement("organism", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent Organism + public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent? Organism { get { return _Organism; } set { _Organism = value; OnPropertyChanged("Organism"); } } - private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent _Organism; + private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent? _Organism; /// /// To do. @@ -1326,35 +1281,31 @@ public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent Organism [DataMember] public List PartDescription { - get { if(_PartDescription==null) _PartDescription = new List(); return _PartDescription; } + get => _PartDescription ?? new List(); set { _PartDescription = value; OnPropertyChanged("PartDescription"); } } - private List _PartDescription; + private List? _PartDescription; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceSourceMaterial; - - if (dest == null) - { + if(other is not SubstanceSourceMaterial dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceMaterialClass != null) dest.SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept)SourceMaterialClass.DeepCopyInternal(); - if(SourceMaterialType != null) dest.SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept)SourceMaterialType.DeepCopyInternal(); - if(SourceMaterialState != null) dest.SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept)SourceMaterialState.DeepCopyInternal(); - if(OrganismId != null) dest.OrganismId = (Hl7.Fhir.Model.Identifier)OrganismId.DeepCopyInternal(); - if(OrganismNameElement != null) dest.OrganismNameElement = (Hl7.Fhir.Model.FhirString)OrganismNameElement.DeepCopyInternal(); - if(ParentSubstanceId.Any()) dest.ParentSubstanceId = new List(ParentSubstanceId.DeepCopyInternal()); - if(ParentSubstanceNameElement.Any()) dest.ParentSubstanceNameElement = new List(ParentSubstanceNameElement.DeepCopyInternal()); - if(CountryOfOrigin.Any()) dest.CountryOfOrigin = new List(CountryOfOrigin.DeepCopyInternal()); - if(GeographicalLocationElement.Any()) dest.GeographicalLocationElement = new List(GeographicalLocationElement.DeepCopyInternal()); - if(DevelopmentStage != null) dest.DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept)DevelopmentStage.DeepCopyInternal(); - if(FractionDescription.Any()) dest.FractionDescription = new List(FractionDescription.DeepCopyInternal()); - if(Organism != null) dest.Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent)Organism.DeepCopyInternal(); - if(PartDescription.Any()) dest.PartDescription = new List(PartDescription.DeepCopyInternal()); + if(_SourceMaterialClass is not null) dest.SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept)_SourceMaterialClass.DeepCopyInternal(); + if(_SourceMaterialType is not null) dest.SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept)_SourceMaterialType.DeepCopyInternal(); + if(_SourceMaterialState is not null) dest.SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept)_SourceMaterialState.DeepCopyInternal(); + if(_OrganismId is not null) dest.OrganismId = (Hl7.Fhir.Model.Identifier)_OrganismId.DeepCopyInternal(); + if(_OrganismNameElement is not null) dest.OrganismNameElement = (Hl7.Fhir.Model.FhirString)_OrganismNameElement.DeepCopyInternal(); + if(_ParentSubstanceId is not null) dest.ParentSubstanceId = new List(_ParentSubstanceId.DeepCopyInternal()); + if(_ParentSubstanceNameElement is not null) dest.ParentSubstanceNameElement = new List(_ParentSubstanceNameElement.DeepCopyInternal()); + if(_CountryOfOrigin is not null) dest.CountryOfOrigin = new List(_CountryOfOrigin.DeepCopyInternal()); + if(_GeographicalLocationElement is not null) dest.GeographicalLocationElement = new List(_GeographicalLocationElement.DeepCopyInternal()); + if(_DevelopmentStage is not null) dest.DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept)_DevelopmentStage.DeepCopyInternal(); + if(_FractionDescription is not null) dest.FractionDescription = new List(_FractionDescription.DeepCopyInternal()); + if(_Organism is not null) dest.Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent)_Organism.DeepCopyInternal(); + if(_PartDescription is not null) dest.PartDescription = new List(_PartDescription.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1366,118 +1317,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceSourceMaterial; - if(otherT == null) return false; + if(other is not SubstanceSourceMaterial otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceMaterialClass, otherT.SourceMaterialClass)) return false; - if(!comparer.Equals(SourceMaterialType, otherT.SourceMaterialType)) return false; - if(!comparer.Equals(SourceMaterialState, otherT.SourceMaterialState)) return false; - if(!comparer.Equals(OrganismId, otherT.OrganismId)) return false; - if(!comparer.Equals(OrganismNameElement, otherT.OrganismNameElement)) return false; - if(!comparer.ListEquals(ParentSubstanceId, otherT.ParentSubstanceId)) return false; - if(!comparer.ListEquals(ParentSubstanceNameElement, otherT.ParentSubstanceNameElement)) return false; - if(!comparer.ListEquals(CountryOfOrigin, otherT.CountryOfOrigin)) return false; - if(!comparer.ListEquals(GeographicalLocationElement, otherT.GeographicalLocationElement)) return false; - if(!comparer.Equals(DevelopmentStage, otherT.DevelopmentStage)) return false; - if(!comparer.ListEquals(FractionDescription, otherT.FractionDescription)) return false; - if(!comparer.Equals(Organism, otherT.Organism)) return false; - if(!comparer.ListEquals(PartDescription, otherT.PartDescription)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceMaterialClass, otherT._SourceMaterialClass)) return false; + if(!comparer.Equals(_SourceMaterialType, otherT._SourceMaterialType)) return false; + if(!comparer.Equals(_SourceMaterialState, otherT._SourceMaterialState)) return false; + if(!comparer.Equals(_OrganismId, otherT._OrganismId)) return false; + if(!comparer.Equals(_OrganismNameElement, otherT._OrganismNameElement)) return false; + if(!comparer.ListEquals(_ParentSubstanceId, otherT._ParentSubstanceId)) return false; + if(!comparer.ListEquals(_ParentSubstanceNameElement, otherT._ParentSubstanceNameElement)) return false; + if(!comparer.ListEquals(_CountryOfOrigin, otherT._CountryOfOrigin)) return false; + if(!comparer.ListEquals(_GeographicalLocationElement, otherT._GeographicalLocationElement)) return false; + if(!comparer.Equals(_DevelopmentStage, otherT._DevelopmentStage)) return false; + if(!comparer.ListEquals(_FractionDescription, otherT._FractionDescription)) return false; + if(!comparer.Equals(_Organism, otherT._Organism)) return false; + if(!comparer.ListEquals(_PartDescription, otherT._PartDescription)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sourceMaterialClass": - value = SourceMaterialClass; - return SourceMaterialClass is not null; + value = _SourceMaterialClass; + return _SourceMaterialClass is not null; case "sourceMaterialType": - value = SourceMaterialType; - return SourceMaterialType is not null; + value = _SourceMaterialType; + return _SourceMaterialType is not null; case "sourceMaterialState": - value = SourceMaterialState; - return SourceMaterialState is not null; + value = _SourceMaterialState; + return _SourceMaterialState is not null; case "organismId": - value = OrganismId; - return OrganismId is not null; + value = _OrganismId; + return _OrganismId is not null; case "organismName": - value = OrganismNameElement; - return OrganismNameElement is not null; + value = _OrganismNameElement; + return _OrganismNameElement is not null; case "parentSubstanceId": - value = ParentSubstanceId; - return ParentSubstanceId?.Any() == true; + value = _ParentSubstanceId; + return _ParentSubstanceId?.Any() == true; case "parentSubstanceName": - value = ParentSubstanceNameElement; - return ParentSubstanceNameElement?.Any() == true; + value = _ParentSubstanceNameElement; + return _ParentSubstanceNameElement?.Any() == true; case "countryOfOrigin": - value = CountryOfOrigin; - return CountryOfOrigin?.Any() == true; + value = _CountryOfOrigin; + return _CountryOfOrigin?.Any() == true; case "geographicalLocation": - value = GeographicalLocationElement; - return GeographicalLocationElement?.Any() == true; + value = _GeographicalLocationElement; + return _GeographicalLocationElement?.Any() == true; case "developmentStage": - value = DevelopmentStage; - return DevelopmentStage is not null; + value = _DevelopmentStage; + return _DevelopmentStage is not null; case "fractionDescription": - value = FractionDescription; - return FractionDescription?.Any() == true; + value = _FractionDescription; + return _FractionDescription?.Any() == true; case "organism": - value = Organism; - return Organism is not null; + value = _Organism; + return _Organism is not null; case "partDescription": - value = PartDescription; - return PartDescription?.Any() == true; + value = _PartDescription; + return _PartDescription?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sourceMaterialClass": - SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept)value; + SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sourceMaterialType": - SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept)value; + SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sourceMaterialState": - SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept)value; + SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "organismId": - OrganismId = (Hl7.Fhir.Model.Identifier)value; + OrganismId = (Hl7.Fhir.Model.Identifier?)value; return this; case "organismName": - OrganismNameElement = (Hl7.Fhir.Model.FhirString)value; + OrganismNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "parentSubstanceId": - ParentSubstanceId = (List)value; + ParentSubstanceId = (List?)value!; return this; case "parentSubstanceName": - ParentSubstanceNameElement = (List)value; + ParentSubstanceNameElement = (List?)value!; return this; case "countryOfOrigin": - CountryOfOrigin = (List)value; + CountryOfOrigin = (List?)value!; return this; case "geographicalLocation": - GeographicalLocationElement = (List)value; + GeographicalLocationElement = (List?)value!; return this; case "developmentStage": - DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept)value; + DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fractionDescription": - FractionDescription = (List)value; + FractionDescription = (List?)value!; return this; case "organism": - Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent)value; + Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent?)value; return this; case "partDescription": - PartDescription = (List)value; + PartDescription = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1488,19 +1439,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceMaterialClass is not null) yield return new KeyValuePair("sourceMaterialClass",SourceMaterialClass); - if (SourceMaterialType is not null) yield return new KeyValuePair("sourceMaterialType",SourceMaterialType); - if (SourceMaterialState is not null) yield return new KeyValuePair("sourceMaterialState",SourceMaterialState); - if (OrganismId is not null) yield return new KeyValuePair("organismId",OrganismId); - if (OrganismNameElement is not null) yield return new KeyValuePair("organismName",OrganismNameElement); - if (ParentSubstanceId?.Any() == true) yield return new KeyValuePair("parentSubstanceId",ParentSubstanceId); - if (ParentSubstanceNameElement?.Any() == true) yield return new KeyValuePair("parentSubstanceName",ParentSubstanceNameElement); - if (CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",CountryOfOrigin); - if (GeographicalLocationElement?.Any() == true) yield return new KeyValuePair("geographicalLocation",GeographicalLocationElement); - if (DevelopmentStage is not null) yield return new KeyValuePair("developmentStage",DevelopmentStage); - if (FractionDescription?.Any() == true) yield return new KeyValuePair("fractionDescription",FractionDescription); - if (Organism is not null) yield return new KeyValuePair("organism",Organism); - if (PartDescription?.Any() == true) yield return new KeyValuePair("partDescription",PartDescription); + if (_SourceMaterialClass is not null) yield return new KeyValuePair("sourceMaterialClass",_SourceMaterialClass); + if (_SourceMaterialType is not null) yield return new KeyValuePair("sourceMaterialType",_SourceMaterialType); + if (_SourceMaterialState is not null) yield return new KeyValuePair("sourceMaterialState",_SourceMaterialState); + if (_OrganismId is not null) yield return new KeyValuePair("organismId",_OrganismId); + if (_OrganismNameElement is not null) yield return new KeyValuePair("organismName",_OrganismNameElement); + if (_ParentSubstanceId?.Any() == true) yield return new KeyValuePair("parentSubstanceId",_ParentSubstanceId); + if (_ParentSubstanceNameElement?.Any() == true) yield return new KeyValuePair("parentSubstanceName",_ParentSubstanceNameElement); + if (_CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",_CountryOfOrigin); + if (_GeographicalLocationElement?.Any() == true) yield return new KeyValuePair("geographicalLocation",_GeographicalLocationElement); + if (_DevelopmentStage is not null) yield return new KeyValuePair("developmentStage",_DevelopmentStage); + if (_FractionDescription?.Any() == true) yield return new KeyValuePair("fractionDescription",_FractionDescription); + if (_Organism is not null) yield return new KeyValuePair("organism",_Organism); + if (_PartDescription?.Any() == true) yield return new KeyValuePair("partDescription",_PartDescription); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs index 22235c491..cd4a7fa66 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SubstanceSpecification","http://hl7.org/fhir/StructureDefinition/SubstanceSpecification")] - public partial class SubstanceSpecification : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class SubstanceSpecification : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -74,54 +77,51 @@ public partial class MoietyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("role", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Identifier by which this moiety substance is known. /// [FhirElement("identifier", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Textual name for this moiety substance. /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Textual name for this moiety substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -131,54 +131,51 @@ public string Name /// [FhirElement("stereochemistry", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Stereochemistry + public Hl7.Fhir.Model.CodeableConcept? Stereochemistry { get { return _Stereochemistry; } set { _Stereochemistry = value; OnPropertyChanged("Stereochemistry"); } } - private Hl7.Fhir.Model.CodeableConcept _Stereochemistry; + private Hl7.Fhir.Model.CodeableConcept? _Stereochemistry; /// /// Optical activity type. /// [FhirElement("opticalActivity", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OpticalActivity + public Hl7.Fhir.Model.CodeableConcept? OpticalActivity { get { return _OpticalActivity; } set { _OpticalActivity = value; OnPropertyChanged("OpticalActivity"); } } - private Hl7.Fhir.Model.CodeableConcept _OpticalActivity; + private Hl7.Fhir.Model.CodeableConcept? _OpticalActivity; /// /// Molecular formula. /// [FhirElement("molecularFormula", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaElement { get { return _MolecularFormulaElement; } set { _MolecularFormulaElement = value; OnPropertyChanged("MolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaElement; /// /// Molecular formula /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormula + public string? MolecularFormula { - get { return MolecularFormulaElement != null ? MolecularFormulaElement.Value : null; } + get => _MolecularFormulaElement?.Value; set { - if (value == null) - MolecularFormulaElement = null; - else - MolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormula"); } } @@ -190,31 +187,27 @@ public string MolecularFormula [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as MoietyComponent; - - if (dest == null) - { + if(other is not MoietyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Stereochemistry != null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)Stereochemistry.DeepCopyInternal(); - if(OpticalActivity != null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)OpticalActivity.DeepCopyInternal(); - if(MolecularFormulaElement != null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Stereochemistry is not null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)_Stereochemistry.DeepCopyInternal(); + if(_OpticalActivity is not null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)_OpticalActivity.DeepCopyInternal(); + if(_MolecularFormulaElement is not null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -226,76 +219,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MoietyComponent; - if(otherT == null) return false; + if(other is not MoietyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Stereochemistry, otherT.Stereochemistry)) return false; - if(!comparer.Equals(OpticalActivity, otherT.OpticalActivity)) return false; - if(!comparer.Equals(MolecularFormulaElement, otherT.MolecularFormulaElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; + if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "stereochemistry": - value = Stereochemistry; - return Stereochemistry is not null; + value = _Stereochemistry; + return _Stereochemistry is not null; case "opticalActivity": - value = OpticalActivity; - return OpticalActivity is not null; + value = _OpticalActivity; + return _OpticalActivity is not null; case "molecularFormula": - value = MolecularFormulaElement; - return MolecularFormulaElement is not null; + value = _MolecularFormulaElement; + return _MolecularFormulaElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "stereochemistry": - Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)value; + Stereochemistry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "opticalActivity": - OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)value; + OpticalActivity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "molecularFormula": - MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -306,13 +299,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",Stereochemistry); - if (OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",OpticalActivity); - if (MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",MolecularFormulaElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",_Stereochemistry); + if (_OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",_OpticalActivity); + if (_MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",_MolecularFormulaElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -335,54 +328,51 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("category", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Property type e.g. viscosity, pH, isoelectric point. /// [FhirElement("code", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Parameters that were used in the measurement of a property (e.g. for viscosity: measured at 20C with a pH of 7.1). /// [FhirElement("parameters", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ParametersElement + public Hl7.Fhir.Model.FhirString? ParametersElement { get { return _ParametersElement; } set { _ParametersElement = value; OnPropertyChanged("ParametersElement"); } } - private Hl7.Fhir.Model.FhirString _ParametersElement; + private Hl7.Fhir.Model.FhirString? _ParametersElement; /// /// Parameters that were used in the measurement of a property (e.g. for viscosity: measured at 20C with a pH of 7.1) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Parameters + public string? Parameters { - get { return ParametersElement != null ? ParametersElement.Value : null; } + get => _ParametersElement?.Value; set { - if (value == null) - ParametersElement = null; - else - ParametersElement = new Hl7.Fhir.Model.FhirString(value); + ParametersElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Parameters"); } } @@ -395,13 +385,13 @@ public string Parameters [References("SubstanceSpecification","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType DefiningSubstance + public Hl7.Fhir.Model.DataType? DefiningSubstance { get { return _DefiningSubstance; } set { _DefiningSubstance = value; OnPropertyChanged("DefiningSubstance"); } } - private Hl7.Fhir.Model.DataType _DefiningSubstance; + private Hl7.Fhir.Model.DataType? _DefiningSubstance; /// /// Quantitative value for this property. @@ -410,29 +400,25 @@ public Hl7.Fhir.Model.DataType DefiningSubstance [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ParametersElement != null) dest.ParametersElement = (Hl7.Fhir.Model.FhirString)ParametersElement.DeepCopyInternal(); - if(DefiningSubstance != null) dest.DefiningSubstance = (Hl7.Fhir.Model.DataType)DefiningSubstance.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ParametersElement is not null) dest.ParametersElement = (Hl7.Fhir.Model.FhirString)_ParametersElement.DeepCopyInternal(); + if(_DefiningSubstance is not null) dest.DefiningSubstance = (Hl7.Fhir.Model.DataType)_DefiningSubstance.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -444,62 +430,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(ParametersElement, otherT.ParametersElement)) return false; - if(!comparer.Equals(DefiningSubstance, otherT.DefiningSubstance)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_ParametersElement, otherT._ParametersElement)) return false; + if(!comparer.Equals(_DefiningSubstance, otherT._DefiningSubstance)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "parameters": - value = ParametersElement; - return ParametersElement is not null; + value = _ParametersElement; + return _ParametersElement is not null; case "definingSubstance": - value = DefiningSubstance; - return DefiningSubstance is not null; + value = _DefiningSubstance; + return _DefiningSubstance is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "parameters": - ParametersElement = (Hl7.Fhir.Model.FhirString)value; + ParametersElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definingSubstance": - DefiningSubstance = (Hl7.Fhir.Model.DataType)value; + DefiningSubstance = (Hl7.Fhir.Model.DataType?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -510,11 +496,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ParametersElement is not null) yield return new KeyValuePair("parameters",ParametersElement); - if (DefiningSubstance is not null) yield return new KeyValuePair("definingSubstance",DefiningSubstance); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ParametersElement is not null) yield return new KeyValuePair("parameters",_ParametersElement); + if (_DefiningSubstance is not null) yield return new KeyValuePair("definingSubstance",_DefiningSubstance); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -537,54 +523,51 @@ public partial class StructureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("stereochemistry", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Stereochemistry + public Hl7.Fhir.Model.CodeableConcept? Stereochemistry { get { return _Stereochemistry; } set { _Stereochemistry = value; OnPropertyChanged("Stereochemistry"); } } - private Hl7.Fhir.Model.CodeableConcept _Stereochemistry; + private Hl7.Fhir.Model.CodeableConcept? _Stereochemistry; /// /// Optical activity type. /// [FhirElement("opticalActivity", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OpticalActivity + public Hl7.Fhir.Model.CodeableConcept? OpticalActivity { get { return _OpticalActivity; } set { _OpticalActivity = value; OnPropertyChanged("OpticalActivity"); } } - private Hl7.Fhir.Model.CodeableConcept _OpticalActivity; + private Hl7.Fhir.Model.CodeableConcept? _OpticalActivity; /// /// Molecular formula. /// [FhirElement("molecularFormula", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaElement { get { return _MolecularFormulaElement; } set { _MolecularFormulaElement = value; OnPropertyChanged("MolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaElement; /// /// Molecular formula /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormula + public string? MolecularFormula { - get { return MolecularFormulaElement != null ? MolecularFormulaElement.Value : null; } + get => _MolecularFormulaElement?.Value; set { - if (value == null) - MolecularFormulaElement = null; - else - MolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormula"); } } @@ -594,28 +577,25 @@ public string MolecularFormula /// [FhirElement("molecularFormulaByMoiety", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaByMoietyElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaByMoietyElement { get { return _MolecularFormulaByMoietyElement; } set { _MolecularFormulaByMoietyElement = value; OnPropertyChanged("MolecularFormulaByMoietyElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaByMoietyElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaByMoietyElement; /// /// Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormulaByMoiety + public string? MolecularFormulaByMoiety { - get { return MolecularFormulaByMoietyElement != null ? MolecularFormulaByMoietyElement.Value : null; } + get => _MolecularFormulaByMoietyElement?.Value; set { - if (value == null) - MolecularFormulaByMoietyElement = null; - else - MolecularFormulaByMoietyElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaByMoietyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormulaByMoiety"); } } @@ -628,24 +608,24 @@ public string MolecularFormulaByMoiety [DataMember] public List Isotope { - get { if(_Isotope==null) _Isotope = new List(); return _Isotope; } + get => _Isotope ?? new List(); set { _Isotope = value; OnPropertyChanged("Isotope"); } } - private List _Isotope; + private List? _Isotope; /// /// The molecular weight or weight range (for proteins, polymers or nucleic acids). /// [FhirElement("molecularWeight", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent MolecularWeight + public Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent? MolecularWeight { get { return _MolecularWeight; } set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } - private Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent _MolecularWeight; + private Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent? _MolecularWeight; /// /// Supporting literature. @@ -657,11 +637,11 @@ public Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent MolecularW [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; /// /// Molecular structural representation. @@ -671,30 +651,26 @@ public List Source [DataMember] public List Representation { - get { if(_Representation==null) _Representation = new List(); return _Representation; } + get => _Representation ?? new List(); set { _Representation = value; OnPropertyChanged("Representation"); } } - private List _Representation; + private List? _Representation; protected internal override void CopyToInternal(Base other) { - var dest = other as StructureComponent; - - if (dest == null) - { + if(other is not StructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Stereochemistry != null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)Stereochemistry.DeepCopyInternal(); - if(OpticalActivity != null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)OpticalActivity.DeepCopyInternal(); - if(MolecularFormulaElement != null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaElement.DeepCopyInternal(); - if(MolecularFormulaByMoietyElement != null) dest.MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaByMoietyElement.DeepCopyInternal(); - if(Isotope.Any()) dest.Isotope = new List(Isotope.DeepCopyInternal()); - if(MolecularWeight != null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent)MolecularWeight.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); - if(Representation.Any()) dest.Representation = new List(Representation.DeepCopyInternal()); + if(_Stereochemistry is not null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)_Stereochemistry.DeepCopyInternal(); + if(_OpticalActivity is not null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)_OpticalActivity.DeepCopyInternal(); + if(_MolecularFormulaElement is not null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaElement.DeepCopyInternal(); + if(_MolecularFormulaByMoietyElement is not null) dest.MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaByMoietyElement.DeepCopyInternal(); + if(_Isotope is not null) dest.Isotope = new List(_Isotope.DeepCopyInternal()); + if(_MolecularWeight is not null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent)_MolecularWeight.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); + if(_Representation is not null) dest.Representation = new List(_Representation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -706,83 +682,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureComponent; - if(otherT == null) return false; + if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Stereochemistry, otherT.Stereochemistry)) return false; - if(!comparer.Equals(OpticalActivity, otherT.OpticalActivity)) return false; - if(!comparer.Equals(MolecularFormulaElement, otherT.MolecularFormulaElement)) return false; - if(!comparer.Equals(MolecularFormulaByMoietyElement, otherT.MolecularFormulaByMoietyElement)) return false; - if(!comparer.ListEquals(Isotope, otherT.Isotope)) return false; - if(!comparer.Equals(MolecularWeight, otherT.MolecularWeight)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Representation, otherT.Representation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; + if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; + if(!comparer.Equals(_MolecularFormulaByMoietyElement, otherT._MolecularFormulaByMoietyElement)) return false; + if(!comparer.ListEquals(_Isotope, otherT._Isotope)) return false; + if(!comparer.Equals(_MolecularWeight, otherT._MolecularWeight)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Representation, otherT._Representation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "stereochemistry": - value = Stereochemistry; - return Stereochemistry is not null; + value = _Stereochemistry; + return _Stereochemistry is not null; case "opticalActivity": - value = OpticalActivity; - return OpticalActivity is not null; + value = _OpticalActivity; + return _OpticalActivity is not null; case "molecularFormula": - value = MolecularFormulaElement; - return MolecularFormulaElement is not null; + value = _MolecularFormulaElement; + return _MolecularFormulaElement is not null; case "molecularFormulaByMoiety": - value = MolecularFormulaByMoietyElement; - return MolecularFormulaByMoietyElement is not null; + value = _MolecularFormulaByMoietyElement; + return _MolecularFormulaByMoietyElement is not null; case "isotope": - value = Isotope; - return Isotope?.Any() == true; + value = _Isotope; + return _Isotope?.Any() == true; case "molecularWeight": - value = MolecularWeight; - return MolecularWeight is not null; + value = _MolecularWeight; + return _MolecularWeight is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; case "representation": - value = Representation; - return Representation?.Any() == true; + value = _Representation; + return _Representation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "stereochemistry": - Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)value; + Stereochemistry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "opticalActivity": - OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)value; + OpticalActivity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "molecularFormula": - MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "molecularFormulaByMoiety": - MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "isotope": - Isotope = (List)value; + Isotope = (List?)value!; return this; case "molecularWeight": - MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent)value; + MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; case "representation": - Representation = (List)value; + Representation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -793,14 +769,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",Stereochemistry); - if (OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",OpticalActivity); - if (MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",MolecularFormulaElement); - if (MolecularFormulaByMoietyElement is not null) yield return new KeyValuePair("molecularFormulaByMoiety",MolecularFormulaByMoietyElement); - if (Isotope?.Any() == true) yield return new KeyValuePair("isotope",Isotope); - if (MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",MolecularWeight); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); - if (Representation?.Any() == true) yield return new KeyValuePair("representation",Representation); + if (_Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",_Stereochemistry); + if (_OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",_OpticalActivity); + if (_MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",_MolecularFormulaElement); + if (_MolecularFormulaByMoietyElement is not null) yield return new KeyValuePair("molecularFormulaByMoiety",_MolecularFormulaByMoietyElement); + if (_Isotope?.Any() == true) yield return new KeyValuePair("isotope",_Isotope); + if (_MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",_MolecularWeight); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); + if (_Representation?.Any() == true) yield return new KeyValuePair("representation",_Representation); } } @@ -823,81 +799,77 @@ public partial class IsotopeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Substance name for each non-natural or radioisotope. /// [FhirElement("name", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Name + public Hl7.Fhir.Model.CodeableConcept? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.CodeableConcept _Name; + private Hl7.Fhir.Model.CodeableConcept? _Name; /// /// The type of isotopic substitution present in a single substance. /// [FhirElement("substitution", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substitution + public Hl7.Fhir.Model.CodeableConcept? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.CodeableConcept _Substitution; + private Hl7.Fhir.Model.CodeableConcept? _Substitution; /// /// Half life - for a non-natural nuclide. /// [FhirElement("halfLife", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity HalfLife + public Hl7.Fhir.Model.Quantity? HalfLife { get { return _HalfLife; } set { _HalfLife = value; OnPropertyChanged("HalfLife"); } } - private Hl7.Fhir.Model.Quantity _HalfLife; + private Hl7.Fhir.Model.Quantity? _HalfLife; /// /// The molecular weight or weight range (for proteins, polymers or nucleic acids). /// [FhirElement("molecularWeight", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent MolecularWeight + public Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent? MolecularWeight { get { return _MolecularWeight; } set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } - private Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent _MolecularWeight; + private Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent? _MolecularWeight; protected internal override void CopyToInternal(Base other) { - var dest = other as IsotopeComponent; - - if (dest == null) - { + if(other is not IsotopeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Name != null) dest.Name = (Hl7.Fhir.Model.CodeableConcept)Name.DeepCopyInternal(); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.CodeableConcept)Substitution.DeepCopyInternal(); - if(HalfLife != null) dest.HalfLife = (Hl7.Fhir.Model.Quantity)HalfLife.DeepCopyInternal(); - if(MolecularWeight != null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent)MolecularWeight.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.CodeableConcept)_Name.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.CodeableConcept)_Substitution.DeepCopyInternal(); + if(_HalfLife is not null) dest.HalfLife = (Hl7.Fhir.Model.Quantity)_HalfLife.DeepCopyInternal(); + if(_MolecularWeight is not null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent)_MolecularWeight.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -909,62 +881,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IsotopeComponent; - if(otherT == null) return false; + if(other is not IsotopeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.Equals(HalfLife, otherT.HalfLife)) return false; - if(!comparer.Equals(MolecularWeight, otherT.MolecularWeight)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.Equals(_HalfLife, otherT._HalfLife)) return false; + if(!comparer.Equals(_MolecularWeight, otherT._MolecularWeight)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "halfLife": - value = HalfLife; - return HalfLife is not null; + value = _HalfLife; + return _HalfLife is not null; case "molecularWeight": - value = MolecularWeight; - return MolecularWeight is not null; + value = _MolecularWeight; + return _MolecularWeight is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - Name = (Hl7.Fhir.Model.CodeableConcept)value; + Name = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.CodeableConcept)value; + Substitution = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "halfLife": - HalfLife = (Hl7.Fhir.Model.Quantity)value; + HalfLife = (Hl7.Fhir.Model.Quantity?)value; return this; case "molecularWeight": - MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent)value; + MolecularWeight = (Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent?)value; return this; default: return base.SetValue(key, value); @@ -975,11 +947,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (HalfLife is not null) yield return new KeyValuePair("halfLife",HalfLife); - if (MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",MolecularWeight); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_HalfLife is not null) yield return new KeyValuePair("halfLife",_HalfLife); + if (_MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",_MolecularWeight); } } @@ -1002,53 +974,49 @@ public partial class MolecularWeightComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("method", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of molecular weight such as exact, average (also known as. number average), weight average. /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field. /// [FhirElement("amount", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as MolecularWeightComponent; - - if (dest == null) - { + if(other is not MolecularWeightComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1060,48 +1028,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MolecularWeightComponent; - if(otherT == null) return false; + if(other is not MolecularWeightComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -1112,9 +1080,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -1137,41 +1105,38 @@ public partial class RepresentationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The structural representation as text string in a format e.g. InChI, SMILES, MOLFILE, CDX. /// [FhirElement("representation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RepresentationElement + public Hl7.Fhir.Model.FhirString? RepresentationElement { get { return _RepresentationElement; } set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } - private Hl7.Fhir.Model.FhirString _RepresentationElement; + private Hl7.Fhir.Model.FhirString? _RepresentationElement; /// /// The structural representation as text string in a format e.g. InChI, SMILES, MOLFILE, CDX /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Representation + public string? Representation { - get { return RepresentationElement != null ? RepresentationElement.Value : null; } + get => _RepresentationElement?.Value; set { - if (value == null) - RepresentationElement = null; - else - RepresentationElement = new Hl7.Fhir.Model.FhirString(value); + RepresentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Representation"); } } @@ -1181,27 +1146,23 @@ public string Representation /// [FhirElement("attachment", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Attachment Attachment + public Hl7.Fhir.Model.Attachment? Attachment { get { return _Attachment; } set { _Attachment = value; OnPropertyChanged("Attachment"); } } - private Hl7.Fhir.Model.Attachment _Attachment; + private Hl7.Fhir.Model.Attachment? _Attachment; protected internal override void CopyToInternal(Base other) { - var dest = other as RepresentationComponent; - - if (dest == null) - { + if(other is not RepresentationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RepresentationElement != null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)RepresentationElement.DeepCopyInternal(); - if(Attachment != null) dest.Attachment = (Hl7.Fhir.Model.Attachment)Attachment.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RepresentationElement is not null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)_RepresentationElement.DeepCopyInternal(); + if(_Attachment is not null) dest.Attachment = (Hl7.Fhir.Model.Attachment)_Attachment.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1213,48 +1174,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepresentationComponent; - if(otherT == null) return false; + if(other is not RepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RepresentationElement, otherT.RepresentationElement)) return false; - if(!comparer.Equals(Attachment, otherT.Attachment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; + if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "representation": - value = RepresentationElement; - return RepresentationElement is not null; + value = _RepresentationElement; + return _RepresentationElement is not null; case "attachment": - value = Attachment; - return Attachment is not null; + value = _Attachment; + return _Attachment is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "representation": - RepresentationElement = (Hl7.Fhir.Model.FhirString)value; + RepresentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "attachment": - Attachment = (Hl7.Fhir.Model.Attachment)value; + Attachment = (Hl7.Fhir.Model.Attachment?)value; return this; default: return base.SetValue(key, value); @@ -1265,9 +1226,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RepresentationElement is not null) yield return new KeyValuePair("representation",RepresentationElement); - if (Attachment is not null) yield return new KeyValuePair("attachment",Attachment); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RepresentationElement is not null) yield return new KeyValuePair("representation",_RepresentationElement); + if (_Attachment is not null) yield return new KeyValuePair("attachment",_Attachment); } } @@ -1290,54 +1251,51 @@ public partial class CodeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Status of the code assignment. /// [FhirElement("status", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the code status is changed as part of the terminology maintenance. /// [FhirElement("statusDate", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the code status is changed as part of the terminology maintenance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -1347,28 +1305,25 @@ public string StatusDate /// [FhirElement("comment", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Any comment can be provided in this field, if necessary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -1383,27 +1338,23 @@ public string Comment [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as CodeComponent; - - if (dest == null) - { + if(other is not CodeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1415,62 +1366,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeComponent; - if(otherT == null) return false; + if(other is not CodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1481,11 +1432,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -1509,28 +1460,25 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The actual name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1540,39 +1488,39 @@ public string Name /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The status of the name. /// [FhirElement("status", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// If this is the preferred name for this substance. /// [FhirElement("preferred", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// If this is the preferred name for this substance @@ -1581,13 +1529,10 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } @@ -1600,11 +1545,11 @@ public bool? Preferred [DataMember] public List Language { - get { if(_Language==null) _Language = new List(); return _Language; } + get => _Language ?? new List(); set { _Language = value; OnPropertyChanged("Language"); } } - private List _Language; + private List? _Language; /// /// The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive. @@ -1614,11 +1559,11 @@ public List Language [DataMember] public List Domain { - get { if(_Domain==null) _Domain = new List(); return _Domain; } + get => _Domain ?? new List(); set { _Domain = value; OnPropertyChanged("Domain"); } } - private List _Domain; + private List? _Domain; /// /// The jurisdiction where this name applies. @@ -1628,11 +1573,11 @@ public List Domain [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// A synonym of this name. @@ -1642,11 +1587,11 @@ public List Jurisdiction [DataMember] public List Synonym { - get { if(_Synonym==null) _Synonym = new List(); return _Synonym; } + get => _Synonym ?? new List(); set { _Synonym = value; OnPropertyChanged("Synonym"); } } - private List _Synonym; + private List? _Synonym; /// /// A translation for this name. @@ -1656,11 +1601,11 @@ public List Synonym [DataMember] public List Translation { - get { if(_Translation==null) _Translation = new List(); return _Translation; } + get => _Translation ?? new List(); set { _Translation = value; OnPropertyChanged("Translation"); } } - private List _Translation; + private List? _Translation; /// /// Details of the official nature of this name. @@ -1670,11 +1615,11 @@ public List Translation [DataMember] public List Official { - get { if(_Official==null) _Official = new List(); return _Official; } + get => _Official ?? new List(); set { _Official = value; OnPropertyChanged("Official"); } } - private List _Official; + private List? _Official; /// /// Supporting literature. @@ -1686,33 +1631,29 @@ public List Official [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); - if(Language.Any()) dest.Language = new List(Language.DeepCopyInternal()); - if(Domain.Any()) dest.Domain = new List(Domain.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Synonym.Any()) dest.Synonym = new List(Synonym.DeepCopyInternal()); - if(Translation.Any()) dest.Translation = new List(Translation.DeepCopyInternal()); - if(Official.Any()) dest.Official = new List(Official.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = new List(_Language.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = new List(_Domain.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Synonym is not null) dest.Synonym = new List(_Synonym.DeepCopyInternal()); + if(_Translation is not null) dest.Translation = new List(_Translation.DeepCopyInternal()); + if(_Official is not null) dest.Official = new List(_Official.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1724,104 +1665,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; - if(!comparer.ListEquals(Language, otherT.Language)) return false; - if(!comparer.ListEquals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Synonym, otherT.Synonym)) return false; - if(!comparer.ListEquals(Translation, otherT.Translation)) return false; - if(!comparer.ListEquals(Official, otherT.Official)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; + if(!comparer.ListEquals(_Language, otherT._Language)) return false; + if(!comparer.ListEquals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Synonym, otherT._Synonym)) return false; + if(!comparer.ListEquals(_Translation, otherT._Translation)) return false; + if(!comparer.ListEquals(_Official, otherT._Official)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; case "language": - value = Language; - return Language?.Any() == true; + value = _Language; + return _Language?.Any() == true; case "domain": - value = Domain; - return Domain?.Any() == true; + value = _Domain; + return _Domain?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "synonym": - value = Synonym; - return Synonym?.Any() == true; + value = _Synonym; + return _Synonym?.Any() == true; case "translation": - value = Translation; - return Translation?.Any() == true; + value = _Translation; + return _Translation?.Any() == true; case "official": - value = Official; - return Official?.Any() == true; + value = _Official; + return _Official?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "language": - Language = (List)value; + Language = (List?)value!; return this; case "domain": - Domain = (List)value; + Domain = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "synonym": - Synonym = (List)value; + Synonym = (List?)value!; return this; case "translation": - Translation = (List)value; + Translation = (List?)value!; return this; case "official": - Official = (List)value; + Official = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1832,17 +1773,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); - if (Language?.Any() == true) yield return new KeyValuePair("language",Language); - if (Domain?.Any() == true) yield return new KeyValuePair("domain",Domain); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Synonym?.Any() == true) yield return new KeyValuePair("synonym",Synonym); - if (Translation?.Any() == true) yield return new KeyValuePair("translation",Translation); - if (Official?.Any() == true) yield return new KeyValuePair("official",Official); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); + if (_Language?.Any() == true) yield return new KeyValuePair("language",_Language); + if (_Domain?.Any() == true) yield return new KeyValuePair("domain",_Domain); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Synonym?.Any() == true) yield return new KeyValuePair("synonym",_Synonym); + if (_Translation?.Any() == true) yield return new KeyValuePair("translation",_Translation); + if (_Official?.Any() == true) yield return new KeyValuePair("official",_Official); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -1865,71 +1806,64 @@ public partial class OfficialComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("authority", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Authority + public Hl7.Fhir.Model.CodeableConcept? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.CodeableConcept _Authority; + private Hl7.Fhir.Model.CodeableConcept? _Authority; /// /// The status of the official name. /// [FhirElement("status", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Date of official name change. /// [FhirElement("date", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date of official name change /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OfficialComponent; - - if (dest == null) - { + if(other is not OfficialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.CodeableConcept)Authority.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.CodeableConcept)_Authority.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1941,48 +1875,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OfficialComponent; - if(otherT == null) return false; + if(other is not OfficialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authority": - Authority = (Hl7.Fhir.Model.CodeableConcept)value; + Authority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -1993,9 +1927,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); } } @@ -2021,39 +1955,39 @@ public partial class RelationshipComponent : Hl7.Fhir.Model.BackboneElement [References("SubstanceSpecification")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Substance + public Hl7.Fhir.Model.DataType? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.DataType _Substance; + private Hl7.Fhir.Model.DataType? _Substance; /// /// For example "salt to parent", "active moiety", "starting material". /// [FhirElement("relationship", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships. /// [FhirElement("isDefining", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefiningElement + public Hl7.Fhir.Model.FhirBoolean? IsDefiningElement { get { return _IsDefiningElement; } set { _IsDefiningElement = value; OnPropertyChanged("IsDefiningElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefiningElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefiningElement; /// /// For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships @@ -2062,13 +1996,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefiningElement [IgnoreDataMember] public bool? IsDefining { - get { return IsDefiningElement != null ? IsDefiningElement.Value : null; } + get => _IsDefiningElement?.Value; set { - if (value == null) - IsDefiningElement = null; - else - IsDefiningElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefiningElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefining"); } } @@ -2080,39 +2011,39 @@ public bool? IsDefining [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// For use when the numeric. /// [FhirElement("amountRatioLowLimit", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Ratio AmountRatioLowLimit + public Hl7.Fhir.Model.Ratio? AmountRatioLowLimit { get { return _AmountRatioLowLimit; } set { _AmountRatioLowLimit = value; OnPropertyChanged("AmountRatioLowLimit"); } } - private Hl7.Fhir.Model.Ratio _AmountRatioLowLimit; + private Hl7.Fhir.Model.Ratio? _AmountRatioLowLimit; /// /// An operator for the amount, for example "average", "approximately", "less than". /// [FhirElement("amountType", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AmountType + public Hl7.Fhir.Model.CodeableConcept? AmountType { get { return _AmountType; } set { _AmountType = value; OnPropertyChanged("AmountType"); } } - private Hl7.Fhir.Model.CodeableConcept _AmountType; + private Hl7.Fhir.Model.CodeableConcept? _AmountType; /// /// Supporting literature. @@ -2124,29 +2055,25 @@ public Hl7.Fhir.Model.CodeableConcept AmountType [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as RelationshipComponent; - - if (dest == null) - { + if(other is not RelationshipComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.DataType)Substance.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(IsDefiningElement != null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)IsDefiningElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(AmountRatioLowLimit != null) dest.AmountRatioLowLimit = (Hl7.Fhir.Model.Ratio)AmountRatioLowLimit.DeepCopyInternal(); - if(AmountType != null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)AmountType.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.DataType)_Substance.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_IsDefiningElement is not null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefiningElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_AmountRatioLowLimit is not null) dest.AmountRatioLowLimit = (Hl7.Fhir.Model.Ratio)_AmountRatioLowLimit.DeepCopyInternal(); + if(_AmountType is not null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)_AmountType.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2158,76 +2085,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelationshipComponent; - if(otherT == null) return false; + if(other is not RelationshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(IsDefiningElement, otherT.IsDefiningElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(AmountRatioLowLimit, otherT.AmountRatioLowLimit)) return false; - if(!comparer.Equals(AmountType, otherT.AmountType)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_AmountRatioLowLimit, otherT._AmountRatioLowLimit)) return false; + if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "isDefining": - value = IsDefiningElement; - return IsDefiningElement is not null; + value = _IsDefiningElement; + return _IsDefiningElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "amountRatioLowLimit": - value = AmountRatioLowLimit; - return AmountRatioLowLimit is not null; + value = _AmountRatioLowLimit; + return _AmountRatioLowLimit is not null; case "amountType": - value = AmountType; - return AmountType is not null; + value = _AmountType; + return _AmountType is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.DataType)value; + Substance = (Hl7.Fhir.Model.DataType?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "isDefining": - IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "amountRatioLowLimit": - AmountRatioLowLimit = (Hl7.Fhir.Model.Ratio)value; + AmountRatioLowLimit = (Hl7.Fhir.Model.Ratio?)value; return this; case "amountType": - AmountType = (Hl7.Fhir.Model.CodeableConcept)value; + AmountType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2238,13 +2165,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (IsDefiningElement is not null) yield return new KeyValuePair("isDefining",IsDefiningElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (AmountRatioLowLimit is not null) yield return new KeyValuePair("amountRatioLowLimit",AmountRatioLowLimit); - if (AmountType is not null) yield return new KeyValuePair("amountType",AmountType); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_IsDefiningElement is not null) yield return new KeyValuePair("isDefining",_IsDefiningElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_AmountRatioLowLimit is not null) yield return new KeyValuePair("amountRatioLowLimit",_AmountRatioLowLimit); + if (_AmountType is not null) yield return new KeyValuePair("amountType",_AmountType); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -2254,80 +2181,77 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// High level categorization, e.g. polymer or nucleic acid. /// [FhirElement("type", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Status of substance within the catalogue e.g. approved. /// [FhirElement("status", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// If the substance applies to only human or veterinary use. /// [FhirElement("domain", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Domain + public Hl7.Fhir.Model.CodeableConcept? Domain { get { return _Domain; } set { _Domain = value; OnPropertyChanged("Domain"); } } - private Hl7.Fhir.Model.CodeableConcept _Domain; + private Hl7.Fhir.Model.CodeableConcept? _Domain; /// /// Textual description of the substance. /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -2342,39 +2266,36 @@ public string Description [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; /// /// Textual comment about this record of a substance. /// [FhirElement("comment", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Textual comment about this record of a substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -2387,11 +2308,11 @@ public string Comment [DataMember] public List Moiety { - get { if(_Moiety==null) _Moiety = new List(); return _Moiety; } + get => _Moiety ?? new List(); set { _Moiety = value; OnPropertyChanged("Moiety"); } } - private List _Moiety; + private List? _Moiety; /// /// General specifications for this substance, including how it is related to other substances. @@ -2401,11 +2322,11 @@ public List Moiety [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// General information detailing this substance. @@ -2414,26 +2335,26 @@ public List Property [CLSCompliant(false)] [References("SubstanceReferenceInformation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReferenceInformation + public Hl7.Fhir.Model.ResourceReference? ReferenceInformation { get { return _ReferenceInformation; } set { _ReferenceInformation = value; OnPropertyChanged("ReferenceInformation"); } } - private Hl7.Fhir.Model.ResourceReference _ReferenceInformation; + private Hl7.Fhir.Model.ResourceReference? _ReferenceInformation; /// /// Structural information. /// [FhirElement("structure", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.SubstanceSpecification.StructureComponent Structure + public Hl7.Fhir.Model.SubstanceSpecification.StructureComponent? Structure { get { return _Structure; } set { _Structure = value; OnPropertyChanged("Structure"); } } - private Hl7.Fhir.Model.SubstanceSpecification.StructureComponent _Structure; + private Hl7.Fhir.Model.SubstanceSpecification.StructureComponent? _Structure; /// /// Codes associated with the substance. @@ -2443,11 +2364,11 @@ public Hl7.Fhir.Model.SubstanceSpecification.StructureComponent Structure [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Names applicable to this substance. @@ -2457,11 +2378,11 @@ public List Code [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// The molecular weight or weight range (for proteins, polymers or nucleic acids). @@ -2471,11 +2392,11 @@ public List Name [DataMember] public List MolecularWeight { - get { if(_MolecularWeight==null) _MolecularWeight = new List(); return _MolecularWeight; } + get => _MolecularWeight ?? new List(); set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } - private List _MolecularWeight; + private List? _MolecularWeight; /// /// A link between this substance and another, with details of the relationship. @@ -2485,11 +2406,11 @@ public List Mole [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// Data items specific to nucleic acids. @@ -2498,13 +2419,13 @@ public List Relatio [CLSCompliant(false)] [References("SubstanceNucleicAcid")] [DataMember] - public Hl7.Fhir.Model.ResourceReference NucleicAcid + public Hl7.Fhir.Model.ResourceReference? NucleicAcid { get { return _NucleicAcid; } set { _NucleicAcid = value; OnPropertyChanged("NucleicAcid"); } } - private Hl7.Fhir.Model.ResourceReference _NucleicAcid; + private Hl7.Fhir.Model.ResourceReference? _NucleicAcid; /// /// Data items specific to polymers. @@ -2513,13 +2434,13 @@ public Hl7.Fhir.Model.ResourceReference NucleicAcid [CLSCompliant(false)] [References("SubstancePolymer")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Polymer + public Hl7.Fhir.Model.ResourceReference? Polymer { get { return _Polymer; } set { _Polymer = value; OnPropertyChanged("Polymer"); } } - private Hl7.Fhir.Model.ResourceReference _Polymer; + private Hl7.Fhir.Model.ResourceReference? _Polymer; /// /// Data items specific to proteins. @@ -2528,13 +2449,13 @@ public Hl7.Fhir.Model.ResourceReference Polymer [CLSCompliant(false)] [References("SubstanceProtein")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Protein + public Hl7.Fhir.Model.ResourceReference? Protein { get { return _Protein; } set { _Protein = value; OnPropertyChanged("Protein"); } } - private Hl7.Fhir.Model.ResourceReference _Protein; + private Hl7.Fhir.Model.ResourceReference? _Protein; /// /// Material or taxonomic/anatomical source for the substance. @@ -2543,45 +2464,41 @@ public Hl7.Fhir.Model.ResourceReference Protein [CLSCompliant(false)] [References("SubstanceSourceMaterial")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SourceMaterial + public Hl7.Fhir.Model.ResourceReference? SourceMaterial { get { return _SourceMaterial; } set { _SourceMaterial = value; OnPropertyChanged("SourceMaterial"); } } - private Hl7.Fhir.Model.ResourceReference _SourceMaterial; + private Hl7.Fhir.Model.ResourceReference? _SourceMaterial; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceSpecification; - - if (dest == null) - { + if(other is not SubstanceSpecification dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Domain != null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)Domain.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Moiety.Any()) dest.Moiety = new List(Moiety.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(ReferenceInformation != null) dest.ReferenceInformation = (Hl7.Fhir.Model.ResourceReference)ReferenceInformation.DeepCopyInternal(); - if(Structure != null) dest.Structure = (Hl7.Fhir.Model.SubstanceSpecification.StructureComponent)Structure.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(MolecularWeight.Any()) dest.MolecularWeight = new List(MolecularWeight.DeepCopyInternal()); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(NucleicAcid != null) dest.NucleicAcid = (Hl7.Fhir.Model.ResourceReference)NucleicAcid.DeepCopyInternal(); - if(Polymer != null) dest.Polymer = (Hl7.Fhir.Model.ResourceReference)Polymer.DeepCopyInternal(); - if(Protein != null) dest.Protein = (Hl7.Fhir.Model.ResourceReference)Protein.DeepCopyInternal(); - if(SourceMaterial != null) dest.SourceMaterial = (Hl7.Fhir.Model.ResourceReference)SourceMaterial.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Domain is not null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)_Domain.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Moiety is not null) dest.Moiety = new List(_Moiety.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_ReferenceInformation is not null) dest.ReferenceInformation = (Hl7.Fhir.Model.ResourceReference)_ReferenceInformation.DeepCopyInternal(); + if(_Structure is not null) dest.Structure = (Hl7.Fhir.Model.SubstanceSpecification.StructureComponent)_Structure.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_MolecularWeight is not null) dest.MolecularWeight = new List(_MolecularWeight.DeepCopyInternal()); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_NucleicAcid is not null) dest.NucleicAcid = (Hl7.Fhir.Model.ResourceReference)_NucleicAcid.DeepCopyInternal(); + if(_Polymer is not null) dest.Polymer = (Hl7.Fhir.Model.ResourceReference)_Polymer.DeepCopyInternal(); + if(_Protein is not null) dest.Protein = (Hl7.Fhir.Model.ResourceReference)_Protein.DeepCopyInternal(); + if(_SourceMaterial is not null) dest.SourceMaterial = (Hl7.Fhir.Model.ResourceReference)_SourceMaterial.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2593,160 +2510,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceSpecification; - if(otherT == null) return false; + if(other is not SubstanceSpecification otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Domain, otherT.Domain)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(Moiety, otherT.Moiety)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(ReferenceInformation, otherT.ReferenceInformation)) return false; - if(!comparer.Equals(Structure, otherT.Structure)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(MolecularWeight, otherT.MolecularWeight)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(NucleicAcid, otherT.NucleicAcid)) return false; - if(!comparer.Equals(Polymer, otherT.Polymer)) return false; - if(!comparer.Equals(Protein, otherT.Protein)) return false; - if(!comparer.Equals(SourceMaterial, otherT.SourceMaterial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Domain, otherT._Domain)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_Moiety, otherT._Moiety)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_ReferenceInformation, otherT._ReferenceInformation)) return false; + if(!comparer.Equals(_Structure, otherT._Structure)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_MolecularWeight, otherT._MolecularWeight)) return false; + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_NucleicAcid, otherT._NucleicAcid)) return false; + if(!comparer.Equals(_Polymer, otherT._Polymer)) return false; + if(!comparer.Equals(_Protein, otherT._Protein)) return false; + if(!comparer.Equals(_SourceMaterial, otherT._SourceMaterial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "domain": - value = Domain; - return Domain is not null; + value = _Domain; + return _Domain is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "moiety": - value = Moiety; - return Moiety?.Any() == true; + value = _Moiety; + return _Moiety?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "referenceInformation": - value = ReferenceInformation; - return ReferenceInformation is not null; + value = _ReferenceInformation; + return _ReferenceInformation is not null; case "structure": - value = Structure; - return Structure is not null; + value = _Structure; + return _Structure is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "molecularWeight": - value = MolecularWeight; - return MolecularWeight?.Any() == true; + value = _MolecularWeight; + return _MolecularWeight?.Any() == true; case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "nucleicAcid": - value = NucleicAcid; - return NucleicAcid is not null; + value = _NucleicAcid; + return _NucleicAcid is not null; case "polymer": - value = Polymer; - return Polymer is not null; + value = _Polymer; + return _Polymer is not null; case "protein": - value = Protein; - return Protein is not null; + value = _Protein; + return _Protein is not null; case "sourceMaterial": - value = SourceMaterial; - return SourceMaterial is not null; + value = _SourceMaterial; + return _SourceMaterial is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "domain": - Domain = (Hl7.Fhir.Model.CodeableConcept)value; + Domain = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "moiety": - Moiety = (List)value; + Moiety = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "referenceInformation": - ReferenceInformation = (Hl7.Fhir.Model.ResourceReference)value; + ReferenceInformation = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "structure": - Structure = (Hl7.Fhir.Model.SubstanceSpecification.StructureComponent)value; + Structure = (Hl7.Fhir.Model.SubstanceSpecification.StructureComponent?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "molecularWeight": - MolecularWeight = (List)value; + MolecularWeight = (List?)value!; return this; case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "nucleicAcid": - NucleicAcid = (Hl7.Fhir.Model.ResourceReference)value; + NucleicAcid = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "polymer": - Polymer = (Hl7.Fhir.Model.ResourceReference)value; + Polymer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "protein": - Protein = (Hl7.Fhir.Model.ResourceReference)value; + Protein = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sourceMaterial": - SourceMaterial = (Hl7.Fhir.Model.ResourceReference)value; + SourceMaterial = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -2757,25 +2674,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Domain is not null) yield return new KeyValuePair("domain",Domain); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Moiety?.Any() == true) yield return new KeyValuePair("moiety",Moiety); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (ReferenceInformation is not null) yield return new KeyValuePair("referenceInformation",ReferenceInformation); - if (Structure is not null) yield return new KeyValuePair("structure",Structure); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (MolecularWeight?.Any() == true) yield return new KeyValuePair("molecularWeight",MolecularWeight); - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (NucleicAcid is not null) yield return new KeyValuePair("nucleicAcid",NucleicAcid); - if (Polymer is not null) yield return new KeyValuePair("polymer",Polymer); - if (Protein is not null) yield return new KeyValuePair("protein",Protein); - if (SourceMaterial is not null) yield return new KeyValuePair("sourceMaterial",SourceMaterial); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Domain is not null) yield return new KeyValuePair("domain",_Domain); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Moiety?.Any() == true) yield return new KeyValuePair("moiety",_Moiety); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_ReferenceInformation is not null) yield return new KeyValuePair("referenceInformation",_ReferenceInformation); + if (_Structure is not null) yield return new KeyValuePair("structure",_Structure); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_MolecularWeight?.Any() == true) yield return new KeyValuePair("molecularWeight",_MolecularWeight); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_NucleicAcid is not null) yield return new KeyValuePair("nucleicAcid",_NucleicAcid); + if (_Polymer is not null) yield return new KeyValuePair("polymer",_Polymer); + if (_Protein is not null) yield return new KeyValuePair("protein",_Protein); + if (_SourceMaterial is not null) yield return new KeyValuePair("sourceMaterial",_SourceMaterial); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs index ee048f60b..4f8236b52 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SupplyDelivery","http://hl7.org/fhir/StructureDefinition/SupplyDelivery")] - public partial class SupplyDelivery : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class SupplyDelivery : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -136,13 +139,13 @@ public partial class SuppliedItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Medication, Substance, or Device supplied. @@ -153,26 +156,22 @@ public Hl7.Fhir.Model.Quantity Quantity [References("Medication","Substance","Device")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as SuppliedItemComponent; - - if (dest == null) - { + if(other is not SuppliedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -184,41 +183,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuppliedItemComponent; - if(otherT == null) return false; + if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -229,8 +228,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -243,11 +242,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -259,11 +258,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -275,11 +274,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | completed | abandoned | entered-in-error. @@ -288,13 +287,13 @@ public List PartOf [DeclaredType(Type = typeof(Code))] [Binding("SupplyDeliveryStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | abandoned | entered-in-error @@ -303,13 +302,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -321,13 +317,13 @@ public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Category of dispense event. @@ -335,26 +331,26 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("type", Order=140)] [Binding("SupplyDeliveryType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The item that is delivered or supplied. /// [FhirElement("suppliedItem", Order=150)] [DataMember] - public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent SuppliedItem + public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent? SuppliedItem { get { return _SuppliedItem; } set { _SuppliedItem = value; OnPropertyChanged("SuppliedItem"); } } - private Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent _SuppliedItem; + private Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent? _SuppliedItem; /// /// When event occurred. @@ -363,13 +359,13 @@ public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent SuppliedItem [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Dispenser. @@ -378,13 +374,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Supplier + public Hl7.Fhir.Model.ResourceReference? Supplier { get { return _Supplier; } set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private Hl7.Fhir.Model.ResourceReference _Supplier; + private Hl7.Fhir.Model.ResourceReference? _Supplier; /// /// Where the Supply was sent. @@ -393,13 +389,13 @@ public Hl7.Fhir.Model.ResourceReference Supplier [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who collected the Supply. @@ -411,38 +407,34 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } + IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyDelivery; - - if (dest == null) - { + if(other is not SupplyDelivery dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SuppliedItem != null) dest.SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)SuppliedItem.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Supplier != null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)Supplier.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SuppliedItem is not null) dest.SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)_SuppliedItem.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)_Supplier.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -454,104 +446,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyDelivery; - if(otherT == null) return false; + if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SuppliedItem, otherT.SuppliedItem)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Supplier, otherT.Supplier)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SuppliedItem, otherT._SuppliedItem)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "suppliedItem": - value = SuppliedItem; - return SuppliedItem is not null; + value = _SuppliedItem; + return _SuppliedItem is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "supplier": - value = Supplier; - return Supplier is not null; + value = _Supplier; + return _Supplier is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "suppliedItem": - SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)value; + SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "supplier": - Supplier = (Hl7.Fhir.Model.ResourceReference)value; + Supplier = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; default: return base.SetValue(key, value); @@ -562,17 +554,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SuppliedItem is not null) yield return new KeyValuePair("suppliedItem",SuppliedItem); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Supplier is not null) yield return new KeyValuePair("supplier",Supplier); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SuppliedItem is not null) yield return new KeyValuePair("suppliedItem",_SuppliedItem); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Supplier is not null) yield return new KeyValuePair("supplier",_Supplier); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs index af64debd0..b4f50224b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SupplyRequest","http://hl7.org/fhir/StructureDefinition/SupplyRequest")] - public partial class SupplyRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class SupplyRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -133,13 +136,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40, FiveWs="FiveWs.what[x]")] [Binding("ParameterCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value of detail. @@ -148,26 +151,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirBoolean))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,41 +178,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -224,8 +223,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -238,11 +237,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | suspended +. @@ -251,13 +250,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("SupplyRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended + @@ -266,13 +265,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -283,13 +279,13 @@ public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status [FhirElement("category", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("SupplyRequestKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// routine | urgent | asap | stat. @@ -298,13 +294,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -313,13 +309,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -334,13 +327,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// The requested amount of the item indicated. @@ -348,13 +341,13 @@ public Hl7.Fhir.Model.DataType Item [FhirElement("quantity", InSummary=true, Order=140)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Ordered item details. @@ -364,11 +357,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// When the request should be fulfilled. @@ -377,41 +370,38 @@ public List Parameter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the request was made. /// [FhirElement("authoredOn", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -423,13 +413,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Who is intended to fulfill the request. @@ -441,11 +431,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List Supplier { - get { if(_Supplier==null) _Supplier = new List(); return _Supplier; } + get => _Supplier ?? new List(); set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private List _Supplier; + private List? _Supplier; /// /// The reason why the supply item was requested. @@ -456,11 +446,11 @@ public List Supplier [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// The reason why the supply item was requested. @@ -472,11 +462,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// The origin of the supply. @@ -485,13 +475,13 @@ public List ReasonReference [CLSCompliant(false)] [References("Organization","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverFrom + public Hl7.Fhir.Model.ResourceReference? DeliverFrom { get { return _DeliverFrom; } set { _DeliverFrom = value; OnPropertyChanged("DeliverFrom"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverFrom; + private Hl7.Fhir.Model.ResourceReference? _DeliverFrom; /// /// The destination of the supply. @@ -500,44 +490,40 @@ public Hl7.Fhir.Model.ResourceReference DeliverFrom [CLSCompliant(false)] [References("Organization","Location","Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverTo + public Hl7.Fhir.Model.ResourceReference? DeliverTo { get { return _DeliverTo; } set { _DeliverTo = value; OnPropertyChanged("DeliverTo"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverTo; + private Hl7.Fhir.Model.ResourceReference? _DeliverTo; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Category; set => Category = value!; } + IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyRequest; - - if (dest == null) - { + if(other is not SupplyRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Supplier.Any()) dest.Supplier = new List(Supplier.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(DeliverFrom != null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)DeliverFrom.DeepCopyInternal(); - if(DeliverTo != null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)DeliverTo.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = new List(_Supplier.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_DeliverFrom is not null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)_DeliverFrom.DeepCopyInternal(); + if(_DeliverTo is not null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)_DeliverTo.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -549,132 +535,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyRequest; - if(otherT == null) return false; + if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(Supplier, otherT.Supplier)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(DeliverFrom, otherT.DeliverFrom)) return false; - if(!comparer.Equals(DeliverTo, otherT.DeliverTo)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_Supplier, otherT._Supplier)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; + if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "supplier": - value = Supplier; - return Supplier?.Any() == true; + value = _Supplier; + return _Supplier?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "deliverFrom": - value = DeliverFrom; - return DeliverFrom is not null; + value = _DeliverFrom; + return _DeliverFrom is not null; case "deliverTo": - value = DeliverTo; - return DeliverTo is not null; + value = _DeliverTo; + return _DeliverTo is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supplier": - Supplier = (List)value; + Supplier = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "deliverFrom": - DeliverFrom = (Hl7.Fhir.Model.ResourceReference)value; + DeliverFrom = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "deliverTo": - DeliverTo = (Hl7.Fhir.Model.ResourceReference)value; + DeliverTo = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -685,21 +671,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Supplier?.Any() == true) yield return new KeyValuePair("supplier",Supplier); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",DeliverFrom); - if (DeliverTo is not null) yield return new KeyValuePair("deliverTo",DeliverTo); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Supplier?.Any() == true) yield return new KeyValuePair("supplier",_Supplier); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",_DeliverFrom); + if (_DeliverTo is not null) yield return new KeyValuePair("deliverTo",_DeliverTo); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Task.cs b/src/Hl7.Fhir.R4/Model/Generated/Task.cs index 50729cef8..19ef8c0ec 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Task.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Task","http://hl7.org/fhir/StructureDefinition/Task")] - public partial class Task : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded + public partial class Task : Hl7.Fhir.Model.DomainResource, IIdentifiable>, ICoded { /// /// FHIR Type Name @@ -223,13 +226,13 @@ public partial class RestrictionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("repetitions", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RepetitionsElement + public Hl7.Fhir.Model.PositiveInt? RepetitionsElement { get { return _RepetitionsElement; } set { _RepetitionsElement = value; OnPropertyChanged("RepetitionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _RepetitionsElement; + private Hl7.Fhir.Model.PositiveInt? _RepetitionsElement; /// /// How many times to repeat @@ -238,13 +241,10 @@ public Hl7.Fhir.Model.PositiveInt RepetitionsElement [IgnoreDataMember] public int? Repetitions { - get { return RepetitionsElement != null ? RepetitionsElement.Value : null; } + get => _RepetitionsElement?.Value; set { - if (value == null) - RepetitionsElement = null; - else - RepetitionsElement = new Hl7.Fhir.Model.PositiveInt(value); + RepetitionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Repetitions"); } } @@ -254,13 +254,13 @@ public int? Repetitions /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// For whom is fulfillment sought?. @@ -272,25 +272,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; protected internal override void CopyToInternal(Base other) { - var dest = other as RestrictionComponent; - - if (dest == null) - { + if(other is not RestrictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RepetitionsElement != null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)RepetitionsElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); + if(_RepetitionsElement is not null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)_RepetitionsElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -302,48 +298,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RestrictionComponent; - if(otherT == null) return false; + if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RepetitionsElement, otherT.RepetitionsElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "repetitions": - value = RepetitionsElement; - return RepetitionsElement is not null; + value = _RepetitionsElement; + return _RepetitionsElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "repetitions": - RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)value; + RepetitionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -354,9 +350,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RepetitionsElement is not null) yield return new KeyValuePair("repetitions",RepetitionsElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); + if (_RepetitionsElement is not null) yield return new KeyValuePair("repetitions",_RepetitionsElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); } } @@ -384,13 +380,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskInputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Content to use in performing the task. @@ -400,26 +396,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.Contributor),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -431,41 +423,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -476,8 +468,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -505,13 +497,13 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskOutputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Result of output. @@ -521,26 +513,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.Contributor),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -552,41 +540,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -597,8 +585,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -611,39 +599,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Formal definition of task. /// [FhirElement("instantiatesCanonical", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical InstantiatesCanonicalElement + public Hl7.Fhir.Model.Canonical? InstantiatesCanonicalElement { get { return _InstantiatesCanonicalElement; } set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _InstantiatesCanonicalElement; + private Hl7.Fhir.Model.Canonical? _InstantiatesCanonicalElement; /// /// Formal definition of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesCanonical + public string? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Value : null; } + get => _InstantiatesCanonicalElement?.Value; set { - if (value == null) - InstantiatesCanonicalElement = null; - else - InstantiatesCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + InstantiatesCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InstantiatesCanonical"); } } @@ -653,28 +638,25 @@ public string InstantiatesCanonical /// [FhirElement("instantiatesUri", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// Formal definition of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -689,24 +671,24 @@ public string InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Requisition or grouper id. /// [FhirElement("groupIdentifier", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// Composite task. @@ -718,11 +700,11 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | requested | received | accepted | +. @@ -732,13 +714,13 @@ public List PartOf [Binding("TaskStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | requested | received | accepted | + @@ -747,13 +729,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Task.TaskStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -764,13 +743,13 @@ public Hl7.Fhir.Model.Task.TaskStatus? Status [FhirElement("statusReason", InSummary=true, Order=160)] [Binding("TaskStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// E.g. "Specimen collected", "IV prepped". @@ -778,13 +757,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [FhirElement("businessStatus", InSummary=true, Order=170)] [Binding("TaskBusinessStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BusinessStatus + public Hl7.Fhir.Model.CodeableConcept? BusinessStatus { get { return _BusinessStatus; } set { _BusinessStatus = value; OnPropertyChanged("BusinessStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _BusinessStatus; + private Hl7.Fhir.Model.CodeableConcept? _BusinessStatus; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option. @@ -794,13 +773,13 @@ public Hl7.Fhir.Model.CodeableConcept BusinessStatus [Binding("TaskIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option @@ -809,13 +788,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.Task.TaskIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -827,13 +803,13 @@ public Hl7.Fhir.Model.Task.TaskIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("TaskPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -842,13 +818,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -859,41 +832,38 @@ public Hl7.Fhir.Model.RequestPriority? Priority [FhirElement("code", InSummary=true, Order=200, FiveWs="FiveWs.what[x]")] [Binding("TaskCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Human-readable explanation of task. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable explanation of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -905,13 +875,13 @@ public string Description [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Beneficiary of the Task. @@ -920,13 +890,13 @@ public Hl7.Fhir.Model.ResourceReference Focus [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference For + public Hl7.Fhir.Model.ResourceReference? For { get { return _For; } set { _For = value; OnPropertyChanged("For"); } } - private Hl7.Fhir.Model.ResourceReference _For; + private Hl7.Fhir.Model.ResourceReference? _For; /// /// Healthcare event during which this task originated. @@ -935,54 +905,51 @@ public Hl7.Fhir.Model.ResourceReference For [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Start and end time of execution. /// [FhirElement("executionPeriod", InSummary=true, Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ExecutionPeriod + public Hl7.Fhir.Model.Period? ExecutionPeriod { get { return _ExecutionPeriod; } set { _ExecutionPeriod = value; OnPropertyChanged("ExecutionPeriod"); } } - private Hl7.Fhir.Model.Period _ExecutionPeriod; + private Hl7.Fhir.Model.Period? _ExecutionPeriod; /// /// Task Creation Date. /// [FhirElement("authoredOn", Order=260, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Task Creation Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -992,28 +959,25 @@ public string AuthoredOn /// [FhirElement("lastModified", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastModifiedElement + public Hl7.Fhir.Model.FhirDateTime? LastModifiedElement { get { return _LastModifiedElement; } set { _LastModifiedElement = value; OnPropertyChanged("LastModifiedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastModifiedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastModifiedElement; /// /// Task Last Modified Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastModified + public string? LastModified { - get { return LastModifiedElement != null ? LastModifiedElement.Value : null; } + get => _LastModifiedElement?.Value; set { - if (value == null) - LastModifiedElement = null; - else - LastModifiedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastModifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastModified"); } } @@ -1025,13 +989,13 @@ public string LastModified [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Requested performer. @@ -1042,11 +1006,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List PerformerType { - get { if(_PerformerType==null) _PerformerType = new List(); return _PerformerType; } + get => _PerformerType ?? new List(); set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private List _PerformerType; + private List? _PerformerType; /// /// Responsible individual. @@ -1055,13 +1019,13 @@ public List PerformerType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","HealthcareService","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Where task occurs. @@ -1070,13 +1034,13 @@ public Hl7.Fhir.Model.ResourceReference Owner [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Why task is needed. @@ -1084,13 +1048,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("reasonCode", Order=320, FiveWs="FiveWs.why[x]")] [Binding("TaskReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReasonCode + public Hl7.Fhir.Model.CodeableConcept? ReasonCode { get { return _ReasonCode; } set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private Hl7.Fhir.Model.CodeableConcept _ReasonCode; + private Hl7.Fhir.Model.CodeableConcept? _ReasonCode; /// /// Why task is needed. @@ -1099,13 +1063,13 @@ public Hl7.Fhir.Model.CodeableConcept ReasonCode [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReasonReference + public Hl7.Fhir.Model.ResourceReference? ReasonReference { get { return _ReasonReference; } set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private Hl7.Fhir.Model.ResourceReference _ReasonReference; + private Hl7.Fhir.Model.ResourceReference? _ReasonReference; /// /// Associated insurance coverage. @@ -1117,11 +1081,11 @@ public Hl7.Fhir.Model.ResourceReference ReasonReference [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Comments made about the task. @@ -1131,11 +1095,11 @@ public List Insurance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Key events in history of the Task. @@ -1147,24 +1111,24 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Constraints on fulfillment tasks. /// [FhirElement("restriction", Order=370)] [DataMember] - public Hl7.Fhir.Model.Task.RestrictionComponent Restriction + public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction { get { return _Restriction; } set { _Restriction = value; OnPropertyChanged("Restriction"); } } - private Hl7.Fhir.Model.Task.RestrictionComponent _Restriction; + private Hl7.Fhir.Model.Task.RestrictionComponent? _Restriction; /// /// Information used to perform task. @@ -1174,11 +1138,11 @@ public Hl7.Fhir.Model.Task.RestrictionComponent Restriction [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Information produced as part of task. @@ -1188,58 +1152,54 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } - Hl7.Fhir.Model.CodeableConcept ICoded.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code.ToCodings(); + Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } + IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { - var dest = other as Task; - - if (dest == null) - { + if(other is not Task dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)InstantiatesCanonicalElement.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(BusinessStatus != null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)BusinessStatus.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(For != null) dest.For = (Hl7.Fhir.Model.ResourceReference)For.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(ExecutionPeriod != null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)ExecutionPeriod.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(LastModifiedElement != null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)LastModifiedElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType.Any()) dest.PerformerType = new List(PerformerType.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ReasonCode != null) dest.ReasonCode = (Hl7.Fhir.Model.CodeableConcept)ReasonCode.DeepCopyInternal(); - if(ReasonReference != null) dest.ReasonReference = (Hl7.Fhir.Model.ResourceReference)ReasonReference.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Restriction != null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)Restriction.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)_InstantiatesCanonicalElement.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_BusinessStatus is not null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)_BusinessStatus.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_For is not null) dest.For = (Hl7.Fhir.Model.ResourceReference)_For.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_ExecutionPeriod is not null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)_ExecutionPeriod.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_LastModifiedElement is not null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)_LastModifiedElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = new List(_PerformerType.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = (Hl7.Fhir.Model.CodeableConcept)_ReasonCode.DeepCopyInternal(); + if(_ReasonReference is not null) dest.ReasonReference = (Hl7.Fhir.Model.ResourceReference)_ReasonReference.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Restriction is not null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)_Restriction.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1251,244 +1211,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Task; - if(otherT == null) return false; + if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(BusinessStatus, otherT.BusinessStatus)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(For, otherT.For)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(ExecutionPeriod, otherT.ExecutionPeriod)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(LastModifiedElement, otherT.LastModifiedElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.Equals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.Equals(Restriction, otherT.Restriction)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_BusinessStatus, otherT._BusinessStatus)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_For, otherT._For)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_ExecutionPeriod, otherT._ExecutionPeriod)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.Equals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement is not null; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "businessStatus": - value = BusinessStatus; - return BusinessStatus is not null; + value = _BusinessStatus; + return _BusinessStatus is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "for": - value = For; - return For is not null; + value = _For; + return _For is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "executionPeriod": - value = ExecutionPeriod; - return ExecutionPeriod is not null; + value = _ExecutionPeriod; + return _ExecutionPeriod is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "lastModified": - value = LastModifiedElement; - return LastModifiedElement is not null; + value = _LastModifiedElement; + return _LastModifiedElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType?.Any() == true; + value = _PerformerType; + return _PerformerType?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode is not null; + value = _ReasonCode; + return _ReasonCode is not null; case "reasonReference": - value = ReasonReference; - return ReasonReference is not null; + value = _ReasonReference; + return _ReasonReference is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "restriction": - value = Restriction; - return Restriction is not null; + value = _Restriction; + return _Restriction is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "businessStatus": - BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)value; + BusinessStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "for": - For = (Hl7.Fhir.Model.ResourceReference)value; + For = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "executionPeriod": - ExecutionPeriod = (Hl7.Fhir.Model.Period)value; + ExecutionPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastModified": - LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (List)value; + PerformerType = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (Hl7.Fhir.Model.CodeableConcept)value; + ReasonCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reasonReference": - ReasonReference = (Hl7.Fhir.Model.ResourceReference)value; + ReasonReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "restriction": - Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)value; + Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1499,37 +1459,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (BusinessStatus is not null) yield return new KeyValuePair("businessStatus",BusinessStatus); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (For is not null) yield return new KeyValuePair("for",For); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",ExecutionPeriod); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (LastModifiedElement is not null) yield return new KeyValuePair("lastModified",LastModifiedElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType?.Any() == true) yield return new KeyValuePair("performerType",PerformerType); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ReasonCode is not null) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference is not null) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Restriction is not null) yield return new KeyValuePair("restriction",Restriction); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_BusinessStatus is not null) yield return new KeyValuePair("businessStatus",_BusinessStatus); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_For is not null) yield return new KeyValuePair("for",_For); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",_ExecutionPeriod); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_LastModifiedElement is not null) yield return new KeyValuePair("lastModified",_LastModifiedElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType?.Any() == true) yield return new KeyValuePair("performerType",_PerformerType); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ReasonCode is not null) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference is not null) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Restriction is not null) yield return new KeyValuePair("restriction",_Restriction); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs index d29190b75..d167f2c0a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -103,28 +106,25 @@ public partial class SoftwareComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name the software is known by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -134,44 +134,37 @@ public string Name /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version covered by this statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SoftwareComponent; - - if (dest == null) - { + if(other is not SoftwareComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -183,41 +176,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SoftwareComponent; - if(otherT == null) return false; + if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -228,8 +221,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -256,28 +249,25 @@ public partial class ImplementationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Describes this specific instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -287,44 +277,37 @@ public string Description /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// Base URL for the implementation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationComponent; - - if (dest == null) - { + if(other is not ImplementationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -336,41 +319,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationComponent; - if(otherT == null) return false; + if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -381,8 +364,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -409,28 +392,25 @@ public partial class CodeSystemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("uri", Order=40)] [DataMember] - public Hl7.Fhir.Model.Canonical UriElement + public Hl7.Fhir.Model.Canonical? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.Canonical _UriElement; + private Hl7.Fhir.Model.Canonical? _UriElement; /// /// URI for the Code System /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.Canonical(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Uri"); } } @@ -443,24 +423,24 @@ public string Uri [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// Whether subsumption is supported. /// [FhirElement("subsumption", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SubsumptionElement + public Hl7.Fhir.Model.FhirBoolean? SubsumptionElement { get { return _SubsumptionElement; } set { _SubsumptionElement = value; OnPropertyChanged("SubsumptionElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SubsumptionElement; + private Hl7.Fhir.Model.FhirBoolean? _SubsumptionElement; /// /// Whether subsumption is supported @@ -469,30 +449,23 @@ public Hl7.Fhir.Model.FhirBoolean SubsumptionElement [IgnoreDataMember] public bool? Subsumption { - get { return SubsumptionElement != null ? SubsumptionElement.Value : null; } + get => _SubsumptionElement?.Value; set { - if (value == null) - SubsumptionElement = null; - else - SubsumptionElement = new Hl7.Fhir.Model.FhirBoolean(value); + SubsumptionElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Subsumption"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CodeSystemComponent; - - if (dest == null) - { + if(other is not CodeSystemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.Canonical)UriElement.DeepCopyInternal(); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(SubsumptionElement != null) dest.SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)SubsumptionElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.Canonical)_UriElement.DeepCopyInternal(); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_SubsumptionElement is not null) dest.SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)_SubsumptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -504,48 +477,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeSystemComponent; - if(otherT == null) return false; + if(other is not CodeSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.Equals(SubsumptionElement, otherT.SubsumptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.Equals(_SubsumptionElement, otherT._SubsumptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "subsumption": - value = SubsumptionElement; - return SubsumptionElement is not null; + value = _SubsumptionElement; + return _SubsumptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uri": - UriElement = (Hl7.Fhir.Model.Canonical)value; + UriElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "subsumption": - SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)value; + SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -556,9 +529,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (SubsumptionElement is not null) yield return new KeyValuePair("subsumption",SubsumptionElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_SubsumptionElement is not null) yield return new KeyValuePair("subsumption",_SubsumptionElement); } } @@ -585,28 +558,25 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString CodeElement + public Hl7.Fhir.Model.FhirString? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.FhirString _CodeElement; + private Hl7.Fhir.Model.FhirString? _CodeElement; /// /// Version identifier for this version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.FhirString(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Code"); } } @@ -616,13 +586,13 @@ public string Code /// [FhirElement("isDefault", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefaultElement + public Hl7.Fhir.Model.FhirBoolean? IsDefaultElement { get { return _IsDefaultElement; } set { _IsDefaultElement = value; OnPropertyChanged("IsDefaultElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefaultElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefaultElement; /// /// If this is the default version for this code system @@ -631,13 +601,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefaultElement [IgnoreDataMember] public bool? IsDefault { - get { return IsDefaultElement != null ? IsDefaultElement.Value : null; } + get => _IsDefaultElement?.Value; set { - if (value == null) - IsDefaultElement = null; - else - IsDefaultElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefaultElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefault"); } } @@ -647,13 +614,13 @@ public bool? IsDefault /// [FhirElement("compositional", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CompositionalElement + public Hl7.Fhir.Model.FhirBoolean? CompositionalElement { get { return _CompositionalElement; } set { _CompositionalElement = value; OnPropertyChanged("CompositionalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CompositionalElement; + private Hl7.Fhir.Model.FhirBoolean? _CompositionalElement; /// /// If compositional grammar is supported @@ -662,13 +629,10 @@ public Hl7.Fhir.Model.FhirBoolean CompositionalElement [IgnoreDataMember] public bool? Compositional { - get { return CompositionalElement != null ? CompositionalElement.Value : null; } + get => _CompositionalElement?.Value; set { - if (value == null) - CompositionalElement = null; - else - CompositionalElement = new Hl7.Fhir.Model.FhirBoolean(value); + CompositionalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Compositional"); } } @@ -681,24 +645,24 @@ public bool? Compositional [DataMember] public List LanguageElement { - get { if(_LanguageElement==null) _LanguageElement = new List(); return _LanguageElement; } + get => _LanguageElement ?? new List(); set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private List _LanguageElement; + private List? _LanguageElement; /// /// Language Displays supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Language + public IEnumerable? Language { - get { return LanguageElement != null ? LanguageElement.Select(elem => elem.Value) : null; } + get => _LanguageElement?.Select(elem => elem.Value); set { if (value == null) - LanguageElement = null; + LanguageElement = null!; else LanguageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Language"); @@ -713,11 +677,11 @@ public IEnumerable Language [DataMember] public List Filter { - get { if(_Filter==null) _Filter = new List(); return _Filter; } + get => _Filter ?? new List(); set { _Filter = value; OnPropertyChanged("Filter"); } } - private List _Filter; + private List? _Filter; /// /// Properties supported for $lookup. @@ -727,24 +691,24 @@ public List Filter [DataMember] public List PropertyElement { - get { if(_PropertyElement==null) _PropertyElement = new List(); return _PropertyElement; } + get => _PropertyElement ?? new List(); set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private List _PropertyElement; + private List? _PropertyElement; /// /// Properties supported for $lookup /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Property + public IEnumerable? Property { - get { return PropertyElement != null ? PropertyElement.Select(elem => elem.Value) : null; } + get => _PropertyElement?.Select(elem => elem.Value); set { if (value == null) - PropertyElement = null; + PropertyElement = null!; else PropertyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Property"); @@ -753,20 +717,16 @@ public IEnumerable Property protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)CodeElement.DeepCopyInternal(); - if(IsDefaultElement != null) dest.IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)IsDefaultElement.DeepCopyInternal(); - if(CompositionalElement != null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)CompositionalElement.DeepCopyInternal(); - if(LanguageElement.Any()) dest.LanguageElement = new List(LanguageElement.DeepCopyInternal()); - if(Filter.Any()) dest.Filter = new List(Filter.DeepCopyInternal()); - if(PropertyElement.Any()) dest.PropertyElement = new List(PropertyElement.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)_CodeElement.DeepCopyInternal(); + if(_IsDefaultElement is not null) dest.IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefaultElement.DeepCopyInternal(); + if(_CompositionalElement is not null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)_CompositionalElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = new List(_LanguageElement.DeepCopyInternal()); + if(_Filter is not null) dest.Filter = new List(_Filter.DeepCopyInternal()); + if(_PropertyElement is not null) dest.PropertyElement = new List(_PropertyElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -778,69 +738,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(IsDefaultElement, otherT.IsDefaultElement)) return false; - if(!comparer.Equals(CompositionalElement, otherT.CompositionalElement)) return false; - if(!comparer.ListEquals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.ListEquals(Filter, otherT.Filter)) return false; - if(!comparer.ListEquals(PropertyElement, otherT.PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_IsDefaultElement, otherT._IsDefaultElement)) return false; + if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; + if(!comparer.ListEquals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; + if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "isDefault": - value = IsDefaultElement; - return IsDefaultElement is not null; + value = _IsDefaultElement; + return _IsDefaultElement is not null; case "compositional": - value = CompositionalElement; - return CompositionalElement is not null; + value = _CompositionalElement; + return _CompositionalElement is not null; case "language": - value = LanguageElement; - return LanguageElement?.Any() == true; + value = _LanguageElement; + return _LanguageElement?.Any() == true; case "filter": - value = Filter; - return Filter?.Any() == true; + value = _Filter; + return _Filter?.Any() == true; case "property": - value = PropertyElement; - return PropertyElement?.Any() == true; + value = _PropertyElement; + return _PropertyElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.FhirString)value; + CodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "isDefault": - IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "compositional": - CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)value; + CompositionalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "language": - LanguageElement = (List)value; + LanguageElement = (List?)value!; return this; case "filter": - Filter = (List)value; + Filter = (List?)value!; return this; case "property": - PropertyElement = (List)value; + PropertyElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -851,12 +811,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (IsDefaultElement is not null) yield return new KeyValuePair("isDefault",IsDefaultElement); - if (CompositionalElement is not null) yield return new KeyValuePair("compositional",CompositionalElement); - if (LanguageElement?.Any() == true) yield return new KeyValuePair("language",LanguageElement); - if (Filter?.Any() == true) yield return new KeyValuePair("filter",Filter); - if (PropertyElement?.Any() == true) yield return new KeyValuePair("property",PropertyElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_IsDefaultElement is not null) yield return new KeyValuePair("isDefault",_IsDefaultElement); + if (_CompositionalElement is not null) yield return new KeyValuePair("compositional",_CompositionalElement); + if (_LanguageElement?.Any() == true) yield return new KeyValuePair("language",_LanguageElement); + if (_Filter?.Any() == true) yield return new KeyValuePair("filter",_Filter); + if (_PropertyElement?.Any() == true) yield return new KeyValuePair("property",_PropertyElement); } } @@ -880,28 +840,25 @@ public partial class FilterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code of the property supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -914,24 +871,24 @@ public string Code [DataMember] public List OpElement { - get { if(_OpElement==null) _OpElement = new List(); return _OpElement; } + get => _OpElement ?? new List(); set { _OpElement = value; OnPropertyChanged("OpElement"); } } - private List _OpElement; + private List? _OpElement; /// /// Operations supported for the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Op + public IEnumerable? Op { - get { return OpElement != null ? OpElement.Select(elem => elem.Value) : null; } + get => _OpElement?.Select(elem => elem.Value); set { if (value == null) - OpElement = null; + OpElement = null!; else OpElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Op"); @@ -940,16 +897,12 @@ public IEnumerable Op protected internal override void CopyToInternal(Base other) { - var dest = other as FilterComponent; - - if (dest == null) - { + if(other is not FilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(OpElement.Any()) dest.OpElement = new List(OpElement.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_OpElement is not null) dest.OpElement = new List(_OpElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -961,41 +914,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterComponent; - if(otherT == null) return false; + if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(OpElement, otherT.OpElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_OpElement, otherT._OpElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "op": - value = OpElement; - return OpElement?.Any() == true; + value = _OpElement; + return _OpElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "op": - OpElement = (List)value; + OpElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1006,8 +959,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (OpElement?.Any() == true) yield return new KeyValuePair("op",OpElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_OpElement?.Any() == true) yield return new KeyValuePair("op",_OpElement); } } @@ -1030,13 +983,13 @@ public partial class ExpansionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("hierarchical", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean HierarchicalElement + public Hl7.Fhir.Model.FhirBoolean? HierarchicalElement { get { return _HierarchicalElement; } set { _HierarchicalElement = value; OnPropertyChanged("HierarchicalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _HierarchicalElement; + private Hl7.Fhir.Model.FhirBoolean? _HierarchicalElement; /// /// Whether the server can return nested value sets @@ -1045,13 +998,10 @@ public Hl7.Fhir.Model.FhirBoolean HierarchicalElement [IgnoreDataMember] public bool? Hierarchical { - get { return HierarchicalElement != null ? HierarchicalElement.Value : null; } + get => _HierarchicalElement?.Value; set { - if (value == null) - HierarchicalElement = null; - else - HierarchicalElement = new Hl7.Fhir.Model.FhirBoolean(value); + HierarchicalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Hierarchical"); } } @@ -1061,13 +1011,13 @@ public bool? Hierarchical /// [FhirElement("paging", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PagingElement + public Hl7.Fhir.Model.FhirBoolean? PagingElement { get { return _PagingElement; } set { _PagingElement = value; OnPropertyChanged("PagingElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PagingElement; + private Hl7.Fhir.Model.FhirBoolean? _PagingElement; /// /// Whether the server supports paging on expansion @@ -1076,13 +1026,10 @@ public Hl7.Fhir.Model.FhirBoolean PagingElement [IgnoreDataMember] public bool? Paging { - get { return PagingElement != null ? PagingElement.Value : null; } + get => _PagingElement?.Value; set { - if (value == null) - PagingElement = null; - else - PagingElement = new Hl7.Fhir.Model.FhirBoolean(value); + PagingElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Paging"); } } @@ -1092,13 +1039,13 @@ public bool? Paging /// [FhirElement("incomplete", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IncompleteElement + public Hl7.Fhir.Model.FhirBoolean? IncompleteElement { get { return _IncompleteElement; } set { _IncompleteElement = value; OnPropertyChanged("IncompleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IncompleteElement; + private Hl7.Fhir.Model.FhirBoolean? _IncompleteElement; /// /// Allow request for incomplete expansions? @@ -1107,13 +1054,10 @@ public Hl7.Fhir.Model.FhirBoolean IncompleteElement [IgnoreDataMember] public bool? Incomplete { - get { return IncompleteElement != null ? IncompleteElement.Value : null; } + get => _IncompleteElement?.Value; set { - if (value == null) - IncompleteElement = null; - else - IncompleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + IncompleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Incomplete"); } } @@ -1126,58 +1070,51 @@ public bool? Incomplete [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Documentation about text searching works. /// [FhirElement("textFilter", Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown TextFilterElement + public Hl7.Fhir.Model.Markdown? TextFilterElement { get { return _TextFilterElement; } set { _TextFilterElement = value; OnPropertyChanged("TextFilterElement"); } } - private Hl7.Fhir.Model.Markdown _TextFilterElement; + private Hl7.Fhir.Model.Markdown? _TextFilterElement; /// /// Documentation about text searching works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextFilter + public string? TextFilter { - get { return TextFilterElement != null ? TextFilterElement.Value : null; } + get => _TextFilterElement?.Value; set { - if (value == null) - TextFilterElement = null; - else - TextFilterElement = new Hl7.Fhir.Model.Markdown(value); + TextFilterElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("TextFilter"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ExpansionComponent; - - if (dest == null) - { + if(other is not ExpansionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(HierarchicalElement != null) dest.HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)HierarchicalElement.DeepCopyInternal(); - if(PagingElement != null) dest.PagingElement = (Hl7.Fhir.Model.FhirBoolean)PagingElement.DeepCopyInternal(); - if(IncompleteElement != null) dest.IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)IncompleteElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(TextFilterElement != null) dest.TextFilterElement = (Hl7.Fhir.Model.Markdown)TextFilterElement.DeepCopyInternal(); + if(_HierarchicalElement is not null) dest.HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)_HierarchicalElement.DeepCopyInternal(); + if(_PagingElement is not null) dest.PagingElement = (Hl7.Fhir.Model.FhirBoolean)_PagingElement.DeepCopyInternal(); + if(_IncompleteElement is not null) dest.IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)_IncompleteElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_TextFilterElement is not null) dest.TextFilterElement = (Hl7.Fhir.Model.Markdown)_TextFilterElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1189,62 +1126,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExpansionComponent; - if(otherT == null) return false; + if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(HierarchicalElement, otherT.HierarchicalElement)) return false; - if(!comparer.Equals(PagingElement, otherT.PagingElement)) return false; - if(!comparer.Equals(IncompleteElement, otherT.IncompleteElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(TextFilterElement, otherT.TextFilterElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; + if(!comparer.Equals(_PagingElement, otherT._PagingElement)) return false; + if(!comparer.Equals(_IncompleteElement, otherT._IncompleteElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_TextFilterElement, otherT._TextFilterElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "hierarchical": - value = HierarchicalElement; - return HierarchicalElement is not null; + value = _HierarchicalElement; + return _HierarchicalElement is not null; case "paging": - value = PagingElement; - return PagingElement is not null; + value = _PagingElement; + return _PagingElement is not null; case "incomplete": - value = IncompleteElement; - return IncompleteElement is not null; + value = _IncompleteElement; + return _IncompleteElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "textFilter": - value = TextFilterElement; - return TextFilterElement is not null; + value = _TextFilterElement; + return _TextFilterElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "hierarchical": - HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)value; + HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "paging": - PagingElement = (Hl7.Fhir.Model.FhirBoolean)value; + PagingElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "incomplete": - IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + IncompleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "textFilter": - TextFilterElement = (Hl7.Fhir.Model.Markdown)value; + TextFilterElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1255,11 +1192,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (HierarchicalElement is not null) yield return new KeyValuePair("hierarchical",HierarchicalElement); - if (PagingElement is not null) yield return new KeyValuePair("paging",PagingElement); - if (IncompleteElement is not null) yield return new KeyValuePair("incomplete",IncompleteElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (TextFilterElement is not null) yield return new KeyValuePair("textFilter",TextFilterElement); + if (_HierarchicalElement is not null) yield return new KeyValuePair("hierarchical",_HierarchicalElement); + if (_PagingElement is not null) yield return new KeyValuePair("paging",_PagingElement); + if (_IncompleteElement is not null) yield return new KeyValuePair("incomplete",_IncompleteElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_TextFilterElement is not null) yield return new KeyValuePair("textFilter",_TextFilterElement); } } @@ -1283,28 +1220,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Expansion Parameter name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -1314,44 +1248,37 @@ public string Name /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Description of support for parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1363,41 +1290,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1408,8 +1335,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1433,13 +1360,13 @@ public partial class ValidateCodeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("translations", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TranslationsElement + public Hl7.Fhir.Model.FhirBoolean? TranslationsElement { get { return _TranslationsElement; } set { _TranslationsElement = value; OnPropertyChanged("TranslationsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TranslationsElement; + private Hl7.Fhir.Model.FhirBoolean? _TranslationsElement; /// /// Whether translations are validated @@ -1448,28 +1375,21 @@ public Hl7.Fhir.Model.FhirBoolean TranslationsElement [IgnoreDataMember] public bool? Translations { - get { return TranslationsElement != null ? TranslationsElement.Value : null; } + get => _TranslationsElement?.Value; set { - if (value == null) - TranslationsElement = null; - else - TranslationsElement = new Hl7.Fhir.Model.FhirBoolean(value); + TranslationsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Translations"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ValidateCodeComponent; - - if (dest == null) - { + if(other is not ValidateCodeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TranslationsElement != null) dest.TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)TranslationsElement.DeepCopyInternal(); + if(_TranslationsElement is not null) dest.TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)_TranslationsElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1481,34 +1401,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValidateCodeComponent; - if(otherT == null) return false; + if(other is not ValidateCodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TranslationsElement, otherT.TranslationsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "translations": - value = TranslationsElement; - return TranslationsElement is not null; + value = _TranslationsElement; + return _TranslationsElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "translations": - TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)value; + TranslationsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1519,7 +1439,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TranslationsElement is not null) yield return new KeyValuePair("translations",TranslationsElement); + if (_TranslationsElement is not null) yield return new KeyValuePair("translations",_TranslationsElement); } } @@ -1543,13 +1463,13 @@ public partial class TranslationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("needsMap", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NeedsMapElement + public Hl7.Fhir.Model.FhirBoolean? NeedsMapElement { get { return _NeedsMapElement; } set { _NeedsMapElement = value; OnPropertyChanged("NeedsMapElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NeedsMapElement; + private Hl7.Fhir.Model.FhirBoolean? _NeedsMapElement; /// /// Whether the client must identify the map @@ -1558,28 +1478,21 @@ public Hl7.Fhir.Model.FhirBoolean NeedsMapElement [IgnoreDataMember] public bool? NeedsMap { - get { return NeedsMapElement != null ? NeedsMapElement.Value : null; } + get => _NeedsMapElement?.Value; set { - if (value == null) - NeedsMapElement = null; - else - NeedsMapElement = new Hl7.Fhir.Model.FhirBoolean(value); + NeedsMapElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NeedsMap"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TranslationComponent; - - if (dest == null) - { + if(other is not TranslationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NeedsMapElement != null) dest.NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)NeedsMapElement.DeepCopyInternal(); + if(_NeedsMapElement is not null) dest.NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)_NeedsMapElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1591,34 +1504,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TranslationComponent; - if(otherT == null) return false; + if(other is not TranslationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NeedsMapElement, otherT.NeedsMapElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "needsMap": - value = NeedsMapElement; - return NeedsMapElement is not null; + value = _NeedsMapElement; + return _NeedsMapElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "needsMap": - NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)value; + NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1629,7 +1542,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NeedsMapElement is not null) yield return new KeyValuePair("needsMap",NeedsMapElement); + if (_NeedsMapElement is not null) yield return new KeyValuePair("needsMap",_NeedsMapElement); } } @@ -1655,13 +1568,13 @@ public partial class ClosureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("translation", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TranslationElement + public Hl7.Fhir.Model.FhirBoolean? TranslationElement { get { return _TranslationElement; } set { _TranslationElement = value; OnPropertyChanged("TranslationElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TranslationElement; + private Hl7.Fhir.Model.FhirBoolean? _TranslationElement; /// /// If cross-system closure is supported @@ -1670,28 +1583,21 @@ public Hl7.Fhir.Model.FhirBoolean TranslationElement [IgnoreDataMember] public bool? Translation { - get { return TranslationElement != null ? TranslationElement.Value : null; } + get => _TranslationElement?.Value; set { - if (value == null) - TranslationElement = null; - else - TranslationElement = new Hl7.Fhir.Model.FhirBoolean(value); + TranslationElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Translation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ClosureComponent; - - if (dest == null) - { + if(other is not ClosureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TranslationElement != null) dest.TranslationElement = (Hl7.Fhir.Model.FhirBoolean)TranslationElement.DeepCopyInternal(); + if(_TranslationElement is not null) dest.TranslationElement = (Hl7.Fhir.Model.FhirBoolean)_TranslationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1703,34 +1609,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClosureComponent; - if(otherT == null) return false; + if(other is not ClosureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TranslationElement, otherT.TranslationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "translation": - value = TranslationElement; - return TranslationElement is not null; + value = _TranslationElement; + return _TranslationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "translation": - TranslationElement = (Hl7.Fhir.Model.FhirBoolean)value; + TranslationElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1741,7 +1647,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TranslationElement is not null) yield return new KeyValuePair("translation",TranslationElement); + if (_TranslationElement is not null) yield return new KeyValuePair("translation",_TranslationElement); } } @@ -1751,28 +1657,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this terminology capabilities, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1782,28 +1685,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the terminology capabilities /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1813,28 +1713,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this terminology capabilities (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1844,28 +1741,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this terminology capabilities (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1878,13 +1772,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1893,13 +1787,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1909,13 +1800,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1924,13 +1815,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1941,28 +1829,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1972,28 +1857,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2006,39 +1888,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the terminology capabilities. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the terminology capabilities /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2051,11 +1930,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for terminology capabilities (if applicable). @@ -2066,39 +1945,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this terminology capabilities is defined. /// [FhirElement("purpose", Order=210, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this terminology capabilities is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2108,28 +1984,25 @@ public string Purpose /// [FhirElement("copyright", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2142,13 +2015,13 @@ public string Copyright [Binding("CapabilityStatementKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// instance | capability | requirements @@ -2157,13 +2030,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatementKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -2173,39 +2043,39 @@ public Hl7.Fhir.Model.CapabilityStatementKind? Kind /// [FhirElement("software", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent Software + public Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent? Software { get { return _Software; } set { _Software = value; OnPropertyChanged("Software"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent _Software; + private Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent? _Software; /// /// If this describes a specific instance. /// [FhirElement("implementation", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent Implementation + public Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent? Implementation { get { return _Implementation; } set { _Implementation = value; OnPropertyChanged("Implementation"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent _Implementation; + private Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent? _Implementation; /// /// Whether lockedDate is supported. /// [FhirElement("lockedDate", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean LockedDateElement + public Hl7.Fhir.Model.FhirBoolean? LockedDateElement { get { return _LockedDateElement; } set { _LockedDateElement = value; OnPropertyChanged("LockedDateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _LockedDateElement; + private Hl7.Fhir.Model.FhirBoolean? _LockedDateElement; /// /// Whether lockedDate is supported @@ -2214,13 +2084,10 @@ public Hl7.Fhir.Model.FhirBoolean LockedDateElement [IgnoreDataMember] public bool? LockedDate { - get { return LockedDateElement != null ? LockedDateElement.Value : null; } + get => _LockedDateElement?.Value; set { - if (value == null) - LockedDateElement = null; - else - LockedDateElement = new Hl7.Fhir.Model.FhirBoolean(value); + LockedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("LockedDate"); } } @@ -2233,24 +2100,24 @@ public bool? LockedDate [DataMember] public List CodeSystem { - get { if(_CodeSystem==null) _CodeSystem = new List(); return _CodeSystem; } + get => _CodeSystem ?? new List(); set { _CodeSystem = value; OnPropertyChanged("CodeSystem"); } } - private List _CodeSystem; + private List? _CodeSystem; /// /// Information about the [ValueSet/$expand](valueset-operation-expand.html) operation. /// [FhirElement("expansion", Order=280)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent Expansion + public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent? Expansion { get { return _Expansion; } set { _Expansion = value; OnPropertyChanged("Expansion"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent _Expansion; + private Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent? _Expansion; /// /// explicit | all. @@ -2259,13 +2126,13 @@ public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent Expansion [DeclaredType(Type = typeof(Code))] [Binding("CodeSearchSupport")] [DataMember] - public Code CodeSearchElement + public Code? CodeSearchElement { get { return _CodeSearchElement; } set { _CodeSearchElement = value; OnPropertyChanged("CodeSearchElement"); } } - private Code _CodeSearchElement; + private Code? _CodeSearchElement; /// /// explicit | all @@ -2274,13 +2141,10 @@ public Code CodeSearch [IgnoreDataMember] public Hl7.Fhir.Model.TerminologyCapabilities.CodeSearchSupport? CodeSearch { - get { return CodeSearchElement != null ? CodeSearchElement.Value : null; } + get => _CodeSearchElement?.Value; set { - if (value == null) - CodeSearchElement = null; - else - CodeSearchElement = new Code(value); + CodeSearchElement = value is null ? null : new Code(value); OnPropertyChanged("CodeSearch"); } } @@ -2290,74 +2154,70 @@ public Hl7.Fhir.Model.TerminologyCapabilities.CodeSearchSupport? CodeSearch /// [FhirElement("validateCode", Order=300)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent ValidateCode + public Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent? ValidateCode { get { return _ValidateCode; } set { _ValidateCode = value; OnPropertyChanged("ValidateCode"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent _ValidateCode; + private Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent? _ValidateCode; /// /// Information about the [ConceptMap/$translate](conceptmap-operation-translate.html) operation. /// [FhirElement("translation", Order=310)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent Translation + public Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent? Translation { get { return _Translation; } set { _Translation = value; OnPropertyChanged("Translation"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent _Translation; + private Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent? _Translation; /// /// Information about the [ConceptMap/$closure](conceptmap-operation-closure.html) operation. /// [FhirElement("closure", Order=320)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent Closure + public Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent? Closure { get { return _Closure; } set { _Closure = value; OnPropertyChanged("Closure"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent _Closure; + private Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent? _Closure; protected internal override void CopyToInternal(Base other) { - var dest = other as TerminologyCapabilities; - - if (dest == null) - { + if(other is not TerminologyCapabilities dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Software != null) dest.Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)Software.DeepCopyInternal(); - if(Implementation != null) dest.Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)Implementation.DeepCopyInternal(); - if(LockedDateElement != null) dest.LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)LockedDateElement.DeepCopyInternal(); - if(CodeSystem.Any()) dest.CodeSystem = new List(CodeSystem.DeepCopyInternal()); - if(Expansion != null) dest.Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)Expansion.DeepCopyInternal(); - if(CodeSearchElement != null) dest.CodeSearchElement = (Code)CodeSearchElement.DeepCopyInternal(); - if(ValidateCode != null) dest.ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)ValidateCode.DeepCopyInternal(); - if(Translation != null) dest.Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)Translation.DeepCopyInternal(); - if(Closure != null) dest.Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)Closure.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Software is not null) dest.Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)_Software.DeepCopyInternal(); + if(_Implementation is not null) dest.Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)_Implementation.DeepCopyInternal(); + if(_LockedDateElement is not null) dest.LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)_LockedDateElement.DeepCopyInternal(); + if(_CodeSystem is not null) dest.CodeSystem = new List(_CodeSystem.DeepCopyInternal()); + if(_Expansion is not null) dest.Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)_Expansion.DeepCopyInternal(); + if(_CodeSearchElement is not null) dest.CodeSearchElement = (Code)_CodeSearchElement.DeepCopyInternal(); + if(_ValidateCode is not null) dest.ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)_ValidateCode.DeepCopyInternal(); + if(_Translation is not null) dest.Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)_Translation.DeepCopyInternal(); + if(_Closure is not null) dest.Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)_Closure.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2369,195 +2229,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TerminologyCapabilities; - if(otherT == null) return false; + if(other is not TerminologyCapabilities otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Software, otherT.Software)) return false; - if(!comparer.Equals(Implementation, otherT.Implementation)) return false; - if(!comparer.Equals(LockedDateElement, otherT.LockedDateElement)) return false; - if(!comparer.ListEquals(CodeSystem, otherT.CodeSystem)) return false; - if(!comparer.Equals(Expansion, otherT.Expansion)) return false; - if(!comparer.Equals(CodeSearchElement, otherT.CodeSearchElement)) return false; - if(!comparer.Equals(ValidateCode, otherT.ValidateCode)) return false; - if(!comparer.Equals(Translation, otherT.Translation)) return false; - if(!comparer.Equals(Closure, otherT.Closure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Software, otherT._Software)) return false; + if(!comparer.Equals(_Implementation, otherT._Implementation)) return false; + if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + if(!comparer.ListEquals(_CodeSystem, otherT._CodeSystem)) return false; + if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; + if(!comparer.Equals(_CodeSearchElement, otherT._CodeSearchElement)) return false; + if(!comparer.Equals(_ValidateCode, otherT._ValidateCode)) return false; + if(!comparer.Equals(_Translation, otherT._Translation)) return false; + if(!comparer.Equals(_Closure, otherT._Closure)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "software": - value = Software; - return Software is not null; + value = _Software; + return _Software is not null; case "implementation": - value = Implementation; - return Implementation is not null; + value = _Implementation; + return _Implementation is not null; case "lockedDate": - value = LockedDateElement; - return LockedDateElement is not null; + value = _LockedDateElement; + return _LockedDateElement is not null; case "codeSystem": - value = CodeSystem; - return CodeSystem?.Any() == true; + value = _CodeSystem; + return _CodeSystem?.Any() == true; case "expansion": - value = Expansion; - return Expansion is not null; + value = _Expansion; + return _Expansion is not null; case "codeSearch": - value = CodeSearchElement; - return CodeSearchElement is not null; + value = _CodeSearchElement; + return _CodeSearchElement is not null; case "validateCode": - value = ValidateCode; - return ValidateCode is not null; + value = _ValidateCode; + return _ValidateCode is not null; case "translation": - value = Translation; - return Translation is not null; + value = _Translation; + return _Translation is not null; case "closure": - value = Closure; - return Closure is not null; + value = _Closure; + return _Closure is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "software": - Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)value; + Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent?)value; return this; case "implementation": - Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)value; + Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent?)value; return this; case "lockedDate": - LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)value; + LockedDateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "codeSystem": - CodeSystem = (List)value; + CodeSystem = (List?)value!; return this; case "expansion": - Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)value; + Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent?)value; return this; case "codeSearch": - CodeSearchElement = (Code)value; + CodeSearchElement = (Code?)value; return this; case "validateCode": - ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)value; + ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent?)value; return this; case "translation": - Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)value; + Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent?)value; return this; case "closure": - Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)value; + Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent?)value; return this; default: return base.SetValue(key, value); @@ -2568,30 +2428,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Software is not null) yield return new KeyValuePair("software",Software); - if (Implementation is not null) yield return new KeyValuePair("implementation",Implementation); - if (LockedDateElement is not null) yield return new KeyValuePair("lockedDate",LockedDateElement); - if (CodeSystem?.Any() == true) yield return new KeyValuePair("codeSystem",CodeSystem); - if (Expansion is not null) yield return new KeyValuePair("expansion",Expansion); - if (CodeSearchElement is not null) yield return new KeyValuePair("codeSearch",CodeSearchElement); - if (ValidateCode is not null) yield return new KeyValuePair("validateCode",ValidateCode); - if (Translation is not null) yield return new KeyValuePair("translation",Translation); - if (Closure is not null) yield return new KeyValuePair("closure",Closure); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Software is not null) yield return new KeyValuePair("software",_Software); + if (_Implementation is not null) yield return new KeyValuePair("implementation",_Implementation); + if (_LockedDateElement is not null) yield return new KeyValuePair("lockedDate",_LockedDateElement); + if (_CodeSystem?.Any() == true) yield return new KeyValuePair("codeSystem",_CodeSystem); + if (_Expansion is not null) yield return new KeyValuePair("expansion",_Expansion); + if (_CodeSearchElement is not null) yield return new KeyValuePair("codeSearch",_CodeSearchElement); + if (_ValidateCode is not null) yield return new KeyValuePair("validateCode",_ValidateCode); + if (_Translation is not null) yield return new KeyValuePair("translation",_Translation); + if (_Closure is not null) yield return new KeyValuePair("closure",_Closure); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs index cb39b7f04..8b814160a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("TestReport","http://hl7.org/fhir/StructureDefinition/TestReport")] - public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -216,13 +219,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// test-engine | client | server @@ -231,13 +234,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -248,28 +248,25 @@ public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type [FhirElement("uri", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// The uri of the participant. An absolute URL is preferred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -279,45 +276,38 @@ public string Uri /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// The display name of the participant /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -329,48 +319,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -381,9 +371,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -409,23 +399,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -437,34 +423,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -475,7 +461,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -502,39 +488,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -546,41 +528,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -591,8 +573,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -621,13 +603,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -636,13 +618,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -652,28 +631,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -683,45 +659,38 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri DetailElement + public Hl7.Fhir.Model.FhirUri? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirUri _DetailElement; + private Hl7.Fhir.Model.FhirUri? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirUri(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Detail"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)DetailElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)_DetailElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -733,48 +702,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirUri)value; + DetailElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -785,9 +754,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); } } @@ -816,13 +785,13 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -831,13 +800,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -847,28 +813,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -878,45 +841,38 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DetailElement + public Hl7.Fhir.Model.FhirString? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirString _DetailElement; + private Hl7.Fhir.Model.FhirString? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirString(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Detail"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)_DetailElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -928,48 +884,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirString)value; + DetailElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -980,9 +936,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); } } @@ -1005,28 +961,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1036,28 +989,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1070,25 +1020,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1100,48 +1046,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1152,9 +1098,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1181,39 +1127,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion performed. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1225,41 +1167,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -1270,8 +1212,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -1300,23 +1242,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1328,34 +1266,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1366,7 +1304,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1394,25 +1332,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1424,34 +1358,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -1462,7 +1396,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -1472,41 +1406,38 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Informal name of the executed TestScript. /// [FhirElement("name", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Informal name of the executed TestScript /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1519,13 +1450,13 @@ public string Name [Binding("TestReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | in-progress | waiting | stopped | entered-in-error @@ -1534,13 +1465,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1553,13 +1481,13 @@ public Hl7.Fhir.Model.TestReport.TestReportStatus? Status [References("TestScript")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference TestScript + public Hl7.Fhir.Model.ResourceReference? TestScript { get { return _TestScript; } set { _TestScript = value; OnPropertyChanged("TestScript"); } } - private Hl7.Fhir.Model.ResourceReference _TestScript; + private Hl7.Fhir.Model.ResourceReference? _TestScript; /// /// pass | fail | pending. @@ -1569,13 +1497,13 @@ public Hl7.Fhir.Model.ResourceReference TestScript [Binding("TestReportResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | fail | pending @@ -1584,13 +1512,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -1600,13 +1525,13 @@ public Hl7.Fhir.Model.TestReport.TestReportResult? Result /// [FhirElement("score", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ScoreElement + public Hl7.Fhir.Model.FhirDecimal? ScoreElement { get { return _ScoreElement; } set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _ScoreElement; /// /// The final score (percentage of tests passed) resulting from the execution of the TestScript @@ -1615,13 +1540,10 @@ public Hl7.Fhir.Model.FhirDecimal ScoreElement [IgnoreDataMember] public decimal? Score { - get { return ScoreElement != null ? ScoreElement.Value : null; } + get => _ScoreElement?.Value; set { - if (value == null) - ScoreElement = null; - else - ScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + ScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Score"); } } @@ -1631,28 +1553,25 @@ public decimal? Score /// [FhirElement("tester", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString TesterElement + public Hl7.Fhir.Model.FhirString? TesterElement { get { return _TesterElement; } set { _TesterElement = value; OnPropertyChanged("TesterElement"); } } - private Hl7.Fhir.Model.FhirString _TesterElement; + private Hl7.Fhir.Model.FhirString? _TesterElement; /// /// Name of the tester producing this report (Organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Tester + public string? Tester { - get { return TesterElement != null ? TesterElement.Value : null; } + get => _TesterElement?.Value; set { - if (value == null) - TesterElement = null; - else - TesterElement = new Hl7.Fhir.Model.FhirString(value); + TesterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Tester"); } } @@ -1662,28 +1581,25 @@ public string Tester /// [FhirElement("issued", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When the TestScript was executed and this TestReport was generated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -1696,24 +1612,24 @@ public string Issued [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The results of the series of required setup operations before the tests were executed. /// [FhirElement("setup", Order=180)] [DataMember] - public Hl7.Fhir.Model.TestReport.SetupComponent Setup + public Hl7.Fhir.Model.TestReport.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestReport.SetupComponent _Setup; + private Hl7.Fhir.Model.TestReport.SetupComponent? _Setup; /// /// A test executed from the test script. @@ -1723,49 +1639,45 @@ public Hl7.Fhir.Model.TestReport.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// The results of running the series of required clean up steps. /// [FhirElement("teardown", Order=200)] [DataMember] - public Hl7.Fhir.Model.TestReport.TeardownComponent Teardown + public Hl7.Fhir.Model.TestReport.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestReport.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestReport.TeardownComponent? _Teardown; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestReport; - - if (dest == null) - { + if(other is not TestReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TestScript != null) dest.TestScript = (Hl7.Fhir.Model.ResourceReference)TestScript.DeepCopyInternal(); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(ScoreElement != null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)ScoreElement.DeepCopyInternal(); - if(TesterElement != null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)TesterElement.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)Teardown.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TestScript is not null) dest.TestScript = (Hl7.Fhir.Model.ResourceReference)_TestScript.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_ScoreElement is not null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)_ScoreElement.DeepCopyInternal(); + if(_TesterElement is not null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)_TesterElement.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1777,111 +1689,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestReport; - if(otherT == null) return false; + if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TestScript, otherT.TestScript)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(ScoreElement, otherT.ScoreElement)) return false; - if(!comparer.Equals(TesterElement, otherT.TesterElement)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TestScript, otherT._TestScript)) return false; + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false; + if(!comparer.Equals(_TesterElement, otherT._TesterElement)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "testScript": - value = TestScript; - return TestScript is not null; + value = _TestScript; + return _TestScript is not null; case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "score": - value = ScoreElement; - return ScoreElement is not null; + value = _ScoreElement; + return _ScoreElement is not null; case "tester": - value = TesterElement; - return TesterElement is not null; + value = _TesterElement; + return _TesterElement is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "testScript": - TestScript = (Hl7.Fhir.Model.ResourceReference)value; + TestScript = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "score": - ScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + ScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tester": - TesterElement = (Hl7.Fhir.Model.FhirString)value; + TesterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestReport.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -1892,18 +1804,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TestScript is not null) yield return new KeyValuePair("testScript",TestScript); - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (ScoreElement is not null) yield return new KeyValuePair("score",ScoreElement); - if (TesterElement is not null) yield return new KeyValuePair("tester",TesterElement); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TestScript is not null) yield return new KeyValuePair("testScript",_TestScript); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_ScoreElement is not null) yield return new KeyValuePair("score",_ScoreElement); + if (_TesterElement is not null) yield return new KeyValuePair("tester",_TesterElement); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs index ad7fed374..5d44dd5de 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("TestScript","http://hl7.org/fhir/StructureDefinition/TestScript")] - public partial class TestScript : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class TestScript : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -314,13 +317,13 @@ public partial class OriginComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract origin server starting at 1 @@ -329,13 +332,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -347,26 +347,22 @@ public int? Index [Binding("TestScriptProfileOriginType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as OriginComponent; - - if (dest == null) - { + if(other is not OriginComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -378,41 +374,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OriginComponent; - if(otherT == null) return false; + if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -423,8 +419,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -452,13 +448,13 @@ public partial class DestinationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract destination server starting at 1 @@ -467,13 +463,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -485,26 +478,22 @@ public int? Index [Binding("TestScriptProfileDestinationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as DestinationComponent; - - if (dest == null) - { + if(other is not DestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -516,41 +505,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DestinationComponent; - if(otherT == null) return false; + if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -561,8 +550,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -591,11 +580,11 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; /// /// Capabilities that are assumed to function correctly on the FHIR server being tested. @@ -605,24 +594,20 @@ public List Link [DataMember] public List Capability { - get { if(_Capability==null) _Capability = new List(); return _Capability; } + get => _Capability ?? new List(); set { _Capability = value; OnPropertyChanged("Capability"); } } - private List _Capability; + private List? _Capability; protected internal override void CopyToInternal(Base other) { - var dest = other as MetadataComponent; - - if (dest == null) - { + if(other is not MetadataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); - if(Capability.Any()) dest.Capability = new List(Capability.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); + if(_Capability is not null) dest.Capability = new List(_Capability.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -634,41 +619,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MetadataComponent; - if(otherT == null) return false; + if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; - if(!comparer.ListEquals(Capability, otherT.Capability)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; case "capability": - value = Capability; - return Capability?.Any() == true; + value = _Capability; + return _Capability?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "link": - Link = (List)value; + Link = (List?)value!; return this; case "capability": - Capability = (List)value; + Capability = (List?)value!; return this; default: return base.SetValue(key, value); @@ -679,8 +664,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); - if (Capability?.Any() == true) yield return new KeyValuePair("capability",Capability); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); + if (_Capability?.Any() == true) yield return new KeyValuePair("capability",_Capability); } } @@ -707,28 +692,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URL to the specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -738,44 +720,37 @@ public string Url /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -787,41 +762,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -832,8 +807,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -861,13 +836,13 @@ public partial class CapabilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("required", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Are the capabilities required? @@ -876,13 +851,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -893,13 +865,13 @@ public bool? Required [FhirElement("validated", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ValidatedElement + public Hl7.Fhir.Model.FhirBoolean? ValidatedElement { get { return _ValidatedElement; } set { _ValidatedElement = value; OnPropertyChanged("ValidatedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ValidatedElement; + private Hl7.Fhir.Model.FhirBoolean? _ValidatedElement; /// /// Are the capabilities validated? @@ -908,13 +880,10 @@ public Hl7.Fhir.Model.FhirBoolean ValidatedElement [IgnoreDataMember] public bool? Validated { - get { return ValidatedElement != null ? ValidatedElement.Value : null; } + get => _ValidatedElement?.Value; set { - if (value == null) - ValidatedElement = null; - else - ValidatedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ValidatedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Validated"); } } @@ -924,28 +893,25 @@ public bool? Validated /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The expected capabilities of the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -958,24 +924,24 @@ public string Description [DataMember] public List OriginElement { - get { if(_OriginElement==null) _OriginElement = new List(); return _OriginElement; } + get => _OriginElement ?? new List(); set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private List _OriginElement; + private List? _OriginElement; /// /// Which origin server these requirements apply to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Origin + public IEnumerable? Origin { - get { return OriginElement != null ? OriginElement.Select(elem => elem.Value) : null; } + get => _OriginElement?.Select(elem => elem.Value); set { if (value == null) - OriginElement = null; + OriginElement = null!; else OriginElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("Origin"); @@ -987,13 +953,13 @@ public IEnumerable Origin /// [FhirElement("destination", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Which server these requirements apply to @@ -1002,13 +968,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -1021,24 +984,24 @@ public int? Destination [DataMember] public List LinkElement { - get { if(_LinkElement==null) _LinkElement = new List(); return _LinkElement; } + get => _LinkElement ?? new List(); set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } - private List _LinkElement; + private List? _LinkElement; /// /// Links to the FHIR specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Link + public IEnumerable? Link { - get { return LinkElement != null ? LinkElement.Select(elem => elem.Value) : null; } + get => _LinkElement?.Select(elem => elem.Value); set { if (value == null) - LinkElement = null; + LinkElement = null!; else LinkElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Link"); @@ -1051,49 +1014,42 @@ public IEnumerable Link [FhirElement("capabilities", Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical CapabilitiesElement + public Hl7.Fhir.Model.Canonical? CapabilitiesElement { get { return _CapabilitiesElement; } set { _CapabilitiesElement = value; OnPropertyChanged("CapabilitiesElement"); } } - private Hl7.Fhir.Model.Canonical _CapabilitiesElement; + private Hl7.Fhir.Model.Canonical? _CapabilitiesElement; /// /// Required Capability Statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Capabilities + public string? Capabilities { - get { return CapabilitiesElement != null ? CapabilitiesElement.Value : null; } + get => _CapabilitiesElement?.Value; set { - if (value == null) - CapabilitiesElement = null; - else - CapabilitiesElement = new Hl7.Fhir.Model.Canonical(value); + CapabilitiesElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Capabilities"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityComponent; - - if (dest == null) - { + if(other is not CapabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(ValidatedElement != null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)ValidatedElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OriginElement.Any()) dest.OriginElement = new List(OriginElement.DeepCopyInternal()); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(LinkElement.Any()) dest.LinkElement = new List(LinkElement.DeepCopyInternal()); - if(CapabilitiesElement != null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)CapabilitiesElement.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_ValidatedElement is not null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)_ValidatedElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = new List(_OriginElement.DeepCopyInternal()); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_LinkElement is not null) dest.LinkElement = new List(_LinkElement.DeepCopyInternal()); + if(_CapabilitiesElement is not null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)_CapabilitiesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1105,76 +1061,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityComponent; - if(otherT == null) return false; + if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(ValidatedElement, otherT.ValidatedElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.ListEquals(LinkElement, otherT.LinkElement)) return false; - if(!comparer.Equals(CapabilitiesElement, otherT.CapabilitiesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; + if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "validated": - value = ValidatedElement; - return ValidatedElement is not null; + value = _ValidatedElement; + return _ValidatedElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "origin": - value = OriginElement; - return OriginElement?.Any() == true; + value = _OriginElement; + return _OriginElement?.Any() == true; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "link": - value = LinkElement; - return LinkElement?.Any() == true; + value = _LinkElement; + return _LinkElement?.Any() == true; case "capabilities": - value = CapabilitiesElement; - return CapabilitiesElement is not null; + value = _CapabilitiesElement; + return _CapabilitiesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "validated": - ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ValidatedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "origin": - OriginElement = (List)value; + OriginElement = (List?)value!; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "link": - LinkElement = (List)value; + LinkElement = (List?)value!; return this; case "capabilities": - CapabilitiesElement = (Hl7.Fhir.Model.Canonical)value; + CapabilitiesElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1185,13 +1141,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (ValidatedElement is not null) yield return new KeyValuePair("validated",ValidatedElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OriginElement?.Any() == true) yield return new KeyValuePair("origin",OriginElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (LinkElement?.Any() == true) yield return new KeyValuePair("link",LinkElement); - if (CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",CapabilitiesElement); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_ValidatedElement is not null) yield return new KeyValuePair("validated",_ValidatedElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OriginElement?.Any() == true) yield return new KeyValuePair("origin",_OriginElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_LinkElement?.Any() == true) yield return new KeyValuePair("link",_LinkElement); + if (_CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",_CapabilitiesElement); } } @@ -1218,13 +1174,13 @@ public partial class FixtureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("autocreate", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutocreateElement + public Hl7.Fhir.Model.FhirBoolean? AutocreateElement { get { return _AutocreateElement; } set { _AutocreateElement = value; OnPropertyChanged("AutocreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutocreateElement; + private Hl7.Fhir.Model.FhirBoolean? _AutocreateElement; /// /// Whether or not to implicitly create the fixture during setup @@ -1233,13 +1189,10 @@ public Hl7.Fhir.Model.FhirBoolean AutocreateElement [IgnoreDataMember] public bool? Autocreate { - get { return AutocreateElement != null ? AutocreateElement.Value : null; } + get => _AutocreateElement?.Value; set { - if (value == null) - AutocreateElement = null; - else - AutocreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutocreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autocreate"); } } @@ -1250,13 +1203,13 @@ public bool? Autocreate [FhirElement("autodelete", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutodeleteElement + public Hl7.Fhir.Model.FhirBoolean? AutodeleteElement { get { return _AutodeleteElement; } set { _AutodeleteElement = value; OnPropertyChanged("AutodeleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutodeleteElement; + private Hl7.Fhir.Model.FhirBoolean? _AutodeleteElement; /// /// Whether or not to implicitly delete the fixture during teardown @@ -1265,13 +1218,10 @@ public Hl7.Fhir.Model.FhirBoolean AutodeleteElement [IgnoreDataMember] public bool? Autodelete { - get { return AutodeleteElement != null ? AutodeleteElement.Value : null; } + get => _AutodeleteElement?.Value; set { - if (value == null) - AutodeleteElement = null; - else - AutodeleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutodeleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autodelete"); } } @@ -1283,27 +1233,23 @@ public bool? Autodelete [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as FixtureComponent; - - if (dest == null) - { + if(other is not FixtureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AutocreateElement != null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)AutocreateElement.DeepCopyInternal(); - if(AutodeleteElement != null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)AutodeleteElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_AutocreateElement is not null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)_AutocreateElement.DeepCopyInternal(); + if(_AutodeleteElement is not null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)_AutodeleteElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1315,48 +1261,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FixtureComponent; - if(otherT == null) return false; + if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AutocreateElement, otherT.AutocreateElement)) return false; - if(!comparer.Equals(AutodeleteElement, otherT.AutodeleteElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "autocreate": - value = AutocreateElement; - return AutocreateElement is not null; + value = _AutocreateElement; + return _AutocreateElement is not null; case "autodelete": - value = AutodeleteElement; - return AutodeleteElement is not null; + value = _AutodeleteElement; + return _AutodeleteElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "autocreate": - AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutocreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "autodelete": - AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1367,9 +1313,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AutocreateElement is not null) yield return new KeyValuePair("autocreate",AutocreateElement); - if (AutodeleteElement is not null) yield return new KeyValuePair("autodelete",AutodeleteElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_AutocreateElement is not null) yield return new KeyValuePair("autocreate",_AutocreateElement); + if (_AutodeleteElement is not null) yield return new KeyValuePair("autodelete",_AutodeleteElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -1397,28 +1343,25 @@ public partial class VariableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptive name for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1428,28 +1371,25 @@ public string Name /// [FhirElement("defaultValue", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DefaultValueElement + public Hl7.Fhir.Model.FhirString? DefaultValueElement { get { return _DefaultValueElement; } set { _DefaultValueElement = value; OnPropertyChanged("DefaultValueElement"); } } - private Hl7.Fhir.Model.FhirString _DefaultValueElement; + private Hl7.Fhir.Model.FhirString? _DefaultValueElement; /// /// Default, hard-coded, or user-defined value for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DefaultValue + public string? DefaultValue { - get { return DefaultValueElement != null ? DefaultValueElement.Value : null; } + get => _DefaultValueElement?.Value; set { - if (value == null) - DefaultValueElement = null; - else - DefaultValueElement = new Hl7.Fhir.Model.FhirString(value); + DefaultValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DefaultValue"); } } @@ -1459,28 +1399,25 @@ public string DefaultValue /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1490,28 +1427,25 @@ public string Description /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The FHIRPath expression against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -1521,28 +1455,25 @@ public string Expression /// [FhirElement("headerField", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name for source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -1552,28 +1483,25 @@ public string HeaderField /// [FhirElement("hint", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString HintElement + public Hl7.Fhir.Model.FhirString? HintElement { get { return _HintElement; } set { _HintElement = value; OnPropertyChanged("HintElement"); } } - private Hl7.Fhir.Model.FhirString _HintElement; + private Hl7.Fhir.Model.FhirString? _HintElement; /// /// Hint help text for default value to enter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Hint + public string? Hint { - get { return HintElement != null ? HintElement.Value : null; } + get => _HintElement?.Value; set { - if (value == null) - HintElement = null; - else - HintElement = new Hl7.Fhir.Model.FhirString(value); + HintElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Hint"); } } @@ -1583,28 +1511,25 @@ public string Hint /// [FhirElement("path", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -1614,50 +1539,43 @@ public string Path /// [FhirElement("sourceId", Order=110)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField within this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VariableComponent; - - if (dest == null) - { + if(other is not VariableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DefaultValueElement != null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)DefaultValueElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(HintElement != null) dest.HintElement = (Hl7.Fhir.Model.FhirString)HintElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DefaultValueElement is not null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)_DefaultValueElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_HintElement is not null) dest.HintElement = (Hl7.Fhir.Model.FhirString)_HintElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1669,83 +1587,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableComponent; - if(otherT == null) return false; + if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DefaultValueElement, otherT.DefaultValueElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(HintElement, otherT.HintElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "defaultValue": - value = DefaultValueElement; - return DefaultValueElement is not null; + value = _DefaultValueElement; + return _DefaultValueElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "hint": - value = HintElement; - return HintElement is not null; + value = _HintElement; + return _HintElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValueElement = (Hl7.Fhir.Model.FhirString)value; + DefaultValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "hint": - HintElement = (Hl7.Fhir.Model.FhirString)value; + HintElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -1756,14 +1674,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",DefaultValueElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (HintElement is not null) yield return new KeyValuePair("hint",HintElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",_DefaultValueElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_HintElement is not null) yield return new KeyValuePair("hint",_HintElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); } } @@ -1789,23 +1707,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1817,34 +1731,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1855,7 +1769,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1882,39 +1796,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1926,41 +1836,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -1971,8 +1881,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -1999,13 +1909,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("TestScriptOperationCode")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Resource type. @@ -2014,13 +1924,13 @@ public Hl7.Fhir.Model.Coding Type [DeclaredType(Type = typeof(Code))] [Binding("FHIRDefinedType")] [DataMember] - public Code ResourceElement + public Code? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Code _ResourceElement; + private Code? _ResourceElement; /// /// Resource type @@ -2029,13 +1939,10 @@ public Code ResourceElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRDefinedType? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Code(value); + ResourceElement = value is null ? null : new Code(value); OnPropertyChanged("Resource"); } } @@ -2045,28 +1952,25 @@ public Hl7.Fhir.Model.FHIRDefinedType? Resource /// [FhirElement("label", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging operation label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2076,28 +1980,25 @@ public string Label /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting operation description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -2108,28 +2009,25 @@ public string Description [FhirElement("accept", Order=80)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code AcceptElement + public Hl7.Fhir.Model.Code? AcceptElement { get { return _AcceptElement; } set { _AcceptElement = value; OnPropertyChanged("AcceptElement"); } } - private Hl7.Fhir.Model.Code _AcceptElement; + private Hl7.Fhir.Model.Code? _AcceptElement; /// /// Mime type to accept in the payload of the response, with charset etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Accept + public string? Accept { - get { return AcceptElement != null ? AcceptElement.Value : null; } + get => _AcceptElement?.Value; set { - if (value == null) - AcceptElement = null; - else - AcceptElement = new Hl7.Fhir.Model.Code(value); + AcceptElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Accept"); } } @@ -2140,28 +2038,25 @@ public string Accept [FhirElement("contentType", Order=90)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// Mime type of the request payload contents, with charset etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -2171,13 +2066,13 @@ public string ContentType /// [FhirElement("destination", Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Server responding to the request @@ -2186,13 +2081,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -2203,13 +2095,13 @@ public int? Destination [FhirElement("encodeRequestUrl", Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement + public Hl7.Fhir.Model.FhirBoolean? EncodeRequestUrlElement { get { return _EncodeRequestUrlElement; } set { _EncodeRequestUrlElement = value; OnPropertyChanged("EncodeRequestUrlElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EncodeRequestUrlElement; + private Hl7.Fhir.Model.FhirBoolean? _EncodeRequestUrlElement; /// /// Whether or not to send the request url in encoded format @@ -2218,13 +2110,10 @@ public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement [IgnoreDataMember] public bool? EncodeRequestUrl { - get { return EncodeRequestUrlElement != null ? EncodeRequestUrlElement.Value : null; } + get => _EncodeRequestUrlElement?.Value; set { - if (value == null) - EncodeRequestUrlElement = null; - else - EncodeRequestUrlElement = new Hl7.Fhir.Model.FhirBoolean(value); + EncodeRequestUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EncodeRequestUrl"); } } @@ -2236,13 +2125,13 @@ public bool? EncodeRequestUrl [DeclaredType(Type = typeof(Code))] [Binding("TestScriptRequestMethodCode")] [DataMember] - public Code MethodElement + public Code? MethodElement { get { return _MethodElement; } set { _MethodElement = value; OnPropertyChanged("MethodElement"); } } - private Code _MethodElement; + private Code? _MethodElement; /// /// delete | get | options | patch | post | put | head @@ -2251,13 +2140,10 @@ public Code MethodElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? Method { - get { return MethodElement != null ? MethodElement.Value : null; } + get => _MethodElement?.Value; set { - if (value == null) - MethodElement = null; - else - MethodElement = new Code(value); + MethodElement = value is null ? null : new Code(value); OnPropertyChanged("Method"); } } @@ -2267,13 +2153,13 @@ public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? Method /// [FhirElement("origin", Order=130)] [DataMember] - public Hl7.Fhir.Model.Integer OriginElement + public Hl7.Fhir.Model.Integer? OriginElement { get { return _OriginElement; } set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private Hl7.Fhir.Model.Integer _OriginElement; + private Hl7.Fhir.Model.Integer? _OriginElement; /// /// Server initiating the request @@ -2282,13 +2168,10 @@ public Hl7.Fhir.Model.Integer OriginElement [IgnoreDataMember] public int? Origin { - get { return OriginElement != null ? OriginElement.Value : null; } + get => _OriginElement?.Value; set { - if (value == null) - OriginElement = null; - else - OriginElement = new Hl7.Fhir.Model.Integer(value); + OriginElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Origin"); } } @@ -2298,28 +2181,25 @@ public int? Origin /// [FhirElement("params", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ParamsElement + public Hl7.Fhir.Model.FhirString? ParamsElement { get { return _ParamsElement; } set { _ParamsElement = value; OnPropertyChanged("ParamsElement"); } } - private Hl7.Fhir.Model.FhirString _ParamsElement; + private Hl7.Fhir.Model.FhirString? _ParamsElement; /// /// Explicitly defined path parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Params + public string? Params { - get { return ParamsElement != null ? ParamsElement.Value : null; } + get => _ParamsElement?.Value; set { - if (value == null) - ParamsElement = null; - else - ParamsElement = new Hl7.Fhir.Model.FhirString(value); + ParamsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Params"); } } @@ -2332,39 +2212,36 @@ public string Params [DataMember] public List RequestHeader { - get { if(_RequestHeader==null) _RequestHeader = new List(); return _RequestHeader; } + get => _RequestHeader ?? new List(); set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } - private List _RequestHeader; + private List? _RequestHeader; /// /// Fixture Id of mapped request. /// [FhirElement("requestId", Order=160)] [DataMember] - public Hl7.Fhir.Model.Id RequestIdElement + public Hl7.Fhir.Model.Id? RequestIdElement { get { return _RequestIdElement; } set { _RequestIdElement = value; OnPropertyChanged("RequestIdElement"); } } - private Hl7.Fhir.Model.Id _RequestIdElement; + private Hl7.Fhir.Model.Id? _RequestIdElement; /// /// Fixture Id of mapped request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestId + public string? RequestId { - get { return RequestIdElement != null ? RequestIdElement.Value : null; } + get => _RequestIdElement?.Value; set { - if (value == null) - RequestIdElement = null; - else - RequestIdElement = new Hl7.Fhir.Model.Id(value); + RequestIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RequestId"); } } @@ -2374,28 +2251,25 @@ public string RequestId /// [FhirElement("responseId", Order=170)] [DataMember] - public Hl7.Fhir.Model.Id ResponseIdElement + public Hl7.Fhir.Model.Id? ResponseIdElement { get { return _ResponseIdElement; } set { _ResponseIdElement = value; OnPropertyChanged("ResponseIdElement"); } } - private Hl7.Fhir.Model.Id _ResponseIdElement; + private Hl7.Fhir.Model.Id? _ResponseIdElement; /// /// Fixture Id of mapped response /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseId + public string? ResponseId { - get { return ResponseIdElement != null ? ResponseIdElement.Value : null; } + get => _ResponseIdElement?.Value; set { - if (value == null) - ResponseIdElement = null; - else - ResponseIdElement = new Hl7.Fhir.Model.Id(value); + ResponseIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ResponseId"); } } @@ -2405,28 +2279,25 @@ public string ResponseId /// [FhirElement("sourceId", Order=180)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of body for PUT and POST requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -2436,28 +2307,25 @@ public string SourceId /// [FhirElement("targetId", Order=190)] [DataMember] - public Hl7.Fhir.Model.Id TargetIdElement + public Hl7.Fhir.Model.Id? TargetIdElement { get { return _TargetIdElement; } set { _TargetIdElement = value; OnPropertyChanged("TargetIdElement"); } } - private Hl7.Fhir.Model.Id _TargetIdElement; + private Hl7.Fhir.Model.Id? _TargetIdElement; /// /// Id of fixture used for extracting the [id], [type], and [vid] for GET requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetId + public string? TargetId { - get { return TargetIdElement != null ? TargetIdElement.Value : null; } + get => _TargetIdElement?.Value; set { - if (value == null) - TargetIdElement = null; - else - TargetIdElement = new Hl7.Fhir.Model.Id(value); + TargetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("TargetId"); } } @@ -2467,59 +2335,52 @@ public string TargetId /// [FhirElement("url", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UrlElement + public Hl7.Fhir.Model.FhirString? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirString _UrlElement; + private Hl7.Fhir.Model.FhirString? _UrlElement; /// /// Request URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirString(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Code)ResourceElement.DeepCopyInternal(); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(AcceptElement != null) dest.AcceptElement = (Hl7.Fhir.Model.Code)AcceptElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(EncodeRequestUrlElement != null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)EncodeRequestUrlElement.DeepCopyInternal(); - if(MethodElement != null) dest.MethodElement = (Code)MethodElement.DeepCopyInternal(); - if(OriginElement != null) dest.OriginElement = (Hl7.Fhir.Model.Integer)OriginElement.DeepCopyInternal(); - if(ParamsElement != null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)ParamsElement.DeepCopyInternal(); - if(RequestHeader.Any()) dest.RequestHeader = new List(RequestHeader.DeepCopyInternal()); - if(RequestIdElement != null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)RequestIdElement.DeepCopyInternal(); - if(ResponseIdElement != null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)ResponseIdElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(TargetIdElement != null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)TargetIdElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)UrlElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Code)_ResourceElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_AcceptElement is not null) dest.AcceptElement = (Hl7.Fhir.Model.Code)_AcceptElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_EncodeRequestUrlElement is not null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)_EncodeRequestUrlElement.DeepCopyInternal(); + if(_MethodElement is not null) dest.MethodElement = (Code)_MethodElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = (Hl7.Fhir.Model.Integer)_OriginElement.DeepCopyInternal(); + if(_ParamsElement is not null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)_ParamsElement.DeepCopyInternal(); + if(_RequestHeader is not null) dest.RequestHeader = new List(_RequestHeader.DeepCopyInternal()); + if(_RequestIdElement is not null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)_RequestIdElement.DeepCopyInternal(); + if(_ResponseIdElement is not null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)_ResponseIdElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_TargetIdElement is not null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)_TargetIdElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2531,146 +2392,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(AcceptElement, otherT.AcceptElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.Equals(EncodeRequestUrlElement, otherT.EncodeRequestUrlElement)) return false; - if(!comparer.Equals(MethodElement, otherT.MethodElement)) return false; - if(!comparer.Equals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(ParamsElement, otherT.ParamsElement)) return false; - if(!comparer.ListEquals(RequestHeader, otherT.RequestHeader)) return false; - if(!comparer.Equals(RequestIdElement, otherT.RequestIdElement)) return false; - if(!comparer.Equals(ResponseIdElement, otherT.ResponseIdElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(TargetIdElement, otherT.TargetIdElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_AcceptElement, otherT._AcceptElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.Equals(_EncodeRequestUrlElement, otherT._EncodeRequestUrlElement)) return false; + if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; + if(!comparer.Equals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; + if(!comparer.ListEquals(_RequestHeader, otherT._RequestHeader)) return false; + if(!comparer.Equals(_RequestIdElement, otherT._RequestIdElement)) return false; + if(!comparer.Equals(_ResponseIdElement, otherT._ResponseIdElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "accept": - value = AcceptElement; - return AcceptElement is not null; + value = _AcceptElement; + return _AcceptElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "encodeRequestUrl": - value = EncodeRequestUrlElement; - return EncodeRequestUrlElement is not null; + value = _EncodeRequestUrlElement; + return _EncodeRequestUrlElement is not null; case "method": - value = MethodElement; - return MethodElement is not null; + value = _MethodElement; + return _MethodElement is not null; case "origin": - value = OriginElement; - return OriginElement is not null; + value = _OriginElement; + return _OriginElement is not null; case "params": - value = ParamsElement; - return ParamsElement is not null; + value = _ParamsElement; + return _ParamsElement is not null; case "requestHeader": - value = RequestHeader; - return RequestHeader?.Any() == true; + value = _RequestHeader; + return _RequestHeader?.Any() == true; case "requestId": - value = RequestIdElement; - return RequestIdElement is not null; + value = _RequestIdElement; + return _RequestIdElement is not null; case "responseId": - value = ResponseIdElement; - return ResponseIdElement is not null; + value = _ResponseIdElement; + return _ResponseIdElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "targetId": - value = TargetIdElement; - return TargetIdElement is not null; + value = _TargetIdElement; + return _TargetIdElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "resource": - ResourceElement = (Code)value; + ResourceElement = (Code?)value; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "accept": - AcceptElement = (Hl7.Fhir.Model.Code)value; + AcceptElement = (Hl7.Fhir.Model.Code?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "encodeRequestUrl": - EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)value; + EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "method": - MethodElement = (Code)value; + MethodElement = (Code?)value; return this; case "origin": - OriginElement = (Hl7.Fhir.Model.Integer)value; + OriginElement = (Hl7.Fhir.Model.Integer?)value; return this; case "params": - ParamsElement = (Hl7.Fhir.Model.FhirString)value; + ParamsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestHeader": - RequestHeader = (List)value; + RequestHeader = (List?)value!; return this; case "requestId": - RequestIdElement = (Hl7.Fhir.Model.Id)value; + RequestIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "responseId": - ResponseIdElement = (Hl7.Fhir.Model.Id)value; + ResponseIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "targetId": - TargetIdElement = (Hl7.Fhir.Model.Id)value; + TargetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirString)value; + UrlElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2681,23 +2542,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (AcceptElement is not null) yield return new KeyValuePair("accept",AcceptElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",EncodeRequestUrlElement); - if (MethodElement is not null) yield return new KeyValuePair("method",MethodElement); - if (OriginElement is not null) yield return new KeyValuePair("origin",OriginElement); - if (ParamsElement is not null) yield return new KeyValuePair("params",ParamsElement); - if (RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",RequestHeader); - if (RequestIdElement is not null) yield return new KeyValuePair("requestId",RequestIdElement); - if (ResponseIdElement is not null) yield return new KeyValuePair("responseId",ResponseIdElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (TargetIdElement is not null) yield return new KeyValuePair("targetId",TargetIdElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_AcceptElement is not null) yield return new KeyValuePair("accept",_AcceptElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",_EncodeRequestUrlElement); + if (_MethodElement is not null) yield return new KeyValuePair("method",_MethodElement); + if (_OriginElement is not null) yield return new KeyValuePair("origin",_OriginElement); + if (_ParamsElement is not null) yield return new KeyValuePair("params",_ParamsElement); + if (_RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",_RequestHeader); + if (_RequestIdElement is not null) yield return new KeyValuePair("requestId",_RequestIdElement); + if (_ResponseIdElement is not null) yield return new KeyValuePair("responseId",_ResponseIdElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_TargetIdElement is not null) yield return new KeyValuePair("targetId",_TargetIdElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -2725,28 +2586,25 @@ public partial class RequestHeaderComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("field", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString FieldElement + public Hl7.Fhir.Model.FhirString? FieldElement { get { return _FieldElement; } set { _FieldElement = value; OnPropertyChanged("FieldElement"); } } - private Hl7.Fhir.Model.FhirString _FieldElement; + private Hl7.Fhir.Model.FhirString? _FieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Field + public string? Field { - get { return FieldElement != null ? FieldElement.Value : null; } + get => _FieldElement?.Value; set { - if (value == null) - FieldElement = null; - else - FieldElement = new Hl7.Fhir.Model.FhirString(value); + FieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Field"); } } @@ -2757,44 +2615,37 @@ public string Field [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// HTTP headerfield value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestHeaderComponent; - - if (dest == null) - { + if(other is not RequestHeaderComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FieldElement != null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)FieldElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_FieldElement is not null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)_FieldElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2806,41 +2657,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestHeaderComponent; - if(otherT == null) return false; + if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FieldElement, otherT.FieldElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "field": - value = FieldElement; - return FieldElement is not null; + value = _FieldElement; + return _FieldElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "field": - FieldElement = (Hl7.Fhir.Model.FhirString)value; + FieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2851,8 +2702,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FieldElement is not null) yield return new KeyValuePair("field",FieldElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_FieldElement is not null) yield return new KeyValuePair("field",_FieldElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -2879,28 +2730,25 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("label", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging assertion label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2910,28 +2758,25 @@ public string Label /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting assertion description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -2943,13 +2788,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("AssertionDirectionType")] [DataMember] - public Code DirectionElement + public Code? DirectionElement { get { return _DirectionElement; } set { _DirectionElement = value; OnPropertyChanged("DirectionElement"); } } - private Code _DirectionElement; + private Code? _DirectionElement; /// /// response | request @@ -2958,13 +2803,10 @@ public Code DirectionElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction { - get { return DirectionElement != null ? DirectionElement.Value : null; } + get => _DirectionElement?.Value; set { - if (value == null) - DirectionElement = null; - else - DirectionElement = new Code(value); + DirectionElement = value is null ? null : new Code(value); OnPropertyChanged("Direction"); } } @@ -2974,28 +2816,25 @@ public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction /// [FhirElement("compareToSourceId", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceIdElement + public Hl7.Fhir.Model.FhirString? CompareToSourceIdElement { get { return _CompareToSourceIdElement; } set { _CompareToSourceIdElement = value; OnPropertyChanged("CompareToSourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceIdElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceIdElement; /// /// Id of the source fixture to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceId + public string? CompareToSourceId { - get { return CompareToSourceIdElement != null ? CompareToSourceIdElement.Value : null; } + get => _CompareToSourceIdElement?.Value; set { - if (value == null) - CompareToSourceIdElement = null; - else - CompareToSourceIdElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceId"); } } @@ -3005,28 +2844,25 @@ public string CompareToSourceId /// [FhirElement("compareToSourceExpression", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceExpressionElement + public Hl7.Fhir.Model.FhirString? CompareToSourceExpressionElement { get { return _CompareToSourceExpressionElement; } set { _CompareToSourceExpressionElement = value; OnPropertyChanged("CompareToSourceExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceExpressionElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceExpressionElement; /// /// The FHIRPath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceExpression + public string? CompareToSourceExpression { - get { return CompareToSourceExpressionElement != null ? CompareToSourceExpressionElement.Value : null; } + get => _CompareToSourceExpressionElement?.Value; set { - if (value == null) - CompareToSourceExpressionElement = null; - else - CompareToSourceExpressionElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceExpression"); } } @@ -3036,28 +2872,25 @@ public string CompareToSourceExpression /// [FhirElement("compareToSourcePath", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourcePathElement + public Hl7.Fhir.Model.FhirString? CompareToSourcePathElement { get { return _CompareToSourcePathElement; } set { _CompareToSourcePathElement = value; OnPropertyChanged("CompareToSourcePathElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourcePathElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourcePathElement; /// /// XPath or JSONPath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourcePath + public string? CompareToSourcePath { - get { return CompareToSourcePathElement != null ? CompareToSourcePathElement.Value : null; } + get => _CompareToSourcePathElement?.Value; set { - if (value == null) - CompareToSourcePathElement = null; - else - CompareToSourcePathElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourcePathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourcePath"); } } @@ -3068,28 +2901,25 @@ public string CompareToSourcePath [FhirElement("contentType", Order=100)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// Mime type to compare against the 'Content-Type' header /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -3099,28 +2929,25 @@ public string ContentType /// [FhirElement("expression", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The FHIRPath expression to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -3130,28 +2957,25 @@ public string Expression /// [FhirElement("headerField", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -3161,28 +2985,25 @@ public string HeaderField /// [FhirElement("minimumId", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString MinimumIdElement + public Hl7.Fhir.Model.FhirString? MinimumIdElement { get { return _MinimumIdElement; } set { _MinimumIdElement = value; OnPropertyChanged("MinimumIdElement"); } } - private Hl7.Fhir.Model.FhirString _MinimumIdElement; + private Hl7.Fhir.Model.FhirString? _MinimumIdElement; /// /// Fixture Id of minimum content resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MinimumId + public string? MinimumId { - get { return MinimumIdElement != null ? MinimumIdElement.Value : null; } + get => _MinimumIdElement?.Value; set { - if (value == null) - MinimumIdElement = null; - else - MinimumIdElement = new Hl7.Fhir.Model.FhirString(value); + MinimumIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MinimumId"); } } @@ -3192,13 +3013,13 @@ public string MinimumId /// [FhirElement("navigationLinks", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement + public Hl7.Fhir.Model.FhirBoolean? NavigationLinksElement { get { return _NavigationLinksElement; } set { _NavigationLinksElement = value; OnPropertyChanged("NavigationLinksElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NavigationLinksElement; + private Hl7.Fhir.Model.FhirBoolean? _NavigationLinksElement; /// /// Perform validation on navigation links? @@ -3207,13 +3028,10 @@ public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement [IgnoreDataMember] public bool? NavigationLinks { - get { return NavigationLinksElement != null ? NavigationLinksElement.Value : null; } + get => _NavigationLinksElement?.Value; set { - if (value == null) - NavigationLinksElement = null; - else - NavigationLinksElement = new Hl7.Fhir.Model.FhirBoolean(value); + NavigationLinksElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NavigationLinks"); } } @@ -3225,13 +3043,13 @@ public bool? NavigationLinks [DeclaredType(Type = typeof(Code))] [Binding("AssertionOperatorType")] [DataMember] - public Code OperatorElement + public Code? OperatorElement { get { return _OperatorElement; } set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private Code _OperatorElement; + private Code? _OperatorElement; /// /// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval @@ -3240,13 +3058,10 @@ public Code OperatorElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator { - get { return OperatorElement != null ? OperatorElement.Value : null; } + get => _OperatorElement?.Value; set { - if (value == null) - OperatorElement = null; - else - OperatorElement = new Code(value); + OperatorElement = value is null ? null : new Code(value); OnPropertyChanged("Operator"); } } @@ -3256,28 +3071,25 @@ public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator /// [FhirElement("path", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -3289,13 +3101,13 @@ public string Path [DeclaredType(Type = typeof(Code))] [Binding("TestScriptRequestMethodCode")] [DataMember] - public Code RequestMethodElement + public Code? RequestMethodElement { get { return _RequestMethodElement; } set { _RequestMethodElement = value; OnPropertyChanged("RequestMethodElement"); } } - private Code _RequestMethodElement; + private Code? _RequestMethodElement; /// /// delete | get | options | patch | post | put | head @@ -3304,13 +3116,10 @@ public Code RequestMethod [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod { - get { return RequestMethodElement != null ? RequestMethodElement.Value : null; } + get => _RequestMethodElement?.Value; set { - if (value == null) - RequestMethodElement = null; - else - RequestMethodElement = new Code(value); + RequestMethodElement = value is null ? null : new Code(value); OnPropertyChanged("RequestMethod"); } } @@ -3320,28 +3129,25 @@ public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod /// [FhirElement("requestURL", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString RequestURLElement + public Hl7.Fhir.Model.FhirString? RequestURLElement { get { return _RequestURLElement; } set { _RequestURLElement = value; OnPropertyChanged("RequestURLElement"); } } - private Hl7.Fhir.Model.FhirString _RequestURLElement; + private Hl7.Fhir.Model.FhirString? _RequestURLElement; /// /// Request URL comparison value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestURL + public string? RequestURL { - get { return RequestURLElement != null ? RequestURLElement.Value : null; } + get => _RequestURLElement?.Value; set { - if (value == null) - RequestURLElement = null; - else - RequestURLElement = new Hl7.Fhir.Model.FhirString(value); + RequestURLElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RequestURL"); } } @@ -3353,13 +3159,13 @@ public string RequestURL [DeclaredType(Type = typeof(Code))] [Binding("FHIRDefinedType")] [DataMember] - public Code ResourceElement + public Code? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Code _ResourceElement; + private Code? _ResourceElement; /// /// Resource type @@ -3368,13 +3174,10 @@ public Code ResourceElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRDefinedType? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Code(value); + ResourceElement = value is null ? null : new Code(value); OnPropertyChanged("Resource"); } } @@ -3386,13 +3189,13 @@ public Hl7.Fhir.Model.FHIRDefinedType? Resource [DeclaredType(Type = typeof(Code))] [Binding("AssertionResponseTypes")] [DataMember] - public Code ResponseElement + public Code? ResponseElement { get { return _ResponseElement; } set { _ResponseElement = value; OnPropertyChanged("ResponseElement"); } } - private Code _ResponseElement; + private Code? _ResponseElement; /// /// okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable @@ -3401,13 +3204,10 @@ public Code ResponseElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response { - get { return ResponseElement != null ? ResponseElement.Value : null; } + get => _ResponseElement?.Value; set { - if (value == null) - ResponseElement = null; - else - ResponseElement = new Code(value); + ResponseElement = value is null ? null : new Code(value); OnPropertyChanged("Response"); } } @@ -3417,28 +3217,25 @@ public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response /// [FhirElement("responseCode", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString ResponseCodeElement + public Hl7.Fhir.Model.FhirString? ResponseCodeElement { get { return _ResponseCodeElement; } set { _ResponseCodeElement = value; OnPropertyChanged("ResponseCodeElement"); } } - private Hl7.Fhir.Model.FhirString _ResponseCodeElement; + private Hl7.Fhir.Model.FhirString? _ResponseCodeElement; /// /// HTTP response code to test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseCode + public string? ResponseCode { - get { return ResponseCodeElement != null ? ResponseCodeElement.Value : null; } + get => _ResponseCodeElement?.Value; set { - if (value == null) - ResponseCodeElement = null; - else - ResponseCodeElement = new Hl7.Fhir.Model.FhirString(value); + ResponseCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResponseCode"); } } @@ -3448,28 +3245,25 @@ public string ResponseCode /// [FhirElement("sourceId", Order=220)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -3479,28 +3273,25 @@ public string SourceId /// [FhirElement("validateProfileId", Order=230)] [DataMember] - public Hl7.Fhir.Model.Id ValidateProfileIdElement + public Hl7.Fhir.Model.Id? ValidateProfileIdElement { get { return _ValidateProfileIdElement; } set { _ValidateProfileIdElement = value; OnPropertyChanged("ValidateProfileIdElement"); } } - private Hl7.Fhir.Model.Id _ValidateProfileIdElement; + private Hl7.Fhir.Model.Id? _ValidateProfileIdElement; /// /// Profile Id of validation profile reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidateProfileId + public string? ValidateProfileId { - get { return ValidateProfileIdElement != null ? ValidateProfileIdElement.Value : null; } + get => _ValidateProfileIdElement?.Value; set { - if (value == null) - ValidateProfileIdElement = null; - else - ValidateProfileIdElement = new Hl7.Fhir.Model.Id(value); + ValidateProfileIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ValidateProfileId"); } } @@ -3510,28 +3301,25 @@ public string ValidateProfileId /// [FhirElement("value", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The value to compare to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -3542,13 +3330,13 @@ public string Value [FhirElement("warningOnly", Order=250)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement + public Hl7.Fhir.Model.FhirBoolean? WarningOnlyElement { get { return _WarningOnlyElement; } set { _WarningOnlyElement = value; OnPropertyChanged("WarningOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WarningOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _WarningOnlyElement; /// /// Will this assert produce a warning only on error? @@ -3557,49 +3345,42 @@ public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement [IgnoreDataMember] public bool? WarningOnly { - get { return WarningOnlyElement != null ? WarningOnlyElement.Value : null; } + get => _WarningOnlyElement?.Value; set { - if (value == null) - WarningOnlyElement = null; - else - WarningOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + WarningOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WarningOnly"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(DirectionElement != null) dest.DirectionElement = (Code)DirectionElement.DeepCopyInternal(); - if(CompareToSourceIdElement != null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)CompareToSourceIdElement.DeepCopyInternal(); - if(CompareToSourceExpressionElement != null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)CompareToSourceExpressionElement.DeepCopyInternal(); - if(CompareToSourcePathElement != null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)CompareToSourcePathElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(MinimumIdElement != null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)MinimumIdElement.DeepCopyInternal(); - if(NavigationLinksElement != null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)NavigationLinksElement.DeepCopyInternal(); - if(OperatorElement != null) dest.OperatorElement = (Code)OperatorElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(RequestMethodElement != null) dest.RequestMethodElement = (Code)RequestMethodElement.DeepCopyInternal(); - if(RequestURLElement != null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)RequestURLElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Code)ResourceElement.DeepCopyInternal(); - if(ResponseElement != null) dest.ResponseElement = (Code)ResponseElement.DeepCopyInternal(); - if(ResponseCodeElement != null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)ResponseCodeElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(ValidateProfileIdElement != null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)ValidateProfileIdElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(WarningOnlyElement != null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)WarningOnlyElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_DirectionElement is not null) dest.DirectionElement = (Code)_DirectionElement.DeepCopyInternal(); + if(_CompareToSourceIdElement is not null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceIdElement.DeepCopyInternal(); + if(_CompareToSourceExpressionElement is not null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceExpressionElement.DeepCopyInternal(); + if(_CompareToSourcePathElement is not null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)_CompareToSourcePathElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_MinimumIdElement is not null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)_MinimumIdElement.DeepCopyInternal(); + if(_NavigationLinksElement is not null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)_NavigationLinksElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = (Code)_OperatorElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_RequestMethodElement is not null) dest.RequestMethodElement = (Code)_RequestMethodElement.DeepCopyInternal(); + if(_RequestURLElement is not null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)_RequestURLElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Code)_ResourceElement.DeepCopyInternal(); + if(_ResponseElement is not null) dest.ResponseElement = (Code)_ResponseElement.DeepCopyInternal(); + if(_ResponseCodeElement is not null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)_ResponseCodeElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_ValidateProfileIdElement is not null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)_ValidateProfileIdElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_WarningOnlyElement is not null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_WarningOnlyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3611,181 +3392,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(DirectionElement, otherT.DirectionElement)) return false; - if(!comparer.Equals(CompareToSourceIdElement, otherT.CompareToSourceIdElement)) return false; - if(!comparer.Equals(CompareToSourceExpressionElement, otherT.CompareToSourceExpressionElement)) return false; - if(!comparer.Equals(CompareToSourcePathElement, otherT.CompareToSourcePathElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(MinimumIdElement, otherT.MinimumIdElement)) return false; - if(!comparer.Equals(NavigationLinksElement, otherT.NavigationLinksElement)) return false; - if(!comparer.Equals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(RequestMethodElement, otherT.RequestMethodElement)) return false; - if(!comparer.Equals(RequestURLElement, otherT.RequestURLElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(ResponseElement, otherT.ResponseElement)) return false; - if(!comparer.Equals(ResponseCodeElement, otherT.ResponseCodeElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(ValidateProfileIdElement, otherT.ValidateProfileIdElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(WarningOnlyElement, otherT.WarningOnlyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; + if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; + if(!comparer.Equals(_CompareToSourceExpressionElement, otherT._CompareToSourceExpressionElement)) return false; + if(!comparer.Equals(_CompareToSourcePathElement, otherT._CompareToSourcePathElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_MinimumIdElement, otherT._MinimumIdElement)) return false; + if(!comparer.Equals(_NavigationLinksElement, otherT._NavigationLinksElement)) return false; + if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_RequestMethodElement, otherT._RequestMethodElement)) return false; + if(!comparer.Equals(_RequestURLElement, otherT._RequestURLElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_ResponseElement, otherT._ResponseElement)) return false; + if(!comparer.Equals(_ResponseCodeElement, otherT._ResponseCodeElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_ValidateProfileIdElement, otherT._ValidateProfileIdElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "direction": - value = DirectionElement; - return DirectionElement is not null; + value = _DirectionElement; + return _DirectionElement is not null; case "compareToSourceId": - value = CompareToSourceIdElement; - return CompareToSourceIdElement is not null; + value = _CompareToSourceIdElement; + return _CompareToSourceIdElement is not null; case "compareToSourceExpression": - value = CompareToSourceExpressionElement; - return CompareToSourceExpressionElement is not null; + value = _CompareToSourceExpressionElement; + return _CompareToSourceExpressionElement is not null; case "compareToSourcePath": - value = CompareToSourcePathElement; - return CompareToSourcePathElement is not null; + value = _CompareToSourcePathElement; + return _CompareToSourcePathElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "minimumId": - value = MinimumIdElement; - return MinimumIdElement is not null; + value = _MinimumIdElement; + return _MinimumIdElement is not null; case "navigationLinks": - value = NavigationLinksElement; - return NavigationLinksElement is not null; + value = _NavigationLinksElement; + return _NavigationLinksElement is not null; case "operator": - value = OperatorElement; - return OperatorElement is not null; + value = _OperatorElement; + return _OperatorElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "requestMethod": - value = RequestMethodElement; - return RequestMethodElement is not null; + value = _RequestMethodElement; + return _RequestMethodElement is not null; case "requestURL": - value = RequestURLElement; - return RequestURLElement is not null; + value = _RequestURLElement; + return _RequestURLElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "response": - value = ResponseElement; - return ResponseElement is not null; + value = _ResponseElement; + return _ResponseElement is not null; case "responseCode": - value = ResponseCodeElement; - return ResponseCodeElement is not null; + value = _ResponseCodeElement; + return _ResponseCodeElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "validateProfileId": - value = ValidateProfileIdElement; - return ValidateProfileIdElement is not null; + value = _ValidateProfileIdElement; + return _ValidateProfileIdElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "warningOnly": - value = WarningOnlyElement; - return WarningOnlyElement is not null; + value = _WarningOnlyElement; + return _WarningOnlyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "direction": - DirectionElement = (Code)value; + DirectionElement = (Code?)value; return this; case "compareToSourceId": - CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourceExpression": - CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourcePath": - CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "minimumId": - MinimumIdElement = (Hl7.Fhir.Model.FhirString)value; + MinimumIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "navigationLinks": - NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)value; + NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "operator": - OperatorElement = (Code)value; + OperatorElement = (Code?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestMethod": - RequestMethodElement = (Code)value; + RequestMethodElement = (Code?)value; return this; case "requestURL": - RequestURLElement = (Hl7.Fhir.Model.FhirString)value; + RequestURLElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resource": - ResourceElement = (Code)value; + ResourceElement = (Code?)value; return this; case "response": - ResponseElement = (Code)value; + ResponseElement = (Code?)value; return this; case "responseCode": - ResponseCodeElement = (Hl7.Fhir.Model.FhirString)value; + ResponseCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "validateProfileId": - ValidateProfileIdElement = (Hl7.Fhir.Model.Id)value; + ValidateProfileIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "warningOnly": - WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -3796,28 +3577,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (DirectionElement is not null) yield return new KeyValuePair("direction",DirectionElement); - if (CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",CompareToSourceIdElement); - if (CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",CompareToSourceExpressionElement); - if (CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",CompareToSourcePathElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (MinimumIdElement is not null) yield return new KeyValuePair("minimumId",MinimumIdElement); - if (NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",NavigationLinksElement); - if (OperatorElement is not null) yield return new KeyValuePair("operator",OperatorElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",RequestMethodElement); - if (RequestURLElement is not null) yield return new KeyValuePair("requestURL",RequestURLElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (ResponseElement is not null) yield return new KeyValuePair("response",ResponseElement); - if (ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",ResponseCodeElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",ValidateProfileIdElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",WarningOnlyElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_DirectionElement is not null) yield return new KeyValuePair("direction",_DirectionElement); + if (_CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",_CompareToSourceIdElement); + if (_CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",_CompareToSourceExpressionElement); + if (_CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",_CompareToSourcePathElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_MinimumIdElement is not null) yield return new KeyValuePair("minimumId",_MinimumIdElement); + if (_NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",_NavigationLinksElement); + if (_OperatorElement is not null) yield return new KeyValuePair("operator",_OperatorElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",_RequestMethodElement); + if (_RequestURLElement is not null) yield return new KeyValuePair("requestURL",_RequestURLElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_ResponseElement is not null) yield return new KeyValuePair("response",_ResponseElement); + if (_ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",_ResponseCodeElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",_ValidateProfileIdElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",_WarningOnlyElement); } } @@ -3840,28 +3621,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3871,28 +3649,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -3905,25 +3680,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3935,48 +3706,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3987,9 +3758,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -4016,39 +3787,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The setup assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4060,41 +3827,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -4105,8 +3872,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -4135,23 +3902,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4163,34 +3926,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4201,7 +3964,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -4229,25 +3992,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4259,34 +4018,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -4297,7 +4056,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -4308,28 +4067,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this test script, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4339,41 +4095,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the test script. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4384,28 +4137,25 @@ public string Version [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this test script (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4415,28 +4165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this test script (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4449,13 +4196,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -4464,13 +4211,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4480,13 +4224,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -4495,13 +4239,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -4511,28 +4252,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -4542,28 +4280,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -4576,39 +4311,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the test script. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -4621,11 +4353,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for test script (if applicable). @@ -4636,39 +4368,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this test script is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this test script is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -4678,28 +4407,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -4712,11 +4438,11 @@ public string Copyright [DataMember] public List Origin { - get { if(_Origin==null) _Origin = new List(); return _Origin; } + get => _Origin ?? new List(); set { _Origin = value; OnPropertyChanged("Origin"); } } - private List _Origin; + private List? _Origin; /// /// An abstract server representing a destination or receiver in a message exchange. @@ -4726,24 +4452,24 @@ public List Origin [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Required capability that is assumed to function correctly on the FHIR server being tested. /// [FhirElement("metadata", Order=260)] [DataMember] - public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata + public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata { get { return _Metadata; } set { _Metadata = value; OnPropertyChanged("Metadata"); } } - private Hl7.Fhir.Model.TestScript.MetadataComponent _Metadata; + private Hl7.Fhir.Model.TestScript.MetadataComponent? _Metadata; /// /// Fixture in the test script - by reference (uri). @@ -4753,11 +4479,11 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata [DataMember] public List Fixture { - get { if(_Fixture==null) _Fixture = new List(); return _Fixture; } + get => _Fixture ?? new List(); set { _Fixture = value; OnPropertyChanged("Fixture"); } } - private List _Fixture; + private List? _Fixture; /// /// Reference of the validation profile. @@ -4769,11 +4495,11 @@ public List Fixture [DataMember] public List Profile { - get { if(_Profile==null) _Profile = new List(); return _Profile; } + get => _Profile ?? new List(); set { _Profile = value; OnPropertyChanged("Profile"); } } - private List _Profile; + private List? _Profile; /// /// Placeholder for evaluated elements. @@ -4783,24 +4509,24 @@ public List Profile [DataMember] public List Variable { - get { if(_Variable==null) _Variable = new List(); return _Variable; } + get => _Variable ?? new List(); set { _Variable = value; OnPropertyChanged("Variable"); } } - private List _Variable; + private List? _Variable; /// /// A series of required setup operations before tests are executed. /// [FhirElement("setup", Order=300)] [DataMember] - public Hl7.Fhir.Model.TestScript.SetupComponent Setup + public Hl7.Fhir.Model.TestScript.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestScript.SetupComponent _Setup; + private Hl7.Fhir.Model.TestScript.SetupComponent? _Setup; /// /// A test in this script. @@ -4810,61 +4536,57 @@ public Hl7.Fhir.Model.TestScript.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// A series of required clean up steps. /// [FhirElement("teardown", Order=320)] [DataMember] - public Hl7.Fhir.Model.TestScript.TeardownComponent Teardown + public Hl7.Fhir.Model.TestScript.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestScript.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestScript.TeardownComponent? _Teardown; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestScript; - - if (dest == null) - { + if(other is not TestScript dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Origin.Any()) dest.Origin = new List(Origin.DeepCopyInternal()); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Metadata != null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)Metadata.DeepCopyInternal(); - if(Fixture.Any()) dest.Fixture = new List(Fixture.DeepCopyInternal()); - if(Profile.Any()) dest.Profile = new List(Profile.DeepCopyInternal()); - if(Variable.Any()) dest.Variable = new List(Variable.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)Teardown.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = new List(_Origin.DeepCopyInternal()); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Metadata is not null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)_Metadata.DeepCopyInternal(); + if(_Fixture is not null) dest.Fixture = new List(_Fixture.DeepCopyInternal()); + if(_Profile is not null) dest.Profile = new List(_Profile.DeepCopyInternal()); + if(_Variable is not null) dest.Variable = new List(_Variable.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4876,195 +4598,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestScript; - if(otherT == null) return false; + if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Origin, otherT.Origin)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Metadata, otherT.Metadata)) return false; - if(!comparer.ListEquals(Fixture, otherT.Fixture)) return false; - if(!comparer.ListEquals(Profile, otherT.Profile)) return false; - if(!comparer.ListEquals(Variable, otherT.Variable)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Origin, otherT._Origin)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Metadata, otherT._Metadata)) return false; + if(!comparer.ListEquals(_Fixture, otherT._Fixture)) return false; + if(!comparer.ListEquals(_Profile, otherT._Profile)) return false; + if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "origin": - value = Origin; - return Origin?.Any() == true; + value = _Origin; + return _Origin?.Any() == true; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "metadata": - value = Metadata; - return Metadata is not null; + value = _Metadata; + return _Metadata is not null; case "fixture": - value = Fixture; - return Fixture?.Any() == true; + value = _Fixture; + return _Fixture?.Any() == true; case "profile": - value = Profile; - return Profile?.Any() == true; + value = _Profile; + return _Profile?.Any() == true; case "variable": - value = Variable; - return Variable?.Any() == true; + value = _Variable; + return _Variable?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "origin": - Origin = (List)value; + Origin = (List?)value!; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "metadata": - Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)value; + Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent?)value; return this; case "fixture": - Fixture = (List)value; + Fixture = (List?)value!; return this; case "profile": - Profile = (List)value; + Profile = (List?)value!; return this; case "variable": - Variable = (List)value; + Variable = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestScript.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -5075,30 +4797,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Origin?.Any() == true) yield return new KeyValuePair("origin",Origin); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Metadata is not null) yield return new KeyValuePair("metadata",Metadata); - if (Fixture?.Any() == true) yield return new KeyValuePair("fixture",Fixture); - if (Profile?.Any() == true) yield return new KeyValuePair("profile",Profile); - if (Variable?.Any() == true) yield return new KeyValuePair("variable",Variable); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Origin?.Any() == true) yield return new KeyValuePair("origin",_Origin); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Metadata is not null) yield return new KeyValuePair("metadata",_Metadata); + if (_Fixture?.Any() == true) yield return new KeyValuePair("fixture",_Fixture); + if (_Profile?.Any() == true) yield return new KeyValuePair("profile",_Profile); + if (_Variable?.Any() == true) yield return new KeyValuePair("variable",_Variable); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs index c005394a4..01d8f11bc 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -306,26 +309,26 @@ public partial class RepeatComponent : Hl7.Fhir.Model.Element [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Bounds + public Hl7.Fhir.Model.DataType? Bounds { get { return _Bounds; } set { _Bounds = value; OnPropertyChanged("Bounds"); } } - private Hl7.Fhir.Model.DataType _Bounds; + private Hl7.Fhir.Model.DataType? _Bounds; /// /// Number of times to repeat. /// [FhirElement("count", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt CountElement + public Hl7.Fhir.Model.PositiveInt? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.PositiveInt _CountElement; + private Hl7.Fhir.Model.PositiveInt? _CountElement; /// /// Number of times to repeat @@ -334,13 +337,10 @@ public Hl7.Fhir.Model.PositiveInt CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.PositiveInt(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Count"); } } @@ -350,13 +350,13 @@ public int? Count /// [FhirElement("countMax", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt CountMaxElement + public Hl7.Fhir.Model.PositiveInt? CountMaxElement { get { return _CountMaxElement; } set { _CountMaxElement = value; OnPropertyChanged("CountMaxElement"); } } - private Hl7.Fhir.Model.PositiveInt _CountMaxElement; + private Hl7.Fhir.Model.PositiveInt? _CountMaxElement; /// /// Maximum number of times to repeat @@ -365,13 +365,10 @@ public Hl7.Fhir.Model.PositiveInt CountMaxElement [IgnoreDataMember] public int? CountMax { - get { return CountMaxElement != null ? CountMaxElement.Value : null; } + get => _CountMaxElement?.Value; set { - if (value == null) - CountMaxElement = null; - else - CountMaxElement = new Hl7.Fhir.Model.PositiveInt(value); + CountMaxElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("CountMax"); } } @@ -381,13 +378,13 @@ public int? CountMax /// [FhirElement("duration", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationElement + public Hl7.Fhir.Model.FhirDecimal? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationElement; /// /// How long when it happens @@ -396,13 +393,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement [IgnoreDataMember] public decimal? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Duration"); } } @@ -412,13 +406,13 @@ public decimal? Duration /// [FhirElement("durationMax", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationMaxElement + public Hl7.Fhir.Model.FhirDecimal? DurationMaxElement { get { return _DurationMaxElement; } set { _DurationMaxElement = value; OnPropertyChanged("DurationMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationMaxElement; /// /// How long when it happens (Max) @@ -427,13 +421,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationMaxElement [IgnoreDataMember] public decimal? DurationMax { - get { return DurationMaxElement != null ? DurationMaxElement.Value : null; } + get => _DurationMaxElement?.Value; set { - if (value == null) - DurationMaxElement = null; - else - DurationMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("DurationMax"); } } @@ -445,13 +436,13 @@ public decimal? DurationMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code DurationUnitElement + public Code? DurationUnitElement { get { return _DurationUnitElement; } set { _DurationUnitElement = value; OnPropertyChanged("DurationUnitElement"); } } - private Code _DurationUnitElement; + private Code? _DurationUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -460,13 +451,10 @@ public Code DurationUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit { - get { return DurationUnitElement != null ? DurationUnitElement.Value : null; } + get => _DurationUnitElement?.Value; set { - if (value == null) - DurationUnitElement = null; - else - DurationUnitElement = new Code(value); + DurationUnitElement = value is null ? null : new Code(value); OnPropertyChanged("DurationUnit"); } } @@ -476,13 +464,13 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit /// [FhirElement("frequency", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FrequencyElement + public Hl7.Fhir.Model.PositiveInt? FrequencyElement { get { return _FrequencyElement; } set { _FrequencyElement = value; OnPropertyChanged("FrequencyElement"); } } - private Hl7.Fhir.Model.PositiveInt _FrequencyElement; + private Hl7.Fhir.Model.PositiveInt? _FrequencyElement; /// /// Event occurs frequency times per period @@ -491,13 +479,10 @@ public Hl7.Fhir.Model.PositiveInt FrequencyElement [IgnoreDataMember] public int? Frequency { - get { return FrequencyElement != null ? FrequencyElement.Value : null; } + get => _FrequencyElement?.Value; set { - if (value == null) - FrequencyElement = null; - else - FrequencyElement = new Hl7.Fhir.Model.PositiveInt(value); + FrequencyElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Frequency"); } } @@ -507,13 +492,13 @@ public int? Frequency /// [FhirElement("frequencyMax", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FrequencyMaxElement + public Hl7.Fhir.Model.PositiveInt? FrequencyMaxElement { get { return _FrequencyMaxElement; } set { _FrequencyMaxElement = value; OnPropertyChanged("FrequencyMaxElement"); } } - private Hl7.Fhir.Model.PositiveInt _FrequencyMaxElement; + private Hl7.Fhir.Model.PositiveInt? _FrequencyMaxElement; /// /// Event occurs up to frequencyMax times per period @@ -522,13 +507,10 @@ public Hl7.Fhir.Model.PositiveInt FrequencyMaxElement [IgnoreDataMember] public int? FrequencyMax { - get { return FrequencyMaxElement != null ? FrequencyMaxElement.Value : null; } + get => _FrequencyMaxElement?.Value; set { - if (value == null) - FrequencyMaxElement = null; - else - FrequencyMaxElement = new Hl7.Fhir.Model.PositiveInt(value); + FrequencyMaxElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("FrequencyMax"); } } @@ -538,13 +520,13 @@ public int? FrequencyMax /// [FhirElement("period", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodElement + public Hl7.Fhir.Model.FhirDecimal? PeriodElement { get { return _PeriodElement; } set { _PeriodElement = value; OnPropertyChanged("PeriodElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodElement; /// /// Event occurs frequency times per period @@ -553,13 +535,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodElement [IgnoreDataMember] public decimal? Period { - get { return PeriodElement != null ? PeriodElement.Value : null; } + get => _PeriodElement?.Value; set { - if (value == null) - PeriodElement = null; - else - PeriodElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Period"); } } @@ -569,13 +548,13 @@ public decimal? Period /// [FhirElement("periodMax", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement + public Hl7.Fhir.Model.FhirDecimal? PeriodMaxElement { get { return _PeriodMaxElement; } set { _PeriodMaxElement = value; OnPropertyChanged("PeriodMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodMaxElement; /// /// Upper limit of period (3-4 hours) @@ -584,13 +563,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement [IgnoreDataMember] public decimal? PeriodMax { - get { return PeriodMaxElement != null ? PeriodMaxElement.Value : null; } + get => _PeriodMaxElement?.Value; set { - if (value == null) - PeriodMaxElement = null; - else - PeriodMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("PeriodMax"); } } @@ -602,13 +578,13 @@ public decimal? PeriodMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code PeriodUnitElement + public Code? PeriodUnitElement { get { return _PeriodUnitElement; } set { _PeriodUnitElement = value; OnPropertyChanged("PeriodUnitElement"); } } - private Code _PeriodUnitElement; + private Code? _PeriodUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -617,13 +593,10 @@ public Code PeriodUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit { - get { return PeriodUnitElement != null ? PeriodUnitElement.Value : null; } + get => _PeriodUnitElement?.Value; set { - if (value == null) - PeriodUnitElement = null; - else - PeriodUnitElement = new Code(value); + PeriodUnitElement = value is null ? null : new Code(value); OnPropertyChanged("PeriodUnit"); } } @@ -638,24 +611,24 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get { if(_DayOfWeekElement==null) _DayOfWeekElement = new List>(); return _DayOfWeekElement; } + get => _DayOfWeekElement ?? new List>(); set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } - private List> _DayOfWeekElement; + private List>? _DayOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DayOfWeek + public IEnumerable? DayOfWeek { - get { return DayOfWeekElement != null ? DayOfWeekElement.Select(elem => elem.Value) : null; } + get => _DayOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DayOfWeekElement = null; + DayOfWeekElement = null!; else DayOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DayOfWeek"); @@ -670,24 +643,24 @@ public IEnumerable DayOfWeek [DataMember] public List TimeOfDayElement { - get { if(_TimeOfDayElement==null) _TimeOfDayElement = new List(); return _TimeOfDayElement; } + get => _TimeOfDayElement ?? new List(); set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } - private List _TimeOfDayElement; + private List? _TimeOfDayElement; /// /// Time of day for action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TimeOfDay + public IEnumerable? TimeOfDay { - get { return TimeOfDayElement != null ? TimeOfDayElement.Select(elem => elem.Value) : null; } + get => _TimeOfDayElement?.Select(elem => elem.Value); set { if (value == null) - TimeOfDayElement = null; + TimeOfDayElement = null!; else TimeOfDayElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Time(elem))); OnPropertyChanged("TimeOfDay"); @@ -704,24 +677,24 @@ public IEnumerable TimeOfDay [DataMember] public List> WhenElement { - get { if(_WhenElement==null) _WhenElement = new List>(); return _WhenElement; } + get => _WhenElement ?? new List>(); set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } - private List> _WhenElement; + private List>? _WhenElement; /// /// Code for time period of occurrence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable When + public IEnumerable? When { - get { return WhenElement != null ? WhenElement.Select(elem => elem.Value) : null; } + get => _WhenElement?.Select(elem => elem.Value); set { if (value == null) - WhenElement = null; + WhenElement = null!; else WhenElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("When"); @@ -733,13 +706,13 @@ public IEnumerable When /// [FhirElement("offset", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt OffsetElement + public Hl7.Fhir.Model.UnsignedInt? OffsetElement { get { return _OffsetElement; } set { _OffsetElement = value; OnPropertyChanged("OffsetElement"); } } - private Hl7.Fhir.Model.UnsignedInt _OffsetElement; + private Hl7.Fhir.Model.UnsignedInt? _OffsetElement; /// /// Minutes from event (before or after) @@ -748,42 +721,35 @@ public Hl7.Fhir.Model.UnsignedInt OffsetElement [IgnoreDataMember] public int? Offset { - get { return OffsetElement != null ? OffsetElement.Value : null; } + get => _OffsetElement?.Value; set { - if (value == null) - OffsetElement = null; - else - OffsetElement = new Hl7.Fhir.Model.UnsignedInt(value); + OffsetElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Offset"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatComponent; - - if (dest == null) - { + if(other is not RepeatComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Bounds != null) dest.Bounds = (Hl7.Fhir.Model.DataType)Bounds.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.PositiveInt)CountElement.DeepCopyInternal(); - if(CountMaxElement != null) dest.CountMaxElement = (Hl7.Fhir.Model.PositiveInt)CountMaxElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal(); - if(DurationMaxElement != null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)DurationMaxElement.DeepCopyInternal(); - if(DurationUnitElement != null) dest.DurationUnitElement = (Code)DurationUnitElement.DeepCopyInternal(); - if(FrequencyElement != null) dest.FrequencyElement = (Hl7.Fhir.Model.PositiveInt)FrequencyElement.DeepCopyInternal(); - if(FrequencyMaxElement != null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)FrequencyMaxElement.DeepCopyInternal(); - if(PeriodElement != null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)PeriodElement.DeepCopyInternal(); - if(PeriodMaxElement != null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)PeriodMaxElement.DeepCopyInternal(); - if(PeriodUnitElement != null) dest.PeriodUnitElement = (Code)PeriodUnitElement.DeepCopyInternal(); - if(DayOfWeekElement.Any()) dest.DayOfWeekElement = new List>(DayOfWeekElement.DeepCopyInternal()); - if(TimeOfDayElement.Any()) dest.TimeOfDayElement = new List(TimeOfDayElement.DeepCopyInternal()); - if(WhenElement.Any()) dest.WhenElement = new List>(WhenElement.DeepCopyInternal()); - if(OffsetElement != null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)OffsetElement.DeepCopyInternal(); + if(_Bounds is not null) dest.Bounds = (Hl7.Fhir.Model.DataType)_Bounds.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.PositiveInt)_CountElement.DeepCopyInternal(); + if(_CountMaxElement is not null) dest.CountMaxElement = (Hl7.Fhir.Model.PositiveInt)_CountMaxElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal(); + if(_DurationMaxElement is not null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)_DurationMaxElement.DeepCopyInternal(); + if(_DurationUnitElement is not null) dest.DurationUnitElement = (Code)_DurationUnitElement.DeepCopyInternal(); + if(_FrequencyElement is not null) dest.FrequencyElement = (Hl7.Fhir.Model.PositiveInt)_FrequencyElement.DeepCopyInternal(); + if(_FrequencyMaxElement is not null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)_FrequencyMaxElement.DeepCopyInternal(); + if(_PeriodElement is not null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodElement.DeepCopyInternal(); + if(_PeriodMaxElement is not null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodMaxElement.DeepCopyInternal(); + if(_PeriodUnitElement is not null) dest.PeriodUnitElement = (Code)_PeriodUnitElement.DeepCopyInternal(); + if(_DayOfWeekElement is not null) dest.DayOfWeekElement = new List>(_DayOfWeekElement.DeepCopyInternal()); + if(_TimeOfDayElement is not null) dest.TimeOfDayElement = new List(_TimeOfDayElement.DeepCopyInternal()); + if(_WhenElement is not null) dest.WhenElement = new List>(_WhenElement.DeepCopyInternal()); + if(_OffsetElement is not null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)_OffsetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -795,132 +761,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatComponent; - if(otherT == null) return false; + if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Bounds, otherT.Bounds)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(CountMaxElement, otherT.CountMaxElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(DurationMaxElement, otherT.DurationMaxElement)) return false; - if(!comparer.Equals(DurationUnitElement, otherT.DurationUnitElement)) return false; - if(!comparer.Equals(FrequencyElement, otherT.FrequencyElement)) return false; - if(!comparer.Equals(FrequencyMaxElement, otherT.FrequencyMaxElement)) return false; - if(!comparer.Equals(PeriodElement, otherT.PeriodElement)) return false; - if(!comparer.Equals(PeriodMaxElement, otherT.PeriodMaxElement)) return false; - if(!comparer.Equals(PeriodUnitElement, otherT.PeriodUnitElement)) return false; - if(!comparer.ListEquals(DayOfWeekElement, otherT.DayOfWeekElement)) return false; - if(!comparer.ListEquals(TimeOfDayElement, otherT.TimeOfDayElement)) return false; - if(!comparer.ListEquals(WhenElement, otherT.WhenElement)) return false; - if(!comparer.Equals(OffsetElement, otherT.OffsetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_DurationMaxElement, otherT._DurationMaxElement)) return false; + if(!comparer.Equals(_DurationUnitElement, otherT._DurationUnitElement)) return false; + if(!comparer.Equals(_FrequencyElement, otherT._FrequencyElement)) return false; + if(!comparer.Equals(_FrequencyMaxElement, otherT._FrequencyMaxElement)) return false; + if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; + if(!comparer.Equals(_PeriodMaxElement, otherT._PeriodMaxElement)) return false; + if(!comparer.Equals(_PeriodUnitElement, otherT._PeriodUnitElement)) return false; + if(!comparer.ListEquals(_DayOfWeekElement, otherT._DayOfWeekElement)) return false; + if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; + if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; + if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "bounds": - value = Bounds; - return Bounds is not null; + value = _Bounds; + return _Bounds is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "countMax": - value = CountMaxElement; - return CountMaxElement is not null; + value = _CountMaxElement; + return _CountMaxElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "durationMax": - value = DurationMaxElement; - return DurationMaxElement is not null; + value = _DurationMaxElement; + return _DurationMaxElement is not null; case "durationUnit": - value = DurationUnitElement; - return DurationUnitElement is not null; + value = _DurationUnitElement; + return _DurationUnitElement is not null; case "frequency": - value = FrequencyElement; - return FrequencyElement is not null; + value = _FrequencyElement; + return _FrequencyElement is not null; case "frequencyMax": - value = FrequencyMaxElement; - return FrequencyMaxElement is not null; + value = _FrequencyMaxElement; + return _FrequencyMaxElement is not null; case "period": - value = PeriodElement; - return PeriodElement is not null; + value = _PeriodElement; + return _PeriodElement is not null; case "periodMax": - value = PeriodMaxElement; - return PeriodMaxElement is not null; + value = _PeriodMaxElement; + return _PeriodMaxElement is not null; case "periodUnit": - value = PeriodUnitElement; - return PeriodUnitElement is not null; + value = _PeriodUnitElement; + return _PeriodUnitElement is not null; case "dayOfWeek": - value = DayOfWeekElement; - return DayOfWeekElement?.Any() == true; + value = _DayOfWeekElement; + return _DayOfWeekElement?.Any() == true; case "timeOfDay": - value = TimeOfDayElement; - return TimeOfDayElement?.Any() == true; + value = _TimeOfDayElement; + return _TimeOfDayElement?.Any() == true; case "when": - value = WhenElement; - return WhenElement?.Any() == true; + value = _WhenElement; + return _WhenElement?.Any() == true; case "offset": - value = OffsetElement; - return OffsetElement is not null; + value = _OffsetElement; + return _OffsetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "bounds": - Bounds = (Hl7.Fhir.Model.DataType)value; + Bounds = (Hl7.Fhir.Model.DataType?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.PositiveInt)value; + CountElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "countMax": - CountMaxElement = (Hl7.Fhir.Model.PositiveInt)value; + CountMaxElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationMax": - DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationUnit": - DurationUnitElement = (Code)value; + DurationUnitElement = (Code?)value; return this; case "frequency": - FrequencyElement = (Hl7.Fhir.Model.PositiveInt)value; + FrequencyElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "frequencyMax": - FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)value; + FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - PeriodElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodMax": - PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodUnit": - PeriodUnitElement = (Code)value; + PeriodUnitElement = (Code?)value; return this; case "dayOfWeek": - DayOfWeekElement = (List>)value; + DayOfWeekElement = (List>?)value!; return this; case "timeOfDay": - TimeOfDayElement = (List)value; + TimeOfDayElement = (List?)value!; return this; case "when": - WhenElement = (List>)value; + WhenElement = (List>?)value!; return this; case "offset": - OffsetElement = (Hl7.Fhir.Model.UnsignedInt)value; + OffsetElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; default: return base.SetValue(key, value); @@ -931,21 +897,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Bounds is not null) yield return new KeyValuePair("bounds",Bounds); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (CountMaxElement is not null) yield return new KeyValuePair("countMax",CountMaxElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (DurationMaxElement is not null) yield return new KeyValuePair("durationMax",DurationMaxElement); - if (DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",DurationUnitElement); - if (FrequencyElement is not null) yield return new KeyValuePair("frequency",FrequencyElement); - if (FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",FrequencyMaxElement); - if (PeriodElement is not null) yield return new KeyValuePair("period",PeriodElement); - if (PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",PeriodMaxElement); - if (PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",PeriodUnitElement); - if (DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",DayOfWeekElement); - if (TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",TimeOfDayElement); - if (WhenElement?.Any() == true) yield return new KeyValuePair("when",WhenElement); - if (OffsetElement is not null) yield return new KeyValuePair("offset",OffsetElement); + if (_Bounds is not null) yield return new KeyValuePair("bounds",_Bounds); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_CountMaxElement is not null) yield return new KeyValuePair("countMax",_CountMaxElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_DurationMaxElement is not null) yield return new KeyValuePair("durationMax",_DurationMaxElement); + if (_DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",_DurationUnitElement); + if (_FrequencyElement is not null) yield return new KeyValuePair("frequency",_FrequencyElement); + if (_FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",_FrequencyMaxElement); + if (_PeriodElement is not null) yield return new KeyValuePair("period",_PeriodElement); + if (_PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",_PeriodMaxElement); + if (_PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",_PeriodUnitElement); + if (_DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",_DayOfWeekElement); + if (_TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",_TimeOfDayElement); + if (_WhenElement?.Any() == true) yield return new KeyValuePair("when",_WhenElement); + if (_OffsetElement is not null) yield return new KeyValuePair("offset",_OffsetElement); } } @@ -958,24 +924,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get { if(_EventElement==null) _EventElement = new List(); return _EventElement; } + get => _EventElement ?? new List(); set { _EventElement = value; OnPropertyChanged("EventElement"); } } - private List _EventElement; + private List? _EventElement; /// /// When the event occurs /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Event + public IEnumerable? Event { - get { return EventElement != null ? EventElement.Select(elem => elem.Value) : null; } + get => _EventElement?.Select(elem => elem.Value); set { if (value == null) - EventElement = null; + EventElement = null!; else EventElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDateTime(elem))); OnPropertyChanged("Event"); @@ -987,13 +953,13 @@ public IEnumerable Event /// [FhirElement("repeat", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Timing.RepeatComponent Repeat + public Hl7.Fhir.Model.Timing.RepeatComponent? Repeat { get { return _Repeat; } set { _Repeat = value; OnPropertyChanged("Repeat"); } } - private Hl7.Fhir.Model.Timing.RepeatComponent _Repeat; + private Hl7.Fhir.Model.Timing.RepeatComponent? _Repeat; /// /// BID | TID | QID | AM | PM | QD | QOD | +. @@ -1001,27 +967,23 @@ public Hl7.Fhir.Model.Timing.RepeatComponent Repeat [FhirElement("code", InSummary=true, Order=60)] [Binding("TimingAbbreviation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as Timing; - - if (dest == null) - { + if(other is not Timing dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(EventElement.Any()) dest.EventElement = new List(EventElement.DeepCopyInternal()); - if(Repeat != null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)Repeat.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_EventElement is not null) dest.EventElement = new List(_EventElement.DeepCopyInternal()); + if(_Repeat is not null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)_Repeat.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1033,48 +995,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Timing; - if(otherT == null) return false; + if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(EventElement, otherT.EventElement)) return false; - if(!comparer.Equals(Repeat, otherT.Repeat)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = EventElement; - return EventElement?.Any() == true; + value = _EventElement; + return _EventElement?.Any() == true; case "repeat": - value = Repeat; - return Repeat is not null; + value = _Repeat; + return _Repeat is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - EventElement = (List)value; + EventElement = (List?)value!; return this; case "repeat": - Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)value; + Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1085,9 +1047,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (EventElement?.Any() == true) yield return new KeyValuePair("event",EventElement); - if (Repeat is not null) yield return new KeyValuePair("repeat",Repeat); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_EventElement?.Any() == true) yield return new KeyValuePair("event",_EventElement); + if (_Repeat is not null) yield return new KeyValuePair("repeat",_Repeat); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs index 76d20d012..1ea54c12d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -126,13 +129,13 @@ public enum TriggerType [Binding("TriggerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// named-event | periodic | data-changed | data-added | data-modified | data-removed | data-accessed | data-access-ended @@ -141,13 +144,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -157,28 +157,25 @@ public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name or URI that identifies the event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -191,13 +188,13 @@ public string Name [References("Schedule")] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Triggering data of the event (multiple = 'and'). @@ -207,40 +204,36 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// Whether the event triggers (boolean expression). /// [FhirElement("condition", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Expression Condition + public Hl7.Fhir.Model.Expression? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.Expression _Condition; + private Hl7.Fhir.Model.Expression? _Condition; protected internal override void CopyToInternal(Base other) { - var dest = other as TriggerDefinition; - - if (dest == null) - { + if(other is not TriggerDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.Expression)Condition.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.Expression)_Condition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -252,62 +245,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TriggerDefinition; - if(otherT == null) return false; + if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "condition": - Condition = (Hl7.Fhir.Model.Expression)value; + Condition = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -318,11 +311,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs index cad587ef7..7306371c4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -122,13 +125,13 @@ public partial class PrimarySourceComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Organization","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Type of primary source (License Board; Primary Education; Continuing Education; Postal Service; Relationship owner; Registration Authority; legal source; issuing source; authoritative source). @@ -139,11 +142,11 @@ public Hl7.Fhir.Model.ResourceReference Who [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Method for exchanging information with the primary source. @@ -154,11 +157,11 @@ public List Type [DataMember] public List CommunicationMethod { - get { if(_CommunicationMethod==null) _CommunicationMethod = new List(); return _CommunicationMethod; } + get => _CommunicationMethod ?? new List(); set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } - private List _CommunicationMethod; + private List? _CommunicationMethod; /// /// successful | failed | unknown. @@ -166,41 +169,38 @@ public List CommunicationMethod [FhirElement("validationStatus", Order=70)] [Binding("validation-status")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ValidationStatus + public Hl7.Fhir.Model.CodeableConcept? ValidationStatus { get { return _ValidationStatus; } set { _ValidationStatus = value; OnPropertyChanged("ValidationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ValidationStatus; + private Hl7.Fhir.Model.CodeableConcept? _ValidationStatus; /// /// When the target was validated against the primary source. /// [FhirElement("validationDate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValidationDateElement + public Hl7.Fhir.Model.FhirDateTime? ValidationDateElement { get { return _ValidationDateElement; } set { _ValidationDateElement = value; OnPropertyChanged("ValidationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValidationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ValidationDateElement; /// /// When the target was validated against the primary source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidationDate + public string? ValidationDate { - get { return ValidationDateElement != null ? ValidationDateElement.Value : null; } + get => _ValidationDateElement?.Value; set { - if (value == null) - ValidationDateElement = null; - else - ValidationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValidationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ValidationDate"); } } @@ -211,13 +211,13 @@ public string ValidationDate [FhirElement("canPushUpdates", InSummary=true, Order=90)] [Binding("can-push-updates")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CanPushUpdates + public Hl7.Fhir.Model.CodeableConcept? CanPushUpdates { get { return _CanPushUpdates; } set { _CanPushUpdates = value; OnPropertyChanged("CanPushUpdates"); } } - private Hl7.Fhir.Model.CodeableConcept _CanPushUpdates; + private Hl7.Fhir.Model.CodeableConcept? _CanPushUpdates; /// /// specific | any | source. @@ -228,29 +228,25 @@ public Hl7.Fhir.Model.CodeableConcept CanPushUpdates [DataMember] public List PushTypeAvailable { - get { if(_PushTypeAvailable==null) _PushTypeAvailable = new List(); return _PushTypeAvailable; } + get => _PushTypeAvailable ?? new List(); set { _PushTypeAvailable = value; OnPropertyChanged("PushTypeAvailable"); } } - private List _PushTypeAvailable; + private List? _PushTypeAvailable; protected internal override void CopyToInternal(Base other) { - var dest = other as PrimarySourceComponent; - - if (dest == null) - { + if(other is not PrimarySourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(CommunicationMethod.Any()) dest.CommunicationMethod = new List(CommunicationMethod.DeepCopyInternal()); - if(ValidationStatus != null) dest.ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)ValidationStatus.DeepCopyInternal(); - if(ValidationDateElement != null) dest.ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)ValidationDateElement.DeepCopyInternal(); - if(CanPushUpdates != null) dest.CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)CanPushUpdates.DeepCopyInternal(); - if(PushTypeAvailable.Any()) dest.PushTypeAvailable = new List(PushTypeAvailable.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_CommunicationMethod is not null) dest.CommunicationMethod = new List(_CommunicationMethod.DeepCopyInternal()); + if(_ValidationStatus is not null) dest.ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)_ValidationStatus.DeepCopyInternal(); + if(_ValidationDateElement is not null) dest.ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ValidationDateElement.DeepCopyInternal(); + if(_CanPushUpdates is not null) dest.CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)_CanPushUpdates.DeepCopyInternal(); + if(_PushTypeAvailable is not null) dest.PushTypeAvailable = new List(_PushTypeAvailable.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -262,76 +258,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrimarySourceComponent; - if(otherT == null) return false; + if(other is not PrimarySourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(CommunicationMethod, otherT.CommunicationMethod)) return false; - if(!comparer.Equals(ValidationStatus, otherT.ValidationStatus)) return false; - if(!comparer.Equals(ValidationDateElement, otherT.ValidationDateElement)) return false; - if(!comparer.Equals(CanPushUpdates, otherT.CanPushUpdates)) return false; - if(!comparer.ListEquals(PushTypeAvailable, otherT.PushTypeAvailable)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_CommunicationMethod, otherT._CommunicationMethod)) return false; + if(!comparer.Equals(_ValidationStatus, otherT._ValidationStatus)) return false; + if(!comparer.Equals(_ValidationDateElement, otherT._ValidationDateElement)) return false; + if(!comparer.Equals(_CanPushUpdates, otherT._CanPushUpdates)) return false; + if(!comparer.ListEquals(_PushTypeAvailable, otherT._PushTypeAvailable)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "communicationMethod": - value = CommunicationMethod; - return CommunicationMethod?.Any() == true; + value = _CommunicationMethod; + return _CommunicationMethod?.Any() == true; case "validationStatus": - value = ValidationStatus; - return ValidationStatus is not null; + value = _ValidationStatus; + return _ValidationStatus is not null; case "validationDate": - value = ValidationDateElement; - return ValidationDateElement is not null; + value = _ValidationDateElement; + return _ValidationDateElement is not null; case "canPushUpdates": - value = CanPushUpdates; - return CanPushUpdates is not null; + value = _CanPushUpdates; + return _CanPushUpdates is not null; case "pushTypeAvailable": - value = PushTypeAvailable; - return PushTypeAvailable?.Any() == true; + value = _PushTypeAvailable; + return _PushTypeAvailable?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "communicationMethod": - CommunicationMethod = (List)value; + CommunicationMethod = (List?)value!; return this; case "validationStatus": - ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ValidationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "validationDate": - ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "canPushUpdates": - CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)value; + CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "pushTypeAvailable": - PushTypeAvailable = (List)value; + PushTypeAvailable = (List?)value!; return this; default: return base.SetValue(key, value); @@ -342,13 +338,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Who is not null) yield return new KeyValuePair("who",Who); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (CommunicationMethod?.Any() == true) yield return new KeyValuePair("communicationMethod",CommunicationMethod); - if (ValidationStatus is not null) yield return new KeyValuePair("validationStatus",ValidationStatus); - if (ValidationDateElement is not null) yield return new KeyValuePair("validationDate",ValidationDateElement); - if (CanPushUpdates is not null) yield return new KeyValuePair("canPushUpdates",CanPushUpdates); - if (PushTypeAvailable?.Any() == true) yield return new KeyValuePair("pushTypeAvailable",PushTypeAvailable); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_CommunicationMethod?.Any() == true) yield return new KeyValuePair("communicationMethod",_CommunicationMethod); + if (_ValidationStatus is not null) yield return new KeyValuePair("validationStatus",_ValidationStatus); + if (_ValidationDateElement is not null) yield return new KeyValuePair("validationDate",_ValidationDateElement); + if (_CanPushUpdates is not null) yield return new KeyValuePair("canPushUpdates",_CanPushUpdates); + if (_PushTypeAvailable?.Any() == true) yield return new KeyValuePair("pushTypeAvailable",_PushTypeAvailable); } } @@ -373,13 +369,13 @@ public partial class AttestationComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// When the who is asserting on behalf of another (organization or individual). @@ -388,13 +384,13 @@ public Hl7.Fhir.Model.ResourceReference Who [CLSCompliant(false)] [References("Organization","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// The method by which attested information was submitted/retrieved. @@ -402,41 +398,38 @@ public Hl7.Fhir.Model.ResourceReference OnBehalfOf [FhirElement("communicationMethod", InSummary=true, Order=60)] [Binding("communication-method")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CommunicationMethod + public Hl7.Fhir.Model.CodeableConcept? CommunicationMethod { get { return _CommunicationMethod; } set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } - private Hl7.Fhir.Model.CodeableConcept _CommunicationMethod; + private Hl7.Fhir.Model.CodeableConcept? _CommunicationMethod; /// /// The date the information was attested to. /// [FhirElement("date", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// The date the information was attested to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -446,28 +439,25 @@ public string Date /// [FhirElement("sourceIdentityCertificate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceIdentityCertificateElement + public Hl7.Fhir.Model.FhirString? SourceIdentityCertificateElement { get { return _SourceIdentityCertificateElement; } set { _SourceIdentityCertificateElement = value; OnPropertyChanged("SourceIdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _SourceIdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _SourceIdentityCertificateElement; /// /// A digital identity certificate associated with the attestation source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceIdentityCertificate + public string? SourceIdentityCertificate { - get { return SourceIdentityCertificateElement != null ? SourceIdentityCertificateElement.Value : null; } + get => _SourceIdentityCertificateElement?.Value; set { - if (value == null) - SourceIdentityCertificateElement = null; - else - SourceIdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + SourceIdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceIdentityCertificate"); } } @@ -477,28 +467,25 @@ public string SourceIdentityCertificate /// [FhirElement("proxyIdentityCertificate", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ProxyIdentityCertificateElement + public Hl7.Fhir.Model.FhirString? ProxyIdentityCertificateElement { get { return _ProxyIdentityCertificateElement; } set { _ProxyIdentityCertificateElement = value; OnPropertyChanged("ProxyIdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _ProxyIdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _ProxyIdentityCertificateElement; /// /// A digital identity certificate associated with the proxy entity submitting attested information on behalf of the attestation source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProxyIdentityCertificate + public string? ProxyIdentityCertificate { - get { return ProxyIdentityCertificateElement != null ? ProxyIdentityCertificateElement.Value : null; } + get => _ProxyIdentityCertificateElement?.Value; set { - if (value == null) - ProxyIdentityCertificateElement = null; - else - ProxyIdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + ProxyIdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProxyIdentityCertificate"); } } @@ -508,45 +495,41 @@ public string ProxyIdentityCertificate /// [FhirElement("proxySignature", Order=100)] [DataMember] - public Hl7.Fhir.Model.Signature ProxySignature + public Hl7.Fhir.Model.Signature? ProxySignature { get { return _ProxySignature; } set { _ProxySignature = value; OnPropertyChanged("ProxySignature"); } } - private Hl7.Fhir.Model.Signature _ProxySignature; + private Hl7.Fhir.Model.Signature? _ProxySignature; /// /// Attester signature. /// [FhirElement("sourceSignature", Order=110)] [DataMember] - public Hl7.Fhir.Model.Signature SourceSignature + public Hl7.Fhir.Model.Signature? SourceSignature { get { return _SourceSignature; } set { _SourceSignature = value; OnPropertyChanged("SourceSignature"); } } - private Hl7.Fhir.Model.Signature _SourceSignature; + private Hl7.Fhir.Model.Signature? _SourceSignature; protected internal override void CopyToInternal(Base other) { - var dest = other as AttestationComponent; - - if (dest == null) - { + if(other is not AttestationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(CommunicationMethod != null) dest.CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)CommunicationMethod.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(SourceIdentityCertificateElement != null) dest.SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)SourceIdentityCertificateElement.DeepCopyInternal(); - if(ProxyIdentityCertificateElement != null) dest.ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)ProxyIdentityCertificateElement.DeepCopyInternal(); - if(ProxySignature != null) dest.ProxySignature = (Hl7.Fhir.Model.Signature)ProxySignature.DeepCopyInternal(); - if(SourceSignature != null) dest.SourceSignature = (Hl7.Fhir.Model.Signature)SourceSignature.DeepCopyInternal(); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_CommunicationMethod is not null) dest.CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)_CommunicationMethod.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_SourceIdentityCertificateElement is not null) dest.SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_SourceIdentityCertificateElement.DeepCopyInternal(); + if(_ProxyIdentityCertificateElement is not null) dest.ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_ProxyIdentityCertificateElement.DeepCopyInternal(); + if(_ProxySignature is not null) dest.ProxySignature = (Hl7.Fhir.Model.Signature)_ProxySignature.DeepCopyInternal(); + if(_SourceSignature is not null) dest.SourceSignature = (Hl7.Fhir.Model.Signature)_SourceSignature.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -558,83 +541,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttestationComponent; - if(otherT == null) return false; + if(other is not AttestationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(CommunicationMethod, otherT.CommunicationMethod)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(SourceIdentityCertificateElement, otherT.SourceIdentityCertificateElement)) return false; - if(!comparer.Equals(ProxyIdentityCertificateElement, otherT.ProxyIdentityCertificateElement)) return false; - if(!comparer.Equals(ProxySignature, otherT.ProxySignature)) return false; - if(!comparer.Equals(SourceSignature, otherT.SourceSignature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_CommunicationMethod, otherT._CommunicationMethod)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_SourceIdentityCertificateElement, otherT._SourceIdentityCertificateElement)) return false; + if(!comparer.Equals(_ProxyIdentityCertificateElement, otherT._ProxyIdentityCertificateElement)) return false; + if(!comparer.Equals(_ProxySignature, otherT._ProxySignature)) return false; + if(!comparer.Equals(_SourceSignature, otherT._SourceSignature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "communicationMethod": - value = CommunicationMethod; - return CommunicationMethod is not null; + value = _CommunicationMethod; + return _CommunicationMethod is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "sourceIdentityCertificate": - value = SourceIdentityCertificateElement; - return SourceIdentityCertificateElement is not null; + value = _SourceIdentityCertificateElement; + return _SourceIdentityCertificateElement is not null; case "proxyIdentityCertificate": - value = ProxyIdentityCertificateElement; - return ProxyIdentityCertificateElement is not null; + value = _ProxyIdentityCertificateElement; + return _ProxyIdentityCertificateElement is not null; case "proxySignature": - value = ProxySignature; - return ProxySignature is not null; + value = _ProxySignature; + return _ProxySignature is not null; case "sourceSignature": - value = SourceSignature; - return SourceSignature is not null; + value = _SourceSignature; + return _SourceSignature is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "communicationMethod": - CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)value; + CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "sourceIdentityCertificate": - SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "proxyIdentityCertificate": - ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "proxySignature": - ProxySignature = (Hl7.Fhir.Model.Signature)value; + ProxySignature = (Hl7.Fhir.Model.Signature?)value; return this; case "sourceSignature": - SourceSignature = (Hl7.Fhir.Model.Signature)value; + SourceSignature = (Hl7.Fhir.Model.Signature?)value; return this; default: return base.SetValue(key, value); @@ -645,14 +628,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (CommunicationMethod is not null) yield return new KeyValuePair("communicationMethod",CommunicationMethod); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (SourceIdentityCertificateElement is not null) yield return new KeyValuePair("sourceIdentityCertificate",SourceIdentityCertificateElement); - if (ProxyIdentityCertificateElement is not null) yield return new KeyValuePair("proxyIdentityCertificate",ProxyIdentityCertificateElement); - if (ProxySignature is not null) yield return new KeyValuePair("proxySignature",ProxySignature); - if (SourceSignature is not null) yield return new KeyValuePair("sourceSignature",SourceSignature); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_CommunicationMethod is not null) yield return new KeyValuePair("communicationMethod",_CommunicationMethod); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_SourceIdentityCertificateElement is not null) yield return new KeyValuePair("sourceIdentityCertificate",_SourceIdentityCertificateElement); + if (_ProxyIdentityCertificateElement is not null) yield return new KeyValuePair("proxyIdentityCertificate",_ProxyIdentityCertificateElement); + if (_ProxySignature is not null) yield return new KeyValuePair("proxySignature",_ProxySignature); + if (_SourceSignature is not null) yield return new KeyValuePair("sourceSignature",_SourceSignature); } } @@ -678,41 +661,38 @@ public partial class ValidatorComponent : Hl7.Fhir.Model.BackboneElement [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// A digital identity certificate associated with the validator. /// [FhirElement("identityCertificate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString IdentityCertificateElement + public Hl7.Fhir.Model.FhirString? IdentityCertificateElement { get { return _IdentityCertificateElement; } set { _IdentityCertificateElement = value; OnPropertyChanged("IdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _IdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _IdentityCertificateElement; /// /// A digital identity certificate associated with the validator /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IdentityCertificate + public string? IdentityCertificate { - get { return IdentityCertificateElement != null ? IdentityCertificateElement.Value : null; } + get => _IdentityCertificateElement?.Value; set { - if (value == null) - IdentityCertificateElement = null; - else - IdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + IdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IdentityCertificate"); } } @@ -722,27 +702,23 @@ public string IdentityCertificate /// [FhirElement("attestationSignature", Order=60)] [DataMember] - public Hl7.Fhir.Model.Signature AttestationSignature + public Hl7.Fhir.Model.Signature? AttestationSignature { get { return _AttestationSignature; } set { _AttestationSignature = value; OnPropertyChanged("AttestationSignature"); } } - private Hl7.Fhir.Model.Signature _AttestationSignature; + private Hl7.Fhir.Model.Signature? _AttestationSignature; protected internal override void CopyToInternal(Base other) { - var dest = other as ValidatorComponent; - - if (dest == null) - { + if(other is not ValidatorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(IdentityCertificateElement != null) dest.IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)IdentityCertificateElement.DeepCopyInternal(); - if(AttestationSignature != null) dest.AttestationSignature = (Hl7.Fhir.Model.Signature)AttestationSignature.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_IdentityCertificateElement is not null) dest.IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_IdentityCertificateElement.DeepCopyInternal(); + if(_AttestationSignature is not null) dest.AttestationSignature = (Hl7.Fhir.Model.Signature)_AttestationSignature.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -754,48 +730,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValidatorComponent; - if(otherT == null) return false; + if(other is not ValidatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(IdentityCertificateElement, otherT.IdentityCertificateElement)) return false; - if(!comparer.Equals(AttestationSignature, otherT.AttestationSignature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_IdentityCertificateElement, otherT._IdentityCertificateElement)) return false; + if(!comparer.Equals(_AttestationSignature, otherT._AttestationSignature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "identityCertificate": - value = IdentityCertificateElement; - return IdentityCertificateElement is not null; + value = _IdentityCertificateElement; + return _IdentityCertificateElement is not null; case "attestationSignature": - value = AttestationSignature; - return AttestationSignature is not null; + value = _AttestationSignature; + return _AttestationSignature is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "identityCertificate": - IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + IdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "attestationSignature": - AttestationSignature = (Hl7.Fhir.Model.Signature)value; + AttestationSignature = (Hl7.Fhir.Model.Signature?)value; return this; default: return base.SetValue(key, value); @@ -806,9 +782,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (IdentityCertificateElement is not null) yield return new KeyValuePair("identityCertificate",IdentityCertificateElement); - if (AttestationSignature is not null) yield return new KeyValuePair("attestationSignature",AttestationSignature); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_IdentityCertificateElement is not null) yield return new KeyValuePair("identityCertificate",_IdentityCertificateElement); + if (_AttestationSignature is not null) yield return new KeyValuePair("attestationSignature",_AttestationSignature); } } @@ -823,11 +799,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// The fhirpath location(s) within the resource that was validated. @@ -837,24 +813,24 @@ public List Target [DataMember] public List TargetLocationElement { - get { if(_TargetLocationElement==null) _TargetLocationElement = new List(); return _TargetLocationElement; } + get => _TargetLocationElement ?? new List(); set { _TargetLocationElement = value; OnPropertyChanged("TargetLocationElement"); } } - private List _TargetLocationElement; + private List? _TargetLocationElement; /// /// The fhirpath location(s) within the resource that was validated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TargetLocation + public IEnumerable? TargetLocation { - get { return TargetLocationElement != null ? TargetLocationElement.Select(elem => elem.Value) : null; } + get => _TargetLocationElement?.Select(elem => elem.Value); set { if (value == null) - TargetLocationElement = null; + TargetLocationElement = null!; else TargetLocationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("TargetLocation"); @@ -867,13 +843,13 @@ public IEnumerable TargetLocation [FhirElement("need", InSummary=true, Order=110)] [Binding("need")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Need + public Hl7.Fhir.Model.CodeableConcept? Need { get { return _Need; } set { _Need = value; OnPropertyChanged("Need"); } } - private Hl7.Fhir.Model.CodeableConcept _Need; + private Hl7.Fhir.Model.CodeableConcept? _Need; /// /// attested | validated | in-process | req-revalid | val-fail | reval-fail. @@ -883,13 +859,13 @@ public Hl7.Fhir.Model.CodeableConcept Need [Binding("status")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// attested | validated | in-process | req-revalid | val-fail | reval-fail @@ -898,13 +874,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.VerificationResult.StatusCode? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -914,28 +887,25 @@ public Hl7.Fhir.Model.VerificationResult.StatusCode? Status /// [FhirElement("statusDate", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// When the validation status was updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -946,13 +916,13 @@ public string StatusDate [FhirElement("validationType", InSummary=true, Order=140)] [Binding("validation-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ValidationType + public Hl7.Fhir.Model.CodeableConcept? ValidationType { get { return _ValidationType; } set { _ValidationType = value; OnPropertyChanged("ValidationType"); } } - private Hl7.Fhir.Model.CodeableConcept _ValidationType; + private Hl7.Fhir.Model.CodeableConcept? _ValidationType; /// /// The primary process by which the target is validated (edit check; value set; primary source; multiple sources; standalone; in context). @@ -963,52 +933,49 @@ public Hl7.Fhir.Model.CodeableConcept ValidationType [DataMember] public List ValidationProcess { - get { if(_ValidationProcess==null) _ValidationProcess = new List(); return _ValidationProcess; } + get => _ValidationProcess ?? new List(); set { _ValidationProcess = value; OnPropertyChanged("ValidationProcess"); } } - private List _ValidationProcess; + private List? _ValidationProcess; /// /// Frequency of revalidation. /// [FhirElement("frequency", Order=160)] [DataMember] - public Hl7.Fhir.Model.Timing Frequency + public Hl7.Fhir.Model.Timing? Frequency { get { return _Frequency; } set { _Frequency = value; OnPropertyChanged("Frequency"); } } - private Hl7.Fhir.Model.Timing _Frequency; + private Hl7.Fhir.Model.Timing? _Frequency; /// /// The date/time validation was last completed (including failed validations). /// [FhirElement("lastPerformed", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastPerformedElement + public Hl7.Fhir.Model.FhirDateTime? LastPerformedElement { get { return _LastPerformedElement; } set { _LastPerformedElement = value; OnPropertyChanged("LastPerformedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastPerformedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastPerformedElement; /// /// The date/time validation was last completed (including failed validations) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastPerformed + public string? LastPerformed { - get { return LastPerformedElement != null ? LastPerformedElement.Value : null; } + get => _LastPerformedElement?.Value; set { - if (value == null) - LastPerformedElement = null; - else - LastPerformedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastPerformedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastPerformed"); } } @@ -1018,28 +985,25 @@ public string LastPerformed /// [FhirElement("nextScheduled", Order=180)] [DataMember] - public Hl7.Fhir.Model.Date NextScheduledElement + public Hl7.Fhir.Model.Date? NextScheduledElement { get { return _NextScheduledElement; } set { _NextScheduledElement = value; OnPropertyChanged("NextScheduledElement"); } } - private Hl7.Fhir.Model.Date _NextScheduledElement; + private Hl7.Fhir.Model.Date? _NextScheduledElement; /// /// The date when target is next validated, if appropriate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string NextScheduled + public string? NextScheduled { - get { return NextScheduledElement != null ? NextScheduledElement.Value : null; } + get => _NextScheduledElement?.Value; set { - if (value == null) - NextScheduledElement = null; - else - NextScheduledElement = new Hl7.Fhir.Model.Date(value); + NextScheduledElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("NextScheduled"); } } @@ -1050,13 +1014,13 @@ public string NextScheduled [FhirElement("failureAction", InSummary=true, Order=190)] [Binding("failure-action")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FailureAction + public Hl7.Fhir.Model.CodeableConcept? FailureAction { get { return _FailureAction; } set { _FailureAction = value; OnPropertyChanged("FailureAction"); } } - private Hl7.Fhir.Model.CodeableConcept _FailureAction; + private Hl7.Fhir.Model.CodeableConcept? _FailureAction; /// /// Information about the primary source(s) involved in validation. @@ -1066,24 +1030,24 @@ public Hl7.Fhir.Model.CodeableConcept FailureAction [DataMember] public List PrimarySource { - get { if(_PrimarySource==null) _PrimarySource = new List(); return _PrimarySource; } + get => _PrimarySource ?? new List(); set { _PrimarySource = value; OnPropertyChanged("PrimarySource"); } } - private List _PrimarySource; + private List? _PrimarySource; /// /// Information about the entity attesting to information. /// [FhirElement("attestation", Order=210)] [DataMember] - public Hl7.Fhir.Model.VerificationResult.AttestationComponent Attestation + public Hl7.Fhir.Model.VerificationResult.AttestationComponent? Attestation { get { return _Attestation; } set { _Attestation = value; OnPropertyChanged("Attestation"); } } - private Hl7.Fhir.Model.VerificationResult.AttestationComponent _Attestation; + private Hl7.Fhir.Model.VerificationResult.AttestationComponent? _Attestation; /// /// Information about the entity validating information. @@ -1093,36 +1057,32 @@ public Hl7.Fhir.Model.VerificationResult.AttestationComponent Attestation [DataMember] public List Validator { - get { if(_Validator==null) _Validator = new List(); return _Validator; } + get => _Validator ?? new List(); set { _Validator = value; OnPropertyChanged("Validator"); } } - private List _Validator; + private List? _Validator; protected internal override void CopyToInternal(Base other) { - var dest = other as VerificationResult; - - if (dest == null) - { + if(other is not VerificationResult dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(TargetLocationElement.Any()) dest.TargetLocationElement = new List(TargetLocationElement.DeepCopyInternal()); - if(Need != null) dest.Need = (Hl7.Fhir.Model.CodeableConcept)Need.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(ValidationType != null) dest.ValidationType = (Hl7.Fhir.Model.CodeableConcept)ValidationType.DeepCopyInternal(); - if(ValidationProcess.Any()) dest.ValidationProcess = new List(ValidationProcess.DeepCopyInternal()); - if(Frequency != null) dest.Frequency = (Hl7.Fhir.Model.Timing)Frequency.DeepCopyInternal(); - if(LastPerformedElement != null) dest.LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)LastPerformedElement.DeepCopyInternal(); - if(NextScheduledElement != null) dest.NextScheduledElement = (Hl7.Fhir.Model.Date)NextScheduledElement.DeepCopyInternal(); - if(FailureAction != null) dest.FailureAction = (Hl7.Fhir.Model.CodeableConcept)FailureAction.DeepCopyInternal(); - if(PrimarySource.Any()) dest.PrimarySource = new List(PrimarySource.DeepCopyInternal()); - if(Attestation != null) dest.Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)Attestation.DeepCopyInternal(); - if(Validator.Any()) dest.Validator = new List(Validator.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_TargetLocationElement is not null) dest.TargetLocationElement = new List(_TargetLocationElement.DeepCopyInternal()); + if(_Need is not null) dest.Need = (Hl7.Fhir.Model.CodeableConcept)_Need.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_ValidationType is not null) dest.ValidationType = (Hl7.Fhir.Model.CodeableConcept)_ValidationType.DeepCopyInternal(); + if(_ValidationProcess is not null) dest.ValidationProcess = new List(_ValidationProcess.DeepCopyInternal()); + if(_Frequency is not null) dest.Frequency = (Hl7.Fhir.Model.Timing)_Frequency.DeepCopyInternal(); + if(_LastPerformedElement is not null) dest.LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)_LastPerformedElement.DeepCopyInternal(); + if(_NextScheduledElement is not null) dest.NextScheduledElement = (Hl7.Fhir.Model.Date)_NextScheduledElement.DeepCopyInternal(); + if(_FailureAction is not null) dest.FailureAction = (Hl7.Fhir.Model.CodeableConcept)_FailureAction.DeepCopyInternal(); + if(_PrimarySource is not null) dest.PrimarySource = new List(_PrimarySource.DeepCopyInternal()); + if(_Attestation is not null) dest.Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)_Attestation.DeepCopyInternal(); + if(_Validator is not null) dest.Validator = new List(_Validator.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1134,125 +1094,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VerificationResult; - if(otherT == null) return false; + if(other is not VerificationResult otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(TargetLocationElement, otherT.TargetLocationElement)) return false; - if(!comparer.Equals(Need, otherT.Need)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(ValidationType, otherT.ValidationType)) return false; - if(!comparer.ListEquals(ValidationProcess, otherT.ValidationProcess)) return false; - if(!comparer.Equals(Frequency, otherT.Frequency)) return false; - if(!comparer.Equals(LastPerformedElement, otherT.LastPerformedElement)) return false; - if(!comparer.Equals(NextScheduledElement, otherT.NextScheduledElement)) return false; - if(!comparer.Equals(FailureAction, otherT.FailureAction)) return false; - if(!comparer.ListEquals(PrimarySource, otherT.PrimarySource)) return false; - if(!comparer.Equals(Attestation, otherT.Attestation)) return false; - if(!comparer.ListEquals(Validator, otherT.Validator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_TargetLocationElement, otherT._TargetLocationElement)) return false; + if(!comparer.Equals(_Need, otherT._Need)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_ValidationType, otherT._ValidationType)) return false; + if(!comparer.ListEquals(_ValidationProcess, otherT._ValidationProcess)) return false; + if(!comparer.Equals(_Frequency, otherT._Frequency)) return false; + if(!comparer.Equals(_LastPerformedElement, otherT._LastPerformedElement)) return false; + if(!comparer.Equals(_NextScheduledElement, otherT._NextScheduledElement)) return false; + if(!comparer.Equals(_FailureAction, otherT._FailureAction)) return false; + if(!comparer.ListEquals(_PrimarySource, otherT._PrimarySource)) return false; + if(!comparer.Equals(_Attestation, otherT._Attestation)) return false; + if(!comparer.ListEquals(_Validator, otherT._Validator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "targetLocation": - value = TargetLocationElement; - return TargetLocationElement?.Any() == true; + value = _TargetLocationElement; + return _TargetLocationElement?.Any() == true; case "need": - value = Need; - return Need is not null; + value = _Need; + return _Need is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "validationType": - value = ValidationType; - return ValidationType is not null; + value = _ValidationType; + return _ValidationType is not null; case "validationProcess": - value = ValidationProcess; - return ValidationProcess?.Any() == true; + value = _ValidationProcess; + return _ValidationProcess?.Any() == true; case "frequency": - value = Frequency; - return Frequency is not null; + value = _Frequency; + return _Frequency is not null; case "lastPerformed": - value = LastPerformedElement; - return LastPerformedElement is not null; + value = _LastPerformedElement; + return _LastPerformedElement is not null; case "nextScheduled": - value = NextScheduledElement; - return NextScheduledElement is not null; + value = _NextScheduledElement; + return _NextScheduledElement is not null; case "failureAction": - value = FailureAction; - return FailureAction is not null; + value = _FailureAction; + return _FailureAction is not null; case "primarySource": - value = PrimarySource; - return PrimarySource?.Any() == true; + value = _PrimarySource; + return _PrimarySource?.Any() == true; case "attestation": - value = Attestation; - return Attestation is not null; + value = _Attestation; + return _Attestation is not null; case "validator": - value = Validator; - return Validator?.Any() == true; + value = _Validator; + return _Validator?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (List)value; + Target = (List?)value!; return this; case "targetLocation": - TargetLocationElement = (List)value; + TargetLocationElement = (List?)value!; return this; case "need": - Need = (Hl7.Fhir.Model.CodeableConcept)value; + Need = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "validationType": - ValidationType = (Hl7.Fhir.Model.CodeableConcept)value; + ValidationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "validationProcess": - ValidationProcess = (List)value; + ValidationProcess = (List?)value!; return this; case "frequency": - Frequency = (Hl7.Fhir.Model.Timing)value; + Frequency = (Hl7.Fhir.Model.Timing?)value; return this; case "lastPerformed": - LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "nextScheduled": - NextScheduledElement = (Hl7.Fhir.Model.Date)value; + NextScheduledElement = (Hl7.Fhir.Model.Date?)value; return this; case "failureAction": - FailureAction = (Hl7.Fhir.Model.CodeableConcept)value; + FailureAction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "primarySource": - PrimarySource = (List)value; + PrimarySource = (List?)value!; return this; case "attestation": - Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)value; + Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent?)value; return this; case "validator": - Validator = (List)value; + Validator = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1263,20 +1223,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (TargetLocationElement?.Any() == true) yield return new KeyValuePair("targetLocation",TargetLocationElement); - if (Need is not null) yield return new KeyValuePair("need",Need); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (ValidationType is not null) yield return new KeyValuePair("validationType",ValidationType); - if (ValidationProcess?.Any() == true) yield return new KeyValuePair("validationProcess",ValidationProcess); - if (Frequency is not null) yield return new KeyValuePair("frequency",Frequency); - if (LastPerformedElement is not null) yield return new KeyValuePair("lastPerformed",LastPerformedElement); - if (NextScheduledElement is not null) yield return new KeyValuePair("nextScheduled",NextScheduledElement); - if (FailureAction is not null) yield return new KeyValuePair("failureAction",FailureAction); - if (PrimarySource?.Any() == true) yield return new KeyValuePair("primarySource",PrimarySource); - if (Attestation is not null) yield return new KeyValuePair("attestation",Attestation); - if (Validator?.Any() == true) yield return new KeyValuePair("validator",Validator); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_TargetLocationElement?.Any() == true) yield return new KeyValuePair("targetLocation",_TargetLocationElement); + if (_Need is not null) yield return new KeyValuePair("need",_Need); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_ValidationType is not null) yield return new KeyValuePair("validationType",_ValidationType); + if (_ValidationProcess?.Any() == true) yield return new KeyValuePair("validationProcess",_ValidationProcess); + if (_Frequency is not null) yield return new KeyValuePair("frequency",_Frequency); + if (_LastPerformedElement is not null) yield return new KeyValuePair("lastPerformed",_LastPerformedElement); + if (_NextScheduledElement is not null) yield return new KeyValuePair("nextScheduled",_NextScheduledElement); + if (_FailureAction is not null) yield return new KeyValuePair("failureAction",_FailureAction); + if (_PrimarySource?.Any() == true) yield return new KeyValuePair("primarySource",_PrimarySource); + if (_Attestation is not null) yield return new KeyValuePair("attestation",_Attestation); + if (_Validator?.Any() == true) yield return new KeyValuePair("validator",_Validator); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs index daea37968..7c8278a23 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -138,13 +141,13 @@ public partial class LensSpecificationComponent : Hl7.Fhir.Model.BackboneElement [Binding("VisionProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Product + public Hl7.Fhir.Model.CodeableConcept? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.CodeableConcept _Product; + private Hl7.Fhir.Model.CodeableConcept? _Product; /// /// right | left. @@ -154,13 +157,13 @@ public Hl7.Fhir.Model.CodeableConcept Product [Binding("VisionEyes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code EyeElement + public Code? EyeElement { get { return _EyeElement; } set { _EyeElement = value; OnPropertyChanged("EyeElement"); } } - private Code _EyeElement; + private Code? _EyeElement; /// /// right | left @@ -169,13 +172,10 @@ public Code EyeElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye { - get { return EyeElement != null ? EyeElement.Value : null; } + get => _EyeElement?.Value; set { - if (value == null) - EyeElement = null; - else - EyeElement = new Code(value); + EyeElement = value is null ? null : new Code(value); OnPropertyChanged("Eye"); } } @@ -185,13 +185,13 @@ public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye /// [FhirElement("sphere", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal SphereElement + public Hl7.Fhir.Model.FhirDecimal? SphereElement { get { return _SphereElement; } set { _SphereElement = value; OnPropertyChanged("SphereElement"); } } - private Hl7.Fhir.Model.FhirDecimal _SphereElement; + private Hl7.Fhir.Model.FhirDecimal? _SphereElement; /// /// Power of the lens @@ -200,13 +200,10 @@ public Hl7.Fhir.Model.FhirDecimal SphereElement [IgnoreDataMember] public decimal? Sphere { - get { return SphereElement != null ? SphereElement.Value : null; } + get => _SphereElement?.Value; set { - if (value == null) - SphereElement = null; - else - SphereElement = new Hl7.Fhir.Model.FhirDecimal(value); + SphereElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Sphere"); } } @@ -216,13 +213,13 @@ public decimal? Sphere /// [FhirElement("cylinder", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal CylinderElement + public Hl7.Fhir.Model.FhirDecimal? CylinderElement { get { return _CylinderElement; } set { _CylinderElement = value; OnPropertyChanged("CylinderElement"); } } - private Hl7.Fhir.Model.FhirDecimal _CylinderElement; + private Hl7.Fhir.Model.FhirDecimal? _CylinderElement; /// /// Lens power for astigmatism @@ -231,13 +228,10 @@ public Hl7.Fhir.Model.FhirDecimal CylinderElement [IgnoreDataMember] public decimal? Cylinder { - get { return CylinderElement != null ? CylinderElement.Value : null; } + get => _CylinderElement?.Value; set { - if (value == null) - CylinderElement = null; - else - CylinderElement = new Hl7.Fhir.Model.FhirDecimal(value); + CylinderElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Cylinder"); } } @@ -247,13 +241,13 @@ public decimal? Cylinder /// [FhirElement("axis", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer AxisElement + public Hl7.Fhir.Model.Integer? AxisElement { get { return _AxisElement; } set { _AxisElement = value; OnPropertyChanged("AxisElement"); } } - private Hl7.Fhir.Model.Integer _AxisElement; + private Hl7.Fhir.Model.Integer? _AxisElement; /// /// Lens meridian which contain no power for astigmatism @@ -262,13 +256,10 @@ public Hl7.Fhir.Model.Integer AxisElement [IgnoreDataMember] public int? Axis { - get { return AxisElement != null ? AxisElement.Value : null; } + get => _AxisElement?.Value; set { - if (value == null) - AxisElement = null; - else - AxisElement = new Hl7.Fhir.Model.Integer(value); + AxisElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Axis"); } } @@ -281,24 +272,24 @@ public int? Axis [DataMember] public List Prism { - get { if(_Prism==null) _Prism = new List(); return _Prism; } + get => _Prism ?? new List(); set { _Prism = value; OnPropertyChanged("Prism"); } } - private List _Prism; + private List? _Prism; /// /// Added power for multifocal levels. /// [FhirElement("add", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AddElement + public Hl7.Fhir.Model.FhirDecimal? AddElement { get { return _AddElement; } set { _AddElement = value; OnPropertyChanged("AddElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AddElement; + private Hl7.Fhir.Model.FhirDecimal? _AddElement; /// /// Added power for multifocal levels @@ -307,13 +298,10 @@ public Hl7.Fhir.Model.FhirDecimal AddElement [IgnoreDataMember] public decimal? Add { - get { return AddElement != null ? AddElement.Value : null; } + get => _AddElement?.Value; set { - if (value == null) - AddElement = null; - else - AddElement = new Hl7.Fhir.Model.FhirDecimal(value); + AddElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Add"); } } @@ -323,13 +311,13 @@ public decimal? Add /// [FhirElement("power", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PowerElement + public Hl7.Fhir.Model.FhirDecimal? PowerElement { get { return _PowerElement; } set { _PowerElement = value; OnPropertyChanged("PowerElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PowerElement; + private Hl7.Fhir.Model.FhirDecimal? _PowerElement; /// /// Contact lens power @@ -338,13 +326,10 @@ public Hl7.Fhir.Model.FhirDecimal PowerElement [IgnoreDataMember] public decimal? Power { - get { return PowerElement != null ? PowerElement.Value : null; } + get => _PowerElement?.Value; set { - if (value == null) - PowerElement = null; - else - PowerElement = new Hl7.Fhir.Model.FhirDecimal(value); + PowerElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Power"); } } @@ -354,13 +339,13 @@ public decimal? Power /// [FhirElement("backCurve", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal BackCurveElement + public Hl7.Fhir.Model.FhirDecimal? BackCurveElement { get { return _BackCurveElement; } set { _BackCurveElement = value; OnPropertyChanged("BackCurveElement"); } } - private Hl7.Fhir.Model.FhirDecimal _BackCurveElement; + private Hl7.Fhir.Model.FhirDecimal? _BackCurveElement; /// /// Contact lens back curvature @@ -369,13 +354,10 @@ public Hl7.Fhir.Model.FhirDecimal BackCurveElement [IgnoreDataMember] public decimal? BackCurve { - get { return BackCurveElement != null ? BackCurveElement.Value : null; } + get => _BackCurveElement?.Value; set { - if (value == null) - BackCurveElement = null; - else - BackCurveElement = new Hl7.Fhir.Model.FhirDecimal(value); + BackCurveElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("BackCurve"); } } @@ -385,13 +367,13 @@ public decimal? BackCurve /// [FhirElement("diameter", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DiameterElement + public Hl7.Fhir.Model.FhirDecimal? DiameterElement { get { return _DiameterElement; } set { _DiameterElement = value; OnPropertyChanged("DiameterElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DiameterElement; + private Hl7.Fhir.Model.FhirDecimal? _DiameterElement; /// /// Contact lens diameter @@ -400,13 +382,10 @@ public Hl7.Fhir.Model.FhirDecimal DiameterElement [IgnoreDataMember] public decimal? Diameter { - get { return DiameterElement != null ? DiameterElement.Value : null; } + get => _DiameterElement?.Value; set { - if (value == null) - DiameterElement = null; - else - DiameterElement = new Hl7.Fhir.Model.FhirDecimal(value); + DiameterElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Diameter"); } } @@ -416,41 +395,38 @@ public decimal? Diameter /// [FhirElement("duration", Order=140)] [DataMember] - public Hl7.Fhir.Model.Quantity Duration + public Hl7.Fhir.Model.Quantity? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Quantity _Duration; + private Hl7.Fhir.Model.Quantity? _Duration; /// /// Color required. /// [FhirElement("color", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString ColorElement + public Hl7.Fhir.Model.FhirString? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Hl7.Fhir.Model.FhirString _ColorElement; + private Hl7.Fhir.Model.FhirString? _ColorElement; /// /// Color required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Color + public string? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Hl7.Fhir.Model.FhirString(value); + ColorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Color"); } } @@ -460,28 +436,25 @@ public string Color /// [FhirElement("brand", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString BrandElement + public Hl7.Fhir.Model.FhirString? BrandElement { get { return _BrandElement; } set { _BrandElement = value; OnPropertyChanged("BrandElement"); } } - private Hl7.Fhir.Model.FhirString _BrandElement; + private Hl7.Fhir.Model.FhirString? _BrandElement; /// /// Brand required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Brand + public string? Brand { - get { return BrandElement != null ? BrandElement.Value : null; } + get => _BrandElement?.Value; set { - if (value == null) - BrandElement = null; - else - BrandElement = new Hl7.Fhir.Model.FhirString(value); + BrandElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Brand"); } } @@ -494,36 +467,32 @@ public string Brand [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as LensSpecificationComponent; - - if (dest == null) - { + if(other is not LensSpecificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Product != null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)Product.DeepCopyInternal(); - if(EyeElement != null) dest.EyeElement = (Code)EyeElement.DeepCopyInternal(); - if(SphereElement != null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)SphereElement.DeepCopyInternal(); - if(CylinderElement != null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)CylinderElement.DeepCopyInternal(); - if(AxisElement != null) dest.AxisElement = (Hl7.Fhir.Model.Integer)AxisElement.DeepCopyInternal(); - if(Prism.Any()) dest.Prism = new List(Prism.DeepCopyInternal()); - if(AddElement != null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)AddElement.DeepCopyInternal(); - if(PowerElement != null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)PowerElement.DeepCopyInternal(); - if(BackCurveElement != null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)BackCurveElement.DeepCopyInternal(); - if(DiameterElement != null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)DiameterElement.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Quantity)Duration.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)ColorElement.DeepCopyInternal(); - if(BrandElement != null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)BrandElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)_Product.DeepCopyInternal(); + if(_EyeElement is not null) dest.EyeElement = (Code)_EyeElement.DeepCopyInternal(); + if(_SphereElement is not null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)_SphereElement.DeepCopyInternal(); + if(_CylinderElement is not null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)_CylinderElement.DeepCopyInternal(); + if(_AxisElement is not null) dest.AxisElement = (Hl7.Fhir.Model.Integer)_AxisElement.DeepCopyInternal(); + if(_Prism is not null) dest.Prism = new List(_Prism.DeepCopyInternal()); + if(_AddElement is not null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)_AddElement.DeepCopyInternal(); + if(_PowerElement is not null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)_PowerElement.DeepCopyInternal(); + if(_BackCurveElement is not null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)_BackCurveElement.DeepCopyInternal(); + if(_DiameterElement is not null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)_DiameterElement.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Quantity)_Duration.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)_ColorElement.DeepCopyInternal(); + if(_BrandElement is not null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)_BrandElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -535,125 +504,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LensSpecificationComponent; - if(otherT == null) return false; + if(other is not LensSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(EyeElement, otherT.EyeElement)) return false; - if(!comparer.Equals(SphereElement, otherT.SphereElement)) return false; - if(!comparer.Equals(CylinderElement, otherT.CylinderElement)) return false; - if(!comparer.Equals(AxisElement, otherT.AxisElement)) return false; - if(!comparer.ListEquals(Prism, otherT.Prism)) return false; - if(!comparer.Equals(AddElement, otherT.AddElement)) return false; - if(!comparer.Equals(PowerElement, otherT.PowerElement)) return false; - if(!comparer.Equals(BackCurveElement, otherT.BackCurveElement)) return false; - if(!comparer.Equals(DiameterElement, otherT.DiameterElement)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(BrandElement, otherT.BrandElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; + if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; + if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; + if(!comparer.Equals(_AxisElement, otherT._AxisElement)) return false; + if(!comparer.ListEquals(_Prism, otherT._Prism)) return false; + if(!comparer.Equals(_AddElement, otherT._AddElement)) return false; + if(!comparer.Equals(_PowerElement, otherT._PowerElement)) return false; + if(!comparer.Equals(_BackCurveElement, otherT._BackCurveElement)) return false; + if(!comparer.Equals(_DiameterElement, otherT._DiameterElement)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "eye": - value = EyeElement; - return EyeElement is not null; + value = _EyeElement; + return _EyeElement is not null; case "sphere": - value = SphereElement; - return SphereElement is not null; + value = _SphereElement; + return _SphereElement is not null; case "cylinder": - value = CylinderElement; - return CylinderElement is not null; + value = _CylinderElement; + return _CylinderElement is not null; case "axis": - value = AxisElement; - return AxisElement is not null; + value = _AxisElement; + return _AxisElement is not null; case "prism": - value = Prism; - return Prism?.Any() == true; + value = _Prism; + return _Prism?.Any() == true; case "add": - value = AddElement; - return AddElement is not null; + value = _AddElement; + return _AddElement is not null; case "power": - value = PowerElement; - return PowerElement is not null; + value = _PowerElement; + return _PowerElement is not null; case "backCurve": - value = BackCurveElement; - return BackCurveElement is not null; + value = _BackCurveElement; + return _BackCurveElement is not null; case "diameter": - value = DiameterElement; - return DiameterElement is not null; + value = _DiameterElement; + return _DiameterElement is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "brand": - value = BrandElement; - return BrandElement is not null; + value = _BrandElement; + return _BrandElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "product": - Product = (Hl7.Fhir.Model.CodeableConcept)value; + Product = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "eye": - EyeElement = (Code)value; + EyeElement = (Code?)value; return this; case "sphere": - SphereElement = (Hl7.Fhir.Model.FhirDecimal)value; + SphereElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "cylinder": - CylinderElement = (Hl7.Fhir.Model.FhirDecimal)value; + CylinderElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "axis": - AxisElement = (Hl7.Fhir.Model.Integer)value; + AxisElement = (Hl7.Fhir.Model.Integer?)value; return this; case "prism": - Prism = (List)value; + Prism = (List?)value!; return this; case "add": - AddElement = (Hl7.Fhir.Model.FhirDecimal)value; + AddElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "power": - PowerElement = (Hl7.Fhir.Model.FhirDecimal)value; + PowerElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "backCurve": - BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)value; + BackCurveElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "diameter": - DiameterElement = (Hl7.Fhir.Model.FhirDecimal)value; + DiameterElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Quantity)value; + Duration = (Hl7.Fhir.Model.Quantity?)value; return this; case "color": - ColorElement = (Hl7.Fhir.Model.FhirString)value; + ColorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "brand": - BrandElement = (Hl7.Fhir.Model.FhirString)value; + BrandElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -664,20 +633,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Product is not null) yield return new KeyValuePair("product",Product); - if (EyeElement is not null) yield return new KeyValuePair("eye",EyeElement); - if (SphereElement is not null) yield return new KeyValuePair("sphere",SphereElement); - if (CylinderElement is not null) yield return new KeyValuePair("cylinder",CylinderElement); - if (AxisElement is not null) yield return new KeyValuePair("axis",AxisElement); - if (Prism?.Any() == true) yield return new KeyValuePair("prism",Prism); - if (AddElement is not null) yield return new KeyValuePair("add",AddElement); - if (PowerElement is not null) yield return new KeyValuePair("power",PowerElement); - if (BackCurveElement is not null) yield return new KeyValuePair("backCurve",BackCurveElement); - if (DiameterElement is not null) yield return new KeyValuePair("diameter",DiameterElement); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (BrandElement is not null) yield return new KeyValuePair("brand",BrandElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_EyeElement is not null) yield return new KeyValuePair("eye",_EyeElement); + if (_SphereElement is not null) yield return new KeyValuePair("sphere",_SphereElement); + if (_CylinderElement is not null) yield return new KeyValuePair("cylinder",_CylinderElement); + if (_AxisElement is not null) yield return new KeyValuePair("axis",_AxisElement); + if (_Prism?.Any() == true) yield return new KeyValuePair("prism",_Prism); + if (_AddElement is not null) yield return new KeyValuePair("add",_AddElement); + if (_PowerElement is not null) yield return new KeyValuePair("power",_PowerElement); + if (_BackCurveElement is not null) yield return new KeyValuePair("backCurve",_BackCurveElement); + if (_DiameterElement is not null) yield return new KeyValuePair("diameter",_DiameterElement); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_BrandElement is not null) yield return new KeyValuePair("brand",_BrandElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -704,13 +673,13 @@ public partial class PrismComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("amount", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AmountElement + public Hl7.Fhir.Model.FhirDecimal? AmountElement { get { return _AmountElement; } set { _AmountElement = value; OnPropertyChanged("AmountElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AmountElement; + private Hl7.Fhir.Model.FhirDecimal? _AmountElement; /// /// Amount of adjustment @@ -719,13 +688,10 @@ public Hl7.Fhir.Model.FhirDecimal AmountElement [IgnoreDataMember] public decimal? Amount { - get { return AmountElement != null ? AmountElement.Value : null; } + get => _AmountElement?.Value; set { - if (value == null) - AmountElement = null; - else - AmountElement = new Hl7.Fhir.Model.FhirDecimal(value); + AmountElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Amount"); } } @@ -738,13 +704,13 @@ public decimal? Amount [Binding("VisionBase")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code BaseElement + public Code? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Code _BaseElement; + private Code? _BaseElement; /// /// up | down | in | out @@ -753,29 +719,22 @@ public Code BaseElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionBase? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Code(value); + BaseElement = value is null ? null : new Code(value); OnPropertyChanged("Base"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PrismComponent; - - if (dest == null) - { + if(other is not PrismComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AmountElement != null) dest.AmountElement = (Hl7.Fhir.Model.FhirDecimal)AmountElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Code)BaseElement.DeepCopyInternal(); + if(_AmountElement is not null) dest.AmountElement = (Hl7.Fhir.Model.FhirDecimal)_AmountElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Code)_BaseElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -787,41 +746,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrismComponent; - if(otherT == null) return false; + if(other is not PrismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AmountElement, otherT.AmountElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "amount": - value = AmountElement; - return AmountElement is not null; + value = _AmountElement; + return _AmountElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "amount": - AmountElement = (Hl7.Fhir.Model.FhirDecimal)value; + AmountElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "base": - BaseElement = (Code)value; + BaseElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -832,8 +791,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AmountElement is not null) yield return new KeyValuePair("amount",AmountElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); + if (_AmountElement is not null) yield return new KeyValuePair("amount",_AmountElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); } } @@ -846,11 +805,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -860,13 +819,13 @@ public List Identifier [Binding("VisionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -875,13 +834,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -892,28 +848,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("created", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -926,13 +879,13 @@ public string Created [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Created during encounter / admission / stay. @@ -941,13 +894,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When prescription was authorized. @@ -955,28 +908,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("dateWritten", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateWrittenElement + public Hl7.Fhir.Model.FhirDateTime? DateWrittenElement { get { return _DateWrittenElement; } set { _DateWrittenElement = value; OnPropertyChanged("DateWrittenElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateWrittenElement; + private Hl7.Fhir.Model.FhirDateTime? _DateWrittenElement; /// /// When prescription was authorized /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateWritten + public string? DateWritten { - get { return DateWrittenElement != null ? DateWrittenElement.Value : null; } + get => _DateWrittenElement?.Value; set { - if (value == null) - DateWrittenElement = null; - else - DateWrittenElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateWrittenElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateWritten"); } } @@ -989,13 +939,13 @@ public string DateWritten [References("Practitioner","PractitionerRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescriber + public Hl7.Fhir.Model.ResourceReference? Prescriber { get { return _Prescriber; } set { _Prescriber = value; OnPropertyChanged("Prescriber"); } } - private Hl7.Fhir.Model.ResourceReference _Prescriber; + private Hl7.Fhir.Model.ResourceReference? _Prescriber; /// /// Vision lens authorization. @@ -1005,32 +955,28 @@ public Hl7.Fhir.Model.ResourceReference Prescriber [DataMember] public List LensSpecification { - get { if(_LensSpecification==null) _LensSpecification = new List(); return _LensSpecification; } + get => _LensSpecification ?? new List(); set { _LensSpecification = value; OnPropertyChanged("LensSpecification"); } } - private List _LensSpecification; + private List? _LensSpecification; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as VisionPrescription; - - if (dest == null) - { + if(other is not VisionPrescription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateWrittenElement != null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)DateWrittenElement.DeepCopyInternal(); - if(Prescriber != null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)Prescriber.DeepCopyInternal(); - if(LensSpecification.Any()) dest.LensSpecification = new List(LensSpecification.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateWrittenElement is not null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)_DateWrittenElement.DeepCopyInternal(); + if(_Prescriber is not null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)_Prescriber.DeepCopyInternal(); + if(_LensSpecification is not null) dest.LensSpecification = new List(_LensSpecification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1042,83 +988,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VisionPrescription; - if(otherT == null) return false; + if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateWrittenElement, otherT.DateWrittenElement)) return false; - if(!comparer.Equals(Prescriber, otherT.Prescriber)) return false; - if(!comparer.ListEquals(LensSpecification, otherT.LensSpecification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateWrittenElement, otherT._DateWrittenElement)) return false; + if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; + if(!comparer.ListEquals(_LensSpecification, otherT._LensSpecification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "dateWritten": - value = DateWrittenElement; - return DateWrittenElement is not null; + value = _DateWrittenElement; + return _DateWrittenElement is not null; case "prescriber": - value = Prescriber; - return Prescriber is not null; + value = _Prescriber; + return _Prescriber is not null; case "lensSpecification": - value = LensSpecification; - return LensSpecification?.Any() == true; + value = _LensSpecification; + return _LensSpecification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateWritten": - DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "prescriber": - Prescriber = (Hl7.Fhir.Model.ResourceReference)value; + Prescriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lensSpecification": - LensSpecification = (List)value; + LensSpecification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1129,14 +1075,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",DateWrittenElement); - if (Prescriber is not null) yield return new KeyValuePair("prescriber",Prescriber); - if (LensSpecification?.Any() == true) yield return new KeyValuePair("lensSpecification",LensSpecification); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",_DateWrittenElement); + if (_Prescriber is not null) yield return new KeyValuePair("prescriber",_Prescriber); + if (_LensSpecification?.Any() == true) yield return new KeyValuePair("lensSpecification",_LensSpecification); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Account.cs b/src/Hl7.Fhir.R4B/Model/Generated/Account.cs index 31e373c46..12be095e0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Account.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -125,26 +128,26 @@ public partial class CoverageComponent : Hl7.Fhir.Model.BackboneElement [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// The priority of the coverage in the context of this account. /// [FhirElement("priority", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PriorityElement + public Hl7.Fhir.Model.PositiveInt? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Hl7.Fhir.Model.PositiveInt _PriorityElement; + private Hl7.Fhir.Model.PositiveInt? _PriorityElement; /// /// The priority of the coverage in the context of this account @@ -153,29 +156,22 @@ public Hl7.Fhir.Model.PositiveInt PriorityElement [IgnoreDataMember] public int? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Hl7.Fhir.Model.PositiveInt(value); + PriorityElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Priority"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageComponent; - - if (dest == null) - { + if(other is not CoverageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)PriorityElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)_PriorityElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -187,41 +183,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageComponent; - if(otherT == null) return false; + if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - PriorityElement = (Hl7.Fhir.Model.PositiveInt)value; + PriorityElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -232,8 +228,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); } } @@ -262,26 +258,26 @@ public partial class GuarantorComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Credit or other hold applied. /// [FhirElement("onHold", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OnHoldElement + public Hl7.Fhir.Model.FhirBoolean? OnHoldElement { get { return _OnHoldElement; } set { _OnHoldElement = value; OnPropertyChanged("OnHoldElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OnHoldElement; + private Hl7.Fhir.Model.FhirBoolean? _OnHoldElement; /// /// Credit or other hold applied @@ -290,13 +286,10 @@ public Hl7.Fhir.Model.FhirBoolean OnHoldElement [IgnoreDataMember] public bool? OnHold { - get { return OnHoldElement != null ? OnHoldElement.Value : null; } + get => _OnHoldElement?.Value; set { - if (value == null) - OnHoldElement = null; - else - OnHoldElement = new Hl7.Fhir.Model.FhirBoolean(value); + OnHoldElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("OnHold"); } } @@ -306,27 +299,23 @@ public bool? OnHold /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as GuarantorComponent; - - if (dest == null) - { + if(other is not GuarantorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(OnHoldElement != null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)OnHoldElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_OnHoldElement is not null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)_OnHoldElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -338,48 +327,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuarantorComponent; - if(otherT == null) return false; + if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.Equals(OnHoldElement, otherT.OnHoldElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "onHold": - value = OnHoldElement; - return OnHoldElement is not null; + value = _OnHoldElement; + return _OnHoldElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onHold": - OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)value; + OnHoldElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -390,9 +379,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Party is not null) yield return new KeyValuePair("party",Party); - if (OnHoldElement is not null) yield return new KeyValuePair("onHold",OnHoldElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_OnHoldElement is not null) yield return new KeyValuePair("onHold",_OnHoldElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -405,11 +394,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error | on-hold | unknown. @@ -419,13 +408,13 @@ public List Identifier [Binding("AccountStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error | on-hold | unknown @@ -434,13 +423,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Account.AccountStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -451,41 +437,38 @@ public Hl7.Fhir.Model.Account.AccountStatus? Status [FhirElement("type", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("AccountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Human-readable label. /// [FhirElement("name", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -500,24 +483,24 @@ public string Name [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Transaction window. /// [FhirElement("servicePeriod", InSummary=true, Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ServicePeriod + public Hl7.Fhir.Model.Period? ServicePeriod { get { return _ServicePeriod; } set { _ServicePeriod = value; OnPropertyChanged("ServicePeriod"); } } - private Hl7.Fhir.Model.Period _ServicePeriod; + private Hl7.Fhir.Model.Period? _ServicePeriod; /// /// The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account. @@ -527,11 +510,11 @@ public Hl7.Fhir.Model.Period ServicePeriod [DataMember] public List Coverage { - get { if(_Coverage==null) _Coverage = new List(); return _Coverage; } + get => _Coverage ?? new List(); set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private List _Coverage; + private List? _Coverage; /// /// Entity managing the Account. @@ -540,41 +523,38 @@ public List Coverage [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Explanation of purpose/use. /// [FhirElement("description", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Explanation of purpose/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -587,11 +567,11 @@ public string Description [DataMember] public List Guarantor { - get { if(_Guarantor==null) _Guarantor = new List(); return _Guarantor; } + get => _Guarantor ?? new List(); set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } - private List _Guarantor; + private List? _Guarantor; /// /// Reference to a parent Account. @@ -600,37 +580,33 @@ public List Guarantor [CLSCompliant(false)] [References("Account")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Account; - - if (dest == null) - { + if(other is not Account dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(ServicePeriod != null) dest.ServicePeriod = (Hl7.Fhir.Model.Period)ServicePeriod.DeepCopyInternal(); - if(Coverage.Any()) dest.Coverage = new List(Coverage.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Guarantor.Any()) dest.Guarantor = new List(Guarantor.DeepCopyInternal()); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_ServicePeriod is not null) dest.ServicePeriod = (Hl7.Fhir.Model.Period)_ServicePeriod.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = new List(_Coverage.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Guarantor is not null) dest.Guarantor = new List(_Guarantor.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -642,104 +618,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Account; - if(otherT == null) return false; + if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(ServicePeriod, otherT.ServicePeriod)) return false; - if(!comparer.ListEquals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Guarantor, otherT.Guarantor)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_ServicePeriod, otherT._ServicePeriod)) return false; + if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Guarantor, otherT._Guarantor)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "servicePeriod": - value = ServicePeriod; - return ServicePeriod is not null; + value = _ServicePeriod; + return _ServicePeriod is not null; case "coverage": - value = Coverage; - return Coverage?.Any() == true; + value = _Coverage; + return _Coverage?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "guarantor": - value = Guarantor; - return Guarantor?.Any() == true; + value = _Guarantor; + return _Guarantor?.Any() == true; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "servicePeriod": - ServicePeriod = (Hl7.Fhir.Model.Period)value; + ServicePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "coverage": - Coverage = (List)value; + Coverage = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "guarantor": - Guarantor = (List)value; + Guarantor = (List?)value!; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -750,17 +726,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (ServicePeriod is not null) yield return new KeyValuePair("servicePeriod",ServicePeriod); - if (Coverage?.Any() == true) yield return new KeyValuePair("coverage",Coverage); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",Guarantor); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_ServicePeriod is not null) yield return new KeyValuePair("servicePeriod",_ServicePeriod); + if (_Coverage?.Any() == true) yield return new KeyValuePair("coverage",_Coverage); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",_Guarantor); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs index 5878af21c..86d177b54 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -183,13 +186,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActivityParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// patient | practitioner | related-person | device @@ -198,13 +201,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -215,26 +215,22 @@ public Hl7.Fhir.Model.ActionParticipantType? Type [FhirElement("role", Order=50)] [Binding("ActivityParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -246,41 +242,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -291,8 +287,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -320,28 +316,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("path", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -352,26 +345,22 @@ public string Path [FhirElement("expression", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -383,41 +372,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -428,8 +417,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -439,28 +428,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this activity definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -473,39 +459,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the activity definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -515,28 +498,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this activity definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -546,28 +526,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this activity definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -577,28 +554,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -611,13 +585,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -626,13 +600,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -642,13 +613,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -657,13 +628,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -677,41 +645,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -721,28 +686,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -755,39 +717,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the activity definition. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -800,11 +759,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for activity definition (if applicable). @@ -815,39 +774,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this activity definition is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this activity definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -857,28 +813,25 @@ public string Purpose /// [FhirElement("usage", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -888,28 +841,25 @@ public string Usage /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -919,28 +869,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the activity definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -950,28 +897,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the activity definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -981,13 +925,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -998,11 +942,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1012,11 +956,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1026,11 +970,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1040,11 +984,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1054,11 +998,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1068,11 +1012,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the activity definition. @@ -1082,24 +1026,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1113,13 +1057,13 @@ public IEnumerable Library [DeclaredType(Type = typeof(Code))] [Binding("ActivityDefinitionKind")] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// Kind of resource @@ -1128,13 +1072,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActivityDefinition.RequestResourceType? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1144,28 +1085,25 @@ public Hl7.Fhir.Model.ActivityDefinition.RequestResourceType? Kind /// [FhirElement("profile", Order=380)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// What profile the resource needs to conform to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -1176,13 +1114,13 @@ public string Profile [FhirElement("code", InSummary=true, Order=390)] [Binding("ActivityDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option. @@ -1191,13 +1129,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("RequestIntent")] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -1206,13 +1144,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1224,13 +1159,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -1239,13 +1174,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -1255,13 +1187,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=420)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if the activity should not be performed @@ -1270,13 +1202,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -1288,13 +1217,13 @@ public bool? DoNotPerform [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Where it should happen. @@ -1303,13 +1232,13 @@ public Hl7.Fhir.Model.DataType Timing [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Who should participate in the action. @@ -1319,11 +1248,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// What's administered/supplied. @@ -1334,26 +1263,26 @@ public List Participant [References("Medication","Substance","Ingredient")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// How much is administered/consumed/supplied. /// [FhirElement("quantity", Order=470)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Detailed dosage instructions. @@ -1363,11 +1292,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// What part of body to perform on. @@ -1378,11 +1307,11 @@ public List Dosage [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// What specimens are required to perform this action. @@ -1394,11 +1323,11 @@ public List BodySite [DataMember] public List SpecimenRequirement { - get { if(_SpecimenRequirement==null) _SpecimenRequirement = new List(); return _SpecimenRequirement; } + get => _SpecimenRequirement ?? new List(); set { _SpecimenRequirement = value; OnPropertyChanged("SpecimenRequirement"); } } - private List _SpecimenRequirement; + private List? _SpecimenRequirement; /// /// What observations are required to perform this action. @@ -1410,11 +1339,11 @@ public List SpecimenRequirement [DataMember] public List ObservationRequirement { - get { if(_ObservationRequirement==null) _ObservationRequirement = new List(); return _ObservationRequirement; } + get => _ObservationRequirement ?? new List(); set { _ObservationRequirement = value; OnPropertyChanged("ObservationRequirement"); } } - private List _ObservationRequirement; + private List? _ObservationRequirement; /// /// What observations must be produced by this action. @@ -1426,39 +1355,36 @@ public List ObservationRequirement [DataMember] public List ObservationResultRequirement { - get { if(_ObservationResultRequirement==null) _ObservationResultRequirement = new List(); return _ObservationResultRequirement; } + get => _ObservationResultRequirement ?? new List(); set { _ObservationResultRequirement = value; OnPropertyChanged("ObservationResultRequirement"); } } - private List _ObservationResultRequirement; + private List? _ObservationResultRequirement; /// /// Transform to apply the template. /// [FhirElement("transform", Order=530)] [DataMember] - public Hl7.Fhir.Model.Canonical TransformElement + public Hl7.Fhir.Model.Canonical? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Hl7.Fhir.Model.Canonical _TransformElement; + private Hl7.Fhir.Model.Canonical? _TransformElement; /// /// Transform to apply the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Transform + public string? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Hl7.Fhir.Model.Canonical(value); + TransformElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Transform"); } } @@ -1471,70 +1397,66 @@ public string Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityDefinition; - - if (dest == null) - { + if(other is not ActivityDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(SpecimenRequirement.Any()) dest.SpecimenRequirement = new List(SpecimenRequirement.DeepCopyInternal()); - if(ObservationRequirement.Any()) dest.ObservationRequirement = new List(ObservationRequirement.DeepCopyInternal()); - if(ObservationResultRequirement.Any()) dest.ObservationResultRequirement = new List(ObservationResultRequirement.DeepCopyInternal()); - if(TransformElement != null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)TransformElement.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_SpecimenRequirement is not null) dest.SpecimenRequirement = new List(_SpecimenRequirement.DeepCopyInternal()); + if(_ObservationRequirement is not null) dest.ObservationRequirement = new List(_ObservationRequirement.DeepCopyInternal()); + if(_ObservationResultRequirement is not null) dest.ObservationResultRequirement = new List(_ObservationResultRequirement.DeepCopyInternal()); + if(_TransformElement is not null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)_TransformElement.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1546,349 +1468,349 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityDefinition; - if(otherT == null) return false; + if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SpecimenRequirement, otherT.SpecimenRequirement)) return false; - if(!comparer.ListEquals(ObservationRequirement, otherT.ObservationRequirement)) return false; - if(!comparer.ListEquals(ObservationResultRequirement, otherT.ObservationResultRequirement)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SpecimenRequirement, otherT._SpecimenRequirement)) return false; + if(!comparer.ListEquals(_ObservationRequirement, otherT._ObservationRequirement)) return false; + if(!comparer.ListEquals(_ObservationResultRequirement, otherT._ObservationResultRequirement)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "specimenRequirement": - value = SpecimenRequirement; - return SpecimenRequirement?.Any() == true; + value = _SpecimenRequirement; + return _SpecimenRequirement?.Any() == true; case "observationRequirement": - value = ObservationRequirement; - return ObservationRequirement?.Any() == true; + value = _ObservationRequirement; + return _ObservationRequirement?.Any() == true; case "observationResultRequirement": - value = ObservationResultRequirement; - return ObservationResultRequirement?.Any() == true; + value = _ObservationResultRequirement; + return _ObservationResultRequirement?.Any() == true; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "specimenRequirement": - SpecimenRequirement = (List)value; + SpecimenRequirement = (List?)value!; return this; case "observationRequirement": - ObservationRequirement = (List)value; + ObservationRequirement = (List?)value!; return this; case "observationResultRequirement": - ObservationResultRequirement = (List)value; + ObservationResultRequirement = (List?)value!; return this; case "transform": - TransformElement = (Hl7.Fhir.Model.Canonical)value; + TransformElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1899,52 +1821,52 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (SpecimenRequirement?.Any() == true) yield return new KeyValuePair("specimenRequirement",SpecimenRequirement); - if (ObservationRequirement?.Any() == true) yield return new KeyValuePair("observationRequirement",ObservationRequirement); - if (ObservationResultRequirement?.Any() == true) yield return new KeyValuePair("observationResultRequirement",ObservationResultRequirement); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_SpecimenRequirement?.Any() == true) yield return new KeyValuePair("specimenRequirement",_SpecimenRequirement); + if (_ObservationRequirement?.Any() == true) yield return new KeyValuePair("observationRequirement",_ObservationRequirement); + if (_ObservationResultRequirement?.Any() == true) yield return new KeyValuePair("observationResultRequirement",_ObservationResultRequirement); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs index f122e6221..e3888ea28 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -135,13 +138,13 @@ public enum AddressType [DeclaredType(Type = typeof(Code))] [Binding("AddressUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// home | work | temp | old | billing - purpose of this address @@ -150,13 +153,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -168,13 +168,13 @@ public Hl7.Fhir.Model.Address.AddressUse? Use [DeclaredType(Type = typeof(Code))] [Binding("AddressType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// postal | physical | both @@ -183,13 +183,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -199,28 +196,25 @@ public Hl7.Fhir.Model.Address.AddressType? Type /// [FhirElement("text", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the address /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -233,24 +227,24 @@ public string Text [DataMember] public List LineElement { - get { if(_LineElement==null) _LineElement = new List(); return _LineElement; } + get => _LineElement ?? new List(); set { _LineElement = value; OnPropertyChanged("LineElement"); } } - private List _LineElement; + private List? _LineElement; /// /// Street name, number, direction & P.O. Box etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Line + public IEnumerable? Line { - get { return LineElement != null ? LineElement.Select(elem => elem.Value) : null; } + get => _LineElement?.Select(elem => elem.Value); set { if (value == null) - LineElement = null; + LineElement = null!; else LineElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Line"); @@ -262,28 +256,25 @@ public IEnumerable Line /// [FhirElement("city", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CityElement + public Hl7.Fhir.Model.FhirString? CityElement { get { return _CityElement; } set { _CityElement = value; OnPropertyChanged("CityElement"); } } - private Hl7.Fhir.Model.FhirString _CityElement; + private Hl7.Fhir.Model.FhirString? _CityElement; /// /// Name of city, town etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string City + public string? City { - get { return CityElement != null ? CityElement.Value : null; } + get => _CityElement?.Value; set { - if (value == null) - CityElement = null; - else - CityElement = new Hl7.Fhir.Model.FhirString(value); + CityElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("City"); } } @@ -293,28 +284,25 @@ public string City /// [FhirElement("district", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DistrictElement + public Hl7.Fhir.Model.FhirString? DistrictElement { get { return _DistrictElement; } set { _DistrictElement = value; OnPropertyChanged("DistrictElement"); } } - private Hl7.Fhir.Model.FhirString _DistrictElement; + private Hl7.Fhir.Model.FhirString? _DistrictElement; /// /// District name (aka county) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string District + public string? District { - get { return DistrictElement != null ? DistrictElement.Value : null; } + get => _DistrictElement?.Value; set { - if (value == null) - DistrictElement = null; - else - DistrictElement = new Hl7.Fhir.Model.FhirString(value); + DistrictElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("District"); } } @@ -324,28 +312,25 @@ public string District /// [FhirElement("state", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString StateElement + public Hl7.Fhir.Model.FhirString? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Hl7.Fhir.Model.FhirString _StateElement; + private Hl7.Fhir.Model.FhirString? _StateElement; /// /// Sub-unit of country (abbreviations ok) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string State + public string? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Hl7.Fhir.Model.FhirString(value); + StateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("State"); } } @@ -355,28 +340,25 @@ public string State /// [FhirElement("postalCode", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PostalCodeElement + public Hl7.Fhir.Model.FhirString? PostalCodeElement { get { return _PostalCodeElement; } set { _PostalCodeElement = value; OnPropertyChanged("PostalCodeElement"); } } - private Hl7.Fhir.Model.FhirString _PostalCodeElement; + private Hl7.Fhir.Model.FhirString? _PostalCodeElement; /// /// Postal code for area /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PostalCode + public string? PostalCode { - get { return PostalCodeElement != null ? PostalCodeElement.Value : null; } + get => _PostalCodeElement?.Value; set { - if (value == null) - PostalCodeElement = null; - else - PostalCodeElement = new Hl7.Fhir.Model.FhirString(value); + PostalCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PostalCode"); } } @@ -386,28 +368,25 @@ public string PostalCode /// [FhirElement("country", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CountryElement + public Hl7.Fhir.Model.FhirString? CountryElement { get { return _CountryElement; } set { _CountryElement = value; OnPropertyChanged("CountryElement"); } } - private Hl7.Fhir.Model.FhirString _CountryElement; + private Hl7.Fhir.Model.FhirString? _CountryElement; /// /// Country (e.g. can be ISO 3166 2 or 3 letter code) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Country + public string? Country { - get { return CountryElement != null ? CountryElement.Value : null; } + get => _CountryElement?.Value; set { - if (value == null) - CountryElement = null; - else - CountryElement = new Hl7.Fhir.Model.FhirString(value); + CountryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Country"); } } @@ -417,34 +396,30 @@ public string Country /// [FhirElement("period", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as Address; - - if (dest == null) - { + if(other is not Address dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LineElement.Any()) dest.LineElement = new List(LineElement.DeepCopyInternal()); - if(CityElement != null) dest.CityElement = (Hl7.Fhir.Model.FhirString)CityElement.DeepCopyInternal(); - if(DistrictElement != null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)DistrictElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Hl7.Fhir.Model.FhirString)StateElement.DeepCopyInternal(); - if(PostalCodeElement != null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)PostalCodeElement.DeepCopyInternal(); - if(CountryElement != null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)CountryElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LineElement is not null) dest.LineElement = new List(_LineElement.DeepCopyInternal()); + if(_CityElement is not null) dest.CityElement = (Hl7.Fhir.Model.FhirString)_CityElement.DeepCopyInternal(); + if(_DistrictElement is not null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)_DistrictElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Hl7.Fhir.Model.FhirString)_StateElement.DeepCopyInternal(); + if(_PostalCodeElement is not null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)_PostalCodeElement.DeepCopyInternal(); + if(_CountryElement is not null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)_CountryElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -456,97 +431,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Address; - if(otherT == null) return false; + if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LineElement, otherT.LineElement)) return false; - if(!comparer.Equals(CityElement, otherT.CityElement)) return false; - if(!comparer.Equals(DistrictElement, otherT.DistrictElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(PostalCodeElement, otherT.PostalCodeElement)) return false; - if(!comparer.Equals(CountryElement, otherT.CountryElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; + if(!comparer.Equals(_CityElement, otherT._CityElement)) return false; + if(!comparer.Equals(_DistrictElement, otherT._DistrictElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; + if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "line": - value = LineElement; - return LineElement?.Any() == true; + value = _LineElement; + return _LineElement?.Any() == true; case "city": - value = CityElement; - return CityElement is not null; + value = _CityElement; + return _CityElement is not null; case "district": - value = DistrictElement; - return DistrictElement is not null; + value = _DistrictElement; + return _DistrictElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "postalCode": - value = PostalCodeElement; - return PostalCodeElement is not null; + value = _PostalCodeElement; + return _PostalCodeElement is not null; case "country": - value = CountryElement; - return CountryElement is not null; + value = _CountryElement; + return _CountryElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "line": - LineElement = (List)value; + LineElement = (List?)value!; return this; case "city": - CityElement = (Hl7.Fhir.Model.FhirString)value; + CityElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "district": - DistrictElement = (Hl7.Fhir.Model.FhirString)value; + DistrictElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "state": - StateElement = (Hl7.Fhir.Model.FhirString)value; + StateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "postalCode": - PostalCodeElement = (Hl7.Fhir.Model.FhirString)value; + PostalCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - CountryElement = (Hl7.Fhir.Model.FhirString)value; + CountryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -557,16 +532,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LineElement?.Any() == true) yield return new KeyValuePair("line",LineElement); - if (CityElement is not null) yield return new KeyValuePair("city",CityElement); - if (DistrictElement is not null) yield return new KeyValuePair("district",DistrictElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (PostalCodeElement is not null) yield return new KeyValuePair("postalCode",PostalCodeElement); - if (CountryElement is not null) yield return new KeyValuePair("country",CountryElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LineElement?.Any() == true) yield return new KeyValuePair("line",_LineElement); + if (_CityElement is not null) yield return new KeyValuePair("city",_CityElement); + if (_DistrictElement is not null) yield return new KeyValuePair("district",_DistrictElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_PostalCodeElement is not null) yield return new KeyValuePair("postalCode",_PostalCodeElement); + if (_CountryElement is not null) yield return new KeyValuePair("country",_CountryElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs index 9b7c93d9e..1b3f97991 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -79,13 +82,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTCharacteristicCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -94,13 +97,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// The status of characteristic e.g. assigned or pending. @@ -108,27 +111,23 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("status", InSummary=true, Order=60)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -140,48 +139,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -192,9 +191,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Status is not null) yield return new KeyValuePair("status",Status); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Status is not null) yield return new KeyValuePair("status",_Status); } } @@ -222,78 +221,78 @@ public partial class RouteOfAdministrationComponent : Hl7.Fhir.Model.BackboneEle [Binding("SNOMEDCTRouteCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The first dose (dose quantity) administered can be specified for the product. /// [FhirElement("firstDose", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity FirstDose + public Hl7.Fhir.Model.Quantity? FirstDose { get { return _FirstDose; } set { _FirstDose = value; OnPropertyChanged("FirstDose"); } } - private Hl7.Fhir.Model.Quantity _FirstDose; + private Hl7.Fhir.Model.Quantity? _FirstDose; /// /// The maximum single dose that can be administered. /// [FhirElement("maxSingleDose", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxSingleDose + public Hl7.Fhir.Model.Quantity? MaxSingleDose { get { return _MaxSingleDose; } set { _MaxSingleDose = value; OnPropertyChanged("MaxSingleDose"); } } - private Hl7.Fhir.Model.Quantity _MaxSingleDose; + private Hl7.Fhir.Model.Quantity? _MaxSingleDose; /// /// The maximum dose quantity to be administered in any one 24-h period. /// [FhirElement("maxDosePerDay", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerDay + public Hl7.Fhir.Model.Quantity? MaxDosePerDay { get { return _MaxDosePerDay; } set { _MaxDosePerDay = value; OnPropertyChanged("MaxDosePerDay"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerDay; + private Hl7.Fhir.Model.Quantity? _MaxDosePerDay; /// /// The maximum dose per treatment period that can be administered. /// [FhirElement("maxDosePerTreatmentPeriod", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Ratio MaxDosePerTreatmentPeriod + public Hl7.Fhir.Model.Ratio? MaxDosePerTreatmentPeriod { get { return _MaxDosePerTreatmentPeriod; } set { _MaxDosePerTreatmentPeriod = value; OnPropertyChanged("MaxDosePerTreatmentPeriod"); } } - private Hl7.Fhir.Model.Ratio _MaxDosePerTreatmentPeriod; + private Hl7.Fhir.Model.Ratio? _MaxDosePerTreatmentPeriod; /// /// The maximum treatment period during which the product can be administered. /// [FhirElement("maxTreatmentPeriod", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration MaxTreatmentPeriod + public Hl7.Fhir.Model.Duration? MaxTreatmentPeriod { get { return _MaxTreatmentPeriod; } set { _MaxTreatmentPeriod = value; OnPropertyChanged("MaxTreatmentPeriod"); } } - private Hl7.Fhir.Model.Duration _MaxTreatmentPeriod; + private Hl7.Fhir.Model.Duration? _MaxTreatmentPeriod; /// /// A species for which this route applies. @@ -303,29 +302,25 @@ public Hl7.Fhir.Model.Duration MaxTreatmentPeriod [DataMember] public List TargetSpecies { - get { if(_TargetSpecies==null) _TargetSpecies = new List(); return _TargetSpecies; } + get => _TargetSpecies ?? new List(); set { _TargetSpecies = value; OnPropertyChanged("TargetSpecies"); } } - private List _TargetSpecies; + private List? _TargetSpecies; protected internal override void CopyToInternal(Base other) { - var dest = other as RouteOfAdministrationComponent; - - if (dest == null) - { + if(other is not RouteOfAdministrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FirstDose != null) dest.FirstDose = (Hl7.Fhir.Model.Quantity)FirstDose.DeepCopyInternal(); - if(MaxSingleDose != null) dest.MaxSingleDose = (Hl7.Fhir.Model.Quantity)MaxSingleDose.DeepCopyInternal(); - if(MaxDosePerDay != null) dest.MaxDosePerDay = (Hl7.Fhir.Model.Quantity)MaxDosePerDay.DeepCopyInternal(); - if(MaxDosePerTreatmentPeriod != null) dest.MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)MaxDosePerTreatmentPeriod.DeepCopyInternal(); - if(MaxTreatmentPeriod != null) dest.MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)MaxTreatmentPeriod.DeepCopyInternal(); - if(TargetSpecies.Any()) dest.TargetSpecies = new List(TargetSpecies.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FirstDose is not null) dest.FirstDose = (Hl7.Fhir.Model.Quantity)_FirstDose.DeepCopyInternal(); + if(_MaxSingleDose is not null) dest.MaxSingleDose = (Hl7.Fhir.Model.Quantity)_MaxSingleDose.DeepCopyInternal(); + if(_MaxDosePerDay is not null) dest.MaxDosePerDay = (Hl7.Fhir.Model.Quantity)_MaxDosePerDay.DeepCopyInternal(); + if(_MaxDosePerTreatmentPeriod is not null) dest.MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)_MaxDosePerTreatmentPeriod.DeepCopyInternal(); + if(_MaxTreatmentPeriod is not null) dest.MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)_MaxTreatmentPeriod.DeepCopyInternal(); + if(_TargetSpecies is not null) dest.TargetSpecies = new List(_TargetSpecies.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -337,76 +332,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RouteOfAdministrationComponent; - if(otherT == null) return false; + if(other is not RouteOfAdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FirstDose, otherT.FirstDose)) return false; - if(!comparer.Equals(MaxSingleDose, otherT.MaxSingleDose)) return false; - if(!comparer.Equals(MaxDosePerDay, otherT.MaxDosePerDay)) return false; - if(!comparer.Equals(MaxDosePerTreatmentPeriod, otherT.MaxDosePerTreatmentPeriod)) return false; - if(!comparer.Equals(MaxTreatmentPeriod, otherT.MaxTreatmentPeriod)) return false; - if(!comparer.ListEquals(TargetSpecies, otherT.TargetSpecies)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FirstDose, otherT._FirstDose)) return false; + if(!comparer.Equals(_MaxSingleDose, otherT._MaxSingleDose)) return false; + if(!comparer.Equals(_MaxDosePerDay, otherT._MaxDosePerDay)) return false; + if(!comparer.Equals(_MaxDosePerTreatmentPeriod, otherT._MaxDosePerTreatmentPeriod)) return false; + if(!comparer.Equals(_MaxTreatmentPeriod, otherT._MaxTreatmentPeriod)) return false; + if(!comparer.ListEquals(_TargetSpecies, otherT._TargetSpecies)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "firstDose": - value = FirstDose; - return FirstDose is not null; + value = _FirstDose; + return _FirstDose is not null; case "maxSingleDose": - value = MaxSingleDose; - return MaxSingleDose is not null; + value = _MaxSingleDose; + return _MaxSingleDose is not null; case "maxDosePerDay": - value = MaxDosePerDay; - return MaxDosePerDay is not null; + value = _MaxDosePerDay; + return _MaxDosePerDay is not null; case "maxDosePerTreatmentPeriod": - value = MaxDosePerTreatmentPeriod; - return MaxDosePerTreatmentPeriod is not null; + value = _MaxDosePerTreatmentPeriod; + return _MaxDosePerTreatmentPeriod is not null; case "maxTreatmentPeriod": - value = MaxTreatmentPeriod; - return MaxTreatmentPeriod is not null; + value = _MaxTreatmentPeriod; + return _MaxTreatmentPeriod is not null; case "targetSpecies": - value = TargetSpecies; - return TargetSpecies?.Any() == true; + value = _TargetSpecies; + return _TargetSpecies?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "firstDose": - FirstDose = (Hl7.Fhir.Model.Quantity)value; + FirstDose = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxSingleDose": - MaxSingleDose = (Hl7.Fhir.Model.Quantity)value; + MaxSingleDose = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerDay": - MaxDosePerDay = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerDay = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerTreatmentPeriod": - MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)value; + MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio?)value; return this; case "maxTreatmentPeriod": - MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)value; + MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration?)value; return this; case "targetSpecies": - TargetSpecies = (List)value; + TargetSpecies = (List?)value!; return this; default: return base.SetValue(key, value); @@ -417,13 +412,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FirstDose is not null) yield return new KeyValuePair("firstDose",FirstDose); - if (MaxSingleDose is not null) yield return new KeyValuePair("maxSingleDose",MaxSingleDose); - if (MaxDosePerDay is not null) yield return new KeyValuePair("maxDosePerDay",MaxDosePerDay); - if (MaxDosePerTreatmentPeriod is not null) yield return new KeyValuePair("maxDosePerTreatmentPeriod",MaxDosePerTreatmentPeriod); - if (MaxTreatmentPeriod is not null) yield return new KeyValuePair("maxTreatmentPeriod",MaxTreatmentPeriod); - if (TargetSpecies?.Any() == true) yield return new KeyValuePair("targetSpecies",TargetSpecies); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FirstDose is not null) yield return new KeyValuePair("firstDose",_FirstDose); + if (_MaxSingleDose is not null) yield return new KeyValuePair("maxSingleDose",_MaxSingleDose); + if (_MaxDosePerDay is not null) yield return new KeyValuePair("maxDosePerDay",_MaxDosePerDay); + if (_MaxDosePerTreatmentPeriod is not null) yield return new KeyValuePair("maxDosePerTreatmentPeriod",_MaxDosePerTreatmentPeriod); + if (_MaxTreatmentPeriod is not null) yield return new KeyValuePair("maxTreatmentPeriod",_MaxTreatmentPeriod); + if (_TargetSpecies?.Any() == true) yield return new KeyValuePair("targetSpecies",_TargetSpecies); } } @@ -448,13 +443,13 @@ public partial class TargetSpeciesComponent : Hl7.Fhir.Model.BackboneElement [Binding("TargetSpecies")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// A species specific time during which consumption of animal product is not appropriate. @@ -464,24 +459,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List WithdrawalPeriod { - get { if(_WithdrawalPeriod==null) _WithdrawalPeriod = new List(); return _WithdrawalPeriod; } + get => _WithdrawalPeriod ?? new List(); set { _WithdrawalPeriod = value; OnPropertyChanged("WithdrawalPeriod"); } } - private List _WithdrawalPeriod; + private List? _WithdrawalPeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetSpeciesComponent; - - if (dest == null) - { + if(other is not TargetSpeciesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(WithdrawalPeriod.Any()) dest.WithdrawalPeriod = new List(WithdrawalPeriod.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_WithdrawalPeriod is not null) dest.WithdrawalPeriod = new List(_WithdrawalPeriod.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -493,41 +484,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetSpeciesComponent; - if(otherT == null) return false; + if(other is not TargetSpeciesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(WithdrawalPeriod, otherT.WithdrawalPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_WithdrawalPeriod, otherT._WithdrawalPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "withdrawalPeriod": - value = WithdrawalPeriod; - return WithdrawalPeriod?.Any() == true; + value = _WithdrawalPeriod; + return _WithdrawalPeriod?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "withdrawalPeriod": - WithdrawalPeriod = (List)value; + WithdrawalPeriod = (List?)value!; return this; default: return base.SetValue(key, value); @@ -538,8 +529,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (WithdrawalPeriod?.Any() == true) yield return new KeyValuePair("withdrawalPeriod",WithdrawalPeriod); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_WithdrawalPeriod?.Any() == true) yield return new KeyValuePair("withdrawalPeriod",_WithdrawalPeriod); } } @@ -564,13 +555,13 @@ public partial class WithdrawalPeriodComponent : Hl7.Fhir.Model.BackboneElement [Binding("AnimalTissueType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Tissue + public Hl7.Fhir.Model.CodeableConcept? Tissue { get { return _Tissue; } set { _Tissue = value; OnPropertyChanged("Tissue"); } } - private Hl7.Fhir.Model.CodeableConcept _Tissue; + private Hl7.Fhir.Model.CodeableConcept? _Tissue; /// /// A value for the time. @@ -578,58 +569,51 @@ public Hl7.Fhir.Model.CodeableConcept Tissue [FhirElement("value", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// Extra information about the withdrawal period. /// [FhirElement("supportingInformation", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString SupportingInformationElement + public Hl7.Fhir.Model.FhirString? SupportingInformationElement { get { return _SupportingInformationElement; } set { _SupportingInformationElement = value; OnPropertyChanged("SupportingInformationElement"); } } - private Hl7.Fhir.Model.FhirString _SupportingInformationElement; + private Hl7.Fhir.Model.FhirString? _SupportingInformationElement; /// /// Extra information about the withdrawal period /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SupportingInformation + public string? SupportingInformation { - get { return SupportingInformationElement != null ? SupportingInformationElement.Value : null; } + get => _SupportingInformationElement?.Value; set { - if (value == null) - SupportingInformationElement = null; - else - SupportingInformationElement = new Hl7.Fhir.Model.FhirString(value); + SupportingInformationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SupportingInformation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as WithdrawalPeriodComponent; - - if (dest == null) - { + if(other is not WithdrawalPeriodComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Tissue != null) dest.Tissue = (Hl7.Fhir.Model.CodeableConcept)Tissue.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(SupportingInformationElement != null) dest.SupportingInformationElement = (Hl7.Fhir.Model.FhirString)SupportingInformationElement.DeepCopyInternal(); + if(_Tissue is not null) dest.Tissue = (Hl7.Fhir.Model.CodeableConcept)_Tissue.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_SupportingInformationElement is not null) dest.SupportingInformationElement = (Hl7.Fhir.Model.FhirString)_SupportingInformationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -641,48 +625,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as WithdrawalPeriodComponent; - if(otherT == null) return false; + if(other is not WithdrawalPeriodComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Tissue, otherT.Tissue)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(SupportingInformationElement, otherT.SupportingInformationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_SupportingInformationElement, otherT._SupportingInformationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "tissue": - value = Tissue; - return Tissue is not null; + value = _Tissue; + return _Tissue is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "supportingInformation": - value = SupportingInformationElement; - return SupportingInformationElement is not null; + value = _SupportingInformationElement; + return _SupportingInformationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "tissue": - Tissue = (Hl7.Fhir.Model.CodeableConcept)value; + Tissue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "supportingInformation": - SupportingInformationElement = (Hl7.Fhir.Model.FhirString)value; + SupportingInformationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -693,9 +677,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Tissue is not null) yield return new KeyValuePair("tissue",Tissue); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (SupportingInformationElement is not null) yield return new KeyValuePair("supportingInformation",SupportingInformationElement); + if (_Tissue is not null) yield return new KeyValuePair("tissue",_Tissue); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_SupportingInformationElement is not null) yield return new KeyValuePair("supportingInformation",_SupportingInformationElement); } } @@ -708,11 +692,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -722,13 +706,13 @@ public List Identifier [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -737,13 +721,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -758,11 +739,11 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List FormOf { - get { if(_FormOf==null) _FormOf = new List(); return _FormOf; } + get => _FormOf ?? new List(); set { _FormOf = value; OnPropertyChanged("FormOf"); } } - private List _FormOf; + private List? _FormOf; /// /// The dose form of the final product after necessary reconstitution or processing. @@ -770,13 +751,13 @@ public List FormOf [FhirElement("administrableDoseForm", InSummary=true, Order=120)] [Binding("AdministrableDoseForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdministrableDoseForm + public Hl7.Fhir.Model.CodeableConcept? AdministrableDoseForm { get { return _AdministrableDoseForm; } set { _AdministrableDoseForm = value; OnPropertyChanged("AdministrableDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _AdministrableDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _AdministrableDoseForm; /// /// The presentation type in which this item is given to a patient. e.g. for a spray - 'puff'. @@ -784,13 +765,13 @@ public Hl7.Fhir.Model.CodeableConcept AdministrableDoseForm [FhirElement("unitOfPresentation", InSummary=true, Order=130)] [Binding("UnitOfPresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation + public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation { get { return _UnitOfPresentation; } set { _UnitOfPresentation = value; OnPropertyChanged("UnitOfPresentation"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfPresentation; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfPresentation; /// /// Indicates the specific manufactured items that are part of the 'formOf' product that are used in the preparation of this specific administrable form. @@ -802,11 +783,11 @@ public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation [DataMember] public List ProducedFrom { - get { if(_ProducedFrom==null) _ProducedFrom = new List(); return _ProducedFrom; } + get => _ProducedFrom ?? new List(); set { _ProducedFrom = value; OnPropertyChanged("ProducedFrom"); } } - private List _ProducedFrom; + private List? _ProducedFrom; /// /// The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton, or using by incoming references from the Ingredient resource. @@ -817,11 +798,11 @@ public List ProducedFrom [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. @@ -830,13 +811,13 @@ public List Ingredient [CLSCompliant(false)] [References("DeviceDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Characteristics e.g. a product's onset of action. @@ -846,11 +827,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// The path by which the product is taken into or makes contact with the body. @@ -860,34 +841,30 @@ public List Pro [DataMember] public List RouteOfAdministration { - get { if(_RouteOfAdministration==null) _RouteOfAdministration = new List(); return _RouteOfAdministration; } + get => _RouteOfAdministration ?? new List(); set { _RouteOfAdministration = value; OnPropertyChanged("RouteOfAdministration"); } } - private List _RouteOfAdministration; + private List? _RouteOfAdministration; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrableProductDefinition; - - if (dest == null) - { + if(other is not AdministrableProductDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(FormOf.Any()) dest.FormOf = new List(FormOf.DeepCopyInternal()); - if(AdministrableDoseForm != null) dest.AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)AdministrableDoseForm.DeepCopyInternal(); - if(UnitOfPresentation != null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopyInternal(); - if(ProducedFrom.Any()) dest.ProducedFrom = new List(ProducedFrom.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(RouteOfAdministration.Any()) dest.RouteOfAdministration = new List(RouteOfAdministration.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_FormOf is not null) dest.FormOf = new List(_FormOf.DeepCopyInternal()); + if(_AdministrableDoseForm is not null) dest.AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)_AdministrableDoseForm.DeepCopyInternal(); + if(_UnitOfPresentation is not null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)_UnitOfPresentation.DeepCopyInternal(); + if(_ProducedFrom is not null) dest.ProducedFrom = new List(_ProducedFrom.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_RouteOfAdministration is not null) dest.RouteOfAdministration = new List(_RouteOfAdministration.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -899,97 +876,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrableProductDefinition; - if(otherT == null) return false; + if(other is not AdministrableProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(FormOf, otherT.FormOf)) return false; - if(!comparer.Equals(AdministrableDoseForm, otherT.AdministrableDoseForm)) return false; - if(!comparer.Equals(UnitOfPresentation, otherT.UnitOfPresentation)) return false; - if(!comparer.ListEquals(ProducedFrom, otherT.ProducedFrom)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(RouteOfAdministration, otherT.RouteOfAdministration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_FormOf, otherT._FormOf)) return false; + if(!comparer.Equals(_AdministrableDoseForm, otherT._AdministrableDoseForm)) return false; + if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; + if(!comparer.ListEquals(_ProducedFrom, otherT._ProducedFrom)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_RouteOfAdministration, otherT._RouteOfAdministration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "formOf": - value = FormOf; - return FormOf?.Any() == true; + value = _FormOf; + return _FormOf?.Any() == true; case "administrableDoseForm": - value = AdministrableDoseForm; - return AdministrableDoseForm is not null; + value = _AdministrableDoseForm; + return _AdministrableDoseForm is not null; case "unitOfPresentation": - value = UnitOfPresentation; - return UnitOfPresentation is not null; + value = _UnitOfPresentation; + return _UnitOfPresentation is not null; case "producedFrom": - value = ProducedFrom; - return ProducedFrom?.Any() == true; + value = _ProducedFrom; + return _ProducedFrom?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "routeOfAdministration": - value = RouteOfAdministration; - return RouteOfAdministration?.Any() == true; + value = _RouteOfAdministration; + return _RouteOfAdministration?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "formOf": - FormOf = (List)value; + FormOf = (List?)value!; return this; case "administrableDoseForm": - AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unitOfPresentation": - UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "producedFrom": - ProducedFrom = (List)value; + ProducedFrom = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "routeOfAdministration": - RouteOfAdministration = (List)value; + RouteOfAdministration = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1000,16 +977,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (FormOf?.Any() == true) yield return new KeyValuePair("formOf",FormOf); - if (AdministrableDoseForm is not null) yield return new KeyValuePair("administrableDoseForm",AdministrableDoseForm); - if (UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",UnitOfPresentation); - if (ProducedFrom?.Any() == true) yield return new KeyValuePair("producedFrom",ProducedFrom); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (RouteOfAdministration?.Any() == true) yield return new KeyValuePair("routeOfAdministration",RouteOfAdministration); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_FormOf?.Any() == true) yield return new KeyValuePair("formOf",_FormOf); + if (_AdministrableDoseForm is not null) yield return new KeyValuePair("administrableDoseForm",_AdministrableDoseForm); + if (_UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",_UnitOfPresentation); + if (_ProducedFrom?.Any() == true) yield return new KeyValuePair("producedFrom",_ProducedFrom); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_RouteOfAdministration?.Any() == true) yield return new KeyValuePair("routeOfAdministration",_RouteOfAdministration); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs index 7c866d35d..1fd0e8f83 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("AdverseEvent","http://hl7.org/fhir/StructureDefinition/AdverseEvent")] - public partial class AdverseEvent : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class AdverseEvent : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -179,13 +182,13 @@ public partial class SuspectEntityComponent : Hl7.Fhir.Model.BackboneElement [References("Immunization","Procedure","Substance","Medication","MedicationAdministration","MedicationStatement","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Instance + public Hl7.Fhir.Model.ResourceReference? Instance { get { return _Instance; } set { _Instance = value; OnPropertyChanged("Instance"); } } - private Hl7.Fhir.Model.ResourceReference _Instance; + private Hl7.Fhir.Model.ResourceReference? _Instance; /// /// Information on the possible cause of the event. @@ -195,24 +198,20 @@ public Hl7.Fhir.Model.ResourceReference Instance [DataMember] public List Causality { - get { if(_Causality==null) _Causality = new List(); return _Causality; } + get => _Causality ?? new List(); set { _Causality = value; OnPropertyChanged("Causality"); } } - private List _Causality; + private List? _Causality; protected internal override void CopyToInternal(Base other) { - var dest = other as SuspectEntityComponent; - - if (dest == null) - { + if(other is not SuspectEntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Instance != null) dest.Instance = (Hl7.Fhir.Model.ResourceReference)Instance.DeepCopyInternal(); - if(Causality.Any()) dest.Causality = new List(Causality.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = (Hl7.Fhir.Model.ResourceReference)_Instance.DeepCopyInternal(); + if(_Causality is not null) dest.Causality = new List(_Causality.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -224,41 +223,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuspectEntityComponent; - if(otherT == null) return false; + if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Causality, otherT.Causality)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Causality, otherT._Causality)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "instance": - value = Instance; - return Instance is not null; + value = _Instance; + return _Instance is not null; case "causality": - value = Causality; - return Causality?.Any() == true; + value = _Causality; + return _Causality?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "instance": - Instance = (Hl7.Fhir.Model.ResourceReference)value; + Instance = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "causality": - Causality = (List)value; + Causality = (List?)value!; return this; default: return base.SetValue(key, value); @@ -269,8 +268,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Instance is not null) yield return new KeyValuePair("instance",Instance); - if (Causality?.Any() == true) yield return new KeyValuePair("causality",Causality); + if (_Instance is not null) yield return new KeyValuePair("instance",_Instance); + if (_Causality?.Any() == true) yield return new KeyValuePair("causality",_Causality); } } @@ -294,41 +293,38 @@ public partial class CausalityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("assessment", InSummary=true, Order=40)] [Binding("AdverseEventCausalityAssessment")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Assessment + public Hl7.Fhir.Model.CodeableConcept? Assessment { get { return _Assessment; } set { _Assessment = value; OnPropertyChanged("Assessment"); } } - private Hl7.Fhir.Model.CodeableConcept _Assessment; + private Hl7.Fhir.Model.CodeableConcept? _Assessment; /// /// AdverseEvent.suspectEntity.causalityProductRelatedness. /// [FhirElement("productRelatedness", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductRelatednessElement + public Hl7.Fhir.Model.FhirString? ProductRelatednessElement { get { return _ProductRelatednessElement; } set { _ProductRelatednessElement = value; OnPropertyChanged("ProductRelatednessElement"); } } - private Hl7.Fhir.Model.FhirString _ProductRelatednessElement; + private Hl7.Fhir.Model.FhirString? _ProductRelatednessElement; /// /// AdverseEvent.suspectEntity.causalityProductRelatedness /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductRelatedness + public string? ProductRelatedness { - get { return ProductRelatednessElement != null ? ProductRelatednessElement.Value : null; } + get => _ProductRelatednessElement?.Value; set { - if (value == null) - ProductRelatednessElement = null; - else - ProductRelatednessElement = new Hl7.Fhir.Model.FhirString(value); + ProductRelatednessElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductRelatedness"); } } @@ -340,13 +336,13 @@ public string ProductRelatedness [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// ProbabilityScale | Bayesian | Checklist. @@ -354,28 +350,24 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("method", InSummary=true, Order=70)] [Binding("AdverseEventCausalityMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; protected internal override void CopyToInternal(Base other) { - var dest = other as CausalityComponent; - - if (dest == null) - { + if(other is not CausalityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Assessment != null) dest.Assessment = (Hl7.Fhir.Model.CodeableConcept)Assessment.DeepCopyInternal(); - if(ProductRelatednessElement != null) dest.ProductRelatednessElement = (Hl7.Fhir.Model.FhirString)ProductRelatednessElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); + if(_Assessment is not null) dest.Assessment = (Hl7.Fhir.Model.CodeableConcept)_Assessment.DeepCopyInternal(); + if(_ProductRelatednessElement is not null) dest.ProductRelatednessElement = (Hl7.Fhir.Model.FhirString)_ProductRelatednessElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -387,55 +379,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CausalityComponent; - if(otherT == null) return false; + if(other is not CausalityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Assessment, otherT.Assessment)) return false; - if(!comparer.Equals(ProductRelatednessElement, otherT.ProductRelatednessElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Assessment, otherT._Assessment)) return false; + if(!comparer.Equals(_ProductRelatednessElement, otherT._ProductRelatednessElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "assessment": - value = Assessment; - return Assessment is not null; + value = _Assessment; + return _Assessment is not null; case "productRelatedness": - value = ProductRelatednessElement; - return ProductRelatednessElement is not null; + value = _ProductRelatednessElement; + return _ProductRelatednessElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "assessment": - Assessment = (Hl7.Fhir.Model.CodeableConcept)value; + Assessment = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productRelatedness": - ProductRelatednessElement = (Hl7.Fhir.Model.FhirString)value; + ProductRelatednessElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -446,10 +438,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Assessment is not null) yield return new KeyValuePair("assessment",Assessment); - if (ProductRelatednessElement is not null) yield return new KeyValuePair("productRelatedness",ProductRelatednessElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Method is not null) yield return new KeyValuePair("method",Method); + if (_Assessment is not null) yield return new KeyValuePair("assessment",_Assessment); + if (_ProductRelatednessElement is not null) yield return new KeyValuePair("productRelatedness",_ProductRelatednessElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Method is not null) yield return new KeyValuePair("method",_Method); } } @@ -459,13 +451,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// actual | potential. @@ -475,13 +467,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("AdverseEventActuality")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ActualityElement + public Code? ActualityElement { get { return _ActualityElement; } set { _ActualityElement = value; OnPropertyChanged("ActualityElement"); } } - private Code _ActualityElement; + private Code? _ActualityElement; /// /// actual | potential @@ -490,13 +482,10 @@ public Code ActualityElement [IgnoreDataMember] public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality { - get { return ActualityElement != null ? ActualityElement.Value : null; } + get => _ActualityElement?.Value; set { - if (value == null) - ActualityElement = null; - else - ActualityElement = new Code(value); + ActualityElement = value is null ? null : new Code(value); OnPropertyChanged("Actuality"); } } @@ -510,11 +499,11 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of the event itself in relation to the subject. @@ -522,13 +511,13 @@ public List Category [FhirElement("event", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("AdverseEventType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Event + public Hl7.Fhir.Model.CodeableConcept? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.CodeableConcept _Event; + private Hl7.Fhir.Model.CodeableConcept? _Event; /// /// Subject impacted by event. @@ -538,13 +527,13 @@ public Hl7.Fhir.Model.CodeableConcept Event [References("Patient","Group","Practitioner","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -553,41 +542,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the event occurred. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the event occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -597,28 +583,25 @@ public string Date /// [FhirElement("detected", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DetectedElement + public Hl7.Fhir.Model.FhirDateTime? DetectedElement { get { return _DetectedElement; } set { _DetectedElement = value; OnPropertyChanged("DetectedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DetectedElement; + private Hl7.Fhir.Model.FhirDateTime? _DetectedElement; /// /// When the event was detected /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detected + public string? Detected { - get { return DetectedElement != null ? DetectedElement.Value : null; } + get => _DetectedElement?.Value; set { - if (value == null) - DetectedElement = null; - else - DetectedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DetectedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Detected"); } } @@ -628,28 +611,25 @@ public string Detected /// [FhirElement("recordedDate", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// When the event was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -664,11 +644,11 @@ public string RecordedDate [DataMember] public List ResultingCondition { - get { if(_ResultingCondition==null) _ResultingCondition = new List(); return _ResultingCondition; } + get => _ResultingCondition ?? new List(); set { _ResultingCondition = value; OnPropertyChanged("ResultingCondition"); } } - private List _ResultingCondition; + private List? _ResultingCondition; /// /// Location where adverse event occurred. @@ -677,13 +657,13 @@ public List ResultingCondition [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Seriousness of the event. @@ -691,13 +671,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("seriousness", InSummary=true, Order=200)] [Binding("AdverseEventSeriousness")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Seriousness + public Hl7.Fhir.Model.CodeableConcept? Seriousness { get { return _Seriousness; } set { _Seriousness = value; OnPropertyChanged("Seriousness"); } } - private Hl7.Fhir.Model.CodeableConcept _Seriousness; + private Hl7.Fhir.Model.CodeableConcept? _Seriousness; /// /// mild | moderate | severe. @@ -705,13 +685,13 @@ public Hl7.Fhir.Model.CodeableConcept Seriousness [FhirElement("severity", InSummary=true, Order=210)] [Binding("AdverseEventSeverity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Severity + public Hl7.Fhir.Model.CodeableConcept? Severity { get { return _Severity; } set { _Severity = value; OnPropertyChanged("Severity"); } } - private Hl7.Fhir.Model.CodeableConcept _Severity; + private Hl7.Fhir.Model.CodeableConcept? _Severity; /// /// resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown. @@ -719,13 +699,13 @@ public Hl7.Fhir.Model.CodeableConcept Severity [FhirElement("outcome", InSummary=true, Order=220)] [Binding("AdverseEventOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Who recorded the adverse event. @@ -734,13 +714,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Who was involved in the adverse event or the potential adverse event. @@ -752,11 +732,11 @@ public Hl7.Fhir.Model.ResourceReference Recorder [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// The suspected agent causing the adverse event. @@ -766,11 +746,11 @@ public List Contributor [DataMember] public List SuspectEntity { - get { if(_SuspectEntity==null) _SuspectEntity = new List(); return _SuspectEntity; } + get => _SuspectEntity ?? new List(); set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } - private List _SuspectEntity; + private List? _SuspectEntity; /// /// AdverseEvent.subjectMedicalHistory. @@ -782,11 +762,11 @@ public List SuspectEntity [DataMember] public List SubjectMedicalHistory { - get { if(_SubjectMedicalHistory==null) _SubjectMedicalHistory = new List(); return _SubjectMedicalHistory; } + get => _SubjectMedicalHistory ?? new List(); set { _SubjectMedicalHistory = value; OnPropertyChanged("SubjectMedicalHistory"); } } - private List _SubjectMedicalHistory; + private List? _SubjectMedicalHistory; /// /// AdverseEvent.referenceDocument. @@ -798,11 +778,11 @@ public List SubjectMedicalHistory [DataMember] public List ReferenceDocument { - get { if(_ReferenceDocument==null) _ReferenceDocument = new List(); return _ReferenceDocument; } + get => _ReferenceDocument ?? new List(); set { _ReferenceDocument = value; OnPropertyChanged("ReferenceDocument"); } } - private List _ReferenceDocument; + private List? _ReferenceDocument; /// /// AdverseEvent.study. @@ -814,44 +794,40 @@ public List ReferenceDocument [DataMember] public List Study { - get { if(_Study==null) _Study = new List(); return _Study; } + get => _Study ?? new List(); set { _Study = value; OnPropertyChanged("Study"); } } - private List _Study; + private List? _Study; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AdverseEvent; - - if (dest == null) - { + if(other is not AdverseEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(ActualityElement != null) dest.ActualityElement = (Code)ActualityElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Event != null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)Event.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(DetectedElement != null) dest.DetectedElement = (Hl7.Fhir.Model.FhirDateTime)DetectedElement.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(ResultingCondition.Any()) dest.ResultingCondition = new List(ResultingCondition.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Seriousness != null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)Seriousness.DeepCopyInternal(); - if(Severity != null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)Severity.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(SuspectEntity.Any()) dest.SuspectEntity = new List(SuspectEntity.DeepCopyInternal()); - if(SubjectMedicalHistory.Any()) dest.SubjectMedicalHistory = new List(SubjectMedicalHistory.DeepCopyInternal()); - if(ReferenceDocument.Any()) dest.ReferenceDocument = new List(ReferenceDocument.DeepCopyInternal()); - if(Study.Any()) dest.Study = new List(Study.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_ActualityElement is not null) dest.ActualityElement = (Code)_ActualityElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)_Event.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_DetectedElement is not null) dest.DetectedElement = (Hl7.Fhir.Model.FhirDateTime)_DetectedElement.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_ResultingCondition is not null) dest.ResultingCondition = new List(_ResultingCondition.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Seriousness is not null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)_Seriousness.DeepCopyInternal(); + if(_Severity is not null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)_Severity.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_SuspectEntity is not null) dest.SuspectEntity = new List(_SuspectEntity.DeepCopyInternal()); + if(_SubjectMedicalHistory is not null) dest.SubjectMedicalHistory = new List(_SubjectMedicalHistory.DeepCopyInternal()); + if(_ReferenceDocument is not null) dest.ReferenceDocument = new List(_ReferenceDocument.DeepCopyInternal()); + if(_Study is not null) dest.Study = new List(_Study.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -863,167 +839,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdverseEvent; - if(otherT == null) return false; + if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActualityElement, otherT.ActualityElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(DetectedElement, otherT.DetectedElement)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.ListEquals(ResultingCondition, otherT.ResultingCondition)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Seriousness, otherT.Seriousness)) return false; - if(!comparer.Equals(Severity, otherT.Severity)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(SuspectEntity, otherT.SuspectEntity)) return false; - if(!comparer.ListEquals(SubjectMedicalHistory, otherT.SubjectMedicalHistory)) return false; - if(!comparer.ListEquals(ReferenceDocument, otherT.ReferenceDocument)) return false; - if(!comparer.ListEquals(Study, otherT.Study)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActualityElement, otherT._ActualityElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_DetectedElement, otherT._DetectedElement)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.ListEquals(_ResultingCondition, otherT._ResultingCondition)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Seriousness, otherT._Seriousness)) return false; + if(!comparer.Equals(_Severity, otherT._Severity)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_SuspectEntity, otherT._SuspectEntity)) return false; + if(!comparer.ListEquals(_SubjectMedicalHistory, otherT._SubjectMedicalHistory)) return false; + if(!comparer.ListEquals(_ReferenceDocument, otherT._ReferenceDocument)) return false; + if(!comparer.ListEquals(_Study, otherT._Study)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "actuality": - value = ActualityElement; - return ActualityElement is not null; + value = _ActualityElement; + return _ActualityElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "detected": - value = DetectedElement; - return DetectedElement is not null; + value = _DetectedElement; + return _DetectedElement is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "resultingCondition": - value = ResultingCondition; - return ResultingCondition?.Any() == true; + value = _ResultingCondition; + return _ResultingCondition?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "seriousness": - value = Seriousness; - return Seriousness is not null; + value = _Seriousness; + return _Seriousness is not null; case "severity": - value = Severity; - return Severity is not null; + value = _Severity; + return _Severity is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "suspectEntity": - value = SuspectEntity; - return SuspectEntity?.Any() == true; + value = _SuspectEntity; + return _SuspectEntity?.Any() == true; case "subjectMedicalHistory": - value = SubjectMedicalHistory; - return SubjectMedicalHistory?.Any() == true; + value = _SubjectMedicalHistory; + return _SubjectMedicalHistory?.Any() == true; case "referenceDocument": - value = ReferenceDocument; - return ReferenceDocument?.Any() == true; + value = _ReferenceDocument; + return _ReferenceDocument?.Any() == true; case "study": - value = Study; - return Study?.Any() == true; + value = _Study; + return _Study?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "actuality": - ActualityElement = (Code)value; + ActualityElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "event": - Event = (Hl7.Fhir.Model.CodeableConcept)value; + Event = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "detected": - DetectedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DetectedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "resultingCondition": - ResultingCondition = (List)value; + ResultingCondition = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "seriousness": - Seriousness = (Hl7.Fhir.Model.CodeableConcept)value; + Seriousness = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "severity": - Severity = (Hl7.Fhir.Model.CodeableConcept)value; + Severity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "suspectEntity": - SuspectEntity = (List)value; + SuspectEntity = (List?)value!; return this; case "subjectMedicalHistory": - SubjectMedicalHistory = (List)value; + SubjectMedicalHistory = (List?)value!; return this; case "referenceDocument": - ReferenceDocument = (List)value; + ReferenceDocument = (List?)value!; return this; case "study": - Study = (List)value; + Study = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1034,26 +1010,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (ActualityElement is not null) yield return new KeyValuePair("actuality",ActualityElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (DetectedElement is not null) yield return new KeyValuePair("detected",DetectedElement); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (ResultingCondition?.Any() == true) yield return new KeyValuePair("resultingCondition",ResultingCondition); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Seriousness is not null) yield return new KeyValuePair("seriousness",Seriousness); - if (Severity is not null) yield return new KeyValuePair("severity",Severity); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",SuspectEntity); - if (SubjectMedicalHistory?.Any() == true) yield return new KeyValuePair("subjectMedicalHistory",SubjectMedicalHistory); - if (ReferenceDocument?.Any() == true) yield return new KeyValuePair("referenceDocument",ReferenceDocument); - if (Study?.Any() == true) yield return new KeyValuePair("study",Study); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_ActualityElement is not null) yield return new KeyValuePair("actuality",_ActualityElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_DetectedElement is not null) yield return new KeyValuePair("detected",_DetectedElement); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_ResultingCondition?.Any() == true) yield return new KeyValuePair("resultingCondition",_ResultingCondition); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Seriousness is not null) yield return new KeyValuePair("seriousness",_Seriousness); + if (_Severity is not null) yield return new KeyValuePair("severity",_Severity); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",_SuspectEntity); + if (_SubjectMedicalHistory?.Any() == true) yield return new KeyValuePair("subjectMedicalHistory",_SubjectMedicalHistory); + if (_ReferenceDocument?.Any() == true) yield return new KeyValuePair("referenceDocument",_ReferenceDocument); + if (_Study?.Any() == true) yield return new KeyValuePair("study",_Study); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Age.cs b/src/Hl7.Fhir.R4B/Model/Generated/Age.cs index c69caa740..c19bd02d5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Age.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Age.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs index 812a1e2c8..2ae8572e9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -256,13 +259,13 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", Order=40)] [Binding("SubstanceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Clinical symptoms/signs associated with the Event. @@ -273,39 +276,36 @@ public Hl7.Fhir.Model.CodeableConcept Substance [DataMember] public List Manifestation { - get { if(_Manifestation==null) _Manifestation = new List(); return _Manifestation; } + get => _Manifestation ?? new List(); set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } - private List _Manifestation; + private List? _Manifestation; /// /// Description of the event as a whole. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the event as a whole /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -315,28 +315,25 @@ public string Description /// [FhirElement("onset", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OnsetElement + public Hl7.Fhir.Model.FhirDateTime? OnsetElement { get { return _OnsetElement; } set { _OnsetElement = value; OnPropertyChanged("OnsetElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OnsetElement; + private Hl7.Fhir.Model.FhirDateTime? _OnsetElement; /// /// Date(/time) when manifestations showed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Onset + public string? Onset { - get { return OnsetElement != null ? OnsetElement.Value : null; } + get => _OnsetElement?.Value; set { - if (value == null) - OnsetElement = null; - else - OnsetElement = new Hl7.Fhir.Model.FhirDateTime(value); + OnsetElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Onset"); } } @@ -348,13 +345,13 @@ public string Onset [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// mild | moderate | severe (of event as a whole) @@ -363,13 +360,10 @@ public Code Severi [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -380,13 +374,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity [FhirElement("exposureRoute", Order=90)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ExposureRoute + public Hl7.Fhir.Model.CodeableConcept? ExposureRoute { get { return _ExposureRoute; } set { _ExposureRoute = value; OnPropertyChanged("ExposureRoute"); } } - private Hl7.Fhir.Model.CodeableConcept _ExposureRoute; + private Hl7.Fhir.Model.CodeableConcept? _ExposureRoute; /// /// Text about event not captured in other fields. @@ -396,29 +390,25 @@ public Hl7.Fhir.Model.CodeableConcept ExposureRoute [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(Manifestation.Any()) dest.Manifestation = new List(Manifestation.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OnsetElement != null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)OnsetElement.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(ExposureRoute != null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)ExposureRoute.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_Manifestation is not null) dest.Manifestation = new List(_Manifestation.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OnsetElement is not null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)_OnsetElement.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_ExposureRoute is not null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)_ExposureRoute.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -430,76 +420,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.ListEquals(Manifestation, otherT.Manifestation)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(OnsetElement, otherT.OnsetElement)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(ExposureRoute, otherT.ExposureRoute)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "manifestation": - value = Manifestation; - return Manifestation?.Any() == true; + value = _Manifestation; + return _Manifestation?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "onset": - value = OnsetElement; - return OnsetElement is not null; + value = _OnsetElement; + return _OnsetElement is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "exposureRoute": - value = ExposureRoute; - return ExposureRoute is not null; + value = _ExposureRoute; + return _ExposureRoute is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manifestation": - Manifestation = (List)value; + Manifestation = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "onset": - OnsetElement = (Hl7.Fhir.Model.FhirDateTime)value; + OnsetElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "exposureRoute": - ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)value; + ExposureRoute = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -510,13 +500,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",Manifestation); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OnsetElement is not null) yield return new KeyValuePair("onset",OnsetElement); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",ExposureRoute); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",_Manifestation); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OnsetElement is not null) yield return new KeyValuePair("onset",_OnsetElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",_ExposureRoute); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -529,11 +519,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | resolved. @@ -541,13 +531,13 @@ public List Identifier [FhirElement("clinicalStatus", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [Binding("AllergyIntoleranceClinicalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ClinicalStatus + public Hl7.Fhir.Model.CodeableConcept? ClinicalStatus { get { return _ClinicalStatus; } set { _ClinicalStatus = value; OnPropertyChanged("ClinicalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ClinicalStatus; + private Hl7.Fhir.Model.CodeableConcept? _ClinicalStatus; /// /// unconfirmed | confirmed | refuted | entered-in-error. @@ -555,13 +545,13 @@ public Hl7.Fhir.Model.CodeableConcept ClinicalStatus [FhirElement("verificationStatus", InSummary=true, IsModifier=true, Order=110, FiveWs="FiveWs.status")] [Binding("AllergyIntoleranceVerificationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VerificationStatus + public Hl7.Fhir.Model.CodeableConcept? VerificationStatus { get { return _VerificationStatus; } set { _VerificationStatus = value; OnPropertyChanged("VerificationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _VerificationStatus; + private Hl7.Fhir.Model.CodeableConcept? _VerificationStatus; /// /// allergy | intolerance - Underlying mechanism (if known). @@ -570,13 +560,13 @@ public Hl7.Fhir.Model.CodeableConcept VerificationStatus [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// allergy | intolerance - Underlying mechanism (if known) @@ -585,13 +575,10 @@ public Code TypeElemen [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -606,24 +593,24 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type [DataMember] public List> CategoryElement { - get { if(_CategoryElement==null) _CategoryElement = new List>(); return _CategoryElement; } + get => _CategoryElement ?? new List>(); set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private List> _CategoryElement; + private List>? _CategoryElement; /// /// food | medication | environment | biologic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Category + public IEnumerable? Category { - get { return CategoryElement != null ? CategoryElement.Select(elem => elem.Value) : null; } + get => _CategoryElement?.Select(elem => elem.Value); set { if (value == null) - CategoryElement = null; + CategoryElement = null!; else CategoryElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Category"); @@ -637,13 +624,13 @@ public IEnumerable CriticalityElement + public Code? CriticalityElement { get { return _CriticalityElement; } set { _CriticalityElement = value; OnPropertyChanged("CriticalityElement"); } } - private Code _CriticalityElement; + private Code? _CriticalityElement; /// /// low | high | unable-to-assess @@ -652,13 +639,10 @@ public Code Cri [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Criticality { - get { return CriticalityElement != null ? CriticalityElement.Value : null; } + get => _CriticalityElement?.Value; set { - if (value == null) - CriticalityElement = null; - else - CriticalityElement = new Code(value); + CriticalityElement = value is null ? null : new Code(value); OnPropertyChanged("Criticality"); } } @@ -669,13 +653,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Critical [FhirElement("code", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [Binding("AllergyIntoleranceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the sensitivity is for. @@ -685,13 +669,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter when the allergy or intolerance was asserted. @@ -700,13 +684,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When allergy or intolerance was identified. @@ -715,41 +699,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Date first version of the resource instance was recorded. /// [FhirElement("recordedDate", Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// Date first version of the resource instance was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -761,13 +742,13 @@ public string RecordedDate [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Source of the information about the allergy. @@ -776,41 +757,38 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// Date(/time) of last known occurrence of a reaction. /// [FhirElement("lastOccurrence", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastOccurrenceElement + public Hl7.Fhir.Model.FhirDateTime? LastOccurrenceElement { get { return _LastOccurrenceElement; } set { _LastOccurrenceElement = value; OnPropertyChanged("LastOccurrenceElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastOccurrenceElement; + private Hl7.Fhir.Model.FhirDateTime? _LastOccurrenceElement; /// /// Date(/time) of last known occurrence of a reaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastOccurrence + public string? LastOccurrence { - get { return LastOccurrenceElement != null ? LastOccurrenceElement.Value : null; } + get => _LastOccurrenceElement?.Value; set { - if (value == null) - LastOccurrenceElement = null; - else - LastOccurrenceElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastOccurrenceElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastOccurrence"); } } @@ -823,11 +801,11 @@ public string LastOccurrence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Adverse Reaction Events linked to exposure to substance. @@ -837,40 +815,36 @@ public List Note [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AllergyIntolerance; - - if (dest == null) - { + if(other is not AllergyIntolerance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatus != null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)ClinicalStatus.DeepCopyInternal(); - if(VerificationStatus != null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)VerificationStatus.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(CategoryElement.Any()) dest.CategoryElement = new List>(CategoryElement.DeepCopyInternal()); - if(CriticalityElement != null) dest.CriticalityElement = (Code)CriticalityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(LastOccurrenceElement != null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)LastOccurrenceElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatus is not null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)_ClinicalStatus.DeepCopyInternal(); + if(_VerificationStatus is not null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)_VerificationStatus.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = new List>(_CategoryElement.DeepCopyInternal()); + if(_CriticalityElement is not null) dest.CriticalityElement = (Code)_CriticalityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_LastOccurrenceElement is not null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)_LastOccurrenceElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -882,139 +856,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllergyIntolerance; - if(otherT == null) return false; + if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatus, otherT.ClinicalStatus)) return false; - if(!comparer.Equals(VerificationStatus, otherT.VerificationStatus)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(CriticalityElement, otherT.CriticalityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.Equals(LastOccurrenceElement, otherT.LastOccurrenceElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; + if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_CriticalityElement, otherT._CriticalityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatus; - return ClinicalStatus is not null; + value = _ClinicalStatus; + return _ClinicalStatus is not null; case "verificationStatus": - value = VerificationStatus; - return VerificationStatus is not null; + value = _VerificationStatus; + return _VerificationStatus is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "category": - value = CategoryElement; - return CategoryElement?.Any() == true; + value = _CategoryElement; + return _CategoryElement?.Any() == true; case "criticality": - value = CriticalityElement; - return CriticalityElement is not null; + value = _CriticalityElement; + return _CriticalityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "lastOccurrence": - value = LastOccurrenceElement; - return LastOccurrenceElement is not null; + value = _LastOccurrenceElement; + return _LastOccurrenceElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verificationStatus": - VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + VerificationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "category": - CategoryElement = (List>)value; + CategoryElement = (List>?)value!; return this; case "criticality": - CriticalityElement = (Code)value; + CriticalityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lastOccurrence": - LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1025,22 +999,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatus); - if (VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",VerificationStatus); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (CategoryElement?.Any() == true) yield return new KeyValuePair("category",CategoryElement); - if (CriticalityElement is not null) yield return new KeyValuePair("criticality",CriticalityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",LastOccurrenceElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatus); + if (_VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatus); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_CategoryElement?.Any() == true) yield return new KeyValuePair("category",_CategoryElement); + if (_CriticalityElement is not null) yield return new KeyValuePair("criticality",_CriticalityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",_LastOccurrenceElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs index daad2fc9d..2c4e403d7 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -68,41 +71,38 @@ public partial class Annotation : Hl7.Fhir.Model.DataType [References("Practitioner","Patient","RelatedPerson","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Author + public Hl7.Fhir.Model.DataType? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.DataType _Author; + private Hl7.Fhir.Model.DataType? _Author; /// /// When the annotation was made. /// [FhirElement("time", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the annotation was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -113,45 +113,38 @@ public string Time [FhirElement("text", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// The annotation - text content (as markdown) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Annotation; - - if (dest == null) - { + if(other is not Annotation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Author != null) dest.Author = (Hl7.Fhir.Model.DataType)Author.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.DataType)_Author.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -163,48 +156,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Annotation; - if(otherT == null) return false; + if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "author": - Author = (Hl7.Fhir.Model.DataType)value; + Author = (Hl7.Fhir.Model.DataType?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -215,9 +208,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Author is not null) yield return new KeyValuePair("author",Author); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs index c3bf1c2d3..ce1e1feff 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -179,11 +182,11 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Person, Location/HealthcareService or Device. @@ -192,13 +195,13 @@ public List Type [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// required | optional | information-only. @@ -207,13 +210,13 @@ public Hl7.Fhir.Model.ResourceReference Actor [DeclaredType(Type = typeof(Code))] [Binding("ParticipantRequired")] [DataMember] - public Code RequiredElement + public Code? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Code _RequiredElement; + private Code? _RequiredElement; /// /// required | optional | information-only @@ -222,13 +225,10 @@ public Code RequiredElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.ParticipantRequired? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Code(value); + RequiredElement = value is null ? null : new Code(value); OnPropertyChanged("Required"); } } @@ -241,13 +241,13 @@ public Hl7.Fhir.Model.Appointment.ParticipantRequired? Required [Binding("ParticipationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// accepted | declined | tentative | needs-action @@ -256,13 +256,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ParticipationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -272,29 +269,25 @@ public Hl7.Fhir.Model.ParticipationStatus? Status /// [FhirElement("period", Order=80)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(RequiredElement != null) dest.RequiredElement = (Code)RequiredElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Code)_RequiredElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -306,62 +299,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "required": - RequiredElement = (Code)value; + RequiredElement = (Code?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -372,11 +365,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -389,11 +382,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist. @@ -403,13 +396,13 @@ public List Identifier [Binding("AppointmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist @@ -418,13 +411,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -435,13 +425,13 @@ public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status [FhirElement("cancelationReason", InSummary=true, Order=110)] [Binding("cancelation-reason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CancelationReason + public Hl7.Fhir.Model.CodeableConcept? CancelationReason { get { return _CancelationReason; } set { _CancelationReason = value; OnPropertyChanged("CancelationReason"); } } - private Hl7.Fhir.Model.CodeableConcept _CancelationReason; + private Hl7.Fhir.Model.CodeableConcept? _CancelationReason; /// /// A broad categorization of the service that is to be performed during this appointment. @@ -452,11 +442,11 @@ public Hl7.Fhir.Model.CodeableConcept CancelationReason [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// The specific service that is to be performed during this appointment. @@ -467,11 +457,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -482,11 +472,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that has been booked in the slot (not service type). @@ -494,13 +484,13 @@ public List Specialty [FhirElement("appointmentType", InSummary=true, Order=150)] [Binding("appointment-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AppointmentType + public Hl7.Fhir.Model.CodeableConcept? AppointmentType { get { return _AppointmentType; } set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private Hl7.Fhir.Model.CodeableConcept _AppointmentType; + private Hl7.Fhir.Model.CodeableConcept? _AppointmentType; /// /// Coded reason this appointment is scheduled. @@ -511,11 +501,11 @@ public Hl7.Fhir.Model.CodeableConcept AppointmentType [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Reason the appointment is to take place (resource). @@ -527,24 +517,24 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Used to make informed decisions if needing to re-prioritize. /// [FhirElement("priority", Order=180, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.UnsignedInt PriorityElement + public Hl7.Fhir.Model.UnsignedInt? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Hl7.Fhir.Model.UnsignedInt _PriorityElement; + private Hl7.Fhir.Model.UnsignedInt? _PriorityElement; /// /// Used to make informed decisions if needing to re-prioritize @@ -553,13 +543,10 @@ public Hl7.Fhir.Model.UnsignedInt PriorityElement [IgnoreDataMember] public int? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Hl7.Fhir.Model.UnsignedInt(value); + PriorityElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Priority"); } } @@ -569,28 +556,25 @@ public int? Priority /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Shown on a subject line in a meeting request, or appointment list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -605,24 +589,24 @@ public string Description [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// When appointment is to take place. /// [FhirElement("start", InSummary=true, Order=210, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// When appointment is to take place @@ -631,13 +615,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -647,13 +628,13 @@ public DateTimeOffset? Start /// [FhirElement("end", InSummary=true, Order=220, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When appointment is to conclude @@ -662,13 +643,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -678,13 +656,13 @@ public DateTimeOffset? End /// [FhirElement("minutesDuration", Order=230)] [DataMember] - public Hl7.Fhir.Model.PositiveInt MinutesDurationElement + public Hl7.Fhir.Model.PositiveInt? MinutesDurationElement { get { return _MinutesDurationElement; } set { _MinutesDurationElement = value; OnPropertyChanged("MinutesDurationElement"); } } - private Hl7.Fhir.Model.PositiveInt _MinutesDurationElement; + private Hl7.Fhir.Model.PositiveInt? _MinutesDurationElement; /// /// Can be less than start/end (e.g. estimate) @@ -693,13 +671,10 @@ public Hl7.Fhir.Model.PositiveInt MinutesDurationElement [IgnoreDataMember] public int? MinutesDuration { - get { return MinutesDurationElement != null ? MinutesDurationElement.Value : null; } + get => _MinutesDurationElement?.Value; set { - if (value == null) - MinutesDurationElement = null; - else - MinutesDurationElement = new Hl7.Fhir.Model.PositiveInt(value); + MinutesDurationElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("MinutesDuration"); } } @@ -714,39 +689,36 @@ public int? MinutesDuration [DataMember] public List Slot { - get { if(_Slot==null) _Slot = new List(); return _Slot; } + get => _Slot ?? new List(); set { _Slot = value; OnPropertyChanged("Slot"); } } - private List _Slot; + private List? _Slot; /// /// The date that this appointment was initially created. /// [FhirElement("created", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// The date that this appointment was initially created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -756,28 +728,25 @@ public string Created /// [FhirElement("comment", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -787,28 +756,25 @@ public string Comment /// [FhirElement("patientInstruction", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Detailed information and instructions for the patient /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -823,11 +789,11 @@ public string PatientInstruction [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Participants involved in appointment. @@ -837,11 +803,11 @@ public List BasedOn [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Potential date/time interval(s) requested to allocate the appointment within. @@ -851,46 +817,42 @@ public List Participant [DataMember] public List RequestedPeriod { - get { if(_RequestedPeriod==null) _RequestedPeriod = new List(); return _RequestedPeriod; } + get => _RequestedPeriod ?? new List(); set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } - private List _RequestedPeriod; + private List? _RequestedPeriod; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Appointment; - - if (dest == null) - { + if(other is not Appointment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CancelationReason != null) dest.CancelationReason = (Hl7.Fhir.Model.CodeableConcept)CancelationReason.DeepCopyInternal(); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType != null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)AppointmentType.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Hl7.Fhir.Model.UnsignedInt)PriorityElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(MinutesDurationElement != null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)MinutesDurationElement.DeepCopyInternal(); - if(Slot.Any()) dest.Slot = new List(Slot.DeepCopyInternal()); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(RequestedPeriod.Any()) dest.RequestedPeriod = new List(RequestedPeriod.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CancelationReason is not null) dest.CancelationReason = (Hl7.Fhir.Model.CodeableConcept)_CancelationReason.DeepCopyInternal(); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)_AppointmentType.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Hl7.Fhir.Model.UnsignedInt)_PriorityElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_MinutesDurationElement is not null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)_MinutesDurationElement.DeepCopyInternal(); + if(_Slot is not null) dest.Slot = new List(_Slot.DeepCopyInternal()); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_RequestedPeriod is not null) dest.RequestedPeriod = new List(_RequestedPeriod.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -902,181 +864,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Appointment; - if(otherT == null) return false; + if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CancelationReason, otherT.CancelationReason)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(MinutesDurationElement, otherT.MinutesDurationElement)) return false; - if(!comparer.ListEquals(Slot, otherT.Slot)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(RequestedPeriod, otherT.RequestedPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CancelationReason, otherT._CancelationReason)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_MinutesDurationElement, otherT._MinutesDurationElement)) return false; + if(!comparer.ListEquals(_Slot, otherT._Slot)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_RequestedPeriod, otherT._RequestedPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "cancelationReason": - value = CancelationReason; - return CancelationReason is not null; + value = _CancelationReason; + return _CancelationReason is not null; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType is not null; + value = _AppointmentType; + return _AppointmentType is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "minutesDuration": - value = MinutesDurationElement; - return MinutesDurationElement is not null; + value = _MinutesDurationElement; + return _MinutesDurationElement is not null; case "slot": - value = Slot; - return Slot?.Any() == true; + value = _Slot; + return _Slot?.Any() == true; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "requestedPeriod": - value = RequestedPeriod; - return RequestedPeriod?.Any() == true; + value = _RequestedPeriod; + return _RequestedPeriod?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "cancelationReason": - CancelationReason = (Hl7.Fhir.Model.CodeableConcept)value; + CancelationReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (Hl7.Fhir.Model.CodeableConcept)value; + AppointmentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "priority": - PriorityElement = (Hl7.Fhir.Model.UnsignedInt)value; + PriorityElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "minutesDuration": - MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)value; + MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "slot": - Slot = (List)value; + Slot = (List?)value!; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "requestedPeriod": - RequestedPeriod = (List)value; + RequestedPeriod = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1087,28 +1049,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CancelationReason is not null) yield return new KeyValuePair("cancelationReason",CancelationReason); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType is not null) yield return new KeyValuePair("appointmentType",AppointmentType); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",MinutesDurationElement); - if (Slot?.Any() == true) yield return new KeyValuePair("slot",Slot); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",RequestedPeriod); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CancelationReason is not null) yield return new KeyValuePair("cancelationReason",_CancelationReason); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType is not null) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",_MinutesDurationElement); + if (_Slot?.Any() == true) yield return new KeyValuePair("slot",_Slot); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",_RequestedPeriod); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs index d94c48c90..32e48ef36 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,11 +67,11 @@ public partial class AppointmentResponse : Hl7.Fhir.Model.DomainResource, IIdent [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Appointment this response relates to. @@ -78,26 +81,26 @@ public List Identifier [References("Appointment")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Appointment + public Hl7.Fhir.Model.ResourceReference? Appointment { get { return _Appointment; } set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private Hl7.Fhir.Model.ResourceReference _Appointment; + private Hl7.Fhir.Model.ResourceReference? _Appointment; /// /// Time from appointment, or requested new start time. /// [FhirElement("start", Order=110, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Time from appointment, or requested new start time @@ -106,13 +109,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -122,13 +122,13 @@ public DateTimeOffset? Start /// [FhirElement("end", Order=120, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Time from appointment, or requested new end time @@ -137,13 +137,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -157,11 +154,11 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get { if(_ParticipantType==null) _ParticipantType = new List(); return _ParticipantType; } + get => _ParticipantType ?? new List(); set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } - private List _ParticipantType; + private List? _ParticipantType; /// /// Person, Location, HealthcareService, or Device. @@ -170,13 +167,13 @@ public List ParticipantType [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// accepted | declined | tentative | needs-action. @@ -186,13 +183,13 @@ public Hl7.Fhir.Model.ResourceReference Actor [Binding("ParticipantStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ParticipantStatusElement + public Code? ParticipantStatusElement { get { return _ParticipantStatusElement; } set { _ParticipantStatusElement = value; OnPropertyChanged("ParticipantStatusElement"); } } - private Code _ParticipantStatusElement; + private Code? _ParticipantStatusElement; /// /// accepted | declined | tentative | needs-action @@ -201,13 +198,10 @@ public Code ParticipantStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ParticipationStatus? ParticipantStatus { - get { return ParticipantStatusElement != null ? ParticipantStatusElement.Value : null; } + get => _ParticipantStatusElement?.Value; set { - if (value == null) - ParticipantStatusElement = null; - else - ParticipantStatusElement = new Code(value); + ParticipantStatusElement = value is null ? null : new Code(value); OnPropertyChanged("ParticipantStatus"); } } @@ -217,28 +211,25 @@ public Hl7.Fhir.Model.ParticipationStatus? ParticipantStatus /// [FhirElement("comment", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -247,22 +238,18 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as AppointmentResponse; - - if (dest == null) - { + if(other is not AppointmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Appointment != null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)Appointment.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ParticipantType.Any()) dest.ParticipantType = new List(ParticipantType.DeepCopyInternal()); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(ParticipantStatusElement != null) dest.ParticipantStatusElement = (Code)ParticipantStatusElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)_Appointment.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ParticipantType is not null) dest.ParticipantType = new List(_ParticipantType.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_ParticipantStatusElement is not null) dest.ParticipantStatusElement = (Code)_ParticipantStatusElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -274,83 +261,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AppointmentResponse; - if(otherT == null) return false; + if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Appointment, otherT.Appointment)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.ListEquals(ParticipantType, otherT.ParticipantType)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(ParticipantStatusElement, otherT.ParticipantStatusElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.ListEquals(_ParticipantType, otherT._ParticipantType)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_ParticipantStatusElement, otherT._ParticipantStatusElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "appointment": - value = Appointment; - return Appointment is not null; + value = _Appointment; + return _Appointment is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "participantType": - value = ParticipantType; - return ParticipantType?.Any() == true; + value = _ParticipantType; + return _ParticipantType?.Any() == true; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "participantStatus": - value = ParticipantStatusElement; - return ParticipantStatusElement is not null; + value = _ParticipantStatusElement; + return _ParticipantStatusElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "appointment": - Appointment = (Hl7.Fhir.Model.ResourceReference)value; + Appointment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "participantType": - ParticipantType = (List)value; + ParticipantType = (List?)value!; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participantStatus": - ParticipantStatusElement = (Code)value; + ParticipantStatusElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -361,14 +348,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Appointment is not null) yield return new KeyValuePair("appointment",Appointment); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",ParticipantType); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",ParticipantStatusElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Appointment is not null) yield return new KeyValuePair("appointment",_Appointment); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",_ParticipantType); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",_ParticipantStatusElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs index 7aa82bf5f..5d79d5beb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -198,13 +201,13 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40, FiveWs="FiveWs.who")] [Binding("AuditAgentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Agent role in the event. @@ -215,11 +218,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Identifier of who. @@ -228,41 +231,38 @@ public List Role [CLSCompliant(false)] [References("PractitionerRole","Practitioner","Organization","Device","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Alternative User identity. /// [FhirElement("altId", Order=70, FiveWs="FiveWs.who")] [DataMember] - public Hl7.Fhir.Model.FhirString AltIdElement + public Hl7.Fhir.Model.FhirString? AltIdElement { get { return _AltIdElement; } set { _AltIdElement = value; OnPropertyChanged("AltIdElement"); } } - private Hl7.Fhir.Model.FhirString _AltIdElement; + private Hl7.Fhir.Model.FhirString? _AltIdElement; /// /// Alternative User identity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AltId + public string? AltId { - get { return AltIdElement != null ? AltIdElement.Value : null; } + get => _AltIdElement?.Value; set { - if (value == null) - AltIdElement = null; - else - AltIdElement = new Hl7.Fhir.Model.FhirString(value); + AltIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AltId"); } } @@ -272,28 +272,25 @@ public string AltId /// [FhirElement("name", Order=80, FiveWs="FiveWs.who")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human friendly name for the agent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -304,13 +301,13 @@ public string Name [FhirElement("requestor", InSummary=true, Order=90, FiveWs="FiveWs.who")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequestorElement + public Hl7.Fhir.Model.FhirBoolean? RequestorElement { get { return _RequestorElement; } set { _RequestorElement = value; OnPropertyChanged("RequestorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequestorElement; + private Hl7.Fhir.Model.FhirBoolean? _RequestorElement; /// /// Whether user is initiator @@ -319,13 +316,10 @@ public Hl7.Fhir.Model.FhirBoolean RequestorElement [IgnoreDataMember] public bool? Requestor { - get { return RequestorElement != null ? RequestorElement.Value : null; } + get => _RequestorElement?.Value; set { - if (value == null) - RequestorElement = null; - else - RequestorElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequestorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Requestor"); } } @@ -337,13 +331,13 @@ public bool? Requestor [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Policy that authorized event. @@ -353,24 +347,24 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy that authorized event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -383,26 +377,26 @@ public IEnumerable Policy [FhirElement("media", Order=120, FiveWs="FiveWs.where[x]")] [Binding("DICOMMediaType")] [DataMember] - public Hl7.Fhir.Model.Coding Media + public Hl7.Fhir.Model.Coding? Media { get { return _Media; } set { _Media = value; OnPropertyChanged("Media"); } } - private Hl7.Fhir.Model.Coding _Media; + private Hl7.Fhir.Model.Coding? _Media; /// /// Logical network location for application activity. /// [FhirElement("network", Order=130, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.AuditEvent.NetworkComponent Network + public Hl7.Fhir.Model.AuditEvent.NetworkComponent? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.AuditEvent.NetworkComponent _Network; + private Hl7.Fhir.Model.AuditEvent.NetworkComponent? _Network; /// /// Reason given for this user. @@ -413,33 +407,29 @@ public Hl7.Fhir.Model.AuditEvent.NetworkComponent Network [DataMember] public List PurposeOfUse { - get { if(_PurposeOfUse==null) _PurposeOfUse = new List(); return _PurposeOfUse; } + get => _PurposeOfUse ?? new List(); set { _PurposeOfUse = value; OnPropertyChanged("PurposeOfUse"); } } - private List _PurposeOfUse; + private List? _PurposeOfUse; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(AltIdElement != null) dest.AltIdElement = (Hl7.Fhir.Model.FhirString)AltIdElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(RequestorElement != null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)RequestorElement.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Media != null) dest.Media = (Hl7.Fhir.Model.Coding)Media.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)Network.DeepCopyInternal(); - if(PurposeOfUse.Any()) dest.PurposeOfUse = new List(PurposeOfUse.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_AltIdElement is not null) dest.AltIdElement = (Hl7.Fhir.Model.FhirString)_AltIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_RequestorElement is not null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)_RequestorElement.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Media is not null) dest.Media = (Hl7.Fhir.Model.Coding)_Media.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)_Network.DeepCopyInternal(); + if(_PurposeOfUse is not null) dest.PurposeOfUse = new List(_PurposeOfUse.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -451,104 +441,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(AltIdElement, otherT.AltIdElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(RequestorElement, otherT.RequestorElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Media, otherT.Media)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(PurposeOfUse, otherT.PurposeOfUse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_AltIdElement, otherT._AltIdElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_RequestorElement, otherT._RequestorElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Media, otherT._Media)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_PurposeOfUse, otherT._PurposeOfUse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "altId": - value = AltIdElement; - return AltIdElement is not null; + value = _AltIdElement; + return _AltIdElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "requestor": - value = RequestorElement; - return RequestorElement is not null; + value = _RequestorElement; + return _RequestorElement is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "media": - value = Media; - return Media is not null; + value = _Media; + return _Media is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "purposeOfUse": - value = PurposeOfUse; - return PurposeOfUse?.Any() == true; + value = _PurposeOfUse; + return _PurposeOfUse?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "altId": - AltIdElement = (Hl7.Fhir.Model.FhirString)value; + AltIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestor": - RequestorElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequestorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "media": - Media = (Hl7.Fhir.Model.Coding)value; + Media = (Hl7.Fhir.Model.Coding?)value; return this; case "network": - Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent)value; + Network = (Hl7.Fhir.Model.AuditEvent.NetworkComponent?)value; return this; case "purposeOfUse": - PurposeOfUse = (List)value; + PurposeOfUse = (List?)value!; return this; default: return base.SetValue(key, value); @@ -559,17 +549,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (AltIdElement is not null) yield return new KeyValuePair("altId",AltIdElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (RequestorElement is not null) yield return new KeyValuePair("requestor",RequestorElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Media is not null) yield return new KeyValuePair("media",Media); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (PurposeOfUse?.Any() == true) yield return new KeyValuePair("purposeOfUse",PurposeOfUse); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_AltIdElement is not null) yield return new KeyValuePair("altId",_AltIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_RequestorElement is not null) yield return new KeyValuePair("requestor",_RequestorElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Media is not null) yield return new KeyValuePair("media",_Media); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_PurposeOfUse?.Any() == true) yield return new KeyValuePair("purposeOfUse",_PurposeOfUse); } } @@ -595,28 +585,25 @@ public partial class NetworkComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("address", Order=40, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString AddressElement + public Hl7.Fhir.Model.FhirString? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirString _AddressElement; + private Hl7.Fhir.Model.FhirString? _AddressElement; /// /// Identifier for the network access point of the user device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirString(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Address"); } } @@ -628,13 +615,13 @@ public string Address [DeclaredType(Type = typeof(Code))] [Binding("AuditEventAgentNetworkType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// The type of network access point @@ -643,29 +630,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventAgentNetworkType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NetworkComponent; - - if (dest == null) - { + if(other is not NetworkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirString)AddressElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirString)_AddressElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -677,41 +657,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NetworkComponent; - if(otherT == null) return false; + if(other is not NetworkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "address": - AddressElement = (Hl7.Fhir.Model.FhirString)value; + AddressElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -722,8 +702,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -750,28 +730,25 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("site", Order=40, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString SiteElement + public Hl7.Fhir.Model.FhirString? SiteElement { get { return _SiteElement; } set { _SiteElement = value; OnPropertyChanged("SiteElement"); } } - private Hl7.Fhir.Model.FhirString _SiteElement; + private Hl7.Fhir.Model.FhirString? _SiteElement; /// /// Logical source location within the enterprise /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Site + public string? Site { - get { return SiteElement != null ? SiteElement.Value : null; } + get => _SiteElement?.Value; set { - if (value == null) - SiteElement = null; - else - SiteElement = new Hl7.Fhir.Model.FhirString(value); + SiteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Site"); } } @@ -784,13 +761,13 @@ public string Site [References("PractitionerRole","Practitioner","Organization","Device","Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Observer + public Hl7.Fhir.Model.ResourceReference? Observer { get { return _Observer; } set { _Observer = value; OnPropertyChanged("Observer"); } } - private Hl7.Fhir.Model.ResourceReference _Observer; + private Hl7.Fhir.Model.ResourceReference? _Observer; /// /// The type of source where event originated. @@ -801,25 +778,21 @@ public Hl7.Fhir.Model.ResourceReference Observer [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SiteElement != null) dest.SiteElement = (Hl7.Fhir.Model.FhirString)SiteElement.DeepCopyInternal(); - if(Observer != null) dest.Observer = (Hl7.Fhir.Model.ResourceReference)Observer.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); + if(_SiteElement is not null) dest.SiteElement = (Hl7.Fhir.Model.FhirString)_SiteElement.DeepCopyInternal(); + if(_Observer is not null) dest.Observer = (Hl7.Fhir.Model.ResourceReference)_Observer.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -831,48 +804,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SiteElement, otherT.SiteElement)) return false; - if(!comparer.Equals(Observer, otherT.Observer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; + if(!comparer.Equals(_Observer, otherT._Observer)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = SiteElement; - return SiteElement is not null; + value = _SiteElement; + return _SiteElement is not null; case "observer": - value = Observer; - return Observer is not null; + value = _Observer; + return _Observer is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - SiteElement = (Hl7.Fhir.Model.FhirString)value; + SiteElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "observer": - Observer = (Hl7.Fhir.Model.ResourceReference)value; + Observer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; default: return base.SetValue(key, value); @@ -883,9 +856,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SiteElement is not null) yield return new KeyValuePair("site",SiteElement); - if (Observer is not null) yield return new KeyValuePair("observer",Observer); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); + if (_SiteElement is not null) yield return new KeyValuePair("site",_SiteElement); + if (_Observer is not null) yield return new KeyValuePair("observer",_Observer); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); } } @@ -914,13 +887,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference What + public Hl7.Fhir.Model.ResourceReference? What { get { return _What; } set { _What = value; OnPropertyChanged("What"); } } - private Hl7.Fhir.Model.ResourceReference _What; + private Hl7.Fhir.Model.ResourceReference? _What; /// /// Type of entity involved. @@ -928,13 +901,13 @@ public Hl7.Fhir.Model.ResourceReference What [FhirElement("type", Order=50, FiveWs="FiveWs.what[x]")] [Binding("AuditEventEntityType")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// What role the entity played. @@ -942,13 +915,13 @@ public Hl7.Fhir.Model.Coding Type [FhirElement("role", Order=60, FiveWs="FiveWs.context")] [Binding("AuditEventEntityRole")] [DataMember] - public Hl7.Fhir.Model.Coding Role + public Hl7.Fhir.Model.Coding? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.Coding _Role; + private Hl7.Fhir.Model.Coding? _Role; /// /// Life-cycle stage for the entity. @@ -956,13 +929,13 @@ public Hl7.Fhir.Model.Coding Role [FhirElement("lifecycle", Order=70, FiveWs="FiveWs.context")] [Binding("AuditEventEntityLifecycle")] [DataMember] - public Hl7.Fhir.Model.Coding Lifecycle + public Hl7.Fhir.Model.Coding? Lifecycle { get { return _Lifecycle; } set { _Lifecycle = value; OnPropertyChanged("Lifecycle"); } } - private Hl7.Fhir.Model.Coding _Lifecycle; + private Hl7.Fhir.Model.Coding? _Lifecycle; /// /// Security labels on the entity. @@ -973,39 +946,36 @@ public Hl7.Fhir.Model.Coding Lifecycle [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Descriptor for entity. /// [FhirElement("name", InSummary=true, Order=90, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptor for entity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1015,28 +985,25 @@ public string Name /// [FhirElement("description", Order=100, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Descriptive text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1046,28 +1013,25 @@ public string Description /// [FhirElement("query", InSummary=true, Order=110, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.Base64Binary QueryElement + public Hl7.Fhir.Model.Base64Binary? QueryElement { get { return _QueryElement; } set { _QueryElement = value; OnPropertyChanged("QueryElement"); } } - private Hl7.Fhir.Model.Base64Binary _QueryElement; + private Hl7.Fhir.Model.Base64Binary? _QueryElement; /// /// Query parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Query + public byte[]? Query { - get { return QueryElement != null ? QueryElement.Value : null; } + get => _QueryElement?.Value; set { - if (value == null) - QueryElement = null; - else - QueryElement = new Hl7.Fhir.Model.Base64Binary(value); + QueryElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Query"); } } @@ -1080,31 +1044,27 @@ public byte[] Query [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(What != null) dest.What = (Hl7.Fhir.Model.ResourceReference)What.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.Coding)Role.DeepCopyInternal(); - if(Lifecycle != null) dest.Lifecycle = (Hl7.Fhir.Model.Coding)Lifecycle.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(QueryElement != null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)QueryElement.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_What is not null) dest.What = (Hl7.Fhir.Model.ResourceReference)_What.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.Coding)_Role.DeepCopyInternal(); + if(_Lifecycle is not null) dest.Lifecycle = (Hl7.Fhir.Model.Coding)_Lifecycle.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_QueryElement is not null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)_QueryElement.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1116,90 +1076,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(What, otherT.What)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Lifecycle, otherT.Lifecycle)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(QueryElement, otherT.QueryElement)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_What, otherT._What)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Lifecycle, otherT._Lifecycle)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "what": - value = What; - return What is not null; + value = _What; + return _What is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "lifecycle": - value = Lifecycle; - return Lifecycle is not null; + value = _Lifecycle; + return _Lifecycle is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "query": - value = QueryElement; - return QueryElement is not null; + value = _QueryElement; + return _QueryElement is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "what": - What = (Hl7.Fhir.Model.ResourceReference)value; + What = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "role": - Role = (Hl7.Fhir.Model.Coding)value; + Role = (Hl7.Fhir.Model.Coding?)value; return this; case "lifecycle": - Lifecycle = (Hl7.Fhir.Model.Coding)value; + Lifecycle = (Hl7.Fhir.Model.Coding?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "query": - QueryElement = (Hl7.Fhir.Model.Base64Binary)value; + QueryElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1210,15 +1170,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (What is not null) yield return new KeyValuePair("what",What); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Lifecycle is not null) yield return new KeyValuePair("lifecycle",Lifecycle); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (QueryElement is not null) yield return new KeyValuePair("query",QueryElement); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_What is not null) yield return new KeyValuePair("what",_What); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Lifecycle is not null) yield return new KeyValuePair("lifecycle",_Lifecycle); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_QueryElement is not null) yield return new KeyValuePair("query",_QueryElement); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -1245,28 +1205,25 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40, FiveWs="FiveWs.context")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Name of the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1279,26 +1236,22 @@ public string Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Base64Binary))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1310,41 +1263,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1355,8 +1308,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1368,13 +1321,13 @@ public override IEnumerable> EnumerateElements() [Binding("AuditEventType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// More specific type/id for the event. @@ -1385,11 +1338,11 @@ public Hl7.Fhir.Model.Coding Type [DataMember] public List Subtype { - get { if(_Subtype==null) _Subtype = new List(); return _Subtype; } + get => _Subtype ?? new List(); set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private List _Subtype; + private List? _Subtype; /// /// Type of action performed during the event. @@ -1398,13 +1351,13 @@ public List Subtype [DeclaredType(Type = typeof(Code))] [Binding("AuditEventAction")] [DataMember] - public Code ActionElement + public Code? ActionElement { get { return _ActionElement; } set { _ActionElement = value; OnPropertyChanged("ActionElement"); } } - private Code _ActionElement; + private Code? _ActionElement; /// /// Type of action performed during the event @@ -1413,13 +1366,10 @@ public Code ActionElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action { - get { return ActionElement != null ? ActionElement.Value : null; } + get => _ActionElement?.Value; set { - if (value == null) - ActionElement = null; - else - ActionElement = new Code(value); + ActionElement = value is null ? null : new Code(value); OnPropertyChanged("Action"); } } @@ -1429,13 +1379,13 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action /// [FhirElement("period", Order=120, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Time when the event was recorded. @@ -1443,13 +1393,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("recorded", InSummary=true, Order=130, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// Time when the event was recorded @@ -1458,13 +1408,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -1476,13 +1423,13 @@ public DateTimeOffset? Recorded [DeclaredType(Type = typeof(Code))] [Binding("AuditEventOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// Whether the event succeeded or failed @@ -1491,13 +1438,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -1507,28 +1451,25 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventOutcome? Outcome /// [FhirElement("outcomeDesc", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString OutcomeDescElement + public Hl7.Fhir.Model.FhirString? OutcomeDescElement { get { return _OutcomeDescElement; } set { _OutcomeDescElement = value; OnPropertyChanged("OutcomeDescElement"); } } - private Hl7.Fhir.Model.FhirString _OutcomeDescElement; + private Hl7.Fhir.Model.FhirString? _OutcomeDescElement; /// /// Description of the event outcome /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OutcomeDesc + public string? OutcomeDesc { - get { return OutcomeDescElement != null ? OutcomeDescElement.Value : null; } + get => _OutcomeDescElement?.Value; set { - if (value == null) - OutcomeDescElement = null; - else - OutcomeDescElement = new Hl7.Fhir.Model.FhirString(value); + OutcomeDescElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OutcomeDesc"); } } @@ -1542,11 +1483,11 @@ public string OutcomeDesc [DataMember] public List PurposeOfEvent { - get { if(_PurposeOfEvent==null) _PurposeOfEvent = new List(); return _PurposeOfEvent; } + get => _PurposeOfEvent ?? new List(); set { _PurposeOfEvent = value; OnPropertyChanged("PurposeOfEvent"); } } - private List _PurposeOfEvent; + private List? _PurposeOfEvent; /// /// Actor involved in the event. @@ -1556,11 +1497,11 @@ public List PurposeOfEvent [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// Audit Event Reporter. @@ -1568,13 +1509,13 @@ public List Agent [FhirElement("source", Order=180, FiveWs="FiveWs.witness")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.AuditEvent.SourceComponent Source + public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.AuditEvent.SourceComponent _Source; + private Hl7.Fhir.Model.AuditEvent.SourceComponent? _Source; /// /// Data or objects used. @@ -1584,33 +1525,29 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent Source [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; protected internal override void CopyToInternal(Base other) { - var dest = other as AuditEvent; - - if (dest == null) - { + if(other is not AuditEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Subtype.Any()) dest.Subtype = new List(Subtype.DeepCopyInternal()); - if(ActionElement != null) dest.ActionElement = (Code)ActionElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(OutcomeDescElement != null) dest.OutcomeDescElement = (Hl7.Fhir.Model.FhirString)OutcomeDescElement.DeepCopyInternal(); - if(PurposeOfEvent.Any()) dest.PurposeOfEvent = new List(PurposeOfEvent.DeepCopyInternal()); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Source != null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)Source.DeepCopyInternal(); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Subtype is not null) dest.Subtype = new List(_Subtype.DeepCopyInternal()); + if(_ActionElement is not null) dest.ActionElement = (Code)_ActionElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_OutcomeDescElement is not null) dest.OutcomeDescElement = (Hl7.Fhir.Model.FhirString)_OutcomeDescElement.DeepCopyInternal(); + if(_PurposeOfEvent is not null) dest.PurposeOfEvent = new List(_PurposeOfEvent.DeepCopyInternal()); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)_Source.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1622,104 +1559,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AuditEvent; - if(otherT == null) return false; + if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Subtype, otherT.Subtype)) return false; - if(!comparer.Equals(ActionElement, otherT.ActionElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(OutcomeDescElement, otherT.OutcomeDescElement)) return false; - if(!comparer.ListEquals(PurposeOfEvent, otherT.PurposeOfEvent)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; + if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_OutcomeDescElement, otherT._OutcomeDescElement)) return false; + if(!comparer.ListEquals(_PurposeOfEvent, otherT._PurposeOfEvent)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subtype": - value = Subtype; - return Subtype?.Any() == true; + value = _Subtype; + return _Subtype?.Any() == true; case "action": - value = ActionElement; - return ActionElement is not null; + value = _ActionElement; + return _ActionElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "outcomeDesc": - value = OutcomeDescElement; - return OutcomeDescElement is not null; + value = _OutcomeDescElement; + return _OutcomeDescElement is not null; case "purposeOfEvent": - value = PurposeOfEvent; - return PurposeOfEvent?.Any() == true; + value = _PurposeOfEvent; + return _PurposeOfEvent?.Any() == true; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "subtype": - Subtype = (List)value; + Subtype = (List?)value!; return this; case "action": - ActionElement = (Code)value; + ActionElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "outcomeDesc": - OutcomeDescElement = (Hl7.Fhir.Model.FhirString)value; + OutcomeDescElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "purposeOfEvent": - PurposeOfEvent = (List)value; + PurposeOfEvent = (List?)value!; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "source": - Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)value; + Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent?)value; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1730,17 +1667,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subtype?.Any() == true) yield return new KeyValuePair("subtype",Subtype); - if (ActionElement is not null) yield return new KeyValuePair("action",ActionElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (OutcomeDescElement is not null) yield return new KeyValuePair("outcomeDesc",OutcomeDescElement); - if (PurposeOfEvent?.Any() == true) yield return new KeyValuePair("purposeOfEvent",PurposeOfEvent); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subtype?.Any() == true) yield return new KeyValuePair("subtype",_Subtype); + if (_ActionElement is not null) yield return new KeyValuePair("action",_ActionElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_OutcomeDescElement is not null) yield return new KeyValuePair("outcomeDesc",_OutcomeDescElement); + if (_PurposeOfEvent?.Any() == true) yield return new KeyValuePair("purposeOfEvent",_PurposeOfEvent); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs b/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs index 2bceac56a..906578bb1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Kind of Resource. @@ -80,13 +83,13 @@ public List Identifier [Binding("BasicResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Identifies the focus of this resource. @@ -95,41 +98,38 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When created. /// [FhirElement("created", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Date CreatedElement + public Hl7.Fhir.Model.Date? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.Date _CreatedElement; + private Hl7.Fhir.Model.Date? _CreatedElement; /// /// When created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.Date(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Created"); } } @@ -141,31 +141,27 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Basic; - - if (dest == null) - { + if(other is not Basic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.Date)CreatedElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.Date)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -177,62 +173,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Basic; - if(otherT == null) return false; + if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.Date)value; + CreatedElement = (Hl7.Fhir.Model.Date?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -243,11 +239,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs index f500dfbc5..9e615362e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -171,13 +174,13 @@ public partial class CollectionComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Collector + public Hl7.Fhir.Model.ResourceReference? Collector { get { return _Collector; } set { _Collector = value; OnPropertyChanged("Collector"); } } - private Hl7.Fhir.Model.ResourceReference _Collector; + private Hl7.Fhir.Model.ResourceReference? _Collector; /// /// Who is product from. @@ -186,13 +189,13 @@ public Hl7.Fhir.Model.ResourceReference Collector [CLSCompliant(false)] [References("Patient","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Time of product collection. @@ -201,27 +204,23 @@ public Hl7.Fhir.Model.ResourceReference Source [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Collected + public Hl7.Fhir.Model.DataType? Collected { get { return _Collected; } set { _Collected = value; OnPropertyChanged("Collected"); } } - private Hl7.Fhir.Model.DataType _Collected; + private Hl7.Fhir.Model.DataType? _Collected; protected internal override void CopyToInternal(Base other) { - var dest = other as CollectionComponent; - - if (dest == null) - { + if(other is not CollectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Collector != null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)Collector.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Collected != null) dest.Collected = (Hl7.Fhir.Model.DataType)Collected.DeepCopyInternal(); + if(_Collector is not null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)_Collector.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Collected is not null) dest.Collected = (Hl7.Fhir.Model.DataType)_Collected.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -233,48 +232,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CollectionComponent; - if(otherT == null) return false; + if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Collector, otherT.Collector)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Collected, otherT.Collected)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Collected, otherT._Collected)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "collector": - value = Collector; - return Collector is not null; + value = _Collector; + return _Collector is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "collected": - value = Collected; - return Collected is not null; + value = _Collected; + return _Collected is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "collector": - Collector = (Hl7.Fhir.Model.ResourceReference)value; + Collector = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "collected": - Collected = (Hl7.Fhir.Model.DataType)value; + Collected = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -285,9 +284,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Collector is not null) yield return new KeyValuePair("collector",Collector); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Collected is not null) yield return new KeyValuePair("collected",Collected); + if (_Collector is not null) yield return new KeyValuePair("collector",_Collector); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Collected is not null) yield return new KeyValuePair("collected",_Collected); } } @@ -313,28 +312,25 @@ public partial class ProcessingComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of of processing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -345,13 +341,13 @@ public string Description [FhirElement("procedure", Order=50)] [Binding("BiologicallyDerivedProductProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Procedure + public Hl7.Fhir.Model.CodeableConcept? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.CodeableConcept _Procedure; + private Hl7.Fhir.Model.CodeableConcept? _Procedure; /// /// Substance added during processing. @@ -360,13 +356,13 @@ public Hl7.Fhir.Model.CodeableConcept Procedure [CLSCompliant(false)] [References("Substance")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Additive + public Hl7.Fhir.Model.ResourceReference? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.ResourceReference _Additive; + private Hl7.Fhir.Model.ResourceReference? _Additive; /// /// Time of processing. @@ -375,28 +371,24 @@ public Hl7.Fhir.Model.ResourceReference Additive [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessingComponent; - - if (dest == null) - { + if(other is not ProcessingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)Procedure.DeepCopyInternal(); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.ResourceReference)Additive.DeepCopyInternal(); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)_Procedure.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.ResourceReference)_Additive.DeepCopyInternal(); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -408,55 +400,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessingComponent; - if(otherT == null) return false; + if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.CodeableConcept)value; + Procedure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additive": - Additive = (Hl7.Fhir.Model.ResourceReference)value; + Additive = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -467,10 +459,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Additive is not null) yield return new KeyValuePair("additive",Additive); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -496,28 +488,25 @@ public partial class ManipulationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of manipulation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -529,26 +518,22 @@ public string Description [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ManipulationComponent; - - if (dest == null) - { + if(other is not ManipulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -560,41 +545,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManipulationComponent; - if(otherT == null) return false; + if(other is not ManipulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -605,8 +590,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -629,28 +614,25 @@ public partial class StorageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of storage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -660,13 +642,13 @@ public string Description /// [FhirElement("temperature", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TemperatureElement + public Hl7.Fhir.Model.FhirDecimal? TemperatureElement { get { return _TemperatureElement; } set { _TemperatureElement = value; OnPropertyChanged("TemperatureElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TemperatureElement; + private Hl7.Fhir.Model.FhirDecimal? _TemperatureElement; /// /// Storage temperature @@ -675,13 +657,10 @@ public Hl7.Fhir.Model.FhirDecimal TemperatureElement [IgnoreDataMember] public decimal? Temperature { - get { return TemperatureElement != null ? TemperatureElement.Value : null; } + get => _TemperatureElement?.Value; set { - if (value == null) - TemperatureElement = null; - else - TemperatureElement = new Hl7.Fhir.Model.FhirDecimal(value); + TemperatureElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Temperature"); } } @@ -693,13 +672,13 @@ public decimal? Temperature [DeclaredType(Type = typeof(Code))] [Binding("BiologicallyDerivedProductStorageScale")] [DataMember] - public Code ScaleElement + public Code? ScaleElement { get { return _ScaleElement; } set { _ScaleElement = value; OnPropertyChanged("ScaleElement"); } } - private Code _ScaleElement; + private Code? _ScaleElement; /// /// farenheit | celsius | kelvin @@ -708,13 +687,10 @@ public Code _ScaleElement?.Value; set { - if (value == null) - ScaleElement = null; - else - ScaleElement = new Code(value); + ScaleElement = value is null ? null : new Code(value); OnPropertyChanged("Scale"); } } @@ -724,28 +700,24 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductStora /// [FhirElement("duration", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Duration + public Hl7.Fhir.Model.Period? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Period _Duration; + private Hl7.Fhir.Model.Period? _Duration; protected internal override void CopyToInternal(Base other) { - var dest = other as StorageComponent; - - if (dest == null) - { + if(other is not StorageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TemperatureElement != null) dest.TemperatureElement = (Hl7.Fhir.Model.FhirDecimal)TemperatureElement.DeepCopyInternal(); - if(ScaleElement != null) dest.ScaleElement = (Code)ScaleElement.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Period)Duration.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TemperatureElement is not null) dest.TemperatureElement = (Hl7.Fhir.Model.FhirDecimal)_TemperatureElement.DeepCopyInternal(); + if(_ScaleElement is not null) dest.ScaleElement = (Code)_ScaleElement.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Period)_Duration.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -757,55 +729,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StorageComponent; - if(otherT == null) return false; + if(other is not StorageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TemperatureElement, otherT.TemperatureElement)) return false; - if(!comparer.Equals(ScaleElement, otherT.ScaleElement)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TemperatureElement, otherT._TemperatureElement)) return false; + if(!comparer.Equals(_ScaleElement, otherT._ScaleElement)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "temperature": - value = TemperatureElement; - return TemperatureElement is not null; + value = _TemperatureElement; + return _TemperatureElement is not null; case "scale": - value = ScaleElement; - return ScaleElement is not null; + value = _ScaleElement; + return _ScaleElement is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "temperature": - TemperatureElement = (Hl7.Fhir.Model.FhirDecimal)value; + TemperatureElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "scale": - ScaleElement = (Code)value; + ScaleElement = (Code?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Period)value; + Duration = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -816,10 +788,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TemperatureElement is not null) yield return new KeyValuePair("temperature",TemperatureElement); - if (ScaleElement is not null) yield return new KeyValuePair("scale",ScaleElement); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TemperatureElement is not null) yield return new KeyValuePair("temperature",_TemperatureElement); + if (_ScaleElement is not null) yield return new KeyValuePair("scale",_ScaleElement); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); } } @@ -832,11 +804,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// organ | tissue | fluid | cells | biologicalAgent. @@ -845,13 +817,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("BiologicallyDerivedProductCategory")] [DataMember] - public Code ProductCategoryElement + public Code? ProductCategoryElement { get { return _ProductCategoryElement; } set { _ProductCategoryElement = value; OnPropertyChanged("ProductCategoryElement"); } } - private Code _ProductCategoryElement; + private Code? _ProductCategoryElement; /// /// organ | tissue | fluid | cells | biologicalAgent @@ -860,13 +832,10 @@ public Code _ProductCategoryElement?.Value; set { - if (value == null) - ProductCategoryElement = null; - else - ProductCategoryElement = new Code(value); + ProductCategoryElement = value is null ? null : new Code(value); OnPropertyChanged("ProductCategory"); } } @@ -877,13 +846,13 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductCateg [FhirElement("productCode", Order=110)] [Binding("BiologicallyDerivedProductCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductCode + public Hl7.Fhir.Model.CodeableConcept? ProductCode { get { return _ProductCode; } set { _ProductCode = value; OnPropertyChanged("ProductCode"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductCode; + private Hl7.Fhir.Model.CodeableConcept? _ProductCode; /// /// available | unavailable. @@ -892,13 +861,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductCode [DeclaredType(Type = typeof(Code))] [Binding("BiologicallyDerivedProductStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// available | unavailable @@ -907,13 +876,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -928,24 +894,24 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatu [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// The amount of this biologically derived product. /// [FhirElement("quantity", Order=140)] [DataMember] - public Hl7.Fhir.Model.Integer QuantityElement + public Hl7.Fhir.Model.Integer? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.Integer _QuantityElement; + private Hl7.Fhir.Model.Integer? _QuantityElement; /// /// The amount of this biologically derived product @@ -954,13 +920,10 @@ public Hl7.Fhir.Model.Integer QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.Integer(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Quantity"); } } @@ -975,24 +938,24 @@ public int? Quantity [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// How this product was collected. /// [FhirElement("collection", Order=160)] [DataMember] - public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent Collection + public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? Collection { get { return _Collection; } set { _Collection = value; OnPropertyChanged("Collection"); } } - private Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent _Collection; + private Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? _Collection; /// /// Any processing of the product during collection. @@ -1002,24 +965,24 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent Collection [DataMember] public List Processing { - get { if(_Processing==null) _Processing = new List(); return _Processing; } + get => _Processing ?? new List(); set { _Processing = value; OnPropertyChanged("Processing"); } } - private List _Processing; + private List? _Processing; /// /// Any manipulation of product post-collection. /// [FhirElement("manipulation", Order=180)] [DataMember] - public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent Manipulation + public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent? Manipulation { get { return _Manipulation; } set { _Manipulation = value; OnPropertyChanged("Manipulation"); } } - private Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent _Manipulation; + private Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent? _Manipulation; /// /// Product storage. @@ -1029,35 +992,31 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent Manipulat [DataMember] public List Storage { - get { if(_Storage==null) _Storage = new List(); return _Storage; } + get => _Storage ?? new List(); set { _Storage = value; OnPropertyChanged("Storage"); } } - private List _Storage; + private List? _Storage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as BiologicallyDerivedProduct; - - if (dest == null) - { + if(other is not BiologicallyDerivedProduct dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ProductCategoryElement != null) dest.ProductCategoryElement = (Code)ProductCategoryElement.DeepCopyInternal(); - if(ProductCode != null) dest.ProductCode = (Hl7.Fhir.Model.CodeableConcept)ProductCode.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)QuantityElement.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Collection != null) dest.Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)Collection.DeepCopyInternal(); - if(Processing.Any()) dest.Processing = new List(Processing.DeepCopyInternal()); - if(Manipulation != null) dest.Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent)Manipulation.DeepCopyInternal(); - if(Storage.Any()) dest.Storage = new List(Storage.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ProductCategoryElement is not null) dest.ProductCategoryElement = (Code)_ProductCategoryElement.DeepCopyInternal(); + if(_ProductCode is not null) dest.ProductCode = (Hl7.Fhir.Model.CodeableConcept)_ProductCode.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)_QuantityElement.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Collection is not null) dest.Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)_Collection.DeepCopyInternal(); + if(_Processing is not null) dest.Processing = new List(_Processing.DeepCopyInternal()); + if(_Manipulation is not null) dest.Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent)_Manipulation.DeepCopyInternal(); + if(_Storage is not null) dest.Storage = new List(_Storage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1069,104 +1028,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BiologicallyDerivedProduct; - if(otherT == null) return false; + if(other is not BiologicallyDerivedProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ProductCategoryElement, otherT.ProductCategoryElement)) return false; - if(!comparer.Equals(ProductCode, otherT.ProductCode)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(Processing, otherT.Processing)) return false; - if(!comparer.Equals(Manipulation, otherT.Manipulation)) return false; - if(!comparer.ListEquals(Storage, otherT.Storage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ProductCategoryElement, otherT._ProductCategoryElement)) return false; + if(!comparer.Equals(_ProductCode, otherT._ProductCode)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; + if(!comparer.Equals(_Manipulation, otherT._Manipulation)) return false; + if(!comparer.ListEquals(_Storage, otherT._Storage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "productCategory": - value = ProductCategoryElement; - return ProductCategoryElement is not null; + value = _ProductCategoryElement; + return _ProductCategoryElement is not null; case "productCode": - value = ProductCode; - return ProductCode is not null; + value = _ProductCode; + return _ProductCode is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "collection": - value = Collection; - return Collection is not null; + value = _Collection; + return _Collection is not null; case "processing": - value = Processing; - return Processing?.Any() == true; + value = _Processing; + return _Processing?.Any() == true; case "manipulation": - value = Manipulation; - return Manipulation is not null; + value = _Manipulation; + return _Manipulation is not null; case "storage": - value = Storage; - return Storage?.Any() == true; + value = _Storage; + return _Storage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "productCategory": - ProductCategoryElement = (Code)value; + ProductCategoryElement = (Code?)value; return this; case "productCode": - ProductCode = (Hl7.Fhir.Model.CodeableConcept)value; + ProductCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.Integer)value; + QuantityElement = (Hl7.Fhir.Model.Integer?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "collection": - Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)value; + Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent?)value; return this; case "processing": - Processing = (List)value; + Processing = (List?)value!; return this; case "manipulation": - Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent)value; + Manipulation = (Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent?)value; return this; case "storage": - Storage = (List)value; + Storage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1177,17 +1136,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ProductCategoryElement is not null) yield return new KeyValuePair("productCategory",ProductCategoryElement); - if (ProductCode is not null) yield return new KeyValuePair("productCode",ProductCode); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Collection is not null) yield return new KeyValuePair("collection",Collection); - if (Processing?.Any() == true) yield return new KeyValuePair("processing",Processing); - if (Manipulation is not null) yield return new KeyValuePair("manipulation",Manipulation); - if (Storage?.Any() == true) yield return new KeyValuePair("storage",Storage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ProductCategoryElement is not null) yield return new KeyValuePair("productCategory",_ProductCategoryElement); + if (_ProductCode is not null) yield return new KeyValuePair("productCode",_ProductCode); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Collection is not null) yield return new KeyValuePair("collection",_Collection); + if (_Processing?.Any() == true) yield return new KeyValuePair("processing",_Processing); + if (_Manipulation is not null) yield return new KeyValuePair("manipulation",_Manipulation); + if (_Storage?.Any() == true) yield return new KeyValuePair("storage",_Storage); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs index a27547954..878e66abe 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,24 +70,24 @@ public partial class BodyStructure : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this record is in active use @@ -93,13 +96,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -110,13 +110,13 @@ public bool? Active [FhirElement("morphology", InSummary=true, Order=110, FiveWs="FiveWs.what[x]")] [Binding("BodyStructureCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Morphology + public Hl7.Fhir.Model.CodeableConcept? Morphology { get { return _Morphology; } set { _Morphology = value; OnPropertyChanged("Morphology"); } } - private Hl7.Fhir.Model.CodeableConcept _Morphology; + private Hl7.Fhir.Model.CodeableConcept? _Morphology; /// /// Body site. @@ -124,13 +124,13 @@ public Hl7.Fhir.Model.CodeableConcept Morphology [FhirElement("location", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Location + public Hl7.Fhir.Model.CodeableConcept? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.CodeableConcept _Location; + private Hl7.Fhir.Model.CodeableConcept? _Location; /// /// Body site modifier. @@ -141,39 +141,36 @@ public Hl7.Fhir.Model.CodeableConcept Location [DataMember] public List LocationQualifier { - get { if(_LocationQualifier==null) _LocationQualifier = new List(); return _LocationQualifier; } + get => _LocationQualifier ?? new List(); set { _LocationQualifier = value; OnPropertyChanged("LocationQualifier"); } } - private List _LocationQualifier; + private List? _LocationQualifier; /// /// Text description. /// [FhirElement("description", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Text description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -186,11 +183,11 @@ public string Description [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; /// /// Who this is about. @@ -200,34 +197,30 @@ public List Image [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as BodyStructure; - - if (dest == null) - { + if(other is not BodyStructure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Morphology != null) dest.Morphology = (Hl7.Fhir.Model.CodeableConcept)Morphology.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.CodeableConcept)Location.DeepCopyInternal(); - if(LocationQualifier.Any()) dest.LocationQualifier = new List(LocationQualifier.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Morphology is not null) dest.Morphology = (Hl7.Fhir.Model.CodeableConcept)_Morphology.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.CodeableConcept)_Location.DeepCopyInternal(); + if(_LocationQualifier is not null) dest.LocationQualifier = new List(_LocationQualifier.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -239,83 +232,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BodyStructure; - if(otherT == null) return false; + if(other is not BodyStructure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Morphology, otherT.Morphology)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(LocationQualifier, otherT.LocationQualifier)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Morphology, otherT._Morphology)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_LocationQualifier, otherT._LocationQualifier)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "morphology": - value = Morphology; - return Morphology is not null; + value = _Morphology; + return _Morphology is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "locationQualifier": - value = LocationQualifier; - return LocationQualifier?.Any() == true; + value = _LocationQualifier; + return _LocationQualifier?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "morphology": - Morphology = (Hl7.Fhir.Model.CodeableConcept)value; + Morphology = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.CodeableConcept)value; + Location = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "locationQualifier": - LocationQualifier = (List)value; + LocationQualifier = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -326,14 +319,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Morphology is not null) yield return new KeyValuePair("morphology",Morphology); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (LocationQualifier?.Any() == true) yield return new KeyValuePair("locationQualifier",LocationQualifier); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Morphology is not null) yield return new KeyValuePair("morphology",_Morphology); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_LocationQualifier?.Any() == true) yield return new KeyValuePair("locationQualifier",_LocationQualifier); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs index 9667de6b7..2a6ad9510 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -240,11 +243,11 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List OutcomeCodeableConcept { - get { if(_OutcomeCodeableConcept==null) _OutcomeCodeableConcept = new List(); return _OutcomeCodeableConcept; } + get => _OutcomeCodeableConcept ?? new List(); set { _OutcomeCodeableConcept = value; OnPropertyChanged("OutcomeCodeableConcept"); } } - private List _OutcomeCodeableConcept; + private List? _OutcomeCodeableConcept; /// /// Appointment, Encounter, Procedure, etc. @@ -256,11 +259,11 @@ public List OutcomeCodeableConcept [DataMember] public List OutcomeReference { - get { if(_OutcomeReference==null) _OutcomeReference = new List(); return _OutcomeReference; } + get => _OutcomeReference ?? new List(); set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } - private List _OutcomeReference; + private List? _OutcomeReference; /// /// Comments about the activity status/progress. @@ -270,11 +273,11 @@ public List OutcomeReference [DataMember] public List Progress { - get { if(_Progress==null) _Progress = new List(); return _Progress; } + get => _Progress ?? new List(); set { _Progress = value; OnPropertyChanged("Progress"); } } - private List _Progress; + private List? _Progress; /// /// Activity details defined in specific resource. @@ -283,42 +286,38 @@ public List Progress [CLSCompliant(false)] [References("Appointment","CommunicationRequest","DeviceRequest","MedicationRequest","NutritionOrder","Task","ServiceRequest","VisionPrescription","RequestGroup")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// In-line definition of activity. /// [FhirElement("detail", Order=80)] [DataMember] - public Hl7.Fhir.Model.CarePlan.DetailComponent Detail + public Hl7.Fhir.Model.CarePlan.DetailComponent? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.CarePlan.DetailComponent _Detail; + private Hl7.Fhir.Model.CarePlan.DetailComponent? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityComponent; - - if (dest == null) - { + if(other is not ActivityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(OutcomeCodeableConcept.Any()) dest.OutcomeCodeableConcept = new List(OutcomeCodeableConcept.DeepCopyInternal()); - if(OutcomeReference.Any()) dest.OutcomeReference = new List(OutcomeReference.DeepCopyInternal()); - if(Progress.Any()) dest.Progress = new List(Progress.DeepCopyInternal()); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)Detail.DeepCopyInternal(); + if(_OutcomeCodeableConcept is not null) dest.OutcomeCodeableConcept = new List(_OutcomeCodeableConcept.DeepCopyInternal()); + if(_OutcomeReference is not null) dest.OutcomeReference = new List(_OutcomeReference.DeepCopyInternal()); + if(_Progress is not null) dest.Progress = new List(_Progress.DeepCopyInternal()); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)_Detail.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -330,62 +329,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityComponent; - if(otherT == null) return false; + if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(OutcomeCodeableConcept, otherT.OutcomeCodeableConcept)) return false; - if(!comparer.ListEquals(OutcomeReference, otherT.OutcomeReference)) return false; - if(!comparer.ListEquals(Progress, otherT.Progress)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; + if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; + if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outcomeCodeableConcept": - value = OutcomeCodeableConcept; - return OutcomeCodeableConcept?.Any() == true; + value = _OutcomeCodeableConcept; + return _OutcomeCodeableConcept?.Any() == true; case "outcomeReference": - value = OutcomeReference; - return OutcomeReference?.Any() == true; + value = _OutcomeReference; + return _OutcomeReference?.Any() == true; case "progress": - value = Progress; - return Progress?.Any() == true; + value = _Progress; + return _Progress?.Any() == true; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outcomeCodeableConcept": - OutcomeCodeableConcept = (List)value; + OutcomeCodeableConcept = (List?)value!; return this; case "outcomeReference": - OutcomeReference = (List)value; + OutcomeReference = (List?)value!; return this; case "progress": - Progress = (List)value; + Progress = (List?)value!; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent)value; + Detail = (Hl7.Fhir.Model.CarePlan.DetailComponent?)value; return this; default: return base.SetValue(key, value); @@ -396,11 +395,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (OutcomeCodeableConcept?.Any() == true) yield return new KeyValuePair("outcomeCodeableConcept",OutcomeCodeableConcept); - if (OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",OutcomeReference); - if (Progress?.Any() == true) yield return new KeyValuePair("progress",Progress); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); + if (_OutcomeCodeableConcept?.Any() == true) yield return new KeyValuePair("outcomeCodeableConcept",_OutcomeCodeableConcept); + if (_OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",_OutcomeReference); + if (_Progress?.Any() == true) yield return new KeyValuePair("progress",_Progress); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); } } @@ -428,13 +427,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("CarePlanActivityKind")] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// Appointment | CommunicationRequest | DeviceRequest | MedicationRequest | NutritionOrder | Task | ServiceRequest | VisionPrescription @@ -443,13 +442,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanActivityKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -462,24 +458,24 @@ public Hl7.Fhir.Model.CarePlan.CarePlanActivityKind? Kind [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -494,24 +490,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -524,13 +520,13 @@ public IEnumerable InstantiatesUri [FhirElement("code", Order=70)] [Binding("CarePlanActivityType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Why activity should be done or why activity was prohibited. @@ -541,11 +537,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why activity is needed. @@ -557,11 +553,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Goals this activity relates to. @@ -573,11 +569,11 @@ public List ReasonReference [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// not-started | scheduled | in-progress | on-hold | completed | cancelled | stopped | unknown | entered-in-error. @@ -587,13 +583,13 @@ public List Goal [Binding("CarePlanActivityStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// not-started | scheduled | in-progress | on-hold | completed | cancelled | stopped | unknown | entered-in-error @@ -602,13 +598,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanActivityStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -618,26 +611,26 @@ public Hl7.Fhir.Model.CarePlan.CarePlanActivityStatus? Status /// [FhirElement("statusReason", Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// If true, activity is prohibiting action. /// [FhirElement("doNotPerform", IsModifier=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// If true, activity is prohibiting action @@ -646,13 +639,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -664,13 +654,13 @@ public bool? DoNotPerform [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Scheduled + public Hl7.Fhir.Model.DataType? Scheduled { get { return _Scheduled; } set { _Scheduled = value; OnPropertyChanged("Scheduled"); } } - private Hl7.Fhir.Model.DataType _Scheduled; + private Hl7.Fhir.Model.DataType? _Scheduled; /// /// Where it should happen. @@ -679,13 +669,13 @@ public Hl7.Fhir.Model.DataType Scheduled [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Who will be responsible?. @@ -697,11 +687,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// What is to be administered/supplied. @@ -712,98 +702,91 @@ public List Performer [References("Medication","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// How to consume/day?. /// [FhirElement("dailyAmount", Order=180)] [DataMember] - public Hl7.Fhir.Model.Quantity DailyAmount + public Hl7.Fhir.Model.Quantity? DailyAmount { get { return _DailyAmount; } set { _DailyAmount = value; OnPropertyChanged("DailyAmount"); } } - private Hl7.Fhir.Model.Quantity _DailyAmount; + private Hl7.Fhir.Model.Quantity? _DailyAmount; /// /// How much to administer/supply/consume. /// [FhirElement("quantity", Order=190)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Extra info describing activity to perform. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Extra info describing activity to perform /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Scheduled != null) dest.Scheduled = (Hl7.Fhir.Model.DataType)Scheduled.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(DailyAmount != null) dest.DailyAmount = (Hl7.Fhir.Model.Quantity)DailyAmount.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Scheduled is not null) dest.Scheduled = (Hl7.Fhir.Model.DataType)_Scheduled.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_DailyAmount is not null) dest.DailyAmount = (Hl7.Fhir.Model.Quantity)_DailyAmount.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -815,146 +798,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Scheduled, otherT.Scheduled)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(DailyAmount, otherT.DailyAmount)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Scheduled, otherT._Scheduled)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_DailyAmount, otherT._DailyAmount)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "scheduled": - value = Scheduled; - return Scheduled is not null; + value = _Scheduled; + return _Scheduled is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "dailyAmount": - value = DailyAmount; - return DailyAmount is not null; + value = _DailyAmount; + return _DailyAmount is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "scheduled": - Scheduled = (Hl7.Fhir.Model.DataType)value; + Scheduled = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "dailyAmount": - DailyAmount = (Hl7.Fhir.Model.Quantity)value; + DailyAmount = (Hl7.Fhir.Model.Quantity?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -965,23 +948,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Scheduled is not null) yield return new KeyValuePair("scheduled",Scheduled); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (DailyAmount is not null) yield return new KeyValuePair("dailyAmount",DailyAmount); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Scheduled is not null) yield return new KeyValuePair("scheduled",_Scheduled); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_DailyAmount is not null) yield return new KeyValuePair("dailyAmount",_DailyAmount); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -994,11 +977,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -1008,24 +991,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1040,24 +1023,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1074,11 +1057,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// CarePlan replaced by this CarePlan. @@ -1090,11 +1073,11 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Part of referenced CarePlan. @@ -1106,11 +1089,11 @@ public List Replaces [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -1120,13 +1103,13 @@ public List PartOf [Binding("CarePlanStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -1135,13 +1118,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1154,13 +1134,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("CarePlanIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | option @@ -1169,13 +1149,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1189,39 +1166,36 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Human-friendly name for the care plan. /// [FhirElement("title", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human-friendly name for the care plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1231,28 +1205,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=190, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Summary of nature of plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1265,13 +1236,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -1280,54 +1251,51 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time period plan covers. /// [FhirElement("period", InSummary=true, Order=220, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Date record was first recorded. /// [FhirElement("created", InSummary=true, Order=230, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Date record was first recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1339,13 +1307,13 @@ public string Created [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Device","RelatedPerson","Organization","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Who provided the content of the care plan. @@ -1357,11 +1325,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Who's involved in plan?. @@ -1373,11 +1341,11 @@ public List Contributor [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Health issues this plan addresses. @@ -1389,11 +1357,11 @@ public List CareTeam [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Information considered as part of plan. @@ -1405,11 +1373,11 @@ public List Addresses [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Desired outcome of plan. @@ -1421,11 +1389,11 @@ public List SupportingInfo [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Action to occur as part of plan. @@ -1435,11 +1403,11 @@ public List Goal [DataMember] public List Activity { - get { if(_Activity==null) _Activity = new List(); return _Activity; } + get => _Activity ?? new List(); set { _Activity = value; OnPropertyChanged("Activity"); } } - private List _Activity; + private List? _Activity; /// /// Comments about the plan. @@ -1449,47 +1417,43 @@ public List Activity [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CarePlan; - - if (dest == null) - { + if(other is not CarePlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Activity.Any()) dest.Activity = new List(Activity.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = new List(_Activity.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1501,188 +1465,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CarePlan; - if(otherT == null) return false; + if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "activity": - value = Activity; - return Activity?.Any() == true; + value = _Activity; + return _Activity?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "activity": - Activity = (List)value; + Activity = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1693,29 +1657,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Activity?.Any() == true) yield return new KeyValuePair("activity",Activity); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Activity?.Any() == true) yield return new KeyValuePair("activity",_Activity); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs index 1d6f827ac..03b33790a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -124,11 +127,11 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Who is involved. @@ -137,13 +140,13 @@ public List Role [CLSCompliant(false)] [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Organization","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Member + public Hl7.Fhir.Model.ResourceReference? Member { get { return _Member; } set { _Member = value; OnPropertyChanged("Member"); } } - private Hl7.Fhir.Model.ResourceReference _Member; + private Hl7.Fhir.Model.ResourceReference? _Member; /// /// Organization of the practitioner. @@ -152,41 +155,37 @@ public Hl7.Fhir.Model.ResourceReference Member [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// Time period of participant. /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Member != null) dest.Member = (Hl7.Fhir.Model.ResourceReference)Member.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Member is not null) dest.Member = (Hl7.Fhir.Model.ResourceReference)_Member.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -198,55 +197,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Member, otherT.Member)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Member, otherT._Member)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "member": - value = Member; - return Member is not null; + value = _Member; + return _Member is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (List)value; + Role = (List?)value!; return this; case "member": - Member = (Hl7.Fhir.Model.ResourceReference)value; + Member = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -257,10 +256,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Member is not null) yield return new KeyValuePair("member",Member); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Member is not null) yield return new KeyValuePair("member",_Member); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -273,11 +272,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | active | suspended | inactive | entered-in-error. @@ -286,13 +285,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("CareTeamStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | active | suspended | inactive | entered-in-error @@ -301,13 +300,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -321,39 +317,36 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Name of the team, such as crisis assessment team. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the team, such as crisis assessment team /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -365,13 +358,13 @@ public string Name [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -380,26 +373,26 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time period team covers. /// [FhirElement("period", InSummary=true, Order=150, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Members of the team. @@ -409,11 +402,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Why the care team exists. @@ -424,11 +417,11 @@ public List Participant [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why the care team exists. @@ -440,11 +433,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Organization responsible for the care team. @@ -456,11 +449,11 @@ public List ReasonReference [DataMember] public List ManagingOrganization { - get { if(_ManagingOrganization==null) _ManagingOrganization = new List(); return _ManagingOrganization; } + get => _ManagingOrganization ?? new List(); set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private List _ManagingOrganization; + private List? _ManagingOrganization; /// /// A contact detail for the care team (that applies to all members). @@ -470,11 +463,11 @@ public List ManagingOrganization [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Comments made about the CareTeam. @@ -484,37 +477,33 @@ public List Telecom [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeam; - - if (dest == null) - { + if(other is not CareTeam dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(ManagingOrganization.Any()) dest.ManagingOrganization = new List(ManagingOrganization.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = new List(_ManagingOrganization.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -526,118 +515,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeam; - if(otherT == null) return false; + if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization?.Any() == true; + value = _ManagingOrganization; + return _ManagingOrganization?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (List)value; + ManagingOrganization = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -648,19 +637,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs b/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs index d5b35ea66..39c07b2d9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -105,13 +108,13 @@ public partial class RelatedEntryComponent : Hl7.Fhir.Model.BackboneElement [Binding("CatalogEntryRelationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationtypeElement + public Code? RelationtypeElement { get { return _RelationtypeElement; } set { _RelationtypeElement = value; OnPropertyChanged("RelationtypeElement"); } } - private Code _RelationtypeElement; + private Code? _RelationtypeElement; /// /// triggers | is-replaced-by @@ -120,13 +123,10 @@ public Code RelationtypeEl [IgnoreDataMember] public Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType? Relationtype { - get { return RelationtypeElement != null ? RelationtypeElement.Value : null; } + get => _RelationtypeElement?.Value; set { - if (value == null) - RelationtypeElement = null; - else - RelationtypeElement = new Code(value); + RelationtypeElement = value is null ? null : new Code(value); OnPropertyChanged("Relationtype"); } } @@ -139,26 +139,22 @@ public Hl7.Fhir.Model.CatalogEntry.CatalogEntryRelationType? Relationtype [References("CatalogEntry")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Item + public Hl7.Fhir.Model.ResourceReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.ResourceReference _Item; + private Hl7.Fhir.Model.ResourceReference? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedEntryComponent; - - if (dest == null) - { + if(other is not RelatedEntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RelationtypeElement != null) dest.RelationtypeElement = (Code)RelationtypeElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.ResourceReference)Item.DeepCopyInternal(); + if(_RelationtypeElement is not null) dest.RelationtypeElement = (Code)_RelationtypeElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.ResourceReference)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -170,41 +166,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedEntryComponent; - if(otherT == null) return false; + if(other is not RelatedEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RelationtypeElement, otherT.RelationtypeElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationtypeElement, otherT._RelationtypeElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationtype": - value = RelationtypeElement; - return RelationtypeElement is not null; + value = _RelationtypeElement; + return _RelationtypeElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationtype": - RelationtypeElement = (Code)value; + RelationtypeElement = (Code?)value; return this; case "item": - Item = (Hl7.Fhir.Model.ResourceReference)value; + Item = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -215,8 +211,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RelationtypeElement is not null) yield return new KeyValuePair("relationtype",RelationtypeElement); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_RelationtypeElement is not null) yield return new KeyValuePair("relationtype",_RelationtypeElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -229,24 +225,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The type of item - medication, device, service, protocol or other. /// [FhirElement("type", Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Whether the entry represents an orderable item. @@ -254,13 +250,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("orderable", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OrderableElement + public Hl7.Fhir.Model.FhirBoolean? OrderableElement { get { return _OrderableElement; } set { _OrderableElement = value; OnPropertyChanged("OrderableElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OrderableElement; + private Hl7.Fhir.Model.FhirBoolean? _OrderableElement; /// /// Whether the entry represents an orderable item @@ -269,13 +265,10 @@ public Hl7.Fhir.Model.FhirBoolean OrderableElement [IgnoreDataMember] public bool? Orderable { - get { return OrderableElement != null ? OrderableElement.Value : null; } + get => _OrderableElement?.Value; set { - if (value == null) - OrderableElement = null; - else - OrderableElement = new Hl7.Fhir.Model.FhirBoolean(value); + OrderableElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Orderable"); } } @@ -288,13 +281,13 @@ public bool? Orderable [References("Medication","Device","Organization","Practitioner","PractitionerRole","HealthcareService","ActivityDefinition","PlanDefinition","SpecimenDefinition","ObservationDefinition","Binary")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReferencedItem + public Hl7.Fhir.Model.ResourceReference? ReferencedItem { get { return _ReferencedItem; } set { _ReferencedItem = value; OnPropertyChanged("ReferencedItem"); } } - private Hl7.Fhir.Model.ResourceReference _ReferencedItem; + private Hl7.Fhir.Model.ResourceReference? _ReferencedItem; /// /// Any additional identifier(s) for the catalog item, in the same granularity or concept. @@ -304,11 +297,11 @@ public Hl7.Fhir.Model.ResourceReference ReferencedItem [DataMember] public List AdditionalIdentifier { - get { if(_AdditionalIdentifier==null) _AdditionalIdentifier = new List(); return _AdditionalIdentifier; } + get => _AdditionalIdentifier ?? new List(); set { _AdditionalIdentifier = value; OnPropertyChanged("AdditionalIdentifier"); } } - private List _AdditionalIdentifier; + private List? _AdditionalIdentifier; /// /// Classification (category or class) of the item entry. @@ -318,11 +311,11 @@ public List AdditionalIdentifier [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// draft | active | retired | unknown. @@ -331,13 +324,13 @@ public List Classification [DeclaredType(Type = typeof(Code))] [Binding("PublicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -346,13 +339,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -362,41 +352,38 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("validityPeriod", Order=160)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// The date until which this catalog entry is expected to be active. /// [FhirElement("validTo", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValidToElement + public Hl7.Fhir.Model.FhirDateTime? ValidToElement { get { return _ValidToElement; } set { _ValidToElement = value; OnPropertyChanged("ValidToElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValidToElement; + private Hl7.Fhir.Model.FhirDateTime? _ValidToElement; /// /// The date until which this catalog entry is expected to be active /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidTo + public string? ValidTo { - get { return ValidToElement != null ? ValidToElement.Value : null; } + get => _ValidToElement?.Value; set { - if (value == null) - ValidToElement = null; - else - ValidToElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValidToElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ValidTo"); } } @@ -406,28 +393,25 @@ public string ValidTo /// [FhirElement("lastUpdated", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastUpdatedElement + public Hl7.Fhir.Model.FhirDateTime? LastUpdatedElement { get { return _LastUpdatedElement; } set { _LastUpdatedElement = value; OnPropertyChanged("LastUpdatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastUpdatedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastUpdatedElement; /// /// When was this catalog last updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastUpdated + public string? LastUpdated { - get { return LastUpdatedElement != null ? LastUpdatedElement.Value : null; } + get => _LastUpdatedElement?.Value; set { - if (value == null) - LastUpdatedElement = null; - else - LastUpdatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastUpdatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastUpdated"); } } @@ -440,11 +424,11 @@ public string LastUpdated [DataMember] public List AdditionalCharacteristic { - get { if(_AdditionalCharacteristic==null) _AdditionalCharacteristic = new List(); return _AdditionalCharacteristic; } + get => _AdditionalCharacteristic ?? new List(); set { _AdditionalCharacteristic = value; OnPropertyChanged("AdditionalCharacteristic"); } } - private List _AdditionalCharacteristic; + private List? _AdditionalCharacteristic; /// /// Additional classification of the catalog entry. @@ -454,11 +438,11 @@ public List AdditionalCharacteristic [DataMember] public List AdditionalClassification { - get { if(_AdditionalClassification==null) _AdditionalClassification = new List(); return _AdditionalClassification; } + get => _AdditionalClassification ?? new List(); set { _AdditionalClassification = value; OnPropertyChanged("AdditionalClassification"); } } - private List _AdditionalClassification; + private List? _AdditionalClassification; /// /// An item that this catalog entry is related to. @@ -468,37 +452,33 @@ public List AdditionalClassification [DataMember] public List RelatedEntry { - get { if(_RelatedEntry==null) _RelatedEntry = new List(); return _RelatedEntry; } + get => _RelatedEntry ?? new List(); set { _RelatedEntry = value; OnPropertyChanged("RelatedEntry"); } } - private List _RelatedEntry; + private List? _RelatedEntry; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CatalogEntry; - - if (dest == null) - { + if(other is not CatalogEntry dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(OrderableElement != null) dest.OrderableElement = (Hl7.Fhir.Model.FhirBoolean)OrderableElement.DeepCopyInternal(); - if(ReferencedItem != null) dest.ReferencedItem = (Hl7.Fhir.Model.ResourceReference)ReferencedItem.DeepCopyInternal(); - if(AdditionalIdentifier.Any()) dest.AdditionalIdentifier = new List(AdditionalIdentifier.DeepCopyInternal()); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(ValidToElement != null) dest.ValidToElement = (Hl7.Fhir.Model.FhirDateTime)ValidToElement.DeepCopyInternal(); - if(LastUpdatedElement != null) dest.LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime)LastUpdatedElement.DeepCopyInternal(); - if(AdditionalCharacteristic.Any()) dest.AdditionalCharacteristic = new List(AdditionalCharacteristic.DeepCopyInternal()); - if(AdditionalClassification.Any()) dest.AdditionalClassification = new List(AdditionalClassification.DeepCopyInternal()); - if(RelatedEntry.Any()) dest.RelatedEntry = new List(RelatedEntry.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_OrderableElement is not null) dest.OrderableElement = (Hl7.Fhir.Model.FhirBoolean)_OrderableElement.DeepCopyInternal(); + if(_ReferencedItem is not null) dest.ReferencedItem = (Hl7.Fhir.Model.ResourceReference)_ReferencedItem.DeepCopyInternal(); + if(_AdditionalIdentifier is not null) dest.AdditionalIdentifier = new List(_AdditionalIdentifier.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_ValidToElement is not null) dest.ValidToElement = (Hl7.Fhir.Model.FhirDateTime)_ValidToElement.DeepCopyInternal(); + if(_LastUpdatedElement is not null) dest.LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime)_LastUpdatedElement.DeepCopyInternal(); + if(_AdditionalCharacteristic is not null) dest.AdditionalCharacteristic = new List(_AdditionalCharacteristic.DeepCopyInternal()); + if(_AdditionalClassification is not null) dest.AdditionalClassification = new List(_AdditionalClassification.DeepCopyInternal()); + if(_RelatedEntry is not null) dest.RelatedEntry = new List(_RelatedEntry.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -510,118 +490,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CatalogEntry; - if(otherT == null) return false; + if(other is not CatalogEntry otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(OrderableElement, otherT.OrderableElement)) return false; - if(!comparer.Equals(ReferencedItem, otherT.ReferencedItem)) return false; - if(!comparer.ListEquals(AdditionalIdentifier, otherT.AdditionalIdentifier)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(ValidToElement, otherT.ValidToElement)) return false; - if(!comparer.Equals(LastUpdatedElement, otherT.LastUpdatedElement)) return false; - if(!comparer.ListEquals(AdditionalCharacteristic, otherT.AdditionalCharacteristic)) return false; - if(!comparer.ListEquals(AdditionalClassification, otherT.AdditionalClassification)) return false; - if(!comparer.ListEquals(RelatedEntry, otherT.RelatedEntry)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OrderableElement, otherT._OrderableElement)) return false; + if(!comparer.Equals(_ReferencedItem, otherT._ReferencedItem)) return false; + if(!comparer.ListEquals(_AdditionalIdentifier, otherT._AdditionalIdentifier)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_ValidToElement, otherT._ValidToElement)) return false; + if(!comparer.Equals(_LastUpdatedElement, otherT._LastUpdatedElement)) return false; + if(!comparer.ListEquals(_AdditionalCharacteristic, otherT._AdditionalCharacteristic)) return false; + if(!comparer.ListEquals(_AdditionalClassification, otherT._AdditionalClassification)) return false; + if(!comparer.ListEquals(_RelatedEntry, otherT._RelatedEntry)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "orderable": - value = OrderableElement; - return OrderableElement is not null; + value = _OrderableElement; + return _OrderableElement is not null; case "referencedItem": - value = ReferencedItem; - return ReferencedItem is not null; + value = _ReferencedItem; + return _ReferencedItem is not null; case "additionalIdentifier": - value = AdditionalIdentifier; - return AdditionalIdentifier?.Any() == true; + value = _AdditionalIdentifier; + return _AdditionalIdentifier?.Any() == true; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "validTo": - value = ValidToElement; - return ValidToElement is not null; + value = _ValidToElement; + return _ValidToElement is not null; case "lastUpdated": - value = LastUpdatedElement; - return LastUpdatedElement is not null; + value = _LastUpdatedElement; + return _LastUpdatedElement is not null; case "additionalCharacteristic": - value = AdditionalCharacteristic; - return AdditionalCharacteristic?.Any() == true; + value = _AdditionalCharacteristic; + return _AdditionalCharacteristic?.Any() == true; case "additionalClassification": - value = AdditionalClassification; - return AdditionalClassification?.Any() == true; + value = _AdditionalClassification; + return _AdditionalClassification?.Any() == true; case "relatedEntry": - value = RelatedEntry; - return RelatedEntry?.Any() == true; + value = _RelatedEntry; + return _RelatedEntry?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "orderable": - OrderableElement = (Hl7.Fhir.Model.FhirBoolean)value; + OrderableElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "referencedItem": - ReferencedItem = (Hl7.Fhir.Model.ResourceReference)value; + ReferencedItem = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "additionalIdentifier": - AdditionalIdentifier = (List)value; + AdditionalIdentifier = (List?)value!; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "validTo": - ValidToElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValidToElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastUpdated": - LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastUpdatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "additionalCharacteristic": - AdditionalCharacteristic = (List)value; + AdditionalCharacteristic = (List?)value!; return this; case "additionalClassification": - AdditionalClassification = (List)value; + AdditionalClassification = (List?)value!; return this; case "relatedEntry": - RelatedEntry = (List)value; + RelatedEntry = (List?)value!; return this; default: return base.SetValue(key, value); @@ -632,19 +612,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (OrderableElement is not null) yield return new KeyValuePair("orderable",OrderableElement); - if (ReferencedItem is not null) yield return new KeyValuePair("referencedItem",ReferencedItem); - if (AdditionalIdentifier?.Any() == true) yield return new KeyValuePair("additionalIdentifier",AdditionalIdentifier); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (ValidToElement is not null) yield return new KeyValuePair("validTo",ValidToElement); - if (LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",LastUpdatedElement); - if (AdditionalCharacteristic?.Any() == true) yield return new KeyValuePair("additionalCharacteristic",AdditionalCharacteristic); - if (AdditionalClassification?.Any() == true) yield return new KeyValuePair("additionalClassification",AdditionalClassification); - if (RelatedEntry?.Any() == true) yield return new KeyValuePair("relatedEntry",RelatedEntry); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_OrderableElement is not null) yield return new KeyValuePair("orderable",_OrderableElement); + if (_ReferencedItem is not null) yield return new KeyValuePair("referencedItem",_ReferencedItem); + if (_AdditionalIdentifier?.Any() == true) yield return new KeyValuePair("additionalIdentifier",_AdditionalIdentifier); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_ValidToElement is not null) yield return new KeyValuePair("validTo",_ValidToElement); + if (_LastUpdatedElement is not null) yield return new KeyValuePair("lastUpdated",_LastUpdatedElement); + if (_AdditionalCharacteristic?.Any() == true) yield return new KeyValuePair("additionalCharacteristic",_AdditionalCharacteristic); + if (_AdditionalClassification?.Any() == true) yield return new KeyValuePair("additionalClassification",_AdditionalClassification); + if (_RelatedEntry?.Any() == true) yield return new KeyValuePair("relatedEntry",_RelatedEntry); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs index 95512cb7e..42f1b6ae1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,13 +136,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("ChargeItemPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual who was performing. @@ -149,26 +152,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,41 +179,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -225,8 +224,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -239,11 +238,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Defining information about the code of this charge item. @@ -253,24 +252,24 @@ public List Identifier [DataMember] public List DefinitionUriElement { - get { if(_DefinitionUriElement==null) _DefinitionUriElement = new List(); return _DefinitionUriElement; } + get => _DefinitionUriElement ?? new List(); set { _DefinitionUriElement = value; OnPropertyChanged("DefinitionUriElement"); } } - private List _DefinitionUriElement; + private List? _DefinitionUriElement; /// /// Defining information about the code of this charge item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DefinitionUri + public IEnumerable? DefinitionUri { - get { return DefinitionUriElement != null ? DefinitionUriElement.Select(elem => elem.Value) : null; } + get => _DefinitionUriElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionUriElement = null; + DefinitionUriElement = null!; else DefinitionUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DefinitionUri"); @@ -285,24 +284,24 @@ public IEnumerable DefinitionUri [DataMember] public List DefinitionCanonicalElement { - get { if(_DefinitionCanonicalElement==null) _DefinitionCanonicalElement = new List(); return _DefinitionCanonicalElement; } + get => _DefinitionCanonicalElement ?? new List(); set { _DefinitionCanonicalElement = value; OnPropertyChanged("DefinitionCanonicalElement"); } } - private List _DefinitionCanonicalElement; + private List? _DefinitionCanonicalElement; /// /// Resource defining the code of this ChargeItem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DefinitionCanonical + public IEnumerable? DefinitionCanonical { - get { return DefinitionCanonicalElement != null ? DefinitionCanonicalElement.Select(elem => elem.Value) : null; } + get => _DefinitionCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionCanonicalElement = null; + DefinitionCanonicalElement = null!; else DefinitionCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DefinitionCanonical"); @@ -317,13 +316,13 @@ public IEnumerable DefinitionCanonical [Binding("ChargeItemStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | billable | not-billable | aborted | billed | entered-in-error | unknown @@ -332,13 +331,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -353,11 +349,11 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// A code that identifies the charge, like a billing code. @@ -366,13 +362,13 @@ public List PartOf [Binding("ChargeItemCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Individual service was done for/to. @@ -382,13 +378,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with event. @@ -397,13 +393,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// When the charged service was applied. @@ -412,13 +408,13 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Who performed charged service. @@ -428,11 +424,11 @@ public Hl7.Fhir.Model.DataType Occurrence [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Organization providing the charged service. @@ -441,13 +437,13 @@ public List Performer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PerformingOrganization + public Hl7.Fhir.Model.ResourceReference? PerformingOrganization { get { return _PerformingOrganization; } set { _PerformingOrganization = value; OnPropertyChanged("PerformingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _PerformingOrganization; + private Hl7.Fhir.Model.ResourceReference? _PerformingOrganization; /// /// Organization requesting the charged service. @@ -456,13 +452,13 @@ public Hl7.Fhir.Model.ResourceReference PerformingOrganization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestingOrganization + public Hl7.Fhir.Model.ResourceReference? RequestingOrganization { get { return _RequestingOrganization; } set { _RequestingOrganization = value; OnPropertyChanged("RequestingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestingOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestingOrganization; /// /// Organization that has ownership of the (potential, future) revenue. @@ -471,26 +467,26 @@ public Hl7.Fhir.Model.ResourceReference RequestingOrganization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CostCenter + public Hl7.Fhir.Model.ResourceReference? CostCenter { get { return _CostCenter; } set { _CostCenter = value; OnPropertyChanged("CostCenter"); } } - private Hl7.Fhir.Model.ResourceReference _CostCenter; + private Hl7.Fhir.Model.ResourceReference? _CostCenter; /// /// Quantity of which the charge item has been serviced. /// [FhirElement("quantity", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Anatomical location, if relevant. @@ -501,24 +497,24 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Bodysite { - get { if(_Bodysite==null) _Bodysite = new List(); return _Bodysite; } + get => _Bodysite ?? new List(); set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } - private List _Bodysite; + private List? _Bodysite; /// /// Factor overriding the associated rules. /// [FhirElement("factorOverride", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorOverrideElement + public Hl7.Fhir.Model.FhirDecimal? FactorOverrideElement { get { return _FactorOverrideElement; } set { _FactorOverrideElement = value; OnPropertyChanged("FactorOverrideElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorOverrideElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorOverrideElement; /// /// Factor overriding the associated rules @@ -527,13 +523,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorOverrideElement [IgnoreDataMember] public decimal? FactorOverride { - get { return FactorOverrideElement != null ? FactorOverrideElement.Value : null; } + get => _FactorOverrideElement?.Value; set { - if (value == null) - FactorOverrideElement = null; - else - FactorOverrideElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorOverrideElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("FactorOverride"); } } @@ -543,41 +536,38 @@ public decimal? FactorOverride /// [FhirElement("priceOverride", Order=250)] [DataMember] - public Hl7.Fhir.Model.Money PriceOverride + public Hl7.Fhir.Model.Money? PriceOverride { get { return _PriceOverride; } set { _PriceOverride = value; OnPropertyChanged("PriceOverride"); } } - private Hl7.Fhir.Model.Money _PriceOverride; + private Hl7.Fhir.Model.Money? _PriceOverride; /// /// Reason for overriding the list price/factor. /// [FhirElement("overrideReason", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString OverrideReasonElement + public Hl7.Fhir.Model.FhirString? OverrideReasonElement { get { return _OverrideReasonElement; } set { _OverrideReasonElement = value; OnPropertyChanged("OverrideReasonElement"); } } - private Hl7.Fhir.Model.FhirString _OverrideReasonElement; + private Hl7.Fhir.Model.FhirString? _OverrideReasonElement; /// /// Reason for overriding the list price/factor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OverrideReason + public string? OverrideReason { - get { return OverrideReasonElement != null ? OverrideReasonElement.Value : null; } + get => _OverrideReasonElement?.Value; set { - if (value == null) - OverrideReasonElement = null; - else - OverrideReasonElement = new Hl7.Fhir.Model.FhirString(value); + OverrideReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OverrideReason"); } } @@ -589,41 +579,38 @@ public string OverrideReason [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Date the charge item was entered. /// [FhirElement("enteredDate", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EnteredDateElement + public Hl7.Fhir.Model.FhirDateTime? EnteredDateElement { get { return _EnteredDateElement; } set { _EnteredDateElement = value; OnPropertyChanged("EnteredDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EnteredDateElement; + private Hl7.Fhir.Model.FhirDateTime? _EnteredDateElement; /// /// Date the charge item was entered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EnteredDate + public string? EnteredDate { - get { return EnteredDateElement != null ? EnteredDateElement.Value : null; } + get => _EnteredDateElement?.Value; set { - if (value == null) - EnteredDateElement = null; - else - EnteredDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + EnteredDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EnteredDate"); } } @@ -637,11 +624,11 @@ public string EnteredDate [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Which rendered service is being charged?. @@ -653,11 +640,11 @@ public List Reason [DataMember] public List Service { - get { if(_Service==null) _Service = new List(); return _Service; } + get => _Service ?? new List(); set { _Service = value; OnPropertyChanged("Service"); } } - private List _Service; + private List? _Service; /// /// Product charged. @@ -668,13 +655,13 @@ public List Service [References("Device","Medication","Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// Account to place this charge. @@ -686,11 +673,11 @@ public Hl7.Fhir.Model.DataType Product [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Comments made about the ChargeItem. @@ -700,11 +687,11 @@ public List Account [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Further information supporting this charge. @@ -716,50 +703,46 @@ public List Note [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItem; - - if (dest == null) - { + if(other is not ChargeItem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(DefinitionUriElement.Any()) dest.DefinitionUriElement = new List(DefinitionUriElement.DeepCopyInternal()); - if(DefinitionCanonicalElement.Any()) dest.DefinitionCanonicalElement = new List(DefinitionCanonicalElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(PerformingOrganization != null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)PerformingOrganization.DeepCopyInternal(); - if(RequestingOrganization != null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)RequestingOrganization.DeepCopyInternal(); - if(CostCenter != null) dest.CostCenter = (Hl7.Fhir.Model.ResourceReference)CostCenter.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Bodysite.Any()) dest.Bodysite = new List(Bodysite.DeepCopyInternal()); - if(FactorOverrideElement != null) dest.FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)FactorOverrideElement.DeepCopyInternal(); - if(PriceOverride != null) dest.PriceOverride = (Hl7.Fhir.Model.Money)PriceOverride.DeepCopyInternal(); - if(OverrideReasonElement != null) dest.OverrideReasonElement = (Hl7.Fhir.Model.FhirString)OverrideReasonElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(EnteredDateElement != null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)EnteredDateElement.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Service.Any()) dest.Service = new List(Service.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_DefinitionUriElement is not null) dest.DefinitionUriElement = new List(_DefinitionUriElement.DeepCopyInternal()); + if(_DefinitionCanonicalElement is not null) dest.DefinitionCanonicalElement = new List(_DefinitionCanonicalElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_PerformingOrganization is not null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)_PerformingOrganization.DeepCopyInternal(); + if(_RequestingOrganization is not null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestingOrganization.DeepCopyInternal(); + if(_CostCenter is not null) dest.CostCenter = (Hl7.Fhir.Model.ResourceReference)_CostCenter.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Bodysite is not null) dest.Bodysite = new List(_Bodysite.DeepCopyInternal()); + if(_FactorOverrideElement is not null) dest.FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)_FactorOverrideElement.DeepCopyInternal(); + if(_PriceOverride is not null) dest.PriceOverride = (Hl7.Fhir.Model.Money)_PriceOverride.DeepCopyInternal(); + if(_OverrideReasonElement is not null) dest.OverrideReasonElement = (Hl7.Fhir.Model.FhirString)_OverrideReasonElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_EnteredDateElement is not null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)_EnteredDateElement.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Service is not null) dest.Service = new List(_Service.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -771,209 +754,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItem; - if(otherT == null) return false; + if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(DefinitionUriElement, otherT.DefinitionUriElement)) return false; - if(!comparer.ListEquals(DefinitionCanonicalElement, otherT.DefinitionCanonicalElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(PerformingOrganization, otherT.PerformingOrganization)) return false; - if(!comparer.Equals(RequestingOrganization, otherT.RequestingOrganization)) return false; - if(!comparer.Equals(CostCenter, otherT.CostCenter)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Bodysite, otherT.Bodysite)) return false; - if(!comparer.Equals(FactorOverrideElement, otherT.FactorOverrideElement)) return false; - if(!comparer.Equals(PriceOverride, otherT.PriceOverride)) return false; - if(!comparer.Equals(OverrideReasonElement, otherT.OverrideReasonElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(EnteredDateElement, otherT.EnteredDateElement)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Service, otherT.Service)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_DefinitionUriElement, otherT._DefinitionUriElement)) return false; + if(!comparer.ListEquals(_DefinitionCanonicalElement, otherT._DefinitionCanonicalElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_PerformingOrganization, otherT._PerformingOrganization)) return false; + if(!comparer.Equals(_RequestingOrganization, otherT._RequestingOrganization)) return false; + if(!comparer.Equals(_CostCenter, otherT._CostCenter)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Bodysite, otherT._Bodysite)) return false; + if(!comparer.Equals(_FactorOverrideElement, otherT._FactorOverrideElement)) return false; + if(!comparer.Equals(_PriceOverride, otherT._PriceOverride)) return false; + if(!comparer.Equals(_OverrideReasonElement, otherT._OverrideReasonElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_EnteredDateElement, otherT._EnteredDateElement)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Service, otherT._Service)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definitionUri": - value = DefinitionUriElement; - return DefinitionUriElement?.Any() == true; + value = _DefinitionUriElement; + return _DefinitionUriElement?.Any() == true; case "definitionCanonical": - value = DefinitionCanonicalElement; - return DefinitionCanonicalElement?.Any() == true; + value = _DefinitionCanonicalElement; + return _DefinitionCanonicalElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "performingOrganization": - value = PerformingOrganization; - return PerformingOrganization is not null; + value = _PerformingOrganization; + return _PerformingOrganization is not null; case "requestingOrganization": - value = RequestingOrganization; - return RequestingOrganization is not null; + value = _RequestingOrganization; + return _RequestingOrganization is not null; case "costCenter": - value = CostCenter; - return CostCenter is not null; + value = _CostCenter; + return _CostCenter is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "bodysite": - value = Bodysite; - return Bodysite?.Any() == true; + value = _Bodysite; + return _Bodysite?.Any() == true; case "factorOverride": - value = FactorOverrideElement; - return FactorOverrideElement is not null; + value = _FactorOverrideElement; + return _FactorOverrideElement is not null; case "priceOverride": - value = PriceOverride; - return PriceOverride is not null; + value = _PriceOverride; + return _PriceOverride is not null; case "overrideReason": - value = OverrideReasonElement; - return OverrideReasonElement is not null; + value = _OverrideReasonElement; + return _OverrideReasonElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "enteredDate": - value = EnteredDateElement; - return EnteredDateElement is not null; + value = _EnteredDateElement; + return _EnteredDateElement is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "service": - value = Service; - return Service?.Any() == true; + value = _Service; + return _Service?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definitionUri": - DefinitionUriElement = (List)value; + DefinitionUriElement = (List?)value!; return this; case "definitionCanonical": - DefinitionCanonicalElement = (List)value; + DefinitionCanonicalElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "performingOrganization": - PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + PerformingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestingOrganization": - RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "costCenter": - CostCenter = (Hl7.Fhir.Model.ResourceReference)value; + CostCenter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "bodysite": - Bodysite = (List)value; + Bodysite = (List?)value!; return this; case "factorOverride": - FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorOverrideElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "priceOverride": - PriceOverride = (Hl7.Fhir.Model.Money)value; + PriceOverride = (Hl7.Fhir.Model.Money?)value; return this; case "overrideReason": - OverrideReasonElement = (Hl7.Fhir.Model.FhirString)value; + OverrideReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "enteredDate": - EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "service": - Service = (List)value; + Service = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -984,32 +967,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (DefinitionUriElement?.Any() == true) yield return new KeyValuePair("definitionUri",DefinitionUriElement); - if (DefinitionCanonicalElement?.Any() == true) yield return new KeyValuePair("definitionCanonical",DefinitionCanonicalElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",PerformingOrganization); - if (RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",RequestingOrganization); - if (CostCenter is not null) yield return new KeyValuePair("costCenter",CostCenter); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",Bodysite); - if (FactorOverrideElement is not null) yield return new KeyValuePair("factorOverride",FactorOverrideElement); - if (PriceOverride is not null) yield return new KeyValuePair("priceOverride",PriceOverride); - if (OverrideReasonElement is not null) yield return new KeyValuePair("overrideReason",OverrideReasonElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",EnteredDateElement); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Service?.Any() == true) yield return new KeyValuePair("service",Service); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_DefinitionUriElement?.Any() == true) yield return new KeyValuePair("definitionUri",_DefinitionUriElement); + if (_DefinitionCanonicalElement?.Any() == true) yield return new KeyValuePair("definitionCanonical",_DefinitionCanonicalElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",_PerformingOrganization); + if (_RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",_RequestingOrganization); + if (_CostCenter is not null) yield return new KeyValuePair("costCenter",_CostCenter); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",_Bodysite); + if (_FactorOverrideElement is not null) yield return new KeyValuePair("factorOverride",_FactorOverrideElement); + if (_PriceOverride is not null) yield return new KeyValuePair("priceOverride",_PriceOverride); + if (_OverrideReasonElement is not null) yield return new KeyValuePair("overrideReason",_OverrideReasonElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",_EnteredDateElement); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Service?.Any() == true) yield return new KeyValuePair("service",_Service); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs index 925be1f78..e3dfd001a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,28 +84,25 @@ public partial class ApplicabilityComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -112,28 +112,25 @@ public string Description /// [FhirElement("language", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString LanguageElement + public Hl7.Fhir.Model.FhirString? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.FhirString _LanguageElement; + private Hl7.Fhir.Model.FhirString? _LanguageElement; /// /// Language of the expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.FhirString(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Language"); } } @@ -143,45 +140,38 @@ public string Language /// [FhirElement("expression", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Boolean-valued expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ApplicabilityComponent; - - if (dest == null) - { + if(other is not ApplicabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.FhirString)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -193,48 +183,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ApplicabilityComponent; - if(otherT == null) return false; + if(other is not ApplicabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.FhirString)value; + LanguageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -245,9 +235,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -276,11 +266,11 @@ public partial class PropertyGroupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Applicability { - get { if(_Applicability==null) _Applicability = new List(); return _Applicability; } + get => _Applicability ?? new List(); set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private List _Applicability; + private List? _Applicability; /// /// Components of total line item price. @@ -290,24 +280,20 @@ public List Applicab [DataMember] public List PriceComponent { - get { if(_PriceComponent==null) _PriceComponent = new List(); return _PriceComponent; } + get => _PriceComponent ?? new List(); set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } - private List _PriceComponent; + private List? _PriceComponent; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyGroupComponent; - - if (dest == null) - { + if(other is not PropertyGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Applicability.Any()) dest.Applicability = new List(Applicability.DeepCopyInternal()); - if(PriceComponent.Any()) dest.PriceComponent = new List(PriceComponent.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = new List(_Applicability.DeepCopyInternal()); + if(_PriceComponent is not null) dest.PriceComponent = new List(_PriceComponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -319,41 +305,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyGroupComponent; - if(otherT == null) return false; + if(other is not PropertyGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(PriceComponent, otherT.PriceComponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "applicability": - value = Applicability; - return Applicability?.Any() == true; + value = _Applicability; + return _Applicability?.Any() == true; case "priceComponent": - value = PriceComponent; - return PriceComponent?.Any() == true; + value = _PriceComponent; + return _PriceComponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "applicability": - Applicability = (List)value; + Applicability = (List?)value!; return this; case "priceComponent": - PriceComponent = (List)value; + PriceComponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -364,8 +350,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Applicability?.Any() == true) yield return new KeyValuePair("applicability",Applicability); - if (PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",PriceComponent); + if (_Applicability?.Any() == true) yield return new KeyValuePair("applicability",_Applicability); + if (_PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",_PriceComponent); } } @@ -394,13 +380,13 @@ public partial class PriceComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("ChargeItemDefinitionPriceComponentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// base | surcharge | deduction | discount | tax | informational @@ -409,13 +395,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.InvoicePriceComponentType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -425,26 +408,26 @@ public Hl7.Fhir.Model.InvoicePriceComponentType? Type /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Factor used for calculating this component. /// [FhirElement("factor", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Factor used for calculating this component @@ -453,13 +436,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -469,28 +449,24 @@ public decimal? Factor /// [FhirElement("amount", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as PriceComponentComponent; - - if (dest == null) - { + if(other is not PriceComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -502,55 +478,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PriceComponentComponent; - if(otherT == null) return false; + if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -561,10 +537,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -575,28 +551,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this charge item definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -609,39 +582,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the charge item definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -651,28 +621,25 @@ public string Version /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this charge item definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -685,24 +652,24 @@ public string Title [DataMember] public List DerivedFromUriElement { - get { if(_DerivedFromUriElement==null) _DerivedFromUriElement = new List(); return _DerivedFromUriElement; } + get => _DerivedFromUriElement ?? new List(); set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } - private List _DerivedFromUriElement; + private List? _DerivedFromUriElement; /// /// Underlying externally-defined charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFromUri + public IEnumerable? DerivedFromUri { - get { return DerivedFromUriElement != null ? DerivedFromUriElement.Select(elem => elem.Value) : null; } + get => _DerivedFromUriElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromUriElement = null; + DerivedFromUriElement = null!; else DerivedFromUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DerivedFromUri"); @@ -717,24 +684,24 @@ public IEnumerable DerivedFromUri [DataMember] public List PartOfElement { - get { if(_PartOfElement==null) _PartOfElement = new List(); return _PartOfElement; } + get => _PartOfElement ?? new List(); set { _PartOfElement = value; OnPropertyChanged("PartOfElement"); } } - private List _PartOfElement; + private List? _PartOfElement; /// /// A larger definition of which this particular definition is a component or step /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PartOf + public IEnumerable? PartOf { - get { return PartOfElement != null ? PartOfElement.Select(elem => elem.Value) : null; } + get => _PartOfElement?.Select(elem => elem.Value); set { if (value == null) - PartOfElement = null; + PartOfElement = null!; else PartOfElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("PartOf"); @@ -749,24 +716,24 @@ public IEnumerable PartOf [DataMember] public List ReplacesElement { - get { if(_ReplacesElement==null) _ReplacesElement = new List(); return _ReplacesElement; } + get => _ReplacesElement ?? new List(); set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } - private List _ReplacesElement; + private List? _ReplacesElement; /// /// Completed or terminated request(s) whose function is taken by this new request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Replaces + public IEnumerable? Replaces { - get { return ReplacesElement != null ? ReplacesElement.Select(elem => elem.Value) : null; } + get => _ReplacesElement?.Select(elem => elem.Value); set { if (value == null) - ReplacesElement = null; + ReplacesElement = null!; else ReplacesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Replaces"); @@ -781,13 +748,13 @@ public IEnumerable Replaces [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -796,13 +763,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -812,13 +776,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -827,13 +791,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -843,28 +804,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -874,28 +832,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -908,39 +863,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the charge item definition. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -953,11 +905,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for charge item definition (if applicable). @@ -968,39 +920,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1010,28 +959,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=250)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the charge item definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1041,28 +987,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the charge item definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1072,13 +1015,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Billing codes or product types this definition applies to. @@ -1086,13 +1029,13 @@ public Hl7.Fhir.Model.Period EffectivePeriod [FhirElement("code", InSummary=true, Order=280)] [Binding("ChargeItemDefinitionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Instances this definition applies to. @@ -1104,11 +1047,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Whether or not the billing code is applicable. @@ -1118,11 +1061,11 @@ public List Instance [DataMember] public List Applicability { - get { if(_Applicability==null) _Applicability = new List(); return _Applicability; } + get => _Applicability ?? new List(); set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private List _Applicability; + private List? _Applicability; /// /// Group of properties which are applicable under the same conditions. @@ -1132,47 +1075,43 @@ public List Applicab [DataMember] public List PropertyGroup { - get { if(_PropertyGroup==null) _PropertyGroup = new List(); return _PropertyGroup; } + get => _PropertyGroup ?? new List(); set { _PropertyGroup = value; OnPropertyChanged("PropertyGroup"); } } - private List _PropertyGroup; + private List? _PropertyGroup; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItemDefinition; - - if (dest == null) - { + if(other is not ChargeItemDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromUriElement.Any()) dest.DerivedFromUriElement = new List(DerivedFromUriElement.DeepCopyInternal()); - if(PartOfElement.Any()) dest.PartOfElement = new List(PartOfElement.DeepCopyInternal()); - if(ReplacesElement.Any()) dest.ReplacesElement = new List(ReplacesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Applicability.Any()) dest.Applicability = new List(Applicability.DeepCopyInternal()); - if(PropertyGroup.Any()) dest.PropertyGroup = new List(PropertyGroup.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromUriElement is not null) dest.DerivedFromUriElement = new List(_DerivedFromUriElement.DeepCopyInternal()); + if(_PartOfElement is not null) dest.PartOfElement = new List(_PartOfElement.DeepCopyInternal()); + if(_ReplacesElement is not null) dest.ReplacesElement = new List(_ReplacesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = new List(_Applicability.DeepCopyInternal()); + if(_PropertyGroup is not null) dest.PropertyGroup = new List(_PropertyGroup.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1184,188 +1123,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItemDefinition; - if(otherT == null) return false; + if(other is not ChargeItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromUriElement, otherT.DerivedFromUriElement)) return false; - if(!comparer.ListEquals(PartOfElement, otherT.PartOfElement)) return false; - if(!comparer.ListEquals(ReplacesElement, otherT.ReplacesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(PropertyGroup, otherT.PropertyGroup)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromUriElement, otherT._DerivedFromUriElement)) return false; + if(!comparer.ListEquals(_PartOfElement, otherT._PartOfElement)) return false; + if(!comparer.ListEquals(_ReplacesElement, otherT._ReplacesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_PropertyGroup, otherT._PropertyGroup)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFromUri": - value = DerivedFromUriElement; - return DerivedFromUriElement?.Any() == true; + value = _DerivedFromUriElement; + return _DerivedFromUriElement?.Any() == true; case "partOf": - value = PartOfElement; - return PartOfElement?.Any() == true; + value = _PartOfElement; + return _PartOfElement?.Any() == true; case "replaces": - value = ReplacesElement; - return ReplacesElement?.Any() == true; + value = _ReplacesElement; + return _ReplacesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "applicability": - value = Applicability; - return Applicability?.Any() == true; + value = _Applicability; + return _Applicability?.Any() == true; case "propertyGroup": - value = PropertyGroup; - return PropertyGroup?.Any() == true; + value = _PropertyGroup; + return _PropertyGroup?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFromUri": - DerivedFromUriElement = (List)value; + DerivedFromUriElement = (List?)value!; return this; case "partOf": - PartOfElement = (List)value; + PartOfElement = (List?)value!; return this; case "replaces": - ReplacesElement = (List)value; + ReplacesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "applicability": - Applicability = (List)value; + Applicability = (List?)value!; return this; case "propertyGroup": - PropertyGroup = (List)value; + PropertyGroup = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1376,29 +1315,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",DerivedFromUriElement); - if (PartOfElement?.Any() == true) yield return new KeyValuePair("partOf",PartOfElement); - if (ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",ReplacesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Applicability?.Any() == true) yield return new KeyValuePair("applicability",Applicability); - if (PropertyGroup?.Any() == true) yield return new KeyValuePair("propertyGroup",PropertyGroup); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",_DerivedFromUriElement); + if (_PartOfElement?.Any() == true) yield return new KeyValuePair("partOf",_PartOfElement); + if (_ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",_ReplacesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Applicability?.Any() == true) yield return new KeyValuePair("applicability",_Applicability); + if (_PropertyGroup?.Any() == true) yield return new KeyValuePair("propertyGroup",_PropertyGroup); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs index 6c8ff623a..0a1709efd 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,13 +81,13 @@ public partial class SummaryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("style", Order=40)] [Binding("CitationSummaryStyle")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Style + public Hl7.Fhir.Model.CodeableConcept? Style { get { return _Style; } set { _Style = value; OnPropertyChanged("Style"); } } - private Hl7.Fhir.Model.CodeableConcept _Style; + private Hl7.Fhir.Model.CodeableConcept? _Style; /// /// The human-readable display of the citation. @@ -92,44 +95,37 @@ public Hl7.Fhir.Model.CodeableConcept Style [FhirElement("text", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// The human-readable display of the citation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SummaryComponent; - - if (dest == null) - { + if(other is not SummaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Style != null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)Style.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Style is not null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)_Style.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -141,41 +137,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SummaryComponent; - if(otherT == null) return false; + if(other is not SummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Style, otherT.Style)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Style, otherT._Style)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "style": - value = Style; - return Style is not null; + value = _Style; + return _Style is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "style": - Style = (Hl7.Fhir.Model.CodeableConcept)value; + Style = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -186,8 +182,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Style is not null) yield return new KeyValuePair("style",Style); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Style is not null) yield return new KeyValuePair("style",_Style); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -211,13 +207,13 @@ public partial class ClassificationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("CitationClassificationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specific classification value. @@ -228,24 +224,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; protected internal override void CopyToInternal(Base other) { - var dest = other as ClassificationComponent; - - if (dest == null) - { + if(other is not ClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -257,41 +249,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassificationComponent; - if(otherT == null) return false; + if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -302,8 +294,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); } } @@ -328,26 +320,26 @@ public partial class StatusDateComponent : Hl7.Fhir.Model.BackboneElement [Binding("CitationStatusType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Activity + public Hl7.Fhir.Model.CodeableConcept? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.CodeableConcept _Activity; + private Hl7.Fhir.Model.CodeableConcept? _Activity; /// /// Either occurred or expected. /// [FhirElement("actual", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Either occurred or expected @@ -356,13 +348,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -373,27 +362,23 @@ public bool? Actual [FhirElement("period", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusDateComponent; - - if (dest == null) - { + if(other is not StatusDateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)_Activity.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -405,48 +390,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusDateComponent; - if(otherT == null) return false; + if(other is not StatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "activity": - Activity = (Hl7.Fhir.Model.CodeableConcept)value; + Activity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -457,9 +442,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -484,13 +469,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("ArtifactRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RelationshipType + public Hl7.Fhir.Model.CodeableConcept? RelationshipType { get { return _RelationshipType; } set { _RelationshipType = value; OnPropertyChanged("RelationshipType"); } } - private Hl7.Fhir.Model.CodeableConcept _RelationshipType; + private Hl7.Fhir.Model.CodeableConcept? _RelationshipType; /// /// The clasification of the related artifact. @@ -501,11 +486,11 @@ public Hl7.Fhir.Model.CodeableConcept RelationshipType [DataMember] public List TargetClassifier { - get { if(_TargetClassifier==null) _TargetClassifier = new List(); return _TargetClassifier; } + get => _TargetClassifier ?? new List(); set { _TargetClassifier = value; OnPropertyChanged("TargetClassifier"); } } - private List _TargetClassifier; + private List? _TargetClassifier; /// /// The article or artifact that the Citation Resource is related to. @@ -516,27 +501,23 @@ public List TargetClassifier [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Attachment))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RelationshipType != null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)RelationshipType.DeepCopyInternal(); - if(TargetClassifier.Any()) dest.TargetClassifier = new List(TargetClassifier.DeepCopyInternal()); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); + if(_RelationshipType is not null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)_RelationshipType.DeepCopyInternal(); + if(_TargetClassifier is not null) dest.TargetClassifier = new List(_TargetClassifier.DeepCopyInternal()); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -548,48 +529,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RelationshipType, otherT.RelationshipType)) return false; - if(!comparer.ListEquals(TargetClassifier, otherT.TargetClassifier)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + if(!comparer.ListEquals(_TargetClassifier, otherT._TargetClassifier)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationshipType": - value = RelationshipType; - return RelationshipType is not null; + value = _RelationshipType; + return _RelationshipType is not null; case "targetClassifier": - value = TargetClassifier; - return TargetClassifier?.Any() == true; + value = _TargetClassifier; + return _TargetClassifier?.Any() == true; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationshipType": - RelationshipType = (Hl7.Fhir.Model.CodeableConcept)value; + RelationshipType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "targetClassifier": - TargetClassifier = (List)value; + TargetClassifier = (List?)value!; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -600,9 +581,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RelationshipType is not null) yield return new KeyValuePair("relationshipType",RelationshipType); - if (TargetClassifier?.Any() == true) yield return new KeyValuePair("targetClassifier",TargetClassifier); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_RelationshipType is not null) yield return new KeyValuePair("relationshipType",_RelationshipType); + if (_TargetClassifier?.Any() == true) yield return new KeyValuePair("targetClassifier",_TargetClassifier); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -628,11 +609,11 @@ public partial class CitedArtifactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// May include trial registry identifiers. @@ -642,39 +623,36 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get { if(_RelatedIdentifier==null) _RelatedIdentifier = new List(); return _RelatedIdentifier; } + get => _RelatedIdentifier ?? new List(); set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } - private List _RelatedIdentifier; + private List? _RelatedIdentifier; /// /// When the cited artifact was accessed. /// [FhirElement("dateAccessed", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateAccessedElement + public Hl7.Fhir.Model.FhirDateTime? DateAccessedElement { get { return _DateAccessedElement; } set { _DateAccessedElement = value; OnPropertyChanged("DateAccessedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateAccessedElement; + private Hl7.Fhir.Model.FhirDateTime? _DateAccessedElement; /// /// When the cited artifact was accessed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateAccessed + public string? DateAccessed { - get { return DateAccessedElement != null ? DateAccessedElement.Value : null; } + get => _DateAccessedElement?.Value; set { - if (value == null) - DateAccessedElement = null; - else - DateAccessedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateAccessedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateAccessed"); } } @@ -684,13 +662,13 @@ public string DateAccessed /// [FhirElement("version", Order=70)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent Version + public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent? Version { get { return _Version; } set { _Version = value; OnPropertyChanged("Version"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent _Version; + private Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent? _Version; /// /// The status of the cited artifact. @@ -701,11 +679,11 @@ public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent Version [DataMember] public List CurrentState { - get { if(_CurrentState==null) _CurrentState = new List(); return _CurrentState; } + get => _CurrentState ?? new List(); set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } - private List _CurrentState; + private List? _CurrentState; /// /// An effective date or period for a status of the cited artifact. @@ -715,11 +693,11 @@ public List CurrentState [DataMember] public List StatusDate { - get { if(_StatusDate==null) _StatusDate = new List(); return _StatusDate; } + get => _StatusDate ?? new List(); set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } - private List _StatusDate; + private List? _StatusDate; /// /// The title details of the article or artifact. @@ -729,11 +707,11 @@ public List StatusDate [DataMember] public List Title { - get { if(_Title==null) _Title = new List(); return _Title; } + get => _Title ?? new List(); set { _Title = value; OnPropertyChanged("Title"); } } - private List _Title; + private List? _Title; /// /// Summary of the article or artifact. @@ -743,24 +721,24 @@ public List Title [DataMember] public List Abstract { - get { if(_Abstract==null) _Abstract = new List(); return _Abstract; } + get => _Abstract ?? new List(); set { _Abstract = value; OnPropertyChanged("Abstract"); } } - private List _Abstract; + private List? _Abstract; /// /// The component of the article or artifact. /// [FhirElement("part", Order=120)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent Part + public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent? Part { get { return _Part; } set { _Part = value; OnPropertyChanged("Part"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactPartComponent _Part; + private Hl7.Fhir.Model.Citation.CitedArtifactPartComponent? _Part; /// /// The artifact related to the cited artifact. @@ -770,11 +748,11 @@ public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent Part [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// If multiple, used to represent alternative forms of the article that are not separate citations. @@ -784,11 +762,11 @@ public List RelatesTo [DataMember] public List PublicationForm { - get { if(_PublicationForm==null) _PublicationForm = new List(); return _PublicationForm; } + get => _PublicationForm ?? new List(); set { _PublicationForm = value; OnPropertyChanged("PublicationForm"); } } - private List _PublicationForm; + private List? _PublicationForm; /// /// Used for any URL for the article or artifact cited. @@ -798,11 +776,11 @@ public List Publi [DataMember] public List WebLocation { - get { if(_WebLocation==null) _WebLocation = new List(); return _WebLocation; } + get => _WebLocation ?? new List(); set { _WebLocation = value; OnPropertyChanged("WebLocation"); } } - private List _WebLocation; + private List? _WebLocation; /// /// The assignment to an organizing scheme. @@ -812,24 +790,24 @@ public List WebLocati [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Attribution of authors and other contributors. /// [FhirElement("contributorship", Order=170)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent Contributorship + public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent? Contributorship { get { return _Contributorship; } set { _Contributorship = value; OnPropertyChanged("Contributorship"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent _Contributorship; + private Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent? _Contributorship; /// /// Any additional information or content for the article or artifact. @@ -839,37 +817,33 @@ public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent Contributor [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactComponent; - - if (dest == null) - { + if(other is not CitedArtifactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(RelatedIdentifier.Any()) dest.RelatedIdentifier = new List(RelatedIdentifier.DeepCopyInternal()); - if(DateAccessedElement != null) dest.DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime)DateAccessedElement.DeepCopyInternal(); - if(Version != null) dest.Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent)Version.DeepCopyInternal(); - if(CurrentState.Any()) dest.CurrentState = new List(CurrentState.DeepCopyInternal()); - if(StatusDate.Any()) dest.StatusDate = new List(StatusDate.DeepCopyInternal()); - if(Title.Any()) dest.Title = new List(Title.DeepCopyInternal()); - if(Abstract.Any()) dest.Abstract = new List(Abstract.DeepCopyInternal()); - if(Part != null) dest.Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent)Part.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(PublicationForm.Any()) dest.PublicationForm = new List(PublicationForm.DeepCopyInternal()); - if(WebLocation.Any()) dest.WebLocation = new List(WebLocation.DeepCopyInternal()); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(Contributorship != null) dest.Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent)Contributorship.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_RelatedIdentifier is not null) dest.RelatedIdentifier = new List(_RelatedIdentifier.DeepCopyInternal()); + if(_DateAccessedElement is not null) dest.DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime)_DateAccessedElement.DeepCopyInternal(); + if(_Version is not null) dest.Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent)_Version.DeepCopyInternal(); + if(_CurrentState is not null) dest.CurrentState = new List(_CurrentState.DeepCopyInternal()); + if(_StatusDate is not null) dest.StatusDate = new List(_StatusDate.DeepCopyInternal()); + if(_Title is not null) dest.Title = new List(_Title.DeepCopyInternal()); + if(_Abstract is not null) dest.Abstract = new List(_Abstract.DeepCopyInternal()); + if(_Part is not null) dest.Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent)_Part.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_PublicationForm is not null) dest.PublicationForm = new List(_PublicationForm.DeepCopyInternal()); + if(_WebLocation is not null) dest.WebLocation = new List(_WebLocation.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_Contributorship is not null) dest.Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent)_Contributorship.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -881,132 +855,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactComponent; - if(otherT == null) return false; + if(other is not CitedArtifactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(RelatedIdentifier, otherT.RelatedIdentifier)) return false; - if(!comparer.Equals(DateAccessedElement, otherT.DateAccessedElement)) return false; - if(!comparer.Equals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(CurrentState, otherT.CurrentState)) return false; - if(!comparer.ListEquals(StatusDate, otherT.StatusDate)) return false; - if(!comparer.ListEquals(Title, otherT.Title)) return false; - if(!comparer.ListEquals(Abstract, otherT.Abstract)) return false; - if(!comparer.Equals(Part, otherT.Part)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(PublicationForm, otherT.PublicationForm)) return false; - if(!comparer.ListEquals(WebLocation, otherT.WebLocation)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(Contributorship, otherT.Contributorship)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_RelatedIdentifier, otherT._RelatedIdentifier)) return false; + if(!comparer.Equals(_DateAccessedElement, otherT._DateAccessedElement)) return false; + if(!comparer.Equals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_CurrentState, otherT._CurrentState)) return false; + if(!comparer.ListEquals(_StatusDate, otherT._StatusDate)) return false; + if(!comparer.ListEquals(_Title, otherT._Title)) return false; + if(!comparer.ListEquals(_Abstract, otherT._Abstract)) return false; + if(!comparer.Equals(_Part, otherT._Part)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_PublicationForm, otherT._PublicationForm)) return false; + if(!comparer.ListEquals(_WebLocation, otherT._WebLocation)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_Contributorship, otherT._Contributorship)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "relatedIdentifier": - value = RelatedIdentifier; - return RelatedIdentifier?.Any() == true; + value = _RelatedIdentifier; + return _RelatedIdentifier?.Any() == true; case "dateAccessed": - value = DateAccessedElement; - return DateAccessedElement is not null; + value = _DateAccessedElement; + return _DateAccessedElement is not null; case "version": - value = Version; - return Version is not null; + value = _Version; + return _Version is not null; case "currentState": - value = CurrentState; - return CurrentState?.Any() == true; + value = _CurrentState; + return _CurrentState?.Any() == true; case "statusDate": - value = StatusDate; - return StatusDate?.Any() == true; + value = _StatusDate; + return _StatusDate?.Any() == true; case "title": - value = Title; - return Title?.Any() == true; + value = _Title; + return _Title?.Any() == true; case "abstract": - value = Abstract; - return Abstract?.Any() == true; + value = _Abstract; + return _Abstract?.Any() == true; case "part": - value = Part; - return Part is not null; + value = _Part; + return _Part is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "publicationForm": - value = PublicationForm; - return PublicationForm?.Any() == true; + value = _PublicationForm; + return _PublicationForm?.Any() == true; case "webLocation": - value = WebLocation; - return WebLocation?.Any() == true; + value = _WebLocation; + return _WebLocation?.Any() == true; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "contributorship": - value = Contributorship; - return Contributorship is not null; + value = _Contributorship; + return _Contributorship is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "relatedIdentifier": - RelatedIdentifier = (List)value; + RelatedIdentifier = (List?)value!; return this; case "dateAccessed": - DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "version": - Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent)value; + Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent?)value; return this; case "currentState": - CurrentState = (List)value; + CurrentState = (List?)value!; return this; case "statusDate": - StatusDate = (List)value; + StatusDate = (List?)value!; return this; case "title": - Title = (List)value; + Title = (List?)value!; return this; case "abstract": - Abstract = (List)value; + Abstract = (List?)value!; return this; case "part": - Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent)value; + Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "publicationForm": - PublicationForm = (List)value; + PublicationForm = (List?)value!; return this; case "webLocation": - WebLocation = (List)value; + WebLocation = (List?)value!; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "contributorship": - Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent)value; + Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1017,21 +991,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",RelatedIdentifier); - if (DateAccessedElement is not null) yield return new KeyValuePair("dateAccessed",DateAccessedElement); - if (Version is not null) yield return new KeyValuePair("version",Version); - if (CurrentState?.Any() == true) yield return new KeyValuePair("currentState",CurrentState); - if (StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",StatusDate); - if (Title?.Any() == true) yield return new KeyValuePair("title",Title); - if (Abstract?.Any() == true) yield return new KeyValuePair("abstract",Abstract); - if (Part is not null) yield return new KeyValuePair("part",Part); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (PublicationForm?.Any() == true) yield return new KeyValuePair("publicationForm",PublicationForm); - if (WebLocation?.Any() == true) yield return new KeyValuePair("webLocation",WebLocation); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (Contributorship is not null) yield return new KeyValuePair("contributorship",Contributorship); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",_RelatedIdentifier); + if (_DateAccessedElement is not null) yield return new KeyValuePair("dateAccessed",_DateAccessedElement); + if (_Version is not null) yield return new KeyValuePair("version",_Version); + if (_CurrentState?.Any() == true) yield return new KeyValuePair("currentState",_CurrentState); + if (_StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",_StatusDate); + if (_Title?.Any() == true) yield return new KeyValuePair("title",_Title); + if (_Abstract?.Any() == true) yield return new KeyValuePair("abstract",_Abstract); + if (_Part is not null) yield return new KeyValuePair("part",_Part); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_PublicationForm?.Any() == true) yield return new KeyValuePair("publicationForm",_PublicationForm); + if (_WebLocation?.Any() == true) yield return new KeyValuePair("webLocation",_WebLocation); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_Contributorship is not null) yield return new KeyValuePair("contributorship",_Contributorship); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -1055,28 +1029,25 @@ public partial class CitedArtifactVersionComponent : Hl7.Fhir.Model.BackboneElem [FhirElement("value", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The version number or other version identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -1088,26 +1059,22 @@ public string Value [CLSCompliant(false)] [References("Citation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BaseCitation + public Hl7.Fhir.Model.ResourceReference? BaseCitation { get { return _BaseCitation; } set { _BaseCitation = value; OnPropertyChanged("BaseCitation"); } } - private Hl7.Fhir.Model.ResourceReference _BaseCitation; + private Hl7.Fhir.Model.ResourceReference? _BaseCitation; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactVersionComponent; - - if (dest == null) - { + if(other is not CitedArtifactVersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(BaseCitation != null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)BaseCitation.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_BaseCitation is not null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)_BaseCitation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1119,41 +1086,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactVersionComponent; - if(otherT == null) return false; + if(other is not CitedArtifactVersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(BaseCitation, otherT.BaseCitation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "baseCitation": - value = BaseCitation; - return BaseCitation is not null; + value = _BaseCitation; + return _BaseCitation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "baseCitation": - BaseCitation = (Hl7.Fhir.Model.ResourceReference)value; + BaseCitation = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1164,8 +1131,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (BaseCitation is not null) yield return new KeyValuePair("baseCitation",BaseCitation); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_BaseCitation is not null) yield return new KeyValuePair("baseCitation",_BaseCitation); } } @@ -1190,26 +1157,26 @@ public partial class CitedArtifactStatusDateComponent : Hl7.Fhir.Model.BackboneE [Binding("CitedArtifactStatusType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Activity + public Hl7.Fhir.Model.CodeableConcept? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.CodeableConcept _Activity; + private Hl7.Fhir.Model.CodeableConcept? _Activity; /// /// Either occurred or expected. /// [FhirElement("actual", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Either occurred or expected @@ -1218,13 +1185,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -1235,27 +1199,23 @@ public bool? Actual [FhirElement("period", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactStatusDateComponent; - - if (dest == null) - { + if(other is not CitedArtifactStatusDateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)_Activity.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1267,48 +1227,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactStatusDateComponent; - if(otherT == null) return false; + if(other is not CitedArtifactStatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "activity": - Activity = (Hl7.Fhir.Model.CodeableConcept)value; + Activity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -1319,9 +1279,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -1348,11 +1308,11 @@ public partial class CitedArtifactTitleComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Used to express the specific language. @@ -1360,13 +1320,13 @@ public List Type [FhirElement("language", Order=50)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// The title of the article or artifact. @@ -1374,45 +1334,38 @@ public Hl7.Fhir.Model.CodeableConcept Language [FhirElement("text", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// The title of the article or artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactTitleComponent; - - if (dest == null) - { + if(other is not CitedArtifactTitleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1424,48 +1377,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactTitleComponent; - if(otherT == null) return false; + if(other is not CitedArtifactTitleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1476,9 +1429,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Language is not null) yield return new KeyValuePair("language",Language); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -1502,13 +1455,13 @@ public partial class CitedArtifactAbstractComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("type", Order=40)] [Binding("CitedArtifactAbstractType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Used to express the specific language. @@ -1516,13 +1469,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("language", Order=50)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Abstract content. @@ -1530,28 +1483,25 @@ public Hl7.Fhir.Model.CodeableConcept Language [FhirElement("text", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// Abstract content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } @@ -1561,46 +1511,39 @@ public string Text /// [FhirElement("copyright", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Copyright notice for the abstract /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactAbstractComponent; - - if (dest == null) - { + if(other is not CitedArtifactAbstractComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1612,55 +1555,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactAbstractComponent; - if(otherT == null) return false; + if(other is not CitedArtifactAbstractComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1671,10 +1614,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Language is not null) yield return new KeyValuePair("language",Language); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -1698,41 +1641,38 @@ public partial class CitedArtifactPartComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("CitedArtifactPartType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specification of the component. /// [FhirElement("value", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The specification of the component /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -1744,27 +1684,23 @@ public string Value [CLSCompliant(false)] [References("Citation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BaseCitation + public Hl7.Fhir.Model.ResourceReference? BaseCitation { get { return _BaseCitation; } set { _BaseCitation = value; OnPropertyChanged("BaseCitation"); } } - private Hl7.Fhir.Model.ResourceReference _BaseCitation; + private Hl7.Fhir.Model.ResourceReference? _BaseCitation; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPartComponent; - - if (dest == null) - { + if(other is not CitedArtifactPartComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(BaseCitation != null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)BaseCitation.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_BaseCitation is not null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)_BaseCitation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1776,48 +1712,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPartComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(BaseCitation, otherT.BaseCitation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "baseCitation": - value = BaseCitation; - return BaseCitation is not null; + value = _BaseCitation; + return _BaseCitation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "baseCitation": - BaseCitation = (Hl7.Fhir.Model.ResourceReference)value; + BaseCitation = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1828,9 +1764,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (BaseCitation is not null) yield return new KeyValuePair("baseCitation",BaseCitation); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_BaseCitation is not null) yield return new KeyValuePair("baseCitation",_BaseCitation); } } @@ -1855,13 +1791,13 @@ public partial class CitedArtifactRelatesToComponent : Hl7.Fhir.Model.BackboneEl [Binding("ArtifactRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RelationshipType + public Hl7.Fhir.Model.CodeableConcept? RelationshipType { get { return _RelationshipType; } set { _RelationshipType = value; OnPropertyChanged("RelationshipType"); } } - private Hl7.Fhir.Model.CodeableConcept _RelationshipType; + private Hl7.Fhir.Model.CodeableConcept? _RelationshipType; /// /// The clasification of the related artifact. @@ -1872,11 +1808,11 @@ public Hl7.Fhir.Model.CodeableConcept RelationshipType [DataMember] public List TargetClassifier { - get { if(_TargetClassifier==null) _TargetClassifier = new List(); return _TargetClassifier; } + get => _TargetClassifier ?? new List(); set { _TargetClassifier = value; OnPropertyChanged("TargetClassifier"); } } - private List _TargetClassifier; + private List? _TargetClassifier; /// /// The article or artifact that the cited artifact is related to. @@ -1887,27 +1823,23 @@ public List TargetClassifier [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Attachment))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactRelatesToComponent; - - if (dest == null) - { + if(other is not CitedArtifactRelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RelationshipType != null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)RelationshipType.DeepCopyInternal(); - if(TargetClassifier.Any()) dest.TargetClassifier = new List(TargetClassifier.DeepCopyInternal()); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); + if(_RelationshipType is not null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)_RelationshipType.DeepCopyInternal(); + if(_TargetClassifier is not null) dest.TargetClassifier = new List(_TargetClassifier.DeepCopyInternal()); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1919,48 +1851,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactRelatesToComponent; - if(otherT == null) return false; + if(other is not CitedArtifactRelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RelationshipType, otherT.RelationshipType)) return false; - if(!comparer.ListEquals(TargetClassifier, otherT.TargetClassifier)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + if(!comparer.ListEquals(_TargetClassifier, otherT._TargetClassifier)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationshipType": - value = RelationshipType; - return RelationshipType is not null; + value = _RelationshipType; + return _RelationshipType is not null; case "targetClassifier": - value = TargetClassifier; - return TargetClassifier?.Any() == true; + value = _TargetClassifier; + return _TargetClassifier?.Any() == true; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationshipType": - RelationshipType = (Hl7.Fhir.Model.CodeableConcept)value; + RelationshipType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "targetClassifier": - TargetClassifier = (List)value; + TargetClassifier = (List?)value!; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1971,9 +1903,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RelationshipType is not null) yield return new KeyValuePair("relationshipType",RelationshipType); - if (TargetClassifier?.Any() == true) yield return new KeyValuePair("targetClassifier",TargetClassifier); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_RelationshipType is not null) yield return new KeyValuePair("relationshipType",_RelationshipType); + if (_TargetClassifier?.Any() == true) yield return new KeyValuePair("targetClassifier",_TargetClassifier); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -1999,54 +1931,51 @@ public partial class CitedArtifactPublicationFormComponent : Hl7.Fhir.Model.Back /// [FhirElement("publishedIn", Order=40)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent PublishedIn + public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent? PublishedIn { get { return _PublishedIn; } set { _PublishedIn = value; OnPropertyChanged("PublishedIn"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent _PublishedIn; + private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent? _PublishedIn; /// /// The specific issue in which the cited article resides. /// [FhirElement("periodicRelease", Order=50)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent PeriodicRelease + public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent? PeriodicRelease { get { return _PeriodicRelease; } set { _PeriodicRelease = value; OnPropertyChanged("PeriodicRelease"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent _PeriodicRelease; + private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent? _PeriodicRelease; /// /// The date the article was added to the database, or the date the article was released. /// [FhirElement("articleDate", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ArticleDateElement + public Hl7.Fhir.Model.FhirDateTime? ArticleDateElement { get { return _ArticleDateElement; } set { _ArticleDateElement = value; OnPropertyChanged("ArticleDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ArticleDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ArticleDateElement; /// /// The date the article was added to the database, or the date the article was released /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ArticleDate + public string? ArticleDate { - get { return ArticleDateElement != null ? ArticleDateElement.Value : null; } + get => _ArticleDateElement?.Value; set { - if (value == null) - ArticleDateElement = null; - else - ArticleDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ArticleDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ArticleDate"); } } @@ -2056,28 +1985,25 @@ public string ArticleDate /// [FhirElement("lastRevisionDate", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastRevisionDateElement + public Hl7.Fhir.Model.FhirDateTime? LastRevisionDateElement { get { return _LastRevisionDateElement; } set { _LastRevisionDateElement = value; OnPropertyChanged("LastRevisionDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastRevisionDateElement; + private Hl7.Fhir.Model.FhirDateTime? _LastRevisionDateElement; /// /// The date the article was last revised or updated in the database /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastRevisionDate + public string? LastRevisionDate { - get { return LastRevisionDateElement != null ? LastRevisionDateElement.Value : null; } + get => _LastRevisionDateElement?.Value; set { - if (value == null) - LastRevisionDateElement = null; - else - LastRevisionDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastRevisionDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastRevisionDate"); } } @@ -2091,39 +2017,36 @@ public string LastRevisionDate [DataMember] public List Language { - get { if(_Language==null) _Language = new List(); return _Language; } + get => _Language ?? new List(); set { _Language = value; OnPropertyChanged("Language"); } } - private List _Language; + private List? _Language; /// /// Entry number or identifier for inclusion in a database. /// [FhirElement("accessionNumber", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString AccessionNumberElement + public Hl7.Fhir.Model.FhirString? AccessionNumberElement { get { return _AccessionNumberElement; } set { _AccessionNumberElement = value; OnPropertyChanged("AccessionNumberElement"); } } - private Hl7.Fhir.Model.FhirString _AccessionNumberElement; + private Hl7.Fhir.Model.FhirString? _AccessionNumberElement; /// /// Entry number or identifier for inclusion in a database /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AccessionNumber + public string? AccessionNumber { - get { return AccessionNumberElement != null ? AccessionNumberElement.Value : null; } + get => _AccessionNumberElement?.Value; set { - if (value == null) - AccessionNumberElement = null; - else - AccessionNumberElement = new Hl7.Fhir.Model.FhirString(value); + AccessionNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AccessionNumber"); } } @@ -2133,28 +2056,25 @@ public string AccessionNumber /// [FhirElement("pageString", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PageStringElement + public Hl7.Fhir.Model.FhirString? PageStringElement { get { return _PageStringElement; } set { _PageStringElement = value; OnPropertyChanged("PageStringElement"); } } - private Hl7.Fhir.Model.FhirString _PageStringElement; + private Hl7.Fhir.Model.FhirString? _PageStringElement; /// /// Used for full display of pagination /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PageString + public string? PageString { - get { return PageStringElement != null ? PageStringElement.Value : null; } + get => _PageStringElement?.Value; set { - if (value == null) - PageStringElement = null; - else - PageStringElement = new Hl7.Fhir.Model.FhirString(value); + PageStringElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PageString"); } } @@ -2164,28 +2084,25 @@ public string PageString /// [FhirElement("firstPage", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString FirstPageElement + public Hl7.Fhir.Model.FhirString? FirstPageElement { get { return _FirstPageElement; } set { _FirstPageElement = value; OnPropertyChanged("FirstPageElement"); } } - private Hl7.Fhir.Model.FhirString _FirstPageElement; + private Hl7.Fhir.Model.FhirString? _FirstPageElement; /// /// Used for isolated representation of first page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FirstPage + public string? FirstPage { - get { return FirstPageElement != null ? FirstPageElement.Value : null; } + get => _FirstPageElement?.Value; set { - if (value == null) - FirstPageElement = null; - else - FirstPageElement = new Hl7.Fhir.Model.FhirString(value); + FirstPageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("FirstPage"); } } @@ -2195,28 +2112,25 @@ public string FirstPage /// [FhirElement("lastPage", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString LastPageElement + public Hl7.Fhir.Model.FhirString? LastPageElement { get { return _LastPageElement; } set { _LastPageElement = value; OnPropertyChanged("LastPageElement"); } } - private Hl7.Fhir.Model.FhirString _LastPageElement; + private Hl7.Fhir.Model.FhirString? _LastPageElement; /// /// Used for isolated representation of last page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastPage + public string? LastPage { - get { return LastPageElement != null ? LastPageElement.Value : null; } + get => _LastPageElement?.Value; set { - if (value == null) - LastPageElement = null; - else - LastPageElement = new Hl7.Fhir.Model.FhirString(value); + LastPageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LastPage"); } } @@ -2226,28 +2140,25 @@ public string LastPage /// [FhirElement("pageCount", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString PageCountElement + public Hl7.Fhir.Model.FhirString? PageCountElement { get { return _PageCountElement; } set { _PageCountElement = value; OnPropertyChanged("PageCountElement"); } } - private Hl7.Fhir.Model.FhirString _PageCountElement; + private Hl7.Fhir.Model.FhirString? _PageCountElement; /// /// Number of pages or screens /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PageCount + public string? PageCount { - get { return PageCountElement != null ? PageCountElement.Value : null; } + get => _PageCountElement?.Value; set { - if (value == null) - PageCountElement = null; - else - PageCountElement = new Hl7.Fhir.Model.FhirString(value); + PageCountElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PageCount"); } } @@ -2257,53 +2168,46 @@ public string PageCount /// [FhirElement("copyright", Order=140)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Copyright notice for the full article or artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPublicationFormComponent; - - if (dest == null) - { + if(other is not CitedArtifactPublicationFormComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PublishedIn != null) dest.PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent)PublishedIn.DeepCopyInternal(); - if(PeriodicRelease != null) dest.PeriodicRelease = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent)PeriodicRelease.DeepCopyInternal(); - if(ArticleDateElement != null) dest.ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime)ArticleDateElement.DeepCopyInternal(); - if(LastRevisionDateElement != null) dest.LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime)LastRevisionDateElement.DeepCopyInternal(); - if(Language.Any()) dest.Language = new List(Language.DeepCopyInternal()); - if(AccessionNumberElement != null) dest.AccessionNumberElement = (Hl7.Fhir.Model.FhirString)AccessionNumberElement.DeepCopyInternal(); - if(PageStringElement != null) dest.PageStringElement = (Hl7.Fhir.Model.FhirString)PageStringElement.DeepCopyInternal(); - if(FirstPageElement != null) dest.FirstPageElement = (Hl7.Fhir.Model.FhirString)FirstPageElement.DeepCopyInternal(); - if(LastPageElement != null) dest.LastPageElement = (Hl7.Fhir.Model.FhirString)LastPageElement.DeepCopyInternal(); - if(PageCountElement != null) dest.PageCountElement = (Hl7.Fhir.Model.FhirString)PageCountElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); + if(_PublishedIn is not null) dest.PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent)_PublishedIn.DeepCopyInternal(); + if(_PeriodicRelease is not null) dest.PeriodicRelease = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent)_PeriodicRelease.DeepCopyInternal(); + if(_ArticleDateElement is not null) dest.ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime)_ArticleDateElement.DeepCopyInternal(); + if(_LastRevisionDateElement is not null) dest.LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime)_LastRevisionDateElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = new List(_Language.DeepCopyInternal()); + if(_AccessionNumberElement is not null) dest.AccessionNumberElement = (Hl7.Fhir.Model.FhirString)_AccessionNumberElement.DeepCopyInternal(); + if(_PageStringElement is not null) dest.PageStringElement = (Hl7.Fhir.Model.FhirString)_PageStringElement.DeepCopyInternal(); + if(_FirstPageElement is not null) dest.FirstPageElement = (Hl7.Fhir.Model.FhirString)_FirstPageElement.DeepCopyInternal(); + if(_LastPageElement is not null) dest.LastPageElement = (Hl7.Fhir.Model.FhirString)_LastPageElement.DeepCopyInternal(); + if(_PageCountElement is not null) dest.PageCountElement = (Hl7.Fhir.Model.FhirString)_PageCountElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2315,104 +2219,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPublicationFormComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPublicationFormComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PublishedIn, otherT.PublishedIn)) return false; - if(!comparer.Equals(PeriodicRelease, otherT.PeriodicRelease)) return false; - if(!comparer.Equals(ArticleDateElement, otherT.ArticleDateElement)) return false; - if(!comparer.Equals(LastRevisionDateElement, otherT.LastRevisionDateElement)) return false; - if(!comparer.ListEquals(Language, otherT.Language)) return false; - if(!comparer.Equals(AccessionNumberElement, otherT.AccessionNumberElement)) return false; - if(!comparer.Equals(PageStringElement, otherT.PageStringElement)) return false; - if(!comparer.Equals(FirstPageElement, otherT.FirstPageElement)) return false; - if(!comparer.Equals(LastPageElement, otherT.LastPageElement)) return false; - if(!comparer.Equals(PageCountElement, otherT.PageCountElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PublishedIn, otherT._PublishedIn)) return false; + if(!comparer.Equals(_PeriodicRelease, otherT._PeriodicRelease)) return false; + if(!comparer.Equals(_ArticleDateElement, otherT._ArticleDateElement)) return false; + if(!comparer.Equals(_LastRevisionDateElement, otherT._LastRevisionDateElement)) return false; + if(!comparer.ListEquals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_AccessionNumberElement, otherT._AccessionNumberElement)) return false; + if(!comparer.Equals(_PageStringElement, otherT._PageStringElement)) return false; + if(!comparer.Equals(_FirstPageElement, otherT._FirstPageElement)) return false; + if(!comparer.Equals(_LastPageElement, otherT._LastPageElement)) return false; + if(!comparer.Equals(_PageCountElement, otherT._PageCountElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "publishedIn": - value = PublishedIn; - return PublishedIn is not null; + value = _PublishedIn; + return _PublishedIn is not null; case "periodicRelease": - value = PeriodicRelease; - return PeriodicRelease is not null; + value = _PeriodicRelease; + return _PeriodicRelease is not null; case "articleDate": - value = ArticleDateElement; - return ArticleDateElement is not null; + value = _ArticleDateElement; + return _ArticleDateElement is not null; case "lastRevisionDate": - value = LastRevisionDateElement; - return LastRevisionDateElement is not null; + value = _LastRevisionDateElement; + return _LastRevisionDateElement is not null; case "language": - value = Language; - return Language?.Any() == true; + value = _Language; + return _Language?.Any() == true; case "accessionNumber": - value = AccessionNumberElement; - return AccessionNumberElement is not null; + value = _AccessionNumberElement; + return _AccessionNumberElement is not null; case "pageString": - value = PageStringElement; - return PageStringElement is not null; + value = _PageStringElement; + return _PageStringElement is not null; case "firstPage": - value = FirstPageElement; - return FirstPageElement is not null; + value = _FirstPageElement; + return _FirstPageElement is not null; case "lastPage": - value = LastPageElement; - return LastPageElement is not null; + value = _LastPageElement; + return _LastPageElement is not null; case "pageCount": - value = PageCountElement; - return PageCountElement is not null; + value = _PageCountElement; + return _PageCountElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "publishedIn": - PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent)value; + PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent?)value; return this; case "periodicRelease": - PeriodicRelease = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent)value; + PeriodicRelease = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseComponent?)value; return this; case "articleDate": - ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastRevisionDate": - LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "language": - Language = (List)value; + Language = (List?)value!; return this; case "accessionNumber": - AccessionNumberElement = (Hl7.Fhir.Model.FhirString)value; + AccessionNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "pageString": - PageStringElement = (Hl7.Fhir.Model.FhirString)value; + PageStringElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "firstPage": - FirstPageElement = (Hl7.Fhir.Model.FhirString)value; + FirstPageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "lastPage": - LastPageElement = (Hl7.Fhir.Model.FhirString)value; + LastPageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "pageCount": - PageCountElement = (Hl7.Fhir.Model.FhirString)value; + PageCountElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2423,17 +2327,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PublishedIn is not null) yield return new KeyValuePair("publishedIn",PublishedIn); - if (PeriodicRelease is not null) yield return new KeyValuePair("periodicRelease",PeriodicRelease); - if (ArticleDateElement is not null) yield return new KeyValuePair("articleDate",ArticleDateElement); - if (LastRevisionDateElement is not null) yield return new KeyValuePair("lastRevisionDate",LastRevisionDateElement); - if (Language?.Any() == true) yield return new KeyValuePair("language",Language); - if (AccessionNumberElement is not null) yield return new KeyValuePair("accessionNumber",AccessionNumberElement); - if (PageStringElement is not null) yield return new KeyValuePair("pageString",PageStringElement); - if (FirstPageElement is not null) yield return new KeyValuePair("firstPage",FirstPageElement); - if (LastPageElement is not null) yield return new KeyValuePair("lastPage",LastPageElement); - if (PageCountElement is not null) yield return new KeyValuePair("pageCount",PageCountElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_PublishedIn is not null) yield return new KeyValuePair("publishedIn",_PublishedIn); + if (_PeriodicRelease is not null) yield return new KeyValuePair("periodicRelease",_PeriodicRelease); + if (_ArticleDateElement is not null) yield return new KeyValuePair("articleDate",_ArticleDateElement); + if (_LastRevisionDateElement is not null) yield return new KeyValuePair("lastRevisionDate",_LastRevisionDateElement); + if (_Language?.Any() == true) yield return new KeyValuePair("language",_Language); + if (_AccessionNumberElement is not null) yield return new KeyValuePair("accessionNumber",_AccessionNumberElement); + if (_PageStringElement is not null) yield return new KeyValuePair("pageString",_PageStringElement); + if (_FirstPageElement is not null) yield return new KeyValuePair("firstPage",_FirstPageElement); + if (_LastPageElement is not null) yield return new KeyValuePair("lastPage",_LastPageElement); + if (_PageCountElement is not null) yield return new KeyValuePair("pageCount",_PageCountElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -2457,13 +2361,13 @@ public partial class CitedArtifactPublicationFormPublishedInComponent : Hl7.Fhir [FhirElement("type", Order=40)] [Binding("PublishedInType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Journal identifiers include ISSN, ISO Abbreviation and NLMuniqueID; Book identifiers include ISBN. @@ -2473,39 +2377,36 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Name of the database or title of the book or journal. /// [FhirElement("title", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name of the database or title of the book or journal /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2517,60 +2418,53 @@ public string Title [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Publisher + public Hl7.Fhir.Model.ResourceReference? Publisher { get { return _Publisher; } set { _Publisher = value; OnPropertyChanged("Publisher"); } } - private Hl7.Fhir.Model.ResourceReference _Publisher; + private Hl7.Fhir.Model.ResourceReference? _Publisher; /// /// Geographic location of the publisher. /// [FhirElement("publisherLocation", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherLocationElement + public Hl7.Fhir.Model.FhirString? PublisherLocationElement { get { return _PublisherLocationElement; } set { _PublisherLocationElement = value; OnPropertyChanged("PublisherLocationElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherLocationElement; + private Hl7.Fhir.Model.FhirString? _PublisherLocationElement; /// /// Geographic location of the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublisherLocation + public string? PublisherLocation { - get { return PublisherLocationElement != null ? PublisherLocationElement.Value : null; } + get => _PublisherLocationElement?.Value; set { - if (value == null) - PublisherLocationElement = null; - else - PublisherLocationElement = new Hl7.Fhir.Model.FhirString(value); + PublisherLocationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PublisherLocation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPublicationFormPublishedInComponent; - - if (dest == null) - { + if(other is not CitedArtifactPublicationFormPublishedInComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Publisher != null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)Publisher.DeepCopyInternal(); - if(PublisherLocationElement != null) dest.PublisherLocationElement = (Hl7.Fhir.Model.FhirString)PublisherLocationElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Publisher is not null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)_Publisher.DeepCopyInternal(); + if(_PublisherLocationElement is not null) dest.PublisherLocationElement = (Hl7.Fhir.Model.FhirString)_PublisherLocationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2582,62 +2476,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPublicationFormPublishedInComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPublicationFormPublishedInComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Publisher, otherT.Publisher)) return false; - if(!comparer.Equals(PublisherLocationElement, otherT.PublisherLocationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; + if(!comparer.Equals(_PublisherLocationElement, otherT._PublisherLocationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "publisher": - value = Publisher; - return Publisher is not null; + value = _Publisher; + return _Publisher is not null; case "publisherLocation": - value = PublisherLocationElement; - return PublisherLocationElement is not null; + value = _PublisherLocationElement; + return _PublisherLocationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "publisher": - Publisher = (Hl7.Fhir.Model.ResourceReference)value; + Publisher = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "publisherLocation": - PublisherLocationElement = (Hl7.Fhir.Model.FhirString)value; + PublisherLocationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2648,11 +2542,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Publisher is not null) yield return new KeyValuePair("publisher",Publisher); - if (PublisherLocationElement is not null) yield return new KeyValuePair("publisherLocation",PublisherLocationElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Publisher is not null) yield return new KeyValuePair("publisher",_Publisher); + if (_PublisherLocationElement is not null) yield return new KeyValuePair("publisherLocation",_PublisherLocationElement); } } @@ -2676,41 +2570,38 @@ public partial class CitedArtifactPublicationFormPeriodicReleaseComponent : Hl7. [FhirElement("citedMedium", Order=40)] [Binding("CitedMedium")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CitedMedium + public Hl7.Fhir.Model.CodeableConcept? CitedMedium { get { return _CitedMedium; } set { _CitedMedium = value; OnPropertyChanged("CitedMedium"); } } - private Hl7.Fhir.Model.CodeableConcept _CitedMedium; + private Hl7.Fhir.Model.CodeableConcept? _CitedMedium; /// /// Volume number of journal in which the article is published. /// [FhirElement("volume", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VolumeElement + public Hl7.Fhir.Model.FhirString? VolumeElement { get { return _VolumeElement; } set { _VolumeElement = value; OnPropertyChanged("VolumeElement"); } } - private Hl7.Fhir.Model.FhirString _VolumeElement; + private Hl7.Fhir.Model.FhirString? _VolumeElement; /// /// Volume number of journal in which the article is published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Volume + public string? Volume { - get { return VolumeElement != null ? VolumeElement.Value : null; } + get => _VolumeElement?.Value; set { - if (value == null) - VolumeElement = null; - else - VolumeElement = new Hl7.Fhir.Model.FhirString(value); + VolumeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Volume"); } } @@ -2720,28 +2611,25 @@ public string Volume /// [FhirElement("issue", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString IssueElement + public Hl7.Fhir.Model.FhirString? IssueElement { get { return _IssueElement; } set { _IssueElement = value; OnPropertyChanged("IssueElement"); } } - private Hl7.Fhir.Model.FhirString _IssueElement; + private Hl7.Fhir.Model.FhirString? _IssueElement; /// /// Issue, part or supplement of journal in which the article is published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issue + public string? Issue { - get { return IssueElement != null ? IssueElement.Value : null; } + get => _IssueElement?.Value; set { - if (value == null) - IssueElement = null; - else - IssueElement = new Hl7.Fhir.Model.FhirString(value); + IssueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Issue"); } } @@ -2751,28 +2639,24 @@ public string Issue /// [FhirElement("dateOfPublication", Order=70)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent DateOfPublication + public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent? DateOfPublication { get { return _DateOfPublication; } set { _DateOfPublication = value; OnPropertyChanged("DateOfPublication"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent _DateOfPublication; + private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent? _DateOfPublication; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPublicationFormPeriodicReleaseComponent; - - if (dest == null) - { + if(other is not CitedArtifactPublicationFormPeriodicReleaseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CitedMedium != null) dest.CitedMedium = (Hl7.Fhir.Model.CodeableConcept)CitedMedium.DeepCopyInternal(); - if(VolumeElement != null) dest.VolumeElement = (Hl7.Fhir.Model.FhirString)VolumeElement.DeepCopyInternal(); - if(IssueElement != null) dest.IssueElement = (Hl7.Fhir.Model.FhirString)IssueElement.DeepCopyInternal(); - if(DateOfPublication != null) dest.DateOfPublication = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent)DateOfPublication.DeepCopyInternal(); + if(_CitedMedium is not null) dest.CitedMedium = (Hl7.Fhir.Model.CodeableConcept)_CitedMedium.DeepCopyInternal(); + if(_VolumeElement is not null) dest.VolumeElement = (Hl7.Fhir.Model.FhirString)_VolumeElement.DeepCopyInternal(); + if(_IssueElement is not null) dest.IssueElement = (Hl7.Fhir.Model.FhirString)_IssueElement.DeepCopyInternal(); + if(_DateOfPublication is not null) dest.DateOfPublication = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent)_DateOfPublication.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2784,55 +2668,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPublicationFormPeriodicReleaseComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPublicationFormPeriodicReleaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CitedMedium, otherT.CitedMedium)) return false; - if(!comparer.Equals(VolumeElement, otherT.VolumeElement)) return false; - if(!comparer.Equals(IssueElement, otherT.IssueElement)) return false; - if(!comparer.Equals(DateOfPublication, otherT.DateOfPublication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CitedMedium, otherT._CitedMedium)) return false; + if(!comparer.Equals(_VolumeElement, otherT._VolumeElement)) return false; + if(!comparer.Equals(_IssueElement, otherT._IssueElement)) return false; + if(!comparer.Equals(_DateOfPublication, otherT._DateOfPublication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "citedMedium": - value = CitedMedium; - return CitedMedium is not null; + value = _CitedMedium; + return _CitedMedium is not null; case "volume": - value = VolumeElement; - return VolumeElement is not null; + value = _VolumeElement; + return _VolumeElement is not null; case "issue": - value = IssueElement; - return IssueElement is not null; + value = _IssueElement; + return _IssueElement is not null; case "dateOfPublication": - value = DateOfPublication; - return DateOfPublication is not null; + value = _DateOfPublication; + return _DateOfPublication is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "citedMedium": - CitedMedium = (Hl7.Fhir.Model.CodeableConcept)value; + CitedMedium = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "volume": - VolumeElement = (Hl7.Fhir.Model.FhirString)value; + VolumeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issue": - IssueElement = (Hl7.Fhir.Model.FhirString)value; + IssueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "dateOfPublication": - DateOfPublication = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent)value; + DateOfPublication = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent?)value; return this; default: return base.SetValue(key, value); @@ -2843,10 +2727,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CitedMedium is not null) yield return new KeyValuePair("citedMedium",CitedMedium); - if (VolumeElement is not null) yield return new KeyValuePair("volume",VolumeElement); - if (IssueElement is not null) yield return new KeyValuePair("issue",IssueElement); - if (DateOfPublication is not null) yield return new KeyValuePair("dateOfPublication",DateOfPublication); + if (_CitedMedium is not null) yield return new KeyValuePair("citedMedium",_CitedMedium); + if (_VolumeElement is not null) yield return new KeyValuePair("volume",_VolumeElement); + if (_IssueElement is not null) yield return new KeyValuePair("issue",_IssueElement); + if (_DateOfPublication is not null) yield return new KeyValuePair("dateOfPublication",_DateOfPublication); } } @@ -2869,28 +2753,25 @@ public partial class CitedArtifactPublicationFormPeriodicReleaseDateOfPublicatio /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Date on which the issue of the journal was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -2900,28 +2781,25 @@ public string Date /// [FhirElement("year", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString YearElement + public Hl7.Fhir.Model.FhirString? YearElement { get { return _YearElement; } set { _YearElement = value; OnPropertyChanged("YearElement"); } } - private Hl7.Fhir.Model.FhirString _YearElement; + private Hl7.Fhir.Model.FhirString? _YearElement; /// /// Year on which the issue of the journal was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Year + public string? Year { - get { return YearElement != null ? YearElement.Value : null; } + get => _YearElement?.Value; set { - if (value == null) - YearElement = null; - else - YearElement = new Hl7.Fhir.Model.FhirString(value); + YearElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Year"); } } @@ -2931,28 +2809,25 @@ public string Year /// [FhirElement("month", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MonthElement + public Hl7.Fhir.Model.FhirString? MonthElement { get { return _MonthElement; } set { _MonthElement = value; OnPropertyChanged("MonthElement"); } } - private Hl7.Fhir.Model.FhirString _MonthElement; + private Hl7.Fhir.Model.FhirString? _MonthElement; /// /// Month on which the issue of the journal was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Month + public string? Month { - get { return MonthElement != null ? MonthElement.Value : null; } + get => _MonthElement?.Value; set { - if (value == null) - MonthElement = null; - else - MonthElement = new Hl7.Fhir.Model.FhirString(value); + MonthElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Month"); } } @@ -2962,28 +2837,25 @@ public string Month /// [FhirElement("day", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DayElement + public Hl7.Fhir.Model.FhirString? DayElement { get { return _DayElement; } set { _DayElement = value; OnPropertyChanged("DayElement"); } } - private Hl7.Fhir.Model.FhirString _DayElement; + private Hl7.Fhir.Model.FhirString? _DayElement; /// /// Day on which the issue of the journal was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Day + public string? Day { - get { return DayElement != null ? DayElement.Value : null; } + get => _DayElement?.Value; set { - if (value == null) - DayElement = null; - else - DayElement = new Hl7.Fhir.Model.FhirString(value); + DayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Day"); } } @@ -2993,28 +2865,25 @@ public string Day /// [FhirElement("season", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString SeasonElement + public Hl7.Fhir.Model.FhirString? SeasonElement { get { return _SeasonElement; } set { _SeasonElement = value; OnPropertyChanged("SeasonElement"); } } - private Hl7.Fhir.Model.FhirString _SeasonElement; + private Hl7.Fhir.Model.FhirString? _SeasonElement; /// /// Season on which the issue of the journal was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Season + public string? Season { - get { return SeasonElement != null ? SeasonElement.Value : null; } + get => _SeasonElement?.Value; set { - if (value == null) - SeasonElement = null; - else - SeasonElement = new Hl7.Fhir.Model.FhirString(value); + SeasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Season"); } } @@ -3024,48 +2893,41 @@ public string Season /// [FhirElement("text", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the date of which the issue of the journal was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent; - - if (dest == null) - { + if(other is not CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(YearElement != null) dest.YearElement = (Hl7.Fhir.Model.FhirString)YearElement.DeepCopyInternal(); - if(MonthElement != null) dest.MonthElement = (Hl7.Fhir.Model.FhirString)MonthElement.DeepCopyInternal(); - if(DayElement != null) dest.DayElement = (Hl7.Fhir.Model.FhirString)DayElement.DeepCopyInternal(); - if(SeasonElement != null) dest.SeasonElement = (Hl7.Fhir.Model.FhirString)SeasonElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_YearElement is not null) dest.YearElement = (Hl7.Fhir.Model.FhirString)_YearElement.DeepCopyInternal(); + if(_MonthElement is not null) dest.MonthElement = (Hl7.Fhir.Model.FhirString)_MonthElement.DeepCopyInternal(); + if(_DayElement is not null) dest.DayElement = (Hl7.Fhir.Model.FhirString)_DayElement.DeepCopyInternal(); + if(_SeasonElement is not null) dest.SeasonElement = (Hl7.Fhir.Model.FhirString)_SeasonElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3077,69 +2939,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(YearElement, otherT.YearElement)) return false; - if(!comparer.Equals(MonthElement, otherT.MonthElement)) return false; - if(!comparer.Equals(DayElement, otherT.DayElement)) return false; - if(!comparer.Equals(SeasonElement, otherT.SeasonElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_YearElement, otherT._YearElement)) return false; + if(!comparer.Equals(_MonthElement, otherT._MonthElement)) return false; + if(!comparer.Equals(_DayElement, otherT._DayElement)) return false; + if(!comparer.Equals(_SeasonElement, otherT._SeasonElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "year": - value = YearElement; - return YearElement is not null; + value = _YearElement; + return _YearElement is not null; case "month": - value = MonthElement; - return MonthElement is not null; + value = _MonthElement; + return _MonthElement is not null; case "day": - value = DayElement; - return DayElement is not null; + value = _DayElement; + return _DayElement is not null; case "season": - value = SeasonElement; - return SeasonElement is not null; + value = _SeasonElement; + return _SeasonElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "year": - YearElement = (Hl7.Fhir.Model.FhirString)value; + YearElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "month": - MonthElement = (Hl7.Fhir.Model.FhirString)value; + MonthElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "day": - DayElement = (Hl7.Fhir.Model.FhirString)value; + DayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "season": - SeasonElement = (Hl7.Fhir.Model.FhirString)value; + SeasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3150,12 +3012,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (YearElement is not null) yield return new KeyValuePair("year",YearElement); - if (MonthElement is not null) yield return new KeyValuePair("month",MonthElement); - if (DayElement is not null) yield return new KeyValuePair("day",DayElement); - if (SeasonElement is not null) yield return new KeyValuePair("season",SeasonElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_YearElement is not null) yield return new KeyValuePair("year",_YearElement); + if (_MonthElement is not null) yield return new KeyValuePair("month",_MonthElement); + if (_DayElement is not null) yield return new KeyValuePair("day",_DayElement); + if (_SeasonElement is not null) yield return new KeyValuePair("season",_SeasonElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -3179,57 +3041,50 @@ public partial class CitedArtifactWebLocationComponent : Hl7.Fhir.Model.Backbone [FhirElement("type", Order=40)] [Binding("ArticleUrlType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specific URL. /// [FhirElement("url", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// The specific URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactWebLocationComponent; - - if (dest == null) - { + if(other is not CitedArtifactWebLocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3241,41 +3096,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactWebLocationComponent; - if(otherT == null) return false; + if(other is not CitedArtifactWebLocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -3286,8 +3141,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -3311,13 +3166,13 @@ public partial class CitedArtifactClassificationComponent : Hl7.Fhir.Model.Backb [FhirElement("type", Order=40)] [Binding("CitedArtifactClassificationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specific classification value. @@ -3328,38 +3183,34 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// Provenance and copyright of classification. /// [FhirElement("whoClassified", Order=60)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent WhoClassified + public Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent? WhoClassified { get { return _WhoClassified; } set { _WhoClassified = value; OnPropertyChanged("WhoClassified"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent _WhoClassified; + private Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent? _WhoClassified; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactClassificationComponent; - - if (dest == null) - { + if(other is not CitedArtifactClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(WhoClassified != null) dest.WhoClassified = (Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent)WhoClassified.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_WhoClassified is not null) dest.WhoClassified = (Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent)_WhoClassified.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3371,48 +3222,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactClassificationComponent; - if(otherT == null) return false; + if(other is not CitedArtifactClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.Equals(WhoClassified, otherT.WhoClassified)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.Equals(_WhoClassified, otherT._WhoClassified)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "whoClassified": - value = WhoClassified; - return WhoClassified is not null; + value = _WhoClassified; + return _WhoClassified is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "whoClassified": - WhoClassified = (Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent)value; + WhoClassified = (Hl7.Fhir.Model.Citation.CitedArtifactClassificationWhoClassifiedComponent?)value; return this; default: return base.SetValue(key, value); @@ -3423,9 +3274,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (WhoClassified is not null) yield return new KeyValuePair("whoClassified",WhoClassified); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_WhoClassified is not null) yield return new KeyValuePair("whoClassified",_WhoClassified); } } @@ -3450,13 +3301,13 @@ public partial class CitedArtifactClassificationWhoClassifiedComponent : Hl7.Fhi [CLSCompliant(false)] [References("Person","Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Person + public Hl7.Fhir.Model.ResourceReference? Person { get { return _Person; } set { _Person = value; OnPropertyChanged("Person"); } } - private Hl7.Fhir.Model.ResourceReference _Person; + private Hl7.Fhir.Model.ResourceReference? _Person; /// /// Organization who created the classification. @@ -3465,13 +3316,13 @@ public Hl7.Fhir.Model.ResourceReference Person [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// The publisher of the classification, not the publisher of the article or artifact being cited. @@ -3480,41 +3331,38 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Publisher + public Hl7.Fhir.Model.ResourceReference? Publisher { get { return _Publisher; } set { _Publisher = value; OnPropertyChanged("Publisher"); } } - private Hl7.Fhir.Model.ResourceReference _Publisher; + private Hl7.Fhir.Model.ResourceReference? _Publisher; /// /// Rights management statement for the classification. /// [FhirElement("classifierCopyright", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ClassifierCopyrightElement + public Hl7.Fhir.Model.FhirString? ClassifierCopyrightElement { get { return _ClassifierCopyrightElement; } set { _ClassifierCopyrightElement = value; OnPropertyChanged("ClassifierCopyrightElement"); } } - private Hl7.Fhir.Model.FhirString _ClassifierCopyrightElement; + private Hl7.Fhir.Model.FhirString? _ClassifierCopyrightElement; /// /// Rights management statement for the classification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClassifierCopyright + public string? ClassifierCopyright { - get { return ClassifierCopyrightElement != null ? ClassifierCopyrightElement.Value : null; } + get => _ClassifierCopyrightElement?.Value; set { - if (value == null) - ClassifierCopyrightElement = null; - else - ClassifierCopyrightElement = new Hl7.Fhir.Model.FhirString(value); + ClassifierCopyrightElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ClassifierCopyright"); } } @@ -3524,13 +3372,13 @@ public string ClassifierCopyright /// [FhirElement("freeToShare", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FreeToShareElement + public Hl7.Fhir.Model.FhirBoolean? FreeToShareElement { get { return _FreeToShareElement; } set { _FreeToShareElement = value; OnPropertyChanged("FreeToShareElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FreeToShareElement; + private Hl7.Fhir.Model.FhirBoolean? _FreeToShareElement; /// /// Acceptable to re-use the classification @@ -3539,32 +3387,25 @@ public Hl7.Fhir.Model.FhirBoolean FreeToShareElement [IgnoreDataMember] public bool? FreeToShare { - get { return FreeToShareElement != null ? FreeToShareElement.Value : null; } + get => _FreeToShareElement?.Value; set { - if (value == null) - FreeToShareElement = null; - else - FreeToShareElement = new Hl7.Fhir.Model.FhirBoolean(value); + FreeToShareElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("FreeToShare"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactClassificationWhoClassifiedComponent; - - if (dest == null) - { + if(other is not CitedArtifactClassificationWhoClassifiedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Person != null) dest.Person = (Hl7.Fhir.Model.ResourceReference)Person.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Publisher != null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)Publisher.DeepCopyInternal(); - if(ClassifierCopyrightElement != null) dest.ClassifierCopyrightElement = (Hl7.Fhir.Model.FhirString)ClassifierCopyrightElement.DeepCopyInternal(); - if(FreeToShareElement != null) dest.FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean)FreeToShareElement.DeepCopyInternal(); + if(_Person is not null) dest.Person = (Hl7.Fhir.Model.ResourceReference)_Person.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Publisher is not null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)_Publisher.DeepCopyInternal(); + if(_ClassifierCopyrightElement is not null) dest.ClassifierCopyrightElement = (Hl7.Fhir.Model.FhirString)_ClassifierCopyrightElement.DeepCopyInternal(); + if(_FreeToShareElement is not null) dest.FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean)_FreeToShareElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3576,62 +3417,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactClassificationWhoClassifiedComponent; - if(otherT == null) return false; + if(other is not CitedArtifactClassificationWhoClassifiedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Person, otherT.Person)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Publisher, otherT.Publisher)) return false; - if(!comparer.Equals(ClassifierCopyrightElement, otherT.ClassifierCopyrightElement)) return false; - if(!comparer.Equals(FreeToShareElement, otherT.FreeToShareElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Person, otherT._Person)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; + if(!comparer.Equals(_ClassifierCopyrightElement, otherT._ClassifierCopyrightElement)) return false; + if(!comparer.Equals(_FreeToShareElement, otherT._FreeToShareElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "person": - value = Person; - return Person is not null; + value = _Person; + return _Person is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "publisher": - value = Publisher; - return Publisher is not null; + value = _Publisher; + return _Publisher is not null; case "classifierCopyright": - value = ClassifierCopyrightElement; - return ClassifierCopyrightElement is not null; + value = _ClassifierCopyrightElement; + return _ClassifierCopyrightElement is not null; case "freeToShare": - value = FreeToShareElement; - return FreeToShareElement is not null; + value = _FreeToShareElement; + return _FreeToShareElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "person": - Person = (Hl7.Fhir.Model.ResourceReference)value; + Person = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "publisher": - Publisher = (Hl7.Fhir.Model.ResourceReference)value; + Publisher = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "classifierCopyright": - ClassifierCopyrightElement = (Hl7.Fhir.Model.FhirString)value; + ClassifierCopyrightElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "freeToShare": - FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean)value; + FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -3642,11 +3483,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Person is not null) yield return new KeyValuePair("person",Person); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Publisher is not null) yield return new KeyValuePair("publisher",Publisher); - if (ClassifierCopyrightElement is not null) yield return new KeyValuePair("classifierCopyright",ClassifierCopyrightElement); - if (FreeToShareElement is not null) yield return new KeyValuePair("freeToShare",FreeToShareElement); + if (_Person is not null) yield return new KeyValuePair("person",_Person); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Publisher is not null) yield return new KeyValuePair("publisher",_Publisher); + if (_ClassifierCopyrightElement is not null) yield return new KeyValuePair("classifierCopyright",_ClassifierCopyrightElement); + if (_FreeToShareElement is not null) yield return new KeyValuePair("freeToShare",_FreeToShareElement); } } @@ -3672,13 +3513,13 @@ public partial class CitedArtifactContributorshipComponent : Hl7.Fhir.Model.Back /// [FhirElement("complete", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CompleteElement + public Hl7.Fhir.Model.FhirBoolean? CompleteElement { get { return _CompleteElement; } set { _CompleteElement = value; OnPropertyChanged("CompleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CompleteElement; + private Hl7.Fhir.Model.FhirBoolean? _CompleteElement; /// /// Indicates if the list includes all authors and/or contributors @@ -3687,13 +3528,10 @@ public Hl7.Fhir.Model.FhirBoolean CompleteElement [IgnoreDataMember] public bool? Complete { - get { return CompleteElement != null ? CompleteElement.Value : null; } + get => _CompleteElement?.Value; set { - if (value == null) - CompleteElement = null; - else - CompleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + CompleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Complete"); } } @@ -3706,11 +3544,11 @@ public bool? Complete [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Used to record a display of the author/contributor list without separate coding for each list member. @@ -3720,25 +3558,21 @@ public List [DataMember] public List Summary { - get { if(_Summary==null) _Summary = new List(); return _Summary; } + get => _Summary ?? new List(); set { _Summary = value; OnPropertyChanged("Summary"); } } - private List _Summary; + private List? _Summary; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactContributorshipComponent; - - if (dest == null) - { + if(other is not CitedArtifactContributorshipComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CompleteElement != null) dest.CompleteElement = (Hl7.Fhir.Model.FhirBoolean)CompleteElement.DeepCopyInternal(); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(Summary.Any()) dest.Summary = new List(Summary.DeepCopyInternal()); + if(_CompleteElement is not null) dest.CompleteElement = (Hl7.Fhir.Model.FhirBoolean)_CompleteElement.DeepCopyInternal(); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_Summary is not null) dest.Summary = new List(_Summary.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3750,48 +3584,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactContributorshipComponent; - if(otherT == null) return false; + if(other is not CitedArtifactContributorshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CompleteElement, otherT.CompleteElement)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.ListEquals(Summary, otherT.Summary)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CompleteElement, otherT._CompleteElement)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.ListEquals(_Summary, otherT._Summary)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "complete": - value = CompleteElement; - return CompleteElement is not null; + value = _CompleteElement; + return _CompleteElement is not null; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "summary": - value = Summary; - return Summary?.Any() == true; + value = _Summary; + return _Summary?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "complete": - CompleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + CompleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "summary": - Summary = (List)value; + Summary = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3802,9 +3636,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CompleteElement is not null) yield return new KeyValuePair("complete",CompleteElement); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (Summary?.Any() == true) yield return new KeyValuePair("summary",Summary); + if (_CompleteElement is not null) yield return new KeyValuePair("complete",_CompleteElement); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_Summary?.Any() == true) yield return new KeyValuePair("summary",_Summary); } } @@ -3831,41 +3665,38 @@ public partial class CitedArtifactContributorshipEntryComponent : Hl7.Fhir.Model /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// Initials for forename. /// [FhirElement("initials", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString InitialsElement + public Hl7.Fhir.Model.FhirString? InitialsElement { get { return _InitialsElement; } set { _InitialsElement = value; OnPropertyChanged("InitialsElement"); } } - private Hl7.Fhir.Model.FhirString _InitialsElement; + private Hl7.Fhir.Model.FhirString? _InitialsElement; /// /// Initials for forename /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Initials + public string? Initials { - get { return InitialsElement != null ? InitialsElement.Value : null; } + get => _InitialsElement?.Value; set { - if (value == null) - InitialsElement = null; - else - InitialsElement = new Hl7.Fhir.Model.FhirString(value); + InitialsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Initials"); } } @@ -3875,28 +3706,25 @@ public string Initials /// [FhirElement("collectiveName", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString CollectiveNameElement + public Hl7.Fhir.Model.FhirString? CollectiveNameElement { get { return _CollectiveNameElement; } set { _CollectiveNameElement = value; OnPropertyChanged("CollectiveNameElement"); } } - private Hl7.Fhir.Model.FhirString _CollectiveNameElement; + private Hl7.Fhir.Model.FhirString? _CollectiveNameElement; /// /// Used for collective or corporate name as an author /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CollectiveName + public string? CollectiveName { - get { return CollectiveNameElement != null ? CollectiveNameElement.Value : null; } + get => _CollectiveNameElement?.Value; set { - if (value == null) - CollectiveNameElement = null; - else - CollectiveNameElement = new Hl7.Fhir.Model.FhirString(value); + CollectiveNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CollectiveName"); } } @@ -3909,11 +3737,11 @@ public string CollectiveName [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Organizational affiliation. @@ -3923,11 +3751,11 @@ public List Identifier [DataMember] public List AffiliationInfo { - get { if(_AffiliationInfo==null) _AffiliationInfo = new List(); return _AffiliationInfo; } + get => _AffiliationInfo ?? new List(); set { _AffiliationInfo = value; OnPropertyChanged("AffiliationInfo"); } } - private List _AffiliationInfo; + private List? _AffiliationInfo; /// /// Physical mailing address. @@ -3937,11 +3765,11 @@ public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Email or telephone contact methods for the author or contributor. @@ -3951,11 +3779,11 @@ public List Address [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// The specific contribution. @@ -3966,11 +3794,11 @@ public List Telecom [DataMember] public List ContributionType { - get { if(_ContributionType==null) _ContributionType = new List(); return _ContributionType; } + get => _ContributionType ?? new List(); set { _ContributionType = value; OnPropertyChanged("ContributionType"); } } - private List _ContributionType; + private List? _ContributionType; /// /// The role of the contributor (e.g. author, editor, reviewer). @@ -3978,13 +3806,13 @@ public List ContributionType [FhirElement("role", Order=120)] [Binding("ContributorRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Contributions with accounting for time or number. @@ -3994,24 +3822,24 @@ public Hl7.Fhir.Model.CodeableConcept Role [DataMember] public List ContributionInstance { - get { if(_ContributionInstance==null) _ContributionInstance = new List(); return _ContributionInstance; } + get => _ContributionInstance ?? new List(); set { _ContributionInstance = value; OnPropertyChanged("ContributionInstance"); } } - private List _ContributionInstance; + private List? _ContributionInstance; /// /// Indication of which contributor is the corresponding contributor for the role. /// [FhirElement("correspondingContact", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CorrespondingContactElement + public Hl7.Fhir.Model.FhirBoolean? CorrespondingContactElement { get { return _CorrespondingContactElement; } set { _CorrespondingContactElement = value; OnPropertyChanged("CorrespondingContactElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CorrespondingContactElement; + private Hl7.Fhir.Model.FhirBoolean? _CorrespondingContactElement; /// /// Indication of which contributor is the corresponding contributor for the role @@ -4020,13 +3848,10 @@ public Hl7.Fhir.Model.FhirBoolean CorrespondingContactElement [IgnoreDataMember] public bool? CorrespondingContact { - get { return CorrespondingContactElement != null ? CorrespondingContactElement.Value : null; } + get => _CorrespondingContactElement?.Value; set { - if (value == null) - CorrespondingContactElement = null; - else - CorrespondingContactElement = new Hl7.Fhir.Model.FhirBoolean(value); + CorrespondingContactElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("CorrespondingContact"); } } @@ -4036,13 +3861,13 @@ public bool? CorrespondingContact /// [FhirElement("listOrder", Order=150)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ListOrderElement + public Hl7.Fhir.Model.PositiveInt? ListOrderElement { get { return _ListOrderElement; } set { _ListOrderElement = value; OnPropertyChanged("ListOrderElement"); } } - private Hl7.Fhir.Model.PositiveInt _ListOrderElement; + private Hl7.Fhir.Model.PositiveInt? _ListOrderElement; /// /// Used to code order of authors @@ -4051,39 +3876,32 @@ public Hl7.Fhir.Model.PositiveInt ListOrderElement [IgnoreDataMember] public int? ListOrder { - get { return ListOrderElement != null ? ListOrderElement.Value : null; } + get => _ListOrderElement?.Value; set { - if (value == null) - ListOrderElement = null; - else - ListOrderElement = new Hl7.Fhir.Model.PositiveInt(value); + ListOrderElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("ListOrder"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactContributorshipEntryComponent; - - if (dest == null) - { + if(other is not CitedArtifactContributorshipEntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(InitialsElement != null) dest.InitialsElement = (Hl7.Fhir.Model.FhirString)InitialsElement.DeepCopyInternal(); - if(CollectiveNameElement != null) dest.CollectiveNameElement = (Hl7.Fhir.Model.FhirString)CollectiveNameElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(AffiliationInfo.Any()) dest.AffiliationInfo = new List(AffiliationInfo.DeepCopyInternal()); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(ContributionType.Any()) dest.ContributionType = new List(ContributionType.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(ContributionInstance.Any()) dest.ContributionInstance = new List(ContributionInstance.DeepCopyInternal()); - if(CorrespondingContactElement != null) dest.CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean)CorrespondingContactElement.DeepCopyInternal(); - if(ListOrderElement != null) dest.ListOrderElement = (Hl7.Fhir.Model.PositiveInt)ListOrderElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_InitialsElement is not null) dest.InitialsElement = (Hl7.Fhir.Model.FhirString)_InitialsElement.DeepCopyInternal(); + if(_CollectiveNameElement is not null) dest.CollectiveNameElement = (Hl7.Fhir.Model.FhirString)_CollectiveNameElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_AffiliationInfo is not null) dest.AffiliationInfo = new List(_AffiliationInfo.DeepCopyInternal()); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_ContributionType is not null) dest.ContributionType = new List(_ContributionType.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_ContributionInstance is not null) dest.ContributionInstance = new List(_ContributionInstance.DeepCopyInternal()); + if(_CorrespondingContactElement is not null) dest.CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean)_CorrespondingContactElement.DeepCopyInternal(); + if(_ListOrderElement is not null) dest.ListOrderElement = (Hl7.Fhir.Model.PositiveInt)_ListOrderElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4095,111 +3913,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactContributorshipEntryComponent; - if(otherT == null) return false; + if(other is not CitedArtifactContributorshipEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.Equals(InitialsElement, otherT.InitialsElement)) return false; - if(!comparer.Equals(CollectiveNameElement, otherT.CollectiveNameElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(AffiliationInfo, otherT.AffiliationInfo)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(ContributionType, otherT.ContributionType)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.ListEquals(ContributionInstance, otherT.ContributionInstance)) return false; - if(!comparer.Equals(CorrespondingContactElement, otherT.CorrespondingContactElement)) return false; - if(!comparer.Equals(ListOrderElement, otherT.ListOrderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.Equals(_InitialsElement, otherT._InitialsElement)) return false; + if(!comparer.Equals(_CollectiveNameElement, otherT._CollectiveNameElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_AffiliationInfo, otherT._AffiliationInfo)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_ContributionType, otherT._ContributionType)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.ListEquals(_ContributionInstance, otherT._ContributionInstance)) return false; + if(!comparer.Equals(_CorrespondingContactElement, otherT._CorrespondingContactElement)) return false; + if(!comparer.Equals(_ListOrderElement, otherT._ListOrderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "initials": - value = InitialsElement; - return InitialsElement is not null; + value = _InitialsElement; + return _InitialsElement is not null; case "collectiveName": - value = CollectiveNameElement; - return CollectiveNameElement is not null; + value = _CollectiveNameElement; + return _CollectiveNameElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "affiliationInfo": - value = AffiliationInfo; - return AffiliationInfo?.Any() == true; + value = _AffiliationInfo; + return _AffiliationInfo?.Any() == true; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "contributionType": - value = ContributionType; - return ContributionType?.Any() == true; + value = _ContributionType; + return _ContributionType?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "contributionInstance": - value = ContributionInstance; - return ContributionInstance?.Any() == true; + value = _ContributionInstance; + return _ContributionInstance?.Any() == true; case "correspondingContact": - value = CorrespondingContactElement; - return CorrespondingContactElement is not null; + value = _CorrespondingContactElement; + return _CorrespondingContactElement is not null; case "listOrder": - value = ListOrderElement; - return ListOrderElement is not null; + value = _ListOrderElement; + return _ListOrderElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "initials": - InitialsElement = (Hl7.Fhir.Model.FhirString)value; + InitialsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "collectiveName": - CollectiveNameElement = (Hl7.Fhir.Model.FhirString)value; + CollectiveNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "affiliationInfo": - AffiliationInfo = (List)value; + AffiliationInfo = (List?)value!; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "contributionType": - ContributionType = (List)value; + ContributionType = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contributionInstance": - ContributionInstance = (List)value; + ContributionInstance = (List?)value!; return this; case "correspondingContact": - CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean)value; + CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "listOrder": - ListOrderElement = (Hl7.Fhir.Model.PositiveInt)value; + ListOrderElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -4210,18 +4028,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Name is not null) yield return new KeyValuePair("name",Name); - if (InitialsElement is not null) yield return new KeyValuePair("initials",InitialsElement); - if (CollectiveNameElement is not null) yield return new KeyValuePair("collectiveName",CollectiveNameElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (AffiliationInfo?.Any() == true) yield return new KeyValuePair("affiliationInfo",AffiliationInfo); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (ContributionType?.Any() == true) yield return new KeyValuePair("contributionType",ContributionType); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (ContributionInstance?.Any() == true) yield return new KeyValuePair("contributionInstance",ContributionInstance); - if (CorrespondingContactElement is not null) yield return new KeyValuePair("correspondingContact",CorrespondingContactElement); - if (ListOrderElement is not null) yield return new KeyValuePair("listOrder",ListOrderElement); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_InitialsElement is not null) yield return new KeyValuePair("initials",_InitialsElement); + if (_CollectiveNameElement is not null) yield return new KeyValuePair("collectiveName",_CollectiveNameElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_AffiliationInfo?.Any() == true) yield return new KeyValuePair("affiliationInfo",_AffiliationInfo); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_ContributionType?.Any() == true) yield return new KeyValuePair("contributionType",_ContributionType); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_ContributionInstance?.Any() == true) yield return new KeyValuePair("contributionInstance",_ContributionInstance); + if (_CorrespondingContactElement is not null) yield return new KeyValuePair("correspondingContact",_CorrespondingContactElement); + if (_ListOrderElement is not null) yield return new KeyValuePair("listOrder",_ListOrderElement); } } @@ -4247,28 +4065,25 @@ public partial class CitedArtifactContributorshipEntryAffiliationInfoComponent : /// [FhirElement("affiliation", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString AffiliationElement + public Hl7.Fhir.Model.FhirString? AffiliationElement { get { return _AffiliationElement; } set { _AffiliationElement = value; OnPropertyChanged("AffiliationElement"); } } - private Hl7.Fhir.Model.FhirString _AffiliationElement; + private Hl7.Fhir.Model.FhirString? _AffiliationElement; /// /// Display for the organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Affiliation + public string? Affiliation { - get { return AffiliationElement != null ? AffiliationElement.Value : null; } + get => _AffiliationElement?.Value; set { - if (value == null) - AffiliationElement = null; - else - AffiliationElement = new Hl7.Fhir.Model.FhirString(value); + AffiliationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Affiliation"); } } @@ -4278,28 +4093,25 @@ public string Affiliation /// [FhirElement("role", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RoleElement + public Hl7.Fhir.Model.FhirString? RoleElement { get { return _RoleElement; } set { _RoleElement = value; OnPropertyChanged("RoleElement"); } } - private Hl7.Fhir.Model.FhirString _RoleElement; + private Hl7.Fhir.Model.FhirString? _RoleElement; /// /// Role within the organization, such as professional title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Role + public string? Role { - get { return RoleElement != null ? RoleElement.Value : null; } + get => _RoleElement?.Value; set { - if (value == null) - RoleElement = null; - else - RoleElement = new Hl7.Fhir.Model.FhirString(value); + RoleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Role"); } } @@ -4312,25 +4124,21 @@ public string Role [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactContributorshipEntryAffiliationInfoComponent; - - if (dest == null) - { + if(other is not CitedArtifactContributorshipEntryAffiliationInfoComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AffiliationElement != null) dest.AffiliationElement = (Hl7.Fhir.Model.FhirString)AffiliationElement.DeepCopyInternal(); - if(RoleElement != null) dest.RoleElement = (Hl7.Fhir.Model.FhirString)RoleElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); + if(_AffiliationElement is not null) dest.AffiliationElement = (Hl7.Fhir.Model.FhirString)_AffiliationElement.DeepCopyInternal(); + if(_RoleElement is not null) dest.RoleElement = (Hl7.Fhir.Model.FhirString)_RoleElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4342,48 +4150,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactContributorshipEntryAffiliationInfoComponent; - if(otherT == null) return false; + if(other is not CitedArtifactContributorshipEntryAffiliationInfoComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AffiliationElement, otherT.AffiliationElement)) return false; - if(!comparer.Equals(RoleElement, otherT.RoleElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AffiliationElement, otherT._AffiliationElement)) return false; + if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "affiliation": - value = AffiliationElement; - return AffiliationElement is not null; + value = _AffiliationElement; + return _AffiliationElement is not null; case "role": - value = RoleElement; - return RoleElement is not null; + value = _RoleElement; + return _RoleElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "affiliation": - AffiliationElement = (Hl7.Fhir.Model.FhirString)value; + AffiliationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "role": - RoleElement = (Hl7.Fhir.Model.FhirString)value; + RoleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4394,9 +4202,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AffiliationElement is not null) yield return new KeyValuePair("affiliation",AffiliationElement); - if (RoleElement is not null) yield return new KeyValuePair("role",RoleElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); + if (_AffiliationElement is not null) yield return new KeyValuePair("affiliation",_AffiliationElement); + if (_RoleElement is not null) yield return new KeyValuePair("role",_RoleElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); } } @@ -4421,57 +4229,50 @@ public partial class CitedArtifactContributorshipEntryContributionInstanceCompon [Binding("ArtifactContributionInstanceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The time that the contribution was made. /// [FhirElement("time", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// The time that the contribution was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactContributorshipEntryContributionInstanceComponent; - - if (dest == null) - { + if(other is not CitedArtifactContributorshipEntryContributionInstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4483,41 +4284,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactContributorshipEntryContributionInstanceComponent; - if(otherT == null) return false; + if(other is not CitedArtifactContributorshipEntryContributionInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -4528,8 +4329,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); } } @@ -4553,13 +4354,13 @@ public partial class ContributorshipSummaryComponent : Hl7.Fhir.Model.BackboneEl [FhirElement("type", Order=40)] [Binding("ContributorSummaryType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The format for the display string. @@ -4567,13 +4368,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("style", Order=50)] [Binding("ContributorSummaryStyle")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Style + public Hl7.Fhir.Model.CodeableConcept? Style { get { return _Style; } set { _Style = value; OnPropertyChanged("Style"); } } - private Hl7.Fhir.Model.CodeableConcept _Style; + private Hl7.Fhir.Model.CodeableConcept? _Style; /// /// Used to code the producer or rule for creating the display string. @@ -4581,13 +4382,13 @@ public Hl7.Fhir.Model.CodeableConcept Style [FhirElement("source", Order=60)] [Binding("ContributorSummarySource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Source + public Hl7.Fhir.Model.CodeableConcept? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.CodeableConcept _Source; + private Hl7.Fhir.Model.CodeableConcept? _Source; /// /// The display string for the author list, contributor list, or contributorship statement. @@ -4595,46 +4396,39 @@ public Hl7.Fhir.Model.CodeableConcept Source [FhirElement("value", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown ValueElement + public Hl7.Fhir.Model.Markdown? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.Markdown _ValueElement; + private Hl7.Fhir.Model.Markdown? _ValueElement; /// /// The display string for the author list, contributor list, or contributorship statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.Markdown(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContributorshipSummaryComponent; - - if (dest == null) - { + if(other is not ContributorshipSummaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Style != null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)Style.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.CodeableConcept)Source.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.Markdown)ValueElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Style is not null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)_Style.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.CodeableConcept)_Source.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.Markdown)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4646,55 +4440,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContributorshipSummaryComponent; - if(otherT == null) return false; + if(other is not ContributorshipSummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Style, otherT.Style)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Style, otherT._Style)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "style": - value = Style; - return Style is not null; + value = _Style; + return _Style is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "style": - Style = (Hl7.Fhir.Model.CodeableConcept)value; + Style = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.CodeableConcept)value; + Source = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.Markdown)value; + ValueElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -4705,10 +4499,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Style is not null) yield return new KeyValuePair("style",Style); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Style is not null) yield return new KeyValuePair("style",_Style); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -4718,28 +4512,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this citation, represented as a globally unique URI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4752,39 +4543,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the citation. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the citation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4794,28 +4582,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this citation (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4825,28 +4610,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this citation (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4859,13 +4641,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -4874,13 +4656,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4890,13 +4669,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -4905,13 +4684,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -4921,28 +4697,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -4952,28 +4725,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// The publisher of the Citation, not the publisher of the article or artifact being cited /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -4986,39 +4756,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the citation. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the citation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -5031,11 +4798,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for citation (if applicable). @@ -5046,39 +4813,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this citation is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this citation is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -5088,28 +4852,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions for the Citation, not for the cited artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -5119,28 +4880,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=240)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the citation was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -5150,28 +4908,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=250)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the citation was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -5181,13 +4936,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Who authored the Citation. @@ -5197,11 +4952,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the Citation. @@ -5211,11 +4966,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the Citation. @@ -5225,11 +4980,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the Citation. @@ -5239,11 +4994,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// A human-readable display of the citation. @@ -5253,11 +5008,11 @@ public List Endorser [DataMember] public List Summary { - get { if(_Summary==null) _Summary = new List(); return _Summary; } + get => _Summary ?? new List(); set { _Summary = value; OnPropertyChanged("Summary"); } } - private List _Summary; + private List? _Summary; /// /// The assignment to an organizing scheme. @@ -5267,11 +5022,11 @@ public List Summary [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Used for general notes and annotations not coded elsewhere. @@ -5281,11 +5036,11 @@ public List Classification [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The status of the citation. @@ -5296,11 +5051,11 @@ public List Note [DataMember] public List CurrentState { - get { if(_CurrentState==null) _CurrentState = new List(); return _CurrentState; } + get => _CurrentState ?? new List(); set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } - private List _CurrentState; + private List? _CurrentState; /// /// An effective date or period for a status of the citation. @@ -5310,11 +5065,11 @@ public List CurrentState [DataMember] public List StatusDate { - get { if(_StatusDate==null) _StatusDate = new List(); return _StatusDate; } + get => _StatusDate ?? new List(); set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } - private List _StatusDate; + private List? _StatusDate; /// /// Artifact related to the Citation Resource. @@ -5324,66 +5079,62 @@ public List StatusDate [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// The article or artifact being described. /// [FhirElement("citedArtifact", Order=370)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactComponent CitedArtifact + public Hl7.Fhir.Model.Citation.CitedArtifactComponent? CitedArtifact { get { return _CitedArtifact; } set { _CitedArtifact = value; OnPropertyChanged("CitedArtifact"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactComponent _CitedArtifact; + private Hl7.Fhir.Model.Citation.CitedArtifactComponent? _CitedArtifact; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Citation; - - if (dest == null) - { + if(other is not Citation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(Summary.Any()) dest.Summary = new List(Summary.DeepCopyInternal()); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(CurrentState.Any()) dest.CurrentState = new List(CurrentState.DeepCopyInternal()); - if(StatusDate.Any()) dest.StatusDate = new List(StatusDate.DeepCopyInternal()); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(CitedArtifact != null) dest.CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent)CitedArtifact.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_Summary is not null) dest.Summary = new List(_Summary.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_CurrentState is not null) dest.CurrentState = new List(_CurrentState.DeepCopyInternal()); + if(_StatusDate is not null) dest.StatusDate = new List(_StatusDate.DeepCopyInternal()); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_CitedArtifact is not null) dest.CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent)_CitedArtifact.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5395,230 +5146,230 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Citation; - if(otherT == null) return false; + if(other is not Citation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(Summary, otherT.Summary)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(CurrentState, otherT.CurrentState)) return false; - if(!comparer.ListEquals(StatusDate, otherT.StatusDate)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.Equals(CitedArtifact, otherT.CitedArtifact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_Summary, otherT._Summary)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_CurrentState, otherT._CurrentState)) return false; + if(!comparer.ListEquals(_StatusDate, otherT._StatusDate)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.Equals(_CitedArtifact, otherT._CitedArtifact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "summary": - value = Summary; - return Summary?.Any() == true; + value = _Summary; + return _Summary?.Any() == true; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "currentState": - value = CurrentState; - return CurrentState?.Any() == true; + value = _CurrentState; + return _CurrentState?.Any() == true; case "statusDate": - value = StatusDate; - return StatusDate?.Any() == true; + value = _StatusDate; + return _StatusDate?.Any() == true; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "citedArtifact": - value = CitedArtifact; - return CitedArtifact is not null; + value = _CitedArtifact; + return _CitedArtifact is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "summary": - Summary = (List)value; + Summary = (List?)value!; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "currentState": - CurrentState = (List)value; + CurrentState = (List?)value!; return this; case "statusDate": - StatusDate = (List)value; + StatusDate = (List?)value!; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "citedArtifact": - CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent)value; + CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent?)value; return this; default: return base.SetValue(key, value); @@ -5629,35 +5380,35 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (Summary?.Any() == true) yield return new KeyValuePair("summary",Summary); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (CurrentState?.Any() == true) yield return new KeyValuePair("currentState",CurrentState); - if (StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",StatusDate); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (CitedArtifact is not null) yield return new KeyValuePair("citedArtifact",CitedArtifact); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_Summary?.Any() == true) yield return new KeyValuePair("summary",_Summary); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_CurrentState?.Any() == true) yield return new KeyValuePair("currentState",_CurrentState); + if (_StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",_StatusDate); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_CitedArtifact is not null) yield return new KeyValuePair("citedArtifact",_CitedArtifact); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs index de36812cf..45d0d325d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -98,40 +101,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// File or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -226,13 +225,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [Binding("PayeeType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient reference. @@ -241,26 +240,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,41 +267,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -317,8 +312,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -345,13 +340,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Order of care team @@ -360,13 +355,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -379,26 +371,26 @@ public int? Sequence [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Indicator of the lead practitioner. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Indicator of the lead practitioner @@ -407,13 +399,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -424,13 +413,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Practitioner credential or specialization. @@ -438,29 +427,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("qualification", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Qualification + public Hl7.Fhir.Model.CodeableConcept? Qualification { get { return _Qualification; } set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private Hl7.Fhir.Model.CodeableConcept _Qualification; + private Hl7.Fhir.Model.CodeableConcept? _Qualification; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Qualification != null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)Qualification.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Qualification is not null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)_Qualification.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -472,62 +457,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Qualification, otherT.Qualification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "qualification": - value = Qualification; - return Qualification is not null; + value = _Qualification; + return _Qualification is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualification": - Qualification = (Hl7.Fhir.Model.CodeableConcept)value; + Qualification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -538,11 +523,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Qualification is not null) yield return new KeyValuePair("qualification",Qualification); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Qualification is not null) yield return new KeyValuePair("qualification",_Qualification); } } @@ -570,13 +555,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -585,13 +570,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -603,13 +585,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -617,13 +599,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -632,13 +614,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Data to be provided. @@ -648,13 +630,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Explanation for the information. @@ -662,30 +644,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -697,69 +675,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -770,12 +748,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -802,13 +780,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Diagnosis instance identifier @@ -817,13 +795,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -838,13 +813,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -855,11 +830,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Present on admission. @@ -867,13 +842,13 @@ public List Type [FhirElement("onAdmission", Order=70)] [Binding("DiagnosisOnAdmission")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OnAdmission + public Hl7.Fhir.Model.CodeableConcept? OnAdmission { get { return _OnAdmission; } set { _OnAdmission = value; OnPropertyChanged("OnAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _OnAdmission; + private Hl7.Fhir.Model.CodeableConcept? _OnAdmission; /// /// Package billing code. @@ -881,29 +856,25 @@ public Hl7.Fhir.Model.CodeableConcept OnAdmission [FhirElement("packageCode", Order=80)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PackageCode + public Hl7.Fhir.Model.CodeableConcept? PackageCode { get { return _PackageCode; } set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private Hl7.Fhir.Model.CodeableConcept _PackageCode; + private Hl7.Fhir.Model.CodeableConcept? _PackageCode; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(OnAdmission != null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)OnAdmission.DeepCopyInternal(); - if(PackageCode != null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)PackageCode.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_OnAdmission is not null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)_OnAdmission.DeepCopyInternal(); + if(_PackageCode is not null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)_PackageCode.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -915,62 +886,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(OnAdmission, otherT.OnAdmission)) return false; - if(!comparer.Equals(PackageCode, otherT.PackageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; + if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "onAdmission": - value = OnAdmission; - return OnAdmission is not null; + value = _OnAdmission; + return _OnAdmission is not null; case "packageCode": - value = PackageCode; - return PackageCode is not null; + value = _PackageCode; + return _PackageCode is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "onAdmission": - OnAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + OnAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "packageCode": - PackageCode = (Hl7.Fhir.Model.CodeableConcept)value; + PackageCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -981,11 +952,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (OnAdmission is not null) yield return new KeyValuePair("onAdmission",OnAdmission); - if (PackageCode is not null) yield return new KeyValuePair("packageCode",PackageCode); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_OnAdmission is not null) yield return new KeyValuePair("onAdmission",_OnAdmission); + if (_PackageCode is not null) yield return new KeyValuePair("packageCode",_PackageCode); } } @@ -1012,13 +983,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure instance identifier @@ -1027,13 +998,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1047,39 +1015,36 @@ public int? Sequence [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// When the procedure was performed. /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1094,13 +1059,13 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; /// /// Unique device identifier. @@ -1112,27 +1077,23 @@ public Hl7.Fhir.Model.DataType Procedure [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1144,62 +1105,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1210,11 +1171,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -1242,13 +1203,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Insurance instance identifier @@ -1257,13 +1218,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1274,13 +1232,13 @@ public int? Sequence [FhirElement("focal", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -1289,13 +1247,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -1305,13 +1260,13 @@ public bool? Focal /// [FhirElement("identifier", Order=60, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Insurance information. @@ -1321,41 +1276,38 @@ public Hl7.Fhir.Model.Identifier Identifier [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -1368,24 +1320,24 @@ public string BusinessArrangement [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Prior authorization reference number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1399,31 +1351,27 @@ public IEnumerable PreAuthRef [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1435,76 +1383,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1515,13 +1463,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -1548,28 +1496,25 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("date", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the incident occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1580,13 +1525,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the event occurred. @@ -1596,27 +1541,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1628,48 +1569,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1680,9 +1621,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1709,13 +1650,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -1724,13 +1665,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1743,24 +1681,24 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get { if(_CareTeamSequenceElement==null) _CareTeamSequenceElement = new List(); return _CareTeamSequenceElement; } + get => _CareTeamSequenceElement ?? new List(); set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } - private List _CareTeamSequenceElement; + private List? _CareTeamSequenceElement; /// /// Applicable careTeam members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamSequence + public IEnumerable? CareTeamSequence { - get { return CareTeamSequenceElement != null ? CareTeamSequenceElement.Select(elem => elem.Value) : null; } + get => _CareTeamSequenceElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamSequenceElement = null; + CareTeamSequenceElement = null!; else CareTeamSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamSequence"); @@ -1775,24 +1713,24 @@ public IEnumerable CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get { if(_DiagnosisSequenceElement==null) _DiagnosisSequenceElement = new List(); return _DiagnosisSequenceElement; } + get => _DiagnosisSequenceElement ?? new List(); set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } - private List _DiagnosisSequenceElement; + private List? _DiagnosisSequenceElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisSequence + public IEnumerable? DiagnosisSequence { - get { return DiagnosisSequenceElement != null ? DiagnosisSequenceElement.Select(elem => elem.Value) : null; } + get => _DiagnosisSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisSequenceElement = null; + DiagnosisSequenceElement = null!; else DiagnosisSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisSequence"); @@ -1807,24 +1745,24 @@ public IEnumerable DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get { if(_ProcedureSequenceElement==null) _ProcedureSequenceElement = new List(); return _ProcedureSequenceElement; } + get => _ProcedureSequenceElement ?? new List(); set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } - private List _ProcedureSequenceElement; + private List? _ProcedureSequenceElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureSequence + public IEnumerable? ProcedureSequence { - get { return ProcedureSequenceElement != null ? ProcedureSequenceElement.Select(elem => elem.Value) : null; } + get => _ProcedureSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureSequenceElement = null; + ProcedureSequenceElement = null!; else ProcedureSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureSequence"); @@ -1839,24 +1777,24 @@ public IEnumerable ProcedureSequence [DataMember] public List InformationSequenceElement { - get { if(_InformationSequenceElement==null) _InformationSequenceElement = new List(); return _InformationSequenceElement; } + get => _InformationSequenceElement ?? new List(); set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } - private List _InformationSequenceElement; + private List? _InformationSequenceElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationSequence + public IEnumerable? InformationSequence { - get { return InformationSequenceElement != null ? InformationSequenceElement.Select(elem => elem.Value) : null; } + get => _InformationSequenceElement?.Select(elem => elem.Value); set { if (value == null) - InformationSequenceElement = null; + InformationSequenceElement = null!; else InformationSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationSequence"); @@ -1869,13 +1807,13 @@ public IEnumerable InformationSequence [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -1883,13 +1821,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=100)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -1898,13 +1836,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -1915,11 +1853,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -1930,11 +1868,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -1943,13 +1881,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -1960,52 +1898,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2014,13 +1952,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2030,13 +1965,13 @@ public decimal? Factor /// [FhirElement("net", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2048,11 +1983,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Anatomical location. @@ -2060,13 +1995,13 @@ public List Udi [FhirElement("bodySite", Order=210)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -2077,11 +2012,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Encounters related to this billed item. @@ -2093,11 +2028,11 @@ public List SubSite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Product or service provided. @@ -2107,43 +2042,39 @@ public List Encounter [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(CareTeamSequenceElement.Any()) dest.CareTeamSequenceElement = new List(CareTeamSequenceElement.DeepCopyInternal()); - if(DiagnosisSequenceElement.Any()) dest.DiagnosisSequenceElement = new List(DiagnosisSequenceElement.DeepCopyInternal()); - if(ProcedureSequenceElement.Any()) dest.ProcedureSequenceElement = new List(ProcedureSequenceElement.DeepCopyInternal()); - if(InformationSequenceElement.Any()) dest.InformationSequenceElement = new List(InformationSequenceElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_CareTeamSequenceElement is not null) dest.CareTeamSequenceElement = new List(_CareTeamSequenceElement.DeepCopyInternal()); + if(_DiagnosisSequenceElement is not null) dest.DiagnosisSequenceElement = new List(_DiagnosisSequenceElement.DeepCopyInternal()); + if(_ProcedureSequenceElement is not null) dest.ProcedureSequenceElement = new List(_ProcedureSequenceElement.DeepCopyInternal()); + if(_InformationSequenceElement is not null) dest.InformationSequenceElement = new List(_InformationSequenceElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2155,174 +2086,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(CareTeamSequenceElement, otherT.CareTeamSequenceElement)) return false; - if(!comparer.ListEquals(DiagnosisSequenceElement, otherT.DiagnosisSequenceElement)) return false; - if(!comparer.ListEquals(ProcedureSequenceElement, otherT.ProcedureSequenceElement)) return false; - if(!comparer.ListEquals(InformationSequenceElement, otherT.InformationSequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; + if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; + if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; + if(!comparer.ListEquals(_InformationSequenceElement, otherT._InformationSequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "careTeamSequence": - value = CareTeamSequenceElement; - return CareTeamSequenceElement?.Any() == true; + value = _CareTeamSequenceElement; + return _CareTeamSequenceElement?.Any() == true; case "diagnosisSequence": - value = DiagnosisSequenceElement; - return DiagnosisSequenceElement?.Any() == true; + value = _DiagnosisSequenceElement; + return _DiagnosisSequenceElement?.Any() == true; case "procedureSequence": - value = ProcedureSequenceElement; - return ProcedureSequenceElement?.Any() == true; + value = _ProcedureSequenceElement; + return _ProcedureSequenceElement?.Any() == true; case "informationSequence": - value = InformationSequenceElement; - return InformationSequenceElement?.Any() == true; + value = _InformationSequenceElement; + return _InformationSequenceElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "careTeamSequence": - CareTeamSequenceElement = (List)value; + CareTeamSequenceElement = (List?)value!; return this; case "diagnosisSequence": - DiagnosisSequenceElement = (List)value; + DiagnosisSequenceElement = (List?)value!; return this; case "procedureSequence": - ProcedureSequenceElement = (List)value; + ProcedureSequenceElement = (List?)value!; return this; case "informationSequence": - InformationSequenceElement = (List)value; + InformationSequenceElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2333,27 +2264,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",CareTeamSequenceElement); - if (DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",DiagnosisSequenceElement); - if (ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",ProcedureSequenceElement); - if (InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",InformationSequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",_CareTeamSequenceElement); + if (_DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",_DiagnosisSequenceElement); + if (_ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",_ProcedureSequenceElement); + if (_InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",_InformationSequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2380,13 +2311,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -2395,13 +2326,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2412,13 +2340,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -2426,13 +2354,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2441,13 +2369,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -2458,11 +2386,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2473,50 +2401,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2525,13 +2453,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2541,13 +2466,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2559,11 +2484,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Product or service provided. @@ -2573,34 +2498,30 @@ public List Udi [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2612,111 +2533,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2727,18 +2648,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -2765,13 +2686,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -2780,13 +2701,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2797,13 +2715,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -2811,13 +2729,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2826,13 +2744,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -2843,11 +2761,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2858,50 +2776,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2910,13 +2828,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2926,13 +2841,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2944,33 +2859,29 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2982,104 +2893,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3090,17 +3001,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -3113,11 +3024,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -3127,13 +3038,13 @@ public List Identifier [Binding("ClaimStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -3142,13 +3053,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3160,13 +3068,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -3174,13 +3082,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=120, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -3190,13 +3098,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -3205,13 +3113,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -3224,26 +3129,26 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Relevant time frame for the claim. /// [FhirElement("billablePeriod", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Resource creation date. @@ -3251,28 +3156,25 @@ public Hl7.Fhir.Model.Period BillablePeriod [FhirElement("created", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Resource creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -3284,13 +3186,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Target. @@ -3299,13 +3201,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -3315,13 +3217,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Desired processing ugency. @@ -3330,13 +3232,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [Binding("ProcessPriority")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// For whom to reserve funds. @@ -3344,13 +3246,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("fundsReserve", Order=210)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Prior or corollary claims. @@ -3360,11 +3262,11 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services and products. @@ -3373,13 +3275,13 @@ public List Related [CLSCompliant(false)] [References("DeviceRequest","MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superseded by fulfiller. @@ -3388,26 +3290,26 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("DeviceRequest","MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Recipient of benefits payable. /// [FhirElement("payee", Order=250)] [DataMember] - public Hl7.Fhir.Model.Claim.PayeeComponent Payee + public Hl7.Fhir.Model.Claim.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.Claim.PayeeComponent _Payee; + private Hl7.Fhir.Model.Claim.PayeeComponent? _Payee; /// /// Treatment referral. @@ -3416,13 +3318,13 @@ public Hl7.Fhir.Model.Claim.PayeeComponent Payee [CLSCompliant(false)] [References("ServiceRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Servicing facility. @@ -3431,13 +3333,13 @@ public Hl7.Fhir.Model.ResourceReference Referral [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Members of the care team. @@ -3447,11 +3349,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Supporting information. @@ -3461,11 +3363,11 @@ public List CareTeam [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Pertinent diagnosis information. @@ -3475,11 +3377,11 @@ public List SupportingInfo [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Clinical procedures performed. @@ -3489,11 +3391,11 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Patient insurance information. @@ -3503,24 +3405,24 @@ public List Procedure [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Details of the event. /// [FhirElement("accident", Order=330)] [DataMember] - public Hl7.Fhir.Model.Claim.AccidentComponent Accident + public Hl7.Fhir.Model.Claim.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.Claim.AccidentComponent _Accident; + private Hl7.Fhir.Model.Claim.AccidentComponent? _Accident; /// /// Product or service provided. @@ -3530,64 +3432,60 @@ public Hl7.Fhir.Model.Claim.AccidentComponent Accident [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Total claim cost. /// [FhirElement("total", Order=350)] [DataMember] - public Hl7.Fhir.Model.Money Total + public Hl7.Fhir.Model.Money? Total { get { return _Total; } set { _Total = value; OnPropertyChanged("Total"); } } - private Hl7.Fhir.Model.Money _Total; + private Hl7.Fhir.Model.Money? _Total; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Claim; - - if (dest == null) - { + if(other is not Claim dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)Payee.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)Accident.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(Total != null) dest.Total = (Hl7.Fhir.Model.Money)Total.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)_Accident.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_Total is not null) dest.Total = (Hl7.Fhir.Model.Money)_Total.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3599,216 +3497,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Claim; - if(otherT == null) return false; + if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.Equals(Total, otherT.Total)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Total, otherT._Total)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "total": - value = Total; - return Total is not null; + value = _Total; + return _Total is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.Claim.PayeeComponent?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "accident": - Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.Claim.AccidentComponent?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "total": - Total = (Hl7.Fhir.Model.Money)value; + Total = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -3819,33 +3717,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (Total is not null) yield return new KeyValuePair("total",Total); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_Total is not null) yield return new KeyValuePair("total",_Total); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs index 9a2118cdf..31cf35729 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("itemSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ItemSequenceElement + public Hl7.Fhir.Model.PositiveInt? ItemSequenceElement { get { return _ItemSequenceElement; } set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _ItemSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _ItemSequenceElement; /// /// Claim item instance identifier @@ -96,13 +99,10 @@ public Hl7.Fhir.Model.PositiveInt ItemSequenceElement [IgnoreDataMember] public int? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Value : null; } + get => _ItemSequenceElement?.Value; set { - if (value == null) - ItemSequenceElement = null; - else - ItemSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + ItemSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("ItemSequence"); } } @@ -115,24 +115,24 @@ public int? ItemSequence [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -147,11 +147,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication for claim details. @@ -161,26 +161,22 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement != null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)ItemSequenceElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)_ItemSequenceElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -192,55 +188,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement is not null; + value = _ItemSequenceElement; + return _ItemSequenceElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -251,10 +247,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -282,13 +278,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of adjudication outcome. @@ -296,39 +292,39 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monetary value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Non-monetary value @@ -337,31 +333,24 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -373,55 +362,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -432,10 +421,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -462,13 +451,13 @@ public partial class ItemDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("detailSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? DetailSequenceElement { get { return _DetailSequenceElement; } set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DetailSequenceElement; /// /// Claim detail instance identifier @@ -477,13 +466,10 @@ public Hl7.Fhir.Model.PositiveInt DetailSequenceElement [IgnoreDataMember] public int? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Value : null; } + get => _DetailSequenceElement?.Value; set { - if (value == null) - DetailSequenceElement = null; - else - DetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DetailSequence"); } } @@ -496,24 +482,24 @@ public int? DetailSequence [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -528,11 +514,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication for claim sub-details. @@ -542,26 +528,22 @@ public List Adjudication [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemDetailComponent; - - if (dest == null) - { + if(other is not ItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DetailSequenceElement != null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)DetailSequenceElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DetailSequenceElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -573,55 +555,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemDetailComponent; - if(otherT == null) return false; + if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement is not null; + value = _DetailSequenceElement; + return _DetailSequenceElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "detailSequence": - DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -632,10 +614,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -662,13 +644,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("subDetailSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? SubDetailSequenceElement { get { return _SubDetailSequenceElement; } set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SubDetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SubDetailSequenceElement; /// /// Claim sub-detail instance identifier @@ -677,13 +659,10 @@ public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement [IgnoreDataMember] public int? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Value : null; } + get => _SubDetailSequenceElement?.Value; set { - if (value == null) - SubDetailSequenceElement = null; - else - SubDetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SubDetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SubDetailSequence"); } } @@ -696,24 +675,24 @@ public int? SubDetailSequence [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -728,25 +707,21 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubDetailSequenceElement != null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)SubDetailSequenceElement.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_SubDetailSequenceElement.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -758,48 +733,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement is not null; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subDetailSequence": - SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -810,9 +785,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -841,24 +816,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get { if(_ItemSequenceElement==null) _ItemSequenceElement = new List(); return _ItemSequenceElement; } + get => _ItemSequenceElement ?? new List(); set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private List _ItemSequenceElement; + private List? _ItemSequenceElement; /// /// Item sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ItemSequence + public IEnumerable? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Select(elem => elem.Value) : null; } + get => _ItemSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ItemSequenceElement = null; + ItemSequenceElement = null!; else ItemSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ItemSequence"); @@ -873,24 +848,24 @@ public IEnumerable ItemSequence [DataMember] public List DetailSequenceElement { - get { if(_DetailSequenceElement==null) _DetailSequenceElement = new List(); return _DetailSequenceElement; } + get => _DetailSequenceElement ?? new List(); set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private List _DetailSequenceElement; + private List? _DetailSequenceElement; /// /// Detail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DetailSequence + public IEnumerable? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Select(elem => elem.Value) : null; } + get => _DetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DetailSequenceElement = null; + DetailSequenceElement = null!; else DetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DetailSequence"); @@ -905,24 +880,24 @@ public IEnumerable DetailSequence [DataMember] public List SubdetailSequenceElement { - get { if(_SubdetailSequenceElement==null) _SubdetailSequenceElement = new List(); return _SubdetailSequenceElement; } + get => _SubdetailSequenceElement ?? new List(); set { _SubdetailSequenceElement = value; OnPropertyChanged("SubdetailSequenceElement"); } } - private List _SubdetailSequenceElement; + private List? _SubdetailSequenceElement; /// /// Subdetail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubdetailSequence + public IEnumerable? SubdetailSequence { - get { return SubdetailSequenceElement != null ? SubdetailSequenceElement.Select(elem => elem.Value) : null; } + get => _SubdetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SubdetailSequenceElement = null; + SubdetailSequenceElement = null!; else SubdetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SubdetailSequence"); @@ -939,11 +914,11 @@ public IEnumerable SubdetailSequence [DataMember] public List Provider { - get { if(_Provider==null) _Provider = new List(); return _Provider; } + get => _Provider ?? new List(); set { _Provider = value; OnPropertyChanged("Provider"); } } - private List _Provider; + private List? _Provider; /// /// Billing, service, product, or drug code. @@ -952,13 +927,13 @@ public List Provider [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -969,11 +944,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -984,11 +959,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -997,13 +972,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -1014,52 +989,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1068,13 +1043,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1084,13 +1056,13 @@ public decimal? Factor /// [FhirElement("net", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Anatomical location. @@ -1098,13 +1070,13 @@ public Hl7.Fhir.Model.Money Net [FhirElement("bodySite", Order=170)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -1115,11 +1087,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Applicable note numbers. @@ -1129,24 +1101,24 @@ public List SubSite [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1161,11 +1133,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line details. @@ -1175,40 +1147,36 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement.Any()) dest.ItemSequenceElement = new List(ItemSequenceElement.DeepCopyInternal()); - if(DetailSequenceElement.Any()) dest.DetailSequenceElement = new List(DetailSequenceElement.DeepCopyInternal()); - if(SubdetailSequenceElement.Any()) dest.SubdetailSequenceElement = new List(SubdetailSequenceElement.DeepCopyInternal()); - if(Provider.Any()) dest.Provider = new List(Provider.DeepCopyInternal()); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = new List(_ItemSequenceElement.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = new List(_DetailSequenceElement.DeepCopyInternal()); + if(_SubdetailSequenceElement is not null) dest.SubdetailSequenceElement = new List(_SubdetailSequenceElement.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = new List(_Provider.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1220,153 +1188,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(SubdetailSequenceElement, otherT.SubdetailSequenceElement)) return false; - if(!comparer.ListEquals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_SubdetailSequenceElement, otherT._SubdetailSequenceElement)) return false; + if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement?.Any() == true; + value = _ItemSequenceElement; + return _ItemSequenceElement?.Any() == true; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement?.Any() == true; + value = _DetailSequenceElement; + return _DetailSequenceElement?.Any() == true; case "subdetailSequence": - value = SubdetailSequenceElement; - return SubdetailSequenceElement?.Any() == true; + value = _SubdetailSequenceElement; + return _SubdetailSequenceElement?.Any() == true; case "provider": - value = Provider; - return Provider?.Any() == true; + value = _Provider; + return _Provider?.Any() == true; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (List)value; + ItemSequenceElement = (List?)value!; return this; case "detailSequence": - DetailSequenceElement = (List)value; + DetailSequenceElement = (List?)value!; return this; case "subdetailSequence": - SubdetailSequenceElement = (List)value; + SubdetailSequenceElement = (List?)value!; return this; case "provider": - Provider = (List)value; + Provider = (List?)value!; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1377,24 +1345,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubdetailSequenceElement?.Any() == true) yield return new KeyValuePair("subdetailSequence",SubdetailSequenceElement); - if (Provider?.Any() == true) yield return new KeyValuePair("provider",Provider); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubdetailSequenceElement?.Any() == true) yield return new KeyValuePair("subdetailSequence",_SubdetailSequenceElement); + if (_Provider?.Any() == true) yield return new KeyValuePair("provider",_Provider); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -1422,13 +1390,13 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -1439,50 +1407,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1491,13 +1459,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1507,13 +1472,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -1523,24 +1488,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1555,11 +1520,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -1569,31 +1534,27 @@ public List Adjudication [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1605,90 +1566,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1699,15 +1660,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -1735,13 +1696,13 @@ public partial class AddedItemSubDetailComponent : Hl7.Fhir.Model.BackboneElemen [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -1752,50 +1713,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1804,13 +1765,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1820,13 +1778,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -1836,24 +1794,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1868,30 +1826,26 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemSubDetailComponent; - - if (dest == null) - { + if(other is not AddedItemSubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1903,83 +1857,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemSubDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1990,14 +1944,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -2026,13 +1980,13 @@ public partial class TotalComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Financial total for the category. @@ -2040,26 +1994,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("amount", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as TotalComponent; - - if (dest == null) - { + if(other is not TotalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2071,41 +2021,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TotalComponent; - if(otherT == null) return false; + if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -2116,8 +2066,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -2145,26 +2095,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [Binding("PaymentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the adjustment. @@ -2172,41 +2122,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected date of payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected date of payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -2217,43 +2164,39 @@ public string Date [FhirElement("amount", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Business identifier for the payment. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2265,69 +2208,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -2338,12 +2281,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -2369,13 +2312,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Note instance identifier @@ -2384,13 +2327,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -2402,13 +2342,13 @@ public int? Number [DeclaredType(Type = typeof(Code))] [Binding("NoteType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// display | print | printoper @@ -2417,13 +2357,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NoteType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2434,28 +2371,25 @@ public Hl7.Fhir.Model.NoteType? Type [FhirElement("text", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -2466,28 +2400,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2499,55 +2429,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -2558,10 +2488,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -2589,13 +2519,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Insurance instance identifier @@ -2604,13 +2534,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2621,13 +2548,13 @@ public int? Sequence [FhirElement("focal", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -2636,13 +2563,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -2655,41 +2579,38 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -2701,29 +2622,25 @@ public string BusinessArrangement [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2735,62 +2652,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -2801,11 +2718,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -2832,13 +2749,13 @@ public partial class ErrorComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("itemSequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ItemSequenceElement + public Hl7.Fhir.Model.PositiveInt? ItemSequenceElement { get { return _ItemSequenceElement; } set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _ItemSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _ItemSequenceElement; /// /// Item sequence number @@ -2847,13 +2764,10 @@ public Hl7.Fhir.Model.PositiveInt ItemSequenceElement [IgnoreDataMember] public int? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Value : null; } + get => _ItemSequenceElement?.Value; set { - if (value == null) - ItemSequenceElement = null; - else - ItemSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + ItemSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("ItemSequence"); } } @@ -2863,13 +2777,13 @@ public int? ItemSequence /// [FhirElement("detailSequence", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? DetailSequenceElement { get { return _DetailSequenceElement; } set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DetailSequenceElement; /// /// Detail sequence number @@ -2878,13 +2792,10 @@ public Hl7.Fhir.Model.PositiveInt DetailSequenceElement [IgnoreDataMember] public int? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Value : null; } + get => _DetailSequenceElement?.Value; set { - if (value == null) - DetailSequenceElement = null; - else - DetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DetailSequence"); } } @@ -2894,13 +2805,13 @@ public int? DetailSequence /// [FhirElement("subDetailSequence", Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? SubDetailSequenceElement { get { return _SubDetailSequenceElement; } set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SubDetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SubDetailSequenceElement; /// /// Subdetail sequence number @@ -2909,13 +2820,10 @@ public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement [IgnoreDataMember] public int? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Value : null; } + get => _SubDetailSequenceElement?.Value; set { - if (value == null) - SubDetailSequenceElement = null; - else - SubDetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SubDetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SubDetailSequence"); } } @@ -2927,28 +2835,24 @@ public int? SubDetailSequence [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorComponent; - - if (dest == null) - { + if(other is not ErrorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement != null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)ItemSequenceElement.DeepCopyInternal(); - if(DetailSequenceElement != null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)DetailSequenceElement.DeepCopyInternal(); - if(SubDetailSequenceElement != null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)SubDetailSequenceElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)_ItemSequenceElement.DeepCopyInternal(); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DetailSequenceElement.DeepCopyInternal(); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_SubDetailSequenceElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2960,55 +2864,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorComponent; - if(otherT == null) return false; + if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.Equals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.Equals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement is not null; + value = _ItemSequenceElement; + return _ItemSequenceElement is not null; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement is not null; + value = _DetailSequenceElement; + return _DetailSequenceElement is not null; case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement is not null; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "detailSequence": - DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "subDetailSequence": - SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -3019,10 +2923,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -3035,11 +2939,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -3049,13 +2953,13 @@ public List Identifier [Binding("ClaimResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -3064,13 +2968,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3082,13 +2983,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -3096,13 +2997,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=120, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -3112,13 +3013,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -3127,13 +3028,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -3146,13 +3044,13 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Response creation date. @@ -3160,28 +3058,25 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("created", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -3194,13 +3089,13 @@ public string Created [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -3209,13 +3104,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// Id of resource triggering adjudication. @@ -3224,13 +3119,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -3240,13 +3135,13 @@ public Hl7.Fhir.Model.ResourceReference Request [Binding("RemittanceOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -3255,13 +3150,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.RemittanceOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -3271,28 +3163,25 @@ public Hl7.Fhir.Model.RemittanceOutcome? Outcome /// [FhirElement("disposition", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -3302,28 +3191,25 @@ public string Disposition /// [FhirElement("preAuthRef", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -3333,13 +3219,13 @@ public string PreAuthRef /// [FhirElement("preAuthPeriod", Order=220)] [DataMember] - public Hl7.Fhir.Model.Period PreAuthPeriod + public Hl7.Fhir.Model.Period? PreAuthPeriod { get { return _PreAuthPeriod; } set { _PreAuthPeriod = value; OnPropertyChanged("PreAuthPeriod"); } } - private Hl7.Fhir.Model.Period _PreAuthPeriod; + private Hl7.Fhir.Model.Period? _PreAuthPeriod; /// /// Party to be paid any benefits payable. @@ -3347,13 +3233,13 @@ public Hl7.Fhir.Model.Period PreAuthPeriod [FhirElement("payeeType", Order=230)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PayeeType + public Hl7.Fhir.Model.CodeableConcept? PayeeType { get { return _PayeeType; } set { _PayeeType = value; OnPropertyChanged("PayeeType"); } } - private Hl7.Fhir.Model.CodeableConcept _PayeeType; + private Hl7.Fhir.Model.CodeableConcept? _PayeeType; /// /// Adjudication for claim line items. @@ -3363,11 +3249,11 @@ public Hl7.Fhir.Model.CodeableConcept PayeeType [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -3377,11 +3263,11 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Header-level adjudication. @@ -3391,11 +3277,11 @@ public List AddItem [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication totals. @@ -3405,24 +3291,24 @@ public List Adjudication [DataMember] public List Total { - get { if(_Total==null) _Total = new List(); return _Total; } + get => _Total ?? new List(); set { _Total = value; OnPropertyChanged("Total"); } } - private List _Total; + private List? _Total; /// /// Payment Details. /// [FhirElement("payment", Order=280)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment + public Hl7.Fhir.Model.ClaimResponse.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ClaimResponse.PaymentComponent _Payment; + private Hl7.Fhir.Model.ClaimResponse.PaymentComponent? _Payment; /// /// Funds reserved status. @@ -3430,13 +3316,13 @@ public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment [FhirElement("fundsReserve", Order=290)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Printed form identifier. @@ -3444,26 +3330,26 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [FhirElement("formCode", Order=300)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Printed reference or actual form. /// [FhirElement("form", Order=310)] [DataMember] - public Hl7.Fhir.Model.Attachment Form + public Hl7.Fhir.Model.Attachment? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.Attachment _Form; + private Hl7.Fhir.Model.Attachment? _Form; /// /// Note concerning adjudication. @@ -3473,11 +3359,11 @@ public Hl7.Fhir.Model.Attachment Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// Request for additional information. @@ -3489,11 +3375,11 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get { if(_CommunicationRequest==null) _CommunicationRequest = new List(); return _CommunicationRequest; } + get => _CommunicationRequest ?? new List(); set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } - private List _CommunicationRequest; + private List? _CommunicationRequest; /// /// Patient insurance information. @@ -3503,11 +3389,11 @@ public List CommunicationRequest [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Processing errors. @@ -3517,51 +3403,47 @@ public List Insurance [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClaimResponse; - - if (dest == null) - { + if(other is not ClaimResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(PreAuthPeriod != null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)PreAuthPeriod.DeepCopyInternal(); - if(PayeeType != null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)PayeeType.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Total.Any()) dest.Total = new List(Total.DeepCopyInternal()); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)Payment.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.Attachment)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(CommunicationRequest.Any()) dest.CommunicationRequest = new List(CommunicationRequest.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_PreAuthPeriod is not null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)_PreAuthPeriod.DeepCopyInternal(); + if(_PayeeType is not null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)_PayeeType.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Total is not null) dest.Total = new List(_Total.DeepCopyInternal()); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)_Payment.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.Attachment)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_CommunicationRequest is not null) dest.CommunicationRequest = new List(_CommunicationRequest.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3573,216 +3455,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClaimResponse; - if(otherT == null) return false; + if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(PreAuthPeriod, otherT.PreAuthPeriod)) return false; - if(!comparer.Equals(PayeeType, otherT.PayeeType)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Total, otherT.Total)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.ListEquals(CommunicationRequest, otherT.CommunicationRequest)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_PreAuthPeriod, otherT._PreAuthPeriod)) return false; + if(!comparer.Equals(_PayeeType, otherT._PayeeType)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Total, otherT._Total)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "preAuthPeriod": - value = PreAuthPeriod; - return PreAuthPeriod is not null; + value = _PreAuthPeriod; + return _PreAuthPeriod is not null; case "payeeType": - value = PayeeType; - return PayeeType is not null; + value = _PayeeType; + return _PayeeType is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "total": - value = Total; - return Total?.Any() == true; + value = _Total; + return _Total?.Any() == true; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "communicationRequest": - value = CommunicationRequest; - return CommunicationRequest?.Any() == true; + value = _CommunicationRequest; + return _CommunicationRequest?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthPeriod": - PreAuthPeriod = (Hl7.Fhir.Model.Period)value; + PreAuthPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "payeeType": - PayeeType = (Hl7.Fhir.Model.CodeableConcept)value; + PayeeType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "total": - Total = (List)value; + Total = (List?)value!; return this; case "payment": - Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "form": - Form = (Hl7.Fhir.Model.Attachment)value; + Form = (Hl7.Fhir.Model.Attachment?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "communicationRequest": - CommunicationRequest = (List)value; + CommunicationRequest = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3793,33 +3675,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",PreAuthPeriod); - if (PayeeType is not null) yield return new KeyValuePair("payeeType",PayeeType); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Total?.Any() == true) yield return new KeyValuePair("total",Total); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",CommunicationRequest); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",_PreAuthPeriod); + if (_PayeeType is not null) yield return new KeyValuePair("payeeType",_PayeeType); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Total?.Any() == true) yield return new KeyValuePair("total",_Total); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",_CommunicationRequest); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs index bf4d65bdd..6cff37b67 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,13 +113,13 @@ public partial class InvestigationComponent : Hl7.Fhir.Model.BackboneElement [Binding("InvestigationGroupType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Record of a specific investigation. @@ -128,24 +131,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InvestigationComponent; - - if (dest == null) - { + if(other is not InvestigationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -157,41 +156,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InvestigationComponent; - if(otherT == null) return false; + if(other is not InvestigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -202,8 +201,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -230,13 +229,13 @@ public partial class FindingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("itemCodeableConcept", Order=40)] [Binding("ConditionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ItemCodeableConcept + public Hl7.Fhir.Model.CodeableConcept? ItemCodeableConcept { get { return _ItemCodeableConcept; } set { _ItemCodeableConcept = value; OnPropertyChanged("ItemCodeableConcept"); } } - private Hl7.Fhir.Model.CodeableConcept _ItemCodeableConcept; + private Hl7.Fhir.Model.CodeableConcept? _ItemCodeableConcept; /// /// What was found. @@ -245,58 +244,51 @@ public Hl7.Fhir.Model.CodeableConcept ItemCodeableConcept [CLSCompliant(false)] [References("Condition","Observation","Media")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ItemReference + public Hl7.Fhir.Model.ResourceReference? ItemReference { get { return _ItemReference; } set { _ItemReference = value; OnPropertyChanged("ItemReference"); } } - private Hl7.Fhir.Model.ResourceReference _ItemReference; + private Hl7.Fhir.Model.ResourceReference? _ItemReference; /// /// Which investigations support finding. /// [FhirElement("basis", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString BasisElement + public Hl7.Fhir.Model.FhirString? BasisElement { get { return _BasisElement; } set { _BasisElement = value; OnPropertyChanged("BasisElement"); } } - private Hl7.Fhir.Model.FhirString _BasisElement; + private Hl7.Fhir.Model.FhirString? _BasisElement; /// /// Which investigations support finding /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Basis + public string? Basis { - get { return BasisElement != null ? BasisElement.Value : null; } + get => _BasisElement?.Value; set { - if (value == null) - BasisElement = null; - else - BasisElement = new Hl7.Fhir.Model.FhirString(value); + BasisElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Basis"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FindingComponent; - - if (dest == null) - { + if(other is not FindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemCodeableConcept != null) dest.ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)ItemCodeableConcept.DeepCopyInternal(); - if(ItemReference != null) dest.ItemReference = (Hl7.Fhir.Model.ResourceReference)ItemReference.DeepCopyInternal(); - if(BasisElement != null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)BasisElement.DeepCopyInternal(); + if(_ItemCodeableConcept is not null) dest.ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)_ItemCodeableConcept.DeepCopyInternal(); + if(_ItemReference is not null) dest.ItemReference = (Hl7.Fhir.Model.ResourceReference)_ItemReference.DeepCopyInternal(); + if(_BasisElement is not null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)_BasisElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -308,48 +300,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FindingComponent; - if(otherT == null) return false; + if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemCodeableConcept, otherT.ItemCodeableConcept)) return false; - if(!comparer.Equals(ItemReference, otherT.ItemReference)) return false; - if(!comparer.Equals(BasisElement, otherT.BasisElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemCodeableConcept, otherT._ItemCodeableConcept)) return false; + if(!comparer.Equals(_ItemReference, otherT._ItemReference)) return false; + if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemCodeableConcept": - value = ItemCodeableConcept; - return ItemCodeableConcept is not null; + value = _ItemCodeableConcept; + return _ItemCodeableConcept is not null; case "itemReference": - value = ItemReference; - return ItemReference is not null; + value = _ItemReference; + return _ItemReference is not null; case "basis": - value = BasisElement; - return BasisElement is not null; + value = _BasisElement; + return _BasisElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemCodeableConcept": - ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)value; + ItemCodeableConcept = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "itemReference": - ItemReference = (Hl7.Fhir.Model.ResourceReference)value; + ItemReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "basis": - BasisElement = (Hl7.Fhir.Model.FhirString)value; + BasisElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -360,9 +352,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemCodeableConcept is not null) yield return new KeyValuePair("itemCodeableConcept",ItemCodeableConcept); - if (ItemReference is not null) yield return new KeyValuePair("itemReference",ItemReference); - if (BasisElement is not null) yield return new KeyValuePair("basis",BasisElement); + if (_ItemCodeableConcept is not null) yield return new KeyValuePair("itemCodeableConcept",_ItemCodeableConcept); + if (_ItemReference is not null) yield return new KeyValuePair("itemReference",_ItemReference); + if (_BasisElement is not null) yield return new KeyValuePair("basis",_BasisElement); } } @@ -375,11 +367,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// in-progress | completed | entered-in-error. @@ -389,13 +381,13 @@ public List Identifier [Binding("ClinicalImpressionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | entered-in-error @@ -404,13 +396,10 @@ public Code StatusEl [IgnoreDataMember] public Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -421,13 +410,13 @@ public Hl7.Fhir.Model.ClinicalImpression.ClinicalImpressionStatus? Status [FhirElement("statusReason", Order=110)] [Binding("ClinicalImpressionStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Kind of assessment performed. @@ -435,41 +424,38 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [FhirElement("code", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("ClinicalImpressionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Why/how the assessment was performed. /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why/how the assessment was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -482,13 +468,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -497,13 +483,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time of assessment. @@ -512,41 +498,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the assessment was documented. /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the assessment was documented /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -558,13 +541,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Assessor + public Hl7.Fhir.Model.ResourceReference? Assessor { get { return _Assessor; } set { _Assessor = value; OnPropertyChanged("Assessor"); } } - private Hl7.Fhir.Model.ResourceReference _Assessor; + private Hl7.Fhir.Model.ResourceReference? _Assessor; /// /// Reference to last assessment. @@ -573,13 +556,13 @@ public Hl7.Fhir.Model.ResourceReference Assessor [CLSCompliant(false)] [References("ClinicalImpression")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Previous + public Hl7.Fhir.Model.ResourceReference? Previous { get { return _Previous; } set { _Previous = value; OnPropertyChanged("Previous"); } } - private Hl7.Fhir.Model.ResourceReference _Previous; + private Hl7.Fhir.Model.ResourceReference? _Previous; /// /// Relevant impressions of patient state. @@ -591,11 +574,11 @@ public Hl7.Fhir.Model.ResourceReference Previous [DataMember] public List Problem { - get { if(_Problem==null) _Problem = new List(); return _Problem; } + get => _Problem ?? new List(); set { _Problem = value; OnPropertyChanged("Problem"); } } - private List _Problem; + private List? _Problem; /// /// One or more sets of investigations (signs, symptoms, etc.). @@ -605,11 +588,11 @@ public List Problem [DataMember] public List Investigation { - get { if(_Investigation==null) _Investigation = new List(); return _Investigation; } + get => _Investigation ?? new List(); set { _Investigation = value; OnPropertyChanged("Investigation"); } } - private List _Investigation; + private List? _Investigation; /// /// Clinical Protocol followed. @@ -619,24 +602,24 @@ public List Investigat [DataMember] public List ProtocolElement { - get { if(_ProtocolElement==null) _ProtocolElement = new List(); return _ProtocolElement; } + get => _ProtocolElement ?? new List(); set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } - private List _ProtocolElement; + private List? _ProtocolElement; /// /// Clinical Protocol followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Protocol + public IEnumerable? Protocol { - get { return ProtocolElement != null ? ProtocolElement.Select(elem => elem.Value) : null; } + get => _ProtocolElement?.Select(elem => elem.Value); set { if (value == null) - ProtocolElement = null; + ProtocolElement = null!; else ProtocolElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Protocol"); @@ -648,28 +631,25 @@ public IEnumerable Protocol /// [FhirElement("summary", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString SummaryElement + public Hl7.Fhir.Model.FhirString? SummaryElement { get { return _SummaryElement; } set { _SummaryElement = value; OnPropertyChanged("SummaryElement"); } } - private Hl7.Fhir.Model.FhirString _SummaryElement; + private Hl7.Fhir.Model.FhirString? _SummaryElement; /// /// Summary of the assessment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Summary + public string? Summary { - get { return SummaryElement != null ? SummaryElement.Value : null; } + get => _SummaryElement?.Value; set { - if (value == null) - SummaryElement = null; - else - SummaryElement = new Hl7.Fhir.Model.FhirString(value); + SummaryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Summary"); } } @@ -682,11 +662,11 @@ public string Summary [DataMember] public List Finding { - get { if(_Finding==null) _Finding = new List(); return _Finding; } + get => _Finding ?? new List(); set { _Finding = value; OnPropertyChanged("Finding"); } } - private List _Finding; + private List? _Finding; /// /// Estimate of likely outcome. @@ -697,11 +677,11 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get { if(_PrognosisCodeableConcept==null) _PrognosisCodeableConcept = new List(); return _PrognosisCodeableConcept; } + get => _PrognosisCodeableConcept ?? new List(); set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } - private List _PrognosisCodeableConcept; + private List? _PrognosisCodeableConcept; /// /// RiskAssessment expressing likely outcome. @@ -713,11 +693,11 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get { if(_PrognosisReference==null) _PrognosisReference = new List(); return _PrognosisReference; } + get => _PrognosisReference ?? new List(); set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } - private List _PrognosisReference; + private List? _PrognosisReference; /// /// Information supporting the clinical impression. @@ -729,11 +709,11 @@ public List PrognosisReference [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Comments made about the ClinicalImpression. @@ -743,44 +723,40 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClinicalImpression; - - if (dest == null) - { + if(other is not ClinicalImpression dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Assessor != null) dest.Assessor = (Hl7.Fhir.Model.ResourceReference)Assessor.DeepCopyInternal(); - if(Previous != null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)Previous.DeepCopyInternal(); - if(Problem.Any()) dest.Problem = new List(Problem.DeepCopyInternal()); - if(Investigation.Any()) dest.Investigation = new List(Investigation.DeepCopyInternal()); - if(ProtocolElement.Any()) dest.ProtocolElement = new List(ProtocolElement.DeepCopyInternal()); - if(SummaryElement != null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)SummaryElement.DeepCopyInternal(); - if(Finding.Any()) dest.Finding = new List(Finding.DeepCopyInternal()); - if(PrognosisCodeableConcept.Any()) dest.PrognosisCodeableConcept = new List(PrognosisCodeableConcept.DeepCopyInternal()); - if(PrognosisReference.Any()) dest.PrognosisReference = new List(PrognosisReference.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Assessor is not null) dest.Assessor = (Hl7.Fhir.Model.ResourceReference)_Assessor.DeepCopyInternal(); + if(_Previous is not null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)_Previous.DeepCopyInternal(); + if(_Problem is not null) dest.Problem = new List(_Problem.DeepCopyInternal()); + if(_Investigation is not null) dest.Investigation = new List(_Investigation.DeepCopyInternal()); + if(_ProtocolElement is not null) dest.ProtocolElement = new List(_ProtocolElement.DeepCopyInternal()); + if(_SummaryElement is not null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)_SummaryElement.DeepCopyInternal(); + if(_Finding is not null) dest.Finding = new List(_Finding.DeepCopyInternal()); + if(_PrognosisCodeableConcept is not null) dest.PrognosisCodeableConcept = new List(_PrognosisCodeableConcept.DeepCopyInternal()); + if(_PrognosisReference is not null) dest.PrognosisReference = new List(_PrognosisReference.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -792,167 +768,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClinicalImpression; - if(otherT == null) return false; + if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Assessor, otherT.Assessor)) return false; - if(!comparer.Equals(Previous, otherT.Previous)) return false; - if(!comparer.ListEquals(Problem, otherT.Problem)) return false; - if(!comparer.ListEquals(Investigation, otherT.Investigation)) return false; - if(!comparer.ListEquals(ProtocolElement, otherT.ProtocolElement)) return false; - if(!comparer.Equals(SummaryElement, otherT.SummaryElement)) return false; - if(!comparer.ListEquals(Finding, otherT.Finding)) return false; - if(!comparer.ListEquals(PrognosisCodeableConcept, otherT.PrognosisCodeableConcept)) return false; - if(!comparer.ListEquals(PrognosisReference, otherT.PrognosisReference)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Assessor, otherT._Assessor)) return false; + if(!comparer.Equals(_Previous, otherT._Previous)) return false; + if(!comparer.ListEquals(_Problem, otherT._Problem)) return false; + if(!comparer.ListEquals(_Investigation, otherT._Investigation)) return false; + if(!comparer.ListEquals(_ProtocolElement, otherT._ProtocolElement)) return false; + if(!comparer.Equals(_SummaryElement, otherT._SummaryElement)) return false; + if(!comparer.ListEquals(_Finding, otherT._Finding)) return false; + if(!comparer.ListEquals(_PrognosisCodeableConcept, otherT._PrognosisCodeableConcept)) return false; + if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "assessor": - value = Assessor; - return Assessor is not null; + value = _Assessor; + return _Assessor is not null; case "previous": - value = Previous; - return Previous is not null; + value = _Previous; + return _Previous is not null; case "problem": - value = Problem; - return Problem?.Any() == true; + value = _Problem; + return _Problem?.Any() == true; case "investigation": - value = Investigation; - return Investigation?.Any() == true; + value = _Investigation; + return _Investigation?.Any() == true; case "protocol": - value = ProtocolElement; - return ProtocolElement?.Any() == true; + value = _ProtocolElement; + return _ProtocolElement?.Any() == true; case "summary": - value = SummaryElement; - return SummaryElement is not null; + value = _SummaryElement; + return _SummaryElement is not null; case "finding": - value = Finding; - return Finding?.Any() == true; + value = _Finding; + return _Finding?.Any() == true; case "prognosisCodeableConcept": - value = PrognosisCodeableConcept; - return PrognosisCodeableConcept?.Any() == true; + value = _PrognosisCodeableConcept; + return _PrognosisCodeableConcept?.Any() == true; case "prognosisReference": - value = PrognosisReference; - return PrognosisReference?.Any() == true; + value = _PrognosisReference; + return _PrognosisReference?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "assessor": - Assessor = (Hl7.Fhir.Model.ResourceReference)value; + Assessor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "previous": - Previous = (Hl7.Fhir.Model.ResourceReference)value; + Previous = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "problem": - Problem = (List)value; + Problem = (List?)value!; return this; case "investigation": - Investigation = (List)value; + Investigation = (List?)value!; return this; case "protocol": - ProtocolElement = (List)value; + ProtocolElement = (List?)value!; return this; case "summary": - SummaryElement = (Hl7.Fhir.Model.FhirString)value; + SummaryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "finding": - Finding = (List)value; + Finding = (List?)value!; return this; case "prognosisCodeableConcept": - PrognosisCodeableConcept = (List)value; + PrognosisCodeableConcept = (List?)value!; return this; case "prognosisReference": - PrognosisReference = (List)value; + PrognosisReference = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -963,26 +939,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Assessor is not null) yield return new KeyValuePair("assessor",Assessor); - if (Previous is not null) yield return new KeyValuePair("previous",Previous); - if (Problem?.Any() == true) yield return new KeyValuePair("problem",Problem); - if (Investigation?.Any() == true) yield return new KeyValuePair("investigation",Investigation); - if (ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",ProtocolElement); - if (SummaryElement is not null) yield return new KeyValuePair("summary",SummaryElement); - if (Finding?.Any() == true) yield return new KeyValuePair("finding",Finding); - if (PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",PrognosisCodeableConcept); - if (PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",PrognosisReference); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Assessor is not null) yield return new KeyValuePair("assessor",_Assessor); + if (_Previous is not null) yield return new KeyValuePair("previous",_Previous); + if (_Problem?.Any() == true) yield return new KeyValuePair("problem",_Problem); + if (_Investigation?.Any() == true) yield return new KeyValuePair("investigation",_Investigation); + if (_ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",_ProtocolElement); + if (_SummaryElement is not null) yield return new KeyValuePair("summary",_SummaryElement); + if (_Finding?.Any() == true) yield return new KeyValuePair("finding",_Finding); + if (_PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",_PrognosisCodeableConcept); + if (_PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",_PrognosisReference); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs index 9d7d5aba2..e80998634 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,13 +118,13 @@ public partial class ContraindicationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("diseaseSymptomProcedure", InSummary=true, Order=40)] [Binding("DiseaseSymptomProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure + public Hl7.Fhir.Model.CodeableReference? DiseaseSymptomProcedure { get { return _DiseaseSymptomProcedure; } set { _DiseaseSymptomProcedure = value; OnPropertyChanged("DiseaseSymptomProcedure"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseSymptomProcedure; + private Hl7.Fhir.Model.CodeableReference? _DiseaseSymptomProcedure; /// /// The status of the disease or symptom for the contraindication. @@ -129,13 +132,13 @@ public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure [FhirElement("diseaseStatus", InSummary=true, Order=50)] [Binding("DiseaseStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseStatus + public Hl7.Fhir.Model.CodeableReference? DiseaseStatus { get { return _DiseaseStatus; } set { _DiseaseStatus = value; OnPropertyChanged("DiseaseStatus"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseStatus; + private Hl7.Fhir.Model.CodeableReference? _DiseaseStatus; /// /// A comorbidity (concurrent condition) or coinfection. @@ -146,11 +149,11 @@ public Hl7.Fhir.Model.CodeableReference DiseaseStatus [DataMember] public List Comorbidity { - get { if(_Comorbidity==null) _Comorbidity = new List(); return _Comorbidity; } + get => _Comorbidity ?? new List(); set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } - private List _Comorbidity; + private List? _Comorbidity; /// /// The indication which this is a contraidication for. @@ -162,11 +165,11 @@ public List Comorbidity [DataMember] public List Indication { - get { if(_Indication==null) _Indication = new List(); return _Indication; } + get => _Indication ?? new List(); set { _Indication = value; OnPropertyChanged("Indication"); } } - private List _Indication; + private List? _Indication; /// /// Information about use of the product in relation to other therapies described as part of the contraindication. @@ -176,27 +179,23 @@ public List Indication [DataMember] public List OtherTherapy { - get { if(_OtherTherapy==null) _OtherTherapy = new List(); return _OtherTherapy; } + get => _OtherTherapy ?? new List(); set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } - private List _OtherTherapy; + private List? _OtherTherapy; protected internal override void CopyToInternal(Base other) { - var dest = other as ContraindicationComponent; - - if (dest == null) - { + if(other is not ContraindicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DiseaseSymptomProcedure != null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)DiseaseSymptomProcedure.DeepCopyInternal(); - if(DiseaseStatus != null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)DiseaseStatus.DeepCopyInternal(); - if(Comorbidity.Any()) dest.Comorbidity = new List(Comorbidity.DeepCopyInternal()); - if(Indication.Any()) dest.Indication = new List(Indication.DeepCopyInternal()); - if(OtherTherapy.Any()) dest.OtherTherapy = new List(OtherTherapy.DeepCopyInternal()); + if(_DiseaseSymptomProcedure is not null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)_DiseaseSymptomProcedure.DeepCopyInternal(); + if(_DiseaseStatus is not null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)_DiseaseStatus.DeepCopyInternal(); + if(_Comorbidity is not null) dest.Comorbidity = new List(_Comorbidity.DeepCopyInternal()); + if(_Indication is not null) dest.Indication = new List(_Indication.DeepCopyInternal()); + if(_OtherTherapy is not null) dest.OtherTherapy = new List(_OtherTherapy.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -208,62 +207,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContraindicationComponent; - if(otherT == null) return false; + if(other is not ContraindicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DiseaseSymptomProcedure, otherT.DiseaseSymptomProcedure)) return false; - if(!comparer.Equals(DiseaseStatus, otherT.DiseaseStatus)) return false; - if(!comparer.ListEquals(Comorbidity, otherT.Comorbidity)) return false; - if(!comparer.ListEquals(Indication, otherT.Indication)) return false; - if(!comparer.ListEquals(OtherTherapy, otherT.OtherTherapy)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; + if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; + if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "diseaseSymptomProcedure": - value = DiseaseSymptomProcedure; - return DiseaseSymptomProcedure is not null; + value = _DiseaseSymptomProcedure; + return _DiseaseSymptomProcedure is not null; case "diseaseStatus": - value = DiseaseStatus; - return DiseaseStatus is not null; + value = _DiseaseStatus; + return _DiseaseStatus is not null; case "comorbidity": - value = Comorbidity; - return Comorbidity?.Any() == true; + value = _Comorbidity; + return _Comorbidity?.Any() == true; case "indication": - value = Indication; - return Indication?.Any() == true; + value = _Indication; + return _Indication?.Any() == true; case "otherTherapy": - value = OtherTherapy; - return OtherTherapy?.Any() == true; + value = _OtherTherapy; + return _OtherTherapy?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "diseaseSymptomProcedure": - DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "diseaseStatus": - DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseStatus = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "comorbidity": - Comorbidity = (List)value; + Comorbidity = (List?)value!; return this; case "indication": - Indication = (List)value; + Indication = (List?)value!; return this; case "otherTherapy": - OtherTherapy = (List)value; + OtherTherapy = (List?)value!; return this; default: return base.SetValue(key, value); @@ -274,11 +273,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",DiseaseSymptomProcedure); - if (DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",DiseaseStatus); - if (Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",Comorbidity); - if (Indication?.Any() == true) yield return new KeyValuePair("indication",Indication); - if (OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",OtherTherapy); + if (_DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",_DiseaseSymptomProcedure); + if (_DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",_DiseaseStatus); + if (_Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",_Comorbidity); + if (_Indication?.Any() == true) yield return new KeyValuePair("indication",_Indication); + if (_OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",_OtherTherapy); } } @@ -306,13 +305,13 @@ public partial class OtherTherapyComponent : Hl7.Fhir.Model.BackboneElement [Binding("TherapyRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RelationshipType + public Hl7.Fhir.Model.CodeableConcept? RelationshipType { get { return _RelationshipType; } set { _RelationshipType = value; OnPropertyChanged("RelationshipType"); } } - private Hl7.Fhir.Model.CodeableConcept _RelationshipType; + private Hl7.Fhir.Model.CodeableConcept? _RelationshipType; /// /// Reference to a specific medication as part of an indication or contraindication. @@ -321,26 +320,22 @@ public Hl7.Fhir.Model.CodeableConcept RelationshipType [Binding("Therapy")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Therapy + public Hl7.Fhir.Model.CodeableReference? Therapy { get { return _Therapy; } set { _Therapy = value; OnPropertyChanged("Therapy"); } } - private Hl7.Fhir.Model.CodeableReference _Therapy; + private Hl7.Fhir.Model.CodeableReference? _Therapy; protected internal override void CopyToInternal(Base other) { - var dest = other as OtherTherapyComponent; - - if (dest == null) - { + if(other is not OtherTherapyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RelationshipType != null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)RelationshipType.DeepCopyInternal(); - if(Therapy != null) dest.Therapy = (Hl7.Fhir.Model.CodeableReference)Therapy.DeepCopyInternal(); + if(_RelationshipType is not null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)_RelationshipType.DeepCopyInternal(); + if(_Therapy is not null) dest.Therapy = (Hl7.Fhir.Model.CodeableReference)_Therapy.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -352,41 +347,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherTherapyComponent; - if(otherT == null) return false; + if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RelationshipType, otherT.RelationshipType)) return false; - if(!comparer.Equals(Therapy, otherT.Therapy)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + if(!comparer.Equals(_Therapy, otherT._Therapy)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationshipType": - value = RelationshipType; - return RelationshipType is not null; + value = _RelationshipType; + return _RelationshipType is not null; case "therapy": - value = Therapy; - return Therapy is not null; + value = _Therapy; + return _Therapy is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationshipType": - RelationshipType = (Hl7.Fhir.Model.CodeableConcept)value; + RelationshipType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "therapy": - Therapy = (Hl7.Fhir.Model.CodeableReference)value; + Therapy = (Hl7.Fhir.Model.CodeableReference?)value; return this; default: return base.SetValue(key, value); @@ -397,8 +392,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RelationshipType is not null) yield return new KeyValuePair("relationshipType",RelationshipType); - if (Therapy is not null) yield return new KeyValuePair("therapy",Therapy); + if (_RelationshipType is not null) yield return new KeyValuePair("relationshipType",_RelationshipType); + if (_Therapy is not null) yield return new KeyValuePair("therapy",_Therapy); } } @@ -422,13 +417,13 @@ public partial class IndicationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("diseaseSymptomProcedure", InSummary=true, Order=40)] [Binding("DiseaseSymptomProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure + public Hl7.Fhir.Model.CodeableReference? DiseaseSymptomProcedure { get { return _DiseaseSymptomProcedure; } set { _DiseaseSymptomProcedure = value; OnPropertyChanged("DiseaseSymptomProcedure"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseSymptomProcedure; + private Hl7.Fhir.Model.CodeableReference? _DiseaseSymptomProcedure; /// /// The status of the disease or symptom for the indication. @@ -436,13 +431,13 @@ public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure [FhirElement("diseaseStatus", InSummary=true, Order=50)] [Binding("DiseaseStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseStatus + public Hl7.Fhir.Model.CodeableReference? DiseaseStatus { get { return _DiseaseStatus; } set { _DiseaseStatus = value; OnPropertyChanged("DiseaseStatus"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseStatus; + private Hl7.Fhir.Model.CodeableReference? _DiseaseStatus; /// /// A comorbidity or coinfection as part of the indication. @@ -453,11 +448,11 @@ public Hl7.Fhir.Model.CodeableReference DiseaseStatus [DataMember] public List Comorbidity { - get { if(_Comorbidity==null) _Comorbidity = new List(); return _Comorbidity; } + get => _Comorbidity ?? new List(); set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } - private List _Comorbidity; + private List? _Comorbidity; /// /// The intended effect, aim or strategy to be achieved. @@ -465,13 +460,13 @@ public List Comorbidity [FhirElement("intendedEffect", InSummary=true, Order=70)] [Binding("ProductIntendedUse")] [DataMember] - public Hl7.Fhir.Model.CodeableReference IntendedEffect + public Hl7.Fhir.Model.CodeableReference? IntendedEffect { get { return _IntendedEffect; } set { _IntendedEffect = value; OnPropertyChanged("IntendedEffect"); } } - private Hl7.Fhir.Model.CodeableReference _IntendedEffect; + private Hl7.Fhir.Model.CodeableReference? _IntendedEffect; /// /// Timing or duration information. @@ -480,13 +475,13 @@ public Hl7.Fhir.Model.CodeableReference IntendedEffect [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Duration + public Hl7.Fhir.Model.DataType? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.DataType _Duration; + private Hl7.Fhir.Model.DataType? _Duration; /// /// An unwanted side effect or negative outcome of the subject of this resource when being used for this indication. @@ -498,11 +493,11 @@ public Hl7.Fhir.Model.DataType Duration [DataMember] public List UndesirableEffect { - get { if(_UndesirableEffect==null) _UndesirableEffect = new List(); return _UndesirableEffect; } + get => _UndesirableEffect ?? new List(); set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } - private List _UndesirableEffect; + private List? _UndesirableEffect; /// /// The use of the medicinal product in relation to other therapies described as part of the indication. @@ -512,29 +507,25 @@ public List UndesirableEffect [DataMember] public List OtherTherapy { - get { if(_OtherTherapy==null) _OtherTherapy = new List(); return _OtherTherapy; } + get => _OtherTherapy ?? new List(); set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } - private List _OtherTherapy; + private List? _OtherTherapy; protected internal override void CopyToInternal(Base other) { - var dest = other as IndicationComponent; - - if (dest == null) - { + if(other is not IndicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DiseaseSymptomProcedure != null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)DiseaseSymptomProcedure.DeepCopyInternal(); - if(DiseaseStatus != null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)DiseaseStatus.DeepCopyInternal(); - if(Comorbidity.Any()) dest.Comorbidity = new List(Comorbidity.DeepCopyInternal()); - if(IntendedEffect != null) dest.IntendedEffect = (Hl7.Fhir.Model.CodeableReference)IntendedEffect.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.DataType)Duration.DeepCopyInternal(); - if(UndesirableEffect.Any()) dest.UndesirableEffect = new List(UndesirableEffect.DeepCopyInternal()); - if(OtherTherapy.Any()) dest.OtherTherapy = new List(OtherTherapy.DeepCopyInternal()); + if(_DiseaseSymptomProcedure is not null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)_DiseaseSymptomProcedure.DeepCopyInternal(); + if(_DiseaseStatus is not null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)_DiseaseStatus.DeepCopyInternal(); + if(_Comorbidity is not null) dest.Comorbidity = new List(_Comorbidity.DeepCopyInternal()); + if(_IntendedEffect is not null) dest.IntendedEffect = (Hl7.Fhir.Model.CodeableReference)_IntendedEffect.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.DataType)_Duration.DeepCopyInternal(); + if(_UndesirableEffect is not null) dest.UndesirableEffect = new List(_UndesirableEffect.DeepCopyInternal()); + if(_OtherTherapy is not null) dest.OtherTherapy = new List(_OtherTherapy.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -546,76 +537,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IndicationComponent; - if(otherT == null) return false; + if(other is not IndicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DiseaseSymptomProcedure, otherT.DiseaseSymptomProcedure)) return false; - if(!comparer.Equals(DiseaseStatus, otherT.DiseaseStatus)) return false; - if(!comparer.ListEquals(Comorbidity, otherT.Comorbidity)) return false; - if(!comparer.Equals(IntendedEffect, otherT.IntendedEffect)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.ListEquals(UndesirableEffect, otherT.UndesirableEffect)) return false; - if(!comparer.ListEquals(OtherTherapy, otherT.OtherTherapy)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; + if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; + if(!comparer.Equals(_IntendedEffect, otherT._IntendedEffect)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.ListEquals(_UndesirableEffect, otherT._UndesirableEffect)) return false; + if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "diseaseSymptomProcedure": - value = DiseaseSymptomProcedure; - return DiseaseSymptomProcedure is not null; + value = _DiseaseSymptomProcedure; + return _DiseaseSymptomProcedure is not null; case "diseaseStatus": - value = DiseaseStatus; - return DiseaseStatus is not null; + value = _DiseaseStatus; + return _DiseaseStatus is not null; case "comorbidity": - value = Comorbidity; - return Comorbidity?.Any() == true; + value = _Comorbidity; + return _Comorbidity?.Any() == true; case "intendedEffect": - value = IntendedEffect; - return IntendedEffect is not null; + value = _IntendedEffect; + return _IntendedEffect is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "undesirableEffect": - value = UndesirableEffect; - return UndesirableEffect?.Any() == true; + value = _UndesirableEffect; + return _UndesirableEffect?.Any() == true; case "otherTherapy": - value = OtherTherapy; - return OtherTherapy?.Any() == true; + value = _OtherTherapy; + return _OtherTherapy?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "diseaseSymptomProcedure": - DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "diseaseStatus": - DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseStatus = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "comorbidity": - Comorbidity = (List)value; + Comorbidity = (List?)value!; return this; case "intendedEffect": - IntendedEffect = (Hl7.Fhir.Model.CodeableReference)value; + IntendedEffect = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.DataType)value; + Duration = (Hl7.Fhir.Model.DataType?)value; return this; case "undesirableEffect": - UndesirableEffect = (List)value; + UndesirableEffect = (List?)value!; return this; case "otherTherapy": - OtherTherapy = (List)value; + OtherTherapy = (List?)value!; return this; default: return base.SetValue(key, value); @@ -626,13 +617,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",DiseaseSymptomProcedure); - if (DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",DiseaseStatus); - if (Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",Comorbidity); - if (IntendedEffect is not null) yield return new KeyValuePair("intendedEffect",IntendedEffect); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (UndesirableEffect?.Any() == true) yield return new KeyValuePair("undesirableEffect",UndesirableEffect); - if (OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",OtherTherapy); + if (_DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",_DiseaseSymptomProcedure); + if (_DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",_DiseaseStatus); + if (_Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",_Comorbidity); + if (_IntendedEffect is not null) yield return new KeyValuePair("intendedEffect",_IntendedEffect); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_UndesirableEffect?.Any() == true) yield return new KeyValuePair("undesirableEffect",_UndesirableEffect); + if (_OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",_OtherTherapy); } } @@ -658,11 +649,11 @@ public partial class InteractionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Interactant { - get { if(_Interactant==null) _Interactant = new List(); return _Interactant; } + get => _Interactant ?? new List(); set { _Interactant = value; OnPropertyChanged("Interactant"); } } - private List _Interactant; + private List? _Interactant; /// /// The type of the interaction e.g. drug-drug interaction, drug-lab test interaction. @@ -670,13 +661,13 @@ public List Interacta [FhirElement("type", InSummary=true, Order=50)] [Binding("InteractionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The effect of the interaction, for example "reduced gastric absorption of primary medication". @@ -684,13 +675,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("effect", InSummary=true, Order=60)] [Binding("InteractionEffect")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Effect + public Hl7.Fhir.Model.CodeableReference? Effect { get { return _Effect; } set { _Effect = value; OnPropertyChanged("Effect"); } } - private Hl7.Fhir.Model.CodeableReference _Effect; + private Hl7.Fhir.Model.CodeableReference? _Effect; /// /// The incidence of the interaction, e.g. theoretical, observed. @@ -698,13 +689,13 @@ public Hl7.Fhir.Model.CodeableReference Effect [FhirElement("incidence", InSummary=true, Order=70)] [Binding("UndesirableEffectSymptom")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Incidence + public Hl7.Fhir.Model.CodeableConcept? Incidence { get { return _Incidence; } set { _Incidence = value; OnPropertyChanged("Incidence"); } } - private Hl7.Fhir.Model.CodeableConcept _Incidence; + private Hl7.Fhir.Model.CodeableConcept? _Incidence; /// /// Actions for managing the interaction. @@ -715,27 +706,23 @@ public Hl7.Fhir.Model.CodeableConcept Incidence [DataMember] public List Management { - get { if(_Management==null) _Management = new List(); return _Management; } + get => _Management ?? new List(); set { _Management = value; OnPropertyChanged("Management"); } } - private List _Management; + private List? _Management; protected internal override void CopyToInternal(Base other) { - var dest = other as InteractionComponent; - - if (dest == null) - { + if(other is not InteractionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Interactant.Any()) dest.Interactant = new List(Interactant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Effect != null) dest.Effect = (Hl7.Fhir.Model.CodeableReference)Effect.DeepCopyInternal(); - if(Incidence != null) dest.Incidence = (Hl7.Fhir.Model.CodeableConcept)Incidence.DeepCopyInternal(); - if(Management.Any()) dest.Management = new List(Management.DeepCopyInternal()); + if(_Interactant is not null) dest.Interactant = new List(_Interactant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Effect is not null) dest.Effect = (Hl7.Fhir.Model.CodeableReference)_Effect.DeepCopyInternal(); + if(_Incidence is not null) dest.Incidence = (Hl7.Fhir.Model.CodeableConcept)_Incidence.DeepCopyInternal(); + if(_Management is not null) dest.Management = new List(_Management.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -747,62 +734,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InteractionComponent; - if(otherT == null) return false; + if(other is not InteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Interactant, otherT.Interactant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Effect, otherT.Effect)) return false; - if(!comparer.Equals(Incidence, otherT.Incidence)) return false; - if(!comparer.ListEquals(Management, otherT.Management)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Effect, otherT._Effect)) return false; + if(!comparer.Equals(_Incidence, otherT._Incidence)) return false; + if(!comparer.ListEquals(_Management, otherT._Management)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "interactant": - value = Interactant; - return Interactant?.Any() == true; + value = _Interactant; + return _Interactant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "effect": - value = Effect; - return Effect is not null; + value = _Effect; + return _Effect is not null; case "incidence": - value = Incidence; - return Incidence is not null; + value = _Incidence; + return _Incidence is not null; case "management": - value = Management; - return Management?.Any() == true; + value = _Management; + return _Management?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "interactant": - Interactant = (List)value; + Interactant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "effect": - Effect = (Hl7.Fhir.Model.CodeableReference)value; + Effect = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "incidence": - Incidence = (Hl7.Fhir.Model.CodeableConcept)value; + Incidence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "management": - Management = (List)value; + Management = (List?)value!; return this; default: return base.SetValue(key, value); @@ -813,11 +800,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Interactant?.Any() == true) yield return new KeyValuePair("interactant",Interactant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Effect is not null) yield return new KeyValuePair("effect",Effect); - if (Incidence is not null) yield return new KeyValuePair("incidence",Incidence); - if (Management?.Any() == true) yield return new KeyValuePair("management",Management); + if (_Interactant?.Any() == true) yield return new KeyValuePair("interactant",_Interactant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Effect is not null) yield return new KeyValuePair("effect",_Effect); + if (_Incidence is not null) yield return new KeyValuePair("incidence",_Incidence); + if (_Management?.Any() == true) yield return new KeyValuePair("management",_Management); } } @@ -845,25 +832,21 @@ public partial class InteractantComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InteractantComponent; - - if (dest == null) - { + if(other is not InteractantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -875,34 +858,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InteractantComponent; - if(otherT == null) return false; + if(other is not InteractantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -913,7 +896,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -940,13 +923,13 @@ public partial class UndesirableEffectComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("symptomConditionEffect", InSummary=true, Order=40)] [Binding("UndesirableEffectSymptom")] [DataMember] - public Hl7.Fhir.Model.CodeableReference SymptomConditionEffect + public Hl7.Fhir.Model.CodeableReference? SymptomConditionEffect { get { return _SymptomConditionEffect; } set { _SymptomConditionEffect = value; OnPropertyChanged("SymptomConditionEffect"); } } - private Hl7.Fhir.Model.CodeableReference _SymptomConditionEffect; + private Hl7.Fhir.Model.CodeableReference? _SymptomConditionEffect; /// /// High level classification of the effect. @@ -954,13 +937,13 @@ public Hl7.Fhir.Model.CodeableReference SymptomConditionEffect [FhirElement("classification", InSummary=true, Order=50)] [Binding("UndesirableEffectClassification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Classification + public Hl7.Fhir.Model.CodeableConcept? Classification { get { return _Classification; } set { _Classification = value; OnPropertyChanged("Classification"); } } - private Hl7.Fhir.Model.CodeableConcept _Classification; + private Hl7.Fhir.Model.CodeableConcept? _Classification; /// /// How often the effect is seen. @@ -968,27 +951,23 @@ public Hl7.Fhir.Model.CodeableConcept Classification [FhirElement("frequencyOfOccurrence", InSummary=true, Order=60)] [Binding("UndesirablEffectFrequency")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FrequencyOfOccurrence + public Hl7.Fhir.Model.CodeableConcept? FrequencyOfOccurrence { get { return _FrequencyOfOccurrence; } set { _FrequencyOfOccurrence = value; OnPropertyChanged("FrequencyOfOccurrence"); } } - private Hl7.Fhir.Model.CodeableConcept _FrequencyOfOccurrence; + private Hl7.Fhir.Model.CodeableConcept? _FrequencyOfOccurrence; protected internal override void CopyToInternal(Base other) { - var dest = other as UndesirableEffectComponent; - - if (dest == null) - { + if(other is not UndesirableEffectComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SymptomConditionEffect != null) dest.SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference)SymptomConditionEffect.DeepCopyInternal(); - if(Classification != null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)Classification.DeepCopyInternal(); - if(FrequencyOfOccurrence != null) dest.FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)FrequencyOfOccurrence.DeepCopyInternal(); + if(_SymptomConditionEffect is not null) dest.SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference)_SymptomConditionEffect.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)_Classification.DeepCopyInternal(); + if(_FrequencyOfOccurrence is not null) dest.FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)_FrequencyOfOccurrence.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1000,48 +979,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UndesirableEffectComponent; - if(otherT == null) return false; + if(other is not UndesirableEffectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SymptomConditionEffect, otherT.SymptomConditionEffect)) return false; - if(!comparer.Equals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(FrequencyOfOccurrence, otherT.FrequencyOfOccurrence)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; + if(!comparer.Equals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_FrequencyOfOccurrence, otherT._FrequencyOfOccurrence)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "symptomConditionEffect": - value = SymptomConditionEffect; - return SymptomConditionEffect is not null; + value = _SymptomConditionEffect; + return _SymptomConditionEffect is not null; case "classification": - value = Classification; - return Classification is not null; + value = _Classification; + return _Classification is not null; case "frequencyOfOccurrence": - value = FrequencyOfOccurrence; - return FrequencyOfOccurrence is not null; + value = _FrequencyOfOccurrence; + return _FrequencyOfOccurrence is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "symptomConditionEffect": - SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference)value; + SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "classification": - Classification = (Hl7.Fhir.Model.CodeableConcept)value; + Classification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "frequencyOfOccurrence": - FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)value; + FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1052,9 +1031,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SymptomConditionEffect is not null) yield return new KeyValuePair("symptomConditionEffect",SymptomConditionEffect); - if (Classification is not null) yield return new KeyValuePair("classification",Classification); - if (FrequencyOfOccurrence is not null) yield return new KeyValuePair("frequencyOfOccurrence",FrequencyOfOccurrence); + if (_SymptomConditionEffect is not null) yield return new KeyValuePair("symptomConditionEffect",_SymptomConditionEffect); + if (_Classification is not null) yield return new KeyValuePair("classification",_Classification); + if (_FrequencyOfOccurrence is not null) yield return new KeyValuePair("frequencyOfOccurrence",_FrequencyOfOccurrence); } } @@ -1080,28 +1059,25 @@ public partial class WarningComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A textual definition of this warning, with formatting /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1112,26 +1088,22 @@ public string Description [FhirElement("code", InSummary=true, Order=50)] [Binding("WarningType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as WarningComponent; - - if (dest == null) - { + if(other is not WarningComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1143,41 +1115,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as WarningComponent; - if(otherT == null) return false; + if(other is not WarningComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1188,8 +1160,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -1202,11 +1174,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// indication | contraindication | interaction | undesirable-effect | warning. @@ -1216,13 +1188,13 @@ public List Identifier [Binding("ClinicalUseDefinitionType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// indication | contraindication | interaction | undesirable-effect | warning @@ -1231,13 +1203,10 @@ public Code Type [IgnoreDataMember] public Hl7.Fhir.Model.ClinicalUseDefinition.ClinicalUseDefinitionType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1251,11 +1220,11 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.ClinicalUseDefinitionType? Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// The medication or procedure for which this is an indication. @@ -1267,11 +1236,11 @@ public List Category [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Whether this is a current issue or one that has been retired etc. @@ -1279,52 +1248,52 @@ public List Subject [FhirElement("status", InSummary=true, Order=130)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Specifics for when this is a contraindication. /// [FhirElement("contraindication", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent Contraindication + public Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent? Contraindication { get { return _Contraindication; } set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent _Contraindication; + private Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent? _Contraindication; /// /// Specifics for when this is an indication. /// [FhirElement("indication", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent Indication + public Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent? Indication { get { return _Indication; } set { _Indication = value; OnPropertyChanged("Indication"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent _Indication; + private Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent? _Indication; /// /// Specifics for when this is an interaction. /// [FhirElement("interaction", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent Interaction + public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent? Interaction { get { return _Interaction; } set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent _Interaction; + private Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent? _Interaction; /// /// The population group to which this applies. @@ -1336,61 +1305,57 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent Interaction [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// A possible negative outcome from the use of this treatment. /// [FhirElement("undesirableEffect", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent UndesirableEffect + public Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent? UndesirableEffect { get { return _UndesirableEffect; } set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent _UndesirableEffect; + private Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent? _UndesirableEffect; /// /// Critical environmental, health or physical risks or hazards. For example 'Do not operate heavy machinery', 'May cause drowsiness'. /// [FhirElement("warning", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent Warning + public Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent? Warning { get { return _Warning; } set { _Warning = value; OnPropertyChanged("Warning"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent _Warning; + private Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent? _Warning; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClinicalUseDefinition; - - if (dest == null) - { + if(other is not ClinicalUseDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Contraindication != null) dest.Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent)Contraindication.DeepCopyInternal(); - if(Indication != null) dest.Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent)Indication.DeepCopyInternal(); - if(Interaction != null) dest.Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent)Interaction.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(UndesirableEffect != null) dest.UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent)UndesirableEffect.DeepCopyInternal(); - if(Warning != null) dest.Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent)Warning.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Contraindication is not null) dest.Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent)_Contraindication.DeepCopyInternal(); + if(_Indication is not null) dest.Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent)_Indication.DeepCopyInternal(); + if(_Interaction is not null) dest.Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent)_Interaction.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_UndesirableEffect is not null) dest.UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent)_UndesirableEffect.DeepCopyInternal(); + if(_Warning is not null) dest.Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent)_Warning.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1402,104 +1367,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClinicalUseDefinition; - if(otherT == null) return false; + if(other is not ClinicalUseDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Contraindication, otherT.Contraindication)) return false; - if(!comparer.Equals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(Interaction, otherT.Interaction)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(UndesirableEffect, otherT.UndesirableEffect)) return false; - if(!comparer.Equals(Warning, otherT.Warning)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Contraindication, otherT._Contraindication)) return false; + if(!comparer.Equals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_Interaction, otherT._Interaction)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_UndesirableEffect, otherT._UndesirableEffect)) return false; + if(!comparer.Equals(_Warning, otherT._Warning)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "contraindication": - value = Contraindication; - return Contraindication is not null; + value = _Contraindication; + return _Contraindication is not null; case "indication": - value = Indication; - return Indication is not null; + value = _Indication; + return _Indication is not null; case "interaction": - value = Interaction; - return Interaction is not null; + value = _Interaction; + return _Interaction is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "undesirableEffect": - value = UndesirableEffect; - return UndesirableEffect is not null; + value = _UndesirableEffect; + return _UndesirableEffect is not null; case "warning": - value = Warning; - return Warning is not null; + value = _Warning; + return _Warning is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contraindication": - Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent)value; + Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent?)value; return this; case "indication": - Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent)value; + Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent?)value; return this; case "interaction": - Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent)value; + Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "undesirableEffect": - UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent)value; + UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent?)value; return this; case "warning": - Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent)value; + Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent?)value; return this; default: return base.SetValue(key, value); @@ -1510,17 +1475,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Contraindication is not null) yield return new KeyValuePair("contraindication",Contraindication); - if (Indication is not null) yield return new KeyValuePair("indication",Indication); - if (Interaction is not null) yield return new KeyValuePair("interaction",Interaction); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (UndesirableEffect is not null) yield return new KeyValuePair("undesirableEffect",UndesirableEffect); - if (Warning is not null) yield return new KeyValuePair("warning",Warning); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Contraindication is not null) yield return new KeyValuePair("contraindication",_Contraindication); + if (_Indication is not null) yield return new KeyValuePair("indication",_Indication); + if (_Interaction is not null) yield return new KeyValuePair("interaction",_Interaction); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_UndesirableEffect is not null) yield return new KeyValuePair("undesirableEffect",_UndesirableEffect); + if (_Warning is not null) yield return new KeyValuePair("warning",_Warning); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs index de286df31..ed087d621 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -165,11 +164,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -179,24 +178,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -211,24 +210,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -245,11 +244,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of this action. @@ -261,11 +260,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Reply to. @@ -277,11 +276,11 @@ public List PartOf [DataMember] public List InResponseTo { - get { if(_InResponseTo==null) _InResponseTo = new List(); return _InResponseTo; } + get => _InResponseTo ?? new List(); set { _InResponseTo = value; OnPropertyChanged("InResponseTo"); } } - private List _InResponseTo; + private List? _InResponseTo; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -291,13 +290,13 @@ public List InResponseTo [Binding("CommunicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -306,13 +305,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -323,13 +319,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("statusReason", InSummary=true, Order=160)] [Binding("CommunicationNotDoneReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Message category. @@ -340,11 +336,11 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -353,13 +349,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("CommunicationPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -368,13 +364,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -388,11 +381,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -401,13 +394,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Description of the purpose/content. @@ -415,13 +408,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [FhirElement("topic", Order=210, FiveWs="FiveWs.context")] [Binding("CommunicationTopic")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Topic + public Hl7.Fhir.Model.CodeableConcept? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.CodeableConcept _Topic; + private Hl7.Fhir.Model.CodeableConcept? _Topic; /// /// Resources that pertain to this communication. @@ -433,11 +426,11 @@ public Hl7.Fhir.Model.CodeableConcept Topic [DataMember] public List About { - get { if(_About==null) _About = new List(); return _About; } + get => _About ?? new List(); set { _About = value; OnPropertyChanged("About"); } } - private List _About; + private List? _About; /// /// Encounter created as part of. @@ -446,41 +439,38 @@ public List About [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When sent. /// [FhirElement("sent", Order=240, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime SentElement + public Hl7.Fhir.Model.FhirDateTime? SentElement { get { return _SentElement; } set { _SentElement = value; OnPropertyChanged("SentElement"); } } - private Hl7.Fhir.Model.FhirDateTime _SentElement; + private Hl7.Fhir.Model.FhirDateTime? _SentElement; /// /// When sent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sent + public string? Sent { - get { return SentElement != null ? SentElement.Value : null; } + get => _SentElement?.Value; set { - if (value == null) - SentElement = null; - else - SentElement = new Hl7.Fhir.Model.FhirDateTime(value); + SentElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Sent"); } } @@ -490,28 +480,25 @@ public string Sent /// [FhirElement("received", Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedElement { get { return _ReceivedElement; } set { _ReceivedElement = value; OnPropertyChanged("ReceivedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedElement; /// /// When received /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Received + public string? Received { - get { return ReceivedElement != null ? ReceivedElement.Value : null; } + get => _ReceivedElement?.Value; set { - if (value == null) - ReceivedElement = null; - else - ReceivedElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Received"); } } @@ -526,11 +513,11 @@ public string Received [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Message sender. @@ -539,13 +526,13 @@ public List Recipient [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Indication for message. @@ -556,11 +543,11 @@ public Hl7.Fhir.Model.ResourceReference Sender [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was communication done?. @@ -572,11 +559,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Message payload. @@ -586,11 +573,11 @@ public List ReasonReference [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// Comments made about the communication. @@ -600,47 +587,43 @@ public List Payload [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Communication; - - if (dest == null) - { + if(other is not Communication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(InResponseTo.Any()) dest.InResponseTo = new List(InResponseTo.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.CodeableConcept)Topic.DeepCopyInternal(); - if(About.Any()) dest.About = new List(About.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SentElement != null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)SentElement.DeepCopyInternal(); - if(ReceivedElement != null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedElement.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_InResponseTo is not null) dest.InResponseTo = new List(_InResponseTo.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.CodeableConcept)_Topic.DeepCopyInternal(); + if(_About is not null) dest.About = new List(_About.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SentElement is not null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)_SentElement.DeepCopyInternal(); + if(_ReceivedElement is not null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedElement.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -652,188 +635,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Communication; - if(otherT == null) return false; + if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(InResponseTo, otherT.InResponseTo)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(About, otherT.About)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(SentElement, otherT.SentElement)) return false; - if(!comparer.Equals(ReceivedElement, otherT.ReceivedElement)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_InResponseTo, otherT._InResponseTo)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_About, otherT._About)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_SentElement, otherT._SentElement)) return false; + if(!comparer.Equals(_ReceivedElement, otherT._ReceivedElement)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "inResponseTo": - value = InResponseTo; - return InResponseTo?.Any() == true; + value = _InResponseTo; + return _InResponseTo?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "about": - value = About; - return About?.Any() == true; + value = _About; + return _About?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "sent": - value = SentElement; - return SentElement is not null; + value = _SentElement; + return _SentElement is not null; case "received": - value = ReceivedElement; - return ReceivedElement is not null; + value = _ReceivedElement; + return _ReceivedElement is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "inResponseTo": - InResponseTo = (List)value; + InResponseTo = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.CodeableConcept)value; + Topic = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "about": - About = (List)value; + About = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sent": - SentElement = (Hl7.Fhir.Model.FhirDateTime)value; + SentElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "received": - ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -844,29 +827,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (InResponseTo?.Any() == true) yield return new KeyValuePair("inResponseTo",InResponseTo); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (About?.Any() == true) yield return new KeyValuePair("about",About); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SentElement is not null) yield return new KeyValuePair("sent",SentElement); - if (ReceivedElement is not null) yield return new KeyValuePair("received",ReceivedElement); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_InResponseTo?.Any() == true) yield return new KeyValuePair("inResponseTo",_InResponseTo); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_About?.Any() == true) yield return new KeyValuePair("about",_About); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SentElement is not null) yield return new KeyValuePair("sent",_SentElement); + if (_ReceivedElement is not null) yield return new KeyValuePair("received",_ReceivedElement); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs index 9983e5f17..a5cd3c348 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -165,11 +164,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan or proposal. @@ -181,11 +180,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -197,24 +196,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -224,13 +223,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("CommunicationRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -239,13 +238,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -256,13 +252,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [FhirElement("statusReason", Order=140)] [Binding("CommunicationRequestStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Message category. @@ -273,11 +269,11 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -286,13 +282,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("CommunicationPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -301,13 +297,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -317,13 +310,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if request is prohibiting action @@ -332,13 +325,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -352,11 +342,11 @@ public bool? DoNotPerform [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -365,13 +355,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Resources that pertain to this communication request. @@ -383,11 +373,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List About { - get { if(_About==null) _About = new List(); return _About; } + get => _About ?? new List(); set { _About = value; OnPropertyChanged("About"); } } - private List _About; + private List? _About; /// /// Encounter created as part of. @@ -396,13 +386,13 @@ public List About [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Message payload. @@ -412,11 +402,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// When scheduled. @@ -425,41 +415,38 @@ public List Payload [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When request transitioned to being actionable. /// [FhirElement("authoredOn", InSummary=true, Order=240, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request transitioned to being actionable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -471,13 +458,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Message recipient. @@ -489,11 +476,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Message sender. @@ -502,13 +489,13 @@ public List Recipient [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Why is communication needed?. @@ -519,11 +506,11 @@ public Hl7.Fhir.Model.ResourceReference Sender [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why is communication needed?. @@ -535,11 +522,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Comments made about communication request. @@ -549,46 +536,42 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationRequest; - - if (dest == null) - { + if(other is not CommunicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(About.Any()) dest.About = new List(About.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_About is not null) dest.About = new List(_About.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -600,181 +583,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationRequest; - if(otherT == null) return false; + if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(About, otherT.About)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_About, otherT._About)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "about": - value = About; - return About?.Any() == true; + value = _About; + return _About?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "about": - About = (List)value; + About = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -785,28 +768,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (About?.Any() == true) yield return new KeyValuePair("about",About); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_About?.Any() == true) yield return new KeyValuePair("about",_About); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs index c14f10248..62bff412f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Name of resource type @@ -99,13 +102,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -118,24 +118,24 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get { if(_ParamElement==null) _ParamElement = new List(); return _ParamElement; } + get => _ParamElement ?? new List(); set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } - private List _ParamElement; + private List? _ParamElement; /// /// Search Parameter Name, or chained parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Param + public IEnumerable? Param { - get { return ParamElement != null ? ParamElement.Select(elem => elem.Value) : null; } + get => _ParamElement?.Select(elem => elem.Value); set { if (value == null) - ParamElement = null; + ParamElement = null!; else ParamElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Param"); @@ -147,45 +147,38 @@ public IEnumerable Param /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional documentation about the resource and compartment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ParamElement.Any()) dest.ParamElement = new List(ParamElement.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ParamElement is not null) dest.ParamElement = new List(_ParamElement.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -197,48 +190,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(ParamElement, otherT.ParamElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "param": - value = ParamElement; - return ParamElement?.Any() == true; + value = _ParamElement; + return _ParamElement?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "param": - ParamElement = (List)value; + ParamElement = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -249,9 +242,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ParamElement?.Any() == true) yield return new KeyValuePair("param",ParamElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ParamElement?.Any() == true) yield return new KeyValuePair("param",_ParamElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -262,28 +255,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this compartment definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -293,28 +283,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the compartment definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -325,28 +312,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this compartment definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -359,13 +343,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -374,13 +358,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -390,13 +371,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=130, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -405,13 +386,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -421,28 +399,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -452,28 +427,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -486,39 +458,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the compartment definition. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the compartment definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -531,39 +500,36 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Why this compartment definition is defined. /// [FhirElement("purpose", Order=190, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this compartment definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -576,13 +542,13 @@ public string Purpose [Binding("CompartmentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device @@ -591,13 +557,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -608,13 +571,13 @@ public Hl7.Fhir.Model.CompartmentType? Code [FhirElement("search", InSummary=true, Order=210)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SearchElement + public Hl7.Fhir.Model.FhirBoolean? SearchElement { get { return _SearchElement; } set { _SearchElement = value; OnPropertyChanged("SearchElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SearchElement; + private Hl7.Fhir.Model.FhirBoolean? _SearchElement; /// /// Whether the search syntax is supported @@ -623,13 +586,10 @@ public Hl7.Fhir.Model.FhirBoolean SearchElement [IgnoreDataMember] public bool? Search { - get { return SearchElement != null ? SearchElement.Value : null; } + get => _SearchElement?.Value; set { - if (value == null) - SearchElement = null; - else - SearchElement = new Hl7.Fhir.Model.FhirBoolean(value); + SearchElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Search"); } } @@ -642,36 +602,32 @@ public bool? Search [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentDefinition; - - if (dest == null) - { + if(other is not CompartmentDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(SearchElement != null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)SearchElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_SearchElement is not null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)_SearchElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -683,125 +639,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentDefinition; - if(otherT == null) return false; + if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(SearchElement, otherT.SearchElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "search": - value = SearchElement; - return SearchElement is not null; + value = _SearchElement; + return _SearchElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "search": - SearchElement = (Hl7.Fhir.Model.FhirBoolean)value; + SearchElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -812,20 +768,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (SearchElement is not null) yield return new KeyValuePair("search",SearchElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_SearchElement is not null) yield return new KeyValuePair("search",_SearchElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs b/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs index 772c146e5..68ac51ff5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Composition","http://hl7.org/fhir/StructureDefinition/Composition")] - public partial class Composition : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class Composition : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -165,13 +168,13 @@ public partial class AttesterComponent : Hl7.Fhir.Model.BackboneElement [Binding("CompositionAttestationMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// personal | professional | legal | official @@ -180,13 +183,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.Composition.CompositionAttestationMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -196,28 +196,25 @@ public Hl7.Fhir.Model.Composition.CompositionAttestationMode? Mode /// [FhirElement("time", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the composition was attested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -229,27 +226,23 @@ public string Time [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as AttesterComponent; - - if (dest == null) - { + if(other is not AttesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -261,48 +254,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttesterComponent; - if(otherT == null) return false; + if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -313,9 +306,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -345,13 +338,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | transforms | signs | appends @@ -360,13 +353,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -380,26 +370,22 @@ public Hl7.Fhir.Model.DocumentRelationshipType? Code [AllowedTypes(typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -411,41 +397,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -456,8 +442,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -488,24 +474,24 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// The period covered by the documentation. /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The event(s) being documented. @@ -517,25 +503,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -547,48 +529,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -599,9 +581,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -627,28 +609,25 @@ public partial class SectionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for section (e.g. for ToC) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -659,13 +638,13 @@ public string Title [FhirElement("code", Order=50)] [Binding("CompositionSectionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who and/or what authored the section. @@ -677,11 +656,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who/what the section is about, when it is not about the subject of composition. @@ -690,26 +669,26 @@ public List Author [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Text summary of the section, for human interpretation. /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.Narrative Text + public Hl7.Fhir.Model.Narrative? Text { get { return _Text; } set { _Text = value; OnPropertyChanged("Text"); } } - private Hl7.Fhir.Model.Narrative _Text; + private Hl7.Fhir.Model.Narrative? _Text; /// /// working | snapshot | changes. @@ -718,13 +697,13 @@ public Hl7.Fhir.Model.Narrative Text [DeclaredType(Type = typeof(Code))] [Binding("SectionMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -733,13 +712,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -750,13 +726,13 @@ public Hl7.Fhir.Model.ListMode? Mode [FhirElement("orderedBy", Order=100)] [Binding("SectionEntryOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// A reference to data that supports this section. @@ -768,11 +744,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why the section is empty. @@ -780,13 +756,13 @@ public List Entry [FhirElement("emptyReason", Order=120)] [Binding("SectionEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; /// /// Nested Section. @@ -796,32 +772,28 @@ public Hl7.Fhir.Model.CodeableConcept EmptyReason [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; protected internal override void CopyToInternal(Base other) { - var dest = other as SectionComponent; - - if (dest == null) - { + if(other is not SectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -833,97 +805,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SectionComponent; - if(otherT == null) return false; + if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Text, otherT.Text)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Text, otherT._Text)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "text": - value = Text; - return Text is not null; + value = _Text; + return _Text is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "text": - Text = (Hl7.Fhir.Model.Narrative)value; + Text = (Hl7.Fhir.Model.Narrative?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -934,16 +906,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (Text is not null) yield return new KeyValuePair("text",Text); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_Text is not null) yield return new KeyValuePair("text",_Text); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } @@ -953,13 +925,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// preliminary | final | amended | entered-in-error. @@ -969,13 +941,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("CompositionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preliminary | final | amended | entered-in-error @@ -984,13 +956,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1002,13 +971,13 @@ public Hl7.Fhir.Model.CompositionStatus? Status [Binding("DocumentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of Composition. @@ -1019,11 +988,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who and/or what the composition is about. @@ -1032,13 +1001,13 @@ public List Category [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Context of the Composition. @@ -1047,13 +1016,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Composition editing time. @@ -1061,28 +1030,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Composition editing time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1097,11 +1063,11 @@ public string Date [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Human Readable name/title. @@ -1109,28 +1075,25 @@ public List Author [FhirElement("title", InSummary=true, Order=170)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human Readable name/title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1142,13 +1105,13 @@ public string Title [DeclaredType(Type = typeof(Code))] [Binding("DocumentConfidentiality")] [DataMember] - public Code ConfidentialityElement + public Code? ConfidentialityElement { get { return _ConfidentialityElement; } set { _ConfidentialityElement = value; OnPropertyChanged("ConfidentialityElement"); } } - private Code _ConfidentialityElement; + private Code? _ConfidentialityElement; /// /// As defined by affinity domain @@ -1157,13 +1120,10 @@ public Code ConfidentialityEleme [IgnoreDataMember] public Hl7.Fhir.Model.Composition.ConfidentialityCode? Confidentiality { - get { return ConfidentialityElement != null ? ConfidentialityElement.Value : null; } + get => _ConfidentialityElement?.Value; set { - if (value == null) - ConfidentialityElement = null; - else - ConfidentialityElement = new Code(value); + ConfidentialityElement = value is null ? null : new Code(value); OnPropertyChanged("Confidentiality"); } } @@ -1176,11 +1136,11 @@ public Hl7.Fhir.Model.Composition.ConfidentialityCode? Confidentiality [DataMember] public List Attester { - get { if(_Attester==null) _Attester = new List(); return _Attester; } + get => _Attester ?? new List(); set { _Attester = value; OnPropertyChanged("Attester"); } } - private List _Attester; + private List? _Attester; /// /// Organization which maintains the composition. @@ -1189,13 +1149,13 @@ public List Attester [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other compositions/documents. @@ -1205,11 +1165,11 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// The clinical service(s) being documented. @@ -1219,11 +1179,11 @@ public List RelatesTo [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Composition is broken into sections. @@ -1233,39 +1193,35 @@ public List Event [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Composition; - - if (dest == null) - { + if(other is not Composition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ConfidentialityElement != null) dest.ConfidentialityElement = (Code)ConfidentialityElement.DeepCopyInternal(); - if(Attester.Any()) dest.Attester = new List(Attester.DeepCopyInternal()); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ConfidentialityElement is not null) dest.ConfidentialityElement = (Code)_ConfidentialityElement.DeepCopyInternal(); + if(_Attester is not null) dest.Attester = new List(_Attester.DeepCopyInternal()); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1277,132 +1233,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Composition; - if(otherT == null) return false; + if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ConfidentialityElement, otherT.ConfidentialityElement)) return false; - if(!comparer.ListEquals(Attester, otherT.Attester)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ConfidentialityElement, otherT._ConfidentialityElement)) return false; + if(!comparer.ListEquals(_Attester, otherT._Attester)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "confidentiality": - value = ConfidentialityElement; - return ConfidentialityElement is not null; + value = _ConfidentialityElement; + return _ConfidentialityElement is not null; case "attester": - value = Attester; - return Attester?.Any() == true; + value = _Attester; + return _Attester?.Any() == true; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "confidentiality": - ConfidentialityElement = (Code)value; + ConfidentialityElement = (Code?)value; return this; case "attester": - Attester = (List)value; + Attester = (List?)value!; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1413,21 +1369,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ConfidentialityElement is not null) yield return new KeyValuePair("confidentiality",ConfidentialityElement); - if (Attester?.Any() == true) yield return new KeyValuePair("attester",Attester); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ConfidentialityElement is not null) yield return new KeyValuePair("confidentiality",_ConfidentialityElement); + if (_Attester?.Any() == true) yield return new KeyValuePair("attester",_Attester); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs index 2009883ae..d80d5db36 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ConceptMap","http://hl7.org/fhir/StructureDefinition/ConceptMap")] - public partial class ConceptMap : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ConceptMap : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -108,28 +111,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("source", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// Source system where concepts to be mapped are defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -139,28 +139,25 @@ public string Source /// [FhirElement("sourceVersion", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceVersionElement + public Hl7.Fhir.Model.FhirString? SourceVersionElement { get { return _SourceVersionElement; } set { _SourceVersionElement = value; OnPropertyChanged("SourceVersionElement"); } } - private Hl7.Fhir.Model.FhirString _SourceVersionElement; + private Hl7.Fhir.Model.FhirString? _SourceVersionElement; /// /// Specific version of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceVersion + public string? SourceVersion { - get { return SourceVersionElement != null ? SourceVersionElement.Value : null; } + get => _SourceVersionElement?.Value; set { - if (value == null) - SourceVersionElement = null; - else - SourceVersionElement = new Hl7.Fhir.Model.FhirString(value); + SourceVersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceVersion"); } } @@ -170,28 +167,25 @@ public string SourceVersion /// [FhirElement("target", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri TargetElement + public Hl7.Fhir.Model.FhirUri? TargetElement { get { return _TargetElement; } set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private Hl7.Fhir.Model.FhirUri _TargetElement; + private Hl7.Fhir.Model.FhirUri? _TargetElement; /// /// Target system that the concepts are to be mapped to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Target + public string? Target { - get { return TargetElement != null ? TargetElement.Value : null; } + get => _TargetElement?.Value; set { - if (value == null) - TargetElement = null; - else - TargetElement = new Hl7.Fhir.Model.FhirUri(value); + TargetElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Target"); } } @@ -201,28 +195,25 @@ public string Target /// [FhirElement("targetVersion", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TargetVersionElement + public Hl7.Fhir.Model.FhirString? TargetVersionElement { get { return _TargetVersionElement; } set { _TargetVersionElement = value; OnPropertyChanged("TargetVersionElement"); } } - private Hl7.Fhir.Model.FhirString _TargetVersionElement; + private Hl7.Fhir.Model.FhirString? _TargetVersionElement; /// /// Specific version of the code system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetVersion + public string? TargetVersion { - get { return TargetVersionElement != null ? TargetVersionElement.Value : null; } + get => _TargetVersionElement?.Value; set { - if (value == null) - TargetVersionElement = null; - else - TargetVersionElement = new Hl7.Fhir.Model.FhirString(value); + TargetVersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TargetVersion"); } } @@ -235,41 +226,37 @@ public string TargetVersion [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; /// /// What to do when there is no mapping for the source concept. /// [FhirElement("unmapped", Order=90)] [DataMember] - public Hl7.Fhir.Model.ConceptMap.UnmappedComponent Unmapped + public Hl7.Fhir.Model.ConceptMap.UnmappedComponent? Unmapped { get { return _Unmapped; } set { _Unmapped = value; OnPropertyChanged("Unmapped"); } } - private Hl7.Fhir.Model.ConceptMap.UnmappedComponent _Unmapped; + private Hl7.Fhir.Model.ConceptMap.UnmappedComponent? _Unmapped; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(SourceVersionElement != null) dest.SourceVersionElement = (Hl7.Fhir.Model.FhirString)SourceVersionElement.DeepCopyInternal(); - if(TargetElement != null) dest.TargetElement = (Hl7.Fhir.Model.FhirUri)TargetElement.DeepCopyInternal(); - if(TargetVersionElement != null) dest.TargetVersionElement = (Hl7.Fhir.Model.FhirString)TargetVersionElement.DeepCopyInternal(); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); - if(Unmapped != null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)Unmapped.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_SourceVersionElement is not null) dest.SourceVersionElement = (Hl7.Fhir.Model.FhirString)_SourceVersionElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = (Hl7.Fhir.Model.FhirUri)_TargetElement.DeepCopyInternal(); + if(_TargetVersionElement is not null) dest.TargetVersionElement = (Hl7.Fhir.Model.FhirString)_TargetVersionElement.DeepCopyInternal(); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); + if(_Unmapped is not null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)_Unmapped.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -281,69 +268,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(SourceVersionElement, otherT.SourceVersionElement)) return false; - if(!comparer.Equals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.Equals(TargetVersionElement, otherT.TargetVersionElement)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; - if(!comparer.Equals(Unmapped, otherT.Unmapped)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_SourceVersionElement, otherT._SourceVersionElement)) return false; + if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.Equals(_TargetVersionElement, otherT._TargetVersionElement)) return false; + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "sourceVersion": - value = SourceVersionElement; - return SourceVersionElement is not null; + value = _SourceVersionElement; + return _SourceVersionElement is not null; case "target": - value = TargetElement; - return TargetElement is not null; + value = _TargetElement; + return _TargetElement is not null; case "targetVersion": - value = TargetVersionElement; - return TargetVersionElement is not null; + value = _TargetVersionElement; + return _TargetVersionElement is not null; case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; case "unmapped": - value = Unmapped; - return Unmapped is not null; + value = _Unmapped; + return _Unmapped is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "sourceVersion": - SourceVersionElement = (Hl7.Fhir.Model.FhirString)value; + SourceVersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - TargetElement = (Hl7.Fhir.Model.FhirUri)value; + TargetElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "targetVersion": - TargetVersionElement = (Hl7.Fhir.Model.FhirString)value; + TargetVersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "element": - Element = (List)value; + Element = (List?)value!; return this; case "unmapped": - Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)value; + Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent?)value; return this; default: return base.SetValue(key, value); @@ -354,12 +341,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (SourceVersionElement is not null) yield return new KeyValuePair("sourceVersion",SourceVersionElement); - if (TargetElement is not null) yield return new KeyValuePair("target",TargetElement); - if (TargetVersionElement is not null) yield return new KeyValuePair("targetVersion",TargetVersionElement); - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); - if (Unmapped is not null) yield return new KeyValuePair("unmapped",Unmapped); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_SourceVersionElement is not null) yield return new KeyValuePair("sourceVersion",_SourceVersionElement); + if (_TargetElement is not null) yield return new KeyValuePair("target",_TargetElement); + if (_TargetVersionElement is not null) yield return new KeyValuePair("targetVersion",_TargetVersionElement); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); + if (_Unmapped is not null) yield return new KeyValuePair("unmapped",_Unmapped); } } @@ -386,28 +373,25 @@ public partial class SourceElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies element being mapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -417,28 +401,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -451,25 +432,21 @@ public string Display [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceElementComponent; - - if (dest == null) - { + if(other is not SourceElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -481,48 +458,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceElementComponent; - if(otherT == null) return false; + if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -533,9 +510,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -562,28 +539,25 @@ public partial class TargetElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies the target element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -593,28 +567,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -627,13 +598,13 @@ public string Display [Binding("ConceptMapEquivalence")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code EquivalenceElement + public Code? EquivalenceElement { get { return _EquivalenceElement; } set { _EquivalenceElement = value; OnPropertyChanged("EquivalenceElement"); } } - private Code _EquivalenceElement; + private Code? _EquivalenceElement; /// /// relatedto | equivalent | equal | wider | subsumes | narrower | specializes | inexact | unmatched | disjoint @@ -642,13 +613,10 @@ public Code EquivalenceElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMapEquivalence? Equivalence { - get { return EquivalenceElement != null ? EquivalenceElement.Value : null; } + get => _EquivalenceElement?.Value; set { - if (value == null) - EquivalenceElement = null; - else - EquivalenceElement = new Code(value); + EquivalenceElement = value is null ? null : new Code(value); OnPropertyChanged("Equivalence"); } } @@ -658,28 +626,25 @@ public Hl7.Fhir.Model.ConceptMapEquivalence? Equivalence /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Description of status/issues in mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -692,11 +657,11 @@ public string Comment [DataMember] public List DependsOn { - get { if(_DependsOn==null) _DependsOn = new List(); return _DependsOn; } + get => _DependsOn ?? new List(); set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } - private List _DependsOn; + private List? _DependsOn; /// /// Other concepts that this mapping also produces. @@ -706,28 +671,24 @@ public List DependsOn [DataMember] public List Product { - get { if(_Product==null) _Product = new List(); return _Product; } + get => _Product ?? new List(); set { _Product = value; OnPropertyChanged("Product"); } } - private List _Product; + private List? _Product; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetElementComponent; - - if (dest == null) - { + if(other is not TargetElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(EquivalenceElement != null) dest.EquivalenceElement = (Code)EquivalenceElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(DependsOn.Any()) dest.DependsOn = new List(DependsOn.DeepCopyInternal()); - if(Product.Any()) dest.Product = new List(Product.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_EquivalenceElement is not null) dest.EquivalenceElement = (Code)_EquivalenceElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_DependsOn is not null) dest.DependsOn = new List(_DependsOn.DeepCopyInternal()); + if(_Product is not null) dest.Product = new List(_Product.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -739,69 +700,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetElementComponent; - if(otherT == null) return false; + if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(EquivalenceElement, otherT.EquivalenceElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(DependsOn, otherT.DependsOn)) return false; - if(!comparer.ListEquals(Product, otherT.Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_EquivalenceElement, otherT._EquivalenceElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; + if(!comparer.ListEquals(_Product, otherT._Product)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "equivalence": - value = EquivalenceElement; - return EquivalenceElement is not null; + value = _EquivalenceElement; + return _EquivalenceElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "dependsOn": - value = DependsOn; - return DependsOn?.Any() == true; + value = _DependsOn; + return _DependsOn?.Any() == true; case "product": - value = Product; - return Product?.Any() == true; + value = _Product; + return _Product?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "equivalence": - EquivalenceElement = (Code)value; + EquivalenceElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "dependsOn": - DependsOn = (List)value; + DependsOn = (List?)value!; return this; case "product": - Product = (List)value; + Product = (List?)value!; return this; default: return base.SetValue(key, value); @@ -812,12 +773,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (EquivalenceElement is not null) yield return new KeyValuePair("equivalence",EquivalenceElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",DependsOn); - if (Product?.Any() == true) yield return new KeyValuePair("product",Product); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_EquivalenceElement is not null) yield return new KeyValuePair("equivalence",_EquivalenceElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",_DependsOn); + if (_Product?.Any() == true) yield return new KeyValuePair("product",_Product); } } @@ -844,28 +805,25 @@ public partial class OtherElementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("property", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri PropertyElement + public Hl7.Fhir.Model.FhirUri? PropertyElement { get { return _PropertyElement; } set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private Hl7.Fhir.Model.FhirUri _PropertyElement; + private Hl7.Fhir.Model.FhirUri? _PropertyElement; /// /// Reference to property mapping depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Property + public string? Property { - get { return PropertyElement != null ? PropertyElement.Value : null; } + get => _PropertyElement?.Value; set { - if (value == null) - PropertyElement = null; - else - PropertyElement = new Hl7.Fhir.Model.FhirUri(value); + PropertyElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Property"); } } @@ -875,28 +833,25 @@ public string Property /// [FhirElement("system", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical SystemElement + public Hl7.Fhir.Model.Canonical? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.Canonical _SystemElement; + private Hl7.Fhir.Model.Canonical? _SystemElement; /// /// Code System (if necessary) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.Canonical(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("System"); } } @@ -907,28 +862,25 @@ public string System [FhirElement("value", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value of the referenced element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -938,46 +890,39 @@ public string Value /// [FhirElement("display", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code (if value is a code) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OtherElementComponent; - - if (dest == null) - { + if(other is not OtherElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PropertyElement != null) dest.PropertyElement = (Hl7.Fhir.Model.FhirUri)PropertyElement.DeepCopyInternal(); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.Canonical)SystemElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_PropertyElement is not null) dest.PropertyElement = (Hl7.Fhir.Model.FhirUri)_PropertyElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.Canonical)_SystemElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -989,55 +934,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherElementComponent; - if(otherT == null) return false; + if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PropertyElement, otherT.PropertyElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "property": - value = PropertyElement; - return PropertyElement is not null; + value = _PropertyElement; + return _PropertyElement is not null; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "property": - PropertyElement = (Hl7.Fhir.Model.FhirUri)value; + PropertyElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "system": - SystemElement = (Hl7.Fhir.Model.Canonical)value; + SystemElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1048,10 +993,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PropertyElement is not null) yield return new KeyValuePair("property",PropertyElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_PropertyElement is not null) yield return new KeyValuePair("property",_PropertyElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -1081,13 +1026,13 @@ public partial class UnmappedComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConceptMapGroupUnmappedMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// provided | fixed | other-map @@ -1096,13 +1041,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -1112,28 +1054,25 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Fixed code when mode = fixed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1143,28 +1082,25 @@ public string Code /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -1174,46 +1110,39 @@ public string Display /// [FhirElement("url", Order=70)] [DataMember] - public Hl7.Fhir.Model.Canonical UrlElement + public Hl7.Fhir.Model.Canonical? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.Canonical _UrlElement; + private Hl7.Fhir.Model.Canonical? _UrlElement; /// /// canonical reference to an additional ConceptMap to use for mapping if the source concept is unmapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.Canonical(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UnmappedComponent; - - if (dest == null) - { + if(other is not UnmappedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)UrlElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1225,55 +1154,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UnmappedComponent; - if(otherT == null) return false; + if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.Canonical)value; + UrlElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1284,10 +1213,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -1297,28 +1226,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this concept map, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1328,41 +1254,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the concept map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1372,28 +1295,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this concept map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1403,28 +1323,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this concept map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1437,13 +1354,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1452,13 +1369,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1468,13 +1382,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1483,13 +1397,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1499,28 +1410,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1530,28 +1438,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1564,39 +1469,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the concept map. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1609,11 +1511,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for concept map (if applicable). @@ -1624,39 +1526,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this concept map is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this concept map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1666,28 +1565,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1699,13 +1595,13 @@ public string Copyright [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// The target value set which provides context for the mappings. @@ -1714,13 +1610,13 @@ public Hl7.Fhir.Model.DataType Source [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; /// /// Same source and target systems. @@ -1730,42 +1626,38 @@ public Hl7.Fhir.Model.DataType Target [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptMap; - - if (dest == null) - { + if(other is not ConceptMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1777,153 +1669,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptMap; - if(otherT == null) return false; + if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1934,24 +1826,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs b/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs index 438638c48..e64a6930a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -173,13 +176,13 @@ public partial class StageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("summary", Order=40)] [Binding("ConditionStage")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Summary + public Hl7.Fhir.Model.CodeableConcept? Summary { get { return _Summary; } set { _Summary = value; OnPropertyChanged("Summary"); } } - private Hl7.Fhir.Model.CodeableConcept _Summary; + private Hl7.Fhir.Model.CodeableConcept? _Summary; /// /// Formal record of assessment. @@ -191,11 +194,11 @@ public Hl7.Fhir.Model.CodeableConcept Summary [DataMember] public List Assessment { - get { if(_Assessment==null) _Assessment = new List(); return _Assessment; } + get => _Assessment ?? new List(); set { _Assessment = value; OnPropertyChanged("Assessment"); } } - private List _Assessment; + private List? _Assessment; /// /// Kind of staging. @@ -203,27 +206,23 @@ public List Assessment [FhirElement("type", Order=60)] [Binding("ConditionStageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as StageComponent; - - if (dest == null) - { + if(other is not StageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Summary != null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)Summary.DeepCopyInternal(); - if(Assessment.Any()) dest.Assessment = new List(Assessment.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_Summary is not null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)_Summary.DeepCopyInternal(); + if(_Assessment is not null) dest.Assessment = new List(_Assessment.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -235,48 +234,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StageComponent; - if(otherT == null) return false; + if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Summary, otherT.Summary)) return false; - if(!comparer.ListEquals(Assessment, otherT.Assessment)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "summary": - value = Summary; - return Summary is not null; + value = _Summary; + return _Summary is not null; case "assessment": - value = Assessment; - return Assessment?.Any() == true; + value = _Assessment; + return _Assessment?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "summary": - Summary = (Hl7.Fhir.Model.CodeableConcept)value; + Summary = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "assessment": - Assessment = (List)value; + Assessment = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -287,9 +286,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Summary is not null) yield return new KeyValuePair("summary",Summary); - if (Assessment?.Any() == true) yield return new KeyValuePair("assessment",Assessment); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_Summary is not null) yield return new KeyValuePair("summary",_Summary); + if (_Assessment?.Any() == true) yield return new KeyValuePair("assessment",_Assessment); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -320,11 +319,11 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting information found elsewhere. @@ -336,24 +335,20 @@ public List Code [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceComponent; - - if (dest == null) - { + if(other is not EvidenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -365,41 +360,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceComponent; - if(otherT == null) return false; + if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -410,8 +405,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -424,11 +419,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | recurrence | relapse | inactive | remission | resolved. @@ -436,13 +431,13 @@ public List Identifier [FhirElement("clinicalStatus", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [Binding("ConditionClinicalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ClinicalStatus + public Hl7.Fhir.Model.CodeableConcept? ClinicalStatus { get { return _ClinicalStatus; } set { _ClinicalStatus = value; OnPropertyChanged("ClinicalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ClinicalStatus; + private Hl7.Fhir.Model.CodeableConcept? _ClinicalStatus; /// /// unconfirmed | provisional | differential | confirmed | refuted | entered-in-error. @@ -450,13 +445,13 @@ public Hl7.Fhir.Model.CodeableConcept ClinicalStatus [FhirElement("verificationStatus", InSummary=true, IsModifier=true, Order=110, FiveWs="FiveWs.status")] [Binding("ConditionVerificationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VerificationStatus + public Hl7.Fhir.Model.CodeableConcept? VerificationStatus { get { return _VerificationStatus; } set { _VerificationStatus = value; OnPropertyChanged("VerificationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _VerificationStatus; + private Hl7.Fhir.Model.CodeableConcept? _VerificationStatus; /// /// problem-list-item | encounter-diagnosis. @@ -467,11 +462,11 @@ public Hl7.Fhir.Model.CodeableConcept VerificationStatus [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Subjective severity of condition. @@ -479,13 +474,13 @@ public List Category [FhirElement("severity", Order=130, FiveWs="FiveWs.grade")] [Binding("ConditionSeverity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Severity + public Hl7.Fhir.Model.CodeableConcept? Severity { get { return _Severity; } set { _Severity = value; OnPropertyChanged("Severity"); } } - private Hl7.Fhir.Model.CodeableConcept _Severity; + private Hl7.Fhir.Model.CodeableConcept? _Severity; /// /// Identification of the condition, problem or diagnosis. @@ -493,13 +488,13 @@ public Hl7.Fhir.Model.CodeableConcept Severity [FhirElement("code", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [Binding("ConditionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Anatomical location, if relevant. @@ -510,11 +505,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Who has the condition?. @@ -524,13 +519,13 @@ public List BodySite [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -539,13 +534,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Estimated or actual date, date-time, or age. @@ -554,13 +549,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// When in resolution/remission. @@ -569,41 +564,38 @@ public Hl7.Fhir.Model.DataType Onset [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Abatement + public Hl7.Fhir.Model.DataType? Abatement { get { return _Abatement; } set { _Abatement = value; OnPropertyChanged("Abatement"); } } - private Hl7.Fhir.Model.DataType _Abatement; + private Hl7.Fhir.Model.DataType? _Abatement; /// /// Date record was first recorded. /// [FhirElement("recordedDate", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// Date record was first recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -615,13 +607,13 @@ public string RecordedDate [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Person who asserts this condition. @@ -630,13 +622,13 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// Stage/grade, usually assessed formally. @@ -646,11 +638,11 @@ public Hl7.Fhir.Model.ResourceReference Asserter [DataMember] public List Stage { - get { if(_Stage==null) _Stage = new List(); return _Stage; } + get => _Stage ?? new List(); set { _Stage = value; OnPropertyChanged("Stage"); } } - private List _Stage; + private List? _Stage; /// /// Supporting evidence. @@ -660,11 +652,11 @@ public List Stage [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; /// /// Additional information about the Condition. @@ -674,41 +666,37 @@ public List Evidence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Condition; - - if (dest == null) - { + if(other is not Condition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatus != null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)ClinicalStatus.DeepCopyInternal(); - if(VerificationStatus != null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)VerificationStatus.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Severity != null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)Severity.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Abatement != null) dest.Abatement = (Hl7.Fhir.Model.DataType)Abatement.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(Stage.Any()) dest.Stage = new List(Stage.DeepCopyInternal()); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatus is not null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)_ClinicalStatus.DeepCopyInternal(); + if(_VerificationStatus is not null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)_VerificationStatus.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Severity is not null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)_Severity.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Abatement is not null) dest.Abatement = (Hl7.Fhir.Model.DataType)_Abatement.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_Stage is not null) dest.Stage = new List(_Stage.DeepCopyInternal()); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -720,146 +708,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Condition; - if(otherT == null) return false; + if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatus, otherT.ClinicalStatus)) return false; - if(!comparer.Equals(VerificationStatus, otherT.VerificationStatus)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Severity, otherT.Severity)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(Abatement, otherT.Abatement)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.ListEquals(Stage, otherT.Stage)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; + if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Severity, otherT._Severity)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_Abatement, otherT._Abatement)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.ListEquals(_Stage, otherT._Stage)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatus; - return ClinicalStatus is not null; + value = _ClinicalStatus; + return _ClinicalStatus is not null; case "verificationStatus": - value = VerificationStatus; - return VerificationStatus is not null; + value = _VerificationStatus; + return _VerificationStatus is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "severity": - value = Severity; - return Severity is not null; + value = _Severity; + return _Severity is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "abatement": - value = Abatement; - return Abatement is not null; + value = _Abatement; + return _Abatement is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "stage": - value = Stage; - return Stage?.Any() == true; + value = _Stage; + return _Stage?.Any() == true; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verificationStatus": - VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + VerificationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "severity": - Severity = (Hl7.Fhir.Model.CodeableConcept)value; + Severity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "abatement": - Abatement = (Hl7.Fhir.Model.DataType)value; + Abatement = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "stage": - Stage = (List)value; + Stage = (List?)value!; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -870,23 +858,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatus); - if (VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",VerificationStatus); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Severity is not null) yield return new KeyValuePair("severity",Severity); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Abatement is not null) yield return new KeyValuePair("abatement",Abatement); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (Stage?.Any() == true) yield return new KeyValuePair("stage",Stage); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatus); + if (_VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatus); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Severity is not null) yield return new KeyValuePair("severity",_Severity); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Abatement is not null) yield return new KeyValuePair("abatement",_Abatement); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_Stage?.Any() == true) yield return new KeyValuePair("stage",_Stage); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs b/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs index e3392b8a8..efe7c0aa0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -183,28 +186,25 @@ public partial class PolicyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("authority", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri AuthorityElement + public Hl7.Fhir.Model.FhirUri? AuthorityElement { get { return _AuthorityElement; } set { _AuthorityElement = value; OnPropertyChanged("AuthorityElement"); } } - private Hl7.Fhir.Model.FhirUri _AuthorityElement; + private Hl7.Fhir.Model.FhirUri? _AuthorityElement; /// /// Enforcement source for policy /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authority + public string? Authority { - get { return AuthorityElement != null ? AuthorityElement.Value : null; } + get => _AuthorityElement?.Value; set { - if (value == null) - AuthorityElement = null; - else - AuthorityElement = new Hl7.Fhir.Model.FhirUri(value); + AuthorityElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Authority"); } } @@ -214,44 +214,37 @@ public string Authority /// [FhirElement("uri", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Specific policy covered by this consent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PolicyComponent; - - if (dest == null) - { + if(other is not PolicyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AuthorityElement != null) dest.AuthorityElement = (Hl7.Fhir.Model.FhirUri)AuthorityElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); + if(_AuthorityElement is not null) dest.AuthorityElement = (Hl7.Fhir.Model.FhirUri)_AuthorityElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -263,41 +256,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PolicyComponent; - if(otherT == null) return false; + if(other is not PolicyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AuthorityElement, otherT.AuthorityElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authority": - value = AuthorityElement; - return AuthorityElement is not null; + value = _AuthorityElement; + return _AuthorityElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authority": - AuthorityElement = (Hl7.Fhir.Model.FhirUri)value; + AuthorityElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -308,8 +301,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AuthorityElement is not null) yield return new KeyValuePair("authority",AuthorityElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); + if (_AuthorityElement is not null) yield return new KeyValuePair("authority",_AuthorityElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); } } @@ -336,13 +329,13 @@ public partial class VerificationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("verified", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean VerifiedElement + public Hl7.Fhir.Model.FhirBoolean? VerifiedElement { get { return _VerifiedElement; } set { _VerifiedElement = value; OnPropertyChanged("VerifiedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _VerifiedElement; + private Hl7.Fhir.Model.FhirBoolean? _VerifiedElement; /// /// Has been verified @@ -351,13 +344,10 @@ public Hl7.Fhir.Model.FhirBoolean VerifiedElement [IgnoreDataMember] public bool? Verified { - get { return VerifiedElement != null ? VerifiedElement.Value : null; } + get => _VerifiedElement?.Value; set { - if (value == null) - VerifiedElement = null; - else - VerifiedElement = new Hl7.Fhir.Model.FhirBoolean(value); + VerifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Verified"); } } @@ -369,58 +359,51 @@ public bool? Verified [CLSCompliant(false)] [References("Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference VerifiedWith + public Hl7.Fhir.Model.ResourceReference? VerifiedWith { get { return _VerifiedWith; } set { _VerifiedWith = value; OnPropertyChanged("VerifiedWith"); } } - private Hl7.Fhir.Model.ResourceReference _VerifiedWith; + private Hl7.Fhir.Model.ResourceReference? _VerifiedWith; /// /// When consent verified. /// [FhirElement("verificationDate", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime VerificationDateElement + public Hl7.Fhir.Model.FhirDateTime? VerificationDateElement { get { return _VerificationDateElement; } set { _VerificationDateElement = value; OnPropertyChanged("VerificationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _VerificationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _VerificationDateElement; /// /// When consent verified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VerificationDate + public string? VerificationDate { - get { return VerificationDateElement != null ? VerificationDateElement.Value : null; } + get => _VerificationDateElement?.Value; set { - if (value == null) - VerificationDateElement = null; - else - VerificationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + VerificationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("VerificationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VerificationComponent; - - if (dest == null) - { + if(other is not VerificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VerifiedElement != null) dest.VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)VerifiedElement.DeepCopyInternal(); - if(VerifiedWith != null) dest.VerifiedWith = (Hl7.Fhir.Model.ResourceReference)VerifiedWith.DeepCopyInternal(); - if(VerificationDateElement != null) dest.VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime)VerificationDateElement.DeepCopyInternal(); + if(_VerifiedElement is not null) dest.VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)_VerifiedElement.DeepCopyInternal(); + if(_VerifiedWith is not null) dest.VerifiedWith = (Hl7.Fhir.Model.ResourceReference)_VerifiedWith.DeepCopyInternal(); + if(_VerificationDateElement is not null) dest.VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime)_VerificationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -432,48 +415,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VerificationComponent; - if(otherT == null) return false; + if(other is not VerificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VerifiedElement, otherT.VerifiedElement)) return false; - if(!comparer.Equals(VerifiedWith, otherT.VerifiedWith)) return false; - if(!comparer.Equals(VerificationDateElement, otherT.VerificationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; + if(!comparer.Equals(_VerifiedWith, otherT._VerifiedWith)) return false; + if(!comparer.Equals(_VerificationDateElement, otherT._VerificationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "verified": - value = VerifiedElement; - return VerifiedElement is not null; + value = _VerifiedElement; + return _VerifiedElement is not null; case "verifiedWith": - value = VerifiedWith; - return VerifiedWith is not null; + value = _VerifiedWith; + return _VerifiedWith is not null; case "verificationDate": - value = VerificationDateElement; - return VerificationDateElement is not null; + value = _VerificationDateElement; + return _VerificationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "verified": - VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)value; + VerifiedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "verifiedWith": - VerifiedWith = (Hl7.Fhir.Model.ResourceReference)value; + VerifiedWith = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "verificationDate": - VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + VerificationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -484,9 +467,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VerifiedElement is not null) yield return new KeyValuePair("verified",VerifiedElement); - if (VerifiedWith is not null) yield return new KeyValuePair("verifiedWith",VerifiedWith); - if (VerificationDateElement is not null) yield return new KeyValuePair("verificationDate",VerificationDateElement); + if (_VerifiedElement is not null) yield return new KeyValuePair("verified",_VerifiedElement); + if (_VerifiedWith is not null) yield return new KeyValuePair("verifiedWith",_VerifiedWith); + if (_VerificationDateElement is not null) yield return new KeyValuePair("verificationDate",_VerificationDateElement); } } @@ -514,13 +497,13 @@ public partial class provisionComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ConsentProvisionType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// deny | permit @@ -529,13 +512,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentProvisionType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -545,13 +525,13 @@ public Hl7.Fhir.Model.Consent.ConsentProvisionType? Type /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Who|what controlled by this rule (or group, by role). @@ -561,11 +541,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Actions controlled by this rule. @@ -576,11 +556,11 @@ public List Actor [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Security Labels that define affected resources. @@ -591,11 +571,11 @@ public List Action [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of activities covered by this rule. @@ -606,11 +586,11 @@ public List SecurityLabel [DataMember] public List Purpose { - get { if(_Purpose==null) _Purpose = new List(); return _Purpose; } + get => _Purpose ?? new List(); set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private List _Purpose; + private List? _Purpose; /// /// e.g. Resource Type, Profile, CDA, etc. @@ -621,11 +601,11 @@ public List Purpose [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// e.g. LOINC or SNOMED CT code, etc. in the content. @@ -636,24 +616,24 @@ public List Class [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Timeframe for data controlled by this rule. /// [FhirElement("dataPeriod", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period DataPeriod + public Hl7.Fhir.Model.Period? DataPeriod { get { return _DataPeriod; } set { _DataPeriod = value; OnPropertyChanged("DataPeriod"); } } - private Hl7.Fhir.Model.Period _DataPeriod; + private Hl7.Fhir.Model.Period? _DataPeriod; /// /// Data controlled by this rule. @@ -663,11 +643,11 @@ public Hl7.Fhir.Model.Period DataPeriod [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// Nested Exception Rules. @@ -677,33 +657,29 @@ public List Data [DataMember] public List Provision { - get { if(_Provision==null) _Provision = new List(); return _Provision; } + get => _Provision ?? new List(); set { _Provision = value; OnPropertyChanged("Provision"); } } - private List _Provision; + private List? _Provision; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionComponent; - - if (dest == null) - { + if(other is not provisionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Purpose.Any()) dest.Purpose = new List(Purpose.DeepCopyInternal()); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(DataPeriod != null) dest.DataPeriod = (Hl7.Fhir.Model.Period)DataPeriod.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Provision.Any()) dest.Provision = new List(Provision.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Purpose is not null) dest.Purpose = new List(_Purpose.DeepCopyInternal()); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_DataPeriod is not null) dest.DataPeriod = (Hl7.Fhir.Model.Period)_DataPeriod.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Provision is not null) dest.Provision = new List(_Provision.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -715,104 +691,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionComponent; - if(otherT == null) return false; + if(other is not provisionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Purpose, otherT.Purpose)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(DataPeriod, otherT.DataPeriod)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.ListEquals(Provision, otherT.Provision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Purpose, otherT._Purpose)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "purpose": - value = Purpose; - return Purpose?.Any() == true; + value = _Purpose; + return _Purpose?.Any() == true; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "dataPeriod": - value = DataPeriod; - return DataPeriod is not null; + value = _DataPeriod; + return _DataPeriod is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "provision": - value = Provision; - return Provision?.Any() == true; + value = _Provision; + return _Provision?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "purpose": - Purpose = (List)value; + Purpose = (List?)value!; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "dataPeriod": - DataPeriod = (Hl7.Fhir.Model.Period)value; + DataPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "provision": - Provision = (List)value; + Provision = (List?)value!; return this; default: return base.SetValue(key, value); @@ -823,17 +799,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Purpose?.Any() == true) yield return new KeyValuePair("purpose",Purpose); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (DataPeriod is not null) yield return new KeyValuePair("dataPeriod",DataPeriod); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Provision?.Any() == true) yield return new KeyValuePair("provision",Provision); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Purpose?.Any() == true) yield return new KeyValuePair("purpose",_Purpose); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_DataPeriod is not null) yield return new KeyValuePair("dataPeriod",_DataPeriod); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Provision?.Any() == true) yield return new KeyValuePair("provision",_Provision); } } @@ -861,13 +837,13 @@ public partial class provisionActorComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentActorRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Resource for the actor (or group, by role). @@ -877,26 +853,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Device","Group","CareTeam","Organization","Patient","Practitioner","RelatedPerson","PractitionerRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionActorComponent; - - if (dest == null) - { + if(other is not provisionActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -908,41 +880,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionActorComponent; - if(otherT == null) return false; + if(other is not provisionActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -953,8 +925,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -983,13 +955,13 @@ public partial class provisionDataComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentDataMeaning")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MeaningElement + public Code? MeaningElement { get { return _MeaningElement; } set { _MeaningElement = value; OnPropertyChanged("MeaningElement"); } } - private Code _MeaningElement; + private Code? _MeaningElement; /// /// instance | related | dependents | authoredby @@ -998,13 +970,10 @@ public Code MeaningElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning { - get { return MeaningElement != null ? MeaningElement.Value : null; } + get => _MeaningElement?.Value; set { - if (value == null) - MeaningElement = null; - else - MeaningElement = new Code(value); + MeaningElement = value is null ? null : new Code(value); OnPropertyChanged("Meaning"); } } @@ -1017,26 +986,22 @@ public Hl7.Fhir.Model.Consent.ConsentDataMeaning? Meaning [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionDataComponent; - - if (dest == null) - { + if(other is not provisionDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MeaningElement != null) dest.MeaningElement = (Code)MeaningElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_MeaningElement is not null) dest.MeaningElement = (Code)_MeaningElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1048,41 +1013,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionDataComponent; - if(otherT == null) return false; + if(other is not provisionDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MeaningElement, otherT.MeaningElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "meaning": - value = MeaningElement; - return MeaningElement is not null; + value = _MeaningElement; + return _MeaningElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "meaning": - MeaningElement = (Code)value; + MeaningElement = (Code?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1093,8 +1058,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MeaningElement is not null) yield return new KeyValuePair("meaning",MeaningElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_MeaningElement is not null) yield return new KeyValuePair("meaning",_MeaningElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -1107,11 +1072,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | proposed | active | rejected | inactive | entered-in-error. @@ -1121,13 +1086,13 @@ public List Identifier [Binding("ConsentState")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | proposed | active | rejected | inactive | entered-in-error @@ -1136,13 +1101,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentState? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1154,13 +1116,13 @@ public Hl7.Fhir.Model.Consent.ConsentState? Status [Binding("ConsentScope")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Classification of the consent statement - for indexing/retrieval. @@ -1171,11 +1133,11 @@ public Hl7.Fhir.Model.CodeableConcept Scope [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who the consent applies to. @@ -1184,41 +1146,38 @@ public List Category [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When this Consent was created or indexed. /// [FhirElement("dateTime", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateTimeElement + public Hl7.Fhir.Model.FhirDateTime? DateTimeElement { get { return _DateTimeElement; } set { _DateTimeElement = value; OnPropertyChanged("DateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _DateTimeElement; /// /// When this Consent was created or indexed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateTime + public string? DateTime { - get { return DateTimeElement != null ? DateTimeElement.Value : null; } + get => _DateTimeElement?.Value; set { - if (value == null) - DateTimeElement = null; - else - DateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateTime"); } } @@ -1233,11 +1192,11 @@ public string DateTime [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Custodian of the consent. @@ -1249,11 +1208,11 @@ public List Performer [DataMember] public List Organization { - get { if(_Organization==null) _Organization = new List(); return _Organization; } + get => _Organization ?? new List(); set { _Organization = value; OnPropertyChanged("Organization"); } } - private List _Organization; + private List? _Organization; /// /// Source from which this consent is taken. @@ -1263,13 +1222,13 @@ public List Organization [References("Consent","DocumentReference","Contract","QuestionnaireResponse")] [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// Policies covered by this consent. @@ -1279,11 +1238,11 @@ public Hl7.Fhir.Model.DataType Source [DataMember] public List Policy { - get { if(_Policy==null) _Policy = new List(); return _Policy; } + get => _Policy ?? new List(); set { _Policy = value; OnPropertyChanged("Policy"); } } - private List _Policy; + private List? _Policy; /// /// Regulation that this consents to. @@ -1291,13 +1250,13 @@ public List Policy [FhirElement("policyRule", InSummary=true, Order=190)] [Binding("ConsentPolicyRule")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PolicyRule + public Hl7.Fhir.Model.CodeableConcept? PolicyRule { get { return _PolicyRule; } set { _PolicyRule = value; OnPropertyChanged("PolicyRule"); } } - private Hl7.Fhir.Model.CodeableConcept _PolicyRule; + private Hl7.Fhir.Model.CodeableConcept? _PolicyRule; /// /// Consent Verified by patient or family. @@ -1307,50 +1266,46 @@ public Hl7.Fhir.Model.CodeableConcept PolicyRule [DataMember] public List Verification { - get { if(_Verification==null) _Verification = new List(); return _Verification; } + get => _Verification ?? new List(); set { _Verification = value; OnPropertyChanged("Verification"); } } - private List _Verification; + private List? _Verification; /// /// Constraints to the base Consent.policyRule. /// [FhirElement("provision", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Consent.provisionComponent Provision + public Hl7.Fhir.Model.Consent.provisionComponent? Provision { get { return _Provision; } set { _Provision = value; OnPropertyChanged("Provision"); } } - private Hl7.Fhir.Model.Consent.provisionComponent _Provision; + private Hl7.Fhir.Model.Consent.provisionComponent? _Provision; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Consent; - - if (dest == null) - { + if(other is not Consent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateTimeElement != null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Organization.Any()) dest.Organization = new List(Organization.DeepCopyInternal()); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(Policy.Any()) dest.Policy = new List(Policy.DeepCopyInternal()); - if(PolicyRule != null) dest.PolicyRule = (Hl7.Fhir.Model.CodeableConcept)PolicyRule.DeepCopyInternal(); - if(Verification.Any()) dest.Verification = new List(Verification.DeepCopyInternal()); - if(Provision != null) dest.Provision = (Hl7.Fhir.Model.Consent.provisionComponent)Provision.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateTimeElement is not null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_DateTimeElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Organization is not null) dest.Organization = new List(_Organization.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_Policy is not null) dest.Policy = new List(_Policy.DeepCopyInternal()); + if(_PolicyRule is not null) dest.PolicyRule = (Hl7.Fhir.Model.CodeableConcept)_PolicyRule.DeepCopyInternal(); + if(_Verification is not null) dest.Verification = new List(_Verification.DeepCopyInternal()); + if(_Provision is not null) dest.Provision = (Hl7.Fhir.Model.Consent.provisionComponent)_Provision.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1362,118 +1317,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Consent; - if(otherT == null) return false; + if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateTimeElement, otherT.DateTimeElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Policy, otherT.Policy)) return false; - if(!comparer.Equals(PolicyRule, otherT.PolicyRule)) return false; - if(!comparer.ListEquals(Verification, otherT.Verification)) return false; - if(!comparer.Equals(Provision, otherT.Provision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateTimeElement, otherT._DateTimeElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Policy, otherT._Policy)) return false; + if(!comparer.Equals(_PolicyRule, otherT._PolicyRule)) return false; + if(!comparer.ListEquals(_Verification, otherT._Verification)) return false; + if(!comparer.Equals(_Provision, otherT._Provision)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "dateTime": - value = DateTimeElement; - return DateTimeElement is not null; + value = _DateTimeElement; + return _DateTimeElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "organization": - value = Organization; - return Organization?.Any() == true; + value = _Organization; + return _Organization?.Any() == true; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "policy": - value = Policy; - return Policy?.Any() == true; + value = _Policy; + return _Policy?.Any() == true; case "policyRule": - value = PolicyRule; - return PolicyRule is not null; + value = _PolicyRule; + return _PolicyRule is not null; case "verification": - value = Verification; - return Verification?.Any() == true; + value = _Verification; + return _Verification?.Any() == true; case "provision": - value = Provision; - return Provision is not null; + value = _Provision; + return _Provision is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateTime": - DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "organization": - Organization = (List)value; + Organization = (List?)value!; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "policy": - Policy = (List)value; + Policy = (List?)value!; return this; case "policyRule": - PolicyRule = (Hl7.Fhir.Model.CodeableConcept)value; + PolicyRule = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verification": - Verification = (List)value; + Verification = (List?)value!; return this; case "provision": - Provision = (Hl7.Fhir.Model.Consent.provisionComponent)value; + Provision = (Hl7.Fhir.Model.Consent.provisionComponent?)value; return this; default: return base.SetValue(key, value); @@ -1484,19 +1439,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateTimeElement is not null) yield return new KeyValuePair("dateTime",DateTimeElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Organization?.Any() == true) yield return new KeyValuePair("organization",Organization); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Policy?.Any() == true) yield return new KeyValuePair("policy",Policy); - if (PolicyRule is not null) yield return new KeyValuePair("policyRule",PolicyRule); - if (Verification?.Any() == true) yield return new KeyValuePair("verification",Verification); - if (Provision is not null) yield return new KeyValuePair("provision",Provision); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateTimeElement is not null) yield return new KeyValuePair("dateTime",_DateTimeElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Organization?.Any() == true) yield return new KeyValuePair("organization",_Organization); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Policy?.Any() == true) yield return new KeyValuePair("policy",_Policy); + if (_PolicyRule is not null) yield return new KeyValuePair("policyRule",_PolicyRule); + if (_Verification?.Any() == true) yield return new KeyValuePair("verification",_Verification); + if (_Provision is not null) yield return new KeyValuePair("provision",_Provision); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs index 79bebc836..3c4018219 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -282,13 +285,13 @@ public partial class ContentDefinitionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ContractDefinitionType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Detailed Content Type Definition. @@ -296,13 +299,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=50)] [Binding("ContractDefinitionSubtype")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// Publisher Entity. @@ -311,41 +314,38 @@ public Hl7.Fhir.Model.CodeableConcept SubType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Publisher + public Hl7.Fhir.Model.ResourceReference? Publisher { get { return _Publisher; } set { _Publisher = value; OnPropertyChanged("Publisher"); } } - private Hl7.Fhir.Model.ResourceReference _Publisher; + private Hl7.Fhir.Model.ResourceReference? _Publisher; /// /// When published. /// [FhirElement("publicationDate", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PublicationDateElement + public Hl7.Fhir.Model.FhirDateTime? PublicationDateElement { get { return _PublicationDateElement; } set { _PublicationDateElement = value; OnPropertyChanged("PublicationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PublicationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PublicationDateElement; /// /// When published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDate + public string? PublicationDate { - get { return PublicationDateElement != null ? PublicationDateElement.Value : null; } + get => _PublicationDateElement?.Value; set { - if (value == null) - PublicationDateElement = null; - else - PublicationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PublicationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PublicationDate"); } } @@ -358,13 +358,13 @@ public string PublicationDate [Binding("ContractPublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PublicationStatusElement + public Code? PublicationStatusElement { get { return _PublicationStatusElement; } set { _PublicationStatusElement = value; OnPropertyChanged("PublicationStatusElement"); } } - private Code _PublicationStatusElement; + private Code? _PublicationStatusElement; /// /// amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated @@ -373,13 +373,10 @@ public Code Publ [IgnoreDataMember] public Hl7.Fhir.Model.Contract.ContractResourcePublicationStatusCodes? PublicationStatus { - get { return PublicationStatusElement != null ? PublicationStatusElement.Value : null; } + get => _PublicationStatusElement?.Value; set { - if (value == null) - PublicationStatusElement = null; - else - PublicationStatusElement = new Code(value); + PublicationStatusElement = value is null ? null : new Code(value); OnPropertyChanged("PublicationStatus"); } } @@ -389,48 +386,41 @@ public Hl7.Fhir.Model.Contract.ContractResourcePublicationStatusCodes? Publicati /// [FhirElement("copyright", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Publication Ownership /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContentDefinitionComponent; - - if (dest == null) - { + if(other is not ContentDefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(Publisher != null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)Publisher.DeepCopyInternal(); - if(PublicationDateElement != null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)PublicationDateElement.DeepCopyInternal(); - if(PublicationStatusElement != null) dest.PublicationStatusElement = (Code)PublicationStatusElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_Publisher is not null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)_Publisher.DeepCopyInternal(); + if(_PublicationDateElement is not null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)_PublicationDateElement.DeepCopyInternal(); + if(_PublicationStatusElement is not null) dest.PublicationStatusElement = (Code)_PublicationStatusElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -442,69 +432,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentDefinitionComponent; - if(otherT == null) return false; + if(other is not ContentDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(Publisher, otherT.Publisher)) return false; - if(!comparer.Equals(PublicationDateElement, otherT.PublicationDateElement)) return false; - if(!comparer.Equals(PublicationStatusElement, otherT.PublicationStatusElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; + if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; + if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "publisher": - value = Publisher; - return Publisher is not null; + value = _Publisher; + return _Publisher is not null; case "publicationDate": - value = PublicationDateElement; - return PublicationDateElement is not null; + value = _PublicationDateElement; + return _PublicationDateElement is not null; case "publicationStatus": - value = PublicationStatusElement; - return PublicationStatusElement is not null; + value = _PublicationStatusElement; + return _PublicationStatusElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "publisher": - Publisher = (Hl7.Fhir.Model.ResourceReference)value; + Publisher = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "publicationDate": - PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publicationStatus": - PublicationStatusElement = (Code)value; + PublicationStatusElement = (Code?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -515,12 +505,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (Publisher is not null) yield return new KeyValuePair("publisher",Publisher); - if (PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",PublicationDateElement); - if (PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",PublicationStatusElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_Publisher is not null) yield return new KeyValuePair("publisher",_Publisher); + if (_PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",_PublicationDateElement); + if (_PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",_PublicationStatusElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -546,41 +536,38 @@ public partial class TermComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Term Issue Date Time. /// [FhirElement("issued", InSummary=true, Order=50, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// Contract Term Issue Date Time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -590,13 +577,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=60, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Term Concern. @@ -606,13 +593,13 @@ public Hl7.Fhir.Model.Period Applies [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Topic + public Hl7.Fhir.Model.DataType? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.DataType _Topic; + private Hl7.Fhir.Model.DataType? _Topic; /// /// Contract Term Type or Form. @@ -620,13 +607,13 @@ public Hl7.Fhir.Model.DataType Topic [FhirElement("type", Order=80, FiveWs="FiveWs.what[x]")] [Binding("ContractTermType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Contract Term Type specific classification. @@ -634,41 +621,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=90, FiveWs="FiveWs.what[x]")] [Binding("ContractTermSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// Term Statement. /// [FhirElement("text", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Term Statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -681,11 +665,11 @@ public string Text [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of the Contract term. @@ -693,13 +677,13 @@ public List SecurityLabel [FhirElement("offer", Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Contract.ContractOfferComponent Offer + public Hl7.Fhir.Model.Contract.ContractOfferComponent? Offer { get { return _Offer; } set { _Offer = value; OnPropertyChanged("Offer"); } } - private Hl7.Fhir.Model.Contract.ContractOfferComponent _Offer; + private Hl7.Fhir.Model.Contract.ContractOfferComponent? _Offer; /// /// Contract Term Asset List. @@ -709,11 +693,11 @@ public Hl7.Fhir.Model.Contract.ContractOfferComponent Offer [DataMember] public List Asset { - get { if(_Asset==null) _Asset = new List(); return _Asset; } + get => _Asset ?? new List(); set { _Asset = value; OnPropertyChanged("Asset"); } } - private List _Asset; + private List? _Asset; /// /// Entity being ascribed responsibility. @@ -723,11 +707,11 @@ public List Asset [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Nested Contract Term Group. @@ -737,34 +721,30 @@ public List Action [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; protected internal override void CopyToInternal(Base other) { - var dest = other as TermComponent; - - if (dest == null) - { + if(other is not TermComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.DataType)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Offer != null) dest.Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)Offer.DeepCopyInternal(); - if(Asset.Any()) dest.Asset = new List(Asset.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.DataType)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Offer is not null) dest.Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)_Offer.DeepCopyInternal(); + if(_Asset is not null) dest.Asset = new List(_Asset.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -776,111 +756,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TermComponent; - if(otherT == null) return false; + if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.Equals(Offer, otherT.Offer)) return false; - if(!comparer.ListEquals(Asset, otherT.Asset)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.Equals(_Offer, otherT._Offer)) return false; + if(!comparer.ListEquals(_Asset, otherT._Asset)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "offer": - value = Offer; - return Offer is not null; + value = _Offer; + return _Offer is not null; case "asset": - value = Asset; - return Asset?.Any() == true; + value = _Asset; + return _Asset?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.DataType)value; + Topic = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "offer": - Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)value; + Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent?)value; return this; case "asset": - Asset = (List)value; + Asset = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -891,18 +871,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Offer is not null) yield return new KeyValuePair("offer",Offer); - if (Asset?.Any() == true) yield return new KeyValuePair("asset",Asset); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Offer is not null) yield return new KeyValuePair("offer",_Offer); + if (_Asset?.Any() == true) yield return new KeyValuePair("asset",_Asset); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } @@ -931,24 +911,24 @@ public partial class SecurityLabelComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List NumberElement { - get { if(_NumberElement==null) _NumberElement = new List(); return _NumberElement; } + get => _NumberElement ?? new List(); set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private List _NumberElement; + private List? _NumberElement; /// /// Link to Security Labels /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Number + public IEnumerable? Number { - get { return NumberElement != null ? NumberElement.Select(elem => elem.Value) : null; } + get => _NumberElement?.Select(elem => elem.Value); set { if (value == null) - NumberElement = null; + NumberElement = null!; else NumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("Number"); @@ -962,13 +942,13 @@ public IEnumerable Number [Binding("ContractSecurityClassification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Classification + public Hl7.Fhir.Model.Coding? Classification { get { return _Classification; } set { _Classification = value; OnPropertyChanged("Classification"); } } - private Hl7.Fhir.Model.Coding _Classification; + private Hl7.Fhir.Model.Coding? _Classification; /// /// Applicable Policy. @@ -979,11 +959,11 @@ public Hl7.Fhir.Model.Coding Classification [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Handling Instructions. @@ -994,26 +974,22 @@ public List Category [DataMember] public List Control { - get { if(_Control==null) _Control = new List(); return _Control; } + get => _Control ?? new List(); set { _Control = value; OnPropertyChanged("Control"); } } - private List _Control; + private List? _Control; protected internal override void CopyToInternal(Base other) { - var dest = other as SecurityLabelComponent; - - if (dest == null) - { + if(other is not SecurityLabelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement.Any()) dest.NumberElement = new List(NumberElement.DeepCopyInternal()); - if(Classification != null) dest.Classification = (Hl7.Fhir.Model.Coding)Classification.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Control.Any()) dest.Control = new List(Control.DeepCopyInternal()); + if(_NumberElement is not null) dest.NumberElement = new List(_NumberElement.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = (Hl7.Fhir.Model.Coding)_Classification.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Control is not null) dest.Control = new List(_Control.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1025,55 +1001,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SecurityLabelComponent; - if(otherT == null) return false; + if(other is not SecurityLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Control, otherT.Control)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Control, otherT._Control)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement?.Any() == true; + value = _NumberElement; + return _NumberElement?.Any() == true; case "classification": - value = Classification; - return Classification is not null; + value = _Classification; + return _Classification is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "control": - value = Control; - return Control?.Any() == true; + value = _Control; + return _Control?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (List)value; + NumberElement = (List?)value!; return this; case "classification": - Classification = (Hl7.Fhir.Model.Coding)value; + Classification = (Hl7.Fhir.Model.Coding?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "control": - Control = (List)value; + Control = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1084,10 +1060,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement?.Any() == true) yield return new KeyValuePair("number",NumberElement); - if (Classification is not null) yield return new KeyValuePair("classification",Classification); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Control?.Any() == true) yield return new KeyValuePair("control",Control); + if (_NumberElement?.Any() == true) yield return new KeyValuePair("number",_NumberElement); + if (_Classification is not null) yield return new KeyValuePair("classification",_Classification); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Control?.Any() == true) yield return new KeyValuePair("control",_Control); } } @@ -1116,11 +1092,11 @@ public partial class ContractOfferComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Offer Recipient. @@ -1130,11 +1106,11 @@ public List Identifier [DataMember] public List Party { - get { if(_Party==null) _Party = new List(); return _Party; } + get => _Party ?? new List(); set { _Party = value; OnPropertyChanged("Party"); } } - private List _Party; + private List? _Party; /// /// Negotiable offer asset. @@ -1143,13 +1119,13 @@ public List Party [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Topic + public Hl7.Fhir.Model.ResourceReference? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.ResourceReference _Topic; + private Hl7.Fhir.Model.ResourceReference? _Topic; /// /// Contract Offer Type or Form. @@ -1157,13 +1133,13 @@ public Hl7.Fhir.Model.ResourceReference Topic [FhirElement("type", Order=70, FiveWs="FiveWs.what[x]")] [Binding("ContractTermType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Accepting party choice. @@ -1171,13 +1147,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("decision", Order=80, FiveWs="FiveWs.what[x]")] [Binding("ContractDecisionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Decision + public Hl7.Fhir.Model.CodeableConcept? Decision { get { return _Decision; } set { _Decision = value; OnPropertyChanged("Decision"); } } - private Hl7.Fhir.Model.CodeableConcept _Decision; + private Hl7.Fhir.Model.CodeableConcept? _Decision; /// /// How decision is conveyed. @@ -1188,11 +1164,11 @@ public Hl7.Fhir.Model.CodeableConcept Decision [DataMember] public List DecisionMode { - get { if(_DecisionMode==null) _DecisionMode = new List(); return _DecisionMode; } + get => _DecisionMode ?? new List(); set { _DecisionMode = value; OnPropertyChanged("DecisionMode"); } } - private List _DecisionMode; + private List? _DecisionMode; /// /// Response to offer text. @@ -1202,39 +1178,36 @@ public List DecisionMode [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Human readable offer text. /// [FhirElement("text", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Human readable offer text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -1247,24 +1220,24 @@ public string Text [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -1279,24 +1252,24 @@ public IEnumerable LinkId [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Offer restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -1305,24 +1278,20 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ContractOfferComponent; - - if (dest == null) - { + if(other is not ContractOfferComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Party.Any()) dest.Party = new List(Party.DeepCopyInternal()); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.ResourceReference)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Decision != null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)Decision.DeepCopyInternal(); - if(DecisionMode.Any()) dest.DecisionMode = new List(DecisionMode.DeepCopyInternal()); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Party is not null) dest.Party = new List(_Party.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.ResourceReference)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Decision is not null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)_Decision.DeepCopyInternal(); + if(_DecisionMode is not null) dest.DecisionMode = new List(_DecisionMode.DeepCopyInternal()); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1334,97 +1303,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractOfferComponent; - if(otherT == null) return false; + if(other is not ContractOfferComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Party, otherT.Party)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Decision, otherT.Decision)) return false; - if(!comparer.ListEquals(DecisionMode, otherT.DecisionMode)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Decision, otherT._Decision)) return false; + if(!comparer.ListEquals(_DecisionMode, otherT._DecisionMode)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "party": - value = Party; - return Party?.Any() == true; + value = _Party; + return _Party?.Any() == true; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "decision": - value = Decision; - return Decision is not null; + value = _Decision; + return _Decision is not null; case "decisionMode": - value = DecisionMode; - return DecisionMode?.Any() == true; + value = _DecisionMode; + return _DecisionMode?.Any() == true; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "party": - Party = (List)value; + Party = (List?)value!; return this; case "topic": - Topic = (Hl7.Fhir.Model.ResourceReference)value; + Topic = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "decision": - Decision = (Hl7.Fhir.Model.CodeableConcept)value; + Decision = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "decisionMode": - DecisionMode = (List)value; + DecisionMode = (List?)value!; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1435,16 +1404,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Party?.Any() == true) yield return new KeyValuePair("party",Party); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Decision is not null) yield return new KeyValuePair("decision",Decision); - if (DecisionMode?.Any() == true) yield return new KeyValuePair("decisionMode",DecisionMode); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Party?.Any() == true) yield return new KeyValuePair("party",_Party); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Decision is not null) yield return new KeyValuePair("decision",_Decision); + if (_DecisionMode?.Any() == true) yield return new KeyValuePair("decisionMode",_DecisionMode); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -1472,11 +1441,11 @@ public partial class ContractPartyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; /// /// Participant engagement type. @@ -1485,26 +1454,22 @@ public List Reference [Binding("ContractPartyRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ContractPartyComponent; - - if (dest == null) - { + if(other is not ContractPartyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1516,41 +1481,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractPartyComponent; - if(otherT == null) return false; + if(other is not ContractPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1561,8 +1526,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -1589,25 +1554,21 @@ public partial class AnswerComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerComponent; - - if (dest == null) - { + if(other is not AnswerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1619,34 +1580,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerComponent; - if(otherT == null) return false; + if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1657,7 +1618,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1681,13 +1642,13 @@ public partial class ContractAssetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("scope", Order=40)] [Binding("ContractAssetScope")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Asset category. @@ -1698,11 +1659,11 @@ public Hl7.Fhir.Model.CodeableConcept Scope [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Associated entities. @@ -1714,11 +1675,11 @@ public List Type [DataMember] public List TypeReference { - get { if(_TypeReference==null) _TypeReference = new List(); return _TypeReference; } + get => _TypeReference ?? new List(); set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } - private List _TypeReference; + private List? _TypeReference; /// /// Asset sub-category. @@ -1729,11 +1690,11 @@ public List TypeReference [DataMember] public List Subtype { - get { if(_Subtype==null) _Subtype = new List(); return _Subtype; } + get => _Subtype ?? new List(); set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private List _Subtype; + private List? _Subtype; /// /// Kinship of the asset. @@ -1741,13 +1702,13 @@ public List Subtype [FhirElement("relationship", Order=80)] [Binding("ConsentContentClass")] [DataMember] - public Hl7.Fhir.Model.Coding Relationship + public Hl7.Fhir.Model.Coding? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.Coding _Relationship; + private Hl7.Fhir.Model.Coding? _Relationship; /// /// Circumstance of the asset. @@ -1757,39 +1718,36 @@ public Hl7.Fhir.Model.Coding Relationship [DataMember] public List Context { - get { if(_Context==null) _Context = new List(); return _Context; } + get => _Context ?? new List(); set { _Context = value; OnPropertyChanged("Context"); } } - private List _Context; + private List? _Context; /// /// Quality desctiption of asset. /// [FhirElement("condition", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// Quality desctiption of asset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -1803,11 +1761,11 @@ public string Condition [DataMember] public List PeriodType { - get { if(_PeriodType==null) _PeriodType = new List(); return _PeriodType; } + get => _PeriodType ?? new List(); set { _PeriodType = value; OnPropertyChanged("PeriodType"); } } - private List _PeriodType; + private List? _PeriodType; /// /// Time period of the asset. @@ -1817,11 +1775,11 @@ public List PeriodType [DataMember] public List Period { - get { if(_Period==null) _Period = new List(); return _Period; } + get => _Period ?? new List(); set { _Period = value; OnPropertyChanged("Period"); } } - private List _Period; + private List? _Period; /// /// Time period. @@ -1831,39 +1789,36 @@ public List Period [DataMember] public List UsePeriod { - get { if(_UsePeriod==null) _UsePeriod = new List(); return _UsePeriod; } + get => _UsePeriod ?? new List(); set { _UsePeriod = value; OnPropertyChanged("UsePeriod"); } } - private List _UsePeriod; + private List? _UsePeriod; /// /// Asset clause or question text. /// [FhirElement("text", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Asset clause or question text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -1876,24 +1831,24 @@ public string Text [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to asset text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -1908,11 +1863,11 @@ public IEnumerable LinkId [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Asset restriction numbers. @@ -1922,24 +1877,24 @@ public List Answer [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Asset restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -1954,37 +1909,33 @@ public IEnumerable SecurityLabelNumber [DataMember] public List ValuedItem { - get { if(_ValuedItem==null) _ValuedItem = new List(); return _ValuedItem; } + get => _ValuedItem ?? new List(); set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } - private List _ValuedItem; + private List? _ValuedItem; protected internal override void CopyToInternal(Base other) { - var dest = other as ContractAssetComponent; - - if (dest == null) - { + if(other is not ContractAssetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(TypeReference.Any()) dest.TypeReference = new List(TypeReference.DeepCopyInternal()); - if(Subtype.Any()) dest.Subtype = new List(Subtype.DeepCopyInternal()); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.Coding)Relationship.DeepCopyInternal(); - if(Context.Any()) dest.Context = new List(Context.DeepCopyInternal()); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(PeriodType.Any()) dest.PeriodType = new List(PeriodType.DeepCopyInternal()); - if(Period.Any()) dest.Period = new List(Period.DeepCopyInternal()); - if(UsePeriod.Any()) dest.UsePeriod = new List(UsePeriod.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); - if(ValuedItem.Any()) dest.ValuedItem = new List(ValuedItem.DeepCopyInternal()); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_TypeReference is not null) dest.TypeReference = new List(_TypeReference.DeepCopyInternal()); + if(_Subtype is not null) dest.Subtype = new List(_Subtype.DeepCopyInternal()); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.Coding)_Relationship.DeepCopyInternal(); + if(_Context is not null) dest.Context = new List(_Context.DeepCopyInternal()); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_PeriodType is not null) dest.PeriodType = new List(_PeriodType.DeepCopyInternal()); + if(_Period is not null) dest.Period = new List(_Period.DeepCopyInternal()); + if(_UsePeriod is not null) dest.UsePeriod = new List(_UsePeriod.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); + if(_ValuedItem is not null) dest.ValuedItem = new List(_ValuedItem.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1996,132 +1947,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractAssetComponent; - if(otherT == null) return false; + if(other is not ContractAssetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(TypeReference, otherT.TypeReference)) return false; - if(!comparer.ListEquals(Subtype, otherT.Subtype)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.ListEquals(Context, otherT.Context)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.ListEquals(PeriodType, otherT.PeriodType)) return false; - if(!comparer.ListEquals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(UsePeriod, otherT.UsePeriod)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; - if(!comparer.ListEquals(ValuedItem, otherT.ValuedItem)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_TypeReference, otherT._TypeReference)) return false; + if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.ListEquals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.ListEquals(_PeriodType, otherT._PeriodType)) return false; + if(!comparer.ListEquals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_UsePeriod, otherT._UsePeriod)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; + if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "typeReference": - value = TypeReference; - return TypeReference?.Any() == true; + value = _TypeReference; + return _TypeReference?.Any() == true; case "subtype": - value = Subtype; - return Subtype?.Any() == true; + value = _Subtype; + return _Subtype?.Any() == true; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "context": - value = Context; - return Context?.Any() == true; + value = _Context; + return _Context?.Any() == true; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "periodType": - value = PeriodType; - return PeriodType?.Any() == true; + value = _PeriodType; + return _PeriodType?.Any() == true; case "period": - value = Period; - return Period?.Any() == true; + value = _Period; + return _Period?.Any() == true; case "usePeriod": - value = UsePeriod; - return UsePeriod?.Any() == true; + value = _UsePeriod; + return _UsePeriod?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; case "valuedItem": - value = ValuedItem; - return ValuedItem?.Any() == true; + value = _ValuedItem; + return _ValuedItem?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "typeReference": - TypeReference = (List)value; + TypeReference = (List?)value!; return this; case "subtype": - Subtype = (List)value; + Subtype = (List?)value!; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.Coding)value; + Relationship = (Hl7.Fhir.Model.Coding?)value; return this; case "context": - Context = (List)value; + Context = (List?)value!; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "periodType": - PeriodType = (List)value; + PeriodType = (List?)value!; return this; case "period": - Period = (List)value; + Period = (List?)value!; return this; case "usePeriod": - UsePeriod = (List)value; + UsePeriod = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; case "valuedItem": - ValuedItem = (List)value; + ValuedItem = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2132,21 +2083,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (TypeReference?.Any() == true) yield return new KeyValuePair("typeReference",TypeReference); - if (Subtype?.Any() == true) yield return new KeyValuePair("subtype",Subtype); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Context?.Any() == true) yield return new KeyValuePair("context",Context); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (PeriodType?.Any() == true) yield return new KeyValuePair("periodType",PeriodType); - if (Period?.Any() == true) yield return new KeyValuePair("period",Period); - if (UsePeriod?.Any() == true) yield return new KeyValuePair("usePeriod",UsePeriod); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); - if (ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",ValuedItem); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_TypeReference?.Any() == true) yield return new KeyValuePair("typeReference",_TypeReference); + if (_Subtype?.Any() == true) yield return new KeyValuePair("subtype",_Subtype); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Context?.Any() == true) yield return new KeyValuePair("context",_Context); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_PeriodType?.Any() == true) yield return new KeyValuePair("periodType",_PeriodType); + if (_Period?.Any() == true) yield return new KeyValuePair("period",_Period); + if (_UsePeriod?.Any() == true) yield return new KeyValuePair("usePeriod",_UsePeriod); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); + if (_ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",_ValuedItem); } } @@ -2171,13 +2122,13 @@ public partial class AssetContextComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Codeable asset context. @@ -2188,56 +2139,49 @@ public Hl7.Fhir.Model.ResourceReference Reference [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Context description. /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Context description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssetContextComponent; - - if (dest == null) - { + if(other is not AssetContextComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2249,48 +2193,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssetContextComponent; - if(otherT == null) return false; + if(other is not AssetContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2301,9 +2245,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -2329,54 +2273,51 @@ public partial class ValuedItemComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Entity + public Hl7.Fhir.Model.DataType? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.DataType _Entity; + private Hl7.Fhir.Model.DataType? _Entity; /// /// Contract Valued Item Number. /// [FhirElement("identifier", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Valued Item Effective Tiem. /// [FhirElement("effectiveTime", Order=60, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EffectiveTimeElement + public Hl7.Fhir.Model.FhirDateTime? EffectiveTimeElement { get { return _EffectiveTimeElement; } set { _EffectiveTimeElement = value; OnPropertyChanged("EffectiveTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EffectiveTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _EffectiveTimeElement; /// /// Contract Valued Item Effective Tiem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EffectiveTime + public string? EffectiveTime { - get { return EffectiveTimeElement != null ? EffectiveTimeElement.Value : null; } + get => _EffectiveTimeElement?.Value; set { - if (value == null) - EffectiveTimeElement = null; - else - EffectiveTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + EffectiveTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EffectiveTime"); } } @@ -2386,39 +2327,39 @@ public string EffectiveTime /// [FhirElement("quantity", Order=70, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Contract Valued Item fee, charge, or cost. /// [FhirElement("unitPrice", Order=80, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Contract Valued Item Price Scaling Factor. /// [FhirElement("factor", Order=90, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Contract Valued Item Price Scaling Factor @@ -2427,13 +2368,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2443,13 +2381,13 @@ public decimal? Factor /// [FhirElement("points", Order=100, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PointsElement + public Hl7.Fhir.Model.FhirDecimal? PointsElement { get { return _PointsElement; } set { _PointsElement = value; OnPropertyChanged("PointsElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PointsElement; + private Hl7.Fhir.Model.FhirDecimal? _PointsElement; /// /// Contract Valued Item Difficulty Scaling Factor @@ -2458,13 +2396,10 @@ public Hl7.Fhir.Model.FhirDecimal PointsElement [IgnoreDataMember] public decimal? Points { - get { return PointsElement != null ? PointsElement.Value : null; } + get => _PointsElement?.Value; set { - if (value == null) - PointsElement = null; - else - PointsElement = new Hl7.Fhir.Model.FhirDecimal(value); + PointsElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Points"); } } @@ -2474,41 +2409,38 @@ public decimal? Points /// [FhirElement("net", Order=110, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Terms of valuation. /// [FhirElement("payment", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString PaymentElement + public Hl7.Fhir.Model.FhirString? PaymentElement { get { return _PaymentElement; } set { _PaymentElement = value; OnPropertyChanged("PaymentElement"); } } - private Hl7.Fhir.Model.FhirString _PaymentElement; + private Hl7.Fhir.Model.FhirString? _PaymentElement; /// /// Terms of valuation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Payment + public string? Payment { - get { return PaymentElement != null ? PaymentElement.Value : null; } + get => _PaymentElement?.Value; set { - if (value == null) - PaymentElement = null; - else - PaymentElement = new Hl7.Fhir.Model.FhirString(value); + PaymentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Payment"); } } @@ -2518,28 +2450,25 @@ public string Payment /// [FhirElement("paymentDate", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PaymentDateElement + public Hl7.Fhir.Model.FhirDateTime? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PaymentDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PaymentDateElement; /// /// When payment is due /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PaymentDate"); } } @@ -2551,13 +2480,13 @@ public string PaymentDate [CLSCompliant(false)] [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Who will receive payment. @@ -2566,13 +2495,13 @@ public Hl7.Fhir.Model.ResourceReference Responsible [CLSCompliant(false)] [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Pointer to specific item. @@ -2582,24 +2511,24 @@ public Hl7.Fhir.Model.ResourceReference Recipient [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -2614,24 +2543,24 @@ public IEnumerable LinkId [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Security Labels that define affected terms /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -2640,28 +2569,24 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ValuedItemComponent; - - if (dest == null) - { + if(other is not ValuedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.DataType)Entity.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(EffectiveTimeElement != null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)EffectiveTimeElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(PointsElement != null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)PointsElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(PaymentElement != null) dest.PaymentElement = (Hl7.Fhir.Model.FhirString)PaymentElement.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)PaymentDateElement.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.DataType)_Entity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_EffectiveTimeElement is not null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)_EffectiveTimeElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_PointsElement is not null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)_PointsElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_PaymentElement is not null) dest.PaymentElement = (Hl7.Fhir.Model.FhirString)_PaymentElement.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)_PaymentDateElement.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2673,125 +2598,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValuedItemComponent; - if(otherT == null) return false; + if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(EffectiveTimeElement, otherT.EffectiveTimeElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(PointsElement, otherT.PointsElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.Equals(PaymentElement, otherT.PaymentElement)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_PointsElement, otherT._PointsElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.Equals(_PaymentElement, otherT._PaymentElement)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "effectiveTime": - value = EffectiveTimeElement; - return EffectiveTimeElement is not null; + value = _EffectiveTimeElement; + return _EffectiveTimeElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "points": - value = PointsElement; - return PointsElement is not null; + value = _PointsElement; + return _PointsElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "payment": - value = PaymentElement; - return PaymentElement is not null; + value = _PaymentElement; + return _PaymentElement is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.DataType)value; + Entity = (Hl7.Fhir.Model.DataType?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "effectiveTime": - EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "points": - PointsElement = (Hl7.Fhir.Model.FhirDecimal)value; + PointsElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "payment": - PaymentElement = (Hl7.Fhir.Model.FhirString)value; + PaymentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2802,20 +2727,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",EffectiveTimeElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (PointsElement is not null) yield return new KeyValuePair("points",PointsElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (PaymentElement is not null) yield return new KeyValuePair("payment",PaymentElement); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",_EffectiveTimeElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_PointsElement is not null) yield return new KeyValuePair("points",_PointsElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_PaymentElement is not null) yield return new KeyValuePair("payment",_PaymentElement); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -2843,13 +2768,13 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("doNotPerform", IsModifier=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if the term prohibits the action @@ -2858,13 +2783,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -2876,13 +2798,13 @@ public bool? DoNotPerform [Binding("ContractAction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Entity of the action. @@ -2892,11 +2814,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Purpose for the Contract Term Action. @@ -2905,13 +2827,13 @@ public List Subject [Binding("ContractActionReason")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Intent + public Hl7.Fhir.Model.CodeableConcept? Intent { get { return _Intent; } set { _Intent = value; OnPropertyChanged("Intent"); } } - private Hl7.Fhir.Model.CodeableConcept _Intent; + private Hl7.Fhir.Model.CodeableConcept? _Intent; /// /// Pointer to specific item. @@ -2921,24 +2843,24 @@ public Hl7.Fhir.Model.CodeableConcept Intent [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -2952,13 +2874,13 @@ public IEnumerable LinkId [Binding("ContractActionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Episode associated with action. @@ -2967,13 +2889,13 @@ public Hl7.Fhir.Model.CodeableConcept Status [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Pointer to specific item. @@ -2983,24 +2905,24 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List ContextLinkIdElement { - get { if(_ContextLinkIdElement==null) _ContextLinkIdElement = new List(); return _ContextLinkIdElement; } + get => _ContextLinkIdElement ?? new List(); set { _ContextLinkIdElement = value; OnPropertyChanged("ContextLinkIdElement"); } } - private List _ContextLinkIdElement; + private List? _ContextLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ContextLinkId + public IEnumerable? ContextLinkId { - get { return ContextLinkIdElement != null ? ContextLinkIdElement.Select(elem => elem.Value) : null; } + get => _ContextLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ContextLinkIdElement = null; + ContextLinkIdElement = null!; else ContextLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ContextLinkId"); @@ -3014,13 +2936,13 @@ public IEnumerable ContextLinkId [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Who asked for action. @@ -3032,11 +2954,11 @@ public Hl7.Fhir.Model.DataType Occurrence [DataMember] public List Requester { - get { if(_Requester==null) _Requester = new List(); return _Requester; } + get => _Requester ?? new List(); set { _Requester = value; OnPropertyChanged("Requester"); } } - private List _Requester; + private List? _Requester; /// /// Pointer to specific item. @@ -3046,24 +2968,24 @@ public List Requester [DataMember] public List RequesterLinkIdElement { - get { if(_RequesterLinkIdElement==null) _RequesterLinkIdElement = new List(); return _RequesterLinkIdElement; } + get => _RequesterLinkIdElement ?? new List(); set { _RequesterLinkIdElement = value; OnPropertyChanged("RequesterLinkIdElement"); } } - private List _RequesterLinkIdElement; + private List? _RequesterLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable RequesterLinkId + public IEnumerable? RequesterLinkId { - get { return RequesterLinkIdElement != null ? RequesterLinkIdElement.Select(elem => elem.Value) : null; } + get => _RequesterLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - RequesterLinkIdElement = null; + RequesterLinkIdElement = null!; else RequesterLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("RequesterLinkId"); @@ -3079,11 +3001,11 @@ public IEnumerable RequesterLinkId [DataMember] public List PerformerType { - get { if(_PerformerType==null) _PerformerType = new List(); return _PerformerType; } + get => _PerformerType ?? new List(); set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private List _PerformerType; + private List? _PerformerType; /// /// Competency of the performer. @@ -3091,13 +3013,13 @@ public List PerformerType [FhirElement("performerRole", Order=160)] [Binding("ContractActionPerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerRole + public Hl7.Fhir.Model.CodeableConcept? PerformerRole { get { return _PerformerRole; } set { _PerformerRole = value; OnPropertyChanged("PerformerRole"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerRole; + private Hl7.Fhir.Model.CodeableConcept? _PerformerRole; /// /// Actor that wil execute (or not) the action. @@ -3106,13 +3028,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerRole [CLSCompliant(false)] [References("RelatedPerson","Patient","Practitioner","PractitionerRole","CareTeam","Device","Substance","Organization","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Pointer to specific item. @@ -3122,24 +3044,24 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List PerformerLinkIdElement { - get { if(_PerformerLinkIdElement==null) _PerformerLinkIdElement = new List(); return _PerformerLinkIdElement; } + get => _PerformerLinkIdElement ?? new List(); set { _PerformerLinkIdElement = value; OnPropertyChanged("PerformerLinkIdElement"); } } - private List _PerformerLinkIdElement; + private List? _PerformerLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PerformerLinkId + public IEnumerable? PerformerLinkId { - get { return PerformerLinkIdElement != null ? PerformerLinkIdElement.Select(elem => elem.Value) : null; } + get => _PerformerLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - PerformerLinkIdElement = null; + PerformerLinkIdElement = null!; else PerformerLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PerformerLinkId"); @@ -3155,11 +3077,11 @@ public IEnumerable PerformerLinkId [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why is action (not) needed?. @@ -3171,11 +3093,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Why action is to be performed. @@ -3185,24 +3107,24 @@ public List ReasonReference [DataMember] public List ReasonElement { - get { if(_ReasonElement==null) _ReasonElement = new List(); return _ReasonElement; } + get => _ReasonElement ?? new List(); set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private List _ReasonElement; + private List? _ReasonElement; /// /// Why action is to be performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Reason + public IEnumerable? Reason { - get { return ReasonElement != null ? ReasonElement.Select(elem => elem.Value) : null; } + get => _ReasonElement?.Select(elem => elem.Value); set { if (value == null) - ReasonElement = null; + ReasonElement = null!; else ReasonElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Reason"); @@ -3217,24 +3139,24 @@ public IEnumerable Reason [DataMember] public List ReasonLinkIdElement { - get { if(_ReasonLinkIdElement==null) _ReasonLinkIdElement = new List(); return _ReasonLinkIdElement; } + get => _ReasonLinkIdElement ?? new List(); set { _ReasonLinkIdElement = value; OnPropertyChanged("ReasonLinkIdElement"); } } - private List _ReasonLinkIdElement; + private List? _ReasonLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ReasonLinkId + public IEnumerable? ReasonLinkId { - get { return ReasonLinkIdElement != null ? ReasonLinkIdElement.Select(elem => elem.Value) : null; } + get => _ReasonLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ReasonLinkIdElement = null; + ReasonLinkIdElement = null!; else ReasonLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ReasonLinkId"); @@ -3249,11 +3171,11 @@ public IEnumerable ReasonLinkId [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Action restriction numbers. @@ -3263,24 +3185,24 @@ public List Note [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Action restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -3289,35 +3211,31 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Intent != null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)Intent.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(ContextLinkIdElement.Any()) dest.ContextLinkIdElement = new List(ContextLinkIdElement.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Requester.Any()) dest.Requester = new List(Requester.DeepCopyInternal()); - if(RequesterLinkIdElement.Any()) dest.RequesterLinkIdElement = new List(RequesterLinkIdElement.DeepCopyInternal()); - if(PerformerType.Any()) dest.PerformerType = new List(PerformerType.DeepCopyInternal()); - if(PerformerRole != null) dest.PerformerRole = (Hl7.Fhir.Model.CodeableConcept)PerformerRole.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(PerformerLinkIdElement.Any()) dest.PerformerLinkIdElement = new List(PerformerLinkIdElement.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(ReasonElement.Any()) dest.ReasonElement = new List(ReasonElement.DeepCopyInternal()); - if(ReasonLinkIdElement.Any()) dest.ReasonLinkIdElement = new List(ReasonLinkIdElement.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Intent is not null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)_Intent.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_ContextLinkIdElement is not null) dest.ContextLinkIdElement = new List(_ContextLinkIdElement.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = new List(_Requester.DeepCopyInternal()); + if(_RequesterLinkIdElement is not null) dest.RequesterLinkIdElement = new List(_RequesterLinkIdElement.DeepCopyInternal()); + if(_PerformerType is not null) dest.PerformerType = new List(_PerformerType.DeepCopyInternal()); + if(_PerformerRole is not null) dest.PerformerRole = (Hl7.Fhir.Model.CodeableConcept)_PerformerRole.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_PerformerLinkIdElement is not null) dest.PerformerLinkIdElement = new List(_PerformerLinkIdElement.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_ReasonElement is not null) dest.ReasonElement = new List(_ReasonElement.DeepCopyInternal()); + if(_ReasonLinkIdElement is not null) dest.ReasonLinkIdElement = new List(_ReasonLinkIdElement.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3329,174 +3247,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Intent, otherT.Intent)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(ContextLinkIdElement, otherT.ContextLinkIdElement)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.ListEquals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(RequesterLinkIdElement, otherT.RequesterLinkIdElement)) return false; - if(!comparer.ListEquals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(PerformerRole, otherT.PerformerRole)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(PerformerLinkIdElement, otherT.PerformerLinkIdElement)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(ReasonElement, otherT.ReasonElement)) return false; - if(!comparer.ListEquals(ReasonLinkIdElement, otherT.ReasonLinkIdElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Intent, otherT._Intent)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_ContextLinkIdElement, otherT._ContextLinkIdElement)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.ListEquals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_RequesterLinkIdElement, otherT._RequesterLinkIdElement)) return false; + if(!comparer.ListEquals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_PerformerRole, otherT._PerformerRole)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_PerformerLinkIdElement, otherT._PerformerLinkIdElement)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_ReasonElement, otherT._ReasonElement)) return false; + if(!comparer.ListEquals(_ReasonLinkIdElement, otherT._ReasonLinkIdElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "intent": - value = Intent; - return Intent is not null; + value = _Intent; + return _Intent is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "contextLinkId": - value = ContextLinkIdElement; - return ContextLinkIdElement?.Any() == true; + value = _ContextLinkIdElement; + return _ContextLinkIdElement?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "requester": - value = Requester; - return Requester?.Any() == true; + value = _Requester; + return _Requester?.Any() == true; case "requesterLinkId": - value = RequesterLinkIdElement; - return RequesterLinkIdElement?.Any() == true; + value = _RequesterLinkIdElement; + return _RequesterLinkIdElement?.Any() == true; case "performerType": - value = PerformerType; - return PerformerType?.Any() == true; + value = _PerformerType; + return _PerformerType?.Any() == true; case "performerRole": - value = PerformerRole; - return PerformerRole is not null; + value = _PerformerRole; + return _PerformerRole is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "performerLinkId": - value = PerformerLinkIdElement; - return PerformerLinkIdElement?.Any() == true; + value = _PerformerLinkIdElement; + return _PerformerLinkIdElement?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "reason": - value = ReasonElement; - return ReasonElement?.Any() == true; + value = _ReasonElement; + return _ReasonElement?.Any() == true; case "reasonLinkId": - value = ReasonLinkIdElement; - return ReasonLinkIdElement?.Any() == true; + value = _ReasonLinkIdElement; + return _ReasonLinkIdElement?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "intent": - Intent = (Hl7.Fhir.Model.CodeableConcept)value; + Intent = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contextLinkId": - ContextLinkIdElement = (List)value; + ContextLinkIdElement = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "requester": - Requester = (List)value; + Requester = (List?)value!; return this; case "requesterLinkId": - RequesterLinkIdElement = (List)value; + RequesterLinkIdElement = (List?)value!; return this; case "performerType": - PerformerType = (List)value; + PerformerType = (List?)value!; return this; case "performerRole": - PerformerRole = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerRole = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerLinkId": - PerformerLinkIdElement = (List)value; + PerformerLinkIdElement = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "reason": - ReasonElement = (List)value; + ReasonElement = (List?)value!; return this; case "reasonLinkId": - ReasonLinkIdElement = (List)value; + ReasonLinkIdElement = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3507,27 +3425,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Intent is not null) yield return new KeyValuePair("intent",Intent); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (ContextLinkIdElement?.Any() == true) yield return new KeyValuePair("contextLinkId",ContextLinkIdElement); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Requester?.Any() == true) yield return new KeyValuePair("requester",Requester); - if (RequesterLinkIdElement?.Any() == true) yield return new KeyValuePair("requesterLinkId",RequesterLinkIdElement); - if (PerformerType?.Any() == true) yield return new KeyValuePair("performerType",PerformerType); - if (PerformerRole is not null) yield return new KeyValuePair("performerRole",PerformerRole); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (PerformerLinkIdElement?.Any() == true) yield return new KeyValuePair("performerLinkId",PerformerLinkIdElement); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (ReasonElement?.Any() == true) yield return new KeyValuePair("reason",ReasonElement); - if (ReasonLinkIdElement?.Any() == true) yield return new KeyValuePair("reasonLinkId",ReasonLinkIdElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Intent is not null) yield return new KeyValuePair("intent",_Intent); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_ContextLinkIdElement?.Any() == true) yield return new KeyValuePair("contextLinkId",_ContextLinkIdElement); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Requester?.Any() == true) yield return new KeyValuePair("requester",_Requester); + if (_RequesterLinkIdElement?.Any() == true) yield return new KeyValuePair("requesterLinkId",_RequesterLinkIdElement); + if (_PerformerType?.Any() == true) yield return new KeyValuePair("performerType",_PerformerType); + if (_PerformerRole is not null) yield return new KeyValuePair("performerRole",_PerformerRole); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_PerformerLinkIdElement?.Any() == true) yield return new KeyValuePair("performerLinkId",_PerformerLinkIdElement); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_ReasonElement?.Any() == true) yield return new KeyValuePair("reason",_ReasonElement); + if (_ReasonLinkIdElement?.Any() == true) yield return new KeyValuePair("reasonLinkId",_ReasonLinkIdElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -3555,11 +3473,11 @@ public partial class ActionSubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; /// /// Role type of the agent. @@ -3567,26 +3485,22 @@ public List Reference [FhirElement("role", Order=50)] [Binding("ContractActorRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionSubjectComponent; - - if (dest == null) - { + if(other is not ActionSubjectComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3598,41 +3512,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionSubjectComponent; - if(otherT == null) return false; + if(other is not ActionSubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -3643,8 +3557,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -3674,13 +3588,13 @@ public partial class SignatoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("ContractSignerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Contract Signatory Party. @@ -3690,13 +3604,13 @@ public Hl7.Fhir.Model.Coding Type [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Contract Documentation Signature. @@ -3706,25 +3620,21 @@ public Hl7.Fhir.Model.ResourceReference Party [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as SignatoryComponent; - - if (dest == null) - { + if(other is not SignatoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3736,48 +3646,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SignatoryComponent; - if(otherT == null) return false; + if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3788,9 +3698,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } @@ -3820,25 +3730,21 @@ public partial class FriendlyLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as FriendlyLanguageComponent; - - if (dest == null) - { + if(other is not FriendlyLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3850,34 +3756,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FriendlyLanguageComponent; - if(otherT == null) return false; + if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -3888,7 +3794,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -3918,25 +3824,21 @@ public partial class LegalLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as LegalLanguageComponent; - - if (dest == null) - { + if(other is not LegalLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3948,34 +3850,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LegalLanguageComponent; - if(otherT == null) return false; + if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -3986,7 +3888,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -4016,25 +3918,21 @@ public partial class ComputableLanguageComponent : Hl7.Fhir.Model.BackboneElemen [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as ComputableLanguageComponent; - - if (dest == null) - { + if(other is not ComputableLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4046,34 +3944,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComputableLanguageComponent; - if(otherT == null) return false; + if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -4084,7 +3982,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -4097,39 +3995,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Basal definition. /// [FhirElement("url", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Basal definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4139,28 +4034,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business edition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4172,13 +4064,13 @@ public string Version [DeclaredType(Type = typeof(Code))] [Binding("ContractStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated @@ -4187,13 +4079,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4204,13 +4093,13 @@ public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status [FhirElement("legalState", Order=130)] [Binding("ContractLegalState")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalState + public Hl7.Fhir.Model.CodeableConcept? LegalState { get { return _LegalState; } set { _LegalState = value; OnPropertyChanged("LegalState"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalState; + private Hl7.Fhir.Model.CodeableConcept? _LegalState; /// /// Source Contract Definition. @@ -4219,41 +4108,38 @@ public Hl7.Fhir.Model.CodeableConcept LegalState [CLSCompliant(false)] [References("Contract")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InstantiatesCanonical + public Hl7.Fhir.Model.ResourceReference? InstantiatesCanonical { get { return _InstantiatesCanonical; } set { _InstantiatesCanonical = value; OnPropertyChanged("InstantiatesCanonical"); } } - private Hl7.Fhir.Model.ResourceReference _InstantiatesCanonical; + private Hl7.Fhir.Model.ResourceReference? _InstantiatesCanonical; /// /// External Contract Definition. /// [FhirElement("instantiatesUri", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// External Contract Definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -4264,41 +4150,38 @@ public string InstantiatesUri [FhirElement("contentDerivative", Order=160, FiveWs="FiveWs.what[x]")] [Binding("ContractContentDerivative")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ContentDerivative + public Hl7.Fhir.Model.CodeableConcept? ContentDerivative { get { return _ContentDerivative; } set { _ContentDerivative = value; OnPropertyChanged("ContentDerivative"); } } - private Hl7.Fhir.Model.CodeableConcept _ContentDerivative; + private Hl7.Fhir.Model.CodeableConcept? _ContentDerivative; /// /// When this Contract was issued. /// [FhirElement("issued", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When this Contract was issued /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -4308,13 +4191,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Contract cessation cause. @@ -4322,13 +4205,13 @@ public Hl7.Fhir.Model.Period Applies [FhirElement("expirationType", Order=190)] [Binding("ContractExpiration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ExpirationType + public Hl7.Fhir.Model.CodeableConcept? ExpirationType { get { return _ExpirationType; } set { _ExpirationType = value; OnPropertyChanged("ExpirationType"); } } - private Hl7.Fhir.Model.CodeableConcept _ExpirationType; + private Hl7.Fhir.Model.CodeableConcept? _ExpirationType; /// /// Contract Target Entity. @@ -4340,11 +4223,11 @@ public Hl7.Fhir.Model.CodeableConcept ExpirationType [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Authority under which this Contract has standing. @@ -4356,11 +4239,11 @@ public List Subject [DataMember] public List Authority { - get { if(_Authority==null) _Authority = new List(); return _Authority; } + get => _Authority ?? new List(); set { _Authority = value; OnPropertyChanged("Authority"); } } - private List _Authority; + private List? _Authority; /// /// A sphere of control governed by an authoritative jurisdiction, organization, or person. @@ -4372,11 +4255,11 @@ public List Authority [DataMember] public List Domain { - get { if(_Domain==null) _Domain = new List(); return _Domain; } + get => _Domain ?? new List(); set { _Domain = value; OnPropertyChanged("Domain"); } } - private List _Domain; + private List? _Domain; /// /// Specific Location. @@ -4388,39 +4271,36 @@ public List Domain [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Computer friendly designation. /// [FhirElement("name", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Computer friendly designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4430,28 +4310,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human Friendly name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4461,28 +4338,25 @@ public string Title /// [FhirElement("subtitle", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate Friendly name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -4495,24 +4369,24 @@ public string Subtitle [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Acronym or short name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -4526,13 +4400,13 @@ public IEnumerable Alias [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Range of Legal Concerns. @@ -4540,13 +4414,13 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("scope", Order=290)] [Binding("ContractScope")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Focus of contract interest. @@ -4556,13 +4430,13 @@ public Hl7.Fhir.Model.CodeableConcept Scope [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Topic + public Hl7.Fhir.Model.DataType? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.DataType _Topic; + private Hl7.Fhir.Model.DataType? _Topic; /// /// Legal instrument category. @@ -4570,13 +4444,13 @@ public Hl7.Fhir.Model.DataType Topic [FhirElement("type", InSummary=true, Order=310, FiveWs="FiveWs.what[x]")] [Binding("ContractType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Subtype within the context of type. @@ -4587,24 +4461,24 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List SubType { - get { if(_SubType==null) _SubType = new List(); return _SubType; } + get => _SubType ?? new List(); set { _SubType = value; OnPropertyChanged("SubType"); } } - private List _SubType; + private List? _SubType; /// /// Contract precursor content. /// [FhirElement("contentDefinition", Order=330)] [DataMember] - public Hl7.Fhir.Model.Contract.ContentDefinitionComponent ContentDefinition + public Hl7.Fhir.Model.Contract.ContentDefinitionComponent? ContentDefinition { get { return _ContentDefinition; } set { _ContentDefinition = value; OnPropertyChanged("ContentDefinition"); } } - private Hl7.Fhir.Model.Contract.ContentDefinitionComponent _ContentDefinition; + private Hl7.Fhir.Model.Contract.ContentDefinitionComponent? _ContentDefinition; /// /// Contract Term List. @@ -4614,11 +4488,11 @@ public Hl7.Fhir.Model.Contract.ContentDefinitionComponent ContentDefinition [DataMember] public List Term { - get { if(_Term==null) _Term = new List(); return _Term; } + get => _Term ?? new List(); set { _Term = value; OnPropertyChanged("Term"); } } - private List _Term; + private List? _Term; /// /// Extra Information. @@ -4630,11 +4504,11 @@ public List Term [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Key event in Contract History. @@ -4646,11 +4520,11 @@ public List SupportingInfo [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Contract Signatory. @@ -4660,11 +4534,11 @@ public List RelevantHistory [DataMember] public List Signer { - get { if(_Signer==null) _Signer = new List(); return _Signer; } + get => _Signer ?? new List(); set { _Signer = value; OnPropertyChanged("Signer"); } } - private List _Signer; + private List? _Signer; /// /// Contract Friendly Language. @@ -4674,11 +4548,11 @@ public List Signer [DataMember] public List Friendly { - get { if(_Friendly==null) _Friendly = new List(); return _Friendly; } + get => _Friendly ?? new List(); set { _Friendly = value; OnPropertyChanged("Friendly"); } } - private List _Friendly; + private List? _Friendly; /// /// Contract Legal Language. @@ -4688,11 +4562,11 @@ public List Friendly [DataMember] public List Legal { - get { if(_Legal==null) _Legal = new List(); return _Legal; } + get => _Legal ?? new List(); set { _Legal = value; OnPropertyChanged("Legal"); } } - private List _Legal; + private List? _Legal; /// /// Computable Contract Language. @@ -4702,11 +4576,11 @@ public List Legal [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Binding Contract. @@ -4716,59 +4590,55 @@ public List Rule [References("Composition","DocumentReference","QuestionnaireResponse","Contract")] [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType LegallyBinding + public Hl7.Fhir.Model.DataType? LegallyBinding { get { return _LegallyBinding; } set { _LegallyBinding = value; OnPropertyChanged("LegallyBinding"); } } - private Hl7.Fhir.Model.DataType _LegallyBinding; + private Hl7.Fhir.Model.DataType? _LegallyBinding; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Contract; - - if (dest == null) - { + if(other is not Contract dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(LegalState != null) dest.LegalState = (Hl7.Fhir.Model.CodeableConcept)LegalState.DeepCopyInternal(); - if(InstantiatesCanonical != null) dest.InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)InstantiatesCanonical.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(ContentDerivative != null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)ContentDerivative.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(ExpirationType != null) dest.ExpirationType = (Hl7.Fhir.Model.CodeableConcept)ExpirationType.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Authority.Any()) dest.Authority = new List(Authority.DeepCopyInternal()); - if(Domain.Any()) dest.Domain = new List(Domain.DeepCopyInternal()); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.DataType)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType.Any()) dest.SubType = new List(SubType.DeepCopyInternal()); - if(ContentDefinition != null) dest.ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)ContentDefinition.DeepCopyInternal(); - if(Term.Any()) dest.Term = new List(Term.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Signer.Any()) dest.Signer = new List(Signer.DeepCopyInternal()); - if(Friendly.Any()) dest.Friendly = new List(Friendly.DeepCopyInternal()); - if(Legal.Any()) dest.Legal = new List(Legal.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(LegallyBinding != null) dest.LegallyBinding = (Hl7.Fhir.Model.DataType)LegallyBinding.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_LegalState is not null) dest.LegalState = (Hl7.Fhir.Model.CodeableConcept)_LegalState.DeepCopyInternal(); + if(_InstantiatesCanonical is not null) dest.InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)_InstantiatesCanonical.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_ContentDerivative is not null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)_ContentDerivative.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_ExpirationType is not null) dest.ExpirationType = (Hl7.Fhir.Model.CodeableConcept)_ExpirationType.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Authority is not null) dest.Authority = new List(_Authority.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = new List(_Domain.DeepCopyInternal()); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.DataType)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = new List(_SubType.DeepCopyInternal()); + if(_ContentDefinition is not null) dest.ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)_ContentDefinition.DeepCopyInternal(); + if(_Term is not null) dest.Term = new List(_Term.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Signer is not null) dest.Signer = new List(_Signer.DeepCopyInternal()); + if(_Friendly is not null) dest.Friendly = new List(_Friendly.DeepCopyInternal()); + if(_Legal is not null) dest.Legal = new List(_Legal.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_LegallyBinding is not null) dest.LegallyBinding = (Hl7.Fhir.Model.DataType)_LegallyBinding.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4780,258 +4650,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contract; - if(otherT == null) return false; + if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(LegalState, otherT.LegalState)) return false; - if(!comparer.Equals(InstantiatesCanonical, otherT.InstantiatesCanonical)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(ContentDerivative, otherT.ContentDerivative)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.Equals(ExpirationType, otherT.ExpirationType)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(ContentDefinition, otherT.ContentDefinition)) return false; - if(!comparer.ListEquals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.ListEquals(Signer, otherT.Signer)) return false; - if(!comparer.ListEquals(Friendly, otherT.Friendly)) return false; - if(!comparer.ListEquals(Legal, otherT.Legal)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.Equals(LegallyBinding, otherT.LegallyBinding)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_LegalState, otherT._LegalState)) return false; + if(!comparer.Equals(_InstantiatesCanonical, otherT._InstantiatesCanonical)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_ContentDerivative, otherT._ContentDerivative)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.Equals(_ExpirationType, otherT._ExpirationType)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_ContentDefinition, otherT._ContentDefinition)) return false; + if(!comparer.ListEquals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.ListEquals(_Signer, otherT._Signer)) return false; + if(!comparer.ListEquals(_Friendly, otherT._Friendly)) return false; + if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.Equals(_LegallyBinding, otherT._LegallyBinding)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "legalState": - value = LegalState; - return LegalState is not null; + value = _LegalState; + return _LegalState is not null; case "instantiatesCanonical": - value = InstantiatesCanonical; - return InstantiatesCanonical is not null; + value = _InstantiatesCanonical; + return _InstantiatesCanonical is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "contentDerivative": - value = ContentDerivative; - return ContentDerivative is not null; + value = _ContentDerivative; + return _ContentDerivative is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "expirationType": - value = ExpirationType; - return ExpirationType is not null; + value = _ExpirationType; + return _ExpirationType is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "authority": - value = Authority; - return Authority?.Any() == true; + value = _Authority; + return _Authority?.Any() == true; case "domain": - value = Domain; - return Domain?.Any() == true; + value = _Domain; + return _Domain?.Any() == true; case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType?.Any() == true; + value = _SubType; + return _SubType?.Any() == true; case "contentDefinition": - value = ContentDefinition; - return ContentDefinition is not null; + value = _ContentDefinition; + return _ContentDefinition is not null; case "term": - value = Term; - return Term?.Any() == true; + value = _Term; + return _Term?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "signer": - value = Signer; - return Signer?.Any() == true; + value = _Signer; + return _Signer?.Any() == true; case "friendly": - value = Friendly; - return Friendly?.Any() == true; + value = _Friendly; + return _Friendly?.Any() == true; case "legal": - value = Legal; - return Legal?.Any() == true; + value = _Legal; + return _Legal?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "legallyBinding": - value = LegallyBinding; - return LegallyBinding is not null; + value = _LegallyBinding; + return _LegallyBinding is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "legalState": - LegalState = (Hl7.Fhir.Model.CodeableConcept)value; + LegalState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "instantiatesCanonical": - InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)value; + InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "contentDerivative": - ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)value; + ContentDerivative = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "expirationType": - ExpirationType = (Hl7.Fhir.Model.CodeableConcept)value; + ExpirationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "authority": - Authority = (List)value; + Authority = (List?)value!; return this; case "domain": - Domain = (List)value; + Domain = (List?)value!; return this; case "site": - Site = (List)value; + Site = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.DataType)value; + Topic = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (List)value; + SubType = (List?)value!; return this; case "contentDefinition": - ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)value; + ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent?)value; return this; case "term": - Term = (List)value; + Term = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "signer": - Signer = (List)value; + Signer = (List?)value!; return this; case "friendly": - Friendly = (List)value; + Friendly = (List?)value!; return this; case "legal": - Legal = (List)value; + Legal = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "legallyBinding": - LegallyBinding = (Hl7.Fhir.Model.DataType)value; + LegallyBinding = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -5042,39 +4912,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (LegalState is not null) yield return new KeyValuePair("legalState",LegalState); - if (InstantiatesCanonical is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonical); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",ContentDerivative); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (ExpirationType is not null) yield return new KeyValuePair("expirationType",ExpirationType); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Authority?.Any() == true) yield return new KeyValuePair("authority",Authority); - if (Domain?.Any() == true) yield return new KeyValuePair("domain",Domain); - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType?.Any() == true) yield return new KeyValuePair("subType",SubType); - if (ContentDefinition is not null) yield return new KeyValuePair("contentDefinition",ContentDefinition); - if (Term?.Any() == true) yield return new KeyValuePair("term",Term); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Signer?.Any() == true) yield return new KeyValuePair("signer",Signer); - if (Friendly?.Any() == true) yield return new KeyValuePair("friendly",Friendly); - if (Legal?.Any() == true) yield return new KeyValuePair("legal",Legal); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (LegallyBinding is not null) yield return new KeyValuePair("legallyBinding",LegallyBinding); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_LegalState is not null) yield return new KeyValuePair("legalState",_LegalState); + if (_InstantiatesCanonical is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonical); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",_ContentDerivative); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_ExpirationType is not null) yield return new KeyValuePair("expirationType",_ExpirationType); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Authority?.Any() == true) yield return new KeyValuePair("authority",_Authority); + if (_Domain?.Any() == true) yield return new KeyValuePair("domain",_Domain); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType?.Any() == true) yield return new KeyValuePair("subType",_SubType); + if (_ContentDefinition is not null) yield return new KeyValuePair("contentDefinition",_ContentDefinition); + if (_Term?.Any() == true) yield return new KeyValuePair("term",_Term); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Signer?.Any() == true) yield return new KeyValuePair("signer",_Signer); + if (_Friendly?.Any() == true) yield return new KeyValuePair("friendly",_Friendly); + if (_Legal?.Any() == true) yield return new KeyValuePair("legal",_Legal); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_LegallyBinding is not null) yield return new KeyValuePair("legallyBinding",_LegallyBinding); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs index a80245766..da0d42273 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -101,13 +104,13 @@ public enum ContributorType [Binding("ContributorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// author | editor | reviewer | endorser @@ -116,13 +119,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Contributor.ContributorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -133,28 +133,25 @@ public Hl7.Fhir.Model.Contributor.ContributorType? Type [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Who contributed the content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -167,25 +164,21 @@ public string Name [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; protected internal override void CopyToInternal(Base other) { - var dest = other as Contributor; - - if (dest == null) - { + if(other is not Contributor dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -197,48 +190,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contributor; - if(otherT == null) return false; + if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; default: return base.SetValue(key, value); @@ -249,9 +242,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Count.cs b/src/Hl7.Fhir.R4B/Model/Generated/Count.cs index 7e8f72eb1..286a52c20 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Count.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Count.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs index 9f712bf83..0e7ddb421 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class ClassComponent : Hl7.Fhir.Model.BackboneElement [Binding("CoverageClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Value associated with the type. @@ -98,28 +101,25 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("value", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value associated with the type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -129,45 +129,38 @@ public string Value /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human readable description of the type and value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ClassComponent; - - if (dest == null) - { + if(other is not ClassComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,48 +172,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassComponent; - if(otherT == null) return false; + if(other is not ClassComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -231,9 +224,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); } } @@ -261,13 +254,13 @@ public partial class CostToBeneficiaryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("CopayTypes")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The amount or percentage due from the beneficiary. @@ -277,13 +270,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Money))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Exceptions for patient payments. @@ -293,25 +286,21 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Exception { - get { if(_Exception==null) _Exception = new List(); return _Exception; } + get => _Exception ?? new List(); set { _Exception = value; OnPropertyChanged("Exception"); } } - private List _Exception; + private List? _Exception; protected internal override void CopyToInternal(Base other) { - var dest = other as CostToBeneficiaryComponent; - - if (dest == null) - { + if(other is not CostToBeneficiaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Exception.Any()) dest.Exception = new List(Exception.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Exception is not null) dest.Exception = new List(_Exception.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -323,48 +312,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostToBeneficiaryComponent; - if(otherT == null) return false; + if(other is not CostToBeneficiaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Exception, otherT.Exception)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Exception, otherT._Exception)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exception": - value = Exception; - return Exception?.Any() == true; + value = _Exception; + return _Exception?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exception": - Exception = (List)value; + Exception = (List?)value!; return this; default: return base.SetValue(key, value); @@ -375,9 +364,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Exception?.Any() == true) yield return new KeyValuePair("exception",Exception); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Exception?.Any() == true) yield return new KeyValuePair("exception",_Exception); } } @@ -405,39 +394,35 @@ public partial class ExemptionComponent : Hl7.Fhir.Model.BackboneElement [Binding("CoverageFinancialException")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The effective period of the exception. /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ExemptionComponent; - - if (dest == null) - { + if(other is not ExemptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -449,41 +434,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExemptionComponent; - if(otherT == null) return false; + if(other is not ExemptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -494,8 +479,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -508,11 +493,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -522,13 +507,13 @@ public List Identifier [Binding("CoverageStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -537,13 +522,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -554,13 +536,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("type", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("CoverageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Owner of the policy. @@ -569,13 +551,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PolicyHolder + public Hl7.Fhir.Model.ResourceReference? PolicyHolder { get { return _PolicyHolder; } set { _PolicyHolder = value; OnPropertyChanged("PolicyHolder"); } } - private Hl7.Fhir.Model.ResourceReference _PolicyHolder; + private Hl7.Fhir.Model.ResourceReference? _PolicyHolder; /// /// Subscriber to the policy. @@ -584,41 +566,38 @@ public Hl7.Fhir.Model.ResourceReference PolicyHolder [CLSCompliant(false)] [References("Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subscriber + public Hl7.Fhir.Model.ResourceReference? Subscriber { get { return _Subscriber; } set { _Subscriber = value; OnPropertyChanged("Subscriber"); } } - private Hl7.Fhir.Model.ResourceReference _Subscriber; + private Hl7.Fhir.Model.ResourceReference? _Subscriber; /// /// ID assigned to the subscriber. /// [FhirElement("subscriberId", InSummary=true, Order=140, FiveWs="FiveWs.subject")] [DataMember] - public Hl7.Fhir.Model.FhirString SubscriberIdElement + public Hl7.Fhir.Model.FhirString? SubscriberIdElement { get { return _SubscriberIdElement; } set { _SubscriberIdElement = value; OnPropertyChanged("SubscriberIdElement"); } } - private Hl7.Fhir.Model.FhirString _SubscriberIdElement; + private Hl7.Fhir.Model.FhirString? _SubscriberIdElement; /// /// ID assigned to the subscriber /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubscriberId + public string? SubscriberId { - get { return SubscriberIdElement != null ? SubscriberIdElement.Value : null; } + get => _SubscriberIdElement?.Value; set { - if (value == null) - SubscriberIdElement = null; - else - SubscriberIdElement = new Hl7.Fhir.Model.FhirString(value); + SubscriberIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SubscriberId"); } } @@ -631,41 +610,38 @@ public string SubscriberId [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Beneficiary + public Hl7.Fhir.Model.ResourceReference? Beneficiary { get { return _Beneficiary; } set { _Beneficiary = value; OnPropertyChanged("Beneficiary"); } } - private Hl7.Fhir.Model.ResourceReference _Beneficiary; + private Hl7.Fhir.Model.ResourceReference? _Beneficiary; /// /// Dependent number. /// [FhirElement("dependent", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString DependentElement + public Hl7.Fhir.Model.FhirString? DependentElement { get { return _DependentElement; } set { _DependentElement = value; OnPropertyChanged("DependentElement"); } } - private Hl7.Fhir.Model.FhirString _DependentElement; + private Hl7.Fhir.Model.FhirString? _DependentElement; /// /// Dependent number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Dependent + public string? Dependent { - get { return DependentElement != null ? DependentElement.Value : null; } + get => _DependentElement?.Value; set { - if (value == null) - DependentElement = null; - else - DependentElement = new Hl7.Fhir.Model.FhirString(value); + DependentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Dependent"); } } @@ -676,26 +652,26 @@ public string Dependent [FhirElement("relationship", Order=170)] [Binding("Relationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// Coverage start and end dates. /// [FhirElement("period", InSummary=true, Order=180, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Issuer of the policy. @@ -707,11 +683,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Payor { - get { if(_Payor==null) _Payor = new List(); return _Payor; } + get => _Payor ?? new List(); set { _Payor = value; OnPropertyChanged("Payor"); } } - private List _Payor; + private List? _Payor; /// /// Additional coverage classifications. @@ -721,24 +697,24 @@ public List Payor [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// Relative order of the coverage. /// [FhirElement("order", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.PositiveInt OrderElement + public Hl7.Fhir.Model.PositiveInt? OrderElement { get { return _OrderElement; } set { _OrderElement = value; OnPropertyChanged("OrderElement"); } } - private Hl7.Fhir.Model.PositiveInt _OrderElement; + private Hl7.Fhir.Model.PositiveInt? _OrderElement; /// /// Relative order of the coverage @@ -747,13 +723,10 @@ public Hl7.Fhir.Model.PositiveInt OrderElement [IgnoreDataMember] public int? Order { - get { return OrderElement != null ? OrderElement.Value : null; } + get => _OrderElement?.Value; set { - if (value == null) - OrderElement = null; - else - OrderElement = new Hl7.Fhir.Model.PositiveInt(value); + OrderElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Order"); } } @@ -763,28 +736,25 @@ public int? Order /// [FhirElement("network", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString NetworkElement + public Hl7.Fhir.Model.FhirString? NetworkElement { get { return _NetworkElement; } set { _NetworkElement = value; OnPropertyChanged("NetworkElement"); } } - private Hl7.Fhir.Model.FhirString _NetworkElement; + private Hl7.Fhir.Model.FhirString? _NetworkElement; /// /// Insurer network /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Network + public string? Network { - get { return NetworkElement != null ? NetworkElement.Value : null; } + get => _NetworkElement?.Value; set { - if (value == null) - NetworkElement = null; - else - NetworkElement = new Hl7.Fhir.Model.FhirString(value); + NetworkElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Network"); } } @@ -797,24 +767,24 @@ public string Network [DataMember] public List CostToBeneficiary { - get { if(_CostToBeneficiary==null) _CostToBeneficiary = new List(); return _CostToBeneficiary; } + get => _CostToBeneficiary ?? new List(); set { _CostToBeneficiary = value; OnPropertyChanged("CostToBeneficiary"); } } - private List _CostToBeneficiary; + private List? _CostToBeneficiary; /// /// Reimbursement to insurer. /// [FhirElement("subrogation", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SubrogationElement + public Hl7.Fhir.Model.FhirBoolean? SubrogationElement { get { return _SubrogationElement; } set { _SubrogationElement = value; OnPropertyChanged("SubrogationElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SubrogationElement; + private Hl7.Fhir.Model.FhirBoolean? _SubrogationElement; /// /// Reimbursement to insurer @@ -823,13 +793,10 @@ public Hl7.Fhir.Model.FhirBoolean SubrogationElement [IgnoreDataMember] public bool? Subrogation { - get { return SubrogationElement != null ? SubrogationElement.Value : null; } + get => _SubrogationElement?.Value; set { - if (value == null) - SubrogationElement = null; - else - SubrogationElement = new Hl7.Fhir.Model.FhirBoolean(value); + SubrogationElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Subrogation"); } } @@ -844,41 +811,37 @@ public bool? Subrogation [DataMember] public List Contract { - get { if(_Contract==null) _Contract = new List(); return _Contract; } + get => _Contract ?? new List(); set { _Contract = value; OnPropertyChanged("Contract"); } } - private List _Contract; + private List? _Contract; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Coverage; - - if (dest == null) - { + if(other is not Coverage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PolicyHolder != null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)PolicyHolder.DeepCopyInternal(); - if(Subscriber != null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)Subscriber.DeepCopyInternal(); - if(SubscriberIdElement != null) dest.SubscriberIdElement = (Hl7.Fhir.Model.FhirString)SubscriberIdElement.DeepCopyInternal(); - if(Beneficiary != null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)Beneficiary.DeepCopyInternal(); - if(DependentElement != null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)DependentElement.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Payor.Any()) dest.Payor = new List(Payor.DeepCopyInternal()); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(OrderElement != null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)OrderElement.DeepCopyInternal(); - if(NetworkElement != null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)NetworkElement.DeepCopyInternal(); - if(CostToBeneficiary.Any()) dest.CostToBeneficiary = new List(CostToBeneficiary.DeepCopyInternal()); - if(SubrogationElement != null) dest.SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)SubrogationElement.DeepCopyInternal(); - if(Contract.Any()) dest.Contract = new List(Contract.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PolicyHolder is not null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)_PolicyHolder.DeepCopyInternal(); + if(_Subscriber is not null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)_Subscriber.DeepCopyInternal(); + if(_SubscriberIdElement is not null) dest.SubscriberIdElement = (Hl7.Fhir.Model.FhirString)_SubscriberIdElement.DeepCopyInternal(); + if(_Beneficiary is not null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)_Beneficiary.DeepCopyInternal(); + if(_DependentElement is not null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)_DependentElement.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Payor is not null) dest.Payor = new List(_Payor.DeepCopyInternal()); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_OrderElement is not null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)_OrderElement.DeepCopyInternal(); + if(_NetworkElement is not null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)_NetworkElement.DeepCopyInternal(); + if(_CostToBeneficiary is not null) dest.CostToBeneficiary = new List(_CostToBeneficiary.DeepCopyInternal()); + if(_SubrogationElement is not null) dest.SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)_SubrogationElement.DeepCopyInternal(); + if(_Contract is not null) dest.Contract = new List(_Contract.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -890,146 +853,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Coverage; - if(otherT == null) return false; + if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PolicyHolder, otherT.PolicyHolder)) return false; - if(!comparer.Equals(Subscriber, otherT.Subscriber)) return false; - if(!comparer.Equals(SubscriberIdElement, otherT.SubscriberIdElement)) return false; - if(!comparer.Equals(Beneficiary, otherT.Beneficiary)) return false; - if(!comparer.Equals(DependentElement, otherT.DependentElement)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Payor, otherT.Payor)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.Equals(OrderElement, otherT.OrderElement)) return false; - if(!comparer.Equals(NetworkElement, otherT.NetworkElement)) return false; - if(!comparer.ListEquals(CostToBeneficiary, otherT.CostToBeneficiary)) return false; - if(!comparer.Equals(SubrogationElement, otherT.SubrogationElement)) return false; - if(!comparer.ListEquals(Contract, otherT.Contract)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PolicyHolder, otherT._PolicyHolder)) return false; + if(!comparer.Equals(_Subscriber, otherT._Subscriber)) return false; + if(!comparer.Equals(_SubscriberIdElement, otherT._SubscriberIdElement)) return false; + if(!comparer.Equals(_Beneficiary, otherT._Beneficiary)) return false; + if(!comparer.Equals(_DependentElement, otherT._DependentElement)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Payor, otherT._Payor)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_OrderElement, otherT._OrderElement)) return false; + if(!comparer.Equals(_NetworkElement, otherT._NetworkElement)) return false; + if(!comparer.ListEquals(_CostToBeneficiary, otherT._CostToBeneficiary)) return false; + if(!comparer.Equals(_SubrogationElement, otherT._SubrogationElement)) return false; + if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "policyHolder": - value = PolicyHolder; - return PolicyHolder is not null; + value = _PolicyHolder; + return _PolicyHolder is not null; case "subscriber": - value = Subscriber; - return Subscriber is not null; + value = _Subscriber; + return _Subscriber is not null; case "subscriberId": - value = SubscriberIdElement; - return SubscriberIdElement is not null; + value = _SubscriberIdElement; + return _SubscriberIdElement is not null; case "beneficiary": - value = Beneficiary; - return Beneficiary is not null; + value = _Beneficiary; + return _Beneficiary is not null; case "dependent": - value = DependentElement; - return DependentElement is not null; + value = _DependentElement; + return _DependentElement is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "payor": - value = Payor; - return Payor?.Any() == true; + value = _Payor; + return _Payor?.Any() == true; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "order": - value = OrderElement; - return OrderElement is not null; + value = _OrderElement; + return _OrderElement is not null; case "network": - value = NetworkElement; - return NetworkElement is not null; + value = _NetworkElement; + return _NetworkElement is not null; case "costToBeneficiary": - value = CostToBeneficiary; - return CostToBeneficiary?.Any() == true; + value = _CostToBeneficiary; + return _CostToBeneficiary?.Any() == true; case "subrogation": - value = SubrogationElement; - return SubrogationElement is not null; + value = _SubrogationElement; + return _SubrogationElement is not null; case "contract": - value = Contract; - return Contract?.Any() == true; + value = _Contract; + return _Contract?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "policyHolder": - PolicyHolder = (Hl7.Fhir.Model.ResourceReference)value; + PolicyHolder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriber": - Subscriber = (Hl7.Fhir.Model.ResourceReference)value; + Subscriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriberId": - SubscriberIdElement = (Hl7.Fhir.Model.FhirString)value; + SubscriberIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "beneficiary": - Beneficiary = (Hl7.Fhir.Model.ResourceReference)value; + Beneficiary = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dependent": - DependentElement = (Hl7.Fhir.Model.FhirString)value; + DependentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "payor": - Payor = (List)value; + Payor = (List?)value!; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "order": - OrderElement = (Hl7.Fhir.Model.PositiveInt)value; + OrderElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "network": - NetworkElement = (Hl7.Fhir.Model.FhirString)value; + NetworkElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "costToBeneficiary": - CostToBeneficiary = (List)value; + CostToBeneficiary = (List?)value!; return this; case "subrogation": - SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)value; + SubrogationElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "contract": - Contract = (List)value; + Contract = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1040,23 +1003,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PolicyHolder is not null) yield return new KeyValuePair("policyHolder",PolicyHolder); - if (Subscriber is not null) yield return new KeyValuePair("subscriber",Subscriber); - if (SubscriberIdElement is not null) yield return new KeyValuePair("subscriberId",SubscriberIdElement); - if (Beneficiary is not null) yield return new KeyValuePair("beneficiary",Beneficiary); - if (DependentElement is not null) yield return new KeyValuePair("dependent",DependentElement); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Payor?.Any() == true) yield return new KeyValuePair("payor",Payor); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (OrderElement is not null) yield return new KeyValuePair("order",OrderElement); - if (NetworkElement is not null) yield return new KeyValuePair("network",NetworkElement); - if (CostToBeneficiary?.Any() == true) yield return new KeyValuePair("costToBeneficiary",CostToBeneficiary); - if (SubrogationElement is not null) yield return new KeyValuePair("subrogation",SubrogationElement); - if (Contract?.Any() == true) yield return new KeyValuePair("contract",Contract); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PolicyHolder is not null) yield return new KeyValuePair("policyHolder",_PolicyHolder); + if (_Subscriber is not null) yield return new KeyValuePair("subscriber",_Subscriber); + if (_SubscriberIdElement is not null) yield return new KeyValuePair("subscriberId",_SubscriberIdElement); + if (_Beneficiary is not null) yield return new KeyValuePair("beneficiary",_Beneficiary); + if (_DependentElement is not null) yield return new KeyValuePair("dependent",_DependentElement); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Payor?.Any() == true) yield return new KeyValuePair("payor",_Payor); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_OrderElement is not null) yield return new KeyValuePair("order",_OrderElement); + if (_NetworkElement is not null) yield return new KeyValuePair("network",_NetworkElement); + if (_CostToBeneficiary?.Any() == true) yield return new KeyValuePair("costToBeneficiary",_CostToBeneficiary); + if (_SubrogationElement is not null) yield return new KeyValuePair("subrogation",_SubrogationElement); + if (_Contract?.Any() == true) yield return new KeyValuePair("contract",_Contract); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs index 5fcd5d535..860a14647 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -131,13 +134,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -150,26 +150,26 @@ public int? Sequence [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Information + public Hl7.Fhir.Model.ResourceReference? Information { get { return _Information; } set { _Information = value; OnPropertyChanged("Information"); } } - private Hl7.Fhir.Model.ResourceReference _Information; + private Hl7.Fhir.Model.ResourceReference? _Information; /// /// Applies to all items. /// [FhirElement("appliesToAll", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AppliesToAllElement + public Hl7.Fhir.Model.FhirBoolean? AppliesToAllElement { get { return _AppliesToAllElement; } set { _AppliesToAllElement = value; OnPropertyChanged("AppliesToAllElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AppliesToAllElement; + private Hl7.Fhir.Model.FhirBoolean? _AppliesToAllElement; /// /// Applies to all items @@ -178,30 +178,23 @@ public Hl7.Fhir.Model.FhirBoolean AppliesToAllElement [IgnoreDataMember] public bool? AppliesToAll { - get { return AppliesToAllElement != null ? AppliesToAllElement.Value : null; } + get => _AppliesToAllElement?.Value; set { - if (value == null) - AppliesToAllElement = null; - else - AppliesToAllElement = new Hl7.Fhir.Model.FhirBoolean(value); + AppliesToAllElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AppliesToAll"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Information != null) dest.Information = (Hl7.Fhir.Model.ResourceReference)Information.DeepCopyInternal(); - if(AppliesToAllElement != null) dest.AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)AppliesToAllElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Information is not null) dest.Information = (Hl7.Fhir.Model.ResourceReference)_Information.DeepCopyInternal(); + if(_AppliesToAllElement is not null) dest.AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)_AppliesToAllElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -213,48 +206,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Information, otherT.Information)) return false; - if(!comparer.Equals(AppliesToAllElement, otherT.AppliesToAllElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Information, otherT._Information)) return false; + if(!comparer.Equals(_AppliesToAllElement, otherT._AppliesToAllElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "information": - value = Information; - return Information is not null; + value = _Information; + return _Information is not null; case "appliesToAll": - value = AppliesToAllElement; - return AppliesToAllElement is not null; + value = _AppliesToAllElement; + return _AppliesToAllElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "information": - Information = (Hl7.Fhir.Model.ResourceReference)value; + Information = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "appliesToAll": - AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)value; + AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -265,9 +258,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Information is not null) yield return new KeyValuePair("information",Information); - if (AppliesToAllElement is not null) yield return new KeyValuePair("appliesToAll",AppliesToAllElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Information is not null) yield return new KeyValuePair("information",_Information); + if (_AppliesToAllElement is not null) yield return new KeyValuePair("appliesToAll",_AppliesToAllElement); } } @@ -294,13 +287,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("focal", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Applicable coverage @@ -309,13 +302,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -328,58 +318,51 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -391,48 +374,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -443,9 +426,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); } } @@ -474,24 +457,24 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SupportingInfoSequenceElement { - get { if(_SupportingInfoSequenceElement==null) _SupportingInfoSequenceElement = new List(); return _SupportingInfoSequenceElement; } + get => _SupportingInfoSequenceElement ?? new List(); set { _SupportingInfoSequenceElement = value; OnPropertyChanged("SupportingInfoSequenceElement"); } } - private List _SupportingInfoSequenceElement; + private List? _SupportingInfoSequenceElement; /// /// Applicable exception or supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SupportingInfoSequence + public IEnumerable? SupportingInfoSequence { - get { return SupportingInfoSequenceElement != null ? SupportingInfoSequenceElement.Select(elem => elem.Value) : null; } + get => _SupportingInfoSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SupportingInfoSequenceElement = null; + SupportingInfoSequenceElement = null!; else SupportingInfoSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SupportingInfoSequence"); @@ -504,13 +487,13 @@ public IEnumerable SupportingInfoSequence [FhirElement("category", Order=50)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -518,13 +501,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -535,11 +518,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Perfoming practitioner. @@ -548,39 +531,39 @@ public List Modifier [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Count of products or services. /// [FhirElement("quantity", Order=90)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=100)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Servicing facility. @@ -589,13 +572,13 @@ public Hl7.Fhir.Model.Money UnitPrice [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Applicable diagnosis. @@ -605,11 +588,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Product or service details. @@ -621,32 +604,28 @@ public List Diagno [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailsComponent; - - if (dest == null) - { + if(other is not DetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SupportingInfoSequenceElement.Any()) dest.SupportingInfoSequenceElement = new List(SupportingInfoSequenceElement.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SupportingInfoSequenceElement is not null) dest.SupportingInfoSequenceElement = new List(_SupportingInfoSequenceElement.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -658,97 +637,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailsComponent; - if(otherT == null) return false; + if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(SupportingInfoSequenceElement, otherT.SupportingInfoSequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "supportingInfoSequence": - value = SupportingInfoSequenceElement; - return SupportingInfoSequenceElement?.Any() == true; + value = _SupportingInfoSequenceElement; + return _SupportingInfoSequenceElement?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "supportingInfoSequence": - SupportingInfoSequenceElement = (List)value; + SupportingInfoSequenceElement = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -759,16 +738,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SupportingInfoSequenceElement?.Any() == true) yield return new KeyValuePair("supportingInfoSequence",SupportingInfoSequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SupportingInfoSequenceElement?.Any() == true) yield return new KeyValuePair("supportingInfoSequence",_SupportingInfoSequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -798,25 +777,21 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -828,34 +803,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -866,7 +841,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); } } @@ -879,11 +854,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -893,13 +868,13 @@ public List Identifier [Binding("EligibilityRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -908,13 +883,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -925,13 +897,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("priority", Order=110, FiveWs="FiveWs.class")] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// auth-requirements | benefits | discovery | validation. @@ -943,24 +915,24 @@ public Hl7.Fhir.Model.CodeableConcept Priority [DataMember] public List> PurposeElement { - get { if(_PurposeElement==null) _PurposeElement = new List>(); return _PurposeElement; } + get => _PurposeElement ?? new List>(); set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private List> _PurposeElement; + private List>? _PurposeElement; /// /// auth-requirements | benefits | discovery | validation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Purpose + public IEnumerable? Purpose { - get { return PurposeElement != null ? PurposeElement.Select(elem => elem.Value) : null; } + get => _PurposeElement?.Select(elem => elem.Value); set { if (value == null) - PurposeElement = null; + PurposeElement = null!; else PurposeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Purpose"); @@ -975,13 +947,13 @@ public IEnumerable /// Estimated date or dates of service. @@ -990,13 +962,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Creation date. @@ -1004,28 +976,25 @@ public Hl7.Fhir.Model.DataType Serviced [FhirElement("created", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1037,13 +1006,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Party responsible for the request. @@ -1052,13 +1021,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Coverage issuer. @@ -1068,13 +1037,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Servicing facility. @@ -1083,13 +1052,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Supporting information. @@ -1099,11 +1068,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Patient insurance information. @@ -1113,11 +1082,11 @@ public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Item to be evaluated for eligibiity. @@ -1127,38 +1096,34 @@ public List Insura [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageEligibilityRequest; - - if (dest == null) - { + if(other is not CoverageEligibilityRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(PurposeElement.Any()) dest.PurposeElement = new List>(PurposeElement.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = new List>(_PurposeElement.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1170,125 +1135,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageEligibilityRequest; - if(otherT == null) return false; + if(other is not CoverageEligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.ListEquals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "purpose": - value = PurposeElement; - return PurposeElement?.Any() == true; + value = _PurposeElement; + return _PurposeElement?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "purpose": - PurposeElement = (List>)value; + PurposeElement = (List>?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1299,20 +1264,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",PurposeElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs index f942ac3ce..28129efd3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -118,26 +121,26 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Coverage inforce indicator. /// [FhirElement("inforce", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InforceElement + public Hl7.Fhir.Model.FhirBoolean? InforceElement { get { return _InforceElement; } set { _InforceElement = value; OnPropertyChanged("InforceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InforceElement; + private Hl7.Fhir.Model.FhirBoolean? _InforceElement; /// /// Coverage inforce indicator @@ -146,13 +149,10 @@ public Hl7.Fhir.Model.FhirBoolean InforceElement [IgnoreDataMember] public bool? Inforce { - get { return InforceElement != null ? InforceElement.Value : null; } + get => _InforceElement?.Value; set { - if (value == null) - InforceElement = null; - else - InforceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InforceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inforce"); } } @@ -162,13 +162,13 @@ public bool? Inforce /// [FhirElement("benefitPeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period BenefitPeriod + public Hl7.Fhir.Model.Period? BenefitPeriod { get { return _BenefitPeriod; } set { _BenefitPeriod = value; OnPropertyChanged("BenefitPeriod"); } } - private Hl7.Fhir.Model.Period _BenefitPeriod; + private Hl7.Fhir.Model.Period? _BenefitPeriod; /// /// Benefits and authorization details. @@ -178,26 +178,22 @@ public Hl7.Fhir.Model.Period BenefitPeriod [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(InforceElement != null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)InforceElement.DeepCopyInternal(); - if(BenefitPeriod != null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)BenefitPeriod.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_InforceElement is not null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)_InforceElement.DeepCopyInternal(); + if(_BenefitPeriod is not null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)_BenefitPeriod.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -209,55 +205,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(InforceElement, otherT.InforceElement)) return false; - if(!comparer.Equals(BenefitPeriod, otherT.BenefitPeriod)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_InforceElement, otherT._InforceElement)) return false; + if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "inforce": - value = InforceElement; - return InforceElement is not null; + value = _InforceElement; + return _InforceElement is not null; case "benefitPeriod": - value = BenefitPeriod; - return BenefitPeriod is not null; + value = _BenefitPeriod; + return _BenefitPeriod is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "inforce": - InforceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InforceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "benefitPeriod": - BenefitPeriod = (Hl7.Fhir.Model.Period)value; + BenefitPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -268,10 +264,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (InforceElement is not null) yield return new KeyValuePair("inforce",InforceElement); - if (BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",BenefitPeriod); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_InforceElement is not null) yield return new KeyValuePair("inforce",_InforceElement); + if (_BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",_BenefitPeriod); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -298,13 +294,13 @@ public partial class ItemsComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -312,13 +308,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=50)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -329,11 +325,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Performing practitioner. @@ -342,26 +338,26 @@ public List Modifier [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -370,13 +366,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -386,28 +379,25 @@ public bool? Excluded /// [FhirElement("name", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -417,28 +407,25 @@ public string Name /// [FhirElement("description", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -449,13 +436,13 @@ public string Description [FhirElement("network", Order=110)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -463,13 +450,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=120)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -477,13 +464,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=130)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -493,24 +480,24 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; /// /// Authorization required flag. /// [FhirElement("authorizationRequired", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AuthorizationRequiredElement + public Hl7.Fhir.Model.FhirBoolean? AuthorizationRequiredElement { get { return _AuthorizationRequiredElement; } set { _AuthorizationRequiredElement = value; OnPropertyChanged("AuthorizationRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AuthorizationRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _AuthorizationRequiredElement; /// /// Authorization required flag @@ -519,13 +506,10 @@ public Hl7.Fhir.Model.FhirBoolean AuthorizationRequiredElement [IgnoreDataMember] public bool? AuthorizationRequired { - get { return AuthorizationRequiredElement != null ? AuthorizationRequiredElement.Value : null; } + get => _AuthorizationRequiredElement?.Value; set { - if (value == null) - AuthorizationRequiredElement = null; - else - AuthorizationRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + AuthorizationRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AuthorizationRequired"); } } @@ -539,67 +523,60 @@ public bool? AuthorizationRequired [DataMember] public List AuthorizationSupporting { - get { if(_AuthorizationSupporting==null) _AuthorizationSupporting = new List(); return _AuthorizationSupporting; } + get => _AuthorizationSupporting ?? new List(); set { _AuthorizationSupporting = value; OnPropertyChanged("AuthorizationSupporting"); } } - private List _AuthorizationSupporting; + private List? _AuthorizationSupporting; /// /// Preauthorization requirements endpoint. /// [FhirElement("authorizationUrl", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirUri AuthorizationUrlElement + public Hl7.Fhir.Model.FhirUri? AuthorizationUrlElement { get { return _AuthorizationUrlElement; } set { _AuthorizationUrlElement = value; OnPropertyChanged("AuthorizationUrlElement"); } } - private Hl7.Fhir.Model.FhirUri _AuthorizationUrlElement; + private Hl7.Fhir.Model.FhirUri? _AuthorizationUrlElement; /// /// Preauthorization requirements endpoint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthorizationUrl + public string? AuthorizationUrl { - get { return AuthorizationUrlElement != null ? AuthorizationUrlElement.Value : null; } + get => _AuthorizationUrlElement?.Value; set { - if (value == null) - AuthorizationUrlElement = null; - else - AuthorizationUrlElement = new Hl7.Fhir.Model.FhirUri(value); + AuthorizationUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("AuthorizationUrl"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ItemsComponent; - - if (dest == null) - { + if(other is not ItemsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); - if(AuthorizationRequiredElement != null) dest.AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)AuthorizationRequiredElement.DeepCopyInternal(); - if(AuthorizationSupporting.Any()) dest.AuthorizationSupporting = new List(AuthorizationSupporting.DeepCopyInternal()); - if(AuthorizationUrlElement != null) dest.AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)AuthorizationUrlElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); + if(_AuthorizationRequiredElement is not null) dest.AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_AuthorizationRequiredElement.DeepCopyInternal(); + if(_AuthorizationSupporting is not null) dest.AuthorizationSupporting = new List(_AuthorizationSupporting.DeepCopyInternal()); + if(_AuthorizationUrlElement is not null) dest.AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)_AuthorizationUrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -611,125 +588,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemsComponent; - if(otherT == null) return false; + if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; - if(!comparer.Equals(AuthorizationRequiredElement, otherT.AuthorizationRequiredElement)) return false; - if(!comparer.ListEquals(AuthorizationSupporting, otherT.AuthorizationSupporting)) return false; - if(!comparer.Equals(AuthorizationUrlElement, otherT.AuthorizationUrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; + if(!comparer.Equals(_AuthorizationRequiredElement, otherT._AuthorizationRequiredElement)) return false; + if(!comparer.ListEquals(_AuthorizationSupporting, otherT._AuthorizationSupporting)) return false; + if(!comparer.Equals(_AuthorizationUrlElement, otherT._AuthorizationUrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; case "authorizationRequired": - value = AuthorizationRequiredElement; - return AuthorizationRequiredElement is not null; + value = _AuthorizationRequiredElement; + return _AuthorizationRequiredElement is not null; case "authorizationSupporting": - value = AuthorizationSupporting; - return AuthorizationSupporting?.Any() == true; + value = _AuthorizationSupporting; + return _AuthorizationSupporting?.Any() == true; case "authorizationUrl": - value = AuthorizationUrlElement; - return AuthorizationUrlElement is not null; + value = _AuthorizationUrlElement; + return _AuthorizationUrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; case "authorizationRequired": - AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "authorizationSupporting": - AuthorizationSupporting = (List)value; + AuthorizationSupporting = (List?)value!; return this; case "authorizationUrl": - AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)value; + AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -740,20 +717,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); - if (AuthorizationRequiredElement is not null) yield return new KeyValuePair("authorizationRequired",AuthorizationRequiredElement); - if (AuthorizationSupporting?.Any() == true) yield return new KeyValuePair("authorizationSupporting",AuthorizationSupporting); - if (AuthorizationUrlElement is not null) yield return new KeyValuePair("authorizationUrl",AuthorizationUrlElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); + if (_AuthorizationRequiredElement is not null) yield return new KeyValuePair("authorizationRequired",_AuthorizationRequiredElement); + if (_AuthorizationSupporting?.Any() == true) yield return new KeyValuePair("authorizationSupporting",_AuthorizationSupporting); + if (_AuthorizationUrlElement is not null) yield return new KeyValuePair("authorizationUrl",_AuthorizationUrlElement); } } @@ -781,13 +758,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -796,13 +773,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -811,27 +788,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -843,48 +816,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -895,9 +868,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -925,25 +898,21 @@ public partial class ErrorsComponent : Hl7.Fhir.Model.BackboneElement [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorsComponent; - - if (dest == null) - { + if(other is not ErrorsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -955,34 +924,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorsComponent; - if(otherT == null) return false; + if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -993,7 +962,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -1006,11 +975,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -1020,13 +989,13 @@ public List Identifier [Binding("EligibilityResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -1035,13 +1004,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1056,24 +1022,24 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [DataMember] public List> PurposeElement { - get { if(_PurposeElement==null) _PurposeElement = new List>(); return _PurposeElement; } + get => _PurposeElement ?? new List>(); set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private List> _PurposeElement; + private List>? _PurposeElement; /// /// auth-requirements | benefits | discovery | validation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Purpose + public IEnumerable? Purpose { - get { return PurposeElement != null ? PurposeElement.Select(elem => elem.Value) : null; } + get => _PurposeElement?.Select(elem => elem.Value); set { if (value == null) - PurposeElement = null; + PurposeElement = null!; else PurposeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Purpose"); @@ -1088,13 +1054,13 @@ public IEnumerable /// Estimated date or dates of service. @@ -1103,13 +1069,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Response creation date. @@ -1117,28 +1083,25 @@ public Hl7.Fhir.Model.DataType Serviced [FhirElement("created", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1150,13 +1113,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// Eligibility request reference. @@ -1166,13 +1129,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [References("CoverageEligibilityRequest")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -1182,13 +1145,13 @@ public Hl7.Fhir.Model.ResourceReference Request [Binding("RemittanceOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -1197,13 +1160,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.RemittanceOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -1213,28 +1173,25 @@ public Hl7.Fhir.Model.RemittanceOutcome? Outcome /// [FhirElement("disposition", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -1247,13 +1204,13 @@ public string Disposition [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Patient insurance information. @@ -1263,39 +1220,36 @@ public Hl7.Fhir.Model.ResourceReference Insurer [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Preauthorization reference. /// [FhirElement("preAuthRef", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -1306,13 +1260,13 @@ public string PreAuthRef [FhirElement("form", Order=220)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Processing errors. @@ -1322,39 +1276,35 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageEligibilityResponse; - - if (dest == null) - { + if(other is not CoverageEligibilityResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PurposeElement.Any()) dest.PurposeElement = new List>(PurposeElement.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = new List>(_PurposeElement.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1366,132 +1316,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageEligibilityResponse; - if(otherT == null) return false; + if(other is not CoverageEligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement?.Any() == true; + value = _PurposeElement; + return _PurposeElement?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "purpose": - PurposeElement = (List>)value; + PurposeElement = (List>?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1502,21 +1452,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",PurposeElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs index 1e97b1912..e102038e3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -102,28 +105,25 @@ public partial class CodeFilterComponent : Hl7.Fhir.Model.Element /// [FhirElement("path", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// A code-valued attribute to filter on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -133,28 +133,25 @@ public string Path /// [FhirElement("searchParam", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SearchParamElement + public Hl7.Fhir.Model.FhirString? SearchParamElement { get { return _SearchParamElement; } set { _SearchParamElement = value; OnPropertyChanged("SearchParamElement"); } } - private Hl7.Fhir.Model.FhirString _SearchParamElement; + private Hl7.Fhir.Model.FhirString? _SearchParamElement; /// /// A coded (token) parameter to search on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SearchParam + public string? SearchParam { - get { return SearchParamElement != null ? SearchParamElement.Value : null; } + get => _SearchParamElement?.Value; set { - if (value == null) - SearchParamElement = null; - else - SearchParamElement = new Hl7.Fhir.Model.FhirString(value); + SearchParamElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SearchParam"); } } @@ -164,28 +161,25 @@ public string SearchParam /// [FhirElement("valueSet", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Valueset for the filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -198,26 +192,22 @@ public string ValueSet [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as CodeFilterComponent; - - if (dest == null) - { + if(other is not CodeFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SearchParamElement != null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)SearchParamElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SearchParamElement is not null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)_SearchParamElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -229,55 +219,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeFilterComponent; - if(otherT == null) return false; + if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SearchParamElement, otherT.SearchParamElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "searchParam": - value = SearchParamElement; - return SearchParamElement is not null; + value = _SearchParamElement; + return _SearchParamElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "searchParam": - SearchParamElement = (Hl7.Fhir.Model.FhirString)value; + SearchParamElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; default: return base.SetValue(key, value); @@ -288,10 +278,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SearchParamElement is not null) yield return new KeyValuePair("searchParam",SearchParamElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SearchParamElement is not null) yield return new KeyValuePair("searchParam",_SearchParamElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); } } @@ -317,28 +307,25 @@ public partial class DateFilterComponent : Hl7.Fhir.Model.Element /// [FhirElement("path", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// A date-valued attribute to filter on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -348,28 +335,25 @@ public string Path /// [FhirElement("searchParam", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SearchParamElement + public Hl7.Fhir.Model.FhirString? SearchParamElement { get { return _SearchParamElement; } set { _SearchParamElement = value; OnPropertyChanged("SearchParamElement"); } } - private Hl7.Fhir.Model.FhirString _SearchParamElement; + private Hl7.Fhir.Model.FhirString? _SearchParamElement; /// /// A date valued parameter to search on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SearchParam + public string? SearchParam { - get { return SearchParamElement != null ? SearchParamElement.Value : null; } + get => _SearchParamElement?.Value; set { - if (value == null) - SearchParamElement = null; - else - SearchParamElement = new Hl7.Fhir.Model.FhirString(value); + SearchParamElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SearchParam"); } } @@ -381,27 +365,23 @@ public string SearchParam [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DateFilterComponent; - - if (dest == null) - { + if(other is not DateFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SearchParamElement != null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)SearchParamElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SearchParamElement is not null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)_SearchParamElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -413,48 +393,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateFilterComponent; - if(otherT == null) return false; + if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SearchParamElement, otherT.SearchParamElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "searchParam": - value = SearchParamElement; - return SearchParamElement is not null; + value = _SearchParamElement; + return _SearchParamElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "searchParam": - SearchParamElement = (Hl7.Fhir.Model.FhirString)value; + SearchParamElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -465,9 +445,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SearchParamElement is not null) yield return new KeyValuePair("searchParam",SearchParamElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SearchParamElement is not null) yield return new KeyValuePair("searchParam",_SearchParamElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -495,28 +475,25 @@ public partial class SortComponent : Hl7.Fhir.Model.Element [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The name of the attribute to perform the sort /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -529,13 +506,13 @@ public string Path [Binding("SortDirection")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code DirectionElement + public Code? DirectionElement { get { return _DirectionElement; } set { _DirectionElement = value; OnPropertyChanged("DirectionElement"); } } - private Code _DirectionElement; + private Code? _DirectionElement; /// /// ascending | descending @@ -544,29 +521,22 @@ public Code DirectionElement [IgnoreDataMember] public Hl7.Fhir.Model.DataRequirement.SortDirection? Direction { - get { return DirectionElement != null ? DirectionElement.Value : null; } + get => _DirectionElement?.Value; set { - if (value == null) - DirectionElement = null; - else - DirectionElement = new Code(value); + DirectionElement = value is null ? null : new Code(value); OnPropertyChanged("Direction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SortComponent; - - if (dest == null) - { + if(other is not SortComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(DirectionElement != null) dest.DirectionElement = (Code)DirectionElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_DirectionElement is not null) dest.DirectionElement = (Code)_DirectionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -578,41 +548,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SortComponent; - if(otherT == null) return false; + if(other is not SortComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(DirectionElement, otherT.DirectionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "direction": - value = DirectionElement; - return DirectionElement is not null; + value = _DirectionElement; + return _DirectionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "direction": - DirectionElement = (Code)value; + DirectionElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -623,8 +593,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (DirectionElement is not null) yield return new KeyValuePair("direction",DirectionElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_DirectionElement is not null) yield return new KeyValuePair("direction",_DirectionElement); } } @@ -637,13 +607,13 @@ public override IEnumerable> EnumerateElements() [Binding("FHIRAllTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// The type of the required data @@ -652,13 +622,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -671,24 +638,24 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// The profile of the required data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -704,13 +671,13 @@ public IEnumerable Profile [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Indicates specific structure elements that are referenced by the knowledge module. @@ -720,24 +687,24 @@ public Hl7.Fhir.Model.DataType Subject [DataMember] public List MustSupportElement { - get { if(_MustSupportElement==null) _MustSupportElement = new List(); return _MustSupportElement; } + get => _MustSupportElement ?? new List(); set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } - private List _MustSupportElement; + private List? _MustSupportElement; /// /// Indicates specific structure elements that are referenced by the knowledge module /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable MustSupport + public IEnumerable? MustSupport { - get { return MustSupportElement != null ? MustSupportElement.Select(elem => elem.Value) : null; } + get => _MustSupportElement?.Select(elem => elem.Value); set { if (value == null) - MustSupportElement = null; + MustSupportElement = null!; else MustSupportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("MustSupport"); @@ -752,11 +719,11 @@ public IEnumerable MustSupport [DataMember] public List CodeFilter { - get { if(_CodeFilter==null) _CodeFilter = new List(); return _CodeFilter; } + get => _CodeFilter ?? new List(); set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } - private List _CodeFilter; + private List? _CodeFilter; /// /// What dates/date ranges are expected. @@ -766,24 +733,24 @@ public List CodeFilter [DataMember] public List DateFilter { - get { if(_DateFilter==null) _DateFilter = new List(); return _DateFilter; } + get => _DateFilter ?? new List(); set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } - private List _DateFilter; + private List? _DateFilter; /// /// Number of results. /// [FhirElement("limit", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.PositiveInt LimitElement + public Hl7.Fhir.Model.PositiveInt? LimitElement { get { return _LimitElement; } set { _LimitElement = value; OnPropertyChanged("LimitElement"); } } - private Hl7.Fhir.Model.PositiveInt _LimitElement; + private Hl7.Fhir.Model.PositiveInt? _LimitElement; /// /// Number of results @@ -792,13 +759,10 @@ public Hl7.Fhir.Model.PositiveInt LimitElement [IgnoreDataMember] public int? Limit { - get { return LimitElement != null ? LimitElement.Value : null; } + get => _LimitElement?.Value; set { - if (value == null) - LimitElement = null; - else - LimitElement = new Hl7.Fhir.Model.PositiveInt(value); + LimitElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Limit"); } } @@ -811,30 +775,26 @@ public int? Limit [DataMember] public List Sort { - get { if(_Sort==null) _Sort = new List(); return _Sort; } + get => _Sort ?? new List(); set { _Sort = value; OnPropertyChanged("Sort"); } } - private List _Sort; + private List? _Sort; protected internal override void CopyToInternal(Base other) { - var dest = other as DataRequirement; - - if (dest == null) - { + if(other is not DataRequirement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(MustSupportElement.Any()) dest.MustSupportElement = new List(MustSupportElement.DeepCopyInternal()); - if(CodeFilter.Any()) dest.CodeFilter = new List(CodeFilter.DeepCopyInternal()); - if(DateFilter.Any()) dest.DateFilter = new List(DateFilter.DeepCopyInternal()); - if(LimitElement != null) dest.LimitElement = (Hl7.Fhir.Model.PositiveInt)LimitElement.DeepCopyInternal(); - if(Sort.Any()) dest.Sort = new List(Sort.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_MustSupportElement is not null) dest.MustSupportElement = new List(_MustSupportElement.DeepCopyInternal()); + if(_CodeFilter is not null) dest.CodeFilter = new List(_CodeFilter.DeepCopyInternal()); + if(_DateFilter is not null) dest.DateFilter = new List(_DateFilter.DeepCopyInternal()); + if(_LimitElement is not null) dest.LimitElement = (Hl7.Fhir.Model.PositiveInt)_LimitElement.DeepCopyInternal(); + if(_Sort is not null) dest.Sort = new List(_Sort.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -846,83 +806,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataRequirement; - if(otherT == null) return false; + if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(MustSupportElement, otherT.MustSupportElement)) return false; - if(!comparer.ListEquals(CodeFilter, otherT.CodeFilter)) return false; - if(!comparer.ListEquals(DateFilter, otherT.DateFilter)) return false; - if(!comparer.Equals(LimitElement, otherT.LimitElement)) return false; - if(!comparer.ListEquals(Sort, otherT.Sort)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; + if(!comparer.ListEquals(_CodeFilter, otherT._CodeFilter)) return false; + if(!comparer.ListEquals(_DateFilter, otherT._DateFilter)) return false; + if(!comparer.Equals(_LimitElement, otherT._LimitElement)) return false; + if(!comparer.ListEquals(_Sort, otherT._Sort)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "mustSupport": - value = MustSupportElement; - return MustSupportElement?.Any() == true; + value = _MustSupportElement; + return _MustSupportElement?.Any() == true; case "codeFilter": - value = CodeFilter; - return CodeFilter?.Any() == true; + value = _CodeFilter; + return _CodeFilter?.Any() == true; case "dateFilter": - value = DateFilter; - return DateFilter?.Any() == true; + value = _DateFilter; + return _DateFilter?.Any() == true; case "limit": - value = LimitElement; - return LimitElement is not null; + value = _LimitElement; + return _LimitElement is not null; case "sort": - value = Sort; - return Sort?.Any() == true; + value = _Sort; + return _Sort?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "mustSupport": - MustSupportElement = (List)value; + MustSupportElement = (List?)value!; return this; case "codeFilter": - CodeFilter = (List)value; + CodeFilter = (List?)value!; return this; case "dateFilter": - DateFilter = (List)value; + DateFilter = (List?)value!; return this; case "limit": - LimitElement = (Hl7.Fhir.Model.PositiveInt)value; + LimitElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "sort": - Sort = (List)value; + Sort = (List?)value!; return this; default: return base.SetValue(key, value); @@ -933,14 +893,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",MustSupportElement); - if (CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",CodeFilter); - if (DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",DateFilter); - if (LimitElement is not null) yield return new KeyValuePair("limit",LimitElement); - if (Sort?.Any() == true) yield return new KeyValuePair("sort",Sort); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",_MustSupportElement); + if (_CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",_CodeFilter); + if (_DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",_DateFilter); + if (_LimitElement is not null) yield return new KeyValuePair("limit",_LimitElement); + if (_Sort?.Any() == true) yield return new KeyValuePair("sort",_Sort); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs index d52b7f25d..efa007ab0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,11 +115,11 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting information. @@ -128,24 +131,20 @@ public List Code [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceComponent; - - if (dest == null) - { + if(other is not EvidenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -157,41 +156,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceComponent; - if(otherT == null) return false; + if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -202,8 +201,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -231,41 +230,38 @@ public partial class MitigationComponent : Hl7.Fhir.Model.BackboneElement [Binding("DetectedIssueMitigationAction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Date committed. /// [FhirElement("date", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date committed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -277,27 +273,23 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; protected internal override void CopyToInternal(Base other) { - var dest = other as MitigationComponent; - - if (dest == null) - { + if(other is not MitigationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -309,48 +301,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MitigationComponent; - if(otherT == null) return false; + if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -361,9 +353,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } @@ -376,11 +368,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// registered | preliminary | final | amended +. @@ -390,13 +382,13 @@ public List Identifier [Binding("DetectedIssueStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -405,13 +397,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -422,13 +411,13 @@ public Hl7.Fhir.Model.ObservationStatus? Status [FhirElement("code", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("DetectedIssueCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// high | moderate | low. @@ -437,13 +426,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("DetectedIssueSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// high | moderate | low @@ -452,13 +441,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -470,13 +456,13 @@ public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When identified. @@ -485,13 +471,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Identified + public Hl7.Fhir.Model.DataType? Identified { get { return _Identified; } set { _Identified = value; OnPropertyChanged("Identified"); } } - private Hl7.Fhir.Model.DataType _Identified; + private Hl7.Fhir.Model.DataType? _Identified; /// /// The provider or device that identified the issue. @@ -500,13 +486,13 @@ public Hl7.Fhir.Model.DataType Identified [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Problem resource. @@ -518,11 +504,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Implicated { - get { if(_Implicated==null) _Implicated = new List(); return _Implicated; } + get => _Implicated ?? new List(); set { _Implicated = value; OnPropertyChanged("Implicated"); } } - private List _Implicated; + private List? _Implicated; /// /// Supporting evidence. @@ -532,39 +518,36 @@ public List Implicated [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; /// /// Description and context. /// [FhirElement("detail", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DetailElement + public Hl7.Fhir.Model.FhirString? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirString _DetailElement; + private Hl7.Fhir.Model.FhirString? _DetailElement; /// /// Description and context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirString(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Detail"); } } @@ -574,28 +557,25 @@ public string Detail /// [FhirElement("reference", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Authority for issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } @@ -608,36 +588,32 @@ public string Reference [DataMember] public List Mitigation { - get { if(_Mitigation==null) _Mitigation = new List(); return _Mitigation; } + get => _Mitigation ?? new List(); set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } - private List _Mitigation; + private List? _Mitigation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DetectedIssue; - - if (dest == null) - { + if(other is not DetectedIssue dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Identified != null) dest.Identified = (Hl7.Fhir.Model.DataType)Identified.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Implicated.Any()) dest.Implicated = new List(Implicated.DeepCopyInternal()); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); - if(Mitigation.Any()) dest.Mitigation = new List(Mitigation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Identified is not null) dest.Identified = (Hl7.Fhir.Model.DataType)_Identified.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Implicated is not null) dest.Implicated = new List(_Implicated.DeepCopyInternal()); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)_DetailElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); + if(_Mitigation is not null) dest.Mitigation = new List(_Mitigation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -649,111 +625,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetectedIssue; - if(otherT == null) return false; + if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Identified, otherT.Identified)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Implicated, otherT.Implicated)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(Mitigation, otherT.Mitigation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Identified, otherT._Identified)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Implicated, otherT._Implicated)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "identified": - value = Identified; - return Identified is not null; + value = _Identified; + return _Identified is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "implicated": - value = Implicated; - return Implicated?.Any() == true; + value = _Implicated; + return _Implicated?.Any() == true; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "mitigation": - value = Mitigation; - return Mitigation?.Any() == true; + value = _Mitigation; + return _Mitigation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "identified": - Identified = (Hl7.Fhir.Model.DataType)value; + Identified = (Hl7.Fhir.Model.DataType?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "implicated": - Implicated = (List)value; + Implicated = (List?)value!; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirString)value; + DetailElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "mitigation": - Mitigation = (List)value; + Mitigation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -764,18 +740,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Identified is not null) yield return new KeyValuePair("identified",Identified); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Implicated?.Any() == true) yield return new KeyValuePair("implicated",Implicated); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",Mitigation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Identified is not null) yield return new KeyValuePair("identified",_Identified); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Implicated?.Any() == true) yield return new KeyValuePair("implicated",_Implicated); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",_Mitigation); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Device.cs b/src/Hl7.Fhir.R4B/Model/Generated/Device.cs index 632aecb0d..ccaaf9c51 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Device.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -161,28 +164,25 @@ public partial class UdiCarrierComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("deviceIdentifier", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// Mandatory fixed portion of UDI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -192,28 +192,25 @@ public string DeviceIdentifier /// [FhirElement("issuer", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// UDI Issuing Organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -223,28 +220,25 @@ public string Issuer /// [FhirElement("jurisdiction", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// Regional UDI authority /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } @@ -254,28 +248,25 @@ public string Jurisdiction /// [FhirElement("carrierAIDC", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Base64Binary CarrierAIDCElement + public Hl7.Fhir.Model.Base64Binary? CarrierAIDCElement { get { return _CarrierAIDCElement; } set { _CarrierAIDCElement = value; OnPropertyChanged("CarrierAIDCElement"); } } - private Hl7.Fhir.Model.Base64Binary _CarrierAIDCElement; + private Hl7.Fhir.Model.Base64Binary? _CarrierAIDCElement; /// /// UDI Machine Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] CarrierAIDC + public byte[]? CarrierAIDC { - get { return CarrierAIDCElement != null ? CarrierAIDCElement.Value : null; } + get => _CarrierAIDCElement?.Value; set { - if (value == null) - CarrierAIDCElement = null; - else - CarrierAIDCElement = new Hl7.Fhir.Model.Base64Binary(value); + CarrierAIDCElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("CarrierAIDC"); } } @@ -285,28 +276,25 @@ public byte[] CarrierAIDC /// [FhirElement("carrierHRF", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CarrierHRFElement + public Hl7.Fhir.Model.FhirString? CarrierHRFElement { get { return _CarrierHRFElement; } set { _CarrierHRFElement = value; OnPropertyChanged("CarrierHRFElement"); } } - private Hl7.Fhir.Model.FhirString _CarrierHRFElement; + private Hl7.Fhir.Model.FhirString? _CarrierHRFElement; /// /// UDI Human Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CarrierHRF + public string? CarrierHRF { - get { return CarrierHRFElement != null ? CarrierHRFElement.Value : null; } + get => _CarrierHRFElement?.Value; set { - if (value == null) - CarrierHRFElement = null; - else - CarrierHRFElement = new Hl7.Fhir.Model.FhirString(value); + CarrierHRFElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CarrierHRF"); } } @@ -318,13 +306,13 @@ public string CarrierHRF [DeclaredType(Type = typeof(Code))] [Binding("UDIEntryType")] [DataMember] - public Code EntryTypeElement + public Code? EntryTypeElement { get { return _EntryTypeElement; } set { _EntryTypeElement = value; OnPropertyChanged("EntryTypeElement"); } } - private Code _EntryTypeElement; + private Code? _EntryTypeElement; /// /// barcode | rfid | manual + @@ -333,33 +321,26 @@ public Code EntryTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.UDIEntryType? EntryType { - get { return EntryTypeElement != null ? EntryTypeElement.Value : null; } + get => _EntryTypeElement?.Value; set { - if (value == null) - EntryTypeElement = null; - else - EntryTypeElement = new Code(value); + EntryTypeElement = value is null ? null : new Code(value); OnPropertyChanged("EntryType"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UdiCarrierComponent; - - if (dest == null) - { + if(other is not UdiCarrierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); - if(CarrierAIDCElement != null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)CarrierAIDCElement.DeepCopyInternal(); - if(CarrierHRFElement != null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)CarrierHRFElement.DeepCopyInternal(); - if(EntryTypeElement != null) dest.EntryTypeElement = (Code)EntryTypeElement.DeepCopyInternal(); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); + if(_CarrierAIDCElement is not null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)_CarrierAIDCElement.DeepCopyInternal(); + if(_CarrierHRFElement is not null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)_CarrierHRFElement.DeepCopyInternal(); + if(_EntryTypeElement is not null) dest.EntryTypeElement = (Code)_EntryTypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -371,69 +352,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiCarrierComponent; - if(otherT == null) return false; + if(other is not UdiCarrierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; - if(!comparer.Equals(CarrierAIDCElement, otherT.CarrierAIDCElement)) return false; - if(!comparer.Equals(CarrierHRFElement, otherT.CarrierHRFElement)) return false; - if(!comparer.Equals(EntryTypeElement, otherT.EntryTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; + if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; + if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; + if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; case "carrierAIDC": - value = CarrierAIDCElement; - return CarrierAIDCElement is not null; + value = _CarrierAIDCElement; + return _CarrierAIDCElement is not null; case "carrierHRF": - value = CarrierHRFElement; - return CarrierHRFElement is not null; + value = _CarrierHRFElement; + return _CarrierHRFElement is not null; case "entryType": - value = EntryTypeElement; - return EntryTypeElement is not null; + value = _EntryTypeElement; + return _EntryTypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "carrierAIDC": - CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)value; + CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "carrierHRF": - CarrierHRFElement = (Hl7.Fhir.Model.FhirString)value; + CarrierHRFElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "entryType": - EntryTypeElement = (Code)value; + EntryTypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -444,12 +425,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); - if (CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",CarrierAIDCElement); - if (CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",CarrierHRFElement); - if (EntryTypeElement is not null) yield return new KeyValuePair("entryType",EntryTypeElement); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); + if (_CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",_CarrierAIDCElement); + if (_CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",_CarrierHRFElement); + if (_EntryTypeElement is not null) yield return new KeyValuePair("entryType",_EntryTypeElement); } } @@ -476,28 +457,25 @@ public partial class DeviceNameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name that identifies the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -510,13 +488,13 @@ public string Name [Binding("DeviceNameType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// udi-label-name | user-friendly-name | patient-reported-name | manufacturer-name | model-name | other @@ -525,29 +503,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceNameType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceNameComponent; - - if (dest == null) - { + if(other is not DeviceNameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -559,41 +530,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceNameComponent; - if(otherT == null) return false; + if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -604,8 +575,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -629,57 +600,50 @@ public partial class SpecializationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("systemType", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SystemType + public Hl7.Fhir.Model.CodeableConcept? SystemType { get { return _SystemType; } set { _SystemType = value; OnPropertyChanged("SystemType"); } } - private Hl7.Fhir.Model.CodeableConcept _SystemType; + private Hl7.Fhir.Model.CodeableConcept? _SystemType; /// /// The version of the standard that is used to operate and communicate. /// [FhirElement("version", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// The version of the standard that is used to operate and communicate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SpecializationComponent; - - if (dest == null) - { + if(other is not SpecializationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemType != null) dest.SystemType = (Hl7.Fhir.Model.CodeableConcept)SystemType.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_SystemType is not null) dest.SystemType = (Hl7.Fhir.Model.CodeableConcept)_SystemType.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -691,41 +655,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecializationComponent; - if(otherT == null) return false; + if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemType, otherT.SystemType)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemType, otherT._SystemType)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "systemType": - value = SystemType; - return SystemType is not null; + value = _SystemType; + return _SystemType is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "systemType": - SystemType = (Hl7.Fhir.Model.CodeableConcept)value; + SystemType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -736,8 +700,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemType is not null) yield return new KeyValuePair("systemType",SystemType); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_SystemType is not null) yield return new KeyValuePair("systemType",_SystemType); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -760,26 +724,26 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A single component of the device version. /// [FhirElement("component", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Identifier Component + public Hl7.Fhir.Model.Identifier? Component { get { return _Component; } set { _Component = value; OnPropertyChanged("Component"); } } - private Hl7.Fhir.Model.Identifier _Component; + private Hl7.Fhir.Model.Identifier? _Component; /// /// The version text. @@ -787,45 +751,38 @@ public Hl7.Fhir.Model.Identifier Component [FhirElement("value", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The version text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Component != null) dest.Component = (Hl7.Fhir.Model.Identifier)Component.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Component is not null) dest.Component = (Hl7.Fhir.Model.Identifier)_Component.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -837,48 +794,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Component, otherT.Component)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Component, otherT._Component)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "component": - value = Component; - return Component is not null; + value = _Component; + return _Component is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "component": - Component = (Hl7.Fhir.Model.Identifier)value; + Component = (Hl7.Fhir.Model.Identifier?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -889,9 +846,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Component is not null) yield return new KeyValuePair("component",Component); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Component is not null) yield return new KeyValuePair("component",_Component); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -915,13 +872,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Property value as a quantity. @@ -931,11 +888,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List ValueQuantity { - get { if(_ValueQuantity==null) _ValueQuantity = new List(); return _ValueQuantity; } + get => _ValueQuantity ?? new List(); set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } - private List _ValueQuantity; + private List? _ValueQuantity; /// /// Property value as a code, e.g., NTP4 (synced to NTP). @@ -945,25 +902,21 @@ public List ValueQuantity [DataMember] public List ValueCode { - get { if(_ValueCode==null) _ValueCode = new List(); return _ValueCode; } + get => _ValueCode ?? new List(); set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } - private List _ValueCode; + private List? _ValueCode; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueQuantity.Any()) dest.ValueQuantity = new List(ValueQuantity.DeepCopyInternal()); - if(ValueCode.Any()) dest.ValueCode = new List(ValueCode.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueQuantity is not null) dest.ValueQuantity = new List(_ValueQuantity.DeepCopyInternal()); + if(_ValueCode is not null) dest.ValueCode = new List(_ValueCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -975,48 +928,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(ValueQuantity, otherT.ValueQuantity)) return false; - if(!comparer.ListEquals(ValueCode, otherT.ValueCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; + if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "valueQuantity": - value = ValueQuantity; - return ValueQuantity?.Any() == true; + value = _ValueQuantity; + return _ValueQuantity?.Any() == true; case "valueCode": - value = ValueCode; - return ValueCode?.Any() == true; + value = _ValueCode; + return _ValueCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "valueQuantity": - ValueQuantity = (List)value; + ValueQuantity = (List?)value!; return this; case "valueCode": - ValueCode = (List)value; + ValueCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1027,9 +980,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",ValueQuantity); - if (ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",ValueCode); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",_ValueQuantity); + if (_ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",_ValueCode); } } @@ -1042,11 +995,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The reference to the definition for the device. @@ -1055,13 +1008,13 @@ public List Identifier [CLSCompliant(false)] [References("DeviceDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; /// /// Unique Device Identifier (UDI) Barcode string. @@ -1071,11 +1024,11 @@ public Hl7.Fhir.Model.ResourceReference Definition [DataMember] public List UdiCarrier { - get { if(_UdiCarrier==null) _UdiCarrier = new List(); return _UdiCarrier; } + get => _UdiCarrier ?? new List(); set { _UdiCarrier = value; OnPropertyChanged("UdiCarrier"); } } - private List _UdiCarrier; + private List? _UdiCarrier; /// /// active | inactive | entered-in-error | unknown. @@ -1084,13 +1037,13 @@ public List UdiCarrier [DeclaredType(Type = typeof(Code))] [Binding("FHIRDeviceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error | unknown @@ -1099,13 +1052,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1119,39 +1069,36 @@ public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// The distinct identification string. /// [FhirElement("distinctIdentifier", Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DistinctIdentifierElement + public Hl7.Fhir.Model.FhirString? DistinctIdentifierElement { get { return _DistinctIdentifierElement; } set { _DistinctIdentifierElement = value; OnPropertyChanged("DistinctIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DistinctIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DistinctIdentifierElement; /// /// The distinct identification string /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DistinctIdentifier + public string? DistinctIdentifier { - get { return DistinctIdentifierElement != null ? DistinctIdentifierElement.Value : null; } + get => _DistinctIdentifierElement?.Value; set { - if (value == null) - DistinctIdentifierElement = null; - else - DistinctIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DistinctIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DistinctIdentifier"); } } @@ -1161,28 +1108,25 @@ public string DistinctIdentifier /// [FhirElement("manufacturer", Order=150, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ManufacturerElement + public Hl7.Fhir.Model.FhirString? ManufacturerElement { get { return _ManufacturerElement; } set { _ManufacturerElement = value; OnPropertyChanged("ManufacturerElement"); } } - private Hl7.Fhir.Model.FhirString _ManufacturerElement; + private Hl7.Fhir.Model.FhirString? _ManufacturerElement; /// /// Name of device manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Manufacturer + public string? Manufacturer { - get { return ManufacturerElement != null ? ManufacturerElement.Value : null; } + get => _ManufacturerElement?.Value; set { - if (value == null) - ManufacturerElement = null; - else - ManufacturerElement = new Hl7.Fhir.Model.FhirString(value); + ManufacturerElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Manufacturer"); } } @@ -1192,28 +1136,25 @@ public string Manufacturer /// [FhirElement("manufactureDate", Order=160, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ManufactureDateElement + public Hl7.Fhir.Model.FhirDateTime? ManufactureDateElement { get { return _ManufactureDateElement; } set { _ManufactureDateElement = value; OnPropertyChanged("ManufactureDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ManufactureDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ManufactureDateElement; /// /// Date when the device was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ManufactureDate + public string? ManufactureDate { - get { return ManufactureDateElement != null ? ManufactureDateElement.Value : null; } + get => _ManufactureDateElement?.Value; set { - if (value == null) - ManufactureDateElement = null; - else - ManufactureDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ManufactureDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ManufactureDate"); } } @@ -1223,28 +1164,25 @@ public string ManufactureDate /// [FhirElement("expirationDate", Order=170, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// Date and time of expiry of this device (if applicable) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } @@ -1254,28 +1192,25 @@ public string ExpirationDate /// [FhirElement("lotNumber", Order=180, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Lot number of manufacture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -1285,28 +1220,25 @@ public string LotNumber /// [FhirElement("serialNumber", Order=190, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString SerialNumberElement + public Hl7.Fhir.Model.FhirString? SerialNumberElement { get { return _SerialNumberElement; } set { _SerialNumberElement = value; OnPropertyChanged("SerialNumberElement"); } } - private Hl7.Fhir.Model.FhirString _SerialNumberElement; + private Hl7.Fhir.Model.FhirString? _SerialNumberElement; /// /// Serial number assigned by the manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SerialNumber + public string? SerialNumber { - get { return SerialNumberElement != null ? SerialNumberElement.Value : null; } + get => _SerialNumberElement?.Value; set { - if (value == null) - SerialNumberElement = null; - else - SerialNumberElement = new Hl7.Fhir.Model.FhirString(value); + SerialNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SerialNumber"); } } @@ -1319,39 +1251,36 @@ public string SerialNumber [DataMember] public List DeviceName { - get { if(_DeviceName==null) _DeviceName = new List(); return _DeviceName; } + get => _DeviceName ?? new List(); set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } - private List _DeviceName; + private List? _DeviceName; /// /// The manufacturer's model number for the device. /// [FhirElement("modelNumber", Order=210, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ModelNumberElement + public Hl7.Fhir.Model.FhirString? ModelNumberElement { get { return _ModelNumberElement; } set { _ModelNumberElement = value; OnPropertyChanged("ModelNumberElement"); } } - private Hl7.Fhir.Model.FhirString _ModelNumberElement; + private Hl7.Fhir.Model.FhirString? _ModelNumberElement; /// /// The manufacturer's model number for the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ModelNumber + public string? ModelNumber { - get { return ModelNumberElement != null ? ModelNumberElement.Value : null; } + get => _ModelNumberElement?.Value; set { - if (value == null) - ModelNumberElement = null; - else - ModelNumberElement = new Hl7.Fhir.Model.FhirString(value); + ModelNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ModelNumber"); } } @@ -1361,28 +1290,25 @@ public string ModelNumber /// [FhirElement("partNumber", Order=220, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString PartNumberElement + public Hl7.Fhir.Model.FhirString? PartNumberElement { get { return _PartNumberElement; } set { _PartNumberElement = value; OnPropertyChanged("PartNumberElement"); } } - private Hl7.Fhir.Model.FhirString _PartNumberElement; + private Hl7.Fhir.Model.FhirString? _PartNumberElement; /// /// The part number or catalog number of the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PartNumber + public string? PartNumber { - get { return PartNumberElement != null ? PartNumberElement.Value : null; } + get => _PartNumberElement?.Value; set { - if (value == null) - PartNumberElement = null; - else - PartNumberElement = new Hl7.Fhir.Model.FhirString(value); + PartNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PartNumber"); } } @@ -1393,13 +1319,13 @@ public string PartNumber [FhirElement("type", Order=230)] [Binding("DeviceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The capabilities supported on a device, the standards to which the device conforms for a particular purpose, and used for the communication. @@ -1409,11 +1335,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Specialization { - get { if(_Specialization==null) _Specialization = new List(); return _Specialization; } + get => _Specialization ?? new List(); set { _Specialization = value; OnPropertyChanged("Specialization"); } } - private List _Specialization; + private List? _Specialization; /// /// The actual design of the device or software version running on the device. @@ -1423,11 +1349,11 @@ public List Specialization [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties. @@ -1437,11 +1363,11 @@ public List Version [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Patient to whom Device is affixed. @@ -1450,13 +1376,13 @@ public List Property [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Organization responsible for device. @@ -1465,13 +1391,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Details for human/organization for support. @@ -1481,11 +1407,11 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Where the device is found. @@ -1494,41 +1420,38 @@ public List Contact [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Network address to contact device. /// [FhirElement("url", Order=310, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Network address to contact device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1541,11 +1464,11 @@ public string Url [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Safety Characteristics of Device. @@ -1555,11 +1478,11 @@ public List Note [DataMember] public List Safety { - get { if(_Safety==null) _Safety = new List(); return _Safety; } + get => _Safety ?? new List(); set { _Safety = value; OnPropertyChanged("Safety"); } } - private List _Safety; + private List? _Safety; /// /// The device that this device is attached to or is part of. @@ -1568,52 +1491,48 @@ public List Safety [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Device; - - if (dest == null) - { + if(other is not Device dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); - if(UdiCarrier.Any()) dest.UdiCarrier = new List(UdiCarrier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(DistinctIdentifierElement != null) dest.DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString)DistinctIdentifierElement.DeepCopyInternal(); - if(ManufacturerElement != null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)ManufacturerElement.DeepCopyInternal(); - if(ManufactureDateElement != null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)ManufactureDateElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(SerialNumberElement != null) dest.SerialNumberElement = (Hl7.Fhir.Model.FhirString)SerialNumberElement.DeepCopyInternal(); - if(DeviceName.Any()) dest.DeviceName = new List(DeviceName.DeepCopyInternal()); - if(ModelNumberElement != null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)ModelNumberElement.DeepCopyInternal(); - if(PartNumberElement != null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)PartNumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Specialization.Any()) dest.Specialization = new List(Specialization.DeepCopyInternal()); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Safety.Any()) dest.Safety = new List(Safety.DeepCopyInternal()); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); + if(_UdiCarrier is not null) dest.UdiCarrier = new List(_UdiCarrier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_DistinctIdentifierElement is not null) dest.DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString)_DistinctIdentifierElement.DeepCopyInternal(); + if(_ManufacturerElement is not null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)_ManufacturerElement.DeepCopyInternal(); + if(_ManufactureDateElement is not null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)_ManufactureDateElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_SerialNumberElement is not null) dest.SerialNumberElement = (Hl7.Fhir.Model.FhirString)_SerialNumberElement.DeepCopyInternal(); + if(_DeviceName is not null) dest.DeviceName = new List(_DeviceName.DeepCopyInternal()); + if(_ModelNumberElement is not null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)_ModelNumberElement.DeepCopyInternal(); + if(_PartNumberElement is not null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)_PartNumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Specialization is not null) dest.Specialization = new List(_Specialization.DeepCopyInternal()); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Safety is not null) dest.Safety = new List(_Safety.DeepCopyInternal()); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1625,209 +1544,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Device; - if(otherT == null) return false; + if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(UdiCarrier, otherT.UdiCarrier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(DistinctIdentifierElement, otherT.DistinctIdentifierElement)) return false; - if(!comparer.Equals(ManufacturerElement, otherT.ManufacturerElement)) return false; - if(!comparer.Equals(ManufactureDateElement, otherT.ManufactureDateElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(SerialNumberElement, otherT.SerialNumberElement)) return false; - if(!comparer.ListEquals(DeviceName, otherT.DeviceName)) return false; - if(!comparer.Equals(ModelNumberElement, otherT.ModelNumberElement)) return false; - if(!comparer.Equals(PartNumberElement, otherT.PartNumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialization, otherT.Specialization)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Safety, otherT.Safety)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_UdiCarrier, otherT._UdiCarrier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_DistinctIdentifierElement, otherT._DistinctIdentifierElement)) return false; + if(!comparer.Equals(_ManufacturerElement, otherT._ManufacturerElement)) return false; + if(!comparer.Equals(_ManufactureDateElement, otherT._ManufactureDateElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_SerialNumberElement, otherT._SerialNumberElement)) return false; + if(!comparer.ListEquals(_DeviceName, otherT._DeviceName)) return false; + if(!comparer.Equals(_ModelNumberElement, otherT._ModelNumberElement)) return false; + if(!comparer.Equals(_PartNumberElement, otherT._PartNumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialization, otherT._Specialization)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "udiCarrier": - value = UdiCarrier; - return UdiCarrier?.Any() == true; + value = _UdiCarrier; + return _UdiCarrier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "distinctIdentifier": - value = DistinctIdentifierElement; - return DistinctIdentifierElement is not null; + value = _DistinctIdentifierElement; + return _DistinctIdentifierElement is not null; case "manufacturer": - value = ManufacturerElement; - return ManufacturerElement is not null; + value = _ManufacturerElement; + return _ManufacturerElement is not null; case "manufactureDate": - value = ManufactureDateElement; - return ManufactureDateElement is not null; + value = _ManufactureDateElement; + return _ManufactureDateElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "serialNumber": - value = SerialNumberElement; - return SerialNumberElement is not null; + value = _SerialNumberElement; + return _SerialNumberElement is not null; case "deviceName": - value = DeviceName; - return DeviceName?.Any() == true; + value = _DeviceName; + return _DeviceName?.Any() == true; case "modelNumber": - value = ModelNumberElement; - return ModelNumberElement is not null; + value = _ModelNumberElement; + return _ModelNumberElement is not null; case "partNumber": - value = PartNumberElement; - return PartNumberElement is not null; + value = _PartNumberElement; + return _PartNumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "specialization": - value = Specialization; - return Specialization?.Any() == true; + value = _Specialization; + return _Specialization?.Any() == true; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "safety": - value = Safety; - return Safety?.Any() == true; + value = _Safety; + return _Safety?.Any() == true; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "udiCarrier": - UdiCarrier = (List)value; + UdiCarrier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "distinctIdentifier": - DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DistinctIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufacturer": - ManufacturerElement = (Hl7.Fhir.Model.FhirString)value; + ManufacturerElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufactureDate": - ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "serialNumber": - SerialNumberElement = (Hl7.Fhir.Model.FhirString)value; + SerialNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "deviceName": - DeviceName = (List)value; + DeviceName = (List?)value!; return this; case "modelNumber": - ModelNumberElement = (Hl7.Fhir.Model.FhirString)value; + ModelNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "partNumber": - PartNumberElement = (Hl7.Fhir.Model.FhirString)value; + PartNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialization": - Specialization = (List)value; + Specialization = (List?)value!; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "safety": - Safety = (List)value; + Safety = (List?)value!; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1838,32 +1757,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (UdiCarrier?.Any() == true) yield return new KeyValuePair("udiCarrier",UdiCarrier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (DistinctIdentifierElement is not null) yield return new KeyValuePair("distinctIdentifier",DistinctIdentifierElement); - if (ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",ManufacturerElement); - if (ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",ManufactureDateElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (SerialNumberElement is not null) yield return new KeyValuePair("serialNumber",SerialNumberElement); - if (DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",DeviceName); - if (ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",ModelNumberElement); - if (PartNumberElement is not null) yield return new KeyValuePair("partNumber",PartNumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Specialization?.Any() == true) yield return new KeyValuePair("specialization",Specialization); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Safety?.Any() == true) yield return new KeyValuePair("safety",Safety); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_UdiCarrier?.Any() == true) yield return new KeyValuePair("udiCarrier",_UdiCarrier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_DistinctIdentifierElement is not null) yield return new KeyValuePair("distinctIdentifier",_DistinctIdentifierElement); + if (_ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",_ManufacturerElement); + if (_ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",_ManufactureDateElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_SerialNumberElement is not null) yield return new KeyValuePair("serialNumber",_SerialNumberElement); + if (_DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",_DeviceName); + if (_ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",_ModelNumberElement); + if (_PartNumberElement is not null) yield return new KeyValuePair("partNumber",_PartNumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Specialization?.Any() == true) yield return new KeyValuePair("specialization",_Specialization); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Safety?.Any() == true) yield return new KeyValuePair("safety",_Safety); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs index bdf3912fc..62edf6207 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,28 +85,25 @@ public partial class UdiDeviceIdentifierComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("deviceIdentifier", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdication porvided in the DeviceDefinition.udiDeviceIdentifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -114,28 +114,25 @@ public string DeviceIdentifier [FhirElement("issuer", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// The organization that assigns the identifier algorithm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -146,45 +143,38 @@ public string Issuer [FhirElement("jurisdiction", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// The jurisdiction to which the deviceIdentifier applies /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UdiDeviceIdentifierComponent; - - if (dest == null) - { + if(other is not UdiDeviceIdentifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -196,48 +186,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiDeviceIdentifierComponent; - if(otherT == null) return false; + if(other is not UdiDeviceIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -248,9 +238,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); } } @@ -274,28 +264,25 @@ public partial class DeviceNameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name of the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -308,13 +295,13 @@ public string Name [Binding("DeviceNameType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// udi-label-name | user-friendly-name | patient-reported-name | manufacturer-name | model-name | other @@ -323,29 +310,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceNameType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceNameComponent; - - if (dest == null) - { + if(other is not DeviceNameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -357,41 +337,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceNameComponent; - if(otherT == null) return false; + if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -402,8 +382,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -427,28 +407,25 @@ public partial class SpecializationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("systemType", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SystemTypeElement + public Hl7.Fhir.Model.FhirString? SystemTypeElement { get { return _SystemTypeElement; } set { _SystemTypeElement = value; OnPropertyChanged("SystemTypeElement"); } } - private Hl7.Fhir.Model.FhirString _SystemTypeElement; + private Hl7.Fhir.Model.FhirString? _SystemTypeElement; /// /// The standard that is used to operate and communicate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SystemType + public string? SystemType { - get { return SystemTypeElement != null ? SystemTypeElement.Value : null; } + get => _SystemTypeElement?.Value; set { - if (value == null) - SystemTypeElement = null; - else - SystemTypeElement = new Hl7.Fhir.Model.FhirString(value); + SystemTypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SystemType"); } } @@ -458,44 +435,37 @@ public string SystemType /// [FhirElement("version", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// The version of the standard that is used to operate and communicate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SpecializationComponent; - - if (dest == null) - { + if(other is not SpecializationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SystemTypeElement != null) dest.SystemTypeElement = (Hl7.Fhir.Model.FhirString)SystemTypeElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_SystemTypeElement is not null) dest.SystemTypeElement = (Hl7.Fhir.Model.FhirString)_SystemTypeElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -507,41 +477,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecializationComponent; - if(otherT == null) return false; + if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SystemTypeElement, otherT.SystemTypeElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemTypeElement, otherT._SystemTypeElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "systemType": - value = SystemTypeElement; - return SystemTypeElement is not null; + value = _SystemTypeElement; + return _SystemTypeElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "systemType": - SystemTypeElement = (Hl7.Fhir.Model.FhirString)value; + SystemTypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -552,8 +522,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SystemTypeElement is not null) yield return new KeyValuePair("systemType",SystemTypeElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_SystemTypeElement is not null) yield return new KeyValuePair("systemType",_SystemTypeElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -577,13 +547,13 @@ public partial class CapabilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Description of capability. @@ -593,24 +563,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Description { - get { if(_Description==null) _Description = new List(); return _Description; } + get => _Description ?? new List(); set { _Description = value; OnPropertyChanged("Description"); } } - private List _Description; + private List? _Description; protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityComponent; - - if (dest == null) - { + if(other is not CapabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Description.Any()) dest.Description = new List(Description.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Description is not null) dest.Description = new List(_Description.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -622,41 +588,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityComponent; - if(otherT == null) return false; + if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Description, otherT.Description)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Description, otherT._Description)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = Description; - return Description?.Any() == true; + value = _Description; + return _Description?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (List)value; + Description = (List?)value!; return this; default: return base.SetValue(key, value); @@ -667,8 +633,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Description?.Any() == true) yield return new KeyValuePair("description",Description); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Description?.Any() == true) yield return new KeyValuePair("description",_Description); } } @@ -692,13 +658,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Property value as a quantity. @@ -708,11 +674,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List ValueQuantity { - get { if(_ValueQuantity==null) _ValueQuantity = new List(); return _ValueQuantity; } + get => _ValueQuantity ?? new List(); set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } - private List _ValueQuantity; + private List? _ValueQuantity; /// /// Property value as a code, e.g., NTP4 (synced to NTP). @@ -722,25 +688,21 @@ public List ValueQuantity [DataMember] public List ValueCode { - get { if(_ValueCode==null) _ValueCode = new List(); return _ValueCode; } + get => _ValueCode ?? new List(); set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } - private List _ValueCode; + private List? _ValueCode; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueQuantity.Any()) dest.ValueQuantity = new List(ValueQuantity.DeepCopyInternal()); - if(ValueCode.Any()) dest.ValueCode = new List(ValueCode.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueQuantity is not null) dest.ValueQuantity = new List(_ValueQuantity.DeepCopyInternal()); + if(_ValueCode is not null) dest.ValueCode = new List(_ValueCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -752,48 +714,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(ValueQuantity, otherT.ValueQuantity)) return false; - if(!comparer.ListEquals(ValueCode, otherT.ValueCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; + if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "valueQuantity": - value = ValueQuantity; - return ValueQuantity?.Any() == true; + value = _ValueQuantity; + return _ValueQuantity?.Any() == true; case "valueCode": - value = ValueCode; - return ValueCode?.Any() == true; + value = _ValueCode; + return _ValueCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "valueQuantity": - ValueQuantity = (List)value; + ValueQuantity = (List?)value!; return this; case "valueCode": - ValueCode = (List)value; + ValueCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -804,9 +766,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",ValueQuantity); - if (ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",ValueCode); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",_ValueQuantity); + if (_ValueCode?.Any() == true) yield return new KeyValuePair("valueCode",_ValueCode); } } @@ -830,26 +792,26 @@ public partial class MaterialComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Indicates an alternative material of the device. /// [FhirElement("alternate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AlternateElement + public Hl7.Fhir.Model.FhirBoolean? AlternateElement { get { return _AlternateElement; } set { _AlternateElement = value; OnPropertyChanged("AlternateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AlternateElement; + private Hl7.Fhir.Model.FhirBoolean? _AlternateElement; /// /// Indicates an alternative material of the device @@ -858,13 +820,10 @@ public Hl7.Fhir.Model.FhirBoolean AlternateElement [IgnoreDataMember] public bool? Alternate { - get { return AlternateElement != null ? AlternateElement.Value : null; } + get => _AlternateElement?.Value; set { - if (value == null) - AlternateElement = null; - else - AlternateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AlternateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Alternate"); } } @@ -874,13 +833,13 @@ public bool? Alternate /// [FhirElement("allergenicIndicator", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? AllergenicIndicatorElement { get { return _AllergenicIndicatorElement; } set { _AllergenicIndicatorElement = value; OnPropertyChanged("AllergenicIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllergenicIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _AllergenicIndicatorElement; /// /// Whether the substance is a known or suspected allergen @@ -889,30 +848,23 @@ public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement [IgnoreDataMember] public bool? AllergenicIndicator { - get { return AllergenicIndicatorElement != null ? AllergenicIndicatorElement.Value : null; } + get => _AllergenicIndicatorElement?.Value; set { - if (value == null) - AllergenicIndicatorElement = null; - else - AllergenicIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllergenicIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllergenicIndicator"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MaterialComponent; - - if (dest == null) - { + if(other is not MaterialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(AlternateElement != null) dest.AlternateElement = (Hl7.Fhir.Model.FhirBoolean)AlternateElement.DeepCopyInternal(); - if(AllergenicIndicatorElement != null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)AllergenicIndicatorElement.DeepCopyInternal(); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_AlternateElement is not null) dest.AlternateElement = (Hl7.Fhir.Model.FhirBoolean)_AlternateElement.DeepCopyInternal(); + if(_AllergenicIndicatorElement is not null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_AllergenicIndicatorElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -924,48 +876,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MaterialComponent; - if(otherT == null) return false; + if(other is not MaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.Equals(AlternateElement, otherT.AlternateElement)) return false; - if(!comparer.Equals(AllergenicIndicatorElement, otherT.AllergenicIndicatorElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.Equals(_AlternateElement, otherT._AlternateElement)) return false; + if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "alternate": - value = AlternateElement; - return AlternateElement is not null; + value = _AlternateElement; + return _AlternateElement is not null; case "allergenicIndicator": - value = AllergenicIndicatorElement; - return AllergenicIndicatorElement is not null; + value = _AllergenicIndicatorElement; + return _AllergenicIndicatorElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "alternate": - AlternateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AlternateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "allergenicIndicator": - AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -976,9 +928,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (AlternateElement is not null) yield return new KeyValuePair("alternate",AlternateElement); - if (AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",AllergenicIndicatorElement); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_AlternateElement is not null) yield return new KeyValuePair("alternate",_AlternateElement); + if (_AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",_AllergenicIndicatorElement); } } @@ -991,11 +943,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Unique Device Identifier (UDI) Barcode string. @@ -1005,11 +957,11 @@ public List Identifier [DataMember] public List UdiDeviceIdentifier { - get { if(_UdiDeviceIdentifier==null) _UdiDeviceIdentifier = new List(); return _UdiDeviceIdentifier; } + get => _UdiDeviceIdentifier ?? new List(); set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } - private List _UdiDeviceIdentifier; + private List? _UdiDeviceIdentifier; /// /// Name of device manufacturer. @@ -1019,13 +971,13 @@ public List UdiDev [References("Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Manufacturer + public Hl7.Fhir.Model.DataType? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.DataType _Manufacturer; + private Hl7.Fhir.Model.DataType? _Manufacturer; /// /// A name given to the device to identify it. @@ -1035,39 +987,36 @@ public Hl7.Fhir.Model.DataType Manufacturer [DataMember] public List DeviceName { - get { if(_DeviceName==null) _DeviceName = new List(); return _DeviceName; } + get => _DeviceName ?? new List(); set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } - private List _DeviceName; + private List? _DeviceName; /// /// The model number for the device. /// [FhirElement("modelNumber", Order=130, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ModelNumberElement + public Hl7.Fhir.Model.FhirString? ModelNumberElement { get { return _ModelNumberElement; } set { _ModelNumberElement = value; OnPropertyChanged("ModelNumberElement"); } } - private Hl7.Fhir.Model.FhirString _ModelNumberElement; + private Hl7.Fhir.Model.FhirString? _ModelNumberElement; /// /// The model number for the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ModelNumber + public string? ModelNumber { - get { return ModelNumberElement != null ? ModelNumberElement.Value : null; } + get => _ModelNumberElement?.Value; set { - if (value == null) - ModelNumberElement = null; - else - ModelNumberElement = new Hl7.Fhir.Model.FhirString(value); + ModelNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ModelNumber"); } } @@ -1078,13 +1027,13 @@ public string ModelNumber [FhirElement("type", Order=140)] [Binding("DeviceKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The capabilities supported on a device, the standards to which the device conforms for a particular purpose, and used for the communication. @@ -1094,11 +1043,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Specialization { - get { if(_Specialization==null) _Specialization = new List(); return _Specialization; } + get => _Specialization ?? new List(); set { _Specialization = value; OnPropertyChanged("Specialization"); } } - private List _Specialization; + private List? _Specialization; /// /// Available versions. @@ -1108,24 +1057,24 @@ public List Specializat [DataMember] public List VersionElement { - get { if(_VersionElement==null) _VersionElement = new List(); return _VersionElement; } + get => _VersionElement ?? new List(); set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private List _VersionElement; + private List? _VersionElement; /// /// Available versions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Version + public IEnumerable? Version { - get { return VersionElement != null ? VersionElement.Select(elem => elem.Value) : null; } + get => _VersionElement?.Select(elem => elem.Value); set { if (value == null) - VersionElement = null; + VersionElement = null!; else VersionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Version"); @@ -1141,11 +1090,11 @@ public IEnumerable Version [DataMember] public List Safety { - get { if(_Safety==null) _Safety = new List(); return _Safety; } + get => _Safety ?? new List(); set { _Safety = value; OnPropertyChanged("Safety"); } } - private List _Safety; + private List? _Safety; /// /// Shelf Life and storage information. @@ -1155,24 +1104,24 @@ public List Safety [DataMember] public List ShelfLifeStorage { - get { if(_ShelfLifeStorage==null) _ShelfLifeStorage = new List(); return _ShelfLifeStorage; } + get => _ShelfLifeStorage ?? new List(); set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } - private List _ShelfLifeStorage; + private List? _ShelfLifeStorage; /// /// Dimensions, color etc. /// [FhirElement("physicalCharacteristics", Order=190)] [DataMember] - public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics + public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics { get { return _PhysicalCharacteristics; } set { _PhysicalCharacteristics = value; OnPropertyChanged("PhysicalCharacteristics"); } } - private Hl7.Fhir.Model.ProdCharacteristic _PhysicalCharacteristics; + private Hl7.Fhir.Model.ProdCharacteristic? _PhysicalCharacteristics; /// /// Language code for the human-readable text strings produced by the device (all supported). @@ -1182,11 +1131,11 @@ public Hl7.Fhir.Model.ProdCharacteristic PhysicalCharacteristics [DataMember] public List LanguageCode { - get { if(_LanguageCode==null) _LanguageCode = new List(); return _LanguageCode; } + get => _LanguageCode ?? new List(); set { _LanguageCode = value; OnPropertyChanged("LanguageCode"); } } - private List _LanguageCode; + private List? _LanguageCode; /// /// Device capabilities. @@ -1196,11 +1145,11 @@ public List LanguageCode [DataMember] public List Capability { - get { if(_Capability==null) _Capability = new List(); return _Capability; } + get => _Capability ?? new List(); set { _Capability = value; OnPropertyChanged("Capability"); } } - private List _Capability; + private List? _Capability; /// /// The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties. @@ -1210,11 +1159,11 @@ public List Capability [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Organization responsible for device. @@ -1223,13 +1172,13 @@ public List Property [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Details for human/organization for support. @@ -1239,39 +1188,36 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Network address to contact device. /// [FhirElement("url", Order=250, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Network address to contact device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1281,28 +1227,25 @@ public string Url /// [FhirElement("onlineInformation", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirUri OnlineInformationElement + public Hl7.Fhir.Model.FhirUri? OnlineInformationElement { get { return _OnlineInformationElement; } set { _OnlineInformationElement = value; OnPropertyChanged("OnlineInformationElement"); } } - private Hl7.Fhir.Model.FhirUri _OnlineInformationElement; + private Hl7.Fhir.Model.FhirUri? _OnlineInformationElement; /// /// Access to on-line information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OnlineInformation + public string? OnlineInformation { - get { return OnlineInformationElement != null ? OnlineInformationElement.Value : null; } + get => _OnlineInformationElement?.Value; set { - if (value == null) - OnlineInformationElement = null; - else - OnlineInformationElement = new Hl7.Fhir.Model.FhirUri(value); + OnlineInformationElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("OnlineInformation"); } } @@ -1315,24 +1258,24 @@ public string OnlineInformation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The quantity of the device present in the packaging (e.g. the number of devices present in a pack, or the number of devices in the same package of the medicinal product). /// [FhirElement("quantity", Order=280)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The parent device it can be part of. @@ -1341,13 +1284,13 @@ public Hl7.Fhir.Model.Quantity Quantity [CLSCompliant(false)] [References("DeviceDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ParentDevice + public Hl7.Fhir.Model.ResourceReference? ParentDevice { get { return _ParentDevice; } set { _ParentDevice = value; OnPropertyChanged("ParentDevice"); } } - private Hl7.Fhir.Model.ResourceReference _ParentDevice; + private Hl7.Fhir.Model.ResourceReference? _ParentDevice; /// /// A substance used to create the material(s) of which the device is made. @@ -1357,46 +1300,42 @@ public Hl7.Fhir.Model.ResourceReference ParentDevice [DataMember] public List Material { - get { if(_Material==null) _Material = new List(); return _Material; } + get => _Material ?? new List(); set { _Material = value; OnPropertyChanged("Material"); } } - private List _Material; + private List? _Material; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceDefinition; - - if (dest == null) - { + if(other is not DeviceDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(UdiDeviceIdentifier.Any()) dest.UdiDeviceIdentifier = new List(UdiDeviceIdentifier.DeepCopyInternal()); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.DataType)Manufacturer.DeepCopyInternal(); - if(DeviceName.Any()) dest.DeviceName = new List(DeviceName.DeepCopyInternal()); - if(ModelNumberElement != null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)ModelNumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Specialization.Any()) dest.Specialization = new List(Specialization.DeepCopyInternal()); - if(VersionElement.Any()) dest.VersionElement = new List(VersionElement.DeepCopyInternal()); - if(Safety.Any()) dest.Safety = new List(Safety.DeepCopyInternal()); - if(ShelfLifeStorage.Any()) dest.ShelfLifeStorage = new List(ShelfLifeStorage.DeepCopyInternal()); - if(PhysicalCharacteristics != null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)PhysicalCharacteristics.DeepCopyInternal(); - if(LanguageCode.Any()) dest.LanguageCode = new List(LanguageCode.DeepCopyInternal()); - if(Capability.Any()) dest.Capability = new List(Capability.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(OnlineInformationElement != null) dest.OnlineInformationElement = (Hl7.Fhir.Model.FhirUri)OnlineInformationElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ParentDevice != null) dest.ParentDevice = (Hl7.Fhir.Model.ResourceReference)ParentDevice.DeepCopyInternal(); - if(Material.Any()) dest.Material = new List(Material.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_UdiDeviceIdentifier is not null) dest.UdiDeviceIdentifier = new List(_UdiDeviceIdentifier.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.DataType)_Manufacturer.DeepCopyInternal(); + if(_DeviceName is not null) dest.DeviceName = new List(_DeviceName.DeepCopyInternal()); + if(_ModelNumberElement is not null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)_ModelNumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Specialization is not null) dest.Specialization = new List(_Specialization.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = new List(_VersionElement.DeepCopyInternal()); + if(_Safety is not null) dest.Safety = new List(_Safety.DeepCopyInternal()); + if(_ShelfLifeStorage is not null) dest.ShelfLifeStorage = new List(_ShelfLifeStorage.DeepCopyInternal()); + if(_PhysicalCharacteristics is not null) dest.PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)_PhysicalCharacteristics.DeepCopyInternal(); + if(_LanguageCode is not null) dest.LanguageCode = new List(_LanguageCode.DeepCopyInternal()); + if(_Capability is not null) dest.Capability = new List(_Capability.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_OnlineInformationElement is not null) dest.OnlineInformationElement = (Hl7.Fhir.Model.FhirUri)_OnlineInformationElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ParentDevice is not null) dest.ParentDevice = (Hl7.Fhir.Model.ResourceReference)_ParentDevice.DeepCopyInternal(); + if(_Material is not null) dest.Material = new List(_Material.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1408,181 +1347,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceDefinition; - if(otherT == null) return false; + if(other is not DeviceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(UdiDeviceIdentifier, otherT.UdiDeviceIdentifier)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(DeviceName, otherT.DeviceName)) return false; - if(!comparer.Equals(ModelNumberElement, otherT.ModelNumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialization, otherT.Specialization)) return false; - if(!comparer.ListEquals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.ListEquals(Safety, otherT.Safety)) return false; - if(!comparer.ListEquals(ShelfLifeStorage, otherT.ShelfLifeStorage)) return false; - if(!comparer.Equals(PhysicalCharacteristics, otherT.PhysicalCharacteristics)) return false; - if(!comparer.ListEquals(LanguageCode, otherT.LanguageCode)) return false; - if(!comparer.ListEquals(Capability, otherT.Capability)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(OnlineInformationElement, otherT.OnlineInformationElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ParentDevice, otherT.ParentDevice)) return false; - if(!comparer.ListEquals(Material, otherT.Material)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_DeviceName, otherT._DeviceName)) return false; + if(!comparer.Equals(_ModelNumberElement, otherT._ModelNumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialization, otherT._Specialization)) return false; + if(!comparer.ListEquals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; + if(!comparer.ListEquals(_ShelfLifeStorage, otherT._ShelfLifeStorage)) return false; + if(!comparer.Equals(_PhysicalCharacteristics, otherT._PhysicalCharacteristics)) return false; + if(!comparer.ListEquals(_LanguageCode, otherT._LanguageCode)) return false; + if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_OnlineInformationElement, otherT._OnlineInformationElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ParentDevice, otherT._ParentDevice)) return false; + if(!comparer.ListEquals(_Material, otherT._Material)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "udiDeviceIdentifier": - value = UdiDeviceIdentifier; - return UdiDeviceIdentifier?.Any() == true; + value = _UdiDeviceIdentifier; + return _UdiDeviceIdentifier?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "deviceName": - value = DeviceName; - return DeviceName?.Any() == true; + value = _DeviceName; + return _DeviceName?.Any() == true; case "modelNumber": - value = ModelNumberElement; - return ModelNumberElement is not null; + value = _ModelNumberElement; + return _ModelNumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "specialization": - value = Specialization; - return Specialization?.Any() == true; + value = _Specialization; + return _Specialization?.Any() == true; case "version": - value = VersionElement; - return VersionElement?.Any() == true; + value = _VersionElement; + return _VersionElement?.Any() == true; case "safety": - value = Safety; - return Safety?.Any() == true; + value = _Safety; + return _Safety?.Any() == true; case "shelfLifeStorage": - value = ShelfLifeStorage; - return ShelfLifeStorage?.Any() == true; + value = _ShelfLifeStorage; + return _ShelfLifeStorage?.Any() == true; case "physicalCharacteristics": - value = PhysicalCharacteristics; - return PhysicalCharacteristics is not null; + value = _PhysicalCharacteristics; + return _PhysicalCharacteristics is not null; case "languageCode": - value = LanguageCode; - return LanguageCode?.Any() == true; + value = _LanguageCode; + return _LanguageCode?.Any() == true; case "capability": - value = Capability; - return Capability?.Any() == true; + value = _Capability; + return _Capability?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "onlineInformation": - value = OnlineInformationElement; - return OnlineInformationElement is not null; + value = _OnlineInformationElement; + return _OnlineInformationElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "parentDevice": - value = ParentDevice; - return ParentDevice is not null; + value = _ParentDevice; + return _ParentDevice is not null; case "material": - value = Material; - return Material?.Any() == true; + value = _Material; + return _Material?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "udiDeviceIdentifier": - UdiDeviceIdentifier = (List)value; + UdiDeviceIdentifier = (List?)value!; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.DataType)value; + Manufacturer = (Hl7.Fhir.Model.DataType?)value; return this; case "deviceName": - DeviceName = (List)value; + DeviceName = (List?)value!; return this; case "modelNumber": - ModelNumberElement = (Hl7.Fhir.Model.FhirString)value; + ModelNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialization": - Specialization = (List)value; + Specialization = (List?)value!; return this; case "version": - VersionElement = (List)value; + VersionElement = (List?)value!; return this; case "safety": - Safety = (List)value; + Safety = (List?)value!; return this; case "shelfLifeStorage": - ShelfLifeStorage = (List)value; + ShelfLifeStorage = (List?)value!; return this; case "physicalCharacteristics": - PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic)value; + PhysicalCharacteristics = (Hl7.Fhir.Model.ProdCharacteristic?)value; return this; case "languageCode": - LanguageCode = (List)value; + LanguageCode = (List?)value!; return this; case "capability": - Capability = (List)value; + Capability = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "onlineInformation": - OnlineInformationElement = (Hl7.Fhir.Model.FhirUri)value; + OnlineInformationElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "parentDevice": - ParentDevice = (Hl7.Fhir.Model.ResourceReference)value; + ParentDevice = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "material": - Material = (List)value; + Material = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1593,28 +1532,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",UdiDeviceIdentifier); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",DeviceName); - if (ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",ModelNumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Specialization?.Any() == true) yield return new KeyValuePair("specialization",Specialization); - if (VersionElement?.Any() == true) yield return new KeyValuePair("version",VersionElement); - if (Safety?.Any() == true) yield return new KeyValuePair("safety",Safety); - if (ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",ShelfLifeStorage); - if (PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",PhysicalCharacteristics); - if (LanguageCode?.Any() == true) yield return new KeyValuePair("languageCode",LanguageCode); - if (Capability?.Any() == true) yield return new KeyValuePair("capability",Capability); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (OnlineInformationElement is not null) yield return new KeyValuePair("onlineInformation",OnlineInformationElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ParentDevice is not null) yield return new KeyValuePair("parentDevice",ParentDevice); - if (Material?.Any() == true) yield return new KeyValuePair("material",Material); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",_UdiDeviceIdentifier); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",_DeviceName); + if (_ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",_ModelNumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Specialization?.Any() == true) yield return new KeyValuePair("specialization",_Specialization); + if (_VersionElement?.Any() == true) yield return new KeyValuePair("version",_VersionElement); + if (_Safety?.Any() == true) yield return new KeyValuePair("safety",_Safety); + if (_ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",_ShelfLifeStorage); + if (_PhysicalCharacteristics is not null) yield return new KeyValuePair("physicalCharacteristics",_PhysicalCharacteristics); + if (_LanguageCode?.Any() == true) yield return new KeyValuePair("languageCode",_LanguageCode); + if (_Capability?.Any() == true) yield return new KeyValuePair("capability",_Capability); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_OnlineInformationElement is not null) yield return new KeyValuePair("onlineInformation",_OnlineInformationElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ParentDevice is not null) yield return new KeyValuePair("parentDevice",_ParentDevice); + if (_Material?.Any() == true) yield return new KeyValuePair("material",_Material); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs index e9f225122..b32a043d9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -274,13 +277,13 @@ public partial class CalibrationComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// unspecified | offset | gain | two-point @@ -289,13 +292,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -307,13 +307,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationState")] [DataMember] - public Code StateElement + public Code? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Code _StateElement; + private Code? _StateElement; /// /// not-calibrated | calibration-required | calibrated | unspecified @@ -322,13 +322,10 @@ public Code StateEleme [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Code(value); + StateElement = value is null ? null : new Code(value); OnPropertyChanged("State"); } } @@ -338,13 +335,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State /// [FhirElement("time", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Instant TimeElement + public Hl7.Fhir.Model.Instant? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.Instant _TimeElement; + private Hl7.Fhir.Model.Instant? _TimeElement; /// /// Describes the time last calibration has been performed @@ -353,30 +350,23 @@ public Hl7.Fhir.Model.Instant TimeElement [IgnoreDataMember] public DateTimeOffset? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.Instant(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Time"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CalibrationComponent; - - if (dest == null) - { + if(other is not CalibrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Code)StateElement.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.Instant)TimeElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Code)_StateElement.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.Instant)_TimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -388,48 +378,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CalibrationComponent; - if(otherT == null) return false; + if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "state": - StateElement = (Code)value; + StateElement = (Code?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.Instant)value; + TimeElement = (Hl7.Fhir.Model.Instant?)value; return this; default: return base.SetValue(key, value); @@ -440,9 +430,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); } } @@ -455,11 +445,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identity of metric, for example Heart Rate or PEEP Setting. @@ -468,13 +458,13 @@ public List Identifier [Binding("MetricType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Unit of Measure for the Metric. @@ -482,13 +472,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("unit", InSummary=true, Order=110)] [Binding("MetricUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Describes the link to the source Device. @@ -497,13 +487,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Describes the link to the parent Device. @@ -512,13 +502,13 @@ public Hl7.Fhir.Model.ResourceReference Source [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// on | off | standby | entered-in-error. @@ -527,13 +517,13 @@ public Hl7.Fhir.Model.ResourceReference Parent [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricOperationalStatus")] [DataMember] - public Code OperationalStatusElement + public Code? OperationalStatusElement { get { return _OperationalStatusElement; } set { _OperationalStatusElement = value; OnPropertyChanged("OperationalStatusElement"); } } - private Code _OperationalStatusElement; + private Code? _OperationalStatusElement; /// /// on | off | standby | entered-in-error @@ -542,13 +532,10 @@ public Code Operation [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalStatus { - get { return OperationalStatusElement != null ? OperationalStatusElement.Value : null; } + get => _OperationalStatusElement?.Value; set { - if (value == null) - OperationalStatusElement = null; - else - OperationalStatusElement = new Code(value); + OperationalStatusElement = value is null ? null : new Code(value); OnPropertyChanged("OperationalStatus"); } } @@ -560,13 +547,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalSta [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricColor")] [DataMember] - public Code ColorElement + public Code? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Code _ColorElement; + private Code? _ColorElement; /// /// black | red | green | yellow | blue | magenta | cyan | white @@ -575,13 +562,10 @@ public Code ColorElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricColor? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Code(value); + ColorElement = value is null ? null : new Code(value); OnPropertyChanged("Color"); } } @@ -594,13 +578,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricColor? Color [Binding("DeviceMetricCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// measurement | setting | calculation | unspecified @@ -609,13 +593,10 @@ public Code CategoryElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -625,13 +606,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category /// [FhirElement("measurementPeriod", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.Timing MeasurementPeriod + public Hl7.Fhir.Model.Timing? MeasurementPeriod { get { return _MeasurementPeriod; } set { _MeasurementPeriod = value; OnPropertyChanged("MeasurementPeriod"); } } - private Hl7.Fhir.Model.Timing _MeasurementPeriod; + private Hl7.Fhir.Model.Timing? _MeasurementPeriod; /// /// Describes the calibrations that have been performed or that are required to be performed. @@ -641,34 +622,30 @@ public Hl7.Fhir.Model.Timing MeasurementPeriod [DataMember] public List Calibration { - get { if(_Calibration==null) _Calibration = new List(); return _Calibration; } + get => _Calibration ?? new List(); set { _Calibration = value; OnPropertyChanged("Calibration"); } } - private List _Calibration; + private List? _Calibration; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceMetric; - - if (dest == null) - { + if(other is not DeviceMetric dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(OperationalStatusElement != null) dest.OperationalStatusElement = (Code)OperationalStatusElement.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Code)ColorElement.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(MeasurementPeriod != null) dest.MeasurementPeriod = (Hl7.Fhir.Model.Timing)MeasurementPeriod.DeepCopyInternal(); - if(Calibration.Any()) dest.Calibration = new List(Calibration.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_OperationalStatusElement is not null) dest.OperationalStatusElement = (Code)_OperationalStatusElement.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Code)_ColorElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_MeasurementPeriod is not null) dest.MeasurementPeriod = (Hl7.Fhir.Model.Timing)_MeasurementPeriod.DeepCopyInternal(); + if(_Calibration is not null) dest.Calibration = new List(_Calibration.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -680,97 +657,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceMetric; - if(otherT == null) return false; + if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(OperationalStatusElement, otherT.OperationalStatusElement)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(MeasurementPeriod, otherT.MeasurementPeriod)) return false; - if(!comparer.ListEquals(Calibration, otherT.Calibration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_OperationalStatusElement, otherT._OperationalStatusElement)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_MeasurementPeriod, otherT._MeasurementPeriod)) return false; + if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "operationalStatus": - value = OperationalStatusElement; - return OperationalStatusElement is not null; + value = _OperationalStatusElement; + return _OperationalStatusElement is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "measurementPeriod": - value = MeasurementPeriod; - return MeasurementPeriod is not null; + value = _MeasurementPeriod; + return _MeasurementPeriod is not null; case "calibration": - value = Calibration; - return Calibration?.Any() == true; + value = _Calibration; + return _Calibration?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "operationalStatus": - OperationalStatusElement = (Code)value; + OperationalStatusElement = (Code?)value; return this; case "color": - ColorElement = (Code)value; + ColorElement = (Code?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "measurementPeriod": - MeasurementPeriod = (Hl7.Fhir.Model.Timing)value; + MeasurementPeriod = (Hl7.Fhir.Model.Timing?)value; return this; case "calibration": - Calibration = (List)value; + Calibration = (List?)value!; return this; default: return base.SetValue(key, value); @@ -781,16 +758,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",OperationalStatusElement); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (MeasurementPeriod is not null) yield return new KeyValuePair("measurementPeriod",MeasurementPeriod); - if (Calibration?.Any() == true) yield return new KeyValuePair("calibration",Calibration); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatusElement); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_MeasurementPeriod is not null) yield return new KeyValuePair("measurementPeriod",_MeasurementPeriod); + if (_Calibration?.Any() == true) yield return new KeyValuePair("calibration",_Calibration); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs index 037b4c449..9d96bcb2d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40, FiveWs="FiveWs.what[x]")] [Binding("ParameterCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value of detail. @@ -96,26 +99,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirBoolean))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -127,41 +126,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -172,8 +171,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -186,11 +185,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -200,24 +199,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -232,24 +231,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -266,11 +265,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -282,24 +281,24 @@ public List BasedOn [DataMember] public List PriorRequest { - get { if(_PriorRequest==null) _PriorRequest = new List(); return _PriorRequest; } + get => _PriorRequest ?? new List(); set { _PriorRequest = value; OnPropertyChanged("PriorRequest"); } } - private List _PriorRequest; + private List? _PriorRequest; /// /// Identifier of composite request. /// [FhirElement("groupIdentifier", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -308,13 +307,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DeclaredType(Type = typeof(Code))] [Binding("DeviceRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -323,13 +322,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -342,13 +338,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -357,13 +353,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -375,13 +368,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -390,13 +383,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -411,13 +401,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Code + public Hl7.Fhir.Model.DataType? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.DataType _Code; + private Hl7.Fhir.Model.DataType? _Code; /// /// Device details. @@ -427,11 +417,11 @@ public Hl7.Fhir.Model.DataType Code [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Focus of request. @@ -441,13 +431,13 @@ public List Parameter [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter motivating request. @@ -456,13 +446,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Desired time or schedule for use. @@ -471,41 +461,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When recorded. /// [FhirElement("authoredOn", InSummary=true, Order=230, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -517,13 +504,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Filler role. @@ -531,13 +518,13 @@ public Hl7.Fhir.Model.ResourceReference Requester [FhirElement("performerType", InSummary=true, Order=250, FiveWs="FiveWs.actor")] [Binding("DeviceRequestParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Requested Filler. @@ -546,13 +533,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","HealthcareService","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Coded Reason for request. @@ -563,11 +550,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Linked Reason for request. @@ -579,11 +566,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Associated insurance coverage. @@ -595,11 +582,11 @@ public List ReasonReference [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Additional clinical information. @@ -611,11 +598,11 @@ public List Insurance [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Notes or comments. @@ -625,11 +612,11 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Request provenance. @@ -641,48 +628,44 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceRequest; - - if (dest == null) - { + if(other is not DeviceRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PriorRequest.Any()) dest.PriorRequest = new List(PriorRequest.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.DataType)Code.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PriorRequest is not null) dest.PriorRequest = new List(_PriorRequest.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.DataType)_Code.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -694,195 +677,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceRequest; - if(otherT == null) return false; + if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PriorRequest, otherT.PriorRequest)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PriorRequest, otherT._PriorRequest)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "priorRequest": - value = PriorRequest; - return PriorRequest?.Any() == true; + value = _PriorRequest; + return _PriorRequest?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "priorRequest": - PriorRequest = (List)value; + PriorRequest = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.DataType)value; + Code = (Hl7.Fhir.Model.DataType?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -893,30 +876,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PriorRequest?.Any() == true) yield return new KeyValuePair("priorRequest",PriorRequest); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PriorRequest?.Any() == true) yield return new KeyValuePair("priorRequest",_PriorRequest); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs index a3a056211..255f3f688 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,11 +116,11 @@ public enum DeviceUseStatementStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -129,11 +132,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// active | completed | entered-in-error +. @@ -143,13 +146,13 @@ public List BasedOn [Binding("DeviceUseStatementStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | completed | entered-in-error + @@ -158,13 +161,10 @@ public Code StatusEl [IgnoreDataMember] public Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -177,13 +177,13 @@ public Hl7.Fhir.Model.DeviceUseStatement.DeviceUseStatementStatus? Status [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Supporting information. @@ -195,11 +195,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// How often the device was used. @@ -208,41 +208,38 @@ public List DerivedFrom [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// When statement was recorded. /// [FhirElement("recordedOn", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedOnElement + public Hl7.Fhir.Model.FhirDateTime? RecordedOnElement { get { return _RecordedOnElement; } set { _RecordedOnElement = value; OnPropertyChanged("RecordedOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedOnElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedOnElement; /// /// When statement was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedOn + public string? RecordedOn { - get { return RecordedOnElement != null ? RecordedOnElement.Value : null; } + get => _RecordedOnElement?.Value; set { - if (value == null) - RecordedOnElement = null; - else - RecordedOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedOn"); } } @@ -254,13 +251,13 @@ public string RecordedOn [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Reference to device used. @@ -270,13 +267,13 @@ public Hl7.Fhir.Model.ResourceReference Source [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Why device was used. @@ -286,11 +283,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was DeviceUseStatement performed?. @@ -302,11 +299,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Target body site. @@ -314,13 +311,13 @@ public List ReasonReference [FhirElement("bodySite", InSummary=true, Order=200)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Addition details (comments, instructions). @@ -330,37 +327,33 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceUseStatement; - - if (dest == null) - { + if(other is not DeviceUseStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(RecordedOnElement != null) dest.RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)RecordedOnElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_RecordedOnElement is not null) dest.RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedOnElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -372,118 +365,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceUseStatement; - if(otherT == null) return false; + if(other is not DeviceUseStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(RecordedOnElement, otherT.RecordedOnElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_RecordedOnElement, otherT._RecordedOnElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "recordedOn": - value = RecordedOnElement; - return RecordedOnElement is not null; + value = _RecordedOnElement; + return _RecordedOnElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedOn": - RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -494,19 +487,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (RecordedOnElement is not null) yield return new KeyValuePair("recordedOn",RecordedOnElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_RecordedOnElement is not null) yield return new KeyValuePair("recordedOn",_RecordedOnElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs index cc0abb221..093cb4437 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -151,28 +154,25 @@ public partial class MediaComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("comment", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comment about the image (e.g. explanation) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -185,26 +185,22 @@ public string Comment [References("Media")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Link + public Hl7.Fhir.Model.ResourceReference? Link { get { return _Link; } set { _Link = value; OnPropertyChanged("Link"); } } - private Hl7.Fhir.Model.ResourceReference _Link; + private Hl7.Fhir.Model.ResourceReference? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as MediaComponent; - - if (dest == null) - { + if(other is not MediaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Link != null) dest.Link = (Hl7.Fhir.Model.ResourceReference)Link.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = (Hl7.Fhir.Model.ResourceReference)_Link.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -216,41 +212,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MediaComponent; - if(otherT == null) return false; + if(other is not MediaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "link": - value = Link; - return Link is not null; + value = _Link; + return _Link is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "link": - Link = (Hl7.Fhir.Model.ResourceReference)value; + Link = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -261,8 +257,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Link is not null) yield return new KeyValuePair("link",Link); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Link is not null) yield return new KeyValuePair("link",_Link); } } @@ -275,11 +271,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// What was requested. @@ -291,11 +287,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// registered | partial | preliminary | final +. @@ -305,13 +301,13 @@ public List BasedOn [Binding("DiagnosticReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | partial | preliminary | final + @@ -320,13 +316,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -340,11 +333,11 @@ public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Name/Code for this diagnostic report. @@ -353,13 +346,13 @@ public List Category [Binding("DiagnosticReportCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The subject of the report - usually, but not always, the patient. @@ -368,13 +361,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location","Organization","Procedure","Practitioner","Medication","Substance")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Health care event when test ordered. @@ -383,13 +376,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Clinically relevant time/time-period for report. @@ -398,26 +391,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// DateTime this version was made. /// [FhirElement("issued", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// DateTime this version was made @@ -426,13 +419,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -447,11 +437,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Primary result interpreter. @@ -463,11 +453,11 @@ public List Performer [DataMember] public List ResultsInterpreter { - get { if(_ResultsInterpreter==null) _ResultsInterpreter = new List(); return _ResultsInterpreter; } + get => _ResultsInterpreter ?? new List(); set { _ResultsInterpreter = value; OnPropertyChanged("ResultsInterpreter"); } } - private List _ResultsInterpreter; + private List? _ResultsInterpreter; /// /// Specimens this report is based on. @@ -479,11 +469,11 @@ public List ResultsInterpreter [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Observations. @@ -495,11 +485,11 @@ public List Specimen [DataMember] public List Result { - get { if(_Result==null) _Result = new List(); return _Result; } + get => _Result ?? new List(); set { _Result = value; OnPropertyChanged("Result"); } } - private List _Result; + private List? _Result; /// /// Reference to full details of imaging associated with the diagnostic report. @@ -511,11 +501,11 @@ public List Result [DataMember] public List ImagingStudy { - get { if(_ImagingStudy==null) _ImagingStudy = new List(); return _ImagingStudy; } + get => _ImagingStudy ?? new List(); set { _ImagingStudy = value; OnPropertyChanged("ImagingStudy"); } } - private List _ImagingStudy; + private List? _ImagingStudy; /// /// Key images associated with this report. @@ -525,39 +515,36 @@ public List ImagingStudy [DataMember] public List Media { - get { if(_Media==null) _Media = new List(); return _Media; } + get => _Media ?? new List(); set { _Media = value; OnPropertyChanged("Media"); } } - private List _Media; + private List? _Media; /// /// Clinical conclusion (interpretation) of test results. /// [FhirElement("conclusion", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString ConclusionElement + public Hl7.Fhir.Model.FhirString? ConclusionElement { get { return _ConclusionElement; } set { _ConclusionElement = value; OnPropertyChanged("ConclusionElement"); } } - private Hl7.Fhir.Model.FhirString _ConclusionElement; + private Hl7.Fhir.Model.FhirString? _ConclusionElement; /// /// Clinical conclusion (interpretation) of test results /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Conclusion + public string? Conclusion { - get { return ConclusionElement != null ? ConclusionElement.Value : null; } + get => _ConclusionElement?.Value; set { - if (value == null) - ConclusionElement = null; - else - ConclusionElement = new Hl7.Fhir.Model.FhirString(value); + ConclusionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Conclusion"); } } @@ -571,11 +558,11 @@ public string Conclusion [DataMember] public List ConclusionCode { - get { if(_ConclusionCode==null) _ConclusionCode = new List(); return _ConclusionCode; } + get => _ConclusionCode ?? new List(); set { _ConclusionCode = value; OnPropertyChanged("ConclusionCode"); } } - private List _ConclusionCode; + private List? _ConclusionCode; /// /// Entire report as issued. @@ -585,42 +572,38 @@ public List ConclusionCode [DataMember] public List PresentedForm { - get { if(_PresentedForm==null) _PresentedForm = new List(); return _PresentedForm; } + get => _PresentedForm ?? new List(); set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } - private List _PresentedForm; + private List? _PresentedForm; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosticReport; - - if (dest == null) - { + if(other is not DiagnosticReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(ResultsInterpreter.Any()) dest.ResultsInterpreter = new List(ResultsInterpreter.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(Result.Any()) dest.Result = new List(Result.DeepCopyInternal()); - if(ImagingStudy.Any()) dest.ImagingStudy = new List(ImagingStudy.DeepCopyInternal()); - if(Media.Any()) dest.Media = new List(Media.DeepCopyInternal()); - if(ConclusionElement != null) dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)ConclusionElement.DeepCopyInternal(); - if(ConclusionCode.Any()) dest.ConclusionCode = new List(ConclusionCode.DeepCopyInternal()); - if(PresentedForm.Any()) dest.PresentedForm = new List(PresentedForm.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_ResultsInterpreter is not null) dest.ResultsInterpreter = new List(_ResultsInterpreter.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_Result is not null) dest.Result = new List(_Result.DeepCopyInternal()); + if(_ImagingStudy is not null) dest.ImagingStudy = new List(_ImagingStudy.DeepCopyInternal()); + if(_Media is not null) dest.Media = new List(_Media.DeepCopyInternal()); + if(_ConclusionElement is not null) dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)_ConclusionElement.DeepCopyInternal(); + if(_ConclusionCode is not null) dest.ConclusionCode = new List(_ConclusionCode.DeepCopyInternal()); + if(_PresentedForm is not null) dest.PresentedForm = new List(_PresentedForm.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -632,153 +615,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosticReport; - if(otherT == null) return false; + if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ResultsInterpreter, otherT.ResultsInterpreter)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(ImagingStudy, otherT.ImagingStudy)) return false; - if(!comparer.ListEquals(Media, otherT.Media)) return false; - if(!comparer.Equals(ConclusionElement, otherT.ConclusionElement)) return false; - if(!comparer.ListEquals(ConclusionCode, otherT.ConclusionCode)) return false; - if(!comparer.ListEquals(PresentedForm, otherT.PresentedForm)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ResultsInterpreter, otherT._ResultsInterpreter)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_ImagingStudy, otherT._ImagingStudy)) return false; + if(!comparer.ListEquals(_Media, otherT._Media)) return false; + if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; + if(!comparer.ListEquals(_ConclusionCode, otherT._ConclusionCode)) return false; + if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "resultsInterpreter": - value = ResultsInterpreter; - return ResultsInterpreter?.Any() == true; + value = _ResultsInterpreter; + return _ResultsInterpreter?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "result": - value = Result; - return Result?.Any() == true; + value = _Result; + return _Result?.Any() == true; case "imagingStudy": - value = ImagingStudy; - return ImagingStudy?.Any() == true; + value = _ImagingStudy; + return _ImagingStudy?.Any() == true; case "media": - value = Media; - return Media?.Any() == true; + value = _Media; + return _Media?.Any() == true; case "conclusion": - value = ConclusionElement; - return ConclusionElement is not null; + value = _ConclusionElement; + return _ConclusionElement is not null; case "conclusionCode": - value = ConclusionCode; - return ConclusionCode?.Any() == true; + value = _ConclusionCode; + return _ConclusionCode?.Any() == true; case "presentedForm": - value = PresentedForm; - return PresentedForm?.Any() == true; + value = _PresentedForm; + return _PresentedForm?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "resultsInterpreter": - ResultsInterpreter = (List)value; + ResultsInterpreter = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "result": - Result = (List)value; + Result = (List?)value!; return this; case "imagingStudy": - ImagingStudy = (List)value; + ImagingStudy = (List?)value!; return this; case "media": - Media = (List)value; + Media = (List?)value!; return this; case "conclusion": - ConclusionElement = (Hl7.Fhir.Model.FhirString)value; + ConclusionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "conclusionCode": - ConclusionCode = (List)value; + ConclusionCode = (List?)value!; return this; case "presentedForm": - PresentedForm = (List)value; + PresentedForm = (List?)value!; return this; default: return base.SetValue(key, value); @@ -789,24 +772,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (ResultsInterpreter?.Any() == true) yield return new KeyValuePair("resultsInterpreter",ResultsInterpreter); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (Result?.Any() == true) yield return new KeyValuePair("result",Result); - if (ImagingStudy?.Any() == true) yield return new KeyValuePair("imagingStudy",ImagingStudy); - if (Media?.Any() == true) yield return new KeyValuePair("media",Media); - if (ConclusionElement is not null) yield return new KeyValuePair("conclusion",ConclusionElement); - if (ConclusionCode?.Any() == true) yield return new KeyValuePair("conclusionCode",ConclusionCode); - if (PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",PresentedForm); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_ResultsInterpreter?.Any() == true) yield return new KeyValuePair("resultsInterpreter",_ResultsInterpreter); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_Result?.Any() == true) yield return new KeyValuePair("result",_Result); + if (_ImagingStudy?.Any() == true) yield return new KeyValuePair("imagingStudy",_ImagingStudy); + if (_Media?.Any() == true) yield return new KeyValuePair("media",_Media); + if (_ConclusionElement is not null) yield return new KeyValuePair("conclusion",_ConclusionElement); + if (_ConclusionCode?.Any() == true) yield return new KeyValuePair("conclusionCode",_ConclusionCode); + if (_PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",_PresentedForm); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Distance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Distance.cs index 1a74fdf6f..122133385 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Distance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Distance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs index d49d8fbc5..fbd9941b7 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class RelatedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Related Resource. @@ -96,26 +99,22 @@ public Hl7.Fhir.Model.Identifier Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Ref + public Hl7.Fhir.Model.ResourceReference? Ref { get { return _Ref; } set { _Ref = value; OnPropertyChanged("Ref"); } } - private Hl7.Fhir.Model.ResourceReference _Ref; + private Hl7.Fhir.Model.ResourceReference? _Ref; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedComponent; - - if (dest == null) - { + if(other is not RelatedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Ref != null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)Ref.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Ref is not null) dest.Ref = (Hl7.Fhir.Model.ResourceReference)_Ref.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -127,41 +126,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedComponent; - if(otherT == null) return false; + if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Ref, otherT.Ref)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Ref, otherT._Ref)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "ref": - value = Ref; - return Ref is not null; + value = _Ref; + return _Ref is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "ref": - Ref = (Hl7.Fhir.Model.ResourceReference)value; + Ref = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -172,8 +171,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Ref is not null) yield return new KeyValuePair("ref",Ref); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Ref is not null) yield return new KeyValuePair("ref",_Ref); } } @@ -183,13 +182,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("masterIdentifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier MasterIdentifier + public Hl7.Fhir.Model.Identifier? MasterIdentifier { get { return _MasterIdentifier; } set { _MasterIdentifier = value; OnPropertyChanged("MasterIdentifier"); } } - private Hl7.Fhir.Model.Identifier _MasterIdentifier; + private Hl7.Fhir.Model.Identifier? _MasterIdentifier; /// /// Other identifiers for the manifest. @@ -199,11 +198,11 @@ public Hl7.Fhir.Model.Identifier MasterIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | superseded | entered-in-error. @@ -213,13 +212,13 @@ public List Identifier [Binding("DocumentReferenceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | superseded | entered-in-error @@ -228,13 +227,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentReferenceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -245,13 +241,13 @@ public Hl7.Fhir.Model.DocumentReferenceStatus? Status [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Binding("v3Act")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The subject of the set of documents. @@ -260,41 +256,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Practitioner","Group","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When this document manifest created. /// [FhirElement("created", Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// When this document manifest created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -309,11 +302,11 @@ public string Created [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Intended to get notified about this set of documents. @@ -325,39 +318,36 @@ public List Author [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// The source system/application/software. /// [FhirElement("source", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirUri SourceElement + public Hl7.Fhir.Model.FhirUri? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirUri _SourceElement; + private Hl7.Fhir.Model.FhirUri? _SourceElement; /// /// The source system/application/software /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirUri(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Source"); } } @@ -367,28 +357,25 @@ public string Source /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable description (title) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -403,11 +390,11 @@ public string Description [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// Related things. @@ -417,36 +404,32 @@ public List Content [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentManifest; - - if (dest == null) - { + if(other is not DocumentManifest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MasterIdentifier != null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); + if(_MasterIdentifier is not null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)_MasterIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirUri)_SourceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -458,111 +441,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentManifest; - if(otherT == null) return false; + if(other is not DocumentManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MasterIdentifier, otherT.MasterIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "masterIdentifier": - value = MasterIdentifier; - return MasterIdentifier is not null; + value = _MasterIdentifier; + return _MasterIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "masterIdentifier": - MasterIdentifier = (Hl7.Fhir.Model.Identifier)value; + MasterIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirUri)value; + SourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; default: return base.SetValue(key, value); @@ -573,18 +556,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",MasterIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); + if (_MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",_MasterIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs index 6fc7c4fb2..686269086 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -85,13 +88,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | transforms | signs | appends @@ -100,13 +103,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -119,26 +119,22 @@ public Hl7.Fhir.Model.DocumentRelationshipType? Code [References("DocumentReference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -150,41 +146,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -195,8 +191,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -223,13 +219,13 @@ public partial class ContentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("attachment", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Attachment Attachment + public Hl7.Fhir.Model.Attachment? Attachment { get { return _Attachment; } set { _Attachment = value; OnPropertyChanged("Attachment"); } } - private Hl7.Fhir.Model.Attachment _Attachment; + private Hl7.Fhir.Model.Attachment? _Attachment; /// /// Format/content rules for the document. @@ -237,26 +233,22 @@ public Hl7.Fhir.Model.Attachment Attachment [FhirElement("format", InSummary=true, Order=50)] [Binding("DocumentFormat")] [DataMember] - public Hl7.Fhir.Model.Coding Format + public Hl7.Fhir.Model.Coding? Format { get { return _Format; } set { _Format = value; OnPropertyChanged("Format"); } } - private Hl7.Fhir.Model.Coding _Format; + private Hl7.Fhir.Model.Coding? _Format; protected internal override void CopyToInternal(Base other) { - var dest = other as ContentComponent; - - if (dest == null) - { + if(other is not ContentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Attachment != null) dest.Attachment = (Hl7.Fhir.Model.Attachment)Attachment.DeepCopyInternal(); - if(Format != null) dest.Format = (Hl7.Fhir.Model.Coding)Format.DeepCopyInternal(); + if(_Attachment is not null) dest.Attachment = (Hl7.Fhir.Model.Attachment)_Attachment.DeepCopyInternal(); + if(_Format is not null) dest.Format = (Hl7.Fhir.Model.Coding)_Format.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -268,41 +260,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentComponent; - if(otherT == null) return false; + if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Attachment, otherT.Attachment)) return false; - if(!comparer.Equals(Format, otherT.Format)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + if(!comparer.Equals(_Format, otherT._Format)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "attachment": - value = Attachment; - return Attachment is not null; + value = _Attachment; + return _Attachment is not null; case "format": - value = Format; - return Format is not null; + value = _Format; + return _Format is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "attachment": - Attachment = (Hl7.Fhir.Model.Attachment)value; + Attachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "format": - Format = (Hl7.Fhir.Model.Coding)value; + Format = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -313,8 +305,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Attachment is not null) yield return new KeyValuePair("attachment",Attachment); - if (Format is not null) yield return new KeyValuePair("format",Format); + if (_Attachment is not null) yield return new KeyValuePair("attachment",_Attachment); + if (_Format is not null) yield return new KeyValuePair("format",_Format); } } @@ -346,11 +338,11 @@ public partial class ContextComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Main clinical acts documented. @@ -361,24 +353,24 @@ public List Encounter [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Time of service that is being documented. /// [FhirElement("period", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Kind of facility where patient was seen. @@ -386,13 +378,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("facilityType", Order=70)] [Binding("DocumentC80FacilityType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FacilityType + public Hl7.Fhir.Model.CodeableConcept? FacilityType { get { return _FacilityType; } set { _FacilityType = value; OnPropertyChanged("FacilityType"); } } - private Hl7.Fhir.Model.CodeableConcept _FacilityType; + private Hl7.Fhir.Model.CodeableConcept? _FacilityType; /// /// Additional details about where the content was created (e.g. clinical specialty). @@ -400,13 +392,13 @@ public Hl7.Fhir.Model.CodeableConcept FacilityType [FhirElement("practiceSetting", Order=80)] [Binding("DocumentC80PracticeSetting")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PracticeSetting + public Hl7.Fhir.Model.CodeableConcept? PracticeSetting { get { return _PracticeSetting; } set { _PracticeSetting = value; OnPropertyChanged("PracticeSetting"); } } - private Hl7.Fhir.Model.CodeableConcept _PracticeSetting; + private Hl7.Fhir.Model.CodeableConcept? _PracticeSetting; /// /// Patient demographics from source. @@ -415,13 +407,13 @@ public Hl7.Fhir.Model.CodeableConcept PracticeSetting [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SourcePatientInfo + public Hl7.Fhir.Model.ResourceReference? SourcePatientInfo { get { return _SourcePatientInfo; } set { _SourcePatientInfo = value; OnPropertyChanged("SourcePatientInfo"); } } - private Hl7.Fhir.Model.ResourceReference _SourcePatientInfo; + private Hl7.Fhir.Model.ResourceReference? _SourcePatientInfo; /// /// Related identifiers or resources. @@ -433,29 +425,25 @@ public Hl7.Fhir.Model.ResourceReference SourcePatientInfo [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; protected internal override void CopyToInternal(Base other) { - var dest = other as ContextComponent; - - if (dest == null) - { + if(other is not ContextComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(FacilityType != null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)FacilityType.DeepCopyInternal(); - if(PracticeSetting != null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)PracticeSetting.DeepCopyInternal(); - if(SourcePatientInfo != null) dest.SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)SourcePatientInfo.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_FacilityType is not null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)_FacilityType.DeepCopyInternal(); + if(_PracticeSetting is not null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)_PracticeSetting.DeepCopyInternal(); + if(_SourcePatientInfo is not null) dest.SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)_SourcePatientInfo.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -467,76 +455,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContextComponent; - if(otherT == null) return false; + if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(FacilityType, otherT.FacilityType)) return false; - if(!comparer.Equals(PracticeSetting, otherT.PracticeSetting)) return false; - if(!comparer.Equals(SourcePatientInfo, otherT.SourcePatientInfo)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_FacilityType, otherT._FacilityType)) return false; + if(!comparer.Equals(_PracticeSetting, otherT._PracticeSetting)) return false; + if(!comparer.Equals(_SourcePatientInfo, otherT._SourcePatientInfo)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "facilityType": - value = FacilityType; - return FacilityType is not null; + value = _FacilityType; + return _FacilityType is not null; case "practiceSetting": - value = PracticeSetting; - return PracticeSetting is not null; + value = _PracticeSetting; + return _PracticeSetting is not null; case "sourcePatientInfo": - value = SourcePatientInfo; - return SourcePatientInfo is not null; + value = _SourcePatientInfo; + return _SourcePatientInfo is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "facilityType": - FacilityType = (Hl7.Fhir.Model.CodeableConcept)value; + FacilityType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "practiceSetting": - PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)value; + PracticeSetting = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sourcePatientInfo": - SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)value; + SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; default: return base.SetValue(key, value); @@ -547,13 +535,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (FacilityType is not null) yield return new KeyValuePair("facilityType",FacilityType); - if (PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",PracticeSetting); - if (SourcePatientInfo is not null) yield return new KeyValuePair("sourcePatientInfo",SourcePatientInfo); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_FacilityType is not null) yield return new KeyValuePair("facilityType",_FacilityType); + if (_PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",_PracticeSetting); + if (_SourcePatientInfo is not null) yield return new KeyValuePair("sourcePatientInfo",_SourcePatientInfo); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); } } @@ -563,13 +551,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("masterIdentifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier MasterIdentifier + public Hl7.Fhir.Model.Identifier? MasterIdentifier { get { return _MasterIdentifier; } set { _MasterIdentifier = value; OnPropertyChanged("MasterIdentifier"); } } - private Hl7.Fhir.Model.Identifier _MasterIdentifier; + private Hl7.Fhir.Model.Identifier? _MasterIdentifier; /// /// Other identifiers for the document. @@ -579,11 +567,11 @@ public Hl7.Fhir.Model.Identifier MasterIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | superseded | entered-in-error. @@ -593,13 +581,13 @@ public List Identifier [Binding("DocumentReferenceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | superseded | entered-in-error @@ -608,13 +596,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DocumentReferenceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -626,13 +611,13 @@ public Hl7.Fhir.Model.DocumentReferenceStatus? Status [DeclaredType(Type = typeof(Code))] [Binding("ReferredDocumentStatus")] [DataMember] - public Code DocStatusElement + public Code? DocStatusElement { get { return _DocStatusElement; } set { _DocStatusElement = value; OnPropertyChanged("DocStatusElement"); } } - private Code _DocStatusElement; + private Code? _DocStatusElement; /// /// preliminary | final | amended | entered-in-error @@ -641,13 +626,10 @@ public Code DocStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? DocStatus { - get { return DocStatusElement != null ? DocStatusElement.Value : null; } + get => _DocStatusElement?.Value; set { - if (value == null) - DocStatusElement = null; - else - DocStatusElement = new Code(value); + DocStatusElement = value is null ? null : new Code(value); OnPropertyChanged("DocStatus"); } } @@ -658,13 +640,13 @@ public Hl7.Fhir.Model.CompositionStatus? DocStatus [FhirElement("type", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("DocumentC80Type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of document. @@ -675,11 +657,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who/what is the subject of the document. @@ -688,26 +670,26 @@ public List Category [CLSCompliant(false)] [References("Patient","Practitioner","Group","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When this document reference was created. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant DateElement + public Hl7.Fhir.Model.Instant? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Instant _DateElement; + private Hl7.Fhir.Model.Instant? _DateElement; /// /// When this document reference was created @@ -716,13 +698,10 @@ public Hl7.Fhir.Model.Instant DateElement [IgnoreDataMember] public DateTimeOffset? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Instant(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Date"); } } @@ -737,11 +716,11 @@ public DateTimeOffset? Date [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who/what authenticated the document. @@ -750,13 +729,13 @@ public List Author [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authenticator + public Hl7.Fhir.Model.ResourceReference? Authenticator { get { return _Authenticator; } set { _Authenticator = value; OnPropertyChanged("Authenticator"); } } - private Hl7.Fhir.Model.ResourceReference _Authenticator; + private Hl7.Fhir.Model.ResourceReference? _Authenticator; /// /// Organization which maintains the document. @@ -765,13 +744,13 @@ public Hl7.Fhir.Model.ResourceReference Authenticator [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other documents. @@ -781,39 +760,36 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// Human-readable description. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -827,11 +803,11 @@ public string Description [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Document referenced. @@ -841,53 +817,49 @@ public List SecurityLabel [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// Clinical context of document. /// [FhirElement("context", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.DocumentReference.ContextComponent Context + public Hl7.Fhir.Model.DocumentReference.ContextComponent? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.DocumentReference.ContextComponent _Context; + private Hl7.Fhir.Model.DocumentReference.ContextComponent? _Context; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentReference; - - if (dest == null) - { + if(other is not DocumentReference dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MasterIdentifier != null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DocStatusElement != null) dest.DocStatusElement = (Code)DocStatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Instant)DateElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Authenticator != null) dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)Authenticator.DeepCopyInternal(); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(Context != null) dest.Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)Context.DeepCopyInternal(); + if(_MasterIdentifier is not null) dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)_MasterIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DocStatusElement is not null) dest.DocStatusElement = (Code)_DocStatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Instant)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Authenticator is not null) dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)_Authenticator.DeepCopyInternal(); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)_Context.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -899,139 +871,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentReference; - if(otherT == null) return false; + if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MasterIdentifier, otherT.MasterIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DocStatusElement, otherT.DocStatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Authenticator, otherT.Authenticator)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DocStatusElement, otherT._DocStatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Authenticator, otherT._Authenticator)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "masterIdentifier": - value = MasterIdentifier; - return MasterIdentifier is not null; + value = _MasterIdentifier; + return _MasterIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "docStatus": - value = DocStatusElement; - return DocStatusElement is not null; + value = _DocStatusElement; + return _DocStatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "authenticator": - value = Authenticator; - return Authenticator is not null; + value = _Authenticator; + return _Authenticator is not null; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "masterIdentifier": - MasterIdentifier = (Hl7.Fhir.Model.Identifier)value; + MasterIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "docStatus": - DocStatusElement = (Code)value; + DocStatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Instant)value; + DateElement = (Hl7.Fhir.Model.Instant?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "authenticator": - Authenticator = (Hl7.Fhir.Model.ResourceReference)value; + Authenticator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "context": - Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent)value; + Context = (Hl7.Fhir.Model.DocumentReference.ContextComponent?)value; return this; default: return base.SetValue(key, value); @@ -1042,22 +1014,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",MasterIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DocStatusElement is not null) yield return new KeyValuePair("docStatus",DocStatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Authenticator is not null) yield return new KeyValuePair("authenticator",Authenticator); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (Context is not null) yield return new KeyValuePair("context",Context); + if (_MasterIdentifier is not null) yield return new KeyValuePair("masterIdentifier",_MasterIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DocStatusElement is not null) yield return new KeyValuePair("docStatus",_DocStatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Authenticator is not null) yield return new KeyValuePair("authenticator",_Authenticator); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_Context is not null) yield return new KeyValuePair("context",_Context); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs index c8d3db621..9b7131c55 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class DoseAndRateComponent : Hl7.Fhir.Model.Element [FhirElement("type", InSummary=true, Order=30)] [Binding("DoseAndRateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount of medication per dose. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Dose + public Hl7.Fhir.Model.DataType? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.DataType _Dose; + private Hl7.Fhir.Model.DataType? _Dose; /// /// Amount of medication per unit of time. @@ -111,27 +114,23 @@ public Hl7.Fhir.Model.DataType Dose [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as DoseAndRateComponent; - - if (dest == null) - { + if(other is not DoseAndRateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.DataType)Dose.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.DataType)_Dose.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DoseAndRateComponent; - if(otherT == null) return false; + if(other is not DoseAndRateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.DataType)value; + Dose = (Hl7.Fhir.Model.DataType?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -207,13 +206,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sequence", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SequenceElement + public Hl7.Fhir.Model.Integer? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.Integer _SequenceElement; + private Hl7.Fhir.Model.Integer? _SequenceElement; /// /// The order of the dosage instructions @@ -222,13 +221,10 @@ public Hl7.Fhir.Model.Integer SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.Integer(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Sequence"); } } @@ -238,28 +234,25 @@ public int? Sequence /// [FhirElement("text", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -273,39 +266,36 @@ public string Text [DataMember] public List AdditionalInstruction { - get { if(_AdditionalInstruction==null) _AdditionalInstruction = new List(); return _AdditionalInstruction; } + get => _AdditionalInstruction ?? new List(); set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } - private List _AdditionalInstruction; + private List? _AdditionalInstruction; /// /// Patient or consumer oriented instructions. /// [FhirElement("patientInstruction", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Patient or consumer oriented instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -315,13 +305,13 @@ public string PatientInstruction /// [FhirElement("timing", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Timing Timing + public Hl7.Fhir.Model.Timing? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.Timing _Timing; + private Hl7.Fhir.Model.Timing? _Timing; /// /// Take "as needed" (for x). @@ -331,13 +321,13 @@ public Hl7.Fhir.Model.Timing Timing [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Body site to administer to. @@ -345,13 +335,13 @@ public Hl7.Fhir.Model.DataType AsNeeded [FhirElement("site", InSummary=true, Order=100)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How drug should enter body. @@ -359,13 +349,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", InSummary=true, Order=110)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Technique for administering medication. @@ -373,13 +363,13 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", InSummary=true, Order=120)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication administered. @@ -389,74 +379,70 @@ public Hl7.Fhir.Model.CodeableConcept Method [DataMember] public List DoseAndRate { - get { if(_DoseAndRate==null) _DoseAndRate = new List(); return _DoseAndRate; } + get => _DoseAndRate ?? new List(); set { _DoseAndRate = value; OnPropertyChanged("DoseAndRate"); } } - private List _DoseAndRate; + private List? _DoseAndRate; /// /// Upper limit on medication per unit of time. /// [FhirElement("maxDosePerPeriod", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Ratio MaxDosePerPeriod + public Hl7.Fhir.Model.Ratio? MaxDosePerPeriod { get { return _MaxDosePerPeriod; } set { _MaxDosePerPeriod = value; OnPropertyChanged("MaxDosePerPeriod"); } } - private Hl7.Fhir.Model.Ratio _MaxDosePerPeriod; + private Hl7.Fhir.Model.Ratio? _MaxDosePerPeriod; /// /// Upper limit on medication per administration. /// [FhirElement("maxDosePerAdministration", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerAdministration + public Hl7.Fhir.Model.Quantity? MaxDosePerAdministration { get { return _MaxDosePerAdministration; } set { _MaxDosePerAdministration = value; OnPropertyChanged("MaxDosePerAdministration"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerAdministration; + private Hl7.Fhir.Model.Quantity? _MaxDosePerAdministration; /// /// Upper limit on medication per lifetime of the patient. /// [FhirElement("maxDosePerLifetime", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerLifetime + public Hl7.Fhir.Model.Quantity? MaxDosePerLifetime { get { return _MaxDosePerLifetime; } set { _MaxDosePerLifetime = value; OnPropertyChanged("MaxDosePerLifetime"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerLifetime; + private Hl7.Fhir.Model.Quantity? _MaxDosePerLifetime; protected internal override void CopyToInternal(Base other) { - var dest = other as Dosage; - - if (dest == null) - { + if(other is not Dosage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)SequenceElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(AdditionalInstruction.Any()) dest.AdditionalInstruction = new List(AdditionalInstruction.DeepCopyInternal()); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.Timing)Timing.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(DoseAndRate.Any()) dest.DoseAndRate = new List(DoseAndRate.DeepCopyInternal()); - if(MaxDosePerPeriod != null) dest.MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)MaxDosePerPeriod.DeepCopyInternal(); - if(MaxDosePerAdministration != null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)MaxDosePerAdministration.DeepCopyInternal(); - if(MaxDosePerLifetime != null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)MaxDosePerLifetime.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)_SequenceElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_AdditionalInstruction is not null) dest.AdditionalInstruction = new List(_AdditionalInstruction.DeepCopyInternal()); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.Timing)_Timing.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_DoseAndRate is not null) dest.DoseAndRate = new List(_DoseAndRate.DeepCopyInternal()); + if(_MaxDosePerPeriod is not null) dest.MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)_MaxDosePerPeriod.DeepCopyInternal(); + if(_MaxDosePerAdministration is not null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)_MaxDosePerAdministration.DeepCopyInternal(); + if(_MaxDosePerLifetime is not null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)_MaxDosePerLifetime.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -468,118 +454,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Dosage; - if(otherT == null) return false; + if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(AdditionalInstruction, otherT.AdditionalInstruction)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.ListEquals(DoseAndRate, otherT.DoseAndRate)) return false; - if(!comparer.Equals(MaxDosePerPeriod, otherT.MaxDosePerPeriod)) return false; - if(!comparer.Equals(MaxDosePerAdministration, otherT.MaxDosePerAdministration)) return false; - if(!comparer.Equals(MaxDosePerLifetime, otherT.MaxDosePerLifetime)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.ListEquals(_DoseAndRate, otherT._DoseAndRate)) return false; + if(!comparer.Equals(_MaxDosePerPeriod, otherT._MaxDosePerPeriod)) return false; + if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; + if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "additionalInstruction": - value = AdditionalInstruction; - return AdditionalInstruction?.Any() == true; + value = _AdditionalInstruction; + return _AdditionalInstruction?.Any() == true; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "doseAndRate": - value = DoseAndRate; - return DoseAndRate?.Any() == true; + value = _DoseAndRate; + return _DoseAndRate?.Any() == true; case "maxDosePerPeriod": - value = MaxDosePerPeriod; - return MaxDosePerPeriod is not null; + value = _MaxDosePerPeriod; + return _MaxDosePerPeriod is not null; case "maxDosePerAdministration": - value = MaxDosePerAdministration; - return MaxDosePerAdministration is not null; + value = _MaxDosePerAdministration; + return _MaxDosePerAdministration is not null; case "maxDosePerLifetime": - value = MaxDosePerLifetime; - return MaxDosePerLifetime is not null; + value = _MaxDosePerLifetime; + return _MaxDosePerLifetime is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.Integer)value; + SequenceElement = (Hl7.Fhir.Model.Integer?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "additionalInstruction": - AdditionalInstruction = (List)value; + AdditionalInstruction = (List?)value!; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.Timing)value; + Timing = (Hl7.Fhir.Model.Timing?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseAndRate": - DoseAndRate = (List)value; + DoseAndRate = (List?)value!; return this; case "maxDosePerPeriod": - MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio)value; + MaxDosePerPeriod = (Hl7.Fhir.Model.Ratio?)value; return this; case "maxDosePerAdministration": - MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerLifetime": - MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -590,19 +576,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",AdditionalInstruction); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (DoseAndRate?.Any() == true) yield return new KeyValuePair("doseAndRate",DoseAndRate); - if (MaxDosePerPeriod is not null) yield return new KeyValuePair("maxDosePerPeriod",MaxDosePerPeriod); - if (MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",MaxDosePerAdministration); - if (MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",MaxDosePerLifetime); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",_AdditionalInstruction); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_DoseAndRate?.Any() == true) yield return new KeyValuePair("doseAndRate",_DoseAndRate); + if (_MaxDosePerPeriod is not null) yield return new KeyValuePair("maxDosePerPeriod",_MaxDosePerPeriod); + if (_MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",_MaxDosePerAdministration); + if (_MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",_MaxDosePerLifetime); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Duration.cs b/src/Hl7.Fhir.R4B/Model/Generated/Duration.cs index 2d9d3d9ae..4526f3010 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Duration.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Duration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs index d147c4bae..d105305a4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -184,13 +187,13 @@ public partial class StatusHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled + @@ -199,13 +202,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -216,26 +216,22 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusHistoryComponent; - - if (dest == null) - { + if(other is not StatusHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -247,41 +243,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusHistoryComponent; - if(otherT == null) return false; + if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -292,8 +288,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -321,13 +317,13 @@ public partial class ClassHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EncounterClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Class + public Hl7.Fhir.Model.Coding? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.Coding _Class; + private Hl7.Fhir.Model.Coding? _Class; /// /// The time that the episode was in the specified class. @@ -335,26 +331,22 @@ public Hl7.Fhir.Model.Coding Class [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ClassHistoryComponent; - - if (dest == null) - { + if(other is not ClassHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Class != null) dest.Class = (Hl7.Fhir.Model.Coding)Class.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.Coding)_Class.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -366,41 +358,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassHistoryComponent; - if(otherT == null) return false; + if(other is not ClassHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "class": - Class = (Hl7.Fhir.Model.Coding)value; + Class = (Hl7.Fhir.Model.Coding?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -411,8 +403,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -442,24 +434,24 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Period of time during the encounter that the participant participated. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Persons involved in the encounter other than the patient. @@ -468,27 +460,23 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Individual + public Hl7.Fhir.Model.ResourceReference? Individual { get { return _Individual; } set { _Individual = value; OnPropertyChanged("Individual"); } } - private Hl7.Fhir.Model.ResourceReference _Individual; + private Hl7.Fhir.Model.ResourceReference? _Individual; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Individual != null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)Individual.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Individual is not null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)_Individual.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -500,48 +488,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Individual, otherT.Individual)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Individual, otherT._Individual)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "individual": - value = Individual; - return Individual is not null; + value = _Individual; + return _Individual is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "individual": - Individual = (Hl7.Fhir.Model.ResourceReference)value; + Individual = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -552,9 +540,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Individual is not null) yield return new KeyValuePair("individual",Individual); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Individual is not null) yield return new KeyValuePair("individual",_Individual); } } @@ -580,13 +568,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition","Procedure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …). @@ -594,26 +582,26 @@ public Hl7.Fhir.Model.ResourceReference Condition [FhirElement("use", Order=50)] [Binding("DiagnosisRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Use + public Hl7.Fhir.Model.CodeableConcept? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.CodeableConcept _Use; + private Hl7.Fhir.Model.CodeableConcept? _Use; /// /// Ranking of the diagnosis (for each role type). /// [FhirElement("rank", Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankElement + public Hl7.Fhir.Model.PositiveInt? RankElement { get { return _RankElement; } set { _RankElement = value; OnPropertyChanged("RankElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankElement; + private Hl7.Fhir.Model.PositiveInt? _RankElement; /// /// Ranking of the diagnosis (for each role type) @@ -622,30 +610,23 @@ public Hl7.Fhir.Model.PositiveInt RankElement [IgnoreDataMember] public int? Rank { - get { return RankElement != null ? RankElement.Value : null; } + get => _RankElement?.Value; set { - if (value == null) - RankElement = null; - else - RankElement = new Hl7.Fhir.Model.PositiveInt(value); + RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Rank"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Use != null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)Use.DeepCopyInternal(); - if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)_Use.DeepCopyInternal(); + if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -657,48 +638,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; - if(!comparer.Equals(RankElement, otherT.RankElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; + if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; case "rank": - value = RankElement; - return RankElement is not null; + value = _RankElement; + return _RankElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "use": - Use = (Hl7.Fhir.Model.CodeableConcept)value; + Use = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rank": - RankElement = (Hl7.Fhir.Model.PositiveInt)value; + RankElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -709,9 +690,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Use is not null) yield return new KeyValuePair("use",Use); - if (RankElement is not null) yield return new KeyValuePair("rank",RankElement); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Use is not null) yield return new KeyValuePair("use",_Use); + if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement); } } @@ -738,13 +719,13 @@ public partial class HospitalizationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("preAdmissionIdentifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier + public Hl7.Fhir.Model.Identifier? PreAdmissionIdentifier { get { return _PreAdmissionIdentifier; } set { _PreAdmissionIdentifier = value; OnPropertyChanged("PreAdmissionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _PreAdmissionIdentifier; + private Hl7.Fhir.Model.Identifier? _PreAdmissionIdentifier; /// /// The location/organization from which the patient came before admission. @@ -753,13 +734,13 @@ public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Origin + public Hl7.Fhir.Model.ResourceReference? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.ResourceReference _Origin; + private Hl7.Fhir.Model.ResourceReference? _Origin; /// /// From where patient was admitted (physician referral, transfer). @@ -767,13 +748,13 @@ public Hl7.Fhir.Model.ResourceReference Origin [FhirElement("admitSource", Order=60)] [Binding("AdmitSource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdmitSource + public Hl7.Fhir.Model.CodeableConcept? AdmitSource { get { return _AdmitSource; } set { _AdmitSource = value; OnPropertyChanged("AdmitSource"); } } - private Hl7.Fhir.Model.CodeableConcept _AdmitSource; + private Hl7.Fhir.Model.CodeableConcept? _AdmitSource; /// /// The type of hospital re-admission that has occurred (if any). If the value is absent, then this is not identified as a readmission. @@ -781,13 +762,13 @@ public Hl7.Fhir.Model.CodeableConcept AdmitSource [FhirElement("reAdmission", Order=70)] [Binding("ReAdmissionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReAdmission + public Hl7.Fhir.Model.CodeableConcept? ReAdmission { get { return _ReAdmission; } set { _ReAdmission = value; OnPropertyChanged("ReAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _ReAdmission; + private Hl7.Fhir.Model.CodeableConcept? _ReAdmission; /// /// Diet preferences reported by the patient. @@ -798,11 +779,11 @@ public Hl7.Fhir.Model.CodeableConcept ReAdmission [DataMember] public List DietPreference { - get { if(_DietPreference==null) _DietPreference = new List(); return _DietPreference; } + get => _DietPreference ?? new List(); set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } - private List _DietPreference; + private List? _DietPreference; /// /// Special courtesies (VIP, board member). @@ -813,11 +794,11 @@ public List DietPreference [DataMember] public List SpecialCourtesy { - get { if(_SpecialCourtesy==null) _SpecialCourtesy = new List(); return _SpecialCourtesy; } + get => _SpecialCourtesy ?? new List(); set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } - private List _SpecialCourtesy; + private List? _SpecialCourtesy; /// /// Wheelchair, translator, stretcher, etc. @@ -828,11 +809,11 @@ public List SpecialCourtesy [DataMember] public List SpecialArrangement { - get { if(_SpecialArrangement==null) _SpecialArrangement = new List(); return _SpecialArrangement; } + get => _SpecialArrangement ?? new List(); set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } - private List _SpecialArrangement; + private List? _SpecialArrangement; /// /// Location/organization to which the patient is discharged. @@ -841,13 +822,13 @@ public List SpecialArrangement [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Category or kind of location after discharge. @@ -855,33 +836,29 @@ public Hl7.Fhir.Model.ResourceReference Destination [FhirElement("dischargeDisposition", Order=120)] [Binding("DischargeDisp")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DischargeDisposition + public Hl7.Fhir.Model.CodeableConcept? DischargeDisposition { get { return _DischargeDisposition; } set { _DischargeDisposition = value; OnPropertyChanged("DischargeDisposition"); } } - private Hl7.Fhir.Model.CodeableConcept _DischargeDisposition; + private Hl7.Fhir.Model.CodeableConcept? _DischargeDisposition; protected internal override void CopyToInternal(Base other) { - var dest = other as HospitalizationComponent; - - if (dest == null) - { + if(other is not HospitalizationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PreAdmissionIdentifier != null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)PreAdmissionIdentifier.DeepCopyInternal(); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)Origin.DeepCopyInternal(); - if(AdmitSource != null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)AdmitSource.DeepCopyInternal(); - if(ReAdmission != null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)ReAdmission.DeepCopyInternal(); - if(DietPreference.Any()) dest.DietPreference = new List(DietPreference.DeepCopyInternal()); - if(SpecialCourtesy.Any()) dest.SpecialCourtesy = new List(SpecialCourtesy.DeepCopyInternal()); - if(SpecialArrangement.Any()) dest.SpecialArrangement = new List(SpecialArrangement.DeepCopyInternal()); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(DischargeDisposition != null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)DischargeDisposition.DeepCopyInternal(); + if(_PreAdmissionIdentifier is not null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)_PreAdmissionIdentifier.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)_Origin.DeepCopyInternal(); + if(_AdmitSource is not null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)_AdmitSource.DeepCopyInternal(); + if(_ReAdmission is not null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)_ReAdmission.DeepCopyInternal(); + if(_DietPreference is not null) dest.DietPreference = new List(_DietPreference.DeepCopyInternal()); + if(_SpecialCourtesy is not null) dest.SpecialCourtesy = new List(_SpecialCourtesy.DeepCopyInternal()); + if(_SpecialArrangement is not null) dest.SpecialArrangement = new List(_SpecialArrangement.DeepCopyInternal()); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_DischargeDisposition is not null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)_DischargeDisposition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -893,90 +870,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HospitalizationComponent; - if(otherT == null) return false; + if(other is not HospitalizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PreAdmissionIdentifier, otherT.PreAdmissionIdentifier)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(AdmitSource, otherT.AdmitSource)) return false; - if(!comparer.Equals(ReAdmission, otherT.ReAdmission)) return false; - if(!comparer.ListEquals(DietPreference, otherT.DietPreference)) return false; - if(!comparer.ListEquals(SpecialCourtesy, otherT.SpecialCourtesy)) return false; - if(!comparer.ListEquals(SpecialArrangement, otherT.SpecialArrangement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(DischargeDisposition, otherT.DischargeDisposition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; + if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; + if(!comparer.ListEquals(_DietPreference, otherT._DietPreference)) return false; + if(!comparer.ListEquals(_SpecialCourtesy, otherT._SpecialCourtesy)) return false; + if(!comparer.ListEquals(_SpecialArrangement, otherT._SpecialArrangement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "preAdmissionIdentifier": - value = PreAdmissionIdentifier; - return PreAdmissionIdentifier is not null; + value = _PreAdmissionIdentifier; + return _PreAdmissionIdentifier is not null; case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "admitSource": - value = AdmitSource; - return AdmitSource is not null; + value = _AdmitSource; + return _AdmitSource is not null; case "reAdmission": - value = ReAdmission; - return ReAdmission is not null; + value = _ReAdmission; + return _ReAdmission is not null; case "dietPreference": - value = DietPreference; - return DietPreference?.Any() == true; + value = _DietPreference; + return _DietPreference?.Any() == true; case "specialCourtesy": - value = SpecialCourtesy; - return SpecialCourtesy?.Any() == true; + value = _SpecialCourtesy; + return _SpecialCourtesy?.Any() == true; case "specialArrangement": - value = SpecialArrangement; - return SpecialArrangement?.Any() == true; + value = _SpecialArrangement; + return _SpecialArrangement?.Any() == true; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "dischargeDisposition": - value = DischargeDisposition; - return DischargeDisposition is not null; + value = _DischargeDisposition; + return _DischargeDisposition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "preAdmissionIdentifier": - PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)value; + PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "origin": - Origin = (Hl7.Fhir.Model.ResourceReference)value; + Origin = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "admitSource": - AdmitSource = (Hl7.Fhir.Model.CodeableConcept)value; + AdmitSource = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reAdmission": - ReAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + ReAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dietPreference": - DietPreference = (List)value; + DietPreference = (List?)value!; return this; case "specialCourtesy": - SpecialCourtesy = (List)value; + SpecialCourtesy = (List?)value!; return this; case "specialArrangement": - SpecialArrangement = (List)value; + SpecialArrangement = (List?)value!; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dischargeDisposition": - DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)value; + DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -987,15 +964,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",PreAdmissionIdentifier); - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (AdmitSource is not null) yield return new KeyValuePair("admitSource",AdmitSource); - if (ReAdmission is not null) yield return new KeyValuePair("reAdmission",ReAdmission); - if (DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",DietPreference); - if (SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",SpecialCourtesy); - if (SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",SpecialArrangement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",DischargeDisposition); + if (_PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",_PreAdmissionIdentifier); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_AdmitSource is not null) yield return new KeyValuePair("admitSource",_AdmitSource); + if (_ReAdmission is not null) yield return new KeyValuePair("reAdmission",_ReAdmission); + if (_DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",_DietPreference); + if (_SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",_SpecialCourtesy); + if (_SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",_SpecialArrangement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",_DischargeDisposition); } } @@ -1025,13 +1002,13 @@ public partial class LocationComponent : Hl7.Fhir.Model.BackboneElement [References("Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// planned | active | reserved | completed. @@ -1040,13 +1017,13 @@ public Hl7.Fhir.Model.ResourceReference Location [DeclaredType(Type = typeof(Code))] [Binding("EncounterLocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | active | reserved | completed @@ -1055,13 +1032,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1072,41 +1046,37 @@ public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status [FhirElement("physicalType", Order=60)] [Binding("PhysicalType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PhysicalType + public Hl7.Fhir.Model.CodeableConcept? PhysicalType { get { return _PhysicalType; } set { _PhysicalType = value; OnPropertyChanged("PhysicalType"); } } - private Hl7.Fhir.Model.CodeableConcept _PhysicalType; + private Hl7.Fhir.Model.CodeableConcept? _PhysicalType; /// /// Time period during which the patient was present at the location. /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as LocationComponent; - - if (dest == null) - { + if(other is not LocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PhysicalType != null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)PhysicalType.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PhysicalType is not null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)_PhysicalType.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1118,55 +1088,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LocationComponent; - if(otherT == null) return false; + if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(PhysicalType, otherT.PhysicalType)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_PhysicalType, otherT._PhysicalType)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "physicalType": - value = PhysicalType; - return PhysicalType is not null; + value = _PhysicalType; + return _PhysicalType is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "physicalType": - PhysicalType = (Hl7.Fhir.Model.CodeableConcept)value; + PhysicalType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -1177,10 +1147,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Location is not null) yield return new KeyValuePair("location",Location); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PhysicalType is not null) yield return new KeyValuePair("physicalType",PhysicalType); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PhysicalType is not null) yield return new KeyValuePair("physicalType",_PhysicalType); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -1193,11 +1163,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled +. @@ -1207,13 +1177,13 @@ public List Identifier [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | arrived | triaged | in-progress | onleave | finished | cancelled + @@ -1222,13 +1192,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1241,11 +1208,11 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [DataMember] public List StatusHistory { - get { if(_StatusHistory==null) _StatusHistory = new List(); return _StatusHistory; } + get => _StatusHistory ?? new List(); set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } - private List _StatusHistory; + private List? _StatusHistory; /// /// Classification of patient encounter. @@ -1254,13 +1221,13 @@ public List StatusHistory [Binding("EncounterClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Class + public Hl7.Fhir.Model.Coding? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.Coding _Class; + private Hl7.Fhir.Model.Coding? _Class; /// /// List of past encounter classes. @@ -1270,11 +1237,11 @@ public Hl7.Fhir.Model.Coding Class [DataMember] public List ClassHistory { - get { if(_ClassHistory==null) _ClassHistory = new List(); return _ClassHistory; } + get => _ClassHistory ?? new List(); set { _ClassHistory = value; OnPropertyChanged("ClassHistory"); } } - private List _ClassHistory; + private List? _ClassHistory; /// /// Specific type of encounter. @@ -1285,11 +1252,11 @@ public List ClassHistory [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specific type of service. @@ -1297,13 +1264,13 @@ public List Type [FhirElement("serviceType", InSummary=true, Order=150)] [Binding("EncounterServiceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ServiceType + public Hl7.Fhir.Model.CodeableConcept? ServiceType { get { return _ServiceType; } set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private Hl7.Fhir.Model.CodeableConcept _ServiceType; + private Hl7.Fhir.Model.CodeableConcept? _ServiceType; /// /// Indicates the urgency of the encounter. @@ -1311,13 +1278,13 @@ public Hl7.Fhir.Model.CodeableConcept ServiceType [FhirElement("priority", Order=160, FiveWs="FiveWs.grade")] [Binding("Priority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// The patient or group present at the encounter. @@ -1326,13 +1293,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Episode(s) of care that this encounter should be recorded against. @@ -1344,11 +1311,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List EpisodeOfCare { - get { if(_EpisodeOfCare==null) _EpisodeOfCare = new List(); return _EpisodeOfCare; } + get => _EpisodeOfCare ?? new List(); set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } - private List _EpisodeOfCare; + private List? _EpisodeOfCare; /// /// The ServiceRequest that initiated this encounter. @@ -1360,11 +1327,11 @@ public List EpisodeOfCare [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// List of participants involved in the encounter. @@ -1374,11 +1341,11 @@ public List BasedOn [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The appointment that scheduled this encounter. @@ -1390,37 +1357,37 @@ public List Participant [DataMember] public List Appointment { - get { if(_Appointment==null) _Appointment = new List(); return _Appointment; } + get => _Appointment ?? new List(); set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private List _Appointment; + private List? _Appointment; /// /// The start and end time of the encounter. /// [FhirElement("period", Order=220, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Quantity of time the encounter lasted (less time absent). /// [FhirElement("length", Order=230)] [DataMember] - public Hl7.Fhir.Model.Duration Length + public Hl7.Fhir.Model.Duration? Length { get { return _Length; } set { _Length = value; OnPropertyChanged("Length"); } } - private Hl7.Fhir.Model.Duration _Length; + private Hl7.Fhir.Model.Duration? _Length; /// /// Coded reason the encounter takes place. @@ -1431,11 +1398,11 @@ public Hl7.Fhir.Model.Duration Length [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Reason the encounter takes place (reference). @@ -1447,11 +1414,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// The list of diagnosis relevant to this encounter. @@ -1461,11 +1428,11 @@ public List ReasonReference [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The set of accounts that may be used for billing for this Encounter. @@ -1477,24 +1444,24 @@ public List Diagnosis [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Details about the admission to a healthcare service. /// [FhirElement("hospitalization", Order=280)] [DataMember] - public Hl7.Fhir.Model.Encounter.HospitalizationComponent Hospitalization + public Hl7.Fhir.Model.Encounter.HospitalizationComponent? Hospitalization { get { return _Hospitalization; } set { _Hospitalization = value; OnPropertyChanged("Hospitalization"); } } - private Hl7.Fhir.Model.Encounter.HospitalizationComponent _Hospitalization; + private Hl7.Fhir.Model.Encounter.HospitalizationComponent? _Hospitalization; /// /// List of locations where the patient has been. @@ -1504,11 +1471,11 @@ public Hl7.Fhir.Model.Encounter.HospitalizationComponent Hospitalization [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// The organization (facility) responsible for this encounter. @@ -1517,13 +1484,13 @@ public List Location [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ServiceProvider + public Hl7.Fhir.Model.ResourceReference? ServiceProvider { get { return _ServiceProvider; } set { _ServiceProvider = value; OnPropertyChanged("ServiceProvider"); } } - private Hl7.Fhir.Model.ResourceReference _ServiceProvider; + private Hl7.Fhir.Model.ResourceReference? _ServiceProvider; /// /// Another Encounter this encounter is part of. @@ -1532,49 +1499,45 @@ public Hl7.Fhir.Model.ResourceReference ServiceProvider [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Encounter; - - if (dest == null) - { + if(other is not Encounter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusHistory.Any()) dest.StatusHistory = new List(StatusHistory.DeepCopyInternal()); - if(Class != null) dest.Class = (Hl7.Fhir.Model.Coding)Class.DeepCopyInternal(); - if(ClassHistory.Any()) dest.ClassHistory = new List(ClassHistory.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(ServiceType != null) dest.ServiceType = (Hl7.Fhir.Model.CodeableConcept)ServiceType.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(EpisodeOfCare.Any()) dest.EpisodeOfCare = new List(EpisodeOfCare.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Appointment.Any()) dest.Appointment = new List(Appointment.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Length != null) dest.Length = (Hl7.Fhir.Model.Duration)Length.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(Hospitalization != null) dest.Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)Hospitalization.DeepCopyInternal(); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(ServiceProvider != null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)ServiceProvider.DeepCopyInternal(); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusHistory is not null) dest.StatusHistory = new List(_StatusHistory.DeepCopyInternal()); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.Coding)_Class.DeepCopyInternal(); + if(_ClassHistory is not null) dest.ClassHistory = new List(_ClassHistory.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = (Hl7.Fhir.Model.CodeableConcept)_ServiceType.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_EpisodeOfCare is not null) dest.EpisodeOfCare = new List(_EpisodeOfCare.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = new List(_Appointment.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Length is not null) dest.Length = (Hl7.Fhir.Model.Duration)_Length.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_Hospitalization is not null) dest.Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)_Hospitalization.DeepCopyInternal(); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_ServiceProvider is not null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)_ServiceProvider.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1586,188 +1549,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Encounter; - if(otherT == null) return false; + if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusHistory, otherT.StatusHistory)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(ClassHistory, otherT.ClassHistory)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(EpisodeOfCare, otherT.EpisodeOfCare)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(Appointment, otherT.Appointment)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Length, otherT.Length)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.Equals(Hospitalization, otherT.Hospitalization)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(ServiceProvider, otherT.ServiceProvider)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_ClassHistory, otherT._ClassHistory)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_EpisodeOfCare, otherT._EpisodeOfCare)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_Appointment, otherT._Appointment)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Length, otherT._Length)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.Equals(_Hospitalization, otherT._Hospitalization)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_ServiceProvider, otherT._ServiceProvider)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusHistory": - value = StatusHistory; - return StatusHistory?.Any() == true; + value = _StatusHistory; + return _StatusHistory?.Any() == true; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "classHistory": - value = ClassHistory; - return ClassHistory?.Any() == true; + value = _ClassHistory; + return _ClassHistory?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType is not null; + value = _ServiceType; + return _ServiceType is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "episodeOfCare": - value = EpisodeOfCare; - return EpisodeOfCare?.Any() == true; + value = _EpisodeOfCare; + return _EpisodeOfCare?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "appointment": - value = Appointment; - return Appointment?.Any() == true; + value = _Appointment; + return _Appointment?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "length": - value = Length; - return Length is not null; + value = _Length; + return _Length is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "hospitalization": - value = Hospitalization; - return Hospitalization is not null; + value = _Hospitalization; + return _Hospitalization is not null; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "serviceProvider": - value = ServiceProvider; - return ServiceProvider is not null; + value = _ServiceProvider; + return _ServiceProvider is not null; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusHistory": - StatusHistory = (List)value; + StatusHistory = (List?)value!; return this; case "class": - Class = (Hl7.Fhir.Model.Coding)value; + Class = (Hl7.Fhir.Model.Coding?)value; return this; case "classHistory": - ClassHistory = (List)value; + ClassHistory = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "serviceType": - ServiceType = (Hl7.Fhir.Model.CodeableConcept)value; + ServiceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "episodeOfCare": - EpisodeOfCare = (List)value; + EpisodeOfCare = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "appointment": - Appointment = (List)value; + Appointment = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "length": - Length = (Hl7.Fhir.Model.Duration)value; + Length = (Hl7.Fhir.Model.Duration?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "hospitalization": - Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent)value; + Hospitalization = (Hl7.Fhir.Model.Encounter.HospitalizationComponent?)value; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "serviceProvider": - ServiceProvider = (Hl7.Fhir.Model.ResourceReference)value; + ServiceProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1778,29 +1741,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",StatusHistory); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (ClassHistory?.Any() == true) yield return new KeyValuePair("classHistory",ClassHistory); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (ServiceType is not null) yield return new KeyValuePair("serviceType",ServiceType); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",EpisodeOfCare); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Appointment?.Any() == true) yield return new KeyValuePair("appointment",Appointment); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Length is not null) yield return new KeyValuePair("length",Length); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (Hospitalization is not null) yield return new KeyValuePair("hospitalization",Hospitalization); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",ServiceProvider); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",_StatusHistory); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_ClassHistory?.Any() == true) yield return new KeyValuePair("classHistory",_ClassHistory); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_ServiceType is not null) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",_EpisodeOfCare); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Appointment?.Any() == true) yield return new KeyValuePair("appointment",_Appointment); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Length is not null) yield return new KeyValuePair("length",_Length); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_Hospitalization is not null) yield return new KeyValuePair("hospitalization",_Hospitalization); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",_ServiceProvider); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs index c6d303f59..ef82a3d26 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,11 +116,11 @@ public enum EndpointStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | error | off | entered-in-error | test. @@ -127,13 +130,13 @@ public List Identifier [Binding("EndpointStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | error | off | entered-in-error | test @@ -142,13 +145,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -160,41 +160,38 @@ public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status [Binding("endpoint-contype")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding ConnectionType + public Hl7.Fhir.Model.Coding? ConnectionType { get { return _ConnectionType; } set { _ConnectionType = value; OnPropertyChanged("ConnectionType"); } } - private Hl7.Fhir.Model.Coding _ConnectionType; + private Hl7.Fhir.Model.Coding? _ConnectionType; /// /// A name that this endpoint can be identified by. /// [FhirElement("name", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name that this endpoint can be identified by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -206,13 +203,13 @@ public string Name [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Contact details for source (e.g. troubleshooting). @@ -222,24 +219,24 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Interval the endpoint is expected to be operational. /// [FhirElement("period", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The type of content that may be used at this endpoint (e.g. XDS Discharge summaries). @@ -250,11 +247,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List PayloadType { - get { if(_PayloadType==null) _PayloadType = new List(); return _PayloadType; } + get => _PayloadType ?? new List(); set { _PayloadType = value; OnPropertyChanged("PayloadType"); } } - private List _PayloadType; + private List? _PayloadType; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this). @@ -265,24 +262,24 @@ public List PayloadType [DataMember] public List PayloadMimeTypeElement { - get { if(_PayloadMimeTypeElement==null) _PayloadMimeTypeElement = new List(); return _PayloadMimeTypeElement; } + get => _PayloadMimeTypeElement ?? new List(); set { _PayloadMimeTypeElement = value; OnPropertyChanged("PayloadMimeTypeElement"); } } - private List _PayloadMimeTypeElement; + private List? _PayloadMimeTypeElement; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PayloadMimeType + public IEnumerable? PayloadMimeType { - get { return PayloadMimeTypeElement != null ? PayloadMimeTypeElement.Select(elem => elem.Value) : null; } + get => _PayloadMimeTypeElement?.Select(elem => elem.Value); set { if (value == null) - PayloadMimeTypeElement = null; + PayloadMimeTypeElement = null!; else PayloadMimeTypeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("PayloadMimeType"); @@ -295,28 +292,25 @@ public IEnumerable PayloadMimeType [FhirElement("address", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl AddressElement + public Hl7.Fhir.Model.FhirUrl? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirUrl _AddressElement; + private Hl7.Fhir.Model.FhirUrl? _AddressElement; /// /// The technical base address for connecting to this endpoint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirUrl(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Address"); } } @@ -329,24 +323,24 @@ public string Address [DataMember] public List HeaderElement { - get { if(_HeaderElement==null) _HeaderElement = new List(); return _HeaderElement; } + get => _HeaderElement ?? new List(); set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } - private List _HeaderElement; + private List? _HeaderElement; /// /// Usage depends on the channel type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Header + public IEnumerable? Header { - get { return HeaderElement != null ? HeaderElement.Select(elem => elem.Value) : null; } + get => _HeaderElement?.Select(elem => elem.Value); set { if (value == null) - HeaderElement = null; + HeaderElement = null!; else HeaderElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Header"); @@ -357,25 +351,21 @@ public IEnumerable Header protected internal override void CopyToInternal(Base other) { - var dest = other as Endpoint; - - if (dest == null) - { + if(other is not Endpoint dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ConnectionType != null) dest.ConnectionType = (Hl7.Fhir.Model.Coding)ConnectionType.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(PayloadType.Any()) dest.PayloadType = new List(PayloadType.DeepCopyInternal()); - if(PayloadMimeTypeElement.Any()) dest.PayloadMimeTypeElement = new List(PayloadMimeTypeElement.DeepCopyInternal()); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)AddressElement.DeepCopyInternal(); - if(HeaderElement.Any()) dest.HeaderElement = new List(HeaderElement.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ConnectionType is not null) dest.ConnectionType = (Hl7.Fhir.Model.Coding)_ConnectionType.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_PayloadType is not null) dest.PayloadType = new List(_PayloadType.DeepCopyInternal()); + if(_PayloadMimeTypeElement is not null) dest.PayloadMimeTypeElement = new List(_PayloadMimeTypeElement.DeepCopyInternal()); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)_AddressElement.DeepCopyInternal(); + if(_HeaderElement is not null) dest.HeaderElement = new List(_HeaderElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -387,104 +377,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Endpoint; - if(otherT == null) return false; + if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ConnectionType, otherT.ConnectionType)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(PayloadType, otherT.PayloadType)) return false; - if(!comparer.ListEquals(PayloadMimeTypeElement, otherT.PayloadMimeTypeElement)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; - if(!comparer.ListEquals(HeaderElement, otherT.HeaderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ConnectionType, otherT._ConnectionType)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_PayloadType, otherT._PayloadType)) return false; + if(!comparer.ListEquals(_PayloadMimeTypeElement, otherT._PayloadMimeTypeElement)) return false; + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "connectionType": - value = ConnectionType; - return ConnectionType is not null; + value = _ConnectionType; + return _ConnectionType is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "payloadType": - value = PayloadType; - return PayloadType?.Any() == true; + value = _PayloadType; + return _PayloadType?.Any() == true; case "payloadMimeType": - value = PayloadMimeTypeElement; - return PayloadMimeTypeElement?.Any() == true; + value = _PayloadMimeTypeElement; + return _PayloadMimeTypeElement?.Any() == true; case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; case "header": - value = HeaderElement; - return HeaderElement?.Any() == true; + value = _HeaderElement; + return _HeaderElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "connectionType": - ConnectionType = (Hl7.Fhir.Model.Coding)value; + ConnectionType = (Hl7.Fhir.Model.Coding?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "payloadType": - PayloadType = (List)value; + PayloadType = (List?)value!; return this; case "payloadMimeType": - PayloadMimeTypeElement = (List)value; + PayloadMimeTypeElement = (List?)value!; return this; case "address": - AddressElement = (Hl7.Fhir.Model.FhirUrl)value; + AddressElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "header": - HeaderElement = (List)value; + HeaderElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -495,17 +485,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ConnectionType is not null) yield return new KeyValuePair("connectionType",ConnectionType); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (PayloadType?.Any() == true) yield return new KeyValuePair("payloadType",PayloadType); - if (PayloadMimeTypeElement?.Any() == true) yield return new KeyValuePair("payloadMimeType",PayloadMimeTypeElement); - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); - if (HeaderElement?.Any() == true) yield return new KeyValuePair("header",HeaderElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ConnectionType is not null) yield return new KeyValuePair("connectionType",_ConnectionType); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_PayloadType?.Any() == true) yield return new KeyValuePair("payloadType",_PayloadType); + if (_PayloadMimeTypeElement?.Any() == true) yield return new KeyValuePair("payloadMimeType",_PayloadMimeTypeElement); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); + if (_HeaderElement?.Any() == true) yield return new KeyValuePair("header",_HeaderElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs index d00a3cdba..ee32c0d75 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -111,28 +111,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("created", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -144,13 +141,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Responsible practitioner. @@ -159,13 +156,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// The subject to be enrolled. @@ -174,13 +171,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Candidate + public Hl7.Fhir.Model.ResourceReference? Candidate { get { return _Candidate; } set { _Candidate = value; OnPropertyChanged("Candidate"); } } - private Hl7.Fhir.Model.ResourceReference _Candidate; + private Hl7.Fhir.Model.ResourceReference? _Candidate; /// /// Insurance information. @@ -189,33 +186,29 @@ public Hl7.Fhir.Model.ResourceReference Candidate [CLSCompliant(false)] [References("Coverage")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentRequest; - - if (dest == null) - { + if(other is not EnrollmentRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Candidate != null) dest.Candidate = (Hl7.Fhir.Model.ResourceReference)Candidate.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Candidate is not null) dest.Candidate = (Hl7.Fhir.Model.ResourceReference)_Candidate.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -227,76 +220,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentRequest; - if(otherT == null) return false; + if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Candidate, otherT.Candidate)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Candidate, otherT._Candidate)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "candidate": - value = Candidate; - return Candidate is not null; + value = _Candidate; + return _Candidate is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "candidate": - Candidate = (Hl7.Fhir.Model.ResourceReference)value; + Candidate = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -307,13 +300,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Candidate is not null) yield return new KeyValuePair("candidate",Candidate); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Candidate is not null) yield return new KeyValuePair("candidate",_Candidate); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs index e9dd710d2..f0a0eb640 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EnrollmentResponse : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentResponseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -113,13 +113,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("EnrollmentRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -128,13 +128,13 @@ public Hl7.Fhir.Model.ResourceReference Request [DeclaredType(Type = typeof(Code))] [Binding("RemittanceOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -143,13 +143,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.RemittanceOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -159,28 +156,25 @@ public Hl7.Fhir.Model.RemittanceOutcome? Outcome /// [FhirElement("disposition", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -190,28 +184,25 @@ public string Disposition /// [FhirElement("created", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -223,13 +214,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Responsible practitioner. @@ -238,34 +229,30 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentResponse; - - if (dest == null) - { + if(other is not EnrollmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -277,83 +264,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentResponse; - if(otherT == null) return false; + if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -364,14 +351,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs index 1acf9144c..3f9a2017e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -135,13 +138,13 @@ public partial class StatusHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -150,13 +153,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -167,26 +167,22 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusHistoryComponent; - - if (dest == null) - { + if(other is not StatusHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -198,41 +194,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusHistoryComponent; - if(otherT == null) return false; + if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -243,8 +239,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -270,13 +266,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …). @@ -284,26 +280,26 @@ public Hl7.Fhir.Model.ResourceReference Condition [FhirElement("role", InSummary=true, Order=50)] [Binding("DiagnosisRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Ranking of the diagnosis (for each role type). /// [FhirElement("rank", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankElement + public Hl7.Fhir.Model.PositiveInt? RankElement { get { return _RankElement; } set { _RankElement = value; OnPropertyChanged("RankElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankElement; + private Hl7.Fhir.Model.PositiveInt? _RankElement; /// /// Ranking of the diagnosis (for each role type) @@ -312,30 +308,23 @@ public Hl7.Fhir.Model.PositiveInt RankElement [IgnoreDataMember] public int? Rank { - get { return RankElement != null ? RankElement.Value : null; } + get => _RankElement?.Value; set { - if (value == null) - RankElement = null; - else - RankElement = new Hl7.Fhir.Model.PositiveInt(value); + RankElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Rank"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(RankElement != null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)RankElement.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_RankElement is not null) dest.RankElement = (Hl7.Fhir.Model.PositiveInt)_RankElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -347,48 +336,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(RankElement, otherT.RankElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "rank": - value = RankElement; - return RankElement is not null; + value = _RankElement; + return _RankElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rank": - RankElement = (Hl7.Fhir.Model.PositiveInt)value; + RankElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -399,9 +388,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (RankElement is not null) yield return new KeyValuePair("rank",RankElement); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_RankElement is not null) yield return new KeyValuePair("rank",_RankElement); } } @@ -414,11 +403,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error. @@ -428,13 +417,13 @@ public List Identifier [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -443,13 +432,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -462,11 +448,11 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get { if(_StatusHistory==null) _StatusHistory = new List(); return _StatusHistory; } + get => _StatusHistory ?? new List(); set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } - private List _StatusHistory; + private List? _StatusHistory; /// /// Type/class - e.g. specialist referral, disease management. @@ -477,11 +463,11 @@ public List StatusHistory [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// The list of diagnosis relevant to this episode of care. @@ -491,11 +477,11 @@ public List Type [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The patient who is the focus of this episode of care. @@ -505,13 +491,13 @@ public List Diagnosis [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Organization that assumes care. @@ -520,26 +506,26 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Interval during responsibility is assumed. /// [FhirElement("period", InSummary=true, Order=160, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Originating Referral Request(s). @@ -551,11 +537,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List ReferralRequest { - get { if(_ReferralRequest==null) _ReferralRequest = new List(); return _ReferralRequest; } + get => _ReferralRequest ?? new List(); set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } - private List _ReferralRequest; + private List? _ReferralRequest; /// /// Care manager/care coordinator for the patient. @@ -564,13 +550,13 @@ public List ReferralRequest [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CareManager + public Hl7.Fhir.Model.ResourceReference? CareManager { get { return _CareManager; } set { _CareManager = value; OnPropertyChanged("CareManager"); } } - private Hl7.Fhir.Model.ResourceReference _CareManager; + private Hl7.Fhir.Model.ResourceReference? _CareManager; /// /// Other practitioners facilitating this episode of care. @@ -582,11 +568,11 @@ public Hl7.Fhir.Model.ResourceReference CareManager [DataMember] public List Team { - get { if(_Team==null) _Team = new List(); return _Team; } + get => _Team ?? new List(); set { _Team = value; OnPropertyChanged("Team"); } } - private List _Team; + private List? _Team; /// /// The set of accounts that may be used for billing for this EpisodeOfCare. @@ -598,36 +584,32 @@ public List Team [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EpisodeOfCare; - - if (dest == null) - { + if(other is not EpisodeOfCare dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusHistory.Any()) dest.StatusHistory = new List(StatusHistory.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(ReferralRequest.Any()) dest.ReferralRequest = new List(ReferralRequest.DeepCopyInternal()); - if(CareManager != null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)CareManager.DeepCopyInternal(); - if(Team.Any()) dest.Team = new List(Team.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusHistory is not null) dest.StatusHistory = new List(_StatusHistory.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_ReferralRequest is not null) dest.ReferralRequest = new List(_ReferralRequest.DeepCopyInternal()); + if(_CareManager is not null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)_CareManager.DeepCopyInternal(); + if(_Team is not null) dest.Team = new List(_Team.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -639,111 +621,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EpisodeOfCare; - if(otherT == null) return false; + if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusHistory, otherT.StatusHistory)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(ReferralRequest, otherT.ReferralRequest)) return false; - if(!comparer.Equals(CareManager, otherT.CareManager)) return false; - if(!comparer.ListEquals(Team, otherT.Team)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_ReferralRequest, otherT._ReferralRequest)) return false; + if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; + if(!comparer.ListEquals(_Team, otherT._Team)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusHistory": - value = StatusHistory; - return StatusHistory?.Any() == true; + value = _StatusHistory; + return _StatusHistory?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "referralRequest": - value = ReferralRequest; - return ReferralRequest?.Any() == true; + value = _ReferralRequest; + return _ReferralRequest?.Any() == true; case "careManager": - value = CareManager; - return CareManager is not null; + value = _CareManager; + return _CareManager is not null; case "team": - value = Team; - return Team?.Any() == true; + value = _Team; + return _Team?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusHistory": - StatusHistory = (List)value; + StatusHistory = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "referralRequest": - ReferralRequest = (List)value; + ReferralRequest = (List?)value!; return this; case "careManager": - CareManager = (Hl7.Fhir.Model.ResourceReference)value; + CareManager = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "team": - Team = (List)value; + Team = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; default: return base.SetValue(key, value); @@ -754,18 +736,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",StatusHistory); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",ReferralRequest); - if (CareManager is not null) yield return new KeyValuePair("careManager",CareManager); - if (Team?.Any() == true) yield return new KeyValuePair("team",Team); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",_StatusHistory); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",_ReferralRequest); + if (_CareManager is not null) yield return new KeyValuePair("careManager",_CareManager); + if (_Team?.Any() == true) yield return new KeyValuePair("team",_Team); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs index 7b98bfeaa..47b010071 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class EventDefinition : Hl7.Fhir.Model.DomainResource, IIdentifia /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this event definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the event definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this event definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this event definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -202,28 +193,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -236,13 +224,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -251,13 +239,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -267,13 +252,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -282,13 +267,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -302,41 +284,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -346,28 +325,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -380,39 +356,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the event definition. /// [FhirElement("description", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -425,11 +398,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for event definition (if applicable). @@ -440,39 +413,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this event definition is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this event definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -482,28 +452,25 @@ public string Purpose /// [FhirElement("usage", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -513,28 +480,25 @@ public string Usage /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -544,28 +508,25 @@ public string Copyright /// [FhirElement("approvalDate", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the event definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -575,28 +536,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the event definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -606,13 +564,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -623,11 +581,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -637,11 +595,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -651,11 +609,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -665,11 +623,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -679,11 +637,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -693,11 +651,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// "when" the event occurs (multiple = 'or'). @@ -707,52 +665,48 @@ public List RelatedArtifact [DataMember] public List Trigger { - get { if(_Trigger==null) _Trigger = new List(); return _Trigger; } + get => _Trigger ?? new List(); set { _Trigger = value; OnPropertyChanged("Trigger"); } } - private List _Trigger; + private List? _Trigger; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EventDefinition; - - if (dest == null) - { + if(other is not EventDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Trigger.Any()) dest.Trigger = new List(Trigger.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Trigger is not null) dest.Trigger = new List(_Trigger.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -764,223 +718,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventDefinition; - if(otherT == null) return false; + if(other is not EventDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Trigger, otherT.Trigger)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "trigger": - value = Trigger; - return Trigger?.Any() == true; + value = _Trigger; + return _Trigger?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "trigger": - Trigger = (List)value; + Trigger = (List?)value!; return this; default: return base.SetValue(key, value); @@ -991,34 +945,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Trigger?.Any() == true) yield return new KeyValuePair("trigger",Trigger); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Trigger?.Any() == true) yield return new KeyValuePair("trigger",_Trigger); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs index a393983dc..c5e850f1f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -77,28 +80,25 @@ public partial class VariableDefinitionComponent : Hl7.Fhir.Model.BackboneElemen /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A text description or summary of the variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -111,11 +111,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// population | subpopulation | exposure | referenceExposure | measuredVariable | confounder. @@ -124,13 +124,13 @@ public List Note [Binding("EvidenceVariableRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VariableRole + public Hl7.Fhir.Model.CodeableConcept? VariableRole { get { return _VariableRole; } set { _VariableRole = value; OnPropertyChanged("VariableRole"); } } - private Hl7.Fhir.Model.CodeableConcept _VariableRole; + private Hl7.Fhir.Model.CodeableConcept? _VariableRole; /// /// Definition of the actual variable related to the statistic(s). @@ -139,13 +139,13 @@ public Hl7.Fhir.Model.CodeableConcept VariableRole [CLSCompliant(false)] [References("Group","EvidenceVariable")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Observed + public Hl7.Fhir.Model.ResourceReference? Observed { get { return _Observed; } set { _Observed = value; OnPropertyChanged("Observed"); } } - private Hl7.Fhir.Model.ResourceReference _Observed; + private Hl7.Fhir.Model.ResourceReference? _Observed; /// /// Definition of the intended variable related to the Evidence. @@ -154,13 +154,13 @@ public Hl7.Fhir.Model.ResourceReference Observed [CLSCompliant(false)] [References("Group","EvidenceVariable")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Intended + public Hl7.Fhir.Model.ResourceReference? Intended { get { return _Intended; } set { _Intended = value; OnPropertyChanged("Intended"); } } - private Hl7.Fhir.Model.ResourceReference _Intended; + private Hl7.Fhir.Model.ResourceReference? _Intended; /// /// low | moderate | high | exact. @@ -168,30 +168,26 @@ public Hl7.Fhir.Model.ResourceReference Intended [FhirElement("directnessMatch", Order=90)] [Binding("EvidenceDirectness")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DirectnessMatch + public Hl7.Fhir.Model.CodeableConcept? DirectnessMatch { get { return _DirectnessMatch; } set { _DirectnessMatch = value; OnPropertyChanged("DirectnessMatch"); } } - private Hl7.Fhir.Model.CodeableConcept _DirectnessMatch; + private Hl7.Fhir.Model.CodeableConcept? _DirectnessMatch; protected internal override void CopyToInternal(Base other) { - var dest = other as VariableDefinitionComponent; - - if (dest == null) - { + if(other is not VariableDefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(VariableRole != null) dest.VariableRole = (Hl7.Fhir.Model.CodeableConcept)VariableRole.DeepCopyInternal(); - if(Observed != null) dest.Observed = (Hl7.Fhir.Model.ResourceReference)Observed.DeepCopyInternal(); - if(Intended != null) dest.Intended = (Hl7.Fhir.Model.ResourceReference)Intended.DeepCopyInternal(); - if(DirectnessMatch != null) dest.DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept)DirectnessMatch.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_VariableRole is not null) dest.VariableRole = (Hl7.Fhir.Model.CodeableConcept)_VariableRole.DeepCopyInternal(); + if(_Observed is not null) dest.Observed = (Hl7.Fhir.Model.ResourceReference)_Observed.DeepCopyInternal(); + if(_Intended is not null) dest.Intended = (Hl7.Fhir.Model.ResourceReference)_Intended.DeepCopyInternal(); + if(_DirectnessMatch is not null) dest.DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept)_DirectnessMatch.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -203,69 +199,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableDefinitionComponent; - if(otherT == null) return false; + if(other is not VariableDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(VariableRole, otherT.VariableRole)) return false; - if(!comparer.Equals(Observed, otherT.Observed)) return false; - if(!comparer.Equals(Intended, otherT.Intended)) return false; - if(!comparer.Equals(DirectnessMatch, otherT.DirectnessMatch)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_VariableRole, otherT._VariableRole)) return false; + if(!comparer.Equals(_Observed, otherT._Observed)) return false; + if(!comparer.Equals(_Intended, otherT._Intended)) return false; + if(!comparer.Equals(_DirectnessMatch, otherT._DirectnessMatch)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "variableRole": - value = VariableRole; - return VariableRole is not null; + value = _VariableRole; + return _VariableRole is not null; case "observed": - value = Observed; - return Observed is not null; + value = _Observed; + return _Observed is not null; case "intended": - value = Intended; - return Intended is not null; + value = _Intended; + return _Intended is not null; case "directnessMatch": - value = DirectnessMatch; - return DirectnessMatch is not null; + value = _DirectnessMatch; + return _DirectnessMatch is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "variableRole": - VariableRole = (Hl7.Fhir.Model.CodeableConcept)value; + VariableRole = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "observed": - Observed = (Hl7.Fhir.Model.ResourceReference)value; + Observed = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "intended": - Intended = (Hl7.Fhir.Model.ResourceReference)value; + Intended = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "directnessMatch": - DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept)value; + DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -276,12 +272,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (VariableRole is not null) yield return new KeyValuePair("variableRole",VariableRole); - if (Observed is not null) yield return new KeyValuePair("observed",Observed); - if (Intended is not null) yield return new KeyValuePair("intended",Intended); - if (DirectnessMatch is not null) yield return new KeyValuePair("directnessMatch",DirectnessMatch); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_VariableRole is not null) yield return new KeyValuePair("variableRole",_VariableRole); + if (_Observed is not null) yield return new KeyValuePair("observed",_Observed); + if (_Intended is not null) yield return new KeyValuePair("intended",_Intended); + if (_DirectnessMatch is not null) yield return new KeyValuePair("directnessMatch",_DirectnessMatch); } } @@ -304,28 +300,25 @@ public partial class StatisticComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -338,11 +331,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Type of statistic, eg relative risk. @@ -350,52 +343,52 @@ public List Note [FhirElement("statisticType", Order=60)] [Binding("StatisticType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatisticType + public Hl7.Fhir.Model.CodeableConcept? StatisticType { get { return _StatisticType; } set { _StatisticType = value; OnPropertyChanged("StatisticType"); } } - private Hl7.Fhir.Model.CodeableConcept _StatisticType; + private Hl7.Fhir.Model.CodeableConcept? _StatisticType; /// /// Associated category for categorical variable. /// [FhirElement("category", Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Statistic value. /// [FhirElement("quantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The number of events associated with the statistic. /// [FhirElement("numberOfEvents", Order=90)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfEventsElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfEventsElement { get { return _NumberOfEventsElement; } set { _NumberOfEventsElement = value; OnPropertyChanged("NumberOfEventsElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfEventsElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfEventsElement; /// /// The number of events associated with the statistic @@ -404,13 +397,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfEventsElement [IgnoreDataMember] public int? NumberOfEvents { - get { return NumberOfEventsElement != null ? NumberOfEventsElement.Value : null; } + get => _NumberOfEventsElement?.Value; set { - if (value == null) - NumberOfEventsElement = null; - else - NumberOfEventsElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfEventsElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfEvents"); } } @@ -420,13 +410,13 @@ public int? NumberOfEvents /// [FhirElement("numberAffected", Order=100)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberAffectedElement + public Hl7.Fhir.Model.UnsignedInt? NumberAffectedElement { get { return _NumberAffectedElement; } set { _NumberAffectedElement = value; OnPropertyChanged("NumberAffectedElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberAffectedElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberAffectedElement; /// /// The number of participants affected @@ -435,13 +425,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberAffectedElement [IgnoreDataMember] public int? NumberAffected { - get { return NumberAffectedElement != null ? NumberAffectedElement.Value : null; } + get => _NumberAffectedElement?.Value; set { - if (value == null) - NumberAffectedElement = null; - else - NumberAffectedElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberAffectedElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberAffected"); } } @@ -451,13 +438,13 @@ public int? NumberAffected /// [FhirElement("sampleSize", Order=110)] [DataMember] - public Hl7.Fhir.Model.Evidence.SampleSizeComponent SampleSize + public Hl7.Fhir.Model.Evidence.SampleSizeComponent? SampleSize { get { return _SampleSize; } set { _SampleSize = value; OnPropertyChanged("SampleSize"); } } - private Hl7.Fhir.Model.Evidence.SampleSizeComponent _SampleSize; + private Hl7.Fhir.Model.Evidence.SampleSizeComponent? _SampleSize; /// /// An attribute of the Statistic. @@ -467,11 +454,11 @@ public Hl7.Fhir.Model.Evidence.SampleSizeComponent SampleSize [DataMember] public List AttributeEstimate { - get { if(_AttributeEstimate==null) _AttributeEstimate = new List(); return _AttributeEstimate; } + get => _AttributeEstimate ?? new List(); set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } - private List _AttributeEstimate; + private List? _AttributeEstimate; /// /// An aspect of the statistical model. @@ -481,32 +468,28 @@ public List AttributeEstimat [DataMember] public List ModelCharacteristic { - get { if(_ModelCharacteristic==null) _ModelCharacteristic = new List(); return _ModelCharacteristic; } + get => _ModelCharacteristic ?? new List(); set { _ModelCharacteristic = value; OnPropertyChanged("ModelCharacteristic"); } } - private List _ModelCharacteristic; + private List? _ModelCharacteristic; protected internal override void CopyToInternal(Base other) { - var dest = other as StatisticComponent; - - if (dest == null) - { + if(other is not StatisticComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(StatisticType != null) dest.StatisticType = (Hl7.Fhir.Model.CodeableConcept)StatisticType.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(NumberOfEventsElement != null) dest.NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfEventsElement.DeepCopyInternal(); - if(NumberAffectedElement != null) dest.NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt)NumberAffectedElement.DeepCopyInternal(); - if(SampleSize != null) dest.SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent)SampleSize.DeepCopyInternal(); - if(AttributeEstimate.Any()) dest.AttributeEstimate = new List(AttributeEstimate.DeepCopyInternal()); - if(ModelCharacteristic.Any()) dest.ModelCharacteristic = new List(ModelCharacteristic.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_StatisticType is not null) dest.StatisticType = (Hl7.Fhir.Model.CodeableConcept)_StatisticType.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_NumberOfEventsElement is not null) dest.NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfEventsElement.DeepCopyInternal(); + if(_NumberAffectedElement is not null) dest.NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt)_NumberAffectedElement.DeepCopyInternal(); + if(_SampleSize is not null) dest.SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent)_SampleSize.DeepCopyInternal(); + if(_AttributeEstimate is not null) dest.AttributeEstimate = new List(_AttributeEstimate.DeepCopyInternal()); + if(_ModelCharacteristic is not null) dest.ModelCharacteristic = new List(_ModelCharacteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -518,97 +501,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatisticComponent; - if(otherT == null) return false; + if(other is not StatisticComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(StatisticType, otherT.StatisticType)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(NumberOfEventsElement, otherT.NumberOfEventsElement)) return false; - if(!comparer.Equals(NumberAffectedElement, otherT.NumberAffectedElement)) return false; - if(!comparer.Equals(SampleSize, otherT.SampleSize)) return false; - if(!comparer.ListEquals(AttributeEstimate, otherT.AttributeEstimate)) return false; - if(!comparer.ListEquals(ModelCharacteristic, otherT.ModelCharacteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_StatisticType, otherT._StatisticType)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_NumberOfEventsElement, otherT._NumberOfEventsElement)) return false; + if(!comparer.Equals(_NumberAffectedElement, otherT._NumberAffectedElement)) return false; + if(!comparer.Equals(_SampleSize, otherT._SampleSize)) return false; + if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; + if(!comparer.ListEquals(_ModelCharacteristic, otherT._ModelCharacteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "statisticType": - value = StatisticType; - return StatisticType is not null; + value = _StatisticType; + return _StatisticType is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "numberOfEvents": - value = NumberOfEventsElement; - return NumberOfEventsElement is not null; + value = _NumberOfEventsElement; + return _NumberOfEventsElement is not null; case "numberAffected": - value = NumberAffectedElement; - return NumberAffectedElement is not null; + value = _NumberAffectedElement; + return _NumberAffectedElement is not null; case "sampleSize": - value = SampleSize; - return SampleSize is not null; + value = _SampleSize; + return _SampleSize is not null; case "attributeEstimate": - value = AttributeEstimate; - return AttributeEstimate?.Any() == true; + value = _AttributeEstimate; + return _AttributeEstimate?.Any() == true; case "modelCharacteristic": - value = ModelCharacteristic; - return ModelCharacteristic?.Any() == true; + value = _ModelCharacteristic; + return _ModelCharacteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "statisticType": - StatisticType = (Hl7.Fhir.Model.CodeableConcept)value; + StatisticType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "numberOfEvents": - NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberAffected": - NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "sampleSize": - SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent)value; + SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent?)value; return this; case "attributeEstimate": - AttributeEstimate = (List)value; + AttributeEstimate = (List?)value!; return this; case "modelCharacteristic": - ModelCharacteristic = (List)value; + ModelCharacteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -619,16 +602,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (StatisticType is not null) yield return new KeyValuePair("statisticType",StatisticType); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (NumberOfEventsElement is not null) yield return new KeyValuePair("numberOfEvents",NumberOfEventsElement); - if (NumberAffectedElement is not null) yield return new KeyValuePair("numberAffected",NumberAffectedElement); - if (SampleSize is not null) yield return new KeyValuePair("sampleSize",SampleSize); - if (AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",AttributeEstimate); - if (ModelCharacteristic?.Any() == true) yield return new KeyValuePair("modelCharacteristic",ModelCharacteristic); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_StatisticType is not null) yield return new KeyValuePair("statisticType",_StatisticType); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_NumberOfEventsElement is not null) yield return new KeyValuePair("numberOfEvents",_NumberOfEventsElement); + if (_NumberAffectedElement is not null) yield return new KeyValuePair("numberAffected",_NumberAffectedElement); + if (_SampleSize is not null) yield return new KeyValuePair("sampleSize",_SampleSize); + if (_AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",_AttributeEstimate); + if (_ModelCharacteristic?.Any() == true) yield return new KeyValuePair("modelCharacteristic",_ModelCharacteristic); } } @@ -651,28 +634,25 @@ public partial class SampleSizeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of sample size for statistic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -685,24 +665,24 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Number of contributing studies. /// [FhirElement("numberOfStudies", Order=60)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfStudiesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfStudiesElement { get { return _NumberOfStudiesElement; } set { _NumberOfStudiesElement = value; OnPropertyChanged("NumberOfStudiesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfStudiesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfStudiesElement; /// /// Number of contributing studies @@ -711,13 +691,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfStudiesElement [IgnoreDataMember] public int? NumberOfStudies { - get { return NumberOfStudiesElement != null ? NumberOfStudiesElement.Value : null; } + get => _NumberOfStudiesElement?.Value; set { - if (value == null) - NumberOfStudiesElement = null; - else - NumberOfStudiesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfStudiesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfStudies"); } } @@ -727,13 +704,13 @@ public int? NumberOfStudies /// [FhirElement("numberOfParticipants", Order=70)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfParticipantsElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfParticipantsElement { get { return _NumberOfParticipantsElement; } set { _NumberOfParticipantsElement = value; OnPropertyChanged("NumberOfParticipantsElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfParticipantsElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfParticipantsElement; /// /// Cumulative number of participants @@ -742,13 +719,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfParticipantsElement [IgnoreDataMember] public int? NumberOfParticipants { - get { return NumberOfParticipantsElement != null ? NumberOfParticipantsElement.Value : null; } + get => _NumberOfParticipantsElement?.Value; set { - if (value == null) - NumberOfParticipantsElement = null; - else - NumberOfParticipantsElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfParticipantsElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfParticipants"); } } @@ -758,13 +732,13 @@ public int? NumberOfParticipants /// [FhirElement("knownDataCount", Order=80)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt KnownDataCountElement + public Hl7.Fhir.Model.UnsignedInt? KnownDataCountElement { get { return _KnownDataCountElement; } set { _KnownDataCountElement = value; OnPropertyChanged("KnownDataCountElement"); } } - private Hl7.Fhir.Model.UnsignedInt _KnownDataCountElement; + private Hl7.Fhir.Model.UnsignedInt? _KnownDataCountElement; /// /// Number of participants with known results for measured variables @@ -773,32 +747,25 @@ public Hl7.Fhir.Model.UnsignedInt KnownDataCountElement [IgnoreDataMember] public int? KnownDataCount { - get { return KnownDataCountElement != null ? KnownDataCountElement.Value : null; } + get => _KnownDataCountElement?.Value; set { - if (value == null) - KnownDataCountElement = null; - else - KnownDataCountElement = new Hl7.Fhir.Model.UnsignedInt(value); + KnownDataCountElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("KnownDataCount"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampleSizeComponent; - - if (dest == null) - { + if(other is not SampleSizeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(NumberOfStudiesElement != null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfStudiesElement.DeepCopyInternal(); - if(NumberOfParticipantsElement != null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfParticipantsElement.DeepCopyInternal(); - if(KnownDataCountElement != null) dest.KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt)KnownDataCountElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_NumberOfStudiesElement is not null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfStudiesElement.DeepCopyInternal(); + if(_NumberOfParticipantsElement is not null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfParticipantsElement.DeepCopyInternal(); + if(_KnownDataCountElement is not null) dest.KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt)_KnownDataCountElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -810,62 +777,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampleSizeComponent; - if(otherT == null) return false; + if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(NumberOfStudiesElement, otherT.NumberOfStudiesElement)) return false; - if(!comparer.Equals(NumberOfParticipantsElement, otherT.NumberOfParticipantsElement)) return false; - if(!comparer.Equals(KnownDataCountElement, otherT.KnownDataCountElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; + if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; + if(!comparer.Equals(_KnownDataCountElement, otherT._KnownDataCountElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "numberOfStudies": - value = NumberOfStudiesElement; - return NumberOfStudiesElement is not null; + value = _NumberOfStudiesElement; + return _NumberOfStudiesElement is not null; case "numberOfParticipants": - value = NumberOfParticipantsElement; - return NumberOfParticipantsElement is not null; + value = _NumberOfParticipantsElement; + return _NumberOfParticipantsElement is not null; case "knownDataCount": - value = KnownDataCountElement; - return KnownDataCountElement is not null; + value = _KnownDataCountElement; + return _KnownDataCountElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "numberOfStudies": - NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberOfParticipants": - NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "knownDataCount": - KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt)value; + KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; default: return base.SetValue(key, value); @@ -876,11 +843,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",NumberOfStudiesElement); - if (NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",NumberOfParticipantsElement); - if (KnownDataCountElement is not null) yield return new KeyValuePair("knownDataCount",KnownDataCountElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",_NumberOfStudiesElement); + if (_NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",_NumberOfParticipantsElement); + if (_KnownDataCountElement is not null) yield return new KeyValuePair("knownDataCount",_KnownDataCountElement); } } @@ -906,28 +873,25 @@ public partial class AttributeEstimateComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the attribute estimate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -940,11 +904,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The type of attribute estimate, eg confidence interval or p value. @@ -952,39 +916,39 @@ public List Note [FhirElement("type", Order=60)] [Binding("AttributeEstimateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Level of confidence interval, eg 0.95 for 95% confidence interval. /// [FhirElement("level", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LevelElement + public Hl7.Fhir.Model.FhirDecimal? LevelElement { get { return _LevelElement; } set { _LevelElement = value; OnPropertyChanged("LevelElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LevelElement; + private Hl7.Fhir.Model.FhirDecimal? _LevelElement; /// /// Level of confidence interval, eg 0.95 for 95% confidence interval @@ -993,13 +957,10 @@ public Hl7.Fhir.Model.FhirDecimal LevelElement [IgnoreDataMember] public decimal? Level { - get { return LevelElement != null ? LevelElement.Value : null; } + get => _LevelElement?.Value; set { - if (value == null) - LevelElement = null; - else - LevelElement = new Hl7.Fhir.Model.FhirDecimal(value); + LevelElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Level"); } } @@ -1009,13 +970,13 @@ public decimal? Level /// [FhirElement("range", Order=90)] [DataMember] - public Hl7.Fhir.Model.Range Range + public Hl7.Fhir.Model.Range? Range { get { return _Range; } set { _Range = value; OnPropertyChanged("Range"); } } - private Hl7.Fhir.Model.Range _Range; + private Hl7.Fhir.Model.Range? _Range; /// /// A nested attribute estimate; which is the attribute estimate of an attribute estimate. @@ -1025,29 +986,25 @@ public Hl7.Fhir.Model.Range Range [DataMember] public List AttributeEstimate { - get { if(_AttributeEstimate==null) _AttributeEstimate = new List(); return _AttributeEstimate; } + get => _AttributeEstimate ?? new List(); set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } - private List _AttributeEstimate; + private List? _AttributeEstimate; protected internal override void CopyToInternal(Base other) { - var dest = other as AttributeEstimateComponent; - - if (dest == null) - { + if(other is not AttributeEstimateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(LevelElement != null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)LevelElement.DeepCopyInternal(); - if(Range != null) dest.Range = (Hl7.Fhir.Model.Range)Range.DeepCopyInternal(); - if(AttributeEstimate.Any()) dest.AttributeEstimate = new List(AttributeEstimate.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_LevelElement is not null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)_LevelElement.DeepCopyInternal(); + if(_Range is not null) dest.Range = (Hl7.Fhir.Model.Range)_Range.DeepCopyInternal(); + if(_AttributeEstimate is not null) dest.AttributeEstimate = new List(_AttributeEstimate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1059,76 +1016,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttributeEstimateComponent; - if(otherT == null) return false; + if(other is not AttributeEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(LevelElement, otherT.LevelElement)) return false; - if(!comparer.Equals(Range, otherT.Range)) return false; - if(!comparer.ListEquals(AttributeEstimate, otherT.AttributeEstimate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; + if(!comparer.Equals(_Range, otherT._Range)) return false; + if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "level": - value = LevelElement; - return LevelElement is not null; + value = _LevelElement; + return _LevelElement is not null; case "range": - value = Range; - return Range is not null; + value = _Range; + return _Range is not null; case "attributeEstimate": - value = AttributeEstimate; - return AttributeEstimate?.Any() == true; + value = _AttributeEstimate; + return _AttributeEstimate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "level": - LevelElement = (Hl7.Fhir.Model.FhirDecimal)value; + LevelElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "range": - Range = (Hl7.Fhir.Model.Range)value; + Range = (Hl7.Fhir.Model.Range?)value; return this; case "attributeEstimate": - AttributeEstimate = (List)value; + AttributeEstimate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1139,13 +1096,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (LevelElement is not null) yield return new KeyValuePair("level",LevelElement); - if (Range is not null) yield return new KeyValuePair("range",Range); - if (AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",AttributeEstimate); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_LevelElement is not null) yield return new KeyValuePair("level",_LevelElement); + if (_Range is not null) yield return new KeyValuePair("range",_Range); + if (_AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",_AttributeEstimate); } } @@ -1173,26 +1130,26 @@ public partial class ModelCharacteristicComponent : Hl7.Fhir.Model.BackboneEleme [Binding("StatisticModelCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Numerical value to complete model specification. /// [FhirElement("value", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// A variable adjusted for in the adjusted analysis. @@ -1202,11 +1159,11 @@ public Hl7.Fhir.Model.Quantity Value [DataMember] public List Variable { - get { if(_Variable==null) _Variable = new List(); return _Variable; } + get => _Variable ?? new List(); set { _Variable = value; OnPropertyChanged("Variable"); } } - private List _Variable; + private List? _Variable; /// /// An attribute of the statistic used as a model characteristic. @@ -1216,26 +1173,22 @@ public List Variable [DataMember] public List AttributeEstimate { - get { if(_AttributeEstimate==null) _AttributeEstimate = new List(); return _AttributeEstimate; } + get => _AttributeEstimate ?? new List(); set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } - private List _AttributeEstimate; + private List? _AttributeEstimate; protected internal override void CopyToInternal(Base other) { - var dest = other as ModelCharacteristicComponent; - - if (dest == null) - { + if(other is not ModelCharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(Variable.Any()) dest.Variable = new List(Variable.DeepCopyInternal()); - if(AttributeEstimate.Any()) dest.AttributeEstimate = new List(AttributeEstimate.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_Variable is not null) dest.Variable = new List(_Variable.DeepCopyInternal()); + if(_AttributeEstimate is not null) dest.AttributeEstimate = new List(_AttributeEstimate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1247,55 +1200,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ModelCharacteristicComponent; - if(otherT == null) return false; + if(other is not ModelCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Variable, otherT.Variable)) return false; - if(!comparer.ListEquals(AttributeEstimate, otherT.AttributeEstimate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; + if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "variable": - value = Variable; - return Variable?.Any() == true; + value = _Variable; + return _Variable?.Any() == true; case "attributeEstimate": - value = AttributeEstimate; - return AttributeEstimate?.Any() == true; + value = _AttributeEstimate; + return _AttributeEstimate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "variable": - Variable = (List)value; + Variable = (List?)value!; return this; case "attributeEstimate": - AttributeEstimate = (List)value; + AttributeEstimate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1306,10 +1259,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Variable?.Any() == true) yield return new KeyValuePair("variable",Variable); - if (AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",AttributeEstimate); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Variable?.Any() == true) yield return new KeyValuePair("variable",_Variable); + if (_AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",_AttributeEstimate); } } @@ -1335,13 +1288,13 @@ public partial class VariableComponent : Hl7.Fhir.Model.BackboneElement [References("Group","EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference VariableDefinition + public Hl7.Fhir.Model.ResourceReference? VariableDefinition { get { return _VariableDefinition; } set { _VariableDefinition = value; OnPropertyChanged("VariableDefinition"); } } - private Hl7.Fhir.Model.ResourceReference _VariableDefinition; + private Hl7.Fhir.Model.ResourceReference? _VariableDefinition; /// /// continuous | dichotomous | ordinal | polychotomous. @@ -1350,13 +1303,13 @@ public Hl7.Fhir.Model.ResourceReference VariableDefinition [DeclaredType(Type = typeof(Code))] [Binding("EvidenceVariableHandling")] [DataMember] - public Code HandlingElement + public Code? HandlingElement { get { return _HandlingElement; } set { _HandlingElement = value; OnPropertyChanged("HandlingElement"); } } - private Code _HandlingElement; + private Code? _HandlingElement; /// /// continuous | dichotomous | ordinal | polychotomous @@ -1365,13 +1318,10 @@ public Code HandlingElement [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceVariableHandling? Handling { - get { return HandlingElement != null ? HandlingElement.Value : null; } + get => _HandlingElement?.Value; set { - if (value == null) - HandlingElement = null; - else - HandlingElement = new Code(value); + HandlingElement = value is null ? null : new Code(value); OnPropertyChanged("Handling"); } } @@ -1384,11 +1334,11 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List ValueCategory { - get { if(_ValueCategory==null) _ValueCategory = new List(); return _ValueCategory; } + get => _ValueCategory ?? new List(); set { _ValueCategory = value; OnPropertyChanged("ValueCategory"); } } - private List _ValueCategory; + private List? _ValueCategory; /// /// Discrete value for grouping of ordinal or polychotomous variables. @@ -1398,11 +1348,11 @@ public List ValueCategory [DataMember] public List ValueQuantity { - get { if(_ValueQuantity==null) _ValueQuantity = new List(); return _ValueQuantity; } + get => _ValueQuantity ?? new List(); set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } - private List _ValueQuantity; + private List? _ValueQuantity; /// /// Range of values for grouping of ordinal or polychotomous variables. @@ -1412,27 +1362,23 @@ public List ValueQuantity [DataMember] public List ValueRange { - get { if(_ValueRange==null) _ValueRange = new List(); return _ValueRange; } + get => _ValueRange ?? new List(); set { _ValueRange = value; OnPropertyChanged("ValueRange"); } } - private List _ValueRange; + private List? _ValueRange; protected internal override void CopyToInternal(Base other) { - var dest = other as VariableComponent; - - if (dest == null) - { + if(other is not VariableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VariableDefinition != null) dest.VariableDefinition = (Hl7.Fhir.Model.ResourceReference)VariableDefinition.DeepCopyInternal(); - if(HandlingElement != null) dest.HandlingElement = (Code)HandlingElement.DeepCopyInternal(); - if(ValueCategory.Any()) dest.ValueCategory = new List(ValueCategory.DeepCopyInternal()); - if(ValueQuantity.Any()) dest.ValueQuantity = new List(ValueQuantity.DeepCopyInternal()); - if(ValueRange.Any()) dest.ValueRange = new List(ValueRange.DeepCopyInternal()); + if(_VariableDefinition is not null) dest.VariableDefinition = (Hl7.Fhir.Model.ResourceReference)_VariableDefinition.DeepCopyInternal(); + if(_HandlingElement is not null) dest.HandlingElement = (Code)_HandlingElement.DeepCopyInternal(); + if(_ValueCategory is not null) dest.ValueCategory = new List(_ValueCategory.DeepCopyInternal()); + if(_ValueQuantity is not null) dest.ValueQuantity = new List(_ValueQuantity.DeepCopyInternal()); + if(_ValueRange is not null) dest.ValueRange = new List(_ValueRange.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1444,62 +1390,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableComponent; - if(otherT == null) return false; + if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VariableDefinition, otherT.VariableDefinition)) return false; - if(!comparer.Equals(HandlingElement, otherT.HandlingElement)) return false; - if(!comparer.ListEquals(ValueCategory, otherT.ValueCategory)) return false; - if(!comparer.ListEquals(ValueQuantity, otherT.ValueQuantity)) return false; - if(!comparer.ListEquals(ValueRange, otherT.ValueRange)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariableDefinition, otherT._VariableDefinition)) return false; + if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; + if(!comparer.ListEquals(_ValueCategory, otherT._ValueCategory)) return false; + if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; + if(!comparer.ListEquals(_ValueRange, otherT._ValueRange)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "variableDefinition": - value = VariableDefinition; - return VariableDefinition is not null; + value = _VariableDefinition; + return _VariableDefinition is not null; case "handling": - value = HandlingElement; - return HandlingElement is not null; + value = _HandlingElement; + return _HandlingElement is not null; case "valueCategory": - value = ValueCategory; - return ValueCategory?.Any() == true; + value = _ValueCategory; + return _ValueCategory?.Any() == true; case "valueQuantity": - value = ValueQuantity; - return ValueQuantity?.Any() == true; + value = _ValueQuantity; + return _ValueQuantity?.Any() == true; case "valueRange": - value = ValueRange; - return ValueRange?.Any() == true; + value = _ValueRange; + return _ValueRange?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "variableDefinition": - VariableDefinition = (Hl7.Fhir.Model.ResourceReference)value; + VariableDefinition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "handling": - HandlingElement = (Code)value; + HandlingElement = (Code?)value; return this; case "valueCategory": - ValueCategory = (List)value; + ValueCategory = (List?)value!; return this; case "valueQuantity": - ValueQuantity = (List)value; + ValueQuantity = (List?)value!; return this; case "valueRange": - ValueRange = (List)value; + ValueRange = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1510,11 +1456,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VariableDefinition is not null) yield return new KeyValuePair("variableDefinition",VariableDefinition); - if (HandlingElement is not null) yield return new KeyValuePair("handling",HandlingElement); - if (ValueCategory?.Any() == true) yield return new KeyValuePair("valueCategory",ValueCategory); - if (ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",ValueQuantity); - if (ValueRange?.Any() == true) yield return new KeyValuePair("valueRange",ValueRange); + if (_VariableDefinition is not null) yield return new KeyValuePair("variableDefinition",_VariableDefinition); + if (_HandlingElement is not null) yield return new KeyValuePair("handling",_HandlingElement); + if (_ValueCategory?.Any() == true) yield return new KeyValuePair("valueCategory",_ValueCategory); + if (_ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",_ValueQuantity); + if (_ValueRange?.Any() == true) yield return new KeyValuePair("valueRange",_ValueRange); } } @@ -1540,28 +1486,25 @@ public partial class CertaintyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of certainty /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1574,11 +1517,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Aspect of certainty being rated. @@ -1586,13 +1529,13 @@ public List Note [FhirElement("type", Order=60)] [Binding("EvidenceCertaintyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Assessment or judgement of the aspect. @@ -1600,41 +1543,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("rating", Order=70)] [Binding("EvidenceCertaintyRating")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Rating + public Hl7.Fhir.Model.CodeableConcept? Rating { get { return _Rating; } set { _Rating = value; OnPropertyChanged("Rating"); } } - private Hl7.Fhir.Model.CodeableConcept _Rating; + private Hl7.Fhir.Model.CodeableConcept? _Rating; /// /// Individual or group who did the rating. /// [FhirElement("rater", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString RaterElement + public Hl7.Fhir.Model.FhirString? RaterElement { get { return _RaterElement; } set { _RaterElement = value; OnPropertyChanged("RaterElement"); } } - private Hl7.Fhir.Model.FhirString _RaterElement; + private Hl7.Fhir.Model.FhirString? _RaterElement; /// /// Individual or group who did the rating /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rater + public string? Rater { - get { return RaterElement != null ? RaterElement.Value : null; } + get => _RaterElement?.Value; set { - if (value == null) - RaterElement = null; - else - RaterElement = new Hl7.Fhir.Model.FhirString(value); + RaterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Rater"); } } @@ -1647,28 +1587,24 @@ public string Rater [DataMember] public List Subcomponent { - get { if(_Subcomponent==null) _Subcomponent = new List(); return _Subcomponent; } + get => _Subcomponent ?? new List(); set { _Subcomponent = value; OnPropertyChanged("Subcomponent"); } } - private List _Subcomponent; + private List? _Subcomponent; protected internal override void CopyToInternal(Base other) { - var dest = other as CertaintyComponent; - - if (dest == null) - { + if(other is not CertaintyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Rating != null) dest.Rating = (Hl7.Fhir.Model.CodeableConcept)Rating.DeepCopyInternal(); - if(RaterElement != null) dest.RaterElement = (Hl7.Fhir.Model.FhirString)RaterElement.DeepCopyInternal(); - if(Subcomponent.Any()) dest.Subcomponent = new List(Subcomponent.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Rating is not null) dest.Rating = (Hl7.Fhir.Model.CodeableConcept)_Rating.DeepCopyInternal(); + if(_RaterElement is not null) dest.RaterElement = (Hl7.Fhir.Model.FhirString)_RaterElement.DeepCopyInternal(); + if(_Subcomponent is not null) dest.Subcomponent = new List(_Subcomponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1680,69 +1616,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CertaintyComponent; - if(otherT == null) return false; + if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Rating, otherT.Rating)) return false; - if(!comparer.Equals(RaterElement, otherT.RaterElement)) return false; - if(!comparer.ListEquals(Subcomponent, otherT.Subcomponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Rating, otherT._Rating)) return false; + if(!comparer.Equals(_RaterElement, otherT._RaterElement)) return false; + if(!comparer.ListEquals(_Subcomponent, otherT._Subcomponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "rating": - value = Rating; - return Rating is not null; + value = _Rating; + return _Rating is not null; case "rater": - value = RaterElement; - return RaterElement is not null; + value = _RaterElement; + return _RaterElement is not null; case "subcomponent": - value = Subcomponent; - return Subcomponent?.Any() == true; + value = _Subcomponent; + return _Subcomponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rating": - Rating = (Hl7.Fhir.Model.CodeableConcept)value; + Rating = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rater": - RaterElement = (Hl7.Fhir.Model.FhirString)value; + RaterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subcomponent": - Subcomponent = (List)value; + Subcomponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1753,12 +1689,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Rating is not null) yield return new KeyValuePair("rating",Rating); - if (RaterElement is not null) yield return new KeyValuePair("rater",RaterElement); - if (Subcomponent?.Any() == true) yield return new KeyValuePair("subcomponent",Subcomponent); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Rating is not null) yield return new KeyValuePair("rating",_Rating); + if (_RaterElement is not null) yield return new KeyValuePair("rater",_RaterElement); + if (_Subcomponent?.Any() == true) yield return new KeyValuePair("subcomponent",_Subcomponent); } } @@ -1768,28 +1704,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this evidence, represented as a globally unique URI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1802,39 +1735,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of this summary. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of this summary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1844,28 +1774,25 @@ public string Version /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this summary (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1878,13 +1805,13 @@ public string Title [References("Citation")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Markdown))] [DataMember] - public Hl7.Fhir.Model.DataType CiteAs + public Hl7.Fhir.Model.DataType? CiteAs { get { return _CiteAs; } set { _CiteAs = value; OnPropertyChanged("CiteAs"); } } - private Hl7.Fhir.Model.DataType _CiteAs; + private Hl7.Fhir.Model.DataType? _CiteAs; /// /// draft | active | retired | unknown. @@ -1894,13 +1821,13 @@ public Hl7.Fhir.Model.DataType CiteAs [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1909,13 +1836,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1925,28 +1849,25 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1959,39 +1880,36 @@ public string Date [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// When the summary was approved by publisher. /// [FhirElement("approvalDate", Order=170)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the summary was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -2001,28 +1919,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=180)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the summary was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2032,28 +1947,25 @@ public string LastReviewDate /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2066,11 +1978,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who authored the content. @@ -2080,11 +1992,11 @@ public List Contact [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -2094,11 +2006,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -2108,11 +2020,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -2122,11 +2034,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Link or citation to artifact associated with the summary. @@ -2136,39 +2048,36 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Description of the particular summary. /// [FhirElement("description", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of the particular summary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2178,28 +2087,25 @@ public string Description /// [FhirElement("assertion", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown AssertionElement + public Hl7.Fhir.Model.Markdown? AssertionElement { get { return _AssertionElement; } set { _AssertionElement = value; OnPropertyChanged("AssertionElement"); } } - private Hl7.Fhir.Model.Markdown _AssertionElement; + private Hl7.Fhir.Model.Markdown? _AssertionElement; /// /// Declarative description of the Evidence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Assertion + public string? Assertion { - get { return AssertionElement != null ? AssertionElement.Value : null; } + get => _AssertionElement?.Value; set { - if (value == null) - AssertionElement = null; - else - AssertionElement = new Hl7.Fhir.Model.Markdown(value); + AssertionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Assertion"); } } @@ -2212,11 +2118,11 @@ public string Assertion [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Evidence variable such as population, exposure, or outcome. @@ -2226,11 +2132,11 @@ public List Note [DataMember] public List VariableDefinition { - get { if(_VariableDefinition==null) _VariableDefinition = new List(); return _VariableDefinition; } + get => _VariableDefinition ?? new List(); set { _VariableDefinition = value; OnPropertyChanged("VariableDefinition"); } } - private List _VariableDefinition; + private List? _VariableDefinition; /// /// The method to combine studies. @@ -2238,13 +2144,13 @@ public List VariableDefinit [FhirElement("synthesisType", Order=300)] [Binding("SynthesisType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SynthesisType + public Hl7.Fhir.Model.CodeableConcept? SynthesisType { get { return _SynthesisType; } set { _SynthesisType = value; OnPropertyChanged("SynthesisType"); } } - private Hl7.Fhir.Model.CodeableConcept _SynthesisType; + private Hl7.Fhir.Model.CodeableConcept? _SynthesisType; /// /// The type of study that produced this evidence. @@ -2252,13 +2158,13 @@ public Hl7.Fhir.Model.CodeableConcept SynthesisType [FhirElement("studyType", Order=310)] [Binding("StudyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StudyType + public Hl7.Fhir.Model.CodeableConcept? StudyType { get { return _StudyType; } set { _StudyType = value; OnPropertyChanged("StudyType"); } } - private Hl7.Fhir.Model.CodeableConcept _StudyType; + private Hl7.Fhir.Model.CodeableConcept? _StudyType; /// /// Values and parameters for a single statistic. @@ -2268,11 +2174,11 @@ public Hl7.Fhir.Model.CodeableConcept StudyType [DataMember] public List Statistic { - get { if(_Statistic==null) _Statistic = new List(); return _Statistic; } + get => _Statistic ?? new List(); set { _Statistic = value; OnPropertyChanged("Statistic"); } } - private List _Statistic; + private List? _Statistic; /// /// Certainty or quality of the evidence. @@ -2282,49 +2188,45 @@ public List Statistic [DataMember] public List Certainty { - get { if(_Certainty==null) _Certainty = new List(); return _Certainty; } + get => _Certainty ?? new List(); set { _Certainty = value; OnPropertyChanged("Certainty"); } } - private List _Certainty; + private List? _Certainty; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Evidence; - - if (dest == null) - { + if(other is not Evidence dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(CiteAs != null) dest.CiteAs = (Hl7.Fhir.Model.DataType)CiteAs.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(AssertionElement != null) dest.AssertionElement = (Hl7.Fhir.Model.Markdown)AssertionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(VariableDefinition.Any()) dest.VariableDefinition = new List(VariableDefinition.DeepCopyInternal()); - if(SynthesisType != null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)SynthesisType.DeepCopyInternal(); - if(StudyType != null) dest.StudyType = (Hl7.Fhir.Model.CodeableConcept)StudyType.DeepCopyInternal(); - if(Statistic.Any()) dest.Statistic = new List(Statistic.DeepCopyInternal()); - if(Certainty.Any()) dest.Certainty = new List(Certainty.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_CiteAs is not null) dest.CiteAs = (Hl7.Fhir.Model.DataType)_CiteAs.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_AssertionElement is not null) dest.AssertionElement = (Hl7.Fhir.Model.Markdown)_AssertionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_VariableDefinition is not null) dest.VariableDefinition = new List(_VariableDefinition.DeepCopyInternal()); + if(_SynthesisType is not null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)_SynthesisType.DeepCopyInternal(); + if(_StudyType is not null) dest.StudyType = (Hl7.Fhir.Model.CodeableConcept)_StudyType.DeepCopyInternal(); + if(_Statistic is not null) dest.Statistic = new List(_Statistic.DeepCopyInternal()); + if(_Certainty is not null) dest.Certainty = new List(_Certainty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2336,202 +2238,202 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Evidence; - if(otherT == null) return false; + if(other is not Evidence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(CiteAs, otherT.CiteAs)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(AssertionElement, otherT.AssertionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(VariableDefinition, otherT.VariableDefinition)) return false; - if(!comparer.Equals(SynthesisType, otherT.SynthesisType)) return false; - if(!comparer.Equals(StudyType, otherT.StudyType)) return false; - if(!comparer.ListEquals(Statistic, otherT.Statistic)) return false; - if(!comparer.ListEquals(Certainty, otherT.Certainty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_CiteAs, otherT._CiteAs)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_AssertionElement, otherT._AssertionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_VariableDefinition, otherT._VariableDefinition)) return false; + if(!comparer.Equals(_SynthesisType, otherT._SynthesisType)) return false; + if(!comparer.Equals(_StudyType, otherT._StudyType)) return false; + if(!comparer.ListEquals(_Statistic, otherT._Statistic)) return false; + if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "citeAs": - value = CiteAs; - return CiteAs is not null; + value = _CiteAs; + return _CiteAs is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "assertion": - value = AssertionElement; - return AssertionElement is not null; + value = _AssertionElement; + return _AssertionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "variableDefinition": - value = VariableDefinition; - return VariableDefinition?.Any() == true; + value = _VariableDefinition; + return _VariableDefinition?.Any() == true; case "synthesisType": - value = SynthesisType; - return SynthesisType is not null; + value = _SynthesisType; + return _SynthesisType is not null; case "studyType": - value = StudyType; - return StudyType is not null; + value = _StudyType; + return _StudyType is not null; case "statistic": - value = Statistic; - return Statistic?.Any() == true; + value = _Statistic; + return _Statistic?.Any() == true; case "certainty": - value = Certainty; - return Certainty?.Any() == true; + value = _Certainty; + return _Certainty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "citeAs": - CiteAs = (Hl7.Fhir.Model.DataType)value; + CiteAs = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "assertion": - AssertionElement = (Hl7.Fhir.Model.Markdown)value; + AssertionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "variableDefinition": - VariableDefinition = (List)value; + VariableDefinition = (List?)value!; return this; case "synthesisType": - SynthesisType = (Hl7.Fhir.Model.CodeableConcept)value; + SynthesisType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyType": - StudyType = (Hl7.Fhir.Model.CodeableConcept)value; + StudyType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statistic": - Statistic = (List)value; + Statistic = (List?)value!; return this; case "certainty": - Certainty = (List)value; + Certainty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2542,31 +2444,31 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (CiteAs is not null) yield return new KeyValuePair("citeAs",CiteAs); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (AssertionElement is not null) yield return new KeyValuePair("assertion",AssertionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (VariableDefinition?.Any() == true) yield return new KeyValuePair("variableDefinition",VariableDefinition); - if (SynthesisType is not null) yield return new KeyValuePair("synthesisType",SynthesisType); - if (StudyType is not null) yield return new KeyValuePair("studyType",StudyType); - if (Statistic?.Any() == true) yield return new KeyValuePair("statistic",Statistic); - if (Certainty?.Any() == true) yield return new KeyValuePair("certainty",Certainty); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_CiteAs is not null) yield return new KeyValuePair("citeAs",_CiteAs); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_AssertionElement is not null) yield return new KeyValuePair("assertion",_AssertionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_VariableDefinition?.Any() == true) yield return new KeyValuePair("variableDefinition",_VariableDefinition); + if (_SynthesisType is not null) yield return new KeyValuePair("synthesisType",_SynthesisType); + if (_StudyType is not null) yield return new KeyValuePair("studyType",_StudyType); + if (_Statistic?.Any() == true) yield return new KeyValuePair("statistic",_Statistic); + if (_Certainty?.Any() == true) yield return new KeyValuePair("certainty",_Certainty); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs index 1c6ab5153..b3510905a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -142,11 +145,11 @@ public partial class SubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Footnotes and/or explanatory notes. @@ -156,24 +159,20 @@ public List Characteristi [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as SubjectComponent; - - if (dest == null) - { + if(other is not SubjectComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -185,41 +184,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubjectComponent; - if(otherT == null) return false; + if(other is not SubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -230,8 +229,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -256,13 +255,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("FocusCharacteristicCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Characteristic value. @@ -273,26 +272,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Is used to express not the characteristic. /// [FhirElement("exclude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Is used to express not the characteristic @@ -301,13 +300,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -317,28 +313,24 @@ public bool? Exclude /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -350,55 +342,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -409,10 +401,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -442,13 +434,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("ReportRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | amends | appends | transforms | replacedWith | amendedWith | appendedWith | transformedWith @@ -457,13 +449,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceReport.ReportRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -477,26 +466,22 @@ public Hl7.Fhir.Model.EvidenceReport.ReportRelationshipType? Code [AllowedTypes(typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Target + public Hl7.Fhir.Model.DataType? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.DataType _Target; + private Hl7.Fhir.Model.DataType? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.DataType)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.DataType)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -508,41 +493,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.DataType)value; + Target = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -553,8 +538,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -580,28 +565,25 @@ public partial class SectionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for section (e.g. for ToC) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -612,13 +594,13 @@ public string Title [FhirElement("focus", Order=50)] [Binding("ReportSectionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Focus + public Hl7.Fhir.Model.CodeableConcept? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.CodeableConcept _Focus; + private Hl7.Fhir.Model.CodeableConcept? _Focus; /// /// Classification of section by Resource. @@ -627,13 +609,13 @@ public Hl7.Fhir.Model.CodeableConcept Focus [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference FocusReference + public Hl7.Fhir.Model.ResourceReference? FocusReference { get { return _FocusReference; } set { _FocusReference = value; OnPropertyChanged("FocusReference"); } } - private Hl7.Fhir.Model.ResourceReference _FocusReference; + private Hl7.Fhir.Model.ResourceReference? _FocusReference; /// /// Who and/or what authored the section. @@ -645,24 +627,24 @@ public Hl7.Fhir.Model.ResourceReference FocusReference [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Text summary of the section, for human interpretation. /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.Narrative Text + public Hl7.Fhir.Model.Narrative? Text { get { return _Text; } set { _Text = value; OnPropertyChanged("Text"); } } - private Hl7.Fhir.Model.Narrative _Text; + private Hl7.Fhir.Model.Narrative? _Text; /// /// working | snapshot | changes. @@ -671,13 +653,13 @@ public Hl7.Fhir.Model.Narrative Text [DeclaredType(Type = typeof(Code))] [Binding("SectionMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -686,13 +668,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -703,13 +682,13 @@ public Hl7.Fhir.Model.ListMode? Mode [FhirElement("orderedBy", Order=100)] [Binding("SectionEntryOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// Extensible classifiers as content. @@ -720,11 +699,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List EntryClassifier { - get { if(_EntryClassifier==null) _EntryClassifier = new List(); return _EntryClassifier; } + get => _EntryClassifier ?? new List(); set { _EntryClassifier = value; OnPropertyChanged("EntryClassifier"); } } - private List _EntryClassifier; + private List? _EntryClassifier; /// /// Reference to resources as content. @@ -736,11 +715,11 @@ public List EntryClassifier [DataMember] public List EntryReference { - get { if(_EntryReference==null) _EntryReference = new List(); return _EntryReference; } + get => _EntryReference ?? new List(); set { _EntryReference = value; OnPropertyChanged("EntryReference"); } } - private List _EntryReference; + private List? _EntryReference; /// /// Quantity as content. @@ -750,11 +729,11 @@ public List EntryReference [DataMember] public List EntryQuantity { - get { if(_EntryQuantity==null) _EntryQuantity = new List(); return _EntryQuantity; } + get => _EntryQuantity ?? new List(); set { _EntryQuantity = value; OnPropertyChanged("EntryQuantity"); } } - private List _EntryQuantity; + private List? _EntryQuantity; /// /// Why the section is empty. @@ -762,13 +741,13 @@ public List EntryQuantity [FhirElement("emptyReason", Order=140)] [Binding("SectionEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; /// /// Nested Section. @@ -778,34 +757,30 @@ public Hl7.Fhir.Model.CodeableConcept EmptyReason [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; protected internal override void CopyToInternal(Base other) { - var dest = other as SectionComponent; - - if (dest == null) - { + if(other is not SectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.CodeableConcept)Focus.DeepCopyInternal(); - if(FocusReference != null) dest.FocusReference = (Hl7.Fhir.Model.ResourceReference)FocusReference.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(EntryClassifier.Any()) dest.EntryClassifier = new List(EntryClassifier.DeepCopyInternal()); - if(EntryReference.Any()) dest.EntryReference = new List(EntryReference.DeepCopyInternal()); - if(EntryQuantity.Any()) dest.EntryQuantity = new List(EntryQuantity.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.CodeableConcept)_Focus.DeepCopyInternal(); + if(_FocusReference is not null) dest.FocusReference = (Hl7.Fhir.Model.ResourceReference)_FocusReference.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_EntryClassifier is not null) dest.EntryClassifier = new List(_EntryClassifier.DeepCopyInternal()); + if(_EntryReference is not null) dest.EntryReference = new List(_EntryReference.DeepCopyInternal()); + if(_EntryQuantity is not null) dest.EntryQuantity = new List(_EntryQuantity.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -817,111 +792,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SectionComponent; - if(otherT == null) return false; + if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(FocusReference, otherT.FocusReference)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Text, otherT.Text)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(EntryClassifier, otherT.EntryClassifier)) return false; - if(!comparer.ListEquals(EntryReference, otherT.EntryReference)) return false; - if(!comparer.ListEquals(EntryQuantity, otherT.EntryQuantity)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_FocusReference, otherT._FocusReference)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Text, otherT._Text)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_EntryClassifier, otherT._EntryClassifier)) return false; + if(!comparer.ListEquals(_EntryReference, otherT._EntryReference)) return false; + if(!comparer.ListEquals(_EntryQuantity, otherT._EntryQuantity)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "focusReference": - value = FocusReference; - return FocusReference is not null; + value = _FocusReference; + return _FocusReference is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "text": - value = Text; - return Text is not null; + value = _Text; + return _Text is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "entryClassifier": - value = EntryClassifier; - return EntryClassifier?.Any() == true; + value = _EntryClassifier; + return _EntryClassifier?.Any() == true; case "entryReference": - value = EntryReference; - return EntryReference?.Any() == true; + value = _EntryReference; + return _EntryReference?.Any() == true; case "entryQuantity": - value = EntryQuantity; - return EntryQuantity?.Any() == true; + value = _EntryQuantity; + return _EntryQuantity?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.CodeableConcept)value; + Focus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "focusReference": - FocusReference = (Hl7.Fhir.Model.ResourceReference)value; + FocusReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "text": - Text = (Hl7.Fhir.Model.Narrative)value; + Text = (Hl7.Fhir.Model.Narrative?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "entryClassifier": - EntryClassifier = (List)value; + EntryClassifier = (List?)value!; return this; case "entryReference": - EntryReference = (List)value; + EntryReference = (List?)value!; return this; case "entryQuantity": - EntryQuantity = (List)value; + EntryQuantity = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -932,18 +907,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (FocusReference is not null) yield return new KeyValuePair("focusReference",FocusReference); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Text is not null) yield return new KeyValuePair("text",Text); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (EntryClassifier?.Any() == true) yield return new KeyValuePair("entryClassifier",EntryClassifier); - if (EntryReference?.Any() == true) yield return new KeyValuePair("entryReference",EntryReference); - if (EntryQuantity?.Any() == true) yield return new KeyValuePair("entryQuantity",EntryQuantity); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_FocusReference is not null) yield return new KeyValuePair("focusReference",_FocusReference); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Text is not null) yield return new KeyValuePair("text",_Text); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_EntryClassifier?.Any() == true) yield return new KeyValuePair("entryClassifier",_EntryClassifier); + if (_EntryReference?.Any() == true) yield return new KeyValuePair("entryReference",_EntryReference); + if (_EntryQuantity?.Any() == true) yield return new KeyValuePair("entryQuantity",_EntryQuantity); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } @@ -953,28 +928,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this EvidenceReport, represented as a globally unique URI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -987,13 +959,13 @@ public string Url [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1002,13 +974,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1021,11 +990,11 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Unique identifier for the evidence report. @@ -1035,11 +1004,11 @@ public List UseContext [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identifiers for articles that may relate to more than one evidence report. @@ -1049,11 +1018,11 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get { if(_RelatedIdentifier==null) _RelatedIdentifier = new List(); return _RelatedIdentifier; } + get => _RelatedIdentifier ?? new List(); set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } - private List _RelatedIdentifier; + private List? _RelatedIdentifier; /// /// Citation for this report. @@ -1063,13 +1032,13 @@ public List RelatedIdentifier [References("Citation")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Markdown))] [DataMember] - public Hl7.Fhir.Model.DataType CiteAs + public Hl7.Fhir.Model.DataType? CiteAs { get { return _CiteAs; } set { _CiteAs = value; OnPropertyChanged("CiteAs"); } } - private Hl7.Fhir.Model.DataType _CiteAs; + private Hl7.Fhir.Model.DataType? _CiteAs; /// /// Kind of report. @@ -1077,13 +1046,13 @@ public Hl7.Fhir.Model.DataType CiteAs [FhirElement("type", Order=150)] [Binding("EvidenceReportType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Used for footnotes and annotations. @@ -1093,11 +1062,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Link, description or reference to artifact associated with the report. @@ -1107,11 +1076,11 @@ public List Note [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Focus of the report. @@ -1119,41 +1088,38 @@ public List RelatedArtifact [FhirElement("subject", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.EvidenceReport.SubjectComponent Subject + public Hl7.Fhir.Model.EvidenceReport.SubjectComponent? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.EvidenceReport.SubjectComponent _Subject; + private Hl7.Fhir.Model.EvidenceReport.SubjectComponent? _Subject; /// /// Name of the publisher (organization or individual). /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1166,11 +1132,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who authored the content. @@ -1180,11 +1146,11 @@ public List Contact [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1194,11 +1160,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1208,11 +1174,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1222,11 +1188,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Relationships to other compositions/documents. @@ -1236,11 +1202,11 @@ public List Endorser [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// Composition is broken into sections. @@ -1250,42 +1216,38 @@ public List RelatesTo [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceReport; - - if (dest == null) - { + if(other is not EvidenceReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(RelatedIdentifier.Any()) dest.RelatedIdentifier = new List(RelatedIdentifier.DeepCopyInternal()); - if(CiteAs != null) dest.CiteAs = (Hl7.Fhir.Model.DataType)CiteAs.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent)Subject.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_RelatedIdentifier is not null) dest.RelatedIdentifier = new List(_RelatedIdentifier.DeepCopyInternal()); + if(_CiteAs is not null) dest.CiteAs = (Hl7.Fhir.Model.DataType)_CiteAs.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent)_Subject.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1297,153 +1259,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceReport; - if(otherT == null) return false; + if(other is not EvidenceReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(RelatedIdentifier, otherT.RelatedIdentifier)) return false; - if(!comparer.Equals(CiteAs, otherT.CiteAs)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_RelatedIdentifier, otherT._RelatedIdentifier)) return false; + if(!comparer.Equals(_CiteAs, otherT._CiteAs)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "relatedIdentifier": - value = RelatedIdentifier; - return RelatedIdentifier?.Any() == true; + value = _RelatedIdentifier; + return _RelatedIdentifier?.Any() == true; case "citeAs": - value = CiteAs; - return CiteAs is not null; + value = _CiteAs; + return _CiteAs is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "relatedIdentifier": - RelatedIdentifier = (List)value; + RelatedIdentifier = (List?)value!; return this; case "citeAs": - CiteAs = (Hl7.Fhir.Model.DataType)value; + CiteAs = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent)value; + Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1454,24 +1416,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",RelatedIdentifier); - if (CiteAs is not null) yield return new KeyValuePair("citeAs",CiteAs); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",_RelatedIdentifier); + if (_CiteAs is not null) yield return new KeyValuePair("citeAs",_CiteAs); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs index bb4e7af1d..b074797c1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,28 +107,25 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the characteristic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -139,13 +139,13 @@ public string Description [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Expression))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// Method used for describing characteristic. @@ -153,13 +153,13 @@ public Hl7.Fhir.Model.DataType Definition [FhirElement("method", Order=60)] [Binding("CharacteristicMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Device used for determining characteristic. @@ -168,26 +168,26 @@ public Hl7.Fhir.Model.CodeableConcept Method [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Whether the characteristic includes or excludes members. /// [FhirElement("exclude", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Whether the characteristic includes or excludes members @@ -196,13 +196,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -212,13 +209,13 @@ public bool? Exclude /// [FhirElement("timeFromStart", Order=90)] [DataMember] - public Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent TimeFromStart + public Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent? TimeFromStart { get { return _TimeFromStart; } set { _TimeFromStart = value; OnPropertyChanged("TimeFromStart"); } } - private Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent _TimeFromStart; + private Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent? _TimeFromStart; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median. @@ -227,13 +224,13 @@ public Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent TimeFromStart [DeclaredType(Type = typeof(Code))] [Binding("GroupMeasure")] [DataMember] - public Code GroupMeasureElement + public Code? GroupMeasureElement { get { return _GroupMeasureElement; } set { _GroupMeasureElement = value; OnPropertyChanged("GroupMeasureElement"); } } - private Code _GroupMeasureElement; + private Code? _GroupMeasureElement; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median @@ -242,34 +239,27 @@ public Code GroupMeasureElement [IgnoreDataMember] public Hl7.Fhir.Model.GroupMeasureCode? GroupMeasure { - get { return GroupMeasureElement != null ? GroupMeasureElement.Value : null; } + get => _GroupMeasureElement?.Value; set { - if (value == null) - GroupMeasureElement = null; - else - GroupMeasureElement = new Code(value); + GroupMeasureElement = value is null ? null : new Code(value); OnPropertyChanged("GroupMeasure"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(TimeFromStart != null) dest.TimeFromStart = (Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent)TimeFromStart.DeepCopyInternal(); - if(GroupMeasureElement != null) dest.GroupMeasureElement = (Code)GroupMeasureElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_TimeFromStart is not null) dest.TimeFromStart = (Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent)_TimeFromStart.DeepCopyInternal(); + if(_GroupMeasureElement is not null) dest.GroupMeasureElement = (Code)_GroupMeasureElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -281,76 +271,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(TimeFromStart, otherT.TimeFromStart)) return false; - if(!comparer.Equals(GroupMeasureElement, otherT.GroupMeasureElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_TimeFromStart, otherT._TimeFromStart)) return false; + if(!comparer.Equals(_GroupMeasureElement, otherT._GroupMeasureElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "timeFromStart": - value = TimeFromStart; - return TimeFromStart is not null; + value = _TimeFromStart; + return _TimeFromStart is not null; case "groupMeasure": - value = GroupMeasureElement; - return GroupMeasureElement is not null; + value = _GroupMeasureElement; + return _GroupMeasureElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "timeFromStart": - TimeFromStart = (Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent)value; + TimeFromStart = (Hl7.Fhir.Model.EvidenceVariable.TimeFromStartComponent?)value; return this; case "groupMeasure": - GroupMeasureElement = (Code)value; + GroupMeasureElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -361,13 +351,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (TimeFromStart is not null) yield return new KeyValuePair("timeFromStart",TimeFromStart); - if (GroupMeasureElement is not null) yield return new KeyValuePair("groupMeasure",GroupMeasureElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_TimeFromStart is not null) yield return new KeyValuePair("timeFromStart",_TimeFromStart); + if (_GroupMeasureElement is not null) yield return new KeyValuePair("groupMeasure",_GroupMeasureElement); } } @@ -393,28 +383,25 @@ public partial class TimeFromStartComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human readable description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -424,26 +411,26 @@ public string Description /// [FhirElement("quantity", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Used to express the observation within a period after the study start. /// [FhirElement("range", Order=60)] [DataMember] - public Hl7.Fhir.Model.Range Range + public Hl7.Fhir.Model.Range? Range { get { return _Range; } set { _Range = value; OnPropertyChanged("Range"); } } - private Hl7.Fhir.Model.Range _Range; + private Hl7.Fhir.Model.Range? _Range; /// /// Used for footnotes or explanatory notes. @@ -453,26 +440,22 @@ public Hl7.Fhir.Model.Range Range [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as TimeFromStartComponent; - - if (dest == null) - { + if(other is not TimeFromStartComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Range != null) dest.Range = (Hl7.Fhir.Model.Range)Range.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Range is not null) dest.Range = (Hl7.Fhir.Model.Range)_Range.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -484,55 +467,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TimeFromStartComponent; - if(otherT == null) return false; + if(other is not TimeFromStartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Range, otherT.Range)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Range, otherT._Range)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "range": - value = Range; - return Range is not null; + value = _Range; + return _Range is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "range": - Range = (Hl7.Fhir.Model.Range)value; + Range = (Hl7.Fhir.Model.Range?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -543,10 +526,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Range is not null) yield return new KeyValuePair("range",Range); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Range is not null) yield return new KeyValuePair("range",_Range); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -572,28 +555,25 @@ public partial class CategoryComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Description of the grouping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -605,26 +585,22 @@ public string Name [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CategoryComponent; - - if (dest == null) - { + if(other is not CategoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -636,41 +612,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CategoryComponent; - if(otherT == null) return false; + if(other is not CategoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -681,8 +657,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -692,28 +668,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this evidence variable, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -726,39 +699,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the evidence variable. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the evidence variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -768,28 +738,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this evidence variable (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -799,28 +766,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this evidence variable (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -830,28 +794,25 @@ public string Title /// [FhirElement("shortTitle", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -861,28 +822,25 @@ public string ShortTitle /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the EvidenceVariable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -895,13 +853,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -910,13 +868,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -926,28 +881,25 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -957,28 +909,25 @@ public string Date /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the evidence variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -991,11 +940,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The context that the content is intended to support. @@ -1005,39 +954,36 @@ public List Note [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Name of the publisher (organization or individual). /// [FhirElement("publisher", InSummary=true, Order=210, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1050,11 +996,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who authored the content. @@ -1064,11 +1010,11 @@ public List Contact [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1078,11 +1024,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1092,11 +1038,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1106,11 +1052,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1120,24 +1066,24 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Actual or conceptual. /// [FhirElement("actual", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Actual or conceptual @@ -1146,13 +1092,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -1164,13 +1107,13 @@ public bool? Actual [DeclaredType(Type = typeof(Code))] [Binding("CharacteristicCombination")] [DataMember] - public Code CharacteristicCombinationElement + public Code? CharacteristicCombinationElement { get { return _CharacteristicCombinationElement; } set { _CharacteristicCombinationElement = value; OnPropertyChanged("CharacteristicCombinationElement"); } } - private Code _CharacteristicCombinationElement; + private Code? _CharacteristicCombinationElement; /// /// intersection | union @@ -1179,13 +1122,10 @@ public Code Chara [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceVariable.CharacteristicCombinationCode? CharacteristicCombination { - get { return CharacteristicCombinationElement != null ? CharacteristicCombinationElement.Value : null; } + get => _CharacteristicCombinationElement?.Value; set { - if (value == null) - CharacteristicCombinationElement = null; - else - CharacteristicCombinationElement = new Code(value); + CharacteristicCombinationElement = value is null ? null : new Code(value); OnPropertyChanged("CharacteristicCombination"); } } @@ -1198,11 +1138,11 @@ public Hl7.Fhir.Model.EvidenceVariable.CharacteristicCombinationCode? Characteri [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// continuous | dichotomous | ordinal | polychotomous. @@ -1211,13 +1151,13 @@ public List Characteris [DeclaredType(Type = typeof(Code))] [Binding("EvidenceVariableHandling")] [DataMember] - public Code HandlingElement + public Code? HandlingElement { get { return _HandlingElement; } set { _HandlingElement = value; OnPropertyChanged("HandlingElement"); } } - private Code _HandlingElement; + private Code? _HandlingElement; /// /// continuous | dichotomous | ordinal | polychotomous @@ -1226,13 +1166,10 @@ public Code HandlingElement [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceVariableHandling? Handling { - get { return HandlingElement != null ? HandlingElement.Value : null; } + get => _HandlingElement?.Value; set { - if (value == null) - HandlingElement = null; - else - HandlingElement = new Code(value); + HandlingElement = value is null ? null : new Code(value); OnPropertyChanged("Handling"); } } @@ -1245,48 +1182,44 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceVariable; - - if (dest == null) - { + if(other is not EvidenceVariable dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(CharacteristicCombinationElement != null) dest.CharacteristicCombinationElement = (Code)CharacteristicCombinationElement.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(HandlingElement != null) dest.HandlingElement = (Code)HandlingElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_CharacteristicCombinationElement is not null) dest.CharacteristicCombinationElement = (Code)_CharacteristicCombinationElement.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_HandlingElement is not null) dest.HandlingElement = (Code)_HandlingElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1298,195 +1231,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceVariable; - if(otherT == null) return false; + if(other is not EvidenceVariable otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(CharacteristicCombinationElement, otherT.CharacteristicCombinationElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.Equals(HandlingElement, otherT.HandlingElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_CharacteristicCombinationElement, otherT._CharacteristicCombinationElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "characteristicCombination": - value = CharacteristicCombinationElement; - return CharacteristicCombinationElement is not null; + value = _CharacteristicCombinationElement; + return _CharacteristicCombinationElement is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "handling": - value = HandlingElement; - return HandlingElement is not null; + value = _HandlingElement; + return _HandlingElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "characteristicCombination": - CharacteristicCombinationElement = (Code)value; + CharacteristicCombinationElement = (Code?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "handling": - HandlingElement = (Code)value; + HandlingElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1497,30 +1430,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (CharacteristicCombinationElement is not null) yield return new KeyValuePair("characteristicCombination",CharacteristicCombinationElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (HandlingElement is not null) yield return new KeyValuePair("handling",HandlingElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_CharacteristicCombinationElement is not null) yield return new KeyValuePair("characteristicCombination",_CharacteristicCombinationElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_HandlingElement is not null) yield return new KeyValuePair("handling",_HandlingElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs index 05e5b84d2..49f3df532 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -97,28 +100,25 @@ public partial class ActorComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actorId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ActorIdElement + public Hl7.Fhir.Model.FhirString? ActorIdElement { get { return _ActorIdElement; } set { _ActorIdElement = value; OnPropertyChanged("ActorIdElement"); } } - private Hl7.Fhir.Model.FhirString _ActorIdElement; + private Hl7.Fhir.Model.FhirString? _ActorIdElement; /// /// ID or acronym of the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActorId + public string? ActorId { - get { return ActorIdElement != null ? ActorIdElement.Value : null; } + get => _ActorIdElement?.Value; set { - if (value == null) - ActorIdElement = null; - else - ActorIdElement = new Hl7.Fhir.Model.FhirString(value); + ActorIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ActorId"); } } @@ -131,13 +131,13 @@ public string ActorId [Binding("ExampleScenarioActorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | entity @@ -146,13 +146,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ExampleScenario.ExampleScenarioActorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -162,28 +159,25 @@ public Hl7.Fhir.Model.ExampleScenario.ExampleScenarioActorType? Type /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name of the actor as shown in the page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -193,46 +187,39 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The description of the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ActorComponent; - - if (dest == null) - { + if(other is not ActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActorIdElement != null) dest.ActorIdElement = (Hl7.Fhir.Model.FhirString)ActorIdElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_ActorIdElement is not null) dest.ActorIdElement = (Hl7.Fhir.Model.FhirString)_ActorIdElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -244,55 +231,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActorComponent; - if(otherT == null) return false; + if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActorIdElement, otherT.ActorIdElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actorId": - value = ActorIdElement; - return ActorIdElement is not null; + value = _ActorIdElement; + return _ActorIdElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actorId": - ActorIdElement = (Hl7.Fhir.Model.FhirString)value; + ActorIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -303,10 +290,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActorIdElement is not null) yield return new KeyValuePair("actorId",ActorIdElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_ActorIdElement is not null) yield return new KeyValuePair("actorId",_ActorIdElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -330,28 +317,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("resourceId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ResourceIdElement + public Hl7.Fhir.Model.FhirString? ResourceIdElement { get { return _ResourceIdElement; } set { _ResourceIdElement = value; OnPropertyChanged("ResourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _ResourceIdElement; + private Hl7.Fhir.Model.FhirString? _ResourceIdElement; /// /// The id of the resource for referencing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResourceId + public string? ResourceId { - get { return ResourceIdElement != null ? ResourceIdElement.Value : null; } + get => _ResourceIdElement?.Value; set { - if (value == null) - ResourceIdElement = null; - else - ResourceIdElement = new Hl7.Fhir.Model.FhirString(value); + ResourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResourceId"); } } @@ -364,13 +348,13 @@ public string ResourceId [Binding("FHIRResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResourceTypeElement + public Code? ResourceTypeElement { get { return _ResourceTypeElement; } set { _ResourceTypeElement = value; OnPropertyChanged("ResourceTypeElement"); } } - private Code _ResourceTypeElement; + private Code? _ResourceTypeElement; /// /// The type of the resource @@ -379,13 +363,10 @@ public Code ResourceTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? ResourceType { - get { return ResourceTypeElement != null ? ResourceTypeElement.Value : null; } + get => _ResourceTypeElement?.Value; set { - if (value == null) - ResourceTypeElement = null; - else - ResourceTypeElement = new Code(value); + ResourceTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ResourceType"); } } @@ -395,28 +376,25 @@ public Hl7.Fhir.Model.ResourceType? ResourceType /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A short name for the resource instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -426,28 +404,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human-friendly description of the resource instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -460,11 +435,11 @@ public string Description [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// Resources contained in the instance. @@ -474,28 +449,24 @@ public List Version [DataMember] public List ContainedInstance { - get { if(_ContainedInstance==null) _ContainedInstance = new List(); return _ContainedInstance; } + get => _ContainedInstance ?? new List(); set { _ContainedInstance = value; OnPropertyChanged("ContainedInstance"); } } - private List _ContainedInstance; + private List? _ContainedInstance; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResourceIdElement != null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)ResourceIdElement.DeepCopyInternal(); - if(ResourceTypeElement != null) dest.ResourceTypeElement = (Code)ResourceTypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(ContainedInstance.Any()) dest.ContainedInstance = new List(ContainedInstance.DeepCopyInternal()); + if(_ResourceIdElement is not null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)_ResourceIdElement.DeepCopyInternal(); + if(_ResourceTypeElement is not null) dest.ResourceTypeElement = (Code)_ResourceTypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_ContainedInstance is not null) dest.ContainedInstance = new List(_ContainedInstance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -507,69 +478,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResourceIdElement, otherT.ResourceIdElement)) return false; - if(!comparer.Equals(ResourceTypeElement, otherT.ResourceTypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(ContainedInstance, otherT.ContainedInstance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + if(!comparer.Equals(_ResourceTypeElement, otherT._ResourceTypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_ContainedInstance, otherT._ContainedInstance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resourceId": - value = ResourceIdElement; - return ResourceIdElement is not null; + value = _ResourceIdElement; + return _ResourceIdElement is not null; case "resourceType": - value = ResourceTypeElement; - return ResourceTypeElement is not null; + value = _ResourceTypeElement; + return _ResourceTypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "containedInstance": - value = ContainedInstance; - return ContainedInstance?.Any() == true; + value = _ContainedInstance; + return _ContainedInstance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resourceId": - ResourceIdElement = (Hl7.Fhir.Model.FhirString)value; + ResourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resourceType": - ResourceTypeElement = (Code)value; + ResourceTypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "containedInstance": - ContainedInstance = (List)value; + ContainedInstance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -580,12 +551,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResourceIdElement is not null) yield return new KeyValuePair("resourceId",ResourceIdElement); - if (ResourceTypeElement is not null) yield return new KeyValuePair("resourceType",ResourceTypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (ContainedInstance?.Any() == true) yield return new KeyValuePair("containedInstance",ContainedInstance); + if (_ResourceIdElement is not null) yield return new KeyValuePair("resourceId",_ResourceIdElement); + if (_ResourceTypeElement is not null) yield return new KeyValuePair("resourceType",_ResourceTypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_ContainedInstance?.Any() == true) yield return new KeyValuePair("containedInstance",_ContainedInstance); } } @@ -609,28 +580,25 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("versionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionIdElement + public Hl7.Fhir.Model.FhirString? VersionIdElement { get { return _VersionIdElement; } set { _VersionIdElement = value; OnPropertyChanged("VersionIdElement"); } } - private Hl7.Fhir.Model.FhirString _VersionIdElement; + private Hl7.Fhir.Model.FhirString? _VersionIdElement; /// /// The identifier of a specific version of a resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VersionId + public string? VersionId { - get { return VersionIdElement != null ? VersionIdElement.Value : null; } + get => _VersionIdElement?.Value; set { - if (value == null) - VersionIdElement = null; - else - VersionIdElement = new Hl7.Fhir.Model.FhirString(value); + VersionIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VersionId"); } } @@ -641,44 +609,37 @@ public string VersionId [FhirElement("description", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The description of the resource version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VersionIdElement != null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)VersionIdElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_VersionIdElement is not null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)_VersionIdElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -690,41 +651,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VersionIdElement, otherT.VersionIdElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "versionId": - value = VersionIdElement; - return VersionIdElement is not null; + value = _VersionIdElement; + return _VersionIdElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "versionId": - VersionIdElement = (Hl7.Fhir.Model.FhirString)value; + VersionIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -735,8 +696,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VersionIdElement is not null) yield return new KeyValuePair("versionId",VersionIdElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_VersionIdElement is not null) yield return new KeyValuePair("versionId",_VersionIdElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -763,28 +724,25 @@ public partial class ContainedInstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("resourceId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ResourceIdElement + public Hl7.Fhir.Model.FhirString? ResourceIdElement { get { return _ResourceIdElement; } set { _ResourceIdElement = value; OnPropertyChanged("ResourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _ResourceIdElement; + private Hl7.Fhir.Model.FhirString? _ResourceIdElement; /// /// Each resource contained in the instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResourceId + public string? ResourceId { - get { return ResourceIdElement != null ? ResourceIdElement.Value : null; } + get => _ResourceIdElement?.Value; set { - if (value == null) - ResourceIdElement = null; - else - ResourceIdElement = new Hl7.Fhir.Model.FhirString(value); + ResourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResourceId"); } } @@ -794,44 +752,37 @@ public string ResourceId /// [FhirElement("versionId", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionIdElement + public Hl7.Fhir.Model.FhirString? VersionIdElement { get { return _VersionIdElement; } set { _VersionIdElement = value; OnPropertyChanged("VersionIdElement"); } } - private Hl7.Fhir.Model.FhirString _VersionIdElement; + private Hl7.Fhir.Model.FhirString? _VersionIdElement; /// /// A specific version of a resource contained in the instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VersionId + public string? VersionId { - get { return VersionIdElement != null ? VersionIdElement.Value : null; } + get => _VersionIdElement?.Value; set { - if (value == null) - VersionIdElement = null; - else - VersionIdElement = new Hl7.Fhir.Model.FhirString(value); + VersionIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VersionId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContainedInstanceComponent; - - if (dest == null) - { + if(other is not ContainedInstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResourceIdElement != null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)ResourceIdElement.DeepCopyInternal(); - if(VersionIdElement != null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)VersionIdElement.DeepCopyInternal(); + if(_ResourceIdElement is not null) dest.ResourceIdElement = (Hl7.Fhir.Model.FhirString)_ResourceIdElement.DeepCopyInternal(); + if(_VersionIdElement is not null) dest.VersionIdElement = (Hl7.Fhir.Model.FhirString)_VersionIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -843,41 +794,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainedInstanceComponent; - if(otherT == null) return false; + if(other is not ContainedInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResourceIdElement, otherT.ResourceIdElement)) return false; - if(!comparer.Equals(VersionIdElement, otherT.VersionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resourceId": - value = ResourceIdElement; - return ResourceIdElement is not null; + value = _ResourceIdElement; + return _ResourceIdElement is not null; case "versionId": - value = VersionIdElement; - return VersionIdElement is not null; + value = _VersionIdElement; + return _VersionIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resourceId": - ResourceIdElement = (Hl7.Fhir.Model.FhirString)value; + ResourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionId": - VersionIdElement = (Hl7.Fhir.Model.FhirString)value; + VersionIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -888,8 +839,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResourceIdElement is not null) yield return new KeyValuePair("resourceId",ResourceIdElement); - if (VersionIdElement is not null) yield return new KeyValuePair("versionId",VersionIdElement); + if (_ResourceIdElement is not null) yield return new KeyValuePair("resourceId",_ResourceIdElement); + if (_VersionIdElement is not null) yield return new KeyValuePair("versionId",_VersionIdElement); } } @@ -913,28 +864,25 @@ public partial class ProcessComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("title", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// The diagram title of the group of operations /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -944,28 +892,25 @@ public string Title /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A longer description of the group of operations /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -975,28 +920,25 @@ public string Description /// [FhirElement("preConditions", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown PreConditionsElement + public Hl7.Fhir.Model.Markdown? PreConditionsElement { get { return _PreConditionsElement; } set { _PreConditionsElement = value; OnPropertyChanged("PreConditionsElement"); } } - private Hl7.Fhir.Model.Markdown _PreConditionsElement; + private Hl7.Fhir.Model.Markdown? _PreConditionsElement; /// /// Description of initial status before the process starts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreConditions + public string? PreConditions { - get { return PreConditionsElement != null ? PreConditionsElement.Value : null; } + get => _PreConditionsElement?.Value; set { - if (value == null) - PreConditionsElement = null; - else - PreConditionsElement = new Hl7.Fhir.Model.Markdown(value); + PreConditionsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PreConditions"); } } @@ -1006,28 +948,25 @@ public string PreConditions /// [FhirElement("postConditions", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown PostConditionsElement + public Hl7.Fhir.Model.Markdown? PostConditionsElement { get { return _PostConditionsElement; } set { _PostConditionsElement = value; OnPropertyChanged("PostConditionsElement"); } } - private Hl7.Fhir.Model.Markdown _PostConditionsElement; + private Hl7.Fhir.Model.Markdown? _PostConditionsElement; /// /// Description of final status after the process ends /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PostConditions + public string? PostConditions { - get { return PostConditionsElement != null ? PostConditionsElement.Value : null; } + get => _PostConditionsElement?.Value; set { - if (value == null) - PostConditionsElement = null; - else - PostConditionsElement = new Hl7.Fhir.Model.Markdown(value); + PostConditionsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PostConditions"); } } @@ -1040,27 +979,23 @@ public string PostConditions [DataMember] public List Step { - get { if(_Step==null) _Step = new List(); return _Step; } + get => _Step ?? new List(); set { _Step = value; OnPropertyChanged("Step"); } } - private List _Step; + private List? _Step; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessComponent; - - if (dest == null) - { + if(other is not ProcessComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PreConditionsElement != null) dest.PreConditionsElement = (Hl7.Fhir.Model.Markdown)PreConditionsElement.DeepCopyInternal(); - if(PostConditionsElement != null) dest.PostConditionsElement = (Hl7.Fhir.Model.Markdown)PostConditionsElement.DeepCopyInternal(); - if(Step.Any()) dest.Step = new List(Step.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PreConditionsElement is not null) dest.PreConditionsElement = (Hl7.Fhir.Model.Markdown)_PreConditionsElement.DeepCopyInternal(); + if(_PostConditionsElement is not null) dest.PostConditionsElement = (Hl7.Fhir.Model.Markdown)_PostConditionsElement.DeepCopyInternal(); + if(_Step is not null) dest.Step = new List(_Step.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1072,62 +1007,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessComponent; - if(otherT == null) return false; + if(other is not ProcessComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PreConditionsElement, otherT.PreConditionsElement)) return false; - if(!comparer.Equals(PostConditionsElement, otherT.PostConditionsElement)) return false; - if(!comparer.ListEquals(Step, otherT.Step)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PreConditionsElement, otherT._PreConditionsElement)) return false; + if(!comparer.Equals(_PostConditionsElement, otherT._PostConditionsElement)) return false; + if(!comparer.ListEquals(_Step, otherT._Step)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "preConditions": - value = PreConditionsElement; - return PreConditionsElement is not null; + value = _PreConditionsElement; + return _PreConditionsElement is not null; case "postConditions": - value = PostConditionsElement; - return PostConditionsElement is not null; + value = _PostConditionsElement; + return _PostConditionsElement is not null; case "step": - value = Step; - return Step?.Any() == true; + value = _Step; + return _Step?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "preConditions": - PreConditionsElement = (Hl7.Fhir.Model.Markdown)value; + PreConditionsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "postConditions": - PostConditionsElement = (Hl7.Fhir.Model.Markdown)value; + PostConditionsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "step": - Step = (List)value; + Step = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1138,11 +1073,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PreConditionsElement is not null) yield return new KeyValuePair("preConditions",PreConditionsElement); - if (PostConditionsElement is not null) yield return new KeyValuePair("postConditions",PostConditionsElement); - if (Step?.Any() == true) yield return new KeyValuePair("step",Step); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PreConditionsElement is not null) yield return new KeyValuePair("preConditions",_PreConditionsElement); + if (_PostConditionsElement is not null) yield return new KeyValuePair("postConditions",_PostConditionsElement); + if (_Step?.Any() == true) yield return new KeyValuePair("step",_Step); } } @@ -1168,24 +1103,24 @@ public partial class StepComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Process { - get { if(_Process==null) _Process = new List(); return _Process; } + get => _Process ?? new List(); set { _Process = value; OnPropertyChanged("Process"); } } - private List _Process; + private List? _Process; /// /// If there is a pause in the flow. /// [FhirElement("pause", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PauseElement + public Hl7.Fhir.Model.FhirBoolean? PauseElement { get { return _PauseElement; } set { _PauseElement = value; OnPropertyChanged("PauseElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PauseElement; + private Hl7.Fhir.Model.FhirBoolean? _PauseElement; /// /// If there is a pause in the flow @@ -1194,13 +1129,10 @@ public Hl7.Fhir.Model.FhirBoolean PauseElement [IgnoreDataMember] public bool? Pause { - get { return PauseElement != null ? PauseElement.Value : null; } + get => _PauseElement?.Value; set { - if (value == null) - PauseElement = null; - else - PauseElement = new Hl7.Fhir.Model.FhirBoolean(value); + PauseElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Pause"); } } @@ -1210,13 +1142,13 @@ public bool? Pause /// [FhirElement("operation", Order=60)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.OperationComponent Operation + public Hl7.Fhir.Model.ExampleScenario.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.ExampleScenario.OperationComponent _Operation; + private Hl7.Fhir.Model.ExampleScenario.OperationComponent? _Operation; /// /// Alternate non-typical step action. @@ -1226,26 +1158,22 @@ public Hl7.Fhir.Model.ExampleScenario.OperationComponent Operation [DataMember] public List Alternative { - get { if(_Alternative==null) _Alternative = new List(); return _Alternative; } + get => _Alternative ?? new List(); set { _Alternative = value; OnPropertyChanged("Alternative"); } } - private List _Alternative; + private List? _Alternative; protected internal override void CopyToInternal(Base other) { - var dest = other as StepComponent; - - if (dest == null) - { + if(other is not StepComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Process.Any()) dest.Process = new List(Process.DeepCopyInternal()); - if(PauseElement != null) dest.PauseElement = (Hl7.Fhir.Model.FhirBoolean)PauseElement.DeepCopyInternal(); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)Operation.DeepCopyInternal(); - if(Alternative.Any()) dest.Alternative = new List(Alternative.DeepCopyInternal()); + if(_Process is not null) dest.Process = new List(_Process.DeepCopyInternal()); + if(_PauseElement is not null) dest.PauseElement = (Hl7.Fhir.Model.FhirBoolean)_PauseElement.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)_Operation.DeepCopyInternal(); + if(_Alternative is not null) dest.Alternative = new List(_Alternative.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1257,55 +1185,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StepComponent; - if(otherT == null) return false; + if(other is not StepComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Process, otherT.Process)) return false; - if(!comparer.Equals(PauseElement, otherT.PauseElement)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.ListEquals(Alternative, otherT.Alternative)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Process, otherT._Process)) return false; + if(!comparer.Equals(_PauseElement, otherT._PauseElement)) return false; + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.ListEquals(_Alternative, otherT._Alternative)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "process": - value = Process; - return Process?.Any() == true; + value = _Process; + return _Process?.Any() == true; case "pause": - value = PauseElement; - return PauseElement is not null; + value = _PauseElement; + return _PauseElement is not null; case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "alternative": - value = Alternative; - return Alternative?.Any() == true; + value = _Alternative; + return _Alternative?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "process": - Process = (List)value; + Process = (List?)value!; return this; case "pause": - PauseElement = (Hl7.Fhir.Model.FhirBoolean)value; + PauseElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "operation": - Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)value; + Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent?)value; return this; case "alternative": - Alternative = (List)value; + Alternative = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1316,10 +1244,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Process?.Any() == true) yield return new KeyValuePair("process",Process); - if (PauseElement is not null) yield return new KeyValuePair("pause",PauseElement); - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Alternative?.Any() == true) yield return new KeyValuePair("alternative",Alternative); + if (_Process?.Any() == true) yield return new KeyValuePair("process",_Process); + if (_PauseElement is not null) yield return new KeyValuePair("pause",_PauseElement); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Alternative?.Any() == true) yield return new KeyValuePair("alternative",_Alternative); } } @@ -1343,28 +1271,25 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("number", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NumberElement + public Hl7.Fhir.Model.FhirString? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.FhirString _NumberElement; + private Hl7.Fhir.Model.FhirString? _NumberElement; /// /// The sequential number of the interaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Number + public string? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.FhirString(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Number"); } } @@ -1374,28 +1299,25 @@ public string Number /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// The type of operation - CRUD /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1405,28 +1327,25 @@ public string Type /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The human-friendly name of the interaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1436,28 +1355,25 @@ public string Name /// [FhirElement("initiator", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString InitiatorElement + public Hl7.Fhir.Model.FhirString? InitiatorElement { get { return _InitiatorElement; } set { _InitiatorElement = value; OnPropertyChanged("InitiatorElement"); } } - private Hl7.Fhir.Model.FhirString _InitiatorElement; + private Hl7.Fhir.Model.FhirString? _InitiatorElement; /// /// Who starts the transaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Initiator + public string? Initiator { - get { return InitiatorElement != null ? InitiatorElement.Value : null; } + get => _InitiatorElement?.Value; set { - if (value == null) - InitiatorElement = null; - else - InitiatorElement = new Hl7.Fhir.Model.FhirString(value); + InitiatorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Initiator"); } } @@ -1467,28 +1383,25 @@ public string Initiator /// [FhirElement("receiver", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString ReceiverElement + public Hl7.Fhir.Model.FhirString? ReceiverElement { get { return _ReceiverElement; } set { _ReceiverElement = value; OnPropertyChanged("ReceiverElement"); } } - private Hl7.Fhir.Model.FhirString _ReceiverElement; + private Hl7.Fhir.Model.FhirString? _ReceiverElement; /// /// Who receives the transaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Receiver + public string? Receiver { - get { return ReceiverElement != null ? ReceiverElement.Value : null; } + get => _ReceiverElement?.Value; set { - if (value == null) - ReceiverElement = null; - else - ReceiverElement = new Hl7.Fhir.Model.FhirString(value); + ReceiverElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Receiver"); } } @@ -1498,28 +1411,25 @@ public string Receiver /// [FhirElement("description", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A comment to be inserted in the diagram /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1529,13 +1439,13 @@ public string Description /// [FhirElement("initiatorActive", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InitiatorActiveElement + public Hl7.Fhir.Model.FhirBoolean? InitiatorActiveElement { get { return _InitiatorActiveElement; } set { _InitiatorActiveElement = value; OnPropertyChanged("InitiatorActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InitiatorActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InitiatorActiveElement; /// /// Whether the initiator is deactivated right after the transaction @@ -1544,13 +1454,10 @@ public Hl7.Fhir.Model.FhirBoolean InitiatorActiveElement [IgnoreDataMember] public bool? InitiatorActive { - get { return InitiatorActiveElement != null ? InitiatorActiveElement.Value : null; } + get => _InitiatorActiveElement?.Value; set { - if (value == null) - InitiatorActiveElement = null; - else - InitiatorActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InitiatorActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("InitiatorActive"); } } @@ -1560,13 +1467,13 @@ public bool? InitiatorActive /// [FhirElement("receiverActive", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReceiverActiveElement + public Hl7.Fhir.Model.FhirBoolean? ReceiverActiveElement { get { return _ReceiverActiveElement; } set { _ReceiverActiveElement = value; OnPropertyChanged("ReceiverActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReceiverActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ReceiverActiveElement; /// /// Whether the receiver is deactivated right after the transaction @@ -1575,13 +1482,10 @@ public Hl7.Fhir.Model.FhirBoolean ReceiverActiveElement [IgnoreDataMember] public bool? ReceiverActive { - get { return ReceiverActiveElement != null ? ReceiverActiveElement.Value : null; } + get => _ReceiverActiveElement?.Value; set { - if (value == null) - ReceiverActiveElement = null; - else - ReceiverActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReceiverActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReceiverActive"); } } @@ -1591,47 +1495,43 @@ public bool? ReceiverActive /// [FhirElement("request", Order=120)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent Request + public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent _Request; + private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? _Request; /// /// Each resource instance used by the responder. /// [FhirElement("response", Order=130)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent Response + public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent _Response; + private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? _Response; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.FhirString)NumberElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(InitiatorElement != null) dest.InitiatorElement = (Hl7.Fhir.Model.FhirString)InitiatorElement.DeepCopyInternal(); - if(ReceiverElement != null) dest.ReceiverElement = (Hl7.Fhir.Model.FhirString)ReceiverElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(InitiatorActiveElement != null) dest.InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)InitiatorActiveElement.DeepCopyInternal(); - if(ReceiverActiveElement != null) dest.ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)ReceiverActiveElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)Response.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.FhirString)_NumberElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_InitiatorElement is not null) dest.InitiatorElement = (Hl7.Fhir.Model.FhirString)_InitiatorElement.DeepCopyInternal(); + if(_ReceiverElement is not null) dest.ReceiverElement = (Hl7.Fhir.Model.FhirString)_ReceiverElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_InitiatorActiveElement is not null) dest.InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)_InitiatorActiveElement.DeepCopyInternal(); + if(_ReceiverActiveElement is not null) dest.ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ReceiverActiveElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)_Response.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1643,97 +1543,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(InitiatorElement, otherT.InitiatorElement)) return false; - if(!comparer.Equals(ReceiverElement, otherT.ReceiverElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(InitiatorActiveElement, otherT.InitiatorActiveElement)) return false; - if(!comparer.Equals(ReceiverActiveElement, otherT.ReceiverActiveElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_InitiatorElement, otherT._InitiatorElement)) return false; + if(!comparer.Equals(_ReceiverElement, otherT._ReceiverElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_InitiatorActiveElement, otherT._InitiatorActiveElement)) return false; + if(!comparer.Equals(_ReceiverActiveElement, otherT._ReceiverActiveElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "initiator": - value = InitiatorElement; - return InitiatorElement is not null; + value = _InitiatorElement; + return _InitiatorElement is not null; case "receiver": - value = ReceiverElement; - return ReceiverElement is not null; + value = _ReceiverElement; + return _ReceiverElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "initiatorActive": - value = InitiatorActiveElement; - return InitiatorActiveElement is not null; + value = _InitiatorActiveElement; + return _InitiatorActiveElement is not null; case "receiverActive": - value = ReceiverActiveElement; - return ReceiverActiveElement is not null; + value = _ReceiverActiveElement; + return _ReceiverActiveElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.FhirString)value; + NumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "initiator": - InitiatorElement = (Hl7.Fhir.Model.FhirString)value; + InitiatorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "receiver": - ReceiverElement = (Hl7.Fhir.Model.FhirString)value; + ReceiverElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "initiatorActive": - InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "receiverActive": - ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)value; + Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)value; + Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent?)value; return this; default: return base.SetValue(key, value); @@ -1744,16 +1644,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (InitiatorElement is not null) yield return new KeyValuePair("initiator",InitiatorElement); - if (ReceiverElement is not null) yield return new KeyValuePair("receiver",ReceiverElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (InitiatorActiveElement is not null) yield return new KeyValuePair("initiatorActive",InitiatorActiveElement); - if (ReceiverActiveElement is not null) yield return new KeyValuePair("receiverActive",ReceiverActiveElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_InitiatorElement is not null) yield return new KeyValuePair("initiator",_InitiatorElement); + if (_ReceiverElement is not null) yield return new KeyValuePair("receiver",_ReceiverElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_InitiatorActiveElement is not null) yield return new KeyValuePair("initiatorActive",_InitiatorActiveElement); + if (_ReceiverActiveElement is not null) yield return new KeyValuePair("receiverActive",_ReceiverActiveElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); } } @@ -1780,28 +1680,25 @@ public partial class AlternativeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("title", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for alternative /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1811,28 +1708,25 @@ public string Title /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A human-readable description of each option /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1845,25 +1739,21 @@ public string Description [DataMember] public List Step { - get { if(_Step==null) _Step = new List(); return _Step; } + get => _Step ?? new List(); set { _Step = value; OnPropertyChanged("Step"); } } - private List _Step; + private List? _Step; protected internal override void CopyToInternal(Base other) { - var dest = other as AlternativeComponent; - - if (dest == null) - { + if(other is not AlternativeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Step.Any()) dest.Step = new List(Step.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Step is not null) dest.Step = new List(_Step.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1875,48 +1765,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AlternativeComponent; - if(otherT == null) return false; + if(other is not AlternativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Step, otherT.Step)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Step, otherT._Step)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "step": - value = Step; - return Step?.Any() == true; + value = _Step; + return _Step?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "step": - Step = (List)value; + Step = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1927,9 +1817,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Step?.Any() == true) yield return new KeyValuePair("step",Step); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Step?.Any() == true) yield return new KeyValuePair("step",_Step); } } @@ -1939,28 +1829,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this example scenario, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1973,39 +1860,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the example scenario. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the example scenario /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2015,28 +1899,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this example scenario (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2049,13 +1930,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2064,13 +1945,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2080,13 +1958,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2095,13 +1973,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2111,28 +1986,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2142,28 +2014,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2176,11 +2045,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// The context that the content is intended to support. @@ -2190,11 +2059,11 @@ public List Contact [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for example scenario (if applicable). @@ -2205,39 +2074,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2247,28 +2113,25 @@ public string Copyright /// [FhirElement("purpose", Order=210, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// The purpose of the example, e.g. to illustrate a scenario /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2281,11 +2144,11 @@ public string Purpose [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Each resource and each version that is present in the workflow. @@ -2295,11 +2158,11 @@ public List Actor [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Each major process - a group of operations. @@ -2309,11 +2172,11 @@ public List Instance [DataMember] public List Process { - get { if(_Process==null) _Process = new List(); return _Process; } + get => _Process ?? new List(); set { _Process = value; OnPropertyChanged("Process"); } } - private List _Process; + private List? _Process; /// /// Another nested workflow. @@ -2323,24 +2186,24 @@ public List Process [DataMember] public List WorkflowElement { - get { if(_WorkflowElement==null) _WorkflowElement = new List(); return _WorkflowElement; } + get => _WorkflowElement ?? new List(); set { _WorkflowElement = value; OnPropertyChanged("WorkflowElement"); } } - private List _WorkflowElement; + private List? _WorkflowElement; /// /// Another nested workflow /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Workflow + public IEnumerable? Workflow { - get { return WorkflowElement != null ? WorkflowElement.Select(elem => elem.Value) : null; } + get => _WorkflowElement?.Select(elem => elem.Value); set { if (value == null) - WorkflowElement = null; + WorkflowElement = null!; else WorkflowElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Workflow"); @@ -2351,31 +2214,27 @@ public IEnumerable Workflow protected internal override void CopyToInternal(Base other) { - var dest = other as ExampleScenario; - - if (dest == null) - { + if(other is not ExampleScenario dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Process.Any()) dest.Process = new List(Process.DeepCopyInternal()); - if(WorkflowElement.Any()) dest.WorkflowElement = new List(WorkflowElement.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Process is not null) dest.Process = new List(_Process.DeepCopyInternal()); + if(_WorkflowElement is not null) dest.WorkflowElement = new List(_WorkflowElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2387,146 +2246,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExampleScenario; - if(otherT == null) return false; + if(other is not ExampleScenario otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Process, otherT.Process)) return false; - if(!comparer.ListEquals(WorkflowElement, otherT.WorkflowElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Process, otherT._Process)) return false; + if(!comparer.ListEquals(_WorkflowElement, otherT._WorkflowElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "process": - value = Process; - return Process?.Any() == true; + value = _Process; + return _Process?.Any() == true; case "workflow": - value = WorkflowElement; - return WorkflowElement?.Any() == true; + value = _WorkflowElement; + return _WorkflowElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "process": - Process = (List)value; + Process = (List?)value!; return this; case "workflow": - WorkflowElement = (List)value; + WorkflowElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2537,23 +2396,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Process?.Any() == true) yield return new KeyValuePair("process",Process); - if (WorkflowElement?.Any() == true) yield return new KeyValuePair("workflow",WorkflowElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Process?.Any() == true) yield return new KeyValuePair("process",_Process); + if (_WorkflowElement?.Any() == true) yield return new KeyValuePair("workflow",_WorkflowElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs index 35d0c88ba..a3e3d48af 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -117,13 +120,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -131,40 +134,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// File or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -176,48 +175,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -228,9 +227,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -258,13 +257,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient reference. @@ -273,26 +272,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -304,41 +299,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -349,8 +344,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -377,13 +372,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Order of care team @@ -392,13 +387,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -411,26 +403,26 @@ public int? Sequence [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Indicator of the lead practitioner. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Indicator of the lead practitioner @@ -439,13 +431,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -456,13 +445,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Practitioner credential or specialization. @@ -470,29 +459,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("qualification", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Qualification + public Hl7.Fhir.Model.CodeableConcept? Qualification { get { return _Qualification; } set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private Hl7.Fhir.Model.CodeableConcept _Qualification; + private Hl7.Fhir.Model.CodeableConcept? _Qualification; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Qualification != null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)Qualification.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Qualification is not null) dest.Qualification = (Hl7.Fhir.Model.CodeableConcept)_Qualification.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -504,62 +489,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Qualification, otherT.Qualification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "qualification": - value = Qualification; - return Qualification is not null; + value = _Qualification; + return _Qualification is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualification": - Qualification = (Hl7.Fhir.Model.CodeableConcept)value; + Qualification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -570,11 +555,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Qualification is not null) yield return new KeyValuePair("qualification",Qualification); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Qualification is not null) yield return new KeyValuePair("qualification",_Qualification); } } @@ -602,13 +587,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -617,13 +602,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -635,13 +617,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -649,13 +631,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -664,13 +646,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Data to be provided. @@ -680,13 +662,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Explanation for the information. @@ -694,30 +676,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.Coding Reason + public Hl7.Fhir.Model.Coding? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.Coding _Reason; + private Hl7.Fhir.Model.Coding? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.Coding)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.Coding)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -729,69 +707,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.Coding)value; + Reason = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -802,12 +780,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -834,13 +812,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Diagnosis instance identifier @@ -849,13 +827,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -870,13 +845,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -887,11 +862,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Present on admission. @@ -899,13 +874,13 @@ public List Type [FhirElement("onAdmission", Order=70)] [Binding("DiagnosisOnAdmission")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OnAdmission + public Hl7.Fhir.Model.CodeableConcept? OnAdmission { get { return _OnAdmission; } set { _OnAdmission = value; OnPropertyChanged("OnAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _OnAdmission; + private Hl7.Fhir.Model.CodeableConcept? _OnAdmission; /// /// Package billing code. @@ -913,29 +888,25 @@ public Hl7.Fhir.Model.CodeableConcept OnAdmission [FhirElement("packageCode", Order=80)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PackageCode + public Hl7.Fhir.Model.CodeableConcept? PackageCode { get { return _PackageCode; } set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private Hl7.Fhir.Model.CodeableConcept _PackageCode; + private Hl7.Fhir.Model.CodeableConcept? _PackageCode; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(OnAdmission != null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)OnAdmission.DeepCopyInternal(); - if(PackageCode != null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)PackageCode.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_OnAdmission is not null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)_OnAdmission.DeepCopyInternal(); + if(_PackageCode is not null) dest.PackageCode = (Hl7.Fhir.Model.CodeableConcept)_PackageCode.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -947,62 +918,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(OnAdmission, otherT.OnAdmission)) return false; - if(!comparer.Equals(PackageCode, otherT.PackageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; + if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "onAdmission": - value = OnAdmission; - return OnAdmission is not null; + value = _OnAdmission; + return _OnAdmission is not null; case "packageCode": - value = PackageCode; - return PackageCode is not null; + value = _PackageCode; + return _PackageCode is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "onAdmission": - OnAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + OnAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "packageCode": - PackageCode = (Hl7.Fhir.Model.CodeableConcept)value; + PackageCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1013,11 +984,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (OnAdmission is not null) yield return new KeyValuePair("onAdmission",OnAdmission); - if (PackageCode is not null) yield return new KeyValuePair("packageCode",PackageCode); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_OnAdmission is not null) yield return new KeyValuePair("onAdmission",_OnAdmission); + if (_PackageCode is not null) yield return new KeyValuePair("packageCode",_PackageCode); } } @@ -1044,13 +1015,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure instance identifier @@ -1059,13 +1030,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1079,39 +1047,36 @@ public int? Sequence [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// When the procedure was performed. /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1126,13 +1091,13 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; /// /// Unique device identifier. @@ -1144,27 +1109,23 @@ public Hl7.Fhir.Model.DataType Procedure [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1176,62 +1137,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1242,11 +1203,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -1274,13 +1235,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("focal", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -1289,13 +1250,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -1308,13 +1266,13 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Prior authorization reference number. @@ -1324,24 +1282,24 @@ public Hl7.Fhir.Model.ResourceReference Coverage [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Prior authorization reference number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1350,17 +1308,13 @@ public IEnumerable PreAuthRef protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1372,48 +1326,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1424,9 +1378,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); } } @@ -1452,28 +1406,25 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the incident occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1484,13 +1435,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the event occurred. @@ -1500,27 +1451,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1532,48 +1479,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1584,9 +1531,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1613,13 +1560,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -1628,13 +1575,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1647,24 +1591,24 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get { if(_CareTeamSequenceElement==null) _CareTeamSequenceElement = new List(); return _CareTeamSequenceElement; } + get => _CareTeamSequenceElement ?? new List(); set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } - private List _CareTeamSequenceElement; + private List? _CareTeamSequenceElement; /// /// Applicable care team members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamSequence + public IEnumerable? CareTeamSequence { - get { return CareTeamSequenceElement != null ? CareTeamSequenceElement.Select(elem => elem.Value) : null; } + get => _CareTeamSequenceElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamSequenceElement = null; + CareTeamSequenceElement = null!; else CareTeamSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamSequence"); @@ -1679,24 +1623,24 @@ public IEnumerable CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get { if(_DiagnosisSequenceElement==null) _DiagnosisSequenceElement = new List(); return _DiagnosisSequenceElement; } + get => _DiagnosisSequenceElement ?? new List(); set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } - private List _DiagnosisSequenceElement; + private List? _DiagnosisSequenceElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisSequence + public IEnumerable? DiagnosisSequence { - get { return DiagnosisSequenceElement != null ? DiagnosisSequenceElement.Select(elem => elem.Value) : null; } + get => _DiagnosisSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisSequenceElement = null; + DiagnosisSequenceElement = null!; else DiagnosisSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisSequence"); @@ -1711,24 +1655,24 @@ public IEnumerable DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get { if(_ProcedureSequenceElement==null) _ProcedureSequenceElement = new List(); return _ProcedureSequenceElement; } + get => _ProcedureSequenceElement ?? new List(); set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } - private List _ProcedureSequenceElement; + private List? _ProcedureSequenceElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureSequence + public IEnumerable? ProcedureSequence { - get { return ProcedureSequenceElement != null ? ProcedureSequenceElement.Select(elem => elem.Value) : null; } + get => _ProcedureSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureSequenceElement = null; + ProcedureSequenceElement = null!; else ProcedureSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureSequence"); @@ -1743,24 +1687,24 @@ public IEnumerable ProcedureSequence [DataMember] public List InformationSequenceElement { - get { if(_InformationSequenceElement==null) _InformationSequenceElement = new List(); return _InformationSequenceElement; } + get => _InformationSequenceElement ?? new List(); set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } - private List _InformationSequenceElement; + private List? _InformationSequenceElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationSequence + public IEnumerable? InformationSequence { - get { return InformationSequenceElement != null ? InformationSequenceElement.Select(elem => elem.Value) : null; } + get => _InformationSequenceElement?.Select(elem => elem.Value); set { if (value == null) - InformationSequenceElement = null; + InformationSequenceElement = null!; else InformationSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationSequence"); @@ -1773,13 +1717,13 @@ public IEnumerable InformationSequence [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -1787,13 +1731,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=100)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -1802,13 +1746,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -1819,11 +1763,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -1834,11 +1778,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -1847,13 +1791,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -1864,52 +1808,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1918,13 +1862,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1934,13 +1875,13 @@ public decimal? Factor /// [FhirElement("net", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -1952,11 +1893,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Anatomical location. @@ -1964,13 +1905,13 @@ public List Udi [FhirElement("bodySite", Order=210)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -1981,11 +1922,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Encounters related to this billed item. @@ -1997,11 +1938,11 @@ public List SubSite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Applicable note numbers. @@ -2011,24 +1952,24 @@ public List Encounter [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2043,11 +1984,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -2057,45 +1998,41 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(CareTeamSequenceElement.Any()) dest.CareTeamSequenceElement = new List(CareTeamSequenceElement.DeepCopyInternal()); - if(DiagnosisSequenceElement.Any()) dest.DiagnosisSequenceElement = new List(DiagnosisSequenceElement.DeepCopyInternal()); - if(ProcedureSequenceElement.Any()) dest.ProcedureSequenceElement = new List(ProcedureSequenceElement.DeepCopyInternal()); - if(InformationSequenceElement.Any()) dest.InformationSequenceElement = new List(InformationSequenceElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_CareTeamSequenceElement is not null) dest.CareTeamSequenceElement = new List(_CareTeamSequenceElement.DeepCopyInternal()); + if(_DiagnosisSequenceElement is not null) dest.DiagnosisSequenceElement = new List(_DiagnosisSequenceElement.DeepCopyInternal()); + if(_ProcedureSequenceElement is not null) dest.ProcedureSequenceElement = new List(_ProcedureSequenceElement.DeepCopyInternal()); + if(_InformationSequenceElement is not null) dest.InformationSequenceElement = new List(_InformationSequenceElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2107,188 +2044,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(CareTeamSequenceElement, otherT.CareTeamSequenceElement)) return false; - if(!comparer.ListEquals(DiagnosisSequenceElement, otherT.DiagnosisSequenceElement)) return false; - if(!comparer.ListEquals(ProcedureSequenceElement, otherT.ProcedureSequenceElement)) return false; - if(!comparer.ListEquals(InformationSequenceElement, otherT.InformationSequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; + if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; + if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; + if(!comparer.ListEquals(_InformationSequenceElement, otherT._InformationSequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "careTeamSequence": - value = CareTeamSequenceElement; - return CareTeamSequenceElement?.Any() == true; + value = _CareTeamSequenceElement; + return _CareTeamSequenceElement?.Any() == true; case "diagnosisSequence": - value = DiagnosisSequenceElement; - return DiagnosisSequenceElement?.Any() == true; + value = _DiagnosisSequenceElement; + return _DiagnosisSequenceElement?.Any() == true; case "procedureSequence": - value = ProcedureSequenceElement; - return ProcedureSequenceElement?.Any() == true; + value = _ProcedureSequenceElement; + return _ProcedureSequenceElement?.Any() == true; case "informationSequence": - value = InformationSequenceElement; - return InformationSequenceElement?.Any() == true; + value = _InformationSequenceElement; + return _InformationSequenceElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "careTeamSequence": - CareTeamSequenceElement = (List)value; + CareTeamSequenceElement = (List?)value!; return this; case "diagnosisSequence": - DiagnosisSequenceElement = (List)value; + DiagnosisSequenceElement = (List?)value!; return this; case "procedureSequence": - ProcedureSequenceElement = (List)value; + ProcedureSequenceElement = (List?)value!; return this; case "informationSequence": - InformationSequenceElement = (List)value; + InformationSequenceElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2299,29 +2236,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",CareTeamSequenceElement); - if (DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",DiagnosisSequenceElement); - if (ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",ProcedureSequenceElement); - if (InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",InformationSequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",_CareTeamSequenceElement); + if (_DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",_DiagnosisSequenceElement); + if (_ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",_ProcedureSequenceElement); + if (_InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",_InformationSequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2349,13 +2286,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of adjudication outcome. @@ -2363,39 +2300,39 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monitary value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Non-monitary value @@ -2404,31 +2341,24 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2440,55 +2370,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -2499,10 +2429,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -2529,13 +2459,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Product or service provided @@ -2544,13 +2474,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2561,13 +2488,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -2575,13 +2502,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2590,13 +2517,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -2607,11 +2534,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2622,50 +2549,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2674,13 +2601,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2690,13 +2614,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2708,11 +2632,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Applicable note numbers. @@ -2722,24 +2646,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2754,11 +2678,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -2768,36 +2692,32 @@ public List Adjudicat [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2809,125 +2729,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2938,20 +2858,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -2978,13 +2898,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Product or service provided @@ -2993,13 +2913,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -3010,13 +2927,13 @@ public int? Sequence [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -3024,13 +2941,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=60)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -3039,13 +2956,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -3056,11 +2973,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -3071,50 +2988,50 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3123,13 +3040,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3139,13 +3053,13 @@ public decimal? Factor /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -3157,11 +3071,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Applicable note numbers. @@ -3171,24 +3085,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3203,35 +3117,31 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3243,118 +3153,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3365,19 +3275,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -3406,24 +3316,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get { if(_ItemSequenceElement==null) _ItemSequenceElement = new List(); return _ItemSequenceElement; } + get => _ItemSequenceElement ?? new List(); set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private List _ItemSequenceElement; + private List? _ItemSequenceElement; /// /// Item sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ItemSequence + public IEnumerable? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Select(elem => elem.Value) : null; } + get => _ItemSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ItemSequenceElement = null; + ItemSequenceElement = null!; else ItemSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ItemSequence"); @@ -3438,24 +3348,24 @@ public IEnumerable ItemSequence [DataMember] public List DetailSequenceElement { - get { if(_DetailSequenceElement==null) _DetailSequenceElement = new List(); return _DetailSequenceElement; } + get => _DetailSequenceElement ?? new List(); set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private List _DetailSequenceElement; + private List? _DetailSequenceElement; /// /// Detail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DetailSequence + public IEnumerable? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Select(elem => elem.Value) : null; } + get => _DetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DetailSequenceElement = null; + DetailSequenceElement = null!; else DetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DetailSequence"); @@ -3470,24 +3380,24 @@ public IEnumerable DetailSequence [DataMember] public List SubDetailSequenceElement { - get { if(_SubDetailSequenceElement==null) _SubDetailSequenceElement = new List(); return _SubDetailSequenceElement; } + get => _SubDetailSequenceElement ?? new List(); set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private List _SubDetailSequenceElement; + private List? _SubDetailSequenceElement; /// /// Subdetail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubDetailSequence + public IEnumerable? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Select(elem => elem.Value) : null; } + get => _SubDetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SubDetailSequenceElement = null; + SubDetailSequenceElement = null!; else SubDetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SubDetailSequence"); @@ -3504,11 +3414,11 @@ public IEnumerable SubDetailSequence [DataMember] public List Provider { - get { if(_Provider==null) _Provider = new List(); return _Provider; } + get => _Provider ?? new List(); set { _Provider = value; OnPropertyChanged("Provider"); } } - private List _Provider; + private List? _Provider; /// /// Billing, service, product, or drug code. @@ -3517,13 +3427,13 @@ public List Provider [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -3534,11 +3444,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -3549,11 +3459,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -3562,13 +3472,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -3579,52 +3489,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3633,13 +3543,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3649,13 +3556,13 @@ public decimal? Factor /// [FhirElement("net", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Anatomical location. @@ -3663,13 +3570,13 @@ public Hl7.Fhir.Model.Money Net [FhirElement("bodySite", Order=170)] [Binding("OralSites")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Anatomical sub-location. @@ -3680,11 +3587,11 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; /// /// Applicable note numbers. @@ -3694,24 +3601,24 @@ public List SubSite [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3726,11 +3633,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -3740,40 +3647,36 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement.Any()) dest.ItemSequenceElement = new List(ItemSequenceElement.DeepCopyInternal()); - if(DetailSequenceElement.Any()) dest.DetailSequenceElement = new List(DetailSequenceElement.DeepCopyInternal()); - if(SubDetailSequenceElement.Any()) dest.SubDetailSequenceElement = new List(SubDetailSequenceElement.DeepCopyInternal()); - if(Provider.Any()) dest.Provider = new List(Provider.DeepCopyInternal()); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = new List(_ItemSequenceElement.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = new List(_DetailSequenceElement.DeepCopyInternal()); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = new List(_SubDetailSequenceElement.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = new List(_Provider.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3785,153 +3688,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.ListEquals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement?.Any() == true; + value = _ItemSequenceElement; + return _ItemSequenceElement?.Any() == true; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement?.Any() == true; + value = _DetailSequenceElement; + return _DetailSequenceElement?.Any() == true; case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement?.Any() == true; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement?.Any() == true; case "provider": - value = Provider; - return Provider?.Any() == true; + value = _Provider; + return _Provider?.Any() == true; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (List)value; + ItemSequenceElement = (List?)value!; return this; case "detailSequence": - DetailSequenceElement = (List)value; + DetailSequenceElement = (List?)value!; return this; case "subDetailSequence": - SubDetailSequenceElement = (List)value; + SubDetailSequenceElement = (List?)value!; return this; case "provider": - Provider = (List)value; + Provider = (List?)value!; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3942,24 +3845,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubDetailSequenceElement?.Any() == true) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (Provider?.Any() == true) yield return new KeyValuePair("provider",Provider); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubDetailSequenceElement?.Any() == true) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_Provider?.Any() == true) yield return new KeyValuePair("provider",_Provider); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -3987,13 +3890,13 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -4004,50 +3907,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -4056,13 +3959,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -4072,13 +3972,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -4088,24 +3988,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -4120,11 +4020,11 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -4134,31 +4034,27 @@ public List Adjudicat [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4170,90 +4066,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4264,15 +4160,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -4300,13 +4196,13 @@ public partial class AddedItemDetailSubDetailComponent : Hl7.Fhir.Model.Backbone [Binding("ServiceProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Service/Product billing modifiers. @@ -4317,50 +4213,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -4369,13 +4265,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -4385,13 +4278,13 @@ public decimal? Factor /// [FhirElement("net", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -4401,24 +4294,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -4433,30 +4326,26 @@ public IEnumerable NoteNumber [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailSubDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailSubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4468,83 +4357,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailSubDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4555,14 +4444,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -4591,13 +4480,13 @@ public partial class TotalComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Financial total for the category. @@ -4605,26 +4494,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("amount", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as TotalComponent; - - if (dest == null) - { + if(other is not TotalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4636,41 +4521,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TotalComponent; - if(otherT == null) return false; + if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -4681,8 +4566,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -4709,26 +4594,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PaymentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the variance. @@ -4736,41 +4621,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected date of payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected date of payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -4780,43 +4662,39 @@ public string Date /// [FhirElement("amount", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Business identifier for the payment. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4828,69 +4706,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -4901,12 +4779,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -4932,13 +4810,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Note instance identifier @@ -4947,13 +4825,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -4965,13 +4840,13 @@ public int? Number [DeclaredType(Type = typeof(Code))] [Binding("NoteType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// display | print | printoper @@ -4980,13 +4855,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NoteType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -4996,28 +4868,25 @@ public Hl7.Fhir.Model.NoteType? Type /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -5028,28 +4897,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5061,55 +4926,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -5120,10 +4985,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -5148,26 +5013,26 @@ public partial class BenefitBalanceComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -5176,13 +5041,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -5192,28 +5054,25 @@ public bool? Excluded /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -5223,28 +5082,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -5255,13 +5111,13 @@ public string Description [FhirElement("network", Order=80)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -5269,13 +5125,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=90)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -5283,13 +5139,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=100)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -5299,30 +5155,26 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Financial { - get { if(_Financial==null) _Financial = new List(); return _Financial; } + get => _Financial ?? new List(); set { _Financial = value; OnPropertyChanged("Financial"); } } - private List _Financial; + private List? _Financial; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitBalanceComponent; - - if (dest == null) - { + if(other is not BenefitBalanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Financial.Any()) dest.Financial = new List(Financial.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Financial is not null) dest.Financial = new List(_Financial.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5334,83 +5186,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitBalanceComponent; - if(otherT == null) return false; + if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Financial, otherT.Financial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "financial": - value = Financial; - return Financial?.Any() == true; + value = _Financial; + return _Financial?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "financial": - Financial = (List)value; + Financial = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5421,14 +5273,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Financial?.Any() == true) yield return new KeyValuePair("financial",Financial); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Financial?.Any() == true) yield return new KeyValuePair("financial",_Financial); } } @@ -5456,13 +5308,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -5471,13 +5323,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -5486,27 +5338,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5518,48 +5366,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -5570,9 +5418,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -5585,11 +5433,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -5599,13 +5447,13 @@ public List Identifier [Binding("ExplanationOfBenefitStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -5614,13 +5462,10 @@ public Code Stat [IgnoreDataMember] public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -5632,13 +5477,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -5646,13 +5491,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=120, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -5662,13 +5507,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -5677,13 +5522,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -5696,26 +5538,26 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Relevant time frame for the claim. /// [FhirElement("billablePeriod", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Response creation date. @@ -5723,28 +5565,25 @@ public Hl7.Fhir.Model.Period BillablePeriod [FhirElement("created", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -5756,13 +5595,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Party responsible for reimbursement. @@ -5772,13 +5611,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -5788,13 +5627,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Desired processing urgency. @@ -5802,13 +5641,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [FhirElement("priority", Order=200)] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// For whom to reserve funds. @@ -5816,13 +5655,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("fundsReserveRequested", Order=210)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserveRequested + public Hl7.Fhir.Model.CodeableConcept? FundsReserveRequested { get { return _FundsReserveRequested; } set { _FundsReserveRequested = value; OnPropertyChanged("FundsReserveRequested"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserveRequested; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserveRequested; /// /// Funds reserved status. @@ -5830,13 +5669,13 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserveRequested [FhirElement("fundsReserve", Order=220)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Prior or corollary claims. @@ -5846,11 +5685,11 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services or products. @@ -5859,13 +5698,13 @@ public List Related [CLSCompliant(false)] [References("MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superceded by fulfiller. @@ -5874,26 +5713,26 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Recipient of benefits payable. /// [FhirElement("payee", Order=260)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee + public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent _Payee; + private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? _Payee; /// /// Treatment Referral. @@ -5902,13 +5741,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee [CLSCompliant(false)] [References("ServiceRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Servicing Facility. @@ -5917,13 +5756,13 @@ public Hl7.Fhir.Model.ResourceReference Referral [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Claim reference. @@ -5932,13 +5771,13 @@ public Hl7.Fhir.Model.ResourceReference Facility [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// Claim response reference. @@ -5947,13 +5786,13 @@ public Hl7.Fhir.Model.ResourceReference Claim [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; /// /// queued | complete | error | partial. @@ -5963,13 +5802,13 @@ public Hl7.Fhir.Model.ResourceReference ClaimResponse [Binding("RemittanceOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -5978,13 +5817,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.RemittanceOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -5994,28 +5830,25 @@ public Hl7.Fhir.Model.RemittanceOutcome? Outcome /// [FhirElement("disposition", Order=320)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -6028,24 +5861,24 @@ public string Disposition [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -6060,11 +5893,11 @@ public IEnumerable PreAuthRef [DataMember] public List PreAuthRefPeriod { - get { if(_PreAuthRefPeriod==null) _PreAuthRefPeriod = new List(); return _PreAuthRefPeriod; } + get => _PreAuthRefPeriod ?? new List(); set { _PreAuthRefPeriod = value; OnPropertyChanged("PreAuthRefPeriod"); } } - private List _PreAuthRefPeriod; + private List? _PreAuthRefPeriod; /// /// Care Team members. @@ -6074,11 +5907,11 @@ public List PreAuthRefPeriod [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Supporting information. @@ -6088,11 +5921,11 @@ public List CareTeam [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Pertinent diagnosis information. @@ -6102,11 +5935,11 @@ public List [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Clinical procedures performed. @@ -6116,24 +5949,24 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Precedence (primary, secondary, etc.). /// [FhirElement("precedence", Order=390)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PrecedenceElement + public Hl7.Fhir.Model.PositiveInt? PrecedenceElement { get { return _PrecedenceElement; } set { _PrecedenceElement = value; OnPropertyChanged("PrecedenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _PrecedenceElement; + private Hl7.Fhir.Model.PositiveInt? _PrecedenceElement; /// /// Precedence (primary, secondary, etc.) @@ -6142,13 +5975,10 @@ public Hl7.Fhir.Model.PositiveInt PrecedenceElement [IgnoreDataMember] public int? Precedence { - get { return PrecedenceElement != null ? PrecedenceElement.Value : null; } + get => _PrecedenceElement?.Value; set { - if (value == null) - PrecedenceElement = null; - else - PrecedenceElement = new Hl7.Fhir.Model.PositiveInt(value); + PrecedenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Precedence"); } } @@ -6161,24 +5991,24 @@ public int? Precedence [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Details of the event. /// [FhirElement("accident", Order=410)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent Accident + public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent _Accident; + private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? _Accident; /// /// Product or service provided. @@ -6188,11 +6018,11 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent Accident [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -6202,11 +6032,11 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Header-level adjudication. @@ -6216,11 +6046,11 @@ public List AddItem [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication totals. @@ -6230,24 +6060,24 @@ public List Adjudicat [DataMember] public List Total { - get { if(_Total==null) _Total = new List(); return _Total; } + get => _Total ?? new List(); set { _Total = value; OnPropertyChanged("Total"); } } - private List _Total; + private List? _Total; /// /// Payment Details. /// [FhirElement("payment", Order=460)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment + public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent _Payment; + private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? _Payment; /// /// Printed form identifier. @@ -6255,26 +6085,26 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment [FhirElement("formCode", Order=470)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Printed reference or actual form. /// [FhirElement("form", Order=480)] [DataMember] - public Hl7.Fhir.Model.Attachment Form + public Hl7.Fhir.Model.Attachment? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.Attachment _Form; + private Hl7.Fhir.Model.Attachment? _Form; /// /// Note concerning adjudication. @@ -6284,24 +6114,24 @@ public Hl7.Fhir.Model.Attachment Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// When the benefits are applicable. /// [FhirElement("benefitPeriod", Order=500)] [DataMember] - public Hl7.Fhir.Model.Period BenefitPeriod + public Hl7.Fhir.Model.Period? BenefitPeriod { get { return _BenefitPeriod; } set { _BenefitPeriod = value; OnPropertyChanged("BenefitPeriod"); } } - private Hl7.Fhir.Model.Period _BenefitPeriod; + private Hl7.Fhir.Model.Period? _BenefitPeriod; /// /// Balance by Benefit Category. @@ -6311,67 +6141,63 @@ public Hl7.Fhir.Model.Period BenefitPeriod [DataMember] public List BenefitBalance { - get { if(_BenefitBalance==null) _BenefitBalance = new List(); return _BenefitBalance; } + get => _BenefitBalance ?? new List(); set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } - private List _BenefitBalance; + private List? _BenefitBalance; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ExplanationOfBenefit; - - if (dest == null) - { + if(other is not ExplanationOfBenefit dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(FundsReserveRequested != null) dest.FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)FundsReserveRequested.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)Payee.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(PreAuthRefPeriod.Any()) dest.PreAuthRefPeriod = new List(PreAuthRefPeriod.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(PrecedenceElement != null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)PrecedenceElement.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)Accident.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Total.Any()) dest.Total = new List(Total.DeepCopyInternal()); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)Payment.DeepCopyInternal(); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.Attachment)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(BenefitPeriod != null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)BenefitPeriod.DeepCopyInternal(); - if(BenefitBalance.Any()) dest.BenefitBalance = new List(BenefitBalance.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_FundsReserveRequested is not null) dest.FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)_FundsReserveRequested.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_PreAuthRefPeriod is not null) dest.PreAuthRefPeriod = new List(_PreAuthRefPeriod.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_PrecedenceElement is not null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)_PrecedenceElement.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)_Accident.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Total is not null) dest.Total = new List(_Total.DeepCopyInternal()); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)_Payment.DeepCopyInternal(); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.Attachment)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_BenefitPeriod is not null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)_BenefitPeriod.DeepCopyInternal(); + if(_BenefitBalance is not null) dest.BenefitBalance = new List(_BenefitBalance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -6383,328 +6209,328 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExplanationOfBenefit; - if(otherT == null) return false; + if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(FundsReserveRequested, otherT.FundsReserveRequested)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.ListEquals(PreAuthRefPeriod, otherT.PreAuthRefPeriod)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(PrecedenceElement, otherT.PrecedenceElement)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Total, otherT.Total)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.Equals(BenefitPeriod, otherT.BenefitPeriod)) return false; - if(!comparer.ListEquals(BenefitBalance, otherT.BenefitBalance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_FundsReserveRequested, otherT._FundsReserveRequested)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.ListEquals(_PreAuthRefPeriod, otherT._PreAuthRefPeriod)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_PrecedenceElement, otherT._PrecedenceElement)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Total, otherT._Total)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; + if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "fundsReserveRequested": - value = FundsReserveRequested; - return FundsReserveRequested is not null; + value = _FundsReserveRequested; + return _FundsReserveRequested is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "preAuthRefPeriod": - value = PreAuthRefPeriod; - return PreAuthRefPeriod?.Any() == true; + value = _PreAuthRefPeriod; + return _PreAuthRefPeriod?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "precedence": - value = PrecedenceElement; - return PrecedenceElement is not null; + value = _PrecedenceElement; + return _PrecedenceElement is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "total": - value = Total; - return Total?.Any() == true; + value = _Total; + return _Total?.Any() == true; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "benefitPeriod": - value = BenefitPeriod; - return BenefitPeriod is not null; + value = _BenefitPeriod; + return _BenefitPeriod is not null; case "benefitBalance": - value = BenefitBalance; - return BenefitBalance?.Any() == true; + value = _BenefitBalance; + return _BenefitBalance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserveRequested": - FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "preAuthRefPeriod": - PreAuthRefPeriod = (List)value; + PreAuthRefPeriod = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "precedence": - PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)value; + PrecedenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "accident": - Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "total": - Total = (List)value; + Total = (List?)value!; return this; case "payment": - Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent?)value; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "form": - Form = (Hl7.Fhir.Model.Attachment)value; + Form = (Hl7.Fhir.Model.Attachment?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "benefitPeriod": - BenefitPeriod = (Hl7.Fhir.Model.Period)value; + BenefitPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "benefitBalance": - BenefitBalance = (List)value; + BenefitBalance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -6715,49 +6541,49 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (FundsReserveRequested is not null) yield return new KeyValuePair("fundsReserveRequested",FundsReserveRequested); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthRefPeriod?.Any() == true) yield return new KeyValuePair("preAuthRefPeriod",PreAuthRefPeriod); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (PrecedenceElement is not null) yield return new KeyValuePair("precedence",PrecedenceElement); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Total?.Any() == true) yield return new KeyValuePair("total",Total); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",BenefitPeriod); - if (BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",BenefitBalance); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_FundsReserveRequested is not null) yield return new KeyValuePair("fundsReserveRequested",_FundsReserveRequested); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthRefPeriod?.Any() == true) yield return new KeyValuePair("preAuthRefPeriod",_PreAuthRefPeriod); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_PrecedenceElement is not null) yield return new KeyValuePair("precedence",_PrecedenceElement); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Total?.Any() == true) yield return new KeyValuePair("total",_Total); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",_BenefitPeriod); + if (_BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",_BenefitBalance); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs b/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs index 57120713b..2973c3874 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Expression : Hl7.Fhir.Model.DataType /// [FhirElement("description", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -95,28 +95,25 @@ public string Description /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Short name assigned to expression for reuse /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -128,28 +125,25 @@ public string Name [Binding("ExpressionLanguage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// text/cql | text/fhirpath | application/x-fhir-query | text/cql-identifier | text/cql-expression | etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -159,28 +153,25 @@ public string Language /// [FhirElement("expression", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Expression in specified language /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression_ + public string? Expression_ { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression_"); } } @@ -190,47 +181,40 @@ public string Expression_ /// [FhirElement("reference", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Where the expression is found /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Expression; - - if (dest == null) - { + if(other is not Expression dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -242,62 +226,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Expression; - if(otherT == null) return false; + if(other is not Expression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -308,11 +292,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs index 5358fd816..a7055bce8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConditionCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// deceased | permanent disability | etc. @@ -130,26 +133,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("outcome", Order=50)] [Binding("ConditionOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Whether the condition contributed to the cause of death. /// [FhirElement("contributedToDeath", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement + public Hl7.Fhir.Model.FhirBoolean? ContributedToDeathElement { get { return _ContributedToDeathElement; } set { _ContributedToDeathElement = value; OnPropertyChanged("ContributedToDeathElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ContributedToDeathElement; + private Hl7.Fhir.Model.FhirBoolean? _ContributedToDeathElement; /// /// Whether the condition contributed to the cause of death @@ -158,13 +161,10 @@ public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement [IgnoreDataMember] public bool? ContributedToDeath { - get { return ContributedToDeathElement != null ? ContributedToDeathElement.Value : null; } + get => _ContributedToDeathElement?.Value; set { - if (value == null) - ContributedToDeathElement = null; - else - ContributedToDeathElement = new Hl7.Fhir.Model.FhirBoolean(value); + ContributedToDeathElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ContributedToDeath"); } } @@ -176,13 +176,13 @@ public bool? ContributedToDeath [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Extra information about condition. @@ -192,27 +192,23 @@ public Hl7.Fhir.Model.DataType Onset [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(ContributedToDeathElement != null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)ContributedToDeathElement.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_ContributedToDeathElement is not null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)_ContributedToDeathElement.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -224,62 +220,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(ContributedToDeathElement, otherT.ContributedToDeathElement)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "contributedToDeath": - value = ContributedToDeathElement; - return ContributedToDeathElement is not null; + value = _ContributedToDeathElement; + return _ContributedToDeathElement is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contributedToDeath": - ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)value; + ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -290,11 +286,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",ContributedToDeathElement); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",_ContributedToDeathElement); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -307,11 +303,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -321,24 +317,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -353,24 +349,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -385,13 +381,13 @@ public IEnumerable InstantiatesUri [Binding("FamilyHistoryStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// partial | completed | entered-in-error | health-unknown @@ -400,13 +396,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -417,13 +410,13 @@ public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status [FhirElement("dataAbsentReason", InSummary=true, Order=130)] [Binding("FamilyHistoryAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// Patient history is about. @@ -433,41 +426,38 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When history was recorded or last updated. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When history was recorded or last updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -477,28 +467,25 @@ public string Date /// [FhirElement("name", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The family member described /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -510,13 +497,13 @@ public string Name [Binding("FamilialRelationship")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// male | female | other | unknown. @@ -524,13 +511,13 @@ public Hl7.Fhir.Model.CodeableConcept Relationship [FhirElement("sex", InSummary=true, Order=180)] [Binding("Sex")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Sex + public Hl7.Fhir.Model.CodeableConcept? Sex { get { return _Sex; } set { _Sex = value; OnPropertyChanged("Sex"); } } - private Hl7.Fhir.Model.CodeableConcept _Sex; + private Hl7.Fhir.Model.CodeableConcept? _Sex; /// /// (approximate) date of birth. @@ -539,13 +526,13 @@ public Hl7.Fhir.Model.CodeableConcept Sex [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Born + public Hl7.Fhir.Model.DataType? Born { get { return _Born; } set { _Born = value; OnPropertyChanged("Born"); } } - private Hl7.Fhir.Model.DataType _Born; + private Hl7.Fhir.Model.DataType? _Born; /// /// (approximate) age. @@ -554,26 +541,26 @@ public Hl7.Fhir.Model.DataType Born [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Age + public Hl7.Fhir.Model.DataType? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.DataType _Age; + private Hl7.Fhir.Model.DataType? _Age; /// /// Age is estimated?. /// [FhirElement("estimatedAge", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement + public Hl7.Fhir.Model.FhirBoolean? EstimatedAgeElement { get { return _EstimatedAgeElement; } set { _EstimatedAgeElement = value; OnPropertyChanged("EstimatedAgeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EstimatedAgeElement; + private Hl7.Fhir.Model.FhirBoolean? _EstimatedAgeElement; /// /// Age is estimated? @@ -582,13 +569,10 @@ public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement [IgnoreDataMember] public bool? EstimatedAge { - get { return EstimatedAgeElement != null ? EstimatedAgeElement.Value : null; } + get => _EstimatedAgeElement?.Value; set { - if (value == null) - EstimatedAgeElement = null; - else - EstimatedAgeElement = new Hl7.Fhir.Model.FhirBoolean(value); + EstimatedAgeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EstimatedAge"); } } @@ -600,13 +584,13 @@ public bool? EstimatedAge [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// Why was family member history performed?. @@ -617,11 +601,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was family member history performed?. @@ -633,11 +617,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// General note about related person. @@ -647,11 +631,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Condition that the related person had. @@ -661,42 +645,38 @@ public List Note [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as FamilyMemberHistory; - - if (dest == null) - { + if(other is not FamilyMemberHistory dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Sex != null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)Sex.DeepCopyInternal(); - if(Born != null) dest.Born = (Hl7.Fhir.Model.DataType)Born.DeepCopyInternal(); - if(Age != null) dest.Age = (Hl7.Fhir.Model.DataType)Age.DeepCopyInternal(); - if(EstimatedAgeElement != null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)EstimatedAgeElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Sex is not null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)_Sex.DeepCopyInternal(); + if(_Born is not null) dest.Born = (Hl7.Fhir.Model.DataType)_Born.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.DataType)_Age.DeepCopyInternal(); + if(_EstimatedAgeElement is not null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)_EstimatedAgeElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -708,153 +688,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FamilyMemberHistory; - if(otherT == null) return false; + if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Sex, otherT.Sex)) return false; - if(!comparer.Equals(Born, otherT.Born)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(EstimatedAgeElement, otherT.EstimatedAgeElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Sex, otherT._Sex)) return false; + if(!comparer.Equals(_Born, otherT._Born)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_EstimatedAgeElement, otherT._EstimatedAgeElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "sex": - value = Sex; - return Sex is not null; + value = _Sex; + return _Sex is not null; case "born": - value = Born; - return Born is not null; + value = _Born; + return _Born is not null; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "estimatedAge": - value = EstimatedAgeElement; - return EstimatedAgeElement is not null; + value = _EstimatedAgeElement; + return _EstimatedAgeElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sex": - Sex = (Hl7.Fhir.Model.CodeableConcept)value; + Sex = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "born": - Born = (Hl7.Fhir.Model.DataType)value; + Born = (Hl7.Fhir.Model.DataType?)value; return this; case "age": - Age = (Hl7.Fhir.Model.DataType)value; + Age = (Hl7.Fhir.Model.DataType?)value; return this; case "estimatedAge": - EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)value; + EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; default: return base.SetValue(key, value); @@ -865,24 +845,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Sex is not null) yield return new KeyValuePair("sex",Sex); - if (Born is not null) yield return new KeyValuePair("born",Born); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",EstimatedAgeElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Sex is not null) yield return new KeyValuePair("sex",_Sex); + if (_Born is not null) yield return new KeyValuePair("born",_Born); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",_EstimatedAgeElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs b/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs index 47c6ac682..06adcf9c5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -95,11 +98,11 @@ public enum FlagStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -109,13 +112,13 @@ public List Identifier [Binding("FlagStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -124,13 +127,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Flag.FlagStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -144,11 +144,11 @@ public Hl7.Fhir.Model.Flag.FlagStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Coded or textual message to display to user. @@ -157,13 +157,13 @@ public List Category [Binding("FlagCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/What is flag about?. @@ -173,26 +173,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Location","Group","Organization","Practitioner","PlanDefinition","Medication","Procedure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Time period when flag is active. /// [FhirElement("period", InSummary=true, Order=140, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Alert relevant during encounter. @@ -201,13 +201,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Flag creator. @@ -216,34 +216,30 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Flag; - - if (dest == null) - { + if(other is not Flag dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -255,83 +251,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Flag; - if(otherT == null) return false; + if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -342,14 +338,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs b/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs index 740cc352f..ad0fe510e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -147,13 +150,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", InSummary=true, Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -163,13 +166,13 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal on or before. @@ -178,27 +181,23 @@ public Hl7.Fhir.Model.DataType Detail [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Due + public Hl7.Fhir.Model.DataType? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.DataType _Due; + private Hl7.Fhir.Model.DataType? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.DataType)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.DataType)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -210,48 +209,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.DataType)value; + Due = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -262,9 +261,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -277,11 +276,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected. @@ -291,13 +290,13 @@ public List Identifier [Binding("GoalLifecycleStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code LifecycleStatusElement + public Code? LifecycleStatusElement { get { return _LifecycleStatusElement; } set { _LifecycleStatusElement = value; OnPropertyChanged("LifecycleStatusElement"); } } - private Code _LifecycleStatusElement; + private Code? _LifecycleStatusElement; /// /// proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected @@ -306,13 +305,10 @@ public Code LifecycleStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Goal.GoalLifecycleStatus? LifecycleStatus { - get { return LifecycleStatusElement != null ? LifecycleStatusElement.Value : null; } + get => _LifecycleStatusElement?.Value; set { - if (value == null) - LifecycleStatusElement = null; - else - LifecycleStatusElement = new Code(value); + LifecycleStatusElement = value is null ? null : new Code(value); OnPropertyChanged("LifecycleStatus"); } } @@ -323,13 +319,13 @@ public Hl7.Fhir.Model.Goal.GoalLifecycleStatus? LifecycleStatus [FhirElement("achievementStatus", InSummary=true, Order=110)] [Binding("GoalAchievementStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AchievementStatus + public Hl7.Fhir.Model.CodeableConcept? AchievementStatus { get { return _AchievementStatus; } set { _AchievementStatus = value; OnPropertyChanged("AchievementStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _AchievementStatus; + private Hl7.Fhir.Model.CodeableConcept? _AchievementStatus; /// /// E.g. Treatment, dietary, behavioral, etc. @@ -340,11 +336,11 @@ public Hl7.Fhir.Model.CodeableConcept AchievementStatus [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// high-priority | medium-priority | low-priority. @@ -352,13 +348,13 @@ public List Category [FhirElement("priority", InSummary=true, Order=130, FiveWs="FiveWs.grade")] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// Code or text describing goal. @@ -367,13 +363,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// Who this goal is intended for. @@ -383,13 +379,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [References("Patient","Group","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When goal pursuit begins. @@ -399,13 +395,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Start + public Hl7.Fhir.Model.DataType? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.DataType _Start; + private Hl7.Fhir.Model.DataType? _Start; /// /// Target outcome for the goal. @@ -415,39 +411,36 @@ public Hl7.Fhir.Model.DataType Start [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// When goal status took effect. /// [FhirElement("statusDate", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Date StatusDateElement + public Hl7.Fhir.Model.Date? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.Date _StatusDateElement; + private Hl7.Fhir.Model.Date? _StatusDateElement; /// /// When goal status took effect /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.Date(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("StatusDate"); } } @@ -457,28 +450,25 @@ public string StatusDate /// [FhirElement("statusReason", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString StatusReasonElement + public Hl7.Fhir.Model.FhirString? StatusReasonElement { get { return _StatusReasonElement; } set { _StatusReasonElement = value; OnPropertyChanged("StatusReasonElement"); } } - private Hl7.Fhir.Model.FhirString _StatusReasonElement; + private Hl7.Fhir.Model.FhirString? _StatusReasonElement; /// /// Reason for current status /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusReason + public string? StatusReason { - get { return StatusReasonElement != null ? StatusReasonElement.Value : null; } + get => _StatusReasonElement?.Value; set { - if (value == null) - StatusReasonElement = null; - else - StatusReasonElement = new Hl7.Fhir.Model.FhirString(value); + StatusReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StatusReason"); } } @@ -490,13 +480,13 @@ public string StatusReason [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExpressedBy + public Hl7.Fhir.Model.ResourceReference? ExpressedBy { get { return _ExpressedBy; } set { _ExpressedBy = value; OnPropertyChanged("ExpressedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ExpressedBy; + private Hl7.Fhir.Model.ResourceReference? _ExpressedBy; /// /// Issues addressed by this goal. @@ -508,11 +498,11 @@ public Hl7.Fhir.Model.ResourceReference ExpressedBy [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Comments about the goal. @@ -522,11 +512,11 @@ public List Addresses [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// What result was achieved regarding the goal?. @@ -537,11 +527,11 @@ public List Note [DataMember] public List OutcomeCode { - get { if(_OutcomeCode==null) _OutcomeCode = new List(); return _OutcomeCode; } + get => _OutcomeCode ?? new List(); set { _OutcomeCode = value; OnPropertyChanged("OutcomeCode"); } } - private List _OutcomeCode; + private List? _OutcomeCode; /// /// Observation that resulted from goal. @@ -553,40 +543,36 @@ public List OutcomeCode [DataMember] public List OutcomeReference { - get { if(_OutcomeReference==null) _OutcomeReference = new List(); return _OutcomeReference; } + get => _OutcomeReference ?? new List(); set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } - private List _OutcomeReference; + private List? _OutcomeReference; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Goal; - - if (dest == null) - { + if(other is not Goal dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(LifecycleStatusElement != null) dest.LifecycleStatusElement = (Code)LifecycleStatusElement.DeepCopyInternal(); - if(AchievementStatus != null) dest.AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)AchievementStatus.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.DataType)Start.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)StatusDateElement.DeepCopyInternal(); - if(StatusReasonElement != null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)StatusReasonElement.DeepCopyInternal(); - if(ExpressedBy != null) dest.ExpressedBy = (Hl7.Fhir.Model.ResourceReference)ExpressedBy.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(OutcomeCode.Any()) dest.OutcomeCode = new List(OutcomeCode.DeepCopyInternal()); - if(OutcomeReference.Any()) dest.OutcomeReference = new List(OutcomeReference.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_LifecycleStatusElement is not null) dest.LifecycleStatusElement = (Code)_LifecycleStatusElement.DeepCopyInternal(); + if(_AchievementStatus is not null) dest.AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)_AchievementStatus.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.DataType)_Start.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)_StatusDateElement.DeepCopyInternal(); + if(_StatusReasonElement is not null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)_StatusReasonElement.DeepCopyInternal(); + if(_ExpressedBy is not null) dest.ExpressedBy = (Hl7.Fhir.Model.ResourceReference)_ExpressedBy.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_OutcomeCode is not null) dest.OutcomeCode = new List(_OutcomeCode.DeepCopyInternal()); + if(_OutcomeReference is not null) dest.OutcomeReference = new List(_OutcomeReference.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -598,139 +584,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Goal; - if(otherT == null) return false; + if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(LifecycleStatusElement, otherT.LifecycleStatusElement)) return false; - if(!comparer.Equals(AchievementStatus, otherT.AchievementStatus)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(StatusReasonElement, otherT.StatusReasonElement)) return false; - if(!comparer.Equals(ExpressedBy, otherT.ExpressedBy)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(OutcomeCode, otherT.OutcomeCode)) return false; - if(!comparer.ListEquals(OutcomeReference, otherT.OutcomeReference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_LifecycleStatusElement, otherT._LifecycleStatusElement)) return false; + if(!comparer.Equals(_AchievementStatus, otherT._AchievementStatus)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_StatusReasonElement, otherT._StatusReasonElement)) return false; + if(!comparer.Equals(_ExpressedBy, otherT._ExpressedBy)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_OutcomeCode, otherT._OutcomeCode)) return false; + if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "lifecycleStatus": - value = LifecycleStatusElement; - return LifecycleStatusElement is not null; + value = _LifecycleStatusElement; + return _LifecycleStatusElement is not null; case "achievementStatus": - value = AchievementStatus; - return AchievementStatus is not null; + value = _AchievementStatus; + return _AchievementStatus is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "statusReason": - value = StatusReasonElement; - return StatusReasonElement is not null; + value = _StatusReasonElement; + return _StatusReasonElement is not null; case "expressedBy": - value = ExpressedBy; - return ExpressedBy is not null; + value = _ExpressedBy; + return _ExpressedBy is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "outcomeCode": - value = OutcomeCode; - return OutcomeCode?.Any() == true; + value = _OutcomeCode; + return _OutcomeCode?.Any() == true; case "outcomeReference": - value = OutcomeReference; - return OutcomeReference?.Any() == true; + value = _OutcomeReference; + return _OutcomeReference?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "lifecycleStatus": - LifecycleStatusElement = (Code)value; + LifecycleStatusElement = (Code?)value; return this; case "achievementStatus": - AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)value; + AchievementStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - Start = (Hl7.Fhir.Model.DataType)value; + Start = (Hl7.Fhir.Model.DataType?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.Date)value; + StatusDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "statusReason": - StatusReasonElement = (Hl7.Fhir.Model.FhirString)value; + StatusReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expressedBy": - ExpressedBy = (Hl7.Fhir.Model.ResourceReference)value; + ExpressedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "outcomeCode": - OutcomeCode = (List)value; + OutcomeCode = (List?)value!; return this; case "outcomeReference": - OutcomeReference = (List)value; + OutcomeReference = (List?)value!; return this; default: return base.SetValue(key, value); @@ -741,22 +727,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (LifecycleStatusElement is not null) yield return new KeyValuePair("lifecycleStatus",LifecycleStatusElement); - if (AchievementStatus is not null) yield return new KeyValuePair("achievementStatus",AchievementStatus); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (StatusReasonElement is not null) yield return new KeyValuePair("statusReason",StatusReasonElement); - if (ExpressedBy is not null) yield return new KeyValuePair("expressedBy",ExpressedBy); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (OutcomeCode?.Any() == true) yield return new KeyValuePair("outcomeCode",OutcomeCode); - if (OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",OutcomeReference); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_LifecycleStatusElement is not null) yield return new KeyValuePair("lifecycleStatus",_LifecycleStatusElement); + if (_AchievementStatus is not null) yield return new KeyValuePair("achievementStatus",_AchievementStatus); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_StatusReasonElement is not null) yield return new KeyValuePair("statusReason",_StatusReasonElement); + if (_ExpressedBy is not null) yield return new KeyValuePair("expressedBy",_ExpressedBy); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_OutcomeCode?.Any() == true) yield return new KeyValuePair("outcomeCode",_OutcomeCode); + if (_OutcomeReference?.Any() == true) yield return new KeyValuePair("outcomeReference",_OutcomeReference); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs index 6287c40eb..b0419760a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,28 +136,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("path", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path in the resource that contains the link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -164,28 +164,25 @@ public string Path /// [FhirElement("sliceName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SliceNameElement + public Hl7.Fhir.Model.FhirString? SliceNameElement { get { return _SliceNameElement; } set { _SliceNameElement = value; OnPropertyChanged("SliceNameElement"); } } - private Hl7.Fhir.Model.FhirString _SliceNameElement; + private Hl7.Fhir.Model.FhirString? _SliceNameElement; /// /// Which slice (if profiled) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SliceName + public string? SliceName { - get { return SliceNameElement != null ? SliceNameElement.Value : null; } + get => _SliceNameElement?.Value; set { - if (value == null) - SliceNameElement = null; - else - SliceNameElement = new Hl7.Fhir.Model.FhirString(value); + SliceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SliceName"); } } @@ -195,13 +192,13 @@ public string SliceName /// [FhirElement("min", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum occurrences for this link @@ -210,13 +207,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -226,28 +220,25 @@ public int? Min /// [FhirElement("max", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum occurrences for this link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -257,28 +248,25 @@ public string Max /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why this link is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -291,28 +279,24 @@ public string Description [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SliceNameElement != null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)SliceNameElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SliceNameElement is not null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)_SliceNameElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -324,69 +308,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SliceNameElement, otherT.SliceNameElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sliceName": - value = SliceNameElement; - return SliceNameElement is not null; + value = _SliceNameElement; + return _SliceNameElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sliceName": - SliceNameElement = (Hl7.Fhir.Model.FhirString)value; + SliceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -397,12 +381,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SliceNameElement is not null) yield return new KeyValuePair("sliceName",SliceNameElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SliceNameElement is not null) yield return new KeyValuePair("sliceName",_SliceNameElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -428,13 +412,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type of resource this link refers to @@ -443,13 +427,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -459,28 +440,25 @@ public Hl7.Fhir.Model.ResourceType? Type /// [FhirElement("params", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ParamsElement + public Hl7.Fhir.Model.FhirString? ParamsElement { get { return _ParamsElement; } set { _ParamsElement = value; OnPropertyChanged("ParamsElement"); } } - private Hl7.Fhir.Model.FhirString _ParamsElement; + private Hl7.Fhir.Model.FhirString? _ParamsElement; /// /// Criteria for reverse lookup /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Params + public string? Params { - get { return ParamsElement != null ? ParamsElement.Value : null; } + get => _ParamsElement?.Value; set { - if (value == null) - ParamsElement = null; - else - ParamsElement = new Hl7.Fhir.Model.FhirString(value); + ParamsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Params"); } } @@ -490,28 +468,25 @@ public string Params /// [FhirElement("profile", Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile for the target resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -524,11 +499,11 @@ public string Profile [DataMember] public List Compartment { - get { if(_Compartment==null) _Compartment = new List(); return _Compartment; } + get => _Compartment ?? new List(); set { _Compartment = value; OnPropertyChanged("Compartment"); } } - private List _Compartment; + private List? _Compartment; /// /// Additional links from target resource. @@ -538,27 +513,23 @@ public List Compartment [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ParamsElement != null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)ParamsElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(Compartment.Any()) dest.Compartment = new List(Compartment.DeepCopyInternal()); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ParamsElement is not null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)_ParamsElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_Compartment is not null) dest.Compartment = new List(_Compartment.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -570,62 +541,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ParamsElement, otherT.ParamsElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Compartment, otherT.Compartment)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "params": - value = ParamsElement; - return ParamsElement is not null; + value = _ParamsElement; + return _ParamsElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "compartment": - value = Compartment; - return Compartment?.Any() == true; + value = _Compartment; + return _Compartment?.Any() == true; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "params": - ParamsElement = (Hl7.Fhir.Model.FhirString)value; + ParamsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "compartment": - Compartment = (List)value; + Compartment = (List?)value!; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -636,11 +607,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ParamsElement is not null) yield return new KeyValuePair("params",ParamsElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Compartment?.Any() == true) yield return new KeyValuePair("compartment",Compartment); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ParamsElement is not null) yield return new KeyValuePair("params",_ParamsElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Compartment?.Any() == true) yield return new KeyValuePair("compartment",_Compartment); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } @@ -666,13 +637,13 @@ public partial class CompartmentComponent : Hl7.Fhir.Model.BackboneElement [Binding("GraphCompartmentUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// condition | requirement @@ -681,13 +652,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -700,13 +668,13 @@ public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentUse? Use [Binding("CompartmentCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device @@ -715,13 +683,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -734,13 +699,13 @@ public Hl7.Fhir.Model.CompartmentType? Code [Binding("GraphCompartmentRule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RuleElement + public Code? RuleElement { get { return _RuleElement; } set { _RuleElement = value; OnPropertyChanged("RuleElement"); } } - private Code _RuleElement; + private Code? _RuleElement; /// /// identical | matching | different | custom @@ -749,13 +714,10 @@ public Code RuleElement [IgnoreDataMember] public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule { - get { return RuleElement != null ? RuleElement.Value : null; } + get => _RuleElement?.Value; set { - if (value == null) - RuleElement = null; - else - RuleElement = new Code(value); + RuleElement = value is null ? null : new Code(value); OnPropertyChanged("Rule"); } } @@ -765,28 +727,25 @@ public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Custom rule, as a FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -796,47 +755,40 @@ public string Expression /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Documentation for FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentComponent; - - if (dest == null) - { + if(other is not CompartmentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(RuleElement != null) dest.RuleElement = (Code)RuleElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_RuleElement is not null) dest.RuleElement = (Code)_RuleElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -848,62 +800,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentComponent; - if(otherT == null) return false; + if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(RuleElement, otherT.RuleElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "rule": - value = RuleElement; - return RuleElement is not null; + value = _RuleElement; + return _RuleElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "rule": - RuleElement = (Code)value; + RuleElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -914,11 +866,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (RuleElement is not null) yield return new KeyValuePair("rule",RuleElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_RuleElement is not null) yield return new KeyValuePair("rule",_RuleElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -928,28 +880,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this graph definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -959,28 +908,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -991,28 +937,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this graph definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1025,13 +968,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1040,13 +983,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1056,13 +996,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=130, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1071,13 +1011,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1087,28 +1024,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1118,28 +1052,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=150, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1152,39 +1083,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the graph definition. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1197,11 +1125,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for graph definition (if applicable). @@ -1212,39 +1140,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this graph definition is defined. /// [FhirElement("purpose", Order=200, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this graph definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1257,13 +1182,13 @@ public string Purpose [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StartElement + public Code? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Code _StartElement; + private Code? _StartElement; /// /// Type of resource at which the graph starts @@ -1272,13 +1197,10 @@ public Code StartElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Code(value); + StartElement = value is null ? null : new Code(value); OnPropertyChanged("Start"); } } @@ -1288,28 +1210,25 @@ public Hl7.Fhir.Model.ResourceType? Start /// [FhirElement("profile", Order=220)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile on base resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -1322,37 +1241,33 @@ public string Profile [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as GraphDefinition; - - if (dest == null) - { + if(other is not GraphDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Code)StartElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Code)_StartElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1364,132 +1279,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GraphDefinition; - if(otherT == null) return false; + if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "start": - StartElement = (Code)value; + StartElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1500,21 +1415,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Group.cs b/src/Hl7.Fhir.R4B/Model/Generated/Group.cs index 354fd3e80..5c3821081 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Group.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -130,13 +133,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("GroupCharacteristicKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value held by characteristic. @@ -147,13 +150,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Group includes or excludes. @@ -161,13 +164,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("exclude", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Group includes or excludes @@ -176,13 +179,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -192,28 +192,24 @@ public bool? Exclude /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -225,55 +221,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -284,10 +280,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -316,39 +312,39 @@ public partial class MemberComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Device","Medication","Substance","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Entity + public Hl7.Fhir.Model.ResourceReference? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.ResourceReference _Entity; + private Hl7.Fhir.Model.ResourceReference? _Entity; /// /// Period member belonged to the group. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// If member is no longer in group. /// [FhirElement("inactive", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// If member is no longer in group @@ -357,30 +353,23 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MemberComponent; - - if (dest == null) - { + if(other is not MemberComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)Entity.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)_Entity.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -392,48 +381,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MemberComponent; - if(otherT == null) return false; + if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.ResourceReference)value; + Entity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -444,9 +433,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); } } @@ -459,24 +448,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this group's record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this group's record is in active use @@ -485,13 +474,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -504,13 +490,13 @@ public bool? Active [Binding("GroupType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | animal | practitioner | device | medication | substance @@ -519,13 +505,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Group.GroupType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -536,13 +519,13 @@ public Hl7.Fhir.Model.Group.GroupType? Type [FhirElement("actual", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Descriptive or actual @@ -551,13 +534,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -568,41 +548,38 @@ public bool? Actual [FhirElement("code", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [Binding("GroupKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Label for Group. /// [FhirElement("name", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for Group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -612,13 +589,13 @@ public string Name /// [FhirElement("quantity", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt QuantityElement + public Hl7.Fhir.Model.UnsignedInt? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.UnsignedInt _QuantityElement; + private Hl7.Fhir.Model.UnsignedInt? _QuantityElement; /// /// Number of members @@ -627,13 +604,10 @@ public Hl7.Fhir.Model.UnsignedInt QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.UnsignedInt(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Quantity"); } } @@ -645,13 +619,13 @@ public int? Quantity [CLSCompliant(false)] [References("Organization","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingEntity + public Hl7.Fhir.Model.ResourceReference? ManagingEntity { get { return _ManagingEntity; } set { _ManagingEntity = value; OnPropertyChanged("ManagingEntity"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingEntity; + private Hl7.Fhir.Model.ResourceReference? _ManagingEntity; /// /// Include / Exclude group members by Trait. @@ -661,11 +635,11 @@ public Hl7.Fhir.Model.ResourceReference ManagingEntity [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Who or what is in group. @@ -675,34 +649,30 @@ public List Characteristic [DataMember] public List Member { - get { if(_Member==null) _Member = new List(); return _Member; } + get => _Member ?? new List(); set { _Member = value; OnPropertyChanged("Member"); } } - private List _Member; + private List? _Member; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Group; - - if (dest == null) - { + if(other is not Group dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)QuantityElement.DeepCopyInternal(); - if(ManagingEntity != null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)ManagingEntity.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Member.Any()) dest.Member = new List(Member.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)_QuantityElement.DeepCopyInternal(); + if(_ManagingEntity is not null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)_ManagingEntity.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Member is not null) dest.Member = new List(_Member.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -714,97 +684,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Group; - if(otherT == null) return false; + if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.Equals(ManagingEntity, otherT.ManagingEntity)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Member, otherT.Member)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.Equals(_ManagingEntity, otherT._ManagingEntity)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Member, otherT._Member)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "managingEntity": - value = ManagingEntity; - return ManagingEntity is not null; + value = _ManagingEntity; + return _ManagingEntity is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "member": - value = Member; - return Member?.Any() == true; + value = _Member; + return _Member?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.UnsignedInt)value; + QuantityElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "managingEntity": - ManagingEntity = (Hl7.Fhir.Model.ResourceReference)value; + ManagingEntity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "member": - Member = (List)value; + Member = (List?)value!; return this; default: return base.SetValue(key, value); @@ -815,16 +785,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (ManagingEntity is not null) yield return new KeyValuePair("managingEntity",ManagingEntity); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Member?.Any() == true) yield return new KeyValuePair("member",Member); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_ManagingEntity is not null) yield return new KeyValuePair("managingEntity",_ManagingEntity); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Member?.Any() == true) yield return new KeyValuePair("member",_Member); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs index 0bd425fd6..518ad8c10 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,13 +113,13 @@ public enum GuidanceResponseStatus /// [FhirElement("requestIdentifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier RequestIdentifier + public Hl7.Fhir.Model.Identifier? RequestIdentifier { get { return _RequestIdentifier; } set { _RequestIdentifier = value; OnPropertyChanged("RequestIdentifier"); } } - private Hl7.Fhir.Model.Identifier _RequestIdentifier; + private Hl7.Fhir.Model.Identifier? _RequestIdentifier; /// /// Business identifier. @@ -126,11 +129,11 @@ public Hl7.Fhir.Model.Identifier RequestIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// What guidance was requested. @@ -140,13 +143,13 @@ public List Identifier [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Module + public Hl7.Fhir.Model.DataType? Module { get { return _Module; } set { _Module = value; OnPropertyChanged("Module"); } } - private Hl7.Fhir.Model.DataType _Module; + private Hl7.Fhir.Model.DataType? _Module; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error. @@ -156,13 +159,13 @@ public Hl7.Fhir.Model.DataType Module [Binding("GuidanceResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error @@ -171,13 +174,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -189,13 +189,13 @@ public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter during which the response was returned. @@ -204,41 +204,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the guidance response was processed. /// [FhirElement("occurrenceDateTime", Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OccurrenceDateTimeElement + public Hl7.Fhir.Model.FhirDateTime? OccurrenceDateTimeElement { get { return _OccurrenceDateTimeElement; } set { _OccurrenceDateTimeElement = value; OnPropertyChanged("OccurrenceDateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OccurrenceDateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _OccurrenceDateTimeElement; /// /// When the guidance response was processed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OccurrenceDateTime + public string? OccurrenceDateTime { - get { return OccurrenceDateTimeElement != null ? OccurrenceDateTimeElement.Value : null; } + get => _OccurrenceDateTimeElement?.Value; set { - if (value == null) - OccurrenceDateTimeElement = null; - else - OccurrenceDateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + OccurrenceDateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("OccurrenceDateTime"); } } @@ -250,13 +247,13 @@ public string OccurrenceDateTime [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Why guidance is needed. @@ -266,11 +263,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why guidance is needed. @@ -282,11 +279,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Additional notes about the response. @@ -296,11 +293,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Messages resulting from the evaluation of the artifact or artifacts. @@ -312,11 +309,11 @@ public List Note [DataMember] public List EvaluationMessage { - get { if(_EvaluationMessage==null) _EvaluationMessage = new List(); return _EvaluationMessage; } + get => _EvaluationMessage ?? new List(); set { _EvaluationMessage = value; OnPropertyChanged("EvaluationMessage"); } } - private List _EvaluationMessage; + private List? _EvaluationMessage; /// /// The output parameters of the evaluation, if any. @@ -325,13 +322,13 @@ public List EvaluationMessage [CLSCompliant(false)] [References("Parameters")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OutputParameters + public Hl7.Fhir.Model.ResourceReference? OutputParameters { get { return _OutputParameters; } set { _OutputParameters = value; OnPropertyChanged("OutputParameters"); } } - private Hl7.Fhir.Model.ResourceReference _OutputParameters; + private Hl7.Fhir.Model.ResourceReference? _OutputParameters; /// /// Proposed actions, if any. @@ -340,13 +337,13 @@ public Hl7.Fhir.Model.ResourceReference OutputParameters [CLSCompliant(false)] [References("CarePlan","RequestGroup")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Result + public Hl7.Fhir.Model.ResourceReference? Result { get { return _Result; } set { _Result = value; OnPropertyChanged("Result"); } } - private Hl7.Fhir.Model.ResourceReference _Result; + private Hl7.Fhir.Model.ResourceReference? _Result; /// /// Additional required data. @@ -356,39 +353,35 @@ public Hl7.Fhir.Model.ResourceReference Result [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as GuidanceResponse; - - if (dest == null) - { + if(other is not GuidanceResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequestIdentifier != null) dest.RequestIdentifier = (Hl7.Fhir.Model.Identifier)RequestIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Module != null) dest.Module = (Hl7.Fhir.Model.DataType)Module.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(OccurrenceDateTimeElement != null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)OccurrenceDateTimeElement.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(EvaluationMessage.Any()) dest.EvaluationMessage = new List(EvaluationMessage.DeepCopyInternal()); - if(OutputParameters != null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)OutputParameters.DeepCopyInternal(); - if(Result != null) dest.Result = (Hl7.Fhir.Model.ResourceReference)Result.DeepCopyInternal(); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); + if(_RequestIdentifier is not null) dest.RequestIdentifier = (Hl7.Fhir.Model.Identifier)_RequestIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Module is not null) dest.Module = (Hl7.Fhir.Model.DataType)_Module.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_OccurrenceDateTimeElement is not null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_OccurrenceDateTimeElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_EvaluationMessage is not null) dest.EvaluationMessage = new List(_EvaluationMessage.DeepCopyInternal()); + if(_OutputParameters is not null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)_OutputParameters.DeepCopyInternal(); + if(_Result is not null) dest.Result = (Hl7.Fhir.Model.ResourceReference)_Result.DeepCopyInternal(); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -400,132 +393,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuidanceResponse; - if(otherT == null) return false; + if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequestIdentifier, otherT.RequestIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Module, otherT.Module)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(OccurrenceDateTimeElement, otherT.OccurrenceDateTimeElement)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(EvaluationMessage, otherT.EvaluationMessage)) return false; - if(!comparer.Equals(OutputParameters, otherT.OutputParameters)) return false; - if(!comparer.Equals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Module, otherT._Module)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_OccurrenceDateTimeElement, otherT._OccurrenceDateTimeElement)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_EvaluationMessage, otherT._EvaluationMessage)) return false; + if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; + if(!comparer.Equals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "requestIdentifier": - value = RequestIdentifier; - return RequestIdentifier is not null; + value = _RequestIdentifier; + return _RequestIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "module": - value = Module; - return Module is not null; + value = _Module; + return _Module is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrenceDateTime": - value = OccurrenceDateTimeElement; - return OccurrenceDateTimeElement is not null; + value = _OccurrenceDateTimeElement; + return _OccurrenceDateTimeElement is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "evaluationMessage": - value = EvaluationMessage; - return EvaluationMessage?.Any() == true; + value = _EvaluationMessage; + return _EvaluationMessage?.Any() == true; case "outputParameters": - value = OutputParameters; - return OutputParameters is not null; + value = _OutputParameters; + return _OutputParameters is not null; case "result": - value = Result; - return Result is not null; + value = _Result; + return _Result is not null; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "requestIdentifier": - RequestIdentifier = (Hl7.Fhir.Model.Identifier)value; + RequestIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "module": - Module = (Hl7.Fhir.Model.DataType)value; + Module = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrenceDateTime": - OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "evaluationMessage": - EvaluationMessage = (List)value; + EvaluationMessage = (List?)value!; return this; case "outputParameters": - OutputParameters = (Hl7.Fhir.Model.ResourceReference)value; + OutputParameters = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "result": - Result = (Hl7.Fhir.Model.ResourceReference)value; + Result = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -536,21 +529,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequestIdentifier is not null) yield return new KeyValuePair("requestIdentifier",RequestIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Module is not null) yield return new KeyValuePair("module",Module); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",OccurrenceDateTimeElement); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (EvaluationMessage?.Any() == true) yield return new KeyValuePair("evaluationMessage",EvaluationMessage); - if (OutputParameters is not null) yield return new KeyValuePair("outputParameters",OutputParameters); - if (Result is not null) yield return new KeyValuePair("result",Result); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); + if (_RequestIdentifier is not null) yield return new KeyValuePair("requestIdentifier",_RequestIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Module is not null) yield return new KeyValuePair("module",_Module); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",_OccurrenceDateTimeElement); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_EvaluationMessage?.Any() == true) yield return new KeyValuePair("evaluationMessage",_EvaluationMessage); + if (_OutputParameters is not null) yield return new KeyValuePair("outputParameters",_OutputParameters); + if (_Result is not null) yield return new KeyValuePair("result",_Result); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs index 619162382..9ed513eca 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,57 +81,50 @@ public partial class EligibilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("ServiceEligibility")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Describes the eligibility conditions for the service. /// [FhirElement("comment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Describes the eligibility conditions for the service /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EligibilityComponent; - - if (dest == null) - { + if(other is not EligibilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -140,41 +136,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EligibilityComponent; - if(otherT == null) return false; + if(other is not EligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -185,8 +181,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -218,24 +214,24 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -247,13 +243,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// Always available? e.g. 24 hour service @@ -262,13 +258,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -278,28 +271,25 @@ public bool? AllDay /// [FhirElement("availableStartTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time AvailableStartTimeElement + public Hl7.Fhir.Model.Time? AvailableStartTimeElement { get { return _AvailableStartTimeElement; } set { _AvailableStartTimeElement = value; OnPropertyChanged("AvailableStartTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableStartTimeElement; + private Hl7.Fhir.Model.Time? _AvailableStartTimeElement; /// /// Opening time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableStartTime + public string? AvailableStartTime { - get { return AvailableStartTimeElement != null ? AvailableStartTimeElement.Value : null; } + get => _AvailableStartTimeElement?.Value; set { - if (value == null) - AvailableStartTimeElement = null; - else - AvailableStartTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableStartTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableStartTime"); } } @@ -309,46 +299,39 @@ public string AvailableStartTime /// [FhirElement("availableEndTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time AvailableEndTimeElement + public Hl7.Fhir.Model.Time? AvailableEndTimeElement { get { return _AvailableEndTimeElement; } set { _AvailableEndTimeElement = value; OnPropertyChanged("AvailableEndTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableEndTimeElement; + private Hl7.Fhir.Model.Time? _AvailableEndTimeElement; /// /// Closing time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableEndTime + public string? AvailableEndTime { - get { return AvailableEndTimeElement != null ? AvailableEndTimeElement.Value : null; } + get => _AvailableEndTimeElement?.Value; set { - if (value == null) - AvailableEndTimeElement = null; - else - AvailableEndTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableEndTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableEndTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AvailableTimeComponent; - - if (dest == null) - { + if(other is not AvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(AvailableStartTimeElement != null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)AvailableStartTimeElement.DeepCopyInternal(); - if(AvailableEndTimeElement != null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)AvailableEndTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_AvailableStartTimeElement is not null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)_AvailableStartTimeElement.DeepCopyInternal(); + if(_AvailableEndTimeElement is not null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)_AvailableEndTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -360,55 +343,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AvailableTimeComponent; - if(otherT == null) return false; + if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(AvailableStartTimeElement, otherT.AvailableStartTimeElement)) return false; - if(!comparer.Equals(AvailableEndTimeElement, otherT.AvailableEndTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; + if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "availableStartTime": - value = AvailableStartTimeElement; - return AvailableStartTimeElement is not null; + value = _AvailableStartTimeElement; + return _AvailableStartTimeElement is not null; case "availableEndTime": - value = AvailableEndTimeElement; - return AvailableEndTimeElement is not null; + value = _AvailableEndTimeElement; + return _AvailableEndTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableStartTime": - AvailableStartTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableStartTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "availableEndTime": - AvailableEndTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableEndTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -419,10 +402,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",AvailableStartTimeElement); - if (AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",AvailableEndTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",_AvailableStartTimeElement); + if (_AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",_AvailableEndTimeElement); } } @@ -449,28 +432,25 @@ public partial class NotAvailableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason presented to the user explaining why time not available /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -480,26 +460,22 @@ public string Description /// [FhirElement("during", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period During + public Hl7.Fhir.Model.Period? During { get { return _During; } set { _During = value; OnPropertyChanged("During"); } } - private Hl7.Fhir.Model.Period _During; + private Hl7.Fhir.Model.Period? _During; protected internal override void CopyToInternal(Base other) { - var dest = other as NotAvailableComponent; - - if (dest == null) - { + if(other is not NotAvailableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(During != null) dest.During = (Hl7.Fhir.Model.Period)During.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_During is not null) dest.During = (Hl7.Fhir.Model.Period)_During.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -511,41 +487,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotAvailableComponent; - if(otherT == null) return false; + if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(During, otherT.During)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_During, otherT._During)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "during": - value = During; - return During is not null; + value = _During; + return _During is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "during": - During = (Hl7.Fhir.Model.Period)value; + During = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -556,8 +532,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (During is not null) yield return new KeyValuePair("during",During); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_During is not null) yield return new KeyValuePair("during",_During); } } @@ -570,24 +546,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this HealthcareService record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this HealthcareService record is in active use @@ -596,13 +572,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -614,13 +587,13 @@ public bool? Active [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProvidedBy + public Hl7.Fhir.Model.ResourceReference? ProvidedBy { get { return _ProvidedBy; } set { _ProvidedBy = value; OnPropertyChanged("ProvidedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ProvidedBy; + private Hl7.Fhir.Model.ResourceReference? _ProvidedBy; /// /// Broad category of service being performed or delivered. @@ -631,11 +604,11 @@ public Hl7.Fhir.Model.ResourceReference ProvidedBy [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of service that may be delivered or performed. @@ -646,11 +619,11 @@ public List Category [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specialties handled by the HealthcareService. @@ -661,11 +634,11 @@ public List Type [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Location(s) where service may be provided. @@ -677,39 +650,36 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Description of service as presented to a consumer while searching. /// [FhirElement("name", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Description of service as presented to a consumer while searching /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -719,28 +689,25 @@ public string Name /// [FhirElement("comment", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional description and/or any specific issues not covered elsewhere /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -750,28 +717,25 @@ public string Comment /// [FhirElement("extraDetails", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown ExtraDetailsElement + public Hl7.Fhir.Model.Markdown? ExtraDetailsElement { get { return _ExtraDetailsElement; } set { _ExtraDetailsElement = value; OnPropertyChanged("ExtraDetailsElement"); } } - private Hl7.Fhir.Model.Markdown _ExtraDetailsElement; + private Hl7.Fhir.Model.Markdown? _ExtraDetailsElement; /// /// Extra details about the service that can't be placed in the other fields /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExtraDetails + public string? ExtraDetails { - get { return ExtraDetailsElement != null ? ExtraDetailsElement.Value : null; } + get => _ExtraDetailsElement?.Value; set { - if (value == null) - ExtraDetailsElement = null; - else - ExtraDetailsElement = new Hl7.Fhir.Model.Markdown(value); + ExtraDetailsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ExtraDetails"); } } @@ -781,13 +745,13 @@ public string ExtraDetails /// [FhirElement("photo", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Attachment Photo + public Hl7.Fhir.Model.Attachment? Photo { get { return _Photo; } set { _Photo = value; OnPropertyChanged("Photo"); } } - private Hl7.Fhir.Model.Attachment _Photo; + private Hl7.Fhir.Model.Attachment? _Photo; /// /// Contacts related to the healthcare service. @@ -797,11 +761,11 @@ public Hl7.Fhir.Model.Attachment Photo [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Location(s) service is intended for/available to. @@ -813,11 +777,11 @@ public List Telecom [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// Conditions under which service is available/offered. @@ -828,11 +792,11 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get { if(_ServiceProvisionCode==null) _ServiceProvisionCode = new List(); return _ServiceProvisionCode; } + get => _ServiceProvisionCode ?? new List(); set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } - private List _ServiceProvisionCode; + private List? _ServiceProvisionCode; /// /// Specific eligibility requirements required to use the service. @@ -842,11 +806,11 @@ public List ServiceProvisionCode [DataMember] public List Eligibility { - get { if(_Eligibility==null) _Eligibility = new List(); return _Eligibility; } + get => _Eligibility ?? new List(); set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } - private List _Eligibility; + private List? _Eligibility; /// /// Programs that this service is applicable to. @@ -857,11 +821,11 @@ public List Eligibility [DataMember] public List Program { - get { if(_Program==null) _Program = new List(); return _Program; } + get => _Program ?? new List(); set { _Program = value; OnPropertyChanged("Program"); } } - private List _Program; + private List? _Program; /// /// Collection of characteristics (attributes). @@ -872,11 +836,11 @@ public List Program [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// The language that this service is offered in. @@ -887,11 +851,11 @@ public List Characteristic [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Ways that the service accepts referrals. @@ -902,24 +866,24 @@ public List Communication [DataMember] public List ReferralMethod { - get { if(_ReferralMethod==null) _ReferralMethod = new List(); return _ReferralMethod; } + get => _ReferralMethod ?? new List(); set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } - private List _ReferralMethod; + private List? _ReferralMethod; /// /// If an appointment is required for access to this service. /// [FhirElement("appointmentRequired", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement + public Hl7.Fhir.Model.FhirBoolean? AppointmentRequiredElement { get { return _AppointmentRequiredElement; } set { _AppointmentRequiredElement = value; OnPropertyChanged("AppointmentRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AppointmentRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _AppointmentRequiredElement; /// /// If an appointment is required for access to this service @@ -928,13 +892,10 @@ public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement [IgnoreDataMember] public bool? AppointmentRequired { - get { return AppointmentRequiredElement != null ? AppointmentRequiredElement.Value : null; } + get => _AppointmentRequiredElement?.Value; set { - if (value == null) - AppointmentRequiredElement = null; - else - AppointmentRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + AppointmentRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AppointmentRequired"); } } @@ -947,11 +908,11 @@ public bool? AppointmentRequired [DataMember] public List AvailableTime { - get { if(_AvailableTime==null) _AvailableTime = new List(); return _AvailableTime; } + get => _AvailableTime ?? new List(); set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } - private List _AvailableTime; + private List? _AvailableTime; /// /// Not available during this time due to provided reason. @@ -961,39 +922,36 @@ public List AvailableTi [DataMember] public List NotAvailable { - get { if(_NotAvailable==null) _NotAvailable = new List(); return _NotAvailable; } + get => _NotAvailable ?? new List(); set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } - private List _NotAvailable; + private List? _NotAvailable; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=310)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -1008,48 +966,44 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as HealthcareService; - - if (dest == null) - { + if(other is not HealthcareService dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ProvidedBy != null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)ProvidedBy.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(ExtraDetailsElement != null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)ExtraDetailsElement.DeepCopyInternal(); - if(Photo != null) dest.Photo = (Hl7.Fhir.Model.Attachment)Photo.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(ServiceProvisionCode.Any()) dest.ServiceProvisionCode = new List(ServiceProvisionCode.DeepCopyInternal()); - if(Eligibility.Any()) dest.Eligibility = new List(Eligibility.DeepCopyInternal()); - if(Program.Any()) dest.Program = new List(Program.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(ReferralMethod.Any()) dest.ReferralMethod = new List(ReferralMethod.DeepCopyInternal()); - if(AppointmentRequiredElement != null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)AppointmentRequiredElement.DeepCopyInternal(); - if(AvailableTime.Any()) dest.AvailableTime = new List(AvailableTime.DeepCopyInternal()); - if(NotAvailable.Any()) dest.NotAvailable = new List(NotAvailable.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ProvidedBy is not null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)_ProvidedBy.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_ExtraDetailsElement is not null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)_ExtraDetailsElement.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = (Hl7.Fhir.Model.Attachment)_Photo.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_ServiceProvisionCode is not null) dest.ServiceProvisionCode = new List(_ServiceProvisionCode.DeepCopyInternal()); + if(_Eligibility is not null) dest.Eligibility = new List(_Eligibility.DeepCopyInternal()); + if(_Program is not null) dest.Program = new List(_Program.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_ReferralMethod is not null) dest.ReferralMethod = new List(_ReferralMethod.DeepCopyInternal()); + if(_AppointmentRequiredElement is not null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_AppointmentRequiredElement.DeepCopyInternal(); + if(_AvailableTime is not null) dest.AvailableTime = new List(_AvailableTime.DeepCopyInternal()); + if(_NotAvailable is not null) dest.NotAvailable = new List(_NotAvailable.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1061,195 +1015,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HealthcareService; - if(otherT == null) return false; + if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(ProvidedBy, otherT.ProvidedBy)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(ExtraDetailsElement, otherT.ExtraDetailsElement)) return false; - if(!comparer.Equals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(ServiceProvisionCode, otherT.ServiceProvisionCode)) return false; - if(!comparer.ListEquals(Eligibility, otherT.Eligibility)) return false; - if(!comparer.ListEquals(Program, otherT.Program)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(ReferralMethod, otherT.ReferralMethod)) return false; - if(!comparer.Equals(AppointmentRequiredElement, otherT.AppointmentRequiredElement)) return false; - if(!comparer.ListEquals(AvailableTime, otherT.AvailableTime)) return false; - if(!comparer.ListEquals(NotAvailable, otherT.NotAvailable)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_ExtraDetailsElement, otherT._ExtraDetailsElement)) return false; + if(!comparer.Equals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_ServiceProvisionCode, otherT._ServiceProvisionCode)) return false; + if(!comparer.ListEquals(_Eligibility, otherT._Eligibility)) return false; + if(!comparer.ListEquals(_Program, otherT._Program)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_ReferralMethod, otherT._ReferralMethod)) return false; + if(!comparer.Equals(_AppointmentRequiredElement, otherT._AppointmentRequiredElement)) return false; + if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "providedBy": - value = ProvidedBy; - return ProvidedBy is not null; + value = _ProvidedBy; + return _ProvidedBy is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "extraDetails": - value = ExtraDetailsElement; - return ExtraDetailsElement is not null; + value = _ExtraDetailsElement; + return _ExtraDetailsElement is not null; case "photo": - value = Photo; - return Photo is not null; + value = _Photo; + return _Photo is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "serviceProvisionCode": - value = ServiceProvisionCode; - return ServiceProvisionCode?.Any() == true; + value = _ServiceProvisionCode; + return _ServiceProvisionCode?.Any() == true; case "eligibility": - value = Eligibility; - return Eligibility?.Any() == true; + value = _Eligibility; + return _Eligibility?.Any() == true; case "program": - value = Program; - return Program?.Any() == true; + value = _Program; + return _Program?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "referralMethod": - value = ReferralMethod; - return ReferralMethod?.Any() == true; + value = _ReferralMethod; + return _ReferralMethod?.Any() == true; case "appointmentRequired": - value = AppointmentRequiredElement; - return AppointmentRequiredElement is not null; + value = _AppointmentRequiredElement; + return _AppointmentRequiredElement is not null; case "availableTime": - value = AvailableTime; - return AvailableTime?.Any() == true; + value = _AvailableTime; + return _AvailableTime?.Any() == true; case "notAvailable": - value = NotAvailable; - return NotAvailable?.Any() == true; + value = _NotAvailable; + return _NotAvailable?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "providedBy": - ProvidedBy = (Hl7.Fhir.Model.ResourceReference)value; + ProvidedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "extraDetails": - ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)value; + ExtraDetailsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "photo": - Photo = (Hl7.Fhir.Model.Attachment)value; + Photo = (Hl7.Fhir.Model.Attachment?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "serviceProvisionCode": - ServiceProvisionCode = (List)value; + ServiceProvisionCode = (List?)value!; return this; case "eligibility": - Eligibility = (List)value; + Eligibility = (List?)value!; return this; case "program": - Program = (List)value; + Program = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "referralMethod": - ReferralMethod = (List)value; + ReferralMethod = (List?)value!; return this; case "appointmentRequired": - AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableTime": - AvailableTime = (List)value; + AvailableTime = (List?)value!; return this; case "notAvailable": - NotAvailable = (List)value; + NotAvailable = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1260,30 +1214,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ProvidedBy is not null) yield return new KeyValuePair("providedBy",ProvidedBy); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",ExtraDetailsElement); - if (Photo is not null) yield return new KeyValuePair("photo",Photo); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",ServiceProvisionCode); - if (Eligibility?.Any() == true) yield return new KeyValuePair("eligibility",Eligibility); - if (Program?.Any() == true) yield return new KeyValuePair("program",Program); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",ReferralMethod); - if (AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",AppointmentRequiredElement); - if (AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",AvailableTime); - if (NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",NotAvailable); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ProvidedBy is not null) yield return new KeyValuePair("providedBy",_ProvidedBy); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",_ExtraDetailsElement); + if (_Photo is not null) yield return new KeyValuePair("photo",_Photo); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",_ServiceProvisionCode); + if (_Eligibility?.Any() == true) yield return new KeyValuePair("eligibility",_Eligibility); + if (_Program?.Any() == true) yield return new KeyValuePair("program",_Program); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",_ReferralMethod); + if (_AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",_AppointmentRequiredElement); + if (_AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",_AvailableTime); + if (_NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",_NotAvailable); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs index db075847e..71dd75afe 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -119,13 +122,13 @@ public enum NameUse [DeclaredType(Type = typeof(Code))] [Binding("NameUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// usual | official | temp | nickname | anonymous | old | maiden @@ -134,13 +137,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.HumanName.NameUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -150,28 +150,25 @@ public Hl7.Fhir.Model.HumanName.NameUse? Use /// [FhirElement("text", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the full name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -181,28 +178,25 @@ public string Text /// [FhirElement("family", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString FamilyElement + public Hl7.Fhir.Model.FhirString? FamilyElement { get { return _FamilyElement; } set { _FamilyElement = value; OnPropertyChanged("FamilyElement"); } } - private Hl7.Fhir.Model.FhirString _FamilyElement; + private Hl7.Fhir.Model.FhirString? _FamilyElement; /// /// Family name (often called 'Surname') /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Family + public string? Family { - get { return FamilyElement != null ? FamilyElement.Value : null; } + get => _FamilyElement?.Value; set { - if (value == null) - FamilyElement = null; - else - FamilyElement = new Hl7.Fhir.Model.FhirString(value); + FamilyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Family"); } } @@ -215,24 +209,24 @@ public string Family [DataMember] public List GivenElement { - get { if(_GivenElement==null) _GivenElement = new List(); return _GivenElement; } + get => _GivenElement ?? new List(); set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } - private List _GivenElement; + private List? _GivenElement; /// /// Given names (not always 'first'). Includes middle names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Given + public IEnumerable? Given { - get { return GivenElement != null ? GivenElement.Select(elem => elem.Value) : null; } + get => _GivenElement?.Select(elem => elem.Value); set { if (value == null) - GivenElement = null; + GivenElement = null!; else GivenElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Given"); @@ -247,24 +241,24 @@ public IEnumerable Given [DataMember] public List PrefixElement { - get { if(_PrefixElement==null) _PrefixElement = new List(); return _PrefixElement; } + get => _PrefixElement ?? new List(); set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private List _PrefixElement; + private List? _PrefixElement; /// /// Parts that come before the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Prefix + public IEnumerable? Prefix { - get { return PrefixElement != null ? PrefixElement.Select(elem => elem.Value) : null; } + get => _PrefixElement?.Select(elem => elem.Value); set { if (value == null) - PrefixElement = null; + PrefixElement = null!; else PrefixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Prefix"); @@ -279,24 +273,24 @@ public IEnumerable Prefix [DataMember] public List SuffixElement { - get { if(_SuffixElement==null) _SuffixElement = new List(); return _SuffixElement; } + get => _SuffixElement ?? new List(); set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } - private List _SuffixElement; + private List? _SuffixElement; /// /// Parts that come after the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Suffix + public IEnumerable? Suffix { - get { return SuffixElement != null ? SuffixElement.Select(elem => elem.Value) : null; } + get => _SuffixElement?.Select(elem => elem.Value); set { if (value == null) - SuffixElement = null; + SuffixElement = null!; else SuffixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Suffix"); @@ -308,31 +302,27 @@ public IEnumerable Suffix /// [FhirElement("period", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as HumanName; - - if (dest == null) - { + if(other is not HumanName dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(FamilyElement != null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)FamilyElement.DeepCopyInternal(); - if(GivenElement.Any()) dest.GivenElement = new List(GivenElement.DeepCopyInternal()); - if(PrefixElement.Any()) dest.PrefixElement = new List(PrefixElement.DeepCopyInternal()); - if(SuffixElement.Any()) dest.SuffixElement = new List(SuffixElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_FamilyElement is not null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)_FamilyElement.DeepCopyInternal(); + if(_GivenElement is not null) dest.GivenElement = new List(_GivenElement.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = new List(_PrefixElement.DeepCopyInternal()); + if(_SuffixElement is not null) dest.SuffixElement = new List(_SuffixElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -344,76 +334,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HumanName; - if(otherT == null) return false; + if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(FamilyElement, otherT.FamilyElement)) return false; - if(!comparer.ListEquals(GivenElement, otherT.GivenElement)) return false; - if(!comparer.ListEquals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.ListEquals(SuffixElement, otherT.SuffixElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; + if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; + if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "family": - value = FamilyElement; - return FamilyElement is not null; + value = _FamilyElement; + return _FamilyElement is not null; case "given": - value = GivenElement; - return GivenElement?.Any() == true; + value = _GivenElement; + return _GivenElement?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement?.Any() == true; + value = _PrefixElement; + return _PrefixElement?.Any() == true; case "suffix": - value = SuffixElement; - return SuffixElement?.Any() == true; + value = _SuffixElement; + return _SuffixElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "family": - FamilyElement = (Hl7.Fhir.Model.FhirString)value; + FamilyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "given": - GivenElement = (List)value; + GivenElement = (List?)value!; return this; case "prefix": - PrefixElement = (List)value; + PrefixElement = (List?)value!; return this; case "suffix": - SuffixElement = (List)value; + SuffixElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -424,13 +414,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (FamilyElement is not null) yield return new KeyValuePair("family",FamilyElement); - if (GivenElement?.Any() == true) yield return new KeyValuePair("given",GivenElement); - if (PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",PrefixElement); - if (SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",SuffixElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_FamilyElement is not null) yield return new KeyValuePair("family",_FamilyElement); + if (_GivenElement?.Any() == true) yield return new KeyValuePair("given",_GivenElement); + if (_PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",_PrefixElement); + if (_SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",_SuffixElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs index 3182e5016..987b02460 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,28 +124,25 @@ public partial class SeriesComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id UidElement + public Hl7.Fhir.Model.Id? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Id _UidElement; + private Hl7.Fhir.Model.Id? _UidElement; /// /// DICOM Series Instance UID for the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Id(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Uid"); } } @@ -152,13 +152,13 @@ public string Uid /// [FhirElement("number", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// Numeric identifier of this series @@ -167,13 +167,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -185,41 +182,38 @@ public int? Number [Binding("ImagingModality")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Modality + public Hl7.Fhir.Model.Coding? Modality { get { return _Modality; } set { _Modality = value; OnPropertyChanged("Modality"); } } - private Hl7.Fhir.Model.Coding _Modality; + private Hl7.Fhir.Model.Coding? _Modality; /// /// A short human readable summary of the series. /// [FhirElement("description", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// A short human readable summary of the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -229,13 +223,13 @@ public string Description /// [FhirElement("numberOfInstances", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Series Related Instances @@ -244,13 +238,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -265,11 +256,11 @@ public int? NumberOfInstances [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Body part examined. @@ -277,13 +268,13 @@ public List Endpoint [FhirElement("bodySite", InSummary=true, Order=100)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.Coding BodySite + public Hl7.Fhir.Model.Coding? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.Coding _BodySite; + private Hl7.Fhir.Model.Coding? _BodySite; /// /// Body part laterality. @@ -291,13 +282,13 @@ public Hl7.Fhir.Model.Coding BodySite [FhirElement("laterality", InSummary=true, Order=110)] [Binding("Laterality")] [DataMember] - public Hl7.Fhir.Model.Coding Laterality + public Hl7.Fhir.Model.Coding? Laterality { get { return _Laterality; } set { _Laterality = value; OnPropertyChanged("Laterality"); } } - private Hl7.Fhir.Model.Coding _Laterality; + private Hl7.Fhir.Model.Coding? _Laterality; /// /// Specimen imaged. @@ -309,39 +300,36 @@ public Hl7.Fhir.Model.Coding Laterality [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// When the series started. /// [FhirElement("started", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the series started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -354,11 +342,11 @@ public string Started [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// A single SOP instance from the series. @@ -368,34 +356,30 @@ public List Performer [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; protected internal override void CopyToInternal(Base other) { - var dest = other as SeriesComponent; - - if (dest == null) - { + if(other is not SeriesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Id)UidElement.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(Modality != null) dest.Modality = (Hl7.Fhir.Model.Coding)Modality.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.Coding)BodySite.DeepCopyInternal(); - if(Laterality != null) dest.Laterality = (Hl7.Fhir.Model.Coding)Laterality.DeepCopyInternal(); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Id)_UidElement.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = (Hl7.Fhir.Model.Coding)_Modality.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.Coding)_BodySite.DeepCopyInternal(); + if(_Laterality is not null) dest.Laterality = (Hl7.Fhir.Model.Coding)_Laterality.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -407,111 +391,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SeriesComponent; - if(otherT == null) return false; + if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Laterality, otherT.Laterality)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Laterality, otherT._Laterality)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "modality": - value = Modality; - return Modality is not null; + value = _Modality; + return _Modality is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "laterality": - value = Laterality; - return Laterality is not null; + value = _Laterality; + return _Laterality is not null; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Id)value; + UidElement = (Hl7.Fhir.Model.Id?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "modality": - Modality = (Hl7.Fhir.Model.Coding)value; + Modality = (Hl7.Fhir.Model.Coding?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.Coding)value; + BodySite = (Hl7.Fhir.Model.Coding?)value; return this; case "laterality": - Laterality = (Hl7.Fhir.Model.Coding)value; + Laterality = (Hl7.Fhir.Model.Coding?)value; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -522,18 +506,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Modality is not null) yield return new KeyValuePair("modality",Modality); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Laterality is not null) yield return new KeyValuePair("laterality",Laterality); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Modality is not null) yield return new KeyValuePair("modality",_Modality); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Laterality is not null) yield return new KeyValuePair("laterality",_Laterality); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); } } @@ -561,13 +545,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("EventPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the series. @@ -577,26 +561,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -608,41 +588,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -653,8 +633,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -681,28 +661,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id UidElement + public Hl7.Fhir.Model.Id? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Id _UidElement; + private Hl7.Fhir.Model.Id? _UidElement; /// /// DICOM SOP Instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Id(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Uid"); } } @@ -714,26 +691,26 @@ public string Uid [Binding("sopClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding SopClass + public Hl7.Fhir.Model.Coding? SopClass { get { return _SopClass; } set { _SopClass = value; OnPropertyChanged("SopClass"); } } - private Hl7.Fhir.Model.Coding _SopClass; + private Hl7.Fhir.Model.Coding? _SopClass; /// /// The number of this instance in the series. /// [FhirElement("number", Order=60)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// The number of this instance in the series @@ -742,13 +719,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -758,46 +732,39 @@ public int? Number /// [FhirElement("title", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Description of instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Id)UidElement.DeepCopyInternal(); - if(SopClass != null) dest.SopClass = (Hl7.Fhir.Model.Coding)SopClass.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Id)_UidElement.DeepCopyInternal(); + if(_SopClass is not null) dest.SopClass = (Hl7.Fhir.Model.Coding)_SopClass.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -809,55 +776,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(SopClass, otherT.SopClass)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "sopClass": - value = SopClass; - return SopClass is not null; + value = _SopClass; + return _SopClass is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Id)value; + UidElement = (Hl7.Fhir.Model.Id?)value; return this; case "sopClass": - SopClass = (Hl7.Fhir.Model.Coding)value; + SopClass = (Hl7.Fhir.Model.Coding?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -868,10 +835,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (SopClass is not null) yield return new KeyValuePair("sopClass",SopClass); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_SopClass is not null) yield return new KeyValuePair("sopClass",_SopClass); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); } } @@ -884,11 +851,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// registered | available | cancelled | entered-in-error | unknown. @@ -898,13 +865,13 @@ public List Identifier [Binding("ImagingStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | available | cancelled | entered-in-error | unknown @@ -913,13 +880,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -933,11 +897,11 @@ public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status [DataMember] public List Modality { - get { if(_Modality==null) _Modality = new List(); return _Modality; } + get => _Modality ?? new List(); set { _Modality = value; OnPropertyChanged("Modality"); } } - private List _Modality; + private List? _Modality; /// /// Who or what is the subject of the study. @@ -947,13 +911,13 @@ public List Modality [References("Patient","Device","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter with which this imaging study is associated. @@ -962,41 +926,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the study was started. /// [FhirElement("started", InSummary=true, Order=140, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the study was started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -1011,11 +972,11 @@ public string Started [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Referring physician. @@ -1024,13 +985,13 @@ public List BasedOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referrer + public Hl7.Fhir.Model.ResourceReference? Referrer { get { return _Referrer; } set { _Referrer = value; OnPropertyChanged("Referrer"); } } - private Hl7.Fhir.Model.ResourceReference _Referrer; + private Hl7.Fhir.Model.ResourceReference? _Referrer; /// /// Who interpreted images. @@ -1042,11 +1003,11 @@ public Hl7.Fhir.Model.ResourceReference Referrer [DataMember] public List Interpreter { - get { if(_Interpreter==null) _Interpreter = new List(); return _Interpreter; } + get => _Interpreter ?? new List(); set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } - private List _Interpreter; + private List? _Interpreter; /// /// Study access endpoint. @@ -1058,24 +1019,24 @@ public List Interpreter [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Number of Study Related Series. /// [FhirElement("numberOfSeries", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfSeriesElement { get { return _NumberOfSeriesElement; } set { _NumberOfSeriesElement = value; OnPropertyChanged("NumberOfSeriesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfSeriesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfSeriesElement; /// /// Number of Study Related Series @@ -1084,13 +1045,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement [IgnoreDataMember] public int? NumberOfSeries { - get { return NumberOfSeriesElement != null ? NumberOfSeriesElement.Value : null; } + get => _NumberOfSeriesElement?.Value; set { - if (value == null) - NumberOfSeriesElement = null; - else - NumberOfSeriesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfSeriesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfSeries"); } } @@ -1100,13 +1058,13 @@ public int? NumberOfSeries /// [FhirElement("numberOfInstances", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Study Related Instances @@ -1115,13 +1073,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -1133,13 +1088,13 @@ public int? NumberOfInstances [CLSCompliant(false)] [References("Procedure")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProcedureReference + public Hl7.Fhir.Model.ResourceReference? ProcedureReference { get { return _ProcedureReference; } set { _ProcedureReference = value; OnPropertyChanged("ProcedureReference"); } } - private Hl7.Fhir.Model.ResourceReference _ProcedureReference; + private Hl7.Fhir.Model.ResourceReference? _ProcedureReference; /// /// The performed procedure code. @@ -1150,11 +1105,11 @@ public Hl7.Fhir.Model.ResourceReference ProcedureReference [DataMember] public List ProcedureCode { - get { if(_ProcedureCode==null) _ProcedureCode = new List(); return _ProcedureCode; } + get => _ProcedureCode ?? new List(); set { _ProcedureCode = value; OnPropertyChanged("ProcedureCode"); } } - private List _ProcedureCode; + private List? _ProcedureCode; /// /// Where ImagingStudy occurred. @@ -1163,13 +1118,13 @@ public List ProcedureCode [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Why the study was requested. @@ -1180,11 +1135,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why was study performed. @@ -1196,11 +1151,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// User-defined comments. @@ -1210,39 +1165,36 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Institution-generated description. /// [FhirElement("description", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Institution-generated description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1255,44 +1207,40 @@ public string Description [DataMember] public List Series { - get { if(_Series==null) _Series = new List(); return _Series; } + get => _Series ?? new List(); set { _Series = value; OnPropertyChanged("Series"); } } - private List _Series; + private List? _Series; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImagingStudy; - - if (dest == null) - { + if(other is not ImagingStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Modality.Any()) dest.Modality = new List(Modality.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Referrer != null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)Referrer.DeepCopyInternal(); - if(Interpreter.Any()) dest.Interpreter = new List(Interpreter.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(NumberOfSeriesElement != null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfSeriesElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(ProcedureReference != null) dest.ProcedureReference = (Hl7.Fhir.Model.ResourceReference)ProcedureReference.DeepCopyInternal(); - if(ProcedureCode.Any()) dest.ProcedureCode = new List(ProcedureCode.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Series.Any()) dest.Series = new List(Series.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = new List(_Modality.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Referrer is not null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)_Referrer.DeepCopyInternal(); + if(_Interpreter is not null) dest.Interpreter = new List(_Interpreter.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_NumberOfSeriesElement is not null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfSeriesElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_ProcedureReference is not null) dest.ProcedureReference = (Hl7.Fhir.Model.ResourceReference)_ProcedureReference.DeepCopyInternal(); + if(_ProcedureCode is not null) dest.ProcedureCode = new List(_ProcedureCode.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Series is not null) dest.Series = new List(_Series.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1304,167 +1252,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImagingStudy; - if(otherT == null) return false; + if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Referrer, otherT.Referrer)) return false; - if(!comparer.ListEquals(Interpreter, otherT.Interpreter)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(NumberOfSeriesElement, otherT.NumberOfSeriesElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.Equals(ProcedureReference, otherT.ProcedureReference)) return false; - if(!comparer.ListEquals(ProcedureCode, otherT.ProcedureCode)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Series, otherT.Series)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Referrer, otherT._Referrer)) return false; + if(!comparer.ListEquals(_Interpreter, otherT._Interpreter)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_NumberOfSeriesElement, otherT._NumberOfSeriesElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.Equals(_ProcedureReference, otherT._ProcedureReference)) return false; + if(!comparer.ListEquals(_ProcedureCode, otherT._ProcedureCode)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Series, otherT._Series)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "modality": - value = Modality; - return Modality?.Any() == true; + value = _Modality; + return _Modality?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "referrer": - value = Referrer; - return Referrer is not null; + value = _Referrer; + return _Referrer is not null; case "interpreter": - value = Interpreter; - return Interpreter?.Any() == true; + value = _Interpreter; + return _Interpreter?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "numberOfSeries": - value = NumberOfSeriesElement; - return NumberOfSeriesElement is not null; + value = _NumberOfSeriesElement; + return _NumberOfSeriesElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "procedureReference": - value = ProcedureReference; - return ProcedureReference is not null; + value = _ProcedureReference; + return _ProcedureReference is not null; case "procedureCode": - value = ProcedureCode; - return ProcedureCode?.Any() == true; + value = _ProcedureCode; + return _ProcedureCode?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = Series; - return Series?.Any() == true; + value = _Series; + return _Series?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "modality": - Modality = (List)value; + Modality = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "referrer": - Referrer = (Hl7.Fhir.Model.ResourceReference)value; + Referrer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "interpreter": - Interpreter = (List)value; + Interpreter = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "numberOfSeries": - NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "procedureReference": - ProcedureReference = (Hl7.Fhir.Model.ResourceReference)value; + ProcedureReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "procedureCode": - ProcedureCode = (List)value; + ProcedureCode = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - Series = (List)value; + Series = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1475,26 +1423,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Modality?.Any() == true) yield return new KeyValuePair("modality",Modality); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Referrer is not null) yield return new KeyValuePair("referrer",Referrer); - if (Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",Interpreter); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",NumberOfSeriesElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (ProcedureReference is not null) yield return new KeyValuePair("procedureReference",ProcedureReference); - if (ProcedureCode?.Any() == true) yield return new KeyValuePair("procedureCode",ProcedureCode); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Series?.Any() == true) yield return new KeyValuePair("series",Series); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Modality?.Any() == true) yield return new KeyValuePair("modality",_Modality); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Referrer is not null) yield return new KeyValuePair("referrer",_Referrer); + if (_Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",_Interpreter); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",_NumberOfSeriesElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_ProcedureReference is not null) yield return new KeyValuePair("procedureReference",_ProcedureReference); + if (_ProcedureCode?.Any() == true) yield return new KeyValuePair("procedureCode",_ProcedureCode); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Series?.Any() == true) yield return new KeyValuePair("series",_Series); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs index 73142b135..1a546a873 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,13 +112,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("ImmunizationFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual or organization who was performing. @@ -125,26 +128,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -156,41 +155,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -201,8 +200,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -228,28 +227,25 @@ public partial class EducationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("documentType", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentTypeElement + public Hl7.Fhir.Model.FhirString? DocumentTypeElement { get { return _DocumentTypeElement; } set { _DocumentTypeElement = value; OnPropertyChanged("DocumentTypeElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentTypeElement; + private Hl7.Fhir.Model.FhirString? _DocumentTypeElement; /// /// Educational material document identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DocumentType + public string? DocumentType { - get { return DocumentTypeElement != null ? DocumentTypeElement.Value : null; } + get => _DocumentTypeElement?.Value; set { - if (value == null) - DocumentTypeElement = null; - else - DocumentTypeElement = new Hl7.Fhir.Model.FhirString(value); + DocumentTypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DocumentType"); } } @@ -259,28 +255,25 @@ public string DocumentType /// [FhirElement("reference", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Educational material reference pointer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } @@ -290,28 +283,25 @@ public string Reference /// [FhirElement("publicationDate", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PublicationDateElement + public Hl7.Fhir.Model.FhirDateTime? PublicationDateElement { get { return _PublicationDateElement; } set { _PublicationDateElement = value; OnPropertyChanged("PublicationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PublicationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PublicationDateElement; /// /// Educational material publication date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDate + public string? PublicationDate { - get { return PublicationDateElement != null ? PublicationDateElement.Value : null; } + get => _PublicationDateElement?.Value; set { - if (value == null) - PublicationDateElement = null; - else - PublicationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PublicationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PublicationDate"); } } @@ -321,46 +311,39 @@ public string PublicationDate /// [FhirElement("presentationDate", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PresentationDateElement + public Hl7.Fhir.Model.FhirDateTime? PresentationDateElement { get { return _PresentationDateElement; } set { _PresentationDateElement = value; OnPropertyChanged("PresentationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PresentationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PresentationDateElement; /// /// Educational material presentation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PresentationDate + public string? PresentationDate { - get { return PresentationDateElement != null ? PresentationDateElement.Value : null; } + get => _PresentationDateElement?.Value; set { - if (value == null) - PresentationDateElement = null; - else - PresentationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PresentationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PresentationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EducationComponent; - - if (dest == null) - { + if(other is not EducationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DocumentTypeElement != null) dest.DocumentTypeElement = (Hl7.Fhir.Model.FhirString)DocumentTypeElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); - if(PublicationDateElement != null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)PublicationDateElement.DeepCopyInternal(); - if(PresentationDateElement != null) dest.PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime)PresentationDateElement.DeepCopyInternal(); + if(_DocumentTypeElement is not null) dest.DocumentTypeElement = (Hl7.Fhir.Model.FhirString)_DocumentTypeElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); + if(_PublicationDateElement is not null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)_PublicationDateElement.DeepCopyInternal(); + if(_PresentationDateElement is not null) dest.PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime)_PresentationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -372,55 +355,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EducationComponent; - if(otherT == null) return false; + if(other is not EducationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DocumentTypeElement, otherT.DocumentTypeElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.Equals(PublicationDateElement, otherT.PublicationDateElement)) return false; - if(!comparer.Equals(PresentationDateElement, otherT.PresentationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DocumentTypeElement, otherT._DocumentTypeElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; + if(!comparer.Equals(_PresentationDateElement, otherT._PresentationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "documentType": - value = DocumentTypeElement; - return DocumentTypeElement is not null; + value = _DocumentTypeElement; + return _DocumentTypeElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "publicationDate": - value = PublicationDateElement; - return PublicationDateElement is not null; + value = _PublicationDateElement; + return _PublicationDateElement is not null; case "presentationDate": - value = PresentationDateElement; - return PresentationDateElement is not null; + value = _PresentationDateElement; + return _PresentationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "documentType": - DocumentTypeElement = (Hl7.Fhir.Model.FhirString)value; + DocumentTypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "publicationDate": - PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "presentationDate": - PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PresentationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -431,10 +414,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DocumentTypeElement is not null) yield return new KeyValuePair("documentType",DocumentTypeElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",PublicationDateElement); - if (PresentationDateElement is not null) yield return new KeyValuePair("presentationDate",PresentationDateElement); + if (_DocumentTypeElement is not null) yield return new KeyValuePair("documentType",_DocumentTypeElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",_PublicationDateElement); + if (_PresentationDateElement is not null) yield return new KeyValuePair("presentationDate",_PresentationDateElement); } } @@ -461,28 +444,25 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When reaction started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -494,26 +474,26 @@ public string Date [CLSCompliant(false)] [References("Observation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Detail + public Hl7.Fhir.Model.ResourceReference? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.ResourceReference _Detail; + private Hl7.Fhir.Model.ResourceReference? _Detail; /// /// Indicates self-reported reaction. /// [FhirElement("reported", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReportedElement + public Hl7.Fhir.Model.FhirBoolean? ReportedElement { get { return _ReportedElement; } set { _ReportedElement = value; OnPropertyChanged("ReportedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReportedElement; + private Hl7.Fhir.Model.FhirBoolean? _ReportedElement; /// /// Indicates self-reported reaction @@ -522,30 +502,23 @@ public Hl7.Fhir.Model.FhirBoolean ReportedElement [IgnoreDataMember] public bool? Reported { - get { return ReportedElement != null ? ReportedElement.Value : null; } + get => _ReportedElement?.Value; set { - if (value == null) - ReportedElement = null; - else - ReportedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReportedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Reported"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.ResourceReference)Detail.DeepCopyInternal(); - if(ReportedElement != null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)ReportedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.ResourceReference)_Detail.DeepCopyInternal(); + if(_ReportedElement is not null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)_ReportedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -557,48 +530,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(ReportedElement, otherT.ReportedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "reported": - value = ReportedElement; - return ReportedElement is not null; + value = _ReportedElement; + return _ReportedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.ResourceReference)value; + Detail = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reported": - ReportedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReportedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -609,9 +582,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (ReportedElement is not null) yield return new KeyValuePair("reported",ReportedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_ReportedElement is not null) yield return new KeyValuePair("reported",_ReportedElement); } } @@ -637,28 +610,25 @@ public partial class ProtocolAppliedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("series", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccine series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -670,13 +640,13 @@ public string Series [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Vaccine preventatable disease being targetted. @@ -687,11 +657,11 @@ public Hl7.Fhir.Model.ResourceReference Authority [DataMember] public List TargetDisease { - get { if(_TargetDisease==null) _TargetDisease = new List(); return _TargetDisease; } + get => _TargetDisease ?? new List(); set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private List _TargetDisease; + private List? _TargetDisease; /// /// Dose number within series. @@ -701,13 +671,13 @@ public List TargetDisease [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType DoseNumber + public Hl7.Fhir.Model.DataType? DoseNumber { get { return _DoseNumber; } set { _DoseNumber = value; OnPropertyChanged("DoseNumber"); } } - private Hl7.Fhir.Model.DataType _DoseNumber; + private Hl7.Fhir.Model.DataType? _DoseNumber; /// /// Recommended number of doses for immunity. @@ -716,29 +686,25 @@ public Hl7.Fhir.Model.DataType DoseNumber [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType SeriesDoses + public Hl7.Fhir.Model.DataType? SeriesDoses { get { return _SeriesDoses; } set { _SeriesDoses = value; OnPropertyChanged("SeriesDoses"); } } - private Hl7.Fhir.Model.DataType _SeriesDoses; + private Hl7.Fhir.Model.DataType? _SeriesDoses; protected internal override void CopyToInternal(Base other) { - var dest = other as ProtocolAppliedComponent; - - if (dest == null) - { + if(other is not ProtocolAppliedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(TargetDisease.Any()) dest.TargetDisease = new List(TargetDisease.DeepCopyInternal()); - if(DoseNumber != null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)DoseNumber.DeepCopyInternal(); - if(SeriesDoses != null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)SeriesDoses.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = new List(_TargetDisease.DeepCopyInternal()); + if(_DoseNumber is not null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)_DoseNumber.DeepCopyInternal(); + if(_SeriesDoses is not null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)_SeriesDoses.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -750,62 +716,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProtocolAppliedComponent; - if(otherT == null) return false; + if(other is not ProtocolAppliedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(DoseNumber, otherT.DoseNumber)) return false; - if(!comparer.Equals(SeriesDoses, otherT.SeriesDoses)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; + if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease?.Any() == true; + value = _TargetDisease; + return _TargetDisease?.Any() == true; case "doseNumber": - value = DoseNumber; - return DoseNumber is not null; + value = _DoseNumber; + return _DoseNumber is not null; case "seriesDoses": - value = SeriesDoses; - return SeriesDoses is not null; + value = _SeriesDoses; + return _SeriesDoses is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "targetDisease": - TargetDisease = (List)value; + TargetDisease = (List?)value!; return this; case "doseNumber": - DoseNumber = (Hl7.Fhir.Model.DataType)value; + DoseNumber = (Hl7.Fhir.Model.DataType?)value; return this; case "seriesDoses": - SeriesDoses = (Hl7.Fhir.Model.DataType)value; + SeriesDoses = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -816,11 +782,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",TargetDisease); - if (DoseNumber is not null) yield return new KeyValuePair("doseNumber",DoseNumber); - if (SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",SeriesDoses); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_DoseNumber is not null) yield return new KeyValuePair("doseNumber",_DoseNumber); + if (_SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",_SeriesDoses); } } @@ -833,11 +799,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// completed | entered-in-error | not-done. @@ -847,13 +813,13 @@ public List Identifier [Binding("ImmunizationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | entered-in-error | not-done @@ -862,13 +828,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -879,13 +842,13 @@ public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status [FhirElement("statusReason", Order=110)] [Binding("ImmunizationStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Vaccine product administered. @@ -894,13 +857,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [Binding("VaccineCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VaccineCode + public Hl7.Fhir.Model.CodeableConcept? VaccineCode { get { return _VaccineCode; } set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private Hl7.Fhir.Model.CodeableConcept _VaccineCode; + private Hl7.Fhir.Model.CodeableConcept? _VaccineCode; /// /// Who was immunized. @@ -910,13 +873,13 @@ public Hl7.Fhir.Model.CodeableConcept VaccineCode [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter immunization was part of. @@ -925,13 +888,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Vaccine administration date. @@ -941,41 +904,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirString))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the immunization was first captured in the subject's record. /// [FhirElement("recorded", Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedElement + public Hl7.Fhir.Model.FhirDateTime? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedElement; /// /// When the immunization was first captured in the subject's record /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Recorded + public string? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Recorded"); } } @@ -985,13 +945,13 @@ public string Recorded /// [FhirElement("primarySource", InSummary=true, Order=170, FiveWs="FiveWs.source")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement + public Hl7.Fhir.Model.FhirBoolean? PrimarySourceElement { get { return _PrimarySourceElement; } set { _PrimarySourceElement = value; OnPropertyChanged("PrimarySourceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PrimarySourceElement; + private Hl7.Fhir.Model.FhirBoolean? _PrimarySourceElement; /// /// Indicates context the data was recorded in @@ -1000,13 +960,10 @@ public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement [IgnoreDataMember] public bool? PrimarySource { - get { return PrimarySourceElement != null ? PrimarySourceElement.Value : null; } + get => _PrimarySourceElement?.Value; set { - if (value == null) - PrimarySourceElement = null; - else - PrimarySourceElement = new Hl7.Fhir.Model.FhirBoolean(value); + PrimarySourceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("PrimarySource"); } } @@ -1017,13 +974,13 @@ public bool? PrimarySource [FhirElement("reportOrigin", Order=180, FiveWs="FiveWs.source")] [Binding("ImmunizationReportOrigin")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReportOrigin + public Hl7.Fhir.Model.CodeableConcept? ReportOrigin { get { return _ReportOrigin; } set { _ReportOrigin = value; OnPropertyChanged("ReportOrigin"); } } - private Hl7.Fhir.Model.CodeableConcept _ReportOrigin; + private Hl7.Fhir.Model.CodeableConcept? _ReportOrigin; /// /// Where immunization occurred. @@ -1032,13 +989,13 @@ public Hl7.Fhir.Model.CodeableConcept ReportOrigin [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Vaccine manufacturer. @@ -1047,41 +1004,38 @@ public Hl7.Fhir.Model.ResourceReference Location [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// Vaccine lot number. /// [FhirElement("lotNumber", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Vaccine lot number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -1091,28 +1045,25 @@ public string LotNumber /// [FhirElement("expirationDate", Order=220)] [DataMember] - public Hl7.Fhir.Model.Date ExpirationDateElement + public Hl7.Fhir.Model.Date? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.Date _ExpirationDateElement; + private Hl7.Fhir.Model.Date? _ExpirationDateElement; /// /// Vaccine expiration date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.Date(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ExpirationDate"); } } @@ -1123,13 +1074,13 @@ public string ExpirationDate [FhirElement("site", Order=230)] [Binding("ImmunizationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How vaccine entered body. @@ -1137,26 +1088,26 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=240)] [Binding("ImmunizationRoute")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Amount of vaccine administered. /// [FhirElement("doseQuantity", Order=250)] [DataMember] - public Hl7.Fhir.Model.Quantity DoseQuantity + public Hl7.Fhir.Model.Quantity? DoseQuantity { get { return _DoseQuantity; } set { _DoseQuantity = value; OnPropertyChanged("DoseQuantity"); } } - private Hl7.Fhir.Model.Quantity _DoseQuantity; + private Hl7.Fhir.Model.Quantity? _DoseQuantity; /// /// Who performed event. @@ -1166,11 +1117,11 @@ public Hl7.Fhir.Model.Quantity DoseQuantity [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Additional immunization notes. @@ -1180,11 +1131,11 @@ public List Performer [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Why immunization occurred. @@ -1195,11 +1146,11 @@ public List Note [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why immunization occurred. @@ -1211,24 +1162,24 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Dose potency. /// [FhirElement("isSubpotent", InSummary=true, IsModifier=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsSubpotentElement + public Hl7.Fhir.Model.FhirBoolean? IsSubpotentElement { get { return _IsSubpotentElement; } set { _IsSubpotentElement = value; OnPropertyChanged("IsSubpotentElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsSubpotentElement; + private Hl7.Fhir.Model.FhirBoolean? _IsSubpotentElement; /// /// Dose potency @@ -1237,13 +1188,10 @@ public Hl7.Fhir.Model.FhirBoolean IsSubpotentElement [IgnoreDataMember] public bool? IsSubpotent { - get { return IsSubpotentElement != null ? IsSubpotentElement.Value : null; } + get => _IsSubpotentElement?.Value; set { - if (value == null) - IsSubpotentElement = null; - else - IsSubpotentElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsSubpotentElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsSubpotent"); } } @@ -1257,11 +1205,11 @@ public bool? IsSubpotent [DataMember] public List SubpotentReason { - get { if(_SubpotentReason==null) _SubpotentReason = new List(); return _SubpotentReason; } + get => _SubpotentReason ?? new List(); set { _SubpotentReason = value; OnPropertyChanged("SubpotentReason"); } } - private List _SubpotentReason; + private List? _SubpotentReason; /// /// Educational material presented to patient. @@ -1271,11 +1219,11 @@ public List SubpotentReason [DataMember] public List Education { - get { if(_Education==null) _Education = new List(); return _Education; } + get => _Education ?? new List(); set { _Education = value; OnPropertyChanged("Education"); } } - private List _Education; + private List? _Education; /// /// Patient eligibility for a vaccination program. @@ -1286,11 +1234,11 @@ public List Education [DataMember] public List ProgramEligibility { - get { if(_ProgramEligibility==null) _ProgramEligibility = new List(); return _ProgramEligibility; } + get => _ProgramEligibility ?? new List(); set { _ProgramEligibility = value; OnPropertyChanged("ProgramEligibility"); } } - private List _ProgramEligibility; + private List? _ProgramEligibility; /// /// Funding source for the vaccine. @@ -1298,13 +1246,13 @@ public List ProgramEligibility [FhirElement("fundingSource", Order=340)] [Binding("FundingSource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundingSource + public Hl7.Fhir.Model.CodeableConcept? FundingSource { get { return _FundingSource; } set { _FundingSource = value; OnPropertyChanged("FundingSource"); } } - private Hl7.Fhir.Model.CodeableConcept _FundingSource; + private Hl7.Fhir.Model.CodeableConcept? _FundingSource; /// /// Details of a reaction that follows immunization. @@ -1314,11 +1262,11 @@ public Hl7.Fhir.Model.CodeableConcept FundingSource [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; /// /// Protocol followed by the provider. @@ -1328,52 +1276,48 @@ public List Reaction [DataMember] public List ProtocolApplied { - get { if(_ProtocolApplied==null) _ProtocolApplied = new List(); return _ProtocolApplied; } + get => _ProtocolApplied ?? new List(); set { _ProtocolApplied = value; OnPropertyChanged("ProtocolApplied"); } } - private List _ProtocolApplied; + private List? _ProtocolApplied; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Immunization; - - if (dest == null) - { + if(other is not Immunization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(VaccineCode != null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)VaccineCode.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)RecordedElement.DeepCopyInternal(); - if(PrimarySourceElement != null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)PrimarySourceElement.DeepCopyInternal(); - if(ReportOrigin != null) dest.ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)ReportOrigin.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)ExpirationDateElement.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(DoseQuantity != null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)DoseQuantity.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(IsSubpotentElement != null) dest.IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)IsSubpotentElement.DeepCopyInternal(); - if(SubpotentReason.Any()) dest.SubpotentReason = new List(SubpotentReason.DeepCopyInternal()); - if(Education.Any()) dest.Education = new List(Education.DeepCopyInternal()); - if(ProgramEligibility.Any()) dest.ProgramEligibility = new List(ProgramEligibility.DeepCopyInternal()); - if(FundingSource != null) dest.FundingSource = (Hl7.Fhir.Model.CodeableConcept)FundingSource.DeepCopyInternal(); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); - if(ProtocolApplied.Any()) dest.ProtocolApplied = new List(ProtocolApplied.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_VaccineCode is not null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)_VaccineCode.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedElement.DeepCopyInternal(); + if(_PrimarySourceElement is not null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)_PrimarySourceElement.DeepCopyInternal(); + if(_ReportOrigin is not null) dest.ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)_ReportOrigin.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)_ExpirationDateElement.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_DoseQuantity is not null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)_DoseQuantity.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_IsSubpotentElement is not null) dest.IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)_IsSubpotentElement.DeepCopyInternal(); + if(_SubpotentReason is not null) dest.SubpotentReason = new List(_SubpotentReason.DeepCopyInternal()); + if(_Education is not null) dest.Education = new List(_Education.DeepCopyInternal()); + if(_ProgramEligibility is not null) dest.ProgramEligibility = new List(_ProgramEligibility.DeepCopyInternal()); + if(_FundingSource is not null) dest.FundingSource = (Hl7.Fhir.Model.CodeableConcept)_FundingSource.DeepCopyInternal(); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); + if(_ProtocolApplied is not null) dest.ProtocolApplied = new List(_ProtocolApplied.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1385,223 +1329,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Immunization; - if(otherT == null) return false; + if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(PrimarySourceElement, otherT.PrimarySourceElement)) return false; - if(!comparer.Equals(ReportOrigin, otherT.ReportOrigin)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(DoseQuantity, otherT.DoseQuantity)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(IsSubpotentElement, otherT.IsSubpotentElement)) return false; - if(!comparer.ListEquals(SubpotentReason, otherT.SubpotentReason)) return false; - if(!comparer.ListEquals(Education, otherT.Education)) return false; - if(!comparer.ListEquals(ProgramEligibility, otherT.ProgramEligibility)) return false; - if(!comparer.Equals(FundingSource, otherT.FundingSource)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; - if(!comparer.ListEquals(ProtocolApplied, otherT.ProtocolApplied)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_PrimarySourceElement, otherT._PrimarySourceElement)) return false; + if(!comparer.Equals(_ReportOrigin, otherT._ReportOrigin)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_DoseQuantity, otherT._DoseQuantity)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_IsSubpotentElement, otherT._IsSubpotentElement)) return false; + if(!comparer.ListEquals(_SubpotentReason, otherT._SubpotentReason)) return false; + if(!comparer.ListEquals(_Education, otherT._Education)) return false; + if(!comparer.ListEquals(_ProgramEligibility, otherT._ProgramEligibility)) return false; + if(!comparer.Equals(_FundingSource, otherT._FundingSource)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; + if(!comparer.ListEquals(_ProtocolApplied, otherT._ProtocolApplied)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "vaccineCode": - value = VaccineCode; - return VaccineCode is not null; + value = _VaccineCode; + return _VaccineCode is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "primarySource": - value = PrimarySourceElement; - return PrimarySourceElement is not null; + value = _PrimarySourceElement; + return _PrimarySourceElement is not null; case "reportOrigin": - value = ReportOrigin; - return ReportOrigin is not null; + value = _ReportOrigin; + return _ReportOrigin is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "doseQuantity": - value = DoseQuantity; - return DoseQuantity is not null; + value = _DoseQuantity; + return _DoseQuantity is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "isSubpotent": - value = IsSubpotentElement; - return IsSubpotentElement is not null; + value = _IsSubpotentElement; + return _IsSubpotentElement is not null; case "subpotentReason": - value = SubpotentReason; - return SubpotentReason?.Any() == true; + value = _SubpotentReason; + return _SubpotentReason?.Any() == true; case "education": - value = Education; - return Education?.Any() == true; + value = _Education; + return _Education?.Any() == true; case "programEligibility": - value = ProgramEligibility; - return ProgramEligibility?.Any() == true; + value = _ProgramEligibility; + return _ProgramEligibility?.Any() == true; case "fundingSource": - value = FundingSource; - return FundingSource is not null; + value = _FundingSource; + return _FundingSource is not null; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; case "protocolApplied": - value = ProtocolApplied; - return ProtocolApplied?.Any() == true; + value = _ProtocolApplied; + return _ProtocolApplied?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "vaccineCode": - VaccineCode = (Hl7.Fhir.Model.CodeableConcept)value; + VaccineCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "primarySource": - PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)value; + PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reportOrigin": - ReportOrigin = (Hl7.Fhir.Model.CodeableConcept)value; + ReportOrigin = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.Date)value; + ExpirationDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseQuantity": - DoseQuantity = (Hl7.Fhir.Model.Quantity)value; + DoseQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "isSubpotent": - IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subpotentReason": - SubpotentReason = (List)value; + SubpotentReason = (List?)value!; return this; case "education": - Education = (List)value; + Education = (List?)value!; return this; case "programEligibility": - ProgramEligibility = (List)value; + ProgramEligibility = (List?)value!; return this; case "fundingSource": - FundingSource = (Hl7.Fhir.Model.CodeableConcept)value; + FundingSource = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; case "protocolApplied": - ProtocolApplied = (List)value; + ProtocolApplied = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1612,34 +1556,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (VaccineCode is not null) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",PrimarySourceElement); - if (ReportOrigin is not null) yield return new KeyValuePair("reportOrigin",ReportOrigin); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",DoseQuantity); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (IsSubpotentElement is not null) yield return new KeyValuePair("isSubpotent",IsSubpotentElement); - if (SubpotentReason?.Any() == true) yield return new KeyValuePair("subpotentReason",SubpotentReason); - if (Education?.Any() == true) yield return new KeyValuePair("education",Education); - if (ProgramEligibility?.Any() == true) yield return new KeyValuePair("programEligibility",ProgramEligibility); - if (FundingSource is not null) yield return new KeyValuePair("fundingSource",FundingSource); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); - if (ProtocolApplied?.Any() == true) yield return new KeyValuePair("protocolApplied",ProtocolApplied); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_VaccineCode is not null) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",_PrimarySourceElement); + if (_ReportOrigin is not null) yield return new KeyValuePair("reportOrigin",_ReportOrigin); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",_DoseQuantity); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_IsSubpotentElement is not null) yield return new KeyValuePair("isSubpotent",_IsSubpotentElement); + if (_SubpotentReason?.Any() == true) yield return new KeyValuePair("subpotentReason",_SubpotentReason); + if (_Education?.Any() == true) yield return new KeyValuePair("education",_Education); + if (_ProgramEligibility?.Any() == true) yield return new KeyValuePair("programEligibility",_ProgramEligibility); + if (_FundingSource is not null) yield return new KeyValuePair("fundingSource",_FundingSource); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); + if (_ProtocolApplied?.Any() == true) yield return new KeyValuePair("protocolApplied",_ProtocolApplied); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs index cb476c5de..f220af2b6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -89,11 +92,11 @@ public enum ImmunizationEvaluationStatusCodes [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// completed | entered-in-error. @@ -103,13 +106,13 @@ public List Identifier [Binding("ImmunizationEvaluationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | entered-in-error @@ -118,13 +121,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -137,41 +137,38 @@ public Hl7.Fhir.Model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes? [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Date evaluation was performed. /// [FhirElement("date", Order=120, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date evaluation was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -183,13 +180,13 @@ public string Date [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Evaluation target disease. @@ -198,13 +195,13 @@ public Hl7.Fhir.Model.ResourceReference Authority [Binding("EvaluationTargetDisease")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TargetDisease + public Hl7.Fhir.Model.CodeableConcept? TargetDisease { get { return _TargetDisease; } set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private Hl7.Fhir.Model.CodeableConcept _TargetDisease; + private Hl7.Fhir.Model.CodeableConcept? _TargetDisease; /// /// Immunization being evaluated. @@ -214,13 +211,13 @@ public Hl7.Fhir.Model.CodeableConcept TargetDisease [References("Immunization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ImmunizationEvent + public Hl7.Fhir.Model.ResourceReference? ImmunizationEvent { get { return _ImmunizationEvent; } set { _ImmunizationEvent = value; OnPropertyChanged("ImmunizationEvent"); } } - private Hl7.Fhir.Model.ResourceReference _ImmunizationEvent; + private Hl7.Fhir.Model.ResourceReference? _ImmunizationEvent; /// /// Status of the dose relative to published recommendations. @@ -229,13 +226,13 @@ public Hl7.Fhir.Model.ResourceReference ImmunizationEvent [Binding("EvaluationDoseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseStatus + public Hl7.Fhir.Model.CodeableConcept? DoseStatus { get { return _DoseStatus; } set { _DoseStatus = value; OnPropertyChanged("DoseStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseStatus; + private Hl7.Fhir.Model.CodeableConcept? _DoseStatus; /// /// Reason for the dose status. @@ -246,39 +243,36 @@ public Hl7.Fhir.Model.CodeableConcept DoseStatus [DataMember] public List DoseStatusReason { - get { if(_DoseStatusReason==null) _DoseStatusReason = new List(); return _DoseStatusReason; } + get => _DoseStatusReason ?? new List(); set { _DoseStatusReason = value; OnPropertyChanged("DoseStatusReason"); } } - private List _DoseStatusReason; + private List? _DoseStatusReason; /// /// Evaluation notes. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Evaluation notes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -288,28 +282,25 @@ public string Description /// [FhirElement("series", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccine series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -321,13 +312,13 @@ public string Series [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType DoseNumber + public Hl7.Fhir.Model.DataType? DoseNumber { get { return _DoseNumber; } set { _DoseNumber = value; OnPropertyChanged("DoseNumber"); } } - private Hl7.Fhir.Model.DataType _DoseNumber; + private Hl7.Fhir.Model.DataType? _DoseNumber; /// /// Recommended number of doses for immunity. @@ -336,39 +327,35 @@ public Hl7.Fhir.Model.DataType DoseNumber [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType SeriesDoses + public Hl7.Fhir.Model.DataType? SeriesDoses { get { return _SeriesDoses; } set { _SeriesDoses = value; OnPropertyChanged("SeriesDoses"); } } - private Hl7.Fhir.Model.DataType _SeriesDoses; + private Hl7.Fhir.Model.DataType? _SeriesDoses; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImmunizationEvaluation; - - if (dest == null) - { + if(other is not ImmunizationEvaluation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(TargetDisease != null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopyInternal(); - if(ImmunizationEvent != null) dest.ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)ImmunizationEvent.DeepCopyInternal(); - if(DoseStatus != null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)DoseStatus.DeepCopyInternal(); - if(DoseStatusReason.Any()) dest.DoseStatusReason = new List(DoseStatusReason.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(DoseNumber != null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)DoseNumber.DeepCopyInternal(); - if(SeriesDoses != null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)SeriesDoses.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)_TargetDisease.DeepCopyInternal(); + if(_ImmunizationEvent is not null) dest.ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)_ImmunizationEvent.DeepCopyInternal(); + if(_DoseStatus is not null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)_DoseStatus.DeepCopyInternal(); + if(_DoseStatusReason is not null) dest.DoseStatusReason = new List(_DoseStatusReason.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_DoseNumber is not null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)_DoseNumber.DeepCopyInternal(); + if(_SeriesDoses is not null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)_SeriesDoses.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -380,118 +367,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImmunizationEvaluation; - if(otherT == null) return false; + if(other is not ImmunizationEvaluation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(ImmunizationEvent, otherT.ImmunizationEvent)) return false; - if(!comparer.Equals(DoseStatus, otherT.DoseStatus)) return false; - if(!comparer.ListEquals(DoseStatusReason, otherT.DoseStatusReason)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(DoseNumber, otherT.DoseNumber)) return false; - if(!comparer.Equals(SeriesDoses, otherT.SeriesDoses)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_ImmunizationEvent, otherT._ImmunizationEvent)) return false; + if(!comparer.Equals(_DoseStatus, otherT._DoseStatus)) return false; + if(!comparer.ListEquals(_DoseStatusReason, otherT._DoseStatusReason)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; + if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease is not null; + value = _TargetDisease; + return _TargetDisease is not null; case "immunizationEvent": - value = ImmunizationEvent; - return ImmunizationEvent is not null; + value = _ImmunizationEvent; + return _ImmunizationEvent is not null; case "doseStatus": - value = DoseStatus; - return DoseStatus is not null; + value = _DoseStatus; + return _DoseStatus is not null; case "doseStatusReason": - value = DoseStatusReason; - return DoseStatusReason?.Any() == true; + value = _DoseStatusReason; + return _DoseStatusReason?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "doseNumber": - value = DoseNumber; - return DoseNumber is not null; + value = _DoseNumber; + return _DoseNumber is not null; case "seriesDoses": - value = SeriesDoses; - return SeriesDoses is not null; + value = _SeriesDoses; + return _SeriesDoses is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "targetDisease": - TargetDisease = (Hl7.Fhir.Model.CodeableConcept)value; + TargetDisease = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "immunizationEvent": - ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)value; + ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "doseStatus": - DoseStatus = (Hl7.Fhir.Model.CodeableConcept)value; + DoseStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseStatusReason": - DoseStatusReason = (List)value; + DoseStatusReason = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "doseNumber": - DoseNumber = (Hl7.Fhir.Model.DataType)value; + DoseNumber = (Hl7.Fhir.Model.DataType?)value; return this; case "seriesDoses": - SeriesDoses = (Hl7.Fhir.Model.DataType)value; + SeriesDoses = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -502,19 +489,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (TargetDisease is not null) yield return new KeyValuePair("targetDisease",TargetDisease); - if (ImmunizationEvent is not null) yield return new KeyValuePair("immunizationEvent",ImmunizationEvent); - if (DoseStatus is not null) yield return new KeyValuePair("doseStatus",DoseStatus); - if (DoseStatusReason?.Any() == true) yield return new KeyValuePair("doseStatusReason",DoseStatusReason); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (DoseNumber is not null) yield return new KeyValuePair("doseNumber",DoseNumber); - if (SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",SeriesDoses); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_TargetDisease is not null) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_ImmunizationEvent is not null) yield return new KeyValuePair("immunizationEvent",_ImmunizationEvent); + if (_DoseStatus is not null) yield return new KeyValuePair("doseStatus",_DoseStatus); + if (_DoseStatusReason?.Any() == true) yield return new KeyValuePair("doseStatusReason",_DoseStatusReason); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_DoseNumber is not null) yield return new KeyValuePair("doseNumber",_DoseNumber); + if (_SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",_SeriesDoses); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs index 2d0858e36..201094064 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,11 +84,11 @@ public partial class RecommendationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List VaccineCode { - get { if(_VaccineCode==null) _VaccineCode = new List(); return _VaccineCode; } + get => _VaccineCode ?? new List(); set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private List _VaccineCode; + private List? _VaccineCode; /// /// Disease to be immunized against. @@ -93,13 +96,13 @@ public List VaccineCode [FhirElement("targetDisease", InSummary=true, Order=50)] [Binding("TargetDisease")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TargetDisease + public Hl7.Fhir.Model.CodeableConcept? TargetDisease { get { return _TargetDisease; } set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private Hl7.Fhir.Model.CodeableConcept _TargetDisease; + private Hl7.Fhir.Model.CodeableConcept? _TargetDisease; /// /// Vaccine which is contraindicated to fulfill the recommendation. @@ -110,11 +113,11 @@ public Hl7.Fhir.Model.CodeableConcept TargetDisease [DataMember] public List ContraindicatedVaccineCode { - get { if(_ContraindicatedVaccineCode==null) _ContraindicatedVaccineCode = new List(); return _ContraindicatedVaccineCode; } + get => _ContraindicatedVaccineCode ?? new List(); set { _ContraindicatedVaccineCode = value; OnPropertyChanged("ContraindicatedVaccineCode"); } } - private List _ContraindicatedVaccineCode; + private List? _ContraindicatedVaccineCode; /// /// Vaccine recommendation status. @@ -123,13 +126,13 @@ public List ContraindicatedVaccineCode [Binding("ImmunizationRecommendationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ForecastStatus + public Hl7.Fhir.Model.CodeableConcept? ForecastStatus { get { return _ForecastStatus; } set { _ForecastStatus = value; OnPropertyChanged("ForecastStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ForecastStatus; + private Hl7.Fhir.Model.CodeableConcept? _ForecastStatus; /// /// Vaccine administration status reason. @@ -140,11 +143,11 @@ public Hl7.Fhir.Model.CodeableConcept ForecastStatus [DataMember] public List ForecastReason { - get { if(_ForecastReason==null) _ForecastReason = new List(); return _ForecastReason; } + get => _ForecastReason ?? new List(); set { _ForecastReason = value; OnPropertyChanged("ForecastReason"); } } - private List _ForecastReason; + private List? _ForecastReason; /// /// Dates governing proposed immunization. @@ -154,39 +157,36 @@ public List ForecastReason [DataMember] public List DateCriterion { - get { if(_DateCriterion==null) _DateCriterion = new List(); return _DateCriterion; } + get => _DateCriterion ?? new List(); set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } - private List _DateCriterion; + private List? _DateCriterion; /// /// Protocol details. /// [FhirElement("description", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Protocol details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -196,28 +196,25 @@ public string Description /// [FhirElement("series", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccination series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -229,13 +226,13 @@ public string Series [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType DoseNumber + public Hl7.Fhir.Model.DataType? DoseNumber { get { return _DoseNumber; } set { _DoseNumber = value; OnPropertyChanged("DoseNumber"); } } - private Hl7.Fhir.Model.DataType _DoseNumber; + private Hl7.Fhir.Model.DataType? _DoseNumber; /// /// Recommended number of doses for immunity. @@ -244,13 +241,13 @@ public Hl7.Fhir.Model.DataType DoseNumber [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType SeriesDoses + public Hl7.Fhir.Model.DataType? SeriesDoses { get { return _SeriesDoses; } set { _SeriesDoses = value; OnPropertyChanged("SeriesDoses"); } } - private Hl7.Fhir.Model.DataType _SeriesDoses; + private Hl7.Fhir.Model.DataType? _SeriesDoses; /// /// Past immunizations supporting recommendation. @@ -262,11 +259,11 @@ public Hl7.Fhir.Model.DataType SeriesDoses [DataMember] public List SupportingImmunization { - get { if(_SupportingImmunization==null) _SupportingImmunization = new List(); return _SupportingImmunization; } + get => _SupportingImmunization ?? new List(); set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } - private List _SupportingImmunization; + private List? _SupportingImmunization; /// /// Patient observations supporting recommendation. @@ -278,34 +275,30 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get { if(_SupportingPatientInformation==null) _SupportingPatientInformation = new List(); return _SupportingPatientInformation; } + get => _SupportingPatientInformation ?? new List(); set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } - private List _SupportingPatientInformation; + private List? _SupportingPatientInformation; protected internal override void CopyToInternal(Base other) { - var dest = other as RecommendationComponent; - - if (dest == null) - { + if(other is not RecommendationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VaccineCode.Any()) dest.VaccineCode = new List(VaccineCode.DeepCopyInternal()); - if(TargetDisease != null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopyInternal(); - if(ContraindicatedVaccineCode.Any()) dest.ContraindicatedVaccineCode = new List(ContraindicatedVaccineCode.DeepCopyInternal()); - if(ForecastStatus != null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)ForecastStatus.DeepCopyInternal(); - if(ForecastReason.Any()) dest.ForecastReason = new List(ForecastReason.DeepCopyInternal()); - if(DateCriterion.Any()) dest.DateCriterion = new List(DateCriterion.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(DoseNumber != null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)DoseNumber.DeepCopyInternal(); - if(SeriesDoses != null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)SeriesDoses.DeepCopyInternal(); - if(SupportingImmunization.Any()) dest.SupportingImmunization = new List(SupportingImmunization.DeepCopyInternal()); - if(SupportingPatientInformation.Any()) dest.SupportingPatientInformation = new List(SupportingPatientInformation.DeepCopyInternal()); + if(_VaccineCode is not null) dest.VaccineCode = new List(_VaccineCode.DeepCopyInternal()); + if(_TargetDisease is not null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)_TargetDisease.DeepCopyInternal(); + if(_ContraindicatedVaccineCode is not null) dest.ContraindicatedVaccineCode = new List(_ContraindicatedVaccineCode.DeepCopyInternal()); + if(_ForecastStatus is not null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)_ForecastStatus.DeepCopyInternal(); + if(_ForecastReason is not null) dest.ForecastReason = new List(_ForecastReason.DeepCopyInternal()); + if(_DateCriterion is not null) dest.DateCriterion = new List(_DateCriterion.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_DoseNumber is not null) dest.DoseNumber = (Hl7.Fhir.Model.DataType)_DoseNumber.DeepCopyInternal(); + if(_SeriesDoses is not null) dest.SeriesDoses = (Hl7.Fhir.Model.DataType)_SeriesDoses.DeepCopyInternal(); + if(_SupportingImmunization is not null) dest.SupportingImmunization = new List(_SupportingImmunization.DeepCopyInternal()); + if(_SupportingPatientInformation is not null) dest.SupportingPatientInformation = new List(_SupportingPatientInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -317,111 +310,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RecommendationComponent; - if(otherT == null) return false; + if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.Equals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.ListEquals(ContraindicatedVaccineCode, otherT.ContraindicatedVaccineCode)) return false; - if(!comparer.Equals(ForecastStatus, otherT.ForecastStatus)) return false; - if(!comparer.ListEquals(ForecastReason, otherT.ForecastReason)) return false; - if(!comparer.ListEquals(DateCriterion, otherT.DateCriterion)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(DoseNumber, otherT.DoseNumber)) return false; - if(!comparer.Equals(SeriesDoses, otherT.SeriesDoses)) return false; - if(!comparer.ListEquals(SupportingImmunization, otherT.SupportingImmunization)) return false; - if(!comparer.ListEquals(SupportingPatientInformation, otherT.SupportingPatientInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.ListEquals(_ContraindicatedVaccineCode, otherT._ContraindicatedVaccineCode)) return false; + if(!comparer.Equals(_ForecastStatus, otherT._ForecastStatus)) return false; + if(!comparer.ListEquals(_ForecastReason, otherT._ForecastReason)) return false; + if(!comparer.ListEquals(_DateCriterion, otherT._DateCriterion)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; + if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; + if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; + if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "vaccineCode": - value = VaccineCode; - return VaccineCode?.Any() == true; + value = _VaccineCode; + return _VaccineCode?.Any() == true; case "targetDisease": - value = TargetDisease; - return TargetDisease is not null; + value = _TargetDisease; + return _TargetDisease is not null; case "contraindicatedVaccineCode": - value = ContraindicatedVaccineCode; - return ContraindicatedVaccineCode?.Any() == true; + value = _ContraindicatedVaccineCode; + return _ContraindicatedVaccineCode?.Any() == true; case "forecastStatus": - value = ForecastStatus; - return ForecastStatus is not null; + value = _ForecastStatus; + return _ForecastStatus is not null; case "forecastReason": - value = ForecastReason; - return ForecastReason?.Any() == true; + value = _ForecastReason; + return _ForecastReason?.Any() == true; case "dateCriterion": - value = DateCriterion; - return DateCriterion?.Any() == true; + value = _DateCriterion; + return _DateCriterion?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "doseNumber": - value = DoseNumber; - return DoseNumber is not null; + value = _DoseNumber; + return _DoseNumber is not null; case "seriesDoses": - value = SeriesDoses; - return SeriesDoses is not null; + value = _SeriesDoses; + return _SeriesDoses is not null; case "supportingImmunization": - value = SupportingImmunization; - return SupportingImmunization?.Any() == true; + value = _SupportingImmunization; + return _SupportingImmunization?.Any() == true; case "supportingPatientInformation": - value = SupportingPatientInformation; - return SupportingPatientInformation?.Any() == true; + value = _SupportingPatientInformation; + return _SupportingPatientInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "vaccineCode": - VaccineCode = (List)value; + VaccineCode = (List?)value!; return this; case "targetDisease": - TargetDisease = (Hl7.Fhir.Model.CodeableConcept)value; + TargetDisease = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contraindicatedVaccineCode": - ContraindicatedVaccineCode = (List)value; + ContraindicatedVaccineCode = (List?)value!; return this; case "forecastStatus": - ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ForecastStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "forecastReason": - ForecastReason = (List)value; + ForecastReason = (List?)value!; return this; case "dateCriterion": - DateCriterion = (List)value; + DateCriterion = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "doseNumber": - DoseNumber = (Hl7.Fhir.Model.DataType)value; + DoseNumber = (Hl7.Fhir.Model.DataType?)value; return this; case "seriesDoses": - SeriesDoses = (Hl7.Fhir.Model.DataType)value; + SeriesDoses = (Hl7.Fhir.Model.DataType?)value; return this; case "supportingImmunization": - SupportingImmunization = (List)value; + SupportingImmunization = (List?)value!; return this; case "supportingPatientInformation": - SupportingPatientInformation = (List)value; + SupportingPatientInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -432,18 +425,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VaccineCode?.Any() == true) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (TargetDisease is not null) yield return new KeyValuePair("targetDisease",TargetDisease); - if (ContraindicatedVaccineCode?.Any() == true) yield return new KeyValuePair("contraindicatedVaccineCode",ContraindicatedVaccineCode); - if (ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",ForecastStatus); - if (ForecastReason?.Any() == true) yield return new KeyValuePair("forecastReason",ForecastReason); - if (DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",DateCriterion); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (DoseNumber is not null) yield return new KeyValuePair("doseNumber",DoseNumber); - if (SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",SeriesDoses); - if (SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",SupportingImmunization); - if (SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",SupportingPatientInformation); + if (_VaccineCode?.Any() == true) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_TargetDisease is not null) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_ContraindicatedVaccineCode?.Any() == true) yield return new KeyValuePair("contraindicatedVaccineCode",_ContraindicatedVaccineCode); + if (_ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",_ForecastStatus); + if (_ForecastReason?.Any() == true) yield return new KeyValuePair("forecastReason",_ForecastReason); + if (_DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",_DateCriterion); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_DoseNumber is not null) yield return new KeyValuePair("doseNumber",_DoseNumber); + if (_SeriesDoses is not null) yield return new KeyValuePair("seriesDoses",_SeriesDoses); + if (_SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",_SupportingImmunization); + if (_SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",_SupportingPatientInformation); } } @@ -471,13 +464,13 @@ public partial class DateCriterionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ImmunizationRecommendationDateCriterion")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Recommended date. @@ -485,44 +478,37 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValueElement + public Hl7.Fhir.Model.FhirDateTime? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValueElement; + private Hl7.Fhir.Model.FhirDateTime? _ValueElement; /// /// Recommended date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DateCriterionComponent; - - if (dest == null) - { + if(other is not DateCriterionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)ValueElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -534,41 +520,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateCriterionComponent; - if(otherT == null) return false; + if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValueElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -579,8 +565,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -593,11 +579,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Who this profile is for. @@ -607,13 +593,13 @@ public List Identifier [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Date recommendation(s) created. @@ -621,28 +607,25 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("date", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date recommendation(s) created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -654,13 +637,13 @@ public string Date [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Vaccine administration recommendations. @@ -670,29 +653,25 @@ public Hl7.Fhir.Model.ResourceReference Authority [DataMember] public List Recommendation { - get { if(_Recommendation==null) _Recommendation = new List(); return _Recommendation; } + get => _Recommendation ?? new List(); set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } - private List _Recommendation; + private List? _Recommendation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImmunizationRecommendation; - - if (dest == null) - { + if(other is not ImmunizationRecommendation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(Recommendation.Any()) dest.Recommendation = new List(Recommendation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_Recommendation is not null) dest.Recommendation = new List(_Recommendation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -704,62 +683,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImmunizationRecommendation; - if(otherT == null) return false; + if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(Recommendation, otherT.Recommendation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "recommendation": - value = Recommendation; - return Recommendation?.Any() == true; + value = _Recommendation; + return _Recommendation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recommendation": - Recommendation = (List)value; + Recommendation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -770,11 +749,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",Recommendation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",_Recommendation); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs index db6579e53..192755dc8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -2271,28 +2274,25 @@ public partial class DependsOnComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uri", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical UriElement + public Hl7.Fhir.Model.Canonical? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.Canonical _UriElement; + private Hl7.Fhir.Model.Canonical? _UriElement; /// /// Identity of the IG that this depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.Canonical(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Uri"); } } @@ -2302,28 +2302,25 @@ public string Uri /// [FhirElement("packageId", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Id PackageIdElement + public Hl7.Fhir.Model.Id? PackageIdElement { get { return _PackageIdElement; } set { _PackageIdElement = value; OnPropertyChanged("PackageIdElement"); } } - private Hl7.Fhir.Model.Id _PackageIdElement; + private Hl7.Fhir.Model.Id? _PackageIdElement; /// /// NPM Package name for IG this depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PackageId + public string? PackageId { - get { return PackageIdElement != null ? PackageIdElement.Value : null; } + get => _PackageIdElement?.Value; set { - if (value == null) - PackageIdElement = null; - else - PackageIdElement = new Hl7.Fhir.Model.Id(value); + PackageIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("PackageId"); } } @@ -2333,45 +2330,38 @@ public string PackageId /// [FhirElement("version", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of the IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DependsOnComponent; - - if (dest == null) - { + if(other is not DependsOnComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.Canonical)UriElement.DeepCopyInternal(); - if(PackageIdElement != null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)PackageIdElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.Canonical)_UriElement.DeepCopyInternal(); + if(_PackageIdElement is not null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)_PackageIdElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2383,48 +2373,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependsOnComponent; - if(otherT == null) return false; + if(other is not DependsOnComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(PackageIdElement, otherT.PackageIdElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "packageId": - value = PackageIdElement; - return PackageIdElement is not null; + value = _PackageIdElement; + return _PackageIdElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uri": - UriElement = (Hl7.Fhir.Model.Canonical)value; + UriElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "packageId": - PackageIdElement = (Hl7.Fhir.Model.Id)value; + PackageIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2435,9 +2425,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (PackageIdElement is not null) yield return new KeyValuePair("packageId",PackageIdElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_PackageIdElement is not null) yield return new KeyValuePair("packageId",_PackageIdElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -2467,13 +2457,13 @@ public partial class GlobalComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type this profile applies to @@ -2482,13 +2472,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2499,44 +2486,37 @@ public Hl7.Fhir.Model.ResourceType? Type [FhirElement("profile", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile that all resources must conform to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GlobalComponent; - - if (dest == null) - { + if(other is not GlobalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2548,41 +2528,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GlobalComponent; - if(otherT == null) return false; + if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -2593,8 +2573,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } @@ -2624,11 +2604,11 @@ public partial class DefinitionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Grouping { - get { if(_Grouping==null) _Grouping = new List(); return _Grouping; } + get => _Grouping ?? new List(); set { _Grouping = value; OnPropertyChanged("Grouping"); } } - private List _Grouping; + private List? _Grouping; /// /// Resource in the implementation guide. @@ -2638,24 +2618,24 @@ public List Grouping [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// Page/Section in the Guide. /// [FhirElement("page", Order=60)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.PageComponent Page + public Hl7.Fhir.Model.ImplementationGuide.PageComponent? Page { get { return _Page; } set { _Page = value; OnPropertyChanged("Page"); } } - private Hl7.Fhir.Model.ImplementationGuide.PageComponent _Page; + private Hl7.Fhir.Model.ImplementationGuide.PageComponent? _Page; /// /// Defines how IG is built by tools. @@ -2665,11 +2645,11 @@ public Hl7.Fhir.Model.ImplementationGuide.PageComponent Page [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// A template for building resources. @@ -2679,27 +2659,23 @@ public List Parameter [DataMember] public List Template { - get { if(_Template==null) _Template = new List(); return _Template; } + get => _Template ?? new List(); set { _Template = value; OnPropertyChanged("Template"); } } - private List _Template; + private List? _Template; protected internal override void CopyToInternal(Base other) { - var dest = other as DefinitionComponent; - - if (dest == null) - { + if(other is not DefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Grouping.Any()) dest.Grouping = new List(Grouping.DeepCopyInternal()); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Page != null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)Page.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Template.Any()) dest.Template = new List(Template.DeepCopyInternal()); + if(_Grouping is not null) dest.Grouping = new List(_Grouping.DeepCopyInternal()); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Page is not null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)_Page.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Template is not null) dest.Template = new List(_Template.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2711,62 +2687,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DefinitionComponent; - if(otherT == null) return false; + if(other is not DefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Grouping, otherT.Grouping)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.Equals(Page, otherT.Page)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Template, otherT.Template)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.Equals(_Page, otherT._Page)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Template, otherT._Template)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "grouping": - value = Grouping; - return Grouping?.Any() == true; + value = _Grouping; + return _Grouping?.Any() == true; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "page": - value = Page; - return Page is not null; + value = _Page; + return _Page is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "template": - value = Template; - return Template?.Any() == true; + value = _Template; + return _Template?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "grouping": - Grouping = (List)value; + Grouping = (List?)value!; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "page": - Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)value; + Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "template": - Template = (List)value; + Template = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2777,11 +2753,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Grouping?.Any() == true) yield return new KeyValuePair("grouping",Grouping); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Page is not null) yield return new KeyValuePair("page",Page); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Template?.Any() == true) yield return new KeyValuePair("template",Template); + if (_Grouping?.Any() == true) yield return new KeyValuePair("grouping",_Grouping); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Page is not null) yield return new KeyValuePair("page",_Page); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Template?.Any() == true) yield return new KeyValuePair("template",_Template); } } @@ -2809,28 +2785,25 @@ public partial class GroupingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptive name for the package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2840,44 +2813,37 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human readable text describing the package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GroupingComponent; - - if (dest == null) - { + if(other is not GroupingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2889,41 +2855,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupingComponent; - if(otherT == null) return false; + if(other is not GroupingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2934,8 +2900,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -2964,13 +2930,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Versions this applies to (if different to IG). @@ -2982,24 +2948,24 @@ public Hl7.Fhir.Model.ResourceReference Reference [DataMember] public List> FhirVersionElement { - get { if(_FhirVersionElement==null) _FhirVersionElement = new List>(); return _FhirVersionElement; } + get => _FhirVersionElement ?? new List>(); set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private List> _FhirVersionElement; + private List>? _FhirVersionElement; /// /// Versions this applies to (if different to IG) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FhirVersion + public IEnumerable? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Select(elem => elem.Value) : null; } + get => _FhirVersionElement?.Select(elem => elem.Value); set { if (value == null) - FhirVersionElement = null; + FhirVersionElement = null!; else FhirVersionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("FhirVersion"); @@ -3011,28 +2977,25 @@ public IEnumerable FhirVersion /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human Name for the resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3042,28 +3005,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason why included in guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -3075,61 +3035,54 @@ public string Description [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Example + public Hl7.Fhir.Model.DataType? Example { get { return _Example; } set { _Example = value; OnPropertyChanged("Example"); } } - private Hl7.Fhir.Model.DataType _Example; + private Hl7.Fhir.Model.DataType? _Example; /// /// Grouping this is part of. /// [FhirElement("groupingId", Order=90)] [DataMember] - public Hl7.Fhir.Model.Id GroupingIdElement + public Hl7.Fhir.Model.Id? GroupingIdElement { get { return _GroupingIdElement; } set { _GroupingIdElement = value; OnPropertyChanged("GroupingIdElement"); } } - private Hl7.Fhir.Model.Id _GroupingIdElement; + private Hl7.Fhir.Model.Id? _GroupingIdElement; /// /// Grouping this is part of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string GroupingId + public string? GroupingId { - get { return GroupingIdElement != null ? GroupingIdElement.Value : null; } + get => _GroupingIdElement?.Value; set { - if (value == null) - GroupingIdElement = null; - else - GroupingIdElement = new Hl7.Fhir.Model.Id(value); + GroupingIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("GroupingId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(FhirVersionElement.Any()) dest.FhirVersionElement = new List>(FhirVersionElement.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Example != null) dest.Example = (Hl7.Fhir.Model.DataType)Example.DeepCopyInternal(); - if(GroupingIdElement != null) dest.GroupingIdElement = (Hl7.Fhir.Model.Id)GroupingIdElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = new List>(_FhirVersionElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Example is not null) dest.Example = (Hl7.Fhir.Model.DataType)_Example.DeepCopyInternal(); + if(_GroupingIdElement is not null) dest.GroupingIdElement = (Hl7.Fhir.Model.Id)_GroupingIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3141,69 +3094,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.ListEquals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Example, otherT.Example)) return false; - if(!comparer.Equals(GroupingIdElement, otherT.GroupingIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Example, otherT._Example)) return false; + if(!comparer.Equals(_GroupingIdElement, otherT._GroupingIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement?.Any() == true; + value = _FhirVersionElement; + return _FhirVersionElement?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "example": - value = Example; - return Example is not null; + value = _Example; + return _Example is not null; case "groupingId": - value = GroupingIdElement; - return GroupingIdElement is not null; + value = _GroupingIdElement; + return _GroupingIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "fhirVersion": - FhirVersionElement = (List>)value; + FhirVersionElement = (List>?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "example": - Example = (Hl7.Fhir.Model.DataType)value; + Example = (Hl7.Fhir.Model.DataType?)value; return this; case "groupingId": - GroupingIdElement = (Hl7.Fhir.Model.Id)value; + GroupingIdElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -3214,12 +3167,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Example is not null) yield return new KeyValuePair("example",Example); - if (GroupingIdElement is not null) yield return new KeyValuePair("groupingId",GroupingIdElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Example is not null) yield return new KeyValuePair("example",_Example); + if (_GroupingIdElement is not null) yield return new KeyValuePair("groupingId",_GroupingIdElement); } } @@ -3250,13 +3203,13 @@ public partial class PageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Name + public Hl7.Fhir.Model.DataType? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.DataType _Name; + private Hl7.Fhir.Model.DataType? _Name; /// /// Short title shown for navigational assistance. @@ -3264,28 +3217,25 @@ public Hl7.Fhir.Model.DataType Name [FhirElement("title", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Short title shown for navigational assistance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -3298,13 +3248,13 @@ public string Title [Binding("GuidePageGeneration")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code GenerationElement + public Code? GenerationElement { get { return _GenerationElement; } set { _GenerationElement = value; OnPropertyChanged("GenerationElement"); } } - private Code _GenerationElement; + private Code? _GenerationElement; /// /// html | markdown | xml | generated @@ -3313,13 +3263,10 @@ public Code GenerationEl [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation { - get { return GenerationElement != null ? GenerationElement.Value : null; } + get => _GenerationElement?.Value; set { - if (value == null) - GenerationElement = null; - else - GenerationElement = new Code(value); + GenerationElement = value is null ? null : new Code(value); OnPropertyChanged("Generation"); } } @@ -3332,26 +3279,22 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation [DataMember] public List Page { - get { if(_Page==null) _Page = new List(); return _Page; } + get => _Page ?? new List(); set { _Page = value; OnPropertyChanged("Page"); } } - private List _Page; + private List? _Page; protected internal override void CopyToInternal(Base other) { - var dest = other as PageComponent; - - if (dest == null) - { + if(other is not PageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Name != null) dest.Name = (Hl7.Fhir.Model.DataType)Name.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(GenerationElement != null) dest.GenerationElement = (Code)GenerationElement.DeepCopyInternal(); - if(Page.Any()) dest.Page = new List(Page.DeepCopyInternal()); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.DataType)_Name.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_GenerationElement is not null) dest.GenerationElement = (Code)_GenerationElement.DeepCopyInternal(); + if(_Page is not null) dest.Page = new List(_Page.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3363,55 +3306,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PageComponent; - if(otherT == null) return false; + if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(GenerationElement, otherT.GenerationElement)) return false; - if(!comparer.ListEquals(Page, otherT.Page)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_GenerationElement, otherT._GenerationElement)) return false; + if(!comparer.ListEquals(_Page, otherT._Page)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "generation": - value = GenerationElement; - return GenerationElement is not null; + value = _GenerationElement; + return _GenerationElement is not null; case "page": - value = Page; - return Page?.Any() == true; + value = _Page; + return _Page?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - Name = (Hl7.Fhir.Model.DataType)value; + Name = (Hl7.Fhir.Model.DataType?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "generation": - GenerationElement = (Code)value; + GenerationElement = (Code?)value; return this; case "page": - Page = (List)value; + Page = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3422,10 +3365,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Name is not null) yield return new KeyValuePair("name",Name); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (GenerationElement is not null) yield return new KeyValuePair("generation",GenerationElement); - if (Page?.Any() == true) yield return new KeyValuePair("page",Page); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_GenerationElement is not null) yield return new KeyValuePair("generation",_GenerationElement); + if (_Page?.Any() == true) yield return new KeyValuePair("page",_Page); } } @@ -3451,13 +3394,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [Binding("GuideParameterCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template @@ -3466,13 +3409,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.GuideParameterCode? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -3483,44 +3423,37 @@ public Hl7.Fhir.Model.ImplementationGuide.GuideParameterCode? Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value for named type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3532,41 +3465,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3577,8 +3510,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -3602,28 +3535,25 @@ public partial class TemplateComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Type of template specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -3634,28 +3564,25 @@ public string Code [FhirElement("source", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// The source location for the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -3665,45 +3592,38 @@ public string Source /// [FhirElement("scope", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ScopeElement + public Hl7.Fhir.Model.FhirString? ScopeElement { get { return _ScopeElement; } set { _ScopeElement = value; OnPropertyChanged("ScopeElement"); } } - private Hl7.Fhir.Model.FhirString _ScopeElement; + private Hl7.Fhir.Model.FhirString? _ScopeElement; /// /// The scope in which the template applies /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Scope + public string? Scope { - get { return ScopeElement != null ? ScopeElement.Value : null; } + get => _ScopeElement?.Value; set { - if (value == null) - ScopeElement = null; - else - ScopeElement = new Hl7.Fhir.Model.FhirString(value); + ScopeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Scope"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TemplateComponent; - - if (dest == null) - { + if(other is not TemplateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(ScopeElement != null) dest.ScopeElement = (Hl7.Fhir.Model.FhirString)ScopeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_ScopeElement is not null) dest.ScopeElement = (Hl7.Fhir.Model.FhirString)_ScopeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3715,48 +3635,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TemplateComponent; - if(otherT == null) return false; + if(other is not TemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(ScopeElement, otherT.ScopeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "scope": - value = ScopeElement; - return ScopeElement is not null; + value = _ScopeElement; + return _ScopeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "scope": - ScopeElement = (Hl7.Fhir.Model.FhirString)value; + ScopeElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3767,9 +3687,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (ScopeElement is not null) yield return new KeyValuePair("scope",ScopeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_ScopeElement is not null) yield return new KeyValuePair("scope",_ScopeElement); } } @@ -3795,28 +3715,25 @@ public partial class ManifestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("rendering", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUrl RenderingElement + public Hl7.Fhir.Model.FhirUrl? RenderingElement { get { return _RenderingElement; } set { _RenderingElement = value; OnPropertyChanged("RenderingElement"); } } - private Hl7.Fhir.Model.FhirUrl _RenderingElement; + private Hl7.Fhir.Model.FhirUrl? _RenderingElement; /// /// Location of rendered implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rendering + public string? Rendering { - get { return RenderingElement != null ? RenderingElement.Value : null; } + get => _RenderingElement?.Value; set { - if (value == null) - RenderingElement = null; - else - RenderingElement = new Hl7.Fhir.Model.FhirUrl(value); + RenderingElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Rendering"); } } @@ -3829,11 +3746,11 @@ public string Rendering [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// HTML page within the parent IG. @@ -3843,11 +3760,11 @@ public List Resour [DataMember] public List Page { - get { if(_Page==null) _Page = new List(); return _Page; } + get => _Page ?? new List(); set { _Page = value; OnPropertyChanged("Page"); } } - private List _Page; + private List? _Page; /// /// Image within the IG. @@ -3857,24 +3774,24 @@ public List Page [DataMember] public List ImageElement { - get { if(_ImageElement==null) _ImageElement = new List(); return _ImageElement; } + get => _ImageElement ?? new List(); set { _ImageElement = value; OnPropertyChanged("ImageElement"); } } - private List _ImageElement; + private List? _ImageElement; /// /// Image within the IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Image + public IEnumerable? Image { - get { return ImageElement != null ? ImageElement.Select(elem => elem.Value) : null; } + get => _ImageElement?.Select(elem => elem.Value); set { if (value == null) - ImageElement = null; + ImageElement = null!; else ImageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Image"); @@ -3889,24 +3806,24 @@ public IEnumerable Image [DataMember] public List OtherElement { - get { if(_OtherElement==null) _OtherElement = new List(); return _OtherElement; } + get => _OtherElement ?? new List(); set { _OtherElement = value; OnPropertyChanged("OtherElement"); } } - private List _OtherElement; + private List? _OtherElement; /// /// Additional linkable file in IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Other + public IEnumerable? Other { - get { return OtherElement != null ? OtherElement.Select(elem => elem.Value) : null; } + get => _OtherElement?.Select(elem => elem.Value); set { if (value == null) - OtherElement = null; + OtherElement = null!; else OtherElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Other"); @@ -3915,19 +3832,15 @@ public IEnumerable Other protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestComponent; - - if (dest == null) - { + if(other is not ManifestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RenderingElement != null) dest.RenderingElement = (Hl7.Fhir.Model.FhirUrl)RenderingElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Page.Any()) dest.Page = new List(Page.DeepCopyInternal()); - if(ImageElement.Any()) dest.ImageElement = new List(ImageElement.DeepCopyInternal()); - if(OtherElement.Any()) dest.OtherElement = new List(OtherElement.DeepCopyInternal()); + if(_RenderingElement is not null) dest.RenderingElement = (Hl7.Fhir.Model.FhirUrl)_RenderingElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Page is not null) dest.Page = new List(_Page.DeepCopyInternal()); + if(_ImageElement is not null) dest.ImageElement = new List(_ImageElement.DeepCopyInternal()); + if(_OtherElement is not null) dest.OtherElement = new List(_OtherElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3939,62 +3852,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestComponent; - if(otherT == null) return false; + if(other is not ManifestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RenderingElement, otherT.RenderingElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Page, otherT.Page)) return false; - if(!comparer.ListEquals(ImageElement, otherT.ImageElement)) return false; - if(!comparer.ListEquals(OtherElement, otherT.OtherElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Page, otherT._Page)) return false; + if(!comparer.ListEquals(_ImageElement, otherT._ImageElement)) return false; + if(!comparer.ListEquals(_OtherElement, otherT._OtherElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "rendering": - value = RenderingElement; - return RenderingElement is not null; + value = _RenderingElement; + return _RenderingElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "page": - value = Page; - return Page?.Any() == true; + value = _Page; + return _Page?.Any() == true; case "image": - value = ImageElement; - return ImageElement?.Any() == true; + value = _ImageElement; + return _ImageElement?.Any() == true; case "other": - value = OtherElement; - return OtherElement?.Any() == true; + value = _OtherElement; + return _OtherElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "rendering": - RenderingElement = (Hl7.Fhir.Model.FhirUrl)value; + RenderingElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "page": - Page = (List)value; + Page = (List?)value!; return this; case "image": - ImageElement = (List)value; + ImageElement = (List?)value!; return this; case "other": - OtherElement = (List)value; + OtherElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4005,11 +3918,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RenderingElement is not null) yield return new KeyValuePair("rendering",RenderingElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Page?.Any() == true) yield return new KeyValuePair("page",Page); - if (ImageElement?.Any() == true) yield return new KeyValuePair("image",ImageElement); - if (OtherElement?.Any() == true) yield return new KeyValuePair("other",OtherElement); + if (_RenderingElement is not null) yield return new KeyValuePair("rendering",_RenderingElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Page?.Any() == true) yield return new KeyValuePair("page",_Page); + if (_ImageElement?.Any() == true) yield return new KeyValuePair("image",_ImageElement); + if (_OtherElement?.Any() == true) yield return new KeyValuePair("other",_OtherElement); } } @@ -4038,13 +3951,13 @@ public partial class ManifestResourceComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Is an example/What is this an example of?. @@ -4053,58 +3966,51 @@ public Hl7.Fhir.Model.ResourceReference Reference [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Example + public Hl7.Fhir.Model.DataType? Example { get { return _Example; } set { _Example = value; OnPropertyChanged("Example"); } } - private Hl7.Fhir.Model.DataType _Example; + private Hl7.Fhir.Model.DataType? _Example; /// /// Relative path for page in IG. /// [FhirElement("relativePath", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUrl RelativePathElement + public Hl7.Fhir.Model.FhirUrl? RelativePathElement { get { return _RelativePathElement; } set { _RelativePathElement = value; OnPropertyChanged("RelativePathElement"); } } - private Hl7.Fhir.Model.FhirUrl _RelativePathElement; + private Hl7.Fhir.Model.FhirUrl? _RelativePathElement; /// /// Relative path for page in IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelativePath + public string? RelativePath { - get { return RelativePathElement != null ? RelativePathElement.Value : null; } + get => _RelativePathElement?.Value; set { - if (value == null) - RelativePathElement = null; - else - RelativePathElement = new Hl7.Fhir.Model.FhirUrl(value); + RelativePathElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("RelativePath"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestResourceComponent; - - if (dest == null) - { + if(other is not ManifestResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Example != null) dest.Example = (Hl7.Fhir.Model.DataType)Example.DeepCopyInternal(); - if(RelativePathElement != null) dest.RelativePathElement = (Hl7.Fhir.Model.FhirUrl)RelativePathElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Example is not null) dest.Example = (Hl7.Fhir.Model.DataType)_Example.DeepCopyInternal(); + if(_RelativePathElement is not null) dest.RelativePathElement = (Hl7.Fhir.Model.FhirUrl)_RelativePathElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4116,48 +4022,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestResourceComponent; - if(otherT == null) return false; + if(other is not ManifestResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Example, otherT.Example)) return false; - if(!comparer.Equals(RelativePathElement, otherT.RelativePathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Example, otherT._Example)) return false; + if(!comparer.Equals(_RelativePathElement, otherT._RelativePathElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "example": - value = Example; - return Example is not null; + value = _Example; + return _Example is not null; case "relativePath": - value = RelativePathElement; - return RelativePathElement is not null; + value = _RelativePathElement; + return _RelativePathElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "example": - Example = (Hl7.Fhir.Model.DataType)value; + Example = (Hl7.Fhir.Model.DataType?)value; return this; case "relativePath": - RelativePathElement = (Hl7.Fhir.Model.FhirUrl)value; + RelativePathElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -4168,9 +4074,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Example is not null) yield return new KeyValuePair("example",Example); - if (RelativePathElement is not null) yield return new KeyValuePair("relativePath",RelativePathElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Example is not null) yield return new KeyValuePair("example",_Example); + if (_RelativePathElement is not null) yield return new KeyValuePair("relativePath",_RelativePathElement); } } @@ -4197,28 +4103,25 @@ public partial class ManifestPageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// HTML page name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4228,28 +4131,25 @@ public string Name /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Title of the page, for references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4262,24 +4162,24 @@ public string Title [DataMember] public List AnchorElement { - get { if(_AnchorElement==null) _AnchorElement = new List(); return _AnchorElement; } + get => _AnchorElement ?? new List(); set { _AnchorElement = value; OnPropertyChanged("AnchorElement"); } } - private List _AnchorElement; + private List? _AnchorElement; /// /// Anchor available on the page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Anchor + public IEnumerable? Anchor { - get { return AnchorElement != null ? AnchorElement.Select(elem => elem.Value) : null; } + get => _AnchorElement?.Select(elem => elem.Value); set { if (value == null) - AnchorElement = null; + AnchorElement = null!; else AnchorElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Anchor"); @@ -4288,17 +4188,13 @@ public IEnumerable Anchor protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestPageComponent; - - if (dest == null) - { + if(other is not ManifestPageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(AnchorElement.Any()) dest.AnchorElement = new List(AnchorElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_AnchorElement is not null) dest.AnchorElement = new List(_AnchorElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4310,48 +4206,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestPageComponent; - if(otherT == null) return false; + if(other is not ManifestPageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(AnchorElement, otherT.AnchorElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_AnchorElement, otherT._AnchorElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "anchor": - value = AnchorElement; - return AnchorElement?.Any() == true; + value = _AnchorElement; + return _AnchorElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "anchor": - AnchorElement = (List)value; + AnchorElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4362,9 +4258,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (AnchorElement?.Any() == true) yield return new KeyValuePair("anchor",AnchorElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_AnchorElement?.Any() == true) yield return new KeyValuePair("anchor",_AnchorElement); } } @@ -4375,28 +4271,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this implementation guide, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4406,28 +4299,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4438,28 +4328,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this implementation guide (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4469,28 +4356,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this implementation guide (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4503,13 +4387,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -4518,13 +4402,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4534,13 +4415,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -4549,13 +4430,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -4565,28 +4443,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -4596,28 +4471,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -4630,39 +4502,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the implementation guide. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -4675,11 +4544,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for implementation guide (if applicable). @@ -4690,39 +4559,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Use and/or publishing restrictions. /// [FhirElement("copyright", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -4733,28 +4599,25 @@ public string Copyright [FhirElement("packageId", InSummary=true, Order=220)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id PackageIdElement + public Hl7.Fhir.Model.Id? PackageIdElement { get { return _PackageIdElement; } set { _PackageIdElement = value; OnPropertyChanged("PackageIdElement"); } } - private Hl7.Fhir.Model.Id _PackageIdElement; + private Hl7.Fhir.Model.Id? _PackageIdElement; /// /// NPM Package name for IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PackageId + public string? PackageId { - get { return PackageIdElement != null ? PackageIdElement.Value : null; } + get => _PackageIdElement?.Value; set { - if (value == null) - PackageIdElement = null; - else - PackageIdElement = new Hl7.Fhir.Model.Id(value); + PackageIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("PackageId"); } } @@ -4766,13 +4629,13 @@ public string PackageId [DeclaredType(Type = typeof(Code))] [Binding("SPDXLicense")] [DataMember] - public Code LicenseElement + public Code? LicenseElement { get { return _LicenseElement; } set { _LicenseElement = value; OnPropertyChanged("LicenseElement"); } } - private Code _LicenseElement; + private Code? _LicenseElement; /// /// SPDX license code for this IG (or not-open-source) @@ -4781,13 +4644,10 @@ public Code LicenseElement [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License { - get { return LicenseElement != null ? LicenseElement.Value : null; } + get => _LicenseElement?.Value; set { - if (value == null) - LicenseElement = null; - else - LicenseElement = new Code(value); + LicenseElement = value is null ? null : new Code(value); OnPropertyChanged("License"); } } @@ -4802,24 +4662,24 @@ public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License [DataMember] public List> FhirVersionElement { - get { if(_FhirVersionElement==null) _FhirVersionElement = new List>(); return _FhirVersionElement; } + get => _FhirVersionElement ?? new List>(); set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private List> _FhirVersionElement; + private List>? _FhirVersionElement; /// /// FHIR Version(s) this Implementation Guide targets /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FhirVersion + public IEnumerable? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Select(elem => elem.Value) : null; } + get => _FhirVersionElement?.Select(elem => elem.Value); set { if (value == null) - FhirVersionElement = null; + FhirVersionElement = null!; else FhirVersionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("FhirVersion"); @@ -4834,11 +4694,11 @@ public IEnumerable FhirVersion [DataMember] public List DependsOn { - get { if(_DependsOn==null) _DependsOn = new List(); return _DependsOn; } + get => _DependsOn ?? new List(); set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } - private List _DependsOn; + private List? _DependsOn; /// /// Profiles that apply globally. @@ -4848,68 +4708,64 @@ public List DependsOn [DataMember] public List Global { - get { if(_Global==null) _Global = new List(); return _Global; } + get => _Global ?? new List(); set { _Global = value; OnPropertyChanged("Global"); } } - private List _Global; + private List? _Global; /// /// Information needed to build the IG. /// [FhirElement("definition", Order=270)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent Definition + public Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent _Definition; + private Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent? _Definition; /// /// Information about an assembled IG. /// [FhirElement("manifest", Order=280)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.ManifestComponent Manifest + public Hl7.Fhir.Model.ImplementationGuide.ManifestComponent? Manifest { get { return _Manifest; } set { _Manifest = value; OnPropertyChanged("Manifest"); } } - private Hl7.Fhir.Model.ImplementationGuide.ManifestComponent _Manifest; + private Hl7.Fhir.Model.ImplementationGuide.ManifestComponent? _Manifest; protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationGuide; - - if (dest == null) - { + if(other is not ImplementationGuide dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(PackageIdElement != null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)PackageIdElement.DeepCopyInternal(); - if(LicenseElement != null) dest.LicenseElement = (Code)LicenseElement.DeepCopyInternal(); - if(FhirVersionElement.Any()) dest.FhirVersionElement = new List>(FhirVersionElement.DeepCopyInternal()); - if(DependsOn.Any()) dest.DependsOn = new List(DependsOn.DeepCopyInternal()); - if(Global.Any()) dest.Global = new List(Global.DeepCopyInternal()); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)Definition.DeepCopyInternal(); - if(Manifest != null) dest.Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)Manifest.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_PackageIdElement is not null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)_PackageIdElement.DeepCopyInternal(); + if(_LicenseElement is not null) dest.LicenseElement = (Code)_LicenseElement.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = new List>(_FhirVersionElement.DeepCopyInternal()); + if(_DependsOn is not null) dest.DependsOn = new List(_DependsOn.DeepCopyInternal()); + if(_Global is not null) dest.Global = new List(_Global.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)_Definition.DeepCopyInternal(); + if(_Manifest is not null) dest.Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)_Manifest.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4921,167 +4777,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationGuide; - if(otherT == null) return false; + if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(PackageIdElement, otherT.PackageIdElement)) return false; - if(!comparer.Equals(LicenseElement, otherT.LicenseElement)) return false; - if(!comparer.ListEquals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.ListEquals(DependsOn, otherT.DependsOn)) return false; - if(!comparer.ListEquals(Global, otherT.Global)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(Manifest, otherT.Manifest)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; + if(!comparer.Equals(_LicenseElement, otherT._LicenseElement)) return false; + if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; + if(!comparer.ListEquals(_Global, otherT._Global)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_Manifest, otherT._Manifest)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "packageId": - value = PackageIdElement; - return PackageIdElement is not null; + value = _PackageIdElement; + return _PackageIdElement is not null; case "license": - value = LicenseElement; - return LicenseElement is not null; + value = _LicenseElement; + return _LicenseElement is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement?.Any() == true; + value = _FhirVersionElement; + return _FhirVersionElement?.Any() == true; case "dependsOn": - value = DependsOn; - return DependsOn?.Any() == true; + value = _DependsOn; + return _DependsOn?.Any() == true; case "global": - value = Global; - return Global?.Any() == true; + value = _Global; + return _Global?.Any() == true; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "manifest": - value = Manifest; - return Manifest is not null; + value = _Manifest; + return _Manifest is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "packageId": - PackageIdElement = (Hl7.Fhir.Model.Id)value; + PackageIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "license": - LicenseElement = (Code)value; + LicenseElement = (Code?)value; return this; case "fhirVersion": - FhirVersionElement = (List>)value; + FhirVersionElement = (List>?)value!; return this; case "dependsOn": - DependsOn = (List)value; + DependsOn = (List?)value!; return this; case "global": - Global = (List)value; + Global = (List?)value!; return this; case "definition": - Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)value; + Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent?)value; return this; case "manifest": - Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)value; + Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent?)value; return this; default: return base.SetValue(key, value); @@ -5092,26 +4948,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (PackageIdElement is not null) yield return new KeyValuePair("packageId",PackageIdElement); - if (LicenseElement is not null) yield return new KeyValuePair("license",LicenseElement); - if (FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",DependsOn); - if (Global?.Any() == true) yield return new KeyValuePair("global",Global); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (Manifest is not null) yield return new KeyValuePair("manifest",Manifest); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_PackageIdElement is not null) yield return new KeyValuePair("packageId",_PackageIdElement); + if (_LicenseElement is not null) yield return new KeyValuePair("license",_LicenseElement); + if (_FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",_DependsOn); + if (_Global?.Any() == true) yield return new KeyValuePair("global",_Global); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_Manifest is not null) yield return new KeyValuePair("manifest",_Manifest); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs b/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs index 40d7228c4..9c5046133 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Ingredient","http://hl7.org/fhir/StructureDefinition/Ingredient")] - public partial class Ingredient : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class Ingredient : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -107,13 +110,13 @@ public partial class ManufacturerComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("IngredientManufacturerRole")] [DataMember] - public Code RoleElement + public Code? RoleElement { get { return _RoleElement; } set { _RoleElement = value; OnPropertyChanged("RoleElement"); } } - private Code _RoleElement; + private Code? _RoleElement; /// /// allowed | possible | actual @@ -122,13 +125,10 @@ public Code RoleElement [IgnoreDataMember] public Hl7.Fhir.Model.Ingredient.IngredientManufacturerRole? Role { - get { return RoleElement != null ? RoleElement.Value : null; } + get => _RoleElement?.Value; set { - if (value == null) - RoleElement = null; - else - RoleElement = new Code(value); + RoleElement = value is null ? null : new Code(value); OnPropertyChanged("Role"); } } @@ -141,26 +141,22 @@ public Hl7.Fhir.Model.Ingredient.IngredientManufacturerRole? Role [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; protected internal override void CopyToInternal(Base other) { - var dest = other as ManufacturerComponent; - - if (dest == null) - { + if(other is not ManufacturerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RoleElement != null) dest.RoleElement = (Code)RoleElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); + if(_RoleElement is not null) dest.RoleElement = (Code)_RoleElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -172,41 +168,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManufacturerComponent; - if(otherT == null) return false; + if(other is not ManufacturerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RoleElement, otherT.RoleElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = RoleElement; - return RoleElement is not null; + value = _RoleElement; + return _RoleElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - RoleElement = (Code)value; + RoleElement = (Code?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -217,8 +213,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RoleElement is not null) yield return new KeyValuePair("role",RoleElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); + if (_RoleElement is not null) yield return new KeyValuePair("role",_RoleElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); } } @@ -243,13 +239,13 @@ public partial class SubstanceComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTSubstanceCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Code + public Hl7.Fhir.Model.CodeableReference? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableReference _Code; + private Hl7.Fhir.Model.CodeableReference? _Code; /// /// The quantity of substance, per presentation, or per volume or mass, and type of quantity. @@ -259,24 +255,20 @@ public Hl7.Fhir.Model.CodeableReference Code [DataMember] public List Strength { - get { if(_Strength==null) _Strength = new List(); return _Strength; } + get => _Strength ?? new List(); set { _Strength = value; OnPropertyChanged("Strength"); } } - private List _Strength; + private List? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceComponent; - - if (dest == null) - { + if(other is not SubstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableReference)Code.DeepCopyInternal(); - if(Strength.Any()) dest.Strength = new List(Strength.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableReference)_Code.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = new List(_Strength.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -288,41 +280,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceComponent; - if(otherT == null) return false; + if(other is not SubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "strength": - value = Strength; - return Strength?.Any() == true; + value = _Strength; + return _Strength?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableReference)value; + Code = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "strength": - Strength = (List)value; + Strength = (List?)value!; return this; default: return base.SetValue(key, value); @@ -333,8 +325,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Strength?.Any() == true) yield return new KeyValuePair("strength",Strength); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Strength?.Any() == true) yield return new KeyValuePair("strength",_Strength); } } @@ -362,41 +354,38 @@ public partial class StrengthComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange))] [DataMember] - public Hl7.Fhir.Model.DataType Presentation + public Hl7.Fhir.Model.DataType? Presentation { get { return _Presentation; } set { _Presentation = value; OnPropertyChanged("Presentation"); } } - private Hl7.Fhir.Model.DataType _Presentation; + private Hl7.Fhir.Model.DataType? _Presentation; /// /// Text of either the whole presentation strength or a part of it (rest being in Strength.presentation as a ratio). /// [FhirElement("textPresentation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextPresentationElement + public Hl7.Fhir.Model.FhirString? TextPresentationElement { get { return _TextPresentationElement; } set { _TextPresentationElement = value; OnPropertyChanged("TextPresentationElement"); } } - private Hl7.Fhir.Model.FhirString _TextPresentationElement; + private Hl7.Fhir.Model.FhirString? _TextPresentationElement; /// /// Text of either the whole presentation strength or a part of it (rest being in Strength.presentation as a ratio) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextPresentation + public string? TextPresentation { - get { return TextPresentationElement != null ? TextPresentationElement.Value : null; } + get => _TextPresentationElement?.Value; set { - if (value == null) - TextPresentationElement = null; - else - TextPresentationElement = new Hl7.Fhir.Model.FhirString(value); + TextPresentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextPresentation"); } } @@ -408,41 +397,38 @@ public string TextPresentation [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange))] [DataMember] - public Hl7.Fhir.Model.DataType Concentration + public Hl7.Fhir.Model.DataType? Concentration { get { return _Concentration; } set { _Concentration = value; OnPropertyChanged("Concentration"); } } - private Hl7.Fhir.Model.DataType _Concentration; + private Hl7.Fhir.Model.DataType? _Concentration; /// /// Text of either the whole concentration strength or a part of it (rest being in Strength.concentration as a ratio). /// [FhirElement("textConcentration", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextConcentrationElement + public Hl7.Fhir.Model.FhirString? TextConcentrationElement { get { return _TextConcentrationElement; } set { _TextConcentrationElement = value; OnPropertyChanged("TextConcentrationElement"); } } - private Hl7.Fhir.Model.FhirString _TextConcentrationElement; + private Hl7.Fhir.Model.FhirString? _TextConcentrationElement; /// /// Text of either the whole concentration strength or a part of it (rest being in Strength.concentration as a ratio) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextConcentration + public string? TextConcentration { - get { return TextConcentrationElement != null ? TextConcentrationElement.Value : null; } + get => _TextConcentrationElement?.Value; set { - if (value == null) - TextConcentrationElement = null; - else - TextConcentrationElement = new Hl7.Fhir.Model.FhirString(value); + TextConcentrationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextConcentration"); } } @@ -452,28 +438,25 @@ public string TextConcentration /// [FhirElement("measurementPoint", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString MeasurementPointElement + public Hl7.Fhir.Model.FhirString? MeasurementPointElement { get { return _MeasurementPointElement; } set { _MeasurementPointElement = value; OnPropertyChanged("MeasurementPointElement"); } } - private Hl7.Fhir.Model.FhirString _MeasurementPointElement; + private Hl7.Fhir.Model.FhirString? _MeasurementPointElement; /// /// When strength is measured at a particular point or distance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeasurementPoint + public string? MeasurementPoint { - get { return MeasurementPointElement != null ? MeasurementPointElement.Value : null; } + get => _MeasurementPointElement?.Value; set { - if (value == null) - MeasurementPointElement = null; - else - MeasurementPointElement = new Hl7.Fhir.Model.FhirString(value); + MeasurementPointElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MeasurementPoint"); } } @@ -487,11 +470,11 @@ public string MeasurementPoint [DataMember] public List Country { - get { if(_Country==null) _Country = new List(); return _Country; } + get => _Country ?? new List(); set { _Country = value; OnPropertyChanged("Country"); } } - private List _Country; + private List? _Country; /// /// Strength expressed in terms of a reference substance. @@ -501,29 +484,25 @@ public List Country [DataMember] public List ReferenceStrength { - get { if(_ReferenceStrength==null) _ReferenceStrength = new List(); return _ReferenceStrength; } + get => _ReferenceStrength ?? new List(); set { _ReferenceStrength = value; OnPropertyChanged("ReferenceStrength"); } } - private List _ReferenceStrength; + private List? _ReferenceStrength; protected internal override void CopyToInternal(Base other) { - var dest = other as StrengthComponent; - - if (dest == null) - { + if(other is not StrengthComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Presentation != null) dest.Presentation = (Hl7.Fhir.Model.DataType)Presentation.DeepCopyInternal(); - if(TextPresentationElement != null) dest.TextPresentationElement = (Hl7.Fhir.Model.FhirString)TextPresentationElement.DeepCopyInternal(); - if(Concentration != null) dest.Concentration = (Hl7.Fhir.Model.DataType)Concentration.DeepCopyInternal(); - if(TextConcentrationElement != null) dest.TextConcentrationElement = (Hl7.Fhir.Model.FhirString)TextConcentrationElement.DeepCopyInternal(); - if(MeasurementPointElement != null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)MeasurementPointElement.DeepCopyInternal(); - if(Country.Any()) dest.Country = new List(Country.DeepCopyInternal()); - if(ReferenceStrength.Any()) dest.ReferenceStrength = new List(ReferenceStrength.DeepCopyInternal()); + if(_Presentation is not null) dest.Presentation = (Hl7.Fhir.Model.DataType)_Presentation.DeepCopyInternal(); + if(_TextPresentationElement is not null) dest.TextPresentationElement = (Hl7.Fhir.Model.FhirString)_TextPresentationElement.DeepCopyInternal(); + if(_Concentration is not null) dest.Concentration = (Hl7.Fhir.Model.DataType)_Concentration.DeepCopyInternal(); + if(_TextConcentrationElement is not null) dest.TextConcentrationElement = (Hl7.Fhir.Model.FhirString)_TextConcentrationElement.DeepCopyInternal(); + if(_MeasurementPointElement is not null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)_MeasurementPointElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = new List(_Country.DeepCopyInternal()); + if(_ReferenceStrength is not null) dest.ReferenceStrength = new List(_ReferenceStrength.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -535,76 +514,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StrengthComponent; - if(otherT == null) return false; + if(other is not StrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Presentation, otherT.Presentation)) return false; - if(!comparer.Equals(TextPresentationElement, otherT.TextPresentationElement)) return false; - if(!comparer.Equals(Concentration, otherT.Concentration)) return false; - if(!comparer.Equals(TextConcentrationElement, otherT.TextConcentrationElement)) return false; - if(!comparer.Equals(MeasurementPointElement, otherT.MeasurementPointElement)) return false; - if(!comparer.ListEquals(Country, otherT.Country)) return false; - if(!comparer.ListEquals(ReferenceStrength, otherT.ReferenceStrength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; + if(!comparer.Equals(_TextPresentationElement, otherT._TextPresentationElement)) return false; + if(!comparer.Equals(_Concentration, otherT._Concentration)) return false; + if(!comparer.Equals(_TextConcentrationElement, otherT._TextConcentrationElement)) return false; + if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; + if(!comparer.ListEquals(_Country, otherT._Country)) return false; + if(!comparer.ListEquals(_ReferenceStrength, otherT._ReferenceStrength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "presentation": - value = Presentation; - return Presentation is not null; + value = _Presentation; + return _Presentation is not null; case "textPresentation": - value = TextPresentationElement; - return TextPresentationElement is not null; + value = _TextPresentationElement; + return _TextPresentationElement is not null; case "concentration": - value = Concentration; - return Concentration is not null; + value = _Concentration; + return _Concentration is not null; case "textConcentration": - value = TextConcentrationElement; - return TextConcentrationElement is not null; + value = _TextConcentrationElement; + return _TextConcentrationElement is not null; case "measurementPoint": - value = MeasurementPointElement; - return MeasurementPointElement is not null; + value = _MeasurementPointElement; + return _MeasurementPointElement is not null; case "country": - value = Country; - return Country?.Any() == true; + value = _Country; + return _Country?.Any() == true; case "referenceStrength": - value = ReferenceStrength; - return ReferenceStrength?.Any() == true; + value = _ReferenceStrength; + return _ReferenceStrength?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "presentation": - Presentation = (Hl7.Fhir.Model.DataType)value; + Presentation = (Hl7.Fhir.Model.DataType?)value; return this; case "textPresentation": - TextPresentationElement = (Hl7.Fhir.Model.FhirString)value; + TextPresentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "concentration": - Concentration = (Hl7.Fhir.Model.DataType)value; + Concentration = (Hl7.Fhir.Model.DataType?)value; return this; case "textConcentration": - TextConcentrationElement = (Hl7.Fhir.Model.FhirString)value; + TextConcentrationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "measurementPoint": - MeasurementPointElement = (Hl7.Fhir.Model.FhirString)value; + MeasurementPointElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - Country = (List)value; + Country = (List?)value!; return this; case "referenceStrength": - ReferenceStrength = (List)value; + ReferenceStrength = (List?)value!; return this; default: return base.SetValue(key, value); @@ -615,13 +594,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Presentation is not null) yield return new KeyValuePair("presentation",Presentation); - if (TextPresentationElement is not null) yield return new KeyValuePair("textPresentation",TextPresentationElement); - if (Concentration is not null) yield return new KeyValuePair("concentration",Concentration); - if (TextConcentrationElement is not null) yield return new KeyValuePair("textConcentration",TextConcentrationElement); - if (MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",MeasurementPointElement); - if (Country?.Any() == true) yield return new KeyValuePair("country",Country); - if (ReferenceStrength?.Any() == true) yield return new KeyValuePair("referenceStrength",ReferenceStrength); + if (_Presentation is not null) yield return new KeyValuePair("presentation",_Presentation); + if (_TextPresentationElement is not null) yield return new KeyValuePair("textPresentation",_TextPresentationElement); + if (_Concentration is not null) yield return new KeyValuePair("concentration",_Concentration); + if (_TextConcentrationElement is not null) yield return new KeyValuePair("textConcentration",_TextConcentrationElement); + if (_MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",_MeasurementPointElement); + if (_Country?.Any() == true) yield return new KeyValuePair("country",_Country); + if (_ReferenceStrength?.Any() == true) yield return new KeyValuePair("referenceStrength",_ReferenceStrength); } } @@ -648,13 +627,13 @@ public partial class ReferenceStrengthComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", InSummary=true, Order=40)] [Binding("SNOMEDCTSubstanceCodes")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Substance + public Hl7.Fhir.Model.CodeableReference? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableReference _Substance; + private Hl7.Fhir.Model.CodeableReference? _Substance; /// /// Strength expressed in terms of a reference substance. @@ -664,41 +643,38 @@ public Hl7.Fhir.Model.CodeableReference Substance [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Strength + public Hl7.Fhir.Model.DataType? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.DataType _Strength; + private Hl7.Fhir.Model.DataType? _Strength; /// /// When strength is measured at a particular point or distance. /// [FhirElement("measurementPoint", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MeasurementPointElement + public Hl7.Fhir.Model.FhirString? MeasurementPointElement { get { return _MeasurementPointElement; } set { _MeasurementPointElement = value; OnPropertyChanged("MeasurementPointElement"); } } - private Hl7.Fhir.Model.FhirString _MeasurementPointElement; + private Hl7.Fhir.Model.FhirString? _MeasurementPointElement; /// /// When strength is measured at a particular point or distance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeasurementPoint + public string? MeasurementPoint { - get { return MeasurementPointElement != null ? MeasurementPointElement.Value : null; } + get => _MeasurementPointElement?.Value; set { - if (value == null) - MeasurementPointElement = null; - else - MeasurementPointElement = new Hl7.Fhir.Model.FhirString(value); + MeasurementPointElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MeasurementPoint"); } } @@ -712,26 +688,22 @@ public string MeasurementPoint [DataMember] public List Country { - get { if(_Country==null) _Country = new List(); return _Country; } + get => _Country ?? new List(); set { _Country = value; OnPropertyChanged("Country"); } } - private List _Country; + private List? _Country; protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceStrengthComponent; - - if (dest == null) - { + if(other is not ReferenceStrengthComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableReference)Substance.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.DataType)Strength.DeepCopyInternal(); - if(MeasurementPointElement != null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)MeasurementPointElement.DeepCopyInternal(); - if(Country.Any()) dest.Country = new List(Country.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableReference)_Substance.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.DataType)_Strength.DeepCopyInternal(); + if(_MeasurementPointElement is not null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)_MeasurementPointElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = new List(_Country.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -743,55 +715,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceStrengthComponent; - if(otherT == null) return false; + if(other is not ReferenceStrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; - if(!comparer.Equals(MeasurementPointElement, otherT.MeasurementPointElement)) return false; - if(!comparer.ListEquals(Country, otherT.Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; + if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; + if(!comparer.ListEquals(_Country, otherT._Country)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; case "measurementPoint": - value = MeasurementPointElement; - return MeasurementPointElement is not null; + value = _MeasurementPointElement; + return _MeasurementPointElement is not null; case "country": - value = Country; - return Country?.Any() == true; + value = _Country; + return _Country?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableReference)value; + Substance = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.DataType)value; + Strength = (Hl7.Fhir.Model.DataType?)value; return this; case "measurementPoint": - MeasurementPointElement = (Hl7.Fhir.Model.FhirString)value; + MeasurementPointElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - Country = (List)value; + Country = (List?)value!; return this; default: return base.SetValue(key, value); @@ -802,10 +774,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); - if (MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",MeasurementPointElement); - if (Country?.Any() == true) yield return new KeyValuePair("country",Country); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); + if (_MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",_MeasurementPointElement); + if (_Country?.Any() == true) yield return new KeyValuePair("country",_Country); } } @@ -815,13 +787,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// draft | active | retired | unknown. @@ -831,13 +803,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -846,13 +818,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -867,11 +836,11 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List For { - get { if(_For==null) _For = new List(); return _For; } + get => _For ?? new List(); set { _For = value; OnPropertyChanged("For"); } } - private List _For; + private List? _For; /// /// Purpose of the ingredient within the product, e.g. active, inactive. @@ -880,13 +849,13 @@ public List For [Binding("IngredientRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Precise action within the drug product, e.g. antioxidant, alkalizing agent. @@ -897,24 +866,24 @@ public Hl7.Fhir.Model.CodeableConcept Role [DataMember] public List Function { - get { if(_Function==null) _Function = new List(); return _Function; } + get => _Function ?? new List(); set { _Function = value; OnPropertyChanged("Function"); } } - private List _Function; + private List? _Function; /// /// If the ingredient is a known or suspected allergen. /// [FhirElement("allergenicIndicator", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? AllergenicIndicatorElement { get { return _AllergenicIndicatorElement; } set { _AllergenicIndicatorElement = value; OnPropertyChanged("AllergenicIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllergenicIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _AllergenicIndicatorElement; /// /// If the ingredient is a known or suspected allergen @@ -923,13 +892,10 @@ public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement [IgnoreDataMember] public bool? AllergenicIndicator { - get { return AllergenicIndicatorElement != null ? AllergenicIndicatorElement.Value : null; } + get => _AllergenicIndicatorElement?.Value; set { - if (value == null) - AllergenicIndicatorElement = null; - else - AllergenicIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllergenicIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllergenicIndicator"); } } @@ -942,11 +908,11 @@ public bool? AllergenicIndicator [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// The substance that comprises this ingredient. @@ -954,34 +920,30 @@ public List Manufacturer [FhirElement("substance", InSummary=true, Order=160)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Ingredient.SubstanceComponent Substance + public Hl7.Fhir.Model.Ingredient.SubstanceComponent? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.Ingredient.SubstanceComponent _Substance; + private Hl7.Fhir.Model.Ingredient.SubstanceComponent? _Substance; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Ingredient; - - if (dest == null) - { + if(other is not Ingredient dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(For.Any()) dest.For = new List(For.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Function.Any()) dest.Function = new List(Function.DeepCopyInternal()); - if(AllergenicIndicatorElement != null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)AllergenicIndicatorElement.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent)Substance.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_For is not null) dest.For = new List(_For.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Function is not null) dest.Function = new List(_Function.DeepCopyInternal()); + if(_AllergenicIndicatorElement is not null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_AllergenicIndicatorElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent)_Substance.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -993,83 +955,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Ingredient; - if(otherT == null) return false; + if(other is not Ingredient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(For, otherT.For)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.ListEquals(Function, otherT.Function)) return false; - if(!comparer.Equals(AllergenicIndicatorElement, otherT.AllergenicIndicatorElement)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_For, otherT._For)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.ListEquals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_Substance, otherT._Substance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "for": - value = For; - return For?.Any() == true; + value = _For; + return _For?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "function": - value = Function; - return Function?.Any() == true; + value = _Function; + return _Function?.Any() == true; case "allergenicIndicator": - value = AllergenicIndicatorElement; - return AllergenicIndicatorElement is not null; + value = _AllergenicIndicatorElement; + return _AllergenicIndicatorElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "for": - For = (List)value; + For = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "function": - Function = (List)value; + Function = (List?)value!; return this; case "allergenicIndicator": - AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "substance": - Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent)value; + Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent?)value; return this; default: return base.SetValue(key, value); @@ -1080,14 +1042,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (For?.Any() == true) yield return new KeyValuePair("for",For); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Function?.Any() == true) yield return new KeyValuePair("function",Function); - if (AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",AllergenicIndicatorElement); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Substance is not null) yield return new KeyValuePair("substance",Substance); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_For?.Any() == true) yield return new KeyValuePair("for",_For); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Function?.Any() == true) yield return new KeyValuePair("function",_Function); + if (_AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",_AllergenicIndicatorElement); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs index c0991c951..fae5e683b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -107,26 +110,26 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("purpose", Order=40)] [Binding("ContactPartyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Purpose + public Hl7.Fhir.Model.CodeableConcept? Purpose { get { return _Purpose; } set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private Hl7.Fhir.Model.CodeableConcept _Purpose; + private Hl7.Fhir.Model.CodeableConcept? _Purpose; /// /// A name associated with the contact. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// Contact details (telephone, email, etc.) for a contact. @@ -136,39 +139,35 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Visiting or postal addresses for the contact. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Purpose != null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)Purpose.DeepCopyInternal(); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); + if(_Purpose is not null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)_Purpose.DeepCopyInternal(); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,55 +179,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Purpose, otherT.Purpose)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = Purpose; - return Purpose is not null; + value = _Purpose; + return _Purpose is not null; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - Purpose = (Hl7.Fhir.Model.CodeableConcept)value; + Purpose = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; default: return base.SetValue(key, value); @@ -239,10 +238,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Purpose is not null) yield return new KeyValuePair("purpose",Purpose); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); + if (_Purpose is not null) yield return new KeyValuePair("purpose",_Purpose); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); } } @@ -269,13 +268,13 @@ public partial class CoverageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// What networks provide coverage. @@ -287,11 +286,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// List of benefits. @@ -301,25 +300,21 @@ public List Network [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageComponent; - - if (dest == null) - { + if(other is not CoverageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -331,48 +326,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageComponent; - if(otherT == null) return false; + if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -383,9 +378,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); } } @@ -412,41 +407,38 @@ public partial class CoverageBenefitComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Referral requirements. /// [FhirElement("requirement", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RequirementElement + public Hl7.Fhir.Model.FhirString? RequirementElement { get { return _RequirementElement; } set { _RequirementElement = value; OnPropertyChanged("RequirementElement"); } } - private Hl7.Fhir.Model.FhirString _RequirementElement; + private Hl7.Fhir.Model.FhirString? _RequirementElement; /// /// Referral requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirement + public string? Requirement { - get { return RequirementElement != null ? RequirementElement.Value : null; } + get => _RequirementElement?.Value; set { - if (value == null) - RequirementElement = null; - else - RequirementElement = new Hl7.Fhir.Model.FhirString(value); + RequirementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Requirement"); } } @@ -459,25 +451,21 @@ public string Requirement [DataMember] public List Limit { - get { if(_Limit==null) _Limit = new List(); return _Limit; } + get => _Limit ?? new List(); set { _Limit = value; OnPropertyChanged("Limit"); } } - private List _Limit; + private List? _Limit; protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageBenefitComponent; - - if (dest == null) - { + if(other is not CoverageBenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RequirementElement != null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)RequirementElement.DeepCopyInternal(); - if(Limit.Any()) dest.Limit = new List(Limit.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RequirementElement is not null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)_RequirementElement.DeepCopyInternal(); + if(_Limit is not null) dest.Limit = new List(_Limit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -489,48 +477,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageBenefitComponent; - if(otherT == null) return false; + if(other is not CoverageBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RequirementElement, otherT.RequirementElement)) return false; - if(!comparer.ListEquals(Limit, otherT.Limit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; + if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "requirement": - value = RequirementElement; - return RequirementElement is not null; + value = _RequirementElement; + return _RequirementElement is not null; case "limit": - value = Limit; - return Limit?.Any() == true; + value = _Limit; + return _Limit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "requirement": - RequirementElement = (Hl7.Fhir.Model.FhirString)value; + RequirementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "limit": - Limit = (List)value; + Limit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -541,9 +529,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RequirementElement is not null) yield return new KeyValuePair("requirement",RequirementElement); - if (Limit?.Any() == true) yield return new KeyValuePair("limit",Limit); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RequirementElement is not null) yield return new KeyValuePair("requirement",_RequirementElement); + if (_Limit?.Any() == true) yield return new KeyValuePair("limit",_Limit); } } @@ -569,39 +557,35 @@ public partial class LimitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("value", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// Benefit limit details. /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as LimitComponent; - - if (dest == null) - { + if(other is not LimitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -613,41 +597,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LimitComponent; - if(otherT == null) return false; + if(other is not LimitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -658,8 +642,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -688,24 +672,24 @@ public partial class PlanComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Type of plan. /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where product applies. @@ -717,11 +701,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// What networks provide coverage. @@ -733,11 +717,11 @@ public List CoverageArea [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Overall costs. @@ -747,11 +731,11 @@ public List Network [DataMember] public List GeneralCost { - get { if(_GeneralCost==null) _GeneralCost = new List(); return _GeneralCost; } + get => _GeneralCost ?? new List(); set { _GeneralCost = value; OnPropertyChanged("GeneralCost"); } } - private List _GeneralCost; + private List? _GeneralCost; /// /// Specific costs. @@ -761,28 +745,24 @@ public List GeneralCost [DataMember] public List SpecificCost { - get { if(_SpecificCost==null) _SpecificCost = new List(); return _SpecificCost; } + get => _SpecificCost ?? new List(); set { _SpecificCost = value; OnPropertyChanged("SpecificCost"); } } - private List _SpecificCost; + private List? _SpecificCost; protected internal override void CopyToInternal(Base other) { - var dest = other as PlanComponent; - - if (dest == null) - { + if(other is not PlanComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(GeneralCost.Any()) dest.GeneralCost = new List(GeneralCost.DeepCopyInternal()); - if(SpecificCost.Any()) dest.SpecificCost = new List(SpecificCost.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_GeneralCost is not null) dest.GeneralCost = new List(_GeneralCost.DeepCopyInternal()); + if(_SpecificCost is not null) dest.SpecificCost = new List(_SpecificCost.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -794,69 +774,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanComponent; - if(otherT == null) return false; + if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(GeneralCost, otherT.GeneralCost)) return false; - if(!comparer.ListEquals(SpecificCost, otherT.SpecificCost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_GeneralCost, otherT._GeneralCost)) return false; + if(!comparer.ListEquals(_SpecificCost, otherT._SpecificCost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "generalCost": - value = GeneralCost; - return GeneralCost?.Any() == true; + value = _GeneralCost; + return _GeneralCost?.Any() == true; case "specificCost": - value = SpecificCost; - return SpecificCost?.Any() == true; + value = _SpecificCost; + return _SpecificCost?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "generalCost": - GeneralCost = (List)value; + GeneralCost = (List?)value!; return this; case "specificCost": - SpecificCost = (List)value; + SpecificCost = (List?)value!; return this; default: return base.SetValue(key, value); @@ -867,12 +847,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (GeneralCost?.Any() == true) yield return new KeyValuePair("generalCost",GeneralCost); - if (SpecificCost?.Any() == true) yield return new KeyValuePair("specificCost",SpecificCost); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_GeneralCost?.Any() == true) yield return new KeyValuePair("generalCost",_GeneralCost); + if (_SpecificCost?.Any() == true) yield return new KeyValuePair("specificCost",_SpecificCost); } } @@ -898,26 +878,26 @@ public partial class GeneralCostComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Number of enrollees. /// [FhirElement("groupSize", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt GroupSizeElement + public Hl7.Fhir.Model.PositiveInt? GroupSizeElement { get { return _GroupSizeElement; } set { _GroupSizeElement = value; OnPropertyChanged("GroupSizeElement"); } } - private Hl7.Fhir.Model.PositiveInt _GroupSizeElement; + private Hl7.Fhir.Model.PositiveInt? _GroupSizeElement; /// /// Number of enrollees @@ -926,13 +906,10 @@ public Hl7.Fhir.Model.PositiveInt GroupSizeElement [IgnoreDataMember] public int? GroupSize { - get { return GroupSizeElement != null ? GroupSizeElement.Value : null; } + get => _GroupSizeElement?.Value; set { - if (value == null) - GroupSizeElement = null; - else - GroupSizeElement = new Hl7.Fhir.Model.PositiveInt(value); + GroupSizeElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("GroupSize"); } } @@ -942,59 +919,52 @@ public int? GroupSize /// [FhirElement("cost", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Cost + public Hl7.Fhir.Model.Money? Cost { get { return _Cost; } set { _Cost = value; OnPropertyChanged("Cost"); } } - private Hl7.Fhir.Model.Money _Cost; + private Hl7.Fhir.Model.Money? _Cost; /// /// Additional cost information. /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional cost information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GeneralCostComponent; - - if (dest == null) - { + if(other is not GeneralCostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupSizeElement != null) dest.GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)GroupSizeElement.DeepCopyInternal(); - if(Cost != null) dest.Cost = (Hl7.Fhir.Model.Money)Cost.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupSizeElement is not null) dest.GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)_GroupSizeElement.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = (Hl7.Fhir.Model.Money)_Cost.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1006,55 +976,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GeneralCostComponent; - if(otherT == null) return false; + if(other is not GeneralCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupSizeElement, otherT.GroupSizeElement)) return false; - if(!comparer.Equals(Cost, otherT.Cost)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupSizeElement, otherT._GroupSizeElement)) return false; + if(!comparer.Equals(_Cost, otherT._Cost)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupSize": - value = GroupSizeElement; - return GroupSizeElement is not null; + value = _GroupSizeElement; + return _GroupSizeElement is not null; case "cost": - value = Cost; - return Cost is not null; + value = _Cost; + return _Cost is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupSize": - GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)value; + GroupSizeElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "cost": - Cost = (Hl7.Fhir.Model.Money)value; + Cost = (Hl7.Fhir.Model.Money?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1065,10 +1035,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupSizeElement is not null) yield return new KeyValuePair("groupSize",GroupSizeElement); - if (Cost is not null) yield return new KeyValuePair("cost",Cost); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupSizeElement is not null) yield return new KeyValuePair("groupSize",_GroupSizeElement); + if (_Cost is not null) yield return new KeyValuePair("cost",_Cost); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -1095,13 +1065,13 @@ public partial class SpecificCostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Benefits list. @@ -1111,24 +1081,20 @@ public Hl7.Fhir.Model.CodeableConcept Category [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; protected internal override void CopyToInternal(Base other) { - var dest = other as SpecificCostComponent; - - if (dest == null) - { + if(other is not SpecificCostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1140,41 +1106,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecificCostComponent; - if(otherT == null) return false; + if(other is not SpecificCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1185,8 +1151,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); } } @@ -1213,13 +1179,13 @@ public partial class PlanBenefitComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// List of the costs. @@ -1229,24 +1195,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Cost { - get { if(_Cost==null) _Cost = new List(); return _Cost; } + get => _Cost ?? new List(); set { _Cost = value; OnPropertyChanged("Cost"); } } - private List _Cost; + private List? _Cost; protected internal override void CopyToInternal(Base other) { - var dest = other as PlanBenefitComponent; - - if (dest == null) - { + if(other is not PlanBenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Cost.Any()) dest.Cost = new List(Cost.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = new List(_Cost.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1258,41 +1220,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanBenefitComponent; - if(otherT == null) return false; + if(other is not PlanBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Cost, otherT.Cost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "cost": - value = Cost; - return Cost?.Any() == true; + value = _Cost; + return _Cost?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cost": - Cost = (List)value; + Cost = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1303,8 +1265,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Cost?.Any() == true) yield return new KeyValuePair("cost",Cost); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Cost?.Any() == true) yield return new KeyValuePair("cost",_Cost); } } @@ -1331,13 +1293,13 @@ public partial class CostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// in-network | out-of-network | other. @@ -1345,13 +1307,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("applicability", Order=50)] [Binding("BenefitCostApplicability")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Applicability + public Hl7.Fhir.Model.CodeableConcept? Applicability { get { return _Applicability; } set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private Hl7.Fhir.Model.CodeableConcept _Applicability; + private Hl7.Fhir.Model.CodeableConcept? _Applicability; /// /// Additional information about the cost. @@ -1361,39 +1323,35 @@ public Hl7.Fhir.Model.CodeableConcept Applicability [DataMember] public List Qualifiers { - get { if(_Qualifiers==null) _Qualifiers = new List(); return _Qualifiers; } + get => _Qualifiers ?? new List(); set { _Qualifiers = value; OnPropertyChanged("Qualifiers"); } } - private List _Qualifiers; + private List? _Qualifiers; /// /// The actual cost value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CostComponent; - - if (dest == null) - { + if(other is not CostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Applicability != null) dest.Applicability = (Hl7.Fhir.Model.CodeableConcept)Applicability.DeepCopyInternal(); - if(Qualifiers.Any()) dest.Qualifiers = new List(Qualifiers.DeepCopyInternal()); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Applicability is not null) dest.Applicability = (Hl7.Fhir.Model.CodeableConcept)_Applicability.DeepCopyInternal(); + if(_Qualifiers is not null) dest.Qualifiers = new List(_Qualifiers.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1405,55 +1363,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostComponent; - if(otherT == null) return false; + if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(Qualifiers, otherT.Qualifiers)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_Qualifiers, otherT._Qualifiers)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "applicability": - value = Applicability; - return Applicability is not null; + value = _Applicability; + return _Applicability is not null; case "qualifiers": - value = Qualifiers; - return Qualifiers?.Any() == true; + value = _Qualifiers; + return _Qualifiers?.Any() == true; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "applicability": - Applicability = (Hl7.Fhir.Model.CodeableConcept)value; + Applicability = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualifiers": - Qualifiers = (List)value; + Qualifiers = (List?)value!; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -1464,10 +1422,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Applicability is not null) yield return new KeyValuePair("applicability",Applicability); - if (Qualifiers?.Any() == true) yield return new KeyValuePair("qualifiers",Qualifiers); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Applicability is not null) yield return new KeyValuePair("applicability",_Applicability); + if (_Qualifiers?.Any() == true) yield return new KeyValuePair("qualifiers",_Qualifiers); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1480,11 +1438,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -1493,13 +1451,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("PublicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1508,13 +1466,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1528,39 +1483,36 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Official name. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Official name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1573,24 +1525,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Alternate names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -1602,13 +1554,13 @@ public IEnumerable Alias /// [FhirElement("period", Order=140)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Plan issuer. @@ -1617,13 +1569,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OwnedBy + public Hl7.Fhir.Model.ResourceReference? OwnedBy { get { return _OwnedBy; } set { _OwnedBy = value; OnPropertyChanged("OwnedBy"); } } - private Hl7.Fhir.Model.ResourceReference _OwnedBy; + private Hl7.Fhir.Model.ResourceReference? _OwnedBy; /// /// Product administrator. @@ -1632,13 +1584,13 @@ public Hl7.Fhir.Model.ResourceReference OwnedBy [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference AdministeredBy + public Hl7.Fhir.Model.ResourceReference? AdministeredBy { get { return _AdministeredBy; } set { _AdministeredBy = value; OnPropertyChanged("AdministeredBy"); } } - private Hl7.Fhir.Model.ResourceReference _AdministeredBy; + private Hl7.Fhir.Model.ResourceReference? _AdministeredBy; /// /// Where product applies. @@ -1650,11 +1602,11 @@ public Hl7.Fhir.Model.ResourceReference AdministeredBy [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// Contact for the product. @@ -1664,11 +1616,11 @@ public List CoverageArea [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Technical endpoint. @@ -1680,11 +1632,11 @@ public List Contact [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// What networks are Included. @@ -1696,11 +1648,11 @@ public List Endpoint [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Coverage details. @@ -1710,11 +1662,11 @@ public List Network [DataMember] public List Coverage { - get { if(_Coverage==null) _Coverage = new List(); return _Coverage; } + get => _Coverage ?? new List(); set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private List _Coverage; + private List? _Coverage; /// /// Plan details. @@ -1724,38 +1676,34 @@ public List Coverage [DataMember] public List Plan { - get { if(_Plan==null) _Plan = new List(); return _Plan; } + get => _Plan ?? new List(); set { _Plan = value; OnPropertyChanged("Plan"); } } - private List _Plan; + private List? _Plan; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as InsurancePlan; - - if (dest == null) - { + if(other is not InsurancePlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(OwnedBy != null) dest.OwnedBy = (Hl7.Fhir.Model.ResourceReference)OwnedBy.DeepCopyInternal(); - if(AdministeredBy != null) dest.AdministeredBy = (Hl7.Fhir.Model.ResourceReference)AdministeredBy.DeepCopyInternal(); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Coverage.Any()) dest.Coverage = new List(Coverage.DeepCopyInternal()); - if(Plan.Any()) dest.Plan = new List(Plan.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_OwnedBy is not null) dest.OwnedBy = (Hl7.Fhir.Model.ResourceReference)_OwnedBy.DeepCopyInternal(); + if(_AdministeredBy is not null) dest.AdministeredBy = (Hl7.Fhir.Model.ResourceReference)_AdministeredBy.DeepCopyInternal(); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = new List(_Coverage.DeepCopyInternal()); + if(_Plan is not null) dest.Plan = new List(_Plan.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1767,125 +1715,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsurancePlan; - if(otherT == null) return false; + if(other is not InsurancePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(OwnedBy, otherT.OwnedBy)) return false; - if(!comparer.Equals(AdministeredBy, otherT.AdministeredBy)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Coverage, otherT.Coverage)) return false; - if(!comparer.ListEquals(Plan, otherT.Plan)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_OwnedBy, otherT._OwnedBy)) return false; + if(!comparer.Equals(_AdministeredBy, otherT._AdministeredBy)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; + if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "ownedBy": - value = OwnedBy; - return OwnedBy is not null; + value = _OwnedBy; + return _OwnedBy is not null; case "administeredBy": - value = AdministeredBy; - return AdministeredBy is not null; + value = _AdministeredBy; + return _AdministeredBy is not null; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "coverage": - value = Coverage; - return Coverage?.Any() == true; + value = _Coverage; + return _Coverage?.Any() == true; case "plan": - value = Plan; - return Plan?.Any() == true; + value = _Plan; + return _Plan?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "ownedBy": - OwnedBy = (Hl7.Fhir.Model.ResourceReference)value; + OwnedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "administeredBy": - AdministeredBy = (Hl7.Fhir.Model.ResourceReference)value; + AdministeredBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "coverage": - Coverage = (List)value; + Coverage = (List?)value!; return this; case "plan": - Plan = (List)value; + Plan = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1896,20 +1844,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (OwnedBy is not null) yield return new KeyValuePair("ownedBy",OwnedBy); - if (AdministeredBy is not null) yield return new KeyValuePair("administeredBy",AdministeredBy); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Coverage?.Any() == true) yield return new KeyValuePair("coverage",Coverage); - if (Plan?.Any() == true) yield return new KeyValuePair("plan",Plan); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_OwnedBy is not null) yield return new KeyValuePair("ownedBy",_OwnedBy); + if (_AdministeredBy is not null) yield return new KeyValuePair("administeredBy",_AdministeredBy); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Coverage?.Any() == true) yield return new KeyValuePair("coverage",_Coverage); + if (_Plan?.Any() == true) yield return new KeyValuePair("plan",_Plan); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs index 1dd45437d..9eda55df1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -120,13 +123,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("role", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Individual who was involved. @@ -136,26 +139,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Practitioner","Organization","Patient","PractitionerRole","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -167,41 +166,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -212,8 +211,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -239,13 +238,13 @@ public partial class LineItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("sequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Sequence number of line item @@ -254,13 +253,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -274,13 +270,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType ChargeItem + public Hl7.Fhir.Model.DataType? ChargeItem { get { return _ChargeItem; } set { _ChargeItem = value; OnPropertyChanged("ChargeItem"); } } - private Hl7.Fhir.Model.DataType _ChargeItem; + private Hl7.Fhir.Model.DataType? _ChargeItem; /// /// Components of total line item price. @@ -290,25 +286,21 @@ public Hl7.Fhir.Model.DataType ChargeItem [DataMember] public List PriceComponent { - get { if(_PriceComponent==null) _PriceComponent = new List(); return _PriceComponent; } + get => _PriceComponent ?? new List(); set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } - private List _PriceComponent; + private List? _PriceComponent; protected internal override void CopyToInternal(Base other) { - var dest = other as LineItemComponent; - - if (dest == null) - { + if(other is not LineItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(ChargeItem != null) dest.ChargeItem = (Hl7.Fhir.Model.DataType)ChargeItem.DeepCopyInternal(); - if(PriceComponent.Any()) dest.PriceComponent = new List(PriceComponent.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_ChargeItem is not null) dest.ChargeItem = (Hl7.Fhir.Model.DataType)_ChargeItem.DeepCopyInternal(); + if(_PriceComponent is not null) dest.PriceComponent = new List(_PriceComponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -320,48 +312,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LineItemComponent; - if(otherT == null) return false; + if(other is not LineItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(ChargeItem, otherT.ChargeItem)) return false; - if(!comparer.ListEquals(PriceComponent, otherT.PriceComponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_ChargeItem, otherT._ChargeItem)) return false; + if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "chargeItem": - value = ChargeItem; - return ChargeItem is not null; + value = _ChargeItem; + return _ChargeItem is not null; case "priceComponent": - value = PriceComponent; - return PriceComponent?.Any() == true; + value = _PriceComponent; + return _PriceComponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "chargeItem": - ChargeItem = (Hl7.Fhir.Model.DataType)value; + ChargeItem = (Hl7.Fhir.Model.DataType?)value; return this; case "priceComponent": - PriceComponent = (List)value; + PriceComponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -372,9 +364,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (ChargeItem is not null) yield return new KeyValuePair("chargeItem",ChargeItem); - if (PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",PriceComponent); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_ChargeItem is not null) yield return new KeyValuePair("chargeItem",_ChargeItem); + if (_PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",_PriceComponent); } } @@ -403,13 +395,13 @@ public partial class PriceComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("InvoicePriceComponentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// base | surcharge | deduction | discount | tax | informational @@ -418,13 +410,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.InvoicePriceComponentType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -434,26 +423,26 @@ public Hl7.Fhir.Model.InvoicePriceComponentType? Type /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Factor used for calculating this component. /// [FhirElement("factor", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Factor used for calculating this component @@ -462,13 +451,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -478,28 +464,24 @@ public decimal? Factor /// [FhirElement("amount", Order=70)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as PriceComponentComponent; - - if (dest == null) - { + if(other is not PriceComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -511,55 +493,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PriceComponentComponent; - if(otherT == null) return false; + if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -570,10 +552,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -586,11 +568,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | issued | balanced | cancelled | entered-in-error. @@ -600,13 +582,13 @@ public List Identifier [Binding("InvoiceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | issued | balanced | cancelled | entered-in-error @@ -615,13 +597,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Invoice.InvoiceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -631,28 +610,25 @@ public Hl7.Fhir.Model.Invoice.InvoiceStatus? Status /// [FhirElement("cancelledReason", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CancelledReasonElement + public Hl7.Fhir.Model.FhirString? CancelledReasonElement { get { return _CancelledReasonElement; } set { _CancelledReasonElement = value; OnPropertyChanged("CancelledReasonElement"); } } - private Hl7.Fhir.Model.FhirString _CancelledReasonElement; + private Hl7.Fhir.Model.FhirString? _CancelledReasonElement; /// /// Reason for cancellation of this Invoice /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CancelledReason + public string? CancelledReason { - get { return CancelledReasonElement != null ? CancelledReasonElement.Value : null; } + get => _CancelledReasonElement?.Value; set { - if (value == null) - CancelledReasonElement = null; - else - CancelledReasonElement = new Hl7.Fhir.Model.FhirString(value); + CancelledReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CancelledReason"); } } @@ -662,13 +638,13 @@ public string CancelledReason /// [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient(s) of goods and services. @@ -677,13 +653,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Recipient of this invoice. @@ -692,41 +668,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Invoice date / posting date. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Invoice date / posting date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -739,11 +712,11 @@ public string Date [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Issuing Organization of Invoice. @@ -752,13 +725,13 @@ public List Participant [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; /// /// Account that is being balanced. @@ -767,13 +740,13 @@ public Hl7.Fhir.Model.ResourceReference Issuer [CLSCompliant(false)] [References("Account")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Account + public Hl7.Fhir.Model.ResourceReference? Account { get { return _Account; } set { _Account = value; OnPropertyChanged("Account"); } } - private Hl7.Fhir.Model.ResourceReference _Account; + private Hl7.Fhir.Model.ResourceReference? _Account; /// /// Line items of this Invoice. @@ -783,11 +756,11 @@ public Hl7.Fhir.Model.ResourceReference Account [DataMember] public List LineItem { - get { if(_LineItem==null) _LineItem = new List(); return _LineItem; } + get => _LineItem ?? new List(); set { _LineItem = value; OnPropertyChanged("LineItem"); } } - private List _LineItem; + private List? _LineItem; /// /// Components of Invoice total. @@ -797,65 +770,62 @@ public List LineItem [DataMember] public List TotalPriceComponent { - get { if(_TotalPriceComponent==null) _TotalPriceComponent = new List(); return _TotalPriceComponent; } + get => _TotalPriceComponent ?? new List(); set { _TotalPriceComponent = value; OnPropertyChanged("TotalPriceComponent"); } } - private List _TotalPriceComponent; + private List? _TotalPriceComponent; /// /// Net total of this Invoice. /// [FhirElement("totalNet", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Money TotalNet + public Hl7.Fhir.Model.Money? TotalNet { get { return _TotalNet; } set { _TotalNet = value; OnPropertyChanged("TotalNet"); } } - private Hl7.Fhir.Model.Money _TotalNet; + private Hl7.Fhir.Model.Money? _TotalNet; /// /// Gross total of this Invoice. /// [FhirElement("totalGross", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Money TotalGross + public Hl7.Fhir.Model.Money? TotalGross { get { return _TotalGross; } set { _TotalGross = value; OnPropertyChanged("TotalGross"); } } - private Hl7.Fhir.Model.Money _TotalGross; + private Hl7.Fhir.Model.Money? _TotalGross; /// /// Payment details. /// [FhirElement("paymentTerms", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown PaymentTermsElement + public Hl7.Fhir.Model.Markdown? PaymentTermsElement { get { return _PaymentTermsElement; } set { _PaymentTermsElement = value; OnPropertyChanged("PaymentTermsElement"); } } - private Hl7.Fhir.Model.Markdown _PaymentTermsElement; + private Hl7.Fhir.Model.Markdown? _PaymentTermsElement; /// /// Payment details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentTerms + public string? PaymentTerms { - get { return PaymentTermsElement != null ? PaymentTermsElement.Value : null; } + get => _PaymentTermsElement?.Value; set { - if (value == null) - PaymentTermsElement = null; - else - PaymentTermsElement = new Hl7.Fhir.Model.Markdown(value); + PaymentTermsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PaymentTerms"); } } @@ -868,40 +838,36 @@ public string PaymentTerms [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Invoice; - - if (dest == null) - { + if(other is not Invoice dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CancelledReasonElement != null) dest.CancelledReasonElement = (Hl7.Fhir.Model.FhirString)CancelledReasonElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); - if(Account != null) dest.Account = (Hl7.Fhir.Model.ResourceReference)Account.DeepCopyInternal(); - if(LineItem.Any()) dest.LineItem = new List(LineItem.DeepCopyInternal()); - if(TotalPriceComponent.Any()) dest.TotalPriceComponent = new List(TotalPriceComponent.DeepCopyInternal()); - if(TotalNet != null) dest.TotalNet = (Hl7.Fhir.Model.Money)TotalNet.DeepCopyInternal(); - if(TotalGross != null) dest.TotalGross = (Hl7.Fhir.Model.Money)TotalGross.DeepCopyInternal(); - if(PaymentTermsElement != null) dest.PaymentTermsElement = (Hl7.Fhir.Model.Markdown)PaymentTermsElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CancelledReasonElement is not null) dest.CancelledReasonElement = (Hl7.Fhir.Model.FhirString)_CancelledReasonElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); + if(_Account is not null) dest.Account = (Hl7.Fhir.Model.ResourceReference)_Account.DeepCopyInternal(); + if(_LineItem is not null) dest.LineItem = new List(_LineItem.DeepCopyInternal()); + if(_TotalPriceComponent is not null) dest.TotalPriceComponent = new List(_TotalPriceComponent.DeepCopyInternal()); + if(_TotalNet is not null) dest.TotalNet = (Hl7.Fhir.Model.Money)_TotalNet.DeepCopyInternal(); + if(_TotalGross is not null) dest.TotalGross = (Hl7.Fhir.Model.Money)_TotalGross.DeepCopyInternal(); + if(_PaymentTermsElement is not null) dest.PaymentTermsElement = (Hl7.Fhir.Model.Markdown)_PaymentTermsElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -913,139 +879,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Invoice; - if(otherT == null) return false; + if(other is not Invoice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CancelledReasonElement, otherT.CancelledReasonElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; - if(!comparer.Equals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(LineItem, otherT.LineItem)) return false; - if(!comparer.ListEquals(TotalPriceComponent, otherT.TotalPriceComponent)) return false; - if(!comparer.Equals(TotalNet, otherT.TotalNet)) return false; - if(!comparer.Equals(TotalGross, otherT.TotalGross)) return false; - if(!comparer.Equals(PaymentTermsElement, otherT.PaymentTermsElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CancelledReasonElement, otherT._CancelledReasonElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; + if(!comparer.Equals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_LineItem, otherT._LineItem)) return false; + if(!comparer.ListEquals(_TotalPriceComponent, otherT._TotalPriceComponent)) return false; + if(!comparer.Equals(_TotalNet, otherT._TotalNet)) return false; + if(!comparer.Equals(_TotalGross, otherT._TotalGross)) return false; + if(!comparer.Equals(_PaymentTermsElement, otherT._PaymentTermsElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "cancelledReason": - value = CancelledReasonElement; - return CancelledReasonElement is not null; + value = _CancelledReasonElement; + return _CancelledReasonElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; case "account": - value = Account; - return Account is not null; + value = _Account; + return _Account is not null; case "lineItem": - value = LineItem; - return LineItem?.Any() == true; + value = _LineItem; + return _LineItem?.Any() == true; case "totalPriceComponent": - value = TotalPriceComponent; - return TotalPriceComponent?.Any() == true; + value = _TotalPriceComponent; + return _TotalPriceComponent?.Any() == true; case "totalNet": - value = TotalNet; - return TotalNet is not null; + value = _TotalNet; + return _TotalNet is not null; case "totalGross": - value = TotalGross; - return TotalGross is not null; + value = _TotalGross; + return _TotalGross is not null; case "paymentTerms": - value = PaymentTermsElement; - return PaymentTermsElement is not null; + value = _PaymentTermsElement; + return _PaymentTermsElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "cancelledReason": - CancelledReasonElement = (Hl7.Fhir.Model.FhirString)value; + CancelledReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "account": - Account = (Hl7.Fhir.Model.ResourceReference)value; + Account = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lineItem": - LineItem = (List)value; + LineItem = (List?)value!; return this; case "totalPriceComponent": - TotalPriceComponent = (List)value; + TotalPriceComponent = (List?)value!; return this; case "totalNet": - TotalNet = (Hl7.Fhir.Model.Money)value; + TotalNet = (Hl7.Fhir.Model.Money?)value; return this; case "totalGross": - TotalGross = (Hl7.Fhir.Model.Money)value; + TotalGross = (Hl7.Fhir.Model.Money?)value; return this; case "paymentTerms": - PaymentTermsElement = (Hl7.Fhir.Model.Markdown)value; + PaymentTermsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1056,22 +1022,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CancelledReasonElement is not null) yield return new KeyValuePair("cancelledReason",CancelledReasonElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); - if (Account is not null) yield return new KeyValuePair("account",Account); - if (LineItem?.Any() == true) yield return new KeyValuePair("lineItem",LineItem); - if (TotalPriceComponent?.Any() == true) yield return new KeyValuePair("totalPriceComponent",TotalPriceComponent); - if (TotalNet is not null) yield return new KeyValuePair("totalNet",TotalNet); - if (TotalGross is not null) yield return new KeyValuePair("totalGross",TotalGross); - if (PaymentTermsElement is not null) yield return new KeyValuePair("paymentTerms",PaymentTermsElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CancelledReasonElement is not null) yield return new KeyValuePair("cancelledReason",_CancelledReasonElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); + if (_Account is not null) yield return new KeyValuePair("account",_Account); + if (_LineItem?.Any() == true) yield return new KeyValuePair("lineItem",_LineItem); + if (_TotalPriceComponent?.Any() == true) yield return new KeyValuePair("totalPriceComponent",_TotalPriceComponent); + if (_TotalNet is not null) yield return new KeyValuePair("totalNet",_TotalNet); + if (_TotalGross is not null) yield return new KeyValuePair("totalGross",_TotalGross); + if (_PaymentTermsElement is not null) yield return new KeyValuePair("paymentTerms",_PaymentTermsElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Library.cs b/src/Hl7.Fhir.R4B/Model/Generated/Library.cs index 22a4000a7..238aa128e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Library.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Library : Hl7.Fhir.Model.DomainResource, IIdentifiable [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this library, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the library. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this library (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this library (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -202,28 +193,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -236,13 +224,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -251,13 +239,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -267,13 +252,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -282,13 +267,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -300,13 +282,13 @@ public bool? Experimental [Binding("LibraryType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Type of individual the library content is focused on. @@ -317,41 +299,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -361,28 +340,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -395,39 +371,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the library. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -440,11 +413,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for library (if applicable). @@ -455,39 +428,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this library is defined. /// [FhirElement("purpose", Order=250, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this library is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -497,28 +467,25 @@ public string Purpose /// [FhirElement("usage", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -528,28 +495,25 @@ public string Usage /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -559,28 +523,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the library was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -590,28 +551,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the library was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -621,13 +579,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -638,11 +596,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -652,11 +610,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -666,11 +624,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -680,11 +638,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -694,11 +652,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -708,11 +666,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Parameters defined by the library. @@ -722,11 +680,11 @@ public List RelatedArtifact [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// What data is referenced by this library. @@ -736,11 +694,11 @@ public List Parameter [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; /// /// Contents of the library, either embedded or referenced. @@ -750,55 +708,51 @@ public List DataRequirement [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Library; - - if (dest == null) - { + if(other is not Library dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -810,244 +764,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Library; - if(otherT == null) return false; + if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1058,37 +1012,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs index 3c849eb84..22df072d2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -111,13 +114,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [Binding("LinkageType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// source | alternate | historical @@ -126,13 +129,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Linkage.LinkageType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -145,26 +145,22 @@ public Hl7.Fhir.Model.Linkage.LinkageType? Type [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -176,41 +172,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -221,8 +217,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -232,13 +228,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("active", InSummary=true, Order=90, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this linkage assertion is active or not @@ -247,13 +243,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -265,13 +258,13 @@ public bool? Active [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Item to be linked. @@ -281,25 +274,21 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as Linkage; - - if (dest == null) - { + if(other is not Linkage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -311,48 +300,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Linkage; - if(otherT == null) return false; + if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -363,9 +352,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/List.cs b/src/Hl7.Fhir.R4B/Model/Generated/List.cs index 5dc9152fa..6f21c6c19 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/List.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -107,26 +110,26 @@ public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("flag", Order=40)] [Binding("ListItemFlag")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Flag + public Hl7.Fhir.Model.CodeableConcept? Flag { get { return _Flag; } set { _Flag = value; OnPropertyChanged("Flag"); } } - private Hl7.Fhir.Model.CodeableConcept _Flag; + private Hl7.Fhir.Model.CodeableConcept? _Flag; /// /// If this item is actually marked as deleted. /// [FhirElement("deleted", IsModifier=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DeletedElement + public Hl7.Fhir.Model.FhirBoolean? DeletedElement { get { return _DeletedElement; } set { _DeletedElement = value; OnPropertyChanged("DeletedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DeletedElement; + private Hl7.Fhir.Model.FhirBoolean? _DeletedElement; /// /// If this item is actually marked as deleted @@ -135,13 +138,10 @@ public Hl7.Fhir.Model.FhirBoolean DeletedElement [IgnoreDataMember] public bool? Deleted { - get { return DeletedElement != null ? DeletedElement.Value : null; } + get => _DeletedElement?.Value; set { - if (value == null) - DeletedElement = null; - else - DeletedElement = new Hl7.Fhir.Model.FhirBoolean(value); + DeletedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Deleted"); } } @@ -151,28 +151,25 @@ public bool? Deleted /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When item added to list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -185,28 +182,24 @@ public string Date [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Item + public Hl7.Fhir.Model.ResourceReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.ResourceReference _Item; + private Hl7.Fhir.Model.ResourceReference? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as EntryComponent; - - if (dest == null) - { + if(other is not EntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Flag != null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)Flag.DeepCopyInternal(); - if(DeletedElement != null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)DeletedElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.ResourceReference)Item.DeepCopyInternal(); + if(_Flag is not null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)_Flag.DeepCopyInternal(); + if(_DeletedElement is not null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)_DeletedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.ResourceReference)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -218,55 +211,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntryComponent; - if(otherT == null) return false; + if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Flag, otherT.Flag)) return false; - if(!comparer.Equals(DeletedElement, otherT.DeletedElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "flag": - value = Flag; - return Flag is not null; + value = _Flag; + return _Flag is not null; case "deleted": - value = DeletedElement; - return DeletedElement is not null; + value = _DeletedElement; + return _DeletedElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "flag": - Flag = (Hl7.Fhir.Model.CodeableConcept)value; + Flag = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "deleted": - DeletedElement = (Hl7.Fhir.Model.FhirBoolean)value; + DeletedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "item": - Item = (Hl7.Fhir.Model.ResourceReference)value; + Item = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -277,10 +270,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Flag is not null) yield return new KeyValuePair("flag",Flag); - if (DeletedElement is not null) yield return new KeyValuePair("deleted",DeletedElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Flag is not null) yield return new KeyValuePair("flag",_Flag); + if (_DeletedElement is not null) yield return new KeyValuePair("deleted",_DeletedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -293,11 +286,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | retired | entered-in-error. @@ -307,13 +300,13 @@ public List Identifier [Binding("ListStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | retired | entered-in-error @@ -322,13 +315,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.List.ListStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -341,13 +331,13 @@ public Hl7.Fhir.Model.List.ListStatus? Status [Binding("ListMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -356,13 +346,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -372,28 +359,25 @@ public Hl7.Fhir.Model.ListMode? Mode /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Descriptive name for the list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -404,13 +388,13 @@ public string Title [FhirElement("code", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [Binding("ListPurpose")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// If all resources have the same subject. @@ -419,13 +403,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Context in which list created. @@ -434,41 +418,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the list was prepared. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the list was prepared /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -480,13 +461,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// What order the list has. @@ -494,13 +475,13 @@ public Hl7.Fhir.Model.ResourceReference Source [FhirElement("orderedBy", Order=180)] [Binding("ListOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// Comments about the list. @@ -510,11 +491,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Entries in the list. @@ -524,11 +505,11 @@ public List Note [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why list is empty. @@ -536,39 +517,35 @@ public List Entry [FhirElement("emptyReason", Order=210)] [Binding("ListEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as List; - - if (dest == null) - { + if(other is not List dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -580,118 +557,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as List; - if(otherT == null) return false; + if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -702,19 +679,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs index 399a6bd5a..b1e0c0845 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -131,13 +134,13 @@ public partial class PositionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("longitude", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LongitudeElement + public Hl7.Fhir.Model.FhirDecimal? LongitudeElement { get { return _LongitudeElement; } set { _LongitudeElement = value; OnPropertyChanged("LongitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LongitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LongitudeElement; /// /// Longitude with WGS84 datum @@ -146,13 +149,10 @@ public Hl7.Fhir.Model.FhirDecimal LongitudeElement [IgnoreDataMember] public decimal? Longitude { - get { return LongitudeElement != null ? LongitudeElement.Value : null; } + get => _LongitudeElement?.Value; set { - if (value == null) - LongitudeElement = null; - else - LongitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LongitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Longitude"); } } @@ -163,13 +163,13 @@ public decimal? Longitude [FhirElement("latitude", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LatitudeElement + public Hl7.Fhir.Model.FhirDecimal? LatitudeElement { get { return _LatitudeElement; } set { _LatitudeElement = value; OnPropertyChanged("LatitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LatitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LatitudeElement; /// /// Latitude with WGS84 datum @@ -178,13 +178,10 @@ public Hl7.Fhir.Model.FhirDecimal LatitudeElement [IgnoreDataMember] public decimal? Latitude { - get { return LatitudeElement != null ? LatitudeElement.Value : null; } + get => _LatitudeElement?.Value; set { - if (value == null) - LatitudeElement = null; - else - LatitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LatitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Latitude"); } } @@ -194,13 +191,13 @@ public decimal? Latitude /// [FhirElement("altitude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AltitudeElement + public Hl7.Fhir.Model.FhirDecimal? AltitudeElement { get { return _AltitudeElement; } set { _AltitudeElement = value; OnPropertyChanged("AltitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AltitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _AltitudeElement; /// /// Altitude with WGS84 datum @@ -209,30 +206,23 @@ public Hl7.Fhir.Model.FhirDecimal AltitudeElement [IgnoreDataMember] public decimal? Altitude { - get { return AltitudeElement != null ? AltitudeElement.Value : null; } + get => _AltitudeElement?.Value; set { - if (value == null) - AltitudeElement = null; - else - AltitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + AltitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Altitude"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PositionComponent; - - if (dest == null) - { + if(other is not PositionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LongitudeElement != null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)LongitudeElement.DeepCopyInternal(); - if(LatitudeElement != null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)LatitudeElement.DeepCopyInternal(); - if(AltitudeElement != null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)AltitudeElement.DeepCopyInternal(); + if(_LongitudeElement is not null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LongitudeElement.DeepCopyInternal(); + if(_LatitudeElement is not null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LatitudeElement.DeepCopyInternal(); + if(_AltitudeElement is not null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)_AltitudeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -244,48 +234,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PositionComponent; - if(otherT == null) return false; + if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LongitudeElement, otherT.LongitudeElement)) return false; - if(!comparer.Equals(LatitudeElement, otherT.LatitudeElement)) return false; - if(!comparer.Equals(AltitudeElement, otherT.AltitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; + if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "longitude": - value = LongitudeElement; - return LongitudeElement is not null; + value = _LongitudeElement; + return _LongitudeElement is not null; case "latitude": - value = LatitudeElement; - return LatitudeElement is not null; + value = _LatitudeElement; + return _LatitudeElement is not null; case "altitude": - value = AltitudeElement; - return AltitudeElement is not null; + value = _AltitudeElement; + return _AltitudeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "longitude": - LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LongitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "latitude": - LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LatitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "altitude": - AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + AltitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -296,9 +286,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LongitudeElement is not null) yield return new KeyValuePair("longitude",LongitudeElement); - if (LatitudeElement is not null) yield return new KeyValuePair("latitude",LatitudeElement); - if (AltitudeElement is not null) yield return new KeyValuePair("altitude",AltitudeElement); + if (_LongitudeElement is not null) yield return new KeyValuePair("longitude",_LongitudeElement); + if (_LatitudeElement is not null) yield return new KeyValuePair("latitude",_LatitudeElement); + if (_AltitudeElement is not null) yield return new KeyValuePair("altitude",_AltitudeElement); } } @@ -330,24 +320,24 @@ public partial class HoursOfOperationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -359,13 +349,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// The Location is open all day @@ -374,13 +364,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -390,28 +377,25 @@ public bool? AllDay /// [FhirElement("openingTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time OpeningTimeElement + public Hl7.Fhir.Model.Time? OpeningTimeElement { get { return _OpeningTimeElement; } set { _OpeningTimeElement = value; OnPropertyChanged("OpeningTimeElement"); } } - private Hl7.Fhir.Model.Time _OpeningTimeElement; + private Hl7.Fhir.Model.Time? _OpeningTimeElement; /// /// Time that the Location opens /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OpeningTime + public string? OpeningTime { - get { return OpeningTimeElement != null ? OpeningTimeElement.Value : null; } + get => _OpeningTimeElement?.Value; set { - if (value == null) - OpeningTimeElement = null; - else - OpeningTimeElement = new Hl7.Fhir.Model.Time(value); + OpeningTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("OpeningTime"); } } @@ -421,46 +405,39 @@ public string OpeningTime /// [FhirElement("closingTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time ClosingTimeElement + public Hl7.Fhir.Model.Time? ClosingTimeElement { get { return _ClosingTimeElement; } set { _ClosingTimeElement = value; OnPropertyChanged("ClosingTimeElement"); } } - private Hl7.Fhir.Model.Time _ClosingTimeElement; + private Hl7.Fhir.Model.Time? _ClosingTimeElement; /// /// Time that the Location closes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClosingTime + public string? ClosingTime { - get { return ClosingTimeElement != null ? ClosingTimeElement.Value : null; } + get => _ClosingTimeElement?.Value; set { - if (value == null) - ClosingTimeElement = null; - else - ClosingTimeElement = new Hl7.Fhir.Model.Time(value); + ClosingTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("ClosingTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as HoursOfOperationComponent; - - if (dest == null) - { + if(other is not HoursOfOperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(OpeningTimeElement != null) dest.OpeningTimeElement = (Hl7.Fhir.Model.Time)OpeningTimeElement.DeepCopyInternal(); - if(ClosingTimeElement != null) dest.ClosingTimeElement = (Hl7.Fhir.Model.Time)ClosingTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_OpeningTimeElement is not null) dest.OpeningTimeElement = (Hl7.Fhir.Model.Time)_OpeningTimeElement.DeepCopyInternal(); + if(_ClosingTimeElement is not null) dest.ClosingTimeElement = (Hl7.Fhir.Model.Time)_ClosingTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -472,55 +449,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HoursOfOperationComponent; - if(otherT == null) return false; + if(other is not HoursOfOperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(OpeningTimeElement, otherT.OpeningTimeElement)) return false; - if(!comparer.Equals(ClosingTimeElement, otherT.ClosingTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_OpeningTimeElement, otherT._OpeningTimeElement)) return false; + if(!comparer.Equals(_ClosingTimeElement, otherT._ClosingTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "openingTime": - value = OpeningTimeElement; - return OpeningTimeElement is not null; + value = _OpeningTimeElement; + return _OpeningTimeElement is not null; case "closingTime": - value = ClosingTimeElement; - return ClosingTimeElement is not null; + value = _ClosingTimeElement; + return _ClosingTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "openingTime": - OpeningTimeElement = (Hl7.Fhir.Model.Time)value; + OpeningTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "closingTime": - ClosingTimeElement = (Hl7.Fhir.Model.Time)value; + ClosingTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -531,10 +508,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (OpeningTimeElement is not null) yield return new KeyValuePair("openingTime",OpeningTimeElement); - if (ClosingTimeElement is not null) yield return new KeyValuePair("closingTime",ClosingTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_OpeningTimeElement is not null) yield return new KeyValuePair("openingTime",_OpeningTimeElement); + if (_ClosingTimeElement is not null) yield return new KeyValuePair("closingTime",_ClosingTimeElement); } } @@ -547,11 +524,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | inactive. @@ -560,13 +537,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("LocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | inactive @@ -575,13 +552,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -592,41 +566,38 @@ public Hl7.Fhir.Model.Location.LocationStatus? Status [FhirElement("operationalStatus", InSummary=true, Order=110, FiveWs="FiveWs.status")] [Binding("OperationalStatus")] [DataMember] - public Hl7.Fhir.Model.Coding OperationalStatus + public Hl7.Fhir.Model.Coding? OperationalStatus { get { return _OperationalStatus; } set { _OperationalStatus = value; OnPropertyChanged("OperationalStatus"); } } - private Hl7.Fhir.Model.Coding _OperationalStatus; + private Hl7.Fhir.Model.Coding? _OperationalStatus; /// /// Name of the location as used by humans. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the location as used by humans /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -639,24 +610,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the location is known as, or was known as, in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -668,28 +639,25 @@ public IEnumerable Alias /// [FhirElement("description", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Additional details about the location that could be displayed as further information to identify the location beyond its name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -701,13 +669,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("LocationMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// instance | kind @@ -716,13 +684,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -736,11 +701,11 @@ public Hl7.Fhir.Model.Location.LocationMode? Mode [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Contact details of the location. @@ -750,24 +715,24 @@ public List Type [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Physical location. /// [FhirElement("address", Order=180)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// Physical form of the location. @@ -775,26 +740,26 @@ public Hl7.Fhir.Model.Address Address [FhirElement("physicalType", InSummary=true, Order=190, FiveWs="FiveWs.class")] [Binding("PhysicalType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PhysicalType + public Hl7.Fhir.Model.CodeableConcept? PhysicalType { get { return _PhysicalType; } set { _PhysicalType = value; OnPropertyChanged("PhysicalType"); } } - private Hl7.Fhir.Model.CodeableConcept _PhysicalType; + private Hl7.Fhir.Model.CodeableConcept? _PhysicalType; /// /// The absolute geographic location. /// [FhirElement("position", Order=200)] [DataMember] - public Hl7.Fhir.Model.Location.PositionComponent Position + public Hl7.Fhir.Model.Location.PositionComponent? Position { get { return _Position; } set { _Position = value; OnPropertyChanged("Position"); } } - private Hl7.Fhir.Model.Location.PositionComponent _Position; + private Hl7.Fhir.Model.Location.PositionComponent? _Position; /// /// Organization responsible for provisioning and upkeep. @@ -803,13 +768,13 @@ public Hl7.Fhir.Model.Location.PositionComponent Position [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Another Location this one is physically a part of. @@ -818,13 +783,13 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// What days/times during a week is this location usually open. @@ -834,39 +799,36 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List HoursOfOperation { - get { if(_HoursOfOperation==null) _HoursOfOperation = new List(); return _HoursOfOperation; } + get => _HoursOfOperation ?? new List(); set { _HoursOfOperation = value; OnPropertyChanged("HoursOfOperation"); } } - private List _HoursOfOperation; + private List? _HoursOfOperation; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -881,41 +843,37 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Location; - - if (dest == null) - { + if(other is not Location dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(OperationalStatus != null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)OperationalStatus.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(PhysicalType != null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)PhysicalType.DeepCopyInternal(); - if(Position != null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)Position.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(HoursOfOperation.Any()) dest.HoursOfOperation = new List(HoursOfOperation.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_OperationalStatus is not null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)_OperationalStatus.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_PhysicalType is not null) dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)_PhysicalType.DeepCopyInternal(); + if(_Position is not null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)_Position.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_HoursOfOperation is not null) dest.HoursOfOperation = new List(_HoursOfOperation.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -927,146 +885,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Location; - if(otherT == null) return false; + if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(OperationalStatus, otherT.OperationalStatus)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(PhysicalType, otherT.PhysicalType)) return false; - if(!comparer.Equals(Position, otherT.Position)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(HoursOfOperation, otherT.HoursOfOperation)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_PhysicalType, otherT._PhysicalType)) return false; + if(!comparer.Equals(_Position, otherT._Position)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_HoursOfOperation, otherT._HoursOfOperation)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "operationalStatus": - value = OperationalStatus; - return OperationalStatus is not null; + value = _OperationalStatus; + return _OperationalStatus is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "physicalType": - value = PhysicalType; - return PhysicalType is not null; + value = _PhysicalType; + return _PhysicalType is not null; case "position": - value = Position; - return Position is not null; + value = _Position; + return _Position is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "hoursOfOperation": - value = HoursOfOperation; - return HoursOfOperation?.Any() == true; + value = _HoursOfOperation; + return _HoursOfOperation?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "operationalStatus": - OperationalStatus = (Hl7.Fhir.Model.Coding)value; + OperationalStatus = (Hl7.Fhir.Model.Coding?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "physicalType": - PhysicalType = (Hl7.Fhir.Model.CodeableConcept)value; + PhysicalType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "position": - Position = (Hl7.Fhir.Model.Location.PositionComponent)value; + Position = (Hl7.Fhir.Model.Location.PositionComponent?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "hoursOfOperation": - HoursOfOperation = (List)value; + HoursOfOperation = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1077,23 +1035,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",OperationalStatus); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (PhysicalType is not null) yield return new KeyValuePair("physicalType",PhysicalType); - if (Position is not null) yield return new KeyValuePair("position",Position); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (HoursOfOperation?.Any() == true) yield return new KeyValuePair("hoursOfOperation",HoursOfOperation); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatus); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_PhysicalType is not null) yield return new KeyValuePair("physicalType",_PhysicalType); + if (_Position is not null) yield return new KeyValuePair("position",_Position); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_HoursOfOperation?.Any() == true) yield return new KeyValuePair("hoursOfOperation",_HoursOfOperation); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs index fa5c81622..5b916e161 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -76,13 +79,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTCharacteristicCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -91,26 +94,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -122,41 +121,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -167,8 +166,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -181,11 +180,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -195,13 +194,13 @@ public List Identifier [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -210,13 +209,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -228,13 +224,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("ManufacturedDoseForm")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ManufacturedDoseForm + public Hl7.Fhir.Model.CodeableConcept? ManufacturedDoseForm { get { return _ManufacturedDoseForm; } set { _ManufacturedDoseForm = value; OnPropertyChanged("ManufacturedDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _ManufacturedDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _ManufacturedDoseForm; /// /// The “real world” units in which the quantity of the item is described. @@ -242,13 +238,13 @@ public Hl7.Fhir.Model.CodeableConcept ManufacturedDoseForm [FhirElement("unitOfPresentation", InSummary=true, Order=120)] [Binding("UnitOfPresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation + public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation { get { return _UnitOfPresentation; } set { _UnitOfPresentation = value; OnPropertyChanged("UnitOfPresentation"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfPresentation; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfPresentation; /// /// Manufacturer of the item (Note that this should be named "manufacturer" but it currently causes technical issues). @@ -260,11 +256,11 @@ public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// The ingredients of this manufactured item. Only needed if these are not specified by incoming references from the Ingredient resource. @@ -275,11 +271,11 @@ public List Manufacturer [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// General characteristics of this item. @@ -289,31 +285,27 @@ public List Ingredient [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ManufacturedItemDefinition; - - if (dest == null) - { + if(other is not ManufacturedItemDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ManufacturedDoseForm != null) dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)ManufacturedDoseForm.DeepCopyInternal(); - if(UnitOfPresentation != null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ManufacturedDoseForm is not null) dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)_ManufacturedDoseForm.DeepCopyInternal(); + if(_UnitOfPresentation is not null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)_UnitOfPresentation.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -325,76 +317,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManufacturedItemDefinition; - if(otherT == null) return false; + if(other is not ManufacturedItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ManufacturedDoseForm, otherT.ManufacturedDoseForm)) return false; - if(!comparer.Equals(UnitOfPresentation, otherT.UnitOfPresentation)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ManufacturedDoseForm, otherT._ManufacturedDoseForm)) return false; + if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "manufacturedDoseForm": - value = ManufacturedDoseForm; - return ManufacturedDoseForm is not null; + value = _ManufacturedDoseForm; + return _ManufacturedDoseForm is not null; case "unitOfPresentation": - value = UnitOfPresentation; - return UnitOfPresentation is not null; + value = _UnitOfPresentation; + return _UnitOfPresentation is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "manufacturedDoseForm": - ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unitOfPresentation": - UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; default: return base.SetValue(key, value); @@ -405,13 +397,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ManufacturedDoseForm is not null) yield return new KeyValuePair("manufacturedDoseForm",ManufacturedDoseForm); - if (UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",UnitOfPresentation); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ManufacturedDoseForm is not null) yield return new KeyValuePair("manufacturedDoseForm",_ManufacturedDoseForm); + if (_UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",_UnitOfPresentation); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs b/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs index fa9afc166..1cc1fc383 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,26 +64,26 @@ public partial class MarketingStatus : Hl7.Fhir.Model.BackboneType /// [FhirElement("country", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Country + public Hl7.Fhir.Model.CodeableConcept? Country { get { return _Country; } set { _Country = value; OnPropertyChanged("Country"); } } - private Hl7.Fhir.Model.CodeableConcept _Country; + private Hl7.Fhir.Model.CodeableConcept? _Country; /// /// Where a Medicines Regulatory Agency has granted a marketing authorisation for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified. /// [FhirElement("jurisdiction", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; /// /// This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples. @@ -88,73 +91,66 @@ public Hl7.Fhir.Model.CodeableConcept Jurisdiction [FhirElement("status", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. /// [FhirElement("dateRange", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Period DateRange + public Hl7.Fhir.Model.Period? DateRange { get { return _DateRange; } set { _DateRange = value; OnPropertyChanged("DateRange"); } } - private Hl7.Fhir.Model.Period _DateRange; + private Hl7.Fhir.Model.Period? _DateRange; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. /// [FhirElement("restoreDate", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RestoreDateElement + public Hl7.Fhir.Model.FhirDateTime? RestoreDateElement { get { return _RestoreDateElement; } set { _RestoreDateElement = value; OnPropertyChanged("RestoreDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RestoreDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RestoreDateElement; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorisation Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RestoreDate + public string? RestoreDate { - get { return RestoreDateElement != null ? RestoreDateElement.Value : null; } + get => _RestoreDateElement?.Value; set { - if (value == null) - RestoreDateElement = null; - else - RestoreDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RestoreDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RestoreDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MarketingStatus; - - if (dest == null) - { + if(other is not MarketingStatus dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Country != null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)Country.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(DateRange != null) dest.DateRange = (Hl7.Fhir.Model.Period)DateRange.DeepCopyInternal(); - if(RestoreDateElement != null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)RestoreDateElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)_Country.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_DateRange is not null) dest.DateRange = (Hl7.Fhir.Model.Period)_DateRange.DeepCopyInternal(); + if(_RestoreDateElement is not null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)_RestoreDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -166,62 +162,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MarketingStatus; - if(otherT == null) return false; + if(other is not MarketingStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Country, otherT.Country)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(DateRange, otherT.DateRange)) return false; - if(!comparer.Equals(RestoreDateElement, otherT.RestoreDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_DateRange, otherT._DateRange)) return false; + if(!comparer.Equals(_RestoreDateElement, otherT._RestoreDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "country": - value = Country; - return Country is not null; + value = _Country; + return _Country is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "dateRange": - value = DateRange; - return DateRange is not null; + value = _DateRange; + return _DateRange is not null; case "restoreDate": - value = RestoreDateElement; - return RestoreDateElement is not null; + value = _RestoreDateElement; + return _RestoreDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "country": - Country = (Hl7.Fhir.Model.CodeableConcept)value; + Country = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dateRange": - DateRange = (Hl7.Fhir.Model.Period)value; + DateRange = (Hl7.Fhir.Model.Period?)value; return this; case "restoreDate": - RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -232,11 +228,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Country is not null) yield return new KeyValuePair("country",Country); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (DateRange is not null) yield return new KeyValuePair("dateRange",DateRange); - if (RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",RestoreDateElement); + if (_Country is not null) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_DateRange is not null) yield return new KeyValuePair("dateRange",_DateRange); + if (_RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",_RestoreDateElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs index 47237907d..a8d0b4ccb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,41 +84,38 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("MeasureGroupExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Summary description. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Summary description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -128,11 +128,11 @@ public string Description [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// Stratifier criteria for the measure. @@ -142,26 +142,22 @@ public List Population [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -173,55 +169,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -232,10 +228,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -262,41 +258,38 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("MeasurePopulationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this population criteria. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this population criteria /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -307,27 +300,23 @@ public string Description [FhirElement("criteria", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -339,48 +328,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -391,9 +380,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); } } @@ -420,41 +409,38 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("MeasureStratifierExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this stratifier. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this stratifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -464,13 +450,13 @@ public string Description /// [FhirElement("criteria", Order=60)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; /// /// Stratifier criteria component for the measure. @@ -480,26 +466,22 @@ public Hl7.Fhir.Model.Expression Criteria [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -511,55 +493,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -570,10 +552,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } @@ -601,41 +583,38 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("MeasureStratifierExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this stratifier component. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this stratifier component /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -646,27 +625,23 @@ public string Description [FhirElement("criteria", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -678,48 +653,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -730,9 +705,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); } } @@ -760,13 +735,13 @@ public partial class SupplementalDataComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("MeasureSupplementalDataExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// supplemental-data | risk-adjustment-factor. @@ -777,39 +752,36 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Usage { - get { if(_Usage==null) _Usage = new List(); return _Usage; } + get => _Usage ?? new List(); set { _Usage = value; OnPropertyChanged("Usage"); } } - private List _Usage; + private List? _Usage; /// /// The human readable description of this supplemental data. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The human readable description of this supplemental data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -820,28 +792,24 @@ public string Description [FhirElement("criteria", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementalDataComponent; - - if (dest == null) - { + if(other is not SupplementalDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Usage.Any()) dest.Usage = new List(Usage.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Usage is not null) dest.Usage = new List(_Usage.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -853,55 +821,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementalDataComponent; - if(otherT == null) return false; + if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Usage, otherT.Usage)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "usage": - value = Usage; - return Usage?.Any() == true; + value = _Usage; + return _Usage?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "usage": - Usage = (List)value; + Usage = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -912,10 +880,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Usage?.Any() == true) yield return new KeyValuePair("usage",Usage); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Usage?.Any() == true) yield return new KeyValuePair("usage",_Usage); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); } } @@ -925,28 +893,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this measure, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -959,39 +924,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the measure. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1001,28 +963,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this measure (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1032,28 +991,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this measure (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1063,28 +1019,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -1097,13 +1050,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1112,13 +1065,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1128,13 +1078,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1143,13 +1093,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1163,41 +1110,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1207,28 +1151,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1241,39 +1182,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the measure. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1286,11 +1224,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for measure (if applicable). @@ -1301,39 +1239,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this measure is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this measure is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1343,28 +1278,25 @@ public string Purpose /// [FhirElement("usage", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -1374,28 +1306,25 @@ public string Usage /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1405,28 +1334,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the measure was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1436,28 +1362,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the measure was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1467,13 +1390,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the measure, such as Education, Treatment, Assessment, etc. @@ -1484,11 +1407,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1498,11 +1421,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1512,11 +1435,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1526,11 +1449,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1540,11 +1463,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1554,11 +1477,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the measure. @@ -1568,24 +1491,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1597,28 +1520,25 @@ public IEnumerable Library /// [FhirElement("disclaimer", InSummary=true, Order=370)] [DataMember] - public Hl7.Fhir.Model.Markdown DisclaimerElement + public Hl7.Fhir.Model.Markdown? DisclaimerElement { get { return _DisclaimerElement; } set { _DisclaimerElement = value; OnPropertyChanged("DisclaimerElement"); } } - private Hl7.Fhir.Model.Markdown _DisclaimerElement; + private Hl7.Fhir.Model.Markdown? _DisclaimerElement; /// /// Disclaimer for use of the measure or its referenced content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disclaimer + public string? Disclaimer { - get { return DisclaimerElement != null ? DisclaimerElement.Value : null; } + get => _DisclaimerElement?.Value; set { - if (value == null) - DisclaimerElement = null; - else - DisclaimerElement = new Hl7.Fhir.Model.Markdown(value); + DisclaimerElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Disclaimer"); } } @@ -1629,13 +1549,13 @@ public string Disclaimer [FhirElement("scoring", InSummary=true, Order=380)] [Binding("MeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; /// /// opportunity | all-or-nothing | linear | weighted. @@ -1643,13 +1563,13 @@ public Hl7.Fhir.Model.CodeableConcept Scoring [FhirElement("compositeScoring", InSummary=true, Order=390)] [Binding("CompositeMeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CompositeScoring + public Hl7.Fhir.Model.CodeableConcept? CompositeScoring { get { return _CompositeScoring; } set { _CompositeScoring = value; OnPropertyChanged("CompositeScoring"); } } - private Hl7.Fhir.Model.CodeableConcept _CompositeScoring; + private Hl7.Fhir.Model.CodeableConcept? _CompositeScoring; /// /// process | outcome | structure | patient-reported-outcome | composite. @@ -1660,39 +1580,36 @@ public Hl7.Fhir.Model.CodeableConcept CompositeScoring [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// How risk adjustment is applied for this measure. /// [FhirElement("riskAdjustment", InSummary=true, Order=410)] [DataMember] - public Hl7.Fhir.Model.FhirString RiskAdjustmentElement + public Hl7.Fhir.Model.FhirString? RiskAdjustmentElement { get { return _RiskAdjustmentElement; } set { _RiskAdjustmentElement = value; OnPropertyChanged("RiskAdjustmentElement"); } } - private Hl7.Fhir.Model.FhirString _RiskAdjustmentElement; + private Hl7.Fhir.Model.FhirString? _RiskAdjustmentElement; /// /// How risk adjustment is applied for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RiskAdjustment + public string? RiskAdjustment { - get { return RiskAdjustmentElement != null ? RiskAdjustmentElement.Value : null; } + get => _RiskAdjustmentElement?.Value; set { - if (value == null) - RiskAdjustmentElement = null; - else - RiskAdjustmentElement = new Hl7.Fhir.Model.FhirString(value); + RiskAdjustmentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RiskAdjustment"); } } @@ -1702,28 +1619,25 @@ public string RiskAdjustment /// [FhirElement("rateAggregation", InSummary=true, Order=420)] [DataMember] - public Hl7.Fhir.Model.FhirString RateAggregationElement + public Hl7.Fhir.Model.FhirString? RateAggregationElement { get { return _RateAggregationElement; } set { _RateAggregationElement = value; OnPropertyChanged("RateAggregationElement"); } } - private Hl7.Fhir.Model.FhirString _RateAggregationElement; + private Hl7.Fhir.Model.FhirString? _RateAggregationElement; /// /// How is rate aggregation performed for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RateAggregation + public string? RateAggregation { - get { return RateAggregationElement != null ? RateAggregationElement.Value : null; } + get => _RateAggregationElement?.Value; set { - if (value == null) - RateAggregationElement = null; - else - RateAggregationElement = new Hl7.Fhir.Model.FhirString(value); + RateAggregationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RateAggregation"); } } @@ -1733,28 +1647,25 @@ public string RateAggregation /// [FhirElement("rationale", InSummary=true, Order=430)] [DataMember] - public Hl7.Fhir.Model.Markdown RationaleElement + public Hl7.Fhir.Model.Markdown? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.Markdown _RationaleElement; + private Hl7.Fhir.Model.Markdown? _RationaleElement; /// /// Detailed description of why the measure exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.Markdown(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Rationale"); } } @@ -1764,28 +1675,25 @@ public string Rationale /// [FhirElement("clinicalRecommendationStatement", InSummary=true, Order=440)] [DataMember] - public Hl7.Fhir.Model.Markdown ClinicalRecommendationStatementElement + public Hl7.Fhir.Model.Markdown? ClinicalRecommendationStatementElement { get { return _ClinicalRecommendationStatementElement; } set { _ClinicalRecommendationStatementElement = value; OnPropertyChanged("ClinicalRecommendationStatementElement"); } } - private Hl7.Fhir.Model.Markdown _ClinicalRecommendationStatementElement; + private Hl7.Fhir.Model.Markdown? _ClinicalRecommendationStatementElement; /// /// Summary of clinical guidelines /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClinicalRecommendationStatement + public string? ClinicalRecommendationStatement { - get { return ClinicalRecommendationStatementElement != null ? ClinicalRecommendationStatementElement.Value : null; } + get => _ClinicalRecommendationStatementElement?.Value; set { - if (value == null) - ClinicalRecommendationStatementElement = null; - else - ClinicalRecommendationStatementElement = new Hl7.Fhir.Model.Markdown(value); + ClinicalRecommendationStatementElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ClinicalRecommendationStatement"); } } @@ -1796,13 +1704,13 @@ public string ClinicalRecommendationStatement [FhirElement("improvementNotation", InSummary=true, Order=450)] [Binding("MeasureImprovementNotation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ImprovementNotation + public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation { get { return _ImprovementNotation; } set { _ImprovementNotation = value; OnPropertyChanged("ImprovementNotation"); } } - private Hl7.Fhir.Model.CodeableConcept _ImprovementNotation; + private Hl7.Fhir.Model.CodeableConcept? _ImprovementNotation; /// /// Defined terms used in the measure documentation. @@ -1812,24 +1720,24 @@ public Hl7.Fhir.Model.CodeableConcept ImprovementNotation [DataMember] public List DefinitionElement { - get { if(_DefinitionElement==null) _DefinitionElement = new List(); return _DefinitionElement; } + get => _DefinitionElement ?? new List(); set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private List _DefinitionElement; + private List? _DefinitionElement; /// /// Defined terms used in the measure documentation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Definition + public IEnumerable? Definition { - get { return DefinitionElement != null ? DefinitionElement.Select(elem => elem.Value) : null; } + get => _DefinitionElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionElement = null; + DefinitionElement = null!; else DefinitionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Markdown(elem))); OnPropertyChanged("Definition"); @@ -1841,28 +1749,25 @@ public IEnumerable Definition /// [FhirElement("guidance", InSummary=true, Order=470)] [DataMember] - public Hl7.Fhir.Model.Markdown GuidanceElement + public Hl7.Fhir.Model.Markdown? GuidanceElement { get { return _GuidanceElement; } set { _GuidanceElement = value; OnPropertyChanged("GuidanceElement"); } } - private Hl7.Fhir.Model.Markdown _GuidanceElement; + private Hl7.Fhir.Model.Markdown? _GuidanceElement; /// /// Additional guidance for implementers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Guidance + public string? Guidance { - get { return GuidanceElement != null ? GuidanceElement.Value : null; } + get => _GuidanceElement?.Value; set { - if (value == null) - GuidanceElement = null; - else - GuidanceElement = new Hl7.Fhir.Model.Markdown(value); + GuidanceElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Guidance"); } } @@ -1875,11 +1780,11 @@ public string Guidance [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// What other data should be reported with the measure. @@ -1889,65 +1794,61 @@ public List Group [DataMember] public List SupplementalData { - get { if(_SupplementalData==null) _SupplementalData = new List(); return _SupplementalData; } + get => _SupplementalData ?? new List(); set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } - private List _SupplementalData; + private List? _SupplementalData; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Measure; - - if (dest == null) - { + if(other is not Measure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(DisclaimerElement != null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)DisclaimerElement.DeepCopyInternal(); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); - if(CompositeScoring != null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)CompositeScoring.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(RiskAdjustmentElement != null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)RiskAdjustmentElement.DeepCopyInternal(); - if(RateAggregationElement != null) dest.RateAggregationElement = (Hl7.Fhir.Model.FhirString)RateAggregationElement.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)RationaleElement.DeepCopyInternal(); - if(ClinicalRecommendationStatementElement != null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)ClinicalRecommendationStatementElement.DeepCopyInternal(); - if(ImprovementNotation != null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)ImprovementNotation.DeepCopyInternal(); - if(DefinitionElement.Any()) dest.DefinitionElement = new List(DefinitionElement.DeepCopyInternal()); - if(GuidanceElement != null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)GuidanceElement.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(SupplementalData.Any()) dest.SupplementalData = new List(SupplementalData.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_DisclaimerElement is not null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)_DisclaimerElement.DeepCopyInternal(); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); + if(_CompositeScoring is not null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)_CompositeScoring.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_RiskAdjustmentElement is not null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)_RiskAdjustmentElement.DeepCopyInternal(); + if(_RateAggregationElement is not null) dest.RateAggregationElement = (Hl7.Fhir.Model.FhirString)_RateAggregationElement.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)_RationaleElement.DeepCopyInternal(); + if(_ClinicalRecommendationStatementElement is not null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)_ClinicalRecommendationStatementElement.DeepCopyInternal(); + if(_ImprovementNotation is not null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)_ImprovementNotation.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = new List(_DefinitionElement.DeepCopyInternal()); + if(_GuidanceElement is not null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)_GuidanceElement.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_SupplementalData is not null) dest.SupplementalData = new List(_SupplementalData.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1959,314 +1860,314 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Measure; - if(otherT == null) return false; + if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(DisclaimerElement, otherT.DisclaimerElement)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; - if(!comparer.Equals(CompositeScoring, otherT.CompositeScoring)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(RiskAdjustmentElement, otherT.RiskAdjustmentElement)) return false; - if(!comparer.Equals(RateAggregationElement, otherT.RateAggregationElement)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; - if(!comparer.Equals(ClinicalRecommendationStatementElement, otherT.ClinicalRecommendationStatementElement)) return false; - if(!comparer.Equals(ImprovementNotation, otherT.ImprovementNotation)) return false; - if(!comparer.ListEquals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(GuidanceElement, otherT.GuidanceElement)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.ListEquals(SupplementalData, otherT.SupplementalData)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_DisclaimerElement, otherT._DisclaimerElement)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; + if(!comparer.Equals(_CompositeScoring, otherT._CompositeScoring)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RiskAdjustmentElement, otherT._RiskAdjustmentElement)) return false; + if(!comparer.Equals(_RateAggregationElement, otherT._RateAggregationElement)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; + if(!comparer.Equals(_ClinicalRecommendationStatementElement, otherT._ClinicalRecommendationStatementElement)) return false; + if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; + if(!comparer.ListEquals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_GuidanceElement, otherT._GuidanceElement)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "disclaimer": - value = DisclaimerElement; - return DisclaimerElement is not null; + value = _DisclaimerElement; + return _DisclaimerElement is not null; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; case "compositeScoring": - value = CompositeScoring; - return CompositeScoring is not null; + value = _CompositeScoring; + return _CompositeScoring is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "riskAdjustment": - value = RiskAdjustmentElement; - return RiskAdjustmentElement is not null; + value = _RiskAdjustmentElement; + return _RiskAdjustmentElement is not null; case "rateAggregation": - value = RateAggregationElement; - return RateAggregationElement is not null; + value = _RateAggregationElement; + return _RateAggregationElement is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; case "clinicalRecommendationStatement": - value = ClinicalRecommendationStatementElement; - return ClinicalRecommendationStatementElement is not null; + value = _ClinicalRecommendationStatementElement; + return _ClinicalRecommendationStatementElement is not null; case "improvementNotation": - value = ImprovementNotation; - return ImprovementNotation is not null; + value = _ImprovementNotation; + return _ImprovementNotation is not null; case "definition": - value = DefinitionElement; - return DefinitionElement?.Any() == true; + value = _DefinitionElement; + return _DefinitionElement?.Any() == true; case "guidance": - value = GuidanceElement; - return GuidanceElement is not null; + value = _GuidanceElement; + return _GuidanceElement is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "supplementalData": - value = SupplementalData; - return SupplementalData?.Any() == true; + value = _SupplementalData; + return _SupplementalData?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "disclaimer": - DisclaimerElement = (Hl7.Fhir.Model.Markdown)value; + DisclaimerElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "compositeScoring": - CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)value; + CompositeScoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "riskAdjustment": - RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString)value; + RiskAdjustmentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rateAggregation": - RateAggregationElement = (Hl7.Fhir.Model.FhirString)value; + RateAggregationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.Markdown)value; + RationaleElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "clinicalRecommendationStatement": - ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)value; + ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "improvementNotation": - ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)value; + ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "definition": - DefinitionElement = (List)value; + DefinitionElement = (List?)value!; return this; case "guidance": - GuidanceElement = (Hl7.Fhir.Model.Markdown)value; + GuidanceElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "supplementalData": - SupplementalData = (List)value; + SupplementalData = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2277,47 +2178,47 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",DisclaimerElement); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); - if (CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",CompositeScoring); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",RiskAdjustmentElement); - if (RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",RateAggregationElement); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); - if (ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",ClinicalRecommendationStatementElement); - if (ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotation); - if (DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",DefinitionElement); - if (GuidanceElement is not null) yield return new KeyValuePair("guidance",GuidanceElement); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",SupplementalData); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",_DisclaimerElement); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); + if (_CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",_CompositeScoring); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",_RiskAdjustmentElement); + if (_RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",_RateAggregationElement); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); + if (_ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",_ClinicalRecommendationStatementElement); + if (_ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotation); + if (_DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",_DefinitionElement); + if (_GuidanceElement is not null) yield return new KeyValuePair("guidance",_GuidanceElement); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",_SupplementalData); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs index e1f650631..ada494a21 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -143,13 +146,13 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Binding("MeasureGroupExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The populations in the group. @@ -159,24 +162,24 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this group achieved. /// [FhirElement("measureScore", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity MeasureScore + public Hl7.Fhir.Model.Quantity? MeasureScore { get { return _MeasureScore; } set { _MeasureScore = value; OnPropertyChanged("MeasureScore"); } } - private Hl7.Fhir.Model.Quantity _MeasureScore; + private Hl7.Fhir.Model.Quantity? _MeasureScore; /// /// Stratification results. @@ -186,26 +189,22 @@ public Hl7.Fhir.Model.Quantity MeasureScore [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScore != null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)MeasureScore.DeepCopyInternal(); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScore is not null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)_MeasureScore.DeepCopyInternal(); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -217,55 +216,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScore, otherT.MeasureScore)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScore; - return MeasureScore is not null; + value = _MeasureScore; + return _MeasureScore is not null; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScore = (Hl7.Fhir.Model.Quantity)value; + MeasureScore = (Hl7.Fhir.Model.Quantity?)value; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -276,10 +275,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScore is not null) yield return new KeyValuePair("measureScore",MeasureScore); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScore is not null) yield return new KeyValuePair("measureScore",_MeasureScore); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -306,26 +305,26 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -334,13 +333,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -352,27 +348,23 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SubjectResults + public Hl7.Fhir.Model.ResourceReference? SubjectResults { get { return _SubjectResults; } set { _SubjectResults = value; OnPropertyChanged("SubjectResults"); } } - private Hl7.Fhir.Model.ResourceReference _SubjectResults; + private Hl7.Fhir.Model.ResourceReference? _SubjectResults; protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(SubjectResults != null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)SubjectResults.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_SubjectResults is not null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)_SubjectResults.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -384,48 +376,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(SubjectResults, otherT.SubjectResults)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "subjectResults": - value = SubjectResults; - return SubjectResults is not null; + value = _SubjectResults; + return _SubjectResults is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "subjectResults": - SubjectResults = (Hl7.Fhir.Model.ResourceReference)value; + SubjectResults = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -436,9 +428,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (SubjectResults is not null) yield return new KeyValuePair("subjectResults",SubjectResults); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_SubjectResults is not null) yield return new KeyValuePair("subjectResults",_SubjectResults); } } @@ -468,11 +460,11 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Stratum results, one for each unique value, or set of values, in the stratifier, or stratifier components. @@ -482,24 +474,20 @@ public List Code [DataMember] public List Stratum { - get { if(_Stratum==null) _Stratum = new List(); return _Stratum; } + get => _Stratum ?? new List(); set { _Stratum = value; OnPropertyChanged("Stratum"); } } - private List _Stratum; + private List? _Stratum; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Stratum.Any()) dest.Stratum = new List(Stratum.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Stratum is not null) dest.Stratum = new List(_Stratum.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -511,41 +499,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Stratum, otherT.Stratum)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "stratum": - value = Stratum; - return Stratum?.Any() == true; + value = _Stratum; + return _Stratum?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "stratum": - Stratum = (List)value; + Stratum = (List?)value!; return this; default: return base.SetValue(key, value); @@ -556,8 +544,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Stratum?.Any() == true) yield return new KeyValuePair("stratum",Stratum); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Stratum?.Any() == true) yield return new KeyValuePair("stratum",_Stratum); } } @@ -584,13 +572,13 @@ public partial class StratifierGroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("value", Order=40)] [Binding("MeasureReportStratifierValueExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Value + public Hl7.Fhir.Model.CodeableConcept? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.CodeableConcept _Value; + private Hl7.Fhir.Model.CodeableConcept? _Value; /// /// Stratifier component values. @@ -600,11 +588,11 @@ public Hl7.Fhir.Model.CodeableConcept Value [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; /// /// Population results in this stratum. @@ -614,39 +602,35 @@ public List Component [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this stratum achieved. /// [FhirElement("measureScore", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity MeasureScore + public Hl7.Fhir.Model.Quantity? MeasureScore { get { return _MeasureScore; } set { _MeasureScore = value; OnPropertyChanged("MeasureScore"); } } - private Hl7.Fhir.Model.Quantity _MeasureScore; + private Hl7.Fhir.Model.Quantity? _MeasureScore; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupComponent; - - if (dest == null) - { + if(other is not StratifierGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)Value.DeepCopyInternal(); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScore != null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)MeasureScore.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)_Value.DeepCopyInternal(); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScore is not null) dest.MeasureScore = (Hl7.Fhir.Model.Quantity)_MeasureScore.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -658,55 +642,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupComponent; - if(otherT == null) return false; + if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScore, otherT.MeasureScore)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScore; - return MeasureScore is not null; + value = _MeasureScore; + return _MeasureScore is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.CodeableConcept)value; + Value = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScore = (Hl7.Fhir.Model.Quantity)value; + MeasureScore = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -717,10 +701,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScore is not null) yield return new KeyValuePair("measureScore",MeasureScore); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScore is not null) yield return new KeyValuePair("measureScore",_MeasureScore); } } @@ -748,13 +732,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("MeasureStratifierExample")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The stratum component value, e.g. male. @@ -763,26 +747,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [Binding("MeasureReportStratifierValueExample")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Value + public Hl7.Fhir.Model.CodeableConcept? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.CodeableConcept _Value; + private Hl7.Fhir.Model.CodeableConcept? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.CodeableConcept)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -794,41 +774,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.CodeableConcept)value; + Value = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -839,8 +819,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -867,26 +847,26 @@ public partial class StratifierGroupPopulationComponent : Hl7.Fhir.Model.Backbon [FhirElement("code", Order=40)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -895,13 +875,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -913,27 +890,23 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SubjectResults + public Hl7.Fhir.Model.ResourceReference? SubjectResults { get { return _SubjectResults; } set { _SubjectResults = value; OnPropertyChanged("SubjectResults"); } } - private Hl7.Fhir.Model.ResourceReference _SubjectResults; + private Hl7.Fhir.Model.ResourceReference? _SubjectResults; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupPopulationComponent; - - if (dest == null) - { + if(other is not StratifierGroupPopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(SubjectResults != null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)SubjectResults.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_SubjectResults is not null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)_SubjectResults.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -945,48 +918,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupPopulationComponent; - if(otherT == null) return false; + if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(SubjectResults, otherT.SubjectResults)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "subjectResults": - value = SubjectResults; - return SubjectResults is not null; + value = _SubjectResults; + return _SubjectResults is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "subjectResults": - SubjectResults = (Hl7.Fhir.Model.ResourceReference)value; + SubjectResults = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -997,9 +970,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (SubjectResults is not null) yield return new KeyValuePair("subjectResults",SubjectResults); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_SubjectResults is not null) yield return new KeyValuePair("subjectResults",_SubjectResults); } } @@ -1012,11 +985,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// complete | pending | error. @@ -1026,13 +999,13 @@ public List Identifier [Binding("MeasureReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// complete | pending | error @@ -1041,13 +1014,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1060,13 +1030,13 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status [Binding("MeasureReportType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// individual | subject-list | summary | data-collection @@ -1075,13 +1045,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1092,28 +1059,25 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type [FhirElement("measure", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical MeasureElement + public Hl7.Fhir.Model.Canonical? MeasureElement { get { return _MeasureElement; } set { _MeasureElement = value; OnPropertyChanged("MeasureElement"); } } - private Hl7.Fhir.Model.Canonical _MeasureElement; + private Hl7.Fhir.Model.Canonical? _MeasureElement; /// /// What measure was calculated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Measure + public string? Measure { - get { return MeasureElement != null ? MeasureElement.Value : null; } + get => _MeasureElement?.Value; set { - if (value == null) - MeasureElement = null; - else - MeasureElement = new Hl7.Fhir.Model.Canonical(value); + MeasureElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Measure"); } } @@ -1125,41 +1089,38 @@ public string Measure [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Location","Device","RelatedPerson","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When the report was generated. /// [FhirElement("date", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the report was generated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1171,13 +1132,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reporter + public Hl7.Fhir.Model.ResourceReference? Reporter { get { return _Reporter; } set { _Reporter = value; OnPropertyChanged("Reporter"); } } - private Hl7.Fhir.Model.ResourceReference _Reporter; + private Hl7.Fhir.Model.ResourceReference? _Reporter; /// /// What period the report covers. @@ -1185,13 +1146,13 @@ public Hl7.Fhir.Model.ResourceReference Reporter [FhirElement("period", InSummary=true, Order=160)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// increase | decrease. @@ -1199,13 +1160,13 @@ public Hl7.Fhir.Model.Period Period [FhirElement("improvementNotation", InSummary=true, IsModifier=true, Order=170)] [Binding("MeasureImprovementNotation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ImprovementNotation + public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation { get { return _ImprovementNotation; } set { _ImprovementNotation = value; OnPropertyChanged("ImprovementNotation"); } } - private Hl7.Fhir.Model.CodeableConcept _ImprovementNotation; + private Hl7.Fhir.Model.CodeableConcept? _ImprovementNotation; /// /// Measure results for each group. @@ -1215,11 +1176,11 @@ public Hl7.Fhir.Model.CodeableConcept ImprovementNotation [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// What data was used to calculate the measure score. @@ -1231,35 +1192,31 @@ public List Group [DataMember] public List EvaluatedResource { - get { if(_EvaluatedResource==null) _EvaluatedResource = new List(); return _EvaluatedResource; } + get => _EvaluatedResource ?? new List(); set { _EvaluatedResource = value; OnPropertyChanged("EvaluatedResource"); } } - private List _EvaluatedResource; + private List? _EvaluatedResource; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MeasureReport; - - if (dest == null) - { + if(other is not MeasureReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(MeasureElement != null) dest.MeasureElement = (Hl7.Fhir.Model.Canonical)MeasureElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Reporter != null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)Reporter.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(ImprovementNotation != null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)ImprovementNotation.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(EvaluatedResource.Any()) dest.EvaluatedResource = new List(EvaluatedResource.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_MeasureElement is not null) dest.MeasureElement = (Hl7.Fhir.Model.Canonical)_MeasureElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Reporter is not null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)_Reporter.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_ImprovementNotation is not null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)_ImprovementNotation.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_EvaluatedResource is not null) dest.EvaluatedResource = new List(_EvaluatedResource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1271,104 +1228,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MeasureReport; - if(otherT == null) return false; + if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(MeasureElement, otherT.MeasureElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Reporter, otherT.Reporter)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(ImprovementNotation, otherT.ImprovementNotation)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.ListEquals(EvaluatedResource, otherT.EvaluatedResource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_MeasureElement, otherT._MeasureElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Reporter, otherT._Reporter)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.ListEquals(_EvaluatedResource, otherT._EvaluatedResource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "measure": - value = MeasureElement; - return MeasureElement is not null; + value = _MeasureElement; + return _MeasureElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "reporter": - value = Reporter; - return Reporter is not null; + value = _Reporter; + return _Reporter is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "improvementNotation": - value = ImprovementNotation; - return ImprovementNotation is not null; + value = _ImprovementNotation; + return _ImprovementNotation is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "evaluatedResource": - value = EvaluatedResource; - return EvaluatedResource?.Any() == true; + value = _EvaluatedResource; + return _EvaluatedResource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "measure": - MeasureElement = (Hl7.Fhir.Model.Canonical)value; + MeasureElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reporter": - Reporter = (Hl7.Fhir.Model.ResourceReference)value; + Reporter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "improvementNotation": - ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)value; + ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "evaluatedResource": - EvaluatedResource = (List)value; + EvaluatedResource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1379,17 +1336,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (MeasureElement is not null) yield return new KeyValuePair("measure",MeasureElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Reporter is not null) yield return new KeyValuePair("reporter",Reporter); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotation); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (EvaluatedResource?.Any() == true) yield return new KeyValuePair("evaluatedResource",EvaluatedResource); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_MeasureElement is not null) yield return new KeyValuePair("measure",_MeasureElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Reporter is not null) yield return new KeyValuePair("reporter",_Reporter); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotation); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_EvaluatedResource?.Any() == true) yield return new KeyValuePair("evaluatedResource",_EvaluatedResource); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Media.cs b/src/Hl7.Fhir.R4B/Model/Generated/Media.cs index 8084a600a..86abb0d83 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Media.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,11 +67,11 @@ public partial class Media : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Procedure that caused this media to be created. @@ -80,11 +83,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -96,11 +99,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -110,13 +113,13 @@ public List PartOf [Binding("MediaStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -125,13 +128,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -142,13 +142,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("type", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("MediaType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The type of acquisition equipment/process. @@ -156,13 +156,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("modality", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [Binding("MediaModality")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modality + public Hl7.Fhir.Model.CodeableConcept? Modality { get { return _Modality; } set { _Modality = value; OnPropertyChanged("Modality"); } } - private Hl7.Fhir.Model.CodeableConcept _Modality; + private Hl7.Fhir.Model.CodeableConcept? _Modality; /// /// Imaging view, e.g. Lateral or Antero-posterior. @@ -170,13 +170,13 @@ public Hl7.Fhir.Model.CodeableConcept Modality [FhirElement("view", InSummary=true, Order=150)] [Binding("MediaView")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept View + public Hl7.Fhir.Model.CodeableConcept? View { get { return _View; } set { _View = value; OnPropertyChanged("View"); } } - private Hl7.Fhir.Model.CodeableConcept _View; + private Hl7.Fhir.Model.CodeableConcept? _View; /// /// Who/What this Media is a record of. @@ -185,13 +185,13 @@ public Hl7.Fhir.Model.CodeableConcept View [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Group","Device","Specimen","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter associated with media. @@ -200,13 +200,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When Media was collected. @@ -215,26 +215,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Created + public Hl7.Fhir.Model.DataType? Created { get { return _Created; } set { _Created = value; OnPropertyChanged("Created"); } } - private Hl7.Fhir.Model.DataType _Created; + private Hl7.Fhir.Model.DataType? _Created; /// /// Date/Time this version was made available. /// [FhirElement("issued", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// Date/Time this version was made available @@ -243,13 +243,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -261,13 +258,13 @@ public DateTimeOffset? Issued [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Operator + public Hl7.Fhir.Model.ResourceReference? Operator { get { return _Operator; } set { _Operator = value; OnPropertyChanged("Operator"); } } - private Hl7.Fhir.Model.ResourceReference _Operator; + private Hl7.Fhir.Model.ResourceReference? _Operator; /// /// Why was event performed?. @@ -278,11 +275,11 @@ public Hl7.Fhir.Model.ResourceReference Operator [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Observed body part. @@ -290,41 +287,38 @@ public List ReasonCode [FhirElement("bodySite", InSummary=true, Order=220)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Name of the device/manufacturer. /// [FhirElement("deviceName", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceNameElement + public Hl7.Fhir.Model.FhirString? DeviceNameElement { get { return _DeviceNameElement; } set { _DeviceNameElement = value; OnPropertyChanged("DeviceNameElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceNameElement; + private Hl7.Fhir.Model.FhirString? _DeviceNameElement; /// /// Name of the device/manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceName + public string? DeviceName { - get { return DeviceNameElement != null ? DeviceNameElement.Value : null; } + get => _DeviceNameElement?.Value; set { - if (value == null) - DeviceNameElement = null; - else - DeviceNameElement = new Hl7.Fhir.Model.FhirString(value); + DeviceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceName"); } } @@ -336,26 +330,26 @@ public string DeviceName [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Height of the image in pixels (photo/video). /// [FhirElement("height", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.PositiveInt HeightElement + public Hl7.Fhir.Model.PositiveInt? HeightElement { get { return _HeightElement; } set { _HeightElement = value; OnPropertyChanged("HeightElement"); } } - private Hl7.Fhir.Model.PositiveInt _HeightElement; + private Hl7.Fhir.Model.PositiveInt? _HeightElement; /// /// Height of the image in pixels (photo/video) @@ -364,13 +358,10 @@ public Hl7.Fhir.Model.PositiveInt HeightElement [IgnoreDataMember] public int? Height { - get { return HeightElement != null ? HeightElement.Value : null; } + get => _HeightElement?.Value; set { - if (value == null) - HeightElement = null; - else - HeightElement = new Hl7.Fhir.Model.PositiveInt(value); + HeightElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Height"); } } @@ -380,13 +371,13 @@ public int? Height /// [FhirElement("width", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.PositiveInt WidthElement + public Hl7.Fhir.Model.PositiveInt? WidthElement { get { return _WidthElement; } set { _WidthElement = value; OnPropertyChanged("WidthElement"); } } - private Hl7.Fhir.Model.PositiveInt _WidthElement; + private Hl7.Fhir.Model.PositiveInt? _WidthElement; /// /// Width of the image in pixels (photo/video) @@ -395,13 +386,10 @@ public Hl7.Fhir.Model.PositiveInt WidthElement [IgnoreDataMember] public int? Width { - get { return WidthElement != null ? WidthElement.Value : null; } + get => _WidthElement?.Value; set { - if (value == null) - WidthElement = null; - else - WidthElement = new Hl7.Fhir.Model.PositiveInt(value); + WidthElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Width"); } } @@ -411,13 +399,13 @@ public int? Width /// [FhirElement("frames", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FramesElement + public Hl7.Fhir.Model.PositiveInt? FramesElement { get { return _FramesElement; } set { _FramesElement = value; OnPropertyChanged("FramesElement"); } } - private Hl7.Fhir.Model.PositiveInt _FramesElement; + private Hl7.Fhir.Model.PositiveInt? _FramesElement; /// /// Number of frames if > 1 (photo) @@ -426,13 +414,10 @@ public Hl7.Fhir.Model.PositiveInt FramesElement [IgnoreDataMember] public int? Frames { - get { return FramesElement != null ? FramesElement.Value : null; } + get => _FramesElement?.Value; set { - if (value == null) - FramesElement = null; - else - FramesElement = new Hl7.Fhir.Model.PositiveInt(value); + FramesElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Frames"); } } @@ -442,13 +427,13 @@ public int? Frames /// [FhirElement("duration", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationElement + public Hl7.Fhir.Model.FhirDecimal? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationElement; /// /// Length in seconds (audio / video) @@ -457,13 +442,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement [IgnoreDataMember] public decimal? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Duration"); } } @@ -474,13 +456,13 @@ public decimal? Duration [FhirElement("content", InSummary=true, Order=290)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Attachment Content + public Hl7.Fhir.Model.Attachment? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.Attachment _Content; + private Hl7.Fhir.Model.Attachment? _Content; /// /// Comments made about the media. @@ -490,46 +472,42 @@ public Hl7.Fhir.Model.Attachment Content [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Media; - - if (dest == null) - { + if(other is not Media dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Modality != null) dest.Modality = (Hl7.Fhir.Model.CodeableConcept)Modality.DeepCopyInternal(); - if(View != null) dest.View = (Hl7.Fhir.Model.CodeableConcept)View.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Created != null) dest.Created = (Hl7.Fhir.Model.DataType)Created.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Operator != null) dest.Operator = (Hl7.Fhir.Model.ResourceReference)Operator.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(DeviceNameElement != null) dest.DeviceNameElement = (Hl7.Fhir.Model.FhirString)DeviceNameElement.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(HeightElement != null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)HeightElement.DeepCopyInternal(); - if(WidthElement != null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)WidthElement.DeepCopyInternal(); - if(FramesElement != null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)FramesElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal(); - if(Content != null) dest.Content = (Hl7.Fhir.Model.Attachment)Content.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = (Hl7.Fhir.Model.CodeableConcept)_Modality.DeepCopyInternal(); + if(_View is not null) dest.View = (Hl7.Fhir.Model.CodeableConcept)_View.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Created is not null) dest.Created = (Hl7.Fhir.Model.DataType)_Created.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Operator is not null) dest.Operator = (Hl7.Fhir.Model.ResourceReference)_Operator.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_DeviceNameElement is not null) dest.DeviceNameElement = (Hl7.Fhir.Model.FhirString)_DeviceNameElement.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_HeightElement is not null) dest.HeightElement = (Hl7.Fhir.Model.PositiveInt)_HeightElement.DeepCopyInternal(); + if(_WidthElement is not null) dest.WidthElement = (Hl7.Fhir.Model.PositiveInt)_WidthElement.DeepCopyInternal(); + if(_FramesElement is not null) dest.FramesElement = (Hl7.Fhir.Model.PositiveInt)_FramesElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.Attachment)_Content.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -541,181 +519,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Media; - if(otherT == null) return false; + if(other is not Media otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(View, otherT.View)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Created, otherT.Created)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Operator, otherT.Operator)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(DeviceNameElement, otherT.DeviceNameElement)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(HeightElement, otherT.HeightElement)) return false; - if(!comparer.Equals(WidthElement, otherT.WidthElement)) return false; - if(!comparer.Equals(FramesElement, otherT.FramesElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_View, otherT._View)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Created, otherT._Created)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Operator, otherT._Operator)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_DeviceNameElement, otherT._DeviceNameElement)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_HeightElement, otherT._HeightElement)) return false; + if(!comparer.Equals(_WidthElement, otherT._WidthElement)) return false; + if(!comparer.Equals(_FramesElement, otherT._FramesElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "modality": - value = Modality; - return Modality is not null; + value = _Modality; + return _Modality is not null; case "view": - value = View; - return View is not null; + value = _View; + return _View is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "created": - value = Created; - return Created is not null; + value = _Created; + return _Created is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "operator": - value = Operator; - return Operator is not null; + value = _Operator; + return _Operator is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "deviceName": - value = DeviceNameElement; - return DeviceNameElement is not null; + value = _DeviceNameElement; + return _DeviceNameElement is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "height": - value = HeightElement; - return HeightElement is not null; + value = _HeightElement; + return _HeightElement is not null; case "width": - value = WidthElement; - return WidthElement is not null; + value = _WidthElement; + return _WidthElement is not null; case "frames": - value = FramesElement; - return FramesElement is not null; + value = _FramesElement; + return _FramesElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modality": - Modality = (Hl7.Fhir.Model.CodeableConcept)value; + Modality = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "view": - View = (Hl7.Fhir.Model.CodeableConcept)value; + View = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - Created = (Hl7.Fhir.Model.DataType)value; + Created = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "operator": - Operator = (Hl7.Fhir.Model.ResourceReference)value; + Operator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "deviceName": - DeviceNameElement = (Hl7.Fhir.Model.FhirString)value; + DeviceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "height": - HeightElement = (Hl7.Fhir.Model.PositiveInt)value; + HeightElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "width": - WidthElement = (Hl7.Fhir.Model.PositiveInt)value; + WidthElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "frames": - FramesElement = (Hl7.Fhir.Model.PositiveInt)value; + FramesElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "content": - Content = (Hl7.Fhir.Model.Attachment)value; + Content = (Hl7.Fhir.Model.Attachment?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -726,28 +704,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Modality is not null) yield return new KeyValuePair("modality",Modality); - if (View is not null) yield return new KeyValuePair("view",View); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Created is not null) yield return new KeyValuePair("created",Created); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Operator is not null) yield return new KeyValuePair("operator",Operator); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (DeviceNameElement is not null) yield return new KeyValuePair("deviceName",DeviceNameElement); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (HeightElement is not null) yield return new KeyValuePair("height",HeightElement); - if (WidthElement is not null) yield return new KeyValuePair("width",WidthElement); - if (FramesElement is not null) yield return new KeyValuePair("frames",FramesElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (Content is not null) yield return new KeyValuePair("content",Content); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Modality is not null) yield return new KeyValuePair("modality",_Modality); + if (_View is not null) yield return new KeyValuePair("view",_View); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Created is not null) yield return new KeyValuePair("created",_Created); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Operator is not null) yield return new KeyValuePair("operator",_Operator); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_DeviceNameElement is not null) yield return new KeyValuePair("deviceName",_DeviceNameElement); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_HeightElement is not null) yield return new KeyValuePair("height",_HeightElement); + if (_WidthElement is not null) yield return new KeyValuePair("width",_WidthElement); + if (_FramesElement is not null) yield return new KeyValuePair("frames",_FramesElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_Content is not null) yield return new KeyValuePair("content",_Content); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs b/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs index f0c10794b..317eaa0bf 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,26 +116,26 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// Active ingredient indicator. /// [FhirElement("isActive", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsActiveElement + public Hl7.Fhir.Model.FhirBoolean? IsActiveElement { get { return _IsActiveElement; } set { _IsActiveElement = value; OnPropertyChanged("IsActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _IsActiveElement; /// /// Active ingredient indicator @@ -141,13 +144,10 @@ public Hl7.Fhir.Model.FhirBoolean IsActiveElement [IgnoreDataMember] public bool? IsActive { - get { return IsActiveElement != null ? IsActiveElement.Value : null; } + get => _IsActiveElement?.Value; set { - if (value == null) - IsActiveElement = null; - else - IsActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsActive"); } } @@ -157,27 +157,23 @@ public bool? IsActive /// [FhirElement("strength", Order=60)] [DataMember] - public Hl7.Fhir.Model.Ratio Strength + public Hl7.Fhir.Model.Ratio? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.Ratio _Strength; + private Hl7.Fhir.Model.Ratio? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(IsActiveElement != null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)IsActiveElement.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.Ratio)Strength.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_IsActiveElement is not null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)_IsActiveElement.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.Ratio)_Strength.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -189,48 +185,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(IsActiveElement, otherT.IsActiveElement)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "isActive": - value = IsActiveElement; - return IsActiveElement is not null; + value = _IsActiveElement; + return _IsActiveElement is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "isActive": - IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.Ratio)value; + Strength = (Hl7.Fhir.Model.Ratio?)value; return this; default: return base.SetValue(key, value); @@ -241,9 +237,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (IsActiveElement is not null) yield return new KeyValuePair("isActive",IsActiveElement); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_IsActiveElement is not null) yield return new KeyValuePair("isActive",_IsActiveElement); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); } } @@ -269,28 +265,25 @@ public partial class BatchComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("lotNumber", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Identifier assigned to batch /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -300,44 +293,37 @@ public string LotNumber /// [FhirElement("expirationDate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// When batch will expire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BatchComponent; - - if (dest == null) - { + if(other is not BatchComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,41 +335,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BatchComponent; - if(otherT == null) return false; + if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -394,8 +380,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); } } @@ -408,11 +394,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Codes that identify this medication. @@ -420,13 +406,13 @@ public List Identifier [FhirElement("code", InSummary=true, Order=100, FiveWs="FiveWs.class")] [Binding("MedicationFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | inactive | entered-in-error. @@ -435,13 +421,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("MedicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -450,13 +436,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Medication.MedicationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -468,13 +451,13 @@ public Hl7.Fhir.Model.Medication.MedicationStatusCodes? Status [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// powder | tablets | capsule +. @@ -482,26 +465,26 @@ public Hl7.Fhir.Model.ResourceReference Manufacturer [FhirElement("form", Order=130)] [Binding("MedicationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Amount of drug in package. /// [FhirElement("amount", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Ratio Amount + public Hl7.Fhir.Model.Ratio? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Ratio _Amount; + private Hl7.Fhir.Model.Ratio? _Amount; /// /// Active or inactive ingredient. @@ -511,45 +494,41 @@ public Hl7.Fhir.Model.Ratio Amount [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Details about packaged medications. /// [FhirElement("batch", Order=160)] [DataMember] - public Hl7.Fhir.Model.Medication.BatchComponent Batch + public Hl7.Fhir.Model.Medication.BatchComponent? Batch { get { return _Batch; } set { _Batch = value; OnPropertyChanged("Batch"); } } - private Hl7.Fhir.Model.Medication.BatchComponent _Batch; + private Hl7.Fhir.Model.Medication.BatchComponent? _Batch; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Medication; - - if (dest == null) - { + if(other is not Medication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Ratio)Amount.DeepCopyInternal(); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Batch != null) dest.Batch = (Hl7.Fhir.Model.Medication.BatchComponent)Batch.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Ratio)_Amount.DeepCopyInternal(); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Batch is not null) dest.Batch = (Hl7.Fhir.Model.Medication.BatchComponent)_Batch.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -561,83 +540,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Medication; - if(otherT == null) return false; + if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(Batch, otherT.Batch)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_Batch, otherT._Batch)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "batch": - value = Batch; - return Batch is not null; + value = _Batch; + return _Batch is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Ratio)value; + Amount = (Hl7.Fhir.Model.Ratio?)value; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "batch": - Batch = (Hl7.Fhir.Model.Medication.BatchComponent)value; + Batch = (Hl7.Fhir.Model.Medication.BatchComponent?)value; return this; default: return base.SetValue(key, value); @@ -648,14 +627,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Batch is not null) yield return new KeyValuePair("batch",Batch); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Batch is not null) yield return new KeyValuePair("batch",_Batch); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs index 3fb215b29..606560a88 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,13 +136,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("MedicationAdministrationPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the medication administration. @@ -149,26 +152,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,41 +179,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -225,8 +224,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -252,28 +251,25 @@ public partial class DosageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("text", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -284,13 +280,13 @@ public string Text [FhirElement("site", Order=50)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// Path of substance into body. @@ -298,13 +294,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=60)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// How drug was administered. @@ -312,26 +308,26 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", Order=70)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication per dose. /// [FhirElement("dose", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Dose + public Hl7.Fhir.Model.Quantity? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.Quantity _Dose; + private Hl7.Fhir.Model.Quantity? _Dose; /// /// Dose quantity per unit of time. @@ -340,30 +336,26 @@ public Hl7.Fhir.Model.Quantity Dose [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as DosageComponent; - - if (dest == null) - { + if(other is not DosageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.Quantity)Dose.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.Quantity)_Dose.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -375,69 +367,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosageComponent; - if(otherT == null) return false; + if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.Quantity)value; + Dose = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -448,12 +440,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -466,11 +458,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates protocol or definition. @@ -480,24 +472,24 @@ public List Identifier [DataMember] public List InstantiatesElement { - get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; } + get => _InstantiatesElement ?? new List(); set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } - private List _InstantiatesElement; + private List? _InstantiatesElement; /// /// Instantiates protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Instantiates + public IEnumerable? Instantiates { - get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; } + get => _InstantiatesElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesElement = null; + InstantiatesElement = null!; else InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Instantiates"); @@ -514,11 +506,11 @@ public IEnumerable Instantiates [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | not-done | on-hold | completed | entered-in-error | stopped | unknown. @@ -528,13 +520,13 @@ public List PartOf [Binding("MedicationAdministrationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | not-done | on-hold | completed | entered-in-error | stopped | unknown @@ -543,13 +535,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -563,11 +552,11 @@ public Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCod [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// Type of medication usage. @@ -575,13 +564,13 @@ public List StatusReason [FhirElement("category", Order=140)] [Binding("MedicationAdministrationCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What was administered. @@ -593,13 +582,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who received medication. @@ -609,13 +598,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter or Episode of Care administered as part of. @@ -624,13 +613,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Additional information to support administration. @@ -642,11 +631,11 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Start and end time of administration. @@ -656,13 +645,13 @@ public List SupportingInformation [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// Who performed the medication administration and what they did. @@ -672,11 +661,11 @@ public Hl7.Fhir.Model.DataType Effective [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Reason administration performed. @@ -687,11 +676,11 @@ public List Performe [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or observation that supports why the medication was administered. @@ -703,11 +692,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Request administration performed against. @@ -716,13 +705,13 @@ public List ReasonReference [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Device used to administer. @@ -734,11 +723,11 @@ public Hl7.Fhir.Model.ResourceReference Request [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// Information about the administration. @@ -748,24 +737,24 @@ public List Device [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Details of how medication was taken. /// [FhirElement("dosage", Order=260)] [DataMember] - public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage + public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage { get { return _Dosage; } set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private Hl7.Fhir.Model.MedicationAdministration.DosageComponent _Dosage; + private Hl7.Fhir.Model.MedicationAdministration.DosageComponent? _Dosage; /// /// A list of events of interest in the lifecycle. @@ -777,43 +766,39 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationAdministration; - - if (dest == null) - { + if(other is not MedicationAdministration dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Dosage != null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)Dosage.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesElement is not null) dest.InstantiatesElement = new List(_InstantiatesElement.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)_Dosage.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -825,160 +810,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationAdministration; - if(otherT == null) return false; + if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesElement, otherT.InstantiatesElement)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiates": - value = InstantiatesElement; - return InstantiatesElement?.Any() == true; + value = _InstantiatesElement; + return _InstantiatesElement?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosage": - value = Dosage; - return Dosage is not null; + value = _Dosage; + return _Dosage is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiates": - InstantiatesElement = (List)value; + InstantiatesElement = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosage": - Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)value; + Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -989,25 +974,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",InstantiatesElement); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Dosage is not null) yield return new KeyValuePair("dosage",Dosage); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",_InstantiatesElement); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Dosage is not null) yield return new KeyValuePair("dosage",_Dosage); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs index 8830424f5..b8aabd235 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -145,13 +148,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("MedicationDispensePerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual who was performing. @@ -161,26 +164,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -192,41 +191,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -237,8 +236,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -265,13 +264,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("wasSubstituted", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement + public Hl7.Fhir.Model.FhirBoolean? WasSubstitutedElement { get { return _WasSubstitutedElement; } set { _WasSubstitutedElement = value; OnPropertyChanged("WasSubstitutedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WasSubstitutedElement; + private Hl7.Fhir.Model.FhirBoolean? _WasSubstitutedElement; /// /// Whether a substitution was or was not performed on the dispense @@ -280,13 +279,10 @@ public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement [IgnoreDataMember] public bool? WasSubstituted { - get { return WasSubstitutedElement != null ? WasSubstitutedElement.Value : null; } + get => _WasSubstitutedElement?.Value; set { - if (value == null) - WasSubstitutedElement = null; - else - WasSubstitutedElement = new Hl7.Fhir.Model.FhirBoolean(value); + WasSubstitutedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WasSubstituted"); } } @@ -297,13 +293,13 @@ public bool? WasSubstituted [FhirElement("type", Order=50)] [Binding("MedicationIntendedSubstitutionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Why was substitution made. @@ -314,11 +310,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Who is responsible for the substitution. @@ -330,26 +326,22 @@ public List Reason [DataMember] public List ResponsibleParty { - get { if(_ResponsibleParty==null) _ResponsibleParty = new List(); return _ResponsibleParty; } + get => _ResponsibleParty ?? new List(); set { _ResponsibleParty = value; OnPropertyChanged("ResponsibleParty"); } } - private List _ResponsibleParty; + private List? _ResponsibleParty; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(WasSubstitutedElement != null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)WasSubstitutedElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(ResponsibleParty.Any()) dest.ResponsibleParty = new List(ResponsibleParty.DeepCopyInternal()); + if(_WasSubstitutedElement is not null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)_WasSubstitutedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_ResponsibleParty is not null) dest.ResponsibleParty = new List(_ResponsibleParty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -361,55 +353,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(WasSubstitutedElement, otherT.WasSubstitutedElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(ResponsibleParty, otherT.ResponsibleParty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_ResponsibleParty, otherT._ResponsibleParty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "wasSubstituted": - value = WasSubstitutedElement; - return WasSubstitutedElement is not null; + value = _WasSubstitutedElement; + return _WasSubstitutedElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "responsibleParty": - value = ResponsibleParty; - return ResponsibleParty?.Any() == true; + value = _ResponsibleParty; + return _ResponsibleParty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "wasSubstituted": - WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)value; + WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "responsibleParty": - ResponsibleParty = (List)value; + ResponsibleParty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -420,10 +412,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",WasSubstitutedElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (ResponsibleParty?.Any() == true) yield return new KeyValuePair("responsibleParty",ResponsibleParty); + if (_WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",_WasSubstitutedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_ResponsibleParty?.Any() == true) yield return new KeyValuePair("responsibleParty",_ResponsibleParty); } } @@ -436,11 +428,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Event that dispense is part of. @@ -452,11 +444,11 @@ public List Identifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown. @@ -466,13 +458,13 @@ public List PartOf [Binding("MedicationDispenseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown @@ -481,13 +473,10 @@ public Code Sta [IgnoreDataMember] public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -501,13 +490,13 @@ public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes? Status [References("DetectedIssue")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType StatusReason + public Hl7.Fhir.Model.DataType? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.DataType _StatusReason; + private Hl7.Fhir.Model.DataType? _StatusReason; /// /// Type of medication dispense. @@ -515,13 +504,13 @@ public Hl7.Fhir.Model.DataType StatusReason [FhirElement("category", Order=130)] [Binding("MedicationDispenseCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What medication was supplied. @@ -533,13 +522,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who the dispense is for. @@ -548,13 +537,13 @@ public Hl7.Fhir.Model.DataType Medication [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with event. @@ -563,13 +552,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Information that supports the dispensing of the medication. @@ -581,11 +570,11 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Who performed event. @@ -595,11 +584,11 @@ public List SupportingInformation [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the dispense occurred. @@ -608,13 +597,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Medication order that authorizes the dispense. @@ -626,11 +615,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List AuthorizingPrescription { - get { if(_AuthorizingPrescription==null) _AuthorizingPrescription = new List(); return _AuthorizingPrescription; } + get => _AuthorizingPrescription ?? new List(); set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } - private List _AuthorizingPrescription; + private List? _AuthorizingPrescription; /// /// Trial fill, partial fill, emergency fill, etc. @@ -638,67 +627,64 @@ public List AuthorizingPrescription [FhirElement("type", Order=210)] [Binding("MedicationDispenseType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount dispensed. /// [FhirElement("quantity", Order=220)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Amount of medication expressed as a timing amount. /// [FhirElement("daysSupply", Order=230)] [DataMember] - public Hl7.Fhir.Model.Quantity DaysSupply + public Hl7.Fhir.Model.Quantity? DaysSupply { get { return _DaysSupply; } set { _DaysSupply = value; OnPropertyChanged("DaysSupply"); } } - private Hl7.Fhir.Model.Quantity _DaysSupply; + private Hl7.Fhir.Model.Quantity? _DaysSupply; /// /// When product was packaged and reviewed. /// [FhirElement("whenPrepared", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenPreparedElement + public Hl7.Fhir.Model.FhirDateTime? WhenPreparedElement { get { return _WhenPreparedElement; } set { _WhenPreparedElement = value; OnPropertyChanged("WhenPreparedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenPreparedElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenPreparedElement; /// /// When product was packaged and reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenPrepared + public string? WhenPrepared { - get { return WhenPreparedElement != null ? WhenPreparedElement.Value : null; } + get => _WhenPreparedElement?.Value; set { - if (value == null) - WhenPreparedElement = null; - else - WhenPreparedElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenPreparedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenPrepared"); } } @@ -708,28 +694,25 @@ public string WhenPrepared /// [FhirElement("whenHandedOver", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenHandedOverElement + public Hl7.Fhir.Model.FhirDateTime? WhenHandedOverElement { get { return _WhenHandedOverElement; } set { _WhenHandedOverElement = value; OnPropertyChanged("WhenHandedOverElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenHandedOverElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenHandedOverElement; /// /// When product was given out /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenHandedOver + public string? WhenHandedOver { - get { return WhenHandedOverElement != null ? WhenHandedOverElement.Value : null; } + get => _WhenHandedOverElement?.Value; set { - if (value == null) - WhenHandedOverElement = null; - else - WhenHandedOverElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenHandedOverElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenHandedOver"); } } @@ -741,13 +724,13 @@ public string WhenHandedOver [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who collected the medication. @@ -759,11 +742,11 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; /// /// Information about the dispense. @@ -773,11 +756,11 @@ public List Receiver [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// How the medication is to be used by the patient or administered by the caregiver. @@ -787,24 +770,24 @@ public List Note [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Whether a substitution was performed on the dispense. /// [FhirElement("substitution", Order=300)] [DataMember] - public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? _Substitution; /// /// Clinical issue with action. @@ -816,11 +799,11 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution [DataMember] public List DetectedIssue { - get { if(_DetectedIssue==null) _DetectedIssue = new List(); return _DetectedIssue; } + get => _DetectedIssue ?? new List(); set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } - private List _DetectedIssue; + private List? _DetectedIssue; /// /// A list of relevant lifecycle events. @@ -832,48 +815,44 @@ public List DetectedIssue [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationDispense; - - if (dest == null) - { + if(other is not MedicationDispense dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.DataType)StatusReason.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(AuthorizingPrescription.Any()) dest.AuthorizingPrescription = new List(AuthorizingPrescription.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(DaysSupply != null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)DaysSupply.DeepCopyInternal(); - if(WhenPreparedElement != null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)WhenPreparedElement.DeepCopyInternal(); - if(WhenHandedOverElement != null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(DetectedIssue.Any()) dest.DetectedIssue = new List(DetectedIssue.DeepCopyInternal()); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.DataType)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_AuthorizingPrescription is not null) dest.AuthorizingPrescription = new List(_AuthorizingPrescription.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_DaysSupply is not null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)_DaysSupply.DeepCopyInternal(); + if(_WhenPreparedElement is not null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)_WhenPreparedElement.DeepCopyInternal(); + if(_WhenHandedOverElement is not null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)_WhenHandedOverElement.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_DetectedIssue is not null) dest.DetectedIssue = new List(_DetectedIssue.DeepCopyInternal()); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -885,195 +864,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationDispense; - if(otherT == null) return false; + if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(AuthorizingPrescription, otherT.AuthorizingPrescription)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(DaysSupply, otherT.DaysSupply)) return false; - if(!comparer.Equals(WhenPreparedElement, otherT.WhenPreparedElement)) return false; - if(!comparer.Equals(WhenHandedOverElement, otherT.WhenHandedOverElement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(DetectedIssue, otherT.DetectedIssue)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_AuthorizingPrescription, otherT._AuthorizingPrescription)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_DaysSupply, otherT._DaysSupply)) return false; + if(!comparer.Equals(_WhenPreparedElement, otherT._WhenPreparedElement)) return false; + if(!comparer.Equals(_WhenHandedOverElement, otherT._WhenHandedOverElement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "authorizingPrescription": - value = AuthorizingPrescription; - return AuthorizingPrescription?.Any() == true; + value = _AuthorizingPrescription; + return _AuthorizingPrescription?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "daysSupply": - value = DaysSupply; - return DaysSupply is not null; + value = _DaysSupply; + return _DaysSupply is not null; case "whenPrepared": - value = WhenPreparedElement; - return WhenPreparedElement is not null; + value = _WhenPreparedElement; + return _WhenPreparedElement is not null; case "whenHandedOver": - value = WhenHandedOverElement; - return WhenHandedOverElement is not null; + value = _WhenHandedOverElement; + return _WhenHandedOverElement is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "detectedIssue": - value = DetectedIssue; - return DetectedIssue?.Any() == true; + value = _DetectedIssue; + return _DetectedIssue?.Any() == true; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.DataType)value; + StatusReason = (Hl7.Fhir.Model.DataType?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authorizingPrescription": - AuthorizingPrescription = (List)value; + AuthorizingPrescription = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "daysSupply": - DaysSupply = (Hl7.Fhir.Model.Quantity)value; + DaysSupply = (Hl7.Fhir.Model.Quantity?)value; return this; case "whenPrepared": - WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "whenHandedOver": - WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent?)value; return this; case "detectedIssue": - DetectedIssue = (List)value; + DetectedIssue = (List?)value!; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1084,30 +1063,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",AuthorizingPrescription); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (DaysSupply is not null) yield return new KeyValuePair("daysSupply",DaysSupply); - if (WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",WhenPreparedElement); - if (WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",WhenHandedOverElement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",DetectedIssue); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",_AuthorizingPrescription); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_DaysSupply is not null) yield return new KeyValuePair("daysSupply",_DaysSupply); + if (_WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",_WhenPreparedElement); + if (_WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",_WhenHandedOverElement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",_DetectedIssue); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs index 43649e70d..0e58a847e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,13 +112,13 @@ public partial class RelatedMedicationKnowledgeComponent : Hl7.Fhir.Model.Backbo [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Associated documentation about the associated medication knowledge. @@ -127,24 +130,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedMedicationKnowledgeComponent; - - if (dest == null) - { + if(other is not RelatedMedicationKnowledgeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -156,41 +155,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedMedicationKnowledgeComponent; - if(otherT == null) return false; + if(other is not RelatedMedicationKnowledgeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; default: return base.SetValue(key, value); @@ -201,8 +200,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); } } @@ -225,13 +224,13 @@ public partial class MonographComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Associated documentation about the medication. @@ -240,26 +239,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("DocumentReference","Media")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as MonographComponent; - - if (dest == null) - { + if(other is not MonographComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -271,41 +266,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonographComponent; - if(otherT == null) return false; + if(other is not MonographComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -316,8 +311,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Source is not null) yield return new KeyValuePair("source",Source); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Source is not null) yield return new KeyValuePair("source",_Source); } } @@ -347,26 +342,26 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// Active ingredient indicator. /// [FhirElement("isActive", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsActiveElement + public Hl7.Fhir.Model.FhirBoolean? IsActiveElement { get { return _IsActiveElement; } set { _IsActiveElement = value; OnPropertyChanged("IsActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _IsActiveElement; /// /// Active ingredient indicator @@ -375,13 +370,10 @@ public Hl7.Fhir.Model.FhirBoolean IsActiveElement [IgnoreDataMember] public bool? IsActive { - get { return IsActiveElement != null ? IsActiveElement.Value : null; } + get => _IsActiveElement?.Value; set { - if (value == null) - IsActiveElement = null; - else - IsActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsActive"); } } @@ -391,27 +383,23 @@ public bool? IsActive /// [FhirElement("strength", Order=60)] [DataMember] - public Hl7.Fhir.Model.Ratio Strength + public Hl7.Fhir.Model.Ratio? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.Ratio _Strength; + private Hl7.Fhir.Model.Ratio? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(IsActiveElement != null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)IsActiveElement.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.Ratio)Strength.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_IsActiveElement is not null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)_IsActiveElement.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.Ratio)_Strength.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -423,48 +411,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(IsActiveElement, otherT.IsActiveElement)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "isActive": - value = IsActiveElement; - return IsActiveElement is not null; + value = _IsActiveElement; + return _IsActiveElement is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "isActive": - IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.Ratio)value; + Strength = (Hl7.Fhir.Model.Ratio?)value; return this; default: return base.SetValue(key, value); @@ -475,9 +463,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (IsActiveElement is not null) yield return new KeyValuePair("isActive",IsActiveElement); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_IsActiveElement is not null) yield return new KeyValuePair("isActive",_IsActiveElement); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); } } @@ -504,41 +492,38 @@ public partial class CostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The source or owner for the price information. /// [FhirElement("source", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// The source or owner for the price information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -549,27 +534,23 @@ public string Source [FhirElement("cost", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Cost + public Hl7.Fhir.Model.Money? Cost { get { return _Cost; } set { _Cost = value; OnPropertyChanged("Cost"); } } - private Hl7.Fhir.Model.Money _Cost; + private Hl7.Fhir.Model.Money? _Cost; protected internal override void CopyToInternal(Base other) { - var dest = other as CostComponent; - - if (dest == null) - { + if(other is not CostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(Cost != null) dest.Cost = (Hl7.Fhir.Model.Money)Cost.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = (Hl7.Fhir.Model.Money)_Cost.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -581,48 +562,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostComponent; - if(otherT == null) return false; + if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(Cost, otherT.Cost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_Cost, otherT._Cost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "cost": - value = Cost; - return Cost is not null; + value = _Cost; + return _Cost is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cost": - Cost = (Hl7.Fhir.Model.Money)value; + Cost = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -633,9 +614,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (Cost is not null) yield return new KeyValuePair("cost",Cost); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_Cost is not null) yield return new KeyValuePair("cost",_Cost); } } @@ -661,57 +642,50 @@ public partial class MonitoringProgramComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Name of the reviewing program. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the reviewing program /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MonitoringProgramComponent; - - if (dest == null) - { + if(other is not MonitoringProgramComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -723,41 +697,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonitoringProgramComponent; - if(otherT == null) return false; + if(other is not MonitoringProgramComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -768,8 +742,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); } } @@ -798,11 +772,11 @@ public partial class AdministrationGuidelinesComponent : Hl7.Fhir.Model.Backbone [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// Indication for use that apply to the specific administration guidelines. @@ -812,13 +786,13 @@ public List Dosage [References("ObservationDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Indication + public Hl7.Fhir.Model.DataType? Indication { get { return _Indication; } set { _Indication = value; OnPropertyChanged("Indication"); } } - private Hl7.Fhir.Model.DataType _Indication; + private Hl7.Fhir.Model.DataType? _Indication; /// /// Characteristics of the patient that are relevant to the administration guidelines. @@ -828,25 +802,21 @@ public Hl7.Fhir.Model.DataType Indication [DataMember] public List PatientCharacteristics { - get { if(_PatientCharacteristics==null) _PatientCharacteristics = new List(); return _PatientCharacteristics; } + get => _PatientCharacteristics ?? new List(); set { _PatientCharacteristics = value; OnPropertyChanged("PatientCharacteristics"); } } - private List _PatientCharacteristics; + private List? _PatientCharacteristics; protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrationGuidelinesComponent; - - if (dest == null) - { + if(other is not AdministrationGuidelinesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(Indication != null) dest.Indication = (Hl7.Fhir.Model.DataType)Indication.DeepCopyInternal(); - if(PatientCharacteristics.Any()) dest.PatientCharacteristics = new List(PatientCharacteristics.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_Indication is not null) dest.Indication = (Hl7.Fhir.Model.DataType)_Indication.DeepCopyInternal(); + if(_PatientCharacteristics is not null) dest.PatientCharacteristics = new List(_PatientCharacteristics.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -858,48 +828,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrationGuidelinesComponent; - if(otherT == null) return false; + if(other is not AdministrationGuidelinesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.Equals(Indication, otherT.Indication)) return false; - if(!comparer.ListEquals(PatientCharacteristics, otherT.PatientCharacteristics)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.Equals(_Indication, otherT._Indication)) return false; + if(!comparer.ListEquals(_PatientCharacteristics, otherT._PatientCharacteristics)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "indication": - value = Indication; - return Indication is not null; + value = _Indication; + return _Indication is not null; case "patientCharacteristics": - value = PatientCharacteristics; - return PatientCharacteristics?.Any() == true; + value = _PatientCharacteristics; + return _PatientCharacteristics?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "indication": - Indication = (Hl7.Fhir.Model.DataType)value; + Indication = (Hl7.Fhir.Model.DataType?)value; return this; case "patientCharacteristics": - PatientCharacteristics = (List)value; + PatientCharacteristics = (List?)value!; return this; default: return base.SetValue(key, value); @@ -910,9 +880,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (Indication is not null) yield return new KeyValuePair("indication",Indication); - if (PatientCharacteristics?.Any() == true) yield return new KeyValuePair("patientCharacteristics",PatientCharacteristics); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_Indication is not null) yield return new KeyValuePair("indication",_Indication); + if (_PatientCharacteristics?.Any() == true) yield return new KeyValuePair("patientCharacteristics",_PatientCharacteristics); } } @@ -936,13 +906,13 @@ public partial class DosageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Dosage for the medication for the specific guidelines. @@ -952,24 +922,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; protected internal override void CopyToInternal(Base other) { - var dest = other as DosageComponent; - - if (dest == null) - { + if(other is not DosageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -981,41 +947,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosageComponent; - if(otherT == null) return false; + if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1026,8 +992,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); } } @@ -1056,13 +1022,13 @@ public partial class PatientCharacteristicsComponent : Hl7.Fhir.Model.BackboneEl [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Characteristic + public Hl7.Fhir.Model.DataType? Characteristic { get { return _Characteristic; } set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private Hl7.Fhir.Model.DataType _Characteristic; + private Hl7.Fhir.Model.DataType? _Characteristic; /// /// The specific characteristic. @@ -1072,24 +1038,24 @@ public Hl7.Fhir.Model.DataType Characteristic [DataMember] public List ValueElement { - get { if(_ValueElement==null) _ValueElement = new List(); return _ValueElement; } + get => _ValueElement ?? new List(); set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private List _ValueElement; + private List? _ValueElement; /// /// The specific characteristic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Value + public IEnumerable? Value { - get { return ValueElement != null ? ValueElement.Select(elem => elem.Value) : null; } + get => _ValueElement?.Select(elem => elem.Value); set { if (value == null) - ValueElement = null; + ValueElement = null!; else ValueElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Value"); @@ -1098,16 +1064,12 @@ public IEnumerable Value protected internal override void CopyToInternal(Base other) { - var dest = other as PatientCharacteristicsComponent; - - if (dest == null) - { + if(other is not PatientCharacteristicsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Characteristic != null) dest.Characteristic = (Hl7.Fhir.Model.DataType)Characteristic.DeepCopyInternal(); - if(ValueElement.Any()) dest.ValueElement = new List(ValueElement.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = (Hl7.Fhir.Model.DataType)_Characteristic.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = new List(_ValueElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1119,41 +1081,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PatientCharacteristicsComponent; - if(otherT == null) return false; + if(other is not PatientCharacteristicsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "characteristic": - value = Characteristic; - return Characteristic is not null; + value = _Characteristic; + return _Characteristic is not null; case "value": - value = ValueElement; - return ValueElement?.Any() == true; + value = _ValueElement; + return _ValueElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "characteristic": - Characteristic = (Hl7.Fhir.Model.DataType)value; + Characteristic = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - ValueElement = (List)value; + ValueElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1164,8 +1126,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Characteristic is not null) yield return new KeyValuePair("characteristic",Characteristic); - if (ValueElement?.Any() == true) yield return new KeyValuePair("value",ValueElement); + if (_Characteristic is not null) yield return new KeyValuePair("characteristic",_Characteristic); + if (_ValueElement?.Any() == true) yield return new KeyValuePair("value",_ValueElement); } } @@ -1189,13 +1151,13 @@ public partial class MedicineClassificationComponent : Hl7.Fhir.Model.BackboneEl [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Specific category assigned to the medication. @@ -1205,24 +1167,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicineClassificationComponent; - - if (dest == null) - { + if(other is not MedicineClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1234,41 +1192,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicineClassificationComponent; - if(otherT == null) return false; + if(other is not MedicineClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1279,8 +1237,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); } } @@ -1307,39 +1265,35 @@ public partial class PackagingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("MedicationPackageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The number of product units the package would contain if fully loaded. /// [FhirElement("quantity", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as PackagingComponent; - - if (dest == null) - { + if(other is not PackagingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1351,41 +1305,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagingComponent; - if(otherT == null) return false; + if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -1396,8 +1350,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -1424,13 +1378,13 @@ public partial class DrugCharacteristicComponent : Hl7.Fhir.Model.BackboneElemen [FhirElement("type", Order=40)] [Binding("MedicationCharacteristic")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Description of the characteristic. @@ -1439,26 +1393,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Base64Binary))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DrugCharacteristicComponent; - - if (dest == null) - { + if(other is not DrugCharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1470,41 +1420,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DrugCharacteristicComponent; - if(otherT == null) return false; + if(other is not DrugCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1515,8 +1465,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1542,13 +1492,13 @@ public partial class RegulatoryComponent : Hl7.Fhir.Model.BackboneElement [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference RegulatoryAuthority + public Hl7.Fhir.Model.ResourceReference? RegulatoryAuthority { get { return _RegulatoryAuthority; } set { _RegulatoryAuthority = value; OnPropertyChanged("RegulatoryAuthority"); } } - private Hl7.Fhir.Model.ResourceReference _RegulatoryAuthority; + private Hl7.Fhir.Model.ResourceReference? _RegulatoryAuthority; /// /// Specifies if changes are allowed when dispensing a medication from a regulatory perspective. @@ -1558,11 +1508,11 @@ public Hl7.Fhir.Model.ResourceReference RegulatoryAuthority [DataMember] public List Substitution { - get { if(_Substitution==null) _Substitution = new List(); return _Substitution; } + get => _Substitution ?? new List(); set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private List _Substitution; + private List? _Substitution; /// /// Specifies the schedule of a medication in jurisdiction. @@ -1572,39 +1522,35 @@ public List Substituti [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// The maximum number of units of the medication that can be dispensed in a period. /// [FhirElement("maxDispense", Order=70)] [DataMember] - public Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent MaxDispense + public Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent? MaxDispense { get { return _MaxDispense; } set { _MaxDispense = value; OnPropertyChanged("MaxDispense"); } } - private Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent _MaxDispense; + private Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent? _MaxDispense; protected internal override void CopyToInternal(Base other) { - var dest = other as RegulatoryComponent; - - if (dest == null) - { + if(other is not RegulatoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RegulatoryAuthority != null) dest.RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)RegulatoryAuthority.DeepCopyInternal(); - if(Substitution.Any()) dest.Substitution = new List(Substitution.DeepCopyInternal()); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(MaxDispense != null) dest.MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)MaxDispense.DeepCopyInternal(); + if(_RegulatoryAuthority is not null) dest.RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)_RegulatoryAuthority.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = new List(_Substitution.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_MaxDispense is not null) dest.MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)_MaxDispense.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1616,55 +1562,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RegulatoryComponent; - if(otherT == null) return false; + if(other is not RegulatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RegulatoryAuthority, otherT.RegulatoryAuthority)) return false; - if(!comparer.ListEquals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(MaxDispense, otherT.MaxDispense)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; + if(!comparer.ListEquals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_MaxDispense, otherT._MaxDispense)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "regulatoryAuthority": - value = RegulatoryAuthority; - return RegulatoryAuthority is not null; + value = _RegulatoryAuthority; + return _RegulatoryAuthority is not null; case "substitution": - value = Substitution; - return Substitution?.Any() == true; + value = _Substitution; + return _Substitution?.Any() == true; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "maxDispense": - value = MaxDispense; - return MaxDispense is not null; + value = _MaxDispense; + return _MaxDispense is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "regulatoryAuthority": - RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)value; + RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "substitution": - Substitution = (List)value; + Substitution = (List?)value!; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "maxDispense": - MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)value; + MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent?)value; return this; default: return base.SetValue(key, value); @@ -1675,10 +1621,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RegulatoryAuthority is not null) yield return new KeyValuePair("regulatoryAuthority",RegulatoryAuthority); - if (Substitution?.Any() == true) yield return new KeyValuePair("substitution",Substitution); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (MaxDispense is not null) yield return new KeyValuePair("maxDispense",MaxDispense); + if (_RegulatoryAuthority is not null) yield return new KeyValuePair("regulatoryAuthority",_RegulatoryAuthority); + if (_Substitution?.Any() == true) yield return new KeyValuePair("substitution",_Substitution); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_MaxDispense is not null) yield return new KeyValuePair("maxDispense",_MaxDispense); } } @@ -1702,13 +1648,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Specifies if regulation allows for changes in the medication when dispensing. @@ -1716,13 +1662,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("allowed", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllowedElement + public Hl7.Fhir.Model.FhirBoolean? AllowedElement { get { return _AllowedElement; } set { _AllowedElement = value; OnPropertyChanged("AllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _AllowedElement; /// /// Specifies if regulation allows for changes in the medication when dispensing @@ -1731,29 +1677,22 @@ public Hl7.Fhir.Model.FhirBoolean AllowedElement [IgnoreDataMember] public bool? Allowed { - get { return AllowedElement != null ? AllowedElement.Value : null; } + get => _AllowedElement?.Value; set { - if (value == null) - AllowedElement = null; - else - AllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Allowed"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AllowedElement != null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)AllowedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AllowedElement is not null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)_AllowedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1765,41 +1704,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(AllowedElement, otherT.AllowedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = AllowedElement; - return AllowedElement is not null; + value = _AllowedElement; + return _AllowedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - AllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1810,8 +1749,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AllowedElement is not null) yield return new KeyValuePair("allowed",AllowedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AllowedElement is not null) yield return new KeyValuePair("allowed",_AllowedElement); } } @@ -1835,25 +1774,21 @@ public partial class ScheduleComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("schedule", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Schedule + public Hl7.Fhir.Model.CodeableConcept? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.CodeableConcept _Schedule; + private Hl7.Fhir.Model.CodeableConcept? _Schedule; protected internal override void CopyToInternal(Base other) { - var dest = other as ScheduleComponent; - - if (dest == null) - { + if(other is not ScheduleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.CodeableConcept)Schedule.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.CodeableConcept)_Schedule.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1865,34 +1800,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ScheduleComponent; - if(otherT == null) return false; + if(other is not ScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "schedule": - Schedule = (Hl7.Fhir.Model.CodeableConcept)value; + Schedule = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1903,7 +1838,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); } } @@ -1927,39 +1862,35 @@ public partial class MaxDispenseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("quantity", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The period that applies to the maximum number of units. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration Period + public Hl7.Fhir.Model.Duration? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Duration _Period; + private Hl7.Fhir.Model.Duration? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as MaxDispenseComponent; - - if (dest == null) - { + if(other is not MaxDispenseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Duration)Period.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Duration)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1971,41 +1902,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MaxDispenseComponent; - if(otherT == null) return false; + if(other is not MaxDispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Duration)value; + Period = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -2016,8 +1947,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -2043,11 +1974,11 @@ public partial class KineticsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List AreaUnderCurve { - get { if(_AreaUnderCurve==null) _AreaUnderCurve = new List(); return _AreaUnderCurve; } + get => _AreaUnderCurve ?? new List(); set { _AreaUnderCurve = value; OnPropertyChanged("AreaUnderCurve"); } } - private List _AreaUnderCurve; + private List? _AreaUnderCurve; /// /// The median lethal dose of a drug. @@ -2057,38 +1988,34 @@ public List AreaUnderCurve [DataMember] public List LethalDose50 { - get { if(_LethalDose50==null) _LethalDose50 = new List(); return _LethalDose50; } + get => _LethalDose50 ?? new List(); set { _LethalDose50 = value; OnPropertyChanged("LethalDose50"); } } - private List _LethalDose50; + private List? _LethalDose50; /// /// Time required for concentration in the body to decrease by half. /// [FhirElement("halfLifePeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration HalfLifePeriod + public Hl7.Fhir.Model.Duration? HalfLifePeriod { get { return _HalfLifePeriod; } set { _HalfLifePeriod = value; OnPropertyChanged("HalfLifePeriod"); } } - private Hl7.Fhir.Model.Duration _HalfLifePeriod; + private Hl7.Fhir.Model.Duration? _HalfLifePeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as KineticsComponent; - - if (dest == null) - { + if(other is not KineticsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AreaUnderCurve.Any()) dest.AreaUnderCurve = new List(AreaUnderCurve.DeepCopyInternal()); - if(LethalDose50.Any()) dest.LethalDose50 = new List(LethalDose50.DeepCopyInternal()); - if(HalfLifePeriod != null) dest.HalfLifePeriod = (Hl7.Fhir.Model.Duration)HalfLifePeriod.DeepCopyInternal(); + if(_AreaUnderCurve is not null) dest.AreaUnderCurve = new List(_AreaUnderCurve.DeepCopyInternal()); + if(_LethalDose50 is not null) dest.LethalDose50 = new List(_LethalDose50.DeepCopyInternal()); + if(_HalfLifePeriod is not null) dest.HalfLifePeriod = (Hl7.Fhir.Model.Duration)_HalfLifePeriod.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2100,48 +2027,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as KineticsComponent; - if(otherT == null) return false; + if(other is not KineticsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(AreaUnderCurve, otherT.AreaUnderCurve)) return false; - if(!comparer.ListEquals(LethalDose50, otherT.LethalDose50)) return false; - if(!comparer.Equals(HalfLifePeriod, otherT.HalfLifePeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_AreaUnderCurve, otherT._AreaUnderCurve)) return false; + if(!comparer.ListEquals(_LethalDose50, otherT._LethalDose50)) return false; + if(!comparer.Equals(_HalfLifePeriod, otherT._HalfLifePeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "areaUnderCurve": - value = AreaUnderCurve; - return AreaUnderCurve?.Any() == true; + value = _AreaUnderCurve; + return _AreaUnderCurve?.Any() == true; case "lethalDose50": - value = LethalDose50; - return LethalDose50?.Any() == true; + value = _LethalDose50; + return _LethalDose50?.Any() == true; case "halfLifePeriod": - value = HalfLifePeriod; - return HalfLifePeriod is not null; + value = _HalfLifePeriod; + return _HalfLifePeriod is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "areaUnderCurve": - AreaUnderCurve = (List)value; + AreaUnderCurve = (List?)value!; return this; case "lethalDose50": - LethalDose50 = (List)value; + LethalDose50 = (List?)value!; return this; case "halfLifePeriod": - HalfLifePeriod = (Hl7.Fhir.Model.Duration)value; + HalfLifePeriod = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -2152,9 +2079,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AreaUnderCurve?.Any() == true) yield return new KeyValuePair("areaUnderCurve",AreaUnderCurve); - if (LethalDose50?.Any() == true) yield return new KeyValuePair("lethalDose50",LethalDose50); - if (HalfLifePeriod is not null) yield return new KeyValuePair("halfLifePeriod",HalfLifePeriod); + if (_AreaUnderCurve?.Any() == true) yield return new KeyValuePair("areaUnderCurve",_AreaUnderCurve); + if (_LethalDose50?.Any() == true) yield return new KeyValuePair("lethalDose50",_LethalDose50); + if (_HalfLifePeriod is not null) yield return new KeyValuePair("halfLifePeriod",_HalfLifePeriod); } } @@ -2165,13 +2092,13 @@ public override IEnumerable> EnumerateElements() [FhirElement("code", InSummary=true, Order=90, FiveWs="FiveWs.class")] [Binding("MedicationFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | inactive | entered-in-error. @@ -2180,13 +2107,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("MedicationKnowledgeStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -2195,13 +2122,10 @@ public Code S [IgnoreDataMember] public Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2213,13 +2137,13 @@ public Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes? Status [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// powder | tablets | capsule +. @@ -2227,26 +2151,26 @@ public Hl7.Fhir.Model.ResourceReference Manufacturer [FhirElement("doseForm", Order=120)] [Binding("MedicationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseForm + public Hl7.Fhir.Model.CodeableConcept? DoseForm { get { return _DoseForm; } set { _DoseForm = value; OnPropertyChanged("DoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseForm; + private Hl7.Fhir.Model.CodeableConcept? _DoseForm; /// /// Amount of drug in package. /// [FhirElement("amount", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; /// /// Additional names for a medication. @@ -2256,24 +2180,24 @@ public Hl7.Fhir.Model.Quantity Amount [DataMember] public List SynonymElement { - get { if(_SynonymElement==null) _SynonymElement = new List(); return _SynonymElement; } + get => _SynonymElement ?? new List(); set { _SynonymElement = value; OnPropertyChanged("SynonymElement"); } } - private List _SynonymElement; + private List? _SynonymElement; /// /// Additional names for a medication /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Synonym + public IEnumerable? Synonym { - get { return SynonymElement != null ? SynonymElement.Select(elem => elem.Value) : null; } + get => _SynonymElement?.Select(elem => elem.Value); set { if (value == null) - SynonymElement = null; + SynonymElement = null!; else SynonymElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Synonym"); @@ -2288,11 +2212,11 @@ public IEnumerable Synonym [DataMember] public List RelatedMedicationKnowledge { - get { if(_RelatedMedicationKnowledge==null) _RelatedMedicationKnowledge = new List(); return _RelatedMedicationKnowledge; } + get => _RelatedMedicationKnowledge ?? new List(); set { _RelatedMedicationKnowledge = value; OnPropertyChanged("RelatedMedicationKnowledge"); } } - private List _RelatedMedicationKnowledge; + private List? _RelatedMedicationKnowledge; /// /// A medication resource that is associated with this medication. @@ -2304,11 +2228,11 @@ public List AssociatedMedication { - get { if(_AssociatedMedication==null) _AssociatedMedication = new List(); return _AssociatedMedication; } + get => _AssociatedMedication ?? new List(); set { _AssociatedMedication = value; OnPropertyChanged("AssociatedMedication"); } } - private List _AssociatedMedication; + private List? _AssociatedMedication; /// /// Category of the medication or product. @@ -2318,11 +2242,11 @@ public List AssociatedMedication [DataMember] public List ProductType { - get { if(_ProductType==null) _ProductType = new List(); return _ProductType; } + get => _ProductType ?? new List(); set { _ProductType = value; OnPropertyChanged("ProductType"); } } - private List _ProductType; + private List? _ProductType; /// /// Associated documentation about the medication. @@ -2332,11 +2256,11 @@ public List ProductType [DataMember] public List Monograph { - get { if(_Monograph==null) _Monograph = new List(); return _Monograph; } + get => _Monograph ?? new List(); set { _Monograph = value; OnPropertyChanged("Monograph"); } } - private List _Monograph; + private List? _Monograph; /// /// Active or inactive ingredient. @@ -2346,39 +2270,36 @@ public List Monograph [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// The instructions for preparing the medication. /// [FhirElement("preparationInstruction", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown PreparationInstructionElement + public Hl7.Fhir.Model.Markdown? PreparationInstructionElement { get { return _PreparationInstructionElement; } set { _PreparationInstructionElement = value; OnPropertyChanged("PreparationInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _PreparationInstructionElement; + private Hl7.Fhir.Model.Markdown? _PreparationInstructionElement; /// /// The instructions for preparing the medication /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreparationInstruction + public string? PreparationInstruction { - get { return PreparationInstructionElement != null ? PreparationInstructionElement.Value : null; } + get => _PreparationInstructionElement?.Value; set { - if (value == null) - PreparationInstructionElement = null; - else - PreparationInstructionElement = new Hl7.Fhir.Model.Markdown(value); + PreparationInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PreparationInstruction"); } } @@ -2392,11 +2313,11 @@ public string PreparationInstruction [DataMember] public List IntendedRoute { - get { if(_IntendedRoute==null) _IntendedRoute = new List(); return _IntendedRoute; } + get => _IntendedRoute ?? new List(); set { _IntendedRoute = value; OnPropertyChanged("IntendedRoute"); } } - private List _IntendedRoute; + private List? _IntendedRoute; /// /// The pricing of the medication. @@ -2406,11 +2327,11 @@ public List IntendedRoute [DataMember] public List Cost { - get { if(_Cost==null) _Cost = new List(); return _Cost; } + get => _Cost ?? new List(); set { _Cost = value; OnPropertyChanged("Cost"); } } - private List _Cost; + private List? _Cost; /// /// Program under which a medication is reviewed. @@ -2420,11 +2341,11 @@ public List Cost [DataMember] public List MonitoringProgram { - get { if(_MonitoringProgram==null) _MonitoringProgram = new List(); return _MonitoringProgram; } + get => _MonitoringProgram ?? new List(); set { _MonitoringProgram = value; OnPropertyChanged("MonitoringProgram"); } } - private List _MonitoringProgram; + private List? _MonitoringProgram; /// /// Guidelines for administration of the medication. @@ -2434,11 +2355,11 @@ public List Monit [DataMember] public List AdministrationGuidelines { - get { if(_AdministrationGuidelines==null) _AdministrationGuidelines = new List(); return _AdministrationGuidelines; } + get => _AdministrationGuidelines ?? new List(); set { _AdministrationGuidelines = value; OnPropertyChanged("AdministrationGuidelines"); } } - private List _AdministrationGuidelines; + private List? _AdministrationGuidelines; /// /// Categorization of the medication within a formulary or classification system. @@ -2448,24 +2369,24 @@ public List MedicineClassification { - get { if(_MedicineClassification==null) _MedicineClassification = new List(); return _MedicineClassification; } + get => _MedicineClassification ?? new List(); set { _MedicineClassification = value; OnPropertyChanged("MedicineClassification"); } } - private List _MedicineClassification; + private List? _MedicineClassification; /// /// Details about packaged medications. /// [FhirElement("packaging", Order=260)] [DataMember] - public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent Packaging + public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent? Packaging { get { return _Packaging; } set { _Packaging = value; OnPropertyChanged("Packaging"); } } - private Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent _Packaging; + private Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent? _Packaging; /// /// Specifies descriptive properties of the medicine. @@ -2475,11 +2396,11 @@ public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent Packaging [DataMember] public List DrugCharacteristic { - get { if(_DrugCharacteristic==null) _DrugCharacteristic = new List(); return _DrugCharacteristic; } + get => _DrugCharacteristic ?? new List(); set { _DrugCharacteristic = value; OnPropertyChanged("DrugCharacteristic"); } } - private List _DrugCharacteristic; + private List? _DrugCharacteristic; /// /// Potential clinical issue with or between medication(s). @@ -2491,11 +2412,11 @@ public List Drug [DataMember] public List Contraindication { - get { if(_Contraindication==null) _Contraindication = new List(); return _Contraindication; } + get => _Contraindication ?? new List(); set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } - private List _Contraindication; + private List? _Contraindication; /// /// Regulatory information about a medication. @@ -2505,11 +2426,11 @@ public List Contraindication [DataMember] public List Regulatory { - get { if(_Regulatory==null) _Regulatory = new List(); return _Regulatory; } + get => _Regulatory ?? new List(); set { _Regulatory = value; OnPropertyChanged("Regulatory"); } } - private List _Regulatory; + private List? _Regulatory; /// /// The time course of drug absorption, distribution, metabolism and excretion of a medication from the body. @@ -2519,44 +2440,40 @@ public List Regulatory [DataMember] public List Kinetics { - get { if(_Kinetics==null) _Kinetics = new List(); return _Kinetics; } + get => _Kinetics ?? new List(); set { _Kinetics = value; OnPropertyChanged("Kinetics"); } } - private List _Kinetics; + private List? _Kinetics; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationKnowledge; - - if (dest == null) - { + if(other is not MedicationKnowledge dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(DoseForm != null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)DoseForm.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); - if(SynonymElement.Any()) dest.SynonymElement = new List(SynonymElement.DeepCopyInternal()); - if(RelatedMedicationKnowledge.Any()) dest.RelatedMedicationKnowledge = new List(RelatedMedicationKnowledge.DeepCopyInternal()); - if(AssociatedMedication.Any()) dest.AssociatedMedication = new List(AssociatedMedication.DeepCopyInternal()); - if(ProductType.Any()) dest.ProductType = new List(ProductType.DeepCopyInternal()); - if(Monograph.Any()) dest.Monograph = new List(Monograph.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(PreparationInstructionElement != null) dest.PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)PreparationInstructionElement.DeepCopyInternal(); - if(IntendedRoute.Any()) dest.IntendedRoute = new List(IntendedRoute.DeepCopyInternal()); - if(Cost.Any()) dest.Cost = new List(Cost.DeepCopyInternal()); - if(MonitoringProgram.Any()) dest.MonitoringProgram = new List(MonitoringProgram.DeepCopyInternal()); - if(AdministrationGuidelines.Any()) dest.AdministrationGuidelines = new List(AdministrationGuidelines.DeepCopyInternal()); - if(MedicineClassification.Any()) dest.MedicineClassification = new List(MedicineClassification.DeepCopyInternal()); - if(Packaging != null) dest.Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent)Packaging.DeepCopyInternal(); - if(DrugCharacteristic.Any()) dest.DrugCharacteristic = new List(DrugCharacteristic.DeepCopyInternal()); - if(Contraindication.Any()) dest.Contraindication = new List(Contraindication.DeepCopyInternal()); - if(Regulatory.Any()) dest.Regulatory = new List(Regulatory.DeepCopyInternal()); - if(Kinetics.Any()) dest.Kinetics = new List(Kinetics.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_DoseForm is not null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)_DoseForm.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); + if(_SynonymElement is not null) dest.SynonymElement = new List(_SynonymElement.DeepCopyInternal()); + if(_RelatedMedicationKnowledge is not null) dest.RelatedMedicationKnowledge = new List(_RelatedMedicationKnowledge.DeepCopyInternal()); + if(_AssociatedMedication is not null) dest.AssociatedMedication = new List(_AssociatedMedication.DeepCopyInternal()); + if(_ProductType is not null) dest.ProductType = new List(_ProductType.DeepCopyInternal()); + if(_Monograph is not null) dest.Monograph = new List(_Monograph.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_PreparationInstructionElement is not null) dest.PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)_PreparationInstructionElement.DeepCopyInternal(); + if(_IntendedRoute is not null) dest.IntendedRoute = new List(_IntendedRoute.DeepCopyInternal()); + if(_Cost is not null) dest.Cost = new List(_Cost.DeepCopyInternal()); + if(_MonitoringProgram is not null) dest.MonitoringProgram = new List(_MonitoringProgram.DeepCopyInternal()); + if(_AdministrationGuidelines is not null) dest.AdministrationGuidelines = new List(_AdministrationGuidelines.DeepCopyInternal()); + if(_MedicineClassification is not null) dest.MedicineClassification = new List(_MedicineClassification.DeepCopyInternal()); + if(_Packaging is not null) dest.Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent)_Packaging.DeepCopyInternal(); + if(_DrugCharacteristic is not null) dest.DrugCharacteristic = new List(_DrugCharacteristic.DeepCopyInternal()); + if(_Contraindication is not null) dest.Contraindication = new List(_Contraindication.DeepCopyInternal()); + if(_Regulatory is not null) dest.Regulatory = new List(_Regulatory.DeepCopyInternal()); + if(_Kinetics is not null) dest.Kinetics = new List(_Kinetics.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2568,181 +2485,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationKnowledge; - if(otherT == null) return false; + if(other is not MedicationKnowledge otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(DoseForm, otherT.DoseForm)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.ListEquals(SynonymElement, otherT.SynonymElement)) return false; - if(!comparer.ListEquals(RelatedMedicationKnowledge, otherT.RelatedMedicationKnowledge)) return false; - if(!comparer.ListEquals(AssociatedMedication, otherT.AssociatedMedication)) return false; - if(!comparer.ListEquals(ProductType, otherT.ProductType)) return false; - if(!comparer.ListEquals(Monograph, otherT.Monograph)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(PreparationInstructionElement, otherT.PreparationInstructionElement)) return false; - if(!comparer.ListEquals(IntendedRoute, otherT.IntendedRoute)) return false; - if(!comparer.ListEquals(Cost, otherT.Cost)) return false; - if(!comparer.ListEquals(MonitoringProgram, otherT.MonitoringProgram)) return false; - if(!comparer.ListEquals(AdministrationGuidelines, otherT.AdministrationGuidelines)) return false; - if(!comparer.ListEquals(MedicineClassification, otherT.MedicineClassification)) return false; - if(!comparer.Equals(Packaging, otherT.Packaging)) return false; - if(!comparer.ListEquals(DrugCharacteristic, otherT.DrugCharacteristic)) return false; - if(!comparer.ListEquals(Contraindication, otherT.Contraindication)) return false; - if(!comparer.ListEquals(Regulatory, otherT.Regulatory)) return false; - if(!comparer.ListEquals(Kinetics, otherT.Kinetics)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_DoseForm, otherT._DoseForm)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.ListEquals(_SynonymElement, otherT._SynonymElement)) return false; + if(!comparer.ListEquals(_RelatedMedicationKnowledge, otherT._RelatedMedicationKnowledge)) return false; + if(!comparer.ListEquals(_AssociatedMedication, otherT._AssociatedMedication)) return false; + if(!comparer.ListEquals(_ProductType, otherT._ProductType)) return false; + if(!comparer.ListEquals(_Monograph, otherT._Monograph)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_PreparationInstructionElement, otherT._PreparationInstructionElement)) return false; + if(!comparer.ListEquals(_IntendedRoute, otherT._IntendedRoute)) return false; + if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; + if(!comparer.ListEquals(_MonitoringProgram, otherT._MonitoringProgram)) return false; + if(!comparer.ListEquals(_AdministrationGuidelines, otherT._AdministrationGuidelines)) return false; + if(!comparer.ListEquals(_MedicineClassification, otherT._MedicineClassification)) return false; + if(!comparer.Equals(_Packaging, otherT._Packaging)) return false; + if(!comparer.ListEquals(_DrugCharacteristic, otherT._DrugCharacteristic)) return false; + if(!comparer.ListEquals(_Contraindication, otherT._Contraindication)) return false; + if(!comparer.ListEquals(_Regulatory, otherT._Regulatory)) return false; + if(!comparer.ListEquals(_Kinetics, otherT._Kinetics)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "doseForm": - value = DoseForm; - return DoseForm is not null; + value = _DoseForm; + return _DoseForm is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "synonym": - value = SynonymElement; - return SynonymElement?.Any() == true; + value = _SynonymElement; + return _SynonymElement?.Any() == true; case "relatedMedicationKnowledge": - value = RelatedMedicationKnowledge; - return RelatedMedicationKnowledge?.Any() == true; + value = _RelatedMedicationKnowledge; + return _RelatedMedicationKnowledge?.Any() == true; case "associatedMedication": - value = AssociatedMedication; - return AssociatedMedication?.Any() == true; + value = _AssociatedMedication; + return _AssociatedMedication?.Any() == true; case "productType": - value = ProductType; - return ProductType?.Any() == true; + value = _ProductType; + return _ProductType?.Any() == true; case "monograph": - value = Monograph; - return Monograph?.Any() == true; + value = _Monograph; + return _Monograph?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "preparationInstruction": - value = PreparationInstructionElement; - return PreparationInstructionElement is not null; + value = _PreparationInstructionElement; + return _PreparationInstructionElement is not null; case "intendedRoute": - value = IntendedRoute; - return IntendedRoute?.Any() == true; + value = _IntendedRoute; + return _IntendedRoute?.Any() == true; case "cost": - value = Cost; - return Cost?.Any() == true; + value = _Cost; + return _Cost?.Any() == true; case "monitoringProgram": - value = MonitoringProgram; - return MonitoringProgram?.Any() == true; + value = _MonitoringProgram; + return _MonitoringProgram?.Any() == true; case "administrationGuidelines": - value = AdministrationGuidelines; - return AdministrationGuidelines?.Any() == true; + value = _AdministrationGuidelines; + return _AdministrationGuidelines?.Any() == true; case "medicineClassification": - value = MedicineClassification; - return MedicineClassification?.Any() == true; + value = _MedicineClassification; + return _MedicineClassification?.Any() == true; case "packaging": - value = Packaging; - return Packaging is not null; + value = _Packaging; + return _Packaging is not null; case "drugCharacteristic": - value = DrugCharacteristic; - return DrugCharacteristic?.Any() == true; + value = _DrugCharacteristic; + return _DrugCharacteristic?.Any() == true; case "contraindication": - value = Contraindication; - return Contraindication?.Any() == true; + value = _Contraindication; + return _Contraindication?.Any() == true; case "regulatory": - value = Regulatory; - return Regulatory?.Any() == true; + value = _Regulatory; + return _Regulatory?.Any() == true; case "kinetics": - value = Kinetics; - return Kinetics?.Any() == true; + value = _Kinetics; + return _Kinetics?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "doseForm": - DoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + DoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; case "synonym": - SynonymElement = (List)value; + SynonymElement = (List?)value!; return this; case "relatedMedicationKnowledge": - RelatedMedicationKnowledge = (List)value; + RelatedMedicationKnowledge = (List?)value!; return this; case "associatedMedication": - AssociatedMedication = (List)value; + AssociatedMedication = (List?)value!; return this; case "productType": - ProductType = (List)value; + ProductType = (List?)value!; return this; case "monograph": - Monograph = (List)value; + Monograph = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "preparationInstruction": - PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)value; + PreparationInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "intendedRoute": - IntendedRoute = (List)value; + IntendedRoute = (List?)value!; return this; case "cost": - Cost = (List)value; + Cost = (List?)value!; return this; case "monitoringProgram": - MonitoringProgram = (List)value; + MonitoringProgram = (List?)value!; return this; case "administrationGuidelines": - AdministrationGuidelines = (List)value; + AdministrationGuidelines = (List?)value!; return this; case "medicineClassification": - MedicineClassification = (List)value; + MedicineClassification = (List?)value!; return this; case "packaging": - Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent)value; + Packaging = (Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent?)value; return this; case "drugCharacteristic": - DrugCharacteristic = (List)value; + DrugCharacteristic = (List?)value!; return this; case "contraindication": - Contraindication = (List)value; + Contraindication = (List?)value!; return this; case "regulatory": - Regulatory = (List)value; + Regulatory = (List?)value!; return this; case "kinetics": - Kinetics = (List)value; + Kinetics = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2753,28 +2670,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (DoseForm is not null) yield return new KeyValuePair("doseForm",DoseForm); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (SynonymElement?.Any() == true) yield return new KeyValuePair("synonym",SynonymElement); - if (RelatedMedicationKnowledge?.Any() == true) yield return new KeyValuePair("relatedMedicationKnowledge",RelatedMedicationKnowledge); - if (AssociatedMedication?.Any() == true) yield return new KeyValuePair("associatedMedication",AssociatedMedication); - if (ProductType?.Any() == true) yield return new KeyValuePair("productType",ProductType); - if (Monograph?.Any() == true) yield return new KeyValuePair("monograph",Monograph); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (PreparationInstructionElement is not null) yield return new KeyValuePair("preparationInstruction",PreparationInstructionElement); - if (IntendedRoute?.Any() == true) yield return new KeyValuePair("intendedRoute",IntendedRoute); - if (Cost?.Any() == true) yield return new KeyValuePair("cost",Cost); - if (MonitoringProgram?.Any() == true) yield return new KeyValuePair("monitoringProgram",MonitoringProgram); - if (AdministrationGuidelines?.Any() == true) yield return new KeyValuePair("administrationGuidelines",AdministrationGuidelines); - if (MedicineClassification?.Any() == true) yield return new KeyValuePair("medicineClassification",MedicineClassification); - if (Packaging is not null) yield return new KeyValuePair("packaging",Packaging); - if (DrugCharacteristic?.Any() == true) yield return new KeyValuePair("drugCharacteristic",DrugCharacteristic); - if (Contraindication?.Any() == true) yield return new KeyValuePair("contraindication",Contraindication); - if (Regulatory?.Any() == true) yield return new KeyValuePair("regulatory",Regulatory); - if (Kinetics?.Any() == true) yield return new KeyValuePair("kinetics",Kinetics); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_DoseForm is not null) yield return new KeyValuePair("doseForm",_DoseForm); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_SynonymElement?.Any() == true) yield return new KeyValuePair("synonym",_SynonymElement); + if (_RelatedMedicationKnowledge?.Any() == true) yield return new KeyValuePair("relatedMedicationKnowledge",_RelatedMedicationKnowledge); + if (_AssociatedMedication?.Any() == true) yield return new KeyValuePair("associatedMedication",_AssociatedMedication); + if (_ProductType?.Any() == true) yield return new KeyValuePair("productType",_ProductType); + if (_Monograph?.Any() == true) yield return new KeyValuePair("monograph",_Monograph); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_PreparationInstructionElement is not null) yield return new KeyValuePair("preparationInstruction",_PreparationInstructionElement); + if (_IntendedRoute?.Any() == true) yield return new KeyValuePair("intendedRoute",_IntendedRoute); + if (_Cost?.Any() == true) yield return new KeyValuePair("cost",_Cost); + if (_MonitoringProgram?.Any() == true) yield return new KeyValuePair("monitoringProgram",_MonitoringProgram); + if (_AdministrationGuidelines?.Any() == true) yield return new KeyValuePair("administrationGuidelines",_AdministrationGuidelines); + if (_MedicineClassification?.Any() == true) yield return new KeyValuePair("medicineClassification",_MedicineClassification); + if (_Packaging is not null) yield return new KeyValuePair("packaging",_Packaging); + if (_DrugCharacteristic?.Any() == true) yield return new KeyValuePair("drugCharacteristic",_DrugCharacteristic); + if (_Contraindication?.Any() == true) yield return new KeyValuePair("contraindication",_Contraindication); + if (_Regulatory?.Any() == true) yield return new KeyValuePair("regulatory",_Regulatory); + if (_Kinetics?.Any() == true) yield return new KeyValuePair("kinetics",_Kinetics); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs index cebc84279..7cc41848a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -196,52 +199,52 @@ public partial class DispenseRequestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("initialFill", Order=40)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.InitialFillComponent InitialFill + public Hl7.Fhir.Model.MedicationRequest.InitialFillComponent? InitialFill { get { return _InitialFill; } set { _InitialFill = value; OnPropertyChanged("InitialFill"); } } - private Hl7.Fhir.Model.MedicationRequest.InitialFillComponent _InitialFill; + private Hl7.Fhir.Model.MedicationRequest.InitialFillComponent? _InitialFill; /// /// Minimum period of time between dispenses. /// [FhirElement("dispenseInterval", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration DispenseInterval + public Hl7.Fhir.Model.Duration? DispenseInterval { get { return _DispenseInterval; } set { _DispenseInterval = value; OnPropertyChanged("DispenseInterval"); } } - private Hl7.Fhir.Model.Duration _DispenseInterval; + private Hl7.Fhir.Model.Duration? _DispenseInterval; /// /// Time period supply is authorized for. /// [FhirElement("validityPeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// Number of refills authorized. /// [FhirElement("numberOfRepeatsAllowed", Order=70)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfRepeatsAllowedElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfRepeatsAllowedElement { get { return _NumberOfRepeatsAllowedElement; } set { _NumberOfRepeatsAllowedElement = value; OnPropertyChanged("NumberOfRepeatsAllowedElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfRepeatsAllowedElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfRepeatsAllowedElement; /// /// Number of refills authorized @@ -250,13 +253,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfRepeatsAllowedElement [IgnoreDataMember] public int? NumberOfRepeatsAllowed { - get { return NumberOfRepeatsAllowedElement != null ? NumberOfRepeatsAllowedElement.Value : null; } + get => _NumberOfRepeatsAllowedElement?.Value; set { - if (value == null) - NumberOfRepeatsAllowedElement = null; - else - NumberOfRepeatsAllowedElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfRepeatsAllowedElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfRepeatsAllowed"); } } @@ -266,26 +266,26 @@ public int? NumberOfRepeatsAllowed /// [FhirElement("quantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Number of days supply per dispense. /// [FhirElement("expectedSupplyDuration", Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration ExpectedSupplyDuration + public Hl7.Fhir.Model.Duration? ExpectedSupplyDuration { get { return _ExpectedSupplyDuration; } set { _ExpectedSupplyDuration = value; OnPropertyChanged("ExpectedSupplyDuration"); } } - private Hl7.Fhir.Model.Duration _ExpectedSupplyDuration; + private Hl7.Fhir.Model.Duration? _ExpectedSupplyDuration; /// /// Intended dispenser. @@ -294,31 +294,27 @@ public Hl7.Fhir.Model.Duration ExpectedSupplyDuration [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; protected internal override void CopyToInternal(Base other) { - var dest = other as DispenseRequestComponent; - - if (dest == null) - { + if(other is not DispenseRequestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(InitialFill != null) dest.InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)InitialFill.DeepCopyInternal(); - if(DispenseInterval != null) dest.DispenseInterval = (Hl7.Fhir.Model.Duration)DispenseInterval.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(NumberOfRepeatsAllowedElement != null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfRepeatsAllowedElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ExpectedSupplyDuration != null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)ExpectedSupplyDuration.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); + if(_InitialFill is not null) dest.InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)_InitialFill.DeepCopyInternal(); + if(_DispenseInterval is not null) dest.DispenseInterval = (Hl7.Fhir.Model.Duration)_DispenseInterval.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_NumberOfRepeatsAllowedElement is not null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfRepeatsAllowedElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ExpectedSupplyDuration is not null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)_ExpectedSupplyDuration.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -330,76 +326,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DispenseRequestComponent; - if(otherT == null) return false; + if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(InitialFill, otherT.InitialFill)) return false; - if(!comparer.Equals(DispenseInterval, otherT.DispenseInterval)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(NumberOfRepeatsAllowedElement, otherT.NumberOfRepeatsAllowedElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ExpectedSupplyDuration, otherT.ExpectedSupplyDuration)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; + if(!comparer.Equals(_DispenseInterval, otherT._DispenseInterval)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ExpectedSupplyDuration, otherT._ExpectedSupplyDuration)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "initialFill": - value = InitialFill; - return InitialFill is not null; + value = _InitialFill; + return _InitialFill is not null; case "dispenseInterval": - value = DispenseInterval; - return DispenseInterval is not null; + value = _DispenseInterval; + return _DispenseInterval is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "numberOfRepeatsAllowed": - value = NumberOfRepeatsAllowedElement; - return NumberOfRepeatsAllowedElement is not null; + value = _NumberOfRepeatsAllowedElement; + return _NumberOfRepeatsAllowedElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "expectedSupplyDuration": - value = ExpectedSupplyDuration; - return ExpectedSupplyDuration is not null; + value = _ExpectedSupplyDuration; + return _ExpectedSupplyDuration is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "initialFill": - InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)value; + InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent?)value; return this; case "dispenseInterval": - DispenseInterval = (Hl7.Fhir.Model.Duration)value; + DispenseInterval = (Hl7.Fhir.Model.Duration?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "numberOfRepeatsAllowed": - NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "expectedSupplyDuration": - ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)value; + ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -410,13 +406,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (InitialFill is not null) yield return new KeyValuePair("initialFill",InitialFill); - if (DispenseInterval is not null) yield return new KeyValuePair("dispenseInterval",DispenseInterval); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",NumberOfRepeatsAllowedElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",ExpectedSupplyDuration); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); + if (_InitialFill is not null) yield return new KeyValuePair("initialFill",_InitialFill); + if (_DispenseInterval is not null) yield return new KeyValuePair("dispenseInterval",_DispenseInterval); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",_NumberOfRepeatsAllowedElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",_ExpectedSupplyDuration); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); } } @@ -443,39 +439,35 @@ public partial class InitialFillComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// First fill duration. /// [FhirElement("duration", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration Duration + public Hl7.Fhir.Model.Duration? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Duration _Duration; + private Hl7.Fhir.Model.Duration? _Duration; protected internal override void CopyToInternal(Base other) { - var dest = other as InitialFillComponent; - - if (dest == null) - { + if(other is not InitialFillComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Duration)_Duration.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -487,41 +479,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InitialFillComponent; - if(otherT == null) return false; + if(other is not InitialFillComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Duration)value; + Duration = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -532,8 +524,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); } } @@ -563,13 +555,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Why should (not) substitution be made. @@ -577,26 +569,22 @@ public Hl7.Fhir.Model.DataType Allowed [FhirElement("reason", Order=50)] [Binding("MedicationIntendedSubstitutionReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -608,41 +596,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -653,8 +641,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -667,11 +655,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown. @@ -681,13 +669,13 @@ public List Identifier [Binding("MedicationRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown @@ -696,13 +684,10 @@ public Code StatusElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationrequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -713,13 +698,13 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationrequestStatus? Status [FhirElement("statusReason", Order=110)] [Binding("MedicationRequestStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option. @@ -729,13 +714,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [Binding("MedicationRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option @@ -744,13 +729,10 @@ public Code IntentElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -764,11 +746,11 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -777,13 +759,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("MedicationRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -792,13 +774,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -808,13 +787,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if request is prohibiting action @@ -823,13 +802,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -842,13 +818,13 @@ public bool? DoNotPerform [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reported + public Hl7.Fhir.Model.DataType? Reported { get { return _Reported; } set { _Reported = value; OnPropertyChanged("Reported"); } } - private Hl7.Fhir.Model.DataType _Reported; + private Hl7.Fhir.Model.DataType? _Reported; /// /// Medication to be taken. @@ -860,13 +836,13 @@ public Hl7.Fhir.Model.DataType Reported [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who or group medication request is for. @@ -876,13 +852,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of encounter/admission/stay. @@ -891,13 +867,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Information to support ordering of the medication. @@ -909,39 +885,36 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// When request was initially authored. /// [FhirElement("authoredOn", InSummary=true, Order=210, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request was initially authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -953,13 +926,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Intended performer of administration. @@ -968,13 +941,13 @@ public Hl7.Fhir.Model.ResourceReference Requester [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Desired kind of performer of the medication administration. @@ -982,13 +955,13 @@ public Hl7.Fhir.Model.ResourceReference Performer [FhirElement("performerType", InSummary=true, Order=240)] [Binding("MedicationRequestPerformerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Person who entered the request. @@ -997,13 +970,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Reason or indication for ordering or not ordering the medication. @@ -1014,11 +987,11 @@ public Hl7.Fhir.Model.ResourceReference Recorder [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or observation that supports why the prescription is being written. @@ -1030,11 +1003,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Instantiates FHIR protocol or definition. @@ -1044,24 +1017,24 @@ public List ReasonReference [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1076,24 +1049,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1110,24 +1083,24 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// Overall pattern of medication administration. @@ -1135,13 +1108,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [FhirElement("courseOfTherapyType", Order=320)] [Binding("MedicationRequestCourseOfTherapy")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CourseOfTherapyType + public Hl7.Fhir.Model.CodeableConcept? CourseOfTherapyType { get { return _CourseOfTherapyType; } set { _CourseOfTherapyType = value; OnPropertyChanged("CourseOfTherapyType"); } } - private Hl7.Fhir.Model.CodeableConcept _CourseOfTherapyType; + private Hl7.Fhir.Model.CodeableConcept? _CourseOfTherapyType; /// /// Associated insurance coverage. @@ -1153,11 +1126,11 @@ public Hl7.Fhir.Model.CodeableConcept CourseOfTherapyType [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Information about the prescription. @@ -1167,11 +1140,11 @@ public List Insurance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// How the medication should be taken. @@ -1181,37 +1154,37 @@ public List Note [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Medication supply authorization. /// [FhirElement("dispenseRequest", Order=360)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent DispenseRequest + public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? DispenseRequest { get { return _DispenseRequest; } set { _DispenseRequest = value; OnPropertyChanged("DispenseRequest"); } } - private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent _DispenseRequest; + private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? _DispenseRequest; /// /// Any restrictions on medication substitution. /// [FhirElement("substitution", Order=370)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? _Substitution; /// /// An order/prescription that is being replaced. @@ -1220,13 +1193,13 @@ public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PriorPrescription + public Hl7.Fhir.Model.ResourceReference? PriorPrescription { get { return _PriorPrescription; } set { _PriorPrescription = value; OnPropertyChanged("PriorPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _PriorPrescription; + private Hl7.Fhir.Model.ResourceReference? _PriorPrescription; /// /// Clinical Issue with action. @@ -1238,11 +1211,11 @@ public Hl7.Fhir.Model.ResourceReference PriorPrescription [DataMember] public List DetectedIssue { - get { if(_DetectedIssue==null) _DetectedIssue = new List(); return _DetectedIssue; } + get => _DetectedIssue ?? new List(); set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } - private List _DetectedIssue; + private List? _DetectedIssue; /// /// A list of events of interest in the lifecycle. @@ -1254,56 +1227,52 @@ public List DetectedIssue [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationRequest; - - if (dest == null) - { + if(other is not MedicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Reported != null) dest.Reported = (Hl7.Fhir.Model.DataType)Reported.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(CourseOfTherapyType != null) dest.CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)CourseOfTherapyType.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(DispenseRequest != null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)DispenseRequest.DeepCopyInternal(); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(PriorPrescription != null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)PriorPrescription.DeepCopyInternal(); - if(DetectedIssue.Any()) dest.DetectedIssue = new List(DetectedIssue.DeepCopyInternal()); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Reported is not null) dest.Reported = (Hl7.Fhir.Model.DataType)_Reported.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_CourseOfTherapyType is not null) dest.CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)_CourseOfTherapyType.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_DispenseRequest is not null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)_DispenseRequest.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_PriorPrescription is not null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)_PriorPrescription.DeepCopyInternal(); + if(_DetectedIssue is not null) dest.DetectedIssue = new List(_DetectedIssue.DeepCopyInternal()); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1315,251 +1284,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationRequest; - if(otherT == null) return false; + if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Reported, otherT.Reported)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(CourseOfTherapyType, otherT.CourseOfTherapyType)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(DispenseRequest, otherT.DispenseRequest)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.Equals(PriorPrescription, otherT.PriorPrescription)) return false; - if(!comparer.ListEquals(DetectedIssue, otherT.DetectedIssue)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Reported, otherT._Reported)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_CourseOfTherapyType, otherT._CourseOfTherapyType)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_DispenseRequest, otherT._DispenseRequest)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; + if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "reported": - value = Reported; - return Reported is not null; + value = _Reported; + return _Reported is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "courseOfTherapyType": - value = CourseOfTherapyType; - return CourseOfTherapyType is not null; + value = _CourseOfTherapyType; + return _CourseOfTherapyType is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "dispenseRequest": - value = DispenseRequest; - return DispenseRequest is not null; + value = _DispenseRequest; + return _DispenseRequest is not null; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "priorPrescription": - value = PriorPrescription; - return PriorPrescription is not null; + value = _PriorPrescription; + return _PriorPrescription is not null; case "detectedIssue": - value = DetectedIssue; - return DetectedIssue?.Any() == true; + value = _DetectedIssue; + return _DetectedIssue?.Any() == true; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "reported": - Reported = (Hl7.Fhir.Model.DataType)value; + Reported = (Hl7.Fhir.Model.DataType?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "courseOfTherapyType": - CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)value; + CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "dispenseRequest": - DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)value; + DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent?)value; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent?)value; return this; case "priorPrescription": - PriorPrescription = (Hl7.Fhir.Model.ResourceReference)value; + PriorPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "detectedIssue": - DetectedIssue = (List)value; + DetectedIssue = (List?)value!; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1570,38 +1539,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Reported is not null) yield return new KeyValuePair("reported",Reported); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (CourseOfTherapyType is not null) yield return new KeyValuePair("courseOfTherapyType",CourseOfTherapyType); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",DispenseRequest); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",PriorPrescription); - if (DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",DetectedIssue); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Reported is not null) yield return new KeyValuePair("reported",_Reported); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_CourseOfTherapyType is not null) yield return new KeyValuePair("courseOfTherapyType",_CourseOfTherapyType); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",_DispenseRequest); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",_PriorPrescription); + if (_DetectedIssue?.Any() == true) yield return new KeyValuePair("detectedIssue",_DetectedIssue); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs index d05f167a9..3e25a5165 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -136,11 +139,11 @@ public enum MedicationStatementStatusCodes [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfils plan, proposal or order. @@ -152,11 +155,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -168,11 +171,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken. @@ -182,13 +185,13 @@ public List PartOf [Binding("MedicationStatementStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | completed | entered-in-error | intended | stopped | on-hold | unknown | not-taken @@ -197,13 +200,10 @@ public Code S [IgnoreDataMember] public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -217,11 +217,11 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatusCodes? Status [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// Type of medication usage. @@ -229,13 +229,13 @@ public List StatusReason [FhirElement("category", InSummary=true, Order=140, FiveWs="FiveWs.class")] [Binding("MedicationStatementCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// What medication was taken. @@ -247,13 +247,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Medication + public Hl7.Fhir.Model.DataType? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.DataType _Medication; + private Hl7.Fhir.Model.DataType? _Medication; /// /// Who is/was taking the medication. @@ -263,13 +263,13 @@ public Hl7.Fhir.Model.DataType Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter / Episode associated with MedicationStatement. @@ -278,13 +278,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// The date/time or interval when the medication is/was/will be taken. @@ -293,41 +293,38 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the statement was asserted?. /// [FhirElement("dateAsserted", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateAssertedElement + public Hl7.Fhir.Model.FhirDateTime? DateAssertedElement { get { return _DateAssertedElement; } set { _DateAssertedElement = value; OnPropertyChanged("DateAssertedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateAssertedElement; + private Hl7.Fhir.Model.FhirDateTime? _DateAssertedElement; /// /// When the statement was asserted? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateAsserted + public string? DateAsserted { - get { return DateAssertedElement != null ? DateAssertedElement.Value : null; } + get => _DateAssertedElement?.Value; set { - if (value == null) - DateAssertedElement = null; - else - DateAssertedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateAssertedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateAsserted"); } } @@ -339,13 +336,13 @@ public string DateAsserted [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InformationSource + public Hl7.Fhir.Model.ResourceReference? InformationSource { get { return _InformationSource; } set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private Hl7.Fhir.Model.ResourceReference _InformationSource; + private Hl7.Fhir.Model.ResourceReference? _InformationSource; /// /// Additional supporting information. @@ -357,11 +354,11 @@ public Hl7.Fhir.Model.ResourceReference InformationSource [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// Reason for why the medication is being/was taken. @@ -372,11 +369,11 @@ public List DerivedFrom [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Condition or observation that supports why the medication is being/was taken. @@ -388,11 +385,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Further information about the statement. @@ -402,11 +399,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Details of how medication is/was taken or should be taken. @@ -416,41 +413,37 @@ public List Note [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationStatement; - - if (dest == null) - { + if(other is not MedicationStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.DataType)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateAssertedElement != null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopyInternal(); - if(InformationSource != null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.DataType)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateAssertedElement is not null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)_DateAssertedElement.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)_InformationSource.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -462,146 +455,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationStatement; - if(otherT == null) return false; + if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateAssertedElement, otherT.DateAssertedElement)) return false; - if(!comparer.Equals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateAssertedElement, otherT._DateAssertedElement)) return false; + if(!comparer.Equals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "dateAsserted": - value = DateAssertedElement; - return DateAssertedElement is not null; + value = _DateAssertedElement; + return _DateAssertedElement is not null; case "informationSource": - value = InformationSource; - return InformationSource is not null; + value = _InformationSource; + return _InformationSource is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.DataType)value; + Medication = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "dateAsserted": - DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "informationSource": - InformationSource = (Hl7.Fhir.Model.ResourceReference)value; + InformationSource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -612,23 +605,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",DateAssertedElement); - if (InformationSource is not null) yield return new KeyValuePair("informationSource",InformationSource); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",_DateAssertedElement); + if (_InformationSource is not null) yield return new KeyValuePair("informationSource",_InformationSource); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs index 7293a42b2..6402aeff0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,13 +81,13 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("ProductContactType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A product specific contact, person (in a role), or an organization. @@ -94,26 +97,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Organization","PractitionerRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Contact + public Hl7.Fhir.Model.ResourceReference? Contact { get { return _Contact; } set { _Contact = value; OnPropertyChanged("Contact"); } } - private Hl7.Fhir.Model.ResourceReference _Contact; + private Hl7.Fhir.Model.ResourceReference? _Contact; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Contact != null) dest.Contact = (Hl7.Fhir.Model.ResourceReference)Contact.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = (Hl7.Fhir.Model.ResourceReference)_Contact.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -125,41 +124,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Contact, otherT.Contact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Contact, otherT._Contact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "contact": - value = Contact; - return Contact is not null; + value = _Contact; + return _Contact is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contact": - Contact = (Hl7.Fhir.Model.ResourceReference)value; + Contact = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -170,8 +169,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Contact is not null) yield return new KeyValuePair("contact",Contact); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Contact is not null) yield return new KeyValuePair("contact",_Contact); } } @@ -195,28 +194,25 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("productName", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// The full product name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -227,13 +223,13 @@ public string ProductName [FhirElement("type", InSummary=true, Order=50)] [Binding("ProductNameType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Coding words or phrases of the name. @@ -243,11 +239,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List NamePart { - get { if(_NamePart==null) _NamePart = new List(); return _NamePart; } + get => _NamePart ?? new List(); set { _NamePart = value; OnPropertyChanged("NamePart"); } } - private List _NamePart; + private List? _NamePart; /// /// Country and jurisdiction where the name applies. @@ -257,26 +253,22 @@ public List NamePar [DataMember] public List CountryLanguage { - get { if(_CountryLanguage==null) _CountryLanguage = new List(); return _CountryLanguage; } + get => _CountryLanguage ?? new List(); set { _CountryLanguage = value; OnPropertyChanged("CountryLanguage"); } } - private List _CountryLanguage; + private List? _CountryLanguage; protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NamePart.Any()) dest.NamePart = new List(NamePart.DeepCopyInternal()); - if(CountryLanguage.Any()) dest.CountryLanguage = new List(CountryLanguage.DeepCopyInternal()); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NamePart is not null) dest.NamePart = new List(_NamePart.DeepCopyInternal()); + if(_CountryLanguage is not null) dest.CountryLanguage = new List(_CountryLanguage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -288,55 +280,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(NamePart, otherT.NamePart)) return false; - if(!comparer.ListEquals(CountryLanguage, otherT.CountryLanguage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_NamePart, otherT._NamePart)) return false; + if(!comparer.ListEquals(_CountryLanguage, otherT._CountryLanguage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "namePart": - value = NamePart; - return NamePart?.Any() == true; + value = _NamePart; + return _NamePart?.Any() == true; case "countryLanguage": - value = CountryLanguage; - return CountryLanguage?.Any() == true; + value = _CountryLanguage; + return _CountryLanguage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "namePart": - NamePart = (List)value; + NamePart = (List?)value!; return this; case "countryLanguage": - CountryLanguage = (List)value; + CountryLanguage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -347,10 +339,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NamePart?.Any() == true) yield return new KeyValuePair("namePart",NamePart); - if (CountryLanguage?.Any() == true) yield return new KeyValuePair("countryLanguage",CountryLanguage); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NamePart?.Any() == true) yield return new KeyValuePair("namePart",_NamePart); + if (_CountryLanguage?.Any() == true) yield return new KeyValuePair("countryLanguage",_CountryLanguage); } } @@ -374,28 +366,25 @@ public partial class NamePartComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("part", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PartElement + public Hl7.Fhir.Model.FhirString? PartElement { get { return _PartElement; } set { _PartElement = value; OnPropertyChanged("PartElement"); } } - private Hl7.Fhir.Model.FhirString _PartElement; + private Hl7.Fhir.Model.FhirString? _PartElement; /// /// A fragment of a product name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Part + public string? Part { - get { return PartElement != null ? PartElement.Value : null; } + get => _PartElement?.Value; set { - if (value == null) - PartElement = null; - else - PartElement = new Hl7.Fhir.Model.FhirString(value); + PartElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Part"); } } @@ -407,26 +396,22 @@ public string Part [Binding("ProductNamePartType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as NamePartComponent; - - if (dest == null) - { + if(other is not NamePartComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PartElement != null) dest.PartElement = (Hl7.Fhir.Model.FhirString)PartElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_PartElement is not null) dest.PartElement = (Hl7.Fhir.Model.FhirString)_PartElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -438,41 +423,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NamePartComponent; - if(otherT == null) return false; + if(other is not NamePartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PartElement, otherT.PartElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "part": - value = PartElement; - return PartElement is not null; + value = _PartElement; + return _PartElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "part": - PartElement = (Hl7.Fhir.Model.FhirString)value; + PartElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -483,8 +468,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PartElement is not null) yield return new KeyValuePair("part",PartElement); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_PartElement is not null) yield return new KeyValuePair("part",_PartElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -512,13 +497,13 @@ public partial class CountryLanguageComponent : Hl7.Fhir.Model.BackboneElement [Binding("Country")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Country + public Hl7.Fhir.Model.CodeableConcept? Country { get { return _Country; } set { _Country = value; OnPropertyChanged("Country"); } } - private Hl7.Fhir.Model.CodeableConcept _Country; + private Hl7.Fhir.Model.CodeableConcept? _Country; /// /// Jurisdiction code for where this name applies. @@ -526,13 +511,13 @@ public Hl7.Fhir.Model.CodeableConcept Country [FhirElement("jurisdiction", InSummary=true, Order=50)] [Binding("Jurisdiction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; /// /// Language code for this name. @@ -541,27 +526,23 @@ public Hl7.Fhir.Model.CodeableConcept Jurisdiction [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as CountryLanguageComponent; - - if (dest == null) - { + if(other is not CountryLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Country != null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)Country.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_Country is not null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)_Country.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -573,48 +554,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CountryLanguageComponent; - if(otherT == null) return false; + if(other is not CountryLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Country, otherT.Country)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "country": - value = Country; - return Country is not null; + value = _Country; + return _Country is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "country": - Country = (Hl7.Fhir.Model.CodeableConcept)value; + Country = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -625,9 +606,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Country is not null) yield return new KeyValuePair("country",Country); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_Country is not null) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -654,13 +635,13 @@ public partial class CrossReferenceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("product", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Product + public Hl7.Fhir.Model.CodeableReference? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.CodeableReference _Product; + private Hl7.Fhir.Model.CodeableReference? _Product; /// /// The type of relationship, for instance branded to generic or virtual to actual product. @@ -668,26 +649,22 @@ public Hl7.Fhir.Model.CodeableReference Product [FhirElement("type", InSummary=true, Order=50)] [Binding("ProductCrossReferenceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as CrossReferenceComponent; - - if (dest == null) - { + if(other is not CrossReferenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Product != null) dest.Product = (Hl7.Fhir.Model.CodeableReference)Product.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.CodeableReference)_Product.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -699,41 +676,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CrossReferenceComponent; - if(otherT == null) return false; + if(other is not CrossReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "product": - Product = (Hl7.Fhir.Model.CodeableReference)value; + Product = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -744,8 +721,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -771,26 +748,26 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Type + public Hl7.Fhir.Model.CodeableReference? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableReference _Type; + private Hl7.Fhir.Model.CodeableReference? _Type; /// /// Date range of applicability. /// [FhirElement("effectiveDate", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period EffectiveDate + public Hl7.Fhir.Model.Period? EffectiveDate { get { return _EffectiveDate; } set { _EffectiveDate = value; OnPropertyChanged("EffectiveDate"); } } - private Hl7.Fhir.Model.Period _EffectiveDate; + private Hl7.Fhir.Model.Period? _EffectiveDate; /// /// The organization responsible for the particular process, e.g. the manufacturer or importer. @@ -802,11 +779,11 @@ public Hl7.Fhir.Model.Period EffectiveDate [DataMember] public List Organization { - get { if(_Organization==null) _Organization = new List(); return _Organization; } + get => _Organization ?? new List(); set { _Organization = value; OnPropertyChanged("Organization"); } } - private List _Organization; + private List? _Organization; /// /// Specifies whether this process is considered proprietary or confidential. @@ -814,28 +791,24 @@ public List Organization [FhirElement("confidentialityIndicator", InSummary=true, Order=70)] [Binding("ProductConfidentiality")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ConfidentialityIndicator + public Hl7.Fhir.Model.CodeableConcept? ConfidentialityIndicator { get { return _ConfidentialityIndicator; } set { _ConfidentialityIndicator = value; OnPropertyChanged("ConfidentialityIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _ConfidentialityIndicator; + private Hl7.Fhir.Model.CodeableConcept? _ConfidentialityIndicator; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableReference)Type.DeepCopyInternal(); - if(EffectiveDate != null) dest.EffectiveDate = (Hl7.Fhir.Model.Period)EffectiveDate.DeepCopyInternal(); - if(Organization.Any()) dest.Organization = new List(Organization.DeepCopyInternal()); - if(ConfidentialityIndicator != null) dest.ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)ConfidentialityIndicator.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableReference)_Type.DeepCopyInternal(); + if(_EffectiveDate is not null) dest.EffectiveDate = (Hl7.Fhir.Model.Period)_EffectiveDate.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = new List(_Organization.DeepCopyInternal()); + if(_ConfidentialityIndicator is not null) dest.ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)_ConfidentialityIndicator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -847,55 +820,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(EffectiveDate, otherT.EffectiveDate)) return false; - if(!comparer.ListEquals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(ConfidentialityIndicator, otherT.ConfidentialityIndicator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_EffectiveDate, otherT._EffectiveDate)) return false; + if(!comparer.ListEquals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_ConfidentialityIndicator, otherT._ConfidentialityIndicator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "effectiveDate": - value = EffectiveDate; - return EffectiveDate is not null; + value = _EffectiveDate; + return _EffectiveDate is not null; case "organization": - value = Organization; - return Organization?.Any() == true; + value = _Organization; + return _Organization?.Any() == true; case "confidentialityIndicator": - value = ConfidentialityIndicator; - return ConfidentialityIndicator is not null; + value = _ConfidentialityIndicator; + return _ConfidentialityIndicator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableReference)value; + Type = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "effectiveDate": - EffectiveDate = (Hl7.Fhir.Model.Period)value; + EffectiveDate = (Hl7.Fhir.Model.Period?)value; return this; case "organization": - Organization = (List)value; + Organization = (List?)value!; return this; case "confidentialityIndicator": - ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -906,10 +879,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (EffectiveDate is not null) yield return new KeyValuePair("effectiveDate",EffectiveDate); - if (Organization?.Any() == true) yield return new KeyValuePair("organization",Organization); - if (ConfidentialityIndicator is not null) yield return new KeyValuePair("confidentialityIndicator",ConfidentialityIndicator); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_EffectiveDate is not null) yield return new KeyValuePair("effectiveDate",_EffectiveDate); + if (_Organization?.Any() == true) yield return new KeyValuePair("organization",_Organization); + if (_ConfidentialityIndicator is not null) yield return new KeyValuePair("confidentialityIndicator",_ConfidentialityIndicator); } } @@ -937,13 +910,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProductCharacteristic")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -952,26 +925,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -983,41 +952,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1028,8 +997,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1042,11 +1011,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Regulatory type, e.g. Investigational or Authorized. @@ -1054,13 +1023,13 @@ public List Identifier [FhirElement("type", InSummary=true, Order=100)] [Binding("MedicinalProductType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// If this medicine applies to human or veterinary uses. @@ -1068,41 +1037,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("domain", InSummary=true, Order=110)] [Binding("MedicinalProductType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Domain + public Hl7.Fhir.Model.CodeableConcept? Domain { get { return _Domain; } set { _Domain = value; OnPropertyChanged("Domain"); } } - private Hl7.Fhir.Model.CodeableConcept _Domain; + private Hl7.Fhir.Model.CodeableConcept? _Domain; /// /// A business identifier relating to a specific version of the product. /// [FhirElement("version", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// A business identifier relating to a specific version of the product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1113,41 +1079,38 @@ public string Version [FhirElement("status", InSummary=true, IsModifier=true, Order=130)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the given status became applicable. /// [FhirElement("statusDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the given status became applicable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -1157,28 +1120,25 @@ public string StatusDate /// [FhirElement("description", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// General description of this product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1189,13 +1149,13 @@ public string Description [FhirElement("combinedPharmaceuticalDoseForm", InSummary=true, Order=160)] [Binding("CombinedDoseForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CombinedPharmaceuticalDoseForm + public Hl7.Fhir.Model.CodeableConcept? CombinedPharmaceuticalDoseForm { get { return _CombinedPharmaceuticalDoseForm; } set { _CombinedPharmaceuticalDoseForm = value; OnPropertyChanged("CombinedPharmaceuticalDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _CombinedPharmaceuticalDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _CombinedPharmaceuticalDoseForm; /// /// The path by which the product is taken into or makes contact with the body. @@ -1206,39 +1166,36 @@ public Hl7.Fhir.Model.CodeableConcept CombinedPharmaceuticalDoseForm [DataMember] public List Route { - get { if(_Route==null) _Route = new List(); return _Route; } + get => _Route ?? new List(); set { _Route = value; OnPropertyChanged("Route"); } } - private List _Route; + private List? _Route; /// /// Description of indication(s) for this product, used when structured indications are not required. /// [FhirElement("indication", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown IndicationElement + public Hl7.Fhir.Model.Markdown? IndicationElement { get { return _IndicationElement; } set { _IndicationElement = value; OnPropertyChanged("IndicationElement"); } } - private Hl7.Fhir.Model.Markdown _IndicationElement; + private Hl7.Fhir.Model.Markdown? _IndicationElement; /// /// Description of indication(s) for this product, used when structured indications are not required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Indication + public string? Indication { - get { return IndicationElement != null ? IndicationElement.Value : null; } + get => _IndicationElement?.Value; set { - if (value == null) - IndicationElement = null; - else - IndicationElement = new Hl7.Fhir.Model.Markdown(value); + IndicationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Indication"); } } @@ -1249,13 +1206,13 @@ public string Indication [FhirElement("legalStatusOfSupply", InSummary=true, Order=190)] [Binding("LegalStatusOfSupply")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply + public Hl7.Fhir.Model.CodeableConcept? LegalStatusOfSupply { get { return _LegalStatusOfSupply; } set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalStatusOfSupply; + private Hl7.Fhir.Model.CodeableConcept? _LegalStatusOfSupply; /// /// Whether the Medicinal Product is subject to additional monitoring for regulatory reasons. @@ -1263,13 +1220,13 @@ public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply [FhirElement("additionalMonitoringIndicator", InSummary=true, Order=200)] [Binding("AdditionalMonitoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdditionalMonitoringIndicator + public Hl7.Fhir.Model.CodeableConcept? AdditionalMonitoringIndicator { get { return _AdditionalMonitoringIndicator; } set { _AdditionalMonitoringIndicator = value; OnPropertyChanged("AdditionalMonitoringIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _AdditionalMonitoringIndicator; + private Hl7.Fhir.Model.CodeableConcept? _AdditionalMonitoringIndicator; /// /// Whether the Medicinal Product is subject to special measures for regulatory reasons. @@ -1280,11 +1237,11 @@ public Hl7.Fhir.Model.CodeableConcept AdditionalMonitoringIndicator [DataMember] public List SpecialMeasures { - get { if(_SpecialMeasures==null) _SpecialMeasures = new List(); return _SpecialMeasures; } + get => _SpecialMeasures ?? new List(); set { _SpecialMeasures = value; OnPropertyChanged("SpecialMeasures"); } } - private List _SpecialMeasures; + private List? _SpecialMeasures; /// /// If authorised for use in children. @@ -1292,13 +1249,13 @@ public List SpecialMeasures [FhirElement("pediatricUseIndicator", InSummary=true, Order=220)] [Binding("PediatricUse")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PediatricUseIndicator + public Hl7.Fhir.Model.CodeableConcept? PediatricUseIndicator { get { return _PediatricUseIndicator; } set { _PediatricUseIndicator = value; OnPropertyChanged("PediatricUseIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _PediatricUseIndicator; + private Hl7.Fhir.Model.CodeableConcept? _PediatricUseIndicator; /// /// Allows the product to be classified by various systems. @@ -1309,11 +1266,11 @@ public Hl7.Fhir.Model.CodeableConcept PediatricUseIndicator [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Marketing status of the medicinal product, in contrast to marketing authorization. @@ -1323,11 +1280,11 @@ public List Classification [DataMember] public List MarketingStatus { - get { if(_MarketingStatus==null) _MarketingStatus = new List(); return _MarketingStatus; } + get => _MarketingStatus ?? new List(); set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } - private List _MarketingStatus; + private List? _MarketingStatus; /// /// Package type for the product. @@ -1338,11 +1295,11 @@ public List MarketingStatus [DataMember] public List PackagedMedicinalProduct { - get { if(_PackagedMedicinalProduct==null) _PackagedMedicinalProduct = new List(); return _PackagedMedicinalProduct; } + get => _PackagedMedicinalProduct ?? new List(); set { _PackagedMedicinalProduct = value; OnPropertyChanged("PackagedMedicinalProduct"); } } - private List _PackagedMedicinalProduct; + private List? _PackagedMedicinalProduct; /// /// The ingredients of this medicinal product - when not detailed in other resources. @@ -1353,11 +1310,11 @@ public List PackagedMedicinalProduct [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Any component of the drug product which is not the chemical entity defined as the drug substance, or an excipient in the drug product. @@ -1368,11 +1325,11 @@ public List Ingredient [DataMember] public List Impurity { - get { if(_Impurity==null) _Impurity = new List(); return _Impurity; } + get => _Impurity ?? new List(); set { _Impurity = value; OnPropertyChanged("Impurity"); } } - private List _Impurity; + private List? _Impurity; /// /// Additional documentation about the medicinal product. @@ -1384,11 +1341,11 @@ public List Impurity [DataMember] public List AttachedDocument { - get { if(_AttachedDocument==null) _AttachedDocument = new List(); return _AttachedDocument; } + get => _AttachedDocument ?? new List(); set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } - private List _AttachedDocument; + private List? _AttachedDocument; /// /// A master file for the medicinal product (e.g. Pharmacovigilance System Master File). @@ -1400,11 +1357,11 @@ public List AttachedDocument [DataMember] public List MasterFile { - get { if(_MasterFile==null) _MasterFile = new List(); return _MasterFile; } + get => _MasterFile ?? new List(); set { _MasterFile = value; OnPropertyChanged("MasterFile"); } } - private List _MasterFile; + private List? _MasterFile; /// /// A product specific contact, person (in a role), or an organization. @@ -1414,11 +1371,11 @@ public List MasterFile [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Clinical trials or studies that this product is involved in. @@ -1430,11 +1387,11 @@ public List Contact [DataMember] public List ClinicalTrial { - get { if(_ClinicalTrial==null) _ClinicalTrial = new List(); return _ClinicalTrial; } + get => _ClinicalTrial ?? new List(); set { _ClinicalTrial = value; OnPropertyChanged("ClinicalTrial"); } } - private List _ClinicalTrial; + private List? _ClinicalTrial; /// /// A code that this product is known by, within some formal terminology. @@ -1445,11 +1402,11 @@ public List ClinicalTrial [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// The product's name, including full name and possibly coded parts. @@ -1459,11 +1416,11 @@ public List Code [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// Reference to another product, e.g. for linking authorised to investigational product. @@ -1473,11 +1430,11 @@ public List Name [DataMember] public List CrossReference { - get { if(_CrossReference==null) _CrossReference = new List(); return _CrossReference; } + get => _CrossReference ?? new List(); set { _CrossReference = value; OnPropertyChanged("CrossReference"); } } - private List _CrossReference; + private List? _CrossReference; /// /// A manufacturing or administrative process for the medicinal product. @@ -1487,11 +1444,11 @@ public List C [DataMember] public List Operation { - get { if(_Operation==null) _Operation = new List(); return _Operation; } + get => _Operation ?? new List(); set { _Operation = value; OnPropertyChanged("Operation"); } } - private List _Operation; + private List? _Operation; /// /// Key product features such as "sugar free", "modified release". @@ -1501,52 +1458,48 @@ public List Operat [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductDefinition; - - if (dest == null) - { + if(other is not MedicinalProductDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Domain != null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)Domain.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(CombinedPharmaceuticalDoseForm != null) dest.CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)CombinedPharmaceuticalDoseForm.DeepCopyInternal(); - if(Route.Any()) dest.Route = new List(Route.DeepCopyInternal()); - if(IndicationElement != null) dest.IndicationElement = (Hl7.Fhir.Model.Markdown)IndicationElement.DeepCopyInternal(); - if(LegalStatusOfSupply != null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)LegalStatusOfSupply.DeepCopyInternal(); - if(AdditionalMonitoringIndicator != null) dest.AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)AdditionalMonitoringIndicator.DeepCopyInternal(); - if(SpecialMeasures.Any()) dest.SpecialMeasures = new List(SpecialMeasures.DeepCopyInternal()); - if(PediatricUseIndicator != null) dest.PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)PediatricUseIndicator.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(MarketingStatus.Any()) dest.MarketingStatus = new List(MarketingStatus.DeepCopyInternal()); - if(PackagedMedicinalProduct.Any()) dest.PackagedMedicinalProduct = new List(PackagedMedicinalProduct.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Impurity.Any()) dest.Impurity = new List(Impurity.DeepCopyInternal()); - if(AttachedDocument.Any()) dest.AttachedDocument = new List(AttachedDocument.DeepCopyInternal()); - if(MasterFile.Any()) dest.MasterFile = new List(MasterFile.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(ClinicalTrial.Any()) dest.ClinicalTrial = new List(ClinicalTrial.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(CrossReference.Any()) dest.CrossReference = new List(CrossReference.DeepCopyInternal()); - if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Domain is not null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)_Domain.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_CombinedPharmaceuticalDoseForm is not null) dest.CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)_CombinedPharmaceuticalDoseForm.DeepCopyInternal(); + if(_Route is not null) dest.Route = new List(_Route.DeepCopyInternal()); + if(_IndicationElement is not null) dest.IndicationElement = (Hl7.Fhir.Model.Markdown)_IndicationElement.DeepCopyInternal(); + if(_LegalStatusOfSupply is not null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)_LegalStatusOfSupply.DeepCopyInternal(); + if(_AdditionalMonitoringIndicator is not null) dest.AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)_AdditionalMonitoringIndicator.DeepCopyInternal(); + if(_SpecialMeasures is not null) dest.SpecialMeasures = new List(_SpecialMeasures.DeepCopyInternal()); + if(_PediatricUseIndicator is not null) dest.PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)_PediatricUseIndicator.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_MarketingStatus is not null) dest.MarketingStatus = new List(_MarketingStatus.DeepCopyInternal()); + if(_PackagedMedicinalProduct is not null) dest.PackagedMedicinalProduct = new List(_PackagedMedicinalProduct.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Impurity is not null) dest.Impurity = new List(_Impurity.DeepCopyInternal()); + if(_AttachedDocument is not null) dest.AttachedDocument = new List(_AttachedDocument.DeepCopyInternal()); + if(_MasterFile is not null) dest.MasterFile = new List(_MasterFile.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_ClinicalTrial is not null) dest.ClinicalTrial = new List(_ClinicalTrial.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_CrossReference is not null) dest.CrossReference = new List(_CrossReference.DeepCopyInternal()); + if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1558,223 +1511,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductDefinition; - if(otherT == null) return false; + if(other is not MedicinalProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Domain, otherT.Domain)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(CombinedPharmaceuticalDoseForm, otherT.CombinedPharmaceuticalDoseForm)) return false; - if(!comparer.ListEquals(Route, otherT.Route)) return false; - if(!comparer.Equals(IndicationElement, otherT.IndicationElement)) return false; - if(!comparer.Equals(LegalStatusOfSupply, otherT.LegalStatusOfSupply)) return false; - if(!comparer.Equals(AdditionalMonitoringIndicator, otherT.AdditionalMonitoringIndicator)) return false; - if(!comparer.ListEquals(SpecialMeasures, otherT.SpecialMeasures)) return false; - if(!comparer.Equals(PediatricUseIndicator, otherT.PediatricUseIndicator)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(MarketingStatus, otherT.MarketingStatus)) return false; - if(!comparer.ListEquals(PackagedMedicinalProduct, otherT.PackagedMedicinalProduct)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(Impurity, otherT.Impurity)) return false; - if(!comparer.ListEquals(AttachedDocument, otherT.AttachedDocument)) return false; - if(!comparer.ListEquals(MasterFile, otherT.MasterFile)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(ClinicalTrial, otherT.ClinicalTrial)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(CrossReference, otherT.CrossReference)) return false; - if(!comparer.ListEquals(Operation, otherT.Operation)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Domain, otherT._Domain)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_CombinedPharmaceuticalDoseForm, otherT._CombinedPharmaceuticalDoseForm)) return false; + if(!comparer.ListEquals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_IndicationElement, otherT._IndicationElement)) return false; + if(!comparer.Equals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; + if(!comparer.Equals(_AdditionalMonitoringIndicator, otherT._AdditionalMonitoringIndicator)) return false; + if(!comparer.ListEquals(_SpecialMeasures, otherT._SpecialMeasures)) return false; + if(!comparer.Equals(_PediatricUseIndicator, otherT._PediatricUseIndicator)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_MarketingStatus, otherT._MarketingStatus)) return false; + if(!comparer.ListEquals(_PackagedMedicinalProduct, otherT._PackagedMedicinalProduct)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_Impurity, otherT._Impurity)) return false; + if(!comparer.ListEquals(_AttachedDocument, otherT._AttachedDocument)) return false; + if(!comparer.ListEquals(_MasterFile, otherT._MasterFile)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_ClinicalTrial, otherT._ClinicalTrial)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_CrossReference, otherT._CrossReference)) return false; + if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "domain": - value = Domain; - return Domain is not null; + value = _Domain; + return _Domain is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "combinedPharmaceuticalDoseForm": - value = CombinedPharmaceuticalDoseForm; - return CombinedPharmaceuticalDoseForm is not null; + value = _CombinedPharmaceuticalDoseForm; + return _CombinedPharmaceuticalDoseForm is not null; case "route": - value = Route; - return Route?.Any() == true; + value = _Route; + return _Route?.Any() == true; case "indication": - value = IndicationElement; - return IndicationElement is not null; + value = _IndicationElement; + return _IndicationElement is not null; case "legalStatusOfSupply": - value = LegalStatusOfSupply; - return LegalStatusOfSupply is not null; + value = _LegalStatusOfSupply; + return _LegalStatusOfSupply is not null; case "additionalMonitoringIndicator": - value = AdditionalMonitoringIndicator; - return AdditionalMonitoringIndicator is not null; + value = _AdditionalMonitoringIndicator; + return _AdditionalMonitoringIndicator is not null; case "specialMeasures": - value = SpecialMeasures; - return SpecialMeasures?.Any() == true; + value = _SpecialMeasures; + return _SpecialMeasures?.Any() == true; case "pediatricUseIndicator": - value = PediatricUseIndicator; - return PediatricUseIndicator is not null; + value = _PediatricUseIndicator; + return _PediatricUseIndicator is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "marketingStatus": - value = MarketingStatus; - return MarketingStatus?.Any() == true; + value = _MarketingStatus; + return _MarketingStatus?.Any() == true; case "packagedMedicinalProduct": - value = PackagedMedicinalProduct; - return PackagedMedicinalProduct?.Any() == true; + value = _PackagedMedicinalProduct; + return _PackagedMedicinalProduct?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "impurity": - value = Impurity; - return Impurity?.Any() == true; + value = _Impurity; + return _Impurity?.Any() == true; case "attachedDocument": - value = AttachedDocument; - return AttachedDocument?.Any() == true; + value = _AttachedDocument; + return _AttachedDocument?.Any() == true; case "masterFile": - value = MasterFile; - return MasterFile?.Any() == true; + value = _MasterFile; + return _MasterFile?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "clinicalTrial": - value = ClinicalTrial; - return ClinicalTrial?.Any() == true; + value = _ClinicalTrial; + return _ClinicalTrial?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "crossReference": - value = CrossReference; - return CrossReference?.Any() == true; + value = _CrossReference; + return _CrossReference?.Any() == true; case "operation": - value = Operation; - return Operation?.Any() == true; + value = _Operation; + return _Operation?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "domain": - Domain = (Hl7.Fhir.Model.CodeableConcept)value; + Domain = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "combinedPharmaceuticalDoseForm": - CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (List)value; + Route = (List?)value!; return this; case "indication": - IndicationElement = (Hl7.Fhir.Model.Markdown)value; + IndicationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "legalStatusOfSupply": - LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)value; + LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additionalMonitoringIndicator": - AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialMeasures": - SpecialMeasures = (List)value; + SpecialMeasures = (List?)value!; return this; case "pediatricUseIndicator": - PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "marketingStatus": - MarketingStatus = (List)value; + MarketingStatus = (List?)value!; return this; case "packagedMedicinalProduct": - PackagedMedicinalProduct = (List)value; + PackagedMedicinalProduct = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "impurity": - Impurity = (List)value; + Impurity = (List?)value!; return this; case "attachedDocument": - AttachedDocument = (List)value; + AttachedDocument = (List?)value!; return this; case "masterFile": - MasterFile = (List)value; + MasterFile = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "clinicalTrial": - ClinicalTrial = (List)value; + ClinicalTrial = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "crossReference": - CrossReference = (List)value; + CrossReference = (List?)value!; return this; case "operation": - Operation = (List)value; + Operation = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1785,34 +1738,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Domain is not null) yield return new KeyValuePair("domain",Domain); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (CombinedPharmaceuticalDoseForm is not null) yield return new KeyValuePair("combinedPharmaceuticalDoseForm",CombinedPharmaceuticalDoseForm); - if (Route?.Any() == true) yield return new KeyValuePair("route",Route); - if (IndicationElement is not null) yield return new KeyValuePair("indication",IndicationElement); - if (LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",LegalStatusOfSupply); - if (AdditionalMonitoringIndicator is not null) yield return new KeyValuePair("additionalMonitoringIndicator",AdditionalMonitoringIndicator); - if (SpecialMeasures?.Any() == true) yield return new KeyValuePair("specialMeasures",SpecialMeasures); - if (PediatricUseIndicator is not null) yield return new KeyValuePair("pediatricUseIndicator",PediatricUseIndicator); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",MarketingStatus); - if (PackagedMedicinalProduct?.Any() == true) yield return new KeyValuePair("packagedMedicinalProduct",PackagedMedicinalProduct); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Impurity?.Any() == true) yield return new KeyValuePair("impurity",Impurity); - if (AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",AttachedDocument); - if (MasterFile?.Any() == true) yield return new KeyValuePair("masterFile",MasterFile); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (ClinicalTrial?.Any() == true) yield return new KeyValuePair("clinicalTrial",ClinicalTrial); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (CrossReference?.Any() == true) yield return new KeyValuePair("crossReference",CrossReference); - if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Domain is not null) yield return new KeyValuePair("domain",_Domain); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_CombinedPharmaceuticalDoseForm is not null) yield return new KeyValuePair("combinedPharmaceuticalDoseForm",_CombinedPharmaceuticalDoseForm); + if (_Route?.Any() == true) yield return new KeyValuePair("route",_Route); + if (_IndicationElement is not null) yield return new KeyValuePair("indication",_IndicationElement); + if (_LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",_LegalStatusOfSupply); + if (_AdditionalMonitoringIndicator is not null) yield return new KeyValuePair("additionalMonitoringIndicator",_AdditionalMonitoringIndicator); + if (_SpecialMeasures?.Any() == true) yield return new KeyValuePair("specialMeasures",_SpecialMeasures); + if (_PediatricUseIndicator is not null) yield return new KeyValuePair("pediatricUseIndicator",_PediatricUseIndicator); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",_MarketingStatus); + if (_PackagedMedicinalProduct?.Any() == true) yield return new KeyValuePair("packagedMedicinalProduct",_PackagedMedicinalProduct); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Impurity?.Any() == true) yield return new KeyValuePair("impurity",_Impurity); + if (_AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",_AttachedDocument); + if (_MasterFile?.Any() == true) yield return new KeyValuePair("masterFile",_MasterFile); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_ClinicalTrial?.Any() == true) yield return new KeyValuePair("clinicalTrial",_ClinicalTrial); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_CrossReference?.Any() == true) yield return new KeyValuePair("crossReference",_CrossReference); + if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs index 315341bb6..67ccd8774 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,13 +115,13 @@ public partial class FocusComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Type of resource @@ -127,13 +130,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -143,28 +143,25 @@ public Hl7.Fhir.Model.ResourceType? Code /// [FhirElement("profile", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile that must be adhered to by focus /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -175,13 +172,13 @@ public string Profile [FhirElement("min", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Minimum number of focuses of this type @@ -190,13 +187,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -206,46 +200,39 @@ public int? Min /// [FhirElement("max", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum number of focuses of this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FocusComponent; - - if (dest == null) - { + if(other is not FocusComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -257,55 +244,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocusComponent; - if(otherT == null) return false; + if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -316,10 +303,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); } } @@ -347,28 +334,25 @@ public partial class AllowedResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("message", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical MessageElement + public Hl7.Fhir.Model.Canonical? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Canonical _MessageElement; + private Hl7.Fhir.Model.Canonical? _MessageElement; /// /// Reference to allowed message definition response /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Canonical(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Message"); } } @@ -378,44 +362,37 @@ public string Message /// [FhirElement("situation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown SituationElement + public Hl7.Fhir.Model.Markdown? SituationElement { get { return _SituationElement; } set { _SituationElement = value; OnPropertyChanged("SituationElement"); } } - private Hl7.Fhir.Model.Markdown _SituationElement; + private Hl7.Fhir.Model.Markdown? _SituationElement; /// /// When should this response be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Situation + public string? Situation { - get { return SituationElement != null ? SituationElement.Value : null; } + get => _SituationElement?.Value; set { - if (value == null) - SituationElement = null; - else - SituationElement = new Hl7.Fhir.Model.Markdown(value); + SituationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Situation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AllowedResponseComponent; - - if (dest == null) - { + if(other is not AllowedResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Canonical)MessageElement.DeepCopyInternal(); - if(SituationElement != null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)SituationElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Canonical)_MessageElement.DeepCopyInternal(); + if(_SituationElement is not null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)_SituationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -427,41 +404,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllowedResponseComponent; - if(otherT == null) return false; + if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(SituationElement, otherT.SituationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "situation": - value = SituationElement; - return SituationElement is not null; + value = _SituationElement; + return _SituationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "message": - MessageElement = (Hl7.Fhir.Model.Canonical)value; + MessageElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "situation": - SituationElement = (Hl7.Fhir.Model.Markdown)value; + SituationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -472,8 +449,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (SituationElement is not null) yield return new KeyValuePair("situation",SituationElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_SituationElement is not null) yield return new KeyValuePair("situation",_SituationElement); } } @@ -483,28 +460,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Business Identifier for a given MessageDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -517,39 +491,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the message definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -559,28 +530,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this message definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -590,28 +558,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this message definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -624,24 +589,24 @@ public string Title [DataMember] public List ReplacesElement { - get { if(_ReplacesElement==null) _ReplacesElement = new List(); return _ReplacesElement; } + get => _ReplacesElement ?? new List(); set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } - private List _ReplacesElement; + private List? _ReplacesElement; /// /// Takes the place of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Replaces + public IEnumerable? Replaces { - get { return ReplacesElement != null ? ReplacesElement.Select(elem => elem.Value) : null; } + get => _ReplacesElement?.Select(elem => elem.Value); set { if (value == null) - ReplacesElement = null; + ReplacesElement = null!; else ReplacesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Replaces"); @@ -656,13 +621,13 @@ public IEnumerable Replaces [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -671,13 +636,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -687,13 +649,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -702,13 +664,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -719,28 +678,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -750,28 +706,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -784,39 +737,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the message definition. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -829,11 +779,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for message definition (if applicable). @@ -844,39 +794,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this message definition is defined. /// [FhirElement("purpose", InSummary=true, Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this message definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -886,28 +833,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -917,28 +861,25 @@ public string Copyright /// [FhirElement("base", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.Canonical BaseElement + public Hl7.Fhir.Model.Canonical? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Hl7.Fhir.Model.Canonical _BaseElement; + private Hl7.Fhir.Model.Canonical? _BaseElement; /// /// Definition this one is based on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Base + public string? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Hl7.Fhir.Model.Canonical(value); + BaseElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Base"); } } @@ -951,24 +892,24 @@ public string Base [DataMember] public List ParentElement { - get { if(_ParentElement==null) _ParentElement = new List(); return _ParentElement; } + get => _ParentElement ?? new List(); set { _ParentElement = value; OnPropertyChanged("ParentElement"); } } - private List _ParentElement; + private List? _ParentElement; /// /// Protocol/workflow this is part of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Parent + public IEnumerable? Parent { - get { return ParentElement != null ? ParentElement.Select(elem => elem.Value) : null; } + get => _ParentElement?.Select(elem => elem.Value); set { if (value == null) - ParentElement = null; + ParentElement = null!; else ParentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Parent"); @@ -984,13 +925,13 @@ public IEnumerable Parent [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirUri))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Event + public Hl7.Fhir.Model.DataType? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.DataType _Event; + private Hl7.Fhir.Model.DataType? _Event; /// /// consequence | currency | notification. @@ -999,13 +940,13 @@ public Hl7.Fhir.Model.DataType Event [DeclaredType(Type = typeof(Code))] [Binding("MessageSignificanceCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// consequence | currency | notification @@ -1014,13 +955,10 @@ public Code Catego [IgnoreDataMember] public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -1033,11 +971,11 @@ public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// always | on-error | never | on-success. @@ -1046,13 +984,13 @@ public List Focus [DeclaredType(Type = typeof(Code))] [Binding("messageheader-response-request")] [DataMember] - public Code ResponseRequiredElement + public Code? ResponseRequiredElement { get { return _ResponseRequiredElement; } set { _ResponseRequiredElement = value; OnPropertyChanged("ResponseRequiredElement"); } } - private Code _ResponseRequiredElement; + private Code? _ResponseRequiredElement; /// /// always | on-error | never | on-success @@ -1061,13 +999,10 @@ public Code ResponseRequiredElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageheaderResponseRequest? ResponseRequired { - get { return ResponseRequiredElement != null ? ResponseRequiredElement.Value : null; } + get => _ResponseRequiredElement?.Value; set { - if (value == null) - ResponseRequiredElement = null; - else - ResponseRequiredElement = new Code(value); + ResponseRequiredElement = value is null ? null : new Code(value); OnPropertyChanged("ResponseRequired"); } } @@ -1080,11 +1015,11 @@ public Hl7.Fhir.Model.MessageheaderResponseRequest? ResponseRequired [DataMember] public List AllowedResponse { - get { if(_AllowedResponse==null) _AllowedResponse = new List(); return _AllowedResponse; } + get => _AllowedResponse ?? new List(); set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } - private List _AllowedResponse; + private List? _AllowedResponse; /// /// Canonical reference to a GraphDefinition. @@ -1094,24 +1029,24 @@ public List AllowedRe [DataMember] public List GraphElement { - get { if(_GraphElement==null) _GraphElement = new List(); return _GraphElement; } + get => _GraphElement ?? new List(); set { _GraphElement = value; OnPropertyChanged("GraphElement"); } } - private List _GraphElement; + private List? _GraphElement; /// /// Canonical reference to a GraphDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Graph + public IEnumerable? Graph { - get { return GraphElement != null ? GraphElement.Select(elem => elem.Value) : null; } + get => _GraphElement?.Select(elem => elem.Value); set { if (value == null) - GraphElement = null; + GraphElement = null!; else GraphElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Graph"); @@ -1122,38 +1057,34 @@ public IEnumerable Graph protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDefinition; - - if (dest == null) - { + if(other is not MessageDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ReplacesElement.Any()) dest.ReplacesElement = new List(ReplacesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)BaseElement.DeepCopyInternal(); - if(ParentElement.Any()) dest.ParentElement = new List(ParentElement.DeepCopyInternal()); - if(Event != null) dest.Event = (Hl7.Fhir.Model.DataType)Event.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(ResponseRequiredElement != null) dest.ResponseRequiredElement = (Code)ResponseRequiredElement.DeepCopyInternal(); - if(AllowedResponse.Any()) dest.AllowedResponse = new List(AllowedResponse.DeepCopyInternal()); - if(GraphElement.Any()) dest.GraphElement = new List(GraphElement.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ReplacesElement is not null) dest.ReplacesElement = new List(_ReplacesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)_BaseElement.DeepCopyInternal(); + if(_ParentElement is not null) dest.ParentElement = new List(_ParentElement.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.DataType)_Event.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_ResponseRequiredElement is not null) dest.ResponseRequiredElement = (Code)_ResponseRequiredElement.DeepCopyInternal(); + if(_AllowedResponse is not null) dest.AllowedResponse = new List(_AllowedResponse.DeepCopyInternal()); + if(_GraphElement is not null) dest.GraphElement = new List(_GraphElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1165,195 +1096,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDefinition; - if(otherT == null) return false; + if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(ReplacesElement, otherT.ReplacesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.ListEquals(ParentElement, otherT.ParentElement)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(ResponseRequiredElement, otherT.ResponseRequiredElement)) return false; - if(!comparer.ListEquals(AllowedResponse, otherT.AllowedResponse)) return false; - if(!comparer.ListEquals(GraphElement, otherT.GraphElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_ReplacesElement, otherT._ReplacesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.ListEquals(_ParentElement, otherT._ParentElement)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; + if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; + if(!comparer.ListEquals(_GraphElement, otherT._GraphElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "replaces": - value = ReplacesElement; - return ReplacesElement?.Any() == true; + value = _ReplacesElement; + return _ReplacesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; case "parent": - value = ParentElement; - return ParentElement?.Any() == true; + value = _ParentElement; + return _ParentElement?.Any() == true; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "responseRequired": - value = ResponseRequiredElement; - return ResponseRequiredElement is not null; + value = _ResponseRequiredElement; + return _ResponseRequiredElement is not null; case "allowedResponse": - value = AllowedResponse; - return AllowedResponse?.Any() == true; + value = _AllowedResponse; + return _AllowedResponse?.Any() == true; case "graph": - value = GraphElement; - return GraphElement?.Any() == true; + value = _GraphElement; + return _GraphElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "replaces": - ReplacesElement = (List)value; + ReplacesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "base": - BaseElement = (Hl7.Fhir.Model.Canonical)value; + BaseElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "parent": - ParentElement = (List)value; + ParentElement = (List?)value!; return this; case "event": - Event = (Hl7.Fhir.Model.DataType)value; + Event = (Hl7.Fhir.Model.DataType?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "responseRequired": - ResponseRequiredElement = (Code)value; + ResponseRequiredElement = (Code?)value; return this; case "allowedResponse": - AllowedResponse = (List)value; + AllowedResponse = (List?)value!; return this; case "graph": - GraphElement = (List)value; + GraphElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1364,30 +1295,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",ReplacesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); - if (ParentElement?.Any() == true) yield return new KeyValuePair("parent",ParentElement); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",ResponseRequiredElement); - if (AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",AllowedResponse); - if (GraphElement?.Any() == true) yield return new KeyValuePair("graph",GraphElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",_ReplacesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); + if (_ParentElement?.Any() == true) yield return new KeyValuePair("parent",_ParentElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",_ResponseRequiredElement); + if (_AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",_AllowedResponse); + if (_GraphElement?.Any() == true) yield return new KeyValuePair("graph",_GraphElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs index c36392f5e..233d346fc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,28 +112,25 @@ public partial class MessageDestinationComponent : Hl7.Fhir.Model.BackboneElemen /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -142,13 +142,13 @@ public string Name [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// Actual destination address or id. @@ -156,28 +156,25 @@ public Hl7.Fhir.Model.ResourceReference Target [FhirElement("endpoint", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl EndpointElement + public Hl7.Fhir.Model.FhirUrl? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUrl _EndpointElement; + private Hl7.Fhir.Model.FhirUrl? _EndpointElement; /// /// Actual destination address or id /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUrl(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Endpoint"); } } @@ -189,28 +186,24 @@ public string Endpoint [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Receiver + public Hl7.Fhir.Model.ResourceReference? Receiver { get { return _Receiver; } set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private Hl7.Fhir.Model.ResourceReference _Receiver; + private Hl7.Fhir.Model.ResourceReference? _Receiver; protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDestinationComponent; - - if (dest == null) - { + if(other is not MessageDestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopyInternal(); - if(Receiver != null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)Receiver.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)_EndpointElement.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)_Receiver.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -222,55 +215,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDestinationComponent; - if(otherT == null) return false; + if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; - if(!comparer.Equals(Receiver, otherT.Receiver)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; + if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; case "receiver": - value = Receiver; - return Receiver is not null; + value = _Receiver; + return _Receiver is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUrl)value; + EndpointElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "receiver": - Receiver = (Hl7.Fhir.Model.ResourceReference)value; + Receiver = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -281,10 +274,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); - if (Receiver is not null) yield return new KeyValuePair("receiver",Receiver); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); + if (_Receiver is not null) yield return new KeyValuePair("receiver",_Receiver); } } @@ -310,28 +303,25 @@ public partial class MessageSourceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -341,28 +331,25 @@ public string Name /// [FhirElement("software", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SoftwareElement + public Hl7.Fhir.Model.FhirString? SoftwareElement { get { return _SoftwareElement; } set { _SoftwareElement = value; OnPropertyChanged("SoftwareElement"); } } - private Hl7.Fhir.Model.FhirString _SoftwareElement; + private Hl7.Fhir.Model.FhirString? _SoftwareElement; /// /// Name of software running the system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Software + public string? Software { - get { return SoftwareElement != null ? SoftwareElement.Value : null; } + get => _SoftwareElement?.Value; set { - if (value == null) - SoftwareElement = null; - else - SoftwareElement = new Hl7.Fhir.Model.FhirString(value); + SoftwareElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Software"); } } @@ -372,28 +359,25 @@ public string Software /// [FhirElement("version", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of software running /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -403,13 +387,13 @@ public string Version /// [FhirElement("contact", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.ContactPoint Contact + public Hl7.Fhir.Model.ContactPoint? Contact { get { return _Contact; } set { _Contact = value; OnPropertyChanged("Contact"); } } - private Hl7.Fhir.Model.ContactPoint _Contact; + private Hl7.Fhir.Model.ContactPoint? _Contact; /// /// Actual message source address or id. @@ -417,47 +401,40 @@ public Hl7.Fhir.Model.ContactPoint Contact [FhirElement("endpoint", InSummary=true, Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl EndpointElement + public Hl7.Fhir.Model.FhirUrl? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUrl _EndpointElement; + private Hl7.Fhir.Model.FhirUrl? _EndpointElement; /// /// Actual message source address or id /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUrl(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Endpoint"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageSourceComponent; - - if (dest == null) - { + if(other is not MessageSourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(SoftwareElement != null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)SoftwareElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Contact != null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)Contact.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_SoftwareElement is not null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)_SoftwareElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)_Contact.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)_EndpointElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -469,62 +446,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageSourceComponent; - if(otherT == null) return false; + if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(SoftwareElement, otherT.SoftwareElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "software": - value = SoftwareElement; - return SoftwareElement is not null; + value = _SoftwareElement; + return _SoftwareElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "contact": - value = Contact; - return Contact is not null; + value = _Contact; + return _Contact is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "software": - SoftwareElement = (Hl7.Fhir.Model.FhirString)value; + SoftwareElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (Hl7.Fhir.Model.ContactPoint)value; + Contact = (Hl7.Fhir.Model.ContactPoint?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUrl)value; + EndpointElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -535,11 +512,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (SoftwareElement is not null) yield return new KeyValuePair("software",SoftwareElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Contact is not null) yield return new KeyValuePair("contact",Contact); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_SoftwareElement is not null) yield return new KeyValuePair("software",_SoftwareElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Contact is not null) yield return new KeyValuePair("contact",_Contact); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); } } @@ -566,28 +543,25 @@ public partial class ResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identifier", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id IdentifierElement + public Hl7.Fhir.Model.Id? IdentifierElement { get { return _IdentifierElement; } set { _IdentifierElement = value; OnPropertyChanged("IdentifierElement"); } } - private Hl7.Fhir.Model.Id _IdentifierElement; + private Hl7.Fhir.Model.Id? _IdentifierElement; /// /// Id of original message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Identifier + public string? Identifier { - get { return IdentifierElement != null ? IdentifierElement.Value : null; } + get => _IdentifierElement?.Value; set { - if (value == null) - IdentifierElement = null; - else - IdentifierElement = new Hl7.Fhir.Model.Id(value); + IdentifierElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Identifier"); } } @@ -600,13 +574,13 @@ public string Identifier [Binding("ResponseType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// ok | transient-error | fatal-error @@ -615,13 +589,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageHeader.ResponseType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -633,27 +604,23 @@ public Hl7.Fhir.Model.MessageHeader.ResponseType? Code [CLSCompliant(false)] [References("OperationOutcome")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Details + public Hl7.Fhir.Model.ResourceReference? Details { get { return _Details; } set { _Details = value; OnPropertyChanged("Details"); } } - private Hl7.Fhir.Model.ResourceReference _Details; + private Hl7.Fhir.Model.ResourceReference? _Details; protected internal override void CopyToInternal(Base other) { - var dest = other as ResponseComponent; - - if (dest == null) - { + if(other is not ResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IdentifierElement != null) dest.IdentifierElement = (Hl7.Fhir.Model.Id)IdentifierElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Details != null) dest.Details = (Hl7.Fhir.Model.ResourceReference)Details.DeepCopyInternal(); + if(_IdentifierElement is not null) dest.IdentifierElement = (Hl7.Fhir.Model.Id)_IdentifierElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Details is not null) dest.Details = (Hl7.Fhir.Model.ResourceReference)_Details.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -665,48 +632,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResponseComponent; - if(otherT == null) return false; + if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IdentifierElement, otherT.IdentifierElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Details, otherT.Details)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Details, otherT._Details)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = IdentifierElement; - return IdentifierElement is not null; + value = _IdentifierElement; + return _IdentifierElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "details": - value = Details; - return Details is not null; + value = _Details; + return _Details is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - IdentifierElement = (Hl7.Fhir.Model.Id)value; + IdentifierElement = (Hl7.Fhir.Model.Id?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "details": - Details = (Hl7.Fhir.Model.ResourceReference)value; + Details = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -717,9 +684,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IdentifierElement is not null) yield return new KeyValuePair("identifier",IdentifierElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Details is not null) yield return new KeyValuePair("details",Details); + if (_IdentifierElement is not null) yield return new KeyValuePair("identifier",_IdentifierElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Details is not null) yield return new KeyValuePair("details",_Details); } } @@ -733,13 +700,13 @@ public override IEnumerable> EnumerateElements() [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirUri))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Event + public Hl7.Fhir.Model.DataType? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.DataType _Event; + private Hl7.Fhir.Model.DataType? _Event; /// /// Message destination application(s). @@ -749,11 +716,11 @@ public Hl7.Fhir.Model.DataType Event [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Real world sender of the message. @@ -762,13 +729,13 @@ public List Destinatio [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// The source of the data entry. @@ -777,13 +744,13 @@ public Hl7.Fhir.Model.ResourceReference Sender [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// The source of the decision. @@ -792,13 +759,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Message source application. @@ -806,13 +773,13 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("source", InSummary=true, Order=140, FiveWs="FiveWs.actor")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source + public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent _Source; + private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? _Source; /// /// Final responsibility for event. @@ -821,13 +788,13 @@ public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Cause of event. @@ -835,26 +802,26 @@ public Hl7.Fhir.Model.ResourceReference Responsible [FhirElement("reason", InSummary=true, Order=160, FiveWs="FiveWs.why[x]")] [Binding("EventReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// If this is a reply to prior message. /// [FhirElement("response", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response + public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.MessageHeader.ResponseComponent _Response; + private Hl7.Fhir.Model.MessageHeader.ResponseComponent? _Response; /// /// The actual content of the message. @@ -866,64 +833,57 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Link to the definition for this message. /// [FhirElement("definition", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Link to the definition for this message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageHeader; - - if (dest == null) - { + if(other is not MessageHeader dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Event != null) dest.Event = (Hl7.Fhir.Model.DataType)Event.DeepCopyInternal(); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)Source.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)Response.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.DataType)_Event.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)_Source.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)_Response.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -935,104 +895,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageHeader; - if(otherT == null) return false; + if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - Event = (Hl7.Fhir.Model.DataType)value; + Event = (Hl7.Fhir.Model.DataType?)value; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)value; + Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "response": - Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)value; + Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1043,17 +1003,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Event is not null) yield return new KeyValuePair("event",Event); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs index 9b397d157..44483ec04 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -221,41 +224,38 @@ public partial class ReferenceSeqComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("chromosome", InSummary=true, Order=40)] [Binding("chromosome-human")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Chromosome + public Hl7.Fhir.Model.CodeableConcept? Chromosome { get { return _Chromosome; } set { _Chromosome = value; OnPropertyChanged("Chromosome"); } } - private Hl7.Fhir.Model.CodeableConcept _Chromosome; + private Hl7.Fhir.Model.CodeableConcept? _Chromosome; /// /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37'. /// [FhirElement("genomeBuild", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString GenomeBuildElement + public Hl7.Fhir.Model.FhirString? GenomeBuildElement { get { return _GenomeBuildElement; } set { _GenomeBuildElement = value; OnPropertyChanged("GenomeBuildElement"); } } - private Hl7.Fhir.Model.FhirString _GenomeBuildElement; + private Hl7.Fhir.Model.FhirString? _GenomeBuildElement; /// /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37' /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string GenomeBuild + public string? GenomeBuild { - get { return GenomeBuildElement != null ? GenomeBuildElement.Value : null; } + get => _GenomeBuildElement?.Value; set { - if (value == null) - GenomeBuildElement = null; - else - GenomeBuildElement = new Hl7.Fhir.Model.FhirString(value); + GenomeBuildElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("GenomeBuild"); } } @@ -267,13 +267,13 @@ public string GenomeBuild [DeclaredType(Type = typeof(Code))] [Binding("orientationType")] [DataMember] - public Code OrientationElement + public Code? OrientationElement { get { return _OrientationElement; } set { _OrientationElement = value; OnPropertyChanged("OrientationElement"); } } - private Code _OrientationElement; + private Code? _OrientationElement; /// /// sense | antisense @@ -282,13 +282,10 @@ public Code OrientationElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.OrientationType? Orientation { - get { return OrientationElement != null ? OrientationElement.Value : null; } + get => _OrientationElement?.Value; set { - if (value == null) - OrientationElement = null; - else - OrientationElement = new Code(value); + OrientationElement = value is null ? null : new Code(value); OnPropertyChanged("Orientation"); } } @@ -299,13 +296,13 @@ public Hl7.Fhir.Model.MolecularSequence.OrientationType? Orientation [FhirElement("referenceSeqId", InSummary=true, Order=70)] [Binding("sequenceReference")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReferenceSeqId + public Hl7.Fhir.Model.CodeableConcept? ReferenceSeqId { get { return _ReferenceSeqId; } set { _ReferenceSeqId = value; OnPropertyChanged("ReferenceSeqId"); } } - private Hl7.Fhir.Model.CodeableConcept _ReferenceSeqId; + private Hl7.Fhir.Model.CodeableConcept? _ReferenceSeqId; /// /// A pointer to another MolecularSequence entity as reference sequence. @@ -314,41 +311,38 @@ public Hl7.Fhir.Model.CodeableConcept ReferenceSeqId [CLSCompliant(false)] [References("MolecularSequence")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReferenceSeqPointer + public Hl7.Fhir.Model.ResourceReference? ReferenceSeqPointer { get { return _ReferenceSeqPointer; } set { _ReferenceSeqPointer = value; OnPropertyChanged("ReferenceSeqPointer"); } } - private Hl7.Fhir.Model.ResourceReference _ReferenceSeqPointer; + private Hl7.Fhir.Model.ResourceReference? _ReferenceSeqPointer; /// /// A string to represent reference sequence. /// [FhirElement("referenceSeqString", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceSeqStringElement + public Hl7.Fhir.Model.FhirString? ReferenceSeqStringElement { get { return _ReferenceSeqStringElement; } set { _ReferenceSeqStringElement = value; OnPropertyChanged("ReferenceSeqStringElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceSeqStringElement; + private Hl7.Fhir.Model.FhirString? _ReferenceSeqStringElement; /// /// A string to represent reference sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReferenceSeqString + public string? ReferenceSeqString { - get { return ReferenceSeqStringElement != null ? ReferenceSeqStringElement.Value : null; } + get => _ReferenceSeqStringElement?.Value; set { - if (value == null) - ReferenceSeqStringElement = null; - else - ReferenceSeqStringElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceSeqStringElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReferenceSeqString"); } } @@ -360,13 +354,13 @@ public string ReferenceSeqString [DeclaredType(Type = typeof(Code))] [Binding("strandType")] [DataMember] - public Code StrandElement + public Code? StrandElement { get { return _StrandElement; } set { _StrandElement = value; OnPropertyChanged("StrandElement"); } } - private Code _StrandElement; + private Code? _StrandElement; /// /// watson | crick @@ -375,13 +369,10 @@ public Code StrandElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.StrandType? Strand { - get { return StrandElement != null ? StrandElement.Value : null; } + get => _StrandElement?.Value; set { - if (value == null) - StrandElement = null; - else - StrandElement = new Code(value); + StrandElement = value is null ? null : new Code(value); OnPropertyChanged("Strand"); } } @@ -391,13 +382,13 @@ public Hl7.Fhir.Model.MolecularSequence.StrandType? Strand /// [FhirElement("windowStart", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Integer WindowStartElement + public Hl7.Fhir.Model.Integer? WindowStartElement { get { return _WindowStartElement; } set { _WindowStartElement = value; OnPropertyChanged("WindowStartElement"); } } - private Hl7.Fhir.Model.Integer _WindowStartElement; + private Hl7.Fhir.Model.Integer? _WindowStartElement; /// /// Start position of the window on the reference sequence @@ -406,13 +397,10 @@ public Hl7.Fhir.Model.Integer WindowStartElement [IgnoreDataMember] public int? WindowStart { - get { return WindowStartElement != null ? WindowStartElement.Value : null; } + get => _WindowStartElement?.Value; set { - if (value == null) - WindowStartElement = null; - else - WindowStartElement = new Hl7.Fhir.Model.Integer(value); + WindowStartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowStart"); } } @@ -422,13 +410,13 @@ public int? WindowStart /// [FhirElement("windowEnd", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Integer WindowEndElement + public Hl7.Fhir.Model.Integer? WindowEndElement { get { return _WindowEndElement; } set { _WindowEndElement = value; OnPropertyChanged("WindowEndElement"); } } - private Hl7.Fhir.Model.Integer _WindowEndElement; + private Hl7.Fhir.Model.Integer? _WindowEndElement; /// /// End position of the window on the reference sequence @@ -437,36 +425,29 @@ public Hl7.Fhir.Model.Integer WindowEndElement [IgnoreDataMember] public int? WindowEnd { - get { return WindowEndElement != null ? WindowEndElement.Value : null; } + get => _WindowEndElement?.Value; set { - if (value == null) - WindowEndElement = null; - else - WindowEndElement = new Hl7.Fhir.Model.Integer(value); + WindowEndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowEnd"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceSeqComponent; - - if (dest == null) - { + if(other is not ReferenceSeqComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Chromosome != null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)Chromosome.DeepCopyInternal(); - if(GenomeBuildElement != null) dest.GenomeBuildElement = (Hl7.Fhir.Model.FhirString)GenomeBuildElement.DeepCopyInternal(); - if(OrientationElement != null) dest.OrientationElement = (Code)OrientationElement.DeepCopyInternal(); - if(ReferenceSeqId != null) dest.ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)ReferenceSeqId.DeepCopyInternal(); - if(ReferenceSeqPointer != null) dest.ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)ReferenceSeqPointer.DeepCopyInternal(); - if(ReferenceSeqStringElement != null) dest.ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)ReferenceSeqStringElement.DeepCopyInternal(); - if(StrandElement != null) dest.StrandElement = (Code)StrandElement.DeepCopyInternal(); - if(WindowStartElement != null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)WindowStartElement.DeepCopyInternal(); - if(WindowEndElement != null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)WindowEndElement.DeepCopyInternal(); + if(_Chromosome is not null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)_Chromosome.DeepCopyInternal(); + if(_GenomeBuildElement is not null) dest.GenomeBuildElement = (Hl7.Fhir.Model.FhirString)_GenomeBuildElement.DeepCopyInternal(); + if(_OrientationElement is not null) dest.OrientationElement = (Code)_OrientationElement.DeepCopyInternal(); + if(_ReferenceSeqId is not null) dest.ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)_ReferenceSeqId.DeepCopyInternal(); + if(_ReferenceSeqPointer is not null) dest.ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)_ReferenceSeqPointer.DeepCopyInternal(); + if(_ReferenceSeqStringElement is not null) dest.ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)_ReferenceSeqStringElement.DeepCopyInternal(); + if(_StrandElement is not null) dest.StrandElement = (Code)_StrandElement.DeepCopyInternal(); + if(_WindowStartElement is not null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)_WindowStartElement.DeepCopyInternal(); + if(_WindowEndElement is not null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)_WindowEndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -478,90 +459,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceSeqComponent; - if(otherT == null) return false; + if(other is not ReferenceSeqComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Chromosome, otherT.Chromosome)) return false; - if(!comparer.Equals(GenomeBuildElement, otherT.GenomeBuildElement)) return false; - if(!comparer.Equals(OrientationElement, otherT.OrientationElement)) return false; - if(!comparer.Equals(ReferenceSeqId, otherT.ReferenceSeqId)) return false; - if(!comparer.Equals(ReferenceSeqPointer, otherT.ReferenceSeqPointer)) return false; - if(!comparer.Equals(ReferenceSeqStringElement, otherT.ReferenceSeqStringElement)) return false; - if(!comparer.Equals(StrandElement, otherT.StrandElement)) return false; - if(!comparer.Equals(WindowStartElement, otherT.WindowStartElement)) return false; - if(!comparer.Equals(WindowEndElement, otherT.WindowEndElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; + if(!comparer.Equals(_GenomeBuildElement, otherT._GenomeBuildElement)) return false; + if(!comparer.Equals(_OrientationElement, otherT._OrientationElement)) return false; + if(!comparer.Equals(_ReferenceSeqId, otherT._ReferenceSeqId)) return false; + if(!comparer.Equals(_ReferenceSeqPointer, otherT._ReferenceSeqPointer)) return false; + if(!comparer.Equals(_ReferenceSeqStringElement, otherT._ReferenceSeqStringElement)) return false; + if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; + if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; + if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "chromosome": - value = Chromosome; - return Chromosome is not null; + value = _Chromosome; + return _Chromosome is not null; case "genomeBuild": - value = GenomeBuildElement; - return GenomeBuildElement is not null; + value = _GenomeBuildElement; + return _GenomeBuildElement is not null; case "orientation": - value = OrientationElement; - return OrientationElement is not null; + value = _OrientationElement; + return _OrientationElement is not null; case "referenceSeqId": - value = ReferenceSeqId; - return ReferenceSeqId is not null; + value = _ReferenceSeqId; + return _ReferenceSeqId is not null; case "referenceSeqPointer": - value = ReferenceSeqPointer; - return ReferenceSeqPointer is not null; + value = _ReferenceSeqPointer; + return _ReferenceSeqPointer is not null; case "referenceSeqString": - value = ReferenceSeqStringElement; - return ReferenceSeqStringElement is not null; + value = _ReferenceSeqStringElement; + return _ReferenceSeqStringElement is not null; case "strand": - value = StrandElement; - return StrandElement is not null; + value = _StrandElement; + return _StrandElement is not null; case "windowStart": - value = WindowStartElement; - return WindowStartElement is not null; + value = _WindowStartElement; + return _WindowStartElement is not null; case "windowEnd": - value = WindowEndElement; - return WindowEndElement is not null; + value = _WindowEndElement; + return _WindowEndElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "chromosome": - Chromosome = (Hl7.Fhir.Model.CodeableConcept)value; + Chromosome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genomeBuild": - GenomeBuildElement = (Hl7.Fhir.Model.FhirString)value; + GenomeBuildElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "orientation": - OrientationElement = (Code)value; + OrientationElement = (Code?)value; return this; case "referenceSeqId": - ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept)value; + ReferenceSeqId = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "referenceSeqPointer": - ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference)value; + ReferenceSeqPointer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referenceSeqString": - ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceSeqStringElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "strand": - StrandElement = (Code)value; + StrandElement = (Code?)value; return this; case "windowStart": - WindowStartElement = (Hl7.Fhir.Model.Integer)value; + WindowStartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "windowEnd": - WindowEndElement = (Hl7.Fhir.Model.Integer)value; + WindowEndElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -572,15 +553,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Chromosome is not null) yield return new KeyValuePair("chromosome",Chromosome); - if (GenomeBuildElement is not null) yield return new KeyValuePair("genomeBuild",GenomeBuildElement); - if (OrientationElement is not null) yield return new KeyValuePair("orientation",OrientationElement); - if (ReferenceSeqId is not null) yield return new KeyValuePair("referenceSeqId",ReferenceSeqId); - if (ReferenceSeqPointer is not null) yield return new KeyValuePair("referenceSeqPointer",ReferenceSeqPointer); - if (ReferenceSeqStringElement is not null) yield return new KeyValuePair("referenceSeqString",ReferenceSeqStringElement); - if (StrandElement is not null) yield return new KeyValuePair("strand",StrandElement); - if (WindowStartElement is not null) yield return new KeyValuePair("windowStart",WindowStartElement); - if (WindowEndElement is not null) yield return new KeyValuePair("windowEnd",WindowEndElement); + if (_Chromosome is not null) yield return new KeyValuePair("chromosome",_Chromosome); + if (_GenomeBuildElement is not null) yield return new KeyValuePair("genomeBuild",_GenomeBuildElement); + if (_OrientationElement is not null) yield return new KeyValuePair("orientation",_OrientationElement); + if (_ReferenceSeqId is not null) yield return new KeyValuePair("referenceSeqId",_ReferenceSeqId); + if (_ReferenceSeqPointer is not null) yield return new KeyValuePair("referenceSeqPointer",_ReferenceSeqPointer); + if (_ReferenceSeqStringElement is not null) yield return new KeyValuePair("referenceSeqString",_ReferenceSeqStringElement); + if (_StrandElement is not null) yield return new KeyValuePair("strand",_StrandElement); + if (_WindowStartElement is not null) yield return new KeyValuePair("windowStart",_WindowStartElement); + if (_WindowEndElement is not null) yield return new KeyValuePair("windowEnd",_WindowEndElement); } } @@ -606,13 +587,13 @@ public partial class VariantComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Start position of the variant on the reference sequence @@ -621,13 +602,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -637,13 +615,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// End position of the variant on the reference sequence @@ -652,13 +630,10 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } @@ -668,28 +643,25 @@ public int? End /// [FhirElement("observedAllele", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ObservedAlleleElement + public Hl7.Fhir.Model.FhirString? ObservedAlleleElement { get { return _ObservedAlleleElement; } set { _ObservedAlleleElement = value; OnPropertyChanged("ObservedAlleleElement"); } } - private Hl7.Fhir.Model.FhirString _ObservedAlleleElement; + private Hl7.Fhir.Model.FhirString? _ObservedAlleleElement; /// /// Allele that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ObservedAllele + public string? ObservedAllele { - get { return ObservedAlleleElement != null ? ObservedAlleleElement.Value : null; } + get => _ObservedAlleleElement?.Value; set { - if (value == null) - ObservedAlleleElement = null; - else - ObservedAlleleElement = new Hl7.Fhir.Model.FhirString(value); + ObservedAlleleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ObservedAllele"); } } @@ -699,28 +671,25 @@ public string ObservedAllele /// [FhirElement("referenceAllele", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceAlleleElement + public Hl7.Fhir.Model.FhirString? ReferenceAlleleElement { get { return _ReferenceAlleleElement; } set { _ReferenceAlleleElement = value; OnPropertyChanged("ReferenceAlleleElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceAlleleElement; + private Hl7.Fhir.Model.FhirString? _ReferenceAlleleElement; /// /// Allele in the reference sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReferenceAllele + public string? ReferenceAllele { - get { return ReferenceAlleleElement != null ? ReferenceAlleleElement.Value : null; } + get => _ReferenceAlleleElement?.Value; set { - if (value == null) - ReferenceAlleleElement = null; - else - ReferenceAlleleElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceAlleleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReferenceAllele"); } } @@ -730,28 +699,25 @@ public string ReferenceAllele /// [FhirElement("cigar", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CigarElement + public Hl7.Fhir.Model.FhirString? CigarElement { get { return _CigarElement; } set { _CigarElement = value; OnPropertyChanged("CigarElement"); } } - private Hl7.Fhir.Model.FhirString _CigarElement; + private Hl7.Fhir.Model.FhirString? _CigarElement; /// /// Extended CIGAR string for aligning the sequence with reference bases /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Cigar + public string? Cigar { - get { return CigarElement != null ? CigarElement.Value : null; } + get => _CigarElement?.Value; set { - if (value == null) - CigarElement = null; - else - CigarElement = new Hl7.Fhir.Model.FhirString(value); + CigarElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Cigar"); } } @@ -763,30 +729,26 @@ public string Cigar [CLSCompliant(false)] [References("Observation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference VariantPointer + public Hl7.Fhir.Model.ResourceReference? VariantPointer { get { return _VariantPointer; } set { _VariantPointer = value; OnPropertyChanged("VariantPointer"); } } - private Hl7.Fhir.Model.ResourceReference _VariantPointer; + private Hl7.Fhir.Model.ResourceReference? _VariantPointer; protected internal override void CopyToInternal(Base other) { - var dest = other as VariantComponent; - - if (dest == null) - { + if(other is not VariantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); - if(ObservedAlleleElement != null) dest.ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)ObservedAlleleElement.DeepCopyInternal(); - if(ReferenceAlleleElement != null) dest.ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)ReferenceAlleleElement.DeepCopyInternal(); - if(CigarElement != null) dest.CigarElement = (Hl7.Fhir.Model.FhirString)CigarElement.DeepCopyInternal(); - if(VariantPointer != null) dest.VariantPointer = (Hl7.Fhir.Model.ResourceReference)VariantPointer.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); + if(_ObservedAlleleElement is not null) dest.ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)_ObservedAlleleElement.DeepCopyInternal(); + if(_ReferenceAlleleElement is not null) dest.ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)_ReferenceAlleleElement.DeepCopyInternal(); + if(_CigarElement is not null) dest.CigarElement = (Hl7.Fhir.Model.FhirString)_CigarElement.DeepCopyInternal(); + if(_VariantPointer is not null) dest.VariantPointer = (Hl7.Fhir.Model.ResourceReference)_VariantPointer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -798,69 +760,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariantComponent; - if(otherT == null) return false; + if(other is not VariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ObservedAlleleElement, otherT.ObservedAlleleElement)) return false; - if(!comparer.Equals(ReferenceAlleleElement, otherT.ReferenceAlleleElement)) return false; - if(!comparer.Equals(CigarElement, otherT.CigarElement)) return false; - if(!comparer.Equals(VariantPointer, otherT.VariantPointer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ObservedAlleleElement, otherT._ObservedAlleleElement)) return false; + if(!comparer.Equals(_ReferenceAlleleElement, otherT._ReferenceAlleleElement)) return false; + if(!comparer.Equals(_CigarElement, otherT._CigarElement)) return false; + if(!comparer.Equals(_VariantPointer, otherT._VariantPointer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "observedAllele": - value = ObservedAlleleElement; - return ObservedAlleleElement is not null; + value = _ObservedAlleleElement; + return _ObservedAlleleElement is not null; case "referenceAllele": - value = ReferenceAlleleElement; - return ReferenceAlleleElement is not null; + value = _ReferenceAlleleElement; + return _ReferenceAlleleElement is not null; case "cigar": - value = CigarElement; - return CigarElement is not null; + value = _CigarElement; + return _CigarElement is not null; case "variantPointer": - value = VariantPointer; - return VariantPointer is not null; + value = _VariantPointer; + return _VariantPointer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "observedAllele": - ObservedAlleleElement = (Hl7.Fhir.Model.FhirString)value; + ObservedAlleleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "referenceAllele": - ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceAlleleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cigar": - CigarElement = (Hl7.Fhir.Model.FhirString)value; + CigarElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variantPointer": - VariantPointer = (Hl7.Fhir.Model.ResourceReference)value; + VariantPointer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -871,12 +833,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ObservedAlleleElement is not null) yield return new KeyValuePair("observedAllele",ObservedAlleleElement); - if (ReferenceAlleleElement is not null) yield return new KeyValuePair("referenceAllele",ReferenceAlleleElement); - if (CigarElement is not null) yield return new KeyValuePair("cigar",CigarElement); - if (VariantPointer is not null) yield return new KeyValuePair("variantPointer",VariantPointer); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ObservedAlleleElement is not null) yield return new KeyValuePair("observedAllele",_ObservedAlleleElement); + if (_ReferenceAlleleElement is not null) yield return new KeyValuePair("referenceAllele",_ReferenceAlleleElement); + if (_CigarElement is not null) yield return new KeyValuePair("cigar",_CigarElement); + if (_VariantPointer is not null) yield return new KeyValuePair("variantPointer",_VariantPointer); } } @@ -905,13 +867,13 @@ public partial class QualityComponent : Hl7.Fhir.Model.BackboneElement [Binding("qualityType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// indel | snp | unknown @@ -920,13 +882,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.QualityType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -937,26 +896,26 @@ public Hl7.Fhir.Model.MolecularSequence.QualityType? Type [FhirElement("standardSequence", InSummary=true, Order=50)] [Binding("qualityStandardSequence")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StandardSequence + public Hl7.Fhir.Model.CodeableConcept? StandardSequence { get { return _StandardSequence; } set { _StandardSequence = value; OnPropertyChanged("StandardSequence"); } } - private Hl7.Fhir.Model.CodeableConcept _StandardSequence; + private Hl7.Fhir.Model.CodeableConcept? _StandardSequence; /// /// Start position of the sequence. /// [FhirElement("start", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Start position of the sequence @@ -965,13 +924,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -981,13 +937,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// End position of the sequence @@ -996,13 +952,10 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } @@ -1012,13 +965,13 @@ public int? End /// [FhirElement("score", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Score + public Hl7.Fhir.Model.Quantity? Score { get { return _Score; } set { _Score = value; OnPropertyChanged("Score"); } } - private Hl7.Fhir.Model.Quantity _Score; + private Hl7.Fhir.Model.Quantity? _Score; /// /// Method to get quality. @@ -1026,26 +979,26 @@ public Hl7.Fhir.Model.Quantity Score [FhirElement("method", InSummary=true, Order=90)] [Binding("qualityMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// True positives from the perspective of the truth data. /// [FhirElement("truthTP", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TruthTPElement + public Hl7.Fhir.Model.FhirDecimal? TruthTPElement { get { return _TruthTPElement; } set { _TruthTPElement = value; OnPropertyChanged("TruthTPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TruthTPElement; + private Hl7.Fhir.Model.FhirDecimal? _TruthTPElement; /// /// True positives from the perspective of the truth data @@ -1054,13 +1007,10 @@ public Hl7.Fhir.Model.FhirDecimal TruthTPElement [IgnoreDataMember] public decimal? TruthTP { - get { return TruthTPElement != null ? TruthTPElement.Value : null; } + get => _TruthTPElement?.Value; set { - if (value == null) - TruthTPElement = null; - else - TruthTPElement = new Hl7.Fhir.Model.FhirDecimal(value); + TruthTPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("TruthTP"); } } @@ -1070,13 +1020,13 @@ public decimal? TruthTP /// [FhirElement("queryTP", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal QueryTPElement + public Hl7.Fhir.Model.FhirDecimal? QueryTPElement { get { return _QueryTPElement; } set { _QueryTPElement = value; OnPropertyChanged("QueryTPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _QueryTPElement; + private Hl7.Fhir.Model.FhirDecimal? _QueryTPElement; /// /// True positives from the perspective of the query data @@ -1085,13 +1035,10 @@ public Hl7.Fhir.Model.FhirDecimal QueryTPElement [IgnoreDataMember] public decimal? QueryTP { - get { return QueryTPElement != null ? QueryTPElement.Value : null; } + get => _QueryTPElement?.Value; set { - if (value == null) - QueryTPElement = null; - else - QueryTPElement = new Hl7.Fhir.Model.FhirDecimal(value); + QueryTPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("QueryTP"); } } @@ -1101,13 +1048,13 @@ public decimal? QueryTP /// [FhirElement("truthFN", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal TruthFNElement + public Hl7.Fhir.Model.FhirDecimal? TruthFNElement { get { return _TruthFNElement; } set { _TruthFNElement = value; OnPropertyChanged("TruthFNElement"); } } - private Hl7.Fhir.Model.FhirDecimal _TruthFNElement; + private Hl7.Fhir.Model.FhirDecimal? _TruthFNElement; /// /// False negatives @@ -1116,13 +1063,10 @@ public Hl7.Fhir.Model.FhirDecimal TruthFNElement [IgnoreDataMember] public decimal? TruthFN { - get { return TruthFNElement != null ? TruthFNElement.Value : null; } + get => _TruthFNElement?.Value; set { - if (value == null) - TruthFNElement = null; - else - TruthFNElement = new Hl7.Fhir.Model.FhirDecimal(value); + TruthFNElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("TruthFN"); } } @@ -1132,13 +1076,13 @@ public decimal? TruthFN /// [FhirElement("queryFP", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal QueryFPElement + public Hl7.Fhir.Model.FhirDecimal? QueryFPElement { get { return _QueryFPElement; } set { _QueryFPElement = value; OnPropertyChanged("QueryFPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _QueryFPElement; + private Hl7.Fhir.Model.FhirDecimal? _QueryFPElement; /// /// False positives @@ -1147,13 +1091,10 @@ public Hl7.Fhir.Model.FhirDecimal QueryFPElement [IgnoreDataMember] public decimal? QueryFP { - get { return QueryFPElement != null ? QueryFPElement.Value : null; } + get => _QueryFPElement?.Value; set { - if (value == null) - QueryFPElement = null; - else - QueryFPElement = new Hl7.Fhir.Model.FhirDecimal(value); + QueryFPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("QueryFP"); } } @@ -1163,13 +1104,13 @@ public decimal? QueryFP /// [FhirElement("gtFP", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal GtFPElement + public Hl7.Fhir.Model.FhirDecimal? GtFPElement { get { return _GtFPElement; } set { _GtFPElement = value; OnPropertyChanged("GtFPElement"); } } - private Hl7.Fhir.Model.FhirDecimal _GtFPElement; + private Hl7.Fhir.Model.FhirDecimal? _GtFPElement; /// /// False positives where the non-REF alleles in the Truth and Query Call Sets match @@ -1178,13 +1119,10 @@ public Hl7.Fhir.Model.FhirDecimal GtFPElement [IgnoreDataMember] public decimal? GtFP { - get { return GtFPElement != null ? GtFPElement.Value : null; } + get => _GtFPElement?.Value; set { - if (value == null) - GtFPElement = null; - else - GtFPElement = new Hl7.Fhir.Model.FhirDecimal(value); + GtFPElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("GtFP"); } } @@ -1194,13 +1132,13 @@ public decimal? GtFP /// [FhirElement("precision", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PrecisionElement + public Hl7.Fhir.Model.FhirDecimal? PrecisionElement { get { return _PrecisionElement; } set { _PrecisionElement = value; OnPropertyChanged("PrecisionElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PrecisionElement; + private Hl7.Fhir.Model.FhirDecimal? _PrecisionElement; /// /// Precision of comparison @@ -1209,13 +1147,10 @@ public Hl7.Fhir.Model.FhirDecimal PrecisionElement [IgnoreDataMember] public decimal? Precision { - get { return PrecisionElement != null ? PrecisionElement.Value : null; } + get => _PrecisionElement?.Value; set { - if (value == null) - PrecisionElement = null; - else - PrecisionElement = new Hl7.Fhir.Model.FhirDecimal(value); + PrecisionElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Precision"); } } @@ -1225,13 +1160,13 @@ public decimal? Precision /// [FhirElement("recall", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal RecallElement + public Hl7.Fhir.Model.FhirDecimal? RecallElement { get { return _RecallElement; } set { _RecallElement = value; OnPropertyChanged("RecallElement"); } } - private Hl7.Fhir.Model.FhirDecimal _RecallElement; + private Hl7.Fhir.Model.FhirDecimal? _RecallElement; /// /// Recall of comparison @@ -1240,13 +1175,10 @@ public Hl7.Fhir.Model.FhirDecimal RecallElement [IgnoreDataMember] public decimal? Recall { - get { return RecallElement != null ? RecallElement.Value : null; } + get => _RecallElement?.Value; set { - if (value == null) - RecallElement = null; - else - RecallElement = new Hl7.Fhir.Model.FhirDecimal(value); + RecallElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Recall"); } } @@ -1256,13 +1188,13 @@ public decimal? Recall /// [FhirElement("fScore", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FScoreElement + public Hl7.Fhir.Model.FhirDecimal? FScoreElement { get { return _FScoreElement; } set { _FScoreElement = value; OnPropertyChanged("FScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _FScoreElement; /// /// F-score @@ -1271,13 +1203,10 @@ public Hl7.Fhir.Model.FhirDecimal FScoreElement [IgnoreDataMember] public decimal? FScore { - get { return FScoreElement != null ? FScoreElement.Value : null; } + get => _FScoreElement?.Value; set { - if (value == null) - FScoreElement = null; - else - FScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + FScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("FScore"); } } @@ -1287,39 +1216,35 @@ public decimal? FScore /// [FhirElement("roc", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.RocComponent Roc + public Hl7.Fhir.Model.MolecularSequence.RocComponent? Roc { get { return _Roc; } set { _Roc = value; OnPropertyChanged("Roc"); } } - private Hl7.Fhir.Model.MolecularSequence.RocComponent _Roc; + private Hl7.Fhir.Model.MolecularSequence.RocComponent? _Roc; protected internal override void CopyToInternal(Base other) { - var dest = other as QualityComponent; - - if (dest == null) - { + if(other is not QualityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(StandardSequence != null) dest.StandardSequence = (Hl7.Fhir.Model.CodeableConcept)StandardSequence.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); - if(Score != null) dest.Score = (Hl7.Fhir.Model.Quantity)Score.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(TruthTPElement != null) dest.TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)TruthTPElement.DeepCopyInternal(); - if(QueryTPElement != null) dest.QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)QueryTPElement.DeepCopyInternal(); - if(TruthFNElement != null) dest.TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)TruthFNElement.DeepCopyInternal(); - if(QueryFPElement != null) dest.QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)QueryFPElement.DeepCopyInternal(); - if(GtFPElement != null) dest.GtFPElement = (Hl7.Fhir.Model.FhirDecimal)GtFPElement.DeepCopyInternal(); - if(PrecisionElement != null) dest.PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)PrecisionElement.DeepCopyInternal(); - if(RecallElement != null) dest.RecallElement = (Hl7.Fhir.Model.FhirDecimal)RecallElement.DeepCopyInternal(); - if(FScoreElement != null) dest.FScoreElement = (Hl7.Fhir.Model.FhirDecimal)FScoreElement.DeepCopyInternal(); - if(Roc != null) dest.Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent)Roc.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_StandardSequence is not null) dest.StandardSequence = (Hl7.Fhir.Model.CodeableConcept)_StandardSequence.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); + if(_Score is not null) dest.Score = (Hl7.Fhir.Model.Quantity)_Score.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_TruthTPElement is not null) dest.TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)_TruthTPElement.DeepCopyInternal(); + if(_QueryTPElement is not null) dest.QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)_QueryTPElement.DeepCopyInternal(); + if(_TruthFNElement is not null) dest.TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)_TruthFNElement.DeepCopyInternal(); + if(_QueryFPElement is not null) dest.QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)_QueryFPElement.DeepCopyInternal(); + if(_GtFPElement is not null) dest.GtFPElement = (Hl7.Fhir.Model.FhirDecimal)_GtFPElement.DeepCopyInternal(); + if(_PrecisionElement is not null) dest.PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)_PrecisionElement.DeepCopyInternal(); + if(_RecallElement is not null) dest.RecallElement = (Hl7.Fhir.Model.FhirDecimal)_RecallElement.DeepCopyInternal(); + if(_FScoreElement is not null) dest.FScoreElement = (Hl7.Fhir.Model.FhirDecimal)_FScoreElement.DeepCopyInternal(); + if(_Roc is not null) dest.Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent)_Roc.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1331,132 +1256,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualityComponent; - if(otherT == null) return false; + if(other is not QualityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(StandardSequence, otherT.StandardSequence)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(Score, otherT.Score)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(TruthTPElement, otherT.TruthTPElement)) return false; - if(!comparer.Equals(QueryTPElement, otherT.QueryTPElement)) return false; - if(!comparer.Equals(TruthFNElement, otherT.TruthFNElement)) return false; - if(!comparer.Equals(QueryFPElement, otherT.QueryFPElement)) return false; - if(!comparer.Equals(GtFPElement, otherT.GtFPElement)) return false; - if(!comparer.Equals(PrecisionElement, otherT.PrecisionElement)) return false; - if(!comparer.Equals(RecallElement, otherT.RecallElement)) return false; - if(!comparer.Equals(FScoreElement, otherT.FScoreElement)) return false; - if(!comparer.Equals(Roc, otherT.Roc)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_StandardSequence, otherT._StandardSequence)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_Score, otherT._Score)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_TruthTPElement, otherT._TruthTPElement)) return false; + if(!comparer.Equals(_QueryTPElement, otherT._QueryTPElement)) return false; + if(!comparer.Equals(_TruthFNElement, otherT._TruthFNElement)) return false; + if(!comparer.Equals(_QueryFPElement, otherT._QueryFPElement)) return false; + if(!comparer.Equals(_GtFPElement, otherT._GtFPElement)) return false; + if(!comparer.Equals(_PrecisionElement, otherT._PrecisionElement)) return false; + if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; + if(!comparer.Equals(_FScoreElement, otherT._FScoreElement)) return false; + if(!comparer.Equals(_Roc, otherT._Roc)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "standardSequence": - value = StandardSequence; - return StandardSequence is not null; + value = _StandardSequence; + return _StandardSequence is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "score": - value = Score; - return Score is not null; + value = _Score; + return _Score is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "truthTP": - value = TruthTPElement; - return TruthTPElement is not null; + value = _TruthTPElement; + return _TruthTPElement is not null; case "queryTP": - value = QueryTPElement; - return QueryTPElement is not null; + value = _QueryTPElement; + return _QueryTPElement is not null; case "truthFN": - value = TruthFNElement; - return TruthFNElement is not null; + value = _TruthFNElement; + return _TruthFNElement is not null; case "queryFP": - value = QueryFPElement; - return QueryFPElement is not null; + value = _QueryFPElement; + return _QueryFPElement is not null; case "gtFP": - value = GtFPElement; - return GtFPElement is not null; + value = _GtFPElement; + return _GtFPElement is not null; case "precision": - value = PrecisionElement; - return PrecisionElement is not null; + value = _PrecisionElement; + return _PrecisionElement is not null; case "recall": - value = RecallElement; - return RecallElement is not null; + value = _RecallElement; + return _RecallElement is not null; case "fScore": - value = FScoreElement; - return FScoreElement is not null; + value = _FScoreElement; + return _FScoreElement is not null; case "roc": - value = Roc; - return Roc is not null; + value = _Roc; + return _Roc is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "standardSequence": - StandardSequence = (Hl7.Fhir.Model.CodeableConcept)value; + StandardSequence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "score": - Score = (Hl7.Fhir.Model.Quantity)value; + Score = (Hl7.Fhir.Model.Quantity?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "truthTP": - TruthTPElement = (Hl7.Fhir.Model.FhirDecimal)value; + TruthTPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "queryTP": - QueryTPElement = (Hl7.Fhir.Model.FhirDecimal)value; + QueryTPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "truthFN": - TruthFNElement = (Hl7.Fhir.Model.FhirDecimal)value; + TruthFNElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "queryFP": - QueryFPElement = (Hl7.Fhir.Model.FhirDecimal)value; + QueryFPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "gtFP": - GtFPElement = (Hl7.Fhir.Model.FhirDecimal)value; + GtFPElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "precision": - PrecisionElement = (Hl7.Fhir.Model.FhirDecimal)value; + PrecisionElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "recall": - RecallElement = (Hl7.Fhir.Model.FhirDecimal)value; + RecallElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "fScore": - FScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + FScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "roc": - Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent)value; + Roc = (Hl7.Fhir.Model.MolecularSequence.RocComponent?)value; return this; default: return base.SetValue(key, value); @@ -1467,21 +1392,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (StandardSequence is not null) yield return new KeyValuePair("standardSequence",StandardSequence); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (Score is not null) yield return new KeyValuePair("score",Score); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (TruthTPElement is not null) yield return new KeyValuePair("truthTP",TruthTPElement); - if (QueryTPElement is not null) yield return new KeyValuePair("queryTP",QueryTPElement); - if (TruthFNElement is not null) yield return new KeyValuePair("truthFN",TruthFNElement); - if (QueryFPElement is not null) yield return new KeyValuePair("queryFP",QueryFPElement); - if (GtFPElement is not null) yield return new KeyValuePair("gtFP",GtFPElement); - if (PrecisionElement is not null) yield return new KeyValuePair("precision",PrecisionElement); - if (RecallElement is not null) yield return new KeyValuePair("recall",RecallElement); - if (FScoreElement is not null) yield return new KeyValuePair("fScore",FScoreElement); - if (Roc is not null) yield return new KeyValuePair("roc",Roc); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_StandardSequence is not null) yield return new KeyValuePair("standardSequence",_StandardSequence); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_Score is not null) yield return new KeyValuePair("score",_Score); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_TruthTPElement is not null) yield return new KeyValuePair("truthTP",_TruthTPElement); + if (_QueryTPElement is not null) yield return new KeyValuePair("queryTP",_QueryTPElement); + if (_TruthFNElement is not null) yield return new KeyValuePair("truthFN",_TruthFNElement); + if (_QueryFPElement is not null) yield return new KeyValuePair("queryFP",_QueryFPElement); + if (_GtFPElement is not null) yield return new KeyValuePair("gtFP",_GtFPElement); + if (_PrecisionElement is not null) yield return new KeyValuePair("precision",_PrecisionElement); + if (_RecallElement is not null) yield return new KeyValuePair("recall",_RecallElement); + if (_FScoreElement is not null) yield return new KeyValuePair("fScore",_FScoreElement); + if (_Roc is not null) yield return new KeyValuePair("roc",_Roc); } } @@ -1510,24 +1435,24 @@ public partial class RocComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ScoreElement { - get { if(_ScoreElement==null) _ScoreElement = new List(); return _ScoreElement; } + get => _ScoreElement ?? new List(); set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } - private List _ScoreElement; + private List? _ScoreElement; /// /// Genotype quality score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Score + public IEnumerable? Score { - get { return ScoreElement != null ? ScoreElement.Select(elem => elem.Value) : null; } + get => _ScoreElement?.Select(elem => elem.Value); set { if (value == null) - ScoreElement = null; + ScoreElement = null!; else ScoreElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("Score"); @@ -1542,24 +1467,24 @@ public IEnumerable Score [DataMember] public List NumTPElement { - get { if(_NumTPElement==null) _NumTPElement = new List(); return _NumTPElement; } + get => _NumTPElement ?? new List(); set { _NumTPElement = value; OnPropertyChanged("NumTPElement"); } } - private List _NumTPElement; + private List? _NumTPElement; /// /// Roc score true positive numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NumTP + public IEnumerable? NumTP { - get { return NumTPElement != null ? NumTPElement.Select(elem => elem.Value) : null; } + get => _NumTPElement?.Select(elem => elem.Value); set { if (value == null) - NumTPElement = null; + NumTPElement = null!; else NumTPElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("NumTP"); @@ -1574,24 +1499,24 @@ public IEnumerable NumTP [DataMember] public List NumFPElement { - get { if(_NumFPElement==null) _NumFPElement = new List(); return _NumFPElement; } + get => _NumFPElement ?? new List(); set { _NumFPElement = value; OnPropertyChanged("NumFPElement"); } } - private List _NumFPElement; + private List? _NumFPElement; /// /// Roc score false positive numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NumFP + public IEnumerable? NumFP { - get { return NumFPElement != null ? NumFPElement.Select(elem => elem.Value) : null; } + get => _NumFPElement?.Select(elem => elem.Value); set { if (value == null) - NumFPElement = null; + NumFPElement = null!; else NumFPElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("NumFP"); @@ -1606,24 +1531,24 @@ public IEnumerable NumFP [DataMember] public List NumFNElement { - get { if(_NumFNElement==null) _NumFNElement = new List(); return _NumFNElement; } + get => _NumFNElement ?? new List(); set { _NumFNElement = value; OnPropertyChanged("NumFNElement"); } } - private List _NumFNElement; + private List? _NumFNElement; /// /// Roc score false negative numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NumFN + public IEnumerable? NumFN { - get { return NumFNElement != null ? NumFNElement.Select(elem => elem.Value) : null; } + get => _NumFNElement?.Select(elem => elem.Value); set { if (value == null) - NumFNElement = null; + NumFNElement = null!; else NumFNElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("NumFN"); @@ -1638,24 +1563,24 @@ public IEnumerable NumFN [DataMember] public List PrecisionElement { - get { if(_PrecisionElement==null) _PrecisionElement = new List(); return _PrecisionElement; } + get => _PrecisionElement ?? new List(); set { _PrecisionElement = value; OnPropertyChanged("PrecisionElement"); } } - private List _PrecisionElement; + private List? _PrecisionElement; /// /// Precision of the GQ score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Precision + public IEnumerable? Precision { - get { return PrecisionElement != null ? PrecisionElement.Select(elem => elem.Value) : null; } + get => _PrecisionElement?.Select(elem => elem.Value); set { if (value == null) - PrecisionElement = null; + PrecisionElement = null!; else PrecisionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("Precision"); @@ -1670,24 +1595,24 @@ public IEnumerable Precision [DataMember] public List SensitivityElement { - get { if(_SensitivityElement==null) _SensitivityElement = new List(); return _SensitivityElement; } + get => _SensitivityElement ?? new List(); set { _SensitivityElement = value; OnPropertyChanged("SensitivityElement"); } } - private List _SensitivityElement; + private List? _SensitivityElement; /// /// Sensitivity of the GQ score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Sensitivity + public IEnumerable? Sensitivity { - get { return SensitivityElement != null ? SensitivityElement.Select(elem => elem.Value) : null; } + get => _SensitivityElement?.Select(elem => elem.Value); set { if (value == null) - SensitivityElement = null; + SensitivityElement = null!; else SensitivityElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("Sensitivity"); @@ -1702,24 +1627,24 @@ public IEnumerable Sensitivity [DataMember] public List FMeasureElement { - get { if(_FMeasureElement==null) _FMeasureElement = new List(); return _FMeasureElement; } + get => _FMeasureElement ?? new List(); set { _FMeasureElement = value; OnPropertyChanged("FMeasureElement"); } } - private List _FMeasureElement; + private List? _FMeasureElement; /// /// FScore of the GQ score /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FMeasure + public IEnumerable? FMeasure { - get { return FMeasureElement != null ? FMeasureElement.Select(elem => elem.Value) : null; } + get => _FMeasureElement?.Select(elem => elem.Value); set { if (value == null) - FMeasureElement = null; + FMeasureElement = null!; else FMeasureElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("FMeasure"); @@ -1728,21 +1653,17 @@ public IEnumerable FMeasure protected internal override void CopyToInternal(Base other) { - var dest = other as RocComponent; - - if (dest == null) - { + if(other is not RocComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ScoreElement.Any()) dest.ScoreElement = new List(ScoreElement.DeepCopyInternal()); - if(NumTPElement.Any()) dest.NumTPElement = new List(NumTPElement.DeepCopyInternal()); - if(NumFPElement.Any()) dest.NumFPElement = new List(NumFPElement.DeepCopyInternal()); - if(NumFNElement.Any()) dest.NumFNElement = new List(NumFNElement.DeepCopyInternal()); - if(PrecisionElement.Any()) dest.PrecisionElement = new List(PrecisionElement.DeepCopyInternal()); - if(SensitivityElement.Any()) dest.SensitivityElement = new List(SensitivityElement.DeepCopyInternal()); - if(FMeasureElement.Any()) dest.FMeasureElement = new List(FMeasureElement.DeepCopyInternal()); + if(_ScoreElement is not null) dest.ScoreElement = new List(_ScoreElement.DeepCopyInternal()); + if(_NumTPElement is not null) dest.NumTPElement = new List(_NumTPElement.DeepCopyInternal()); + if(_NumFPElement is not null) dest.NumFPElement = new List(_NumFPElement.DeepCopyInternal()); + if(_NumFNElement is not null) dest.NumFNElement = new List(_NumFNElement.DeepCopyInternal()); + if(_PrecisionElement is not null) dest.PrecisionElement = new List(_PrecisionElement.DeepCopyInternal()); + if(_SensitivityElement is not null) dest.SensitivityElement = new List(_SensitivityElement.DeepCopyInternal()); + if(_FMeasureElement is not null) dest.FMeasureElement = new List(_FMeasureElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1754,76 +1675,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RocComponent; - if(otherT == null) return false; + if(other is not RocComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ScoreElement, otherT.ScoreElement)) return false; - if(!comparer.ListEquals(NumTPElement, otherT.NumTPElement)) return false; - if(!comparer.ListEquals(NumFPElement, otherT.NumFPElement)) return false; - if(!comparer.ListEquals(NumFNElement, otherT.NumFNElement)) return false; - if(!comparer.ListEquals(PrecisionElement, otherT.PrecisionElement)) return false; - if(!comparer.ListEquals(SensitivityElement, otherT.SensitivityElement)) return false; - if(!comparer.ListEquals(FMeasureElement, otherT.FMeasureElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ScoreElement, otherT._ScoreElement)) return false; + if(!comparer.ListEquals(_NumTPElement, otherT._NumTPElement)) return false; + if(!comparer.ListEquals(_NumFPElement, otherT._NumFPElement)) return false; + if(!comparer.ListEquals(_NumFNElement, otherT._NumFNElement)) return false; + if(!comparer.ListEquals(_PrecisionElement, otherT._PrecisionElement)) return false; + if(!comparer.ListEquals(_SensitivityElement, otherT._SensitivityElement)) return false; + if(!comparer.ListEquals(_FMeasureElement, otherT._FMeasureElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "score": - value = ScoreElement; - return ScoreElement?.Any() == true; + value = _ScoreElement; + return _ScoreElement?.Any() == true; case "numTP": - value = NumTPElement; - return NumTPElement?.Any() == true; + value = _NumTPElement; + return _NumTPElement?.Any() == true; case "numFP": - value = NumFPElement; - return NumFPElement?.Any() == true; + value = _NumFPElement; + return _NumFPElement?.Any() == true; case "numFN": - value = NumFNElement; - return NumFNElement?.Any() == true; + value = _NumFNElement; + return _NumFNElement?.Any() == true; case "precision": - value = PrecisionElement; - return PrecisionElement?.Any() == true; + value = _PrecisionElement; + return _PrecisionElement?.Any() == true; case "sensitivity": - value = SensitivityElement; - return SensitivityElement?.Any() == true; + value = _SensitivityElement; + return _SensitivityElement?.Any() == true; case "fMeasure": - value = FMeasureElement; - return FMeasureElement?.Any() == true; + value = _FMeasureElement; + return _FMeasureElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "score": - ScoreElement = (List)value; + ScoreElement = (List?)value!; return this; case "numTP": - NumTPElement = (List)value; + NumTPElement = (List?)value!; return this; case "numFP": - NumFPElement = (List)value; + NumFPElement = (List?)value!; return this; case "numFN": - NumFNElement = (List)value; + NumFNElement = (List?)value!; return this; case "precision": - PrecisionElement = (List)value; + PrecisionElement = (List?)value!; return this; case "sensitivity": - SensitivityElement = (List)value; + SensitivityElement = (List?)value!; return this; case "fMeasure": - FMeasureElement = (List)value; + FMeasureElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1834,13 +1755,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ScoreElement?.Any() == true) yield return new KeyValuePair("score",ScoreElement); - if (NumTPElement?.Any() == true) yield return new KeyValuePair("numTP",NumTPElement); - if (NumFPElement?.Any() == true) yield return new KeyValuePair("numFP",NumFPElement); - if (NumFNElement?.Any() == true) yield return new KeyValuePair("numFN",NumFNElement); - if (PrecisionElement?.Any() == true) yield return new KeyValuePair("precision",PrecisionElement); - if (SensitivityElement?.Any() == true) yield return new KeyValuePair("sensitivity",SensitivityElement); - if (FMeasureElement?.Any() == true) yield return new KeyValuePair("fMeasure",FMeasureElement); + if (_ScoreElement?.Any() == true) yield return new KeyValuePair("score",_ScoreElement); + if (_NumTPElement?.Any() == true) yield return new KeyValuePair("numTP",_NumTPElement); + if (_NumFPElement?.Any() == true) yield return new KeyValuePair("numFP",_NumFPElement); + if (_NumFNElement?.Any() == true) yield return new KeyValuePair("numFN",_NumFNElement); + if (_PrecisionElement?.Any() == true) yield return new KeyValuePair("precision",_PrecisionElement); + if (_SensitivityElement?.Any() == true) yield return new KeyValuePair("sensitivity",_SensitivityElement); + if (_FMeasureElement?.Any() == true) yield return new KeyValuePair("fMeasure",_FMeasureElement); } } @@ -1869,13 +1790,13 @@ public partial class RepositoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("repositoryType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// directlink | openapi | login | oauth | other @@ -1884,13 +1805,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.RepositoryType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1900,28 +1818,25 @@ public Hl7.Fhir.Model.MolecularSequence.RepositoryType? Type /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URI of the repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1931,28 +1846,25 @@ public string Url /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Repository's name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1962,28 +1874,25 @@ public string Name /// [FhirElement("datasetId", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DatasetIdElement + public Hl7.Fhir.Model.FhirString? DatasetIdElement { get { return _DatasetIdElement; } set { _DatasetIdElement = value; OnPropertyChanged("DatasetIdElement"); } } - private Hl7.Fhir.Model.FhirString _DatasetIdElement; + private Hl7.Fhir.Model.FhirString? _DatasetIdElement; /// /// Id of the dataset that used to call for dataset in repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DatasetId + public string? DatasetId { - get { return DatasetIdElement != null ? DatasetIdElement.Value : null; } + get => _DatasetIdElement?.Value; set { - if (value == null) - DatasetIdElement = null; - else - DatasetIdElement = new Hl7.Fhir.Model.FhirString(value); + DatasetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DatasetId"); } } @@ -1993,28 +1902,25 @@ public string DatasetId /// [FhirElement("variantsetId", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString VariantsetIdElement + public Hl7.Fhir.Model.FhirString? VariantsetIdElement { get { return _VariantsetIdElement; } set { _VariantsetIdElement = value; OnPropertyChanged("VariantsetIdElement"); } } - private Hl7.Fhir.Model.FhirString _VariantsetIdElement; + private Hl7.Fhir.Model.FhirString? _VariantsetIdElement; /// /// Id of the variantset that used to call for variantset in repository /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VariantsetId + public string? VariantsetId { - get { return VariantsetIdElement != null ? VariantsetIdElement.Value : null; } + get => _VariantsetIdElement?.Value; set { - if (value == null) - VariantsetIdElement = null; - else - VariantsetIdElement = new Hl7.Fhir.Model.FhirString(value); + VariantsetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VariantsetId"); } } @@ -2024,48 +1930,41 @@ public string VariantsetId /// [FhirElement("readsetId", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ReadsetIdElement + public Hl7.Fhir.Model.FhirString? ReadsetIdElement { get { return _ReadsetIdElement; } set { _ReadsetIdElement = value; OnPropertyChanged("ReadsetIdElement"); } } - private Hl7.Fhir.Model.FhirString _ReadsetIdElement; + private Hl7.Fhir.Model.FhirString? _ReadsetIdElement; /// /// Id of the read /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReadsetId + public string? ReadsetId { - get { return ReadsetIdElement != null ? ReadsetIdElement.Value : null; } + get => _ReadsetIdElement?.Value; set { - if (value == null) - ReadsetIdElement = null; - else - ReadsetIdElement = new Hl7.Fhir.Model.FhirString(value); + ReadsetIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReadsetId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RepositoryComponent; - - if (dest == null) - { + if(other is not RepositoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DatasetIdElement != null) dest.DatasetIdElement = (Hl7.Fhir.Model.FhirString)DatasetIdElement.DeepCopyInternal(); - if(VariantsetIdElement != null) dest.VariantsetIdElement = (Hl7.Fhir.Model.FhirString)VariantsetIdElement.DeepCopyInternal(); - if(ReadsetIdElement != null) dest.ReadsetIdElement = (Hl7.Fhir.Model.FhirString)ReadsetIdElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DatasetIdElement is not null) dest.DatasetIdElement = (Hl7.Fhir.Model.FhirString)_DatasetIdElement.DeepCopyInternal(); + if(_VariantsetIdElement is not null) dest.VariantsetIdElement = (Hl7.Fhir.Model.FhirString)_VariantsetIdElement.DeepCopyInternal(); + if(_ReadsetIdElement is not null) dest.ReadsetIdElement = (Hl7.Fhir.Model.FhirString)_ReadsetIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2077,69 +1976,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepositoryComponent; - if(otherT == null) return false; + if(other is not RepositoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DatasetIdElement, otherT.DatasetIdElement)) return false; - if(!comparer.Equals(VariantsetIdElement, otherT.VariantsetIdElement)) return false; - if(!comparer.Equals(ReadsetIdElement, otherT.ReadsetIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DatasetIdElement, otherT._DatasetIdElement)) return false; + if(!comparer.Equals(_VariantsetIdElement, otherT._VariantsetIdElement)) return false; + if(!comparer.Equals(_ReadsetIdElement, otherT._ReadsetIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "datasetId": - value = DatasetIdElement; - return DatasetIdElement is not null; + value = _DatasetIdElement; + return _DatasetIdElement is not null; case "variantsetId": - value = VariantsetIdElement; - return VariantsetIdElement is not null; + value = _VariantsetIdElement; + return _VariantsetIdElement is not null; case "readsetId": - value = ReadsetIdElement; - return ReadsetIdElement is not null; + value = _ReadsetIdElement; + return _ReadsetIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "datasetId": - DatasetIdElement = (Hl7.Fhir.Model.FhirString)value; + DatasetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variantsetId": - VariantsetIdElement = (Hl7.Fhir.Model.FhirString)value; + VariantsetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "readsetId": - ReadsetIdElement = (Hl7.Fhir.Model.FhirString)value; + ReadsetIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2150,12 +2049,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DatasetIdElement is not null) yield return new KeyValuePair("datasetId",DatasetIdElement); - if (VariantsetIdElement is not null) yield return new KeyValuePair("variantsetId",VariantsetIdElement); - if (ReadsetIdElement is not null) yield return new KeyValuePair("readsetId",ReadsetIdElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DatasetIdElement is not null) yield return new KeyValuePair("datasetId",_DatasetIdElement); + if (_VariantsetIdElement is not null) yield return new KeyValuePair("variantsetId",_VariantsetIdElement); + if (_ReadsetIdElement is not null) yield return new KeyValuePair("readsetId",_ReadsetIdElement); } } @@ -2182,26 +2081,26 @@ public partial class StructureVariantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("variantType", InSummary=true, Order=40)] [Binding("LOINC LL379-9 answerlist")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VariantType + public Hl7.Fhir.Model.CodeableConcept? VariantType { get { return _VariantType; } set { _VariantType = value; OnPropertyChanged("VariantType"); } } - private Hl7.Fhir.Model.CodeableConcept _VariantType; + private Hl7.Fhir.Model.CodeableConcept? _VariantType; /// /// Does the structural variant have base pair resolution breakpoints?. /// [FhirElement("exact", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExactElement + public Hl7.Fhir.Model.FhirBoolean? ExactElement { get { return _ExactElement; } set { _ExactElement = value; OnPropertyChanged("ExactElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExactElement; + private Hl7.Fhir.Model.FhirBoolean? _ExactElement; /// /// Does the structural variant have base pair resolution breakpoints? @@ -2210,13 +2109,10 @@ public Hl7.Fhir.Model.FhirBoolean ExactElement [IgnoreDataMember] public bool? Exact { - get { return ExactElement != null ? ExactElement.Value : null; } + get => _ExactElement?.Value; set { - if (value == null) - ExactElement = null; - else - ExactElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExactElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exact"); } } @@ -2226,13 +2122,13 @@ public bool? Exact /// [FhirElement("length", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer LengthElement + public Hl7.Fhir.Model.Integer? LengthElement { get { return _LengthElement; } set { _LengthElement = value; OnPropertyChanged("LengthElement"); } } - private Hl7.Fhir.Model.Integer _LengthElement; + private Hl7.Fhir.Model.Integer? _LengthElement; /// /// Structural variant length @@ -2241,13 +2137,10 @@ public Hl7.Fhir.Model.Integer LengthElement [IgnoreDataMember] public int? Length { - get { return LengthElement != null ? LengthElement.Value : null; } + get => _LengthElement?.Value; set { - if (value == null) - LengthElement = null; - else - LengthElement = new Hl7.Fhir.Model.Integer(value); + LengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Length"); } } @@ -2257,42 +2150,38 @@ public int? Length /// [FhirElement("outer", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.OuterComponent Outer + public Hl7.Fhir.Model.MolecularSequence.OuterComponent? Outer { get { return _Outer; } set { _Outer = value; OnPropertyChanged("Outer"); } } - private Hl7.Fhir.Model.MolecularSequence.OuterComponent _Outer; + private Hl7.Fhir.Model.MolecularSequence.OuterComponent? _Outer; /// /// Structural variant inner. /// [FhirElement("inner", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.InnerComponent Inner + public Hl7.Fhir.Model.MolecularSequence.InnerComponent? Inner { get { return _Inner; } set { _Inner = value; OnPropertyChanged("Inner"); } } - private Hl7.Fhir.Model.MolecularSequence.InnerComponent _Inner; + private Hl7.Fhir.Model.MolecularSequence.InnerComponent? _Inner; protected internal override void CopyToInternal(Base other) { - var dest = other as StructureVariantComponent; - - if (dest == null) - { + if(other is not StructureVariantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VariantType != null) dest.VariantType = (Hl7.Fhir.Model.CodeableConcept)VariantType.DeepCopyInternal(); - if(ExactElement != null) dest.ExactElement = (Hl7.Fhir.Model.FhirBoolean)ExactElement.DeepCopyInternal(); - if(LengthElement != null) dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopyInternal(); - if(Outer != null) dest.Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent)Outer.DeepCopyInternal(); - if(Inner != null) dest.Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent)Inner.DeepCopyInternal(); + if(_VariantType is not null) dest.VariantType = (Hl7.Fhir.Model.CodeableConcept)_VariantType.DeepCopyInternal(); + if(_ExactElement is not null) dest.ExactElement = (Hl7.Fhir.Model.FhirBoolean)_ExactElement.DeepCopyInternal(); + if(_LengthElement is not null) dest.LengthElement = (Hl7.Fhir.Model.Integer)_LengthElement.DeepCopyInternal(); + if(_Outer is not null) dest.Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent)_Outer.DeepCopyInternal(); + if(_Inner is not null) dest.Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent)_Inner.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2304,62 +2193,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureVariantComponent; - if(otherT == null) return false; + if(other is not StructureVariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VariantType, otherT.VariantType)) return false; - if(!comparer.Equals(ExactElement, otherT.ExactElement)) return false; - if(!comparer.Equals(LengthElement, otherT.LengthElement)) return false; - if(!comparer.Equals(Outer, otherT.Outer)) return false; - if(!comparer.Equals(Inner, otherT.Inner)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariantType, otherT._VariantType)) return false; + if(!comparer.Equals(_ExactElement, otherT._ExactElement)) return false; + if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; + if(!comparer.Equals(_Outer, otherT._Outer)) return false; + if(!comparer.Equals(_Inner, otherT._Inner)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "variantType": - value = VariantType; - return VariantType is not null; + value = _VariantType; + return _VariantType is not null; case "exact": - value = ExactElement; - return ExactElement is not null; + value = _ExactElement; + return _ExactElement is not null; case "length": - value = LengthElement; - return LengthElement is not null; + value = _LengthElement; + return _LengthElement is not null; case "outer": - value = Outer; - return Outer is not null; + value = _Outer; + return _Outer is not null; case "inner": - value = Inner; - return Inner is not null; + value = _Inner; + return _Inner is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "variantType": - VariantType = (Hl7.Fhir.Model.CodeableConcept)value; + VariantType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "exact": - ExactElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExactElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "length": - LengthElement = (Hl7.Fhir.Model.Integer)value; + LengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "outer": - Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent)value; + Outer = (Hl7.Fhir.Model.MolecularSequence.OuterComponent?)value; return this; case "inner": - Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent)value; + Inner = (Hl7.Fhir.Model.MolecularSequence.InnerComponent?)value; return this; default: return base.SetValue(key, value); @@ -2370,11 +2259,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VariantType is not null) yield return new KeyValuePair("variantType",VariantType); - if (ExactElement is not null) yield return new KeyValuePair("exact",ExactElement); - if (LengthElement is not null) yield return new KeyValuePair("length",LengthElement); - if (Outer is not null) yield return new KeyValuePair("outer",Outer); - if (Inner is not null) yield return new KeyValuePair("inner",Inner); + if (_VariantType is not null) yield return new KeyValuePair("variantType",_VariantType); + if (_ExactElement is not null) yield return new KeyValuePair("exact",_ExactElement); + if (_LengthElement is not null) yield return new KeyValuePair("length",_LengthElement); + if (_Outer is not null) yield return new KeyValuePair("outer",_Outer); + if (_Inner is not null) yield return new KeyValuePair("inner",_Inner); } } @@ -2397,13 +2286,13 @@ public partial class OuterComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Structural variant outer start @@ -2412,13 +2301,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -2428,13 +2314,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// Structural variant outer end @@ -2443,29 +2329,22 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OuterComponent; - - if (dest == null) - { + if(other is not OuterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2477,41 +2356,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OuterComponent; - if(otherT == null) return false; + if(other is not OuterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -2522,8 +2401,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); } } @@ -2546,13 +2425,13 @@ public partial class InnerComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Structural variant inner start @@ -2561,13 +2440,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -2577,13 +2453,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// Structural variant inner end @@ -2592,29 +2468,22 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InnerComponent; - - if (dest == null) - { + if(other is not InnerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2626,41 +2495,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InnerComponent; - if(otherT == null) return false; + if(other is not InnerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -2671,8 +2540,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); } } @@ -2685,11 +2554,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// aa | dna | rna. @@ -2698,13 +2567,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("sequenceType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// aa | dna | rna @@ -2713,13 +2582,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.SequenceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2730,13 +2596,13 @@ public Hl7.Fhir.Model.MolecularSequence.SequenceType? Type [FhirElement("coordinateSystem", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer CoordinateSystemElement + public Hl7.Fhir.Model.Integer? CoordinateSystemElement { get { return _CoordinateSystemElement; } set { _CoordinateSystemElement = value; OnPropertyChanged("CoordinateSystemElement"); } } - private Hl7.Fhir.Model.Integer _CoordinateSystemElement; + private Hl7.Fhir.Model.Integer? _CoordinateSystemElement; /// /// Base number of coordinate system (0 for 0-based numbering or coordinates, inclusive start, exclusive end, 1 for 1-based numbering, inclusive start, inclusive end) @@ -2745,13 +2611,10 @@ public Hl7.Fhir.Model.Integer CoordinateSystemElement [IgnoreDataMember] public int? CoordinateSystem { - get { return CoordinateSystemElement != null ? CoordinateSystemElement.Value : null; } + get => _CoordinateSystemElement?.Value; set { - if (value == null) - CoordinateSystemElement = null; - else - CoordinateSystemElement = new Hl7.Fhir.Model.Integer(value); + CoordinateSystemElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("CoordinateSystem"); } } @@ -2763,13 +2626,13 @@ public int? CoordinateSystem [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Specimen used for sequencing. @@ -2778,13 +2641,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// The method for sequencing. @@ -2793,13 +2656,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Who should be responsible for test result. @@ -2808,39 +2671,39 @@ public Hl7.Fhir.Model.ResourceReference Device [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// The number of copies of the sequence of interest. (RNASeq). /// [FhirElement("quantity", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// A sequence used as reference. /// [FhirElement("referenceSeq", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent ReferenceSeq + public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent? ReferenceSeq { get { return _ReferenceSeq; } set { _ReferenceSeq = value; OnPropertyChanged("ReferenceSeq"); } } - private Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent _ReferenceSeq; + private Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent? _ReferenceSeq; /// /// Variant in sequence. @@ -2850,39 +2713,36 @@ public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent ReferenceSeq [DataMember] public List Variant { - get { if(_Variant==null) _Variant = new List(); return _Variant; } + get => _Variant ?? new List(); set { _Variant = value; OnPropertyChanged("Variant"); } } - private List _Variant; + private List? _Variant; /// /// Sequence that was observed. /// [FhirElement("observedSeq", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString ObservedSeqElement + public Hl7.Fhir.Model.FhirString? ObservedSeqElement { get { return _ObservedSeqElement; } set { _ObservedSeqElement = value; OnPropertyChanged("ObservedSeqElement"); } } - private Hl7.Fhir.Model.FhirString _ObservedSeqElement; + private Hl7.Fhir.Model.FhirString? _ObservedSeqElement; /// /// Sequence that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ObservedSeq + public string? ObservedSeq { - get { return ObservedSeqElement != null ? ObservedSeqElement.Value : null; } + get => _ObservedSeqElement?.Value; set { - if (value == null) - ObservedSeqElement = null; - else - ObservedSeqElement = new Hl7.Fhir.Model.FhirString(value); + ObservedSeqElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ObservedSeq"); } } @@ -2895,24 +2755,24 @@ public string ObservedSeq [DataMember] public List Quality { - get { if(_Quality==null) _Quality = new List(); return _Quality; } + get => _Quality ?? new List(); set { _Quality = value; OnPropertyChanged("Quality"); } } - private List _Quality; + private List? _Quality; /// /// Average number of reads representing a given nucleotide in the reconstructed sequence. /// [FhirElement("readCoverage", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Integer ReadCoverageElement + public Hl7.Fhir.Model.Integer? ReadCoverageElement { get { return _ReadCoverageElement; } set { _ReadCoverageElement = value; OnPropertyChanged("ReadCoverageElement"); } } - private Hl7.Fhir.Model.Integer _ReadCoverageElement; + private Hl7.Fhir.Model.Integer? _ReadCoverageElement; /// /// Average number of reads representing a given nucleotide in the reconstructed sequence @@ -2921,13 +2781,10 @@ public Hl7.Fhir.Model.Integer ReadCoverageElement [IgnoreDataMember] public int? ReadCoverage { - get { return ReadCoverageElement != null ? ReadCoverageElement.Value : null; } + get => _ReadCoverageElement?.Value; set { - if (value == null) - ReadCoverageElement = null; - else - ReadCoverageElement = new Hl7.Fhir.Model.Integer(value); + ReadCoverageElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("ReadCoverage"); } } @@ -2940,11 +2797,11 @@ public int? ReadCoverage [DataMember] public List Repository { - get { if(_Repository==null) _Repository = new List(); return _Repository; } + get => _Repository ?? new List(); set { _Repository = value; OnPropertyChanged("Repository"); } } - private List _Repository; + private List? _Repository; /// /// Pointer to next atomic sequence. @@ -2956,11 +2813,11 @@ public List Repository [DataMember] public List Pointer { - get { if(_Pointer==null) _Pointer = new List(); return _Pointer; } + get => _Pointer ?? new List(); set { _Pointer = value; OnPropertyChanged("Pointer"); } } - private List _Pointer; + private List? _Pointer; /// /// Structural variant. @@ -2970,40 +2827,36 @@ public List Pointer [DataMember] public List StructureVariant { - get { if(_StructureVariant==null) _StructureVariant = new List(); return _StructureVariant; } + get => _StructureVariant ?? new List(); set { _StructureVariant = value; OnPropertyChanged("StructureVariant"); } } - private List _StructureVariant; + private List? _StructureVariant; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MolecularSequence; - - if (dest == null) - { + if(other is not MolecularSequence dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(CoordinateSystemElement != null) dest.CoordinateSystemElement = (Hl7.Fhir.Model.Integer)CoordinateSystemElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ReferenceSeq != null) dest.ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent)ReferenceSeq.DeepCopyInternal(); - if(Variant.Any()) dest.Variant = new List(Variant.DeepCopyInternal()); - if(ObservedSeqElement != null) dest.ObservedSeqElement = (Hl7.Fhir.Model.FhirString)ObservedSeqElement.DeepCopyInternal(); - if(Quality.Any()) dest.Quality = new List(Quality.DeepCopyInternal()); - if(ReadCoverageElement != null) dest.ReadCoverageElement = (Hl7.Fhir.Model.Integer)ReadCoverageElement.DeepCopyInternal(); - if(Repository.Any()) dest.Repository = new List(Repository.DeepCopyInternal()); - if(Pointer.Any()) dest.Pointer = new List(Pointer.DeepCopyInternal()); - if(StructureVariant.Any()) dest.StructureVariant = new List(StructureVariant.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_CoordinateSystemElement is not null) dest.CoordinateSystemElement = (Hl7.Fhir.Model.Integer)_CoordinateSystemElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ReferenceSeq is not null) dest.ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent)_ReferenceSeq.DeepCopyInternal(); + if(_Variant is not null) dest.Variant = new List(_Variant.DeepCopyInternal()); + if(_ObservedSeqElement is not null) dest.ObservedSeqElement = (Hl7.Fhir.Model.FhirString)_ObservedSeqElement.DeepCopyInternal(); + if(_Quality is not null) dest.Quality = new List(_Quality.DeepCopyInternal()); + if(_ReadCoverageElement is not null) dest.ReadCoverageElement = (Hl7.Fhir.Model.Integer)_ReadCoverageElement.DeepCopyInternal(); + if(_Repository is not null) dest.Repository = new List(_Repository.DeepCopyInternal()); + if(_Pointer is not null) dest.Pointer = new List(_Pointer.DeepCopyInternal()); + if(_StructureVariant is not null) dest.StructureVariant = new List(_StructureVariant.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3015,139 +2868,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MolecularSequence; - if(otherT == null) return false; + if(other is not MolecularSequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(CoordinateSystemElement, otherT.CoordinateSystemElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ReferenceSeq, otherT.ReferenceSeq)) return false; - if(!comparer.ListEquals(Variant, otherT.Variant)) return false; - if(!comparer.Equals(ObservedSeqElement, otherT.ObservedSeqElement)) return false; - if(!comparer.ListEquals(Quality, otherT.Quality)) return false; - if(!comparer.Equals(ReadCoverageElement, otherT.ReadCoverageElement)) return false; - if(!comparer.ListEquals(Repository, otherT.Repository)) return false; - if(!comparer.ListEquals(Pointer, otherT.Pointer)) return false; - if(!comparer.ListEquals(StructureVariant, otherT.StructureVariant)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_CoordinateSystemElement, otherT._CoordinateSystemElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ReferenceSeq, otherT._ReferenceSeq)) return false; + if(!comparer.ListEquals(_Variant, otherT._Variant)) return false; + if(!comparer.Equals(_ObservedSeqElement, otherT._ObservedSeqElement)) return false; + if(!comparer.ListEquals(_Quality, otherT._Quality)) return false; + if(!comparer.Equals(_ReadCoverageElement, otherT._ReadCoverageElement)) return false; + if(!comparer.ListEquals(_Repository, otherT._Repository)) return false; + if(!comparer.ListEquals(_Pointer, otherT._Pointer)) return false; + if(!comparer.ListEquals(_StructureVariant, otherT._StructureVariant)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "coordinateSystem": - value = CoordinateSystemElement; - return CoordinateSystemElement is not null; + value = _CoordinateSystemElement; + return _CoordinateSystemElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "referenceSeq": - value = ReferenceSeq; - return ReferenceSeq is not null; + value = _ReferenceSeq; + return _ReferenceSeq is not null; case "variant": - value = Variant; - return Variant?.Any() == true; + value = _Variant; + return _Variant?.Any() == true; case "observedSeq": - value = ObservedSeqElement; - return ObservedSeqElement is not null; + value = _ObservedSeqElement; + return _ObservedSeqElement is not null; case "quality": - value = Quality; - return Quality?.Any() == true; + value = _Quality; + return _Quality?.Any() == true; case "readCoverage": - value = ReadCoverageElement; - return ReadCoverageElement is not null; + value = _ReadCoverageElement; + return _ReadCoverageElement is not null; case "repository": - value = Repository; - return Repository?.Any() == true; + value = _Repository; + return _Repository?.Any() == true; case "pointer": - value = Pointer; - return Pointer?.Any() == true; + value = _Pointer; + return _Pointer?.Any() == true; case "structureVariant": - value = StructureVariant; - return StructureVariant?.Any() == true; + value = _StructureVariant; + return _StructureVariant?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "coordinateSystem": - CoordinateSystemElement = (Hl7.Fhir.Model.Integer)value; + CoordinateSystemElement = (Hl7.Fhir.Model.Integer?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "referenceSeq": - ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent)value; + ReferenceSeq = (Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent?)value; return this; case "variant": - Variant = (List)value; + Variant = (List?)value!; return this; case "observedSeq": - ObservedSeqElement = (Hl7.Fhir.Model.FhirString)value; + ObservedSeqElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quality": - Quality = (List)value; + Quality = (List?)value!; return this; case "readCoverage": - ReadCoverageElement = (Hl7.Fhir.Model.Integer)value; + ReadCoverageElement = (Hl7.Fhir.Model.Integer?)value; return this; case "repository": - Repository = (List)value; + Repository = (List?)value!; return this; case "pointer": - Pointer = (List)value; + Pointer = (List?)value!; return this; case "structureVariant": - StructureVariant = (List)value; + StructureVariant = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3158,22 +3011,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (CoordinateSystemElement is not null) yield return new KeyValuePair("coordinateSystem",CoordinateSystemElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ReferenceSeq is not null) yield return new KeyValuePair("referenceSeq",ReferenceSeq); - if (Variant?.Any() == true) yield return new KeyValuePair("variant",Variant); - if (ObservedSeqElement is not null) yield return new KeyValuePair("observedSeq",ObservedSeqElement); - if (Quality?.Any() == true) yield return new KeyValuePair("quality",Quality); - if (ReadCoverageElement is not null) yield return new KeyValuePair("readCoverage",ReadCoverageElement); - if (Repository?.Any() == true) yield return new KeyValuePair("repository",Repository); - if (Pointer?.Any() == true) yield return new KeyValuePair("pointer",Pointer); - if (StructureVariant?.Any() == true) yield return new KeyValuePair("structureVariant",StructureVariant); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_CoordinateSystemElement is not null) yield return new KeyValuePair("coordinateSystem",_CoordinateSystemElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ReferenceSeq is not null) yield return new KeyValuePair("referenceSeq",_ReferenceSeq); + if (_Variant?.Any() == true) yield return new KeyValuePair("variant",_Variant); + if (_ObservedSeqElement is not null) yield return new KeyValuePair("observedSeq",_ObservedSeqElement); + if (_Quality?.Any() == true) yield return new KeyValuePair("quality",_Quality); + if (_ReadCoverageElement is not null) yield return new KeyValuePair("readCoverage",_ReadCoverageElement); + if (_Repository?.Any() == true) yield return new KeyValuePair("repository",_Repository); + if (_Pointer?.Any() == true) yield return new KeyValuePair("pointer",_Pointer); + if (_StructureVariant?.Any() == true) yield return new KeyValuePair("structureVariant",_StructureVariant); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Money.cs b/src/Hl7.Fhir.R4B/Model/Generated/Money.cs index 102ad2930..d9889510f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Money.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Money.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -1163,13 +1166,13 @@ public enum Currencies /// [FhirElement("value", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Numerical value (with implicit precision) @@ -1178,13 +1181,10 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } @@ -1196,13 +1196,13 @@ public decimal? Value [DeclaredType(Type = typeof(Code))] [Binding("CurrencyCode")] [DataMember] - public Code CurrencyElement + public Code? CurrencyElement { get { return _CurrencyElement; } set { _CurrencyElement = value; OnPropertyChanged("CurrencyElement"); } } - private Code _CurrencyElement; + private Code? _CurrencyElement; /// /// ISO 4217 Currency Code @@ -1211,29 +1211,22 @@ public Code CurrencyElement [IgnoreDataMember] public Hl7.Fhir.Model.Money.Currencies? Currency { - get { return CurrencyElement != null ? CurrencyElement.Value : null; } + get => _CurrencyElement?.Value; set { - if (value == null) - CurrencyElement = null; - else - CurrencyElement = new Code(value); + CurrencyElement = value is null ? null : new Code(value); OnPropertyChanged("Currency"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Money; - - if (dest == null) - { + if(other is not Money dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); - if(CurrencyElement != null) dest.CurrencyElement = (Code)CurrencyElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); + if(_CurrencyElement is not null) dest.CurrencyElement = (Code)_CurrencyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1245,41 +1238,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Money; - if(otherT == null) return false; + if(other is not Money otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(CurrencyElement, otherT.CurrencyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_CurrencyElement, otherT._CurrencyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "currency": - value = CurrencyElement; - return CurrencyElement is not null; + value = _CurrencyElement; + return _CurrencyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "currency": - CurrencyElement = (Code)value; + CurrencyElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -1290,8 +1283,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (CurrencyElement is not null) yield return new KeyValuePair("currency",CurrencyElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_CurrencyElement is not null) yield return new KeyValuePair("currency",_CurrencyElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs index c32b5bc69..6a1997fa5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -146,13 +149,13 @@ public partial class UniqueIdComponent : Hl7.Fhir.Model.BackboneElement [Binding("NamingSystemIdentifierType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// oid | uuid | uri | other @@ -161,13 +164,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -178,28 +178,25 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type [FhirElement("value", InSummary=true, Order=50, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The unique identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -209,13 +206,13 @@ public string Value /// [FhirElement("preferred", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Is this the id that should be used for this type @@ -224,13 +221,10 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } @@ -240,28 +234,25 @@ public bool? Preferred /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Notes about identifier usage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -271,29 +262,25 @@ public string Comment /// [FhirElement("period", Order=80)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as UniqueIdComponent; - - if (dest == null) - { + if(other is not UniqueIdComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -305,62 +292,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UniqueIdComponent; - if(otherT == null) return false; + if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -371,11 +358,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -386,28 +373,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("name", InSummary=true, Order=90)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this naming system (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -420,13 +404,13 @@ public string Name [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -435,13 +419,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -454,13 +435,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("NamingSystemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// codesystem | identifier | root @@ -469,13 +450,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -486,28 +464,25 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind [FhirElement("date", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -517,28 +492,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=130, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -551,39 +523,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who maintains system namespace?. /// [FhirElement("responsible", Order=150, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString ResponsibleElement + public Hl7.Fhir.Model.FhirString? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirString _ResponsibleElement; + private Hl7.Fhir.Model.FhirString? _ResponsibleElement; /// /// Who maintains system namespace? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Responsible + public string? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirString(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Responsible"); } } @@ -594,41 +563,38 @@ public string Responsible [FhirElement("type", Order=160)] [Binding("IdentifierType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Natural language description of the naming system. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the naming system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -641,11 +607,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for naming system (if applicable). @@ -656,39 +622,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// How/where is it used. /// [FhirElement("usage", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// How/where is it used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -701,35 +664,31 @@ public string Usage [DataMember] public List UniqueId { - get { if(_UniqueId==null) _UniqueId = new List(); return _UniqueId; } + get => _UniqueId ?? new List(); set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } - private List _UniqueId; + private List? _UniqueId; protected internal override void CopyToInternal(Base other) { - var dest = other as NamingSystem; - - if (dest == null) - { + if(other is not NamingSystem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)ResponsibleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(UniqueId.Any()) dest.UniqueId = new List(UniqueId.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)_ResponsibleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_UniqueId is not null) dest.UniqueId = new List(_UniqueId.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -741,118 +700,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NamingSystem; - if(otherT == null) return false; + if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.ListEquals(UniqueId, otherT.UniqueId)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "uniqueId": - value = UniqueId; - return UniqueId?.Any() == true; + value = _UniqueId; + return _UniqueId?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirString)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "uniqueId": - UniqueId = (List)value; + UniqueId = (List?)value!; return this; default: return base.SetValue(key, value); @@ -863,19 +822,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",UniqueId); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",_UniqueId); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs index 12cc33218..827886559 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -85,11 +88,11 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Scheduled frequency of diet. @@ -99,11 +102,11 @@ public List Type [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// Required nutrient modifications. @@ -113,11 +116,11 @@ public List Schedule [DataMember] public List Nutrient { - get { if(_Nutrient==null) _Nutrient = new List(); return _Nutrient; } + get => _Nutrient ?? new List(); set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } - private List _Nutrient; + private List? _Nutrient; /// /// Required texture modifications. @@ -127,11 +130,11 @@ public List Nutrient [DataMember] public List Texture { - get { if(_Texture==null) _Texture = new List(); return _Texture; } + get => _Texture ?? new List(); set { _Texture = value; OnPropertyChanged("Texture"); } } - private List _Texture; + private List? _Texture; /// /// The required consistency of fluids and liquids provided to the patient. @@ -142,59 +145,52 @@ public List Texture [DataMember] public List FluidConsistencyType { - get { if(_FluidConsistencyType==null) _FluidConsistencyType = new List(); return _FluidConsistencyType; } + get => _FluidConsistencyType ?? new List(); set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } - private List _FluidConsistencyType; + private List? _FluidConsistencyType; /// /// Instructions or additional information about the oral diet. /// [FhirElement("instruction", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral diet /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OralDietComponent; - - if (dest == null) - { + if(other is not OralDietComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(Nutrient.Any()) dest.Nutrient = new List(Nutrient.DeepCopyInternal()); - if(Texture.Any()) dest.Texture = new List(Texture.DeepCopyInternal()); - if(FluidConsistencyType.Any()) dest.FluidConsistencyType = new List(FluidConsistencyType.DeepCopyInternal()); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_Nutrient is not null) dest.Nutrient = new List(_Nutrient.DeepCopyInternal()); + if(_Texture is not null) dest.Texture = new List(_Texture.DeepCopyInternal()); + if(_FluidConsistencyType is not null) dest.FluidConsistencyType = new List(_FluidConsistencyType.DeepCopyInternal()); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -206,69 +202,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OralDietComponent; - if(otherT == null) return false; + if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.ListEquals(Nutrient, otherT.Nutrient)) return false; - if(!comparer.ListEquals(Texture, otherT.Texture)) return false; - if(!comparer.ListEquals(FluidConsistencyType, otherT.FluidConsistencyType)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; + if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; + if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "nutrient": - value = Nutrient; - return Nutrient?.Any() == true; + value = _Nutrient; + return _Nutrient?.Any() == true; case "texture": - value = Texture; - return Texture?.Any() == true; + value = _Texture; + return _Texture?.Any() == true; case "fluidConsistencyType": - value = FluidConsistencyType; - return FluidConsistencyType?.Any() == true; + value = _FluidConsistencyType; + return _FluidConsistencyType?.Any() == true; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "nutrient": - Nutrient = (List)value; + Nutrient = (List?)value!; return this; case "texture": - Texture = (List)value; + Texture = (List?)value!; return this; case "fluidConsistencyType": - FluidConsistencyType = (List)value; + FluidConsistencyType = (List?)value!; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -279,12 +275,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",Nutrient); - if (Texture?.Any() == true) yield return new KeyValuePair("texture",Texture); - if (FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",FluidConsistencyType); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",_Nutrient); + if (_Texture?.Any() == true) yield return new KeyValuePair("texture",_Texture); + if (_FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",_FluidConsistencyType); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -311,39 +307,35 @@ public partial class NutrientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40, FiveWs="FiveWs.what[x]")] [Binding("NutrientModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Quantity of the specified nutrient. /// [FhirElement("amount", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as NutrientComponent; - - if (dest == null) - { + if(other is not NutrientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -355,41 +347,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutrientComponent; - if(otherT == null) return false; + if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -400,8 +392,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -428,13 +420,13 @@ public partial class TextureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40)] [Binding("TextureModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Concepts that are used to identify an entity that is ingested for nutritional purposes. @@ -442,26 +434,22 @@ public Hl7.Fhir.Model.CodeableConcept Modifier [FhirElement("foodType", Order=50)] [Binding("TextureModifiedFoodType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FoodType + public Hl7.Fhir.Model.CodeableConcept? FoodType { get { return _FoodType; } set { _FoodType = value; OnPropertyChanged("FoodType"); } } - private Hl7.Fhir.Model.CodeableConcept _FoodType; + private Hl7.Fhir.Model.CodeableConcept? _FoodType; protected internal override void CopyToInternal(Base other) { - var dest = other as TextureComponent; - - if (dest == null) - { + if(other is not TextureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(FoodType != null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)FoodType.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_FoodType is not null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)_FoodType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -473,41 +461,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TextureComponent; - if(otherT == null) return false; + if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(FoodType, otherT.FoodType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "foodType": - value = FoodType; - return FoodType is not null; + value = _FoodType; + return _FoodType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "foodType": - FoodType = (Hl7.Fhir.Model.CodeableConcept)value; + FoodType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -518,8 +506,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (FoodType is not null) yield return new KeyValuePair("foodType",FoodType); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_FoodType is not null) yield return new KeyValuePair("foodType",_FoodType); } } @@ -546,41 +534,38 @@ public partial class SupplementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [Binding("SupplementType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Product or brand name of the nutritional supplement. /// [FhirElement("productName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// Product or brand name of the nutritional supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -593,71 +578,64 @@ public string ProductName [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// Amount of the nutritional supplement. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Instructions or additional information about the oral supplement. /// [FhirElement("instruction", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementComponent; - - if (dest == null) - { + if(other is not SupplementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -669,62 +647,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementComponent; - if(otherT == null) return false; + if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -735,11 +713,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -766,41 +744,38 @@ public partial class EnteralFormulaComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("baseFormulaType", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [Binding("EnteralFormulaType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BaseFormulaType + public Hl7.Fhir.Model.CodeableConcept? BaseFormulaType { get { return _BaseFormulaType; } set { _BaseFormulaType = value; OnPropertyChanged("BaseFormulaType"); } } - private Hl7.Fhir.Model.CodeableConcept _BaseFormulaType; + private Hl7.Fhir.Model.CodeableConcept? _BaseFormulaType; /// /// Product or brand name of the enteral or infant formula. /// [FhirElement("baseFormulaProductName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString BaseFormulaProductNameElement + public Hl7.Fhir.Model.FhirString? BaseFormulaProductNameElement { get { return _BaseFormulaProductNameElement; } set { _BaseFormulaProductNameElement = value; OnPropertyChanged("BaseFormulaProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _BaseFormulaProductNameElement; + private Hl7.Fhir.Model.FhirString? _BaseFormulaProductNameElement; /// /// Product or brand name of the enteral or infant formula /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BaseFormulaProductName + public string? BaseFormulaProductName { - get { return BaseFormulaProductNameElement != null ? BaseFormulaProductNameElement.Value : null; } + get => _BaseFormulaProductNameElement?.Value; set { - if (value == null) - BaseFormulaProductNameElement = null; - else - BaseFormulaProductNameElement = new Hl7.Fhir.Model.FhirString(value); + BaseFormulaProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BaseFormulaProductName"); } } @@ -811,41 +786,38 @@ public string BaseFormulaProductName [FhirElement("additiveType", Order=60, FiveWs="FiveWs.what[x]")] [Binding("EnteralFormulaAdditiveType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdditiveType + public Hl7.Fhir.Model.CodeableConcept? AdditiveType { get { return _AdditiveType; } set { _AdditiveType = value; OnPropertyChanged("AdditiveType"); } } - private Hl7.Fhir.Model.CodeableConcept _AdditiveType; + private Hl7.Fhir.Model.CodeableConcept? _AdditiveType; /// /// Product or brand name of the modular additive. /// [FhirElement("additiveProductName", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString AdditiveProductNameElement + public Hl7.Fhir.Model.FhirString? AdditiveProductNameElement { get { return _AdditiveProductNameElement; } set { _AdditiveProductNameElement = value; OnPropertyChanged("AdditiveProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _AdditiveProductNameElement; + private Hl7.Fhir.Model.FhirString? _AdditiveProductNameElement; /// /// Product or brand name of the modular additive /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AdditiveProductName + public string? AdditiveProductName { - get { return AdditiveProductNameElement != null ? AdditiveProductNameElement.Value : null; } + get => _AdditiveProductNameElement?.Value; set { - if (value == null) - AdditiveProductNameElement = null; - else - AdditiveProductNameElement = new Hl7.Fhir.Model.FhirString(value); + AdditiveProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AdditiveProductName"); } } @@ -855,13 +827,13 @@ public string AdditiveProductName /// [FhirElement("caloricDensity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity CaloricDensity + public Hl7.Fhir.Model.Quantity? CaloricDensity { get { return _CaloricDensity; } set { _CaloricDensity = value; OnPropertyChanged("CaloricDensity"); } } - private Hl7.Fhir.Model.Quantity _CaloricDensity; + private Hl7.Fhir.Model.Quantity? _CaloricDensity; /// /// How the formula should enter the patient's gastrointestinal tract. @@ -869,13 +841,13 @@ public Hl7.Fhir.Model.Quantity CaloricDensity [FhirElement("routeofAdministration", Order=90)] [Binding("EnteralRouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RouteofAdministration + public Hl7.Fhir.Model.CodeableConcept? RouteofAdministration { get { return _RouteofAdministration; } set { _RouteofAdministration = value; OnPropertyChanged("RouteofAdministration"); } } - private Hl7.Fhir.Model.CodeableConcept _RouteofAdministration; + private Hl7.Fhir.Model.CodeableConcept? _RouteofAdministration; /// /// Formula feeding instruction as structured data. @@ -885,75 +857,68 @@ public Hl7.Fhir.Model.CodeableConcept RouteofAdministration [DataMember] public List Administration { - get { if(_Administration==null) _Administration = new List(); return _Administration; } + get => _Administration ?? new List(); set { _Administration = value; OnPropertyChanged("Administration"); } } - private List _Administration; + private List? _Administration; /// /// Upper limit on formula volume per unit of time. /// [FhirElement("maxVolumeToDeliver", Order=110)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxVolumeToDeliver + public Hl7.Fhir.Model.Quantity? MaxVolumeToDeliver { get { return _MaxVolumeToDeliver; } set { _MaxVolumeToDeliver = value; OnPropertyChanged("MaxVolumeToDeliver"); } } - private Hl7.Fhir.Model.Quantity _MaxVolumeToDeliver; + private Hl7.Fhir.Model.Quantity? _MaxVolumeToDeliver; /// /// Formula feeding instructions expressed as text. /// [FhirElement("administrationInstruction", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString AdministrationInstructionElement + public Hl7.Fhir.Model.FhirString? AdministrationInstructionElement { get { return _AdministrationInstructionElement; } set { _AdministrationInstructionElement = value; OnPropertyChanged("AdministrationInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _AdministrationInstructionElement; + private Hl7.Fhir.Model.FhirString? _AdministrationInstructionElement; /// /// Formula feeding instructions expressed as text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AdministrationInstruction + public string? AdministrationInstruction { - get { return AdministrationInstructionElement != null ? AdministrationInstructionElement.Value : null; } + get => _AdministrationInstructionElement?.Value; set { - if (value == null) - AdministrationInstructionElement = null; - else - AdministrationInstructionElement = new Hl7.Fhir.Model.FhirString(value); + AdministrationInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AdministrationInstruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EnteralFormulaComponent; - - if (dest == null) - { + if(other is not EnteralFormulaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(BaseFormulaType != null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)BaseFormulaType.DeepCopyInternal(); - if(BaseFormulaProductNameElement != null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)BaseFormulaProductNameElement.DeepCopyInternal(); - if(AdditiveType != null) dest.AdditiveType = (Hl7.Fhir.Model.CodeableConcept)AdditiveType.DeepCopyInternal(); - if(AdditiveProductNameElement != null) dest.AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)AdditiveProductNameElement.DeepCopyInternal(); - if(CaloricDensity != null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)CaloricDensity.DeepCopyInternal(); - if(RouteofAdministration != null) dest.RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)RouteofAdministration.DeepCopyInternal(); - if(Administration.Any()) dest.Administration = new List(Administration.DeepCopyInternal()); - if(MaxVolumeToDeliver != null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)MaxVolumeToDeliver.DeepCopyInternal(); - if(AdministrationInstructionElement != null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)AdministrationInstructionElement.DeepCopyInternal(); + if(_BaseFormulaType is not null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)_BaseFormulaType.DeepCopyInternal(); + if(_BaseFormulaProductNameElement is not null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)_BaseFormulaProductNameElement.DeepCopyInternal(); + if(_AdditiveType is not null) dest.AdditiveType = (Hl7.Fhir.Model.CodeableConcept)_AdditiveType.DeepCopyInternal(); + if(_AdditiveProductNameElement is not null) dest.AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)_AdditiveProductNameElement.DeepCopyInternal(); + if(_CaloricDensity is not null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)_CaloricDensity.DeepCopyInternal(); + if(_RouteofAdministration is not null) dest.RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)_RouteofAdministration.DeepCopyInternal(); + if(_Administration is not null) dest.Administration = new List(_Administration.DeepCopyInternal()); + if(_MaxVolumeToDeliver is not null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)_MaxVolumeToDeliver.DeepCopyInternal(); + if(_AdministrationInstructionElement is not null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)_AdministrationInstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -965,90 +930,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnteralFormulaComponent; - if(otherT == null) return false; + if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(BaseFormulaType, otherT.BaseFormulaType)) return false; - if(!comparer.Equals(BaseFormulaProductNameElement, otherT.BaseFormulaProductNameElement)) return false; - if(!comparer.Equals(AdditiveType, otherT.AdditiveType)) return false; - if(!comparer.Equals(AdditiveProductNameElement, otherT.AdditiveProductNameElement)) return false; - if(!comparer.Equals(CaloricDensity, otherT.CaloricDensity)) return false; - if(!comparer.Equals(RouteofAdministration, otherT.RouteofAdministration)) return false; - if(!comparer.ListEquals(Administration, otherT.Administration)) return false; - if(!comparer.Equals(MaxVolumeToDeliver, otherT.MaxVolumeToDeliver)) return false; - if(!comparer.Equals(AdministrationInstructionElement, otherT.AdministrationInstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; + if(!comparer.Equals(_AdditiveType, otherT._AdditiveType)) return false; + if(!comparer.Equals(_AdditiveProductNameElement, otherT._AdditiveProductNameElement)) return false; + if(!comparer.Equals(_CaloricDensity, otherT._CaloricDensity)) return false; + if(!comparer.Equals(_RouteofAdministration, otherT._RouteofAdministration)) return false; + if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; + if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; + if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "baseFormulaType": - value = BaseFormulaType; - return BaseFormulaType is not null; + value = _BaseFormulaType; + return _BaseFormulaType is not null; case "baseFormulaProductName": - value = BaseFormulaProductNameElement; - return BaseFormulaProductNameElement is not null; + value = _BaseFormulaProductNameElement; + return _BaseFormulaProductNameElement is not null; case "additiveType": - value = AdditiveType; - return AdditiveType is not null; + value = _AdditiveType; + return _AdditiveType is not null; case "additiveProductName": - value = AdditiveProductNameElement; - return AdditiveProductNameElement is not null; + value = _AdditiveProductNameElement; + return _AdditiveProductNameElement is not null; case "caloricDensity": - value = CaloricDensity; - return CaloricDensity is not null; + value = _CaloricDensity; + return _CaloricDensity is not null; case "routeofAdministration": - value = RouteofAdministration; - return RouteofAdministration is not null; + value = _RouteofAdministration; + return _RouteofAdministration is not null; case "administration": - value = Administration; - return Administration?.Any() == true; + value = _Administration; + return _Administration?.Any() == true; case "maxVolumeToDeliver": - value = MaxVolumeToDeliver; - return MaxVolumeToDeliver is not null; + value = _MaxVolumeToDeliver; + return _MaxVolumeToDeliver is not null; case "administrationInstruction": - value = AdministrationInstructionElement; - return AdministrationInstructionElement is not null; + value = _AdministrationInstructionElement; + return _AdministrationInstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "baseFormulaType": - BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept)value; + BaseFormulaType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "baseFormulaProductName": - BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)value; + BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "additiveType": - AdditiveType = (Hl7.Fhir.Model.CodeableConcept)value; + AdditiveType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additiveProductName": - AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString)value; + AdditiveProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "caloricDensity": - CaloricDensity = (Hl7.Fhir.Model.Quantity)value; + CaloricDensity = (Hl7.Fhir.Model.Quantity?)value; return this; case "routeofAdministration": - RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept)value; + RouteofAdministration = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "administration": - Administration = (List)value; + Administration = (List?)value!; return this; case "maxVolumeToDeliver": - MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)value; + MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity?)value; return this; case "administrationInstruction": - AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString)value; + AdministrationInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1059,15 +1024,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",BaseFormulaType); - if (BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",BaseFormulaProductNameElement); - if (AdditiveType is not null) yield return new KeyValuePair("additiveType",AdditiveType); - if (AdditiveProductNameElement is not null) yield return new KeyValuePair("additiveProductName",AdditiveProductNameElement); - if (CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",CaloricDensity); - if (RouteofAdministration is not null) yield return new KeyValuePair("routeofAdministration",RouteofAdministration); - if (Administration?.Any() == true) yield return new KeyValuePair("administration",Administration); - if (MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",MaxVolumeToDeliver); - if (AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",AdministrationInstructionElement); + if (_BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",_BaseFormulaType); + if (_BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",_BaseFormulaProductNameElement); + if (_AdditiveType is not null) yield return new KeyValuePair("additiveType",_AdditiveType); + if (_AdditiveProductNameElement is not null) yield return new KeyValuePair("additiveProductName",_AdditiveProductNameElement); + if (_CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",_CaloricDensity); + if (_RouteofAdministration is not null) yield return new KeyValuePair("routeofAdministration",_RouteofAdministration); + if (_Administration?.Any() == true) yield return new KeyValuePair("administration",_Administration); + if (_MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",_MaxVolumeToDeliver); + if (_AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",_AdministrationInstructionElement); } } @@ -1094,26 +1059,26 @@ public partial class AdministrationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("schedule", Order=40)] [DataMember] - public Hl7.Fhir.Model.Timing Schedule + public Hl7.Fhir.Model.Timing? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.Timing _Schedule; + private Hl7.Fhir.Model.Timing? _Schedule; /// /// The volume of formula to provide. /// [FhirElement("quantity", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Speed with which the formula is provided per period of time. @@ -1122,27 +1087,23 @@ public Hl7.Fhir.Model.Quantity Quantity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrationComponent; - - if (dest == null) - { + if(other is not AdministrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.Timing)Schedule.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.Timing)_Schedule.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1154,48 +1115,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrationComponent; - if(otherT == null) return false; + if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "schedule": - Schedule = (Hl7.Fhir.Model.Timing)value; + Schedule = (Hl7.Fhir.Model.Timing?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1206,9 +1167,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -1221,11 +1182,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -1235,24 +1196,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1267,24 +1228,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1299,24 +1260,24 @@ public IEnumerable InstantiatesUri [DataMember] public List InstantiatesElement { - get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; } + get => _InstantiatesElement ?? new List(); set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } - private List _InstantiatesElement; + private List? _InstantiatesElement; /// /// Instantiates protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Instantiates + public IEnumerable? Instantiates { - get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; } + get => _InstantiatesElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesElement = null; + InstantiatesElement = null!; else InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Instantiates"); @@ -1331,13 +1292,13 @@ public IEnumerable Instantiates [Binding("NutritionOrderStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -1346,13 +1307,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1365,13 +1323,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("NutritiionOrderIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -1380,13 +1338,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1399,13 +1354,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// The encounter associated with this nutrition order. @@ -1414,13 +1369,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Date and time the nutrition order was requested. @@ -1428,28 +1383,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("dateTime", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateTimeElement + public Hl7.Fhir.Model.FhirDateTime? DateTimeElement { get { return _DateTimeElement; } set { _DateTimeElement = value; OnPropertyChanged("DateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _DateTimeElement; /// /// Date and time the nutrition order was requested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateTime + public string? DateTime { - get { return DateTimeElement != null ? DateTimeElement.Value : null; } + get => _DateTimeElement?.Value; set { - if (value == null) - DateTimeElement = null; - else - DateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateTime"); } } @@ -1461,13 +1413,13 @@ public string DateTime [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Orderer + public Hl7.Fhir.Model.ResourceReference? Orderer { get { return _Orderer; } set { _Orderer = value; OnPropertyChanged("Orderer"); } } - private Hl7.Fhir.Model.ResourceReference _Orderer; + private Hl7.Fhir.Model.ResourceReference? _Orderer; /// /// List of the patient's food and nutrition-related allergies and intolerances. @@ -1479,11 +1431,11 @@ public Hl7.Fhir.Model.ResourceReference Orderer [DataMember] public List AllergyIntolerance { - get { if(_AllergyIntolerance==null) _AllergyIntolerance = new List(); return _AllergyIntolerance; } + get => _AllergyIntolerance ?? new List(); set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } - private List _AllergyIntolerance; + private List? _AllergyIntolerance; /// /// Order-specific modifier about the type of food that should be given. @@ -1494,11 +1446,11 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get { if(_FoodPreferenceModifier==null) _FoodPreferenceModifier = new List(); return _FoodPreferenceModifier; } + get => _FoodPreferenceModifier ?? new List(); set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } - private List _FoodPreferenceModifier; + private List? _FoodPreferenceModifier; /// /// Order-specific modifier about the type of food that should not be given. @@ -1509,24 +1461,24 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get { if(_ExcludeFoodModifier==null) _ExcludeFoodModifier = new List(); return _ExcludeFoodModifier; } + get => _ExcludeFoodModifier ?? new List(); set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } - private List _ExcludeFoodModifier; + private List? _ExcludeFoodModifier; /// /// Oral diet components. /// [FhirElement("oralDiet", Order=220)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet + public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet { get { return _OralDiet; } set { _OralDiet = value; OnPropertyChanged("OralDiet"); } } - private Hl7.Fhir.Model.NutritionOrder.OralDietComponent _OralDiet; + private Hl7.Fhir.Model.NutritionOrder.OralDietComponent? _OralDiet; /// /// Supplement components. @@ -1536,24 +1488,24 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet [DataMember] public List Supplement { - get { if(_Supplement==null) _Supplement = new List(); return _Supplement; } + get => _Supplement ?? new List(); set { _Supplement = value; OnPropertyChanged("Supplement"); } } - private List _Supplement; + private List? _Supplement; /// /// Enteral formula components. /// [FhirElement("enteralFormula", Order=240)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent EnteralFormula + public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? EnteralFormula { get { return _EnteralFormula; } set { _EnteralFormula = value; OnPropertyChanged("EnteralFormula"); } } - private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent _EnteralFormula; + private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? _EnteralFormula; /// /// Comments. @@ -1563,41 +1515,37 @@ public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent EnteralFormula [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as NutritionOrder; - - if (dest == null) - { + if(other is not NutritionOrder dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateTimeElement != null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopyInternal(); - if(Orderer != null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)Orderer.DeepCopyInternal(); - if(AllergyIntolerance.Any()) dest.AllergyIntolerance = new List(AllergyIntolerance.DeepCopyInternal()); - if(FoodPreferenceModifier.Any()) dest.FoodPreferenceModifier = new List(FoodPreferenceModifier.DeepCopyInternal()); - if(ExcludeFoodModifier.Any()) dest.ExcludeFoodModifier = new List(ExcludeFoodModifier.DeepCopyInternal()); - if(OralDiet != null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)OralDiet.DeepCopyInternal(); - if(Supplement.Any()) dest.Supplement = new List(Supplement.DeepCopyInternal()); - if(EnteralFormula != null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)EnteralFormula.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_InstantiatesElement is not null) dest.InstantiatesElement = new List(_InstantiatesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateTimeElement is not null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_DateTimeElement.DeepCopyInternal(); + if(_Orderer is not null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)_Orderer.DeepCopyInternal(); + if(_AllergyIntolerance is not null) dest.AllergyIntolerance = new List(_AllergyIntolerance.DeepCopyInternal()); + if(_FoodPreferenceModifier is not null) dest.FoodPreferenceModifier = new List(_FoodPreferenceModifier.DeepCopyInternal()); + if(_ExcludeFoodModifier is not null) dest.ExcludeFoodModifier = new List(_ExcludeFoodModifier.DeepCopyInternal()); + if(_OralDiet is not null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)_OralDiet.DeepCopyInternal(); + if(_Supplement is not null) dest.Supplement = new List(_Supplement.DeepCopyInternal()); + if(_EnteralFormula is not null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)_EnteralFormula.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1609,146 +1557,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutritionOrder; - if(otherT == null) return false; + if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(InstantiatesElement, otherT.InstantiatesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateTimeElement, otherT.DateTimeElement)) return false; - if(!comparer.Equals(Orderer, otherT.Orderer)) return false; - if(!comparer.ListEquals(AllergyIntolerance, otherT.AllergyIntolerance)) return false; - if(!comparer.ListEquals(FoodPreferenceModifier, otherT.FoodPreferenceModifier)) return false; - if(!comparer.ListEquals(ExcludeFoodModifier, otherT.ExcludeFoodModifier)) return false; - if(!comparer.Equals(OralDiet, otherT.OralDiet)) return false; - if(!comparer.ListEquals(Supplement, otherT.Supplement)) return false; - if(!comparer.Equals(EnteralFormula, otherT.EnteralFormula)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateTimeElement, otherT._DateTimeElement)) return false; + if(!comparer.Equals(_Orderer, otherT._Orderer)) return false; + if(!comparer.ListEquals(_AllergyIntolerance, otherT._AllergyIntolerance)) return false; + if(!comparer.ListEquals(_FoodPreferenceModifier, otherT._FoodPreferenceModifier)) return false; + if(!comparer.ListEquals(_ExcludeFoodModifier, otherT._ExcludeFoodModifier)) return false; + if(!comparer.Equals(_OralDiet, otherT._OralDiet)) return false; + if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; + if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "instantiates": - value = InstantiatesElement; - return InstantiatesElement?.Any() == true; + value = _InstantiatesElement; + return _InstantiatesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "dateTime": - value = DateTimeElement; - return DateTimeElement is not null; + value = _DateTimeElement; + return _DateTimeElement is not null; case "orderer": - value = Orderer; - return Orderer is not null; + value = _Orderer; + return _Orderer is not null; case "allergyIntolerance": - value = AllergyIntolerance; - return AllergyIntolerance?.Any() == true; + value = _AllergyIntolerance; + return _AllergyIntolerance?.Any() == true; case "foodPreferenceModifier": - value = FoodPreferenceModifier; - return FoodPreferenceModifier?.Any() == true; + value = _FoodPreferenceModifier; + return _FoodPreferenceModifier?.Any() == true; case "excludeFoodModifier": - value = ExcludeFoodModifier; - return ExcludeFoodModifier?.Any() == true; + value = _ExcludeFoodModifier; + return _ExcludeFoodModifier?.Any() == true; case "oralDiet": - value = OralDiet; - return OralDiet is not null; + value = _OralDiet; + return _OralDiet is not null; case "supplement": - value = Supplement; - return Supplement?.Any() == true; + value = _Supplement; + return _Supplement?.Any() == true; case "enteralFormula": - value = EnteralFormula; - return EnteralFormula is not null; + value = _EnteralFormula; + return _EnteralFormula is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "instantiates": - InstantiatesElement = (List)value; + InstantiatesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateTime": - DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "orderer": - Orderer = (Hl7.Fhir.Model.ResourceReference)value; + Orderer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "allergyIntolerance": - AllergyIntolerance = (List)value; + AllergyIntolerance = (List?)value!; return this; case "foodPreferenceModifier": - FoodPreferenceModifier = (List)value; + FoodPreferenceModifier = (List?)value!; return this; case "excludeFoodModifier": - ExcludeFoodModifier = (List)value; + ExcludeFoodModifier = (List?)value!; return this; case "oralDiet": - OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)value; + OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent?)value; return this; case "supplement": - Supplement = (List)value; + Supplement = (List?)value!; return this; case "enteralFormula": - EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)value; + EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1759,23 +1707,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",InstantiatesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateTimeElement is not null) yield return new KeyValuePair("dateTime",DateTimeElement); - if (Orderer is not null) yield return new KeyValuePair("orderer",Orderer); - if (AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",AllergyIntolerance); - if (FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",FoodPreferenceModifier); - if (ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",ExcludeFoodModifier); - if (OralDiet is not null) yield return new KeyValuePair("oralDiet",OralDiet); - if (Supplement?.Any() == true) yield return new KeyValuePair("supplement",Supplement); - if (EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",EnteralFormula); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",_InstantiatesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateTimeElement is not null) yield return new KeyValuePair("dateTime",_DateTimeElement); + if (_Orderer is not null) yield return new KeyValuePair("orderer",_Orderer); + if (_AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",_AllergyIntolerance); + if (_FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",_FoodPreferenceModifier); + if (_ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",_ExcludeFoodModifier); + if (_OralDiet is not null) yield return new KeyValuePair("oralDiet",_OralDiet); + if (_Supplement?.Any() == true) yield return new KeyValuePair("supplement",_Supplement); + if (_EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",_EnteralFormula); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs b/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs index 704b911c7..1e684ab32 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,13 +112,13 @@ public partial class NutrientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", Order=40)] [Binding("NutritionProductNutrient")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// The amount of nutrient expressed in one or more units: X per pack / per serving / per dose. @@ -125,24 +128,20 @@ public Hl7.Fhir.Model.CodeableReference Item [DataMember] public List Amount { - get { if(_Amount==null) _Amount = new List(); return _Amount; } + get => _Amount ?? new List(); set { _Amount = value; OnPropertyChanged("Amount"); } } - private List _Amount; + private List? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as NutrientComponent; - - if (dest == null) - { + if(other is not NutrientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Amount.Any()) dest.Amount = new List(Amount.DeepCopyInternal()); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = new List(_Amount.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -154,41 +153,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutrientComponent; - if(otherT == null) return false; + if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "amount": - value = Amount; - return Amount?.Any() == true; + value = _Amount; + return _Amount?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "amount": - Amount = (List)value; + Amount = (List?)value!; return this; default: return base.SetValue(key, value); @@ -199,8 +198,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Amount?.Any() == true) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Amount?.Any() == true) yield return new KeyValuePair("amount",_Amount); } } @@ -224,13 +223,13 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// The amount of ingredient that is in the product. @@ -240,24 +239,20 @@ public Hl7.Fhir.Model.CodeableReference Item [DataMember] public List Amount { - get { if(_Amount==null) _Amount = new List(); return _Amount; } + get => _Amount ?? new List(); set { _Amount = value; OnPropertyChanged("Amount"); } } - private List _Amount; + private List? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Amount.Any()) dest.Amount = new List(Amount.DeepCopyInternal()); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = new List(_Amount.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -269,41 +264,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "amount": - value = Amount; - return Amount?.Any() == true; + value = _Amount; + return _Amount?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "amount": - Amount = (List)value; + Amount = (List?)value!; return this; default: return base.SetValue(key, value); @@ -314,8 +309,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Amount?.Any() == true) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Amount?.Any() == true) yield return new KeyValuePair("amount",_Amount); } } @@ -340,13 +335,13 @@ public partial class ProductCharacteristicComponent : Hl7.Fhir.Model.BackboneEle [Binding("PropertyCharacteristic")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The value of the characteristic. @@ -356,26 +351,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.FhirBoolean))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ProductCharacteristicComponent; - - if (dest == null) - { + if(other is not ProductCharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -387,41 +378,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProductCharacteristicComponent; - if(otherT == null) return false; + if(other is not ProductCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -432,8 +423,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -459,13 +450,13 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The identifier for the physical instance, typically a serial number. @@ -475,39 +466,36 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The identification of the batch or lot of the product. /// [FhirElement("lotNumber", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// The identification of the batch or lot of the product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -517,28 +505,25 @@ public string LotNumber /// [FhirElement("expiry", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpiryElement + public Hl7.Fhir.Model.FhirDateTime? ExpiryElement { get { return _ExpiryElement; } set { _ExpiryElement = value; OnPropertyChanged("ExpiryElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpiryElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpiryElement; /// /// The expiry date or date and time for the product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expiry + public string? Expiry { - get { return ExpiryElement != null ? ExpiryElement.Value : null; } + get => _ExpiryElement?.Value; set { - if (value == null) - ExpiryElement = null; - else - ExpiryElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpiryElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Expiry"); } } @@ -548,47 +533,40 @@ public string Expiry /// [FhirElement("useBy", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime UseByElement + public Hl7.Fhir.Model.FhirDateTime? UseByElement { get { return _UseByElement; } set { _UseByElement = value; OnPropertyChanged("UseByElement"); } } - private Hl7.Fhir.Model.FhirDateTime _UseByElement; + private Hl7.Fhir.Model.FhirDateTime? _UseByElement; /// /// The date until which the product is expected to be good for consumption /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string UseBy + public string? UseBy { - get { return UseByElement != null ? UseByElement.Value : null; } + get => _UseByElement?.Value; set { - if (value == null) - UseByElement = null; - else - UseByElement = new Hl7.Fhir.Model.FhirDateTime(value); + UseByElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("UseBy"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpiryElement != null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)ExpiryElement.DeepCopyInternal(); - if(UseByElement != null) dest.UseByElement = (Hl7.Fhir.Model.FhirDateTime)UseByElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpiryElement is not null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)_ExpiryElement.DeepCopyInternal(); + if(_UseByElement is not null) dest.UseByElement = (Hl7.Fhir.Model.FhirDateTime)_UseByElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -600,62 +578,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpiryElement, otherT.ExpiryElement)) return false; - if(!comparer.Equals(UseByElement, otherT.UseByElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; + if(!comparer.Equals(_UseByElement, otherT._UseByElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expiry": - value = ExpiryElement; - return ExpiryElement is not null; + value = _ExpiryElement; + return _ExpiryElement is not null; case "useBy": - value = UseByElement; - return UseByElement is not null; + value = _UseByElement; + return _UseByElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expiry": - ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpiryElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "useBy": - UseByElement = (Hl7.Fhir.Model.FhirDateTime)value; + UseByElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -666,11 +644,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpiryElement is not null) yield return new KeyValuePair("expiry",ExpiryElement); - if (UseByElement is not null) yield return new KeyValuePair("useBy",UseByElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpiryElement is not null) yield return new KeyValuePair("expiry",_ExpiryElement); + if (_UseByElement is not null) yield return new KeyValuePair("useBy",_UseByElement); } } @@ -683,13 +661,13 @@ public override IEnumerable> EnumerateElements() [Binding("NutritionProductStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -698,13 +676,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.NutritionProduct.NutritionProductStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -718,11 +693,11 @@ public Hl7.Fhir.Model.NutritionProduct.NutritionProductStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// A code designating a specific type of nutritional product. @@ -730,13 +705,13 @@ public List Category [FhirElement("code", InSummary=true, Order=110, FiveWs="FiveWs.identifier")] [Binding("NutritionProductCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Manufacturer, representative or officially responsible for the product. @@ -748,11 +723,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// The product's nutritional information expressed by the nutrients. @@ -762,11 +737,11 @@ public List Manufacturer [DataMember] public List Nutrient { - get { if(_Nutrient==null) _Nutrient = new List(); return _Nutrient; } + get => _Nutrient ?? new List(); set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } - private List _Nutrient; + private List? _Nutrient; /// /// Ingredients contained in this product. @@ -776,11 +751,11 @@ public List Nutrient [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Known or suspected allergens that are a part of this product. @@ -791,11 +766,11 @@ public List Ingredient [DataMember] public List KnownAllergen { - get { if(_KnownAllergen==null) _KnownAllergen = new List(); return _KnownAllergen; } + get => _KnownAllergen ?? new List(); set { _KnownAllergen = value; OnPropertyChanged("KnownAllergen"); } } - private List _KnownAllergen; + private List? _KnownAllergen; /// /// Specifies descriptive properties of the nutrition product. @@ -805,24 +780,24 @@ public List KnownAllergen [DataMember] public List ProductCharacteristic { - get { if(_ProductCharacteristic==null) _ProductCharacteristic = new List(); return _ProductCharacteristic; } + get => _ProductCharacteristic ?? new List(); set { _ProductCharacteristic = value; OnPropertyChanged("ProductCharacteristic"); } } - private List _ProductCharacteristic; + private List? _ProductCharacteristic; /// /// One or several physical instances or occurrences of the nutrition product. /// [FhirElement("instance", Order=170)] [DataMember] - public Hl7.Fhir.Model.NutritionProduct.InstanceComponent Instance + public Hl7.Fhir.Model.NutritionProduct.InstanceComponent? Instance { get { return _Instance; } set { _Instance = value; OnPropertyChanged("Instance"); } } - private Hl7.Fhir.Model.NutritionProduct.InstanceComponent _Instance; + private Hl7.Fhir.Model.NutritionProduct.InstanceComponent? _Instance; /// /// Comments made about the product. @@ -832,32 +807,28 @@ public Hl7.Fhir.Model.NutritionProduct.InstanceComponent Instance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as NutritionProduct; - - if (dest == null) - { + if(other is not NutritionProduct dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Nutrient.Any()) dest.Nutrient = new List(Nutrient.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(KnownAllergen.Any()) dest.KnownAllergen = new List(KnownAllergen.DeepCopyInternal()); - if(ProductCharacteristic.Any()) dest.ProductCharacteristic = new List(ProductCharacteristic.DeepCopyInternal()); - if(Instance != null) dest.Instance = (Hl7.Fhir.Model.NutritionProduct.InstanceComponent)Instance.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Nutrient is not null) dest.Nutrient = new List(_Nutrient.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_KnownAllergen is not null) dest.KnownAllergen = new List(_KnownAllergen.DeepCopyInternal()); + if(_ProductCharacteristic is not null) dest.ProductCharacteristic = new List(_ProductCharacteristic.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = (Hl7.Fhir.Model.NutritionProduct.InstanceComponent)_Instance.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -869,97 +840,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutritionProduct; - if(otherT == null) return false; + if(other is not NutritionProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Nutrient, otherT.Nutrient)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(KnownAllergen, otherT.KnownAllergen)) return false; - if(!comparer.ListEquals(ProductCharacteristic, otherT.ProductCharacteristic)) return false; - if(!comparer.Equals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_KnownAllergen, otherT._KnownAllergen)) return false; + if(!comparer.ListEquals(_ProductCharacteristic, otherT._ProductCharacteristic)) return false; + if(!comparer.Equals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "nutrient": - value = Nutrient; - return Nutrient?.Any() == true; + value = _Nutrient; + return _Nutrient?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "knownAllergen": - value = KnownAllergen; - return KnownAllergen?.Any() == true; + value = _KnownAllergen; + return _KnownAllergen?.Any() == true; case "productCharacteristic": - value = ProductCharacteristic; - return ProductCharacteristic?.Any() == true; + value = _ProductCharacteristic; + return _ProductCharacteristic?.Any() == true; case "instance": - value = Instance; - return Instance is not null; + value = _Instance; + return _Instance is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "nutrient": - Nutrient = (List)value; + Nutrient = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "knownAllergen": - KnownAllergen = (List)value; + KnownAllergen = (List?)value!; return this; case "productCharacteristic": - ProductCharacteristic = (List)value; + ProductCharacteristic = (List?)value!; return this; case "instance": - Instance = (Hl7.Fhir.Model.NutritionProduct.InstanceComponent)value; + Instance = (Hl7.Fhir.Model.NutritionProduct.InstanceComponent?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -970,16 +941,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",Nutrient); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (KnownAllergen?.Any() == true) yield return new KeyValuePair("knownAllergen",KnownAllergen); - if (ProductCharacteristic?.Any() == true) yield return new KeyValuePair("productCharacteristic",ProductCharacteristic); - if (Instance is not null) yield return new KeyValuePair("instance",Instance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",_Nutrient); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_KnownAllergen?.Any() == true) yield return new KeyValuePair("knownAllergen",_KnownAllergen); + if (_ProductCharacteristic?.Any() == true) yield return new KeyValuePair("productCharacteristic",_ProductCharacteristic); + if (_Instance is not null) yield return new KeyValuePair("instance",_Instance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs index da9eee6f5..d516d3cd4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,26 +85,26 @@ public partial class ReferenceRangeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("low", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Low + public Hl7.Fhir.Model.Quantity? Low { get { return _Low; } set { _Low = value; OnPropertyChanged("Low"); } } - private Hl7.Fhir.Model.Quantity _Low; + private Hl7.Fhir.Model.Quantity? _Low; /// /// High Range, if relevant. /// [FhirElement("high", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity High + public Hl7.Fhir.Model.Quantity? High { get { return _High; } set { _High = value; OnPropertyChanged("High"); } } - private Hl7.Fhir.Model.Quantity _High; + private Hl7.Fhir.Model.Quantity? _High; /// /// Reference range qualifier. @@ -109,13 +112,13 @@ public Hl7.Fhir.Model.Quantity High [FhirElement("type", Order=60)] [Binding("ObservationRangeMeaning")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Reference range population. @@ -126,72 +129,65 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List AppliesTo { - get { if(_AppliesTo==null) _AppliesTo = new List(); return _AppliesTo; } + get => _AppliesTo ?? new List(); set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } - private List _AppliesTo; + private List? _AppliesTo; /// /// Applicable age range, if relevant. /// [FhirElement("age", Order=80)] [DataMember] - public Hl7.Fhir.Model.Range Age + public Hl7.Fhir.Model.Range? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.Range _Age; + private Hl7.Fhir.Model.Range? _Age; /// /// Text based reference range in an observation. /// [FhirElement("text", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text based reference range in an observation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceRangeComponent; - - if (dest == null) - { + if(other is not ReferenceRangeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Low != null) dest.Low = (Hl7.Fhir.Model.Quantity)Low.DeepCopyInternal(); - if(High != null) dest.High = (Hl7.Fhir.Model.Quantity)High.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AppliesTo.Any()) dest.AppliesTo = new List(AppliesTo.DeepCopyInternal()); - if(Age != null) dest.Age = (Hl7.Fhir.Model.Range)Age.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Low is not null) dest.Low = (Hl7.Fhir.Model.Quantity)_Low.DeepCopyInternal(); + if(_High is not null) dest.High = (Hl7.Fhir.Model.Quantity)_High.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AppliesTo is not null) dest.AppliesTo = new List(_AppliesTo.DeepCopyInternal()); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.Range)_Age.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -203,69 +199,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceRangeComponent; - if(otherT == null) return false; + if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Low, otherT.Low)) return false; - if(!comparer.Equals(High, otherT.High)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(AppliesTo, otherT.AppliesTo)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + if(!comparer.Equals(_High, otherT._High)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "low": - value = Low; - return Low is not null; + value = _Low; + return _Low is not null; case "high": - value = High; - return High is not null; + value = _High; + return _High is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "appliesTo": - value = AppliesTo; - return AppliesTo?.Any() == true; + value = _AppliesTo; + return _AppliesTo?.Any() == true; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "low": - Low = (Hl7.Fhir.Model.Quantity)value; + Low = (Hl7.Fhir.Model.Quantity?)value; return this; case "high": - High = (Hl7.Fhir.Model.Quantity)value; + High = (Hl7.Fhir.Model.Quantity?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "appliesTo": - AppliesTo = (List)value; + AppliesTo = (List?)value!; return this; case "age": - Age = (Hl7.Fhir.Model.Range)value; + Age = (Hl7.Fhir.Model.Range?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -276,12 +272,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Low is not null) yield return new KeyValuePair("low",Low); - if (High is not null) yield return new KeyValuePair("high",High); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",AppliesTo); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Low is not null) yield return new KeyValuePair("low",_Low); + if (_High is not null) yield return new KeyValuePair("high",_High); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",_AppliesTo); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -310,13 +306,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Actual component result. @@ -325,13 +321,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the component result is missing. @@ -339,13 +335,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=60)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -356,11 +352,11 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [DataMember] public List Interpretation { - get { if(_Interpretation==null) _Interpretation = new List(); return _Interpretation; } + get => _Interpretation ?? new List(); set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private List _Interpretation; + private List? _Interpretation; /// /// Provides guide for interpretation of component result. @@ -370,27 +366,23 @@ public List Interpretation [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation.Any()) dest.Interpretation = new List(Interpretation.DeepCopyInternal()); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = new List(_Interpretation.DeepCopyInternal()); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -402,62 +394,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.ListEquals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation?.Any() == true; + value = _Interpretation; + return _Interpretation?.Any() == true; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (List)value; + Interpretation = (List?)value!; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; default: return base.SetValue(key, value); @@ -468,11 +460,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",Interpretation); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",_Interpretation); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); } } @@ -485,11 +477,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -501,11 +493,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -517,11 +509,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// registered | preliminary | final | amended +. @@ -531,13 +523,13 @@ public List PartOf [Binding("ObservationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -546,13 +538,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -566,11 +555,11 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of observation (code / type). @@ -579,13 +568,13 @@ public List Category [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who and/or what the observation is about. @@ -594,13 +583,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location","Organization","Procedure","Practitioner","Medication","Substance")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// What the observation is about, when it is not about the subject of record. @@ -612,11 +601,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Healthcare event during which this observation is made. @@ -625,13 +614,13 @@ public List Focus [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Clinically relevant time/time-period for observation. @@ -640,26 +629,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Instant))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// Date/Time this version was made available. /// [FhirElement("issued", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// Date/Time this version was made available @@ -668,13 +657,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -689,11 +675,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Actual result. @@ -702,13 +688,13 @@ public List Performer [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the result is missing. @@ -716,13 +702,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=220)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -733,11 +719,11 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [DataMember] public List Interpretation { - get { if(_Interpretation==null) _Interpretation = new List(); return _Interpretation; } + get => _Interpretation ?? new List(); set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private List _Interpretation; + private List? _Interpretation; /// /// Comments about the observation. @@ -747,11 +733,11 @@ public List Interpretation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Observed body part. @@ -759,13 +745,13 @@ public List Note [FhirElement("bodySite", Order=250)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// How it was done. @@ -773,13 +759,13 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [FhirElement("method", Order=260)] [Binding("ObservationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Specimen used for this observation. @@ -788,13 +774,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [CLSCompliant(false)] [References("Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// (Measurement) Device. @@ -803,13 +789,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Provides guide for interpretation. @@ -819,11 +805,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; /// /// Related resource that belongs to the Observation group. @@ -835,11 +821,11 @@ public List ReferenceRange [DataMember] public List HasMember { - get { if(_HasMember==null) _HasMember = new List(); return _HasMember; } + get => _HasMember ?? new List(); set { _HasMember = value; OnPropertyChanged("HasMember"); } } - private List _HasMember; + private List? _HasMember; /// /// Related measurements the observation is made from. @@ -851,11 +837,11 @@ public List HasMember [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// Component results. @@ -865,48 +851,44 @@ public List DerivedFrom [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Observation; - - if (dest == null) - { + if(other is not Observation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation.Any()) dest.Interpretation = new List(Interpretation.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); - if(HasMember.Any()) dest.HasMember = new List(HasMember.DeepCopyInternal()); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = new List(_Interpretation.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); + if(_HasMember is not null) dest.HasMember = new List(_HasMember.DeepCopyInternal()); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -918,195 +900,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Observation; - if(otherT == null) return false; + if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.ListEquals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; - if(!comparer.ListEquals(HasMember, otherT.HasMember)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; + if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation?.Any() == true; + value = _Interpretation; + return _Interpretation?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; case "hasMember": - value = HasMember; - return HasMember?.Any() == true; + value = _HasMember; + return _HasMember?.Any() == true; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (List)value; + Interpretation = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; case "hasMember": - HasMember = (List)value; + HasMember = (List?)value!; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1117,30 +1099,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",Interpretation); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); - if (HasMember?.Any() == true) yield return new KeyValuePair("hasMember",HasMember); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",_Interpretation); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); + if (_HasMember?.Any() == true) yield return new KeyValuePair("hasMember",_HasMember); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs index e1ed8266a..7b7fcbbe0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -186,13 +189,13 @@ public partial class QuantitativeDetailsComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("customaryUnit", Order=40)] [Binding("ObservationUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CustomaryUnit + public Hl7.Fhir.Model.CodeableConcept? CustomaryUnit { get { return _CustomaryUnit; } set { _CustomaryUnit = value; OnPropertyChanged("CustomaryUnit"); } } - private Hl7.Fhir.Model.CodeableConcept _CustomaryUnit; + private Hl7.Fhir.Model.CodeableConcept? _CustomaryUnit; /// /// SI unit for quantitative results. @@ -200,26 +203,26 @@ public Hl7.Fhir.Model.CodeableConcept CustomaryUnit [FhirElement("unit", Order=50)] [Binding("ObservationUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// SI to Customary unit conversion factor. /// [FhirElement("conversionFactor", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ConversionFactorElement + public Hl7.Fhir.Model.FhirDecimal? ConversionFactorElement { get { return _ConversionFactorElement; } set { _ConversionFactorElement = value; OnPropertyChanged("ConversionFactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ConversionFactorElement; + private Hl7.Fhir.Model.FhirDecimal? _ConversionFactorElement; /// /// SI to Customary unit conversion factor @@ -228,13 +231,10 @@ public Hl7.Fhir.Model.FhirDecimal ConversionFactorElement [IgnoreDataMember] public decimal? ConversionFactor { - get { return ConversionFactorElement != null ? ConversionFactorElement.Value : null; } + get => _ConversionFactorElement?.Value; set { - if (value == null) - ConversionFactorElement = null; - else - ConversionFactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + ConversionFactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("ConversionFactor"); } } @@ -244,13 +244,13 @@ public decimal? ConversionFactor /// [FhirElement("decimalPrecision", Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer DecimalPrecisionElement + public Hl7.Fhir.Model.Integer? DecimalPrecisionElement { get { return _DecimalPrecisionElement; } set { _DecimalPrecisionElement = value; OnPropertyChanged("DecimalPrecisionElement"); } } - private Hl7.Fhir.Model.Integer _DecimalPrecisionElement; + private Hl7.Fhir.Model.Integer? _DecimalPrecisionElement; /// /// Decimal precision of observation quantitative results @@ -259,31 +259,24 @@ public Hl7.Fhir.Model.Integer DecimalPrecisionElement [IgnoreDataMember] public int? DecimalPrecision { - get { return DecimalPrecisionElement != null ? DecimalPrecisionElement.Value : null; } + get => _DecimalPrecisionElement?.Value; set { - if (value == null) - DecimalPrecisionElement = null; - else - DecimalPrecisionElement = new Hl7.Fhir.Model.Integer(value); + DecimalPrecisionElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("DecimalPrecision"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QuantitativeDetailsComponent; - - if (dest == null) - { + if(other is not QuantitativeDetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CustomaryUnit != null) dest.CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept)CustomaryUnit.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(ConversionFactorElement != null) dest.ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal)ConversionFactorElement.DeepCopyInternal(); - if(DecimalPrecisionElement != null) dest.DecimalPrecisionElement = (Hl7.Fhir.Model.Integer)DecimalPrecisionElement.DeepCopyInternal(); + if(_CustomaryUnit is not null) dest.CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept)_CustomaryUnit.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_ConversionFactorElement is not null) dest.ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal)_ConversionFactorElement.DeepCopyInternal(); + if(_DecimalPrecisionElement is not null) dest.DecimalPrecisionElement = (Hl7.Fhir.Model.Integer)_DecimalPrecisionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -295,55 +288,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QuantitativeDetailsComponent; - if(otherT == null) return false; + if(other is not QuantitativeDetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CustomaryUnit, otherT.CustomaryUnit)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(ConversionFactorElement, otherT.ConversionFactorElement)) return false; - if(!comparer.Equals(DecimalPrecisionElement, otherT.DecimalPrecisionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CustomaryUnit, otherT._CustomaryUnit)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_ConversionFactorElement, otherT._ConversionFactorElement)) return false; + if(!comparer.Equals(_DecimalPrecisionElement, otherT._DecimalPrecisionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "customaryUnit": - value = CustomaryUnit; - return CustomaryUnit is not null; + value = _CustomaryUnit; + return _CustomaryUnit is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "conversionFactor": - value = ConversionFactorElement; - return ConversionFactorElement is not null; + value = _ConversionFactorElement; + return _ConversionFactorElement is not null; case "decimalPrecision": - value = DecimalPrecisionElement; - return DecimalPrecisionElement is not null; + value = _DecimalPrecisionElement; + return _DecimalPrecisionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "customaryUnit": - CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept)value; + CustomaryUnit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "conversionFactor": - ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + ConversionFactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "decimalPrecision": - DecimalPrecisionElement = (Hl7.Fhir.Model.Integer)value; + DecimalPrecisionElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -354,10 +347,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CustomaryUnit is not null) yield return new KeyValuePair("customaryUnit",CustomaryUnit); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (ConversionFactorElement is not null) yield return new KeyValuePair("conversionFactor",ConversionFactorElement); - if (DecimalPrecisionElement is not null) yield return new KeyValuePair("decimalPrecision",DecimalPrecisionElement); + if (_CustomaryUnit is not null) yield return new KeyValuePair("customaryUnit",_CustomaryUnit); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_ConversionFactorElement is not null) yield return new KeyValuePair("conversionFactor",_ConversionFactorElement); + if (_DecimalPrecisionElement is not null) yield return new KeyValuePair("decimalPrecision",_DecimalPrecisionElement); } } @@ -385,13 +378,13 @@ public partial class QualifiedIntervalComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ObservationRangeCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// reference | critical | absolute @@ -400,13 +393,10 @@ public Code Categ [IgnoreDataMember] public Hl7.Fhir.Model.ObservationDefinition.ObservationRangeCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -416,13 +406,13 @@ public Hl7.Fhir.Model.ObservationDefinition.ObservationRangeCategory? Category /// [FhirElement("range", Order=50)] [DataMember] - public Hl7.Fhir.Model.Range Range + public Hl7.Fhir.Model.Range? Range { get { return _Range; } set { _Range = value; OnPropertyChanged("Range"); } } - private Hl7.Fhir.Model.Range _Range; + private Hl7.Fhir.Model.Range? _Range; /// /// Range context qualifier. @@ -430,13 +420,13 @@ public Hl7.Fhir.Model.Range Range [FhirElement("context", Order=60)] [Binding("ObservationRangeMeaning")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Context + public Hl7.Fhir.Model.CodeableConcept? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.CodeableConcept _Context; + private Hl7.Fhir.Model.CodeableConcept? _Context; /// /// Targetted population of the range. @@ -447,11 +437,11 @@ public Hl7.Fhir.Model.CodeableConcept Context [DataMember] public List AppliesTo { - get { if(_AppliesTo==null) _AppliesTo = new List(); return _AppliesTo; } + get => _AppliesTo ?? new List(); set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } - private List _AppliesTo; + private List? _AppliesTo; /// /// male | female | other | unknown. @@ -460,13 +450,13 @@ public List AppliesTo [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -475,13 +465,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -491,76 +478,69 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("age", Order=90)] [DataMember] - public Hl7.Fhir.Model.Range Age + public Hl7.Fhir.Model.Range? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.Range _Age; + private Hl7.Fhir.Model.Range? _Age; /// /// Applicable gestational age range, if relevant. /// [FhirElement("gestationalAge", Order=100)] [DataMember] - public Hl7.Fhir.Model.Range GestationalAge + public Hl7.Fhir.Model.Range? GestationalAge { get { return _GestationalAge; } set { _GestationalAge = value; OnPropertyChanged("GestationalAge"); } } - private Hl7.Fhir.Model.Range _GestationalAge; + private Hl7.Fhir.Model.Range? _GestationalAge; /// /// Condition associated with the reference range. /// [FhirElement("condition", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// Condition associated with the reference range /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QualifiedIntervalComponent; - - if (dest == null) - { + if(other is not QualifiedIntervalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(Range != null) dest.Range = (Hl7.Fhir.Model.Range)Range.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.CodeableConcept)Context.DeepCopyInternal(); - if(AppliesTo.Any()) dest.AppliesTo = new List(AppliesTo.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Age != null) dest.Age = (Hl7.Fhir.Model.Range)Age.DeepCopyInternal(); - if(GestationalAge != null) dest.GestationalAge = (Hl7.Fhir.Model.Range)GestationalAge.DeepCopyInternal(); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_Range is not null) dest.Range = (Hl7.Fhir.Model.Range)_Range.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.CodeableConcept)_Context.DeepCopyInternal(); + if(_AppliesTo is not null) dest.AppliesTo = new List(_AppliesTo.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.Range)_Age.DeepCopyInternal(); + if(_GestationalAge is not null) dest.GestationalAge = (Hl7.Fhir.Model.Range)_GestationalAge.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -572,83 +552,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualifiedIntervalComponent; - if(otherT == null) return false; + if(other is not QualifiedIntervalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(Range, otherT.Range)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(AppliesTo, otherT.AppliesTo)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(GestationalAge, otherT.GestationalAge)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_Range, otherT._Range)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_GestationalAge, otherT._GestationalAge)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "range": - value = Range; - return Range is not null; + value = _Range; + return _Range is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "appliesTo": - value = AppliesTo; - return AppliesTo?.Any() == true; + value = _AppliesTo; + return _AppliesTo?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "gestationalAge": - value = GestationalAge; - return GestationalAge is not null; + value = _GestationalAge; + return _GestationalAge is not null; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "range": - Range = (Hl7.Fhir.Model.Range)value; + Range = (Hl7.Fhir.Model.Range?)value; return this; case "context": - Context = (Hl7.Fhir.Model.CodeableConcept)value; + Context = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "appliesTo": - AppliesTo = (List)value; + AppliesTo = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "age": - Age = (Hl7.Fhir.Model.Range)value; + Age = (Hl7.Fhir.Model.Range?)value; return this; case "gestationalAge": - GestationalAge = (Hl7.Fhir.Model.Range)value; + GestationalAge = (Hl7.Fhir.Model.Range?)value; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -659,14 +639,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (Range is not null) yield return new KeyValuePair("range",Range); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",AppliesTo); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (GestationalAge is not null) yield return new KeyValuePair("gestationalAge",GestationalAge); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_Range is not null) yield return new KeyValuePair("range",_Range); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",_AppliesTo); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_GestationalAge is not null) yield return new KeyValuePair("gestationalAge",_GestationalAge); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); } } @@ -680,11 +660,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of observation (code / type). @@ -693,13 +673,13 @@ public List Category [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Business identifier for this ObservationDefinition instance. @@ -709,11 +689,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period. @@ -725,24 +705,24 @@ public List Identifier [DataMember] public List> PermittedDataTypeElement { - get { if(_PermittedDataTypeElement==null) _PermittedDataTypeElement = new List>(); return _PermittedDataTypeElement; } + get => _PermittedDataTypeElement ?? new List>(); set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } - private List> _PermittedDataTypeElement; + private List>? _PermittedDataTypeElement; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PermittedDataType + public IEnumerable? PermittedDataType { - get { return PermittedDataTypeElement != null ? PermittedDataTypeElement.Select(elem => elem.Value) : null; } + get => _PermittedDataTypeElement?.Select(elem => elem.Value); set { if (value == null) - PermittedDataTypeElement = null; + PermittedDataTypeElement = null!; else PermittedDataTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("PermittedDataType"); @@ -754,13 +734,13 @@ public IEnumerable Pe /// [FhirElement("multipleResultsAllowed", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleResultsAllowedElement + public Hl7.Fhir.Model.FhirBoolean? MultipleResultsAllowedElement { get { return _MultipleResultsAllowedElement; } set { _MultipleResultsAllowedElement = value; OnPropertyChanged("MultipleResultsAllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleResultsAllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleResultsAllowedElement; /// /// Multiple results allowed @@ -769,13 +749,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleResultsAllowedElement [IgnoreDataMember] public bool? MultipleResultsAllowed { - get { return MultipleResultsAllowedElement != null ? MultipleResultsAllowedElement.Value : null; } + get => _MultipleResultsAllowedElement?.Value; set { - if (value == null) - MultipleResultsAllowedElement = null; - else - MultipleResultsAllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleResultsAllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleResultsAllowed"); } } @@ -786,41 +763,38 @@ public bool? MultipleResultsAllowed [FhirElement("method", Order=140)] [Binding("ObservationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Preferred report name. /// [FhirElement("preferredReportName", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString PreferredReportNameElement + public Hl7.Fhir.Model.FhirString? PreferredReportNameElement { get { return _PreferredReportNameElement; } set { _PreferredReportNameElement = value; OnPropertyChanged("PreferredReportNameElement"); } } - private Hl7.Fhir.Model.FhirString _PreferredReportNameElement; + private Hl7.Fhir.Model.FhirString? _PreferredReportNameElement; /// /// Preferred report name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreferredReportName + public string? PreferredReportName { - get { return PreferredReportNameElement != null ? PreferredReportNameElement.Value : null; } + get => _PreferredReportNameElement?.Value; set { - if (value == null) - PreferredReportNameElement = null; - else - PreferredReportNameElement = new Hl7.Fhir.Model.FhirString(value); + PreferredReportNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreferredReportName"); } } @@ -830,13 +804,13 @@ public string PreferredReportName /// [FhirElement("quantitativeDetails", Order=160)] [DataMember] - public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent QuantitativeDetails + public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent? QuantitativeDetails { get { return _QuantitativeDetails; } set { _QuantitativeDetails = value; OnPropertyChanged("QuantitativeDetails"); } } - private Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent _QuantitativeDetails; + private Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent? _QuantitativeDetails; /// /// Qualified range for continuous and ordinal observation results. @@ -846,11 +820,11 @@ public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent Quantit [DataMember] public List QualifiedInterval { - get { if(_QualifiedInterval==null) _QualifiedInterval = new List(); return _QualifiedInterval; } + get => _QualifiedInterval ?? new List(); set { _QualifiedInterval = value; OnPropertyChanged("QualifiedInterval"); } } - private List _QualifiedInterval; + private List? _QualifiedInterval; /// /// Value set of valid coded values for the observations conforming to this ObservationDefinition. @@ -859,13 +833,13 @@ public List Qua [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ValidCodedValueSet + public Hl7.Fhir.Model.ResourceReference? ValidCodedValueSet { get { return _ValidCodedValueSet; } set { _ValidCodedValueSet = value; OnPropertyChanged("ValidCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _ValidCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _ValidCodedValueSet; /// /// Value set of normal coded values for the observations conforming to this ObservationDefinition. @@ -874,13 +848,13 @@ public Hl7.Fhir.Model.ResourceReference ValidCodedValueSet [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference NormalCodedValueSet + public Hl7.Fhir.Model.ResourceReference? NormalCodedValueSet { get { return _NormalCodedValueSet; } set { _NormalCodedValueSet = value; OnPropertyChanged("NormalCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _NormalCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _NormalCodedValueSet; /// /// Value set of abnormal coded values for the observations conforming to this ObservationDefinition. @@ -889,13 +863,13 @@ public Hl7.Fhir.Model.ResourceReference NormalCodedValueSet [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference AbnormalCodedValueSet + public Hl7.Fhir.Model.ResourceReference? AbnormalCodedValueSet { get { return _AbnormalCodedValueSet; } set { _AbnormalCodedValueSet = value; OnPropertyChanged("AbnormalCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _AbnormalCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _AbnormalCodedValueSet; /// /// Value set of critical coded values for the observations conforming to this ObservationDefinition. @@ -904,39 +878,35 @@ public Hl7.Fhir.Model.ResourceReference AbnormalCodedValueSet [CLSCompliant(false)] [References("ValueSet")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CriticalCodedValueSet + public Hl7.Fhir.Model.ResourceReference? CriticalCodedValueSet { get { return _CriticalCodedValueSet; } set { _CriticalCodedValueSet = value; OnPropertyChanged("CriticalCodedValueSet"); } } - private Hl7.Fhir.Model.ResourceReference _CriticalCodedValueSet; + private Hl7.Fhir.Model.ResourceReference? _CriticalCodedValueSet; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ObservationDefinition; - - if (dest == null) - { + if(other is not ObservationDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(PermittedDataTypeElement.Any()) dest.PermittedDataTypeElement = new List>(PermittedDataTypeElement.DeepCopyInternal()); - if(MultipleResultsAllowedElement != null) dest.MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)MultipleResultsAllowedElement.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(PreferredReportNameElement != null) dest.PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)PreferredReportNameElement.DeepCopyInternal(); - if(QuantitativeDetails != null) dest.QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent)QuantitativeDetails.DeepCopyInternal(); - if(QualifiedInterval.Any()) dest.QualifiedInterval = new List(QualifiedInterval.DeepCopyInternal()); - if(ValidCodedValueSet != null) dest.ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference)ValidCodedValueSet.DeepCopyInternal(); - if(NormalCodedValueSet != null) dest.NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)NormalCodedValueSet.DeepCopyInternal(); - if(AbnormalCodedValueSet != null) dest.AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)AbnormalCodedValueSet.DeepCopyInternal(); - if(CriticalCodedValueSet != null) dest.CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)CriticalCodedValueSet.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_PermittedDataTypeElement is not null) dest.PermittedDataTypeElement = new List>(_PermittedDataTypeElement.DeepCopyInternal()); + if(_MultipleResultsAllowedElement is not null) dest.MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleResultsAllowedElement.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_PreferredReportNameElement is not null) dest.PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)_PreferredReportNameElement.DeepCopyInternal(); + if(_QuantitativeDetails is not null) dest.QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent)_QuantitativeDetails.DeepCopyInternal(); + if(_QualifiedInterval is not null) dest.QualifiedInterval = new List(_QualifiedInterval.DeepCopyInternal()); + if(_ValidCodedValueSet is not null) dest.ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_ValidCodedValueSet.DeepCopyInternal(); + if(_NormalCodedValueSet is not null) dest.NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_NormalCodedValueSet.DeepCopyInternal(); + if(_AbnormalCodedValueSet is not null) dest.AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_AbnormalCodedValueSet.DeepCopyInternal(); + if(_CriticalCodedValueSet is not null) dest.CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)_CriticalCodedValueSet.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -948,118 +918,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ObservationDefinition; - if(otherT == null) return false; + if(other is not ObservationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(PermittedDataTypeElement, otherT.PermittedDataTypeElement)) return false; - if(!comparer.Equals(MultipleResultsAllowedElement, otherT.MultipleResultsAllowedElement)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(PreferredReportNameElement, otherT.PreferredReportNameElement)) return false; - if(!comparer.Equals(QuantitativeDetails, otherT.QuantitativeDetails)) return false; - if(!comparer.ListEquals(QualifiedInterval, otherT.QualifiedInterval)) return false; - if(!comparer.Equals(ValidCodedValueSet, otherT.ValidCodedValueSet)) return false; - if(!comparer.Equals(NormalCodedValueSet, otherT.NormalCodedValueSet)) return false; - if(!comparer.Equals(AbnormalCodedValueSet, otherT.AbnormalCodedValueSet)) return false; - if(!comparer.Equals(CriticalCodedValueSet, otherT.CriticalCodedValueSet)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_PermittedDataTypeElement, otherT._PermittedDataTypeElement)) return false; + if(!comparer.Equals(_MultipleResultsAllowedElement, otherT._MultipleResultsAllowedElement)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_PreferredReportNameElement, otherT._PreferredReportNameElement)) return false; + if(!comparer.Equals(_QuantitativeDetails, otherT._QuantitativeDetails)) return false; + if(!comparer.ListEquals(_QualifiedInterval, otherT._QualifiedInterval)) return false; + if(!comparer.Equals(_ValidCodedValueSet, otherT._ValidCodedValueSet)) return false; + if(!comparer.Equals(_NormalCodedValueSet, otherT._NormalCodedValueSet)) return false; + if(!comparer.Equals(_AbnormalCodedValueSet, otherT._AbnormalCodedValueSet)) return false; + if(!comparer.Equals(_CriticalCodedValueSet, otherT._CriticalCodedValueSet)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "permittedDataType": - value = PermittedDataTypeElement; - return PermittedDataTypeElement?.Any() == true; + value = _PermittedDataTypeElement; + return _PermittedDataTypeElement?.Any() == true; case "multipleResultsAllowed": - value = MultipleResultsAllowedElement; - return MultipleResultsAllowedElement is not null; + value = _MultipleResultsAllowedElement; + return _MultipleResultsAllowedElement is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "preferredReportName": - value = PreferredReportNameElement; - return PreferredReportNameElement is not null; + value = _PreferredReportNameElement; + return _PreferredReportNameElement is not null; case "quantitativeDetails": - value = QuantitativeDetails; - return QuantitativeDetails is not null; + value = _QuantitativeDetails; + return _QuantitativeDetails is not null; case "qualifiedInterval": - value = QualifiedInterval; - return QualifiedInterval?.Any() == true; + value = _QualifiedInterval; + return _QualifiedInterval?.Any() == true; case "validCodedValueSet": - value = ValidCodedValueSet; - return ValidCodedValueSet is not null; + value = _ValidCodedValueSet; + return _ValidCodedValueSet is not null; case "normalCodedValueSet": - value = NormalCodedValueSet; - return NormalCodedValueSet is not null; + value = _NormalCodedValueSet; + return _NormalCodedValueSet is not null; case "abnormalCodedValueSet": - value = AbnormalCodedValueSet; - return AbnormalCodedValueSet is not null; + value = _AbnormalCodedValueSet; + return _AbnormalCodedValueSet is not null; case "criticalCodedValueSet": - value = CriticalCodedValueSet; - return CriticalCodedValueSet is not null; + value = _CriticalCodedValueSet; + return _CriticalCodedValueSet is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "permittedDataType": - PermittedDataTypeElement = (List>)value; + PermittedDataTypeElement = (List>?)value!; return this; case "multipleResultsAllowed": - MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferredReportName": - PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)value; + PreferredReportNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quantitativeDetails": - QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent)value; + QuantitativeDetails = (Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent?)value; return this; case "qualifiedInterval": - QualifiedInterval = (List)value; + QualifiedInterval = (List?)value!; return this; case "validCodedValueSet": - ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + ValidCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "normalCodedValueSet": - NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + NormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "abnormalCodedValueSet": - AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + AbnormalCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "criticalCodedValueSet": - CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference)value; + CriticalCodedValueSet = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1070,19 +1040,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",PermittedDataTypeElement); - if (MultipleResultsAllowedElement is not null) yield return new KeyValuePair("multipleResultsAllowed",MultipleResultsAllowedElement); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (PreferredReportNameElement is not null) yield return new KeyValuePair("preferredReportName",PreferredReportNameElement); - if (QuantitativeDetails is not null) yield return new KeyValuePair("quantitativeDetails",QuantitativeDetails); - if (QualifiedInterval?.Any() == true) yield return new KeyValuePair("qualifiedInterval",QualifiedInterval); - if (ValidCodedValueSet is not null) yield return new KeyValuePair("validCodedValueSet",ValidCodedValueSet); - if (NormalCodedValueSet is not null) yield return new KeyValuePair("normalCodedValueSet",NormalCodedValueSet); - if (AbnormalCodedValueSet is not null) yield return new KeyValuePair("abnormalCodedValueSet",AbnormalCodedValueSet); - if (CriticalCodedValueSet is not null) yield return new KeyValuePair("criticalCodedValueSet",CriticalCodedValueSet); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",_PermittedDataTypeElement); + if (_MultipleResultsAllowedElement is not null) yield return new KeyValuePair("multipleResultsAllowed",_MultipleResultsAllowedElement); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_PreferredReportNameElement is not null) yield return new KeyValuePair("preferredReportName",_PreferredReportNameElement); + if (_QuantitativeDetails is not null) yield return new KeyValuePair("quantitativeDetails",_QuantitativeDetails); + if (_QualifiedInterval?.Any() == true) yield return new KeyValuePair("qualifiedInterval",_QualifiedInterval); + if (_ValidCodedValueSet is not null) yield return new KeyValuePair("validCodedValueSet",_ValidCodedValueSet); + if (_NormalCodedValueSet is not null) yield return new KeyValuePair("normalCodedValueSet",_NormalCodedValueSet); + if (_AbnormalCodedValueSet is not null) yield return new KeyValuePair("abnormalCodedValueSet",_AbnormalCodedValueSet); + if (_CriticalCodedValueSet is not null) yield return new KeyValuePair("criticalCodedValueSet",_CriticalCodedValueSet); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs index 63c4e45a7..0ea701250 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,28 +107,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name in Parameters.parameter.name or in URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -138,13 +138,13 @@ public string Name [Binding("OperationParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -153,13 +153,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -170,13 +167,13 @@ public Hl7.Fhir.Model.OperationParameterUse? Use [FhirElement("min", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum Cardinality @@ -185,13 +182,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -202,28 +196,25 @@ public int? Min [FhirElement("max", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum Cardinality (a number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -233,28 +224,25 @@ public string Max /// [FhirElement("documentation", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Description of meaning/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -266,13 +254,13 @@ public string Documentation [DeclaredType(Type = typeof(Code))] [Binding("FHIRAllTypes")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type this parameter has @@ -281,13 +269,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -300,24 +285,24 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List TargetProfileElement { - get { if(_TargetProfileElement==null) _TargetProfileElement = new List(); return _TargetProfileElement; } + get => _TargetProfileElement ?? new List(); set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } - private List _TargetProfileElement; + private List? _TargetProfileElement; /// /// If type is Reference | canonical, allowed targets /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TargetProfile + public IEnumerable? TargetProfile { - get { return TargetProfileElement != null ? TargetProfileElement.Select(elem => elem.Value) : null; } + get => _TargetProfileElement?.Select(elem => elem.Value); set { if (value == null) - TargetProfileElement = null; + TargetProfileElement = null!; else TargetProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("TargetProfile"); @@ -331,13 +316,13 @@ public IEnumerable TargetProfile [DeclaredType(Type = typeof(Code))] [Binding("SearchParamType")] [DataMember] - public Code SearchTypeElement + public Code? SearchTypeElement { get { return _SearchTypeElement; } set { _SearchTypeElement = value; OnPropertyChanged("SearchTypeElement"); } } - private Code _SearchTypeElement; + private Code? _SearchTypeElement; /// /// number | date | string | token | reference | composite | quantity | uri | special @@ -346,13 +331,10 @@ public Code SearchTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? SearchType { - get { return SearchTypeElement != null ? SearchTypeElement.Value : null; } + get => _SearchTypeElement?.Value; set { - if (value == null) - SearchTypeElement = null; - else - SearchTypeElement = new Code(value); + SearchTypeElement = value is null ? null : new Code(value); OnPropertyChanged("SearchType"); } } @@ -362,13 +344,13 @@ public Hl7.Fhir.Model.SearchParamType? SearchType /// [FhirElement("binding", Order=120)] [DataMember] - public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding + public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding { get { return _Binding; } set { _Binding = value; OnPropertyChanged("Binding"); } } - private Hl7.Fhir.Model.OperationDefinition.BindingComponent _Binding; + private Hl7.Fhir.Model.OperationDefinition.BindingComponent? _Binding; /// /// References to this parameter. @@ -378,11 +360,11 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding [DataMember] public List ReferencedFrom { - get { if(_ReferencedFrom==null) _ReferencedFrom = new List(); return _ReferencedFrom; } + get => _ReferencedFrom ?? new List(); set { _ReferencedFrom = value; OnPropertyChanged("ReferencedFrom"); } } - private List _ReferencedFrom; + private List? _ReferencedFrom; /// /// Parts of a nested Parameter. @@ -392,33 +374,29 @@ public List Referenc [DataMember] public List Part { - get { if(_Part==null) _Part = new List(); return _Part; } + get => _Part ?? new List(); set { _Part = value; OnPropertyChanged("Part"); } } - private List _Part; + private List? _Part; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TargetProfileElement.Any()) dest.TargetProfileElement = new List(TargetProfileElement.DeepCopyInternal()); - if(SearchTypeElement != null) dest.SearchTypeElement = (Code)SearchTypeElement.DeepCopyInternal(); - if(Binding != null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)Binding.DeepCopyInternal(); - if(ReferencedFrom.Any()) dest.ReferencedFrom = new List(ReferencedFrom.DeepCopyInternal()); - if(Part.Any()) dest.Part = new List(Part.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TargetProfileElement is not null) dest.TargetProfileElement = new List(_TargetProfileElement.DeepCopyInternal()); + if(_SearchTypeElement is not null) dest.SearchTypeElement = (Code)_SearchTypeElement.DeepCopyInternal(); + if(_Binding is not null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)_Binding.DeepCopyInternal(); + if(_ReferencedFrom is not null) dest.ReferencedFrom = new List(_ReferencedFrom.DeepCopyInternal()); + if(_Part is not null) dest.Part = new List(_Part.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -430,104 +408,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(TargetProfileElement, otherT.TargetProfileElement)) return false; - if(!comparer.Equals(SearchTypeElement, otherT.SearchTypeElement)) return false; - if(!comparer.Equals(Binding, otherT.Binding)) return false; - if(!comparer.ListEquals(ReferencedFrom, otherT.ReferencedFrom)) return false; - if(!comparer.ListEquals(Part, otherT.Part)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_TargetProfileElement, otherT._TargetProfileElement)) return false; + if(!comparer.Equals(_SearchTypeElement, otherT._SearchTypeElement)) return false; + if(!comparer.Equals(_Binding, otherT._Binding)) return false; + if(!comparer.ListEquals(_ReferencedFrom, otherT._ReferencedFrom)) return false; + if(!comparer.ListEquals(_Part, otherT._Part)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "targetProfile": - value = TargetProfileElement; - return TargetProfileElement?.Any() == true; + value = _TargetProfileElement; + return _TargetProfileElement?.Any() == true; case "searchType": - value = SearchTypeElement; - return SearchTypeElement is not null; + value = _SearchTypeElement; + return _SearchTypeElement is not null; case "binding": - value = Binding; - return Binding is not null; + value = _Binding; + return _Binding is not null; case "referencedFrom": - value = ReferencedFrom; - return ReferencedFrom?.Any() == true; + value = _ReferencedFrom; + return _ReferencedFrom?.Any() == true; case "part": - value = Part; - return Part?.Any() == true; + value = _Part; + return _Part?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "targetProfile": - TargetProfileElement = (List)value; + TargetProfileElement = (List?)value!; return this; case "searchType": - SearchTypeElement = (Code)value; + SearchTypeElement = (Code?)value; return this; case "binding": - Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)value; + Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent?)value; return this; case "referencedFrom": - ReferencedFrom = (List)value; + ReferencedFrom = (List?)value!; return this; case "part": - Part = (List)value; + Part = (List?)value!; return this; default: return base.SetValue(key, value); @@ -538,17 +516,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",TargetProfileElement); - if (SearchTypeElement is not null) yield return new KeyValuePair("searchType",SearchTypeElement); - if (Binding is not null) yield return new KeyValuePair("binding",Binding); - if (ReferencedFrom?.Any() == true) yield return new KeyValuePair("referencedFrom",ReferencedFrom); - if (Part?.Any() == true) yield return new KeyValuePair("part",Part); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",_TargetProfileElement); + if (_SearchTypeElement is not null) yield return new KeyValuePair("searchType",_SearchTypeElement); + if (_Binding is not null) yield return new KeyValuePair("binding",_Binding); + if (_ReferencedFrom?.Any() == true) yield return new KeyValuePair("referencedFrom",_ReferencedFrom); + if (_Part?.Any() == true) yield return new KeyValuePair("part",_Part); } } @@ -577,13 +555,13 @@ public partial class BindingComponent : Hl7.Fhir.Model.BackboneElement [Binding("BindingStrength")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StrengthElement + public Code? StrengthElement { get { return _StrengthElement; } set { _StrengthElement = value; OnPropertyChanged("StrengthElement"); } } - private Code _StrengthElement; + private Code? _StrengthElement; /// /// required | extensible | preferred | example @@ -592,13 +570,10 @@ public Code StrengthElement [IgnoreDataMember] public Hl7.Fhir.Model.BindingStrength? Strength { - get { return StrengthElement != null ? StrengthElement.Value : null; } + get => _StrengthElement?.Value; set { - if (value == null) - StrengthElement = null; - else - StrengthElement = new Code(value); + StrengthElement = value is null ? null : new Code(value); OnPropertyChanged("Strength"); } } @@ -609,44 +584,37 @@ public Hl7.Fhir.Model.BindingStrength? Strength [FhirElement("valueSet", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Source of value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BindingComponent; - - if (dest == null) - { + if(other is not BindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StrengthElement != null) dest.StrengthElement = (Code)StrengthElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); + if(_StrengthElement is not null) dest.StrengthElement = (Code)_StrengthElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -658,41 +626,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BindingComponent; - if(otherT == null) return false; + if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StrengthElement, otherT.StrengthElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "strength": - value = StrengthElement; - return StrengthElement is not null; + value = _StrengthElement; + return _StrengthElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "strength": - StrengthElement = (Code)value; + StrengthElement = (Code?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -703,8 +671,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StrengthElement is not null) yield return new KeyValuePair("strength",StrengthElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); + if (_StrengthElement is not null) yield return new KeyValuePair("strength",_StrengthElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); } } @@ -732,28 +700,25 @@ public partial class ReferencedFromComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("source", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// Referencing parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -763,44 +728,37 @@ public string Source /// [FhirElement("sourceId", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceIdElement + public Hl7.Fhir.Model.FhirString? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _SourceIdElement; + private Hl7.Fhir.Model.FhirString? _SourceIdElement; /// /// Element id of reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.FhirString(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferencedFromComponent; - - if (dest == null) - { + if(other is not ReferencedFromComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.FhirString)SourceIdElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.FhirString)_SourceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -812,41 +770,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferencedFromComponent; - if(otherT == null) return false; + if(other is not ReferencedFromComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.FhirString)value; + SourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -857,8 +815,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); } } @@ -888,24 +846,24 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get { if(_ParameterNameElement==null) _ParameterNameElement = new List(); return _ParameterNameElement; } + get => _ParameterNameElement ?? new List(); set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } - private List _ParameterNameElement; + private List? _ParameterNameElement; /// /// Name of parameter to include in overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ParameterName + public IEnumerable? ParameterName { - get { return ParameterNameElement != null ? ParameterNameElement.Select(elem => elem.Value) : null; } + get => _ParameterNameElement?.Select(elem => elem.Value); set { if (value == null) - ParameterNameElement = null; + ParameterNameElement = null!; else ParameterNameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ParameterName"); @@ -917,44 +875,37 @@ public IEnumerable ParameterName /// [FhirElement("comment", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments to go on overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OverloadComponent; - - if (dest == null) - { + if(other is not OverloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ParameterNameElement.Any()) dest.ParameterNameElement = new List(ParameterNameElement.DeepCopyInternal()); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_ParameterNameElement is not null) dest.ParameterNameElement = new List(_ParameterNameElement.DeepCopyInternal()); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -966,41 +917,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OverloadComponent; - if(otherT == null) return false; + if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ParameterNameElement, otherT.ParameterNameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "parameterName": - value = ParameterNameElement; - return ParameterNameElement?.Any() == true; + value = _ParameterNameElement; + return _ParameterNameElement?.Any() == true; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "parameterName": - ParameterNameElement = (List)value; + ParameterNameElement = (List?)value!; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1011,8 +962,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",ParameterNameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",_ParameterNameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -1022,28 +973,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this operation definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1053,28 +1001,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1085,28 +1030,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this operation definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1116,28 +1058,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this operation definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1150,13 +1089,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1165,13 +1104,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1184,13 +1120,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("OperationKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// operation | query @@ -1199,13 +1135,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1215,13 +1148,13 @@ public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1230,13 +1163,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1246,28 +1176,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1277,28 +1204,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1311,39 +1235,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the operation definition. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1356,11 +1277,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for operation definition (if applicable). @@ -1371,39 +1292,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this operation definition is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this operation definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1413,13 +1331,13 @@ public string Purpose /// [FhirElement("affectsState", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AffectsStateElement + public Hl7.Fhir.Model.FhirBoolean? AffectsStateElement { get { return _AffectsStateElement; } set { _AffectsStateElement = value; OnPropertyChanged("AffectsStateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AffectsStateElement; + private Hl7.Fhir.Model.FhirBoolean? _AffectsStateElement; /// /// Whether content is changed by the operation @@ -1428,13 +1346,10 @@ public Hl7.Fhir.Model.FhirBoolean AffectsStateElement [IgnoreDataMember] public bool? AffectsState { - get { return AffectsStateElement != null ? AffectsStateElement.Value : null; } + get => _AffectsStateElement?.Value; set { - if (value == null) - AffectsStateElement = null; - else - AffectsStateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AffectsStateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AffectsState"); } } @@ -1445,28 +1360,25 @@ public bool? AffectsState [FhirElement("code", InSummary=true, Order=240)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Name used to invoke the operation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1476,28 +1388,25 @@ public string Code /// [FhirElement("comment", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Additional information about use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -1507,28 +1416,25 @@ public string Comment /// [FhirElement("base", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.Canonical BaseElement + public Hl7.Fhir.Model.Canonical? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Hl7.Fhir.Model.Canonical _BaseElement; + private Hl7.Fhir.Model.Canonical? _BaseElement; /// /// Marks this as a profile of the base /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Base + public string? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Hl7.Fhir.Model.Canonical(value); + BaseElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Base"); } } @@ -1543,24 +1449,24 @@ public string Base [DataMember] public List> ResourceElement { - get { if(_ResourceElement==null) _ResourceElement = new List>(); return _ResourceElement; } + get => _ResourceElement ?? new List>(); set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private List> _ResourceElement; + private List>? _ResourceElement; /// /// Types this operation applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Resource + public IEnumerable? Resource { - get { return ResourceElement != null ? ResourceElement.Select(elem => elem.Value) : null; } + get => _ResourceElement?.Select(elem => elem.Value); set { if (value == null) - ResourceElement = null; + ResourceElement = null!; else ResourceElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Resource"); @@ -1573,13 +1479,13 @@ public IEnumerable Resource [FhirElement("system", InSummary=true, Order=280)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SystemElement + public Hl7.Fhir.Model.FhirBoolean? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SystemElement; + private Hl7.Fhir.Model.FhirBoolean? _SystemElement; /// /// Invoke at the system level? @@ -1588,13 +1494,10 @@ public Hl7.Fhir.Model.FhirBoolean SystemElement [IgnoreDataMember] public bool? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirBoolean(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("System"); } } @@ -1605,13 +1508,13 @@ public bool? System [FhirElement("type", InSummary=true, Order=290)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TypeElement + public Hl7.Fhir.Model.FhirBoolean? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TypeElement; + private Hl7.Fhir.Model.FhirBoolean? _TypeElement; /// /// Invoke at the type level? @@ -1620,13 +1523,10 @@ public Hl7.Fhir.Model.FhirBoolean TypeElement [IgnoreDataMember] public bool? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirBoolean(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Type"); } } @@ -1637,13 +1537,13 @@ public bool? Type [FhirElement("instance", InSummary=true, Order=300)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InstanceElement + public Hl7.Fhir.Model.FhirBoolean? InstanceElement { get { return _InstanceElement; } set { _InstanceElement = value; OnPropertyChanged("InstanceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InstanceElement; + private Hl7.Fhir.Model.FhirBoolean? _InstanceElement; /// /// Invoke on an instance? @@ -1652,13 +1552,10 @@ public Hl7.Fhir.Model.FhirBoolean InstanceElement [IgnoreDataMember] public bool? Instance { - get { return InstanceElement != null ? InstanceElement.Value : null; } + get => _InstanceElement?.Value; set { - if (value == null) - InstanceElement = null; - else - InstanceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InstanceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Instance"); } } @@ -1668,28 +1565,25 @@ public bool? Instance /// [FhirElement("inputProfile", Order=310)] [DataMember] - public Hl7.Fhir.Model.Canonical InputProfileElement + public Hl7.Fhir.Model.Canonical? InputProfileElement { get { return _InputProfileElement; } set { _InputProfileElement = value; OnPropertyChanged("InputProfileElement"); } } - private Hl7.Fhir.Model.Canonical _InputProfileElement; + private Hl7.Fhir.Model.Canonical? _InputProfileElement; /// /// Validation information for in parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InputProfile + public string? InputProfile { - get { return InputProfileElement != null ? InputProfileElement.Value : null; } + get => _InputProfileElement?.Value; set { - if (value == null) - InputProfileElement = null; - else - InputProfileElement = new Hl7.Fhir.Model.Canonical(value); + InputProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InputProfile"); } } @@ -1699,28 +1593,25 @@ public string InputProfile /// [FhirElement("outputProfile", Order=320)] [DataMember] - public Hl7.Fhir.Model.Canonical OutputProfileElement + public Hl7.Fhir.Model.Canonical? OutputProfileElement { get { return _OutputProfileElement; } set { _OutputProfileElement = value; OnPropertyChanged("OutputProfileElement"); } } - private Hl7.Fhir.Model.Canonical _OutputProfileElement; + private Hl7.Fhir.Model.Canonical? _OutputProfileElement; /// /// Validation information for out parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OutputProfile + public string? OutputProfile { - get { return OutputProfileElement != null ? OutputProfileElement.Value : null; } + get => _OutputProfileElement?.Value; set { - if (value == null) - OutputProfileElement = null; - else - OutputProfileElement = new Hl7.Fhir.Model.Canonical(value); + OutputProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("OutputProfile"); } } @@ -1733,11 +1624,11 @@ public string OutputProfile [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Define overloaded variants for when generating code. @@ -1747,48 +1638,44 @@ public List Parameter [DataMember] public List Overload { - get { if(_Overload==null) _Overload = new List(); return _Overload; } + get => _Overload ?? new List(); set { _Overload = value; OnPropertyChanged("Overload"); } } - private List _Overload; + private List? _Overload; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationDefinition; - - if (dest == null) - { + if(other is not OperationDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(AffectsStateElement != null) dest.AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)AffectsStateElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)BaseElement.DeepCopyInternal(); - if(ResourceElement.Any()) dest.ResourceElement = new List>(ResourceElement.DeepCopyInternal()); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)SystemElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)TypeElement.DeepCopyInternal(); - if(InstanceElement != null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)InstanceElement.DeepCopyInternal(); - if(InputProfileElement != null) dest.InputProfileElement = (Hl7.Fhir.Model.Canonical)InputProfileElement.DeepCopyInternal(); - if(OutputProfileElement != null) dest.OutputProfileElement = (Hl7.Fhir.Model.Canonical)OutputProfileElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Overload.Any()) dest.Overload = new List(Overload.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_AffectsStateElement is not null) dest.AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)_AffectsStateElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)_BaseElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = new List>(_ResourceElement.DeepCopyInternal()); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)_SystemElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)_TypeElement.DeepCopyInternal(); + if(_InstanceElement is not null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)_InstanceElement.DeepCopyInternal(); + if(_InputProfileElement is not null) dest.InputProfileElement = (Hl7.Fhir.Model.Canonical)_InputProfileElement.DeepCopyInternal(); + if(_OutputProfileElement is not null) dest.OutputProfileElement = (Hl7.Fhir.Model.Canonical)_OutputProfileElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Overload is not null) dest.Overload = new List(_Overload.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1800,209 +1687,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationDefinition; - if(otherT == null) return false; + if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(AffectsStateElement, otherT.AffectsStateElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.ListEquals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(InstanceElement, otherT.InstanceElement)) return false; - if(!comparer.Equals(InputProfileElement, otherT.InputProfileElement)) return false; - if(!comparer.Equals(OutputProfileElement, otherT.OutputProfileElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Overload, otherT.Overload)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_AffectsStateElement, otherT._AffectsStateElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.ListEquals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_InstanceElement, otherT._InstanceElement)) return false; + if(!comparer.Equals(_InputProfileElement, otherT._InputProfileElement)) return false; + if(!comparer.Equals(_OutputProfileElement, otherT._OutputProfileElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "affectsState": - value = AffectsStateElement; - return AffectsStateElement is not null; + value = _AffectsStateElement; + return _AffectsStateElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; case "resource": - value = ResourceElement; - return ResourceElement?.Any() == true; + value = _ResourceElement; + return _ResourceElement?.Any() == true; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "instance": - value = InstanceElement; - return InstanceElement is not null; + value = _InstanceElement; + return _InstanceElement is not null; case "inputProfile": - value = InputProfileElement; - return InputProfileElement is not null; + value = _InputProfileElement; + return _InputProfileElement is not null; case "outputProfile": - value = OutputProfileElement; - return OutputProfileElement is not null; + value = _OutputProfileElement; + return _OutputProfileElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "overload": - value = Overload; - return Overload?.Any() == true; + value = _Overload; + return _Overload?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "affectsState": - AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "base": - BaseElement = (Hl7.Fhir.Model.Canonical)value; + BaseElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "resource": - ResourceElement = (List>)value; + ResourceElement = (List>?)value!; return this; case "system": - SystemElement = (Hl7.Fhir.Model.FhirBoolean)value; + SystemElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirBoolean)value; + TypeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "instance": - InstanceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InstanceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "inputProfile": - InputProfileElement = (Hl7.Fhir.Model.Canonical)value; + InputProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "outputProfile": - OutputProfileElement = (Hl7.Fhir.Model.Canonical)value; + OutputProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "overload": - Overload = (List)value; + Overload = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2013,32 +1900,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (AffectsStateElement is not null) yield return new KeyValuePair("affectsState",AffectsStateElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); - if (ResourceElement?.Any() == true) yield return new KeyValuePair("resource",ResourceElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (InstanceElement is not null) yield return new KeyValuePair("instance",InstanceElement); - if (InputProfileElement is not null) yield return new KeyValuePair("inputProfile",InputProfileElement); - if (OutputProfileElement is not null) yield return new KeyValuePair("outputProfile",OutputProfileElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Overload?.Any() == true) yield return new KeyValuePair("overload",Overload); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_AffectsStateElement is not null) yield return new KeyValuePair("affectsState",_AffectsStateElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); + if (_ResourceElement?.Any() == true) yield return new KeyValuePair("resource",_ResourceElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_InstanceElement is not null) yield return new KeyValuePair("instance",_InstanceElement); + if (_InputProfileElement is not null) yield return new KeyValuePair("inputProfile",_InputProfileElement); + if (_OutputProfileElement is not null) yield return new KeyValuePair("outputProfile",_OutputProfileElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Overload?.Any() == true) yield return new KeyValuePair("overload",_Overload); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs index 3b8439ed4..579da4fe8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,26 +84,26 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("purpose", Order=40)] [Binding("ContactPartyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Purpose + public Hl7.Fhir.Model.CodeableConcept? Purpose { get { return _Purpose; } set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private Hl7.Fhir.Model.CodeableConcept _Purpose; + private Hl7.Fhir.Model.CodeableConcept? _Purpose; /// /// A name associated with the contact. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// Contact details (telephone, email, etc.) for a contact. @@ -110,39 +113,35 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Visiting or postal addresses for the contact. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Purpose != null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)Purpose.DeepCopyInternal(); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); + if(_Purpose is not null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)_Purpose.DeepCopyInternal(); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -154,55 +153,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Purpose, otherT.Purpose)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = Purpose; - return Purpose is not null; + value = _Purpose; + return _Purpose is not null; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - Purpose = (Hl7.Fhir.Model.CodeableConcept)value; + Purpose = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; default: return base.SetValue(key, value); @@ -213,10 +212,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Purpose is not null) yield return new KeyValuePair("purpose",Purpose); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); + if (_Purpose is not null) yield return new KeyValuePair("purpose",_Purpose); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); } } @@ -229,24 +228,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether the organization's record is still in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether the organization's record is still in active use @@ -255,13 +254,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -275,39 +271,36 @@ public bool? Active [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Name used for the organization. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name used for the organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -320,24 +313,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the organization is known as, or was known as in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -352,11 +345,11 @@ public IEnumerable Alias [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// An address for the organization. @@ -366,11 +359,11 @@ public List Telecom [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// The organization of which this organization forms a part. @@ -379,13 +372,13 @@ public List Address [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// Contact for the organization for a certain purpose. @@ -395,11 +388,11 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Technical endpoints providing access to services operated for the organization. @@ -411,34 +404,30 @@ public List Contact [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Organization; - - if (dest == null) - { + if(other is not Organization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -450,97 +439,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Organization; - if(otherT == null) return false; + if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -551,16 +540,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs index 232196e47..76cc91e78 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,24 +67,24 @@ public partial class OrganizationAffiliation : Hl7.Fhir.Model.DomainResource, II [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this organization affiliation record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this organization affiliation record is in active use @@ -90,13 +93,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -106,13 +106,13 @@ public bool? Active /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization where the role is available. @@ -121,13 +121,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Organization that provides/performs the role (e.g. providing services or is a member of). @@ -136,13 +136,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ParticipatingOrganization + public Hl7.Fhir.Model.ResourceReference? ParticipatingOrganization { get { return _ParticipatingOrganization; } set { _ParticipatingOrganization = value; OnPropertyChanged("ParticipatingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ParticipatingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ParticipatingOrganization; /// /// Health insurance provider network in which the participatingOrganization provides the role's services (if defined) at the indicated locations (if defined). @@ -154,11 +154,11 @@ public Hl7.Fhir.Model.ResourceReference ParticipatingOrganization [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Definition of the role the participatingOrganization plays. @@ -169,11 +169,11 @@ public List Network [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Specific specialty of the participatingOrganization in the context of the role. @@ -184,11 +184,11 @@ public List Code [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The location(s) at which the role occurs. @@ -200,11 +200,11 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Healthcare services provided through the role. @@ -216,11 +216,11 @@ public List Location [DataMember] public List HealthcareService { - get { if(_HealthcareService==null) _HealthcareService = new List(); return _HealthcareService; } + get => _HealthcareService ?? new List(); set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } - private List _HealthcareService; + private List? _HealthcareService; /// /// Contact details at the participatingOrganization relevant to this Affiliation. @@ -230,11 +230,11 @@ public List HealthcareService [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Technical endpoints providing access to services operated for this role. @@ -246,36 +246,32 @@ public List Telecom [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as OrganizationAffiliation; - - if (dest == null) - { + if(other is not OrganizationAffiliation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(ParticipatingOrganization != null) dest.ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)ParticipatingOrganization.DeepCopyInternal(); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(HealthcareService.Any()) dest.HealthcareService = new List(HealthcareService.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_ParticipatingOrganization is not null) dest.ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)_ParticipatingOrganization.DeepCopyInternal(); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_HealthcareService is not null) dest.HealthcareService = new List(_HealthcareService.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -287,111 +283,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrganizationAffiliation; - if(otherT == null) return false; + if(other is not OrganizationAffiliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(ParticipatingOrganization, otherT.ParticipatingOrganization)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(HealthcareService, otherT.HealthcareService)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_ParticipatingOrganization, otherT._ParticipatingOrganization)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "participatingOrganization": - value = ParticipatingOrganization; - return ParticipatingOrganization is not null; + value = _ParticipatingOrganization; + return _ParticipatingOrganization is not null; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "healthcareService": - value = HealthcareService; - return HealthcareService?.Any() == true; + value = _HealthcareService; + return _HealthcareService?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participatingOrganization": - ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "healthcareService": - HealthcareService = (List)value; + HealthcareService = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -402,18 +398,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (ParticipatingOrganization is not null) yield return new KeyValuePair("participatingOrganization",ParticipatingOrganization); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",HealthcareService); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_ParticipatingOrganization is not null) yield return new KeyValuePair("participatingOrganization",_ParticipatingOrganization); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",_HealthcareService); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs index d003a7d9a..2bae35cb5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -75,13 +78,13 @@ public partial class LegalStatusOfSupplyComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("code", InSummary=true, Order=40)] [Binding("LegalStatusOfSupply")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The place where the legal status of supply applies. @@ -89,26 +92,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("jurisdiction", InSummary=true, Order=50)] [Binding("Jurisdiction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; protected internal override void CopyToInternal(Base other) { - var dest = other as LegalStatusOfSupplyComponent; - - if (dest == null) - { + if(other is not LegalStatusOfSupplyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -120,41 +119,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LegalStatusOfSupplyComponent; - if(otherT == null) return false; + if(other is not LegalStatusOfSupplyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -165,8 +164,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); } } @@ -195,11 +194,11 @@ public partial class PackageComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The physical type of the container of the items. @@ -207,26 +206,26 @@ public List Identifier [FhirElement("type", InSummary=true, Order=50)] [Binding("PackagingType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The quantity of this level of packaging in the package that contains it (with the outermost level being 1). /// [FhirElement("quantity", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer QuantityElement + public Hl7.Fhir.Model.Integer? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.Integer _QuantityElement; + private Hl7.Fhir.Model.Integer? _QuantityElement; /// /// The quantity of this level of packaging in the package that contains it (with the outermost level being 1) @@ -235,13 +234,10 @@ public Hl7.Fhir.Model.Integer QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.Integer(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Quantity"); } } @@ -255,11 +251,11 @@ public int? Quantity [DataMember] public List Material { - get { if(_Material==null) _Material = new List(); return _Material; } + get => _Material ?? new List(); set { _Material = value; OnPropertyChanged("Material"); } } - private List _Material; + private List? _Material; /// /// A possible alternate material for this part of the packaging, that is allowed to be used instead of the usual material. @@ -270,11 +266,11 @@ public List Material [DataMember] public List AlternateMaterial { - get { if(_AlternateMaterial==null) _AlternateMaterial = new List(); return _AlternateMaterial; } + get => _AlternateMaterial ?? new List(); set { _AlternateMaterial = value; OnPropertyChanged("AlternateMaterial"); } } - private List _AlternateMaterial; + private List? _AlternateMaterial; /// /// Shelf Life and storage information. @@ -284,11 +280,11 @@ public List AlternateMaterial [DataMember] public List ShelfLifeStorage { - get { if(_ShelfLifeStorage==null) _ShelfLifeStorage = new List(); return _ShelfLifeStorage; } + get => _ShelfLifeStorage ?? new List(); set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } - private List _ShelfLifeStorage; + private List? _ShelfLifeStorage; /// /// Manufacturer of this package Item (multiple means these are all possible manufacturers). @@ -300,11 +296,11 @@ public List [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// General characteristics of this item. @@ -314,11 +310,11 @@ public List Manufacturer [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// The item(s) within the packaging. @@ -328,11 +324,11 @@ public List Property [DataMember] public List ContainedItem { - get { if(_ContainedItem==null) _ContainedItem = new List(); return _ContainedItem; } + get => _ContainedItem ?? new List(); set { _ContainedItem = value; OnPropertyChanged("ContainedItem"); } } - private List _ContainedItem; + private List? _ContainedItem; /// /// Allows containers (and parts of containers) within containers, still a single packaged product. @@ -342,32 +338,28 @@ public List Con [DataMember] public List Package { - get { if(_Package==null) _Package = new List(); return _Package; } + get => _Package ?? new List(); set { _Package = value; OnPropertyChanged("Package"); } } - private List _Package; + private List? _Package; protected internal override void CopyToInternal(Base other) { - var dest = other as PackageComponent; - - if (dest == null) - { + if(other is not PackageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)QuantityElement.DeepCopyInternal(); - if(Material.Any()) dest.Material = new List(Material.DeepCopyInternal()); - if(AlternateMaterial.Any()) dest.AlternateMaterial = new List(AlternateMaterial.DeepCopyInternal()); - if(ShelfLifeStorage.Any()) dest.ShelfLifeStorage = new List(ShelfLifeStorage.DeepCopyInternal()); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(ContainedItem.Any()) dest.ContainedItem = new List(ContainedItem.DeepCopyInternal()); - if(Package.Any()) dest.Package = new List(Package.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)_QuantityElement.DeepCopyInternal(); + if(_Material is not null) dest.Material = new List(_Material.DeepCopyInternal()); + if(_AlternateMaterial is not null) dest.AlternateMaterial = new List(_AlternateMaterial.DeepCopyInternal()); + if(_ShelfLifeStorage is not null) dest.ShelfLifeStorage = new List(_ShelfLifeStorage.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_ContainedItem is not null) dest.ContainedItem = new List(_ContainedItem.DeepCopyInternal()); + if(_Package is not null) dest.Package = new List(_Package.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -379,97 +371,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackageComponent; - if(otherT == null) return false; + if(other is not PackageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.ListEquals(Material, otherT.Material)) return false; - if(!comparer.ListEquals(AlternateMaterial, otherT.AlternateMaterial)) return false; - if(!comparer.ListEquals(ShelfLifeStorage, otherT.ShelfLifeStorage)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(ContainedItem, otherT.ContainedItem)) return false; - if(!comparer.ListEquals(Package, otherT.Package)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.ListEquals(_Material, otherT._Material)) return false; + if(!comparer.ListEquals(_AlternateMaterial, otherT._AlternateMaterial)) return false; + if(!comparer.ListEquals(_ShelfLifeStorage, otherT._ShelfLifeStorage)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_ContainedItem, otherT._ContainedItem)) return false; + if(!comparer.ListEquals(_Package, otherT._Package)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "material": - value = Material; - return Material?.Any() == true; + value = _Material; + return _Material?.Any() == true; case "alternateMaterial": - value = AlternateMaterial; - return AlternateMaterial?.Any() == true; + value = _AlternateMaterial; + return _AlternateMaterial?.Any() == true; case "shelfLifeStorage": - value = ShelfLifeStorage; - return ShelfLifeStorage?.Any() == true; + value = _ShelfLifeStorage; + return _ShelfLifeStorage?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "containedItem": - value = ContainedItem; - return ContainedItem?.Any() == true; + value = _ContainedItem; + return _ContainedItem?.Any() == true; case "package": - value = Package; - return Package?.Any() == true; + value = _Package; + return _Package?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.Integer)value; + QuantityElement = (Hl7.Fhir.Model.Integer?)value; return this; case "material": - Material = (List)value; + Material = (List?)value!; return this; case "alternateMaterial": - AlternateMaterial = (List)value; + AlternateMaterial = (List?)value!; return this; case "shelfLifeStorage": - ShelfLifeStorage = (List)value; + ShelfLifeStorage = (List?)value!; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "containedItem": - ContainedItem = (List)value; + ContainedItem = (List?)value!; return this; case "package": - Package = (List)value; + Package = (List?)value!; return this; default: return base.SetValue(key, value); @@ -480,16 +472,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (Material?.Any() == true) yield return new KeyValuePair("material",Material); - if (AlternateMaterial?.Any() == true) yield return new KeyValuePair("alternateMaterial",AlternateMaterial); - if (ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",ShelfLifeStorage); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (ContainedItem?.Any() == true) yield return new KeyValuePair("containedItem",ContainedItem); - if (Package?.Any() == true) yield return new KeyValuePair("package",Package); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_Material?.Any() == true) yield return new KeyValuePair("material",_Material); + if (_AlternateMaterial?.Any() == true) yield return new KeyValuePair("alternateMaterial",_AlternateMaterial); + if (_ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",_ShelfLifeStorage); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_ContainedItem?.Any() == true) yield return new KeyValuePair("containedItem",_ContainedItem); + if (_Package?.Any() == true) yield return new KeyValuePair("package",_Package); } } @@ -512,13 +504,13 @@ public partial class ShelfLifeStorageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The shelf life time period can be specified using a numerical value for the period of time and its unit of time measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. @@ -527,13 +519,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Period + public Hl7.Fhir.Model.DataType? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.DataType _Period; + private Hl7.Fhir.Model.DataType? _Period; /// /// Special precautions for storage, if any, can be specified using an appropriate controlled vocabulary. The controlled term and the controlled term identifier shall be specified. @@ -543,25 +535,21 @@ public Hl7.Fhir.Model.DataType Period [DataMember] public List SpecialPrecautionsForStorage { - get { if(_SpecialPrecautionsForStorage==null) _SpecialPrecautionsForStorage = new List(); return _SpecialPrecautionsForStorage; } + get => _SpecialPrecautionsForStorage ?? new List(); set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } - private List _SpecialPrecautionsForStorage; + private List? _SpecialPrecautionsForStorage; protected internal override void CopyToInternal(Base other) { - var dest = other as ShelfLifeStorageComponent; - - if (dest == null) - { + if(other is not ShelfLifeStorageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.DataType)Period.DeepCopyInternal(); - if(SpecialPrecautionsForStorage.Any()) dest.SpecialPrecautionsForStorage = new List(SpecialPrecautionsForStorage.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.DataType)_Period.DeepCopyInternal(); + if(_SpecialPrecautionsForStorage is not null) dest.SpecialPrecautionsForStorage = new List(_SpecialPrecautionsForStorage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -573,48 +561,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ShelfLifeStorageComponent; - if(otherT == null) return false; + if(other is not ShelfLifeStorageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(SpecialPrecautionsForStorage, otherT.SpecialPrecautionsForStorage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "specialPrecautionsForStorage": - value = SpecialPrecautionsForStorage; - return SpecialPrecautionsForStorage?.Any() == true; + value = _SpecialPrecautionsForStorage; + return _SpecialPrecautionsForStorage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.DataType)value; + Period = (Hl7.Fhir.Model.DataType?)value; return this; case "specialPrecautionsForStorage": - SpecialPrecautionsForStorage = (List)value; + SpecialPrecautionsForStorage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -625,9 +613,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",SpecialPrecautionsForStorage); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",_SpecialPrecautionsForStorage); } } @@ -652,13 +640,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProductCharacteristic")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -667,26 +655,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -698,41 +682,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -743,8 +727,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -768,39 +752,35 @@ public partial class ContainedItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// The number of this type of item within this packaging. /// [FhirElement("amount", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainedItemComponent; - - if (dest == null) - { + if(other is not ContainedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -812,41 +792,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainedItemComponent; - if(otherT == null) return false; + if(other is not ContainedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -857,8 +837,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -871,39 +851,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A name for this package. Typically as listed in a drug formulary, catalogue, inventory etc. /// [FhirElement("name", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name for this package. Typically as listed in a drug formulary, catalogue, inventory etc /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -914,13 +891,13 @@ public string Name [FhirElement("type", InSummary=true, Order=110)] [Binding("PackageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The product that this is a pack for. @@ -932,11 +909,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List PackageFor { - get { if(_PackageFor==null) _PackageFor = new List(); return _PackageFor; } + get => _PackageFor ?? new List(); set { _PackageFor = value; OnPropertyChanged("PackageFor"); } } - private List _PackageFor; + private List? _PackageFor; /// /// The status within the lifecycle of this item. High level - not intended to duplicate details elsewhere e.g. legal status, or authorization/marketing status. @@ -944,41 +921,38 @@ public List PackageFor [FhirElement("status", InSummary=true, IsModifier=true, Order=130)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the given status became applicable. /// [FhirElement("statusDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the given status became applicable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -991,39 +965,36 @@ public string StatusDate [DataMember] public List ContainedItemQuantity { - get { if(_ContainedItemQuantity==null) _ContainedItemQuantity = new List(); return _ContainedItemQuantity; } + get => _ContainedItemQuantity ?? new List(); set { _ContainedItemQuantity = value; OnPropertyChanged("ContainedItemQuantity"); } } - private List _ContainedItemQuantity; + private List? _ContainedItemQuantity; /// /// Textual description. Note that this is not the name of the package or product. /// [FhirElement("description", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description. Note that this is not the name of the package or product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1036,11 +1007,11 @@ public string Description [DataMember] public List LegalStatusOfSupply { - get { if(_LegalStatusOfSupply==null) _LegalStatusOfSupply = new List(); return _LegalStatusOfSupply; } + get => _LegalStatusOfSupply ?? new List(); set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } - private List _LegalStatusOfSupply; + private List? _LegalStatusOfSupply; /// /// Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated. @@ -1050,11 +1021,11 @@ public List MarketingStatus { - get { if(_MarketingStatus==null) _MarketingStatus = new List(); return _MarketingStatus; } + get => _MarketingStatus ?? new List(); set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } - private List _MarketingStatus; + private List? _MarketingStatus; /// /// Allows the key features to be recorded, such as "hospital pack", "nurse prescribable". @@ -1065,24 +1036,24 @@ public List MarketingStatus [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// If the drug product is supplied with another item such as a diluent or adjuvant. /// [FhirElement("copackagedIndicator", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CopackagedIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? CopackagedIndicatorElement { get { return _CopackagedIndicatorElement; } set { _CopackagedIndicatorElement = value; OnPropertyChanged("CopackagedIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CopackagedIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _CopackagedIndicatorElement; /// /// If the drug product is supplied with another item such as a diluent or adjuvant @@ -1091,13 +1062,10 @@ public Hl7.Fhir.Model.FhirBoolean CopackagedIndicatorElement [IgnoreDataMember] public bool? CopackagedIndicator { - get { return CopackagedIndicatorElement != null ? CopackagedIndicatorElement.Value : null; } + get => _CopackagedIndicatorElement?.Value; set { - if (value == null) - CopackagedIndicatorElement = null; - else - CopackagedIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + CopackagedIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("CopackagedIndicator"); } } @@ -1112,51 +1080,47 @@ public bool? CopackagedIndicator [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// A packaging item, as a container for medically related items, possibly with other packaging items within, or a packaging component, such as bottle cap. /// [FhirElement("package", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent Package + public Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent? Package { get { return _Package; } set { _Package = value; OnPropertyChanged("Package"); } } - private Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent _Package; + private Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent? _Package; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PackagedProductDefinition; - - if (dest == null) - { + if(other is not PackagedProductDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PackageFor.Any()) dest.PackageFor = new List(PackageFor.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(ContainedItemQuantity.Any()) dest.ContainedItemQuantity = new List(ContainedItemQuantity.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(LegalStatusOfSupply.Any()) dest.LegalStatusOfSupply = new List(LegalStatusOfSupply.DeepCopyInternal()); - if(MarketingStatus.Any()) dest.MarketingStatus = new List(MarketingStatus.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(CopackagedIndicatorElement != null) dest.CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)CopackagedIndicatorElement.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Package != null) dest.Package = (Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent)Package.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PackageFor is not null) dest.PackageFor = new List(_PackageFor.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_ContainedItemQuantity is not null) dest.ContainedItemQuantity = new List(_ContainedItemQuantity.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_LegalStatusOfSupply is not null) dest.LegalStatusOfSupply = new List(_LegalStatusOfSupply.DeepCopyInternal()); + if(_MarketingStatus is not null) dest.MarketingStatus = new List(_MarketingStatus.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_CopackagedIndicatorElement is not null) dest.CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_CopackagedIndicatorElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Package is not null) dest.Package = (Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent)_Package.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1168,125 +1132,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagedProductDefinition; - if(otherT == null) return false; + if(other is not PackagedProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(PackageFor, otherT.PackageFor)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.ListEquals(ContainedItemQuantity, otherT.ContainedItemQuantity)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(LegalStatusOfSupply, otherT.LegalStatusOfSupply)) return false; - if(!comparer.ListEquals(MarketingStatus, otherT.MarketingStatus)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.Equals(CopackagedIndicatorElement, otherT.CopackagedIndicatorElement)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(Package, otherT.Package)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_PackageFor, otherT._PackageFor)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.ListEquals(_ContainedItemQuantity, otherT._ContainedItemQuantity)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; + if(!comparer.ListEquals(_MarketingStatus, otherT._MarketingStatus)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.Equals(_CopackagedIndicatorElement, otherT._CopackagedIndicatorElement)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_Package, otherT._Package)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "packageFor": - value = PackageFor; - return PackageFor?.Any() == true; + value = _PackageFor; + return _PackageFor?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "containedItemQuantity": - value = ContainedItemQuantity; - return ContainedItemQuantity?.Any() == true; + value = _ContainedItemQuantity; + return _ContainedItemQuantity?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "legalStatusOfSupply": - value = LegalStatusOfSupply; - return LegalStatusOfSupply?.Any() == true; + value = _LegalStatusOfSupply; + return _LegalStatusOfSupply?.Any() == true; case "marketingStatus": - value = MarketingStatus; - return MarketingStatus?.Any() == true; + value = _MarketingStatus; + return _MarketingStatus?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "copackagedIndicator": - value = CopackagedIndicatorElement; - return CopackagedIndicatorElement is not null; + value = _CopackagedIndicatorElement; + return _CopackagedIndicatorElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "package": - value = Package; - return Package is not null; + value = _Package; + return _Package is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "packageFor": - PackageFor = (List)value; + PackageFor = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "containedItemQuantity": - ContainedItemQuantity = (List)value; + ContainedItemQuantity = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "legalStatusOfSupply": - LegalStatusOfSupply = (List)value; + LegalStatusOfSupply = (List?)value!; return this; case "marketingStatus": - MarketingStatus = (List)value; + MarketingStatus = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "copackagedIndicator": - CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "package": - Package = (Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent)value; + Package = (Hl7.Fhir.Model.PackagedProductDefinition.PackageComponent?)value; return this; default: return base.SetValue(key, value); @@ -1297,20 +1261,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PackageFor?.Any() == true) yield return new KeyValuePair("packageFor",PackageFor); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (ContainedItemQuantity?.Any() == true) yield return new KeyValuePair("containedItemQuantity",ContainedItemQuantity); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (LegalStatusOfSupply?.Any() == true) yield return new KeyValuePair("legalStatusOfSupply",LegalStatusOfSupply); - if (MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",MarketingStatus); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (CopackagedIndicatorElement is not null) yield return new KeyValuePair("copackagedIndicator",CopackagedIndicatorElement); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Package is not null) yield return new KeyValuePair("package",Package); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PackageFor?.Any() == true) yield return new KeyValuePair("packageFor",_PackageFor); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_ContainedItemQuantity?.Any() == true) yield return new KeyValuePair("containedItemQuantity",_ContainedItemQuantity); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_LegalStatusOfSupply?.Any() == true) yield return new KeyValuePair("legalStatusOfSupply",_LegalStatusOfSupply); + if (_MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",_MarketingStatus); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_CopackagedIndicatorElement is not null) yield return new KeyValuePair("copackagedIndicator",_CopackagedIndicatorElement); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Package is not null) yield return new KeyValuePair("package",_Package); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs index be6ccaa39..1d6cfa626 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ParameterDefinition : Hl7.Fhir.Model.DataType /// [FhirElement("name", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name used to access the parameter value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -98,13 +98,13 @@ public string Name [Binding("ParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -113,13 +113,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -129,13 +126,13 @@ public Hl7.Fhir.Model.OperationParameterUse? Use /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum cardinality @@ -144,13 +141,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -160,28 +154,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum cardinality (a number of *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -191,28 +182,25 @@ public string Max /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// A brief description of the parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -225,13 +213,13 @@ public string Documentation [Binding("FHIRAllTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type of value @@ -240,13 +228,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -256,49 +241,42 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type /// [FhirElement("profile", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// What profile the value is expected to be /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterDefinition; - - if (dest == null) - { + if(other is not ParameterDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -310,76 +288,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterDefinition; - if(otherT == null) return false; + if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -390,13 +368,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs b/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs index 742fc48cd..3b9482979 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -118,24 +121,24 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// A name associated with the contact person. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// A contact detail for the person. @@ -145,24 +148,24 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address for the contact person. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// male | female | other | unknown. @@ -171,13 +174,13 @@ public Hl7.Fhir.Model.Address Address [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -186,13 +189,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -204,44 +204,40 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// The period during which this contact person or organization is valid to be contacted relating to this patient. /// [FhirElement("period", Order=100)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -253,76 +249,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -333,13 +329,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -367,26 +363,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -395,29 +391,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -429,41 +418,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -474,8 +463,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -505,13 +494,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Other + public Hl7.Fhir.Model.ResourceReference? Other { get { return _Other; } set { _Other = value; OnPropertyChanged("Other"); } } - private Hl7.Fhir.Model.ResourceReference _Other; + private Hl7.Fhir.Model.ResourceReference? _Other; /// /// replaced-by | replaces | refer | seealso. @@ -521,13 +510,13 @@ public Hl7.Fhir.Model.ResourceReference Other [Binding("LinkType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// replaced-by | replaces | refer | seealso @@ -536,29 +525,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Patient.LinkType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Other != null) dest.Other = (Hl7.Fhir.Model.ResourceReference)Other.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_Other is not null) dest.Other = (Hl7.Fhir.Model.ResourceReference)_Other.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -570,41 +552,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Other, otherT.Other)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "other": - value = Other; - return Other is not null; + value = _Other; + return _Other is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "other": - Other = (Hl7.Fhir.Model.ResourceReference)value; + Other = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -615,8 +597,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Other is not null) yield return new KeyValuePair("other",Other); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_Other is not null) yield return new KeyValuePair("other",_Other); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -629,24 +611,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this patient's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this patient's record is in active use @@ -655,13 +637,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -674,11 +653,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the individual. @@ -688,11 +667,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -701,13 +680,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -716,13 +695,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -732,28 +708,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date of birth for the individual /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -765,13 +738,13 @@ public string BirthDate [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// An address for the individual. @@ -781,11 +754,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Marital (civil) status of a patient. @@ -793,13 +766,13 @@ public List Address [FhirElement("maritalStatus", Order=170)] [Binding("MaritalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MaritalStatus + public Hl7.Fhir.Model.CodeableConcept? MaritalStatus { get { return _MaritalStatus; } set { _MaritalStatus = value; OnPropertyChanged("MaritalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _MaritalStatus; + private Hl7.Fhir.Model.CodeableConcept? _MaritalStatus; /// /// Whether patient is part of a multiple birth. @@ -808,13 +781,13 @@ public Hl7.Fhir.Model.CodeableConcept MaritalStatus [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer))] [DataMember] - public Hl7.Fhir.Model.DataType MultipleBirth + public Hl7.Fhir.Model.DataType? MultipleBirth { get { return _MultipleBirth; } set { _MultipleBirth = value; OnPropertyChanged("MultipleBirth"); } } - private Hl7.Fhir.Model.DataType _MultipleBirth; + private Hl7.Fhir.Model.DataType? _MultipleBirth; /// /// Image of the patient. @@ -824,11 +797,11 @@ public Hl7.Fhir.Model.DataType MultipleBirth [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// A contact party (e.g. guardian, partner, friend) for the patient. @@ -838,11 +811,11 @@ public List Photo [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// A language which may be used to communicate with the patient about his or her health. @@ -852,11 +825,11 @@ public List Contact [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Patient's nominated primary care provider. @@ -868,11 +841,11 @@ public List Communication [DataMember] public List GeneralPractitioner { - get { if(_GeneralPractitioner==null) _GeneralPractitioner = new List(); return _GeneralPractitioner; } + get => _GeneralPractitioner ?? new List(); set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } - private List _GeneralPractitioner; + private List? _GeneralPractitioner; /// /// Organization that is the custodian of the patient record. @@ -881,13 +854,13 @@ public List GeneralPractitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Link to another patient resource that concerns the same actual person. @@ -897,40 +870,36 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Patient; - - if (dest == null) - { + if(other is not Patient dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(MaritalStatus != null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)MaritalStatus.DeepCopyInternal(); - if(MultipleBirth != null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)MultipleBirth.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(GeneralPractitioner.Any()) dest.GeneralPractitioner = new List(GeneralPractitioner.DeepCopyInternal()); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_MaritalStatus is not null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)_MaritalStatus.DeepCopyInternal(); + if(_MultipleBirth is not null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)_MultipleBirth.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_GeneralPractitioner is not null) dest.GeneralPractitioner = new List(_GeneralPractitioner.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -942,139 +911,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Patient; - if(otherT == null) return false; + if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(MaritalStatus, otherT.MaritalStatus)) return false; - if(!comparer.Equals(MultipleBirth, otherT.MultipleBirth)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(GeneralPractitioner, otherT.GeneralPractitioner)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_MaritalStatus, otherT._MaritalStatus)) return false; + if(!comparer.Equals(_MultipleBirth, otherT._MultipleBirth)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "maritalStatus": - value = MaritalStatus; - return MaritalStatus is not null; + value = _MaritalStatus; + return _MaritalStatus is not null; case "multipleBirth": - value = MultipleBirth; - return MultipleBirth is not null; + value = _MultipleBirth; + return _MultipleBirth is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "generalPractitioner": - value = GeneralPractitioner; - return GeneralPractitioner?.Any() == true; + value = _GeneralPractitioner; + return _GeneralPractitioner?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "maritalStatus": - MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + MaritalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "multipleBirth": - MultipleBirth = (Hl7.Fhir.Model.DataType)value; + MultipleBirth = (Hl7.Fhir.Model.DataType?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "generalPractitioner": - GeneralPractitioner = (List)value; + GeneralPractitioner = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1085,22 +1054,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",MaritalStatus); - if (MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",MultipleBirth); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",GeneralPractitioner); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",_MaritalStatus); + if (_MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",_MultipleBirth); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",_GeneralPractitioner); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs index c085b4bea..e7a24ae2f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -81,13 +84,13 @@ public List Identifier [Binding("PaymentNoticeStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -96,13 +99,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -114,13 +114,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Response reference. @@ -129,13 +129,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Creation date. @@ -143,28 +143,25 @@ public Hl7.Fhir.Model.ResourceReference Response [FhirElement("created", InSummary=true, Order=130, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -176,13 +173,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Payment reference. @@ -192,41 +189,38 @@ public Hl7.Fhir.Model.ResourceReference Provider [References("PaymentReconciliation")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payment + public Hl7.Fhir.Model.ResourceReference? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ResourceReference _Payment; + private Hl7.Fhir.Model.ResourceReference? _Payment; /// /// Payment or clearing date. /// [FhirElement("paymentDate", Order=160)] [DataMember] - public Hl7.Fhir.Model.Date PaymentDateElement + public Hl7.Fhir.Model.Date? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.Date _PaymentDateElement; + private Hl7.Fhir.Model.Date? _PaymentDateElement; /// /// Payment or clearing date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.Date(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("PaymentDate"); } } @@ -238,13 +232,13 @@ public string PaymentDate [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payee + public Hl7.Fhir.Model.ResourceReference? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ResourceReference _Payee; + private Hl7.Fhir.Model.ResourceReference? _Payee; /// /// Party being notified. @@ -254,13 +248,13 @@ public Hl7.Fhir.Model.ResourceReference Payee [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Monetary amount of the payment. @@ -268,13 +262,13 @@ public Hl7.Fhir.Model.ResourceReference Recipient [FhirElement("amount", InSummary=true, Order=190)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Issued or cleared Status of the payment. @@ -282,38 +276,34 @@ public Hl7.Fhir.Model.Money Amount [FhirElement("paymentStatus", Order=200)] [Binding("PaymentStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PaymentStatus + public Hl7.Fhir.Model.CodeableConcept? PaymentStatus { get { return _PaymentStatus; } set { _PaymentStatus = value; OnPropertyChanged("PaymentStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _PaymentStatus; + private Hl7.Fhir.Model.CodeableConcept? _PaymentStatus; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentNotice; - - if (dest == null) - { + if(other is not PaymentNotice dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ResourceReference)Payment.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)PaymentDateElement.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(PaymentStatus != null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)PaymentStatus.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ResourceReference)_Payment.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)_PaymentDateElement.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)_Payee.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_PaymentStatus is not null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)_PaymentStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -325,111 +315,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentNotice; - if(otherT == null) return false; + if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(PaymentStatus, otherT.PaymentStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "paymentStatus": - value = PaymentStatus; - return PaymentStatus is not null; + value = _PaymentStatus; + return _PaymentStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payment": - Payment = (Hl7.Fhir.Model.ResourceReference)value; + Payment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.Date)value; + PaymentDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ResourceReference)value; + Payee = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "paymentStatus": - PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)value; + PaymentStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -440,18 +430,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",PaymentStatus); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",_PaymentStatus); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs index fe059e86c..5e6621962 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,26 +83,26 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business identifier of the prior payment detail. /// [FhirElement("predecessor", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Predecessor + public Hl7.Fhir.Model.Identifier? Predecessor { get { return _Predecessor; } set { _Predecessor = value; OnPropertyChanged("Predecessor"); } } - private Hl7.Fhir.Model.Identifier _Predecessor; + private Hl7.Fhir.Model.Identifier? _Predecessor; /// /// Category of payment. @@ -108,13 +111,13 @@ public Hl7.Fhir.Model.Identifier Predecessor [Binding("PaymentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Request giving rise to the payment. @@ -123,13 +126,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Submitter of the request. @@ -138,13 +141,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Submitter + public Hl7.Fhir.Model.ResourceReference? Submitter { get { return _Submitter; } set { _Submitter = value; OnPropertyChanged("Submitter"); } } - private Hl7.Fhir.Model.ResourceReference _Submitter; + private Hl7.Fhir.Model.ResourceReference? _Submitter; /// /// Response committing to a payment. @@ -153,41 +156,38 @@ public Hl7.Fhir.Model.ResourceReference Submitter [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Date of commitment to pay. /// [FhirElement("date", Order=100)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Date of commitment to pay /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -199,13 +199,13 @@ public string Date [CLSCompliant(false)] [References("PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Recipient of the payment. @@ -214,47 +214,43 @@ public Hl7.Fhir.Model.ResourceReference Responsible [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payee + public Hl7.Fhir.Model.ResourceReference? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ResourceReference _Payee; + private Hl7.Fhir.Model.ResourceReference? _Payee; /// /// Amount allocated to this payable. /// [FhirElement("amount", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailsComponent; - - if (dest == null) - { + if(other is not DetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Predecessor != null) dest.Predecessor = (Hl7.Fhir.Model.Identifier)Predecessor.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Submitter != null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)Submitter.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Predecessor is not null) dest.Predecessor = (Hl7.Fhir.Model.Identifier)_Predecessor.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Submitter is not null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)_Submitter.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)_Payee.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -266,97 +262,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailsComponent; - if(otherT == null) return false; + if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Predecessor, otherT.Predecessor)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Submitter, otherT.Submitter)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Submitter, otherT._Submitter)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "predecessor": - value = Predecessor; - return Predecessor is not null; + value = _Predecessor; + return _Predecessor is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "submitter": - value = Submitter; - return Submitter is not null; + value = _Submitter; + return _Submitter is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "predecessor": - Predecessor = (Hl7.Fhir.Model.Identifier)value; + Predecessor = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "submitter": - Submitter = (Hl7.Fhir.Model.ResourceReference)value; + Submitter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ResourceReference)value; + Payee = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -367,16 +363,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Predecessor is not null) yield return new KeyValuePair("predecessor",Predecessor); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Submitter is not null) yield return new KeyValuePair("submitter",Submitter); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Predecessor is not null) yield return new KeyValuePair("predecessor",_Predecessor); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Submitter is not null) yield return new KeyValuePair("submitter",_Submitter); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -404,13 +400,13 @@ public partial class NotesComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("NoteType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// display | print | printoper @@ -419,13 +415,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NoteType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -435,44 +428,37 @@ public Hl7.Fhir.Model.NoteType? Type /// [FhirElement("text", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NotesComponent; - - if (dest == null) - { + if(other is not NotesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -484,41 +470,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotesComponent; - if(otherT == null) return false; + if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -529,8 +515,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -543,11 +529,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -557,13 +543,13 @@ public List Identifier [Binding("PaymentReconciliationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -572,13 +558,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -588,13 +571,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Creation date. @@ -602,28 +585,25 @@ public Hl7.Fhir.Model.Period Period [FhirElement("created", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -635,13 +615,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PaymentIssuer + public Hl7.Fhir.Model.ResourceReference? PaymentIssuer { get { return _PaymentIssuer; } set { _PaymentIssuer = value; OnPropertyChanged("PaymentIssuer"); } } - private Hl7.Fhir.Model.ResourceReference _PaymentIssuer; + private Hl7.Fhir.Model.ResourceReference? _PaymentIssuer; /// /// Reference to requesting resource. @@ -650,13 +630,13 @@ public Hl7.Fhir.Model.ResourceReference PaymentIssuer [CLSCompliant(false)] [References("Task")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Responsible practitioner. @@ -665,13 +645,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// queued | complete | error | partial. @@ -680,13 +660,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [DeclaredType(Type = typeof(Code))] [Binding("RemittanceOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -695,13 +675,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.RemittanceOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -711,28 +688,25 @@ public Hl7.Fhir.Model.RemittanceOutcome? Outcome /// [FhirElement("disposition", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -743,28 +717,25 @@ public string Disposition [FhirElement("paymentDate", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Date PaymentDateElement + public Hl7.Fhir.Model.Date? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.Date _PaymentDateElement; + private Hl7.Fhir.Model.Date? _PaymentDateElement; /// /// When payment issued /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.Date(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("PaymentDate"); } } @@ -775,26 +746,26 @@ public string PaymentDate [FhirElement("paymentAmount", InSummary=true, Order=190)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money PaymentAmount + public Hl7.Fhir.Model.Money? PaymentAmount { get { return _PaymentAmount; } set { _PaymentAmount = value; OnPropertyChanged("PaymentAmount"); } } - private Hl7.Fhir.Model.Money _PaymentAmount; + private Hl7.Fhir.Model.Money? _PaymentAmount; /// /// Business identifier for the payment. /// [FhirElement("paymentIdentifier", Order=200)] [DataMember] - public Hl7.Fhir.Model.Identifier PaymentIdentifier + public Hl7.Fhir.Model.Identifier? PaymentIdentifier { get { return _PaymentIdentifier; } set { _PaymentIdentifier = value; OnPropertyChanged("PaymentIdentifier"); } } - private Hl7.Fhir.Model.Identifier _PaymentIdentifier; + private Hl7.Fhir.Model.Identifier? _PaymentIdentifier; /// /// Settlement particulars. @@ -804,11 +775,11 @@ public Hl7.Fhir.Model.Identifier PaymentIdentifier [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; /// /// Printed form identifier. @@ -816,13 +787,13 @@ public List Detail [FhirElement("formCode", Order=220)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Note concerning processing. @@ -832,39 +803,35 @@ public Hl7.Fhir.Model.CodeableConcept FormCode [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentReconciliation; - - if (dest == null) - { + if(other is not PaymentReconciliation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(PaymentIssuer != null) dest.PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)PaymentIssuer.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)PaymentDateElement.DeepCopyInternal(); - if(PaymentAmount != null) dest.PaymentAmount = (Hl7.Fhir.Model.Money)PaymentAmount.DeepCopyInternal(); - if(PaymentIdentifier != null) dest.PaymentIdentifier = (Hl7.Fhir.Model.Identifier)PaymentIdentifier.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_PaymentIssuer is not null) dest.PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)_PaymentIssuer.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)_PaymentDateElement.DeepCopyInternal(); + if(_PaymentAmount is not null) dest.PaymentAmount = (Hl7.Fhir.Model.Money)_PaymentAmount.DeepCopyInternal(); + if(_PaymentIdentifier is not null) dest.PaymentIdentifier = (Hl7.Fhir.Model.Identifier)_PaymentIdentifier.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -876,132 +843,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentReconciliation; - if(otherT == null) return false; + if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(PaymentIssuer, otherT.PaymentIssuer)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(PaymentAmount, otherT.PaymentAmount)) return false; - if(!comparer.Equals(PaymentIdentifier, otherT.PaymentIdentifier)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_PaymentIssuer, otherT._PaymentIssuer)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_PaymentAmount, otherT._PaymentAmount)) return false; + if(!comparer.Equals(_PaymentIdentifier, otherT._PaymentIdentifier)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "paymentIssuer": - value = PaymentIssuer; - return PaymentIssuer is not null; + value = _PaymentIssuer; + return _PaymentIssuer is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "paymentAmount": - value = PaymentAmount; - return PaymentAmount is not null; + value = _PaymentAmount; + return _PaymentAmount is not null; case "paymentIdentifier": - value = PaymentIdentifier; - return PaymentIdentifier is not null; + value = _PaymentIdentifier; + return _PaymentIdentifier is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "paymentIssuer": - PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)value; + PaymentIssuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.Date)value; + PaymentDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "paymentAmount": - PaymentAmount = (Hl7.Fhir.Model.Money)value; + PaymentAmount = (Hl7.Fhir.Model.Money?)value; return this; case "paymentIdentifier": - PaymentIdentifier = (Hl7.Fhir.Model.Identifier)value; + PaymentIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1012,21 +979,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (PaymentIssuer is not null) yield return new KeyValuePair("paymentIssuer",PaymentIssuer); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (PaymentAmount is not null) yield return new KeyValuePair("paymentAmount",PaymentAmount); - if (PaymentIdentifier is not null) yield return new KeyValuePair("paymentIdentifier",PaymentIdentifier); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_PaymentIssuer is not null) yield return new KeyValuePair("paymentIssuer",_PaymentIssuer); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_PaymentAmount is not null) yield return new KeyValuePair("paymentAmount",_PaymentAmount); + if (_PaymentIdentifier is not null) yield return new KeyValuePair("paymentIdentifier",_PaymentIdentifier); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Person.cs b/src/Hl7.Fhir.R4B/Model/Generated/Person.cs index 0893aa0a8..6dc25ae42 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Person.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,13 +118,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","Practitioner","RelatedPerson","Person")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// level1 | level2 | level3 | level4. @@ -130,13 +133,13 @@ public Hl7.Fhir.Model.ResourceReference Target [DeclaredType(Type = typeof(Code))] [Binding("IdentityAssuranceLevel")] [DataMember] - public Code AssuranceElement + public Code? AssuranceElement { get { return _AssuranceElement; } set { _AssuranceElement = value; OnPropertyChanged("AssuranceElement"); } } - private Code _AssuranceElement; + private Code? _AssuranceElement; /// /// level1 | level2 | level3 | level4 @@ -145,29 +148,22 @@ public Code AssuranceElement [IgnoreDataMember] public Hl7.Fhir.Model.Person.IdentityAssuranceLevel? Assurance { - get { return AssuranceElement != null ? AssuranceElement.Value : null; } + get => _AssuranceElement?.Value; set { - if (value == null) - AssuranceElement = null; - else - AssuranceElement = new Code(value); + AssuranceElement = value is null ? null : new Code(value); OnPropertyChanged("Assurance"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(AssuranceElement != null) dest.AssuranceElement = (Code)AssuranceElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_AssuranceElement is not null) dest.AssuranceElement = (Code)_AssuranceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,41 +175,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(AssuranceElement, otherT.AssuranceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "assurance": - value = AssuranceElement; - return AssuranceElement is not null; + value = _AssuranceElement; + return _AssuranceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assurance": - AssuranceElement = (Code)value; + AssuranceElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -224,8 +220,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target is not null) yield return new KeyValuePair("target",Target); - if (AssuranceElement is not null) yield return new KeyValuePair("assurance",AssuranceElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_AssuranceElement is not null) yield return new KeyValuePair("assurance",_AssuranceElement); } } @@ -238,11 +234,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A name associated with the person. @@ -252,11 +248,11 @@ public List Identifier [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -266,11 +262,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -279,13 +275,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -294,13 +290,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -310,28 +303,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -344,24 +334,24 @@ public string BirthDate [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. /// [FhirElement("photo", Order=150)] [DataMember] - public Hl7.Fhir.Model.Attachment Photo + public Hl7.Fhir.Model.Attachment? Photo { get { return _Photo; } set { _Photo = value; OnPropertyChanged("Photo"); } } - private Hl7.Fhir.Model.Attachment _Photo; + private Hl7.Fhir.Model.Attachment? _Photo; /// /// The organization that is the custodian of the person record. @@ -370,26 +360,26 @@ public Hl7.Fhir.Model.Attachment Photo [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// This person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=170, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// This person's record is in active use @@ -398,13 +388,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -417,34 +404,30 @@ public bool? Active [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Person; - - if (dest == null) - { + if(other is not Person dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo != null) dest.Photo = (Hl7.Fhir.Model.Attachment)Photo.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = (Hl7.Fhir.Model.Attachment)_Photo.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -456,97 +439,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Person; - if(otherT == null) return false; + if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(Photo, otherT.Photo)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_Photo, otherT._Photo)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo is not null; + value = _Photo; + return _Photo is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (Hl7.Fhir.Model.Attachment)value; + Photo = (Hl7.Fhir.Model.Attachment?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -557,16 +540,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo is not null) yield return new KeyValuePair("photo",Photo); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo is not null) yield return new KeyValuePair("photo",_Photo); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs index 0b863e497..c6ae3071f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class GoalComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("GoalCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Code or text describing the goal. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// high-priority | medium-priority | low-priority. @@ -110,13 +113,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [FhirElement("priority", Order=60)] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// When goal pursuit begins. @@ -124,13 +127,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("start", Order=70)] [Binding("GoalStartEvent")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Start + public Hl7.Fhir.Model.CodeableConcept? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.CodeableConcept _Start; + private Hl7.Fhir.Model.CodeableConcept? _Start; /// /// What does the goal address. @@ -141,11 +144,11 @@ public Hl7.Fhir.Model.CodeableConcept Start [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Supporting documentation for the goal. @@ -155,11 +158,11 @@ public List Addresses [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// Target outcome for the goal. @@ -169,29 +172,25 @@ public List Documentation [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as GoalComponent; - - if (dest == null) - { + if(other is not GoalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)Start.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)_Start.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -203,76 +202,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GoalComponent; - if(otherT == null) return false; + if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "start": - Start = (Hl7.Fhir.Model.CodeableConcept)value; + Start = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -283,13 +282,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -316,13 +315,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -331,40 +330,36 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal within. /// [FhirElement("due", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration Due + public Hl7.Fhir.Model.Duration? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.Duration _Due; + private Hl7.Fhir.Model.Duration? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.Duration)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.Duration)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -376,48 +371,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.Duration)value; + Due = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -428,9 +423,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -457,28 +452,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("prefix", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// User-visible prefix for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -488,28 +480,25 @@ public string Prefix /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -519,28 +508,25 @@ public string Title /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Brief description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -550,28 +536,25 @@ public string Description /// [FhirElement("textEquivalent", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextEquivalentElement + public Hl7.Fhir.Model.FhirString? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.FhirString _TextEquivalentElement; + private Hl7.Fhir.Model.FhirString? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.FhirString(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextEquivalent"); } } @@ -583,13 +566,13 @@ public string TextEquivalent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -598,13 +581,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -618,11 +598,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Why the action should be performed. @@ -633,11 +613,11 @@ public List Code [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Supporting documentation for the intended performer of the action. @@ -647,11 +627,11 @@ public List Reason [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// What goals this action supports. @@ -661,24 +641,24 @@ public List Documentation [DataMember] public List GoalIdElement { - get { if(_GoalIdElement==null) _GoalIdElement = new List(); return _GoalIdElement; } + get => _GoalIdElement ?? new List(); set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } - private List _GoalIdElement; + private List? _GoalIdElement; /// /// What goals this action supports /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable GoalId + public IEnumerable? GoalId { - get { return GoalIdElement != null ? GoalIdElement.Select(elem => elem.Value) : null; } + get => _GoalIdElement?.Select(elem => elem.Value); set { if (value == null) - GoalIdElement = null; + GoalIdElement = null!; else GoalIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Id(elem))); OnPropertyChanged("GoalId"); @@ -694,13 +674,13 @@ public IEnumerable GoalId [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// When the action should be triggered. @@ -710,11 +690,11 @@ public Hl7.Fhir.Model.DataType Subject [DataMember] public List Trigger { - get { if(_Trigger==null) _Trigger = new List(); return _Trigger; } + get => _Trigger ?? new List(); set { _Trigger = value; OnPropertyChanged("Trigger"); } } - private List _Trigger; + private List? _Trigger; /// /// Whether or not the action is applicable. @@ -724,11 +704,11 @@ public List Trigger [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Input data requirements. @@ -738,11 +718,11 @@ public List Condition [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Output data definition. @@ -752,11 +732,11 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; /// /// Relationship to another action. @@ -766,11 +746,11 @@ public List Output [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -779,13 +759,13 @@ public List RelatedAction [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Who should participate in the action. @@ -795,11 +775,11 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -807,13 +787,13 @@ public List Participant [FhirElement("type", Order=210)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// visual-group | logical-group | sentence-group. @@ -822,13 +802,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -837,13 +817,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -855,13 +832,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -870,13 +847,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -888,13 +862,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -903,13 +877,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -921,13 +892,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -936,13 +907,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -954,13 +922,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -969,13 +937,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -987,41 +952,38 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// Transform to apply the template. /// [FhirElement("transform", Order=280)] [DataMember] - public Hl7.Fhir.Model.Canonical TransformElement + public Hl7.Fhir.Model.Canonical? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Hl7.Fhir.Model.Canonical _TransformElement; + private Hl7.Fhir.Model.Canonical? _TransformElement; /// /// Transform to apply the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Transform + public string? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Hl7.Fhir.Model.Canonical(value); + TransformElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Transform"); } } @@ -1034,11 +996,11 @@ public string Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; /// /// A sub-action. @@ -1048,49 +1010,45 @@ public List DynamicValue [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)TextEquivalentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(GoalIdElement.Any()) dest.GoalIdElement = new List(GoalIdElement.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(Trigger.Any()) dest.Trigger = new List(Trigger.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)TransformElement.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)_TextEquivalentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_GoalIdElement is not null) dest.GoalIdElement = new List(_GoalIdElement.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_Trigger is not null) dest.Trigger = new List(_Trigger.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)_TransformElement.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1102,216 +1060,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(GoalIdElement, otherT.GoalIdElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Trigger, otherT.Trigger)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_GoalIdElement, otherT._GoalIdElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "goalId": - value = GoalIdElement; - return GoalIdElement?.Any() == true; + value = _GoalIdElement; + return _GoalIdElement?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "trigger": - value = Trigger; - return Trigger?.Any() == true; + value = _Trigger; + return _Trigger?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.FhirString)value; + TextEquivalentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "goalId": - GoalIdElement = (List)value; + GoalIdElement = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "trigger": - Trigger = (List)value; + Trigger = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "transform": - TransformElement = (Hl7.Fhir.Model.Canonical)value; + TransformElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1322,33 +1280,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",GoalIdElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Trigger?.Any() == true) yield return new KeyValuePair("trigger",Trigger); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",_GoalIdElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Trigger?.Any() == true) yield return new KeyValuePair("trigger",_Trigger); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1378,13 +1336,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -1393,13 +1351,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1409,26 +1364,22 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1440,41 +1391,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -1485,8 +1436,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -1514,28 +1465,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ActionIdElement + public Hl7.Fhir.Model.Id? ActionIdElement { get { return _ActionIdElement; } set { _ActionIdElement = value; OnPropertyChanged("ActionIdElement"); } } - private Hl7.Fhir.Model.Id _ActionIdElement; + private Hl7.Fhir.Model.Id? _ActionIdElement; /// /// What action is this related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActionId + public string? ActionId { - get { return ActionIdElement != null ? ActionIdElement.Value : null; } + get => _ActionIdElement?.Value; set { - if (value == null) - ActionIdElement = null; - else - ActionIdElement = new Hl7.Fhir.Model.Id(value); + ActionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ActionId"); } } @@ -1548,13 +1496,13 @@ public string ActionId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end @@ -1563,13 +1511,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -1581,27 +1526,23 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActionIdElement != null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)ActionIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_ActionIdElement is not null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)_ActionIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1613,48 +1554,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActionIdElement, otherT.ActionIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actionId": - value = ActionIdElement; - return ActionIdElement is not null; + value = _ActionIdElement; + return _ActionIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actionId": - ActionIdElement = (Hl7.Fhir.Model.Id)value; + ActionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1665,9 +1606,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActionIdElement is not null) yield return new KeyValuePair("actionId",ActionIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_ActionIdElement is not null) yield return new KeyValuePair("actionId",_ActionIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -1696,13 +1637,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// patient | practitioner | related-person | device @@ -1711,13 +1652,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1728,26 +1666,22 @@ public Hl7.Fhir.Model.ActionParticipantType? Type [FhirElement("role", Order=50)] [Binding("ActionParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1759,41 +1693,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1804,8 +1738,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -1832,28 +1766,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("path", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -1863,26 +1794,22 @@ public string Path /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1894,41 +1821,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -1939,8 +1866,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -1950,28 +1877,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this plan definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1984,39 +1908,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the plan definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2026,28 +1947,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this plan definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2057,28 +1975,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this plan definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2088,28 +2003,25 @@ public string Title /// [FhirElement("subtitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -2120,13 +2032,13 @@ public string Subtitle [FhirElement("type", InSummary=true, Order=150)] [Binding("PlanDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// draft | active | retired | unknown. @@ -2136,13 +2048,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2151,13 +2063,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2167,13 +2076,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2182,13 +2091,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2202,41 +2108,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2246,28 +2149,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2280,39 +2180,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the plan definition. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2325,11 +2222,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for plan definition (if applicable). @@ -2340,39 +2237,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this plan definition is defined. /// [FhirElement("purpose", Order=250, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this plan definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2382,28 +2276,25 @@ public string Purpose /// [FhirElement("usage", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -2413,28 +2304,25 @@ public string Usage /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2444,28 +2332,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the plan definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -2475,28 +2360,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the plan definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2506,13 +2388,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment. @@ -2523,11 +2405,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -2537,11 +2419,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -2551,11 +2433,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -2565,11 +2447,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -2579,11 +2461,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations. @@ -2593,11 +2475,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the plan definition. @@ -2607,24 +2489,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -2639,11 +2521,11 @@ public IEnumerable Library [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Action defined by the plan. @@ -2653,55 +2535,51 @@ public List Goal [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PlanDefinition; - - if (dest == null) - { + if(other is not PlanDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2713,244 +2591,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanDefinition; - if(otherT == null) return false; + if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2961,37 +2839,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Population.cs b/src/Hl7.Fhir.R4B/Model/Generated/Population.cs index 902db41d2..a215df90a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Population.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Population.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,67 +69,63 @@ public partial class Population : Hl7.Fhir.Model.BackboneType [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Age + public Hl7.Fhir.Model.DataType? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.DataType _Age; + private Hl7.Fhir.Model.DataType? _Age; /// /// The gender of the specific population. /// [FhirElement("gender", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Gender + public Hl7.Fhir.Model.CodeableConcept? Gender { get { return _Gender; } set { _Gender = value; OnPropertyChanged("Gender"); } } - private Hl7.Fhir.Model.CodeableConcept _Gender; + private Hl7.Fhir.Model.CodeableConcept? _Gender; /// /// Race of the specific population. /// [FhirElement("race", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Race + public Hl7.Fhir.Model.CodeableConcept? Race { get { return _Race; } set { _Race = value; OnPropertyChanged("Race"); } } - private Hl7.Fhir.Model.CodeableConcept _Race; + private Hl7.Fhir.Model.CodeableConcept? _Race; /// /// The existing physiological conditions of the specific population to which this applies. /// [FhirElement("physiologicalCondition", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PhysiologicalCondition + public Hl7.Fhir.Model.CodeableConcept? PhysiologicalCondition { get { return _PhysiologicalCondition; } set { _PhysiologicalCondition = value; OnPropertyChanged("PhysiologicalCondition"); } } - private Hl7.Fhir.Model.CodeableConcept _PhysiologicalCondition; + private Hl7.Fhir.Model.CodeableConcept? _PhysiologicalCondition; protected internal override void CopyToInternal(Base other) { - var dest = other as Population; - - if (dest == null) - { + if(other is not Population dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Age != null) dest.Age = (Hl7.Fhir.Model.DataType)Age.DeepCopyInternal(); - if(Gender != null) dest.Gender = (Hl7.Fhir.Model.CodeableConcept)Gender.DeepCopyInternal(); - if(Race != null) dest.Race = (Hl7.Fhir.Model.CodeableConcept)Race.DeepCopyInternal(); - if(PhysiologicalCondition != null) dest.PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept)PhysiologicalCondition.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.DataType)_Age.DeepCopyInternal(); + if(_Gender is not null) dest.Gender = (Hl7.Fhir.Model.CodeableConcept)_Gender.DeepCopyInternal(); + if(_Race is not null) dest.Race = (Hl7.Fhir.Model.CodeableConcept)_Race.DeepCopyInternal(); + if(_PhysiologicalCondition is not null) dest.PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept)_PhysiologicalCondition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -138,55 +137,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Population; - if(otherT == null) return false; + if(other is not Population otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(Gender, otherT.Gender)) return false; - if(!comparer.Equals(Race, otherT.Race)) return false; - if(!comparer.Equals(PhysiologicalCondition, otherT.PhysiologicalCondition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_Gender, otherT._Gender)) return false; + if(!comparer.Equals(_Race, otherT._Race)) return false; + if(!comparer.Equals(_PhysiologicalCondition, otherT._PhysiologicalCondition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "gender": - value = Gender; - return Gender is not null; + value = _Gender; + return _Gender is not null; case "race": - value = Race; - return Race is not null; + value = _Race; + return _Race is not null; case "physiologicalCondition": - value = PhysiologicalCondition; - return PhysiologicalCondition is not null; + value = _PhysiologicalCondition; + return _PhysiologicalCondition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "age": - Age = (Hl7.Fhir.Model.DataType)value; + Age = (Hl7.Fhir.Model.DataType?)value; return this; case "gender": - Gender = (Hl7.Fhir.Model.CodeableConcept)value; + Gender = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "race": - Race = (Hl7.Fhir.Model.CodeableConcept)value; + Race = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "physiologicalCondition": - PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept)value; + PhysiologicalCondition = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -197,10 +196,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Age is not null) yield return new KeyValuePair("age",Age); - if (Gender is not null) yield return new KeyValuePair("gender",Gender); - if (Race is not null) yield return new KeyValuePair("race",Race); - if (PhysiologicalCondition is not null) yield return new KeyValuePair("physiologicalCondition",PhysiologicalCondition); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_Gender is not null) yield return new KeyValuePair("gender",_Gender); + if (_Race is not null) yield return new KeyValuePair("race",_Race); + if (_PhysiologicalCondition is not null) yield return new KeyValuePair("physiologicalCondition",_PhysiologicalCondition); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs index e0257bb2f..adcbe0745 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -83,11 +86,11 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Coded representation of the qualification. @@ -96,26 +99,26 @@ public List Identifier [Binding("Qualification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Period during which the qualification is valid. /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that regulates and issues the qualification. @@ -124,28 +127,24 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; protected internal override void CopyToInternal(Base other) { - var dest = other as QualificationComponent; - - if (dest == null) - { + if(other is not QualificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -157,55 +156,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualificationComponent; - if(otherT == null) return false; + if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -216,10 +215,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); } } @@ -232,24 +231,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner's record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner's record is in active use @@ -258,13 +257,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -277,11 +273,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the practitioner (that apply to all roles). @@ -291,11 +287,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address(es) of the practitioner that are not role specific (typically home address). @@ -305,11 +301,11 @@ public List Telecom [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// male | female | other | unknown. @@ -318,13 +314,13 @@ public List Address [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -333,13 +329,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -349,28 +342,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the practitioner was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -383,11 +373,11 @@ public string BirthDate [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Certification, licenses, or training pertaining to the provision of care. @@ -397,11 +387,11 @@ public List Photo [DataMember] public List Qualification { - get { if(_Qualification==null) _Qualification = new List(); return _Qualification; } + get => _Qualification ?? new List(); set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private List _Qualification; + private List? _Qualification; /// /// A language the practitioner can use in patient communication. @@ -412,34 +402,30 @@ public List Qualification [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Practitioner; - - if (dest == null) - { + if(other is not Practitioner dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Qualification.Any()) dest.Qualification = new List(Qualification.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Qualification is not null) dest.Qualification = new List(_Qualification.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -451,97 +437,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Practitioner; - if(otherT == null) return false; + if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Qualification, otherT.Qualification)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "qualification": - value = Qualification; - return Qualification?.Any() == true; + value = _Qualification; + return _Qualification?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "qualification": - Qualification = (List)value; + Qualification = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -552,16 +538,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Qualification?.Any() == true) yield return new KeyValuePair("qualification",Qualification); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Qualification?.Any() == true) yield return new KeyValuePair("qualification",_Qualification); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs index be49917d1..579005148 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -86,24 +89,24 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -115,13 +118,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// Always available? e.g. 24 hour service @@ -130,13 +133,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -146,28 +146,25 @@ public bool? AllDay /// [FhirElement("availableStartTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.Time AvailableStartTimeElement + public Hl7.Fhir.Model.Time? AvailableStartTimeElement { get { return _AvailableStartTimeElement; } set { _AvailableStartTimeElement = value; OnPropertyChanged("AvailableStartTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableStartTimeElement; + private Hl7.Fhir.Model.Time? _AvailableStartTimeElement; /// /// Opening time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableStartTime + public string? AvailableStartTime { - get { return AvailableStartTimeElement != null ? AvailableStartTimeElement.Value : null; } + get => _AvailableStartTimeElement?.Value; set { - if (value == null) - AvailableStartTimeElement = null; - else - AvailableStartTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableStartTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableStartTime"); } } @@ -177,46 +174,39 @@ public string AvailableStartTime /// [FhirElement("availableEndTime", Order=70)] [DataMember] - public Hl7.Fhir.Model.Time AvailableEndTimeElement + public Hl7.Fhir.Model.Time? AvailableEndTimeElement { get { return _AvailableEndTimeElement; } set { _AvailableEndTimeElement = value; OnPropertyChanged("AvailableEndTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableEndTimeElement; + private Hl7.Fhir.Model.Time? _AvailableEndTimeElement; /// /// Closing time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableEndTime + public string? AvailableEndTime { - get { return AvailableEndTimeElement != null ? AvailableEndTimeElement.Value : null; } + get => _AvailableEndTimeElement?.Value; set { - if (value == null) - AvailableEndTimeElement = null; - else - AvailableEndTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableEndTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableEndTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AvailableTimeComponent; - - if (dest == null) - { + if(other is not AvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(AvailableStartTimeElement != null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)AvailableStartTimeElement.DeepCopyInternal(); - if(AvailableEndTimeElement != null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)AvailableEndTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_AvailableStartTimeElement is not null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)_AvailableStartTimeElement.DeepCopyInternal(); + if(_AvailableEndTimeElement is not null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)_AvailableEndTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -228,55 +218,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AvailableTimeComponent; - if(otherT == null) return false; + if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(AvailableStartTimeElement, otherT.AvailableStartTimeElement)) return false; - if(!comparer.Equals(AvailableEndTimeElement, otherT.AvailableEndTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; + if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "availableStartTime": - value = AvailableStartTimeElement; - return AvailableStartTimeElement is not null; + value = _AvailableStartTimeElement; + return _AvailableStartTimeElement is not null; case "availableEndTime": - value = AvailableEndTimeElement; - return AvailableEndTimeElement is not null; + value = _AvailableEndTimeElement; + return _AvailableEndTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableStartTime": - AvailableStartTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableStartTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "availableEndTime": - AvailableEndTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableEndTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -287,10 +277,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",AvailableStartTimeElement); - if (AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",AvailableEndTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",_AvailableStartTimeElement); + if (_AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",_AvailableEndTimeElement); } } @@ -317,28 +307,25 @@ public partial class NotAvailableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason presented to the user explaining why time not available /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -348,26 +335,22 @@ public string Description /// [FhirElement("during", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period During + public Hl7.Fhir.Model.Period? During { get { return _During; } set { _During = value; OnPropertyChanged("During"); } } - private Hl7.Fhir.Model.Period _During; + private Hl7.Fhir.Model.Period? _During; protected internal override void CopyToInternal(Base other) { - var dest = other as NotAvailableComponent; - - if (dest == null) - { + if(other is not NotAvailableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(During != null) dest.During = (Hl7.Fhir.Model.Period)During.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_During is not null) dest.During = (Hl7.Fhir.Model.Period)_During.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -379,41 +362,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotAvailableComponent; - if(otherT == null) return false; + if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(During, otherT.During)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_During, otherT._During)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "during": - value = During; - return During is not null; + value = _During; + return _During is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "during": - During = (Hl7.Fhir.Model.Period)value; + During = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -424,8 +407,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (During is not null) yield return new KeyValuePair("during",During); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_During is not null) yield return new KeyValuePair("during",_During); } } @@ -438,24 +421,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner role record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner role record is in active use @@ -464,13 +447,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -480,13 +460,13 @@ public bool? Active /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Practitioner that is able to provide the defined services for the organization. @@ -495,13 +475,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Practitioner + public Hl7.Fhir.Model.ResourceReference? Practitioner { get { return _Practitioner; } set { _Practitioner = value; OnPropertyChanged("Practitioner"); } } - private Hl7.Fhir.Model.ResourceReference _Practitioner; + private Hl7.Fhir.Model.ResourceReference? _Practitioner; /// /// Organization where the roles are available. @@ -510,13 +490,13 @@ public Hl7.Fhir.Model.ResourceReference Practitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Roles which this practitioner may perform. @@ -527,11 +507,11 @@ public Hl7.Fhir.Model.ResourceReference Organization [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Specific specialty of the practitioner. @@ -542,11 +522,11 @@ public List Code [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The location(s) at which this practitioner provides care. @@ -558,11 +538,11 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// The list of healthcare services that this worker provides for this role's Organization/Location(s). @@ -574,11 +554,11 @@ public List Location [DataMember] public List HealthcareService { - get { if(_HealthcareService==null) _HealthcareService = new List(); return _HealthcareService; } + get => _HealthcareService ?? new List(); set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } - private List _HealthcareService; + private List? _HealthcareService; /// /// Contact details that are specific to the role/location/service. @@ -588,11 +568,11 @@ public List HealthcareService [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Times the Service Site is available. @@ -602,11 +582,11 @@ public List Telecom [DataMember] public List AvailableTime { - get { if(_AvailableTime==null) _AvailableTime = new List(); return _AvailableTime; } + get => _AvailableTime ?? new List(); set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } - private List _AvailableTime; + private List? _AvailableTime; /// /// Not available during this time due to provided reason. @@ -616,39 +596,36 @@ public List AvailableTim [DataMember] public List NotAvailable { - get { if(_NotAvailable==null) _NotAvailable = new List(); return _NotAvailable; } + get => _NotAvailable ?? new List(); set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } - private List _NotAvailable; + private List? _NotAvailable; /// /// Description of availability exceptions. /// [FhirElement("availabilityExceptions", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString AvailabilityExceptionsElement + public Hl7.Fhir.Model.FhirString? AvailabilityExceptionsElement { get { return _AvailabilityExceptionsElement; } set { _AvailabilityExceptionsElement = value; OnPropertyChanged("AvailabilityExceptionsElement"); } } - private Hl7.Fhir.Model.FhirString _AvailabilityExceptionsElement; + private Hl7.Fhir.Model.FhirString? _AvailabilityExceptionsElement; /// /// Description of availability exceptions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailabilityExceptions + public string? AvailabilityExceptions { - get { return AvailabilityExceptionsElement != null ? AvailabilityExceptionsElement.Value : null; } + get => _AvailabilityExceptionsElement?.Value; set { - if (value == null) - AvailabilityExceptionsElement = null; - else - AvailabilityExceptionsElement = new Hl7.Fhir.Model.FhirString(value); + AvailabilityExceptionsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AvailabilityExceptions"); } } @@ -663,38 +640,34 @@ public string AvailabilityExceptions [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PractitionerRole; - - if (dest == null) - { + if(other is not PractitionerRole dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Practitioner != null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)Practitioner.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(HealthcareService.Any()) dest.HealthcareService = new List(HealthcareService.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(AvailableTime.Any()) dest.AvailableTime = new List(AvailableTime.DeepCopyInternal()); - if(NotAvailable.Any()) dest.NotAvailable = new List(NotAvailable.DeepCopyInternal()); - if(AvailabilityExceptionsElement != null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)AvailabilityExceptionsElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Practitioner is not null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)_Practitioner.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_HealthcareService is not null) dest.HealthcareService = new List(_HealthcareService.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_AvailableTime is not null) dest.AvailableTime = new List(_AvailableTime.DeepCopyInternal()); + if(_NotAvailable is not null) dest.NotAvailable = new List(_NotAvailable.DeepCopyInternal()); + if(_AvailabilityExceptionsElement is not null) dest.AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)_AvailabilityExceptionsElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -706,125 +679,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PractitionerRole; - if(otherT == null) return false; + if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Practitioner, otherT.Practitioner)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(HealthcareService, otherT.HealthcareService)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(AvailableTime, otherT.AvailableTime)) return false; - if(!comparer.ListEquals(NotAvailable, otherT.NotAvailable)) return false; - if(!comparer.Equals(AvailabilityExceptionsElement, otherT.AvailabilityExceptionsElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; + if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "practitioner": - value = Practitioner; - return Practitioner is not null; + value = _Practitioner; + return _Practitioner is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "healthcareService": - value = HealthcareService; - return HealthcareService?.Any() == true; + value = _HealthcareService; + return _HealthcareService?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "availableTime": - value = AvailableTime; - return AvailableTime?.Any() == true; + value = _AvailableTime; + return _AvailableTime?.Any() == true; case "notAvailable": - value = NotAvailable; - return NotAvailable?.Any() == true; + value = _NotAvailable; + return _NotAvailable?.Any() == true; case "availabilityExceptions": - value = AvailabilityExceptionsElement; - return AvailabilityExceptionsElement is not null; + value = _AvailabilityExceptionsElement; + return _AvailabilityExceptionsElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "practitioner": - Practitioner = (Hl7.Fhir.Model.ResourceReference)value; + Practitioner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "healthcareService": - HealthcareService = (List)value; + HealthcareService = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "availableTime": - AvailableTime = (List)value; + AvailableTime = (List?)value!; return this; case "notAvailable": - NotAvailable = (List)value; + NotAvailable = (List?)value!; return this; case "availabilityExceptions": - AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString)value; + AvailabilityExceptionsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -835,20 +808,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Practitioner is not null) yield return new KeyValuePair("practitioner",Practitioner); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",HealthcareService); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",AvailableTime); - if (NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",NotAvailable); - if (AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",AvailabilityExceptionsElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Practitioner is not null) yield return new KeyValuePair("practitioner",_Practitioner); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",_HealthcareService); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",_AvailableTime); + if (_NotAvailable?.Any() == true) yield return new KeyValuePair("notAvailable",_NotAvailable); + if (_AvailabilityExceptionsElement is not null) yield return new KeyValuePair("availabilityExceptions",_AvailabilityExceptionsElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs index ad3dfb9b9..795ab52ed 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("ProcedurePerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// The reference to the practitioner. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Organization the device or practitioner was acting for. @@ -112,27 +115,23 @@ public Hl7.Fhir.Model.ResourceReference Actor [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -144,48 +143,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -196,9 +195,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -225,13 +224,13 @@ public partial class FocalDeviceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("action", Order=40)] [Binding("DeviceActionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Device that was changed. @@ -241,26 +240,22 @@ public Hl7.Fhir.Model.CodeableConcept Action [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manipulated + public Hl7.Fhir.Model.ResourceReference? Manipulated { get { return _Manipulated; } set { _Manipulated = value; OnPropertyChanged("Manipulated"); } } - private Hl7.Fhir.Model.ResourceReference _Manipulated; + private Hl7.Fhir.Model.ResourceReference? _Manipulated; protected internal override void CopyToInternal(Base other) { - var dest = other as FocalDeviceComponent; - - if (dest == null) - { + if(other is not FocalDeviceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(Manipulated != null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)Manipulated.DeepCopyInternal(); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_Manipulated is not null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)_Manipulated.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,41 +267,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocalDeviceComponent; - if(otherT == null) return false; + if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(Manipulated, otherT.Manipulated)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "manipulated": - value = Manipulated; - return Manipulated is not null; + value = _Manipulated; + return _Manipulated is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manipulated": - Manipulated = (Hl7.Fhir.Model.ResourceReference)value; + Manipulated = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -317,8 +312,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (Manipulated is not null) yield return new KeyValuePair("manipulated",Manipulated); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_Manipulated is not null) yield return new KeyValuePair("manipulated",_Manipulated); } } @@ -331,11 +326,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -345,24 +340,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -377,24 +372,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -411,11 +406,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -427,11 +422,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -441,13 +436,13 @@ public List PartOf [Binding("ProcedureStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -456,13 +451,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -473,13 +465,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("statusReason", InSummary=true, Order=150)] [Binding("ProcedureNegationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Classification of the procedure. @@ -487,13 +479,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [FhirElement("category", InSummary=true, Order=160, FiveWs="FiveWs.class")] [Binding("ProcedureCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Identification of the procedure. @@ -501,13 +493,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", InSummary=true, Order=170, FiveWs="FiveWs.what[x]")] [Binding("ProcedureCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the procedure was performed on. @@ -517,13 +509,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -532,13 +524,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the procedure was performed. @@ -547,13 +539,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Performed + public Hl7.Fhir.Model.DataType? Performed { get { return _Performed; } set { _Performed = value; OnPropertyChanged("Performed"); } } - private Hl7.Fhir.Model.DataType _Performed; + private Hl7.Fhir.Model.DataType? _Performed; /// /// Who recorded the procedure. @@ -562,13 +554,13 @@ public Hl7.Fhir.Model.DataType Performed [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Person who asserts this procedure. @@ -577,13 +569,13 @@ public Hl7.Fhir.Model.ResourceReference Recorder [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// The people who performed the procedure. @@ -593,11 +585,11 @@ public Hl7.Fhir.Model.ResourceReference Asserter [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the procedure happened. @@ -606,13 +598,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Coded reason procedure performed. @@ -623,11 +615,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// The justification that the procedure was performed. @@ -639,11 +631,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Target body sites. @@ -654,11 +646,11 @@ public List ReasonReference [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// The result of procedure. @@ -666,13 +658,13 @@ public List BodySite [FhirElement("outcome", InSummary=true, Order=280)] [Binding("ProcedureOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Any report resulting from the procedure. @@ -684,11 +676,11 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [DataMember] public List Report { - get { if(_Report==null) _Report = new List(); return _Report; } + get => _Report ?? new List(); set { _Report = value; OnPropertyChanged("Report"); } } - private List _Report; + private List? _Report; /// /// Complication following the procedure. @@ -699,11 +691,11 @@ public List Report [DataMember] public List Complication { - get { if(_Complication==null) _Complication = new List(); return _Complication; } + get => _Complication ?? new List(); set { _Complication = value; OnPropertyChanged("Complication"); } } - private List _Complication; + private List? _Complication; /// /// A condition that is a result of the procedure. @@ -715,11 +707,11 @@ public List Complication [DataMember] public List ComplicationDetail { - get { if(_ComplicationDetail==null) _ComplicationDetail = new List(); return _ComplicationDetail; } + get => _ComplicationDetail ?? new List(); set { _ComplicationDetail = value; OnPropertyChanged("ComplicationDetail"); } } - private List _ComplicationDetail; + private List? _ComplicationDetail; /// /// Instructions for follow up. @@ -730,11 +722,11 @@ public List ComplicationDetail [DataMember] public List FollowUp { - get { if(_FollowUp==null) _FollowUp = new List(); return _FollowUp; } + get => _FollowUp ?? new List(); set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } - private List _FollowUp; + private List? _FollowUp; /// /// Additional information about the procedure. @@ -744,11 +736,11 @@ public List FollowUp [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Manipulated, implanted, or removed device. @@ -758,11 +750,11 @@ public List Note [DataMember] public List FocalDevice { - get { if(_FocalDevice==null) _FocalDevice = new List(); return _FocalDevice; } + get => _FocalDevice ?? new List(); set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } - private List _FocalDevice; + private List? _FocalDevice; /// /// Items used during procedure. @@ -774,11 +766,11 @@ public List FocalDevice [DataMember] public List UsedReference { - get { if(_UsedReference==null) _UsedReference = new List(); return _UsedReference; } + get => _UsedReference ?? new List(); set { _UsedReference = value; OnPropertyChanged("UsedReference"); } } - private List _UsedReference; + private List? _UsedReference; /// /// Coded items used during the procedure. @@ -789,52 +781,48 @@ public List UsedReference [DataMember] public List UsedCode { - get { if(_UsedCode==null) _UsedCode = new List(); return _UsedCode; } + get => _UsedCode ?? new List(); set { _UsedCode = value; OnPropertyChanged("UsedCode"); } } - private List _UsedCode; + private List? _UsedCode; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Procedure; - - if (dest == null) - { + if(other is not Procedure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Performed != null) dest.Performed = (Hl7.Fhir.Model.DataType)Performed.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Report.Any()) dest.Report = new List(Report.DeepCopyInternal()); - if(Complication.Any()) dest.Complication = new List(Complication.DeepCopyInternal()); - if(ComplicationDetail.Any()) dest.ComplicationDetail = new List(ComplicationDetail.DeepCopyInternal()); - if(FollowUp.Any()) dest.FollowUp = new List(FollowUp.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(FocalDevice.Any()) dest.FocalDevice = new List(FocalDevice.DeepCopyInternal()); - if(UsedReference.Any()) dest.UsedReference = new List(UsedReference.DeepCopyInternal()); - if(UsedCode.Any()) dest.UsedCode = new List(UsedCode.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Performed is not null) dest.Performed = (Hl7.Fhir.Model.DataType)_Performed.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Report is not null) dest.Report = new List(_Report.DeepCopyInternal()); + if(_Complication is not null) dest.Complication = new List(_Complication.DeepCopyInternal()); + if(_ComplicationDetail is not null) dest.ComplicationDetail = new List(_ComplicationDetail.DeepCopyInternal()); + if(_FollowUp is not null) dest.FollowUp = new List(_FollowUp.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_FocalDevice is not null) dest.FocalDevice = new List(_FocalDevice.DeepCopyInternal()); + if(_UsedReference is not null) dest.UsedReference = new List(_UsedReference.DeepCopyInternal()); + if(_UsedCode is not null) dest.UsedCode = new List(_UsedCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -846,223 +834,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Procedure; - if(otherT == null) return false; + if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Performed, otherT.Performed)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.ListEquals(Report, otherT.Report)) return false; - if(!comparer.ListEquals(Complication, otherT.Complication)) return false; - if(!comparer.ListEquals(ComplicationDetail, otherT.ComplicationDetail)) return false; - if(!comparer.ListEquals(FollowUp, otherT.FollowUp)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(FocalDevice, otherT.FocalDevice)) return false; - if(!comparer.ListEquals(UsedReference, otherT.UsedReference)) return false; - if(!comparer.ListEquals(UsedCode, otherT.UsedCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Performed, otherT._Performed)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.ListEquals(_Report, otherT._Report)) return false; + if(!comparer.ListEquals(_Complication, otherT._Complication)) return false; + if(!comparer.ListEquals(_ComplicationDetail, otherT._ComplicationDetail)) return false; + if(!comparer.ListEquals(_FollowUp, otherT._FollowUp)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; + if(!comparer.ListEquals(_UsedReference, otherT._UsedReference)) return false; + if(!comparer.ListEquals(_UsedCode, otherT._UsedCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "performed": - value = Performed; - return Performed is not null; + value = _Performed; + return _Performed is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "report": - value = Report; - return Report?.Any() == true; + value = _Report; + return _Report?.Any() == true; case "complication": - value = Complication; - return Complication?.Any() == true; + value = _Complication; + return _Complication?.Any() == true; case "complicationDetail": - value = ComplicationDetail; - return ComplicationDetail?.Any() == true; + value = _ComplicationDetail; + return _ComplicationDetail?.Any() == true; case "followUp": - value = FollowUp; - return FollowUp?.Any() == true; + value = _FollowUp; + return _FollowUp?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "focalDevice": - value = FocalDevice; - return FocalDevice?.Any() == true; + value = _FocalDevice; + return _FocalDevice?.Any() == true; case "usedReference": - value = UsedReference; - return UsedReference?.Any() == true; + value = _UsedReference; + return _UsedReference?.Any() == true; case "usedCode": - value = UsedCode; - return UsedCode?.Any() == true; + value = _UsedCode; + return _UsedCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performed": - Performed = (Hl7.Fhir.Model.DataType)value; + Performed = (Hl7.Fhir.Model.DataType?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "report": - Report = (List)value; + Report = (List?)value!; return this; case "complication": - Complication = (List)value; + Complication = (List?)value!; return this; case "complicationDetail": - ComplicationDetail = (List)value; + ComplicationDetail = (List?)value!; return this; case "followUp": - FollowUp = (List)value; + FollowUp = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "focalDevice": - FocalDevice = (List)value; + FocalDevice = (List?)value!; return this; case "usedReference": - UsedReference = (List)value; + UsedReference = (List?)value!; return this; case "usedCode": - UsedCode = (List)value; + UsedCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1073,34 +1061,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Performed is not null) yield return new KeyValuePair("performed",Performed); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Report?.Any() == true) yield return new KeyValuePair("report",Report); - if (Complication?.Any() == true) yield return new KeyValuePair("complication",Complication); - if (ComplicationDetail?.Any() == true) yield return new KeyValuePair("complicationDetail",ComplicationDetail); - if (FollowUp?.Any() == true) yield return new KeyValuePair("followUp",FollowUp); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",FocalDevice); - if (UsedReference?.Any() == true) yield return new KeyValuePair("usedReference",UsedReference); - if (UsedCode?.Any() == true) yield return new KeyValuePair("usedCode",UsedCode); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Performed is not null) yield return new KeyValuePair("performed",_Performed); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Report?.Any() == true) yield return new KeyValuePair("report",_Report); + if (_Complication?.Any() == true) yield return new KeyValuePair("complication",_Complication); + if (_ComplicationDetail?.Any() == true) yield return new KeyValuePair("complicationDetail",_ComplicationDetail); + if (_FollowUp?.Any() == true) yield return new KeyValuePair("followUp",_FollowUp); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",_FocalDevice); + if (_UsedReference?.Any() == true) yield return new KeyValuePair("usedReference",_UsedReference); + if (_UsedCode?.Any() == true) yield return new KeyValuePair("usedCode",_UsedCode); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs index e3dd09bf4..b69467790 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,106 +64,103 @@ public partial class ProdCharacteristic : Hl7.Fhir.Model.BackboneType /// [FhirElement("height", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Height + public Hl7.Fhir.Model.Quantity? Height { get { return _Height; } set { _Height = value; OnPropertyChanged("Height"); } } - private Hl7.Fhir.Model.Quantity _Height; + private Hl7.Fhir.Model.Quantity? _Height; /// /// Where applicable, the width can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("width", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Width + public Hl7.Fhir.Model.Quantity? Width { get { return _Width; } set { _Width = value; OnPropertyChanged("Width"); } } - private Hl7.Fhir.Model.Quantity _Width; + private Hl7.Fhir.Model.Quantity? _Width; /// /// Where applicable, the depth can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("depth", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Depth + public Hl7.Fhir.Model.Quantity? Depth { get { return _Depth; } set { _Depth = value; OnPropertyChanged("Depth"); } } - private Hl7.Fhir.Model.Quantity _Depth; + private Hl7.Fhir.Model.Quantity? _Depth; /// /// Where applicable, the weight can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("weight", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Weight + public Hl7.Fhir.Model.Quantity? Weight { get { return _Weight; } set { _Weight = value; OnPropertyChanged("Weight"); } } - private Hl7.Fhir.Model.Quantity _Weight; + private Hl7.Fhir.Model.Quantity? _Weight; /// /// Where applicable, the nominal volume can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("nominalVolume", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity NominalVolume + public Hl7.Fhir.Model.Quantity? NominalVolume { get { return _NominalVolume; } set { _NominalVolume = value; OnPropertyChanged("NominalVolume"); } } - private Hl7.Fhir.Model.Quantity _NominalVolume; + private Hl7.Fhir.Model.Quantity? _NominalVolume; /// /// Where applicable, the external diameter can be specified using a numerical value and its unit of measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. /// [FhirElement("externalDiameter", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Quantity ExternalDiameter + public Hl7.Fhir.Model.Quantity? ExternalDiameter { get { return _ExternalDiameter; } set { _ExternalDiameter = value; OnPropertyChanged("ExternalDiameter"); } } - private Hl7.Fhir.Model.Quantity _ExternalDiameter; + private Hl7.Fhir.Model.Quantity? _ExternalDiameter; /// /// Where applicable, the shape can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used. /// [FhirElement("shape", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString ShapeElement + public Hl7.Fhir.Model.FhirString? ShapeElement { get { return _ShapeElement; } set { _ShapeElement = value; OnPropertyChanged("ShapeElement"); } } - private Hl7.Fhir.Model.FhirString _ShapeElement; + private Hl7.Fhir.Model.FhirString? _ShapeElement; /// /// Where applicable, the shape can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Shape + public string? Shape { - get { return ShapeElement != null ? ShapeElement.Value : null; } + get => _ShapeElement?.Value; set { - if (value == null) - ShapeElement = null; - else - ShapeElement = new Hl7.Fhir.Model.FhirString(value); + ShapeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Shape"); } } @@ -173,24 +173,24 @@ public string Shape [DataMember] public List ColorElement { - get { if(_ColorElement==null) _ColorElement = new List(); return _ColorElement; } + get => _ColorElement ?? new List(); set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private List _ColorElement; + private List? _ColorElement; /// /// Where applicable, the color can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Color + public IEnumerable? Color { - get { return ColorElement != null ? ColorElement.Select(elem => elem.Value) : null; } + get => _ColorElement?.Select(elem => elem.Value); set { if (value == null) - ColorElement = null; + ColorElement = null!; else ColorElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Color"); @@ -205,24 +205,24 @@ public IEnumerable Color [DataMember] public List ImprintElement { - get { if(_ImprintElement==null) _ImprintElement = new List(); return _ImprintElement; } + get => _ImprintElement ?? new List(); set { _ImprintElement = value; OnPropertyChanged("ImprintElement"); } } - private List _ImprintElement; + private List? _ImprintElement; /// /// Where applicable, the imprint can be specified as text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Imprint + public IEnumerable? Imprint { - get { return ImprintElement != null ? ImprintElement.Select(elem => elem.Value) : null; } + get => _ImprintElement?.Select(elem => elem.Value); set { if (value == null) - ImprintElement = null; + ImprintElement = null!; else ImprintElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Imprint"); @@ -237,46 +237,42 @@ public IEnumerable Imprint [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; /// /// Where applicable, the scoring can be specified An appropriate controlled vocabulary shall be used The term and the term identifier shall be used. /// [FhirElement("scoring", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; protected internal override void CopyToInternal(Base other) { - var dest = other as ProdCharacteristic; - - if (dest == null) - { + if(other is not ProdCharacteristic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Height != null) dest.Height = (Hl7.Fhir.Model.Quantity)Height.DeepCopyInternal(); - if(Width != null) dest.Width = (Hl7.Fhir.Model.Quantity)Width.DeepCopyInternal(); - if(Depth != null) dest.Depth = (Hl7.Fhir.Model.Quantity)Depth.DeepCopyInternal(); - if(Weight != null) dest.Weight = (Hl7.Fhir.Model.Quantity)Weight.DeepCopyInternal(); - if(NominalVolume != null) dest.NominalVolume = (Hl7.Fhir.Model.Quantity)NominalVolume.DeepCopyInternal(); - if(ExternalDiameter != null) dest.ExternalDiameter = (Hl7.Fhir.Model.Quantity)ExternalDiameter.DeepCopyInternal(); - if(ShapeElement != null) dest.ShapeElement = (Hl7.Fhir.Model.FhirString)ShapeElement.DeepCopyInternal(); - if(ColorElement.Any()) dest.ColorElement = new List(ColorElement.DeepCopyInternal()); - if(ImprintElement.Any()) dest.ImprintElement = new List(ImprintElement.DeepCopyInternal()); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); + if(_Height is not null) dest.Height = (Hl7.Fhir.Model.Quantity)_Height.DeepCopyInternal(); + if(_Width is not null) dest.Width = (Hl7.Fhir.Model.Quantity)_Width.DeepCopyInternal(); + if(_Depth is not null) dest.Depth = (Hl7.Fhir.Model.Quantity)_Depth.DeepCopyInternal(); + if(_Weight is not null) dest.Weight = (Hl7.Fhir.Model.Quantity)_Weight.DeepCopyInternal(); + if(_NominalVolume is not null) dest.NominalVolume = (Hl7.Fhir.Model.Quantity)_NominalVolume.DeepCopyInternal(); + if(_ExternalDiameter is not null) dest.ExternalDiameter = (Hl7.Fhir.Model.Quantity)_ExternalDiameter.DeepCopyInternal(); + if(_ShapeElement is not null) dest.ShapeElement = (Hl7.Fhir.Model.FhirString)_ShapeElement.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = new List(_ColorElement.DeepCopyInternal()); + if(_ImprintElement is not null) dest.ImprintElement = new List(_ImprintElement.DeepCopyInternal()); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -288,104 +284,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProdCharacteristic; - if(otherT == null) return false; + if(other is not ProdCharacteristic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Height, otherT.Height)) return false; - if(!comparer.Equals(Width, otherT.Width)) return false; - if(!comparer.Equals(Depth, otherT.Depth)) return false; - if(!comparer.Equals(Weight, otherT.Weight)) return false; - if(!comparer.Equals(NominalVolume, otherT.NominalVolume)) return false; - if(!comparer.Equals(ExternalDiameter, otherT.ExternalDiameter)) return false; - if(!comparer.Equals(ShapeElement, otherT.ShapeElement)) return false; - if(!comparer.ListEquals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.ListEquals(ImprintElement, otherT.ImprintElement)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Height, otherT._Height)) return false; + if(!comparer.Equals(_Width, otherT._Width)) return false; + if(!comparer.Equals(_Depth, otherT._Depth)) return false; + if(!comparer.Equals(_Weight, otherT._Weight)) return false; + if(!comparer.Equals(_NominalVolume, otherT._NominalVolume)) return false; + if(!comparer.Equals(_ExternalDiameter, otherT._ExternalDiameter)) return false; + if(!comparer.Equals(_ShapeElement, otherT._ShapeElement)) return false; + if(!comparer.ListEquals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.ListEquals(_ImprintElement, otherT._ImprintElement)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "height": - value = Height; - return Height is not null; + value = _Height; + return _Height is not null; case "width": - value = Width; - return Width is not null; + value = _Width; + return _Width is not null; case "depth": - value = Depth; - return Depth is not null; + value = _Depth; + return _Depth is not null; case "weight": - value = Weight; - return Weight is not null; + value = _Weight; + return _Weight is not null; case "nominalVolume": - value = NominalVolume; - return NominalVolume is not null; + value = _NominalVolume; + return _NominalVolume is not null; case "externalDiameter": - value = ExternalDiameter; - return ExternalDiameter is not null; + value = _ExternalDiameter; + return _ExternalDiameter is not null; case "shape": - value = ShapeElement; - return ShapeElement is not null; + value = _ShapeElement; + return _ShapeElement is not null; case "color": - value = ColorElement; - return ColorElement?.Any() == true; + value = _ColorElement; + return _ColorElement?.Any() == true; case "imprint": - value = ImprintElement; - return ImprintElement?.Any() == true; + value = _ImprintElement; + return _ImprintElement?.Any() == true; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "height": - Height = (Hl7.Fhir.Model.Quantity)value; + Height = (Hl7.Fhir.Model.Quantity?)value; return this; case "width": - Width = (Hl7.Fhir.Model.Quantity)value; + Width = (Hl7.Fhir.Model.Quantity?)value; return this; case "depth": - Depth = (Hl7.Fhir.Model.Quantity)value; + Depth = (Hl7.Fhir.Model.Quantity?)value; return this; case "weight": - Weight = (Hl7.Fhir.Model.Quantity)value; + Weight = (Hl7.Fhir.Model.Quantity?)value; return this; case "nominalVolume": - NominalVolume = (Hl7.Fhir.Model.Quantity)value; + NominalVolume = (Hl7.Fhir.Model.Quantity?)value; return this; case "externalDiameter": - ExternalDiameter = (Hl7.Fhir.Model.Quantity)value; + ExternalDiameter = (Hl7.Fhir.Model.Quantity?)value; return this; case "shape": - ShapeElement = (Hl7.Fhir.Model.FhirString)value; + ShapeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "color": - ColorElement = (List)value; + ColorElement = (List?)value!; return this; case "imprint": - ImprintElement = (List)value; + ImprintElement = (List?)value!; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -396,17 +392,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Height is not null) yield return new KeyValuePair("height",Height); - if (Width is not null) yield return new KeyValuePair("width",Width); - if (Depth is not null) yield return new KeyValuePair("depth",Depth); - if (Weight is not null) yield return new KeyValuePair("weight",Weight); - if (NominalVolume is not null) yield return new KeyValuePair("nominalVolume",NominalVolume); - if (ExternalDiameter is not null) yield return new KeyValuePair("externalDiameter",ExternalDiameter); - if (ShapeElement is not null) yield return new KeyValuePair("shape",ShapeElement); - if (ColorElement?.Any() == true) yield return new KeyValuePair("color",ColorElement); - if (ImprintElement?.Any() == true) yield return new KeyValuePair("imprint",ImprintElement); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); + if (_Height is not null) yield return new KeyValuePair("height",_Height); + if (_Width is not null) yield return new KeyValuePair("width",_Width); + if (_Depth is not null) yield return new KeyValuePair("depth",_Depth); + if (_Weight is not null) yield return new KeyValuePair("weight",_Weight); + if (_NominalVolume is not null) yield return new KeyValuePair("nominalVolume",_NominalVolume); + if (_ExternalDiameter is not null) yield return new KeyValuePair("externalDiameter",_ExternalDiameter); + if (_ShapeElement is not null) yield return new KeyValuePair("shape",_ShapeElement); + if (_ColorElement?.Any() == true) yield return new KeyValuePair("color",_ColorElement); + if (_ImprintElement?.Any() == true) yield return new KeyValuePair("imprint",_ImprintElement); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs index 16cefdd6b..2d043de7c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,13 +64,13 @@ public partial class ProductShelfLife : Hl7.Fhir.Model.BackboneType /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// This describes the shelf life, taking into account various scenarios such as shelf life of the packaged Medicinal Product itself, shelf life after transformation where necessary and shelf life after the first opening of a bottle, etc. The shelf life type shall be specified using an appropriate controlled vocabulary The controlled term and the controlled term identifier shall be specified. @@ -75,13 +78,13 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("type", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The shelf life time period can be specified using a numerical value for the period of time and its unit of time measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. @@ -89,13 +92,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("period", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Period + public Hl7.Fhir.Model.Quantity? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Quantity _Period; + private Hl7.Fhir.Model.Quantity? _Period; /// /// Special precautions for storage, if any, can be specified using an appropriate controlled vocabulary The controlled term and the controlled term identifier shall be specified. @@ -105,26 +108,22 @@ public Hl7.Fhir.Model.Quantity Period [DataMember] public List SpecialPrecautionsForStorage { - get { if(_SpecialPrecautionsForStorage==null) _SpecialPrecautionsForStorage = new List(); return _SpecialPrecautionsForStorage; } + get => _SpecialPrecautionsForStorage ?? new List(); set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } - private List _SpecialPrecautionsForStorage; + private List? _SpecialPrecautionsForStorage; protected internal override void CopyToInternal(Base other) { - var dest = other as ProductShelfLife; - - if (dest == null) - { + if(other is not ProductShelfLife dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Quantity)Period.DeepCopyInternal(); - if(SpecialPrecautionsForStorage.Any()) dest.SpecialPrecautionsForStorage = new List(SpecialPrecautionsForStorage.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Quantity)_Period.DeepCopyInternal(); + if(_SpecialPrecautionsForStorage is not null) dest.SpecialPrecautionsForStorage = new List(_SpecialPrecautionsForStorage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -136,55 +135,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProductShelfLife; - if(otherT == null) return false; + if(other is not ProductShelfLife otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(SpecialPrecautionsForStorage, otherT.SpecialPrecautionsForStorage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "specialPrecautionsForStorage": - value = SpecialPrecautionsForStorage; - return SpecialPrecautionsForStorage?.Any() == true; + value = _SpecialPrecautionsForStorage; + return _SpecialPrecautionsForStorage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Quantity)value; + Period = (Hl7.Fhir.Model.Quantity?)value; return this; case "specialPrecautionsForStorage": - SpecialPrecautionsForStorage = (List)value; + SpecialPrecautionsForStorage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -195,10 +194,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",SpecialPrecautionsForStorage); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",_SpecialPrecautionsForStorage); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs index 5396a6d4e..3401ac0c9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -123,13 +126,13 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("ProvenanceAgentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// What the agents role was. @@ -140,11 +143,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Who participated. @@ -154,13 +157,13 @@ public List Role [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Who the agent is representing. @@ -169,28 +172,24 @@ public Hl7.Fhir.Model.ResourceReference Who [CLSCompliant(false)] [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Device","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -202,55 +201,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -261,10 +260,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -290,13 +289,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProvenanceEntityRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RoleElement + public Code? RoleElement { get { return _RoleElement; } set { _RoleElement = value; OnPropertyChanged("RoleElement"); } } - private Code _RoleElement; + private Code? _RoleElement; /// /// derivation | revision | quotation | source | removal @@ -305,13 +304,10 @@ public Code RoleElement [IgnoreDataMember] public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role { - get { return RoleElement != null ? RoleElement.Value : null; } + get => _RoleElement?.Value; set { - if (value == null) - RoleElement = null; - else - RoleElement = new Code(value); + RoleElement = value is null ? null : new Code(value); OnPropertyChanged("Role"); } } @@ -324,13 +320,13 @@ public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference What + public Hl7.Fhir.Model.ResourceReference? What { get { return _What; } set { _What = value; OnPropertyChanged("What"); } } - private Hl7.Fhir.Model.ResourceReference _What; + private Hl7.Fhir.Model.ResourceReference? _What; /// /// Entity is attributed to this agent. @@ -340,25 +336,21 @@ public Hl7.Fhir.Model.ResourceReference What [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RoleElement != null) dest.RoleElement = (Code)RoleElement.DeepCopyInternal(); - if(What != null) dest.What = (Hl7.Fhir.Model.ResourceReference)What.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); + if(_RoleElement is not null) dest.RoleElement = (Code)_RoleElement.DeepCopyInternal(); + if(_What is not null) dest.What = (Hl7.Fhir.Model.ResourceReference)_What.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -370,48 +362,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RoleElement, otherT.RoleElement)) return false; - if(!comparer.Equals(What, otherT.What)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + if(!comparer.Equals(_What, otherT._What)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = RoleElement; - return RoleElement is not null; + value = _RoleElement; + return _RoleElement is not null; case "what": - value = What; - return What is not null; + value = _What; + return _What is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - RoleElement = (Code)value; + RoleElement = (Code?)value; return this; case "what": - What = (Hl7.Fhir.Model.ResourceReference)value; + What = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -422,9 +414,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RoleElement is not null) yield return new KeyValuePair("role",RoleElement); - if (What is not null) yield return new KeyValuePair("what",What); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); + if (_RoleElement is not null) yield return new KeyValuePair("role",_RoleElement); + if (_What is not null) yield return new KeyValuePair("what",_What); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); } } @@ -439,11 +431,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// When the activity occurred. @@ -452,13 +444,13 @@ public List Target [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Occurred + public Hl7.Fhir.Model.DataType? Occurred { get { return _Occurred; } set { _Occurred = value; OnPropertyChanged("Occurred"); } } - private Hl7.Fhir.Model.DataType _Occurred; + private Hl7.Fhir.Model.DataType? _Occurred; /// /// When the activity was recorded / updated. @@ -466,13 +458,13 @@ public Hl7.Fhir.Model.DataType Occurred [FhirElement("recorded", InSummary=true, Order=110, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// When the activity was recorded / updated @@ -481,13 +473,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -500,24 +489,24 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy or plan the activity was defined by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -531,13 +520,13 @@ public IEnumerable Policy [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Reason the activity is occurring. @@ -548,11 +537,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Activity that occurred. @@ -560,13 +549,13 @@ public List Reason [FhirElement("activity", Order=150, FiveWs="FiveWs.why[x]")] [Binding("ProvenanceActivity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Activity + public Hl7.Fhir.Model.CodeableConcept? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.CodeableConcept _Activity; + private Hl7.Fhir.Model.CodeableConcept? _Activity; /// /// Actor involved. @@ -576,11 +565,11 @@ public Hl7.Fhir.Model.CodeableConcept Activity [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// An entity used in this activity. @@ -590,11 +579,11 @@ public List Agent [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; /// /// Signature on target. @@ -604,32 +593,28 @@ public List Entity [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as Provenance; - - if (dest == null) - { + if(other is not Provenance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Occurred != null) dest.Occurred = (Hl7.Fhir.Model.DataType)Occurred.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Occurred is not null) dest.Occurred = (Hl7.Fhir.Model.DataType)_Occurred.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)_Activity.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -641,97 +626,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Provenance; - if(otherT == null) return false; + if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.Equals(Occurred, otherT.Occurred)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Occurred, otherT._Occurred)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "occurred": - value = Occurred; - return Occurred is not null; + value = _Occurred; + return _Occurred is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (List)value; + Target = (List?)value!; return this; case "occurred": - Occurred = (Hl7.Fhir.Model.DataType)value; + Occurred = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "activity": - Activity = (Hl7.Fhir.Model.CodeableConcept)value; + Activity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -742,16 +727,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Occurred is not null) yield return new KeyValuePair("occurred",Occurred); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Occurred is not null) yield return new KeyValuePair("occurred",_Occurred); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs index ea6560f23..df38e15a3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -268,28 +271,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for item in questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -299,28 +299,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -334,39 +331,36 @@ public string Definition [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// E.g. "1(a)", "2.5.3". /// [FhirElement("prefix", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// E.g. "1(a)", "2.5.3" /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -376,28 +370,25 @@ public string Prefix /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Primary text for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -410,13 +401,13 @@ public string Text [Binding("QuestionnaireItemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// group | display | boolean | decimal | integer | date | dateTime + @@ -425,13 +416,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -444,11 +432,11 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get { if(_EnableWhen==null) _EnableWhen = new List(); return _EnableWhen; } + get => _EnableWhen ?? new List(); set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } - private List _EnableWhen; + private List? _EnableWhen; /// /// all | any. @@ -457,13 +445,13 @@ public List EnableWhen [DeclaredType(Type = typeof(Code))] [Binding("EnableWhenBehavior")] [DataMember] - public Code EnableBehaviorElement + public Code? EnableBehaviorElement { get { return _EnableBehaviorElement; } set { _EnableBehaviorElement = value; OnPropertyChanged("EnableBehaviorElement"); } } - private Code _EnableBehaviorElement; + private Code? _EnableBehaviorElement; /// /// all | any @@ -472,13 +460,10 @@ public Code EnableBehaviorEleme [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.EnableWhenBehavior? EnableBehavior { - get { return EnableBehaviorElement != null ? EnableBehaviorElement.Value : null; } + get => _EnableBehaviorElement?.Value; set { - if (value == null) - EnableBehaviorElement = null; - else - EnableBehaviorElement = new Code(value); + EnableBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("EnableBehavior"); } } @@ -488,13 +473,13 @@ public Hl7.Fhir.Model.Questionnaire.EnableWhenBehavior? EnableBehavior /// [FhirElement("required", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Whether the item must be included in data results @@ -503,13 +488,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -519,13 +501,13 @@ public bool? Required /// [FhirElement("repeats", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RepeatsElement + public Hl7.Fhir.Model.FhirBoolean? RepeatsElement { get { return _RepeatsElement; } set { _RepeatsElement = value; OnPropertyChanged("RepeatsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RepeatsElement; + private Hl7.Fhir.Model.FhirBoolean? _RepeatsElement; /// /// Whether the item may repeat @@ -534,13 +516,10 @@ public Hl7.Fhir.Model.FhirBoolean RepeatsElement [IgnoreDataMember] public bool? Repeats { - get { return RepeatsElement != null ? RepeatsElement.Value : null; } + get => _RepeatsElement?.Value; set { - if (value == null) - RepeatsElement = null; - else - RepeatsElement = new Hl7.Fhir.Model.FhirBoolean(value); + RepeatsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Repeats"); } } @@ -550,13 +529,13 @@ public bool? Repeats /// [FhirElement("readOnly", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement + public Hl7.Fhir.Model.FhirBoolean? ReadOnlyElement { get { return _ReadOnlyElement; } set { _ReadOnlyElement = value; OnPropertyChanged("ReadOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReadOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _ReadOnlyElement; /// /// Don't allow human editing @@ -565,13 +544,10 @@ public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement [IgnoreDataMember] public bool? ReadOnly { - get { return ReadOnlyElement != null ? ReadOnlyElement.Value : null; } + get => _ReadOnlyElement?.Value; set { - if (value == null) - ReadOnlyElement = null; - else - ReadOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReadOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReadOnly"); } } @@ -581,13 +557,13 @@ public bool? ReadOnly /// [FhirElement("maxLength", Order=150)] [DataMember] - public Hl7.Fhir.Model.Integer MaxLengthElement + public Hl7.Fhir.Model.Integer? MaxLengthElement { get { return _MaxLengthElement; } set { _MaxLengthElement = value; OnPropertyChanged("MaxLengthElement"); } } - private Hl7.Fhir.Model.Integer _MaxLengthElement; + private Hl7.Fhir.Model.Integer? _MaxLengthElement; /// /// No more than this many characters @@ -596,13 +572,10 @@ public Hl7.Fhir.Model.Integer MaxLengthElement [IgnoreDataMember] public int? MaxLength { - get { return MaxLengthElement != null ? MaxLengthElement.Value : null; } + get => _MaxLengthElement?.Value; set { - if (value == null) - MaxLengthElement = null; - else - MaxLengthElement = new Hl7.Fhir.Model.Integer(value); + MaxLengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("MaxLength"); } } @@ -612,28 +585,25 @@ public int? MaxLength /// [FhirElement("answerValueSet", Order=160)] [DataMember] - public Hl7.Fhir.Model.Canonical AnswerValueSetElement + public Hl7.Fhir.Model.Canonical? AnswerValueSetElement { get { return _AnswerValueSetElement; } set { _AnswerValueSetElement = value; OnPropertyChanged("AnswerValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _AnswerValueSetElement; + private Hl7.Fhir.Model.Canonical? _AnswerValueSetElement; /// /// Valueset containing permitted answers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AnswerValueSet + public string? AnswerValueSet { - get { return AnswerValueSetElement != null ? AnswerValueSetElement.Value : null; } + get => _AnswerValueSetElement?.Value; set { - if (value == null) - AnswerValueSetElement = null; - else - AnswerValueSetElement = new Hl7.Fhir.Model.Canonical(value); + AnswerValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("AnswerValueSet"); } } @@ -646,11 +616,11 @@ public string AnswerValueSet [DataMember] public List AnswerOption { - get { if(_AnswerOption==null) _AnswerOption = new List(); return _AnswerOption; } + get => _AnswerOption ?? new List(); set { _AnswerOption = value; OnPropertyChanged("AnswerOption"); } } - private List _AnswerOption; + private List? _AnswerOption; /// /// Initial value(s) when item is first rendered. @@ -660,11 +630,11 @@ public List AnswerOption [DataMember] public List Initial { - get { if(_Initial==null) _Initial = new List(); return _Initial; } + get => _Initial ?? new List(); set { _Initial = value; OnPropertyChanged("Initial"); } } - private List _Initial; + private List? _Initial; /// /// Nested questionnaire items. @@ -674,38 +644,34 @@ public List Initial [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EnableWhen.Any()) dest.EnableWhen = new List(EnableWhen.DeepCopyInternal()); - if(EnableBehaviorElement != null) dest.EnableBehaviorElement = (Code)EnableBehaviorElement.DeepCopyInternal(); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(RepeatsElement != null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)RepeatsElement.DeepCopyInternal(); - if(ReadOnlyElement != null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)ReadOnlyElement.DeepCopyInternal(); - if(MaxLengthElement != null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)MaxLengthElement.DeepCopyInternal(); - if(AnswerValueSetElement != null) dest.AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)AnswerValueSetElement.DeepCopyInternal(); - if(AnswerOption.Any()) dest.AnswerOption = new List(AnswerOption.DeepCopyInternal()); - if(Initial.Any()) dest.Initial = new List(Initial.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EnableWhen is not null) dest.EnableWhen = new List(_EnableWhen.DeepCopyInternal()); + if(_EnableBehaviorElement is not null) dest.EnableBehaviorElement = (Code)_EnableBehaviorElement.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_RepeatsElement is not null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)_RepeatsElement.DeepCopyInternal(); + if(_ReadOnlyElement is not null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_ReadOnlyElement.DeepCopyInternal(); + if(_MaxLengthElement is not null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)_MaxLengthElement.DeepCopyInternal(); + if(_AnswerValueSetElement is not null) dest.AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)_AnswerValueSetElement.DeepCopyInternal(); + if(_AnswerOption is not null) dest.AnswerOption = new List(_AnswerOption.DeepCopyInternal()); + if(_Initial is not null) dest.Initial = new List(_Initial.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -717,139 +683,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(EnableWhen, otherT.EnableWhen)) return false; - if(!comparer.Equals(EnableBehaviorElement, otherT.EnableBehaviorElement)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(RepeatsElement, otherT.RepeatsElement)) return false; - if(!comparer.Equals(ReadOnlyElement, otherT.ReadOnlyElement)) return false; - if(!comparer.Equals(MaxLengthElement, otherT.MaxLengthElement)) return false; - if(!comparer.Equals(AnswerValueSetElement, otherT.AnswerValueSetElement)) return false; - if(!comparer.ListEquals(AnswerOption, otherT.AnswerOption)) return false; - if(!comparer.ListEquals(Initial, otherT.Initial)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_EnableWhen, otherT._EnableWhen)) return false; + if(!comparer.Equals(_EnableBehaviorElement, otherT._EnableBehaviorElement)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_RepeatsElement, otherT._RepeatsElement)) return false; + if(!comparer.Equals(_ReadOnlyElement, otherT._ReadOnlyElement)) return false; + if(!comparer.Equals(_MaxLengthElement, otherT._MaxLengthElement)) return false; + if(!comparer.Equals(_AnswerValueSetElement, otherT._AnswerValueSetElement)) return false; + if(!comparer.ListEquals(_AnswerOption, otherT._AnswerOption)) return false; + if(!comparer.ListEquals(_Initial, otherT._Initial)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "enableWhen": - value = EnableWhen; - return EnableWhen?.Any() == true; + value = _EnableWhen; + return _EnableWhen?.Any() == true; case "enableBehavior": - value = EnableBehaviorElement; - return EnableBehaviorElement is not null; + value = _EnableBehaviorElement; + return _EnableBehaviorElement is not null; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "repeats": - value = RepeatsElement; - return RepeatsElement is not null; + value = _RepeatsElement; + return _RepeatsElement is not null; case "readOnly": - value = ReadOnlyElement; - return ReadOnlyElement is not null; + value = _ReadOnlyElement; + return _ReadOnlyElement is not null; case "maxLength": - value = MaxLengthElement; - return MaxLengthElement is not null; + value = _MaxLengthElement; + return _MaxLengthElement is not null; case "answerValueSet": - value = AnswerValueSetElement; - return AnswerValueSetElement is not null; + value = _AnswerValueSetElement; + return _AnswerValueSetElement is not null; case "answerOption": - value = AnswerOption; - return AnswerOption?.Any() == true; + value = _AnswerOption; + return _AnswerOption?.Any() == true; case "initial": - value = Initial; - return Initial?.Any() == true; + value = _Initial; + return _Initial?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "enableWhen": - EnableWhen = (List)value; + EnableWhen = (List?)value!; return this; case "enableBehavior": - EnableBehaviorElement = (Code)value; + EnableBehaviorElement = (Code?)value; return this; case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "repeats": - RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)value; + RepeatsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "readOnly": - ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "maxLength": - MaxLengthElement = (Hl7.Fhir.Model.Integer)value; + MaxLengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "answerValueSet": - AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)value; + AnswerValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "answerOption": - AnswerOption = (List)value; + AnswerOption = (List?)value!; return this; case "initial": - Initial = (List)value; + Initial = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -860,22 +826,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",EnableWhen); - if (EnableBehaviorElement is not null) yield return new KeyValuePair("enableBehavior",EnableBehaviorElement); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (RepeatsElement is not null) yield return new KeyValuePair("repeats",RepeatsElement); - if (ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",ReadOnlyElement); - if (MaxLengthElement is not null) yield return new KeyValuePair("maxLength",MaxLengthElement); - if (AnswerValueSetElement is not null) yield return new KeyValuePair("answerValueSet",AnswerValueSetElement); - if (AnswerOption?.Any() == true) yield return new KeyValuePair("answerOption",AnswerOption); - if (Initial?.Any() == true) yield return new KeyValuePair("initial",Initial); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",_EnableWhen); + if (_EnableBehaviorElement is not null) yield return new KeyValuePair("enableBehavior",_EnableBehaviorElement); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_RepeatsElement is not null) yield return new KeyValuePair("repeats",_RepeatsElement); + if (_ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",_ReadOnlyElement); + if (_MaxLengthElement is not null) yield return new KeyValuePair("maxLength",_MaxLengthElement); + if (_AnswerValueSetElement is not null) yield return new KeyValuePair("answerValueSet",_AnswerValueSetElement); + if (_AnswerOption?.Any() == true) yield return new KeyValuePair("answerOption",_AnswerOption); + if (_Initial?.Any() == true) yield return new KeyValuePair("initial",_Initial); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -903,28 +869,25 @@ public partial class EnableWhenComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("question", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString QuestionElement + public Hl7.Fhir.Model.FhirString? QuestionElement { get { return _QuestionElement; } set { _QuestionElement = value; OnPropertyChanged("QuestionElement"); } } - private Hl7.Fhir.Model.FhirString _QuestionElement; + private Hl7.Fhir.Model.FhirString? _QuestionElement; /// /// Question that determines whether item is enabled /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Question + public string? Question { - get { return QuestionElement != null ? QuestionElement.Value : null; } + get => _QuestionElement?.Value; set { - if (value == null) - QuestionElement = null; - else - QuestionElement = new Hl7.Fhir.Model.FhirString(value); + QuestionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Question"); } } @@ -937,13 +900,13 @@ public string Question [Binding("QuestionnaireItemOperator")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OperatorElement + public Code? OperatorElement { get { return _OperatorElement; } set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private Code _OperatorElement; + private Code? _OperatorElement; /// /// exists | = | != | > | < | >= | <= @@ -952,13 +915,10 @@ public Code OperatorElem [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemOperator? Operator { - get { return OperatorElement != null ? OperatorElement.Value : null; } + get => _OperatorElement?.Value; set { - if (value == null) - OperatorElement = null; - else - OperatorElement = new Code(value); + OperatorElement = value is null ? null : new Code(value); OnPropertyChanged("Operator"); } } @@ -973,27 +933,23 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemOperator? Operator [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Answer + public Hl7.Fhir.Model.DataType? Answer { get { return _Answer; } set { _Answer = value; OnPropertyChanged("Answer"); } } - private Hl7.Fhir.Model.DataType _Answer; + private Hl7.Fhir.Model.DataType? _Answer; protected internal override void CopyToInternal(Base other) { - var dest = other as EnableWhenComponent; - - if (dest == null) - { + if(other is not EnableWhenComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(QuestionElement != null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)QuestionElement.DeepCopyInternal(); - if(OperatorElement != null) dest.OperatorElement = (Code)OperatorElement.DeepCopyInternal(); - if(Answer != null) dest.Answer = (Hl7.Fhir.Model.DataType)Answer.DeepCopyInternal(); + if(_QuestionElement is not null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)_QuestionElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = (Code)_OperatorElement.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = (Hl7.Fhir.Model.DataType)_Answer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1005,48 +961,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnableWhenComponent; - if(otherT == null) return false; + if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(QuestionElement, otherT.QuestionElement)) return false; - if(!comparer.Equals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(Answer, otherT.Answer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_Answer, otherT._Answer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "question": - value = QuestionElement; - return QuestionElement is not null; + value = _QuestionElement; + return _QuestionElement is not null; case "operator": - value = OperatorElement; - return OperatorElement is not null; + value = _OperatorElement; + return _OperatorElement is not null; case "answer": - value = Answer; - return Answer is not null; + value = _Answer; + return _Answer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "question": - QuestionElement = (Hl7.Fhir.Model.FhirString)value; + QuestionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "operator": - OperatorElement = (Code)value; + OperatorElement = (Code?)value; return this; case "answer": - Answer = (Hl7.Fhir.Model.DataType)value; + Answer = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1057,9 +1013,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (QuestionElement is not null) yield return new KeyValuePair("question",QuestionElement); - if (OperatorElement is not null) yield return new KeyValuePair("operator",OperatorElement); - if (Answer is not null) yield return new KeyValuePair("answer",Answer); + if (_QuestionElement is not null) yield return new KeyValuePair("question",_QuestionElement); + if (_OperatorElement is not null) yield return new KeyValuePair("operator",_OperatorElement); + if (_Answer is not null) yield return new KeyValuePair("answer",_Answer); } } @@ -1091,26 +1047,26 @@ public partial class AnswerOptionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Whether option is selected by default. /// [FhirElement("initialSelected", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InitialSelectedElement + public Hl7.Fhir.Model.FhirBoolean? InitialSelectedElement { get { return _InitialSelectedElement; } set { _InitialSelectedElement = value; OnPropertyChanged("InitialSelectedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InitialSelectedElement; + private Hl7.Fhir.Model.FhirBoolean? _InitialSelectedElement; /// /// Whether option is selected by default @@ -1119,29 +1075,22 @@ public Hl7.Fhir.Model.FhirBoolean InitialSelectedElement [IgnoreDataMember] public bool? InitialSelected { - get { return InitialSelectedElement != null ? InitialSelectedElement.Value : null; } + get => _InitialSelectedElement?.Value; set { - if (value == null) - InitialSelectedElement = null; - else - InitialSelectedElement = new Hl7.Fhir.Model.FhirBoolean(value); + InitialSelectedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("InitialSelected"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerOptionComponent; - - if (dest == null) - { + if(other is not AnswerOptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(InitialSelectedElement != null) dest.InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)InitialSelectedElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_InitialSelectedElement is not null) dest.InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)_InitialSelectedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1153,41 +1102,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerOptionComponent; - if(otherT == null) return false; + if(other is not AnswerOptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(InitialSelectedElement, otherT.InitialSelectedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_InitialSelectedElement, otherT._InitialSelectedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "initialSelected": - value = InitialSelectedElement; - return InitialSelectedElement is not null; + value = _InitialSelectedElement; + return _InitialSelectedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "initialSelected": - InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)value; + InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1198,8 +1147,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (InitialSelectedElement is not null) yield return new KeyValuePair("initialSelected",InitialSelectedElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_InitialSelectedElement is not null) yield return new KeyValuePair("initialSelected",_InitialSelectedElement); } } @@ -1231,25 +1180,21 @@ public partial class InitialComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as InitialComponent; - - if (dest == null) - { + if(other is not InitialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1261,34 +1206,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InitialComponent; - if(otherT == null) return false; + if(other is not InitialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1299,7 +1244,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1309,28 +1254,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this questionnaire, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1343,39 +1285,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the questionnaire. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1385,28 +1324,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this questionnaire (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1416,28 +1352,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this questionnaire (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1450,24 +1383,24 @@ public string Title [DataMember] public List DerivedFromElement { - get { if(_DerivedFromElement==null) _DerivedFromElement = new List(); return _DerivedFromElement; } + get => _DerivedFromElement ?? new List(); set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private List _DerivedFromElement; + private List? _DerivedFromElement; /// /// Instantiates protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFrom + public IEnumerable? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Select(elem => elem.Value) : null; } + get => _DerivedFromElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromElement = null; + DerivedFromElement = null!; else DerivedFromElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFrom"); @@ -1482,13 +1415,13 @@ public IEnumerable DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1497,13 +1430,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1513,13 +1443,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1528,13 +1458,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1549,24 +1476,24 @@ public bool? Experimental [DataMember] public List> SubjectTypeElement { - get { if(_SubjectTypeElement==null) _SubjectTypeElement = new List>(); return _SubjectTypeElement; } + get => _SubjectTypeElement ?? new List>(); set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } - private List> _SubjectTypeElement; + private List>? _SubjectTypeElement; /// /// Resource that can be subject of QuestionnaireResponse /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubjectType + public IEnumerable? SubjectType { - get { return SubjectTypeElement != null ? SubjectTypeElement.Select(elem => elem.Value) : null; } + get => _SubjectTypeElement?.Select(elem => elem.Value); set { if (value == null) - SubjectTypeElement = null; + SubjectTypeElement = null!; else SubjectTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("SubjectType"); @@ -1578,28 +1505,25 @@ public IEnumerable SubjectType /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1609,28 +1533,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1643,39 +1564,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the questionnaire. /// [FhirElement("description", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1688,11 +1606,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for questionnaire (if applicable). @@ -1703,39 +1621,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this questionnaire is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this questionnaire is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1745,28 +1660,25 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1776,28 +1688,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the questionnaire was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1807,28 +1716,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the questionnaire was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1838,13 +1744,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Concept that represents the overall questionnaire. @@ -1855,11 +1761,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Questions and sections within the Questionnaire. @@ -1869,46 +1775,42 @@ public List Code [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Questionnaire; - - if (dest == null) - { + if(other is not Questionnaire dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromElement.Any()) dest.DerivedFromElement = new List(DerivedFromElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(SubjectTypeElement.Any()) dest.SubjectTypeElement = new List>(SubjectTypeElement.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = new List(_DerivedFromElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_SubjectTypeElement is not null) dest.SubjectTypeElement = new List>(_SubjectTypeElement.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1920,181 +1822,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Questionnaire; - if(otherT == null) return false; + if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.ListEquals(SubjectTypeElement, otherT.SubjectTypeElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.ListEquals(_SubjectTypeElement, otherT._SubjectTypeElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement?.Any() == true; + value = _DerivedFromElement; + return _DerivedFromElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subjectType": - value = SubjectTypeElement; - return SubjectTypeElement?.Any() == true; + value = _SubjectTypeElement; + return _SubjectTypeElement?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (List)value; + DerivedFromElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subjectType": - SubjectTypeElement = (List>)value; + SubjectTypeElement = (List>?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2105,28 +2007,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",SubjectTypeElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",_SubjectTypeElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs index 24f4212d8..af0c6373e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("QuestionnaireResponse","http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse")] - public partial class QuestionnaireResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class QuestionnaireResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -123,28 +126,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific item from Questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -154,28 +154,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -185,28 +182,25 @@ public string Definition /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Name for group or question text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -219,11 +213,11 @@ public string Text [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Nested questionnaire response items. @@ -233,27 +227,23 @@ public List Answer [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -265,62 +255,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -331,11 +321,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -366,13 +356,13 @@ public partial class AnswerComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Nested groups and questions. @@ -382,24 +372,20 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerComponent; - - if (dest == null) - { + if(other is not AnswerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -411,41 +397,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerComponent; - if(otherT == null) return false; + if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -456,8 +442,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -467,13 +453,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Request fulfilled by this QuestionnaireResponse. @@ -485,11 +471,11 @@ public Hl7.Fhir.Model.Identifier Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of this action. @@ -501,39 +487,36 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Form being answered. /// [FhirElement("questionnaire", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Canonical QuestionnaireElement + public Hl7.Fhir.Model.Canonical? QuestionnaireElement { get { return _QuestionnaireElement; } set { _QuestionnaireElement = value; OnPropertyChanged("QuestionnaireElement"); } } - private Hl7.Fhir.Model.Canonical _QuestionnaireElement; + private Hl7.Fhir.Model.Canonical? _QuestionnaireElement; /// /// Form being answered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Questionnaire + public string? Questionnaire { - get { return QuestionnaireElement != null ? QuestionnaireElement.Value : null; } + get => _QuestionnaireElement?.Value; set { - if (value == null) - QuestionnaireElement = null; - else - QuestionnaireElement = new Hl7.Fhir.Model.Canonical(value); + QuestionnaireElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Questionnaire"); } } @@ -546,13 +529,13 @@ public string Questionnaire [Binding("QuestionnaireResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | amended | entered-in-error | stopped @@ -561,13 +544,10 @@ public Code St [IgnoreDataMember] public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -579,13 +559,13 @@ public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter created as part of. @@ -594,41 +574,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Date the answers were gathered. /// [FhirElement("authored", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredElement { get { return _AuthoredElement; } set { _AuthoredElement = value; OnPropertyChanged("AuthoredElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredElement; /// /// Date the answers were gathered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authored + public string? Authored { - get { return AuthoredElement != null ? AuthoredElement.Value : null; } + get => _AuthoredElement?.Value; set { - if (value == null) - AuthoredElement = null; - else - AuthoredElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Authored"); } } @@ -640,13 +617,13 @@ public string Authored [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole","Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// The person who answered the questions. @@ -655,13 +632,13 @@ public Hl7.Fhir.Model.ResourceReference Author [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Groups and questions. @@ -671,35 +648,31 @@ public Hl7.Fhir.Model.ResourceReference Source [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as QuestionnaireResponse; - - if (dest == null) - { + if(other is not QuestionnaireResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(QuestionnaireElement != null) dest.QuestionnaireElement = (Hl7.Fhir.Model.Canonical)QuestionnaireElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(AuthoredElement != null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_QuestionnaireElement is not null) dest.QuestionnaireElement = (Hl7.Fhir.Model.Canonical)_QuestionnaireElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_AuthoredElement is not null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -711,104 +684,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QuestionnaireResponse; - if(otherT == null) return false; + if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(QuestionnaireElement, otherT.QuestionnaireElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(AuthoredElement, otherT.AuthoredElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_QuestionnaireElement, otherT._QuestionnaireElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_AuthoredElement, otherT._AuthoredElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "questionnaire": - value = QuestionnaireElement; - return QuestionnaireElement is not null; + value = _QuestionnaireElement; + return _QuestionnaireElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "authored": - value = AuthoredElement; - return AuthoredElement is not null; + value = _AuthoredElement; + return _AuthoredElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "questionnaire": - QuestionnaireElement = (Hl7.Fhir.Model.Canonical)value; + QuestionnaireElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authored": - AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -819,17 +792,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (QuestionnaireElement is not null) yield return new KeyValuePair("questionnaire",QuestionnaireElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (AuthoredElement is not null) yield return new KeyValuePair("authored",AuthoredElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_QuestionnaireElement is not null) yield return new KeyValuePair("questionnaire",_QuestionnaireElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_AuthoredElement is not null) yield return new KeyValuePair("authored",_AuthoredElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs b/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs index 4b0299041..e763e934a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -65,39 +68,35 @@ public partial class Ratio : Hl7.Fhir.Model.DataType /// [FhirElement("numerator", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity Numerator + public Hl7.Fhir.Model.Quantity? Numerator { get { return _Numerator; } set { _Numerator = value; OnPropertyChanged("Numerator"); } } - private Hl7.Fhir.Model.Quantity _Numerator; + private Hl7.Fhir.Model.Quantity? _Numerator; /// /// Denominator value. /// [FhirElement("denominator", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Denominator + public Hl7.Fhir.Model.Quantity? Denominator { get { return _Denominator; } set { _Denominator = value; OnPropertyChanged("Denominator"); } } - private Hl7.Fhir.Model.Quantity _Denominator; + private Hl7.Fhir.Model.Quantity? _Denominator; protected internal override void CopyToInternal(Base other) { - var dest = other as Ratio; - - if (dest == null) - { + if(other is not Ratio dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Numerator != null) dest.Numerator = (Hl7.Fhir.Model.Quantity)Numerator.DeepCopyInternal(); - if(Denominator != null) dest.Denominator = (Hl7.Fhir.Model.Quantity)Denominator.DeepCopyInternal(); + if(_Numerator is not null) dest.Numerator = (Hl7.Fhir.Model.Quantity)_Numerator.DeepCopyInternal(); + if(_Denominator is not null) dest.Denominator = (Hl7.Fhir.Model.Quantity)_Denominator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -109,41 +108,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Ratio; - if(otherT == null) return false; + if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Numerator, otherT.Numerator)) return false; - if(!comparer.Equals(Denominator, otherT.Denominator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "numerator": - value = Numerator; - return Numerator is not null; + value = _Numerator; + return _Numerator is not null; case "denominator": - value = Denominator; - return Denominator is not null; + value = _Denominator; + return _Denominator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "numerator": - Numerator = (Hl7.Fhir.Model.Quantity)value; + Numerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "denominator": - Denominator = (Hl7.Fhir.Model.Quantity)value; + Denominator = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -154,8 +153,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Numerator is not null) yield return new KeyValuePair("numerator",Numerator); - if (Denominator is not null) yield return new KeyValuePair("denominator",Denominator); + if (_Numerator is not null) yield return new KeyValuePair("numerator",_Numerator); + if (_Denominator is not null) yield return new KeyValuePair("denominator",_Denominator); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs b/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs index 5564767d5..ac4c44cf8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -65,53 +68,49 @@ public partial class RatioRange : Hl7.Fhir.Model.DataType /// [FhirElement("lowNumerator", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity LowNumerator + public Hl7.Fhir.Model.Quantity? LowNumerator { get { return _LowNumerator; } set { _LowNumerator = value; OnPropertyChanged("LowNumerator"); } } - private Hl7.Fhir.Model.Quantity _LowNumerator; + private Hl7.Fhir.Model.Quantity? _LowNumerator; /// /// High Numerator limit. /// [FhirElement("highNumerator", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity HighNumerator + public Hl7.Fhir.Model.Quantity? HighNumerator { get { return _HighNumerator; } set { _HighNumerator = value; OnPropertyChanged("HighNumerator"); } } - private Hl7.Fhir.Model.Quantity _HighNumerator; + private Hl7.Fhir.Model.Quantity? _HighNumerator; /// /// Denominator value. /// [FhirElement("denominator", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Denominator + public Hl7.Fhir.Model.Quantity? Denominator { get { return _Denominator; } set { _Denominator = value; OnPropertyChanged("Denominator"); } } - private Hl7.Fhir.Model.Quantity _Denominator; + private Hl7.Fhir.Model.Quantity? _Denominator; protected internal override void CopyToInternal(Base other) { - var dest = other as RatioRange; - - if (dest == null) - { + if(other is not RatioRange dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LowNumerator != null) dest.LowNumerator = (Hl7.Fhir.Model.Quantity)LowNumerator.DeepCopyInternal(); - if(HighNumerator != null) dest.HighNumerator = (Hl7.Fhir.Model.Quantity)HighNumerator.DeepCopyInternal(); - if(Denominator != null) dest.Denominator = (Hl7.Fhir.Model.Quantity)Denominator.DeepCopyInternal(); + if(_LowNumerator is not null) dest.LowNumerator = (Hl7.Fhir.Model.Quantity)_LowNumerator.DeepCopyInternal(); + if(_HighNumerator is not null) dest.HighNumerator = (Hl7.Fhir.Model.Quantity)_HighNumerator.DeepCopyInternal(); + if(_Denominator is not null) dest.Denominator = (Hl7.Fhir.Model.Quantity)_Denominator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -123,48 +122,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RatioRange; - if(otherT == null) return false; + if(other is not RatioRange otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LowNumerator, otherT.LowNumerator)) return false; - if(!comparer.Equals(HighNumerator, otherT.HighNumerator)) return false; - if(!comparer.Equals(Denominator, otherT.Denominator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LowNumerator, otherT._LowNumerator)) return false; + if(!comparer.Equals(_HighNumerator, otherT._HighNumerator)) return false; + if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lowNumerator": - value = LowNumerator; - return LowNumerator is not null; + value = _LowNumerator; + return _LowNumerator is not null; case "highNumerator": - value = HighNumerator; - return HighNumerator is not null; + value = _HighNumerator; + return _HighNumerator is not null; case "denominator": - value = Denominator; - return Denominator is not null; + value = _Denominator; + return _Denominator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lowNumerator": - LowNumerator = (Hl7.Fhir.Model.Quantity)value; + LowNumerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "highNumerator": - HighNumerator = (Hl7.Fhir.Model.Quantity)value; + HighNumerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "denominator": - Denominator = (Hl7.Fhir.Model.Quantity)value; + Denominator = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -175,9 +174,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LowNumerator is not null) yield return new KeyValuePair("lowNumerator",LowNumerator); - if (HighNumerator is not null) yield return new KeyValuePair("highNumerator",HighNumerator); - if (Denominator is not null) yield return new KeyValuePair("denominator",Denominator); + if (_LowNumerator is not null) yield return new KeyValuePair("lowNumerator",_LowNumerator); + if (_HighNumerator is not null) yield return new KeyValuePair("highNumerator",_HighNumerator); + if (_Denominator is not null) yield return new KeyValuePair("denominator",_Denominator); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs b/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs index 2b4d27af1..7a221c814 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,13 +83,13 @@ public partial class CaseComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// The defining type of case. @@ -94,13 +97,13 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("type", InSummary=true, Order=50)] [Binding("RegulatedAuthorizationCaseType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The status associated with the case. @@ -108,13 +111,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("status", InSummary=true, Order=60)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Relevant date for this case. @@ -123,13 +126,13 @@ public Hl7.Fhir.Model.CodeableConcept Status [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Date + public Hl7.Fhir.Model.DataType? Date { get { return _Date; } set { _Date = value; OnPropertyChanged("Date"); } } - private Hl7.Fhir.Model.DataType _Date; + private Hl7.Fhir.Model.DataType? _Date; /// /// Applications submitted to obtain a regulated authorization. Steps within the longer running case or procedure. @@ -139,27 +142,23 @@ public Hl7.Fhir.Model.DataType Date [DataMember] public List Application { - get { if(_Application==null) _Application = new List(); return _Application; } + get => _Application ?? new List(); set { _Application = value; OnPropertyChanged("Application"); } } - private List _Application; + private List? _Application; protected internal override void CopyToInternal(Base other) { - var dest = other as CaseComponent; - - if (dest == null) - { + if(other is not CaseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Date != null) dest.Date = (Hl7.Fhir.Model.DataType)Date.DeepCopyInternal(); - if(Application.Any()) dest.Application = new List(Application.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Date is not null) dest.Date = (Hl7.Fhir.Model.DataType)_Date.DeepCopyInternal(); + if(_Application is not null) dest.Application = new List(_Application.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -171,62 +170,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CaseComponent; - if(otherT == null) return false; + if(other is not CaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Date, otherT.Date)) return false; - if(!comparer.ListEquals(Application, otherT.Application)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Date, otherT._Date)) return false; + if(!comparer.ListEquals(_Application, otherT._Application)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "date": - value = Date; - return Date is not null; + value = _Date; + return _Date is not null; case "application": - value = Application; - return Application?.Any() == true; + value = _Application; + return _Application?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - Date = (Hl7.Fhir.Model.DataType)value; + Date = (Hl7.Fhir.Model.DataType?)value; return this; case "application": - Application = (List)value; + Application = (List?)value!; return this; default: return base.SetValue(key, value); @@ -237,11 +236,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Date is not null) yield return new KeyValuePair("date",Date); - if (Application?.Any() == true) yield return new KeyValuePair("application",Application); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Date is not null) yield return new KeyValuePair("date",_Date); + if (_Application?.Any() == true) yield return new KeyValuePair("application",_Application); } } @@ -254,11 +253,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The product type, treatment, facility or activity that is being authorized. @@ -270,11 +269,11 @@ public List Identifier [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Overall type of this authorization, for example drug marketing approval, orphan drug designation. @@ -282,41 +281,38 @@ public List Subject [FhirElement("type", InSummary=true, Order=110)] [Binding("RegulatedAuthorizationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// General textual supporting information. /// [FhirElement("description", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// General textual supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -330,11 +326,11 @@ public string Description [DataMember] public List Region { - get { if(_Region==null) _Region = new List(); return _Region; } + get => _Region ?? new List(); set { _Region = value; OnPropertyChanged("Region"); } } - private List _Region; + private List? _Region; /// /// The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications. @@ -342,41 +338,38 @@ public List Region [FhirElement("status", InSummary=true, Order=140)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the current status was assigned. /// [FhirElement("statusDate", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the current status was assigned /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -386,26 +379,26 @@ public string StatusDate /// [FhirElement("validityPeriod", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// Condition for which the use of the regulated product applies. /// [FhirElement("indication", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Indication + public Hl7.Fhir.Model.CodeableReference? Indication { get { return _Indication; } set { _Indication = value; OnPropertyChanged("Indication"); } } - private Hl7.Fhir.Model.CodeableReference _Indication; + private Hl7.Fhir.Model.CodeableReference? _Indication; /// /// The intended use of the product, e.g. prevention, treatment. @@ -413,13 +406,13 @@ public Hl7.Fhir.Model.CodeableReference Indication [FhirElement("intendedUse", InSummary=true, Order=180)] [Binding("ProductIntendedUse")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept IntendedUse + public Hl7.Fhir.Model.CodeableConcept? IntendedUse { get { return _IntendedUse; } set { _IntendedUse = value; OnPropertyChanged("IntendedUse"); } } - private Hl7.Fhir.Model.CodeableConcept _IntendedUse; + private Hl7.Fhir.Model.CodeableConcept? _IntendedUse; /// /// The legal/regulatory framework or reasons under which this authorization is granted. @@ -430,11 +423,11 @@ public Hl7.Fhir.Model.CodeableConcept IntendedUse [DataMember] public List Basis { - get { if(_Basis==null) _Basis = new List(); return _Basis; } + get => _Basis ?? new List(); set { _Basis = value; OnPropertyChanged("Basis"); } } - private List _Basis; + private List? _Basis; /// /// The organization that has been granted this authorization, by the regulator. @@ -443,13 +436,13 @@ public List Basis [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Holder + public Hl7.Fhir.Model.ResourceReference? Holder { get { return _Holder; } set { _Holder = value; OnPropertyChanged("Holder"); } } - private Hl7.Fhir.Model.ResourceReference _Holder; + private Hl7.Fhir.Model.ResourceReference? _Holder; /// /// The regulatory authority or authorizing body granting the authorization. @@ -458,53 +451,49 @@ public Hl7.Fhir.Model.ResourceReference Holder [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Regulator + public Hl7.Fhir.Model.ResourceReference? Regulator { get { return _Regulator; } set { _Regulator = value; OnPropertyChanged("Regulator"); } } - private Hl7.Fhir.Model.ResourceReference _Regulator; + private Hl7.Fhir.Model.ResourceReference? _Regulator; /// /// The case or regulatory procedure for granting or amending a regulated authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page). /// [FhirElement("case", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent Case + public Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent? Case { get { return _Case; } set { _Case = value; OnPropertyChanged("Case"); } } - private Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent _Case; + private Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent? _Case; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RegulatedAuthorization; - - if (dest == null) - { + if(other is not RegulatedAuthorization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Region.Any()) dest.Region = new List(Region.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(Indication != null) dest.Indication = (Hl7.Fhir.Model.CodeableReference)Indication.DeepCopyInternal(); - if(IntendedUse != null) dest.IntendedUse = (Hl7.Fhir.Model.CodeableConcept)IntendedUse.DeepCopyInternal(); - if(Basis.Any()) dest.Basis = new List(Basis.DeepCopyInternal()); - if(Holder != null) dest.Holder = (Hl7.Fhir.Model.ResourceReference)Holder.DeepCopyInternal(); - if(Regulator != null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)Regulator.DeepCopyInternal(); - if(Case != null) dest.Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent)Case.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Region is not null) dest.Region = new List(_Region.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_Indication is not null) dest.Indication = (Hl7.Fhir.Model.CodeableReference)_Indication.DeepCopyInternal(); + if(_IntendedUse is not null) dest.IntendedUse = (Hl7.Fhir.Model.CodeableConcept)_IntendedUse.DeepCopyInternal(); + if(_Basis is not null) dest.Basis = new List(_Basis.DeepCopyInternal()); + if(_Holder is not null) dest.Holder = (Hl7.Fhir.Model.ResourceReference)_Holder.DeepCopyInternal(); + if(_Regulator is not null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)_Regulator.DeepCopyInternal(); + if(_Case is not null) dest.Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent)_Case.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -516,125 +505,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RegulatedAuthorization; - if(otherT == null) return false; + if(other is not RegulatedAuthorization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Region, otherT.Region)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(IntendedUse, otherT.IntendedUse)) return false; - if(!comparer.ListEquals(Basis, otherT.Basis)) return false; - if(!comparer.Equals(Holder, otherT.Holder)) return false; - if(!comparer.Equals(Regulator, otherT.Regulator)) return false; - if(!comparer.Equals(Case, otherT.Case)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Region, otherT._Region)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_IntendedUse, otherT._IntendedUse)) return false; + if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + if(!comparer.Equals(_Holder, otherT._Holder)) return false; + if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; + if(!comparer.Equals(_Case, otherT._Case)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "region": - value = Region; - return Region?.Any() == true; + value = _Region; + return _Region?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "indication": - value = Indication; - return Indication is not null; + value = _Indication; + return _Indication is not null; case "intendedUse": - value = IntendedUse; - return IntendedUse is not null; + value = _IntendedUse; + return _IntendedUse is not null; case "basis": - value = Basis; - return Basis?.Any() == true; + value = _Basis; + return _Basis?.Any() == true; case "holder": - value = Holder; - return Holder is not null; + value = _Holder; + return _Holder is not null; case "regulator": - value = Regulator; - return Regulator is not null; + value = _Regulator; + return _Regulator is not null; case "case": - value = Case; - return Case is not null; + value = _Case; + return _Case is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "region": - Region = (List)value; + Region = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "indication": - Indication = (Hl7.Fhir.Model.CodeableReference)value; + Indication = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "intendedUse": - IntendedUse = (Hl7.Fhir.Model.CodeableConcept)value; + IntendedUse = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "basis": - Basis = (List)value; + Basis = (List?)value!; return this; case "holder": - Holder = (Hl7.Fhir.Model.ResourceReference)value; + Holder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "regulator": - Regulator = (Hl7.Fhir.Model.ResourceReference)value; + Regulator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "case": - Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent)value; + Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent?)value; return this; default: return base.SetValue(key, value); @@ -645,20 +634,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Region?.Any() == true) yield return new KeyValuePair("region",Region); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (Indication is not null) yield return new KeyValuePair("indication",Indication); - if (IntendedUse is not null) yield return new KeyValuePair("intendedUse",IntendedUse); - if (Basis?.Any() == true) yield return new KeyValuePair("basis",Basis); - if (Holder is not null) yield return new KeyValuePair("holder",Holder); - if (Regulator is not null) yield return new KeyValuePair("regulator",Regulator); - if (Case is not null) yield return new KeyValuePair("case",Case); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Region?.Any() == true) yield return new KeyValuePair("region",_Region); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_Indication is not null) yield return new KeyValuePair("indication",_Indication); + if (_IntendedUse is not null) yield return new KeyValuePair("intendedUse",_IntendedUse); + if (_Basis?.Any() == true) yield return new KeyValuePair("basis",_Basis); + if (_Holder is not null) yield return new KeyValuePair("holder",_Holder); + if (_Regulator is not null) yield return new KeyValuePair("regulator",_Regulator); + if (_Case is not null) yield return new KeyValuePair("case",_Case); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs index 6d9ca8198..45cffd184 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,26 +85,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -110,29 +113,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -144,41 +140,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -189,8 +185,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -203,24 +199,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this related person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this related person's record is in active use @@ -229,13 +225,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -248,13 +241,13 @@ public bool? Active [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// The nature of the relationship. @@ -265,11 +258,11 @@ public Hl7.Fhir.Model.ResourceReference Patient [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// A name associated with the person. @@ -279,11 +272,11 @@ public List Relationship [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -293,11 +286,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -306,13 +299,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -321,13 +314,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -337,28 +327,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the related person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -371,11 +358,11 @@ public string BirthDate [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. @@ -385,24 +372,24 @@ public List Address [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Period of time that this relationship is considered valid. /// [FhirElement("period", Order=190, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// A language which may be used to communicate with about the patient's health. @@ -412,36 +399,32 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedPerson; - - if (dest == null) - { + if(other is not RelatedPerson dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -453,111 +436,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedPerson; - if(otherT == null) return false; + if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -568,18 +551,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs index 06337f94b..a870e57bf 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,28 +83,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("prefix", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// User-visible prefix for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -111,28 +111,25 @@ public string Prefix /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -142,28 +139,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -173,28 +167,25 @@ public string Description /// [FhirElement("textEquivalent", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextEquivalentElement + public Hl7.Fhir.Model.FhirString? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.FhirString _TextEquivalentElement; + private Hl7.Fhir.Model.FhirString? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.FhirString(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextEquivalent"); } } @@ -206,13 +197,13 @@ public string TextEquivalent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -221,13 +212,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -240,11 +228,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting documentation for the intended performer of the action. @@ -254,11 +242,11 @@ public List Code [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// Whether or not the action is applicable. @@ -268,11 +256,11 @@ public List Documentation [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Relationship to another action. @@ -282,11 +270,11 @@ public List Condition [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -295,13 +283,13 @@ public List RelatedAction [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Who should perform the action. @@ -313,11 +301,11 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -325,13 +313,13 @@ public List Participant [FhirElement("type", Order=150)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// visual-group | logical-group | sentence-group. @@ -340,13 +328,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -355,13 +343,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -373,13 +358,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -388,13 +373,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -406,13 +388,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -421,13 +403,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -439,13 +418,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -454,13 +433,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -472,13 +448,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -487,13 +463,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -505,13 +478,13 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; /// /// Sub action. @@ -521,41 +494,37 @@ public Hl7.Fhir.Model.ResourceReference Resource [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)TextEquivalentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.FhirString)_TextEquivalentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -567,160 +536,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.FhirString)value; + TextEquivalentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -731,25 +700,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -779,13 +748,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -794,13 +763,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -810,26 +776,22 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -841,41 +803,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -886,8 +848,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -914,28 +876,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("actionId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ActionIdElement + public Hl7.Fhir.Model.Id? ActionIdElement { get { return _ActionIdElement; } set { _ActionIdElement = value; OnPropertyChanged("ActionIdElement"); } } - private Hl7.Fhir.Model.Id _ActionIdElement; + private Hl7.Fhir.Model.Id? _ActionIdElement; /// /// What action this is related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActionId + public string? ActionId { - get { return ActionIdElement != null ? ActionIdElement.Value : null; } + get => _ActionIdElement?.Value; set { - if (value == null) - ActionIdElement = null; - else - ActionIdElement = new Hl7.Fhir.Model.Id(value); + ActionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ActionId"); } } @@ -948,13 +907,13 @@ public string ActionId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end @@ -963,13 +922,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -981,27 +937,23 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActionIdElement != null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)ActionIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_ActionIdElement is not null) dest.ActionIdElement = (Hl7.Fhir.Model.Id)_ActionIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1013,48 +965,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActionIdElement, otherT.ActionIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actionId": - value = ActionIdElement; - return ActionIdElement is not null; + value = _ActionIdElement; + return _ActionIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actionId": - ActionIdElement = (Hl7.Fhir.Model.Id)value; + ActionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1065,9 +1017,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActionIdElement is not null) yield return new KeyValuePair("actionId",ActionIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_ActionIdElement is not null) yield return new KeyValuePair("actionId",_ActionIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -1080,11 +1032,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -1094,24 +1046,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1126,24 +1078,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1160,11 +1112,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -1176,24 +1128,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -1203,13 +1155,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("RequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -1218,13 +1170,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1237,13 +1186,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -1252,13 +1201,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1270,13 +1216,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -1285,13 +1231,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -1301,13 +1244,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("code", InSummary=true, Order=180, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the request group is about. @@ -1316,13 +1259,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Created as part of. @@ -1331,41 +1274,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the request group was authored. /// [FhirElement("authoredOn", Order=210, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request group was authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -1377,13 +1317,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Why the request group is needed. @@ -1393,11 +1333,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why the request group is needed. @@ -1409,11 +1349,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Additional notes about the response. @@ -1423,11 +1363,11 @@ public List ReasonReference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Proposed actions, if any. @@ -1437,42 +1377,38 @@ public List Note [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestGroup; - - if (dest == null) - { + if(other is not RequestGroup dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1484,153 +1420,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestGroup; - if(otherT == null) return false; + if(other is not RequestGroup otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1641,24 +1577,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs index 448be5401..7ad658580 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ResearchDefinition : Hl7.Fhir.Model.DomainResource, IIdenti /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this research definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the research definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the research definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -140,28 +137,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this research definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -171,28 +165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this research definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -202,28 +193,25 @@ public string Title /// [FhirElement("shortTitle", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -233,28 +221,25 @@ public string ShortTitle /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the ResearchDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -267,13 +252,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -282,13 +267,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -298,13 +280,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -313,13 +295,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -333,41 +312,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -377,28 +353,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -411,39 +384,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the research definition. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the research definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -456,24 +426,24 @@ public string Description [DataMember] public List CommentElement { - get { if(_CommentElement==null) _CommentElement = new List(); return _CommentElement; } + get => _CommentElement ?? new List(); set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private List _CommentElement; + private List? _CommentElement; /// /// Used for footnotes or explanatory notes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comment + public IEnumerable? Comment { - get { return CommentElement != null ? CommentElement.Select(elem => elem.Value) : null; } + get => _CommentElement?.Select(elem => elem.Value); set { if (value == null) - CommentElement = null; + CommentElement = null!; else CommentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Comment"); @@ -488,11 +458,11 @@ public IEnumerable Comment [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for research definition (if applicable). @@ -503,39 +473,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this research definition is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this research definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -545,28 +512,25 @@ public string Purpose /// [FhirElement("usage", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the ResearchDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -576,28 +540,25 @@ public string Usage /// [FhirElement("copyright", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -607,28 +568,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the research definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -638,28 +596,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the research definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -669,13 +624,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the ResearchDefinition, such as Education, Treatment, Assessment, etc. @@ -686,11 +641,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -700,11 +655,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -714,11 +669,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -728,11 +683,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -742,11 +697,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -756,11 +711,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the ResearchDefinition. @@ -770,24 +725,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the ResearchDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -802,13 +757,13 @@ public IEnumerable Library [References("ResearchElementDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Population + public Hl7.Fhir.Model.ResourceReference? Population { get { return _Population; } set { _Population = value; OnPropertyChanged("Population"); } } - private Hl7.Fhir.Model.ResourceReference _Population; + private Hl7.Fhir.Model.ResourceReference? _Population; /// /// What exposure?. @@ -817,13 +772,13 @@ public Hl7.Fhir.Model.ResourceReference Population [CLSCompliant(false)] [References("ResearchElementDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Exposure + public Hl7.Fhir.Model.ResourceReference? Exposure { get { return _Exposure; } set { _Exposure = value; OnPropertyChanged("Exposure"); } } - private Hl7.Fhir.Model.ResourceReference _Exposure; + private Hl7.Fhir.Model.ResourceReference? _Exposure; /// /// What alternative exposure state?. @@ -832,13 +787,13 @@ public Hl7.Fhir.Model.ResourceReference Exposure [CLSCompliant(false)] [References("ResearchElementDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ExposureAlternative + public Hl7.Fhir.Model.ResourceReference? ExposureAlternative { get { return _ExposureAlternative; } set { _ExposureAlternative = value; OnPropertyChanged("ExposureAlternative"); } } - private Hl7.Fhir.Model.ResourceReference _ExposureAlternative; + private Hl7.Fhir.Model.ResourceReference? _ExposureAlternative; /// /// What outcome?. @@ -847,60 +802,56 @@ public Hl7.Fhir.Model.ResourceReference ExposureAlternative [CLSCompliant(false)] [References("ResearchElementDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Outcome + public Hl7.Fhir.Model.ResourceReference? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.ResourceReference _Outcome; + private Hl7.Fhir.Model.ResourceReference? _Outcome; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchDefinition; - - if (dest == null) - { + if(other is not ResearchDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(CommentElement.Any()) dest.CommentElement = new List(CommentElement.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(Population != null) dest.Population = (Hl7.Fhir.Model.ResourceReference)Population.DeepCopyInternal(); - if(Exposure != null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)Exposure.DeepCopyInternal(); - if(ExposureAlternative != null) dest.ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)ExposureAlternative.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)Outcome.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = new List(_CommentElement.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_Population is not null) dest.Population = (Hl7.Fhir.Model.ResourceReference)_Population.DeepCopyInternal(); + if(_Exposure is not null) dest.Exposure = (Hl7.Fhir.Model.ResourceReference)_Exposure.DeepCopyInternal(); + if(_ExposureAlternative is not null) dest.ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)_ExposureAlternative.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.ResourceReference)_Outcome.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -912,265 +863,265 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchDefinition; - if(otherT == null) return false; + if(other is not ResearchDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(Population, otherT.Population)) return false; - if(!comparer.Equals(Exposure, otherT.Exposure)) return false; - if(!comparer.Equals(ExposureAlternative, otherT.ExposureAlternative)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_Exposure, otherT._Exposure)) return false; + if(!comparer.Equals(_ExposureAlternative, otherT._ExposureAlternative)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "comment": - value = CommentElement; - return CommentElement?.Any() == true; + value = _CommentElement; + return _CommentElement?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "population": - value = Population; - return Population is not null; + value = _Population; + return _Population is not null; case "exposure": - value = Exposure; - return Exposure is not null; + value = _Exposure; + return _Exposure is not null; case "exposureAlternative": - value = ExposureAlternative; - return ExposureAlternative is not null; + value = _ExposureAlternative; + return _ExposureAlternative is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "comment": - CommentElement = (List)value; + CommentElement = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "population": - Population = (Hl7.Fhir.Model.ResourceReference)value; + Population = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposure": - Exposure = (Hl7.Fhir.Model.ResourceReference)value; + Exposure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "exposureAlternative": - ExposureAlternative = (Hl7.Fhir.Model.ResourceReference)value; + ExposureAlternative = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.ResourceReference)value; + Outcome = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1181,40 +1132,40 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (CommentElement?.Any() == true) yield return new KeyValuePair("comment",CommentElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (Population is not null) yield return new KeyValuePair("population",Population); - if (Exposure is not null) yield return new KeyValuePair("exposure",Exposure); - if (ExposureAlternative is not null) yield return new KeyValuePair("exposureAlternative",ExposureAlternative); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_CommentElement?.Any() == true) yield return new KeyValuePair("comment",_CommentElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_Population is not null) yield return new KeyValuePair("population",_Population); + if (_Exposure is not null) yield return new KeyValuePair("exposure",_Exposure); + if (_ExposureAlternative is not null) yield return new KeyValuePair("exposureAlternative",_ExposureAlternative); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs index 4fed5ff32..63831595b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -141,13 +144,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.DataRequirement))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// What code/value pairs define members?. @@ -157,24 +160,24 @@ public Hl7.Fhir.Model.DataType Definition [DataMember] public List UsageContext { - get { if(_UsageContext==null) _UsageContext = new List(); return _UsageContext; } + get => _UsageContext ?? new List(); set { _UsageContext = value; OnPropertyChanged("UsageContext"); } } - private List _UsageContext; + private List? _UsageContext; /// /// Whether the characteristic includes or excludes members. /// [FhirElement("exclude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Whether the characteristic includes or excludes members @@ -183,13 +186,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -200,41 +200,38 @@ public bool? Exclude [FhirElement("unitOfMeasure", Order=70)] [Binding("UCUMUnits")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfMeasure + public Hl7.Fhir.Model.CodeableConcept? UnitOfMeasure { get { return _UnitOfMeasure; } set { _UnitOfMeasure = value; OnPropertyChanged("UnitOfMeasure"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfMeasure; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfMeasure; /// /// What time period does the study cover. /// [FhirElement("studyEffectiveDescription", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString StudyEffectiveDescriptionElement + public Hl7.Fhir.Model.FhirString? StudyEffectiveDescriptionElement { get { return _StudyEffectiveDescriptionElement; } set { _StudyEffectiveDescriptionElement = value; OnPropertyChanged("StudyEffectiveDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _StudyEffectiveDescriptionElement; + private Hl7.Fhir.Model.FhirString? _StudyEffectiveDescriptionElement; /// /// What time period does the study cover /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StudyEffectiveDescription + public string? StudyEffectiveDescription { - get { return StudyEffectiveDescriptionElement != null ? StudyEffectiveDescriptionElement.Value : null; } + get => _StudyEffectiveDescriptionElement?.Value; set { - if (value == null) - StudyEffectiveDescriptionElement = null; - else - StudyEffectiveDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + StudyEffectiveDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StudyEffectiveDescription"); } } @@ -246,26 +243,26 @@ public string StudyEffectiveDescription [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType StudyEffective + public Hl7.Fhir.Model.DataType? StudyEffective { get { return _StudyEffective; } set { _StudyEffective = value; OnPropertyChanged("StudyEffective"); } } - private Hl7.Fhir.Model.DataType _StudyEffective; + private Hl7.Fhir.Model.DataType? _StudyEffective; /// /// Observation time from study start. /// [FhirElement("studyEffectiveTimeFromStart", Order=100)] [DataMember] - public Hl7.Fhir.Model.Duration StudyEffectiveTimeFromStart + public Hl7.Fhir.Model.Duration? StudyEffectiveTimeFromStart { get { return _StudyEffectiveTimeFromStart; } set { _StudyEffectiveTimeFromStart = value; OnPropertyChanged("StudyEffectiveTimeFromStart"); } } - private Hl7.Fhir.Model.Duration _StudyEffectiveTimeFromStart; + private Hl7.Fhir.Model.Duration? _StudyEffectiveTimeFromStart; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median. @@ -274,13 +271,13 @@ public Hl7.Fhir.Model.Duration StudyEffectiveTimeFromStart [DeclaredType(Type = typeof(Code))] [Binding("GroupMeasure")] [DataMember] - public Code StudyEffectiveGroupMeasureElement + public Code? StudyEffectiveGroupMeasureElement { get { return _StudyEffectiveGroupMeasureElement; } set { _StudyEffectiveGroupMeasureElement = value; OnPropertyChanged("StudyEffectiveGroupMeasureElement"); } } - private Code _StudyEffectiveGroupMeasureElement; + private Code? _StudyEffectiveGroupMeasureElement; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median @@ -289,13 +286,10 @@ public Code StudyEffectiveGroupMeasureElement [IgnoreDataMember] public Hl7.Fhir.Model.GroupMeasureCode? StudyEffectiveGroupMeasure { - get { return StudyEffectiveGroupMeasureElement != null ? StudyEffectiveGroupMeasureElement.Value : null; } + get => _StudyEffectiveGroupMeasureElement?.Value; set { - if (value == null) - StudyEffectiveGroupMeasureElement = null; - else - StudyEffectiveGroupMeasureElement = new Code(value); + StudyEffectiveGroupMeasureElement = value is null ? null : new Code(value); OnPropertyChanged("StudyEffectiveGroupMeasure"); } } @@ -305,28 +299,25 @@ public Hl7.Fhir.Model.GroupMeasureCode? StudyEffectiveGroupMeasure /// [FhirElement("participantEffectiveDescription", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ParticipantEffectiveDescriptionElement + public Hl7.Fhir.Model.FhirString? ParticipantEffectiveDescriptionElement { get { return _ParticipantEffectiveDescriptionElement; } set { _ParticipantEffectiveDescriptionElement = value; OnPropertyChanged("ParticipantEffectiveDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _ParticipantEffectiveDescriptionElement; + private Hl7.Fhir.Model.FhirString? _ParticipantEffectiveDescriptionElement; /// /// What time period do participants cover /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ParticipantEffectiveDescription + public string? ParticipantEffectiveDescription { - get { return ParticipantEffectiveDescriptionElement != null ? ParticipantEffectiveDescriptionElement.Value : null; } + get => _ParticipantEffectiveDescriptionElement?.Value; set { - if (value == null) - ParticipantEffectiveDescriptionElement = null; - else - ParticipantEffectiveDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + ParticipantEffectiveDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ParticipantEffectiveDescription"); } } @@ -338,26 +329,26 @@ public string ParticipantEffectiveDescription [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType ParticipantEffective + public Hl7.Fhir.Model.DataType? ParticipantEffective { get { return _ParticipantEffective; } set { _ParticipantEffective = value; OnPropertyChanged("ParticipantEffective"); } } - private Hl7.Fhir.Model.DataType _ParticipantEffective; + private Hl7.Fhir.Model.DataType? _ParticipantEffective; /// /// Observation time from study start. /// [FhirElement("participantEffectiveTimeFromStart", Order=140)] [DataMember] - public Hl7.Fhir.Model.Duration ParticipantEffectiveTimeFromStart + public Hl7.Fhir.Model.Duration? ParticipantEffectiveTimeFromStart { get { return _ParticipantEffectiveTimeFromStart; } set { _ParticipantEffectiveTimeFromStart = value; OnPropertyChanged("ParticipantEffectiveTimeFromStart"); } } - private Hl7.Fhir.Model.Duration _ParticipantEffectiveTimeFromStart; + private Hl7.Fhir.Model.Duration? _ParticipantEffectiveTimeFromStart; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median. @@ -366,13 +357,13 @@ public Hl7.Fhir.Model.Duration ParticipantEffectiveTimeFromStart [DeclaredType(Type = typeof(Code))] [Binding("GroupMeasure")] [DataMember] - public Code ParticipantEffectiveGroupMeasureElement + public Code? ParticipantEffectiveGroupMeasureElement { get { return _ParticipantEffectiveGroupMeasureElement; } set { _ParticipantEffectiveGroupMeasureElement = value; OnPropertyChanged("ParticipantEffectiveGroupMeasureElement"); } } - private Code _ParticipantEffectiveGroupMeasureElement; + private Code? _ParticipantEffectiveGroupMeasureElement; /// /// mean | median | mean-of-mean | mean-of-median | median-of-mean | median-of-median @@ -381,39 +372,32 @@ public Code ParticipantEffectiveGroupMeasureEle [IgnoreDataMember] public Hl7.Fhir.Model.GroupMeasureCode? ParticipantEffectiveGroupMeasure { - get { return ParticipantEffectiveGroupMeasureElement != null ? ParticipantEffectiveGroupMeasureElement.Value : null; } + get => _ParticipantEffectiveGroupMeasureElement?.Value; set { - if (value == null) - ParticipantEffectiveGroupMeasureElement = null; - else - ParticipantEffectiveGroupMeasureElement = new Code(value); + ParticipantEffectiveGroupMeasureElement = value is null ? null : new Code(value); OnPropertyChanged("ParticipantEffectiveGroupMeasure"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(UsageContext.Any()) dest.UsageContext = new List(UsageContext.DeepCopyInternal()); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(UnitOfMeasure != null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)UnitOfMeasure.DeepCopyInternal(); - if(StudyEffectiveDescriptionElement != null) dest.StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)StudyEffectiveDescriptionElement.DeepCopyInternal(); - if(StudyEffective != null) dest.StudyEffective = (Hl7.Fhir.Model.DataType)StudyEffective.DeepCopyInternal(); - if(StudyEffectiveTimeFromStart != null) dest.StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)StudyEffectiveTimeFromStart.DeepCopyInternal(); - if(StudyEffectiveGroupMeasureElement != null) dest.StudyEffectiveGroupMeasureElement = (Code)StudyEffectiveGroupMeasureElement.DeepCopyInternal(); - if(ParticipantEffectiveDescriptionElement != null) dest.ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)ParticipantEffectiveDescriptionElement.DeepCopyInternal(); - if(ParticipantEffective != null) dest.ParticipantEffective = (Hl7.Fhir.Model.DataType)ParticipantEffective.DeepCopyInternal(); - if(ParticipantEffectiveTimeFromStart != null) dest.ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)ParticipantEffectiveTimeFromStart.DeepCopyInternal(); - if(ParticipantEffectiveGroupMeasureElement != null) dest.ParticipantEffectiveGroupMeasureElement = (Code)ParticipantEffectiveGroupMeasureElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_UsageContext is not null) dest.UsageContext = new List(_UsageContext.DeepCopyInternal()); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_UnitOfMeasure is not null) dest.UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)_UnitOfMeasure.DeepCopyInternal(); + if(_StudyEffectiveDescriptionElement is not null) dest.StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)_StudyEffectiveDescriptionElement.DeepCopyInternal(); + if(_StudyEffective is not null) dest.StudyEffective = (Hl7.Fhir.Model.DataType)_StudyEffective.DeepCopyInternal(); + if(_StudyEffectiveTimeFromStart is not null) dest.StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)_StudyEffectiveTimeFromStart.DeepCopyInternal(); + if(_StudyEffectiveGroupMeasureElement is not null) dest.StudyEffectiveGroupMeasureElement = (Code)_StudyEffectiveGroupMeasureElement.DeepCopyInternal(); + if(_ParticipantEffectiveDescriptionElement is not null) dest.ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)_ParticipantEffectiveDescriptionElement.DeepCopyInternal(); + if(_ParticipantEffective is not null) dest.ParticipantEffective = (Hl7.Fhir.Model.DataType)_ParticipantEffective.DeepCopyInternal(); + if(_ParticipantEffectiveTimeFromStart is not null) dest.ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)_ParticipantEffectiveTimeFromStart.DeepCopyInternal(); + if(_ParticipantEffectiveGroupMeasureElement is not null) dest.ParticipantEffectiveGroupMeasureElement = (Code)_ParticipantEffectiveGroupMeasureElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -425,111 +409,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(UsageContext, otherT.UsageContext)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(UnitOfMeasure, otherT.UnitOfMeasure)) return false; - if(!comparer.Equals(StudyEffectiveDescriptionElement, otherT.StudyEffectiveDescriptionElement)) return false; - if(!comparer.Equals(StudyEffective, otherT.StudyEffective)) return false; - if(!comparer.Equals(StudyEffectiveTimeFromStart, otherT.StudyEffectiveTimeFromStart)) return false; - if(!comparer.Equals(StudyEffectiveGroupMeasureElement, otherT.StudyEffectiveGroupMeasureElement)) return false; - if(!comparer.Equals(ParticipantEffectiveDescriptionElement, otherT.ParticipantEffectiveDescriptionElement)) return false; - if(!comparer.Equals(ParticipantEffective, otherT.ParticipantEffective)) return false; - if(!comparer.Equals(ParticipantEffectiveTimeFromStart, otherT.ParticipantEffectiveTimeFromStart)) return false; - if(!comparer.Equals(ParticipantEffectiveGroupMeasureElement, otherT.ParticipantEffectiveGroupMeasureElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_UsageContext, otherT._UsageContext)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; + if(!comparer.Equals(_StudyEffectiveDescriptionElement, otherT._StudyEffectiveDescriptionElement)) return false; + if(!comparer.Equals(_StudyEffective, otherT._StudyEffective)) return false; + if(!comparer.Equals(_StudyEffectiveTimeFromStart, otherT._StudyEffectiveTimeFromStart)) return false; + if(!comparer.Equals(_StudyEffectiveGroupMeasureElement, otherT._StudyEffectiveGroupMeasureElement)) return false; + if(!comparer.Equals(_ParticipantEffectiveDescriptionElement, otherT._ParticipantEffectiveDescriptionElement)) return false; + if(!comparer.Equals(_ParticipantEffective, otherT._ParticipantEffective)) return false; + if(!comparer.Equals(_ParticipantEffectiveTimeFromStart, otherT._ParticipantEffectiveTimeFromStart)) return false; + if(!comparer.Equals(_ParticipantEffectiveGroupMeasureElement, otherT._ParticipantEffectiveGroupMeasureElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "usageContext": - value = UsageContext; - return UsageContext?.Any() == true; + value = _UsageContext; + return _UsageContext?.Any() == true; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "unitOfMeasure": - value = UnitOfMeasure; - return UnitOfMeasure is not null; + value = _UnitOfMeasure; + return _UnitOfMeasure is not null; case "studyEffectiveDescription": - value = StudyEffectiveDescriptionElement; - return StudyEffectiveDescriptionElement is not null; + value = _StudyEffectiveDescriptionElement; + return _StudyEffectiveDescriptionElement is not null; case "studyEffective": - value = StudyEffective; - return StudyEffective is not null; + value = _StudyEffective; + return _StudyEffective is not null; case "studyEffectiveTimeFromStart": - value = StudyEffectiveTimeFromStart; - return StudyEffectiveTimeFromStart is not null; + value = _StudyEffectiveTimeFromStart; + return _StudyEffectiveTimeFromStart is not null; case "studyEffectiveGroupMeasure": - value = StudyEffectiveGroupMeasureElement; - return StudyEffectiveGroupMeasureElement is not null; + value = _StudyEffectiveGroupMeasureElement; + return _StudyEffectiveGroupMeasureElement is not null; case "participantEffectiveDescription": - value = ParticipantEffectiveDescriptionElement; - return ParticipantEffectiveDescriptionElement is not null; + value = _ParticipantEffectiveDescriptionElement; + return _ParticipantEffectiveDescriptionElement is not null; case "participantEffective": - value = ParticipantEffective; - return ParticipantEffective is not null; + value = _ParticipantEffective; + return _ParticipantEffective is not null; case "participantEffectiveTimeFromStart": - value = ParticipantEffectiveTimeFromStart; - return ParticipantEffectiveTimeFromStart is not null; + value = _ParticipantEffectiveTimeFromStart; + return _ParticipantEffectiveTimeFromStart is not null; case "participantEffectiveGroupMeasure": - value = ParticipantEffectiveGroupMeasureElement; - return ParticipantEffectiveGroupMeasureElement is not null; + value = _ParticipantEffectiveGroupMeasureElement; + return _ParticipantEffectiveGroupMeasureElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "usageContext": - UsageContext = (List)value; + UsageContext = (List?)value!; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "unitOfMeasure": - UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfMeasure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyEffectiveDescription": - StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + StudyEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "studyEffective": - StudyEffective = (Hl7.Fhir.Model.DataType)value; + StudyEffective = (Hl7.Fhir.Model.DataType?)value; return this; case "studyEffectiveTimeFromStart": - StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)value; + StudyEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration?)value; return this; case "studyEffectiveGroupMeasure": - StudyEffectiveGroupMeasureElement = (Code)value; + StudyEffectiveGroupMeasureElement = (Code?)value; return this; case "participantEffectiveDescription": - ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + ParticipantEffectiveDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "participantEffective": - ParticipantEffective = (Hl7.Fhir.Model.DataType)value; + ParticipantEffective = (Hl7.Fhir.Model.DataType?)value; return this; case "participantEffectiveTimeFromStart": - ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration)value; + ParticipantEffectiveTimeFromStart = (Hl7.Fhir.Model.Duration?)value; return this; case "participantEffectiveGroupMeasure": - ParticipantEffectiveGroupMeasureElement = (Code)value; + ParticipantEffectiveGroupMeasureElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -540,18 +524,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (UsageContext?.Any() == true) yield return new KeyValuePair("usageContext",UsageContext); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",UnitOfMeasure); - if (StudyEffectiveDescriptionElement is not null) yield return new KeyValuePair("studyEffectiveDescription",StudyEffectiveDescriptionElement); - if (StudyEffective is not null) yield return new KeyValuePair("studyEffective",StudyEffective); - if (StudyEffectiveTimeFromStart is not null) yield return new KeyValuePair("studyEffectiveTimeFromStart",StudyEffectiveTimeFromStart); - if (StudyEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("studyEffectiveGroupMeasure",StudyEffectiveGroupMeasureElement); - if (ParticipantEffectiveDescriptionElement is not null) yield return new KeyValuePair("participantEffectiveDescription",ParticipantEffectiveDescriptionElement); - if (ParticipantEffective is not null) yield return new KeyValuePair("participantEffective",ParticipantEffective); - if (ParticipantEffectiveTimeFromStart is not null) yield return new KeyValuePair("participantEffectiveTimeFromStart",ParticipantEffectiveTimeFromStart); - if (ParticipantEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("participantEffectiveGroupMeasure",ParticipantEffectiveGroupMeasureElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_UsageContext?.Any() == true) yield return new KeyValuePair("usageContext",_UsageContext); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_UnitOfMeasure is not null) yield return new KeyValuePair("unitOfMeasure",_UnitOfMeasure); + if (_StudyEffectiveDescriptionElement is not null) yield return new KeyValuePair("studyEffectiveDescription",_StudyEffectiveDescriptionElement); + if (_StudyEffective is not null) yield return new KeyValuePair("studyEffective",_StudyEffective); + if (_StudyEffectiveTimeFromStart is not null) yield return new KeyValuePair("studyEffectiveTimeFromStart",_StudyEffectiveTimeFromStart); + if (_StudyEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("studyEffectiveGroupMeasure",_StudyEffectiveGroupMeasureElement); + if (_ParticipantEffectiveDescriptionElement is not null) yield return new KeyValuePair("participantEffectiveDescription",_ParticipantEffectiveDescriptionElement); + if (_ParticipantEffective is not null) yield return new KeyValuePair("participantEffective",_ParticipantEffective); + if (_ParticipantEffectiveTimeFromStart is not null) yield return new KeyValuePair("participantEffectiveTimeFromStart",_ParticipantEffectiveTimeFromStart); + if (_ParticipantEffectiveGroupMeasureElement is not null) yield return new KeyValuePair("participantEffectiveGroupMeasure",_ParticipantEffectiveGroupMeasureElement); } } @@ -561,28 +545,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this research element definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -595,39 +576,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the research element definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the research element definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -637,28 +615,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this research element definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -668,28 +643,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this research element definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -699,28 +671,25 @@ public string Title /// [FhirElement("shortTitle", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -730,28 +699,25 @@ public string ShortTitle /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the ResearchElementDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -764,13 +730,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -779,13 +745,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -795,13 +758,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -810,13 +773,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -830,41 +790,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -874,28 +831,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -908,39 +862,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the research element definition. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the research element definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -953,24 +904,24 @@ public string Description [DataMember] public List CommentElement { - get { if(_CommentElement==null) _CommentElement = new List(); return _CommentElement; } + get => _CommentElement ?? new List(); set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private List _CommentElement; + private List? _CommentElement; /// /// Used for footnotes or explanatory notes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comment + public IEnumerable? Comment { - get { return CommentElement != null ? CommentElement.Select(elem => elem.Value) : null; } + get => _CommentElement?.Select(elem => elem.Value); set { if (value == null) - CommentElement = null; + CommentElement = null!; else CommentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Comment"); @@ -985,11 +936,11 @@ public IEnumerable Comment [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for research element definition (if applicable). @@ -1000,39 +951,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this research element definition is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this research element definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1042,28 +990,25 @@ public string Purpose /// [FhirElement("usage", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// Describes the clinical usage of the ResearchElementDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -1073,28 +1018,25 @@ public string Usage /// [FhirElement("copyright", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1104,28 +1046,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the research element definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1135,28 +1074,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the research element definition was last reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1166,13 +1102,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the ResearchElementDefinition, such as Education, Treatment, Assessment, etc. @@ -1183,11 +1119,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1197,11 +1133,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1211,11 +1147,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1225,11 +1161,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1239,11 +1175,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1253,11 +1189,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the ResearchElementDefinition. @@ -1267,24 +1203,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the ResearchElementDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1299,13 +1235,13 @@ public IEnumerable Library [Binding("ResearchElementType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// population | exposure | outcome @@ -1314,13 +1250,10 @@ public Code TypeEl [IgnoreDataMember] public Hl7.Fhir.Model.ResearchElementDefinition.ResearchElementType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1332,13 +1265,13 @@ public Hl7.Fhir.Model.ResearchElementDefinition.ResearchElementType? Type [DeclaredType(Type = typeof(Code))] [Binding("VariableType")] [DataMember] - public Code VariableTypeElement + public Code? VariableTypeElement { get { return _VariableTypeElement; } set { _VariableTypeElement = value; OnPropertyChanged("VariableTypeElement"); } } - private Code _VariableTypeElement; + private Code? _VariableTypeElement; /// /// dichotomous | continuous | descriptive @@ -1347,13 +1280,10 @@ public Code VariableT [IgnoreDataMember] public Hl7.Fhir.Model.ResearchElementDefinition.VariableTypeCode? VariableType { - get { return VariableTypeElement != null ? VariableTypeElement.Value : null; } + get => _VariableTypeElement?.Value; set { - if (value == null) - VariableTypeElement = null; - else - VariableTypeElement = new Code(value); + VariableTypeElement = value is null ? null : new Code(value); OnPropertyChanged("VariableType"); } } @@ -1366,57 +1296,53 @@ public Hl7.Fhir.Model.ResearchElementDefinition.VariableTypeCode? VariableType [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchElementDefinition; - - if (dest == null) - { + if(other is not ResearchElementDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(CommentElement.Any()) dest.CommentElement = new List(CommentElement.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(VariableTypeElement != null) dest.VariableTypeElement = (Code)VariableTypeElement.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = new List(_CommentElement.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_VariableTypeElement is not null) dest.VariableTypeElement = (Code)_VariableTypeElement.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1428,258 +1354,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchElementDefinition; - if(otherT == null) return false; + if(other is not ResearchElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(VariableTypeElement, otherT.VariableTypeElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_VariableTypeElement, otherT._VariableTypeElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "comment": - value = CommentElement; - return CommentElement?.Any() == true; + value = _CommentElement; + return _CommentElement?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "variableType": - value = VariableTypeElement; - return VariableTypeElement is not null; + value = _VariableTypeElement; + return _VariableTypeElement is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "comment": - CommentElement = (List)value; + CommentElement = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "variableType": - VariableTypeElement = (Code)value; + VariableTypeElement = (Code?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1690,39 +1616,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (CommentElement?.Any() == true) yield return new KeyValuePair("comment",CommentElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (VariableTypeElement is not null) yield return new KeyValuePair("variableType",VariableTypeElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_CommentElement?.Any() == true) yield return new KeyValuePair("comment",_CommentElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_VariableTypeElement is not null) yield return new KeyValuePair("variableType",_VariableTypeElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs index a374911bf..a3ac8598c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -158,28 +161,25 @@ public partial class ArmComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for study arm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -189,58 +189,51 @@ public string Name /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Short explanation of study path. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short explanation of study path /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ArmComponent; - - if (dest == null) - { + if(other is not ArmComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -252,48 +245,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ArmComponent; - if(otherT == null) return false; + if(other is not ArmComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -304,9 +297,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -332,28 +325,25 @@ public partial class ObjectiveComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for the objective /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -364,26 +354,22 @@ public string Name [FhirElement("type", Order=50)] [Binding("ResearchStudyObjectiveType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as ObjectiveComponent; - - if (dest == null) - { + if(other is not ObjectiveComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -395,41 +381,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ObjectiveComponent; - if(otherT == null) return false; + if(other is not ObjectiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -440,8 +426,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -454,39 +440,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Name for this study. /// [FhirElement("title", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -501,11 +484,11 @@ public string Title [DataMember] public List Protocol { - get { if(_Protocol==null) _Protocol = new List(); return _Protocol; } + get => _Protocol ?? new List(); set { _Protocol = value; OnPropertyChanged("Protocol"); } } - private List _Protocol; + private List? _Protocol; /// /// Part of larger study. @@ -517,11 +500,11 @@ public List Protocol [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn. @@ -531,13 +514,13 @@ public List PartOf [Binding("ResearchStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | administratively-completed | approved | closed-to-accrual | closed-to-accrual-and-intervention | completed | disapproved | in-review | temporarily-closed-to-accrual | temporarily-closed-to-accrual-and-intervention | withdrawn @@ -546,13 +529,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -563,13 +543,13 @@ public Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus? Status [FhirElement("primaryPurposeType", InSummary=true, Order=140)] [Binding("ResearchStudyPrimaryPurposeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PrimaryPurposeType + public Hl7.Fhir.Model.CodeableConcept? PrimaryPurposeType { get { return _PrimaryPurposeType; } set { _PrimaryPurposeType = value; OnPropertyChanged("PrimaryPurposeType"); } } - private Hl7.Fhir.Model.CodeableConcept _PrimaryPurposeType; + private Hl7.Fhir.Model.CodeableConcept? _PrimaryPurposeType; /// /// n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4. @@ -577,13 +557,13 @@ public Hl7.Fhir.Model.CodeableConcept PrimaryPurposeType [FhirElement("phase", InSummary=true, Order=150)] [Binding("ResearchStudyPhase")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Phase + public Hl7.Fhir.Model.CodeableConcept? Phase { get { return _Phase; } set { _Phase = value; OnPropertyChanged("Phase"); } } - private Hl7.Fhir.Model.CodeableConcept _Phase; + private Hl7.Fhir.Model.CodeableConcept? _Phase; /// /// Classifications for the study. @@ -594,11 +574,11 @@ public Hl7.Fhir.Model.CodeableConcept Phase [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Drugs, devices, etc. under study. @@ -609,11 +589,11 @@ public List Category [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Condition being studied. @@ -624,11 +604,11 @@ public List Focus [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Contact details for the study. @@ -638,11 +618,11 @@ public List Condition [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// References and dependencies. @@ -652,11 +632,11 @@ public List Contact [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Used to search for the study. @@ -667,11 +647,11 @@ public List RelatedArtifact [DataMember] public List Keyword { - get { if(_Keyword==null) _Keyword = new List(); return _Keyword; } + get => _Keyword ?? new List(); set { _Keyword = value; OnPropertyChanged("Keyword"); } } - private List _Keyword; + private List? _Keyword; /// /// Geographic region(s) for study. @@ -682,39 +662,36 @@ public List Keyword [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// What this is study doing. /// [FhirElement("description", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// What this is study doing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -729,24 +706,24 @@ public string Description [DataMember] public List Enrollment { - get { if(_Enrollment==null) _Enrollment = new List(); return _Enrollment; } + get => _Enrollment ?? new List(); set { _Enrollment = value; OnPropertyChanged("Enrollment"); } } - private List _Enrollment; + private List? _Enrollment; /// /// When the study began and ended. /// [FhirElement("period", InSummary=true, Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that initiates and is legally responsible for the study. @@ -755,13 +732,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sponsor + public Hl7.Fhir.Model.ResourceReference? Sponsor { get { return _Sponsor; } set { _Sponsor = value; OnPropertyChanged("Sponsor"); } } - private Hl7.Fhir.Model.ResourceReference _Sponsor; + private Hl7.Fhir.Model.ResourceReference? _Sponsor; /// /// Researcher who oversees multiple aspects of the study. @@ -770,13 +747,13 @@ public Hl7.Fhir.Model.ResourceReference Sponsor [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PrincipalInvestigator + public Hl7.Fhir.Model.ResourceReference? PrincipalInvestigator { get { return _PrincipalInvestigator; } set { _PrincipalInvestigator = value; OnPropertyChanged("PrincipalInvestigator"); } } - private Hl7.Fhir.Model.ResourceReference _PrincipalInvestigator; + private Hl7.Fhir.Model.ResourceReference? _PrincipalInvestigator; /// /// Facility where study activities are conducted. @@ -788,11 +765,11 @@ public Hl7.Fhir.Model.ResourceReference PrincipalInvestigator [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// accrual-goal-met | closed-due-to-toxicity | closed-due-to-lack-of-study-progress | temporarily-closed-per-study-design. @@ -800,13 +777,13 @@ public List Site [FhirElement("reasonStopped", InSummary=true, Order=290, FiveWs="FiveWs.why[x]")] [Binding("ResearchStudyReasonStopped")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReasonStopped + public Hl7.Fhir.Model.CodeableConcept? ReasonStopped { get { return _ReasonStopped; } set { _ReasonStopped = value; OnPropertyChanged("ReasonStopped"); } } - private Hl7.Fhir.Model.CodeableConcept _ReasonStopped; + private Hl7.Fhir.Model.CodeableConcept? _ReasonStopped; /// /// Comments made about the study. @@ -816,11 +793,11 @@ public Hl7.Fhir.Model.CodeableConcept ReasonStopped [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Defined path through the study for a subject. @@ -830,11 +807,11 @@ public List Note [DataMember] public List Arm { - get { if(_Arm==null) _Arm = new List(); return _Arm; } + get => _Arm ?? new List(); set { _Arm = value; OnPropertyChanged("Arm"); } } - private List _Arm; + private List? _Arm; /// /// A goal for the study. @@ -844,48 +821,44 @@ public List Arm [DataMember] public List Objective { - get { if(_Objective==null) _Objective = new List(); return _Objective; } + get => _Objective ?? new List(); set { _Objective = value; OnPropertyChanged("Objective"); } } - private List _Objective; + private List? _Objective; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchStudy; - - if (dest == null) - { + if(other is not ResearchStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Protocol.Any()) dest.Protocol = new List(Protocol.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PrimaryPurposeType != null) dest.PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)PrimaryPurposeType.DeepCopyInternal(); - if(Phase != null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)Phase.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Keyword.Any()) dest.Keyword = new List(Keyword.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Enrollment.Any()) dest.Enrollment = new List(Enrollment.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Sponsor != null) dest.Sponsor = (Hl7.Fhir.Model.ResourceReference)Sponsor.DeepCopyInternal(); - if(PrincipalInvestigator != null) dest.PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)PrincipalInvestigator.DeepCopyInternal(); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(ReasonStopped != null) dest.ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)ReasonStopped.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Arm.Any()) dest.Arm = new List(Arm.DeepCopyInternal()); - if(Objective.Any()) dest.Objective = new List(Objective.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Protocol is not null) dest.Protocol = new List(_Protocol.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PrimaryPurposeType is not null) dest.PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)_PrimaryPurposeType.DeepCopyInternal(); + if(_Phase is not null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)_Phase.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Keyword is not null) dest.Keyword = new List(_Keyword.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Enrollment is not null) dest.Enrollment = new List(_Enrollment.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Sponsor is not null) dest.Sponsor = (Hl7.Fhir.Model.ResourceReference)_Sponsor.DeepCopyInternal(); + if(_PrincipalInvestigator is not null) dest.PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)_PrincipalInvestigator.DeepCopyInternal(); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_ReasonStopped is not null) dest.ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)_ReasonStopped.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Arm is not null) dest.Arm = new List(_Arm.DeepCopyInternal()); + if(_Objective is not null) dest.Objective = new List(_Objective.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -897,195 +870,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchStudy; - if(otherT == null) return false; + if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(Protocol, otherT.Protocol)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(PrimaryPurposeType, otherT.PrimaryPurposeType)) return false; - if(!comparer.Equals(Phase, otherT.Phase)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Keyword, otherT.Keyword)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Enrollment, otherT.Enrollment)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Sponsor, otherT.Sponsor)) return false; - if(!comparer.Equals(PrincipalInvestigator, otherT.PrincipalInvestigator)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.Equals(ReasonStopped, otherT.ReasonStopped)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Arm, otherT.Arm)) return false; - if(!comparer.ListEquals(Objective, otherT.Objective)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_Protocol, otherT._Protocol)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_PrimaryPurposeType, otherT._PrimaryPurposeType)) return false; + if(!comparer.Equals(_Phase, otherT._Phase)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Keyword, otherT._Keyword)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Enrollment, otherT._Enrollment)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Sponsor, otherT._Sponsor)) return false; + if(!comparer.Equals(_PrincipalInvestigator, otherT._PrincipalInvestigator)) return false; + if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_ReasonStopped, otherT._ReasonStopped)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Arm, otherT._Arm)) return false; + if(!comparer.ListEquals(_Objective, otherT._Objective)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "protocol": - value = Protocol; - return Protocol?.Any() == true; + value = _Protocol; + return _Protocol?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "primaryPurposeType": - value = PrimaryPurposeType; - return PrimaryPurposeType is not null; + value = _PrimaryPurposeType; + return _PrimaryPurposeType is not null; case "phase": - value = Phase; - return Phase is not null; + value = _Phase; + return _Phase is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "keyword": - value = Keyword; - return Keyword?.Any() == true; + value = _Keyword; + return _Keyword?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "enrollment": - value = Enrollment; - return Enrollment?.Any() == true; + value = _Enrollment; + return _Enrollment?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "sponsor": - value = Sponsor; - return Sponsor is not null; + value = _Sponsor; + return _Sponsor is not null; case "principalInvestigator": - value = PrincipalInvestigator; - return PrincipalInvestigator is not null; + value = _PrincipalInvestigator; + return _PrincipalInvestigator is not null; case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "reasonStopped": - value = ReasonStopped; - return ReasonStopped is not null; + value = _ReasonStopped; + return _ReasonStopped is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "arm": - value = Arm; - return Arm?.Any() == true; + value = _Arm; + return _Arm?.Any() == true; case "objective": - value = Objective; - return Objective?.Any() == true; + value = _Objective; + return _Objective?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "protocol": - Protocol = (List)value; + Protocol = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "primaryPurposeType": - PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)value; + PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "phase": - Phase = (Hl7.Fhir.Model.CodeableConcept)value; + Phase = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "keyword": - Keyword = (List)value; + Keyword = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "enrollment": - Enrollment = (List)value; + Enrollment = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "sponsor": - Sponsor = (Hl7.Fhir.Model.ResourceReference)value; + Sponsor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "principalInvestigator": - PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference)value; + PrincipalInvestigator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "site": - Site = (List)value; + Site = (List?)value!; return this; case "reasonStopped": - ReasonStopped = (Hl7.Fhir.Model.CodeableConcept)value; + ReasonStopped = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "arm": - Arm = (List)value; + Arm = (List?)value!; return this; case "objective": - Objective = (List)value; + Objective = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1096,30 +1069,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Protocol?.Any() == true) yield return new KeyValuePair("protocol",Protocol); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PrimaryPurposeType is not null) yield return new KeyValuePair("primaryPurposeType",PrimaryPurposeType); - if (Phase is not null) yield return new KeyValuePair("phase",Phase); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Keyword?.Any() == true) yield return new KeyValuePair("keyword",Keyword); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Enrollment?.Any() == true) yield return new KeyValuePair("enrollment",Enrollment); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Sponsor is not null) yield return new KeyValuePair("sponsor",Sponsor); - if (PrincipalInvestigator is not null) yield return new KeyValuePair("principalInvestigator",PrincipalInvestigator); - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (ReasonStopped is not null) yield return new KeyValuePair("reasonStopped",ReasonStopped); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Arm?.Any() == true) yield return new KeyValuePair("arm",Arm); - if (Objective?.Any() == true) yield return new KeyValuePair("objective",Objective); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Protocol?.Any() == true) yield return new KeyValuePair("protocol",_Protocol); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PrimaryPurposeType is not null) yield return new KeyValuePair("primaryPurposeType",_PrimaryPurposeType); + if (_Phase is not null) yield return new KeyValuePair("phase",_Phase); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Keyword?.Any() == true) yield return new KeyValuePair("keyword",_Keyword); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Enrollment?.Any() == true) yield return new KeyValuePair("enrollment",_Enrollment); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Sponsor is not null) yield return new KeyValuePair("sponsor",_Sponsor); + if (_PrincipalInvestigator is not null) yield return new KeyValuePair("principalInvestigator",_PrincipalInvestigator); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_ReasonStopped is not null) yield return new KeyValuePair("reasonStopped",_ReasonStopped); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Arm?.Any() == true) yield return new KeyValuePair("arm",_Arm); + if (_Objective?.Any() == true) yield return new KeyValuePair("objective",_Objective); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs index 597cde359..22dece8e9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -156,11 +159,11 @@ public enum ResearchSubjectStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn. @@ -170,13 +173,13 @@ public List Identifier [Binding("ResearchSubjectStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn @@ -185,13 +188,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ResearchSubject.ResearchSubjectStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -201,13 +201,13 @@ public Hl7.Fhir.Model.ResearchSubject.ResearchSubjectStatus? Status /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Study subject is part of. @@ -217,13 +217,13 @@ public Hl7.Fhir.Model.Period Period [References("ResearchStudy")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Study + public Hl7.Fhir.Model.ResourceReference? Study { get { return _Study; } set { _Study = value; OnPropertyChanged("Study"); } } - private Hl7.Fhir.Model.ResourceReference _Study; + private Hl7.Fhir.Model.ResourceReference? _Study; /// /// Who is part of study. @@ -233,41 +233,38 @@ public Hl7.Fhir.Model.ResourceReference Study [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Individual + public Hl7.Fhir.Model.ResourceReference? Individual { get { return _Individual; } set { _Individual = value; OnPropertyChanged("Individual"); } } - private Hl7.Fhir.Model.ResourceReference _Individual; + private Hl7.Fhir.Model.ResourceReference? _Individual; /// /// What path should be followed. /// [FhirElement("assignedArm", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString AssignedArmElement + public Hl7.Fhir.Model.FhirString? AssignedArmElement { get { return _AssignedArmElement; } set { _AssignedArmElement = value; OnPropertyChanged("AssignedArmElement"); } } - private Hl7.Fhir.Model.FhirString _AssignedArmElement; + private Hl7.Fhir.Model.FhirString? _AssignedArmElement; /// /// What path should be followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AssignedArm + public string? AssignedArm { - get { return AssignedArmElement != null ? AssignedArmElement.Value : null; } + get => _AssignedArmElement?.Value; set { - if (value == null) - AssignedArmElement = null; - else - AssignedArmElement = new Hl7.Fhir.Model.FhirString(value); + AssignedArmElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AssignedArm"); } } @@ -277,28 +274,25 @@ public string AssignedArm /// [FhirElement("actualArm", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString ActualArmElement + public Hl7.Fhir.Model.FhirString? ActualArmElement { get { return _ActualArmElement; } set { _ActualArmElement = value; OnPropertyChanged("ActualArmElement"); } } - private Hl7.Fhir.Model.FhirString _ActualArmElement; + private Hl7.Fhir.Model.FhirString? _ActualArmElement; /// /// What path was followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActualArm + public string? ActualArm { - get { return ActualArmElement != null ? ActualArmElement.Value : null; } + get => _ActualArmElement?.Value; set { - if (value == null) - ActualArmElement = null; - else - ActualArmElement = new Hl7.Fhir.Model.FhirString(value); + ActualArmElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ActualArm"); } } @@ -310,34 +304,30 @@ public string ActualArm [CLSCompliant(false)] [References("Consent")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Consent + public Hl7.Fhir.Model.ResourceReference? Consent { get { return _Consent; } set { _Consent = value; OnPropertyChanged("Consent"); } } - private Hl7.Fhir.Model.ResourceReference _Consent; + private Hl7.Fhir.Model.ResourceReference? _Consent; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchSubject; - - if (dest == null) - { + if(other is not ResearchSubject dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Study != null) dest.Study = (Hl7.Fhir.Model.ResourceReference)Study.DeepCopyInternal(); - if(Individual != null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)Individual.DeepCopyInternal(); - if(AssignedArmElement != null) dest.AssignedArmElement = (Hl7.Fhir.Model.FhirString)AssignedArmElement.DeepCopyInternal(); - if(ActualArmElement != null) dest.ActualArmElement = (Hl7.Fhir.Model.FhirString)ActualArmElement.DeepCopyInternal(); - if(Consent != null) dest.Consent = (Hl7.Fhir.Model.ResourceReference)Consent.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Study is not null) dest.Study = (Hl7.Fhir.Model.ResourceReference)_Study.DeepCopyInternal(); + if(_Individual is not null) dest.Individual = (Hl7.Fhir.Model.ResourceReference)_Individual.DeepCopyInternal(); + if(_AssignedArmElement is not null) dest.AssignedArmElement = (Hl7.Fhir.Model.FhirString)_AssignedArmElement.DeepCopyInternal(); + if(_ActualArmElement is not null) dest.ActualArmElement = (Hl7.Fhir.Model.FhirString)_ActualArmElement.DeepCopyInternal(); + if(_Consent is not null) dest.Consent = (Hl7.Fhir.Model.ResourceReference)_Consent.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,83 +339,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchSubject; - if(otherT == null) return false; + if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Study, otherT.Study)) return false; - if(!comparer.Equals(Individual, otherT.Individual)) return false; - if(!comparer.Equals(AssignedArmElement, otherT.AssignedArmElement)) return false; - if(!comparer.Equals(ActualArmElement, otherT.ActualArmElement)) return false; - if(!comparer.Equals(Consent, otherT.Consent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Study, otherT._Study)) return false; + if(!comparer.Equals(_Individual, otherT._Individual)) return false; + if(!comparer.Equals(_AssignedArmElement, otherT._AssignedArmElement)) return false; + if(!comparer.Equals(_ActualArmElement, otherT._ActualArmElement)) return false; + if(!comparer.Equals(_Consent, otherT._Consent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "study": - value = Study; - return Study is not null; + value = _Study; + return _Study is not null; case "individual": - value = Individual; - return Individual is not null; + value = _Individual; + return _Individual is not null; case "assignedArm": - value = AssignedArmElement; - return AssignedArmElement is not null; + value = _AssignedArmElement; + return _AssignedArmElement is not null; case "actualArm": - value = ActualArmElement; - return ActualArmElement is not null; + value = _ActualArmElement; + return _ActualArmElement is not null; case "consent": - value = Consent; - return Consent is not null; + value = _Consent; + return _Consent is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "study": - Study = (Hl7.Fhir.Model.ResourceReference)value; + Study = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "individual": - Individual = (Hl7.Fhir.Model.ResourceReference)value; + Individual = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assignedArm": - AssignedArmElement = (Hl7.Fhir.Model.FhirString)value; + AssignedArmElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "actualArm": - ActualArmElement = (Hl7.Fhir.Model.FhirString)value; + ActualArmElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "consent": - Consent = (Hl7.Fhir.Model.ResourceReference)value; + Consent = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -436,14 +426,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Study is not null) yield return new KeyValuePair("study",Study); - if (Individual is not null) yield return new KeyValuePair("individual",Individual); - if (AssignedArmElement is not null) yield return new KeyValuePair("assignedArm",AssignedArmElement); - if (ActualArmElement is not null) yield return new KeyValuePair("actualArm",ActualArmElement); - if (Consent is not null) yield return new KeyValuePair("consent",Consent); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Study is not null) yield return new KeyValuePair("study",_Study); + if (_Individual is not null) yield return new KeyValuePair("individual",_Individual); + if (_AssignedArmElement is not null) yield return new KeyValuePair("assignedArm",_AssignedArmElement); + if (_ActualArmElement is not null) yield return new KeyValuePair("actualArm",_ActualArmElement); + if (_Consent is not null) yield return new KeyValuePair("consent",_Consent); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs index 2dd71e209..562bcfe28 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,13 +85,13 @@ public partial class PredictionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("outcome", Order=40)] [Binding("RiskAssessmentOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Likelihood of specified outcome. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Probability + public Hl7.Fhir.Model.DataType? Probability { get { return _Probability; } set { _Probability = value; OnPropertyChanged("Probability"); } } - private Hl7.Fhir.Model.DataType _Probability; + private Hl7.Fhir.Model.DataType? _Probability; /// /// Likelihood of specified outcome as a qualitative value. @@ -111,26 +114,26 @@ public Hl7.Fhir.Model.DataType Probability [FhirElement("qualitativeRisk", Order=60)] [Binding("RiskAssessmentProbability")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept QualitativeRisk + public Hl7.Fhir.Model.CodeableConcept? QualitativeRisk { get { return _QualitativeRisk; } set { _QualitativeRisk = value; OnPropertyChanged("QualitativeRisk"); } } - private Hl7.Fhir.Model.CodeableConcept _QualitativeRisk; + private Hl7.Fhir.Model.CodeableConcept? _QualitativeRisk; /// /// Relative likelihood. /// [FhirElement("relativeRisk", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement + public Hl7.Fhir.Model.FhirDecimal? RelativeRiskElement { get { return _RelativeRiskElement; } set { _RelativeRiskElement = value; OnPropertyChanged("RelativeRiskElement"); } } - private Hl7.Fhir.Model.FhirDecimal _RelativeRiskElement; + private Hl7.Fhir.Model.FhirDecimal? _RelativeRiskElement; /// /// Relative likelihood @@ -139,13 +142,10 @@ public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement [IgnoreDataMember] public decimal? RelativeRisk { - get { return RelativeRiskElement != null ? RelativeRiskElement.Value : null; } + get => _RelativeRiskElement?.Value; set { - if (value == null) - RelativeRiskElement = null; - else - RelativeRiskElement = new Hl7.Fhir.Model.FhirDecimal(value); + RelativeRiskElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("RelativeRisk"); } } @@ -157,61 +157,54 @@ public decimal? RelativeRisk [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; /// /// Explanation of prediction. /// [FhirElement("rationale", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString RationaleElement + public Hl7.Fhir.Model.FhirString? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.FhirString _RationaleElement; + private Hl7.Fhir.Model.FhirString? _RationaleElement; /// /// Explanation of prediction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.FhirString(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Rationale"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PredictionComponent; - - if (dest == null) - { + if(other is not PredictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Probability != null) dest.Probability = (Hl7.Fhir.Model.DataType)Probability.DeepCopyInternal(); - if(QualitativeRisk != null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)QualitativeRisk.DeepCopyInternal(); - if(RelativeRiskElement != null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)RelativeRiskElement.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)RationaleElement.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Probability is not null) dest.Probability = (Hl7.Fhir.Model.DataType)_Probability.DeepCopyInternal(); + if(_QualitativeRisk is not null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)_QualitativeRisk.DeepCopyInternal(); + if(_RelativeRiskElement is not null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)_RelativeRiskElement.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)_RationaleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -223,69 +216,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PredictionComponent; - if(otherT == null) return false; + if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Probability, otherT.Probability)) return false; - if(!comparer.Equals(QualitativeRisk, otherT.QualitativeRisk)) return false; - if(!comparer.Equals(RelativeRiskElement, otherT.RelativeRiskElement)) return false; - if(!comparer.Equals(When, otherT.When)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Probability, otherT._Probability)) return false; + if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; + if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "probability": - value = Probability; - return Probability is not null; + value = _Probability; + return _Probability is not null; case "qualitativeRisk": - value = QualitativeRisk; - return QualitativeRisk is not null; + value = _QualitativeRisk; + return _QualitativeRisk is not null; case "relativeRisk": - value = RelativeRiskElement; - return RelativeRiskElement is not null; + value = _RelativeRiskElement; + return _RelativeRiskElement is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "probability": - Probability = (Hl7.Fhir.Model.DataType)value; + Probability = (Hl7.Fhir.Model.DataType?)value; return this; case "qualitativeRisk": - QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)value; + QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "relativeRisk": - RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)value; + RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.FhirString)value; + RationaleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -296,12 +289,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Probability is not null) yield return new KeyValuePair("probability",Probability); - if (QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",QualitativeRisk); - if (RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",RelativeRiskElement); - if (When is not null) yield return new KeyValuePair("when",When); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Probability is not null) yield return new KeyValuePair("probability",_Probability); + if (_QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",_QualitativeRisk); + if (_RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",_RelativeRiskElement); + if (_When is not null) yield return new KeyValuePair("when",_When); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); } } @@ -314,11 +307,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Request fulfilled by this assessment. @@ -327,13 +320,13 @@ public List Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BasedOn + public Hl7.Fhir.Model.ResourceReference? BasedOn { get { return _BasedOn; } set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private Hl7.Fhir.Model.ResourceReference _BasedOn; + private Hl7.Fhir.Model.ResourceReference? _BasedOn; /// /// Part of this occurrence. @@ -342,13 +335,13 @@ public Hl7.Fhir.Model.ResourceReference BasedOn [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// registered | preliminary | final | amended +. @@ -358,13 +351,13 @@ public Hl7.Fhir.Model.ResourceReference Parent [Binding("RiskAssessmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -373,13 +366,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -390,26 +380,26 @@ public Hl7.Fhir.Model.ObservationStatus? Status [FhirElement("method", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("RiskAssessmentMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of assessment. /// [FhirElement("code", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/what does assessment apply to?. @@ -419,13 +409,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Where was assessment performed?. @@ -434,13 +424,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When was assessment made?. @@ -449,13 +439,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Condition assessed. @@ -464,13 +454,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Condition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Who did assessment?. @@ -479,13 +469,13 @@ public Hl7.Fhir.Model.ResourceReference Condition [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Why the assessment was necessary?. @@ -495,11 +485,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Why the assessment was necessary?. @@ -511,11 +501,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Information used in assessment. @@ -527,11 +517,11 @@ public List ReasonReference [DataMember] public List Basis { - get { if(_Basis==null) _Basis = new List(); return _Basis; } + get => _Basis ?? new List(); set { _Basis = value; OnPropertyChanged("Basis"); } } - private List _Basis; + private List? _Basis; /// /// Outcome predicted. @@ -541,39 +531,36 @@ public List Basis [DataMember] public List Prediction { - get { if(_Prediction==null) _Prediction = new List(); return _Prediction; } + get => _Prediction ?? new List(); set { _Prediction = value; OnPropertyChanged("Prediction"); } } - private List _Prediction; + private List? _Prediction; /// /// How to reduce risk. /// [FhirElement("mitigation", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString MitigationElement + public Hl7.Fhir.Model.FhirString? MitigationElement { get { return _MitigationElement; } set { _MitigationElement = value; OnPropertyChanged("MitigationElement"); } } - private Hl7.Fhir.Model.FhirString _MitigationElement; + private Hl7.Fhir.Model.FhirString? _MitigationElement; /// /// How to reduce risk /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Mitigation + public string? Mitigation { - get { return MitigationElement != null ? MitigationElement.Value : null; } + get => _MitigationElement?.Value; set { - if (value == null) - MitigationElement = null; - else - MitigationElement = new Hl7.Fhir.Model.FhirString(value); + MitigationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Mitigation"); } } @@ -586,41 +573,37 @@ public string Mitigation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RiskAssessment; - - if (dest == null) - { + if(other is not RiskAssessment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn != null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)BasedOn.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Basis.Any()) dest.Basis = new List(Basis.DeepCopyInternal()); - if(Prediction.Any()) dest.Prediction = new List(Prediction.DeepCopyInternal()); - if(MitigationElement != null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)MitigationElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)_BasedOn.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Basis is not null) dest.Basis = new List(_Basis.DeepCopyInternal()); + if(_Prediction is not null) dest.Prediction = new List(_Prediction.DeepCopyInternal()); + if(_MitigationElement is not null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)_MitigationElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -632,146 +615,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RiskAssessment; - if(otherT == null) return false; + if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Basis, otherT.Basis)) return false; - if(!comparer.ListEquals(Prediction, otherT.Prediction)) return false; - if(!comparer.Equals(MitigationElement, otherT.MitigationElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; + if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn is not null; + value = _BasedOn; + return _BasedOn is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "basis": - value = Basis; - return Basis?.Any() == true; + value = _Basis; + return _Basis?.Any() == true; case "prediction": - value = Prediction; - return Prediction?.Any() == true; + value = _Prediction; + return _Prediction?.Any() == true; case "mitigation": - value = MitigationElement; - return MitigationElement is not null; + value = _MitigationElement; + return _MitigationElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (Hl7.Fhir.Model.ResourceReference)value; + BasedOn = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "basis": - Basis = (List)value; + Basis = (List?)value!; return this; case "prediction": - Prediction = (List)value; + Prediction = (List?)value!; return this; case "mitigation": - MitigationElement = (Hl7.Fhir.Model.FhirString)value; + MitigationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -782,23 +765,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn is not null) yield return new KeyValuePair("basedOn",BasedOn); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Basis?.Any() == true) yield return new KeyValuePair("basis",Basis); - if (Prediction?.Any() == true) yield return new KeyValuePair("prediction",Prediction); - if (MitigationElement is not null) yield return new KeyValuePair("mitigation",MitigationElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn is not null) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Basis?.Any() == true) yield return new KeyValuePair("basis",_Basis); + if (_Prediction?.Any() == true) yield return new KeyValuePair("prediction",_Prediction); + if (_MitigationElement is not null) yield return new KeyValuePair("mitigation",_MitigationElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs b/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs index 722198f3d..1595ff0c7 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,13 +69,13 @@ public partial class SampledData : Hl7.Fhir.Model.DataType [FhirElement("origin", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Origin + public Hl7.Fhir.Model.Quantity? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.Quantity _Origin; + private Hl7.Fhir.Model.Quantity? _Origin; /// /// Number of milliseconds between samples. @@ -80,13 +83,13 @@ public Hl7.Fhir.Model.Quantity Origin [FhirElement("period", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodElement + public Hl7.Fhir.Model.FhirDecimal? PeriodElement { get { return _PeriodElement; } set { _PeriodElement = value; OnPropertyChanged("PeriodElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodElement; /// /// Number of milliseconds between samples @@ -95,13 +98,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodElement [IgnoreDataMember] public decimal? Period { - get { return PeriodElement != null ? PeriodElement.Value : null; } + get => _PeriodElement?.Value; set { - if (value == null) - PeriodElement = null; - else - PeriodElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Period"); } } @@ -111,13 +111,13 @@ public decimal? Period /// [FhirElement("factor", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Multiply data by this before adding to origin @@ -126,13 +126,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -142,13 +139,13 @@ public decimal? Factor /// [FhirElement("lowerLimit", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LowerLimitElement + public Hl7.Fhir.Model.FhirDecimal? LowerLimitElement { get { return _LowerLimitElement; } set { _LowerLimitElement = value; OnPropertyChanged("LowerLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LowerLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _LowerLimitElement; /// /// Lower limit of detection @@ -157,13 +154,10 @@ public Hl7.Fhir.Model.FhirDecimal LowerLimitElement [IgnoreDataMember] public decimal? LowerLimit { - get { return LowerLimitElement != null ? LowerLimitElement.Value : null; } + get => _LowerLimitElement?.Value; set { - if (value == null) - LowerLimitElement = null; - else - LowerLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + LowerLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("LowerLimit"); } } @@ -173,13 +167,13 @@ public decimal? LowerLimit /// [FhirElement("upperLimit", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal UpperLimitElement + public Hl7.Fhir.Model.FhirDecimal? UpperLimitElement { get { return _UpperLimitElement; } set { _UpperLimitElement = value; OnPropertyChanged("UpperLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _UpperLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _UpperLimitElement; /// /// Upper limit of detection @@ -188,13 +182,10 @@ public Hl7.Fhir.Model.FhirDecimal UpperLimitElement [IgnoreDataMember] public decimal? UpperLimit { - get { return UpperLimitElement != null ? UpperLimitElement.Value : null; } + get => _UpperLimitElement?.Value; set { - if (value == null) - UpperLimitElement = null; - else - UpperLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + UpperLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("UpperLimit"); } } @@ -205,13 +196,13 @@ public decimal? UpperLimit [FhirElement("dimensions", InSummary=true, Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DimensionsElement + public Hl7.Fhir.Model.PositiveInt? DimensionsElement { get { return _DimensionsElement; } set { _DimensionsElement = value; OnPropertyChanged("DimensionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _DimensionsElement; + private Hl7.Fhir.Model.PositiveInt? _DimensionsElement; /// /// Number of sample points at each time point @@ -220,13 +211,10 @@ public Hl7.Fhir.Model.PositiveInt DimensionsElement [IgnoreDataMember] public int? Dimensions { - get { return DimensionsElement != null ? DimensionsElement.Value : null; } + get => _DimensionsElement?.Value; set { - if (value == null) - DimensionsElement = null; - else - DimensionsElement = new Hl7.Fhir.Model.PositiveInt(value); + DimensionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Dimensions"); } } @@ -236,49 +224,42 @@ public int? Dimensions /// [FhirElement("data", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DataElement + public Hl7.Fhir.Model.FhirString? DataElement { get { return _DataElement; } set { _DataElement = value; OnPropertyChanged("DataElement"); } } - private Hl7.Fhir.Model.FhirString _DataElement; + private Hl7.Fhir.Model.FhirString? _DataElement; /// /// Decimal values with spaces, or "E" | "U" | "L" /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Data + public string? Data { - get { return DataElement != null ? DataElement.Value : null; } + get => _DataElement?.Value; set { - if (value == null) - DataElement = null; - else - DataElement = new Hl7.Fhir.Model.FhirString(value); + DataElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Data"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampledData; - - if (dest == null) - { + if(other is not SampledData dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.Quantity)Origin.DeepCopyInternal(); - if(PeriodElement != null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)PeriodElement.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(LowerLimitElement != null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)LowerLimitElement.DeepCopyInternal(); - if(UpperLimitElement != null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)UpperLimitElement.DeepCopyInternal(); - if(DimensionsElement != null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)DimensionsElement.DeepCopyInternal(); - if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.FhirString)DataElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.Quantity)_Origin.DeepCopyInternal(); + if(_PeriodElement is not null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodElement.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_LowerLimitElement is not null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)_LowerLimitElement.DeepCopyInternal(); + if(_UpperLimitElement is not null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)_UpperLimitElement.DeepCopyInternal(); + if(_DimensionsElement is not null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)_DimensionsElement.DeepCopyInternal(); + if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.FhirString)_DataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -290,76 +271,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampledData; - if(otherT == null) return false; + if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(PeriodElement, otherT.PeriodElement)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(LowerLimitElement, otherT.LowerLimitElement)) return false; - if(!comparer.Equals(UpperLimitElement, otherT.UpperLimitElement)) return false; - if(!comparer.Equals(DimensionsElement, otherT.DimensionsElement)) return false; - if(!comparer.Equals(DataElement, otherT.DataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_LowerLimitElement, otherT._LowerLimitElement)) return false; + if(!comparer.Equals(_UpperLimitElement, otherT._UpperLimitElement)) return false; + if(!comparer.Equals(_DimensionsElement, otherT._DimensionsElement)) return false; + if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "period": - value = PeriodElement; - return PeriodElement is not null; + value = _PeriodElement; + return _PeriodElement is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "lowerLimit": - value = LowerLimitElement; - return LowerLimitElement is not null; + value = _LowerLimitElement; + return _LowerLimitElement is not null; case "upperLimit": - value = UpperLimitElement; - return UpperLimitElement is not null; + value = _UpperLimitElement; + return _UpperLimitElement is not null; case "dimensions": - value = DimensionsElement; - return DimensionsElement is not null; + value = _DimensionsElement; + return _DimensionsElement is not null; case "data": - value = DataElement; - return DataElement is not null; + value = _DataElement; + return _DataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "origin": - Origin = (Hl7.Fhir.Model.Quantity)value; + Origin = (Hl7.Fhir.Model.Quantity?)value; return this; case "period": - PeriodElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "lowerLimit": - LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "upperLimit": - UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "dimensions": - DimensionsElement = (Hl7.Fhir.Model.PositiveInt)value; + DimensionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "data": - DataElement = (Hl7.Fhir.Model.FhirString)value; + DataElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -370,13 +351,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (PeriodElement is not null) yield return new KeyValuePair("period",PeriodElement); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",LowerLimitElement); - if (UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",UpperLimitElement); - if (DimensionsElement is not null) yield return new KeyValuePair("dimensions",DimensionsElement); - if (DataElement is not null) yield return new KeyValuePair("data",DataElement); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_PeriodElement is not null) yield return new KeyValuePair("period",_PeriodElement); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",_LowerLimitElement); + if (_UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",_UpperLimitElement); + if (_DimensionsElement is not null) yield return new KeyValuePair("dimensions",_DimensionsElement); + if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs index 63689ca14..8987c0f7e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,24 +67,24 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this schedule is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this schedule is in active use @@ -90,13 +93,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -110,11 +110,11 @@ public bool? Active [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// Specific service. @@ -125,11 +125,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// Type of specialty needed. @@ -140,11 +140,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Resource(s) that availability information is being provided for. @@ -156,52 +156,49 @@ public List Specialty [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Period of time covered by schedule. /// [FhirElement("planningHorizon", InSummary=true, Order=150, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period PlanningHorizon + public Hl7.Fhir.Model.Period? PlanningHorizon { get { return _PlanningHorizon; } set { _PlanningHorizon = value; OnPropertyChanged("PlanningHorizon"); } } - private Hl7.Fhir.Model.Period _PlanningHorizon; + private Hl7.Fhir.Model.Period? _PlanningHorizon; /// /// Comments on availability. /// [FhirElement("comment", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on availability /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -210,22 +207,18 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Schedule; - - if (dest == null) - { + if(other is not Schedule dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(PlanningHorizon != null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)PlanningHorizon.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_PlanningHorizon is not null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)_PlanningHorizon.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -237,83 +230,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Schedule; - if(otherT == null) return false; + if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(PlanningHorizon, otherT.PlanningHorizon)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "planningHorizon": - value = PlanningHorizon; - return PlanningHorizon is not null; + value = _PlanningHorizon; + return _PlanningHorizon is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "planningHorizon": - PlanningHorizon = (Hl7.Fhir.Model.Period)value; + PlanningHorizon = (Hl7.Fhir.Model.Period?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -324,14 +317,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",PlanningHorizon); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",_PlanningHorizon); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs index 28e6570c7..8293cfabd 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -268,28 +271,25 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("definition", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Defines how the part works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } @@ -300,44 +300,37 @@ public string Definition [FhirElement("expression", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Subexpression relative to main expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,41 +342,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -394,8 +387,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -406,28 +399,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this search parameter, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -437,28 +427,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -469,28 +456,25 @@ public string Version [FhirElement("name", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this search parameter (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -500,28 +484,25 @@ public string Name /// [FhirElement("derivedFrom", Order=120)] [DataMember] - public Hl7.Fhir.Model.Canonical DerivedFromElement + public Hl7.Fhir.Model.Canonical? DerivedFromElement { get { return _DerivedFromElement; } set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private Hl7.Fhir.Model.Canonical _DerivedFromElement; + private Hl7.Fhir.Model.Canonical? _DerivedFromElement; /// /// Original definition for the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DerivedFrom + public string? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Value : null; } + get => _DerivedFromElement?.Value; set { - if (value == null) - DerivedFromElement = null; - else - DerivedFromElement = new Hl7.Fhir.Model.Canonical(value); + DerivedFromElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("DerivedFrom"); } } @@ -534,13 +515,13 @@ public string DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -549,13 +530,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -565,13 +543,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -580,13 +558,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -596,28 +571,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -627,28 +599,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -661,11 +630,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the search parameter. @@ -673,28 +642,25 @@ public List Contact [FhirElement("description", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -707,11 +673,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for search parameter (if applicable). @@ -722,39 +688,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this search parameter is defined. /// [FhirElement("purpose", Order=210, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this search parameter is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -765,28 +728,25 @@ public string Purpose [FhirElement("code", InSummary=true, Order=220)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code used in URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -801,24 +761,24 @@ public string Code [DataMember] public List> BaseElement { - get { if(_BaseElement==null) _BaseElement = new List>(); return _BaseElement; } + get => _BaseElement ?? new List>(); set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private List> _BaseElement; + private List>? _BaseElement; /// /// The resource type(s) this search parameter applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Base + public IEnumerable? Base { - get { return BaseElement != null ? BaseElement.Select(elem => elem.Value) : null; } + get => _BaseElement?.Select(elem => elem.Value); set { if (value == null) - BaseElement = null; + BaseElement = null!; else BaseElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Base"); @@ -833,13 +793,13 @@ public IEnumerable Base [Binding("SearchParamType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// number | date | string | token | reference | composite | quantity | uri | special @@ -848,13 +808,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -864,28 +821,25 @@ public Hl7.Fhir.Model.SearchParamType? Type /// [FhirElement("expression", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// FHIRPath expression that extracts the values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -895,28 +849,25 @@ public string Expression /// [FhirElement("xpath", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString XpathElement + public Hl7.Fhir.Model.FhirString? XpathElement { get { return _XpathElement; } set { _XpathElement = value; OnPropertyChanged("XpathElement"); } } - private Hl7.Fhir.Model.FhirString _XpathElement; + private Hl7.Fhir.Model.FhirString? _XpathElement; /// /// XPath that extracts the values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Xpath + public string? Xpath { - get { return XpathElement != null ? XpathElement.Value : null; } + get => _XpathElement?.Value; set { - if (value == null) - XpathElement = null; - else - XpathElement = new Hl7.Fhir.Model.FhirString(value); + XpathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Xpath"); } } @@ -928,13 +879,13 @@ public string Xpath [DeclaredType(Type = typeof(Code))] [Binding("XPathUsageType")] [DataMember] - public Code XpathUsageElement + public Code? XpathUsageElement { get { return _XpathUsageElement; } set { _XpathUsageElement = value; OnPropertyChanged("XpathUsageElement"); } } - private Code _XpathUsageElement; + private Code? _XpathUsageElement; /// /// normal | phonetic | nearby | distance | other @@ -943,13 +894,10 @@ public Code XpathUsageElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage { - get { return XpathUsageElement != null ? XpathUsageElement.Value : null; } + get => _XpathUsageElement?.Value; set { - if (value == null) - XpathUsageElement = null; - else - XpathUsageElement = new Code(value); + XpathUsageElement = value is null ? null : new Code(value); OnPropertyChanged("XpathUsage"); } } @@ -964,24 +912,24 @@ public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage [DataMember] public List> TargetElement { - get { if(_TargetElement==null) _TargetElement = new List>(); return _TargetElement; } + get => _TargetElement ?? new List>(); set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private List> _TargetElement; + private List>? _TargetElement; /// /// Types of resource (if a resource reference) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Target + public IEnumerable? Target { - get { return TargetElement != null ? TargetElement.Select(elem => elem.Value) : null; } + get => _TargetElement?.Select(elem => elem.Value); set { if (value == null) - TargetElement = null; + TargetElement = null!; else TargetElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Target"); @@ -993,13 +941,13 @@ public IEnumerable Target /// [FhirElement("multipleOr", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleOrElement + public Hl7.Fhir.Model.FhirBoolean? MultipleOrElement { get { return _MultipleOrElement; } set { _MultipleOrElement = value; OnPropertyChanged("MultipleOrElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleOrElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleOrElement; /// /// Allow multiple values per parameter (or) @@ -1008,13 +956,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleOrElement [IgnoreDataMember] public bool? MultipleOr { - get { return MultipleOrElement != null ? MultipleOrElement.Value : null; } + get => _MultipleOrElement?.Value; set { - if (value == null) - MultipleOrElement = null; - else - MultipleOrElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleOrElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleOr"); } } @@ -1024,13 +969,13 @@ public bool? MultipleOr /// [FhirElement("multipleAnd", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleAndElement + public Hl7.Fhir.Model.FhirBoolean? MultipleAndElement { get { return _MultipleAndElement; } set { _MultipleAndElement = value; OnPropertyChanged("MultipleAndElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleAndElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleAndElement; /// /// Allow multiple parameters (and) @@ -1039,13 +984,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleAndElement [IgnoreDataMember] public bool? MultipleAnd { - get { return MultipleAndElement != null ? MultipleAndElement.Value : null; } + get => _MultipleAndElement?.Value; set { - if (value == null) - MultipleAndElement = null; - else - MultipleAndElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleAndElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleAnd"); } } @@ -1060,24 +1002,24 @@ public bool? MultipleAnd [DataMember] public List> ComparatorElement { - get { if(_ComparatorElement==null) _ComparatorElement = new List>(); return _ComparatorElement; } + get => _ComparatorElement ?? new List>(); set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private List> _ComparatorElement; + private List>? _ComparatorElement; /// /// eq | ne | gt | lt | ge | le | sa | eb | ap /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comparator + public IEnumerable? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Select(elem => elem.Value) : null; } + get => _ComparatorElement?.Select(elem => elem.Value); set { if (value == null) - ComparatorElement = null; + ComparatorElement = null!; else ComparatorElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Comparator"); @@ -1094,24 +1036,24 @@ public IEnumerable Comparator [DataMember] public List> ModifierElement { - get { if(_ModifierElement==null) _ModifierElement = new List>(); return _ModifierElement; } + get => _ModifierElement ?? new List>(); set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } - private List> _ModifierElement; + private List>? _ModifierElement; /// /// missing | exact | contains | not | text | in | not-in | below | above | type | identifier | ofType /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Modifier + public IEnumerable? Modifier { - get { return ModifierElement != null ? ModifierElement.Select(elem => elem.Value) : null; } + get => _ModifierElement?.Select(elem => elem.Value); set { if (value == null) - ModifierElement = null; + ModifierElement = null!; else ModifierElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Modifier"); @@ -1126,24 +1068,24 @@ public IEnumerable Modifier [DataMember] public List ChainElement { - get { if(_ChainElement==null) _ChainElement = new List(); return _ChainElement; } + get => _ChainElement ?? new List(); set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } - private List _ChainElement; + private List? _ChainElement; /// /// Chained names supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Chain + public IEnumerable? Chain { - get { return ChainElement != null ? ChainElement.Select(elem => elem.Value) : null; } + get => _ChainElement?.Select(elem => elem.Value); set { if (value == null) - ChainElement = null; + ChainElement = null!; else ChainElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Chain"); @@ -1158,48 +1100,44 @@ public IEnumerable Chain [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; protected internal override void CopyToInternal(Base other) { - var dest = other as SearchParameter; - - if (dest == null) - { + if(other is not SearchParameter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DerivedFromElement != null) dest.DerivedFromElement = (Hl7.Fhir.Model.Canonical)DerivedFromElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(BaseElement.Any()) dest.BaseElement = new List>(BaseElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(XpathElement != null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)XpathElement.DeepCopyInternal(); - if(XpathUsageElement != null) dest.XpathUsageElement = (Code)XpathUsageElement.DeepCopyInternal(); - if(TargetElement.Any()) dest.TargetElement = new List>(TargetElement.DeepCopyInternal()); - if(MultipleOrElement != null) dest.MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)MultipleOrElement.DeepCopyInternal(); - if(MultipleAndElement != null) dest.MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)MultipleAndElement.DeepCopyInternal(); - if(ComparatorElement.Any()) dest.ComparatorElement = new List>(ComparatorElement.DeepCopyInternal()); - if(ModifierElement.Any()) dest.ModifierElement = new List>(ModifierElement.DeepCopyInternal()); - if(ChainElement.Any()) dest.ChainElement = new List(ChainElement.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = (Hl7.Fhir.Model.Canonical)_DerivedFromElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = new List>(_BaseElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_XpathElement is not null) dest.XpathElement = (Hl7.Fhir.Model.FhirString)_XpathElement.DeepCopyInternal(); + if(_XpathUsageElement is not null) dest.XpathUsageElement = (Code)_XpathUsageElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = new List>(_TargetElement.DeepCopyInternal()); + if(_MultipleOrElement is not null) dest.MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleOrElement.DeepCopyInternal(); + if(_MultipleAndElement is not null) dest.MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleAndElement.DeepCopyInternal(); + if(_ComparatorElement is not null) dest.ComparatorElement = new List>(_ComparatorElement.DeepCopyInternal()); + if(_ModifierElement is not null) dest.ModifierElement = new List>(_ModifierElement.DeepCopyInternal()); + if(_ChainElement is not null) dest.ChainElement = new List(_ChainElement.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1211,209 +1149,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SearchParameter; - if(otherT == null) return false; + if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(XpathElement, otherT.XpathElement)) return false; - if(!comparer.Equals(XpathUsageElement, otherT.XpathUsageElement)) return false; - if(!comparer.ListEquals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.Equals(MultipleOrElement, otherT.MultipleOrElement)) return false; - if(!comparer.Equals(MultipleAndElement, otherT.MultipleAndElement)) return false; - if(!comparer.ListEquals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.ListEquals(ModifierElement, otherT.ModifierElement)) return false; - if(!comparer.ListEquals(ChainElement, otherT.ChainElement)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; + if(!comparer.Equals(_XpathUsageElement, otherT._XpathUsageElement)) return false; + if(!comparer.ListEquals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.Equals(_MultipleOrElement, otherT._MultipleOrElement)) return false; + if(!comparer.Equals(_MultipleAndElement, otherT._MultipleAndElement)) return false; + if(!comparer.ListEquals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; + if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement is not null; + value = _DerivedFromElement; + return _DerivedFromElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "base": - value = BaseElement; - return BaseElement?.Any() == true; + value = _BaseElement; + return _BaseElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "xpath": - value = XpathElement; - return XpathElement is not null; + value = _XpathElement; + return _XpathElement is not null; case "xpathUsage": - value = XpathUsageElement; - return XpathUsageElement is not null; + value = _XpathUsageElement; + return _XpathUsageElement is not null; case "target": - value = TargetElement; - return TargetElement?.Any() == true; + value = _TargetElement; + return _TargetElement?.Any() == true; case "multipleOr": - value = MultipleOrElement; - return MultipleOrElement is not null; + value = _MultipleOrElement; + return _MultipleOrElement is not null; case "multipleAnd": - value = MultipleAndElement; - return MultipleAndElement is not null; + value = _MultipleAndElement; + return _MultipleAndElement is not null; case "comparator": - value = ComparatorElement; - return ComparatorElement?.Any() == true; + value = _ComparatorElement; + return _ComparatorElement?.Any() == true; case "modifier": - value = ModifierElement; - return ModifierElement?.Any() == true; + value = _ModifierElement; + return _ModifierElement?.Any() == true; case "chain": - value = ChainElement; - return ChainElement?.Any() == true; + value = _ChainElement; + return _ChainElement?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (Hl7.Fhir.Model.Canonical)value; + DerivedFromElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "base": - BaseElement = (List>)value; + BaseElement = (List>?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpath": - XpathElement = (Hl7.Fhir.Model.FhirString)value; + XpathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "xpathUsage": - XpathUsageElement = (Code)value; + XpathUsageElement = (Code?)value; return this; case "target": - TargetElement = (List>)value; + TargetElement = (List>?)value!; return this; case "multipleOr": - MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "multipleAnd": - MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comparator": - ComparatorElement = (List>)value; + ComparatorElement = (List>?)value!; return this; case "modifier": - ModifierElement = (List>)value; + ModifierElement = (List>?)value!; return this; case "chain": - ChainElement = (List)value; + ChainElement = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1424,32 +1362,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (BaseElement?.Any() == true) yield return new KeyValuePair("base",BaseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (XpathElement is not null) yield return new KeyValuePair("xpath",XpathElement); - if (XpathUsageElement is not null) yield return new KeyValuePair("xpathUsage",XpathUsageElement); - if (TargetElement?.Any() == true) yield return new KeyValuePair("target",TargetElement); - if (MultipleOrElement is not null) yield return new KeyValuePair("multipleOr",MultipleOrElement); - if (MultipleAndElement is not null) yield return new KeyValuePair("multipleAnd",MultipleAndElement); - if (ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",ComparatorElement); - if (ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",ModifierElement); - if (ChainElement?.Any() == true) yield return new KeyValuePair("chain",ChainElement); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_BaseElement?.Any() == true) yield return new KeyValuePair("base",_BaseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_XpathElement is not null) yield return new KeyValuePair("xpath",_XpathElement); + if (_XpathUsageElement is not null) yield return new KeyValuePair("xpathUsage",_XpathUsageElement); + if (_TargetElement?.Any() == true) yield return new KeyValuePair("target",_TargetElement); + if (_MultipleOrElement is not null) yield return new KeyValuePair("multipleOr",_MultipleOrElement); + if (_MultipleAndElement is not null) yield return new KeyValuePair("multipleAnd",_MultipleAndElement); + if (_ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",_ModifierElement); + if (_ChainElement?.Any() == true) yield return new KeyValuePair("chain",_ChainElement); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs index c88e61810..08b2b9778 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class ServiceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiab [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -81,24 +84,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -113,24 +116,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -147,11 +150,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -163,24 +166,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite Request ID. /// [FhirElement("requisition", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier Requisition + public Hl7.Fhir.Model.Identifier? Requisition { get { return _Requisition; } set { _Requisition = value; OnPropertyChanged("Requisition"); } } - private Hl7.Fhir.Model.Identifier _Requisition; + private Hl7.Fhir.Model.Identifier? _Requisition; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -190,13 +193,13 @@ public Hl7.Fhir.Model.Identifier Requisition [Binding("ServiceRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -205,13 +208,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -224,13 +224,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("ServiceRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -239,13 +239,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -259,11 +256,11 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -272,13 +269,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("ServiceRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -287,13 +284,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -303,13 +297,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if service/procedure should not be performed @@ -318,13 +312,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -335,13 +326,13 @@ public bool? DoNotPerform [FhirElement("code", InSummary=true, Order=200, FiveWs="FiveWs.what[x]")] [Binding("ServiceRequestCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Additional order information. @@ -352,11 +343,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List OrderDetail { - get { if(_OrderDetail==null) _OrderDetail = new List(); return _OrderDetail; } + get => _OrderDetail ?? new List(); set { _OrderDetail = value; OnPropertyChanged("OrderDetail"); } } - private List _OrderDetail; + private List? _OrderDetail; /// /// Service amount. @@ -365,13 +356,13 @@ public List OrderDetail [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Quantity + public Hl7.Fhir.Model.DataType? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.DataType _Quantity; + private Hl7.Fhir.Model.DataType? _Quantity; /// /// Individual or Entity the service is ordered for. @@ -381,13 +372,13 @@ public Hl7.Fhir.Model.DataType Quantity [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter in which the request was created. @@ -396,13 +387,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When service should occur. @@ -411,13 +402,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Preconditions for service. @@ -427,41 +418,38 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Date request signed. /// [FhirElement("authoredOn", InSummary=true, Order=270, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Date request signed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -473,13 +461,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Performer role. @@ -487,13 +475,13 @@ public Hl7.Fhir.Model.ResourceReference Requester [FhirElement("performerType", InSummary=true, Order=290, FiveWs="FiveWs.actor")] [Binding("ServiceRequestParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Requested performer. @@ -505,11 +493,11 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Requested location. @@ -520,11 +508,11 @@ public List Performer [DataMember] public List LocationCode { - get { if(_LocationCode==null) _LocationCode = new List(); return _LocationCode; } + get => _LocationCode ?? new List(); set { _LocationCode = value; OnPropertyChanged("LocationCode"); } } - private List _LocationCode; + private List? _LocationCode; /// /// Requested location. @@ -536,11 +524,11 @@ public List LocationCode [DataMember] public List LocationReference { - get { if(_LocationReference==null) _LocationReference = new List(); return _LocationReference; } + get => _LocationReference ?? new List(); set { _LocationReference = value; OnPropertyChanged("LocationReference"); } } - private List _LocationReference; + private List? _LocationReference; /// /// Explanation/Justification for procedure or service. @@ -551,11 +539,11 @@ public List LocationReference [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// Explanation/Justification for service or service. @@ -567,11 +555,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// Associated insurance coverage. @@ -583,11 +571,11 @@ public List ReasonReference [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Additional clinical information. @@ -599,11 +587,11 @@ public List Insurance [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Procedure Samples. @@ -615,11 +603,11 @@ public List SupportingInfo [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Location on Body. @@ -630,11 +618,11 @@ public List Specimen [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Comments. @@ -644,39 +632,36 @@ public List BodySite [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Patient or consumer-oriented instructions. /// [FhirElement("patientInstruction", InSummary=true, Order=400)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Patient or consumer-oriented instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -691,57 +676,53 @@ public string PatientInstruction [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ServiceRequest; - - if (dest == null) - { + if(other is not ServiceRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(Requisition != null) dest.Requisition = (Hl7.Fhir.Model.Identifier)Requisition.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(OrderDetail.Any()) dest.OrderDetail = new List(OrderDetail.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.DataType)Quantity.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(LocationCode.Any()) dest.LocationCode = new List(LocationCode.DeepCopyInternal()); - if(LocationReference.Any()) dest.LocationReference = new List(LocationReference.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_Requisition is not null) dest.Requisition = (Hl7.Fhir.Model.Identifier)_Requisition.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_OrderDetail is not null) dest.OrderDetail = new List(_OrderDetail.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.DataType)_Quantity.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_LocationCode is not null) dest.LocationCode = new List(_LocationCode.DeepCopyInternal()); + if(_LocationReference is not null) dest.LocationReference = new List(_LocationReference.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -753,258 +734,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ServiceRequest; - if(otherT == null) return false; + if(other is not ServiceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(Requisition, otherT.Requisition)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(OrderDetail, otherT.OrderDetail)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(LocationCode, otherT.LocationCode)) return false; - if(!comparer.ListEquals(LocationReference, otherT.LocationReference)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_Requisition, otherT._Requisition)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_OrderDetail, otherT._OrderDetail)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_LocationCode, otherT._LocationCode)) return false; + if(!comparer.ListEquals(_LocationReference, otherT._LocationReference)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "requisition": - value = Requisition; - return Requisition is not null; + value = _Requisition; + return _Requisition is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "orderDetail": - value = OrderDetail; - return OrderDetail?.Any() == true; + value = _OrderDetail; + return _OrderDetail?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "locationCode": - value = LocationCode; - return LocationCode?.Any() == true; + value = _LocationCode; + return _LocationCode?.Any() == true; case "locationReference": - value = LocationReference; - return LocationReference?.Any() == true; + value = _LocationReference; + return _LocationReference?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "requisition": - Requisition = (Hl7.Fhir.Model.Identifier)value; + Requisition = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "orderDetail": - OrderDetail = (List)value; + OrderDetail = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.DataType)value; + Quantity = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "locationCode": - LocationCode = (List)value; + LocationCode = (List?)value!; return this; case "locationReference": - LocationReference = (List)value; + LocationReference = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1015,39 +996,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (Requisition is not null) yield return new KeyValuePair("requisition",Requisition); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (OrderDetail?.Any() == true) yield return new KeyValuePair("orderDetail",OrderDetail); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (LocationCode?.Any() == true) yield return new KeyValuePair("locationCode",LocationCode); - if (LocationReference?.Any() == true) yield return new KeyValuePair("locationReference",LocationReference); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_Requisition is not null) yield return new KeyValuePair("requisition",_Requisition); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_OrderDetail?.Any() == true) yield return new KeyValuePair("orderDetail",_OrderDetail); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_LocationCode?.Any() == true) yield return new KeyValuePair("locationCode",_LocationCode); + if (_LocationReference?.Any() == true) yield return new KeyValuePair("locationReference",_LocationReference); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs b/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs index b96cc3033..ad865e669 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,11 +107,11 @@ public enum SlotStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A broad categorization of the service that is to be performed during this appointment. @@ -119,11 +122,11 @@ public List Identifier [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource. @@ -134,11 +137,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -149,11 +152,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that may be booked in the slot (not service type). @@ -161,13 +164,13 @@ public List Specialty [FhirElement("appointmentType", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("appointment-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AppointmentType + public Hl7.Fhir.Model.CodeableConcept? AppointmentType { get { return _AppointmentType; } set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private Hl7.Fhir.Model.CodeableConcept _AppointmentType; + private Hl7.Fhir.Model.CodeableConcept? _AppointmentType; /// /// The schedule resource that this slot defines an interval of status information. @@ -177,13 +180,13 @@ public Hl7.Fhir.Model.CodeableConcept AppointmentType [References("Schedule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Schedule + public Hl7.Fhir.Model.ResourceReference? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.ResourceReference _Schedule; + private Hl7.Fhir.Model.ResourceReference? _Schedule; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error. @@ -193,13 +196,13 @@ public Hl7.Fhir.Model.ResourceReference Schedule [Binding("SlotStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error @@ -208,13 +211,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Slot.SlotStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -225,13 +225,13 @@ public Hl7.Fhir.Model.Slot.SlotStatus? Status [FhirElement("start", InSummary=true, Order=160, FiveWs="FiveWs.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Date/Time that the slot is to begin @@ -240,13 +240,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -257,13 +254,13 @@ public DateTimeOffset? Start [FhirElement("end", InSummary=true, Order=170, FiveWs="FiveWs.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Date/Time that the slot is to conclude @@ -272,13 +269,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -288,13 +282,13 @@ public DateTimeOffset? End /// [FhirElement("overbooked", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OverbookedElement + public Hl7.Fhir.Model.FhirBoolean? OverbookedElement { get { return _OverbookedElement; } set { _OverbookedElement = value; OnPropertyChanged("OverbookedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OverbookedElement; + private Hl7.Fhir.Model.FhirBoolean? _OverbookedElement; /// /// This slot has already been overbooked, appointments are unlikely to be accepted for this time @@ -303,13 +297,10 @@ public Hl7.Fhir.Model.FhirBoolean OverbookedElement [IgnoreDataMember] public bool? Overbooked { - get { return OverbookedElement != null ? OverbookedElement.Value : null; } + get => _OverbookedElement?.Value; set { - if (value == null) - OverbookedElement = null; - else - OverbookedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OverbookedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Overbooked"); } } @@ -319,28 +310,25 @@ public bool? Overbooked /// [FhirElement("comment", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on the slot to describe any extended information. Such as custom constraints on the slot /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -349,25 +337,21 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Slot; - - if (dest == null) - { + if(other is not Slot dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType != null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)AppointmentType.DeepCopyInternal(); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)Schedule.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(OverbookedElement != null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)OverbookedElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)_AppointmentType.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)_Schedule.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_OverbookedElement is not null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)_OverbookedElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -379,104 +363,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Slot; - if(otherT == null) return false; + if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(OverbookedElement, otherT.OverbookedElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType is not null; + value = _AppointmentType; + return _AppointmentType is not null; case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "overbooked": - value = OverbookedElement; - return OverbookedElement is not null; + value = _OverbookedElement; + return _OverbookedElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (Hl7.Fhir.Model.CodeableConcept)value; + AppointmentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "schedule": - Schedule = (Hl7.Fhir.Model.ResourceReference)value; + Schedule = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "overbooked": - OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OverbookedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -487,17 +471,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType is not null) yield return new KeyValuePair("appointmentType",AppointmentType); - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (OverbookedElement is not null) yield return new KeyValuePair("overbooked",OverbookedElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType is not null) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_OverbookedElement is not null) yield return new KeyValuePair("overbooked",_OverbookedElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs index a921515fc..83615697e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class CollectionComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Collector + public Hl7.Fhir.Model.ResourceReference? Collector { get { return _Collector; } set { _Collector = value; OnPropertyChanged("Collector"); } } - private Hl7.Fhir.Model.ResourceReference _Collector; + private Hl7.Fhir.Model.ResourceReference? _Collector; /// /// Collection time. @@ -131,39 +134,39 @@ public Hl7.Fhir.Model.ResourceReference Collector [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Collected + public Hl7.Fhir.Model.DataType? Collected { get { return _Collected; } set { _Collected = value; OnPropertyChanged("Collected"); } } - private Hl7.Fhir.Model.DataType _Collected; + private Hl7.Fhir.Model.DataType? _Collected; /// /// How long it took to collect specimen. /// [FhirElement("duration", InSummary=true, Order=60, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Duration Duration + public Hl7.Fhir.Model.Duration? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Duration _Duration; + private Hl7.Fhir.Model.Duration? _Duration; /// /// The quantity of specimen collected. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Technique used to perform collection. @@ -171,13 +174,13 @@ public Hl7.Fhir.Model.Quantity Quantity [FhirElement("method", Order=80)] [Binding("SpecimenCollectionMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Anatomical collection site. @@ -185,13 +188,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [FhirElement("bodySite", Order=90)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Whether or how long patient abstained from food and/or drink. @@ -201,31 +204,27 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType FastingStatus + public Hl7.Fhir.Model.DataType? FastingStatus { get { return _FastingStatus; } set { _FastingStatus = value; OnPropertyChanged("FastingStatus"); } } - private Hl7.Fhir.Model.DataType _FastingStatus; + private Hl7.Fhir.Model.DataType? _FastingStatus; protected internal override void CopyToInternal(Base other) { - var dest = other as CollectionComponent; - - if (dest == null) - { + if(other is not CollectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Collector != null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)Collector.DeepCopyInternal(); - if(Collected != null) dest.Collected = (Hl7.Fhir.Model.DataType)Collected.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(FastingStatus != null) dest.FastingStatus = (Hl7.Fhir.Model.DataType)FastingStatus.DeepCopyInternal(); + if(_Collector is not null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)_Collector.DeepCopyInternal(); + if(_Collected is not null) dest.Collected = (Hl7.Fhir.Model.DataType)_Collected.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Duration)_Duration.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_FastingStatus is not null) dest.FastingStatus = (Hl7.Fhir.Model.DataType)_FastingStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -237,76 +236,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CollectionComponent; - if(otherT == null) return false; + if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Collector, otherT.Collector)) return false; - if(!comparer.Equals(Collected, otherT.Collected)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(FastingStatus, otherT.FastingStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + if(!comparer.Equals(_Collected, otherT._Collected)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_FastingStatus, otherT._FastingStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "collector": - value = Collector; - return Collector is not null; + value = _Collector; + return _Collector is not null; case "collected": - value = Collected; - return Collected is not null; + value = _Collected; + return _Collected is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "fastingStatus": - value = FastingStatus; - return FastingStatus is not null; + value = _FastingStatus; + return _FastingStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "collector": - Collector = (Hl7.Fhir.Model.ResourceReference)value; + Collector = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "collected": - Collected = (Hl7.Fhir.Model.DataType)value; + Collected = (Hl7.Fhir.Model.DataType?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Duration)value; + Duration = (Hl7.Fhir.Model.Duration?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fastingStatus": - FastingStatus = (Hl7.Fhir.Model.DataType)value; + FastingStatus = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -317,13 +316,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Collector is not null) yield return new KeyValuePair("collector",Collector); - if (Collected is not null) yield return new KeyValuePair("collected",Collected); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (FastingStatus is not null) yield return new KeyValuePair("fastingStatus",FastingStatus); + if (_Collector is not null) yield return new KeyValuePair("collector",_Collector); + if (_Collected is not null) yield return new KeyValuePair("collected",_Collected); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_FastingStatus is not null) yield return new KeyValuePair("fastingStatus",_FastingStatus); } } @@ -349,28 +348,25 @@ public partial class ProcessingComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of procedure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -381,13 +377,13 @@ public string Description [FhirElement("procedure", Order=50)] [Binding("SpecimenProcessingProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Procedure + public Hl7.Fhir.Model.CodeableConcept? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.CodeableConcept _Procedure; + private Hl7.Fhir.Model.CodeableConcept? _Procedure; /// /// Material used in the processing step. @@ -399,11 +395,11 @@ public Hl7.Fhir.Model.CodeableConcept Procedure [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Date and time of specimen processing. @@ -412,28 +408,24 @@ public List Additive [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessingComponent; - - if (dest == null) - { + if(other is not ProcessingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)Procedure.DeepCopyInternal(); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.CodeableConcept)_Procedure.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -445,55 +437,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessingComponent; - if(otherT == null) return false; + if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.CodeableConcept)value; + Procedure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -504,10 +496,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -536,39 +528,36 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Textual description of the container. /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the container /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -579,39 +568,39 @@ public string Description [FhirElement("type", Order=60)] [Binding("SpecimenContainerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Container volume or size. /// [FhirElement("capacity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Capacity + public Hl7.Fhir.Model.Quantity? Capacity { get { return _Capacity; } set { _Capacity = value; OnPropertyChanged("Capacity"); } } - private Hl7.Fhir.Model.Quantity _Capacity; + private Hl7.Fhir.Model.Quantity? _Capacity; /// /// Quantity of specimen within container. /// [FhirElement("specimenQuantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity SpecimenQuantity + public Hl7.Fhir.Model.Quantity? SpecimenQuantity { get { return _SpecimenQuantity; } set { _SpecimenQuantity = value; OnPropertyChanged("SpecimenQuantity"); } } - private Hl7.Fhir.Model.Quantity _SpecimenQuantity; + private Hl7.Fhir.Model.Quantity? _SpecimenQuantity; /// /// Additive associated with container. @@ -622,30 +611,26 @@ public Hl7.Fhir.Model.Quantity SpecimenQuantity [References("Substance")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Additive + public Hl7.Fhir.Model.DataType? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.DataType _Additive; + private Hl7.Fhir.Model.DataType? _Additive; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainerComponent; - - if (dest == null) - { + if(other is not ContainerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Capacity != null) dest.Capacity = (Hl7.Fhir.Model.Quantity)Capacity.DeepCopyInternal(); - if(SpecimenQuantity != null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)SpecimenQuantity.DeepCopyInternal(); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.DataType)Additive.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Capacity is not null) dest.Capacity = (Hl7.Fhir.Model.Quantity)_Capacity.DeepCopyInternal(); + if(_SpecimenQuantity is not null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)_SpecimenQuantity.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.DataType)_Additive.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -657,69 +642,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainerComponent; - if(otherT == null) return false; + if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Capacity, otherT.Capacity)) return false; - if(!comparer.Equals(SpecimenQuantity, otherT.SpecimenQuantity)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; + if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; + if(!comparer.Equals(_Additive, otherT._Additive)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "capacity": - value = Capacity; - return Capacity is not null; + value = _Capacity; + return _Capacity is not null; case "specimenQuantity": - value = SpecimenQuantity; - return SpecimenQuantity is not null; + value = _SpecimenQuantity; + return _SpecimenQuantity is not null; case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "capacity": - Capacity = (Hl7.Fhir.Model.Quantity)value; + Capacity = (Hl7.Fhir.Model.Quantity?)value; return this; case "specimenQuantity": - SpecimenQuantity = (Hl7.Fhir.Model.Quantity)value; + SpecimenQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "additive": - Additive = (Hl7.Fhir.Model.DataType)value; + Additive = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -730,12 +715,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Capacity is not null) yield return new KeyValuePair("capacity",Capacity); - if (SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",SpecimenQuantity); - if (Additive is not null) yield return new KeyValuePair("additive",Additive); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Capacity is not null) yield return new KeyValuePair("capacity",_Capacity); + if (_SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",_SpecimenQuantity); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); } } @@ -748,24 +733,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identifier assigned by the lab. /// [FhirElement("accessionIdentifier", InSummary=true, Order=100, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier AccessionIdentifier + public Hl7.Fhir.Model.Identifier? AccessionIdentifier { get { return _AccessionIdentifier; } set { _AccessionIdentifier = value; OnPropertyChanged("AccessionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _AccessionIdentifier; + private Hl7.Fhir.Model.Identifier? _AccessionIdentifier; /// /// available | unavailable | unsatisfactory | entered-in-error. @@ -774,13 +759,13 @@ public Hl7.Fhir.Model.Identifier AccessionIdentifier [DeclaredType(Type = typeof(Code))] [Binding("SpecimenStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// available | unavailable | unsatisfactory | entered-in-error @@ -789,13 +774,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -806,13 +788,13 @@ public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("SpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance or a device. @@ -821,41 +803,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Group","Device","Substance","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The time when specimen was received for processing. /// [FhirElement("receivedTime", InSummary=true, Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedTimeElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedTimeElement { get { return _ReceivedTimeElement; } set { _ReceivedTimeElement = value; OnPropertyChanged("ReceivedTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedTimeElement; /// /// The time when specimen was received for processing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReceivedTime + public string? ReceivedTime { - get { return ReceivedTimeElement != null ? ReceivedTimeElement.Value : null; } + get => _ReceivedTimeElement?.Value; set { - if (value == null) - ReceivedTimeElement = null; - else - ReceivedTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ReceivedTime"); } } @@ -870,11 +849,11 @@ public string ReceivedTime [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// Why the specimen was collected. @@ -886,24 +865,24 @@ public List Parent [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Collection details. /// [FhirElement("collection", Order=170)] [DataMember] - public Hl7.Fhir.Model.Specimen.CollectionComponent Collection + public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection { get { return _Collection; } set { _Collection = value; OnPropertyChanged("Collection"); } } - private Hl7.Fhir.Model.Specimen.CollectionComponent _Collection; + private Hl7.Fhir.Model.Specimen.CollectionComponent? _Collection; /// /// Processing and processing step details. @@ -913,11 +892,11 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent Collection [DataMember] public List Processing { - get { if(_Processing==null) _Processing = new List(); return _Processing; } + get => _Processing ?? new List(); set { _Processing = value; OnPropertyChanged("Processing"); } } - private List _Processing; + private List? _Processing; /// /// Direct container of specimen (tube/slide, etc.). @@ -927,11 +906,11 @@ public List Processing [DataMember] public List Container { - get { if(_Container==null) _Container = new List(); return _Container; } + get => _Container ?? new List(); set { _Container = value; OnPropertyChanged("Container"); } } - private List _Container; + private List? _Container; /// /// State of the specimen. @@ -942,11 +921,11 @@ public List Container [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Comments. @@ -956,37 +935,33 @@ public List Condition [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Specimen; - - if (dest == null) - { + if(other is not Specimen dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(AccessionIdentifier != null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)AccessionIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(ReceivedTimeElement != null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedTimeElement.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Collection != null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)Collection.DeepCopyInternal(); - if(Processing.Any()) dest.Processing = new List(Processing.DeepCopyInternal()); - if(Container.Any()) dest.Container = new List(Container.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_AccessionIdentifier is not null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)_AccessionIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_ReceivedTimeElement is not null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedTimeElement.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Collection is not null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)_Collection.DeepCopyInternal(); + if(_Processing is not null) dest.Processing = new List(_Processing.DeepCopyInternal()); + if(_Container is not null) dest.Container = new List(_Container.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -998,118 +973,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Specimen; - if(otherT == null) return false; + if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(AccessionIdentifier, otherT.AccessionIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(ReceivedTimeElement, otherT.ReceivedTimeElement)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.Equals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(Processing, otherT.Processing)) return false; - if(!comparer.ListEquals(Container, otherT.Container)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_ReceivedTimeElement, otherT._ReceivedTimeElement)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; + if(!comparer.ListEquals(_Container, otherT._Container)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "accessionIdentifier": - value = AccessionIdentifier; - return AccessionIdentifier is not null; + value = _AccessionIdentifier; + return _AccessionIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "receivedTime": - value = ReceivedTimeElement; - return ReceivedTimeElement is not null; + value = _ReceivedTimeElement; + return _ReceivedTimeElement is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "collection": - value = Collection; - return Collection is not null; + value = _Collection; + return _Collection is not null; case "processing": - value = Processing; - return Processing?.Any() == true; + value = _Processing; + return _Processing?.Any() == true; case "container": - value = Container; - return Container?.Any() == true; + value = _Container; + return _Container?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "accessionIdentifier": - AccessionIdentifier = (Hl7.Fhir.Model.Identifier)value; + AccessionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receivedTime": - ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "collection": - Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)value; + Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent?)value; return this; case "processing": - Processing = (List)value; + Processing = (List?)value!; return this; case "container": - Container = (List)value; + Container = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1120,19 +1095,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",AccessionIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",ReceivedTimeElement); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Collection is not null) yield return new KeyValuePair("collection",Collection); - if (Processing?.Any() == true) yield return new KeyValuePair("processing",Processing); - if (Container?.Any() == true) yield return new KeyValuePair("container",Container); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",_AccessionIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",_ReceivedTimeElement); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Collection is not null) yield return new KeyValuePair("collection",_Collection); + if (_Processing?.Any() == true) yield return new KeyValuePair("processing",_Processing); + if (_Container?.Any() == true) yield return new KeyValuePair("container",_Container); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs index 189e0314d..62dfd5da5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SpecimenDefinition","http://hl7.org/fhir/StructureDefinition/SpecimenDefinition")] - public partial class SpecimenDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class SpecimenDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -102,13 +105,13 @@ public partial class TypeTestedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("isDerived", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDerivedElement + public Hl7.Fhir.Model.FhirBoolean? IsDerivedElement { get { return _IsDerivedElement; } set { _IsDerivedElement = value; OnPropertyChanged("IsDerivedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDerivedElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDerivedElement; /// /// Primary or secondary specimen @@ -117,13 +120,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDerivedElement [IgnoreDataMember] public bool? IsDerived { - get { return IsDerivedElement != null ? IsDerivedElement.Value : null; } + get => _IsDerivedElement?.Value; set { - if (value == null) - IsDerivedElement = null; - else - IsDerivedElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDerivedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDerived"); } } @@ -134,13 +134,13 @@ public bool? IsDerived [FhirElement("type", Order=50)] [Binding("IntendedSpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// preferred | alternate. @@ -150,13 +150,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("SpecimenContainedPreference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PreferenceElement + public Code? PreferenceElement { get { return _PreferenceElement; } set { _PreferenceElement = value; OnPropertyChanged("PreferenceElement"); } } - private Code _PreferenceElement; + private Code? _PreferenceElement; /// /// preferred | alternate @@ -165,13 +165,10 @@ public Code Prefe [IgnoreDataMember] public Hl7.Fhir.Model.SpecimenDefinition.SpecimenContainedPreference? Preference { - get { return PreferenceElement != null ? PreferenceElement.Value : null; } + get => _PreferenceElement?.Value; set { - if (value == null) - PreferenceElement = null; - else - PreferenceElement = new Code(value); + PreferenceElement = value is null ? null : new Code(value); OnPropertyChanged("Preference"); } } @@ -181,41 +178,38 @@ public Hl7.Fhir.Model.SpecimenDefinition.SpecimenContainedPreference? Preference /// [FhirElement("container", Order=70)] [DataMember] - public Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent Container + public Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent? Container { get { return _Container; } set { _Container = value; OnPropertyChanged("Container"); } } - private Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent _Container; + private Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent? _Container; /// /// Specimen requirements. /// [FhirElement("requirement", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString RequirementElement + public Hl7.Fhir.Model.FhirString? RequirementElement { get { return _RequirementElement; } set { _RequirementElement = value; OnPropertyChanged("RequirementElement"); } } - private Hl7.Fhir.Model.FhirString _RequirementElement; + private Hl7.Fhir.Model.FhirString? _RequirementElement; /// /// Specimen requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirement + public string? Requirement { - get { return RequirementElement != null ? RequirementElement.Value : null; } + get => _RequirementElement?.Value; set { - if (value == null) - RequirementElement = null; - else - RequirementElement = new Hl7.Fhir.Model.FhirString(value); + RequirementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Requirement"); } } @@ -225,13 +219,13 @@ public string Requirement /// [FhirElement("retentionTime", Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration RetentionTime + public Hl7.Fhir.Model.Duration? RetentionTime { get { return _RetentionTime; } set { _RetentionTime = value; OnPropertyChanged("RetentionTime"); } } - private Hl7.Fhir.Model.Duration _RetentionTime; + private Hl7.Fhir.Model.Duration? _RetentionTime; /// /// Rejection criterion. @@ -242,11 +236,11 @@ public Hl7.Fhir.Model.Duration RetentionTime [DataMember] public List RejectionCriterion { - get { if(_RejectionCriterion==null) _RejectionCriterion = new List(); return _RejectionCriterion; } + get => _RejectionCriterion ?? new List(); set { _RejectionCriterion = value; OnPropertyChanged("RejectionCriterion"); } } - private List _RejectionCriterion; + private List? _RejectionCriterion; /// /// Specimen handling before testing. @@ -256,30 +250,26 @@ public List RejectionCriterion [DataMember] public List Handling { - get { if(_Handling==null) _Handling = new List(); return _Handling; } + get => _Handling ?? new List(); set { _Handling = value; OnPropertyChanged("Handling"); } } - private List _Handling; + private List? _Handling; protected internal override void CopyToInternal(Base other) { - var dest = other as TypeTestedComponent; - - if (dest == null) - { + if(other is not TypeTestedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IsDerivedElement != null) dest.IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)IsDerivedElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PreferenceElement != null) dest.PreferenceElement = (Code)PreferenceElement.DeepCopyInternal(); - if(Container != null) dest.Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)Container.DeepCopyInternal(); - if(RequirementElement != null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)RequirementElement.DeepCopyInternal(); - if(RetentionTime != null) dest.RetentionTime = (Hl7.Fhir.Model.Duration)RetentionTime.DeepCopyInternal(); - if(RejectionCriterion.Any()) dest.RejectionCriterion = new List(RejectionCriterion.DeepCopyInternal()); - if(Handling.Any()) dest.Handling = new List(Handling.DeepCopyInternal()); + if(_IsDerivedElement is not null) dest.IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)_IsDerivedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PreferenceElement is not null) dest.PreferenceElement = (Code)_PreferenceElement.DeepCopyInternal(); + if(_Container is not null) dest.Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)_Container.DeepCopyInternal(); + if(_RequirementElement is not null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)_RequirementElement.DeepCopyInternal(); + if(_RetentionTime is not null) dest.RetentionTime = (Hl7.Fhir.Model.Duration)_RetentionTime.DeepCopyInternal(); + if(_RejectionCriterion is not null) dest.RejectionCriterion = new List(_RejectionCriterion.DeepCopyInternal()); + if(_Handling is not null) dest.Handling = new List(_Handling.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -291,83 +281,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TypeTestedComponent; - if(otherT == null) return false; + if(other is not TypeTestedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IsDerivedElement, otherT.IsDerivedElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PreferenceElement, otherT.PreferenceElement)) return false; - if(!comparer.Equals(Container, otherT.Container)) return false; - if(!comparer.Equals(RequirementElement, otherT.RequirementElement)) return false; - if(!comparer.Equals(RetentionTime, otherT.RetentionTime)) return false; - if(!comparer.ListEquals(RejectionCriterion, otherT.RejectionCriterion)) return false; - if(!comparer.ListEquals(Handling, otherT.Handling)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PreferenceElement, otherT._PreferenceElement)) return false; + if(!comparer.Equals(_Container, otherT._Container)) return false; + if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; + if(!comparer.Equals(_RetentionTime, otherT._RetentionTime)) return false; + if(!comparer.ListEquals(_RejectionCriterion, otherT._RejectionCriterion)) return false; + if(!comparer.ListEquals(_Handling, otherT._Handling)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "isDerived": - value = IsDerivedElement; - return IsDerivedElement is not null; + value = _IsDerivedElement; + return _IsDerivedElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "preference": - value = PreferenceElement; - return PreferenceElement is not null; + value = _PreferenceElement; + return _PreferenceElement is not null; case "container": - value = Container; - return Container is not null; + value = _Container; + return _Container is not null; case "requirement": - value = RequirementElement; - return RequirementElement is not null; + value = _RequirementElement; + return _RequirementElement is not null; case "retentionTime": - value = RetentionTime; - return RetentionTime is not null; + value = _RetentionTime; + return _RetentionTime is not null; case "rejectionCriterion": - value = RejectionCriterion; - return RejectionCriterion?.Any() == true; + value = _RejectionCriterion; + return _RejectionCriterion?.Any() == true; case "handling": - value = Handling; - return Handling?.Any() == true; + value = _Handling; + return _Handling?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "isDerived": - IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preference": - PreferenceElement = (Code)value; + PreferenceElement = (Code?)value; return this; case "container": - Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)value; + Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent?)value; return this; case "requirement": - RequirementElement = (Hl7.Fhir.Model.FhirString)value; + RequirementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "retentionTime": - RetentionTime = (Hl7.Fhir.Model.Duration)value; + RetentionTime = (Hl7.Fhir.Model.Duration?)value; return this; case "rejectionCriterion": - RejectionCriterion = (List)value; + RejectionCriterion = (List?)value!; return this; case "handling": - Handling = (List)value; + Handling = (List?)value!; return this; default: return base.SetValue(key, value); @@ -378,14 +368,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IsDerivedElement is not null) yield return new KeyValuePair("isDerived",IsDerivedElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PreferenceElement is not null) yield return new KeyValuePair("preference",PreferenceElement); - if (Container is not null) yield return new KeyValuePair("container",Container); - if (RequirementElement is not null) yield return new KeyValuePair("requirement",RequirementElement); - if (RetentionTime is not null) yield return new KeyValuePair("retentionTime",RetentionTime); - if (RejectionCriterion?.Any() == true) yield return new KeyValuePair("rejectionCriterion",RejectionCriterion); - if (Handling?.Any() == true) yield return new KeyValuePair("handling",Handling); + if (_IsDerivedElement is not null) yield return new KeyValuePair("isDerived",_IsDerivedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PreferenceElement is not null) yield return new KeyValuePair("preference",_PreferenceElement); + if (_Container is not null) yield return new KeyValuePair("container",_Container); + if (_RequirementElement is not null) yield return new KeyValuePair("requirement",_RequirementElement); + if (_RetentionTime is not null) yield return new KeyValuePair("retentionTime",_RetentionTime); + if (_RejectionCriterion?.Any() == true) yield return new KeyValuePair("rejectionCriterion",_RejectionCriterion); + if (_Handling?.Any() == true) yield return new KeyValuePair("handling",_Handling); } } @@ -409,13 +399,13 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("material", Order=40)] [Binding("ContainerMaterial")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Material + public Hl7.Fhir.Model.CodeableConcept? Material { get { return _Material; } set { _Material = value; OnPropertyChanged("Material"); } } - private Hl7.Fhir.Model.CodeableConcept _Material; + private Hl7.Fhir.Model.CodeableConcept? _Material; /// /// Kind of container associated with the kind of specimen. @@ -423,13 +413,13 @@ public Hl7.Fhir.Model.CodeableConcept Material [FhirElement("type", Order=50)] [Binding("ContainerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Color of container cap. @@ -437,41 +427,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("cap", Order=60)] [Binding("ContainerCap")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Cap + public Hl7.Fhir.Model.CodeableConcept? Cap { get { return _Cap; } set { _Cap = value; OnPropertyChanged("Cap"); } } - private Hl7.Fhir.Model.CodeableConcept _Cap; + private Hl7.Fhir.Model.CodeableConcept? _Cap; /// /// Container description. /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Container description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -481,13 +468,13 @@ public string Description /// [FhirElement("capacity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Capacity + public Hl7.Fhir.Model.Quantity? Capacity { get { return _Capacity; } set { _Capacity = value; OnPropertyChanged("Capacity"); } } - private Hl7.Fhir.Model.Quantity _Capacity; + private Hl7.Fhir.Model.Quantity? _Capacity; /// /// Minimum volume. @@ -496,13 +483,13 @@ public Hl7.Fhir.Model.Quantity Capacity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType MinimumVolume + public Hl7.Fhir.Model.DataType? MinimumVolume { get { return _MinimumVolume; } set { _MinimumVolume = value; OnPropertyChanged("MinimumVolume"); } } - private Hl7.Fhir.Model.DataType _MinimumVolume; + private Hl7.Fhir.Model.DataType? _MinimumVolume; /// /// Additive associated with container. @@ -512,61 +499,54 @@ public Hl7.Fhir.Model.DataType MinimumVolume [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Specimen container preparation. /// [FhirElement("preparation", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString PreparationElement + public Hl7.Fhir.Model.FhirString? PreparationElement { get { return _PreparationElement; } set { _PreparationElement = value; OnPropertyChanged("PreparationElement"); } } - private Hl7.Fhir.Model.FhirString _PreparationElement; + private Hl7.Fhir.Model.FhirString? _PreparationElement; /// /// Specimen container preparation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Preparation + public string? Preparation { - get { return PreparationElement != null ? PreparationElement.Value : null; } + get => _PreparationElement?.Value; set { - if (value == null) - PreparationElement = null; - else - PreparationElement = new Hl7.Fhir.Model.FhirString(value); + PreparationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Preparation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContainerComponent; - - if (dest == null) - { + if(other is not ContainerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Material != null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)Material.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Cap != null) dest.Cap = (Hl7.Fhir.Model.CodeableConcept)Cap.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Capacity != null) dest.Capacity = (Hl7.Fhir.Model.Quantity)Capacity.DeepCopyInternal(); - if(MinimumVolume != null) dest.MinimumVolume = (Hl7.Fhir.Model.DataType)MinimumVolume.DeepCopyInternal(); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(PreparationElement != null) dest.PreparationElement = (Hl7.Fhir.Model.FhirString)PreparationElement.DeepCopyInternal(); + if(_Material is not null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)_Material.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Cap is not null) dest.Cap = (Hl7.Fhir.Model.CodeableConcept)_Cap.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Capacity is not null) dest.Capacity = (Hl7.Fhir.Model.Quantity)_Capacity.DeepCopyInternal(); + if(_MinimumVolume is not null) dest.MinimumVolume = (Hl7.Fhir.Model.DataType)_MinimumVolume.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_PreparationElement is not null) dest.PreparationElement = (Hl7.Fhir.Model.FhirString)_PreparationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -578,83 +558,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainerComponent; - if(otherT == null) return false; + if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Material, otherT.Material)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Cap, otherT.Cap)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Capacity, otherT.Capacity)) return false; - if(!comparer.Equals(MinimumVolume, otherT.MinimumVolume)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(PreparationElement, otherT.PreparationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Cap, otherT._Cap)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; + if(!comparer.Equals(_MinimumVolume, otherT._MinimumVolume)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_PreparationElement, otherT._PreparationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "material": - value = Material; - return Material is not null; + value = _Material; + return _Material is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "cap": - value = Cap; - return Cap is not null; + value = _Cap; + return _Cap is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "capacity": - value = Capacity; - return Capacity is not null; + value = _Capacity; + return _Capacity is not null; case "minimumVolume": - value = MinimumVolume; - return MinimumVolume is not null; + value = _MinimumVolume; + return _MinimumVolume is not null; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "preparation": - value = PreparationElement; - return PreparationElement is not null; + value = _PreparationElement; + return _PreparationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "material": - Material = (Hl7.Fhir.Model.CodeableConcept)value; + Material = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cap": - Cap = (Hl7.Fhir.Model.CodeableConcept)value; + Cap = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "capacity": - Capacity = (Hl7.Fhir.Model.Quantity)value; + Capacity = (Hl7.Fhir.Model.Quantity?)value; return this; case "minimumVolume": - MinimumVolume = (Hl7.Fhir.Model.DataType)value; + MinimumVolume = (Hl7.Fhir.Model.DataType?)value; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "preparation": - PreparationElement = (Hl7.Fhir.Model.FhirString)value; + PreparationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -665,14 +645,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Material is not null) yield return new KeyValuePair("material",Material); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Cap is not null) yield return new KeyValuePair("cap",Cap); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Capacity is not null) yield return new KeyValuePair("capacity",Capacity); - if (MinimumVolume is not null) yield return new KeyValuePair("minimumVolume",MinimumVolume); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (PreparationElement is not null) yield return new KeyValuePair("preparation",PreparationElement); + if (_Material is not null) yield return new KeyValuePair("material",_Material); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Cap is not null) yield return new KeyValuePair("cap",_Cap); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Capacity is not null) yield return new KeyValuePair("capacity",_Capacity); + if (_MinimumVolume is not null) yield return new KeyValuePair("minimumVolume",_MinimumVolume); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_PreparationElement is not null) yield return new KeyValuePair("preparation",_PreparationElement); } } @@ -703,25 +683,21 @@ public partial class AdditiveComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Additive + public Hl7.Fhir.Model.DataType? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.DataType _Additive; + private Hl7.Fhir.Model.DataType? _Additive; protected internal override void CopyToInternal(Base other) { - var dest = other as AdditiveComponent; - - if (dest == null) - { + if(other is not AdditiveComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.DataType)Additive.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.DataType)_Additive.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -733,34 +709,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdditiveComponent; - if(otherT == null) return false; + if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Additive, otherT._Additive)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "additive": - Additive = (Hl7.Fhir.Model.DataType)value; + Additive = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -771,7 +747,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Additive is not null) yield return new KeyValuePair("additive",Additive); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); } } @@ -798,85 +774,78 @@ public partial class HandlingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("temperatureQualifier", Order=40)] [Binding("HandlingConditionSet")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TemperatureQualifier + public Hl7.Fhir.Model.CodeableConcept? TemperatureQualifier { get { return _TemperatureQualifier; } set { _TemperatureQualifier = value; OnPropertyChanged("TemperatureQualifier"); } } - private Hl7.Fhir.Model.CodeableConcept _TemperatureQualifier; + private Hl7.Fhir.Model.CodeableConcept? _TemperatureQualifier; /// /// Temperature range. /// [FhirElement("temperatureRange", Order=50)] [DataMember] - public Hl7.Fhir.Model.Range TemperatureRange + public Hl7.Fhir.Model.Range? TemperatureRange { get { return _TemperatureRange; } set { _TemperatureRange = value; OnPropertyChanged("TemperatureRange"); } } - private Hl7.Fhir.Model.Range _TemperatureRange; + private Hl7.Fhir.Model.Range? _TemperatureRange; /// /// Maximum preservation time. /// [FhirElement("maxDuration", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration MaxDuration + public Hl7.Fhir.Model.Duration? MaxDuration { get { return _MaxDuration; } set { _MaxDuration = value; OnPropertyChanged("MaxDuration"); } } - private Hl7.Fhir.Model.Duration _MaxDuration; + private Hl7.Fhir.Model.Duration? _MaxDuration; /// /// Preservation instruction. /// [FhirElement("instruction", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Preservation instruction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as HandlingComponent; - - if (dest == null) - { + if(other is not HandlingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TemperatureQualifier != null) dest.TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)TemperatureQualifier.DeepCopyInternal(); - if(TemperatureRange != null) dest.TemperatureRange = (Hl7.Fhir.Model.Range)TemperatureRange.DeepCopyInternal(); - if(MaxDuration != null) dest.MaxDuration = (Hl7.Fhir.Model.Duration)MaxDuration.DeepCopyInternal(); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_TemperatureQualifier is not null) dest.TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)_TemperatureQualifier.DeepCopyInternal(); + if(_TemperatureRange is not null) dest.TemperatureRange = (Hl7.Fhir.Model.Range)_TemperatureRange.DeepCopyInternal(); + if(_MaxDuration is not null) dest.MaxDuration = (Hl7.Fhir.Model.Duration)_MaxDuration.DeepCopyInternal(); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -888,55 +857,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HandlingComponent; - if(otherT == null) return false; + if(other is not HandlingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TemperatureQualifier, otherT.TemperatureQualifier)) return false; - if(!comparer.Equals(TemperatureRange, otherT.TemperatureRange)) return false; - if(!comparer.Equals(MaxDuration, otherT.MaxDuration)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; + if(!comparer.Equals(_TemperatureRange, otherT._TemperatureRange)) return false; + if(!comparer.Equals(_MaxDuration, otherT._MaxDuration)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "temperatureQualifier": - value = TemperatureQualifier; - return TemperatureQualifier is not null; + value = _TemperatureQualifier; + return _TemperatureQualifier is not null; case "temperatureRange": - value = TemperatureRange; - return TemperatureRange is not null; + value = _TemperatureRange; + return _TemperatureRange is not null; case "maxDuration": - value = MaxDuration; - return MaxDuration is not null; + value = _MaxDuration; + return _MaxDuration is not null; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "temperatureQualifier": - TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)value; + TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "temperatureRange": - TemperatureRange = (Hl7.Fhir.Model.Range)value; + TemperatureRange = (Hl7.Fhir.Model.Range?)value; return this; case "maxDuration": - MaxDuration = (Hl7.Fhir.Model.Duration)value; + MaxDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -947,10 +916,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TemperatureQualifier is not null) yield return new KeyValuePair("temperatureQualifier",TemperatureQualifier); - if (TemperatureRange is not null) yield return new KeyValuePair("temperatureRange",TemperatureRange); - if (MaxDuration is not null) yield return new KeyValuePair("maxDuration",MaxDuration); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_TemperatureQualifier is not null) yield return new KeyValuePair("temperatureQualifier",_TemperatureQualifier); + if (_TemperatureRange is not null) yield return new KeyValuePair("temperatureRange",_TemperatureRange); + if (_MaxDuration is not null) yield return new KeyValuePair("maxDuration",_MaxDuration); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -960,13 +929,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Kind of material to collect. @@ -974,13 +943,13 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("typeCollected", InSummary=true, Order=100)] [Binding("CollectedSpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TypeCollected + public Hl7.Fhir.Model.CodeableConcept? TypeCollected { get { return _TypeCollected; } set { _TypeCollected = value; OnPropertyChanged("TypeCollected"); } } - private Hl7.Fhir.Model.CodeableConcept _TypeCollected; + private Hl7.Fhir.Model.CodeableConcept? _TypeCollected; /// /// Patient preparation for collection. @@ -991,39 +960,36 @@ public Hl7.Fhir.Model.CodeableConcept TypeCollected [DataMember] public List PatientPreparation { - get { if(_PatientPreparation==null) _PatientPreparation = new List(); return _PatientPreparation; } + get => _PatientPreparation ?? new List(); set { _PatientPreparation = value; OnPropertyChanged("PatientPreparation"); } } - private List _PatientPreparation; + private List? _PatientPreparation; /// /// Time aspect for collection. /// [FhirElement("timeAspect", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TimeAspectElement + public Hl7.Fhir.Model.FhirString? TimeAspectElement { get { return _TimeAspectElement; } set { _TimeAspectElement = value; OnPropertyChanged("TimeAspectElement"); } } - private Hl7.Fhir.Model.FhirString _TimeAspectElement; + private Hl7.Fhir.Model.FhirString? _TimeAspectElement; /// /// Time aspect for collection /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TimeAspect + public string? TimeAspect { - get { return TimeAspectElement != null ? TimeAspectElement.Value : null; } + get => _TimeAspectElement?.Value; set { - if (value == null) - TimeAspectElement = null; - else - TimeAspectElement = new Hl7.Fhir.Model.FhirString(value); + TimeAspectElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TimeAspect"); } } @@ -1037,11 +1003,11 @@ public string TimeAspect [DataMember] public List Collection { - get { if(_Collection==null) _Collection = new List(); return _Collection; } + get => _Collection ?? new List(); set { _Collection = value; OnPropertyChanged("Collection"); } } - private List _Collection; + private List? _Collection; /// /// Specimen in container intended for testing by lab. @@ -1051,30 +1017,26 @@ public List Collection [DataMember] public List TypeTested { - get { if(_TypeTested==null) _TypeTested = new List(); return _TypeTested; } + get => _TypeTested ?? new List(); set { _TypeTested = value; OnPropertyChanged("TypeTested"); } } - private List _TypeTested; + private List? _TypeTested; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SpecimenDefinition; - - if (dest == null) - { + if(other is not SpecimenDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(TypeCollected != null) dest.TypeCollected = (Hl7.Fhir.Model.CodeableConcept)TypeCollected.DeepCopyInternal(); - if(PatientPreparation.Any()) dest.PatientPreparation = new List(PatientPreparation.DeepCopyInternal()); - if(TimeAspectElement != null) dest.TimeAspectElement = (Hl7.Fhir.Model.FhirString)TimeAspectElement.DeepCopyInternal(); - if(Collection.Any()) dest.Collection = new List(Collection.DeepCopyInternal()); - if(TypeTested.Any()) dest.TypeTested = new List(TypeTested.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_TypeCollected is not null) dest.TypeCollected = (Hl7.Fhir.Model.CodeableConcept)_TypeCollected.DeepCopyInternal(); + if(_PatientPreparation is not null) dest.PatientPreparation = new List(_PatientPreparation.DeepCopyInternal()); + if(_TimeAspectElement is not null) dest.TimeAspectElement = (Hl7.Fhir.Model.FhirString)_TimeAspectElement.DeepCopyInternal(); + if(_Collection is not null) dest.Collection = new List(_Collection.DeepCopyInternal()); + if(_TypeTested is not null) dest.TypeTested = new List(_TypeTested.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1086,69 +1048,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecimenDefinition; - if(otherT == null) return false; + if(other is not SpecimenDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeCollected, otherT.TypeCollected)) return false; - if(!comparer.ListEquals(PatientPreparation, otherT.PatientPreparation)) return false; - if(!comparer.Equals(TimeAspectElement, otherT.TimeAspectElement)) return false; - if(!comparer.ListEquals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(TypeTested, otherT.TypeTested)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeCollected, otherT._TypeCollected)) return false; + if(!comparer.ListEquals(_PatientPreparation, otherT._PatientPreparation)) return false; + if(!comparer.Equals(_TimeAspectElement, otherT._TimeAspectElement)) return false; + if(!comparer.ListEquals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_TypeTested, otherT._TypeTested)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "typeCollected": - value = TypeCollected; - return TypeCollected is not null; + value = _TypeCollected; + return _TypeCollected is not null; case "patientPreparation": - value = PatientPreparation; - return PatientPreparation?.Any() == true; + value = _PatientPreparation; + return _PatientPreparation?.Any() == true; case "timeAspect": - value = TimeAspectElement; - return TimeAspectElement is not null; + value = _TimeAspectElement; + return _TimeAspectElement is not null; case "collection": - value = Collection; - return Collection?.Any() == true; + value = _Collection; + return _Collection?.Any() == true; case "typeTested": - value = TypeTested; - return TypeTested?.Any() == true; + value = _TypeTested; + return _TypeTested?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "typeCollected": - TypeCollected = (Hl7.Fhir.Model.CodeableConcept)value; + TypeCollected = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patientPreparation": - PatientPreparation = (List)value; + PatientPreparation = (List?)value!; return this; case "timeAspect": - TimeAspectElement = (Hl7.Fhir.Model.FhirString)value; + TimeAspectElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "collection": - Collection = (List)value; + Collection = (List?)value!; return this; case "typeTested": - TypeTested = (List)value; + TypeTested = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1159,12 +1121,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (TypeCollected is not null) yield return new KeyValuePair("typeCollected",TypeCollected); - if (PatientPreparation?.Any() == true) yield return new KeyValuePair("patientPreparation",PatientPreparation); - if (TimeAspectElement is not null) yield return new KeyValuePair("timeAspect",TimeAspectElement); - if (Collection?.Any() == true) yield return new KeyValuePair("collection",Collection); - if (TypeTested?.Any() == true) yield return new KeyValuePair("typeTested",TypeTested); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeCollected is not null) yield return new KeyValuePair("typeCollected",_TypeCollected); + if (_PatientPreparation?.Any() == true) yield return new KeyValuePair("patientPreparation",_PatientPreparation); + if (_TimeAspectElement is not null) yield return new KeyValuePair("timeAspect",_TimeAspectElement); + if (_Collection?.Any() == true) yield return new KeyValuePair("collection",_Collection); + if (_TypeTested?.Any() == true) yield return new KeyValuePair("typeTested",_TypeTested); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs index c080f29e6..87ca3fda5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -371,28 +374,25 @@ public partial class StructureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical UrlElement + public Hl7.Fhir.Model.Canonical? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.Canonical _UrlElement; + private Hl7.Fhir.Model.Canonical? _UrlElement; /// /// Canonical reference to structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.Canonical(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Url"); } } @@ -405,13 +405,13 @@ public string Url [Binding("StructureMapModelMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | queried | target | produced @@ -420,13 +420,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -436,28 +433,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode /// [FhirElement("alias", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString AliasElement + public Hl7.Fhir.Model.FhirString? AliasElement { get { return _AliasElement; } set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private Hl7.Fhir.Model.FhirString _AliasElement; + private Hl7.Fhir.Model.FhirString? _AliasElement; /// /// Name for type in this map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Alias + public string? Alias { - get { return AliasElement != null ? AliasElement.Value : null; } + get => _AliasElement?.Value; set { - if (value == null) - AliasElement = null; - else - AliasElement = new Hl7.Fhir.Model.FhirString(value); + AliasElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Alias"); } } @@ -467,46 +461,39 @@ public string Alias /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation on use of structure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureComponent; - - if (dest == null) - { + if(other is not StructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)UrlElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(AliasElement != null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)AliasElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)_UrlElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)_AliasElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -518,55 +505,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureComponent; - if(otherT == null) return false; + if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "alias": - value = AliasElement; - return AliasElement is not null; + value = _AliasElement; + return _AliasElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.Canonical)value; + UrlElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "alias": - AliasElement = (Hl7.Fhir.Model.FhirString)value; + AliasElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -577,10 +564,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (AliasElement is not null) yield return new KeyValuePair("alias",AliasElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_AliasElement is not null) yield return new KeyValuePair("alias",_AliasElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -607,28 +594,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -638,28 +622,25 @@ public string Name /// [FhirElement("extends", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Id ExtendsElement + public Hl7.Fhir.Model.Id? ExtendsElement { get { return _ExtendsElement; } set { _ExtendsElement = value; OnPropertyChanged("ExtendsElement"); } } - private Hl7.Fhir.Model.Id _ExtendsElement; + private Hl7.Fhir.Model.Id? _ExtendsElement; /// /// Another group that this group adds rules to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Extends + public string? Extends { - get { return ExtendsElement != null ? ExtendsElement.Value : null; } + get => _ExtendsElement?.Value; set { - if (value == null) - ExtendsElement = null; - else - ExtendsElement = new Hl7.Fhir.Model.Id(value); + ExtendsElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Extends"); } } @@ -672,13 +653,13 @@ public string Extends [Binding("StructureMapGroupTypeMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeModeElement + public Code? TypeModeElement { get { return _TypeModeElement; } set { _TypeModeElement = value; OnPropertyChanged("TypeModeElement"); } } - private Code _TypeModeElement; + private Code? _TypeModeElement; /// /// none | types | type-and-types @@ -687,13 +668,10 @@ public Code TypeModeEleme [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode { - get { return TypeModeElement != null ? TypeModeElement.Value : null; } + get => _TypeModeElement?.Value; set { - if (value == null) - TypeModeElement = null; - else - TypeModeElement = new Code(value); + TypeModeElement = value is null ? null : new Code(value); OnPropertyChanged("TypeMode"); } } @@ -703,28 +681,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional description/explanation for group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -737,11 +712,11 @@ public string Documentation [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Transform Rule from source to target. @@ -751,28 +726,24 @@ public List Input [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(ExtendsElement != null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)ExtendsElement.DeepCopyInternal(); - if(TypeModeElement != null) dest.TypeModeElement = (Code)TypeModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_ExtendsElement is not null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)_ExtendsElement.DeepCopyInternal(); + if(_TypeModeElement is not null) dest.TypeModeElement = (Code)_TypeModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -784,69 +755,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ExtendsElement, otherT.ExtendsElement)) return false; - if(!comparer.Equals(TypeModeElement, otherT.TypeModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; + if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "extends": - value = ExtendsElement; - return ExtendsElement is not null; + value = _ExtendsElement; + return _ExtendsElement is not null; case "typeMode": - value = TypeModeElement; - return TypeModeElement is not null; + value = _TypeModeElement; + return _TypeModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "extends": - ExtendsElement = (Hl7.Fhir.Model.Id)value; + ExtendsElement = (Hl7.Fhir.Model.Id?)value; return this; case "typeMode": - TypeModeElement = (Code)value; + TypeModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -857,12 +828,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ExtendsElement is not null) yield return new KeyValuePair("extends",ExtendsElement); - if (TypeModeElement is not null) yield return new KeyValuePair("typeMode",TypeModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ExtendsElement is not null) yield return new KeyValuePair("extends",_ExtendsElement); + if (_TypeModeElement is not null) yield return new KeyValuePair("typeMode",_TypeModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } @@ -890,28 +861,25 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -921,28 +889,25 @@ public string Name /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Type for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -955,13 +920,13 @@ public string Type [Binding("StructureMapInputMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | target @@ -970,13 +935,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -986,46 +948,39 @@ public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1037,55 +992,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1096,10 +1051,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1123,28 +1078,25 @@ public partial class RuleComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of the rule for internal references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -1157,11 +1109,11 @@ public string Name [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; /// /// Content to create because of this mapping rule. @@ -1171,11 +1123,11 @@ public List Source [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// Rules contained in this rule. @@ -1185,11 +1137,11 @@ public List Target [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Which other rules to apply in the context of this rule. @@ -1199,59 +1151,52 @@ public List Rule [DataMember] public List Dependent { - get { if(_Dependent==null) _Dependent = new List(); return _Dependent; } + get => _Dependent ?? new List(); set { _Dependent = value; OnPropertyChanged("Dependent"); } } - private List _Dependent; + private List? _Dependent; /// /// Documentation for this instance of data. /// [FhirElement("documentation", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RuleComponent; - - if (dest == null) - { + if(other is not RuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(Dependent.Any()) dest.Dependent = new List(Dependent.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_Dependent is not null) dest.Dependent = new List(_Dependent.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1263,69 +1208,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RuleComponent; - if(otherT == null) return false; + if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.ListEquals(Dependent, otherT.Dependent)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "dependent": - value = Dependent; - return Dependent?.Any() == true; + value = _Dependent; + return _Dependent?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "dependent": - Dependent = (List)value; + Dependent = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1336,12 +1281,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (Dependent?.Any() == true) yield return new KeyValuePair("dependent",Dependent); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_Dependent?.Any() == true) yield return new KeyValuePair("dependent",_Dependent); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1365,28 +1310,25 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("context", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ContextElement + public Hl7.Fhir.Model.Id? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.Id _ContextElement; + private Hl7.Fhir.Model.Id? _ContextElement; /// /// Type or variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.Id(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Context"); } } @@ -1396,13 +1338,13 @@ public string Context /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Specified minimum cardinality @@ -1411,13 +1353,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -1427,28 +1366,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Specified maximum cardinality (number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -1458,28 +1394,25 @@ public string Max /// [FhirElement("type", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Rule only applies if source has this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1491,41 +1424,38 @@ public string Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.Contributor),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [DataMember] - public Hl7.Fhir.Model.DataType DefaultValue + public Hl7.Fhir.Model.DataType? DefaultValue { get { return _DefaultValue; } set { _DefaultValue = value; OnPropertyChanged("DefaultValue"); } } - private Hl7.Fhir.Model.DataType _DefaultValue; + private Hl7.Fhir.Model.DataType? _DefaultValue; /// /// Optional field for this source. /// [FhirElement("element", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Optional field for this source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -1537,13 +1467,13 @@ public string Element [DeclaredType(Type = typeof(Code))] [Binding("StructureMapSourceListMode")] [DataMember] - public Code ListModeElement + public Code? ListModeElement { get { return _ListModeElement; } set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private Code _ListModeElement; + private Code? _ListModeElement; /// /// first | not_first | last | not_last | only_one @@ -1552,13 +1482,10 @@ public Code ListModeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode { - get { return ListModeElement != null ? ListModeElement.Value : null; } + get => _ListModeElement?.Value; set { - if (value == null) - ListModeElement = null; - else - ListModeElement = new Code(value); + ListModeElement = value is null ? null : new Code(value); OnPropertyChanged("ListMode"); } } @@ -1568,28 +1495,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode /// [FhirElement("variable", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -1599,28 +1523,25 @@ public string Variable /// [FhirElement("condition", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// FHIRPath expression - must be true or the rule does not apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -1630,28 +1551,25 @@ public string Condition /// [FhirElement("check", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString CheckElement + public Hl7.Fhir.Model.FhirString? CheckElement { get { return _CheckElement; } set { _CheckElement = value; OnPropertyChanged("CheckElement"); } } - private Hl7.Fhir.Model.FhirString _CheckElement; + private Hl7.Fhir.Model.FhirString? _CheckElement; /// /// FHIRPath expression - must be true or the mapping engine throws an error instead of completing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Check + public string? Check { - get { return CheckElement != null ? CheckElement.Value : null; } + get => _CheckElement?.Value; set { - if (value == null) - CheckElement = null; - else - CheckElement = new Hl7.Fhir.Model.FhirString(value); + CheckElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Check"); } } @@ -1661,53 +1579,46 @@ public string Check /// [FhirElement("logMessage", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString LogMessageElement + public Hl7.Fhir.Model.FhirString? LogMessageElement { get { return _LogMessageElement; } set { _LogMessageElement = value; OnPropertyChanged("LogMessageElement"); } } - private Hl7.Fhir.Model.FhirString _LogMessageElement; + private Hl7.Fhir.Model.FhirString? _LogMessageElement; /// /// Message to put in log if source exists (FHIRPath) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LogMessage + public string? LogMessage { - get { return LogMessageElement != null ? LogMessageElement.Value : null; } + get => _LogMessageElement?.Value; set { - if (value == null) - LogMessageElement = null; - else - LogMessageElement = new Hl7.Fhir.Model.FhirString(value); + LogMessageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LogMessage"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.Id)ContextElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(DefaultValue != null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)DefaultValue.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(ListModeElement != null) dest.ListModeElement = (Code)ListModeElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(CheckElement != null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)CheckElement.DeepCopyInternal(); - if(LogMessageElement != null) dest.LogMessageElement = (Hl7.Fhir.Model.FhirString)LogMessageElement.DeepCopyInternal(); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.Id)_ContextElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_DefaultValue is not null) dest.DefaultValue = (Hl7.Fhir.Model.DataType)_DefaultValue.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = (Code)_ListModeElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_CheckElement is not null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)_CheckElement.DeepCopyInternal(); + if(_LogMessageElement is not null) dest.LogMessageElement = (Hl7.Fhir.Model.FhirString)_LogMessageElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1719,104 +1630,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DefaultValue, otherT.DefaultValue)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.Equals(CheckElement, otherT.CheckElement)) return false; - if(!comparer.Equals(LogMessageElement, otherT.LogMessageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DefaultValue, otherT._DefaultValue)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; + if(!comparer.Equals(_LogMessageElement, otherT._LogMessageElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "defaultValue": - value = DefaultValue; - return DefaultValue is not null; + value = _DefaultValue; + return _DefaultValue is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement is not null; + value = _ListModeElement; + return _ListModeElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "check": - value = CheckElement; - return CheckElement is not null; + value = _CheckElement; + return _CheckElement is not null; case "logMessage": - value = LogMessageElement; - return LogMessageElement is not null; + value = _LogMessageElement; + return _LogMessageElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.Id)value; + ContextElement = (Hl7.Fhir.Model.Id?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValue = (Hl7.Fhir.Model.DataType)value; + DefaultValue = (Hl7.Fhir.Model.DataType?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "listMode": - ListModeElement = (Code)value; + ListModeElement = (Code?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "check": - CheckElement = (Hl7.Fhir.Model.FhirString)value; + CheckElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "logMessage": - LogMessageElement = (Hl7.Fhir.Model.FhirString)value; + LogMessageElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1827,17 +1738,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DefaultValue is not null) yield return new KeyValuePair("defaultValue",DefaultValue); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (ListModeElement is not null) yield return new KeyValuePair("listMode",ListModeElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (CheckElement is not null) yield return new KeyValuePair("check",CheckElement); - if (LogMessageElement is not null) yield return new KeyValuePair("logMessage",LogMessageElement); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DefaultValue is not null) yield return new KeyValuePair("defaultValue",_DefaultValue); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_ListModeElement is not null) yield return new KeyValuePair("listMode",_ListModeElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_CheckElement is not null) yield return new KeyValuePair("check",_CheckElement); + if (_LogMessageElement is not null) yield return new KeyValuePair("logMessage",_LogMessageElement); } } @@ -1860,28 +1771,25 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("context", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Id ContextElement + public Hl7.Fhir.Model.Id? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.Id _ContextElement; + private Hl7.Fhir.Model.Id? _ContextElement; /// /// Type or variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.Id(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Context"); } } @@ -1893,13 +1801,13 @@ public string Context [DeclaredType(Type = typeof(Code))] [Binding("StructureMapContextType")] [DataMember] - public Code ContextTypeElement + public Code? ContextTypeElement { get { return _ContextTypeElement; } set { _ContextTypeElement = value; OnPropertyChanged("ContextTypeElement"); } } - private Code _ContextTypeElement; + private Code? _ContextTypeElement; /// /// type | variable @@ -1908,13 +1816,10 @@ public Code ContextTypeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapContextType? ContextType { - get { return ContextTypeElement != null ? ContextTypeElement.Value : null; } + get => _ContextTypeElement?.Value; set { - if (value == null) - ContextTypeElement = null; - else - ContextTypeElement = new Code(value); + ContextTypeElement = value is null ? null : new Code(value); OnPropertyChanged("ContextType"); } } @@ -1924,28 +1829,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapContextType? ContextType /// [FhirElement("element", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Field to create in the context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -1955,28 +1857,25 @@ public string Element /// [FhirElement("variable", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if desired, and a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -1991,24 +1890,24 @@ public string Variable [DataMember] public List> ListModeElement { - get { if(_ListModeElement==null) _ListModeElement = new List>(); return _ListModeElement; } + get => _ListModeElement ?? new List>(); set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private List> _ListModeElement; + private List>? _ListModeElement; /// /// first | share | last | collate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ListMode + public IEnumerable? ListMode { - get { return ListModeElement != null ? ListModeElement.Select(elem => elem.Value) : null; } + get => _ListModeElement?.Select(elem => elem.Value); set { if (value == null) - ListModeElement = null; + ListModeElement = null!; else ListModeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("ListMode"); @@ -2020,28 +1919,25 @@ public IEnumerable List /// [FhirElement("listRuleId", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Id ListRuleIdElement + public Hl7.Fhir.Model.Id? ListRuleIdElement { get { return _ListRuleIdElement; } set { _ListRuleIdElement = value; OnPropertyChanged("ListRuleIdElement"); } } - private Hl7.Fhir.Model.Id _ListRuleIdElement; + private Hl7.Fhir.Model.Id? _ListRuleIdElement; /// /// Internal rule reference for shared list items /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ListRuleId + public string? ListRuleId { - get { return ListRuleIdElement != null ? ListRuleIdElement.Value : null; } + get => _ListRuleIdElement?.Value; set { - if (value == null) - ListRuleIdElement = null; - else - ListRuleIdElement = new Hl7.Fhir.Model.Id(value); + ListRuleIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ListRuleId"); } } @@ -2053,13 +1949,13 @@ public string ListRuleId [DeclaredType(Type = typeof(Code))] [Binding("StructureMapTransform")] [DataMember] - public Code TransformElement + public Code? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Code _TransformElement; + private Code? _TransformElement; /// /// create | copy + @@ -2068,13 +1964,10 @@ public Code TransformElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Code(value); + TransformElement = value is null ? null : new Code(value); OnPropertyChanged("Transform"); } } @@ -2087,30 +1980,26 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.Id)ContextElement.DeepCopyInternal(); - if(ContextTypeElement != null) dest.ContextTypeElement = (Code)ContextTypeElement.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ListModeElement.Any()) dest.ListModeElement = new List>(ListModeElement.DeepCopyInternal()); - if(ListRuleIdElement != null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)ListRuleIdElement.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Code)TransformElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.Id)_ContextElement.DeepCopyInternal(); + if(_ContextTypeElement is not null) dest.ContextTypeElement = (Code)_ContextTypeElement.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = new List>(_ListModeElement.DeepCopyInternal()); + if(_ListRuleIdElement is not null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)_ListRuleIdElement.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Code)_TransformElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2122,83 +2011,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(ContextTypeElement, otherT.ContextTypeElement)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.ListEquals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(ListRuleIdElement, otherT.ListRuleIdElement)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_ContextTypeElement, otherT._ContextTypeElement)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.ListEquals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "contextType": - value = ContextTypeElement; - return ContextTypeElement is not null; + value = _ContextTypeElement; + return _ContextTypeElement is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement?.Any() == true; + value = _ListModeElement; + return _ListModeElement?.Any() == true; case "listRuleId": - value = ListRuleIdElement; - return ListRuleIdElement is not null; + value = _ListRuleIdElement; + return _ListRuleIdElement is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.Id)value; + ContextElement = (Hl7.Fhir.Model.Id?)value; return this; case "contextType": - ContextTypeElement = (Code)value; + ContextTypeElement = (Code?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "listMode": - ListModeElement = (List>)value; + ListModeElement = (List>?)value!; return this; case "listRuleId": - ListRuleIdElement = (Hl7.Fhir.Model.Id)value; + ListRuleIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "transform": - TransformElement = (Code)value; + TransformElement = (Code?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2209,14 +2098,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (ContextTypeElement is not null) yield return new KeyValuePair("contextType",ContextTypeElement); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",ListModeElement); - if (ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",ListRuleIdElement); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_ContextTypeElement is not null) yield return new KeyValuePair("contextType",_ContextTypeElement); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",_ListModeElement); + if (_ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",_ListRuleIdElement); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); } } @@ -2242,25 +2131,21 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirDecimal))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2272,34 +2157,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2310,7 +2195,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -2334,28 +2219,25 @@ public partial class DependentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of a rule or group to apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -2368,24 +2250,24 @@ public string Name [DataMember] public List VariableElement { - get { if(_VariableElement==null) _VariableElement = new List(); return _VariableElement; } + get => _VariableElement ?? new List(); set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private List _VariableElement; + private List? _VariableElement; /// /// Variable to pass to the rule or group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Variable + public IEnumerable? Variable { - get { return VariableElement != null ? VariableElement.Select(elem => elem.Value) : null; } + get => _VariableElement?.Select(elem => elem.Value); set { if (value == null) - VariableElement = null; + VariableElement = null!; else VariableElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Variable"); @@ -2394,16 +2276,12 @@ public IEnumerable Variable protected internal override void CopyToInternal(Base other) { - var dest = other as DependentComponent; - - if (dest == null) - { + if(other is not DependentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(VariableElement.Any()) dest.VariableElement = new List(VariableElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = new List(_VariableElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2415,41 +2293,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependentComponent; - if(otherT == null) return false; + if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(VariableElement, otherT.VariableElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_VariableElement, otherT._VariableElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "variable": - value = VariableElement; - return VariableElement?.Any() == true; + value = _VariableElement; + return _VariableElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "variable": - VariableElement = (List)value; + VariableElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2460,8 +2338,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VariableElement?.Any() == true) yield return new KeyValuePair("variable",VariableElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VariableElement?.Any() == true) yield return new KeyValuePair("variable",_VariableElement); } } @@ -2472,28 +2350,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this structure map, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2506,39 +2381,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the structure map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2549,28 +2421,25 @@ public string Version [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this structure map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2580,28 +2449,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this structure map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2614,13 +2480,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2629,13 +2495,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2645,13 +2508,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2660,13 +2523,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2676,28 +2536,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2707,28 +2564,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2741,39 +2595,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the structure map. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2786,11 +2637,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for structure map (if applicable). @@ -2801,39 +2652,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this structure map is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this structure map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2843,28 +2691,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2877,11 +2722,11 @@ public string Copyright [DataMember] public List Structure { - get { if(_Structure==null) _Structure = new List(); return _Structure; } + get => _Structure ?? new List(); set { _Structure = value; OnPropertyChanged("Structure"); } } - private List _Structure; + private List? _Structure; /// /// Other maps used by this map (canonical URLs). @@ -2891,24 +2736,24 @@ public List Structure [DataMember] public List ImportElement { - get { if(_ImportElement==null) _ImportElement = new List(); return _ImportElement; } + get => _ImportElement ?? new List(); set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } - private List _ImportElement; + private List? _ImportElement; /// /// Other maps used by this map (canonical URLs) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Import + public IEnumerable? Import { - get { return ImportElement != null ? ImportElement.Select(elem => elem.Value) : null; } + get => _ImportElement?.Select(elem => elem.Value); set { if (value == null) - ImportElement = null; + ImportElement = null!; else ImportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Import"); @@ -2923,42 +2768,38 @@ public IEnumerable Import [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureMap; - - if (dest == null) - { + if(other is not StructureMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Structure.Any()) dest.Structure = new List(Structure.DeepCopyInternal()); - if(ImportElement.Any()) dest.ImportElement = new List(ImportElement.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Structure is not null) dest.Structure = new List(_Structure.DeepCopyInternal()); + if(_ImportElement is not null) dest.ImportElement = new List(_ImportElement.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2970,153 +2811,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureMap; - if(otherT == null) return false; + if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Structure, otherT.Structure)) return false; - if(!comparer.ListEquals(ImportElement, otherT.ImportElement)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Structure, otherT._Structure)) return false; + if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "structure": - value = Structure; - return Structure?.Any() == true; + value = _Structure; + return _Structure?.Any() == true; case "import": - value = ImportElement; - return ImportElement?.Any() == true; + value = _ImportElement; + return _ImportElement?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "structure": - Structure = (List)value; + Structure = (List?)value!; return this; case "import": - ImportElement = (List)value; + ImportElement = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3127,24 +2968,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Structure?.Any() == true) yield return new KeyValuePair("structure",Structure); - if (ImportElement?.Any() == true) yield return new KeyValuePair("import",ImportElement); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Structure?.Any() == true) yield return new KeyValuePair("structure",_Structure); + if (_ImportElement?.Any() == true) yield return new KeyValuePair("import",_ImportElement); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs index 970a2a176..30935191d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -123,13 +126,13 @@ public partial class ChannelComponent : Hl7.Fhir.Model.BackboneElement [Binding("SubscriptionChannelType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// rest-hook | websocket | email | sms | message @@ -138,13 +141,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Subscription.SubscriptionChannelType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -154,28 +154,25 @@ public Hl7.Fhir.Model.Subscription.SubscriptionChannelType? Type /// [FhirElement("endpoint", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUrl EndpointElement + public Hl7.Fhir.Model.FhirUrl? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUrl _EndpointElement; + private Hl7.Fhir.Model.FhirUrl? _EndpointElement; /// /// Where the channel points to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUrl(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Endpoint"); } } @@ -186,28 +183,25 @@ public string Endpoint [FhirElement("payload", InSummary=true, Order=60)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code PayloadElement + public Hl7.Fhir.Model.Code? PayloadElement { get { return _PayloadElement; } set { _PayloadElement = value; OnPropertyChanged("PayloadElement"); } } - private Hl7.Fhir.Model.Code _PayloadElement; + private Hl7.Fhir.Model.Code? _PayloadElement; /// /// MIME type to send, or omit for no payload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Payload + public string? Payload { - get { return PayloadElement != null ? PayloadElement.Value : null; } + get => _PayloadElement?.Value; set { - if (value == null) - PayloadElement = null; - else - PayloadElement = new Hl7.Fhir.Model.Code(value); + PayloadElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Payload"); } } @@ -220,24 +214,24 @@ public string Payload [DataMember] public List HeaderElement { - get { if(_HeaderElement==null) _HeaderElement = new List(); return _HeaderElement; } + get => _HeaderElement ?? new List(); set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } - private List _HeaderElement; + private List? _HeaderElement; /// /// Usage depends on the channel type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Header + public IEnumerable? Header { - get { return HeaderElement != null ? HeaderElement.Select(elem => elem.Value) : null; } + get => _HeaderElement?.Select(elem => elem.Value); set { if (value == null) - HeaderElement = null; + HeaderElement = null!; else HeaderElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Header"); @@ -246,18 +240,14 @@ public IEnumerable Header protected internal override void CopyToInternal(Base other) { - var dest = other as ChannelComponent; - - if (dest == null) - { + if(other is not ChannelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopyInternal(); - if(PayloadElement != null) dest.PayloadElement = (Hl7.Fhir.Model.Code)PayloadElement.DeepCopyInternal(); - if(HeaderElement.Any()) dest.HeaderElement = new List(HeaderElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)_EndpointElement.DeepCopyInternal(); + if(_PayloadElement is not null) dest.PayloadElement = (Hl7.Fhir.Model.Code)_PayloadElement.DeepCopyInternal(); + if(_HeaderElement is not null) dest.HeaderElement = new List(_HeaderElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -269,55 +259,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChannelComponent; - if(otherT == null) return false; + if(other is not ChannelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; - if(!comparer.Equals(PayloadElement, otherT.PayloadElement)) return false; - if(!comparer.ListEquals(HeaderElement, otherT.HeaderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; + if(!comparer.Equals(_PayloadElement, otherT._PayloadElement)) return false; + if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; case "payload": - value = PayloadElement; - return PayloadElement is not null; + value = _PayloadElement; + return _PayloadElement is not null; case "header": - value = HeaderElement; - return HeaderElement?.Any() == true; + value = _HeaderElement; + return _HeaderElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUrl)value; + EndpointElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "payload": - PayloadElement = (Hl7.Fhir.Model.Code)value; + PayloadElement = (Hl7.Fhir.Model.Code?)value; return this; case "header": - HeaderElement = (List)value; + HeaderElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -328,10 +318,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); - if (PayloadElement is not null) yield return new KeyValuePair("payload",PayloadElement); - if (HeaderElement?.Any() == true) yield return new KeyValuePair("header",HeaderElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); + if (_PayloadElement is not null) yield return new KeyValuePair("payload",_PayloadElement); + if (_HeaderElement?.Any() == true) yield return new KeyValuePair("header",_HeaderElement); } } @@ -344,13 +334,13 @@ public override IEnumerable> EnumerateElements() [Binding("SubscriptionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// requested | active | error | off @@ -359,13 +349,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -378,24 +365,24 @@ public Hl7.Fhir.Model.SubscriptionStatusCodes? Status [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// When to automatically delete the subscription. /// [FhirElement("end", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When to automatically delete the subscription @@ -404,13 +391,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -421,28 +405,25 @@ public DateTimeOffset? End [FhirElement("reason", InSummary=true, Order=120, FiveWs="FiveWs.why[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ReasonElement + public Hl7.Fhir.Model.FhirString? ReasonElement { get { return _ReasonElement; } set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private Hl7.Fhir.Model.FhirString _ReasonElement; + private Hl7.Fhir.Model.FhirString? _ReasonElement; /// /// Description of why this subscription was created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reason + public string? Reason { - get { return ReasonElement != null ? ReasonElement.Value : null; } + get => _ReasonElement?.Value; set { - if (value == null) - ReasonElement = null; - else - ReasonElement = new Hl7.Fhir.Model.FhirString(value); + ReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Reason"); } } @@ -453,28 +434,25 @@ public string Reason [FhirElement("criteria", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString CriteriaElement + public Hl7.Fhir.Model.FhirString? CriteriaElement { get { return _CriteriaElement; } set { _CriteriaElement = value; OnPropertyChanged("CriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _CriteriaElement; + private Hl7.Fhir.Model.FhirString? _CriteriaElement; /// /// Rule for server push /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Criteria + public string? Criteria { - get { return CriteriaElement != null ? CriteriaElement.Value : null; } + get => _CriteriaElement?.Value; set { - if (value == null) - CriteriaElement = null; - else - CriteriaElement = new Hl7.Fhir.Model.FhirString(value); + CriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Criteria"); } } @@ -484,28 +462,25 @@ public string Criteria /// [FhirElement("error", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ErrorElement + public Hl7.Fhir.Model.FhirString? ErrorElement { get { return _ErrorElement; } set { _ErrorElement = value; OnPropertyChanged("ErrorElement"); } } - private Hl7.Fhir.Model.FhirString _ErrorElement; + private Hl7.Fhir.Model.FhirString? _ErrorElement; /// /// Latest error note /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Error + public string? Error { - get { return ErrorElement != null ? ErrorElement.Value : null; } + get => _ErrorElement?.Value; set { - if (value == null) - ErrorElement = null; - else - ErrorElement = new Hl7.Fhir.Model.FhirString(value); + ErrorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Error"); } } @@ -516,31 +491,27 @@ public string Error [FhirElement("channel", InSummary=true, Order=150)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Subscription.ChannelComponent Channel + public Hl7.Fhir.Model.Subscription.ChannelComponent? Channel { get { return _Channel; } set { _Channel = value; OnPropertyChanged("Channel"); } } - private Hl7.Fhir.Model.Subscription.ChannelComponent _Channel; + private Hl7.Fhir.Model.Subscription.ChannelComponent? _Channel; protected internal override void CopyToInternal(Base other) { - var dest = other as Subscription; - - if (dest == null) - { + if(other is not Subscription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ReasonElement != null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)ReasonElement.DeepCopyInternal(); - if(CriteriaElement != null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)CriteriaElement.DeepCopyInternal(); - if(ErrorElement != null) dest.ErrorElement = (Hl7.Fhir.Model.FhirString)ErrorElement.DeepCopyInternal(); - if(Channel != null) dest.Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)Channel.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ReasonElement is not null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)_ReasonElement.DeepCopyInternal(); + if(_CriteriaElement is not null) dest.CriteriaElement = (Hl7.Fhir.Model.FhirString)_CriteriaElement.DeepCopyInternal(); + if(_ErrorElement is not null) dest.ErrorElement = (Hl7.Fhir.Model.FhirString)_ErrorElement.DeepCopyInternal(); + if(_Channel is not null) dest.Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)_Channel.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -552,76 +523,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Subscription; - if(otherT == null) return false; + if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ReasonElement, otherT.ReasonElement)) return false; - if(!comparer.Equals(CriteriaElement, otherT.CriteriaElement)) return false; - if(!comparer.Equals(ErrorElement, otherT.ErrorElement)) return false; - if(!comparer.Equals(Channel, otherT.Channel)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; + if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; + if(!comparer.Equals(_ErrorElement, otherT._ErrorElement)) return false; + if(!comparer.Equals(_Channel, otherT._Channel)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "reason": - value = ReasonElement; - return ReasonElement is not null; + value = _ReasonElement; + return _ReasonElement is not null; case "criteria": - value = CriteriaElement; - return CriteriaElement is not null; + value = _CriteriaElement; + return _CriteriaElement is not null; case "error": - value = ErrorElement; - return ErrorElement is not null; + value = _ErrorElement; + return _ErrorElement is not null; case "channel": - value = Channel; - return Channel is not null; + value = _Channel; + return _Channel is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "reason": - ReasonElement = (Hl7.Fhir.Model.FhirString)value; + ReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "criteria": - CriteriaElement = (Hl7.Fhir.Model.FhirString)value; + CriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "error": - ErrorElement = (Hl7.Fhir.Model.FhirString)value; + ErrorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "channel": - Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent)value; + Channel = (Hl7.Fhir.Model.Subscription.ChannelComponent?)value; return this; default: return base.SetValue(key, value); @@ -632,13 +603,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ReasonElement is not null) yield return new KeyValuePair("reason",ReasonElement); - if (CriteriaElement is not null) yield return new KeyValuePair("criteria",CriteriaElement); - if (ErrorElement is not null) yield return new KeyValuePair("error",ErrorElement); - if (Channel is not null) yield return new KeyValuePair("channel",Channel); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ReasonElement is not null) yield return new KeyValuePair("reason",_ReasonElement); + if (_CriteriaElement is not null) yield return new KeyValuePair("criteria",_CriteriaElement); + if (_ErrorElement is not null) yield return new KeyValuePair("error",_ErrorElement); + if (_Channel is not null) yield return new KeyValuePair("channel",_Channel); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs index 4a086ad60..dfe4293e0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,28 +124,25 @@ public partial class NotificationEventComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("eventNumber", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString EventNumberElement + public Hl7.Fhir.Model.FhirString? EventNumberElement { get { return _EventNumberElement; } set { _EventNumberElement = value; OnPropertyChanged("EventNumberElement"); } } - private Hl7.Fhir.Model.FhirString _EventNumberElement; + private Hl7.Fhir.Model.FhirString? _EventNumberElement; /// /// Event number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EventNumber + public string? EventNumber { - get { return EventNumberElement != null ? EventNumberElement.Value : null; } + get => _EventNumberElement?.Value; set { - if (value == null) - EventNumberElement = null; - else - EventNumberElement = new Hl7.Fhir.Model.FhirString(value); + EventNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("EventNumber"); } } @@ -152,13 +152,13 @@ public string EventNumber /// [FhirElement("timestamp", Order=50)] [DataMember] - public Hl7.Fhir.Model.Instant TimestampElement + public Hl7.Fhir.Model.Instant? TimestampElement { get { return _TimestampElement; } set { _TimestampElement = value; OnPropertyChanged("TimestampElement"); } } - private Hl7.Fhir.Model.Instant _TimestampElement; + private Hl7.Fhir.Model.Instant? _TimestampElement; /// /// The instant this event occurred @@ -167,13 +167,10 @@ public Hl7.Fhir.Model.Instant TimestampElement [IgnoreDataMember] public DateTimeOffset? Timestamp { - get { return TimestampElement != null ? TimestampElement.Value : null; } + get => _TimestampElement?.Value; set { - if (value == null) - TimestampElement = null; - else - TimestampElement = new Hl7.Fhir.Model.Instant(value); + TimestampElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Timestamp"); } } @@ -185,13 +182,13 @@ public DateTimeOffset? Timestamp [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Additional context for this event. @@ -203,26 +200,22 @@ public Hl7.Fhir.Model.ResourceReference Focus [DataMember] public List AdditionalContext { - get { if(_AdditionalContext==null) _AdditionalContext = new List(); return _AdditionalContext; } + get => _AdditionalContext ?? new List(); set { _AdditionalContext = value; OnPropertyChanged("AdditionalContext"); } } - private List _AdditionalContext; + private List? _AdditionalContext; protected internal override void CopyToInternal(Base other) { - var dest = other as NotificationEventComponent; - - if (dest == null) - { + if(other is not NotificationEventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(EventNumberElement != null) dest.EventNumberElement = (Hl7.Fhir.Model.FhirString)EventNumberElement.DeepCopyInternal(); - if(TimestampElement != null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)TimestampElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(AdditionalContext.Any()) dest.AdditionalContext = new List(AdditionalContext.DeepCopyInternal()); + if(_EventNumberElement is not null) dest.EventNumberElement = (Hl7.Fhir.Model.FhirString)_EventNumberElement.DeepCopyInternal(); + if(_TimestampElement is not null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)_TimestampElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_AdditionalContext is not null) dest.AdditionalContext = new List(_AdditionalContext.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -234,55 +227,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotificationEventComponent; - if(otherT == null) return false; + if(other is not NotificationEventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(EventNumberElement, otherT.EventNumberElement)) return false; - if(!comparer.Equals(TimestampElement, otherT.TimestampElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(AdditionalContext, otherT.AdditionalContext)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_EventNumberElement, otherT._EventNumberElement)) return false; + if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_AdditionalContext, otherT._AdditionalContext)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "eventNumber": - value = EventNumberElement; - return EventNumberElement is not null; + value = _EventNumberElement; + return _EventNumberElement is not null; case "timestamp": - value = TimestampElement; - return TimestampElement is not null; + value = _TimestampElement; + return _TimestampElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "additionalContext": - value = AdditionalContext; - return AdditionalContext?.Any() == true; + value = _AdditionalContext; + return _AdditionalContext?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "eventNumber": - EventNumberElement = (Hl7.Fhir.Model.FhirString)value; + EventNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "timestamp": - TimestampElement = (Hl7.Fhir.Model.Instant)value; + TimestampElement = (Hl7.Fhir.Model.Instant?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "additionalContext": - AdditionalContext = (List)value; + AdditionalContext = (List?)value!; return this; default: return base.SetValue(key, value); @@ -293,10 +286,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (EventNumberElement is not null) yield return new KeyValuePair("eventNumber",EventNumberElement); - if (TimestampElement is not null) yield return new KeyValuePair("timestamp",TimestampElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (AdditionalContext?.Any() == true) yield return new KeyValuePair("additionalContext",AdditionalContext); + if (_EventNumberElement is not null) yield return new KeyValuePair("eventNumber",_EventNumberElement); + if (_TimestampElement is not null) yield return new KeyValuePair("timestamp",_TimestampElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_AdditionalContext?.Any() == true) yield return new KeyValuePair("additionalContext",_AdditionalContext); } } @@ -308,13 +301,13 @@ public override IEnumerable> EnumerateElements() [DeclaredType(Type = typeof(Code))] [Binding("SubscriptionStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// requested | active | error | off | entered-in-error @@ -323,13 +316,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -342,13 +332,13 @@ public Hl7.Fhir.Model.SubscriptionStatusCodes? Status [Binding("SubscriptionNotificationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// handshake | heartbeat | event-notification | query-status | query-event @@ -357,13 +347,10 @@ public Code Type [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionStatus.SubscriptionNotificationType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -373,28 +360,25 @@ public Hl7.Fhir.Model.SubscriptionStatus.SubscriptionNotificationType? Type /// [FhirElement("eventsSinceSubscriptionStart", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString EventsSinceSubscriptionStartElement + public Hl7.Fhir.Model.FhirString? EventsSinceSubscriptionStartElement { get { return _EventsSinceSubscriptionStartElement; } set { _EventsSinceSubscriptionStartElement = value; OnPropertyChanged("EventsSinceSubscriptionStartElement"); } } - private Hl7.Fhir.Model.FhirString _EventsSinceSubscriptionStartElement; + private Hl7.Fhir.Model.FhirString? _EventsSinceSubscriptionStartElement; /// /// Events since the Subscription was created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EventsSinceSubscriptionStart + public string? EventsSinceSubscriptionStart { - get { return EventsSinceSubscriptionStartElement != null ? EventsSinceSubscriptionStartElement.Value : null; } + get => _EventsSinceSubscriptionStartElement?.Value; set { - if (value == null) - EventsSinceSubscriptionStartElement = null; - else - EventsSinceSubscriptionStartElement = new Hl7.Fhir.Model.FhirString(value); + EventsSinceSubscriptionStartElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("EventsSinceSubscriptionStart"); } } @@ -407,11 +391,11 @@ public string EventsSinceSubscriptionStart [DataMember] public List NotificationEvent { - get { if(_NotificationEvent==null) _NotificationEvent = new List(); return _NotificationEvent; } + get => _NotificationEvent ?? new List(); set { _NotificationEvent = value; OnPropertyChanged("NotificationEvent"); } } - private List _NotificationEvent; + private List? _NotificationEvent; /// /// Reference to the Subscription responsible for this notification. @@ -421,41 +405,38 @@ public List Notifi [References("Subscription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subscription + public Hl7.Fhir.Model.ResourceReference? Subscription { get { return _Subscription; } set { _Subscription = value; OnPropertyChanged("Subscription"); } } - private Hl7.Fhir.Model.ResourceReference _Subscription; + private Hl7.Fhir.Model.ResourceReference? _Subscription; /// /// Reference to the SubscriptionTopic this notification relates to. /// [FhirElement("topic", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Canonical TopicElement + public Hl7.Fhir.Model.Canonical? TopicElement { get { return _TopicElement; } set { _TopicElement = value; OnPropertyChanged("TopicElement"); } } - private Hl7.Fhir.Model.Canonical _TopicElement; + private Hl7.Fhir.Model.Canonical? _TopicElement; /// /// Reference to the SubscriptionTopic this notification relates to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Topic + public string? Topic { - get { return TopicElement != null ? TopicElement.Value : null; } + get => _TopicElement?.Value; set { - if (value == null) - TopicElement = null; - else - TopicElement = new Hl7.Fhir.Model.Canonical(value); + TopicElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Topic"); } } @@ -469,29 +450,25 @@ public string Topic [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; protected internal override void CopyToInternal(Base other) { - var dest = other as SubscriptionStatus; - - if (dest == null) - { + if(other is not SubscriptionStatus dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EventsSinceSubscriptionStartElement != null) dest.EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.FhirString)EventsSinceSubscriptionStartElement.DeepCopyInternal(); - if(NotificationEvent.Any()) dest.NotificationEvent = new List(NotificationEvent.DeepCopyInternal()); - if(Subscription != null) dest.Subscription = (Hl7.Fhir.Model.ResourceReference)Subscription.DeepCopyInternal(); - if(TopicElement != null) dest.TopicElement = (Hl7.Fhir.Model.Canonical)TopicElement.DeepCopyInternal(); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EventsSinceSubscriptionStartElement is not null) dest.EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.FhirString)_EventsSinceSubscriptionStartElement.DeepCopyInternal(); + if(_NotificationEvent is not null) dest.NotificationEvent = new List(_NotificationEvent.DeepCopyInternal()); + if(_Subscription is not null) dest.Subscription = (Hl7.Fhir.Model.ResourceReference)_Subscription.DeepCopyInternal(); + if(_TopicElement is not null) dest.TopicElement = (Hl7.Fhir.Model.Canonical)_TopicElement.DeepCopyInternal(); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -503,76 +480,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubscriptionStatus; - if(otherT == null) return false; + if(other is not SubscriptionStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(EventsSinceSubscriptionStartElement, otherT.EventsSinceSubscriptionStartElement)) return false; - if(!comparer.ListEquals(NotificationEvent, otherT.NotificationEvent)) return false; - if(!comparer.Equals(Subscription, otherT.Subscription)) return false; - if(!comparer.Equals(TopicElement, otherT.TopicElement)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_EventsSinceSubscriptionStartElement, otherT._EventsSinceSubscriptionStartElement)) return false; + if(!comparer.ListEquals(_NotificationEvent, otherT._NotificationEvent)) return false; + if(!comparer.Equals(_Subscription, otherT._Subscription)) return false; + if(!comparer.Equals(_TopicElement, otherT._TopicElement)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "eventsSinceSubscriptionStart": - value = EventsSinceSubscriptionStartElement; - return EventsSinceSubscriptionStartElement is not null; + value = _EventsSinceSubscriptionStartElement; + return _EventsSinceSubscriptionStartElement is not null; case "notificationEvent": - value = NotificationEvent; - return NotificationEvent?.Any() == true; + value = _NotificationEvent; + return _NotificationEvent?.Any() == true; case "subscription": - value = Subscription; - return Subscription is not null; + value = _Subscription; + return _Subscription is not null; case "topic": - value = TopicElement; - return TopicElement is not null; + value = _TopicElement; + return _TopicElement is not null; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "eventsSinceSubscriptionStart": - EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.FhirString)value; + EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "notificationEvent": - NotificationEvent = (List)value; + NotificationEvent = (List?)value!; return this; case "subscription": - Subscription = (Hl7.Fhir.Model.ResourceReference)value; + Subscription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "topic": - TopicElement = (Hl7.Fhir.Model.Canonical)value; + TopicElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -583,13 +560,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EventsSinceSubscriptionStartElement is not null) yield return new KeyValuePair("eventsSinceSubscriptionStart",EventsSinceSubscriptionStartElement); - if (NotificationEvent?.Any() == true) yield return new KeyValuePair("notificationEvent",NotificationEvent); - if (Subscription is not null) yield return new KeyValuePair("subscription",Subscription); - if (TopicElement is not null) yield return new KeyValuePair("topic",TopicElement); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EventsSinceSubscriptionStartElement is not null) yield return new KeyValuePair("eventsSinceSubscriptionStart",_EventsSinceSubscriptionStartElement); + if (_NotificationEvent?.Any() == true) yield return new KeyValuePair("notificationEvent",_NotificationEvent); + if (_Subscription is not null) yield return new KeyValuePair("subscription",_Subscription); + if (_TopicElement is not null) yield return new KeyValuePair("topic",_TopicElement); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs index 86ce693a6..1c8393d78 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -230,28 +233,25 @@ public partial class ResourceTriggerComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Text representation of the resource trigger /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -263,28 +263,25 @@ public string Description [Binding("FHIRDefinedTypeExt")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// Data Type or Resource (reference to definition) for this trigger definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -299,24 +296,24 @@ public string Resource [DataMember] public List> SupportedInteractionElement { - get { if(_SupportedInteractionElement==null) _SupportedInteractionElement = new List>(); return _SupportedInteractionElement; } + get => _SupportedInteractionElement ?? new List>(); set { _SupportedInteractionElement = value; OnPropertyChanged("SupportedInteractionElement"); } } - private List> _SupportedInteractionElement; + private List>? _SupportedInteractionElement; /// /// create | update | delete /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SupportedInteraction + public IEnumerable? SupportedInteraction { - get { return SupportedInteractionElement != null ? SupportedInteractionElement.Select(elem => elem.Value) : null; } + get => _SupportedInteractionElement?.Select(elem => elem.Value); set { if (value == null) - SupportedInteractionElement = null; + SupportedInteractionElement = null!; else SupportedInteractionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("SupportedInteraction"); @@ -328,60 +325,53 @@ public IEnumerable Support /// [FhirElement("queryCriteria", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent QueryCriteria + public Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent? QueryCriteria { get { return _QueryCriteria; } set { _QueryCriteria = value; OnPropertyChanged("QueryCriteria"); } } - private Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent _QueryCriteria; + private Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent? _QueryCriteria; /// /// FHIRPath based trigger rule. /// [FhirElement("fhirPathCriteria", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString FhirPathCriteriaElement + public Hl7.Fhir.Model.FhirString? FhirPathCriteriaElement { get { return _FhirPathCriteriaElement; } set { _FhirPathCriteriaElement = value; OnPropertyChanged("FhirPathCriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _FhirPathCriteriaElement; + private Hl7.Fhir.Model.FhirString? _FhirPathCriteriaElement; /// /// FHIRPath based trigger rule /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FhirPathCriteria + public string? FhirPathCriteria { - get { return FhirPathCriteriaElement != null ? FhirPathCriteriaElement.Value : null; } + get => _FhirPathCriteriaElement?.Value; set { - if (value == null) - FhirPathCriteriaElement = null; - else - FhirPathCriteriaElement = new Hl7.Fhir.Model.FhirString(value); + FhirPathCriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("FhirPathCriteria"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceTriggerComponent; - - if (dest == null) - { + if(other is not ResourceTriggerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(SupportedInteractionElement.Any()) dest.SupportedInteractionElement = new List>(SupportedInteractionElement.DeepCopyInternal()); - if(QueryCriteria != null) dest.QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent)QueryCriteria.DeepCopyInternal(); - if(FhirPathCriteriaElement != null) dest.FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString)FhirPathCriteriaElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_SupportedInteractionElement is not null) dest.SupportedInteractionElement = new List>(_SupportedInteractionElement.DeepCopyInternal()); + if(_QueryCriteria is not null) dest.QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent)_QueryCriteria.DeepCopyInternal(); + if(_FhirPathCriteriaElement is not null) dest.FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString)_FhirPathCriteriaElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -393,62 +383,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceTriggerComponent; - if(otherT == null) return false; + if(other is not ResourceTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.ListEquals(SupportedInteractionElement, otherT.SupportedInteractionElement)) return false; - if(!comparer.Equals(QueryCriteria, otherT.QueryCriteria)) return false; - if(!comparer.Equals(FhirPathCriteriaElement, otherT.FhirPathCriteriaElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.ListEquals(_SupportedInteractionElement, otherT._SupportedInteractionElement)) return false; + if(!comparer.Equals(_QueryCriteria, otherT._QueryCriteria)) return false; + if(!comparer.Equals(_FhirPathCriteriaElement, otherT._FhirPathCriteriaElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "supportedInteraction": - value = SupportedInteractionElement; - return SupportedInteractionElement?.Any() == true; + value = _SupportedInteractionElement; + return _SupportedInteractionElement?.Any() == true; case "queryCriteria": - value = QueryCriteria; - return QueryCriteria is not null; + value = _QueryCriteria; + return _QueryCriteria is not null; case "fhirPathCriteria": - value = FhirPathCriteriaElement; - return FhirPathCriteriaElement is not null; + value = _FhirPathCriteriaElement; + return _FhirPathCriteriaElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "supportedInteraction": - SupportedInteractionElement = (List>)value; + SupportedInteractionElement = (List>?)value!; return this; case "queryCriteria": - QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent)value; + QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent?)value; return this; case "fhirPathCriteria": - FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString)value; + FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -459,11 +449,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (SupportedInteractionElement?.Any() == true) yield return new KeyValuePair("supportedInteraction",SupportedInteractionElement); - if (QueryCriteria is not null) yield return new KeyValuePair("queryCriteria",QueryCriteria); - if (FhirPathCriteriaElement is not null) yield return new KeyValuePair("fhirPathCriteria",FhirPathCriteriaElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_SupportedInteractionElement?.Any() == true) yield return new KeyValuePair("supportedInteraction",_SupportedInteractionElement); + if (_QueryCriteria is not null) yield return new KeyValuePair("queryCriteria",_QueryCriteria); + if (_FhirPathCriteriaElement is not null) yield return new KeyValuePair("fhirPathCriteria",_FhirPathCriteriaElement); } } @@ -489,28 +479,25 @@ public partial class QueryCriteriaComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("previous", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PreviousElement + public Hl7.Fhir.Model.FhirString? PreviousElement { get { return _PreviousElement; } set { _PreviousElement = value; OnPropertyChanged("PreviousElement"); } } - private Hl7.Fhir.Model.FhirString _PreviousElement; + private Hl7.Fhir.Model.FhirString? _PreviousElement; /// /// Rule applied to previous resource state /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Previous + public string? Previous { - get { return PreviousElement != null ? PreviousElement.Value : null; } + get => _PreviousElement?.Value; set { - if (value == null) - PreviousElement = null; - else - PreviousElement = new Hl7.Fhir.Model.FhirString(value); + PreviousElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Previous"); } } @@ -522,13 +509,13 @@ public string Previous [DeclaredType(Type = typeof(Code))] [Binding("CriteriaNotExistsBehavior")] [DataMember] - public Code ResultForCreateElement + public Code? ResultForCreateElement { get { return _ResultForCreateElement; } set { _ResultForCreateElement = value; OnPropertyChanged("ResultForCreateElement"); } } - private Code _ResultForCreateElement; + private Code? _ResultForCreateElement; /// /// test-passes | test-fails @@ -537,13 +524,10 @@ public Code ResultFo [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForCreate { - get { return ResultForCreateElement != null ? ResultForCreateElement.Value : null; } + get => _ResultForCreateElement?.Value; set { - if (value == null) - ResultForCreateElement = null; - else - ResultForCreateElement = new Code(value); + ResultForCreateElement = value is null ? null : new Code(value); OnPropertyChanged("ResultForCreate"); } } @@ -553,28 +537,25 @@ public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForCrea /// [FhirElement("current", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString CurrentElement + public Hl7.Fhir.Model.FhirString? CurrentElement { get { return _CurrentElement; } set { _CurrentElement = value; OnPropertyChanged("CurrentElement"); } } - private Hl7.Fhir.Model.FhirString _CurrentElement; + private Hl7.Fhir.Model.FhirString? _CurrentElement; /// /// Rule applied to current resource state /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Current + public string? Current { - get { return CurrentElement != null ? CurrentElement.Value : null; } + get => _CurrentElement?.Value; set { - if (value == null) - CurrentElement = null; - else - CurrentElement = new Hl7.Fhir.Model.FhirString(value); + CurrentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Current"); } } @@ -586,13 +567,13 @@ public string Current [DeclaredType(Type = typeof(Code))] [Binding("CriteriaNotExistsBehavior")] [DataMember] - public Code ResultForDeleteElement + public Code? ResultForDeleteElement { get { return _ResultForDeleteElement; } set { _ResultForDeleteElement = value; OnPropertyChanged("ResultForDeleteElement"); } } - private Code _ResultForDeleteElement; + private Code? _ResultForDeleteElement; /// /// test-passes | test-fails @@ -601,13 +582,10 @@ public Code ResultFo [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForDelete { - get { return ResultForDeleteElement != null ? ResultForDeleteElement.Value : null; } + get => _ResultForDeleteElement?.Value; set { - if (value == null) - ResultForDeleteElement = null; - else - ResultForDeleteElement = new Code(value); + ResultForDeleteElement = value is null ? null : new Code(value); OnPropertyChanged("ResultForDelete"); } } @@ -617,13 +595,13 @@ public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForDele /// [FhirElement("requireBoth", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequireBothElement + public Hl7.Fhir.Model.FhirBoolean? RequireBothElement { get { return _RequireBothElement; } set { _RequireBothElement = value; OnPropertyChanged("RequireBothElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequireBothElement; + private Hl7.Fhir.Model.FhirBoolean? _RequireBothElement; /// /// Both must be true flag @@ -632,32 +610,25 @@ public Hl7.Fhir.Model.FhirBoolean RequireBothElement [IgnoreDataMember] public bool? RequireBoth { - get { return RequireBothElement != null ? RequireBothElement.Value : null; } + get => _RequireBothElement?.Value; set { - if (value == null) - RequireBothElement = null; - else - RequireBothElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequireBothElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("RequireBoth"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QueryCriteriaComponent; - - if (dest == null) - { + if(other is not QueryCriteriaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PreviousElement != null) dest.PreviousElement = (Hl7.Fhir.Model.FhirString)PreviousElement.DeepCopyInternal(); - if(ResultForCreateElement != null) dest.ResultForCreateElement = (Code)ResultForCreateElement.DeepCopyInternal(); - if(CurrentElement != null) dest.CurrentElement = (Hl7.Fhir.Model.FhirString)CurrentElement.DeepCopyInternal(); - if(ResultForDeleteElement != null) dest.ResultForDeleteElement = (Code)ResultForDeleteElement.DeepCopyInternal(); - if(RequireBothElement != null) dest.RequireBothElement = (Hl7.Fhir.Model.FhirBoolean)RequireBothElement.DeepCopyInternal(); + if(_PreviousElement is not null) dest.PreviousElement = (Hl7.Fhir.Model.FhirString)_PreviousElement.DeepCopyInternal(); + if(_ResultForCreateElement is not null) dest.ResultForCreateElement = (Code)_ResultForCreateElement.DeepCopyInternal(); + if(_CurrentElement is not null) dest.CurrentElement = (Hl7.Fhir.Model.FhirString)_CurrentElement.DeepCopyInternal(); + if(_ResultForDeleteElement is not null) dest.ResultForDeleteElement = (Code)_ResultForDeleteElement.DeepCopyInternal(); + if(_RequireBothElement is not null) dest.RequireBothElement = (Hl7.Fhir.Model.FhirBoolean)_RequireBothElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -669,62 +640,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QueryCriteriaComponent; - if(otherT == null) return false; + if(other is not QueryCriteriaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PreviousElement, otherT.PreviousElement)) return false; - if(!comparer.Equals(ResultForCreateElement, otherT.ResultForCreateElement)) return false; - if(!comparer.Equals(CurrentElement, otherT.CurrentElement)) return false; - if(!comparer.Equals(ResultForDeleteElement, otherT.ResultForDeleteElement)) return false; - if(!comparer.Equals(RequireBothElement, otherT.RequireBothElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreviousElement, otherT._PreviousElement)) return false; + if(!comparer.Equals(_ResultForCreateElement, otherT._ResultForCreateElement)) return false; + if(!comparer.Equals(_CurrentElement, otherT._CurrentElement)) return false; + if(!comparer.Equals(_ResultForDeleteElement, otherT._ResultForDeleteElement)) return false; + if(!comparer.Equals(_RequireBothElement, otherT._RequireBothElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "previous": - value = PreviousElement; - return PreviousElement is not null; + value = _PreviousElement; + return _PreviousElement is not null; case "resultForCreate": - value = ResultForCreateElement; - return ResultForCreateElement is not null; + value = _ResultForCreateElement; + return _ResultForCreateElement is not null; case "current": - value = CurrentElement; - return CurrentElement is not null; + value = _CurrentElement; + return _CurrentElement is not null; case "resultForDelete": - value = ResultForDeleteElement; - return ResultForDeleteElement is not null; + value = _ResultForDeleteElement; + return _ResultForDeleteElement is not null; case "requireBoth": - value = RequireBothElement; - return RequireBothElement is not null; + value = _RequireBothElement; + return _RequireBothElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "previous": - PreviousElement = (Hl7.Fhir.Model.FhirString)value; + PreviousElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resultForCreate": - ResultForCreateElement = (Code)value; + ResultForCreateElement = (Code?)value; return this; case "current": - CurrentElement = (Hl7.Fhir.Model.FhirString)value; + CurrentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resultForDelete": - ResultForDeleteElement = (Code)value; + ResultForDeleteElement = (Code?)value; return this; case "requireBoth": - RequireBothElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequireBothElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -735,11 +706,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PreviousElement is not null) yield return new KeyValuePair("previous",PreviousElement); - if (ResultForCreateElement is not null) yield return new KeyValuePair("resultForCreate",ResultForCreateElement); - if (CurrentElement is not null) yield return new KeyValuePair("current",CurrentElement); - if (ResultForDeleteElement is not null) yield return new KeyValuePair("resultForDelete",ResultForDeleteElement); - if (RequireBothElement is not null) yield return new KeyValuePair("requireBoth",RequireBothElement); + if (_PreviousElement is not null) yield return new KeyValuePair("previous",_PreviousElement); + if (_ResultForCreateElement is not null) yield return new KeyValuePair("resultForCreate",_ResultForCreateElement); + if (_CurrentElement is not null) yield return new KeyValuePair("current",_CurrentElement); + if (_ResultForDeleteElement is not null) yield return new KeyValuePair("resultForDelete",_ResultForDeleteElement); + if (_RequireBothElement is not null) yield return new KeyValuePair("requireBoth",_RequireBothElement); } } @@ -765,28 +736,25 @@ public partial class EventTriggerComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Text representation of the event trigger /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -798,13 +766,13 @@ public string Description [Binding("SubscriptionTopicEventTrigger")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Event + public Hl7.Fhir.Model.CodeableConcept? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.CodeableConcept _Event; + private Hl7.Fhir.Model.CodeableConcept? _Event; /// /// Data Type or Resource (reference to definition) for this trigger definition. @@ -813,45 +781,38 @@ public Hl7.Fhir.Model.CodeableConcept Event [Binding("FHIRDefinedTypeExt")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// Data Type or Resource (reference to definition) for this trigger definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EventTriggerComponent; - - if (dest == null) - { + if(other is not EventTriggerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Event != null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)Event.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)_Event.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -863,48 +824,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventTriggerComponent; - if(otherT == null) return false; + if(other is not EventTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "event": - Event = (Hl7.Fhir.Model.CodeableConcept)value; + Event = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -915,9 +876,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); } } @@ -943,28 +904,25 @@ public partial class CanFilterByComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of this filter parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -975,28 +933,25 @@ public string Description [FhirElement("resource", InSummary=true, Order=50)] [Binding("FHIRDefinedTypeExt")] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// URL of the triggering Resource that this filter applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -1007,28 +962,25 @@ public string Resource [FhirElement("filterParameter", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString FilterParameterElement + public Hl7.Fhir.Model.FhirString? FilterParameterElement { get { return _FilterParameterElement; } set { _FilterParameterElement = value; OnPropertyChanged("FilterParameterElement"); } } - private Hl7.Fhir.Model.FhirString _FilterParameterElement; + private Hl7.Fhir.Model.FhirString? _FilterParameterElement; /// /// Human-readable and computation-friendly name for a filter parameter usable by subscriptions on this topic, via Subscription.filterBy.filterParameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FilterParameter + public string? FilterParameter { - get { return FilterParameterElement != null ? FilterParameterElement.Value : null; } + get => _FilterParameterElement?.Value; set { - if (value == null) - FilterParameterElement = null; - else - FilterParameterElement = new Hl7.Fhir.Model.FhirString(value); + FilterParameterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("FilterParameter"); } } @@ -1038,28 +990,25 @@ public string FilterParameter /// [FhirElement("filterDefinition", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUri FilterDefinitionElement + public Hl7.Fhir.Model.FhirUri? FilterDefinitionElement { get { return _FilterDefinitionElement; } set { _FilterDefinitionElement = value; OnPropertyChanged("FilterDefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _FilterDefinitionElement; + private Hl7.Fhir.Model.FhirUri? _FilterDefinitionElement; /// /// Canonical URL for a filterParameter definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FilterDefinition + public string? FilterDefinition { - get { return FilterDefinitionElement != null ? FilterDefinitionElement.Value : null; } + get => _FilterDefinitionElement?.Value; set { - if (value == null) - FilterDefinitionElement = null; - else - FilterDefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + FilterDefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("FilterDefinition"); } } @@ -1074,24 +1023,24 @@ public string FilterDefinition [DataMember] public List> ModifierElement { - get { if(_ModifierElement==null) _ModifierElement = new List>(); return _ModifierElement; } + get => _ModifierElement ?? new List>(); set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } - private List> _ModifierElement; + private List>? _ModifierElement; /// /// = | eq | ne | gt | lt | ge | le | sa | eb | ap | above | below | in | not-in | of-type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Modifier + public IEnumerable? Modifier { - get { return ModifierElement != null ? ModifierElement.Select(elem => elem.Value) : null; } + get => _ModifierElement?.Select(elem => elem.Value); set { if (value == null) - ModifierElement = null; + ModifierElement = null!; else ModifierElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Modifier"); @@ -1100,19 +1049,15 @@ public IEnumerable protected internal override void CopyToInternal(Base other) { - var dest = other as CanFilterByComponent; - - if (dest == null) - { + if(other is not CanFilterByComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(FilterParameterElement != null) dest.FilterParameterElement = (Hl7.Fhir.Model.FhirString)FilterParameterElement.DeepCopyInternal(); - if(FilterDefinitionElement != null) dest.FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri)FilterDefinitionElement.DeepCopyInternal(); - if(ModifierElement.Any()) dest.ModifierElement = new List>(ModifierElement.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_FilterParameterElement is not null) dest.FilterParameterElement = (Hl7.Fhir.Model.FhirString)_FilterParameterElement.DeepCopyInternal(); + if(_FilterDefinitionElement is not null) dest.FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri)_FilterDefinitionElement.DeepCopyInternal(); + if(_ModifierElement is not null) dest.ModifierElement = new List>(_ModifierElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1124,62 +1069,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CanFilterByComponent; - if(otherT == null) return false; + if(other is not CanFilterByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(FilterParameterElement, otherT.FilterParameterElement)) return false; - if(!comparer.Equals(FilterDefinitionElement, otherT.FilterDefinitionElement)) return false; - if(!comparer.ListEquals(ModifierElement, otherT.ModifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_FilterParameterElement, otherT._FilterParameterElement)) return false; + if(!comparer.Equals(_FilterDefinitionElement, otherT._FilterDefinitionElement)) return false; + if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "filterParameter": - value = FilterParameterElement; - return FilterParameterElement is not null; + value = _FilterParameterElement; + return _FilterParameterElement is not null; case "filterDefinition": - value = FilterDefinitionElement; - return FilterDefinitionElement is not null; + value = _FilterDefinitionElement; + return _FilterDefinitionElement is not null; case "modifier": - value = ModifierElement; - return ModifierElement?.Any() == true; + value = _ModifierElement; + return _ModifierElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "filterParameter": - FilterParameterElement = (Hl7.Fhir.Model.FhirString)value; + FilterParameterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "filterDefinition": - FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "modifier": - ModifierElement = (List>)value; + ModifierElement = (List>?)value!; return this; default: return base.SetValue(key, value); @@ -1190,11 +1135,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (FilterParameterElement is not null) yield return new KeyValuePair("filterParameter",FilterParameterElement); - if (FilterDefinitionElement is not null) yield return new KeyValuePair("filterDefinition",FilterDefinitionElement); - if (ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",ModifierElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_FilterParameterElement is not null) yield return new KeyValuePair("filterParameter",_FilterParameterElement); + if (_FilterDefinitionElement is not null) yield return new KeyValuePair("filterDefinition",_FilterDefinitionElement); + if (_ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",_ModifierElement); } } @@ -1222,28 +1167,25 @@ public partial class NotificationShapeComponent : Hl7.Fhir.Model.BackboneElement [Binding("FHIRDefinedTypeExt")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// URL of the Resource that is the focus (main) resource in a notification shape /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -1256,24 +1198,24 @@ public string Resource [DataMember] public List IncludeElement { - get { if(_IncludeElement==null) _IncludeElement = new List(); return _IncludeElement; } + get => _IncludeElement ?? new List(); set { _IncludeElement = value; OnPropertyChanged("IncludeElement"); } } - private List _IncludeElement; + private List? _IncludeElement; /// /// Include directives, rooted in the resource for this shape /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Include + public IEnumerable? Include { - get { return IncludeElement != null ? IncludeElement.Select(elem => elem.Value) : null; } + get => _IncludeElement?.Select(elem => elem.Value); set { if (value == null) - IncludeElement = null; + IncludeElement = null!; else IncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Include"); @@ -1288,24 +1230,24 @@ public IEnumerable Include [DataMember] public List RevIncludeElement { - get { if(_RevIncludeElement==null) _RevIncludeElement = new List(); return _RevIncludeElement; } + get => _RevIncludeElement ?? new List(); set { _RevIncludeElement = value; OnPropertyChanged("RevIncludeElement"); } } - private List _RevIncludeElement; + private List? _RevIncludeElement; /// /// Reverse include directives, rooted in the resource for this shape /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable RevInclude + public IEnumerable? RevInclude { - get { return RevIncludeElement != null ? RevIncludeElement.Select(elem => elem.Value) : null; } + get => _RevIncludeElement?.Select(elem => elem.Value); set { if (value == null) - RevIncludeElement = null; + RevIncludeElement = null!; else RevIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("RevInclude"); @@ -1314,17 +1256,13 @@ public IEnumerable RevInclude protected internal override void CopyToInternal(Base other) { - var dest = other as NotificationShapeComponent; - - if (dest == null) - { + if(other is not NotificationShapeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(IncludeElement.Any()) dest.IncludeElement = new List(IncludeElement.DeepCopyInternal()); - if(RevIncludeElement.Any()) dest.RevIncludeElement = new List(RevIncludeElement.DeepCopyInternal()); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_IncludeElement is not null) dest.IncludeElement = new List(_IncludeElement.DeepCopyInternal()); + if(_RevIncludeElement is not null) dest.RevIncludeElement = new List(_RevIncludeElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1336,48 +1274,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotificationShapeComponent; - if(otherT == null) return false; + if(other is not NotificationShapeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.ListEquals(IncludeElement, otherT.IncludeElement)) return false; - if(!comparer.ListEquals(RevIncludeElement, otherT.RevIncludeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.ListEquals(_IncludeElement, otherT._IncludeElement)) return false; + if(!comparer.ListEquals(_RevIncludeElement, otherT._RevIncludeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "include": - value = IncludeElement; - return IncludeElement?.Any() == true; + value = _IncludeElement; + return _IncludeElement?.Any() == true; case "revInclude": - value = RevIncludeElement; - return RevIncludeElement?.Any() == true; + value = _RevIncludeElement; + return _RevIncludeElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "include": - IncludeElement = (List)value; + IncludeElement = (List?)value!; return this; case "revInclude": - RevIncludeElement = (List)value; + RevIncludeElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1388,9 +1326,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (IncludeElement?.Any() == true) yield return new KeyValuePair("include",IncludeElement); - if (RevIncludeElement?.Any() == true) yield return new KeyValuePair("revInclude",RevIncludeElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_IncludeElement?.Any() == true) yield return new KeyValuePair("include",_IncludeElement); + if (_RevIncludeElement?.Any() == true) yield return new KeyValuePair("revInclude",_RevIncludeElement); } } @@ -1401,28 +1339,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this subscription topic definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1435,39 +1370,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the subscription topic. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the subscription topic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1477,28 +1409,25 @@ public string Version /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this subscription topic (Human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1511,24 +1440,24 @@ public string Title [DataMember] public List DerivedFromElement { - get { if(_DerivedFromElement==null) _DerivedFromElement = new List(); return _DerivedFromElement; } + get => _DerivedFromElement ?? new List(); set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private List _DerivedFromElement; + private List? _DerivedFromElement; /// /// Based on FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFrom + public IEnumerable? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Select(elem => elem.Value) : null; } + get => _DerivedFromElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromElement = null; + DerivedFromElement = null!; else DerivedFromElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFrom"); @@ -1543,13 +1472,13 @@ public IEnumerable DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1558,13 +1487,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1574,13 +1500,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, IsModifier=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// If for testing purposes, not real usage @@ -1589,13 +1515,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1605,28 +1528,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date status first applied /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1636,28 +1556,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.author")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// The name of the individual or organization that published the SubscriptionTopic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1670,39 +1587,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the SubscriptionTopic. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the SubscriptionTopic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1715,11 +1629,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction of the SubscriptionTopic (if applicable). @@ -1730,39 +1644,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this SubscriptionTopic is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this SubscriptionTopic is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1772,28 +1683,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1803,28 +1711,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=240)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When SubscriptionTopic is/was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1834,28 +1739,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=250)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// Date the Subscription Topic was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1865,13 +1767,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Definition of a resource-based trigger for the subscription topic. @@ -1881,11 +1783,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List ResourceTrigger { - get { if(_ResourceTrigger==null) _ResourceTrigger = new List(); return _ResourceTrigger; } + get => _ResourceTrigger ?? new List(); set { _ResourceTrigger = value; OnPropertyChanged("ResourceTrigger"); } } - private List _ResourceTrigger; + private List? _ResourceTrigger; /// /// Event definitions the SubscriptionTopic. @@ -1895,11 +1797,11 @@ public List ResourceT [DataMember] public List EventTrigger { - get { if(_EventTrigger==null) _EventTrigger = new List(); return _EventTrigger; } + get => _EventTrigger ?? new List(); set { _EventTrigger = value; OnPropertyChanged("EventTrigger"); } } - private List _EventTrigger; + private List? _EventTrigger; /// /// Properties by which a Subscription can filter notifications from the SubscriptionTopic. @@ -1909,11 +1811,11 @@ public List EventTrigger [DataMember] public List CanFilterBy { - get { if(_CanFilterBy==null) _CanFilterBy = new List(); return _CanFilterBy; } + get => _CanFilterBy ?? new List(); set { _CanFilterBy = value; OnPropertyChanged("CanFilterBy"); } } - private List _CanFilterBy; + private List? _CanFilterBy; /// /// Properties for describing the shape of notifications generated by this topic. @@ -1923,46 +1825,42 @@ public List CanFilterBy [DataMember] public List NotificationShape { - get { if(_NotificationShape==null) _NotificationShape = new List(); return _NotificationShape; } + get => _NotificationShape ?? new List(); set { _NotificationShape = value; OnPropertyChanged("NotificationShape"); } } - private List _NotificationShape; + private List? _NotificationShape; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SubscriptionTopic; - - if (dest == null) - { + if(other is not SubscriptionTopic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromElement.Any()) dest.DerivedFromElement = new List(DerivedFromElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(ResourceTrigger.Any()) dest.ResourceTrigger = new List(ResourceTrigger.DeepCopyInternal()); - if(EventTrigger.Any()) dest.EventTrigger = new List(EventTrigger.DeepCopyInternal()); - if(CanFilterBy.Any()) dest.CanFilterBy = new List(CanFilterBy.DeepCopyInternal()); - if(NotificationShape.Any()) dest.NotificationShape = new List(NotificationShape.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = new List(_DerivedFromElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_ResourceTrigger is not null) dest.ResourceTrigger = new List(_ResourceTrigger.DeepCopyInternal()); + if(_EventTrigger is not null) dest.EventTrigger = new List(_EventTrigger.DeepCopyInternal()); + if(_CanFilterBy is not null) dest.CanFilterBy = new List(_CanFilterBy.DeepCopyInternal()); + if(_NotificationShape is not null) dest.NotificationShape = new List(_NotificationShape.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1974,181 +1872,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubscriptionTopic; - if(otherT == null) return false; + if(other is not SubscriptionTopic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(ResourceTrigger, otherT.ResourceTrigger)) return false; - if(!comparer.ListEquals(EventTrigger, otherT.EventTrigger)) return false; - if(!comparer.ListEquals(CanFilterBy, otherT.CanFilterBy)) return false; - if(!comparer.ListEquals(NotificationShape, otherT.NotificationShape)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_ResourceTrigger, otherT._ResourceTrigger)) return false; + if(!comparer.ListEquals(_EventTrigger, otherT._EventTrigger)) return false; + if(!comparer.ListEquals(_CanFilterBy, otherT._CanFilterBy)) return false; + if(!comparer.ListEquals(_NotificationShape, otherT._NotificationShape)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement?.Any() == true; + value = _DerivedFromElement; + return _DerivedFromElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "resourceTrigger": - value = ResourceTrigger; - return ResourceTrigger?.Any() == true; + value = _ResourceTrigger; + return _ResourceTrigger?.Any() == true; case "eventTrigger": - value = EventTrigger; - return EventTrigger?.Any() == true; + value = _EventTrigger; + return _EventTrigger?.Any() == true; case "canFilterBy": - value = CanFilterBy; - return CanFilterBy?.Any() == true; + value = _CanFilterBy; + return _CanFilterBy?.Any() == true; case "notificationShape": - value = NotificationShape; - return NotificationShape?.Any() == true; + value = _NotificationShape; + return _NotificationShape?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (List)value; + DerivedFromElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "resourceTrigger": - ResourceTrigger = (List)value; + ResourceTrigger = (List?)value!; return this; case "eventTrigger": - EventTrigger = (List)value; + EventTrigger = (List?)value!; return this; case "canFilterBy": - CanFilterBy = (List)value; + CanFilterBy = (List?)value!; return this; case "notificationShape": - NotificationShape = (List)value; + NotificationShape = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2159,28 +2057,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (ResourceTrigger?.Any() == true) yield return new KeyValuePair("resourceTrigger",ResourceTrigger); - if (EventTrigger?.Any() == true) yield return new KeyValuePair("eventTrigger",EventTrigger); - if (CanFilterBy?.Any() == true) yield return new KeyValuePair("canFilterBy",CanFilterBy); - if (NotificationShape?.Any() == true) yield return new KeyValuePair("notificationShape",NotificationShape); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_ResourceTrigger?.Any() == true) yield return new KeyValuePair("resourceTrigger",_ResourceTrigger); + if (_EventTrigger?.Any() == true) yield return new KeyValuePair("eventTrigger",_EventTrigger); + if (_CanFilterBy?.Any() == true) yield return new KeyValuePair("canFilterBy",_CanFilterBy); + if (_NotificationShape?.Any() == true) yield return new KeyValuePair("notificationShape",_NotificationShape); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs index 6c092b281..ed14bf499 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -105,41 +108,38 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// When no longer valid to use. /// [FhirElement("expiry", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpiryElement + public Hl7.Fhir.Model.FhirDateTime? ExpiryElement { get { return _ExpiryElement; } set { _ExpiryElement = value; OnPropertyChanged("ExpiryElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpiryElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpiryElement; /// /// When no longer valid to use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expiry + public string? Expiry { - get { return ExpiryElement != null ? ExpiryElement.Value : null; } + get => _ExpiryElement?.Value; set { - if (value == null) - ExpiryElement = null; - else - ExpiryElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpiryElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Expiry"); } } @@ -149,27 +149,23 @@ public string Expiry /// [FhirElement("quantity", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(ExpiryElement != null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)ExpiryElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_ExpiryElement is not null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)_ExpiryElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -181,48 +177,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ExpiryElement, otherT.ExpiryElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "expiry": - value = ExpiryElement; - return ExpiryElement is not null; + value = _ExpiryElement; + return _ExpiryElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "expiry": - ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpiryElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -233,9 +229,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (ExpiryElement is not null) yield return new KeyValuePair("expiry",ExpiryElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_ExpiryElement is not null) yield return new KeyValuePair("expiry",_ExpiryElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -261,13 +257,13 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Ratio Quantity + public Hl7.Fhir.Model.Ratio? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Ratio _Quantity; + private Hl7.Fhir.Model.Ratio? _Quantity; /// /// A component of the substance. @@ -279,26 +275,22 @@ public Hl7.Fhir.Model.Ratio Quantity [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Substance + public Hl7.Fhir.Model.DataType? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.DataType _Substance; + private Hl7.Fhir.Model.DataType? _Substance; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Ratio)Quantity.DeepCopyInternal(); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.DataType)Substance.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Ratio)_Quantity.DeepCopyInternal(); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.DataType)_Substance.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -310,41 +302,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Substance, otherT._Substance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Ratio)value; + Quantity = (Hl7.Fhir.Model.Ratio?)value; return this; case "substance": - Substance = (Hl7.Fhir.Model.DataType)value; + Substance = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -355,8 +347,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Substance is not null) yield return new KeyValuePair("substance",Substance); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); } } @@ -369,11 +361,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -382,13 +374,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("FHIRSubstanceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -397,13 +389,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -417,11 +406,11 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What substance this is. @@ -430,41 +419,38 @@ public List Category [Binding("SubstanceCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Textual description of the substance, comments. /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the substance, comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -477,11 +463,11 @@ public string Description [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Composition information about the substance. @@ -491,31 +477,27 @@ public List Instance [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Substance; - - if (dest == null) - { + if(other is not Substance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -527,76 +509,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Substance; - if(otherT == null) return false; + if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -607,13 +589,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs index 1d3494c73..9420c2e6f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,54 +77,51 @@ public partial class MoietyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("role", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Identifier by which this moiety substance is known. /// [FhirElement("identifier", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Textual name for this moiety substance. /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Textual name for this moiety substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -132,13 +132,13 @@ public string Name [FhirElement("stereochemistry", InSummary=true, Order=70)] [Binding("SubstanceStereochemistry")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Stereochemistry + public Hl7.Fhir.Model.CodeableConcept? Stereochemistry { get { return _Stereochemistry; } set { _Stereochemistry = value; OnPropertyChanged("Stereochemistry"); } } - private Hl7.Fhir.Model.CodeableConcept _Stereochemistry; + private Hl7.Fhir.Model.CodeableConcept? _Stereochemistry; /// /// Optical activity type. @@ -146,41 +146,38 @@ public Hl7.Fhir.Model.CodeableConcept Stereochemistry [FhirElement("opticalActivity", InSummary=true, Order=80)] [Binding("SubstanceOpticalActivity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OpticalActivity + public Hl7.Fhir.Model.CodeableConcept? OpticalActivity { get { return _OpticalActivity; } set { _OpticalActivity = value; OnPropertyChanged("OpticalActivity"); } } - private Hl7.Fhir.Model.CodeableConcept _OpticalActivity; + private Hl7.Fhir.Model.CodeableConcept? _OpticalActivity; /// /// Molecular formula for this moiety (e.g. with the Hill system). /// [FhirElement("molecularFormula", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaElement { get { return _MolecularFormulaElement; } set { _MolecularFormulaElement = value; OnPropertyChanged("MolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaElement; /// /// Molecular formula for this moiety (e.g. with the Hill system) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormula + public string? MolecularFormula { - get { return MolecularFormulaElement != null ? MolecularFormulaElement.Value : null; } + get => _MolecularFormulaElement?.Value; set { - if (value == null) - MolecularFormulaElement = null; - else - MolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormula"); } } @@ -192,13 +189,13 @@ public string MolecularFormula [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// The measurement type of the quantitative value. @@ -206,32 +203,28 @@ public Hl7.Fhir.Model.DataType Amount [FhirElement("measurementType", InSummary=true, Order=110)] [Binding("SubstanceAmountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MeasurementType + public Hl7.Fhir.Model.CodeableConcept? MeasurementType { get { return _MeasurementType; } set { _MeasurementType = value; OnPropertyChanged("MeasurementType"); } } - private Hl7.Fhir.Model.CodeableConcept _MeasurementType; + private Hl7.Fhir.Model.CodeableConcept? _MeasurementType; protected internal override void CopyToInternal(Base other) { - var dest = other as MoietyComponent; - - if (dest == null) - { + if(other is not MoietyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Stereochemistry != null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)Stereochemistry.DeepCopyInternal(); - if(OpticalActivity != null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)OpticalActivity.DeepCopyInternal(); - if(MolecularFormulaElement != null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(MeasurementType != null) dest.MeasurementType = (Hl7.Fhir.Model.CodeableConcept)MeasurementType.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Stereochemistry is not null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)_Stereochemistry.DeepCopyInternal(); + if(_OpticalActivity is not null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)_OpticalActivity.DeepCopyInternal(); + if(_MolecularFormulaElement is not null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_MeasurementType is not null) dest.MeasurementType = (Hl7.Fhir.Model.CodeableConcept)_MeasurementType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -243,83 +236,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MoietyComponent; - if(otherT == null) return false; + if(other is not MoietyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Stereochemistry, otherT.Stereochemistry)) return false; - if(!comparer.Equals(OpticalActivity, otherT.OpticalActivity)) return false; - if(!comparer.Equals(MolecularFormulaElement, otherT.MolecularFormulaElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(MeasurementType, otherT.MeasurementType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; + if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_MeasurementType, otherT._MeasurementType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "stereochemistry": - value = Stereochemistry; - return Stereochemistry is not null; + value = _Stereochemistry; + return _Stereochemistry is not null; case "opticalActivity": - value = OpticalActivity; - return OpticalActivity is not null; + value = _OpticalActivity; + return _OpticalActivity is not null; case "molecularFormula": - value = MolecularFormulaElement; - return MolecularFormulaElement is not null; + value = _MolecularFormulaElement; + return _MolecularFormulaElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "measurementType": - value = MeasurementType; - return MeasurementType is not null; + value = _MeasurementType; + return _MeasurementType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "stereochemistry": - Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)value; + Stereochemistry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "opticalActivity": - OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)value; + OpticalActivity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "molecularFormula": - MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "measurementType": - MeasurementType = (Hl7.Fhir.Model.CodeableConcept)value; + MeasurementType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -330,14 +323,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",Stereochemistry); - if (OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",OpticalActivity); - if (MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",MolecularFormulaElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (MeasurementType is not null) yield return new KeyValuePair("measurementType",MeasurementType); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",_Stereochemistry); + if (_OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",_OpticalActivity); + if (_MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",_MolecularFormulaElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_MeasurementType is not null) yield return new KeyValuePair("measurementType",_MeasurementType); } } @@ -362,13 +355,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTCharacteristicCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the property. @@ -377,26 +370,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -408,41 +397,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -453,8 +442,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -481,13 +470,13 @@ public partial class MolecularWeightComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("method", InSummary=true, Order=40)] [Binding("SubstanceWeightMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of molecular weight e.g. exact, average, weight average. @@ -495,13 +484,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [FhirElement("type", InSummary=true, Order=50)] [Binding("SubstanceWeightType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Used to capture quantitative values for a variety of elements. @@ -509,27 +498,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("amount", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as MolecularWeightComponent; - - if (dest == null) - { + if(other is not MolecularWeightComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -541,48 +526,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MolecularWeightComponent; - if(otherT == null) return false; + if(other is not MolecularWeightComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -593,9 +578,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -619,13 +604,13 @@ public partial class StructureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("stereochemistry", InSummary=true, Order=40)] [Binding("SubstanceStereochemistry")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Stereochemistry + public Hl7.Fhir.Model.CodeableConcept? Stereochemistry { get { return _Stereochemistry; } set { _Stereochemistry = value; OnPropertyChanged("Stereochemistry"); } } - private Hl7.Fhir.Model.CodeableConcept _Stereochemistry; + private Hl7.Fhir.Model.CodeableConcept? _Stereochemistry; /// /// Optical activity type. @@ -633,41 +618,38 @@ public Hl7.Fhir.Model.CodeableConcept Stereochemistry [FhirElement("opticalActivity", InSummary=true, Order=50)] [Binding("SubstanceOpticalActivity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OpticalActivity + public Hl7.Fhir.Model.CodeableConcept? OpticalActivity { get { return _OpticalActivity; } set { _OpticalActivity = value; OnPropertyChanged("OpticalActivity"); } } - private Hl7.Fhir.Model.CodeableConcept _OpticalActivity; + private Hl7.Fhir.Model.CodeableConcept? _OpticalActivity; /// /// Molecular formula (e.g. using the Hill system). /// [FhirElement("molecularFormula", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaElement { get { return _MolecularFormulaElement; } set { _MolecularFormulaElement = value; OnPropertyChanged("MolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaElement; /// /// Molecular formula (e.g. using the Hill system) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormula + public string? MolecularFormula { - get { return MolecularFormulaElement != null ? MolecularFormulaElement.Value : null; } + get => _MolecularFormulaElement?.Value; set { - if (value == null) - MolecularFormulaElement = null; - else - MolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormula"); } } @@ -677,28 +659,25 @@ public string MolecularFormula /// [FhirElement("molecularFormulaByMoiety", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaByMoietyElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaByMoietyElement { get { return _MolecularFormulaByMoietyElement; } set { _MolecularFormulaByMoietyElement = value; OnPropertyChanged("MolecularFormulaByMoietyElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaByMoietyElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaByMoietyElement; /// /// Specified per moiety according to the Hill system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormulaByMoiety + public string? MolecularFormulaByMoiety { - get { return MolecularFormulaByMoietyElement != null ? MolecularFormulaByMoietyElement.Value : null; } + get => _MolecularFormulaByMoietyElement?.Value; set { - if (value == null) - MolecularFormulaByMoietyElement = null; - else - MolecularFormulaByMoietyElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaByMoietyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormulaByMoiety"); } } @@ -708,13 +687,13 @@ public string MolecularFormulaByMoiety /// [FhirElement("molecularWeight", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent MolecularWeight + public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent? MolecularWeight { get { return _MolecularWeight; } set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } - private Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent _MolecularWeight; + private Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent? _MolecularWeight; /// /// The method used to find the structure e.g. X-ray, NMR. @@ -725,11 +704,11 @@ public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent MolecularWeig [DataMember] public List Technique { - get { if(_Technique==null) _Technique = new List(); return _Technique; } + get => _Technique ?? new List(); set { _Technique = value; OnPropertyChanged("Technique"); } } - private List _Technique; + private List? _Technique; /// /// Source of information for the structure. @@ -741,11 +720,11 @@ public List Technique [DataMember] public List SourceDocument { - get { if(_SourceDocument==null) _SourceDocument = new List(); return _SourceDocument; } + get => _SourceDocument ?? new List(); set { _SourceDocument = value; OnPropertyChanged("SourceDocument"); } } - private List _SourceDocument; + private List? _SourceDocument; /// /// A depiction of the structure or characterization of the substance. @@ -755,30 +734,26 @@ public List SourceDocument [DataMember] public List Representation { - get { if(_Representation==null) _Representation = new List(); return _Representation; } + get => _Representation ?? new List(); set { _Representation = value; OnPropertyChanged("Representation"); } } - private List _Representation; + private List? _Representation; protected internal override void CopyToInternal(Base other) { - var dest = other as StructureComponent; - - if (dest == null) - { + if(other is not StructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Stereochemistry != null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)Stereochemistry.DeepCopyInternal(); - if(OpticalActivity != null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)OpticalActivity.DeepCopyInternal(); - if(MolecularFormulaElement != null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaElement.DeepCopyInternal(); - if(MolecularFormulaByMoietyElement != null) dest.MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaByMoietyElement.DeepCopyInternal(); - if(MolecularWeight != null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent)MolecularWeight.DeepCopyInternal(); - if(Technique.Any()) dest.Technique = new List(Technique.DeepCopyInternal()); - if(SourceDocument.Any()) dest.SourceDocument = new List(SourceDocument.DeepCopyInternal()); - if(Representation.Any()) dest.Representation = new List(Representation.DeepCopyInternal()); + if(_Stereochemistry is not null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)_Stereochemistry.DeepCopyInternal(); + if(_OpticalActivity is not null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)_OpticalActivity.DeepCopyInternal(); + if(_MolecularFormulaElement is not null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaElement.DeepCopyInternal(); + if(_MolecularFormulaByMoietyElement is not null) dest.MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaByMoietyElement.DeepCopyInternal(); + if(_MolecularWeight is not null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent)_MolecularWeight.DeepCopyInternal(); + if(_Technique is not null) dest.Technique = new List(_Technique.DeepCopyInternal()); + if(_SourceDocument is not null) dest.SourceDocument = new List(_SourceDocument.DeepCopyInternal()); + if(_Representation is not null) dest.Representation = new List(_Representation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -790,83 +765,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureComponent; - if(otherT == null) return false; + if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Stereochemistry, otherT.Stereochemistry)) return false; - if(!comparer.Equals(OpticalActivity, otherT.OpticalActivity)) return false; - if(!comparer.Equals(MolecularFormulaElement, otherT.MolecularFormulaElement)) return false; - if(!comparer.Equals(MolecularFormulaByMoietyElement, otherT.MolecularFormulaByMoietyElement)) return false; - if(!comparer.Equals(MolecularWeight, otherT.MolecularWeight)) return false; - if(!comparer.ListEquals(Technique, otherT.Technique)) return false; - if(!comparer.ListEquals(SourceDocument, otherT.SourceDocument)) return false; - if(!comparer.ListEquals(Representation, otherT.Representation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; + if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; + if(!comparer.Equals(_MolecularFormulaByMoietyElement, otherT._MolecularFormulaByMoietyElement)) return false; + if(!comparer.Equals(_MolecularWeight, otherT._MolecularWeight)) return false; + if(!comparer.ListEquals(_Technique, otherT._Technique)) return false; + if(!comparer.ListEquals(_SourceDocument, otherT._SourceDocument)) return false; + if(!comparer.ListEquals(_Representation, otherT._Representation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "stereochemistry": - value = Stereochemistry; - return Stereochemistry is not null; + value = _Stereochemistry; + return _Stereochemistry is not null; case "opticalActivity": - value = OpticalActivity; - return OpticalActivity is not null; + value = _OpticalActivity; + return _OpticalActivity is not null; case "molecularFormula": - value = MolecularFormulaElement; - return MolecularFormulaElement is not null; + value = _MolecularFormulaElement; + return _MolecularFormulaElement is not null; case "molecularFormulaByMoiety": - value = MolecularFormulaByMoietyElement; - return MolecularFormulaByMoietyElement is not null; + value = _MolecularFormulaByMoietyElement; + return _MolecularFormulaByMoietyElement is not null; case "molecularWeight": - value = MolecularWeight; - return MolecularWeight is not null; + value = _MolecularWeight; + return _MolecularWeight is not null; case "technique": - value = Technique; - return Technique?.Any() == true; + value = _Technique; + return _Technique?.Any() == true; case "sourceDocument": - value = SourceDocument; - return SourceDocument?.Any() == true; + value = _SourceDocument; + return _SourceDocument?.Any() == true; case "representation": - value = Representation; - return Representation?.Any() == true; + value = _Representation; + return _Representation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "stereochemistry": - Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)value; + Stereochemistry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "opticalActivity": - OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)value; + OpticalActivity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "molecularFormula": - MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "molecularFormulaByMoiety": - MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "molecularWeight": - MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent)value; + MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent?)value; return this; case "technique": - Technique = (List)value; + Technique = (List?)value!; return this; case "sourceDocument": - SourceDocument = (List)value; + SourceDocument = (List?)value!; return this; case "representation": - Representation = (List)value; + Representation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -877,14 +852,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",Stereochemistry); - if (OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",OpticalActivity); - if (MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",MolecularFormulaElement); - if (MolecularFormulaByMoietyElement is not null) yield return new KeyValuePair("molecularFormulaByMoiety",MolecularFormulaByMoietyElement); - if (MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",MolecularWeight); - if (Technique?.Any() == true) yield return new KeyValuePair("technique",Technique); - if (SourceDocument?.Any() == true) yield return new KeyValuePair("sourceDocument",SourceDocument); - if (Representation?.Any() == true) yield return new KeyValuePair("representation",Representation); + if (_Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",_Stereochemistry); + if (_OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",_OpticalActivity); + if (_MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",_MolecularFormulaElement); + if (_MolecularFormulaByMoietyElement is not null) yield return new KeyValuePair("molecularFormulaByMoiety",_MolecularFormulaByMoietyElement); + if (_MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",_MolecularWeight); + if (_Technique?.Any() == true) yield return new KeyValuePair("technique",_Technique); + if (_SourceDocument?.Any() == true) yield return new KeyValuePair("sourceDocument",_SourceDocument); + if (_Representation?.Any() == true) yield return new KeyValuePair("representation",_Representation); } } @@ -908,41 +883,38 @@ public partial class RepresentationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("SubstanceRepresentationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The structural representation or characterization as a text string in a standard format. /// [FhirElement("representation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RepresentationElement + public Hl7.Fhir.Model.FhirString? RepresentationElement { get { return _RepresentationElement; } set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } - private Hl7.Fhir.Model.FhirString _RepresentationElement; + private Hl7.Fhir.Model.FhirString? _RepresentationElement; /// /// The structural representation or characterization as a text string in a standard format /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Representation + public string? Representation { - get { return RepresentationElement != null ? RepresentationElement.Value : null; } + get => _RepresentationElement?.Value; set { - if (value == null) - RepresentationElement = null; - else - RepresentationElement = new Hl7.Fhir.Model.FhirString(value); + RepresentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Representation"); } } @@ -953,13 +925,13 @@ public string Representation [FhirElement("format", InSummary=true, Order=60)] [Binding("SubstanceRepresentationFormat")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Format + public Hl7.Fhir.Model.CodeableConcept? Format { get { return _Format; } set { _Format = value; OnPropertyChanged("Format"); } } - private Hl7.Fhir.Model.CodeableConcept _Format; + private Hl7.Fhir.Model.CodeableConcept? _Format; /// /// An attachment with the structural representation e.g. a structure graphic or AnIML file. @@ -968,28 +940,24 @@ public Hl7.Fhir.Model.CodeableConcept Format [CLSCompliant(false)] [References("DocumentReference")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Document + public Hl7.Fhir.Model.ResourceReference? Document { get { return _Document; } set { _Document = value; OnPropertyChanged("Document"); } } - private Hl7.Fhir.Model.ResourceReference _Document; + private Hl7.Fhir.Model.ResourceReference? _Document; protected internal override void CopyToInternal(Base other) { - var dest = other as RepresentationComponent; - - if (dest == null) - { + if(other is not RepresentationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RepresentationElement != null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)RepresentationElement.DeepCopyInternal(); - if(Format != null) dest.Format = (Hl7.Fhir.Model.CodeableConcept)Format.DeepCopyInternal(); - if(Document != null) dest.Document = (Hl7.Fhir.Model.ResourceReference)Document.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RepresentationElement is not null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)_RepresentationElement.DeepCopyInternal(); + if(_Format is not null) dest.Format = (Hl7.Fhir.Model.CodeableConcept)_Format.DeepCopyInternal(); + if(_Document is not null) dest.Document = (Hl7.Fhir.Model.ResourceReference)_Document.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1001,55 +969,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepresentationComponent; - if(otherT == null) return false; + if(other is not RepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RepresentationElement, otherT.RepresentationElement)) return false; - if(!comparer.Equals(Format, otherT.Format)) return false; - if(!comparer.Equals(Document, otherT.Document)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; + if(!comparer.Equals(_Format, otherT._Format)) return false; + if(!comparer.Equals(_Document, otherT._Document)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "representation": - value = RepresentationElement; - return RepresentationElement is not null; + value = _RepresentationElement; + return _RepresentationElement is not null; case "format": - value = Format; - return Format is not null; + value = _Format; + return _Format is not null; case "document": - value = Document; - return Document is not null; + value = _Document; + return _Document is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "representation": - RepresentationElement = (Hl7.Fhir.Model.FhirString)value; + RepresentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "format": - Format = (Hl7.Fhir.Model.CodeableConcept)value; + Format = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "document": - Document = (Hl7.Fhir.Model.ResourceReference)value; + Document = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1060,10 +1028,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RepresentationElement is not null) yield return new KeyValuePair("representation",RepresentationElement); - if (Format is not null) yield return new KeyValuePair("format",Format); - if (Document is not null) yield return new KeyValuePair("document",Document); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RepresentationElement is not null) yield return new KeyValuePair("representation",_RepresentationElement); + if (_Format is not null) yield return new KeyValuePair("format",_Format); + if (_Document is not null) yield return new KeyValuePair("document",_Document); } } @@ -1086,13 +1054,13 @@ public partial class CodeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Status of the code assignment, for example 'provisional', 'approved'. @@ -1100,41 +1068,38 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("status", InSummary=true, Order=50)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the code status was changed. /// [FhirElement("statusDate", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the code status was changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -1147,11 +1112,11 @@ public string StatusDate [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Supporting literature. @@ -1163,27 +1128,23 @@ public List Note [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as CodeComponent; - - if (dest == null) - { + if(other is not CodeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1195,62 +1156,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeComponent; - if(otherT == null) return false; + if(other is not CodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1261,11 +1222,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -1289,28 +1250,25 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The actual name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1321,13 +1279,13 @@ public string Name [FhirElement("type", InSummary=true, Order=50)] [Binding("SubstanceNameType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The status of the name e.g. 'current', 'proposed'. @@ -1335,26 +1293,26 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("status", InSummary=true, Order=60)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// If this is the preferred name for this substance. /// [FhirElement("preferred", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// If this is the preferred name for this substance @@ -1363,13 +1321,10 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } @@ -1383,11 +1338,11 @@ public bool? Preferred [DataMember] public List Language { - get { if(_Language==null) _Language = new List(); return _Language; } + get => _Language ?? new List(); set { _Language = value; OnPropertyChanged("Language"); } } - private List _Language; + private List? _Language; /// /// The use context of this name e.g. as an active ingredient or as a food colour additive. @@ -1398,11 +1353,11 @@ public List Language [DataMember] public List Domain { - get { if(_Domain==null) _Domain = new List(); return _Domain; } + get => _Domain ?? new List(); set { _Domain = value; OnPropertyChanged("Domain"); } } - private List _Domain; + private List? _Domain; /// /// The jurisdiction where this name applies. @@ -1413,11 +1368,11 @@ public List Domain [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// A synonym of this particular name, by which the substance is also known. @@ -1427,11 +1382,11 @@ public List Jurisdiction [DataMember] public List Synonym { - get { if(_Synonym==null) _Synonym = new List(); return _Synonym; } + get => _Synonym ?? new List(); set { _Synonym = value; OnPropertyChanged("Synonym"); } } - private List _Synonym; + private List? _Synonym; /// /// A translation for this name into another human language. @@ -1441,11 +1396,11 @@ public List Synonym [DataMember] public List Translation { - get { if(_Translation==null) _Translation = new List(); return _Translation; } + get => _Translation ?? new List(); set { _Translation = value; OnPropertyChanged("Translation"); } } - private List _Translation; + private List? _Translation; /// /// Details of the official nature of this name. @@ -1455,11 +1410,11 @@ public List Translation [DataMember] public List Official { - get { if(_Official==null) _Official = new List(); return _Official; } + get => _Official ?? new List(); set { _Official = value; OnPropertyChanged("Official"); } } - private List _Official; + private List? _Official; /// /// Supporting literature. @@ -1471,33 +1426,29 @@ public List Official [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); - if(Language.Any()) dest.Language = new List(Language.DeepCopyInternal()); - if(Domain.Any()) dest.Domain = new List(Domain.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Synonym.Any()) dest.Synonym = new List(Synonym.DeepCopyInternal()); - if(Translation.Any()) dest.Translation = new List(Translation.DeepCopyInternal()); - if(Official.Any()) dest.Official = new List(Official.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = new List(_Language.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = new List(_Domain.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Synonym is not null) dest.Synonym = new List(_Synonym.DeepCopyInternal()); + if(_Translation is not null) dest.Translation = new List(_Translation.DeepCopyInternal()); + if(_Official is not null) dest.Official = new List(_Official.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1509,104 +1460,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; - if(!comparer.ListEquals(Language, otherT.Language)) return false; - if(!comparer.ListEquals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Synonym, otherT.Synonym)) return false; - if(!comparer.ListEquals(Translation, otherT.Translation)) return false; - if(!comparer.ListEquals(Official, otherT.Official)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; + if(!comparer.ListEquals(_Language, otherT._Language)) return false; + if(!comparer.ListEquals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Synonym, otherT._Synonym)) return false; + if(!comparer.ListEquals(_Translation, otherT._Translation)) return false; + if(!comparer.ListEquals(_Official, otherT._Official)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; case "language": - value = Language; - return Language?.Any() == true; + value = _Language; + return _Language?.Any() == true; case "domain": - value = Domain; - return Domain?.Any() == true; + value = _Domain; + return _Domain?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "synonym": - value = Synonym; - return Synonym?.Any() == true; + value = _Synonym; + return _Synonym?.Any() == true; case "translation": - value = Translation; - return Translation?.Any() == true; + value = _Translation; + return _Translation?.Any() == true; case "official": - value = Official; - return Official?.Any() == true; + value = _Official; + return _Official?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "language": - Language = (List)value; + Language = (List?)value!; return this; case "domain": - Domain = (List)value; + Domain = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "synonym": - Synonym = (List)value; + Synonym = (List?)value!; return this; case "translation": - Translation = (List)value; + Translation = (List?)value!; return this; case "official": - Official = (List)value; + Official = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1617,17 +1568,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); - if (Language?.Any() == true) yield return new KeyValuePair("language",Language); - if (Domain?.Any() == true) yield return new KeyValuePair("domain",Domain); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Synonym?.Any() == true) yield return new KeyValuePair("synonym",Synonym); - if (Translation?.Any() == true) yield return new KeyValuePair("translation",Translation); - if (Official?.Any() == true) yield return new KeyValuePair("official",Official); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); + if (_Language?.Any() == true) yield return new KeyValuePair("language",_Language); + if (_Domain?.Any() == true) yield return new KeyValuePair("domain",_Domain); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Synonym?.Any() == true) yield return new KeyValuePair("synonym",_Synonym); + if (_Translation?.Any() == true) yield return new KeyValuePair("translation",_Translation); + if (_Official?.Any() == true) yield return new KeyValuePair("official",_Official); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -1651,13 +1602,13 @@ public partial class OfficialComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("authority", InSummary=true, Order=40)] [Binding("SubstanceNameAuthority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Authority + public Hl7.Fhir.Model.CodeableConcept? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.CodeableConcept _Authority; + private Hl7.Fhir.Model.CodeableConcept? _Authority; /// /// The status of the official name, for example 'draft', 'active'. @@ -1665,58 +1616,51 @@ public Hl7.Fhir.Model.CodeableConcept Authority [FhirElement("status", InSummary=true, Order=50)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Date of official name change. /// [FhirElement("date", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date of official name change /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OfficialComponent; - - if (dest == null) - { + if(other is not OfficialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.CodeableConcept)Authority.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.CodeableConcept)_Authority.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1728,48 +1672,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OfficialComponent; - if(otherT == null) return false; + if(other is not OfficialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authority": - Authority = (Hl7.Fhir.Model.CodeableConcept)value; + Authority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -1780,9 +1724,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); } } @@ -1811,13 +1755,13 @@ public partial class RelationshipComponent : Hl7.Fhir.Model.BackboneElement [References("SubstanceDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType SubstanceDefinition + public Hl7.Fhir.Model.DataType? SubstanceDefinition { get { return _SubstanceDefinition; } set { _SubstanceDefinition = value; OnPropertyChanged("SubstanceDefinition"); } } - private Hl7.Fhir.Model.DataType _SubstanceDefinition; + private Hl7.Fhir.Model.DataType? _SubstanceDefinition; /// /// For example "salt to parent", "active moiety". @@ -1826,26 +1770,26 @@ public Hl7.Fhir.Model.DataType SubstanceDefinition [Binding("SubstanceRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible relationships. /// [FhirElement("isDefining", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefiningElement + public Hl7.Fhir.Model.FhirBoolean? IsDefiningElement { get { return _IsDefiningElement; } set { _IsDefiningElement = value; OnPropertyChanged("IsDefiningElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefiningElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefiningElement; /// /// For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible relationships @@ -1854,13 +1798,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefiningElement [IgnoreDataMember] public bool? IsDefining { - get { return IsDefiningElement != null ? IsDefiningElement.Value : null; } + get => _IsDefiningElement?.Value; set { - if (value == null) - IsDefiningElement = null; - else - IsDefiningElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefiningElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefining"); } } @@ -1872,26 +1813,26 @@ public bool? IsDefining [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// For use when the numeric has an uncertain range. /// [FhirElement("ratioHighLimitAmount", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Ratio RatioHighLimitAmount + public Hl7.Fhir.Model.Ratio? RatioHighLimitAmount { get { return _RatioHighLimitAmount; } set { _RatioHighLimitAmount = value; OnPropertyChanged("RatioHighLimitAmount"); } } - private Hl7.Fhir.Model.Ratio _RatioHighLimitAmount; + private Hl7.Fhir.Model.Ratio? _RatioHighLimitAmount; /// /// An operator for the amount, for example "average", "approximately", "less than". @@ -1899,13 +1840,13 @@ public Hl7.Fhir.Model.Ratio RatioHighLimitAmount [FhirElement("comparator", InSummary=true, Order=90)] [Binding("SubstanceAmountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Comparator + public Hl7.Fhir.Model.CodeableConcept? Comparator { get { return _Comparator; } set { _Comparator = value; OnPropertyChanged("Comparator"); } } - private Hl7.Fhir.Model.CodeableConcept _Comparator; + private Hl7.Fhir.Model.CodeableConcept? _Comparator; /// /// Supporting literature. @@ -1917,29 +1858,25 @@ public Hl7.Fhir.Model.CodeableConcept Comparator [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as RelationshipComponent; - - if (dest == null) - { + if(other is not RelationshipComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubstanceDefinition != null) dest.SubstanceDefinition = (Hl7.Fhir.Model.DataType)SubstanceDefinition.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(IsDefiningElement != null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)IsDefiningElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(RatioHighLimitAmount != null) dest.RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio)RatioHighLimitAmount.DeepCopyInternal(); - if(Comparator != null) dest.Comparator = (Hl7.Fhir.Model.CodeableConcept)Comparator.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_SubstanceDefinition is not null) dest.SubstanceDefinition = (Hl7.Fhir.Model.DataType)_SubstanceDefinition.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_IsDefiningElement is not null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefiningElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_RatioHighLimitAmount is not null) dest.RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio)_RatioHighLimitAmount.DeepCopyInternal(); + if(_Comparator is not null) dest.Comparator = (Hl7.Fhir.Model.CodeableConcept)_Comparator.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1951,76 +1888,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelationshipComponent; - if(otherT == null) return false; + if(other is not RelationshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubstanceDefinition, otherT.SubstanceDefinition)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(IsDefiningElement, otherT.IsDefiningElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(RatioHighLimitAmount, otherT.RatioHighLimitAmount)) return false; - if(!comparer.Equals(Comparator, otherT.Comparator)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubstanceDefinition, otherT._SubstanceDefinition)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_RatioHighLimitAmount, otherT._RatioHighLimitAmount)) return false; + if(!comparer.Equals(_Comparator, otherT._Comparator)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substanceDefinition": - value = SubstanceDefinition; - return SubstanceDefinition is not null; + value = _SubstanceDefinition; + return _SubstanceDefinition is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "isDefining": - value = IsDefiningElement; - return IsDefiningElement is not null; + value = _IsDefiningElement; + return _IsDefiningElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "ratioHighLimitAmount": - value = RatioHighLimitAmount; - return RatioHighLimitAmount is not null; + value = _RatioHighLimitAmount; + return _RatioHighLimitAmount is not null; case "comparator": - value = Comparator; - return Comparator is not null; + value = _Comparator; + return _Comparator is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substanceDefinition": - SubstanceDefinition = (Hl7.Fhir.Model.DataType)value; + SubstanceDefinition = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "isDefining": - IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "ratioHighLimitAmount": - RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio)value; + RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio?)value; return this; case "comparator": - Comparator = (Hl7.Fhir.Model.CodeableConcept)value; + Comparator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2031,13 +1968,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubstanceDefinition is not null) yield return new KeyValuePair("substanceDefinition",SubstanceDefinition); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (IsDefiningElement is not null) yield return new KeyValuePair("isDefining",IsDefiningElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (RatioHighLimitAmount is not null) yield return new KeyValuePair("ratioHighLimitAmount",RatioHighLimitAmount); - if (Comparator is not null) yield return new KeyValuePair("comparator",Comparator); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_SubstanceDefinition is not null) yield return new KeyValuePair("substanceDefinition",_SubstanceDefinition); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_IsDefiningElement is not null) yield return new KeyValuePair("isDefining",_IsDefiningElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_RatioHighLimitAmount is not null) yield return new KeyValuePair("ratioHighLimitAmount",_RatioHighLimitAmount); + if (_Comparator is not null) yield return new KeyValuePair("comparator",_Comparator); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -2064,13 +2001,13 @@ public partial class SourceMaterialComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("SourceMaterialType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The genus of an organism e.g. the Latin epithet of the plant/animal scientific name. @@ -2078,13 +2015,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("genus", InSummary=true, Order=50)] [Binding("SourceMaterialGenus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Genus + public Hl7.Fhir.Model.CodeableConcept? Genus { get { return _Genus; } set { _Genus = value; OnPropertyChanged("Genus"); } } - private Hl7.Fhir.Model.CodeableConcept _Genus; + private Hl7.Fhir.Model.CodeableConcept? _Genus; /// /// The species of an organism e.g. the Latin epithet of the species of the plant/animal. @@ -2092,13 +2029,13 @@ public Hl7.Fhir.Model.CodeableConcept Genus [FhirElement("species", InSummary=true, Order=60)] [Binding("SourceMaterialSpecies")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Species + public Hl7.Fhir.Model.CodeableConcept? Species { get { return _Species; } set { _Species = value; OnPropertyChanged("Species"); } } - private Hl7.Fhir.Model.CodeableConcept _Species; + private Hl7.Fhir.Model.CodeableConcept? _Species; /// /// An anatomical origin of the source material within an organism. @@ -2106,13 +2043,13 @@ public Hl7.Fhir.Model.CodeableConcept Species [FhirElement("part", InSummary=true, Order=70)] [Binding("SourceMaterialPart")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Part + public Hl7.Fhir.Model.CodeableConcept? Part { get { return _Part; } set { _Part = value; OnPropertyChanged("Part"); } } - private Hl7.Fhir.Model.CodeableConcept _Part; + private Hl7.Fhir.Model.CodeableConcept? _Part; /// /// The country or countries where the material is harvested. @@ -2123,27 +2060,23 @@ public Hl7.Fhir.Model.CodeableConcept Part [DataMember] public List CountryOfOrigin { - get { if(_CountryOfOrigin==null) _CountryOfOrigin = new List(); return _CountryOfOrigin; } + get => _CountryOfOrigin ?? new List(); set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } - private List _CountryOfOrigin; + private List? _CountryOfOrigin; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceMaterialComponent; - - if (dest == null) - { + if(other is not SourceMaterialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Genus != null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)Genus.DeepCopyInternal(); - if(Species != null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)Species.DeepCopyInternal(); - if(Part != null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)Part.DeepCopyInternal(); - if(CountryOfOrigin.Any()) dest.CountryOfOrigin = new List(CountryOfOrigin.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Genus is not null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)_Genus.DeepCopyInternal(); + if(_Species is not null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)_Species.DeepCopyInternal(); + if(_Part is not null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)_Part.DeepCopyInternal(); + if(_CountryOfOrigin is not null) dest.CountryOfOrigin = new List(_CountryOfOrigin.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2155,62 +2088,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceMaterialComponent; - if(otherT == null) return false; + if(other is not SourceMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Genus, otherT.Genus)) return false; - if(!comparer.Equals(Species, otherT.Species)) return false; - if(!comparer.Equals(Part, otherT.Part)) return false; - if(!comparer.ListEquals(CountryOfOrigin, otherT.CountryOfOrigin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Genus, otherT._Genus)) return false; + if(!comparer.Equals(_Species, otherT._Species)) return false; + if(!comparer.Equals(_Part, otherT._Part)) return false; + if(!comparer.ListEquals(_CountryOfOrigin, otherT._CountryOfOrigin)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "genus": - value = Genus; - return Genus is not null; + value = _Genus; + return _Genus is not null; case "species": - value = Species; - return Species is not null; + value = _Species; + return _Species is not null; case "part": - value = Part; - return Part is not null; + value = _Part; + return _Part is not null; case "countryOfOrigin": - value = CountryOfOrigin; - return CountryOfOrigin?.Any() == true; + value = _CountryOfOrigin; + return _CountryOfOrigin?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genus": - Genus = (Hl7.Fhir.Model.CodeableConcept)value; + Genus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "species": - Species = (Hl7.Fhir.Model.CodeableConcept)value; + Species = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "part": - Part = (Hl7.Fhir.Model.CodeableConcept)value; + Part = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "countryOfOrigin": - CountryOfOrigin = (List)value; + CountryOfOrigin = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2221,11 +2154,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Genus is not null) yield return new KeyValuePair("genus",Genus); - if (Species is not null) yield return new KeyValuePair("species",Species); - if (Part is not null) yield return new KeyValuePair("part",Part); - if (CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",CountryOfOrigin); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Genus is not null) yield return new KeyValuePair("genus",_Genus); + if (_Species is not null) yield return new KeyValuePair("species",_Species); + if (_Part is not null) yield return new KeyValuePair("part",_Part); + if (_CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",_CountryOfOrigin); } } @@ -2238,39 +2171,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A business level version identifier of the substance. /// [FhirElement("version", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// A business level version identifier of the substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2281,13 +2211,13 @@ public string Version [FhirElement("status", InSummary=true, Order=110)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// A categorization, high level e.g. polymer or nucleic acid, or food, chemical, biological, or lower e.g. polymer linear or branch chain, or type of impurity. @@ -2297,11 +2227,11 @@ public Hl7.Fhir.Model.CodeableConcept Status [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// If the substance applies to human or veterinary use. @@ -2309,13 +2239,13 @@ public List Classification [FhirElement("domain", InSummary=true, Order=130)] [Binding("MedicinalProductType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Domain + public Hl7.Fhir.Model.CodeableConcept? Domain { get { return _Domain; } set { _Domain = value; OnPropertyChanged("Domain"); } } - private Hl7.Fhir.Model.CodeableConcept _Domain; + private Hl7.Fhir.Model.CodeableConcept? _Domain; /// /// The quality standard, established benchmark, to which substance complies (e.g. USP/NF, BP). @@ -2326,39 +2256,36 @@ public Hl7.Fhir.Model.CodeableConcept Domain [DataMember] public List Grade { - get { if(_Grade==null) _Grade = new List(); return _Grade; } + get => _Grade ?? new List(); set { _Grade = value; OnPropertyChanged("Grade"); } } - private List _Grade; + private List? _Grade; /// /// Textual description of the substance. /// [FhirElement("description", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description of the substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2373,11 +2300,11 @@ public string Description [DataMember] public List InformationSource { - get { if(_InformationSource==null) _InformationSource = new List(); return _InformationSource; } + get => _InformationSource ?? new List(); set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private List _InformationSource; + private List? _InformationSource; /// /// Textual comment about the substance's catalogue or registry record. @@ -2387,11 +2314,11 @@ public List InformationSource [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The entity that creates, makes, produces or fabricates the substance. @@ -2403,11 +2330,11 @@ public List Note [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// An entity that is the source for the substance. It may be different from the manufacturer. @@ -2419,11 +2346,11 @@ public List Manufacturer [DataMember] public List Supplier { - get { if(_Supplier==null) _Supplier = new List(); return _Supplier; } + get => _Supplier ?? new List(); set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private List _Supplier; + private List? _Supplier; /// /// Moiety, for structural modifications. @@ -2433,11 +2360,11 @@ public List Supplier [DataMember] public List Moiety { - get { if(_Moiety==null) _Moiety = new List(); return _Moiety; } + get => _Moiety ?? new List(); set { _Moiety = value; OnPropertyChanged("Moiety"); } } - private List _Moiety; + private List? _Moiety; /// /// General specifications for this substance. @@ -2447,11 +2374,11 @@ public List Moiety [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// The molecular weight or weight range. @@ -2461,24 +2388,24 @@ public List Property [DataMember] public List MolecularWeight { - get { if(_MolecularWeight==null) _MolecularWeight = new List(); return _MolecularWeight; } + get => _MolecularWeight ?? new List(); set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } - private List _MolecularWeight; + private List? _MolecularWeight; /// /// Structural information. /// [FhirElement("structure", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent Structure + public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent? Structure { get { return _Structure; } set { _Structure = value; OnPropertyChanged("Structure"); } } - private Hl7.Fhir.Model.SubstanceDefinition.StructureComponent _Structure; + private Hl7.Fhir.Model.SubstanceDefinition.StructureComponent? _Structure; /// /// Codes associated with the substance. @@ -2488,11 +2415,11 @@ public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent Structure [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Names applicable to this substance. @@ -2502,11 +2429,11 @@ public List Code [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A link between this substance and another. @@ -2516,56 +2443,52 @@ public List Name [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// Material or taxonomic/anatomical source. /// [FhirElement("sourceMaterial", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent SourceMaterial + public Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent? SourceMaterial { get { return _SourceMaterial; } set { _SourceMaterial = value; OnPropertyChanged("SourceMaterial"); } } - private Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent _SourceMaterial; + private Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent? _SourceMaterial; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceDefinition; - - if (dest == null) - { + if(other is not SubstanceDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(Domain != null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)Domain.DeepCopyInternal(); - if(Grade.Any()) dest.Grade = new List(Grade.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(InformationSource.Any()) dest.InformationSource = new List(InformationSource.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Supplier.Any()) dest.Supplier = new List(Supplier.DeepCopyInternal()); - if(Moiety.Any()) dest.Moiety = new List(Moiety.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(MolecularWeight.Any()) dest.MolecularWeight = new List(MolecularWeight.DeepCopyInternal()); - if(Structure != null) dest.Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent)Structure.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(SourceMaterial != null) dest.SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent)SourceMaterial.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)_Domain.DeepCopyInternal(); + if(_Grade is not null) dest.Grade = new List(_Grade.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = new List(_InformationSource.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Supplier is not null) dest.Supplier = new List(_Supplier.DeepCopyInternal()); + if(_Moiety is not null) dest.Moiety = new List(_Moiety.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_MolecularWeight is not null) dest.MolecularWeight = new List(_MolecularWeight.DeepCopyInternal()); + if(_Structure is not null) dest.Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent)_Structure.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_SourceMaterial is not null) dest.SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent)_SourceMaterial.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2577,160 +2500,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceDefinition; - if(otherT == null) return false; + if(other is not SubstanceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Grade, otherT.Grade)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Supplier, otherT.Supplier)) return false; - if(!comparer.ListEquals(Moiety, otherT.Moiety)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(MolecularWeight, otherT.MolecularWeight)) return false; - if(!comparer.Equals(Structure, otherT.Structure)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(SourceMaterial, otherT.SourceMaterial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Grade, otherT._Grade)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Supplier, otherT._Supplier)) return false; + if(!comparer.ListEquals(_Moiety, otherT._Moiety)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_MolecularWeight, otherT._MolecularWeight)) return false; + if(!comparer.Equals(_Structure, otherT._Structure)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_SourceMaterial, otherT._SourceMaterial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "domain": - value = Domain; - return Domain is not null; + value = _Domain; + return _Domain is not null; case "grade": - value = Grade; - return Grade?.Any() == true; + value = _Grade; + return _Grade?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "informationSource": - value = InformationSource; - return InformationSource?.Any() == true; + value = _InformationSource; + return _InformationSource?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "supplier": - value = Supplier; - return Supplier?.Any() == true; + value = _Supplier; + return _Supplier?.Any() == true; case "moiety": - value = Moiety; - return Moiety?.Any() == true; + value = _Moiety; + return _Moiety?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "molecularWeight": - value = MolecularWeight; - return MolecularWeight?.Any() == true; + value = _MolecularWeight; + return _MolecularWeight?.Any() == true; case "structure": - value = Structure; - return Structure is not null; + value = _Structure; + return _Structure is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "sourceMaterial": - value = SourceMaterial; - return SourceMaterial is not null; + value = _SourceMaterial; + return _SourceMaterial is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "domain": - Domain = (Hl7.Fhir.Model.CodeableConcept)value; + Domain = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "grade": - Grade = (List)value; + Grade = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "informationSource": - InformationSource = (List)value; + InformationSource = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "supplier": - Supplier = (List)value; + Supplier = (List?)value!; return this; case "moiety": - Moiety = (List)value; + Moiety = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "molecularWeight": - MolecularWeight = (List)value; + MolecularWeight = (List?)value!; return this; case "structure": - Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent)value; + Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "sourceMaterial": - SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent)value; + SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent?)value; return this; default: return base.SetValue(key, value); @@ -2741,25 +2664,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (Domain is not null) yield return new KeyValuePair("domain",Domain); - if (Grade?.Any() == true) yield return new KeyValuePair("grade",Grade); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",InformationSource); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Supplier?.Any() == true) yield return new KeyValuePair("supplier",Supplier); - if (Moiety?.Any() == true) yield return new KeyValuePair("moiety",Moiety); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (MolecularWeight?.Any() == true) yield return new KeyValuePair("molecularWeight",MolecularWeight); - if (Structure is not null) yield return new KeyValuePair("structure",Structure); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (SourceMaterial is not null) yield return new KeyValuePair("sourceMaterial",SourceMaterial); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_Domain is not null) yield return new KeyValuePair("domain",_Domain); + if (_Grade?.Any() == true) yield return new KeyValuePair("grade",_Grade); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",_InformationSource); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Supplier?.Any() == true) yield return new KeyValuePair("supplier",_Supplier); + if (_Moiety?.Any() == true) yield return new KeyValuePair("moiety",_Moiety); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_MolecularWeight?.Any() == true) yield return new KeyValuePair("molecularWeight",_MolecularWeight); + if (_Structure is not null) yield return new KeyValuePair("structure",_Structure); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_SourceMaterial is not null) yield return new KeyValuePair("sourceMaterial",_SourceMaterial); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs index 8c7141c65..6050fe5f3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -136,13 +139,13 @@ public partial class SuppliedItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Medication, Substance, or Device supplied. @@ -153,26 +156,22 @@ public Hl7.Fhir.Model.Quantity Quantity [References("Medication","Substance","Device")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as SuppliedItemComponent; - - if (dest == null) - { + if(other is not SuppliedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -184,41 +183,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuppliedItemComponent; - if(otherT == null) return false; + if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -229,8 +228,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -243,11 +242,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -259,11 +258,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -275,11 +274,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | completed | abandoned | entered-in-error. @@ -288,13 +287,13 @@ public List PartOf [DeclaredType(Type = typeof(Code))] [Binding("SupplyDeliveryStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | abandoned | entered-in-error @@ -303,13 +302,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -321,13 +317,13 @@ public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Category of dispense event. @@ -335,26 +331,26 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("type", Order=140)] [Binding("SupplyDeliveryType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The item that is delivered or supplied. /// [FhirElement("suppliedItem", Order=150)] [DataMember] - public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent SuppliedItem + public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent? SuppliedItem { get { return _SuppliedItem; } set { _SuppliedItem = value; OnPropertyChanged("SuppliedItem"); } } - private Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent _SuppliedItem; + private Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent? _SuppliedItem; /// /// When event occurred. @@ -363,13 +359,13 @@ public Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent SuppliedItem [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Dispenser. @@ -378,13 +374,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Supplier + public Hl7.Fhir.Model.ResourceReference? Supplier { get { return _Supplier; } set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private Hl7.Fhir.Model.ResourceReference _Supplier; + private Hl7.Fhir.Model.ResourceReference? _Supplier; /// /// Where the Supply was sent. @@ -393,13 +389,13 @@ public Hl7.Fhir.Model.ResourceReference Supplier [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who collected the Supply. @@ -411,35 +407,31 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyDelivery; - - if (dest == null) - { + if(other is not SupplyDelivery dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SuppliedItem != null) dest.SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)SuppliedItem.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Supplier != null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)Supplier.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SuppliedItem is not null) dest.SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)_SuppliedItem.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)_Supplier.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -451,104 +443,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyDelivery; - if(otherT == null) return false; + if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SuppliedItem, otherT.SuppliedItem)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Supplier, otherT.Supplier)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SuppliedItem, otherT._SuppliedItem)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "suppliedItem": - value = SuppliedItem; - return SuppliedItem is not null; + value = _SuppliedItem; + return _SuppliedItem is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "supplier": - value = Supplier; - return Supplier is not null; + value = _Supplier; + return _Supplier is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "suppliedItem": - SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent)value; + SuppliedItem = (Hl7.Fhir.Model.SupplyDelivery.SuppliedItemComponent?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "supplier": - Supplier = (Hl7.Fhir.Model.ResourceReference)value; + Supplier = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; default: return base.SetValue(key, value); @@ -559,17 +551,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SuppliedItem is not null) yield return new KeyValuePair("suppliedItem",SuppliedItem); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Supplier is not null) yield return new KeyValuePair("supplier",Supplier); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SuppliedItem is not null) yield return new KeyValuePair("suppliedItem",_SuppliedItem); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Supplier is not null) yield return new KeyValuePair("supplier",_Supplier); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs index 30490fb2a..78dc22050 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,13 +136,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40, FiveWs="FiveWs.what[x]")] [Binding("ParameterCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value of detail. @@ -148,26 +151,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirBoolean))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,41 +178,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -224,8 +223,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -238,11 +237,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | suspended +. @@ -251,13 +250,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("SupplyRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended + @@ -266,13 +265,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -283,13 +279,13 @@ public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status [FhirElement("category", InSummary=true, Order=110, FiveWs="FiveWs.class")] [Binding("SupplyRequestKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// routine | urgent | asap | stat. @@ -298,13 +294,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -313,13 +309,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -334,13 +327,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; /// /// The requested amount of the item indicated. @@ -348,13 +341,13 @@ public Hl7.Fhir.Model.DataType Item [FhirElement("quantity", InSummary=true, Order=140)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Ordered item details. @@ -364,11 +357,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// When the request should be fulfilled. @@ -377,41 +370,38 @@ public List Parameter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the request was made. /// [FhirElement("authoredOn", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -423,13 +413,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Who is intended to fulfill the request. @@ -441,11 +431,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List Supplier { - get { if(_Supplier==null) _Supplier = new List(); return _Supplier; } + get => _Supplier ?? new List(); set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private List _Supplier; + private List? _Supplier; /// /// The reason why the supply item was requested. @@ -456,11 +446,11 @@ public List Supplier [DataMember] public List ReasonCode { - get { if(_ReasonCode==null) _ReasonCode = new List(); return _ReasonCode; } + get => _ReasonCode ?? new List(); set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private List _ReasonCode; + private List? _ReasonCode; /// /// The reason why the supply item was requested. @@ -472,11 +462,11 @@ public List ReasonCode [DataMember] public List ReasonReference { - get { if(_ReasonReference==null) _ReasonReference = new List(); return _ReasonReference; } + get => _ReasonReference ?? new List(); set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private List _ReasonReference; + private List? _ReasonReference; /// /// The origin of the supply. @@ -485,13 +475,13 @@ public List ReasonReference [CLSCompliant(false)] [References("Organization","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverFrom + public Hl7.Fhir.Model.ResourceReference? DeliverFrom { get { return _DeliverFrom; } set { _DeliverFrom = value; OnPropertyChanged("DeliverFrom"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverFrom; + private Hl7.Fhir.Model.ResourceReference? _DeliverFrom; /// /// The destination of the supply. @@ -500,41 +490,37 @@ public Hl7.Fhir.Model.ResourceReference DeliverFrom [CLSCompliant(false)] [References("Organization","Location","Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverTo + public Hl7.Fhir.Model.ResourceReference? DeliverTo { get { return _DeliverTo; } set { _DeliverTo = value; OnPropertyChanged("DeliverTo"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverTo; + private Hl7.Fhir.Model.ResourceReference? _DeliverTo; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyRequest; - - if (dest == null) - { + if(other is not SupplyRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Supplier.Any()) dest.Supplier = new List(Supplier.DeepCopyInternal()); - if(ReasonCode.Any()) dest.ReasonCode = new List(ReasonCode.DeepCopyInternal()); - if(ReasonReference.Any()) dest.ReasonReference = new List(ReasonReference.DeepCopyInternal()); - if(DeliverFrom != null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)DeliverFrom.DeepCopyInternal(); - if(DeliverTo != null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)DeliverTo.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = new List(_Supplier.DeepCopyInternal()); + if(_ReasonCode is not null) dest.ReasonCode = new List(_ReasonCode.DeepCopyInternal()); + if(_ReasonReference is not null) dest.ReasonReference = new List(_ReasonReference.DeepCopyInternal()); + if(_DeliverFrom is not null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)_DeliverFrom.DeepCopyInternal(); + if(_DeliverTo is not null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)_DeliverTo.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -546,132 +532,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyRequest; - if(otherT == null) return false; + if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(Supplier, otherT.Supplier)) return false; - if(!comparer.ListEquals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.ListEquals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.Equals(DeliverFrom, otherT.DeliverFrom)) return false; - if(!comparer.Equals(DeliverTo, otherT.DeliverTo)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_Supplier, otherT._Supplier)) return false; + if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; + if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "supplier": - value = Supplier; - return Supplier?.Any() == true; + value = _Supplier; + return _Supplier?.Any() == true; case "reasonCode": - value = ReasonCode; - return ReasonCode?.Any() == true; + value = _ReasonCode; + return _ReasonCode?.Any() == true; case "reasonReference": - value = ReasonReference; - return ReasonReference?.Any() == true; + value = _ReasonReference; + return _ReasonReference?.Any() == true; case "deliverFrom": - value = DeliverFrom; - return DeliverFrom is not null; + value = _DeliverFrom; + return _DeliverFrom is not null; case "deliverTo": - value = DeliverTo; - return DeliverTo is not null; + value = _DeliverTo; + return _DeliverTo is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supplier": - Supplier = (List)value; + Supplier = (List?)value!; return this; case "reasonCode": - ReasonCode = (List)value; + ReasonCode = (List?)value!; return this; case "reasonReference": - ReasonReference = (List)value; + ReasonReference = (List?)value!; return this; case "deliverFrom": - DeliverFrom = (Hl7.Fhir.Model.ResourceReference)value; + DeliverFrom = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "deliverTo": - DeliverTo = (Hl7.Fhir.Model.ResourceReference)value; + DeliverTo = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -682,21 +668,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Supplier?.Any() == true) yield return new KeyValuePair("supplier",Supplier); - if (ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",ReasonReference); - if (DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",DeliverFrom); - if (DeliverTo is not null) yield return new KeyValuePair("deliverTo",DeliverTo); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Supplier?.Any() == true) yield return new KeyValuePair("supplier",_Supplier); + if (_ReasonCode?.Any() == true) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference?.Any() == true) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",_DeliverFrom); + if (_DeliverTo is not null) yield return new KeyValuePair("deliverTo",_DeliverTo); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Task.cs b/src/Hl7.Fhir.R4B/Model/Generated/Task.cs index 482caa11c..18db9c6da 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Task.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -223,13 +226,13 @@ public partial class RestrictionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("repetitions", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RepetitionsElement + public Hl7.Fhir.Model.PositiveInt? RepetitionsElement { get { return _RepetitionsElement; } set { _RepetitionsElement = value; OnPropertyChanged("RepetitionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _RepetitionsElement; + private Hl7.Fhir.Model.PositiveInt? _RepetitionsElement; /// /// How many times to repeat @@ -238,13 +241,10 @@ public Hl7.Fhir.Model.PositiveInt RepetitionsElement [IgnoreDataMember] public int? Repetitions { - get { return RepetitionsElement != null ? RepetitionsElement.Value : null; } + get => _RepetitionsElement?.Value; set { - if (value == null) - RepetitionsElement = null; - else - RepetitionsElement = new Hl7.Fhir.Model.PositiveInt(value); + RepetitionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Repetitions"); } } @@ -254,13 +254,13 @@ public int? Repetitions /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// For whom is fulfillment sought?. @@ -272,25 +272,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; protected internal override void CopyToInternal(Base other) { - var dest = other as RestrictionComponent; - - if (dest == null) - { + if(other is not RestrictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RepetitionsElement != null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)RepetitionsElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); + if(_RepetitionsElement is not null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)_RepetitionsElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -302,48 +298,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RestrictionComponent; - if(otherT == null) return false; + if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RepetitionsElement, otherT.RepetitionsElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "repetitions": - value = RepetitionsElement; - return RepetitionsElement is not null; + value = _RepetitionsElement; + return _RepetitionsElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "repetitions": - RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)value; + RepetitionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -354,9 +350,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RepetitionsElement is not null) yield return new KeyValuePair("repetitions",RepetitionsElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); + if (_RepetitionsElement is not null) yield return new KeyValuePair("repetitions",_RepetitionsElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); } } @@ -384,13 +380,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskInputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Content to use in performing the task. @@ -400,26 +396,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.Contributor),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -431,41 +423,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -476,8 +468,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -505,13 +497,13 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskOutputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Result of output. @@ -521,26 +513,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.Contributor),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -552,41 +540,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -597,8 +585,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -611,39 +599,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Formal definition of task. /// [FhirElement("instantiatesCanonical", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical InstantiatesCanonicalElement + public Hl7.Fhir.Model.Canonical? InstantiatesCanonicalElement { get { return _InstantiatesCanonicalElement; } set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _InstantiatesCanonicalElement; + private Hl7.Fhir.Model.Canonical? _InstantiatesCanonicalElement; /// /// Formal definition of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesCanonical + public string? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Value : null; } + get => _InstantiatesCanonicalElement?.Value; set { - if (value == null) - InstantiatesCanonicalElement = null; - else - InstantiatesCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + InstantiatesCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InstantiatesCanonical"); } } @@ -653,28 +638,25 @@ public string InstantiatesCanonical /// [FhirElement("instantiatesUri", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// Formal definition of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -689,24 +671,24 @@ public string InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Requisition or grouper id. /// [FhirElement("groupIdentifier", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// Composite task. @@ -718,11 +700,11 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | requested | received | accepted | +. @@ -732,13 +714,13 @@ public List PartOf [Binding("TaskStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | requested | received | accepted | + @@ -747,13 +729,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Task.TaskStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -764,13 +743,13 @@ public Hl7.Fhir.Model.Task.TaskStatus? Status [FhirElement("statusReason", InSummary=true, Order=160)] [Binding("TaskStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// E.g. "Specimen collected", "IV prepped". @@ -778,13 +757,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [FhirElement("businessStatus", InSummary=true, Order=170)] [Binding("TaskBusinessStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BusinessStatus + public Hl7.Fhir.Model.CodeableConcept? BusinessStatus { get { return _BusinessStatus; } set { _BusinessStatus = value; OnPropertyChanged("BusinessStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _BusinessStatus; + private Hl7.Fhir.Model.CodeableConcept? _BusinessStatus; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option. @@ -794,13 +773,13 @@ public Hl7.Fhir.Model.CodeableConcept BusinessStatus [Binding("TaskIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option @@ -809,13 +788,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.Task.TaskIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -827,13 +803,13 @@ public Hl7.Fhir.Model.Task.TaskIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("TaskPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -842,13 +818,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -859,41 +832,38 @@ public Hl7.Fhir.Model.RequestPriority? Priority [FhirElement("code", InSummary=true, Order=200, FiveWs="FiveWs.what[x]")] [Binding("TaskCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Human-readable explanation of task. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable explanation of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -905,13 +875,13 @@ public string Description [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Beneficiary of the Task. @@ -920,13 +890,13 @@ public Hl7.Fhir.Model.ResourceReference Focus [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference For + public Hl7.Fhir.Model.ResourceReference? For { get { return _For; } set { _For = value; OnPropertyChanged("For"); } } - private Hl7.Fhir.Model.ResourceReference _For; + private Hl7.Fhir.Model.ResourceReference? _For; /// /// Healthcare event during which this task originated. @@ -935,54 +905,51 @@ public Hl7.Fhir.Model.ResourceReference For [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Start and end time of execution. /// [FhirElement("executionPeriod", InSummary=true, Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ExecutionPeriod + public Hl7.Fhir.Model.Period? ExecutionPeriod { get { return _ExecutionPeriod; } set { _ExecutionPeriod = value; OnPropertyChanged("ExecutionPeriod"); } } - private Hl7.Fhir.Model.Period _ExecutionPeriod; + private Hl7.Fhir.Model.Period? _ExecutionPeriod; /// /// Task Creation Date. /// [FhirElement("authoredOn", Order=260, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Task Creation Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -992,28 +959,25 @@ public string AuthoredOn /// [FhirElement("lastModified", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastModifiedElement + public Hl7.Fhir.Model.FhirDateTime? LastModifiedElement { get { return _LastModifiedElement; } set { _LastModifiedElement = value; OnPropertyChanged("LastModifiedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastModifiedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastModifiedElement; /// /// Task Last Modified Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastModified + public string? LastModified { - get { return LastModifiedElement != null ? LastModifiedElement.Value : null; } + get => _LastModifiedElement?.Value; set { - if (value == null) - LastModifiedElement = null; - else - LastModifiedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastModifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastModified"); } } @@ -1025,13 +989,13 @@ public string LastModified [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Requested performer. @@ -1042,11 +1006,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List PerformerType { - get { if(_PerformerType==null) _PerformerType = new List(); return _PerformerType; } + get => _PerformerType ?? new List(); set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private List _PerformerType; + private List? _PerformerType; /// /// Responsible individual. @@ -1055,13 +1019,13 @@ public List PerformerType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","HealthcareService","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Where task occurs. @@ -1070,13 +1034,13 @@ public Hl7.Fhir.Model.ResourceReference Owner [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Why task is needed. @@ -1084,13 +1048,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("reasonCode", Order=320, FiveWs="FiveWs.why[x]")] [Binding("TaskReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReasonCode + public Hl7.Fhir.Model.CodeableConcept? ReasonCode { get { return _ReasonCode; } set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } - private Hl7.Fhir.Model.CodeableConcept _ReasonCode; + private Hl7.Fhir.Model.CodeableConcept? _ReasonCode; /// /// Why task is needed. @@ -1099,13 +1063,13 @@ public Hl7.Fhir.Model.CodeableConcept ReasonCode [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReasonReference + public Hl7.Fhir.Model.ResourceReference? ReasonReference { get { return _ReasonReference; } set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } - private Hl7.Fhir.Model.ResourceReference _ReasonReference; + private Hl7.Fhir.Model.ResourceReference? _ReasonReference; /// /// Associated insurance coverage. @@ -1117,11 +1081,11 @@ public Hl7.Fhir.Model.ResourceReference ReasonReference [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Comments made about the task. @@ -1131,11 +1095,11 @@ public List Insurance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Key events in history of the Task. @@ -1147,24 +1111,24 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Constraints on fulfillment tasks. /// [FhirElement("restriction", Order=370)] [DataMember] - public Hl7.Fhir.Model.Task.RestrictionComponent Restriction + public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction { get { return _Restriction; } set { _Restriction = value; OnPropertyChanged("Restriction"); } } - private Hl7.Fhir.Model.Task.RestrictionComponent _Restriction; + private Hl7.Fhir.Model.Task.RestrictionComponent? _Restriction; /// /// Information used to perform task. @@ -1174,11 +1138,11 @@ public Hl7.Fhir.Model.Task.RestrictionComponent Restriction [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Information produced as part of task. @@ -1188,55 +1152,51 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Task; - - if (dest == null) - { + if(other is not Task dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)InstantiatesCanonicalElement.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(BusinessStatus != null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)BusinessStatus.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(For != null) dest.For = (Hl7.Fhir.Model.ResourceReference)For.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(ExecutionPeriod != null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)ExecutionPeriod.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(LastModifiedElement != null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)LastModifiedElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType.Any()) dest.PerformerType = new List(PerformerType.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ReasonCode != null) dest.ReasonCode = (Hl7.Fhir.Model.CodeableConcept)ReasonCode.DeepCopyInternal(); - if(ReasonReference != null) dest.ReasonReference = (Hl7.Fhir.Model.ResourceReference)ReasonReference.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Restriction != null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)Restriction.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)_InstantiatesCanonicalElement.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_BusinessStatus is not null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)_BusinessStatus.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_For is not null) dest.For = (Hl7.Fhir.Model.ResourceReference)_For.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_ExecutionPeriod is not null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)_ExecutionPeriod.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_LastModifiedElement is not null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)_LastModifiedElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = new List(_PerformerType.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ReasonCode is not null) dest.ReasonCode = (Hl7.Fhir.Model.CodeableConcept)_ReasonCode.DeepCopyInternal(); + if(_ReasonReference is not null) dest.ReasonReference = (Hl7.Fhir.Model.ResourceReference)_ReasonReference.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Restriction is not null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)_Restriction.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1248,244 +1208,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Task; - if(otherT == null) return false; + if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(BusinessStatus, otherT.BusinessStatus)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(For, otherT.For)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(ExecutionPeriod, otherT.ExecutionPeriod)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(LastModifiedElement, otherT.LastModifiedElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(ReasonCode, otherT.ReasonCode)) return false; - if(!comparer.Equals(ReasonReference, otherT.ReasonReference)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.Equals(Restriction, otherT.Restriction)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_BusinessStatus, otherT._BusinessStatus)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_For, otherT._For)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_ExecutionPeriod, otherT._ExecutionPeriod)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_ReasonCode, otherT._ReasonCode)) return false; + if(!comparer.Equals(_ReasonReference, otherT._ReasonReference)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement is not null; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "businessStatus": - value = BusinessStatus; - return BusinessStatus is not null; + value = _BusinessStatus; + return _BusinessStatus is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "for": - value = For; - return For is not null; + value = _For; + return _For is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "executionPeriod": - value = ExecutionPeriod; - return ExecutionPeriod is not null; + value = _ExecutionPeriod; + return _ExecutionPeriod is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "lastModified": - value = LastModifiedElement; - return LastModifiedElement is not null; + value = _LastModifiedElement; + return _LastModifiedElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType?.Any() == true; + value = _PerformerType; + return _PerformerType?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reasonCode": - value = ReasonCode; - return ReasonCode is not null; + value = _ReasonCode; + return _ReasonCode is not null; case "reasonReference": - value = ReasonReference; - return ReasonReference is not null; + value = _ReasonReference; + return _ReasonReference is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "restriction": - value = Restriction; - return Restriction is not null; + value = _Restriction; + return _Restriction is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "businessStatus": - BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)value; + BusinessStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "for": - For = (Hl7.Fhir.Model.ResourceReference)value; + For = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "executionPeriod": - ExecutionPeriod = (Hl7.Fhir.Model.Period)value; + ExecutionPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastModified": - LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (List)value; + PerformerType = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reasonCode": - ReasonCode = (Hl7.Fhir.Model.CodeableConcept)value; + ReasonCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reasonReference": - ReasonReference = (Hl7.Fhir.Model.ResourceReference)value; + ReasonReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "restriction": - Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)value; + Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1496,37 +1456,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (BusinessStatus is not null) yield return new KeyValuePair("businessStatus",BusinessStatus); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (For is not null) yield return new KeyValuePair("for",For); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",ExecutionPeriod); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (LastModifiedElement is not null) yield return new KeyValuePair("lastModified",LastModifiedElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType?.Any() == true) yield return new KeyValuePair("performerType",PerformerType); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ReasonCode is not null) yield return new KeyValuePair("reasonCode",ReasonCode); - if (ReasonReference is not null) yield return new KeyValuePair("reasonReference",ReasonReference); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Restriction is not null) yield return new KeyValuePair("restriction",Restriction); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_BusinessStatus is not null) yield return new KeyValuePair("businessStatus",_BusinessStatus); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_For is not null) yield return new KeyValuePair("for",_For); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",_ExecutionPeriod); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_LastModifiedElement is not null) yield return new KeyValuePair("lastModified",_LastModifiedElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType?.Any() == true) yield return new KeyValuePair("performerType",_PerformerType); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ReasonCode is not null) yield return new KeyValuePair("reasonCode",_ReasonCode); + if (_ReasonReference is not null) yield return new KeyValuePair("reasonReference",_ReasonReference); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Restriction is not null) yield return new KeyValuePair("restriction",_Restriction); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs index 0a0b805db..d61089c09 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -103,28 +106,25 @@ public partial class SoftwareComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name the software is known by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -134,44 +134,37 @@ public string Name /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version covered by this statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SoftwareComponent; - - if (dest == null) - { + if(other is not SoftwareComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -183,41 +176,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SoftwareComponent; - if(otherT == null) return false; + if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -228,8 +221,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -256,28 +249,25 @@ public partial class ImplementationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Describes this specific instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -287,44 +277,37 @@ public string Description /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// Base URL for the implementation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationComponent; - - if (dest == null) - { + if(other is not ImplementationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -336,41 +319,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationComponent; - if(otherT == null) return false; + if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -381,8 +364,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -409,28 +392,25 @@ public partial class CodeSystemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("uri", Order=40)] [DataMember] - public Hl7.Fhir.Model.Canonical UriElement + public Hl7.Fhir.Model.Canonical? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.Canonical _UriElement; + private Hl7.Fhir.Model.Canonical? _UriElement; /// /// URI for the Code System /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.Canonical(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Uri"); } } @@ -443,24 +423,24 @@ public string Uri [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// Whether subsumption is supported. /// [FhirElement("subsumption", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SubsumptionElement + public Hl7.Fhir.Model.FhirBoolean? SubsumptionElement { get { return _SubsumptionElement; } set { _SubsumptionElement = value; OnPropertyChanged("SubsumptionElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SubsumptionElement; + private Hl7.Fhir.Model.FhirBoolean? _SubsumptionElement; /// /// Whether subsumption is supported @@ -469,30 +449,23 @@ public Hl7.Fhir.Model.FhirBoolean SubsumptionElement [IgnoreDataMember] public bool? Subsumption { - get { return SubsumptionElement != null ? SubsumptionElement.Value : null; } + get => _SubsumptionElement?.Value; set { - if (value == null) - SubsumptionElement = null; - else - SubsumptionElement = new Hl7.Fhir.Model.FhirBoolean(value); + SubsumptionElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Subsumption"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CodeSystemComponent; - - if (dest == null) - { + if(other is not CodeSystemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.Canonical)UriElement.DeepCopyInternal(); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(SubsumptionElement != null) dest.SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)SubsumptionElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.Canonical)_UriElement.DeepCopyInternal(); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_SubsumptionElement is not null) dest.SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)_SubsumptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -504,48 +477,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeSystemComponent; - if(otherT == null) return false; + if(other is not CodeSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.Equals(SubsumptionElement, otherT.SubsumptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.Equals(_SubsumptionElement, otherT._SubsumptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "subsumption": - value = SubsumptionElement; - return SubsumptionElement is not null; + value = _SubsumptionElement; + return _SubsumptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uri": - UriElement = (Hl7.Fhir.Model.Canonical)value; + UriElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "subsumption": - SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)value; + SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -556,9 +529,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (SubsumptionElement is not null) yield return new KeyValuePair("subsumption",SubsumptionElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_SubsumptionElement is not null) yield return new KeyValuePair("subsumption",_SubsumptionElement); } } @@ -585,28 +558,25 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString CodeElement + public Hl7.Fhir.Model.FhirString? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.FhirString _CodeElement; + private Hl7.Fhir.Model.FhirString? _CodeElement; /// /// Version identifier for this version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.FhirString(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Code"); } } @@ -616,13 +586,13 @@ public string Code /// [FhirElement("isDefault", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefaultElement + public Hl7.Fhir.Model.FhirBoolean? IsDefaultElement { get { return _IsDefaultElement; } set { _IsDefaultElement = value; OnPropertyChanged("IsDefaultElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefaultElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefaultElement; /// /// If this is the default version for this code system @@ -631,13 +601,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefaultElement [IgnoreDataMember] public bool? IsDefault { - get { return IsDefaultElement != null ? IsDefaultElement.Value : null; } + get => _IsDefaultElement?.Value; set { - if (value == null) - IsDefaultElement = null; - else - IsDefaultElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefaultElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefault"); } } @@ -647,13 +614,13 @@ public bool? IsDefault /// [FhirElement("compositional", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CompositionalElement + public Hl7.Fhir.Model.FhirBoolean? CompositionalElement { get { return _CompositionalElement; } set { _CompositionalElement = value; OnPropertyChanged("CompositionalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CompositionalElement; + private Hl7.Fhir.Model.FhirBoolean? _CompositionalElement; /// /// If compositional grammar is supported @@ -662,13 +629,10 @@ public Hl7.Fhir.Model.FhirBoolean CompositionalElement [IgnoreDataMember] public bool? Compositional { - get { return CompositionalElement != null ? CompositionalElement.Value : null; } + get => _CompositionalElement?.Value; set { - if (value == null) - CompositionalElement = null; - else - CompositionalElement = new Hl7.Fhir.Model.FhirBoolean(value); + CompositionalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Compositional"); } } @@ -681,24 +645,24 @@ public bool? Compositional [DataMember] public List LanguageElement { - get { if(_LanguageElement==null) _LanguageElement = new List(); return _LanguageElement; } + get => _LanguageElement ?? new List(); set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private List _LanguageElement; + private List? _LanguageElement; /// /// Language Displays supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Language + public IEnumerable? Language { - get { return LanguageElement != null ? LanguageElement.Select(elem => elem.Value) : null; } + get => _LanguageElement?.Select(elem => elem.Value); set { if (value == null) - LanguageElement = null; + LanguageElement = null!; else LanguageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Language"); @@ -713,11 +677,11 @@ public IEnumerable Language [DataMember] public List Filter { - get { if(_Filter==null) _Filter = new List(); return _Filter; } + get => _Filter ?? new List(); set { _Filter = value; OnPropertyChanged("Filter"); } } - private List _Filter; + private List? _Filter; /// /// Properties supported for $lookup. @@ -727,24 +691,24 @@ public List Filter [DataMember] public List PropertyElement { - get { if(_PropertyElement==null) _PropertyElement = new List(); return _PropertyElement; } + get => _PropertyElement ?? new List(); set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private List _PropertyElement; + private List? _PropertyElement; /// /// Properties supported for $lookup /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Property + public IEnumerable? Property { - get { return PropertyElement != null ? PropertyElement.Select(elem => elem.Value) : null; } + get => _PropertyElement?.Select(elem => elem.Value); set { if (value == null) - PropertyElement = null; + PropertyElement = null!; else PropertyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Property"); @@ -753,20 +717,16 @@ public IEnumerable Property protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)CodeElement.DeepCopyInternal(); - if(IsDefaultElement != null) dest.IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)IsDefaultElement.DeepCopyInternal(); - if(CompositionalElement != null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)CompositionalElement.DeepCopyInternal(); - if(LanguageElement.Any()) dest.LanguageElement = new List(LanguageElement.DeepCopyInternal()); - if(Filter.Any()) dest.Filter = new List(Filter.DeepCopyInternal()); - if(PropertyElement.Any()) dest.PropertyElement = new List(PropertyElement.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)_CodeElement.DeepCopyInternal(); + if(_IsDefaultElement is not null) dest.IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefaultElement.DeepCopyInternal(); + if(_CompositionalElement is not null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)_CompositionalElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = new List(_LanguageElement.DeepCopyInternal()); + if(_Filter is not null) dest.Filter = new List(_Filter.DeepCopyInternal()); + if(_PropertyElement is not null) dest.PropertyElement = new List(_PropertyElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -778,69 +738,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(IsDefaultElement, otherT.IsDefaultElement)) return false; - if(!comparer.Equals(CompositionalElement, otherT.CompositionalElement)) return false; - if(!comparer.ListEquals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.ListEquals(Filter, otherT.Filter)) return false; - if(!comparer.ListEquals(PropertyElement, otherT.PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_IsDefaultElement, otherT._IsDefaultElement)) return false; + if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; + if(!comparer.ListEquals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; + if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "isDefault": - value = IsDefaultElement; - return IsDefaultElement is not null; + value = _IsDefaultElement; + return _IsDefaultElement is not null; case "compositional": - value = CompositionalElement; - return CompositionalElement is not null; + value = _CompositionalElement; + return _CompositionalElement is not null; case "language": - value = LanguageElement; - return LanguageElement?.Any() == true; + value = _LanguageElement; + return _LanguageElement?.Any() == true; case "filter": - value = Filter; - return Filter?.Any() == true; + value = _Filter; + return _Filter?.Any() == true; case "property": - value = PropertyElement; - return PropertyElement?.Any() == true; + value = _PropertyElement; + return _PropertyElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.FhirString)value; + CodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "isDefault": - IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "compositional": - CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)value; + CompositionalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "language": - LanguageElement = (List)value; + LanguageElement = (List?)value!; return this; case "filter": - Filter = (List)value; + Filter = (List?)value!; return this; case "property": - PropertyElement = (List)value; + PropertyElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -851,12 +811,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (IsDefaultElement is not null) yield return new KeyValuePair("isDefault",IsDefaultElement); - if (CompositionalElement is not null) yield return new KeyValuePair("compositional",CompositionalElement); - if (LanguageElement?.Any() == true) yield return new KeyValuePair("language",LanguageElement); - if (Filter?.Any() == true) yield return new KeyValuePair("filter",Filter); - if (PropertyElement?.Any() == true) yield return new KeyValuePair("property",PropertyElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_IsDefaultElement is not null) yield return new KeyValuePair("isDefault",_IsDefaultElement); + if (_CompositionalElement is not null) yield return new KeyValuePair("compositional",_CompositionalElement); + if (_LanguageElement?.Any() == true) yield return new KeyValuePair("language",_LanguageElement); + if (_Filter?.Any() == true) yield return new KeyValuePair("filter",_Filter); + if (_PropertyElement?.Any() == true) yield return new KeyValuePair("property",_PropertyElement); } } @@ -880,28 +840,25 @@ public partial class FilterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code of the property supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -914,24 +871,24 @@ public string Code [DataMember] public List OpElement { - get { if(_OpElement==null) _OpElement = new List(); return _OpElement; } + get => _OpElement ?? new List(); set { _OpElement = value; OnPropertyChanged("OpElement"); } } - private List _OpElement; + private List? _OpElement; /// /// Operations supported for the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Op + public IEnumerable? Op { - get { return OpElement != null ? OpElement.Select(elem => elem.Value) : null; } + get => _OpElement?.Select(elem => elem.Value); set { if (value == null) - OpElement = null; + OpElement = null!; else OpElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Op"); @@ -940,16 +897,12 @@ public IEnumerable Op protected internal override void CopyToInternal(Base other) { - var dest = other as FilterComponent; - - if (dest == null) - { + if(other is not FilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(OpElement.Any()) dest.OpElement = new List(OpElement.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_OpElement is not null) dest.OpElement = new List(_OpElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -961,41 +914,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterComponent; - if(otherT == null) return false; + if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(OpElement, otherT.OpElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_OpElement, otherT._OpElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "op": - value = OpElement; - return OpElement?.Any() == true; + value = _OpElement; + return _OpElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "op": - OpElement = (List)value; + OpElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1006,8 +959,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (OpElement?.Any() == true) yield return new KeyValuePair("op",OpElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_OpElement?.Any() == true) yield return new KeyValuePair("op",_OpElement); } } @@ -1030,13 +983,13 @@ public partial class ExpansionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("hierarchical", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean HierarchicalElement + public Hl7.Fhir.Model.FhirBoolean? HierarchicalElement { get { return _HierarchicalElement; } set { _HierarchicalElement = value; OnPropertyChanged("HierarchicalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _HierarchicalElement; + private Hl7.Fhir.Model.FhirBoolean? _HierarchicalElement; /// /// Whether the server can return nested value sets @@ -1045,13 +998,10 @@ public Hl7.Fhir.Model.FhirBoolean HierarchicalElement [IgnoreDataMember] public bool? Hierarchical { - get { return HierarchicalElement != null ? HierarchicalElement.Value : null; } + get => _HierarchicalElement?.Value; set { - if (value == null) - HierarchicalElement = null; - else - HierarchicalElement = new Hl7.Fhir.Model.FhirBoolean(value); + HierarchicalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Hierarchical"); } } @@ -1061,13 +1011,13 @@ public bool? Hierarchical /// [FhirElement("paging", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PagingElement + public Hl7.Fhir.Model.FhirBoolean? PagingElement { get { return _PagingElement; } set { _PagingElement = value; OnPropertyChanged("PagingElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PagingElement; + private Hl7.Fhir.Model.FhirBoolean? _PagingElement; /// /// Whether the server supports paging on expansion @@ -1076,13 +1026,10 @@ public Hl7.Fhir.Model.FhirBoolean PagingElement [IgnoreDataMember] public bool? Paging { - get { return PagingElement != null ? PagingElement.Value : null; } + get => _PagingElement?.Value; set { - if (value == null) - PagingElement = null; - else - PagingElement = new Hl7.Fhir.Model.FhirBoolean(value); + PagingElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Paging"); } } @@ -1092,13 +1039,13 @@ public bool? Paging /// [FhirElement("incomplete", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IncompleteElement + public Hl7.Fhir.Model.FhirBoolean? IncompleteElement { get { return _IncompleteElement; } set { _IncompleteElement = value; OnPropertyChanged("IncompleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IncompleteElement; + private Hl7.Fhir.Model.FhirBoolean? _IncompleteElement; /// /// Allow request for incomplete expansions? @@ -1107,13 +1054,10 @@ public Hl7.Fhir.Model.FhirBoolean IncompleteElement [IgnoreDataMember] public bool? Incomplete { - get { return IncompleteElement != null ? IncompleteElement.Value : null; } + get => _IncompleteElement?.Value; set { - if (value == null) - IncompleteElement = null; - else - IncompleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + IncompleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Incomplete"); } } @@ -1126,58 +1070,51 @@ public bool? Incomplete [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Documentation about text searching works. /// [FhirElement("textFilter", Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown TextFilterElement + public Hl7.Fhir.Model.Markdown? TextFilterElement { get { return _TextFilterElement; } set { _TextFilterElement = value; OnPropertyChanged("TextFilterElement"); } } - private Hl7.Fhir.Model.Markdown _TextFilterElement; + private Hl7.Fhir.Model.Markdown? _TextFilterElement; /// /// Documentation about text searching works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextFilter + public string? TextFilter { - get { return TextFilterElement != null ? TextFilterElement.Value : null; } + get => _TextFilterElement?.Value; set { - if (value == null) - TextFilterElement = null; - else - TextFilterElement = new Hl7.Fhir.Model.Markdown(value); + TextFilterElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("TextFilter"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ExpansionComponent; - - if (dest == null) - { + if(other is not ExpansionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(HierarchicalElement != null) dest.HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)HierarchicalElement.DeepCopyInternal(); - if(PagingElement != null) dest.PagingElement = (Hl7.Fhir.Model.FhirBoolean)PagingElement.DeepCopyInternal(); - if(IncompleteElement != null) dest.IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)IncompleteElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(TextFilterElement != null) dest.TextFilterElement = (Hl7.Fhir.Model.Markdown)TextFilterElement.DeepCopyInternal(); + if(_HierarchicalElement is not null) dest.HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)_HierarchicalElement.DeepCopyInternal(); + if(_PagingElement is not null) dest.PagingElement = (Hl7.Fhir.Model.FhirBoolean)_PagingElement.DeepCopyInternal(); + if(_IncompleteElement is not null) dest.IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)_IncompleteElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_TextFilterElement is not null) dest.TextFilterElement = (Hl7.Fhir.Model.Markdown)_TextFilterElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1189,62 +1126,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExpansionComponent; - if(otherT == null) return false; + if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(HierarchicalElement, otherT.HierarchicalElement)) return false; - if(!comparer.Equals(PagingElement, otherT.PagingElement)) return false; - if(!comparer.Equals(IncompleteElement, otherT.IncompleteElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(TextFilterElement, otherT.TextFilterElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; + if(!comparer.Equals(_PagingElement, otherT._PagingElement)) return false; + if(!comparer.Equals(_IncompleteElement, otherT._IncompleteElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_TextFilterElement, otherT._TextFilterElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "hierarchical": - value = HierarchicalElement; - return HierarchicalElement is not null; + value = _HierarchicalElement; + return _HierarchicalElement is not null; case "paging": - value = PagingElement; - return PagingElement is not null; + value = _PagingElement; + return _PagingElement is not null; case "incomplete": - value = IncompleteElement; - return IncompleteElement is not null; + value = _IncompleteElement; + return _IncompleteElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "textFilter": - value = TextFilterElement; - return TextFilterElement is not null; + value = _TextFilterElement; + return _TextFilterElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "hierarchical": - HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)value; + HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "paging": - PagingElement = (Hl7.Fhir.Model.FhirBoolean)value; + PagingElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "incomplete": - IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + IncompleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "textFilter": - TextFilterElement = (Hl7.Fhir.Model.Markdown)value; + TextFilterElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1255,11 +1192,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (HierarchicalElement is not null) yield return new KeyValuePair("hierarchical",HierarchicalElement); - if (PagingElement is not null) yield return new KeyValuePair("paging",PagingElement); - if (IncompleteElement is not null) yield return new KeyValuePair("incomplete",IncompleteElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (TextFilterElement is not null) yield return new KeyValuePair("textFilter",TextFilterElement); + if (_HierarchicalElement is not null) yield return new KeyValuePair("hierarchical",_HierarchicalElement); + if (_PagingElement is not null) yield return new KeyValuePair("paging",_PagingElement); + if (_IncompleteElement is not null) yield return new KeyValuePair("incomplete",_IncompleteElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_TextFilterElement is not null) yield return new KeyValuePair("textFilter",_TextFilterElement); } } @@ -1283,28 +1220,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Expansion Parameter name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -1314,44 +1248,37 @@ public string Name /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Description of support for parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1363,41 +1290,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1408,8 +1335,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1433,13 +1360,13 @@ public partial class ValidateCodeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("translations", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TranslationsElement + public Hl7.Fhir.Model.FhirBoolean? TranslationsElement { get { return _TranslationsElement; } set { _TranslationsElement = value; OnPropertyChanged("TranslationsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TranslationsElement; + private Hl7.Fhir.Model.FhirBoolean? _TranslationsElement; /// /// Whether translations are validated @@ -1448,28 +1375,21 @@ public Hl7.Fhir.Model.FhirBoolean TranslationsElement [IgnoreDataMember] public bool? Translations { - get { return TranslationsElement != null ? TranslationsElement.Value : null; } + get => _TranslationsElement?.Value; set { - if (value == null) - TranslationsElement = null; - else - TranslationsElement = new Hl7.Fhir.Model.FhirBoolean(value); + TranslationsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Translations"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ValidateCodeComponent; - - if (dest == null) - { + if(other is not ValidateCodeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TranslationsElement != null) dest.TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)TranslationsElement.DeepCopyInternal(); + if(_TranslationsElement is not null) dest.TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)_TranslationsElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1481,34 +1401,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValidateCodeComponent; - if(otherT == null) return false; + if(other is not ValidateCodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TranslationsElement, otherT.TranslationsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "translations": - value = TranslationsElement; - return TranslationsElement is not null; + value = _TranslationsElement; + return _TranslationsElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "translations": - TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)value; + TranslationsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1519,7 +1439,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TranslationsElement is not null) yield return new KeyValuePair("translations",TranslationsElement); + if (_TranslationsElement is not null) yield return new KeyValuePair("translations",_TranslationsElement); } } @@ -1543,13 +1463,13 @@ public partial class TranslationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("needsMap", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NeedsMapElement + public Hl7.Fhir.Model.FhirBoolean? NeedsMapElement { get { return _NeedsMapElement; } set { _NeedsMapElement = value; OnPropertyChanged("NeedsMapElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NeedsMapElement; + private Hl7.Fhir.Model.FhirBoolean? _NeedsMapElement; /// /// Whether the client must identify the map @@ -1558,28 +1478,21 @@ public Hl7.Fhir.Model.FhirBoolean NeedsMapElement [IgnoreDataMember] public bool? NeedsMap { - get { return NeedsMapElement != null ? NeedsMapElement.Value : null; } + get => _NeedsMapElement?.Value; set { - if (value == null) - NeedsMapElement = null; - else - NeedsMapElement = new Hl7.Fhir.Model.FhirBoolean(value); + NeedsMapElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NeedsMap"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TranslationComponent; - - if (dest == null) - { + if(other is not TranslationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NeedsMapElement != null) dest.NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)NeedsMapElement.DeepCopyInternal(); + if(_NeedsMapElement is not null) dest.NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)_NeedsMapElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1591,34 +1504,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TranslationComponent; - if(otherT == null) return false; + if(other is not TranslationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NeedsMapElement, otherT.NeedsMapElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "needsMap": - value = NeedsMapElement; - return NeedsMapElement is not null; + value = _NeedsMapElement; + return _NeedsMapElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "needsMap": - NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)value; + NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1629,7 +1542,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NeedsMapElement is not null) yield return new KeyValuePair("needsMap",NeedsMapElement); + if (_NeedsMapElement is not null) yield return new KeyValuePair("needsMap",_NeedsMapElement); } } @@ -1655,13 +1568,13 @@ public partial class ClosureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("translation", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TranslationElement + public Hl7.Fhir.Model.FhirBoolean? TranslationElement { get { return _TranslationElement; } set { _TranslationElement = value; OnPropertyChanged("TranslationElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TranslationElement; + private Hl7.Fhir.Model.FhirBoolean? _TranslationElement; /// /// If cross-system closure is supported @@ -1670,28 +1583,21 @@ public Hl7.Fhir.Model.FhirBoolean TranslationElement [IgnoreDataMember] public bool? Translation { - get { return TranslationElement != null ? TranslationElement.Value : null; } + get => _TranslationElement?.Value; set { - if (value == null) - TranslationElement = null; - else - TranslationElement = new Hl7.Fhir.Model.FhirBoolean(value); + TranslationElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Translation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ClosureComponent; - - if (dest == null) - { + if(other is not ClosureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TranslationElement != null) dest.TranslationElement = (Hl7.Fhir.Model.FhirBoolean)TranslationElement.DeepCopyInternal(); + if(_TranslationElement is not null) dest.TranslationElement = (Hl7.Fhir.Model.FhirBoolean)_TranslationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1703,34 +1609,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClosureComponent; - if(otherT == null) return false; + if(other is not ClosureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TranslationElement, otherT.TranslationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "translation": - value = TranslationElement; - return TranslationElement is not null; + value = _TranslationElement; + return _TranslationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "translation": - TranslationElement = (Hl7.Fhir.Model.FhirBoolean)value; + TranslationElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1741,7 +1647,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TranslationElement is not null) yield return new KeyValuePair("translation",TranslationElement); + if (_TranslationElement is not null) yield return new KeyValuePair("translation",_TranslationElement); } } @@ -1751,28 +1657,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this terminology capabilities, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1782,28 +1685,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the terminology capabilities /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1813,28 +1713,25 @@ public string Version /// [FhirElement("name", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this terminology capabilities (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1844,28 +1741,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this terminology capabilities (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1878,13 +1772,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1893,13 +1787,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1909,13 +1800,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=140, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1924,13 +1815,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1941,28 +1829,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1972,28 +1857,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=160, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2006,39 +1888,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the terminology capabilities. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the terminology capabilities /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2051,11 +1930,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for terminology capabilities (if applicable). @@ -2066,39 +1945,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this terminology capabilities is defined. /// [FhirElement("purpose", Order=210, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this terminology capabilities is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2108,28 +1984,25 @@ public string Purpose /// [FhirElement("copyright", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2142,13 +2015,13 @@ public string Copyright [Binding("CapabilityStatementKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// instance | capability | requirements @@ -2157,13 +2030,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatementKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -2173,39 +2043,39 @@ public Hl7.Fhir.Model.CapabilityStatementKind? Kind /// [FhirElement("software", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent Software + public Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent? Software { get { return _Software; } set { _Software = value; OnPropertyChanged("Software"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent _Software; + private Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent? _Software; /// /// If this describes a specific instance. /// [FhirElement("implementation", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent Implementation + public Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent? Implementation { get { return _Implementation; } set { _Implementation = value; OnPropertyChanged("Implementation"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent _Implementation; + private Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent? _Implementation; /// /// Whether lockedDate is supported. /// [FhirElement("lockedDate", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean LockedDateElement + public Hl7.Fhir.Model.FhirBoolean? LockedDateElement { get { return _LockedDateElement; } set { _LockedDateElement = value; OnPropertyChanged("LockedDateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _LockedDateElement; + private Hl7.Fhir.Model.FhirBoolean? _LockedDateElement; /// /// Whether lockedDate is supported @@ -2214,13 +2084,10 @@ public Hl7.Fhir.Model.FhirBoolean LockedDateElement [IgnoreDataMember] public bool? LockedDate { - get { return LockedDateElement != null ? LockedDateElement.Value : null; } + get => _LockedDateElement?.Value; set { - if (value == null) - LockedDateElement = null; - else - LockedDateElement = new Hl7.Fhir.Model.FhirBoolean(value); + LockedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("LockedDate"); } } @@ -2233,24 +2100,24 @@ public bool? LockedDate [DataMember] public List CodeSystem { - get { if(_CodeSystem==null) _CodeSystem = new List(); return _CodeSystem; } + get => _CodeSystem ?? new List(); set { _CodeSystem = value; OnPropertyChanged("CodeSystem"); } } - private List _CodeSystem; + private List? _CodeSystem; /// /// Information about the [ValueSet/$expand](valueset-operation-expand.html) operation. /// [FhirElement("expansion", Order=280)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent Expansion + public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent? Expansion { get { return _Expansion; } set { _Expansion = value; OnPropertyChanged("Expansion"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent _Expansion; + private Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent? _Expansion; /// /// explicit | all. @@ -2259,13 +2126,13 @@ public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent Expansion [DeclaredType(Type = typeof(Code))] [Binding("CodeSearchSupport")] [DataMember] - public Code CodeSearchElement + public Code? CodeSearchElement { get { return _CodeSearchElement; } set { _CodeSearchElement = value; OnPropertyChanged("CodeSearchElement"); } } - private Code _CodeSearchElement; + private Code? _CodeSearchElement; /// /// explicit | all @@ -2274,13 +2141,10 @@ public Code CodeSearch [IgnoreDataMember] public Hl7.Fhir.Model.TerminologyCapabilities.CodeSearchSupport? CodeSearch { - get { return CodeSearchElement != null ? CodeSearchElement.Value : null; } + get => _CodeSearchElement?.Value; set { - if (value == null) - CodeSearchElement = null; - else - CodeSearchElement = new Code(value); + CodeSearchElement = value is null ? null : new Code(value); OnPropertyChanged("CodeSearch"); } } @@ -2290,74 +2154,70 @@ public Hl7.Fhir.Model.TerminologyCapabilities.CodeSearchSupport? CodeSearch /// [FhirElement("validateCode", Order=300)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent ValidateCode + public Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent? ValidateCode { get { return _ValidateCode; } set { _ValidateCode = value; OnPropertyChanged("ValidateCode"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent _ValidateCode; + private Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent? _ValidateCode; /// /// Information about the [ConceptMap/$translate](conceptmap-operation-translate.html) operation. /// [FhirElement("translation", Order=310)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent Translation + public Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent? Translation { get { return _Translation; } set { _Translation = value; OnPropertyChanged("Translation"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent _Translation; + private Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent? _Translation; /// /// Information about the [ConceptMap/$closure](conceptmap-operation-closure.html) operation. /// [FhirElement("closure", Order=320)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent Closure + public Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent? Closure { get { return _Closure; } set { _Closure = value; OnPropertyChanged("Closure"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent _Closure; + private Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent? _Closure; protected internal override void CopyToInternal(Base other) { - var dest = other as TerminologyCapabilities; - - if (dest == null) - { + if(other is not TerminologyCapabilities dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Software != null) dest.Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)Software.DeepCopyInternal(); - if(Implementation != null) dest.Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)Implementation.DeepCopyInternal(); - if(LockedDateElement != null) dest.LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)LockedDateElement.DeepCopyInternal(); - if(CodeSystem.Any()) dest.CodeSystem = new List(CodeSystem.DeepCopyInternal()); - if(Expansion != null) dest.Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)Expansion.DeepCopyInternal(); - if(CodeSearchElement != null) dest.CodeSearchElement = (Code)CodeSearchElement.DeepCopyInternal(); - if(ValidateCode != null) dest.ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)ValidateCode.DeepCopyInternal(); - if(Translation != null) dest.Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)Translation.DeepCopyInternal(); - if(Closure != null) dest.Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)Closure.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Software is not null) dest.Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)_Software.DeepCopyInternal(); + if(_Implementation is not null) dest.Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)_Implementation.DeepCopyInternal(); + if(_LockedDateElement is not null) dest.LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)_LockedDateElement.DeepCopyInternal(); + if(_CodeSystem is not null) dest.CodeSystem = new List(_CodeSystem.DeepCopyInternal()); + if(_Expansion is not null) dest.Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)_Expansion.DeepCopyInternal(); + if(_CodeSearchElement is not null) dest.CodeSearchElement = (Code)_CodeSearchElement.DeepCopyInternal(); + if(_ValidateCode is not null) dest.ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)_ValidateCode.DeepCopyInternal(); + if(_Translation is not null) dest.Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)_Translation.DeepCopyInternal(); + if(_Closure is not null) dest.Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)_Closure.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2369,195 +2229,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TerminologyCapabilities; - if(otherT == null) return false; + if(other is not TerminologyCapabilities otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Software, otherT.Software)) return false; - if(!comparer.Equals(Implementation, otherT.Implementation)) return false; - if(!comparer.Equals(LockedDateElement, otherT.LockedDateElement)) return false; - if(!comparer.ListEquals(CodeSystem, otherT.CodeSystem)) return false; - if(!comparer.Equals(Expansion, otherT.Expansion)) return false; - if(!comparer.Equals(CodeSearchElement, otherT.CodeSearchElement)) return false; - if(!comparer.Equals(ValidateCode, otherT.ValidateCode)) return false; - if(!comparer.Equals(Translation, otherT.Translation)) return false; - if(!comparer.Equals(Closure, otherT.Closure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Software, otherT._Software)) return false; + if(!comparer.Equals(_Implementation, otherT._Implementation)) return false; + if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + if(!comparer.ListEquals(_CodeSystem, otherT._CodeSystem)) return false; + if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; + if(!comparer.Equals(_CodeSearchElement, otherT._CodeSearchElement)) return false; + if(!comparer.Equals(_ValidateCode, otherT._ValidateCode)) return false; + if(!comparer.Equals(_Translation, otherT._Translation)) return false; + if(!comparer.Equals(_Closure, otherT._Closure)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "software": - value = Software; - return Software is not null; + value = _Software; + return _Software is not null; case "implementation": - value = Implementation; - return Implementation is not null; + value = _Implementation; + return _Implementation is not null; case "lockedDate": - value = LockedDateElement; - return LockedDateElement is not null; + value = _LockedDateElement; + return _LockedDateElement is not null; case "codeSystem": - value = CodeSystem; - return CodeSystem?.Any() == true; + value = _CodeSystem; + return _CodeSystem?.Any() == true; case "expansion": - value = Expansion; - return Expansion is not null; + value = _Expansion; + return _Expansion is not null; case "codeSearch": - value = CodeSearchElement; - return CodeSearchElement is not null; + value = _CodeSearchElement; + return _CodeSearchElement is not null; case "validateCode": - value = ValidateCode; - return ValidateCode is not null; + value = _ValidateCode; + return _ValidateCode is not null; case "translation": - value = Translation; - return Translation is not null; + value = _Translation; + return _Translation is not null; case "closure": - value = Closure; - return Closure is not null; + value = _Closure; + return _Closure is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "software": - Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)value; + Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent?)value; return this; case "implementation": - Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)value; + Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent?)value; return this; case "lockedDate": - LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)value; + LockedDateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "codeSystem": - CodeSystem = (List)value; + CodeSystem = (List?)value!; return this; case "expansion": - Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)value; + Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent?)value; return this; case "codeSearch": - CodeSearchElement = (Code)value; + CodeSearchElement = (Code?)value; return this; case "validateCode": - ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)value; + ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent?)value; return this; case "translation": - Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)value; + Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent?)value; return this; case "closure": - Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)value; + Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent?)value; return this; default: return base.SetValue(key, value); @@ -2568,30 +2428,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Software is not null) yield return new KeyValuePair("software",Software); - if (Implementation is not null) yield return new KeyValuePair("implementation",Implementation); - if (LockedDateElement is not null) yield return new KeyValuePair("lockedDate",LockedDateElement); - if (CodeSystem?.Any() == true) yield return new KeyValuePair("codeSystem",CodeSystem); - if (Expansion is not null) yield return new KeyValuePair("expansion",Expansion); - if (CodeSearchElement is not null) yield return new KeyValuePair("codeSearch",CodeSearchElement); - if (ValidateCode is not null) yield return new KeyValuePair("validateCode",ValidateCode); - if (Translation is not null) yield return new KeyValuePair("translation",Translation); - if (Closure is not null) yield return new KeyValuePair("closure",Closure); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Software is not null) yield return new KeyValuePair("software",_Software); + if (_Implementation is not null) yield return new KeyValuePair("implementation",_Implementation); + if (_LockedDateElement is not null) yield return new KeyValuePair("lockedDate",_LockedDateElement); + if (_CodeSystem?.Any() == true) yield return new KeyValuePair("codeSystem",_CodeSystem); + if (_Expansion is not null) yield return new KeyValuePair("expansion",_Expansion); + if (_CodeSearchElement is not null) yield return new KeyValuePair("codeSearch",_CodeSearchElement); + if (_ValidateCode is not null) yield return new KeyValuePair("validateCode",_ValidateCode); + if (_Translation is not null) yield return new KeyValuePair("translation",_Translation); + if (_Closure is not null) yield return new KeyValuePair("closure",_Closure); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs index 8fd170b2d..249570595 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("TestReport","http://hl7.org/fhir/StructureDefinition/TestReport")] - public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -216,13 +219,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// test-engine | client | server @@ -231,13 +234,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -248,28 +248,25 @@ public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type [FhirElement("uri", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// The uri of the participant. An absolute URL is preferred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -279,45 +276,38 @@ public string Uri /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// The display name of the participant /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -329,48 +319,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -381,9 +371,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -409,23 +399,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -437,34 +423,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -475,7 +461,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -502,39 +488,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -546,41 +528,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -591,8 +573,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -621,13 +603,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -636,13 +618,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -652,28 +631,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -683,45 +659,38 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri DetailElement + public Hl7.Fhir.Model.FhirUri? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirUri _DetailElement; + private Hl7.Fhir.Model.FhirUri? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirUri(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Detail"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)DetailElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)_DetailElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -733,48 +702,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirUri)value; + DetailElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -785,9 +754,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); } } @@ -816,13 +785,13 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -831,13 +800,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -847,28 +813,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -878,45 +841,38 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DetailElement + public Hl7.Fhir.Model.FhirString? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirString _DetailElement; + private Hl7.Fhir.Model.FhirString? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirString(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Detail"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)_DetailElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -928,48 +884,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirString)value; + DetailElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -980,9 +936,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); } } @@ -1005,28 +961,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1036,28 +989,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1070,25 +1020,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1100,48 +1046,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1152,9 +1098,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1181,39 +1127,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion performed. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1225,41 +1167,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -1270,8 +1212,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -1300,23 +1242,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1328,34 +1266,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1366,7 +1304,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1394,25 +1332,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1424,34 +1358,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -1462,7 +1396,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -1472,41 +1406,38 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Informal name of the executed TestScript. /// [FhirElement("name", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Informal name of the executed TestScript /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1519,13 +1450,13 @@ public string Name [Binding("TestReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | in-progress | waiting | stopped | entered-in-error @@ -1534,13 +1465,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1553,13 +1481,13 @@ public Hl7.Fhir.Model.TestReport.TestReportStatus? Status [References("TestScript")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference TestScript + public Hl7.Fhir.Model.ResourceReference? TestScript { get { return _TestScript; } set { _TestScript = value; OnPropertyChanged("TestScript"); } } - private Hl7.Fhir.Model.ResourceReference _TestScript; + private Hl7.Fhir.Model.ResourceReference? _TestScript; /// /// pass | fail | pending. @@ -1569,13 +1497,13 @@ public Hl7.Fhir.Model.ResourceReference TestScript [Binding("TestReportResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | fail | pending @@ -1584,13 +1512,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -1600,13 +1525,13 @@ public Hl7.Fhir.Model.TestReport.TestReportResult? Result /// [FhirElement("score", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ScoreElement + public Hl7.Fhir.Model.FhirDecimal? ScoreElement { get { return _ScoreElement; } set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _ScoreElement; /// /// The final score (percentage of tests passed) resulting from the execution of the TestScript @@ -1615,13 +1540,10 @@ public Hl7.Fhir.Model.FhirDecimal ScoreElement [IgnoreDataMember] public decimal? Score { - get { return ScoreElement != null ? ScoreElement.Value : null; } + get => _ScoreElement?.Value; set { - if (value == null) - ScoreElement = null; - else - ScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + ScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Score"); } } @@ -1631,28 +1553,25 @@ public decimal? Score /// [FhirElement("tester", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString TesterElement + public Hl7.Fhir.Model.FhirString? TesterElement { get { return _TesterElement; } set { _TesterElement = value; OnPropertyChanged("TesterElement"); } } - private Hl7.Fhir.Model.FhirString _TesterElement; + private Hl7.Fhir.Model.FhirString? _TesterElement; /// /// Name of the tester producing this report (Organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Tester + public string? Tester { - get { return TesterElement != null ? TesterElement.Value : null; } + get => _TesterElement?.Value; set { - if (value == null) - TesterElement = null; - else - TesterElement = new Hl7.Fhir.Model.FhirString(value); + TesterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Tester"); } } @@ -1662,28 +1581,25 @@ public string Tester /// [FhirElement("issued", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When the TestScript was executed and this TestReport was generated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -1696,24 +1612,24 @@ public string Issued [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The results of the series of required setup operations before the tests were executed. /// [FhirElement("setup", Order=180)] [DataMember] - public Hl7.Fhir.Model.TestReport.SetupComponent Setup + public Hl7.Fhir.Model.TestReport.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestReport.SetupComponent _Setup; + private Hl7.Fhir.Model.TestReport.SetupComponent? _Setup; /// /// A test executed from the test script. @@ -1723,49 +1639,45 @@ public Hl7.Fhir.Model.TestReport.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// The results of running the series of required clean up steps. /// [FhirElement("teardown", Order=200)] [DataMember] - public Hl7.Fhir.Model.TestReport.TeardownComponent Teardown + public Hl7.Fhir.Model.TestReport.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestReport.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestReport.TeardownComponent? _Teardown; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestReport; - - if (dest == null) - { + if(other is not TestReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TestScript != null) dest.TestScript = (Hl7.Fhir.Model.ResourceReference)TestScript.DeepCopyInternal(); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(ScoreElement != null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)ScoreElement.DeepCopyInternal(); - if(TesterElement != null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)TesterElement.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)Teardown.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TestScript is not null) dest.TestScript = (Hl7.Fhir.Model.ResourceReference)_TestScript.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_ScoreElement is not null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)_ScoreElement.DeepCopyInternal(); + if(_TesterElement is not null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)_TesterElement.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1777,111 +1689,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestReport; - if(otherT == null) return false; + if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TestScript, otherT.TestScript)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(ScoreElement, otherT.ScoreElement)) return false; - if(!comparer.Equals(TesterElement, otherT.TesterElement)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TestScript, otherT._TestScript)) return false; + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false; + if(!comparer.Equals(_TesterElement, otherT._TesterElement)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "testScript": - value = TestScript; - return TestScript is not null; + value = _TestScript; + return _TestScript is not null; case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "score": - value = ScoreElement; - return ScoreElement is not null; + value = _ScoreElement; + return _ScoreElement is not null; case "tester": - value = TesterElement; - return TesterElement is not null; + value = _TesterElement; + return _TesterElement is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "testScript": - TestScript = (Hl7.Fhir.Model.ResourceReference)value; + TestScript = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "score": - ScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + ScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tester": - TesterElement = (Hl7.Fhir.Model.FhirString)value; + TesterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestReport.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -1892,18 +1804,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TestScript is not null) yield return new KeyValuePair("testScript",TestScript); - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (ScoreElement is not null) yield return new KeyValuePair("score",ScoreElement); - if (TesterElement is not null) yield return new KeyValuePair("tester",TesterElement); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TestScript is not null) yield return new KeyValuePair("testScript",_TestScript); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_ScoreElement is not null) yield return new KeyValuePair("score",_ScoreElement); + if (_TesterElement is not null) yield return new KeyValuePair("tester",_TesterElement); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs index 396ac2954..9364e6387 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("TestScript","http://hl7.org/fhir/StructureDefinition/TestScript")] - public partial class TestScript : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class TestScript : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -314,13 +317,13 @@ public partial class OriginComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract origin server starting at 1 @@ -329,13 +332,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -347,26 +347,22 @@ public int? Index [Binding("TestScriptProfileOriginType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as OriginComponent; - - if (dest == null) - { + if(other is not OriginComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -378,41 +374,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OriginComponent; - if(otherT == null) return false; + if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -423,8 +419,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -452,13 +448,13 @@ public partial class DestinationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract destination server starting at 1 @@ -467,13 +463,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -485,26 +478,22 @@ public int? Index [Binding("TestScriptProfileDestinationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as DestinationComponent; - - if (dest == null) - { + if(other is not DestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -516,41 +505,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DestinationComponent; - if(otherT == null) return false; + if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -561,8 +550,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); } } @@ -591,11 +580,11 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; /// /// Capabilities that are assumed to function correctly on the FHIR server being tested. @@ -605,24 +594,20 @@ public List Link [DataMember] public List Capability { - get { if(_Capability==null) _Capability = new List(); return _Capability; } + get => _Capability ?? new List(); set { _Capability = value; OnPropertyChanged("Capability"); } } - private List _Capability; + private List? _Capability; protected internal override void CopyToInternal(Base other) { - var dest = other as MetadataComponent; - - if (dest == null) - { + if(other is not MetadataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); - if(Capability.Any()) dest.Capability = new List(Capability.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); + if(_Capability is not null) dest.Capability = new List(_Capability.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -634,41 +619,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MetadataComponent; - if(otherT == null) return false; + if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; - if(!comparer.ListEquals(Capability, otherT.Capability)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; case "capability": - value = Capability; - return Capability?.Any() == true; + value = _Capability; + return _Capability?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "link": - Link = (List)value; + Link = (List?)value!; return this; case "capability": - Capability = (List)value; + Capability = (List?)value!; return this; default: return base.SetValue(key, value); @@ -679,8 +664,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); - if (Capability?.Any() == true) yield return new KeyValuePair("capability",Capability); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); + if (_Capability?.Any() == true) yield return new KeyValuePair("capability",_Capability); } } @@ -707,28 +692,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URL to the specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -738,44 +720,37 @@ public string Url /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -787,41 +762,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -832,8 +807,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -861,13 +836,13 @@ public partial class CapabilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("required", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Are the capabilities required? @@ -876,13 +851,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -893,13 +865,13 @@ public bool? Required [FhirElement("validated", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ValidatedElement + public Hl7.Fhir.Model.FhirBoolean? ValidatedElement { get { return _ValidatedElement; } set { _ValidatedElement = value; OnPropertyChanged("ValidatedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ValidatedElement; + private Hl7.Fhir.Model.FhirBoolean? _ValidatedElement; /// /// Are the capabilities validated? @@ -908,13 +880,10 @@ public Hl7.Fhir.Model.FhirBoolean ValidatedElement [IgnoreDataMember] public bool? Validated { - get { return ValidatedElement != null ? ValidatedElement.Value : null; } + get => _ValidatedElement?.Value; set { - if (value == null) - ValidatedElement = null; - else - ValidatedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ValidatedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Validated"); } } @@ -924,28 +893,25 @@ public bool? Validated /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The expected capabilities of the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -958,24 +924,24 @@ public string Description [DataMember] public List OriginElement { - get { if(_OriginElement==null) _OriginElement = new List(); return _OriginElement; } + get => _OriginElement ?? new List(); set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private List _OriginElement; + private List? _OriginElement; /// /// Which origin server these requirements apply to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Origin + public IEnumerable? Origin { - get { return OriginElement != null ? OriginElement.Select(elem => elem.Value) : null; } + get => _OriginElement?.Select(elem => elem.Value); set { if (value == null) - OriginElement = null; + OriginElement = null!; else OriginElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("Origin"); @@ -987,13 +953,13 @@ public IEnumerable Origin /// [FhirElement("destination", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Which server these requirements apply to @@ -1002,13 +968,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -1021,24 +984,24 @@ public int? Destination [DataMember] public List LinkElement { - get { if(_LinkElement==null) _LinkElement = new List(); return _LinkElement; } + get => _LinkElement ?? new List(); set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } - private List _LinkElement; + private List? _LinkElement; /// /// Links to the FHIR specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Link + public IEnumerable? Link { - get { return LinkElement != null ? LinkElement.Select(elem => elem.Value) : null; } + get => _LinkElement?.Select(elem => elem.Value); set { if (value == null) - LinkElement = null; + LinkElement = null!; else LinkElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Link"); @@ -1051,49 +1014,42 @@ public IEnumerable Link [FhirElement("capabilities", Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical CapabilitiesElement + public Hl7.Fhir.Model.Canonical? CapabilitiesElement { get { return _CapabilitiesElement; } set { _CapabilitiesElement = value; OnPropertyChanged("CapabilitiesElement"); } } - private Hl7.Fhir.Model.Canonical _CapabilitiesElement; + private Hl7.Fhir.Model.Canonical? _CapabilitiesElement; /// /// Required Capability Statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Capabilities + public string? Capabilities { - get { return CapabilitiesElement != null ? CapabilitiesElement.Value : null; } + get => _CapabilitiesElement?.Value; set { - if (value == null) - CapabilitiesElement = null; - else - CapabilitiesElement = new Hl7.Fhir.Model.Canonical(value); + CapabilitiesElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Capabilities"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityComponent; - - if (dest == null) - { + if(other is not CapabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(ValidatedElement != null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)ValidatedElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OriginElement.Any()) dest.OriginElement = new List(OriginElement.DeepCopyInternal()); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(LinkElement.Any()) dest.LinkElement = new List(LinkElement.DeepCopyInternal()); - if(CapabilitiesElement != null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)CapabilitiesElement.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_ValidatedElement is not null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)_ValidatedElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = new List(_OriginElement.DeepCopyInternal()); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_LinkElement is not null) dest.LinkElement = new List(_LinkElement.DeepCopyInternal()); + if(_CapabilitiesElement is not null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)_CapabilitiesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1105,76 +1061,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityComponent; - if(otherT == null) return false; + if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(ValidatedElement, otherT.ValidatedElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.ListEquals(LinkElement, otherT.LinkElement)) return false; - if(!comparer.Equals(CapabilitiesElement, otherT.CapabilitiesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; + if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "validated": - value = ValidatedElement; - return ValidatedElement is not null; + value = _ValidatedElement; + return _ValidatedElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "origin": - value = OriginElement; - return OriginElement?.Any() == true; + value = _OriginElement; + return _OriginElement?.Any() == true; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "link": - value = LinkElement; - return LinkElement?.Any() == true; + value = _LinkElement; + return _LinkElement?.Any() == true; case "capabilities": - value = CapabilitiesElement; - return CapabilitiesElement is not null; + value = _CapabilitiesElement; + return _CapabilitiesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "validated": - ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ValidatedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "origin": - OriginElement = (List)value; + OriginElement = (List?)value!; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "link": - LinkElement = (List)value; + LinkElement = (List?)value!; return this; case "capabilities": - CapabilitiesElement = (Hl7.Fhir.Model.Canonical)value; + CapabilitiesElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1185,13 +1141,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (ValidatedElement is not null) yield return new KeyValuePair("validated",ValidatedElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OriginElement?.Any() == true) yield return new KeyValuePair("origin",OriginElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (LinkElement?.Any() == true) yield return new KeyValuePair("link",LinkElement); - if (CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",CapabilitiesElement); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_ValidatedElement is not null) yield return new KeyValuePair("validated",_ValidatedElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OriginElement?.Any() == true) yield return new KeyValuePair("origin",_OriginElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_LinkElement?.Any() == true) yield return new KeyValuePair("link",_LinkElement); + if (_CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",_CapabilitiesElement); } } @@ -1218,13 +1174,13 @@ public partial class FixtureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("autocreate", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutocreateElement + public Hl7.Fhir.Model.FhirBoolean? AutocreateElement { get { return _AutocreateElement; } set { _AutocreateElement = value; OnPropertyChanged("AutocreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutocreateElement; + private Hl7.Fhir.Model.FhirBoolean? _AutocreateElement; /// /// Whether or not to implicitly create the fixture during setup @@ -1233,13 +1189,10 @@ public Hl7.Fhir.Model.FhirBoolean AutocreateElement [IgnoreDataMember] public bool? Autocreate { - get { return AutocreateElement != null ? AutocreateElement.Value : null; } + get => _AutocreateElement?.Value; set { - if (value == null) - AutocreateElement = null; - else - AutocreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutocreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autocreate"); } } @@ -1250,13 +1203,13 @@ public bool? Autocreate [FhirElement("autodelete", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutodeleteElement + public Hl7.Fhir.Model.FhirBoolean? AutodeleteElement { get { return _AutodeleteElement; } set { _AutodeleteElement = value; OnPropertyChanged("AutodeleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutodeleteElement; + private Hl7.Fhir.Model.FhirBoolean? _AutodeleteElement; /// /// Whether or not to implicitly delete the fixture during teardown @@ -1265,13 +1218,10 @@ public Hl7.Fhir.Model.FhirBoolean AutodeleteElement [IgnoreDataMember] public bool? Autodelete { - get { return AutodeleteElement != null ? AutodeleteElement.Value : null; } + get => _AutodeleteElement?.Value; set { - if (value == null) - AutodeleteElement = null; - else - AutodeleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutodeleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autodelete"); } } @@ -1283,27 +1233,23 @@ public bool? Autodelete [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as FixtureComponent; - - if (dest == null) - { + if(other is not FixtureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AutocreateElement != null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)AutocreateElement.DeepCopyInternal(); - if(AutodeleteElement != null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)AutodeleteElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_AutocreateElement is not null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)_AutocreateElement.DeepCopyInternal(); + if(_AutodeleteElement is not null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)_AutodeleteElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1315,48 +1261,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FixtureComponent; - if(otherT == null) return false; + if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AutocreateElement, otherT.AutocreateElement)) return false; - if(!comparer.Equals(AutodeleteElement, otherT.AutodeleteElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "autocreate": - value = AutocreateElement; - return AutocreateElement is not null; + value = _AutocreateElement; + return _AutocreateElement is not null; case "autodelete": - value = AutodeleteElement; - return AutodeleteElement is not null; + value = _AutodeleteElement; + return _AutodeleteElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "autocreate": - AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutocreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "autodelete": - AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1367,9 +1313,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AutocreateElement is not null) yield return new KeyValuePair("autocreate",AutocreateElement); - if (AutodeleteElement is not null) yield return new KeyValuePair("autodelete",AutodeleteElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_AutocreateElement is not null) yield return new KeyValuePair("autocreate",_AutocreateElement); + if (_AutodeleteElement is not null) yield return new KeyValuePair("autodelete",_AutodeleteElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -1397,28 +1343,25 @@ public partial class VariableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptive name for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1428,28 +1371,25 @@ public string Name /// [FhirElement("defaultValue", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DefaultValueElement + public Hl7.Fhir.Model.FhirString? DefaultValueElement { get { return _DefaultValueElement; } set { _DefaultValueElement = value; OnPropertyChanged("DefaultValueElement"); } } - private Hl7.Fhir.Model.FhirString _DefaultValueElement; + private Hl7.Fhir.Model.FhirString? _DefaultValueElement; /// /// Default, hard-coded, or user-defined value for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DefaultValue + public string? DefaultValue { - get { return DefaultValueElement != null ? DefaultValueElement.Value : null; } + get => _DefaultValueElement?.Value; set { - if (value == null) - DefaultValueElement = null; - else - DefaultValueElement = new Hl7.Fhir.Model.FhirString(value); + DefaultValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DefaultValue"); } } @@ -1459,28 +1399,25 @@ public string DefaultValue /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1490,28 +1427,25 @@ public string Description /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The FHIRPath expression against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -1521,28 +1455,25 @@ public string Expression /// [FhirElement("headerField", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name for source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -1552,28 +1483,25 @@ public string HeaderField /// [FhirElement("hint", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString HintElement + public Hl7.Fhir.Model.FhirString? HintElement { get { return _HintElement; } set { _HintElement = value; OnPropertyChanged("HintElement"); } } - private Hl7.Fhir.Model.FhirString _HintElement; + private Hl7.Fhir.Model.FhirString? _HintElement; /// /// Hint help text for default value to enter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Hint + public string? Hint { - get { return HintElement != null ? HintElement.Value : null; } + get => _HintElement?.Value; set { - if (value == null) - HintElement = null; - else - HintElement = new Hl7.Fhir.Model.FhirString(value); + HintElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Hint"); } } @@ -1583,28 +1511,25 @@ public string Hint /// [FhirElement("path", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -1614,50 +1539,43 @@ public string Path /// [FhirElement("sourceId", Order=110)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField within this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VariableComponent; - - if (dest == null) - { + if(other is not VariableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DefaultValueElement != null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)DefaultValueElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(HintElement != null) dest.HintElement = (Hl7.Fhir.Model.FhirString)HintElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DefaultValueElement is not null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)_DefaultValueElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_HintElement is not null) dest.HintElement = (Hl7.Fhir.Model.FhirString)_HintElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1669,83 +1587,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableComponent; - if(otherT == null) return false; + if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DefaultValueElement, otherT.DefaultValueElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(HintElement, otherT.HintElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "defaultValue": - value = DefaultValueElement; - return DefaultValueElement is not null; + value = _DefaultValueElement; + return _DefaultValueElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "hint": - value = HintElement; - return HintElement is not null; + value = _HintElement; + return _HintElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValueElement = (Hl7.Fhir.Model.FhirString)value; + DefaultValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "hint": - HintElement = (Hl7.Fhir.Model.FhirString)value; + HintElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -1756,14 +1674,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",DefaultValueElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (HintElement is not null) yield return new KeyValuePair("hint",HintElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",_DefaultValueElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_HintElement is not null) yield return new KeyValuePair("hint",_HintElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); } } @@ -1789,23 +1707,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1817,34 +1731,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1855,7 +1769,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1882,39 +1796,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1926,41 +1836,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -1971,8 +1881,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -1999,13 +1909,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("TestScriptOperationCode")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Resource type. @@ -2014,13 +1924,13 @@ public Hl7.Fhir.Model.Coding Type [DeclaredType(Type = typeof(Code))] [Binding("FHIRDefinedType")] [DataMember] - public Code ResourceElement + public Code? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Code _ResourceElement; + private Code? _ResourceElement; /// /// Resource type @@ -2029,13 +1939,10 @@ public Code ResourceElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRDefinedType? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Code(value); + ResourceElement = value is null ? null : new Code(value); OnPropertyChanged("Resource"); } } @@ -2045,28 +1952,25 @@ public Hl7.Fhir.Model.FHIRDefinedType? Resource /// [FhirElement("label", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging operation label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2076,28 +1980,25 @@ public string Label /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting operation description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -2108,28 +2009,25 @@ public string Description [FhirElement("accept", Order=80)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code AcceptElement + public Hl7.Fhir.Model.Code? AcceptElement { get { return _AcceptElement; } set { _AcceptElement = value; OnPropertyChanged("AcceptElement"); } } - private Hl7.Fhir.Model.Code _AcceptElement; + private Hl7.Fhir.Model.Code? _AcceptElement; /// /// Mime type to accept in the payload of the response, with charset etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Accept + public string? Accept { - get { return AcceptElement != null ? AcceptElement.Value : null; } + get => _AcceptElement?.Value; set { - if (value == null) - AcceptElement = null; - else - AcceptElement = new Hl7.Fhir.Model.Code(value); + AcceptElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Accept"); } } @@ -2140,28 +2038,25 @@ public string Accept [FhirElement("contentType", Order=90)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// Mime type of the request payload contents, with charset etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -2171,13 +2066,13 @@ public string ContentType /// [FhirElement("destination", Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Server responding to the request @@ -2186,13 +2081,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -2203,13 +2095,13 @@ public int? Destination [FhirElement("encodeRequestUrl", Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement + public Hl7.Fhir.Model.FhirBoolean? EncodeRequestUrlElement { get { return _EncodeRequestUrlElement; } set { _EncodeRequestUrlElement = value; OnPropertyChanged("EncodeRequestUrlElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EncodeRequestUrlElement; + private Hl7.Fhir.Model.FhirBoolean? _EncodeRequestUrlElement; /// /// Whether or not to send the request url in encoded format @@ -2218,13 +2110,10 @@ public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement [IgnoreDataMember] public bool? EncodeRequestUrl { - get { return EncodeRequestUrlElement != null ? EncodeRequestUrlElement.Value : null; } + get => _EncodeRequestUrlElement?.Value; set { - if (value == null) - EncodeRequestUrlElement = null; - else - EncodeRequestUrlElement = new Hl7.Fhir.Model.FhirBoolean(value); + EncodeRequestUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EncodeRequestUrl"); } } @@ -2236,13 +2125,13 @@ public bool? EncodeRequestUrl [DeclaredType(Type = typeof(Code))] [Binding("TestScriptRequestMethodCode")] [DataMember] - public Code MethodElement + public Code? MethodElement { get { return _MethodElement; } set { _MethodElement = value; OnPropertyChanged("MethodElement"); } } - private Code _MethodElement; + private Code? _MethodElement; /// /// delete | get | options | patch | post | put | head @@ -2251,13 +2140,10 @@ public Code MethodElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? Method { - get { return MethodElement != null ? MethodElement.Value : null; } + get => _MethodElement?.Value; set { - if (value == null) - MethodElement = null; - else - MethodElement = new Code(value); + MethodElement = value is null ? null : new Code(value); OnPropertyChanged("Method"); } } @@ -2267,13 +2153,13 @@ public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? Method /// [FhirElement("origin", Order=130)] [DataMember] - public Hl7.Fhir.Model.Integer OriginElement + public Hl7.Fhir.Model.Integer? OriginElement { get { return _OriginElement; } set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private Hl7.Fhir.Model.Integer _OriginElement; + private Hl7.Fhir.Model.Integer? _OriginElement; /// /// Server initiating the request @@ -2282,13 +2168,10 @@ public Hl7.Fhir.Model.Integer OriginElement [IgnoreDataMember] public int? Origin { - get { return OriginElement != null ? OriginElement.Value : null; } + get => _OriginElement?.Value; set { - if (value == null) - OriginElement = null; - else - OriginElement = new Hl7.Fhir.Model.Integer(value); + OriginElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Origin"); } } @@ -2298,28 +2181,25 @@ public int? Origin /// [FhirElement("params", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ParamsElement + public Hl7.Fhir.Model.FhirString? ParamsElement { get { return _ParamsElement; } set { _ParamsElement = value; OnPropertyChanged("ParamsElement"); } } - private Hl7.Fhir.Model.FhirString _ParamsElement; + private Hl7.Fhir.Model.FhirString? _ParamsElement; /// /// Explicitly defined path parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Params + public string? Params { - get { return ParamsElement != null ? ParamsElement.Value : null; } + get => _ParamsElement?.Value; set { - if (value == null) - ParamsElement = null; - else - ParamsElement = new Hl7.Fhir.Model.FhirString(value); + ParamsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Params"); } } @@ -2332,39 +2212,36 @@ public string Params [DataMember] public List RequestHeader { - get { if(_RequestHeader==null) _RequestHeader = new List(); return _RequestHeader; } + get => _RequestHeader ?? new List(); set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } - private List _RequestHeader; + private List? _RequestHeader; /// /// Fixture Id of mapped request. /// [FhirElement("requestId", Order=160)] [DataMember] - public Hl7.Fhir.Model.Id RequestIdElement + public Hl7.Fhir.Model.Id? RequestIdElement { get { return _RequestIdElement; } set { _RequestIdElement = value; OnPropertyChanged("RequestIdElement"); } } - private Hl7.Fhir.Model.Id _RequestIdElement; + private Hl7.Fhir.Model.Id? _RequestIdElement; /// /// Fixture Id of mapped request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestId + public string? RequestId { - get { return RequestIdElement != null ? RequestIdElement.Value : null; } + get => _RequestIdElement?.Value; set { - if (value == null) - RequestIdElement = null; - else - RequestIdElement = new Hl7.Fhir.Model.Id(value); + RequestIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RequestId"); } } @@ -2374,28 +2251,25 @@ public string RequestId /// [FhirElement("responseId", Order=170)] [DataMember] - public Hl7.Fhir.Model.Id ResponseIdElement + public Hl7.Fhir.Model.Id? ResponseIdElement { get { return _ResponseIdElement; } set { _ResponseIdElement = value; OnPropertyChanged("ResponseIdElement"); } } - private Hl7.Fhir.Model.Id _ResponseIdElement; + private Hl7.Fhir.Model.Id? _ResponseIdElement; /// /// Fixture Id of mapped response /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseId + public string? ResponseId { - get { return ResponseIdElement != null ? ResponseIdElement.Value : null; } + get => _ResponseIdElement?.Value; set { - if (value == null) - ResponseIdElement = null; - else - ResponseIdElement = new Hl7.Fhir.Model.Id(value); + ResponseIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ResponseId"); } } @@ -2405,28 +2279,25 @@ public string ResponseId /// [FhirElement("sourceId", Order=180)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of body for PUT and POST requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -2436,28 +2307,25 @@ public string SourceId /// [FhirElement("targetId", Order=190)] [DataMember] - public Hl7.Fhir.Model.Id TargetIdElement + public Hl7.Fhir.Model.Id? TargetIdElement { get { return _TargetIdElement; } set { _TargetIdElement = value; OnPropertyChanged("TargetIdElement"); } } - private Hl7.Fhir.Model.Id _TargetIdElement; + private Hl7.Fhir.Model.Id? _TargetIdElement; /// /// Id of fixture used for extracting the [id], [type], and [vid] for GET requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetId + public string? TargetId { - get { return TargetIdElement != null ? TargetIdElement.Value : null; } + get => _TargetIdElement?.Value; set { - if (value == null) - TargetIdElement = null; - else - TargetIdElement = new Hl7.Fhir.Model.Id(value); + TargetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("TargetId"); } } @@ -2467,59 +2335,52 @@ public string TargetId /// [FhirElement("url", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UrlElement + public Hl7.Fhir.Model.FhirString? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirString _UrlElement; + private Hl7.Fhir.Model.FhirString? _UrlElement; /// /// Request URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirString(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Code)ResourceElement.DeepCopyInternal(); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(AcceptElement != null) dest.AcceptElement = (Hl7.Fhir.Model.Code)AcceptElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(EncodeRequestUrlElement != null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)EncodeRequestUrlElement.DeepCopyInternal(); - if(MethodElement != null) dest.MethodElement = (Code)MethodElement.DeepCopyInternal(); - if(OriginElement != null) dest.OriginElement = (Hl7.Fhir.Model.Integer)OriginElement.DeepCopyInternal(); - if(ParamsElement != null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)ParamsElement.DeepCopyInternal(); - if(RequestHeader.Any()) dest.RequestHeader = new List(RequestHeader.DeepCopyInternal()); - if(RequestIdElement != null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)RequestIdElement.DeepCopyInternal(); - if(ResponseIdElement != null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)ResponseIdElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(TargetIdElement != null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)TargetIdElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)UrlElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Code)_ResourceElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_AcceptElement is not null) dest.AcceptElement = (Hl7.Fhir.Model.Code)_AcceptElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_EncodeRequestUrlElement is not null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)_EncodeRequestUrlElement.DeepCopyInternal(); + if(_MethodElement is not null) dest.MethodElement = (Code)_MethodElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = (Hl7.Fhir.Model.Integer)_OriginElement.DeepCopyInternal(); + if(_ParamsElement is not null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)_ParamsElement.DeepCopyInternal(); + if(_RequestHeader is not null) dest.RequestHeader = new List(_RequestHeader.DeepCopyInternal()); + if(_RequestIdElement is not null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)_RequestIdElement.DeepCopyInternal(); + if(_ResponseIdElement is not null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)_ResponseIdElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_TargetIdElement is not null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)_TargetIdElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2531,146 +2392,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(AcceptElement, otherT.AcceptElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.Equals(EncodeRequestUrlElement, otherT.EncodeRequestUrlElement)) return false; - if(!comparer.Equals(MethodElement, otherT.MethodElement)) return false; - if(!comparer.Equals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(ParamsElement, otherT.ParamsElement)) return false; - if(!comparer.ListEquals(RequestHeader, otherT.RequestHeader)) return false; - if(!comparer.Equals(RequestIdElement, otherT.RequestIdElement)) return false; - if(!comparer.Equals(ResponseIdElement, otherT.ResponseIdElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(TargetIdElement, otherT.TargetIdElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_AcceptElement, otherT._AcceptElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.Equals(_EncodeRequestUrlElement, otherT._EncodeRequestUrlElement)) return false; + if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; + if(!comparer.Equals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; + if(!comparer.ListEquals(_RequestHeader, otherT._RequestHeader)) return false; + if(!comparer.Equals(_RequestIdElement, otherT._RequestIdElement)) return false; + if(!comparer.Equals(_ResponseIdElement, otherT._ResponseIdElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "accept": - value = AcceptElement; - return AcceptElement is not null; + value = _AcceptElement; + return _AcceptElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "encodeRequestUrl": - value = EncodeRequestUrlElement; - return EncodeRequestUrlElement is not null; + value = _EncodeRequestUrlElement; + return _EncodeRequestUrlElement is not null; case "method": - value = MethodElement; - return MethodElement is not null; + value = _MethodElement; + return _MethodElement is not null; case "origin": - value = OriginElement; - return OriginElement is not null; + value = _OriginElement; + return _OriginElement is not null; case "params": - value = ParamsElement; - return ParamsElement is not null; + value = _ParamsElement; + return _ParamsElement is not null; case "requestHeader": - value = RequestHeader; - return RequestHeader?.Any() == true; + value = _RequestHeader; + return _RequestHeader?.Any() == true; case "requestId": - value = RequestIdElement; - return RequestIdElement is not null; + value = _RequestIdElement; + return _RequestIdElement is not null; case "responseId": - value = ResponseIdElement; - return ResponseIdElement is not null; + value = _ResponseIdElement; + return _ResponseIdElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "targetId": - value = TargetIdElement; - return TargetIdElement is not null; + value = _TargetIdElement; + return _TargetIdElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "resource": - ResourceElement = (Code)value; + ResourceElement = (Code?)value; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "accept": - AcceptElement = (Hl7.Fhir.Model.Code)value; + AcceptElement = (Hl7.Fhir.Model.Code?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "encodeRequestUrl": - EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)value; + EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "method": - MethodElement = (Code)value; + MethodElement = (Code?)value; return this; case "origin": - OriginElement = (Hl7.Fhir.Model.Integer)value; + OriginElement = (Hl7.Fhir.Model.Integer?)value; return this; case "params": - ParamsElement = (Hl7.Fhir.Model.FhirString)value; + ParamsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestHeader": - RequestHeader = (List)value; + RequestHeader = (List?)value!; return this; case "requestId": - RequestIdElement = (Hl7.Fhir.Model.Id)value; + RequestIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "responseId": - ResponseIdElement = (Hl7.Fhir.Model.Id)value; + ResponseIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "targetId": - TargetIdElement = (Hl7.Fhir.Model.Id)value; + TargetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirString)value; + UrlElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2681,23 +2542,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (AcceptElement is not null) yield return new KeyValuePair("accept",AcceptElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",EncodeRequestUrlElement); - if (MethodElement is not null) yield return new KeyValuePair("method",MethodElement); - if (OriginElement is not null) yield return new KeyValuePair("origin",OriginElement); - if (ParamsElement is not null) yield return new KeyValuePair("params",ParamsElement); - if (RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",RequestHeader); - if (RequestIdElement is not null) yield return new KeyValuePair("requestId",RequestIdElement); - if (ResponseIdElement is not null) yield return new KeyValuePair("responseId",ResponseIdElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (TargetIdElement is not null) yield return new KeyValuePair("targetId",TargetIdElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_AcceptElement is not null) yield return new KeyValuePair("accept",_AcceptElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",_EncodeRequestUrlElement); + if (_MethodElement is not null) yield return new KeyValuePair("method",_MethodElement); + if (_OriginElement is not null) yield return new KeyValuePair("origin",_OriginElement); + if (_ParamsElement is not null) yield return new KeyValuePair("params",_ParamsElement); + if (_RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",_RequestHeader); + if (_RequestIdElement is not null) yield return new KeyValuePair("requestId",_RequestIdElement); + if (_ResponseIdElement is not null) yield return new KeyValuePair("responseId",_ResponseIdElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_TargetIdElement is not null) yield return new KeyValuePair("targetId",_TargetIdElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -2725,28 +2586,25 @@ public partial class RequestHeaderComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("field", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString FieldElement + public Hl7.Fhir.Model.FhirString? FieldElement { get { return _FieldElement; } set { _FieldElement = value; OnPropertyChanged("FieldElement"); } } - private Hl7.Fhir.Model.FhirString _FieldElement; + private Hl7.Fhir.Model.FhirString? _FieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Field + public string? Field { - get { return FieldElement != null ? FieldElement.Value : null; } + get => _FieldElement?.Value; set { - if (value == null) - FieldElement = null; - else - FieldElement = new Hl7.Fhir.Model.FhirString(value); + FieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Field"); } } @@ -2757,44 +2615,37 @@ public string Field [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// HTTP headerfield value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestHeaderComponent; - - if (dest == null) - { + if(other is not RequestHeaderComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FieldElement != null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)FieldElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_FieldElement is not null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)_FieldElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2806,41 +2657,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestHeaderComponent; - if(otherT == null) return false; + if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FieldElement, otherT.FieldElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "field": - value = FieldElement; - return FieldElement is not null; + value = _FieldElement; + return _FieldElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "field": - FieldElement = (Hl7.Fhir.Model.FhirString)value; + FieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2851,8 +2702,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FieldElement is not null) yield return new KeyValuePair("field",FieldElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_FieldElement is not null) yield return new KeyValuePair("field",_FieldElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -2879,28 +2730,25 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("label", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging assertion label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2910,28 +2758,25 @@ public string Label /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting assertion description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -2943,13 +2788,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("AssertionDirectionType")] [DataMember] - public Code DirectionElement + public Code? DirectionElement { get { return _DirectionElement; } set { _DirectionElement = value; OnPropertyChanged("DirectionElement"); } } - private Code _DirectionElement; + private Code? _DirectionElement; /// /// response | request @@ -2958,13 +2803,10 @@ public Code DirectionElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction { - get { return DirectionElement != null ? DirectionElement.Value : null; } + get => _DirectionElement?.Value; set { - if (value == null) - DirectionElement = null; - else - DirectionElement = new Code(value); + DirectionElement = value is null ? null : new Code(value); OnPropertyChanged("Direction"); } } @@ -2974,28 +2816,25 @@ public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction /// [FhirElement("compareToSourceId", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceIdElement + public Hl7.Fhir.Model.FhirString? CompareToSourceIdElement { get { return _CompareToSourceIdElement; } set { _CompareToSourceIdElement = value; OnPropertyChanged("CompareToSourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceIdElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceIdElement; /// /// Id of the source fixture to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceId + public string? CompareToSourceId { - get { return CompareToSourceIdElement != null ? CompareToSourceIdElement.Value : null; } + get => _CompareToSourceIdElement?.Value; set { - if (value == null) - CompareToSourceIdElement = null; - else - CompareToSourceIdElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceId"); } } @@ -3005,28 +2844,25 @@ public string CompareToSourceId /// [FhirElement("compareToSourceExpression", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceExpressionElement + public Hl7.Fhir.Model.FhirString? CompareToSourceExpressionElement { get { return _CompareToSourceExpressionElement; } set { _CompareToSourceExpressionElement = value; OnPropertyChanged("CompareToSourceExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceExpressionElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceExpressionElement; /// /// The FHIRPath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceExpression + public string? CompareToSourceExpression { - get { return CompareToSourceExpressionElement != null ? CompareToSourceExpressionElement.Value : null; } + get => _CompareToSourceExpressionElement?.Value; set { - if (value == null) - CompareToSourceExpressionElement = null; - else - CompareToSourceExpressionElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceExpression"); } } @@ -3036,28 +2872,25 @@ public string CompareToSourceExpression /// [FhirElement("compareToSourcePath", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourcePathElement + public Hl7.Fhir.Model.FhirString? CompareToSourcePathElement { get { return _CompareToSourcePathElement; } set { _CompareToSourcePathElement = value; OnPropertyChanged("CompareToSourcePathElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourcePathElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourcePathElement; /// /// XPath or JSONPath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourcePath + public string? CompareToSourcePath { - get { return CompareToSourcePathElement != null ? CompareToSourcePathElement.Value : null; } + get => _CompareToSourcePathElement?.Value; set { - if (value == null) - CompareToSourcePathElement = null; - else - CompareToSourcePathElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourcePathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourcePath"); } } @@ -3068,28 +2901,25 @@ public string CompareToSourcePath [FhirElement("contentType", Order=100)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// Mime type to compare against the 'Content-Type' header /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -3099,28 +2929,25 @@ public string ContentType /// [FhirElement("expression", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The FHIRPath expression to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -3130,28 +2957,25 @@ public string Expression /// [FhirElement("headerField", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -3161,28 +2985,25 @@ public string HeaderField /// [FhirElement("minimumId", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString MinimumIdElement + public Hl7.Fhir.Model.FhirString? MinimumIdElement { get { return _MinimumIdElement; } set { _MinimumIdElement = value; OnPropertyChanged("MinimumIdElement"); } } - private Hl7.Fhir.Model.FhirString _MinimumIdElement; + private Hl7.Fhir.Model.FhirString? _MinimumIdElement; /// /// Fixture Id of minimum content resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MinimumId + public string? MinimumId { - get { return MinimumIdElement != null ? MinimumIdElement.Value : null; } + get => _MinimumIdElement?.Value; set { - if (value == null) - MinimumIdElement = null; - else - MinimumIdElement = new Hl7.Fhir.Model.FhirString(value); + MinimumIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MinimumId"); } } @@ -3192,13 +3013,13 @@ public string MinimumId /// [FhirElement("navigationLinks", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement + public Hl7.Fhir.Model.FhirBoolean? NavigationLinksElement { get { return _NavigationLinksElement; } set { _NavigationLinksElement = value; OnPropertyChanged("NavigationLinksElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NavigationLinksElement; + private Hl7.Fhir.Model.FhirBoolean? _NavigationLinksElement; /// /// Perform validation on navigation links? @@ -3207,13 +3028,10 @@ public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement [IgnoreDataMember] public bool? NavigationLinks { - get { return NavigationLinksElement != null ? NavigationLinksElement.Value : null; } + get => _NavigationLinksElement?.Value; set { - if (value == null) - NavigationLinksElement = null; - else - NavigationLinksElement = new Hl7.Fhir.Model.FhirBoolean(value); + NavigationLinksElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NavigationLinks"); } } @@ -3225,13 +3043,13 @@ public bool? NavigationLinks [DeclaredType(Type = typeof(Code))] [Binding("AssertionOperatorType")] [DataMember] - public Code OperatorElement + public Code? OperatorElement { get { return _OperatorElement; } set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private Code _OperatorElement; + private Code? _OperatorElement; /// /// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval @@ -3240,13 +3058,10 @@ public Code OperatorElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator { - get { return OperatorElement != null ? OperatorElement.Value : null; } + get => _OperatorElement?.Value; set { - if (value == null) - OperatorElement = null; - else - OperatorElement = new Code(value); + OperatorElement = value is null ? null : new Code(value); OnPropertyChanged("Operator"); } } @@ -3256,28 +3071,25 @@ public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator /// [FhirElement("path", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -3289,13 +3101,13 @@ public string Path [DeclaredType(Type = typeof(Code))] [Binding("TestScriptRequestMethodCode")] [DataMember] - public Code RequestMethodElement + public Code? RequestMethodElement { get { return _RequestMethodElement; } set { _RequestMethodElement = value; OnPropertyChanged("RequestMethodElement"); } } - private Code _RequestMethodElement; + private Code? _RequestMethodElement; /// /// delete | get | options | patch | post | put | head @@ -3304,13 +3116,10 @@ public Code RequestMethod [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod { - get { return RequestMethodElement != null ? RequestMethodElement.Value : null; } + get => _RequestMethodElement?.Value; set { - if (value == null) - RequestMethodElement = null; - else - RequestMethodElement = new Code(value); + RequestMethodElement = value is null ? null : new Code(value); OnPropertyChanged("RequestMethod"); } } @@ -3320,28 +3129,25 @@ public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod /// [FhirElement("requestURL", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString RequestURLElement + public Hl7.Fhir.Model.FhirString? RequestURLElement { get { return _RequestURLElement; } set { _RequestURLElement = value; OnPropertyChanged("RequestURLElement"); } } - private Hl7.Fhir.Model.FhirString _RequestURLElement; + private Hl7.Fhir.Model.FhirString? _RequestURLElement; /// /// Request URL comparison value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestURL + public string? RequestURL { - get { return RequestURLElement != null ? RequestURLElement.Value : null; } + get => _RequestURLElement?.Value; set { - if (value == null) - RequestURLElement = null; - else - RequestURLElement = new Hl7.Fhir.Model.FhirString(value); + RequestURLElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RequestURL"); } } @@ -3353,13 +3159,13 @@ public string RequestURL [DeclaredType(Type = typeof(Code))] [Binding("FHIRDefinedType")] [DataMember] - public Code ResourceElement + public Code? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Code _ResourceElement; + private Code? _ResourceElement; /// /// Resource type @@ -3368,13 +3174,10 @@ public Code ResourceElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRDefinedType? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Code(value); + ResourceElement = value is null ? null : new Code(value); OnPropertyChanged("Resource"); } } @@ -3386,13 +3189,13 @@ public Hl7.Fhir.Model.FHIRDefinedType? Resource [DeclaredType(Type = typeof(Code))] [Binding("AssertionResponseTypes")] [DataMember] - public Code ResponseElement + public Code? ResponseElement { get { return _ResponseElement; } set { _ResponseElement = value; OnPropertyChanged("ResponseElement"); } } - private Code _ResponseElement; + private Code? _ResponseElement; /// /// okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable @@ -3401,13 +3204,10 @@ public Code ResponseElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response { - get { return ResponseElement != null ? ResponseElement.Value : null; } + get => _ResponseElement?.Value; set { - if (value == null) - ResponseElement = null; - else - ResponseElement = new Code(value); + ResponseElement = value is null ? null : new Code(value); OnPropertyChanged("Response"); } } @@ -3417,28 +3217,25 @@ public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response /// [FhirElement("responseCode", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString ResponseCodeElement + public Hl7.Fhir.Model.FhirString? ResponseCodeElement { get { return _ResponseCodeElement; } set { _ResponseCodeElement = value; OnPropertyChanged("ResponseCodeElement"); } } - private Hl7.Fhir.Model.FhirString _ResponseCodeElement; + private Hl7.Fhir.Model.FhirString? _ResponseCodeElement; /// /// HTTP response code to test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseCode + public string? ResponseCode { - get { return ResponseCodeElement != null ? ResponseCodeElement.Value : null; } + get => _ResponseCodeElement?.Value; set { - if (value == null) - ResponseCodeElement = null; - else - ResponseCodeElement = new Hl7.Fhir.Model.FhirString(value); + ResponseCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResponseCode"); } } @@ -3448,28 +3245,25 @@ public string ResponseCode /// [FhirElement("sourceId", Order=220)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -3479,28 +3273,25 @@ public string SourceId /// [FhirElement("validateProfileId", Order=230)] [DataMember] - public Hl7.Fhir.Model.Id ValidateProfileIdElement + public Hl7.Fhir.Model.Id? ValidateProfileIdElement { get { return _ValidateProfileIdElement; } set { _ValidateProfileIdElement = value; OnPropertyChanged("ValidateProfileIdElement"); } } - private Hl7.Fhir.Model.Id _ValidateProfileIdElement; + private Hl7.Fhir.Model.Id? _ValidateProfileIdElement; /// /// Profile Id of validation profile reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidateProfileId + public string? ValidateProfileId { - get { return ValidateProfileIdElement != null ? ValidateProfileIdElement.Value : null; } + get => _ValidateProfileIdElement?.Value; set { - if (value == null) - ValidateProfileIdElement = null; - else - ValidateProfileIdElement = new Hl7.Fhir.Model.Id(value); + ValidateProfileIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ValidateProfileId"); } } @@ -3510,28 +3301,25 @@ public string ValidateProfileId /// [FhirElement("value", Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The value to compare to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -3542,13 +3330,13 @@ public string Value [FhirElement("warningOnly", Order=250)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement + public Hl7.Fhir.Model.FhirBoolean? WarningOnlyElement { get { return _WarningOnlyElement; } set { _WarningOnlyElement = value; OnPropertyChanged("WarningOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WarningOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _WarningOnlyElement; /// /// Will this assert produce a warning only on error? @@ -3557,49 +3345,42 @@ public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement [IgnoreDataMember] public bool? WarningOnly { - get { return WarningOnlyElement != null ? WarningOnlyElement.Value : null; } + get => _WarningOnlyElement?.Value; set { - if (value == null) - WarningOnlyElement = null; - else - WarningOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + WarningOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WarningOnly"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(DirectionElement != null) dest.DirectionElement = (Code)DirectionElement.DeepCopyInternal(); - if(CompareToSourceIdElement != null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)CompareToSourceIdElement.DeepCopyInternal(); - if(CompareToSourceExpressionElement != null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)CompareToSourceExpressionElement.DeepCopyInternal(); - if(CompareToSourcePathElement != null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)CompareToSourcePathElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(MinimumIdElement != null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)MinimumIdElement.DeepCopyInternal(); - if(NavigationLinksElement != null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)NavigationLinksElement.DeepCopyInternal(); - if(OperatorElement != null) dest.OperatorElement = (Code)OperatorElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(RequestMethodElement != null) dest.RequestMethodElement = (Code)RequestMethodElement.DeepCopyInternal(); - if(RequestURLElement != null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)RequestURLElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Code)ResourceElement.DeepCopyInternal(); - if(ResponseElement != null) dest.ResponseElement = (Code)ResponseElement.DeepCopyInternal(); - if(ResponseCodeElement != null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)ResponseCodeElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(ValidateProfileIdElement != null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)ValidateProfileIdElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(WarningOnlyElement != null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)WarningOnlyElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_DirectionElement is not null) dest.DirectionElement = (Code)_DirectionElement.DeepCopyInternal(); + if(_CompareToSourceIdElement is not null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceIdElement.DeepCopyInternal(); + if(_CompareToSourceExpressionElement is not null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceExpressionElement.DeepCopyInternal(); + if(_CompareToSourcePathElement is not null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)_CompareToSourcePathElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_MinimumIdElement is not null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)_MinimumIdElement.DeepCopyInternal(); + if(_NavigationLinksElement is not null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)_NavigationLinksElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = (Code)_OperatorElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_RequestMethodElement is not null) dest.RequestMethodElement = (Code)_RequestMethodElement.DeepCopyInternal(); + if(_RequestURLElement is not null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)_RequestURLElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Code)_ResourceElement.DeepCopyInternal(); + if(_ResponseElement is not null) dest.ResponseElement = (Code)_ResponseElement.DeepCopyInternal(); + if(_ResponseCodeElement is not null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)_ResponseCodeElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_ValidateProfileIdElement is not null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)_ValidateProfileIdElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_WarningOnlyElement is not null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_WarningOnlyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3611,181 +3392,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(DirectionElement, otherT.DirectionElement)) return false; - if(!comparer.Equals(CompareToSourceIdElement, otherT.CompareToSourceIdElement)) return false; - if(!comparer.Equals(CompareToSourceExpressionElement, otherT.CompareToSourceExpressionElement)) return false; - if(!comparer.Equals(CompareToSourcePathElement, otherT.CompareToSourcePathElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(MinimumIdElement, otherT.MinimumIdElement)) return false; - if(!comparer.Equals(NavigationLinksElement, otherT.NavigationLinksElement)) return false; - if(!comparer.Equals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(RequestMethodElement, otherT.RequestMethodElement)) return false; - if(!comparer.Equals(RequestURLElement, otherT.RequestURLElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(ResponseElement, otherT.ResponseElement)) return false; - if(!comparer.Equals(ResponseCodeElement, otherT.ResponseCodeElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(ValidateProfileIdElement, otherT.ValidateProfileIdElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(WarningOnlyElement, otherT.WarningOnlyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; + if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; + if(!comparer.Equals(_CompareToSourceExpressionElement, otherT._CompareToSourceExpressionElement)) return false; + if(!comparer.Equals(_CompareToSourcePathElement, otherT._CompareToSourcePathElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_MinimumIdElement, otherT._MinimumIdElement)) return false; + if(!comparer.Equals(_NavigationLinksElement, otherT._NavigationLinksElement)) return false; + if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_RequestMethodElement, otherT._RequestMethodElement)) return false; + if(!comparer.Equals(_RequestURLElement, otherT._RequestURLElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_ResponseElement, otherT._ResponseElement)) return false; + if(!comparer.Equals(_ResponseCodeElement, otherT._ResponseCodeElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_ValidateProfileIdElement, otherT._ValidateProfileIdElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "direction": - value = DirectionElement; - return DirectionElement is not null; + value = _DirectionElement; + return _DirectionElement is not null; case "compareToSourceId": - value = CompareToSourceIdElement; - return CompareToSourceIdElement is not null; + value = _CompareToSourceIdElement; + return _CompareToSourceIdElement is not null; case "compareToSourceExpression": - value = CompareToSourceExpressionElement; - return CompareToSourceExpressionElement is not null; + value = _CompareToSourceExpressionElement; + return _CompareToSourceExpressionElement is not null; case "compareToSourcePath": - value = CompareToSourcePathElement; - return CompareToSourcePathElement is not null; + value = _CompareToSourcePathElement; + return _CompareToSourcePathElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "minimumId": - value = MinimumIdElement; - return MinimumIdElement is not null; + value = _MinimumIdElement; + return _MinimumIdElement is not null; case "navigationLinks": - value = NavigationLinksElement; - return NavigationLinksElement is not null; + value = _NavigationLinksElement; + return _NavigationLinksElement is not null; case "operator": - value = OperatorElement; - return OperatorElement is not null; + value = _OperatorElement; + return _OperatorElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "requestMethod": - value = RequestMethodElement; - return RequestMethodElement is not null; + value = _RequestMethodElement; + return _RequestMethodElement is not null; case "requestURL": - value = RequestURLElement; - return RequestURLElement is not null; + value = _RequestURLElement; + return _RequestURLElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "response": - value = ResponseElement; - return ResponseElement is not null; + value = _ResponseElement; + return _ResponseElement is not null; case "responseCode": - value = ResponseCodeElement; - return ResponseCodeElement is not null; + value = _ResponseCodeElement; + return _ResponseCodeElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "validateProfileId": - value = ValidateProfileIdElement; - return ValidateProfileIdElement is not null; + value = _ValidateProfileIdElement; + return _ValidateProfileIdElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "warningOnly": - value = WarningOnlyElement; - return WarningOnlyElement is not null; + value = _WarningOnlyElement; + return _WarningOnlyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "direction": - DirectionElement = (Code)value; + DirectionElement = (Code?)value; return this; case "compareToSourceId": - CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourceExpression": - CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourcePath": - CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "minimumId": - MinimumIdElement = (Hl7.Fhir.Model.FhirString)value; + MinimumIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "navigationLinks": - NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)value; + NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "operator": - OperatorElement = (Code)value; + OperatorElement = (Code?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestMethod": - RequestMethodElement = (Code)value; + RequestMethodElement = (Code?)value; return this; case "requestURL": - RequestURLElement = (Hl7.Fhir.Model.FhirString)value; + RequestURLElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resource": - ResourceElement = (Code)value; + ResourceElement = (Code?)value; return this; case "response": - ResponseElement = (Code)value; + ResponseElement = (Code?)value; return this; case "responseCode": - ResponseCodeElement = (Hl7.Fhir.Model.FhirString)value; + ResponseCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "validateProfileId": - ValidateProfileIdElement = (Hl7.Fhir.Model.Id)value; + ValidateProfileIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "warningOnly": - WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -3796,28 +3577,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (DirectionElement is not null) yield return new KeyValuePair("direction",DirectionElement); - if (CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",CompareToSourceIdElement); - if (CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",CompareToSourceExpressionElement); - if (CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",CompareToSourcePathElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (MinimumIdElement is not null) yield return new KeyValuePair("minimumId",MinimumIdElement); - if (NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",NavigationLinksElement); - if (OperatorElement is not null) yield return new KeyValuePair("operator",OperatorElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",RequestMethodElement); - if (RequestURLElement is not null) yield return new KeyValuePair("requestURL",RequestURLElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (ResponseElement is not null) yield return new KeyValuePair("response",ResponseElement); - if (ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",ResponseCodeElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",ValidateProfileIdElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",WarningOnlyElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_DirectionElement is not null) yield return new KeyValuePair("direction",_DirectionElement); + if (_CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",_CompareToSourceIdElement); + if (_CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",_CompareToSourceExpressionElement); + if (_CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",_CompareToSourcePathElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_MinimumIdElement is not null) yield return new KeyValuePair("minimumId",_MinimumIdElement); + if (_NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",_NavigationLinksElement); + if (_OperatorElement is not null) yield return new KeyValuePair("operator",_OperatorElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",_RequestMethodElement); + if (_RequestURLElement is not null) yield return new KeyValuePair("requestURL",_RequestURLElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_ResponseElement is not null) yield return new KeyValuePair("response",_ResponseElement); + if (_ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",_ResponseCodeElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",_ValidateProfileIdElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",_WarningOnlyElement); } } @@ -3840,28 +3621,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3871,28 +3649,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -3905,25 +3680,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3935,48 +3706,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3987,9 +3758,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -4016,39 +3787,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The setup assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4060,41 +3827,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -4105,8 +3872,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -4135,23 +3902,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4163,34 +3926,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4201,7 +3964,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -4229,25 +3992,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4259,34 +4018,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -4297,7 +4056,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -4308,28 +4067,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this test script, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4339,41 +4095,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the test script. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4384,28 +4137,25 @@ public string Version [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this test script (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4415,28 +4165,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this test script (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4449,13 +4196,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -4464,13 +4211,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4480,13 +4224,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -4495,13 +4239,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -4511,28 +4252,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -4542,28 +4280,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -4576,39 +4311,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the test script. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -4621,11 +4353,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for test script (if applicable). @@ -4636,39 +4368,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this test script is defined. /// [FhirElement("purpose", Order=220, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this test script is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -4678,28 +4407,25 @@ public string Purpose /// [FhirElement("copyright", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -4712,11 +4438,11 @@ public string Copyright [DataMember] public List Origin { - get { if(_Origin==null) _Origin = new List(); return _Origin; } + get => _Origin ?? new List(); set { _Origin = value; OnPropertyChanged("Origin"); } } - private List _Origin; + private List? _Origin; /// /// An abstract server representing a destination or receiver in a message exchange. @@ -4726,24 +4452,24 @@ public List Origin [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Required capability that is assumed to function correctly on the FHIR server being tested. /// [FhirElement("metadata", Order=260)] [DataMember] - public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata + public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata { get { return _Metadata; } set { _Metadata = value; OnPropertyChanged("Metadata"); } } - private Hl7.Fhir.Model.TestScript.MetadataComponent _Metadata; + private Hl7.Fhir.Model.TestScript.MetadataComponent? _Metadata; /// /// Fixture in the test script - by reference (uri). @@ -4753,11 +4479,11 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata [DataMember] public List Fixture { - get { if(_Fixture==null) _Fixture = new List(); return _Fixture; } + get => _Fixture ?? new List(); set { _Fixture = value; OnPropertyChanged("Fixture"); } } - private List _Fixture; + private List? _Fixture; /// /// Reference of the validation profile. @@ -4769,11 +4495,11 @@ public List Fixture [DataMember] public List Profile { - get { if(_Profile==null) _Profile = new List(); return _Profile; } + get => _Profile ?? new List(); set { _Profile = value; OnPropertyChanged("Profile"); } } - private List _Profile; + private List? _Profile; /// /// Placeholder for evaluated elements. @@ -4783,24 +4509,24 @@ public List Profile [DataMember] public List Variable { - get { if(_Variable==null) _Variable = new List(); return _Variable; } + get => _Variable ?? new List(); set { _Variable = value; OnPropertyChanged("Variable"); } } - private List _Variable; + private List? _Variable; /// /// A series of required setup operations before tests are executed. /// [FhirElement("setup", Order=300)] [DataMember] - public Hl7.Fhir.Model.TestScript.SetupComponent Setup + public Hl7.Fhir.Model.TestScript.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestScript.SetupComponent _Setup; + private Hl7.Fhir.Model.TestScript.SetupComponent? _Setup; /// /// A test in this script. @@ -4810,61 +4536,57 @@ public Hl7.Fhir.Model.TestScript.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// A series of required clean up steps. /// [FhirElement("teardown", Order=320)] [DataMember] - public Hl7.Fhir.Model.TestScript.TeardownComponent Teardown + public Hl7.Fhir.Model.TestScript.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestScript.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestScript.TeardownComponent? _Teardown; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestScript; - - if (dest == null) - { + if(other is not TestScript dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(Origin.Any()) dest.Origin = new List(Origin.DeepCopyInternal()); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Metadata != null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)Metadata.DeepCopyInternal(); - if(Fixture.Any()) dest.Fixture = new List(Fixture.DeepCopyInternal()); - if(Profile.Any()) dest.Profile = new List(Profile.DeepCopyInternal()); - if(Variable.Any()) dest.Variable = new List(Variable.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)Teardown.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = new List(_Origin.DeepCopyInternal()); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Metadata is not null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)_Metadata.DeepCopyInternal(); + if(_Fixture is not null) dest.Fixture = new List(_Fixture.DeepCopyInternal()); + if(_Profile is not null) dest.Profile = new List(_Profile.DeepCopyInternal()); + if(_Variable is not null) dest.Variable = new List(_Variable.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4876,195 +4598,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestScript; - if(otherT == null) return false; + if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.ListEquals(Origin, otherT.Origin)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Metadata, otherT.Metadata)) return false; - if(!comparer.ListEquals(Fixture, otherT.Fixture)) return false; - if(!comparer.ListEquals(Profile, otherT.Profile)) return false; - if(!comparer.ListEquals(Variable, otherT.Variable)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.ListEquals(_Origin, otherT._Origin)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Metadata, otherT._Metadata)) return false; + if(!comparer.ListEquals(_Fixture, otherT._Fixture)) return false; + if(!comparer.ListEquals(_Profile, otherT._Profile)) return false; + if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "origin": - value = Origin; - return Origin?.Any() == true; + value = _Origin; + return _Origin?.Any() == true; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "metadata": - value = Metadata; - return Metadata is not null; + value = _Metadata; + return _Metadata is not null; case "fixture": - value = Fixture; - return Fixture?.Any() == true; + value = _Fixture; + return _Fixture?.Any() == true; case "profile": - value = Profile; - return Profile?.Any() == true; + value = _Profile; + return _Profile?.Any() == true; case "variable": - value = Variable; - return Variable?.Any() == true; + value = _Variable; + return _Variable?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "origin": - Origin = (List)value; + Origin = (List?)value!; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "metadata": - Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)value; + Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent?)value; return this; case "fixture": - Fixture = (List)value; + Fixture = (List?)value!; return this; case "profile": - Profile = (List)value; + Profile = (List?)value!; return this; case "variable": - Variable = (List)value; + Variable = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestScript.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -5075,30 +4797,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (Origin?.Any() == true) yield return new KeyValuePair("origin",Origin); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Metadata is not null) yield return new KeyValuePair("metadata",Metadata); - if (Fixture?.Any() == true) yield return new KeyValuePair("fixture",Fixture); - if (Profile?.Any() == true) yield return new KeyValuePair("profile",Profile); - if (Variable?.Any() == true) yield return new KeyValuePair("variable",Variable); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_Origin?.Any() == true) yield return new KeyValuePair("origin",_Origin); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Metadata is not null) yield return new KeyValuePair("metadata",_Metadata); + if (_Fixture?.Any() == true) yield return new KeyValuePair("fixture",_Fixture); + if (_Profile?.Any() == true) yield return new KeyValuePair("profile",_Profile); + if (_Variable?.Any() == true) yield return new KeyValuePair("variable",_Variable); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs index 47350213d..fdca22f24 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -302,26 +305,26 @@ public partial class RepeatComponent : Hl7.Fhir.Model.Element [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Bounds + public Hl7.Fhir.Model.DataType? Bounds { get { return _Bounds; } set { _Bounds = value; OnPropertyChanged("Bounds"); } } - private Hl7.Fhir.Model.DataType _Bounds; + private Hl7.Fhir.Model.DataType? _Bounds; /// /// Number of times to repeat. /// [FhirElement("count", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt CountElement + public Hl7.Fhir.Model.PositiveInt? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.PositiveInt _CountElement; + private Hl7.Fhir.Model.PositiveInt? _CountElement; /// /// Number of times to repeat @@ -330,13 +333,10 @@ public Hl7.Fhir.Model.PositiveInt CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.PositiveInt(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Count"); } } @@ -346,13 +346,13 @@ public int? Count /// [FhirElement("countMax", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt CountMaxElement + public Hl7.Fhir.Model.PositiveInt? CountMaxElement { get { return _CountMaxElement; } set { _CountMaxElement = value; OnPropertyChanged("CountMaxElement"); } } - private Hl7.Fhir.Model.PositiveInt _CountMaxElement; + private Hl7.Fhir.Model.PositiveInt? _CountMaxElement; /// /// Maximum number of times to repeat @@ -361,13 +361,10 @@ public Hl7.Fhir.Model.PositiveInt CountMaxElement [IgnoreDataMember] public int? CountMax { - get { return CountMaxElement != null ? CountMaxElement.Value : null; } + get => _CountMaxElement?.Value; set { - if (value == null) - CountMaxElement = null; - else - CountMaxElement = new Hl7.Fhir.Model.PositiveInt(value); + CountMaxElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("CountMax"); } } @@ -377,13 +374,13 @@ public int? CountMax /// [FhirElement("duration", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationElement + public Hl7.Fhir.Model.FhirDecimal? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationElement; /// /// How long when it happens @@ -392,13 +389,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement [IgnoreDataMember] public decimal? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Duration"); } } @@ -408,13 +402,13 @@ public decimal? Duration /// [FhirElement("durationMax", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationMaxElement + public Hl7.Fhir.Model.FhirDecimal? DurationMaxElement { get { return _DurationMaxElement; } set { _DurationMaxElement = value; OnPropertyChanged("DurationMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationMaxElement; /// /// How long when it happens (Max) @@ -423,13 +417,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationMaxElement [IgnoreDataMember] public decimal? DurationMax { - get { return DurationMaxElement != null ? DurationMaxElement.Value : null; } + get => _DurationMaxElement?.Value; set { - if (value == null) - DurationMaxElement = null; - else - DurationMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("DurationMax"); } } @@ -441,13 +432,13 @@ public decimal? DurationMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code DurationUnitElement + public Code? DurationUnitElement { get { return _DurationUnitElement; } set { _DurationUnitElement = value; OnPropertyChanged("DurationUnitElement"); } } - private Code _DurationUnitElement; + private Code? _DurationUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -456,13 +447,10 @@ public Code DurationUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit { - get { return DurationUnitElement != null ? DurationUnitElement.Value : null; } + get => _DurationUnitElement?.Value; set { - if (value == null) - DurationUnitElement = null; - else - DurationUnitElement = new Code(value); + DurationUnitElement = value is null ? null : new Code(value); OnPropertyChanged("DurationUnit"); } } @@ -472,13 +460,13 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit /// [FhirElement("frequency", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FrequencyElement + public Hl7.Fhir.Model.PositiveInt? FrequencyElement { get { return _FrequencyElement; } set { _FrequencyElement = value; OnPropertyChanged("FrequencyElement"); } } - private Hl7.Fhir.Model.PositiveInt _FrequencyElement; + private Hl7.Fhir.Model.PositiveInt? _FrequencyElement; /// /// Event occurs frequency times per period @@ -487,13 +475,10 @@ public Hl7.Fhir.Model.PositiveInt FrequencyElement [IgnoreDataMember] public int? Frequency { - get { return FrequencyElement != null ? FrequencyElement.Value : null; } + get => _FrequencyElement?.Value; set { - if (value == null) - FrequencyElement = null; - else - FrequencyElement = new Hl7.Fhir.Model.PositiveInt(value); + FrequencyElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Frequency"); } } @@ -503,13 +488,13 @@ public int? Frequency /// [FhirElement("frequencyMax", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FrequencyMaxElement + public Hl7.Fhir.Model.PositiveInt? FrequencyMaxElement { get { return _FrequencyMaxElement; } set { _FrequencyMaxElement = value; OnPropertyChanged("FrequencyMaxElement"); } } - private Hl7.Fhir.Model.PositiveInt _FrequencyMaxElement; + private Hl7.Fhir.Model.PositiveInt? _FrequencyMaxElement; /// /// Event occurs up to frequencyMax times per period @@ -518,13 +503,10 @@ public Hl7.Fhir.Model.PositiveInt FrequencyMaxElement [IgnoreDataMember] public int? FrequencyMax { - get { return FrequencyMaxElement != null ? FrequencyMaxElement.Value : null; } + get => _FrequencyMaxElement?.Value; set { - if (value == null) - FrequencyMaxElement = null; - else - FrequencyMaxElement = new Hl7.Fhir.Model.PositiveInt(value); + FrequencyMaxElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("FrequencyMax"); } } @@ -534,13 +516,13 @@ public int? FrequencyMax /// [FhirElement("period", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodElement + public Hl7.Fhir.Model.FhirDecimal? PeriodElement { get { return _PeriodElement; } set { _PeriodElement = value; OnPropertyChanged("PeriodElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodElement; /// /// Event occurs frequency times per period @@ -549,13 +531,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodElement [IgnoreDataMember] public decimal? Period { - get { return PeriodElement != null ? PeriodElement.Value : null; } + get => _PeriodElement?.Value; set { - if (value == null) - PeriodElement = null; - else - PeriodElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Period"); } } @@ -565,13 +544,13 @@ public decimal? Period /// [FhirElement("periodMax", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement + public Hl7.Fhir.Model.FhirDecimal? PeriodMaxElement { get { return _PeriodMaxElement; } set { _PeriodMaxElement = value; OnPropertyChanged("PeriodMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodMaxElement; /// /// Upper limit of period (3-4 hours) @@ -580,13 +559,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement [IgnoreDataMember] public decimal? PeriodMax { - get { return PeriodMaxElement != null ? PeriodMaxElement.Value : null; } + get => _PeriodMaxElement?.Value; set { - if (value == null) - PeriodMaxElement = null; - else - PeriodMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("PeriodMax"); } } @@ -598,13 +574,13 @@ public decimal? PeriodMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code PeriodUnitElement + public Code? PeriodUnitElement { get { return _PeriodUnitElement; } set { _PeriodUnitElement = value; OnPropertyChanged("PeriodUnitElement"); } } - private Code _PeriodUnitElement; + private Code? _PeriodUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -613,13 +589,10 @@ public Code PeriodUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit { - get { return PeriodUnitElement != null ? PeriodUnitElement.Value : null; } + get => _PeriodUnitElement?.Value; set { - if (value == null) - PeriodUnitElement = null; - else - PeriodUnitElement = new Code(value); + PeriodUnitElement = value is null ? null : new Code(value); OnPropertyChanged("PeriodUnit"); } } @@ -634,24 +607,24 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get { if(_DayOfWeekElement==null) _DayOfWeekElement = new List>(); return _DayOfWeekElement; } + get => _DayOfWeekElement ?? new List>(); set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } - private List> _DayOfWeekElement; + private List>? _DayOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DayOfWeek + public IEnumerable? DayOfWeek { - get { return DayOfWeekElement != null ? DayOfWeekElement.Select(elem => elem.Value) : null; } + get => _DayOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DayOfWeekElement = null; + DayOfWeekElement = null!; else DayOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DayOfWeek"); @@ -666,24 +639,24 @@ public IEnumerable DayOfWeek [DataMember] public List TimeOfDayElement { - get { if(_TimeOfDayElement==null) _TimeOfDayElement = new List(); return _TimeOfDayElement; } + get => _TimeOfDayElement ?? new List(); set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } - private List _TimeOfDayElement; + private List? _TimeOfDayElement; /// /// Time of day for action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TimeOfDay + public IEnumerable? TimeOfDay { - get { return TimeOfDayElement != null ? TimeOfDayElement.Select(elem => elem.Value) : null; } + get => _TimeOfDayElement?.Select(elem => elem.Value); set { if (value == null) - TimeOfDayElement = null; + TimeOfDayElement = null!; else TimeOfDayElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Time(elem))); OnPropertyChanged("TimeOfDay"); @@ -700,24 +673,24 @@ public IEnumerable TimeOfDay [DataMember] public List> WhenElement { - get { if(_WhenElement==null) _WhenElement = new List>(); return _WhenElement; } + get => _WhenElement ?? new List>(); set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } - private List> _WhenElement; + private List>? _WhenElement; /// /// Code for time period of occurrence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable When + public IEnumerable? When { - get { return WhenElement != null ? WhenElement.Select(elem => elem.Value) : null; } + get => _WhenElement?.Select(elem => elem.Value); set { if (value == null) - WhenElement = null; + WhenElement = null!; else WhenElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("When"); @@ -729,13 +702,13 @@ public IEnumerable When /// [FhirElement("offset", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt OffsetElement + public Hl7.Fhir.Model.UnsignedInt? OffsetElement { get { return _OffsetElement; } set { _OffsetElement = value; OnPropertyChanged("OffsetElement"); } } - private Hl7.Fhir.Model.UnsignedInt _OffsetElement; + private Hl7.Fhir.Model.UnsignedInt? _OffsetElement; /// /// Minutes from event (before or after) @@ -744,42 +717,35 @@ public Hl7.Fhir.Model.UnsignedInt OffsetElement [IgnoreDataMember] public int? Offset { - get { return OffsetElement != null ? OffsetElement.Value : null; } + get => _OffsetElement?.Value; set { - if (value == null) - OffsetElement = null; - else - OffsetElement = new Hl7.Fhir.Model.UnsignedInt(value); + OffsetElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Offset"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatComponent; - - if (dest == null) - { + if(other is not RepeatComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Bounds != null) dest.Bounds = (Hl7.Fhir.Model.DataType)Bounds.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.PositiveInt)CountElement.DeepCopyInternal(); - if(CountMaxElement != null) dest.CountMaxElement = (Hl7.Fhir.Model.PositiveInt)CountMaxElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal(); - if(DurationMaxElement != null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)DurationMaxElement.DeepCopyInternal(); - if(DurationUnitElement != null) dest.DurationUnitElement = (Code)DurationUnitElement.DeepCopyInternal(); - if(FrequencyElement != null) dest.FrequencyElement = (Hl7.Fhir.Model.PositiveInt)FrequencyElement.DeepCopyInternal(); - if(FrequencyMaxElement != null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)FrequencyMaxElement.DeepCopyInternal(); - if(PeriodElement != null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)PeriodElement.DeepCopyInternal(); - if(PeriodMaxElement != null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)PeriodMaxElement.DeepCopyInternal(); - if(PeriodUnitElement != null) dest.PeriodUnitElement = (Code)PeriodUnitElement.DeepCopyInternal(); - if(DayOfWeekElement.Any()) dest.DayOfWeekElement = new List>(DayOfWeekElement.DeepCopyInternal()); - if(TimeOfDayElement.Any()) dest.TimeOfDayElement = new List(TimeOfDayElement.DeepCopyInternal()); - if(WhenElement.Any()) dest.WhenElement = new List>(WhenElement.DeepCopyInternal()); - if(OffsetElement != null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)OffsetElement.DeepCopyInternal(); + if(_Bounds is not null) dest.Bounds = (Hl7.Fhir.Model.DataType)_Bounds.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.PositiveInt)_CountElement.DeepCopyInternal(); + if(_CountMaxElement is not null) dest.CountMaxElement = (Hl7.Fhir.Model.PositiveInt)_CountMaxElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal(); + if(_DurationMaxElement is not null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)_DurationMaxElement.DeepCopyInternal(); + if(_DurationUnitElement is not null) dest.DurationUnitElement = (Code)_DurationUnitElement.DeepCopyInternal(); + if(_FrequencyElement is not null) dest.FrequencyElement = (Hl7.Fhir.Model.PositiveInt)_FrequencyElement.DeepCopyInternal(); + if(_FrequencyMaxElement is not null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)_FrequencyMaxElement.DeepCopyInternal(); + if(_PeriodElement is not null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodElement.DeepCopyInternal(); + if(_PeriodMaxElement is not null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodMaxElement.DeepCopyInternal(); + if(_PeriodUnitElement is not null) dest.PeriodUnitElement = (Code)_PeriodUnitElement.DeepCopyInternal(); + if(_DayOfWeekElement is not null) dest.DayOfWeekElement = new List>(_DayOfWeekElement.DeepCopyInternal()); + if(_TimeOfDayElement is not null) dest.TimeOfDayElement = new List(_TimeOfDayElement.DeepCopyInternal()); + if(_WhenElement is not null) dest.WhenElement = new List>(_WhenElement.DeepCopyInternal()); + if(_OffsetElement is not null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)_OffsetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -791,132 +757,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatComponent; - if(otherT == null) return false; + if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Bounds, otherT.Bounds)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(CountMaxElement, otherT.CountMaxElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(DurationMaxElement, otherT.DurationMaxElement)) return false; - if(!comparer.Equals(DurationUnitElement, otherT.DurationUnitElement)) return false; - if(!comparer.Equals(FrequencyElement, otherT.FrequencyElement)) return false; - if(!comparer.Equals(FrequencyMaxElement, otherT.FrequencyMaxElement)) return false; - if(!comparer.Equals(PeriodElement, otherT.PeriodElement)) return false; - if(!comparer.Equals(PeriodMaxElement, otherT.PeriodMaxElement)) return false; - if(!comparer.Equals(PeriodUnitElement, otherT.PeriodUnitElement)) return false; - if(!comparer.ListEquals(DayOfWeekElement, otherT.DayOfWeekElement)) return false; - if(!comparer.ListEquals(TimeOfDayElement, otherT.TimeOfDayElement)) return false; - if(!comparer.ListEquals(WhenElement, otherT.WhenElement)) return false; - if(!comparer.Equals(OffsetElement, otherT.OffsetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_DurationMaxElement, otherT._DurationMaxElement)) return false; + if(!comparer.Equals(_DurationUnitElement, otherT._DurationUnitElement)) return false; + if(!comparer.Equals(_FrequencyElement, otherT._FrequencyElement)) return false; + if(!comparer.Equals(_FrequencyMaxElement, otherT._FrequencyMaxElement)) return false; + if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; + if(!comparer.Equals(_PeriodMaxElement, otherT._PeriodMaxElement)) return false; + if(!comparer.Equals(_PeriodUnitElement, otherT._PeriodUnitElement)) return false; + if(!comparer.ListEquals(_DayOfWeekElement, otherT._DayOfWeekElement)) return false; + if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; + if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; + if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "bounds": - value = Bounds; - return Bounds is not null; + value = _Bounds; + return _Bounds is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "countMax": - value = CountMaxElement; - return CountMaxElement is not null; + value = _CountMaxElement; + return _CountMaxElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "durationMax": - value = DurationMaxElement; - return DurationMaxElement is not null; + value = _DurationMaxElement; + return _DurationMaxElement is not null; case "durationUnit": - value = DurationUnitElement; - return DurationUnitElement is not null; + value = _DurationUnitElement; + return _DurationUnitElement is not null; case "frequency": - value = FrequencyElement; - return FrequencyElement is not null; + value = _FrequencyElement; + return _FrequencyElement is not null; case "frequencyMax": - value = FrequencyMaxElement; - return FrequencyMaxElement is not null; + value = _FrequencyMaxElement; + return _FrequencyMaxElement is not null; case "period": - value = PeriodElement; - return PeriodElement is not null; + value = _PeriodElement; + return _PeriodElement is not null; case "periodMax": - value = PeriodMaxElement; - return PeriodMaxElement is not null; + value = _PeriodMaxElement; + return _PeriodMaxElement is not null; case "periodUnit": - value = PeriodUnitElement; - return PeriodUnitElement is not null; + value = _PeriodUnitElement; + return _PeriodUnitElement is not null; case "dayOfWeek": - value = DayOfWeekElement; - return DayOfWeekElement?.Any() == true; + value = _DayOfWeekElement; + return _DayOfWeekElement?.Any() == true; case "timeOfDay": - value = TimeOfDayElement; - return TimeOfDayElement?.Any() == true; + value = _TimeOfDayElement; + return _TimeOfDayElement?.Any() == true; case "when": - value = WhenElement; - return WhenElement?.Any() == true; + value = _WhenElement; + return _WhenElement?.Any() == true; case "offset": - value = OffsetElement; - return OffsetElement is not null; + value = _OffsetElement; + return _OffsetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "bounds": - Bounds = (Hl7.Fhir.Model.DataType)value; + Bounds = (Hl7.Fhir.Model.DataType?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.PositiveInt)value; + CountElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "countMax": - CountMaxElement = (Hl7.Fhir.Model.PositiveInt)value; + CountMaxElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationMax": - DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationUnit": - DurationUnitElement = (Code)value; + DurationUnitElement = (Code?)value; return this; case "frequency": - FrequencyElement = (Hl7.Fhir.Model.PositiveInt)value; + FrequencyElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "frequencyMax": - FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)value; + FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - PeriodElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodMax": - PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodUnit": - PeriodUnitElement = (Code)value; + PeriodUnitElement = (Code?)value; return this; case "dayOfWeek": - DayOfWeekElement = (List>)value; + DayOfWeekElement = (List>?)value!; return this; case "timeOfDay": - TimeOfDayElement = (List)value; + TimeOfDayElement = (List?)value!; return this; case "when": - WhenElement = (List>)value; + WhenElement = (List>?)value!; return this; case "offset": - OffsetElement = (Hl7.Fhir.Model.UnsignedInt)value; + OffsetElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; default: return base.SetValue(key, value); @@ -927,21 +893,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Bounds is not null) yield return new KeyValuePair("bounds",Bounds); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (CountMaxElement is not null) yield return new KeyValuePair("countMax",CountMaxElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (DurationMaxElement is not null) yield return new KeyValuePair("durationMax",DurationMaxElement); - if (DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",DurationUnitElement); - if (FrequencyElement is not null) yield return new KeyValuePair("frequency",FrequencyElement); - if (FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",FrequencyMaxElement); - if (PeriodElement is not null) yield return new KeyValuePair("period",PeriodElement); - if (PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",PeriodMaxElement); - if (PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",PeriodUnitElement); - if (DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",DayOfWeekElement); - if (TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",TimeOfDayElement); - if (WhenElement?.Any() == true) yield return new KeyValuePair("when",WhenElement); - if (OffsetElement is not null) yield return new KeyValuePair("offset",OffsetElement); + if (_Bounds is not null) yield return new KeyValuePair("bounds",_Bounds); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_CountMaxElement is not null) yield return new KeyValuePair("countMax",_CountMaxElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_DurationMaxElement is not null) yield return new KeyValuePair("durationMax",_DurationMaxElement); + if (_DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",_DurationUnitElement); + if (_FrequencyElement is not null) yield return new KeyValuePair("frequency",_FrequencyElement); + if (_FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",_FrequencyMaxElement); + if (_PeriodElement is not null) yield return new KeyValuePair("period",_PeriodElement); + if (_PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",_PeriodMaxElement); + if (_PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",_PeriodUnitElement); + if (_DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",_DayOfWeekElement); + if (_TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",_TimeOfDayElement); + if (_WhenElement?.Any() == true) yield return new KeyValuePair("when",_WhenElement); + if (_OffsetElement is not null) yield return new KeyValuePair("offset",_OffsetElement); } } @@ -954,24 +920,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get { if(_EventElement==null) _EventElement = new List(); return _EventElement; } + get => _EventElement ?? new List(); set { _EventElement = value; OnPropertyChanged("EventElement"); } } - private List _EventElement; + private List? _EventElement; /// /// When the event occurs /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Event + public IEnumerable? Event { - get { return EventElement != null ? EventElement.Select(elem => elem.Value) : null; } + get => _EventElement?.Select(elem => elem.Value); set { if (value == null) - EventElement = null; + EventElement = null!; else EventElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDateTime(elem))); OnPropertyChanged("Event"); @@ -983,13 +949,13 @@ public IEnumerable Event /// [FhirElement("repeat", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Timing.RepeatComponent Repeat + public Hl7.Fhir.Model.Timing.RepeatComponent? Repeat { get { return _Repeat; } set { _Repeat = value; OnPropertyChanged("Repeat"); } } - private Hl7.Fhir.Model.Timing.RepeatComponent _Repeat; + private Hl7.Fhir.Model.Timing.RepeatComponent? _Repeat; /// /// BID | TID | QID | AM | PM | QD | QOD | +. @@ -997,27 +963,23 @@ public Hl7.Fhir.Model.Timing.RepeatComponent Repeat [FhirElement("code", InSummary=true, Order=60)] [Binding("TimingAbbreviation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as Timing; - - if (dest == null) - { + if(other is not Timing dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(EventElement.Any()) dest.EventElement = new List(EventElement.DeepCopyInternal()); - if(Repeat != null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)Repeat.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_EventElement is not null) dest.EventElement = new List(_EventElement.DeepCopyInternal()); + if(_Repeat is not null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)_Repeat.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1029,48 +991,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Timing; - if(otherT == null) return false; + if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(EventElement, otherT.EventElement)) return false; - if(!comparer.Equals(Repeat, otherT.Repeat)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = EventElement; - return EventElement?.Any() == true; + value = _EventElement; + return _EventElement?.Any() == true; case "repeat": - value = Repeat; - return Repeat is not null; + value = _Repeat; + return _Repeat is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - EventElement = (List)value; + EventElement = (List?)value!; return this; case "repeat": - Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)value; + Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1081,9 +1043,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (EventElement?.Any() == true) yield return new KeyValuePair("event",EventElement); - if (Repeat is not null) yield return new KeyValuePair("repeat",Repeat); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_EventElement?.Any() == true) yield return new KeyValuePair("event",_EventElement); + if (_Repeat is not null) yield return new KeyValuePair("repeat",_Repeat); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs index 5b40ebedc..a036d3573 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -126,13 +129,13 @@ public enum TriggerType [Binding("TriggerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// named-event | periodic | data-changed | data-added | data-modified | data-removed | data-accessed | data-access-ended @@ -141,13 +144,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -157,28 +157,25 @@ public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name or URI that identifies the event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -191,13 +188,13 @@ public string Name [References("Schedule")] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Triggering data of the event (multiple = 'and'). @@ -207,40 +204,36 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// Whether the event triggers (boolean expression). /// [FhirElement("condition", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Expression Condition + public Hl7.Fhir.Model.Expression? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.Expression _Condition; + private Hl7.Fhir.Model.Expression? _Condition; protected internal override void CopyToInternal(Base other) { - var dest = other as TriggerDefinition; - - if (dest == null) - { + if(other is not TriggerDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.Expression)Condition.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.Expression)_Condition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -252,62 +245,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TriggerDefinition; - if(otherT == null) return false; + if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "condition": - Condition = (Hl7.Fhir.Model.Expression)value; + Condition = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -318,11 +311,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs index 08e0866ec..1540c78e2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -122,13 +125,13 @@ public partial class PrimarySourceComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Organization","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Type of primary source (License Board; Primary Education; Continuing Education; Postal Service; Relationship owner; Registration Authority; legal source; issuing source; authoritative source). @@ -139,11 +142,11 @@ public Hl7.Fhir.Model.ResourceReference Who [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Method for exchanging information with the primary source. @@ -154,11 +157,11 @@ public List Type [DataMember] public List CommunicationMethod { - get { if(_CommunicationMethod==null) _CommunicationMethod = new List(); return _CommunicationMethod; } + get => _CommunicationMethod ?? new List(); set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } - private List _CommunicationMethod; + private List? _CommunicationMethod; /// /// successful | failed | unknown. @@ -166,41 +169,38 @@ public List CommunicationMethod [FhirElement("validationStatus", Order=70)] [Binding("validation-status")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ValidationStatus + public Hl7.Fhir.Model.CodeableConcept? ValidationStatus { get { return _ValidationStatus; } set { _ValidationStatus = value; OnPropertyChanged("ValidationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ValidationStatus; + private Hl7.Fhir.Model.CodeableConcept? _ValidationStatus; /// /// When the target was validated against the primary source. /// [FhirElement("validationDate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValidationDateElement + public Hl7.Fhir.Model.FhirDateTime? ValidationDateElement { get { return _ValidationDateElement; } set { _ValidationDateElement = value; OnPropertyChanged("ValidationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValidationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ValidationDateElement; /// /// When the target was validated against the primary source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidationDate + public string? ValidationDate { - get { return ValidationDateElement != null ? ValidationDateElement.Value : null; } + get => _ValidationDateElement?.Value; set { - if (value == null) - ValidationDateElement = null; - else - ValidationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValidationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ValidationDate"); } } @@ -211,13 +211,13 @@ public string ValidationDate [FhirElement("canPushUpdates", InSummary=true, Order=90)] [Binding("can-push-updates")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CanPushUpdates + public Hl7.Fhir.Model.CodeableConcept? CanPushUpdates { get { return _CanPushUpdates; } set { _CanPushUpdates = value; OnPropertyChanged("CanPushUpdates"); } } - private Hl7.Fhir.Model.CodeableConcept _CanPushUpdates; + private Hl7.Fhir.Model.CodeableConcept? _CanPushUpdates; /// /// specific | any | source. @@ -228,29 +228,25 @@ public Hl7.Fhir.Model.CodeableConcept CanPushUpdates [DataMember] public List PushTypeAvailable { - get { if(_PushTypeAvailable==null) _PushTypeAvailable = new List(); return _PushTypeAvailable; } + get => _PushTypeAvailable ?? new List(); set { _PushTypeAvailable = value; OnPropertyChanged("PushTypeAvailable"); } } - private List _PushTypeAvailable; + private List? _PushTypeAvailable; protected internal override void CopyToInternal(Base other) { - var dest = other as PrimarySourceComponent; - - if (dest == null) - { + if(other is not PrimarySourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(CommunicationMethod.Any()) dest.CommunicationMethod = new List(CommunicationMethod.DeepCopyInternal()); - if(ValidationStatus != null) dest.ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)ValidationStatus.DeepCopyInternal(); - if(ValidationDateElement != null) dest.ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)ValidationDateElement.DeepCopyInternal(); - if(CanPushUpdates != null) dest.CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)CanPushUpdates.DeepCopyInternal(); - if(PushTypeAvailable.Any()) dest.PushTypeAvailable = new List(PushTypeAvailable.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_CommunicationMethod is not null) dest.CommunicationMethod = new List(_CommunicationMethod.DeepCopyInternal()); + if(_ValidationStatus is not null) dest.ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)_ValidationStatus.DeepCopyInternal(); + if(_ValidationDateElement is not null) dest.ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ValidationDateElement.DeepCopyInternal(); + if(_CanPushUpdates is not null) dest.CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)_CanPushUpdates.DeepCopyInternal(); + if(_PushTypeAvailable is not null) dest.PushTypeAvailable = new List(_PushTypeAvailable.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -262,76 +258,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrimarySourceComponent; - if(otherT == null) return false; + if(other is not PrimarySourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(CommunicationMethod, otherT.CommunicationMethod)) return false; - if(!comparer.Equals(ValidationStatus, otherT.ValidationStatus)) return false; - if(!comparer.Equals(ValidationDateElement, otherT.ValidationDateElement)) return false; - if(!comparer.Equals(CanPushUpdates, otherT.CanPushUpdates)) return false; - if(!comparer.ListEquals(PushTypeAvailable, otherT.PushTypeAvailable)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_CommunicationMethod, otherT._CommunicationMethod)) return false; + if(!comparer.Equals(_ValidationStatus, otherT._ValidationStatus)) return false; + if(!comparer.Equals(_ValidationDateElement, otherT._ValidationDateElement)) return false; + if(!comparer.Equals(_CanPushUpdates, otherT._CanPushUpdates)) return false; + if(!comparer.ListEquals(_PushTypeAvailable, otherT._PushTypeAvailable)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "communicationMethod": - value = CommunicationMethod; - return CommunicationMethod?.Any() == true; + value = _CommunicationMethod; + return _CommunicationMethod?.Any() == true; case "validationStatus": - value = ValidationStatus; - return ValidationStatus is not null; + value = _ValidationStatus; + return _ValidationStatus is not null; case "validationDate": - value = ValidationDateElement; - return ValidationDateElement is not null; + value = _ValidationDateElement; + return _ValidationDateElement is not null; case "canPushUpdates": - value = CanPushUpdates; - return CanPushUpdates is not null; + value = _CanPushUpdates; + return _CanPushUpdates is not null; case "pushTypeAvailable": - value = PushTypeAvailable; - return PushTypeAvailable?.Any() == true; + value = _PushTypeAvailable; + return _PushTypeAvailable?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "communicationMethod": - CommunicationMethod = (List)value; + CommunicationMethod = (List?)value!; return this; case "validationStatus": - ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ValidationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "validationDate": - ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "canPushUpdates": - CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)value; + CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "pushTypeAvailable": - PushTypeAvailable = (List)value; + PushTypeAvailable = (List?)value!; return this; default: return base.SetValue(key, value); @@ -342,13 +338,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Who is not null) yield return new KeyValuePair("who",Who); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (CommunicationMethod?.Any() == true) yield return new KeyValuePair("communicationMethod",CommunicationMethod); - if (ValidationStatus is not null) yield return new KeyValuePair("validationStatus",ValidationStatus); - if (ValidationDateElement is not null) yield return new KeyValuePair("validationDate",ValidationDateElement); - if (CanPushUpdates is not null) yield return new KeyValuePair("canPushUpdates",CanPushUpdates); - if (PushTypeAvailable?.Any() == true) yield return new KeyValuePair("pushTypeAvailable",PushTypeAvailable); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_CommunicationMethod?.Any() == true) yield return new KeyValuePair("communicationMethod",_CommunicationMethod); + if (_ValidationStatus is not null) yield return new KeyValuePair("validationStatus",_ValidationStatus); + if (_ValidationDateElement is not null) yield return new KeyValuePair("validationDate",_ValidationDateElement); + if (_CanPushUpdates is not null) yield return new KeyValuePair("canPushUpdates",_CanPushUpdates); + if (_PushTypeAvailable?.Any() == true) yield return new KeyValuePair("pushTypeAvailable",_PushTypeAvailable); } } @@ -373,13 +369,13 @@ public partial class AttestationComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// When the who is asserting on behalf of another (organization or individual). @@ -388,13 +384,13 @@ public Hl7.Fhir.Model.ResourceReference Who [CLSCompliant(false)] [References("Organization","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// The method by which attested information was submitted/retrieved. @@ -402,41 +398,38 @@ public Hl7.Fhir.Model.ResourceReference OnBehalfOf [FhirElement("communicationMethod", InSummary=true, Order=60)] [Binding("communication-method")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CommunicationMethod + public Hl7.Fhir.Model.CodeableConcept? CommunicationMethod { get { return _CommunicationMethod; } set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } - private Hl7.Fhir.Model.CodeableConcept _CommunicationMethod; + private Hl7.Fhir.Model.CodeableConcept? _CommunicationMethod; /// /// The date the information was attested to. /// [FhirElement("date", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// The date the information was attested to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -446,28 +439,25 @@ public string Date /// [FhirElement("sourceIdentityCertificate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceIdentityCertificateElement + public Hl7.Fhir.Model.FhirString? SourceIdentityCertificateElement { get { return _SourceIdentityCertificateElement; } set { _SourceIdentityCertificateElement = value; OnPropertyChanged("SourceIdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _SourceIdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _SourceIdentityCertificateElement; /// /// A digital identity certificate associated with the attestation source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceIdentityCertificate + public string? SourceIdentityCertificate { - get { return SourceIdentityCertificateElement != null ? SourceIdentityCertificateElement.Value : null; } + get => _SourceIdentityCertificateElement?.Value; set { - if (value == null) - SourceIdentityCertificateElement = null; - else - SourceIdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + SourceIdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceIdentityCertificate"); } } @@ -477,28 +467,25 @@ public string SourceIdentityCertificate /// [FhirElement("proxyIdentityCertificate", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ProxyIdentityCertificateElement + public Hl7.Fhir.Model.FhirString? ProxyIdentityCertificateElement { get { return _ProxyIdentityCertificateElement; } set { _ProxyIdentityCertificateElement = value; OnPropertyChanged("ProxyIdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _ProxyIdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _ProxyIdentityCertificateElement; /// /// A digital identity certificate associated with the proxy entity submitting attested information on behalf of the attestation source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProxyIdentityCertificate + public string? ProxyIdentityCertificate { - get { return ProxyIdentityCertificateElement != null ? ProxyIdentityCertificateElement.Value : null; } + get => _ProxyIdentityCertificateElement?.Value; set { - if (value == null) - ProxyIdentityCertificateElement = null; - else - ProxyIdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + ProxyIdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProxyIdentityCertificate"); } } @@ -508,45 +495,41 @@ public string ProxyIdentityCertificate /// [FhirElement("proxySignature", Order=100)] [DataMember] - public Hl7.Fhir.Model.Signature ProxySignature + public Hl7.Fhir.Model.Signature? ProxySignature { get { return _ProxySignature; } set { _ProxySignature = value; OnPropertyChanged("ProxySignature"); } } - private Hl7.Fhir.Model.Signature _ProxySignature; + private Hl7.Fhir.Model.Signature? _ProxySignature; /// /// Attester signature. /// [FhirElement("sourceSignature", Order=110)] [DataMember] - public Hl7.Fhir.Model.Signature SourceSignature + public Hl7.Fhir.Model.Signature? SourceSignature { get { return _SourceSignature; } set { _SourceSignature = value; OnPropertyChanged("SourceSignature"); } } - private Hl7.Fhir.Model.Signature _SourceSignature; + private Hl7.Fhir.Model.Signature? _SourceSignature; protected internal override void CopyToInternal(Base other) { - var dest = other as AttestationComponent; - - if (dest == null) - { + if(other is not AttestationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(CommunicationMethod != null) dest.CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)CommunicationMethod.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(SourceIdentityCertificateElement != null) dest.SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)SourceIdentityCertificateElement.DeepCopyInternal(); - if(ProxyIdentityCertificateElement != null) dest.ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)ProxyIdentityCertificateElement.DeepCopyInternal(); - if(ProxySignature != null) dest.ProxySignature = (Hl7.Fhir.Model.Signature)ProxySignature.DeepCopyInternal(); - if(SourceSignature != null) dest.SourceSignature = (Hl7.Fhir.Model.Signature)SourceSignature.DeepCopyInternal(); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_CommunicationMethod is not null) dest.CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)_CommunicationMethod.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_SourceIdentityCertificateElement is not null) dest.SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_SourceIdentityCertificateElement.DeepCopyInternal(); + if(_ProxyIdentityCertificateElement is not null) dest.ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_ProxyIdentityCertificateElement.DeepCopyInternal(); + if(_ProxySignature is not null) dest.ProxySignature = (Hl7.Fhir.Model.Signature)_ProxySignature.DeepCopyInternal(); + if(_SourceSignature is not null) dest.SourceSignature = (Hl7.Fhir.Model.Signature)_SourceSignature.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -558,83 +541,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttestationComponent; - if(otherT == null) return false; + if(other is not AttestationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(CommunicationMethod, otherT.CommunicationMethod)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(SourceIdentityCertificateElement, otherT.SourceIdentityCertificateElement)) return false; - if(!comparer.Equals(ProxyIdentityCertificateElement, otherT.ProxyIdentityCertificateElement)) return false; - if(!comparer.Equals(ProxySignature, otherT.ProxySignature)) return false; - if(!comparer.Equals(SourceSignature, otherT.SourceSignature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_CommunicationMethod, otherT._CommunicationMethod)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_SourceIdentityCertificateElement, otherT._SourceIdentityCertificateElement)) return false; + if(!comparer.Equals(_ProxyIdentityCertificateElement, otherT._ProxyIdentityCertificateElement)) return false; + if(!comparer.Equals(_ProxySignature, otherT._ProxySignature)) return false; + if(!comparer.Equals(_SourceSignature, otherT._SourceSignature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "communicationMethod": - value = CommunicationMethod; - return CommunicationMethod is not null; + value = _CommunicationMethod; + return _CommunicationMethod is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "sourceIdentityCertificate": - value = SourceIdentityCertificateElement; - return SourceIdentityCertificateElement is not null; + value = _SourceIdentityCertificateElement; + return _SourceIdentityCertificateElement is not null; case "proxyIdentityCertificate": - value = ProxyIdentityCertificateElement; - return ProxyIdentityCertificateElement is not null; + value = _ProxyIdentityCertificateElement; + return _ProxyIdentityCertificateElement is not null; case "proxySignature": - value = ProxySignature; - return ProxySignature is not null; + value = _ProxySignature; + return _ProxySignature is not null; case "sourceSignature": - value = SourceSignature; - return SourceSignature is not null; + value = _SourceSignature; + return _SourceSignature is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "communicationMethod": - CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)value; + CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "sourceIdentityCertificate": - SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "proxyIdentityCertificate": - ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "proxySignature": - ProxySignature = (Hl7.Fhir.Model.Signature)value; + ProxySignature = (Hl7.Fhir.Model.Signature?)value; return this; case "sourceSignature": - SourceSignature = (Hl7.Fhir.Model.Signature)value; + SourceSignature = (Hl7.Fhir.Model.Signature?)value; return this; default: return base.SetValue(key, value); @@ -645,14 +628,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (CommunicationMethod is not null) yield return new KeyValuePair("communicationMethod",CommunicationMethod); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (SourceIdentityCertificateElement is not null) yield return new KeyValuePair("sourceIdentityCertificate",SourceIdentityCertificateElement); - if (ProxyIdentityCertificateElement is not null) yield return new KeyValuePair("proxyIdentityCertificate",ProxyIdentityCertificateElement); - if (ProxySignature is not null) yield return new KeyValuePair("proxySignature",ProxySignature); - if (SourceSignature is not null) yield return new KeyValuePair("sourceSignature",SourceSignature); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_CommunicationMethod is not null) yield return new KeyValuePair("communicationMethod",_CommunicationMethod); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_SourceIdentityCertificateElement is not null) yield return new KeyValuePair("sourceIdentityCertificate",_SourceIdentityCertificateElement); + if (_ProxyIdentityCertificateElement is not null) yield return new KeyValuePair("proxyIdentityCertificate",_ProxyIdentityCertificateElement); + if (_ProxySignature is not null) yield return new KeyValuePair("proxySignature",_ProxySignature); + if (_SourceSignature is not null) yield return new KeyValuePair("sourceSignature",_SourceSignature); } } @@ -678,41 +661,38 @@ public partial class ValidatorComponent : Hl7.Fhir.Model.BackboneElement [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// A digital identity certificate associated with the validator. /// [FhirElement("identityCertificate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString IdentityCertificateElement + public Hl7.Fhir.Model.FhirString? IdentityCertificateElement { get { return _IdentityCertificateElement; } set { _IdentityCertificateElement = value; OnPropertyChanged("IdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _IdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _IdentityCertificateElement; /// /// A digital identity certificate associated with the validator /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IdentityCertificate + public string? IdentityCertificate { - get { return IdentityCertificateElement != null ? IdentityCertificateElement.Value : null; } + get => _IdentityCertificateElement?.Value; set { - if (value == null) - IdentityCertificateElement = null; - else - IdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + IdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IdentityCertificate"); } } @@ -722,27 +702,23 @@ public string IdentityCertificate /// [FhirElement("attestationSignature", Order=60)] [DataMember] - public Hl7.Fhir.Model.Signature AttestationSignature + public Hl7.Fhir.Model.Signature? AttestationSignature { get { return _AttestationSignature; } set { _AttestationSignature = value; OnPropertyChanged("AttestationSignature"); } } - private Hl7.Fhir.Model.Signature _AttestationSignature; + private Hl7.Fhir.Model.Signature? _AttestationSignature; protected internal override void CopyToInternal(Base other) { - var dest = other as ValidatorComponent; - - if (dest == null) - { + if(other is not ValidatorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(IdentityCertificateElement != null) dest.IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)IdentityCertificateElement.DeepCopyInternal(); - if(AttestationSignature != null) dest.AttestationSignature = (Hl7.Fhir.Model.Signature)AttestationSignature.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_IdentityCertificateElement is not null) dest.IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_IdentityCertificateElement.DeepCopyInternal(); + if(_AttestationSignature is not null) dest.AttestationSignature = (Hl7.Fhir.Model.Signature)_AttestationSignature.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -754,48 +730,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValidatorComponent; - if(otherT == null) return false; + if(other is not ValidatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(IdentityCertificateElement, otherT.IdentityCertificateElement)) return false; - if(!comparer.Equals(AttestationSignature, otherT.AttestationSignature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_IdentityCertificateElement, otherT._IdentityCertificateElement)) return false; + if(!comparer.Equals(_AttestationSignature, otherT._AttestationSignature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "identityCertificate": - value = IdentityCertificateElement; - return IdentityCertificateElement is not null; + value = _IdentityCertificateElement; + return _IdentityCertificateElement is not null; case "attestationSignature": - value = AttestationSignature; - return AttestationSignature is not null; + value = _AttestationSignature; + return _AttestationSignature is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "identityCertificate": - IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + IdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "attestationSignature": - AttestationSignature = (Hl7.Fhir.Model.Signature)value; + AttestationSignature = (Hl7.Fhir.Model.Signature?)value; return this; default: return base.SetValue(key, value); @@ -806,9 +782,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (IdentityCertificateElement is not null) yield return new KeyValuePair("identityCertificate",IdentityCertificateElement); - if (AttestationSignature is not null) yield return new KeyValuePair("attestationSignature",AttestationSignature); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_IdentityCertificateElement is not null) yield return new KeyValuePair("identityCertificate",_IdentityCertificateElement); + if (_AttestationSignature is not null) yield return new KeyValuePair("attestationSignature",_AttestationSignature); } } @@ -823,11 +799,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// The fhirpath location(s) within the resource that was validated. @@ -837,24 +813,24 @@ public List Target [DataMember] public List TargetLocationElement { - get { if(_TargetLocationElement==null) _TargetLocationElement = new List(); return _TargetLocationElement; } + get => _TargetLocationElement ?? new List(); set { _TargetLocationElement = value; OnPropertyChanged("TargetLocationElement"); } } - private List _TargetLocationElement; + private List? _TargetLocationElement; /// /// The fhirpath location(s) within the resource that was validated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TargetLocation + public IEnumerable? TargetLocation { - get { return TargetLocationElement != null ? TargetLocationElement.Select(elem => elem.Value) : null; } + get => _TargetLocationElement?.Select(elem => elem.Value); set { if (value == null) - TargetLocationElement = null; + TargetLocationElement = null!; else TargetLocationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("TargetLocation"); @@ -867,13 +843,13 @@ public IEnumerable TargetLocation [FhirElement("need", InSummary=true, Order=110)] [Binding("need")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Need + public Hl7.Fhir.Model.CodeableConcept? Need { get { return _Need; } set { _Need = value; OnPropertyChanged("Need"); } } - private Hl7.Fhir.Model.CodeableConcept _Need; + private Hl7.Fhir.Model.CodeableConcept? _Need; /// /// attested | validated | in-process | req-revalid | val-fail | reval-fail. @@ -883,13 +859,13 @@ public Hl7.Fhir.Model.CodeableConcept Need [Binding("status")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// attested | validated | in-process | req-revalid | val-fail | reval-fail @@ -898,13 +874,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.VerificationResult.StatusCode? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -914,28 +887,25 @@ public Hl7.Fhir.Model.VerificationResult.StatusCode? Status /// [FhirElement("statusDate", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// When the validation status was updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -946,13 +916,13 @@ public string StatusDate [FhirElement("validationType", InSummary=true, Order=140)] [Binding("validation-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ValidationType + public Hl7.Fhir.Model.CodeableConcept? ValidationType { get { return _ValidationType; } set { _ValidationType = value; OnPropertyChanged("ValidationType"); } } - private Hl7.Fhir.Model.CodeableConcept _ValidationType; + private Hl7.Fhir.Model.CodeableConcept? _ValidationType; /// /// The primary process by which the target is validated (edit check; value set; primary source; multiple sources; standalone; in context). @@ -963,52 +933,49 @@ public Hl7.Fhir.Model.CodeableConcept ValidationType [DataMember] public List ValidationProcess { - get { if(_ValidationProcess==null) _ValidationProcess = new List(); return _ValidationProcess; } + get => _ValidationProcess ?? new List(); set { _ValidationProcess = value; OnPropertyChanged("ValidationProcess"); } } - private List _ValidationProcess; + private List? _ValidationProcess; /// /// Frequency of revalidation. /// [FhirElement("frequency", Order=160)] [DataMember] - public Hl7.Fhir.Model.Timing Frequency + public Hl7.Fhir.Model.Timing? Frequency { get { return _Frequency; } set { _Frequency = value; OnPropertyChanged("Frequency"); } } - private Hl7.Fhir.Model.Timing _Frequency; + private Hl7.Fhir.Model.Timing? _Frequency; /// /// The date/time validation was last completed (including failed validations). /// [FhirElement("lastPerformed", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastPerformedElement + public Hl7.Fhir.Model.FhirDateTime? LastPerformedElement { get { return _LastPerformedElement; } set { _LastPerformedElement = value; OnPropertyChanged("LastPerformedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastPerformedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastPerformedElement; /// /// The date/time validation was last completed (including failed validations) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastPerformed + public string? LastPerformed { - get { return LastPerformedElement != null ? LastPerformedElement.Value : null; } + get => _LastPerformedElement?.Value; set { - if (value == null) - LastPerformedElement = null; - else - LastPerformedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastPerformedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastPerformed"); } } @@ -1018,28 +985,25 @@ public string LastPerformed /// [FhirElement("nextScheduled", Order=180)] [DataMember] - public Hl7.Fhir.Model.Date NextScheduledElement + public Hl7.Fhir.Model.Date? NextScheduledElement { get { return _NextScheduledElement; } set { _NextScheduledElement = value; OnPropertyChanged("NextScheduledElement"); } } - private Hl7.Fhir.Model.Date _NextScheduledElement; + private Hl7.Fhir.Model.Date? _NextScheduledElement; /// /// The date when target is next validated, if appropriate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string NextScheduled + public string? NextScheduled { - get { return NextScheduledElement != null ? NextScheduledElement.Value : null; } + get => _NextScheduledElement?.Value; set { - if (value == null) - NextScheduledElement = null; - else - NextScheduledElement = new Hl7.Fhir.Model.Date(value); + NextScheduledElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("NextScheduled"); } } @@ -1050,13 +1014,13 @@ public string NextScheduled [FhirElement("failureAction", InSummary=true, Order=190)] [Binding("failure-action")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FailureAction + public Hl7.Fhir.Model.CodeableConcept? FailureAction { get { return _FailureAction; } set { _FailureAction = value; OnPropertyChanged("FailureAction"); } } - private Hl7.Fhir.Model.CodeableConcept _FailureAction; + private Hl7.Fhir.Model.CodeableConcept? _FailureAction; /// /// Information about the primary source(s) involved in validation. @@ -1066,24 +1030,24 @@ public Hl7.Fhir.Model.CodeableConcept FailureAction [DataMember] public List PrimarySource { - get { if(_PrimarySource==null) _PrimarySource = new List(); return _PrimarySource; } + get => _PrimarySource ?? new List(); set { _PrimarySource = value; OnPropertyChanged("PrimarySource"); } } - private List _PrimarySource; + private List? _PrimarySource; /// /// Information about the entity attesting to information. /// [FhirElement("attestation", Order=210)] [DataMember] - public Hl7.Fhir.Model.VerificationResult.AttestationComponent Attestation + public Hl7.Fhir.Model.VerificationResult.AttestationComponent? Attestation { get { return _Attestation; } set { _Attestation = value; OnPropertyChanged("Attestation"); } } - private Hl7.Fhir.Model.VerificationResult.AttestationComponent _Attestation; + private Hl7.Fhir.Model.VerificationResult.AttestationComponent? _Attestation; /// /// Information about the entity validating information. @@ -1093,36 +1057,32 @@ public Hl7.Fhir.Model.VerificationResult.AttestationComponent Attestation [DataMember] public List Validator { - get { if(_Validator==null) _Validator = new List(); return _Validator; } + get => _Validator ?? new List(); set { _Validator = value; OnPropertyChanged("Validator"); } } - private List _Validator; + private List? _Validator; protected internal override void CopyToInternal(Base other) { - var dest = other as VerificationResult; - - if (dest == null) - { + if(other is not VerificationResult dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(TargetLocationElement.Any()) dest.TargetLocationElement = new List(TargetLocationElement.DeepCopyInternal()); - if(Need != null) dest.Need = (Hl7.Fhir.Model.CodeableConcept)Need.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(ValidationType != null) dest.ValidationType = (Hl7.Fhir.Model.CodeableConcept)ValidationType.DeepCopyInternal(); - if(ValidationProcess.Any()) dest.ValidationProcess = new List(ValidationProcess.DeepCopyInternal()); - if(Frequency != null) dest.Frequency = (Hl7.Fhir.Model.Timing)Frequency.DeepCopyInternal(); - if(LastPerformedElement != null) dest.LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)LastPerformedElement.DeepCopyInternal(); - if(NextScheduledElement != null) dest.NextScheduledElement = (Hl7.Fhir.Model.Date)NextScheduledElement.DeepCopyInternal(); - if(FailureAction != null) dest.FailureAction = (Hl7.Fhir.Model.CodeableConcept)FailureAction.DeepCopyInternal(); - if(PrimarySource.Any()) dest.PrimarySource = new List(PrimarySource.DeepCopyInternal()); - if(Attestation != null) dest.Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)Attestation.DeepCopyInternal(); - if(Validator.Any()) dest.Validator = new List(Validator.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_TargetLocationElement is not null) dest.TargetLocationElement = new List(_TargetLocationElement.DeepCopyInternal()); + if(_Need is not null) dest.Need = (Hl7.Fhir.Model.CodeableConcept)_Need.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_ValidationType is not null) dest.ValidationType = (Hl7.Fhir.Model.CodeableConcept)_ValidationType.DeepCopyInternal(); + if(_ValidationProcess is not null) dest.ValidationProcess = new List(_ValidationProcess.DeepCopyInternal()); + if(_Frequency is not null) dest.Frequency = (Hl7.Fhir.Model.Timing)_Frequency.DeepCopyInternal(); + if(_LastPerformedElement is not null) dest.LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)_LastPerformedElement.DeepCopyInternal(); + if(_NextScheduledElement is not null) dest.NextScheduledElement = (Hl7.Fhir.Model.Date)_NextScheduledElement.DeepCopyInternal(); + if(_FailureAction is not null) dest.FailureAction = (Hl7.Fhir.Model.CodeableConcept)_FailureAction.DeepCopyInternal(); + if(_PrimarySource is not null) dest.PrimarySource = new List(_PrimarySource.DeepCopyInternal()); + if(_Attestation is not null) dest.Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)_Attestation.DeepCopyInternal(); + if(_Validator is not null) dest.Validator = new List(_Validator.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1134,125 +1094,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VerificationResult; - if(otherT == null) return false; + if(other is not VerificationResult otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(TargetLocationElement, otherT.TargetLocationElement)) return false; - if(!comparer.Equals(Need, otherT.Need)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(ValidationType, otherT.ValidationType)) return false; - if(!comparer.ListEquals(ValidationProcess, otherT.ValidationProcess)) return false; - if(!comparer.Equals(Frequency, otherT.Frequency)) return false; - if(!comparer.Equals(LastPerformedElement, otherT.LastPerformedElement)) return false; - if(!comparer.Equals(NextScheduledElement, otherT.NextScheduledElement)) return false; - if(!comparer.Equals(FailureAction, otherT.FailureAction)) return false; - if(!comparer.ListEquals(PrimarySource, otherT.PrimarySource)) return false; - if(!comparer.Equals(Attestation, otherT.Attestation)) return false; - if(!comparer.ListEquals(Validator, otherT.Validator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_TargetLocationElement, otherT._TargetLocationElement)) return false; + if(!comparer.Equals(_Need, otherT._Need)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_ValidationType, otherT._ValidationType)) return false; + if(!comparer.ListEquals(_ValidationProcess, otherT._ValidationProcess)) return false; + if(!comparer.Equals(_Frequency, otherT._Frequency)) return false; + if(!comparer.Equals(_LastPerformedElement, otherT._LastPerformedElement)) return false; + if(!comparer.Equals(_NextScheduledElement, otherT._NextScheduledElement)) return false; + if(!comparer.Equals(_FailureAction, otherT._FailureAction)) return false; + if(!comparer.ListEquals(_PrimarySource, otherT._PrimarySource)) return false; + if(!comparer.Equals(_Attestation, otherT._Attestation)) return false; + if(!comparer.ListEquals(_Validator, otherT._Validator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "targetLocation": - value = TargetLocationElement; - return TargetLocationElement?.Any() == true; + value = _TargetLocationElement; + return _TargetLocationElement?.Any() == true; case "need": - value = Need; - return Need is not null; + value = _Need; + return _Need is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "validationType": - value = ValidationType; - return ValidationType is not null; + value = _ValidationType; + return _ValidationType is not null; case "validationProcess": - value = ValidationProcess; - return ValidationProcess?.Any() == true; + value = _ValidationProcess; + return _ValidationProcess?.Any() == true; case "frequency": - value = Frequency; - return Frequency is not null; + value = _Frequency; + return _Frequency is not null; case "lastPerformed": - value = LastPerformedElement; - return LastPerformedElement is not null; + value = _LastPerformedElement; + return _LastPerformedElement is not null; case "nextScheduled": - value = NextScheduledElement; - return NextScheduledElement is not null; + value = _NextScheduledElement; + return _NextScheduledElement is not null; case "failureAction": - value = FailureAction; - return FailureAction is not null; + value = _FailureAction; + return _FailureAction is not null; case "primarySource": - value = PrimarySource; - return PrimarySource?.Any() == true; + value = _PrimarySource; + return _PrimarySource?.Any() == true; case "attestation": - value = Attestation; - return Attestation is not null; + value = _Attestation; + return _Attestation is not null; case "validator": - value = Validator; - return Validator?.Any() == true; + value = _Validator; + return _Validator?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (List)value; + Target = (List?)value!; return this; case "targetLocation": - TargetLocationElement = (List)value; + TargetLocationElement = (List?)value!; return this; case "need": - Need = (Hl7.Fhir.Model.CodeableConcept)value; + Need = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "validationType": - ValidationType = (Hl7.Fhir.Model.CodeableConcept)value; + ValidationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "validationProcess": - ValidationProcess = (List)value; + ValidationProcess = (List?)value!; return this; case "frequency": - Frequency = (Hl7.Fhir.Model.Timing)value; + Frequency = (Hl7.Fhir.Model.Timing?)value; return this; case "lastPerformed": - LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "nextScheduled": - NextScheduledElement = (Hl7.Fhir.Model.Date)value; + NextScheduledElement = (Hl7.Fhir.Model.Date?)value; return this; case "failureAction": - FailureAction = (Hl7.Fhir.Model.CodeableConcept)value; + FailureAction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "primarySource": - PrimarySource = (List)value; + PrimarySource = (List?)value!; return this; case "attestation": - Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)value; + Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent?)value; return this; case "validator": - Validator = (List)value; + Validator = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1263,20 +1223,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (TargetLocationElement?.Any() == true) yield return new KeyValuePair("targetLocation",TargetLocationElement); - if (Need is not null) yield return new KeyValuePair("need",Need); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (ValidationType is not null) yield return new KeyValuePair("validationType",ValidationType); - if (ValidationProcess?.Any() == true) yield return new KeyValuePair("validationProcess",ValidationProcess); - if (Frequency is not null) yield return new KeyValuePair("frequency",Frequency); - if (LastPerformedElement is not null) yield return new KeyValuePair("lastPerformed",LastPerformedElement); - if (NextScheduledElement is not null) yield return new KeyValuePair("nextScheduled",NextScheduledElement); - if (FailureAction is not null) yield return new KeyValuePair("failureAction",FailureAction); - if (PrimarySource?.Any() == true) yield return new KeyValuePair("primarySource",PrimarySource); - if (Attestation is not null) yield return new KeyValuePair("attestation",Attestation); - if (Validator?.Any() == true) yield return new KeyValuePair("validator",Validator); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_TargetLocationElement?.Any() == true) yield return new KeyValuePair("targetLocation",_TargetLocationElement); + if (_Need is not null) yield return new KeyValuePair("need",_Need); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_ValidationType is not null) yield return new KeyValuePair("validationType",_ValidationType); + if (_ValidationProcess?.Any() == true) yield return new KeyValuePair("validationProcess",_ValidationProcess); + if (_Frequency is not null) yield return new KeyValuePair("frequency",_Frequency); + if (_LastPerformedElement is not null) yield return new KeyValuePair("lastPerformed",_LastPerformedElement); + if (_NextScheduledElement is not null) yield return new KeyValuePair("nextScheduled",_NextScheduledElement); + if (_FailureAction is not null) yield return new KeyValuePair("failureAction",_FailureAction); + if (_PrimarySource?.Any() == true) yield return new KeyValuePair("primarySource",_PrimarySource); + if (_Attestation is not null) yield return new KeyValuePair("attestation",_Attestation); + if (_Validator?.Any() == true) yield return new KeyValuePair("validator",_Validator); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs index b08c5044a..5a8555971 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -138,13 +141,13 @@ public partial class LensSpecificationComponent : Hl7.Fhir.Model.BackboneElement [Binding("VisionProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Product + public Hl7.Fhir.Model.CodeableConcept? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.CodeableConcept _Product; + private Hl7.Fhir.Model.CodeableConcept? _Product; /// /// right | left. @@ -154,13 +157,13 @@ public Hl7.Fhir.Model.CodeableConcept Product [Binding("VisionEyes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code EyeElement + public Code? EyeElement { get { return _EyeElement; } set { _EyeElement = value; OnPropertyChanged("EyeElement"); } } - private Code _EyeElement; + private Code? _EyeElement; /// /// right | left @@ -169,13 +172,10 @@ public Code EyeElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye { - get { return EyeElement != null ? EyeElement.Value : null; } + get => _EyeElement?.Value; set { - if (value == null) - EyeElement = null; - else - EyeElement = new Code(value); + EyeElement = value is null ? null : new Code(value); OnPropertyChanged("Eye"); } } @@ -185,13 +185,13 @@ public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye /// [FhirElement("sphere", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal SphereElement + public Hl7.Fhir.Model.FhirDecimal? SphereElement { get { return _SphereElement; } set { _SphereElement = value; OnPropertyChanged("SphereElement"); } } - private Hl7.Fhir.Model.FhirDecimal _SphereElement; + private Hl7.Fhir.Model.FhirDecimal? _SphereElement; /// /// Power of the lens @@ -200,13 +200,10 @@ public Hl7.Fhir.Model.FhirDecimal SphereElement [IgnoreDataMember] public decimal? Sphere { - get { return SphereElement != null ? SphereElement.Value : null; } + get => _SphereElement?.Value; set { - if (value == null) - SphereElement = null; - else - SphereElement = new Hl7.Fhir.Model.FhirDecimal(value); + SphereElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Sphere"); } } @@ -216,13 +213,13 @@ public decimal? Sphere /// [FhirElement("cylinder", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal CylinderElement + public Hl7.Fhir.Model.FhirDecimal? CylinderElement { get { return _CylinderElement; } set { _CylinderElement = value; OnPropertyChanged("CylinderElement"); } } - private Hl7.Fhir.Model.FhirDecimal _CylinderElement; + private Hl7.Fhir.Model.FhirDecimal? _CylinderElement; /// /// Lens power for astigmatism @@ -231,13 +228,10 @@ public Hl7.Fhir.Model.FhirDecimal CylinderElement [IgnoreDataMember] public decimal? Cylinder { - get { return CylinderElement != null ? CylinderElement.Value : null; } + get => _CylinderElement?.Value; set { - if (value == null) - CylinderElement = null; - else - CylinderElement = new Hl7.Fhir.Model.FhirDecimal(value); + CylinderElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Cylinder"); } } @@ -247,13 +241,13 @@ public decimal? Cylinder /// [FhirElement("axis", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer AxisElement + public Hl7.Fhir.Model.Integer? AxisElement { get { return _AxisElement; } set { _AxisElement = value; OnPropertyChanged("AxisElement"); } } - private Hl7.Fhir.Model.Integer _AxisElement; + private Hl7.Fhir.Model.Integer? _AxisElement; /// /// Lens meridian which contain no power for astigmatism @@ -262,13 +256,10 @@ public Hl7.Fhir.Model.Integer AxisElement [IgnoreDataMember] public int? Axis { - get { return AxisElement != null ? AxisElement.Value : null; } + get => _AxisElement?.Value; set { - if (value == null) - AxisElement = null; - else - AxisElement = new Hl7.Fhir.Model.Integer(value); + AxisElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Axis"); } } @@ -281,24 +272,24 @@ public int? Axis [DataMember] public List Prism { - get { if(_Prism==null) _Prism = new List(); return _Prism; } + get => _Prism ?? new List(); set { _Prism = value; OnPropertyChanged("Prism"); } } - private List _Prism; + private List? _Prism; /// /// Added power for multifocal levels. /// [FhirElement("add", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AddElement + public Hl7.Fhir.Model.FhirDecimal? AddElement { get { return _AddElement; } set { _AddElement = value; OnPropertyChanged("AddElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AddElement; + private Hl7.Fhir.Model.FhirDecimal? _AddElement; /// /// Added power for multifocal levels @@ -307,13 +298,10 @@ public Hl7.Fhir.Model.FhirDecimal AddElement [IgnoreDataMember] public decimal? Add { - get { return AddElement != null ? AddElement.Value : null; } + get => _AddElement?.Value; set { - if (value == null) - AddElement = null; - else - AddElement = new Hl7.Fhir.Model.FhirDecimal(value); + AddElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Add"); } } @@ -323,13 +311,13 @@ public decimal? Add /// [FhirElement("power", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PowerElement + public Hl7.Fhir.Model.FhirDecimal? PowerElement { get { return _PowerElement; } set { _PowerElement = value; OnPropertyChanged("PowerElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PowerElement; + private Hl7.Fhir.Model.FhirDecimal? _PowerElement; /// /// Contact lens power @@ -338,13 +326,10 @@ public Hl7.Fhir.Model.FhirDecimal PowerElement [IgnoreDataMember] public decimal? Power { - get { return PowerElement != null ? PowerElement.Value : null; } + get => _PowerElement?.Value; set { - if (value == null) - PowerElement = null; - else - PowerElement = new Hl7.Fhir.Model.FhirDecimal(value); + PowerElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Power"); } } @@ -354,13 +339,13 @@ public decimal? Power /// [FhirElement("backCurve", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal BackCurveElement + public Hl7.Fhir.Model.FhirDecimal? BackCurveElement { get { return _BackCurveElement; } set { _BackCurveElement = value; OnPropertyChanged("BackCurveElement"); } } - private Hl7.Fhir.Model.FhirDecimal _BackCurveElement; + private Hl7.Fhir.Model.FhirDecimal? _BackCurveElement; /// /// Contact lens back curvature @@ -369,13 +354,10 @@ public Hl7.Fhir.Model.FhirDecimal BackCurveElement [IgnoreDataMember] public decimal? BackCurve { - get { return BackCurveElement != null ? BackCurveElement.Value : null; } + get => _BackCurveElement?.Value; set { - if (value == null) - BackCurveElement = null; - else - BackCurveElement = new Hl7.Fhir.Model.FhirDecimal(value); + BackCurveElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("BackCurve"); } } @@ -385,13 +367,13 @@ public decimal? BackCurve /// [FhirElement("diameter", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DiameterElement + public Hl7.Fhir.Model.FhirDecimal? DiameterElement { get { return _DiameterElement; } set { _DiameterElement = value; OnPropertyChanged("DiameterElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DiameterElement; + private Hl7.Fhir.Model.FhirDecimal? _DiameterElement; /// /// Contact lens diameter @@ -400,13 +382,10 @@ public Hl7.Fhir.Model.FhirDecimal DiameterElement [IgnoreDataMember] public decimal? Diameter { - get { return DiameterElement != null ? DiameterElement.Value : null; } + get => _DiameterElement?.Value; set { - if (value == null) - DiameterElement = null; - else - DiameterElement = new Hl7.Fhir.Model.FhirDecimal(value); + DiameterElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Diameter"); } } @@ -416,41 +395,38 @@ public decimal? Diameter /// [FhirElement("duration", Order=140)] [DataMember] - public Hl7.Fhir.Model.Quantity Duration + public Hl7.Fhir.Model.Quantity? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Quantity _Duration; + private Hl7.Fhir.Model.Quantity? _Duration; /// /// Color required. /// [FhirElement("color", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString ColorElement + public Hl7.Fhir.Model.FhirString? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Hl7.Fhir.Model.FhirString _ColorElement; + private Hl7.Fhir.Model.FhirString? _ColorElement; /// /// Color required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Color + public string? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Hl7.Fhir.Model.FhirString(value); + ColorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Color"); } } @@ -460,28 +436,25 @@ public string Color /// [FhirElement("brand", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString BrandElement + public Hl7.Fhir.Model.FhirString? BrandElement { get { return _BrandElement; } set { _BrandElement = value; OnPropertyChanged("BrandElement"); } } - private Hl7.Fhir.Model.FhirString _BrandElement; + private Hl7.Fhir.Model.FhirString? _BrandElement; /// /// Brand required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Brand + public string? Brand { - get { return BrandElement != null ? BrandElement.Value : null; } + get => _BrandElement?.Value; set { - if (value == null) - BrandElement = null; - else - BrandElement = new Hl7.Fhir.Model.FhirString(value); + BrandElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Brand"); } } @@ -494,36 +467,32 @@ public string Brand [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as LensSpecificationComponent; - - if (dest == null) - { + if(other is not LensSpecificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Product != null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)Product.DeepCopyInternal(); - if(EyeElement != null) dest.EyeElement = (Code)EyeElement.DeepCopyInternal(); - if(SphereElement != null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)SphereElement.DeepCopyInternal(); - if(CylinderElement != null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)CylinderElement.DeepCopyInternal(); - if(AxisElement != null) dest.AxisElement = (Hl7.Fhir.Model.Integer)AxisElement.DeepCopyInternal(); - if(Prism.Any()) dest.Prism = new List(Prism.DeepCopyInternal()); - if(AddElement != null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)AddElement.DeepCopyInternal(); - if(PowerElement != null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)PowerElement.DeepCopyInternal(); - if(BackCurveElement != null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)BackCurveElement.DeepCopyInternal(); - if(DiameterElement != null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)DiameterElement.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Quantity)Duration.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)ColorElement.DeepCopyInternal(); - if(BrandElement != null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)BrandElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)_Product.DeepCopyInternal(); + if(_EyeElement is not null) dest.EyeElement = (Code)_EyeElement.DeepCopyInternal(); + if(_SphereElement is not null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)_SphereElement.DeepCopyInternal(); + if(_CylinderElement is not null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)_CylinderElement.DeepCopyInternal(); + if(_AxisElement is not null) dest.AxisElement = (Hl7.Fhir.Model.Integer)_AxisElement.DeepCopyInternal(); + if(_Prism is not null) dest.Prism = new List(_Prism.DeepCopyInternal()); + if(_AddElement is not null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)_AddElement.DeepCopyInternal(); + if(_PowerElement is not null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)_PowerElement.DeepCopyInternal(); + if(_BackCurveElement is not null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)_BackCurveElement.DeepCopyInternal(); + if(_DiameterElement is not null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)_DiameterElement.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Quantity)_Duration.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)_ColorElement.DeepCopyInternal(); + if(_BrandElement is not null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)_BrandElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -535,125 +504,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LensSpecificationComponent; - if(otherT == null) return false; + if(other is not LensSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(EyeElement, otherT.EyeElement)) return false; - if(!comparer.Equals(SphereElement, otherT.SphereElement)) return false; - if(!comparer.Equals(CylinderElement, otherT.CylinderElement)) return false; - if(!comparer.Equals(AxisElement, otherT.AxisElement)) return false; - if(!comparer.ListEquals(Prism, otherT.Prism)) return false; - if(!comparer.Equals(AddElement, otherT.AddElement)) return false; - if(!comparer.Equals(PowerElement, otherT.PowerElement)) return false; - if(!comparer.Equals(BackCurveElement, otherT.BackCurveElement)) return false; - if(!comparer.Equals(DiameterElement, otherT.DiameterElement)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(BrandElement, otherT.BrandElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; + if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; + if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; + if(!comparer.Equals(_AxisElement, otherT._AxisElement)) return false; + if(!comparer.ListEquals(_Prism, otherT._Prism)) return false; + if(!comparer.Equals(_AddElement, otherT._AddElement)) return false; + if(!comparer.Equals(_PowerElement, otherT._PowerElement)) return false; + if(!comparer.Equals(_BackCurveElement, otherT._BackCurveElement)) return false; + if(!comparer.Equals(_DiameterElement, otherT._DiameterElement)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "eye": - value = EyeElement; - return EyeElement is not null; + value = _EyeElement; + return _EyeElement is not null; case "sphere": - value = SphereElement; - return SphereElement is not null; + value = _SphereElement; + return _SphereElement is not null; case "cylinder": - value = CylinderElement; - return CylinderElement is not null; + value = _CylinderElement; + return _CylinderElement is not null; case "axis": - value = AxisElement; - return AxisElement is not null; + value = _AxisElement; + return _AxisElement is not null; case "prism": - value = Prism; - return Prism?.Any() == true; + value = _Prism; + return _Prism?.Any() == true; case "add": - value = AddElement; - return AddElement is not null; + value = _AddElement; + return _AddElement is not null; case "power": - value = PowerElement; - return PowerElement is not null; + value = _PowerElement; + return _PowerElement is not null; case "backCurve": - value = BackCurveElement; - return BackCurveElement is not null; + value = _BackCurveElement; + return _BackCurveElement is not null; case "diameter": - value = DiameterElement; - return DiameterElement is not null; + value = _DiameterElement; + return _DiameterElement is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "brand": - value = BrandElement; - return BrandElement is not null; + value = _BrandElement; + return _BrandElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "product": - Product = (Hl7.Fhir.Model.CodeableConcept)value; + Product = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "eye": - EyeElement = (Code)value; + EyeElement = (Code?)value; return this; case "sphere": - SphereElement = (Hl7.Fhir.Model.FhirDecimal)value; + SphereElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "cylinder": - CylinderElement = (Hl7.Fhir.Model.FhirDecimal)value; + CylinderElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "axis": - AxisElement = (Hl7.Fhir.Model.Integer)value; + AxisElement = (Hl7.Fhir.Model.Integer?)value; return this; case "prism": - Prism = (List)value; + Prism = (List?)value!; return this; case "add": - AddElement = (Hl7.Fhir.Model.FhirDecimal)value; + AddElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "power": - PowerElement = (Hl7.Fhir.Model.FhirDecimal)value; + PowerElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "backCurve": - BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)value; + BackCurveElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "diameter": - DiameterElement = (Hl7.Fhir.Model.FhirDecimal)value; + DiameterElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Quantity)value; + Duration = (Hl7.Fhir.Model.Quantity?)value; return this; case "color": - ColorElement = (Hl7.Fhir.Model.FhirString)value; + ColorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "brand": - BrandElement = (Hl7.Fhir.Model.FhirString)value; + BrandElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -664,20 +633,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Product is not null) yield return new KeyValuePair("product",Product); - if (EyeElement is not null) yield return new KeyValuePair("eye",EyeElement); - if (SphereElement is not null) yield return new KeyValuePair("sphere",SphereElement); - if (CylinderElement is not null) yield return new KeyValuePair("cylinder",CylinderElement); - if (AxisElement is not null) yield return new KeyValuePair("axis",AxisElement); - if (Prism?.Any() == true) yield return new KeyValuePair("prism",Prism); - if (AddElement is not null) yield return new KeyValuePair("add",AddElement); - if (PowerElement is not null) yield return new KeyValuePair("power",PowerElement); - if (BackCurveElement is not null) yield return new KeyValuePair("backCurve",BackCurveElement); - if (DiameterElement is not null) yield return new KeyValuePair("diameter",DiameterElement); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (BrandElement is not null) yield return new KeyValuePair("brand",BrandElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_EyeElement is not null) yield return new KeyValuePair("eye",_EyeElement); + if (_SphereElement is not null) yield return new KeyValuePair("sphere",_SphereElement); + if (_CylinderElement is not null) yield return new KeyValuePair("cylinder",_CylinderElement); + if (_AxisElement is not null) yield return new KeyValuePair("axis",_AxisElement); + if (_Prism?.Any() == true) yield return new KeyValuePair("prism",_Prism); + if (_AddElement is not null) yield return new KeyValuePair("add",_AddElement); + if (_PowerElement is not null) yield return new KeyValuePair("power",_PowerElement); + if (_BackCurveElement is not null) yield return new KeyValuePair("backCurve",_BackCurveElement); + if (_DiameterElement is not null) yield return new KeyValuePair("diameter",_DiameterElement); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_BrandElement is not null) yield return new KeyValuePair("brand",_BrandElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -704,13 +673,13 @@ public partial class PrismComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("amount", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AmountElement + public Hl7.Fhir.Model.FhirDecimal? AmountElement { get { return _AmountElement; } set { _AmountElement = value; OnPropertyChanged("AmountElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AmountElement; + private Hl7.Fhir.Model.FhirDecimal? _AmountElement; /// /// Amount of adjustment @@ -719,13 +688,10 @@ public Hl7.Fhir.Model.FhirDecimal AmountElement [IgnoreDataMember] public decimal? Amount { - get { return AmountElement != null ? AmountElement.Value : null; } + get => _AmountElement?.Value; set { - if (value == null) - AmountElement = null; - else - AmountElement = new Hl7.Fhir.Model.FhirDecimal(value); + AmountElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Amount"); } } @@ -738,13 +704,13 @@ public decimal? Amount [Binding("VisionBase")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code BaseElement + public Code? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Code _BaseElement; + private Code? _BaseElement; /// /// up | down | in | out @@ -753,29 +719,22 @@ public Code BaseElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionBase? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Code(value); + BaseElement = value is null ? null : new Code(value); OnPropertyChanged("Base"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PrismComponent; - - if (dest == null) - { + if(other is not PrismComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AmountElement != null) dest.AmountElement = (Hl7.Fhir.Model.FhirDecimal)AmountElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Code)BaseElement.DeepCopyInternal(); + if(_AmountElement is not null) dest.AmountElement = (Hl7.Fhir.Model.FhirDecimal)_AmountElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Code)_BaseElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -787,41 +746,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrismComponent; - if(otherT == null) return false; + if(other is not PrismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AmountElement, otherT.AmountElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "amount": - value = AmountElement; - return AmountElement is not null; + value = _AmountElement; + return _AmountElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "amount": - AmountElement = (Hl7.Fhir.Model.FhirDecimal)value; + AmountElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "base": - BaseElement = (Code)value; + BaseElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -832,8 +791,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AmountElement is not null) yield return new KeyValuePair("amount",AmountElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); + if (_AmountElement is not null) yield return new KeyValuePair("amount",_AmountElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); } } @@ -846,11 +805,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -860,13 +819,13 @@ public List Identifier [Binding("VisionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -875,13 +834,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -892,28 +848,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("created", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -926,13 +879,13 @@ public string Created [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Created during encounter / admission / stay. @@ -941,13 +894,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When prescription was authorized. @@ -955,28 +908,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("dateWritten", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateWrittenElement + public Hl7.Fhir.Model.FhirDateTime? DateWrittenElement { get { return _DateWrittenElement; } set { _DateWrittenElement = value; OnPropertyChanged("DateWrittenElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateWrittenElement; + private Hl7.Fhir.Model.FhirDateTime? _DateWrittenElement; /// /// When prescription was authorized /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateWritten + public string? DateWritten { - get { return DateWrittenElement != null ? DateWrittenElement.Value : null; } + get => _DateWrittenElement?.Value; set { - if (value == null) - DateWrittenElement = null; - else - DateWrittenElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateWrittenElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateWritten"); } } @@ -989,13 +939,13 @@ public string DateWritten [References("Practitioner","PractitionerRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescriber + public Hl7.Fhir.Model.ResourceReference? Prescriber { get { return _Prescriber; } set { _Prescriber = value; OnPropertyChanged("Prescriber"); } } - private Hl7.Fhir.Model.ResourceReference _Prescriber; + private Hl7.Fhir.Model.ResourceReference? _Prescriber; /// /// Vision lens authorization. @@ -1005,32 +955,28 @@ public Hl7.Fhir.Model.ResourceReference Prescriber [DataMember] public List LensSpecification { - get { if(_LensSpecification==null) _LensSpecification = new List(); return _LensSpecification; } + get => _LensSpecification ?? new List(); set { _LensSpecification = value; OnPropertyChanged("LensSpecification"); } } - private List _LensSpecification; + private List? _LensSpecification; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as VisionPrescription; - - if (dest == null) - { + if(other is not VisionPrescription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateWrittenElement != null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)DateWrittenElement.DeepCopyInternal(); - if(Prescriber != null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)Prescriber.DeepCopyInternal(); - if(LensSpecification.Any()) dest.LensSpecification = new List(LensSpecification.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateWrittenElement is not null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)_DateWrittenElement.DeepCopyInternal(); + if(_Prescriber is not null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)_Prescriber.DeepCopyInternal(); + if(_LensSpecification is not null) dest.LensSpecification = new List(_LensSpecification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1042,83 +988,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VisionPrescription; - if(otherT == null) return false; + if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateWrittenElement, otherT.DateWrittenElement)) return false; - if(!comparer.Equals(Prescriber, otherT.Prescriber)) return false; - if(!comparer.ListEquals(LensSpecification, otherT.LensSpecification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateWrittenElement, otherT._DateWrittenElement)) return false; + if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; + if(!comparer.ListEquals(_LensSpecification, otherT._LensSpecification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "dateWritten": - value = DateWrittenElement; - return DateWrittenElement is not null; + value = _DateWrittenElement; + return _DateWrittenElement is not null; case "prescriber": - value = Prescriber; - return Prescriber is not null; + value = _Prescriber; + return _Prescriber is not null; case "lensSpecification": - value = LensSpecification; - return LensSpecification?.Any() == true; + value = _LensSpecification; + return _LensSpecification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateWritten": - DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "prescriber": - Prescriber = (Hl7.Fhir.Model.ResourceReference)value; + Prescriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lensSpecification": - LensSpecification = (List)value; + LensSpecification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1129,14 +1075,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",DateWrittenElement); - if (Prescriber is not null) yield return new KeyValuePair("prescriber",Prescriber); - if (LensSpecification?.Any() == true) yield return new KeyValuePair("lensSpecification",LensSpecification); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",_DateWrittenElement); + if (_Prescriber is not null) yield return new KeyValuePair("prescriber",_Prescriber); + if (_LensSpecification?.Any() == true) yield return new KeyValuePair("lensSpecification",_LensSpecification); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Account.cs b/src/Hl7.Fhir.R5/Model/Generated/Account.cs index cdd338c4e..516eb614f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Account.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -125,26 +128,26 @@ public partial class CoverageComponent : Hl7.Fhir.Model.BackboneElement [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// The priority of the coverage in the context of this account. /// [FhirElement("priority", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PriorityElement + public Hl7.Fhir.Model.PositiveInt? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Hl7.Fhir.Model.PositiveInt _PriorityElement; + private Hl7.Fhir.Model.PositiveInt? _PriorityElement; /// /// The priority of the coverage in the context of this account @@ -153,29 +156,22 @@ public Hl7.Fhir.Model.PositiveInt PriorityElement [IgnoreDataMember] public int? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Hl7.Fhir.Model.PositiveInt(value); + PriorityElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Priority"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageComponent; - - if (dest == null) - { + if(other is not CoverageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)PriorityElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)_PriorityElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -187,41 +183,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageComponent; - if(otherT == null) return false; + if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - PriorityElement = (Hl7.Fhir.Model.PositiveInt)value; + PriorityElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -232,8 +228,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); } } @@ -262,26 +258,26 @@ public partial class GuarantorComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Credit or other hold applied. /// [FhirElement("onHold", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OnHoldElement + public Hl7.Fhir.Model.FhirBoolean? OnHoldElement { get { return _OnHoldElement; } set { _OnHoldElement = value; OnPropertyChanged("OnHoldElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OnHoldElement; + private Hl7.Fhir.Model.FhirBoolean? _OnHoldElement; /// /// Credit or other hold applied @@ -290,13 +286,10 @@ public Hl7.Fhir.Model.FhirBoolean OnHoldElement [IgnoreDataMember] public bool? OnHold { - get { return OnHoldElement != null ? OnHoldElement.Value : null; } + get => _OnHoldElement?.Value; set { - if (value == null) - OnHoldElement = null; - else - OnHoldElement = new Hl7.Fhir.Model.FhirBoolean(value); + OnHoldElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("OnHold"); } } @@ -306,27 +299,23 @@ public bool? OnHold /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as GuarantorComponent; - - if (dest == null) - { + if(other is not GuarantorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(OnHoldElement != null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)OnHoldElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_OnHoldElement is not null) dest.OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)_OnHoldElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -338,48 +327,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuarantorComponent; - if(otherT == null) return false; + if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.Equals(OnHoldElement, otherT.OnHoldElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "onHold": - value = OnHoldElement; - return OnHoldElement is not null; + value = _OnHoldElement; + return _OnHoldElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onHold": - OnHoldElement = (Hl7.Fhir.Model.FhirBoolean)value; + OnHoldElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -390,9 +379,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Party is not null) yield return new KeyValuePair("party",Party); - if (OnHoldElement is not null) yield return new KeyValuePair("onHold",OnHoldElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_OnHoldElement is not null) yield return new KeyValuePair("onHold",_OnHoldElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -418,13 +407,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("sequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Ranking of the diagnosis (for each type) @@ -433,13 +422,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -451,41 +437,38 @@ public int? Sequence [Binding("condition-code")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Condition + public Hl7.Fhir.Model.CodeableReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.CodeableReference _Condition; + private Hl7.Fhir.Model.CodeableReference? _Condition; /// /// Date of the diagnosis (when coded diagnosis). /// [FhirElement("dateOfDiagnosis", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateOfDiagnosisElement + public Hl7.Fhir.Model.FhirDateTime? DateOfDiagnosisElement { get { return _DateOfDiagnosisElement; } set { _DateOfDiagnosisElement = value; OnPropertyChanged("DateOfDiagnosisElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateOfDiagnosisElement; + private Hl7.Fhir.Model.FhirDateTime? _DateOfDiagnosisElement; /// /// Date of the diagnosis (when coded diagnosis) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateOfDiagnosis + public string? DateOfDiagnosis { - get { return DateOfDiagnosisElement != null ? DateOfDiagnosisElement.Value : null; } + get => _DateOfDiagnosisElement?.Value; set { - if (value == null) - DateOfDiagnosisElement = null; - else - DateOfDiagnosisElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateOfDiagnosisElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateOfDiagnosis"); } } @@ -499,24 +482,24 @@ public string DateOfDiagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Diagnosis present on Admission. /// [FhirElement("onAdmission", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OnAdmissionElement + public Hl7.Fhir.Model.FhirBoolean? OnAdmissionElement { get { return _OnAdmissionElement; } set { _OnAdmissionElement = value; OnPropertyChanged("OnAdmissionElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OnAdmissionElement; + private Hl7.Fhir.Model.FhirBoolean? _OnAdmissionElement; /// /// Diagnosis present on Admission @@ -525,13 +508,10 @@ public Hl7.Fhir.Model.FhirBoolean OnAdmissionElement [IgnoreDataMember] public bool? OnAdmission { - get { return OnAdmissionElement != null ? OnAdmissionElement.Value : null; } + get => _OnAdmissionElement?.Value; set { - if (value == null) - OnAdmissionElement = null; - else - OnAdmissionElement = new Hl7.Fhir.Model.FhirBoolean(value); + OnAdmissionElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("OnAdmission"); } } @@ -545,28 +525,24 @@ public bool? OnAdmission [DataMember] public List PackageCode { - get { if(_PackageCode==null) _PackageCode = new List(); return _PackageCode; } + get => _PackageCode ?? new List(); set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private List _PackageCode; + private List? _PackageCode; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.CodeableReference)Condition.DeepCopyInternal(); - if(DateOfDiagnosisElement != null) dest.DateOfDiagnosisElement = (Hl7.Fhir.Model.FhirDateTime)DateOfDiagnosisElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(OnAdmissionElement != null) dest.OnAdmissionElement = (Hl7.Fhir.Model.FhirBoolean)OnAdmissionElement.DeepCopyInternal(); - if(PackageCode.Any()) dest.PackageCode = new List(PackageCode.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.CodeableReference)_Condition.DeepCopyInternal(); + if(_DateOfDiagnosisElement is not null) dest.DateOfDiagnosisElement = (Hl7.Fhir.Model.FhirDateTime)_DateOfDiagnosisElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_OnAdmissionElement is not null) dest.OnAdmissionElement = (Hl7.Fhir.Model.FhirBoolean)_OnAdmissionElement.DeepCopyInternal(); + if(_PackageCode is not null) dest.PackageCode = new List(_PackageCode.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -578,69 +554,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(DateOfDiagnosisElement, otherT.DateOfDiagnosisElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(OnAdmissionElement, otherT.OnAdmissionElement)) return false; - if(!comparer.ListEquals(PackageCode, otherT.PackageCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_DateOfDiagnosisElement, otherT._DateOfDiagnosisElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OnAdmissionElement, otherT._OnAdmissionElement)) return false; + if(!comparer.ListEquals(_PackageCode, otherT._PackageCode)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "dateOfDiagnosis": - value = DateOfDiagnosisElement; - return DateOfDiagnosisElement is not null; + value = _DateOfDiagnosisElement; + return _DateOfDiagnosisElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "onAdmission": - value = OnAdmissionElement; - return OnAdmissionElement is not null; + value = _OnAdmissionElement; + return _OnAdmissionElement is not null; case "packageCode": - value = PackageCode; - return PackageCode?.Any() == true; + value = _PackageCode; + return _PackageCode?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "condition": - Condition = (Hl7.Fhir.Model.CodeableReference)value; + Condition = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "dateOfDiagnosis": - DateOfDiagnosisElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateOfDiagnosisElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "onAdmission": - OnAdmissionElement = (Hl7.Fhir.Model.FhirBoolean)value; + OnAdmissionElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "packageCode": - PackageCode = (List)value; + PackageCode = (List?)value!; return this; default: return base.SetValue(key, value); @@ -651,12 +627,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (DateOfDiagnosisElement is not null) yield return new KeyValuePair("dateOfDiagnosis",DateOfDiagnosisElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (OnAdmissionElement is not null) yield return new KeyValuePair("onAdmission",OnAdmissionElement); - if (PackageCode?.Any() == true) yield return new KeyValuePair("packageCode",PackageCode); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_DateOfDiagnosisElement is not null) yield return new KeyValuePair("dateOfDiagnosis",_DateOfDiagnosisElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_OnAdmissionElement is not null) yield return new KeyValuePair("onAdmission",_OnAdmissionElement); + if (_PackageCode?.Any() == true) yield return new KeyValuePair("packageCode",_PackageCode); } } @@ -682,13 +658,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("sequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Ranking of the procedure (for each type) @@ -697,13 +673,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -714,41 +687,38 @@ public int? Sequence [FhirElement("code", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Code + public Hl7.Fhir.Model.CodeableReference? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableReference _Code; + private Hl7.Fhir.Model.CodeableReference? _Code; /// /// Date of the procedure (when coded procedure). /// [FhirElement("dateOfService", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateOfServiceElement + public Hl7.Fhir.Model.FhirDateTime? DateOfServiceElement { get { return _DateOfServiceElement; } set { _DateOfServiceElement = value; OnPropertyChanged("DateOfServiceElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateOfServiceElement; + private Hl7.Fhir.Model.FhirDateTime? _DateOfServiceElement; /// /// Date of the procedure (when coded procedure) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateOfService + public string? DateOfService { - get { return DateOfServiceElement != null ? DateOfServiceElement.Value : null; } + get => _DateOfServiceElement?.Value; set { - if (value == null) - DateOfServiceElement = null; - else - DateOfServiceElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateOfServiceElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateOfService"); } } @@ -762,11 +732,11 @@ public string DateOfService [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Package Code specific for billing. @@ -777,11 +747,11 @@ public List Type [DataMember] public List PackageCode { - get { if(_PackageCode==null) _PackageCode = new List(); return _PackageCode; } + get => _PackageCode ?? new List(); set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } - private List _PackageCode; + private List? _PackageCode; /// /// Any devices that were associated with the procedure. @@ -793,28 +763,24 @@ public List PackageCode [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableReference)Code.DeepCopyInternal(); - if(DateOfServiceElement != null) dest.DateOfServiceElement = (Hl7.Fhir.Model.FhirDateTime)DateOfServiceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(PackageCode.Any()) dest.PackageCode = new List(PackageCode.DeepCopyInternal()); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableReference)_Code.DeepCopyInternal(); + if(_DateOfServiceElement is not null) dest.DateOfServiceElement = (Hl7.Fhir.Model.FhirDateTime)_DateOfServiceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_PackageCode is not null) dest.PackageCode = new List(_PackageCode.DeepCopyInternal()); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -826,69 +792,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DateOfServiceElement, otherT.DateOfServiceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(PackageCode, otherT.PackageCode)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DateOfServiceElement, otherT._DateOfServiceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_PackageCode, otherT._PackageCode)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "dateOfService": - value = DateOfServiceElement; - return DateOfServiceElement is not null; + value = _DateOfServiceElement; + return _DateOfServiceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "packageCode": - value = PackageCode; - return PackageCode?.Any() == true; + value = _PackageCode; + return _PackageCode?.Any() == true; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableReference)value; + Code = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "dateOfService": - DateOfServiceElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateOfServiceElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "packageCode": - PackageCode = (List)value; + PackageCode = (List?)value!; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; default: return base.SetValue(key, value); @@ -899,12 +865,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DateOfServiceElement is not null) yield return new KeyValuePair("dateOfService",DateOfServiceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (PackageCode?.Any() == true) yield return new KeyValuePair("packageCode",PackageCode); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DateOfServiceElement is not null) yield return new KeyValuePair("dateOfService",_DateOfServiceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_PackageCode?.Any() == true) yield return new KeyValuePair("packageCode",_PackageCode); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); } } @@ -928,13 +894,13 @@ public partial class RelatedAccountComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("relationship", Order=40)] [Binding("AccountRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// Reference to an associated Account. @@ -944,26 +910,22 @@ public Hl7.Fhir.Model.CodeableConcept Relationship [References("Account")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Account + public Hl7.Fhir.Model.ResourceReference? Account { get { return _Account; } set { _Account = value; OnPropertyChanged("Account"); } } - private Hl7.Fhir.Model.ResourceReference _Account; + private Hl7.Fhir.Model.ResourceReference? _Account; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedAccountComponent; - - if (dest == null) - { + if(other is not RelatedAccountComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Account != null) dest.Account = (Hl7.Fhir.Model.ResourceReference)Account.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Account is not null) dest.Account = (Hl7.Fhir.Model.ResourceReference)_Account.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -975,41 +937,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedAccountComponent; - if(otherT == null) return false; + if(other is not RelatedAccountComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Account, otherT.Account)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Account, otherT._Account)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "account": - value = Account; - return Account is not null; + value = _Account; + return _Account is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "account": - Account = (Hl7.Fhir.Model.ResourceReference)value; + Account = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1020,8 +982,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Account is not null) yield return new KeyValuePair("account",Account); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Account is not null) yield return new KeyValuePair("account",_Account); } } @@ -1049,13 +1011,13 @@ public partial class BalanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("aggregate", Order=40)] [Binding("AccountAggregate")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Aggregate + public Hl7.Fhir.Model.CodeableConcept? Aggregate { get { return _Aggregate; } set { _Aggregate = value; OnPropertyChanged("Aggregate"); } } - private Hl7.Fhir.Model.CodeableConcept _Aggregate; + private Hl7.Fhir.Model.CodeableConcept? _Aggregate; /// /// current | 30 | 60 | 90 | 120. @@ -1063,26 +1025,26 @@ public Hl7.Fhir.Model.CodeableConcept Aggregate [FhirElement("term", Order=50)] [Binding("AccountBalanceTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Estimated balance. /// [FhirElement("estimate", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EstimateElement + public Hl7.Fhir.Model.FhirBoolean? EstimateElement { get { return _EstimateElement; } set { _EstimateElement = value; OnPropertyChanged("EstimateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EstimateElement; + private Hl7.Fhir.Model.FhirBoolean? _EstimateElement; /// /// Estimated balance @@ -1091,13 +1053,10 @@ public Hl7.Fhir.Model.FhirBoolean EstimateElement [IgnoreDataMember] public bool? Estimate { - get { return EstimateElement != null ? EstimateElement.Value : null; } + get => _EstimateElement?.Value; set { - if (value == null) - EstimateElement = null; - else - EstimateElement = new Hl7.Fhir.Model.FhirBoolean(value); + EstimateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Estimate"); } } @@ -1108,28 +1067,24 @@ public bool? Estimate [FhirElement("amount", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as BalanceComponent; - - if (dest == null) - { + if(other is not BalanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Aggregate != null) dest.Aggregate = (Hl7.Fhir.Model.CodeableConcept)Aggregate.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(EstimateElement != null) dest.EstimateElement = (Hl7.Fhir.Model.FhirBoolean)EstimateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Aggregate is not null) dest.Aggregate = (Hl7.Fhir.Model.CodeableConcept)_Aggregate.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_EstimateElement is not null) dest.EstimateElement = (Hl7.Fhir.Model.FhirBoolean)_EstimateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1141,55 +1096,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BalanceComponent; - if(otherT == null) return false; + if(other is not BalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Aggregate, otherT.Aggregate)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.Equals(EstimateElement, otherT.EstimateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Aggregate, otherT._Aggregate)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.Equals(_EstimateElement, otherT._EstimateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "aggregate": - value = Aggregate; - return Aggregate is not null; + value = _Aggregate; + return _Aggregate is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "estimate": - value = EstimateElement; - return EstimateElement is not null; + value = _EstimateElement; + return _EstimateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "aggregate": - Aggregate = (Hl7.Fhir.Model.CodeableConcept)value; + Aggregate = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "estimate": - EstimateElement = (Hl7.Fhir.Model.FhirBoolean)value; + EstimateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -1200,10 +1155,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Aggregate is not null) yield return new KeyValuePair("aggregate",Aggregate); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (EstimateElement is not null) yield return new KeyValuePair("estimate",EstimateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Aggregate is not null) yield return new KeyValuePair("aggregate",_Aggregate); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_EstimateElement is not null) yield return new KeyValuePair("estimate",_EstimateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -1216,11 +1171,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error | on-hold | unknown. @@ -1230,13 +1185,13 @@ public List Identifier [Binding("AccountStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error | on-hold | unknown @@ -1245,13 +1200,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Account.AccountStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1262,13 +1214,13 @@ public Hl7.Fhir.Model.Account.AccountStatus? Status [FhirElement("billingStatus", InSummary=true, Order=110)] [Binding("AccountBillingStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BillingStatus + public Hl7.Fhir.Model.CodeableConcept? BillingStatus { get { return _BillingStatus; } set { _BillingStatus = value; OnPropertyChanged("BillingStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _BillingStatus; + private Hl7.Fhir.Model.CodeableConcept? _BillingStatus; /// /// E.g. patient, expense, depreciation. @@ -1276,41 +1228,38 @@ public Hl7.Fhir.Model.CodeableConcept BillingStatus [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Binding("AccountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Human-readable label. /// [FhirElement("name", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1325,24 +1274,24 @@ public string Name [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Transaction window. /// [FhirElement("servicePeriod", InSummary=true, Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ServicePeriod + public Hl7.Fhir.Model.Period? ServicePeriod { get { return _ServicePeriod; } set { _ServicePeriod = value; OnPropertyChanged("ServicePeriod"); } } - private Hl7.Fhir.Model.Period _ServicePeriod; + private Hl7.Fhir.Model.Period? _ServicePeriod; /// /// The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account. @@ -1352,11 +1301,11 @@ public Hl7.Fhir.Model.Period ServicePeriod [DataMember] public List Coverage { - get { if(_Coverage==null) _Coverage = new List(); return _Coverage; } + get => _Coverage ?? new List(); set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private List _Coverage; + private List? _Coverage; /// /// Entity managing the Account. @@ -1365,41 +1314,38 @@ public List Coverage [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Explanation of purpose/use. /// [FhirElement("description", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Explanation of purpose/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1412,11 +1358,11 @@ public string Description [DataMember] public List Guarantor { - get { if(_Guarantor==null) _Guarantor = new List(); return _Guarantor; } + get => _Guarantor ?? new List(); set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } - private List _Guarantor; + private List? _Guarantor; /// /// The list of diagnoses relevant to this account. @@ -1426,11 +1372,11 @@ public List Guarantor [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The list of procedures relevant to this account. @@ -1440,11 +1386,11 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Other associated accounts related to this account. @@ -1454,11 +1400,11 @@ public List Procedure [DataMember] public List RelatedAccount { - get { if(_RelatedAccount==null) _RelatedAccount = new List(); return _RelatedAccount; } + get => _RelatedAccount ?? new List(); set { _RelatedAccount = value; OnPropertyChanged("RelatedAccount"); } } - private List _RelatedAccount; + private List? _RelatedAccount; /// /// The base or default currency. @@ -1466,13 +1412,13 @@ public List RelatedAccount [FhirElement("currency", Order=230)] [Binding("AccountCurrency")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Currency + public Hl7.Fhir.Model.CodeableConcept? Currency { get { return _Currency; } set { _Currency = value; OnPropertyChanged("Currency"); } } - private Hl7.Fhir.Model.CodeableConcept _Currency; + private Hl7.Fhir.Model.CodeableConcept? _Currency; /// /// Calculated account balance(s). @@ -1482,24 +1428,24 @@ public Hl7.Fhir.Model.CodeableConcept Currency [DataMember] public List Balance { - get { if(_Balance==null) _Balance = new List(); return _Balance; } + get => _Balance ?? new List(); set { _Balance = value; OnPropertyChanged("Balance"); } } - private List _Balance; + private List? _Balance; /// /// Time the balance amount was calculated. /// [FhirElement("calculatedAt", Order=250)] [DataMember] - public Hl7.Fhir.Model.Instant CalculatedAtElement + public Hl7.Fhir.Model.Instant? CalculatedAtElement { get { return _CalculatedAtElement; } set { _CalculatedAtElement = value; OnPropertyChanged("CalculatedAtElement"); } } - private Hl7.Fhir.Model.Instant _CalculatedAtElement; + private Hl7.Fhir.Model.Instant? _CalculatedAtElement; /// /// Time the balance amount was calculated @@ -1508,13 +1454,10 @@ public Hl7.Fhir.Model.Instant CalculatedAtElement [IgnoreDataMember] public DateTimeOffset? CalculatedAt { - get { return CalculatedAtElement != null ? CalculatedAtElement.Value : null; } + get => _CalculatedAtElement?.Value; set { - if (value == null) - CalculatedAtElement = null; - else - CalculatedAtElement = new Hl7.Fhir.Model.Instant(value); + CalculatedAtElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("CalculatedAt"); } } @@ -1523,31 +1466,27 @@ public DateTimeOffset? CalculatedAt protected internal override void CopyToInternal(Base other) { - var dest = other as Account; - - if (dest == null) - { + if(other is not Account dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(BillingStatus != null) dest.BillingStatus = (Hl7.Fhir.Model.CodeableConcept)BillingStatus.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(ServicePeriod != null) dest.ServicePeriod = (Hl7.Fhir.Model.Period)ServicePeriod.DeepCopyInternal(); - if(Coverage.Any()) dest.Coverage = new List(Coverage.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Guarantor.Any()) dest.Guarantor = new List(Guarantor.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(RelatedAccount.Any()) dest.RelatedAccount = new List(RelatedAccount.DeepCopyInternal()); - if(Currency != null) dest.Currency = (Hl7.Fhir.Model.CodeableConcept)Currency.DeepCopyInternal(); - if(Balance.Any()) dest.Balance = new List(Balance.DeepCopyInternal()); - if(CalculatedAtElement != null) dest.CalculatedAtElement = (Hl7.Fhir.Model.Instant)CalculatedAtElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_BillingStatus is not null) dest.BillingStatus = (Hl7.Fhir.Model.CodeableConcept)_BillingStatus.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_ServicePeriod is not null) dest.ServicePeriod = (Hl7.Fhir.Model.Period)_ServicePeriod.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = new List(_Coverage.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Guarantor is not null) dest.Guarantor = new List(_Guarantor.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_RelatedAccount is not null) dest.RelatedAccount = new List(_RelatedAccount.DeepCopyInternal()); + if(_Currency is not null) dest.Currency = (Hl7.Fhir.Model.CodeableConcept)_Currency.DeepCopyInternal(); + if(_Balance is not null) dest.Balance = new List(_Balance.DeepCopyInternal()); + if(_CalculatedAtElement is not null) dest.CalculatedAtElement = (Hl7.Fhir.Model.Instant)_CalculatedAtElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1559,146 +1498,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Account; - if(otherT == null) return false; + if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(BillingStatus, otherT.BillingStatus)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(ServicePeriod, otherT.ServicePeriod)) return false; - if(!comparer.ListEquals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Guarantor, otherT.Guarantor)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(RelatedAccount, otherT.RelatedAccount)) return false; - if(!comparer.Equals(Currency, otherT.Currency)) return false; - if(!comparer.ListEquals(Balance, otherT.Balance)) return false; - if(!comparer.Equals(CalculatedAtElement, otherT.CalculatedAtElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_BillingStatus, otherT._BillingStatus)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_ServicePeriod, otherT._ServicePeriod)) return false; + if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Guarantor, otherT._Guarantor)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_RelatedAccount, otherT._RelatedAccount)) return false; + if(!comparer.Equals(_Currency, otherT._Currency)) return false; + if(!comparer.ListEquals(_Balance, otherT._Balance)) return false; + if(!comparer.Equals(_CalculatedAtElement, otherT._CalculatedAtElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "billingStatus": - value = BillingStatus; - return BillingStatus is not null; + value = _BillingStatus; + return _BillingStatus is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "servicePeriod": - value = ServicePeriod; - return ServicePeriod is not null; + value = _ServicePeriod; + return _ServicePeriod is not null; case "coverage": - value = Coverage; - return Coverage?.Any() == true; + value = _Coverage; + return _Coverage?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "guarantor": - value = Guarantor; - return Guarantor?.Any() == true; + value = _Guarantor; + return _Guarantor?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "relatedAccount": - value = RelatedAccount; - return RelatedAccount?.Any() == true; + value = _RelatedAccount; + return _RelatedAccount?.Any() == true; case "currency": - value = Currency; - return Currency is not null; + value = _Currency; + return _Currency is not null; case "balance": - value = Balance; - return Balance?.Any() == true; + value = _Balance; + return _Balance?.Any() == true; case "calculatedAt": - value = CalculatedAtElement; - return CalculatedAtElement is not null; + value = _CalculatedAtElement; + return _CalculatedAtElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "billingStatus": - BillingStatus = (Hl7.Fhir.Model.CodeableConcept)value; + BillingStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "servicePeriod": - ServicePeriod = (Hl7.Fhir.Model.Period)value; + ServicePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "coverage": - Coverage = (List)value; + Coverage = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "guarantor": - Guarantor = (List)value; + Guarantor = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "relatedAccount": - RelatedAccount = (List)value; + RelatedAccount = (List?)value!; return this; case "currency": - Currency = (Hl7.Fhir.Model.CodeableConcept)value; + Currency = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "balance": - Balance = (List)value; + Balance = (List?)value!; return this; case "calculatedAt": - CalculatedAtElement = (Hl7.Fhir.Model.Instant)value; + CalculatedAtElement = (Hl7.Fhir.Model.Instant?)value; return this; default: return base.SetValue(key, value); @@ -1709,23 +1648,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (BillingStatus is not null) yield return new KeyValuePair("billingStatus",BillingStatus); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (ServicePeriod is not null) yield return new KeyValuePair("servicePeriod",ServicePeriod); - if (Coverage?.Any() == true) yield return new KeyValuePair("coverage",Coverage); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",Guarantor); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (RelatedAccount?.Any() == true) yield return new KeyValuePair("relatedAccount",RelatedAccount); - if (Currency is not null) yield return new KeyValuePair("currency",Currency); - if (Balance?.Any() == true) yield return new KeyValuePair("balance",Balance); - if (CalculatedAtElement is not null) yield return new KeyValuePair("calculatedAt",CalculatedAtElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_BillingStatus is not null) yield return new KeyValuePair("billingStatus",_BillingStatus); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_ServicePeriod is not null) yield return new KeyValuePair("servicePeriod",_ServicePeriod); + if (_Coverage?.Any() == true) yield return new KeyValuePair("coverage",_Coverage); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Guarantor?.Any() == true) yield return new KeyValuePair("guarantor",_Guarantor); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_RelatedAccount?.Any() == true) yield return new KeyValuePair("relatedAccount",_RelatedAccount); + if (_Currency is not null) yield return new KeyValuePair("currency",_Currency); + if (_Balance?.Any() == true) yield return new KeyValuePair("balance",_Balance); + if (_CalculatedAtElement is not null) yield return new KeyValuePair("calculatedAt",_CalculatedAtElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs index 8df8193b2..2e63f3701 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -194,13 +197,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ActivityParticipantType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson @@ -209,13 +212,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -225,28 +225,25 @@ public Hl7.Fhir.Model.ActionParticipantType? Type /// [FhirElement("typeCanonical", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical TypeCanonicalElement + public Hl7.Fhir.Model.Canonical? TypeCanonicalElement { get { return _TypeCanonicalElement; } set { _TypeCanonicalElement = value; OnPropertyChanged("TypeCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _TypeCanonicalElement; + private Hl7.Fhir.Model.Canonical? _TypeCanonicalElement; /// /// Who or what can participate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TypeCanonical + public string? TypeCanonical { - get { return TypeCanonicalElement != null ? TypeCanonicalElement.Value : null; } + get => _TypeCanonicalElement?.Value; set { - if (value == null) - TypeCanonicalElement = null; - else - TypeCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + TypeCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("TypeCanonical"); } } @@ -258,13 +255,13 @@ public string TypeCanonical [CLSCompliant(false)] [References("CareTeam","Device","DeviceDefinition","Endpoint","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference TypeReference + public Hl7.Fhir.Model.ResourceReference? TypeReference { get { return _TypeReference; } set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } - private Hl7.Fhir.Model.ResourceReference _TypeReference; + private Hl7.Fhir.Model.ResourceReference? _TypeReference; /// /// E.g. Nurse, Surgeon, Parent, etc. @@ -272,13 +269,13 @@ public Hl7.Fhir.Model.ResourceReference TypeReference [FhirElement("role", Order=70)] [Binding("ActivityParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// E.g. Author, Reviewer, Witness, etc. @@ -286,29 +283,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("function", Order=80)] [Binding("ActionParticipantFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TypeCanonicalElement != null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)TypeCanonicalElement.DeepCopyInternal(); - if(TypeReference != null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)TypeReference.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TypeCanonicalElement is not null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)_TypeCanonicalElement.DeepCopyInternal(); + if(_TypeReference is not null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)_TypeReference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -320,62 +313,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TypeCanonicalElement, otherT.TypeCanonicalElement)) return false; - if(!comparer.Equals(TypeReference, otherT.TypeReference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; + if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Function, otherT._Function)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "typeCanonical": - value = TypeCanonicalElement; - return TypeCanonicalElement is not null; + value = _TypeCanonicalElement; + return _TypeCanonicalElement is not null; case "typeReference": - value = TypeReference; - return TypeReference is not null; + value = _TypeReference; + return _TypeReference is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "typeCanonical": - TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + TypeCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "typeReference": - TypeReference = (Hl7.Fhir.Model.ResourceReference)value; + TypeReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -386,11 +379,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",TypeCanonicalElement); - if (TypeReference is not null) yield return new KeyValuePair("typeReference",TypeReference); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Function is not null) yield return new KeyValuePair("function",Function); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",_TypeCanonicalElement); + if (_TypeReference is not null) yield return new KeyValuePair("typeReference",_TypeReference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Function is not null) yield return new KeyValuePair("function",_Function); } } @@ -418,28 +411,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("path", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -450,26 +440,22 @@ public string Path [FhirElement("expression", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -481,41 +467,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -526,8 +512,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -537,28 +523,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this activity definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -571,39 +554,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the activity definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -615,41 +595,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this activity definition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this activity definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -659,28 +636,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this activity definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -690,28 +664,25 @@ public string Title /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -724,13 +695,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -739,13 +710,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -755,13 +723,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -770,13 +738,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -790,41 +755,38 @@ public bool? Experimental [References("Group","MedicinalProductDefinition","SubstanceDefinition","AdministrableProductDefinition","ManufacturedItemDefinition","PackagedProductDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -834,28 +796,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -868,39 +827,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the activity definition. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -913,11 +869,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for activity definition (if applicable). @@ -928,39 +884,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this activity definition is defined. /// [FhirElement("purpose", Order=250, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this activity definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -970,28 +923,25 @@ public string Purpose /// [FhirElement("usage", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown UsageElement + public Hl7.Fhir.Model.Markdown? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.Markdown _UsageElement; + private Hl7.Fhir.Model.Markdown? _UsageElement; /// /// Describes the clinical usage of the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.Markdown(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Usage"); } } @@ -1001,28 +951,25 @@ public string Usage /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1032,28 +979,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1063,28 +1007,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the activity definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1094,28 +1035,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the activity definition was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1125,13 +1063,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -1142,11 +1080,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -1156,11 +1094,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1170,11 +1108,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1184,11 +1122,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1198,11 +1136,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1212,11 +1150,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the activity definition. @@ -1226,24 +1164,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the activity definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1257,13 +1195,13 @@ public IEnumerable Library [DeclaredType(Type = typeof(Code))] [Binding("ActivityDefinitionKind")] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// Kind of resource @@ -1272,13 +1210,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActivityDefinition.RequestResourceTypes? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1288,28 +1223,25 @@ public Hl7.Fhir.Model.ActivityDefinition.RequestResourceTypes? Kind /// [FhirElement("profile", Order=400)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// What profile the resource needs to conform to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -1320,13 +1252,13 @@ public string Profile [FhirElement("code", InSummary=true, Order=410)] [Binding("ActivityDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option. @@ -1335,13 +1267,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("RequestIntent")] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -1350,13 +1282,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -1368,13 +1297,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -1383,13 +1312,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -1399,13 +1325,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=440)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if the activity should not be performed @@ -1414,13 +1340,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -1432,13 +1355,13 @@ public bool? DoNotPerform [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Preconditions for service. @@ -1448,26 +1371,26 @@ public Hl7.Fhir.Model.DataType Timing [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Where it should happen. /// [FhirElement("location", Order=470)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Location + public Hl7.Fhir.Model.CodeableReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.CodeableReference _Location; + private Hl7.Fhir.Model.CodeableReference? _Location; /// /// Who should participate in the action. @@ -1477,11 +1400,11 @@ public Hl7.Fhir.Model.CodeableReference Location [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// What's administered/supplied. @@ -1492,26 +1415,26 @@ public List Participant [References("Medication","Ingredient","Substance","SubstanceDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Product + public Hl7.Fhir.Model.DataType? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.DataType _Product; + private Hl7.Fhir.Model.DataType? _Product; /// /// How much is administered/consumed/supplied. /// [FhirElement("quantity", Order=500)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Detailed dosage instructions. @@ -1521,11 +1444,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// What part of body to perform on. @@ -1536,11 +1459,11 @@ public List Dosage [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// What specimens are required to perform this action. @@ -1550,24 +1473,24 @@ public List BodySite [DataMember] public List SpecimenRequirementElement { - get { if(_SpecimenRequirementElement==null) _SpecimenRequirementElement = new List(); return _SpecimenRequirementElement; } + get => _SpecimenRequirementElement ?? new List(); set { _SpecimenRequirementElement = value; OnPropertyChanged("SpecimenRequirementElement"); } } - private List _SpecimenRequirementElement; + private List? _SpecimenRequirementElement; /// /// What specimens are required to perform this action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SpecimenRequirement + public IEnumerable? SpecimenRequirement { - get { return SpecimenRequirementElement != null ? SpecimenRequirementElement.Select(elem => elem.Value) : null; } + get => _SpecimenRequirementElement?.Select(elem => elem.Value); set { if (value == null) - SpecimenRequirementElement = null; + SpecimenRequirementElement = null!; else SpecimenRequirementElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("SpecimenRequirement"); @@ -1582,24 +1505,24 @@ public IEnumerable SpecimenRequirement [DataMember] public List ObservationRequirementElement { - get { if(_ObservationRequirementElement==null) _ObservationRequirementElement = new List(); return _ObservationRequirementElement; } + get => _ObservationRequirementElement ?? new List(); set { _ObservationRequirementElement = value; OnPropertyChanged("ObservationRequirementElement"); } } - private List _ObservationRequirementElement; + private List? _ObservationRequirementElement; /// /// What observations are required to perform this action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ObservationRequirement + public IEnumerable? ObservationRequirement { - get { return ObservationRequirementElement != null ? ObservationRequirementElement.Select(elem => elem.Value) : null; } + get => _ObservationRequirementElement?.Select(elem => elem.Value); set { if (value == null) - ObservationRequirementElement = null; + ObservationRequirementElement = null!; else ObservationRequirementElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("ObservationRequirement"); @@ -1614,24 +1537,24 @@ public IEnumerable ObservationRequirement [DataMember] public List ObservationResultRequirementElement { - get { if(_ObservationResultRequirementElement==null) _ObservationResultRequirementElement = new List(); return _ObservationResultRequirementElement; } + get => _ObservationResultRequirementElement ?? new List(); set { _ObservationResultRequirementElement = value; OnPropertyChanged("ObservationResultRequirementElement"); } } - private List _ObservationResultRequirementElement; + private List? _ObservationResultRequirementElement; /// /// What observations must be produced by this action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ObservationResultRequirement + public IEnumerable? ObservationResultRequirement { - get { return ObservationResultRequirementElement != null ? ObservationResultRequirementElement.Select(elem => elem.Value) : null; } + get => _ObservationResultRequirementElement?.Select(elem => elem.Value); set { if (value == null) - ObservationResultRequirementElement = null; + ObservationResultRequirementElement = null!; else ObservationResultRequirementElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("ObservationResultRequirement"); @@ -1643,28 +1566,25 @@ public IEnumerable ObservationResultRequirement /// [FhirElement("transform", Order=560)] [DataMember] - public Hl7.Fhir.Model.Canonical TransformElement + public Hl7.Fhir.Model.Canonical? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Hl7.Fhir.Model.Canonical _TransformElement; + private Hl7.Fhir.Model.Canonical? _TransformElement; /// /// Transform to apply the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Transform + public string? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Hl7.Fhir.Model.Canonical(value); + TransformElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Transform"); } } @@ -1677,73 +1597,69 @@ public string Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityDefinition; - - if (dest == null) - { + if(other is not ActivityDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.CodeableReference)Location.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Product != null) dest.Product = (Hl7.Fhir.Model.DataType)Product.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(SpecimenRequirementElement.Any()) dest.SpecimenRequirementElement = new List(SpecimenRequirementElement.DeepCopyInternal()); - if(ObservationRequirementElement.Any()) dest.ObservationRequirementElement = new List(ObservationRequirementElement.DeepCopyInternal()); - if(ObservationResultRequirementElement.Any()) dest.ObservationResultRequirementElement = new List(ObservationResultRequirementElement.DeepCopyInternal()); - if(TransformElement != null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)TransformElement.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.CodeableReference)_Location.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.DataType)_Product.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_SpecimenRequirementElement is not null) dest.SpecimenRequirementElement = new List(_SpecimenRequirementElement.DeepCopyInternal()); + if(_ObservationRequirementElement is not null) dest.ObservationRequirementElement = new List(_ObservationRequirementElement.DeepCopyInternal()); + if(_ObservationResultRequirementElement is not null) dest.ObservationResultRequirementElement = new List(_ObservationResultRequirementElement.DeepCopyInternal()); + if(_TransformElement is not null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)_TransformElement.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1755,370 +1671,370 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityDefinition; - if(otherT == null) return false; + if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(SpecimenRequirementElement, otherT.SpecimenRequirementElement)) return false; - if(!comparer.ListEquals(ObservationRequirementElement, otherT.ObservationRequirementElement)) return false; - if(!comparer.ListEquals(ObservationResultRequirementElement, otherT.ObservationResultRequirementElement)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_SpecimenRequirementElement, otherT._SpecimenRequirementElement)) return false; + if(!comparer.ListEquals(_ObservationRequirementElement, otherT._ObservationRequirementElement)) return false; + if(!comparer.ListEquals(_ObservationResultRequirementElement, otherT._ObservationResultRequirementElement)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "specimenRequirement": - value = SpecimenRequirementElement; - return SpecimenRequirementElement?.Any() == true; + value = _SpecimenRequirementElement; + return _SpecimenRequirementElement?.Any() == true; case "observationRequirement": - value = ObservationRequirementElement; - return ObservationRequirementElement?.Any() == true; + value = _ObservationRequirementElement; + return _ObservationRequirementElement?.Any() == true; case "observationResultRequirement": - value = ObservationResultRequirementElement; - return ObservationResultRequirementElement?.Any() == true; + value = _ObservationResultRequirementElement; + return _ObservationResultRequirementElement?.Any() == true; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.Markdown)value; + UsageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.CodeableReference)value; + Location = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "product": - Product = (Hl7.Fhir.Model.DataType)value; + Product = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "specimenRequirement": - SpecimenRequirementElement = (List)value; + SpecimenRequirementElement = (List?)value!; return this; case "observationRequirement": - ObservationRequirementElement = (List)value; + ObservationRequirementElement = (List?)value!; return this; case "observationResultRequirement": - ObservationResultRequirementElement = (List)value; + ObservationResultRequirementElement = (List?)value!; return this; case "transform": - TransformElement = (Hl7.Fhir.Model.Canonical)value; + TransformElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2129,55 +2045,55 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (SpecimenRequirementElement?.Any() == true) yield return new KeyValuePair("specimenRequirement",SpecimenRequirementElement); - if (ObservationRequirementElement?.Any() == true) yield return new KeyValuePair("observationRequirement",ObservationRequirementElement); - if (ObservationResultRequirementElement?.Any() == true) yield return new KeyValuePair("observationResultRequirement",ObservationResultRequirementElement); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_SpecimenRequirementElement?.Any() == true) yield return new KeyValuePair("specimenRequirement",_SpecimenRequirementElement); + if (_ObservationRequirementElement?.Any() == true) yield return new KeyValuePair("observationRequirement",_ObservationRequirementElement); + if (_ObservationResultRequirementElement?.Any() == true) yield return new KeyValuePair("observationResultRequirement",_ObservationResultRequirementElement); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs index 1c08e457b..9d9886d74 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ActorDefinition : Hl7.Fhir.Model.DomainResource, IIdentifia /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this actor definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the actor definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the actor definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -143,41 +140,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this actor definition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this actor definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -187,28 +181,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this actor definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -221,13 +212,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -236,13 +227,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -252,13 +240,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -267,13 +255,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -283,28 +268,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -314,28 +296,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -348,39 +327,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the actor. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -393,11 +369,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for actor definition (if applicable). @@ -408,39 +384,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this actor definition is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this actor definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -450,28 +423,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -481,28 +451,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -515,13 +482,13 @@ public string CopyrightLabel [Binding("ExampleScenarioActorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | system @@ -530,13 +497,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ExampleScenarioActorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -546,28 +510,25 @@ public Hl7.Fhir.Model.ExampleScenarioActorType? Type /// [FhirElement("documentation", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Functionality associated with the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -580,24 +541,24 @@ public string Documentation [DataMember] public List ReferenceElement { - get { if(_ReferenceElement==null) _ReferenceElement = new List(); return _ReferenceElement; } + get => _ReferenceElement ?? new List(); set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private List _ReferenceElement; + private List? _ReferenceElement; /// /// Reference to more information about the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Reference + public IEnumerable? Reference { - get { return ReferenceElement != null ? ReferenceElement.Select(elem => elem.Value) : null; } + get => _ReferenceElement?.Select(elem => elem.Value); set { if (value == null) - ReferenceElement = null; + ReferenceElement = null!; else ReferenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUrl(elem))); OnPropertyChanged("Reference"); @@ -609,28 +570,25 @@ public IEnumerable Reference /// [FhirElement("capabilities", Order=290)] [DataMember] - public Hl7.Fhir.Model.Canonical CapabilitiesElement + public Hl7.Fhir.Model.Canonical? CapabilitiesElement { get { return _CapabilitiesElement; } set { _CapabilitiesElement = value; OnPropertyChanged("CapabilitiesElement"); } } - private Hl7.Fhir.Model.Canonical _CapabilitiesElement; + private Hl7.Fhir.Model.Canonical? _CapabilitiesElement; /// /// CapabilityStatement for the actor (if applicable) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Capabilities + public string? Capabilities { - get { return CapabilitiesElement != null ? CapabilitiesElement.Value : null; } + get => _CapabilitiesElement?.Value; set { - if (value == null) - CapabilitiesElement = null; - else - CapabilitiesElement = new Hl7.Fhir.Model.Canonical(value); + CapabilitiesElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Capabilities"); } } @@ -643,24 +601,24 @@ public string Capabilities [DataMember] public List DerivedFromElement { - get { if(_DerivedFromElement==null) _DerivedFromElement = new List(); return _DerivedFromElement; } + get => _DerivedFromElement ?? new List(); set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private List _DerivedFromElement; + private List? _DerivedFromElement; /// /// Definition of this actor in another context / IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFrom + public IEnumerable? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Select(elem => elem.Value) : null; } + get => _DerivedFromElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromElement = null; + DerivedFromElement = null!; else DerivedFromElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFrom"); @@ -671,36 +629,32 @@ public IEnumerable DerivedFrom protected internal override void CopyToInternal(Base other) { - var dest = other as ActorDefinition; - - if (dest == null) - { + if(other is not ActorDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(ReferenceElement.Any()) dest.ReferenceElement = new List(ReferenceElement.DeepCopyInternal()); - if(CapabilitiesElement != null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)CapabilitiesElement.DeepCopyInternal(); - if(DerivedFromElement.Any()) dest.DerivedFromElement = new List(DerivedFromElement.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = new List(_ReferenceElement.DeepCopyInternal()); + if(_CapabilitiesElement is not null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)_CapabilitiesElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = new List(_DerivedFromElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -712,181 +666,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActorDefinition; - if(otherT == null) return false; + if(other is not ActorDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.Equals(CapabilitiesElement, otherT.CapabilitiesElement)) return false; - if(!comparer.ListEquals(DerivedFromElement, otherT.DerivedFromElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; + if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement?.Any() == true; + value = _ReferenceElement; + return _ReferenceElement?.Any() == true; case "capabilities": - value = CapabilitiesElement; - return CapabilitiesElement is not null; + value = _CapabilitiesElement; + return _CapabilitiesElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement?.Any() == true; + value = _DerivedFromElement; + return _DerivedFromElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "reference": - ReferenceElement = (List)value; + ReferenceElement = (List?)value!; return this; case "capabilities": - CapabilitiesElement = (Hl7.Fhir.Model.Canonical)value; + CapabilitiesElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "derivedFrom": - DerivedFromElement = (List)value; + DerivedFromElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -897,28 +851,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (ReferenceElement?.Any() == true) yield return new KeyValuePair("reference",ReferenceElement); - if (CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",CapabilitiesElement); - if (DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFromElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_ReferenceElement?.Any() == true) yield return new KeyValuePair("reference",_ReferenceElement); + if (_CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",_CapabilitiesElement); + if (_DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Address.cs b/src/Hl7.Fhir.R5/Model/Generated/Address.cs index adc53d014..26e2e948f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Address.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -136,13 +139,13 @@ public enum AddressType [DeclaredType(Type = typeof(Code))] [Binding("AddressUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// home | work | temp | old | billing - purpose of this address @@ -151,13 +154,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -169,13 +169,13 @@ public Hl7.Fhir.Model.Address.AddressUse? Use [DeclaredType(Type = typeof(Code))] [Binding("AddressType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// postal | physical | both @@ -184,13 +184,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Address.AddressType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -200,28 +197,25 @@ public Hl7.Fhir.Model.Address.AddressType? Type /// [FhirElement("text", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the address /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -234,24 +228,24 @@ public string Text [DataMember] public List LineElement { - get { if(_LineElement==null) _LineElement = new List(); return _LineElement; } + get => _LineElement ?? new List(); set { _LineElement = value; OnPropertyChanged("LineElement"); } } - private List _LineElement; + private List? _LineElement; /// /// Street name, number, direction & P.O. Box etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Line + public IEnumerable? Line { - get { return LineElement != null ? LineElement.Select(elem => elem.Value) : null; } + get => _LineElement?.Select(elem => elem.Value); set { if (value == null) - LineElement = null; + LineElement = null!; else LineElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Line"); @@ -263,28 +257,25 @@ public IEnumerable Line /// [FhirElement("city", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CityElement + public Hl7.Fhir.Model.FhirString? CityElement { get { return _CityElement; } set { _CityElement = value; OnPropertyChanged("CityElement"); } } - private Hl7.Fhir.Model.FhirString _CityElement; + private Hl7.Fhir.Model.FhirString? _CityElement; /// /// Name of city, town etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string City + public string? City { - get { return CityElement != null ? CityElement.Value : null; } + get => _CityElement?.Value; set { - if (value == null) - CityElement = null; - else - CityElement = new Hl7.Fhir.Model.FhirString(value); + CityElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("City"); } } @@ -294,28 +285,25 @@ public string City /// [FhirElement("district", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DistrictElement + public Hl7.Fhir.Model.FhirString? DistrictElement { get { return _DistrictElement; } set { _DistrictElement = value; OnPropertyChanged("DistrictElement"); } } - private Hl7.Fhir.Model.FhirString _DistrictElement; + private Hl7.Fhir.Model.FhirString? _DistrictElement; /// /// District name (aka county) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string District + public string? District { - get { return DistrictElement != null ? DistrictElement.Value : null; } + get => _DistrictElement?.Value; set { - if (value == null) - DistrictElement = null; - else - DistrictElement = new Hl7.Fhir.Model.FhirString(value); + DistrictElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("District"); } } @@ -325,28 +313,25 @@ public string District /// [FhirElement("state", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString StateElement + public Hl7.Fhir.Model.FhirString? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Hl7.Fhir.Model.FhirString _StateElement; + private Hl7.Fhir.Model.FhirString? _StateElement; /// /// Sub-unit of country (abbreviations ok) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string State + public string? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Hl7.Fhir.Model.FhirString(value); + StateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("State"); } } @@ -356,28 +341,25 @@ public string State /// [FhirElement("postalCode", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PostalCodeElement + public Hl7.Fhir.Model.FhirString? PostalCodeElement { get { return _PostalCodeElement; } set { _PostalCodeElement = value; OnPropertyChanged("PostalCodeElement"); } } - private Hl7.Fhir.Model.FhirString _PostalCodeElement; + private Hl7.Fhir.Model.FhirString? _PostalCodeElement; /// /// Postal code for area /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PostalCode + public string? PostalCode { - get { return PostalCodeElement != null ? PostalCodeElement.Value : null; } + get => _PostalCodeElement?.Value; set { - if (value == null) - PostalCodeElement = null; - else - PostalCodeElement = new Hl7.Fhir.Model.FhirString(value); + PostalCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PostalCode"); } } @@ -387,28 +369,25 @@ public string PostalCode /// [FhirElement("country", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CountryElement + public Hl7.Fhir.Model.FhirString? CountryElement { get { return _CountryElement; } set { _CountryElement = value; OnPropertyChanged("CountryElement"); } } - private Hl7.Fhir.Model.FhirString _CountryElement; + private Hl7.Fhir.Model.FhirString? _CountryElement; /// /// Country (e.g. may be ISO 3166 2 or 3 letter code) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Country + public string? Country { - get { return CountryElement != null ? CountryElement.Value : null; } + get => _CountryElement?.Value; set { - if (value == null) - CountryElement = null; - else - CountryElement = new Hl7.Fhir.Model.FhirString(value); + CountryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Country"); } } @@ -418,34 +397,30 @@ public string Country /// [FhirElement("period", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as Address; - - if (dest == null) - { + if(other is not Address dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LineElement.Any()) dest.LineElement = new List(LineElement.DeepCopyInternal()); - if(CityElement != null) dest.CityElement = (Hl7.Fhir.Model.FhirString)CityElement.DeepCopyInternal(); - if(DistrictElement != null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)DistrictElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Hl7.Fhir.Model.FhirString)StateElement.DeepCopyInternal(); - if(PostalCodeElement != null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)PostalCodeElement.DeepCopyInternal(); - if(CountryElement != null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)CountryElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LineElement is not null) dest.LineElement = new List(_LineElement.DeepCopyInternal()); + if(_CityElement is not null) dest.CityElement = (Hl7.Fhir.Model.FhirString)_CityElement.DeepCopyInternal(); + if(_DistrictElement is not null) dest.DistrictElement = (Hl7.Fhir.Model.FhirString)_DistrictElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Hl7.Fhir.Model.FhirString)_StateElement.DeepCopyInternal(); + if(_PostalCodeElement is not null) dest.PostalCodeElement = (Hl7.Fhir.Model.FhirString)_PostalCodeElement.DeepCopyInternal(); + if(_CountryElement is not null) dest.CountryElement = (Hl7.Fhir.Model.FhirString)_CountryElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -457,97 +432,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Address; - if(otherT == null) return false; + if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LineElement, otherT.LineElement)) return false; - if(!comparer.Equals(CityElement, otherT.CityElement)) return false; - if(!comparer.Equals(DistrictElement, otherT.DistrictElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(PostalCodeElement, otherT.PostalCodeElement)) return false; - if(!comparer.Equals(CountryElement, otherT.CountryElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; + if(!comparer.Equals(_CityElement, otherT._CityElement)) return false; + if(!comparer.Equals(_DistrictElement, otherT._DistrictElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; + if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "line": - value = LineElement; - return LineElement?.Any() == true; + value = _LineElement; + return _LineElement?.Any() == true; case "city": - value = CityElement; - return CityElement is not null; + value = _CityElement; + return _CityElement is not null; case "district": - value = DistrictElement; - return DistrictElement is not null; + value = _DistrictElement; + return _DistrictElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "postalCode": - value = PostalCodeElement; - return PostalCodeElement is not null; + value = _PostalCodeElement; + return _PostalCodeElement is not null; case "country": - value = CountryElement; - return CountryElement is not null; + value = _CountryElement; + return _CountryElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "line": - LineElement = (List)value; + LineElement = (List?)value!; return this; case "city": - CityElement = (Hl7.Fhir.Model.FhirString)value; + CityElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "district": - DistrictElement = (Hl7.Fhir.Model.FhirString)value; + DistrictElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "state": - StateElement = (Hl7.Fhir.Model.FhirString)value; + StateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "postalCode": - PostalCodeElement = (Hl7.Fhir.Model.FhirString)value; + PostalCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - CountryElement = (Hl7.Fhir.Model.FhirString)value; + CountryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -558,16 +533,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LineElement?.Any() == true) yield return new KeyValuePair("line",LineElement); - if (CityElement is not null) yield return new KeyValuePair("city",CityElement); - if (DistrictElement is not null) yield return new KeyValuePair("district",DistrictElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (PostalCodeElement is not null) yield return new KeyValuePair("postalCode",PostalCodeElement); - if (CountryElement is not null) yield return new KeyValuePair("country",CountryElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LineElement?.Any() == true) yield return new KeyValuePair("line",_LineElement); + if (_CityElement is not null) yield return new KeyValuePair("city",_CityElement); + if (_DistrictElement is not null) yield return new KeyValuePair("district",_DistrictElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_PostalCodeElement is not null) yield return new KeyValuePair("postalCode",_PostalCodeElement); + if (_CountryElement is not null) yield return new KeyValuePair("country",_CountryElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs index 25bb31651..995286650 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -79,13 +82,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTCharacteristicCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -95,13 +98,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Binary")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// The status of characteristic e.g. assigned or pending. @@ -109,27 +112,23 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("status", InSummary=true, Order=60)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -141,48 +140,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -193,9 +192,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Status is not null) yield return new KeyValuePair("status",Status); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Status is not null) yield return new KeyValuePair("status",_Status); } } @@ -223,78 +222,78 @@ public partial class RouteOfAdministrationComponent : Hl7.Fhir.Model.BackboneEle [Binding("SNOMEDCTRouteCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The first dose (dose quantity) administered can be specified for the product. /// [FhirElement("firstDose", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity FirstDose + public Hl7.Fhir.Model.Quantity? FirstDose { get { return _FirstDose; } set { _FirstDose = value; OnPropertyChanged("FirstDose"); } } - private Hl7.Fhir.Model.Quantity _FirstDose; + private Hl7.Fhir.Model.Quantity? _FirstDose; /// /// The maximum single dose that can be administered. /// [FhirElement("maxSingleDose", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxSingleDose + public Hl7.Fhir.Model.Quantity? MaxSingleDose { get { return _MaxSingleDose; } set { _MaxSingleDose = value; OnPropertyChanged("MaxSingleDose"); } } - private Hl7.Fhir.Model.Quantity _MaxSingleDose; + private Hl7.Fhir.Model.Quantity? _MaxSingleDose; /// /// The maximum dose quantity to be administered in any one 24-h period. /// [FhirElement("maxDosePerDay", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerDay + public Hl7.Fhir.Model.Quantity? MaxDosePerDay { get { return _MaxDosePerDay; } set { _MaxDosePerDay = value; OnPropertyChanged("MaxDosePerDay"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerDay; + private Hl7.Fhir.Model.Quantity? _MaxDosePerDay; /// /// The maximum dose per treatment period that can be administered. /// [FhirElement("maxDosePerTreatmentPeriod", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Ratio MaxDosePerTreatmentPeriod + public Hl7.Fhir.Model.Ratio? MaxDosePerTreatmentPeriod { get { return _MaxDosePerTreatmentPeriod; } set { _MaxDosePerTreatmentPeriod = value; OnPropertyChanged("MaxDosePerTreatmentPeriod"); } } - private Hl7.Fhir.Model.Ratio _MaxDosePerTreatmentPeriod; + private Hl7.Fhir.Model.Ratio? _MaxDosePerTreatmentPeriod; /// /// The maximum treatment period during which the product can be administered. /// [FhirElement("maxTreatmentPeriod", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration MaxTreatmentPeriod + public Hl7.Fhir.Model.Duration? MaxTreatmentPeriod { get { return _MaxTreatmentPeriod; } set { _MaxTreatmentPeriod = value; OnPropertyChanged("MaxTreatmentPeriod"); } } - private Hl7.Fhir.Model.Duration _MaxTreatmentPeriod; + private Hl7.Fhir.Model.Duration? _MaxTreatmentPeriod; /// /// A species for which this route applies. @@ -304,29 +303,25 @@ public Hl7.Fhir.Model.Duration MaxTreatmentPeriod [DataMember] public List TargetSpecies { - get { if(_TargetSpecies==null) _TargetSpecies = new List(); return _TargetSpecies; } + get => _TargetSpecies ?? new List(); set { _TargetSpecies = value; OnPropertyChanged("TargetSpecies"); } } - private List _TargetSpecies; + private List? _TargetSpecies; protected internal override void CopyToInternal(Base other) { - var dest = other as RouteOfAdministrationComponent; - - if (dest == null) - { + if(other is not RouteOfAdministrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FirstDose != null) dest.FirstDose = (Hl7.Fhir.Model.Quantity)FirstDose.DeepCopyInternal(); - if(MaxSingleDose != null) dest.MaxSingleDose = (Hl7.Fhir.Model.Quantity)MaxSingleDose.DeepCopyInternal(); - if(MaxDosePerDay != null) dest.MaxDosePerDay = (Hl7.Fhir.Model.Quantity)MaxDosePerDay.DeepCopyInternal(); - if(MaxDosePerTreatmentPeriod != null) dest.MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)MaxDosePerTreatmentPeriod.DeepCopyInternal(); - if(MaxTreatmentPeriod != null) dest.MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)MaxTreatmentPeriod.DeepCopyInternal(); - if(TargetSpecies.Any()) dest.TargetSpecies = new List(TargetSpecies.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FirstDose is not null) dest.FirstDose = (Hl7.Fhir.Model.Quantity)_FirstDose.DeepCopyInternal(); + if(_MaxSingleDose is not null) dest.MaxSingleDose = (Hl7.Fhir.Model.Quantity)_MaxSingleDose.DeepCopyInternal(); + if(_MaxDosePerDay is not null) dest.MaxDosePerDay = (Hl7.Fhir.Model.Quantity)_MaxDosePerDay.DeepCopyInternal(); + if(_MaxDosePerTreatmentPeriod is not null) dest.MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)_MaxDosePerTreatmentPeriod.DeepCopyInternal(); + if(_MaxTreatmentPeriod is not null) dest.MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)_MaxTreatmentPeriod.DeepCopyInternal(); + if(_TargetSpecies is not null) dest.TargetSpecies = new List(_TargetSpecies.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -338,76 +333,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RouteOfAdministrationComponent; - if(otherT == null) return false; + if(other is not RouteOfAdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FirstDose, otherT.FirstDose)) return false; - if(!comparer.Equals(MaxSingleDose, otherT.MaxSingleDose)) return false; - if(!comparer.Equals(MaxDosePerDay, otherT.MaxDosePerDay)) return false; - if(!comparer.Equals(MaxDosePerTreatmentPeriod, otherT.MaxDosePerTreatmentPeriod)) return false; - if(!comparer.Equals(MaxTreatmentPeriod, otherT.MaxTreatmentPeriod)) return false; - if(!comparer.ListEquals(TargetSpecies, otherT.TargetSpecies)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FirstDose, otherT._FirstDose)) return false; + if(!comparer.Equals(_MaxSingleDose, otherT._MaxSingleDose)) return false; + if(!comparer.Equals(_MaxDosePerDay, otherT._MaxDosePerDay)) return false; + if(!comparer.Equals(_MaxDosePerTreatmentPeriod, otherT._MaxDosePerTreatmentPeriod)) return false; + if(!comparer.Equals(_MaxTreatmentPeriod, otherT._MaxTreatmentPeriod)) return false; + if(!comparer.ListEquals(_TargetSpecies, otherT._TargetSpecies)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "firstDose": - value = FirstDose; - return FirstDose is not null; + value = _FirstDose; + return _FirstDose is not null; case "maxSingleDose": - value = MaxSingleDose; - return MaxSingleDose is not null; + value = _MaxSingleDose; + return _MaxSingleDose is not null; case "maxDosePerDay": - value = MaxDosePerDay; - return MaxDosePerDay is not null; + value = _MaxDosePerDay; + return _MaxDosePerDay is not null; case "maxDosePerTreatmentPeriod": - value = MaxDosePerTreatmentPeriod; - return MaxDosePerTreatmentPeriod is not null; + value = _MaxDosePerTreatmentPeriod; + return _MaxDosePerTreatmentPeriod is not null; case "maxTreatmentPeriod": - value = MaxTreatmentPeriod; - return MaxTreatmentPeriod is not null; + value = _MaxTreatmentPeriod; + return _MaxTreatmentPeriod is not null; case "targetSpecies": - value = TargetSpecies; - return TargetSpecies?.Any() == true; + value = _TargetSpecies; + return _TargetSpecies?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "firstDose": - FirstDose = (Hl7.Fhir.Model.Quantity)value; + FirstDose = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxSingleDose": - MaxSingleDose = (Hl7.Fhir.Model.Quantity)value; + MaxSingleDose = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerDay": - MaxDosePerDay = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerDay = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerTreatmentPeriod": - MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio)value; + MaxDosePerTreatmentPeriod = (Hl7.Fhir.Model.Ratio?)value; return this; case "maxTreatmentPeriod": - MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration)value; + MaxTreatmentPeriod = (Hl7.Fhir.Model.Duration?)value; return this; case "targetSpecies": - TargetSpecies = (List)value; + TargetSpecies = (List?)value!; return this; default: return base.SetValue(key, value); @@ -418,13 +413,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FirstDose is not null) yield return new KeyValuePair("firstDose",FirstDose); - if (MaxSingleDose is not null) yield return new KeyValuePair("maxSingleDose",MaxSingleDose); - if (MaxDosePerDay is not null) yield return new KeyValuePair("maxDosePerDay",MaxDosePerDay); - if (MaxDosePerTreatmentPeriod is not null) yield return new KeyValuePair("maxDosePerTreatmentPeriod",MaxDosePerTreatmentPeriod); - if (MaxTreatmentPeriod is not null) yield return new KeyValuePair("maxTreatmentPeriod",MaxTreatmentPeriod); - if (TargetSpecies?.Any() == true) yield return new KeyValuePair("targetSpecies",TargetSpecies); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FirstDose is not null) yield return new KeyValuePair("firstDose",_FirstDose); + if (_MaxSingleDose is not null) yield return new KeyValuePair("maxSingleDose",_MaxSingleDose); + if (_MaxDosePerDay is not null) yield return new KeyValuePair("maxDosePerDay",_MaxDosePerDay); + if (_MaxDosePerTreatmentPeriod is not null) yield return new KeyValuePair("maxDosePerTreatmentPeriod",_MaxDosePerTreatmentPeriod); + if (_MaxTreatmentPeriod is not null) yield return new KeyValuePair("maxTreatmentPeriod",_MaxTreatmentPeriod); + if (_TargetSpecies?.Any() == true) yield return new KeyValuePair("targetSpecies",_TargetSpecies); } } @@ -449,13 +444,13 @@ public partial class TargetSpeciesComponent : Hl7.Fhir.Model.BackboneElement [Binding("TargetSpecies")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// A species specific time during which consumption of animal product is not appropriate. @@ -465,24 +460,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List WithdrawalPeriod { - get { if(_WithdrawalPeriod==null) _WithdrawalPeriod = new List(); return _WithdrawalPeriod; } + get => _WithdrawalPeriod ?? new List(); set { _WithdrawalPeriod = value; OnPropertyChanged("WithdrawalPeriod"); } } - private List _WithdrawalPeriod; + private List? _WithdrawalPeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetSpeciesComponent; - - if (dest == null) - { + if(other is not TargetSpeciesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(WithdrawalPeriod.Any()) dest.WithdrawalPeriod = new List(WithdrawalPeriod.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_WithdrawalPeriod is not null) dest.WithdrawalPeriod = new List(_WithdrawalPeriod.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -494,41 +485,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetSpeciesComponent; - if(otherT == null) return false; + if(other is not TargetSpeciesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(WithdrawalPeriod, otherT.WithdrawalPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_WithdrawalPeriod, otherT._WithdrawalPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "withdrawalPeriod": - value = WithdrawalPeriod; - return WithdrawalPeriod?.Any() == true; + value = _WithdrawalPeriod; + return _WithdrawalPeriod?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "withdrawalPeriod": - WithdrawalPeriod = (List)value; + WithdrawalPeriod = (List?)value!; return this; default: return base.SetValue(key, value); @@ -539,8 +530,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (WithdrawalPeriod?.Any() == true) yield return new KeyValuePair("withdrawalPeriod",WithdrawalPeriod); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_WithdrawalPeriod?.Any() == true) yield return new KeyValuePair("withdrawalPeriod",_WithdrawalPeriod); } } @@ -565,13 +556,13 @@ public partial class WithdrawalPeriodComponent : Hl7.Fhir.Model.BackboneElement [Binding("AnimalTissueType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Tissue + public Hl7.Fhir.Model.CodeableConcept? Tissue { get { return _Tissue; } set { _Tissue = value; OnPropertyChanged("Tissue"); } } - private Hl7.Fhir.Model.CodeableConcept _Tissue; + private Hl7.Fhir.Model.CodeableConcept? _Tissue; /// /// A value for the time. @@ -579,58 +570,51 @@ public Hl7.Fhir.Model.CodeableConcept Tissue [FhirElement("value", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// Extra information about the withdrawal period. /// [FhirElement("supportingInformation", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString SupportingInformationElement + public Hl7.Fhir.Model.FhirString? SupportingInformationElement { get { return _SupportingInformationElement; } set { _SupportingInformationElement = value; OnPropertyChanged("SupportingInformationElement"); } } - private Hl7.Fhir.Model.FhirString _SupportingInformationElement; + private Hl7.Fhir.Model.FhirString? _SupportingInformationElement; /// /// Extra information about the withdrawal period /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SupportingInformation + public string? SupportingInformation { - get { return SupportingInformationElement != null ? SupportingInformationElement.Value : null; } + get => _SupportingInformationElement?.Value; set { - if (value == null) - SupportingInformationElement = null; - else - SupportingInformationElement = new Hl7.Fhir.Model.FhirString(value); + SupportingInformationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SupportingInformation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as WithdrawalPeriodComponent; - - if (dest == null) - { + if(other is not WithdrawalPeriodComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Tissue != null) dest.Tissue = (Hl7.Fhir.Model.CodeableConcept)Tissue.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(SupportingInformationElement != null) dest.SupportingInformationElement = (Hl7.Fhir.Model.FhirString)SupportingInformationElement.DeepCopyInternal(); + if(_Tissue is not null) dest.Tissue = (Hl7.Fhir.Model.CodeableConcept)_Tissue.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_SupportingInformationElement is not null) dest.SupportingInformationElement = (Hl7.Fhir.Model.FhirString)_SupportingInformationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -642,48 +626,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as WithdrawalPeriodComponent; - if(otherT == null) return false; + if(other is not WithdrawalPeriodComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Tissue, otherT.Tissue)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(SupportingInformationElement, otherT.SupportingInformationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_SupportingInformationElement, otherT._SupportingInformationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "tissue": - value = Tissue; - return Tissue is not null; + value = _Tissue; + return _Tissue is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "supportingInformation": - value = SupportingInformationElement; - return SupportingInformationElement is not null; + value = _SupportingInformationElement; + return _SupportingInformationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "tissue": - Tissue = (Hl7.Fhir.Model.CodeableConcept)value; + Tissue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "supportingInformation": - SupportingInformationElement = (Hl7.Fhir.Model.FhirString)value; + SupportingInformationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -694,9 +678,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Tissue is not null) yield return new KeyValuePair("tissue",Tissue); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (SupportingInformationElement is not null) yield return new KeyValuePair("supportingInformation",SupportingInformationElement); + if (_Tissue is not null) yield return new KeyValuePair("tissue",_Tissue); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_SupportingInformationElement is not null) yield return new KeyValuePair("supportingInformation",_SupportingInformationElement); } } @@ -709,11 +693,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -723,13 +707,13 @@ public List Identifier [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -738,13 +722,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -759,11 +740,11 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List FormOf { - get { if(_FormOf==null) _FormOf = new List(); return _FormOf; } + get => _FormOf ?? new List(); set { _FormOf = value; OnPropertyChanged("FormOf"); } } - private List _FormOf; + private List? _FormOf; /// /// The dose form of the final product after necessary reconstitution or processing. @@ -771,13 +752,13 @@ public List FormOf [FhirElement("administrableDoseForm", InSummary=true, Order=120)] [Binding("AdministrableDoseForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdministrableDoseForm + public Hl7.Fhir.Model.CodeableConcept? AdministrableDoseForm { get { return _AdministrableDoseForm; } set { _AdministrableDoseForm = value; OnPropertyChanged("AdministrableDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _AdministrableDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _AdministrableDoseForm; /// /// The presentation type in which this item is given to a patient. e.g. for a spray - 'puff'. @@ -785,13 +766,13 @@ public Hl7.Fhir.Model.CodeableConcept AdministrableDoseForm [FhirElement("unitOfPresentation", InSummary=true, Order=130)] [Binding("UnitOfPresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation + public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation { get { return _UnitOfPresentation; } set { _UnitOfPresentation = value; OnPropertyChanged("UnitOfPresentation"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfPresentation; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfPresentation; /// /// Indicates the specific manufactured items that are part of the 'formOf' product that are used in the preparation of this specific administrable form. @@ -803,11 +784,11 @@ public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation [DataMember] public List ProducedFrom { - get { if(_ProducedFrom==null) _ProducedFrom = new List(); return _ProducedFrom; } + get => _ProducedFrom ?? new List(); set { _ProducedFrom = value; OnPropertyChanged("ProducedFrom"); } } - private List _ProducedFrom; + private List? _ProducedFrom; /// /// The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton, or using by incoming references from the Ingredient resource. @@ -818,11 +799,11 @@ public List ProducedFrom [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. @@ -831,41 +812,38 @@ public List Ingredient [CLSCompliant(false)] [References("DeviceDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// A general description of the product, when in its final form, suitable for administration e.g. effervescent blue liquid, to be swallowed. /// [FhirElement("description", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A general description of the product, when in its final form, suitable for administration e.g. effervescent blue liquid, to be swallowed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -878,11 +856,11 @@ public string Description [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// The path by which the product is taken into or makes contact with the body. @@ -892,35 +870,31 @@ public List Pro [DataMember] public List RouteOfAdministration { - get { if(_RouteOfAdministration==null) _RouteOfAdministration = new List(); return _RouteOfAdministration; } + get => _RouteOfAdministration ?? new List(); set { _RouteOfAdministration = value; OnPropertyChanged("RouteOfAdministration"); } } - private List _RouteOfAdministration; + private List? _RouteOfAdministration; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrableProductDefinition; - - if (dest == null) - { + if(other is not AdministrableProductDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(FormOf.Any()) dest.FormOf = new List(FormOf.DeepCopyInternal()); - if(AdministrableDoseForm != null) dest.AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)AdministrableDoseForm.DeepCopyInternal(); - if(UnitOfPresentation != null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopyInternal(); - if(ProducedFrom.Any()) dest.ProducedFrom = new List(ProducedFrom.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(RouteOfAdministration.Any()) dest.RouteOfAdministration = new List(RouteOfAdministration.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_FormOf is not null) dest.FormOf = new List(_FormOf.DeepCopyInternal()); + if(_AdministrableDoseForm is not null) dest.AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)_AdministrableDoseForm.DeepCopyInternal(); + if(_UnitOfPresentation is not null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)_UnitOfPresentation.DeepCopyInternal(); + if(_ProducedFrom is not null) dest.ProducedFrom = new List(_ProducedFrom.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_RouteOfAdministration is not null) dest.RouteOfAdministration = new List(_RouteOfAdministration.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -932,104 +906,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrableProductDefinition; - if(otherT == null) return false; + if(other is not AdministrableProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(FormOf, otherT.FormOf)) return false; - if(!comparer.Equals(AdministrableDoseForm, otherT.AdministrableDoseForm)) return false; - if(!comparer.Equals(UnitOfPresentation, otherT.UnitOfPresentation)) return false; - if(!comparer.ListEquals(ProducedFrom, otherT.ProducedFrom)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(RouteOfAdministration, otherT.RouteOfAdministration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_FormOf, otherT._FormOf)) return false; + if(!comparer.Equals(_AdministrableDoseForm, otherT._AdministrableDoseForm)) return false; + if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; + if(!comparer.ListEquals(_ProducedFrom, otherT._ProducedFrom)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_RouteOfAdministration, otherT._RouteOfAdministration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "formOf": - value = FormOf; - return FormOf?.Any() == true; + value = _FormOf; + return _FormOf?.Any() == true; case "administrableDoseForm": - value = AdministrableDoseForm; - return AdministrableDoseForm is not null; + value = _AdministrableDoseForm; + return _AdministrableDoseForm is not null; case "unitOfPresentation": - value = UnitOfPresentation; - return UnitOfPresentation is not null; + value = _UnitOfPresentation; + return _UnitOfPresentation is not null; case "producedFrom": - value = ProducedFrom; - return ProducedFrom?.Any() == true; + value = _ProducedFrom; + return _ProducedFrom?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "routeOfAdministration": - value = RouteOfAdministration; - return RouteOfAdministration?.Any() == true; + value = _RouteOfAdministration; + return _RouteOfAdministration?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "formOf": - FormOf = (List)value; + FormOf = (List?)value!; return this; case "administrableDoseForm": - AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + AdministrableDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unitOfPresentation": - UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "producedFrom": - ProducedFrom = (List)value; + ProducedFrom = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "routeOfAdministration": - RouteOfAdministration = (List)value; + RouteOfAdministration = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1040,17 +1014,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (FormOf?.Any() == true) yield return new KeyValuePair("formOf",FormOf); - if (AdministrableDoseForm is not null) yield return new KeyValuePair("administrableDoseForm",AdministrableDoseForm); - if (UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",UnitOfPresentation); - if (ProducedFrom?.Any() == true) yield return new KeyValuePair("producedFrom",ProducedFrom); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (RouteOfAdministration?.Any() == true) yield return new KeyValuePair("routeOfAdministration",RouteOfAdministration); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_FormOf?.Any() == true) yield return new KeyValuePair("formOf",_FormOf); + if (_AdministrableDoseForm is not null) yield return new KeyValuePair("administrableDoseForm",_AdministrableDoseForm); + if (_UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",_UnitOfPresentation); + if (_ProducedFrom?.Any() == true) yield return new KeyValuePair("producedFrom",_ProducedFrom); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_RouteOfAdministration?.Any() == true) yield return new KeyValuePair("routeOfAdministration",_RouteOfAdministration); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs index fb7712242..88e911aa4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -137,13 +140,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("AdverseEventParticipantFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who was involved in the adverse event or the potential adverse event. @@ -153,26 +156,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson","ResearchSubject")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -184,41 +183,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -229,8 +228,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -260,39 +259,35 @@ public partial class SuspectEntityComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Instance + public Hl7.Fhir.Model.DataType? Instance { get { return _Instance; } set { _Instance = value; OnPropertyChanged("Instance"); } } - private Hl7.Fhir.Model.DataType _Instance; + private Hl7.Fhir.Model.DataType? _Instance; /// /// Information on the possible cause of the event. /// [FhirElement("causality", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.AdverseEvent.CausalityComponent Causality + public Hl7.Fhir.Model.AdverseEvent.CausalityComponent? Causality { get { return _Causality; } set { _Causality = value; OnPropertyChanged("Causality"); } } - private Hl7.Fhir.Model.AdverseEvent.CausalityComponent _Causality; + private Hl7.Fhir.Model.AdverseEvent.CausalityComponent? _Causality; protected internal override void CopyToInternal(Base other) { - var dest = other as SuspectEntityComponent; - - if (dest == null) - { + if(other is not SuspectEntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Instance != null) dest.Instance = (Hl7.Fhir.Model.DataType)Instance.DeepCopyInternal(); - if(Causality != null) dest.Causality = (Hl7.Fhir.Model.AdverseEvent.CausalityComponent)Causality.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = (Hl7.Fhir.Model.DataType)_Instance.DeepCopyInternal(); + if(_Causality is not null) dest.Causality = (Hl7.Fhir.Model.AdverseEvent.CausalityComponent)_Causality.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -304,41 +299,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuspectEntityComponent; - if(otherT == null) return false; + if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Instance, otherT.Instance)) return false; - if(!comparer.Equals(Causality, otherT.Causality)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + if(!comparer.Equals(_Causality, otherT._Causality)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "instance": - value = Instance; - return Instance is not null; + value = _Instance; + return _Instance is not null; case "causality": - value = Causality; - return Causality is not null; + value = _Causality; + return _Causality is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "instance": - Instance = (Hl7.Fhir.Model.DataType)value; + Instance = (Hl7.Fhir.Model.DataType?)value; return this; case "causality": - Causality = (Hl7.Fhir.Model.AdverseEvent.CausalityComponent)value; + Causality = (Hl7.Fhir.Model.AdverseEvent.CausalityComponent?)value; return this; default: return base.SetValue(key, value); @@ -349,8 +344,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Instance is not null) yield return new KeyValuePair("instance",Instance); - if (Causality is not null) yield return new KeyValuePair("causality",Causality); + if (_Instance is not null) yield return new KeyValuePair("instance",_Instance); + if (_Causality is not null) yield return new KeyValuePair("causality",_Causality); } } @@ -374,13 +369,13 @@ public partial class CausalityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("assessmentMethod", InSummary=true, Order=40)] [Binding("AdverseEventCausalityMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AssessmentMethod + public Hl7.Fhir.Model.CodeableConcept? AssessmentMethod { get { return _AssessmentMethod; } set { _AssessmentMethod = value; OnPropertyChanged("AssessmentMethod"); } } - private Hl7.Fhir.Model.CodeableConcept _AssessmentMethod; + private Hl7.Fhir.Model.CodeableConcept? _AssessmentMethod; /// /// Result of the assessment regarding the relatedness of the suspected entity to the event. @@ -388,13 +383,13 @@ public Hl7.Fhir.Model.CodeableConcept AssessmentMethod [FhirElement("entityRelatedness", InSummary=true, Order=50)] [Binding("AdverseEventCausalityAssessment")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EntityRelatedness + public Hl7.Fhir.Model.CodeableConcept? EntityRelatedness { get { return _EntityRelatedness; } set { _EntityRelatedness = value; OnPropertyChanged("EntityRelatedness"); } } - private Hl7.Fhir.Model.CodeableConcept _EntityRelatedness; + private Hl7.Fhir.Model.CodeableConcept? _EntityRelatedness; /// /// Author of the information on the possible cause of the event. @@ -403,27 +398,23 @@ public Hl7.Fhir.Model.CodeableConcept EntityRelatedness [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson","ResearchSubject")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; protected internal override void CopyToInternal(Base other) { - var dest = other as CausalityComponent; - - if (dest == null) - { + if(other is not CausalityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AssessmentMethod != null) dest.AssessmentMethod = (Hl7.Fhir.Model.CodeableConcept)AssessmentMethod.DeepCopyInternal(); - if(EntityRelatedness != null) dest.EntityRelatedness = (Hl7.Fhir.Model.CodeableConcept)EntityRelatedness.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_AssessmentMethod is not null) dest.AssessmentMethod = (Hl7.Fhir.Model.CodeableConcept)_AssessmentMethod.DeepCopyInternal(); + if(_EntityRelatedness is not null) dest.EntityRelatedness = (Hl7.Fhir.Model.CodeableConcept)_EntityRelatedness.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -435,48 +426,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CausalityComponent; - if(otherT == null) return false; + if(other is not CausalityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AssessmentMethod, otherT.AssessmentMethod)) return false; - if(!comparer.Equals(EntityRelatedness, otherT.EntityRelatedness)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AssessmentMethod, otherT._AssessmentMethod)) return false; + if(!comparer.Equals(_EntityRelatedness, otherT._EntityRelatedness)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "assessmentMethod": - value = AssessmentMethod; - return AssessmentMethod is not null; + value = _AssessmentMethod; + return _AssessmentMethod is not null; case "entityRelatedness": - value = EntityRelatedness; - return EntityRelatedness is not null; + value = _EntityRelatedness; + return _EntityRelatedness is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "assessmentMethod": - AssessmentMethod = (Hl7.Fhir.Model.CodeableConcept)value; + AssessmentMethod = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "entityRelatedness": - EntityRelatedness = (Hl7.Fhir.Model.CodeableConcept)value; + EntityRelatedness = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -487,9 +478,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AssessmentMethod is not null) yield return new KeyValuePair("assessmentMethod",AssessmentMethod); - if (EntityRelatedness is not null) yield return new KeyValuePair("entityRelatedness",EntityRelatedness); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_AssessmentMethod is not null) yield return new KeyValuePair("assessmentMethod",_AssessmentMethod); + if (_EntityRelatedness is not null) yield return new KeyValuePair("entityRelatedness",_EntityRelatedness); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } @@ -520,25 +511,21 @@ public partial class ContributingFactorComponent : Hl7.Fhir.Model.BackboneElemen [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ContributingFactorComponent; - - if (dest == null) - { + if(other is not ContributingFactorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -550,34 +537,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContributingFactorComponent; - if(otherT == null) return false; + if(other is not ContributingFactorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -588,7 +575,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -616,25 +603,21 @@ public partial class PreventiveActionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as PreventiveActionComponent; - - if (dest == null) - { + if(other is not PreventiveActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -646,34 +629,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PreventiveActionComponent; - if(otherT == null) return false; + if(other is not PreventiveActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -684,7 +667,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -715,25 +698,21 @@ public partial class MitigatingActionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as MitigatingActionComponent; - - if (dest == null) - { + if(other is not MitigatingActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -745,34 +724,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MitigatingActionComponent; - if(otherT == null) return false; + if(other is not MitigatingActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -783,7 +762,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -811,25 +790,21 @@ public partial class SupportingInfoComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInfoComponent; - - if (dest == null) - { + if(other is not SupportingInfoComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -841,34 +816,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInfoComponent; - if(otherT == null) return false; + if(other is not SupportingInfoComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -879,7 +854,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -892,11 +867,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// in-progress | completed | entered-in-error | unknown. @@ -906,13 +881,13 @@ public List Identifier [Binding("AdverseEventStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | entered-in-error | unknown @@ -921,13 +896,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.AdverseEvent.AdverseEventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -940,13 +912,13 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventStatus? Status [Binding("AdverseEventActuality")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ActualityElement + public Code? ActualityElement { get { return _ActualityElement; } set { _ActualityElement = value; OnPropertyChanged("ActualityElement"); } } - private Code _ActualityElement; + private Code? _ActualityElement; /// /// actual | potential @@ -955,13 +927,10 @@ public Code ActualityElement [IgnoreDataMember] public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality { - get { return ActualityElement != null ? ActualityElement.Value : null; } + get => _ActualityElement?.Value; set { - if (value == null) - ActualityElement = null; - else - ActualityElement = new Code(value); + ActualityElement = value is null ? null : new Code(value); OnPropertyChanged("Actuality"); } } @@ -975,11 +944,11 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Event or incident that occurred or was averted. @@ -987,13 +956,13 @@ public List Category [FhirElement("code", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [Binding("AdverseEventType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Subject impacted by event. @@ -1003,13 +972,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group","Practitioner","RelatedPerson","ResearchSubject")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The Encounter associated with the start of the AdverseEvent. @@ -1018,13 +987,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the event occurred. @@ -1033,41 +1002,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the event was detected. /// [FhirElement("detected", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DetectedElement + public Hl7.Fhir.Model.FhirDateTime? DetectedElement { get { return _DetectedElement; } set { _DetectedElement = value; OnPropertyChanged("DetectedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DetectedElement; + private Hl7.Fhir.Model.FhirDateTime? _DetectedElement; /// /// When the event was detected /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detected + public string? Detected { - get { return DetectedElement != null ? DetectedElement.Value : null; } + get => _DetectedElement?.Value; set { - if (value == null) - DetectedElement = null; - else - DetectedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DetectedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Detected"); } } @@ -1077,28 +1043,25 @@ public string Detected /// [FhirElement("recordedDate", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// When the event was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -1113,11 +1076,11 @@ public string RecordedDate [DataMember] public List ResultingEffect { - get { if(_ResultingEffect==null) _ResultingEffect = new List(); return _ResultingEffect; } + get => _ResultingEffect ?? new List(); set { _ResultingEffect = value; OnPropertyChanged("ResultingEffect"); } } - private List _ResultingEffect; + private List? _ResultingEffect; /// /// Location where adverse event occurred. @@ -1126,13 +1089,13 @@ public List ResultingEffect [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Seriousness or gravity of the event. @@ -1140,13 +1103,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("seriousness", InSummary=true, Order=210)] [Binding("AdverseEventSeriousness")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Seriousness + public Hl7.Fhir.Model.CodeableConcept? Seriousness { get { return _Seriousness; } set { _Seriousness = value; OnPropertyChanged("Seriousness"); } } - private Hl7.Fhir.Model.CodeableConcept _Seriousness; + private Hl7.Fhir.Model.CodeableConcept? _Seriousness; /// /// Type of outcome from the adverse event. @@ -1157,11 +1120,11 @@ public Hl7.Fhir.Model.CodeableConcept Seriousness [DataMember] public List Outcome { - get { if(_Outcome==null) _Outcome = new List(); return _Outcome; } + get => _Outcome ?? new List(); set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private List _Outcome; + private List? _Outcome; /// /// Who recorded the adverse event. @@ -1170,13 +1133,13 @@ public List Outcome [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","ResearchSubject")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Who was involved in the adverse event or the potential adverse event and what they did. @@ -1186,11 +1149,11 @@ public Hl7.Fhir.Model.ResourceReference Recorder [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Research study that the subject is enrolled in. @@ -1202,24 +1165,24 @@ public List Participant [DataMember] public List Study { - get { if(_Study==null) _Study = new List(); return _Study; } + get => _Study ?? new List(); set { _Study = value; OnPropertyChanged("Study"); } } - private List _Study; + private List? _Study; /// /// Considered likely or probable or anticipated in the research study. /// [FhirElement("expectedInResearchStudy", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExpectedInResearchStudyElement + public Hl7.Fhir.Model.FhirBoolean? ExpectedInResearchStudyElement { get { return _ExpectedInResearchStudyElement; } set { _ExpectedInResearchStudyElement = value; OnPropertyChanged("ExpectedInResearchStudyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExpectedInResearchStudyElement; + private Hl7.Fhir.Model.FhirBoolean? _ExpectedInResearchStudyElement; /// /// Considered likely or probable or anticipated in the research study @@ -1228,13 +1191,10 @@ public Hl7.Fhir.Model.FhirBoolean ExpectedInResearchStudyElement [IgnoreDataMember] public bool? ExpectedInResearchStudy { - get { return ExpectedInResearchStudyElement != null ? ExpectedInResearchStudyElement.Value : null; } + get => _ExpectedInResearchStudyElement?.Value; set { - if (value == null) - ExpectedInResearchStudyElement = null; - else - ExpectedInResearchStudyElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExpectedInResearchStudyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ExpectedInResearchStudy"); } } @@ -1247,11 +1207,11 @@ public bool? ExpectedInResearchStudy [DataMember] public List SuspectEntity { - get { if(_SuspectEntity==null) _SuspectEntity = new List(); return _SuspectEntity; } + get => _SuspectEntity ?? new List(); set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } - private List _SuspectEntity; + private List? _SuspectEntity; /// /// Contributing factors suspected to have increased the probability or severity of the adverse event. @@ -1261,11 +1221,11 @@ public List SuspectEntity [DataMember] public List ContributingFactor { - get { if(_ContributingFactor==null) _ContributingFactor = new List(); return _ContributingFactor; } + get => _ContributingFactor ?? new List(); set { _ContributingFactor = value; OnPropertyChanged("ContributingFactor"); } } - private List _ContributingFactor; + private List? _ContributingFactor; /// /// Preventive actions that contributed to avoiding the adverse event. @@ -1275,11 +1235,11 @@ public List Contributin [DataMember] public List PreventiveAction { - get { if(_PreventiveAction==null) _PreventiveAction = new List(); return _PreventiveAction; } + get => _PreventiveAction ?? new List(); set { _PreventiveAction = value; OnPropertyChanged("PreventiveAction"); } } - private List _PreventiveAction; + private List? _PreventiveAction; /// /// Ameliorating actions taken after the adverse event occured in order to reduce the extent of harm. @@ -1289,11 +1249,11 @@ public List PreventiveAct [DataMember] public List MitigatingAction { - get { if(_MitigatingAction==null) _MitigatingAction = new List(); return _MitigatingAction; } + get => _MitigatingAction ?? new List(); set { _MitigatingAction = value; OnPropertyChanged("MitigatingAction"); } } - private List _MitigatingAction; + private List? _MitigatingAction; /// /// Supporting information relevant to the event. @@ -1303,11 +1263,11 @@ public List MitigatingAct [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Comment on adverse event. @@ -1317,48 +1277,44 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AdverseEvent; - - if (dest == null) - { + if(other is not AdverseEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ActualityElement != null) dest.ActualityElement = (Code)ActualityElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(DetectedElement != null) dest.DetectedElement = (Hl7.Fhir.Model.FhirDateTime)DetectedElement.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(ResultingEffect.Any()) dest.ResultingEffect = new List(ResultingEffect.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Seriousness != null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)Seriousness.DeepCopyInternal(); - if(Outcome.Any()) dest.Outcome = new List(Outcome.DeepCopyInternal()); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Study.Any()) dest.Study = new List(Study.DeepCopyInternal()); - if(ExpectedInResearchStudyElement != null) dest.ExpectedInResearchStudyElement = (Hl7.Fhir.Model.FhirBoolean)ExpectedInResearchStudyElement.DeepCopyInternal(); - if(SuspectEntity.Any()) dest.SuspectEntity = new List(SuspectEntity.DeepCopyInternal()); - if(ContributingFactor.Any()) dest.ContributingFactor = new List(ContributingFactor.DeepCopyInternal()); - if(PreventiveAction.Any()) dest.PreventiveAction = new List(PreventiveAction.DeepCopyInternal()); - if(MitigatingAction.Any()) dest.MitigatingAction = new List(MitigatingAction.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ActualityElement is not null) dest.ActualityElement = (Code)_ActualityElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_DetectedElement is not null) dest.DetectedElement = (Hl7.Fhir.Model.FhirDateTime)_DetectedElement.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_ResultingEffect is not null) dest.ResultingEffect = new List(_ResultingEffect.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Seriousness is not null) dest.Seriousness = (Hl7.Fhir.Model.CodeableConcept)_Seriousness.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = new List(_Outcome.DeepCopyInternal()); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Study is not null) dest.Study = new List(_Study.DeepCopyInternal()); + if(_ExpectedInResearchStudyElement is not null) dest.ExpectedInResearchStudyElement = (Hl7.Fhir.Model.FhirBoolean)_ExpectedInResearchStudyElement.DeepCopyInternal(); + if(_SuspectEntity is not null) dest.SuspectEntity = new List(_SuspectEntity.DeepCopyInternal()); + if(_ContributingFactor is not null) dest.ContributingFactor = new List(_ContributingFactor.DeepCopyInternal()); + if(_PreventiveAction is not null) dest.PreventiveAction = new List(_PreventiveAction.DeepCopyInternal()); + if(_MitigatingAction is not null) dest.MitigatingAction = new List(_MitigatingAction.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1370,195 +1326,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdverseEvent; - if(otherT == null) return false; + if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ActualityElement, otherT.ActualityElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(DetectedElement, otherT.DetectedElement)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.ListEquals(ResultingEffect, otherT.ResultingEffect)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Seriousness, otherT.Seriousness)) return false; - if(!comparer.ListEquals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(Study, otherT.Study)) return false; - if(!comparer.Equals(ExpectedInResearchStudyElement, otherT.ExpectedInResearchStudyElement)) return false; - if(!comparer.ListEquals(SuspectEntity, otherT.SuspectEntity)) return false; - if(!comparer.ListEquals(ContributingFactor, otherT.ContributingFactor)) return false; - if(!comparer.ListEquals(PreventiveAction, otherT.PreventiveAction)) return false; - if(!comparer.ListEquals(MitigatingAction, otherT.MitigatingAction)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ActualityElement, otherT._ActualityElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_DetectedElement, otherT._DetectedElement)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.ListEquals(_ResultingEffect, otherT._ResultingEffect)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Seriousness, otherT._Seriousness)) return false; + if(!comparer.ListEquals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_Study, otherT._Study)) return false; + if(!comparer.Equals(_ExpectedInResearchStudyElement, otherT._ExpectedInResearchStudyElement)) return false; + if(!comparer.ListEquals(_SuspectEntity, otherT._SuspectEntity)) return false; + if(!comparer.ListEquals(_ContributingFactor, otherT._ContributingFactor)) return false; + if(!comparer.ListEquals(_PreventiveAction, otherT._PreventiveAction)) return false; + if(!comparer.ListEquals(_MitigatingAction, otherT._MitigatingAction)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "actuality": - value = ActualityElement; - return ActualityElement is not null; + value = _ActualityElement; + return _ActualityElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "detected": - value = DetectedElement; - return DetectedElement is not null; + value = _DetectedElement; + return _DetectedElement is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "resultingEffect": - value = ResultingEffect; - return ResultingEffect?.Any() == true; + value = _ResultingEffect; + return _ResultingEffect?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "seriousness": - value = Seriousness; - return Seriousness is not null; + value = _Seriousness; + return _Seriousness is not null; case "outcome": - value = Outcome; - return Outcome?.Any() == true; + value = _Outcome; + return _Outcome?.Any() == true; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "study": - value = Study; - return Study?.Any() == true; + value = _Study; + return _Study?.Any() == true; case "expectedInResearchStudy": - value = ExpectedInResearchStudyElement; - return ExpectedInResearchStudyElement is not null; + value = _ExpectedInResearchStudyElement; + return _ExpectedInResearchStudyElement is not null; case "suspectEntity": - value = SuspectEntity; - return SuspectEntity?.Any() == true; + value = _SuspectEntity; + return _SuspectEntity?.Any() == true; case "contributingFactor": - value = ContributingFactor; - return ContributingFactor?.Any() == true; + value = _ContributingFactor; + return _ContributingFactor?.Any() == true; case "preventiveAction": - value = PreventiveAction; - return PreventiveAction?.Any() == true; + value = _PreventiveAction; + return _PreventiveAction?.Any() == true; case "mitigatingAction": - value = MitigatingAction; - return MitigatingAction?.Any() == true; + value = _MitigatingAction; + return _MitigatingAction?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "actuality": - ActualityElement = (Code)value; + ActualityElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "detected": - DetectedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DetectedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "resultingEffect": - ResultingEffect = (List)value; + ResultingEffect = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "seriousness": - Seriousness = (Hl7.Fhir.Model.CodeableConcept)value; + Seriousness = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (List)value; + Outcome = (List?)value!; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "study": - Study = (List)value; + Study = (List?)value!; return this; case "expectedInResearchStudy": - ExpectedInResearchStudyElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExpectedInResearchStudyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "suspectEntity": - SuspectEntity = (List)value; + SuspectEntity = (List?)value!; return this; case "contributingFactor": - ContributingFactor = (List)value; + ContributingFactor = (List?)value!; return this; case "preventiveAction": - PreventiveAction = (List)value; + PreventiveAction = (List?)value!; return this; case "mitigatingAction": - MitigatingAction = (List)value; + MitigatingAction = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1569,30 +1525,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ActualityElement is not null) yield return new KeyValuePair("actuality",ActualityElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (DetectedElement is not null) yield return new KeyValuePair("detected",DetectedElement); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (ResultingEffect?.Any() == true) yield return new KeyValuePair("resultingEffect",ResultingEffect); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Seriousness is not null) yield return new KeyValuePair("seriousness",Seriousness); - if (Outcome?.Any() == true) yield return new KeyValuePair("outcome",Outcome); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Study?.Any() == true) yield return new KeyValuePair("study",Study); - if (ExpectedInResearchStudyElement is not null) yield return new KeyValuePair("expectedInResearchStudy",ExpectedInResearchStudyElement); - if (SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",SuspectEntity); - if (ContributingFactor?.Any() == true) yield return new KeyValuePair("contributingFactor",ContributingFactor); - if (PreventiveAction?.Any() == true) yield return new KeyValuePair("preventiveAction",PreventiveAction); - if (MitigatingAction?.Any() == true) yield return new KeyValuePair("mitigatingAction",MitigatingAction); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ActualityElement is not null) yield return new KeyValuePair("actuality",_ActualityElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_DetectedElement is not null) yield return new KeyValuePair("detected",_DetectedElement); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_ResultingEffect?.Any() == true) yield return new KeyValuePair("resultingEffect",_ResultingEffect); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Seriousness is not null) yield return new KeyValuePair("seriousness",_Seriousness); + if (_Outcome?.Any() == true) yield return new KeyValuePair("outcome",_Outcome); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Study?.Any() == true) yield return new KeyValuePair("study",_Study); + if (_ExpectedInResearchStudyElement is not null) yield return new KeyValuePair("expectedInResearchStudy",_ExpectedInResearchStudyElement); + if (_SuspectEntity?.Any() == true) yield return new KeyValuePair("suspectEntity",_SuspectEntity); + if (_ContributingFactor?.Any() == true) yield return new KeyValuePair("contributingFactor",_ContributingFactor); + if (_PreventiveAction?.Any() == true) yield return new KeyValuePair("preventiveAction",_PreventiveAction); + if (_MitigatingAction?.Any() == true) yield return new KeyValuePair("mitigatingAction",_MitigatingAction); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Age.cs b/src/Hl7.Fhir.R5/Model/Generated/Age.cs index 2bf3cda38..b8660bf57 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Age.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Age.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs index bcb76bc3a..254c4aed2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -240,13 +243,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("AllergyIntoleranceParticipantFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who or what participated in the activities related to the allergy or intolerance. @@ -256,26 +259,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Device","Organization","CareTeam")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -287,41 +286,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -332,8 +331,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -360,13 +359,13 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", Order=40)] [Binding("SubstanceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Clinical symptoms/signs associated with the Event. @@ -377,39 +376,36 @@ public Hl7.Fhir.Model.CodeableConcept Substance [DataMember] public List Manifestation { - get { if(_Manifestation==null) _Manifestation = new List(); return _Manifestation; } + get => _Manifestation ?? new List(); set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } - private List _Manifestation; + private List? _Manifestation; /// /// Description of the event as a whole. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the event as a whole /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -419,28 +415,25 @@ public string Description /// [FhirElement("onset", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OnsetElement + public Hl7.Fhir.Model.FhirDateTime? OnsetElement { get { return _OnsetElement; } set { _OnsetElement = value; OnPropertyChanged("OnsetElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OnsetElement; + private Hl7.Fhir.Model.FhirDateTime? _OnsetElement; /// /// Date(/time) when manifestations showed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Onset + public string? Onset { - get { return OnsetElement != null ? OnsetElement.Value : null; } + get => _OnsetElement?.Value; set { - if (value == null) - OnsetElement = null; - else - OnsetElement = new Hl7.Fhir.Model.FhirDateTime(value); + OnsetElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Onset"); } } @@ -452,13 +445,13 @@ public string Onset [DeclaredType(Type = typeof(Code))] [Binding("AllergyIntoleranceSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// mild | moderate | severe (of event as a whole) @@ -467,13 +460,10 @@ public Code Severi [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -484,13 +474,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceSeverity? Severity [FhirElement("exposureRoute", Order=90)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ExposureRoute + public Hl7.Fhir.Model.CodeableConcept? ExposureRoute { get { return _ExposureRoute; } set { _ExposureRoute = value; OnPropertyChanged("ExposureRoute"); } } - private Hl7.Fhir.Model.CodeableConcept _ExposureRoute; + private Hl7.Fhir.Model.CodeableConcept? _ExposureRoute; /// /// Text about event not captured in other fields. @@ -500,29 +490,25 @@ public Hl7.Fhir.Model.CodeableConcept ExposureRoute [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(Manifestation.Any()) dest.Manifestation = new List(Manifestation.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OnsetElement != null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)OnsetElement.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(ExposureRoute != null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)ExposureRoute.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_Manifestation is not null) dest.Manifestation = new List(_Manifestation.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OnsetElement is not null) dest.OnsetElement = (Hl7.Fhir.Model.FhirDateTime)_OnsetElement.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_ExposureRoute is not null) dest.ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)_ExposureRoute.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -534,76 +520,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.ListEquals(Manifestation, otherT.Manifestation)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(OnsetElement, otherT.OnsetElement)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(ExposureRoute, otherT.ExposureRoute)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "manifestation": - value = Manifestation; - return Manifestation?.Any() == true; + value = _Manifestation; + return _Manifestation?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "onset": - value = OnsetElement; - return OnsetElement is not null; + value = _OnsetElement; + return _OnsetElement is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "exposureRoute": - value = ExposureRoute; - return ExposureRoute is not null; + value = _ExposureRoute; + return _ExposureRoute is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manifestation": - Manifestation = (List)value; + Manifestation = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "onset": - OnsetElement = (Hl7.Fhir.Model.FhirDateTime)value; + OnsetElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "exposureRoute": - ExposureRoute = (Hl7.Fhir.Model.CodeableConcept)value; + ExposureRoute = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -614,13 +600,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",Manifestation); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OnsetElement is not null) yield return new KeyValuePair("onset",OnsetElement); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",ExposureRoute); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Manifestation?.Any() == true) yield return new KeyValuePair("manifestation",_Manifestation); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OnsetElement is not null) yield return new KeyValuePair("onset",_OnsetElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_ExposureRoute is not null) yield return new KeyValuePair("exposureRoute",_ExposureRoute); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -633,11 +619,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | resolved. @@ -645,13 +631,13 @@ public List Identifier [FhirElement("clinicalStatus", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [Binding("AllergyIntoleranceClinicalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ClinicalStatus + public Hl7.Fhir.Model.CodeableConcept? ClinicalStatus { get { return _ClinicalStatus; } set { _ClinicalStatus = value; OnPropertyChanged("ClinicalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ClinicalStatus; + private Hl7.Fhir.Model.CodeableConcept? _ClinicalStatus; /// /// unconfirmed | presumed | confirmed | refuted | entered-in-error. @@ -659,13 +645,13 @@ public Hl7.Fhir.Model.CodeableConcept ClinicalStatus [FhirElement("verificationStatus", InSummary=true, IsModifier=true, Order=110, FiveWs="FiveWs.status")] [Binding("AllergyIntoleranceVerificationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VerificationStatus + public Hl7.Fhir.Model.CodeableConcept? VerificationStatus { get { return _VerificationStatus; } set { _VerificationStatus = value; OnPropertyChanged("VerificationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _VerificationStatus; + private Hl7.Fhir.Model.CodeableConcept? _VerificationStatus; /// /// allergy | intolerance - Underlying mechanism (if known). @@ -673,13 +659,13 @@ public Hl7.Fhir.Model.CodeableConcept VerificationStatus [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Binding("AllergyIntoleranceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// food | medication | environment | biologic. @@ -691,24 +677,24 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List> CategoryElement { - get { if(_CategoryElement==null) _CategoryElement = new List>(); return _CategoryElement; } + get => _CategoryElement ?? new List>(); set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private List> _CategoryElement; + private List>? _CategoryElement; /// /// food | medication | environment | biologic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Category + public IEnumerable? Category { - get { return CategoryElement != null ? CategoryElement.Select(elem => elem.Value) : null; } + get => _CategoryElement?.Select(elem => elem.Value); set { if (value == null) - CategoryElement = null; + CategoryElement = null!; else CategoryElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Category"); @@ -722,13 +708,13 @@ public IEnumerable CriticalityElement + public Code? CriticalityElement { get { return _CriticalityElement; } set { _CriticalityElement = value; OnPropertyChanged("CriticalityElement"); } } - private Code _CriticalityElement; + private Code? _CriticalityElement; /// /// low | high | unable-to-assess @@ -737,13 +723,10 @@ public Code Cri [IgnoreDataMember] public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Criticality { - get { return CriticalityElement != null ? CriticalityElement.Value : null; } + get => _CriticalityElement?.Value; set { - if (value == null) - CriticalityElement = null; - else - CriticalityElement = new Code(value); + CriticalityElement = value is null ? null : new Code(value); OnPropertyChanged("Criticality"); } } @@ -754,13 +737,13 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceCriticality? Critical [FhirElement("code", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [Binding("AllergyIntoleranceCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the allergy or intolerance is for. @@ -770,13 +753,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter when the allergy or intolerance was asserted. @@ -785,13 +768,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When allergy or intolerance was identified. @@ -800,41 +783,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Date allergy or intolerance was first recorded. /// [FhirElement("recordedDate", Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// Date allergy or intolerance was first recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -847,39 +827,36 @@ public string RecordedDate [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Date(/time) of last known occurrence of a reaction. /// [FhirElement("lastOccurrence", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastOccurrenceElement + public Hl7.Fhir.Model.FhirDateTime? LastOccurrenceElement { get { return _LastOccurrenceElement; } set { _LastOccurrenceElement = value; OnPropertyChanged("LastOccurrenceElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastOccurrenceElement; + private Hl7.Fhir.Model.FhirDateTime? _LastOccurrenceElement; /// /// Date(/time) of last known occurrence of a reaction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastOccurrence + public string? LastOccurrence { - get { return LastOccurrenceElement != null ? LastOccurrenceElement.Value : null; } + get => _LastOccurrenceElement?.Value; set { - if (value == null) - LastOccurrenceElement = null; - else - LastOccurrenceElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastOccurrenceElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastOccurrence"); } } @@ -892,11 +869,11 @@ public string LastOccurrence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Adverse Reaction Events linked to exposure to substance. @@ -906,39 +883,35 @@ public List Note [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as AllergyIntolerance; - - if (dest == null) - { + if(other is not AllergyIntolerance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatus != null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)ClinicalStatus.DeepCopyInternal(); - if(VerificationStatus != null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)VerificationStatus.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(CategoryElement.Any()) dest.CategoryElement = new List>(CategoryElement.DeepCopyInternal()); - if(CriticalityElement != null) dest.CriticalityElement = (Code)CriticalityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(LastOccurrenceElement != null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)LastOccurrenceElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatus is not null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)_ClinicalStatus.DeepCopyInternal(); + if(_VerificationStatus is not null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)_VerificationStatus.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = new List>(_CategoryElement.DeepCopyInternal()); + if(_CriticalityElement is not null) dest.CriticalityElement = (Code)_CriticalityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_LastOccurrenceElement is not null) dest.LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)_LastOccurrenceElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -950,132 +923,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllergyIntolerance; - if(otherT == null) return false; + if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatus, otherT.ClinicalStatus)) return false; - if(!comparer.Equals(VerificationStatus, otherT.VerificationStatus)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(CriticalityElement, otherT.CriticalityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(LastOccurrenceElement, otherT.LastOccurrenceElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; + if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_CriticalityElement, otherT._CriticalityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatus; - return ClinicalStatus is not null; + value = _ClinicalStatus; + return _ClinicalStatus is not null; case "verificationStatus": - value = VerificationStatus; - return VerificationStatus is not null; + value = _VerificationStatus; + return _VerificationStatus is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = CategoryElement; - return CategoryElement?.Any() == true; + value = _CategoryElement; + return _CategoryElement?.Any() == true; case "criticality": - value = CriticalityElement; - return CriticalityElement is not null; + value = _CriticalityElement; + return _CriticalityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "lastOccurrence": - value = LastOccurrenceElement; - return LastOccurrenceElement is not null; + value = _LastOccurrenceElement; + return _LastOccurrenceElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verificationStatus": - VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + VerificationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - CategoryElement = (List>)value; + CategoryElement = (List>?)value!; return this; case "criticality": - CriticalityElement = (Code)value; + CriticalityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "lastOccurrence": - LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastOccurrenceElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1086,21 +1059,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatus); - if (VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",VerificationStatus); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (CategoryElement?.Any() == true) yield return new KeyValuePair("category",CategoryElement); - if (CriticalityElement is not null) yield return new KeyValuePair("criticality",CriticalityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",LastOccurrenceElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatus); + if (_VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatus); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_CategoryElement?.Any() == true) yield return new KeyValuePair("category",_CategoryElement); + if (_CriticalityElement is not null) yield return new KeyValuePair("criticality",_CriticalityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_LastOccurrenceElement is not null) yield return new KeyValuePair("lastOccurrence",_LastOccurrenceElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs b/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs index 2a806d1b9..cc95b37c5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -68,41 +71,38 @@ public partial class Annotation : Hl7.Fhir.Model.DataType [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Author + public Hl7.Fhir.Model.DataType? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.DataType _Author; + private Hl7.Fhir.Model.DataType? _Author; /// /// When the annotation was made. /// [FhirElement("time", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the annotation was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -113,45 +113,38 @@ public string Time [FhirElement("text", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// The annotation - text content (as markdown) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Annotation; - - if (dest == null) - { + if(other is not Annotation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Author != null) dest.Author = (Hl7.Fhir.Model.DataType)Author.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.DataType)_Author.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -163,48 +156,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Annotation; - if(otherT == null) return false; + if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "author": - Author = (Hl7.Fhir.Model.DataType)value; + Author = (Hl7.Fhir.Model.DataType?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -215,9 +208,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Author is not null) yield return new KeyValuePair("author",Author); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs index 042d1d198..62d35584e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -3049,24 +3052,24 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Participation period of the actor. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The individual, device, location, or service participating in the appointment. @@ -3075,26 +3078,26 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Patient","Group","Practitioner","PractitionerRole","CareTeam","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// The participant is required to attend (optional when false). /// [FhirElement("required", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// The participant is required to attend (optional when false) @@ -3103,13 +3106,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -3122,13 +3122,13 @@ public bool? Required [Binding("ParticipationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// accepted | declined | tentative | needs-action @@ -3137,32 +3137,25 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.ParticipationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3174,62 +3167,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -3240,11 +3233,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); } } @@ -3271,13 +3264,13 @@ public partial class RecurrenceTemplateComponent : Hl7.Fhir.Model.BackboneElemen [FhirElement("timezone", Order=40)] [Binding("IANATimezone")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Timezone + public Hl7.Fhir.Model.CodeableConcept? Timezone { get { return _Timezone; } set { _Timezone = value; OnPropertyChanged("Timezone"); } } - private Hl7.Fhir.Model.CodeableConcept _Timezone; + private Hl7.Fhir.Model.CodeableConcept? _Timezone; /// /// The frequency of the recurrence. @@ -3286,41 +3279,38 @@ public Hl7.Fhir.Model.CodeableConcept Timezone [Binding("AppointmentRecurrenceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RecurrenceType + public Hl7.Fhir.Model.CodeableConcept? RecurrenceType { get { return _RecurrenceType; } set { _RecurrenceType = value; OnPropertyChanged("RecurrenceType"); } } - private Hl7.Fhir.Model.CodeableConcept _RecurrenceType; + private Hl7.Fhir.Model.CodeableConcept? _RecurrenceType; /// /// The date when the recurrence should end. /// [FhirElement("lastOccurrenceDate", Order=60)] [DataMember] - public Hl7.Fhir.Model.Date LastOccurrenceDateElement + public Hl7.Fhir.Model.Date? LastOccurrenceDateElement { get { return _LastOccurrenceDateElement; } set { _LastOccurrenceDateElement = value; OnPropertyChanged("LastOccurrenceDateElement"); } } - private Hl7.Fhir.Model.Date _LastOccurrenceDateElement; + private Hl7.Fhir.Model.Date? _LastOccurrenceDateElement; /// /// The date when the recurrence should end /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastOccurrenceDate + public string? LastOccurrenceDate { - get { return LastOccurrenceDateElement != null ? LastOccurrenceDateElement.Value : null; } + get => _LastOccurrenceDateElement?.Value; set { - if (value == null) - LastOccurrenceDateElement = null; - else - LastOccurrenceDateElement = new Hl7.Fhir.Model.Date(value); + LastOccurrenceDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastOccurrenceDate"); } } @@ -3330,13 +3320,13 @@ public string LastOccurrenceDate /// [FhirElement("occurrenceCount", Order=70)] [DataMember] - public Hl7.Fhir.Model.PositiveInt OccurrenceCountElement + public Hl7.Fhir.Model.PositiveInt? OccurrenceCountElement { get { return _OccurrenceCountElement; } set { _OccurrenceCountElement = value; OnPropertyChanged("OccurrenceCountElement"); } } - private Hl7.Fhir.Model.PositiveInt _OccurrenceCountElement; + private Hl7.Fhir.Model.PositiveInt? _OccurrenceCountElement; /// /// The number of planned occurrences @@ -3345,13 +3335,10 @@ public Hl7.Fhir.Model.PositiveInt OccurrenceCountElement [IgnoreDataMember] public int? OccurrenceCount { - get { return OccurrenceCountElement != null ? OccurrenceCountElement.Value : null; } + get => _OccurrenceCountElement?.Value; set { - if (value == null) - OccurrenceCountElement = null; - else - OccurrenceCountElement = new Hl7.Fhir.Model.PositiveInt(value); + OccurrenceCountElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("OccurrenceCount"); } } @@ -3364,24 +3351,24 @@ public int? OccurrenceCount [DataMember] public List OccurrenceDateElement { - get { if(_OccurrenceDateElement==null) _OccurrenceDateElement = new List(); return _OccurrenceDateElement; } + get => _OccurrenceDateElement ?? new List(); set { _OccurrenceDateElement = value; OnPropertyChanged("OccurrenceDateElement"); } } - private List _OccurrenceDateElement; + private List? _OccurrenceDateElement; /// /// Specific dates for a recurring set of appointments (no template) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable OccurrenceDate + public IEnumerable? OccurrenceDate { - get { return OccurrenceDateElement != null ? OccurrenceDateElement.Select(elem => elem.Value) : null; } + get => _OccurrenceDateElement?.Select(elem => elem.Value); set { if (value == null) - OccurrenceDateElement = null; + OccurrenceDateElement = null!; else OccurrenceDateElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Date(elem))); OnPropertyChanged("OccurrenceDate"); @@ -3393,39 +3380,39 @@ public IEnumerable OccurrenceDate /// [FhirElement("weeklyTemplate", Order=90)] [DataMember] - public Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent WeeklyTemplate + public Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent? WeeklyTemplate { get { return _WeeklyTemplate; } set { _WeeklyTemplate = value; OnPropertyChanged("WeeklyTemplate"); } } - private Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent _WeeklyTemplate; + private Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent? _WeeklyTemplate; /// /// Information about monthly recurring appointments. /// [FhirElement("monthlyTemplate", Order=100)] [DataMember] - public Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent MonthlyTemplate + public Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent? MonthlyTemplate { get { return _MonthlyTemplate; } set { _MonthlyTemplate = value; OnPropertyChanged("MonthlyTemplate"); } } - private Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent _MonthlyTemplate; + private Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent? _MonthlyTemplate; /// /// Information about yearly recurring appointments. /// [FhirElement("yearlyTemplate", Order=110)] [DataMember] - public Hl7.Fhir.Model.Appointment.YearlyTemplateComponent YearlyTemplate + public Hl7.Fhir.Model.Appointment.YearlyTemplateComponent? YearlyTemplate { get { return _YearlyTemplate; } set { _YearlyTemplate = value; OnPropertyChanged("YearlyTemplate"); } } - private Hl7.Fhir.Model.Appointment.YearlyTemplateComponent _YearlyTemplate; + private Hl7.Fhir.Model.Appointment.YearlyTemplateComponent? _YearlyTemplate; /// /// Any dates that should be excluded from the series. @@ -3435,24 +3422,24 @@ public Hl7.Fhir.Model.Appointment.YearlyTemplateComponent YearlyTemplate [DataMember] public List ExcludingDateElement { - get { if(_ExcludingDateElement==null) _ExcludingDateElement = new List(); return _ExcludingDateElement; } + get => _ExcludingDateElement ?? new List(); set { _ExcludingDateElement = value; OnPropertyChanged("ExcludingDateElement"); } } - private List _ExcludingDateElement; + private List? _ExcludingDateElement; /// /// Any dates that should be excluded from the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ExcludingDate + public IEnumerable? ExcludingDate { - get { return ExcludingDateElement != null ? ExcludingDateElement.Select(elem => elem.Value) : null; } + get => _ExcludingDateElement?.Select(elem => elem.Value); set { if (value == null) - ExcludingDateElement = null; + ExcludingDateElement = null!; else ExcludingDateElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Date(elem))); OnPropertyChanged("ExcludingDate"); @@ -3467,24 +3454,24 @@ public IEnumerable ExcludingDate [DataMember] public List ExcludingRecurrenceIdElement { - get { if(_ExcludingRecurrenceIdElement==null) _ExcludingRecurrenceIdElement = new List(); return _ExcludingRecurrenceIdElement; } + get => _ExcludingRecurrenceIdElement ?? new List(); set { _ExcludingRecurrenceIdElement = value; OnPropertyChanged("ExcludingRecurrenceIdElement"); } } - private List _ExcludingRecurrenceIdElement; + private List? _ExcludingRecurrenceIdElement; /// /// Any recurrence IDs that should be excluded from the recurrence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ExcludingRecurrenceId + public IEnumerable? ExcludingRecurrenceId { - get { return ExcludingRecurrenceIdElement != null ? ExcludingRecurrenceIdElement.Select(elem => elem.Value) : null; } + get => _ExcludingRecurrenceIdElement?.Select(elem => elem.Value); set { if (value == null) - ExcludingRecurrenceIdElement = null; + ExcludingRecurrenceIdElement = null!; else ExcludingRecurrenceIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ExcludingRecurrenceId"); @@ -3493,24 +3480,20 @@ public IEnumerable ExcludingRecurrenceId protected internal override void CopyToInternal(Base other) { - var dest = other as RecurrenceTemplateComponent; - - if (dest == null) - { + if(other is not RecurrenceTemplateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Timezone != null) dest.Timezone = (Hl7.Fhir.Model.CodeableConcept)Timezone.DeepCopyInternal(); - if(RecurrenceType != null) dest.RecurrenceType = (Hl7.Fhir.Model.CodeableConcept)RecurrenceType.DeepCopyInternal(); - if(LastOccurrenceDateElement != null) dest.LastOccurrenceDateElement = (Hl7.Fhir.Model.Date)LastOccurrenceDateElement.DeepCopyInternal(); - if(OccurrenceCountElement != null) dest.OccurrenceCountElement = (Hl7.Fhir.Model.PositiveInt)OccurrenceCountElement.DeepCopyInternal(); - if(OccurrenceDateElement.Any()) dest.OccurrenceDateElement = new List(OccurrenceDateElement.DeepCopyInternal()); - if(WeeklyTemplate != null) dest.WeeklyTemplate = (Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent)WeeklyTemplate.DeepCopyInternal(); - if(MonthlyTemplate != null) dest.MonthlyTemplate = (Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent)MonthlyTemplate.DeepCopyInternal(); - if(YearlyTemplate != null) dest.YearlyTemplate = (Hl7.Fhir.Model.Appointment.YearlyTemplateComponent)YearlyTemplate.DeepCopyInternal(); - if(ExcludingDateElement.Any()) dest.ExcludingDateElement = new List(ExcludingDateElement.DeepCopyInternal()); - if(ExcludingRecurrenceIdElement.Any()) dest.ExcludingRecurrenceIdElement = new List(ExcludingRecurrenceIdElement.DeepCopyInternal()); + if(_Timezone is not null) dest.Timezone = (Hl7.Fhir.Model.CodeableConcept)_Timezone.DeepCopyInternal(); + if(_RecurrenceType is not null) dest.RecurrenceType = (Hl7.Fhir.Model.CodeableConcept)_RecurrenceType.DeepCopyInternal(); + if(_LastOccurrenceDateElement is not null) dest.LastOccurrenceDateElement = (Hl7.Fhir.Model.Date)_LastOccurrenceDateElement.DeepCopyInternal(); + if(_OccurrenceCountElement is not null) dest.OccurrenceCountElement = (Hl7.Fhir.Model.PositiveInt)_OccurrenceCountElement.DeepCopyInternal(); + if(_OccurrenceDateElement is not null) dest.OccurrenceDateElement = new List(_OccurrenceDateElement.DeepCopyInternal()); + if(_WeeklyTemplate is not null) dest.WeeklyTemplate = (Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent)_WeeklyTemplate.DeepCopyInternal(); + if(_MonthlyTemplate is not null) dest.MonthlyTemplate = (Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent)_MonthlyTemplate.DeepCopyInternal(); + if(_YearlyTemplate is not null) dest.YearlyTemplate = (Hl7.Fhir.Model.Appointment.YearlyTemplateComponent)_YearlyTemplate.DeepCopyInternal(); + if(_ExcludingDateElement is not null) dest.ExcludingDateElement = new List(_ExcludingDateElement.DeepCopyInternal()); + if(_ExcludingRecurrenceIdElement is not null) dest.ExcludingRecurrenceIdElement = new List(_ExcludingRecurrenceIdElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3522,97 +3505,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RecurrenceTemplateComponent; - if(otherT == null) return false; + if(other is not RecurrenceTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Timezone, otherT.Timezone)) return false; - if(!comparer.Equals(RecurrenceType, otherT.RecurrenceType)) return false; - if(!comparer.Equals(LastOccurrenceDateElement, otherT.LastOccurrenceDateElement)) return false; - if(!comparer.Equals(OccurrenceCountElement, otherT.OccurrenceCountElement)) return false; - if(!comparer.ListEquals(OccurrenceDateElement, otherT.OccurrenceDateElement)) return false; - if(!comparer.Equals(WeeklyTemplate, otherT.WeeklyTemplate)) return false; - if(!comparer.Equals(MonthlyTemplate, otherT.MonthlyTemplate)) return false; - if(!comparer.Equals(YearlyTemplate, otherT.YearlyTemplate)) return false; - if(!comparer.ListEquals(ExcludingDateElement, otherT.ExcludingDateElement)) return false; - if(!comparer.ListEquals(ExcludingRecurrenceIdElement, otherT.ExcludingRecurrenceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Timezone, otherT._Timezone)) return false; + if(!comparer.Equals(_RecurrenceType, otherT._RecurrenceType)) return false; + if(!comparer.Equals(_LastOccurrenceDateElement, otherT._LastOccurrenceDateElement)) return false; + if(!comparer.Equals(_OccurrenceCountElement, otherT._OccurrenceCountElement)) return false; + if(!comparer.ListEquals(_OccurrenceDateElement, otherT._OccurrenceDateElement)) return false; + if(!comparer.Equals(_WeeklyTemplate, otherT._WeeklyTemplate)) return false; + if(!comparer.Equals(_MonthlyTemplate, otherT._MonthlyTemplate)) return false; + if(!comparer.Equals(_YearlyTemplate, otherT._YearlyTemplate)) return false; + if(!comparer.ListEquals(_ExcludingDateElement, otherT._ExcludingDateElement)) return false; + if(!comparer.ListEquals(_ExcludingRecurrenceIdElement, otherT._ExcludingRecurrenceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "timezone": - value = Timezone; - return Timezone is not null; + value = _Timezone; + return _Timezone is not null; case "recurrenceType": - value = RecurrenceType; - return RecurrenceType is not null; + value = _RecurrenceType; + return _RecurrenceType is not null; case "lastOccurrenceDate": - value = LastOccurrenceDateElement; - return LastOccurrenceDateElement is not null; + value = _LastOccurrenceDateElement; + return _LastOccurrenceDateElement is not null; case "occurrenceCount": - value = OccurrenceCountElement; - return OccurrenceCountElement is not null; + value = _OccurrenceCountElement; + return _OccurrenceCountElement is not null; case "occurrenceDate": - value = OccurrenceDateElement; - return OccurrenceDateElement?.Any() == true; + value = _OccurrenceDateElement; + return _OccurrenceDateElement?.Any() == true; case "weeklyTemplate": - value = WeeklyTemplate; - return WeeklyTemplate is not null; + value = _WeeklyTemplate; + return _WeeklyTemplate is not null; case "monthlyTemplate": - value = MonthlyTemplate; - return MonthlyTemplate is not null; + value = _MonthlyTemplate; + return _MonthlyTemplate is not null; case "yearlyTemplate": - value = YearlyTemplate; - return YearlyTemplate is not null; + value = _YearlyTemplate; + return _YearlyTemplate is not null; case "excludingDate": - value = ExcludingDateElement; - return ExcludingDateElement?.Any() == true; + value = _ExcludingDateElement; + return _ExcludingDateElement?.Any() == true; case "excludingRecurrenceId": - value = ExcludingRecurrenceIdElement; - return ExcludingRecurrenceIdElement?.Any() == true; + value = _ExcludingRecurrenceIdElement; + return _ExcludingRecurrenceIdElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "timezone": - Timezone = (Hl7.Fhir.Model.CodeableConcept)value; + Timezone = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recurrenceType": - RecurrenceType = (Hl7.Fhir.Model.CodeableConcept)value; + RecurrenceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "lastOccurrenceDate": - LastOccurrenceDateElement = (Hl7.Fhir.Model.Date)value; + LastOccurrenceDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "occurrenceCount": - OccurrenceCountElement = (Hl7.Fhir.Model.PositiveInt)value; + OccurrenceCountElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "occurrenceDate": - OccurrenceDateElement = (List)value; + OccurrenceDateElement = (List?)value!; return this; case "weeklyTemplate": - WeeklyTemplate = (Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent)value; + WeeklyTemplate = (Hl7.Fhir.Model.Appointment.WeeklyTemplateComponent?)value; return this; case "monthlyTemplate": - MonthlyTemplate = (Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent)value; + MonthlyTemplate = (Hl7.Fhir.Model.Appointment.MonthlyTemplateComponent?)value; return this; case "yearlyTemplate": - YearlyTemplate = (Hl7.Fhir.Model.Appointment.YearlyTemplateComponent)value; + YearlyTemplate = (Hl7.Fhir.Model.Appointment.YearlyTemplateComponent?)value; return this; case "excludingDate": - ExcludingDateElement = (List)value; + ExcludingDateElement = (List?)value!; return this; case "excludingRecurrenceId": - ExcludingRecurrenceIdElement = (List)value; + ExcludingRecurrenceIdElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3623,16 +3606,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Timezone is not null) yield return new KeyValuePair("timezone",Timezone); - if (RecurrenceType is not null) yield return new KeyValuePair("recurrenceType",RecurrenceType); - if (LastOccurrenceDateElement is not null) yield return new KeyValuePair("lastOccurrenceDate",LastOccurrenceDateElement); - if (OccurrenceCountElement is not null) yield return new KeyValuePair("occurrenceCount",OccurrenceCountElement); - if (OccurrenceDateElement?.Any() == true) yield return new KeyValuePair("occurrenceDate",OccurrenceDateElement); - if (WeeklyTemplate is not null) yield return new KeyValuePair("weeklyTemplate",WeeklyTemplate); - if (MonthlyTemplate is not null) yield return new KeyValuePair("monthlyTemplate",MonthlyTemplate); - if (YearlyTemplate is not null) yield return new KeyValuePair("yearlyTemplate",YearlyTemplate); - if (ExcludingDateElement?.Any() == true) yield return new KeyValuePair("excludingDate",ExcludingDateElement); - if (ExcludingRecurrenceIdElement?.Any() == true) yield return new KeyValuePair("excludingRecurrenceId",ExcludingRecurrenceIdElement); + if (_Timezone is not null) yield return new KeyValuePair("timezone",_Timezone); + if (_RecurrenceType is not null) yield return new KeyValuePair("recurrenceType",_RecurrenceType); + if (_LastOccurrenceDateElement is not null) yield return new KeyValuePair("lastOccurrenceDate",_LastOccurrenceDateElement); + if (_OccurrenceCountElement is not null) yield return new KeyValuePair("occurrenceCount",_OccurrenceCountElement); + if (_OccurrenceDateElement?.Any() == true) yield return new KeyValuePair("occurrenceDate",_OccurrenceDateElement); + if (_WeeklyTemplate is not null) yield return new KeyValuePair("weeklyTemplate",_WeeklyTemplate); + if (_MonthlyTemplate is not null) yield return new KeyValuePair("monthlyTemplate",_MonthlyTemplate); + if (_YearlyTemplate is not null) yield return new KeyValuePair("yearlyTemplate",_YearlyTemplate); + if (_ExcludingDateElement?.Any() == true) yield return new KeyValuePair("excludingDate",_ExcludingDateElement); + if (_ExcludingRecurrenceIdElement?.Any() == true) yield return new KeyValuePair("excludingRecurrenceId",_ExcludingRecurrenceIdElement); } } @@ -3655,13 +3638,13 @@ public partial class WeeklyTemplateComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("monday", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MondayElement + public Hl7.Fhir.Model.FhirBoolean? MondayElement { get { return _MondayElement; } set { _MondayElement = value; OnPropertyChanged("MondayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MondayElement; + private Hl7.Fhir.Model.FhirBoolean? _MondayElement; /// /// Recurs on Mondays @@ -3670,13 +3653,10 @@ public Hl7.Fhir.Model.FhirBoolean MondayElement [IgnoreDataMember] public bool? Monday { - get { return MondayElement != null ? MondayElement.Value : null; } + get => _MondayElement?.Value; set { - if (value == null) - MondayElement = null; - else - MondayElement = new Hl7.Fhir.Model.FhirBoolean(value); + MondayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Monday"); } } @@ -3686,13 +3666,13 @@ public bool? Monday /// [FhirElement("tuesday", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TuesdayElement + public Hl7.Fhir.Model.FhirBoolean? TuesdayElement { get { return _TuesdayElement; } set { _TuesdayElement = value; OnPropertyChanged("TuesdayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TuesdayElement; + private Hl7.Fhir.Model.FhirBoolean? _TuesdayElement; /// /// Recurs on Tuesday @@ -3701,13 +3681,10 @@ public Hl7.Fhir.Model.FhirBoolean TuesdayElement [IgnoreDataMember] public bool? Tuesday { - get { return TuesdayElement != null ? TuesdayElement.Value : null; } + get => _TuesdayElement?.Value; set { - if (value == null) - TuesdayElement = null; - else - TuesdayElement = new Hl7.Fhir.Model.FhirBoolean(value); + TuesdayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Tuesday"); } } @@ -3717,13 +3694,13 @@ public bool? Tuesday /// [FhirElement("wednesday", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WednesdayElement + public Hl7.Fhir.Model.FhirBoolean? WednesdayElement { get { return _WednesdayElement; } set { _WednesdayElement = value; OnPropertyChanged("WednesdayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WednesdayElement; + private Hl7.Fhir.Model.FhirBoolean? _WednesdayElement; /// /// Recurs on Wednesday @@ -3732,13 +3709,10 @@ public Hl7.Fhir.Model.FhirBoolean WednesdayElement [IgnoreDataMember] public bool? Wednesday { - get { return WednesdayElement != null ? WednesdayElement.Value : null; } + get => _WednesdayElement?.Value; set { - if (value == null) - WednesdayElement = null; - else - WednesdayElement = new Hl7.Fhir.Model.FhirBoolean(value); + WednesdayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Wednesday"); } } @@ -3748,13 +3722,13 @@ public bool? Wednesday /// [FhirElement("thursday", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ThursdayElement + public Hl7.Fhir.Model.FhirBoolean? ThursdayElement { get { return _ThursdayElement; } set { _ThursdayElement = value; OnPropertyChanged("ThursdayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ThursdayElement; + private Hl7.Fhir.Model.FhirBoolean? _ThursdayElement; /// /// Recurs on Thursday @@ -3763,13 +3737,10 @@ public Hl7.Fhir.Model.FhirBoolean ThursdayElement [IgnoreDataMember] public bool? Thursday { - get { return ThursdayElement != null ? ThursdayElement.Value : null; } + get => _ThursdayElement?.Value; set { - if (value == null) - ThursdayElement = null; - else - ThursdayElement = new Hl7.Fhir.Model.FhirBoolean(value); + ThursdayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Thursday"); } } @@ -3779,13 +3750,13 @@ public bool? Thursday /// [FhirElement("friday", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FridayElement + public Hl7.Fhir.Model.FhirBoolean? FridayElement { get { return _FridayElement; } set { _FridayElement = value; OnPropertyChanged("FridayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FridayElement; + private Hl7.Fhir.Model.FhirBoolean? _FridayElement; /// /// Recurs on Friday @@ -3794,13 +3765,10 @@ public Hl7.Fhir.Model.FhirBoolean FridayElement [IgnoreDataMember] public bool? Friday { - get { return FridayElement != null ? FridayElement.Value : null; } + get => _FridayElement?.Value; set { - if (value == null) - FridayElement = null; - else - FridayElement = new Hl7.Fhir.Model.FhirBoolean(value); + FridayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Friday"); } } @@ -3810,13 +3778,13 @@ public bool? Friday /// [FhirElement("saturday", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SaturdayElement + public Hl7.Fhir.Model.FhirBoolean? SaturdayElement { get { return _SaturdayElement; } set { _SaturdayElement = value; OnPropertyChanged("SaturdayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SaturdayElement; + private Hl7.Fhir.Model.FhirBoolean? _SaturdayElement; /// /// Recurs on Saturday @@ -3825,13 +3793,10 @@ public Hl7.Fhir.Model.FhirBoolean SaturdayElement [IgnoreDataMember] public bool? Saturday { - get { return SaturdayElement != null ? SaturdayElement.Value : null; } + get => _SaturdayElement?.Value; set { - if (value == null) - SaturdayElement = null; - else - SaturdayElement = new Hl7.Fhir.Model.FhirBoolean(value); + SaturdayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Saturday"); } } @@ -3841,13 +3806,13 @@ public bool? Saturday /// [FhirElement("sunday", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SundayElement + public Hl7.Fhir.Model.FhirBoolean? SundayElement { get { return _SundayElement; } set { _SundayElement = value; OnPropertyChanged("SundayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SundayElement; + private Hl7.Fhir.Model.FhirBoolean? _SundayElement; /// /// Recurs on Sunday @@ -3856,13 +3821,10 @@ public Hl7.Fhir.Model.FhirBoolean SundayElement [IgnoreDataMember] public bool? Sunday { - get { return SundayElement != null ? SundayElement.Value : null; } + get => _SundayElement?.Value; set { - if (value == null) - SundayElement = null; - else - SundayElement = new Hl7.Fhir.Model.FhirBoolean(value); + SundayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Sunday"); } } @@ -3872,13 +3834,13 @@ public bool? Sunday /// [FhirElement("weekInterval", Order=110)] [DataMember] - public Hl7.Fhir.Model.PositiveInt WeekIntervalElement + public Hl7.Fhir.Model.PositiveInt? WeekIntervalElement { get { return _WeekIntervalElement; } set { _WeekIntervalElement = value; OnPropertyChanged("WeekIntervalElement"); } } - private Hl7.Fhir.Model.PositiveInt _WeekIntervalElement; + private Hl7.Fhir.Model.PositiveInt? _WeekIntervalElement; /// /// Recurs every nth week @@ -3887,35 +3849,28 @@ public Hl7.Fhir.Model.PositiveInt WeekIntervalElement [IgnoreDataMember] public int? WeekInterval { - get { return WeekIntervalElement != null ? WeekIntervalElement.Value : null; } + get => _WeekIntervalElement?.Value; set { - if (value == null) - WeekIntervalElement = null; - else - WeekIntervalElement = new Hl7.Fhir.Model.PositiveInt(value); + WeekIntervalElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("WeekInterval"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as WeeklyTemplateComponent; - - if (dest == null) - { + if(other is not WeeklyTemplateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MondayElement != null) dest.MondayElement = (Hl7.Fhir.Model.FhirBoolean)MondayElement.DeepCopyInternal(); - if(TuesdayElement != null) dest.TuesdayElement = (Hl7.Fhir.Model.FhirBoolean)TuesdayElement.DeepCopyInternal(); - if(WednesdayElement != null) dest.WednesdayElement = (Hl7.Fhir.Model.FhirBoolean)WednesdayElement.DeepCopyInternal(); - if(ThursdayElement != null) dest.ThursdayElement = (Hl7.Fhir.Model.FhirBoolean)ThursdayElement.DeepCopyInternal(); - if(FridayElement != null) dest.FridayElement = (Hl7.Fhir.Model.FhirBoolean)FridayElement.DeepCopyInternal(); - if(SaturdayElement != null) dest.SaturdayElement = (Hl7.Fhir.Model.FhirBoolean)SaturdayElement.DeepCopyInternal(); - if(SundayElement != null) dest.SundayElement = (Hl7.Fhir.Model.FhirBoolean)SundayElement.DeepCopyInternal(); - if(WeekIntervalElement != null) dest.WeekIntervalElement = (Hl7.Fhir.Model.PositiveInt)WeekIntervalElement.DeepCopyInternal(); + if(_MondayElement is not null) dest.MondayElement = (Hl7.Fhir.Model.FhirBoolean)_MondayElement.DeepCopyInternal(); + if(_TuesdayElement is not null) dest.TuesdayElement = (Hl7.Fhir.Model.FhirBoolean)_TuesdayElement.DeepCopyInternal(); + if(_WednesdayElement is not null) dest.WednesdayElement = (Hl7.Fhir.Model.FhirBoolean)_WednesdayElement.DeepCopyInternal(); + if(_ThursdayElement is not null) dest.ThursdayElement = (Hl7.Fhir.Model.FhirBoolean)_ThursdayElement.DeepCopyInternal(); + if(_FridayElement is not null) dest.FridayElement = (Hl7.Fhir.Model.FhirBoolean)_FridayElement.DeepCopyInternal(); + if(_SaturdayElement is not null) dest.SaturdayElement = (Hl7.Fhir.Model.FhirBoolean)_SaturdayElement.DeepCopyInternal(); + if(_SundayElement is not null) dest.SundayElement = (Hl7.Fhir.Model.FhirBoolean)_SundayElement.DeepCopyInternal(); + if(_WeekIntervalElement is not null) dest.WeekIntervalElement = (Hl7.Fhir.Model.PositiveInt)_WeekIntervalElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3927,83 +3882,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as WeeklyTemplateComponent; - if(otherT == null) return false; + if(other is not WeeklyTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MondayElement, otherT.MondayElement)) return false; - if(!comparer.Equals(TuesdayElement, otherT.TuesdayElement)) return false; - if(!comparer.Equals(WednesdayElement, otherT.WednesdayElement)) return false; - if(!comparer.Equals(ThursdayElement, otherT.ThursdayElement)) return false; - if(!comparer.Equals(FridayElement, otherT.FridayElement)) return false; - if(!comparer.Equals(SaturdayElement, otherT.SaturdayElement)) return false; - if(!comparer.Equals(SundayElement, otherT.SundayElement)) return false; - if(!comparer.Equals(WeekIntervalElement, otherT.WeekIntervalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MondayElement, otherT._MondayElement)) return false; + if(!comparer.Equals(_TuesdayElement, otherT._TuesdayElement)) return false; + if(!comparer.Equals(_WednesdayElement, otherT._WednesdayElement)) return false; + if(!comparer.Equals(_ThursdayElement, otherT._ThursdayElement)) return false; + if(!comparer.Equals(_FridayElement, otherT._FridayElement)) return false; + if(!comparer.Equals(_SaturdayElement, otherT._SaturdayElement)) return false; + if(!comparer.Equals(_SundayElement, otherT._SundayElement)) return false; + if(!comparer.Equals(_WeekIntervalElement, otherT._WeekIntervalElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "monday": - value = MondayElement; - return MondayElement is not null; + value = _MondayElement; + return _MondayElement is not null; case "tuesday": - value = TuesdayElement; - return TuesdayElement is not null; + value = _TuesdayElement; + return _TuesdayElement is not null; case "wednesday": - value = WednesdayElement; - return WednesdayElement is not null; + value = _WednesdayElement; + return _WednesdayElement is not null; case "thursday": - value = ThursdayElement; - return ThursdayElement is not null; + value = _ThursdayElement; + return _ThursdayElement is not null; case "friday": - value = FridayElement; - return FridayElement is not null; + value = _FridayElement; + return _FridayElement is not null; case "saturday": - value = SaturdayElement; - return SaturdayElement is not null; + value = _SaturdayElement; + return _SaturdayElement is not null; case "sunday": - value = SundayElement; - return SundayElement is not null; + value = _SundayElement; + return _SundayElement is not null; case "weekInterval": - value = WeekIntervalElement; - return WeekIntervalElement is not null; + value = _WeekIntervalElement; + return _WeekIntervalElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "monday": - MondayElement = (Hl7.Fhir.Model.FhirBoolean)value; + MondayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "tuesday": - TuesdayElement = (Hl7.Fhir.Model.FhirBoolean)value; + TuesdayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "wednesday": - WednesdayElement = (Hl7.Fhir.Model.FhirBoolean)value; + WednesdayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "thursday": - ThursdayElement = (Hl7.Fhir.Model.FhirBoolean)value; + ThursdayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "friday": - FridayElement = (Hl7.Fhir.Model.FhirBoolean)value; + FridayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "saturday": - SaturdayElement = (Hl7.Fhir.Model.FhirBoolean)value; + SaturdayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "sunday": - SundayElement = (Hl7.Fhir.Model.FhirBoolean)value; + SundayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "weekInterval": - WeekIntervalElement = (Hl7.Fhir.Model.PositiveInt)value; + WeekIntervalElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -4014,14 +3969,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MondayElement is not null) yield return new KeyValuePair("monday",MondayElement); - if (TuesdayElement is not null) yield return new KeyValuePair("tuesday",TuesdayElement); - if (WednesdayElement is not null) yield return new KeyValuePair("wednesday",WednesdayElement); - if (ThursdayElement is not null) yield return new KeyValuePair("thursday",ThursdayElement); - if (FridayElement is not null) yield return new KeyValuePair("friday",FridayElement); - if (SaturdayElement is not null) yield return new KeyValuePair("saturday",SaturdayElement); - if (SundayElement is not null) yield return new KeyValuePair("sunday",SundayElement); - if (WeekIntervalElement is not null) yield return new KeyValuePair("weekInterval",WeekIntervalElement); + if (_MondayElement is not null) yield return new KeyValuePair("monday",_MondayElement); + if (_TuesdayElement is not null) yield return new KeyValuePair("tuesday",_TuesdayElement); + if (_WednesdayElement is not null) yield return new KeyValuePair("wednesday",_WednesdayElement); + if (_ThursdayElement is not null) yield return new KeyValuePair("thursday",_ThursdayElement); + if (_FridayElement is not null) yield return new KeyValuePair("friday",_FridayElement); + if (_SaturdayElement is not null) yield return new KeyValuePair("saturday",_SaturdayElement); + if (_SundayElement is not null) yield return new KeyValuePair("sunday",_SundayElement); + if (_WeekIntervalElement is not null) yield return new KeyValuePair("weekInterval",_WeekIntervalElement); } } @@ -4044,13 +3999,13 @@ public partial class MonthlyTemplateComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("dayOfMonth", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DayOfMonthElement + public Hl7.Fhir.Model.PositiveInt? DayOfMonthElement { get { return _DayOfMonthElement; } set { _DayOfMonthElement = value; OnPropertyChanged("DayOfMonthElement"); } } - private Hl7.Fhir.Model.PositiveInt _DayOfMonthElement; + private Hl7.Fhir.Model.PositiveInt? _DayOfMonthElement; /// /// Recurs on a specific day of the month @@ -4059,13 +4014,10 @@ public Hl7.Fhir.Model.PositiveInt DayOfMonthElement [IgnoreDataMember] public int? DayOfMonth { - get { return DayOfMonthElement != null ? DayOfMonthElement.Value : null; } + get => _DayOfMonthElement?.Value; set { - if (value == null) - DayOfMonthElement = null; - else - DayOfMonthElement = new Hl7.Fhir.Model.PositiveInt(value); + DayOfMonthElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DayOfMonth"); } } @@ -4076,13 +4028,13 @@ public int? DayOfMonth [FhirElement("nthWeekOfMonth", Order=50)] [Binding("WeekOfMonth")] [DataMember] - public Hl7.Fhir.Model.Coding NthWeekOfMonth + public Hl7.Fhir.Model.Coding? NthWeekOfMonth { get { return _NthWeekOfMonth; } set { _NthWeekOfMonth = value; OnPropertyChanged("NthWeekOfMonth"); } } - private Hl7.Fhir.Model.Coding _NthWeekOfMonth; + private Hl7.Fhir.Model.Coding? _NthWeekOfMonth; /// /// Indicates which day of the week the appointment should occur. @@ -4090,13 +4042,13 @@ public Hl7.Fhir.Model.Coding NthWeekOfMonth [FhirElement("dayOfWeek", Order=60)] [Binding("DaysOfWeek")] [DataMember] - public Hl7.Fhir.Model.Coding DayOfWeek + public Hl7.Fhir.Model.Coding? DayOfWeek { get { return _DayOfWeek; } set { _DayOfWeek = value; OnPropertyChanged("DayOfWeek"); } } - private Hl7.Fhir.Model.Coding _DayOfWeek; + private Hl7.Fhir.Model.Coding? _DayOfWeek; /// /// Recurs every nth month. @@ -4104,13 +4056,13 @@ public Hl7.Fhir.Model.Coding DayOfWeek [FhirElement("monthInterval", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt MonthIntervalElement + public Hl7.Fhir.Model.PositiveInt? MonthIntervalElement { get { return _MonthIntervalElement; } set { _MonthIntervalElement = value; OnPropertyChanged("MonthIntervalElement"); } } - private Hl7.Fhir.Model.PositiveInt _MonthIntervalElement; + private Hl7.Fhir.Model.PositiveInt? _MonthIntervalElement; /// /// Recurs every nth month @@ -4119,31 +4071,24 @@ public Hl7.Fhir.Model.PositiveInt MonthIntervalElement [IgnoreDataMember] public int? MonthInterval { - get { return MonthIntervalElement != null ? MonthIntervalElement.Value : null; } + get => _MonthIntervalElement?.Value; set { - if (value == null) - MonthIntervalElement = null; - else - MonthIntervalElement = new Hl7.Fhir.Model.PositiveInt(value); + MonthIntervalElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("MonthInterval"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MonthlyTemplateComponent; - - if (dest == null) - { + if(other is not MonthlyTemplateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DayOfMonthElement != null) dest.DayOfMonthElement = (Hl7.Fhir.Model.PositiveInt)DayOfMonthElement.DeepCopyInternal(); - if(NthWeekOfMonth != null) dest.NthWeekOfMonth = (Hl7.Fhir.Model.Coding)NthWeekOfMonth.DeepCopyInternal(); - if(DayOfWeek != null) dest.DayOfWeek = (Hl7.Fhir.Model.Coding)DayOfWeek.DeepCopyInternal(); - if(MonthIntervalElement != null) dest.MonthIntervalElement = (Hl7.Fhir.Model.PositiveInt)MonthIntervalElement.DeepCopyInternal(); + if(_DayOfMonthElement is not null) dest.DayOfMonthElement = (Hl7.Fhir.Model.PositiveInt)_DayOfMonthElement.DeepCopyInternal(); + if(_NthWeekOfMonth is not null) dest.NthWeekOfMonth = (Hl7.Fhir.Model.Coding)_NthWeekOfMonth.DeepCopyInternal(); + if(_DayOfWeek is not null) dest.DayOfWeek = (Hl7.Fhir.Model.Coding)_DayOfWeek.DeepCopyInternal(); + if(_MonthIntervalElement is not null) dest.MonthIntervalElement = (Hl7.Fhir.Model.PositiveInt)_MonthIntervalElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4155,55 +4100,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonthlyTemplateComponent; - if(otherT == null) return false; + if(other is not MonthlyTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DayOfMonthElement, otherT.DayOfMonthElement)) return false; - if(!comparer.Equals(NthWeekOfMonth, otherT.NthWeekOfMonth)) return false; - if(!comparer.Equals(DayOfWeek, otherT.DayOfWeek)) return false; - if(!comparer.Equals(MonthIntervalElement, otherT.MonthIntervalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DayOfMonthElement, otherT._DayOfMonthElement)) return false; + if(!comparer.Equals(_NthWeekOfMonth, otherT._NthWeekOfMonth)) return false; + if(!comparer.Equals(_DayOfWeek, otherT._DayOfWeek)) return false; + if(!comparer.Equals(_MonthIntervalElement, otherT._MonthIntervalElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "dayOfMonth": - value = DayOfMonthElement; - return DayOfMonthElement is not null; + value = _DayOfMonthElement; + return _DayOfMonthElement is not null; case "nthWeekOfMonth": - value = NthWeekOfMonth; - return NthWeekOfMonth is not null; + value = _NthWeekOfMonth; + return _NthWeekOfMonth is not null; case "dayOfWeek": - value = DayOfWeek; - return DayOfWeek is not null; + value = _DayOfWeek; + return _DayOfWeek is not null; case "monthInterval": - value = MonthIntervalElement; - return MonthIntervalElement is not null; + value = _MonthIntervalElement; + return _MonthIntervalElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "dayOfMonth": - DayOfMonthElement = (Hl7.Fhir.Model.PositiveInt)value; + DayOfMonthElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "nthWeekOfMonth": - NthWeekOfMonth = (Hl7.Fhir.Model.Coding)value; + NthWeekOfMonth = (Hl7.Fhir.Model.Coding?)value; return this; case "dayOfWeek": - DayOfWeek = (Hl7.Fhir.Model.Coding)value; + DayOfWeek = (Hl7.Fhir.Model.Coding?)value; return this; case "monthInterval": - MonthIntervalElement = (Hl7.Fhir.Model.PositiveInt)value; + MonthIntervalElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -4214,10 +4159,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DayOfMonthElement is not null) yield return new KeyValuePair("dayOfMonth",DayOfMonthElement); - if (NthWeekOfMonth is not null) yield return new KeyValuePair("nthWeekOfMonth",NthWeekOfMonth); - if (DayOfWeek is not null) yield return new KeyValuePair("dayOfWeek",DayOfWeek); - if (MonthIntervalElement is not null) yield return new KeyValuePair("monthInterval",MonthIntervalElement); + if (_DayOfMonthElement is not null) yield return new KeyValuePair("dayOfMonth",_DayOfMonthElement); + if (_NthWeekOfMonth is not null) yield return new KeyValuePair("nthWeekOfMonth",_NthWeekOfMonth); + if (_DayOfWeek is not null) yield return new KeyValuePair("dayOfWeek",_DayOfWeek); + if (_MonthIntervalElement is not null) yield return new KeyValuePair("monthInterval",_MonthIntervalElement); } } @@ -4241,13 +4186,13 @@ public partial class YearlyTemplateComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("yearInterval", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt YearIntervalElement + public Hl7.Fhir.Model.PositiveInt? YearIntervalElement { get { return _YearIntervalElement; } set { _YearIntervalElement = value; OnPropertyChanged("YearIntervalElement"); } } - private Hl7.Fhir.Model.PositiveInt _YearIntervalElement; + private Hl7.Fhir.Model.PositiveInt? _YearIntervalElement; /// /// Recurs every nth year @@ -4256,28 +4201,21 @@ public Hl7.Fhir.Model.PositiveInt YearIntervalElement [IgnoreDataMember] public int? YearInterval { - get { return YearIntervalElement != null ? YearIntervalElement.Value : null; } + get => _YearIntervalElement?.Value; set { - if (value == null) - YearIntervalElement = null; - else - YearIntervalElement = new Hl7.Fhir.Model.PositiveInt(value); + YearIntervalElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("YearInterval"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as YearlyTemplateComponent; - - if (dest == null) - { + if(other is not YearlyTemplateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(YearIntervalElement != null) dest.YearIntervalElement = (Hl7.Fhir.Model.PositiveInt)YearIntervalElement.DeepCopyInternal(); + if(_YearIntervalElement is not null) dest.YearIntervalElement = (Hl7.Fhir.Model.PositiveInt)_YearIntervalElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4289,34 +4227,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as YearlyTemplateComponent; - if(otherT == null) return false; + if(other is not YearlyTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(YearIntervalElement, otherT.YearIntervalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_YearIntervalElement, otherT._YearIntervalElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "yearInterval": - value = YearIntervalElement; - return YearIntervalElement is not null; + value = _YearIntervalElement; + return _YearIntervalElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "yearInterval": - YearIntervalElement = (Hl7.Fhir.Model.PositiveInt)value; + YearIntervalElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -4327,7 +4265,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (YearIntervalElement is not null) yield return new KeyValuePair("yearInterval",YearIntervalElement); + if (_YearIntervalElement is not null) yield return new KeyValuePair("yearInterval",_YearIntervalElement); } } @@ -4340,11 +4278,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist. @@ -4354,13 +4292,13 @@ public List Identifier [Binding("AppointmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error | checked-in | waitlist @@ -4369,13 +4307,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4386,13 +4321,13 @@ public Hl7.Fhir.Model.Appointment.AppointmentStatus? Status [FhirElement("cancellationReason", InSummary=true, Order=110)] [Binding("cancellation-reason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CancellationReason + public Hl7.Fhir.Model.CodeableConcept? CancellationReason { get { return _CancellationReason; } set { _CancellationReason = value; OnPropertyChanged("CancellationReason"); } } - private Hl7.Fhir.Model.CodeableConcept _CancellationReason; + private Hl7.Fhir.Model.CodeableConcept? _CancellationReason; /// /// Classification when becoming an encounter. @@ -4403,11 +4338,11 @@ public Hl7.Fhir.Model.CodeableConcept CancellationReason [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// A broad categorization of the service that is to be performed during this appointment. @@ -4418,11 +4353,11 @@ public List Class [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// The specific service that is to be performed during this appointment. @@ -4433,11 +4368,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -4448,11 +4383,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that has been booked in the slot (not service type). @@ -4460,13 +4395,13 @@ public List Specialty [FhirElement("appointmentType", InSummary=true, Order=160)] [Binding("appointment-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AppointmentType + public Hl7.Fhir.Model.CodeableConcept? AppointmentType { get { return _AppointmentType; } set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private Hl7.Fhir.Model.CodeableConcept _AppointmentType; + private Hl7.Fhir.Model.CodeableConcept? _AppointmentType; /// /// Reason this appointment is scheduled. @@ -4477,11 +4412,11 @@ public Hl7.Fhir.Model.CodeableConcept AppointmentType [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Used to make informed decisions if needing to re-prioritize. @@ -4489,41 +4424,38 @@ public List Reason [FhirElement("priority", Order=180, FiveWs="FiveWs.class")] [Binding("Priority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// Shown on a subject line in a meeting request, or appointment list. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Shown on a subject line in a meeting request, or appointment list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -4538,11 +4470,11 @@ public string Description [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Connection details of a virtual service (e.g. conference call). @@ -4552,11 +4484,11 @@ public List Replaces [DataMember] public List VirtualService { - get { if(_VirtualService==null) _VirtualService = new List(); return _VirtualService; } + get => _VirtualService ?? new List(); set { _VirtualService = value; OnPropertyChanged("VirtualService"); } } - private List _VirtualService; + private List? _VirtualService; /// /// Additional information to support the appointment. @@ -4568,11 +4500,11 @@ public List VirtualService [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// The previous appointment in a series. @@ -4581,13 +4513,13 @@ public List SupportingInformation [CLSCompliant(false)] [References("Appointment")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PreviousAppointment + public Hl7.Fhir.Model.ResourceReference? PreviousAppointment { get { return _PreviousAppointment; } set { _PreviousAppointment = value; OnPropertyChanged("PreviousAppointment"); } } - private Hl7.Fhir.Model.ResourceReference _PreviousAppointment; + private Hl7.Fhir.Model.ResourceReference? _PreviousAppointment; /// /// The originating appointment in a recurring set of appointments. @@ -4596,26 +4528,26 @@ public Hl7.Fhir.Model.ResourceReference PreviousAppointment [CLSCompliant(false)] [References("Appointment")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginatingAppointment + public Hl7.Fhir.Model.ResourceReference? OriginatingAppointment { get { return _OriginatingAppointment; } set { _OriginatingAppointment = value; OnPropertyChanged("OriginatingAppointment"); } } - private Hl7.Fhir.Model.ResourceReference _OriginatingAppointment; + private Hl7.Fhir.Model.ResourceReference? _OriginatingAppointment; /// /// When appointment is to take place. /// [FhirElement("start", InSummary=true, Order=250, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// When appointment is to take place @@ -4624,13 +4556,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -4640,13 +4569,13 @@ public DateTimeOffset? Start /// [FhirElement("end", InSummary=true, Order=260, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When appointment is to conclude @@ -4655,13 +4584,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -4671,13 +4597,13 @@ public DateTimeOffset? End /// [FhirElement("minutesDuration", Order=270)] [DataMember] - public Hl7.Fhir.Model.PositiveInt MinutesDurationElement + public Hl7.Fhir.Model.PositiveInt? MinutesDurationElement { get { return _MinutesDurationElement; } set { _MinutesDurationElement = value; OnPropertyChanged("MinutesDurationElement"); } } - private Hl7.Fhir.Model.PositiveInt _MinutesDurationElement; + private Hl7.Fhir.Model.PositiveInt? _MinutesDurationElement; /// /// Can be less than start/end (e.g. estimate) @@ -4686,13 +4612,10 @@ public Hl7.Fhir.Model.PositiveInt MinutesDurationElement [IgnoreDataMember] public int? MinutesDuration { - get { return MinutesDurationElement != null ? MinutesDurationElement.Value : null; } + get => _MinutesDurationElement?.Value; set { - if (value == null) - MinutesDurationElement = null; - else - MinutesDurationElement = new Hl7.Fhir.Model.PositiveInt(value); + MinutesDurationElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("MinutesDuration"); } } @@ -4705,11 +4628,11 @@ public int? MinutesDuration [DataMember] public List RequestedPeriod { - get { if(_RequestedPeriod==null) _RequestedPeriod = new List(); return _RequestedPeriod; } + get => _RequestedPeriod ?? new List(); set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } - private List _RequestedPeriod; + private List? _RequestedPeriod; /// /// The slots that this appointment is filling. @@ -4721,11 +4644,11 @@ public List RequestedPeriod [DataMember] public List Slot { - get { if(_Slot==null) _Slot = new List(); return _Slot; } + get => _Slot ?? new List(); set { _Slot = value; OnPropertyChanged("Slot"); } } - private List _Slot; + private List? _Slot; /// /// The set of accounts that may be used for billing for this Appointment. @@ -4737,39 +4660,36 @@ public List Slot [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// The date that this appointment was initially created. /// [FhirElement("created", Order=310)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// The date that this appointment was initially created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -4779,28 +4699,25 @@ public string Created /// [FhirElement("cancellationDate", Order=320)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CancellationDateElement + public Hl7.Fhir.Model.FhirDateTime? CancellationDateElement { get { return _CancellationDateElement; } set { _CancellationDateElement = value; OnPropertyChanged("CancellationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CancellationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _CancellationDateElement; /// /// When the appointment was cancelled /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CancellationDate + public string? CancellationDate { - get { return CancellationDateElement != null ? CancellationDateElement.Value : null; } + get => _CancellationDateElement?.Value; set { - if (value == null) - CancellationDateElement = null; - else - CancellationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + CancellationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("CancellationDate"); } } @@ -4813,11 +4730,11 @@ public string CancellationDate [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Detailed information and instructions for the patient. @@ -4827,11 +4744,11 @@ public List Note [DataMember] public List PatientInstruction { - get { if(_PatientInstruction==null) _PatientInstruction = new List(); return _PatientInstruction; } + get => _PatientInstruction ?? new List(); set { _PatientInstruction = value; OnPropertyChanged("PatientInstruction"); } } - private List _PatientInstruction; + private List? _PatientInstruction; /// /// The request this appointment is allocated to assess. @@ -4843,11 +4760,11 @@ public List PatientInstruction [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// The patient or group associated with the appointment. @@ -4856,13 +4773,13 @@ public List BasedOn [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Participants involved in appointment. @@ -4872,24 +4789,24 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The sequence number in the recurrence. /// [FhirElement("recurrenceId", Order=380)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RecurrenceIdElement + public Hl7.Fhir.Model.PositiveInt? RecurrenceIdElement { get { return _RecurrenceIdElement; } set { _RecurrenceIdElement = value; OnPropertyChanged("RecurrenceIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _RecurrenceIdElement; + private Hl7.Fhir.Model.PositiveInt? _RecurrenceIdElement; /// /// The sequence number in the recurrence @@ -4898,13 +4815,10 @@ public Hl7.Fhir.Model.PositiveInt RecurrenceIdElement [IgnoreDataMember] public int? RecurrenceId { - get { return RecurrenceIdElement != null ? RecurrenceIdElement.Value : null; } + get => _RecurrenceIdElement?.Value; set { - if (value == null) - RecurrenceIdElement = null; - else - RecurrenceIdElement = new Hl7.Fhir.Model.PositiveInt(value); + RecurrenceIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("RecurrenceId"); } } @@ -4914,13 +4828,13 @@ public int? RecurrenceId /// [FhirElement("occurrenceChanged", Order=390)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OccurrenceChangedElement + public Hl7.Fhir.Model.FhirBoolean? OccurrenceChangedElement { get { return _OccurrenceChangedElement; } set { _OccurrenceChangedElement = value; OnPropertyChanged("OccurrenceChangedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OccurrenceChangedElement; + private Hl7.Fhir.Model.FhirBoolean? _OccurrenceChangedElement; /// /// Indicates that this appointment varies from a recurrence pattern @@ -4929,13 +4843,10 @@ public Hl7.Fhir.Model.FhirBoolean OccurrenceChangedElement [IgnoreDataMember] public bool? OccurrenceChanged { - get { return OccurrenceChangedElement != null ? OccurrenceChangedElement.Value : null; } + get => _OccurrenceChangedElement?.Value; set { - if (value == null) - OccurrenceChangedElement = null; - else - OccurrenceChangedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OccurrenceChangedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("OccurrenceChanged"); } } @@ -4948,56 +4859,52 @@ public bool? OccurrenceChanged [DataMember] public List RecurrenceTemplate { - get { if(_RecurrenceTemplate==null) _RecurrenceTemplate = new List(); return _RecurrenceTemplate; } + get => _RecurrenceTemplate ?? new List(); set { _RecurrenceTemplate = value; OnPropertyChanged("RecurrenceTemplate"); } } - private List _RecurrenceTemplate; + private List? _RecurrenceTemplate; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Appointment; - - if (dest == null) - { + if(other is not Appointment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CancellationReason != null) dest.CancellationReason = (Hl7.Fhir.Model.CodeableConcept)CancellationReason.DeepCopyInternal(); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType != null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)AppointmentType.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(VirtualService.Any()) dest.VirtualService = new List(VirtualService.DeepCopyInternal()); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(PreviousAppointment != null) dest.PreviousAppointment = (Hl7.Fhir.Model.ResourceReference)PreviousAppointment.DeepCopyInternal(); - if(OriginatingAppointment != null) dest.OriginatingAppointment = (Hl7.Fhir.Model.ResourceReference)OriginatingAppointment.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(MinutesDurationElement != null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)MinutesDurationElement.DeepCopyInternal(); - if(RequestedPeriod.Any()) dest.RequestedPeriod = new List(RequestedPeriod.DeepCopyInternal()); - if(Slot.Any()) dest.Slot = new List(Slot.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(CancellationDateElement != null) dest.CancellationDateElement = (Hl7.Fhir.Model.FhirDateTime)CancellationDateElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(PatientInstruction.Any()) dest.PatientInstruction = new List(PatientInstruction.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(RecurrenceIdElement != null) dest.RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt)RecurrenceIdElement.DeepCopyInternal(); - if(OccurrenceChangedElement != null) dest.OccurrenceChangedElement = (Hl7.Fhir.Model.FhirBoolean)OccurrenceChangedElement.DeepCopyInternal(); - if(RecurrenceTemplate.Any()) dest.RecurrenceTemplate = new List(RecurrenceTemplate.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CancellationReason is not null) dest.CancellationReason = (Hl7.Fhir.Model.CodeableConcept)_CancellationReason.DeepCopyInternal(); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = (Hl7.Fhir.Model.CodeableConcept)_AppointmentType.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_VirtualService is not null) dest.VirtualService = new List(_VirtualService.DeepCopyInternal()); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_PreviousAppointment is not null) dest.PreviousAppointment = (Hl7.Fhir.Model.ResourceReference)_PreviousAppointment.DeepCopyInternal(); + if(_OriginatingAppointment is not null) dest.OriginatingAppointment = (Hl7.Fhir.Model.ResourceReference)_OriginatingAppointment.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_MinutesDurationElement is not null) dest.MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)_MinutesDurationElement.DeepCopyInternal(); + if(_RequestedPeriod is not null) dest.RequestedPeriod = new List(_RequestedPeriod.DeepCopyInternal()); + if(_Slot is not null) dest.Slot = new List(_Slot.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_CancellationDateElement is not null) dest.CancellationDateElement = (Hl7.Fhir.Model.FhirDateTime)_CancellationDateElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_PatientInstruction is not null) dest.PatientInstruction = new List(_PatientInstruction.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_RecurrenceIdElement is not null) dest.RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt)_RecurrenceIdElement.DeepCopyInternal(); + if(_OccurrenceChangedElement is not null) dest.OccurrenceChangedElement = (Hl7.Fhir.Model.FhirBoolean)_OccurrenceChangedElement.DeepCopyInternal(); + if(_RecurrenceTemplate is not null) dest.RecurrenceTemplate = new List(_RecurrenceTemplate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5009,251 +4916,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Appointment; - if(otherT == null) return false; + if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CancellationReason, otherT.CancellationReason)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.ListEquals(VirtualService, otherT.VirtualService)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(PreviousAppointment, otherT.PreviousAppointment)) return false; - if(!comparer.Equals(OriginatingAppointment, otherT.OriginatingAppointment)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(MinutesDurationElement, otherT.MinutesDurationElement)) return false; - if(!comparer.ListEquals(RequestedPeriod, otherT.RequestedPeriod)) return false; - if(!comparer.ListEquals(Slot, otherT.Slot)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(CancellationDateElement, otherT.CancellationDateElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(PatientInstruction, otherT.PatientInstruction)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(RecurrenceIdElement, otherT.RecurrenceIdElement)) return false; - if(!comparer.Equals(OccurrenceChangedElement, otherT.OccurrenceChangedElement)) return false; - if(!comparer.ListEquals(RecurrenceTemplate, otherT.RecurrenceTemplate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CancellationReason, otherT._CancellationReason)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.ListEquals(_VirtualService, otherT._VirtualService)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_PreviousAppointment, otherT._PreviousAppointment)) return false; + if(!comparer.Equals(_OriginatingAppointment, otherT._OriginatingAppointment)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_MinutesDurationElement, otherT._MinutesDurationElement)) return false; + if(!comparer.ListEquals(_RequestedPeriod, otherT._RequestedPeriod)) return false; + if(!comparer.ListEquals(_Slot, otherT._Slot)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_CancellationDateElement, otherT._CancellationDateElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_PatientInstruction, otherT._PatientInstruction)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_RecurrenceIdElement, otherT._RecurrenceIdElement)) return false; + if(!comparer.Equals(_OccurrenceChangedElement, otherT._OccurrenceChangedElement)) return false; + if(!comparer.ListEquals(_RecurrenceTemplate, otherT._RecurrenceTemplate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "cancellationReason": - value = CancellationReason; - return CancellationReason is not null; + value = _CancellationReason; + return _CancellationReason is not null; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType is not null; + value = _AppointmentType; + return _AppointmentType is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "virtualService": - value = VirtualService; - return VirtualService?.Any() == true; + value = _VirtualService; + return _VirtualService?.Any() == true; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "previousAppointment": - value = PreviousAppointment; - return PreviousAppointment is not null; + value = _PreviousAppointment; + return _PreviousAppointment is not null; case "originatingAppointment": - value = OriginatingAppointment; - return OriginatingAppointment is not null; + value = _OriginatingAppointment; + return _OriginatingAppointment is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "minutesDuration": - value = MinutesDurationElement; - return MinutesDurationElement is not null; + value = _MinutesDurationElement; + return _MinutesDurationElement is not null; case "requestedPeriod": - value = RequestedPeriod; - return RequestedPeriod?.Any() == true; + value = _RequestedPeriod; + return _RequestedPeriod?.Any() == true; case "slot": - value = Slot; - return Slot?.Any() == true; + value = _Slot; + return _Slot?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "cancellationDate": - value = CancellationDateElement; - return CancellationDateElement is not null; + value = _CancellationDateElement; + return _CancellationDateElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "patientInstruction": - value = PatientInstruction; - return PatientInstruction?.Any() == true; + value = _PatientInstruction; + return _PatientInstruction?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "recurrenceId": - value = RecurrenceIdElement; - return RecurrenceIdElement is not null; + value = _RecurrenceIdElement; + return _RecurrenceIdElement is not null; case "occurrenceChanged": - value = OccurrenceChangedElement; - return OccurrenceChangedElement is not null; + value = _OccurrenceChangedElement; + return _OccurrenceChangedElement is not null; case "recurrenceTemplate": - value = RecurrenceTemplate; - return RecurrenceTemplate?.Any() == true; + value = _RecurrenceTemplate; + return _RecurrenceTemplate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "cancellationReason": - CancellationReason = (Hl7.Fhir.Model.CodeableConcept)value; + CancellationReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (Hl7.Fhir.Model.CodeableConcept)value; + AppointmentType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "virtualService": - VirtualService = (List)value; + VirtualService = (List?)value!; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "previousAppointment": - PreviousAppointment = (Hl7.Fhir.Model.ResourceReference)value; + PreviousAppointment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originatingAppointment": - OriginatingAppointment = (Hl7.Fhir.Model.ResourceReference)value; + OriginatingAppointment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "minutesDuration": - MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt)value; + MinutesDurationElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "requestedPeriod": - RequestedPeriod = (List)value; + RequestedPeriod = (List?)value!; return this; case "slot": - Slot = (List)value; + Slot = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "cancellationDate": - CancellationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + CancellationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "patientInstruction": - PatientInstruction = (List)value; + PatientInstruction = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "recurrenceId": - RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt)value; + RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "occurrenceChanged": - OccurrenceChangedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OccurrenceChangedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "recurrenceTemplate": - RecurrenceTemplate = (List)value; + RecurrenceTemplate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5264,38 +5171,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CancellationReason is not null) yield return new KeyValuePair("cancellationReason",CancellationReason); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType is not null) yield return new KeyValuePair("appointmentType",AppointmentType); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (VirtualService?.Any() == true) yield return new KeyValuePair("virtualService",VirtualService); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (PreviousAppointment is not null) yield return new KeyValuePair("previousAppointment",PreviousAppointment); - if (OriginatingAppointment is not null) yield return new KeyValuePair("originatingAppointment",OriginatingAppointment); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",MinutesDurationElement); - if (RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",RequestedPeriod); - if (Slot?.Any() == true) yield return new KeyValuePair("slot",Slot); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (CancellationDateElement is not null) yield return new KeyValuePair("cancellationDate",CancellationDateElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (PatientInstruction?.Any() == true) yield return new KeyValuePair("patientInstruction",PatientInstruction); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (RecurrenceIdElement is not null) yield return new KeyValuePair("recurrenceId",RecurrenceIdElement); - if (OccurrenceChangedElement is not null) yield return new KeyValuePair("occurrenceChanged",OccurrenceChangedElement); - if (RecurrenceTemplate?.Any() == true) yield return new KeyValuePair("recurrenceTemplate",RecurrenceTemplate); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CancellationReason is not null) yield return new KeyValuePair("cancellationReason",_CancellationReason); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType is not null) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_VirtualService?.Any() == true) yield return new KeyValuePair("virtualService",_VirtualService); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_PreviousAppointment is not null) yield return new KeyValuePair("previousAppointment",_PreviousAppointment); + if (_OriginatingAppointment is not null) yield return new KeyValuePair("originatingAppointment",_OriginatingAppointment); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_MinutesDurationElement is not null) yield return new KeyValuePair("minutesDuration",_MinutesDurationElement); + if (_RequestedPeriod?.Any() == true) yield return new KeyValuePair("requestedPeriod",_RequestedPeriod); + if (_Slot?.Any() == true) yield return new KeyValuePair("slot",_Slot); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_CancellationDateElement is not null) yield return new KeyValuePair("cancellationDate",_CancellationDateElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_PatientInstruction?.Any() == true) yield return new KeyValuePair("patientInstruction",_PatientInstruction); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_RecurrenceIdElement is not null) yield return new KeyValuePair("recurrenceId",_RecurrenceIdElement); + if (_OccurrenceChangedElement is not null) yield return new KeyValuePair("occurrenceChanged",_OccurrenceChangedElement); + if (_RecurrenceTemplate?.Any() == true) yield return new KeyValuePair("recurrenceTemplate",_RecurrenceTemplate); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs index a39061f9f..127d40d9e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,11 +107,11 @@ public enum AppointmentResponseStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Appointment this response relates to. @@ -118,26 +121,26 @@ public List Identifier [References("Appointment")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Appointment + public Hl7.Fhir.Model.ResourceReference? Appointment { get { return _Appointment; } set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private Hl7.Fhir.Model.ResourceReference _Appointment; + private Hl7.Fhir.Model.ResourceReference? _Appointment; /// /// Indicator for a counter proposal. /// [FhirElement("proposedNewTime", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ProposedNewTimeElement + public Hl7.Fhir.Model.FhirBoolean? ProposedNewTimeElement { get { return _ProposedNewTimeElement; } set { _ProposedNewTimeElement = value; OnPropertyChanged("ProposedNewTimeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ProposedNewTimeElement; + private Hl7.Fhir.Model.FhirBoolean? _ProposedNewTimeElement; /// /// Indicator for a counter proposal @@ -146,13 +149,10 @@ public Hl7.Fhir.Model.FhirBoolean ProposedNewTimeElement [IgnoreDataMember] public bool? ProposedNewTime { - get { return ProposedNewTimeElement != null ? ProposedNewTimeElement.Value : null; } + get => _ProposedNewTimeElement?.Value; set { - if (value == null) - ProposedNewTimeElement = null; - else - ProposedNewTimeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ProposedNewTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ProposedNewTime"); } } @@ -162,13 +162,13 @@ public bool? ProposedNewTime /// [FhirElement("start", Order=120, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Time from appointment, or requested new start time @@ -177,13 +177,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -193,13 +190,13 @@ public DateTimeOffset? Start /// [FhirElement("end", Order=130, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Time from appointment, or requested new end time @@ -208,13 +205,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -228,11 +222,11 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get { if(_ParticipantType==null) _ParticipantType = new List(); return _ParticipantType; } + get => _ParticipantType ?? new List(); set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } - private List _ParticipantType; + private List? _ParticipantType; /// /// Person(s), Location, HealthcareService, or Device. @@ -241,13 +235,13 @@ public List ParticipantType [CLSCompliant(false)] [References("Patient","Group","Practitioner","PractitionerRole","RelatedPerson","Device","HealthcareService","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// accepted | declined | tentative | needs-action | entered-in-error. @@ -257,13 +251,13 @@ public Hl7.Fhir.Model.ResourceReference Actor [Binding("ParticipantStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ParticipantStatusElement + public Code? ParticipantStatusElement { get { return _ParticipantStatusElement; } set { _ParticipantStatusElement = value; OnPropertyChanged("ParticipantStatusElement"); } } - private Code _ParticipantStatusElement; + private Code? _ParticipantStatusElement; /// /// accepted | declined | tentative | needs-action | entered-in-error @@ -272,13 +266,10 @@ public Code Partic [IgnoreDataMember] public Hl7.Fhir.Model.AppointmentResponse.AppointmentResponseStatus? ParticipantStatus { - get { return ParticipantStatusElement != null ? ParticipantStatusElement.Value : null; } + get => _ParticipantStatusElement?.Value; set { - if (value == null) - ParticipantStatusElement = null; - else - ParticipantStatusElement = new Code(value); + ParticipantStatusElement = value is null ? null : new Code(value); OnPropertyChanged("ParticipantStatus"); } } @@ -288,28 +279,25 @@ public Hl7.Fhir.Model.AppointmentResponse.AppointmentResponseStatus? Participant /// [FhirElement("comment", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Additional comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -319,13 +307,13 @@ public string Comment /// [FhirElement("recurring", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RecurringElement + public Hl7.Fhir.Model.FhirBoolean? RecurringElement { get { return _RecurringElement; } set { _RecurringElement = value; OnPropertyChanged("RecurringElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RecurringElement; + private Hl7.Fhir.Model.FhirBoolean? _RecurringElement; /// /// This response is for all occurrences in a recurring request @@ -334,13 +322,10 @@ public Hl7.Fhir.Model.FhirBoolean RecurringElement [IgnoreDataMember] public bool? Recurring { - get { return RecurringElement != null ? RecurringElement.Value : null; } + get => _RecurringElement?.Value; set { - if (value == null) - RecurringElement = null; - else - RecurringElement = new Hl7.Fhir.Model.FhirBoolean(value); + RecurringElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Recurring"); } } @@ -350,28 +335,25 @@ public bool? Recurring /// [FhirElement("occurrenceDate", Order=190)] [DataMember] - public Hl7.Fhir.Model.Date OccurrenceDateElement + public Hl7.Fhir.Model.Date? OccurrenceDateElement { get { return _OccurrenceDateElement; } set { _OccurrenceDateElement = value; OnPropertyChanged("OccurrenceDateElement"); } } - private Hl7.Fhir.Model.Date _OccurrenceDateElement; + private Hl7.Fhir.Model.Date? _OccurrenceDateElement; /// /// Original date within a recurring request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OccurrenceDate + public string? OccurrenceDate { - get { return OccurrenceDateElement != null ? OccurrenceDateElement.Value : null; } + get => _OccurrenceDateElement?.Value; set { - if (value == null) - OccurrenceDateElement = null; - else - OccurrenceDateElement = new Hl7.Fhir.Model.Date(value); + OccurrenceDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("OccurrenceDate"); } } @@ -381,13 +363,13 @@ public string OccurrenceDate /// [FhirElement("recurrenceId", Order=200)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RecurrenceIdElement + public Hl7.Fhir.Model.PositiveInt? RecurrenceIdElement { get { return _RecurrenceIdElement; } set { _RecurrenceIdElement = value; OnPropertyChanged("RecurrenceIdElement"); } } - private Hl7.Fhir.Model.PositiveInt _RecurrenceIdElement; + private Hl7.Fhir.Model.PositiveInt? _RecurrenceIdElement; /// /// The recurrence ID of the specific recurring request @@ -396,13 +378,10 @@ public Hl7.Fhir.Model.PositiveInt RecurrenceIdElement [IgnoreDataMember] public int? RecurrenceId { - get { return RecurrenceIdElement != null ? RecurrenceIdElement.Value : null; } + get => _RecurrenceIdElement?.Value; set { - if (value == null) - RecurrenceIdElement = null; - else - RecurrenceIdElement = new Hl7.Fhir.Model.PositiveInt(value); + RecurrenceIdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("RecurrenceId"); } } @@ -411,26 +390,22 @@ public int? RecurrenceId protected internal override void CopyToInternal(Base other) { - var dest = other as AppointmentResponse; - - if (dest == null) - { + if(other is not AppointmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Appointment != null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)Appointment.DeepCopyInternal(); - if(ProposedNewTimeElement != null) dest.ProposedNewTimeElement = (Hl7.Fhir.Model.FhirBoolean)ProposedNewTimeElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ParticipantType.Any()) dest.ParticipantType = new List(ParticipantType.DeepCopyInternal()); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(ParticipantStatusElement != null) dest.ParticipantStatusElement = (Code)ParticipantStatusElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(RecurringElement != null) dest.RecurringElement = (Hl7.Fhir.Model.FhirBoolean)RecurringElement.DeepCopyInternal(); - if(OccurrenceDateElement != null) dest.OccurrenceDateElement = (Hl7.Fhir.Model.Date)OccurrenceDateElement.DeepCopyInternal(); - if(RecurrenceIdElement != null) dest.RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt)RecurrenceIdElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = (Hl7.Fhir.Model.ResourceReference)_Appointment.DeepCopyInternal(); + if(_ProposedNewTimeElement is not null) dest.ProposedNewTimeElement = (Hl7.Fhir.Model.FhirBoolean)_ProposedNewTimeElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ParticipantType is not null) dest.ParticipantType = new List(_ParticipantType.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_ParticipantStatusElement is not null) dest.ParticipantStatusElement = (Code)_ParticipantStatusElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_RecurringElement is not null) dest.RecurringElement = (Hl7.Fhir.Model.FhirBoolean)_RecurringElement.DeepCopyInternal(); + if(_OccurrenceDateElement is not null) dest.OccurrenceDateElement = (Hl7.Fhir.Model.Date)_OccurrenceDateElement.DeepCopyInternal(); + if(_RecurrenceIdElement is not null) dest.RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt)_RecurrenceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -442,111 +417,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AppointmentResponse; - if(otherT == null) return false; + if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Appointment, otherT.Appointment)) return false; - if(!comparer.Equals(ProposedNewTimeElement, otherT.ProposedNewTimeElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.ListEquals(ParticipantType, otherT.ParticipantType)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(ParticipantStatusElement, otherT.ParticipantStatusElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(RecurringElement, otherT.RecurringElement)) return false; - if(!comparer.Equals(OccurrenceDateElement, otherT.OccurrenceDateElement)) return false; - if(!comparer.Equals(RecurrenceIdElement, otherT.RecurrenceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; + if(!comparer.Equals(_ProposedNewTimeElement, otherT._ProposedNewTimeElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.ListEquals(_ParticipantType, otherT._ParticipantType)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_ParticipantStatusElement, otherT._ParticipantStatusElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_RecurringElement, otherT._RecurringElement)) return false; + if(!comparer.Equals(_OccurrenceDateElement, otherT._OccurrenceDateElement)) return false; + if(!comparer.Equals(_RecurrenceIdElement, otherT._RecurrenceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "appointment": - value = Appointment; - return Appointment is not null; + value = _Appointment; + return _Appointment is not null; case "proposedNewTime": - value = ProposedNewTimeElement; - return ProposedNewTimeElement is not null; + value = _ProposedNewTimeElement; + return _ProposedNewTimeElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "participantType": - value = ParticipantType; - return ParticipantType?.Any() == true; + value = _ParticipantType; + return _ParticipantType?.Any() == true; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "participantStatus": - value = ParticipantStatusElement; - return ParticipantStatusElement is not null; + value = _ParticipantStatusElement; + return _ParticipantStatusElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "recurring": - value = RecurringElement; - return RecurringElement is not null; + value = _RecurringElement; + return _RecurringElement is not null; case "occurrenceDate": - value = OccurrenceDateElement; - return OccurrenceDateElement is not null; + value = _OccurrenceDateElement; + return _OccurrenceDateElement is not null; case "recurrenceId": - value = RecurrenceIdElement; - return RecurrenceIdElement is not null; + value = _RecurrenceIdElement; + return _RecurrenceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "appointment": - Appointment = (Hl7.Fhir.Model.ResourceReference)value; + Appointment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "proposedNewTime": - ProposedNewTimeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ProposedNewTimeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "participantType": - ParticipantType = (List)value; + ParticipantType = (List?)value!; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participantStatus": - ParticipantStatusElement = (Code)value; + ParticipantStatusElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "recurring": - RecurringElement = (Hl7.Fhir.Model.FhirBoolean)value; + RecurringElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "occurrenceDate": - OccurrenceDateElement = (Hl7.Fhir.Model.Date)value; + OccurrenceDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "recurrenceId": - RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt)value; + RecurrenceIdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -557,18 +532,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Appointment is not null) yield return new KeyValuePair("appointment",Appointment); - if (ProposedNewTimeElement is not null) yield return new KeyValuePair("proposedNewTime",ProposedNewTimeElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",ParticipantType); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",ParticipantStatusElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (RecurringElement is not null) yield return new KeyValuePair("recurring",RecurringElement); - if (OccurrenceDateElement is not null) yield return new KeyValuePair("occurrenceDate",OccurrenceDateElement); - if (RecurrenceIdElement is not null) yield return new KeyValuePair("recurrenceId",RecurrenceIdElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Appointment is not null) yield return new KeyValuePair("appointment",_Appointment); + if (_ProposedNewTimeElement is not null) yield return new KeyValuePair("proposedNewTime",_ProposedNewTimeElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ParticipantType?.Any() == true) yield return new KeyValuePair("participantType",_ParticipantType); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_ParticipantStatusElement is not null) yield return new KeyValuePair("participantStatus",_ParticipantStatusElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_RecurringElement is not null) yield return new KeyValuePair("recurring",_RecurringElement); + if (_OccurrenceDateElement is not null) yield return new KeyValuePair("occurrenceDate",_OccurrenceDateElement); + if (_RecurrenceIdElement is not null) yield return new KeyValuePair("recurrenceId",_RecurrenceIdElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs index e0c03c5b2..021c2dff1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -238,13 +241,13 @@ public partial class ContentComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("InformationType")] [DataMember] - public Code InformationTypeElement + public Code? InformationTypeElement { get { return _InformationTypeElement; } set { _InformationTypeElement = value; OnPropertyChanged("InformationTypeElement"); } } - private Code _InformationTypeElement; + private Code? _InformationTypeElement; /// /// comment | classifier | rating | container | response | change-request @@ -253,13 +256,10 @@ public Code [IgnoreDataMember] public Hl7.Fhir.Model.ArtifactAssessment.ArtifactAssessmentInformationType? InformationType { - get { return InformationTypeElement != null ? InformationTypeElement.Value : null; } + get => _InformationTypeElement?.Value; set { - if (value == null) - InformationTypeElement = null; - else - InformationTypeElement = new Code(value); + InformationTypeElement = value is null ? null : new Code(value); OnPropertyChanged("InformationType"); } } @@ -269,28 +269,25 @@ public Hl7.Fhir.Model.ArtifactAssessment.ArtifactAssessmentInformationType? Info /// [FhirElement("summary", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown SummaryElement + public Hl7.Fhir.Model.Markdown? SummaryElement { get { return _SummaryElement; } set { _SummaryElement = value; OnPropertyChanged("SummaryElement"); } } - private Hl7.Fhir.Model.Markdown _SummaryElement; + private Hl7.Fhir.Model.Markdown? _SummaryElement; /// /// Brief summary of the content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Summary + public string? Summary { - get { return SummaryElement != null ? SummaryElement.Value : null; } + get => _SummaryElement?.Value; set { - if (value == null) - SummaryElement = null; - else - SummaryElement = new Hl7.Fhir.Model.Markdown(value); + SummaryElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Summary"); } } @@ -301,13 +298,13 @@ public string Summary [FhirElement("type", Order=60)] [Binding("EvidenceCertaintyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Rating, classifier, or assessment. @@ -318,24 +315,24 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// Quantitative rating. /// [FhirElement("quantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Who authored the content. @@ -344,13 +341,13 @@ public Hl7.Fhir.Model.Quantity Quantity [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Organization","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// What the comment is directed to. @@ -360,24 +357,24 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List PathElement { - get { if(_PathElement==null) _PathElement = new List(); return _PathElement; } + get => _PathElement ?? new List(); set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private List _PathElement; + private List? _PathElement; /// /// What the comment is directed to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Path + public IEnumerable? Path { - get { return PathElement != null ? PathElement.Select(elem => elem.Value) : null; } + get => _PathElement?.Select(elem => elem.Value); set { if (value == null) - PathElement = null; + PathElement = null!; else PathElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Path"); @@ -392,24 +389,24 @@ public IEnumerable Path [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Acceptable to publicly share the resource content. /// [FhirElement("freeToShare", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FreeToShareElement + public Hl7.Fhir.Model.FhirBoolean? FreeToShareElement { get { return _FreeToShareElement; } set { _FreeToShareElement = value; OnPropertyChanged("FreeToShareElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FreeToShareElement; + private Hl7.Fhir.Model.FhirBoolean? _FreeToShareElement; /// /// Acceptable to publicly share the resource content @@ -418,13 +415,10 @@ public Hl7.Fhir.Model.FhirBoolean FreeToShareElement [IgnoreDataMember] public bool? FreeToShare { - get { return FreeToShareElement != null ? FreeToShareElement.Value : null; } + get => _FreeToShareElement?.Value; set { - if (value == null) - FreeToShareElement = null; - else - FreeToShareElement = new Hl7.Fhir.Model.FhirBoolean(value); + FreeToShareElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("FreeToShare"); } } @@ -437,32 +431,28 @@ public bool? FreeToShare [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; protected internal override void CopyToInternal(Base other) { - var dest = other as ContentComponent; - - if (dest == null) - { + if(other is not ContentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(InformationTypeElement != null) dest.InformationTypeElement = (Code)InformationTypeElement.DeepCopyInternal(); - if(SummaryElement != null) dest.SummaryElement = (Hl7.Fhir.Model.Markdown)SummaryElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(PathElement.Any()) dest.PathElement = new List(PathElement.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(FreeToShareElement != null) dest.FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean)FreeToShareElement.DeepCopyInternal(); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_InformationTypeElement is not null) dest.InformationTypeElement = (Code)_InformationTypeElement.DeepCopyInternal(); + if(_SummaryElement is not null) dest.SummaryElement = (Hl7.Fhir.Model.Markdown)_SummaryElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = new List(_PathElement.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_FreeToShareElement is not null) dest.FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean)_FreeToShareElement.DeepCopyInternal(); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -474,97 +464,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentComponent; - if(otherT == null) return false; + if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(InformationTypeElement, otherT.InformationTypeElement)) return false; - if(!comparer.Equals(SummaryElement, otherT.SummaryElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(PathElement, otherT.PathElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(FreeToShareElement, otherT.FreeToShareElement)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InformationTypeElement, otherT._InformationTypeElement)) return false; + if(!comparer.Equals(_SummaryElement, otherT._SummaryElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_PathElement, otherT._PathElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_FreeToShareElement, otherT._FreeToShareElement)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "informationType": - value = InformationTypeElement; - return InformationTypeElement is not null; + value = _InformationTypeElement; + return _InformationTypeElement is not null; case "summary": - value = SummaryElement; - return SummaryElement is not null; + value = _SummaryElement; + return _SummaryElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "path": - value = PathElement; - return PathElement?.Any() == true; + value = _PathElement; + return _PathElement?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "freeToShare": - value = FreeToShareElement; - return FreeToShareElement is not null; + value = _FreeToShareElement; + return _FreeToShareElement is not null; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "informationType": - InformationTypeElement = (Code)value; + InformationTypeElement = (Code?)value; return this; case "summary": - SummaryElement = (Hl7.Fhir.Model.Markdown)value; + SummaryElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "path": - PathElement = (List)value; + PathElement = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "freeToShare": - FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean)value; + FreeToShareElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -575,16 +565,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (InformationTypeElement is not null) yield return new KeyValuePair("informationType",InformationTypeElement); - if (SummaryElement is not null) yield return new KeyValuePair("summary",SummaryElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (PathElement?.Any() == true) yield return new KeyValuePair("path",PathElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (FreeToShareElement is not null) yield return new KeyValuePair("freeToShare",FreeToShareElement); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_InformationTypeElement is not null) yield return new KeyValuePair("informationType",_InformationTypeElement); + if (_SummaryElement is not null) yield return new KeyValuePair("summary",_SummaryElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_PathElement?.Any() == true) yield return new KeyValuePair("path",_PathElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_FreeToShareElement is not null) yield return new KeyValuePair("freeToShare",_FreeToShareElement); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } @@ -597,39 +587,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A short title for the assessment for use in displaying and selecting. /// [FhirElement("title", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// A short title for the assessment for use in displaying and selecting /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -642,41 +629,38 @@ public string Title [References("Citation")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Markdown))] [DataMember] - public Hl7.Fhir.Model.DataType CiteAs + public Hl7.Fhir.Model.DataType? CiteAs { get { return _CiteAs; } set { _CiteAs = value; OnPropertyChanged("CiteAs"); } } - private Hl7.Fhir.Model.DataType _CiteAs; + private Hl7.Fhir.Model.DataType? _CiteAs; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -686,28 +670,25 @@ public string Date /// [FhirElement("copyright", Order=130)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -717,28 +698,25 @@ public string Copyright /// [FhirElement("approvalDate", Order=140)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the artifact assessment was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -748,28 +726,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the artifact assessment was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -783,13 +758,13 @@ public string LastReviewDate [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.FhirUri))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Artifact + public Hl7.Fhir.Model.DataType? Artifact { get { return _Artifact; } set { _Artifact = value; OnPropertyChanged("Artifact"); } } - private Hl7.Fhir.Model.DataType _Artifact; + private Hl7.Fhir.Model.DataType? _Artifact; /// /// Comment, classifier, or rating content. @@ -799,11 +774,11 @@ public Hl7.Fhir.Model.DataType Artifact [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; /// /// submitted | triaged | waiting-for-input | resolved-no-change | resolved-change-required | deferred | duplicate | applied | published | entered-in-error. @@ -812,13 +787,13 @@ public List Content [DeclaredType(Type = typeof(Code))] [Binding("WorkflowStatus")] [DataMember] - public Code WorkflowStatusElement + public Code? WorkflowStatusElement { get { return _WorkflowStatusElement; } set { _WorkflowStatusElement = value; OnPropertyChanged("WorkflowStatusElement"); } } - private Code _WorkflowStatusElement; + private Code? _WorkflowStatusElement; /// /// submitted | triaged | waiting-for-input | resolved-no-change | resolved-change-required | deferred | duplicate | applied | published | entered-in-error @@ -827,13 +802,10 @@ public Code [IgnoreDataMember] public Hl7.Fhir.Model.ArtifactAssessment.ArtifactAssessmentWorkflowStatus? WorkflowStatus { - get { return WorkflowStatusElement != null ? WorkflowStatusElement.Value : null; } + get => _WorkflowStatusElement?.Value; set { - if (value == null) - WorkflowStatusElement = null; - else - WorkflowStatusElement = new Code(value); + WorkflowStatusElement = value is null ? null : new Code(value); OnPropertyChanged("WorkflowStatus"); } } @@ -845,13 +817,13 @@ public Hl7.Fhir.Model.ArtifactAssessment.ArtifactAssessmentWorkflowStatus? Workf [DeclaredType(Type = typeof(Code))] [Binding("Disposition")] [DataMember] - public Code DispositionElement + public Code? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Code _DispositionElement; + private Code? _DispositionElement; /// /// unresolved | not-persuasive | persuasive | persuasive-with-modification | not-persuasive-with-modification @@ -860,13 +832,10 @@ public Code Dis [IgnoreDataMember] public Hl7.Fhir.Model.ArtifactAssessment.ArtifactAssessmentDisposition? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Code(value); + DispositionElement = value is null ? null : new Code(value); OnPropertyChanged("Disposition"); } } @@ -875,25 +844,21 @@ public Hl7.Fhir.Model.ArtifactAssessment.ArtifactAssessmentDisposition? Disposit protected internal override void CopyToInternal(Base other) { - var dest = other as ArtifactAssessment; - - if (dest == null) - { + if(other is not ArtifactAssessment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(CiteAs != null) dest.CiteAs = (Hl7.Fhir.Model.DataType)CiteAs.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(Artifact != null) dest.Artifact = (Hl7.Fhir.Model.DataType)Artifact.DeepCopyInternal(); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); - if(WorkflowStatusElement != null) dest.WorkflowStatusElement = (Code)WorkflowStatusElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Code)DispositionElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_CiteAs is not null) dest.CiteAs = (Hl7.Fhir.Model.DataType)_CiteAs.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_Artifact is not null) dest.Artifact = (Hl7.Fhir.Model.DataType)_Artifact.DeepCopyInternal(); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); + if(_WorkflowStatusElement is not null) dest.WorkflowStatusElement = (Code)_WorkflowStatusElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Code)_DispositionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -905,104 +870,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ArtifactAssessment; - if(otherT == null) return false; + if(other is not ArtifactAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(CiteAs, otherT.CiteAs)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(Artifact, otherT.Artifact)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; - if(!comparer.Equals(WorkflowStatusElement, otherT.WorkflowStatusElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_CiteAs, otherT._CiteAs)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_Artifact, otherT._Artifact)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; + if(!comparer.Equals(_WorkflowStatusElement, otherT._WorkflowStatusElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "citeAs": - value = CiteAs; - return CiteAs is not null; + value = _CiteAs; + return _CiteAs is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "artifact": - value = Artifact; - return Artifact is not null; + value = _Artifact; + return _Artifact is not null; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; case "workflowStatus": - value = WorkflowStatusElement; - return WorkflowStatusElement is not null; + value = _WorkflowStatusElement; + return _WorkflowStatusElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "citeAs": - CiteAs = (Hl7.Fhir.Model.DataType)value; + CiteAs = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "artifact": - Artifact = (Hl7.Fhir.Model.DataType)value; + Artifact = (Hl7.Fhir.Model.DataType?)value; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; case "workflowStatus": - WorkflowStatusElement = (Code)value; + WorkflowStatusElement = (Code?)value; return this; case "disposition": - DispositionElement = (Code)value; + DispositionElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -1013,17 +978,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (CiteAs is not null) yield return new KeyValuePair("citeAs",CiteAs); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (Artifact is not null) yield return new KeyValuePair("artifact",Artifact); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); - if (WorkflowStatusElement is not null) yield return new KeyValuePair("workflowStatus",WorkflowStatusElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_CiteAs is not null) yield return new KeyValuePair("citeAs",_CiteAs); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_Artifact is not null) yield return new KeyValuePair("artifact",_Artifact); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); + if (_WorkflowStatusElement is not null) yield return new KeyValuePair("workflowStatus",_WorkflowStatusElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs index b73056b25..55969440e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -182,13 +185,13 @@ public partial class OutcomeComponent : Hl7.Fhir.Model.BackboneElement [Binding("AuditEventOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Code + public Hl7.Fhir.Model.Coding? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.Coding _Code; + private Hl7.Fhir.Model.Coding? _Code; /// /// Additional outcome detail. @@ -199,24 +202,20 @@ public Hl7.Fhir.Model.Coding Code [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as OutcomeComponent; - - if (dest == null) - { + if(other is not OutcomeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.Coding)Code.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.Coding)_Code.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -228,41 +227,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutcomeComponent; - if(otherT == null) return false; + if(other is not OutcomeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.Coding)value; + Code = (Hl7.Fhir.Model.Coding?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -273,8 +272,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -304,13 +303,13 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40, FiveWs="FiveWs.who")] [Binding("AuditAgentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Agent role in the event. @@ -321,11 +320,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// Identifier of who. @@ -335,26 +334,26 @@ public List Role [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Whether user is initiator. /// [FhirElement("requestor", InSummary=true, Order=70, FiveWs="FiveWs.who")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequestorElement + public Hl7.Fhir.Model.FhirBoolean? RequestorElement { get { return _RequestorElement; } set { _RequestorElement = value; OnPropertyChanged("RequestorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequestorElement; + private Hl7.Fhir.Model.FhirBoolean? _RequestorElement; /// /// Whether user is initiator @@ -363,13 +362,10 @@ public Hl7.Fhir.Model.FhirBoolean RequestorElement [IgnoreDataMember] public bool? Requestor { - get { return RequestorElement != null ? RequestorElement.Value : null; } + get => _RequestorElement?.Value; set { - if (value == null) - RequestorElement = null; - else - RequestorElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequestorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Requestor"); } } @@ -381,13 +377,13 @@ public bool? Requestor [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Policy that authorized the agent participation in the event. @@ -397,24 +393,24 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy that authorized the agent participation in the event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -429,13 +425,13 @@ public IEnumerable Policy [References("Endpoint")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Network + public Hl7.Fhir.Model.DataType? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.DataType _Network; + private Hl7.Fhir.Model.DataType? _Network; /// /// Allowable authorization for this agent. @@ -446,30 +442,26 @@ public Hl7.Fhir.Model.DataType Network [DataMember] public List Authorization { - get { if(_Authorization==null) _Authorization = new List(); return _Authorization; } + get => _Authorization ?? new List(); set { _Authorization = value; OnPropertyChanged("Authorization"); } } - private List _Authorization; + private List? _Authorization; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(RequestorElement != null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)RequestorElement.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Network != null) dest.Network = (Hl7.Fhir.Model.DataType)Network.DeepCopyInternal(); - if(Authorization.Any()) dest.Authorization = new List(Authorization.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_RequestorElement is not null) dest.RequestorElement = (Hl7.Fhir.Model.FhirBoolean)_RequestorElement.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.DataType)_Network.DeepCopyInternal(); + if(_Authorization is not null) dest.Authorization = new List(_Authorization.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -481,83 +473,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(RequestorElement, otherT.RequestorElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Authorization, otherT.Authorization)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_RequestorElement, otherT._RequestorElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Authorization, otherT._Authorization)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "requestor": - value = RequestorElement; - return RequestorElement is not null; + value = _RequestorElement; + return _RequestorElement is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "authorization": - value = Authorization; - return Authorization?.Any() == true; + value = _Authorization; + return _Authorization?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestor": - RequestorElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequestorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "network": - Network = (Hl7.Fhir.Model.DataType)value; + Network = (Hl7.Fhir.Model.DataType?)value; return this; case "authorization": - Authorization = (List)value; + Authorization = (List?)value!; return this; default: return base.SetValue(key, value); @@ -568,14 +560,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (RequestorElement is not null) yield return new KeyValuePair("requestor",RequestorElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Authorization?.Any() == true) yield return new KeyValuePair("authorization",Authorization); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_RequestorElement is not null) yield return new KeyValuePair("requestor",_RequestorElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Authorization?.Any() == true) yield return new KeyValuePair("authorization",_Authorization); } } @@ -604,13 +596,13 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Site + public Hl7.Fhir.Model.ResourceReference? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.ResourceReference _Site; + private Hl7.Fhir.Model.ResourceReference? _Site; /// /// The identity of source detecting the event. @@ -620,13 +612,13 @@ public Hl7.Fhir.Model.ResourceReference Site [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Observer + public Hl7.Fhir.Model.ResourceReference? Observer { get { return _Observer; } set { _Observer = value; OnPropertyChanged("Observer"); } } - private Hl7.Fhir.Model.ResourceReference _Observer; + private Hl7.Fhir.Model.ResourceReference? _Observer; /// /// The type of source where event originated. @@ -637,25 +629,21 @@ public Hl7.Fhir.Model.ResourceReference Observer [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Site != null) dest.Site = (Hl7.Fhir.Model.ResourceReference)Site.DeepCopyInternal(); - if(Observer != null) dest.Observer = (Hl7.Fhir.Model.ResourceReference)Observer.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.ResourceReference)_Site.DeepCopyInternal(); + if(_Observer is not null) dest.Observer = (Hl7.Fhir.Model.ResourceReference)_Observer.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -667,48 +655,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Observer, otherT.Observer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Observer, otherT._Observer)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "observer": - value = Observer; - return Observer is not null; + value = _Observer; + return _Observer is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - Site = (Hl7.Fhir.Model.ResourceReference)value; + Site = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "observer": - Observer = (Hl7.Fhir.Model.ResourceReference)value; + Observer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; default: return base.SetValue(key, value); @@ -719,9 +707,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Observer is not null) yield return new KeyValuePair("observer",Observer); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Observer is not null) yield return new KeyValuePair("observer",_Observer); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); } } @@ -750,13 +738,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference What + public Hl7.Fhir.Model.ResourceReference? What { get { return _What; } set { _What = value; OnPropertyChanged("What"); } } - private Hl7.Fhir.Model.ResourceReference _What; + private Hl7.Fhir.Model.ResourceReference? _What; /// /// What role the entity played. @@ -764,13 +752,13 @@ public Hl7.Fhir.Model.ResourceReference What [FhirElement("role", Order=50, FiveWs="FiveWs.context")] [Binding("AuditEventEntityRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Security labels on the entity. @@ -781,39 +769,36 @@ public Hl7.Fhir.Model.CodeableConcept Role [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Query parameters. /// [FhirElement("query", InSummary=true, Order=70, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.Base64Binary QueryElement + public Hl7.Fhir.Model.Base64Binary? QueryElement { get { return _QueryElement; } set { _QueryElement = value; OnPropertyChanged("QueryElement"); } } - private Hl7.Fhir.Model.Base64Binary _QueryElement; + private Hl7.Fhir.Model.Base64Binary? _QueryElement; /// /// Query parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] Query + public byte[]? Query { - get { return QueryElement != null ? QueryElement.Value : null; } + get => _QueryElement?.Value; set { - if (value == null) - QueryElement = null; - else - QueryElement = new Hl7.Fhir.Model.Base64Binary(value); + QueryElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("Query"); } } @@ -826,11 +811,11 @@ public byte[] Query [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; /// /// Entity is attributed to this agent. @@ -840,28 +825,24 @@ public List Detail [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(What != null) dest.What = (Hl7.Fhir.Model.ResourceReference)What.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(QueryElement != null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)QueryElement.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); + if(_What is not null) dest.What = (Hl7.Fhir.Model.ResourceReference)_What.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_QueryElement is not null) dest.QueryElement = (Hl7.Fhir.Model.Base64Binary)_QueryElement.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -873,69 +854,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(What, otherT.What)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.Equals(QueryElement, otherT.QueryElement)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_What, otherT._What)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "what": - value = What; - return What is not null; + value = _What; + return _What is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "query": - value = QueryElement; - return QueryElement is not null; + value = _QueryElement; + return _QueryElement is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "what": - What = (Hl7.Fhir.Model.ResourceReference)value; + What = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "query": - QueryElement = (Hl7.Fhir.Model.Base64Binary)value; + QueryElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -946,12 +927,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (What is not null) yield return new KeyValuePair("what",What); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (QueryElement is not null) yield return new KeyValuePair("query",QueryElement); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); + if (_What is not null) yield return new KeyValuePair("what",_What); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_QueryElement is not null) yield return new KeyValuePair("query",_QueryElement); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); } } @@ -979,13 +960,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [Binding("AuditEventDetailType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Property value. @@ -995,26 +976,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Base64Binary))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1026,41 +1003,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1071,8 +1048,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1086,11 +1063,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Specific type of event. @@ -1099,13 +1076,13 @@ public List Category [Binding("AuditEventSubType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Type of action performed during the event. @@ -1114,13 +1091,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("AuditEventAction")] [DataMember] - public Code ActionElement + public Code? ActionElement { get { return _ActionElement; } set { _ActionElement = value; OnPropertyChanged("ActionElement"); } } - private Code _ActionElement; + private Code? _ActionElement; /// /// Type of action performed during the event @@ -1129,13 +1106,10 @@ public Code ActionElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action { - get { return ActionElement != null ? ActionElement.Value : null; } + get => _ActionElement?.Value; set { - if (value == null) - ActionElement = null; - else - ActionElement = new Code(value); + ActionElement = value is null ? null : new Code(value); OnPropertyChanged("Action"); } } @@ -1147,13 +1121,13 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventAction? Action [DeclaredType(Type = typeof(Code))] [Binding("AuditEventSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// emergency | alert | critical | error | warning | notice | informational | debug @@ -1162,13 +1136,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.AuditEvent.AuditEventSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -1180,13 +1151,13 @@ public Hl7.Fhir.Model.AuditEvent.AuditEventSeverity? Severity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Occurred + public Hl7.Fhir.Model.DataType? Occurred { get { return _Occurred; } set { _Occurred = value; OnPropertyChanged("Occurred"); } } - private Hl7.Fhir.Model.DataType _Occurred; + private Hl7.Fhir.Model.DataType? _Occurred; /// /// Time when the event was recorded. @@ -1194,13 +1165,13 @@ public Hl7.Fhir.Model.DataType Occurred [FhirElement("recorded", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// Time when the event was recorded @@ -1209,13 +1180,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -1225,13 +1193,13 @@ public DateTimeOffset? Recorded /// [FhirElement("outcome", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.AuditEvent.OutcomeComponent Outcome + public Hl7.Fhir.Model.AuditEvent.OutcomeComponent? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.AuditEvent.OutcomeComponent _Outcome; + private Hl7.Fhir.Model.AuditEvent.OutcomeComponent? _Outcome; /// /// Authorization related to the event. @@ -1242,11 +1210,11 @@ public Hl7.Fhir.Model.AuditEvent.OutcomeComponent Outcome [DataMember] public List Authorization { - get { if(_Authorization==null) _Authorization = new List(); return _Authorization; } + get => _Authorization ?? new List(); set { _Authorization = value; OnPropertyChanged("Authorization"); } } - private List _Authorization; + private List? _Authorization; /// /// Workflow authorization within which this event occurred. @@ -1258,11 +1226,11 @@ public List Authorization [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// The patient is the subject of the data used/created/updated/deleted during the activity. @@ -1271,13 +1239,13 @@ public List BasedOn [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter within which this event occurred or which the event is tightly associated. @@ -1286,13 +1254,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Actor involved in the event. @@ -1302,11 +1270,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// Audit Event Reporter. @@ -1314,13 +1282,13 @@ public List Agent [FhirElement("source", InSummary=true, Order=210, FiveWs="FiveWs.witness")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.AuditEvent.SourceComponent Source + public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.AuditEvent.SourceComponent _Source; + private Hl7.Fhir.Model.AuditEvent.SourceComponent? _Source; /// /// Data or objects used. @@ -1330,36 +1298,32 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent Source [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; protected internal override void CopyToInternal(Base other) { - var dest = other as AuditEvent; - - if (dest == null) - { + if(other is not AuditEvent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ActionElement != null) dest.ActionElement = (Code)ActionElement.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(Occurred != null) dest.Occurred = (Hl7.Fhir.Model.DataType)Occurred.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.AuditEvent.OutcomeComponent)Outcome.DeepCopyInternal(); - if(Authorization.Any()) dest.Authorization = new List(Authorization.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Source != null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)Source.DeepCopyInternal(); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ActionElement is not null) dest.ActionElement = (Code)_ActionElement.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_Occurred is not null) dest.Occurred = (Hl7.Fhir.Model.DataType)_Occurred.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.AuditEvent.OutcomeComponent)_Outcome.DeepCopyInternal(); + if(_Authorization is not null) dest.Authorization = new List(_Authorization.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)_Source.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1371,125 +1335,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AuditEvent; - if(otherT == null) return false; + if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(ActionElement, otherT.ActionElement)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(Occurred, otherT.Occurred)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.ListEquals(Authorization, otherT.Authorization)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_Occurred, otherT._Occurred)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.ListEquals(_Authorization, otherT._Authorization)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "action": - value = ActionElement; - return ActionElement is not null; + value = _ActionElement; + return _ActionElement is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "occurred": - value = Occurred; - return Occurred is not null; + value = _Occurred; + return _Occurred is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "authorization": - value = Authorization; - return Authorization?.Any() == true; + value = _Authorization; + return _Authorization?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "action": - ActionElement = (Code)value; + ActionElement = (Code?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "occurred": - Occurred = (Hl7.Fhir.Model.DataType)value; + Occurred = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.AuditEvent.OutcomeComponent)value; + Outcome = (Hl7.Fhir.Model.AuditEvent.OutcomeComponent?)value; return this; case "authorization": - Authorization = (List)value; + Authorization = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "source": - Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent)value; + Source = (Hl7.Fhir.Model.AuditEvent.SourceComponent?)value; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1500,20 +1464,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ActionElement is not null) yield return new KeyValuePair("action",ActionElement); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (Occurred is not null) yield return new KeyValuePair("occurred",Occurred); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Authorization?.Any() == true) yield return new KeyValuePair("authorization",Authorization); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ActionElement is not null) yield return new KeyValuePair("action",_ActionElement); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_Occurred is not null) yield return new KeyValuePair("occurred",_Occurred); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Authorization?.Any() == true) yield return new KeyValuePair("authorization",_Authorization); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs index 20eaaa3a6..f13b0b0cb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -79,24 +82,24 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.Element [DataMember] public List> DaysOfWeekElement { - get { if(_DaysOfWeekElement==null) _DaysOfWeekElement = new List>(); return _DaysOfWeekElement; } + get => _DaysOfWeekElement ?? new List>(); set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } - private List> _DaysOfWeekElement; + private List>? _DaysOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DaysOfWeek + public IEnumerable? DaysOfWeek { - get { return DaysOfWeekElement != null ? DaysOfWeekElement.Select(elem => elem.Value) : null; } + get => _DaysOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DaysOfWeekElement = null; + DaysOfWeekElement = null!; else DaysOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DaysOfWeek"); @@ -108,13 +111,13 @@ public IEnumerable DaysOfWeek /// [FhirElement("allDay", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllDayElement + public Hl7.Fhir.Model.FhirBoolean? AllDayElement { get { return _AllDayElement; } set { _AllDayElement = value; OnPropertyChanged("AllDayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllDayElement; + private Hl7.Fhir.Model.FhirBoolean? _AllDayElement; /// /// Always available? i.e. 24 hour service @@ -123,13 +126,10 @@ public Hl7.Fhir.Model.FhirBoolean AllDayElement [IgnoreDataMember] public bool? AllDay { - get { return AllDayElement != null ? AllDayElement.Value : null; } + get => _AllDayElement?.Value; set { - if (value == null) - AllDayElement = null; - else - AllDayElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllDayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllDay"); } } @@ -139,28 +139,25 @@ public bool? AllDay /// [FhirElement("availableStartTime", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Time AvailableStartTimeElement + public Hl7.Fhir.Model.Time? AvailableStartTimeElement { get { return _AvailableStartTimeElement; } set { _AvailableStartTimeElement = value; OnPropertyChanged("AvailableStartTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableStartTimeElement; + private Hl7.Fhir.Model.Time? _AvailableStartTimeElement; /// /// Opening time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableStartTime + public string? AvailableStartTime { - get { return AvailableStartTimeElement != null ? AvailableStartTimeElement.Value : null; } + get => _AvailableStartTimeElement?.Value; set { - if (value == null) - AvailableStartTimeElement = null; - else - AvailableStartTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableStartTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableStartTime"); } } @@ -170,46 +167,39 @@ public string AvailableStartTime /// [FhirElement("availableEndTime", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Time AvailableEndTimeElement + public Hl7.Fhir.Model.Time? AvailableEndTimeElement { get { return _AvailableEndTimeElement; } set { _AvailableEndTimeElement = value; OnPropertyChanged("AvailableEndTimeElement"); } } - private Hl7.Fhir.Model.Time _AvailableEndTimeElement; + private Hl7.Fhir.Model.Time? _AvailableEndTimeElement; /// /// Closing time of day (ignored if allDay = true) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AvailableEndTime + public string? AvailableEndTime { - get { return AvailableEndTimeElement != null ? AvailableEndTimeElement.Value : null; } + get => _AvailableEndTimeElement?.Value; set { - if (value == null) - AvailableEndTimeElement = null; - else - AvailableEndTimeElement = new Hl7.Fhir.Model.Time(value); + AvailableEndTimeElement = value is null ? null : new Hl7.Fhir.Model.Time(value); OnPropertyChanged("AvailableEndTime"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AvailableTimeComponent; - - if (dest == null) - { + if(other is not AvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DaysOfWeekElement.Any()) dest.DaysOfWeekElement = new List>(DaysOfWeekElement.DeepCopyInternal()); - if(AllDayElement != null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)AllDayElement.DeepCopyInternal(); - if(AvailableStartTimeElement != null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)AvailableStartTimeElement.DeepCopyInternal(); - if(AvailableEndTimeElement != null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)AvailableEndTimeElement.DeepCopyInternal(); + if(_DaysOfWeekElement is not null) dest.DaysOfWeekElement = new List>(_DaysOfWeekElement.DeepCopyInternal()); + if(_AllDayElement is not null) dest.AllDayElement = (Hl7.Fhir.Model.FhirBoolean)_AllDayElement.DeepCopyInternal(); + if(_AvailableStartTimeElement is not null) dest.AvailableStartTimeElement = (Hl7.Fhir.Model.Time)_AvailableStartTimeElement.DeepCopyInternal(); + if(_AvailableEndTimeElement is not null) dest.AvailableEndTimeElement = (Hl7.Fhir.Model.Time)_AvailableEndTimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -221,55 +211,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AvailableTimeComponent; - if(otherT == null) return false; + if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(DaysOfWeekElement, otherT.DaysOfWeekElement)) return false; - if(!comparer.Equals(AllDayElement, otherT.AllDayElement)) return false; - if(!comparer.Equals(AvailableStartTimeElement, otherT.AvailableStartTimeElement)) return false; - if(!comparer.Equals(AvailableEndTimeElement, otherT.AvailableEndTimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; + if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; + if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "daysOfWeek": - value = DaysOfWeekElement; - return DaysOfWeekElement?.Any() == true; + value = _DaysOfWeekElement; + return _DaysOfWeekElement?.Any() == true; case "allDay": - value = AllDayElement; - return AllDayElement is not null; + value = _AllDayElement; + return _AllDayElement is not null; case "availableStartTime": - value = AvailableStartTimeElement; - return AvailableStartTimeElement is not null; + value = _AvailableStartTimeElement; + return _AvailableStartTimeElement is not null; case "availableEndTime": - value = AvailableEndTimeElement; - return AvailableEndTimeElement is not null; + value = _AvailableEndTimeElement; + return _AvailableEndTimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "daysOfWeek": - DaysOfWeekElement = (List>)value; + DaysOfWeekElement = (List>?)value!; return this; case "allDay": - AllDayElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllDayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availableStartTime": - AvailableStartTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableStartTimeElement = (Hl7.Fhir.Model.Time?)value; return this; case "availableEndTime": - AvailableEndTimeElement = (Hl7.Fhir.Model.Time)value; + AvailableEndTimeElement = (Hl7.Fhir.Model.Time?)value; return this; default: return base.SetValue(key, value); @@ -280,10 +270,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",DaysOfWeekElement); - if (AllDayElement is not null) yield return new KeyValuePair("allDay",AllDayElement); - if (AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",AvailableStartTimeElement); - if (AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",AvailableEndTimeElement); + if (_DaysOfWeekElement?.Any() == true) yield return new KeyValuePair("daysOfWeek",_DaysOfWeekElement); + if (_AllDayElement is not null) yield return new KeyValuePair("allDay",_AllDayElement); + if (_AvailableStartTimeElement is not null) yield return new KeyValuePair("availableStartTime",_AvailableStartTimeElement); + if (_AvailableEndTimeElement is not null) yield return new KeyValuePair("availableEndTime",_AvailableEndTimeElement); } } @@ -306,28 +296,25 @@ public partial class NotAvailableTimeComponent : Hl7.Fhir.Model.Element /// [FhirElement("description", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Reason presented to the user explaining why time not available /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -337,26 +324,22 @@ public string Description /// [FhirElement("during", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Period During + public Hl7.Fhir.Model.Period? During { get { return _During; } set { _During = value; OnPropertyChanged("During"); } } - private Hl7.Fhir.Model.Period _During; + private Hl7.Fhir.Model.Period? _During; protected internal override void CopyToInternal(Base other) { - var dest = other as NotAvailableTimeComponent; - - if (dest == null) - { + if(other is not NotAvailableTimeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(During != null) dest.During = (Hl7.Fhir.Model.Period)During.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_During is not null) dest.During = (Hl7.Fhir.Model.Period)_During.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -368,41 +351,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotAvailableTimeComponent; - if(otherT == null) return false; + if(other is not NotAvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(During, otherT.During)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_During, otherT._During)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "during": - value = During; - return During is not null; + value = _During; + return _During is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "during": - During = (Hl7.Fhir.Model.Period)value; + During = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -413,8 +396,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (During is not null) yield return new KeyValuePair("during",During); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_During is not null) yield return new KeyValuePair("during",_During); } } @@ -427,11 +410,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List AvailableTime { - get { if(_AvailableTime==null) _AvailableTime = new List(); return _AvailableTime; } + get => _AvailableTime ?? new List(); set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } - private List _AvailableTime; + private List? _AvailableTime; /// /// Not available during this time due to provided reason. @@ -441,24 +424,20 @@ public List AvailableTime [DataMember] public List NotAvailableTime { - get { if(_NotAvailableTime==null) _NotAvailableTime = new List(); return _NotAvailableTime; } + get => _NotAvailableTime ?? new List(); set { _NotAvailableTime = value; OnPropertyChanged("NotAvailableTime"); } } - private List _NotAvailableTime; + private List? _NotAvailableTime; protected internal override void CopyToInternal(Base other) { - var dest = other as Availability; - - if (dest == null) - { + if(other is not Availability dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AvailableTime.Any()) dest.AvailableTime = new List(AvailableTime.DeepCopyInternal()); - if(NotAvailableTime.Any()) dest.NotAvailableTime = new List(NotAvailableTime.DeepCopyInternal()); + if(_AvailableTime is not null) dest.AvailableTime = new List(_AvailableTime.DeepCopyInternal()); + if(_NotAvailableTime is not null) dest.NotAvailableTime = new List(_NotAvailableTime.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -470,41 +449,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Availability; - if(otherT == null) return false; + if(other is not Availability otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(AvailableTime, otherT.AvailableTime)) return false; - if(!comparer.ListEquals(NotAvailableTime, otherT.NotAvailableTime)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + if(!comparer.ListEquals(_NotAvailableTime, otherT._NotAvailableTime)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "availableTime": - value = AvailableTime; - return AvailableTime?.Any() == true; + value = _AvailableTime; + return _AvailableTime?.Any() == true; case "notAvailableTime": - value = NotAvailableTime; - return NotAvailableTime?.Any() == true; + value = _NotAvailableTime; + return _NotAvailableTime?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "availableTime": - AvailableTime = (List)value; + AvailableTime = (List?)value!; return this; case "notAvailableTime": - NotAvailableTime = (List)value; + NotAvailableTime = (List?)value!; return this; default: return base.SetValue(key, value); @@ -515,8 +494,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",AvailableTime); - if (NotAvailableTime?.Any() == true) yield return new KeyValuePair("notAvailableTime",NotAvailableTime); + if (_AvailableTime?.Any() == true) yield return new KeyValuePair("availableTime",_AvailableTime); + if (_NotAvailableTime?.Any() == true) yield return new KeyValuePair("notAvailableTime",_NotAvailableTime); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Basic.cs b/src/Hl7.Fhir.R5/Model/Generated/Basic.cs index 9f34274c0..337bcbd30 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Basic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Kind of Resource. @@ -80,13 +83,13 @@ public List Identifier [Binding("BasicResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Identifies the focus of this resource. @@ -95,41 +98,38 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When created. /// [FhirElement("created", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// When created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -141,31 +141,27 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Organization","Device","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Basic; - - if (dest == null) - { + if(other is not Basic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -177,62 +173,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Basic; - if(otherT == null) return false; + if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -243,11 +239,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs index eeb4266eb..79736975e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class CollectionComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Collector + public Hl7.Fhir.Model.ResourceReference? Collector { get { return _Collector; } set { _Collector = value; OnPropertyChanged("Collector"); } } - private Hl7.Fhir.Model.ResourceReference _Collector; + private Hl7.Fhir.Model.ResourceReference? _Collector; /// /// The patient who underwent the medical procedure to collect the product or the organization that facilitated the collection. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.ResourceReference Collector [CLSCompliant(false)] [References("Patient","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Time of product collection. @@ -111,27 +114,23 @@ public Hl7.Fhir.Model.ResourceReference Source [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Collected + public Hl7.Fhir.Model.DataType? Collected { get { return _Collected; } set { _Collected = value; OnPropertyChanged("Collected"); } } - private Hl7.Fhir.Model.DataType _Collected; + private Hl7.Fhir.Model.DataType? _Collected; protected internal override void CopyToInternal(Base other) { - var dest = other as CollectionComponent; - - if (dest == null) - { + if(other is not CollectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Collector != null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)Collector.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Collected != null) dest.Collected = (Hl7.Fhir.Model.DataType)Collected.DeepCopyInternal(); + if(_Collector is not null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)_Collector.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Collected is not null) dest.Collected = (Hl7.Fhir.Model.DataType)_Collected.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CollectionComponent; - if(otherT == null) return false; + if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Collector, otherT.Collector)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Collected, otherT.Collected)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Collected, otherT._Collected)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "collector": - value = Collector; - return Collector is not null; + value = _Collector; + return _Collector is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "collected": - value = Collected; - return Collected is not null; + value = _Collected; + return _Collected is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "collector": - Collector = (Hl7.Fhir.Model.ResourceReference)value; + Collector = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "collected": - Collected = (Hl7.Fhir.Model.DataType)value; + Collected = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Collector is not null) yield return new KeyValuePair("collector",Collector); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Collected is not null) yield return new KeyValuePair("collected",Collected); + if (_Collector is not null) yield return new KeyValuePair("collector",_Collector); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Collected is not null) yield return new KeyValuePair("collected",_Collected); } } @@ -225,13 +224,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("BiologicallyDerivedProductPropertyTypeCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Property values. @@ -241,26 +240,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Attachment))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,41 +267,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -317,8 +312,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -329,13 +324,13 @@ public override IEnumerable> EnumerateElements() [FhirElement("productCategory", Order=90)] [Binding("BiologicallyDerivedProductCategory")] [DataMember] - public Hl7.Fhir.Model.Coding ProductCategory + public Hl7.Fhir.Model.Coding? ProductCategory { get { return _ProductCategory; } set { _ProductCategory = value; OnPropertyChanged("ProductCategory"); } } - private Hl7.Fhir.Model.Coding _ProductCategory; + private Hl7.Fhir.Model.Coding? _ProductCategory; /// /// A code that identifies the kind of this biologically derived product. @@ -343,13 +338,13 @@ public Hl7.Fhir.Model.Coding ProductCategory [FhirElement("productCode", Order=100)] [Binding("BiologicallyDerivedProductCodes")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductCode + public Hl7.Fhir.Model.CodeableConcept? ProductCode { get { return _ProductCode; } set { _ProductCode = value; OnPropertyChanged("ProductCode"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductCode; + private Hl7.Fhir.Model.CodeableConcept? _ProductCode; /// /// The parent biologically-derived product. @@ -361,11 +356,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductCode [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// Request to obtain and/or infuse this product. @@ -377,11 +372,11 @@ public List Parent [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Instance identifier. @@ -391,24 +386,24 @@ public List Request [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled. /// [FhirElement("biologicalSourceEvent", InSummary=true, Order=140, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier BiologicalSourceEvent + public Hl7.Fhir.Model.Identifier? BiologicalSourceEvent { get { return _BiologicalSourceEvent; } set { _BiologicalSourceEvent = value; OnPropertyChanged("BiologicalSourceEvent"); } } - private Hl7.Fhir.Model.Identifier _BiologicalSourceEvent; + private Hl7.Fhir.Model.Identifier? _BiologicalSourceEvent; /// /// Processing facilities responsible for the labeling and distribution of this biologically derived product. @@ -420,39 +415,36 @@ public Hl7.Fhir.Model.Identifier BiologicalSourceEvent [DataMember] public List ProcessingFacility { - get { if(_ProcessingFacility==null) _ProcessingFacility = new List(); return _ProcessingFacility; } + get => _ProcessingFacility ?? new List(); set { _ProcessingFacility = value; OnPropertyChanged("ProcessingFacility"); } } - private List _ProcessingFacility; + private List? _ProcessingFacility; /// /// A unique identifier for an aliquot of a product. /// [FhirElement("division", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString DivisionElement + public Hl7.Fhir.Model.FhirString? DivisionElement { get { return _DivisionElement; } set { _DivisionElement = value; OnPropertyChanged("DivisionElement"); } } - private Hl7.Fhir.Model.FhirString _DivisionElement; + private Hl7.Fhir.Model.FhirString? _DivisionElement; /// /// A unique identifier for an aliquot of a product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Division + public string? Division { - get { return DivisionElement != null ? DivisionElement.Value : null; } + get => _DivisionElement?.Value; set { - if (value == null) - DivisionElement = null; - else - DivisionElement = new Hl7.Fhir.Model.FhirString(value); + DivisionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Division"); } } @@ -463,41 +455,38 @@ public string Division [FhirElement("productStatus", Order=170)] [Binding("BiologicallyDerivedProductStatus")] [DataMember] - public Hl7.Fhir.Model.Coding ProductStatus + public Hl7.Fhir.Model.Coding? ProductStatus { get { return _ProductStatus; } set { _ProductStatus = value; OnPropertyChanged("ProductStatus"); } } - private Hl7.Fhir.Model.Coding _ProductStatus; + private Hl7.Fhir.Model.Coding? _ProductStatus; /// /// Date, and where relevant time, of expiration. /// [FhirElement("expirationDate", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// Date, and where relevant time, of expiration /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } @@ -507,26 +496,26 @@ public string ExpirationDate /// [FhirElement("collection", Order=190)] [DataMember] - public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent Collection + public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? Collection { get { return _Collection; } set { _Collection = value; OnPropertyChanged("Collection"); } } - private Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent _Collection; + private Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? _Collection; /// /// Product storage temperature requirements. /// [FhirElement("storageTempRequirements", Order=200)] [DataMember] - public Hl7.Fhir.Model.Range StorageTempRequirements + public Hl7.Fhir.Model.Range? StorageTempRequirements { get { return _StorageTempRequirements; } set { _StorageTempRequirements = value; OnPropertyChanged("StorageTempRequirements"); } } - private Hl7.Fhir.Model.Range _StorageTempRequirements; + private Hl7.Fhir.Model.Range? _StorageTempRequirements; /// /// A property that is specific to this BiologicallyDerviedProduct instance. @@ -536,37 +525,33 @@ public Hl7.Fhir.Model.Range StorageTempRequirements [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as BiologicallyDerivedProduct; - - if (dest == null) - { + if(other is not BiologicallyDerivedProduct dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductCategory != null) dest.ProductCategory = (Hl7.Fhir.Model.Coding)ProductCategory.DeepCopyInternal(); - if(ProductCode != null) dest.ProductCode = (Hl7.Fhir.Model.CodeableConcept)ProductCode.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BiologicalSourceEvent != null) dest.BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)BiologicalSourceEvent.DeepCopyInternal(); - if(ProcessingFacility.Any()) dest.ProcessingFacility = new List(ProcessingFacility.DeepCopyInternal()); - if(DivisionElement != null) dest.DivisionElement = (Hl7.Fhir.Model.FhirString)DivisionElement.DeepCopyInternal(); - if(ProductStatus != null) dest.ProductStatus = (Hl7.Fhir.Model.Coding)ProductStatus.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); - if(Collection != null) dest.Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)Collection.DeepCopyInternal(); - if(StorageTempRequirements != null) dest.StorageTempRequirements = (Hl7.Fhir.Model.Range)StorageTempRequirements.DeepCopyInternal(); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); + if(_ProductCategory is not null) dest.ProductCategory = (Hl7.Fhir.Model.Coding)_ProductCategory.DeepCopyInternal(); + if(_ProductCode is not null) dest.ProductCode = (Hl7.Fhir.Model.CodeableConcept)_ProductCode.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BiologicalSourceEvent is not null) dest.BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)_BiologicalSourceEvent.DeepCopyInternal(); + if(_ProcessingFacility is not null) dest.ProcessingFacility = new List(_ProcessingFacility.DeepCopyInternal()); + if(_DivisionElement is not null) dest.DivisionElement = (Hl7.Fhir.Model.FhirString)_DivisionElement.DeepCopyInternal(); + if(_ProductStatus is not null) dest.ProductStatus = (Hl7.Fhir.Model.Coding)_ProductStatus.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); + if(_Collection is not null) dest.Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)_Collection.DeepCopyInternal(); + if(_StorageTempRequirements is not null) dest.StorageTempRequirements = (Hl7.Fhir.Model.Range)_StorageTempRequirements.DeepCopyInternal(); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -578,118 +563,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BiologicallyDerivedProduct; - if(otherT == null) return false; + if(other is not BiologicallyDerivedProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductCategory, otherT.ProductCategory)) return false; - if(!comparer.Equals(ProductCode, otherT.ProductCode)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(BiologicalSourceEvent, otherT.BiologicalSourceEvent)) return false; - if(!comparer.ListEquals(ProcessingFacility, otherT.ProcessingFacility)) return false; - if(!comparer.Equals(DivisionElement, otherT.DivisionElement)) return false; - if(!comparer.Equals(ProductStatus, otherT.ProductStatus)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(Collection, otherT.Collection)) return false; - if(!comparer.Equals(StorageTempRequirements, otherT.StorageTempRequirements)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductCategory, otherT._ProductCategory)) return false; + if(!comparer.Equals(_ProductCode, otherT._ProductCode)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_BiologicalSourceEvent, otherT._BiologicalSourceEvent)) return false; + if(!comparer.ListEquals(_ProcessingFacility, otherT._ProcessingFacility)) return false; + if(!comparer.Equals(_DivisionElement, otherT._DivisionElement)) return false; + if(!comparer.Equals(_ProductStatus, otherT._ProductStatus)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_Collection, otherT._Collection)) return false; + if(!comparer.Equals(_StorageTempRequirements, otherT._StorageTempRequirements)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productCategory": - value = ProductCategory; - return ProductCategory is not null; + value = _ProductCategory; + return _ProductCategory is not null; case "productCode": - value = ProductCode; - return ProductCode is not null; + value = _ProductCode; + return _ProductCode is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "biologicalSourceEvent": - value = BiologicalSourceEvent; - return BiologicalSourceEvent is not null; + value = _BiologicalSourceEvent; + return _BiologicalSourceEvent is not null; case "processingFacility": - value = ProcessingFacility; - return ProcessingFacility?.Any() == true; + value = _ProcessingFacility; + return _ProcessingFacility?.Any() == true; case "division": - value = DivisionElement; - return DivisionElement is not null; + value = _DivisionElement; + return _DivisionElement is not null; case "productStatus": - value = ProductStatus; - return ProductStatus is not null; + value = _ProductStatus; + return _ProductStatus is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "collection": - value = Collection; - return Collection is not null; + value = _Collection; + return _Collection is not null; case "storageTempRequirements": - value = StorageTempRequirements; - return StorageTempRequirements is not null; + value = _StorageTempRequirements; + return _StorageTempRequirements is not null; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productCategory": - ProductCategory = (Hl7.Fhir.Model.Coding)value; + ProductCategory = (Hl7.Fhir.Model.Coding?)value; return this; case "productCode": - ProductCode = (Hl7.Fhir.Model.CodeableConcept)value; + ProductCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "biologicalSourceEvent": - BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)value; + BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier?)value; return this; case "processingFacility": - ProcessingFacility = (List)value; + ProcessingFacility = (List?)value!; return this; case "division": - DivisionElement = (Hl7.Fhir.Model.FhirString)value; + DivisionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "productStatus": - ProductStatus = (Hl7.Fhir.Model.Coding)value; + ProductStatus = (Hl7.Fhir.Model.Coding?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "collection": - Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent)value; + Collection = (Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent?)value; return this; case "storageTempRequirements": - StorageTempRequirements = (Hl7.Fhir.Model.Range)value; + StorageTempRequirements = (Hl7.Fhir.Model.Range?)value; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; default: return base.SetValue(key, value); @@ -700,19 +685,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductCategory is not null) yield return new KeyValuePair("productCategory",ProductCategory); - if (ProductCode is not null) yield return new KeyValuePair("productCode",ProductCode); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BiologicalSourceEvent is not null) yield return new KeyValuePair("biologicalSourceEvent",BiologicalSourceEvent); - if (ProcessingFacility?.Any() == true) yield return new KeyValuePair("processingFacility",ProcessingFacility); - if (DivisionElement is not null) yield return new KeyValuePair("division",DivisionElement); - if (ProductStatus is not null) yield return new KeyValuePair("productStatus",ProductStatus); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (Collection is not null) yield return new KeyValuePair("collection",Collection); - if (StorageTempRequirements is not null) yield return new KeyValuePair("storageTempRequirements",StorageTempRequirements); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); + if (_ProductCategory is not null) yield return new KeyValuePair("productCategory",_ProductCategory); + if (_ProductCode is not null) yield return new KeyValuePair("productCode",_ProductCode); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BiologicalSourceEvent is not null) yield return new KeyValuePair("biologicalSourceEvent",_BiologicalSourceEvent); + if (_ProcessingFacility?.Any() == true) yield return new KeyValuePair("processingFacility",_ProcessingFacility); + if (_DivisionElement is not null) yield return new KeyValuePair("division",_DivisionElement); + if (_ProductStatus is not null) yield return new KeyValuePair("productStatus",_ProductStatus); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_Collection is not null) yield return new KeyValuePair("collection",_Collection); + if (_StorageTempRequirements is not null) yield return new KeyValuePair("storageTempRequirements",_StorageTempRequirements); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs index 19098998d..796f5dbca 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -136,13 +139,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("BiologicallyDerivedProductDispensPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the action. @@ -152,26 +155,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -183,41 +182,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -228,8 +227,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -242,11 +241,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The order or request that this dispense is fulfilling. @@ -258,11 +257,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Short description. @@ -274,11 +273,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | allocated | issued | unfulfilled | returned | entered-in-error | unknown. @@ -288,13 +287,13 @@ public List PartOf [Binding("BiologicallyDerivedProductDispenseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | allocated | issued | unfulfilled | returned | entered-in-error | unknown @@ -303,13 +302,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -320,13 +316,13 @@ public Hl7.Fhir.Model.BiologicallyDerivedProductDispense.BiologicallyDerivedProd [FhirElement("originRelationshipType", InSummary=true, Order=130)] [Binding("BiologicallyDerivedProductDispenseOriginRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OriginRelationshipType + public Hl7.Fhir.Model.CodeableConcept? OriginRelationshipType { get { return _OriginRelationshipType; } set { _OriginRelationshipType = value; OnPropertyChanged("OriginRelationshipType"); } } - private Hl7.Fhir.Model.CodeableConcept _OriginRelationshipType; + private Hl7.Fhir.Model.CodeableConcept? _OriginRelationshipType; /// /// The BiologicallyDerivedProduct that is dispensed. @@ -336,13 +332,13 @@ public Hl7.Fhir.Model.CodeableConcept OriginRelationshipType [References("BiologicallyDerivedProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Product + public Hl7.Fhir.Model.ResourceReference? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.ResourceReference _Product; + private Hl7.Fhir.Model.ResourceReference? _Product; /// /// The intended recipient of the dispensed product. @@ -352,13 +348,13 @@ public Hl7.Fhir.Model.ResourceReference Product [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Indicates the type of matching associated with the dispense. @@ -366,13 +362,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("matchStatus", InSummary=true, Order=160)] [Binding("BiologicallyDerivedProductDispenseMatchStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MatchStatus + public Hl7.Fhir.Model.CodeableConcept? MatchStatus { get { return _MatchStatus; } set { _MatchStatus = value; OnPropertyChanged("MatchStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _MatchStatus; + private Hl7.Fhir.Model.CodeableConcept? _MatchStatus; /// /// Indicates who or what performed an action. @@ -382,11 +378,11 @@ public Hl7.Fhir.Model.CodeableConcept MatchStatus [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the dispense occurred. @@ -395,54 +391,51 @@ public List /// Amount dispensed. /// [FhirElement("quantity", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// When product was selected/matched. /// [FhirElement("preparedDate", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PreparedDateElement + public Hl7.Fhir.Model.FhirDateTime? PreparedDateElement { get { return _PreparedDateElement; } set { _PreparedDateElement = value; OnPropertyChanged("PreparedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PreparedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PreparedDateElement; /// /// When product was selected/matched /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreparedDate + public string? PreparedDate { - get { return PreparedDateElement != null ? PreparedDateElement.Value : null; } + get => _PreparedDateElement?.Value; set { - if (value == null) - PreparedDateElement = null; - else - PreparedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PreparedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PreparedDate"); } } @@ -452,28 +445,25 @@ public string PreparedDate /// [FhirElement("whenHandedOver", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenHandedOverElement + public Hl7.Fhir.Model.FhirDateTime? WhenHandedOverElement { get { return _WhenHandedOverElement; } set { _WhenHandedOverElement = value; OnPropertyChanged("WhenHandedOverElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenHandedOverElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenHandedOverElement; /// /// When the product was dispatched /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenHandedOver + public string? WhenHandedOver { - get { return WhenHandedOverElement != null ? WhenHandedOverElement.Value : null; } + get => _WhenHandedOverElement?.Value; set { - if (value == null) - WhenHandedOverElement = null; - else - WhenHandedOverElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenHandedOverElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenHandedOver"); } } @@ -485,13 +475,13 @@ public string WhenHandedOver [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Additional notes. @@ -501,39 +491,36 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Specific instructions for use. /// [FhirElement("usageInstruction", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageInstructionElement + public Hl7.Fhir.Model.FhirString? UsageInstructionElement { get { return _UsageInstructionElement; } set { _UsageInstructionElement = value; OnPropertyChanged("UsageInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _UsageInstructionElement; + private Hl7.Fhir.Model.FhirString? _UsageInstructionElement; /// /// Specific instructions for use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string UsageInstruction + public string? UsageInstruction { - get { return UsageInstructionElement != null ? UsageInstructionElement.Value : null; } + get => _UsageInstructionElement?.Value; set { - if (value == null) - UsageInstructionElement = null; - else - UsageInstructionElement = new Hl7.Fhir.Model.FhirString(value); + UsageInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("UsageInstruction"); } } @@ -542,30 +529,26 @@ public string UsageInstruction protected internal override void CopyToInternal(Base other) { - var dest = other as BiologicallyDerivedProductDispense; - - if (dest == null) - { + if(other is not BiologicallyDerivedProductDispense dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(OriginRelationshipType != null) dest.OriginRelationshipType = (Hl7.Fhir.Model.CodeableConcept)OriginRelationshipType.DeepCopyInternal(); - if(Product != null) dest.Product = (Hl7.Fhir.Model.ResourceReference)Product.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(MatchStatus != null) dest.MatchStatus = (Hl7.Fhir.Model.CodeableConcept)MatchStatus.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(PreparedDateElement != null) dest.PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime)PreparedDateElement.DeepCopyInternal(); - if(WhenHandedOverElement != null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UsageInstructionElement != null) dest.UsageInstructionElement = (Hl7.Fhir.Model.FhirString)UsageInstructionElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_OriginRelationshipType is not null) dest.OriginRelationshipType = (Hl7.Fhir.Model.CodeableConcept)_OriginRelationshipType.DeepCopyInternal(); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.ResourceReference)_Product.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_MatchStatus is not null) dest.MatchStatus = (Hl7.Fhir.Model.CodeableConcept)_MatchStatus.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_PreparedDateElement is not null) dest.PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime)_PreparedDateElement.DeepCopyInternal(); + if(_WhenHandedOverElement is not null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)_WhenHandedOverElement.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UsageInstructionElement is not null) dest.UsageInstructionElement = (Hl7.Fhir.Model.FhirString)_UsageInstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -577,139 +560,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BiologicallyDerivedProductDispense; - if(otherT == null) return false; + if(other is not BiologicallyDerivedProductDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(OriginRelationshipType, otherT.OriginRelationshipType)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(MatchStatus, otherT.MatchStatus)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(PreparedDateElement, otherT.PreparedDateElement)) return false; - if(!comparer.Equals(WhenHandedOverElement, otherT.WhenHandedOverElement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(UsageInstructionElement, otherT.UsageInstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_OriginRelationshipType, otherT._OriginRelationshipType)) return false; + if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_MatchStatus, otherT._MatchStatus)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_PreparedDateElement, otherT._PreparedDateElement)) return false; + if(!comparer.Equals(_WhenHandedOverElement, otherT._WhenHandedOverElement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_UsageInstructionElement, otherT._UsageInstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "originRelationshipType": - value = OriginRelationshipType; - return OriginRelationshipType is not null; + value = _OriginRelationshipType; + return _OriginRelationshipType is not null; case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "matchStatus": - value = MatchStatus; - return MatchStatus is not null; + value = _MatchStatus; + return _MatchStatus is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "preparedDate": - value = PreparedDateElement; - return PreparedDateElement is not null; + value = _PreparedDateElement; + return _PreparedDateElement is not null; case "whenHandedOver": - value = WhenHandedOverElement; - return WhenHandedOverElement is not null; + value = _WhenHandedOverElement; + return _WhenHandedOverElement is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "usageInstruction": - value = UsageInstructionElement; - return UsageInstructionElement is not null; + value = _UsageInstructionElement; + return _UsageInstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "originRelationshipType": - OriginRelationshipType = (Hl7.Fhir.Model.CodeableConcept)value; + OriginRelationshipType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "product": - Product = (Hl7.Fhir.Model.ResourceReference)value; + Product = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "matchStatus": - MatchStatus = (Hl7.Fhir.Model.CodeableConcept)value; + MatchStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "preparedDate": - PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "whenHandedOver": - WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "usageInstruction": - UsageInstructionElement = (Hl7.Fhir.Model.FhirString)value; + UsageInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -720,22 +703,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (OriginRelationshipType is not null) yield return new KeyValuePair("originRelationshipType",OriginRelationshipType); - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (MatchStatus is not null) yield return new KeyValuePair("matchStatus",MatchStatus); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (PreparedDateElement is not null) yield return new KeyValuePair("preparedDate",PreparedDateElement); - if (WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",WhenHandedOverElement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UsageInstructionElement is not null) yield return new KeyValuePair("usageInstruction",UsageInstructionElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_OriginRelationshipType is not null) yield return new KeyValuePair("originRelationshipType",_OriginRelationshipType); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_MatchStatus is not null) yield return new KeyValuePair("matchStatus",_MatchStatus); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_PreparedDateElement is not null) yield return new KeyValuePair("preparedDate",_PreparedDateElement); + if (_WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",_WhenHandedOverElement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UsageInstructionElement is not null) yield return new KeyValuePair("usageInstruction",_UsageInstructionElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs index c0fadfa8a..6e130b7ab 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,13 +85,13 @@ public partial class IncludedStructureComponent : Hl7.Fhir.Model.BackboneElement [Binding("BodySite")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Structure + public Hl7.Fhir.Model.CodeableConcept? Structure { get { return _Structure; } set { _Structure = value; OnPropertyChanged("Structure"); } } - private Hl7.Fhir.Model.CodeableConcept _Structure; + private Hl7.Fhir.Model.CodeableConcept? _Structure; /// /// Code that represents the included structure laterality. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Structure [FhirElement("laterality", Order=50, FiveWs="FiveWs.what[x]")] [Binding("BodyStructureQualifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Laterality + public Hl7.Fhir.Model.CodeableConcept? Laterality { get { return _Laterality; } set { _Laterality = value; OnPropertyChanged("Laterality"); } } - private Hl7.Fhir.Model.CodeableConcept _Laterality; + private Hl7.Fhir.Model.CodeableConcept? _Laterality; /// /// Landmark relative location. @@ -112,11 +115,11 @@ public Hl7.Fhir.Model.CodeableConcept Laterality [DataMember] public List BodyLandmarkOrientation { - get { if(_BodyLandmarkOrientation==null) _BodyLandmarkOrientation = new List(); return _BodyLandmarkOrientation; } + get => _BodyLandmarkOrientation ?? new List(); set { _BodyLandmarkOrientation = value; OnPropertyChanged("BodyLandmarkOrientation"); } } - private List _BodyLandmarkOrientation; + private List? _BodyLandmarkOrientation; /// /// Cartesian reference for structure. @@ -128,11 +131,11 @@ public List BodyL [DataMember] public List SpatialReference { - get { if(_SpatialReference==null) _SpatialReference = new List(); return _SpatialReference; } + get => _SpatialReference ?? new List(); set { _SpatialReference = value; OnPropertyChanged("SpatialReference"); } } - private List _SpatialReference; + private List? _SpatialReference; /// /// Code that represents the included structure qualifier. @@ -143,27 +146,23 @@ public List SpatialReference [DataMember] public List Qualifier { - get { if(_Qualifier==null) _Qualifier = new List(); return _Qualifier; } + get => _Qualifier ?? new List(); set { _Qualifier = value; OnPropertyChanged("Qualifier"); } } - private List _Qualifier; + private List? _Qualifier; protected internal override void CopyToInternal(Base other) { - var dest = other as IncludedStructureComponent; - - if (dest == null) - { + if(other is not IncludedStructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Structure != null) dest.Structure = (Hl7.Fhir.Model.CodeableConcept)Structure.DeepCopyInternal(); - if(Laterality != null) dest.Laterality = (Hl7.Fhir.Model.CodeableConcept)Laterality.DeepCopyInternal(); - if(BodyLandmarkOrientation.Any()) dest.BodyLandmarkOrientation = new List(BodyLandmarkOrientation.DeepCopyInternal()); - if(SpatialReference.Any()) dest.SpatialReference = new List(SpatialReference.DeepCopyInternal()); - if(Qualifier.Any()) dest.Qualifier = new List(Qualifier.DeepCopyInternal()); + if(_Structure is not null) dest.Structure = (Hl7.Fhir.Model.CodeableConcept)_Structure.DeepCopyInternal(); + if(_Laterality is not null) dest.Laterality = (Hl7.Fhir.Model.CodeableConcept)_Laterality.DeepCopyInternal(); + if(_BodyLandmarkOrientation is not null) dest.BodyLandmarkOrientation = new List(_BodyLandmarkOrientation.DeepCopyInternal()); + if(_SpatialReference is not null) dest.SpatialReference = new List(_SpatialReference.DeepCopyInternal()); + if(_Qualifier is not null) dest.Qualifier = new List(_Qualifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -175,62 +174,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IncludedStructureComponent; - if(otherT == null) return false; + if(other is not IncludedStructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Structure, otherT.Structure)) return false; - if(!comparer.Equals(Laterality, otherT.Laterality)) return false; - if(!comparer.ListEquals(BodyLandmarkOrientation, otherT.BodyLandmarkOrientation)) return false; - if(!comparer.ListEquals(SpatialReference, otherT.SpatialReference)) return false; - if(!comparer.ListEquals(Qualifier, otherT.Qualifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Structure, otherT._Structure)) return false; + if(!comparer.Equals(_Laterality, otherT._Laterality)) return false; + if(!comparer.ListEquals(_BodyLandmarkOrientation, otherT._BodyLandmarkOrientation)) return false; + if(!comparer.ListEquals(_SpatialReference, otherT._SpatialReference)) return false; + if(!comparer.ListEquals(_Qualifier, otherT._Qualifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "structure": - value = Structure; - return Structure is not null; + value = _Structure; + return _Structure is not null; case "laterality": - value = Laterality; - return Laterality is not null; + value = _Laterality; + return _Laterality is not null; case "bodyLandmarkOrientation": - value = BodyLandmarkOrientation; - return BodyLandmarkOrientation?.Any() == true; + value = _BodyLandmarkOrientation; + return _BodyLandmarkOrientation?.Any() == true; case "spatialReference": - value = SpatialReference; - return SpatialReference?.Any() == true; + value = _SpatialReference; + return _SpatialReference?.Any() == true; case "qualifier": - value = Qualifier; - return Qualifier?.Any() == true; + value = _Qualifier; + return _Qualifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "structure": - Structure = (Hl7.Fhir.Model.CodeableConcept)value; + Structure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "laterality": - Laterality = (Hl7.Fhir.Model.CodeableConcept)value; + Laterality = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodyLandmarkOrientation": - BodyLandmarkOrientation = (List)value; + BodyLandmarkOrientation = (List?)value!; return this; case "spatialReference": - SpatialReference = (List)value; + SpatialReference = (List?)value!; return this; case "qualifier": - Qualifier = (List)value; + Qualifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -241,11 +240,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Structure is not null) yield return new KeyValuePair("structure",Structure); - if (Laterality is not null) yield return new KeyValuePair("laterality",Laterality); - if (BodyLandmarkOrientation?.Any() == true) yield return new KeyValuePair("bodyLandmarkOrientation",BodyLandmarkOrientation); - if (SpatialReference?.Any() == true) yield return new KeyValuePair("spatialReference",SpatialReference); - if (Qualifier?.Any() == true) yield return new KeyValuePair("qualifier",Qualifier); + if (_Structure is not null) yield return new KeyValuePair("structure",_Structure); + if (_Laterality is not null) yield return new KeyValuePair("laterality",_Laterality); + if (_BodyLandmarkOrientation?.Any() == true) yield return new KeyValuePair("bodyLandmarkOrientation",_BodyLandmarkOrientation); + if (_SpatialReference?.Any() == true) yield return new KeyValuePair("spatialReference",_SpatialReference); + if (_Qualifier?.Any() == true) yield return new KeyValuePair("qualifier",_Qualifier); } } @@ -275,11 +274,11 @@ public partial class BodyLandmarkOrientationComponent : Hl7.Fhir.Model.BackboneE [DataMember] public List LandmarkDescription { - get { if(_LandmarkDescription==null) _LandmarkDescription = new List(); return _LandmarkDescription; } + get => _LandmarkDescription ?? new List(); set { _LandmarkDescription = value; OnPropertyChanged("LandmarkDescription"); } } - private List _LandmarkDescription; + private List? _LandmarkDescription; /// /// Clockface orientation. @@ -290,11 +289,11 @@ public List LandmarkDescription [DataMember] public List ClockFacePosition { - get { if(_ClockFacePosition==null) _ClockFacePosition = new List(); return _ClockFacePosition; } + get => _ClockFacePosition ?? new List(); set { _ClockFacePosition = value; OnPropertyChanged("ClockFacePosition"); } } - private List _ClockFacePosition; + private List? _ClockFacePosition; /// /// Landmark relative location. @@ -304,11 +303,11 @@ public List ClockFacePosition [DataMember] public List DistanceFromLandmark { - get { if(_DistanceFromLandmark==null) _DistanceFromLandmark = new List(); return _DistanceFromLandmark; } + get => _DistanceFromLandmark ?? new List(); set { _DistanceFromLandmark = value; OnPropertyChanged("DistanceFromLandmark"); } } - private List _DistanceFromLandmark; + private List? _DistanceFromLandmark; /// /// Relative landmark surface orientation. @@ -319,26 +318,22 @@ public List Distance [DataMember] public List SurfaceOrientation { - get { if(_SurfaceOrientation==null) _SurfaceOrientation = new List(); return _SurfaceOrientation; } + get => _SurfaceOrientation ?? new List(); set { _SurfaceOrientation = value; OnPropertyChanged("SurfaceOrientation"); } } - private List _SurfaceOrientation; + private List? _SurfaceOrientation; protected internal override void CopyToInternal(Base other) { - var dest = other as BodyLandmarkOrientationComponent; - - if (dest == null) - { + if(other is not BodyLandmarkOrientationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LandmarkDescription.Any()) dest.LandmarkDescription = new List(LandmarkDescription.DeepCopyInternal()); - if(ClockFacePosition.Any()) dest.ClockFacePosition = new List(ClockFacePosition.DeepCopyInternal()); - if(DistanceFromLandmark.Any()) dest.DistanceFromLandmark = new List(DistanceFromLandmark.DeepCopyInternal()); - if(SurfaceOrientation.Any()) dest.SurfaceOrientation = new List(SurfaceOrientation.DeepCopyInternal()); + if(_LandmarkDescription is not null) dest.LandmarkDescription = new List(_LandmarkDescription.DeepCopyInternal()); + if(_ClockFacePosition is not null) dest.ClockFacePosition = new List(_ClockFacePosition.DeepCopyInternal()); + if(_DistanceFromLandmark is not null) dest.DistanceFromLandmark = new List(_DistanceFromLandmark.DeepCopyInternal()); + if(_SurfaceOrientation is not null) dest.SurfaceOrientation = new List(_SurfaceOrientation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -350,55 +345,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BodyLandmarkOrientationComponent; - if(otherT == null) return false; + if(other is not BodyLandmarkOrientationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(LandmarkDescription, otherT.LandmarkDescription)) return false; - if(!comparer.ListEquals(ClockFacePosition, otherT.ClockFacePosition)) return false; - if(!comparer.ListEquals(DistanceFromLandmark, otherT.DistanceFromLandmark)) return false; - if(!comparer.ListEquals(SurfaceOrientation, otherT.SurfaceOrientation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_LandmarkDescription, otherT._LandmarkDescription)) return false; + if(!comparer.ListEquals(_ClockFacePosition, otherT._ClockFacePosition)) return false; + if(!comparer.ListEquals(_DistanceFromLandmark, otherT._DistanceFromLandmark)) return false; + if(!comparer.ListEquals(_SurfaceOrientation, otherT._SurfaceOrientation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "landmarkDescription": - value = LandmarkDescription; - return LandmarkDescription?.Any() == true; + value = _LandmarkDescription; + return _LandmarkDescription?.Any() == true; case "clockFacePosition": - value = ClockFacePosition; - return ClockFacePosition?.Any() == true; + value = _ClockFacePosition; + return _ClockFacePosition?.Any() == true; case "distanceFromLandmark": - value = DistanceFromLandmark; - return DistanceFromLandmark?.Any() == true; + value = _DistanceFromLandmark; + return _DistanceFromLandmark?.Any() == true; case "surfaceOrientation": - value = SurfaceOrientation; - return SurfaceOrientation?.Any() == true; + value = _SurfaceOrientation; + return _SurfaceOrientation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "landmarkDescription": - LandmarkDescription = (List)value; + LandmarkDescription = (List?)value!; return this; case "clockFacePosition": - ClockFacePosition = (List)value; + ClockFacePosition = (List?)value!; return this; case "distanceFromLandmark": - DistanceFromLandmark = (List)value; + DistanceFromLandmark = (List?)value!; return this; case "surfaceOrientation": - SurfaceOrientation = (List)value; + SurfaceOrientation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -409,10 +404,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LandmarkDescription?.Any() == true) yield return new KeyValuePair("landmarkDescription",LandmarkDescription); - if (ClockFacePosition?.Any() == true) yield return new KeyValuePair("clockFacePosition",ClockFacePosition); - if (DistanceFromLandmark?.Any() == true) yield return new KeyValuePair("distanceFromLandmark",DistanceFromLandmark); - if (SurfaceOrientation?.Any() == true) yield return new KeyValuePair("surfaceOrientation",SurfaceOrientation); + if (_LandmarkDescription?.Any() == true) yield return new KeyValuePair("landmarkDescription",_LandmarkDescription); + if (_ClockFacePosition?.Any() == true) yield return new KeyValuePair("clockFacePosition",_ClockFacePosition); + if (_DistanceFromLandmark?.Any() == true) yield return new KeyValuePair("distanceFromLandmark",_DistanceFromLandmark); + if (_SurfaceOrientation?.Any() == true) yield return new KeyValuePair("surfaceOrientation",_SurfaceOrientation); } } @@ -442,11 +437,11 @@ public partial class DistanceFromLandmarkComponent : Hl7.Fhir.Model.BackboneElem [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// Measured distance from body landmark. @@ -456,24 +451,20 @@ public List Device [DataMember] public List Value { - get { if(_Value==null) _Value = new List(); return _Value; } + get => _Value ?? new List(); set { _Value = value; OnPropertyChanged("Value"); } } - private List _Value; + private List? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DistanceFromLandmarkComponent; - - if (dest == null) - { + if(other is not DistanceFromLandmarkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(Value.Any()) dest.Value = new List(Value.DeepCopyInternal()); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_Value is not null) dest.Value = new List(_Value.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -485,41 +476,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DistanceFromLandmarkComponent; - if(otherT == null) return false; + if(other is not DistanceFromLandmarkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "value": - value = Value; - return Value?.Any() == true; + value = _Value; + return _Value?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "device": - Device = (List)value; + Device = (List?)value!; return this; case "value": - Value = (List)value; + Value = (List?)value!; return this; default: return base.SetValue(key, value); @@ -530,8 +521,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (Value?.Any() == true) yield return new KeyValuePair("value",Value); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_Value?.Any() == true) yield return new KeyValuePair("value",_Value); } } @@ -544,24 +535,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this record is in active use @@ -570,13 +561,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -587,13 +575,13 @@ public bool? Active [FhirElement("morphology", InSummary=true, Order=110, FiveWs="FiveWs.what[x]")] [Binding("BodyStructureCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Morphology + public Hl7.Fhir.Model.CodeableConcept? Morphology { get { return _Morphology; } set { _Morphology = value; OnPropertyChanged("Morphology"); } } - private Hl7.Fhir.Model.CodeableConcept _Morphology; + private Hl7.Fhir.Model.CodeableConcept? _Morphology; /// /// Included anatomic location(s). @@ -603,11 +591,11 @@ public Hl7.Fhir.Model.CodeableConcept Morphology [DataMember] public List IncludedStructure { - get { if(_IncludedStructure==null) _IncludedStructure = new List(); return _IncludedStructure; } + get => _IncludedStructure ?? new List(); set { _IncludedStructure = value; OnPropertyChanged("IncludedStructure"); } } - private List _IncludedStructure; + private List? _IncludedStructure; /// /// Excluded anatomic locations(s). @@ -617,39 +605,36 @@ public List IncludedStr [DataMember] public List ExcludedStructure { - get { if(_ExcludedStructure==null) _ExcludedStructure = new List(); return _ExcludedStructure; } + get => _ExcludedStructure ?? new List(); set { _ExcludedStructure = value; OnPropertyChanged("ExcludedStructure"); } } - private List _ExcludedStructure; + private List? _ExcludedStructure; /// /// Text description. /// [FhirElement("description", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Text description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -662,11 +647,11 @@ public string Description [DataMember] public List Image { - get { if(_Image==null) _Image = new List(); return _Image; } + get => _Image ?? new List(); set { _Image = value; OnPropertyChanged("Image"); } } - private List _Image; + private List? _Image; /// /// Who this is about. @@ -676,34 +661,30 @@ public List Image [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as BodyStructure; - - if (dest == null) - { + if(other is not BodyStructure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Morphology != null) dest.Morphology = (Hl7.Fhir.Model.CodeableConcept)Morphology.DeepCopyInternal(); - if(IncludedStructure.Any()) dest.IncludedStructure = new List(IncludedStructure.DeepCopyInternal()); - if(ExcludedStructure.Any()) dest.ExcludedStructure = new List(ExcludedStructure.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Image.Any()) dest.Image = new List(Image.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Morphology is not null) dest.Morphology = (Hl7.Fhir.Model.CodeableConcept)_Morphology.DeepCopyInternal(); + if(_IncludedStructure is not null) dest.IncludedStructure = new List(_IncludedStructure.DeepCopyInternal()); + if(_ExcludedStructure is not null) dest.ExcludedStructure = new List(_ExcludedStructure.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Image is not null) dest.Image = new List(_Image.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -715,83 +696,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BodyStructure; - if(otherT == null) return false; + if(other is not BodyStructure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Morphology, otherT.Morphology)) return false; - if(!comparer.ListEquals(IncludedStructure, otherT.IncludedStructure)) return false; - if(!comparer.ListEquals(ExcludedStructure, otherT.ExcludedStructure)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Image, otherT.Image)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Morphology, otherT._Morphology)) return false; + if(!comparer.ListEquals(_IncludedStructure, otherT._IncludedStructure)) return false; + if(!comparer.ListEquals(_ExcludedStructure, otherT._ExcludedStructure)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Image, otherT._Image)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "morphology": - value = Morphology; - return Morphology is not null; + value = _Morphology; + return _Morphology is not null; case "includedStructure": - value = IncludedStructure; - return IncludedStructure?.Any() == true; + value = _IncludedStructure; + return _IncludedStructure?.Any() == true; case "excludedStructure": - value = ExcludedStructure; - return ExcludedStructure?.Any() == true; + value = _ExcludedStructure; + return _ExcludedStructure?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "image": - value = Image; - return Image?.Any() == true; + value = _Image; + return _Image?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "morphology": - Morphology = (Hl7.Fhir.Model.CodeableConcept)value; + Morphology = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "includedStructure": - IncludedStructure = (List)value; + IncludedStructure = (List?)value!; return this; case "excludedStructure": - ExcludedStructure = (List)value; + ExcludedStructure = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "image": - Image = (List)value; + Image = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -802,14 +783,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Morphology is not null) yield return new KeyValuePair("morphology",Morphology); - if (IncludedStructure?.Any() == true) yield return new KeyValuePair("includedStructure",IncludedStructure); - if (ExcludedStructure?.Any() == true) yield return new KeyValuePair("excludedStructure",ExcludedStructure); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Image?.Any() == true) yield return new KeyValuePair("image",Image); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Morphology is not null) yield return new KeyValuePair("morphology",_Morphology); + if (_IncludedStructure?.Any() == true) yield return new KeyValuePair("includedStructure",_IncludedStructure); + if (_ExcludedStructure?.Any() == true) yield return new KeyValuePair("excludedStructure",_ExcludedStructure); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Image?.Any() == true) yield return new KeyValuePair("image",_Image); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs index 488bf738b..47a1bc238 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -124,11 +127,11 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List PerformedActivity { - get { if(_PerformedActivity==null) _PerformedActivity = new List(); return _PerformedActivity; } + get => _PerformedActivity ?? new List(); set { _PerformedActivity = value; OnPropertyChanged("PerformedActivity"); } } - private List _PerformedActivity; + private List? _PerformedActivity; /// /// Comments about the activity status/progress. @@ -138,11 +141,11 @@ public List PerformedActivity [DataMember] public List Progress { - get { if(_Progress==null) _Progress = new List(); return _Progress; } + get => _Progress ?? new List(); set { _Progress = value; OnPropertyChanged("Progress"); } } - private List _Progress; + private List? _Progress; /// /// Activity that is intended to be part of the care plan. @@ -151,27 +154,23 @@ public List Progress [CLSCompliant(false)] [References("Appointment","CommunicationRequest","DeviceRequest","MedicationRequest","NutritionOrder","Task","ServiceRequest","VisionPrescription","RequestOrchestration","ImmunizationRecommendation","SupplyRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PlannedActivityReference + public Hl7.Fhir.Model.ResourceReference? PlannedActivityReference { get { return _PlannedActivityReference; } set { _PlannedActivityReference = value; OnPropertyChanged("PlannedActivityReference"); } } - private Hl7.Fhir.Model.ResourceReference _PlannedActivityReference; + private Hl7.Fhir.Model.ResourceReference? _PlannedActivityReference; protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityComponent; - - if (dest == null) - { + if(other is not ActivityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PerformedActivity.Any()) dest.PerformedActivity = new List(PerformedActivity.DeepCopyInternal()); - if(Progress.Any()) dest.Progress = new List(Progress.DeepCopyInternal()); - if(PlannedActivityReference != null) dest.PlannedActivityReference = (Hl7.Fhir.Model.ResourceReference)PlannedActivityReference.DeepCopyInternal(); + if(_PerformedActivity is not null) dest.PerformedActivity = new List(_PerformedActivity.DeepCopyInternal()); + if(_Progress is not null) dest.Progress = new List(_Progress.DeepCopyInternal()); + if(_PlannedActivityReference is not null) dest.PlannedActivityReference = (Hl7.Fhir.Model.ResourceReference)_PlannedActivityReference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -183,48 +182,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityComponent; - if(otherT == null) return false; + if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(PerformedActivity, otherT.PerformedActivity)) return false; - if(!comparer.ListEquals(Progress, otherT.Progress)) return false; - if(!comparer.Equals(PlannedActivityReference, otherT.PlannedActivityReference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_PerformedActivity, otherT._PerformedActivity)) return false; + if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; + if(!comparer.Equals(_PlannedActivityReference, otherT._PlannedActivityReference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "performedActivity": - value = PerformedActivity; - return PerformedActivity?.Any() == true; + value = _PerformedActivity; + return _PerformedActivity?.Any() == true; case "progress": - value = Progress; - return Progress?.Any() == true; + value = _Progress; + return _Progress?.Any() == true; case "plannedActivityReference": - value = PlannedActivityReference; - return PlannedActivityReference is not null; + value = _PlannedActivityReference; + return _PlannedActivityReference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "performedActivity": - PerformedActivity = (List)value; + PerformedActivity = (List?)value!; return this; case "progress": - Progress = (List)value; + Progress = (List?)value!; return this; case "plannedActivityReference": - PlannedActivityReference = (Hl7.Fhir.Model.ResourceReference)value; + PlannedActivityReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -235,9 +234,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PerformedActivity?.Any() == true) yield return new KeyValuePair("performedActivity",PerformedActivity); - if (Progress?.Any() == true) yield return new KeyValuePair("progress",Progress); - if (PlannedActivityReference is not null) yield return new KeyValuePair("plannedActivityReference",PlannedActivityReference); + if (_PerformedActivity?.Any() == true) yield return new KeyValuePair("performedActivity",_PerformedActivity); + if (_Progress?.Any() == true) yield return new KeyValuePair("progress",_Progress); + if (_PlannedActivityReference is not null) yield return new KeyValuePair("plannedActivityReference",_PlannedActivityReference); } } @@ -250,11 +249,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -264,24 +263,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -296,24 +295,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -330,11 +329,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// CarePlan replaced by this CarePlan. @@ -346,11 +345,11 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Part of referenced CarePlan. @@ -362,11 +361,11 @@ public List Replaces [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -376,13 +375,13 @@ public List PartOf [Binding("CarePlanStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -391,13 +390,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -410,13 +406,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("CarePlanIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | option | directive @@ -425,13 +421,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -445,39 +438,36 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Human-friendly name for the care plan. /// [FhirElement("title", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human-friendly name for the care plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -487,28 +477,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=190, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Summary of nature of plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -521,13 +508,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The Encounter during which this CarePlan was created. @@ -536,54 +523,51 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time period plan covers. /// [FhirElement("period", InSummary=true, Order=220, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Date record was first recorded. /// [FhirElement("created", InSummary=true, Order=230, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Date record was first recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -595,13 +579,13 @@ public string Created [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Device","RelatedPerson","Organization","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Who provided the content of the care plan. @@ -613,11 +597,11 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List Contributor { - get { if(_Contributor==null) _Contributor = new List(); return _Contributor; } + get => _Contributor ?? new List(); set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private List _Contributor; + private List? _Contributor; /// /// Who's involved in plan?. @@ -629,11 +613,11 @@ public List Contributor [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Health issues this plan addresses. @@ -644,11 +628,11 @@ public List CareTeam [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Information considered as part of plan. @@ -660,11 +644,11 @@ public List Addresses [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Desired outcome of plan. @@ -676,11 +660,11 @@ public List SupportingInfo [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Action to occur or has occurred as part of plan. @@ -690,11 +674,11 @@ public List Goal [DataMember] public List Activity { - get { if(_Activity==null) _Activity = new List(); return _Activity; } + get => _Activity ?? new List(); set { _Activity = value; OnPropertyChanged("Activity"); } } - private List _Activity; + private List? _Activity; /// /// Comments about the plan. @@ -704,47 +688,43 @@ public List Activity [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CarePlan; - - if (dest == null) - { + if(other is not CarePlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(Contributor.Any()) dest.Contributor = new List(Contributor.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Activity.Any()) dest.Activity = new List(Activity.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_Contributor is not null) dest.Contributor = new List(_Contributor.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = new List(_Activity.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -756,188 +736,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CarePlan; - if(otherT == null) return false; + if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(Contributor, otherT.Contributor)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_Contributor, otherT._Contributor)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "contributor": - value = Contributor; - return Contributor?.Any() == true; + value = _Contributor; + return _Contributor?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "activity": - value = Activity; - return Activity?.Any() == true; + value = _Activity; + return _Activity?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contributor": - Contributor = (List)value; + Contributor = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "activity": - Activity = (List)value; + Activity = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -948,29 +928,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (Contributor?.Any() == true) yield return new KeyValuePair("contributor",Contributor); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Activity?.Any() == true) yield return new KeyValuePair("activity",Activity); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_Contributor?.Any() == true) yield return new KeyValuePair("contributor",_Contributor); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Activity?.Any() == true) yield return new KeyValuePair("activity",_Activity); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs index 2dc0056cd..14b2b59ab 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,13 +124,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("role", InSummary=true, Order=40)] [Binding("CareTeamParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Who is involved. @@ -136,13 +139,13 @@ public Hl7.Fhir.Model.CodeableConcept Role [CLSCompliant(false)] [References("Practitioner","PractitionerRole","RelatedPerson","Patient","Organization","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Member + public Hl7.Fhir.Model.ResourceReference? Member { get { return _Member; } set { _Member = value; OnPropertyChanged("Member"); } } - private Hl7.Fhir.Model.ResourceReference _Member; + private Hl7.Fhir.Model.ResourceReference? _Member; /// /// Organization of the practitioner. @@ -151,13 +154,13 @@ public Hl7.Fhir.Model.ResourceReference Member [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// When the member is generally available within this care team. @@ -166,28 +169,24 @@ public Hl7.Fhir.Model.ResourceReference OnBehalfOf [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Coverage + public Hl7.Fhir.Model.DataType? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.DataType _Coverage; + private Hl7.Fhir.Model.DataType? _Coverage; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Member != null) dest.Member = (Hl7.Fhir.Model.ResourceReference)Member.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.DataType)Coverage.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Member is not null) dest.Member = (Hl7.Fhir.Model.ResourceReference)_Member.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.DataType)_Coverage.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -199,55 +198,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Member, otherT.Member)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Member, otherT._Member)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "member": - value = Member; - return Member is not null; + value = _Member; + return _Member is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "member": - Member = (Hl7.Fhir.Model.ResourceReference)value; + Member = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.DataType)value; + Coverage = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -258,10 +257,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Member is not null) yield return new KeyValuePair("member",Member); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Member is not null) yield return new KeyValuePair("member",_Member); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); } } @@ -274,11 +273,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | active | suspended | inactive | entered-in-error. @@ -287,13 +286,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("CareTeamStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// proposed | active | suspended | inactive | entered-in-error @@ -302,13 +301,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -322,39 +318,36 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Name of the team, such as crisis assessment team. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the team, such as crisis assessment team /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -366,26 +359,26 @@ public string Name [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Time period team covers. /// [FhirElement("period", InSummary=true, Order=140, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Members of the team. @@ -395,11 +388,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Why the care team exists. @@ -410,11 +403,11 @@ public List Participant [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Organization responsible for the care team. @@ -426,11 +419,11 @@ public List Reason [DataMember] public List ManagingOrganization { - get { if(_ManagingOrganization==null) _ManagingOrganization = new List(); return _ManagingOrganization; } + get => _ManagingOrganization ?? new List(); set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private List _ManagingOrganization; + private List? _ManagingOrganization; /// /// A contact detail for the care team (that applies to all members). @@ -440,11 +433,11 @@ public List ManagingOrganization [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Comments made about the CareTeam. @@ -454,35 +447,31 @@ public List Telecom [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeam; - - if (dest == null) - { + if(other is not CareTeam dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(ManagingOrganization.Any()) dest.ManagingOrganization = new List(ManagingOrganization.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = new List(_ManagingOrganization.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -494,104 +483,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeam; - if(otherT == null) return false; + if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization?.Any() == true; + value = _ManagingOrganization; + return _ManagingOrganization?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (List)value; + ManagingOrganization = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -602,17 +591,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_ManagingOrganization?.Any() == true) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs index cab0fff35..38ffe11ef 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,13 +136,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("ChargeItemPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual who was performing. @@ -149,26 +152,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","HealthcareService","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,41 +179,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -225,8 +224,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -239,11 +238,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Defining information about the code of this charge item. @@ -253,24 +252,24 @@ public List Identifier [DataMember] public List DefinitionUriElement { - get { if(_DefinitionUriElement==null) _DefinitionUriElement = new List(); return _DefinitionUriElement; } + get => _DefinitionUriElement ?? new List(); set { _DefinitionUriElement = value; OnPropertyChanged("DefinitionUriElement"); } } - private List _DefinitionUriElement; + private List? _DefinitionUriElement; /// /// Defining information about the code of this charge item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DefinitionUri + public IEnumerable? DefinitionUri { - get { return DefinitionUriElement != null ? DefinitionUriElement.Select(elem => elem.Value) : null; } + get => _DefinitionUriElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionUriElement = null; + DefinitionUriElement = null!; else DefinitionUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DefinitionUri"); @@ -285,24 +284,24 @@ public IEnumerable DefinitionUri [DataMember] public List DefinitionCanonicalElement { - get { if(_DefinitionCanonicalElement==null) _DefinitionCanonicalElement = new List(); return _DefinitionCanonicalElement; } + get => _DefinitionCanonicalElement ?? new List(); set { _DefinitionCanonicalElement = value; OnPropertyChanged("DefinitionCanonicalElement"); } } - private List _DefinitionCanonicalElement; + private List? _DefinitionCanonicalElement; /// /// Resource defining the code of this ChargeItem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DefinitionCanonical + public IEnumerable? DefinitionCanonical { - get { return DefinitionCanonicalElement != null ? DefinitionCanonicalElement.Select(elem => elem.Value) : null; } + get => _DefinitionCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionCanonicalElement = null; + DefinitionCanonicalElement = null!; else DefinitionCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DefinitionCanonical"); @@ -317,13 +316,13 @@ public IEnumerable DefinitionCanonical [Binding("ChargeItemStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | billable | not-billable | aborted | billed | entered-in-error | unknown @@ -332,13 +331,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -353,11 +349,11 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// A code that identifies the charge, like a billing code. @@ -366,13 +362,13 @@ public List PartOf [Binding("ChargeItemCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Individual service was done for/to. @@ -382,13 +378,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter associated with this ChargeItem. @@ -397,13 +393,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the charged service was applied. @@ -412,13 +408,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Who performed charged service. @@ -428,11 +424,11 @@ public Hl7.Fhir.Model.DataType Occurrence [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Organization providing the charged service. @@ -441,13 +437,13 @@ public List Performer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PerformingOrganization + public Hl7.Fhir.Model.ResourceReference? PerformingOrganization { get { return _PerformingOrganization; } set { _PerformingOrganization = value; OnPropertyChanged("PerformingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _PerformingOrganization; + private Hl7.Fhir.Model.ResourceReference? _PerformingOrganization; /// /// Organization requesting the charged service. @@ -456,13 +452,13 @@ public Hl7.Fhir.Model.ResourceReference PerformingOrganization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestingOrganization + public Hl7.Fhir.Model.ResourceReference? RequestingOrganization { get { return _RequestingOrganization; } set { _RequestingOrganization = value; OnPropertyChanged("RequestingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _RequestingOrganization; + private Hl7.Fhir.Model.ResourceReference? _RequestingOrganization; /// /// Organization that has ownership of the (potential, future) revenue. @@ -471,26 +467,26 @@ public Hl7.Fhir.Model.ResourceReference RequestingOrganization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CostCenter + public Hl7.Fhir.Model.ResourceReference? CostCenter { get { return _CostCenter; } set { _CostCenter = value; OnPropertyChanged("CostCenter"); } } - private Hl7.Fhir.Model.ResourceReference _CostCenter; + private Hl7.Fhir.Model.ResourceReference? _CostCenter; /// /// Quantity of which the charge item has been serviced. /// [FhirElement("quantity", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Anatomical location, if relevant. @@ -501,37 +497,37 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Bodysite { - get { if(_Bodysite==null) _Bodysite = new List(); return _Bodysite; } + get => _Bodysite ?? new List(); set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } - private List _Bodysite; + private List? _Bodysite; /// /// Unit price overriding the associated rules. /// [FhirElement("unitPriceComponent", Order=240)] [DataMember] - public Hl7.Fhir.Model.MonetaryComponent UnitPriceComponent + public Hl7.Fhir.Model.MonetaryComponent? UnitPriceComponent { get { return _UnitPriceComponent; } set { _UnitPriceComponent = value; OnPropertyChanged("UnitPriceComponent"); } } - private Hl7.Fhir.Model.MonetaryComponent _UnitPriceComponent; + private Hl7.Fhir.Model.MonetaryComponent? _UnitPriceComponent; /// /// Total price overriding the associated rules. /// [FhirElement("totalPriceComponent", Order=250)] [DataMember] - public Hl7.Fhir.Model.MonetaryComponent TotalPriceComponent + public Hl7.Fhir.Model.MonetaryComponent? TotalPriceComponent { get { return _TotalPriceComponent; } set { _TotalPriceComponent = value; OnPropertyChanged("TotalPriceComponent"); } } - private Hl7.Fhir.Model.MonetaryComponent _TotalPriceComponent; + private Hl7.Fhir.Model.MonetaryComponent? _TotalPriceComponent; /// /// Reason for overriding the list price/factor. @@ -539,13 +535,13 @@ public Hl7.Fhir.Model.MonetaryComponent TotalPriceComponent [FhirElement("overrideReason", Order=260)] [Binding("override-reason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OverrideReason + public Hl7.Fhir.Model.CodeableConcept? OverrideReason { get { return _OverrideReason; } set { _OverrideReason = value; OnPropertyChanged("OverrideReason"); } } - private Hl7.Fhir.Model.CodeableConcept _OverrideReason; + private Hl7.Fhir.Model.CodeableConcept? _OverrideReason; /// /// Individual who was entering. @@ -554,41 +550,38 @@ public Hl7.Fhir.Model.CodeableConcept OverrideReason [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Date the charge item was entered. /// [FhirElement("enteredDate", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EnteredDateElement + public Hl7.Fhir.Model.FhirDateTime? EnteredDateElement { get { return _EnteredDateElement; } set { _EnteredDateElement = value; OnPropertyChanged("EnteredDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EnteredDateElement; + private Hl7.Fhir.Model.FhirDateTime? _EnteredDateElement; /// /// Date the charge item was entered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EnteredDate + public string? EnteredDate { - get { return EnteredDateElement != null ? EnteredDateElement.Value : null; } + get => _EnteredDateElement?.Value; set { - if (value == null) - EnteredDateElement = null; - else - EnteredDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + EnteredDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EnteredDate"); } } @@ -602,11 +595,11 @@ public string EnteredDate [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Which rendered service is being charged?. @@ -616,11 +609,11 @@ public List Reason [DataMember] public List Service { - get { if(_Service==null) _Service = new List(); return _Service; } + get => _Service ?? new List(); set { _Service = value; OnPropertyChanged("Service"); } } - private List _Service; + private List? _Service; /// /// Product charged. @@ -631,11 +624,11 @@ public List Service [DataMember] public List Product { - get { if(_Product==null) _Product = new List(); return _Product; } + get => _Product ?? new List(); set { _Product = value; OnPropertyChanged("Product"); } } - private List _Product; + private List? _Product; /// /// Account to place this charge. @@ -647,11 +640,11 @@ public List Product [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Comments made about the ChargeItem. @@ -661,11 +654,11 @@ public List Account [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Further information supporting this charge. @@ -677,50 +670,46 @@ public List Note [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItem; - - if (dest == null) - { + if(other is not ChargeItem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(DefinitionUriElement.Any()) dest.DefinitionUriElement = new List(DefinitionUriElement.DeepCopyInternal()); - if(DefinitionCanonicalElement.Any()) dest.DefinitionCanonicalElement = new List(DefinitionCanonicalElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(PerformingOrganization != null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)PerformingOrganization.DeepCopyInternal(); - if(RequestingOrganization != null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)RequestingOrganization.DeepCopyInternal(); - if(CostCenter != null) dest.CostCenter = (Hl7.Fhir.Model.ResourceReference)CostCenter.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Bodysite.Any()) dest.Bodysite = new List(Bodysite.DeepCopyInternal()); - if(UnitPriceComponent != null) dest.UnitPriceComponent = (Hl7.Fhir.Model.MonetaryComponent)UnitPriceComponent.DeepCopyInternal(); - if(TotalPriceComponent != null) dest.TotalPriceComponent = (Hl7.Fhir.Model.MonetaryComponent)TotalPriceComponent.DeepCopyInternal(); - if(OverrideReason != null) dest.OverrideReason = (Hl7.Fhir.Model.CodeableConcept)OverrideReason.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(EnteredDateElement != null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)EnteredDateElement.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Service.Any()) dest.Service = new List(Service.DeepCopyInternal()); - if(Product.Any()) dest.Product = new List(Product.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_DefinitionUriElement is not null) dest.DefinitionUriElement = new List(_DefinitionUriElement.DeepCopyInternal()); + if(_DefinitionCanonicalElement is not null) dest.DefinitionCanonicalElement = new List(_DefinitionCanonicalElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_PerformingOrganization is not null) dest.PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)_PerformingOrganization.DeepCopyInternal(); + if(_RequestingOrganization is not null) dest.RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)_RequestingOrganization.DeepCopyInternal(); + if(_CostCenter is not null) dest.CostCenter = (Hl7.Fhir.Model.ResourceReference)_CostCenter.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Bodysite is not null) dest.Bodysite = new List(_Bodysite.DeepCopyInternal()); + if(_UnitPriceComponent is not null) dest.UnitPriceComponent = (Hl7.Fhir.Model.MonetaryComponent)_UnitPriceComponent.DeepCopyInternal(); + if(_TotalPriceComponent is not null) dest.TotalPriceComponent = (Hl7.Fhir.Model.MonetaryComponent)_TotalPriceComponent.DeepCopyInternal(); + if(_OverrideReason is not null) dest.OverrideReason = (Hl7.Fhir.Model.CodeableConcept)_OverrideReason.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_EnteredDateElement is not null) dest.EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)_EnteredDateElement.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Service is not null) dest.Service = new List(_Service.DeepCopyInternal()); + if(_Product is not null) dest.Product = new List(_Product.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -732,209 +721,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItem; - if(otherT == null) return false; + if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(DefinitionUriElement, otherT.DefinitionUriElement)) return false; - if(!comparer.ListEquals(DefinitionCanonicalElement, otherT.DefinitionCanonicalElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(PerformingOrganization, otherT.PerformingOrganization)) return false; - if(!comparer.Equals(RequestingOrganization, otherT.RequestingOrganization)) return false; - if(!comparer.Equals(CostCenter, otherT.CostCenter)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Bodysite, otherT.Bodysite)) return false; - if(!comparer.Equals(UnitPriceComponent, otherT.UnitPriceComponent)) return false; - if(!comparer.Equals(TotalPriceComponent, otherT.TotalPriceComponent)) return false; - if(!comparer.Equals(OverrideReason, otherT.OverrideReason)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(EnteredDateElement, otherT.EnteredDateElement)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Service, otherT.Service)) return false; - if(!comparer.ListEquals(Product, otherT.Product)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_DefinitionUriElement, otherT._DefinitionUriElement)) return false; + if(!comparer.ListEquals(_DefinitionCanonicalElement, otherT._DefinitionCanonicalElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_PerformingOrganization, otherT._PerformingOrganization)) return false; + if(!comparer.Equals(_RequestingOrganization, otherT._RequestingOrganization)) return false; + if(!comparer.Equals(_CostCenter, otherT._CostCenter)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Bodysite, otherT._Bodysite)) return false; + if(!comparer.Equals(_UnitPriceComponent, otherT._UnitPriceComponent)) return false; + if(!comparer.Equals(_TotalPriceComponent, otherT._TotalPriceComponent)) return false; + if(!comparer.Equals(_OverrideReason, otherT._OverrideReason)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_EnteredDateElement, otherT._EnteredDateElement)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Service, otherT._Service)) return false; + if(!comparer.ListEquals(_Product, otherT._Product)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "definitionUri": - value = DefinitionUriElement; - return DefinitionUriElement?.Any() == true; + value = _DefinitionUriElement; + return _DefinitionUriElement?.Any() == true; case "definitionCanonical": - value = DefinitionCanonicalElement; - return DefinitionCanonicalElement?.Any() == true; + value = _DefinitionCanonicalElement; + return _DefinitionCanonicalElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "performingOrganization": - value = PerformingOrganization; - return PerformingOrganization is not null; + value = _PerformingOrganization; + return _PerformingOrganization is not null; case "requestingOrganization": - value = RequestingOrganization; - return RequestingOrganization is not null; + value = _RequestingOrganization; + return _RequestingOrganization is not null; case "costCenter": - value = CostCenter; - return CostCenter is not null; + value = _CostCenter; + return _CostCenter is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "bodysite": - value = Bodysite; - return Bodysite?.Any() == true; + value = _Bodysite; + return _Bodysite?.Any() == true; case "unitPriceComponent": - value = UnitPriceComponent; - return UnitPriceComponent is not null; + value = _UnitPriceComponent; + return _UnitPriceComponent is not null; case "totalPriceComponent": - value = TotalPriceComponent; - return TotalPriceComponent is not null; + value = _TotalPriceComponent; + return _TotalPriceComponent is not null; case "overrideReason": - value = OverrideReason; - return OverrideReason is not null; + value = _OverrideReason; + return _OverrideReason is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "enteredDate": - value = EnteredDateElement; - return EnteredDateElement is not null; + value = _EnteredDateElement; + return _EnteredDateElement is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "service": - value = Service; - return Service?.Any() == true; + value = _Service; + return _Service?.Any() == true; case "product": - value = Product; - return Product?.Any() == true; + value = _Product; + return _Product?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "definitionUri": - DefinitionUriElement = (List)value; + DefinitionUriElement = (List?)value!; return this; case "definitionCanonical": - DefinitionCanonicalElement = (List)value; + DefinitionCanonicalElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "performingOrganization": - PerformingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + PerformingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestingOrganization": - RequestingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + RequestingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "costCenter": - CostCenter = (Hl7.Fhir.Model.ResourceReference)value; + CostCenter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "bodysite": - Bodysite = (List)value; + Bodysite = (List?)value!; return this; case "unitPriceComponent": - UnitPriceComponent = (Hl7.Fhir.Model.MonetaryComponent)value; + UnitPriceComponent = (Hl7.Fhir.Model.MonetaryComponent?)value; return this; case "totalPriceComponent": - TotalPriceComponent = (Hl7.Fhir.Model.MonetaryComponent)value; + TotalPriceComponent = (Hl7.Fhir.Model.MonetaryComponent?)value; return this; case "overrideReason": - OverrideReason = (Hl7.Fhir.Model.CodeableConcept)value; + OverrideReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "enteredDate": - EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + EnteredDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "service": - Service = (List)value; + Service = (List?)value!; return this; case "product": - Product = (List)value; + Product = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -945,32 +934,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (DefinitionUriElement?.Any() == true) yield return new KeyValuePair("definitionUri",DefinitionUriElement); - if (DefinitionCanonicalElement?.Any() == true) yield return new KeyValuePair("definitionCanonical",DefinitionCanonicalElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",PerformingOrganization); - if (RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",RequestingOrganization); - if (CostCenter is not null) yield return new KeyValuePair("costCenter",CostCenter); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",Bodysite); - if (UnitPriceComponent is not null) yield return new KeyValuePair("unitPriceComponent",UnitPriceComponent); - if (TotalPriceComponent is not null) yield return new KeyValuePair("totalPriceComponent",TotalPriceComponent); - if (OverrideReason is not null) yield return new KeyValuePair("overrideReason",OverrideReason); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",EnteredDateElement); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Service?.Any() == true) yield return new KeyValuePair("service",Service); - if (Product?.Any() == true) yield return new KeyValuePair("product",Product); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_DefinitionUriElement?.Any() == true) yield return new KeyValuePair("definitionUri",_DefinitionUriElement); + if (_DefinitionCanonicalElement?.Any() == true) yield return new KeyValuePair("definitionCanonical",_DefinitionCanonicalElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_PerformingOrganization is not null) yield return new KeyValuePair("performingOrganization",_PerformingOrganization); + if (_RequestingOrganization is not null) yield return new KeyValuePair("requestingOrganization",_RequestingOrganization); + if (_CostCenter is not null) yield return new KeyValuePair("costCenter",_CostCenter); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Bodysite?.Any() == true) yield return new KeyValuePair("bodysite",_Bodysite); + if (_UnitPriceComponent is not null) yield return new KeyValuePair("unitPriceComponent",_UnitPriceComponent); + if (_TotalPriceComponent is not null) yield return new KeyValuePair("totalPriceComponent",_TotalPriceComponent); + if (_OverrideReason is not null) yield return new KeyValuePair("overrideReason",_OverrideReason); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_EnteredDateElement is not null) yield return new KeyValuePair("enteredDate",_EnteredDateElement); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Service?.Any() == true) yield return new KeyValuePair("service",_Service); + if (_Product?.Any() == true) yield return new KeyValuePair("product",_Product); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs index 89ba4b8a3..1e9d3ca29 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,53 +84,49 @@ public partial class ApplicabilityComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("condition", Order=40)] [DataMember] - public Hl7.Fhir.Model.Expression Condition + public Hl7.Fhir.Model.Expression? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.Expression _Condition; + private Hl7.Fhir.Model.Expression? _Condition; /// /// When the charge item definition is expected to be used. /// [FhirElement("effectivePeriod", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Reference to / quotation of the external source of the group of properties. /// [FhirElement("relatedArtifact", Order=60)] [DataMember] - public Hl7.Fhir.Model.RelatedArtifact RelatedArtifact + public Hl7.Fhir.Model.RelatedArtifact? RelatedArtifact { get { return _RelatedArtifact; } set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private Hl7.Fhir.Model.RelatedArtifact _RelatedArtifact; + private Hl7.Fhir.Model.RelatedArtifact? _RelatedArtifact; protected internal override void CopyToInternal(Base other) { - var dest = other as ApplicabilityComponent; - - if (dest == null) - { + if(other is not ApplicabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.Expression)Condition.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(RelatedArtifact != null) dest.RelatedArtifact = (Hl7.Fhir.Model.RelatedArtifact)RelatedArtifact.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.Expression)_Condition.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = (Hl7.Fhir.Model.RelatedArtifact)_RelatedArtifact.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -139,48 +138,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ApplicabilityComponent; - if(otherT == null) return false; + if(other is not ApplicabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.Equals(RelatedArtifact, otherT.RelatedArtifact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.Equals(_RelatedArtifact, otherT._RelatedArtifact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact is not null; + value = _RelatedArtifact; + return _RelatedArtifact is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (Hl7.Fhir.Model.Expression)value; + Condition = (Hl7.Fhir.Model.Expression?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "relatedArtifact": - RelatedArtifact = (Hl7.Fhir.Model.RelatedArtifact)value; + RelatedArtifact = (Hl7.Fhir.Model.RelatedArtifact?)value; return this; default: return base.SetValue(key, value); @@ -191,9 +190,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (RelatedArtifact is not null) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_RelatedArtifact is not null) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); } } @@ -222,11 +221,11 @@ public partial class PropertyGroupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Applicability { - get { if(_Applicability==null) _Applicability = new List(); return _Applicability; } + get => _Applicability ?? new List(); set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private List _Applicability; + private List? _Applicability; /// /// Components of total line item price. @@ -236,24 +235,20 @@ public List Applicab [DataMember] public List PriceComponent { - get { if(_PriceComponent==null) _PriceComponent = new List(); return _PriceComponent; } + get => _PriceComponent ?? new List(); set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } - private List _PriceComponent; + private List? _PriceComponent; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyGroupComponent; - - if (dest == null) - { + if(other is not PropertyGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Applicability.Any()) dest.Applicability = new List(Applicability.DeepCopyInternal()); - if(PriceComponent.Any()) dest.PriceComponent = new List(PriceComponent.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = new List(_Applicability.DeepCopyInternal()); + if(_PriceComponent is not null) dest.PriceComponent = new List(_PriceComponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -265,41 +260,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyGroupComponent; - if(otherT == null) return false; + if(other is not PropertyGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(PriceComponent, otherT.PriceComponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "applicability": - value = Applicability; - return Applicability?.Any() == true; + value = _Applicability; + return _Applicability?.Any() == true; case "priceComponent": - value = PriceComponent; - return PriceComponent?.Any() == true; + value = _PriceComponent; + return _PriceComponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "applicability": - Applicability = (List)value; + Applicability = (List?)value!; return this; case "priceComponent": - PriceComponent = (List)value; + PriceComponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -310,8 +305,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Applicability?.Any() == true) yield return new KeyValuePair("applicability",Applicability); - if (PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",PriceComponent); + if (_Applicability?.Any() == true) yield return new KeyValuePair("applicability",_Applicability); + if (_PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",_PriceComponent); } } @@ -321,28 +316,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this charge item definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -355,39 +347,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the charge item definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -399,41 +388,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this charge item definition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this charge item definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -443,28 +429,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this charge item definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -477,24 +460,24 @@ public string Title [DataMember] public List DerivedFromUriElement { - get { if(_DerivedFromUriElement==null) _DerivedFromUriElement = new List(); return _DerivedFromUriElement; } + get => _DerivedFromUriElement ?? new List(); set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } - private List _DerivedFromUriElement; + private List? _DerivedFromUriElement; /// /// Underlying externally-defined charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFromUri + public IEnumerable? DerivedFromUri { - get { return DerivedFromUriElement != null ? DerivedFromUriElement.Select(elem => elem.Value) : null; } + get => _DerivedFromUriElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromUriElement = null; + DerivedFromUriElement = null!; else DerivedFromUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DerivedFromUri"); @@ -509,24 +492,24 @@ public IEnumerable DerivedFromUri [DataMember] public List PartOfElement { - get { if(_PartOfElement==null) _PartOfElement = new List(); return _PartOfElement; } + get => _PartOfElement ?? new List(); set { _PartOfElement = value; OnPropertyChanged("PartOfElement"); } } - private List _PartOfElement; + private List? _PartOfElement; /// /// A larger definition of which this particular definition is a component or step /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PartOf + public IEnumerable? PartOf { - get { return PartOfElement != null ? PartOfElement.Select(elem => elem.Value) : null; } + get => _PartOfElement?.Select(elem => elem.Value); set { if (value == null) - PartOfElement = null; + PartOfElement = null!; else PartOfElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("PartOf"); @@ -541,24 +524,24 @@ public IEnumerable PartOf [DataMember] public List ReplacesElement { - get { if(_ReplacesElement==null) _ReplacesElement = new List(); return _ReplacesElement; } + get => _ReplacesElement ?? new List(); set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } - private List _ReplacesElement; + private List? _ReplacesElement; /// /// Completed or terminated request(s) whose function is taken by this new request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Replaces + public IEnumerable? Replaces { - get { return ReplacesElement != null ? ReplacesElement.Select(elem => elem.Value) : null; } + get => _ReplacesElement?.Select(elem => elem.Value); set { if (value == null) - ReplacesElement = null; + ReplacesElement = null!; else ReplacesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Replaces"); @@ -573,13 +556,13 @@ public IEnumerable Replaces [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -588,13 +571,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -604,13 +584,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=190, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -619,13 +599,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -635,28 +612,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -666,28 +640,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=210, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -700,39 +671,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the charge item definition. /// [FhirElement("description", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the charge item definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -745,11 +713,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for charge item definition (if applicable). @@ -760,39 +728,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this charge item definition is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this charge item definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -802,28 +767,25 @@ public string Purpose /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -833,28 +795,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -864,28 +823,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the charge item definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -895,28 +851,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the charge item definition was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -927,13 +880,13 @@ public string LastReviewDate [FhirElement("code", InSummary=true, Order=310)] [Binding("ChargeItemDefinitionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Instances this definition applies to. @@ -945,11 +898,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Whether or not the billing code is applicable. @@ -959,11 +912,11 @@ public List Instance [DataMember] public List Applicability { - get { if(_Applicability==null) _Applicability = new List(); return _Applicability; } + get => _Applicability ?? new List(); set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private List _Applicability; + private List? _Applicability; /// /// Group of properties which are applicable under the same conditions. @@ -973,50 +926,46 @@ public List Applicab [DataMember] public List PropertyGroup { - get { if(_PropertyGroup==null) _PropertyGroup = new List(); return _PropertyGroup; } + get => _PropertyGroup ?? new List(); set { _PropertyGroup = value; OnPropertyChanged("PropertyGroup"); } } - private List _PropertyGroup; + private List? _PropertyGroup; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItemDefinition; - - if (dest == null) - { + if(other is not ChargeItemDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromUriElement.Any()) dest.DerivedFromUriElement = new List(DerivedFromUriElement.DeepCopyInternal()); - if(PartOfElement.Any()) dest.PartOfElement = new List(PartOfElement.DeepCopyInternal()); - if(ReplacesElement.Any()) dest.ReplacesElement = new List(ReplacesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Applicability.Any()) dest.Applicability = new List(Applicability.DeepCopyInternal()); - if(PropertyGroup.Any()) dest.PropertyGroup = new List(PropertyGroup.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromUriElement is not null) dest.DerivedFromUriElement = new List(_DerivedFromUriElement.DeepCopyInternal()); + if(_PartOfElement is not null) dest.PartOfElement = new List(_PartOfElement.DeepCopyInternal()); + if(_ReplacesElement is not null) dest.ReplacesElement = new List(_ReplacesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = new List(_Applicability.DeepCopyInternal()); + if(_PropertyGroup is not null) dest.PropertyGroup = new List(_PropertyGroup.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1028,209 +977,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItemDefinition; - if(otherT == null) return false; + if(other is not ChargeItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromUriElement, otherT.DerivedFromUriElement)) return false; - if(!comparer.ListEquals(PartOfElement, otherT.PartOfElement)) return false; - if(!comparer.ListEquals(ReplacesElement, otherT.ReplacesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(PropertyGroup, otherT.PropertyGroup)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromUriElement, otherT._DerivedFromUriElement)) return false; + if(!comparer.ListEquals(_PartOfElement, otherT._PartOfElement)) return false; + if(!comparer.ListEquals(_ReplacesElement, otherT._ReplacesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_PropertyGroup, otherT._PropertyGroup)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFromUri": - value = DerivedFromUriElement; - return DerivedFromUriElement?.Any() == true; + value = _DerivedFromUriElement; + return _DerivedFromUriElement?.Any() == true; case "partOf": - value = PartOfElement; - return PartOfElement?.Any() == true; + value = _PartOfElement; + return _PartOfElement?.Any() == true; case "replaces": - value = ReplacesElement; - return ReplacesElement?.Any() == true; + value = _ReplacesElement; + return _ReplacesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "applicability": - value = Applicability; - return Applicability?.Any() == true; + value = _Applicability; + return _Applicability?.Any() == true; case "propertyGroup": - value = PropertyGroup; - return PropertyGroup?.Any() == true; + value = _PropertyGroup; + return _PropertyGroup?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFromUri": - DerivedFromUriElement = (List)value; + DerivedFromUriElement = (List?)value!; return this; case "partOf": - PartOfElement = (List)value; + PartOfElement = (List?)value!; return this; case "replaces": - ReplacesElement = (List)value; + ReplacesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "applicability": - Applicability = (List)value; + Applicability = (List?)value!; return this; case "propertyGroup": - PropertyGroup = (List)value; + PropertyGroup = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1241,32 +1190,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",DerivedFromUriElement); - if (PartOfElement?.Any() == true) yield return new KeyValuePair("partOf",PartOfElement); - if (ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",ReplacesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Applicability?.Any() == true) yield return new KeyValuePair("applicability",Applicability); - if (PropertyGroup?.Any() == true) yield return new KeyValuePair("propertyGroup",PropertyGroup); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",_DerivedFromUriElement); + if (_PartOfElement?.Any() == true) yield return new KeyValuePair("partOf",_PartOfElement); + if (_ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",_ReplacesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Applicability?.Any() == true) yield return new KeyValuePair("applicability",_Applicability); + if (_PropertyGroup?.Any() == true) yield return new KeyValuePair("propertyGroup",_PropertyGroup); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Citation.cs b/src/Hl7.Fhir.R5/Model/Generated/Citation.cs index 076b3614a..0146ad36a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Citation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Citation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -316,13 +319,13 @@ public partial class SummaryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("style", Order=40)] [Binding("CitationSummaryStyle")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Style + public Hl7.Fhir.Model.CodeableConcept? Style { get { return _Style; } set { _Style = value; OnPropertyChanged("Style"); } } - private Hl7.Fhir.Model.CodeableConcept _Style; + private Hl7.Fhir.Model.CodeableConcept? _Style; /// /// The human-readable display of the citation summary. @@ -330,44 +333,37 @@ public Hl7.Fhir.Model.CodeableConcept Style [FhirElement("text", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// The human-readable display of the citation summary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SummaryComponent; - - if (dest == null) - { + if(other is not SummaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Style != null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)Style.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Style is not null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)_Style.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -379,41 +375,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SummaryComponent; - if(otherT == null) return false; + if(other is not SummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Style, otherT.Style)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Style, otherT._Style)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "style": - value = Style; - return Style is not null; + value = _Style; + return _Style is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "style": - Style = (Hl7.Fhir.Model.CodeableConcept)value; + Style = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -424,8 +420,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Style is not null) yield return new KeyValuePair("style",Style); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Style is not null) yield return new KeyValuePair("style",_Style); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -452,13 +448,13 @@ public partial class ClassificationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("CitationClassificationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specific classification value. @@ -469,24 +465,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; protected internal override void CopyToInternal(Base other) { - var dest = other as ClassificationComponent; - - if (dest == null) - { + if(other is not ClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -498,41 +490,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassificationComponent; - if(otherT == null) return false; + if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -543,8 +535,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); } } @@ -573,26 +565,26 @@ public partial class StatusDateComponent : Hl7.Fhir.Model.BackboneElement [Binding("CitationStatusType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Activity + public Hl7.Fhir.Model.CodeableConcept? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.CodeableConcept _Activity; + private Hl7.Fhir.Model.CodeableConcept? _Activity; /// /// Either occurred or expected. /// [FhirElement("actual", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Either occurred or expected @@ -601,13 +593,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -618,27 +607,23 @@ public bool? Actual [FhirElement("period", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusDateComponent; - - if (dest == null) - { + if(other is not StatusDateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)_Activity.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -650,48 +635,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusDateComponent; - if(otherT == null) return false; + if(other is not StatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "activity": - Activity = (Hl7.Fhir.Model.CodeableConcept)value; + Activity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -702,9 +687,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -730,11 +715,11 @@ public partial class CitedArtifactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identifier not unique to the cited artifact. May include trial registry identifiers. @@ -744,39 +729,36 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get { if(_RelatedIdentifier==null) _RelatedIdentifier = new List(); return _RelatedIdentifier; } + get => _RelatedIdentifier ?? new List(); set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } - private List _RelatedIdentifier; + private List? _RelatedIdentifier; /// /// When the cited artifact was accessed. /// [FhirElement("dateAccessed", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateAccessedElement + public Hl7.Fhir.Model.FhirDateTime? DateAccessedElement { get { return _DateAccessedElement; } set { _DateAccessedElement = value; OnPropertyChanged("DateAccessedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateAccessedElement; + private Hl7.Fhir.Model.FhirDateTime? _DateAccessedElement; /// /// When the cited artifact was accessed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateAccessed + public string? DateAccessed { - get { return DateAccessedElement != null ? DateAccessedElement.Value : null; } + get => _DateAccessedElement?.Value; set { - if (value == null) - DateAccessedElement = null; - else - DateAccessedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateAccessedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateAccessed"); } } @@ -786,13 +768,13 @@ public string DateAccessed /// [FhirElement("version", Order=70)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent Version + public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent? Version { get { return _Version; } set { _Version = value; OnPropertyChanged("Version"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent _Version; + private Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent? _Version; /// /// The status of the cited artifact. @@ -803,11 +785,11 @@ public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent Version [DataMember] public List CurrentState { - get { if(_CurrentState==null) _CurrentState = new List(); return _CurrentState; } + get => _CurrentState ?? new List(); set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } - private List _CurrentState; + private List? _CurrentState; /// /// An effective date or period for a status of the cited artifact. @@ -817,11 +799,11 @@ public List CurrentState [DataMember] public List StatusDate { - get { if(_StatusDate==null) _StatusDate = new List(); return _StatusDate; } + get => _StatusDate ?? new List(); set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } - private List _StatusDate; + private List? _StatusDate; /// /// The title details of the article or artifact. @@ -831,11 +813,11 @@ public List StatusDate [DataMember] public List Title { - get { if(_Title==null) _Title = new List(); return _Title; } + get => _Title ?? new List(); set { _Title = value; OnPropertyChanged("Title"); } } - private List _Title; + private List? _Title; /// /// Summary of the article or artifact. @@ -845,24 +827,24 @@ public List Title [DataMember] public List Abstract { - get { if(_Abstract==null) _Abstract = new List(); return _Abstract; } + get => _Abstract ?? new List(); set { _Abstract = value; OnPropertyChanged("Abstract"); } } - private List _Abstract; + private List? _Abstract; /// /// The component of the article or artifact. /// [FhirElement("part", Order=120)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent Part + public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent? Part { get { return _Part; } set { _Part = value; OnPropertyChanged("Part"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactPartComponent _Part; + private Hl7.Fhir.Model.Citation.CitedArtifactPartComponent? _Part; /// /// The artifact related to the cited artifact. @@ -872,11 +854,11 @@ public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent Part [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// If multiple, used to represent alternative forms of the article that are not separate citations. @@ -886,11 +868,11 @@ public List RelatesTo [DataMember] public List PublicationForm { - get { if(_PublicationForm==null) _PublicationForm = new List(); return _PublicationForm; } + get => _PublicationForm ?? new List(); set { _PublicationForm = value; OnPropertyChanged("PublicationForm"); } } - private List _PublicationForm; + private List? _PublicationForm; /// /// Used for any URL for the article or artifact cited. @@ -900,11 +882,11 @@ public List Publi [DataMember] public List WebLocation { - get { if(_WebLocation==null) _WebLocation = new List(); return _WebLocation; } + get => _WebLocation ?? new List(); set { _WebLocation = value; OnPropertyChanged("WebLocation"); } } - private List _WebLocation; + private List? _WebLocation; /// /// The assignment to an organizing scheme. @@ -914,24 +896,24 @@ public List WebLocati [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Attribution of authors and other contributors. /// [FhirElement("contributorship", Order=170)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent Contributorship + public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent? Contributorship { get { return _Contributorship; } set { _Contributorship = value; OnPropertyChanged("Contributorship"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent _Contributorship; + private Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent? _Contributorship; /// /// Any additional information or content for the article or artifact. @@ -941,37 +923,33 @@ public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent Contributor [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactComponent; - - if (dest == null) - { + if(other is not CitedArtifactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(RelatedIdentifier.Any()) dest.RelatedIdentifier = new List(RelatedIdentifier.DeepCopyInternal()); - if(DateAccessedElement != null) dest.DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime)DateAccessedElement.DeepCopyInternal(); - if(Version != null) dest.Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent)Version.DeepCopyInternal(); - if(CurrentState.Any()) dest.CurrentState = new List(CurrentState.DeepCopyInternal()); - if(StatusDate.Any()) dest.StatusDate = new List(StatusDate.DeepCopyInternal()); - if(Title.Any()) dest.Title = new List(Title.DeepCopyInternal()); - if(Abstract.Any()) dest.Abstract = new List(Abstract.DeepCopyInternal()); - if(Part != null) dest.Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent)Part.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(PublicationForm.Any()) dest.PublicationForm = new List(PublicationForm.DeepCopyInternal()); - if(WebLocation.Any()) dest.WebLocation = new List(WebLocation.DeepCopyInternal()); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(Contributorship != null) dest.Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent)Contributorship.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_RelatedIdentifier is not null) dest.RelatedIdentifier = new List(_RelatedIdentifier.DeepCopyInternal()); + if(_DateAccessedElement is not null) dest.DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime)_DateAccessedElement.DeepCopyInternal(); + if(_Version is not null) dest.Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent)_Version.DeepCopyInternal(); + if(_CurrentState is not null) dest.CurrentState = new List(_CurrentState.DeepCopyInternal()); + if(_StatusDate is not null) dest.StatusDate = new List(_StatusDate.DeepCopyInternal()); + if(_Title is not null) dest.Title = new List(_Title.DeepCopyInternal()); + if(_Abstract is not null) dest.Abstract = new List(_Abstract.DeepCopyInternal()); + if(_Part is not null) dest.Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent)_Part.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_PublicationForm is not null) dest.PublicationForm = new List(_PublicationForm.DeepCopyInternal()); + if(_WebLocation is not null) dest.WebLocation = new List(_WebLocation.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_Contributorship is not null) dest.Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent)_Contributorship.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -983,132 +961,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactComponent; - if(otherT == null) return false; + if(other is not CitedArtifactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(RelatedIdentifier, otherT.RelatedIdentifier)) return false; - if(!comparer.Equals(DateAccessedElement, otherT.DateAccessedElement)) return false; - if(!comparer.Equals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(CurrentState, otherT.CurrentState)) return false; - if(!comparer.ListEquals(StatusDate, otherT.StatusDate)) return false; - if(!comparer.ListEquals(Title, otherT.Title)) return false; - if(!comparer.ListEquals(Abstract, otherT.Abstract)) return false; - if(!comparer.Equals(Part, otherT.Part)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(PublicationForm, otherT.PublicationForm)) return false; - if(!comparer.ListEquals(WebLocation, otherT.WebLocation)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(Contributorship, otherT.Contributorship)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_RelatedIdentifier, otherT._RelatedIdentifier)) return false; + if(!comparer.Equals(_DateAccessedElement, otherT._DateAccessedElement)) return false; + if(!comparer.Equals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_CurrentState, otherT._CurrentState)) return false; + if(!comparer.ListEquals(_StatusDate, otherT._StatusDate)) return false; + if(!comparer.ListEquals(_Title, otherT._Title)) return false; + if(!comparer.ListEquals(_Abstract, otherT._Abstract)) return false; + if(!comparer.Equals(_Part, otherT._Part)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_PublicationForm, otherT._PublicationForm)) return false; + if(!comparer.ListEquals(_WebLocation, otherT._WebLocation)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_Contributorship, otherT._Contributorship)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "relatedIdentifier": - value = RelatedIdentifier; - return RelatedIdentifier?.Any() == true; + value = _RelatedIdentifier; + return _RelatedIdentifier?.Any() == true; case "dateAccessed": - value = DateAccessedElement; - return DateAccessedElement is not null; + value = _DateAccessedElement; + return _DateAccessedElement is not null; case "version": - value = Version; - return Version is not null; + value = _Version; + return _Version is not null; case "currentState": - value = CurrentState; - return CurrentState?.Any() == true; + value = _CurrentState; + return _CurrentState?.Any() == true; case "statusDate": - value = StatusDate; - return StatusDate?.Any() == true; + value = _StatusDate; + return _StatusDate?.Any() == true; case "title": - value = Title; - return Title?.Any() == true; + value = _Title; + return _Title?.Any() == true; case "abstract": - value = Abstract; - return Abstract?.Any() == true; + value = _Abstract; + return _Abstract?.Any() == true; case "part": - value = Part; - return Part is not null; + value = _Part; + return _Part is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "publicationForm": - value = PublicationForm; - return PublicationForm?.Any() == true; + value = _PublicationForm; + return _PublicationForm?.Any() == true; case "webLocation": - value = WebLocation; - return WebLocation?.Any() == true; + value = _WebLocation; + return _WebLocation?.Any() == true; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "contributorship": - value = Contributorship; - return Contributorship is not null; + value = _Contributorship; + return _Contributorship is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "relatedIdentifier": - RelatedIdentifier = (List)value; + RelatedIdentifier = (List?)value!; return this; case "dateAccessed": - DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateAccessedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "version": - Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent)value; + Version = (Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent?)value; return this; case "currentState": - CurrentState = (List)value; + CurrentState = (List?)value!; return this; case "statusDate": - StatusDate = (List)value; + StatusDate = (List?)value!; return this; case "title": - Title = (List)value; + Title = (List?)value!; return this; case "abstract": - Abstract = (List)value; + Abstract = (List?)value!; return this; case "part": - Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent)value; + Part = (Hl7.Fhir.Model.Citation.CitedArtifactPartComponent?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "publicationForm": - PublicationForm = (List)value; + PublicationForm = (List?)value!; return this; case "webLocation": - WebLocation = (List)value; + WebLocation = (List?)value!; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "contributorship": - Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent)value; + Contributorship = (Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1119,21 +1097,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",RelatedIdentifier); - if (DateAccessedElement is not null) yield return new KeyValuePair("dateAccessed",DateAccessedElement); - if (Version is not null) yield return new KeyValuePair("version",Version); - if (CurrentState?.Any() == true) yield return new KeyValuePair("currentState",CurrentState); - if (StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",StatusDate); - if (Title?.Any() == true) yield return new KeyValuePair("title",Title); - if (Abstract?.Any() == true) yield return new KeyValuePair("abstract",Abstract); - if (Part is not null) yield return new KeyValuePair("part",Part); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (PublicationForm?.Any() == true) yield return new KeyValuePair("publicationForm",PublicationForm); - if (WebLocation?.Any() == true) yield return new KeyValuePair("webLocation",WebLocation); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (Contributorship is not null) yield return new KeyValuePair("contributorship",Contributorship); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",_RelatedIdentifier); + if (_DateAccessedElement is not null) yield return new KeyValuePair("dateAccessed",_DateAccessedElement); + if (_Version is not null) yield return new KeyValuePair("version",_Version); + if (_CurrentState?.Any() == true) yield return new KeyValuePair("currentState",_CurrentState); + if (_StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",_StatusDate); + if (_Title?.Any() == true) yield return new KeyValuePair("title",_Title); + if (_Abstract?.Any() == true) yield return new KeyValuePair("abstract",_Abstract); + if (_Part is not null) yield return new KeyValuePair("part",_Part); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_PublicationForm?.Any() == true) yield return new KeyValuePair("publicationForm",_PublicationForm); + if (_WebLocation?.Any() == true) yield return new KeyValuePair("webLocation",_WebLocation); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_Contributorship is not null) yield return new KeyValuePair("contributorship",_Contributorship); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -1157,28 +1135,25 @@ public partial class CitedArtifactVersionComponent : Hl7.Fhir.Model.BackboneElem [FhirElement("value", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The version number or other version identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -1190,26 +1165,22 @@ public string Value [CLSCompliant(false)] [References("Citation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BaseCitation + public Hl7.Fhir.Model.ResourceReference? BaseCitation { get { return _BaseCitation; } set { _BaseCitation = value; OnPropertyChanged("BaseCitation"); } } - private Hl7.Fhir.Model.ResourceReference _BaseCitation; + private Hl7.Fhir.Model.ResourceReference? _BaseCitation; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactVersionComponent; - - if (dest == null) - { + if(other is not CitedArtifactVersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(BaseCitation != null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)BaseCitation.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_BaseCitation is not null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)_BaseCitation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1221,41 +1192,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactVersionComponent; - if(otherT == null) return false; + if(other is not CitedArtifactVersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(BaseCitation, otherT.BaseCitation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "baseCitation": - value = BaseCitation; - return BaseCitation is not null; + value = _BaseCitation; + return _BaseCitation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "baseCitation": - BaseCitation = (Hl7.Fhir.Model.ResourceReference)value; + BaseCitation = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1266,8 +1237,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (BaseCitation is not null) yield return new KeyValuePair("baseCitation",BaseCitation); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_BaseCitation is not null) yield return new KeyValuePair("baseCitation",_BaseCitation); } } @@ -1295,26 +1266,26 @@ public partial class CitedArtifactStatusDateComponent : Hl7.Fhir.Model.BackboneE [Binding("CitedArtifactStatusType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Activity + public Hl7.Fhir.Model.CodeableConcept? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.CodeableConcept _Activity; + private Hl7.Fhir.Model.CodeableConcept? _Activity; /// /// Either occurred or expected. /// [FhirElement("actual", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Either occurred or expected @@ -1323,13 +1294,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -1340,27 +1308,23 @@ public bool? Actual [FhirElement("period", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactStatusDateComponent; - - if (dest == null) - { + if(other is not CitedArtifactStatusDateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)_Activity.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1372,48 +1336,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactStatusDateComponent; - if(otherT == null) return false; + if(other is not CitedArtifactStatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "activity": - Activity = (Hl7.Fhir.Model.CodeableConcept)value; + Activity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -1424,9 +1388,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -1453,11 +1417,11 @@ public partial class CitedArtifactTitleComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Used to express the specific language. @@ -1465,13 +1429,13 @@ public List Type [FhirElement("language", Order=50)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// The title of the article or artifact. @@ -1479,45 +1443,38 @@ public Hl7.Fhir.Model.CodeableConcept Language [FhirElement("text", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// The title of the article or artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactTitleComponent; - - if (dest == null) - { + if(other is not CitedArtifactTitleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1529,48 +1486,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactTitleComponent; - if(otherT == null) return false; + if(other is not CitedArtifactTitleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1581,9 +1538,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Language is not null) yield return new KeyValuePair("language",Language); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -1610,13 +1567,13 @@ public partial class CitedArtifactAbstractComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("type", Order=40)] [Binding("CitedArtifactAbstractType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Used to express the specific language. @@ -1624,13 +1581,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("language", Order=50)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Abstract content. @@ -1638,28 +1595,25 @@ public Hl7.Fhir.Model.CodeableConcept Language [FhirElement("text", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// Abstract content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } @@ -1669,46 +1623,39 @@ public string Text /// [FhirElement("copyright", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Copyright notice for the abstract /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactAbstractComponent; - - if (dest == null) - { + if(other is not CitedArtifactAbstractComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1720,55 +1667,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactAbstractComponent; - if(otherT == null) return false; + if(other is not CitedArtifactAbstractComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1779,10 +1726,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Language is not null) yield return new KeyValuePair("language",Language); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -1806,41 +1753,38 @@ public partial class CitedArtifactPartComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("CitedArtifactPartType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specification of the component. /// [FhirElement("value", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The specification of the component /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -1852,27 +1796,23 @@ public string Value [CLSCompliant(false)] [References("Citation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BaseCitation + public Hl7.Fhir.Model.ResourceReference? BaseCitation { get { return _BaseCitation; } set { _BaseCitation = value; OnPropertyChanged("BaseCitation"); } } - private Hl7.Fhir.Model.ResourceReference _BaseCitation; + private Hl7.Fhir.Model.ResourceReference? _BaseCitation; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPartComponent; - - if (dest == null) - { + if(other is not CitedArtifactPartComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(BaseCitation != null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)BaseCitation.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_BaseCitation is not null) dest.BaseCitation = (Hl7.Fhir.Model.ResourceReference)_BaseCitation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1884,48 +1824,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPartComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(BaseCitation, otherT.BaseCitation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "baseCitation": - value = BaseCitation; - return BaseCitation is not null; + value = _BaseCitation; + return _BaseCitation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "baseCitation": - BaseCitation = (Hl7.Fhir.Model.ResourceReference)value; + BaseCitation = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1936,9 +1876,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (BaseCitation is not null) yield return new KeyValuePair("baseCitation",BaseCitation); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_BaseCitation is not null) yield return new KeyValuePair("baseCitation",_BaseCitation); } } @@ -1967,13 +1907,13 @@ public partial class CitedArtifactRelatesToComponent : Hl7.Fhir.Model.BackboneEl [Binding("RelatedArtifactTypeExpanded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// documentation | justification | citation | predecessor | successor | derived-from | depends-on | composed-of | part-of | amends | amended-with | appends | appended-with | cites | cited-by | comments-on | comment-in | contains | contained-in | corrects | correction-in | replaces | replaced-with | retracts | retracted-by | signs | similar-to | supports | supported-with | transforms | transformed-into | transformed-with | documents | specification-of | created-with | cite-as | reprint | reprint-of @@ -1982,13 +1922,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Citation.RelatedArtifactTypeExpanded? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2002,39 +1939,36 @@ public Hl7.Fhir.Model.Citation.RelatedArtifactTypeExpanded? Type [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// Short label. /// [FhirElement("label", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Short label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2044,28 +1978,25 @@ public string Label /// [FhirElement("display", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Brief description of the related artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -2075,28 +2006,25 @@ public string Display /// [FhirElement("citation", Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown CitationElement + public Hl7.Fhir.Model.Markdown? CitationElement { get { return _CitationElement; } set { _CitationElement = value; OnPropertyChanged("CitationElement"); } } - private Hl7.Fhir.Model.Markdown _CitationElement; + private Hl7.Fhir.Model.Markdown? _CitationElement; /// /// Bibliographic citation for the artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Citation + public string? Citation { - get { return CitationElement != null ? CitationElement.Value : null; } + get => _CitationElement?.Value; set { - if (value == null) - CitationElement = null; - else - CitationElement = new Hl7.Fhir.Model.Markdown(value); + CitationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Citation"); } } @@ -2106,41 +2034,38 @@ public string Citation /// [FhirElement("document", Order=90)] [DataMember] - public Hl7.Fhir.Model.Attachment Document + public Hl7.Fhir.Model.Attachment? Document { get { return _Document; } set { _Document = value; OnPropertyChanged("Document"); } } - private Hl7.Fhir.Model.Attachment _Document; + private Hl7.Fhir.Model.Attachment? _Document; /// /// What artifact is being referenced. /// [FhirElement("resource", Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical ResourceElement + public Hl7.Fhir.Model.Canonical? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.Canonical _ResourceElement; + private Hl7.Fhir.Model.Canonical? _ResourceElement; /// /// What artifact is being referenced /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.Canonical(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Resource"); } } @@ -2150,32 +2075,28 @@ public string Resource /// [FhirElement("resourceReference", Order=110)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ResourceReference + public Hl7.Fhir.Model.ResourceReference? ResourceReference { get { return _ResourceReference; } set { _ResourceReference = value; OnPropertyChanged("ResourceReference"); } } - private Hl7.Fhir.Model.ResourceReference _ResourceReference; + private Hl7.Fhir.Model.ResourceReference? _ResourceReference; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactRelatesToComponent; - - if (dest == null) - { + if(other is not CitedArtifactRelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(CitationElement != null) dest.CitationElement = (Hl7.Fhir.Model.Markdown)CitationElement.DeepCopyInternal(); - if(Document != null) dest.Document = (Hl7.Fhir.Model.Attachment)Document.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.Canonical)ResourceElement.DeepCopyInternal(); - if(ResourceReference != null) dest.ResourceReference = (Hl7.Fhir.Model.ResourceReference)ResourceReference.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_CitationElement is not null) dest.CitationElement = (Hl7.Fhir.Model.Markdown)_CitationElement.DeepCopyInternal(); + if(_Document is not null) dest.Document = (Hl7.Fhir.Model.Attachment)_Document.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.Canonical)_ResourceElement.DeepCopyInternal(); + if(_ResourceReference is not null) dest.ResourceReference = (Hl7.Fhir.Model.ResourceReference)_ResourceReference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2187,83 +2108,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactRelatesToComponent; - if(otherT == null) return false; + if(other is not CitedArtifactRelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(CitationElement, otherT.CitationElement)) return false; - if(!comparer.Equals(Document, otherT.Document)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(ResourceReference, otherT.ResourceReference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_CitationElement, otherT._CitationElement)) return false; + if(!comparer.Equals(_Document, otherT._Document)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_ResourceReference, otherT._ResourceReference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "citation": - value = CitationElement; - return CitationElement is not null; + value = _CitationElement; + return _CitationElement is not null; case "document": - value = Document; - return Document is not null; + value = _Document; + return _Document is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "resourceReference": - value = ResourceReference; - return ResourceReference is not null; + value = _ResourceReference; + return _ResourceReference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "citation": - CitationElement = (Hl7.Fhir.Model.Markdown)value; + CitationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "document": - Document = (Hl7.Fhir.Model.Attachment)value; + Document = (Hl7.Fhir.Model.Attachment?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.Canonical)value; + ResourceElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "resourceReference": - ResourceReference = (Hl7.Fhir.Model.ResourceReference)value; + ResourceReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -2274,14 +2195,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (CitationElement is not null) yield return new KeyValuePair("citation",CitationElement); - if (Document is not null) yield return new KeyValuePair("document",Document); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (ResourceReference is not null) yield return new KeyValuePair("resourceReference",ResourceReference); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_CitationElement is not null) yield return new KeyValuePair("citation",_CitationElement); + if (_Document is not null) yield return new KeyValuePair("document",_Document); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_ResourceReference is not null) yield return new KeyValuePair("resourceReference",_ResourceReference); } } @@ -2307,13 +2228,13 @@ public partial class CitedArtifactPublicationFormComponent : Hl7.Fhir.Model.Back /// [FhirElement("publishedIn", Order=40)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent PublishedIn + public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent? PublishedIn { get { return _PublishedIn; } set { _PublishedIn = value; OnPropertyChanged("PublishedIn"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent _PublishedIn; + private Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent? _PublishedIn; /// /// Internet or Print. @@ -2321,41 +2242,38 @@ public Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent [FhirElement("citedMedium", Order=50)] [Binding("CitedMedium")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CitedMedium + public Hl7.Fhir.Model.CodeableConcept? CitedMedium { get { return _CitedMedium; } set { _CitedMedium = value; OnPropertyChanged("CitedMedium"); } } - private Hl7.Fhir.Model.CodeableConcept _CitedMedium; + private Hl7.Fhir.Model.CodeableConcept? _CitedMedium; /// /// Volume number of journal or other collection in which the article is published. /// [FhirElement("volume", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VolumeElement + public Hl7.Fhir.Model.FhirString? VolumeElement { get { return _VolumeElement; } set { _VolumeElement = value; OnPropertyChanged("VolumeElement"); } } - private Hl7.Fhir.Model.FhirString _VolumeElement; + private Hl7.Fhir.Model.FhirString? _VolumeElement; /// /// Volume number of journal or other collection in which the article is published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Volume + public string? Volume { - get { return VolumeElement != null ? VolumeElement.Value : null; } + get => _VolumeElement?.Value; set { - if (value == null) - VolumeElement = null; - else - VolumeElement = new Hl7.Fhir.Model.FhirString(value); + VolumeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Volume"); } } @@ -2365,28 +2283,25 @@ public string Volume /// [FhirElement("issue", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString IssueElement + public Hl7.Fhir.Model.FhirString? IssueElement { get { return _IssueElement; } set { _IssueElement = value; OnPropertyChanged("IssueElement"); } } - private Hl7.Fhir.Model.FhirString _IssueElement; + private Hl7.Fhir.Model.FhirString? _IssueElement; /// /// Issue, part or supplement of journal or other collection in which the article is published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issue + public string? Issue { - get { return IssueElement != null ? IssueElement.Value : null; } + get => _IssueElement?.Value; set { - if (value == null) - IssueElement = null; - else - IssueElement = new Hl7.Fhir.Model.FhirString(value); + IssueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Issue"); } } @@ -2396,28 +2311,25 @@ public string Issue /// [FhirElement("articleDate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ArticleDateElement + public Hl7.Fhir.Model.FhirDateTime? ArticleDateElement { get { return _ArticleDateElement; } set { _ArticleDateElement = value; OnPropertyChanged("ArticleDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ArticleDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ArticleDateElement; /// /// The date the article was added to the database, or the date the article was released /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ArticleDate + public string? ArticleDate { - get { return ArticleDateElement != null ? ArticleDateElement.Value : null; } + get => _ArticleDateElement?.Value; set { - if (value == null) - ArticleDateElement = null; - else - ArticleDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ArticleDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ArticleDate"); } } @@ -2427,28 +2339,25 @@ public string ArticleDate /// [FhirElement("publicationDateText", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString PublicationDateTextElement + public Hl7.Fhir.Model.FhirString? PublicationDateTextElement { get { return _PublicationDateTextElement; } set { _PublicationDateTextElement = value; OnPropertyChanged("PublicationDateTextElement"); } } - private Hl7.Fhir.Model.FhirString _PublicationDateTextElement; + private Hl7.Fhir.Model.FhirString? _PublicationDateTextElement; /// /// Text representation of the date on which the issue of the cited artifact was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDateText + public string? PublicationDateText { - get { return PublicationDateTextElement != null ? PublicationDateTextElement.Value : null; } + get => _PublicationDateTextElement?.Value; set { - if (value == null) - PublicationDateTextElement = null; - else - PublicationDateTextElement = new Hl7.Fhir.Model.FhirString(value); + PublicationDateTextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PublicationDateText"); } } @@ -2458,28 +2367,25 @@ public string PublicationDateText /// [FhirElement("publicationDateSeason", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PublicationDateSeasonElement + public Hl7.Fhir.Model.FhirString? PublicationDateSeasonElement { get { return _PublicationDateSeasonElement; } set { _PublicationDateSeasonElement = value; OnPropertyChanged("PublicationDateSeasonElement"); } } - private Hl7.Fhir.Model.FhirString _PublicationDateSeasonElement; + private Hl7.Fhir.Model.FhirString? _PublicationDateSeasonElement; /// /// Season in which the cited artifact was published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDateSeason + public string? PublicationDateSeason { - get { return PublicationDateSeasonElement != null ? PublicationDateSeasonElement.Value : null; } + get => _PublicationDateSeasonElement?.Value; set { - if (value == null) - PublicationDateSeasonElement = null; - else - PublicationDateSeasonElement = new Hl7.Fhir.Model.FhirString(value); + PublicationDateSeasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PublicationDateSeason"); } } @@ -2489,28 +2395,25 @@ public string PublicationDateSeason /// [FhirElement("lastRevisionDate", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastRevisionDateElement + public Hl7.Fhir.Model.FhirDateTime? LastRevisionDateElement { get { return _LastRevisionDateElement; } set { _LastRevisionDateElement = value; OnPropertyChanged("LastRevisionDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastRevisionDateElement; + private Hl7.Fhir.Model.FhirDateTime? _LastRevisionDateElement; /// /// The date the article was last revised or updated in the database /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastRevisionDate + public string? LastRevisionDate { - get { return LastRevisionDateElement != null ? LastRevisionDateElement.Value : null; } + get => _LastRevisionDateElement?.Value; set { - if (value == null) - LastRevisionDateElement = null; - else - LastRevisionDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastRevisionDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastRevisionDate"); } } @@ -2524,39 +2427,36 @@ public string LastRevisionDate [DataMember] public List Language { - get { if(_Language==null) _Language = new List(); return _Language; } + get => _Language ?? new List(); set { _Language = value; OnPropertyChanged("Language"); } } - private List _Language; + private List? _Language; /// /// Entry number or identifier for inclusion in a database. /// [FhirElement("accessionNumber", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString AccessionNumberElement + public Hl7.Fhir.Model.FhirString? AccessionNumberElement { get { return _AccessionNumberElement; } set { _AccessionNumberElement = value; OnPropertyChanged("AccessionNumberElement"); } } - private Hl7.Fhir.Model.FhirString _AccessionNumberElement; + private Hl7.Fhir.Model.FhirString? _AccessionNumberElement; /// /// Entry number or identifier for inclusion in a database /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AccessionNumber + public string? AccessionNumber { - get { return AccessionNumberElement != null ? AccessionNumberElement.Value : null; } + get => _AccessionNumberElement?.Value; set { - if (value == null) - AccessionNumberElement = null; - else - AccessionNumberElement = new Hl7.Fhir.Model.FhirString(value); + AccessionNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AccessionNumber"); } } @@ -2566,28 +2466,25 @@ public string AccessionNumber /// [FhirElement("pageString", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString PageStringElement + public Hl7.Fhir.Model.FhirString? PageStringElement { get { return _PageStringElement; } set { _PageStringElement = value; OnPropertyChanged("PageStringElement"); } } - private Hl7.Fhir.Model.FhirString _PageStringElement; + private Hl7.Fhir.Model.FhirString? _PageStringElement; /// /// Used for full display of pagination /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PageString + public string? PageString { - get { return PageStringElement != null ? PageStringElement.Value : null; } + get => _PageStringElement?.Value; set { - if (value == null) - PageStringElement = null; - else - PageStringElement = new Hl7.Fhir.Model.FhirString(value); + PageStringElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PageString"); } } @@ -2597,28 +2494,25 @@ public string PageString /// [FhirElement("firstPage", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString FirstPageElement + public Hl7.Fhir.Model.FhirString? FirstPageElement { get { return _FirstPageElement; } set { _FirstPageElement = value; OnPropertyChanged("FirstPageElement"); } } - private Hl7.Fhir.Model.FhirString _FirstPageElement; + private Hl7.Fhir.Model.FhirString? _FirstPageElement; /// /// Used for isolated representation of first page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FirstPage + public string? FirstPage { - get { return FirstPageElement != null ? FirstPageElement.Value : null; } + get => _FirstPageElement?.Value; set { - if (value == null) - FirstPageElement = null; - else - FirstPageElement = new Hl7.Fhir.Model.FhirString(value); + FirstPageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("FirstPage"); } } @@ -2628,28 +2522,25 @@ public string FirstPage /// [FhirElement("lastPage", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString LastPageElement + public Hl7.Fhir.Model.FhirString? LastPageElement { get { return _LastPageElement; } set { _LastPageElement = value; OnPropertyChanged("LastPageElement"); } } - private Hl7.Fhir.Model.FhirString _LastPageElement; + private Hl7.Fhir.Model.FhirString? _LastPageElement; /// /// Used for isolated representation of last page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastPage + public string? LastPage { - get { return LastPageElement != null ? LastPageElement.Value : null; } + get => _LastPageElement?.Value; set { - if (value == null) - LastPageElement = null; - else - LastPageElement = new Hl7.Fhir.Model.FhirString(value); + LastPageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LastPage"); } } @@ -2659,28 +2550,25 @@ public string LastPage /// [FhirElement("pageCount", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString PageCountElement + public Hl7.Fhir.Model.FhirString? PageCountElement { get { return _PageCountElement; } set { _PageCountElement = value; OnPropertyChanged("PageCountElement"); } } - private Hl7.Fhir.Model.FhirString _PageCountElement; + private Hl7.Fhir.Model.FhirString? _PageCountElement; /// /// Number of pages or screens /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PageCount + public string? PageCount { - get { return PageCountElement != null ? PageCountElement.Value : null; } + get => _PageCountElement?.Value; set { - if (value == null) - PageCountElement = null; - else - PageCountElement = new Hl7.Fhir.Model.FhirString(value); + PageCountElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PageCount"); } } @@ -2690,57 +2578,50 @@ public string PageCount /// [FhirElement("copyright", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Copyright notice for the full article or artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPublicationFormComponent; - - if (dest == null) - { + if(other is not CitedArtifactPublicationFormComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PublishedIn != null) dest.PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent)PublishedIn.DeepCopyInternal(); - if(CitedMedium != null) dest.CitedMedium = (Hl7.Fhir.Model.CodeableConcept)CitedMedium.DeepCopyInternal(); - if(VolumeElement != null) dest.VolumeElement = (Hl7.Fhir.Model.FhirString)VolumeElement.DeepCopyInternal(); - if(IssueElement != null) dest.IssueElement = (Hl7.Fhir.Model.FhirString)IssueElement.DeepCopyInternal(); - if(ArticleDateElement != null) dest.ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime)ArticleDateElement.DeepCopyInternal(); - if(PublicationDateTextElement != null) dest.PublicationDateTextElement = (Hl7.Fhir.Model.FhirString)PublicationDateTextElement.DeepCopyInternal(); - if(PublicationDateSeasonElement != null) dest.PublicationDateSeasonElement = (Hl7.Fhir.Model.FhirString)PublicationDateSeasonElement.DeepCopyInternal(); - if(LastRevisionDateElement != null) dest.LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime)LastRevisionDateElement.DeepCopyInternal(); - if(Language.Any()) dest.Language = new List(Language.DeepCopyInternal()); - if(AccessionNumberElement != null) dest.AccessionNumberElement = (Hl7.Fhir.Model.FhirString)AccessionNumberElement.DeepCopyInternal(); - if(PageStringElement != null) dest.PageStringElement = (Hl7.Fhir.Model.FhirString)PageStringElement.DeepCopyInternal(); - if(FirstPageElement != null) dest.FirstPageElement = (Hl7.Fhir.Model.FhirString)FirstPageElement.DeepCopyInternal(); - if(LastPageElement != null) dest.LastPageElement = (Hl7.Fhir.Model.FhirString)LastPageElement.DeepCopyInternal(); - if(PageCountElement != null) dest.PageCountElement = (Hl7.Fhir.Model.FhirString)PageCountElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); + if(_PublishedIn is not null) dest.PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent)_PublishedIn.DeepCopyInternal(); + if(_CitedMedium is not null) dest.CitedMedium = (Hl7.Fhir.Model.CodeableConcept)_CitedMedium.DeepCopyInternal(); + if(_VolumeElement is not null) dest.VolumeElement = (Hl7.Fhir.Model.FhirString)_VolumeElement.DeepCopyInternal(); + if(_IssueElement is not null) dest.IssueElement = (Hl7.Fhir.Model.FhirString)_IssueElement.DeepCopyInternal(); + if(_ArticleDateElement is not null) dest.ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime)_ArticleDateElement.DeepCopyInternal(); + if(_PublicationDateTextElement is not null) dest.PublicationDateTextElement = (Hl7.Fhir.Model.FhirString)_PublicationDateTextElement.DeepCopyInternal(); + if(_PublicationDateSeasonElement is not null) dest.PublicationDateSeasonElement = (Hl7.Fhir.Model.FhirString)_PublicationDateSeasonElement.DeepCopyInternal(); + if(_LastRevisionDateElement is not null) dest.LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime)_LastRevisionDateElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = new List(_Language.DeepCopyInternal()); + if(_AccessionNumberElement is not null) dest.AccessionNumberElement = (Hl7.Fhir.Model.FhirString)_AccessionNumberElement.DeepCopyInternal(); + if(_PageStringElement is not null) dest.PageStringElement = (Hl7.Fhir.Model.FhirString)_PageStringElement.DeepCopyInternal(); + if(_FirstPageElement is not null) dest.FirstPageElement = (Hl7.Fhir.Model.FhirString)_FirstPageElement.DeepCopyInternal(); + if(_LastPageElement is not null) dest.LastPageElement = (Hl7.Fhir.Model.FhirString)_LastPageElement.DeepCopyInternal(); + if(_PageCountElement is not null) dest.PageCountElement = (Hl7.Fhir.Model.FhirString)_PageCountElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2752,132 +2633,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPublicationFormComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPublicationFormComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PublishedIn, otherT.PublishedIn)) return false; - if(!comparer.Equals(CitedMedium, otherT.CitedMedium)) return false; - if(!comparer.Equals(VolumeElement, otherT.VolumeElement)) return false; - if(!comparer.Equals(IssueElement, otherT.IssueElement)) return false; - if(!comparer.Equals(ArticleDateElement, otherT.ArticleDateElement)) return false; - if(!comparer.Equals(PublicationDateTextElement, otherT.PublicationDateTextElement)) return false; - if(!comparer.Equals(PublicationDateSeasonElement, otherT.PublicationDateSeasonElement)) return false; - if(!comparer.Equals(LastRevisionDateElement, otherT.LastRevisionDateElement)) return false; - if(!comparer.ListEquals(Language, otherT.Language)) return false; - if(!comparer.Equals(AccessionNumberElement, otherT.AccessionNumberElement)) return false; - if(!comparer.Equals(PageStringElement, otherT.PageStringElement)) return false; - if(!comparer.Equals(FirstPageElement, otherT.FirstPageElement)) return false; - if(!comparer.Equals(LastPageElement, otherT.LastPageElement)) return false; - if(!comparer.Equals(PageCountElement, otherT.PageCountElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PublishedIn, otherT._PublishedIn)) return false; + if(!comparer.Equals(_CitedMedium, otherT._CitedMedium)) return false; + if(!comparer.Equals(_VolumeElement, otherT._VolumeElement)) return false; + if(!comparer.Equals(_IssueElement, otherT._IssueElement)) return false; + if(!comparer.Equals(_ArticleDateElement, otherT._ArticleDateElement)) return false; + if(!comparer.Equals(_PublicationDateTextElement, otherT._PublicationDateTextElement)) return false; + if(!comparer.Equals(_PublicationDateSeasonElement, otherT._PublicationDateSeasonElement)) return false; + if(!comparer.Equals(_LastRevisionDateElement, otherT._LastRevisionDateElement)) return false; + if(!comparer.ListEquals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_AccessionNumberElement, otherT._AccessionNumberElement)) return false; + if(!comparer.Equals(_PageStringElement, otherT._PageStringElement)) return false; + if(!comparer.Equals(_FirstPageElement, otherT._FirstPageElement)) return false; + if(!comparer.Equals(_LastPageElement, otherT._LastPageElement)) return false; + if(!comparer.Equals(_PageCountElement, otherT._PageCountElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "publishedIn": - value = PublishedIn; - return PublishedIn is not null; + value = _PublishedIn; + return _PublishedIn is not null; case "citedMedium": - value = CitedMedium; - return CitedMedium is not null; + value = _CitedMedium; + return _CitedMedium is not null; case "volume": - value = VolumeElement; - return VolumeElement is not null; + value = _VolumeElement; + return _VolumeElement is not null; case "issue": - value = IssueElement; - return IssueElement is not null; + value = _IssueElement; + return _IssueElement is not null; case "articleDate": - value = ArticleDateElement; - return ArticleDateElement is not null; + value = _ArticleDateElement; + return _ArticleDateElement is not null; case "publicationDateText": - value = PublicationDateTextElement; - return PublicationDateTextElement is not null; + value = _PublicationDateTextElement; + return _PublicationDateTextElement is not null; case "publicationDateSeason": - value = PublicationDateSeasonElement; - return PublicationDateSeasonElement is not null; + value = _PublicationDateSeasonElement; + return _PublicationDateSeasonElement is not null; case "lastRevisionDate": - value = LastRevisionDateElement; - return LastRevisionDateElement is not null; + value = _LastRevisionDateElement; + return _LastRevisionDateElement is not null; case "language": - value = Language; - return Language?.Any() == true; + value = _Language; + return _Language?.Any() == true; case "accessionNumber": - value = AccessionNumberElement; - return AccessionNumberElement is not null; + value = _AccessionNumberElement; + return _AccessionNumberElement is not null; case "pageString": - value = PageStringElement; - return PageStringElement is not null; + value = _PageStringElement; + return _PageStringElement is not null; case "firstPage": - value = FirstPageElement; - return FirstPageElement is not null; + value = _FirstPageElement; + return _FirstPageElement is not null; case "lastPage": - value = LastPageElement; - return LastPageElement is not null; + value = _LastPageElement; + return _LastPageElement is not null; case "pageCount": - value = PageCountElement; - return PageCountElement is not null; + value = _PageCountElement; + return _PageCountElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "publishedIn": - PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent)value; + PublishedIn = (Hl7.Fhir.Model.Citation.CitedArtifactPublicationFormPublishedInComponent?)value; return this; case "citedMedium": - CitedMedium = (Hl7.Fhir.Model.CodeableConcept)value; + CitedMedium = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "volume": - VolumeElement = (Hl7.Fhir.Model.FhirString)value; + VolumeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issue": - IssueElement = (Hl7.Fhir.Model.FhirString)value; + IssueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "articleDate": - ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ArticleDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publicationDateText": - PublicationDateTextElement = (Hl7.Fhir.Model.FhirString)value; + PublicationDateTextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "publicationDateSeason": - PublicationDateSeasonElement = (Hl7.Fhir.Model.FhirString)value; + PublicationDateSeasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "lastRevisionDate": - LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastRevisionDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "language": - Language = (List)value; + Language = (List?)value!; return this; case "accessionNumber": - AccessionNumberElement = (Hl7.Fhir.Model.FhirString)value; + AccessionNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "pageString": - PageStringElement = (Hl7.Fhir.Model.FhirString)value; + PageStringElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "firstPage": - FirstPageElement = (Hl7.Fhir.Model.FhirString)value; + FirstPageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "lastPage": - LastPageElement = (Hl7.Fhir.Model.FhirString)value; + LastPageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "pageCount": - PageCountElement = (Hl7.Fhir.Model.FhirString)value; + PageCountElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2888,21 +2769,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PublishedIn is not null) yield return new KeyValuePair("publishedIn",PublishedIn); - if (CitedMedium is not null) yield return new KeyValuePair("citedMedium",CitedMedium); - if (VolumeElement is not null) yield return new KeyValuePair("volume",VolumeElement); - if (IssueElement is not null) yield return new KeyValuePair("issue",IssueElement); - if (ArticleDateElement is not null) yield return new KeyValuePair("articleDate",ArticleDateElement); - if (PublicationDateTextElement is not null) yield return new KeyValuePair("publicationDateText",PublicationDateTextElement); - if (PublicationDateSeasonElement is not null) yield return new KeyValuePair("publicationDateSeason",PublicationDateSeasonElement); - if (LastRevisionDateElement is not null) yield return new KeyValuePair("lastRevisionDate",LastRevisionDateElement); - if (Language?.Any() == true) yield return new KeyValuePair("language",Language); - if (AccessionNumberElement is not null) yield return new KeyValuePair("accessionNumber",AccessionNumberElement); - if (PageStringElement is not null) yield return new KeyValuePair("pageString",PageStringElement); - if (FirstPageElement is not null) yield return new KeyValuePair("firstPage",FirstPageElement); - if (LastPageElement is not null) yield return new KeyValuePair("lastPage",LastPageElement); - if (PageCountElement is not null) yield return new KeyValuePair("pageCount",PageCountElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_PublishedIn is not null) yield return new KeyValuePair("publishedIn",_PublishedIn); + if (_CitedMedium is not null) yield return new KeyValuePair("citedMedium",_CitedMedium); + if (_VolumeElement is not null) yield return new KeyValuePair("volume",_VolumeElement); + if (_IssueElement is not null) yield return new KeyValuePair("issue",_IssueElement); + if (_ArticleDateElement is not null) yield return new KeyValuePair("articleDate",_ArticleDateElement); + if (_PublicationDateTextElement is not null) yield return new KeyValuePair("publicationDateText",_PublicationDateTextElement); + if (_PublicationDateSeasonElement is not null) yield return new KeyValuePair("publicationDateSeason",_PublicationDateSeasonElement); + if (_LastRevisionDateElement is not null) yield return new KeyValuePair("lastRevisionDate",_LastRevisionDateElement); + if (_Language?.Any() == true) yield return new KeyValuePair("language",_Language); + if (_AccessionNumberElement is not null) yield return new KeyValuePair("accessionNumber",_AccessionNumberElement); + if (_PageStringElement is not null) yield return new KeyValuePair("pageString",_PageStringElement); + if (_FirstPageElement is not null) yield return new KeyValuePair("firstPage",_FirstPageElement); + if (_LastPageElement is not null) yield return new KeyValuePair("lastPage",_LastPageElement); + if (_PageCountElement is not null) yield return new KeyValuePair("pageCount",_PageCountElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -2926,13 +2807,13 @@ public partial class CitedArtifactPublicationFormPublishedInComponent : Hl7.Fhir [FhirElement("type", Order=40)] [Binding("PublishedInType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Journal identifiers include ISSN, ISO Abbreviation and NLMuniqueID; Book identifiers include ISBN. @@ -2942,39 +2823,36 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Name of the database or title of the book or journal. /// [FhirElement("title", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name of the database or title of the book or journal /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2986,60 +2864,53 @@ public string Title [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Publisher + public Hl7.Fhir.Model.ResourceReference? Publisher { get { return _Publisher; } set { _Publisher = value; OnPropertyChanged("Publisher"); } } - private Hl7.Fhir.Model.ResourceReference _Publisher; + private Hl7.Fhir.Model.ResourceReference? _Publisher; /// /// Geographic location of the publisher. /// [FhirElement("publisherLocation", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherLocationElement + public Hl7.Fhir.Model.FhirString? PublisherLocationElement { get { return _PublisherLocationElement; } set { _PublisherLocationElement = value; OnPropertyChanged("PublisherLocationElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherLocationElement; + private Hl7.Fhir.Model.FhirString? _PublisherLocationElement; /// /// Geographic location of the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublisherLocation + public string? PublisherLocation { - get { return PublisherLocationElement != null ? PublisherLocationElement.Value : null; } + get => _PublisherLocationElement?.Value; set { - if (value == null) - PublisherLocationElement = null; - else - PublisherLocationElement = new Hl7.Fhir.Model.FhirString(value); + PublisherLocationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PublisherLocation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactPublicationFormPublishedInComponent; - - if (dest == null) - { + if(other is not CitedArtifactPublicationFormPublishedInComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Publisher != null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)Publisher.DeepCopyInternal(); - if(PublisherLocationElement != null) dest.PublisherLocationElement = (Hl7.Fhir.Model.FhirString)PublisherLocationElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Publisher is not null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)_Publisher.DeepCopyInternal(); + if(_PublisherLocationElement is not null) dest.PublisherLocationElement = (Hl7.Fhir.Model.FhirString)_PublisherLocationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3051,62 +2922,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactPublicationFormPublishedInComponent; - if(otherT == null) return false; + if(other is not CitedArtifactPublicationFormPublishedInComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Publisher, otherT.Publisher)) return false; - if(!comparer.Equals(PublisherLocationElement, otherT.PublisherLocationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; + if(!comparer.Equals(_PublisherLocationElement, otherT._PublisherLocationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "publisher": - value = Publisher; - return Publisher is not null; + value = _Publisher; + return _Publisher is not null; case "publisherLocation": - value = PublisherLocationElement; - return PublisherLocationElement is not null; + value = _PublisherLocationElement; + return _PublisherLocationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "publisher": - Publisher = (Hl7.Fhir.Model.ResourceReference)value; + Publisher = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "publisherLocation": - PublisherLocationElement = (Hl7.Fhir.Model.FhirString)value; + PublisherLocationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3117,11 +2988,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Publisher is not null) yield return new KeyValuePair("publisher",Publisher); - if (PublisherLocationElement is not null) yield return new KeyValuePair("publisherLocation",PublisherLocationElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Publisher is not null) yield return new KeyValuePair("publisher",_Publisher); + if (_PublisherLocationElement is not null) yield return new KeyValuePair("publisherLocation",_PublisherLocationElement); } } @@ -3148,55 +3019,48 @@ public partial class CitedArtifactWebLocationComponent : Hl7.Fhir.Model.Backbone [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// The specific URL. /// [FhirElement("url", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// The specific URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactWebLocationComponent; - - if (dest == null) - { + if(other is not CitedArtifactWebLocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3208,41 +3072,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactWebLocationComponent; - if(otherT == null) return false; + if(other is not CitedArtifactWebLocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -3253,8 +3117,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -3278,13 +3142,13 @@ public partial class CitedArtifactClassificationComponent : Hl7.Fhir.Model.Backb [FhirElement("type", Order=40)] [Binding("CitedArtifactClassificationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specific classification value. @@ -3295,11 +3159,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// Complex or externally created classification. @@ -3311,25 +3175,21 @@ public List Classifier [DataMember] public List ArtifactAssessment { - get { if(_ArtifactAssessment==null) _ArtifactAssessment = new List(); return _ArtifactAssessment; } + get => _ArtifactAssessment ?? new List(); set { _ArtifactAssessment = value; OnPropertyChanged("ArtifactAssessment"); } } - private List _ArtifactAssessment; + private List? _ArtifactAssessment; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactClassificationComponent; - - if (dest == null) - { + if(other is not CitedArtifactClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(ArtifactAssessment.Any()) dest.ArtifactAssessment = new List(ArtifactAssessment.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_ArtifactAssessment is not null) dest.ArtifactAssessment = new List(_ArtifactAssessment.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3341,48 +3201,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactClassificationComponent; - if(otherT == null) return false; + if(other is not CitedArtifactClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.ListEquals(ArtifactAssessment, otherT.ArtifactAssessment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.ListEquals(_ArtifactAssessment, otherT._ArtifactAssessment)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "artifactAssessment": - value = ArtifactAssessment; - return ArtifactAssessment?.Any() == true; + value = _ArtifactAssessment; + return _ArtifactAssessment?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "artifactAssessment": - ArtifactAssessment = (List)value; + ArtifactAssessment = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3393,9 +3253,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (ArtifactAssessment?.Any() == true) yield return new KeyValuePair("artifactAssessment",ArtifactAssessment); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_ArtifactAssessment?.Any() == true) yield return new KeyValuePair("artifactAssessment",_ArtifactAssessment); } } @@ -3421,13 +3281,13 @@ public partial class CitedArtifactContributorshipComponent : Hl7.Fhir.Model.Back /// [FhirElement("complete", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CompleteElement + public Hl7.Fhir.Model.FhirBoolean? CompleteElement { get { return _CompleteElement; } set { _CompleteElement = value; OnPropertyChanged("CompleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CompleteElement; + private Hl7.Fhir.Model.FhirBoolean? _CompleteElement; /// /// Indicates if the list includes all authors and/or contributors @@ -3436,13 +3296,10 @@ public Hl7.Fhir.Model.FhirBoolean CompleteElement [IgnoreDataMember] public bool? Complete { - get { return CompleteElement != null ? CompleteElement.Value : null; } + get => _CompleteElement?.Value; set { - if (value == null) - CompleteElement = null; - else - CompleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + CompleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Complete"); } } @@ -3455,11 +3312,11 @@ public bool? Complete [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Used to record a display of the author/contributor list without separate data element for each list member. @@ -3469,25 +3326,21 @@ public List [DataMember] public List Summary { - get { if(_Summary==null) _Summary = new List(); return _Summary; } + get => _Summary ?? new List(); set { _Summary = value; OnPropertyChanged("Summary"); } } - private List _Summary; + private List? _Summary; protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactContributorshipComponent; - - if (dest == null) - { + if(other is not CitedArtifactContributorshipComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CompleteElement != null) dest.CompleteElement = (Hl7.Fhir.Model.FhirBoolean)CompleteElement.DeepCopyInternal(); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(Summary.Any()) dest.Summary = new List(Summary.DeepCopyInternal()); + if(_CompleteElement is not null) dest.CompleteElement = (Hl7.Fhir.Model.FhirBoolean)_CompleteElement.DeepCopyInternal(); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_Summary is not null) dest.Summary = new List(_Summary.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3499,48 +3352,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactContributorshipComponent; - if(otherT == null) return false; + if(other is not CitedArtifactContributorshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CompleteElement, otherT.CompleteElement)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.ListEquals(Summary, otherT.Summary)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CompleteElement, otherT._CompleteElement)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.ListEquals(_Summary, otherT._Summary)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "complete": - value = CompleteElement; - return CompleteElement is not null; + value = _CompleteElement; + return _CompleteElement is not null; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "summary": - value = Summary; - return Summary?.Any() == true; + value = _Summary; + return _Summary?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "complete": - CompleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + CompleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "summary": - Summary = (List)value; + Summary = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3551,9 +3404,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CompleteElement is not null) yield return new KeyValuePair("complete",CompleteElement); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (Summary?.Any() == true) yield return new KeyValuePair("summary",Summary); + if (_CompleteElement is not null) yield return new KeyValuePair("complete",_CompleteElement); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_Summary?.Any() == true) yield return new KeyValuePair("summary",_Summary); } } @@ -3583,41 +3436,38 @@ public partial class CitedArtifactContributorshipEntryComponent : Hl7.Fhir.Model [References("Practitioner","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Contributor + public Hl7.Fhir.Model.ResourceReference? Contributor { get { return _Contributor; } set { _Contributor = value; OnPropertyChanged("Contributor"); } } - private Hl7.Fhir.Model.ResourceReference _Contributor; + private Hl7.Fhir.Model.ResourceReference? _Contributor; /// /// For citation styles that use initials. /// [FhirElement("forenameInitials", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ForenameInitialsElement + public Hl7.Fhir.Model.FhirString? ForenameInitialsElement { get { return _ForenameInitialsElement; } set { _ForenameInitialsElement = value; OnPropertyChanged("ForenameInitialsElement"); } } - private Hl7.Fhir.Model.FhirString _ForenameInitialsElement; + private Hl7.Fhir.Model.FhirString? _ForenameInitialsElement; /// /// For citation styles that use initials /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ForenameInitials + public string? ForenameInitials { - get { return ForenameInitialsElement != null ? ForenameInitialsElement.Value : null; } + get => _ForenameInitialsElement?.Value; set { - if (value == null) - ForenameInitialsElement = null; - else - ForenameInitialsElement = new Hl7.Fhir.Model.FhirString(value); + ForenameInitialsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ForenameInitials"); } } @@ -3632,11 +3482,11 @@ public string ForenameInitials [DataMember] public List Affiliation { - get { if(_Affiliation==null) _Affiliation = new List(); return _Affiliation; } + get => _Affiliation ?? new List(); set { _Affiliation = value; OnPropertyChanged("Affiliation"); } } - private List _Affiliation; + private List? _Affiliation; /// /// The specific contribution. @@ -3647,11 +3497,11 @@ public List Affiliation [DataMember] public List ContributionType { - get { if(_ContributionType==null) _ContributionType = new List(); return _ContributionType; } + get => _ContributionType ?? new List(); set { _ContributionType = value; OnPropertyChanged("ContributionType"); } } - private List _ContributionType; + private List? _ContributionType; /// /// The role of the contributor (e.g. author, editor, reviewer, funder). @@ -3659,13 +3509,13 @@ public List ContributionType [FhirElement("role", Order=80)] [Binding("ContributorRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Contributions with accounting for time or number. @@ -3675,24 +3525,24 @@ public Hl7.Fhir.Model.CodeableConcept Role [DataMember] public List ContributionInstance { - get { if(_ContributionInstance==null) _ContributionInstance = new List(); return _ContributionInstance; } + get => _ContributionInstance ?? new List(); set { _ContributionInstance = value; OnPropertyChanged("ContributionInstance"); } } - private List _ContributionInstance; + private List? _ContributionInstance; /// /// Whether the contributor is the corresponding contributor for the role. /// [FhirElement("correspondingContact", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CorrespondingContactElement + public Hl7.Fhir.Model.FhirBoolean? CorrespondingContactElement { get { return _CorrespondingContactElement; } set { _CorrespondingContactElement = value; OnPropertyChanged("CorrespondingContactElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CorrespondingContactElement; + private Hl7.Fhir.Model.FhirBoolean? _CorrespondingContactElement; /// /// Whether the contributor is the corresponding contributor for the role @@ -3701,13 +3551,10 @@ public Hl7.Fhir.Model.FhirBoolean CorrespondingContactElement [IgnoreDataMember] public bool? CorrespondingContact { - get { return CorrespondingContactElement != null ? CorrespondingContactElement.Value : null; } + get => _CorrespondingContactElement?.Value; set { - if (value == null) - CorrespondingContactElement = null; - else - CorrespondingContactElement = new Hl7.Fhir.Model.FhirBoolean(value); + CorrespondingContactElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("CorrespondingContact"); } } @@ -3717,13 +3564,13 @@ public bool? CorrespondingContact /// [FhirElement("rankingOrder", Order=110)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RankingOrderElement + public Hl7.Fhir.Model.PositiveInt? RankingOrderElement { get { return _RankingOrderElement; } set { _RankingOrderElement = value; OnPropertyChanged("RankingOrderElement"); } } - private Hl7.Fhir.Model.PositiveInt _RankingOrderElement; + private Hl7.Fhir.Model.PositiveInt? _RankingOrderElement; /// /// Ranked order of contribution @@ -3732,35 +3579,28 @@ public Hl7.Fhir.Model.PositiveInt RankingOrderElement [IgnoreDataMember] public int? RankingOrder { - get { return RankingOrderElement != null ? RankingOrderElement.Value : null; } + get => _RankingOrderElement?.Value; set { - if (value == null) - RankingOrderElement = null; - else - RankingOrderElement = new Hl7.Fhir.Model.PositiveInt(value); + RankingOrderElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("RankingOrder"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactContributorshipEntryComponent; - - if (dest == null) - { + if(other is not CitedArtifactContributorshipEntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Contributor != null) dest.Contributor = (Hl7.Fhir.Model.ResourceReference)Contributor.DeepCopyInternal(); - if(ForenameInitialsElement != null) dest.ForenameInitialsElement = (Hl7.Fhir.Model.FhirString)ForenameInitialsElement.DeepCopyInternal(); - if(Affiliation.Any()) dest.Affiliation = new List(Affiliation.DeepCopyInternal()); - if(ContributionType.Any()) dest.ContributionType = new List(ContributionType.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(ContributionInstance.Any()) dest.ContributionInstance = new List(ContributionInstance.DeepCopyInternal()); - if(CorrespondingContactElement != null) dest.CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean)CorrespondingContactElement.DeepCopyInternal(); - if(RankingOrderElement != null) dest.RankingOrderElement = (Hl7.Fhir.Model.PositiveInt)RankingOrderElement.DeepCopyInternal(); + if(_Contributor is not null) dest.Contributor = (Hl7.Fhir.Model.ResourceReference)_Contributor.DeepCopyInternal(); + if(_ForenameInitialsElement is not null) dest.ForenameInitialsElement = (Hl7.Fhir.Model.FhirString)_ForenameInitialsElement.DeepCopyInternal(); + if(_Affiliation is not null) dest.Affiliation = new List(_Affiliation.DeepCopyInternal()); + if(_ContributionType is not null) dest.ContributionType = new List(_ContributionType.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_ContributionInstance is not null) dest.ContributionInstance = new List(_ContributionInstance.DeepCopyInternal()); + if(_CorrespondingContactElement is not null) dest.CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean)_CorrespondingContactElement.DeepCopyInternal(); + if(_RankingOrderElement is not null) dest.RankingOrderElement = (Hl7.Fhir.Model.PositiveInt)_RankingOrderElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3772,83 +3612,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactContributorshipEntryComponent; - if(otherT == null) return false; + if(other is not CitedArtifactContributorshipEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Contributor, otherT.Contributor)) return false; - if(!comparer.Equals(ForenameInitialsElement, otherT.ForenameInitialsElement)) return false; - if(!comparer.ListEquals(Affiliation, otherT.Affiliation)) return false; - if(!comparer.ListEquals(ContributionType, otherT.ContributionType)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.ListEquals(ContributionInstance, otherT.ContributionInstance)) return false; - if(!comparer.Equals(CorrespondingContactElement, otherT.CorrespondingContactElement)) return false; - if(!comparer.Equals(RankingOrderElement, otherT.RankingOrderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Contributor, otherT._Contributor)) return false; + if(!comparer.Equals(_ForenameInitialsElement, otherT._ForenameInitialsElement)) return false; + if(!comparer.ListEquals(_Affiliation, otherT._Affiliation)) return false; + if(!comparer.ListEquals(_ContributionType, otherT._ContributionType)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.ListEquals(_ContributionInstance, otherT._ContributionInstance)) return false; + if(!comparer.Equals(_CorrespondingContactElement, otherT._CorrespondingContactElement)) return false; + if(!comparer.Equals(_RankingOrderElement, otherT._RankingOrderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "contributor": - value = Contributor; - return Contributor is not null; + value = _Contributor; + return _Contributor is not null; case "forenameInitials": - value = ForenameInitialsElement; - return ForenameInitialsElement is not null; + value = _ForenameInitialsElement; + return _ForenameInitialsElement is not null; case "affiliation": - value = Affiliation; - return Affiliation?.Any() == true; + value = _Affiliation; + return _Affiliation?.Any() == true; case "contributionType": - value = ContributionType; - return ContributionType?.Any() == true; + value = _ContributionType; + return _ContributionType?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "contributionInstance": - value = ContributionInstance; - return ContributionInstance?.Any() == true; + value = _ContributionInstance; + return _ContributionInstance?.Any() == true; case "correspondingContact": - value = CorrespondingContactElement; - return CorrespondingContactElement is not null; + value = _CorrespondingContactElement; + return _CorrespondingContactElement is not null; case "rankingOrder": - value = RankingOrderElement; - return RankingOrderElement is not null; + value = _RankingOrderElement; + return _RankingOrderElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "contributor": - Contributor = (Hl7.Fhir.Model.ResourceReference)value; + Contributor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "forenameInitials": - ForenameInitialsElement = (Hl7.Fhir.Model.FhirString)value; + ForenameInitialsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "affiliation": - Affiliation = (List)value; + Affiliation = (List?)value!; return this; case "contributionType": - ContributionType = (List)value; + ContributionType = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contributionInstance": - ContributionInstance = (List)value; + ContributionInstance = (List?)value!; return this; case "correspondingContact": - CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean)value; + CorrespondingContactElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "rankingOrder": - RankingOrderElement = (Hl7.Fhir.Model.PositiveInt)value; + RankingOrderElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -3859,14 +3699,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Contributor is not null) yield return new KeyValuePair("contributor",Contributor); - if (ForenameInitialsElement is not null) yield return new KeyValuePair("forenameInitials",ForenameInitialsElement); - if (Affiliation?.Any() == true) yield return new KeyValuePair("affiliation",Affiliation); - if (ContributionType?.Any() == true) yield return new KeyValuePair("contributionType",ContributionType); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (ContributionInstance?.Any() == true) yield return new KeyValuePair("contributionInstance",ContributionInstance); - if (CorrespondingContactElement is not null) yield return new KeyValuePair("correspondingContact",CorrespondingContactElement); - if (RankingOrderElement is not null) yield return new KeyValuePair("rankingOrder",RankingOrderElement); + if (_Contributor is not null) yield return new KeyValuePair("contributor",_Contributor); + if (_ForenameInitialsElement is not null) yield return new KeyValuePair("forenameInitials",_ForenameInitialsElement); + if (_Affiliation?.Any() == true) yield return new KeyValuePair("affiliation",_Affiliation); + if (_ContributionType?.Any() == true) yield return new KeyValuePair("contributionType",_ContributionType); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_ContributionInstance?.Any() == true) yield return new KeyValuePair("contributionInstance",_ContributionInstance); + if (_CorrespondingContactElement is not null) yield return new KeyValuePair("correspondingContact",_CorrespondingContactElement); + if (_RankingOrderElement is not null) yield return new KeyValuePair("rankingOrder",_RankingOrderElement); } } @@ -3891,57 +3731,50 @@ public partial class CitedArtifactContributorshipEntryContributionInstanceCompon [Binding("ArtifactContributionInstanceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The time that the contribution was made. /// [FhirElement("time", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// The time that the contribution was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CitedArtifactContributorshipEntryContributionInstanceComponent; - - if (dest == null) - { + if(other is not CitedArtifactContributorshipEntryContributionInstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3953,41 +3786,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CitedArtifactContributorshipEntryContributionInstanceComponent; - if(otherT == null) return false; + if(other is not CitedArtifactContributorshipEntryContributionInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -3998,8 +3831,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); } } @@ -4023,13 +3856,13 @@ public partial class ContributorshipSummaryComponent : Hl7.Fhir.Model.BackboneEl [FhirElement("type", Order=40)] [Binding("ContributorSummaryType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The format for the display string. @@ -4037,13 +3870,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("style", Order=50)] [Binding("ContributorSummaryStyle")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Style + public Hl7.Fhir.Model.CodeableConcept? Style { get { return _Style; } set { _Style = value; OnPropertyChanged("Style"); } } - private Hl7.Fhir.Model.CodeableConcept _Style; + private Hl7.Fhir.Model.CodeableConcept? _Style; /// /// Used to code the producer or rule for creating the display string. @@ -4051,13 +3884,13 @@ public Hl7.Fhir.Model.CodeableConcept Style [FhirElement("source", Order=60)] [Binding("ContributorSummarySource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Source + public Hl7.Fhir.Model.CodeableConcept? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.CodeableConcept _Source; + private Hl7.Fhir.Model.CodeableConcept? _Source; /// /// The display string for the author list, contributor list, or contributorship statement. @@ -4065,46 +3898,39 @@ public Hl7.Fhir.Model.CodeableConcept Source [FhirElement("value", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown ValueElement + public Hl7.Fhir.Model.Markdown? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.Markdown _ValueElement; + private Hl7.Fhir.Model.Markdown? _ValueElement; /// /// The display string for the author list, contributor list, or contributorship statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.Markdown(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContributorshipSummaryComponent; - - if (dest == null) - { + if(other is not ContributorshipSummaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Style != null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)Style.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.CodeableConcept)Source.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.Markdown)ValueElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Style is not null) dest.Style = (Hl7.Fhir.Model.CodeableConcept)_Style.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.CodeableConcept)_Source.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.Markdown)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4116,55 +3942,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContributorshipSummaryComponent; - if(otherT == null) return false; + if(other is not ContributorshipSummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Style, otherT.Style)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Style, otherT._Style)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "style": - value = Style; - return Style is not null; + value = _Style; + return _Style is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "style": - Style = (Hl7.Fhir.Model.CodeableConcept)value; + Style = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.CodeableConcept)value; + Source = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.Markdown)value; + ValueElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -4175,10 +4001,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Style is not null) yield return new KeyValuePair("style",Style); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Style is not null) yield return new KeyValuePair("style",_Style); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -4188,28 +4014,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this citation record, represented as a globally unique URI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4222,39 +4045,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the citation record. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the citation record /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4266,41 +4086,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this citation record (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this citation record (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4310,28 +4127,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this citation record (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4344,13 +4158,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -4359,13 +4173,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4375,13 +4186,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -4390,13 +4201,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -4406,28 +4214,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -4437,28 +4242,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// The publisher of the citation record, not the publisher of the article or artifact being cited /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -4471,39 +4273,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the citation. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the citation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -4516,11 +4315,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for citation record (if applicable). @@ -4531,39 +4330,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this citation is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this citation is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -4573,28 +4369,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions for the citation record, not for the cited artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -4604,28 +4397,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) for the ciation record, not for the cited artifact /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -4635,28 +4425,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the citation record was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -4666,28 +4453,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the citation record was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -4697,13 +4481,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Who authored the citation record. @@ -4713,11 +4497,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the citation record. @@ -4727,11 +4511,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the citation record. @@ -4741,11 +4525,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the citation record. @@ -4755,11 +4539,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// A human-readable display of key concepts to represent the citation. @@ -4769,11 +4553,11 @@ public List Endorser [DataMember] public List Summary { - get { if(_Summary==null) _Summary = new List(); return _Summary; } + get => _Summary ?? new List(); set { _Summary = value; OnPropertyChanged("Summary"); } } - private List _Summary; + private List? _Summary; /// /// The assignment to an organizing scheme. @@ -4783,11 +4567,11 @@ public List Summary [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Used for general notes and annotations not coded elsewhere. @@ -4797,11 +4581,11 @@ public List Classification [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The status of the citation record. @@ -4812,11 +4596,11 @@ public List Note [DataMember] public List CurrentState { - get { if(_CurrentState==null) _CurrentState = new List(); return _CurrentState; } + get => _CurrentState ?? new List(); set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } - private List _CurrentState; + private List? _CurrentState; /// /// An effective date or period for a status of the citation record. @@ -4826,11 +4610,11 @@ public List CurrentState [DataMember] public List StatusDate { - get { if(_StatusDate==null) _StatusDate = new List(); return _StatusDate; } + get => _StatusDate ?? new List(); set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } - private List _StatusDate; + private List? _StatusDate; /// /// Artifact related to the citation record. @@ -4840,68 +4624,64 @@ public List StatusDate [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// The article or artifact being described. /// [FhirElement("citedArtifact", Order=390)] [DataMember] - public Hl7.Fhir.Model.Citation.CitedArtifactComponent CitedArtifact + public Hl7.Fhir.Model.Citation.CitedArtifactComponent? CitedArtifact { get { return _CitedArtifact; } set { _CitedArtifact = value; OnPropertyChanged("CitedArtifact"); } } - private Hl7.Fhir.Model.Citation.CitedArtifactComponent _CitedArtifact; + private Hl7.Fhir.Model.Citation.CitedArtifactComponent? _CitedArtifact; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Citation; - - if (dest == null) - { + if(other is not Citation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(Summary.Any()) dest.Summary = new List(Summary.DeepCopyInternal()); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(CurrentState.Any()) dest.CurrentState = new List(CurrentState.DeepCopyInternal()); - if(StatusDate.Any()) dest.StatusDate = new List(StatusDate.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(CitedArtifact != null) dest.CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent)CitedArtifact.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_Summary is not null) dest.Summary = new List(_Summary.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_CurrentState is not null) dest.CurrentState = new List(_CurrentState.DeepCopyInternal()); + if(_StatusDate is not null) dest.StatusDate = new List(_StatusDate.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_CitedArtifact is not null) dest.CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent)_CitedArtifact.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4913,244 +4693,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Citation; - if(otherT == null) return false; + if(other is not Citation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(Summary, otherT.Summary)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(CurrentState, otherT.CurrentState)) return false; - if(!comparer.ListEquals(StatusDate, otherT.StatusDate)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(CitedArtifact, otherT.CitedArtifact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_Summary, otherT._Summary)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_CurrentState, otherT._CurrentState)) return false; + if(!comparer.ListEquals(_StatusDate, otherT._StatusDate)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_CitedArtifact, otherT._CitedArtifact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "summary": - value = Summary; - return Summary?.Any() == true; + value = _Summary; + return _Summary?.Any() == true; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "currentState": - value = CurrentState; - return CurrentState?.Any() == true; + value = _CurrentState; + return _CurrentState?.Any() == true; case "statusDate": - value = StatusDate; - return StatusDate?.Any() == true; + value = _StatusDate; + return _StatusDate?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "citedArtifact": - value = CitedArtifact; - return CitedArtifact is not null; + value = _CitedArtifact; + return _CitedArtifact is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "summary": - Summary = (List)value; + Summary = (List?)value!; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "currentState": - CurrentState = (List)value; + CurrentState = (List?)value!; return this; case "statusDate": - StatusDate = (List)value; + StatusDate = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "citedArtifact": - CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent)value; + CitedArtifact = (Hl7.Fhir.Model.Citation.CitedArtifactComponent?)value; return this; default: return base.SetValue(key, value); @@ -5161,37 +4941,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (Summary?.Any() == true) yield return new KeyValuePair("summary",Summary); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (CurrentState?.Any() == true) yield return new KeyValuePair("currentState",CurrentState); - if (StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",StatusDate); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (CitedArtifact is not null) yield return new KeyValuePair("citedArtifact",CitedArtifact); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_Summary?.Any() == true) yield return new KeyValuePair("summary",_Summary); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_CurrentState?.Any() == true) yield return new KeyValuePair("currentState",_CurrentState); + if (_StatusDate?.Any() == true) yield return new KeyValuePair("statusDate",_StatusDate); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_CitedArtifact is not null) yield return new KeyValuePair("citedArtifact",_CitedArtifact); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs index a8baab7ef..92af68299 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -98,40 +101,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// File or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -226,13 +225,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [Binding("PayeeType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient reference. @@ -241,26 +240,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -272,41 +267,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -317,8 +312,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -346,13 +341,13 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [Binding("DatesType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Occurance date or period. @@ -362,26 +357,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -393,41 +384,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(When, otherT.When)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -438,8 +429,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (When is not null) yield return new KeyValuePair("when",When); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_When is not null) yield return new KeyValuePair("when",_When); } } @@ -466,13 +457,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Order of care team @@ -481,13 +472,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -500,26 +488,26 @@ public int? Sequence [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Indicator of the lead practitioner. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Indicator of the lead practitioner @@ -528,13 +516,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -545,13 +530,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Practitioner or provider specialization. @@ -559,29 +544,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("specialty", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Specialty + public Hl7.Fhir.Model.CodeableConcept? Specialty { get { return _Specialty; } set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private Hl7.Fhir.Model.CodeableConcept _Specialty; + private Hl7.Fhir.Model.CodeableConcept? _Specialty; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Specialty != null) dest.Specialty = (Hl7.Fhir.Model.CodeableConcept)Specialty.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Specialty is not null) dest.Specialty = (Hl7.Fhir.Model.CodeableConcept)_Specialty.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -593,62 +574,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Specialty, otherT.Specialty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Specialty, otherT._Specialty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "specialty": - value = Specialty; - return Specialty is not null; + value = _Specialty; + return _Specialty is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialty": - Specialty = (Hl7.Fhir.Model.CodeableConcept)value; + Specialty = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -659,11 +640,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Specialty is not null) yield return new KeyValuePair("specialty",Specialty); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Specialty is not null) yield return new KeyValuePair("specialty",_Specialty); } } @@ -691,13 +672,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -706,13 +687,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -724,13 +702,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -738,13 +716,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -753,13 +731,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Data to be provided. @@ -769,13 +747,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Identifier))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Explanation for the information. @@ -783,30 +761,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -818,69 +792,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -891,12 +865,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -923,13 +897,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Diagnosis instance identifier @@ -938,13 +912,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -959,13 +930,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -976,11 +947,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Present on admission. @@ -988,28 +959,24 @@ public List Type [FhirElement("onAdmission", Order=70)] [Binding("DiagnosisOnAdmission")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OnAdmission + public Hl7.Fhir.Model.CodeableConcept? OnAdmission { get { return _OnAdmission; } set { _OnAdmission = value; OnPropertyChanged("OnAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _OnAdmission; + private Hl7.Fhir.Model.CodeableConcept? _OnAdmission; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(OnAdmission != null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)OnAdmission.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_OnAdmission is not null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)_OnAdmission.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1021,55 +988,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(OnAdmission, otherT.OnAdmission)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "onAdmission": - value = OnAdmission; - return OnAdmission is not null; + value = _OnAdmission; + return _OnAdmission is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "onAdmission": - OnAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + OnAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1080,10 +1047,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (OnAdmission is not null) yield return new KeyValuePair("onAdmission",OnAdmission); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_OnAdmission is not null) yield return new KeyValuePair("onAdmission",_OnAdmission); } } @@ -1110,13 +1077,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure instance identifier @@ -1125,13 +1092,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1145,39 +1109,36 @@ public int? Sequence [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// When the procedure was performed. /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1192,13 +1153,13 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; /// /// Unique device identifier. @@ -1210,27 +1171,23 @@ public Hl7.Fhir.Model.DataType Procedure [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1242,62 +1199,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1308,11 +1265,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -1340,13 +1297,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Insurance instance identifier @@ -1355,13 +1312,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1372,13 +1326,13 @@ public int? Sequence [FhirElement("focal", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -1387,13 +1341,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -1403,13 +1354,13 @@ public bool? Focal /// [FhirElement("identifier", Order=60, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Insurance information. @@ -1419,41 +1370,38 @@ public Hl7.Fhir.Model.Identifier Identifier [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -1466,24 +1414,24 @@ public string BusinessArrangement [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Prior authorization reference number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1497,31 +1445,27 @@ public IEnumerable PreAuthRef [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1533,76 +1477,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1613,13 +1557,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -1646,28 +1590,25 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("date", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the incident occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1678,13 +1619,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the event occurred. @@ -1694,27 +1635,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1726,48 +1663,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1778,9 +1715,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1807,13 +1744,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -1822,13 +1759,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1841,11 +1775,11 @@ public int? Sequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Applicable careTeam members. @@ -1855,24 +1789,24 @@ public List TraceNumber [DataMember] public List CareTeamSequenceElement { - get { if(_CareTeamSequenceElement==null) _CareTeamSequenceElement = new List(); return _CareTeamSequenceElement; } + get => _CareTeamSequenceElement ?? new List(); set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } - private List _CareTeamSequenceElement; + private List? _CareTeamSequenceElement; /// /// Applicable careTeam members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamSequence + public IEnumerable? CareTeamSequence { - get { return CareTeamSequenceElement != null ? CareTeamSequenceElement.Select(elem => elem.Value) : null; } + get => _CareTeamSequenceElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamSequenceElement = null; + CareTeamSequenceElement = null!; else CareTeamSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamSequence"); @@ -1887,24 +1821,24 @@ public IEnumerable CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get { if(_DiagnosisSequenceElement==null) _DiagnosisSequenceElement = new List(); return _DiagnosisSequenceElement; } + get => _DiagnosisSequenceElement ?? new List(); set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } - private List _DiagnosisSequenceElement; + private List? _DiagnosisSequenceElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisSequence + public IEnumerable? DiagnosisSequence { - get { return DiagnosisSequenceElement != null ? DiagnosisSequenceElement.Select(elem => elem.Value) : null; } + get => _DiagnosisSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisSequenceElement = null; + DiagnosisSequenceElement = null!; else DiagnosisSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisSequence"); @@ -1919,24 +1853,24 @@ public IEnumerable DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get { if(_ProcedureSequenceElement==null) _ProcedureSequenceElement = new List(); return _ProcedureSequenceElement; } + get => _ProcedureSequenceElement ?? new List(); set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } - private List _ProcedureSequenceElement; + private List? _ProcedureSequenceElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureSequence + public IEnumerable? ProcedureSequence { - get { return ProcedureSequenceElement != null ? ProcedureSequenceElement.Select(elem => elem.Value) : null; } + get => _ProcedureSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureSequenceElement = null; + ProcedureSequenceElement = null!; else ProcedureSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureSequence"); @@ -1951,24 +1885,24 @@ public IEnumerable ProcedureSequence [DataMember] public List InformationSequenceElement { - get { if(_InformationSequenceElement==null) _InformationSequenceElement = new List(); return _InformationSequenceElement; } + get => _InformationSequenceElement ?? new List(); set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } - private List _InformationSequenceElement; + private List? _InformationSequenceElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationSequence + public IEnumerable? InformationSequence { - get { return InformationSequenceElement != null ? InformationSequenceElement.Select(elem => elem.Value) : null; } + get => _InformationSequenceElement?.Select(elem => elem.Value); set { if (value == null) - InformationSequenceElement = null; + InformationSequenceElement = null!; else InformationSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationSequence"); @@ -1981,13 +1915,13 @@ public IEnumerable InformationSequence [FhirElement("revenue", Order=100)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -1995,13 +1929,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=110)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2009,13 +1943,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=120)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -2023,13 +1957,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=130)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Request or Referral for Service. @@ -2041,11 +1975,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Product or service billing modifiers. @@ -2056,11 +1990,11 @@ public List Request [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2071,11 +2005,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -2084,13 +2018,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -2101,65 +2035,65 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=200)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=210)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2168,13 +2102,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2184,26 +2115,26 @@ public decimal? Factor /// [FhirElement("tax", Order=230)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=240)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2215,11 +2146,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Anatomical location. @@ -2229,11 +2160,11 @@ public List Udi [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Encounters associated with the listed treatments. @@ -2245,11 +2176,11 @@ public List BodySite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Product or service provided. @@ -2259,47 +2190,43 @@ public List Encounter [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(CareTeamSequenceElement.Any()) dest.CareTeamSequenceElement = new List(CareTeamSequenceElement.DeepCopyInternal()); - if(DiagnosisSequenceElement.Any()) dest.DiagnosisSequenceElement = new List(DiagnosisSequenceElement.DeepCopyInternal()); - if(ProcedureSequenceElement.Any()) dest.ProcedureSequenceElement = new List(ProcedureSequenceElement.DeepCopyInternal()); - if(InformationSequenceElement.Any()) dest.InformationSequenceElement = new List(InformationSequenceElement.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_CareTeamSequenceElement is not null) dest.CareTeamSequenceElement = new List(_CareTeamSequenceElement.DeepCopyInternal()); + if(_DiagnosisSequenceElement is not null) dest.DiagnosisSequenceElement = new List(_DiagnosisSequenceElement.DeepCopyInternal()); + if(_ProcedureSequenceElement is not null) dest.ProcedureSequenceElement = new List(_ProcedureSequenceElement.DeepCopyInternal()); + if(_InformationSequenceElement is not null) dest.InformationSequenceElement = new List(_InformationSequenceElement.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2311,202 +2238,202 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.ListEquals(CareTeamSequenceElement, otherT.CareTeamSequenceElement)) return false; - if(!comparer.ListEquals(DiagnosisSequenceElement, otherT.DiagnosisSequenceElement)) return false; - if(!comparer.ListEquals(ProcedureSequenceElement, otherT.ProcedureSequenceElement)) return false; - if(!comparer.ListEquals(InformationSequenceElement, otherT.InformationSequenceElement)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; + if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; + if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; + if(!comparer.ListEquals(_InformationSequenceElement, otherT._InformationSequenceElement)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "careTeamSequence": - value = CareTeamSequenceElement; - return CareTeamSequenceElement?.Any() == true; + value = _CareTeamSequenceElement; + return _CareTeamSequenceElement?.Any() == true; case "diagnosisSequence": - value = DiagnosisSequenceElement; - return DiagnosisSequenceElement?.Any() == true; + value = _DiagnosisSequenceElement; + return _DiagnosisSequenceElement?.Any() == true; case "procedureSequence": - value = ProcedureSequenceElement; - return ProcedureSequenceElement?.Any() == true; + value = _ProcedureSequenceElement; + return _ProcedureSequenceElement?.Any() == true; case "informationSequence": - value = InformationSequenceElement; - return InformationSequenceElement?.Any() == true; + value = _InformationSequenceElement; + return _InformationSequenceElement?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "careTeamSequence": - CareTeamSequenceElement = (List)value; + CareTeamSequenceElement = (List?)value!; return this; case "diagnosisSequence": - DiagnosisSequenceElement = (List)value; + DiagnosisSequenceElement = (List?)value!; return this; case "procedureSequence": - ProcedureSequenceElement = (List)value; + ProcedureSequenceElement = (List?)value!; return this; case "informationSequence": - InformationSequenceElement = (List)value; + InformationSequenceElement = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2517,31 +2444,31 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",CareTeamSequenceElement); - if (DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",DiagnosisSequenceElement); - if (ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",ProcedureSequenceElement); - if (InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",InformationSequenceElement); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",_CareTeamSequenceElement); + if (_DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",_DiagnosisSequenceElement); + if (_ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",_ProcedureSequenceElement); + if (_InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",_InformationSequenceElement); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2571,11 +2498,11 @@ public partial class BodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Sub-location. @@ -2586,24 +2513,20 @@ public List Site [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; protected internal override void CopyToInternal(Base other) { - var dest = other as BodySiteComponent; - - if (dest == null) - { + if(other is not BodySiteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2615,41 +2538,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BodySiteComponent; - if(otherT == null) return false; + if(other is not BodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - Site = (List)value; + Site = (List?)value!; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2660,8 +2583,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); } } @@ -2688,13 +2611,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -2703,13 +2626,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -2722,11 +2642,11 @@ public int? Sequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -2734,13 +2654,13 @@ public List TraceNumber [FhirElement("revenue", Order=60)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -2748,13 +2668,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=70)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -2762,13 +2682,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=80)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -2776,13 +2696,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=90)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -2793,11 +2713,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -2808,63 +2728,63 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2873,13 +2793,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2889,26 +2806,26 @@ public decimal? Factor /// [FhirElement("tax", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2920,11 +2837,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Product or service provided. @@ -2934,38 +2851,34 @@ public List Udi [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2977,139 +2890,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3120,22 +3033,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -3162,13 +3075,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -3177,13 +3090,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -3196,11 +3106,11 @@ public int? Sequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -3208,13 +3118,13 @@ public List TraceNumber [FhirElement("revenue", Order=60)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -3222,13 +3132,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=70)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -3236,13 +3146,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=80)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -3250,13 +3160,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=90)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -3267,11 +3177,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -3282,63 +3192,63 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3347,13 +3257,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3363,26 +3270,26 @@ public decimal? Factor /// [FhirElement("tax", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -3394,37 +3301,33 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3436,132 +3339,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3572,21 +3475,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -3599,11 +3502,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Number for tracking. @@ -3613,11 +3516,11 @@ public List Identifier [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// active | cancelled | draft | entered-in-error. @@ -3627,13 +3530,13 @@ public List TraceNumber [Binding("ClaimStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -3642,13 +3545,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3660,13 +3560,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -3674,13 +3574,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=130, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -3690,13 +3590,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -3705,13 +3605,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -3724,26 +3621,26 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Relevant time frame for the claim. /// [FhirElement("billablePeriod", InSummary=true, Order=160, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Resource creation date. @@ -3751,28 +3648,25 @@ public Hl7.Fhir.Model.Period BillablePeriod [FhirElement("created", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Resource creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -3784,13 +3678,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Target. @@ -3799,13 +3693,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -3814,13 +3708,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Desired processing urgency. @@ -3828,13 +3722,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [FhirElement("priority", InSummary=true, Order=210)] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// For whom to reserve funds. @@ -3842,13 +3736,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("fundsReserve", Order=220)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Prior or corollary claims. @@ -3858,11 +3752,11 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services and products. @@ -3871,13 +3765,13 @@ public List Related [CLSCompliant(false)] [References("DeviceRequest","MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superseded by fulfiller. @@ -3886,26 +3780,26 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("DeviceRequest","MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Recipient of benefits payable. /// [FhirElement("payee", Order=260)] [DataMember] - public Hl7.Fhir.Model.Claim.PayeeComponent Payee + public Hl7.Fhir.Model.Claim.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.Claim.PayeeComponent _Payee; + private Hl7.Fhir.Model.Claim.PayeeComponent? _Payee; /// /// Treatment referral. @@ -3914,13 +3808,13 @@ public Hl7.Fhir.Model.Claim.PayeeComponent Payee [CLSCompliant(false)] [References("ServiceRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Encounters associated with the listed treatments. @@ -3932,11 +3826,11 @@ public Hl7.Fhir.Model.ResourceReference Referral [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Servicing facility. @@ -3945,13 +3839,13 @@ public List Encounter [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Package billing code. @@ -3959,13 +3853,13 @@ public Hl7.Fhir.Model.ResourceReference Facility [FhirElement("diagnosisRelatedGroup", Order=300)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DiagnosisRelatedGroup + public Hl7.Fhir.Model.CodeableConcept? DiagnosisRelatedGroup { get { return _DiagnosisRelatedGroup; } set { _DiagnosisRelatedGroup = value; OnPropertyChanged("DiagnosisRelatedGroup"); } } - private Hl7.Fhir.Model.CodeableConcept _DiagnosisRelatedGroup; + private Hl7.Fhir.Model.CodeableConcept? _DiagnosisRelatedGroup; /// /// Event information. @@ -3975,11 +3869,11 @@ public Hl7.Fhir.Model.CodeableConcept DiagnosisRelatedGroup [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Members of the care team. @@ -3989,11 +3883,11 @@ public List Event [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Supporting information. @@ -4003,11 +3897,11 @@ public List CareTeam [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Pertinent diagnosis information. @@ -4017,11 +3911,11 @@ public List SupportingInfo [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Clinical procedures performed. @@ -4031,11 +3925,11 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Patient insurance information. @@ -4045,37 +3939,37 @@ public List Procedure [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Details of the event. /// [FhirElement("accident", Order=370)] [DataMember] - public Hl7.Fhir.Model.Claim.AccidentComponent Accident + public Hl7.Fhir.Model.Claim.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.Claim.AccidentComponent _Accident; + private Hl7.Fhir.Model.Claim.AccidentComponent? _Accident; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=380)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Product or service provided. @@ -4085,69 +3979,65 @@ public Hl7.Fhir.Model.Money PatientPaid [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Total claim cost. /// [FhirElement("total", Order=400)] [DataMember] - public Hl7.Fhir.Model.Money Total + public Hl7.Fhir.Model.Money? Total { get { return _Total; } set { _Total = value; OnPropertyChanged("Total"); } } - private Hl7.Fhir.Model.Money _Total; + private Hl7.Fhir.Model.Money? _Total; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Claim; - - if (dest == null) - { + if(other is not Claim dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)Payee.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(DiagnosisRelatedGroup != null) dest.DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)DiagnosisRelatedGroup.DeepCopyInternal(); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)Accident.DeepCopyInternal(); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(Total != null) dest.Total = (Hl7.Fhir.Model.Money)Total.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_DiagnosisRelatedGroup is not null) dest.DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)_DiagnosisRelatedGroup.DeepCopyInternal(); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)_Accident.DeepCopyInternal(); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_Total is not null) dest.Total = (Hl7.Fhir.Model.Money)_Total.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4159,251 +4049,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Claim; - if(otherT == null) return false; + if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.Equals(DiagnosisRelatedGroup, otherT.DiagnosisRelatedGroup)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.Equals(Total, otherT.Total)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.Equals(_DiagnosisRelatedGroup, otherT._DiagnosisRelatedGroup)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Total, otherT._Total)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "diagnosisRelatedGroup": - value = DiagnosisRelatedGroup; - return DiagnosisRelatedGroup is not null; + value = _DiagnosisRelatedGroup; + return _DiagnosisRelatedGroup is not null; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "total": - value = Total; - return Total is not null; + value = _Total; + return _Total is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.Claim.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.Claim.PayeeComponent?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "diagnosisRelatedGroup": - DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)value; + DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "accident": - Accident = (Hl7.Fhir.Model.Claim.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.Claim.AccidentComponent?)value; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "total": - Total = (Hl7.Fhir.Model.Money)value; + Total = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -4414,38 +4304,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (DiagnosisRelatedGroup is not null) yield return new KeyValuePair("diagnosisRelatedGroup",DiagnosisRelatedGroup); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (Total is not null) yield return new KeyValuePair("total",Total); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_DiagnosisRelatedGroup is not null) yield return new KeyValuePair("diagnosisRelatedGroup",_DiagnosisRelatedGroup); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_Total is not null) yield return new KeyValuePair("total",_Total); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs index 53014dc7f..bbdec2131 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,13 +85,13 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [Binding("DatesType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Occurance date or period. @@ -98,26 +101,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -129,41 +128,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(When, otherT.When)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -174,8 +173,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (When is not null) yield return new KeyValuePair("when",When); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_When is not null) yield return new KeyValuePair("when",_When); } } @@ -202,13 +201,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("itemSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ItemSequenceElement + public Hl7.Fhir.Model.PositiveInt? ItemSequenceElement { get { return _ItemSequenceElement; } set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _ItemSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _ItemSequenceElement; /// /// Claim item instance identifier @@ -217,13 +216,10 @@ public Hl7.Fhir.Model.PositiveInt ItemSequenceElement [IgnoreDataMember] public int? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Value : null; } + get => _ItemSequenceElement?.Value; set { - if (value == null) - ItemSequenceElement = null; - else - ItemSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + ItemSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("ItemSequence"); } } @@ -236,11 +232,11 @@ public int? ItemSequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Applicable note numbers. @@ -250,24 +246,24 @@ public List TraceNumber [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -279,13 +275,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=70)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? _ReviewOutcome; /// /// Adjudication details. @@ -295,11 +291,11 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication for claim details. @@ -309,28 +305,24 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement != null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)ItemSequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)_ItemSequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -342,69 +334,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement is not null; + value = _ItemSequenceElement; + return _ItemSequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -415,12 +407,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -447,13 +439,13 @@ public partial class ReviewOutcomeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("decision", Order=40)] [Binding("AdjudicationDecision")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Decision + public Hl7.Fhir.Model.CodeableConcept? Decision { get { return _Decision; } set { _Decision = value; OnPropertyChanged("Decision"); } } - private Hl7.Fhir.Model.CodeableConcept _Decision; + private Hl7.Fhir.Model.CodeableConcept? _Decision; /// /// Reason for result of the adjudication. @@ -464,39 +456,36 @@ public Hl7.Fhir.Model.CodeableConcept Decision [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Preauthorization reference. /// [FhirElement("preAuthRef", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -506,28 +495,24 @@ public string PreAuthRef /// [FhirElement("preAuthPeriod", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period PreAuthPeriod + public Hl7.Fhir.Model.Period? PreAuthPeriod { get { return _PreAuthPeriod; } set { _PreAuthPeriod = value; OnPropertyChanged("PreAuthPeriod"); } } - private Hl7.Fhir.Model.Period _PreAuthPeriod; + private Hl7.Fhir.Model.Period? _PreAuthPeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as ReviewOutcomeComponent; - - if (dest == null) - { + if(other is not ReviewOutcomeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Decision != null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)Decision.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(PreAuthPeriod != null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)PreAuthPeriod.DeepCopyInternal(); + if(_Decision is not null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)_Decision.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_PreAuthPeriod is not null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)_PreAuthPeriod.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -539,55 +524,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReviewOutcomeComponent; - if(otherT == null) return false; + if(other is not ReviewOutcomeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Decision, otherT.Decision)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(PreAuthPeriod, otherT.PreAuthPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Decision, otherT._Decision)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_PreAuthPeriod, otherT._PreAuthPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "decision": - value = Decision; - return Decision is not null; + value = _Decision; + return _Decision is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "preAuthPeriod": - value = PreAuthPeriod; - return PreAuthPeriod is not null; + value = _PreAuthPeriod; + return _PreAuthPeriod is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "decision": - Decision = (Hl7.Fhir.Model.CodeableConcept)value; + Decision = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthPeriod": - PreAuthPeriod = (Hl7.Fhir.Model.Period)value; + PreAuthPeriod = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -598,10 +583,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Decision is not null) yield return new KeyValuePair("decision",Decision); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",PreAuthPeriod); + if (_Decision is not null) yield return new KeyValuePair("decision",_Decision); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",_PreAuthPeriod); } } @@ -629,13 +614,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of adjudication outcome. @@ -643,54 +628,50 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monetary value. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -702,55 +683,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -761,10 +742,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -791,13 +772,13 @@ public partial class ItemDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("detailSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? DetailSequenceElement { get { return _DetailSequenceElement; } set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DetailSequenceElement; /// /// Claim detail instance identifier @@ -806,13 +787,10 @@ public Hl7.Fhir.Model.PositiveInt DetailSequenceElement [IgnoreDataMember] public int? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Value : null; } + get => _DetailSequenceElement?.Value; set { - if (value == null) - DetailSequenceElement = null; - else - DetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DetailSequence"); } } @@ -825,11 +803,11 @@ public int? DetailSequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Applicable note numbers. @@ -839,24 +817,24 @@ public List TraceNumber [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -868,13 +846,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=70)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? _ReviewOutcome; /// /// Detail level adjudication details. @@ -884,11 +862,11 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication for claim sub-details. @@ -898,28 +876,24 @@ public List Adjudication [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemDetailComponent; - - if (dest == null) - { + if(other is not ItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DetailSequenceElement != null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)DetailSequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DetailSequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -931,69 +905,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemDetailComponent; - if(otherT == null) return false; + if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement is not null; + value = _DetailSequenceElement; + return _DetailSequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "detailSequence": - DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1004,12 +978,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -1036,13 +1010,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("subDetailSequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? SubDetailSequenceElement { get { return _SubDetailSequenceElement; } set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SubDetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SubDetailSequenceElement; /// /// Claim sub-detail instance identifier @@ -1051,13 +1025,10 @@ public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement [IgnoreDataMember] public int? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Value : null; } + get => _SubDetailSequenceElement?.Value; set { - if (value == null) - SubDetailSequenceElement = null; - else - SubDetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SubDetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SubDetailSequence"); } } @@ -1070,11 +1041,11 @@ public int? SubDetailSequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Applicable note numbers. @@ -1084,24 +1055,24 @@ public List TraceNumber [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1113,13 +1084,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=70)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? _ReviewOutcome; /// /// Subdetail level adjudication details. @@ -1129,27 +1100,23 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubDetailSequenceElement != null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)SubDetailSequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_SubDetailSequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1161,62 +1128,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement is not null; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subDetailSequence": - SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1227,11 +1194,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -1260,24 +1227,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get { if(_ItemSequenceElement==null) _ItemSequenceElement = new List(); return _ItemSequenceElement; } + get => _ItemSequenceElement ?? new List(); set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private List _ItemSequenceElement; + private List? _ItemSequenceElement; /// /// Item sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ItemSequence + public IEnumerable? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Select(elem => elem.Value) : null; } + get => _ItemSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ItemSequenceElement = null; + ItemSequenceElement = null!; else ItemSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ItemSequence"); @@ -1292,24 +1259,24 @@ public IEnumerable ItemSequence [DataMember] public List DetailSequenceElement { - get { if(_DetailSequenceElement==null) _DetailSequenceElement = new List(); return _DetailSequenceElement; } + get => _DetailSequenceElement ?? new List(); set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private List _DetailSequenceElement; + private List? _DetailSequenceElement; /// /// Detail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DetailSequence + public IEnumerable? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Select(elem => elem.Value) : null; } + get => _DetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DetailSequenceElement = null; + DetailSequenceElement = null!; else DetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DetailSequence"); @@ -1324,24 +1291,24 @@ public IEnumerable DetailSequence [DataMember] public List SubdetailSequenceElement { - get { if(_SubdetailSequenceElement==null) _SubdetailSequenceElement = new List(); return _SubdetailSequenceElement; } + get => _SubdetailSequenceElement ?? new List(); set { _SubdetailSequenceElement = value; OnPropertyChanged("SubdetailSequenceElement"); } } - private List _SubdetailSequenceElement; + private List? _SubdetailSequenceElement; /// /// Subdetail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubdetailSequence + public IEnumerable? SubdetailSequence { - get { return SubdetailSequenceElement != null ? SubdetailSequenceElement.Select(elem => elem.Value) : null; } + get => _SubdetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SubdetailSequenceElement = null; + SubdetailSequenceElement = null!; else SubdetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SubdetailSequence"); @@ -1356,11 +1323,11 @@ public IEnumerable SubdetailSequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Authorized providers. @@ -1372,11 +1339,11 @@ public List TraceNumber [DataMember] public List Provider { - get { if(_Provider==null) _Provider = new List(); return _Provider; } + get => _Provider ?? new List(); set { _Provider = value; OnPropertyChanged("Provider"); } } - private List _Provider; + private List? _Provider; /// /// Revenue or cost center code. @@ -1384,13 +1351,13 @@ public List Provider [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Billing, service, product, or drug code. @@ -1398,13 +1365,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("productOrService", Order=100)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -1412,13 +1379,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=110)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Request or Referral for Service. @@ -1430,11 +1397,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Service/Product billing modifiers. @@ -1445,11 +1412,11 @@ public List Request [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -1460,11 +1427,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -1473,13 +1440,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -1490,52 +1457,52 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Count of products or services. /// [FhirElement("quantity", Order=170)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=180)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -1544,13 +1511,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -1560,26 +1524,26 @@ public decimal? Factor /// [FhirElement("tax", Order=200)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=210)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Anatomical location. @@ -1589,11 +1553,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Applicable note numbers. @@ -1603,24 +1567,24 @@ public List BodySite [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -1632,13 +1596,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=240)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? _ReviewOutcome; /// /// Added items adjudication. @@ -1648,11 +1612,11 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line details. @@ -1662,45 +1626,41 @@ public List Adjudication [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement.Any()) dest.ItemSequenceElement = new List(ItemSequenceElement.DeepCopyInternal()); - if(DetailSequenceElement.Any()) dest.DetailSequenceElement = new List(DetailSequenceElement.DeepCopyInternal()); - if(SubdetailSequenceElement.Any()) dest.SubdetailSequenceElement = new List(SubdetailSequenceElement.DeepCopyInternal()); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Provider.Any()) dest.Provider = new List(Provider.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = new List(_ItemSequenceElement.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = new List(_DetailSequenceElement.DeepCopyInternal()); + if(_SubdetailSequenceElement is not null) dest.SubdetailSequenceElement = new List(_SubdetailSequenceElement.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = new List(_Provider.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1712,188 +1672,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(SubdetailSequenceElement, otherT.SubdetailSequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.ListEquals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_SubdetailSequenceElement, otherT._SubdetailSequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement?.Any() == true; + value = _ItemSequenceElement; + return _ItemSequenceElement?.Any() == true; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement?.Any() == true; + value = _DetailSequenceElement; + return _DetailSequenceElement?.Any() == true; case "subdetailSequence": - value = SubdetailSequenceElement; - return SubdetailSequenceElement?.Any() == true; + value = _SubdetailSequenceElement; + return _SubdetailSequenceElement?.Any() == true; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "provider": - value = Provider; - return Provider?.Any() == true; + value = _Provider; + return _Provider?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (List)value; + ItemSequenceElement = (List?)value!; return this; case "detailSequence": - DetailSequenceElement = (List)value; + DetailSequenceElement = (List?)value!; return this; case "subdetailSequence": - SubdetailSequenceElement = (List)value; + SubdetailSequenceElement = (List?)value!; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "provider": - Provider = (List)value; + Provider = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1904,29 +1864,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubdetailSequenceElement?.Any() == true) yield return new KeyValuePair("subdetailSequence",SubdetailSequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Provider?.Any() == true) yield return new KeyValuePair("provider",Provider); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubdetailSequenceElement?.Any() == true) yield return new KeyValuePair("subdetailSequence",_SubdetailSequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Provider?.Any() == true) yield return new KeyValuePair("provider",_Provider); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -1956,11 +1916,11 @@ public partial class BodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Sub-location. @@ -1971,24 +1931,20 @@ public List Site [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; protected internal override void CopyToInternal(Base other) { - var dest = other as BodySiteComponent; - - if (dest == null) - { + if(other is not BodySiteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2000,41 +1956,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BodySiteComponent; - if(otherT == null) return false; + if(other is not BodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - Site = (List)value; + Site = (List?)value!; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2045,8 +2001,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); } } @@ -2075,11 +2031,11 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -2087,13 +2043,13 @@ public List TraceNumber [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Billing, service, product, or drug code. @@ -2101,13 +2057,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("productOrService", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -2115,13 +2071,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -2132,50 +2088,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=90)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=100)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2184,13 +2140,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2200,26 +2153,26 @@ public decimal? Factor /// [FhirElement("tax", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -2229,24 +2182,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2258,13 +2211,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=150)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? _ReviewOutcome; /// /// Added items detail adjudication. @@ -2274,11 +2227,11 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -2288,36 +2241,32 @@ public List Adjudication [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2329,125 +2278,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2458,20 +2407,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -2500,11 +2449,11 @@ public partial class AddedItemSubDetailComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -2512,13 +2461,13 @@ public List TraceNumber [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Billing, service, product, or drug code. @@ -2526,13 +2475,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("productOrService", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -2540,13 +2489,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -2557,50 +2506,50 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Count of products or services. /// [FhirElement("quantity", Order=90)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=100)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2609,13 +2558,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2625,26 +2571,26 @@ public decimal? Factor /// [FhirElement("tax", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -2654,24 +2600,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2683,13 +2629,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=150)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? _ReviewOutcome; /// /// Added items subdetail adjudication. @@ -2699,35 +2645,31 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemSubDetailComponent; - - if (dest == null) - { + if(other is not AddedItemSubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2739,118 +2681,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemSubDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2861,19 +2803,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -2902,13 +2844,13 @@ public partial class TotalComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Financial total for the category. @@ -2916,26 +2858,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("amount", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as TotalComponent; - - if (dest == null) - { + if(other is not TotalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2947,41 +2885,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TotalComponent; - if(otherT == null) return false; + if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -2992,8 +2930,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -3021,26 +2959,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [Binding("PaymentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the adjustment. @@ -3048,41 +2986,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected date of payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected date of payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -3093,43 +3028,39 @@ public string Date [FhirElement("amount", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Business identifier for the payment. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3141,69 +3072,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -3214,12 +3145,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -3245,13 +3176,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Note instance identifier @@ -3260,13 +3191,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -3277,13 +3205,13 @@ public int? Number [FhirElement("type", Order=50)] [Binding("NoteType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Note explanatory text. @@ -3291,28 +3219,25 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("text", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -3323,28 +3248,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3356,55 +3277,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -3415,10 +3336,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -3446,13 +3367,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Insurance instance identifier @@ -3461,13 +3382,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -3478,13 +3396,13 @@ public int? Sequence [FhirElement("focal", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -3493,13 +3411,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -3512,41 +3427,38 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } @@ -3558,29 +3470,25 @@ public string BusinessArrangement [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3592,62 +3500,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -3658,11 +3566,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); } } @@ -3689,13 +3597,13 @@ public partial class ErrorComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("itemSequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ItemSequenceElement + public Hl7.Fhir.Model.PositiveInt? ItemSequenceElement { get { return _ItemSequenceElement; } set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _ItemSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _ItemSequenceElement; /// /// Item sequence number @@ -3704,13 +3612,10 @@ public Hl7.Fhir.Model.PositiveInt ItemSequenceElement [IgnoreDataMember] public int? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Value : null; } + get => _ItemSequenceElement?.Value; set { - if (value == null) - ItemSequenceElement = null; - else - ItemSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + ItemSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("ItemSequence"); } } @@ -3720,13 +3625,13 @@ public int? ItemSequence /// [FhirElement("detailSequence", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? DetailSequenceElement { get { return _DetailSequenceElement; } set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _DetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _DetailSequenceElement; /// /// Detail sequence number @@ -3735,13 +3640,10 @@ public Hl7.Fhir.Model.PositiveInt DetailSequenceElement [IgnoreDataMember] public int? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Value : null; } + get => _DetailSequenceElement?.Value; set { - if (value == null) - DetailSequenceElement = null; - else - DetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + DetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("DetailSequence"); } } @@ -3751,13 +3653,13 @@ public int? DetailSequence /// [FhirElement("subDetailSequence", Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement + public Hl7.Fhir.Model.PositiveInt? SubDetailSequenceElement { get { return _SubDetailSequenceElement; } set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SubDetailSequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SubDetailSequenceElement; /// /// Subdetail sequence number @@ -3766,13 +3668,10 @@ public Hl7.Fhir.Model.PositiveInt SubDetailSequenceElement [IgnoreDataMember] public int? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Value : null; } + get => _SubDetailSequenceElement?.Value; set { - if (value == null) - SubDetailSequenceElement = null; - else - SubDetailSequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SubDetailSequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("SubDetailSequence"); } } @@ -3784,13 +3683,13 @@ public int? SubDetailSequence [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// FHIRPath of element(s) related to issue. @@ -3800,24 +3699,24 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List ExpressionElement { - get { if(_ExpressionElement==null) _ExpressionElement = new List(); return _ExpressionElement; } + get => _ExpressionElement ?? new List(); set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private List _ExpressionElement; + private List? _ExpressionElement; /// /// FHIRPath of element(s) related to issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Expression + public IEnumerable? Expression { - get { return ExpressionElement != null ? ExpressionElement.Select(elem => elem.Value) : null; } + get => _ExpressionElement?.Select(elem => elem.Value); set { if (value == null) - ExpressionElement = null; + ExpressionElement = null!; else ExpressionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Expression"); @@ -3826,19 +3725,15 @@ public IEnumerable Expression protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorComponent; - - if (dest == null) - { + if(other is not ErrorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement != null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)ItemSequenceElement.DeepCopyInternal(); - if(DetailSequenceElement != null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)DetailSequenceElement.DeepCopyInternal(); - if(SubDetailSequenceElement != null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)SubDetailSequenceElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ExpressionElement.Any()) dest.ExpressionElement = new List(ExpressionElement.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)_ItemSequenceElement.DeepCopyInternal(); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_DetailSequenceElement.DeepCopyInternal(); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)_SubDetailSequenceElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = new List(_ExpressionElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3850,62 +3745,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorComponent; - if(otherT == null) return false; + if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.Equals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.Equals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement is not null; + value = _ItemSequenceElement; + return _ItemSequenceElement is not null; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement is not null; + value = _DetailSequenceElement; + return _DetailSequenceElement is not null; case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement is not null; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "expression": - value = ExpressionElement; - return ExpressionElement?.Any() == true; + value = _ExpressionElement; + return _ExpressionElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + ItemSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "detailSequence": - DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + DetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "subDetailSequence": - SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SubDetailSequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "expression": - ExpressionElement = (List)value; + ExpressionElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3916,11 +3811,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",ExpressionElement); + if (_ItemSequenceElement is not null) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement is not null) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubDetailSequenceElement is not null) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -3933,11 +3828,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Number for tracking. @@ -3947,11 +3842,11 @@ public List Identifier [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// active | cancelled | draft | entered-in-error. @@ -3961,13 +3856,13 @@ public List TraceNumber [Binding("ClaimResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -3976,13 +3871,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3994,13 +3886,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -4008,13 +3900,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=130, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -4024,13 +3916,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -4039,13 +3931,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -4058,13 +3947,13 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Response creation date. @@ -4072,28 +3961,25 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("created", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -4105,13 +3991,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -4120,13 +4006,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// Id of resource triggering adjudication. @@ -4135,13 +4021,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -4151,13 +4037,13 @@ public Hl7.Fhir.Model.ResourceReference Request [Binding("RemittanceOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -4166,13 +4052,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -4183,41 +4066,38 @@ public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome [FhirElement("decision", InSummary=true, Order=210)] [Binding("AdjudicationDecision")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Decision + public Hl7.Fhir.Model.CodeableConcept? Decision { get { return _Decision; } set { _Decision = value; OnPropertyChanged("Decision"); } } - private Hl7.Fhir.Model.CodeableConcept _Decision; + private Hl7.Fhir.Model.CodeableConcept? _Decision; /// /// Disposition Message. /// [FhirElement("disposition", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -4227,28 +4107,25 @@ public string Disposition /// [FhirElement("preAuthRef", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -4258,13 +4135,13 @@ public string PreAuthRef /// [FhirElement("preAuthPeriod", Order=240)] [DataMember] - public Hl7.Fhir.Model.Period PreAuthPeriod + public Hl7.Fhir.Model.Period? PreAuthPeriod { get { return _PreAuthPeriod; } set { _PreAuthPeriod = value; OnPropertyChanged("PreAuthPeriod"); } } - private Hl7.Fhir.Model.Period _PreAuthPeriod; + private Hl7.Fhir.Model.Period? _PreAuthPeriod; /// /// Event information. @@ -4274,11 +4151,11 @@ public Hl7.Fhir.Model.Period PreAuthPeriod [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Party to be paid any benefits payable. @@ -4286,13 +4163,13 @@ public List Event [FhirElement("payeeType", Order=260)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PayeeType + public Hl7.Fhir.Model.CodeableConcept? PayeeType { get { return _PayeeType; } set { _PayeeType = value; OnPropertyChanged("PayeeType"); } } - private Hl7.Fhir.Model.CodeableConcept _PayeeType; + private Hl7.Fhir.Model.CodeableConcept? _PayeeType; /// /// Encounters associated with the listed treatments. @@ -4304,11 +4181,11 @@ public Hl7.Fhir.Model.CodeableConcept PayeeType [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Package billing code. @@ -4316,13 +4193,13 @@ public List Encounter [FhirElement("diagnosisRelatedGroup", Order=280)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DiagnosisRelatedGroup + public Hl7.Fhir.Model.CodeableConcept? DiagnosisRelatedGroup { get { return _DiagnosisRelatedGroup; } set { _DiagnosisRelatedGroup = value; OnPropertyChanged("DiagnosisRelatedGroup"); } } - private Hl7.Fhir.Model.CodeableConcept _DiagnosisRelatedGroup; + private Hl7.Fhir.Model.CodeableConcept? _DiagnosisRelatedGroup; /// /// Adjudication for claim line items. @@ -4332,11 +4209,11 @@ public Hl7.Fhir.Model.CodeableConcept DiagnosisRelatedGroup [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -4346,11 +4223,11 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Header-level adjudication. @@ -4360,11 +4237,11 @@ public List AddItem [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication totals. @@ -4374,24 +4251,24 @@ public List Adjudication [DataMember] public List Total { - get { if(_Total==null) _Total = new List(); return _Total; } + get => _Total ?? new List(); set { _Total = value; OnPropertyChanged("Total"); } } - private List _Total; + private List? _Total; /// /// Payment Details. /// [FhirElement("payment", Order=330)] [DataMember] - public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment + public Hl7.Fhir.Model.ClaimResponse.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ClaimResponse.PaymentComponent _Payment; + private Hl7.Fhir.Model.ClaimResponse.PaymentComponent? _Payment; /// /// Funds reserved status. @@ -4399,13 +4276,13 @@ public Hl7.Fhir.Model.ClaimResponse.PaymentComponent Payment [FhirElement("fundsReserve", Order=340)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Printed form identifier. @@ -4413,26 +4290,26 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [FhirElement("formCode", Order=350)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Printed reference or actual form. /// [FhirElement("form", Order=360)] [DataMember] - public Hl7.Fhir.Model.Attachment Form + public Hl7.Fhir.Model.Attachment? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.Attachment _Form; + private Hl7.Fhir.Model.Attachment? _Form; /// /// Note concerning adjudication. @@ -4442,11 +4319,11 @@ public Hl7.Fhir.Model.Attachment Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// Request for additional information. @@ -4458,11 +4335,11 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get { if(_CommunicationRequest==null) _CommunicationRequest = new List(); return _CommunicationRequest; } + get => _CommunicationRequest ?? new List(); set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } - private List _CommunicationRequest; + private List? _CommunicationRequest; /// /// Patient insurance information. @@ -4472,11 +4349,11 @@ public List CommunicationRequest [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Processing errors. @@ -4486,56 +4363,52 @@ public List Insurance [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClaimResponse; - - if (dest == null) - { + if(other is not ClaimResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(Decision != null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)Decision.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(PreAuthPeriod != null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)PreAuthPeriod.DeepCopyInternal(); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(PayeeType != null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)PayeeType.DeepCopyInternal(); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(DiagnosisRelatedGroup != null) dest.DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)DiagnosisRelatedGroup.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Total.Any()) dest.Total = new List(Total.DeepCopyInternal()); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)Payment.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.Attachment)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(CommunicationRequest.Any()) dest.CommunicationRequest = new List(CommunicationRequest.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_Decision is not null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)_Decision.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_PreAuthPeriod is not null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)_PreAuthPeriod.DeepCopyInternal(); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_PayeeType is not null) dest.PayeeType = (Hl7.Fhir.Model.CodeableConcept)_PayeeType.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_DiagnosisRelatedGroup is not null) dest.DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)_DiagnosisRelatedGroup.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Total is not null) dest.Total = new List(_Total.DeepCopyInternal()); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)_Payment.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.Attachment)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_CommunicationRequest is not null) dest.CommunicationRequest = new List(_CommunicationRequest.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4547,251 +4420,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClaimResponse; - if(otherT == null) return false; + if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(Decision, otherT.Decision)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(PreAuthPeriod, otherT.PreAuthPeriod)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.Equals(PayeeType, otherT.PayeeType)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DiagnosisRelatedGroup, otherT.DiagnosisRelatedGroup)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Total, otherT.Total)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.ListEquals(CommunicationRequest, otherT.CommunicationRequest)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_Decision, otherT._Decision)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_PreAuthPeriod, otherT._PreAuthPeriod)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_PayeeType, otherT._PayeeType)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DiagnosisRelatedGroup, otherT._DiagnosisRelatedGroup)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Total, otherT._Total)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "decision": - value = Decision; - return Decision is not null; + value = _Decision; + return _Decision is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "preAuthPeriod": - value = PreAuthPeriod; - return PreAuthPeriod is not null; + value = _PreAuthPeriod; + return _PreAuthPeriod is not null; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "payeeType": - value = PayeeType; - return PayeeType is not null; + value = _PayeeType; + return _PayeeType is not null; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "diagnosisRelatedGroup": - value = DiagnosisRelatedGroup; - return DiagnosisRelatedGroup is not null; + value = _DiagnosisRelatedGroup; + return _DiagnosisRelatedGroup is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "total": - value = Total; - return Total?.Any() == true; + value = _Total; + return _Total?.Any() == true; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "communicationRequest": - value = CommunicationRequest; - return CommunicationRequest?.Any() == true; + value = _CommunicationRequest; + return _CommunicationRequest?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "decision": - Decision = (Hl7.Fhir.Model.CodeableConcept)value; + Decision = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthPeriod": - PreAuthPeriod = (Hl7.Fhir.Model.Period)value; + PreAuthPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "payeeType": - PayeeType = (Hl7.Fhir.Model.CodeableConcept)value; + PayeeType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "diagnosisRelatedGroup": - DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)value; + DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "total": - Total = (List)value; + Total = (List?)value!; return this; case "payment": - Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ClaimResponse.PaymentComponent?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "form": - Form = (Hl7.Fhir.Model.Attachment)value; + Form = (Hl7.Fhir.Model.Attachment?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "communicationRequest": - CommunicationRequest = (List)value; + CommunicationRequest = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4802,38 +4675,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (Decision is not null) yield return new KeyValuePair("decision",Decision); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",PreAuthPeriod); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (PayeeType is not null) yield return new KeyValuePair("payeeType",PayeeType); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (DiagnosisRelatedGroup is not null) yield return new KeyValuePair("diagnosisRelatedGroup",DiagnosisRelatedGroup); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Total?.Any() == true) yield return new KeyValuePair("total",Total); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",CommunicationRequest); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_Decision is not null) yield return new KeyValuePair("decision",_Decision); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",_PreAuthPeriod); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_PayeeType is not null) yield return new KeyValuePair("payeeType",_PayeeType); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_DiagnosisRelatedGroup is not null) yield return new KeyValuePair("diagnosisRelatedGroup",_DiagnosisRelatedGroup); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Total?.Any() == true) yield return new KeyValuePair("total",_Total); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_CommunicationRequest?.Any() == true) yield return new KeyValuePair("communicationRequest",_CommunicationRequest); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs index 3b1cb95fc..8659fb999 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,57 +84,50 @@ public partial class FindingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", Order=40)] [Binding("ConditionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// Which investigations support finding. /// [FhirElement("basis", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString BasisElement + public Hl7.Fhir.Model.FhirString? BasisElement { get { return _BasisElement; } set { _BasisElement = value; OnPropertyChanged("BasisElement"); } } - private Hl7.Fhir.Model.FhirString _BasisElement; + private Hl7.Fhir.Model.FhirString? _BasisElement; /// /// Which investigations support finding /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Basis + public string? Basis { - get { return BasisElement != null ? BasisElement.Value : null; } + get => _BasisElement?.Value; set { - if (value == null) - BasisElement = null; - else - BasisElement = new Hl7.Fhir.Model.FhirString(value); + BasisElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Basis"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FindingComponent; - - if (dest == null) - { + if(other is not FindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(BasisElement != null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)BasisElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_BasisElement is not null) dest.BasisElement = (Hl7.Fhir.Model.FhirString)_BasisElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,41 +139,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FindingComponent; - if(otherT == null) return false; + if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(BasisElement, otherT.BasisElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "basis": - value = BasisElement; - return BasisElement is not null; + value = _BasisElement; + return _BasisElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "basis": - BasisElement = (Hl7.Fhir.Model.FhirString)value; + BasisElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -188,8 +184,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (BasisElement is not null) yield return new KeyValuePair("basis",BasisElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_BasisElement is not null) yield return new KeyValuePair("basis",_BasisElement); } } @@ -202,11 +198,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -216,13 +212,13 @@ public List Identifier [Binding("ClinicalImpressionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -231,13 +227,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -248,41 +241,38 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("statusReason", Order=110)] [Binding("ClinicalImpressionStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Why/how the assessment was performed. /// [FhirElement("description", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why/how the assessment was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -295,13 +285,13 @@ public string Description [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The Encounter during which this ClinicalImpression was created. @@ -310,13 +300,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Time of assessment. @@ -325,41 +315,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the assessment was documented. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the assessment was documented /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -371,13 +358,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Reference to last assessment. @@ -386,13 +373,13 @@ public Hl7.Fhir.Model.ResourceReference Performer [CLSCompliant(false)] [References("ClinicalImpression")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Previous + public Hl7.Fhir.Model.ResourceReference? Previous { get { return _Previous; } set { _Previous = value; OnPropertyChanged("Previous"); } } - private Hl7.Fhir.Model.ResourceReference _Previous; + private Hl7.Fhir.Model.ResourceReference? _Previous; /// /// Relevant impressions of patient state. @@ -404,11 +391,11 @@ public Hl7.Fhir.Model.ResourceReference Previous [DataMember] public List Problem { - get { if(_Problem==null) _Problem = new List(); return _Problem; } + get => _Problem ?? new List(); set { _Problem = value; OnPropertyChanged("Problem"); } } - private List _Problem; + private List? _Problem; /// /// Change in the status/pattern of a subject's condition since previously assessed, such as worsening, improving, or no change. @@ -416,13 +403,13 @@ public List Problem [FhirElement("changePattern", Order=200)] [Binding("ClinicalImpressionChangePattern")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ChangePattern + public Hl7.Fhir.Model.CodeableConcept? ChangePattern { get { return _ChangePattern; } set { _ChangePattern = value; OnPropertyChanged("ChangePattern"); } } - private Hl7.Fhir.Model.CodeableConcept _ChangePattern; + private Hl7.Fhir.Model.CodeableConcept? _ChangePattern; /// /// Clinical Protocol followed. @@ -432,24 +419,24 @@ public Hl7.Fhir.Model.CodeableConcept ChangePattern [DataMember] public List ProtocolElement { - get { if(_ProtocolElement==null) _ProtocolElement = new List(); return _ProtocolElement; } + get => _ProtocolElement ?? new List(); set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } - private List _ProtocolElement; + private List? _ProtocolElement; /// /// Clinical Protocol followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Protocol + public IEnumerable? Protocol { - get { return ProtocolElement != null ? ProtocolElement.Select(elem => elem.Value) : null; } + get => _ProtocolElement?.Select(elem => elem.Value); set { if (value == null) - ProtocolElement = null; + ProtocolElement = null!; else ProtocolElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Protocol"); @@ -461,28 +448,25 @@ public IEnumerable Protocol /// [FhirElement("summary", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString SummaryElement + public Hl7.Fhir.Model.FhirString? SummaryElement { get { return _SummaryElement; } set { _SummaryElement = value; OnPropertyChanged("SummaryElement"); } } - private Hl7.Fhir.Model.FhirString _SummaryElement; + private Hl7.Fhir.Model.FhirString? _SummaryElement; /// /// Summary of the assessment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Summary + public string? Summary { - get { return SummaryElement != null ? SummaryElement.Value : null; } + get => _SummaryElement?.Value; set { - if (value == null) - SummaryElement = null; - else - SummaryElement = new Hl7.Fhir.Model.FhirString(value); + SummaryElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Summary"); } } @@ -495,11 +479,11 @@ public string Summary [DataMember] public List Finding { - get { if(_Finding==null) _Finding = new List(); return _Finding; } + get => _Finding ?? new List(); set { _Finding = value; OnPropertyChanged("Finding"); } } - private List _Finding; + private List? _Finding; /// /// Estimate of likely outcome. @@ -510,11 +494,11 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get { if(_PrognosisCodeableConcept==null) _PrognosisCodeableConcept = new List(); return _PrognosisCodeableConcept; } + get => _PrognosisCodeableConcept ?? new List(); set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } - private List _PrognosisCodeableConcept; + private List? _PrognosisCodeableConcept; /// /// RiskAssessment expressing likely outcome. @@ -526,11 +510,11 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get { if(_PrognosisReference==null) _PrognosisReference = new List(); return _PrognosisReference; } + get => _PrognosisReference ?? new List(); set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } - private List _PrognosisReference; + private List? _PrognosisReference; /// /// Information supporting the clinical impression. @@ -542,11 +526,11 @@ public List PrognosisReference [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Comments made about the ClinicalImpression. @@ -556,43 +540,39 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClinicalImpression; - - if (dest == null) - { + if(other is not ClinicalImpression dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Previous != null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)Previous.DeepCopyInternal(); - if(Problem.Any()) dest.Problem = new List(Problem.DeepCopyInternal()); - if(ChangePattern != null) dest.ChangePattern = (Hl7.Fhir.Model.CodeableConcept)ChangePattern.DeepCopyInternal(); - if(ProtocolElement.Any()) dest.ProtocolElement = new List(ProtocolElement.DeepCopyInternal()); - if(SummaryElement != null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)SummaryElement.DeepCopyInternal(); - if(Finding.Any()) dest.Finding = new List(Finding.DeepCopyInternal()); - if(PrognosisCodeableConcept.Any()) dest.PrognosisCodeableConcept = new List(PrognosisCodeableConcept.DeepCopyInternal()); - if(PrognosisReference.Any()) dest.PrognosisReference = new List(PrognosisReference.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Previous is not null) dest.Previous = (Hl7.Fhir.Model.ResourceReference)_Previous.DeepCopyInternal(); + if(_Problem is not null) dest.Problem = new List(_Problem.DeepCopyInternal()); + if(_ChangePattern is not null) dest.ChangePattern = (Hl7.Fhir.Model.CodeableConcept)_ChangePattern.DeepCopyInternal(); + if(_ProtocolElement is not null) dest.ProtocolElement = new List(_ProtocolElement.DeepCopyInternal()); + if(_SummaryElement is not null) dest.SummaryElement = (Hl7.Fhir.Model.FhirString)_SummaryElement.DeepCopyInternal(); + if(_Finding is not null) dest.Finding = new List(_Finding.DeepCopyInternal()); + if(_PrognosisCodeableConcept is not null) dest.PrognosisCodeableConcept = new List(_PrognosisCodeableConcept.DeepCopyInternal()); + if(_PrognosisReference is not null) dest.PrognosisReference = new List(_PrognosisReference.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -604,160 +584,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClinicalImpression; - if(otherT == null) return false; + if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Previous, otherT.Previous)) return false; - if(!comparer.ListEquals(Problem, otherT.Problem)) return false; - if(!comparer.Equals(ChangePattern, otherT.ChangePattern)) return false; - if(!comparer.ListEquals(ProtocolElement, otherT.ProtocolElement)) return false; - if(!comparer.Equals(SummaryElement, otherT.SummaryElement)) return false; - if(!comparer.ListEquals(Finding, otherT.Finding)) return false; - if(!comparer.ListEquals(PrognosisCodeableConcept, otherT.PrognosisCodeableConcept)) return false; - if(!comparer.ListEquals(PrognosisReference, otherT.PrognosisReference)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Previous, otherT._Previous)) return false; + if(!comparer.ListEquals(_Problem, otherT._Problem)) return false; + if(!comparer.Equals(_ChangePattern, otherT._ChangePattern)) return false; + if(!comparer.ListEquals(_ProtocolElement, otherT._ProtocolElement)) return false; + if(!comparer.Equals(_SummaryElement, otherT._SummaryElement)) return false; + if(!comparer.ListEquals(_Finding, otherT._Finding)) return false; + if(!comparer.ListEquals(_PrognosisCodeableConcept, otherT._PrognosisCodeableConcept)) return false; + if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "previous": - value = Previous; - return Previous is not null; + value = _Previous; + return _Previous is not null; case "problem": - value = Problem; - return Problem?.Any() == true; + value = _Problem; + return _Problem?.Any() == true; case "changePattern": - value = ChangePattern; - return ChangePattern is not null; + value = _ChangePattern; + return _ChangePattern is not null; case "protocol": - value = ProtocolElement; - return ProtocolElement?.Any() == true; + value = _ProtocolElement; + return _ProtocolElement?.Any() == true; case "summary": - value = SummaryElement; - return SummaryElement is not null; + value = _SummaryElement; + return _SummaryElement is not null; case "finding": - value = Finding; - return Finding?.Any() == true; + value = _Finding; + return _Finding?.Any() == true; case "prognosisCodeableConcept": - value = PrognosisCodeableConcept; - return PrognosisCodeableConcept?.Any() == true; + value = _PrognosisCodeableConcept; + return _PrognosisCodeableConcept?.Any() == true; case "prognosisReference": - value = PrognosisReference; - return PrognosisReference?.Any() == true; + value = _PrognosisReference; + return _PrognosisReference?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "previous": - Previous = (Hl7.Fhir.Model.ResourceReference)value; + Previous = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "problem": - Problem = (List)value; + Problem = (List?)value!; return this; case "changePattern": - ChangePattern = (Hl7.Fhir.Model.CodeableConcept)value; + ChangePattern = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "protocol": - ProtocolElement = (List)value; + ProtocolElement = (List?)value!; return this; case "summary": - SummaryElement = (Hl7.Fhir.Model.FhirString)value; + SummaryElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "finding": - Finding = (List)value; + Finding = (List?)value!; return this; case "prognosisCodeableConcept": - PrognosisCodeableConcept = (List)value; + PrognosisCodeableConcept = (List?)value!; return this; case "prognosisReference": - PrognosisReference = (List)value; + PrognosisReference = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -768,25 +748,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Previous is not null) yield return new KeyValuePair("previous",Previous); - if (Problem?.Any() == true) yield return new KeyValuePair("problem",Problem); - if (ChangePattern is not null) yield return new KeyValuePair("changePattern",ChangePattern); - if (ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",ProtocolElement); - if (SummaryElement is not null) yield return new KeyValuePair("summary",SummaryElement); - if (Finding?.Any() == true) yield return new KeyValuePair("finding",Finding); - if (PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",PrognosisCodeableConcept); - if (PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",PrognosisReference); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Previous is not null) yield return new KeyValuePair("previous",_Previous); + if (_Problem?.Any() == true) yield return new KeyValuePair("problem",_Problem); + if (_ChangePattern is not null) yield return new KeyValuePair("changePattern",_ChangePattern); + if (_ProtocolElement?.Any() == true) yield return new KeyValuePair("protocol",_ProtocolElement); + if (_SummaryElement is not null) yield return new KeyValuePair("summary",_SummaryElement); + if (_Finding?.Any() == true) yield return new KeyValuePair("finding",_Finding); + if (_PrognosisCodeableConcept?.Any() == true) yield return new KeyValuePair("prognosisCodeableConcept",_PrognosisCodeableConcept); + if (_PrognosisReference?.Any() == true) yield return new KeyValuePair("prognosisReference",_PrognosisReference); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs index 6cc43403e..bed951801 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,13 +118,13 @@ public partial class ContraindicationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("diseaseSymptomProcedure", InSummary=true, Order=40)] [Binding("DiseaseSymptomProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure + public Hl7.Fhir.Model.CodeableReference? DiseaseSymptomProcedure { get { return _DiseaseSymptomProcedure; } set { _DiseaseSymptomProcedure = value; OnPropertyChanged("DiseaseSymptomProcedure"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseSymptomProcedure; + private Hl7.Fhir.Model.CodeableReference? _DiseaseSymptomProcedure; /// /// The status of the disease or symptom for the contraindication. @@ -129,13 +132,13 @@ public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure [FhirElement("diseaseStatus", InSummary=true, Order=50)] [Binding("DiseaseStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseStatus + public Hl7.Fhir.Model.CodeableReference? DiseaseStatus { get { return _DiseaseStatus; } set { _DiseaseStatus = value; OnPropertyChanged("DiseaseStatus"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseStatus; + private Hl7.Fhir.Model.CodeableReference? _DiseaseStatus; /// /// A comorbidity (concurrent condition) or coinfection. @@ -146,11 +149,11 @@ public Hl7.Fhir.Model.CodeableReference DiseaseStatus [DataMember] public List Comorbidity { - get { if(_Comorbidity==null) _Comorbidity = new List(); return _Comorbidity; } + get => _Comorbidity ?? new List(); set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } - private List _Comorbidity; + private List? _Comorbidity; /// /// The indication which this is a contraidication for. @@ -162,24 +165,24 @@ public List Comorbidity [DataMember] public List Indication { - get { if(_Indication==null) _Indication = new List(); return _Indication; } + get => _Indication ?? new List(); set { _Indication = value; OnPropertyChanged("Indication"); } } - private List _Indication; + private List? _Indication; /// /// An expression that returns true or false, indicating whether the indication is applicable or not, after having applied its other elements. /// [FhirElement("applicability", Order=80)] [DataMember] - public Hl7.Fhir.Model.Expression Applicability + public Hl7.Fhir.Model.Expression? Applicability { get { return _Applicability; } set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private Hl7.Fhir.Model.Expression _Applicability; + private Hl7.Fhir.Model.Expression? _Applicability; /// /// Information about use of the product in relation to other therapies described as part of the contraindication. @@ -189,28 +192,24 @@ public Hl7.Fhir.Model.Expression Applicability [DataMember] public List OtherTherapy { - get { if(_OtherTherapy==null) _OtherTherapy = new List(); return _OtherTherapy; } + get => _OtherTherapy ?? new List(); set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } - private List _OtherTherapy; + private List? _OtherTherapy; protected internal override void CopyToInternal(Base other) { - var dest = other as ContraindicationComponent; - - if (dest == null) - { + if(other is not ContraindicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DiseaseSymptomProcedure != null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)DiseaseSymptomProcedure.DeepCopyInternal(); - if(DiseaseStatus != null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)DiseaseStatus.DeepCopyInternal(); - if(Comorbidity.Any()) dest.Comorbidity = new List(Comorbidity.DeepCopyInternal()); - if(Indication.Any()) dest.Indication = new List(Indication.DeepCopyInternal()); - if(Applicability != null) dest.Applicability = (Hl7.Fhir.Model.Expression)Applicability.DeepCopyInternal(); - if(OtherTherapy.Any()) dest.OtherTherapy = new List(OtherTherapy.DeepCopyInternal()); + if(_DiseaseSymptomProcedure is not null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)_DiseaseSymptomProcedure.DeepCopyInternal(); + if(_DiseaseStatus is not null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)_DiseaseStatus.DeepCopyInternal(); + if(_Comorbidity is not null) dest.Comorbidity = new List(_Comorbidity.DeepCopyInternal()); + if(_Indication is not null) dest.Indication = new List(_Indication.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = (Hl7.Fhir.Model.Expression)_Applicability.DeepCopyInternal(); + if(_OtherTherapy is not null) dest.OtherTherapy = new List(_OtherTherapy.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -222,69 +221,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContraindicationComponent; - if(otherT == null) return false; + if(other is not ContraindicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DiseaseSymptomProcedure, otherT.DiseaseSymptomProcedure)) return false; - if(!comparer.Equals(DiseaseStatus, otherT.DiseaseStatus)) return false; - if(!comparer.ListEquals(Comorbidity, otherT.Comorbidity)) return false; - if(!comparer.ListEquals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(OtherTherapy, otherT.OtherTherapy)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; + if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; + if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "diseaseSymptomProcedure": - value = DiseaseSymptomProcedure; - return DiseaseSymptomProcedure is not null; + value = _DiseaseSymptomProcedure; + return _DiseaseSymptomProcedure is not null; case "diseaseStatus": - value = DiseaseStatus; - return DiseaseStatus is not null; + value = _DiseaseStatus; + return _DiseaseStatus is not null; case "comorbidity": - value = Comorbidity; - return Comorbidity?.Any() == true; + value = _Comorbidity; + return _Comorbidity?.Any() == true; case "indication": - value = Indication; - return Indication?.Any() == true; + value = _Indication; + return _Indication?.Any() == true; case "applicability": - value = Applicability; - return Applicability is not null; + value = _Applicability; + return _Applicability is not null; case "otherTherapy": - value = OtherTherapy; - return OtherTherapy?.Any() == true; + value = _OtherTherapy; + return _OtherTherapy?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "diseaseSymptomProcedure": - DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "diseaseStatus": - DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseStatus = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "comorbidity": - Comorbidity = (List)value; + Comorbidity = (List?)value!; return this; case "indication": - Indication = (List)value; + Indication = (List?)value!; return this; case "applicability": - Applicability = (Hl7.Fhir.Model.Expression)value; + Applicability = (Hl7.Fhir.Model.Expression?)value; return this; case "otherTherapy": - OtherTherapy = (List)value; + OtherTherapy = (List?)value!; return this; default: return base.SetValue(key, value); @@ -295,12 +294,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",DiseaseSymptomProcedure); - if (DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",DiseaseStatus); - if (Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",Comorbidity); - if (Indication?.Any() == true) yield return new KeyValuePair("indication",Indication); - if (Applicability is not null) yield return new KeyValuePair("applicability",Applicability); - if (OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",OtherTherapy); + if (_DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",_DiseaseSymptomProcedure); + if (_DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",_DiseaseStatus); + if (_Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",_Comorbidity); + if (_Indication?.Any() == true) yield return new KeyValuePair("indication",_Indication); + if (_Applicability is not null) yield return new KeyValuePair("applicability",_Applicability); + if (_OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",_OtherTherapy); } } @@ -328,13 +327,13 @@ public partial class OtherTherapyComponent : Hl7.Fhir.Model.BackboneElement [Binding("TherapyRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RelationshipType + public Hl7.Fhir.Model.CodeableConcept? RelationshipType { get { return _RelationshipType; } set { _RelationshipType = value; OnPropertyChanged("RelationshipType"); } } - private Hl7.Fhir.Model.CodeableConcept _RelationshipType; + private Hl7.Fhir.Model.CodeableConcept? _RelationshipType; /// /// Reference to a specific medication, substance etc. as part of an indication or contraindication. @@ -343,26 +342,22 @@ public Hl7.Fhir.Model.CodeableConcept RelationshipType [Binding("Therapy")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Treatment + public Hl7.Fhir.Model.CodeableReference? Treatment { get { return _Treatment; } set { _Treatment = value; OnPropertyChanged("Treatment"); } } - private Hl7.Fhir.Model.CodeableReference _Treatment; + private Hl7.Fhir.Model.CodeableReference? _Treatment; protected internal override void CopyToInternal(Base other) { - var dest = other as OtherTherapyComponent; - - if (dest == null) - { + if(other is not OtherTherapyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RelationshipType != null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)RelationshipType.DeepCopyInternal(); - if(Treatment != null) dest.Treatment = (Hl7.Fhir.Model.CodeableReference)Treatment.DeepCopyInternal(); + if(_RelationshipType is not null) dest.RelationshipType = (Hl7.Fhir.Model.CodeableConcept)_RelationshipType.DeepCopyInternal(); + if(_Treatment is not null) dest.Treatment = (Hl7.Fhir.Model.CodeableReference)_Treatment.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -374,41 +369,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherTherapyComponent; - if(otherT == null) return false; + if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RelationshipType, otherT.RelationshipType)) return false; - if(!comparer.Equals(Treatment, otherT.Treatment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + if(!comparer.Equals(_Treatment, otherT._Treatment)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationshipType": - value = RelationshipType; - return RelationshipType is not null; + value = _RelationshipType; + return _RelationshipType is not null; case "treatment": - value = Treatment; - return Treatment is not null; + value = _Treatment; + return _Treatment is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationshipType": - RelationshipType = (Hl7.Fhir.Model.CodeableConcept)value; + RelationshipType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "treatment": - Treatment = (Hl7.Fhir.Model.CodeableReference)value; + Treatment = (Hl7.Fhir.Model.CodeableReference?)value; return this; default: return base.SetValue(key, value); @@ -419,8 +414,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RelationshipType is not null) yield return new KeyValuePair("relationshipType",RelationshipType); - if (Treatment is not null) yield return new KeyValuePair("treatment",Treatment); + if (_RelationshipType is not null) yield return new KeyValuePair("relationshipType",_RelationshipType); + if (_Treatment is not null) yield return new KeyValuePair("treatment",_Treatment); } } @@ -444,13 +439,13 @@ public partial class IndicationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("diseaseSymptomProcedure", InSummary=true, Order=40)] [Binding("DiseaseSymptomProcedure")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure + public Hl7.Fhir.Model.CodeableReference? DiseaseSymptomProcedure { get { return _DiseaseSymptomProcedure; } set { _DiseaseSymptomProcedure = value; OnPropertyChanged("DiseaseSymptomProcedure"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseSymptomProcedure; + private Hl7.Fhir.Model.CodeableReference? _DiseaseSymptomProcedure; /// /// The status of the disease or symptom for the indication. @@ -458,13 +453,13 @@ public Hl7.Fhir.Model.CodeableReference DiseaseSymptomProcedure [FhirElement("diseaseStatus", InSummary=true, Order=50)] [Binding("DiseaseStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableReference DiseaseStatus + public Hl7.Fhir.Model.CodeableReference? DiseaseStatus { get { return _DiseaseStatus; } set { _DiseaseStatus = value; OnPropertyChanged("DiseaseStatus"); } } - private Hl7.Fhir.Model.CodeableReference _DiseaseStatus; + private Hl7.Fhir.Model.CodeableReference? _DiseaseStatus; /// /// A comorbidity or coinfection as part of the indication. @@ -475,11 +470,11 @@ public Hl7.Fhir.Model.CodeableReference DiseaseStatus [DataMember] public List Comorbidity { - get { if(_Comorbidity==null) _Comorbidity = new List(); return _Comorbidity; } + get => _Comorbidity ?? new List(); set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } - private List _Comorbidity; + private List? _Comorbidity; /// /// The intended effect, aim or strategy to be achieved. @@ -487,13 +482,13 @@ public List Comorbidity [FhirElement("intendedEffect", InSummary=true, Order=70)] [Binding("ProductIntendedUse")] [DataMember] - public Hl7.Fhir.Model.CodeableReference IntendedEffect + public Hl7.Fhir.Model.CodeableReference? IntendedEffect { get { return _IntendedEffect; } set { _IntendedEffect = value; OnPropertyChanged("IntendedEffect"); } } - private Hl7.Fhir.Model.CodeableReference _IntendedEffect; + private Hl7.Fhir.Model.CodeableReference? _IntendedEffect; /// /// Timing or duration information. @@ -502,13 +497,13 @@ public Hl7.Fhir.Model.CodeableReference IntendedEffect [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Duration + public Hl7.Fhir.Model.DataType? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.DataType _Duration; + private Hl7.Fhir.Model.DataType? _Duration; /// /// An unwanted side effect or negative outcome of the subject of this resource when being used for this indication. @@ -520,24 +515,24 @@ public Hl7.Fhir.Model.DataType Duration [DataMember] public List UndesirableEffect { - get { if(_UndesirableEffect==null) _UndesirableEffect = new List(); return _UndesirableEffect; } + get => _UndesirableEffect ?? new List(); set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } - private List _UndesirableEffect; + private List? _UndesirableEffect; /// /// An expression that returns true or false, indicating whether the indication is applicable or not, after having applied its other elements. /// [FhirElement("applicability", Order=100)] [DataMember] - public Hl7.Fhir.Model.Expression Applicability + public Hl7.Fhir.Model.Expression? Applicability { get { return _Applicability; } set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private Hl7.Fhir.Model.Expression _Applicability; + private Hl7.Fhir.Model.Expression? _Applicability; /// /// The use of the medicinal product in relation to other therapies described as part of the indication. @@ -547,30 +542,26 @@ public Hl7.Fhir.Model.Expression Applicability [DataMember] public List OtherTherapy { - get { if(_OtherTherapy==null) _OtherTherapy = new List(); return _OtherTherapy; } + get => _OtherTherapy ?? new List(); set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } - private List _OtherTherapy; + private List? _OtherTherapy; protected internal override void CopyToInternal(Base other) { - var dest = other as IndicationComponent; - - if (dest == null) - { + if(other is not IndicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DiseaseSymptomProcedure != null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)DiseaseSymptomProcedure.DeepCopyInternal(); - if(DiseaseStatus != null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)DiseaseStatus.DeepCopyInternal(); - if(Comorbidity.Any()) dest.Comorbidity = new List(Comorbidity.DeepCopyInternal()); - if(IntendedEffect != null) dest.IntendedEffect = (Hl7.Fhir.Model.CodeableReference)IntendedEffect.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.DataType)Duration.DeepCopyInternal(); - if(UndesirableEffect.Any()) dest.UndesirableEffect = new List(UndesirableEffect.DeepCopyInternal()); - if(Applicability != null) dest.Applicability = (Hl7.Fhir.Model.Expression)Applicability.DeepCopyInternal(); - if(OtherTherapy.Any()) dest.OtherTherapy = new List(OtherTherapy.DeepCopyInternal()); + if(_DiseaseSymptomProcedure is not null) dest.DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)_DiseaseSymptomProcedure.DeepCopyInternal(); + if(_DiseaseStatus is not null) dest.DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)_DiseaseStatus.DeepCopyInternal(); + if(_Comorbidity is not null) dest.Comorbidity = new List(_Comorbidity.DeepCopyInternal()); + if(_IntendedEffect is not null) dest.IntendedEffect = (Hl7.Fhir.Model.CodeableReference)_IntendedEffect.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.DataType)_Duration.DeepCopyInternal(); + if(_UndesirableEffect is not null) dest.UndesirableEffect = new List(_UndesirableEffect.DeepCopyInternal()); + if(_Applicability is not null) dest.Applicability = (Hl7.Fhir.Model.Expression)_Applicability.DeepCopyInternal(); + if(_OtherTherapy is not null) dest.OtherTherapy = new List(_OtherTherapy.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -582,83 +573,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IndicationComponent; - if(otherT == null) return false; + if(other is not IndicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DiseaseSymptomProcedure, otherT.DiseaseSymptomProcedure)) return false; - if(!comparer.Equals(DiseaseStatus, otherT.DiseaseStatus)) return false; - if(!comparer.ListEquals(Comorbidity, otherT.Comorbidity)) return false; - if(!comparer.Equals(IntendedEffect, otherT.IntendedEffect)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.ListEquals(UndesirableEffect, otherT.UndesirableEffect)) return false; - if(!comparer.Equals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(OtherTherapy, otherT.OtherTherapy)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; + if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; + if(!comparer.Equals(_IntendedEffect, otherT._IntendedEffect)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.ListEquals(_UndesirableEffect, otherT._UndesirableEffect)) return false; + if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "diseaseSymptomProcedure": - value = DiseaseSymptomProcedure; - return DiseaseSymptomProcedure is not null; + value = _DiseaseSymptomProcedure; + return _DiseaseSymptomProcedure is not null; case "diseaseStatus": - value = DiseaseStatus; - return DiseaseStatus is not null; + value = _DiseaseStatus; + return _DiseaseStatus is not null; case "comorbidity": - value = Comorbidity; - return Comorbidity?.Any() == true; + value = _Comorbidity; + return _Comorbidity?.Any() == true; case "intendedEffect": - value = IntendedEffect; - return IntendedEffect is not null; + value = _IntendedEffect; + return _IntendedEffect is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "undesirableEffect": - value = UndesirableEffect; - return UndesirableEffect?.Any() == true; + value = _UndesirableEffect; + return _UndesirableEffect?.Any() == true; case "applicability": - value = Applicability; - return Applicability is not null; + value = _Applicability; + return _Applicability is not null; case "otherTherapy": - value = OtherTherapy; - return OtherTherapy?.Any() == true; + value = _OtherTherapy; + return _OtherTherapy?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "diseaseSymptomProcedure": - DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseSymptomProcedure = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "diseaseStatus": - DiseaseStatus = (Hl7.Fhir.Model.CodeableReference)value; + DiseaseStatus = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "comorbidity": - Comorbidity = (List)value; + Comorbidity = (List?)value!; return this; case "intendedEffect": - IntendedEffect = (Hl7.Fhir.Model.CodeableReference)value; + IntendedEffect = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.DataType)value; + Duration = (Hl7.Fhir.Model.DataType?)value; return this; case "undesirableEffect": - UndesirableEffect = (List)value; + UndesirableEffect = (List?)value!; return this; case "applicability": - Applicability = (Hl7.Fhir.Model.Expression)value; + Applicability = (Hl7.Fhir.Model.Expression?)value; return this; case "otherTherapy": - OtherTherapy = (List)value; + OtherTherapy = (List?)value!; return this; default: return base.SetValue(key, value); @@ -669,14 +660,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",DiseaseSymptomProcedure); - if (DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",DiseaseStatus); - if (Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",Comorbidity); - if (IntendedEffect is not null) yield return new KeyValuePair("intendedEffect",IntendedEffect); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (UndesirableEffect?.Any() == true) yield return new KeyValuePair("undesirableEffect",UndesirableEffect); - if (Applicability is not null) yield return new KeyValuePair("applicability",Applicability); - if (OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",OtherTherapy); + if (_DiseaseSymptomProcedure is not null) yield return new KeyValuePair("diseaseSymptomProcedure",_DiseaseSymptomProcedure); + if (_DiseaseStatus is not null) yield return new KeyValuePair("diseaseStatus",_DiseaseStatus); + if (_Comorbidity?.Any() == true) yield return new KeyValuePair("comorbidity",_Comorbidity); + if (_IntendedEffect is not null) yield return new KeyValuePair("intendedEffect",_IntendedEffect); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_UndesirableEffect?.Any() == true) yield return new KeyValuePair("undesirableEffect",_UndesirableEffect); + if (_Applicability is not null) yield return new KeyValuePair("applicability",_Applicability); + if (_OtherTherapy?.Any() == true) yield return new KeyValuePair("otherTherapy",_OtherTherapy); } } @@ -702,11 +693,11 @@ public partial class InteractionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Interactant { - get { if(_Interactant==null) _Interactant = new List(); return _Interactant; } + get => _Interactant ?? new List(); set { _Interactant = value; OnPropertyChanged("Interactant"); } } - private List _Interactant; + private List? _Interactant; /// /// The type of the interaction e.g. drug-drug interaction, drug-lab test interaction. @@ -714,13 +705,13 @@ public List Interacta [FhirElement("type", InSummary=true, Order=50)] [Binding("InteractionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The effect of the interaction, for example "reduced gastric absorption of primary medication". @@ -728,13 +719,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("effect", InSummary=true, Order=60)] [Binding("InteractionEffect")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Effect + public Hl7.Fhir.Model.CodeableReference? Effect { get { return _Effect; } set { _Effect = value; OnPropertyChanged("Effect"); } } - private Hl7.Fhir.Model.CodeableReference _Effect; + private Hl7.Fhir.Model.CodeableReference? _Effect; /// /// The incidence of the interaction, e.g. theoretical, observed. @@ -742,13 +733,13 @@ public Hl7.Fhir.Model.CodeableReference Effect [FhirElement("incidence", InSummary=true, Order=70)] [Binding("UndesirableEffectSymptom")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Incidence + public Hl7.Fhir.Model.CodeableConcept? Incidence { get { return _Incidence; } set { _Incidence = value; OnPropertyChanged("Incidence"); } } - private Hl7.Fhir.Model.CodeableConcept _Incidence; + private Hl7.Fhir.Model.CodeableConcept? _Incidence; /// /// Actions for managing the interaction. @@ -759,27 +750,23 @@ public Hl7.Fhir.Model.CodeableConcept Incidence [DataMember] public List Management { - get { if(_Management==null) _Management = new List(); return _Management; } + get => _Management ?? new List(); set { _Management = value; OnPropertyChanged("Management"); } } - private List _Management; + private List? _Management; protected internal override void CopyToInternal(Base other) { - var dest = other as InteractionComponent; - - if (dest == null) - { + if(other is not InteractionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Interactant.Any()) dest.Interactant = new List(Interactant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Effect != null) dest.Effect = (Hl7.Fhir.Model.CodeableReference)Effect.DeepCopyInternal(); - if(Incidence != null) dest.Incidence = (Hl7.Fhir.Model.CodeableConcept)Incidence.DeepCopyInternal(); - if(Management.Any()) dest.Management = new List(Management.DeepCopyInternal()); + if(_Interactant is not null) dest.Interactant = new List(_Interactant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Effect is not null) dest.Effect = (Hl7.Fhir.Model.CodeableReference)_Effect.DeepCopyInternal(); + if(_Incidence is not null) dest.Incidence = (Hl7.Fhir.Model.CodeableConcept)_Incidence.DeepCopyInternal(); + if(_Management is not null) dest.Management = new List(_Management.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -791,62 +778,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InteractionComponent; - if(otherT == null) return false; + if(other is not InteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Interactant, otherT.Interactant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Effect, otherT.Effect)) return false; - if(!comparer.Equals(Incidence, otherT.Incidence)) return false; - if(!comparer.ListEquals(Management, otherT.Management)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Effect, otherT._Effect)) return false; + if(!comparer.Equals(_Incidence, otherT._Incidence)) return false; + if(!comparer.ListEquals(_Management, otherT._Management)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "interactant": - value = Interactant; - return Interactant?.Any() == true; + value = _Interactant; + return _Interactant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "effect": - value = Effect; - return Effect is not null; + value = _Effect; + return _Effect is not null; case "incidence": - value = Incidence; - return Incidence is not null; + value = _Incidence; + return _Incidence is not null; case "management": - value = Management; - return Management?.Any() == true; + value = _Management; + return _Management?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "interactant": - Interactant = (List)value; + Interactant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "effect": - Effect = (Hl7.Fhir.Model.CodeableReference)value; + Effect = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "incidence": - Incidence = (Hl7.Fhir.Model.CodeableConcept)value; + Incidence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "management": - Management = (List)value; + Management = (List?)value!; return this; default: return base.SetValue(key, value); @@ -857,11 +844,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Interactant?.Any() == true) yield return new KeyValuePair("interactant",Interactant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Effect is not null) yield return new KeyValuePair("effect",Effect); - if (Incidence is not null) yield return new KeyValuePair("incidence",Incidence); - if (Management?.Any() == true) yield return new KeyValuePair("management",Management); + if (_Interactant?.Any() == true) yield return new KeyValuePair("interactant",_Interactant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Effect is not null) yield return new KeyValuePair("effect",_Effect); + if (_Incidence is not null) yield return new KeyValuePair("incidence",_Incidence); + if (_Management?.Any() == true) yield return new KeyValuePair("management",_Management); } } @@ -892,25 +879,21 @@ public partial class InteractantComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InteractantComponent; - - if (dest == null) - { + if(other is not InteractantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -922,34 +905,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InteractantComponent; - if(otherT == null) return false; + if(other is not InteractantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -960,7 +943,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -987,13 +970,13 @@ public partial class UndesirableEffectComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("symptomConditionEffect", InSummary=true, Order=40)] [Binding("UndesirableEffectSymptom")] [DataMember] - public Hl7.Fhir.Model.CodeableReference SymptomConditionEffect + public Hl7.Fhir.Model.CodeableReference? SymptomConditionEffect { get { return _SymptomConditionEffect; } set { _SymptomConditionEffect = value; OnPropertyChanged("SymptomConditionEffect"); } } - private Hl7.Fhir.Model.CodeableReference _SymptomConditionEffect; + private Hl7.Fhir.Model.CodeableReference? _SymptomConditionEffect; /// /// High level classification of the effect. @@ -1001,13 +984,13 @@ public Hl7.Fhir.Model.CodeableReference SymptomConditionEffect [FhirElement("classification", InSummary=true, Order=50)] [Binding("UndesirableEffectClassification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Classification + public Hl7.Fhir.Model.CodeableConcept? Classification { get { return _Classification; } set { _Classification = value; OnPropertyChanged("Classification"); } } - private Hl7.Fhir.Model.CodeableConcept _Classification; + private Hl7.Fhir.Model.CodeableConcept? _Classification; /// /// How often the effect is seen. @@ -1015,27 +998,23 @@ public Hl7.Fhir.Model.CodeableConcept Classification [FhirElement("frequencyOfOccurrence", InSummary=true, Order=60)] [Binding("UndesirablEffectFrequency")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FrequencyOfOccurrence + public Hl7.Fhir.Model.CodeableConcept? FrequencyOfOccurrence { get { return _FrequencyOfOccurrence; } set { _FrequencyOfOccurrence = value; OnPropertyChanged("FrequencyOfOccurrence"); } } - private Hl7.Fhir.Model.CodeableConcept _FrequencyOfOccurrence; + private Hl7.Fhir.Model.CodeableConcept? _FrequencyOfOccurrence; protected internal override void CopyToInternal(Base other) { - var dest = other as UndesirableEffectComponent; - - if (dest == null) - { + if(other is not UndesirableEffectComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SymptomConditionEffect != null) dest.SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference)SymptomConditionEffect.DeepCopyInternal(); - if(Classification != null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)Classification.DeepCopyInternal(); - if(FrequencyOfOccurrence != null) dest.FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)FrequencyOfOccurrence.DeepCopyInternal(); + if(_SymptomConditionEffect is not null) dest.SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference)_SymptomConditionEffect.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = (Hl7.Fhir.Model.CodeableConcept)_Classification.DeepCopyInternal(); + if(_FrequencyOfOccurrence is not null) dest.FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)_FrequencyOfOccurrence.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1047,48 +1026,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UndesirableEffectComponent; - if(otherT == null) return false; + if(other is not UndesirableEffectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SymptomConditionEffect, otherT.SymptomConditionEffect)) return false; - if(!comparer.Equals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(FrequencyOfOccurrence, otherT.FrequencyOfOccurrence)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; + if(!comparer.Equals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_FrequencyOfOccurrence, otherT._FrequencyOfOccurrence)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "symptomConditionEffect": - value = SymptomConditionEffect; - return SymptomConditionEffect is not null; + value = _SymptomConditionEffect; + return _SymptomConditionEffect is not null; case "classification": - value = Classification; - return Classification is not null; + value = _Classification; + return _Classification is not null; case "frequencyOfOccurrence": - value = FrequencyOfOccurrence; - return FrequencyOfOccurrence is not null; + value = _FrequencyOfOccurrence; + return _FrequencyOfOccurrence is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "symptomConditionEffect": - SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference)value; + SymptomConditionEffect = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "classification": - Classification = (Hl7.Fhir.Model.CodeableConcept)value; + Classification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "frequencyOfOccurrence": - FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept)value; + FrequencyOfOccurrence = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1099,9 +1078,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SymptomConditionEffect is not null) yield return new KeyValuePair("symptomConditionEffect",SymptomConditionEffect); - if (Classification is not null) yield return new KeyValuePair("classification",Classification); - if (FrequencyOfOccurrence is not null) yield return new KeyValuePair("frequencyOfOccurrence",FrequencyOfOccurrence); + if (_SymptomConditionEffect is not null) yield return new KeyValuePair("symptomConditionEffect",_SymptomConditionEffect); + if (_Classification is not null) yield return new KeyValuePair("classification",_Classification); + if (_FrequencyOfOccurrence is not null) yield return new KeyValuePair("frequencyOfOccurrence",_FrequencyOfOccurrence); } } @@ -1127,28 +1106,25 @@ public partial class WarningComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A textual definition of this warning, with formatting /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1159,26 +1135,22 @@ public string Description [FhirElement("code", InSummary=true, Order=50)] [Binding("WarningType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as WarningComponent; - - if (dest == null) - { + if(other is not WarningComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1190,41 +1162,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as WarningComponent; - if(otherT == null) return false; + if(other is not WarningComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1235,8 +1207,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -1249,11 +1221,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// indication | contraindication | interaction | undesirable-effect | warning. @@ -1263,13 +1235,13 @@ public List Identifier [Binding("ClinicalUseDefinitionType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// indication | contraindication | interaction | undesirable-effect | warning @@ -1278,13 +1250,10 @@ public Code Type [IgnoreDataMember] public Hl7.Fhir.Model.ClinicalUseDefinition.ClinicalUseDefinitionType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1298,11 +1267,11 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.ClinicalUseDefinitionType? Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// The medication, product, substance, device, procedure etc. for which this is an indication. @@ -1314,11 +1283,11 @@ public List Category [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Whether this is a current issue or one that has been retired etc. @@ -1326,52 +1295,52 @@ public List Subject [FhirElement("status", InSummary=true, Order=130)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Specifics for when this is a contraindication. /// [FhirElement("contraindication", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent Contraindication + public Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent? Contraindication { get { return _Contraindication; } set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent _Contraindication; + private Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent? _Contraindication; /// /// Specifics for when this is an indication. /// [FhirElement("indication", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent Indication + public Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent? Indication { get { return _Indication; } set { _Indication = value; OnPropertyChanged("Indication"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent _Indication; + private Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent? _Indication; /// /// Specifics for when this is an interaction. /// [FhirElement("interaction", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent Interaction + public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent? Interaction { get { return _Interaction; } set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent _Interaction; + private Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent? _Interaction; /// /// The population group to which this applies. @@ -1383,11 +1352,11 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent Interaction [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// Logic used by the clinical use definition. @@ -1397,24 +1366,24 @@ public List Population [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the clinical use definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -1426,51 +1395,47 @@ public IEnumerable Library /// [FhirElement("undesirableEffect", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent UndesirableEffect + public Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent? UndesirableEffect { get { return _UndesirableEffect; } set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent _UndesirableEffect; + private Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent? _UndesirableEffect; /// /// Critical environmental, health or physical risks or hazards. For example 'Do not operate heavy machinery', 'May cause drowsiness'. /// [FhirElement("warning", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent Warning + public Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent? Warning { get { return _Warning; } set { _Warning = value; OnPropertyChanged("Warning"); } } - private Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent _Warning; + private Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent? _Warning; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ClinicalUseDefinition; - - if (dest == null) - { + if(other is not ClinicalUseDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Contraindication != null) dest.Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent)Contraindication.DeepCopyInternal(); - if(Indication != null) dest.Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent)Indication.DeepCopyInternal(); - if(Interaction != null) dest.Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent)Interaction.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(UndesirableEffect != null) dest.UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent)UndesirableEffect.DeepCopyInternal(); - if(Warning != null) dest.Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent)Warning.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Contraindication is not null) dest.Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent)_Contraindication.DeepCopyInternal(); + if(_Indication is not null) dest.Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent)_Indication.DeepCopyInternal(); + if(_Interaction is not null) dest.Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent)_Interaction.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_UndesirableEffect is not null) dest.UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent)_UndesirableEffect.DeepCopyInternal(); + if(_Warning is not null) dest.Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent)_Warning.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1482,111 +1447,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClinicalUseDefinition; - if(otherT == null) return false; + if(other is not ClinicalUseDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Contraindication, otherT.Contraindication)) return false; - if(!comparer.Equals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(Interaction, otherT.Interaction)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(UndesirableEffect, otherT.UndesirableEffect)) return false; - if(!comparer.Equals(Warning, otherT.Warning)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Contraindication, otherT._Contraindication)) return false; + if(!comparer.Equals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_Interaction, otherT._Interaction)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_UndesirableEffect, otherT._UndesirableEffect)) return false; + if(!comparer.Equals(_Warning, otherT._Warning)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "contraindication": - value = Contraindication; - return Contraindication is not null; + value = _Contraindication; + return _Contraindication is not null; case "indication": - value = Indication; - return Indication is not null; + value = _Indication; + return _Indication is not null; case "interaction": - value = Interaction; - return Interaction is not null; + value = _Interaction; + return _Interaction is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "undesirableEffect": - value = UndesirableEffect; - return UndesirableEffect is not null; + value = _UndesirableEffect; + return _UndesirableEffect is not null; case "warning": - value = Warning; - return Warning is not null; + value = _Warning; + return _Warning is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contraindication": - Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent)value; + Contraindication = (Hl7.Fhir.Model.ClinicalUseDefinition.ContraindicationComponent?)value; return this; case "indication": - Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent)value; + Indication = (Hl7.Fhir.Model.ClinicalUseDefinition.IndicationComponent?)value; return this; case "interaction": - Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent)value; + Interaction = (Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "undesirableEffect": - UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent)value; + UndesirableEffect = (Hl7.Fhir.Model.ClinicalUseDefinition.UndesirableEffectComponent?)value; return this; case "warning": - Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent)value; + Warning = (Hl7.Fhir.Model.ClinicalUseDefinition.WarningComponent?)value; return this; default: return base.SetValue(key, value); @@ -1597,18 +1562,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Contraindication is not null) yield return new KeyValuePair("contraindication",Contraindication); - if (Indication is not null) yield return new KeyValuePair("indication",Indication); - if (Interaction is not null) yield return new KeyValuePair("interaction",Interaction); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (UndesirableEffect is not null) yield return new KeyValuePair("undesirableEffect",UndesirableEffect); - if (Warning is not null) yield return new KeyValuePair("warning",Warning); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Contraindication is not null) yield return new KeyValuePair("contraindication",_Contraindication); + if (_Indication is not null) yield return new KeyValuePair("indication",_Indication); + if (_Interaction is not null) yield return new KeyValuePair("interaction",_Interaction); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_UndesirableEffect is not null) yield return new KeyValuePair("undesirableEffect",_UndesirableEffect); + if (_Warning is not null) yield return new KeyValuePair("warning",_Warning); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs index 6e383bfa1..f63b6b49f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -165,11 +164,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -179,24 +178,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -211,24 +210,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -245,11 +244,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event (e.g. Communication, Procedure). @@ -261,11 +260,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Reply to. @@ -277,11 +276,11 @@ public List PartOf [DataMember] public List InResponseTo { - get { if(_InResponseTo==null) _InResponseTo = new List(); return _InResponseTo; } + get => _InResponseTo ?? new List(); set { _InResponseTo = value; OnPropertyChanged("InResponseTo"); } } - private List _InResponseTo; + private List? _InResponseTo; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -291,13 +290,13 @@ public List InResponseTo [Binding("CommunicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -306,13 +305,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -323,13 +319,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("statusReason", InSummary=true, Order=160)] [Binding("CommunicationNotDoneReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Message category. @@ -340,11 +336,11 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -353,13 +349,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("CommunicationPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -368,13 +364,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -388,11 +381,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -401,13 +394,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Description of the purpose/content. @@ -415,13 +408,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [FhirElement("topic", Order=210, FiveWs="FiveWs.context")] [Binding("CommunicationTopic")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Topic + public Hl7.Fhir.Model.CodeableConcept? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.CodeableConcept _Topic; + private Hl7.Fhir.Model.CodeableConcept? _Topic; /// /// Resources that pertain to this communication. @@ -433,11 +426,11 @@ public Hl7.Fhir.Model.CodeableConcept Topic [DataMember] public List About { - get { if(_About==null) _About = new List(); return _About; } + get => _About ?? new List(); set { _About = value; OnPropertyChanged("About"); } } - private List _About; + private List? _About; /// /// The Encounter during which this Communication was created. @@ -446,41 +439,38 @@ public List About [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When sent. /// [FhirElement("sent", Order=240, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime SentElement + public Hl7.Fhir.Model.FhirDateTime? SentElement { get { return _SentElement; } set { _SentElement = value; OnPropertyChanged("SentElement"); } } - private Hl7.Fhir.Model.FhirDateTime _SentElement; + private Hl7.Fhir.Model.FhirDateTime? _SentElement; /// /// When sent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sent + public string? Sent { - get { return SentElement != null ? SentElement.Value : null; } + get => _SentElement?.Value; set { - if (value == null) - SentElement = null; - else - SentElement = new Hl7.Fhir.Model.FhirDateTime(value); + SentElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Sent"); } } @@ -490,28 +480,25 @@ public string Sent /// [FhirElement("received", Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedElement { get { return _ReceivedElement; } set { _ReceivedElement = value; OnPropertyChanged("ReceivedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedElement; /// /// When received /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Received + public string? Received { - get { return ReceivedElement != null ? ReceivedElement.Value : null; } + get => _ReceivedElement?.Value; set { - if (value == null) - ReceivedElement = null; - else - ReceivedElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Received"); } } @@ -526,11 +513,11 @@ public string Received [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Who shares the information. @@ -539,13 +526,13 @@ public List Recipient [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson","HealthcareService","Endpoint","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// Indication for message. @@ -556,11 +543,11 @@ public Hl7.Fhir.Model.ResourceReference Sender [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Message payload. @@ -570,11 +557,11 @@ public List Reason [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// Comments made about the communication. @@ -584,46 +571,42 @@ public List Payload [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Communication; - - if (dest == null) - { + if(other is not Communication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(InResponseTo.Any()) dest.InResponseTo = new List(InResponseTo.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.CodeableConcept)Topic.DeepCopyInternal(); - if(About.Any()) dest.About = new List(About.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SentElement != null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)SentElement.DeepCopyInternal(); - if(ReceivedElement != null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedElement.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_InResponseTo is not null) dest.InResponseTo = new List(_InResponseTo.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.CodeableConcept)_Topic.DeepCopyInternal(); + if(_About is not null) dest.About = new List(_About.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SentElement is not null) dest.SentElement = (Hl7.Fhir.Model.FhirDateTime)_SentElement.DeepCopyInternal(); + if(_ReceivedElement is not null) dest.ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedElement.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -635,181 +618,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Communication; - if(otherT == null) return false; + if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(InResponseTo, otherT.InResponseTo)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(About, otherT.About)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(SentElement, otherT.SentElement)) return false; - if(!comparer.Equals(ReceivedElement, otherT.ReceivedElement)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_InResponseTo, otherT._InResponseTo)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_About, otherT._About)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_SentElement, otherT._SentElement)) return false; + if(!comparer.Equals(_ReceivedElement, otherT._ReceivedElement)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "inResponseTo": - value = InResponseTo; - return InResponseTo?.Any() == true; + value = _InResponseTo; + return _InResponseTo?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "about": - value = About; - return About?.Any() == true; + value = _About; + return _About?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "sent": - value = SentElement; - return SentElement is not null; + value = _SentElement; + return _SentElement is not null; case "received": - value = ReceivedElement; - return ReceivedElement is not null; + value = _ReceivedElement; + return _ReceivedElement is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "inResponseTo": - InResponseTo = (List)value; + InResponseTo = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.CodeableConcept)value; + Topic = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "about": - About = (List)value; + About = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sent": - SentElement = (Hl7.Fhir.Model.FhirDateTime)value; + SentElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "received": - ReceivedElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -820,28 +803,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (InResponseTo?.Any() == true) yield return new KeyValuePair("inResponseTo",InResponseTo); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (About?.Any() == true) yield return new KeyValuePair("about",About); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SentElement is not null) yield return new KeyValuePair("sent",SentElement); - if (ReceivedElement is not null) yield return new KeyValuePair("received",ReceivedElement); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_InResponseTo?.Any() == true) yield return new KeyValuePair("inResponseTo",_InResponseTo); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_About?.Any() == true) yield return new KeyValuePair("about",_About); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SentElement is not null) yield return new KeyValuePair("sent",_SentElement); + if (_ReceivedElement is not null) yield return new KeyValuePair("received",_ReceivedElement); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs index edaf24f47..003a47363 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,25 +87,21 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -114,34 +113,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -152,7 +151,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -165,11 +164,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan or proposal. @@ -181,11 +180,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -197,24 +196,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -224,13 +223,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("CommunicationRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -239,13 +238,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -256,13 +252,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [FhirElement("statusReason", Order=140)] [Binding("CommunicationRequestStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option. @@ -272,13 +268,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [Binding("CommunicationRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -287,13 +283,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -307,11 +300,11 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -320,13 +313,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("CommunicationPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -335,13 +328,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -351,13 +341,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if request is prohibiting action @@ -366,13 +356,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -386,11 +373,11 @@ public bool? DoNotPerform [DataMember] public List Medium { - get { if(_Medium==null) _Medium = new List(); return _Medium; } + get => _Medium ?? new List(); set { _Medium = value; OnPropertyChanged("Medium"); } } - private List _Medium; + private List? _Medium; /// /// Focus of message. @@ -399,13 +386,13 @@ public List Medium [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Resources that pertain to this communication request. @@ -417,11 +404,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List About { - get { if(_About==null) _About = new List(); return _About; } + get => _About ?? new List(); set { _About = value; OnPropertyChanged("About"); } } - private List _About; + private List? _About; /// /// The Encounter during which this CommunicationRequest was created. @@ -430,13 +417,13 @@ public List About [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Message payload. @@ -446,11 +433,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// When scheduled. @@ -459,41 +446,38 @@ public List Payload [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When request transitioned to being actionable. /// [FhirElement("authoredOn", InSummary=true, Order=250, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request transitioned to being actionable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -505,13 +489,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Who to share the information with. @@ -523,11 +507,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; /// /// Who should share the information. @@ -539,11 +523,11 @@ public List Recipient [DataMember] public List InformationProvider { - get { if(_InformationProvider==null) _InformationProvider = new List(); return _InformationProvider; } + get => _InformationProvider ?? new List(); set { _InformationProvider = value; OnPropertyChanged("InformationProvider"); } } - private List _InformationProvider; + private List? _InformationProvider; /// /// Why is communication needed?. @@ -554,11 +538,11 @@ public List InformationProvider [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Comments made about communication request. @@ -568,46 +552,42 @@ public List Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationRequest; - - if (dest == null) - { + if(other is not CommunicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Medium.Any()) dest.Medium = new List(Medium.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(About.Any()) dest.About = new List(About.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); - if(InformationProvider.Any()) dest.InformationProvider = new List(InformationProvider.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Medium is not null) dest.Medium = new List(_Medium.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_About is not null) dest.About = new List(_About.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); + if(_InformationProvider is not null) dest.InformationProvider = new List(_InformationProvider.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -619,181 +599,181 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationRequest; - if(otherT == null) return false; + if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.ListEquals(Medium, otherT.Medium)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(About, otherT.About)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; - if(!comparer.ListEquals(InformationProvider, otherT.InformationProvider)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.ListEquals(_Medium, otherT._Medium)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_About, otherT._About)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; + if(!comparer.ListEquals(_InformationProvider, otherT._InformationProvider)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "medium": - value = Medium; - return Medium?.Any() == true; + value = _Medium; + return _Medium?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "about": - value = About; - return About?.Any() == true; + value = _About; + return _About?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; case "informationProvider": - value = InformationProvider; - return InformationProvider?.Any() == true; + value = _InformationProvider; + return _InformationProvider?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "medium": - Medium = (List)value; + Medium = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "about": - About = (List)value; + About = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; case "informationProvider": - InformationProvider = (List)value; + InformationProvider = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -804,28 +784,28 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Medium?.Any() == true) yield return new KeyValuePair("medium",Medium); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (About?.Any() == true) yield return new KeyValuePair("about",About); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); - if (InformationProvider?.Any() == true) yield return new KeyValuePair("informationProvider",InformationProvider); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Medium?.Any() == true) yield return new KeyValuePair("medium",_Medium); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_About?.Any() == true) yield return new KeyValuePair("about",_About); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); + if (_InformationProvider?.Any() == true) yield return new KeyValuePair("informationProvider",_InformationProvider); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs index 5273cadd9..321c81e15 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Name of resource type @@ -99,13 +102,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -118,24 +118,24 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get { if(_ParamElement==null) _ParamElement = new List(); return _ParamElement; } + get => _ParamElement ?? new List(); set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } - private List _ParamElement; + private List? _ParamElement; /// /// Search Parameter Name, or chained parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Param + public IEnumerable? Param { - get { return ParamElement != null ? ParamElement.Select(elem => elem.Value) : null; } + get => _ParamElement?.Select(elem => elem.Value); set { if (value == null) - ParamElement = null; + ParamElement = null!; else ParamElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Param"); @@ -147,28 +147,25 @@ public IEnumerable Param /// [FhirElement("documentation", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional documentation about the resource and compartment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -178,28 +175,25 @@ public string Documentation /// [FhirElement("startParam", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUri StartParamElement + public Hl7.Fhir.Model.FhirUri? StartParamElement { get { return _StartParamElement; } set { _StartParamElement = value; OnPropertyChanged("StartParamElement"); } } - private Hl7.Fhir.Model.FhirUri _StartParamElement; + private Hl7.Fhir.Model.FhirUri? _StartParamElement; /// /// Search Param for interpreting $everything.start /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StartParam + public string? StartParam { - get { return StartParamElement != null ? StartParamElement.Value : null; } + get => _StartParamElement?.Value; set { - if (value == null) - StartParamElement = null; - else - StartParamElement = new Hl7.Fhir.Model.FhirUri(value); + StartParamElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("StartParam"); } } @@ -209,47 +203,40 @@ public string StartParam /// [FhirElement("endParam", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirUri EndParamElement + public Hl7.Fhir.Model.FhirUri? EndParamElement { get { return _EndParamElement; } set { _EndParamElement = value; OnPropertyChanged("EndParamElement"); } } - private Hl7.Fhir.Model.FhirUri _EndParamElement; + private Hl7.Fhir.Model.FhirUri? _EndParamElement; /// /// Search Param for interpreting $everything.end /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EndParam + public string? EndParam { - get { return EndParamElement != null ? EndParamElement.Value : null; } + get => _EndParamElement?.Value; set { - if (value == null) - EndParamElement = null; - else - EndParamElement = new Hl7.Fhir.Model.FhirUri(value); + EndParamElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("EndParam"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ParamElement.Any()) dest.ParamElement = new List(ParamElement.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(StartParamElement != null) dest.StartParamElement = (Hl7.Fhir.Model.FhirUri)StartParamElement.DeepCopyInternal(); - if(EndParamElement != null) dest.EndParamElement = (Hl7.Fhir.Model.FhirUri)EndParamElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ParamElement is not null) dest.ParamElement = new List(_ParamElement.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_StartParamElement is not null) dest.StartParamElement = (Hl7.Fhir.Model.FhirUri)_StartParamElement.DeepCopyInternal(); + if(_EndParamElement is not null) dest.EndParamElement = (Hl7.Fhir.Model.FhirUri)_EndParamElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -261,62 +248,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(ParamElement, otherT.ParamElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(StartParamElement, otherT.StartParamElement)) return false; - if(!comparer.Equals(EndParamElement, otherT.EndParamElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_StartParamElement, otherT._StartParamElement)) return false; + if(!comparer.Equals(_EndParamElement, otherT._EndParamElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "param": - value = ParamElement; - return ParamElement?.Any() == true; + value = _ParamElement; + return _ParamElement?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "startParam": - value = StartParamElement; - return StartParamElement is not null; + value = _StartParamElement; + return _StartParamElement is not null; case "endParam": - value = EndParamElement; - return EndParamElement is not null; + value = _EndParamElement; + return _EndParamElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "param": - ParamElement = (List)value; + ParamElement = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "startParam": - StartParamElement = (Hl7.Fhir.Model.FhirUri)value; + StartParamElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "endParam": - EndParamElement = (Hl7.Fhir.Model.FhirUri)value; + EndParamElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -327,11 +314,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ParamElement?.Any() == true) yield return new KeyValuePair("param",ParamElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (StartParamElement is not null) yield return new KeyValuePair("startParam",StartParamElement); - if (EndParamElement is not null) yield return new KeyValuePair("endParam",EndParamElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ParamElement?.Any() == true) yield return new KeyValuePair("param",_ParamElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_StartParamElement is not null) yield return new KeyValuePair("startParam",_StartParamElement); + if (_EndParamElement is not null) yield return new KeyValuePair("endParam",_EndParamElement); } } @@ -342,28 +329,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this compartment definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -373,28 +357,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the compartment definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -406,13 +387,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this compartment definition (computer friendly). @@ -420,28 +401,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this compartment definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -451,28 +429,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this compartment definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -485,13 +460,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -500,13 +475,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -516,13 +488,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=150, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -531,13 +503,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -547,28 +516,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -578,28 +544,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=170, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -612,39 +575,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the compartment definition. /// [FhirElement("description", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the compartment definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -657,39 +617,36 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Why this compartment definition is defined. /// [FhirElement("purpose", Order=210, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this compartment definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -702,13 +659,13 @@ public string Purpose [Binding("CompartmentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare @@ -717,13 +674,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -734,13 +688,13 @@ public Hl7.Fhir.Model.CompartmentType? Code [FhirElement("search", InSummary=true, Order=230)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SearchElement + public Hl7.Fhir.Model.FhirBoolean? SearchElement { get { return _SearchElement; } set { _SearchElement = value; OnPropertyChanged("SearchElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SearchElement; + private Hl7.Fhir.Model.FhirBoolean? _SearchElement; /// /// Whether the search syntax is supported @@ -749,13 +703,10 @@ public Hl7.Fhir.Model.FhirBoolean SearchElement [IgnoreDataMember] public bool? Search { - get { return SearchElement != null ? SearchElement.Value : null; } + get => _SearchElement?.Value; set { - if (value == null) - SearchElement = null; - else - SearchElement = new Hl7.Fhir.Model.FhirBoolean(value); + SearchElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Search"); } } @@ -768,38 +719,34 @@ public bool? Search [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentDefinition; - - if (dest == null) - { + if(other is not CompartmentDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(SearchElement != null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)SearchElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_SearchElement is not null) dest.SearchElement = (Hl7.Fhir.Model.FhirBoolean)_SearchElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -811,139 +758,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentDefinition; - if(otherT == null) return false; + if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(SearchElement, otherT.SearchElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "search": - value = SearchElement; - return SearchElement is not null; + value = _SearchElement; + return _SearchElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "search": - SearchElement = (Hl7.Fhir.Model.FhirBoolean)value; + SearchElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -954,22 +901,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (SearchElement is not null) yield return new KeyValuePair("search",SearchElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_SearchElement is not null) yield return new KeyValuePair("search",_SearchElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Composition.cs b/src/Hl7.Fhir.R5/Model/Generated/Composition.cs index 6c8e4c26d..d70693e34 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Composition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,41 +87,38 @@ public partial class AttesterComponent : Hl7.Fhir.Model.BackboneElement [Binding("CompositionAttestationMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Mode + public Hl7.Fhir.Model.CodeableConcept? Mode { get { return _Mode; } set { _Mode = value; OnPropertyChanged("Mode"); } } - private Hl7.Fhir.Model.CodeableConcept _Mode; + private Hl7.Fhir.Model.CodeableConcept? _Mode; /// /// When the composition was attested. /// [FhirElement("time", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the composition was attested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -130,27 +130,23 @@ public string Time [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as AttesterComponent; - - if (dest == null) - { + if(other is not AttesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Mode != null) dest.Mode = (Hl7.Fhir.Model.CodeableConcept)Mode.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Mode is not null) dest.Mode = (Hl7.Fhir.Model.CodeableConcept)_Mode.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -162,48 +158,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttesterComponent; - if(otherT == null) return false; + if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Mode, otherT.Mode)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Mode, otherT._Mode)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = Mode; - return Mode is not null; + value = _Mode; + return _Mode is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - Mode = (Hl7.Fhir.Model.CodeableConcept)value; + Mode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -214,9 +210,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Mode is not null) yield return new KeyValuePair("mode",Mode); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Mode is not null) yield return new KeyValuePair("mode",_Mode); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -243,13 +239,13 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("period", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The event(s) being documented, as code(s), reference(s), or both. @@ -260,24 +256,20 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -289,41 +281,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -334,8 +326,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -361,28 +353,25 @@ public partial class SectionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for section (e.g. for ToC) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -393,13 +382,13 @@ public string Title [FhirElement("code", Order=50)] [Binding("CompositionSectionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who and/or what authored the section. @@ -411,11 +400,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who/what the section is about, when it is not about the subject of composition. @@ -424,26 +413,26 @@ public List Author [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Text summary of the section, for human interpretation. /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.Narrative Text + public Hl7.Fhir.Model.Narrative? Text { get { return _Text; } set { _Text = value; OnPropertyChanged("Text"); } } - private Hl7.Fhir.Model.Narrative _Text; + private Hl7.Fhir.Model.Narrative? _Text; /// /// Order of section entries. @@ -451,13 +440,13 @@ public Hl7.Fhir.Model.Narrative Text [FhirElement("orderedBy", Order=90)] [Binding("SectionEntryOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// A reference to data that supports this section. @@ -469,11 +458,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why the section is empty. @@ -481,13 +470,13 @@ public List Entry [FhirElement("emptyReason", Order=110)] [Binding("SectionEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; /// /// Nested Section. @@ -497,31 +486,27 @@ public Hl7.Fhir.Model.CodeableConcept EmptyReason [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; protected internal override void CopyToInternal(Base other) { - var dest = other as SectionComponent; - - if (dest == null) - { + if(other is not SectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -533,90 +518,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SectionComponent; - if(otherT == null) return false; + if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Text, otherT.Text)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Text, otherT._Text)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "text": - value = Text; - return Text is not null; + value = _Text; + return _Text is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "text": - Text = (Hl7.Fhir.Model.Narrative)value; + Text = (Hl7.Fhir.Model.Narrative?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -627,15 +612,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (Text is not null) yield return new KeyValuePair("text",Text); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_Text is not null) yield return new KeyValuePair("text",_Text); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } @@ -645,28 +630,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this Composition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -679,39 +661,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// An explicitly assigned identifer of a variation of the content in the Composition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// An explicitly assigned identifer of a variation of the content in the Composition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -724,13 +703,13 @@ public string Version [Binding("CompositionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | partial | preliminary | final | amended | corrected | appended | cancelled | entered-in-error | deprecated | unknown @@ -739,13 +718,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -757,13 +733,13 @@ public Hl7.Fhir.Model.CompositionStatus? Status [Binding("DocumentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of Composition. @@ -774,11 +750,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who and/or what the composition is about. @@ -790,11 +766,11 @@ public List Category [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Context of the Composition. @@ -803,13 +779,13 @@ public List Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Composition editing time. @@ -817,28 +793,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.done[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Composition editing time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -851,11 +824,11 @@ public string Date [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Who and/or what authored the composition. @@ -867,39 +840,36 @@ public List UseContext [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Name for this Composition (computer friendly). /// [FhirElement("name", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this Composition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -910,28 +880,25 @@ public string Name [FhirElement("title", InSummary=true, Order=210)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human Readable name/title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -944,11 +911,11 @@ public string Title [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Attests to accuracy of composition. @@ -958,11 +925,11 @@ public List Note [DataMember] public List Attester { - get { if(_Attester==null) _Attester = new List(); return _Attester; } + get => _Attester ?? new List(); set { _Attester = value; OnPropertyChanged("Attester"); } } - private List _Attester; + private List? _Attester; /// /// Organization which maintains the composition. @@ -971,13 +938,13 @@ public List Attester [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other compositions/documents. @@ -987,11 +954,11 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// The clinical service(s) being documented. @@ -1001,11 +968,11 @@ public List RelatesTo [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Composition is broken into sections. @@ -1015,43 +982,39 @@ public List Event [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Composition; - - if (dest == null) - { + if(other is not Composition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Attester.Any()) dest.Attester = new List(Attester.DeepCopyInternal()); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Attester is not null) dest.Attester = new List(_Attester.DeepCopyInternal()); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1063,160 +1026,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Composition; - if(otherT == null) return false; + if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Attester, otherT.Attester)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Attester, otherT._Attester)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "attester": - value = Attester; - return Attester?.Any() == true; + value = _Attester; + return _Attester?.Any() == true; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "attester": - Attester = (List)value; + Attester = (List?)value!; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1227,25 +1190,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Attester?.Any() == true) yield return new KeyValuePair("attester",Attester); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Attester?.Any() == true) yield return new KeyValuePair("attester",_Attester); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs index 3be7ccf75..579c7376c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -242,28 +245,25 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies the property on the mappings, and when referred to in the $translate operation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -273,28 +273,25 @@ public string Code /// [FhirElement("uri", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Formal identifier for the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -304,28 +301,25 @@ public string Uri /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why the property is defined, and/or what it conveys /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -338,13 +332,13 @@ public string Description [Binding("PropertyType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Coding | string | integer | boolean | dateTime | decimal | code @@ -353,13 +347,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapPropertyType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -369,47 +360,40 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapPropertyType? Type /// [FhirElement("system", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Canonical SystemElement + public Hl7.Fhir.Model.Canonical? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.Canonical _SystemElement; + private Hl7.Fhir.Model.Canonical? _SystemElement; /// /// The CodeSystem from which code values come /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string System + public string? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.Canonical(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("System"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.Canonical)SystemElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.Canonical)_SystemElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -421,62 +405,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "system": - SystemElement = (Hl7.Fhir.Model.Canonical)value; + SystemElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -487,11 +471,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); } } @@ -519,28 +503,25 @@ public partial class AdditionalAttributeComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("code", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies this additional attribute through this resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -550,28 +531,25 @@ public string Code /// [FhirElement("uri", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// Formal identifier for the data element referred to in this attribte /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -581,28 +559,25 @@ public string Uri /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why the additional attribute is defined, and/or what the data element it refers to is /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -615,13 +590,13 @@ public string Description [Binding("ConceptMapmapAttributeType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// code | Coding | string | boolean | Quantity @@ -630,31 +605,24 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapAttributeType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AdditionalAttributeComponent; - - if (dest == null) - { + if(other is not AdditionalAttributeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -666,55 +634,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdditionalAttributeComponent; - if(otherT == null) return false; + if(other is not AdditionalAttributeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -725,10 +693,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -754,28 +722,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("source", Order=40)] [DataMember] - public Hl7.Fhir.Model.Canonical SourceElement + public Hl7.Fhir.Model.Canonical? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.Canonical _SourceElement; + private Hl7.Fhir.Model.Canonical? _SourceElement; /// /// Source system where concepts to be mapped are defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.Canonical(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Source"); } } @@ -785,28 +750,25 @@ public string Source /// [FhirElement("target", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical TargetElement + public Hl7.Fhir.Model.Canonical? TargetElement { get { return _TargetElement; } set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private Hl7.Fhir.Model.Canonical _TargetElement; + private Hl7.Fhir.Model.Canonical? _TargetElement; /// /// Target system that the concepts are to be mapped to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Target + public string? Target { - get { return TargetElement != null ? TargetElement.Value : null; } + get => _TargetElement?.Value; set { - if (value == null) - TargetElement = null; - else - TargetElement = new Hl7.Fhir.Model.Canonical(value); + TargetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Target"); } } @@ -819,39 +781,35 @@ public string Target [DataMember] public List Element { - get { if(_Element==null) _Element = new List(); return _Element; } + get => _Element ?? new List(); set { _Element = value; OnPropertyChanged("Element"); } } - private List _Element; + private List? _Element; /// /// What to do when there is no mapping target for the source concept and ConceptMap.group.element.noMap is not true. /// [FhirElement("unmapped", Order=70)] [DataMember] - public Hl7.Fhir.Model.ConceptMap.UnmappedComponent Unmapped + public Hl7.Fhir.Model.ConceptMap.UnmappedComponent? Unmapped { get { return _Unmapped; } set { _Unmapped = value; OnPropertyChanged("Unmapped"); } } - private Hl7.Fhir.Model.ConceptMap.UnmappedComponent _Unmapped; + private Hl7.Fhir.Model.ConceptMap.UnmappedComponent? _Unmapped; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.Canonical)SourceElement.DeepCopyInternal(); - if(TargetElement != null) dest.TargetElement = (Hl7.Fhir.Model.Canonical)TargetElement.DeepCopyInternal(); - if(Element.Any()) dest.Element = new List(Element.DeepCopyInternal()); - if(Unmapped != null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)Unmapped.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.Canonical)_SourceElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = (Hl7.Fhir.Model.Canonical)_TargetElement.DeepCopyInternal(); + if(_Element is not null) dest.Element = new List(_Element.DeepCopyInternal()); + if(_Unmapped is not null) dest.Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)_Unmapped.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -863,55 +821,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.ListEquals(Element, otherT.Element)) return false; - if(!comparer.Equals(Unmapped, otherT.Unmapped)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "target": - value = TargetElement; - return TargetElement is not null; + value = _TargetElement; + return _TargetElement is not null; case "element": - value = Element; - return Element?.Any() == true; + value = _Element; + return _Element?.Any() == true; case "unmapped": - value = Unmapped; - return Unmapped is not null; + value = _Unmapped; + return _Unmapped is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.Canonical)value; + SourceElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "target": - TargetElement = (Hl7.Fhir.Model.Canonical)value; + TargetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "element": - Element = (List)value; + Element = (List?)value!; return this; case "unmapped": - Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent)value; + Unmapped = (Hl7.Fhir.Model.ConceptMap.UnmappedComponent?)value; return this; default: return base.SetValue(key, value); @@ -922,10 +880,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (TargetElement is not null) yield return new KeyValuePair("target",TargetElement); - if (Element?.Any() == true) yield return new KeyValuePair("element",Element); - if (Unmapped is not null) yield return new KeyValuePair("unmapped",Unmapped); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_TargetElement is not null) yield return new KeyValuePair("target",_TargetElement); + if (_Element?.Any() == true) yield return new KeyValuePair("element",_Element); + if (_Unmapped is not null) yield return new KeyValuePair("unmapped",_Unmapped); } } @@ -952,28 +910,25 @@ public partial class SourceElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Identifies element being mapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -983,28 +938,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -1014,28 +966,25 @@ public string Display /// [FhirElement("valueSet", Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Identifies the set of concepts being mapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -1045,13 +994,13 @@ public string ValueSet /// [FhirElement("noMap", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NoMapElement + public Hl7.Fhir.Model.FhirBoolean? NoMapElement { get { return _NoMapElement; } set { _NoMapElement = value; OnPropertyChanged("NoMapElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NoMapElement; + private Hl7.Fhir.Model.FhirBoolean? _NoMapElement; /// /// No mapping to a target concept for this source concept @@ -1060,13 +1009,10 @@ public Hl7.Fhir.Model.FhirBoolean NoMapElement [IgnoreDataMember] public bool? NoMap { - get { return NoMapElement != null ? NoMapElement.Value : null; } + get => _NoMapElement?.Value; set { - if (value == null) - NoMapElement = null; - else - NoMapElement = new Hl7.Fhir.Model.FhirBoolean(value); + NoMapElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NoMap"); } } @@ -1079,27 +1025,23 @@ public bool? NoMap [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceElementComponent; - - if (dest == null) - { + if(other is not SourceElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(NoMapElement != null) dest.NoMapElement = (Hl7.Fhir.Model.FhirBoolean)NoMapElement.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_NoMapElement is not null) dest.NoMapElement = (Hl7.Fhir.Model.FhirBoolean)_NoMapElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1111,62 +1053,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceElementComponent; - if(otherT == null) return false; + if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.Equals(NoMapElement, otherT.NoMapElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.Equals(_NoMapElement, otherT._NoMapElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "noMap": - value = NoMapElement; - return NoMapElement is not null; + value = _NoMapElement; + return _NoMapElement is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "noMap": - NoMapElement = (Hl7.Fhir.Model.FhirBoolean)value; + NoMapElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1177,11 +1119,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (NoMapElement is not null) yield return new KeyValuePair("noMap",NoMapElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_NoMapElement is not null) yield return new KeyValuePair("noMap",_NoMapElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -1208,28 +1150,25 @@ public partial class TargetElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", Order=40)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code that identifies the target element /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1239,28 +1178,25 @@ public string Code /// [FhirElement("display", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -1270,28 +1206,25 @@ public string Display /// [FhirElement("valueSet", Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Identifies the set of target concepts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -1304,13 +1237,13 @@ public string ValueSet [Binding("ConceptMapRelationship")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// related-to | equivalent | source-is-narrower-than-target | source-is-broader-than-target | not-related-to @@ -1319,13 +1252,10 @@ public Code RelationshipElemen [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapRelationship? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -1335,28 +1265,25 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapRelationship? Relationship /// [FhirElement("comment", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Description of status/issues in mapping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -1369,11 +1296,11 @@ public string Comment [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Other properties required for this mapping. @@ -1383,11 +1310,11 @@ public List Property [DataMember] public List DependsOn { - get { if(_DependsOn==null) _DependsOn = new List(); return _DependsOn; } + get => _DependsOn ?? new List(); set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } - private List _DependsOn; + private List? _DependsOn; /// /// Other data elements that this mapping also produces. @@ -1397,30 +1324,26 @@ public List DependsOn [DataMember] public List Product { - get { if(_Product==null) _Product = new List(); return _Product; } + get => _Product ?? new List(); set { _Product = value; OnPropertyChanged("Product"); } } - private List _Product; + private List? _Product; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetElementComponent; - - if (dest == null) - { + if(other is not TargetElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(DependsOn.Any()) dest.DependsOn = new List(DependsOn.DeepCopyInternal()); - if(Product.Any()) dest.Product = new List(Product.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_DependsOn is not null) dest.DependsOn = new List(_DependsOn.DeepCopyInternal()); + if(_Product is not null) dest.Product = new List(_Product.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1432,83 +1355,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetElementComponent; - if(otherT == null) return false; + if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(DependsOn, otherT.DependsOn)) return false; - if(!comparer.ListEquals(Product, otherT.Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; + if(!comparer.ListEquals(_Product, otherT._Product)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "dependsOn": - value = DependsOn; - return DependsOn?.Any() == true; + value = _DependsOn; + return _DependsOn?.Any() == true; case "product": - value = Product; - return Product?.Any() == true; + value = _Product; + return _Product?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "dependsOn": - DependsOn = (List)value; + DependsOn = (List?)value!; return this; case "product": - Product = (List)value; + Product = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1519,14 +1442,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",DependsOn); - if (Product?.Any() == true) yield return new KeyValuePair("product",Product); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",_DependsOn); + if (_Product?.Any() == true) yield return new KeyValuePair("product",_Product); } } @@ -1553,28 +1476,25 @@ public partial class MappingPropertyComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Reference to ConceptMap.property.code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1587,26 +1507,22 @@ public string Code [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Code))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as MappingPropertyComponent; - - if (dest == null) - { + if(other is not MappingPropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1618,41 +1534,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MappingPropertyComponent; - if(otherT == null) return false; + if(other is not MappingPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1663,8 +1579,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1691,28 +1607,25 @@ public partial class OtherElementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("attribute", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code AttributeElement + public Hl7.Fhir.Model.Code? AttributeElement { get { return _AttributeElement; } set { _AttributeElement = value; OnPropertyChanged("AttributeElement"); } } - private Hl7.Fhir.Model.Code _AttributeElement; + private Hl7.Fhir.Model.Code? _AttributeElement; /// /// A reference to a mapping attribute defined in ConceptMap.additionalAttribute /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Attribute + public string? Attribute { - get { return AttributeElement != null ? AttributeElement.Value : null; } + get => _AttributeElement?.Value; set { - if (value == null) - AttributeElement = null; - else - AttributeElement = new Hl7.Fhir.Model.Code(value); + AttributeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Attribute"); } } @@ -1724,58 +1637,51 @@ public string Attribute [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// The mapping depends on a data element with a value from this value set. /// [FhirElement("valueSet", Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// The mapping depends on a data element with a value from this value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OtherElementComponent; - - if (dest == null) - { + if(other is not OtherElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AttributeElement != null) dest.AttributeElement = (Hl7.Fhir.Model.Code)AttributeElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); + if(_AttributeElement is not null) dest.AttributeElement = (Hl7.Fhir.Model.Code)_AttributeElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1787,48 +1693,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OtherElementComponent; - if(otherT == null) return false; + if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AttributeElement, otherT.AttributeElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AttributeElement, otherT._AttributeElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "attribute": - value = AttributeElement; - return AttributeElement is not null; + value = _AttributeElement; + return _AttributeElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "attribute": - AttributeElement = (Hl7.Fhir.Model.Code)value; + AttributeElement = (Hl7.Fhir.Model.Code?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1839,9 +1745,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AttributeElement is not null) yield return new KeyValuePair("attribute",AttributeElement); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); + if (_AttributeElement is not null) yield return new KeyValuePair("attribute",_AttributeElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); } } @@ -1871,13 +1777,13 @@ public partial class UnmappedComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConceptMapGroupUnmappedMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// use-source-code | fixed | other-map @@ -1886,13 +1792,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -1902,28 +1805,25 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapGroupUnmappedMode? Mode /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Fixed code when mode = fixed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1933,28 +1833,25 @@ public string Code /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// Display for the code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } @@ -1964,28 +1861,25 @@ public string Display /// [FhirElement("valueSet", Order=70)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Fixed code set when mode = fixed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -1997,13 +1891,13 @@ public string ValueSet [DeclaredType(Type = typeof(Code))] [Binding("UnmappedConceptMapRelationship")] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// related-to | equivalent | source-is-narrower-than-target | source-is-broader-than-target | not-related-to @@ -2012,13 +1906,10 @@ public Code RelationshipElemen [IgnoreDataMember] public Hl7.Fhir.Model.ConceptMap.ConceptMapRelationship? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -2028,48 +1919,41 @@ public Hl7.Fhir.Model.ConceptMap.ConceptMapRelationship? Relationship /// [FhirElement("otherMap", Order=90)] [DataMember] - public Hl7.Fhir.Model.Canonical OtherMapElement + public Hl7.Fhir.Model.Canonical? OtherMapElement { get { return _OtherMapElement; } set { _OtherMapElement = value; OnPropertyChanged("OtherMapElement"); } } - private Hl7.Fhir.Model.Canonical _OtherMapElement; + private Hl7.Fhir.Model.Canonical? _OtherMapElement; /// /// canonical reference to an additional ConceptMap to use for mapping if the source concept is unmapped /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OtherMap + public string? OtherMap { - get { return OtherMapElement != null ? OtherMapElement.Value : null; } + get => _OtherMapElement?.Value; set { - if (value == null) - OtherMapElement = null; - else - OtherMapElement = new Hl7.Fhir.Model.Canonical(value); + OtherMapElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("OtherMap"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UnmappedComponent; - - if (dest == null) - { + if(other is not UnmappedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(OtherMapElement != null) dest.OtherMapElement = (Hl7.Fhir.Model.Canonical)OtherMapElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_OtherMapElement is not null) dest.OtherMapElement = (Hl7.Fhir.Model.Canonical)_OtherMapElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2081,69 +1965,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UnmappedComponent; - if(otherT == null) return false; + if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(OtherMapElement, otherT.OtherMapElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_OtherMapElement, otherT._OtherMapElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "otherMap": - value = OtherMapElement; - return OtherMapElement is not null; + value = _OtherMapElement; + return _OtherMapElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "otherMap": - OtherMapElement = (Hl7.Fhir.Model.Canonical)value; + OtherMapElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -2154,12 +2038,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (OtherMapElement is not null) yield return new KeyValuePair("otherMap",OtherMapElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_OtherMapElement is not null) yield return new KeyValuePair("otherMap",_OtherMapElement); } } @@ -2169,28 +2053,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this concept map, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2203,39 +2084,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the concept map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2247,41 +2125,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this concept map (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this concept map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2291,28 +2166,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this concept map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2325,13 +2197,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2340,13 +2212,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2356,13 +2225,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2371,13 +2240,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2387,28 +2253,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2418,28 +2281,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2452,39 +2312,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the concept map. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the concept map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2497,11 +2354,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for concept map (if applicable). @@ -2512,39 +2369,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this concept map is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this concept map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2554,28 +2408,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2585,28 +2436,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -2616,28 +2464,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the ConceptMap was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -2647,28 +2492,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the ConceptMap was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2678,13 +2520,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -2695,11 +2537,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the ConceptMap. @@ -2709,11 +2551,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the ConceptMap. @@ -2723,11 +2565,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the ConceptMap. @@ -2737,11 +2579,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the ConceptMap. @@ -2751,11 +2593,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -2765,11 +2607,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Additional properties of the mapping. @@ -2779,11 +2621,11 @@ public List RelatedArtifact [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Definition of an additional attribute to act as a data source or target. @@ -2793,11 +2635,11 @@ public List Property [DataMember] public List AdditionalAttribute { - get { if(_AdditionalAttribute==null) _AdditionalAttribute = new List(); return _AdditionalAttribute; } + get => _AdditionalAttribute ?? new List(); set { _AdditionalAttribute = value; OnPropertyChanged("AdditionalAttribute"); } } - private List _AdditionalAttribute; + private List? _AdditionalAttribute; /// /// The source value set that contains the concepts that are being mapped. @@ -2806,13 +2648,13 @@ public List AdditionalAt [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType SourceScope + public Hl7.Fhir.Model.DataType? SourceScope { get { return _SourceScope; } set { _SourceScope = value; OnPropertyChanged("SourceScope"); } } - private Hl7.Fhir.Model.DataType _SourceScope; + private Hl7.Fhir.Model.DataType? _SourceScope; /// /// The target value set which provides context for the mappings. @@ -2821,13 +2663,13 @@ public Hl7.Fhir.Model.DataType SourceScope [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType TargetScope + public Hl7.Fhir.Model.DataType? TargetScope { get { return _TargetScope; } set { _TargetScope = value; OnPropertyChanged("TargetScope"); } } - private Hl7.Fhir.Model.DataType _TargetScope; + private Hl7.Fhir.Model.DataType? _TargetScope; /// /// Same source and target systems. @@ -2837,55 +2679,51 @@ public Hl7.Fhir.Model.DataType TargetScope [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ConceptMap; - - if (dest == null) - { + if(other is not ConceptMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(AdditionalAttribute.Any()) dest.AdditionalAttribute = new List(AdditionalAttribute.DeepCopyInternal()); - if(SourceScope != null) dest.SourceScope = (Hl7.Fhir.Model.DataType)SourceScope.DeepCopyInternal(); - if(TargetScope != null) dest.TargetScope = (Hl7.Fhir.Model.DataType)TargetScope.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_AdditionalAttribute is not null) dest.AdditionalAttribute = new List(_AdditionalAttribute.DeepCopyInternal()); + if(_SourceScope is not null) dest.SourceScope = (Hl7.Fhir.Model.DataType)_SourceScope.DeepCopyInternal(); + if(_TargetScope is not null) dest.TargetScope = (Hl7.Fhir.Model.DataType)_TargetScope.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2897,244 +2735,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConceptMap; - if(otherT == null) return false; + if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(AdditionalAttribute, otherT.AdditionalAttribute)) return false; - if(!comparer.Equals(SourceScope, otherT.SourceScope)) return false; - if(!comparer.Equals(TargetScope, otherT.TargetScope)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_AdditionalAttribute, otherT._AdditionalAttribute)) return false; + if(!comparer.Equals(_SourceScope, otherT._SourceScope)) return false; + if(!comparer.Equals(_TargetScope, otherT._TargetScope)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "additionalAttribute": - value = AdditionalAttribute; - return AdditionalAttribute?.Any() == true; + value = _AdditionalAttribute; + return _AdditionalAttribute?.Any() == true; case "sourceScope": - value = SourceScope; - return SourceScope is not null; + value = _SourceScope; + return _SourceScope is not null; case "targetScope": - value = TargetScope; - return TargetScope is not null; + value = _TargetScope; + return _TargetScope is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "additionalAttribute": - AdditionalAttribute = (List)value; + AdditionalAttribute = (List?)value!; return this; case "sourceScope": - SourceScope = (Hl7.Fhir.Model.DataType)value; + SourceScope = (Hl7.Fhir.Model.DataType?)value; return this; case "targetScope": - TargetScope = (Hl7.Fhir.Model.DataType)value; + TargetScope = (Hl7.Fhir.Model.DataType?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3145,37 +2983,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (AdditionalAttribute?.Any() == true) yield return new KeyValuePair("additionalAttribute",AdditionalAttribute); - if (SourceScope is not null) yield return new KeyValuePair("sourceScope",SourceScope); - if (TargetScope is not null) yield return new KeyValuePair("targetScope",TargetScope); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_AdditionalAttribute?.Any() == true) yield return new KeyValuePair("additionalAttribute",_AdditionalAttribute); + if (_SourceScope is not null) yield return new KeyValuePair("sourceScope",_SourceScope); + if (_TargetScope is not null) yield return new KeyValuePair("targetScope",_TargetScope); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Condition.cs b/src/Hl7.Fhir.R5/Model/Generated/Condition.cs index fdcc5832c..9f3a48954 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Condition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -179,13 +182,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("ConditionParticipantFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who or what participated in the activities related to the condition. @@ -195,26 +198,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Device","Organization","CareTeam")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -226,41 +225,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -271,8 +270,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -299,13 +298,13 @@ public partial class StageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("summary", Order=40)] [Binding("ConditionStage")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Summary + public Hl7.Fhir.Model.CodeableConcept? Summary { get { return _Summary; } set { _Summary = value; OnPropertyChanged("Summary"); } } - private Hl7.Fhir.Model.CodeableConcept _Summary; + private Hl7.Fhir.Model.CodeableConcept? _Summary; /// /// Formal record of assessment. @@ -317,11 +316,11 @@ public Hl7.Fhir.Model.CodeableConcept Summary [DataMember] public List Assessment { - get { if(_Assessment==null) _Assessment = new List(); return _Assessment; } + get => _Assessment ?? new List(); set { _Assessment = value; OnPropertyChanged("Assessment"); } } - private List _Assessment; + private List? _Assessment; /// /// Kind of staging. @@ -329,27 +328,23 @@ public List Assessment [FhirElement("type", Order=60)] [Binding("ConditionStageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as StageComponent; - - if (dest == null) - { + if(other is not StageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Summary != null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)Summary.DeepCopyInternal(); - if(Assessment.Any()) dest.Assessment = new List(Assessment.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_Summary is not null) dest.Summary = (Hl7.Fhir.Model.CodeableConcept)_Summary.DeepCopyInternal(); + if(_Assessment is not null) dest.Assessment = new List(_Assessment.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -361,48 +356,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StageComponent; - if(otherT == null) return false; + if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Summary, otherT.Summary)) return false; - if(!comparer.ListEquals(Assessment, otherT.Assessment)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "summary": - value = Summary; - return Summary is not null; + value = _Summary; + return _Summary is not null; case "assessment": - value = Assessment; - return Assessment?.Any() == true; + value = _Assessment; + return _Assessment?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "summary": - Summary = (Hl7.Fhir.Model.CodeableConcept)value; + Summary = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "assessment": - Assessment = (List)value; + Assessment = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -413,9 +408,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Summary is not null) yield return new KeyValuePair("summary",Summary); - if (Assessment?.Any() == true) yield return new KeyValuePair("assessment",Assessment); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_Summary is not null) yield return new KeyValuePair("summary",_Summary); + if (_Assessment?.Any() == true) yield return new KeyValuePair("assessment",_Assessment); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -428,11 +423,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | recurrence | relapse | inactive | remission | resolved | unknown. @@ -441,13 +436,13 @@ public List Identifier [Binding("ConditionClinicalStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ClinicalStatus + public Hl7.Fhir.Model.CodeableConcept? ClinicalStatus { get { return _ClinicalStatus; } set { _ClinicalStatus = value; OnPropertyChanged("ClinicalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ClinicalStatus; + private Hl7.Fhir.Model.CodeableConcept? _ClinicalStatus; /// /// unconfirmed | provisional | differential | confirmed | refuted | entered-in-error. @@ -455,13 +450,13 @@ public Hl7.Fhir.Model.CodeableConcept ClinicalStatus [FhirElement("verificationStatus", InSummary=true, IsModifier=true, Order=110, FiveWs="FiveWs.status")] [Binding("ConditionVerificationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VerificationStatus + public Hl7.Fhir.Model.CodeableConcept? VerificationStatus { get { return _VerificationStatus; } set { _VerificationStatus = value; OnPropertyChanged("VerificationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _VerificationStatus; + private Hl7.Fhir.Model.CodeableConcept? _VerificationStatus; /// /// problem-list-item | encounter-diagnosis. @@ -472,11 +467,11 @@ public Hl7.Fhir.Model.CodeableConcept VerificationStatus [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Subjective severity of condition. @@ -484,13 +479,13 @@ public List Category [FhirElement("severity", Order=130, FiveWs="FiveWs.grade")] [Binding("ConditionSeverity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Severity + public Hl7.Fhir.Model.CodeableConcept? Severity { get { return _Severity; } set { _Severity = value; OnPropertyChanged("Severity"); } } - private Hl7.Fhir.Model.CodeableConcept _Severity; + private Hl7.Fhir.Model.CodeableConcept? _Severity; /// /// Identification of the condition, problem or diagnosis. @@ -498,13 +493,13 @@ public Hl7.Fhir.Model.CodeableConcept Severity [FhirElement("code", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [Binding("ConditionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Anatomical location, if relevant. @@ -515,11 +510,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Who has the condition?. @@ -529,13 +524,13 @@ public List BodySite [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The Encounter during which this Condition was created. @@ -544,13 +539,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Estimated or actual date, date-time, or age. @@ -559,13 +554,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// When in resolution/remission. @@ -574,41 +569,38 @@ public Hl7.Fhir.Model.DataType Onset [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Abatement + public Hl7.Fhir.Model.DataType? Abatement { get { return _Abatement; } set { _Abatement = value; OnPropertyChanged("Abatement"); } } - private Hl7.Fhir.Model.DataType _Abatement; + private Hl7.Fhir.Model.DataType? _Abatement; /// /// Date condition was first recorded. /// [FhirElement("recordedDate", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedDateElement + public Hl7.Fhir.Model.FhirDateTime? RecordedDateElement { get { return _RecordedDateElement; } set { _RecordedDateElement = value; OnPropertyChanged("RecordedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedDateElement; /// /// Date condition was first recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RecordedDate + public string? RecordedDate { - get { return RecordedDateElement != null ? RecordedDateElement.Value : null; } + get => _RecordedDateElement?.Value; set { - if (value == null) - RecordedDateElement = null; - else - RecordedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RecordedDate"); } } @@ -621,11 +613,11 @@ public string RecordedDate [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Stage/grade, usually assessed formally. @@ -635,11 +627,11 @@ public List Participant [DataMember] public List Stage { - get { if(_Stage==null) _Stage = new List(); return _Stage; } + get => _Stage ?? new List(); set { _Stage = value; OnPropertyChanged("Stage"); } } - private List _Stage; + private List? _Stage; /// /// Supporting evidence for the verification status. @@ -650,11 +642,11 @@ public List Stage [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; /// /// Additional information about the Condition. @@ -664,40 +656,36 @@ public List Evidence [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Condition; - - if (dest == null) - { + if(other is not Condition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ClinicalStatus != null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)ClinicalStatus.DeepCopyInternal(); - if(VerificationStatus != null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)VerificationStatus.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Severity != null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)Severity.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Abatement != null) dest.Abatement = (Hl7.Fhir.Model.DataType)Abatement.DeepCopyInternal(); - if(RecordedDateElement != null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)RecordedDateElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Stage.Any()) dest.Stage = new List(Stage.DeepCopyInternal()); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ClinicalStatus is not null) dest.ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)_ClinicalStatus.DeepCopyInternal(); + if(_VerificationStatus is not null) dest.VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)_VerificationStatus.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Severity is not null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)_Severity.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Abatement is not null) dest.Abatement = (Hl7.Fhir.Model.DataType)_Abatement.DeepCopyInternal(); + if(_RecordedDateElement is not null) dest.RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedDateElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Stage is not null) dest.Stage = new List(_Stage.DeepCopyInternal()); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -709,139 +697,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Condition; - if(otherT == null) return false; + if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ClinicalStatus, otherT.ClinicalStatus)) return false; - if(!comparer.Equals(VerificationStatus, otherT.VerificationStatus)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Severity, otherT.Severity)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.Equals(Abatement, otherT.Abatement)) return false; - if(!comparer.Equals(RecordedDateElement, otherT.RecordedDateElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(Stage, otherT.Stage)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; + if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Severity, otherT._Severity)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.Equals(_Abatement, otherT._Abatement)) return false; + if(!comparer.Equals(_RecordedDateElement, otherT._RecordedDateElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_Stage, otherT._Stage)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "clinicalStatus": - value = ClinicalStatus; - return ClinicalStatus is not null; + value = _ClinicalStatus; + return _ClinicalStatus is not null; case "verificationStatus": - value = VerificationStatus; - return VerificationStatus is not null; + value = _VerificationStatus; + return _VerificationStatus is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "severity": - value = Severity; - return Severity is not null; + value = _Severity; + return _Severity is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "abatement": - value = Abatement; - return Abatement is not null; + value = _Abatement; + return _Abatement is not null; case "recordedDate": - value = RecordedDateElement; - return RecordedDateElement is not null; + value = _RecordedDateElement; + return _RecordedDateElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "stage": - value = Stage; - return Stage?.Any() == true; + value = _Stage; + return _Stage?.Any() == true; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "clinicalStatus": - ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ClinicalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verificationStatus": - VerificationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + VerificationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "severity": - Severity = (Hl7.Fhir.Model.CodeableConcept)value; + Severity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "abatement": - Abatement = (Hl7.Fhir.Model.DataType)value; + Abatement = (Hl7.Fhir.Model.DataType?)value; return this; case "recordedDate": - RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "stage": - Stage = (List)value; + Stage = (List?)value!; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -852,22 +840,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",ClinicalStatus); - if (VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",VerificationStatus); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Severity is not null) yield return new KeyValuePair("severity",Severity); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Abatement is not null) yield return new KeyValuePair("abatement",Abatement); - if (RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",RecordedDateElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Stage?.Any() == true) yield return new KeyValuePair("stage",Stage); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ClinicalStatus is not null) yield return new KeyValuePair("clinicalStatus",_ClinicalStatus); + if (_VerificationStatus is not null) yield return new KeyValuePair("verificationStatus",_VerificationStatus); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Severity is not null) yield return new KeyValuePair("severity",_Severity); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Abatement is not null) yield return new KeyValuePair("abatement",_Abatement); + if (_RecordedDateElement is not null) yield return new KeyValuePair("recordedDate",_RecordedDateElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Stage?.Any() == true) yield return new KeyValuePair("stage",_Stage); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs index 082c4e50b..bb3179605 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -128,13 +131,13 @@ public partial class ObservationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("ObservationCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Code for relevant Observation. @@ -142,26 +145,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=50)] [Binding("ObservationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as ObservationComponent; - - if (dest == null) - { + if(other is not ObservationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -173,41 +172,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ObservationComponent; - if(otherT == null) return false; + if(other is not ObservationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -218,8 +217,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -243,13 +242,13 @@ public partial class MedicationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("MedicationRequestCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Code for relevant Medication. @@ -257,26 +256,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=50)] [Binding("MedicationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationComponent; - - if (dest == null) - { + if(other is not MedicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -288,41 +283,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationComponent; - if(otherT == null) return false; + if(other is not MedicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -333,8 +328,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -363,13 +358,13 @@ public partial class PreconditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConditionPreconditionType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// sensitive | specific @@ -378,13 +373,10 @@ public Code TypeEl [IgnoreDataMember] public Hl7.Fhir.Model.ConditionDefinition.ConditionPreconditionType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -396,13 +388,13 @@ public Hl7.Fhir.Model.ConditionDefinition.ConditionPreconditionType? Type [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value of Observation. @@ -411,27 +403,23 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PreconditionComponent; - - if (dest == null) - { + if(other is not PreconditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -443,48 +431,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PreconditionComponent; - if(otherT == null) return false; + if(other is not PreconditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -495,9 +483,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -523,13 +511,13 @@ public partial class QuestionnaireComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConditionQuestionnairePurpose")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PurposeElement + public Code? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Code _PurposeElement; + private Code? _PurposeElement; /// /// preadmit | diff-diagnosis | outcome @@ -538,13 +526,10 @@ public Code Pu [IgnoreDataMember] public Hl7.Fhir.Model.ConditionDefinition.ConditionQuestionnairePurpose? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Code(value); + PurposeElement = value is null ? null : new Code(value); OnPropertyChanged("Purpose"); } } @@ -557,26 +542,22 @@ public Hl7.Fhir.Model.ConditionDefinition.ConditionQuestionnairePurpose? Purpose [References("Questionnaire")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as QuestionnaireComponent; - - if (dest == null) - { + if(other is not QuestionnaireComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PurposeElement != null) dest.PurposeElement = (Code)PurposeElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = (Code)_PurposeElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -588,41 +569,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QuestionnaireComponent; - if(otherT == null) return false; + if(other is not QuestionnaireComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - PurposeElement = (Code)value; + PurposeElement = (Code?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -633,8 +614,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -657,13 +638,13 @@ public partial class PlanComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("role", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// The actual plan. @@ -673,26 +654,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("PlanDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as PlanComponent; - - if (dest == null) - { + if(other is not PlanComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -704,41 +681,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanComponent; - if(otherT == null) return false; + if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -749,8 +726,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -760,28 +737,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this condition definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -794,39 +768,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the condition definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the condition definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -838,41 +809,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this condition definition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this condition definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -882,28 +850,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this condition definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -913,28 +878,25 @@ public string Title /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -947,13 +909,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -962,13 +924,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -978,13 +937,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -993,13 +952,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1009,28 +965,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1040,28 +993,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1074,39 +1024,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the condition definition. /// [FhirElement("description", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the condition definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1119,11 +1066,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for condition definition (if applicable). @@ -1134,11 +1081,11 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Identification of the condition, problem or diagnosis. @@ -1147,13 +1094,13 @@ public List Jurisdiction [Binding("ConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Subjective severity of condition. @@ -1161,13 +1108,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("severity", InSummary=true, Order=250)] [Binding("ConditionSeverity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Severity + public Hl7.Fhir.Model.CodeableConcept? Severity { get { return _Severity; } set { _Severity = value; OnPropertyChanged("Severity"); } } - private Hl7.Fhir.Model.CodeableConcept _Severity; + private Hl7.Fhir.Model.CodeableConcept? _Severity; /// /// Anatomical location, if relevant. @@ -1175,13 +1122,13 @@ public Hl7.Fhir.Model.CodeableConcept Severity [FhirElement("bodySite", InSummary=true, Order=260)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Stage/grade, usually assessed formally. @@ -1189,26 +1136,26 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [FhirElement("stage", InSummary=true, Order=270)] [Binding("ConditionStage")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Stage + public Hl7.Fhir.Model.CodeableConcept? Stage { get { return _Stage; } set { _Stage = value; OnPropertyChanged("Stage"); } } - private Hl7.Fhir.Model.CodeableConcept _Stage; + private Hl7.Fhir.Model.CodeableConcept? _Stage; /// /// Whether Severity is appropriate. /// [FhirElement("hasSeverity", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean HasSeverityElement + public Hl7.Fhir.Model.FhirBoolean? HasSeverityElement { get { return _HasSeverityElement; } set { _HasSeverityElement = value; OnPropertyChanged("HasSeverityElement"); } } - private Hl7.Fhir.Model.FhirBoolean _HasSeverityElement; + private Hl7.Fhir.Model.FhirBoolean? _HasSeverityElement; /// /// Whether Severity is appropriate @@ -1217,13 +1164,10 @@ public Hl7.Fhir.Model.FhirBoolean HasSeverityElement [IgnoreDataMember] public bool? HasSeverity { - get { return HasSeverityElement != null ? HasSeverityElement.Value : null; } + get => _HasSeverityElement?.Value; set { - if (value == null) - HasSeverityElement = null; - else - HasSeverityElement = new Hl7.Fhir.Model.FhirBoolean(value); + HasSeverityElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("HasSeverity"); } } @@ -1233,13 +1177,13 @@ public bool? HasSeverity /// [FhirElement("hasBodySite", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean HasBodySiteElement + public Hl7.Fhir.Model.FhirBoolean? HasBodySiteElement { get { return _HasBodySiteElement; } set { _HasBodySiteElement = value; OnPropertyChanged("HasBodySiteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _HasBodySiteElement; + private Hl7.Fhir.Model.FhirBoolean? _HasBodySiteElement; /// /// Whether bodySite is appropriate @@ -1248,13 +1192,10 @@ public Hl7.Fhir.Model.FhirBoolean HasBodySiteElement [IgnoreDataMember] public bool? HasBodySite { - get { return HasBodySiteElement != null ? HasBodySiteElement.Value : null; } + get => _HasBodySiteElement?.Value; set { - if (value == null) - HasBodySiteElement = null; - else - HasBodySiteElement = new Hl7.Fhir.Model.FhirBoolean(value); + HasBodySiteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("HasBodySite"); } } @@ -1264,13 +1205,13 @@ public bool? HasBodySite /// [FhirElement("hasStage", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean HasStageElement + public Hl7.Fhir.Model.FhirBoolean? HasStageElement { get { return _HasStageElement; } set { _HasStageElement = value; OnPropertyChanged("HasStageElement"); } } - private Hl7.Fhir.Model.FhirBoolean _HasStageElement; + private Hl7.Fhir.Model.FhirBoolean? _HasStageElement; /// /// Whether stage is appropriate @@ -1279,13 +1220,10 @@ public Hl7.Fhir.Model.FhirBoolean HasStageElement [IgnoreDataMember] public bool? HasStage { - get { return HasStageElement != null ? HasStageElement.Value : null; } + get => _HasStageElement?.Value; set { - if (value == null) - HasStageElement = null; - else - HasStageElement = new Hl7.Fhir.Model.FhirBoolean(value); + HasStageElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("HasStage"); } } @@ -1298,24 +1236,24 @@ public bool? HasStage [DataMember] public List DefinitionElement { - get { if(_DefinitionElement==null) _DefinitionElement = new List(); return _DefinitionElement; } + get => _DefinitionElement ?? new List(); set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private List _DefinitionElement; + private List? _DefinitionElement; /// /// Formal Definition for the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Definition + public IEnumerable? Definition { - get { return DefinitionElement != null ? DefinitionElement.Select(elem => elem.Value) : null; } + get => _DefinitionElement?.Select(elem => elem.Value); set { if (value == null) - DefinitionElement = null; + DefinitionElement = null!; else DefinitionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Definition"); @@ -1330,11 +1268,11 @@ public IEnumerable Definition [DataMember] public List Observation { - get { if(_Observation==null) _Observation = new List(); return _Observation; } + get => _Observation ?? new List(); set { _Observation = value; OnPropertyChanged("Observation"); } } - private List _Observation; + private List? _Observation; /// /// Medications particularly relevant for this condition. @@ -1344,11 +1282,11 @@ public List Observation [DataMember] public List Medication { - get { if(_Medication==null) _Medication = new List(); return _Medication; } + get => _Medication ?? new List(); set { _Medication = value; OnPropertyChanged("Medication"); } } - private List _Medication; + private List? _Medication; /// /// Observation that suggets this condition. @@ -1358,11 +1296,11 @@ public List Medication [DataMember] public List Precondition { - get { if(_Precondition==null) _Precondition = new List(); return _Precondition; } + get => _Precondition ?? new List(); set { _Precondition = value; OnPropertyChanged("Precondition"); } } - private List _Precondition; + private List? _Precondition; /// /// Appropriate team for this condition. @@ -1374,11 +1312,11 @@ public List Preconditi [DataMember] public List Team { - get { if(_Team==null) _Team = new List(); return _Team; } + get => _Team ?? new List(); set { _Team = value; OnPropertyChanged("Team"); } } - private List _Team; + private List? _Team; /// /// Questionnaire for this condition. @@ -1388,11 +1326,11 @@ public List Team [DataMember] public List Questionnaire { - get { if(_Questionnaire==null) _Questionnaire = new List(); return _Questionnaire; } + get => _Questionnaire ?? new List(); set { _Questionnaire = value; OnPropertyChanged("Questionnaire"); } } - private List _Questionnaire; + private List? _Questionnaire; /// /// Plan that is appropriate. @@ -1402,53 +1340,49 @@ public List Questionn [DataMember] public List Plan { - get { if(_Plan==null) _Plan = new List(); return _Plan; } + get => _Plan ?? new List(); set { _Plan = value; OnPropertyChanged("Plan"); } } - private List _Plan; + private List? _Plan; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionDefinition; - - if (dest == null) - { + if(other is not ConditionDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Severity != null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)Severity.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Stage != null) dest.Stage = (Hl7.Fhir.Model.CodeableConcept)Stage.DeepCopyInternal(); - if(HasSeverityElement != null) dest.HasSeverityElement = (Hl7.Fhir.Model.FhirBoolean)HasSeverityElement.DeepCopyInternal(); - if(HasBodySiteElement != null) dest.HasBodySiteElement = (Hl7.Fhir.Model.FhirBoolean)HasBodySiteElement.DeepCopyInternal(); - if(HasStageElement != null) dest.HasStageElement = (Hl7.Fhir.Model.FhirBoolean)HasStageElement.DeepCopyInternal(); - if(DefinitionElement.Any()) dest.DefinitionElement = new List(DefinitionElement.DeepCopyInternal()); - if(Observation.Any()) dest.Observation = new List(Observation.DeepCopyInternal()); - if(Medication.Any()) dest.Medication = new List(Medication.DeepCopyInternal()); - if(Precondition.Any()) dest.Precondition = new List(Precondition.DeepCopyInternal()); - if(Team.Any()) dest.Team = new List(Team.DeepCopyInternal()); - if(Questionnaire.Any()) dest.Questionnaire = new List(Questionnaire.DeepCopyInternal()); - if(Plan.Any()) dest.Plan = new List(Plan.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Severity is not null) dest.Severity = (Hl7.Fhir.Model.CodeableConcept)_Severity.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Stage is not null) dest.Stage = (Hl7.Fhir.Model.CodeableConcept)_Stage.DeepCopyInternal(); + if(_HasSeverityElement is not null) dest.HasSeverityElement = (Hl7.Fhir.Model.FhirBoolean)_HasSeverityElement.DeepCopyInternal(); + if(_HasBodySiteElement is not null) dest.HasBodySiteElement = (Hl7.Fhir.Model.FhirBoolean)_HasBodySiteElement.DeepCopyInternal(); + if(_HasStageElement is not null) dest.HasStageElement = (Hl7.Fhir.Model.FhirBoolean)_HasStageElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = new List(_DefinitionElement.DeepCopyInternal()); + if(_Observation is not null) dest.Observation = new List(_Observation.DeepCopyInternal()); + if(_Medication is not null) dest.Medication = new List(_Medication.DeepCopyInternal()); + if(_Precondition is not null) dest.Precondition = new List(_Precondition.DeepCopyInternal()); + if(_Team is not null) dest.Team = new List(_Team.DeepCopyInternal()); + if(_Questionnaire is not null) dest.Questionnaire = new List(_Questionnaire.DeepCopyInternal()); + if(_Plan is not null) dest.Plan = new List(_Plan.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1460,230 +1394,230 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionDefinition; - if(otherT == null) return false; + if(other is not ConditionDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Severity, otherT.Severity)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Stage, otherT.Stage)) return false; - if(!comparer.Equals(HasSeverityElement, otherT.HasSeverityElement)) return false; - if(!comparer.Equals(HasBodySiteElement, otherT.HasBodySiteElement)) return false; - if(!comparer.Equals(HasStageElement, otherT.HasStageElement)) return false; - if(!comparer.ListEquals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.ListEquals(Observation, otherT.Observation)) return false; - if(!comparer.ListEquals(Medication, otherT.Medication)) return false; - if(!comparer.ListEquals(Precondition, otherT.Precondition)) return false; - if(!comparer.ListEquals(Team, otherT.Team)) return false; - if(!comparer.ListEquals(Questionnaire, otherT.Questionnaire)) return false; - if(!comparer.ListEquals(Plan, otherT.Plan)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Severity, otherT._Severity)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Stage, otherT._Stage)) return false; + if(!comparer.Equals(_HasSeverityElement, otherT._HasSeverityElement)) return false; + if(!comparer.Equals(_HasBodySiteElement, otherT._HasBodySiteElement)) return false; + if(!comparer.Equals(_HasStageElement, otherT._HasStageElement)) return false; + if(!comparer.ListEquals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.ListEquals(_Observation, otherT._Observation)) return false; + if(!comparer.ListEquals(_Medication, otherT._Medication)) return false; + if(!comparer.ListEquals(_Precondition, otherT._Precondition)) return false; + if(!comparer.ListEquals(_Team, otherT._Team)) return false; + if(!comparer.ListEquals(_Questionnaire, otherT._Questionnaire)) return false; + if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "severity": - value = Severity; - return Severity is not null; + value = _Severity; + return _Severity is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "stage": - value = Stage; - return Stage is not null; + value = _Stage; + return _Stage is not null; case "hasSeverity": - value = HasSeverityElement; - return HasSeverityElement is not null; + value = _HasSeverityElement; + return _HasSeverityElement is not null; case "hasBodySite": - value = HasBodySiteElement; - return HasBodySiteElement is not null; + value = _HasBodySiteElement; + return _HasBodySiteElement is not null; case "hasStage": - value = HasStageElement; - return HasStageElement is not null; + value = _HasStageElement; + return _HasStageElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement?.Any() == true; + value = _DefinitionElement; + return _DefinitionElement?.Any() == true; case "observation": - value = Observation; - return Observation?.Any() == true; + value = _Observation; + return _Observation?.Any() == true; case "medication": - value = Medication; - return Medication?.Any() == true; + value = _Medication; + return _Medication?.Any() == true; case "precondition": - value = Precondition; - return Precondition?.Any() == true; + value = _Precondition; + return _Precondition?.Any() == true; case "team": - value = Team; - return Team?.Any() == true; + value = _Team; + return _Team?.Any() == true; case "questionnaire": - value = Questionnaire; - return Questionnaire?.Any() == true; + value = _Questionnaire; + return _Questionnaire?.Any() == true; case "plan": - value = Plan; - return Plan?.Any() == true; + value = _Plan; + return _Plan?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "severity": - Severity = (Hl7.Fhir.Model.CodeableConcept)value; + Severity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "stage": - Stage = (Hl7.Fhir.Model.CodeableConcept)value; + Stage = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "hasSeverity": - HasSeverityElement = (Hl7.Fhir.Model.FhirBoolean)value; + HasSeverityElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "hasBodySite": - HasBodySiteElement = (Hl7.Fhir.Model.FhirBoolean)value; + HasBodySiteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "hasStage": - HasStageElement = (Hl7.Fhir.Model.FhirBoolean)value; + HasStageElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "definition": - DefinitionElement = (List)value; + DefinitionElement = (List?)value!; return this; case "observation": - Observation = (List)value; + Observation = (List?)value!; return this; case "medication": - Medication = (List)value; + Medication = (List?)value!; return this; case "precondition": - Precondition = (List)value; + Precondition = (List?)value!; return this; case "team": - Team = (List)value; + Team = (List?)value!; return this; case "questionnaire": - Questionnaire = (List)value; + Questionnaire = (List?)value!; return this; case "plan": - Plan = (List)value; + Plan = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1694,35 +1628,35 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Severity is not null) yield return new KeyValuePair("severity",Severity); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Stage is not null) yield return new KeyValuePair("stage",Stage); - if (HasSeverityElement is not null) yield return new KeyValuePair("hasSeverity",HasSeverityElement); - if (HasBodySiteElement is not null) yield return new KeyValuePair("hasBodySite",HasBodySiteElement); - if (HasStageElement is not null) yield return new KeyValuePair("hasStage",HasStageElement); - if (DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",DefinitionElement); - if (Observation?.Any() == true) yield return new KeyValuePair("observation",Observation); - if (Medication?.Any() == true) yield return new KeyValuePair("medication",Medication); - if (Precondition?.Any() == true) yield return new KeyValuePair("precondition",Precondition); - if (Team?.Any() == true) yield return new KeyValuePair("team",Team); - if (Questionnaire?.Any() == true) yield return new KeyValuePair("questionnaire",Questionnaire); - if (Plan?.Any() == true) yield return new KeyValuePair("plan",Plan); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Severity is not null) yield return new KeyValuePair("severity",_Severity); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Stage is not null) yield return new KeyValuePair("stage",_Stage); + if (_HasSeverityElement is not null) yield return new KeyValuePair("hasSeverity",_HasSeverityElement); + if (_HasBodySiteElement is not null) yield return new KeyValuePair("hasBodySite",_HasBodySiteElement); + if (_HasStageElement is not null) yield return new KeyValuePair("hasStage",_HasStageElement); + if (_DefinitionElement?.Any() == true) yield return new KeyValuePair("definition",_DefinitionElement); + if (_Observation?.Any() == true) yield return new KeyValuePair("observation",_Observation); + if (_Medication?.Any() == true) yield return new KeyValuePair("medication",_Medication); + if (_Precondition?.Any() == true) yield return new KeyValuePair("precondition",_Precondition); + if (_Team?.Any() == true) yield return new KeyValuePair("team",_Team); + if (_Questionnaire?.Any() == true) yield return new KeyValuePair("questionnaire",_Questionnaire); + if (_Plan?.Any() == true) yield return new KeyValuePair("plan",_Plan); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs index d4ade0059..747f82597 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -129,57 +132,50 @@ public partial class PolicyBasisComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// URL to a computable backing policy. /// [FhirElement("url", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// URL to a computable backing policy /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PolicyBasisComponent; - - if (dest == null) - { + if(other is not PolicyBasisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -191,41 +187,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PolicyBasisComponent; - if(otherT == null) return false; + if(other is not PolicyBasisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -236,8 +232,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -264,13 +260,13 @@ public partial class VerificationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("verified", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean VerifiedElement + public Hl7.Fhir.Model.FhirBoolean? VerifiedElement { get { return _VerifiedElement; } set { _VerifiedElement = value; OnPropertyChanged("VerifiedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _VerifiedElement; + private Hl7.Fhir.Model.FhirBoolean? _VerifiedElement; /// /// Has been verified @@ -279,13 +275,10 @@ public Hl7.Fhir.Model.FhirBoolean VerifiedElement [IgnoreDataMember] public bool? Verified { - get { return VerifiedElement != null ? VerifiedElement.Value : null; } + get => _VerifiedElement?.Value; set { - if (value == null) - VerifiedElement = null; - else - VerifiedElement = new Hl7.Fhir.Model.FhirBoolean(value); + VerifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Verified"); } } @@ -296,13 +289,13 @@ public bool? Verified [FhirElement("verificationType", Order=50)] [Binding("ConsentVerificationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VerificationType + public Hl7.Fhir.Model.CodeableConcept? VerificationType { get { return _VerificationType; } set { _VerificationType = value; OnPropertyChanged("VerificationType"); } } - private Hl7.Fhir.Model.CodeableConcept _VerificationType; + private Hl7.Fhir.Model.CodeableConcept? _VerificationType; /// /// Person conducting verification. @@ -311,13 +304,13 @@ public Hl7.Fhir.Model.CodeableConcept VerificationType [CLSCompliant(false)] [References("Organization","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference VerifiedBy + public Hl7.Fhir.Model.ResourceReference? VerifiedBy { get { return _VerifiedBy; } set { _VerifiedBy = value; OnPropertyChanged("VerifiedBy"); } } - private Hl7.Fhir.Model.ResourceReference _VerifiedBy; + private Hl7.Fhir.Model.ResourceReference? _VerifiedBy; /// /// Person who verified. @@ -326,13 +319,13 @@ public Hl7.Fhir.Model.ResourceReference VerifiedBy [CLSCompliant(false)] [References("Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference VerifiedWith + public Hl7.Fhir.Model.ResourceReference? VerifiedWith { get { return _VerifiedWith; } set { _VerifiedWith = value; OnPropertyChanged("VerifiedWith"); } } - private Hl7.Fhir.Model.ResourceReference _VerifiedWith; + private Hl7.Fhir.Model.ResourceReference? _VerifiedWith; /// /// When consent verified. @@ -342,24 +335,24 @@ public Hl7.Fhir.Model.ResourceReference VerifiedWith [DataMember] public List VerificationDateElement { - get { if(_VerificationDateElement==null) _VerificationDateElement = new List(); return _VerificationDateElement; } + get => _VerificationDateElement ?? new List(); set { _VerificationDateElement = value; OnPropertyChanged("VerificationDateElement"); } } - private List _VerificationDateElement; + private List? _VerificationDateElement; /// /// When consent verified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable VerificationDate + public IEnumerable? VerificationDate { - get { return VerificationDateElement != null ? VerificationDateElement.Select(elem => elem.Value) : null; } + get => _VerificationDateElement?.Select(elem => elem.Value); set { if (value == null) - VerificationDateElement = null; + VerificationDateElement = null!; else VerificationDateElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDateTime(elem))); OnPropertyChanged("VerificationDate"); @@ -368,19 +361,15 @@ public IEnumerable VerificationDate protected internal override void CopyToInternal(Base other) { - var dest = other as VerificationComponent; - - if (dest == null) - { + if(other is not VerificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VerifiedElement != null) dest.VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)VerifiedElement.DeepCopyInternal(); - if(VerificationType != null) dest.VerificationType = (Hl7.Fhir.Model.CodeableConcept)VerificationType.DeepCopyInternal(); - if(VerifiedBy != null) dest.VerifiedBy = (Hl7.Fhir.Model.ResourceReference)VerifiedBy.DeepCopyInternal(); - if(VerifiedWith != null) dest.VerifiedWith = (Hl7.Fhir.Model.ResourceReference)VerifiedWith.DeepCopyInternal(); - if(VerificationDateElement.Any()) dest.VerificationDateElement = new List(VerificationDateElement.DeepCopyInternal()); + if(_VerifiedElement is not null) dest.VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)_VerifiedElement.DeepCopyInternal(); + if(_VerificationType is not null) dest.VerificationType = (Hl7.Fhir.Model.CodeableConcept)_VerificationType.DeepCopyInternal(); + if(_VerifiedBy is not null) dest.VerifiedBy = (Hl7.Fhir.Model.ResourceReference)_VerifiedBy.DeepCopyInternal(); + if(_VerifiedWith is not null) dest.VerifiedWith = (Hl7.Fhir.Model.ResourceReference)_VerifiedWith.DeepCopyInternal(); + if(_VerificationDateElement is not null) dest.VerificationDateElement = new List(_VerificationDateElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -392,62 +381,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VerificationComponent; - if(otherT == null) return false; + if(other is not VerificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VerifiedElement, otherT.VerifiedElement)) return false; - if(!comparer.Equals(VerificationType, otherT.VerificationType)) return false; - if(!comparer.Equals(VerifiedBy, otherT.VerifiedBy)) return false; - if(!comparer.Equals(VerifiedWith, otherT.VerifiedWith)) return false; - if(!comparer.ListEquals(VerificationDateElement, otherT.VerificationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; + if(!comparer.Equals(_VerificationType, otherT._VerificationType)) return false; + if(!comparer.Equals(_VerifiedBy, otherT._VerifiedBy)) return false; + if(!comparer.Equals(_VerifiedWith, otherT._VerifiedWith)) return false; + if(!comparer.ListEquals(_VerificationDateElement, otherT._VerificationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "verified": - value = VerifiedElement; - return VerifiedElement is not null; + value = _VerifiedElement; + return _VerifiedElement is not null; case "verificationType": - value = VerificationType; - return VerificationType is not null; + value = _VerificationType; + return _VerificationType is not null; case "verifiedBy": - value = VerifiedBy; - return VerifiedBy is not null; + value = _VerifiedBy; + return _VerifiedBy is not null; case "verifiedWith": - value = VerifiedWith; - return VerifiedWith is not null; + value = _VerifiedWith; + return _VerifiedWith is not null; case "verificationDate": - value = VerificationDateElement; - return VerificationDateElement?.Any() == true; + value = _VerificationDateElement; + return _VerificationDateElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "verified": - VerifiedElement = (Hl7.Fhir.Model.FhirBoolean)value; + VerifiedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "verificationType": - VerificationType = (Hl7.Fhir.Model.CodeableConcept)value; + VerificationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "verifiedBy": - VerifiedBy = (Hl7.Fhir.Model.ResourceReference)value; + VerifiedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "verifiedWith": - VerifiedWith = (Hl7.Fhir.Model.ResourceReference)value; + VerifiedWith = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "verificationDate": - VerificationDateElement = (List)value; + VerificationDateElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -458,11 +447,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VerifiedElement is not null) yield return new KeyValuePair("verified",VerifiedElement); - if (VerificationType is not null) yield return new KeyValuePair("verificationType",VerificationType); - if (VerifiedBy is not null) yield return new KeyValuePair("verifiedBy",VerifiedBy); - if (VerifiedWith is not null) yield return new KeyValuePair("verifiedWith",VerifiedWith); - if (VerificationDateElement?.Any() == true) yield return new KeyValuePair("verificationDate",VerificationDateElement); + if (_VerifiedElement is not null) yield return new KeyValuePair("verified",_VerifiedElement); + if (_VerificationType is not null) yield return new KeyValuePair("verificationType",_VerificationType); + if (_VerifiedBy is not null) yield return new KeyValuePair("verifiedBy",_VerifiedBy); + if (_VerifiedWith is not null) yield return new KeyValuePair("verifiedWith",_VerifiedWith); + if (_VerificationDateElement?.Any() == true) yield return new KeyValuePair("verificationDate",_VerificationDateElement); } } @@ -488,13 +477,13 @@ public partial class provisionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("period", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Who|what controlled by this provision (or group, by role). @@ -504,11 +493,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Actions controlled by this provision. @@ -519,11 +508,11 @@ public List Actor [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Security Labels that define affected resources. @@ -534,11 +523,11 @@ public List Action [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of activities covered by this provision. @@ -549,11 +538,11 @@ public List SecurityLabel [DataMember] public List Purpose { - get { if(_Purpose==null) _Purpose = new List(); return _Purpose; } + get => _Purpose ?? new List(); set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private List _Purpose; + private List? _Purpose; /// /// e.g. Resource Type, Profile, CDA, etc. @@ -564,11 +553,11 @@ public List Purpose [DataMember] public List DocumentType { - get { if(_DocumentType==null) _DocumentType = new List(); return _DocumentType; } + get => _DocumentType ?? new List(); set { _DocumentType = value; OnPropertyChanged("DocumentType"); } } - private List _DocumentType; + private List? _DocumentType; /// /// e.g. Resource Type, Profile, etc. @@ -579,11 +568,11 @@ public List DocumentType [DataMember] public List ResourceType { - get { if(_ResourceType==null) _ResourceType = new List(); return _ResourceType; } + get => _ResourceType ?? new List(); set { _ResourceType = value; OnPropertyChanged("ResourceType"); } } - private List _ResourceType; + private List? _ResourceType; /// /// e.g. LOINC or SNOMED CT code, etc. in the content. @@ -594,24 +583,24 @@ public List ResourceType [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Timeframe for data controlled by this provision. /// [FhirElement("dataPeriod", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period DataPeriod + public Hl7.Fhir.Model.Period? DataPeriod { get { return _DataPeriod; } set { _DataPeriod = value; OnPropertyChanged("DataPeriod"); } } - private Hl7.Fhir.Model.Period _DataPeriod; + private Hl7.Fhir.Model.Period? _DataPeriod; /// /// Data controlled by this provision. @@ -621,24 +610,24 @@ public Hl7.Fhir.Model.Period DataPeriod [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// A computable expression of the consent. /// [FhirElement("expression", Order=140)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; /// /// Nested Exception Provisions. @@ -648,34 +637,30 @@ public Hl7.Fhir.Model.Expression Expression [DataMember] public List Provision { - get { if(_Provision==null) _Provision = new List(); return _Provision; } + get => _Provision ?? new List(); set { _Provision = value; OnPropertyChanged("Provision"); } } - private List _Provision; + private List? _Provision; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionComponent; - - if (dest == null) - { + if(other is not provisionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Purpose.Any()) dest.Purpose = new List(Purpose.DeepCopyInternal()); - if(DocumentType.Any()) dest.DocumentType = new List(DocumentType.DeepCopyInternal()); - if(ResourceType.Any()) dest.ResourceType = new List(ResourceType.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(DataPeriod != null) dest.DataPeriod = (Hl7.Fhir.Model.Period)DataPeriod.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); - if(Provision.Any()) dest.Provision = new List(Provision.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Purpose is not null) dest.Purpose = new List(_Purpose.DeepCopyInternal()); + if(_DocumentType is not null) dest.DocumentType = new List(_DocumentType.DeepCopyInternal()); + if(_ResourceType is not null) dest.ResourceType = new List(_ResourceType.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_DataPeriod is not null) dest.DataPeriod = (Hl7.Fhir.Model.Period)_DataPeriod.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); + if(_Provision is not null) dest.Provision = new List(_Provision.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -687,111 +672,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionComponent; - if(otherT == null) return false; + if(other is not provisionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Purpose, otherT.Purpose)) return false; - if(!comparer.ListEquals(DocumentType, otherT.DocumentType)) return false; - if(!comparer.ListEquals(ResourceType, otherT.ResourceType)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(DataPeriod, otherT.DataPeriod)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; - if(!comparer.ListEquals(Provision, otherT.Provision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Purpose, otherT._Purpose)) return false; + if(!comparer.ListEquals(_DocumentType, otherT._DocumentType)) return false; + if(!comparer.ListEquals(_ResourceType, otherT._ResourceType)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; + if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "purpose": - value = Purpose; - return Purpose?.Any() == true; + value = _Purpose; + return _Purpose?.Any() == true; case "documentType": - value = DocumentType; - return DocumentType?.Any() == true; + value = _DocumentType; + return _DocumentType?.Any() == true; case "resourceType": - value = ResourceType; - return ResourceType?.Any() == true; + value = _ResourceType; + return _ResourceType?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "dataPeriod": - value = DataPeriod; - return DataPeriod is not null; + value = _DataPeriod; + return _DataPeriod is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; case "provision": - value = Provision; - return Provision?.Any() == true; + value = _Provision; + return _Provision?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "purpose": - Purpose = (List)value; + Purpose = (List?)value!; return this; case "documentType": - DocumentType = (List)value; + DocumentType = (List?)value!; return this; case "resourceType": - ResourceType = (List)value; + ResourceType = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "dataPeriod": - DataPeriod = (Hl7.Fhir.Model.Period)value; + DataPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; case "provision": - Provision = (List)value; + Provision = (List?)value!; return this; default: return base.SetValue(key, value); @@ -802,18 +787,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Purpose?.Any() == true) yield return new KeyValuePair("purpose",Purpose); - if (DocumentType?.Any() == true) yield return new KeyValuePair("documentType",DocumentType); - if (ResourceType?.Any() == true) yield return new KeyValuePair("resourceType",ResourceType); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (DataPeriod is not null) yield return new KeyValuePair("dataPeriod",DataPeriod); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); - if (Provision?.Any() == true) yield return new KeyValuePair("provision",Provision); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Purpose?.Any() == true) yield return new KeyValuePair("purpose",_Purpose); + if (_DocumentType?.Any() == true) yield return new KeyValuePair("documentType",_DocumentType); + if (_ResourceType?.Any() == true) yield return new KeyValuePair("resourceType",_ResourceType); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_DataPeriod is not null) yield return new KeyValuePair("dataPeriod",_DataPeriod); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); + if (_Provision?.Any() == true) yield return new KeyValuePair("provision",_Provision); } } @@ -840,13 +825,13 @@ public partial class provisionActorComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("role", Order=40)] [Binding("ConsentActorRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Resource for the actor (or group, by role). @@ -855,26 +840,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [CLSCompliant(false)] [References("Device","Group","CareTeam","Organization","Patient","Practitioner","RelatedPerson","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionActorComponent; - - if (dest == null) - { + if(other is not provisionActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -886,41 +867,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionActorComponent; - if(otherT == null) return false; + if(other is not provisionActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -931,8 +912,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -961,13 +942,13 @@ public partial class provisionDataComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentDataMeaning")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MeaningElement + public Code? MeaningElement { get { return _MeaningElement; } set { _MeaningElement = value; OnPropertyChanged("MeaningElement"); } } - private Code _MeaningElement; + private Code? _MeaningElement; /// /// instance | related | dependents | authoredby @@ -976,13 +957,10 @@ public Code MeaningElement [IgnoreDataMember] public Hl7.Fhir.Model.ConsentDataMeaning? Meaning { - get { return MeaningElement != null ? MeaningElement.Value : null; } + get => _MeaningElement?.Value; set { - if (value == null) - MeaningElement = null; - else - MeaningElement = new Code(value); + MeaningElement = value is null ? null : new Code(value); OnPropertyChanged("Meaning"); } } @@ -995,26 +973,22 @@ public Hl7.Fhir.Model.ConsentDataMeaning? Meaning [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as provisionDataComponent; - - if (dest == null) - { + if(other is not provisionDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MeaningElement != null) dest.MeaningElement = (Code)MeaningElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_MeaningElement is not null) dest.MeaningElement = (Code)_MeaningElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1026,41 +1000,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as provisionDataComponent; - if(otherT == null) return false; + if(other is not provisionDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MeaningElement, otherT.MeaningElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "meaning": - value = MeaningElement; - return MeaningElement is not null; + value = _MeaningElement; + return _MeaningElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "meaning": - MeaningElement = (Code)value; + MeaningElement = (Code?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1071,8 +1045,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MeaningElement is not null) yield return new KeyValuePair("meaning",MeaningElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_MeaningElement is not null) yield return new KeyValuePair("meaning",_MeaningElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -1085,11 +1059,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | inactive | not-done | entered-in-error | unknown. @@ -1099,13 +1073,13 @@ public List Identifier [Binding("ConsentState")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | inactive | not-done | entered-in-error | unknown @@ -1114,13 +1088,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Consent.ConsentState? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1134,11 +1105,11 @@ public Hl7.Fhir.Model.Consent.ConsentState? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who the consent applies to. @@ -1147,41 +1118,38 @@ public List Category [CLSCompliant(false)] [References("Patient","Practitioner","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Fully executed date of the consent. /// [FhirElement("date", InSummary=true, Order=130, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Fully executed date of the consent /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1191,13 +1159,13 @@ public string Date /// [FhirElement("period", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Who is granting rights according to the policy and rules. @@ -1209,11 +1177,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Grantor { - get { if(_Grantor==null) _Grantor = new List(); return _Grantor; } + get => _Grantor ?? new List(); set { _Grantor = value; OnPropertyChanged("Grantor"); } } - private List _Grantor; + private List? _Grantor; /// /// Who is agreeing to the policy and rules. @@ -1225,11 +1193,11 @@ public List Grantor [DataMember] public List Grantee { - get { if(_Grantee==null) _Grantee = new List(); return _Grantee; } + get => _Grantee ?? new List(); set { _Grantee = value; OnPropertyChanged("Grantee"); } } - private List _Grantee; + private List? _Grantee; /// /// Consent workflow management. @@ -1241,11 +1209,11 @@ public List Grantee [DataMember] public List Manager { - get { if(_Manager==null) _Manager = new List(); return _Manager; } + get => _Manager ?? new List(); set { _Manager = value; OnPropertyChanged("Manager"); } } - private List _Manager; + private List? _Manager; /// /// Consent Enforcer. @@ -1257,11 +1225,11 @@ public List Manager [DataMember] public List Controller { - get { if(_Controller==null) _Controller = new List(); return _Controller; } + get => _Controller ?? new List(); set { _Controller = value; OnPropertyChanged("Controller"); } } - private List _Controller; + private List? _Controller; /// /// Source from which this consent is taken. @@ -1271,11 +1239,11 @@ public List Controller [DataMember] public List SourceAttachment { - get { if(_SourceAttachment==null) _SourceAttachment = new List(); return _SourceAttachment; } + get => _SourceAttachment ?? new List(); set { _SourceAttachment = value; OnPropertyChanged("SourceAttachment"); } } - private List _SourceAttachment; + private List? _SourceAttachment; /// /// Source from which this consent is taken. @@ -1287,11 +1255,11 @@ public List SourceAttachment [DataMember] public List SourceReference { - get { if(_SourceReference==null) _SourceReference = new List(); return _SourceReference; } + get => _SourceReference ?? new List(); set { _SourceReference = value; OnPropertyChanged("SourceReference"); } } - private List _SourceReference; + private List? _SourceReference; /// /// Regulations establishing base Consent. @@ -1302,24 +1270,24 @@ public List SourceReference [DataMember] public List RegulatoryBasis { - get { if(_RegulatoryBasis==null) _RegulatoryBasis = new List(); return _RegulatoryBasis; } + get => _RegulatoryBasis ?? new List(); set { _RegulatoryBasis = value; OnPropertyChanged("RegulatoryBasis"); } } - private List _RegulatoryBasis; + private List? _RegulatoryBasis; /// /// Computable version of the backing policy. /// [FhirElement("policyBasis", Order=220)] [DataMember] - public Hl7.Fhir.Model.Consent.PolicyBasisComponent PolicyBasis + public Hl7.Fhir.Model.Consent.PolicyBasisComponent? PolicyBasis { get { return _PolicyBasis; } set { _PolicyBasis = value; OnPropertyChanged("PolicyBasis"); } } - private Hl7.Fhir.Model.Consent.PolicyBasisComponent _PolicyBasis; + private Hl7.Fhir.Model.Consent.PolicyBasisComponent? _PolicyBasis; /// /// Human Readable Policy. @@ -1331,11 +1299,11 @@ public Hl7.Fhir.Model.Consent.PolicyBasisComponent PolicyBasis [DataMember] public List PolicyText { - get { if(_PolicyText==null) _PolicyText = new List(); return _PolicyText; } + get => _PolicyText ?? new List(); set { _PolicyText = value; OnPropertyChanged("PolicyText"); } } - private List _PolicyText; + private List? _PolicyText; /// /// Consent Verified by patient or family. @@ -1345,11 +1313,11 @@ public List PolicyText [DataMember] public List Verification { - get { if(_Verification==null) _Verification = new List(); return _Verification; } + get => _Verification ?? new List(); set { _Verification = value; OnPropertyChanged("Verification"); } } - private List _Verification; + private List? _Verification; /// /// deny | permit. @@ -1358,13 +1326,13 @@ public List Verification [DeclaredType(Type = typeof(Code))] [Binding("ConsentProvisionType")] [DataMember] - public Code DecisionElement + public Code? DecisionElement { get { return _DecisionElement; } set { _DecisionElement = value; OnPropertyChanged("DecisionElement"); } } - private Code _DecisionElement; + private Code? _DecisionElement; /// /// deny | permit @@ -1373,13 +1341,10 @@ public Code DecisionElement [IgnoreDataMember] public Hl7.Fhir.Model.ConsentProvisionType? Decision { - get { return DecisionElement != null ? DecisionElement.Value : null; } + get => _DecisionElement?.Value; set { - if (value == null) - DecisionElement = null; - else - DecisionElement = new Code(value); + DecisionElement = value is null ? null : new Code(value); OnPropertyChanged("Decision"); } } @@ -1392,42 +1357,38 @@ public Hl7.Fhir.Model.ConsentProvisionType? Decision [DataMember] public List Provision { - get { if(_Provision==null) _Provision = new List(); return _Provision; } + get => _Provision ?? new List(); set { _Provision = value; OnPropertyChanged("Provision"); } } - private List _Provision; + private List? _Provision; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Consent; - - if (dest == null) - { + if(other is not Consent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Grantor.Any()) dest.Grantor = new List(Grantor.DeepCopyInternal()); - if(Grantee.Any()) dest.Grantee = new List(Grantee.DeepCopyInternal()); - if(Manager.Any()) dest.Manager = new List(Manager.DeepCopyInternal()); - if(Controller.Any()) dest.Controller = new List(Controller.DeepCopyInternal()); - if(SourceAttachment.Any()) dest.SourceAttachment = new List(SourceAttachment.DeepCopyInternal()); - if(SourceReference.Any()) dest.SourceReference = new List(SourceReference.DeepCopyInternal()); - if(RegulatoryBasis.Any()) dest.RegulatoryBasis = new List(RegulatoryBasis.DeepCopyInternal()); - if(PolicyBasis != null) dest.PolicyBasis = (Hl7.Fhir.Model.Consent.PolicyBasisComponent)PolicyBasis.DeepCopyInternal(); - if(PolicyText.Any()) dest.PolicyText = new List(PolicyText.DeepCopyInternal()); - if(Verification.Any()) dest.Verification = new List(Verification.DeepCopyInternal()); - if(DecisionElement != null) dest.DecisionElement = (Code)DecisionElement.DeepCopyInternal(); - if(Provision.Any()) dest.Provision = new List(Provision.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Grantor is not null) dest.Grantor = new List(_Grantor.DeepCopyInternal()); + if(_Grantee is not null) dest.Grantee = new List(_Grantee.DeepCopyInternal()); + if(_Manager is not null) dest.Manager = new List(_Manager.DeepCopyInternal()); + if(_Controller is not null) dest.Controller = new List(_Controller.DeepCopyInternal()); + if(_SourceAttachment is not null) dest.SourceAttachment = new List(_SourceAttachment.DeepCopyInternal()); + if(_SourceReference is not null) dest.SourceReference = new List(_SourceReference.DeepCopyInternal()); + if(_RegulatoryBasis is not null) dest.RegulatoryBasis = new List(_RegulatoryBasis.DeepCopyInternal()); + if(_PolicyBasis is not null) dest.PolicyBasis = (Hl7.Fhir.Model.Consent.PolicyBasisComponent)_PolicyBasis.DeepCopyInternal(); + if(_PolicyText is not null) dest.PolicyText = new List(_PolicyText.DeepCopyInternal()); + if(_Verification is not null) dest.Verification = new List(_Verification.DeepCopyInternal()); + if(_DecisionElement is not null) dest.DecisionElement = (Code)_DecisionElement.DeepCopyInternal(); + if(_Provision is not null) dest.Provision = new List(_Provision.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1439,153 +1400,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Consent; - if(otherT == null) return false; + if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Grantor, otherT.Grantor)) return false; - if(!comparer.ListEquals(Grantee, otherT.Grantee)) return false; - if(!comparer.ListEquals(Manager, otherT.Manager)) return false; - if(!comparer.ListEquals(Controller, otherT.Controller)) return false; - if(!comparer.ListEquals(SourceAttachment, otherT.SourceAttachment)) return false; - if(!comparer.ListEquals(SourceReference, otherT.SourceReference)) return false; - if(!comparer.ListEquals(RegulatoryBasis, otherT.RegulatoryBasis)) return false; - if(!comparer.Equals(PolicyBasis, otherT.PolicyBasis)) return false; - if(!comparer.ListEquals(PolicyText, otherT.PolicyText)) return false; - if(!comparer.ListEquals(Verification, otherT.Verification)) return false; - if(!comparer.Equals(DecisionElement, otherT.DecisionElement)) return false; - if(!comparer.ListEquals(Provision, otherT.Provision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Grantor, otherT._Grantor)) return false; + if(!comparer.ListEquals(_Grantee, otherT._Grantee)) return false; + if(!comparer.ListEquals(_Manager, otherT._Manager)) return false; + if(!comparer.ListEquals(_Controller, otherT._Controller)) return false; + if(!comparer.ListEquals(_SourceAttachment, otherT._SourceAttachment)) return false; + if(!comparer.ListEquals(_SourceReference, otherT._SourceReference)) return false; + if(!comparer.ListEquals(_RegulatoryBasis, otherT._RegulatoryBasis)) return false; + if(!comparer.Equals(_PolicyBasis, otherT._PolicyBasis)) return false; + if(!comparer.ListEquals(_PolicyText, otherT._PolicyText)) return false; + if(!comparer.ListEquals(_Verification, otherT._Verification)) return false; + if(!comparer.Equals(_DecisionElement, otherT._DecisionElement)) return false; + if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "grantor": - value = Grantor; - return Grantor?.Any() == true; + value = _Grantor; + return _Grantor?.Any() == true; case "grantee": - value = Grantee; - return Grantee?.Any() == true; + value = _Grantee; + return _Grantee?.Any() == true; case "manager": - value = Manager; - return Manager?.Any() == true; + value = _Manager; + return _Manager?.Any() == true; case "controller": - value = Controller; - return Controller?.Any() == true; + value = _Controller; + return _Controller?.Any() == true; case "sourceAttachment": - value = SourceAttachment; - return SourceAttachment?.Any() == true; + value = _SourceAttachment; + return _SourceAttachment?.Any() == true; case "sourceReference": - value = SourceReference; - return SourceReference?.Any() == true; + value = _SourceReference; + return _SourceReference?.Any() == true; case "regulatoryBasis": - value = RegulatoryBasis; - return RegulatoryBasis?.Any() == true; + value = _RegulatoryBasis; + return _RegulatoryBasis?.Any() == true; case "policyBasis": - value = PolicyBasis; - return PolicyBasis is not null; + value = _PolicyBasis; + return _PolicyBasis is not null; case "policyText": - value = PolicyText; - return PolicyText?.Any() == true; + value = _PolicyText; + return _PolicyText?.Any() == true; case "verification": - value = Verification; - return Verification?.Any() == true; + value = _Verification; + return _Verification?.Any() == true; case "decision": - value = DecisionElement; - return DecisionElement is not null; + value = _DecisionElement; + return _DecisionElement is not null; case "provision": - value = Provision; - return Provision?.Any() == true; + value = _Provision; + return _Provision?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "grantor": - Grantor = (List)value; + Grantor = (List?)value!; return this; case "grantee": - Grantee = (List)value; + Grantee = (List?)value!; return this; case "manager": - Manager = (List)value; + Manager = (List?)value!; return this; case "controller": - Controller = (List)value; + Controller = (List?)value!; return this; case "sourceAttachment": - SourceAttachment = (List)value; + SourceAttachment = (List?)value!; return this; case "sourceReference": - SourceReference = (List)value; + SourceReference = (List?)value!; return this; case "regulatoryBasis": - RegulatoryBasis = (List)value; + RegulatoryBasis = (List?)value!; return this; case "policyBasis": - PolicyBasis = (Hl7.Fhir.Model.Consent.PolicyBasisComponent)value; + PolicyBasis = (Hl7.Fhir.Model.Consent.PolicyBasisComponent?)value; return this; case "policyText": - PolicyText = (List)value; + PolicyText = (List?)value!; return this; case "verification": - Verification = (List)value; + Verification = (List?)value!; return this; case "decision": - DecisionElement = (Code)value; + DecisionElement = (Code?)value; return this; case "provision": - Provision = (List)value; + Provision = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1596,24 +1557,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Grantor?.Any() == true) yield return new KeyValuePair("grantor",Grantor); - if (Grantee?.Any() == true) yield return new KeyValuePair("grantee",Grantee); - if (Manager?.Any() == true) yield return new KeyValuePair("manager",Manager); - if (Controller?.Any() == true) yield return new KeyValuePair("controller",Controller); - if (SourceAttachment?.Any() == true) yield return new KeyValuePair("sourceAttachment",SourceAttachment); - if (SourceReference?.Any() == true) yield return new KeyValuePair("sourceReference",SourceReference); - if (RegulatoryBasis?.Any() == true) yield return new KeyValuePair("regulatoryBasis",RegulatoryBasis); - if (PolicyBasis is not null) yield return new KeyValuePair("policyBasis",PolicyBasis); - if (PolicyText?.Any() == true) yield return new KeyValuePair("policyText",PolicyText); - if (Verification?.Any() == true) yield return new KeyValuePair("verification",Verification); - if (DecisionElement is not null) yield return new KeyValuePair("decision",DecisionElement); - if (Provision?.Any() == true) yield return new KeyValuePair("provision",Provision); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Grantor?.Any() == true) yield return new KeyValuePair("grantor",_Grantor); + if (_Grantee?.Any() == true) yield return new KeyValuePair("grantee",_Grantee); + if (_Manager?.Any() == true) yield return new KeyValuePair("manager",_Manager); + if (_Controller?.Any() == true) yield return new KeyValuePair("controller",_Controller); + if (_SourceAttachment?.Any() == true) yield return new KeyValuePair("sourceAttachment",_SourceAttachment); + if (_SourceReference?.Any() == true) yield return new KeyValuePair("sourceReference",_SourceReference); + if (_RegulatoryBasis?.Any() == true) yield return new KeyValuePair("regulatoryBasis",_RegulatoryBasis); + if (_PolicyBasis is not null) yield return new KeyValuePair("policyBasis",_PolicyBasis); + if (_PolicyText?.Any() == true) yield return new KeyValuePair("policyText",_PolicyText); + if (_Verification?.Any() == true) yield return new KeyValuePair("verification",_Verification); + if (_DecisionElement is not null) yield return new KeyValuePair("decision",_DecisionElement); + if (_Provision?.Any() == true) yield return new KeyValuePair("provision",_Provision); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs index f393ad7e1..00471a1d8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -282,13 +285,13 @@ public partial class ContentDefinitionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ContractDefinitionType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Detailed Content Type Definition. @@ -296,13 +299,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=50)] [Binding("ContractDefinitionSubtype")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// Publisher Entity. @@ -311,41 +314,38 @@ public Hl7.Fhir.Model.CodeableConcept SubType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Publisher + public Hl7.Fhir.Model.ResourceReference? Publisher { get { return _Publisher; } set { _Publisher = value; OnPropertyChanged("Publisher"); } } - private Hl7.Fhir.Model.ResourceReference _Publisher; + private Hl7.Fhir.Model.ResourceReference? _Publisher; /// /// When published. /// [FhirElement("publicationDate", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PublicationDateElement + public Hl7.Fhir.Model.FhirDateTime? PublicationDateElement { get { return _PublicationDateElement; } set { _PublicationDateElement = value; OnPropertyChanged("PublicationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PublicationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PublicationDateElement; /// /// When published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PublicationDate + public string? PublicationDate { - get { return PublicationDateElement != null ? PublicationDateElement.Value : null; } + get => _PublicationDateElement?.Value; set { - if (value == null) - PublicationDateElement = null; - else - PublicationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PublicationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PublicationDate"); } } @@ -358,13 +358,13 @@ public string PublicationDate [Binding("ContractPublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PublicationStatusElement + public Code? PublicationStatusElement { get { return _PublicationStatusElement; } set { _PublicationStatusElement = value; OnPropertyChanged("PublicationStatusElement"); } } - private Code _PublicationStatusElement; + private Code? _PublicationStatusElement; /// /// amended | appended | cancelled | disputed | entered-in-error | executable + @@ -373,13 +373,10 @@ public Code Publ [IgnoreDataMember] public Hl7.Fhir.Model.Contract.ContractResourcePublicationStatusCodes? PublicationStatus { - get { return PublicationStatusElement != null ? PublicationStatusElement.Value : null; } + get => _PublicationStatusElement?.Value; set { - if (value == null) - PublicationStatusElement = null; - else - PublicationStatusElement = new Code(value); + PublicationStatusElement = value is null ? null : new Code(value); OnPropertyChanged("PublicationStatus"); } } @@ -389,48 +386,41 @@ public Hl7.Fhir.Model.Contract.ContractResourcePublicationStatusCodes? Publicati /// [FhirElement("copyright", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Publication Ownership /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContentDefinitionComponent; - - if (dest == null) - { + if(other is not ContentDefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(Publisher != null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)Publisher.DeepCopyInternal(); - if(PublicationDateElement != null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)PublicationDateElement.DeepCopyInternal(); - if(PublicationStatusElement != null) dest.PublicationStatusElement = (Code)PublicationStatusElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_Publisher is not null) dest.Publisher = (Hl7.Fhir.Model.ResourceReference)_Publisher.DeepCopyInternal(); + if(_PublicationDateElement is not null) dest.PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)_PublicationDateElement.DeepCopyInternal(); + if(_PublicationStatusElement is not null) dest.PublicationStatusElement = (Code)_PublicationStatusElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -442,69 +432,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentDefinitionComponent; - if(otherT == null) return false; + if(other is not ContentDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(Publisher, otherT.Publisher)) return false; - if(!comparer.Equals(PublicationDateElement, otherT.PublicationDateElement)) return false; - if(!comparer.Equals(PublicationStatusElement, otherT.PublicationStatusElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; + if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; + if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "publisher": - value = Publisher; - return Publisher is not null; + value = _Publisher; + return _Publisher is not null; case "publicationDate": - value = PublicationDateElement; - return PublicationDateElement is not null; + value = _PublicationDateElement; + return _PublicationDateElement is not null; case "publicationStatus": - value = PublicationStatusElement; - return PublicationStatusElement is not null; + value = _PublicationStatusElement; + return _PublicationStatusElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "publisher": - Publisher = (Hl7.Fhir.Model.ResourceReference)value; + Publisher = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "publicationDate": - PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PublicationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publicationStatus": - PublicationStatusElement = (Code)value; + PublicationStatusElement = (Code?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -515,12 +505,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (Publisher is not null) yield return new KeyValuePair("publisher",Publisher); - if (PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",PublicationDateElement); - if (PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",PublicationStatusElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_Publisher is not null) yield return new KeyValuePair("publisher",_Publisher); + if (_PublicationDateElement is not null) yield return new KeyValuePair("publicationDate",_PublicationDateElement); + if (_PublicationStatusElement is not null) yield return new KeyValuePair("publicationStatus",_PublicationStatusElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); } } @@ -546,41 +536,38 @@ public partial class TermComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Term Issue Date Time. /// [FhirElement("issued", InSummary=true, Order=50, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// Contract Term Issue Date Time /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -590,13 +577,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=60, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Term Concern. @@ -606,13 +593,13 @@ public Hl7.Fhir.Model.Period Applies [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Topic + public Hl7.Fhir.Model.DataType? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.DataType _Topic; + private Hl7.Fhir.Model.DataType? _Topic; /// /// Contract Term Type or Form. @@ -620,13 +607,13 @@ public Hl7.Fhir.Model.DataType Topic [FhirElement("type", Order=80, FiveWs="FiveWs.what[x]")] [Binding("ContractTermType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Contract Term Type specific classification. @@ -634,41 +621,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=90, FiveWs="FiveWs.what[x]")] [Binding("ContractTermSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// Term Statement. /// [FhirElement("text", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Term Statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -681,11 +665,11 @@ public string Text [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Context of the Contract term. @@ -693,13 +677,13 @@ public List SecurityLabel [FhirElement("offer", Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Contract.ContractOfferComponent Offer + public Hl7.Fhir.Model.Contract.ContractOfferComponent? Offer { get { return _Offer; } set { _Offer = value; OnPropertyChanged("Offer"); } } - private Hl7.Fhir.Model.Contract.ContractOfferComponent _Offer; + private Hl7.Fhir.Model.Contract.ContractOfferComponent? _Offer; /// /// Contract Term Asset List. @@ -709,11 +693,11 @@ public Hl7.Fhir.Model.Contract.ContractOfferComponent Offer [DataMember] public List Asset { - get { if(_Asset==null) _Asset = new List(); return _Asset; } + get => _Asset ?? new List(); set { _Asset = value; OnPropertyChanged("Asset"); } } - private List _Asset; + private List? _Asset; /// /// Entity being ascribed responsibility. @@ -723,11 +707,11 @@ public List Asset [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Nested Contract Term Group. @@ -737,34 +721,30 @@ public List Action [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; protected internal override void CopyToInternal(Base other) { - var dest = other as TermComponent; - - if (dest == null) - { + if(other is not TermComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.DataType)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Offer != null) dest.Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)Offer.DeepCopyInternal(); - if(Asset.Any()) dest.Asset = new List(Asset.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.DataType)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Offer is not null) dest.Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)_Offer.DeepCopyInternal(); + if(_Asset is not null) dest.Asset = new List(_Asset.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -776,111 +756,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TermComponent; - if(otherT == null) return false; + if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.Equals(Offer, otherT.Offer)) return false; - if(!comparer.ListEquals(Asset, otherT.Asset)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.Equals(_Offer, otherT._Offer)) return false; + if(!comparer.ListEquals(_Asset, otherT._Asset)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "offer": - value = Offer; - return Offer is not null; + value = _Offer; + return _Offer is not null; case "asset": - value = Asset; - return Asset?.Any() == true; + value = _Asset; + return _Asset?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.DataType)value; + Topic = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "offer": - Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent)value; + Offer = (Hl7.Fhir.Model.Contract.ContractOfferComponent?)value; return this; case "asset": - Asset = (List)value; + Asset = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -891,18 +871,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Offer is not null) yield return new KeyValuePair("offer",Offer); - if (Asset?.Any() == true) yield return new KeyValuePair("asset",Asset); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Offer is not null) yield return new KeyValuePair("offer",_Offer); + if (_Asset?.Any() == true) yield return new KeyValuePair("asset",_Asset); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } @@ -933,24 +913,24 @@ public partial class SecurityLabelComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List NumberElement { - get { if(_NumberElement==null) _NumberElement = new List(); return _NumberElement; } + get => _NumberElement ?? new List(); set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private List _NumberElement; + private List? _NumberElement; /// /// Link to Security Labels /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Number + public IEnumerable? Number { - get { return NumberElement != null ? NumberElement.Select(elem => elem.Value) : null; } + get => _NumberElement?.Select(elem => elem.Value); set { if (value == null) - NumberElement = null; + NumberElement = null!; else NumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("Number"); @@ -964,13 +944,13 @@ public IEnumerable Number [Binding("ContractSecurityClassification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Classification + public Hl7.Fhir.Model.Coding? Classification { get { return _Classification; } set { _Classification = value; OnPropertyChanged("Classification"); } } - private Hl7.Fhir.Model.Coding _Classification; + private Hl7.Fhir.Model.Coding? _Classification; /// /// Applicable Policy. @@ -981,11 +961,11 @@ public Hl7.Fhir.Model.Coding Classification [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Handling Instructions. @@ -996,26 +976,22 @@ public List Category [DataMember] public List Control { - get { if(_Control==null) _Control = new List(); return _Control; } + get => _Control ?? new List(); set { _Control = value; OnPropertyChanged("Control"); } } - private List _Control; + private List? _Control; protected internal override void CopyToInternal(Base other) { - var dest = other as SecurityLabelComponent; - - if (dest == null) - { + if(other is not SecurityLabelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement.Any()) dest.NumberElement = new List(NumberElement.DeepCopyInternal()); - if(Classification != null) dest.Classification = (Hl7.Fhir.Model.Coding)Classification.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Control.Any()) dest.Control = new List(Control.DeepCopyInternal()); + if(_NumberElement is not null) dest.NumberElement = new List(_NumberElement.DeepCopyInternal()); + if(_Classification is not null) dest.Classification = (Hl7.Fhir.Model.Coding)_Classification.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Control is not null) dest.Control = new List(_Control.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1027,55 +1003,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SecurityLabelComponent; - if(otherT == null) return false; + if(other is not SecurityLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Control, otherT.Control)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Control, otherT._Control)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement?.Any() == true; + value = _NumberElement; + return _NumberElement?.Any() == true; case "classification": - value = Classification; - return Classification is not null; + value = _Classification; + return _Classification is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "control": - value = Control; - return Control?.Any() == true; + value = _Control; + return _Control?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (List)value; + NumberElement = (List?)value!; return this; case "classification": - Classification = (Hl7.Fhir.Model.Coding)value; + Classification = (Hl7.Fhir.Model.Coding?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "control": - Control = (List)value; + Control = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1086,10 +1062,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement?.Any() == true) yield return new KeyValuePair("number",NumberElement); - if (Classification is not null) yield return new KeyValuePair("classification",Classification); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Control?.Any() == true) yield return new KeyValuePair("control",Control); + if (_NumberElement?.Any() == true) yield return new KeyValuePair("number",_NumberElement); + if (_Classification is not null) yield return new KeyValuePair("classification",_Classification); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Control?.Any() == true) yield return new KeyValuePair("control",_Control); } } @@ -1118,11 +1094,11 @@ public partial class ContractOfferComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Offer Recipient. @@ -1132,11 +1108,11 @@ public List Identifier [DataMember] public List Party { - get { if(_Party==null) _Party = new List(); return _Party; } + get => _Party ?? new List(); set { _Party = value; OnPropertyChanged("Party"); } } - private List _Party; + private List? _Party; /// /// Negotiable offer asset. @@ -1145,13 +1121,13 @@ public List Party [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Topic + public Hl7.Fhir.Model.ResourceReference? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.ResourceReference _Topic; + private Hl7.Fhir.Model.ResourceReference? _Topic; /// /// Contract Offer Type or Form. @@ -1159,13 +1135,13 @@ public Hl7.Fhir.Model.ResourceReference Topic [FhirElement("type", Order=70, FiveWs="FiveWs.what[x]")] [Binding("ContractTermType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Accepting party choice. @@ -1173,13 +1149,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("decision", Order=80, FiveWs="FiveWs.what[x]")] [Binding("ContractDecisionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Decision + public Hl7.Fhir.Model.CodeableConcept? Decision { get { return _Decision; } set { _Decision = value; OnPropertyChanged("Decision"); } } - private Hl7.Fhir.Model.CodeableConcept _Decision; + private Hl7.Fhir.Model.CodeableConcept? _Decision; /// /// How decision is conveyed. @@ -1190,11 +1166,11 @@ public Hl7.Fhir.Model.CodeableConcept Decision [DataMember] public List DecisionMode { - get { if(_DecisionMode==null) _DecisionMode = new List(); return _DecisionMode; } + get => _DecisionMode ?? new List(); set { _DecisionMode = value; OnPropertyChanged("DecisionMode"); } } - private List _DecisionMode; + private List? _DecisionMode; /// /// Response to offer text. @@ -1204,39 +1180,36 @@ public List DecisionMode [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Human readable offer text. /// [FhirElement("text", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Human readable offer text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -1249,24 +1222,24 @@ public string Text [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -1281,24 +1254,24 @@ public IEnumerable LinkId [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Offer restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -1307,24 +1280,20 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ContractOfferComponent; - - if (dest == null) - { + if(other is not ContractOfferComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Party.Any()) dest.Party = new List(Party.DeepCopyInternal()); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.ResourceReference)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Decision != null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)Decision.DeepCopyInternal(); - if(DecisionMode.Any()) dest.DecisionMode = new List(DecisionMode.DeepCopyInternal()); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Party is not null) dest.Party = new List(_Party.DeepCopyInternal()); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.ResourceReference)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Decision is not null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)_Decision.DeepCopyInternal(); + if(_DecisionMode is not null) dest.DecisionMode = new List(_DecisionMode.DeepCopyInternal()); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1336,97 +1305,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractOfferComponent; - if(otherT == null) return false; + if(other is not ContractOfferComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Party, otherT.Party)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Decision, otherT.Decision)) return false; - if(!comparer.ListEquals(DecisionMode, otherT.DecisionMode)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Decision, otherT._Decision)) return false; + if(!comparer.ListEquals(_DecisionMode, otherT._DecisionMode)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "party": - value = Party; - return Party?.Any() == true; + value = _Party; + return _Party?.Any() == true; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "decision": - value = Decision; - return Decision is not null; + value = _Decision; + return _Decision is not null; case "decisionMode": - value = DecisionMode; - return DecisionMode?.Any() == true; + value = _DecisionMode; + return _DecisionMode?.Any() == true; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "party": - Party = (List)value; + Party = (List?)value!; return this; case "topic": - Topic = (Hl7.Fhir.Model.ResourceReference)value; + Topic = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "decision": - Decision = (Hl7.Fhir.Model.CodeableConcept)value; + Decision = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "decisionMode": - DecisionMode = (List)value; + DecisionMode = (List?)value!; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1437,16 +1406,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Party?.Any() == true) yield return new KeyValuePair("party",Party); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Decision is not null) yield return new KeyValuePair("decision",Decision); - if (DecisionMode?.Any() == true) yield return new KeyValuePair("decisionMode",DecisionMode); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Party?.Any() == true) yield return new KeyValuePair("party",_Party); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Decision is not null) yield return new KeyValuePair("decision",_Decision); + if (_DecisionMode?.Any() == true) yield return new KeyValuePair("decisionMode",_DecisionMode); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -1474,11 +1443,11 @@ public partial class ContractPartyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; /// /// Participant engagement type. @@ -1487,26 +1456,22 @@ public List Reference [Binding("ContractPartyRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ContractPartyComponent; - - if (dest == null) - { + if(other is not ContractPartyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1518,41 +1483,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractPartyComponent; - if(otherT == null) return false; + if(other is not ContractPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1563,8 +1528,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -1591,25 +1556,21 @@ public partial class AnswerComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerComponent; - - if (dest == null) - { + if(other is not AnswerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1621,34 +1582,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerComponent; - if(otherT == null) return false; + if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1659,7 +1620,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1683,13 +1644,13 @@ public partial class ContractAssetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("scope", Order=40)] [Binding("ContractAssetScope")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Asset category. @@ -1700,11 +1661,11 @@ public Hl7.Fhir.Model.CodeableConcept Scope [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Associated entities. @@ -1716,11 +1677,11 @@ public List Type [DataMember] public List TypeReference { - get { if(_TypeReference==null) _TypeReference = new List(); return _TypeReference; } + get => _TypeReference ?? new List(); set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } - private List _TypeReference; + private List? _TypeReference; /// /// Asset sub-category. @@ -1731,11 +1692,11 @@ public List TypeReference [DataMember] public List Subtype { - get { if(_Subtype==null) _Subtype = new List(); return _Subtype; } + get => _Subtype ?? new List(); set { _Subtype = value; OnPropertyChanged("Subtype"); } } - private List _Subtype; + private List? _Subtype; /// /// Kinship of the asset. @@ -1743,13 +1704,13 @@ public List Subtype [FhirElement("relationship", Order=80)] [Binding("ConsentContentClass")] [DataMember] - public Hl7.Fhir.Model.Coding Relationship + public Hl7.Fhir.Model.Coding? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.Coding _Relationship; + private Hl7.Fhir.Model.Coding? _Relationship; /// /// Circumstance of the asset. @@ -1759,39 +1720,36 @@ public Hl7.Fhir.Model.Coding Relationship [DataMember] public List Context { - get { if(_Context==null) _Context = new List(); return _Context; } + get => _Context ?? new List(); set { _Context = value; OnPropertyChanged("Context"); } } - private List _Context; + private List? _Context; /// /// Quality desctiption of asset. /// [FhirElement("condition", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// Quality desctiption of asset /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -1805,11 +1763,11 @@ public string Condition [DataMember] public List PeriodType { - get { if(_PeriodType==null) _PeriodType = new List(); return _PeriodType; } + get => _PeriodType ?? new List(); set { _PeriodType = value; OnPropertyChanged("PeriodType"); } } - private List _PeriodType; + private List? _PeriodType; /// /// Time period of the asset. @@ -1819,11 +1777,11 @@ public List PeriodType [DataMember] public List Period { - get { if(_Period==null) _Period = new List(); return _Period; } + get => _Period ?? new List(); set { _Period = value; OnPropertyChanged("Period"); } } - private List _Period; + private List? _Period; /// /// Time period. @@ -1833,39 +1791,36 @@ public List Period [DataMember] public List UsePeriod { - get { if(_UsePeriod==null) _UsePeriod = new List(); return _UsePeriod; } + get => _UsePeriod ?? new List(); set { _UsePeriod = value; OnPropertyChanged("UsePeriod"); } } - private List _UsePeriod; + private List? _UsePeriod; /// /// Asset clause or question text. /// [FhirElement("text", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Asset clause or question text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -1878,24 +1833,24 @@ public string Text [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to asset text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -1910,11 +1865,11 @@ public IEnumerable LinkId [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Asset restriction numbers. @@ -1924,24 +1879,24 @@ public List Answer [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Asset restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -1956,37 +1911,33 @@ public IEnumerable SecurityLabelNumber [DataMember] public List ValuedItem { - get { if(_ValuedItem==null) _ValuedItem = new List(); return _ValuedItem; } + get => _ValuedItem ?? new List(); set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } - private List _ValuedItem; + private List? _ValuedItem; protected internal override void CopyToInternal(Base other) { - var dest = other as ContractAssetComponent; - - if (dest == null) - { + if(other is not ContractAssetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(TypeReference.Any()) dest.TypeReference = new List(TypeReference.DeepCopyInternal()); - if(Subtype.Any()) dest.Subtype = new List(Subtype.DeepCopyInternal()); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.Coding)Relationship.DeepCopyInternal(); - if(Context.Any()) dest.Context = new List(Context.DeepCopyInternal()); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(PeriodType.Any()) dest.PeriodType = new List(PeriodType.DeepCopyInternal()); - if(Period.Any()) dest.Period = new List(Period.DeepCopyInternal()); - if(UsePeriod.Any()) dest.UsePeriod = new List(UsePeriod.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); - if(ValuedItem.Any()) dest.ValuedItem = new List(ValuedItem.DeepCopyInternal()); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_TypeReference is not null) dest.TypeReference = new List(_TypeReference.DeepCopyInternal()); + if(_Subtype is not null) dest.Subtype = new List(_Subtype.DeepCopyInternal()); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.Coding)_Relationship.DeepCopyInternal(); + if(_Context is not null) dest.Context = new List(_Context.DeepCopyInternal()); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_PeriodType is not null) dest.PeriodType = new List(_PeriodType.DeepCopyInternal()); + if(_Period is not null) dest.Period = new List(_Period.DeepCopyInternal()); + if(_UsePeriod is not null) dest.UsePeriod = new List(_UsePeriod.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); + if(_ValuedItem is not null) dest.ValuedItem = new List(_ValuedItem.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1998,132 +1949,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContractAssetComponent; - if(otherT == null) return false; + if(other is not ContractAssetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(TypeReference, otherT.TypeReference)) return false; - if(!comparer.ListEquals(Subtype, otherT.Subtype)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.ListEquals(Context, otherT.Context)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.ListEquals(PeriodType, otherT.PeriodType)) return false; - if(!comparer.ListEquals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(UsePeriod, otherT.UsePeriod)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; - if(!comparer.ListEquals(ValuedItem, otherT.ValuedItem)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_TypeReference, otherT._TypeReference)) return false; + if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.ListEquals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.ListEquals(_PeriodType, otherT._PeriodType)) return false; + if(!comparer.ListEquals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_UsePeriod, otherT._UsePeriod)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; + if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "typeReference": - value = TypeReference; - return TypeReference?.Any() == true; + value = _TypeReference; + return _TypeReference?.Any() == true; case "subtype": - value = Subtype; - return Subtype?.Any() == true; + value = _Subtype; + return _Subtype?.Any() == true; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "context": - value = Context; - return Context?.Any() == true; + value = _Context; + return _Context?.Any() == true; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "periodType": - value = PeriodType; - return PeriodType?.Any() == true; + value = _PeriodType; + return _PeriodType?.Any() == true; case "period": - value = Period; - return Period?.Any() == true; + value = _Period; + return _Period?.Any() == true; case "usePeriod": - value = UsePeriod; - return UsePeriod?.Any() == true; + value = _UsePeriod; + return _UsePeriod?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; case "valuedItem": - value = ValuedItem; - return ValuedItem?.Any() == true; + value = _ValuedItem; + return _ValuedItem?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "typeReference": - TypeReference = (List)value; + TypeReference = (List?)value!; return this; case "subtype": - Subtype = (List)value; + Subtype = (List?)value!; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.Coding)value; + Relationship = (Hl7.Fhir.Model.Coding?)value; return this; case "context": - Context = (List)value; + Context = (List?)value!; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "periodType": - PeriodType = (List)value; + PeriodType = (List?)value!; return this; case "period": - Period = (List)value; + Period = (List?)value!; return this; case "usePeriod": - UsePeriod = (List)value; + UsePeriod = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; case "valuedItem": - ValuedItem = (List)value; + ValuedItem = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2134,21 +2085,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (TypeReference?.Any() == true) yield return new KeyValuePair("typeReference",TypeReference); - if (Subtype?.Any() == true) yield return new KeyValuePair("subtype",Subtype); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Context?.Any() == true) yield return new KeyValuePair("context",Context); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (PeriodType?.Any() == true) yield return new KeyValuePair("periodType",PeriodType); - if (Period?.Any() == true) yield return new KeyValuePair("period",Period); - if (UsePeriod?.Any() == true) yield return new KeyValuePair("usePeriod",UsePeriod); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); - if (ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",ValuedItem); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_TypeReference?.Any() == true) yield return new KeyValuePair("typeReference",_TypeReference); + if (_Subtype?.Any() == true) yield return new KeyValuePair("subtype",_Subtype); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Context?.Any() == true) yield return new KeyValuePair("context",_Context); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_PeriodType?.Any() == true) yield return new KeyValuePair("periodType",_PeriodType); + if (_Period?.Any() == true) yield return new KeyValuePair("period",_Period); + if (_UsePeriod?.Any() == true) yield return new KeyValuePair("usePeriod",_UsePeriod); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); + if (_ValuedItem?.Any() == true) yield return new KeyValuePair("valuedItem",_ValuedItem); } } @@ -2173,13 +2124,13 @@ public partial class AssetContextComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Codeable asset context. @@ -2190,56 +2141,49 @@ public Hl7.Fhir.Model.ResourceReference Reference [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Context description. /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Context description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AssetContextComponent; - - if (dest == null) - { + if(other is not AssetContextComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2251,48 +2195,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssetContextComponent; - if(otherT == null) return false; + if(other is not AssetContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2303,9 +2247,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -2331,54 +2275,51 @@ public partial class ValuedItemComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Entity + public Hl7.Fhir.Model.DataType? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.DataType _Entity; + private Hl7.Fhir.Model.DataType? _Entity; /// /// Contract Valued Item Number. /// [FhirElement("identifier", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Contract Valued Item Effective Tiem. /// [FhirElement("effectiveTime", Order=60, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EffectiveTimeElement + public Hl7.Fhir.Model.FhirDateTime? EffectiveTimeElement { get { return _EffectiveTimeElement; } set { _EffectiveTimeElement = value; OnPropertyChanged("EffectiveTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EffectiveTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _EffectiveTimeElement; /// /// Contract Valued Item Effective Tiem /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EffectiveTime + public string? EffectiveTime { - get { return EffectiveTimeElement != null ? EffectiveTimeElement.Value : null; } + get => _EffectiveTimeElement?.Value; set { - if (value == null) - EffectiveTimeElement = null; - else - EffectiveTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + EffectiveTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EffectiveTime"); } } @@ -2388,39 +2329,39 @@ public string EffectiveTime /// [FhirElement("quantity", Order=70, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Contract Valued Item fee, charge, or cost. /// [FhirElement("unitPrice", Order=80, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Contract Valued Item Price Scaling Factor. /// [FhirElement("factor", Order=90, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Contract Valued Item Price Scaling Factor @@ -2429,13 +2370,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2445,13 +2383,13 @@ public decimal? Factor /// [FhirElement("points", Order=100, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PointsElement + public Hl7.Fhir.Model.FhirDecimal? PointsElement { get { return _PointsElement; } set { _PointsElement = value; OnPropertyChanged("PointsElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PointsElement; + private Hl7.Fhir.Model.FhirDecimal? _PointsElement; /// /// Contract Valued Item Difficulty Scaling Factor @@ -2460,13 +2398,10 @@ public Hl7.Fhir.Model.FhirDecimal PointsElement [IgnoreDataMember] public decimal? Points { - get { return PointsElement != null ? PointsElement.Value : null; } + get => _PointsElement?.Value; set { - if (value == null) - PointsElement = null; - else - PointsElement = new Hl7.Fhir.Model.FhirDecimal(value); + PointsElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Points"); } } @@ -2476,41 +2411,38 @@ public decimal? Points /// [FhirElement("net", Order=110, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Terms of valuation. /// [FhirElement("payment", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString PaymentElement + public Hl7.Fhir.Model.FhirString? PaymentElement { get { return _PaymentElement; } set { _PaymentElement = value; OnPropertyChanged("PaymentElement"); } } - private Hl7.Fhir.Model.FhirString _PaymentElement; + private Hl7.Fhir.Model.FhirString? _PaymentElement; /// /// Terms of valuation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Payment + public string? Payment { - get { return PaymentElement != null ? PaymentElement.Value : null; } + get => _PaymentElement?.Value; set { - if (value == null) - PaymentElement = null; - else - PaymentElement = new Hl7.Fhir.Model.FhirString(value); + PaymentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Payment"); } } @@ -2520,28 +2452,25 @@ public string Payment /// [FhirElement("paymentDate", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PaymentDateElement + public Hl7.Fhir.Model.FhirDateTime? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PaymentDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PaymentDateElement; /// /// When payment is due /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PaymentDate"); } } @@ -2553,13 +2482,13 @@ public string PaymentDate [CLSCompliant(false)] [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Who will receive payment. @@ -2568,13 +2497,13 @@ public Hl7.Fhir.Model.ResourceReference Responsible [CLSCompliant(false)] [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Pointer to specific item. @@ -2584,24 +2513,24 @@ public Hl7.Fhir.Model.ResourceReference Recipient [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -2616,24 +2545,24 @@ public IEnumerable LinkId [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Security Labels that define affected terms /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -2642,28 +2571,24 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ValuedItemComponent; - - if (dest == null) - { + if(other is not ValuedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.DataType)Entity.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(EffectiveTimeElement != null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)EffectiveTimeElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(PointsElement != null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)PointsElement.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(PaymentElement != null) dest.PaymentElement = (Hl7.Fhir.Model.FhirString)PaymentElement.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)PaymentDateElement.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.DataType)_Entity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_EffectiveTimeElement is not null) dest.EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)_EffectiveTimeElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_PointsElement is not null) dest.PointsElement = (Hl7.Fhir.Model.FhirDecimal)_PointsElement.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_PaymentElement is not null) dest.PaymentElement = (Hl7.Fhir.Model.FhirString)_PaymentElement.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)_PaymentDateElement.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2675,125 +2600,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValuedItemComponent; - if(otherT == null) return false; + if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(EffectiveTimeElement, otherT.EffectiveTimeElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(PointsElement, otherT.PointsElement)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.Equals(PaymentElement, otherT.PaymentElement)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_PointsElement, otherT._PointsElement)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.Equals(_PaymentElement, otherT._PaymentElement)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "effectiveTime": - value = EffectiveTimeElement; - return EffectiveTimeElement is not null; + value = _EffectiveTimeElement; + return _EffectiveTimeElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "points": - value = PointsElement; - return PointsElement is not null; + value = _PointsElement; + return _PointsElement is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "payment": - value = PaymentElement; - return PaymentElement is not null; + value = _PaymentElement; + return _PaymentElement is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.DataType)value; + Entity = (Hl7.Fhir.Model.DataType?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "effectiveTime": - EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + EffectiveTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "points": - PointsElement = (Hl7.Fhir.Model.FhirDecimal)value; + PointsElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "payment": - PaymentElement = (Hl7.Fhir.Model.FhirString)value; + PaymentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PaymentDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2804,20 +2729,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",EffectiveTimeElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (PointsElement is not null) yield return new KeyValuePair("points",PointsElement); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (PaymentElement is not null) yield return new KeyValuePair("payment",PaymentElement); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_EffectiveTimeElement is not null) yield return new KeyValuePair("effectiveTime",_EffectiveTimeElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_PointsElement is not null) yield return new KeyValuePair("points",_PointsElement); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_PaymentElement is not null) yield return new KeyValuePair("payment",_PaymentElement); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -2845,13 +2770,13 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("doNotPerform", IsModifier=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if the term prohibits the action @@ -2860,13 +2785,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -2878,13 +2800,13 @@ public bool? DoNotPerform [Binding("ContractAction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Entity of the action. @@ -2894,11 +2816,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Purpose for the Contract Term Action. @@ -2907,13 +2829,13 @@ public List Subject [Binding("ContractActionReason")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Intent + public Hl7.Fhir.Model.CodeableConcept? Intent { get { return _Intent; } set { _Intent = value; OnPropertyChanged("Intent"); } } - private Hl7.Fhir.Model.CodeableConcept _Intent; + private Hl7.Fhir.Model.CodeableConcept? _Intent; /// /// Pointer to specific item. @@ -2923,24 +2845,24 @@ public Hl7.Fhir.Model.CodeableConcept Intent [DataMember] public List LinkIdElement { - get { if(_LinkIdElement==null) _LinkIdElement = new List(); return _LinkIdElement; } + get => _LinkIdElement ?? new List(); set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private List _LinkIdElement; + private List? _LinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable LinkId + public IEnumerable? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Select(elem => elem.Value) : null; } + get => _LinkIdElement?.Select(elem => elem.Value); set { if (value == null) - LinkIdElement = null; + LinkIdElement = null!; else LinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("LinkId"); @@ -2954,13 +2876,13 @@ public IEnumerable LinkId [Binding("ContractActionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Episode associated with action. @@ -2969,13 +2891,13 @@ public Hl7.Fhir.Model.CodeableConcept Status [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// Pointer to specific item. @@ -2985,24 +2907,24 @@ public Hl7.Fhir.Model.ResourceReference Context [DataMember] public List ContextLinkIdElement { - get { if(_ContextLinkIdElement==null) _ContextLinkIdElement = new List(); return _ContextLinkIdElement; } + get => _ContextLinkIdElement ?? new List(); set { _ContextLinkIdElement = value; OnPropertyChanged("ContextLinkIdElement"); } } - private List _ContextLinkIdElement; + private List? _ContextLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ContextLinkId + public IEnumerable? ContextLinkId { - get { return ContextLinkIdElement != null ? ContextLinkIdElement.Select(elem => elem.Value) : null; } + get => _ContextLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ContextLinkIdElement = null; + ContextLinkIdElement = null!; else ContextLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ContextLinkId"); @@ -3016,13 +2938,13 @@ public IEnumerable ContextLinkId [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Who asked for action. @@ -3034,11 +2956,11 @@ public Hl7.Fhir.Model.DataType Occurrence [DataMember] public List Requester { - get { if(_Requester==null) _Requester = new List(); return _Requester; } + get => _Requester ?? new List(); set { _Requester = value; OnPropertyChanged("Requester"); } } - private List _Requester; + private List? _Requester; /// /// Pointer to specific item. @@ -3048,24 +2970,24 @@ public List Requester [DataMember] public List RequesterLinkIdElement { - get { if(_RequesterLinkIdElement==null) _RequesterLinkIdElement = new List(); return _RequesterLinkIdElement; } + get => _RequesterLinkIdElement ?? new List(); set { _RequesterLinkIdElement = value; OnPropertyChanged("RequesterLinkIdElement"); } } - private List _RequesterLinkIdElement; + private List? _RequesterLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable RequesterLinkId + public IEnumerable? RequesterLinkId { - get { return RequesterLinkIdElement != null ? RequesterLinkIdElement.Select(elem => elem.Value) : null; } + get => _RequesterLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - RequesterLinkIdElement = null; + RequesterLinkIdElement = null!; else RequesterLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("RequesterLinkId"); @@ -3081,11 +3003,11 @@ public IEnumerable RequesterLinkId [DataMember] public List PerformerType { - get { if(_PerformerType==null) _PerformerType = new List(); return _PerformerType; } + get => _PerformerType ?? new List(); set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private List _PerformerType; + private List? _PerformerType; /// /// Competency of the performer. @@ -3093,13 +3015,13 @@ public List PerformerType [FhirElement("performerRole", Order=160)] [Binding("ContractActionPerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerRole + public Hl7.Fhir.Model.CodeableConcept? PerformerRole { get { return _PerformerRole; } set { _PerformerRole = value; OnPropertyChanged("PerformerRole"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerRole; + private Hl7.Fhir.Model.CodeableConcept? _PerformerRole; /// /// Actor that wil execute (or not) the action. @@ -3108,13 +3030,13 @@ public Hl7.Fhir.Model.CodeableConcept PerformerRole [CLSCompliant(false)] [References("RelatedPerson","Patient","Practitioner","PractitionerRole","CareTeam","Device","Substance","Organization","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Pointer to specific item. @@ -3124,24 +3046,24 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List PerformerLinkIdElement { - get { if(_PerformerLinkIdElement==null) _PerformerLinkIdElement = new List(); return _PerformerLinkIdElement; } + get => _PerformerLinkIdElement ?? new List(); set { _PerformerLinkIdElement = value; OnPropertyChanged("PerformerLinkIdElement"); } } - private List _PerformerLinkIdElement; + private List? _PerformerLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PerformerLinkId + public IEnumerable? PerformerLinkId { - get { return PerformerLinkIdElement != null ? PerformerLinkIdElement.Select(elem => elem.Value) : null; } + get => _PerformerLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - PerformerLinkIdElement = null; + PerformerLinkIdElement = null!; else PerformerLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PerformerLinkId"); @@ -3157,11 +3079,11 @@ public IEnumerable PerformerLinkId [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Pointer to specific item. @@ -3171,24 +3093,24 @@ public List Reason [DataMember] public List ReasonLinkIdElement { - get { if(_ReasonLinkIdElement==null) _ReasonLinkIdElement = new List(); return _ReasonLinkIdElement; } + get => _ReasonLinkIdElement ?? new List(); set { _ReasonLinkIdElement = value; OnPropertyChanged("ReasonLinkIdElement"); } } - private List _ReasonLinkIdElement; + private List? _ReasonLinkIdElement; /// /// Pointer to specific item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ReasonLinkId + public IEnumerable? ReasonLinkId { - get { return ReasonLinkIdElement != null ? ReasonLinkIdElement.Select(elem => elem.Value) : null; } + get => _ReasonLinkIdElement?.Select(elem => elem.Value); set { if (value == null) - ReasonLinkIdElement = null; + ReasonLinkIdElement = null!; else ReasonLinkIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ReasonLinkId"); @@ -3203,11 +3125,11 @@ public IEnumerable ReasonLinkId [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Action restriction numbers. @@ -3217,24 +3139,24 @@ public List Note [DataMember] public List SecurityLabelNumberElement { - get { if(_SecurityLabelNumberElement==null) _SecurityLabelNumberElement = new List(); return _SecurityLabelNumberElement; } + get => _SecurityLabelNumberElement ?? new List(); set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } - private List _SecurityLabelNumberElement; + private List? _SecurityLabelNumberElement; /// /// Action restriction numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SecurityLabelNumber + public IEnumerable? SecurityLabelNumber { - get { return SecurityLabelNumberElement != null ? SecurityLabelNumberElement.Select(elem => elem.Value) : null; } + get => _SecurityLabelNumberElement?.Select(elem => elem.Value); set { if (value == null) - SecurityLabelNumberElement = null; + SecurityLabelNumberElement = null!; else SecurityLabelNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.UnsignedInt(elem))); OnPropertyChanged("SecurityLabelNumber"); @@ -3243,33 +3165,29 @@ public IEnumerable SecurityLabelNumber protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Intent != null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)Intent.DeepCopyInternal(); - if(LinkIdElement.Any()) dest.LinkIdElement = new List(LinkIdElement.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(ContextLinkIdElement.Any()) dest.ContextLinkIdElement = new List(ContextLinkIdElement.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Requester.Any()) dest.Requester = new List(Requester.DeepCopyInternal()); - if(RequesterLinkIdElement.Any()) dest.RequesterLinkIdElement = new List(RequesterLinkIdElement.DeepCopyInternal()); - if(PerformerType.Any()) dest.PerformerType = new List(PerformerType.DeepCopyInternal()); - if(PerformerRole != null) dest.PerformerRole = (Hl7.Fhir.Model.CodeableConcept)PerformerRole.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(PerformerLinkIdElement.Any()) dest.PerformerLinkIdElement = new List(PerformerLinkIdElement.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(ReasonLinkIdElement.Any()) dest.ReasonLinkIdElement = new List(ReasonLinkIdElement.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(SecurityLabelNumberElement.Any()) dest.SecurityLabelNumberElement = new List(SecurityLabelNumberElement.DeepCopyInternal()); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Intent is not null) dest.Intent = (Hl7.Fhir.Model.CodeableConcept)_Intent.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = new List(_LinkIdElement.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_ContextLinkIdElement is not null) dest.ContextLinkIdElement = new List(_ContextLinkIdElement.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = new List(_Requester.DeepCopyInternal()); + if(_RequesterLinkIdElement is not null) dest.RequesterLinkIdElement = new List(_RequesterLinkIdElement.DeepCopyInternal()); + if(_PerformerType is not null) dest.PerformerType = new List(_PerformerType.DeepCopyInternal()); + if(_PerformerRole is not null) dest.PerformerRole = (Hl7.Fhir.Model.CodeableConcept)_PerformerRole.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_PerformerLinkIdElement is not null) dest.PerformerLinkIdElement = new List(_PerformerLinkIdElement.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_ReasonLinkIdElement is not null) dest.ReasonLinkIdElement = new List(_ReasonLinkIdElement.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_SecurityLabelNumberElement is not null) dest.SecurityLabelNumberElement = new List(_SecurityLabelNumberElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3281,160 +3199,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Intent, otherT.Intent)) return false; - if(!comparer.ListEquals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(ContextLinkIdElement, otherT.ContextLinkIdElement)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.ListEquals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(RequesterLinkIdElement, otherT.RequesterLinkIdElement)) return false; - if(!comparer.ListEquals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(PerformerRole, otherT.PerformerRole)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(PerformerLinkIdElement, otherT.PerformerLinkIdElement)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(ReasonLinkIdElement, otherT.ReasonLinkIdElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(SecurityLabelNumberElement, otherT.SecurityLabelNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Intent, otherT._Intent)) return false; + if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_ContextLinkIdElement, otherT._ContextLinkIdElement)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.ListEquals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_RequesterLinkIdElement, otherT._RequesterLinkIdElement)) return false; + if(!comparer.ListEquals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_PerformerRole, otherT._PerformerRole)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_PerformerLinkIdElement, otherT._PerformerLinkIdElement)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_ReasonLinkIdElement, otherT._ReasonLinkIdElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "intent": - value = Intent; - return Intent is not null; + value = _Intent; + return _Intent is not null; case "linkId": - value = LinkIdElement; - return LinkIdElement?.Any() == true; + value = _LinkIdElement; + return _LinkIdElement?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "contextLinkId": - value = ContextLinkIdElement; - return ContextLinkIdElement?.Any() == true; + value = _ContextLinkIdElement; + return _ContextLinkIdElement?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "requester": - value = Requester; - return Requester?.Any() == true; + value = _Requester; + return _Requester?.Any() == true; case "requesterLinkId": - value = RequesterLinkIdElement; - return RequesterLinkIdElement?.Any() == true; + value = _RequesterLinkIdElement; + return _RequesterLinkIdElement?.Any() == true; case "performerType": - value = PerformerType; - return PerformerType?.Any() == true; + value = _PerformerType; + return _PerformerType?.Any() == true; case "performerRole": - value = PerformerRole; - return PerformerRole is not null; + value = _PerformerRole; + return _PerformerRole is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "performerLinkId": - value = PerformerLinkIdElement; - return PerformerLinkIdElement?.Any() == true; + value = _PerformerLinkIdElement; + return _PerformerLinkIdElement?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "reasonLinkId": - value = ReasonLinkIdElement; - return ReasonLinkIdElement?.Any() == true; + value = _ReasonLinkIdElement; + return _ReasonLinkIdElement?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "securityLabelNumber": - value = SecurityLabelNumberElement; - return SecurityLabelNumberElement?.Any() == true; + value = _SecurityLabelNumberElement; + return _SecurityLabelNumberElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "intent": - Intent = (Hl7.Fhir.Model.CodeableConcept)value; + Intent = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "linkId": - LinkIdElement = (List)value; + LinkIdElement = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contextLinkId": - ContextLinkIdElement = (List)value; + ContextLinkIdElement = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "requester": - Requester = (List)value; + Requester = (List?)value!; return this; case "requesterLinkId": - RequesterLinkIdElement = (List)value; + RequesterLinkIdElement = (List?)value!; return this; case "performerType": - PerformerType = (List)value; + PerformerType = (List?)value!; return this; case "performerRole": - PerformerRole = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerRole = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerLinkId": - PerformerLinkIdElement = (List)value; + PerformerLinkIdElement = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "reasonLinkId": - ReasonLinkIdElement = (List)value; + ReasonLinkIdElement = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "securityLabelNumber": - SecurityLabelNumberElement = (List)value; + SecurityLabelNumberElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3445,25 +3363,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Intent is not null) yield return new KeyValuePair("intent",Intent); - if (LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",LinkIdElement); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (ContextLinkIdElement?.Any() == true) yield return new KeyValuePair("contextLinkId",ContextLinkIdElement); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Requester?.Any() == true) yield return new KeyValuePair("requester",Requester); - if (RequesterLinkIdElement?.Any() == true) yield return new KeyValuePair("requesterLinkId",RequesterLinkIdElement); - if (PerformerType?.Any() == true) yield return new KeyValuePair("performerType",PerformerType); - if (PerformerRole is not null) yield return new KeyValuePair("performerRole",PerformerRole); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (PerformerLinkIdElement?.Any() == true) yield return new KeyValuePair("performerLinkId",PerformerLinkIdElement); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (ReasonLinkIdElement?.Any() == true) yield return new KeyValuePair("reasonLinkId",ReasonLinkIdElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",SecurityLabelNumberElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Intent is not null) yield return new KeyValuePair("intent",_Intent); + if (_LinkIdElement?.Any() == true) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_ContextLinkIdElement?.Any() == true) yield return new KeyValuePair("contextLinkId",_ContextLinkIdElement); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Requester?.Any() == true) yield return new KeyValuePair("requester",_Requester); + if (_RequesterLinkIdElement?.Any() == true) yield return new KeyValuePair("requesterLinkId",_RequesterLinkIdElement); + if (_PerformerType?.Any() == true) yield return new KeyValuePair("performerType",_PerformerType); + if (_PerformerRole is not null) yield return new KeyValuePair("performerRole",_PerformerRole); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_PerformerLinkIdElement?.Any() == true) yield return new KeyValuePair("performerLinkId",_PerformerLinkIdElement); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_ReasonLinkIdElement?.Any() == true) yield return new KeyValuePair("reasonLinkId",_ReasonLinkIdElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_SecurityLabelNumberElement?.Any() == true) yield return new KeyValuePair("securityLabelNumber",_SecurityLabelNumberElement); } } @@ -3491,11 +3409,11 @@ public partial class ActionSubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; /// /// Role type of the agent. @@ -3503,26 +3421,22 @@ public List Reference [FhirElement("role", Order=50)] [Binding("ContractActorRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionSubjectComponent; - - if (dest == null) - { + if(other is not ActionSubjectComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3534,41 +3448,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionSubjectComponent; - if(otherT == null) return false; + if(other is not ActionSubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -3579,8 +3493,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -3610,13 +3524,13 @@ public partial class SignatoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("ContractSignerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Contract Signatory Party. @@ -3626,13 +3540,13 @@ public Hl7.Fhir.Model.Coding Type [References("Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Contract Documentation Signature. @@ -3642,25 +3556,21 @@ public Hl7.Fhir.Model.ResourceReference Party [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as SignatoryComponent; - - if (dest == null) - { + if(other is not SignatoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3672,48 +3582,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SignatoryComponent; - if(otherT == null) return false; + if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3724,9 +3634,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } @@ -3756,25 +3666,21 @@ public partial class FriendlyLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as FriendlyLanguageComponent; - - if (dest == null) - { + if(other is not FriendlyLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3786,34 +3692,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FriendlyLanguageComponent; - if(otherT == null) return false; + if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -3824,7 +3730,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -3854,25 +3760,21 @@ public partial class LegalLanguageComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as LegalLanguageComponent; - - if (dest == null) - { + if(other is not LegalLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3884,34 +3786,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LegalLanguageComponent; - if(otherT == null) return false; + if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -3922,7 +3824,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -3952,25 +3854,21 @@ public partial class ComputableLanguageComponent : Hl7.Fhir.Model.BackboneElemen [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Content + public Hl7.Fhir.Model.DataType? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.DataType _Content; + private Hl7.Fhir.Model.DataType? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as ComputableLanguageComponent; - - if (dest == null) - { + if(other is not ComputableLanguageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Content != null) dest.Content = (Hl7.Fhir.Model.DataType)Content.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.DataType)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3982,34 +3880,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComputableLanguageComponent; - if(otherT == null) return false; + if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "content": - Content = (Hl7.Fhir.Model.DataType)value; + Content = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -4020,7 +3918,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -4033,39 +3931,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Basal definition. /// [FhirElement("url", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Basal definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4075,28 +3970,25 @@ public string Url /// [FhirElement("version", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business edition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4108,13 +4000,13 @@ public string Version [DeclaredType(Type = typeof(Code))] [Binding("ContractStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// amended | appended | cancelled | disputed | entered-in-error | executable + @@ -4123,13 +4015,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4140,13 +4029,13 @@ public Hl7.Fhir.Model.Contract.ContractResourceStatusCodes? Status [FhirElement("legalState", Order=130)] [Binding("ContractLegalState")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalState + public Hl7.Fhir.Model.CodeableConcept? LegalState { get { return _LegalState; } set { _LegalState = value; OnPropertyChanged("LegalState"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalState; + private Hl7.Fhir.Model.CodeableConcept? _LegalState; /// /// Source Contract Definition. @@ -4155,41 +4044,38 @@ public Hl7.Fhir.Model.CodeableConcept LegalState [CLSCompliant(false)] [References("Contract")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InstantiatesCanonical + public Hl7.Fhir.Model.ResourceReference? InstantiatesCanonical { get { return _InstantiatesCanonical; } set { _InstantiatesCanonical = value; OnPropertyChanged("InstantiatesCanonical"); } } - private Hl7.Fhir.Model.ResourceReference _InstantiatesCanonical; + private Hl7.Fhir.Model.ResourceReference? _InstantiatesCanonical; /// /// External Contract Definition. /// [FhirElement("instantiatesUri", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// External Contract Definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -4200,41 +4086,38 @@ public string InstantiatesUri [FhirElement("contentDerivative", Order=160, FiveWs="FiveWs.what[x]")] [Binding("ContractContentDerivative")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ContentDerivative + public Hl7.Fhir.Model.CodeableConcept? ContentDerivative { get { return _ContentDerivative; } set { _ContentDerivative = value; OnPropertyChanged("ContentDerivative"); } } - private Hl7.Fhir.Model.CodeableConcept _ContentDerivative; + private Hl7.Fhir.Model.CodeableConcept? _ContentDerivative; /// /// When this Contract was issued. /// [FhirElement("issued", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When this Contract was issued /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -4244,13 +4127,13 @@ public string Issued /// [FhirElement("applies", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Period Applies + public Hl7.Fhir.Model.Period? Applies { get { return _Applies; } set { _Applies = value; OnPropertyChanged("Applies"); } } - private Hl7.Fhir.Model.Period _Applies; + private Hl7.Fhir.Model.Period? _Applies; /// /// Contract cessation cause. @@ -4258,13 +4141,13 @@ public Hl7.Fhir.Model.Period Applies [FhirElement("expirationType", Order=190)] [Binding("ContractExpiration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ExpirationType + public Hl7.Fhir.Model.CodeableConcept? ExpirationType { get { return _ExpirationType; } set { _ExpirationType = value; OnPropertyChanged("ExpirationType"); } } - private Hl7.Fhir.Model.CodeableConcept _ExpirationType; + private Hl7.Fhir.Model.CodeableConcept? _ExpirationType; /// /// Contract Target Entity. @@ -4276,11 +4159,11 @@ public Hl7.Fhir.Model.CodeableConcept ExpirationType [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Authority under which this Contract has standing. @@ -4292,11 +4175,11 @@ public List Subject [DataMember] public List Authority { - get { if(_Authority==null) _Authority = new List(); return _Authority; } + get => _Authority ?? new List(); set { _Authority = value; OnPropertyChanged("Authority"); } } - private List _Authority; + private List? _Authority; /// /// A sphere of control governed by an authoritative jurisdiction, organization, or person. @@ -4308,11 +4191,11 @@ public List Authority [DataMember] public List Domain { - get { if(_Domain==null) _Domain = new List(); return _Domain; } + get => _Domain ?? new List(); set { _Domain = value; OnPropertyChanged("Domain"); } } - private List _Domain; + private List? _Domain; /// /// Specific Location. @@ -4324,39 +4207,36 @@ public List Domain [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Computer friendly designation. /// [FhirElement("name", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Computer friendly designation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4366,28 +4246,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human Friendly name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4397,28 +4274,25 @@ public string Title /// [FhirElement("subtitle", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate Friendly name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -4431,24 +4305,24 @@ public string Subtitle [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Acronym or short name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -4462,13 +4336,13 @@ public IEnumerable Alias [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Range of Legal Concerns. @@ -4476,13 +4350,13 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("scope", Order=290)] [Binding("ContractScope")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scope + public Hl7.Fhir.Model.CodeableConcept? Scope { get { return _Scope; } set { _Scope = value; OnPropertyChanged("Scope"); } } - private Hl7.Fhir.Model.CodeableConcept _Scope; + private Hl7.Fhir.Model.CodeableConcept? _Scope; /// /// Focus of contract interest. @@ -4492,13 +4366,13 @@ public Hl7.Fhir.Model.CodeableConcept Scope [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Topic + public Hl7.Fhir.Model.DataType? Topic { get { return _Topic; } set { _Topic = value; OnPropertyChanged("Topic"); } } - private Hl7.Fhir.Model.DataType _Topic; + private Hl7.Fhir.Model.DataType? _Topic; /// /// Legal instrument category. @@ -4506,13 +4380,13 @@ public Hl7.Fhir.Model.DataType Topic [FhirElement("type", InSummary=true, Order=310, FiveWs="FiveWs.what[x]")] [Binding("ContractType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Subtype within the context of type. @@ -4523,24 +4397,24 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List SubType { - get { if(_SubType==null) _SubType = new List(); return _SubType; } + get => _SubType ?? new List(); set { _SubType = value; OnPropertyChanged("SubType"); } } - private List _SubType; + private List? _SubType; /// /// Contract precursor content. /// [FhirElement("contentDefinition", Order=330)] [DataMember] - public Hl7.Fhir.Model.Contract.ContentDefinitionComponent ContentDefinition + public Hl7.Fhir.Model.Contract.ContentDefinitionComponent? ContentDefinition { get { return _ContentDefinition; } set { _ContentDefinition = value; OnPropertyChanged("ContentDefinition"); } } - private Hl7.Fhir.Model.Contract.ContentDefinitionComponent _ContentDefinition; + private Hl7.Fhir.Model.Contract.ContentDefinitionComponent? _ContentDefinition; /// /// Contract Term List. @@ -4550,11 +4424,11 @@ public Hl7.Fhir.Model.Contract.ContentDefinitionComponent ContentDefinition [DataMember] public List Term { - get { if(_Term==null) _Term = new List(); return _Term; } + get => _Term ?? new List(); set { _Term = value; OnPropertyChanged("Term"); } } - private List _Term; + private List? _Term; /// /// Extra Information. @@ -4566,11 +4440,11 @@ public List Term [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Key event in Contract History. @@ -4582,11 +4456,11 @@ public List SupportingInfo [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Contract Signatory. @@ -4596,11 +4470,11 @@ public List RelevantHistory [DataMember] public List Signer { - get { if(_Signer==null) _Signer = new List(); return _Signer; } + get => _Signer ?? new List(); set { _Signer = value; OnPropertyChanged("Signer"); } } - private List _Signer; + private List? _Signer; /// /// Contract Friendly Language. @@ -4610,11 +4484,11 @@ public List Signer [DataMember] public List Friendly { - get { if(_Friendly==null) _Friendly = new List(); return _Friendly; } + get => _Friendly ?? new List(); set { _Friendly = value; OnPropertyChanged("Friendly"); } } - private List _Friendly; + private List? _Friendly; /// /// Contract Legal Language. @@ -4624,11 +4498,11 @@ public List Friendly [DataMember] public List Legal { - get { if(_Legal==null) _Legal = new List(); return _Legal; } + get => _Legal ?? new List(); set { _Legal = value; OnPropertyChanged("Legal"); } } - private List _Legal; + private List? _Legal; /// /// Computable Contract Language. @@ -4638,11 +4512,11 @@ public List Legal [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Binding Contract. @@ -4652,59 +4526,55 @@ public List Rule [References("Composition","DocumentReference","QuestionnaireResponse","Contract")] [AllowedTypes(typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType LegallyBinding + public Hl7.Fhir.Model.DataType? LegallyBinding { get { return _LegallyBinding; } set { _LegallyBinding = value; OnPropertyChanged("LegallyBinding"); } } - private Hl7.Fhir.Model.DataType _LegallyBinding; + private Hl7.Fhir.Model.DataType? _LegallyBinding; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Contract; - - if (dest == null) - { + if(other is not Contract dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(LegalState != null) dest.LegalState = (Hl7.Fhir.Model.CodeableConcept)LegalState.DeepCopyInternal(); - if(InstantiatesCanonical != null) dest.InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)InstantiatesCanonical.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(ContentDerivative != null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)ContentDerivative.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Applies != null) dest.Applies = (Hl7.Fhir.Model.Period)Applies.DeepCopyInternal(); - if(ExpirationType != null) dest.ExpirationType = (Hl7.Fhir.Model.CodeableConcept)ExpirationType.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Authority.Any()) dest.Authority = new List(Authority.DeepCopyInternal()); - if(Domain.Any()) dest.Domain = new List(Domain.DeepCopyInternal()); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Scope != null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)Scope.DeepCopyInternal(); - if(Topic != null) dest.Topic = (Hl7.Fhir.Model.DataType)Topic.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType.Any()) dest.SubType = new List(SubType.DeepCopyInternal()); - if(ContentDefinition != null) dest.ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)ContentDefinition.DeepCopyInternal(); - if(Term.Any()) dest.Term = new List(Term.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Signer.Any()) dest.Signer = new List(Signer.DeepCopyInternal()); - if(Friendly.Any()) dest.Friendly = new List(Friendly.DeepCopyInternal()); - if(Legal.Any()) dest.Legal = new List(Legal.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(LegallyBinding != null) dest.LegallyBinding = (Hl7.Fhir.Model.DataType)LegallyBinding.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_LegalState is not null) dest.LegalState = (Hl7.Fhir.Model.CodeableConcept)_LegalState.DeepCopyInternal(); + if(_InstantiatesCanonical is not null) dest.InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)_InstantiatesCanonical.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_ContentDerivative is not null) dest.ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)_ContentDerivative.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Applies is not null) dest.Applies = (Hl7.Fhir.Model.Period)_Applies.DeepCopyInternal(); + if(_ExpirationType is not null) dest.ExpirationType = (Hl7.Fhir.Model.CodeableConcept)_ExpirationType.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Authority is not null) dest.Authority = new List(_Authority.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = new List(_Domain.DeepCopyInternal()); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = (Hl7.Fhir.Model.CodeableConcept)_Scope.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = (Hl7.Fhir.Model.DataType)_Topic.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = new List(_SubType.DeepCopyInternal()); + if(_ContentDefinition is not null) dest.ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)_ContentDefinition.DeepCopyInternal(); + if(_Term is not null) dest.Term = new List(_Term.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Signer is not null) dest.Signer = new List(_Signer.DeepCopyInternal()); + if(_Friendly is not null) dest.Friendly = new List(_Friendly.DeepCopyInternal()); + if(_Legal is not null) dest.Legal = new List(_Legal.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_LegallyBinding is not null) dest.LegallyBinding = (Hl7.Fhir.Model.DataType)_LegallyBinding.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4716,258 +4586,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contract; - if(otherT == null) return false; + if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(LegalState, otherT.LegalState)) return false; - if(!comparer.Equals(InstantiatesCanonical, otherT.InstantiatesCanonical)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(ContentDerivative, otherT.ContentDerivative)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.Equals(Applies, otherT.Applies)) return false; - if(!comparer.Equals(ExpirationType, otherT.ExpirationType)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Scope, otherT.Scope)) return false; - if(!comparer.Equals(Topic, otherT.Topic)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(ContentDefinition, otherT.ContentDefinition)) return false; - if(!comparer.ListEquals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.ListEquals(Signer, otherT.Signer)) return false; - if(!comparer.ListEquals(Friendly, otherT.Friendly)) return false; - if(!comparer.ListEquals(Legal, otherT.Legal)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.Equals(LegallyBinding, otherT.LegallyBinding)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_LegalState, otherT._LegalState)) return false; + if(!comparer.Equals(_InstantiatesCanonical, otherT._InstantiatesCanonical)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_ContentDerivative, otherT._ContentDerivative)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.Equals(_Applies, otherT._Applies)) return false; + if(!comparer.Equals(_ExpirationType, otherT._ExpirationType)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Scope, otherT._Scope)) return false; + if(!comparer.Equals(_Topic, otherT._Topic)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_ContentDefinition, otherT._ContentDefinition)) return false; + if(!comparer.ListEquals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.ListEquals(_Signer, otherT._Signer)) return false; + if(!comparer.ListEquals(_Friendly, otherT._Friendly)) return false; + if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.Equals(_LegallyBinding, otherT._LegallyBinding)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "legalState": - value = LegalState; - return LegalState is not null; + value = _LegalState; + return _LegalState is not null; case "instantiatesCanonical": - value = InstantiatesCanonical; - return InstantiatesCanonical is not null; + value = _InstantiatesCanonical; + return _InstantiatesCanonical is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "contentDerivative": - value = ContentDerivative; - return ContentDerivative is not null; + value = _ContentDerivative; + return _ContentDerivative is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "applies": - value = Applies; - return Applies is not null; + value = _Applies; + return _Applies is not null; case "expirationType": - value = ExpirationType; - return ExpirationType is not null; + value = _ExpirationType; + return _ExpirationType is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "authority": - value = Authority; - return Authority?.Any() == true; + value = _Authority; + return _Authority?.Any() == true; case "domain": - value = Domain; - return Domain?.Any() == true; + value = _Domain; + return _Domain?.Any() == true; case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "scope": - value = Scope; - return Scope is not null; + value = _Scope; + return _Scope is not null; case "topic": - value = Topic; - return Topic is not null; + value = _Topic; + return _Topic is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType?.Any() == true; + value = _SubType; + return _SubType?.Any() == true; case "contentDefinition": - value = ContentDefinition; - return ContentDefinition is not null; + value = _ContentDefinition; + return _ContentDefinition is not null; case "term": - value = Term; - return Term?.Any() == true; + value = _Term; + return _Term?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "signer": - value = Signer; - return Signer?.Any() == true; + value = _Signer; + return _Signer?.Any() == true; case "friendly": - value = Friendly; - return Friendly?.Any() == true; + value = _Friendly; + return _Friendly?.Any() == true; case "legal": - value = Legal; - return Legal?.Any() == true; + value = _Legal; + return _Legal?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "legallyBinding": - value = LegallyBinding; - return LegallyBinding is not null; + value = _LegallyBinding; + return _LegallyBinding is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "legalState": - LegalState = (Hl7.Fhir.Model.CodeableConcept)value; + LegalState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "instantiatesCanonical": - InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference)value; + InstantiatesCanonical = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "contentDerivative": - ContentDerivative = (Hl7.Fhir.Model.CodeableConcept)value; + ContentDerivative = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "applies": - Applies = (Hl7.Fhir.Model.Period)value; + Applies = (Hl7.Fhir.Model.Period?)value; return this; case "expirationType": - ExpirationType = (Hl7.Fhir.Model.CodeableConcept)value; + ExpirationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "authority": - Authority = (List)value; + Authority = (List?)value!; return this; case "domain": - Domain = (List)value; + Domain = (List?)value!; return this; case "site": - Site = (List)value; + Site = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "scope": - Scope = (Hl7.Fhir.Model.CodeableConcept)value; + Scope = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "topic": - Topic = (Hl7.Fhir.Model.DataType)value; + Topic = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (List)value; + SubType = (List?)value!; return this; case "contentDefinition": - ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent)value; + ContentDefinition = (Hl7.Fhir.Model.Contract.ContentDefinitionComponent?)value; return this; case "term": - Term = (List)value; + Term = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "signer": - Signer = (List)value; + Signer = (List?)value!; return this; case "friendly": - Friendly = (List)value; + Friendly = (List?)value!; return this; case "legal": - Legal = (List)value; + Legal = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "legallyBinding": - LegallyBinding = (Hl7.Fhir.Model.DataType)value; + LegallyBinding = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -4978,39 +4848,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (LegalState is not null) yield return new KeyValuePair("legalState",LegalState); - if (InstantiatesCanonical is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonical); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",ContentDerivative); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Applies is not null) yield return new KeyValuePair("applies",Applies); - if (ExpirationType is not null) yield return new KeyValuePair("expirationType",ExpirationType); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Authority?.Any() == true) yield return new KeyValuePair("authority",Authority); - if (Domain?.Any() == true) yield return new KeyValuePair("domain",Domain); - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Scope is not null) yield return new KeyValuePair("scope",Scope); - if (Topic is not null) yield return new KeyValuePair("topic",Topic); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType?.Any() == true) yield return new KeyValuePair("subType",SubType); - if (ContentDefinition is not null) yield return new KeyValuePair("contentDefinition",ContentDefinition); - if (Term?.Any() == true) yield return new KeyValuePair("term",Term); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Signer?.Any() == true) yield return new KeyValuePair("signer",Signer); - if (Friendly?.Any() == true) yield return new KeyValuePair("friendly",Friendly); - if (Legal?.Any() == true) yield return new KeyValuePair("legal",Legal); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (LegallyBinding is not null) yield return new KeyValuePair("legallyBinding",LegallyBinding); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_LegalState is not null) yield return new KeyValuePair("legalState",_LegalState); + if (_InstantiatesCanonical is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonical); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_ContentDerivative is not null) yield return new KeyValuePair("contentDerivative",_ContentDerivative); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Applies is not null) yield return new KeyValuePair("applies",_Applies); + if (_ExpirationType is not null) yield return new KeyValuePair("expirationType",_ExpirationType); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Authority?.Any() == true) yield return new KeyValuePair("authority",_Authority); + if (_Domain?.Any() == true) yield return new KeyValuePair("domain",_Domain); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Scope is not null) yield return new KeyValuePair("scope",_Scope); + if (_Topic is not null) yield return new KeyValuePair("topic",_Topic); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType?.Any() == true) yield return new KeyValuePair("subType",_SubType); + if (_ContentDefinition is not null) yield return new KeyValuePair("contentDefinition",_ContentDefinition); + if (_Term?.Any() == true) yield return new KeyValuePair("term",_Term); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Signer?.Any() == true) yield return new KeyValuePair("signer",_Signer); + if (_Friendly?.Any() == true) yield return new KeyValuePair("friendly",_Friendly); + if (_Legal?.Any() == true) yield return new KeyValuePair("legal",_Legal); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_LegallyBinding is not null) yield return new KeyValuePair("legallyBinding",_LegallyBinding); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs index a5807dd39..31d8468ca 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -101,13 +104,13 @@ public enum ContributorType [Binding("ContributorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// author | editor | reviewer | endorser @@ -116,13 +119,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Contributor.ContributorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -133,28 +133,25 @@ public Hl7.Fhir.Model.Contributor.ContributorType? Type [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Who contributed the content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -167,25 +164,21 @@ public string Name [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; protected internal override void CopyToInternal(Base other) { - var dest = other as Contributor; - - if (dest == null) - { + if(other is not Contributor dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -197,48 +190,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Contributor; - if(otherT == null) return false; + if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; default: return base.SetValue(key, value); @@ -249,9 +242,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Count.cs b/src/Hl7.Fhir.R5/Model/Generated/Count.cs index 576a90634..c657378f6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Count.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Count.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs index 63a2981d6..2d47f8b46 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,57 +115,50 @@ public partial class PaymentByComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; /// /// Party's responsibility. /// [FhirElement("responsibility", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ResponsibilityElement + public Hl7.Fhir.Model.FhirString? ResponsibilityElement { get { return _ResponsibilityElement; } set { _ResponsibilityElement = value; OnPropertyChanged("ResponsibilityElement"); } } - private Hl7.Fhir.Model.FhirString _ResponsibilityElement; + private Hl7.Fhir.Model.FhirString? _ResponsibilityElement; /// /// Party's responsibility /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Responsibility + public string? Responsibility { - get { return ResponsibilityElement != null ? ResponsibilityElement.Value : null; } + get => _ResponsibilityElement?.Value; set { - if (value == null) - ResponsibilityElement = null; - else - ResponsibilityElement = new Hl7.Fhir.Model.FhirString(value); + ResponsibilityElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Responsibility"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentByComponent; - - if (dest == null) - { + if(other is not PaymentByComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); - if(ResponsibilityElement != null) dest.ResponsibilityElement = (Hl7.Fhir.Model.FhirString)ResponsibilityElement.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); + if(_ResponsibilityElement is not null) dest.ResponsibilityElement = (Hl7.Fhir.Model.FhirString)_ResponsibilityElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -174,41 +170,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentByComponent; - if(otherT == null) return false; + if(other is not PaymentByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; - if(!comparer.Equals(ResponsibilityElement, otherT.ResponsibilityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + if(!comparer.Equals(_ResponsibilityElement, otherT._ResponsibilityElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; case "responsibility": - value = ResponsibilityElement; - return ResponsibilityElement is not null; + value = _ResponsibilityElement; + return _ResponsibilityElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsibility": - ResponsibilityElement = (Hl7.Fhir.Model.FhirString)value; + ResponsibilityElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -219,8 +215,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Party is not null) yield return new KeyValuePair("party",Party); - if (ResponsibilityElement is not null) yield return new KeyValuePair("responsibility",ResponsibilityElement); + if (_Party is not null) yield return new KeyValuePair("party",_Party); + if (_ResponsibilityElement is not null) yield return new KeyValuePair("responsibility",_ResponsibilityElement); } } @@ -249,13 +245,13 @@ public partial class ClassComponent : Hl7.Fhir.Model.BackboneElement [Binding("CoverageClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Value associated with the type. @@ -263,58 +259,51 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("value", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier Value + public Hl7.Fhir.Model.Identifier? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Identifier _Value; + private Hl7.Fhir.Model.Identifier? _Value; /// /// Human readable description of the type and value. /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human readable description of the type and value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ClassComponent; - - if (dest == null) - { + if(other is not ClassComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Identifier)Value.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Identifier)_Value.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -326,48 +315,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassComponent; - if(otherT == null) return false; + if(other is not ClassComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.Identifier)value; + Value = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -378,9 +367,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); } } @@ -408,13 +397,13 @@ public partial class CostToBeneficiaryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("CopayTypes")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefit classification. @@ -422,13 +411,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("category", Order=50)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// In or out of network. @@ -436,13 +425,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("network", Order=60)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -450,13 +439,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=70)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -464,13 +453,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=80)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// The amount or percentage due from the beneficiary. @@ -479,13 +468,13 @@ public Hl7.Fhir.Model.CodeableConcept Term [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Exceptions for patient payments. @@ -495,29 +484,25 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Exception { - get { if(_Exception==null) _Exception = new List(); return _Exception; } + get => _Exception ?? new List(); set { _Exception = value; OnPropertyChanged("Exception"); } } - private List _Exception; + private List? _Exception; protected internal override void CopyToInternal(Base other) { - var dest = other as CostToBeneficiaryComponent; - - if (dest == null) - { + if(other is not CostToBeneficiaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Exception.Any()) dest.Exception = new List(Exception.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Exception is not null) dest.Exception = new List(_Exception.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -529,76 +514,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostToBeneficiaryComponent; - if(otherT == null) return false; + if(other is not CostToBeneficiaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Exception, otherT.Exception)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Exception, otherT._Exception)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exception": - value = Exception; - return Exception?.Any() == true; + value = _Exception; + return _Exception?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exception": - Exception = (List)value; + Exception = (List?)value!; return this; default: return base.SetValue(key, value); @@ -609,13 +594,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Exception?.Any() == true) yield return new KeyValuePair("exception",Exception); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Exception?.Any() == true) yield return new KeyValuePair("exception",_Exception); } } @@ -643,39 +628,35 @@ public partial class ExemptionComponent : Hl7.Fhir.Model.BackboneElement [Binding("CoverageFinancialException")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The effective period of the exception. /// [FhirElement("period", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ExemptionComponent; - - if (dest == null) - { + if(other is not ExemptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -687,41 +668,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExemptionComponent; - if(otherT == null) return false; + if(other is not ExemptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -732,8 +713,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -746,11 +727,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -760,13 +741,13 @@ public List Identifier [Binding("CoverageStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -775,13 +756,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -794,13 +772,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [Binding("CoverageKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// insurance | self-pay | other @@ -809,13 +787,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.Coverage.CoverageKindCode? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -828,11 +803,11 @@ public Hl7.Fhir.Model.Coverage.CoverageKindCode? Kind [DataMember] public List PaymentBy { - get { if(_PaymentBy==null) _PaymentBy = new List(); return _PaymentBy; } + get => _PaymentBy ?? new List(); set { _PaymentBy = value; OnPropertyChanged("PaymentBy"); } } - private List _PaymentBy; + private List? _PaymentBy; /// /// Coverage category such as medical or accident. @@ -840,13 +815,13 @@ public List PaymentBy [FhirElement("type", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("CoverageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Owner of the policy. @@ -855,13 +830,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PolicyHolder + public Hl7.Fhir.Model.ResourceReference? PolicyHolder { get { return _PolicyHolder; } set { _PolicyHolder = value; OnPropertyChanged("PolicyHolder"); } } - private Hl7.Fhir.Model.ResourceReference _PolicyHolder; + private Hl7.Fhir.Model.ResourceReference? _PolicyHolder; /// /// Subscriber to the policy. @@ -870,13 +845,13 @@ public Hl7.Fhir.Model.ResourceReference PolicyHolder [CLSCompliant(false)] [References("Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subscriber + public Hl7.Fhir.Model.ResourceReference? Subscriber { get { return _Subscriber; } set { _Subscriber = value; OnPropertyChanged("Subscriber"); } } - private Hl7.Fhir.Model.ResourceReference _Subscriber; + private Hl7.Fhir.Model.ResourceReference? _Subscriber; /// /// ID assigned to the subscriber. @@ -886,11 +861,11 @@ public Hl7.Fhir.Model.ResourceReference Subscriber [DataMember] public List SubscriberId { - get { if(_SubscriberId==null) _SubscriberId = new List(); return _SubscriberId; } + get => _SubscriberId ?? new List(); set { _SubscriberId = value; OnPropertyChanged("SubscriberId"); } } - private List _SubscriberId; + private List? _SubscriberId; /// /// Plan beneficiary. @@ -900,41 +875,38 @@ public List SubscriberId [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Beneficiary + public Hl7.Fhir.Model.ResourceReference? Beneficiary { get { return _Beneficiary; } set { _Beneficiary = value; OnPropertyChanged("Beneficiary"); } } - private Hl7.Fhir.Model.ResourceReference _Beneficiary; + private Hl7.Fhir.Model.ResourceReference? _Beneficiary; /// /// Dependent number. /// [FhirElement("dependent", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString DependentElement + public Hl7.Fhir.Model.FhirString? DependentElement { get { return _DependentElement; } set { _DependentElement = value; OnPropertyChanged("DependentElement"); } } - private Hl7.Fhir.Model.FhirString _DependentElement; + private Hl7.Fhir.Model.FhirString? _DependentElement; /// /// Dependent number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Dependent + public string? Dependent { - get { return DependentElement != null ? DependentElement.Value : null; } + get => _DependentElement?.Value; set { - if (value == null) - DependentElement = null; - else - DependentElement = new Hl7.Fhir.Model.FhirString(value); + DependentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Dependent"); } } @@ -945,26 +917,26 @@ public string Dependent [FhirElement("relationship", Order=190)] [Binding("Relationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// Coverage start and end dates. /// [FhirElement("period", InSummary=true, Order=200, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Issuer of the policy. @@ -973,13 +945,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Additional coverage classifications. @@ -989,24 +961,24 @@ public Hl7.Fhir.Model.ResourceReference Insurer [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// Relative order of the coverage. /// [FhirElement("order", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.PositiveInt OrderElement + public Hl7.Fhir.Model.PositiveInt? OrderElement { get { return _OrderElement; } set { _OrderElement = value; OnPropertyChanged("OrderElement"); } } - private Hl7.Fhir.Model.PositiveInt _OrderElement; + private Hl7.Fhir.Model.PositiveInt? _OrderElement; /// /// Relative order of the coverage @@ -1015,13 +987,10 @@ public Hl7.Fhir.Model.PositiveInt OrderElement [IgnoreDataMember] public int? Order { - get { return OrderElement != null ? OrderElement.Value : null; } + get => _OrderElement?.Value; set { - if (value == null) - OrderElement = null; - else - OrderElement = new Hl7.Fhir.Model.PositiveInt(value); + OrderElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Order"); } } @@ -1031,28 +1000,25 @@ public int? Order /// [FhirElement("network", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirString NetworkElement + public Hl7.Fhir.Model.FhirString? NetworkElement { get { return _NetworkElement; } set { _NetworkElement = value; OnPropertyChanged("NetworkElement"); } } - private Hl7.Fhir.Model.FhirString _NetworkElement; + private Hl7.Fhir.Model.FhirString? _NetworkElement; /// /// Insurer network /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Network + public string? Network { - get { return NetworkElement != null ? NetworkElement.Value : null; } + get => _NetworkElement?.Value; set { - if (value == null) - NetworkElement = null; - else - NetworkElement = new Hl7.Fhir.Model.FhirString(value); + NetworkElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Network"); } } @@ -1065,24 +1031,24 @@ public string Network [DataMember] public List CostToBeneficiary { - get { if(_CostToBeneficiary==null) _CostToBeneficiary = new List(); return _CostToBeneficiary; } + get => _CostToBeneficiary ?? new List(); set { _CostToBeneficiary = value; OnPropertyChanged("CostToBeneficiary"); } } - private List _CostToBeneficiary; + private List? _CostToBeneficiary; /// /// Reimbursement to insurer. /// [FhirElement("subrogation", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SubrogationElement + public Hl7.Fhir.Model.FhirBoolean? SubrogationElement { get { return _SubrogationElement; } set { _SubrogationElement = value; OnPropertyChanged("SubrogationElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SubrogationElement; + private Hl7.Fhir.Model.FhirBoolean? _SubrogationElement; /// /// Reimbursement to insurer @@ -1091,13 +1057,10 @@ public Hl7.Fhir.Model.FhirBoolean SubrogationElement [IgnoreDataMember] public bool? Subrogation { - get { return SubrogationElement != null ? SubrogationElement.Value : null; } + get => _SubrogationElement?.Value; set { - if (value == null) - SubrogationElement = null; - else - SubrogationElement = new Hl7.Fhir.Model.FhirBoolean(value); + SubrogationElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Subrogation"); } } @@ -1112,11 +1075,11 @@ public bool? Subrogation [DataMember] public List Contract { - get { if(_Contract==null) _Contract = new List(); return _Contract; } + get => _Contract ?? new List(); set { _Contract = value; OnPropertyChanged("Contract"); } } - private List _Contract; + private List? _Contract; /// /// Insurance plan details. @@ -1125,46 +1088,42 @@ public List Contract [CLSCompliant(false)] [References("InsurancePlan")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InsurancePlan + public Hl7.Fhir.Model.ResourceReference? InsurancePlan { get { return _InsurancePlan; } set { _InsurancePlan = value; OnPropertyChanged("InsurancePlan"); } } - private Hl7.Fhir.Model.ResourceReference _InsurancePlan; + private Hl7.Fhir.Model.ResourceReference? _InsurancePlan; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Coverage; - - if (dest == null) - { + if(other is not Coverage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(PaymentBy.Any()) dest.PaymentBy = new List(PaymentBy.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PolicyHolder != null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)PolicyHolder.DeepCopyInternal(); - if(Subscriber != null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)Subscriber.DeepCopyInternal(); - if(SubscriberId.Any()) dest.SubscriberId = new List(SubscriberId.DeepCopyInternal()); - if(Beneficiary != null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)Beneficiary.DeepCopyInternal(); - if(DependentElement != null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)DependentElement.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(OrderElement != null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)OrderElement.DeepCopyInternal(); - if(NetworkElement != null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)NetworkElement.DeepCopyInternal(); - if(CostToBeneficiary.Any()) dest.CostToBeneficiary = new List(CostToBeneficiary.DeepCopyInternal()); - if(SubrogationElement != null) dest.SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)SubrogationElement.DeepCopyInternal(); - if(Contract.Any()) dest.Contract = new List(Contract.DeepCopyInternal()); - if(InsurancePlan != null) dest.InsurancePlan = (Hl7.Fhir.Model.ResourceReference)InsurancePlan.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_PaymentBy is not null) dest.PaymentBy = new List(_PaymentBy.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PolicyHolder is not null) dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)_PolicyHolder.DeepCopyInternal(); + if(_Subscriber is not null) dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)_Subscriber.DeepCopyInternal(); + if(_SubscriberId is not null) dest.SubscriberId = new List(_SubscriberId.DeepCopyInternal()); + if(_Beneficiary is not null) dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)_Beneficiary.DeepCopyInternal(); + if(_DependentElement is not null) dest.DependentElement = (Hl7.Fhir.Model.FhirString)_DependentElement.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_OrderElement is not null) dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)_OrderElement.DeepCopyInternal(); + if(_NetworkElement is not null) dest.NetworkElement = (Hl7.Fhir.Model.FhirString)_NetworkElement.DeepCopyInternal(); + if(_CostToBeneficiary is not null) dest.CostToBeneficiary = new List(_CostToBeneficiary.DeepCopyInternal()); + if(_SubrogationElement is not null) dest.SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)_SubrogationElement.DeepCopyInternal(); + if(_Contract is not null) dest.Contract = new List(_Contract.DeepCopyInternal()); + if(_InsurancePlan is not null) dest.InsurancePlan = (Hl7.Fhir.Model.ResourceReference)_InsurancePlan.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1176,167 +1135,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Coverage; - if(otherT == null) return false; + if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.ListEquals(PaymentBy, otherT.PaymentBy)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PolicyHolder, otherT.PolicyHolder)) return false; - if(!comparer.Equals(Subscriber, otherT.Subscriber)) return false; - if(!comparer.ListEquals(SubscriberId, otherT.SubscriberId)) return false; - if(!comparer.Equals(Beneficiary, otherT.Beneficiary)) return false; - if(!comparer.Equals(DependentElement, otherT.DependentElement)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.Equals(OrderElement, otherT.OrderElement)) return false; - if(!comparer.Equals(NetworkElement, otherT.NetworkElement)) return false; - if(!comparer.ListEquals(CostToBeneficiary, otherT.CostToBeneficiary)) return false; - if(!comparer.Equals(SubrogationElement, otherT.SubrogationElement)) return false; - if(!comparer.ListEquals(Contract, otherT.Contract)) return false; - if(!comparer.Equals(InsurancePlan, otherT.InsurancePlan)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.ListEquals(_PaymentBy, otherT._PaymentBy)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PolicyHolder, otherT._PolicyHolder)) return false; + if(!comparer.Equals(_Subscriber, otherT._Subscriber)) return false; + if(!comparer.ListEquals(_SubscriberId, otherT._SubscriberId)) return false; + if(!comparer.Equals(_Beneficiary, otherT._Beneficiary)) return false; + if(!comparer.Equals(_DependentElement, otherT._DependentElement)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_OrderElement, otherT._OrderElement)) return false; + if(!comparer.Equals(_NetworkElement, otherT._NetworkElement)) return false; + if(!comparer.ListEquals(_CostToBeneficiary, otherT._CostToBeneficiary)) return false; + if(!comparer.Equals(_SubrogationElement, otherT._SubrogationElement)) return false; + if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; + if(!comparer.Equals(_InsurancePlan, otherT._InsurancePlan)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "paymentBy": - value = PaymentBy; - return PaymentBy?.Any() == true; + value = _PaymentBy; + return _PaymentBy?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "policyHolder": - value = PolicyHolder; - return PolicyHolder is not null; + value = _PolicyHolder; + return _PolicyHolder is not null; case "subscriber": - value = Subscriber; - return Subscriber is not null; + value = _Subscriber; + return _Subscriber is not null; case "subscriberId": - value = SubscriberId; - return SubscriberId?.Any() == true; + value = _SubscriberId; + return _SubscriberId?.Any() == true; case "beneficiary": - value = Beneficiary; - return Beneficiary is not null; + value = _Beneficiary; + return _Beneficiary is not null; case "dependent": - value = DependentElement; - return DependentElement is not null; + value = _DependentElement; + return _DependentElement is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "order": - value = OrderElement; - return OrderElement is not null; + value = _OrderElement; + return _OrderElement is not null; case "network": - value = NetworkElement; - return NetworkElement is not null; + value = _NetworkElement; + return _NetworkElement is not null; case "costToBeneficiary": - value = CostToBeneficiary; - return CostToBeneficiary?.Any() == true; + value = _CostToBeneficiary; + return _CostToBeneficiary?.Any() == true; case "subrogation": - value = SubrogationElement; - return SubrogationElement is not null; + value = _SubrogationElement; + return _SubrogationElement is not null; case "contract": - value = Contract; - return Contract?.Any() == true; + value = _Contract; + return _Contract?.Any() == true; case "insurancePlan": - value = InsurancePlan; - return InsurancePlan is not null; + value = _InsurancePlan; + return _InsurancePlan is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "paymentBy": - PaymentBy = (List)value; + PaymentBy = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "policyHolder": - PolicyHolder = (Hl7.Fhir.Model.ResourceReference)value; + PolicyHolder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriber": - Subscriber = (Hl7.Fhir.Model.ResourceReference)value; + Subscriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subscriberId": - SubscriberId = (List)value; + SubscriberId = (List?)value!; return this; case "beneficiary": - Beneficiary = (Hl7.Fhir.Model.ResourceReference)value; + Beneficiary = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dependent": - DependentElement = (Hl7.Fhir.Model.FhirString)value; + DependentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "order": - OrderElement = (Hl7.Fhir.Model.PositiveInt)value; + OrderElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "network": - NetworkElement = (Hl7.Fhir.Model.FhirString)value; + NetworkElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "costToBeneficiary": - CostToBeneficiary = (List)value; + CostToBeneficiary = (List?)value!; return this; case "subrogation": - SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)value; + SubrogationElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "contract": - Contract = (List)value; + Contract = (List?)value!; return this; case "insurancePlan": - InsurancePlan = (Hl7.Fhir.Model.ResourceReference)value; + InsurancePlan = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1347,26 +1306,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (PaymentBy?.Any() == true) yield return new KeyValuePair("paymentBy",PaymentBy); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PolicyHolder is not null) yield return new KeyValuePair("policyHolder",PolicyHolder); - if (Subscriber is not null) yield return new KeyValuePair("subscriber",Subscriber); - if (SubscriberId?.Any() == true) yield return new KeyValuePair("subscriberId",SubscriberId); - if (Beneficiary is not null) yield return new KeyValuePair("beneficiary",Beneficiary); - if (DependentElement is not null) yield return new KeyValuePair("dependent",DependentElement); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (OrderElement is not null) yield return new KeyValuePair("order",OrderElement); - if (NetworkElement is not null) yield return new KeyValuePair("network",NetworkElement); - if (CostToBeneficiary?.Any() == true) yield return new KeyValuePair("costToBeneficiary",CostToBeneficiary); - if (SubrogationElement is not null) yield return new KeyValuePair("subrogation",SubrogationElement); - if (Contract?.Any() == true) yield return new KeyValuePair("contract",Contract); - if (InsurancePlan is not null) yield return new KeyValuePair("insurancePlan",InsurancePlan); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_PaymentBy?.Any() == true) yield return new KeyValuePair("paymentBy",_PaymentBy); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PolicyHolder is not null) yield return new KeyValuePair("policyHolder",_PolicyHolder); + if (_Subscriber is not null) yield return new KeyValuePair("subscriber",_Subscriber); + if (_SubscriberId?.Any() == true) yield return new KeyValuePair("subscriberId",_SubscriberId); + if (_Beneficiary is not null) yield return new KeyValuePair("beneficiary",_Beneficiary); + if (_DependentElement is not null) yield return new KeyValuePair("dependent",_DependentElement); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_OrderElement is not null) yield return new KeyValuePair("order",_OrderElement); + if (_NetworkElement is not null) yield return new KeyValuePair("network",_NetworkElement); + if (_CostToBeneficiary?.Any() == true) yield return new KeyValuePair("costToBeneficiary",_CostToBeneficiary); + if (_SubrogationElement is not null) yield return new KeyValuePair("subrogation",_SubrogationElement); + if (_Contract?.Any() == true) yield return new KeyValuePair("contract",_Contract); + if (_InsurancePlan is not null) yield return new KeyValuePair("insurancePlan",_InsurancePlan); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs index 34117094a..5e6a77f95 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [Binding("DatesType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Occurance date or period. @@ -132,26 +135,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -163,41 +162,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(When, otherT.When)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -208,8 +207,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (When is not null) yield return new KeyValuePair("when",When); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_When is not null) yield return new KeyValuePair("when",_When); } } @@ -237,13 +236,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -252,13 +251,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -271,26 +267,26 @@ public int? Sequence [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Information + public Hl7.Fhir.Model.ResourceReference? Information { get { return _Information; } set { _Information = value; OnPropertyChanged("Information"); } } - private Hl7.Fhir.Model.ResourceReference _Information; + private Hl7.Fhir.Model.ResourceReference? _Information; /// /// Applies to all items. /// [FhirElement("appliesToAll", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AppliesToAllElement + public Hl7.Fhir.Model.FhirBoolean? AppliesToAllElement { get { return _AppliesToAllElement; } set { _AppliesToAllElement = value; OnPropertyChanged("AppliesToAllElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AppliesToAllElement; + private Hl7.Fhir.Model.FhirBoolean? _AppliesToAllElement; /// /// Applies to all items @@ -299,30 +295,23 @@ public Hl7.Fhir.Model.FhirBoolean AppliesToAllElement [IgnoreDataMember] public bool? AppliesToAll { - get { return AppliesToAllElement != null ? AppliesToAllElement.Value : null; } + get => _AppliesToAllElement?.Value; set { - if (value == null) - AppliesToAllElement = null; - else - AppliesToAllElement = new Hl7.Fhir.Model.FhirBoolean(value); + AppliesToAllElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AppliesToAll"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Information != null) dest.Information = (Hl7.Fhir.Model.ResourceReference)Information.DeepCopyInternal(); - if(AppliesToAllElement != null) dest.AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)AppliesToAllElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Information is not null) dest.Information = (Hl7.Fhir.Model.ResourceReference)_Information.DeepCopyInternal(); + if(_AppliesToAllElement is not null) dest.AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)_AppliesToAllElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -334,48 +323,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Information, otherT.Information)) return false; - if(!comparer.Equals(AppliesToAllElement, otherT.AppliesToAllElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Information, otherT._Information)) return false; + if(!comparer.Equals(_AppliesToAllElement, otherT._AppliesToAllElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "information": - value = Information; - return Information is not null; + value = _Information; + return _Information is not null; case "appliesToAll": - value = AppliesToAllElement; - return AppliesToAllElement is not null; + value = _AppliesToAllElement; + return _AppliesToAllElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "information": - Information = (Hl7.Fhir.Model.ResourceReference)value; + Information = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "appliesToAll": - AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean)value; + AppliesToAllElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -386,9 +375,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Information is not null) yield return new KeyValuePair("information",Information); - if (AppliesToAllElement is not null) yield return new KeyValuePair("appliesToAll",AppliesToAllElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Information is not null) yield return new KeyValuePair("information",_Information); + if (_AppliesToAllElement is not null) yield return new KeyValuePair("appliesToAll",_AppliesToAllElement); } } @@ -415,13 +404,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("focal", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Applicable coverage @@ -430,13 +419,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -449,58 +435,51 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Additional provider contract number. /// [FhirElement("businessArrangement", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString BusinessArrangementElement + public Hl7.Fhir.Model.FhirString? BusinessArrangementElement { get { return _BusinessArrangementElement; } set { _BusinessArrangementElement = value; OnPropertyChanged("BusinessArrangementElement"); } } - private Hl7.Fhir.Model.FhirString _BusinessArrangementElement; + private Hl7.Fhir.Model.FhirString? _BusinessArrangementElement; /// /// Additional provider contract number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BusinessArrangement + public string? BusinessArrangement { - get { return BusinessArrangementElement != null ? BusinessArrangementElement.Value : null; } + get => _BusinessArrangementElement?.Value; set { - if (value == null) - BusinessArrangementElement = null; - else - BusinessArrangementElement = new Hl7.Fhir.Model.FhirString(value); + BusinessArrangementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BusinessArrangement"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(BusinessArrangementElement != null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopyInternal(); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_BusinessArrangementElement is not null) dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)_BusinessArrangementElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -512,48 +491,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(BusinessArrangementElement, otherT.BusinessArrangementElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "businessArrangement": - value = BusinessArrangementElement; - return BusinessArrangementElement is not null; + value = _BusinessArrangementElement; + return _BusinessArrangementElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "businessArrangement": - BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)value; + BusinessArrangementElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -564,9 +543,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",BusinessArrangementElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_BusinessArrangementElement is not null) yield return new KeyValuePair("businessArrangement",_BusinessArrangementElement); } } @@ -595,24 +574,24 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SupportingInfoSequenceElement { - get { if(_SupportingInfoSequenceElement==null) _SupportingInfoSequenceElement = new List(); return _SupportingInfoSequenceElement; } + get => _SupportingInfoSequenceElement ?? new List(); set { _SupportingInfoSequenceElement = value; OnPropertyChanged("SupportingInfoSequenceElement"); } } - private List _SupportingInfoSequenceElement; + private List? _SupportingInfoSequenceElement; /// /// Applicable exception or supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SupportingInfoSequence + public IEnumerable? SupportingInfoSequence { - get { return SupportingInfoSequenceElement != null ? SupportingInfoSequenceElement.Select(elem => elem.Value) : null; } + get => _SupportingInfoSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SupportingInfoSequenceElement = null; + SupportingInfoSequenceElement = null!; else SupportingInfoSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SupportingInfoSequence"); @@ -625,13 +604,13 @@ public IEnumerable SupportingInfoSequence [FhirElement("category", Order=50)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -639,13 +618,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -656,11 +635,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Perfoming practitioner. @@ -669,39 +648,39 @@ public List Modifier [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Count of products or services. /// [FhirElement("quantity", Order=90)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=100)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Servicing facility. @@ -710,13 +689,13 @@ public Hl7.Fhir.Model.Money UnitPrice [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Applicable diagnosis. @@ -726,11 +705,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Product or service details. @@ -742,32 +721,28 @@ public List Diagno [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailsComponent; - - if (dest == null) - { + if(other is not DetailsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SupportingInfoSequenceElement.Any()) dest.SupportingInfoSequenceElement = new List(SupportingInfoSequenceElement.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SupportingInfoSequenceElement is not null) dest.SupportingInfoSequenceElement = new List(_SupportingInfoSequenceElement.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -779,97 +754,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailsComponent; - if(otherT == null) return false; + if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(SupportingInfoSequenceElement, otherT.SupportingInfoSequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "supportingInfoSequence": - value = SupportingInfoSequenceElement; - return SupportingInfoSequenceElement?.Any() == true; + value = _SupportingInfoSequenceElement; + return _SupportingInfoSequenceElement?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "supportingInfoSequence": - SupportingInfoSequenceElement = (List)value; + SupportingInfoSequenceElement = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -880,16 +855,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SupportingInfoSequenceElement?.Any() == true) yield return new KeyValuePair("supportingInfoSequence",SupportingInfoSequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SupportingInfoSequenceElement?.Any() == true) yield return new KeyValuePair("supportingInfoSequence",_SupportingInfoSequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -919,25 +894,21 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [References("Condition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -949,34 +920,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -987,7 +958,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); } } @@ -1000,11 +971,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -1014,13 +985,13 @@ public List Identifier [Binding("EligibilityRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -1029,13 +1000,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1046,13 +1014,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("priority", Order=110, FiveWs="FiveWs.class")] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// auth-requirements | benefits | discovery | validation. @@ -1064,24 +1032,24 @@ public Hl7.Fhir.Model.CodeableConcept Priority [DataMember] public List> PurposeElement { - get { if(_PurposeElement==null) _PurposeElement = new List>(); return _PurposeElement; } + get => _PurposeElement ?? new List>(); set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private List> _PurposeElement; + private List>? _PurposeElement; /// /// auth-requirements | benefits | discovery | validation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Purpose + public IEnumerable? Purpose { - get { return PurposeElement != null ? PurposeElement.Select(elem => elem.Value) : null; } + get => _PurposeElement?.Select(elem => elem.Value); set { if (value == null) - PurposeElement = null; + PurposeElement = null!; else PurposeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Purpose"); @@ -1096,13 +1064,13 @@ public IEnumerable /// Event information. @@ -1112,11 +1080,11 @@ public Hl7.Fhir.Model.ResourceReference Patient [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Estimated date or dates of service. @@ -1125,13 +1093,13 @@ public List Event [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Creation date. @@ -1139,28 +1107,25 @@ public Hl7.Fhir.Model.DataType Serviced [FhirElement("created", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1172,13 +1137,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Party responsible for the request. @@ -1187,13 +1152,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Coverage issuer. @@ -1203,13 +1168,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Servicing facility. @@ -1218,13 +1183,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Supporting information. @@ -1234,11 +1199,11 @@ public Hl7.Fhir.Model.ResourceReference Facility [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Patient insurance information. @@ -1248,11 +1213,11 @@ public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Item to be evaluated for eligibiity. @@ -1262,39 +1227,35 @@ public List Insura [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageEligibilityRequest; - - if (dest == null) - { + if(other is not CoverageEligibilityRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(PurposeElement.Any()) dest.PurposeElement = new List>(PurposeElement.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = new List>(_PurposeElement.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1306,132 +1267,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageEligibilityRequest; - if(otherT == null) return false; + if(other is not CoverageEligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.ListEquals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "purpose": - value = PurposeElement; - return PurposeElement?.Any() == true; + value = _PurposeElement; + return _PurposeElement?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "purpose": - PurposeElement = (List>)value; + PurposeElement = (List>?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1442,21 +1403,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",PurposeElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs index a3602e6f2..1712a4136 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -150,13 +153,13 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [Binding("DatesType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Occurance date or period. @@ -166,26 +169,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -197,41 +196,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(When, otherT.When)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -242,8 +241,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (When is not null) yield return new KeyValuePair("when",When); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_When is not null) yield return new KeyValuePair("when",_When); } } @@ -273,26 +272,26 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Coverage inforce indicator. /// [FhirElement("inforce", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InforceElement + public Hl7.Fhir.Model.FhirBoolean? InforceElement { get { return _InforceElement; } set { _InforceElement = value; OnPropertyChanged("InforceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InforceElement; + private Hl7.Fhir.Model.FhirBoolean? _InforceElement; /// /// Coverage inforce indicator @@ -301,13 +300,10 @@ public Hl7.Fhir.Model.FhirBoolean InforceElement [IgnoreDataMember] public bool? Inforce { - get { return InforceElement != null ? InforceElement.Value : null; } + get => _InforceElement?.Value; set { - if (value == null) - InforceElement = null; - else - InforceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InforceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inforce"); } } @@ -317,13 +313,13 @@ public bool? Inforce /// [FhirElement("benefitPeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period BenefitPeriod + public Hl7.Fhir.Model.Period? BenefitPeriod { get { return _BenefitPeriod; } set { _BenefitPeriod = value; OnPropertyChanged("BenefitPeriod"); } } - private Hl7.Fhir.Model.Period _BenefitPeriod; + private Hl7.Fhir.Model.Period? _BenefitPeriod; /// /// Benefits and authorization details. @@ -333,26 +329,22 @@ public Hl7.Fhir.Model.Period BenefitPeriod [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(InforceElement != null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)InforceElement.DeepCopyInternal(); - if(BenefitPeriod != null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)BenefitPeriod.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_InforceElement is not null) dest.InforceElement = (Hl7.Fhir.Model.FhirBoolean)_InforceElement.DeepCopyInternal(); + if(_BenefitPeriod is not null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)_BenefitPeriod.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -364,55 +356,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.Equals(InforceElement, otherT.InforceElement)) return false; - if(!comparer.Equals(BenefitPeriod, otherT.BenefitPeriod)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.Equals(_InforceElement, otherT._InforceElement)) return false; + if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "inforce": - value = InforceElement; - return InforceElement is not null; + value = _InforceElement; + return _InforceElement is not null; case "benefitPeriod": - value = BenefitPeriod; - return BenefitPeriod is not null; + value = _BenefitPeriod; + return _BenefitPeriod is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "inforce": - InforceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InforceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "benefitPeriod": - BenefitPeriod = (Hl7.Fhir.Model.Period)value; + BenefitPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -423,10 +415,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (InforceElement is not null) yield return new KeyValuePair("inforce",InforceElement); - if (BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",BenefitPeriod); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_InforceElement is not null) yield return new KeyValuePair("inforce",_InforceElement); + if (_BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",_BenefitPeriod); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -453,13 +445,13 @@ public partial class ItemsComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -467,13 +459,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=50)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// Product or service billing modifiers. @@ -484,11 +476,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Performing practitioner. @@ -497,26 +489,26 @@ public List Modifier [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -525,13 +517,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -541,28 +530,25 @@ public bool? Excluded /// [FhirElement("name", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -572,28 +558,25 @@ public string Name /// [FhirElement("description", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -604,13 +587,13 @@ public string Description [FhirElement("network", Order=110)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -618,13 +601,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=120)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -632,13 +615,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=130)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -648,24 +631,24 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; /// /// Authorization required flag. /// [FhirElement("authorizationRequired", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AuthorizationRequiredElement + public Hl7.Fhir.Model.FhirBoolean? AuthorizationRequiredElement { get { return _AuthorizationRequiredElement; } set { _AuthorizationRequiredElement = value; OnPropertyChanged("AuthorizationRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AuthorizationRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _AuthorizationRequiredElement; /// /// Authorization required flag @@ -674,13 +657,10 @@ public Hl7.Fhir.Model.FhirBoolean AuthorizationRequiredElement [IgnoreDataMember] public bool? AuthorizationRequired { - get { return AuthorizationRequiredElement != null ? AuthorizationRequiredElement.Value : null; } + get => _AuthorizationRequiredElement?.Value; set { - if (value == null) - AuthorizationRequiredElement = null; - else - AuthorizationRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + AuthorizationRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AuthorizationRequired"); } } @@ -694,67 +674,60 @@ public bool? AuthorizationRequired [DataMember] public List AuthorizationSupporting { - get { if(_AuthorizationSupporting==null) _AuthorizationSupporting = new List(); return _AuthorizationSupporting; } + get => _AuthorizationSupporting ?? new List(); set { _AuthorizationSupporting = value; OnPropertyChanged("AuthorizationSupporting"); } } - private List _AuthorizationSupporting; + private List? _AuthorizationSupporting; /// /// Preauthorization requirements endpoint. /// [FhirElement("authorizationUrl", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirUri AuthorizationUrlElement + public Hl7.Fhir.Model.FhirUri? AuthorizationUrlElement { get { return _AuthorizationUrlElement; } set { _AuthorizationUrlElement = value; OnPropertyChanged("AuthorizationUrlElement"); } } - private Hl7.Fhir.Model.FhirUri _AuthorizationUrlElement; + private Hl7.Fhir.Model.FhirUri? _AuthorizationUrlElement; /// /// Preauthorization requirements endpoint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthorizationUrl + public string? AuthorizationUrl { - get { return AuthorizationUrlElement != null ? AuthorizationUrlElement.Value : null; } + get => _AuthorizationUrlElement?.Value; set { - if (value == null) - AuthorizationUrlElement = null; - else - AuthorizationUrlElement = new Hl7.Fhir.Model.FhirUri(value); + AuthorizationUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("AuthorizationUrl"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ItemsComponent; - - if (dest == null) - { + if(other is not ItemsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); - if(AuthorizationRequiredElement != null) dest.AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)AuthorizationRequiredElement.DeepCopyInternal(); - if(AuthorizationSupporting.Any()) dest.AuthorizationSupporting = new List(AuthorizationSupporting.DeepCopyInternal()); - if(AuthorizationUrlElement != null) dest.AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)AuthorizationUrlElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); + if(_AuthorizationRequiredElement is not null) dest.AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_AuthorizationRequiredElement.DeepCopyInternal(); + if(_AuthorizationSupporting is not null) dest.AuthorizationSupporting = new List(_AuthorizationSupporting.DeepCopyInternal()); + if(_AuthorizationUrlElement is not null) dest.AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)_AuthorizationUrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -766,125 +739,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemsComponent; - if(otherT == null) return false; + if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; - if(!comparer.Equals(AuthorizationRequiredElement, otherT.AuthorizationRequiredElement)) return false; - if(!comparer.ListEquals(AuthorizationSupporting, otherT.AuthorizationSupporting)) return false; - if(!comparer.Equals(AuthorizationUrlElement, otherT.AuthorizationUrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; + if(!comparer.Equals(_AuthorizationRequiredElement, otherT._AuthorizationRequiredElement)) return false; + if(!comparer.ListEquals(_AuthorizationSupporting, otherT._AuthorizationSupporting)) return false; + if(!comparer.Equals(_AuthorizationUrlElement, otherT._AuthorizationUrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; case "authorizationRequired": - value = AuthorizationRequiredElement; - return AuthorizationRequiredElement is not null; + value = _AuthorizationRequiredElement; + return _AuthorizationRequiredElement is not null; case "authorizationSupporting": - value = AuthorizationSupporting; - return AuthorizationSupporting?.Any() == true; + value = _AuthorizationSupporting; + return _AuthorizationSupporting?.Any() == true; case "authorizationUrl": - value = AuthorizationUrlElement; - return AuthorizationUrlElement is not null; + value = _AuthorizationUrlElement; + return _AuthorizationUrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; case "authorizationRequired": - AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + AuthorizationRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "authorizationSupporting": - AuthorizationSupporting = (List)value; + AuthorizationSupporting = (List?)value!; return this; case "authorizationUrl": - AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri)value; + AuthorizationUrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -895,20 +868,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); - if (AuthorizationRequiredElement is not null) yield return new KeyValuePair("authorizationRequired",AuthorizationRequiredElement); - if (AuthorizationSupporting?.Any() == true) yield return new KeyValuePair("authorizationSupporting",AuthorizationSupporting); - if (AuthorizationUrlElement is not null) yield return new KeyValuePair("authorizationUrl",AuthorizationUrlElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); + if (_AuthorizationRequiredElement is not null) yield return new KeyValuePair("authorizationRequired",_AuthorizationRequiredElement); + if (_AuthorizationSupporting?.Any() == true) yield return new KeyValuePair("authorizationSupporting",_AuthorizationSupporting); + if (_AuthorizationUrlElement is not null) yield return new KeyValuePair("authorizationUrl",_AuthorizationUrlElement); } } @@ -936,13 +909,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -951,13 +924,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -966,27 +939,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -998,48 +967,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1050,9 +1019,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -1080,13 +1049,13 @@ public partial class ErrorsComponent : Hl7.Fhir.Model.BackboneElement [Binding("AdjudicationError")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// FHIRPath of element(s) related to issue. @@ -1096,24 +1065,24 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List ExpressionElement { - get { if(_ExpressionElement==null) _ExpressionElement = new List(); return _ExpressionElement; } + get => _ExpressionElement ?? new List(); set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private List _ExpressionElement; + private List? _ExpressionElement; /// /// FHIRPath of element(s) related to issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Expression + public IEnumerable? Expression { - get { return ExpressionElement != null ? ExpressionElement.Select(elem => elem.Value) : null; } + get => _ExpressionElement?.Select(elem => elem.Value); set { if (value == null) - ExpressionElement = null; + ExpressionElement = null!; else ExpressionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Expression"); @@ -1122,16 +1091,12 @@ public IEnumerable Expression protected internal override void CopyToInternal(Base other) { - var dest = other as ErrorsComponent; - - if (dest == null) - { + if(other is not ErrorsComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ExpressionElement.Any()) dest.ExpressionElement = new List(ExpressionElement.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = new List(_ExpressionElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1143,41 +1108,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ErrorsComponent; - if(otherT == null) return false; + if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "expression": - value = ExpressionElement; - return ExpressionElement?.Any() == true; + value = _ExpressionElement; + return _ExpressionElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "expression": - ExpressionElement = (List)value; + ExpressionElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1188,8 +1153,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",ExpressionElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ExpressionElement?.Any() == true) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -1202,11 +1167,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -1216,13 +1181,13 @@ public List Identifier [Binding("EligibilityResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -1231,13 +1196,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1252,24 +1214,24 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [DataMember] public List> PurposeElement { - get { if(_PurposeElement==null) _PurposeElement = new List>(); return _PurposeElement; } + get => _PurposeElement ?? new List>(); set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private List> _PurposeElement; + private List>? _PurposeElement; /// /// auth-requirements | benefits | discovery | validation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Purpose + public IEnumerable? Purpose { - get { return PurposeElement != null ? PurposeElement.Select(elem => elem.Value) : null; } + get => _PurposeElement?.Select(elem => elem.Value); set { if (value == null) - PurposeElement = null; + PurposeElement = null!; else PurposeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Purpose"); @@ -1284,13 +1246,13 @@ public IEnumerable /// Event information. @@ -1300,11 +1262,11 @@ public Hl7.Fhir.Model.ResourceReference Patient [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Estimated date or dates of service. @@ -1313,13 +1275,13 @@ public List Event [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Response creation date. @@ -1327,28 +1289,25 @@ public Hl7.Fhir.Model.DataType Serviced [FhirElement("created", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -1360,13 +1319,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// Eligibility request reference. @@ -1376,13 +1335,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [References("CoverageEligibilityRequest")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -1392,13 +1351,13 @@ public Hl7.Fhir.Model.ResourceReference Request [Binding("EligibilityOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -1407,13 +1366,10 @@ public Code Outco [IgnoreDataMember] public Hl7.Fhir.Model.CoverageEligibilityResponse.EligibilityOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -1423,28 +1379,25 @@ public Hl7.Fhir.Model.CoverageEligibilityResponse.EligibilityOutcome? Outcome /// [FhirElement("disposition", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -1457,13 +1410,13 @@ public string Disposition [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Patient insurance information. @@ -1473,39 +1426,36 @@ public Hl7.Fhir.Model.ResourceReference Insurer [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Preauthorization reference. /// [FhirElement("preAuthRef", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -1516,13 +1466,13 @@ public string PreAuthRef [FhirElement("form", Order=230)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Processing errors. @@ -1532,40 +1482,36 @@ public Hl7.Fhir.Model.CodeableConcept Form [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageEligibilityResponse; - - if (dest == null) - { + if(other is not CoverageEligibilityResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PurposeElement.Any()) dest.PurposeElement = new List>(PurposeElement.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PurposeElement is not null) dest.PurposeElement = new List>(_PurposeElement.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1577,139 +1523,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageEligibilityResponse; - if(otherT == null) return false; + if(other is not CoverageEligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "purpose": - value = PurposeElement; - return PurposeElement?.Any() == true; + value = _PurposeElement; + return _PurposeElement?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "purpose": - PurposeElement = (List>)value; + PurposeElement = (List>?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1720,22 +1666,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",PurposeElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PurposeElement?.Any() == true) yield return new KeyValuePair("purpose",_PurposeElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs index 2f4a2f97f..42c6430a1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -154,28 +157,25 @@ public partial class CodeFilterComponent : Hl7.Fhir.Model.Element /// [FhirElement("path", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// A code-valued attribute to filter on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -185,28 +185,25 @@ public string Path /// [FhirElement("searchParam", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SearchParamElement + public Hl7.Fhir.Model.FhirString? SearchParamElement { get { return _SearchParamElement; } set { _SearchParamElement = value; OnPropertyChanged("SearchParamElement"); } } - private Hl7.Fhir.Model.FhirString _SearchParamElement; + private Hl7.Fhir.Model.FhirString? _SearchParamElement; /// /// A coded (token) parameter to search on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SearchParam + public string? SearchParam { - get { return SearchParamElement != null ? SearchParamElement.Value : null; } + get => _SearchParamElement?.Value; set { - if (value == null) - SearchParamElement = null; - else - SearchParamElement = new Hl7.Fhir.Model.FhirString(value); + SearchParamElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SearchParam"); } } @@ -216,28 +213,25 @@ public string SearchParam /// [FhirElement("valueSet", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// ValueSet for the filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } @@ -250,26 +244,22 @@ public string ValueSet [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as CodeFilterComponent; - - if (dest == null) - { + if(other is not CodeFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SearchParamElement != null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)SearchParamElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SearchParamElement is not null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)_SearchParamElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -281,55 +271,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeFilterComponent; - if(otherT == null) return false; + if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SearchParamElement, otherT.SearchParamElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "searchParam": - value = SearchParamElement; - return SearchParamElement is not null; + value = _SearchParamElement; + return _SearchParamElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "searchParam": - SearchParamElement = (Hl7.Fhir.Model.FhirString)value; + SearchParamElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; default: return base.SetValue(key, value); @@ -340,10 +330,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SearchParamElement is not null) yield return new KeyValuePair("searchParam",SearchParamElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SearchParamElement is not null) yield return new KeyValuePair("searchParam",_SearchParamElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); } } @@ -369,28 +359,25 @@ public partial class DateFilterComponent : Hl7.Fhir.Model.Element /// [FhirElement("path", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// A date-valued attribute to filter on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -400,28 +387,25 @@ public string Path /// [FhirElement("searchParam", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SearchParamElement + public Hl7.Fhir.Model.FhirString? SearchParamElement { get { return _SearchParamElement; } set { _SearchParamElement = value; OnPropertyChanged("SearchParamElement"); } } - private Hl7.Fhir.Model.FhirString _SearchParamElement; + private Hl7.Fhir.Model.FhirString? _SearchParamElement; /// /// A date valued parameter to search on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SearchParam + public string? SearchParam { - get { return SearchParamElement != null ? SearchParamElement.Value : null; } + get => _SearchParamElement?.Value; set { - if (value == null) - SearchParamElement = null; - else - SearchParamElement = new Hl7.Fhir.Model.FhirString(value); + SearchParamElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SearchParam"); } } @@ -433,27 +417,23 @@ public string SearchParam [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DateFilterComponent; - - if (dest == null) - { + if(other is not DateFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SearchParamElement != null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)SearchParamElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SearchParamElement is not null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)_SearchParamElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -465,48 +445,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateFilterComponent; - if(otherT == null) return false; + if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SearchParamElement, otherT.SearchParamElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "searchParam": - value = SearchParamElement; - return SearchParamElement is not null; + value = _SearchParamElement; + return _SearchParamElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "searchParam": - SearchParamElement = (Hl7.Fhir.Model.FhirString)value; + SearchParamElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -517,9 +497,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SearchParamElement is not null) yield return new KeyValuePair("searchParam",SearchParamElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SearchParamElement is not null) yield return new KeyValuePair("searchParam",_SearchParamElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -545,28 +525,25 @@ public partial class ValueFilterComponent : Hl7.Fhir.Model.Element /// [FhirElement("path", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// An attribute to filter on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -576,28 +553,25 @@ public string Path /// [FhirElement("searchParam", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SearchParamElement + public Hl7.Fhir.Model.FhirString? SearchParamElement { get { return _SearchParamElement; } set { _SearchParamElement = value; OnPropertyChanged("SearchParamElement"); } } - private Hl7.Fhir.Model.FhirString _SearchParamElement; + private Hl7.Fhir.Model.FhirString? _SearchParamElement; /// /// A parameter to search on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SearchParam + public string? SearchParam { - get { return SearchParamElement != null ? SearchParamElement.Value : null; } + get => _SearchParamElement?.Value; set { - if (value == null) - SearchParamElement = null; - else - SearchParamElement = new Hl7.Fhir.Model.FhirString(value); + SearchParamElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SearchParam"); } } @@ -609,13 +583,13 @@ public string SearchParam [DeclaredType(Type = typeof(Code))] [Binding("ValueFilterComparator")] [DataMember] - public Code ComparatorElement + public Code? ComparatorElement { get { return _ComparatorElement; } set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private Code _ComparatorElement; + private Code? _ComparatorElement; /// /// eq | gt | lt | ge | le | sa | eb @@ -624,13 +598,10 @@ public Code ComparatorElem [IgnoreDataMember] public Hl7.Fhir.Model.DataRequirement.ValueFilterComparator? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Value : null; } + get => _ComparatorElement?.Value; set { - if (value == null) - ComparatorElement = null; - else - ComparatorElement = new Code(value); + ComparatorElement = value is null ? null : new Code(value); OnPropertyChanged("Comparator"); } } @@ -642,28 +613,24 @@ public Hl7.Fhir.Model.DataRequirement.ValueFilterComparator? Comparator [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ValueFilterComponent; - - if (dest == null) - { + if(other is not ValueFilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SearchParamElement != null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)SearchParamElement.DeepCopyInternal(); - if(ComparatorElement != null) dest.ComparatorElement = (Code)ComparatorElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SearchParamElement is not null) dest.SearchParamElement = (Hl7.Fhir.Model.FhirString)_SearchParamElement.DeepCopyInternal(); + if(_ComparatorElement is not null) dest.ComparatorElement = (Code)_ComparatorElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -675,55 +642,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValueFilterComponent; - if(otherT == null) return false; + if(other is not ValueFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SearchParamElement, otherT.SearchParamElement)) return false; - if(!comparer.Equals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; + if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "searchParam": - value = SearchParamElement; - return SearchParamElement is not null; + value = _SearchParamElement; + return _SearchParamElement is not null; case "comparator": - value = ComparatorElement; - return ComparatorElement is not null; + value = _ComparatorElement; + return _ComparatorElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "searchParam": - SearchParamElement = (Hl7.Fhir.Model.FhirString)value; + SearchParamElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comparator": - ComparatorElement = (Code)value; + ComparatorElement = (Code?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -734,10 +701,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SearchParamElement is not null) yield return new KeyValuePair("searchParam",SearchParamElement); - if (ComparatorElement is not null) yield return new KeyValuePair("comparator",ComparatorElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SearchParamElement is not null) yield return new KeyValuePair("searchParam",_SearchParamElement); + if (_ComparatorElement is not null) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -765,28 +732,25 @@ public partial class SortComponent : Hl7.Fhir.Model.Element [FhirElement("path", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The name of the attribute to perform the sort /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -799,13 +763,13 @@ public string Path [Binding("SortDirection")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code DirectionElement + public Code? DirectionElement { get { return _DirectionElement; } set { _DirectionElement = value; OnPropertyChanged("DirectionElement"); } } - private Code _DirectionElement; + private Code? _DirectionElement; /// /// ascending | descending @@ -814,29 +778,22 @@ public Code DirectionElement [IgnoreDataMember] public Hl7.Fhir.Model.DataRequirement.SortDirection? Direction { - get { return DirectionElement != null ? DirectionElement.Value : null; } + get => _DirectionElement?.Value; set { - if (value == null) - DirectionElement = null; - else - DirectionElement = new Code(value); + DirectionElement = value is null ? null : new Code(value); OnPropertyChanged("Direction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SortComponent; - - if (dest == null) - { + if(other is not SortComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(DirectionElement != null) dest.DirectionElement = (Code)DirectionElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_DirectionElement is not null) dest.DirectionElement = (Code)_DirectionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -848,41 +805,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SortComponent; - if(otherT == null) return false; + if(other is not SortComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(DirectionElement, otherT.DirectionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "direction": - value = DirectionElement; - return DirectionElement is not null; + value = _DirectionElement; + return _DirectionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "direction": - DirectionElement = (Code)value; + DirectionElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -893,8 +850,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (DirectionElement is not null) yield return new KeyValuePair("direction",DirectionElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_DirectionElement is not null) yield return new KeyValuePair("direction",_DirectionElement); } } @@ -907,13 +864,13 @@ public override IEnumerable> EnumerateElements() [Binding("FHIRTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// The type of the required data @@ -922,13 +879,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -941,24 +895,24 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// The profile of the required data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -974,13 +928,13 @@ public IEnumerable Profile [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Indicates specific structure elements that are referenced by the knowledge module. @@ -990,24 +944,24 @@ public Hl7.Fhir.Model.DataType Subject [DataMember] public List MustSupportElement { - get { if(_MustSupportElement==null) _MustSupportElement = new List(); return _MustSupportElement; } + get => _MustSupportElement ?? new List(); set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } - private List _MustSupportElement; + private List? _MustSupportElement; /// /// Indicates specific structure elements that are referenced by the knowledge module /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable MustSupport + public IEnumerable? MustSupport { - get { return MustSupportElement != null ? MustSupportElement.Select(elem => elem.Value) : null; } + get => _MustSupportElement?.Select(elem => elem.Value); set { if (value == null) - MustSupportElement = null; + MustSupportElement = null!; else MustSupportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("MustSupport"); @@ -1022,11 +976,11 @@ public IEnumerable MustSupport [DataMember] public List CodeFilter { - get { if(_CodeFilter==null) _CodeFilter = new List(); return _CodeFilter; } + get => _CodeFilter ?? new List(); set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } - private List _CodeFilter; + private List? _CodeFilter; /// /// What dates/date ranges are expected. @@ -1036,11 +990,11 @@ public List CodeFilter [DataMember] public List DateFilter { - get { if(_DateFilter==null) _DateFilter = new List(); return _DateFilter; } + get => _DateFilter ?? new List(); set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } - private List _DateFilter; + private List? _DateFilter; /// /// What values are expected. @@ -1050,24 +1004,24 @@ public List DateFilter [DataMember] public List ValueFilter { - get { if(_ValueFilter==null) _ValueFilter = new List(); return _ValueFilter; } + get => _ValueFilter ?? new List(); set { _ValueFilter = value; OnPropertyChanged("ValueFilter"); } } - private List _ValueFilter; + private List? _ValueFilter; /// /// Number of results. /// [FhirElement("limit", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.PositiveInt LimitElement + public Hl7.Fhir.Model.PositiveInt? LimitElement { get { return _LimitElement; } set { _LimitElement = value; OnPropertyChanged("LimitElement"); } } - private Hl7.Fhir.Model.PositiveInt _LimitElement; + private Hl7.Fhir.Model.PositiveInt? _LimitElement; /// /// Number of results @@ -1076,13 +1030,10 @@ public Hl7.Fhir.Model.PositiveInt LimitElement [IgnoreDataMember] public int? Limit { - get { return LimitElement != null ? LimitElement.Value : null; } + get => _LimitElement?.Value; set { - if (value == null) - LimitElement = null; - else - LimitElement = new Hl7.Fhir.Model.PositiveInt(value); + LimitElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Limit"); } } @@ -1095,31 +1046,27 @@ public int? Limit [DataMember] public List Sort { - get { if(_Sort==null) _Sort = new List(); return _Sort; } + get => _Sort ?? new List(); set { _Sort = value; OnPropertyChanged("Sort"); } } - private List _Sort; + private List? _Sort; protected internal override void CopyToInternal(Base other) { - var dest = other as DataRequirement; - - if (dest == null) - { + if(other is not DataRequirement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(MustSupportElement.Any()) dest.MustSupportElement = new List(MustSupportElement.DeepCopyInternal()); - if(CodeFilter.Any()) dest.CodeFilter = new List(CodeFilter.DeepCopyInternal()); - if(DateFilter.Any()) dest.DateFilter = new List(DateFilter.DeepCopyInternal()); - if(ValueFilter.Any()) dest.ValueFilter = new List(ValueFilter.DeepCopyInternal()); - if(LimitElement != null) dest.LimitElement = (Hl7.Fhir.Model.PositiveInt)LimitElement.DeepCopyInternal(); - if(Sort.Any()) dest.Sort = new List(Sort.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_MustSupportElement is not null) dest.MustSupportElement = new List(_MustSupportElement.DeepCopyInternal()); + if(_CodeFilter is not null) dest.CodeFilter = new List(_CodeFilter.DeepCopyInternal()); + if(_DateFilter is not null) dest.DateFilter = new List(_DateFilter.DeepCopyInternal()); + if(_ValueFilter is not null) dest.ValueFilter = new List(_ValueFilter.DeepCopyInternal()); + if(_LimitElement is not null) dest.LimitElement = (Hl7.Fhir.Model.PositiveInt)_LimitElement.DeepCopyInternal(); + if(_Sort is not null) dest.Sort = new List(_Sort.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1131,90 +1078,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataRequirement; - if(otherT == null) return false; + if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(MustSupportElement, otherT.MustSupportElement)) return false; - if(!comparer.ListEquals(CodeFilter, otherT.CodeFilter)) return false; - if(!comparer.ListEquals(DateFilter, otherT.DateFilter)) return false; - if(!comparer.ListEquals(ValueFilter, otherT.ValueFilter)) return false; - if(!comparer.Equals(LimitElement, otherT.LimitElement)) return false; - if(!comparer.ListEquals(Sort, otherT.Sort)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; + if(!comparer.ListEquals(_CodeFilter, otherT._CodeFilter)) return false; + if(!comparer.ListEquals(_DateFilter, otherT._DateFilter)) return false; + if(!comparer.ListEquals(_ValueFilter, otherT._ValueFilter)) return false; + if(!comparer.Equals(_LimitElement, otherT._LimitElement)) return false; + if(!comparer.ListEquals(_Sort, otherT._Sort)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "mustSupport": - value = MustSupportElement; - return MustSupportElement?.Any() == true; + value = _MustSupportElement; + return _MustSupportElement?.Any() == true; case "codeFilter": - value = CodeFilter; - return CodeFilter?.Any() == true; + value = _CodeFilter; + return _CodeFilter?.Any() == true; case "dateFilter": - value = DateFilter; - return DateFilter?.Any() == true; + value = _DateFilter; + return _DateFilter?.Any() == true; case "valueFilter": - value = ValueFilter; - return ValueFilter?.Any() == true; + value = _ValueFilter; + return _ValueFilter?.Any() == true; case "limit": - value = LimitElement; - return LimitElement is not null; + value = _LimitElement; + return _LimitElement is not null; case "sort": - value = Sort; - return Sort?.Any() == true; + value = _Sort; + return _Sort?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "mustSupport": - MustSupportElement = (List)value; + MustSupportElement = (List?)value!; return this; case "codeFilter": - CodeFilter = (List)value; + CodeFilter = (List?)value!; return this; case "dateFilter": - DateFilter = (List)value; + DateFilter = (List?)value!; return this; case "valueFilter": - ValueFilter = (List)value; + ValueFilter = (List?)value!; return this; case "limit": - LimitElement = (Hl7.Fhir.Model.PositiveInt)value; + LimitElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "sort": - Sort = (List)value; + Sort = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1225,15 +1172,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",MustSupportElement); - if (CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",CodeFilter); - if (DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",DateFilter); - if (ValueFilter?.Any() == true) yield return new KeyValuePair("valueFilter",ValueFilter); - if (LimitElement is not null) yield return new KeyValuePair("limit",LimitElement); - if (Sort?.Any() == true) yield return new KeyValuePair("sort",Sort); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_MustSupportElement?.Any() == true) yield return new KeyValuePair("mustSupport",_MustSupportElement); + if (_CodeFilter?.Any() == true) yield return new KeyValuePair("codeFilter",_CodeFilter); + if (_DateFilter?.Any() == true) yield return new KeyValuePair("dateFilter",_DateFilter); + if (_ValueFilter?.Any() == true) yield return new KeyValuePair("valueFilter",_ValueFilter); + if (_LimitElement is not null) yield return new KeyValuePair("limit",_LimitElement); + if (_Sort?.Any() == true) yield return new KeyValuePair("sort",_Sort); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs index 76554295b..f6c8f2824 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -146,11 +149,11 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting information. @@ -162,24 +165,20 @@ public List Code [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceComponent; - - if (dest == null) - { + if(other is not EvidenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -191,41 +190,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceComponent; - if(otherT == null) return false; + if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (List)value; + Code = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -236,8 +235,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -265,41 +264,38 @@ public partial class MitigationComponent : Hl7.Fhir.Model.BackboneElement [Binding("DetectedIssueMitigationAction")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Date committed. /// [FhirElement("date", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date committed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -311,13 +307,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Additional notes about the mitigation. @@ -327,26 +323,22 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as MitigationComponent; - - if (dest == null) - { + if(other is not MitigationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -358,55 +350,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MitigationComponent; - if(otherT == null) return false; + if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -417,10 +409,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -433,11 +425,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// preliminary | final | entered-in-error | mitigated. @@ -447,13 +439,13 @@ public List Identifier [Binding("DetectedIssueStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preliminary | final | entered-in-error | mitigated @@ -462,13 +454,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DetectedIssue.DetectedIssueStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -482,11 +471,11 @@ public Hl7.Fhir.Model.DetectedIssue.DetectedIssueStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Specific type of detected issue, e.g. drug-drug, duplicate therapy, etc. @@ -494,13 +483,13 @@ public List Category [FhirElement("code", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Binding("DetectedIssueCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// high | moderate | low. @@ -509,13 +498,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("DetectedIssueSeverity")] [DataMember] - public Code SeverityElement + public Code? SeverityElement { get { return _SeverityElement; } set { _SeverityElement = value; OnPropertyChanged("SeverityElement"); } } - private Code _SeverityElement; + private Code? _SeverityElement; /// /// high | moderate | low @@ -524,13 +513,10 @@ public Code SeverityElement [IgnoreDataMember] public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity { - get { return SeverityElement != null ? SeverityElement.Value : null; } + get => _SeverityElement?.Value; set { - if (value == null) - SeverityElement = null; - else - SeverityElement = new Code(value); + SeverityElement = value is null ? null : new Code(value); OnPropertyChanged("Severity"); } } @@ -542,13 +528,13 @@ public Hl7.Fhir.Model.DetectedIssue.DetectedIssueSeverity? Severity [CLSCompliant(false)] [References("Patient","Group","Device","Location","Organization","Procedure","Practitioner","Medication","Substance","BiologicallyDerivedProduct","NutritionProduct")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter detected issue is part of. @@ -557,13 +543,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When identified. @@ -572,13 +558,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Identified + public Hl7.Fhir.Model.DataType? Identified { get { return _Identified; } set { _Identified = value; OnPropertyChanged("Identified"); } } - private Hl7.Fhir.Model.DataType _Identified; + private Hl7.Fhir.Model.DataType? _Identified; /// /// The provider or device that identified the issue. @@ -587,13 +573,13 @@ public Hl7.Fhir.Model.DataType Identified [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Problem resource. @@ -605,11 +591,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Implicated { - get { if(_Implicated==null) _Implicated = new List(); return _Implicated; } + get => _Implicated ?? new List(); set { _Implicated = value; OnPropertyChanged("Implicated"); } } - private List _Implicated; + private List? _Implicated; /// /// Supporting evidence. @@ -619,39 +605,36 @@ public List Implicated [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; /// /// Description and context. /// [FhirElement("detail", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DetailElement + public Hl7.Fhir.Model.Markdown? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.Markdown _DetailElement; + private Hl7.Fhir.Model.Markdown? _DetailElement; /// /// Description and context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.Markdown(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Detail"); } } @@ -661,28 +644,25 @@ public string Detail /// [FhirElement("reference", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Authority for issue /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } @@ -695,38 +675,34 @@ public string Reference [DataMember] public List Mitigation { - get { if(_Mitigation==null) _Mitigation = new List(); return _Mitigation; } + get => _Mitigation ?? new List(); set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } - private List _Mitigation; + private List? _Mitigation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DetectedIssue; - - if (dest == null) - { + if(other is not DetectedIssue dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(SeverityElement != null) dest.SeverityElement = (Code)SeverityElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Identified != null) dest.Identified = (Hl7.Fhir.Model.DataType)Identified.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Implicated.Any()) dest.Implicated = new List(Implicated.DeepCopyInternal()); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.Markdown)DetailElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); - if(Mitigation.Any()) dest.Mitigation = new List(Mitigation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_SeverityElement is not null) dest.SeverityElement = (Code)_SeverityElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Identified is not null) dest.Identified = (Hl7.Fhir.Model.DataType)_Identified.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Implicated is not null) dest.Implicated = new List(_Implicated.DeepCopyInternal()); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.Markdown)_DetailElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); + if(_Mitigation is not null) dest.Mitigation = new List(_Mitigation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -738,125 +714,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetectedIssue; - if(otherT == null) return false; + if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(SeverityElement, otherT.SeverityElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Identified, otherT.Identified)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Implicated, otherT.Implicated)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(Mitigation, otherT.Mitigation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Identified, otherT._Identified)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Implicated, otherT._Implicated)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "severity": - value = SeverityElement; - return SeverityElement is not null; + value = _SeverityElement; + return _SeverityElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "identified": - value = Identified; - return Identified is not null; + value = _Identified; + return _Identified is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "implicated": - value = Implicated; - return Implicated?.Any() == true; + value = _Implicated; + return _Implicated?.Any() == true; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "mitigation": - value = Mitigation; - return Mitigation?.Any() == true; + value = _Mitigation; + return _Mitigation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "severity": - SeverityElement = (Code)value; + SeverityElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "identified": - Identified = (Hl7.Fhir.Model.DataType)value; + Identified = (Hl7.Fhir.Model.DataType?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "implicated": - Implicated = (List)value; + Implicated = (List?)value!; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.Markdown)value; + DetailElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "mitigation": - Mitigation = (List)value; + Mitigation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -867,20 +843,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (SeverityElement is not null) yield return new KeyValuePair("severity",SeverityElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Identified is not null) yield return new KeyValuePair("identified",Identified); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Implicated?.Any() == true) yield return new KeyValuePair("implicated",Implicated); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",Mitigation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_SeverityElement is not null) yield return new KeyValuePair("severity",_SeverityElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Identified is not null) yield return new KeyValuePair("identified",_Identified); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Implicated?.Any() == true) yield return new KeyValuePair("implicated",_Implicated); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_Mitigation?.Any() == true) yield return new KeyValuePair("mitigation",_Mitigation); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Device.cs b/src/Hl7.Fhir.R5/Model/Generated/Device.cs index 3850c54f9..d21f0a898 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Device.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -162,28 +165,25 @@ public partial class UdiCarrierComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("deviceIdentifier", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// Mandatory fixed portion of UDI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -194,28 +194,25 @@ public string DeviceIdentifier [FhirElement("issuer", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// UDI Issuing Organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -225,28 +222,25 @@ public string Issuer /// [FhirElement("jurisdiction", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// Regional UDI authority /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } @@ -256,28 +250,25 @@ public string Jurisdiction /// [FhirElement("carrierAIDC", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Base64Binary CarrierAIDCElement + public Hl7.Fhir.Model.Base64Binary? CarrierAIDCElement { get { return _CarrierAIDCElement; } set { _CarrierAIDCElement = value; OnPropertyChanged("CarrierAIDCElement"); } } - private Hl7.Fhir.Model.Base64Binary _CarrierAIDCElement; + private Hl7.Fhir.Model.Base64Binary? _CarrierAIDCElement; /// /// UDI Machine Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public byte[] CarrierAIDC + public byte[]? CarrierAIDC { - get { return CarrierAIDCElement != null ? CarrierAIDCElement.Value : null; } + get => _CarrierAIDCElement?.Value; set { - if (value == null) - CarrierAIDCElement = null; - else - CarrierAIDCElement = new Hl7.Fhir.Model.Base64Binary(value); + CarrierAIDCElement = value is null ? null : new Hl7.Fhir.Model.Base64Binary(value); OnPropertyChanged("CarrierAIDC"); } } @@ -287,28 +278,25 @@ public byte[] CarrierAIDC /// [FhirElement("carrierHRF", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CarrierHRFElement + public Hl7.Fhir.Model.FhirString? CarrierHRFElement { get { return _CarrierHRFElement; } set { _CarrierHRFElement = value; OnPropertyChanged("CarrierHRFElement"); } } - private Hl7.Fhir.Model.FhirString _CarrierHRFElement; + private Hl7.Fhir.Model.FhirString? _CarrierHRFElement; /// /// UDI Human Readable Barcode String /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CarrierHRF + public string? CarrierHRF { - get { return CarrierHRFElement != null ? CarrierHRFElement.Value : null; } + get => _CarrierHRFElement?.Value; set { - if (value == null) - CarrierHRFElement = null; - else - CarrierHRFElement = new Hl7.Fhir.Model.FhirString(value); + CarrierHRFElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CarrierHRF"); } } @@ -320,13 +308,13 @@ public string CarrierHRF [DeclaredType(Type = typeof(Code))] [Binding("UDIEntryType")] [DataMember] - public Code EntryTypeElement + public Code? EntryTypeElement { get { return _EntryTypeElement; } set { _EntryTypeElement = value; OnPropertyChanged("EntryTypeElement"); } } - private Code _EntryTypeElement; + private Code? _EntryTypeElement; /// /// barcode | rfid | manual | card | self-reported | electronic-transmission | unknown @@ -335,33 +323,26 @@ public Code EntryTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.UDIEntryType? EntryType { - get { return EntryTypeElement != null ? EntryTypeElement.Value : null; } + get => _EntryTypeElement?.Value; set { - if (value == null) - EntryTypeElement = null; - else - EntryTypeElement = new Code(value); + EntryTypeElement = value is null ? null : new Code(value); OnPropertyChanged("EntryType"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UdiCarrierComponent; - - if (dest == null) - { + if(other is not UdiCarrierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); - if(CarrierAIDCElement != null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)CarrierAIDCElement.DeepCopyInternal(); - if(CarrierHRFElement != null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)CarrierHRFElement.DeepCopyInternal(); - if(EntryTypeElement != null) dest.EntryTypeElement = (Code)EntryTypeElement.DeepCopyInternal(); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); + if(_CarrierAIDCElement is not null) dest.CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)_CarrierAIDCElement.DeepCopyInternal(); + if(_CarrierHRFElement is not null) dest.CarrierHRFElement = (Hl7.Fhir.Model.FhirString)_CarrierHRFElement.DeepCopyInternal(); + if(_EntryTypeElement is not null) dest.EntryTypeElement = (Code)_EntryTypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -373,69 +354,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiCarrierComponent; - if(otherT == null) return false; + if(other is not UdiCarrierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; - if(!comparer.Equals(CarrierAIDCElement, otherT.CarrierAIDCElement)) return false; - if(!comparer.Equals(CarrierHRFElement, otherT.CarrierHRFElement)) return false; - if(!comparer.Equals(EntryTypeElement, otherT.EntryTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; + if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; + if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; + if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; case "carrierAIDC": - value = CarrierAIDCElement; - return CarrierAIDCElement is not null; + value = _CarrierAIDCElement; + return _CarrierAIDCElement is not null; case "carrierHRF": - value = CarrierHRFElement; - return CarrierHRFElement is not null; + value = _CarrierHRFElement; + return _CarrierHRFElement is not null; case "entryType": - value = EntryTypeElement; - return EntryTypeElement is not null; + value = _EntryTypeElement; + return _EntryTypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "carrierAIDC": - CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary)value; + CarrierAIDCElement = (Hl7.Fhir.Model.Base64Binary?)value; return this; case "carrierHRF": - CarrierHRFElement = (Hl7.Fhir.Model.FhirString)value; + CarrierHRFElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "entryType": - EntryTypeElement = (Code)value; + EntryTypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -446,12 +427,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); - if (CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",CarrierAIDCElement); - if (CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",CarrierHRFElement); - if (EntryTypeElement is not null) yield return new KeyValuePair("entryType",EntryTypeElement); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); + if (_CarrierAIDCElement is not null) yield return new KeyValuePair("carrierAIDC",_CarrierAIDCElement); + if (_CarrierHRFElement is not null) yield return new KeyValuePair("carrierHRF",_CarrierHRFElement); + if (_EntryTypeElement is not null) yield return new KeyValuePair("entryType",_EntryTypeElement); } } @@ -478,28 +459,25 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("value", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The term that names the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -512,13 +490,13 @@ public string Value [Binding("DeviceNameType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// registered-name | user-friendly-name | patient-reported-name @@ -527,13 +505,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceNameType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -543,13 +518,13 @@ public Hl7.Fhir.Model.DeviceNameType? Type /// [FhirElement("display", InSummary=true, IsModifier=true, Order=60, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DisplayElement + public Hl7.Fhir.Model.FhirBoolean? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DisplayElement; + private Hl7.Fhir.Model.FhirBoolean? _DisplayElement; /// /// The preferred device name @@ -558,30 +533,23 @@ public Hl7.Fhir.Model.FhirBoolean DisplayElement [IgnoreDataMember] public bool? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirBoolean(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirBoolean)DisplayElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirBoolean)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -593,48 +561,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirBoolean)value; + DisplayElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -645,9 +613,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -671,54 +639,51 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("FHIRDeviceVersionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The hardware or software module of the device to which the version applies. /// [FhirElement("component", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Identifier Component + public Hl7.Fhir.Model.Identifier? Component { get { return _Component; } set { _Component = value; OnPropertyChanged("Component"); } } - private Hl7.Fhir.Model.Identifier _Component; + private Hl7.Fhir.Model.Identifier? _Component; /// /// The date the version was installed on the device. /// [FhirElement("installDate", Order=60, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime InstallDateElement + public Hl7.Fhir.Model.FhirDateTime? InstallDateElement { get { return _InstallDateElement; } set { _InstallDateElement = value; OnPropertyChanged("InstallDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _InstallDateElement; + private Hl7.Fhir.Model.FhirDateTime? _InstallDateElement; /// /// The date the version was installed on the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstallDate + public string? InstallDate { - get { return InstallDateElement != null ? InstallDateElement.Value : null; } + get => _InstallDateElement?.Value; set { - if (value == null) - InstallDateElement = null; - else - InstallDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + InstallDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("InstallDate"); } } @@ -729,46 +694,39 @@ public string InstallDate [FhirElement("value", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The version text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Component != null) dest.Component = (Hl7.Fhir.Model.Identifier)Component.DeepCopyInternal(); - if(InstallDateElement != null) dest.InstallDateElement = (Hl7.Fhir.Model.FhirDateTime)InstallDateElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Component is not null) dest.Component = (Hl7.Fhir.Model.Identifier)_Component.DeepCopyInternal(); + if(_InstallDateElement is not null) dest.InstallDateElement = (Hl7.Fhir.Model.FhirDateTime)_InstallDateElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -780,55 +738,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Component, otherT.Component)) return false; - if(!comparer.Equals(InstallDateElement, otherT.InstallDateElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Component, otherT._Component)) return false; + if(!comparer.Equals(_InstallDateElement, otherT._InstallDateElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "component": - value = Component; - return Component is not null; + value = _Component; + return _Component is not null; case "installDate": - value = InstallDateElement; - return InstallDateElement is not null; + value = _InstallDateElement; + return _InstallDateElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "component": - Component = (Hl7.Fhir.Model.Identifier)value; + Component = (Hl7.Fhir.Model.Identifier?)value; return this; case "installDate": - InstallDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + InstallDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -839,10 +797,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Component is not null) yield return new KeyValuePair("component",Component); - if (InstallDateElement is not null) yield return new KeyValuePair("installDate",InstallDateElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Component is not null) yield return new KeyValuePair("component",_Component); + if (_InstallDateElement is not null) yield return new KeyValuePair("installDate",_InstallDateElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -869,13 +827,13 @@ public partial class ConformsToComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("DeviceSpecificationCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Identifies the standard, specification, or formal guidance that the device adheres to. @@ -884,58 +842,51 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("DeviceSpecification-type")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Specification + public Hl7.Fhir.Model.CodeableConcept? Specification { get { return _Specification; } set { _Specification = value; OnPropertyChanged("Specification"); } } - private Hl7.Fhir.Model.CodeableConcept _Specification; + private Hl7.Fhir.Model.CodeableConcept? _Specification; /// /// Specific form or variant of the standard. /// [FhirElement("version", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Specific form or variant of the standard /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ConformsToComponent; - - if (dest == null) - { + if(other is not ConformsToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Specification != null) dest.Specification = (Hl7.Fhir.Model.CodeableConcept)Specification.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Specification is not null) dest.Specification = (Hl7.Fhir.Model.CodeableConcept)_Specification.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -947,48 +898,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConformsToComponent; - if(otherT == null) return false; + if(other is not ConformsToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Specification, otherT.Specification)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Specification, otherT._Specification)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "specification": - value = Specification; - return Specification is not null; + value = _Specification; + return _Specification is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specification": - Specification = (Hl7.Fhir.Model.CodeableConcept)value; + Specification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -999,9 +950,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Specification is not null) yield return new KeyValuePair("specification",Specification); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Specification is not null) yield return new KeyValuePair("specification",_Specification); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -1030,13 +981,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("DevicePropertyType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Value of the property. @@ -1046,26 +997,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Attachment))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1077,41 +1024,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1122,8 +1069,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1136,39 +1083,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The name used to display by default when the device is referenced. /// [FhirElement("displayName", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayNameElement + public Hl7.Fhir.Model.FhirString? DisplayNameElement { get { return _DisplayNameElement; } set { _DisplayNameElement = value; OnPropertyChanged("DisplayNameElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayNameElement; + private Hl7.Fhir.Model.FhirString? _DisplayNameElement; /// /// The name used to display by default when the device is referenced /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DisplayName + public string? DisplayName { - get { return DisplayNameElement != null ? DisplayNameElement.Value : null; } + get => _DisplayNameElement?.Value; set { - if (value == null) - DisplayNameElement = null; - else - DisplayNameElement = new Hl7.Fhir.Model.FhirString(value); + DisplayNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DisplayName"); } } @@ -1178,13 +1122,13 @@ public string DisplayName /// [FhirElement("definition", Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Definition + public Hl7.Fhir.Model.CodeableReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.CodeableReference _Definition; + private Hl7.Fhir.Model.CodeableReference? _Definition; /// /// Unique Device Identifier (UDI) Barcode string. @@ -1194,11 +1138,11 @@ public Hl7.Fhir.Model.CodeableReference Definition [DataMember] public List UdiCarrier { - get { if(_UdiCarrier==null) _UdiCarrier = new List(); return _UdiCarrier; } + get => _UdiCarrier ?? new List(); set { _UdiCarrier = value; OnPropertyChanged("UdiCarrier"); } } - private List _UdiCarrier; + private List? _UdiCarrier; /// /// active | inactive | entered-in-error. @@ -1207,13 +1151,13 @@ public List UdiCarrier [DeclaredType(Type = typeof(Code))] [Binding("FHIRDeviceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -1222,13 +1166,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1239,54 +1180,51 @@ public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status [FhirElement("availabilityStatus", Order=140, FiveWs="FiveWs.status")] [Binding("FHIRDeviceAvailabilityStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AvailabilityStatus + public Hl7.Fhir.Model.CodeableConcept? AvailabilityStatus { get { return _AvailabilityStatus; } set { _AvailabilityStatus = value; OnPropertyChanged("AvailabilityStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _AvailabilityStatus; + private Hl7.Fhir.Model.CodeableConcept? _AvailabilityStatus; /// /// An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled. /// [FhirElement("biologicalSourceEvent", Order=150, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Identifier BiologicalSourceEvent + public Hl7.Fhir.Model.Identifier? BiologicalSourceEvent { get { return _BiologicalSourceEvent; } set { _BiologicalSourceEvent = value; OnPropertyChanged("BiologicalSourceEvent"); } } - private Hl7.Fhir.Model.Identifier _BiologicalSourceEvent; + private Hl7.Fhir.Model.Identifier? _BiologicalSourceEvent; /// /// Name of device manufacturer. /// [FhirElement("manufacturer", Order=160, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ManufacturerElement + public Hl7.Fhir.Model.FhirString? ManufacturerElement { get { return _ManufacturerElement; } set { _ManufacturerElement = value; OnPropertyChanged("ManufacturerElement"); } } - private Hl7.Fhir.Model.FhirString _ManufacturerElement; + private Hl7.Fhir.Model.FhirString? _ManufacturerElement; /// /// Name of device manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Manufacturer + public string? Manufacturer { - get { return ManufacturerElement != null ? ManufacturerElement.Value : null; } + get => _ManufacturerElement?.Value; set { - if (value == null) - ManufacturerElement = null; - else - ManufacturerElement = new Hl7.Fhir.Model.FhirString(value); + ManufacturerElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Manufacturer"); } } @@ -1296,28 +1234,25 @@ public string Manufacturer /// [FhirElement("manufactureDate", Order=170, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ManufactureDateElement + public Hl7.Fhir.Model.FhirDateTime? ManufactureDateElement { get { return _ManufactureDateElement; } set { _ManufactureDateElement = value; OnPropertyChanged("ManufactureDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ManufactureDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ManufactureDateElement; /// /// Date when the device was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ManufactureDate + public string? ManufactureDate { - get { return ManufactureDateElement != null ? ManufactureDateElement.Value : null; } + get => _ManufactureDateElement?.Value; set { - if (value == null) - ManufactureDateElement = null; - else - ManufactureDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ManufactureDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ManufactureDate"); } } @@ -1327,28 +1262,25 @@ public string ManufactureDate /// [FhirElement("expirationDate", Order=180, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// Date and time of expiry of this device (if applicable) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } @@ -1358,28 +1290,25 @@ public string ExpirationDate /// [FhirElement("lotNumber", Order=190, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Lot number of manufacture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -1389,28 +1318,25 @@ public string LotNumber /// [FhirElement("serialNumber", Order=200, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString SerialNumberElement + public Hl7.Fhir.Model.FhirString? SerialNumberElement { get { return _SerialNumberElement; } set { _SerialNumberElement = value; OnPropertyChanged("SerialNumberElement"); } } - private Hl7.Fhir.Model.FhirString _SerialNumberElement; + private Hl7.Fhir.Model.FhirString? _SerialNumberElement; /// /// Serial number assigned by the manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SerialNumber + public string? SerialNumber { - get { return SerialNumberElement != null ? SerialNumberElement.Value : null; } + get => _SerialNumberElement?.Value; set { - if (value == null) - SerialNumberElement = null; - else - SerialNumberElement = new Hl7.Fhir.Model.FhirString(value); + SerialNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SerialNumber"); } } @@ -1423,39 +1349,36 @@ public string SerialNumber [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// The manufacturer's model number for the device. /// [FhirElement("modelNumber", Order=220, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ModelNumberElement + public Hl7.Fhir.Model.FhirString? ModelNumberElement { get { return _ModelNumberElement; } set { _ModelNumberElement = value; OnPropertyChanged("ModelNumberElement"); } } - private Hl7.Fhir.Model.FhirString _ModelNumberElement; + private Hl7.Fhir.Model.FhirString? _ModelNumberElement; /// /// The manufacturer's model number for the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ModelNumber + public string? ModelNumber { - get { return ModelNumberElement != null ? ModelNumberElement.Value : null; } + get => _ModelNumberElement?.Value; set { - if (value == null) - ModelNumberElement = null; - else - ModelNumberElement = new Hl7.Fhir.Model.FhirString(value); + ModelNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ModelNumber"); } } @@ -1465,28 +1388,25 @@ public string ModelNumber /// [FhirElement("partNumber", Order=230, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString PartNumberElement + public Hl7.Fhir.Model.FhirString? PartNumberElement { get { return _PartNumberElement; } set { _PartNumberElement = value; OnPropertyChanged("PartNumberElement"); } } - private Hl7.Fhir.Model.FhirString _PartNumberElement; + private Hl7.Fhir.Model.FhirString? _PartNumberElement; /// /// The part number or catalog number of the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PartNumber + public string? PartNumber { - get { return PartNumberElement != null ? PartNumberElement.Value : null; } + get => _PartNumberElement?.Value; set { - if (value == null) - PartNumberElement = null; - else - PartNumberElement = new Hl7.Fhir.Model.FhirString(value); + PartNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PartNumber"); } } @@ -1500,11 +1420,11 @@ public string PartNumber [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// The kind or type of device. @@ -1515,11 +1435,11 @@ public List Category [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// The actual design of the device or software version running on the device. @@ -1529,11 +1449,11 @@ public List Type [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. @@ -1543,11 +1463,11 @@ public List Version [DataMember] public List ConformsTo { - get { if(_ConformsTo==null) _ConformsTo = new List(); return _ConformsTo; } + get => _ConformsTo ?? new List(); set { _ConformsTo = value; OnPropertyChanged("ConformsTo"); } } - private List _ConformsTo; + private List? _ConformsTo; /// /// Inherent, essentially fixed, characteristics of the device. e.g., time properties, size, material, etc. @@ -1557,11 +1477,11 @@ public List ConformsTo [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// The designated condition for performing a task. @@ -1569,39 +1489,39 @@ public List Property [FhirElement("mode", Order=290)] [Binding("DeviceOperationMode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Mode + public Hl7.Fhir.Model.CodeableConcept? Mode { get { return _Mode; } set { _Mode = value; OnPropertyChanged("Mode"); } } - private Hl7.Fhir.Model.CodeableConcept _Mode; + private Hl7.Fhir.Model.CodeableConcept? _Mode; /// /// The series of occurrences that repeats during the operation of the device. /// [FhirElement("cycle", Order=300)] [DataMember] - public Hl7.Fhir.Model.Count Cycle + public Hl7.Fhir.Model.Count? Cycle { get { return _Cycle; } set { _Cycle = value; OnPropertyChanged("Cycle"); } } - private Hl7.Fhir.Model.Count _Cycle; + private Hl7.Fhir.Model.Count? _Cycle; /// /// A measurement of time during the device's operation (e.g., days, hours, mins, etc.). /// [FhirElement("duration", Order=310)] [DataMember] - public Hl7.Fhir.Model.Duration Duration + public Hl7.Fhir.Model.Duration? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Duration _Duration; + private Hl7.Fhir.Model.Duration? _Duration; /// /// Organization responsible for device. @@ -1610,13 +1530,13 @@ public Hl7.Fhir.Model.Duration Duration [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Details for human/organization for support. @@ -1626,11 +1546,11 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Where the device is found. @@ -1639,41 +1559,38 @@ public List Contact [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Network address to contact device. /// [FhirElement("url", Order=350, FiveWs="FiveWs.where[x]")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Network address to contact device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1688,11 +1605,11 @@ public string Url [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Linked device acting as a communication/data collector, translator or controller. @@ -1702,11 +1619,11 @@ public List Endpoint [DataMember] public List Gateway { - get { if(_Gateway==null) _Gateway = new List(); return _Gateway; } + get => _Gateway ?? new List(); set { _Gateway = value; OnPropertyChanged("Gateway"); } } - private List _Gateway; + private List? _Gateway; /// /// Device notes and comments. @@ -1716,11 +1633,11 @@ public List Gateway [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Safety Characteristics of Device. @@ -1731,11 +1648,11 @@ public List Note [DataMember] public List Safety { - get { if(_Safety==null) _Safety = new List(); return _Safety; } + get => _Safety ?? new List(); set { _Safety = value; OnPropertyChanged("Safety"); } } - private List _Safety; + private List? _Safety; /// /// The higher level or encompassing device that this device is a logical part of. @@ -1744,58 +1661,54 @@ public List Safety [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Device; - - if (dest == null) - { + if(other is not Device dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(DisplayNameElement != null) dest.DisplayNameElement = (Hl7.Fhir.Model.FhirString)DisplayNameElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.CodeableReference)Definition.DeepCopyInternal(); - if(UdiCarrier.Any()) dest.UdiCarrier = new List(UdiCarrier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(AvailabilityStatus != null) dest.AvailabilityStatus = (Hl7.Fhir.Model.CodeableConcept)AvailabilityStatus.DeepCopyInternal(); - if(BiologicalSourceEvent != null) dest.BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)BiologicalSourceEvent.DeepCopyInternal(); - if(ManufacturerElement != null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)ManufacturerElement.DeepCopyInternal(); - if(ManufactureDateElement != null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)ManufactureDateElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(SerialNumberElement != null) dest.SerialNumberElement = (Hl7.Fhir.Model.FhirString)SerialNumberElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(ModelNumberElement != null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)ModelNumberElement.DeepCopyInternal(); - if(PartNumberElement != null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)PartNumberElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(ConformsTo.Any()) dest.ConformsTo = new List(ConformsTo.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Mode != null) dest.Mode = (Hl7.Fhir.Model.CodeableConcept)Mode.DeepCopyInternal(); - if(Cycle != null) dest.Cycle = (Hl7.Fhir.Model.Count)Cycle.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopyInternal(); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(Gateway.Any()) dest.Gateway = new List(Gateway.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Safety.Any()) dest.Safety = new List(Safety.DeepCopyInternal()); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_DisplayNameElement is not null) dest.DisplayNameElement = (Hl7.Fhir.Model.FhirString)_DisplayNameElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.CodeableReference)_Definition.DeepCopyInternal(); + if(_UdiCarrier is not null) dest.UdiCarrier = new List(_UdiCarrier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_AvailabilityStatus is not null) dest.AvailabilityStatus = (Hl7.Fhir.Model.CodeableConcept)_AvailabilityStatus.DeepCopyInternal(); + if(_BiologicalSourceEvent is not null) dest.BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)_BiologicalSourceEvent.DeepCopyInternal(); + if(_ManufacturerElement is not null) dest.ManufacturerElement = (Hl7.Fhir.Model.FhirString)_ManufacturerElement.DeepCopyInternal(); + if(_ManufactureDateElement is not null) dest.ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)_ManufactureDateElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_SerialNumberElement is not null) dest.SerialNumberElement = (Hl7.Fhir.Model.FhirString)_SerialNumberElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_ModelNumberElement is not null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)_ModelNumberElement.DeepCopyInternal(); + if(_PartNumberElement is not null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)_PartNumberElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_ConformsTo is not null) dest.ConformsTo = new List(_ConformsTo.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Mode is not null) dest.Mode = (Hl7.Fhir.Model.CodeableConcept)_Mode.DeepCopyInternal(); + if(_Cycle is not null) dest.Cycle = (Hl7.Fhir.Model.Count)_Cycle.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Duration)_Duration.DeepCopyInternal(); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_Gateway is not null) dest.Gateway = new List(_Gateway.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Safety is not null) dest.Safety = new List(_Safety.DeepCopyInternal()); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1807,251 +1720,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Device; - if(otherT == null) return false; + if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(DisplayNameElement, otherT.DisplayNameElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.ListEquals(UdiCarrier, otherT.UdiCarrier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(AvailabilityStatus, otherT.AvailabilityStatus)) return false; - if(!comparer.Equals(BiologicalSourceEvent, otherT.BiologicalSourceEvent)) return false; - if(!comparer.Equals(ManufacturerElement, otherT.ManufacturerElement)) return false; - if(!comparer.Equals(ManufactureDateElement, otherT.ManufactureDateElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(SerialNumberElement, otherT.SerialNumberElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.Equals(ModelNumberElement, otherT.ModelNumberElement)) return false; - if(!comparer.Equals(PartNumberElement, otherT.PartNumberElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(ConformsTo, otherT.ConformsTo)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(Mode, otherT.Mode)) return false; - if(!comparer.Equals(Cycle, otherT.Cycle)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.ListEquals(Gateway, otherT.Gateway)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Safety, otherT.Safety)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_DisplayNameElement, otherT._DisplayNameElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.ListEquals(_UdiCarrier, otherT._UdiCarrier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_AvailabilityStatus, otherT._AvailabilityStatus)) return false; + if(!comparer.Equals(_BiologicalSourceEvent, otherT._BiologicalSourceEvent)) return false; + if(!comparer.Equals(_ManufacturerElement, otherT._ManufacturerElement)) return false; + if(!comparer.Equals(_ManufactureDateElement, otherT._ManufactureDateElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_SerialNumberElement, otherT._SerialNumberElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.Equals(_ModelNumberElement, otherT._ModelNumberElement)) return false; + if(!comparer.Equals(_PartNumberElement, otherT._PartNumberElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_ConformsTo, otherT._ConformsTo)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_Mode, otherT._Mode)) return false; + if(!comparer.Equals(_Cycle, otherT._Cycle)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.ListEquals(_Gateway, otherT._Gateway)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "displayName": - value = DisplayNameElement; - return DisplayNameElement is not null; + value = _DisplayNameElement; + return _DisplayNameElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "udiCarrier": - value = UdiCarrier; - return UdiCarrier?.Any() == true; + value = _UdiCarrier; + return _UdiCarrier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "availabilityStatus": - value = AvailabilityStatus; - return AvailabilityStatus is not null; + value = _AvailabilityStatus; + return _AvailabilityStatus is not null; case "biologicalSourceEvent": - value = BiologicalSourceEvent; - return BiologicalSourceEvent is not null; + value = _BiologicalSourceEvent; + return _BiologicalSourceEvent is not null; case "manufacturer": - value = ManufacturerElement; - return ManufacturerElement is not null; + value = _ManufacturerElement; + return _ManufacturerElement is not null; case "manufactureDate": - value = ManufactureDateElement; - return ManufactureDateElement is not null; + value = _ManufactureDateElement; + return _ManufactureDateElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "serialNumber": - value = SerialNumberElement; - return SerialNumberElement is not null; + value = _SerialNumberElement; + return _SerialNumberElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "modelNumber": - value = ModelNumberElement; - return ModelNumberElement is not null; + value = _ModelNumberElement; + return _ModelNumberElement is not null; case "partNumber": - value = PartNumberElement; - return PartNumberElement is not null; + value = _PartNumberElement; + return _PartNumberElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "conformsTo": - value = ConformsTo; - return ConformsTo?.Any() == true; + value = _ConformsTo; + return _ConformsTo?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "mode": - value = Mode; - return Mode is not null; + value = _Mode; + return _Mode is not null; case "cycle": - value = Cycle; - return Cycle is not null; + value = _Cycle; + return _Cycle is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "gateway": - value = Gateway; - return Gateway?.Any() == true; + value = _Gateway; + return _Gateway?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "safety": - value = Safety; - return Safety?.Any() == true; + value = _Safety; + return _Safety?.Any() == true; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "displayName": - DisplayNameElement = (Hl7.Fhir.Model.FhirString)value; + DisplayNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.CodeableReference)value; + Definition = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "udiCarrier": - UdiCarrier = (List)value; + UdiCarrier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "availabilityStatus": - AvailabilityStatus = (Hl7.Fhir.Model.CodeableConcept)value; + AvailabilityStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "biologicalSourceEvent": - BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)value; + BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier?)value; return this; case "manufacturer": - ManufacturerElement = (Hl7.Fhir.Model.FhirString)value; + ManufacturerElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufactureDate": - ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ManufactureDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "serialNumber": - SerialNumberElement = (Hl7.Fhir.Model.FhirString)value; + SerialNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "modelNumber": - ModelNumberElement = (Hl7.Fhir.Model.FhirString)value; + ModelNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "partNumber": - PartNumberElement = (Hl7.Fhir.Model.FhirString)value; + PartNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "conformsTo": - ConformsTo = (List)value; + ConformsTo = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "mode": - Mode = (Hl7.Fhir.Model.CodeableConcept)value; + Mode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cycle": - Cycle = (Hl7.Fhir.Model.Count)value; + Cycle = (Hl7.Fhir.Model.Count?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Duration)value; + Duration = (Hl7.Fhir.Model.Duration?)value; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "gateway": - Gateway = (List)value; + Gateway = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "safety": - Safety = (List)value; + Safety = (List?)value!; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -2062,38 +1975,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (DisplayNameElement is not null) yield return new KeyValuePair("displayName",DisplayNameElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (UdiCarrier?.Any() == true) yield return new KeyValuePair("udiCarrier",UdiCarrier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (AvailabilityStatus is not null) yield return new KeyValuePair("availabilityStatus",AvailabilityStatus); - if (BiologicalSourceEvent is not null) yield return new KeyValuePair("biologicalSourceEvent",BiologicalSourceEvent); - if (ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",ManufacturerElement); - if (ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",ManufactureDateElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (SerialNumberElement is not null) yield return new KeyValuePair("serialNumber",SerialNumberElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",ModelNumberElement); - if (PartNumberElement is not null) yield return new KeyValuePair("partNumber",PartNumberElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (ConformsTo?.Any() == true) yield return new KeyValuePair("conformsTo",ConformsTo); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Mode is not null) yield return new KeyValuePair("mode",Mode); - if (Cycle is not null) yield return new KeyValuePair("cycle",Cycle); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (Gateway?.Any() == true) yield return new KeyValuePair("gateway",Gateway); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Safety?.Any() == true) yield return new KeyValuePair("safety",Safety); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_DisplayNameElement is not null) yield return new KeyValuePair("displayName",_DisplayNameElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_UdiCarrier?.Any() == true) yield return new KeyValuePair("udiCarrier",_UdiCarrier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_AvailabilityStatus is not null) yield return new KeyValuePair("availabilityStatus",_AvailabilityStatus); + if (_BiologicalSourceEvent is not null) yield return new KeyValuePair("biologicalSourceEvent",_BiologicalSourceEvent); + if (_ManufacturerElement is not null) yield return new KeyValuePair("manufacturer",_ManufacturerElement); + if (_ManufactureDateElement is not null) yield return new KeyValuePair("manufactureDate",_ManufactureDateElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_SerialNumberElement is not null) yield return new KeyValuePair("serialNumber",_SerialNumberElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",_ModelNumberElement); + if (_PartNumberElement is not null) yield return new KeyValuePair("partNumber",_PartNumberElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_ConformsTo?.Any() == true) yield return new KeyValuePair("conformsTo",_ConformsTo); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Mode is not null) yield return new KeyValuePair("mode",_Mode); + if (_Cycle is not null) yield return new KeyValuePair("cycle",_Cycle); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_Gateway?.Any() == true) yield return new KeyValuePair("gateway",_Gateway); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Safety?.Any() == true) yield return new KeyValuePair("safety",_Safety); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs index 3ae7a8def..456bc111b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -116,13 +119,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [Binding("DeviceAssociationOperationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The individual performing the action enabled by the device. @@ -134,38 +137,34 @@ public Hl7.Fhir.Model.CodeableConcept Status [DataMember] public List Operator { - get { if(_Operator==null) _Operator = new List(); return _Operator; } + get => _Operator ?? new List(); set { _Operator = value; OnPropertyChanged("Operator"); } } - private List _Operator; + private List? _Operator; /// /// Begin and end dates and times for the device's operation. /// [FhirElement("period", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Operator.Any()) dest.Operator = new List(Operator.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Operator is not null) dest.Operator = new List(_Operator.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -177,48 +176,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.ListEquals(Operator, otherT.Operator)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.ListEquals(_Operator, otherT._Operator)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "operator": - value = Operator; - return Operator?.Any() == true; + value = _Operator; + return _Operator?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "operator": - Operator = (List)value; + Operator = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -229,9 +228,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Operator?.Any() == true) yield return new KeyValuePair("operator",Operator); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Operator?.Any() == true) yield return new KeyValuePair("operator",_Operator); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -244,11 +243,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Reference to the devices associated with the patient or group. @@ -258,13 +257,13 @@ public List Identifier [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Describes the relationship between the device and subject. @@ -274,11 +273,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// implanted | explanted | attached | entered-in-error | unknown. @@ -287,13 +286,13 @@ public List Category [Binding("DeviceAssociationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The reasons given for the current association status. @@ -304,11 +303,11 @@ public Hl7.Fhir.Model.CodeableConcept Status [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// The individual, group of individuals or device that the device is on or associated with. @@ -317,13 +316,13 @@ public List StatusReason [CLSCompliant(false)] [References("Patient","Group","Practitioner","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Current anatomical location of the device in/on subject. @@ -332,26 +331,26 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("BodyStructure")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BodyStructure + public Hl7.Fhir.Model.ResourceReference? BodyStructure { get { return _BodyStructure; } set { _BodyStructure = value; OnPropertyChanged("BodyStructure"); } } - private Hl7.Fhir.Model.ResourceReference _BodyStructure; + private Hl7.Fhir.Model.ResourceReference? _BodyStructure; /// /// Begin and end dates and times for the device association. /// [FhirElement("period", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The details about the device when it is in use to describe its operation. @@ -361,33 +360,29 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Operation { - get { if(_Operation==null) _Operation = new List(); return _Operation; } + get => _Operation ?? new List(); set { _Operation = value; OnPropertyChanged("Operation"); } } - private List _Operation; + private List? _Operation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceAssociation; - - if (dest == null) - { + if(other is not DeviceAssociation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(BodyStructure != null) dest.BodyStructure = (Hl7.Fhir.Model.ResourceReference)BodyStructure.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_BodyStructure is not null) dest.BodyStructure = (Hl7.Fhir.Model.ResourceReference)_BodyStructure.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -399,90 +394,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceAssociation; - if(otherT == null) return false; + if(other is not DeviceAssociation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(BodyStructure, otherT.BodyStructure)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_BodyStructure, otherT._BodyStructure)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "bodyStructure": - value = BodyStructure; - return BodyStructure is not null; + value = _BodyStructure; + return _BodyStructure is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "operation": - value = Operation; - return Operation?.Any() == true; + value = _Operation; + return _Operation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "bodyStructure": - BodyStructure = (Hl7.Fhir.Model.ResourceReference)value; + BodyStructure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "operation": - Operation = (List)value; + Operation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -493,15 +488,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (BodyStructure is not null) yield return new KeyValuePair("bodyStructure",BodyStructure); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_BodyStructure is not null) yield return new KeyValuePair("bodyStructure",_BodyStructure); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs index ac45359bf..05e8c9c3b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -184,28 +187,25 @@ public partial class UdiDeviceIdentifierComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("deviceIdentifier", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -216,28 +216,25 @@ public string DeviceIdentifier [FhirElement("issuer", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// The organization that assigns the identifier algorithm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -248,28 +245,25 @@ public string Issuer [FhirElement("jurisdiction", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// The jurisdiction to which the deviceIdentifier applies /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } @@ -282,26 +276,22 @@ public string Jurisdiction [DataMember] public List MarketDistribution { - get { if(_MarketDistribution==null) _MarketDistribution = new List(); return _MarketDistribution; } + get => _MarketDistribution ?? new List(); set { _MarketDistribution = value; OnPropertyChanged("MarketDistribution"); } } - private List _MarketDistribution; + private List? _MarketDistribution; protected internal override void CopyToInternal(Base other) { - var dest = other as UdiDeviceIdentifierComponent; - - if (dest == null) - { + if(other is not UdiDeviceIdentifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); - if(MarketDistribution.Any()) dest.MarketDistribution = new List(MarketDistribution.DeepCopyInternal()); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); + if(_MarketDistribution is not null) dest.MarketDistribution = new List(_MarketDistribution.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -313,55 +303,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiDeviceIdentifierComponent; - if(otherT == null) return false; + if(other is not UdiDeviceIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; - if(!comparer.ListEquals(MarketDistribution, otherT.MarketDistribution)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; + if(!comparer.ListEquals(_MarketDistribution, otherT._MarketDistribution)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; case "marketDistribution": - value = MarketDistribution; - return MarketDistribution?.Any() == true; + value = _MarketDistribution; + return _MarketDistribution?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "marketDistribution": - MarketDistribution = (List)value; + MarketDistribution = (List?)value!; return this; default: return base.SetValue(key, value); @@ -372,10 +362,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); - if (MarketDistribution?.Any() == true) yield return new KeyValuePair("marketDistribution",MarketDistribution); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); + if (_MarketDistribution?.Any() == true) yield return new KeyValuePair("marketDistribution",_MarketDistribution); } } @@ -402,13 +392,13 @@ public partial class UdiDeviceIdentifierMarketDistributionComponent : Hl7.Fhir.M [FhirElement("marketPeriod", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period MarketPeriod + public Hl7.Fhir.Model.Period? MarketPeriod { get { return _MarketPeriod; } set { _MarketPeriod = value; OnPropertyChanged("MarketPeriod"); } } - private Hl7.Fhir.Model.Period _MarketPeriod; + private Hl7.Fhir.Model.Period? _MarketPeriod; /// /// National state or territory where the device is commercialized. @@ -416,44 +406,37 @@ public Hl7.Fhir.Model.Period MarketPeriod [FhirElement("subJurisdiction", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri SubJurisdictionElement + public Hl7.Fhir.Model.FhirUri? SubJurisdictionElement { get { return _SubJurisdictionElement; } set { _SubJurisdictionElement = value; OnPropertyChanged("SubJurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _SubJurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _SubJurisdictionElement; /// /// National state or territory where the device is commercialized /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubJurisdiction + public string? SubJurisdiction { - get { return SubJurisdictionElement != null ? SubJurisdictionElement.Value : null; } + get => _SubJurisdictionElement?.Value; set { - if (value == null) - SubJurisdictionElement = null; - else - SubJurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + SubJurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("SubJurisdiction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UdiDeviceIdentifierMarketDistributionComponent; - - if (dest == null) - { + if(other is not UdiDeviceIdentifierMarketDistributionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MarketPeriod != null) dest.MarketPeriod = (Hl7.Fhir.Model.Period)MarketPeriod.DeepCopyInternal(); - if(SubJurisdictionElement != null) dest.SubJurisdictionElement = (Hl7.Fhir.Model.FhirUri)SubJurisdictionElement.DeepCopyInternal(); + if(_MarketPeriod is not null) dest.MarketPeriod = (Hl7.Fhir.Model.Period)_MarketPeriod.DeepCopyInternal(); + if(_SubJurisdictionElement is not null) dest.SubJurisdictionElement = (Hl7.Fhir.Model.FhirUri)_SubJurisdictionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -465,41 +448,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UdiDeviceIdentifierMarketDistributionComponent; - if(otherT == null) return false; + if(other is not UdiDeviceIdentifierMarketDistributionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MarketPeriod, otherT.MarketPeriod)) return false; - if(!comparer.Equals(SubJurisdictionElement, otherT.SubJurisdictionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MarketPeriod, otherT._MarketPeriod)) return false; + if(!comparer.Equals(_SubJurisdictionElement, otherT._SubJurisdictionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "marketPeriod": - value = MarketPeriod; - return MarketPeriod is not null; + value = _MarketPeriod; + return _MarketPeriod is not null; case "subJurisdiction": - value = SubJurisdictionElement; - return SubJurisdictionElement is not null; + value = _SubJurisdictionElement; + return _SubJurisdictionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "marketPeriod": - MarketPeriod = (Hl7.Fhir.Model.Period)value; + MarketPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "subJurisdiction": - SubJurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + SubJurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -510,8 +493,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MarketPeriod is not null) yield return new KeyValuePair("marketPeriod",MarketPeriod); - if (SubJurisdictionElement is not null) yield return new KeyValuePair("subJurisdiction",SubJurisdictionElement); + if (_MarketPeriod is not null) yield return new KeyValuePair("marketPeriod",_MarketPeriod); + if (_SubJurisdictionElement is not null) yield return new KeyValuePair("subJurisdiction",_SubJurisdictionElement); } } @@ -541,13 +524,13 @@ public partial class RegulatoryIdentifierComponent : Hl7.Fhir.Model.BackboneElem [Binding("DeviceRegulatoryIdentifierType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// basic | master | license @@ -556,13 +539,10 @@ public Code _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -573,28 +553,25 @@ public Hl7.Fhir.Model.DeviceDefinition.DeviceDefinitionRegulatoryIdentifierType? [FhirElement("deviceIdentifier", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DeviceIdentifierElement + public Hl7.Fhir.Model.FhirString? DeviceIdentifierElement { get { return _DeviceIdentifierElement; } set { _DeviceIdentifierElement = value; OnPropertyChanged("DeviceIdentifierElement"); } } - private Hl7.Fhir.Model.FhirString _DeviceIdentifierElement; + private Hl7.Fhir.Model.FhirString? _DeviceIdentifierElement; /// /// The identifier itself /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DeviceIdentifier + public string? DeviceIdentifier { - get { return DeviceIdentifierElement != null ? DeviceIdentifierElement.Value : null; } + get => _DeviceIdentifierElement?.Value; set { - if (value == null) - DeviceIdentifierElement = null; - else - DeviceIdentifierElement = new Hl7.Fhir.Model.FhirString(value); + DeviceIdentifierElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DeviceIdentifier"); } } @@ -605,28 +582,25 @@ public string DeviceIdentifier [FhirElement("issuer", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri IssuerElement + public Hl7.Fhir.Model.FhirUri? IssuerElement { get { return _IssuerElement; } set { _IssuerElement = value; OnPropertyChanged("IssuerElement"); } } - private Hl7.Fhir.Model.FhirUri _IssuerElement; + private Hl7.Fhir.Model.FhirUri? _IssuerElement; /// /// The organization that issued this identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issuer + public string? Issuer { - get { return IssuerElement != null ? IssuerElement.Value : null; } + get => _IssuerElement?.Value; set { - if (value == null) - IssuerElement = null; - else - IssuerElement = new Hl7.Fhir.Model.FhirUri(value); + IssuerElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Issuer"); } } @@ -637,46 +611,39 @@ public string Issuer [FhirElement("jurisdiction", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri JurisdictionElement + public Hl7.Fhir.Model.FhirUri? JurisdictionElement { get { return _JurisdictionElement; } set { _JurisdictionElement = value; OnPropertyChanged("JurisdictionElement"); } } - private Hl7.Fhir.Model.FhirUri _JurisdictionElement; + private Hl7.Fhir.Model.FhirUri? _JurisdictionElement; /// /// The jurisdiction to which the deviceIdentifier applies /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Jurisdiction + public string? Jurisdiction { - get { return JurisdictionElement != null ? JurisdictionElement.Value : null; } + get => _JurisdictionElement?.Value; set { - if (value == null) - JurisdictionElement = null; - else - JurisdictionElement = new Hl7.Fhir.Model.FhirUri(value); + JurisdictionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Jurisdiction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RegulatoryIdentifierComponent; - - if (dest == null) - { + if(other is not RegulatoryIdentifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DeviceIdentifierElement != null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)DeviceIdentifierElement.DeepCopyInternal(); - if(IssuerElement != null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)IssuerElement.DeepCopyInternal(); - if(JurisdictionElement != null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)JurisdictionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DeviceIdentifierElement is not null) dest.DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)_DeviceIdentifierElement.DeepCopyInternal(); + if(_IssuerElement is not null) dest.IssuerElement = (Hl7.Fhir.Model.FhirUri)_IssuerElement.DeepCopyInternal(); + if(_JurisdictionElement is not null) dest.JurisdictionElement = (Hl7.Fhir.Model.FhirUri)_JurisdictionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -688,55 +655,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RegulatoryIdentifierComponent; - if(otherT == null) return false; + if(other is not RegulatoryIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DeviceIdentifierElement, otherT.DeviceIdentifierElement)) return false; - if(!comparer.Equals(IssuerElement, otherT.IssuerElement)) return false; - if(!comparer.Equals(JurisdictionElement, otherT.JurisdictionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; + if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "deviceIdentifier": - value = DeviceIdentifierElement; - return DeviceIdentifierElement is not null; + value = _DeviceIdentifierElement; + return _DeviceIdentifierElement is not null; case "issuer": - value = IssuerElement; - return IssuerElement is not null; + value = _IssuerElement; + return _IssuerElement is not null; case "jurisdiction": - value = JurisdictionElement; - return JurisdictionElement is not null; + value = _JurisdictionElement; + return _JurisdictionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "deviceIdentifier": - DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString)value; + DeviceIdentifierElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issuer": - IssuerElement = (Hl7.Fhir.Model.FhirUri)value; + IssuerElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "jurisdiction": - JurisdictionElement = (Hl7.Fhir.Model.FhirUri)value; + JurisdictionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -747,10 +714,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",DeviceIdentifierElement); - if (IssuerElement is not null) yield return new KeyValuePair("issuer",IssuerElement); - if (JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",JurisdictionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DeviceIdentifierElement is not null) yield return new KeyValuePair("deviceIdentifier",_DeviceIdentifierElement); + if (_IssuerElement is not null) yield return new KeyValuePair("issuer",_IssuerElement); + if (_JurisdictionElement is not null) yield return new KeyValuePair("jurisdiction",_JurisdictionElement); } } @@ -774,28 +741,25 @@ public partial class DeviceNameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name that is used to refer to the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -808,13 +772,13 @@ public string Name [Binding("DeviceNameType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// registered-name | user-friendly-name | patient-reported-name @@ -823,29 +787,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceNameType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceNameComponent; - - if (dest == null) - { + if(other is not DeviceNameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -857,41 +814,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceNameComponent; - if(otherT == null) return false; + if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -902,8 +859,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -931,13 +888,13 @@ public partial class ClassificationComponent : Hl7.Fhir.Model.BackboneElement [Binding("DeviceKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Further information qualifying this classification of the device model. @@ -947,24 +904,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Justification { - get { if(_Justification==null) _Justification = new List(); return _Justification; } + get => _Justification ?? new List(); set { _Justification = value; OnPropertyChanged("Justification"); } } - private List _Justification; + private List? _Justification; protected internal override void CopyToInternal(Base other) { - var dest = other as ClassificationComponent; - - if (dest == null) - { + if(other is not ClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Justification.Any()) dest.Justification = new List(Justification.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Justification is not null) dest.Justification = new List(_Justification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -976,41 +929,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClassificationComponent; - if(otherT == null) return false; + if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Justification, otherT.Justification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Justification, otherT._Justification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "justification": - value = Justification; - return Justification?.Any() == true; + value = _Justification; + return _Justification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "justification": - Justification = (List)value; + Justification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1021,8 +974,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Justification?.Any() == true) yield return new KeyValuePair("justification",Justification); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Justification?.Any() == true) yield return new KeyValuePair("justification",_Justification); } } @@ -1049,13 +1002,13 @@ public partial class ConformsToComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", InSummary=true, Order=40)] [Binding("DeviceSpecificationCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Identifies the standard, specification, or formal guidance that the device adheres to the Device Specification type. @@ -1064,13 +1017,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("DeviceSpecificationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Specification + public Hl7.Fhir.Model.CodeableConcept? Specification { get { return _Specification; } set { _Specification = value; OnPropertyChanged("Specification"); } } - private Hl7.Fhir.Model.CodeableConcept _Specification; + private Hl7.Fhir.Model.CodeableConcept? _Specification; /// /// The specific form or variant of the standard, specification or formal guidance. @@ -1080,24 +1033,24 @@ public Hl7.Fhir.Model.CodeableConcept Specification [DataMember] public List VersionElement { - get { if(_VersionElement==null) _VersionElement = new List(); return _VersionElement; } + get => _VersionElement ?? new List(); set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private List _VersionElement; + private List? _VersionElement; /// /// The specific form or variant of the standard, specification or formal guidance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Version + public IEnumerable? Version { - get { return VersionElement != null ? VersionElement.Select(elem => elem.Value) : null; } + get => _VersionElement?.Select(elem => elem.Value); set { if (value == null) - VersionElement = null; + VersionElement = null!; else VersionElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Version"); @@ -1112,26 +1065,22 @@ public IEnumerable Version [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as ConformsToComponent; - - if (dest == null) - { + if(other is not ConformsToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Specification != null) dest.Specification = (Hl7.Fhir.Model.CodeableConcept)Specification.DeepCopyInternal(); - if(VersionElement.Any()) dest.VersionElement = new List(VersionElement.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Specification is not null) dest.Specification = (Hl7.Fhir.Model.CodeableConcept)_Specification.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = new List(_VersionElement.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1143,55 +1092,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConformsToComponent; - if(otherT == null) return false; + if(other is not ConformsToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Specification, otherT.Specification)) return false; - if(!comparer.ListEquals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Specification, otherT._Specification)) return false; + if(!comparer.ListEquals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "specification": - value = Specification; - return Specification is not null; + value = _Specification; + return _Specification is not null; case "version": - value = VersionElement; - return VersionElement?.Any() == true; + value = _VersionElement; + return _VersionElement?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specification": - Specification = (Hl7.Fhir.Model.CodeableConcept)value; + Specification = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "version": - VersionElement = (List)value; + VersionElement = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1202,10 +1151,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Specification is not null) yield return new KeyValuePair("specification",Specification); - if (VersionElement?.Any() == true) yield return new KeyValuePair("version",VersionElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Specification is not null) yield return new KeyValuePair("specification",_Specification); + if (_VersionElement?.Any() == true) yield return new KeyValuePair("version",_VersionElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -1234,26 +1183,26 @@ public partial class HasPartComponent : Hl7.Fhir.Model.BackboneElement [References("DeviceDefinition")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Number of occurrences of the part. /// [FhirElement("count", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Number of occurrences of the part @@ -1262,29 +1211,22 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as HasPartComponent; - - if (dest == null) - { + if(other is not HasPartComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1296,41 +1238,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HasPartComponent; - if(otherT == null) return false; + if(other is not HasPartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -1341,8 +1283,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); } } @@ -1365,39 +1307,39 @@ public partial class PackagingComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// A code that defines the specific type of packaging. /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The number of items contained in the package (devices or sub-packages). /// [FhirElement("count", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// The number of items contained in the package (devices or sub-packages) @@ -1406,13 +1348,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -1425,11 +1364,11 @@ public int? Count [DataMember] public List Distributor { - get { if(_Distributor==null) _Distributor = new List(); return _Distributor; } + get => _Distributor ?? new List(); set { _Distributor = value; OnPropertyChanged("Distributor"); } } - private List _Distributor; + private List? _Distributor; /// /// Unique Device Identifier (UDI) Barcode string on the packaging. @@ -1439,11 +1378,11 @@ public List Distr [DataMember] public List UdiDeviceIdentifier { - get { if(_UdiDeviceIdentifier==null) _UdiDeviceIdentifier = new List(); return _UdiDeviceIdentifier; } + get => _UdiDeviceIdentifier ?? new List(); set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } - private List _UdiDeviceIdentifier; + private List? _UdiDeviceIdentifier; /// /// Allows packages within packages. @@ -1453,28 +1392,24 @@ public List UdiDev [DataMember] public List Packaging { - get { if(_Packaging==null) _Packaging = new List(); return _Packaging; } + get => _Packaging ?? new List(); set { _Packaging = value; OnPropertyChanged("Packaging"); } } - private List _Packaging; + private List? _Packaging; protected internal override void CopyToInternal(Base other) { - var dest = other as PackagingComponent; - - if (dest == null) - { + if(other is not PackagingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(Distributor.Any()) dest.Distributor = new List(Distributor.DeepCopyInternal()); - if(UdiDeviceIdentifier.Any()) dest.UdiDeviceIdentifier = new List(UdiDeviceIdentifier.DeepCopyInternal()); - if(Packaging.Any()) dest.Packaging = new List(Packaging.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_Distributor is not null) dest.Distributor = new List(_Distributor.DeepCopyInternal()); + if(_UdiDeviceIdentifier is not null) dest.UdiDeviceIdentifier = new List(_UdiDeviceIdentifier.DeepCopyInternal()); + if(_Packaging is not null) dest.Packaging = new List(_Packaging.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1486,69 +1421,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagingComponent; - if(otherT == null) return false; + if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.ListEquals(Distributor, otherT.Distributor)) return false; - if(!comparer.ListEquals(UdiDeviceIdentifier, otherT.UdiDeviceIdentifier)) return false; - if(!comparer.ListEquals(Packaging, otherT.Packaging)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.ListEquals(_Distributor, otherT._Distributor)) return false; + if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; + if(!comparer.ListEquals(_Packaging, otherT._Packaging)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "distributor": - value = Distributor; - return Distributor?.Any() == true; + value = _Distributor; + return _Distributor?.Any() == true; case "udiDeviceIdentifier": - value = UdiDeviceIdentifier; - return UdiDeviceIdentifier?.Any() == true; + value = _UdiDeviceIdentifier; + return _UdiDeviceIdentifier?.Any() == true; case "packaging": - value = Packaging; - return Packaging?.Any() == true; + value = _Packaging; + return _Packaging?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "distributor": - Distributor = (List)value; + Distributor = (List?)value!; return this; case "udiDeviceIdentifier": - UdiDeviceIdentifier = (List)value; + UdiDeviceIdentifier = (List?)value!; return this; case "packaging": - Packaging = (List)value; + Packaging = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1559,12 +1494,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (Distributor?.Any() == true) yield return new KeyValuePair("distributor",Distributor); - if (UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",UdiDeviceIdentifier); - if (Packaging?.Any() == true) yield return new KeyValuePair("packaging",Packaging); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_Distributor?.Any() == true) yield return new KeyValuePair("distributor",_Distributor); + if (_UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",_UdiDeviceIdentifier); + if (_Packaging?.Any() == true) yield return new KeyValuePair("packaging",_Packaging); } } @@ -1587,28 +1522,25 @@ public partial class PackagingDistributorComponent : Hl7.Fhir.Model.BackboneElem /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Distributor's human-readable name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1623,24 +1555,20 @@ public string Name [DataMember] public List OrganizationReference { - get { if(_OrganizationReference==null) _OrganizationReference = new List(); return _OrganizationReference; } + get => _OrganizationReference ?? new List(); set { _OrganizationReference = value; OnPropertyChanged("OrganizationReference"); } } - private List _OrganizationReference; + private List? _OrganizationReference; protected internal override void CopyToInternal(Base other) { - var dest = other as PackagingDistributorComponent; - - if (dest == null) - { + if(other is not PackagingDistributorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(OrganizationReference.Any()) dest.OrganizationReference = new List(OrganizationReference.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_OrganizationReference is not null) dest.OrganizationReference = new List(_OrganizationReference.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1652,41 +1580,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagingDistributorComponent; - if(otherT == null) return false; + if(other is not PackagingDistributorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(OrganizationReference, otherT.OrganizationReference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_OrganizationReference, otherT._OrganizationReference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "organizationReference": - value = OrganizationReference; - return OrganizationReference?.Any() == true; + value = _OrganizationReference; + return _OrganizationReference?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "organizationReference": - OrganizationReference = (List)value; + OrganizationReference = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1697,8 +1625,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (OrganizationReference?.Any() == true) yield return new KeyValuePair("organizationReference",OrganizationReference); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_OrganizationReference?.Any() == true) yield return new KeyValuePair("organizationReference",_OrganizationReference); } } @@ -1721,26 +1649,26 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The hardware or software module of the device to which the version applies. /// [FhirElement("component", Order=50, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Identifier Component + public Hl7.Fhir.Model.Identifier? Component { get { return _Component; } set { _Component = value; OnPropertyChanged("Component"); } } - private Hl7.Fhir.Model.Identifier _Component; + private Hl7.Fhir.Model.Identifier? _Component; /// /// The version text. @@ -1748,45 +1676,38 @@ public Hl7.Fhir.Model.Identifier Component [FhirElement("value", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The version text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Component != null) dest.Component = (Hl7.Fhir.Model.Identifier)Component.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Component is not null) dest.Component = (Hl7.Fhir.Model.Identifier)_Component.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1798,48 +1719,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Component, otherT.Component)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Component, otherT._Component)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "component": - value = Component; - return Component is not null; + value = _Component; + return _Component is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "component": - Component = (Hl7.Fhir.Model.Identifier)value; + Component = (Hl7.Fhir.Model.Identifier?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1850,9 +1771,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Component is not null) yield return new KeyValuePair("component",Component); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Component is not null) yield return new KeyValuePair("component",_Component); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -1881,13 +1802,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("DevicePropertyType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Value of the property. @@ -1897,26 +1818,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Attachment))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1928,41 +1845,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1973,8 +1890,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1999,13 +1916,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [Binding("DeviceDefinitionRelationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Relation + public Hl7.Fhir.Model.Coding? Relation { get { return _Relation; } set { _Relation = value; OnPropertyChanged("Relation"); } } - private Hl7.Fhir.Model.Coding _Relation; + private Hl7.Fhir.Model.Coding? _Relation; /// /// A reference to the linked device. @@ -2013,26 +1930,22 @@ public Hl7.Fhir.Model.Coding Relation [FhirElement("relatedDevice", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference RelatedDevice + public Hl7.Fhir.Model.CodeableReference? RelatedDevice { get { return _RelatedDevice; } set { _RelatedDevice = value; OnPropertyChanged("RelatedDevice"); } } - private Hl7.Fhir.Model.CodeableReference _RelatedDevice; + private Hl7.Fhir.Model.CodeableReference? _RelatedDevice; protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Relation != null) dest.Relation = (Hl7.Fhir.Model.Coding)Relation.DeepCopyInternal(); - if(RelatedDevice != null) dest.RelatedDevice = (Hl7.Fhir.Model.CodeableReference)RelatedDevice.DeepCopyInternal(); + if(_Relation is not null) dest.Relation = (Hl7.Fhir.Model.Coding)_Relation.DeepCopyInternal(); + if(_RelatedDevice is not null) dest.RelatedDevice = (Hl7.Fhir.Model.CodeableReference)_RelatedDevice.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2044,41 +1957,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Relation, otherT.Relation)) return false; - if(!comparer.Equals(RelatedDevice, otherT.RelatedDevice)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Relation, otherT._Relation)) return false; + if(!comparer.Equals(_RelatedDevice, otherT._RelatedDevice)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relation": - value = Relation; - return Relation is not null; + value = _Relation; + return _Relation is not null; case "relatedDevice": - value = RelatedDevice; - return RelatedDevice is not null; + value = _RelatedDevice; + return _RelatedDevice is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relation": - Relation = (Hl7.Fhir.Model.Coding)value; + Relation = (Hl7.Fhir.Model.Coding?)value; return this; case "relatedDevice": - RelatedDevice = (Hl7.Fhir.Model.CodeableReference)value; + RelatedDevice = (Hl7.Fhir.Model.CodeableReference?)value; return this; default: return base.SetValue(key, value); @@ -2089,8 +2002,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Relation is not null) yield return new KeyValuePair("relation",Relation); - if (RelatedDevice is not null) yield return new KeyValuePair("relatedDevice",RelatedDevice); + if (_Relation is not null) yield return new KeyValuePair("relation",_Relation); + if (_RelatedDevice is not null) yield return new KeyValuePair("relatedDevice",_RelatedDevice); } } @@ -2114,26 +2027,26 @@ public partial class MaterialComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("substance", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Substance + public Hl7.Fhir.Model.CodeableConcept? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableConcept _Substance; + private Hl7.Fhir.Model.CodeableConcept? _Substance; /// /// Indicates an alternative material of the device. /// [FhirElement("alternate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AlternateElement + public Hl7.Fhir.Model.FhirBoolean? AlternateElement { get { return _AlternateElement; } set { _AlternateElement = value; OnPropertyChanged("AlternateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AlternateElement; + private Hl7.Fhir.Model.FhirBoolean? _AlternateElement; /// /// Indicates an alternative material of the device @@ -2142,13 +2055,10 @@ public Hl7.Fhir.Model.FhirBoolean AlternateElement [IgnoreDataMember] public bool? Alternate { - get { return AlternateElement != null ? AlternateElement.Value : null; } + get => _AlternateElement?.Value; set { - if (value == null) - AlternateElement = null; - else - AlternateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AlternateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Alternate"); } } @@ -2158,13 +2068,13 @@ public bool? Alternate /// [FhirElement("allergenicIndicator", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? AllergenicIndicatorElement { get { return _AllergenicIndicatorElement; } set { _AllergenicIndicatorElement = value; OnPropertyChanged("AllergenicIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllergenicIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _AllergenicIndicatorElement; /// /// Whether the substance is a known or suspected allergen @@ -2173,30 +2083,23 @@ public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement [IgnoreDataMember] public bool? AllergenicIndicator { - get { return AllergenicIndicatorElement != null ? AllergenicIndicatorElement.Value : null; } + get => _AllergenicIndicatorElement?.Value; set { - if (value == null) - AllergenicIndicatorElement = null; - else - AllergenicIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllergenicIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllergenicIndicator"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MaterialComponent; - - if (dest == null) - { + if(other is not MaterialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)Substance.DeepCopyInternal(); - if(AlternateElement != null) dest.AlternateElement = (Hl7.Fhir.Model.FhirBoolean)AlternateElement.DeepCopyInternal(); - if(AllergenicIndicatorElement != null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)AllergenicIndicatorElement.DeepCopyInternal(); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableConcept)_Substance.DeepCopyInternal(); + if(_AlternateElement is not null) dest.AlternateElement = (Hl7.Fhir.Model.FhirBoolean)_AlternateElement.DeepCopyInternal(); + if(_AllergenicIndicatorElement is not null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_AllergenicIndicatorElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2208,48 +2111,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MaterialComponent; - if(otherT == null) return false; + if(other is not MaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.Equals(AlternateElement, otherT.AlternateElement)) return false; - if(!comparer.Equals(AllergenicIndicatorElement, otherT.AllergenicIndicatorElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.Equals(_AlternateElement, otherT._AlternateElement)) return false; + if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "alternate": - value = AlternateElement; - return AlternateElement is not null; + value = _AlternateElement; + return _AlternateElement is not null; case "allergenicIndicator": - value = AllergenicIndicatorElement; - return AllergenicIndicatorElement is not null; + value = _AllergenicIndicatorElement; + return _AllergenicIndicatorElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableConcept)value; + Substance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "alternate": - AlternateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AlternateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "allergenicIndicator": - AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -2260,9 +2163,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (AlternateElement is not null) yield return new KeyValuePair("alternate",AlternateElement); - if (AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",AllergenicIndicatorElement); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_AlternateElement is not null) yield return new KeyValuePair("alternate",_AlternateElement); + if (_AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",_AllergenicIndicatorElement); } } @@ -2291,39 +2194,36 @@ public partial class GuidelineComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Detailed written and visual directions for the user on how to use the device. /// [FhirElement("usageInstruction", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown UsageInstructionElement + public Hl7.Fhir.Model.Markdown? UsageInstructionElement { get { return _UsageInstructionElement; } set { _UsageInstructionElement = value; OnPropertyChanged("UsageInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _UsageInstructionElement; + private Hl7.Fhir.Model.Markdown? _UsageInstructionElement; /// /// Detailed written and visual directions for the user on how to use the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string UsageInstruction + public string? UsageInstruction { - get { return UsageInstructionElement != null ? UsageInstructionElement.Value : null; } + get => _UsageInstructionElement?.Value; set { - if (value == null) - UsageInstructionElement = null; - else - UsageInstructionElement = new Hl7.Fhir.Model.Markdown(value); + UsageInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("UsageInstruction"); } } @@ -2336,11 +2236,11 @@ public string UsageInstruction [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// A clinical condition for which the device was designed to be used. @@ -2350,11 +2250,11 @@ public List RelatedArtifact [DataMember] public List Indication { - get { if(_Indication==null) _Indication = new List(); return _Indication; } + get => _Indication ?? new List(); set { _Indication = value; OnPropertyChanged("Indication"); } } - private List _Indication; + private List? _Indication; /// /// A specific situation when a device should not be used because it may cause harm. @@ -2364,11 +2264,11 @@ public List Indication [DataMember] public List Contraindication { - get { if(_Contraindication==null) _Contraindication = new List(); return _Contraindication; } + get => _Contraindication ?? new List(); set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } - private List _Contraindication; + private List? _Contraindication; /// /// Specific hazard alert information that a user needs to know before using the device. @@ -2378,60 +2278,53 @@ public List Contraindication [DataMember] public List Warning { - get { if(_Warning==null) _Warning = new List(); return _Warning; } + get => _Warning ?? new List(); set { _Warning = value; OnPropertyChanged("Warning"); } } - private List _Warning; + private List? _Warning; /// /// A description of the general purpose or medical use of the device or its function. /// [FhirElement("intendedUse", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString IntendedUseElement + public Hl7.Fhir.Model.FhirString? IntendedUseElement { get { return _IntendedUseElement; } set { _IntendedUseElement = value; OnPropertyChanged("IntendedUseElement"); } } - private Hl7.Fhir.Model.FhirString _IntendedUseElement; + private Hl7.Fhir.Model.FhirString? _IntendedUseElement; /// /// A description of the general purpose or medical use of the device or its function /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IntendedUse + public string? IntendedUse { - get { return IntendedUseElement != null ? IntendedUseElement.Value : null; } + get => _IntendedUseElement?.Value; set { - if (value == null) - IntendedUseElement = null; - else - IntendedUseElement = new Hl7.Fhir.Model.FhirString(value); + IntendedUseElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IntendedUse"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GuidelineComponent; - - if (dest == null) - { + if(other is not GuidelineComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(UsageInstructionElement != null) dest.UsageInstructionElement = (Hl7.Fhir.Model.Markdown)UsageInstructionElement.DeepCopyInternal(); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Indication.Any()) dest.Indication = new List(Indication.DeepCopyInternal()); - if(Contraindication.Any()) dest.Contraindication = new List(Contraindication.DeepCopyInternal()); - if(Warning.Any()) dest.Warning = new List(Warning.DeepCopyInternal()); - if(IntendedUseElement != null) dest.IntendedUseElement = (Hl7.Fhir.Model.FhirString)IntendedUseElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_UsageInstructionElement is not null) dest.UsageInstructionElement = (Hl7.Fhir.Model.Markdown)_UsageInstructionElement.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Indication is not null) dest.Indication = new List(_Indication.DeepCopyInternal()); + if(_Contraindication is not null) dest.Contraindication = new List(_Contraindication.DeepCopyInternal()); + if(_Warning is not null) dest.Warning = new List(_Warning.DeepCopyInternal()); + if(_IntendedUseElement is not null) dest.IntendedUseElement = (Hl7.Fhir.Model.FhirString)_IntendedUseElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2443,76 +2336,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuidelineComponent; - if(otherT == null) return false; + if(other is not GuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(UsageInstructionElement, otherT.UsageInstructionElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Indication, otherT.Indication)) return false; - if(!comparer.ListEquals(Contraindication, otherT.Contraindication)) return false; - if(!comparer.ListEquals(Warning, otherT.Warning)) return false; - if(!comparer.Equals(IntendedUseElement, otherT.IntendedUseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_UsageInstructionElement, otherT._UsageInstructionElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + if(!comparer.ListEquals(_Contraindication, otherT._Contraindication)) return false; + if(!comparer.ListEquals(_Warning, otherT._Warning)) return false; + if(!comparer.Equals(_IntendedUseElement, otherT._IntendedUseElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "usageInstruction": - value = UsageInstructionElement; - return UsageInstructionElement is not null; + value = _UsageInstructionElement; + return _UsageInstructionElement is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "indication": - value = Indication; - return Indication?.Any() == true; + value = _Indication; + return _Indication?.Any() == true; case "contraindication": - value = Contraindication; - return Contraindication?.Any() == true; + value = _Contraindication; + return _Contraindication?.Any() == true; case "warning": - value = Warning; - return Warning?.Any() == true; + value = _Warning; + return _Warning?.Any() == true; case "intendedUse": - value = IntendedUseElement; - return IntendedUseElement is not null; + value = _IntendedUseElement; + return _IntendedUseElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "usageInstruction": - UsageInstructionElement = (Hl7.Fhir.Model.Markdown)value; + UsageInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "indication": - Indication = (List)value; + Indication = (List?)value!; return this; case "contraindication": - Contraindication = (List)value; + Contraindication = (List?)value!; return this; case "warning": - Warning = (List)value; + Warning = (List?)value!; return this; case "intendedUse": - IntendedUseElement = (Hl7.Fhir.Model.FhirString)value; + IntendedUseElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2523,13 +2416,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (UsageInstructionElement is not null) yield return new KeyValuePair("usageInstruction",UsageInstructionElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Indication?.Any() == true) yield return new KeyValuePair("indication",Indication); - if (Contraindication?.Any() == true) yield return new KeyValuePair("contraindication",Contraindication); - if (Warning?.Any() == true) yield return new KeyValuePair("warning",Warning); - if (IntendedUseElement is not null) yield return new KeyValuePair("intendedUse",IntendedUseElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_UsageInstructionElement is not null) yield return new KeyValuePair("usageInstruction",_UsageInstructionElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Indication?.Any() == true) yield return new KeyValuePair("indication",_Indication); + if (_Contraindication?.Any() == true) yield return new KeyValuePair("contraindication",_Contraindication); + if (_Warning?.Any() == true) yield return new KeyValuePair("warning",_Warning); + if (_IntendedUseElement is not null) yield return new KeyValuePair("intendedUse",_IntendedUseElement); } } @@ -2553,13 +2446,13 @@ public partial class CorrectiveActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("recall", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RecallElement + public Hl7.Fhir.Model.FhirBoolean? RecallElement { get { return _RecallElement; } set { _RecallElement = value; OnPropertyChanged("RecallElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RecallElement; + private Hl7.Fhir.Model.FhirBoolean? _RecallElement; /// /// Whether the corrective action was a recall @@ -2568,13 +2461,10 @@ public Hl7.Fhir.Model.FhirBoolean RecallElement [IgnoreDataMember] public bool? Recall { - get { return RecallElement != null ? RecallElement.Value : null; } + get => _RecallElement?.Value; set { - if (value == null) - RecallElement = null; - else - RecallElement = new Hl7.Fhir.Model.FhirBoolean(value); + RecallElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Recall"); } } @@ -2586,13 +2476,13 @@ public bool? Recall [DeclaredType(Type = typeof(Code))] [Binding("DeviceCorrectiveActionScope")] [DataMember] - public Code ScopeElement + public Code? ScopeElement { get { return _ScopeElement; } set { _ScopeElement = value; OnPropertyChanged("ScopeElement"); } } - private Code _ScopeElement; + private Code? _ScopeElement; /// /// model | lot-numbers | serial-numbers @@ -2601,13 +2491,10 @@ public Code ScopeEl [IgnoreDataMember] public Hl7.Fhir.Model.DeviceDefinition.DeviceCorrectiveActionScope? Scope { - get { return ScopeElement != null ? ScopeElement.Value : null; } + get => _ScopeElement?.Value; set { - if (value == null) - ScopeElement = null; - else - ScopeElement = new Code(value); + ScopeElement = value is null ? null : new Code(value); OnPropertyChanged("Scope"); } } @@ -2618,27 +2505,23 @@ public Hl7.Fhir.Model.DeviceDefinition.DeviceCorrectiveActionScope? Scope [FhirElement("period", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CorrectiveActionComponent; - - if (dest == null) - { + if(other is not CorrectiveActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RecallElement != null) dest.RecallElement = (Hl7.Fhir.Model.FhirBoolean)RecallElement.DeepCopyInternal(); - if(ScopeElement != null) dest.ScopeElement = (Code)ScopeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_RecallElement is not null) dest.RecallElement = (Hl7.Fhir.Model.FhirBoolean)_RecallElement.DeepCopyInternal(); + if(_ScopeElement is not null) dest.ScopeElement = (Code)_ScopeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2650,48 +2533,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CorrectiveActionComponent; - if(otherT == null) return false; + if(other is not CorrectiveActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RecallElement, otherT.RecallElement)) return false; - if(!comparer.Equals(ScopeElement, otherT.ScopeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; + if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "recall": - value = RecallElement; - return RecallElement is not null; + value = _RecallElement; + return _RecallElement is not null; case "scope": - value = ScopeElement; - return ScopeElement is not null; + value = _ScopeElement; + return _ScopeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "recall": - RecallElement = (Hl7.Fhir.Model.FhirBoolean)value; + RecallElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "scope": - ScopeElement = (Code)value; + ScopeElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -2702,9 +2585,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RecallElement is not null) yield return new KeyValuePair("recall",RecallElement); - if (ScopeElement is not null) yield return new KeyValuePair("scope",ScopeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_RecallElement is not null) yield return new KeyValuePair("recall",_RecallElement); + if (_ScopeElement is not null) yield return new KeyValuePair("scope",_ScopeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -2728,13 +2611,13 @@ public partial class ChargeItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("chargeItemCode", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference ChargeItemCode + public Hl7.Fhir.Model.CodeableReference? ChargeItemCode { get { return _ChargeItemCode; } set { _ChargeItemCode = value; OnPropertyChanged("ChargeItemCode"); } } - private Hl7.Fhir.Model.CodeableReference _ChargeItemCode; + private Hl7.Fhir.Model.CodeableReference? _ChargeItemCode; /// /// Coefficient applicable to the billing code. @@ -2742,26 +2625,26 @@ public Hl7.Fhir.Model.CodeableReference ChargeItemCode [FhirElement("count", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Count + public Hl7.Fhir.Model.Quantity? Count { get { return _Count; } set { _Count = value; OnPropertyChanged("Count"); } } - private Hl7.Fhir.Model.Quantity _Count; + private Hl7.Fhir.Model.Quantity? _Count; /// /// A specific time period in which this charge item applies. /// [FhirElement("effectivePeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The context to which this charge item applies. @@ -2771,26 +2654,22 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; protected internal override void CopyToInternal(Base other) { - var dest = other as ChargeItemComponent; - - if (dest == null) - { + if(other is not ChargeItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ChargeItemCode != null) dest.ChargeItemCode = (Hl7.Fhir.Model.CodeableReference)ChargeItemCode.DeepCopyInternal(); - if(Count != null) dest.Count = (Hl7.Fhir.Model.Quantity)Count.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); + if(_ChargeItemCode is not null) dest.ChargeItemCode = (Hl7.Fhir.Model.CodeableReference)_ChargeItemCode.DeepCopyInternal(); + if(_Count is not null) dest.Count = (Hl7.Fhir.Model.Quantity)_Count.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2802,55 +2681,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ChargeItemComponent; - if(otherT == null) return false; + if(other is not ChargeItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ChargeItemCode, otherT.ChargeItemCode)) return false; - if(!comparer.Equals(Count, otherT.Count)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ChargeItemCode, otherT._ChargeItemCode)) return false; + if(!comparer.Equals(_Count, otherT._Count)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "chargeItemCode": - value = ChargeItemCode; - return ChargeItemCode is not null; + value = _ChargeItemCode; + return _ChargeItemCode is not null; case "count": - value = Count; - return Count is not null; + value = _Count; + return _Count is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "chargeItemCode": - ChargeItemCode = (Hl7.Fhir.Model.CodeableReference)value; + ChargeItemCode = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "count": - Count = (Hl7.Fhir.Model.Quantity)value; + Count = (Hl7.Fhir.Model.Quantity?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2861,10 +2740,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ChargeItemCode is not null) yield return new KeyValuePair("chargeItemCode",ChargeItemCode); - if (Count is not null) yield return new KeyValuePair("count",Count); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); + if (_ChargeItemCode is not null) yield return new KeyValuePair("chargeItemCode",_ChargeItemCode); + if (_Count is not null) yield return new KeyValuePair("count",_Count); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); } } @@ -2874,28 +2753,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("description", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Additional information to describe the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2908,11 +2784,11 @@ public string Description [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Unique Device Identifier (UDI) Barcode string. @@ -2922,11 +2798,11 @@ public List Identifier [DataMember] public List UdiDeviceIdentifier { - get { if(_UdiDeviceIdentifier==null) _UdiDeviceIdentifier = new List(); return _UdiDeviceIdentifier; } + get => _UdiDeviceIdentifier ?? new List(); set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } - private List _UdiDeviceIdentifier; + private List? _UdiDeviceIdentifier; /// /// Regulatory identifier(s) associated with this device. @@ -2936,39 +2812,36 @@ public List UdiDev [DataMember] public List RegulatoryIdentifier { - get { if(_RegulatoryIdentifier==null) _RegulatoryIdentifier = new List(); return _RegulatoryIdentifier; } + get => _RegulatoryIdentifier ?? new List(); set { _RegulatoryIdentifier = value; OnPropertyChanged("RegulatoryIdentifier"); } } - private List _RegulatoryIdentifier; + private List? _RegulatoryIdentifier; /// /// The part number or catalog number of the device. /// [FhirElement("partNumber", Order=130, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString PartNumberElement + public Hl7.Fhir.Model.FhirString? PartNumberElement { get { return _PartNumberElement; } set { _PartNumberElement = value; OnPropertyChanged("PartNumberElement"); } } - private Hl7.Fhir.Model.FhirString _PartNumberElement; + private Hl7.Fhir.Model.FhirString? _PartNumberElement; /// /// The part number or catalog number of the device /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PartNumber + public string? PartNumber { - get { return PartNumberElement != null ? PartNumberElement.Value : null; } + get => _PartNumberElement?.Value; set { - if (value == null) - PartNumberElement = null; - else - PartNumberElement = new Hl7.Fhir.Model.FhirString(value); + PartNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PartNumber"); } } @@ -2980,13 +2853,13 @@ public string PartNumber [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; /// /// The name or names of the device as given by the manufacturer. @@ -2996,39 +2869,36 @@ public Hl7.Fhir.Model.ResourceReference Manufacturer [DataMember] public List DeviceName { - get { if(_DeviceName==null) _DeviceName = new List(); return _DeviceName; } + get => _DeviceName ?? new List(); set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } - private List _DeviceName; + private List? _DeviceName; /// /// The catalog or model number for the device for example as defined by the manufacturer. /// [FhirElement("modelNumber", InSummary=true, Order=160, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ModelNumberElement + public Hl7.Fhir.Model.FhirString? ModelNumberElement { get { return _ModelNumberElement; } set { _ModelNumberElement = value; OnPropertyChanged("ModelNumberElement"); } } - private Hl7.Fhir.Model.FhirString _ModelNumberElement; + private Hl7.Fhir.Model.FhirString? _ModelNumberElement; /// /// The catalog or model number for the device for example as defined by the manufacturer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ModelNumber + public string? ModelNumber { - get { return ModelNumberElement != null ? ModelNumberElement.Value : null; } + get => _ModelNumberElement?.Value; set { - if (value == null) - ModelNumberElement = null; - else - ModelNumberElement = new Hl7.Fhir.Model.FhirString(value); + ModelNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ModelNumber"); } } @@ -3041,11 +2911,11 @@ public string ModelNumber [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. @@ -3055,11 +2925,11 @@ public List Classificat [DataMember] public List ConformsTo { - get { if(_ConformsTo==null) _ConformsTo = new List(); return _ConformsTo; } + get => _ConformsTo ?? new List(); set { _ConformsTo = value; OnPropertyChanged("ConformsTo"); } } - private List _ConformsTo; + private List? _ConformsTo; /// /// A device, part of the current one. @@ -3069,11 +2939,11 @@ public List ConformsTo [DataMember] public List HasPart { - get { if(_HasPart==null) _HasPart = new List(); return _HasPart; } + get => _HasPart ?? new List(); set { _HasPart = value; OnPropertyChanged("HasPart"); } } - private List _HasPart; + private List? _HasPart; /// /// Information about the packaging of the device, i.e. how the device is packaged. @@ -3083,11 +2953,11 @@ public List HasPart [DataMember] public List Packaging { - get { if(_Packaging==null) _Packaging = new List(); return _Packaging; } + get => _Packaging ?? new List(); set { _Packaging = value; OnPropertyChanged("Packaging"); } } - private List _Packaging; + private List? _Packaging; /// /// The version of the device or software. @@ -3097,11 +2967,11 @@ public List Packaging [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// Safety characteristics of the device. @@ -3112,11 +2982,11 @@ public List Version [DataMember] public List Safety { - get { if(_Safety==null) _Safety = new List(); return _Safety; } + get => _Safety ?? new List(); set { _Safety = value; OnPropertyChanged("Safety"); } } - private List _Safety; + private List? _Safety; /// /// Shelf Life and storage information. @@ -3126,11 +2996,11 @@ public List Safety [DataMember] public List ShelfLifeStorage { - get { if(_ShelfLifeStorage==null) _ShelfLifeStorage = new List(); return _ShelfLifeStorage; } + get => _ShelfLifeStorage ?? new List(); set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } - private List _ShelfLifeStorage; + private List? _ShelfLifeStorage; /// /// Language code for the human-readable text strings produced by the device (all supported). @@ -3140,11 +3010,11 @@ public List ShelfLifeStorage [DataMember] public List LanguageCode { - get { if(_LanguageCode==null) _LanguageCode = new List(); return _LanguageCode; } + get => _LanguageCode ?? new List(); set { _LanguageCode = value; OnPropertyChanged("LanguageCode"); } } - private List _LanguageCode; + private List? _LanguageCode; /// /// Inherent, essentially fixed, characteristics of this kind of device, e.g., time properties, size, etc. @@ -3154,11 +3024,11 @@ public List LanguageCode [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Organization responsible for device. @@ -3167,13 +3037,13 @@ public List Property [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Details for human/organization for support. @@ -3183,11 +3053,11 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device. @@ -3197,11 +3067,11 @@ public List Contact [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; /// /// Device notes and comments. @@ -3211,11 +3081,11 @@ public List Link [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// A substance used to create the material(s) of which the device is made. @@ -3225,11 +3095,11 @@ public List Note [DataMember] public List Material { - get { if(_Material==null) _Material = new List(); return _Material; } + get => _Material ?? new List(); set { _Material = value; OnPropertyChanged("Material"); } } - private List _Material; + private List? _Material; /// /// lot-number | manufactured-date | serial-number | expiration-date | biological-source | software-version. @@ -3241,24 +3111,24 @@ public List Material [DataMember] public List> ProductionIdentifierInUDIElement { - get { if(_ProductionIdentifierInUDIElement==null) _ProductionIdentifierInUDIElement = new List>(); return _ProductionIdentifierInUDIElement; } + get => _ProductionIdentifierInUDIElement ?? new List>(); set { _ProductionIdentifierInUDIElement = value; OnPropertyChanged("ProductionIdentifierInUDIElement"); } } - private List> _ProductionIdentifierInUDIElement; + private List>? _ProductionIdentifierInUDIElement; /// /// lot-number | manufactured-date | serial-number | expiration-date | biological-source | software-version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProductionIdentifierInUDI + public IEnumerable? ProductionIdentifierInUDI { - get { return ProductionIdentifierInUDIElement != null ? ProductionIdentifierInUDIElement.Select(elem => elem.Value) : null; } + get => _ProductionIdentifierInUDIElement?.Select(elem => elem.Value); set { if (value == null) - ProductionIdentifierInUDIElement = null; + ProductionIdentifierInUDIElement = null!; else ProductionIdentifierInUDIElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("ProductionIdentifierInUDI"); @@ -3270,26 +3140,26 @@ public IEnumerable [FhirElement("guideline", Order=320)] [DataMember] - public Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent Guideline + public Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent? Guideline { get { return _Guideline; } set { _Guideline = value; OnPropertyChanged("Guideline"); } } - private Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent _Guideline; + private Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent? _Guideline; /// /// Tracking of latest field safety corrective action. /// [FhirElement("correctiveAction", Order=330)] [DataMember] - public Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent CorrectiveAction + public Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent? CorrectiveAction { get { return _CorrectiveAction; } set { _CorrectiveAction = value; OnPropertyChanged("CorrectiveAction"); } } - private Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent _CorrectiveAction; + private Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent? _CorrectiveAction; /// /// Billing code or reference associated with the device. @@ -3299,50 +3169,46 @@ public Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent CorrectiveActio [DataMember] public List ChargeItem { - get { if(_ChargeItem==null) _ChargeItem = new List(); return _ChargeItem; } + get => _ChargeItem ?? new List(); set { _ChargeItem = value; OnPropertyChanged("ChargeItem"); } } - private List _ChargeItem; + private List? _ChargeItem; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceDefinition; - - if (dest == null) - { + if(other is not DeviceDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(UdiDeviceIdentifier.Any()) dest.UdiDeviceIdentifier = new List(UdiDeviceIdentifier.DeepCopyInternal()); - if(RegulatoryIdentifier.Any()) dest.RegulatoryIdentifier = new List(RegulatoryIdentifier.DeepCopyInternal()); - if(PartNumberElement != null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)PartNumberElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); - if(DeviceName.Any()) dest.DeviceName = new List(DeviceName.DeepCopyInternal()); - if(ModelNumberElement != null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)ModelNumberElement.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(ConformsTo.Any()) dest.ConformsTo = new List(ConformsTo.DeepCopyInternal()); - if(HasPart.Any()) dest.HasPart = new List(HasPart.DeepCopyInternal()); - if(Packaging.Any()) dest.Packaging = new List(Packaging.DeepCopyInternal()); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(Safety.Any()) dest.Safety = new List(Safety.DeepCopyInternal()); - if(ShelfLifeStorage.Any()) dest.ShelfLifeStorage = new List(ShelfLifeStorage.DeepCopyInternal()); - if(LanguageCode.Any()) dest.LanguageCode = new List(LanguageCode.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Material.Any()) dest.Material = new List(Material.DeepCopyInternal()); - if(ProductionIdentifierInUDIElement.Any()) dest.ProductionIdentifierInUDIElement = new List>(ProductionIdentifierInUDIElement.DeepCopyInternal()); - if(Guideline != null) dest.Guideline = (Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent)Guideline.DeepCopyInternal(); - if(CorrectiveAction != null) dest.CorrectiveAction = (Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent)CorrectiveAction.DeepCopyInternal(); - if(ChargeItem.Any()) dest.ChargeItem = new List(ChargeItem.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_UdiDeviceIdentifier is not null) dest.UdiDeviceIdentifier = new List(_UdiDeviceIdentifier.DeepCopyInternal()); + if(_RegulatoryIdentifier is not null) dest.RegulatoryIdentifier = new List(_RegulatoryIdentifier.DeepCopyInternal()); + if(_PartNumberElement is not null) dest.PartNumberElement = (Hl7.Fhir.Model.FhirString)_PartNumberElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); + if(_DeviceName is not null) dest.DeviceName = new List(_DeviceName.DeepCopyInternal()); + if(_ModelNumberElement is not null) dest.ModelNumberElement = (Hl7.Fhir.Model.FhirString)_ModelNumberElement.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_ConformsTo is not null) dest.ConformsTo = new List(_ConformsTo.DeepCopyInternal()); + if(_HasPart is not null) dest.HasPart = new List(_HasPart.DeepCopyInternal()); + if(_Packaging is not null) dest.Packaging = new List(_Packaging.DeepCopyInternal()); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_Safety is not null) dest.Safety = new List(_Safety.DeepCopyInternal()); + if(_ShelfLifeStorage is not null) dest.ShelfLifeStorage = new List(_ShelfLifeStorage.DeepCopyInternal()); + if(_LanguageCode is not null) dest.LanguageCode = new List(_LanguageCode.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Material is not null) dest.Material = new List(_Material.DeepCopyInternal()); + if(_ProductionIdentifierInUDIElement is not null) dest.ProductionIdentifierInUDIElement = new List>(_ProductionIdentifierInUDIElement.DeepCopyInternal()); + if(_Guideline is not null) dest.Guideline = (Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent)_Guideline.DeepCopyInternal(); + if(_CorrectiveAction is not null) dest.CorrectiveAction = (Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent)_CorrectiveAction.DeepCopyInternal(); + if(_ChargeItem is not null) dest.ChargeItem = new List(_ChargeItem.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3354,209 +3220,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceDefinition; - if(otherT == null) return false; + if(other is not DeviceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(UdiDeviceIdentifier, otherT.UdiDeviceIdentifier)) return false; - if(!comparer.ListEquals(RegulatoryIdentifier, otherT.RegulatoryIdentifier)) return false; - if(!comparer.Equals(PartNumberElement, otherT.PartNumberElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(DeviceName, otherT.DeviceName)) return false; - if(!comparer.Equals(ModelNumberElement, otherT.ModelNumberElement)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(ConformsTo, otherT.ConformsTo)) return false; - if(!comparer.ListEquals(HasPart, otherT.HasPart)) return false; - if(!comparer.ListEquals(Packaging, otherT.Packaging)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(Safety, otherT.Safety)) return false; - if(!comparer.ListEquals(ShelfLifeStorage, otherT.ShelfLifeStorage)) return false; - if(!comparer.ListEquals(LanguageCode, otherT.LanguageCode)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Material, otherT.Material)) return false; - if(!comparer.ListEquals(ProductionIdentifierInUDIElement, otherT.ProductionIdentifierInUDIElement)) return false; - if(!comparer.Equals(Guideline, otherT.Guideline)) return false; - if(!comparer.Equals(CorrectiveAction, otherT.CorrectiveAction)) return false; - if(!comparer.ListEquals(ChargeItem, otherT.ChargeItem)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; + if(!comparer.ListEquals(_RegulatoryIdentifier, otherT._RegulatoryIdentifier)) return false; + if(!comparer.Equals(_PartNumberElement, otherT._PartNumberElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_DeviceName, otherT._DeviceName)) return false; + if(!comparer.Equals(_ModelNumberElement, otherT._ModelNumberElement)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_ConformsTo, otherT._ConformsTo)) return false; + if(!comparer.ListEquals(_HasPart, otherT._HasPart)) return false; + if(!comparer.ListEquals(_Packaging, otherT._Packaging)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; + if(!comparer.ListEquals(_ShelfLifeStorage, otherT._ShelfLifeStorage)) return false; + if(!comparer.ListEquals(_LanguageCode, otherT._LanguageCode)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Material, otherT._Material)) return false; + if(!comparer.ListEquals(_ProductionIdentifierInUDIElement, otherT._ProductionIdentifierInUDIElement)) return false; + if(!comparer.Equals(_Guideline, otherT._Guideline)) return false; + if(!comparer.Equals(_CorrectiveAction, otherT._CorrectiveAction)) return false; + if(!comparer.ListEquals(_ChargeItem, otherT._ChargeItem)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "udiDeviceIdentifier": - value = UdiDeviceIdentifier; - return UdiDeviceIdentifier?.Any() == true; + value = _UdiDeviceIdentifier; + return _UdiDeviceIdentifier?.Any() == true; case "regulatoryIdentifier": - value = RegulatoryIdentifier; - return RegulatoryIdentifier?.Any() == true; + value = _RegulatoryIdentifier; + return _RegulatoryIdentifier?.Any() == true; case "partNumber": - value = PartNumberElement; - return PartNumberElement is not null; + value = _PartNumberElement; + return _PartNumberElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "deviceName": - value = DeviceName; - return DeviceName?.Any() == true; + value = _DeviceName; + return _DeviceName?.Any() == true; case "modelNumber": - value = ModelNumberElement; - return ModelNumberElement is not null; + value = _ModelNumberElement; + return _ModelNumberElement is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "conformsTo": - value = ConformsTo; - return ConformsTo?.Any() == true; + value = _ConformsTo; + return _ConformsTo?.Any() == true; case "hasPart": - value = HasPart; - return HasPart?.Any() == true; + value = _HasPart; + return _HasPart?.Any() == true; case "packaging": - value = Packaging; - return Packaging?.Any() == true; + value = _Packaging; + return _Packaging?.Any() == true; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "safety": - value = Safety; - return Safety?.Any() == true; + value = _Safety; + return _Safety?.Any() == true; case "shelfLifeStorage": - value = ShelfLifeStorage; - return ShelfLifeStorage?.Any() == true; + value = _ShelfLifeStorage; + return _ShelfLifeStorage?.Any() == true; case "languageCode": - value = LanguageCode; - return LanguageCode?.Any() == true; + value = _LanguageCode; + return _LanguageCode?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "material": - value = Material; - return Material?.Any() == true; + value = _Material; + return _Material?.Any() == true; case "productionIdentifierInUDI": - value = ProductionIdentifierInUDIElement; - return ProductionIdentifierInUDIElement?.Any() == true; + value = _ProductionIdentifierInUDIElement; + return _ProductionIdentifierInUDIElement?.Any() == true; case "guideline": - value = Guideline; - return Guideline is not null; + value = _Guideline; + return _Guideline is not null; case "correctiveAction": - value = CorrectiveAction; - return CorrectiveAction is not null; + value = _CorrectiveAction; + return _CorrectiveAction is not null; case "chargeItem": - value = ChargeItem; - return ChargeItem?.Any() == true; + value = _ChargeItem; + return _ChargeItem?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "udiDeviceIdentifier": - UdiDeviceIdentifier = (List)value; + UdiDeviceIdentifier = (List?)value!; return this; case "regulatoryIdentifier": - RegulatoryIdentifier = (List)value; + RegulatoryIdentifier = (List?)value!; return this; case "partNumber": - PartNumberElement = (Hl7.Fhir.Model.FhirString)value; + PartNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "deviceName": - DeviceName = (List)value; + DeviceName = (List?)value!; return this; case "modelNumber": - ModelNumberElement = (Hl7.Fhir.Model.FhirString)value; + ModelNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "conformsTo": - ConformsTo = (List)value; + ConformsTo = (List?)value!; return this; case "hasPart": - HasPart = (List)value; + HasPart = (List?)value!; return this; case "packaging": - Packaging = (List)value; + Packaging = (List?)value!; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "safety": - Safety = (List)value; + Safety = (List?)value!; return this; case "shelfLifeStorage": - ShelfLifeStorage = (List)value; + ShelfLifeStorage = (List?)value!; return this; case "languageCode": - LanguageCode = (List)value; + LanguageCode = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "material": - Material = (List)value; + Material = (List?)value!; return this; case "productionIdentifierInUDI": - ProductionIdentifierInUDIElement = (List>)value; + ProductionIdentifierInUDIElement = (List>?)value!; return this; case "guideline": - Guideline = (Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent)value; + Guideline = (Hl7.Fhir.Model.DeviceDefinition.GuidelineComponent?)value; return this; case "correctiveAction": - CorrectiveAction = (Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent)value; + CorrectiveAction = (Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent?)value; return this; case "chargeItem": - ChargeItem = (List)value; + ChargeItem = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3567,32 +3433,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",UdiDeviceIdentifier); - if (RegulatoryIdentifier?.Any() == true) yield return new KeyValuePair("regulatoryIdentifier",RegulatoryIdentifier); - if (PartNumberElement is not null) yield return new KeyValuePair("partNumber",PartNumberElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",DeviceName); - if (ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",ModelNumberElement); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (ConformsTo?.Any() == true) yield return new KeyValuePair("conformsTo",ConformsTo); - if (HasPart?.Any() == true) yield return new KeyValuePair("hasPart",HasPart); - if (Packaging?.Any() == true) yield return new KeyValuePair("packaging",Packaging); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (Safety?.Any() == true) yield return new KeyValuePair("safety",Safety); - if (ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",ShelfLifeStorage); - if (LanguageCode?.Any() == true) yield return new KeyValuePair("languageCode",LanguageCode); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Material?.Any() == true) yield return new KeyValuePair("material",Material); - if (ProductionIdentifierInUDIElement?.Any() == true) yield return new KeyValuePair("productionIdentifierInUDI",ProductionIdentifierInUDIElement); - if (Guideline is not null) yield return new KeyValuePair("guideline",Guideline); - if (CorrectiveAction is not null) yield return new KeyValuePair("correctiveAction",CorrectiveAction); - if (ChargeItem?.Any() == true) yield return new KeyValuePair("chargeItem",ChargeItem); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_UdiDeviceIdentifier?.Any() == true) yield return new KeyValuePair("udiDeviceIdentifier",_UdiDeviceIdentifier); + if (_RegulatoryIdentifier?.Any() == true) yield return new KeyValuePair("regulatoryIdentifier",_RegulatoryIdentifier); + if (_PartNumberElement is not null) yield return new KeyValuePair("partNumber",_PartNumberElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_DeviceName?.Any() == true) yield return new KeyValuePair("deviceName",_DeviceName); + if (_ModelNumberElement is not null) yield return new KeyValuePair("modelNumber",_ModelNumberElement); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_ConformsTo?.Any() == true) yield return new KeyValuePair("conformsTo",_ConformsTo); + if (_HasPart?.Any() == true) yield return new KeyValuePair("hasPart",_HasPart); + if (_Packaging?.Any() == true) yield return new KeyValuePair("packaging",_Packaging); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_Safety?.Any() == true) yield return new KeyValuePair("safety",_Safety); + if (_ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",_ShelfLifeStorage); + if (_LanguageCode?.Any() == true) yield return new KeyValuePair("languageCode",_LanguageCode); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Material?.Any() == true) yield return new KeyValuePair("material",_Material); + if (_ProductionIdentifierInUDIElement?.Any() == true) yield return new KeyValuePair("productionIdentifierInUDI",_ProductionIdentifierInUDIElement); + if (_Guideline is not null) yield return new KeyValuePair("guideline",_Guideline); + if (_CorrectiveAction is not null) yield return new KeyValuePair("correctiveAction",_CorrectiveAction); + if (_ChargeItem?.Any() == true) yield return new KeyValuePair("chargeItem",_ChargeItem); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs index 9735d7e3f..857528786 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -144,13 +147,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("function", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual who was performing. @@ -160,26 +163,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson","CareTeam")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -191,41 +190,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -236,8 +235,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -250,11 +249,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The order or request that this dispense is fulfilling. @@ -266,11 +265,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// The bigger event that this dispense is a part of. @@ -282,11 +281,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown. @@ -296,13 +295,13 @@ public List PartOf [Binding("DeviceDispenseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown @@ -311,13 +310,10 @@ public Code StatusEleme [IgnoreDataMember] public Hl7.Fhir.Model.DeviceDispense.DeviceDispenseStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -328,13 +324,13 @@ public Hl7.Fhir.Model.DeviceDispense.DeviceDispenseStatusCodes? Status [FhirElement("statusReason", Order=130)] [Binding("DeviceDispenseStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableReference StatusReason + public Hl7.Fhir.Model.CodeableReference? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableReference _StatusReason; + private Hl7.Fhir.Model.CodeableReference? _StatusReason; /// /// Type of device dispense. @@ -344,11 +340,11 @@ public Hl7.Fhir.Model.CodeableReference StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What device was supplied. @@ -356,13 +352,13 @@ public List Category [FhirElement("device", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Device + public Hl7.Fhir.Model.CodeableReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.CodeableReference _Device; + private Hl7.Fhir.Model.CodeableReference? _Device; /// /// Who the dispense is for. @@ -372,13 +368,13 @@ public Hl7.Fhir.Model.CodeableReference Device [References("Patient","Practitioner")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Who collected the device or where the medication was delivered. @@ -387,13 +383,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Patient","Practitioner","RelatedPerson","Location","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Receiver + public Hl7.Fhir.Model.ResourceReference? Receiver { get { return _Receiver; } set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private Hl7.Fhir.Model.ResourceReference _Receiver; + private Hl7.Fhir.Model.ResourceReference? _Receiver; /// /// Encounter associated with event. @@ -402,13 +398,13 @@ public Hl7.Fhir.Model.ResourceReference Receiver [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Information that supports the dispensing of the device. @@ -420,11 +416,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Who performed event. @@ -434,11 +430,11 @@ public List SupportingInformation [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the dispense occurred. @@ -447,67 +443,64 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Trial fill, partial fill, emergency fill, etc. /// [FhirElement("type", Order=220)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount dispensed. /// [FhirElement("quantity", Order=230)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// When product was packaged and reviewed. /// [FhirElement("preparedDate", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PreparedDateElement + public Hl7.Fhir.Model.FhirDateTime? PreparedDateElement { get { return _PreparedDateElement; } set { _PreparedDateElement = value; OnPropertyChanged("PreparedDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PreparedDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PreparedDateElement; /// /// When product was packaged and reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreparedDate + public string? PreparedDate { - get { return PreparedDateElement != null ? PreparedDateElement.Value : null; } + get => _PreparedDateElement?.Value; set { - if (value == null) - PreparedDateElement = null; - else - PreparedDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PreparedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PreparedDate"); } } @@ -517,28 +510,25 @@ public string PreparedDate /// [FhirElement("whenHandedOver", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenHandedOverElement + public Hl7.Fhir.Model.FhirDateTime? WhenHandedOverElement { get { return _WhenHandedOverElement; } set { _WhenHandedOverElement = value; OnPropertyChanged("WhenHandedOverElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenHandedOverElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenHandedOverElement; /// /// When product was given out /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenHandedOver + public string? WhenHandedOver { - get { return WhenHandedOverElement != null ? WhenHandedOverElement.Value : null; } + get => _WhenHandedOverElement?.Value; set { - if (value == null) - WhenHandedOverElement = null; - else - WhenHandedOverElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenHandedOverElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenHandedOver"); } } @@ -550,13 +540,13 @@ public string WhenHandedOver [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Information about the dispense. @@ -566,39 +556,36 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Full representation of the usage instructions. /// [FhirElement("usageInstruction", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown UsageInstructionElement + public Hl7.Fhir.Model.Markdown? UsageInstructionElement { get { return _UsageInstructionElement; } set { _UsageInstructionElement = value; OnPropertyChanged("UsageInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _UsageInstructionElement; + private Hl7.Fhir.Model.Markdown? _UsageInstructionElement; /// /// Full representation of the usage instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string UsageInstruction + public string? UsageInstruction { - get { return UsageInstructionElement != null ? UsageInstructionElement.Value : null; } + get => _UsageInstructionElement?.Value; set { - if (value == null) - UsageInstructionElement = null; - else - UsageInstructionElement = new Hl7.Fhir.Model.Markdown(value); + UsageInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("UsageInstruction"); } } @@ -613,45 +600,41 @@ public string UsageInstruction [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceDispense; - - if (dest == null) - { + if(other is not DeviceDispense dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableReference)StatusReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Device != null) dest.Device = (Hl7.Fhir.Model.CodeableReference)Device.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Receiver != null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)Receiver.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(PreparedDateElement != null) dest.PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime)PreparedDateElement.DeepCopyInternal(); - if(WhenHandedOverElement != null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UsageInstructionElement != null) dest.UsageInstructionElement = (Hl7.Fhir.Model.Markdown)UsageInstructionElement.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableReference)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.CodeableReference)_Device.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)_Receiver.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_PreparedDateElement is not null) dest.PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime)_PreparedDateElement.DeepCopyInternal(); + if(_WhenHandedOverElement is not null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)_WhenHandedOverElement.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UsageInstructionElement is not null) dest.UsageInstructionElement = (Hl7.Fhir.Model.Markdown)_UsageInstructionElement.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -663,174 +646,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceDispense; - if(otherT == null) return false; + if(other is not DeviceDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Receiver, otherT.Receiver)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(PreparedDateElement, otherT.PreparedDateElement)) return false; - if(!comparer.Equals(WhenHandedOverElement, otherT.WhenHandedOverElement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(UsageInstructionElement, otherT.UsageInstructionElement)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_PreparedDateElement, otherT._PreparedDateElement)) return false; + if(!comparer.Equals(_WhenHandedOverElement, otherT._WhenHandedOverElement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_UsageInstructionElement, otherT._UsageInstructionElement)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "receiver": - value = Receiver; - return Receiver is not null; + value = _Receiver; + return _Receiver is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "preparedDate": - value = PreparedDateElement; - return PreparedDateElement is not null; + value = _PreparedDateElement; + return _PreparedDateElement is not null; case "whenHandedOver": - value = WhenHandedOverElement; - return WhenHandedOverElement is not null; + value = _WhenHandedOverElement; + return _WhenHandedOverElement is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "usageInstruction": - value = UsageInstructionElement; - return UsageInstructionElement is not null; + value = _UsageInstructionElement; + return _UsageInstructionElement is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableReference)value; + StatusReason = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "device": - Device = (Hl7.Fhir.Model.CodeableReference)value; + Device = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (Hl7.Fhir.Model.ResourceReference)value; + Receiver = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "preparedDate": - PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PreparedDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "whenHandedOver": - WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "usageInstruction": - UsageInstructionElement = (Hl7.Fhir.Model.Markdown)value; + UsageInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -841,27 +824,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Receiver is not null) yield return new KeyValuePair("receiver",Receiver); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (PreparedDateElement is not null) yield return new KeyValuePair("preparedDate",PreparedDateElement); - if (WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",WhenHandedOverElement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UsageInstructionElement is not null) yield return new KeyValuePair("usageInstruction",UsageInstructionElement); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Receiver is not null) yield return new KeyValuePair("receiver",_Receiver); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_PreparedDateElement is not null) yield return new KeyValuePair("preparedDate",_PreparedDateElement); + if (_WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",_WhenHandedOverElement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UsageInstructionElement is not null) yield return new KeyValuePair("usageInstruction",_UsageInstructionElement); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs index 95fca7667..093773b01 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -216,13 +219,13 @@ public partial class CalibrationComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// unspecified | offset | gain | two-point @@ -231,13 +234,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -249,13 +249,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationType? Type [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricCalibrationState")] [DataMember] - public Code StateElement + public Code? StateElement { get { return _StateElement; } set { _StateElement = value; OnPropertyChanged("StateElement"); } } - private Code _StateElement; + private Code? _StateElement; /// /// not-calibrated | calibration-required | calibrated | unspecified @@ -264,13 +264,10 @@ public Code StateEleme [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State { - get { return StateElement != null ? StateElement.Value : null; } + get => _StateElement?.Value; set { - if (value == null) - StateElement = null; - else - StateElement = new Code(value); + StateElement = value is null ? null : new Code(value); OnPropertyChanged("State"); } } @@ -280,13 +277,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCalibrationState? State /// [FhirElement("time", Order=60)] [DataMember] - public Hl7.Fhir.Model.Instant TimeElement + public Hl7.Fhir.Model.Instant? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.Instant _TimeElement; + private Hl7.Fhir.Model.Instant? _TimeElement; /// /// Describes the time last calibration has been performed @@ -295,30 +292,23 @@ public Hl7.Fhir.Model.Instant TimeElement [IgnoreDataMember] public DateTimeOffset? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.Instant(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Time"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CalibrationComponent; - - if (dest == null) - { + if(other is not CalibrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(StateElement != null) dest.StateElement = (Code)StateElement.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.Instant)TimeElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_StateElement is not null) dest.StateElement = (Code)_StateElement.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.Instant)_TimeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -330,48 +320,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CalibrationComponent; - if(otherT == null) return false; + if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(StateElement, otherT.StateElement)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "state": - value = StateElement; - return StateElement is not null; + value = _StateElement; + return _StateElement is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "state": - StateElement = (Code)value; + StateElement = (Code?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.Instant)value; + TimeElement = (Hl7.Fhir.Model.Instant?)value; return this; default: return base.SetValue(key, value); @@ -382,9 +372,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (StateElement is not null) yield return new KeyValuePair("state",StateElement); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_StateElement is not null) yield return new KeyValuePair("state",_StateElement); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); } } @@ -397,11 +387,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identity of metric, for example Heart Rate or PEEP Setting. @@ -410,13 +400,13 @@ public List Identifier [Binding("MetricType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Unit of Measure for the Metric. @@ -424,13 +414,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("unit", InSummary=true, Order=110)] [Binding("MetricUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Describes the link to the Device. @@ -440,13 +430,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// on | off | standby | entered-in-error. @@ -455,13 +445,13 @@ public Hl7.Fhir.Model.ResourceReference Device [DeclaredType(Type = typeof(Code))] [Binding("DeviceMetricOperationalStatus")] [DataMember] - public Code OperationalStatusElement + public Code? OperationalStatusElement { get { return _OperationalStatusElement; } set { _OperationalStatusElement = value; OnPropertyChanged("OperationalStatusElement"); } } - private Code _OperationalStatusElement; + private Code? _OperationalStatusElement; /// /// on | off | standby | entered-in-error @@ -470,13 +460,10 @@ public Code Operation [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalStatus { - get { return OperationalStatusElement != null ? OperationalStatusElement.Value : null; } + get => _OperationalStatusElement?.Value; set { - if (value == null) - OperationalStatusElement = null; - else - OperationalStatusElement = new Code(value); + OperationalStatusElement = value is null ? null : new Code(value); OnPropertyChanged("OperationalStatus"); } } @@ -486,28 +473,25 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricOperationalStatus? OperationalSta /// [FhirElement("color", Order=140)] [DataMember] - public Hl7.Fhir.Model.Code ColorElement + public Hl7.Fhir.Model.Code? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Hl7.Fhir.Model.Code _ColorElement; + private Hl7.Fhir.Model.Code? _ColorElement; /// /// Color name (from CSS4) or #RRGGBB code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Color + public string? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Hl7.Fhir.Model.Code(value); + ColorElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Color"); } } @@ -520,13 +504,13 @@ public string Color [Binding("DeviceMetricCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// measurement | setting | calculation | unspecified @@ -535,13 +519,10 @@ public Code CategoryElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -551,13 +532,13 @@ public Hl7.Fhir.Model.DeviceMetric.DeviceMetricCategory? Category /// [FhirElement("measurementFrequency", Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity MeasurementFrequency + public Hl7.Fhir.Model.Quantity? MeasurementFrequency { get { return _MeasurementFrequency; } set { _MeasurementFrequency = value; OnPropertyChanged("MeasurementFrequency"); } } - private Hl7.Fhir.Model.Quantity _MeasurementFrequency; + private Hl7.Fhir.Model.Quantity? _MeasurementFrequency; /// /// Describes the calibrations that have been performed or that are required to be performed. @@ -567,33 +548,29 @@ public Hl7.Fhir.Model.Quantity MeasurementFrequency [DataMember] public List Calibration { - get { if(_Calibration==null) _Calibration = new List(); return _Calibration; } + get => _Calibration ?? new List(); set { _Calibration = value; OnPropertyChanged("Calibration"); } } - private List _Calibration; + private List? _Calibration; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceMetric; - - if (dest == null) - { + if(other is not DeviceMetric dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(OperationalStatusElement != null) dest.OperationalStatusElement = (Code)OperationalStatusElement.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Hl7.Fhir.Model.Code)ColorElement.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(MeasurementFrequency != null) dest.MeasurementFrequency = (Hl7.Fhir.Model.Quantity)MeasurementFrequency.DeepCopyInternal(); - if(Calibration.Any()) dest.Calibration = new List(Calibration.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_OperationalStatusElement is not null) dest.OperationalStatusElement = (Code)_OperationalStatusElement.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Hl7.Fhir.Model.Code)_ColorElement.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_MeasurementFrequency is not null) dest.MeasurementFrequency = (Hl7.Fhir.Model.Quantity)_MeasurementFrequency.DeepCopyInternal(); + if(_Calibration is not null) dest.Calibration = new List(_Calibration.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -605,90 +582,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceMetric; - if(otherT == null) return false; + if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(OperationalStatusElement, otherT.OperationalStatusElement)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.Equals(MeasurementFrequency, otherT.MeasurementFrequency)) return false; - if(!comparer.ListEquals(Calibration, otherT.Calibration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_OperationalStatusElement, otherT._OperationalStatusElement)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.Equals(_MeasurementFrequency, otherT._MeasurementFrequency)) return false; + if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "operationalStatus": - value = OperationalStatusElement; - return OperationalStatusElement is not null; + value = _OperationalStatusElement; + return _OperationalStatusElement is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "measurementFrequency": - value = MeasurementFrequency; - return MeasurementFrequency is not null; + value = _MeasurementFrequency; + return _MeasurementFrequency is not null; case "calibration": - value = Calibration; - return Calibration?.Any() == true; + value = _Calibration; + return _Calibration?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "operationalStatus": - OperationalStatusElement = (Code)value; + OperationalStatusElement = (Code?)value; return this; case "color": - ColorElement = (Hl7.Fhir.Model.Code)value; + ColorElement = (Hl7.Fhir.Model.Code?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "measurementFrequency": - MeasurementFrequency = (Hl7.Fhir.Model.Quantity)value; + MeasurementFrequency = (Hl7.Fhir.Model.Quantity?)value; return this; case "calibration": - Calibration = (List)value; + Calibration = (List?)value!; return this; default: return base.SetValue(key, value); @@ -699,15 +676,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",OperationalStatusElement); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (MeasurementFrequency is not null) yield return new KeyValuePair("measurementFrequency",MeasurementFrequency); - if (Calibration?.Any() == true) yield return new KeyValuePair("calibration",Calibration); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_OperationalStatusElement is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatusElement); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_MeasurementFrequency is not null) yield return new KeyValuePair("measurementFrequency",_MeasurementFrequency); + if (_Calibration?.Any() == true) yield return new KeyValuePair("calibration",_Calibration); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs index 5ca0d0b8d..ced971a57 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40, FiveWs="FiveWs.what[x]")] [Binding("ParameterCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value of detail. @@ -96,26 +99,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirBoolean))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -127,41 +126,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -172,8 +171,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -186,11 +185,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -200,24 +199,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -232,24 +231,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -266,11 +265,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -282,24 +281,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Identifier of composite request. /// [FhirElement("groupIdentifier", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -308,13 +307,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DeclaredType(Type = typeof(Code))] [Binding("DeviceRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -323,13 +322,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -342,13 +338,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -357,13 +353,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -375,13 +368,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -390,13 +383,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -406,13 +396,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if the request is to stop or not to start using the device @@ -421,13 +411,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -439,26 +426,26 @@ public bool? DoNotPerform [Binding("DeviceRequestCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Code + public Hl7.Fhir.Model.CodeableReference? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableReference _Code; + private Hl7.Fhir.Model.CodeableReference? _Code; /// /// Quantity of devices to supply. /// [FhirElement("quantity", Order=200)] [DataMember] - public Hl7.Fhir.Model.Integer QuantityElement + public Hl7.Fhir.Model.Integer? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.Integer _QuantityElement; + private Hl7.Fhir.Model.Integer? _QuantityElement; /// /// Quantity of devices to supply @@ -467,13 +454,10 @@ public Hl7.Fhir.Model.Integer QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.Integer(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Quantity"); } } @@ -486,11 +470,11 @@ public int? Quantity [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Focus of request. @@ -500,13 +484,13 @@ public List Parameter [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter motivating request. @@ -515,13 +499,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Desired time or schedule for use. @@ -530,41 +514,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When recorded. /// [FhirElement("authoredOn", InSummary=true, Order=250, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -576,26 +557,26 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Requested Filler. /// [FhirElement("performer", InSummary=true, Order=270, FiveWs="FiveWs.actor")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Performer + public Hl7.Fhir.Model.CodeableReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.CodeableReference _Performer; + private Hl7.Fhir.Model.CodeableReference? _Performer; /// /// Coded/Linked Reason for request. @@ -606,24 +587,24 @@ public Hl7.Fhir.Model.CodeableReference Performer [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// PRN status of request. /// [FhirElement("asNeeded", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AsNeededElement + public Hl7.Fhir.Model.FhirBoolean? AsNeededElement { get { return _AsNeededElement; } set { _AsNeededElement = value; OnPropertyChanged("AsNeededElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AsNeededElement; + private Hl7.Fhir.Model.FhirBoolean? _AsNeededElement; /// /// PRN status of request @@ -632,13 +613,10 @@ public Hl7.Fhir.Model.FhirBoolean AsNeededElement [IgnoreDataMember] public bool? AsNeeded { - get { return AsNeededElement != null ? AsNeededElement.Value : null; } + get => _AsNeededElement?.Value; set { - if (value == null) - AsNeededElement = null; - else - AsNeededElement = new Hl7.Fhir.Model.FhirBoolean(value); + AsNeededElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AsNeeded"); } } @@ -648,13 +626,13 @@ public bool? AsNeeded /// [FhirElement("asNeededFor", Order=300)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AsNeededFor + public Hl7.Fhir.Model.CodeableConcept? AsNeededFor { get { return _AsNeededFor; } set { _AsNeededFor = value; OnPropertyChanged("AsNeededFor"); } } - private Hl7.Fhir.Model.CodeableConcept _AsNeededFor; + private Hl7.Fhir.Model.CodeableConcept? _AsNeededFor; /// /// Associated insurance coverage. @@ -666,11 +644,11 @@ public Hl7.Fhir.Model.CodeableConcept AsNeededFor [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Additional clinical information. @@ -682,11 +660,11 @@ public List Insurance [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Notes or comments. @@ -696,11 +674,11 @@ public List SupportingInfo [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Request provenance. @@ -712,50 +690,46 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceRequest; - - if (dest == null) - { + if(other is not DeviceRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableReference)Code.DeepCopyInternal(); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)QuantityElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.CodeableReference)Performer.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(AsNeededElement != null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)AsNeededElement.DeepCopyInternal(); - if(AsNeededFor != null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)AsNeededFor.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableReference)_Code.DeepCopyInternal(); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)_QuantityElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.CodeableReference)_Performer.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_AsNeededElement is not null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)_AsNeededElement.DeepCopyInternal(); + if(_AsNeededFor is not null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)_AsNeededFor.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -767,209 +741,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceRequest; - if(otherT == null) return false; + if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(AsNeededElement, otherT.AsNeededElement)) return false; - if(!comparer.Equals(AsNeededFor, otherT.AsNeededFor)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; + if(!comparer.Equals(_AsNeededFor, otherT._AsNeededFor)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "asNeeded": - value = AsNeededElement; - return AsNeededElement is not null; + value = _AsNeededElement; + return _AsNeededElement is not null; case "asNeededFor": - value = AsNeededFor; - return AsNeededFor is not null; + value = _AsNeededFor; + return _AsNeededFor is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableReference)value; + Code = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.Integer)value; + QuantityElement = (Hl7.Fhir.Model.Integer?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.CodeableReference)value; + Performer = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "asNeeded": - AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)value; + AsNeededElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "asNeededFor": - AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)value; + AsNeededFor = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -980,32 +954,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (AsNeededElement is not null) yield return new KeyValuePair("asNeeded",AsNeededElement); - if (AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",AsNeededFor); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_AsNeededElement is not null) yield return new KeyValuePair("asNeeded",_AsNeededElement); + if (_AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",_AsNeededFor); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs index 6a540a672..80e5bed63 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -134,13 +137,13 @@ public partial class AdherenceComponent : Hl7.Fhir.Model.BackboneElement [Binding("DeviceUsageAdherenceCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// lost | stolen | prescribed | broken | burned | forgot. @@ -151,24 +154,20 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as AdherenceComponent; - - if (dest == null) - { + if(other is not AdherenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -180,41 +179,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdherenceComponent; - if(otherT == null) return false; + if(other is not AdherenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; default: return base.SetValue(key, value); @@ -225,8 +224,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); } } @@ -239,11 +238,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -255,11 +254,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// active | completed | not-done | entered-in-error +. @@ -269,13 +268,13 @@ public List BasedOn [Binding("DeviceUsageStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | completed | not-done | entered-in-error + @@ -284,13 +283,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.DeviceUsage.DeviceUsageStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -303,11 +299,11 @@ public Hl7.Fhir.Model.DeviceUsage.DeviceUsageStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Patient using device. @@ -317,13 +313,13 @@ public List Category [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Supporting information. @@ -335,11 +331,11 @@ public Hl7.Fhir.Model.ResourceReference Patient [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// The encounter or episode of care that establishes the context for this device use statement. @@ -348,13 +344,13 @@ public List DerivedFrom [CLSCompliant(false)] [References("Encounter","EpisodeOfCare")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Context + public Hl7.Fhir.Model.ResourceReference? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.ResourceReference _Context; + private Hl7.Fhir.Model.ResourceReference? _Context; /// /// How often the device was used. @@ -363,41 +359,38 @@ public Hl7.Fhir.Model.ResourceReference Context [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// When the statement was made (and recorded). /// [FhirElement("dateAsserted", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateAssertedElement + public Hl7.Fhir.Model.FhirDateTime? DateAssertedElement { get { return _DateAssertedElement; } set { _DateAssertedElement = value; OnPropertyChanged("DateAssertedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateAssertedElement; + private Hl7.Fhir.Model.FhirDateTime? _DateAssertedElement; /// /// When the statement was made (and recorded) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateAsserted + public string? DateAsserted { - get { return DateAssertedElement != null ? DateAssertedElement.Value : null; } + get => _DateAssertedElement?.Value; set { - if (value == null) - DateAssertedElement = null; - else - DateAssertedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateAssertedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateAsserted"); } } @@ -408,13 +401,13 @@ public string DateAsserted [FhirElement("usageStatus", Order=180)] [Binding("DeviceUsageStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UsageStatus + public Hl7.Fhir.Model.CodeableConcept? UsageStatus { get { return _UsageStatus; } set { _UsageStatus = value; OnPropertyChanged("UsageStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _UsageStatus; + private Hl7.Fhir.Model.CodeableConcept? _UsageStatus; /// /// The reason for asserting the usage status - for example forgot, lost, stolen, broken. @@ -424,24 +417,24 @@ public Hl7.Fhir.Model.CodeableConcept UsageStatus [DataMember] public List UsageReason { - get { if(_UsageReason==null) _UsageReason = new List(); return _UsageReason; } + get => _UsageReason ?? new List(); set { _UsageReason = value; OnPropertyChanged("UsageReason"); } } - private List _UsageReason; + private List? _UsageReason; /// /// How device is being used. /// [FhirElement("adherence", Order=200)] [DataMember] - public Hl7.Fhir.Model.DeviceUsage.AdherenceComponent Adherence + public Hl7.Fhir.Model.DeviceUsage.AdherenceComponent? Adherence { get { return _Adherence; } set { _Adherence = value; OnPropertyChanged("Adherence"); } } - private Hl7.Fhir.Model.DeviceUsage.AdherenceComponent _Adherence; + private Hl7.Fhir.Model.DeviceUsage.AdherenceComponent? _Adherence; /// /// Who made the statement. @@ -450,13 +443,13 @@ public Hl7.Fhir.Model.DeviceUsage.AdherenceComponent Adherence [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InformationSource + public Hl7.Fhir.Model.ResourceReference? InformationSource { get { return _InformationSource; } set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private Hl7.Fhir.Model.ResourceReference _InformationSource; + private Hl7.Fhir.Model.ResourceReference? _InformationSource; /// /// Code or Reference to device used. @@ -464,13 +457,13 @@ public Hl7.Fhir.Model.ResourceReference InformationSource [FhirElement("device", InSummary=true, Order=220, FiveWs="FiveWs.actor")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Device + public Hl7.Fhir.Model.CodeableReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.CodeableReference _Device; + private Hl7.Fhir.Model.CodeableReference? _Device; /// /// Why device was used. @@ -480,11 +473,11 @@ public Hl7.Fhir.Model.CodeableReference Device [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Target body site. @@ -492,13 +485,13 @@ public List Reason [FhirElement("bodySite", InSummary=true, Order=240)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableReference BodySite + public Hl7.Fhir.Model.CodeableReference? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableReference _BodySite; + private Hl7.Fhir.Model.CodeableReference? _BodySite; /// /// Addition details (comments, instructions). @@ -508,41 +501,37 @@ public Hl7.Fhir.Model.CodeableReference BodySite [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceUsage; - - if (dest == null) - { + if(other is not DeviceUsage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Context != null) dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(DateAssertedElement != null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopyInternal(); - if(UsageStatus != null) dest.UsageStatus = (Hl7.Fhir.Model.CodeableConcept)UsageStatus.DeepCopyInternal(); - if(UsageReason.Any()) dest.UsageReason = new List(UsageReason.DeepCopyInternal()); - if(Adherence != null) dest.Adherence = (Hl7.Fhir.Model.DeviceUsage.AdherenceComponent)Adherence.DeepCopyInternal(); - if(InformationSource != null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)InformationSource.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.CodeableReference)Device.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)BodySite.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.ResourceReference)_Context.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_DateAssertedElement is not null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)_DateAssertedElement.DeepCopyInternal(); + if(_UsageStatus is not null) dest.UsageStatus = (Hl7.Fhir.Model.CodeableConcept)_UsageStatus.DeepCopyInternal(); + if(_UsageReason is not null) dest.UsageReason = new List(_UsageReason.DeepCopyInternal()); + if(_Adherence is not null) dest.Adherence = (Hl7.Fhir.Model.DeviceUsage.AdherenceComponent)_Adherence.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = (Hl7.Fhir.Model.ResourceReference)_InformationSource.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.CodeableReference)_Device.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)_BodySite.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -554,146 +543,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceUsage; - if(otherT == null) return false; + if(other is not DeviceUsage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(DateAssertedElement, otherT.DateAssertedElement)) return false; - if(!comparer.Equals(UsageStatus, otherT.UsageStatus)) return false; - if(!comparer.ListEquals(UsageReason, otherT.UsageReason)) return false; - if(!comparer.Equals(Adherence, otherT.Adherence)) return false; - if(!comparer.Equals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_DateAssertedElement, otherT._DateAssertedElement)) return false; + if(!comparer.Equals(_UsageStatus, otherT._UsageStatus)) return false; + if(!comparer.ListEquals(_UsageReason, otherT._UsageReason)) return false; + if(!comparer.Equals(_Adherence, otherT._Adherence)) return false; + if(!comparer.Equals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "dateAsserted": - value = DateAssertedElement; - return DateAssertedElement is not null; + value = _DateAssertedElement; + return _DateAssertedElement is not null; case "usageStatus": - value = UsageStatus; - return UsageStatus is not null; + value = _UsageStatus; + return _UsageStatus is not null; case "usageReason": - value = UsageReason; - return UsageReason?.Any() == true; + value = _UsageReason; + return _UsageReason?.Any() == true; case "adherence": - value = Adherence; - return Adherence is not null; + value = _Adherence; + return _Adherence is not null; case "informationSource": - value = InformationSource; - return InformationSource is not null; + value = _InformationSource; + return _InformationSource is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "context": - Context = (Hl7.Fhir.Model.ResourceReference)value; + Context = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "dateAsserted": - DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "usageStatus": - UsageStatus = (Hl7.Fhir.Model.CodeableConcept)value; + UsageStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "usageReason": - UsageReason = (List)value; + UsageReason = (List?)value!; return this; case "adherence": - Adherence = (Hl7.Fhir.Model.DeviceUsage.AdherenceComponent)value; + Adherence = (Hl7.Fhir.Model.DeviceUsage.AdherenceComponent?)value; return this; case "informationSource": - InformationSource = (Hl7.Fhir.Model.ResourceReference)value; + InformationSource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.CodeableReference)value; + Device = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableReference)value; + BodySite = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -704,23 +693,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Context is not null) yield return new KeyValuePair("context",Context); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",DateAssertedElement); - if (UsageStatus is not null) yield return new KeyValuePair("usageStatus",UsageStatus); - if (UsageReason?.Any() == true) yield return new KeyValuePair("usageReason",UsageReason); - if (Adherence is not null) yield return new KeyValuePair("adherence",Adherence); - if (InformationSource is not null) yield return new KeyValuePair("informationSource",InformationSource); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",_DateAssertedElement); + if (_UsageStatus is not null) yield return new KeyValuePair("usageStatus",_UsageStatus); + if (_UsageReason?.Any() == true) yield return new KeyValuePair("usageReason",_UsageReason); + if (_Adherence is not null) yield return new KeyValuePair("adherence",_Adherence); + if (_InformationSource is not null) yield return new KeyValuePair("informationSource",_InformationSource); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs index b09260d59..5dfd2dd36 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -159,13 +162,13 @@ public partial class SupportingInfoComponent : Hl7.Fhir.Model.BackboneElement [Binding("DiagnosticReportSupportingInfoType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Supporting information reference. @@ -175,26 +178,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Procedure","Observation","DiagnosticReport","Citation")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInfoComponent; - - if (dest == null) - { + if(other is not SupportingInfoComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -206,41 +205,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInfoComponent; - if(otherT == null) return false; + if(other is not SupportingInfoComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -251,8 +250,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -278,28 +277,25 @@ public partial class MediaComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("comment", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comment about the image or data (e.g. explanation) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -312,26 +308,22 @@ public string Comment [References("DocumentReference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Link + public Hl7.Fhir.Model.ResourceReference? Link { get { return _Link; } set { _Link = value; OnPropertyChanged("Link"); } } - private Hl7.Fhir.Model.ResourceReference _Link; + private Hl7.Fhir.Model.ResourceReference? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as MediaComponent; - - if (dest == null) - { + if(other is not MediaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Link != null) dest.Link = (Hl7.Fhir.Model.ResourceReference)Link.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Link is not null) dest.Link = (Hl7.Fhir.Model.ResourceReference)_Link.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -343,41 +335,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MediaComponent; - if(otherT == null) return false; + if(other is not MediaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "link": - value = Link; - return Link is not null; + value = _Link; + return _Link is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "link": - Link = (Hl7.Fhir.Model.ResourceReference)value; + Link = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -388,8 +380,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Link is not null) yield return new KeyValuePair("link",Link); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Link is not null) yield return new KeyValuePair("link",_Link); } } @@ -402,11 +394,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// What was requested. @@ -418,11 +410,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// registered | partial | preliminary | modified | final | amended | corrected | appended | cancelled | entered-in-error | unknown. @@ -432,13 +424,13 @@ public List BasedOn [Binding("DiagnosticReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | partial | preliminary | modified | final | amended | corrected | appended | cancelled | entered-in-error | unknown @@ -447,13 +439,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -467,11 +456,11 @@ public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Name/Code for this diagnostic report. @@ -480,13 +469,13 @@ public List Category [Binding("DiagnosticReportCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The subject of the report - usually, but not always, the patient. @@ -495,13 +484,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location","Organization","Practitioner","Medication","Substance","BiologicallyDerivedProduct")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Health care event when test ordered. @@ -510,13 +499,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Clinically relevant time/time-period for report. @@ -525,26 +514,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// DateTime this version was made. /// [FhirElement("issued", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// DateTime this version was made @@ -553,13 +542,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -574,11 +560,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Primary result interpreter. @@ -590,11 +576,11 @@ public List Performer [DataMember] public List ResultsInterpreter { - get { if(_ResultsInterpreter==null) _ResultsInterpreter = new List(); return _ResultsInterpreter; } + get => _ResultsInterpreter ?? new List(); set { _ResultsInterpreter = value; OnPropertyChanged("ResultsInterpreter"); } } - private List _ResultsInterpreter; + private List? _ResultsInterpreter; /// /// Specimens this report is based on. @@ -606,11 +592,11 @@ public List ResultsInterpreter [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Observations. @@ -622,11 +608,11 @@ public List Specimen [DataMember] public List Result { - get { if(_Result==null) _Result = new List(); return _Result; } + get => _Result ?? new List(); set { _Result = value; OnPropertyChanged("Result"); } } - private List _Result; + private List? _Result; /// /// Comments about the diagnostic report. @@ -636,11 +622,11 @@ public List Result [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Reference to full details of an analysis associated with the diagnostic report. @@ -652,11 +638,11 @@ public List Note [DataMember] public List Study { - get { if(_Study==null) _Study = new List(); return _Study; } + get => _Study ?? new List(); set { _Study = value; OnPropertyChanged("Study"); } } - private List _Study; + private List? _Study; /// /// Additional information supporting the diagnostic report. @@ -666,11 +652,11 @@ public List Study [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Key images or data associated with this report. @@ -680,11 +666,11 @@ public List SupportingI [DataMember] public List Media { - get { if(_Media==null) _Media = new List(); return _Media; } + get => _Media ?? new List(); set { _Media = value; OnPropertyChanged("Media"); } } - private List _Media; + private List? _Media; /// /// Reference to a Composition resource for the DiagnosticReport structure. @@ -693,41 +679,38 @@ public List Media [CLSCompliant(false)] [References("Composition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Composition + public Hl7.Fhir.Model.ResourceReference? Composition { get { return _Composition; } set { _Composition = value; OnPropertyChanged("Composition"); } } - private Hl7.Fhir.Model.ResourceReference _Composition; + private Hl7.Fhir.Model.ResourceReference? _Composition; /// /// Clinical conclusion (interpretation) of test results. /// [FhirElement("conclusion", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown ConclusionElement + public Hl7.Fhir.Model.Markdown? ConclusionElement { get { return _ConclusionElement; } set { _ConclusionElement = value; OnPropertyChanged("ConclusionElement"); } } - private Hl7.Fhir.Model.Markdown _ConclusionElement; + private Hl7.Fhir.Model.Markdown? _ConclusionElement; /// /// Clinical conclusion (interpretation) of test results /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Conclusion + public string? Conclusion { - get { return ConclusionElement != null ? ConclusionElement.Value : null; } + get => _ConclusionElement?.Value; set { - if (value == null) - ConclusionElement = null; - else - ConclusionElement = new Hl7.Fhir.Model.Markdown(value); + ConclusionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Conclusion"); } } @@ -741,11 +724,11 @@ public string Conclusion [DataMember] public List ConclusionCode { - get { if(_ConclusionCode==null) _ConclusionCode = new List(); return _ConclusionCode; } + get => _ConclusionCode ?? new List(); set { _ConclusionCode = value; OnPropertyChanged("ConclusionCode"); } } - private List _ConclusionCode; + private List? _ConclusionCode; /// /// Entire report as issued. @@ -755,45 +738,41 @@ public List ConclusionCode [DataMember] public List PresentedForm { - get { if(_PresentedForm==null) _PresentedForm = new List(); return _PresentedForm; } + get => _PresentedForm ?? new List(); set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } - private List _PresentedForm; + private List? _PresentedForm; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosticReport; - - if (dest == null) - { + if(other is not DiagnosticReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(ResultsInterpreter.Any()) dest.ResultsInterpreter = new List(ResultsInterpreter.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(Result.Any()) dest.Result = new List(Result.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Study.Any()) dest.Study = new List(Study.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Media.Any()) dest.Media = new List(Media.DeepCopyInternal()); - if(Composition != null) dest.Composition = (Hl7.Fhir.Model.ResourceReference)Composition.DeepCopyInternal(); - if(ConclusionElement != null) dest.ConclusionElement = (Hl7.Fhir.Model.Markdown)ConclusionElement.DeepCopyInternal(); - if(ConclusionCode.Any()) dest.ConclusionCode = new List(ConclusionCode.DeepCopyInternal()); - if(PresentedForm.Any()) dest.PresentedForm = new List(PresentedForm.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_ResultsInterpreter is not null) dest.ResultsInterpreter = new List(_ResultsInterpreter.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_Result is not null) dest.Result = new List(_Result.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Study is not null) dest.Study = new List(_Study.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Media is not null) dest.Media = new List(_Media.DeepCopyInternal()); + if(_Composition is not null) dest.Composition = (Hl7.Fhir.Model.ResourceReference)_Composition.DeepCopyInternal(); + if(_ConclusionElement is not null) dest.ConclusionElement = (Hl7.Fhir.Model.Markdown)_ConclusionElement.DeepCopyInternal(); + if(_ConclusionCode is not null) dest.ConclusionCode = new List(_ConclusionCode.DeepCopyInternal()); + if(_PresentedForm is not null) dest.PresentedForm = new List(_PresentedForm.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -805,174 +784,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosticReport; - if(otherT == null) return false; + if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(ResultsInterpreter, otherT.ResultsInterpreter)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Study, otherT.Study)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Media, otherT.Media)) return false; - if(!comparer.Equals(Composition, otherT.Composition)) return false; - if(!comparer.Equals(ConclusionElement, otherT.ConclusionElement)) return false; - if(!comparer.ListEquals(ConclusionCode, otherT.ConclusionCode)) return false; - if(!comparer.ListEquals(PresentedForm, otherT.PresentedForm)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_ResultsInterpreter, otherT._ResultsInterpreter)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Study, otherT._Study)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Media, otherT._Media)) return false; + if(!comparer.Equals(_Composition, otherT._Composition)) return false; + if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; + if(!comparer.ListEquals(_ConclusionCode, otherT._ConclusionCode)) return false; + if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "resultsInterpreter": - value = ResultsInterpreter; - return ResultsInterpreter?.Any() == true; + value = _ResultsInterpreter; + return _ResultsInterpreter?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "result": - value = Result; - return Result?.Any() == true; + value = _Result; + return _Result?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "study": - value = Study; - return Study?.Any() == true; + value = _Study; + return _Study?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "media": - value = Media; - return Media?.Any() == true; + value = _Media; + return _Media?.Any() == true; case "composition": - value = Composition; - return Composition is not null; + value = _Composition; + return _Composition is not null; case "conclusion": - value = ConclusionElement; - return ConclusionElement is not null; + value = _ConclusionElement; + return _ConclusionElement is not null; case "conclusionCode": - value = ConclusionCode; - return ConclusionCode?.Any() == true; + value = _ConclusionCode; + return _ConclusionCode?.Any() == true; case "presentedForm": - value = PresentedForm; - return PresentedForm?.Any() == true; + value = _PresentedForm; + return _PresentedForm?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "resultsInterpreter": - ResultsInterpreter = (List)value; + ResultsInterpreter = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "result": - Result = (List)value; + Result = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "study": - Study = (List)value; + Study = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "media": - Media = (List)value; + Media = (List?)value!; return this; case "composition": - Composition = (Hl7.Fhir.Model.ResourceReference)value; + Composition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "conclusion": - ConclusionElement = (Hl7.Fhir.Model.Markdown)value; + ConclusionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "conclusionCode": - ConclusionCode = (List)value; + ConclusionCode = (List?)value!; return this; case "presentedForm": - PresentedForm = (List)value; + PresentedForm = (List?)value!; return this; default: return base.SetValue(key, value); @@ -983,27 +962,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (ResultsInterpreter?.Any() == true) yield return new KeyValuePair("resultsInterpreter",ResultsInterpreter); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (Result?.Any() == true) yield return new KeyValuePair("result",Result); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Study?.Any() == true) yield return new KeyValuePair("study",Study); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Media?.Any() == true) yield return new KeyValuePair("media",Media); - if (Composition is not null) yield return new KeyValuePair("composition",Composition); - if (ConclusionElement is not null) yield return new KeyValuePair("conclusion",ConclusionElement); - if (ConclusionCode?.Any() == true) yield return new KeyValuePair("conclusionCode",ConclusionCode); - if (PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",PresentedForm); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_ResultsInterpreter?.Any() == true) yield return new KeyValuePair("resultsInterpreter",_ResultsInterpreter); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_Result?.Any() == true) yield return new KeyValuePair("result",_Result); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Study?.Any() == true) yield return new KeyValuePair("study",_Study); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Media?.Any() == true) yield return new KeyValuePair("media",_Media); + if (_Composition is not null) yield return new KeyValuePair("composition",_Composition); + if (_ConclusionElement is not null) yield return new KeyValuePair("conclusion",_ConclusionElement); + if (_ConclusionCode?.Any() == true) yield return new KeyValuePair("conclusionCode",_ConclusionCode); + if (_PresentedForm?.Any() == true) yield return new KeyValuePair("presentedForm",_PresentedForm); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Distance.cs b/src/Hl7.Fhir.R5/Model/Generated/Distance.cs index 158612f28..0ba91d0f2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Distance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Distance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs index 3d6d2f838..03f1d1ab5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,41 +115,38 @@ public partial class AttesterComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentAttestationMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Mode + public Hl7.Fhir.Model.CodeableConcept? Mode { get { return _Mode; } set { _Mode = value; OnPropertyChanged("Mode"); } } - private Hl7.Fhir.Model.CodeableConcept _Mode; + private Hl7.Fhir.Model.CodeableConcept? _Mode; /// /// When the document was attested. /// [FhirElement("time", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime TimeElement + public Hl7.Fhir.Model.FhirDateTime? TimeElement { get { return _TimeElement; } set { _TimeElement = value; OnPropertyChanged("TimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _TimeElement; + private Hl7.Fhir.Model.FhirDateTime? _TimeElement; /// /// When the document was attested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Time + public string? Time { - get { return TimeElement != null ? TimeElement.Value : null; } + get => _TimeElement?.Value; set { - if (value == null) - TimeElement = null; - else - TimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + TimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Time"); } } @@ -158,27 +158,23 @@ public string Time [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as AttesterComponent; - - if (dest == null) - { + if(other is not AttesterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Mode != null) dest.Mode = (Hl7.Fhir.Model.CodeableConcept)Mode.DeepCopyInternal(); - if(TimeElement != null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)TimeElement.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Mode is not null) dest.Mode = (Hl7.Fhir.Model.CodeableConcept)_Mode.DeepCopyInternal(); + if(_TimeElement is not null) dest.TimeElement = (Hl7.Fhir.Model.FhirDateTime)_TimeElement.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -190,48 +186,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttesterComponent; - if(otherT == null) return false; + if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Mode, otherT.Mode)) return false; - if(!comparer.Equals(TimeElement, otherT.TimeElement)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Mode, otherT._Mode)) return false; + if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "mode": - value = Mode; - return Mode is not null; + value = _Mode; + return _Mode is not null; case "time": - value = TimeElement; - return TimeElement is not null; + value = _TimeElement; + return _TimeElement is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "mode": - Mode = (Hl7.Fhir.Model.CodeableConcept)value; + Mode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "time": - TimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + TimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -242,9 +238,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Mode is not null) yield return new KeyValuePair("mode",Mode); - if (TimeElement is not null) yield return new KeyValuePair("time",TimeElement); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Mode is not null) yield return new KeyValuePair("mode",_Mode); + if (_TimeElement is not null) yield return new KeyValuePair("time",_TimeElement); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -273,13 +269,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("DocumentRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Target of the relationship. @@ -289,26 +285,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("DocumentReference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -320,41 +312,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -365,8 +357,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -394,13 +386,13 @@ public partial class ContentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("attachment", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Attachment Attachment + public Hl7.Fhir.Model.Attachment? Attachment { get { return _Attachment; } set { _Attachment = value; OnPropertyChanged("Attachment"); } } - private Hl7.Fhir.Model.Attachment _Attachment; + private Hl7.Fhir.Model.Attachment? _Attachment; /// /// Content profile rules for the document. @@ -410,24 +402,20 @@ public Hl7.Fhir.Model.Attachment Attachment [DataMember] public List Profile { - get { if(_Profile==null) _Profile = new List(); return _Profile; } + get => _Profile ?? new List(); set { _Profile = value; OnPropertyChanged("Profile"); } } - private List _Profile; + private List? _Profile; protected internal override void CopyToInternal(Base other) { - var dest = other as ContentComponent; - - if (dest == null) - { + if(other is not ContentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Attachment != null) dest.Attachment = (Hl7.Fhir.Model.Attachment)Attachment.DeepCopyInternal(); - if(Profile.Any()) dest.Profile = new List(Profile.DeepCopyInternal()); + if(_Attachment is not null) dest.Attachment = (Hl7.Fhir.Model.Attachment)_Attachment.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = new List(_Profile.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -439,41 +427,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContentComponent; - if(otherT == null) return false; + if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Attachment, otherT.Attachment)) return false; - if(!comparer.ListEquals(Profile, otherT.Profile)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + if(!comparer.ListEquals(_Profile, otherT._Profile)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "attachment": - value = Attachment; - return Attachment is not null; + value = _Attachment; + return _Attachment is not null; case "profile": - value = Profile; - return Profile?.Any() == true; + value = _Profile; + return _Profile?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "attachment": - Attachment = (Hl7.Fhir.Model.Attachment)value; + Attachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "profile": - Profile = (List)value; + Profile = (List?)value!; return this; default: return base.SetValue(key, value); @@ -484,8 +472,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Attachment is not null) yield return new KeyValuePair("attachment",Attachment); - if (Profile?.Any() == true) yield return new KeyValuePair("profile",Profile); + if (_Attachment is not null) yield return new KeyValuePair("attachment",_Attachment); + if (_Profile?.Any() == true) yield return new KeyValuePair("profile",_Profile); } } @@ -517,25 +505,21 @@ public partial class ProfileComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ProfileComponent; - - if (dest == null) - { + if(other is not ProfileComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -547,34 +531,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProfileComponent; - if(otherT == null) return false; + if(other is not ProfileComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -585,7 +569,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -598,39 +582,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// An explicitly assigned identifer of a variation of the content in the DocumentReference. /// [FhirElement("version", InSummary=true, Order=100, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// An explicitly assigned identifer of a variation of the content in the DocumentReference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -645,11 +626,11 @@ public string Version [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// current | superseded | entered-in-error. @@ -659,13 +640,13 @@ public List BasedOn [Binding("DocumentReferenceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | superseded | entered-in-error @@ -674,13 +655,10 @@ public Code StatusElem [IgnoreDataMember] public Hl7.Fhir.Model.DocumentReference.DocumentReferenceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -692,13 +670,13 @@ public Hl7.Fhir.Model.DocumentReference.DocumentReferenceStatus? Status [DeclaredType(Type = typeof(Code))] [Binding("ReferredDocumentStatus")] [DataMember] - public Code DocStatusElement + public Code? DocStatusElement { get { return _DocStatusElement; } set { _DocStatusElement = value; OnPropertyChanged("DocStatusElement"); } } - private Code _DocStatusElement; + private Code? _DocStatusElement; /// /// registered | partial | preliminary | final | amended | corrected | appended | cancelled | entered-in-error | deprecated | unknown @@ -707,13 +685,10 @@ public Code DocStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.CompositionStatus? DocStatus { - get { return DocStatusElement != null ? DocStatusElement.Value : null; } + get => _DocStatusElement?.Value; set { - if (value == null) - DocStatusElement = null; - else - DocStatusElement = new Code(value); + DocStatusElement = value is null ? null : new Code(value); OnPropertyChanged("DocStatus"); } } @@ -727,11 +702,11 @@ public Hl7.Fhir.Model.CompositionStatus? DocStatus [DataMember] public List Modality { - get { if(_Modality==null) _Modality = new List(); return _Modality; } + get => _Modality ?? new List(); set { _Modality = value; OnPropertyChanged("Modality"); } } - private List _Modality; + private List? _Modality; /// /// Kind of document (LOINC if possible). @@ -739,13 +714,13 @@ public List Modality [FhirElement("type", InSummary=true, Order=150, FiveWs="FiveWs.what[x]")] [Binding("DocumentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Categorization of document. @@ -756,11 +731,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Who/what is the subject of the document. @@ -769,13 +744,13 @@ public List Category [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Context of the document content. @@ -787,11 +762,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Context { - get { if(_Context==null) _Context = new List(); return _Context; } + get => _Context ?? new List(); set { _Context = value; OnPropertyChanged("Context"); } } - private List _Context; + private List? _Context; /// /// Main clinical acts documented. @@ -802,11 +777,11 @@ public List Context [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Body part included. @@ -817,11 +792,11 @@ public List Event [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Kind of facility where patient was seen. @@ -829,13 +804,13 @@ public List BodySite [FhirElement("facilityType", Order=210)] [Binding("DocumentC80FacilityType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FacilityType + public Hl7.Fhir.Model.CodeableConcept? FacilityType { get { return _FacilityType; } set { _FacilityType = value; OnPropertyChanged("FacilityType"); } } - private Hl7.Fhir.Model.CodeableConcept _FacilityType; + private Hl7.Fhir.Model.CodeableConcept? _FacilityType; /// /// Additional details about where the content was created (e.g. clinical specialty). @@ -843,39 +818,39 @@ public Hl7.Fhir.Model.CodeableConcept FacilityType [FhirElement("practiceSetting", Order=220)] [Binding("DocumentC80PracticeSetting")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PracticeSetting + public Hl7.Fhir.Model.CodeableConcept? PracticeSetting { get { return _PracticeSetting; } set { _PracticeSetting = value; OnPropertyChanged("PracticeSetting"); } } - private Hl7.Fhir.Model.CodeableConcept _PracticeSetting; + private Hl7.Fhir.Model.CodeableConcept? _PracticeSetting; /// /// Time of service that is being documented. /// [FhirElement("period", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// When this document reference was created. /// [FhirElement("date", InSummary=true, Order=240, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant DateElement + public Hl7.Fhir.Model.Instant? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Instant _DateElement; + private Hl7.Fhir.Model.Instant? _DateElement; /// /// When this document reference was created @@ -884,13 +859,10 @@ public Hl7.Fhir.Model.Instant DateElement [IgnoreDataMember] public DateTimeOffset? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Instant(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Date"); } } @@ -905,11 +877,11 @@ public DateTimeOffset? Date [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Attests to accuracy of the document. @@ -919,11 +891,11 @@ public List Author [DataMember] public List Attester { - get { if(_Attester==null) _Attester = new List(); return _Attester; } + get => _Attester ?? new List(); set { _Attester = value; OnPropertyChanged("Attester"); } } - private List _Attester; + private List? _Attester; /// /// Organization which maintains the document. @@ -932,13 +904,13 @@ public List Attester [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Custodian + public Hl7.Fhir.Model.ResourceReference? Custodian { get { return _Custodian; } set { _Custodian = value; OnPropertyChanged("Custodian"); } } - private Hl7.Fhir.Model.ResourceReference _Custodian; + private Hl7.Fhir.Model.ResourceReference? _Custodian; /// /// Relationships to other documents. @@ -948,39 +920,36 @@ public Hl7.Fhir.Model.ResourceReference Custodian [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// Human-readable description. /// [FhirElement("description", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human-readable description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -994,11 +963,11 @@ public string Description [DataMember] public List SecurityLabel { - get { if(_SecurityLabel==null) _SecurityLabel = new List(); return _SecurityLabel; } + get => _SecurityLabel ?? new List(); set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } - private List _SecurityLabel; + private List? _SecurityLabel; /// /// Document referenced. @@ -1008,47 +977,43 @@ public List SecurityLabel [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as DocumentReference; - - if (dest == null) - { + if(other is not DocumentReference dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DocStatusElement != null) dest.DocStatusElement = (Code)DocStatusElement.DeepCopyInternal(); - if(Modality.Any()) dest.Modality = new List(Modality.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Context.Any()) dest.Context = new List(Context.DeepCopyInternal()); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(FacilityType != null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)FacilityType.DeepCopyInternal(); - if(PracticeSetting != null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)PracticeSetting.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Instant)DateElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Attester.Any()) dest.Attester = new List(Attester.DeepCopyInternal()); - if(Custodian != null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopyInternal(); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(SecurityLabel.Any()) dest.SecurityLabel = new List(SecurityLabel.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DocStatusElement is not null) dest.DocStatusElement = (Code)_DocStatusElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = new List(_Modality.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Context is not null) dest.Context = new List(_Context.DeepCopyInternal()); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_FacilityType is not null) dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)_FacilityType.DeepCopyInternal(); + if(_PracticeSetting is not null) dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)_PracticeSetting.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Instant)_DateElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Attester is not null) dest.Attester = new List(_Attester.DeepCopyInternal()); + if(_Custodian is not null) dest.Custodian = (Hl7.Fhir.Model.ResourceReference)_Custodian.DeepCopyInternal(); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_SecurityLabel is not null) dest.SecurityLabel = new List(_SecurityLabel.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1060,188 +1025,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DocumentReference; - if(otherT == null) return false; + if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DocStatusElement, otherT.DocStatusElement)) return false; - if(!comparer.ListEquals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(FacilityType, otherT.FacilityType)) return false; - if(!comparer.Equals(PracticeSetting, otherT.PracticeSetting)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Attester, otherT.Attester)) return false; - if(!comparer.Equals(Custodian, otherT.Custodian)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(SecurityLabel, otherT.SecurityLabel)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DocStatusElement, otherT._DocStatusElement)) return false; + if(!comparer.ListEquals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_FacilityType, otherT._FacilityType)) return false; + if(!comparer.Equals(_PracticeSetting, otherT._PracticeSetting)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Attester, otherT._Attester)) return false; + if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "docStatus": - value = DocStatusElement; - return DocStatusElement is not null; + value = _DocStatusElement; + return _DocStatusElement is not null; case "modality": - value = Modality; - return Modality?.Any() == true; + value = _Modality; + return _Modality?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "context": - value = Context; - return Context?.Any() == true; + value = _Context; + return _Context?.Any() == true; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "facilityType": - value = FacilityType; - return FacilityType is not null; + value = _FacilityType; + return _FacilityType is not null; case "practiceSetting": - value = PracticeSetting; - return PracticeSetting is not null; + value = _PracticeSetting; + return _PracticeSetting is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "attester": - value = Attester; - return Attester?.Any() == true; + value = _Attester; + return _Attester?.Any() == true; case "custodian": - value = Custodian; - return Custodian is not null; + value = _Custodian; + return _Custodian is not null; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "securityLabel": - value = SecurityLabel; - return SecurityLabel?.Any() == true; + value = _SecurityLabel; + return _SecurityLabel?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "docStatus": - DocStatusElement = (Code)value; + DocStatusElement = (Code?)value; return this; case "modality": - Modality = (List)value; + Modality = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "context": - Context = (List)value; + Context = (List?)value!; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "facilityType": - FacilityType = (Hl7.Fhir.Model.CodeableConcept)value; + FacilityType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "practiceSetting": - PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)value; + PracticeSetting = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Instant)value; + DateElement = (Hl7.Fhir.Model.Instant?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "attester": - Attester = (List)value; + Attester = (List?)value!; return this; case "custodian": - Custodian = (Hl7.Fhir.Model.ResourceReference)value; + Custodian = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "securityLabel": - SecurityLabel = (List)value; + SecurityLabel = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1252,29 +1217,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DocStatusElement is not null) yield return new KeyValuePair("docStatus",DocStatusElement); - if (Modality?.Any() == true) yield return new KeyValuePair("modality",Modality); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Context?.Any() == true) yield return new KeyValuePair("context",Context); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (FacilityType is not null) yield return new KeyValuePair("facilityType",FacilityType); - if (PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",PracticeSetting); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Attester?.Any() == true) yield return new KeyValuePair("attester",Attester); - if (Custodian is not null) yield return new KeyValuePair("custodian",Custodian); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",SecurityLabel); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DocStatusElement is not null) yield return new KeyValuePair("docStatus",_DocStatusElement); + if (_Modality?.Any() == true) yield return new KeyValuePair("modality",_Modality); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Context?.Any() == true) yield return new KeyValuePair("context",_Context); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_FacilityType is not null) yield return new KeyValuePair("facilityType",_FacilityType); + if (_PracticeSetting is not null) yield return new KeyValuePair("practiceSetting",_PracticeSetting); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Attester?.Any() == true) yield return new KeyValuePair("attester",_Attester); + if (_Custodian is not null) yield return new KeyValuePair("custodian",_Custodian); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SecurityLabel?.Any() == true) yield return new KeyValuePair("securityLabel",_SecurityLabel); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs index cac127baa..90bf8b7bb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class DoseAndRateComponent : Hl7.Fhir.Model.Element [FhirElement("type", InSummary=true, Order=30)] [Binding("DoseAndRateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount of medication per dose. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Dose + public Hl7.Fhir.Model.DataType? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.DataType _Dose; + private Hl7.Fhir.Model.DataType? _Dose; /// /// Amount of medication per unit of time. @@ -111,27 +114,23 @@ public Hl7.Fhir.Model.DataType Dose [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as DoseAndRateComponent; - - if (dest == null) - { + if(other is not DoseAndRateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.DataType)Dose.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.DataType)_Dose.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,48 +142,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DoseAndRateComponent; - if(otherT == null) return false; + if(other is not DoseAndRateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.DataType)value; + Dose = (Hl7.Fhir.Model.DataType?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -195,9 +194,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -207,13 +206,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sequence", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SequenceElement + public Hl7.Fhir.Model.Integer? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.Integer _SequenceElement; + private Hl7.Fhir.Model.Integer? _SequenceElement; /// /// The order of the dosage instructions @@ -222,13 +221,10 @@ public Hl7.Fhir.Model.Integer SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.Integer(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Sequence"); } } @@ -238,28 +234,25 @@ public int? Sequence /// [FhirElement("text", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -273,39 +266,36 @@ public string Text [DataMember] public List AdditionalInstruction { - get { if(_AdditionalInstruction==null) _AdditionalInstruction = new List(); return _AdditionalInstruction; } + get => _AdditionalInstruction ?? new List(); set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } - private List _AdditionalInstruction; + private List? _AdditionalInstruction; /// /// Patient or consumer oriented instructions. /// [FhirElement("patientInstruction", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PatientInstructionElement + public Hl7.Fhir.Model.FhirString? PatientInstructionElement { get { return _PatientInstructionElement; } set { _PatientInstructionElement = value; OnPropertyChanged("PatientInstructionElement"); } } - private Hl7.Fhir.Model.FhirString _PatientInstructionElement; + private Hl7.Fhir.Model.FhirString? _PatientInstructionElement; /// /// Patient or consumer oriented instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PatientInstruction + public string? PatientInstruction { - get { return PatientInstructionElement != null ? PatientInstructionElement.Value : null; } + get => _PatientInstructionElement?.Value; set { - if (value == null) - PatientInstructionElement = null; - else - PatientInstructionElement = new Hl7.Fhir.Model.FhirString(value); + PatientInstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PatientInstruction"); } } @@ -315,26 +305,26 @@ public string PatientInstruction /// [FhirElement("timing", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Timing Timing + public Hl7.Fhir.Model.Timing? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.Timing _Timing; + private Hl7.Fhir.Model.Timing? _Timing; /// /// Take "as needed". /// [FhirElement("asNeeded", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AsNeededElement + public Hl7.Fhir.Model.FhirBoolean? AsNeededElement { get { return _AsNeededElement; } set { _AsNeededElement = value; OnPropertyChanged("AsNeededElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AsNeededElement; + private Hl7.Fhir.Model.FhirBoolean? _AsNeededElement; /// /// Take "as needed" @@ -343,13 +333,10 @@ public Hl7.Fhir.Model.FhirBoolean AsNeededElement [IgnoreDataMember] public bool? AsNeeded { - get { return AsNeededElement != null ? AsNeededElement.Value : null; } + get => _AsNeededElement?.Value; set { - if (value == null) - AsNeededElement = null; - else - AsNeededElement = new Hl7.Fhir.Model.FhirBoolean(value); + AsNeededElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AsNeeded"); } } @@ -363,11 +350,11 @@ public bool? AsNeeded [DataMember] public List AsNeededFor { - get { if(_AsNeededFor==null) _AsNeededFor = new List(); return _AsNeededFor; } + get => _AsNeededFor ?? new List(); set { _AsNeededFor = value; OnPropertyChanged("AsNeededFor"); } } - private List _AsNeededFor; + private List? _AsNeededFor; /// /// Body site to administer to. @@ -375,13 +362,13 @@ public List AsNeededFor [FhirElement("site", InSummary=true, Order=110)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How drug should enter body. @@ -389,13 +376,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", InSummary=true, Order=120)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Technique for administering medication. @@ -403,13 +390,13 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", InSummary=true, Order=130)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication administered, to be administered or typical amount to be administered. @@ -419,11 +406,11 @@ public Hl7.Fhir.Model.CodeableConcept Method [DataMember] public List DoseAndRate { - get { if(_DoseAndRate==null) _DoseAndRate = new List(); return _DoseAndRate; } + get => _DoseAndRate ?? new List(); set { _DoseAndRate = value; OnPropertyChanged("DoseAndRate"); } } - private List _DoseAndRate; + private List? _DoseAndRate; /// /// Upper limit on medication per unit of time. @@ -433,62 +420,58 @@ public List DoseAndRate [DataMember] public List MaxDosePerPeriod { - get { if(_MaxDosePerPeriod==null) _MaxDosePerPeriod = new List(); return _MaxDosePerPeriod; } + get => _MaxDosePerPeriod ?? new List(); set { _MaxDosePerPeriod = value; OnPropertyChanged("MaxDosePerPeriod"); } } - private List _MaxDosePerPeriod; + private List? _MaxDosePerPeriod; /// /// Upper limit on medication per administration. /// [FhirElement("maxDosePerAdministration", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerAdministration + public Hl7.Fhir.Model.Quantity? MaxDosePerAdministration { get { return _MaxDosePerAdministration; } set { _MaxDosePerAdministration = value; OnPropertyChanged("MaxDosePerAdministration"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerAdministration; + private Hl7.Fhir.Model.Quantity? _MaxDosePerAdministration; /// /// Upper limit on medication per lifetime of the patient. /// [FhirElement("maxDosePerLifetime", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxDosePerLifetime + public Hl7.Fhir.Model.Quantity? MaxDosePerLifetime { get { return _MaxDosePerLifetime; } set { _MaxDosePerLifetime = value; OnPropertyChanged("MaxDosePerLifetime"); } } - private Hl7.Fhir.Model.Quantity _MaxDosePerLifetime; + private Hl7.Fhir.Model.Quantity? _MaxDosePerLifetime; protected internal override void CopyToInternal(Base other) { - var dest = other as Dosage; - - if (dest == null) - { + if(other is not Dosage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)SequenceElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(AdditionalInstruction.Any()) dest.AdditionalInstruction = new List(AdditionalInstruction.DeepCopyInternal()); - if(PatientInstructionElement != null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)PatientInstructionElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.Timing)Timing.DeepCopyInternal(); - if(AsNeededElement != null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)AsNeededElement.DeepCopyInternal(); - if(AsNeededFor.Any()) dest.AsNeededFor = new List(AsNeededFor.DeepCopyInternal()); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(DoseAndRate.Any()) dest.DoseAndRate = new List(DoseAndRate.DeepCopyInternal()); - if(MaxDosePerPeriod.Any()) dest.MaxDosePerPeriod = new List(MaxDosePerPeriod.DeepCopyInternal()); - if(MaxDosePerAdministration != null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)MaxDosePerAdministration.DeepCopyInternal(); - if(MaxDosePerLifetime != null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)MaxDosePerLifetime.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)_SequenceElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_AdditionalInstruction is not null) dest.AdditionalInstruction = new List(_AdditionalInstruction.DeepCopyInternal()); + if(_PatientInstructionElement is not null) dest.PatientInstructionElement = (Hl7.Fhir.Model.FhirString)_PatientInstructionElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.Timing)_Timing.DeepCopyInternal(); + if(_AsNeededElement is not null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)_AsNeededElement.DeepCopyInternal(); + if(_AsNeededFor is not null) dest.AsNeededFor = new List(_AsNeededFor.DeepCopyInternal()); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_DoseAndRate is not null) dest.DoseAndRate = new List(_DoseAndRate.DeepCopyInternal()); + if(_MaxDosePerPeriod is not null) dest.MaxDosePerPeriod = new List(_MaxDosePerPeriod.DeepCopyInternal()); + if(_MaxDosePerAdministration is not null) dest.MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)_MaxDosePerAdministration.DeepCopyInternal(); + if(_MaxDosePerLifetime is not null) dest.MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)_MaxDosePerLifetime.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -500,125 +483,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Dosage; - if(otherT == null) return false; + if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(AdditionalInstruction, otherT.AdditionalInstruction)) return false; - if(!comparer.Equals(PatientInstructionElement, otherT.PatientInstructionElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeededElement, otherT.AsNeededElement)) return false; - if(!comparer.ListEquals(AsNeededFor, otherT.AsNeededFor)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.ListEquals(DoseAndRate, otherT.DoseAndRate)) return false; - if(!comparer.ListEquals(MaxDosePerPeriod, otherT.MaxDosePerPeriod)) return false; - if(!comparer.Equals(MaxDosePerAdministration, otherT.MaxDosePerAdministration)) return false; - if(!comparer.Equals(MaxDosePerLifetime, otherT.MaxDosePerLifetime)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; + if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; + if(!comparer.ListEquals(_AsNeededFor, otherT._AsNeededFor)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.ListEquals(_DoseAndRate, otherT._DoseAndRate)) return false; + if(!comparer.ListEquals(_MaxDosePerPeriod, otherT._MaxDosePerPeriod)) return false; + if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; + if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "additionalInstruction": - value = AdditionalInstruction; - return AdditionalInstruction?.Any() == true; + value = _AdditionalInstruction; + return _AdditionalInstruction?.Any() == true; case "patientInstruction": - value = PatientInstructionElement; - return PatientInstructionElement is not null; + value = _PatientInstructionElement; + return _PatientInstructionElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "asNeeded": - value = AsNeededElement; - return AsNeededElement is not null; + value = _AsNeededElement; + return _AsNeededElement is not null; case "asNeededFor": - value = AsNeededFor; - return AsNeededFor?.Any() == true; + value = _AsNeededFor; + return _AsNeededFor?.Any() == true; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "doseAndRate": - value = DoseAndRate; - return DoseAndRate?.Any() == true; + value = _DoseAndRate; + return _DoseAndRate?.Any() == true; case "maxDosePerPeriod": - value = MaxDosePerPeriod; - return MaxDosePerPeriod?.Any() == true; + value = _MaxDosePerPeriod; + return _MaxDosePerPeriod?.Any() == true; case "maxDosePerAdministration": - value = MaxDosePerAdministration; - return MaxDosePerAdministration is not null; + value = _MaxDosePerAdministration; + return _MaxDosePerAdministration is not null; case "maxDosePerLifetime": - value = MaxDosePerLifetime; - return MaxDosePerLifetime is not null; + value = _MaxDosePerLifetime; + return _MaxDosePerLifetime is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.Integer)value; + SequenceElement = (Hl7.Fhir.Model.Integer?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "additionalInstruction": - AdditionalInstruction = (List)value; + AdditionalInstruction = (List?)value!; return this; case "patientInstruction": - PatientInstructionElement = (Hl7.Fhir.Model.FhirString)value; + PatientInstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.Timing)value; + Timing = (Hl7.Fhir.Model.Timing?)value; return this; case "asNeeded": - AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)value; + AsNeededElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "asNeededFor": - AsNeededFor = (List)value; + AsNeededFor = (List?)value!; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseAndRate": - DoseAndRate = (List)value; + DoseAndRate = (List?)value!; return this; case "maxDosePerPeriod": - MaxDosePerPeriod = (List)value; + MaxDosePerPeriod = (List?)value!; return this; case "maxDosePerAdministration": - MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerAdministration = (Hl7.Fhir.Model.Quantity?)value; return this; case "maxDosePerLifetime": - MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity)value; + MaxDosePerLifetime = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -629,20 +612,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",AdditionalInstruction); - if (PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",PatientInstructionElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (AsNeededElement is not null) yield return new KeyValuePair("asNeeded",AsNeededElement); - if (AsNeededFor?.Any() == true) yield return new KeyValuePair("asNeededFor",AsNeededFor); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (DoseAndRate?.Any() == true) yield return new KeyValuePair("doseAndRate",DoseAndRate); - if (MaxDosePerPeriod?.Any() == true) yield return new KeyValuePair("maxDosePerPeriod",MaxDosePerPeriod); - if (MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",MaxDosePerAdministration); - if (MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",MaxDosePerLifetime); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_AdditionalInstruction?.Any() == true) yield return new KeyValuePair("additionalInstruction",_AdditionalInstruction); + if (_PatientInstructionElement is not null) yield return new KeyValuePair("patientInstruction",_PatientInstructionElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_AsNeededElement is not null) yield return new KeyValuePair("asNeeded",_AsNeededElement); + if (_AsNeededFor?.Any() == true) yield return new KeyValuePair("asNeededFor",_AsNeededFor); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_DoseAndRate?.Any() == true) yield return new KeyValuePair("doseAndRate",_DoseAndRate); + if (_MaxDosePerPeriod?.Any() == true) yield return new KeyValuePair("maxDosePerPeriod",_MaxDosePerPeriod); + if (_MaxDosePerAdministration is not null) yield return new KeyValuePair("maxDosePerAdministration",_MaxDosePerAdministration); + if (_MaxDosePerLifetime is not null) yield return new KeyValuePair("maxDosePerLifetime",_MaxDosePerLifetime); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Duration.cs b/src/Hl7.Fhir.R5/Model/Generated/Duration.cs index 54c08c7fc..84933e5d9 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Duration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Duration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. diff --git a/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs index 50128e710..e9d47ace5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,24 +124,24 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Period of time during the encounter that the participant participated. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// The individual, device, or service participating in the encounter. @@ -147,27 +150,23 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Patient","Group","RelatedPerson","Practitioner","PractitionerRole","Device","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,48 +178,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -231,9 +230,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -266,11 +265,11 @@ public partial class ReasonComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Use { - get { if(_Use==null) _Use = new List(); return _Use; } + get => _Use ?? new List(); set { _Use = value; OnPropertyChanged("Use"); } } - private List _Use; + private List? _Use; /// /// Reason the encounter takes place (core or reference). @@ -281,24 +280,20 @@ public List Use [DataMember] public List Value { - get { if(_Value==null) _Value = new List(); return _Value; } + get => _Value ?? new List(); set { _Value = value; OnPropertyChanged("Value"); } } - private List _Value; + private List? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ReasonComponent; - - if (dest == null) - { + if(other is not ReasonComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Use.Any()) dest.Use = new List(Use.DeepCopyInternal()); - if(Value.Any()) dest.Value = new List(Value.DeepCopyInternal()); + if(_Use is not null) dest.Use = new List(_Use.DeepCopyInternal()); + if(_Value is not null) dest.Value = new List(_Value.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -310,41 +305,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReasonComponent; - if(otherT == null) return false; + if(other is not ReasonComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Use, otherT.Use)) return false; - if(!comparer.ListEquals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Use, otherT._Use)) return false; + if(!comparer.ListEquals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = Use; - return Use?.Any() == true; + value = _Use; + return _Use?.Any() == true; case "value": - value = Value; - return Value?.Any() == true; + value = _Value; + return _Value?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - Use = (List)value; + Use = (List?)value!; return this; case "value": - Value = (List)value; + Value = (List?)value!; return this; default: return base.SetValue(key, value); @@ -355,8 +350,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Use?.Any() == true) yield return new KeyValuePair("use",Use); - if (Value?.Any() == true) yield return new KeyValuePair("value",Value); + if (_Use?.Any() == true) yield return new KeyValuePair("use",_Use); + if (_Value?.Any() == true) yield return new KeyValuePair("value",_Value); } } @@ -386,11 +381,11 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …). @@ -401,24 +396,20 @@ public List Condition [DataMember] public List Use { - get { if(_Use==null) _Use = new List(); return _Use; } + get => _Use ?? new List(); set { _Use = value; OnPropertyChanged("Use"); } } - private List _Use; + private List? _Use; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Use.Any()) dest.Use = new List(Use.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Use is not null) dest.Use = new List(_Use.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -430,41 +421,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Use, otherT.Use)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Use, otherT._Use)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "use": - value = Use; - return Use?.Any() == true; + value = _Use; + return _Use?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "use": - Use = (List)value; + Use = (List?)value!; return this; default: return base.SetValue(key, value); @@ -475,8 +466,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Use?.Any() == true) yield return new KeyValuePair("use",Use); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Use?.Any() == true) yield return new KeyValuePair("use",_Use); } } @@ -505,13 +496,13 @@ public partial class AdmissionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("preAdmissionIdentifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier + public Hl7.Fhir.Model.Identifier? PreAdmissionIdentifier { get { return _PreAdmissionIdentifier; } set { _PreAdmissionIdentifier = value; OnPropertyChanged("PreAdmissionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _PreAdmissionIdentifier; + private Hl7.Fhir.Model.Identifier? _PreAdmissionIdentifier; /// /// The location/organization from which the patient came before admission. @@ -520,13 +511,13 @@ public Hl7.Fhir.Model.Identifier PreAdmissionIdentifier [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Origin + public Hl7.Fhir.Model.ResourceReference? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.ResourceReference _Origin; + private Hl7.Fhir.Model.ResourceReference? _Origin; /// /// From where patient was admitted (physician referral, transfer). @@ -534,13 +525,13 @@ public Hl7.Fhir.Model.ResourceReference Origin [FhirElement("admitSource", Order=60)] [Binding("AdmitSource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdmitSource + public Hl7.Fhir.Model.CodeableConcept? AdmitSource { get { return _AdmitSource; } set { _AdmitSource = value; OnPropertyChanged("AdmitSource"); } } - private Hl7.Fhir.Model.CodeableConcept _AdmitSource; + private Hl7.Fhir.Model.CodeableConcept? _AdmitSource; /// /// Indicates that the patient is being re-admitted. @@ -548,13 +539,13 @@ public Hl7.Fhir.Model.CodeableConcept AdmitSource [FhirElement("reAdmission", Order=70)] [Binding("ReAdmissionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ReAdmission + public Hl7.Fhir.Model.CodeableConcept? ReAdmission { get { return _ReAdmission; } set { _ReAdmission = value; OnPropertyChanged("ReAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _ReAdmission; + private Hl7.Fhir.Model.CodeableConcept? _ReAdmission; /// /// Location/organization to which the patient is discharged. @@ -563,13 +554,13 @@ public Hl7.Fhir.Model.CodeableConcept ReAdmission [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Category or kind of location after discharge. @@ -577,30 +568,26 @@ public Hl7.Fhir.Model.ResourceReference Destination [FhirElement("dischargeDisposition", Order=90)] [Binding("DischargeDisp")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DischargeDisposition + public Hl7.Fhir.Model.CodeableConcept? DischargeDisposition { get { return _DischargeDisposition; } set { _DischargeDisposition = value; OnPropertyChanged("DischargeDisposition"); } } - private Hl7.Fhir.Model.CodeableConcept _DischargeDisposition; + private Hl7.Fhir.Model.CodeableConcept? _DischargeDisposition; protected internal override void CopyToInternal(Base other) { - var dest = other as AdmissionComponent; - - if (dest == null) - { + if(other is not AdmissionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PreAdmissionIdentifier != null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)PreAdmissionIdentifier.DeepCopyInternal(); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)Origin.DeepCopyInternal(); - if(AdmitSource != null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)AdmitSource.DeepCopyInternal(); - if(ReAdmission != null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)ReAdmission.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(DischargeDisposition != null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)DischargeDisposition.DeepCopyInternal(); + if(_PreAdmissionIdentifier is not null) dest.PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)_PreAdmissionIdentifier.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.ResourceReference)_Origin.DeepCopyInternal(); + if(_AdmitSource is not null) dest.AdmitSource = (Hl7.Fhir.Model.CodeableConcept)_AdmitSource.DeepCopyInternal(); + if(_ReAdmission is not null) dest.ReAdmission = (Hl7.Fhir.Model.CodeableConcept)_ReAdmission.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_DischargeDisposition is not null) dest.DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)_DischargeDisposition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -612,69 +599,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdmissionComponent; - if(otherT == null) return false; + if(other is not AdmissionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PreAdmissionIdentifier, otherT.PreAdmissionIdentifier)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(AdmitSource, otherT.AdmitSource)) return false; - if(!comparer.Equals(ReAdmission, otherT.ReAdmission)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(DischargeDisposition, otherT.DischargeDisposition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; + if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "preAdmissionIdentifier": - value = PreAdmissionIdentifier; - return PreAdmissionIdentifier is not null; + value = _PreAdmissionIdentifier; + return _PreAdmissionIdentifier is not null; case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "admitSource": - value = AdmitSource; - return AdmitSource is not null; + value = _AdmitSource; + return _AdmitSource is not null; case "reAdmission": - value = ReAdmission; - return ReAdmission is not null; + value = _ReAdmission; + return _ReAdmission is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "dischargeDisposition": - value = DischargeDisposition; - return DischargeDisposition is not null; + value = _DischargeDisposition; + return _DischargeDisposition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "preAdmissionIdentifier": - PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier)value; + PreAdmissionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "origin": - Origin = (Hl7.Fhir.Model.ResourceReference)value; + Origin = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "admitSource": - AdmitSource = (Hl7.Fhir.Model.CodeableConcept)value; + AdmitSource = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reAdmission": - ReAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + ReAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dischargeDisposition": - DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept)value; + DischargeDisposition = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -685,12 +672,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",PreAdmissionIdentifier); - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (AdmitSource is not null) yield return new KeyValuePair("admitSource",AdmitSource); - if (ReAdmission is not null) yield return new KeyValuePair("reAdmission",ReAdmission); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",DischargeDisposition); + if (_PreAdmissionIdentifier is not null) yield return new KeyValuePair("preAdmissionIdentifier",_PreAdmissionIdentifier); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_AdmitSource is not null) yield return new KeyValuePair("admitSource",_AdmitSource); + if (_ReAdmission is not null) yield return new KeyValuePair("reAdmission",_ReAdmission); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_DischargeDisposition is not null) yield return new KeyValuePair("dischargeDisposition",_DischargeDisposition); } } @@ -720,13 +707,13 @@ public partial class LocationComponent : Hl7.Fhir.Model.BackboneElement [References("Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// planned | active | reserved | completed. @@ -735,13 +722,13 @@ public Hl7.Fhir.Model.ResourceReference Location [DeclaredType(Type = typeof(Code))] [Binding("EncounterLocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | active | reserved | completed @@ -750,13 +737,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -767,41 +751,37 @@ public Hl7.Fhir.Model.Encounter.EncounterLocationStatus? Status [FhirElement("form", Order=60)] [Binding("LocationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// Time period during which the patient was present at the location. /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as LocationComponent; - - if (dest == null) - { + if(other is not LocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -813,55 +793,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LocationComponent; - if(otherT == null) return false; + if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -872,10 +852,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Location is not null) yield return new KeyValuePair("location",Location); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -888,11 +868,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | in-progress | on-hold | discharged | completed | cancelled | discontinued | entered-in-error | unknown. @@ -902,13 +882,13 @@ public List Identifier [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | in-progress | on-hold | discharged | completed | cancelled | discontinued | entered-in-error | unknown @@ -917,13 +897,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -937,11 +914,11 @@ public Hl7.Fhir.Model.EncounterStatus? Status [DataMember] public List Class { - get { if(_Class==null) _Class = new List(); return _Class; } + get => _Class ?? new List(); set { _Class = value; OnPropertyChanged("Class"); } } - private List _Class; + private List? _Class; /// /// Indicates the urgency of the encounter. @@ -949,13 +926,13 @@ public List Class [FhirElement("priority", Order=120, FiveWs="FiveWs.grade")] [Binding("Priority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// Specific type of encounter (e.g. e-mail consultation, surgical day-care, ...). @@ -966,11 +943,11 @@ public Hl7.Fhir.Model.CodeableConcept Priority [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specific type of service. @@ -981,11 +958,11 @@ public List Type [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The patient or group related to this encounter. @@ -994,13 +971,13 @@ public List ServiceType [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The current status of the subject in relation to the Encounter. @@ -1008,13 +985,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [FhirElement("subjectStatus", Order=160)] [Binding("SubjectStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubjectStatus + public Hl7.Fhir.Model.CodeableConcept? SubjectStatus { get { return _SubjectStatus; } set { _SubjectStatus = value; OnPropertyChanged("SubjectStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _SubjectStatus; + private Hl7.Fhir.Model.CodeableConcept? _SubjectStatus; /// /// Episode(s) of care that this encounter should be recorded against. @@ -1026,11 +1003,11 @@ public Hl7.Fhir.Model.CodeableConcept SubjectStatus [DataMember] public List EpisodeOfCare { - get { if(_EpisodeOfCare==null) _EpisodeOfCare = new List(); return _EpisodeOfCare; } + get => _EpisodeOfCare ?? new List(); set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } - private List _EpisodeOfCare; + private List? _EpisodeOfCare; /// /// The request that initiated this encounter. @@ -1042,11 +1019,11 @@ public List EpisodeOfCare [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// The group(s) that are allocated to participate in this encounter. @@ -1058,11 +1035,11 @@ public List BasedOn [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Another Encounter this encounter is part of. @@ -1071,13 +1048,13 @@ public List CareTeam [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// The organization (facility) responsible for this encounter. @@ -1086,13 +1063,13 @@ public Hl7.Fhir.Model.ResourceReference PartOf [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ServiceProvider + public Hl7.Fhir.Model.ResourceReference? ServiceProvider { get { return _ServiceProvider; } set { _ServiceProvider = value; OnPropertyChanged("ServiceProvider"); } } - private Hl7.Fhir.Model.ResourceReference _ServiceProvider; + private Hl7.Fhir.Model.ResourceReference? _ServiceProvider; /// /// List of participants involved in the encounter. @@ -1102,11 +1079,11 @@ public Hl7.Fhir.Model.ResourceReference ServiceProvider [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The appointment that scheduled this encounter. @@ -1118,11 +1095,11 @@ public List Participant [DataMember] public List Appointment { - get { if(_Appointment==null) _Appointment = new List(); return _Appointment; } + get => _Appointment ?? new List(); set { _Appointment = value; OnPropertyChanged("Appointment"); } } - private List _Appointment; + private List? _Appointment; /// /// Connection details of a virtual service (e.g. conference call). @@ -1132,52 +1109,49 @@ public List Appointment [DataMember] public List VirtualService { - get { if(_VirtualService==null) _VirtualService = new List(); return _VirtualService; } + get => _VirtualService ?? new List(); set { _VirtualService = value; OnPropertyChanged("VirtualService"); } } - private List _VirtualService; + private List? _VirtualService; /// /// The actual start and end time of the encounter. /// [FhirElement("actualPeriod", Order=250, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ActualPeriod + public Hl7.Fhir.Model.Period? ActualPeriod { get { return _ActualPeriod; } set { _ActualPeriod = value; OnPropertyChanged("ActualPeriod"); } } - private Hl7.Fhir.Model.Period _ActualPeriod; + private Hl7.Fhir.Model.Period? _ActualPeriod; /// /// The planned start date/time (or admission date) of the encounter. /// [FhirElement("plannedStartDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PlannedStartDateElement + public Hl7.Fhir.Model.FhirDateTime? PlannedStartDateElement { get { return _PlannedStartDateElement; } set { _PlannedStartDateElement = value; OnPropertyChanged("PlannedStartDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PlannedStartDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PlannedStartDateElement; /// /// The planned start date/time (or admission date) of the encounter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PlannedStartDate + public string? PlannedStartDate { - get { return PlannedStartDateElement != null ? PlannedStartDateElement.Value : null; } + get => _PlannedStartDateElement?.Value; set { - if (value == null) - PlannedStartDateElement = null; - else - PlannedStartDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PlannedStartDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PlannedStartDate"); } } @@ -1187,28 +1161,25 @@ public string PlannedStartDate /// [FhirElement("plannedEndDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PlannedEndDateElement + public Hl7.Fhir.Model.FhirDateTime? PlannedEndDateElement { get { return _PlannedEndDateElement; } set { _PlannedEndDateElement = value; OnPropertyChanged("PlannedEndDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PlannedEndDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PlannedEndDateElement; /// /// The planned end date/time (or discharge date) of the encounter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PlannedEndDate + public string? PlannedEndDate { - get { return PlannedEndDateElement != null ? PlannedEndDateElement.Value : null; } + get => _PlannedEndDateElement?.Value; set { - if (value == null) - PlannedEndDateElement = null; - else - PlannedEndDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PlannedEndDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PlannedEndDate"); } } @@ -1218,13 +1189,13 @@ public string PlannedEndDate /// [FhirElement("length", Order=280)] [DataMember] - public Hl7.Fhir.Model.Duration Length + public Hl7.Fhir.Model.Duration? Length { get { return _Length; } set { _Length = value; OnPropertyChanged("Length"); } } - private Hl7.Fhir.Model.Duration _Length; + private Hl7.Fhir.Model.Duration? _Length; /// /// The list of medical reasons that are expected to be addressed during the episode of care. @@ -1234,11 +1205,11 @@ public Hl7.Fhir.Model.Duration Length [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// The list of diagnosis relevant to this encounter. @@ -1248,11 +1219,11 @@ public List Reason [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The set of accounts that may be used for billing for this Encounter. @@ -1264,11 +1235,11 @@ public List Diagnosis [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; /// /// Diet preferences reported by the patient. @@ -1279,11 +1250,11 @@ public List Account [DataMember] public List DietPreference { - get { if(_DietPreference==null) _DietPreference = new List(); return _DietPreference; } + get => _DietPreference ?? new List(); set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } - private List _DietPreference; + private List? _DietPreference; /// /// Wheelchair, translator, stretcher, etc. @@ -1294,11 +1265,11 @@ public List DietPreference [DataMember] public List SpecialArrangement { - get { if(_SpecialArrangement==null) _SpecialArrangement = new List(); return _SpecialArrangement; } + get => _SpecialArrangement ?? new List(); set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } - private List _SpecialArrangement; + private List? _SpecialArrangement; /// /// Special courtesies (VIP, board member). @@ -1309,24 +1280,24 @@ public List SpecialArrangement [DataMember] public List SpecialCourtesy { - get { if(_SpecialCourtesy==null) _SpecialCourtesy = new List(); return _SpecialCourtesy; } + get => _SpecialCourtesy ?? new List(); set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } - private List _SpecialCourtesy; + private List? _SpecialCourtesy; /// /// Details about the admission to a healthcare service. /// [FhirElement("admission", Order=350)] [DataMember] - public Hl7.Fhir.Model.Encounter.AdmissionComponent Admission + public Hl7.Fhir.Model.Encounter.AdmissionComponent? Admission { get { return _Admission; } set { _Admission = value; OnPropertyChanged("Admission"); } } - private Hl7.Fhir.Model.Encounter.AdmissionComponent _Admission; + private Hl7.Fhir.Model.Encounter.AdmissionComponent? _Admission; /// /// List of locations where the patient has been. @@ -1336,52 +1307,48 @@ public Hl7.Fhir.Model.Encounter.AdmissionComponent Admission [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Encounter; - - if (dest == null) - { + if(other is not Encounter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Class.Any()) dest.Class = new List(Class.DeepCopyInternal()); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(SubjectStatus != null) dest.SubjectStatus = (Hl7.Fhir.Model.CodeableConcept)SubjectStatus.DeepCopyInternal(); - if(EpisodeOfCare.Any()) dest.EpisodeOfCare = new List(EpisodeOfCare.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(ServiceProvider != null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)ServiceProvider.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Appointment.Any()) dest.Appointment = new List(Appointment.DeepCopyInternal()); - if(VirtualService.Any()) dest.VirtualService = new List(VirtualService.DeepCopyInternal()); - if(ActualPeriod != null) dest.ActualPeriod = (Hl7.Fhir.Model.Period)ActualPeriod.DeepCopyInternal(); - if(PlannedStartDateElement != null) dest.PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime)PlannedStartDateElement.DeepCopyInternal(); - if(PlannedEndDateElement != null) dest.PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime)PlannedEndDateElement.DeepCopyInternal(); - if(Length != null) dest.Length = (Hl7.Fhir.Model.Duration)Length.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); - if(DietPreference.Any()) dest.DietPreference = new List(DietPreference.DeepCopyInternal()); - if(SpecialArrangement.Any()) dest.SpecialArrangement = new List(SpecialArrangement.DeepCopyInternal()); - if(SpecialCourtesy.Any()) dest.SpecialCourtesy = new List(SpecialCourtesy.DeepCopyInternal()); - if(Admission != null) dest.Admission = (Hl7.Fhir.Model.Encounter.AdmissionComponent)Admission.DeepCopyInternal(); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Class is not null) dest.Class = new List(_Class.DeepCopyInternal()); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_SubjectStatus is not null) dest.SubjectStatus = (Hl7.Fhir.Model.CodeableConcept)_SubjectStatus.DeepCopyInternal(); + if(_EpisodeOfCare is not null) dest.EpisodeOfCare = new List(_EpisodeOfCare.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_ServiceProvider is not null) dest.ServiceProvider = (Hl7.Fhir.Model.ResourceReference)_ServiceProvider.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Appointment is not null) dest.Appointment = new List(_Appointment.DeepCopyInternal()); + if(_VirtualService is not null) dest.VirtualService = new List(_VirtualService.DeepCopyInternal()); + if(_ActualPeriod is not null) dest.ActualPeriod = (Hl7.Fhir.Model.Period)_ActualPeriod.DeepCopyInternal(); + if(_PlannedStartDateElement is not null) dest.PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime)_PlannedStartDateElement.DeepCopyInternal(); + if(_PlannedEndDateElement is not null) dest.PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime)_PlannedEndDateElement.DeepCopyInternal(); + if(_Length is not null) dest.Length = (Hl7.Fhir.Model.Duration)_Length.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); + if(_DietPreference is not null) dest.DietPreference = new List(_DietPreference.DeepCopyInternal()); + if(_SpecialArrangement is not null) dest.SpecialArrangement = new List(_SpecialArrangement.DeepCopyInternal()); + if(_SpecialCourtesy is not null) dest.SpecialCourtesy = new List(_SpecialCourtesy.DeepCopyInternal()); + if(_Admission is not null) dest.Admission = (Hl7.Fhir.Model.Encounter.AdmissionComponent)_Admission.DeepCopyInternal(); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1393,223 +1360,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Encounter; - if(otherT == null) return false; + if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Class, otherT.Class)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(SubjectStatus, otherT.SubjectStatus)) return false; - if(!comparer.ListEquals(EpisodeOfCare, otherT.EpisodeOfCare)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(ServiceProvider, otherT.ServiceProvider)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.ListEquals(Appointment, otherT.Appointment)) return false; - if(!comparer.ListEquals(VirtualService, otherT.VirtualService)) return false; - if(!comparer.Equals(ActualPeriod, otherT.ActualPeriod)) return false; - if(!comparer.Equals(PlannedStartDateElement, otherT.PlannedStartDateElement)) return false; - if(!comparer.Equals(PlannedEndDateElement, otherT.PlannedEndDateElement)) return false; - if(!comparer.Equals(Length, otherT.Length)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(DietPreference, otherT.DietPreference)) return false; - if(!comparer.ListEquals(SpecialArrangement, otherT.SpecialArrangement)) return false; - if(!comparer.ListEquals(SpecialCourtesy, otherT.SpecialCourtesy)) return false; - if(!comparer.Equals(Admission, otherT.Admission)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_SubjectStatus, otherT._SubjectStatus)) return false; + if(!comparer.ListEquals(_EpisodeOfCare, otherT._EpisodeOfCare)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_ServiceProvider, otherT._ServiceProvider)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.ListEquals(_Appointment, otherT._Appointment)) return false; + if(!comparer.ListEquals(_VirtualService, otherT._VirtualService)) return false; + if(!comparer.Equals(_ActualPeriod, otherT._ActualPeriod)) return false; + if(!comparer.Equals(_PlannedStartDateElement, otherT._PlannedStartDateElement)) return false; + if(!comparer.Equals(_PlannedEndDateElement, otherT._PlannedEndDateElement)) return false; + if(!comparer.Equals(_Length, otherT._Length)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_DietPreference, otherT._DietPreference)) return false; + if(!comparer.ListEquals(_SpecialArrangement, otherT._SpecialArrangement)) return false; + if(!comparer.ListEquals(_SpecialCourtesy, otherT._SpecialCourtesy)) return false; + if(!comparer.Equals(_Admission, otherT._Admission)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "class": - value = Class; - return Class?.Any() == true; + value = _Class; + return _Class?.Any() == true; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "subjectStatus": - value = SubjectStatus; - return SubjectStatus is not null; + value = _SubjectStatus; + return _SubjectStatus is not null; case "episodeOfCare": - value = EpisodeOfCare; - return EpisodeOfCare?.Any() == true; + value = _EpisodeOfCare; + return _EpisodeOfCare?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "serviceProvider": - value = ServiceProvider; - return ServiceProvider is not null; + value = _ServiceProvider; + return _ServiceProvider is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "appointment": - value = Appointment; - return Appointment?.Any() == true; + value = _Appointment; + return _Appointment?.Any() == true; case "virtualService": - value = VirtualService; - return VirtualService?.Any() == true; + value = _VirtualService; + return _VirtualService?.Any() == true; case "actualPeriod": - value = ActualPeriod; - return ActualPeriod is not null; + value = _ActualPeriod; + return _ActualPeriod is not null; case "plannedStartDate": - value = PlannedStartDateElement; - return PlannedStartDateElement is not null; + value = _PlannedStartDateElement; + return _PlannedStartDateElement is not null; case "plannedEndDate": - value = PlannedEndDateElement; - return PlannedEndDateElement is not null; + value = _PlannedEndDateElement; + return _PlannedEndDateElement is not null; case "length": - value = Length; - return Length is not null; + value = _Length; + return _Length is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; case "dietPreference": - value = DietPreference; - return DietPreference?.Any() == true; + value = _DietPreference; + return _DietPreference?.Any() == true; case "specialArrangement": - value = SpecialArrangement; - return SpecialArrangement?.Any() == true; + value = _SpecialArrangement; + return _SpecialArrangement?.Any() == true; case "specialCourtesy": - value = SpecialCourtesy; - return SpecialCourtesy?.Any() == true; + value = _SpecialCourtesy; + return _SpecialCourtesy?.Any() == true; case "admission": - value = Admission; - return Admission is not null; + value = _Admission; + return _Admission is not null; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "class": - Class = (List)value; + Class = (List?)value!; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subjectStatus": - SubjectStatus = (Hl7.Fhir.Model.CodeableConcept)value; + SubjectStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "episodeOfCare": - EpisodeOfCare = (List)value; + EpisodeOfCare = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "serviceProvider": - ServiceProvider = (Hl7.Fhir.Model.ResourceReference)value; + ServiceProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "appointment": - Appointment = (List)value; + Appointment = (List?)value!; return this; case "virtualService": - VirtualService = (List)value; + VirtualService = (List?)value!; return this; case "actualPeriod": - ActualPeriod = (Hl7.Fhir.Model.Period)value; + ActualPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "plannedStartDate": - PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "plannedEndDate": - PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "length": - Length = (Hl7.Fhir.Model.Duration)value; + Length = (Hl7.Fhir.Model.Duration?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; case "dietPreference": - DietPreference = (List)value; + DietPreference = (List?)value!; return this; case "specialArrangement": - SpecialArrangement = (List)value; + SpecialArrangement = (List?)value!; return this; case "specialCourtesy": - SpecialCourtesy = (List)value; + SpecialCourtesy = (List?)value!; return this; case "admission": - Admission = (Hl7.Fhir.Model.Encounter.AdmissionComponent)value; + Admission = (Hl7.Fhir.Model.Encounter.AdmissionComponent?)value; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1620,34 +1587,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Class?.Any() == true) yield return new KeyValuePair("class",Class); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (SubjectStatus is not null) yield return new KeyValuePair("subjectStatus",SubjectStatus); - if (EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",EpisodeOfCare); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",ServiceProvider); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Appointment?.Any() == true) yield return new KeyValuePair("appointment",Appointment); - if (VirtualService?.Any() == true) yield return new KeyValuePair("virtualService",VirtualService); - if (ActualPeriod is not null) yield return new KeyValuePair("actualPeriod",ActualPeriod); - if (PlannedStartDateElement is not null) yield return new KeyValuePair("plannedStartDate",PlannedStartDateElement); - if (PlannedEndDateElement is not null) yield return new KeyValuePair("plannedEndDate",PlannedEndDateElement); - if (Length is not null) yield return new KeyValuePair("length",Length); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); - if (DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",DietPreference); - if (SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",SpecialArrangement); - if (SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",SpecialCourtesy); - if (Admission is not null) yield return new KeyValuePair("admission",Admission); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Class?.Any() == true) yield return new KeyValuePair("class",_Class); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_SubjectStatus is not null) yield return new KeyValuePair("subjectStatus",_SubjectStatus); + if (_EpisodeOfCare?.Any() == true) yield return new KeyValuePair("episodeOfCare",_EpisodeOfCare); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_ServiceProvider is not null) yield return new KeyValuePair("serviceProvider",_ServiceProvider); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Appointment?.Any() == true) yield return new KeyValuePair("appointment",_Appointment); + if (_VirtualService?.Any() == true) yield return new KeyValuePair("virtualService",_VirtualService); + if (_ActualPeriod is not null) yield return new KeyValuePair("actualPeriod",_ActualPeriod); + if (_PlannedStartDateElement is not null) yield return new KeyValuePair("plannedStartDate",_PlannedStartDateElement); + if (_PlannedEndDateElement is not null) yield return new KeyValuePair("plannedEndDate",_PlannedEndDateElement); + if (_Length is not null) yield return new KeyValuePair("length",_Length); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); + if (_DietPreference?.Any() == true) yield return new KeyValuePair("dietPreference",_DietPreference); + if (_SpecialArrangement?.Any() == true) yield return new KeyValuePair("specialArrangement",_SpecialArrangement); + if (_SpecialCourtesy?.Any() == true) yield return new KeyValuePair("specialCourtesy",_SpecialCourtesy); + if (_Admission is not null) yield return new KeyValuePair("admission",_Admission); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs b/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs index 77f02732d..296f80b6a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,13 +87,13 @@ public partial class LocationComponent : Hl7.Fhir.Model.BackboneElement [References("Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// The physical type of the location (usually the level in the location hierarchy - bed, room, ward, virtual etc.). @@ -98,26 +101,22 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("form", Order=50)] [Binding("LocationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; protected internal override void CopyToInternal(Base other) { - var dest = other as LocationComponent; - - if (dest == null) - { + if(other is not LocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -129,41 +128,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LocationComponent; - if(otherT == null) return false; + if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -174,8 +173,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Form is not null) yield return new KeyValuePair("form",Form); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Form is not null) yield return new KeyValuePair("form",_Form); } } @@ -187,13 +186,13 @@ public override IEnumerable> EnumerateElements() [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Identifier(s) by which this encounter is known. @@ -203,11 +202,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | in-progress | on-hold | discharged | completed | cancelled | discontinued | entered-in-error | unknown. @@ -217,13 +216,13 @@ public List Identifier [Binding("EncounterStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | in-progress | on-hold | discharged | completed | cancelled | discontinued | entered-in-error | unknown @@ -232,13 +231,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EncounterStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -250,13 +246,13 @@ public Hl7.Fhir.Model.EncounterStatus? Status [Binding("EncounterClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Class + public Hl7.Fhir.Model.CodeableConcept? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.CodeableConcept _Class; + private Hl7.Fhir.Model.CodeableConcept? _Class; /// /// Specific type of encounter. @@ -267,11 +263,11 @@ public Hl7.Fhir.Model.CodeableConcept Class [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specific type of service. @@ -282,11 +278,11 @@ public List Type [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The patient or group related to this encounter. @@ -295,13 +291,13 @@ public List ServiceType [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The current status of the subject in relation to the Encounter. @@ -309,54 +305,51 @@ public Hl7.Fhir.Model.ResourceReference Subject [FhirElement("subjectStatus", Order=160)] [Binding("SubjectStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubjectStatus + public Hl7.Fhir.Model.CodeableConcept? SubjectStatus { get { return _SubjectStatus; } set { _SubjectStatus = value; OnPropertyChanged("SubjectStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _SubjectStatus; + private Hl7.Fhir.Model.CodeableConcept? _SubjectStatus; /// /// The actual start and end time associated with this set of values associated with the encounter. /// [FhirElement("actualPeriod", Order=170, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ActualPeriod + public Hl7.Fhir.Model.Period? ActualPeriod { get { return _ActualPeriod; } set { _ActualPeriod = value; OnPropertyChanged("ActualPeriod"); } } - private Hl7.Fhir.Model.Period _ActualPeriod; + private Hl7.Fhir.Model.Period? _ActualPeriod; /// /// The planned start date/time (or admission date) of the encounter. /// [FhirElement("plannedStartDate", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PlannedStartDateElement + public Hl7.Fhir.Model.FhirDateTime? PlannedStartDateElement { get { return _PlannedStartDateElement; } set { _PlannedStartDateElement = value; OnPropertyChanged("PlannedStartDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PlannedStartDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PlannedStartDateElement; /// /// The planned start date/time (or admission date) of the encounter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PlannedStartDate + public string? PlannedStartDate { - get { return PlannedStartDateElement != null ? PlannedStartDateElement.Value : null; } + get => _PlannedStartDateElement?.Value; set { - if (value == null) - PlannedStartDateElement = null; - else - PlannedStartDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PlannedStartDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PlannedStartDate"); } } @@ -366,28 +359,25 @@ public string PlannedStartDate /// [FhirElement("plannedEndDate", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime PlannedEndDateElement + public Hl7.Fhir.Model.FhirDateTime? PlannedEndDateElement { get { return _PlannedEndDateElement; } set { _PlannedEndDateElement = value; OnPropertyChanged("PlannedEndDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _PlannedEndDateElement; + private Hl7.Fhir.Model.FhirDateTime? _PlannedEndDateElement; /// /// The planned end date/time (or discharge date) of the encounter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PlannedEndDate + public string? PlannedEndDate { - get { return PlannedEndDateElement != null ? PlannedEndDateElement.Value : null; } + get => _PlannedEndDateElement?.Value; set { - if (value == null) - PlannedEndDateElement = null; - else - PlannedEndDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + PlannedEndDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("PlannedEndDate"); } } @@ -397,13 +387,13 @@ public string PlannedEndDate /// [FhirElement("length", Order=200)] [DataMember] - public Hl7.Fhir.Model.Duration Length + public Hl7.Fhir.Model.Duration? Length { get { return _Length; } set { _Length = value; OnPropertyChanged("Length"); } } - private Hl7.Fhir.Model.Duration _Length; + private Hl7.Fhir.Model.Duration? _Length; /// /// Location of the patient at this point in the encounter. @@ -413,37 +403,33 @@ public Hl7.Fhir.Model.Duration Length [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EncounterHistory; - - if (dest == null) - { + if(other is not EncounterHistory dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Class != null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(SubjectStatus != null) dest.SubjectStatus = (Hl7.Fhir.Model.CodeableConcept)SubjectStatus.DeepCopyInternal(); - if(ActualPeriod != null) dest.ActualPeriod = (Hl7.Fhir.Model.Period)ActualPeriod.DeepCopyInternal(); - if(PlannedStartDateElement != null) dest.PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime)PlannedStartDateElement.DeepCopyInternal(); - if(PlannedEndDateElement != null) dest.PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime)PlannedEndDateElement.DeepCopyInternal(); - if(Length != null) dest.Length = (Hl7.Fhir.Model.Duration)Length.DeepCopyInternal(); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)_Class.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_SubjectStatus is not null) dest.SubjectStatus = (Hl7.Fhir.Model.CodeableConcept)_SubjectStatus.DeepCopyInternal(); + if(_ActualPeriod is not null) dest.ActualPeriod = (Hl7.Fhir.Model.Period)_ActualPeriod.DeepCopyInternal(); + if(_PlannedStartDateElement is not null) dest.PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime)_PlannedStartDateElement.DeepCopyInternal(); + if(_PlannedEndDateElement is not null) dest.PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime)_PlannedEndDateElement.DeepCopyInternal(); + if(_Length is not null) dest.Length = (Hl7.Fhir.Model.Duration)_Length.DeepCopyInternal(); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -455,118 +441,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EncounterHistory; - if(otherT == null) return false; + if(other is not EncounterHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(SubjectStatus, otherT.SubjectStatus)) return false; - if(!comparer.Equals(ActualPeriod, otherT.ActualPeriod)) return false; - if(!comparer.Equals(PlannedStartDateElement, otherT.PlannedStartDateElement)) return false; - if(!comparer.Equals(PlannedEndDateElement, otherT.PlannedEndDateElement)) return false; - if(!comparer.Equals(Length, otherT.Length)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_SubjectStatus, otherT._SubjectStatus)) return false; + if(!comparer.Equals(_ActualPeriod, otherT._ActualPeriod)) return false; + if(!comparer.Equals(_PlannedStartDateElement, otherT._PlannedStartDateElement)) return false; + if(!comparer.Equals(_PlannedEndDateElement, otherT._PlannedEndDateElement)) return false; + if(!comparer.Equals(_Length, otherT._Length)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "subjectStatus": - value = SubjectStatus; - return SubjectStatus is not null; + value = _SubjectStatus; + return _SubjectStatus is not null; case "actualPeriod": - value = ActualPeriod; - return ActualPeriod is not null; + value = _ActualPeriod; + return _ActualPeriod is not null; case "plannedStartDate": - value = PlannedStartDateElement; - return PlannedStartDateElement is not null; + value = _PlannedStartDateElement; + return _PlannedStartDateElement is not null; case "plannedEndDate": - value = PlannedEndDateElement; - return PlannedEndDateElement is not null; + value = _PlannedEndDateElement; + return _PlannedEndDateElement is not null; case "length": - value = Length; - return Length is not null; + value = _Length; + return _Length is not null; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "class": - Class = (Hl7.Fhir.Model.CodeableConcept)value; + Class = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subjectStatus": - SubjectStatus = (Hl7.Fhir.Model.CodeableConcept)value; + SubjectStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actualPeriod": - ActualPeriod = (Hl7.Fhir.Model.Period)value; + ActualPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "plannedStartDate": - PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PlannedStartDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "plannedEndDate": - PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + PlannedEndDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "length": - Length = (Hl7.Fhir.Model.Duration)value; + Length = (Hl7.Fhir.Model.Duration?)value; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; default: return base.SetValue(key, value); @@ -577,19 +563,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (SubjectStatus is not null) yield return new KeyValuePair("subjectStatus",SubjectStatus); - if (ActualPeriod is not null) yield return new KeyValuePair("actualPeriod",ActualPeriod); - if (PlannedStartDateElement is not null) yield return new KeyValuePair("plannedStartDate",PlannedStartDateElement); - if (PlannedEndDateElement is not null) yield return new KeyValuePair("plannedEndDate",PlannedEndDateElement); - if (Length is not null) yield return new KeyValuePair("length",Length); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_SubjectStatus is not null) yield return new KeyValuePair("subjectStatus",_SubjectStatus); + if (_ActualPeriod is not null) yield return new KeyValuePair("actualPeriod",_ActualPeriod); + if (_PlannedStartDateElement is not null) yield return new KeyValuePair("plannedStartDate",_PlannedStartDateElement); + if (_PlannedEndDateElement is not null) yield return new KeyValuePair("plannedEndDate",_PlannedEndDateElement); + if (_Length is not null) yield return new KeyValuePair("length",_Length); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs index 5fbb74d3a..aceb68fa7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -125,11 +128,11 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this). @@ -140,24 +143,24 @@ public List Type [DataMember] public List MimeTypeElement { - get { if(_MimeTypeElement==null) _MimeTypeElement = new List(); return _MimeTypeElement; } + get => _MimeTypeElement ?? new List(); set { _MimeTypeElement = value; OnPropertyChanged("MimeTypeElement"); } } - private List _MimeTypeElement; + private List? _MimeTypeElement; /// /// Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable MimeType + public IEnumerable? MimeType { - get { return MimeTypeElement != null ? MimeTypeElement.Select(elem => elem.Value) : null; } + get => _MimeTypeElement?.Select(elem => elem.Value); set { if (value == null) - MimeTypeElement = null; + MimeTypeElement = null!; else MimeTypeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("MimeType"); @@ -166,16 +169,12 @@ public IEnumerable MimeType protected internal override void CopyToInternal(Base other) { - var dest = other as PayloadComponent; - - if (dest == null) - { + if(other is not PayloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(MimeTypeElement.Any()) dest.MimeTypeElement = new List(MimeTypeElement.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_MimeTypeElement is not null) dest.MimeTypeElement = new List(_MimeTypeElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -187,41 +186,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayloadComponent; - if(otherT == null) return false; + if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(MimeTypeElement, otherT.MimeTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_MimeTypeElement, otherT._MimeTypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "mimeType": - value = MimeTypeElement; - return MimeTypeElement?.Any() == true; + value = _MimeTypeElement; + return _MimeTypeElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "mimeType": - MimeTypeElement = (List)value; + MimeTypeElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -232,8 +231,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (MimeTypeElement?.Any() == true) yield return new KeyValuePair("mimeType",MimeTypeElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_MimeTypeElement?.Any() == true) yield return new KeyValuePair("mimeType",_MimeTypeElement); } } @@ -246,11 +245,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | error | off | entered-in-error | test. @@ -260,13 +259,13 @@ public List Identifier [Binding("EndpointStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | error | off | entered-in-error | test @@ -275,13 +274,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -295,39 +291,36 @@ public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status [DataMember] public List ConnectionType { - get { if(_ConnectionType==null) _ConnectionType = new List(); return _ConnectionType; } + get => _ConnectionType ?? new List(); set { _ConnectionType = value; OnPropertyChanged("ConnectionType"); } } - private List _ConnectionType; + private List? _ConnectionType; /// /// A name that this endpoint can be identified by. /// [FhirElement("name", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name that this endpoint can be identified by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -337,28 +330,25 @@ public string Name /// [FhirElement("description", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Additional details about the endpoint that could be displayed as further information to identify the description beyond its name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -372,11 +362,11 @@ public string Description [DataMember] public List EnvironmentType { - get { if(_EnvironmentType==null) _EnvironmentType = new List(); return _EnvironmentType; } + get => _EnvironmentType ?? new List(); set { _EnvironmentType = value; OnPropertyChanged("EnvironmentType"); } } - private List _EnvironmentType; + private List? _EnvironmentType; /// /// Organization that manages this endpoint (might not be the organization that exposes the endpoint). @@ -385,13 +375,13 @@ public List EnvironmentType [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Contact details for source (e.g. troubleshooting). @@ -401,24 +391,24 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Interval the endpoint is expected to be operational. /// [FhirElement("period", InSummary=true, Order=170, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Set of payloads that are provided by this endpoint. @@ -428,11 +418,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Payload { - get { if(_Payload==null) _Payload = new List(); return _Payload; } + get => _Payload ?? new List(); set { _Payload = value; OnPropertyChanged("Payload"); } } - private List _Payload; + private List? _Payload; /// /// The technical base address for connecting to this endpoint. @@ -440,28 +430,25 @@ public List Payload [FhirElement("address", InSummary=true, Order=190)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl AddressElement + public Hl7.Fhir.Model.FhirUrl? AddressElement { get { return _AddressElement; } set { _AddressElement = value; OnPropertyChanged("AddressElement"); } } - private Hl7.Fhir.Model.FhirUrl _AddressElement; + private Hl7.Fhir.Model.FhirUrl? _AddressElement; /// /// The technical base address for connecting to this endpoint /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Address + public string? Address { - get { return AddressElement != null ? AddressElement.Value : null; } + get => _AddressElement?.Value; set { - if (value == null) - AddressElement = null; - else - AddressElement = new Hl7.Fhir.Model.FhirUrl(value); + AddressElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Address"); } } @@ -474,24 +461,24 @@ public string Address [DataMember] public List HeaderElement { - get { if(_HeaderElement==null) _HeaderElement = new List(); return _HeaderElement; } + get => _HeaderElement ?? new List(); set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } - private List _HeaderElement; + private List? _HeaderElement; /// /// Usage depends on the channel type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Header + public IEnumerable? Header { - get { return HeaderElement != null ? HeaderElement.Select(elem => elem.Value) : null; } + get => _HeaderElement?.Select(elem => elem.Value); set { if (value == null) - HeaderElement = null; + HeaderElement = null!; else HeaderElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Header"); @@ -502,26 +489,22 @@ public IEnumerable Header protected internal override void CopyToInternal(Base other) { - var dest = other as Endpoint; - - if (dest == null) - { + if(other is not Endpoint dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ConnectionType.Any()) dest.ConnectionType = new List(ConnectionType.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(EnvironmentType.Any()) dest.EnvironmentType = new List(EnvironmentType.DeepCopyInternal()); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Payload.Any()) dest.Payload = new List(Payload.DeepCopyInternal()); - if(AddressElement != null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)AddressElement.DeepCopyInternal(); - if(HeaderElement.Any()) dest.HeaderElement = new List(HeaderElement.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ConnectionType is not null) dest.ConnectionType = new List(_ConnectionType.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_EnvironmentType is not null) dest.EnvironmentType = new List(_EnvironmentType.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Payload is not null) dest.Payload = new List(_Payload.DeepCopyInternal()); + if(_AddressElement is not null) dest.AddressElement = (Hl7.Fhir.Model.FhirUrl)_AddressElement.DeepCopyInternal(); + if(_HeaderElement is not null) dest.HeaderElement = new List(_HeaderElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -533,111 +516,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Endpoint; - if(otherT == null) return false; + if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(ConnectionType, otherT.ConnectionType)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(EnvironmentType, otherT.EnvironmentType)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Payload, otherT.Payload)) return false; - if(!comparer.Equals(AddressElement, otherT.AddressElement)) return false; - if(!comparer.ListEquals(HeaderElement, otherT.HeaderElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_ConnectionType, otherT._ConnectionType)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_EnvironmentType, otherT._EnvironmentType)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "connectionType": - value = ConnectionType; - return ConnectionType?.Any() == true; + value = _ConnectionType; + return _ConnectionType?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "environmentType": - value = EnvironmentType; - return EnvironmentType?.Any() == true; + value = _EnvironmentType; + return _EnvironmentType?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "payload": - value = Payload; - return Payload?.Any() == true; + value = _Payload; + return _Payload?.Any() == true; case "address": - value = AddressElement; - return AddressElement is not null; + value = _AddressElement; + return _AddressElement is not null; case "header": - value = HeaderElement; - return HeaderElement?.Any() == true; + value = _HeaderElement; + return _HeaderElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "connectionType": - ConnectionType = (List)value; + ConnectionType = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "environmentType": - EnvironmentType = (List)value; + EnvironmentType = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "payload": - Payload = (List)value; + Payload = (List?)value!; return this; case "address": - AddressElement = (Hl7.Fhir.Model.FhirUrl)value; + AddressElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "header": - HeaderElement = (List)value; + HeaderElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -648,18 +631,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ConnectionType?.Any() == true) yield return new KeyValuePair("connectionType",ConnectionType); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (EnvironmentType?.Any() == true) yield return new KeyValuePair("environmentType",EnvironmentType); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Payload?.Any() == true) yield return new KeyValuePair("payload",Payload); - if (AddressElement is not null) yield return new KeyValuePair("address",AddressElement); - if (HeaderElement?.Any() == true) yield return new KeyValuePair("header",HeaderElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ConnectionType?.Any() == true) yield return new KeyValuePair("connectionType",_ConnectionType); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_EnvironmentType?.Any() == true) yield return new KeyValuePair("environmentType",_EnvironmentType); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Payload?.Any() == true) yield return new KeyValuePair("payload",_Payload); + if (_AddressElement is not null) yield return new KeyValuePair("address",_AddressElement); + if (_HeaderElement?.Any() == true) yield return new KeyValuePair("header",_HeaderElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs index ec9f2098f..aa70beb22 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -80,13 +83,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -95,13 +98,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -111,28 +111,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status /// [FhirElement("created", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -144,13 +141,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Responsible practitioner. @@ -159,13 +156,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// The subject to be enrolled. @@ -174,13 +171,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Candidate + public Hl7.Fhir.Model.ResourceReference? Candidate { get { return _Candidate; } set { _Candidate = value; OnPropertyChanged("Candidate"); } } - private Hl7.Fhir.Model.ResourceReference _Candidate; + private Hl7.Fhir.Model.ResourceReference? _Candidate; /// /// Insurance information. @@ -189,33 +186,29 @@ public Hl7.Fhir.Model.ResourceReference Candidate [CLSCompliant(false)] [References("Coverage")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentRequest; - - if (dest == null) - { + if(other is not EnrollmentRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Candidate != null) dest.Candidate = (Hl7.Fhir.Model.ResourceReference)Candidate.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Candidate is not null) dest.Candidate = (Hl7.Fhir.Model.ResourceReference)_Candidate.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -227,76 +220,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentRequest; - if(otherT == null) return false; + if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Candidate, otherT.Candidate)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Candidate, otherT._Candidate)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "candidate": - value = Candidate; - return Candidate is not null; + value = _Candidate; + return _Candidate is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "candidate": - Candidate = (Hl7.Fhir.Model.ResourceReference)value; + Candidate = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -307,13 +300,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Candidate is not null) yield return new KeyValuePair("candidate",Candidate); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Candidate is not null) yield return new KeyValuePair("candidate",_Candidate); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs index ece816185..9ff013da2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -101,11 +104,11 @@ public enum EnrollmentOutcome [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -114,13 +117,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentResponseStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -129,13 +132,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -147,13 +147,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("EnrollmentRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// queued | complete | error | partial. @@ -162,13 +162,13 @@ public Hl7.Fhir.Model.ResourceReference Request [DeclaredType(Type = typeof(Code))] [Binding("EnrollmentOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -177,13 +177,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.EnrollmentResponse.EnrollmentOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -193,28 +190,25 @@ public Hl7.Fhir.Model.EnrollmentResponse.EnrollmentOutcome? Outcome /// [FhirElement("disposition", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -224,28 +218,25 @@ public string Disposition /// [FhirElement("created", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -257,13 +248,13 @@ public string Created [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Responsible practitioner. @@ -272,34 +263,30 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestProvider + public Hl7.Fhir.Model.ResourceReference? RequestProvider { get { return _RequestProvider; } set { _RequestProvider = value; OnPropertyChanged("RequestProvider"); } } - private Hl7.Fhir.Model.ResourceReference _RequestProvider; + private Hl7.Fhir.Model.ResourceReference? _RequestProvider; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EnrollmentResponse; - - if (dest == null) - { + if(other is not EnrollmentResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(RequestProvider != null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)RequestProvider.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_RequestProvider is not null) dest.RequestProvider = (Hl7.Fhir.Model.ResourceReference)_RequestProvider.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -311,83 +298,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnrollmentResponse; - if(otherT == null) return false; + if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(RequestProvider, otherT.RequestProvider)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "requestProvider": - value = RequestProvider; - return RequestProvider is not null; + value = _RequestProvider; + return _RequestProvider is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestProvider": - RequestProvider = (Hl7.Fhir.Model.ResourceReference)value; + RequestProvider = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -398,14 +385,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (RequestProvider is not null) yield return new KeyValuePair("requestProvider",RequestProvider); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_RequestProvider is not null) yield return new KeyValuePair("requestProvider",_RequestProvider); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs index 34b0df557..f65216dfe 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -135,13 +138,13 @@ public partial class StatusHistoryComponent : Hl7.Fhir.Model.BackboneElement [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -150,13 +153,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -167,26 +167,22 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [FhirElement("period", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as StatusHistoryComponent; - - if (dest == null) - { + if(other is not StatusHistoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -198,41 +194,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatusHistoryComponent; - if(otherT == null) return false; + if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -243,8 +239,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -274,13 +270,13 @@ public partial class ReasonComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("use", InSummary=true, Order=40)] [Binding("reason-use")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Use + public Hl7.Fhir.Model.CodeableConcept? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.CodeableConcept _Use; + private Hl7.Fhir.Model.CodeableConcept? _Use; /// /// Medical reason to be addressed. @@ -291,24 +287,20 @@ public Hl7.Fhir.Model.CodeableConcept Use [DataMember] public List Value { - get { if(_Value==null) _Value = new List(); return _Value; } + get => _Value ?? new List(); set { _Value = value; OnPropertyChanged("Value"); } } - private List _Value; + private List? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ReasonComponent; - - if (dest == null) - { + if(other is not ReasonComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Use != null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)Use.DeepCopyInternal(); - if(Value.Any()) dest.Value = new List(Value.DeepCopyInternal()); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)_Use.DeepCopyInternal(); + if(_Value is not null) dest.Value = new List(_Value.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -320,41 +312,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReasonComponent; - if(otherT == null) return false; + if(other is not ReasonComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; - if(!comparer.ListEquals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Use, otherT._Use)) return false; + if(!comparer.ListEquals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; case "value": - value = Value; - return Value?.Any() == true; + value = _Value; + return _Value?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - Use = (Hl7.Fhir.Model.CodeableConcept)value; + Use = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (List)value; + Value = (List?)value!; return this; default: return base.SetValue(key, value); @@ -365,8 +357,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Use is not null) yield return new KeyValuePair("use",Use); - if (Value?.Any() == true) yield return new KeyValuePair("value",Value); + if (_Use is not null) yield return new KeyValuePair("use",_Use); + if (_Value?.Any() == true) yield return new KeyValuePair("value",_Value); } } @@ -397,11 +389,11 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …). @@ -409,26 +401,22 @@ public List Condition [FhirElement("use", InSummary=true, Order=50)] [Binding("DiagnosisUse")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Use + public Hl7.Fhir.Model.CodeableConcept? Use { get { return _Use; } set { _Use = value; OnPropertyChanged("Use"); } } - private Hl7.Fhir.Model.CodeableConcept _Use; + private Hl7.Fhir.Model.CodeableConcept? _Use; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Use != null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)Use.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Use is not null) dest.Use = (Hl7.Fhir.Model.CodeableConcept)_Use.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -440,41 +428,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Use, otherT.Use)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Use, otherT._Use)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "use": - value = Use; - return Use is not null; + value = _Use; + return _Use is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "use": - Use = (Hl7.Fhir.Model.CodeableConcept)value; + Use = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -485,8 +473,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Use is not null) yield return new KeyValuePair("use",Use); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Use is not null) yield return new KeyValuePair("use",_Use); } } @@ -499,11 +487,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error. @@ -513,13 +501,13 @@ public List Identifier [Binding("EpisodeOfCareStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// planned | waitlist | active | onhold | finished | cancelled | entered-in-error @@ -528,13 +516,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -547,11 +532,11 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get { if(_StatusHistory==null) _StatusHistory = new List(); return _StatusHistory; } + get => _StatusHistory ?? new List(); set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } - private List _StatusHistory; + private List? _StatusHistory; /// /// Type/class - e.g. specialist referral, disease management. @@ -562,11 +547,11 @@ public List StatusHistory [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// The list of medical reasons that are expected to be addressed during the episode of care. @@ -576,11 +561,11 @@ public List Type [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// The list of medical conditions that were addressed during the episode of care. @@ -590,11 +575,11 @@ public List Reason [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// The patient who is the focus of this episode of care. @@ -604,13 +589,13 @@ public List Diagnosis [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Organization that assumes responsibility for care coordination. @@ -619,26 +604,26 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Interval during responsibility is assumed. /// [FhirElement("period", InSummary=true, Order=170, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Originating Referral Request(s). @@ -650,11 +635,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List ReferralRequest { - get { if(_ReferralRequest==null) _ReferralRequest = new List(); return _ReferralRequest; } + get => _ReferralRequest ?? new List(); set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } - private List _ReferralRequest; + private List? _ReferralRequest; /// /// Care manager/care coordinator for the patient. @@ -663,13 +648,13 @@ public List ReferralRequest [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference CareManager + public Hl7.Fhir.Model.ResourceReference? CareManager { get { return _CareManager; } set { _CareManager = value; OnPropertyChanged("CareManager"); } } - private Hl7.Fhir.Model.ResourceReference _CareManager; + private Hl7.Fhir.Model.ResourceReference? _CareManager; /// /// Other practitioners facilitating this episode of care. @@ -681,11 +666,11 @@ public Hl7.Fhir.Model.ResourceReference CareManager [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// The set of accounts that may be used for billing for this EpisodeOfCare. @@ -697,37 +682,33 @@ public List CareTeam [DataMember] public List Account { - get { if(_Account==null) _Account = new List(); return _Account; } + get => _Account ?? new List(); set { _Account = value; OnPropertyChanged("Account"); } } - private List _Account; + private List? _Account; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EpisodeOfCare; - - if (dest == null) - { + if(other is not EpisodeOfCare dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusHistory.Any()) dest.StatusHistory = new List(StatusHistory.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(ReferralRequest.Any()) dest.ReferralRequest = new List(ReferralRequest.DeepCopyInternal()); - if(CareManager != null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)CareManager.DeepCopyInternal(); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(Account.Any()) dest.Account = new List(Account.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusHistory is not null) dest.StatusHistory = new List(_StatusHistory.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_ReferralRequest is not null) dest.ReferralRequest = new List(_ReferralRequest.DeepCopyInternal()); + if(_CareManager is not null) dest.CareManager = (Hl7.Fhir.Model.ResourceReference)_CareManager.DeepCopyInternal(); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_Account is not null) dest.Account = new List(_Account.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -739,118 +720,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EpisodeOfCare; - if(otherT == null) return false; + if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusHistory, otherT.StatusHistory)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(ReferralRequest, otherT.ReferralRequest)) return false; - if(!comparer.Equals(CareManager, otherT.CareManager)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(Account, otherT.Account)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_ReferralRequest, otherT._ReferralRequest)) return false; + if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_Account, otherT._Account)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusHistory": - value = StatusHistory; - return StatusHistory?.Any() == true; + value = _StatusHistory; + return _StatusHistory?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "referralRequest": - value = ReferralRequest; - return ReferralRequest?.Any() == true; + value = _ReferralRequest; + return _ReferralRequest?.Any() == true; case "careManager": - value = CareManager; - return CareManager is not null; + value = _CareManager; + return _CareManager is not null; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "account": - value = Account; - return Account?.Any() == true; + value = _Account; + return _Account?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusHistory": - StatusHistory = (List)value; + StatusHistory = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "referralRequest": - ReferralRequest = (List)value; + ReferralRequest = (List?)value!; return this; case "careManager": - CareManager = (Hl7.Fhir.Model.ResourceReference)value; + CareManager = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "account": - Account = (List)value; + Account = (List?)value!; return this; default: return base.SetValue(key, value); @@ -861,19 +842,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",StatusHistory); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",ReferralRequest); - if (CareManager is not null) yield return new KeyValuePair("careManager",CareManager); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (Account?.Any() == true) yield return new KeyValuePair("account",Account); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusHistory?.Any() == true) yield return new KeyValuePair("statusHistory",_StatusHistory); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_ReferralRequest?.Any() == true) yield return new KeyValuePair("referralRequest",_ReferralRequest); + if (_CareManager is not null) yield return new KeyValuePair("careManager",_CareManager); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_Account?.Any() == true) yield return new KeyValuePair("account",_Account); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs index 45cc397d0..3647899ec 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class EventDefinition : Hl7.Fhir.Model.DomainResource, IIdentifia /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this event definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the event definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -142,41 +139,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this event definition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this event definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -186,28 +180,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this event definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -217,28 +208,25 @@ public string Title /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -251,13 +239,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -266,13 +254,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -282,13 +267,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -297,13 +282,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -317,41 +299,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -361,28 +340,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -395,39 +371,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the event definition. /// [FhirElement("description", Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -440,11 +413,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for event definition (if applicable). @@ -455,39 +428,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this event definition is defined. /// [FhirElement("purpose", Order=250, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this event definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -497,28 +467,25 @@ public string Purpose /// [FhirElement("usage", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown UsageElement + public Hl7.Fhir.Model.Markdown? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.Markdown _UsageElement; + private Hl7.Fhir.Model.Markdown? _UsageElement; /// /// Describes the clinical usage of the event definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.Markdown(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Usage"); } } @@ -528,28 +495,25 @@ public string Usage /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -559,28 +523,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -590,28 +551,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the event definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -621,28 +579,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the event definition was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -652,13 +607,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -669,11 +624,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -683,11 +638,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -697,11 +652,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -711,11 +666,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -725,11 +680,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -739,11 +694,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// "when" the event occurs (multiple = 'or'). @@ -753,54 +708,50 @@ public List RelatedArtifact [DataMember] public List Trigger { - get { if(_Trigger==null) _Trigger = new List(); return _Trigger; } + get => _Trigger ?? new List(); set { _Trigger = value; OnPropertyChanged("Trigger"); } } - private List _Trigger; + private List? _Trigger; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EventDefinition; - - if (dest == null) - { + if(other is not EventDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Trigger.Any()) dest.Trigger = new List(Trigger.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Trigger is not null) dest.Trigger = new List(_Trigger.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -812,237 +763,237 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventDefinition; - if(otherT == null) return false; + if(other is not EventDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Trigger, otherT.Trigger)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "trigger": - value = Trigger; - return Trigger?.Any() == true; + value = _Trigger; + return _Trigger?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.Markdown)value; + UsageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "trigger": - Trigger = (List)value; + Trigger = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1053,36 +1004,36 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Trigger?.Any() == true) yield return new KeyValuePair("trigger",Trigger); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Trigger?.Any() == true) yield return new KeyValuePair("trigger",_Trigger); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs index e39293842..4136f84dc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -77,28 +80,25 @@ public partial class VariableDefinitionComponent : Hl7.Fhir.Model.BackboneElemen /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// A text description or summary of the variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -111,11 +111,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// population | subpopulation | exposure | referenceExposure | measuredVariable | confounder. @@ -124,13 +124,13 @@ public List Note [Binding("EvidenceVariableRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VariableRole + public Hl7.Fhir.Model.CodeableConcept? VariableRole { get { return _VariableRole; } set { _VariableRole = value; OnPropertyChanged("VariableRole"); } } - private Hl7.Fhir.Model.CodeableConcept _VariableRole; + private Hl7.Fhir.Model.CodeableConcept? _VariableRole; /// /// Definition of the actual variable related to the statistic(s). @@ -139,13 +139,13 @@ public Hl7.Fhir.Model.CodeableConcept VariableRole [CLSCompliant(false)] [References("Group","EvidenceVariable")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Observed + public Hl7.Fhir.Model.ResourceReference? Observed { get { return _Observed; } set { _Observed = value; OnPropertyChanged("Observed"); } } - private Hl7.Fhir.Model.ResourceReference _Observed; + private Hl7.Fhir.Model.ResourceReference? _Observed; /// /// Definition of the intended variable related to the Evidence. @@ -154,13 +154,13 @@ public Hl7.Fhir.Model.ResourceReference Observed [CLSCompliant(false)] [References("Group","EvidenceVariable")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Intended + public Hl7.Fhir.Model.ResourceReference? Intended { get { return _Intended; } set { _Intended = value; OnPropertyChanged("Intended"); } } - private Hl7.Fhir.Model.ResourceReference _Intended; + private Hl7.Fhir.Model.ResourceReference? _Intended; /// /// low | moderate | high | exact. @@ -168,30 +168,26 @@ public Hl7.Fhir.Model.ResourceReference Intended [FhirElement("directnessMatch", Order=90)] [Binding("EvidenceDirectness")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DirectnessMatch + public Hl7.Fhir.Model.CodeableConcept? DirectnessMatch { get { return _DirectnessMatch; } set { _DirectnessMatch = value; OnPropertyChanged("DirectnessMatch"); } } - private Hl7.Fhir.Model.CodeableConcept _DirectnessMatch; + private Hl7.Fhir.Model.CodeableConcept? _DirectnessMatch; protected internal override void CopyToInternal(Base other) { - var dest = other as VariableDefinitionComponent; - - if (dest == null) - { + if(other is not VariableDefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(VariableRole != null) dest.VariableRole = (Hl7.Fhir.Model.CodeableConcept)VariableRole.DeepCopyInternal(); - if(Observed != null) dest.Observed = (Hl7.Fhir.Model.ResourceReference)Observed.DeepCopyInternal(); - if(Intended != null) dest.Intended = (Hl7.Fhir.Model.ResourceReference)Intended.DeepCopyInternal(); - if(DirectnessMatch != null) dest.DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept)DirectnessMatch.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_VariableRole is not null) dest.VariableRole = (Hl7.Fhir.Model.CodeableConcept)_VariableRole.DeepCopyInternal(); + if(_Observed is not null) dest.Observed = (Hl7.Fhir.Model.ResourceReference)_Observed.DeepCopyInternal(); + if(_Intended is not null) dest.Intended = (Hl7.Fhir.Model.ResourceReference)_Intended.DeepCopyInternal(); + if(_DirectnessMatch is not null) dest.DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept)_DirectnessMatch.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -203,69 +199,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableDefinitionComponent; - if(otherT == null) return false; + if(other is not VariableDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(VariableRole, otherT.VariableRole)) return false; - if(!comparer.Equals(Observed, otherT.Observed)) return false; - if(!comparer.Equals(Intended, otherT.Intended)) return false; - if(!comparer.Equals(DirectnessMatch, otherT.DirectnessMatch)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_VariableRole, otherT._VariableRole)) return false; + if(!comparer.Equals(_Observed, otherT._Observed)) return false; + if(!comparer.Equals(_Intended, otherT._Intended)) return false; + if(!comparer.Equals(_DirectnessMatch, otherT._DirectnessMatch)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "variableRole": - value = VariableRole; - return VariableRole is not null; + value = _VariableRole; + return _VariableRole is not null; case "observed": - value = Observed; - return Observed is not null; + value = _Observed; + return _Observed is not null; case "intended": - value = Intended; - return Intended is not null; + value = _Intended; + return _Intended is not null; case "directnessMatch": - value = DirectnessMatch; - return DirectnessMatch is not null; + value = _DirectnessMatch; + return _DirectnessMatch is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "variableRole": - VariableRole = (Hl7.Fhir.Model.CodeableConcept)value; + VariableRole = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "observed": - Observed = (Hl7.Fhir.Model.ResourceReference)value; + Observed = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "intended": - Intended = (Hl7.Fhir.Model.ResourceReference)value; + Intended = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "directnessMatch": - DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept)value; + DirectnessMatch = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -276,12 +272,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (VariableRole is not null) yield return new KeyValuePair("variableRole",VariableRole); - if (Observed is not null) yield return new KeyValuePair("observed",Observed); - if (Intended is not null) yield return new KeyValuePair("intended",Intended); - if (DirectnessMatch is not null) yield return new KeyValuePair("directnessMatch",DirectnessMatch); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_VariableRole is not null) yield return new KeyValuePair("variableRole",_VariableRole); + if (_Observed is not null) yield return new KeyValuePair("observed",_Observed); + if (_Intended is not null) yield return new KeyValuePair("intended",_Intended); + if (_DirectnessMatch is not null) yield return new KeyValuePair("directnessMatch",_DirectnessMatch); } } @@ -304,28 +300,25 @@ public partial class StatisticComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -338,11 +331,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Type of statistic, e.g., relative risk. @@ -350,52 +343,52 @@ public List Note [FhirElement("statisticType", Order=60)] [Binding("StatisticType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatisticType + public Hl7.Fhir.Model.CodeableConcept? StatisticType { get { return _StatisticType; } set { _StatisticType = value; OnPropertyChanged("StatisticType"); } } - private Hl7.Fhir.Model.CodeableConcept _StatisticType; + private Hl7.Fhir.Model.CodeableConcept? _StatisticType; /// /// Associated category for categorical variable. /// [FhirElement("category", Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Statistic value. /// [FhirElement("quantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The number of events associated with the statistic. /// [FhirElement("numberOfEvents", Order=90)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfEventsElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfEventsElement { get { return _NumberOfEventsElement; } set { _NumberOfEventsElement = value; OnPropertyChanged("NumberOfEventsElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfEventsElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfEventsElement; /// /// The number of events associated with the statistic @@ -404,13 +397,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfEventsElement [IgnoreDataMember] public int? NumberOfEvents { - get { return NumberOfEventsElement != null ? NumberOfEventsElement.Value : null; } + get => _NumberOfEventsElement?.Value; set { - if (value == null) - NumberOfEventsElement = null; - else - NumberOfEventsElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfEventsElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfEvents"); } } @@ -420,13 +410,13 @@ public int? NumberOfEvents /// [FhirElement("numberAffected", Order=100)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberAffectedElement + public Hl7.Fhir.Model.UnsignedInt? NumberAffectedElement { get { return _NumberAffectedElement; } set { _NumberAffectedElement = value; OnPropertyChanged("NumberAffectedElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberAffectedElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberAffectedElement; /// /// The number of participants affected @@ -435,13 +425,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberAffectedElement [IgnoreDataMember] public int? NumberAffected { - get { return NumberAffectedElement != null ? NumberAffectedElement.Value : null; } + get => _NumberAffectedElement?.Value; set { - if (value == null) - NumberAffectedElement = null; - else - NumberAffectedElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberAffectedElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberAffected"); } } @@ -451,13 +438,13 @@ public int? NumberAffected /// [FhirElement("sampleSize", Order=110)] [DataMember] - public Hl7.Fhir.Model.Evidence.SampleSizeComponent SampleSize + public Hl7.Fhir.Model.Evidence.SampleSizeComponent? SampleSize { get { return _SampleSize; } set { _SampleSize = value; OnPropertyChanged("SampleSize"); } } - private Hl7.Fhir.Model.Evidence.SampleSizeComponent _SampleSize; + private Hl7.Fhir.Model.Evidence.SampleSizeComponent? _SampleSize; /// /// An attribute of the Statistic. @@ -467,11 +454,11 @@ public Hl7.Fhir.Model.Evidence.SampleSizeComponent SampleSize [DataMember] public List AttributeEstimate { - get { if(_AttributeEstimate==null) _AttributeEstimate = new List(); return _AttributeEstimate; } + get => _AttributeEstimate ?? new List(); set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } - private List _AttributeEstimate; + private List? _AttributeEstimate; /// /// An aspect of the statistical model. @@ -481,32 +468,28 @@ public List AttributeEstimat [DataMember] public List ModelCharacteristic { - get { if(_ModelCharacteristic==null) _ModelCharacteristic = new List(); return _ModelCharacteristic; } + get => _ModelCharacteristic ?? new List(); set { _ModelCharacteristic = value; OnPropertyChanged("ModelCharacteristic"); } } - private List _ModelCharacteristic; + private List? _ModelCharacteristic; protected internal override void CopyToInternal(Base other) { - var dest = other as StatisticComponent; - - if (dest == null) - { + if(other is not StatisticComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(StatisticType != null) dest.StatisticType = (Hl7.Fhir.Model.CodeableConcept)StatisticType.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(NumberOfEventsElement != null) dest.NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfEventsElement.DeepCopyInternal(); - if(NumberAffectedElement != null) dest.NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt)NumberAffectedElement.DeepCopyInternal(); - if(SampleSize != null) dest.SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent)SampleSize.DeepCopyInternal(); - if(AttributeEstimate.Any()) dest.AttributeEstimate = new List(AttributeEstimate.DeepCopyInternal()); - if(ModelCharacteristic.Any()) dest.ModelCharacteristic = new List(ModelCharacteristic.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_StatisticType is not null) dest.StatisticType = (Hl7.Fhir.Model.CodeableConcept)_StatisticType.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_NumberOfEventsElement is not null) dest.NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfEventsElement.DeepCopyInternal(); + if(_NumberAffectedElement is not null) dest.NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt)_NumberAffectedElement.DeepCopyInternal(); + if(_SampleSize is not null) dest.SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent)_SampleSize.DeepCopyInternal(); + if(_AttributeEstimate is not null) dest.AttributeEstimate = new List(_AttributeEstimate.DeepCopyInternal()); + if(_ModelCharacteristic is not null) dest.ModelCharacteristic = new List(_ModelCharacteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -518,97 +501,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatisticComponent; - if(otherT == null) return false; + if(other is not StatisticComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(StatisticType, otherT.StatisticType)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(NumberOfEventsElement, otherT.NumberOfEventsElement)) return false; - if(!comparer.Equals(NumberAffectedElement, otherT.NumberAffectedElement)) return false; - if(!comparer.Equals(SampleSize, otherT.SampleSize)) return false; - if(!comparer.ListEquals(AttributeEstimate, otherT.AttributeEstimate)) return false; - if(!comparer.ListEquals(ModelCharacteristic, otherT.ModelCharacteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_StatisticType, otherT._StatisticType)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_NumberOfEventsElement, otherT._NumberOfEventsElement)) return false; + if(!comparer.Equals(_NumberAffectedElement, otherT._NumberAffectedElement)) return false; + if(!comparer.Equals(_SampleSize, otherT._SampleSize)) return false; + if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; + if(!comparer.ListEquals(_ModelCharacteristic, otherT._ModelCharacteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "statisticType": - value = StatisticType; - return StatisticType is not null; + value = _StatisticType; + return _StatisticType is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "numberOfEvents": - value = NumberOfEventsElement; - return NumberOfEventsElement is not null; + value = _NumberOfEventsElement; + return _NumberOfEventsElement is not null; case "numberAffected": - value = NumberAffectedElement; - return NumberAffectedElement is not null; + value = _NumberAffectedElement; + return _NumberAffectedElement is not null; case "sampleSize": - value = SampleSize; - return SampleSize is not null; + value = _SampleSize; + return _SampleSize is not null; case "attributeEstimate": - value = AttributeEstimate; - return AttributeEstimate?.Any() == true; + value = _AttributeEstimate; + return _AttributeEstimate?.Any() == true; case "modelCharacteristic": - value = ModelCharacteristic; - return ModelCharacteristic?.Any() == true; + value = _ModelCharacteristic; + return _ModelCharacteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "statisticType": - StatisticType = (Hl7.Fhir.Model.CodeableConcept)value; + StatisticType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "numberOfEvents": - NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfEventsElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberAffected": - NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberAffectedElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "sampleSize": - SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent)value; + SampleSize = (Hl7.Fhir.Model.Evidence.SampleSizeComponent?)value; return this; case "attributeEstimate": - AttributeEstimate = (List)value; + AttributeEstimate = (List?)value!; return this; case "modelCharacteristic": - ModelCharacteristic = (List)value; + ModelCharacteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -619,16 +602,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (StatisticType is not null) yield return new KeyValuePair("statisticType",StatisticType); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (NumberOfEventsElement is not null) yield return new KeyValuePair("numberOfEvents",NumberOfEventsElement); - if (NumberAffectedElement is not null) yield return new KeyValuePair("numberAffected",NumberAffectedElement); - if (SampleSize is not null) yield return new KeyValuePair("sampleSize",SampleSize); - if (AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",AttributeEstimate); - if (ModelCharacteristic?.Any() == true) yield return new KeyValuePair("modelCharacteristic",ModelCharacteristic); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_StatisticType is not null) yield return new KeyValuePair("statisticType",_StatisticType); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_NumberOfEventsElement is not null) yield return new KeyValuePair("numberOfEvents",_NumberOfEventsElement); + if (_NumberAffectedElement is not null) yield return new KeyValuePair("numberAffected",_NumberAffectedElement); + if (_SampleSize is not null) yield return new KeyValuePair("sampleSize",_SampleSize); + if (_AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",_AttributeEstimate); + if (_ModelCharacteristic?.Any() == true) yield return new KeyValuePair("modelCharacteristic",_ModelCharacteristic); } } @@ -651,28 +634,25 @@ public partial class SampleSizeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description of sample size for statistic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -685,24 +665,24 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Number of contributing studies. /// [FhirElement("numberOfStudies", Order=60)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfStudiesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfStudiesElement { get { return _NumberOfStudiesElement; } set { _NumberOfStudiesElement = value; OnPropertyChanged("NumberOfStudiesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfStudiesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfStudiesElement; /// /// Number of contributing studies @@ -711,13 +691,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfStudiesElement [IgnoreDataMember] public int? NumberOfStudies { - get { return NumberOfStudiesElement != null ? NumberOfStudiesElement.Value : null; } + get => _NumberOfStudiesElement?.Value; set { - if (value == null) - NumberOfStudiesElement = null; - else - NumberOfStudiesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfStudiesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfStudies"); } } @@ -727,13 +704,13 @@ public int? NumberOfStudies /// [FhirElement("numberOfParticipants", Order=70)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfParticipantsElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfParticipantsElement { get { return _NumberOfParticipantsElement; } set { _NumberOfParticipantsElement = value; OnPropertyChanged("NumberOfParticipantsElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfParticipantsElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfParticipantsElement; /// /// Cumulative number of participants @@ -742,13 +719,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfParticipantsElement [IgnoreDataMember] public int? NumberOfParticipants { - get { return NumberOfParticipantsElement != null ? NumberOfParticipantsElement.Value : null; } + get => _NumberOfParticipantsElement?.Value; set { - if (value == null) - NumberOfParticipantsElement = null; - else - NumberOfParticipantsElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfParticipantsElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfParticipants"); } } @@ -758,13 +732,13 @@ public int? NumberOfParticipants /// [FhirElement("knownDataCount", Order=80)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt KnownDataCountElement + public Hl7.Fhir.Model.UnsignedInt? KnownDataCountElement { get { return _KnownDataCountElement; } set { _KnownDataCountElement = value; OnPropertyChanged("KnownDataCountElement"); } } - private Hl7.Fhir.Model.UnsignedInt _KnownDataCountElement; + private Hl7.Fhir.Model.UnsignedInt? _KnownDataCountElement; /// /// Number of participants with known results for measured variables @@ -773,32 +747,25 @@ public Hl7.Fhir.Model.UnsignedInt KnownDataCountElement [IgnoreDataMember] public int? KnownDataCount { - get { return KnownDataCountElement != null ? KnownDataCountElement.Value : null; } + get => _KnownDataCountElement?.Value; set { - if (value == null) - KnownDataCountElement = null; - else - KnownDataCountElement = new Hl7.Fhir.Model.UnsignedInt(value); + KnownDataCountElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("KnownDataCount"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampleSizeComponent; - - if (dest == null) - { + if(other is not SampleSizeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(NumberOfStudiesElement != null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfStudiesElement.DeepCopyInternal(); - if(NumberOfParticipantsElement != null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfParticipantsElement.DeepCopyInternal(); - if(KnownDataCountElement != null) dest.KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt)KnownDataCountElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_NumberOfStudiesElement is not null) dest.NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfStudiesElement.DeepCopyInternal(); + if(_NumberOfParticipantsElement is not null) dest.NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfParticipantsElement.DeepCopyInternal(); + if(_KnownDataCountElement is not null) dest.KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt)_KnownDataCountElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -810,62 +777,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampleSizeComponent; - if(otherT == null) return false; + if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(NumberOfStudiesElement, otherT.NumberOfStudiesElement)) return false; - if(!comparer.Equals(NumberOfParticipantsElement, otherT.NumberOfParticipantsElement)) return false; - if(!comparer.Equals(KnownDataCountElement, otherT.KnownDataCountElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; + if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; + if(!comparer.Equals(_KnownDataCountElement, otherT._KnownDataCountElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "numberOfStudies": - value = NumberOfStudiesElement; - return NumberOfStudiesElement is not null; + value = _NumberOfStudiesElement; + return _NumberOfStudiesElement is not null; case "numberOfParticipants": - value = NumberOfParticipantsElement; - return NumberOfParticipantsElement is not null; + value = _NumberOfParticipantsElement; + return _NumberOfParticipantsElement is not null; case "knownDataCount": - value = KnownDataCountElement; - return KnownDataCountElement is not null; + value = _KnownDataCountElement; + return _KnownDataCountElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "numberOfStudies": - NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfStudiesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberOfParticipants": - NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfParticipantsElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "knownDataCount": - KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt)value; + KnownDataCountElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; default: return base.SetValue(key, value); @@ -876,11 +843,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",NumberOfStudiesElement); - if (NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",NumberOfParticipantsElement); - if (KnownDataCountElement is not null) yield return new KeyValuePair("knownDataCount",KnownDataCountElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_NumberOfStudiesElement is not null) yield return new KeyValuePair("numberOfStudies",_NumberOfStudiesElement); + if (_NumberOfParticipantsElement is not null) yield return new KeyValuePair("numberOfParticipants",_NumberOfParticipantsElement); + if (_KnownDataCountElement is not null) yield return new KeyValuePair("knownDataCount",_KnownDataCountElement); } } @@ -906,28 +873,25 @@ public partial class AttributeEstimateComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description of the attribute estimate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -940,11 +904,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The type of attribute estimate, e.g., confidence interval or p value. @@ -952,39 +916,39 @@ public List Note [FhirElement("type", Order=60)] [Binding("AttributeEstimateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Level of confidence interval, e.g., 0.95 for 95% confidence interval. /// [FhirElement("level", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LevelElement + public Hl7.Fhir.Model.FhirDecimal? LevelElement { get { return _LevelElement; } set { _LevelElement = value; OnPropertyChanged("LevelElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LevelElement; + private Hl7.Fhir.Model.FhirDecimal? _LevelElement; /// /// Level of confidence interval, e.g., 0.95 for 95% confidence interval @@ -993,13 +957,10 @@ public Hl7.Fhir.Model.FhirDecimal LevelElement [IgnoreDataMember] public decimal? Level { - get { return LevelElement != null ? LevelElement.Value : null; } + get => _LevelElement?.Value; set { - if (value == null) - LevelElement = null; - else - LevelElement = new Hl7.Fhir.Model.FhirDecimal(value); + LevelElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Level"); } } @@ -1009,13 +970,13 @@ public decimal? Level /// [FhirElement("range", Order=90)] [DataMember] - public Hl7.Fhir.Model.Range Range + public Hl7.Fhir.Model.Range? Range { get { return _Range; } set { _Range = value; OnPropertyChanged("Range"); } } - private Hl7.Fhir.Model.Range _Range; + private Hl7.Fhir.Model.Range? _Range; /// /// A nested attribute estimate; which is the attribute estimate of an attribute estimate. @@ -1025,29 +986,25 @@ public Hl7.Fhir.Model.Range Range [DataMember] public List AttributeEstimate { - get { if(_AttributeEstimate==null) _AttributeEstimate = new List(); return _AttributeEstimate; } + get => _AttributeEstimate ?? new List(); set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } - private List _AttributeEstimate; + private List? _AttributeEstimate; protected internal override void CopyToInternal(Base other) { - var dest = other as AttributeEstimateComponent; - - if (dest == null) - { + if(other is not AttributeEstimateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(LevelElement != null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)LevelElement.DeepCopyInternal(); - if(Range != null) dest.Range = (Hl7.Fhir.Model.Range)Range.DeepCopyInternal(); - if(AttributeEstimate.Any()) dest.AttributeEstimate = new List(AttributeEstimate.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_LevelElement is not null) dest.LevelElement = (Hl7.Fhir.Model.FhirDecimal)_LevelElement.DeepCopyInternal(); + if(_Range is not null) dest.Range = (Hl7.Fhir.Model.Range)_Range.DeepCopyInternal(); + if(_AttributeEstimate is not null) dest.AttributeEstimate = new List(_AttributeEstimate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1059,76 +1016,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttributeEstimateComponent; - if(otherT == null) return false; + if(other is not AttributeEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(LevelElement, otherT.LevelElement)) return false; - if(!comparer.Equals(Range, otherT.Range)) return false; - if(!comparer.ListEquals(AttributeEstimate, otherT.AttributeEstimate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; + if(!comparer.Equals(_Range, otherT._Range)) return false; + if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "level": - value = LevelElement; - return LevelElement is not null; + value = _LevelElement; + return _LevelElement is not null; case "range": - value = Range; - return Range is not null; + value = _Range; + return _Range is not null; case "attributeEstimate": - value = AttributeEstimate; - return AttributeEstimate?.Any() == true; + value = _AttributeEstimate; + return _AttributeEstimate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "level": - LevelElement = (Hl7.Fhir.Model.FhirDecimal)value; + LevelElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "range": - Range = (Hl7.Fhir.Model.Range)value; + Range = (Hl7.Fhir.Model.Range?)value; return this; case "attributeEstimate": - AttributeEstimate = (List)value; + AttributeEstimate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1139,13 +1096,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (LevelElement is not null) yield return new KeyValuePair("level",LevelElement); - if (Range is not null) yield return new KeyValuePair("range",Range); - if (AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",AttributeEstimate); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_LevelElement is not null) yield return new KeyValuePair("level",_LevelElement); + if (_Range is not null) yield return new KeyValuePair("range",_Range); + if (_AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",_AttributeEstimate); } } @@ -1173,26 +1130,26 @@ public partial class ModelCharacteristicComponent : Hl7.Fhir.Model.BackboneEleme [Binding("StatisticModelCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Numerical value to complete model specification. /// [FhirElement("value", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// A variable adjusted for in the adjusted analysis. @@ -1202,11 +1159,11 @@ public Hl7.Fhir.Model.Quantity Value [DataMember] public List Variable { - get { if(_Variable==null) _Variable = new List(); return _Variable; } + get => _Variable ?? new List(); set { _Variable = value; OnPropertyChanged("Variable"); } } - private List _Variable; + private List? _Variable; /// /// An attribute of the statistic used as a model characteristic. @@ -1216,26 +1173,22 @@ public List Variable [DataMember] public List AttributeEstimate { - get { if(_AttributeEstimate==null) _AttributeEstimate = new List(); return _AttributeEstimate; } + get => _AttributeEstimate ?? new List(); set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } - private List _AttributeEstimate; + private List? _AttributeEstimate; protected internal override void CopyToInternal(Base other) { - var dest = other as ModelCharacteristicComponent; - - if (dest == null) - { + if(other is not ModelCharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(Variable.Any()) dest.Variable = new List(Variable.DeepCopyInternal()); - if(AttributeEstimate.Any()) dest.AttributeEstimate = new List(AttributeEstimate.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_Variable is not null) dest.Variable = new List(_Variable.DeepCopyInternal()); + if(_AttributeEstimate is not null) dest.AttributeEstimate = new List(_AttributeEstimate.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1247,55 +1200,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ModelCharacteristicComponent; - if(otherT == null) return false; + if(other is not ModelCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Variable, otherT.Variable)) return false; - if(!comparer.ListEquals(AttributeEstimate, otherT.AttributeEstimate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; + if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "variable": - value = Variable; - return Variable?.Any() == true; + value = _Variable; + return _Variable?.Any() == true; case "attributeEstimate": - value = AttributeEstimate; - return AttributeEstimate?.Any() == true; + value = _AttributeEstimate; + return _AttributeEstimate?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "variable": - Variable = (List)value; + Variable = (List?)value!; return this; case "attributeEstimate": - AttributeEstimate = (List)value; + AttributeEstimate = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1306,10 +1259,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Variable?.Any() == true) yield return new KeyValuePair("variable",Variable); - if (AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",AttributeEstimate); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Variable?.Any() == true) yield return new KeyValuePair("variable",_Variable); + if (_AttributeEstimate?.Any() == true) yield return new KeyValuePair("attributeEstimate",_AttributeEstimate); } } @@ -1335,13 +1288,13 @@ public partial class VariableComponent : Hl7.Fhir.Model.BackboneElement [References("Group","EvidenceVariable")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference VariableDefinition + public Hl7.Fhir.Model.ResourceReference? VariableDefinition { get { return _VariableDefinition; } set { _VariableDefinition = value; OnPropertyChanged("VariableDefinition"); } } - private Hl7.Fhir.Model.ResourceReference _VariableDefinition; + private Hl7.Fhir.Model.ResourceReference? _VariableDefinition; /// /// continuous | dichotomous | ordinal | polychotomous. @@ -1350,13 +1303,13 @@ public Hl7.Fhir.Model.ResourceReference VariableDefinition [DeclaredType(Type = typeof(Code))] [Binding("EvidenceVariableHandling")] [DataMember] - public Code HandlingElement + public Code? HandlingElement { get { return _HandlingElement; } set { _HandlingElement = value; OnPropertyChanged("HandlingElement"); } } - private Code _HandlingElement; + private Code? _HandlingElement; /// /// continuous | dichotomous | ordinal | polychotomous @@ -1365,13 +1318,10 @@ public Code HandlingElement [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceVariableHandling? Handling { - get { return HandlingElement != null ? HandlingElement.Value : null; } + get => _HandlingElement?.Value; set { - if (value == null) - HandlingElement = null; - else - HandlingElement = new Code(value); + HandlingElement = value is null ? null : new Code(value); OnPropertyChanged("Handling"); } } @@ -1384,11 +1334,11 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List ValueCategory { - get { if(_ValueCategory==null) _ValueCategory = new List(); return _ValueCategory; } + get => _ValueCategory ?? new List(); set { _ValueCategory = value; OnPropertyChanged("ValueCategory"); } } - private List _ValueCategory; + private List? _ValueCategory; /// /// Discrete value for grouping of ordinal or polychotomous variables. @@ -1398,11 +1348,11 @@ public List ValueCategory [DataMember] public List ValueQuantity { - get { if(_ValueQuantity==null) _ValueQuantity = new List(); return _ValueQuantity; } + get => _ValueQuantity ?? new List(); set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } - private List _ValueQuantity; + private List? _ValueQuantity; /// /// Range of values for grouping of ordinal or polychotomous variables. @@ -1412,27 +1362,23 @@ public List ValueQuantity [DataMember] public List ValueRange { - get { if(_ValueRange==null) _ValueRange = new List(); return _ValueRange; } + get => _ValueRange ?? new List(); set { _ValueRange = value; OnPropertyChanged("ValueRange"); } } - private List _ValueRange; + private List? _ValueRange; protected internal override void CopyToInternal(Base other) { - var dest = other as VariableComponent; - - if (dest == null) - { + if(other is not VariableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VariableDefinition != null) dest.VariableDefinition = (Hl7.Fhir.Model.ResourceReference)VariableDefinition.DeepCopyInternal(); - if(HandlingElement != null) dest.HandlingElement = (Code)HandlingElement.DeepCopyInternal(); - if(ValueCategory.Any()) dest.ValueCategory = new List(ValueCategory.DeepCopyInternal()); - if(ValueQuantity.Any()) dest.ValueQuantity = new List(ValueQuantity.DeepCopyInternal()); - if(ValueRange.Any()) dest.ValueRange = new List(ValueRange.DeepCopyInternal()); + if(_VariableDefinition is not null) dest.VariableDefinition = (Hl7.Fhir.Model.ResourceReference)_VariableDefinition.DeepCopyInternal(); + if(_HandlingElement is not null) dest.HandlingElement = (Code)_HandlingElement.DeepCopyInternal(); + if(_ValueCategory is not null) dest.ValueCategory = new List(_ValueCategory.DeepCopyInternal()); + if(_ValueQuantity is not null) dest.ValueQuantity = new List(_ValueQuantity.DeepCopyInternal()); + if(_ValueRange is not null) dest.ValueRange = new List(_ValueRange.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1444,62 +1390,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableComponent; - if(otherT == null) return false; + if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(VariableDefinition, otherT.VariableDefinition)) return false; - if(!comparer.Equals(HandlingElement, otherT.HandlingElement)) return false; - if(!comparer.ListEquals(ValueCategory, otherT.ValueCategory)) return false; - if(!comparer.ListEquals(ValueQuantity, otherT.ValueQuantity)) return false; - if(!comparer.ListEquals(ValueRange, otherT.ValueRange)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariableDefinition, otherT._VariableDefinition)) return false; + if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; + if(!comparer.ListEquals(_ValueCategory, otherT._ValueCategory)) return false; + if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; + if(!comparer.ListEquals(_ValueRange, otherT._ValueRange)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "variableDefinition": - value = VariableDefinition; - return VariableDefinition is not null; + value = _VariableDefinition; + return _VariableDefinition is not null; case "handling": - value = HandlingElement; - return HandlingElement is not null; + value = _HandlingElement; + return _HandlingElement is not null; case "valueCategory": - value = ValueCategory; - return ValueCategory?.Any() == true; + value = _ValueCategory; + return _ValueCategory?.Any() == true; case "valueQuantity": - value = ValueQuantity; - return ValueQuantity?.Any() == true; + value = _ValueQuantity; + return _ValueQuantity?.Any() == true; case "valueRange": - value = ValueRange; - return ValueRange?.Any() == true; + value = _ValueRange; + return _ValueRange?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "variableDefinition": - VariableDefinition = (Hl7.Fhir.Model.ResourceReference)value; + VariableDefinition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "handling": - HandlingElement = (Code)value; + HandlingElement = (Code?)value; return this; case "valueCategory": - ValueCategory = (List)value; + ValueCategory = (List?)value!; return this; case "valueQuantity": - ValueQuantity = (List)value; + ValueQuantity = (List?)value!; return this; case "valueRange": - ValueRange = (List)value; + ValueRange = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1510,11 +1456,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VariableDefinition is not null) yield return new KeyValuePair("variableDefinition",VariableDefinition); - if (HandlingElement is not null) yield return new KeyValuePair("handling",HandlingElement); - if (ValueCategory?.Any() == true) yield return new KeyValuePair("valueCategory",ValueCategory); - if (ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",ValueQuantity); - if (ValueRange?.Any() == true) yield return new KeyValuePair("valueRange",ValueRange); + if (_VariableDefinition is not null) yield return new KeyValuePair("variableDefinition",_VariableDefinition); + if (_HandlingElement is not null) yield return new KeyValuePair("handling",_HandlingElement); + if (_ValueCategory?.Any() == true) yield return new KeyValuePair("valueCategory",_ValueCategory); + if (_ValueQuantity?.Any() == true) yield return new KeyValuePair("valueQuantity",_ValueQuantity); + if (_ValueRange?.Any() == true) yield return new KeyValuePair("valueRange",_ValueRange); } } @@ -1540,28 +1486,25 @@ public partial class CertaintyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description of certainty /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1574,11 +1517,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Aspect of certainty being rated. @@ -1586,13 +1529,13 @@ public List Note [FhirElement("type", Order=60)] [Binding("EvidenceCertaintyType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Assessment or judgement of the aspect. @@ -1600,41 +1543,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("rating", Order=70)] [Binding("EvidenceCertaintyRating")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Rating + public Hl7.Fhir.Model.CodeableConcept? Rating { get { return _Rating; } set { _Rating = value; OnPropertyChanged("Rating"); } } - private Hl7.Fhir.Model.CodeableConcept _Rating; + private Hl7.Fhir.Model.CodeableConcept? _Rating; /// /// Individual or group who did the rating. /// [FhirElement("rater", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString RaterElement + public Hl7.Fhir.Model.FhirString? RaterElement { get { return _RaterElement; } set { _RaterElement = value; OnPropertyChanged("RaterElement"); } } - private Hl7.Fhir.Model.FhirString _RaterElement; + private Hl7.Fhir.Model.FhirString? _RaterElement; /// /// Individual or group who did the rating /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rater + public string? Rater { - get { return RaterElement != null ? RaterElement.Value : null; } + get => _RaterElement?.Value; set { - if (value == null) - RaterElement = null; - else - RaterElement = new Hl7.Fhir.Model.FhirString(value); + RaterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Rater"); } } @@ -1647,28 +1587,24 @@ public string Rater [DataMember] public List Subcomponent { - get { if(_Subcomponent==null) _Subcomponent = new List(); return _Subcomponent; } + get => _Subcomponent ?? new List(); set { _Subcomponent = value; OnPropertyChanged("Subcomponent"); } } - private List _Subcomponent; + private List? _Subcomponent; protected internal override void CopyToInternal(Base other) { - var dest = other as CertaintyComponent; - - if (dest == null) - { + if(other is not CertaintyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Rating != null) dest.Rating = (Hl7.Fhir.Model.CodeableConcept)Rating.DeepCopyInternal(); - if(RaterElement != null) dest.RaterElement = (Hl7.Fhir.Model.FhirString)RaterElement.DeepCopyInternal(); - if(Subcomponent.Any()) dest.Subcomponent = new List(Subcomponent.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Rating is not null) dest.Rating = (Hl7.Fhir.Model.CodeableConcept)_Rating.DeepCopyInternal(); + if(_RaterElement is not null) dest.RaterElement = (Hl7.Fhir.Model.FhirString)_RaterElement.DeepCopyInternal(); + if(_Subcomponent is not null) dest.Subcomponent = new List(_Subcomponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1680,69 +1616,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CertaintyComponent; - if(otherT == null) return false; + if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Rating, otherT.Rating)) return false; - if(!comparer.Equals(RaterElement, otherT.RaterElement)) return false; - if(!comparer.ListEquals(Subcomponent, otherT.Subcomponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Rating, otherT._Rating)) return false; + if(!comparer.Equals(_RaterElement, otherT._RaterElement)) return false; + if(!comparer.ListEquals(_Subcomponent, otherT._Subcomponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "rating": - value = Rating; - return Rating is not null; + value = _Rating; + return _Rating is not null; case "rater": - value = RaterElement; - return RaterElement is not null; + value = _RaterElement; + return _RaterElement is not null; case "subcomponent": - value = Subcomponent; - return Subcomponent?.Any() == true; + value = _Subcomponent; + return _Subcomponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rating": - Rating = (Hl7.Fhir.Model.CodeableConcept)value; + Rating = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rater": - RaterElement = (Hl7.Fhir.Model.FhirString)value; + RaterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subcomponent": - Subcomponent = (List)value; + Subcomponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1753,12 +1689,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Rating is not null) yield return new KeyValuePair("rating",Rating); - if (RaterElement is not null) yield return new KeyValuePair("rater",RaterElement); - if (Subcomponent?.Any() == true) yield return new KeyValuePair("subcomponent",Subcomponent); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Rating is not null) yield return new KeyValuePair("rating",_Rating); + if (_RaterElement is not null) yield return new KeyValuePair("rater",_RaterElement); + if (_Subcomponent?.Any() == true) yield return new KeyValuePair("subcomponent",_Subcomponent); } } @@ -1768,28 +1704,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this evidence, represented as a globally unique URI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1802,39 +1735,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of this summary. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of this summary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1846,41 +1776,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this summary (machine friendly). /// [FhirElement("name", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this summary (machine friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1890,28 +1817,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this summary (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1924,13 +1848,13 @@ public string Title [References("Citation")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Markdown))] [DataMember] - public Hl7.Fhir.Model.DataType CiteAs + public Hl7.Fhir.Model.DataType? CiteAs { get { return _CiteAs; } set { _CiteAs = value; OnPropertyChanged("CiteAs"); } } - private Hl7.Fhir.Model.DataType _CiteAs; + private Hl7.Fhir.Model.DataType? _CiteAs; /// /// draft | active | retired | unknown. @@ -1940,13 +1864,13 @@ public Hl7.Fhir.Model.DataType CiteAs [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1955,13 +1879,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1971,13 +1892,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1986,13 +1907,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2002,28 +1920,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2033,28 +1948,25 @@ public string Date /// [FhirElement("approvalDate", Order=190)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the summary was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -2064,28 +1976,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=200)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the summary was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2095,28 +2004,25 @@ public string LastReviewDate /// [FhirElement("publisher", InSummary=true, Order=210, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2129,11 +2035,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who authored the content. @@ -2143,11 +2049,11 @@ public List Contact [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -2157,11 +2063,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -2171,11 +2077,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -2185,11 +2091,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// The context that the content is intended to support. @@ -2199,39 +2105,36 @@ public List Endorser [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Why this Evidence is defined. /// [FhirElement("purpose", Order=280, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this Evidence is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2241,28 +2144,25 @@ public string Purpose /// [FhirElement("copyright", Order=290)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2272,28 +2172,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -2306,39 +2203,36 @@ public string CopyrightLabel [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Description of the particular summary. /// [FhirElement("description", Order=320)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of the particular summary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2348,28 +2242,25 @@ public string Description /// [FhirElement("assertion", Order=330)] [DataMember] - public Hl7.Fhir.Model.Markdown AssertionElement + public Hl7.Fhir.Model.Markdown? AssertionElement { get { return _AssertionElement; } set { _AssertionElement = value; OnPropertyChanged("AssertionElement"); } } - private Hl7.Fhir.Model.Markdown _AssertionElement; + private Hl7.Fhir.Model.Markdown? _AssertionElement; /// /// Declarative description of the Evidence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Assertion + public string? Assertion { - get { return AssertionElement != null ? AssertionElement.Value : null; } + get => _AssertionElement?.Value; set { - if (value == null) - AssertionElement = null; - else - AssertionElement = new Hl7.Fhir.Model.Markdown(value); + AssertionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Assertion"); } } @@ -2382,11 +2273,11 @@ public string Assertion [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Evidence variable such as population, exposure, or outcome. @@ -2396,11 +2287,11 @@ public List Note [DataMember] public List VariableDefinition { - get { if(_VariableDefinition==null) _VariableDefinition = new List(); return _VariableDefinition; } + get => _VariableDefinition ?? new List(); set { _VariableDefinition = value; OnPropertyChanged("VariableDefinition"); } } - private List _VariableDefinition; + private List? _VariableDefinition; /// /// The method to combine studies. @@ -2408,13 +2299,13 @@ public List VariableDefinit [FhirElement("synthesisType", Order=360)] [Binding("SynthesisType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SynthesisType + public Hl7.Fhir.Model.CodeableConcept? SynthesisType { get { return _SynthesisType; } set { _SynthesisType = value; OnPropertyChanged("SynthesisType"); } } - private Hl7.Fhir.Model.CodeableConcept _SynthesisType; + private Hl7.Fhir.Model.CodeableConcept? _SynthesisType; /// /// The design of the study that produced this evidence. @@ -2425,11 +2316,11 @@ public Hl7.Fhir.Model.CodeableConcept SynthesisType [DataMember] public List StudyDesign { - get { if(_StudyDesign==null) _StudyDesign = new List(); return _StudyDesign; } + get => _StudyDesign ?? new List(); set { _StudyDesign = value; OnPropertyChanged("StudyDesign"); } } - private List _StudyDesign; + private List? _StudyDesign; /// /// Values and parameters for a single statistic. @@ -2439,11 +2330,11 @@ public List StudyDesign [DataMember] public List Statistic { - get { if(_Statistic==null) _Statistic = new List(); return _Statistic; } + get => _Statistic ?? new List(); set { _Statistic = value; OnPropertyChanged("Statistic"); } } - private List _Statistic; + private List? _Statistic; /// /// Certainty or quality of the evidence. @@ -2453,55 +2344,51 @@ public List Statistic [DataMember] public List Certainty { - get { if(_Certainty==null) _Certainty = new List(); return _Certainty; } + get => _Certainty ?? new List(); set { _Certainty = value; OnPropertyChanged("Certainty"); } } - private List _Certainty; + private List? _Certainty; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Evidence; - - if (dest == null) - { + if(other is not Evidence dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(CiteAs != null) dest.CiteAs = (Hl7.Fhir.Model.DataType)CiteAs.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(AssertionElement != null) dest.AssertionElement = (Hl7.Fhir.Model.Markdown)AssertionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(VariableDefinition.Any()) dest.VariableDefinition = new List(VariableDefinition.DeepCopyInternal()); - if(SynthesisType != null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)SynthesisType.DeepCopyInternal(); - if(StudyDesign.Any()) dest.StudyDesign = new List(StudyDesign.DeepCopyInternal()); - if(Statistic.Any()) dest.Statistic = new List(Statistic.DeepCopyInternal()); - if(Certainty.Any()) dest.Certainty = new List(Certainty.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_CiteAs is not null) dest.CiteAs = (Hl7.Fhir.Model.DataType)_CiteAs.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_AssertionElement is not null) dest.AssertionElement = (Hl7.Fhir.Model.Markdown)_AssertionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_VariableDefinition is not null) dest.VariableDefinition = new List(_VariableDefinition.DeepCopyInternal()); + if(_SynthesisType is not null) dest.SynthesisType = (Hl7.Fhir.Model.CodeableConcept)_SynthesisType.DeepCopyInternal(); + if(_StudyDesign is not null) dest.StudyDesign = new List(_StudyDesign.DeepCopyInternal()); + if(_Statistic is not null) dest.Statistic = new List(_Statistic.DeepCopyInternal()); + if(_Certainty is not null) dest.Certainty = new List(_Certainty.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2513,244 +2400,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Evidence; - if(otherT == null) return false; + if(other is not Evidence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(CiteAs, otherT.CiteAs)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(AssertionElement, otherT.AssertionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(VariableDefinition, otherT.VariableDefinition)) return false; - if(!comparer.Equals(SynthesisType, otherT.SynthesisType)) return false; - if(!comparer.ListEquals(StudyDesign, otherT.StudyDesign)) return false; - if(!comparer.ListEquals(Statistic, otherT.Statistic)) return false; - if(!comparer.ListEquals(Certainty, otherT.Certainty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_CiteAs, otherT._CiteAs)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_AssertionElement, otherT._AssertionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_VariableDefinition, otherT._VariableDefinition)) return false; + if(!comparer.Equals(_SynthesisType, otherT._SynthesisType)) return false; + if(!comparer.ListEquals(_StudyDesign, otherT._StudyDesign)) return false; + if(!comparer.ListEquals(_Statistic, otherT._Statistic)) return false; + if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "citeAs": - value = CiteAs; - return CiteAs is not null; + value = _CiteAs; + return _CiteAs is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "assertion": - value = AssertionElement; - return AssertionElement is not null; + value = _AssertionElement; + return _AssertionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "variableDefinition": - value = VariableDefinition; - return VariableDefinition?.Any() == true; + value = _VariableDefinition; + return _VariableDefinition?.Any() == true; case "synthesisType": - value = SynthesisType; - return SynthesisType is not null; + value = _SynthesisType; + return _SynthesisType is not null; case "studyDesign": - value = StudyDesign; - return StudyDesign?.Any() == true; + value = _StudyDesign; + return _StudyDesign?.Any() == true; case "statistic": - value = Statistic; - return Statistic?.Any() == true; + value = _Statistic; + return _Statistic?.Any() == true; case "certainty": - value = Certainty; - return Certainty?.Any() == true; + value = _Certainty; + return _Certainty?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "citeAs": - CiteAs = (Hl7.Fhir.Model.DataType)value; + CiteAs = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "assertion": - AssertionElement = (Hl7.Fhir.Model.Markdown)value; + AssertionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "variableDefinition": - VariableDefinition = (List)value; + VariableDefinition = (List?)value!; return this; case "synthesisType": - SynthesisType = (Hl7.Fhir.Model.CodeableConcept)value; + SynthesisType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyDesign": - StudyDesign = (List)value; + StudyDesign = (List?)value!; return this; case "statistic": - Statistic = (List)value; + Statistic = (List?)value!; return this; case "certainty": - Certainty = (List)value; + Certainty = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2761,37 +2648,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (CiteAs is not null) yield return new KeyValuePair("citeAs",CiteAs); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (AssertionElement is not null) yield return new KeyValuePair("assertion",AssertionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (VariableDefinition?.Any() == true) yield return new KeyValuePair("variableDefinition",VariableDefinition); - if (SynthesisType is not null) yield return new KeyValuePair("synthesisType",SynthesisType); - if (StudyDesign?.Any() == true) yield return new KeyValuePair("studyDesign",StudyDesign); - if (Statistic?.Any() == true) yield return new KeyValuePair("statistic",Statistic); - if (Certainty?.Any() == true) yield return new KeyValuePair("certainty",Certainty); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_CiteAs is not null) yield return new KeyValuePair("citeAs",_CiteAs); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_AssertionElement is not null) yield return new KeyValuePair("assertion",_AssertionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_VariableDefinition?.Any() == true) yield return new KeyValuePair("variableDefinition",_VariableDefinition); + if (_SynthesisType is not null) yield return new KeyValuePair("synthesisType",_SynthesisType); + if (_StudyDesign?.Any() == true) yield return new KeyValuePair("studyDesign",_StudyDesign); + if (_Statistic?.Any() == true) yield return new KeyValuePair("statistic",_Statistic); + if (_Certainty?.Any() == true) yield return new KeyValuePair("certainty",_Certainty); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs b/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs index 7fb882ec1..5a041a646 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -142,11 +145,11 @@ public partial class SubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Footnotes and/or explanatory notes. @@ -156,24 +159,20 @@ public List Characteristi [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as SubjectComponent; - - if (dest == null) - { + if(other is not SubjectComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -185,41 +184,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubjectComponent; - if(otherT == null) return false; + if(other is not SubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -230,8 +229,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -256,13 +255,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("FocusCharacteristicCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Characteristic value. @@ -273,26 +272,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Is used to express not the characteristic. /// [FhirElement("exclude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Is used to express not the characteristic @@ -301,13 +300,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -317,28 +313,24 @@ public bool? Exclude /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -350,55 +342,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -409,10 +401,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -442,13 +434,13 @@ public partial class RelatesToComponent : Hl7.Fhir.Model.BackboneElement [Binding("ReportRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// replaces | amends | appends | transforms | replacedWith | amendedWith | appendedWith | transformedWith @@ -457,13 +449,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceReport.ReportRelationshipType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -474,26 +463,22 @@ public Hl7.Fhir.Model.EvidenceReport.ReportRelationshipType? Code [FhirElement("target", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.EvidenceReport.TargetComponent Target + public Hl7.Fhir.Model.EvidenceReport.TargetComponent? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.EvidenceReport.TargetComponent _Target; + private Hl7.Fhir.Model.EvidenceReport.TargetComponent? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatesToComponent; - - if (dest == null) - { + if(other is not RelatesToComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.EvidenceReport.TargetComponent)Target.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.EvidenceReport.TargetComponent)_Target.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -505,41 +490,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatesToComponent; - if(otherT == null) return false; + if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "target": - Target = (Hl7.Fhir.Model.EvidenceReport.TargetComponent)value; + Target = (Hl7.Fhir.Model.EvidenceReport.TargetComponent?)value; return this; default: return base.SetValue(key, value); @@ -550,8 +535,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Target is not null) yield return new KeyValuePair("target",Target); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); } } @@ -577,28 +562,25 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("url", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Target of the relationship URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -608,41 +590,38 @@ public string Url /// [FhirElement("identifier", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Target of the relationship Display. /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DisplayElement + public Hl7.Fhir.Model.Markdown? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.Markdown _DisplayElement; + private Hl7.Fhir.Model.Markdown? _DisplayElement; /// /// Target of the relationship Display /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.Markdown(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Display"); } } @@ -654,28 +633,24 @@ public string Display [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.Markdown)DisplayElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.Markdown)_DisplayElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -687,55 +662,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.Markdown)value; + DisplayElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -746,10 +721,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -775,28 +750,25 @@ public partial class SectionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for section (e.g. for ToC) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -807,13 +779,13 @@ public string Title [FhirElement("focus", Order=50)] [Binding("ReportSectionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Focus + public Hl7.Fhir.Model.CodeableConcept? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.CodeableConcept _Focus; + private Hl7.Fhir.Model.CodeableConcept? _Focus; /// /// Classification of section by Resource. @@ -822,13 +794,13 @@ public Hl7.Fhir.Model.CodeableConcept Focus [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference FocusReference + public Hl7.Fhir.Model.ResourceReference? FocusReference { get { return _FocusReference; } set { _FocusReference = value; OnPropertyChanged("FocusReference"); } } - private Hl7.Fhir.Model.ResourceReference _FocusReference; + private Hl7.Fhir.Model.ResourceReference? _FocusReference; /// /// Who and/or what authored the section. @@ -840,24 +812,24 @@ public Hl7.Fhir.Model.ResourceReference FocusReference [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Text summary of the section, for human interpretation. /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.Narrative Text + public Hl7.Fhir.Model.Narrative? Text { get { return _Text; } set { _Text = value; OnPropertyChanged("Text"); } } - private Hl7.Fhir.Model.Narrative _Text; + private Hl7.Fhir.Model.Narrative? _Text; /// /// working | snapshot | changes. @@ -866,13 +838,13 @@ public Hl7.Fhir.Model.Narrative Text [DeclaredType(Type = typeof(Code))] [Binding("SectionMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -881,13 +853,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -898,13 +867,13 @@ public Hl7.Fhir.Model.ListMode? Mode [FhirElement("orderedBy", Order=100)] [Binding("SectionEntryOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// Extensible classifiers as content. @@ -915,11 +884,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List EntryClassifier { - get { if(_EntryClassifier==null) _EntryClassifier = new List(); return _EntryClassifier; } + get => _EntryClassifier ?? new List(); set { _EntryClassifier = value; OnPropertyChanged("EntryClassifier"); } } - private List _EntryClassifier; + private List? _EntryClassifier; /// /// Reference to resources as content. @@ -931,11 +900,11 @@ public List EntryClassifier [DataMember] public List EntryReference { - get { if(_EntryReference==null) _EntryReference = new List(); return _EntryReference; } + get => _EntryReference ?? new List(); set { _EntryReference = value; OnPropertyChanged("EntryReference"); } } - private List _EntryReference; + private List? _EntryReference; /// /// Quantity as content. @@ -945,11 +914,11 @@ public List EntryReference [DataMember] public List EntryQuantity { - get { if(_EntryQuantity==null) _EntryQuantity = new List(); return _EntryQuantity; } + get => _EntryQuantity ?? new List(); set { _EntryQuantity = value; OnPropertyChanged("EntryQuantity"); } } - private List _EntryQuantity; + private List? _EntryQuantity; /// /// Why the section is empty. @@ -957,13 +926,13 @@ public List EntryQuantity [FhirElement("emptyReason", Order=140)] [Binding("SectionEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; /// /// Nested Section. @@ -973,34 +942,30 @@ public Hl7.Fhir.Model.CodeableConcept EmptyReason [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; protected internal override void CopyToInternal(Base other) { - var dest = other as SectionComponent; - - if (dest == null) - { + if(other is not SectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.CodeableConcept)Focus.DeepCopyInternal(); - if(FocusReference != null) dest.FocusReference = (Hl7.Fhir.Model.ResourceReference)FocusReference.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Text != null) dest.Text = (Hl7.Fhir.Model.Narrative)Text.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(EntryClassifier.Any()) dest.EntryClassifier = new List(EntryClassifier.DeepCopyInternal()); - if(EntryReference.Any()) dest.EntryReference = new List(EntryReference.DeepCopyInternal()); - if(EntryQuantity.Any()) dest.EntryQuantity = new List(EntryQuantity.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.CodeableConcept)_Focus.DeepCopyInternal(); + if(_FocusReference is not null) dest.FocusReference = (Hl7.Fhir.Model.ResourceReference)_FocusReference.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Text is not null) dest.Text = (Hl7.Fhir.Model.Narrative)_Text.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_EntryClassifier is not null) dest.EntryClassifier = new List(_EntryClassifier.DeepCopyInternal()); + if(_EntryReference is not null) dest.EntryReference = new List(_EntryReference.DeepCopyInternal()); + if(_EntryQuantity is not null) dest.EntryQuantity = new List(_EntryQuantity.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1012,111 +977,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SectionComponent; - if(otherT == null) return false; + if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(FocusReference, otherT.FocusReference)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Text, otherT.Text)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(EntryClassifier, otherT.EntryClassifier)) return false; - if(!comparer.ListEquals(EntryReference, otherT.EntryReference)) return false; - if(!comparer.ListEquals(EntryQuantity, otherT.EntryQuantity)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_FocusReference, otherT._FocusReference)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Text, otherT._Text)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_EntryClassifier, otherT._EntryClassifier)) return false; + if(!comparer.ListEquals(_EntryReference, otherT._EntryReference)) return false; + if(!comparer.ListEquals(_EntryQuantity, otherT._EntryQuantity)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "focusReference": - value = FocusReference; - return FocusReference is not null; + value = _FocusReference; + return _FocusReference is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "text": - value = Text; - return Text is not null; + value = _Text; + return _Text is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "entryClassifier": - value = EntryClassifier; - return EntryClassifier?.Any() == true; + value = _EntryClassifier; + return _EntryClassifier?.Any() == true; case "entryReference": - value = EntryReference; - return EntryReference?.Any() == true; + value = _EntryReference; + return _EntryReference?.Any() == true; case "entryQuantity": - value = EntryQuantity; - return EntryQuantity?.Any() == true; + value = _EntryQuantity; + return _EntryQuantity?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.CodeableConcept)value; + Focus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "focusReference": - FocusReference = (Hl7.Fhir.Model.ResourceReference)value; + FocusReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "text": - Text = (Hl7.Fhir.Model.Narrative)value; + Text = (Hl7.Fhir.Model.Narrative?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "entryClassifier": - EntryClassifier = (List)value; + EntryClassifier = (List?)value!; return this; case "entryReference": - EntryReference = (List)value; + EntryReference = (List?)value!; return this; case "entryQuantity": - EntryQuantity = (List)value; + EntryQuantity = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1127,18 +1092,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (FocusReference is not null) yield return new KeyValuePair("focusReference",FocusReference); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Text is not null) yield return new KeyValuePair("text",Text); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (EntryClassifier?.Any() == true) yield return new KeyValuePair("entryClassifier",EntryClassifier); - if (EntryReference?.Any() == true) yield return new KeyValuePair("entryReference",EntryReference); - if (EntryQuantity?.Any() == true) yield return new KeyValuePair("entryQuantity",EntryQuantity); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_FocusReference is not null) yield return new KeyValuePair("focusReference",_FocusReference); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Text is not null) yield return new KeyValuePair("text",_Text); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_EntryClassifier?.Any() == true) yield return new KeyValuePair("entryClassifier",_EntryClassifier); + if (_EntryReference?.Any() == true) yield return new KeyValuePair("entryReference",_EntryReference); + if (_EntryQuantity?.Any() == true) yield return new KeyValuePair("entryQuantity",_EntryQuantity); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } @@ -1148,28 +1113,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this EvidenceReport, represented as a globally unique URI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1182,13 +1144,13 @@ public string Url [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1197,13 +1159,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1216,11 +1175,11 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Unique identifier for the evidence report. @@ -1230,11 +1189,11 @@ public List UseContext [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identifiers for articles that may relate to more than one evidence report. @@ -1244,11 +1203,11 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get { if(_RelatedIdentifier==null) _RelatedIdentifier = new List(); return _RelatedIdentifier; } + get => _RelatedIdentifier ?? new List(); set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } - private List _RelatedIdentifier; + private List? _RelatedIdentifier; /// /// Citation for this report. @@ -1258,13 +1217,13 @@ public List RelatedIdentifier [References("Citation")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Markdown))] [DataMember] - public Hl7.Fhir.Model.DataType CiteAs + public Hl7.Fhir.Model.DataType? CiteAs { get { return _CiteAs; } set { _CiteAs = value; OnPropertyChanged("CiteAs"); } } - private Hl7.Fhir.Model.DataType _CiteAs; + private Hl7.Fhir.Model.DataType? _CiteAs; /// /// Kind of report. @@ -1272,13 +1231,13 @@ public Hl7.Fhir.Model.DataType CiteAs [FhirElement("type", Order=150)] [Binding("EvidenceReportType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Used for footnotes and annotations. @@ -1288,11 +1247,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Link, description or reference to artifact associated with the report. @@ -1302,11 +1261,11 @@ public List Note [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Focus of the report. @@ -1314,41 +1273,38 @@ public List RelatedArtifact [FhirElement("subject", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.EvidenceReport.SubjectComponent Subject + public Hl7.Fhir.Model.EvidenceReport.SubjectComponent? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.EvidenceReport.SubjectComponent _Subject; + private Hl7.Fhir.Model.EvidenceReport.SubjectComponent? _Subject; /// /// Name of the publisher/steward (organization or individual). /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1361,11 +1317,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who authored the content. @@ -1375,11 +1331,11 @@ public List Contact [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1389,11 +1345,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1403,11 +1359,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1417,11 +1373,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Relationships to other compositions/documents. @@ -1431,11 +1387,11 @@ public List Endorser [DataMember] public List RelatesTo { - get { if(_RelatesTo==null) _RelatesTo = new List(); return _RelatesTo; } + get => _RelatesTo ?? new List(); set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } - private List _RelatesTo; + private List? _RelatesTo; /// /// Composition is broken into sections. @@ -1445,42 +1401,38 @@ public List RelatesTo [DataMember] public List Section { - get { if(_Section==null) _Section = new List(); return _Section; } + get => _Section ?? new List(); set { _Section = value; OnPropertyChanged("Section"); } } - private List _Section; + private List? _Section; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceReport; - - if (dest == null) - { + if(other is not EvidenceReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(RelatedIdentifier.Any()) dest.RelatedIdentifier = new List(RelatedIdentifier.DeepCopyInternal()); - if(CiteAs != null) dest.CiteAs = (Hl7.Fhir.Model.DataType)CiteAs.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent)Subject.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatesTo.Any()) dest.RelatesTo = new List(RelatesTo.DeepCopyInternal()); - if(Section.Any()) dest.Section = new List(Section.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_RelatedIdentifier is not null) dest.RelatedIdentifier = new List(_RelatedIdentifier.DeepCopyInternal()); + if(_CiteAs is not null) dest.CiteAs = (Hl7.Fhir.Model.DataType)_CiteAs.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent)_Subject.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatesTo is not null) dest.RelatesTo = new List(_RelatesTo.DeepCopyInternal()); + if(_Section is not null) dest.Section = new List(_Section.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1492,153 +1444,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceReport; - if(otherT == null) return false; + if(other is not EvidenceReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(RelatedIdentifier, otherT.RelatedIdentifier)) return false; - if(!comparer.Equals(CiteAs, otherT.CiteAs)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatesTo, otherT.RelatesTo)) return false; - if(!comparer.ListEquals(Section, otherT.Section)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_RelatedIdentifier, otherT._RelatedIdentifier)) return false; + if(!comparer.Equals(_CiteAs, otherT._CiteAs)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; + if(!comparer.ListEquals(_Section, otherT._Section)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "relatedIdentifier": - value = RelatedIdentifier; - return RelatedIdentifier?.Any() == true; + value = _RelatedIdentifier; + return _RelatedIdentifier?.Any() == true; case "citeAs": - value = CiteAs; - return CiteAs is not null; + value = _CiteAs; + return _CiteAs is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatesTo": - value = RelatesTo; - return RelatesTo?.Any() == true; + value = _RelatesTo; + return _RelatesTo?.Any() == true; case "section": - value = Section; - return Section?.Any() == true; + value = _Section; + return _Section?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "relatedIdentifier": - RelatedIdentifier = (List)value; + RelatedIdentifier = (List?)value!; return this; case "citeAs": - CiteAs = (Hl7.Fhir.Model.DataType)value; + CiteAs = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent)value; + Subject = (Hl7.Fhir.Model.EvidenceReport.SubjectComponent?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatesTo": - RelatesTo = (List)value; + RelatesTo = (List?)value!; return this; case "section": - Section = (List)value; + Section = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1649,24 +1601,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",RelatedIdentifier); - if (CiteAs is not null) yield return new KeyValuePair("citeAs",CiteAs); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",RelatesTo); - if (Section?.Any() == true) yield return new KeyValuePair("section",Section); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_RelatedIdentifier?.Any() == true) yield return new KeyValuePair("relatedIdentifier",_RelatedIdentifier); + if (_CiteAs is not null) yield return new KeyValuePair("citeAs",_CiteAs); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatesTo?.Any() == true) yield return new KeyValuePair("relatesTo",_RelatesTo); + if (_Section?.Any() == true) yield return new KeyValuePair("section",_Section); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs index 5cc6d6c5e..7c6b81ad7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -134,28 +137,25 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.Id LinkIdElement + public Hl7.Fhir.Model.Id? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.Id _LinkIdElement; + private Hl7.Fhir.Model.Id? _LinkIdElement; /// /// Label for internal linking /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.Id(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("LinkId"); } } @@ -165,28 +165,25 @@ public string LinkId /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the characteristic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -199,24 +196,24 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Whether the characteristic is an inclusion criterion or exclusion criterion. /// [FhirElement("exclude", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Whether the characteristic is an inclusion criterion or exclusion criterion @@ -225,13 +222,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -243,41 +237,38 @@ public bool? Exclude [CLSCompliant(false)] [References("EvidenceVariable","Group","Evidence")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DefinitionReference + public Hl7.Fhir.Model.ResourceReference? DefinitionReference { get { return _DefinitionReference; } set { _DefinitionReference = value; OnPropertyChanged("DefinitionReference"); } } - private Hl7.Fhir.Model.ResourceReference _DefinitionReference; + private Hl7.Fhir.Model.ResourceReference? _DefinitionReference; /// /// Defines the characteristic (without using type and value) by a Canonical. /// [FhirElement("definitionCanonical", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionCanonicalElement + public Hl7.Fhir.Model.Canonical? DefinitionCanonicalElement { get { return _DefinitionCanonicalElement; } set { _DefinitionCanonicalElement = value; OnPropertyChanged("DefinitionCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionCanonicalElement; + private Hl7.Fhir.Model.Canonical? _DefinitionCanonicalElement; /// /// Defines the characteristic (without using type and value) by a Canonical /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DefinitionCanonical + public string? DefinitionCanonical { - get { return DefinitionCanonicalElement != null ? DefinitionCanonicalElement.Value : null; } + get => _DefinitionCanonicalElement?.Value; set { - if (value == null) - DefinitionCanonicalElement = null; - else - DefinitionCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("DefinitionCanonical"); } } @@ -287,54 +278,51 @@ public string DefinitionCanonical /// [FhirElement("definitionCodeableConcept", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DefinitionCodeableConcept + public Hl7.Fhir.Model.CodeableConcept? DefinitionCodeableConcept { get { return _DefinitionCodeableConcept; } set { _DefinitionCodeableConcept = value; OnPropertyChanged("DefinitionCodeableConcept"); } } - private Hl7.Fhir.Model.CodeableConcept _DefinitionCodeableConcept; + private Hl7.Fhir.Model.CodeableConcept? _DefinitionCodeableConcept; /// /// Defines the characteristic (without using type and value) by an expression. /// [FhirElement("definitionExpression", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Expression DefinitionExpression + public Hl7.Fhir.Model.Expression? DefinitionExpression { get { return _DefinitionExpression; } set { _DefinitionExpression = value; OnPropertyChanged("DefinitionExpression"); } } - private Hl7.Fhir.Model.Expression _DefinitionExpression; + private Hl7.Fhir.Model.Expression? _DefinitionExpression; /// /// Defines the characteristic (without using type and value) by an id. /// [FhirElement("definitionId", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Id DefinitionIdElement + public Hl7.Fhir.Model.Id? DefinitionIdElement { get { return _DefinitionIdElement; } set { _DefinitionIdElement = value; OnPropertyChanged("DefinitionIdElement"); } } - private Hl7.Fhir.Model.Id _DefinitionIdElement; + private Hl7.Fhir.Model.Id? _DefinitionIdElement; /// /// Defines the characteristic (without using type and value) by an id /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DefinitionId + public string? DefinitionId { - get { return DefinitionIdElement != null ? DefinitionIdElement.Value : null; } + get => _DefinitionIdElement?.Value; set { - if (value == null) - DefinitionIdElement = null; - else - DefinitionIdElement = new Hl7.Fhir.Model.Id(value); + DefinitionIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("DefinitionId"); } } @@ -344,26 +332,26 @@ public string DefinitionId /// [FhirElement("definitionByTypeAndValue", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent DefinitionByTypeAndValue + public Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent? DefinitionByTypeAndValue { get { return _DefinitionByTypeAndValue; } set { _DefinitionByTypeAndValue = value; OnPropertyChanged("DefinitionByTypeAndValue"); } } - private Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent _DefinitionByTypeAndValue; + private Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent? _DefinitionByTypeAndValue; /// /// Used to specify how two or more characteristics are combined. /// [FhirElement("definitionByCombination", Order=140)] [DataMember] - public Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent DefinitionByCombination + public Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent? DefinitionByCombination { get { return _DefinitionByCombination; } set { _DefinitionByCombination = value; OnPropertyChanged("DefinitionByCombination"); } } - private Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent _DefinitionByCombination; + private Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent? _DefinitionByCombination; /// /// Number of occurrences meeting the characteristic. @@ -372,13 +360,13 @@ public Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent Definiti [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Instances + public Hl7.Fhir.Model.DataType? Instances { get { return _Instances; } set { _Instances = value; OnPropertyChanged("Instances"); } } - private Hl7.Fhir.Model.DataType _Instances; + private Hl7.Fhir.Model.DataType? _Instances; /// /// Length of time in which the characteristic is met. @@ -387,13 +375,13 @@ public Hl7.Fhir.Model.DataType Instances [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Duration + public Hl7.Fhir.Model.DataType? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.DataType _Duration; + private Hl7.Fhir.Model.DataType? _Duration; /// /// Timing in which the characteristic is determined. @@ -403,36 +391,32 @@ public Hl7.Fhir.Model.DataType Duration [DataMember] public List TimeFromEvent { - get { if(_TimeFromEvent==null) _TimeFromEvent = new List(); return _TimeFromEvent; } + get => _TimeFromEvent ?? new List(); set { _TimeFromEvent = value; OnPropertyChanged("TimeFromEvent"); } } - private List _TimeFromEvent; + private List? _TimeFromEvent; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.Id)LinkIdElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(DefinitionReference != null) dest.DefinitionReference = (Hl7.Fhir.Model.ResourceReference)DefinitionReference.DeepCopyInternal(); - if(DefinitionCanonicalElement != null) dest.DefinitionCanonicalElement = (Hl7.Fhir.Model.Canonical)DefinitionCanonicalElement.DeepCopyInternal(); - if(DefinitionCodeableConcept != null) dest.DefinitionCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)DefinitionCodeableConcept.DeepCopyInternal(); - if(DefinitionExpression != null) dest.DefinitionExpression = (Hl7.Fhir.Model.Expression)DefinitionExpression.DeepCopyInternal(); - if(DefinitionIdElement != null) dest.DefinitionIdElement = (Hl7.Fhir.Model.Id)DefinitionIdElement.DeepCopyInternal(); - if(DefinitionByTypeAndValue != null) dest.DefinitionByTypeAndValue = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent)DefinitionByTypeAndValue.DeepCopyInternal(); - if(DefinitionByCombination != null) dest.DefinitionByCombination = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent)DefinitionByCombination.DeepCopyInternal(); - if(Instances != null) dest.Instances = (Hl7.Fhir.Model.DataType)Instances.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.DataType)Duration.DeepCopyInternal(); - if(TimeFromEvent.Any()) dest.TimeFromEvent = new List(TimeFromEvent.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.Id)_LinkIdElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_DefinitionReference is not null) dest.DefinitionReference = (Hl7.Fhir.Model.ResourceReference)_DefinitionReference.DeepCopyInternal(); + if(_DefinitionCanonicalElement is not null) dest.DefinitionCanonicalElement = (Hl7.Fhir.Model.Canonical)_DefinitionCanonicalElement.DeepCopyInternal(); + if(_DefinitionCodeableConcept is not null) dest.DefinitionCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)_DefinitionCodeableConcept.DeepCopyInternal(); + if(_DefinitionExpression is not null) dest.DefinitionExpression = (Hl7.Fhir.Model.Expression)_DefinitionExpression.DeepCopyInternal(); + if(_DefinitionIdElement is not null) dest.DefinitionIdElement = (Hl7.Fhir.Model.Id)_DefinitionIdElement.DeepCopyInternal(); + if(_DefinitionByTypeAndValue is not null) dest.DefinitionByTypeAndValue = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent)_DefinitionByTypeAndValue.DeepCopyInternal(); + if(_DefinitionByCombination is not null) dest.DefinitionByCombination = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent)_DefinitionByCombination.DeepCopyInternal(); + if(_Instances is not null) dest.Instances = (Hl7.Fhir.Model.DataType)_Instances.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.DataType)_Duration.DeepCopyInternal(); + if(_TimeFromEvent is not null) dest.TimeFromEvent = new List(_TimeFromEvent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -444,125 +428,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(DefinitionReference, otherT.DefinitionReference)) return false; - if(!comparer.Equals(DefinitionCanonicalElement, otherT.DefinitionCanonicalElement)) return false; - if(!comparer.Equals(DefinitionCodeableConcept, otherT.DefinitionCodeableConcept)) return false; - if(!comparer.Equals(DefinitionExpression, otherT.DefinitionExpression)) return false; - if(!comparer.Equals(DefinitionIdElement, otherT.DefinitionIdElement)) return false; - if(!comparer.Equals(DefinitionByTypeAndValue, otherT.DefinitionByTypeAndValue)) return false; - if(!comparer.Equals(DefinitionByCombination, otherT.DefinitionByCombination)) return false; - if(!comparer.Equals(Instances, otherT.Instances)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.ListEquals(TimeFromEvent, otherT.TimeFromEvent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_DefinitionReference, otherT._DefinitionReference)) return false; + if(!comparer.Equals(_DefinitionCanonicalElement, otherT._DefinitionCanonicalElement)) return false; + if(!comparer.Equals(_DefinitionCodeableConcept, otherT._DefinitionCodeableConcept)) return false; + if(!comparer.Equals(_DefinitionExpression, otherT._DefinitionExpression)) return false; + if(!comparer.Equals(_DefinitionIdElement, otherT._DefinitionIdElement)) return false; + if(!comparer.Equals(_DefinitionByTypeAndValue, otherT._DefinitionByTypeAndValue)) return false; + if(!comparer.Equals(_DefinitionByCombination, otherT._DefinitionByCombination)) return false; + if(!comparer.Equals(_Instances, otherT._Instances)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.ListEquals(_TimeFromEvent, otherT._TimeFromEvent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "definitionReference": - value = DefinitionReference; - return DefinitionReference is not null; + value = _DefinitionReference; + return _DefinitionReference is not null; case "definitionCanonical": - value = DefinitionCanonicalElement; - return DefinitionCanonicalElement is not null; + value = _DefinitionCanonicalElement; + return _DefinitionCanonicalElement is not null; case "definitionCodeableConcept": - value = DefinitionCodeableConcept; - return DefinitionCodeableConcept is not null; + value = _DefinitionCodeableConcept; + return _DefinitionCodeableConcept is not null; case "definitionExpression": - value = DefinitionExpression; - return DefinitionExpression is not null; + value = _DefinitionExpression; + return _DefinitionExpression is not null; case "definitionId": - value = DefinitionIdElement; - return DefinitionIdElement is not null; + value = _DefinitionIdElement; + return _DefinitionIdElement is not null; case "definitionByTypeAndValue": - value = DefinitionByTypeAndValue; - return DefinitionByTypeAndValue is not null; + value = _DefinitionByTypeAndValue; + return _DefinitionByTypeAndValue is not null; case "definitionByCombination": - value = DefinitionByCombination; - return DefinitionByCombination is not null; + value = _DefinitionByCombination; + return _DefinitionByCombination is not null; case "instances": - value = Instances; - return Instances is not null; + value = _Instances; + return _Instances is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "timeFromEvent": - value = TimeFromEvent; - return TimeFromEvent?.Any() == true; + value = _TimeFromEvent; + return _TimeFromEvent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.Id)value; + LinkIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "definitionReference": - DefinitionReference = (Hl7.Fhir.Model.ResourceReference)value; + DefinitionReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "definitionCanonical": - DefinitionCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "definitionCodeableConcept": - DefinitionCodeableConcept = (Hl7.Fhir.Model.CodeableConcept)value; + DefinitionCodeableConcept = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "definitionExpression": - DefinitionExpression = (Hl7.Fhir.Model.Expression)value; + DefinitionExpression = (Hl7.Fhir.Model.Expression?)value; return this; case "definitionId": - DefinitionIdElement = (Hl7.Fhir.Model.Id)value; + DefinitionIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "definitionByTypeAndValue": - DefinitionByTypeAndValue = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent)value; + DefinitionByTypeAndValue = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByTypeAndValueComponent?)value; return this; case "definitionByCombination": - DefinitionByCombination = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent)value; + DefinitionByCombination = (Hl7.Fhir.Model.EvidenceVariable.DefinitionByCombinationComponent?)value; return this; case "instances": - Instances = (Hl7.Fhir.Model.DataType)value; + Instances = (Hl7.Fhir.Model.DataType?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.DataType)value; + Duration = (Hl7.Fhir.Model.DataType?)value; return this; case "timeFromEvent": - TimeFromEvent = (List)value; + TimeFromEvent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -573,20 +557,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (DefinitionReference is not null) yield return new KeyValuePair("definitionReference",DefinitionReference); - if (DefinitionCanonicalElement is not null) yield return new KeyValuePair("definitionCanonical",DefinitionCanonicalElement); - if (DefinitionCodeableConcept is not null) yield return new KeyValuePair("definitionCodeableConcept",DefinitionCodeableConcept); - if (DefinitionExpression is not null) yield return new KeyValuePair("definitionExpression",DefinitionExpression); - if (DefinitionIdElement is not null) yield return new KeyValuePair("definitionId",DefinitionIdElement); - if (DefinitionByTypeAndValue is not null) yield return new KeyValuePair("definitionByTypeAndValue",DefinitionByTypeAndValue); - if (DefinitionByCombination is not null) yield return new KeyValuePair("definitionByCombination",DefinitionByCombination); - if (Instances is not null) yield return new KeyValuePair("instances",Instances); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (TimeFromEvent?.Any() == true) yield return new KeyValuePair("timeFromEvent",TimeFromEvent); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_DefinitionReference is not null) yield return new KeyValuePair("definitionReference",_DefinitionReference); + if (_DefinitionCanonicalElement is not null) yield return new KeyValuePair("definitionCanonical",_DefinitionCanonicalElement); + if (_DefinitionCodeableConcept is not null) yield return new KeyValuePair("definitionCodeableConcept",_DefinitionCodeableConcept); + if (_DefinitionExpression is not null) yield return new KeyValuePair("definitionExpression",_DefinitionExpression); + if (_DefinitionIdElement is not null) yield return new KeyValuePair("definitionId",_DefinitionIdElement); + if (_DefinitionByTypeAndValue is not null) yield return new KeyValuePair("definitionByTypeAndValue",_DefinitionByTypeAndValue); + if (_DefinitionByCombination is not null) yield return new KeyValuePair("definitionByCombination",_DefinitionByCombination); + if (_Instances is not null) yield return new KeyValuePair("instances",_Instances); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_TimeFromEvent?.Any() == true) yield return new KeyValuePair("timeFromEvent",_TimeFromEvent); } } @@ -614,13 +598,13 @@ public partial class DefinitionByTypeAndValueComponent : Hl7.Fhir.Model.Backbone [Binding("UsageContextType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Method for how the characteristic value was determined. @@ -631,11 +615,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Method { - get { if(_Method==null) _Method = new List(); return _Method; } + get => _Method ?? new List(); set { _Method = value; OnPropertyChanged("Method"); } } - private List _Method; + private List? _Method; /// /// Device used for determining characteristic. @@ -644,13 +628,13 @@ public List Method [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Defines the characteristic when coupled with characteristic.type. @@ -660,13 +644,13 @@ public Hl7.Fhir.Model.ResourceReference Device [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Id))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Reference point for valueQuantity or valueRange. @@ -674,29 +658,25 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("offset", Order=80)] [Binding("CharacteristicOffset")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Offset + public Hl7.Fhir.Model.CodeableConcept? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.CodeableConcept _Offset; + private Hl7.Fhir.Model.CodeableConcept? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as DefinitionByTypeAndValueComponent; - - if (dest == null) - { + if(other is not DefinitionByTypeAndValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Method.Any()) dest.Method = new List(Method.DeepCopyInternal()); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.CodeableConcept)Offset.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Method is not null) dest.Method = new List(_Method.DeepCopyInternal()); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.CodeableConcept)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -708,62 +688,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DefinitionByTypeAndValueComponent; - if(otherT == null) return false; + if(other is not DefinitionByTypeAndValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Method, otherT.Method)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "method": - value = Method; - return Method?.Any() == true; + value = _Method; + return _Method?.Any() == true; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (List)value; + Method = (List?)value!; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.CodeableConcept)value; + Offset = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -774,11 +754,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Method?.Any() == true) yield return new KeyValuePair("method",Method); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Method?.Any() == true) yield return new KeyValuePair("method",_Method); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -807,13 +787,13 @@ public partial class DefinitionByCombinationComponent : Hl7.Fhir.Model.BackboneE [Binding("CharacteristicCombination")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// all-of | any-of | at-least | at-most | statistical | net-effect | dataset @@ -822,13 +802,10 @@ public Code CodeE [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceVariable.CharacteristicCombinationCode? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -838,13 +815,13 @@ public Hl7.Fhir.Model.EvidenceVariable.CharacteristicCombinationCode? Code /// [FhirElement("threshold", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt ThresholdElement + public Hl7.Fhir.Model.PositiveInt? ThresholdElement { get { return _ThresholdElement; } set { _ThresholdElement = value; OnPropertyChanged("ThresholdElement"); } } - private Hl7.Fhir.Model.PositiveInt _ThresholdElement; + private Hl7.Fhir.Model.PositiveInt? _ThresholdElement; /// /// Provides the value of "n" when "at-least" or "at-most" codes are used @@ -853,13 +830,10 @@ public Hl7.Fhir.Model.PositiveInt ThresholdElement [IgnoreDataMember] public int? Threshold { - get { return ThresholdElement != null ? ThresholdElement.Value : null; } + get => _ThresholdElement?.Value; set { - if (value == null) - ThresholdElement = null; - else - ThresholdElement = new Hl7.Fhir.Model.PositiveInt(value); + ThresholdElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Threshold"); } } @@ -872,25 +846,21 @@ public int? Threshold [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; protected internal override void CopyToInternal(Base other) { - var dest = other as DefinitionByCombinationComponent; - - if (dest == null) - { + if(other is not DefinitionByCombinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ThresholdElement != null) dest.ThresholdElement = (Hl7.Fhir.Model.PositiveInt)ThresholdElement.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ThresholdElement is not null) dest.ThresholdElement = (Hl7.Fhir.Model.PositiveInt)_ThresholdElement.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -902,48 +872,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DefinitionByCombinationComponent; - if(otherT == null) return false; + if(other is not DefinitionByCombinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ThresholdElement, otherT.ThresholdElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ThresholdElement, otherT._ThresholdElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "threshold": - value = ThresholdElement; - return ThresholdElement is not null; + value = _ThresholdElement; + return _ThresholdElement is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "threshold": - ThresholdElement = (Hl7.Fhir.Model.PositiveInt)value; + ThresholdElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -954,9 +924,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ThresholdElement is not null) yield return new KeyValuePair("threshold",ThresholdElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ThresholdElement is not null) yield return new KeyValuePair("threshold",_ThresholdElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); } } @@ -979,28 +949,25 @@ public partial class TimeFromEventComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human readable description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1013,11 +980,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The event used as a base point (reference point) in time. @@ -1027,55 +994,51 @@ public List Note [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Id))] [DataMember] - public Hl7.Fhir.Model.DataType Event + public Hl7.Fhir.Model.DataType? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.DataType _Event; + private Hl7.Fhir.Model.DataType? _Event; /// /// Used to express the observation at a defined amount of time before or after the event. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Used to express the observation within a period before and/or after the event. /// [FhirElement("range", Order=80)] [DataMember] - public Hl7.Fhir.Model.Range Range + public Hl7.Fhir.Model.Range? Range { get { return _Range; } set { _Range = value; OnPropertyChanged("Range"); } } - private Hl7.Fhir.Model.Range _Range; + private Hl7.Fhir.Model.Range? _Range; protected internal override void CopyToInternal(Base other) { - var dest = other as TimeFromEventComponent; - - if (dest == null) - { + if(other is not TimeFromEventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Event != null) dest.Event = (Hl7.Fhir.Model.DataType)Event.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Range != null) dest.Range = (Hl7.Fhir.Model.Range)Range.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.DataType)_Event.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Range is not null) dest.Range = (Hl7.Fhir.Model.Range)_Range.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1087,62 +1050,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TimeFromEventComponent; - if(otherT == null) return false; + if(other is not TimeFromEventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Range, otherT.Range)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Range, otherT._Range)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "range": - value = Range; - return Range is not null; + value = _Range; + return _Range is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "event": - Event = (Hl7.Fhir.Model.DataType)value; + Event = (Hl7.Fhir.Model.DataType?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "range": - Range = (Hl7.Fhir.Model.Range)value; + Range = (Hl7.Fhir.Model.Range?)value; return this; default: return base.SetValue(key, value); @@ -1153,11 +1116,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Range is not null) yield return new KeyValuePair("range",Range); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Range is not null) yield return new KeyValuePair("range",_Range); } } @@ -1180,28 +1143,25 @@ public partial class CategoryComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Description of the grouping /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1213,26 +1173,22 @@ public string Name [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CategoryComponent; - - if (dest == null) - { + if(other is not CategoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1244,41 +1200,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CategoryComponent; - if(otherT == null) return false; + if(other is not CategoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1289,8 +1245,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1300,28 +1256,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this evidence variable, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1334,39 +1287,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the evidence variable. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the evidence variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1378,41 +1328,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this evidence variable (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this evidence variable (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1422,28 +1369,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this evidence variable (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1453,28 +1397,25 @@ public string Title /// [FhirElement("shortTitle", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString ShortTitleElement + public Hl7.Fhir.Model.FhirString? ShortTitleElement { get { return _ShortTitleElement; } set { _ShortTitleElement = value; OnPropertyChanged("ShortTitleElement"); } } - private Hl7.Fhir.Model.FhirString _ShortTitleElement; + private Hl7.Fhir.Model.FhirString? _ShortTitleElement; /// /// Title for use in informal contexts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ShortTitle + public string? ShortTitle { - get { return ShortTitleElement != null ? ShortTitleElement.Value : null; } + get => _ShortTitleElement?.Value; set { - if (value == null) - ShortTitleElement = null; - else - ShortTitleElement = new Hl7.Fhir.Model.FhirString(value); + ShortTitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ShortTitle"); } } @@ -1487,13 +1428,13 @@ public string ShortTitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1502,13 +1443,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1518,13 +1456,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1533,13 +1471,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1549,28 +1484,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1580,28 +1512,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1614,39 +1543,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the evidence variable. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the evidence variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1659,11 +1585,11 @@ public string Description [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The context that the content is intended to support. @@ -1673,39 +1599,36 @@ public List Note [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Why this EvidenceVariable is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this EvidenceVariable is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1715,28 +1638,25 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1746,28 +1666,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1777,28 +1694,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the resource was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1808,28 +1722,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the resource was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1839,13 +1750,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Who authored the content. @@ -1855,11 +1766,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -1869,11 +1780,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -1883,11 +1794,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -1897,11 +1808,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1911,24 +1822,24 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Actual or conceptual. /// [FhirElement("actual", Order=350)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Actual or conceptual @@ -1937,13 +1848,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -1956,11 +1864,11 @@ public bool? Actual [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// continuous | dichotomous | ordinal | polychotomous. @@ -1969,13 +1877,13 @@ public List Characteris [DeclaredType(Type = typeof(Code))] [Binding("EvidenceVariableHandling")] [DataMember] - public Code HandlingElement + public Code? HandlingElement { get { return _HandlingElement; } set { _HandlingElement = value; OnPropertyChanged("HandlingElement"); } } - private Code _HandlingElement; + private Code? _HandlingElement; /// /// continuous | dichotomous | ordinal | polychotomous @@ -1984,13 +1892,10 @@ public Code HandlingElement [IgnoreDataMember] public Hl7.Fhir.Model.EvidenceVariableHandling? Handling { - get { return HandlingElement != null ? HandlingElement.Value : null; } + get => _HandlingElement?.Value; set { - if (value == null) - HandlingElement = null; - else - HandlingElement = new Code(value); + HandlingElement = value is null ? null : new Code(value); OnPropertyChanged("Handling"); } } @@ -2003,54 +1908,50 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as EvidenceVariable; - - if (dest == null) - { + if(other is not EvidenceVariable dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ShortTitleElement != null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)ShortTitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(HandlingElement != null) dest.HandlingElement = (Code)HandlingElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ShortTitleElement is not null) dest.ShortTitleElement = (Hl7.Fhir.Model.FhirString)_ShortTitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_HandlingElement is not null) dest.HandlingElement = (Code)_HandlingElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2062,237 +1963,237 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EvidenceVariable; - if(otherT == null) return false; + if(other is not EvidenceVariable otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(ShortTitleElement, otherT.ShortTitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.Equals(HandlingElement, otherT.HandlingElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_ShortTitleElement, otherT._ShortTitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "shortTitle": - value = ShortTitleElement; - return ShortTitleElement is not null; + value = _ShortTitleElement; + return _ShortTitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "handling": - value = HandlingElement; - return HandlingElement is not null; + value = _HandlingElement; + return _HandlingElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "shortTitle": - ShortTitleElement = (Hl7.Fhir.Model.FhirString)value; + ShortTitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "handling": - HandlingElement = (Code)value; + HandlingElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2303,36 +2204,36 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",ShortTitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (HandlingElement is not null) yield return new KeyValuePair("handling",HandlingElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ShortTitleElement is not null) yield return new KeyValuePair("shortTitle",_ShortTitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_HandlingElement is not null) yield return new KeyValuePair("handling",_HandlingElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs index 746595494..c5fe2029f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,28 +81,25 @@ public partial class ActorComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("key", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString KeyElement + public Hl7.Fhir.Model.FhirString? KeyElement { get { return _KeyElement; } set { _KeyElement = value; OnPropertyChanged("KeyElement"); } } - private Hl7.Fhir.Model.FhirString _KeyElement; + private Hl7.Fhir.Model.FhirString? _KeyElement; /// /// ID or acronym of the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Key + public string? Key { - get { return KeyElement != null ? KeyElement.Value : null; } + get => _KeyElement?.Value; set { - if (value == null) - KeyElement = null; - else - KeyElement = new Hl7.Fhir.Model.FhirString(value); + KeyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Key"); } } @@ -112,13 +112,13 @@ public string Key [Binding("ExampleScenarioActorType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | system @@ -127,13 +127,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ExampleScenarioActorType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -144,28 +141,25 @@ public Hl7.Fhir.Model.ExampleScenarioActorType? Type [FhirElement("title", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for actor when rendering /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -175,46 +169,39 @@ public string Title /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Details about actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ActorComponent; - - if (dest == null) - { + if(other is not ActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KeyElement != null) dest.KeyElement = (Hl7.Fhir.Model.FhirString)KeyElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_KeyElement is not null) dest.KeyElement = (Hl7.Fhir.Model.FhirString)_KeyElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -226,55 +213,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActorComponent; - if(otherT == null) return false; + if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KeyElement, otherT.KeyElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "key": - value = KeyElement; - return KeyElement is not null; + value = _KeyElement; + return _KeyElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "key": - KeyElement = (Hl7.Fhir.Model.FhirString)value; + KeyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -285,10 +272,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KeyElement is not null) yield return new KeyValuePair("key",KeyElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_KeyElement is not null) yield return new KeyValuePair("key",_KeyElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -315,28 +302,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("key", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString KeyElement + public Hl7.Fhir.Model.FhirString? KeyElement { get { return _KeyElement; } set { _KeyElement = value; OnPropertyChanged("KeyElement"); } } - private Hl7.Fhir.Model.FhirString _KeyElement; + private Hl7.Fhir.Model.FhirString? _KeyElement; /// /// ID or acronym of the instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Key + public string? Key { - get { return KeyElement != null ? KeyElement.Value : null; } + get => _KeyElement?.Value; set { - if (value == null) - KeyElement = null; - else - KeyElement = new Hl7.Fhir.Model.FhirString(value); + KeyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Key"); } } @@ -348,41 +332,38 @@ public string Key [Binding("InstanceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding StructureType + public Hl7.Fhir.Model.Coding? StructureType { get { return _StructureType; } set { _StructureType = value; OnPropertyChanged("StructureType"); } } - private Hl7.Fhir.Model.Coding _StructureType; + private Hl7.Fhir.Model.Coding? _StructureType; /// /// E.g. 4.0.1. /// [FhirElement("structureVersion", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString StructureVersionElement + public Hl7.Fhir.Model.FhirString? StructureVersionElement { get { return _StructureVersionElement; } set { _StructureVersionElement = value; OnPropertyChanged("StructureVersionElement"); } } - private Hl7.Fhir.Model.FhirString _StructureVersionElement; + private Hl7.Fhir.Model.FhirString? _StructureVersionElement; /// /// E.g. 4.0.1 /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StructureVersion + public string? StructureVersion { - get { return StructureVersionElement != null ? StructureVersionElement.Value : null; } + get => _StructureVersionElement?.Value; set { - if (value == null) - StructureVersionElement = null; - else - StructureVersionElement = new Hl7.Fhir.Model.FhirString(value); + StructureVersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StructureVersion"); } } @@ -394,13 +375,13 @@ public string StructureVersion [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType StructureProfile + public Hl7.Fhir.Model.DataType? StructureProfile { get { return _StructureProfile; } set { _StructureProfile = value; OnPropertyChanged("StructureProfile"); } } - private Hl7.Fhir.Model.DataType _StructureProfile; + private Hl7.Fhir.Model.DataType? _StructureProfile; /// /// Label for instance. @@ -408,28 +389,25 @@ public Hl7.Fhir.Model.DataType StructureProfile [FhirElement("title", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -439,28 +417,25 @@ public string Title /// [FhirElement("description", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human-friendly description of the instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -470,13 +445,13 @@ public string Description /// [FhirElement("content", Order=100)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Content + public Hl7.Fhir.Model.ResourceReference? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.ResourceReference _Content; + private Hl7.Fhir.Model.ResourceReference? _Content; /// /// Snapshot of instance that changes. @@ -486,11 +461,11 @@ public Hl7.Fhir.Model.ResourceReference Content [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// Resources contained in the instance. @@ -500,31 +475,27 @@ public List Version [DataMember] public List ContainedInstance { - get { if(_ContainedInstance==null) _ContainedInstance = new List(); return _ContainedInstance; } + get => _ContainedInstance ?? new List(); set { _ContainedInstance = value; OnPropertyChanged("ContainedInstance"); } } - private List _ContainedInstance; + private List? _ContainedInstance; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KeyElement != null) dest.KeyElement = (Hl7.Fhir.Model.FhirString)KeyElement.DeepCopyInternal(); - if(StructureType != null) dest.StructureType = (Hl7.Fhir.Model.Coding)StructureType.DeepCopyInternal(); - if(StructureVersionElement != null) dest.StructureVersionElement = (Hl7.Fhir.Model.FhirString)StructureVersionElement.DeepCopyInternal(); - if(StructureProfile != null) dest.StructureProfile = (Hl7.Fhir.Model.DataType)StructureProfile.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Content != null) dest.Content = (Hl7.Fhir.Model.ResourceReference)Content.DeepCopyInternal(); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(ContainedInstance.Any()) dest.ContainedInstance = new List(ContainedInstance.DeepCopyInternal()); + if(_KeyElement is not null) dest.KeyElement = (Hl7.Fhir.Model.FhirString)_KeyElement.DeepCopyInternal(); + if(_StructureType is not null) dest.StructureType = (Hl7.Fhir.Model.Coding)_StructureType.DeepCopyInternal(); + if(_StructureVersionElement is not null) dest.StructureVersionElement = (Hl7.Fhir.Model.FhirString)_StructureVersionElement.DeepCopyInternal(); + if(_StructureProfile is not null) dest.StructureProfile = (Hl7.Fhir.Model.DataType)_StructureProfile.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.ResourceReference)_Content.DeepCopyInternal(); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_ContainedInstance is not null) dest.ContainedInstance = new List(_ContainedInstance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -536,90 +507,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KeyElement, otherT.KeyElement)) return false; - if(!comparer.Equals(StructureType, otherT.StructureType)) return false; - if(!comparer.Equals(StructureVersionElement, otherT.StructureVersionElement)) return false; - if(!comparer.Equals(StructureProfile, otherT.StructureProfile)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.ListEquals(ContainedInstance, otherT.ContainedInstance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + if(!comparer.Equals(_StructureType, otherT._StructureType)) return false; + if(!comparer.Equals(_StructureVersionElement, otherT._StructureVersionElement)) return false; + if(!comparer.Equals(_StructureProfile, otherT._StructureProfile)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Content, otherT._Content)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.ListEquals(_ContainedInstance, otherT._ContainedInstance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "key": - value = KeyElement; - return KeyElement is not null; + value = _KeyElement; + return _KeyElement is not null; case "structureType": - value = StructureType; - return StructureType is not null; + value = _StructureType; + return _StructureType is not null; case "structureVersion": - value = StructureVersionElement; - return StructureVersionElement is not null; + value = _StructureVersionElement; + return _StructureVersionElement is not null; case "structureProfile": - value = StructureProfile; - return StructureProfile is not null; + value = _StructureProfile; + return _StructureProfile is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "containedInstance": - value = ContainedInstance; - return ContainedInstance?.Any() == true; + value = _ContainedInstance; + return _ContainedInstance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "key": - KeyElement = (Hl7.Fhir.Model.FhirString)value; + KeyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "structureType": - StructureType = (Hl7.Fhir.Model.Coding)value; + StructureType = (Hl7.Fhir.Model.Coding?)value; return this; case "structureVersion": - StructureVersionElement = (Hl7.Fhir.Model.FhirString)value; + StructureVersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "structureProfile": - StructureProfile = (Hl7.Fhir.Model.DataType)value; + StructureProfile = (Hl7.Fhir.Model.DataType?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "content": - Content = (Hl7.Fhir.Model.ResourceReference)value; + Content = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "containedInstance": - ContainedInstance = (List)value; + ContainedInstance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -630,15 +601,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KeyElement is not null) yield return new KeyValuePair("key",KeyElement); - if (StructureType is not null) yield return new KeyValuePair("structureType",StructureType); - if (StructureVersionElement is not null) yield return new KeyValuePair("structureVersion",StructureVersionElement); - if (StructureProfile is not null) yield return new KeyValuePair("structureProfile",StructureProfile); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Content is not null) yield return new KeyValuePair("content",Content); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (ContainedInstance?.Any() == true) yield return new KeyValuePair("containedInstance",ContainedInstance); + if (_KeyElement is not null) yield return new KeyValuePair("key",_KeyElement); + if (_StructureType is not null) yield return new KeyValuePair("structureType",_StructureType); + if (_StructureVersionElement is not null) yield return new KeyValuePair("structureVersion",_StructureVersionElement); + if (_StructureProfile is not null) yield return new KeyValuePair("structureProfile",_StructureProfile); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Content is not null) yield return new KeyValuePair("content",_Content); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_ContainedInstance?.Any() == true) yield return new KeyValuePair("containedInstance",_ContainedInstance); } } @@ -666,28 +637,25 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("key", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString KeyElement + public Hl7.Fhir.Model.FhirString? KeyElement { get { return _KeyElement; } set { _KeyElement = value; OnPropertyChanged("KeyElement"); } } - private Hl7.Fhir.Model.FhirString _KeyElement; + private Hl7.Fhir.Model.FhirString? _KeyElement; /// /// ID or acronym of the version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Key + public string? Key { - get { return KeyElement != null ? KeyElement.Value : null; } + get => _KeyElement?.Value; set { - if (value == null) - KeyElement = null; - else - KeyElement = new Hl7.Fhir.Model.FhirString(value); + KeyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Key"); } } @@ -698,28 +666,25 @@ public string Key [FhirElement("title", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for instance version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -729,28 +694,25 @@ public string Title /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Details about version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -760,28 +722,24 @@ public string Description /// [FhirElement("content", Order=70)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Content + public Hl7.Fhir.Model.ResourceReference? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.ResourceReference _Content; + private Hl7.Fhir.Model.ResourceReference? _Content; protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KeyElement != null) dest.KeyElement = (Hl7.Fhir.Model.FhirString)KeyElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Content != null) dest.Content = (Hl7.Fhir.Model.ResourceReference)Content.DeepCopyInternal(); + if(_KeyElement is not null) dest.KeyElement = (Hl7.Fhir.Model.FhirString)_KeyElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.ResourceReference)_Content.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -793,55 +751,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KeyElement, otherT.KeyElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "key": - value = KeyElement; - return KeyElement is not null; + value = _KeyElement; + return _KeyElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "key": - KeyElement = (Hl7.Fhir.Model.FhirString)value; + KeyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "content": - Content = (Hl7.Fhir.Model.ResourceReference)value; + Content = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -852,10 +810,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KeyElement is not null) yield return new KeyValuePair("key",KeyElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Content is not null) yield return new KeyValuePair("content",Content); + if (_KeyElement is not null) yield return new KeyValuePair("key",_KeyElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Content is not null) yield return new KeyValuePair("content",_Content); } } @@ -882,28 +840,25 @@ public partial class ContainedInstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("instanceReference", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString InstanceReferenceElement + public Hl7.Fhir.Model.FhirString? InstanceReferenceElement { get { return _InstanceReferenceElement; } set { _InstanceReferenceElement = value; OnPropertyChanged("InstanceReferenceElement"); } } - private Hl7.Fhir.Model.FhirString _InstanceReferenceElement; + private Hl7.Fhir.Model.FhirString? _InstanceReferenceElement; /// /// Key of contained instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstanceReference + public string? InstanceReference { - get { return InstanceReferenceElement != null ? InstanceReferenceElement.Value : null; } + get => _InstanceReferenceElement?.Value; set { - if (value == null) - InstanceReferenceElement = null; - else - InstanceReferenceElement = new Hl7.Fhir.Model.FhirString(value); + InstanceReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("InstanceReference"); } } @@ -913,44 +868,37 @@ public string InstanceReference /// [FhirElement("versionReference", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionReferenceElement + public Hl7.Fhir.Model.FhirString? VersionReferenceElement { get { return _VersionReferenceElement; } set { _VersionReferenceElement = value; OnPropertyChanged("VersionReferenceElement"); } } - private Hl7.Fhir.Model.FhirString _VersionReferenceElement; + private Hl7.Fhir.Model.FhirString? _VersionReferenceElement; /// /// Key of contained instance version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string VersionReference + public string? VersionReference { - get { return VersionReferenceElement != null ? VersionReferenceElement.Value : null; } + get => _VersionReferenceElement?.Value; set { - if (value == null) - VersionReferenceElement = null; - else - VersionReferenceElement = new Hl7.Fhir.Model.FhirString(value); + VersionReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("VersionReference"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContainedInstanceComponent; - - if (dest == null) - { + if(other is not ContainedInstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(InstanceReferenceElement != null) dest.InstanceReferenceElement = (Hl7.Fhir.Model.FhirString)InstanceReferenceElement.DeepCopyInternal(); - if(VersionReferenceElement != null) dest.VersionReferenceElement = (Hl7.Fhir.Model.FhirString)VersionReferenceElement.DeepCopyInternal(); + if(_InstanceReferenceElement is not null) dest.InstanceReferenceElement = (Hl7.Fhir.Model.FhirString)_InstanceReferenceElement.DeepCopyInternal(); + if(_VersionReferenceElement is not null) dest.VersionReferenceElement = (Hl7.Fhir.Model.FhirString)_VersionReferenceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -962,41 +910,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainedInstanceComponent; - if(otherT == null) return false; + if(other is not ContainedInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(InstanceReferenceElement, otherT.InstanceReferenceElement)) return false; - if(!comparer.Equals(VersionReferenceElement, otherT.VersionReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InstanceReferenceElement, otherT._InstanceReferenceElement)) return false; + if(!comparer.Equals(_VersionReferenceElement, otherT._VersionReferenceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "instanceReference": - value = InstanceReferenceElement; - return InstanceReferenceElement is not null; + value = _InstanceReferenceElement; + return _InstanceReferenceElement is not null; case "versionReference": - value = VersionReferenceElement; - return VersionReferenceElement is not null; + value = _VersionReferenceElement; + return _VersionReferenceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "instanceReference": - InstanceReferenceElement = (Hl7.Fhir.Model.FhirString)value; + InstanceReferenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionReference": - VersionReferenceElement = (Hl7.Fhir.Model.FhirString)value; + VersionReferenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1007,8 +955,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (InstanceReferenceElement is not null) yield return new KeyValuePair("instanceReference",InstanceReferenceElement); - if (VersionReferenceElement is not null) yield return new KeyValuePair("versionReference",VersionReferenceElement); + if (_InstanceReferenceElement is not null) yield return new KeyValuePair("instanceReference",_InstanceReferenceElement); + if (_VersionReferenceElement is not null) yield return new KeyValuePair("versionReference",_VersionReferenceElement); } } @@ -1036,28 +984,25 @@ public partial class ProcessComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("title", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for procss /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1067,28 +1012,25 @@ public string Title /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human-friendly description of the process /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1098,28 +1040,25 @@ public string Description /// [FhirElement("preConditions", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown PreConditionsElement + public Hl7.Fhir.Model.Markdown? PreConditionsElement { get { return _PreConditionsElement; } set { _PreConditionsElement = value; OnPropertyChanged("PreConditionsElement"); } } - private Hl7.Fhir.Model.Markdown _PreConditionsElement; + private Hl7.Fhir.Model.Markdown? _PreConditionsElement; /// /// Status before process starts /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreConditions + public string? PreConditions { - get { return PreConditionsElement != null ? PreConditionsElement.Value : null; } + get => _PreConditionsElement?.Value; set { - if (value == null) - PreConditionsElement = null; - else - PreConditionsElement = new Hl7.Fhir.Model.Markdown(value); + PreConditionsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PreConditions"); } } @@ -1129,28 +1068,25 @@ public string PreConditions /// [FhirElement("postConditions", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown PostConditionsElement + public Hl7.Fhir.Model.Markdown? PostConditionsElement { get { return _PostConditionsElement; } set { _PostConditionsElement = value; OnPropertyChanged("PostConditionsElement"); } } - private Hl7.Fhir.Model.Markdown _PostConditionsElement; + private Hl7.Fhir.Model.Markdown? _PostConditionsElement; /// /// Status after successful completion /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PostConditions + public string? PostConditions { - get { return PostConditionsElement != null ? PostConditionsElement.Value : null; } + get => _PostConditionsElement?.Value; set { - if (value == null) - PostConditionsElement = null; - else - PostConditionsElement = new Hl7.Fhir.Model.Markdown(value); + PostConditionsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PostConditions"); } } @@ -1163,27 +1099,23 @@ public string PostConditions [DataMember] public List Step { - get { if(_Step==null) _Step = new List(); return _Step; } + get => _Step ?? new List(); set { _Step = value; OnPropertyChanged("Step"); } } - private List _Step; + private List? _Step; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessComponent; - - if (dest == null) - { + if(other is not ProcessComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(PreConditionsElement != null) dest.PreConditionsElement = (Hl7.Fhir.Model.Markdown)PreConditionsElement.DeepCopyInternal(); - if(PostConditionsElement != null) dest.PostConditionsElement = (Hl7.Fhir.Model.Markdown)PostConditionsElement.DeepCopyInternal(); - if(Step.Any()) dest.Step = new List(Step.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_PreConditionsElement is not null) dest.PreConditionsElement = (Hl7.Fhir.Model.Markdown)_PreConditionsElement.DeepCopyInternal(); + if(_PostConditionsElement is not null) dest.PostConditionsElement = (Hl7.Fhir.Model.Markdown)_PostConditionsElement.DeepCopyInternal(); + if(_Step is not null) dest.Step = new List(_Step.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1195,62 +1127,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessComponent; - if(otherT == null) return false; + if(other is not ProcessComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(PreConditionsElement, otherT.PreConditionsElement)) return false; - if(!comparer.Equals(PostConditionsElement, otherT.PostConditionsElement)) return false; - if(!comparer.ListEquals(Step, otherT.Step)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_PreConditionsElement, otherT._PreConditionsElement)) return false; + if(!comparer.Equals(_PostConditionsElement, otherT._PostConditionsElement)) return false; + if(!comparer.ListEquals(_Step, otherT._Step)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "preConditions": - value = PreConditionsElement; - return PreConditionsElement is not null; + value = _PreConditionsElement; + return _PreConditionsElement is not null; case "postConditions": - value = PostConditionsElement; - return PostConditionsElement is not null; + value = _PostConditionsElement; + return _PostConditionsElement is not null; case "step": - value = Step; - return Step?.Any() == true; + value = _Step; + return _Step?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "preConditions": - PreConditionsElement = (Hl7.Fhir.Model.Markdown)value; + PreConditionsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "postConditions": - PostConditionsElement = (Hl7.Fhir.Model.Markdown)value; + PostConditionsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "step": - Step = (List)value; + Step = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1261,11 +1193,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (PreConditionsElement is not null) yield return new KeyValuePair("preConditions",PreConditionsElement); - if (PostConditionsElement is not null) yield return new KeyValuePair("postConditions",PostConditionsElement); - if (Step?.Any() == true) yield return new KeyValuePair("step",Step); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_PreConditionsElement is not null) yield return new KeyValuePair("preConditions",_PreConditionsElement); + if (_PostConditionsElement is not null) yield return new KeyValuePair("postConditions",_PostConditionsElement); + if (_Step?.Any() == true) yield return new KeyValuePair("step",_Step); } } @@ -1291,28 +1223,25 @@ public partial class StepComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NumberElement + public Hl7.Fhir.Model.FhirString? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.FhirString _NumberElement; + private Hl7.Fhir.Model.FhirString? _NumberElement; /// /// Sequential number of the step /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Number + public string? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.FhirString(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Number"); } } @@ -1322,41 +1251,38 @@ public string Number /// [FhirElement("process", Order=50)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.ProcessComponent Process + public Hl7.Fhir.Model.ExampleScenario.ProcessComponent? Process { get { return _Process; } set { _Process = value; OnPropertyChanged("Process"); } } - private Hl7.Fhir.Model.ExampleScenario.ProcessComponent _Process; + private Hl7.Fhir.Model.ExampleScenario.ProcessComponent? _Process; /// /// Step is nested workflow. /// [FhirElement("workflow", Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical WorkflowElement + public Hl7.Fhir.Model.Canonical? WorkflowElement { get { return _WorkflowElement; } set { _WorkflowElement = value; OnPropertyChanged("WorkflowElement"); } } - private Hl7.Fhir.Model.Canonical _WorkflowElement; + private Hl7.Fhir.Model.Canonical? _WorkflowElement; /// /// Step is nested workflow /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Workflow + public string? Workflow { - get { return WorkflowElement != null ? WorkflowElement.Value : null; } + get => _WorkflowElement?.Value; set { - if (value == null) - WorkflowElement = null; - else - WorkflowElement = new Hl7.Fhir.Model.Canonical(value); + WorkflowElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Workflow"); } } @@ -1366,13 +1292,13 @@ public string Workflow /// [FhirElement("operation", Order=70)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.OperationComponent Operation + public Hl7.Fhir.Model.ExampleScenario.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.ExampleScenario.OperationComponent _Operation; + private Hl7.Fhir.Model.ExampleScenario.OperationComponent? _Operation; /// /// Alternate non-typical step action. @@ -1382,24 +1308,24 @@ public Hl7.Fhir.Model.ExampleScenario.OperationComponent Operation [DataMember] public List Alternative { - get { if(_Alternative==null) _Alternative = new List(); return _Alternative; } + get => _Alternative ?? new List(); set { _Alternative = value; OnPropertyChanged("Alternative"); } } - private List _Alternative; + private List? _Alternative; /// /// Pause in the flow?. /// [FhirElement("pause", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PauseElement + public Hl7.Fhir.Model.FhirBoolean? PauseElement { get { return _PauseElement; } set { _PauseElement = value; OnPropertyChanged("PauseElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PauseElement; + private Hl7.Fhir.Model.FhirBoolean? _PauseElement; /// /// Pause in the flow? @@ -1408,33 +1334,26 @@ public Hl7.Fhir.Model.FhirBoolean PauseElement [IgnoreDataMember] public bool? Pause { - get { return PauseElement != null ? PauseElement.Value : null; } + get => _PauseElement?.Value; set { - if (value == null) - PauseElement = null; - else - PauseElement = new Hl7.Fhir.Model.FhirBoolean(value); + PauseElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Pause"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StepComponent; - - if (dest == null) - { + if(other is not StepComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.FhirString)NumberElement.DeepCopyInternal(); - if(Process != null) dest.Process = (Hl7.Fhir.Model.ExampleScenario.ProcessComponent)Process.DeepCopyInternal(); - if(WorkflowElement != null) dest.WorkflowElement = (Hl7.Fhir.Model.Canonical)WorkflowElement.DeepCopyInternal(); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)Operation.DeepCopyInternal(); - if(Alternative.Any()) dest.Alternative = new List(Alternative.DeepCopyInternal()); - if(PauseElement != null) dest.PauseElement = (Hl7.Fhir.Model.FhirBoolean)PauseElement.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.FhirString)_NumberElement.DeepCopyInternal(); + if(_Process is not null) dest.Process = (Hl7.Fhir.Model.ExampleScenario.ProcessComponent)_Process.DeepCopyInternal(); + if(_WorkflowElement is not null) dest.WorkflowElement = (Hl7.Fhir.Model.Canonical)_WorkflowElement.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)_Operation.DeepCopyInternal(); + if(_Alternative is not null) dest.Alternative = new List(_Alternative.DeepCopyInternal()); + if(_PauseElement is not null) dest.PauseElement = (Hl7.Fhir.Model.FhirBoolean)_PauseElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1446,69 +1365,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StepComponent; - if(otherT == null) return false; + if(other is not StepComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Process, otherT.Process)) return false; - if(!comparer.Equals(WorkflowElement, otherT.WorkflowElement)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.ListEquals(Alternative, otherT.Alternative)) return false; - if(!comparer.Equals(PauseElement, otherT.PauseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Process, otherT._Process)) return false; + if(!comparer.Equals(_WorkflowElement, otherT._WorkflowElement)) return false; + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.ListEquals(_Alternative, otherT._Alternative)) return false; + if(!comparer.Equals(_PauseElement, otherT._PauseElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "process": - value = Process; - return Process is not null; + value = _Process; + return _Process is not null; case "workflow": - value = WorkflowElement; - return WorkflowElement is not null; + value = _WorkflowElement; + return _WorkflowElement is not null; case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "alternative": - value = Alternative; - return Alternative?.Any() == true; + value = _Alternative; + return _Alternative?.Any() == true; case "pause": - value = PauseElement; - return PauseElement is not null; + value = _PauseElement; + return _PauseElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.FhirString)value; + NumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "process": - Process = (Hl7.Fhir.Model.ExampleScenario.ProcessComponent)value; + Process = (Hl7.Fhir.Model.ExampleScenario.ProcessComponent?)value; return this; case "workflow": - WorkflowElement = (Hl7.Fhir.Model.Canonical)value; + WorkflowElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "operation": - Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent)value; + Operation = (Hl7.Fhir.Model.ExampleScenario.OperationComponent?)value; return this; case "alternative": - Alternative = (List)value; + Alternative = (List?)value!; return this; case "pause": - PauseElement = (Hl7.Fhir.Model.FhirBoolean)value; + PauseElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1519,12 +1438,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Process is not null) yield return new KeyValuePair("process",Process); - if (WorkflowElement is not null) yield return new KeyValuePair("workflow",WorkflowElement); - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Alternative?.Any() == true) yield return new KeyValuePair("alternative",Alternative); - if (PauseElement is not null) yield return new KeyValuePair("pause",PauseElement); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Process is not null) yield return new KeyValuePair("process",_Process); + if (_WorkflowElement is not null) yield return new KeyValuePair("workflow",_WorkflowElement); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Alternative?.Any() == true) yield return new KeyValuePair("alternative",_Alternative); + if (_PauseElement is not null) yield return new KeyValuePair("pause",_PauseElement); } } @@ -1550,13 +1469,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Label for step. @@ -1564,28 +1483,25 @@ public Hl7.Fhir.Model.Coding Type [FhirElement("title", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for step /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1595,28 +1511,25 @@ public string Title /// [FhirElement("initiator", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString InitiatorElement + public Hl7.Fhir.Model.FhirString? InitiatorElement { get { return _InitiatorElement; } set { _InitiatorElement = value; OnPropertyChanged("InitiatorElement"); } } - private Hl7.Fhir.Model.FhirString _InitiatorElement; + private Hl7.Fhir.Model.FhirString? _InitiatorElement; /// /// Who starts the operation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Initiator + public string? Initiator { - get { return InitiatorElement != null ? InitiatorElement.Value : null; } + get => _InitiatorElement?.Value; set { - if (value == null) - InitiatorElement = null; - else - InitiatorElement = new Hl7.Fhir.Model.FhirString(value); + InitiatorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Initiator"); } } @@ -1626,28 +1539,25 @@ public string Initiator /// [FhirElement("receiver", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ReceiverElement + public Hl7.Fhir.Model.FhirString? ReceiverElement { get { return _ReceiverElement; } set { _ReceiverElement = value; OnPropertyChanged("ReceiverElement"); } } - private Hl7.Fhir.Model.FhirString _ReceiverElement; + private Hl7.Fhir.Model.FhirString? _ReceiverElement; /// /// Who receives the operation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Receiver + public string? Receiver { - get { return ReceiverElement != null ? ReceiverElement.Value : null; } + get => _ReceiverElement?.Value; set { - if (value == null) - ReceiverElement = null; - else - ReceiverElement = new Hl7.Fhir.Model.FhirString(value); + ReceiverElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Receiver"); } } @@ -1657,28 +1567,25 @@ public string Receiver /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human-friendly description of the operation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1688,13 +1595,13 @@ public string Description /// [FhirElement("initiatorActive", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InitiatorActiveElement + public Hl7.Fhir.Model.FhirBoolean? InitiatorActiveElement { get { return _InitiatorActiveElement; } set { _InitiatorActiveElement = value; OnPropertyChanged("InitiatorActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InitiatorActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InitiatorActiveElement; /// /// Initiator stays active? @@ -1703,13 +1610,10 @@ public Hl7.Fhir.Model.FhirBoolean InitiatorActiveElement [IgnoreDataMember] public bool? InitiatorActive { - get { return InitiatorActiveElement != null ? InitiatorActiveElement.Value : null; } + get => _InitiatorActiveElement?.Value; set { - if (value == null) - InitiatorActiveElement = null; - else - InitiatorActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InitiatorActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("InitiatorActive"); } } @@ -1719,13 +1623,13 @@ public bool? InitiatorActive /// [FhirElement("receiverActive", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReceiverActiveElement + public Hl7.Fhir.Model.FhirBoolean? ReceiverActiveElement { get { return _ReceiverActiveElement; } set { _ReceiverActiveElement = value; OnPropertyChanged("ReceiverActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReceiverActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ReceiverActiveElement; /// /// Receiver stays active? @@ -1734,13 +1638,10 @@ public Hl7.Fhir.Model.FhirBoolean ReceiverActiveElement [IgnoreDataMember] public bool? ReceiverActive { - get { return ReceiverActiveElement != null ? ReceiverActiveElement.Value : null; } + get => _ReceiverActiveElement?.Value; set { - if (value == null) - ReceiverActiveElement = null; - else - ReceiverActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReceiverActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReceiverActive"); } } @@ -1750,46 +1651,42 @@ public bool? ReceiverActive /// [FhirElement("request", Order=110)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent Request + public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent _Request; + private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? _Request; /// /// Instance transmitted on invocation response. /// [FhirElement("response", Order=120)] [DataMember] - public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent Response + public Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent _Response; + private Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent? _Response; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(InitiatorElement != null) dest.InitiatorElement = (Hl7.Fhir.Model.FhirString)InitiatorElement.DeepCopyInternal(); - if(ReceiverElement != null) dest.ReceiverElement = (Hl7.Fhir.Model.FhirString)ReceiverElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(InitiatorActiveElement != null) dest.InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)InitiatorActiveElement.DeepCopyInternal(); - if(ReceiverActiveElement != null) dest.ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)ReceiverActiveElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)Response.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_InitiatorElement is not null) dest.InitiatorElement = (Hl7.Fhir.Model.FhirString)_InitiatorElement.DeepCopyInternal(); + if(_ReceiverElement is not null) dest.ReceiverElement = (Hl7.Fhir.Model.FhirString)_ReceiverElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_InitiatorActiveElement is not null) dest.InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)_InitiatorActiveElement.DeepCopyInternal(); + if(_ReceiverActiveElement is not null) dest.ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ReceiverActiveElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)_Response.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1801,90 +1698,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(InitiatorElement, otherT.InitiatorElement)) return false; - if(!comparer.Equals(ReceiverElement, otherT.ReceiverElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(InitiatorActiveElement, otherT.InitiatorActiveElement)) return false; - if(!comparer.Equals(ReceiverActiveElement, otherT.ReceiverActiveElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_InitiatorElement, otherT._InitiatorElement)) return false; + if(!comparer.Equals(_ReceiverElement, otherT._ReceiverElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_InitiatorActiveElement, otherT._InitiatorActiveElement)) return false; + if(!comparer.Equals(_ReceiverActiveElement, otherT._ReceiverActiveElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "initiator": - value = InitiatorElement; - return InitiatorElement is not null; + value = _InitiatorElement; + return _InitiatorElement is not null; case "receiver": - value = ReceiverElement; - return ReceiverElement is not null; + value = _ReceiverElement; + return _ReceiverElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "initiatorActive": - value = InitiatorActiveElement; - return InitiatorActiveElement is not null; + value = _InitiatorActiveElement; + return _InitiatorActiveElement is not null; case "receiverActive": - value = ReceiverActiveElement; - return ReceiverActiveElement is not null; + value = _ReceiverActiveElement; + return _ReceiverActiveElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "initiator": - InitiatorElement = (Hl7.Fhir.Model.FhirString)value; + InitiatorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "receiver": - ReceiverElement = (Hl7.Fhir.Model.FhirString)value; + ReceiverElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "initiatorActive": - InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InitiatorActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "receiverActive": - ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReceiverActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)value; + Request = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent)value; + Response = (Hl7.Fhir.Model.ExampleScenario.ContainedInstanceComponent?)value; return this; default: return base.SetValue(key, value); @@ -1895,15 +1792,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (InitiatorElement is not null) yield return new KeyValuePair("initiator",InitiatorElement); - if (ReceiverElement is not null) yield return new KeyValuePair("receiver",ReceiverElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (InitiatorActiveElement is not null) yield return new KeyValuePair("initiatorActive",InitiatorActiveElement); - if (ReceiverActiveElement is not null) yield return new KeyValuePair("receiverActive",ReceiverActiveElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_InitiatorElement is not null) yield return new KeyValuePair("initiator",_InitiatorElement); + if (_ReceiverElement is not null) yield return new KeyValuePair("receiver",_ReceiverElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_InitiatorActiveElement is not null) yield return new KeyValuePair("initiatorActive",_InitiatorActiveElement); + if (_ReceiverActiveElement is not null) yield return new KeyValuePair("receiverActive",_ReceiverActiveElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); } } @@ -1930,28 +1827,25 @@ public partial class AlternativeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("title", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Label for alternative /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1961,28 +1855,25 @@ public string Title /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human-readable description of option /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1995,25 +1886,21 @@ public string Description [DataMember] public List Step { - get { if(_Step==null) _Step = new List(); return _Step; } + get => _Step ?? new List(); set { _Step = value; OnPropertyChanged("Step"); } } - private List _Step; + private List? _Step; protected internal override void CopyToInternal(Base other) { - var dest = other as AlternativeComponent; - - if (dest == null) - { + if(other is not AlternativeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Step.Any()) dest.Step = new List(Step.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Step is not null) dest.Step = new List(_Step.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2025,48 +1912,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AlternativeComponent; - if(otherT == null) return false; + if(other is not AlternativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Step, otherT.Step)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Step, otherT._Step)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "step": - value = Step; - return Step?.Any() == true; + value = _Step; + return _Step?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "step": - Step = (List)value; + Step = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2077,9 +1964,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Step?.Any() == true) yield return new KeyValuePair("step",Step); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Step?.Any() == true) yield return new KeyValuePair("step",_Step); } } @@ -2089,28 +1976,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this example scenario, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2123,39 +2007,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the example scenario. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the example scenario /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2167,41 +2048,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// To be removed?. /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// To be removed? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2211,28 +2089,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this example scenario (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2245,13 +2120,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2260,13 +2135,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2276,13 +2148,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2291,13 +2163,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2307,28 +2176,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2338,28 +2204,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2372,39 +2235,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the ExampleScenario. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the ExampleScenario /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2417,11 +2277,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for example scenario (if applicable). @@ -2432,39 +2292,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// The purpose of the example, e.g. to illustrate a scenario. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// The purpose of the example, e.g. to illustrate a scenario /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2474,28 +2331,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2505,28 +2359,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -2539,11 +2390,11 @@ public string CopyrightLabel [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Data used in the scenario. @@ -2553,11 +2404,11 @@ public List Actor [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Major process within scenario. @@ -2567,44 +2418,40 @@ public List Instance [DataMember] public List Process { - get { if(_Process==null) _Process = new List(); return _Process; } + get => _Process ?? new List(); set { _Process = value; OnPropertyChanged("Process"); } } - private List _Process; + private List? _Process; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ExampleScenario; - - if (dest == null) - { + if(other is not ExampleScenario dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Process.Any()) dest.Process = new List(Process.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Process is not null) dest.Process = new List(_Process.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2616,167 +2463,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExampleScenario; - if(otherT == null) return false; + if(other is not ExampleScenario otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Process, otherT.Process)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Process, otherT._Process)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "process": - value = Process; - return Process?.Any() == true; + value = _Process; + return _Process?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "process": - Process = (List)value; + Process = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2787,26 +2634,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Process?.Any() == true) yield return new KeyValuePair("process",Process); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Process?.Any() == true) yield return new KeyValuePair("process",_Process); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs index 5c98ad303..87be7d771 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -117,13 +120,13 @@ public partial class RelatedClaimComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// How the reference claim is related. @@ -131,40 +134,36 @@ public Hl7.Fhir.Model.ResourceReference Claim [FhirElement("relationship", Order=50)] [Binding("RelatedClaimRelationship")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// File or case reference. /// [FhirElement("reference", Order=60)] [DataMember] - public Hl7.Fhir.Model.Identifier Reference + public Hl7.Fhir.Model.Identifier? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.Identifier _Reference; + private Hl7.Fhir.Model.Identifier? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedClaimComponent; - - if (dest == null) - { + if(other is not RelatedClaimComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.Identifier)Reference.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.Identifier)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -176,48 +175,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedClaimComponent; - if(otherT == null) return false; + if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.Identifier)value; + Reference = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -228,9 +227,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -258,13 +257,13 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [Binding("DatesType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Occurance date or period. @@ -274,26 +273,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; protected internal override void CopyToInternal(Base other) { - var dest = other as EventComponent; - - if (dest == null) - { + if(other is not EventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -305,41 +300,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventComponent; - if(otherT == null) return false; + if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(When, otherT.When)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -350,8 +345,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (When is not null) yield return new KeyValuePair("when",When); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_When is not null) yield return new KeyValuePair("when",_When); } } @@ -379,13 +374,13 @@ public partial class PayeeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PayeeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient reference. @@ -394,26 +389,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as PayeeComponent; - - if (dest == null) - { + if(other is not PayeeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -425,41 +416,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PayeeComponent; - if(otherT == null) return false; + if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -470,8 +461,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -498,13 +489,13 @@ public partial class CareTeamComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Order of care team @@ -513,13 +504,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -532,26 +520,26 @@ public int? Sequence [References("Practitioner","PractitionerRole","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Indicator of the lead practitioner. /// [FhirElement("responsible", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ResponsibleElement + public Hl7.Fhir.Model.FhirBoolean? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ResponsibleElement; + private Hl7.Fhir.Model.FhirBoolean? _ResponsibleElement; /// /// Indicator of the lead practitioner @@ -560,13 +548,10 @@ public Hl7.Fhir.Model.FhirBoolean ResponsibleElement [IgnoreDataMember] public bool? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirBoolean(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Responsible"); } } @@ -577,13 +562,13 @@ public bool? Responsible [FhirElement("role", Order=70)] [Binding("CareTeamRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Practitioner or provider specialization. @@ -591,29 +576,25 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("specialty", Order=80)] [Binding("ProviderQualification")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Specialty + public Hl7.Fhir.Model.CodeableConcept? Specialty { get { return _Specialty; } set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private Hl7.Fhir.Model.CodeableConcept _Specialty; + private Hl7.Fhir.Model.CodeableConcept? _Specialty; protected internal override void CopyToInternal(Base other) { - var dest = other as CareTeamComponent; - - if (dest == null) - { + if(other is not CareTeamComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)ResponsibleElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Specialty != null) dest.Specialty = (Hl7.Fhir.Model.CodeableConcept)Specialty.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)_ResponsibleElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Specialty is not null) dest.Specialty = (Hl7.Fhir.Model.CodeableConcept)_Specialty.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -625,62 +606,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CareTeamComponent; - if(otherT == null) return false; + if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Specialty, otherT.Specialty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Specialty, otherT._Specialty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "specialty": - value = Specialty; - return Specialty is not null; + value = _Specialty; + return _Specialty is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialty": - Specialty = (Hl7.Fhir.Model.CodeableConcept)value; + Specialty = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -691,11 +672,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Specialty is not null) yield return new KeyValuePair("specialty",Specialty); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Specialty is not null) yield return new KeyValuePair("specialty",_Specialty); } } @@ -723,13 +704,13 @@ public partial class SupportingInformationComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Information instance identifier @@ -738,13 +719,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -756,13 +734,13 @@ public int? Sequence [Binding("InformationCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Type of information. @@ -770,13 +748,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("code", Order=60)] [Binding("InformationCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// When it occurred. @@ -785,13 +763,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Data to be provided. @@ -801,13 +779,13 @@ public Hl7.Fhir.Model.DataType Timing [References("Resource")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Identifier))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Explanation for the information. @@ -815,30 +793,26 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("reason", Order=90)] [Binding("MissingReason")] [DataMember] - public Hl7.Fhir.Model.Coding Reason + public Hl7.Fhir.Model.Coding? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.Coding _Reason; + private Hl7.Fhir.Model.Coding? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SupportingInformationComponent; - - if (dest == null) - { + if(other is not SupportingInformationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.Coding)Reason.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.Coding)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -850,69 +824,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupportingInformationComponent; - if(otherT == null) return false; + if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.Coding)value; + Reason = (Hl7.Fhir.Model.Coding?)value; return this; default: return base.SetValue(key, value); @@ -923,12 +897,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -955,13 +929,13 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Diagnosis instance identifier @@ -970,13 +944,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -991,13 +962,13 @@ public int? Sequence [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Diagnosis + public Hl7.Fhir.Model.DataType? Diagnosis { get { return _Diagnosis; } set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private Hl7.Fhir.Model.DataType _Diagnosis; + private Hl7.Fhir.Model.DataType? _Diagnosis; /// /// Timing or nature of the diagnosis. @@ -1008,11 +979,11 @@ public Hl7.Fhir.Model.DataType Diagnosis [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Present on admission. @@ -1020,28 +991,24 @@ public List Type [FhirElement("onAdmission", Order=70)] [Binding("DiagnosisOnAdmission")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OnAdmission + public Hl7.Fhir.Model.CodeableConcept? OnAdmission { get { return _OnAdmission; } set { _OnAdmission = value; OnPropertyChanged("OnAdmission"); } } - private Hl7.Fhir.Model.CodeableConcept _OnAdmission; + private Hl7.Fhir.Model.CodeableConcept? _OnAdmission; protected internal override void CopyToInternal(Base other) { - var dest = other as DiagnosisComponent; - - if (dest == null) - { + if(other is not DiagnosisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Diagnosis != null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)Diagnosis.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(OnAdmission != null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)OnAdmission.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Diagnosis is not null) dest.Diagnosis = (Hl7.Fhir.Model.DataType)_Diagnosis.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_OnAdmission is not null) dest.OnAdmission = (Hl7.Fhir.Model.CodeableConcept)_OnAdmission.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1053,55 +1020,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DiagnosisComponent; - if(otherT == null) return false; + if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(OnAdmission, otherT.OnAdmission)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "diagnosis": - value = Diagnosis; - return Diagnosis is not null; + value = _Diagnosis; + return _Diagnosis is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "onAdmission": - value = OnAdmission; - return OnAdmission is not null; + value = _OnAdmission; + return _OnAdmission is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "diagnosis": - Diagnosis = (Hl7.Fhir.Model.DataType)value; + Diagnosis = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "onAdmission": - OnAdmission = (Hl7.Fhir.Model.CodeableConcept)value; + OnAdmission = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1112,10 +1079,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Diagnosis is not null) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (OnAdmission is not null) yield return new KeyValuePair("onAdmission",OnAdmission); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Diagnosis is not null) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_OnAdmission is not null) yield return new KeyValuePair("onAdmission",_OnAdmission); } } @@ -1142,13 +1109,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Procedure instance identifier @@ -1157,13 +1124,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1177,39 +1141,36 @@ public int? Sequence [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// When the procedure was performed. /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the procedure was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1224,13 +1185,13 @@ public string Date [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Procedure + public Hl7.Fhir.Model.DataType? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.DataType _Procedure; + private Hl7.Fhir.Model.DataType? _Procedure; /// /// Unique device identifier. @@ -1242,27 +1203,23 @@ public Hl7.Fhir.Model.DataType Procedure [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.DataType)Procedure.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.DataType)_Procedure.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1274,62 +1231,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.DataType)value; + Procedure = (Hl7.Fhir.Model.DataType?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1340,11 +1297,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); } } @@ -1372,13 +1329,13 @@ public partial class InsuranceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("focal", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean FocalElement + public Hl7.Fhir.Model.FhirBoolean? FocalElement { get { return _FocalElement; } set { _FocalElement = value; OnPropertyChanged("FocalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _FocalElement; + private Hl7.Fhir.Model.FhirBoolean? _FocalElement; /// /// Coverage to be used for adjudication @@ -1387,13 +1344,10 @@ public Hl7.Fhir.Model.FhirBoolean FocalElement [IgnoreDataMember] public bool? Focal { - get { return FocalElement != null ? FocalElement.Value : null; } + get => _FocalElement?.Value; set { - if (value == null) - FocalElement = null; - else - FocalElement = new Hl7.Fhir.Model.FhirBoolean(value); + FocalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Focal"); } } @@ -1406,13 +1360,13 @@ public bool? Focal [References("Coverage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Coverage + public Hl7.Fhir.Model.ResourceReference? Coverage { get { return _Coverage; } set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private Hl7.Fhir.Model.ResourceReference _Coverage; + private Hl7.Fhir.Model.ResourceReference? _Coverage; /// /// Prior authorization reference number. @@ -1422,24 +1376,24 @@ public Hl7.Fhir.Model.ResourceReference Coverage [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Prior authorization reference number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -1448,17 +1402,13 @@ public IEnumerable PreAuthRef protected internal override void CopyToInternal(Base other) { - var dest = other as InsuranceComponent; - - if (dest == null) - { + if(other is not InsuranceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FocalElement != null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)FocalElement.DeepCopyInternal(); - if(Coverage != null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); + if(_FocalElement is not null) dest.FocalElement = (Hl7.Fhir.Model.FhirBoolean)_FocalElement.DeepCopyInternal(); + if(_Coverage is not null) dest.Coverage = (Hl7.Fhir.Model.ResourceReference)_Coverage.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1470,48 +1420,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsuranceComponent; - if(otherT == null) return false; + if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FocalElement, otherT.FocalElement)) return false; - if(!comparer.Equals(Coverage, otherT.Coverage)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "focal": - value = FocalElement; - return FocalElement is not null; + value = _FocalElement; + return _FocalElement is not null; case "coverage": - value = Coverage; - return Coverage is not null; + value = _Coverage; + return _Coverage is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "focal": - FocalElement = (Hl7.Fhir.Model.FhirBoolean)value; + FocalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "coverage": - Coverage = (Hl7.Fhir.Model.ResourceReference)value; + Coverage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1522,9 +1472,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FocalElement is not null) yield return new KeyValuePair("focal",FocalElement); - if (Coverage is not null) yield return new KeyValuePair("coverage",Coverage); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); + if (_FocalElement is not null) yield return new KeyValuePair("focal",_FocalElement); + if (_Coverage is not null) yield return new KeyValuePair("coverage",_Coverage); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); } } @@ -1550,28 +1500,25 @@ public partial class AccidentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When the incident occurred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -1582,13 +1529,13 @@ public string Date [FhirElement("type", Order=50)] [Binding("AccidentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the event occurred. @@ -1598,27 +1545,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as AccidentComponent; - - if (dest == null) - { + if(other is not AccidentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1630,48 +1573,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AccidentComponent; - if(otherT == null) return false; + if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1682,9 +1625,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1711,13 +1654,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Item instance identifier @@ -1726,13 +1669,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -1745,24 +1685,24 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get { if(_CareTeamSequenceElement==null) _CareTeamSequenceElement = new List(); return _CareTeamSequenceElement; } + get => _CareTeamSequenceElement ?? new List(); set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } - private List _CareTeamSequenceElement; + private List? _CareTeamSequenceElement; /// /// Applicable care team members /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable CareTeamSequence + public IEnumerable? CareTeamSequence { - get { return CareTeamSequenceElement != null ? CareTeamSequenceElement.Select(elem => elem.Value) : null; } + get => _CareTeamSequenceElement?.Select(elem => elem.Value); set { if (value == null) - CareTeamSequenceElement = null; + CareTeamSequenceElement = null!; else CareTeamSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("CareTeamSequence"); @@ -1777,24 +1717,24 @@ public IEnumerable CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get { if(_DiagnosisSequenceElement==null) _DiagnosisSequenceElement = new List(); return _DiagnosisSequenceElement; } + get => _DiagnosisSequenceElement ?? new List(); set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } - private List _DiagnosisSequenceElement; + private List? _DiagnosisSequenceElement; /// /// Applicable diagnoses /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DiagnosisSequence + public IEnumerable? DiagnosisSequence { - get { return DiagnosisSequenceElement != null ? DiagnosisSequenceElement.Select(elem => elem.Value) : null; } + get => _DiagnosisSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DiagnosisSequenceElement = null; + DiagnosisSequenceElement = null!; else DiagnosisSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DiagnosisSequence"); @@ -1809,24 +1749,24 @@ public IEnumerable DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get { if(_ProcedureSequenceElement==null) _ProcedureSequenceElement = new List(); return _ProcedureSequenceElement; } + get => _ProcedureSequenceElement ?? new List(); set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } - private List _ProcedureSequenceElement; + private List? _ProcedureSequenceElement; /// /// Applicable procedures /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ProcedureSequence + public IEnumerable? ProcedureSequence { - get { return ProcedureSequenceElement != null ? ProcedureSequenceElement.Select(elem => elem.Value) : null; } + get => _ProcedureSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ProcedureSequenceElement = null; + ProcedureSequenceElement = null!; else ProcedureSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ProcedureSequence"); @@ -1841,24 +1781,24 @@ public IEnumerable ProcedureSequence [DataMember] public List InformationSequenceElement { - get { if(_InformationSequenceElement==null) _InformationSequenceElement = new List(); return _InformationSequenceElement; } + get => _InformationSequenceElement ?? new List(); set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } - private List _InformationSequenceElement; + private List? _InformationSequenceElement; /// /// Applicable exception and supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InformationSequence + public IEnumerable? InformationSequence { - get { return InformationSequenceElement != null ? InformationSequenceElement.Select(elem => elem.Value) : null; } + get => _InformationSequenceElement?.Select(elem => elem.Value); set { if (value == null) - InformationSequenceElement = null; + InformationSequenceElement = null!; else InformationSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("InformationSequence"); @@ -1873,11 +1813,11 @@ public IEnumerable InformationSequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -1885,13 +1825,13 @@ public List TraceNumber [FhirElement("revenue", Order=100)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -1899,13 +1839,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=110)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -1913,13 +1853,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=120)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -1927,13 +1867,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=130)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Request or Referral for Service. @@ -1945,11 +1885,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Product or service billing modifiers. @@ -1960,11 +1900,11 @@ public List Request [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -1975,11 +1915,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -1988,13 +1928,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -2005,65 +1945,65 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=200)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=210)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -2072,13 +2012,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -2088,26 +2025,26 @@ public decimal? Factor /// [FhirElement("tax", Order=230)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=240)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -2119,11 +2056,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Anatomical location. @@ -2133,11 +2070,11 @@ public List Udi [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Encounters associated with the listed treatments. @@ -2149,11 +2086,11 @@ public List BodySite [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Applicable note numbers. @@ -2163,24 +2100,24 @@ public List Encounter [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -2192,13 +2129,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=290)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? _ReviewOutcome; /// /// Adjudication details. @@ -2208,11 +2145,11 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -2222,50 +2159,46 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(CareTeamSequenceElement.Any()) dest.CareTeamSequenceElement = new List(CareTeamSequenceElement.DeepCopyInternal()); - if(DiagnosisSequenceElement.Any()) dest.DiagnosisSequenceElement = new List(DiagnosisSequenceElement.DeepCopyInternal()); - if(ProcedureSequenceElement.Any()) dest.ProcedureSequenceElement = new List(ProcedureSequenceElement.DeepCopyInternal()); - if(InformationSequenceElement.Any()) dest.InformationSequenceElement = new List(InformationSequenceElement.DeepCopyInternal()); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_CareTeamSequenceElement is not null) dest.CareTeamSequenceElement = new List(_CareTeamSequenceElement.DeepCopyInternal()); + if(_DiagnosisSequenceElement is not null) dest.DiagnosisSequenceElement = new List(_DiagnosisSequenceElement.DeepCopyInternal()); + if(_ProcedureSequenceElement is not null) dest.ProcedureSequenceElement = new List(_ProcedureSequenceElement.DeepCopyInternal()); + if(_InformationSequenceElement is not null) dest.InformationSequenceElement = new List(_InformationSequenceElement.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2277,223 +2210,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(CareTeamSequenceElement, otherT.CareTeamSequenceElement)) return false; - if(!comparer.ListEquals(DiagnosisSequenceElement, otherT.DiagnosisSequenceElement)) return false; - if(!comparer.ListEquals(ProcedureSequenceElement, otherT.ProcedureSequenceElement)) return false; - if(!comparer.ListEquals(InformationSequenceElement, otherT.InformationSequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; + if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; + if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; + if(!comparer.ListEquals(_InformationSequenceElement, otherT._InformationSequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "careTeamSequence": - value = CareTeamSequenceElement; - return CareTeamSequenceElement?.Any() == true; + value = _CareTeamSequenceElement; + return _CareTeamSequenceElement?.Any() == true; case "diagnosisSequence": - value = DiagnosisSequenceElement; - return DiagnosisSequenceElement?.Any() == true; + value = _DiagnosisSequenceElement; + return _DiagnosisSequenceElement?.Any() == true; case "procedureSequence": - value = ProcedureSequenceElement; - return ProcedureSequenceElement?.Any() == true; + value = _ProcedureSequenceElement; + return _ProcedureSequenceElement?.Any() == true; case "informationSequence": - value = InformationSequenceElement; - return InformationSequenceElement?.Any() == true; + value = _InformationSequenceElement; + return _InformationSequenceElement?.Any() == true; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "careTeamSequence": - CareTeamSequenceElement = (List)value; + CareTeamSequenceElement = (List?)value!; return this; case "diagnosisSequence": - DiagnosisSequenceElement = (List)value; + DiagnosisSequenceElement = (List?)value!; return this; case "procedureSequence": - ProcedureSequenceElement = (List)value; + ProcedureSequenceElement = (List?)value!; return this; case "informationSequence": - InformationSequenceElement = (List)value; + InformationSequenceElement = (List?)value!; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2504,34 +2437,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",CareTeamSequenceElement); - if (DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",DiagnosisSequenceElement); - if (ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",ProcedureSequenceElement); - if (InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",InformationSequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_CareTeamSequenceElement?.Any() == true) yield return new KeyValuePair("careTeamSequence",_CareTeamSequenceElement); + if (_DiagnosisSequenceElement?.Any() == true) yield return new KeyValuePair("diagnosisSequence",_DiagnosisSequenceElement); + if (_ProcedureSequenceElement?.Any() == true) yield return new KeyValuePair("procedureSequence",_ProcedureSequenceElement); + if (_InformationSequenceElement?.Any() == true) yield return new KeyValuePair("informationSequence",_InformationSequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -2561,11 +2494,11 @@ public partial class ItemBodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Sub-location. @@ -2576,24 +2509,20 @@ public List Site [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemBodySiteComponent; - - if (dest == null) - { + if(other is not ItemBodySiteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2605,41 +2534,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemBodySiteComponent; - if(otherT == null) return false; + if(other is not ItemBodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - Site = (List)value; + Site = (List?)value!; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2650,8 +2579,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); } } @@ -2678,13 +2607,13 @@ public partial class ReviewOutcomeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("decision", Order=40)] [Binding("AdjudicationDecision")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Decision + public Hl7.Fhir.Model.CodeableConcept? Decision { get { return _Decision; } set { _Decision = value; OnPropertyChanged("Decision"); } } - private Hl7.Fhir.Model.CodeableConcept _Decision; + private Hl7.Fhir.Model.CodeableConcept? _Decision; /// /// Reason for result of the adjudication. @@ -2695,39 +2624,36 @@ public Hl7.Fhir.Model.CodeableConcept Decision [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Preauthorization reference. /// [FhirElement("preAuthRef", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString PreAuthRefElement + public Hl7.Fhir.Model.FhirString? PreAuthRefElement { get { return _PreAuthRefElement; } set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private Hl7.Fhir.Model.FhirString _PreAuthRefElement; + private Hl7.Fhir.Model.FhirString? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreAuthRef + public string? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Value : null; } + get => _PreAuthRefElement?.Value; set { - if (value == null) - PreAuthRefElement = null; - else - PreAuthRefElement = new Hl7.Fhir.Model.FhirString(value); + PreAuthRefElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreAuthRef"); } } @@ -2737,28 +2663,24 @@ public string PreAuthRef /// [FhirElement("preAuthPeriod", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period PreAuthPeriod + public Hl7.Fhir.Model.Period? PreAuthPeriod { get { return _PreAuthPeriod; } set { _PreAuthPeriod = value; OnPropertyChanged("PreAuthPeriod"); } } - private Hl7.Fhir.Model.Period _PreAuthPeriod; + private Hl7.Fhir.Model.Period? _PreAuthPeriod; protected internal override void CopyToInternal(Base other) { - var dest = other as ReviewOutcomeComponent; - - if (dest == null) - { + if(other is not ReviewOutcomeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Decision != null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)Decision.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(PreAuthRefElement != null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)PreAuthRefElement.DeepCopyInternal(); - if(PreAuthPeriod != null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)PreAuthPeriod.DeepCopyInternal(); + if(_Decision is not null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)_Decision.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = (Hl7.Fhir.Model.FhirString)_PreAuthRefElement.DeepCopyInternal(); + if(_PreAuthPeriod is not null) dest.PreAuthPeriod = (Hl7.Fhir.Model.Period)_PreAuthPeriod.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2770,55 +2692,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReviewOutcomeComponent; - if(otherT == null) return false; + if(other is not ReviewOutcomeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Decision, otherT.Decision)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.Equals(PreAuthPeriod, otherT.PreAuthPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Decision, otherT._Decision)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.Equals(_PreAuthPeriod, otherT._PreAuthPeriod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "decision": - value = Decision; - return Decision is not null; + value = _Decision; + return _Decision is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement is not null; + value = _PreAuthRefElement; + return _PreAuthRefElement is not null; case "preAuthPeriod": - value = PreAuthPeriod; - return PreAuthPeriod is not null; + value = _PreAuthPeriod; + return _PreAuthPeriod is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "decision": - Decision = (Hl7.Fhir.Model.CodeableConcept)value; + Decision = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "preAuthRef": - PreAuthRefElement = (Hl7.Fhir.Model.FhirString)value; + PreAuthRefElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthPeriod": - PreAuthPeriod = (Hl7.Fhir.Model.Period)value; + PreAuthPeriod = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -2829,10 +2751,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Decision is not null) yield return new KeyValuePair("decision",Decision); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",PreAuthPeriod); + if (_Decision is not null) yield return new KeyValuePair("decision",_Decision); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_PreAuthRefElement is not null) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthPeriod is not null) yield return new KeyValuePair("preAuthPeriod",_PreAuthPeriod); } } @@ -2860,13 +2782,13 @@ public partial class AdjudicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Explanation of adjudication outcome. @@ -2874,54 +2796,50 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("reason", Order=50)] [Binding("AdjudicationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// Monetary amount. /// [FhirElement("amount", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Non-monitary value. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as AdjudicationComponent; - - if (dest == null) - { + if(other is not AdjudicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2933,55 +2851,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdjudicationComponent; - if(otherT == null) return false; + if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -2992,10 +2910,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -3022,13 +2940,13 @@ public partial class DetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Product or service provided @@ -3037,13 +2955,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -3056,11 +2971,11 @@ public int? Sequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -3068,13 +2983,13 @@ public List TraceNumber [FhirElement("revenue", Order=60)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -3082,13 +2997,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=70)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -3096,13 +3011,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=80)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -3110,13 +3025,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=90)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -3127,11 +3042,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -3142,63 +3057,63 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3207,13 +3122,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3223,26 +3135,26 @@ public decimal? Factor /// [FhirElement("tax", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -3254,11 +3166,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Applicable note numbers. @@ -3268,24 +3180,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3297,13 +3209,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=200)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? _ReviewOutcome; /// /// Detail level adjudication details. @@ -3313,11 +3225,11 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Additional items. @@ -3327,41 +3239,37 @@ public List Adjudicat [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as DetailComponent; - - if (dest == null) - { + if(other is not DetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3373,160 +3281,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DetailComponent; - if(otherT == null) return false; + if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3537,25 +3445,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -3582,13 +3490,13 @@ public partial class SubDetailComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("sequence", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Product or service provided @@ -3597,13 +3505,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -3616,11 +3521,11 @@ public int? Sequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -3628,13 +3533,13 @@ public List TraceNumber [FhirElement("revenue", Order=60)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Benefit classification. @@ -3642,13 +3547,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("category", Order=70)] [Binding("BenefitCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Billing, service, product, or drug code. @@ -3656,13 +3561,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("productOrService", Order=80)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -3670,13 +3575,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=90)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -3687,11 +3592,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -3702,63 +3607,63 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=120)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=130)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -3767,13 +3672,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -3783,26 +3685,26 @@ public decimal? Factor /// [FhirElement("tax", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Unique device identifier. @@ -3814,11 +3716,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List Udi { - get { if(_Udi==null) _Udi = new List(); return _Udi; } + get => _Udi ?? new List(); set { _Udi = value; OnPropertyChanged("Udi"); } } - private List _Udi; + private List? _Udi; /// /// Applicable note numbers. @@ -3828,24 +3730,24 @@ public List Udi [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -3857,13 +3759,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=200)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? _ReviewOutcome; /// /// Subdetail level adjudication details. @@ -3873,40 +3775,36 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as SubDetailComponent; - - if (dest == null) - { + if(other is not SubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(Udi.Any()) dest.Udi = new List(Udi.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_Udi is not null) dest.Udi = new List(_Udi.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3918,153 +3816,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubDetailComponent; - if(otherT == null) return false; + if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(Udi, otherT.Udi)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "udi": - value = Udi; - return Udi?.Any() == true; + value = _Udi; + return _Udi?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "udi": - Udi = (List)value; + Udi = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4075,24 +3973,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (Udi?.Any() == true) yield return new KeyValuePair("udi",Udi); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_Udi?.Any() == true) yield return new KeyValuePair("udi",_Udi); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -4121,24 +4019,24 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get { if(_ItemSequenceElement==null) _ItemSequenceElement = new List(); return _ItemSequenceElement; } + get => _ItemSequenceElement ?? new List(); set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } - private List _ItemSequenceElement; + private List? _ItemSequenceElement; /// /// Item sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ItemSequence + public IEnumerable? ItemSequence { - get { return ItemSequenceElement != null ? ItemSequenceElement.Select(elem => elem.Value) : null; } + get => _ItemSequenceElement?.Select(elem => elem.Value); set { if (value == null) - ItemSequenceElement = null; + ItemSequenceElement = null!; else ItemSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("ItemSequence"); @@ -4153,24 +4051,24 @@ public IEnumerable ItemSequence [DataMember] public List DetailSequenceElement { - get { if(_DetailSequenceElement==null) _DetailSequenceElement = new List(); return _DetailSequenceElement; } + get => _DetailSequenceElement ?? new List(); set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } - private List _DetailSequenceElement; + private List? _DetailSequenceElement; /// /// Detail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DetailSequence + public IEnumerable? DetailSequence { - get { return DetailSequenceElement != null ? DetailSequenceElement.Select(elem => elem.Value) : null; } + get => _DetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - DetailSequenceElement = null; + DetailSequenceElement = null!; else DetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("DetailSequence"); @@ -4185,24 +4083,24 @@ public IEnumerable DetailSequence [DataMember] public List SubDetailSequenceElement { - get { if(_SubDetailSequenceElement==null) _SubDetailSequenceElement = new List(); return _SubDetailSequenceElement; } + get => _SubDetailSequenceElement ?? new List(); set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } - private List _SubDetailSequenceElement; + private List? _SubDetailSequenceElement; /// /// Subdetail sequence number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubDetailSequence + public IEnumerable? SubDetailSequence { - get { return SubDetailSequenceElement != null ? SubDetailSequenceElement.Select(elem => elem.Value) : null; } + get => _SubDetailSequenceElement?.Select(elem => elem.Value); set { if (value == null) - SubDetailSequenceElement = null; + SubDetailSequenceElement = null!; else SubDetailSequenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("SubDetailSequence"); @@ -4217,11 +4115,11 @@ public IEnumerable SubDetailSequence [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Authorized providers. @@ -4233,11 +4131,11 @@ public List TraceNumber [DataMember] public List Provider { - get { if(_Provider==null) _Provider = new List(); return _Provider; } + get => _Provider ?? new List(); set { _Provider = value; OnPropertyChanged("Provider"); } } - private List _Provider; + private List? _Provider; /// /// Revenue or cost center code. @@ -4245,13 +4143,13 @@ public List Provider [FhirElement("revenue", Order=90)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Billing, service, product, or drug code. @@ -4259,13 +4157,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("productOrService", Order=100)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -4273,13 +4171,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=110)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Request or Referral for Service. @@ -4291,11 +4189,11 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// Service/Product billing modifiers. @@ -4306,11 +4204,11 @@ public List Request [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Program the product or service is provided under. @@ -4321,11 +4219,11 @@ public List Modifier [DataMember] public List ProgramCode { - get { if(_ProgramCode==null) _ProgramCode = new List(); return _ProgramCode; } + get => _ProgramCode ?? new List(); set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } - private List _ProgramCode; + private List? _ProgramCode; /// /// Date or dates of service or product delivery. @@ -4334,13 +4232,13 @@ public List ProgramCode [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Place of service or where product was supplied. @@ -4351,65 +4249,65 @@ public Hl7.Fhir.Model.DataType Serviced [References("Location")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Location + public Hl7.Fhir.Model.DataType? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.DataType _Location; + private Hl7.Fhir.Model.DataType? _Location; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=170)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=180)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=190)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -4418,13 +4316,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -4434,26 +4329,26 @@ public decimal? Factor /// [FhirElement("tax", Order=210)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=220)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Anatomical location. @@ -4463,11 +4358,11 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// Applicable note numbers. @@ -4477,24 +4372,24 @@ public List Body [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -4506,13 +4401,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=250)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? _ReviewOutcome; /// /// Added items adjudication. @@ -4522,11 +4417,11 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -4536,46 +4431,42 @@ public List Adjudicat [DataMember] public List Detail { - get { if(_Detail==null) _Detail = new List(); return _Detail; } + get => _Detail ?? new List(); set { _Detail = value; OnPropertyChanged("Detail"); } } - private List _Detail; + private List? _Detail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemComponent; - - if (dest == null) - { + if(other is not AddedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ItemSequenceElement.Any()) dest.ItemSequenceElement = new List(ItemSequenceElement.DeepCopyInternal()); - if(DetailSequenceElement.Any()) dest.DetailSequenceElement = new List(DetailSequenceElement.DeepCopyInternal()); - if(SubDetailSequenceElement.Any()) dest.SubDetailSequenceElement = new List(SubDetailSequenceElement.DeepCopyInternal()); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Provider.Any()) dest.Provider = new List(Provider.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(ProgramCode.Any()) dest.ProgramCode = new List(ProgramCode.DeepCopyInternal()); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.DataType)Location.DeepCopyInternal(); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Detail.Any()) dest.Detail = new List(Detail.DeepCopyInternal()); + if(_ItemSequenceElement is not null) dest.ItemSequenceElement = new List(_ItemSequenceElement.DeepCopyInternal()); + if(_DetailSequenceElement is not null) dest.DetailSequenceElement = new List(_DetailSequenceElement.DeepCopyInternal()); + if(_SubDetailSequenceElement is not null) dest.SubDetailSequenceElement = new List(_SubDetailSequenceElement.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Provider is not null) dest.Provider = new List(_Provider.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_ProgramCode is not null) dest.ProgramCode = new List(_ProgramCode.DeepCopyInternal()); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.DataType)_Location.DeepCopyInternal(); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Detail is not null) dest.Detail = new List(_Detail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4587,195 +4478,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemComponent; - if(otherT == null) return false; + if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ItemSequenceElement, otherT.ItemSequenceElement)) return false; - if(!comparer.ListEquals(DetailSequenceElement, otherT.DetailSequenceElement)) return false; - if(!comparer.ListEquals(SubDetailSequenceElement, otherT.SubDetailSequenceElement)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.ListEquals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.ListEquals(ProgramCode, otherT.ProgramCode)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Detail, otherT.Detail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + if(!comparer.ListEquals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.ListEquals(_ProgramCode, otherT._ProgramCode)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "itemSequence": - value = ItemSequenceElement; - return ItemSequenceElement?.Any() == true; + value = _ItemSequenceElement; + return _ItemSequenceElement?.Any() == true; case "detailSequence": - value = DetailSequenceElement; - return DetailSequenceElement?.Any() == true; + value = _DetailSequenceElement; + return _DetailSequenceElement?.Any() == true; case "subDetailSequence": - value = SubDetailSequenceElement; - return SubDetailSequenceElement?.Any() == true; + value = _SubDetailSequenceElement; + return _SubDetailSequenceElement?.Any() == true; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "provider": - value = Provider; - return Provider?.Any() == true; + value = _Provider; + return _Provider?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "programCode": - value = ProgramCode; - return ProgramCode?.Any() == true; + value = _ProgramCode; + return _ProgramCode?.Any() == true; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "detail": - value = Detail; - return Detail?.Any() == true; + value = _Detail; + return _Detail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "itemSequence": - ItemSequenceElement = (List)value; + ItemSequenceElement = (List?)value!; return this; case "detailSequence": - DetailSequenceElement = (List)value; + DetailSequenceElement = (List?)value!; return this; case "subDetailSequence": - SubDetailSequenceElement = (List)value; + SubDetailSequenceElement = (List?)value!; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "provider": - Provider = (List)value; + Provider = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "programCode": - ProgramCode = (List)value; + ProgramCode = (List?)value!; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.DataType)value; + Location = (Hl7.Fhir.Model.DataType?)value; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "detail": - Detail = (List)value; + Detail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4786,30 +4677,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",ItemSequenceElement); - if (DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",DetailSequenceElement); - if (SubDetailSequenceElement?.Any() == true) yield return new KeyValuePair("subDetailSequence",SubDetailSequenceElement); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Provider?.Any() == true) yield return new KeyValuePair("provider",Provider); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",ProgramCode); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Detail?.Any() == true) yield return new KeyValuePair("detail",Detail); + if (_ItemSequenceElement?.Any() == true) yield return new KeyValuePair("itemSequence",_ItemSequenceElement); + if (_DetailSequenceElement?.Any() == true) yield return new KeyValuePair("detailSequence",_DetailSequenceElement); + if (_SubDetailSequenceElement?.Any() == true) yield return new KeyValuePair("subDetailSequence",_SubDetailSequenceElement); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Provider?.Any() == true) yield return new KeyValuePair("provider",_Provider); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_ProgramCode?.Any() == true) yield return new KeyValuePair("programCode",_ProgramCode); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Detail?.Any() == true) yield return new KeyValuePair("detail",_Detail); } } @@ -4839,11 +4730,11 @@ public partial class AddedItemBodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Sub-location. @@ -4854,24 +4745,20 @@ public List Site [DataMember] public List SubSite { - get { if(_SubSite==null) _SubSite = new List(); return _SubSite; } + get => _SubSite ?? new List(); set { _SubSite = value; OnPropertyChanged("SubSite"); } } - private List _SubSite; + private List? _SubSite; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemBodySiteComponent; - - if (dest == null) - { + if(other is not AddedItemBodySiteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(SubSite.Any()) dest.SubSite = new List(SubSite.DeepCopyInternal()); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_SubSite is not null) dest.SubSite = new List(_SubSite.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4883,41 +4770,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemBodySiteComponent; - if(otherT == null) return false; + if(other is not AddedItemBodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.ListEquals(SubSite, otherT.SubSite)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "subSite": - value = SubSite; - return SubSite?.Any() == true; + value = _SubSite; + return _SubSite?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "site": - Site = (List)value; + Site = (List?)value!; return this; case "subSite": - SubSite = (List)value; + SubSite = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4928,8 +4815,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (SubSite?.Any() == true) yield return new KeyValuePair("subSite",SubSite); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_SubSite?.Any() == true) yield return new KeyValuePair("subSite",_SubSite); } } @@ -4958,11 +4845,11 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -4970,13 +4857,13 @@ public List TraceNumber [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Billing, service, product, or drug code. @@ -4984,13 +4871,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("productOrService", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -4998,13 +4885,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -5015,63 +4902,63 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -5080,13 +4967,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -5096,26 +4980,26 @@ public decimal? Factor /// [FhirElement("tax", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -5125,24 +5009,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -5154,13 +5038,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=160)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? _ReviewOutcome; /// /// Added items adjudication. @@ -5170,11 +5054,11 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Insurer added line items. @@ -5184,37 +5068,33 @@ public List Adjudicat [DataMember] public List SubDetail { - get { if(_SubDetail==null) _SubDetail = new List(); return _SubDetail; } + get => _SubDetail ?? new List(); set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } - private List _SubDetail; + private List? _SubDetail; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(SubDetail.Any()) dest.SubDetail = new List(SubDetail.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_SubDetail is not null) dest.SubDetail = new List(_SubDetail.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5226,132 +5106,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(SubDetail, otherT.SubDetail)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "subDetail": - value = SubDetail; - return SubDetail?.Any() == true; + value = _SubDetail; + return _SubDetail?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "subDetail": - SubDetail = (List)value; + SubDetail = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5362,21 +5242,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",SubDetail); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_SubDetail?.Any() == true) yield return new KeyValuePair("subDetail",_SubDetail); } } @@ -5405,11 +5285,11 @@ public partial class AddedItemDetailSubDetailComponent : Hl7.Fhir.Model.Backbone [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// Revenue or cost center code. @@ -5417,13 +5297,13 @@ public List TraceNumber [FhirElement("revenue", Order=50)] [Binding("RevenueCenter")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Revenue + public Hl7.Fhir.Model.CodeableConcept? Revenue { get { return _Revenue; } set { _Revenue = value; OnPropertyChanged("Revenue"); } } - private Hl7.Fhir.Model.CodeableConcept _Revenue; + private Hl7.Fhir.Model.CodeableConcept? _Revenue; /// /// Billing, service, product, or drug code. @@ -5431,13 +5311,13 @@ public Hl7.Fhir.Model.CodeableConcept Revenue [FhirElement("productOrService", Order=60)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrService + public Hl7.Fhir.Model.CodeableConcept? ProductOrService { get { return _ProductOrService; } set { _ProductOrService = value; OnPropertyChanged("ProductOrService"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrService; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrService; /// /// End of a range of codes. @@ -5445,13 +5325,13 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrService [FhirElement("productOrServiceEnd", Order=70)] [Binding("ServiceProduct")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd + public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd { get { return _ProductOrServiceEnd; } set { _ProductOrServiceEnd = value; OnPropertyChanged("ProductOrServiceEnd"); } } - private Hl7.Fhir.Model.CodeableConcept _ProductOrServiceEnd; + private Hl7.Fhir.Model.CodeableConcept? _ProductOrServiceEnd; /// /// Service/Product billing modifiers. @@ -5462,63 +5342,63 @@ public Hl7.Fhir.Model.CodeableConcept ProductOrServiceEnd [DataMember] public List Modifier { - get { if(_Modifier==null) _Modifier = new List(); return _Modifier; } + get => _Modifier ?? new List(); set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private List _Modifier; + private List? _Modifier; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=90)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Count of products or services. /// [FhirElement("quantity", Order=100)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Fee, charge or cost per item. /// [FhirElement("unitPrice", Order=110)] [DataMember] - public Hl7.Fhir.Model.Money UnitPrice + public Hl7.Fhir.Model.Money? UnitPrice { get { return _UnitPrice; } set { _UnitPrice = value; OnPropertyChanged("UnitPrice"); } } - private Hl7.Fhir.Model.Money _UnitPrice; + private Hl7.Fhir.Model.Money? _UnitPrice; /// /// Price scaling factor. /// [FhirElement("factor", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Price scaling factor @@ -5527,13 +5407,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -5543,26 +5420,26 @@ public decimal? Factor /// [FhirElement("tax", Order=130)] [DataMember] - public Hl7.Fhir.Model.Money Tax + public Hl7.Fhir.Model.Money? Tax { get { return _Tax; } set { _Tax = value; OnPropertyChanged("Tax"); } } - private Hl7.Fhir.Model.Money _Tax; + private Hl7.Fhir.Model.Money? _Tax; /// /// Total item cost. /// [FhirElement("net", Order=140)] [DataMember] - public Hl7.Fhir.Model.Money Net + public Hl7.Fhir.Model.Money? Net { get { return _Net; } set { _Net = value; OnPropertyChanged("Net"); } } - private Hl7.Fhir.Model.Money _Net; + private Hl7.Fhir.Model.Money? _Net; /// /// Applicable note numbers. @@ -5572,24 +5449,24 @@ public Hl7.Fhir.Model.Money Net [DataMember] public List NoteNumberElement { - get { if(_NoteNumberElement==null) _NoteNumberElement = new List(); return _NoteNumberElement; } + get => _NoteNumberElement ?? new List(); set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } - private List _NoteNumberElement; + private List? _NoteNumberElement; /// /// Applicable note numbers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable NoteNumber + public IEnumerable? NoteNumber { - get { return NoteNumberElement != null ? NoteNumberElement.Select(elem => elem.Value) : null; } + get => _NoteNumberElement?.Select(elem => elem.Value); set { if (value == null) - NoteNumberElement = null; + NoteNumberElement = null!; else NoteNumberElement = new List(value.Select(elem=>new Hl7.Fhir.Model.PositiveInt(elem))); OnPropertyChanged("NoteNumber"); @@ -5601,13 +5478,13 @@ public IEnumerable NoteNumber /// [FhirElement("reviewOutcome", Order=160)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome + public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome { get { return _ReviewOutcome; } set { _ReviewOutcome = value; OnPropertyChanged("ReviewOutcome"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent _ReviewOutcome; + private Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? _ReviewOutcome; /// /// Added items adjudication. @@ -5617,36 +5494,32 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent ReviewOutcome [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; protected internal override void CopyToInternal(Base other) { - var dest = other as AddedItemDetailSubDetailComponent; - - if (dest == null) - { + if(other is not AddedItemDetailSubDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(Revenue != null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)Revenue.DeepCopyInternal(); - if(ProductOrService != null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)ProductOrService.DeepCopyInternal(); - if(ProductOrServiceEnd != null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)ProductOrServiceEnd.DeepCopyInternal(); - if(Modifier.Any()) dest.Modifier = new List(Modifier.DeepCopyInternal()); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(UnitPrice != null) dest.UnitPrice = (Hl7.Fhir.Model.Money)UnitPrice.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Tax != null) dest.Tax = (Hl7.Fhir.Model.Money)Tax.DeepCopyInternal(); - if(Net != null) dest.Net = (Hl7.Fhir.Model.Money)Net.DeepCopyInternal(); - if(NoteNumberElement.Any()) dest.NoteNumberElement = new List(NoteNumberElement.DeepCopyInternal()); - if(ReviewOutcome != null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)ReviewOutcome.DeepCopyInternal(); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_Revenue is not null) dest.Revenue = (Hl7.Fhir.Model.CodeableConcept)_Revenue.DeepCopyInternal(); + if(_ProductOrService is not null) dest.ProductOrService = (Hl7.Fhir.Model.CodeableConcept)_ProductOrService.DeepCopyInternal(); + if(_ProductOrServiceEnd is not null) dest.ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)_ProductOrServiceEnd.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = new List(_Modifier.DeepCopyInternal()); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_UnitPrice is not null) dest.UnitPrice = (Hl7.Fhir.Model.Money)_UnitPrice.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Tax is not null) dest.Tax = (Hl7.Fhir.Model.Money)_Tax.DeepCopyInternal(); + if(_Net is not null) dest.Net = (Hl7.Fhir.Model.Money)_Net.DeepCopyInternal(); + if(_NoteNumberElement is not null) dest.NoteNumberElement = new List(_NoteNumberElement.DeepCopyInternal()); + if(_ReviewOutcome is not null) dest.ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)_ReviewOutcome.DeepCopyInternal(); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -5658,125 +5531,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AddedItemDetailSubDetailComponent; - if(otherT == null) return false; + if(other is not AddedItemDetailSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(Revenue, otherT.Revenue)) return false; - if(!comparer.Equals(ProductOrService, otherT.ProductOrService)) return false; - if(!comparer.Equals(ProductOrServiceEnd, otherT.ProductOrServiceEnd)) return false; - if(!comparer.ListEquals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(UnitPrice, otherT.UnitPrice)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Tax, otherT.Tax)) return false; - if(!comparer.Equals(Net, otherT.Net)) return false; - if(!comparer.ListEquals(NoteNumberElement, otherT.NoteNumberElement)) return false; - if(!comparer.Equals(ReviewOutcome, otherT.ReviewOutcome)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; + if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Tax, otherT._Tax)) return false; + if(!comparer.Equals(_Net, otherT._Net)) return false; + if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; + if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "revenue": - value = Revenue; - return Revenue is not null; + value = _Revenue; + return _Revenue is not null; case "productOrService": - value = ProductOrService; - return ProductOrService is not null; + value = _ProductOrService; + return _ProductOrService is not null; case "productOrServiceEnd": - value = ProductOrServiceEnd; - return ProductOrServiceEnd is not null; + value = _ProductOrServiceEnd; + return _ProductOrServiceEnd is not null; case "modifier": - value = Modifier; - return Modifier?.Any() == true; + value = _Modifier; + return _Modifier?.Any() == true; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "unitPrice": - value = UnitPrice; - return UnitPrice is not null; + value = _UnitPrice; + return _UnitPrice is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "tax": - value = Tax; - return Tax is not null; + value = _Tax; + return _Tax is not null; case "net": - value = Net; - return Net is not null; + value = _Net; + return _Net is not null; case "noteNumber": - value = NoteNumberElement; - return NoteNumberElement?.Any() == true; + value = _NoteNumberElement; + return _NoteNumberElement?.Any() == true; case "reviewOutcome": - value = ReviewOutcome; - return ReviewOutcome is not null; + value = _ReviewOutcome; + return _ReviewOutcome is not null; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "revenue": - Revenue = (Hl7.Fhir.Model.CodeableConcept)value; + Revenue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrService": - ProductOrService = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrService = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "productOrServiceEnd": - ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept)value; + ProductOrServiceEnd = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "modifier": - Modifier = (List)value; + Modifier = (List?)value!; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "unitPrice": - UnitPrice = (Hl7.Fhir.Model.Money)value; + UnitPrice = (Hl7.Fhir.Model.Money?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tax": - Tax = (Hl7.Fhir.Model.Money)value; + Tax = (Hl7.Fhir.Model.Money?)value; return this; case "net": - Net = (Hl7.Fhir.Model.Money)value; + Net = (Hl7.Fhir.Model.Money?)value; return this; case "noteNumber": - NoteNumberElement = (List)value; + NoteNumberElement = (List?)value!; return this; case "reviewOutcome": - ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent)value; + ReviewOutcome = (Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent?)value; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -5787,20 +5660,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (Revenue is not null) yield return new KeyValuePair("revenue",Revenue); - if (ProductOrService is not null) yield return new KeyValuePair("productOrService",ProductOrService); - if (ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",ProductOrServiceEnd); - if (Modifier?.Any() == true) yield return new KeyValuePair("modifier",Modifier); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (UnitPrice is not null) yield return new KeyValuePair("unitPrice",UnitPrice); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Tax is not null) yield return new KeyValuePair("tax",Tax); - if (Net is not null) yield return new KeyValuePair("net",Net); - if (NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",NoteNumberElement); - if (ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",ReviewOutcome); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_Revenue is not null) yield return new KeyValuePair("revenue",_Revenue); + if (_ProductOrService is not null) yield return new KeyValuePair("productOrService",_ProductOrService); + if (_ProductOrServiceEnd is not null) yield return new KeyValuePair("productOrServiceEnd",_ProductOrServiceEnd); + if (_Modifier?.Any() == true) yield return new KeyValuePair("modifier",_Modifier); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_UnitPrice is not null) yield return new KeyValuePair("unitPrice",_UnitPrice); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Tax is not null) yield return new KeyValuePair("tax",_Tax); + if (_Net is not null) yield return new KeyValuePair("net",_Net); + if (_NoteNumberElement?.Any() == true) yield return new KeyValuePair("noteNumber",_NoteNumberElement); + if (_ReviewOutcome is not null) yield return new KeyValuePair("reviewOutcome",_ReviewOutcome); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); } } @@ -5829,13 +5702,13 @@ public partial class TotalComponent : Hl7.Fhir.Model.BackboneElement [Binding("Adjudication")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Financial total for the category. @@ -5843,26 +5716,22 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("amount", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as TotalComponent; - - if (dest == null) - { + if(other is not TotalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5874,41 +5743,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TotalComponent; - if(otherT == null) return false; + if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -5919,8 +5788,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -5947,26 +5816,26 @@ public partial class PaymentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("PaymentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Payment adjustment for non-claim issues. /// [FhirElement("adjustment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Money Adjustment + public Hl7.Fhir.Model.Money? Adjustment { get { return _Adjustment; } set { _Adjustment = value; OnPropertyChanged("Adjustment"); } } - private Hl7.Fhir.Model.Money _Adjustment; + private Hl7.Fhir.Model.Money? _Adjustment; /// /// Explanation for the variance. @@ -5974,41 +5843,38 @@ public Hl7.Fhir.Model.Money Adjustment [FhirElement("adjustmentReason", Order=60)] [Binding("PaymentAdjustmentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdjustmentReason + public Hl7.Fhir.Model.CodeableConcept? AdjustmentReason { get { return _AdjustmentReason; } set { _AdjustmentReason = value; OnPropertyChanged("AdjustmentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _AdjustmentReason; + private Hl7.Fhir.Model.CodeableConcept? _AdjustmentReason; /// /// Expected date of payment. /// [FhirElement("date", Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Expected date of payment /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -6018,43 +5884,39 @@ public string Date /// [FhirElement("amount", Order=80)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Business identifier for the payment. /// [FhirElement("identifier", Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentComponent; - - if (dest == null) - { + if(other is not PaymentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Adjustment != null) dest.Adjustment = (Hl7.Fhir.Model.Money)Adjustment.DeepCopyInternal(); - if(AdjustmentReason != null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)AdjustmentReason.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Adjustment is not null) dest.Adjustment = (Hl7.Fhir.Model.Money)_Adjustment.DeepCopyInternal(); + if(_AdjustmentReason is not null) dest.AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)_AdjustmentReason.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -6066,69 +5928,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentComponent; - if(otherT == null) return false; + if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Adjustment, otherT.Adjustment)) return false; - if(!comparer.Equals(AdjustmentReason, otherT.AdjustmentReason)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; + if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "adjustment": - value = Adjustment; - return Adjustment is not null; + value = _Adjustment; + return _Adjustment is not null; case "adjustmentReason": - value = AdjustmentReason; - return AdjustmentReason is not null; + value = _AdjustmentReason; + return _AdjustmentReason is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "adjustment": - Adjustment = (Hl7.Fhir.Model.Money)value; + Adjustment = (Hl7.Fhir.Model.Money?)value; return this; case "adjustmentReason": - AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept)value; + AdjustmentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -6139,12 +6001,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Adjustment is not null) yield return new KeyValuePair("adjustment",Adjustment); - if (AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",AdjustmentReason); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Adjustment is not null) yield return new KeyValuePair("adjustment",_Adjustment); + if (_AdjustmentReason is not null) yield return new KeyValuePair("adjustmentReason",_AdjustmentReason); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); } } @@ -6170,13 +6032,13 @@ public partial class NoteComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("number", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt NumberElement + public Hl7.Fhir.Model.PositiveInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.PositiveInt _NumberElement; + private Hl7.Fhir.Model.PositiveInt? _NumberElement; /// /// Note instance identifier @@ -6185,13 +6047,10 @@ public Hl7.Fhir.Model.PositiveInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.PositiveInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Number"); } } @@ -6202,41 +6061,38 @@ public int? Number [FhirElement("type", Order=50)] [Binding("NoteType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Note explanatory text. /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -6247,28 +6103,24 @@ public string Text [FhirElement("language", Order=70)] [Binding("Language")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as NoteComponent; - - if (dest == null) - { + if(other is not NoteComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)NumberElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.PositiveInt)_NumberElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -6280,55 +6132,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NoteComponent; - if(otherT == null) return false; + if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "number": - NumberElement = (Hl7.Fhir.Model.PositiveInt)value; + NumberElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -6339,10 +6191,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -6367,26 +6219,26 @@ public partial class BenefitBalanceComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitCategory")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Excluded from the plan. /// [FhirElement("excluded", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludedElement + public Hl7.Fhir.Model.FhirBoolean? ExcludedElement { get { return _ExcludedElement; } set { _ExcludedElement = value; OnPropertyChanged("ExcludedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludedElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludedElement; /// /// Excluded from the plan @@ -6395,13 +6247,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludedElement [IgnoreDataMember] public bool? Excluded { - get { return ExcludedElement != null ? ExcludedElement.Value : null; } + get => _ExcludedElement?.Value; set { - if (value == null) - ExcludedElement = null; - else - ExcludedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Excluded"); } } @@ -6411,28 +6260,25 @@ public bool? Excluded /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Short name for the benefit /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -6442,28 +6288,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Description of the benefit or services covered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -6474,13 +6317,13 @@ public string Description [FhirElement("network", Order=80)] [Binding("BenefitNetwork")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Network + public Hl7.Fhir.Model.CodeableConcept? Network { get { return _Network; } set { _Network = value; OnPropertyChanged("Network"); } } - private Hl7.Fhir.Model.CodeableConcept _Network; + private Hl7.Fhir.Model.CodeableConcept? _Network; /// /// Individual or family. @@ -6488,13 +6331,13 @@ public Hl7.Fhir.Model.CodeableConcept Network [FhirElement("unit", Order=90)] [Binding("BenefitUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Unit + public Hl7.Fhir.Model.CodeableConcept? Unit { get { return _Unit; } set { _Unit = value; OnPropertyChanged("Unit"); } } - private Hl7.Fhir.Model.CodeableConcept _Unit; + private Hl7.Fhir.Model.CodeableConcept? _Unit; /// /// Annual or lifetime. @@ -6502,13 +6345,13 @@ public Hl7.Fhir.Model.CodeableConcept Unit [FhirElement("term", Order=100)] [Binding("BenefitTerm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Term + public Hl7.Fhir.Model.CodeableConcept? Term { get { return _Term; } set { _Term = value; OnPropertyChanged("Term"); } } - private Hl7.Fhir.Model.CodeableConcept _Term; + private Hl7.Fhir.Model.CodeableConcept? _Term; /// /// Benefit Summary. @@ -6518,30 +6361,26 @@ public Hl7.Fhir.Model.CodeableConcept Term [DataMember] public List Financial { - get { if(_Financial==null) _Financial = new List(); return _Financial; } + get => _Financial ?? new List(); set { _Financial = value; OnPropertyChanged("Financial"); } } - private List _Financial; + private List? _Financial; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitBalanceComponent; - - if (dest == null) - { + if(other is not BenefitBalanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(ExcludedElement != null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)ExcludedElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Network != null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)Network.DeepCopyInternal(); - if(Unit != null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)Unit.DeepCopyInternal(); - if(Term != null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)Term.DeepCopyInternal(); - if(Financial.Any()) dest.Financial = new List(Financial.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_ExcludedElement is not null) dest.ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludedElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Network is not null) dest.Network = (Hl7.Fhir.Model.CodeableConcept)_Network.DeepCopyInternal(); + if(_Unit is not null) dest.Unit = (Hl7.Fhir.Model.CodeableConcept)_Unit.DeepCopyInternal(); + if(_Term is not null) dest.Term = (Hl7.Fhir.Model.CodeableConcept)_Term.DeepCopyInternal(); + if(_Financial is not null) dest.Financial = new List(_Financial.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -6553,83 +6392,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitBalanceComponent; - if(otherT == null) return false; + if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(ExcludedElement, otherT.ExcludedElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Network, otherT.Network)) return false; - if(!comparer.Equals(Unit, otherT.Unit)) return false; - if(!comparer.Equals(Term, otherT.Term)) return false; - if(!comparer.ListEquals(Financial, otherT.Financial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Network, otherT._Network)) return false; + if(!comparer.Equals(_Unit, otherT._Unit)) return false; + if(!comparer.Equals(_Term, otherT._Term)) return false; + if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "excluded": - value = ExcludedElement; - return ExcludedElement is not null; + value = _ExcludedElement; + return _ExcludedElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "network": - value = Network; - return Network is not null; + value = _Network; + return _Network is not null; case "unit": - value = Unit; - return Unit is not null; + value = _Unit; + return _Unit is not null; case "term": - value = Term; - return Term is not null; + value = _Term; + return _Term is not null; case "financial": - value = Financial; - return Financial?.Any() == true; + value = _Financial; + return _Financial?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "excluded": - ExcludedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "network": - Network = (Hl7.Fhir.Model.CodeableConcept)value; + Network = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unit": - Unit = (Hl7.Fhir.Model.CodeableConcept)value; + Unit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (Hl7.Fhir.Model.CodeableConcept)value; + Term = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "financial": - Financial = (List)value; + Financial = (List?)value!; return this; default: return base.SetValue(key, value); @@ -6640,14 +6479,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (ExcludedElement is not null) yield return new KeyValuePair("excluded",ExcludedElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Network is not null) yield return new KeyValuePair("network",Network); - if (Unit is not null) yield return new KeyValuePair("unit",Unit); - if (Term is not null) yield return new KeyValuePair("term",Term); - if (Financial?.Any() == true) yield return new KeyValuePair("financial",Financial); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_ExcludedElement is not null) yield return new KeyValuePair("excluded",_ExcludedElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Network is not null) yield return new KeyValuePair("network",_Network); + if (_Unit is not null) yield return new KeyValuePair("unit",_Unit); + if (_Term is not null) yield return new KeyValuePair("term",_Term); + if (_Financial?.Any() == true) yield return new KeyValuePair("financial",_Financial); } } @@ -6675,13 +6514,13 @@ public partial class BenefitComponent : Hl7.Fhir.Model.BackboneElement [Binding("BenefitType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Benefits allowed. @@ -6690,13 +6529,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Benefits used. @@ -6705,27 +6544,23 @@ public Hl7.Fhir.Model.DataType Allowed [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.Money))] [DataMember] - public Hl7.Fhir.Model.DataType Used + public Hl7.Fhir.Model.DataType? Used { get { return _Used; } set { _Used = value; OnPropertyChanged("Used"); } } - private Hl7.Fhir.Model.DataType _Used; + private Hl7.Fhir.Model.DataType? _Used; protected internal override void CopyToInternal(Base other) { - var dest = other as BenefitComponent; - - if (dest == null) - { + if(other is not BenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Used != null) dest.Used = (Hl7.Fhir.Model.DataType)Used.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Used is not null) dest.Used = (Hl7.Fhir.Model.DataType)_Used.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -6737,48 +6572,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BenefitComponent; - if(otherT == null) return false; + if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Used, otherT.Used)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Used, otherT._Used)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "used": - value = Used; - return Used is not null; + value = _Used; + return _Used is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "used": - Used = (Hl7.Fhir.Model.DataType)value; + Used = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -6789,9 +6624,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Used is not null) yield return new KeyValuePair("used",Used); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Used is not null) yield return new KeyValuePair("used",_Used); } } @@ -6804,11 +6639,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Number for tracking. @@ -6818,11 +6653,11 @@ public List Identifier [DataMember] public List TraceNumber { - get { if(_TraceNumber==null) _TraceNumber = new List(); return _TraceNumber; } + get => _TraceNumber ?? new List(); set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } - private List _TraceNumber; + private List? _TraceNumber; /// /// active | cancelled | draft | entered-in-error. @@ -6832,13 +6667,13 @@ public List TraceNumber [Binding("ExplanationOfBenefitStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -6847,13 +6682,10 @@ public Code Stat [IgnoreDataMember] public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -6865,13 +6697,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ExplanationOfBenefitStatus? Status [Binding("ClaimType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// More granular claim type. @@ -6879,13 +6711,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subType", Order=130, FiveWs="FiveWs.class")] [Binding("ClaimSubType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubType + public Hl7.Fhir.Model.CodeableConcept? SubType { get { return _SubType; } set { _SubType = value; OnPropertyChanged("SubType"); } } - private Hl7.Fhir.Model.CodeableConcept _SubType; + private Hl7.Fhir.Model.CodeableConcept? _SubType; /// /// claim | preauthorization | predetermination. @@ -6895,13 +6727,13 @@ public Hl7.Fhir.Model.CodeableConcept SubType [Binding("Use")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// claim | preauthorization | predetermination @@ -6910,13 +6742,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimUseCode? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -6929,26 +6758,26 @@ public Hl7.Fhir.Model.ClaimUseCode? Use [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Relevant time frame for the claim. /// [FhirElement("billablePeriod", InSummary=true, Order=160, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period BillablePeriod + public Hl7.Fhir.Model.Period? BillablePeriod { get { return _BillablePeriod; } set { _BillablePeriod = value; OnPropertyChanged("BillablePeriod"); } } - private Hl7.Fhir.Model.Period _BillablePeriod; + private Hl7.Fhir.Model.Period? _BillablePeriod; /// /// Response creation date. @@ -6956,28 +6785,25 @@ public Hl7.Fhir.Model.Period BillablePeriod [FhirElement("created", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -6989,13 +6815,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Party responsible for reimbursement. @@ -7004,13 +6830,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Insurer + public Hl7.Fhir.Model.ResourceReference? Insurer { get { return _Insurer; } set { _Insurer = value; OnPropertyChanged("Insurer"); } } - private Hl7.Fhir.Model.ResourceReference _Insurer; + private Hl7.Fhir.Model.ResourceReference? _Insurer; /// /// Party responsible for the claim. @@ -7019,13 +6845,13 @@ public Hl7.Fhir.Model.ResourceReference Insurer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Provider + public Hl7.Fhir.Model.ResourceReference? Provider { get { return _Provider; } set { _Provider = value; OnPropertyChanged("Provider"); } } - private Hl7.Fhir.Model.ResourceReference _Provider; + private Hl7.Fhir.Model.ResourceReference? _Provider; /// /// Desired processing urgency. @@ -7033,13 +6859,13 @@ public Hl7.Fhir.Model.ResourceReference Provider [FhirElement("priority", Order=210)] [Binding("ProcessPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// For whom to reserve funds. @@ -7047,13 +6873,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("fundsReserveRequested", Order=220)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserveRequested + public Hl7.Fhir.Model.CodeableConcept? FundsReserveRequested { get { return _FundsReserveRequested; } set { _FundsReserveRequested = value; OnPropertyChanged("FundsReserveRequested"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserveRequested; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserveRequested; /// /// Funds reserved status. @@ -7061,13 +6887,13 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserveRequested [FhirElement("fundsReserve", Order=230)] [Binding("FundsReserve")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundsReserve + public Hl7.Fhir.Model.CodeableConcept? FundsReserve { get { return _FundsReserve; } set { _FundsReserve = value; OnPropertyChanged("FundsReserve"); } } - private Hl7.Fhir.Model.CodeableConcept _FundsReserve; + private Hl7.Fhir.Model.CodeableConcept? _FundsReserve; /// /// Prior or corollary claims. @@ -7077,11 +6903,11 @@ public Hl7.Fhir.Model.CodeableConcept FundsReserve [DataMember] public List Related { - get { if(_Related==null) _Related = new List(); return _Related; } + get => _Related ?? new List(); set { _Related = value; OnPropertyChanged("Related"); } } - private List _Related; + private List? _Related; /// /// Prescription authorizing services or products. @@ -7090,13 +6916,13 @@ public List Related [CLSCompliant(false)] [References("MedicationRequest","VisionPrescription")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescription + public Hl7.Fhir.Model.ResourceReference? Prescription { get { return _Prescription; } set { _Prescription = value; OnPropertyChanged("Prescription"); } } - private Hl7.Fhir.Model.ResourceReference _Prescription; + private Hl7.Fhir.Model.ResourceReference? _Prescription; /// /// Original prescription if superceded by fulfiller. @@ -7105,13 +6931,13 @@ public Hl7.Fhir.Model.ResourceReference Prescription [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OriginalPrescription + public Hl7.Fhir.Model.ResourceReference? OriginalPrescription { get { return _OriginalPrescription; } set { _OriginalPrescription = value; OnPropertyChanged("OriginalPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _OriginalPrescription; + private Hl7.Fhir.Model.ResourceReference? _OriginalPrescription; /// /// Event information. @@ -7121,24 +6947,24 @@ public Hl7.Fhir.Model.ResourceReference OriginalPrescription [DataMember] public List Event { - get { if(_Event==null) _Event = new List(); return _Event; } + get => _Event ?? new List(); set { _Event = value; OnPropertyChanged("Event"); } } - private List _Event; + private List? _Event; /// /// Recipient of benefits payable. /// [FhirElement("payee", Order=280)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee + public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent _Payee; + private Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? _Payee; /// /// Treatment Referral. @@ -7147,13 +6973,13 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent Payee [CLSCompliant(false)] [References("ServiceRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referral + public Hl7.Fhir.Model.ResourceReference? Referral { get { return _Referral; } set { _Referral = value; OnPropertyChanged("Referral"); } } - private Hl7.Fhir.Model.ResourceReference _Referral; + private Hl7.Fhir.Model.ResourceReference? _Referral; /// /// Encounters associated with the listed treatments. @@ -7165,11 +6991,11 @@ public Hl7.Fhir.Model.ResourceReference Referral [DataMember] public List Encounter { - get { if(_Encounter==null) _Encounter = new List(); return _Encounter; } + get => _Encounter ?? new List(); set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private List _Encounter; + private List? _Encounter; /// /// Servicing Facility. @@ -7178,13 +7004,13 @@ public List Encounter [CLSCompliant(false)] [References("Location","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Facility + public Hl7.Fhir.Model.ResourceReference? Facility { get { return _Facility; } set { _Facility = value; OnPropertyChanged("Facility"); } } - private Hl7.Fhir.Model.ResourceReference _Facility; + private Hl7.Fhir.Model.ResourceReference? _Facility; /// /// Claim reference. @@ -7193,13 +7019,13 @@ public Hl7.Fhir.Model.ResourceReference Facility [CLSCompliant(false)] [References("Claim")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Claim + public Hl7.Fhir.Model.ResourceReference? Claim { get { return _Claim; } set { _Claim = value; OnPropertyChanged("Claim"); } } - private Hl7.Fhir.Model.ResourceReference _Claim; + private Hl7.Fhir.Model.ResourceReference? _Claim; /// /// Claim response reference. @@ -7208,13 +7034,13 @@ public Hl7.Fhir.Model.ResourceReference Claim [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ClaimResponse + public Hl7.Fhir.Model.ResourceReference? ClaimResponse { get { return _ClaimResponse; } set { _ClaimResponse = value; OnPropertyChanged("ClaimResponse"); } } - private Hl7.Fhir.Model.ResourceReference _ClaimResponse; + private Hl7.Fhir.Model.ResourceReference? _ClaimResponse; /// /// queued | complete | error | partial. @@ -7224,13 +7050,13 @@ public Hl7.Fhir.Model.ResourceReference ClaimResponse [Binding("ClaimOutcome")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -7239,13 +7065,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -7256,41 +7079,38 @@ public Hl7.Fhir.Model.ClaimProcessingCodes? Outcome [FhirElement("decision", InSummary=true, Order=350)] [Binding("AdjudicationDecision")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Decision + public Hl7.Fhir.Model.CodeableConcept? Decision { get { return _Decision; } set { _Decision = value; OnPropertyChanged("Decision"); } } - private Hl7.Fhir.Model.CodeableConcept _Decision; + private Hl7.Fhir.Model.CodeableConcept? _Decision; /// /// Disposition Message. /// [FhirElement("disposition", Order=360)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition Message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -7303,24 +7123,24 @@ public string Disposition [DataMember] public List PreAuthRefElement { - get { if(_PreAuthRefElement==null) _PreAuthRefElement = new List(); return _PreAuthRefElement; } + get => _PreAuthRefElement ?? new List(); set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } - private List _PreAuthRefElement; + private List? _PreAuthRefElement; /// /// Preauthorization reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PreAuthRef + public IEnumerable? PreAuthRef { - get { return PreAuthRefElement != null ? PreAuthRefElement.Select(elem => elem.Value) : null; } + get => _PreAuthRefElement?.Select(elem => elem.Value); set { if (value == null) - PreAuthRefElement = null; + PreAuthRefElement = null!; else PreAuthRefElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("PreAuthRef"); @@ -7335,11 +7155,11 @@ public IEnumerable PreAuthRef [DataMember] public List PreAuthRefPeriod { - get { if(_PreAuthRefPeriod==null) _PreAuthRefPeriod = new List(); return _PreAuthRefPeriod; } + get => _PreAuthRefPeriod ?? new List(); set { _PreAuthRefPeriod = value; OnPropertyChanged("PreAuthRefPeriod"); } } - private List _PreAuthRefPeriod; + private List? _PreAuthRefPeriod; /// /// Package billing code. @@ -7347,13 +7167,13 @@ public List PreAuthRefPeriod [FhirElement("diagnosisRelatedGroup", Order=390)] [Binding("DiagnosisRelatedGroup")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DiagnosisRelatedGroup + public Hl7.Fhir.Model.CodeableConcept? DiagnosisRelatedGroup { get { return _DiagnosisRelatedGroup; } set { _DiagnosisRelatedGroup = value; OnPropertyChanged("DiagnosisRelatedGroup"); } } - private Hl7.Fhir.Model.CodeableConcept _DiagnosisRelatedGroup; + private Hl7.Fhir.Model.CodeableConcept? _DiagnosisRelatedGroup; /// /// Care Team members. @@ -7363,11 +7183,11 @@ public Hl7.Fhir.Model.CodeableConcept DiagnosisRelatedGroup [DataMember] public List CareTeam { - get { if(_CareTeam==null) _CareTeam = new List(); return _CareTeam; } + get => _CareTeam ?? new List(); set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } - private List _CareTeam; + private List? _CareTeam; /// /// Supporting information. @@ -7377,11 +7197,11 @@ public List CareTeam [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Pertinent diagnosis information. @@ -7391,11 +7211,11 @@ public List [DataMember] public List Diagnosis { - get { if(_Diagnosis==null) _Diagnosis = new List(); return _Diagnosis; } + get => _Diagnosis ?? new List(); set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } - private List _Diagnosis; + private List? _Diagnosis; /// /// Clinical procedures performed. @@ -7405,24 +7225,24 @@ public List Diagnosis [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Precedence (primary, secondary, etc.). /// [FhirElement("precedence", Order=440)] [DataMember] - public Hl7.Fhir.Model.PositiveInt PrecedenceElement + public Hl7.Fhir.Model.PositiveInt? PrecedenceElement { get { return _PrecedenceElement; } set { _PrecedenceElement = value; OnPropertyChanged("PrecedenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _PrecedenceElement; + private Hl7.Fhir.Model.PositiveInt? _PrecedenceElement; /// /// Precedence (primary, secondary, etc.) @@ -7431,13 +7251,10 @@ public Hl7.Fhir.Model.PositiveInt PrecedenceElement [IgnoreDataMember] public int? Precedence { - get { return PrecedenceElement != null ? PrecedenceElement.Value : null; } + get => _PrecedenceElement?.Value; set { - if (value == null) - PrecedenceElement = null; - else - PrecedenceElement = new Hl7.Fhir.Model.PositiveInt(value); + PrecedenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Precedence"); } } @@ -7450,37 +7267,37 @@ public int? Precedence [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Details of the event. /// [FhirElement("accident", Order=460)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent Accident + public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? Accident { get { return _Accident; } set { _Accident = value; OnPropertyChanged("Accident"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent _Accident; + private Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? _Accident; /// /// Paid by the patient. /// [FhirElement("patientPaid", Order=470)] [DataMember] - public Hl7.Fhir.Model.Money PatientPaid + public Hl7.Fhir.Model.Money? PatientPaid { get { return _PatientPaid; } set { _PatientPaid = value; OnPropertyChanged("PatientPaid"); } } - private Hl7.Fhir.Model.Money _PatientPaid; + private Hl7.Fhir.Model.Money? _PatientPaid; /// /// Product or service provided. @@ -7490,11 +7307,11 @@ public Hl7.Fhir.Model.Money PatientPaid [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; /// /// Insurer added line items. @@ -7504,11 +7321,11 @@ public List Item [DataMember] public List AddItem { - get { if(_AddItem==null) _AddItem = new List(); return _AddItem; } + get => _AddItem ?? new List(); set { _AddItem = value; OnPropertyChanged("AddItem"); } } - private List _AddItem; + private List? _AddItem; /// /// Header-level adjudication. @@ -7518,11 +7335,11 @@ public List AddItem [DataMember] public List Adjudication { - get { if(_Adjudication==null) _Adjudication = new List(); return _Adjudication; } + get => _Adjudication ?? new List(); set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } - private List _Adjudication; + private List? _Adjudication; /// /// Adjudication totals. @@ -7532,24 +7349,24 @@ public List Adjudicat [DataMember] public List Total { - get { if(_Total==null) _Total = new List(); return _Total; } + get => _Total ?? new List(); set { _Total = value; OnPropertyChanged("Total"); } } - private List _Total; + private List? _Total; /// /// Payment Details. /// [FhirElement("payment", Order=520)] [DataMember] - public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment + public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent _Payment; + private Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent? _Payment; /// /// Printed form identifier. @@ -7557,26 +7374,26 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent Payment [FhirElement("formCode", Order=530)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Printed reference or actual form. /// [FhirElement("form", Order=540)] [DataMember] - public Hl7.Fhir.Model.Attachment Form + public Hl7.Fhir.Model.Attachment? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.Attachment _Form; + private Hl7.Fhir.Model.Attachment? _Form; /// /// Note concerning adjudication. @@ -7586,24 +7403,24 @@ public Hl7.Fhir.Model.Attachment Form [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; /// /// When the benefits are applicable. /// [FhirElement("benefitPeriod", Order=560)] [DataMember] - public Hl7.Fhir.Model.Period BenefitPeriod + public Hl7.Fhir.Model.Period? BenefitPeriod { get { return _BenefitPeriod; } set { _BenefitPeriod = value; OnPropertyChanged("BenefitPeriod"); } } - private Hl7.Fhir.Model.Period _BenefitPeriod; + private Hl7.Fhir.Model.Period? _BenefitPeriod; /// /// Balance by Benefit Category. @@ -7613,73 +7430,69 @@ public Hl7.Fhir.Model.Period BenefitPeriod [DataMember] public List BenefitBalance { - get { if(_BenefitBalance==null) _BenefitBalance = new List(); return _BenefitBalance; } + get => _BenefitBalance ?? new List(); set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } - private List _BenefitBalance; + private List? _BenefitBalance; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ExplanationOfBenefit; - - if (dest == null) - { + if(other is not ExplanationOfBenefit dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TraceNumber.Any()) dest.TraceNumber = new List(TraceNumber.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubType != null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)SubType.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(BillablePeriod != null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)BillablePeriod.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(Insurer != null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopyInternal(); - if(Provider != null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(FundsReserveRequested != null) dest.FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)FundsReserveRequested.DeepCopyInternal(); - if(FundsReserve != null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)FundsReserve.DeepCopyInternal(); - if(Related.Any()) dest.Related = new List(Related.DeepCopyInternal()); - if(Prescription != null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)Prescription.DeepCopyInternal(); - if(OriginalPrescription != null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)OriginalPrescription.DeepCopyInternal(); - if(Event.Any()) dest.Event = new List(Event.DeepCopyInternal()); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)Payee.DeepCopyInternal(); - if(Referral != null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)Referral.DeepCopyInternal(); - if(Encounter.Any()) dest.Encounter = new List(Encounter.DeepCopyInternal()); - if(Facility != null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopyInternal(); - if(Claim != null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)Claim.DeepCopyInternal(); - if(ClaimResponse != null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)ClaimResponse.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(Decision != null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)Decision.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(PreAuthRefElement.Any()) dest.PreAuthRefElement = new List(PreAuthRefElement.DeepCopyInternal()); - if(PreAuthRefPeriod.Any()) dest.PreAuthRefPeriod = new List(PreAuthRefPeriod.DeepCopyInternal()); - if(DiagnosisRelatedGroup != null) dest.DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)DiagnosisRelatedGroup.DeepCopyInternal(); - if(CareTeam.Any()) dest.CareTeam = new List(CareTeam.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Diagnosis.Any()) dest.Diagnosis = new List(Diagnosis.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(PrecedenceElement != null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)PrecedenceElement.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Accident != null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)Accident.DeepCopyInternal(); - if(PatientPaid != null) dest.PatientPaid = (Hl7.Fhir.Model.Money)PatientPaid.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); - if(AddItem.Any()) dest.AddItem = new List(AddItem.DeepCopyInternal()); - if(Adjudication.Any()) dest.Adjudication = new List(Adjudication.DeepCopyInternal()); - if(Total.Any()) dest.Total = new List(Total.DeepCopyInternal()); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)Payment.DeepCopyInternal(); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.Attachment)Form.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); - if(BenefitPeriod != null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)BenefitPeriod.DeepCopyInternal(); - if(BenefitBalance.Any()) dest.BenefitBalance = new List(BenefitBalance.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TraceNumber is not null) dest.TraceNumber = new List(_TraceNumber.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubType is not null) dest.SubType = (Hl7.Fhir.Model.CodeableConcept)_SubType.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_BillablePeriod is not null) dest.BillablePeriod = (Hl7.Fhir.Model.Period)_BillablePeriod.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_Insurer is not null) dest.Insurer = (Hl7.Fhir.Model.ResourceReference)_Insurer.DeepCopyInternal(); + if(_Provider is not null) dest.Provider = (Hl7.Fhir.Model.ResourceReference)_Provider.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_FundsReserveRequested is not null) dest.FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)_FundsReserveRequested.DeepCopyInternal(); + if(_FundsReserve is not null) dest.FundsReserve = (Hl7.Fhir.Model.CodeableConcept)_FundsReserve.DeepCopyInternal(); + if(_Related is not null) dest.Related = new List(_Related.DeepCopyInternal()); + if(_Prescription is not null) dest.Prescription = (Hl7.Fhir.Model.ResourceReference)_Prescription.DeepCopyInternal(); + if(_OriginalPrescription is not null) dest.OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)_OriginalPrescription.DeepCopyInternal(); + if(_Event is not null) dest.Event = new List(_Event.DeepCopyInternal()); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)_Payee.DeepCopyInternal(); + if(_Referral is not null) dest.Referral = (Hl7.Fhir.Model.ResourceReference)_Referral.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = new List(_Encounter.DeepCopyInternal()); + if(_Facility is not null) dest.Facility = (Hl7.Fhir.Model.ResourceReference)_Facility.DeepCopyInternal(); + if(_Claim is not null) dest.Claim = (Hl7.Fhir.Model.ResourceReference)_Claim.DeepCopyInternal(); + if(_ClaimResponse is not null) dest.ClaimResponse = (Hl7.Fhir.Model.ResourceReference)_ClaimResponse.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_Decision is not null) dest.Decision = (Hl7.Fhir.Model.CodeableConcept)_Decision.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_PreAuthRefElement is not null) dest.PreAuthRefElement = new List(_PreAuthRefElement.DeepCopyInternal()); + if(_PreAuthRefPeriod is not null) dest.PreAuthRefPeriod = new List(_PreAuthRefPeriod.DeepCopyInternal()); + if(_DiagnosisRelatedGroup is not null) dest.DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)_DiagnosisRelatedGroup.DeepCopyInternal(); + if(_CareTeam is not null) dest.CareTeam = new List(_CareTeam.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Diagnosis is not null) dest.Diagnosis = new List(_Diagnosis.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_PrecedenceElement is not null) dest.PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)_PrecedenceElement.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Accident is not null) dest.Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)_Accident.DeepCopyInternal(); + if(_PatientPaid is not null) dest.PatientPaid = (Hl7.Fhir.Model.Money)_PatientPaid.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); + if(_AddItem is not null) dest.AddItem = new List(_AddItem.DeepCopyInternal()); + if(_Adjudication is not null) dest.Adjudication = new List(_Adjudication.DeepCopyInternal()); + if(_Total is not null) dest.Total = new List(_Total.DeepCopyInternal()); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)_Payment.DeepCopyInternal(); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.Attachment)_Form.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); + if(_BenefitPeriod is not null) dest.BenefitPeriod = (Hl7.Fhir.Model.Period)_BenefitPeriod.DeepCopyInternal(); + if(_BenefitBalance is not null) dest.BenefitBalance = new List(_BenefitBalance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -7691,370 +7504,370 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExplanationOfBenefit; - if(otherT == null) return false; + if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(TraceNumber, otherT.TraceNumber)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubType, otherT.SubType)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(BillablePeriod, otherT.BillablePeriod)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(Insurer, otherT.Insurer)) return false; - if(!comparer.Equals(Provider, otherT.Provider)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(FundsReserveRequested, otherT.FundsReserveRequested)) return false; - if(!comparer.Equals(FundsReserve, otherT.FundsReserve)) return false; - if(!comparer.ListEquals(Related, otherT.Related)) return false; - if(!comparer.Equals(Prescription, otherT.Prescription)) return false; - if(!comparer.Equals(OriginalPrescription, otherT.OriginalPrescription)) return false; - if(!comparer.ListEquals(Event, otherT.Event)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Referral, otherT.Referral)) return false; - if(!comparer.ListEquals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Facility, otherT.Facility)) return false; - if(!comparer.Equals(Claim, otherT.Claim)) return false; - if(!comparer.Equals(ClaimResponse, otherT.ClaimResponse)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(Decision, otherT.Decision)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.ListEquals(PreAuthRefElement, otherT.PreAuthRefElement)) return false; - if(!comparer.ListEquals(PreAuthRefPeriod, otherT.PreAuthRefPeriod)) return false; - if(!comparer.Equals(DiagnosisRelatedGroup, otherT.DiagnosisRelatedGroup)) return false; - if(!comparer.ListEquals(CareTeam, otherT.CareTeam)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Diagnosis, otherT.Diagnosis)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(PrecedenceElement, otherT.PrecedenceElement)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.Equals(Accident, otherT.Accident)) return false; - if(!comparer.Equals(PatientPaid, otherT.PatientPaid)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(AddItem, otherT.AddItem)) return false; - if(!comparer.ListEquals(Adjudication, otherT.Adjudication)) return false; - if(!comparer.ListEquals(Total, otherT.Total)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; - if(!comparer.Equals(BenefitPeriod, otherT.BenefitPeriod)) return false; - if(!comparer.ListEquals(BenefitBalance, otherT.BenefitBalance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubType, otherT._SubType)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_BillablePeriod, otherT._BillablePeriod)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; + if(!comparer.Equals(_Provider, otherT._Provider)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_FundsReserveRequested, otherT._FundsReserveRequested)) return false; + if(!comparer.Equals(_FundsReserve, otherT._FundsReserve)) return false; + if(!comparer.ListEquals(_Related, otherT._Related)) return false; + if(!comparer.Equals(_Prescription, otherT._Prescription)) return false; + if(!comparer.Equals(_OriginalPrescription, otherT._OriginalPrescription)) return false; + if(!comparer.ListEquals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Referral, otherT._Referral)) return false; + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Facility, otherT._Facility)) return false; + if(!comparer.Equals(_Claim, otherT._Claim)) return false; + if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_Decision, otherT._Decision)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; + if(!comparer.ListEquals(_PreAuthRefPeriod, otherT._PreAuthRefPeriod)) return false; + if(!comparer.Equals(_DiagnosisRelatedGroup, otherT._DiagnosisRelatedGroup)) return false; + if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_PrecedenceElement, otherT._PrecedenceElement)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.Equals(_Accident, otherT._Accident)) return false; + if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_AddItem, otherT._AddItem)) return false; + if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; + if(!comparer.ListEquals(_Total, otherT._Total)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; + if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; + if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "traceNumber": - value = TraceNumber; - return TraceNumber?.Any() == true; + value = _TraceNumber; + return _TraceNumber?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subType": - value = SubType; - return SubType is not null; + value = _SubType; + return _SubType is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "billablePeriod": - value = BillablePeriod; - return BillablePeriod is not null; + value = _BillablePeriod; + return _BillablePeriod is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "insurer": - value = Insurer; - return Insurer is not null; + value = _Insurer; + return _Insurer is not null; case "provider": - value = Provider; - return Provider is not null; + value = _Provider; + return _Provider is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "fundsReserveRequested": - value = FundsReserveRequested; - return FundsReserveRequested is not null; + value = _FundsReserveRequested; + return _FundsReserveRequested is not null; case "fundsReserve": - value = FundsReserve; - return FundsReserve is not null; + value = _FundsReserve; + return _FundsReserve is not null; case "related": - value = Related; - return Related?.Any() == true; + value = _Related; + return _Related?.Any() == true; case "prescription": - value = Prescription; - return Prescription is not null; + value = _Prescription; + return _Prescription is not null; case "originalPrescription": - value = OriginalPrescription; - return OriginalPrescription is not null; + value = _OriginalPrescription; + return _OriginalPrescription is not null; case "event": - value = Event; - return Event?.Any() == true; + value = _Event; + return _Event?.Any() == true; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "referral": - value = Referral; - return Referral is not null; + value = _Referral; + return _Referral is not null; case "encounter": - value = Encounter; - return Encounter?.Any() == true; + value = _Encounter; + return _Encounter?.Any() == true; case "facility": - value = Facility; - return Facility is not null; + value = _Facility; + return _Facility is not null; case "claim": - value = Claim; - return Claim is not null; + value = _Claim; + return _Claim is not null; case "claimResponse": - value = ClaimResponse; - return ClaimResponse is not null; + value = _ClaimResponse; + return _ClaimResponse is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "decision": - value = Decision; - return Decision is not null; + value = _Decision; + return _Decision is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "preAuthRef": - value = PreAuthRefElement; - return PreAuthRefElement?.Any() == true; + value = _PreAuthRefElement; + return _PreAuthRefElement?.Any() == true; case "preAuthRefPeriod": - value = PreAuthRefPeriod; - return PreAuthRefPeriod?.Any() == true; + value = _PreAuthRefPeriod; + return _PreAuthRefPeriod?.Any() == true; case "diagnosisRelatedGroup": - value = DiagnosisRelatedGroup; - return DiagnosisRelatedGroup is not null; + value = _DiagnosisRelatedGroup; + return _DiagnosisRelatedGroup is not null; case "careTeam": - value = CareTeam; - return CareTeam?.Any() == true; + value = _CareTeam; + return _CareTeam?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "diagnosis": - value = Diagnosis; - return Diagnosis?.Any() == true; + value = _Diagnosis; + return _Diagnosis?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "precedence": - value = PrecedenceElement; - return PrecedenceElement is not null; + value = _PrecedenceElement; + return _PrecedenceElement is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "accident": - value = Accident; - return Accident is not null; + value = _Accident; + return _Accident is not null; case "patientPaid": - value = PatientPaid; - return PatientPaid is not null; + value = _PatientPaid; + return _PatientPaid is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; case "addItem": - value = AddItem; - return AddItem?.Any() == true; + value = _AddItem; + return _AddItem?.Any() == true; case "adjudication": - value = Adjudication; - return Adjudication?.Any() == true; + value = _Adjudication; + return _Adjudication?.Any() == true; case "total": - value = Total; - return Total?.Any() == true; + value = _Total; + return _Total?.Any() == true; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; case "benefitPeriod": - value = BenefitPeriod; - return BenefitPeriod is not null; + value = _BenefitPeriod; + return _BenefitPeriod is not null; case "benefitBalance": - value = BenefitBalance; - return BenefitBalance?.Any() == true; + value = _BenefitBalance; + return _BenefitBalance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "traceNumber": - TraceNumber = (List)value; + TraceNumber = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subType": - SubType = (Hl7.Fhir.Model.CodeableConcept)value; + SubType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "billablePeriod": - BillablePeriod = (Hl7.Fhir.Model.Period)value; + BillablePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurer": - Insurer = (Hl7.Fhir.Model.ResourceReference)value; + Insurer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "provider": - Provider = (Hl7.Fhir.Model.ResourceReference)value; + Provider = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserveRequested": - FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserveRequested = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fundsReserve": - FundsReserve = (Hl7.Fhir.Model.CodeableConcept)value; + FundsReserve = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "related": - Related = (List)value; + Related = (List?)value!; return this; case "prescription": - Prescription = (Hl7.Fhir.Model.ResourceReference)value; + Prescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "originalPrescription": - OriginalPrescription = (Hl7.Fhir.Model.ResourceReference)value; + OriginalPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "event": - Event = (List)value; + Event = (List?)value!; return this; case "payee": - Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent)value; + Payee = (Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent?)value; return this; case "referral": - Referral = (Hl7.Fhir.Model.ResourceReference)value; + Referral = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (List)value; + Encounter = (List?)value!; return this; case "facility": - Facility = (Hl7.Fhir.Model.ResourceReference)value; + Facility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claim": - Claim = (Hl7.Fhir.Model.ResourceReference)value; + Claim = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "claimResponse": - ClaimResponse = (Hl7.Fhir.Model.ResourceReference)value; + ClaimResponse = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "decision": - Decision = (Hl7.Fhir.Model.CodeableConcept)value; + Decision = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preAuthRef": - PreAuthRefElement = (List)value; + PreAuthRefElement = (List?)value!; return this; case "preAuthRefPeriod": - PreAuthRefPeriod = (List)value; + PreAuthRefPeriod = (List?)value!; return this; case "diagnosisRelatedGroup": - DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept)value; + DiagnosisRelatedGroup = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "careTeam": - CareTeam = (List)value; + CareTeam = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "diagnosis": - Diagnosis = (List)value; + Diagnosis = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "precedence": - PrecedenceElement = (Hl7.Fhir.Model.PositiveInt)value; + PrecedenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "accident": - Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent)value; + Accident = (Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent?)value; return this; case "patientPaid": - PatientPaid = (Hl7.Fhir.Model.Money)value; + PatientPaid = (Hl7.Fhir.Model.Money?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; case "addItem": - AddItem = (List)value; + AddItem = (List?)value!; return this; case "adjudication": - Adjudication = (List)value; + Adjudication = (List?)value!; return this; case "total": - Total = (List)value; + Total = (List?)value!; return this; case "payment": - Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent)value; + Payment = (Hl7.Fhir.Model.ExplanationOfBenefit.PaymentComponent?)value; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "form": - Form = (Hl7.Fhir.Model.Attachment)value; + Form = (Hl7.Fhir.Model.Attachment?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; case "benefitPeriod": - BenefitPeriod = (Hl7.Fhir.Model.Period)value; + BenefitPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "benefitBalance": - BenefitBalance = (List)value; + BenefitBalance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -8065,55 +7878,55 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",TraceNumber); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubType is not null) yield return new KeyValuePair("subType",SubType); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",BillablePeriod); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (Insurer is not null) yield return new KeyValuePair("insurer",Insurer); - if (Provider is not null) yield return new KeyValuePair("provider",Provider); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (FundsReserveRequested is not null) yield return new KeyValuePair("fundsReserveRequested",FundsReserveRequested); - if (FundsReserve is not null) yield return new KeyValuePair("fundsReserve",FundsReserve); - if (Related?.Any() == true) yield return new KeyValuePair("related",Related); - if (Prescription is not null) yield return new KeyValuePair("prescription",Prescription); - if (OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",OriginalPrescription); - if (Event?.Any() == true) yield return new KeyValuePair("event",Event); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Referral is not null) yield return new KeyValuePair("referral",Referral); - if (Encounter?.Any() == true) yield return new KeyValuePair("encounter",Encounter); - if (Facility is not null) yield return new KeyValuePair("facility",Facility); - if (Claim is not null) yield return new KeyValuePair("claim",Claim); - if (ClaimResponse is not null) yield return new KeyValuePair("claimResponse",ClaimResponse); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (Decision is not null) yield return new KeyValuePair("decision",Decision); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",PreAuthRefElement); - if (PreAuthRefPeriod?.Any() == true) yield return new KeyValuePair("preAuthRefPeriod",PreAuthRefPeriod); - if (DiagnosisRelatedGroup is not null) yield return new KeyValuePair("diagnosisRelatedGroup",DiagnosisRelatedGroup); - if (CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",CareTeam); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",Diagnosis); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (PrecedenceElement is not null) yield return new KeyValuePair("precedence",PrecedenceElement); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Accident is not null) yield return new KeyValuePair("accident",Accident); - if (PatientPaid is not null) yield return new KeyValuePair("patientPaid",PatientPaid); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); - if (AddItem?.Any() == true) yield return new KeyValuePair("addItem",AddItem); - if (Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",Adjudication); - if (Total?.Any() == true) yield return new KeyValuePair("total",Total); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); - if (BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",BenefitPeriod); - if (BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",BenefitBalance); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TraceNumber?.Any() == true) yield return new KeyValuePair("traceNumber",_TraceNumber); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubType is not null) yield return new KeyValuePair("subType",_SubType); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_BillablePeriod is not null) yield return new KeyValuePair("billablePeriod",_BillablePeriod); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_Insurer is not null) yield return new KeyValuePair("insurer",_Insurer); + if (_Provider is not null) yield return new KeyValuePair("provider",_Provider); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_FundsReserveRequested is not null) yield return new KeyValuePair("fundsReserveRequested",_FundsReserveRequested); + if (_FundsReserve is not null) yield return new KeyValuePair("fundsReserve",_FundsReserve); + if (_Related?.Any() == true) yield return new KeyValuePair("related",_Related); + if (_Prescription is not null) yield return new KeyValuePair("prescription",_Prescription); + if (_OriginalPrescription is not null) yield return new KeyValuePair("originalPrescription",_OriginalPrescription); + if (_Event?.Any() == true) yield return new KeyValuePair("event",_Event); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Referral is not null) yield return new KeyValuePair("referral",_Referral); + if (_Encounter?.Any() == true) yield return new KeyValuePair("encounter",_Encounter); + if (_Facility is not null) yield return new KeyValuePair("facility",_Facility); + if (_Claim is not null) yield return new KeyValuePair("claim",_Claim); + if (_ClaimResponse is not null) yield return new KeyValuePair("claimResponse",_ClaimResponse); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_Decision is not null) yield return new KeyValuePair("decision",_Decision); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_PreAuthRefElement?.Any() == true) yield return new KeyValuePair("preAuthRef",_PreAuthRefElement); + if (_PreAuthRefPeriod?.Any() == true) yield return new KeyValuePair("preAuthRefPeriod",_PreAuthRefPeriod); + if (_DiagnosisRelatedGroup is not null) yield return new KeyValuePair("diagnosisRelatedGroup",_DiagnosisRelatedGroup); + if (_CareTeam?.Any() == true) yield return new KeyValuePair("careTeam",_CareTeam); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Diagnosis?.Any() == true) yield return new KeyValuePair("diagnosis",_Diagnosis); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_PrecedenceElement is not null) yield return new KeyValuePair("precedence",_PrecedenceElement); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Accident is not null) yield return new KeyValuePair("accident",_Accident); + if (_PatientPaid is not null) yield return new KeyValuePair("patientPaid",_PatientPaid); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); + if (_AddItem?.Any() == true) yield return new KeyValuePair("addItem",_AddItem); + if (_Adjudication?.Any() == true) yield return new KeyValuePair("adjudication",_Adjudication); + if (_Total?.Any() == true) yield return new KeyValuePair("total",_Total); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); + if (_BenefitPeriod is not null) yield return new KeyValuePair("benefitPeriod",_BenefitPeriod); + if (_BenefitBalance?.Any() == true) yield return new KeyValuePair("benefitBalance",_BenefitBalance); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Expression.cs b/src/Hl7.Fhir.R5/Model/Generated/Expression.cs index 83a96882b..9460b813d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Expression.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Expression.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Expression : Hl7.Fhir.Model.DataType /// [FhirElement("description", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the condition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -95,28 +95,25 @@ public string Description /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Short name assigned to expression for reuse /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -127,28 +124,25 @@ public string Name [FhirElement("language", InSummary=true, Order=50)] [Binding("ExpressionLanguage")] [DataMember] - public Hl7.Fhir.Model.Code LanguageElement + public Hl7.Fhir.Model.Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Hl7.Fhir.Model.Code _LanguageElement; + private Hl7.Fhir.Model.Code? _LanguageElement; /// /// text/cql | text/fhirpath | application/x-fhir-query | etc. /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Language + public string? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Hl7.Fhir.Model.Code(value); + LanguageElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Language"); } } @@ -158,28 +152,25 @@ public string Language /// [FhirElement("expression", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Expression in specified language /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression_ + public string? Expression_ { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression_"); } } @@ -189,47 +180,40 @@ public string Expression_ /// [FhirElement("reference", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Where the expression is found /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Expression; - - if (dest == null) - { + if(other is not Expression dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Hl7.Fhir.Model.Code)LanguageElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Hl7.Fhir.Model.Code)_LanguageElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -241,62 +225,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Expression; - if(otherT == null) return false; + if(other is not Expression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "language": - LanguageElement = (Hl7.Fhir.Model.Code)value; + LanguageElement = (Hl7.Fhir.Model.Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -307,11 +291,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs b/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs index 7975c2972..a8a4634f7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,13 +69,13 @@ public partial class ExtendedContactDetail : Hl7.Fhir.Model.DataType [FhirElement("purpose", InSummary=true, Order=30)] [Binding("Purpose")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Purpose + public Hl7.Fhir.Model.CodeableConcept? Purpose { get { return _Purpose; } set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private Hl7.Fhir.Model.CodeableConcept _Purpose; + private Hl7.Fhir.Model.CodeableConcept? _Purpose; /// /// Name of an individual to contact. @@ -82,11 +85,11 @@ public Hl7.Fhir.Model.CodeableConcept Purpose [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// Contact details (e.g.phone/fax/url). @@ -96,24 +99,24 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address for the contact. /// [FhirElement("address", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// This contact detail is handled/monitored by a specific organization. @@ -122,43 +125,39 @@ public Hl7.Fhir.Model.Address Address [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Period that this contact was valid for usage. /// [FhirElement("period", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ExtendedContactDetail; - - if (dest == null) - { + if(other is not ExtendedContactDetail dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Purpose != null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)Purpose.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Purpose is not null) dest.Purpose = (Hl7.Fhir.Model.CodeableConcept)_Purpose.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -170,69 +169,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExtendedContactDetail; - if(otherT == null) return false; + if(other is not ExtendedContactDetail otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Purpose, otherT.Purpose)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "purpose": - value = Purpose; - return Purpose is not null; + value = _Purpose; + return _Purpose is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "purpose": - Purpose = (Hl7.Fhir.Model.CodeableConcept)value; + Purpose = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -243,12 +242,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Purpose is not null) yield return new KeyValuePair("purpose",Purpose); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Purpose is not null) yield return new KeyValuePair("purpose",_Purpose); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs index 65bcd88ff..e59f3a6bd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,13 +118,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("FamilyMemberHistoryParticipantFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who or what participated in the activities related to the family member history. @@ -131,26 +134,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Patient","RelatedPerson","Device","Organization","CareTeam")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -162,41 +161,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -207,8 +206,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -236,13 +235,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConditionCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// deceased | permanent disability | etc. @@ -250,26 +249,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("outcome", Order=50)] [Binding("ConditionOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Whether the condition contributed to the cause of death. /// [FhirElement("contributedToDeath", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement + public Hl7.Fhir.Model.FhirBoolean? ContributedToDeathElement { get { return _ContributedToDeathElement; } set { _ContributedToDeathElement = value; OnPropertyChanged("ContributedToDeathElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ContributedToDeathElement; + private Hl7.Fhir.Model.FhirBoolean? _ContributedToDeathElement; /// /// Whether the condition contributed to the cause of death @@ -278,13 +277,10 @@ public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement [IgnoreDataMember] public bool? ContributedToDeath { - get { return ContributedToDeathElement != null ? ContributedToDeathElement.Value : null; } + get => _ContributedToDeathElement?.Value; set { - if (value == null) - ContributedToDeathElement = null; - else - ContributedToDeathElement = new Hl7.Fhir.Model.FhirBoolean(value); + ContributedToDeathElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ContributedToDeath"); } } @@ -296,13 +292,13 @@ public bool? ContributedToDeath [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Onset + public Hl7.Fhir.Model.DataType? Onset { get { return _Onset; } set { _Onset = value; OnPropertyChanged("Onset"); } } - private Hl7.Fhir.Model.DataType _Onset; + private Hl7.Fhir.Model.DataType? _Onset; /// /// Extra information about condition. @@ -312,27 +308,23 @@ public Hl7.Fhir.Model.DataType Onset [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(ContributedToDeathElement != null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)ContributedToDeathElement.DeepCopyInternal(); - if(Onset != null) dest.Onset = (Hl7.Fhir.Model.DataType)Onset.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_ContributedToDeathElement is not null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)_ContributedToDeathElement.DeepCopyInternal(); + if(_Onset is not null) dest.Onset = (Hl7.Fhir.Model.DataType)_Onset.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -344,62 +336,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(ContributedToDeathElement, otherT.ContributedToDeathElement)) return false; - if(!comparer.Equals(Onset, otherT.Onset)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; + if(!comparer.Equals(_Onset, otherT._Onset)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "contributedToDeath": - value = ContributedToDeathElement; - return ContributedToDeathElement is not null; + value = _ContributedToDeathElement; + return _ContributedToDeathElement is not null; case "onset": - value = Onset; - return Onset is not null; + value = _Onset; + return _Onset is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contributedToDeath": - ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)value; + ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "onset": - Onset = (Hl7.Fhir.Model.DataType)value; + Onset = (Hl7.Fhir.Model.DataType?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -410,11 +402,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",ContributedToDeathElement); - if (Onset is not null) yield return new KeyValuePair("onset",Onset); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",_ContributedToDeathElement); + if (_Onset is not null) yield return new KeyValuePair("onset",_Onset); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -442,13 +434,13 @@ public partial class ProcedureComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProcedureCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// What happened following the procedure. @@ -456,26 +448,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("outcome", Order=50)] [Binding("ProcedureOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Whether the procedure contributed to the cause of death. /// [FhirElement("contributedToDeath", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement + public Hl7.Fhir.Model.FhirBoolean? ContributedToDeathElement { get { return _ContributedToDeathElement; } set { _ContributedToDeathElement = value; OnPropertyChanged("ContributedToDeathElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ContributedToDeathElement; + private Hl7.Fhir.Model.FhirBoolean? _ContributedToDeathElement; /// /// Whether the procedure contributed to the cause of death @@ -484,13 +476,10 @@ public Hl7.Fhir.Model.FhirBoolean ContributedToDeathElement [IgnoreDataMember] public bool? ContributedToDeath { - get { return ContributedToDeathElement != null ? ContributedToDeathElement.Value : null; } + get => _ContributedToDeathElement?.Value; set { - if (value == null) - ContributedToDeathElement = null; - else - ContributedToDeathElement = new Hl7.Fhir.Model.FhirBoolean(value); + ContributedToDeathElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ContributedToDeath"); } } @@ -502,13 +491,13 @@ public bool? ContributedToDeath [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Performed + public Hl7.Fhir.Model.DataType? Performed { get { return _Performed; } set { _Performed = value; OnPropertyChanged("Performed"); } } - private Hl7.Fhir.Model.DataType _Performed; + private Hl7.Fhir.Model.DataType? _Performed; /// /// Extra information about the procedure. @@ -518,27 +507,23 @@ public Hl7.Fhir.Model.DataType Performed [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcedureComponent; - - if (dest == null) - { + if(other is not ProcedureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(ContributedToDeathElement != null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)ContributedToDeathElement.DeepCopyInternal(); - if(Performed != null) dest.Performed = (Hl7.Fhir.Model.DataType)Performed.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_ContributedToDeathElement is not null) dest.ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)_ContributedToDeathElement.DeepCopyInternal(); + if(_Performed is not null) dest.Performed = (Hl7.Fhir.Model.DataType)_Performed.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -550,62 +535,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcedureComponent; - if(otherT == null) return false; + if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(ContributedToDeathElement, otherT.ContributedToDeathElement)) return false; - if(!comparer.Equals(Performed, otherT.Performed)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; + if(!comparer.Equals(_Performed, otherT._Performed)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "contributedToDeath": - value = ContributedToDeathElement; - return ContributedToDeathElement is not null; + value = _ContributedToDeathElement; + return _ContributedToDeathElement is not null; case "performed": - value = Performed; - return Performed is not null; + value = _Performed; + return _Performed is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contributedToDeath": - ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean)value; + ContributedToDeathElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "performed": - Performed = (Hl7.Fhir.Model.DataType)value; + Performed = (Hl7.Fhir.Model.DataType?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -616,11 +601,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",ContributedToDeathElement); - if (Performed is not null) yield return new KeyValuePair("performed",Performed); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_ContributedToDeathElement is not null) yield return new KeyValuePair("contributedToDeath",_ContributedToDeathElement); + if (_Performed is not null) yield return new KeyValuePair("performed",_Performed); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -633,11 +618,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -647,24 +632,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -679,24 +664,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -711,13 +696,13 @@ public IEnumerable InstantiatesUri [Binding("FamilyHistoryStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// partial | completed | entered-in-error | health-unknown @@ -726,13 +711,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -743,13 +725,13 @@ public Hl7.Fhir.Model.FamilyMemberHistory.FamilyHistoryStatus? Status [FhirElement("dataAbsentReason", InSummary=true, Order=130)] [Binding("FamilyHistoryAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// Patient history is about. @@ -759,41 +741,38 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// When history was recorded or last updated. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When history was recorded or last updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -806,39 +785,36 @@ public string Date [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The family member described. /// [FhirElement("name", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The family member described /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -850,13 +826,13 @@ public string Name [Binding("FamilialRelationship")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Relationship + public Hl7.Fhir.Model.CodeableConcept? Relationship { get { return _Relationship; } set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private Hl7.Fhir.Model.CodeableConcept _Relationship; + private Hl7.Fhir.Model.CodeableConcept? _Relationship; /// /// male | female | other | unknown. @@ -864,13 +840,13 @@ public Hl7.Fhir.Model.CodeableConcept Relationship [FhirElement("sex", InSummary=true, Order=190)] [Binding("Sex")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Sex + public Hl7.Fhir.Model.CodeableConcept? Sex { get { return _Sex; } set { _Sex = value; OnPropertyChanged("Sex"); } } - private Hl7.Fhir.Model.CodeableConcept _Sex; + private Hl7.Fhir.Model.CodeableConcept? _Sex; /// /// (approximate) date of birth. @@ -879,13 +855,13 @@ public Hl7.Fhir.Model.CodeableConcept Sex [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Born + public Hl7.Fhir.Model.DataType? Born { get { return _Born; } set { _Born = value; OnPropertyChanged("Born"); } } - private Hl7.Fhir.Model.DataType _Born; + private Hl7.Fhir.Model.DataType? _Born; /// /// (approximate) age. @@ -894,26 +870,26 @@ public Hl7.Fhir.Model.DataType Born [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Age + public Hl7.Fhir.Model.DataType? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.DataType _Age; + private Hl7.Fhir.Model.DataType? _Age; /// /// Age is estimated?. /// [FhirElement("estimatedAge", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement + public Hl7.Fhir.Model.FhirBoolean? EstimatedAgeElement { get { return _EstimatedAgeElement; } set { _EstimatedAgeElement = value; OnPropertyChanged("EstimatedAgeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EstimatedAgeElement; + private Hl7.Fhir.Model.FhirBoolean? _EstimatedAgeElement; /// /// Age is estimated? @@ -922,13 +898,10 @@ public Hl7.Fhir.Model.FhirBoolean EstimatedAgeElement [IgnoreDataMember] public bool? EstimatedAge { - get { return EstimatedAgeElement != null ? EstimatedAgeElement.Value : null; } + get => _EstimatedAgeElement?.Value; set { - if (value == null) - EstimatedAgeElement = null; - else - EstimatedAgeElement = new Hl7.Fhir.Model.FhirBoolean(value); + EstimatedAgeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EstimatedAge"); } } @@ -940,13 +913,13 @@ public bool? EstimatedAge [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// Why was family member history performed?. @@ -957,11 +930,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// General note about related person. @@ -971,11 +944,11 @@ public List Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Condition that the related person had. @@ -985,11 +958,11 @@ public List Note [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Procedures that the related person had. @@ -999,43 +972,39 @@ public List Condition [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as FamilyMemberHistory; - - if (dest == null) - { + if(other is not FamilyMemberHistory dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Relationship != null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopyInternal(); - if(Sex != null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)Sex.DeepCopyInternal(); - if(Born != null) dest.Born = (Hl7.Fhir.Model.DataType)Born.DeepCopyInternal(); - if(Age != null) dest.Age = (Hl7.Fhir.Model.DataType)Age.DeepCopyInternal(); - if(EstimatedAgeElement != null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)EstimatedAgeElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)_Relationship.DeepCopyInternal(); + if(_Sex is not null) dest.Sex = (Hl7.Fhir.Model.CodeableConcept)_Sex.DeepCopyInternal(); + if(_Born is not null) dest.Born = (Hl7.Fhir.Model.DataType)_Born.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.DataType)_Age.DeepCopyInternal(); + if(_EstimatedAgeElement is not null) dest.EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)_EstimatedAgeElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1047,160 +1016,160 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FamilyMemberHistory; - if(otherT == null) return false; + if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Sex, otherT.Sex)) return false; - if(!comparer.Equals(Born, otherT.Born)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(EstimatedAgeElement, otherT.EstimatedAgeElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Sex, otherT._Sex)) return false; + if(!comparer.Equals(_Born, otherT._Born)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_EstimatedAgeElement, otherT._EstimatedAgeElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "relationship": - value = Relationship; - return Relationship is not null; + value = _Relationship; + return _Relationship is not null; case "sex": - value = Sex; - return Sex is not null; + value = _Sex; + return _Sex is not null; case "born": - value = Born; - return Born is not null; + value = _Born; + return _Born is not null; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "estimatedAge": - value = EstimatedAgeElement; - return EstimatedAgeElement is not null; + value = _EstimatedAgeElement; + return _EstimatedAgeElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "relationship": - Relationship = (Hl7.Fhir.Model.CodeableConcept)value; + Relationship = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sex": - Sex = (Hl7.Fhir.Model.CodeableConcept)value; + Sex = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "born": - Born = (Hl7.Fhir.Model.DataType)value; + Born = (Hl7.Fhir.Model.DataType?)value; return this; case "age": - Age = (Hl7.Fhir.Model.DataType)value; + Age = (Hl7.Fhir.Model.DataType?)value; return this; case "estimatedAge": - EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean)value; + EstimatedAgeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1211,25 +1180,25 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Relationship is not null) yield return new KeyValuePair("relationship",Relationship); - if (Sex is not null) yield return new KeyValuePair("sex",Sex); - if (Born is not null) yield return new KeyValuePair("born",Born); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",EstimatedAgeElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Relationship is not null) yield return new KeyValuePair("relationship",_Relationship); + if (_Sex is not null) yield return new KeyValuePair("sex",_Sex); + if (_Born is not null) yield return new KeyValuePair("born",_Born); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_EstimatedAgeElement is not null) yield return new KeyValuePair("estimatedAge",_EstimatedAgeElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Flag.cs b/src/Hl7.Fhir.R5/Model/Generated/Flag.cs index 6aea57f5f..0fb7300ae 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Flag.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -95,11 +98,11 @@ public enum FlagStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error. @@ -109,13 +112,13 @@ public List Identifier [Binding("FlagStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -124,13 +127,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Flag.FlagStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -144,11 +144,11 @@ public Hl7.Fhir.Model.Flag.FlagStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Coded or textual message to display to user. @@ -157,13 +157,13 @@ public List Category [Binding("FlagCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/What is flag about?. @@ -173,26 +173,26 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","RelatedPerson","Location","Group","Organization","Practitioner","PractitionerRole","PlanDefinition","Medication","Procedure")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Time period when flag is active. /// [FhirElement("period", InSummary=true, Order=140, FiveWs="FiveWs.context")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Alert relevant during encounter. @@ -201,13 +201,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Flag creator. @@ -216,34 +216,30 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [References("Device","Organization","Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Flag; - - if (dest == null) - { + if(other is not Flag dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -255,83 +251,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Flag; - if(otherT == null) return false; + if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -342,14 +338,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Author is not null) yield return new KeyValuePair("author",Author); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Author is not null) yield return new KeyValuePair("author",_Author); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs b/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs index ac6833a8c..7fd8a789d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -95,11 +98,11 @@ public enum FormularyItemStatusCodes [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Codes that identify this formulary item. @@ -107,13 +110,13 @@ public List Identifier [FhirElement("code", InSummary=true, Order=100)] [Binding("FormularyItemFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | entered-in-error | inactive. @@ -122,13 +125,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("FormularyItemStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | entered-in-error | inactive @@ -137,13 +140,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FormularyItem.FormularyItemStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -152,17 +152,13 @@ public Hl7.Fhir.Model.FormularyItem.FormularyItemStatusCodes? Status protected internal override void CopyToInternal(Base other) { - var dest = other as FormularyItem; - - if (dest == null) - { + if(other is not FormularyItem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -174,48 +170,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FormularyItem; - if(otherT == null) return false; + if(other is not FormularyItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -226,9 +222,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs index 7bfb55322..1c25fca0f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -123,11 +126,11 @@ public partial class AnalysisComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Type of the methods used in the analysis (e.g., FISH, Karyotyping, MSI). @@ -138,11 +141,11 @@ public List Identifier [DataMember] public List MethodType { - get { if(_MethodType==null) _MethodType = new List(); return _MethodType; } + get => _MethodType ?? new List(); set { _MethodType = value; OnPropertyChanged("MethodType"); } } - private List _MethodType; + private List? _MethodType; /// /// Type of the genomic changes studied in the analysis (e.g., DNA, RNA, or AA change). @@ -153,11 +156,11 @@ public List MethodType [DataMember] public List ChangeType { - get { if(_ChangeType==null) _ChangeType = new List(); return _ChangeType; } + get => _ChangeType ?? new List(); set { _ChangeType = value; OnPropertyChanged("ChangeType"); } } - private List _ChangeType; + private List? _ChangeType; /// /// Genome build that is used in this analysis. @@ -165,41 +168,38 @@ public List ChangeType [FhirElement("genomeBuild", Order=70)] [Binding("HumanRefSeqNCBIBuildId")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept GenomeBuild + public Hl7.Fhir.Model.CodeableConcept? GenomeBuild { get { return _GenomeBuild; } set { _GenomeBuild = value; OnPropertyChanged("GenomeBuild"); } } - private Hl7.Fhir.Model.CodeableConcept _GenomeBuild; + private Hl7.Fhir.Model.CodeableConcept? _GenomeBuild; /// /// The defined protocol that describes the analysis. /// [FhirElement("instantiatesCanonical", Order=80)] [DataMember] - public Hl7.Fhir.Model.Canonical InstantiatesCanonicalElement + public Hl7.Fhir.Model.Canonical? InstantiatesCanonicalElement { get { return _InstantiatesCanonicalElement; } set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _InstantiatesCanonicalElement; + private Hl7.Fhir.Model.Canonical? _InstantiatesCanonicalElement; /// /// The defined protocol that describes the analysis /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesCanonical + public string? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Value : null; } + get => _InstantiatesCanonicalElement?.Value; set { - if (value == null) - InstantiatesCanonicalElement = null; - else - InstantiatesCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + InstantiatesCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InstantiatesCanonical"); } } @@ -209,28 +209,25 @@ public string InstantiatesCanonical /// [FhirElement("instantiatesUri", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// The URL pointing to an externally maintained protocol that describes the analysis /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -240,28 +237,25 @@ public string InstantiatesUri /// [FhirElement("title", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name of the analysis event (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -276,11 +270,11 @@ public string Title [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// The specimen used in the analysis event. @@ -292,39 +286,36 @@ public List Focus [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// The date of the analysis event. /// [FhirElement("date", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// The date of the analysis event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -337,11 +328,11 @@ public string Date [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The protocol that was performed for the analysis event. @@ -350,13 +341,13 @@ public List Note [CLSCompliant(false)] [References("Procedure","Task")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProtocolPerformed + public Hl7.Fhir.Model.ResourceReference? ProtocolPerformed { get { return _ProtocolPerformed; } set { _ProtocolPerformed = value; OnPropertyChanged("ProtocolPerformed"); } } - private Hl7.Fhir.Model.ResourceReference _ProtocolPerformed; + private Hl7.Fhir.Model.ResourceReference? _ProtocolPerformed; /// /// The genomic regions to be studied in the analysis (BED file). @@ -368,11 +359,11 @@ public Hl7.Fhir.Model.ResourceReference ProtocolPerformed [DataMember] public List RegionsStudied { - get { if(_RegionsStudied==null) _RegionsStudied = new List(); return _RegionsStudied; } + get => _RegionsStudied ?? new List(); set { _RegionsStudied = value; OnPropertyChanged("RegionsStudied"); } } - private List _RegionsStudied; + private List? _RegionsStudied; /// /// Genomic regions actually called in the analysis event (BED file). @@ -384,11 +375,11 @@ public List RegionsStudied [DataMember] public List RegionsCalled { - get { if(_RegionsCalled==null) _RegionsCalled = new List(); return _RegionsCalled; } + get => _RegionsCalled ?? new List(); set { _RegionsCalled = value; OnPropertyChanged("RegionsCalled"); } } - private List _RegionsCalled; + private List? _RegionsCalled; /// /// Inputs for the analysis event. @@ -398,11 +389,11 @@ public List RegionsCalled [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Outputs for the analysis event. @@ -412,11 +403,11 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; /// /// Performer for the analysis event. @@ -426,11 +417,11 @@ public List Output [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Devices used for the analysis (e.g., instruments, software), with settings and parameters. @@ -440,40 +431,36 @@ public List Performer [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; protected internal override void CopyToInternal(Base other) { - var dest = other as AnalysisComponent; - - if (dest == null) - { + if(other is not AnalysisComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(MethodType.Any()) dest.MethodType = new List(MethodType.DeepCopyInternal()); - if(ChangeType.Any()) dest.ChangeType = new List(ChangeType.DeepCopyInternal()); - if(GenomeBuild != null) dest.GenomeBuild = (Hl7.Fhir.Model.CodeableConcept)GenomeBuild.DeepCopyInternal(); - if(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)InstantiatesCanonicalElement.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(ProtocolPerformed != null) dest.ProtocolPerformed = (Hl7.Fhir.Model.ResourceReference)ProtocolPerformed.DeepCopyInternal(); - if(RegionsStudied.Any()) dest.RegionsStudied = new List(RegionsStudied.DeepCopyInternal()); - if(RegionsCalled.Any()) dest.RegionsCalled = new List(RegionsCalled.DeepCopyInternal()); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_MethodType is not null) dest.MethodType = new List(_MethodType.DeepCopyInternal()); + if(_ChangeType is not null) dest.ChangeType = new List(_ChangeType.DeepCopyInternal()); + if(_GenomeBuild is not null) dest.GenomeBuild = (Hl7.Fhir.Model.CodeableConcept)_GenomeBuild.DeepCopyInternal(); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)_InstantiatesCanonicalElement.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_ProtocolPerformed is not null) dest.ProtocolPerformed = (Hl7.Fhir.Model.ResourceReference)_ProtocolPerformed.DeepCopyInternal(); + if(_RegionsStudied is not null) dest.RegionsStudied = new List(_RegionsStudied.DeepCopyInternal()); + if(_RegionsCalled is not null) dest.RegionsCalled = new List(_RegionsCalled.DeepCopyInternal()); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -485,153 +472,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnalysisComponent; - if(otherT == null) return false; + if(other is not AnalysisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(MethodType, otherT.MethodType)) return false; - if(!comparer.ListEquals(ChangeType, otherT.ChangeType)) return false; - if(!comparer.Equals(GenomeBuild, otherT.GenomeBuild)) return false; - if(!comparer.Equals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(ProtocolPerformed, otherT.ProtocolPerformed)) return false; - if(!comparer.ListEquals(RegionsStudied, otherT.RegionsStudied)) return false; - if(!comparer.ListEquals(RegionsCalled, otherT.RegionsCalled)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_MethodType, otherT._MethodType)) return false; + if(!comparer.ListEquals(_ChangeType, otherT._ChangeType)) return false; + if(!comparer.Equals(_GenomeBuild, otherT._GenomeBuild)) return false; + if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_ProtocolPerformed, otherT._ProtocolPerformed)) return false; + if(!comparer.ListEquals(_RegionsStudied, otherT._RegionsStudied)) return false; + if(!comparer.ListEquals(_RegionsCalled, otherT._RegionsCalled)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "methodType": - value = MethodType; - return MethodType?.Any() == true; + value = _MethodType; + return _MethodType?.Any() == true; case "changeType": - value = ChangeType; - return ChangeType?.Any() == true; + value = _ChangeType; + return _ChangeType?.Any() == true; case "genomeBuild": - value = GenomeBuild; - return GenomeBuild is not null; + value = _GenomeBuild; + return _GenomeBuild is not null; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement is not null; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "protocolPerformed": - value = ProtocolPerformed; - return ProtocolPerformed is not null; + value = _ProtocolPerformed; + return _ProtocolPerformed is not null; case "regionsStudied": - value = RegionsStudied; - return RegionsStudied?.Any() == true; + value = _RegionsStudied; + return _RegionsStudied?.Any() == true; case "regionsCalled": - value = RegionsCalled; - return RegionsCalled?.Any() == true; + value = _RegionsCalled; + return _RegionsCalled?.Any() == true; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "methodType": - MethodType = (List)value; + MethodType = (List?)value!; return this; case "changeType": - ChangeType = (List)value; + ChangeType = (List?)value!; return this; case "genomeBuild": - GenomeBuild = (Hl7.Fhir.Model.CodeableConcept)value; + GenomeBuild = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "protocolPerformed": - ProtocolPerformed = (Hl7.Fhir.Model.ResourceReference)value; + ProtocolPerformed = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "regionsStudied": - RegionsStudied = (List)value; + RegionsStudied = (List?)value!; return this; case "regionsCalled": - RegionsCalled = (List)value; + RegionsCalled = (List?)value!; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; default: return base.SetValue(key, value); @@ -642,24 +629,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (MethodType?.Any() == true) yield return new KeyValuePair("methodType",MethodType); - if (ChangeType?.Any() == true) yield return new KeyValuePair("changeType",ChangeType); - if (GenomeBuild is not null) yield return new KeyValuePair("genomeBuild",GenomeBuild); - if (InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (ProtocolPerformed is not null) yield return new KeyValuePair("protocolPerformed",ProtocolPerformed); - if (RegionsStudied?.Any() == true) yield return new KeyValuePair("regionsStudied",RegionsStudied); - if (RegionsCalled?.Any() == true) yield return new KeyValuePair("regionsCalled",RegionsCalled); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_MethodType?.Any() == true) yield return new KeyValuePair("methodType",_MethodType); + if (_ChangeType?.Any() == true) yield return new KeyValuePair("changeType",_ChangeType); + if (_GenomeBuild is not null) yield return new KeyValuePair("genomeBuild",_GenomeBuild); + if (_InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_ProtocolPerformed is not null) yield return new KeyValuePair("protocolPerformed",_ProtocolPerformed); + if (_RegionsStudied?.Any() == true) yield return new KeyValuePair("regionsStudied",_RegionsStudied); + if (_RegionsCalled?.Any() == true) yield return new KeyValuePair("regionsCalled",_RegionsCalled); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); } } @@ -684,13 +671,13 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("DocumentReference")] [DataMember] - public Hl7.Fhir.Model.ResourceReference File + public Hl7.Fhir.Model.ResourceReference? File { get { return _File; } set { _File = value; OnPropertyChanged("File"); } } - private Hl7.Fhir.Model.ResourceReference _File; + private Hl7.Fhir.Model.ResourceReference? _File; /// /// Type of input data (e.g., BAM, CRAM, or FASTA). @@ -698,13 +685,13 @@ public Hl7.Fhir.Model.ResourceReference File [FhirElement("type", Order=50)] [Binding("GenomicStudyDataFormat")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The analysis event or other GenomicStudy that generated this input file. @@ -714,27 +701,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("GenomicStudy")] [AllowedTypes(typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType GeneratedBy + public Hl7.Fhir.Model.DataType? GeneratedBy { get { return _GeneratedBy; } set { _GeneratedBy = value; OnPropertyChanged("GeneratedBy"); } } - private Hl7.Fhir.Model.DataType _GeneratedBy; + private Hl7.Fhir.Model.DataType? _GeneratedBy; protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(File != null) dest.File = (Hl7.Fhir.Model.ResourceReference)File.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GeneratedBy != null) dest.GeneratedBy = (Hl7.Fhir.Model.DataType)GeneratedBy.DeepCopyInternal(); + if(_File is not null) dest.File = (Hl7.Fhir.Model.ResourceReference)_File.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GeneratedBy is not null) dest.GeneratedBy = (Hl7.Fhir.Model.DataType)_GeneratedBy.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -746,48 +729,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(File, otherT.File)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GeneratedBy, otherT.GeneratedBy)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_File, otherT._File)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GeneratedBy, otherT._GeneratedBy)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "file": - value = File; - return File is not null; + value = _File; + return _File is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "generatedBy": - value = GeneratedBy; - return GeneratedBy is not null; + value = _GeneratedBy; + return _GeneratedBy is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "file": - File = (Hl7.Fhir.Model.ResourceReference)value; + File = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "generatedBy": - GeneratedBy = (Hl7.Fhir.Model.DataType)value; + GeneratedBy = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -798,9 +781,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (File is not null) yield return new KeyValuePair("file",File); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GeneratedBy is not null) yield return new KeyValuePair("generatedBy",GeneratedBy); + if (_File is not null) yield return new KeyValuePair("file",_File); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GeneratedBy is not null) yield return new KeyValuePair("generatedBy",_GeneratedBy); } } @@ -825,13 +808,13 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("DocumentReference")] [DataMember] - public Hl7.Fhir.Model.ResourceReference File + public Hl7.Fhir.Model.ResourceReference? File { get { return _File; } set { _File = value; OnPropertyChanged("File"); } } - private Hl7.Fhir.Model.ResourceReference _File; + private Hl7.Fhir.Model.ResourceReference? _File; /// /// Type of output data (e.g., VCF, MAF, or BAM). @@ -839,26 +822,22 @@ public Hl7.Fhir.Model.ResourceReference File [FhirElement("type", InSummary=true, Order=50)] [Binding("GenomicStudyDataFormat")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(File != null) dest.File = (Hl7.Fhir.Model.ResourceReference)File.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_File is not null) dest.File = (Hl7.Fhir.Model.ResourceReference)_File.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -870,41 +849,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(File, otherT.File)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_File, otherT._File)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "file": - value = File; - return File is not null; + value = _File; + return _File is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "file": - File = (Hl7.Fhir.Model.ResourceReference)value; + File = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -915,8 +894,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (File is not null) yield return new KeyValuePair("file",File); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_File is not null) yield return new KeyValuePair("file",_File); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -941,39 +920,35 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Role of the actor for this analysis. /// [FhirElement("role", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -985,41 +960,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1030,8 +1005,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -1056,39 +1031,35 @@ public partial class DeviceComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Specific function for the device used for the analysis. /// [FhirElement("function", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; protected internal override void CopyToInternal(Base other) { - var dest = other as DeviceComponent; - - if (dest == null) - { + if(other is not DeviceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1100,41 +1071,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DeviceComponent; - if(otherT == null) return false; + if(other is not DeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Function, otherT._Function)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1145,8 +1116,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Function is not null) yield return new KeyValuePair("function",Function); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Function is not null) yield return new KeyValuePair("function",_Function); } } @@ -1159,11 +1130,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// registered | available | cancelled | entered-in-error | unknown. @@ -1173,13 +1144,13 @@ public List Identifier [Binding("GenomicStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | available | cancelled | entered-in-error | unknown @@ -1188,13 +1159,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.GenomicStudy.GenomicStudyStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1208,11 +1176,11 @@ public Hl7.Fhir.Model.GenomicStudy.GenomicStudyStatus? Status [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// The primary subject of the genomic study. @@ -1222,13 +1190,13 @@ public List Type [References("Patient","Group","Substance","BiologicallyDerivedProduct","NutritionProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The healthcare event with which this genomics study is associated. @@ -1237,41 +1205,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the genomic study was started. /// [FhirElement("startDate", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartDateElement + public Hl7.Fhir.Model.FhirDateTime? StartDateElement { get { return _StartDateElement; } set { _StartDateElement = value; OnPropertyChanged("StartDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StartDateElement; /// /// When the genomic study was started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StartDate + public string? StartDate { - get { return StartDateElement != null ? StartDateElement.Value : null; } + get => _StartDateElement?.Value; set { - if (value == null) - StartDateElement = null; - else - StartDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StartDate"); } } @@ -1286,11 +1251,11 @@ public string StartDate [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Healthcare professional who requested or referred the genomic study. @@ -1299,13 +1264,13 @@ public List BasedOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referrer + public Hl7.Fhir.Model.ResourceReference? Referrer { get { return _Referrer; } set { _Referrer = value; OnPropertyChanged("Referrer"); } } - private Hl7.Fhir.Model.ResourceReference _Referrer; + private Hl7.Fhir.Model.ResourceReference? _Referrer; /// /// Healthcare professionals who interpreted the genomic study. @@ -1317,11 +1282,11 @@ public Hl7.Fhir.Model.ResourceReference Referrer [DataMember] public List Interpreter { - get { if(_Interpreter==null) _Interpreter = new List(); return _Interpreter; } + get => _Interpreter ?? new List(); set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } - private List _Interpreter; + private List? _Interpreter; /// /// Why the genomic study was performed. @@ -1331,39 +1296,36 @@ public List Interpreter [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// The defined protocol that describes the study. /// [FhirElement("instantiatesCanonical", Order=190)] [DataMember] - public Hl7.Fhir.Model.Canonical InstantiatesCanonicalElement + public Hl7.Fhir.Model.Canonical? InstantiatesCanonicalElement { get { return _InstantiatesCanonicalElement; } set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _InstantiatesCanonicalElement; + private Hl7.Fhir.Model.Canonical? _InstantiatesCanonicalElement; /// /// The defined protocol that describes the study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesCanonical + public string? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Value : null; } + get => _InstantiatesCanonicalElement?.Value; set { - if (value == null) - InstantiatesCanonicalElement = null; - else - InstantiatesCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + InstantiatesCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InstantiatesCanonical"); } } @@ -1373,28 +1335,25 @@ public string InstantiatesCanonical /// [FhirElement("instantiatesUri", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// The URL pointing to an externally maintained protocol that describes the study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -1407,39 +1366,36 @@ public string InstantiatesUri [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Description of the genomic study. /// [FhirElement("description", Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of the genomic study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1452,39 +1408,35 @@ public string Description [DataMember] public List Analysis { - get { if(_Analysis==null) _Analysis = new List(); return _Analysis; } + get => _Analysis ?? new List(); set { _Analysis = value; OnPropertyChanged("Analysis"); } } - private List _Analysis; + private List? _Analysis; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as GenomicStudy; - - if (dest == null) - { + if(other is not GenomicStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(StartDateElement != null) dest.StartDateElement = (Hl7.Fhir.Model.FhirDateTime)StartDateElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Referrer != null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)Referrer.DeepCopyInternal(); - if(Interpreter.Any()) dest.Interpreter = new List(Interpreter.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)InstantiatesCanonicalElement.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Analysis.Any()) dest.Analysis = new List(Analysis.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_StartDateElement is not null) dest.StartDateElement = (Hl7.Fhir.Model.FhirDateTime)_StartDateElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Referrer is not null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)_Referrer.DeepCopyInternal(); + if(_Interpreter is not null) dest.Interpreter = new List(_Interpreter.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)_InstantiatesCanonicalElement.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Analysis is not null) dest.Analysis = new List(_Analysis.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1496,132 +1448,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GenomicStudy; - if(otherT == null) return false; + if(other is not GenomicStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(StartDateElement, otherT.StartDateElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Referrer, otherT.Referrer)) return false; - if(!comparer.ListEquals(Interpreter, otherT.Interpreter)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Analysis, otherT.Analysis)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_StartDateElement, otherT._StartDateElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Referrer, otherT._Referrer)) return false; + if(!comparer.ListEquals(_Interpreter, otherT._Interpreter)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Analysis, otherT._Analysis)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "startDate": - value = StartDateElement; - return StartDateElement is not null; + value = _StartDateElement; + return _StartDateElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "referrer": - value = Referrer; - return Referrer is not null; + value = _Referrer; + return _Referrer is not null; case "interpreter": - value = Interpreter; - return Interpreter?.Any() == true; + value = _Interpreter; + return _Interpreter?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement is not null; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "analysis": - value = Analysis; - return Analysis?.Any() == true; + value = _Analysis; + return _Analysis?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "startDate": - StartDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "referrer": - Referrer = (Hl7.Fhir.Model.ResourceReference)value; + Referrer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "interpreter": - Interpreter = (List)value; + Interpreter = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "analysis": - Analysis = (List)value; + Analysis = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1632,21 +1584,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (StartDateElement is not null) yield return new KeyValuePair("startDate",StartDateElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Referrer is not null) yield return new KeyValuePair("referrer",Referrer); - if (Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",Interpreter); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Analysis?.Any() == true) yield return new KeyValuePair("analysis",Analysis); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_StartDateElement is not null) yield return new KeyValuePair("startDate",_StartDateElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Referrer is not null) yield return new KeyValuePair("referrer",_Referrer); + if (_Interpreter?.Any() == true) yield return new KeyValuePair("interpreter",_Interpreter); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Analysis?.Any() == true) yield return new KeyValuePair("analysis",_Analysis); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Goal.cs b/src/Hl7.Fhir.R5/Model/Generated/Goal.cs index 2183ba78d..166e350df 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Goal.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -147,13 +150,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", InSummary=true, Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -163,13 +166,13 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal on or before. @@ -178,27 +181,23 @@ public Hl7.Fhir.Model.DataType Detail [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType Due + public Hl7.Fhir.Model.DataType? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.DataType _Due; + private Hl7.Fhir.Model.DataType? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.DataType)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.DataType)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -210,48 +209,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.DataType)value; + Due = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -262,9 +261,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -277,11 +276,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected. @@ -291,13 +290,13 @@ public List Identifier [Binding("GoalLifecycleStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code LifecycleStatusElement + public Code? LifecycleStatusElement { get { return _LifecycleStatusElement; } set { _LifecycleStatusElement = value; OnPropertyChanged("LifecycleStatusElement"); } } - private Code _LifecycleStatusElement; + private Code? _LifecycleStatusElement; /// /// proposed | planned | accepted | active | on-hold | completed | cancelled | entered-in-error | rejected @@ -306,13 +305,10 @@ public Code LifecycleStatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Goal.GoalLifecycleStatus? LifecycleStatus { - get { return LifecycleStatusElement != null ? LifecycleStatusElement.Value : null; } + get => _LifecycleStatusElement?.Value; set { - if (value == null) - LifecycleStatusElement = null; - else - LifecycleStatusElement = new Code(value); + LifecycleStatusElement = value is null ? null : new Code(value); OnPropertyChanged("LifecycleStatus"); } } @@ -323,13 +319,13 @@ public Hl7.Fhir.Model.Goal.GoalLifecycleStatus? LifecycleStatus [FhirElement("achievementStatus", InSummary=true, Order=110)] [Binding("GoalAchievementStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AchievementStatus + public Hl7.Fhir.Model.CodeableConcept? AchievementStatus { get { return _AchievementStatus; } set { _AchievementStatus = value; OnPropertyChanged("AchievementStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _AchievementStatus; + private Hl7.Fhir.Model.CodeableConcept? _AchievementStatus; /// /// E.g. Treatment, dietary, behavioral, etc. @@ -340,24 +336,24 @@ public Hl7.Fhir.Model.CodeableConcept AchievementStatus [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// After meeting the goal, ongoing activity is needed to sustain the goal objective. /// [FhirElement("continuous", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ContinuousElement + public Hl7.Fhir.Model.FhirBoolean? ContinuousElement { get { return _ContinuousElement; } set { _ContinuousElement = value; OnPropertyChanged("ContinuousElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ContinuousElement; + private Hl7.Fhir.Model.FhirBoolean? _ContinuousElement; /// /// After meeting the goal, ongoing activity is needed to sustain the goal objective @@ -366,13 +362,10 @@ public Hl7.Fhir.Model.FhirBoolean ContinuousElement [IgnoreDataMember] public bool? Continuous { - get { return ContinuousElement != null ? ContinuousElement.Value : null; } + get => _ContinuousElement?.Value; set { - if (value == null) - ContinuousElement = null; - else - ContinuousElement = new Hl7.Fhir.Model.FhirBoolean(value); + ContinuousElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Continuous"); } } @@ -383,13 +376,13 @@ public bool? Continuous [FhirElement("priority", InSummary=true, Order=140, FiveWs="FiveWs.grade")] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// Code or text describing goal. @@ -398,13 +391,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// Who this goal is intended for. @@ -414,13 +407,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [References("Patient","Group","Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When goal pursuit begins. @@ -430,13 +423,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType Start + public Hl7.Fhir.Model.DataType? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.DataType _Start; + private Hl7.Fhir.Model.DataType? _Start; /// /// Target outcome for the goal. @@ -446,39 +439,36 @@ public Hl7.Fhir.Model.DataType Start [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// When goal status took effect. /// [FhirElement("statusDate", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Date StatusDateElement + public Hl7.Fhir.Model.Date? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.Date _StatusDateElement; + private Hl7.Fhir.Model.Date? _StatusDateElement; /// /// When goal status took effect /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.Date(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("StatusDate"); } } @@ -488,28 +478,25 @@ public string StatusDate /// [FhirElement("statusReason", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString StatusReasonElement + public Hl7.Fhir.Model.FhirString? StatusReasonElement { get { return _StatusReasonElement; } set { _StatusReasonElement = value; OnPropertyChanged("StatusReasonElement"); } } - private Hl7.Fhir.Model.FhirString _StatusReasonElement; + private Hl7.Fhir.Model.FhirString? _StatusReasonElement; /// /// Reason for current status /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusReason + public string? StatusReason { - get { return StatusReasonElement != null ? StatusReasonElement.Value : null; } + get => _StatusReasonElement?.Value; set { - if (value == null) - StatusReasonElement = null; - else - StatusReasonElement = new Hl7.Fhir.Model.FhirString(value); + StatusReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("StatusReason"); } } @@ -521,13 +508,13 @@ public string StatusReason [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Issues addressed by this goal. @@ -539,11 +526,11 @@ public Hl7.Fhir.Model.ResourceReference Source [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Comments about the goal. @@ -553,11 +540,11 @@ public List Addresses [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// What result was achieved regarding the goal?. @@ -568,40 +555,36 @@ public List Note [DataMember] public List Outcome { - get { if(_Outcome==null) _Outcome = new List(); return _Outcome; } + get => _Outcome ?? new List(); set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private List _Outcome; + private List? _Outcome; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Goal; - - if (dest == null) - { + if(other is not Goal dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(LifecycleStatusElement != null) dest.LifecycleStatusElement = (Code)LifecycleStatusElement.DeepCopyInternal(); - if(AchievementStatus != null) dest.AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)AchievementStatus.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(ContinuousElement != null) dest.ContinuousElement = (Hl7.Fhir.Model.FhirBoolean)ContinuousElement.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.DataType)Start.DeepCopyInternal(); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)StatusDateElement.DeepCopyInternal(); - if(StatusReasonElement != null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)StatusReasonElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Outcome.Any()) dest.Outcome = new List(Outcome.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_LifecycleStatusElement is not null) dest.LifecycleStatusElement = (Code)_LifecycleStatusElement.DeepCopyInternal(); + if(_AchievementStatus is not null) dest.AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)_AchievementStatus.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_ContinuousElement is not null) dest.ContinuousElement = (Hl7.Fhir.Model.FhirBoolean)_ContinuousElement.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.DataType)_Start.DeepCopyInternal(); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.Date)_StatusDateElement.DeepCopyInternal(); + if(_StatusReasonElement is not null) dest.StatusReasonElement = (Hl7.Fhir.Model.FhirString)_StatusReasonElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Outcome is not null) dest.Outcome = new List(_Outcome.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -613,139 +596,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Goal; - if(otherT == null) return false; + if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(LifecycleStatusElement, otherT.LifecycleStatusElement)) return false; - if(!comparer.Equals(AchievementStatus, otherT.AchievementStatus)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(ContinuousElement, otherT.ContinuousElement)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(StatusReasonElement, otherT.StatusReasonElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Outcome, otherT.Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_LifecycleStatusElement, otherT._LifecycleStatusElement)) return false; + if(!comparer.Equals(_AchievementStatus, otherT._AchievementStatus)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_ContinuousElement, otherT._ContinuousElement)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_StatusReasonElement, otherT._StatusReasonElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Outcome, otherT._Outcome)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "lifecycleStatus": - value = LifecycleStatusElement; - return LifecycleStatusElement is not null; + value = _LifecycleStatusElement; + return _LifecycleStatusElement is not null; case "achievementStatus": - value = AchievementStatus; - return AchievementStatus is not null; + value = _AchievementStatus; + return _AchievementStatus is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "continuous": - value = ContinuousElement; - return ContinuousElement is not null; + value = _ContinuousElement; + return _ContinuousElement is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "statusReason": - value = StatusReasonElement; - return StatusReasonElement is not null; + value = _StatusReasonElement; + return _StatusReasonElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "outcome": - value = Outcome; - return Outcome?.Any() == true; + value = _Outcome; + return _Outcome?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "lifecycleStatus": - LifecycleStatusElement = (Code)value; + LifecycleStatusElement = (Code?)value; return this; case "achievementStatus": - AchievementStatus = (Hl7.Fhir.Model.CodeableConcept)value; + AchievementStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "continuous": - ContinuousElement = (Hl7.Fhir.Model.FhirBoolean)value; + ContinuousElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "start": - Start = (Hl7.Fhir.Model.DataType)value; + Start = (Hl7.Fhir.Model.DataType?)value; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.Date)value; + StatusDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "statusReason": - StatusReasonElement = (Hl7.Fhir.Model.FhirString)value; + StatusReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "outcome": - Outcome = (List)value; + Outcome = (List?)value!; return this; default: return base.SetValue(key, value); @@ -756,22 +739,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (LifecycleStatusElement is not null) yield return new KeyValuePair("lifecycleStatus",LifecycleStatusElement); - if (AchievementStatus is not null) yield return new KeyValuePair("achievementStatus",AchievementStatus); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (ContinuousElement is not null) yield return new KeyValuePair("continuous",ContinuousElement); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (StatusReasonElement is not null) yield return new KeyValuePair("statusReason",StatusReasonElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Outcome?.Any() == true) yield return new KeyValuePair("outcome",Outcome); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_LifecycleStatusElement is not null) yield return new KeyValuePair("lifecycleStatus",_LifecycleStatusElement); + if (_AchievementStatus is not null) yield return new KeyValuePair("achievementStatus",_AchievementStatus); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_ContinuousElement is not null) yield return new KeyValuePair("continuous",_ContinuousElement); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_StatusReasonElement is not null) yield return new KeyValuePair("statusReason",_StatusReasonElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Outcome?.Any() == true) yield return new KeyValuePair("outcome",_Outcome); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs index 2ee44bd61..ae9a33611 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -134,28 +137,25 @@ public partial class NodeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("nodeId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NodeIdElement + public Hl7.Fhir.Model.Id? NodeIdElement { get { return _NodeIdElement; } set { _NodeIdElement = value; OnPropertyChanged("NodeIdElement"); } } - private Hl7.Fhir.Model.Id _NodeIdElement; + private Hl7.Fhir.Model.Id? _NodeIdElement; /// /// Internal ID - target for link references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string NodeId + public string? NodeId { - get { return NodeIdElement != null ? NodeIdElement.Value : null; } + get => _NodeIdElement?.Value; set { - if (value == null) - NodeIdElement = null; - else - NodeIdElement = new Hl7.Fhir.Model.Id(value); + NodeIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("NodeId"); } } @@ -165,28 +165,25 @@ public string NodeId /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why this node is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -199,13 +196,13 @@ public string Description [Binding("FHIRTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type of resource this link refers to @@ -214,13 +211,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.VersionIndependentResourceTypesAll? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -230,46 +224,39 @@ public Hl7.Fhir.Model.VersionIndependentResourceTypesAll? Type /// [FhirElement("profile", Order=70)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile for the target resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NodeComponent; - - if (dest == null) - { + if(other is not NodeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NodeIdElement != null) dest.NodeIdElement = (Hl7.Fhir.Model.Id)NodeIdElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_NodeIdElement is not null) dest.NodeIdElement = (Hl7.Fhir.Model.Id)_NodeIdElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -281,55 +268,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NodeComponent; - if(otherT == null) return false; + if(other is not NodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NodeIdElement, otherT.NodeIdElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NodeIdElement, otherT._NodeIdElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "nodeId": - value = NodeIdElement; - return NodeIdElement is not null; + value = _NodeIdElement; + return _NodeIdElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "nodeId": - NodeIdElement = (Hl7.Fhir.Model.Id)value; + NodeIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -340,10 +327,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NodeIdElement is not null) yield return new KeyValuePair("nodeId",NodeIdElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_NodeIdElement is not null) yield return new KeyValuePair("nodeId",_NodeIdElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } @@ -366,28 +353,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Why this link is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -397,13 +381,13 @@ public string Description /// [FhirElement("min", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum occurrences for this link @@ -412,13 +396,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -428,28 +409,25 @@ public int? Min /// [FhirElement("max", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum occurrences for this link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -460,28 +438,25 @@ public string Max [FhirElement("sourceId", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Source Node for this link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -491,28 +466,25 @@ public string SourceId /// [FhirElement("path", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// Path in the resource that contains the link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -522,28 +494,25 @@ public string Path /// [FhirElement("sliceName", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString SliceNameElement + public Hl7.Fhir.Model.FhirString? SliceNameElement { get { return _SliceNameElement; } set { _SliceNameElement = value; OnPropertyChanged("SliceNameElement"); } } - private Hl7.Fhir.Model.FhirString _SliceNameElement; + private Hl7.Fhir.Model.FhirString? _SliceNameElement; /// /// Which slice (if profiled) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SliceName + public string? SliceName { - get { return SliceNameElement != null ? SliceNameElement.Value : null; } + get => _SliceNameElement?.Value; set { - if (value == null) - SliceNameElement = null; - else - SliceNameElement = new Hl7.Fhir.Model.FhirString(value); + SliceNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SliceName"); } } @@ -554,28 +523,25 @@ public string SliceName [FhirElement("targetId", Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id TargetIdElement + public Hl7.Fhir.Model.Id? TargetIdElement { get { return _TargetIdElement; } set { _TargetIdElement = value; OnPropertyChanged("TargetIdElement"); } } - private Hl7.Fhir.Model.Id _TargetIdElement; + private Hl7.Fhir.Model.Id? _TargetIdElement; /// /// Target Node for this link /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetId + public string? TargetId { - get { return TargetIdElement != null ? TargetIdElement.Value : null; } + get => _TargetIdElement?.Value; set { - if (value == null) - TargetIdElement = null; - else - TargetIdElement = new Hl7.Fhir.Model.Id(value); + TargetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("TargetId"); } } @@ -585,28 +551,25 @@ public string TargetId /// [FhirElement("params", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString ParamsElement + public Hl7.Fhir.Model.FhirString? ParamsElement { get { return _ParamsElement; } set { _ParamsElement = value; OnPropertyChanged("ParamsElement"); } } - private Hl7.Fhir.Model.FhirString _ParamsElement; + private Hl7.Fhir.Model.FhirString? _ParamsElement; /// /// Criteria for reverse lookup /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Params + public string? Params { - get { return ParamsElement != null ? ParamsElement.Value : null; } + get => _ParamsElement?.Value; set { - if (value == null) - ParamsElement = null; - else - ParamsElement = new Hl7.Fhir.Model.FhirString(value); + ParamsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Params"); } } @@ -619,31 +582,27 @@ public string Params [DataMember] public List Compartment { - get { if(_Compartment==null) _Compartment = new List(); return _Compartment; } + get => _Compartment ?? new List(); set { _Compartment = value; OnPropertyChanged("Compartment"); } } - private List _Compartment; + private List? _Compartment; protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SliceNameElement != null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)SliceNameElement.DeepCopyInternal(); - if(TargetIdElement != null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)TargetIdElement.DeepCopyInternal(); - if(ParamsElement != null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)ParamsElement.DeepCopyInternal(); - if(Compartment.Any()) dest.Compartment = new List(Compartment.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SliceNameElement is not null) dest.SliceNameElement = (Hl7.Fhir.Model.FhirString)_SliceNameElement.DeepCopyInternal(); + if(_TargetIdElement is not null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)_TargetIdElement.DeepCopyInternal(); + if(_ParamsElement is not null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)_ParamsElement.DeepCopyInternal(); + if(_Compartment is not null) dest.Compartment = new List(_Compartment.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -655,90 +614,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SliceNameElement, otherT.SliceNameElement)) return false; - if(!comparer.Equals(TargetIdElement, otherT.TargetIdElement)) return false; - if(!comparer.Equals(ParamsElement, otherT.ParamsElement)) return false; - if(!comparer.ListEquals(Compartment, otherT.Compartment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; + if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; + if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sliceName": - value = SliceNameElement; - return SliceNameElement is not null; + value = _SliceNameElement; + return _SliceNameElement is not null; case "targetId": - value = TargetIdElement; - return TargetIdElement is not null; + value = _TargetIdElement; + return _TargetIdElement is not null; case "params": - value = ParamsElement; - return ParamsElement is not null; + value = _ParamsElement; + return _ParamsElement is not null; case "compartment": - value = Compartment; - return Compartment?.Any() == true; + value = _Compartment; + return _Compartment?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sliceName": - SliceNameElement = (Hl7.Fhir.Model.FhirString)value; + SliceNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "targetId": - TargetIdElement = (Hl7.Fhir.Model.Id)value; + TargetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "params": - ParamsElement = (Hl7.Fhir.Model.FhirString)value; + ParamsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compartment": - Compartment = (List)value; + Compartment = (List?)value!; return this; default: return base.SetValue(key, value); @@ -749,15 +708,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SliceNameElement is not null) yield return new KeyValuePair("sliceName",SliceNameElement); - if (TargetIdElement is not null) yield return new KeyValuePair("targetId",TargetIdElement); - if (ParamsElement is not null) yield return new KeyValuePair("params",ParamsElement); - if (Compartment?.Any() == true) yield return new KeyValuePair("compartment",Compartment); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SliceNameElement is not null) yield return new KeyValuePair("sliceName",_SliceNameElement); + if (_TargetIdElement is not null) yield return new KeyValuePair("targetId",_TargetIdElement); + if (_ParamsElement is not null) yield return new KeyValuePair("params",_ParamsElement); + if (_Compartment?.Any() == true) yield return new KeyValuePair("compartment",_Compartment); } } @@ -783,13 +742,13 @@ public partial class CompartmentComponent : Hl7.Fhir.Model.BackboneElement [Binding("GraphCompartmentUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// where | requires @@ -798,13 +757,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -817,13 +773,13 @@ public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentUse? Use [Binding("GraphCompartmentRule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RuleElement + public Code? RuleElement { get { return _RuleElement; } set { _RuleElement = value; OnPropertyChanged("RuleElement"); } } - private Code _RuleElement; + private Code? _RuleElement; /// /// identical | matching | different | custom @@ -832,13 +788,10 @@ public Code RuleElement [IgnoreDataMember] public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule { - get { return RuleElement != null ? RuleElement.Value : null; } + get => _RuleElement?.Value; set { - if (value == null) - RuleElement = null; - else - RuleElement = new Code(value); + RuleElement = value is null ? null : new Code(value); OnPropertyChanged("Rule"); } } @@ -851,13 +804,13 @@ public Hl7.Fhir.Model.GraphDefinition.GraphCompartmentRule? Rule [Binding("CompartmentCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Patient | Encounter | RelatedPerson | Practitioner | Device | EpisodeOfCare @@ -866,13 +819,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.CompartmentType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -882,28 +832,25 @@ public Hl7.Fhir.Model.CompartmentType? Code /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Custom rule, as a FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -913,47 +860,40 @@ public string Expression /// [FhirElement("description", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Documentation for FHIRPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CompartmentComponent; - - if (dest == null) - { + if(other is not CompartmentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(RuleElement != null) dest.RuleElement = (Code)RuleElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_RuleElement is not null) dest.RuleElement = (Code)_RuleElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -965,62 +905,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CompartmentComponent; - if(otherT == null) return false; + if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(RuleElement, otherT.RuleElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "rule": - value = RuleElement; - return RuleElement is not null; + value = _RuleElement; + return _RuleElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "rule": - RuleElement = (Code)value; + RuleElement = (Code?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1031,11 +971,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (RuleElement is not null) yield return new KeyValuePair("rule",RuleElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_RuleElement is not null) yield return new KeyValuePair("rule",_RuleElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -1045,28 +985,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this graph definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1079,39 +1016,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the graph definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1124,13 +1058,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this graph definition (computer friendly). @@ -1138,28 +1072,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this graph definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1169,28 +1100,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this graph definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1203,13 +1131,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1218,13 +1146,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1234,13 +1159,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1249,13 +1174,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1265,28 +1187,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1296,28 +1215,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1330,39 +1246,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the graph definition. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the graph definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1375,11 +1288,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for graph definition (if applicable). @@ -1390,39 +1303,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this graph definition is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this graph definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1432,28 +1342,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1463,28 +1370,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1494,28 +1398,25 @@ public string CopyrightLabel /// [FhirElement("start", Order=260)] [DataMember] - public Hl7.Fhir.Model.Id StartElement + public Hl7.Fhir.Model.Id? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Id _StartElement; + private Hl7.Fhir.Model.Id? _StartElement; /// /// Starting Node /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Start + public string? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Id(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Start"); } } @@ -1528,11 +1429,11 @@ public string Start [DataMember] public List Node { - get { if(_Node==null) _Node = new List(); return _Node; } + get => _Node ?? new List(); set { _Node = value; OnPropertyChanged("Node"); } } - private List _Node; + private List? _Node; /// /// Links this graph makes rules about. @@ -1542,44 +1443,40 @@ public List Node [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as GraphDefinition; - - if (dest == null) - { + if(other is not GraphDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Id)StartElement.DeepCopyInternal(); - if(Node.Any()) dest.Node = new List(Node.DeepCopyInternal()); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Id)_StartElement.DeepCopyInternal(); + if(_Node is not null) dest.Node = new List(_Node.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1591,167 +1488,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GraphDefinition; - if(otherT == null) return false; + if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.ListEquals(Node, otherT.Node)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.ListEquals(_Node, otherT._Node)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "node": - value = Node; - return Node?.Any() == true; + value = _Node; + return _Node?.Any() == true; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Id)value; + StartElement = (Hl7.Fhir.Model.Id?)value; return this; case "node": - Node = (List)value; + Node = (List?)value!; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1762,26 +1659,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (Node?.Any() == true) yield return new KeyValuePair("node",Node); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_Node?.Any() == true) yield return new KeyValuePair("node",_Node); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Group.cs b/src/Hl7.Fhir.R5/Model/Generated/Group.cs index f59c726b2..a79b3e353 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Group.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -176,13 +179,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("GroupCharacteristicKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value held by characteristic. @@ -193,13 +196,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Group includes or excludes. @@ -207,13 +210,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("exclude", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExcludeElement + public Hl7.Fhir.Model.FhirBoolean? ExcludeElement { get { return _ExcludeElement; } set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExcludeElement; + private Hl7.Fhir.Model.FhirBoolean? _ExcludeElement; /// /// Group includes or excludes @@ -222,13 +225,10 @@ public Hl7.Fhir.Model.FhirBoolean ExcludeElement [IgnoreDataMember] public bool? Exclude { - get { return ExcludeElement != null ? ExcludeElement.Value : null; } + get => _ExcludeElement?.Value; set { - if (value == null) - ExcludeElement = null; - else - ExcludeElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExcludeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Exclude"); } } @@ -238,28 +238,24 @@ public bool? Exclude /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(ExcludeElement != null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)ExcludeElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_ExcludeElement is not null) dest.ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)_ExcludeElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -271,55 +267,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(ExcludeElement, otherT.ExcludeElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "exclude": - value = ExcludeElement; - return ExcludeElement is not null; + value = _ExcludeElement; + return _ExcludeElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "exclude": - ExcludeElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExcludeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -330,10 +326,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (ExcludeElement is not null) yield return new KeyValuePair("exclude",ExcludeElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_ExcludeElement is not null) yield return new KeyValuePair("exclude",_ExcludeElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -362,39 +358,39 @@ public partial class MemberComponent : Hl7.Fhir.Model.BackboneElement [References("CareTeam","Device","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson","Specimen")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Entity + public Hl7.Fhir.Model.ResourceReference? Entity { get { return _Entity; } set { _Entity = value; OnPropertyChanged("Entity"); } } - private Hl7.Fhir.Model.ResourceReference _Entity; + private Hl7.Fhir.Model.ResourceReference? _Entity; /// /// Period member belonged to the group. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// If member is no longer in group. /// [FhirElement("inactive", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InactiveElement + public Hl7.Fhir.Model.FhirBoolean? InactiveElement { get { return _InactiveElement; } set { _InactiveElement = value; OnPropertyChanged("InactiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InactiveElement; + private Hl7.Fhir.Model.FhirBoolean? _InactiveElement; /// /// If member is no longer in group @@ -403,30 +399,23 @@ public Hl7.Fhir.Model.FhirBoolean InactiveElement [IgnoreDataMember] public bool? Inactive { - get { return InactiveElement != null ? InactiveElement.Value : null; } + get => _InactiveElement?.Value; set { - if (value == null) - InactiveElement = null; - else - InactiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + InactiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Inactive"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MemberComponent; - - if (dest == null) - { + if(other is not MemberComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Entity != null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)Entity.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(InactiveElement != null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)InactiveElement.DeepCopyInternal(); + if(_Entity is not null) dest.Entity = (Hl7.Fhir.Model.ResourceReference)_Entity.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_InactiveElement is not null) dest.InactiveElement = (Hl7.Fhir.Model.FhirBoolean)_InactiveElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -438,48 +427,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MemberComponent; - if(otherT == null) return false; + if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Entity, otherT.Entity)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(InactiveElement, otherT.InactiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "entity": - value = Entity; - return Entity is not null; + value = _Entity; + return _Entity is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "inactive": - value = InactiveElement; - return InactiveElement is not null; + value = _InactiveElement; + return _InactiveElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "entity": - Entity = (Hl7.Fhir.Model.ResourceReference)value; + Entity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "inactive": - InactiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + InactiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -490,9 +479,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Entity is not null) yield return new KeyValuePair("entity",Entity); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (InactiveElement is not null) yield return new KeyValuePair("inactive",InactiveElement); + if (_Entity is not null) yield return new KeyValuePair("entity",_Entity); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_InactiveElement is not null) yield return new KeyValuePair("inactive",_InactiveElement); } } @@ -505,24 +494,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this group's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this group's record is in active use @@ -531,13 +520,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -550,13 +536,13 @@ public bool? Active [Binding("GroupType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// person | animal | practitioner | device | careteam | healthcareservice | location | organization | relatedperson | specimen @@ -565,13 +551,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Group.GroupType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -583,13 +566,13 @@ public Hl7.Fhir.Model.Group.GroupType? Type [DeclaredType(Type = typeof(Code))] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MembershipElement + public Code? MembershipElement { get { return _MembershipElement; } set { _MembershipElement = value; OnPropertyChanged("MembershipElement"); } } - private Code _MembershipElement; + private Code? _MembershipElement; /// /// definitional | enumerated @@ -598,13 +581,10 @@ public Code MembershipElement [IgnoreDataMember] public Hl7.Fhir.Model.Group.GroupMembershipBasis? Membership { - get { return MembershipElement != null ? MembershipElement.Value : null; } + get => _MembershipElement?.Value; set { - if (value == null) - MembershipElement = null; - else - MembershipElement = new Code(value); + MembershipElement = value is null ? null : new Code(value); OnPropertyChanged("Membership"); } } @@ -615,41 +595,38 @@ public Hl7.Fhir.Model.Group.GroupMembershipBasis? Membership [FhirElement("code", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [Binding("GroupKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Label for Group. /// [FhirElement("name", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for Group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -659,28 +636,25 @@ public string Name /// [FhirElement("description", Order=150)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -690,13 +664,13 @@ public string Description /// [FhirElement("quantity", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt QuantityElement + public Hl7.Fhir.Model.UnsignedInt? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.UnsignedInt _QuantityElement; + private Hl7.Fhir.Model.UnsignedInt? _QuantityElement; /// /// Number of members @@ -705,13 +679,10 @@ public Hl7.Fhir.Model.UnsignedInt QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.UnsignedInt(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Quantity"); } } @@ -723,13 +694,13 @@ public int? Quantity [CLSCompliant(false)] [References("Organization","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingEntity + public Hl7.Fhir.Model.ResourceReference? ManagingEntity { get { return _ManagingEntity; } set { _ManagingEntity = value; OnPropertyChanged("ManagingEntity"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingEntity; + private Hl7.Fhir.Model.ResourceReference? _ManagingEntity; /// /// Include / Exclude group members by Trait. @@ -739,11 +710,11 @@ public Hl7.Fhir.Model.ResourceReference ManagingEntity [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Who or what is in group. @@ -753,35 +724,31 @@ public List Characteristic [DataMember] public List Member { - get { if(_Member==null) _Member = new List(); return _Member; } + get => _Member ?? new List(); set { _Member = value; OnPropertyChanged("Member"); } } - private List _Member; + private List? _Member; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Group; - - if (dest == null) - { + if(other is not Group dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(MembershipElement != null) dest.MembershipElement = (Code)MembershipElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)QuantityElement.DeepCopyInternal(); - if(ManagingEntity != null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)ManagingEntity.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Member.Any()) dest.Member = new List(Member.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_MembershipElement is not null) dest.MembershipElement = (Code)_MembershipElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.UnsignedInt)_QuantityElement.DeepCopyInternal(); + if(_ManagingEntity is not null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)_ManagingEntity.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Member is not null) dest.Member = new List(_Member.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -793,104 +760,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Group; - if(otherT == null) return false; + if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(MembershipElement, otherT.MembershipElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.Equals(ManagingEntity, otherT.ManagingEntity)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Member, otherT.Member)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_MembershipElement, otherT._MembershipElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.Equals(_ManagingEntity, otherT._ManagingEntity)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Member, otherT._Member)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "membership": - value = MembershipElement; - return MembershipElement is not null; + value = _MembershipElement; + return _MembershipElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "managingEntity": - value = ManagingEntity; - return ManagingEntity is not null; + value = _ManagingEntity; + return _ManagingEntity is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "member": - value = Member; - return Member?.Any() == true; + value = _Member; + return _Member?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "membership": - MembershipElement = (Code)value; + MembershipElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.UnsignedInt)value; + QuantityElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "managingEntity": - ManagingEntity = (Hl7.Fhir.Model.ResourceReference)value; + ManagingEntity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "member": - Member = (List)value; + Member = (List?)value!; return this; default: return base.SetValue(key, value); @@ -901,17 +868,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (MembershipElement is not null) yield return new KeyValuePair("membership",MembershipElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (ManagingEntity is not null) yield return new KeyValuePair("managingEntity",ManagingEntity); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Member?.Any() == true) yield return new KeyValuePair("member",Member); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_MembershipElement is not null) yield return new KeyValuePair("membership",_MembershipElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_ManagingEntity is not null) yield return new KeyValuePair("managingEntity",_ManagingEntity); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Member?.Any() == true) yield return new KeyValuePair("member",_Member); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs index d18ac1956..65b8122c1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,13 +113,13 @@ public enum GuidanceResponseStatus /// [FhirElement("requestIdentifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier RequestIdentifier + public Hl7.Fhir.Model.Identifier? RequestIdentifier { get { return _RequestIdentifier; } set { _RequestIdentifier = value; OnPropertyChanged("RequestIdentifier"); } } - private Hl7.Fhir.Model.Identifier _RequestIdentifier; + private Hl7.Fhir.Model.Identifier? _RequestIdentifier; /// /// Business identifier. @@ -126,11 +129,11 @@ public Hl7.Fhir.Model.Identifier RequestIdentifier [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// What guidance was requested. @@ -141,13 +144,13 @@ public List Identifier [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Module + public Hl7.Fhir.Model.DataType? Module { get { return _Module; } set { _Module = value; OnPropertyChanged("Module"); } } - private Hl7.Fhir.Model.DataType _Module; + private Hl7.Fhir.Model.DataType? _Module; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error. @@ -157,13 +160,13 @@ public Hl7.Fhir.Model.DataType Module [Binding("GuidanceResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// success | data-requested | data-required | in-progress | failure | entered-in-error @@ -172,13 +175,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -190,13 +190,13 @@ public Hl7.Fhir.Model.GuidanceResponse.GuidanceResponseStatus? Status [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter during which the response was returned. @@ -205,41 +205,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the guidance response was processed. /// [FhirElement("occurrenceDateTime", Order=150, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime OccurrenceDateTimeElement + public Hl7.Fhir.Model.FhirDateTime? OccurrenceDateTimeElement { get { return _OccurrenceDateTimeElement; } set { _OccurrenceDateTimeElement = value; OnPropertyChanged("OccurrenceDateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _OccurrenceDateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _OccurrenceDateTimeElement; /// /// When the guidance response was processed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OccurrenceDateTime + public string? OccurrenceDateTime { - get { return OccurrenceDateTimeElement != null ? OccurrenceDateTimeElement.Value : null; } + get => _OccurrenceDateTimeElement?.Value; set { - if (value == null) - OccurrenceDateTimeElement = null; - else - OccurrenceDateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + OccurrenceDateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("OccurrenceDateTime"); } } @@ -251,13 +248,13 @@ public string OccurrenceDateTime [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Why guidance is needed. @@ -267,11 +264,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Additional notes about the response. @@ -281,11 +278,11 @@ public List Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Messages resulting from the evaluation of the artifact or artifacts. @@ -294,13 +291,13 @@ public List Note [CLSCompliant(false)] [References("OperationOutcome")] [DataMember] - public Hl7.Fhir.Model.ResourceReference EvaluationMessage + public Hl7.Fhir.Model.ResourceReference? EvaluationMessage { get { return _EvaluationMessage; } set { _EvaluationMessage = value; OnPropertyChanged("EvaluationMessage"); } } - private Hl7.Fhir.Model.ResourceReference _EvaluationMessage; + private Hl7.Fhir.Model.ResourceReference? _EvaluationMessage; /// /// The output parameters of the evaluation, if any. @@ -309,13 +306,13 @@ public Hl7.Fhir.Model.ResourceReference EvaluationMessage [CLSCompliant(false)] [References("Parameters")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OutputParameters + public Hl7.Fhir.Model.ResourceReference? OutputParameters { get { return _OutputParameters; } set { _OutputParameters = value; OnPropertyChanged("OutputParameters"); } } - private Hl7.Fhir.Model.ResourceReference _OutputParameters; + private Hl7.Fhir.Model.ResourceReference? _OutputParameters; /// /// Proposed actions, if any. @@ -327,11 +324,11 @@ public Hl7.Fhir.Model.ResourceReference OutputParameters [DataMember] public List Result { - get { if(_Result==null) _Result = new List(); return _Result; } + get => _Result ?? new List(); set { _Result = value; OnPropertyChanged("Result"); } } - private List _Result; + private List? _Result; /// /// Additional required data. @@ -341,38 +338,34 @@ public List Result [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as GuidanceResponse; - - if (dest == null) - { + if(other is not GuidanceResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequestIdentifier != null) dest.RequestIdentifier = (Hl7.Fhir.Model.Identifier)RequestIdentifier.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Module != null) dest.Module = (Hl7.Fhir.Model.DataType)Module.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(OccurrenceDateTimeElement != null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)OccurrenceDateTimeElement.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(EvaluationMessage != null) dest.EvaluationMessage = (Hl7.Fhir.Model.ResourceReference)EvaluationMessage.DeepCopyInternal(); - if(OutputParameters != null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)OutputParameters.DeepCopyInternal(); - if(Result.Any()) dest.Result = new List(Result.DeepCopyInternal()); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); + if(_RequestIdentifier is not null) dest.RequestIdentifier = (Hl7.Fhir.Model.Identifier)_RequestIdentifier.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Module is not null) dest.Module = (Hl7.Fhir.Model.DataType)_Module.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_OccurrenceDateTimeElement is not null) dest.OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_OccurrenceDateTimeElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_EvaluationMessage is not null) dest.EvaluationMessage = (Hl7.Fhir.Model.ResourceReference)_EvaluationMessage.DeepCopyInternal(); + if(_OutputParameters is not null) dest.OutputParameters = (Hl7.Fhir.Model.ResourceReference)_OutputParameters.DeepCopyInternal(); + if(_Result is not null) dest.Result = new List(_Result.DeepCopyInternal()); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -384,125 +377,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GuidanceResponse; - if(otherT == null) return false; + if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequestIdentifier, otherT.RequestIdentifier)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Module, otherT.Module)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(OccurrenceDateTimeElement, otherT.OccurrenceDateTimeElement)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(EvaluationMessage, otherT.EvaluationMessage)) return false; - if(!comparer.Equals(OutputParameters, otherT.OutputParameters)) return false; - if(!comparer.ListEquals(Result, otherT.Result)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Module, otherT._Module)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_OccurrenceDateTimeElement, otherT._OccurrenceDateTimeElement)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_EvaluationMessage, otherT._EvaluationMessage)) return false; + if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; + if(!comparer.ListEquals(_Result, otherT._Result)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "requestIdentifier": - value = RequestIdentifier; - return RequestIdentifier is not null; + value = _RequestIdentifier; + return _RequestIdentifier is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "module": - value = Module; - return Module is not null; + value = _Module; + return _Module is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrenceDateTime": - value = OccurrenceDateTimeElement; - return OccurrenceDateTimeElement is not null; + value = _OccurrenceDateTimeElement; + return _OccurrenceDateTimeElement is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "evaluationMessage": - value = EvaluationMessage; - return EvaluationMessage is not null; + value = _EvaluationMessage; + return _EvaluationMessage is not null; case "outputParameters": - value = OutputParameters; - return OutputParameters is not null; + value = _OutputParameters; + return _OutputParameters is not null; case "result": - value = Result; - return Result?.Any() == true; + value = _Result; + return _Result?.Any() == true; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "requestIdentifier": - RequestIdentifier = (Hl7.Fhir.Model.Identifier)value; + RequestIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "module": - Module = (Hl7.Fhir.Model.DataType)value; + Module = (Hl7.Fhir.Model.DataType?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrenceDateTime": - OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + OccurrenceDateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "evaluationMessage": - EvaluationMessage = (Hl7.Fhir.Model.ResourceReference)value; + EvaluationMessage = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outputParameters": - OutputParameters = (Hl7.Fhir.Model.ResourceReference)value; + OutputParameters = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "result": - Result = (List)value; + Result = (List?)value!; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -513,20 +506,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequestIdentifier is not null) yield return new KeyValuePair("requestIdentifier",RequestIdentifier); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Module is not null) yield return new KeyValuePair("module",Module); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",OccurrenceDateTimeElement); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (EvaluationMessage is not null) yield return new KeyValuePair("evaluationMessage",EvaluationMessage); - if (OutputParameters is not null) yield return new KeyValuePair("outputParameters",OutputParameters); - if (Result?.Any() == true) yield return new KeyValuePair("result",Result); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); + if (_RequestIdentifier is not null) yield return new KeyValuePair("requestIdentifier",_RequestIdentifier); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Module is not null) yield return new KeyValuePair("module",_Module); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_OccurrenceDateTimeElement is not null) yield return new KeyValuePair("occurrenceDateTime",_OccurrenceDateTimeElement); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_EvaluationMessage is not null) yield return new KeyValuePair("evaluationMessage",_EvaluationMessage); + if (_OutputParameters is not null) yield return new KeyValuePair("outputParameters",_OutputParameters); + if (_Result?.Any() == true) yield return new KeyValuePair("result",_Result); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs index 1f18c7b4f..1e2be3de1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,57 +81,50 @@ public partial class EligibilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("ServiceEligibility")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Describes the eligibility conditions for the service. /// [FhirElement("comment", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Describes the eligibility conditions for the service /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EligibilityComponent; - - if (dest == null) - { + if(other is not EligibilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -140,41 +136,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EligibilityComponent; - if(otherT == null) return false; + if(other is not EligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -185,8 +181,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -199,24 +195,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this HealthcareService record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this HealthcareService record is in active use @@ -225,13 +221,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -243,13 +236,13 @@ public bool? Active [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProvidedBy + public Hl7.Fhir.Model.ResourceReference? ProvidedBy { get { return _ProvidedBy; } set { _ProvidedBy = value; OnPropertyChanged("ProvidedBy"); } } - private Hl7.Fhir.Model.ResourceReference _ProvidedBy; + private Hl7.Fhir.Model.ResourceReference? _ProvidedBy; /// /// The service within which this service is offered. @@ -261,11 +254,11 @@ public Hl7.Fhir.Model.ResourceReference ProvidedBy [DataMember] public List OfferedIn { - get { if(_OfferedIn==null) _OfferedIn = new List(); return _OfferedIn; } + get => _OfferedIn ?? new List(); set { _OfferedIn = value; OnPropertyChanged("OfferedIn"); } } - private List _OfferedIn; + private List? _OfferedIn; /// /// Broad category of service being performed or delivered. @@ -276,11 +269,11 @@ public List OfferedIn [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of service that may be delivered or performed. @@ -291,11 +284,11 @@ public List Category [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Specialties handled by the HealthcareService. @@ -306,11 +299,11 @@ public List Type [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Location(s) where service may be provided. @@ -322,39 +315,36 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Description of service as presented to a consumer while searching. /// [FhirElement("name", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Description of service as presented to a consumer while searching /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -364,28 +354,25 @@ public string Name /// [FhirElement("comment", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Additional description and/or any specific issues not covered elsewhere /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -395,28 +382,25 @@ public string Comment /// [FhirElement("extraDetails", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown ExtraDetailsElement + public Hl7.Fhir.Model.Markdown? ExtraDetailsElement { get { return _ExtraDetailsElement; } set { _ExtraDetailsElement = value; OnPropertyChanged("ExtraDetailsElement"); } } - private Hl7.Fhir.Model.Markdown _ExtraDetailsElement; + private Hl7.Fhir.Model.Markdown? _ExtraDetailsElement; /// /// Extra details about the service that can't be placed in the other fields /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExtraDetails + public string? ExtraDetails { - get { return ExtraDetailsElement != null ? ExtraDetailsElement.Value : null; } + get => _ExtraDetailsElement?.Value; set { - if (value == null) - ExtraDetailsElement = null; - else - ExtraDetailsElement = new Hl7.Fhir.Model.Markdown(value); + ExtraDetailsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ExtraDetails"); } } @@ -426,13 +410,13 @@ public string ExtraDetails /// [FhirElement("photo", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Attachment Photo + public Hl7.Fhir.Model.Attachment? Photo { get { return _Photo; } set { _Photo = value; OnPropertyChanged("Photo"); } } - private Hl7.Fhir.Model.Attachment _Photo; + private Hl7.Fhir.Model.Attachment? _Photo; /// /// Official contact details for the HealthcareService. @@ -442,11 +426,11 @@ public Hl7.Fhir.Model.Attachment Photo [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Location(s) service is intended for/available to. @@ -458,11 +442,11 @@ public List Contact [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// Conditions under which service is available/offered. @@ -473,11 +457,11 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get { if(_ServiceProvisionCode==null) _ServiceProvisionCode = new List(); return _ServiceProvisionCode; } + get => _ServiceProvisionCode ?? new List(); set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } - private List _ServiceProvisionCode; + private List? _ServiceProvisionCode; /// /// Specific eligibility requirements required to use the service. @@ -487,11 +471,11 @@ public List ServiceProvisionCode [DataMember] public List Eligibility { - get { if(_Eligibility==null) _Eligibility = new List(); return _Eligibility; } + get => _Eligibility ?? new List(); set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } - private List _Eligibility; + private List? _Eligibility; /// /// Programs that this service is applicable to. @@ -502,11 +486,11 @@ public List Eligibility [DataMember] public List Program { - get { if(_Program==null) _Program = new List(); return _Program; } + get => _Program ?? new List(); set { _Program = value; OnPropertyChanged("Program"); } } - private List _Program; + private List? _Program; /// /// Collection of characteristics (attributes). @@ -517,11 +501,11 @@ public List Program [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// The language that this service is offered in. @@ -532,11 +516,11 @@ public List Characteristic [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Ways that the service accepts referrals. @@ -547,24 +531,24 @@ public List Communication [DataMember] public List ReferralMethod { - get { if(_ReferralMethod==null) _ReferralMethod = new List(); return _ReferralMethod; } + get => _ReferralMethod ?? new List(); set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } - private List _ReferralMethod; + private List? _ReferralMethod; /// /// If an appointment is required for access to this service. /// [FhirElement("appointmentRequired", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement + public Hl7.Fhir.Model.FhirBoolean? AppointmentRequiredElement { get { return _AppointmentRequiredElement; } set { _AppointmentRequiredElement = value; OnPropertyChanged("AppointmentRequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AppointmentRequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _AppointmentRequiredElement; /// /// If an appointment is required for access to this service @@ -573,13 +557,10 @@ public Hl7.Fhir.Model.FhirBoolean AppointmentRequiredElement [IgnoreDataMember] public bool? AppointmentRequired { - get { return AppointmentRequiredElement != null ? AppointmentRequiredElement.Value : null; } + get => _AppointmentRequiredElement?.Value; set { - if (value == null) - AppointmentRequiredElement = null; - else - AppointmentRequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + AppointmentRequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AppointmentRequired"); } } @@ -592,11 +573,11 @@ public bool? AppointmentRequired [DataMember] public List Availability { - get { if(_Availability==null) _Availability = new List(); return _Availability; } + get => _Availability ?? new List(); set { _Availability = value; OnPropertyChanged("Availability"); } } - private List _Availability; + private List? _Availability; /// /// Technical endpoints providing access to electronic services operated for the healthcare service. @@ -608,47 +589,43 @@ public List Availability [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as HealthcareService; - - if (dest == null) - { + if(other is not HealthcareService dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ProvidedBy != null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)ProvidedBy.DeepCopyInternal(); - if(OfferedIn.Any()) dest.OfferedIn = new List(OfferedIn.DeepCopyInternal()); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(ExtraDetailsElement != null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)ExtraDetailsElement.DeepCopyInternal(); - if(Photo != null) dest.Photo = (Hl7.Fhir.Model.Attachment)Photo.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(ServiceProvisionCode.Any()) dest.ServiceProvisionCode = new List(ServiceProvisionCode.DeepCopyInternal()); - if(Eligibility.Any()) dest.Eligibility = new List(Eligibility.DeepCopyInternal()); - if(Program.Any()) dest.Program = new List(Program.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(ReferralMethod.Any()) dest.ReferralMethod = new List(ReferralMethod.DeepCopyInternal()); - if(AppointmentRequiredElement != null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)AppointmentRequiredElement.DeepCopyInternal(); - if(Availability.Any()) dest.Availability = new List(Availability.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ProvidedBy is not null) dest.ProvidedBy = (Hl7.Fhir.Model.ResourceReference)_ProvidedBy.DeepCopyInternal(); + if(_OfferedIn is not null) dest.OfferedIn = new List(_OfferedIn.DeepCopyInternal()); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_ExtraDetailsElement is not null) dest.ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)_ExtraDetailsElement.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = (Hl7.Fhir.Model.Attachment)_Photo.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_ServiceProvisionCode is not null) dest.ServiceProvisionCode = new List(_ServiceProvisionCode.DeepCopyInternal()); + if(_Eligibility is not null) dest.Eligibility = new List(_Eligibility.DeepCopyInternal()); + if(_Program is not null) dest.Program = new List(_Program.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_ReferralMethod is not null) dest.ReferralMethod = new List(_ReferralMethod.DeepCopyInternal()); + if(_AppointmentRequiredElement is not null) dest.AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)_AppointmentRequiredElement.DeepCopyInternal(); + if(_Availability is not null) dest.Availability = new List(_Availability.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -660,188 +637,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HealthcareService; - if(otherT == null) return false; + if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(ProvidedBy, otherT.ProvidedBy)) return false; - if(!comparer.ListEquals(OfferedIn, otherT.OfferedIn)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(ExtraDetailsElement, otherT.ExtraDetailsElement)) return false; - if(!comparer.Equals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(ServiceProvisionCode, otherT.ServiceProvisionCode)) return false; - if(!comparer.ListEquals(Eligibility, otherT.Eligibility)) return false; - if(!comparer.ListEquals(Program, otherT.Program)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(ReferralMethod, otherT.ReferralMethod)) return false; - if(!comparer.Equals(AppointmentRequiredElement, otherT.AppointmentRequiredElement)) return false; - if(!comparer.ListEquals(Availability, otherT.Availability)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; + if(!comparer.ListEquals(_OfferedIn, otherT._OfferedIn)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_ExtraDetailsElement, otherT._ExtraDetailsElement)) return false; + if(!comparer.Equals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_ServiceProvisionCode, otherT._ServiceProvisionCode)) return false; + if(!comparer.ListEquals(_Eligibility, otherT._Eligibility)) return false; + if(!comparer.ListEquals(_Program, otherT._Program)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_ReferralMethod, otherT._ReferralMethod)) return false; + if(!comparer.Equals(_AppointmentRequiredElement, otherT._AppointmentRequiredElement)) return false; + if(!comparer.ListEquals(_Availability, otherT._Availability)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "providedBy": - value = ProvidedBy; - return ProvidedBy is not null; + value = _ProvidedBy; + return _ProvidedBy is not null; case "offeredIn": - value = OfferedIn; - return OfferedIn?.Any() == true; + value = _OfferedIn; + return _OfferedIn?.Any() == true; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "extraDetails": - value = ExtraDetailsElement; - return ExtraDetailsElement is not null; + value = _ExtraDetailsElement; + return _ExtraDetailsElement is not null; case "photo": - value = Photo; - return Photo is not null; + value = _Photo; + return _Photo is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "serviceProvisionCode": - value = ServiceProvisionCode; - return ServiceProvisionCode?.Any() == true; + value = _ServiceProvisionCode; + return _ServiceProvisionCode?.Any() == true; case "eligibility": - value = Eligibility; - return Eligibility?.Any() == true; + value = _Eligibility; + return _Eligibility?.Any() == true; case "program": - value = Program; - return Program?.Any() == true; + value = _Program; + return _Program?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "referralMethod": - value = ReferralMethod; - return ReferralMethod?.Any() == true; + value = _ReferralMethod; + return _ReferralMethod?.Any() == true; case "appointmentRequired": - value = AppointmentRequiredElement; - return AppointmentRequiredElement is not null; + value = _AppointmentRequiredElement; + return _AppointmentRequiredElement is not null; case "availability": - value = Availability; - return Availability?.Any() == true; + value = _Availability; + return _Availability?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "providedBy": - ProvidedBy = (Hl7.Fhir.Model.ResourceReference)value; + ProvidedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "offeredIn": - OfferedIn = (List)value; + OfferedIn = (List?)value!; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "extraDetails": - ExtraDetailsElement = (Hl7.Fhir.Model.Markdown)value; + ExtraDetailsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "photo": - Photo = (Hl7.Fhir.Model.Attachment)value; + Photo = (Hl7.Fhir.Model.Attachment?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "serviceProvisionCode": - ServiceProvisionCode = (List)value; + ServiceProvisionCode = (List?)value!; return this; case "eligibility": - Eligibility = (List)value; + Eligibility = (List?)value!; return this; case "program": - Program = (List)value; + Program = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "referralMethod": - ReferralMethod = (List)value; + ReferralMethod = (List?)value!; return this; case "appointmentRequired": - AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + AppointmentRequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "availability": - Availability = (List)value; + Availability = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -852,29 +829,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ProvidedBy is not null) yield return new KeyValuePair("providedBy",ProvidedBy); - if (OfferedIn?.Any() == true) yield return new KeyValuePair("offeredIn",OfferedIn); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",ExtraDetailsElement); - if (Photo is not null) yield return new KeyValuePair("photo",Photo); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",ServiceProvisionCode); - if (Eligibility?.Any() == true) yield return new KeyValuePair("eligibility",Eligibility); - if (Program?.Any() == true) yield return new KeyValuePair("program",Program); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",ReferralMethod); - if (AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",AppointmentRequiredElement); - if (Availability?.Any() == true) yield return new KeyValuePair("availability",Availability); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ProvidedBy is not null) yield return new KeyValuePair("providedBy",_ProvidedBy); + if (_OfferedIn?.Any() == true) yield return new KeyValuePair("offeredIn",_OfferedIn); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_ExtraDetailsElement is not null) yield return new KeyValuePair("extraDetails",_ExtraDetailsElement); + if (_Photo is not null) yield return new KeyValuePair("photo",_Photo); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_ServiceProvisionCode?.Any() == true) yield return new KeyValuePair("serviceProvisionCode",_ServiceProvisionCode); + if (_Eligibility?.Any() == true) yield return new KeyValuePair("eligibility",_Eligibility); + if (_Program?.Any() == true) yield return new KeyValuePair("program",_Program); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_ReferralMethod?.Any() == true) yield return new KeyValuePair("referralMethod",_ReferralMethod); + if (_AppointmentRequiredElement is not null) yield return new KeyValuePair("appointmentRequired",_AppointmentRequiredElement); + if (_Availability?.Any() == true) yield return new KeyValuePair("availability",_Availability); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs index a648c2d3e..1857cac4a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -119,13 +122,13 @@ public enum NameUse [DeclaredType(Type = typeof(Code))] [Binding("NameUse")] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// usual | official | temp | nickname | anonymous | old | maiden @@ -134,13 +137,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.HumanName.NameUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -150,28 +150,25 @@ public Hl7.Fhir.Model.HumanName.NameUse? Use /// [FhirElement("text", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Text representation of the full name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -181,28 +178,25 @@ public string Text /// [FhirElement("family", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString FamilyElement + public Hl7.Fhir.Model.FhirString? FamilyElement { get { return _FamilyElement; } set { _FamilyElement = value; OnPropertyChanged("FamilyElement"); } } - private Hl7.Fhir.Model.FhirString _FamilyElement; + private Hl7.Fhir.Model.FhirString? _FamilyElement; /// /// Family name (often called 'Surname') /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Family + public string? Family { - get { return FamilyElement != null ? FamilyElement.Value : null; } + get => _FamilyElement?.Value; set { - if (value == null) - FamilyElement = null; - else - FamilyElement = new Hl7.Fhir.Model.FhirString(value); + FamilyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Family"); } } @@ -215,24 +209,24 @@ public string Family [DataMember] public List GivenElement { - get { if(_GivenElement==null) _GivenElement = new List(); return _GivenElement; } + get => _GivenElement ?? new List(); set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } - private List _GivenElement; + private List? _GivenElement; /// /// Given names (not always 'first'). Includes middle names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Given + public IEnumerable? Given { - get { return GivenElement != null ? GivenElement.Select(elem => elem.Value) : null; } + get => _GivenElement?.Select(elem => elem.Value); set { if (value == null) - GivenElement = null; + GivenElement = null!; else GivenElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Given"); @@ -247,24 +241,24 @@ public IEnumerable Given [DataMember] public List PrefixElement { - get { if(_PrefixElement==null) _PrefixElement = new List(); return _PrefixElement; } + get => _PrefixElement ?? new List(); set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private List _PrefixElement; + private List? _PrefixElement; /// /// Parts that come before the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Prefix + public IEnumerable? Prefix { - get { return PrefixElement != null ? PrefixElement.Select(elem => elem.Value) : null; } + get => _PrefixElement?.Select(elem => elem.Value); set { if (value == null) - PrefixElement = null; + PrefixElement = null!; else PrefixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Prefix"); @@ -279,24 +273,24 @@ public IEnumerable Prefix [DataMember] public List SuffixElement { - get { if(_SuffixElement==null) _SuffixElement = new List(); return _SuffixElement; } + get => _SuffixElement ?? new List(); set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } - private List _SuffixElement; + private List? _SuffixElement; /// /// Parts that come after the name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Suffix + public IEnumerable? Suffix { - get { return SuffixElement != null ? SuffixElement.Select(elem => elem.Value) : null; } + get => _SuffixElement?.Select(elem => elem.Value); set { if (value == null) - SuffixElement = null; + SuffixElement = null!; else SuffixElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Suffix"); @@ -308,31 +302,27 @@ public IEnumerable Suffix /// [FhirElement("period", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as HumanName; - - if (dest == null) - { + if(other is not HumanName dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(FamilyElement != null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)FamilyElement.DeepCopyInternal(); - if(GivenElement.Any()) dest.GivenElement = new List(GivenElement.DeepCopyInternal()); - if(PrefixElement.Any()) dest.PrefixElement = new List(PrefixElement.DeepCopyInternal()); - if(SuffixElement.Any()) dest.SuffixElement = new List(SuffixElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_FamilyElement is not null) dest.FamilyElement = (Hl7.Fhir.Model.FhirString)_FamilyElement.DeepCopyInternal(); + if(_GivenElement is not null) dest.GivenElement = new List(_GivenElement.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = new List(_PrefixElement.DeepCopyInternal()); + if(_SuffixElement is not null) dest.SuffixElement = new List(_SuffixElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -344,76 +334,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HumanName; - if(otherT == null) return false; + if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(FamilyElement, otherT.FamilyElement)) return false; - if(!comparer.ListEquals(GivenElement, otherT.GivenElement)) return false; - if(!comparer.ListEquals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.ListEquals(SuffixElement, otherT.SuffixElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; + if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; + if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "family": - value = FamilyElement; - return FamilyElement is not null; + value = _FamilyElement; + return _FamilyElement is not null; case "given": - value = GivenElement; - return GivenElement?.Any() == true; + value = _GivenElement; + return _GivenElement?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement?.Any() == true; + value = _PrefixElement; + return _PrefixElement?.Any() == true; case "suffix": - value = SuffixElement; - return SuffixElement?.Any() == true; + value = _SuffixElement; + return _SuffixElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "family": - FamilyElement = (Hl7.Fhir.Model.FhirString)value; + FamilyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "given": - GivenElement = (List)value; + GivenElement = (List?)value!; return this; case "prefix": - PrefixElement = (List)value; + PrefixElement = (List?)value!; return this; case "suffix": - SuffixElement = (List)value; + SuffixElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -424,13 +414,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (FamilyElement is not null) yield return new KeyValuePair("family",FamilyElement); - if (GivenElement?.Any() == true) yield return new KeyValuePair("given",GivenElement); - if (PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",PrefixElement); - if (SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",SuffixElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_FamilyElement is not null) yield return new KeyValuePair("family",_FamilyElement); + if (_GivenElement?.Any() == true) yield return new KeyValuePair("given",_GivenElement); + if (_PrefixElement?.Any() == true) yield return new KeyValuePair("prefix",_PrefixElement); + if (_SuffixElement?.Any() == true) yield return new KeyValuePair("suffix",_SuffixElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ICanonicalResource.cs b/src/Hl7.Fhir.R5/Model/Generated/ICanonicalResource.cs index c6f4394e0..83b3767b2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ICanonicalResource.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ICanonicalResource.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,12 +55,12 @@ public interface ICanonicalResource /// Canonical identifier for this CanonicalResource, represented as an absolute URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Url { get; set; } + string? Url { get; set; } /// /// Canonical identifier for this CanonicalResource, represented as an absolute URI (globally unique). /// - Hl7.Fhir.Model.FhirUri UrlElement { get; set; } + Hl7.Fhir.Model.FhirUri? UrlElement { get; set; } /// /// Additional identifier for the CanonicalResource. @@ -68,39 +71,39 @@ public interface ICanonicalResource /// Business version of the CanonicalResource /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Version { get; set; } + string? Version { get; set; } /// /// Business version of the CanonicalResource. /// - Hl7.Fhir.Model.FhirString VersionElement { get; set; } + Hl7.Fhir.Model.FhirString? VersionElement { get; set; } /// /// How to compare versions. /// - Hl7.Fhir.Model.DataType VersionAlgorithm { get; set; } + Hl7.Fhir.Model.DataType? VersionAlgorithm { get; set; } /// /// Name for this CanonicalResource (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Name { get; set; } + string? Name { get; set; } /// /// Name for this CanonicalResource (computer friendly). /// - Hl7.Fhir.Model.FhirString NameElement { get; set; } + Hl7.Fhir.Model.FhirString? NameElement { get; set; } /// /// Name for this CanonicalResource (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Title { get; set; } + string? Title { get; set; } /// /// Name for this CanonicalResource (human friendly). /// - Hl7.Fhir.Model.FhirString TitleElement { get; set; } + Hl7.Fhir.Model.FhirString? TitleElement { get; set; } /// /// draft | active | retired | unknown @@ -111,7 +114,7 @@ public interface ICanonicalResource /// /// draft | active | retired | unknown. /// - Code StatusElement { get; set; } + Code? StatusElement { get; set; } /// /// For testing purposes, not real usage @@ -122,29 +125,29 @@ public interface ICanonicalResource /// /// For testing purposes, not real usage. /// - Hl7.Fhir.Model.FhirBoolean ExperimentalElement { get; set; } + Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get; set; } /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Date { get; set; } + string? Date { get; set; } /// /// Date last changed. /// - Hl7.Fhir.Model.FhirDateTime DateElement { get; set; } + Hl7.Fhir.Model.FhirDateTime? DateElement { get; set; } /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Publisher { get; set; } + string? Publisher { get; set; } /// /// Name of the publisher/steward (organization or individual). /// - Hl7.Fhir.Model.FhirString PublisherElement { get; set; } + Hl7.Fhir.Model.FhirString? PublisherElement { get; set; } /// /// Contact details for the publisher. @@ -155,12 +158,12 @@ public interface ICanonicalResource /// Natural language description of the CanonicalResource /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Description { get; set; } + string? Description { get; set; } /// /// Natural language description of the CanonicalResource. /// - Hl7.Fhir.Model.Markdown DescriptionElement { get; set; } + Hl7.Fhir.Model.Markdown? DescriptionElement { get; set; } /// /// The context that the content is intended to support. @@ -176,512 +179,1068 @@ public interface ICanonicalResource /// Why this CanonicalResource is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Purpose { get; set; } + string? Purpose { get; set; } /// /// Why this CanonicalResource is defined. /// - Hl7.Fhir.Model.Markdown PurposeElement { get; set; } + Hl7.Fhir.Model.Markdown? PurposeElement { get; set; } /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string Copyright { get; set; } + string? Copyright { get; set; } /// /// Use and/or publishing restrictions. /// - Hl7.Fhir.Model.Markdown CopyrightElement { get; set; } + Hl7.Fhir.Model.Markdown? CopyrightElement { get; set; } /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string CopyrightLabel { get; set; } + string? CopyrightLabel { get; set; } /// /// Copyright holder and year(s). /// - Hl7.Fhir.Model.FhirString CopyrightLabelElement { get; set; } + Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get; set; } } public partial class ActivityDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class ActorDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class ChargeItemDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class Citation : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class CompartmentDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } - + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } + [IgnoreDataMember] List ICanonicalResource.Identifier { - get { return null; } - set { throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.identifier");} + get => []; + set => throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.identifier"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] List ICanonicalResource.Jurisdiction { - get { return null; } - set { throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.jurisdiction");} + get => []; + set => throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.jurisdiction"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement { - get { return null; } - set { throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - string ICanonicalResource.Copyright + string? ICanonicalResource.Copyright { - get { return null; } - set { throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement { - get { return null; } - set { throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyrightLabel"); } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel + string? ICanonicalResource.CopyrightLabel { - get { return null; } - set { throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource CompartmentDefinition does not implement ICanonicalResource.copyrightLabel"); } } @@ -689,205 +1248,413 @@ string ICanonicalResource.CopyrightLabel public partial class ConceptMap : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class ConditionDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.purpose");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.purpose"); } [IgnoreDataMember] - string ICanonicalResource.Purpose + string? ICanonicalResource.Purpose { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.purpose");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.purpose"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - string ICanonicalResource.Copyright + string? ICanonicalResource.Copyright { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyrightLabel"); } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel + string? ICanonicalResource.CopyrightLabel { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement ICanonicalResource.copyrightLabel"); } } @@ -895,356 +1662,620 @@ string ICanonicalResource.CopyrightLabel public partial class EventDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class Evidence : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } - + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } + [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] List ICanonicalResource.Jurisdiction { - get { return null; } - set { throw new NotImplementedException("Resource Evidence does not implement ICanonicalResource.jurisdiction");} + get => []; + set => throw new NotImplementedException("Resource Evidence does not implement ICanonicalResource.jurisdiction"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class EvidenceReport : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.version");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.version"); } [IgnoreDataMember] - string ICanonicalResource.Version + string? ICanonicalResource.Version { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.version");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.version"); } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.versionAlgorithm");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.versionAlgorithm"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.name");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.name"); } [IgnoreDataMember] - string ICanonicalResource.Name + string? ICanonicalResource.Name { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.name");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.name"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.title");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.title"); } [IgnoreDataMember] - string ICanonicalResource.Title + string? ICanonicalResource.Title { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.title");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.title"); } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.experimental");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.experimental"); } [IgnoreDataMember] bool? ICanonicalResource.Experimental { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.experimental");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.experimental"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.date");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.date"); } [IgnoreDataMember] - string ICanonicalResource.Date + string? ICanonicalResource.Date { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.date");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.date"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.description");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.description"); } [IgnoreDataMember] - string ICanonicalResource.Description + string? ICanonicalResource.Description { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.description");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.description"); } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] List ICanonicalResource.Jurisdiction { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.jurisdiction");} + get => []; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.jurisdiction"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.purpose");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.purpose"); } [IgnoreDataMember] - string ICanonicalResource.Purpose + string? ICanonicalResource.Purpose { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.purpose");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.purpose"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - string ICanonicalResource.Copyright + string? ICanonicalResource.Copyright { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyrightLabel"); } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel + string? ICanonicalResource.CopyrightLabel { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement ICanonicalResource.copyrightLabel"); } } @@ -1252,762 +2283,1460 @@ string ICanonicalResource.CopyrightLabel public partial class EvidenceVariable : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] List ICanonicalResource.Jurisdiction { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceVariable does not implement ICanonicalResource.jurisdiction");} + get => []; + set => throw new NotImplementedException("Resource EvidenceVariable does not implement ICanonicalResource.jurisdiction"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class ExampleScenario : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class GraphDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class ImplementationGuide : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } - + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } + [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class Library : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class Measure : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class MedicationKnowledge : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.url");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.url"); } [IgnoreDataMember] - string ICanonicalResource.Url + string? ICanonicalResource.Url { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.url");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.url"); } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.version");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.version"); } [IgnoreDataMember] - string ICanonicalResource.Version + string? ICanonicalResource.Version { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.version");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.version"); } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.versionAlgorithm");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.versionAlgorithm"); } /// - /// MedicationKnowledge.NameElement (List<Hl7.Fhir.Model.FhirString>) is incompatible with - /// ICanonicalResource.name (Hl7.Fhir.Model.FhirString) + /// MedicationKnowledge.NameElement is incompatible with ICanonicalResource.name. /// [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement { - get { return null; } - set { throw new NotImplementedException("MedicationKnowledge.NameElement (List) is incompatible with ICanonicalResource.name (Hl7.Fhir.Model.FhirString)");} + get => null; + set => throw new NotImplementedException("MedicationKnowledge.NameElement is incompatible with ICanonicalResource.name."); } - // MedicationKnowledge.NameElement () is incompatible with ICanonicalResource.name (string) + /// + /// MedicationKnowledge.NameElement is incompatible with ICanonicalResource.name. + /// [IgnoreDataMember] - string ICanonicalResource.Name + string? ICanonicalResource.Name { - get { return null; } - set { throw new NotImplementedException("MedicationKnowledge.NameElement (List) is incompatible with ICanonicalResource.name (Hl7.Fhir.Model.FhirString)");} + get => null; + set => throw new NotImplementedException("MedicationKnowledge.NameElement is incompatible with ICanonicalResource.name."); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.title");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.title"); } [IgnoreDataMember] - string ICanonicalResource.Title + string? ICanonicalResource.Title { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.title");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.title"); } /// - /// MedicationKnowledge.StatusElement (Code<Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes>) is incompatible with - /// ICanonicalResource.status (Code<Hl7.Fhir.Model.PublicationStatus>) + /// MedicationKnowledge.StatusElement is incompatible with ICanonicalResource.status. /// [IgnoreDataMember] - Code ICanonicalResource.StatusElement + Code? ICanonicalResource.StatusElement { - get { return null; } - set { throw new NotImplementedException("MedicationKnowledge.StatusElement (Code) is incompatible with ICanonicalResource.status (Code)");} + get => null; + set => throw new NotImplementedException("MedicationKnowledge.StatusElement is incompatible with ICanonicalResource.status."); } - // MedicationKnowledge.StatusElement (Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes?) is incompatible with ICanonicalResource.status (Hl7.Fhir.Model.PublicationStatus?) + /// + /// MedicationKnowledge.StatusElement is incompatible with ICanonicalResource.status. + /// [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { - get { return null; } - set { throw new NotImplementedException("MedicationKnowledge.StatusElement (Code) is incompatible with ICanonicalResource.status (Code)");} + get => null; + set => throw new NotImplementedException("MedicationKnowledge.StatusElement is incompatible with ICanonicalResource.status."); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.experimental");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.experimental"); } [IgnoreDataMember] bool? ICanonicalResource.Experimental { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.experimental");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.experimental"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.date");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.date"); } [IgnoreDataMember] - string ICanonicalResource.Date + string? ICanonicalResource.Date { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.date");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.date"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.publisher");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.publisher"); } [IgnoreDataMember] - string ICanonicalResource.Publisher + string? ICanonicalResource.Publisher { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.publisher");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.publisher"); } [IgnoreDataMember] List ICanonicalResource.Contact { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.contact");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.contact"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.description");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.description"); } [IgnoreDataMember] - string ICanonicalResource.Description + string? ICanonicalResource.Description { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.description");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.description"); } [IgnoreDataMember] List ICanonicalResource.UseContext { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.useContext");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.useContext"); } [IgnoreDataMember] List ICanonicalResource.Jurisdiction { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.jurisdiction");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.jurisdiction"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.purpose");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.purpose"); } [IgnoreDataMember] - string ICanonicalResource.Purpose + string? ICanonicalResource.Purpose { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.purpose");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.purpose"); } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - string ICanonicalResource.Copyright + string? ICanonicalResource.Copyright { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyright");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyright"); } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyrightLabel"); } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel + string? ICanonicalResource.CopyrightLabel { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyrightLabel");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement ICanonicalResource.copyrightLabel"); } } @@ -2015,1304 +3744,2914 @@ string ICanonicalResource.CopyrightLabel public partial class MessageDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class NamingSystem : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class ObservationDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] List ICanonicalResource.Identifier { - get - { - if (Identifier == null) return new List(); - return new List() { Identifier }; - } - + get => Identifier is null ? [] : [Identifier]; set { - if (value.Count == 0) { Identifier = null; } - else if (value.Count == 1) { Identifier = value.First(); } - else { throw new NotImplementedException("Resource ObservationDefinition can only have a single ICanonicalResource.Identifier value"); } + Identifier = value switch + { + { Count: 0 } => null, + { Count: 1 } => value.First(), + _ => throw new NotImplementedException("Resource ObservationDefinition can only have a single Identifier value") + }; } - } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class OperationDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class PlanDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class Questionnaire : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } - + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } + [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class Requirements : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class SearchParameter : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class SpecimenDefinition : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] List ICanonicalResource.Identifier { - get - { - if (Identifier == null) return new List(); - return new List() { Identifier }; - } - + get => Identifier is null ? [] : [Identifier]; set { - if (value.Count == 0) { Identifier = null; } - else if (value.Count == 1) { Identifier = value.First(); } - else { throw new NotImplementedException("Resource SpecimenDefinition can only have a single ICanonicalResource.Identifier value"); } + Identifier = value switch + { + { Count: 0 } => null, + { Count: 1 } => value.First(), + _ => throw new NotImplementedException("Resource SpecimenDefinition can only have a single Identifier value") + }; } - } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class StructureMap : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class SubscriptionTopic : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class TerminologyCapabilities : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class TestPlan : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } public partial class TestScript : ICanonicalResource { [IgnoreDataMember] - Hl7.Fhir.Model.FhirUri ICanonicalResource.UrlElement { get => UrlElement; set { UrlElement = value; } } + Hl7.Fhir.Model.FhirUri? ICanonicalResource.UrlElement + { + get => UrlElement; + set => UrlElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Url { get => Url; set { Url = value; } } + string? ICanonicalResource.Url + { + get => Url; + set => Url = value; + } [IgnoreDataMember] - List ICanonicalResource.Identifier { get => Identifier; set { Identifier = value; } } + List ICanonicalResource.Identifier + { + get => Identifier; + set => Identifier = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.VersionElement { get => VersionElement; set { VersionElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.VersionElement + { + get => VersionElement; + set => VersionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Version { get => Version; set { Version = value; } } + string? ICanonicalResource.Version + { + get => Version; + set => Version = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.DataType ICanonicalResource.VersionAlgorithm { get => VersionAlgorithm; set { VersionAlgorithm = value; } } + Hl7.Fhir.Model.DataType? ICanonicalResource.VersionAlgorithm + { + get => VersionAlgorithm; + set => VersionAlgorithm = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.NameElement { get => NameElement; set { NameElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.NameElement + { + get => NameElement; + set => NameElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Name { get => Name; set { Name = value; } } + string? ICanonicalResource.Name + { + get => Name; + set => Name = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.TitleElement { get => TitleElement; set { TitleElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.TitleElement + { + get => TitleElement; + set => TitleElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Title { get => Title; set { Title = value; } } + string? ICanonicalResource.Title + { + get => Title; + set => Title = value; + } [IgnoreDataMember] - Code ICanonicalResource.StatusElement { get => StatusElement; set { StatusElement = value; } } + Code? ICanonicalResource.StatusElement + { + get => StatusElement; + set => StatusElement = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status { get => Status; set { Status = value; } } + Hl7.Fhir.Model.PublicationStatus? ICanonicalResource.Status + { + get => Status; + set => Status = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirBoolean ICanonicalResource.ExperimentalElement { get => ExperimentalElement; set { ExperimentalElement = value; } } + Hl7.Fhir.Model.FhirBoolean? ICanonicalResource.ExperimentalElement + { + get => ExperimentalElement; + set => ExperimentalElement = value; + } [IgnoreDataMember] - bool? ICanonicalResource.Experimental { get => Experimental; set { Experimental = value; } } + bool? ICanonicalResource.Experimental + { + get => Experimental; + set => Experimental = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirDateTime ICanonicalResource.DateElement { get => DateElement; set { DateElement = value; } } + Hl7.Fhir.Model.FhirDateTime? ICanonicalResource.DateElement + { + get => DateElement; + set => DateElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Date { get => Date; set { Date = value; } } + string? ICanonicalResource.Date + { + get => Date; + set => Date = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.PublisherElement { get => PublisherElement; set { PublisherElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.PublisherElement + { + get => PublisherElement; + set => PublisherElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Publisher { get => Publisher; set { Publisher = value; } } + string? ICanonicalResource.Publisher + { + get => Publisher; + set => Publisher = value; + } [IgnoreDataMember] - List ICanonicalResource.Contact { get => Contact; set { Contact = value; } } + List ICanonicalResource.Contact + { + get => Contact; + set => Contact = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.DescriptionElement { get => DescriptionElement; set { DescriptionElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.DescriptionElement + { + get => DescriptionElement; + set => DescriptionElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Description { get => Description; set { Description = value; } } + string? ICanonicalResource.Description + { + get => Description; + set => Description = value; + } [IgnoreDataMember] - List ICanonicalResource.UseContext { get => UseContext; set { UseContext = value; } } + List ICanonicalResource.UseContext + { + get => UseContext; + set => UseContext = value; + } [IgnoreDataMember] - List ICanonicalResource.Jurisdiction { get => Jurisdiction; set { Jurisdiction = value; } } + List ICanonicalResource.Jurisdiction + { + get => Jurisdiction; + set => Jurisdiction = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.PurposeElement { get => PurposeElement; set { PurposeElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.PurposeElement + { + get => PurposeElement; + set => PurposeElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Purpose { get => Purpose; set { Purpose = value; } } + string? ICanonicalResource.Purpose + { + get => Purpose; + set => Purpose = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Markdown ICanonicalResource.CopyrightElement { get => CopyrightElement; set { CopyrightElement = value; } } + Hl7.Fhir.Model.Markdown? ICanonicalResource.CopyrightElement + { + get => CopyrightElement; + set => CopyrightElement = value; + } [IgnoreDataMember] - string ICanonicalResource.Copyright { get => Copyright; set { Copyright = value; } } + string? ICanonicalResource.Copyright + { + get => Copyright; + set => Copyright = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.FhirString ICanonicalResource.CopyrightLabelElement { get => CopyrightLabelElement; set { CopyrightLabelElement = value; } } + Hl7.Fhir.Model.FhirString? ICanonicalResource.CopyrightLabelElement + { + get => CopyrightLabelElement; + set => CopyrightLabelElement = value; + } [IgnoreDataMember] - string ICanonicalResource.CopyrightLabel { get => CopyrightLabel; set { CopyrightLabel = value; } } + string? ICanonicalResource.CopyrightLabel + { + get => CopyrightLabel; + set => CopyrightLabel = value; + } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/IMetadataResource.cs b/src/Hl7.Fhir.R5/Model/Generated/IMetadataResource.cs index b68393865..1afcde2b9 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/IMetadataResource.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/IMetadataResource.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,28 +55,28 @@ public interface IMetadataResource : Hl7.Fhir.Model.ICanonicalResource /// When the MetadataResource was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string ApprovalDate { get; set; } + string? ApprovalDate { get; set; } /// /// When the MetadataResource was approved by publisher. /// - Hl7.Fhir.Model.Date ApprovalDateElement { get; set; } + Hl7.Fhir.Model.Date? ApprovalDateElement { get; set; } /// /// When the MetadataResource was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent - string LastReviewDate { get; set; } + string? LastReviewDate { get; set; } /// /// When the MetadataResource was last reviewed by the publisher. /// - Hl7.Fhir.Model.Date LastReviewDateElement { get; set; } + Hl7.Fhir.Model.Date? LastReviewDateElement { get; set; } /// /// When the MetadataResource is expected to be used. /// - Hl7.Fhir.Model.Period EffectivePeriod { get; set; } + Hl7.Fhir.Model.Period? EffectivePeriod { get; set; } /// /// E.g. Education, Treatment, Assessment, etc. @@ -110,101 +113,161 @@ public interface IMetadataResource : Hl7.Fhir.Model.ICanonicalResource public partial class ActivityDefinition : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] - List IMetadataResource.Topic { get => Topic; set { Topic = value; } } + List IMetadataResource.Topic + { + get => Topic; + set => Topic = value; + } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class ChargeItemDefinition : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod { - get { return null; } - set { throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.effectivePeriod");} + get => null; + set => throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.effectivePeriod"); } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.topic"); } [IgnoreDataMember] List IMetadataResource.Author { - get { return null; } - set { throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.author");} + get => []; + set => throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.author"); } [IgnoreDataMember] List IMetadataResource.Editor { - get { return null; } - set { throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.editor");} + get => []; + set => throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.editor"); } [IgnoreDataMember] List IMetadataResource.Reviewer { - get { return null; } - set { throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.reviewer");} + get => []; + set => throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.reviewer"); } [IgnoreDataMember] List IMetadataResource.Endorser { - get { return null; } - set { throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.endorser");} + get => []; + set => throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.endorser"); } [IgnoreDataMember] List IMetadataResource.RelatedArtifact { - get { return null; } - set { throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.relatedArtifact");} + get => []; + set => throw new NotImplementedException("Resource ChargeItemDefinition does not implement IMetadataResource.relatedArtifact"); } } @@ -212,158 +275,242 @@ Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod public partial class Citation : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource Citation does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource Citation does not implement IMetadataResource.topic"); } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class ConceptMap : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] - List IMetadataResource.Topic { get => Topic; set { Topic = value; } } + List IMetadataResource.Topic + { + get => Topic; + set => Topic = value; + } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class ConditionDefinition : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.approvalDate");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.approvalDate"); } [IgnoreDataMember] - string IMetadataResource.ApprovalDate + string? IMetadataResource.ApprovalDate { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.approvalDate");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.approvalDate"); } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.lastReviewDate");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.lastReviewDate"); } [IgnoreDataMember] - string IMetadataResource.LastReviewDate + string? IMetadataResource.LastReviewDate { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.lastReviewDate");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.lastReviewDate"); } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.effectivePeriod");} + get => null; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.effectivePeriod"); } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.topic"); } [IgnoreDataMember] List IMetadataResource.Author { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.author");} + get => []; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.author"); } [IgnoreDataMember] List IMetadataResource.Editor { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.editor");} + get => []; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.editor"); } [IgnoreDataMember] List IMetadataResource.Reviewer { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.reviewer");} + get => []; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.reviewer"); } [IgnoreDataMember] List IMetadataResource.Endorser { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.endorser");} + get => []; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.endorser"); } [IgnoreDataMember] List IMetadataResource.RelatedArtifact { - get { return null; } - set { throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.relatedArtifact");} + get => []; + set => throw new NotImplementedException("Resource ConditionDefinition does not implement IMetadataResource.relatedArtifact"); } } @@ -371,342 +518,569 @@ Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod public partial class EventDefinition : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] - List IMetadataResource.Topic { get => Topic; set { Topic = value; } } + List IMetadataResource.Topic + { + get => Topic; + set => Topic = value; + } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class Evidence : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod { - get { return null; } - set { throw new NotImplementedException("Resource Evidence does not implement IMetadataResource.effectivePeriod");} + get => null; + set => throw new NotImplementedException("Resource Evidence does not implement IMetadataResource.effectivePeriod"); } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource Evidence does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource Evidence does not implement IMetadataResource.topic"); } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class EvidenceReport : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.approvalDate");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.approvalDate"); } [IgnoreDataMember] - string IMetadataResource.ApprovalDate + string? IMetadataResource.ApprovalDate { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.approvalDate");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.approvalDate"); } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.lastReviewDate");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.lastReviewDate"); } [IgnoreDataMember] - string IMetadataResource.LastReviewDate + string? IMetadataResource.LastReviewDate { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.lastReviewDate");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.lastReviewDate"); } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.effectivePeriod");} + get => null; + set => throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.effectivePeriod"); } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource EvidenceReport does not implement IMetadataResource.topic"); } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class EvidenceVariable : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource EvidenceVariable does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource EvidenceVariable does not implement IMetadataResource.topic"); } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class Library : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] - List IMetadataResource.Topic { get => Topic; set { Topic = value; } } + List IMetadataResource.Topic + { + get => Topic; + set => Topic = value; + } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class Measure : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] - List IMetadataResource.Topic { get => Topic; set { Topic = value; } } + List IMetadataResource.Topic + { + get => Topic; + set => Topic = value; + } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class MedicationKnowledge : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.approvalDate");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.approvalDate"); } [IgnoreDataMember] - string IMetadataResource.ApprovalDate + string? IMetadataResource.ApprovalDate { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.approvalDate");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.approvalDate"); } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.lastReviewDate");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.lastReviewDate"); } [IgnoreDataMember] - string IMetadataResource.LastReviewDate + string? IMetadataResource.LastReviewDate { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.lastReviewDate");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.lastReviewDate"); } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.effectivePeriod");} + get => null; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.effectivePeriod"); } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.topic"); } /// - /// MedicationKnowledge.Author (Hl7.Fhir.Model.ResourceReference) is incompatible with - /// IMetadataResource.author (List<Hl7.Fhir.Model.ContactDetail>) + /// MedicationKnowledge.Author is incompatible with IMetadataResource.author. /// [IgnoreDataMember] List IMetadataResource.Author { - get { return null; } - set { throw new NotImplementedException("MedicationKnowledge.Author (Hl7.Fhir.Model.ResourceReference) is incompatible with IMetadataResource.author (List)");} + get => []; + set => throw new NotImplementedException("MedicationKnowledge.Author is incompatible with IMetadataResource.author."); } [IgnoreDataMember] List IMetadataResource.Editor { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.editor");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.editor"); } [IgnoreDataMember] List IMetadataResource.Reviewer { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.reviewer");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.reviewer"); } [IgnoreDataMember] List IMetadataResource.Endorser { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.endorser");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.endorser"); } [IgnoreDataMember] List IMetadataResource.RelatedArtifact { - get { return null; } - set { throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.relatedArtifact");} + get => []; + set => throw new NotImplementedException("Resource MedicationKnowledge does not implement IMetadataResource.relatedArtifact"); } } @@ -714,97 +1088,161 @@ Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod public partial class NamingSystem : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] - List IMetadataResource.Topic { get => Topic; set { Topic = value; } } + List IMetadataResource.Topic + { + get => Topic; + set => Topic = value; + } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class ObservationDefinition : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.topic"); } [IgnoreDataMember] List IMetadataResource.Author { - get { return null; } - set { throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.author");} + get => []; + set => throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.author"); } [IgnoreDataMember] List IMetadataResource.Editor { - get { return null; } - set { throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.editor");} + get => []; + set => throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.editor"); } [IgnoreDataMember] List IMetadataResource.Reviewer { - get { return null; } - set { throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.reviewer");} + get => []; + set => throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.reviewer"); } [IgnoreDataMember] List IMetadataResource.Endorser { - get { return null; } - set { throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.endorser");} + get => []; + set => throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.endorser"); } [IgnoreDataMember] List IMetadataResource.RelatedArtifact { - get { return null; } - set { throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.relatedArtifact");} + get => []; + set => throw new NotImplementedException("Resource ObservationDefinition does not implement IMetadataResource.relatedArtifact"); } } @@ -812,97 +1250,161 @@ public partial class ObservationDefinition : IMetadataResource public partial class PlanDefinition : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] - List IMetadataResource.Topic { get => Topic; set { Topic = value; } } + List IMetadataResource.Topic + { + get => Topic; + set => Topic = value; + } [IgnoreDataMember] - List IMetadataResource.Author { get => Author; set { Author = value; } } + List IMetadataResource.Author + { + get => Author; + set => Author = value; + } [IgnoreDataMember] - List IMetadataResource.Editor { get => Editor; set { Editor = value; } } + List IMetadataResource.Editor + { + get => Editor; + set => Editor = value; + } [IgnoreDataMember] - List IMetadataResource.Reviewer { get => Reviewer; set { Reviewer = value; } } + List IMetadataResource.Reviewer + { + get => Reviewer; + set => Reviewer = value; + } [IgnoreDataMember] - List IMetadataResource.Endorser { get => Endorser; set { Endorser = value; } } + List IMetadataResource.Endorser + { + get => Endorser; + set => Endorser = value; + } [IgnoreDataMember] - List IMetadataResource.RelatedArtifact { get => RelatedArtifact; set { RelatedArtifact = value; } } + List IMetadataResource.RelatedArtifact + { + get => RelatedArtifact; + set => RelatedArtifact = value; + } } public partial class Questionnaire : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.topic"); } [IgnoreDataMember] List IMetadataResource.Author { - get { return null; } - set { throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.author");} + get => []; + set => throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.author"); } [IgnoreDataMember] List IMetadataResource.Editor { - get { return null; } - set { throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.editor");} + get => []; + set => throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.editor"); } [IgnoreDataMember] List IMetadataResource.Reviewer { - get { return null; } - set { throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.reviewer");} + get => []; + set => throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.reviewer"); } [IgnoreDataMember] List IMetadataResource.Endorser { - get { return null; } - set { throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.endorser");} + get => []; + set => throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.endorser"); } [IgnoreDataMember] List IMetadataResource.RelatedArtifact { - get { return null; } - set { throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.relatedArtifact");} + get => []; + set => throw new NotImplementedException("Resource Questionnaire does not implement IMetadataResource.relatedArtifact"); } } @@ -910,60 +1412,80 @@ public partial class Questionnaire : IMetadataResource public partial class SpecimenDefinition : IMetadataResource { [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.ApprovalDateElement { get => ApprovalDateElement; set { ApprovalDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.ApprovalDateElement + { + get => ApprovalDateElement; + set => ApprovalDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.ApprovalDate { get => ApprovalDate; set { ApprovalDate = value; } } + string? IMetadataResource.ApprovalDate + { + get => ApprovalDate; + set => ApprovalDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Date IMetadataResource.LastReviewDateElement { get => LastReviewDateElement; set { LastReviewDateElement = value; } } + Hl7.Fhir.Model.Date? IMetadataResource.LastReviewDateElement + { + get => LastReviewDateElement; + set => LastReviewDateElement = value; + } [IgnoreDataMember] - string IMetadataResource.LastReviewDate { get => LastReviewDate; set { LastReviewDate = value; } } + string? IMetadataResource.LastReviewDate + { + get => LastReviewDate; + set => LastReviewDate = value; + } [IgnoreDataMember] - Hl7.Fhir.Model.Period IMetadataResource.EffectivePeriod { get => EffectivePeriod; set { EffectivePeriod = value; } } + Hl7.Fhir.Model.Period? IMetadataResource.EffectivePeriod + { + get => EffectivePeriod; + set => EffectivePeriod = value; + } [IgnoreDataMember] List IMetadataResource.Topic { - get { return null; } - set { throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.topic");} + get => []; + set => throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.topic"); } [IgnoreDataMember] List IMetadataResource.Author { - get { return null; } - set { throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.author");} + get => []; + set => throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.author"); } [IgnoreDataMember] List IMetadataResource.Editor { - get { return null; } - set { throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.editor");} + get => []; + set => throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.editor"); } [IgnoreDataMember] List IMetadataResource.Reviewer { - get { return null; } - set { throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.reviewer");} + get => []; + set => throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.reviewer"); } [IgnoreDataMember] List IMetadataResource.Endorser { - get { return null; } - set { throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.endorser");} + get => []; + set => throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.endorser"); } [IgnoreDataMember] List IMetadataResource.RelatedArtifact { - get { return null; } - set { throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.relatedArtifact");} + get => []; + set => throw new NotImplementedException("Resource SpecimenDefinition does not implement IMetadataResource.relatedArtifact"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs index 62de2c517..5a4075d7e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -195,13 +198,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("EventPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Author (human or machine). @@ -210,26 +213,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Device","Organization","CareTeam","Patient","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -241,41 +240,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -286,8 +285,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -314,28 +313,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id UidElement + public Hl7.Fhir.Model.Id? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Id _UidElement; + private Hl7.Fhir.Model.Id? _UidElement; /// /// DICOM SOP Instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Id(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Uid"); } } @@ -345,13 +341,13 @@ public string Uid /// [FhirElement("number", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// DICOM Instance Number @@ -360,13 +356,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -377,13 +370,13 @@ public int? Number [FhirElement("sopClass", Order=60)] [Binding("sopClass")] [DataMember] - public Hl7.Fhir.Model.Coding SopClass + public Hl7.Fhir.Model.Coding? SopClass { get { return _SopClass; } set { _SopClass = value; OnPropertyChanged("SopClass"); } } - private Hl7.Fhir.Model.Coding _SopClass; + private Hl7.Fhir.Model.Coding? _SopClass; /// /// The selected subset of the SOP Instance. @@ -393,24 +386,24 @@ public Hl7.Fhir.Model.Coding SopClass [DataMember] public List SubsetElement { - get { if(_SubsetElement==null) _SubsetElement = new List(); return _SubsetElement; } + get => _SubsetElement ?? new List(); set { _SubsetElement = value; OnPropertyChanged("SubsetElement"); } } - private List _SubsetElement; + private List? _SubsetElement; /// /// The selected subset of the SOP Instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Subset + public IEnumerable? Subset { - get { return SubsetElement != null ? SubsetElement.Select(elem => elem.Value) : null; } + get => _SubsetElement?.Select(elem => elem.Value); set { if (value == null) - SubsetElement = null; + SubsetElement = null!; else SubsetElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Subset"); @@ -425,11 +418,11 @@ public IEnumerable Subset [DataMember] public List ImageRegion2D { - get { if(_ImageRegion2D==null) _ImageRegion2D = new List(); return _ImageRegion2D; } + get => _ImageRegion2D ?? new List(); set { _ImageRegion2D = value; OnPropertyChanged("ImageRegion2D"); } } - private List _ImageRegion2D; + private List? _ImageRegion2D; /// /// A specific 3D region in a DICOM frame of reference. @@ -439,28 +432,24 @@ public List ImageRegion2 [DataMember] public List ImageRegion3D { - get { if(_ImageRegion3D==null) _ImageRegion3D = new List(); return _ImageRegion3D; } + get => _ImageRegion3D ?? new List(); set { _ImageRegion3D = value; OnPropertyChanged("ImageRegion3D"); } } - private List _ImageRegion3D; + private List? _ImageRegion3D; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Id)UidElement.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(SopClass != null) dest.SopClass = (Hl7.Fhir.Model.Coding)SopClass.DeepCopyInternal(); - if(SubsetElement.Any()) dest.SubsetElement = new List(SubsetElement.DeepCopyInternal()); - if(ImageRegion2D.Any()) dest.ImageRegion2D = new List(ImageRegion2D.DeepCopyInternal()); - if(ImageRegion3D.Any()) dest.ImageRegion3D = new List(ImageRegion3D.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Id)_UidElement.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_SopClass is not null) dest.SopClass = (Hl7.Fhir.Model.Coding)_SopClass.DeepCopyInternal(); + if(_SubsetElement is not null) dest.SubsetElement = new List(_SubsetElement.DeepCopyInternal()); + if(_ImageRegion2D is not null) dest.ImageRegion2D = new List(_ImageRegion2D.DeepCopyInternal()); + if(_ImageRegion3D is not null) dest.ImageRegion3D = new List(_ImageRegion3D.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -472,69 +461,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(SopClass, otherT.SopClass)) return false; - if(!comparer.ListEquals(SubsetElement, otherT.SubsetElement)) return false; - if(!comparer.ListEquals(ImageRegion2D, otherT.ImageRegion2D)) return false; - if(!comparer.ListEquals(ImageRegion3D, otherT.ImageRegion3D)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; + if(!comparer.ListEquals(_SubsetElement, otherT._SubsetElement)) return false; + if(!comparer.ListEquals(_ImageRegion2D, otherT._ImageRegion2D)) return false; + if(!comparer.ListEquals(_ImageRegion3D, otherT._ImageRegion3D)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "sopClass": - value = SopClass; - return SopClass is not null; + value = _SopClass; + return _SopClass is not null; case "subset": - value = SubsetElement; - return SubsetElement?.Any() == true; + value = _SubsetElement; + return _SubsetElement?.Any() == true; case "imageRegion2D": - value = ImageRegion2D; - return ImageRegion2D?.Any() == true; + value = _ImageRegion2D; + return _ImageRegion2D?.Any() == true; case "imageRegion3D": - value = ImageRegion3D; - return ImageRegion3D?.Any() == true; + value = _ImageRegion3D; + return _ImageRegion3D?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Id)value; + UidElement = (Hl7.Fhir.Model.Id?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "sopClass": - SopClass = (Hl7.Fhir.Model.Coding)value; + SopClass = (Hl7.Fhir.Model.Coding?)value; return this; case "subset": - SubsetElement = (List)value; + SubsetElement = (List?)value!; return this; case "imageRegion2D": - ImageRegion2D = (List)value; + ImageRegion2D = (List?)value!; return this; case "imageRegion3D": - ImageRegion3D = (List)value; + ImageRegion3D = (List?)value!; return this; default: return base.SetValue(key, value); @@ -545,12 +534,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (SopClass is not null) yield return new KeyValuePair("sopClass",SopClass); - if (SubsetElement?.Any() == true) yield return new KeyValuePair("subset",SubsetElement); - if (ImageRegion2D?.Any() == true) yield return new KeyValuePair("imageRegion2D",ImageRegion2D); - if (ImageRegion3D?.Any() == true) yield return new KeyValuePair("imageRegion3D",ImageRegion3D); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_SopClass is not null) yield return new KeyValuePair("sopClass",_SopClass); + if (_SubsetElement?.Any() == true) yield return new KeyValuePair("subset",_SubsetElement); + if (_ImageRegion2D?.Any() == true) yield return new KeyValuePair("imageRegion2D",_ImageRegion2D); + if (_ImageRegion3D?.Any() == true) yield return new KeyValuePair("imageRegion3D",_ImageRegion3D); } } @@ -580,13 +569,13 @@ public partial class ImageRegion2DComponent : Hl7.Fhir.Model.BackboneElement [Binding("ImagingSelection2DGraphicType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RegionTypeElement + public Code? RegionTypeElement { get { return _RegionTypeElement; } set { _RegionTypeElement = value; OnPropertyChanged("RegionTypeElement"); } } - private Code _RegionTypeElement; + private Code? _RegionTypeElement; /// /// point | polyline | interpolated | circle | ellipse @@ -595,13 +584,10 @@ public Code Regio [IgnoreDataMember] public Hl7.Fhir.Model.ImagingSelection.ImagingSelection2DGraphicType? RegionType { - get { return RegionTypeElement != null ? RegionTypeElement.Value : null; } + get => _RegionTypeElement?.Value; set { - if (value == null) - RegionTypeElement = null; - else - RegionTypeElement = new Code(value); + RegionTypeElement = value is null ? null : new Code(value); OnPropertyChanged("RegionType"); } } @@ -614,24 +600,24 @@ public Hl7.Fhir.Model.ImagingSelection.ImagingSelection2DGraphicType? RegionType [DataMember] public List CoordinateElement { - get { if(_CoordinateElement==null) _CoordinateElement = new List(); return _CoordinateElement; } + get => _CoordinateElement ?? new List(); set { _CoordinateElement = value; OnPropertyChanged("CoordinateElement"); } } - private List _CoordinateElement; + private List? _CoordinateElement; /// /// Specifies the coordinates that define the image region /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Coordinate + public IEnumerable? Coordinate { - get { return CoordinateElement != null ? CoordinateElement.Select(elem => elem.Value) : null; } + get => _CoordinateElement?.Select(elem => elem.Value); set { if (value == null) - CoordinateElement = null; + CoordinateElement = null!; else CoordinateElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("Coordinate"); @@ -640,16 +626,12 @@ public IEnumerable Coordinate protected internal override void CopyToInternal(Base other) { - var dest = other as ImageRegion2DComponent; - - if (dest == null) - { + if(other is not ImageRegion2DComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RegionTypeElement != null) dest.RegionTypeElement = (Code)RegionTypeElement.DeepCopyInternal(); - if(CoordinateElement.Any()) dest.CoordinateElement = new List(CoordinateElement.DeepCopyInternal()); + if(_RegionTypeElement is not null) dest.RegionTypeElement = (Code)_RegionTypeElement.DeepCopyInternal(); + if(_CoordinateElement is not null) dest.CoordinateElement = new List(_CoordinateElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -661,41 +643,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImageRegion2DComponent; - if(otherT == null) return false; + if(other is not ImageRegion2DComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RegionTypeElement, otherT.RegionTypeElement)) return false; - if(!comparer.ListEquals(CoordinateElement, otherT.CoordinateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegionTypeElement, otherT._RegionTypeElement)) return false; + if(!comparer.ListEquals(_CoordinateElement, otherT._CoordinateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "regionType": - value = RegionTypeElement; - return RegionTypeElement is not null; + value = _RegionTypeElement; + return _RegionTypeElement is not null; case "coordinate": - value = CoordinateElement; - return CoordinateElement?.Any() == true; + value = _CoordinateElement; + return _CoordinateElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "regionType": - RegionTypeElement = (Code)value; + RegionTypeElement = (Code?)value; return this; case "coordinate": - CoordinateElement = (List)value; + CoordinateElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -706,8 +688,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RegionTypeElement is not null) yield return new KeyValuePair("regionType",RegionTypeElement); - if (CoordinateElement?.Any() == true) yield return new KeyValuePair("coordinate",CoordinateElement); + if (_RegionTypeElement is not null) yield return new KeyValuePair("regionType",_RegionTypeElement); + if (_CoordinateElement?.Any() == true) yield return new KeyValuePair("coordinate",_CoordinateElement); } } @@ -736,13 +718,13 @@ public partial class ImageRegion3DComponent : Hl7.Fhir.Model.BackboneElement [Binding("ImagingSelection3DGraphicType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RegionTypeElement + public Code? RegionTypeElement { get { return _RegionTypeElement; } set { _RegionTypeElement = value; OnPropertyChanged("RegionTypeElement"); } } - private Code _RegionTypeElement; + private Code? _RegionTypeElement; /// /// point | multipoint | polyline | polygon | ellipse | ellipsoid @@ -751,13 +733,10 @@ public Code Regio [IgnoreDataMember] public Hl7.Fhir.Model.ImagingSelection.ImagingSelection3DGraphicType? RegionType { - get { return RegionTypeElement != null ? RegionTypeElement.Value : null; } + get => _RegionTypeElement?.Value; set { - if (value == null) - RegionTypeElement = null; - else - RegionTypeElement = new Code(value); + RegionTypeElement = value is null ? null : new Code(value); OnPropertyChanged("RegionType"); } } @@ -770,24 +749,24 @@ public Hl7.Fhir.Model.ImagingSelection.ImagingSelection3DGraphicType? RegionType [DataMember] public List CoordinateElement { - get { if(_CoordinateElement==null) _CoordinateElement = new List(); return _CoordinateElement; } + get => _CoordinateElement ?? new List(); set { _CoordinateElement = value; OnPropertyChanged("CoordinateElement"); } } - private List _CoordinateElement; + private List? _CoordinateElement; /// /// Specifies the coordinates that define the image region /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Coordinate + public IEnumerable? Coordinate { - get { return CoordinateElement != null ? CoordinateElement.Select(elem => elem.Value) : null; } + get => _CoordinateElement?.Select(elem => elem.Value); set { if (value == null) - CoordinateElement = null; + CoordinateElement = null!; else CoordinateElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDecimal(elem))); OnPropertyChanged("Coordinate"); @@ -796,16 +775,12 @@ public IEnumerable Coordinate protected internal override void CopyToInternal(Base other) { - var dest = other as ImageRegion3DComponent; - - if (dest == null) - { + if(other is not ImageRegion3DComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RegionTypeElement != null) dest.RegionTypeElement = (Code)RegionTypeElement.DeepCopyInternal(); - if(CoordinateElement.Any()) dest.CoordinateElement = new List(CoordinateElement.DeepCopyInternal()); + if(_RegionTypeElement is not null) dest.RegionTypeElement = (Code)_RegionTypeElement.DeepCopyInternal(); + if(_CoordinateElement is not null) dest.CoordinateElement = new List(_CoordinateElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -817,41 +792,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImageRegion3DComponent; - if(otherT == null) return false; + if(other is not ImageRegion3DComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RegionTypeElement, otherT.RegionTypeElement)) return false; - if(!comparer.ListEquals(CoordinateElement, otherT.CoordinateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegionTypeElement, otherT._RegionTypeElement)) return false; + if(!comparer.ListEquals(_CoordinateElement, otherT._CoordinateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "regionType": - value = RegionTypeElement; - return RegionTypeElement is not null; + value = _RegionTypeElement; + return _RegionTypeElement is not null; case "coordinate": - value = CoordinateElement; - return CoordinateElement?.Any() == true; + value = _CoordinateElement; + return _CoordinateElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "regionType": - RegionTypeElement = (Code)value; + RegionTypeElement = (Code?)value; return this; case "coordinate": - CoordinateElement = (List)value; + CoordinateElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -862,8 +837,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RegionTypeElement is not null) yield return new KeyValuePair("regionType",RegionTypeElement); - if (CoordinateElement?.Any() == true) yield return new KeyValuePair("coordinate",CoordinateElement); + if (_RegionTypeElement is not null) yield return new KeyValuePair("regionType",_RegionTypeElement); + if (_CoordinateElement?.Any() == true) yield return new KeyValuePair("coordinate",_CoordinateElement); } } @@ -876,11 +851,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// available | entered-in-error | unknown. @@ -890,13 +865,13 @@ public List Identifier [Binding("ImagingSelectionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// available | entered-in-error | unknown @@ -905,13 +880,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.ImagingSelection.ImagingSelectionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -923,26 +895,26 @@ public Hl7.Fhir.Model.ImagingSelection.ImagingSelectionStatus? Status [CLSCompliant(false)] [References("Patient","Group","Device","Location","Organization","Procedure","Practitioner","Medication","Substance","Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Date / Time when this imaging selection was created. /// [FhirElement("issued", InSummary=true, Order=120, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// Date / Time when this imaging selection was created @@ -951,13 +923,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -970,11 +939,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Associated request. @@ -986,11 +955,11 @@ public List Performer [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Classifies the imaging selection. @@ -1001,11 +970,11 @@ public List BasedOn [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Imaging Selection purpose text or code. @@ -1014,41 +983,38 @@ public List Category [Binding("ImagingSelectionCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// DICOM Study Instance UID. /// [FhirElement("studyUid", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.Id StudyUidElement + public Hl7.Fhir.Model.Id? StudyUidElement { get { return _StudyUidElement; } set { _StudyUidElement = value; OnPropertyChanged("StudyUidElement"); } } - private Hl7.Fhir.Model.Id _StudyUidElement; + private Hl7.Fhir.Model.Id? _StudyUidElement; /// /// DICOM Study Instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StudyUid + public string? StudyUid { - get { return StudyUidElement != null ? StudyUidElement.Value : null; } + get => _StudyUidElement?.Value; set { - if (value == null) - StudyUidElement = null; - else - StudyUidElement = new Hl7.Fhir.Model.Id(value); + StudyUidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("StudyUid"); } } @@ -1063,11 +1029,11 @@ public string StudyUid [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// The network service providing retrieval for the images referenced in the imaging selection. @@ -1079,39 +1045,36 @@ public List DerivedFrom [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// DICOM Series Instance UID. /// [FhirElement("seriesUid", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.Id SeriesUidElement + public Hl7.Fhir.Model.Id? SeriesUidElement { get { return _SeriesUidElement; } set { _SeriesUidElement = value; OnPropertyChanged("SeriesUidElement"); } } - private Hl7.Fhir.Model.Id _SeriesUidElement; + private Hl7.Fhir.Model.Id? _SeriesUidElement; /// /// DICOM Series Instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SeriesUid + public string? SeriesUid { - get { return SeriesUidElement != null ? SeriesUidElement.Value : null; } + get => _SeriesUidElement?.Value; set { - if (value == null) - SeriesUidElement = null; - else - SeriesUidElement = new Hl7.Fhir.Model.Id(value); + SeriesUidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SeriesUid"); } } @@ -1121,13 +1084,13 @@ public string SeriesUid /// [FhirElement("seriesNumber", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt SeriesNumberElement + public Hl7.Fhir.Model.UnsignedInt? SeriesNumberElement { get { return _SeriesNumberElement; } set { _SeriesNumberElement = value; OnPropertyChanged("SeriesNumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _SeriesNumberElement; + private Hl7.Fhir.Model.UnsignedInt? _SeriesNumberElement; /// /// DICOM Series Number @@ -1136,13 +1099,10 @@ public Hl7.Fhir.Model.UnsignedInt SeriesNumberElement [IgnoreDataMember] public int? SeriesNumber { - get { return SeriesNumberElement != null ? SeriesNumberElement.Value : null; } + get => _SeriesNumberElement?.Value; set { - if (value == null) - SeriesNumberElement = null; - else - SeriesNumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + SeriesNumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("SeriesNumber"); } } @@ -1152,28 +1112,25 @@ public int? SeriesNumber /// [FhirElement("frameOfReferenceUid", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Id FrameOfReferenceUidElement + public Hl7.Fhir.Model.Id? FrameOfReferenceUidElement { get { return _FrameOfReferenceUidElement; } set { _FrameOfReferenceUidElement = value; OnPropertyChanged("FrameOfReferenceUidElement"); } } - private Hl7.Fhir.Model.Id _FrameOfReferenceUidElement; + private Hl7.Fhir.Model.Id? _FrameOfReferenceUidElement; /// /// The Frame of Reference UID for the selected images /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FrameOfReferenceUid + public string? FrameOfReferenceUid { - get { return FrameOfReferenceUidElement != null ? FrameOfReferenceUidElement.Value : null; } + get => _FrameOfReferenceUidElement?.Value; set { - if (value == null) - FrameOfReferenceUidElement = null; - else - FrameOfReferenceUidElement = new Hl7.Fhir.Model.Id(value); + FrameOfReferenceUidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("FrameOfReferenceUid"); } } @@ -1184,13 +1141,13 @@ public string FrameOfReferenceUid [FhirElement("bodySite", InSummary=true, Order=230)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableReference BodySite + public Hl7.Fhir.Model.CodeableReference? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableReference _BodySite; + private Hl7.Fhir.Model.CodeableReference? _BodySite; /// /// Related resource that is the focus for the imaging selection. @@ -1202,11 +1159,11 @@ public Hl7.Fhir.Model.CodeableReference BodySite [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// The selected instances. @@ -1216,41 +1173,37 @@ public List Focus [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImagingSelection; - - if (dest == null) - { + if(other is not ImagingSelection dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StudyUidElement != null) dest.StudyUidElement = (Hl7.Fhir.Model.Id)StudyUidElement.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(SeriesUidElement != null) dest.SeriesUidElement = (Hl7.Fhir.Model.Id)SeriesUidElement.DeepCopyInternal(); - if(SeriesNumberElement != null) dest.SeriesNumberElement = (Hl7.Fhir.Model.UnsignedInt)SeriesNumberElement.DeepCopyInternal(); - if(FrameOfReferenceUidElement != null) dest.FrameOfReferenceUidElement = (Hl7.Fhir.Model.Id)FrameOfReferenceUidElement.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)BodySite.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StudyUidElement is not null) dest.StudyUidElement = (Hl7.Fhir.Model.Id)_StudyUidElement.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_SeriesUidElement is not null) dest.SeriesUidElement = (Hl7.Fhir.Model.Id)_SeriesUidElement.DeepCopyInternal(); + if(_SeriesNumberElement is not null) dest.SeriesNumberElement = (Hl7.Fhir.Model.UnsignedInt)_SeriesNumberElement.DeepCopyInternal(); + if(_FrameOfReferenceUidElement is not null) dest.FrameOfReferenceUidElement = (Hl7.Fhir.Model.Id)_FrameOfReferenceUidElement.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)_BodySite.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1262,146 +1215,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImagingSelection; - if(otherT == null) return false; + if(other is not ImagingSelection otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StudyUidElement, otherT.StudyUidElement)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(SeriesUidElement, otherT.SeriesUidElement)) return false; - if(!comparer.Equals(SeriesNumberElement, otherT.SeriesNumberElement)) return false; - if(!comparer.Equals(FrameOfReferenceUidElement, otherT.FrameOfReferenceUidElement)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StudyUidElement, otherT._StudyUidElement)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_SeriesUidElement, otherT._SeriesUidElement)) return false; + if(!comparer.Equals(_SeriesNumberElement, otherT._SeriesNumberElement)) return false; + if(!comparer.Equals(_FrameOfReferenceUidElement, otherT._FrameOfReferenceUidElement)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "studyUid": - value = StudyUidElement; - return StudyUidElement is not null; + value = _StudyUidElement; + return _StudyUidElement is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "seriesUid": - value = SeriesUidElement; - return SeriesUidElement is not null; + value = _SeriesUidElement; + return _SeriesUidElement is not null; case "seriesNumber": - value = SeriesNumberElement; - return SeriesNumberElement is not null; + value = _SeriesNumberElement; + return _SeriesNumberElement is not null; case "frameOfReferenceUid": - value = FrameOfReferenceUidElement; - return FrameOfReferenceUidElement is not null; + value = _FrameOfReferenceUidElement; + return _FrameOfReferenceUidElement is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyUid": - StudyUidElement = (Hl7.Fhir.Model.Id)value; + StudyUidElement = (Hl7.Fhir.Model.Id?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "seriesUid": - SeriesUidElement = (Hl7.Fhir.Model.Id)value; + SeriesUidElement = (Hl7.Fhir.Model.Id?)value; return this; case "seriesNumber": - SeriesNumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + SeriesNumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "frameOfReferenceUid": - FrameOfReferenceUidElement = (Hl7.Fhir.Model.Id)value; + FrameOfReferenceUidElement = (Hl7.Fhir.Model.Id?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableReference)value; + BodySite = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1412,23 +1365,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StudyUidElement is not null) yield return new KeyValuePair("studyUid",StudyUidElement); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (SeriesUidElement is not null) yield return new KeyValuePair("seriesUid",SeriesUidElement); - if (SeriesNumberElement is not null) yield return new KeyValuePair("seriesNumber",SeriesNumberElement); - if (FrameOfReferenceUidElement is not null) yield return new KeyValuePair("frameOfReferenceUid",FrameOfReferenceUidElement); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StudyUidElement is not null) yield return new KeyValuePair("studyUid",_StudyUidElement); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_SeriesUidElement is not null) yield return new KeyValuePair("seriesUid",_SeriesUidElement); + if (_SeriesNumberElement is not null) yield return new KeyValuePair("seriesNumber",_SeriesNumberElement); + if (_FrameOfReferenceUidElement is not null) yield return new KeyValuePair("frameOfReferenceUid",_FrameOfReferenceUidElement); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs index 032b10c08..feb30ce60 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,28 +124,25 @@ public partial class SeriesComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id UidElement + public Hl7.Fhir.Model.Id? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Id _UidElement; + private Hl7.Fhir.Model.Id? _UidElement; /// /// DICOM Series Instance UID for the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Id(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Uid"); } } @@ -152,13 +152,13 @@ public string Uid /// [FhirElement("number", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// Numeric identifier of this series @@ -167,13 +167,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -185,41 +182,38 @@ public int? Number [Binding("ImagingModality")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modality + public Hl7.Fhir.Model.CodeableConcept? Modality { get { return _Modality; } set { _Modality = value; OnPropertyChanged("Modality"); } } - private Hl7.Fhir.Model.CodeableConcept _Modality; + private Hl7.Fhir.Model.CodeableConcept? _Modality; /// /// A short human readable summary of the series. /// [FhirElement("description", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// A short human readable summary of the series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -229,13 +223,13 @@ public string Description /// [FhirElement("numberOfInstances", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Series Related Instances @@ -244,13 +238,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -265,11 +256,11 @@ public int? NumberOfInstances [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Body part examined. @@ -277,13 +268,13 @@ public List Endpoint [FhirElement("bodySite", InSummary=true, Order=100)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableReference BodySite + public Hl7.Fhir.Model.CodeableReference? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableReference _BodySite; + private Hl7.Fhir.Model.CodeableReference? _BodySite; /// /// Body part laterality. @@ -291,13 +282,13 @@ public Hl7.Fhir.Model.CodeableReference BodySite [FhirElement("laterality", InSummary=true, Order=110)] [Binding("Laterality")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Laterality + public Hl7.Fhir.Model.CodeableConcept? Laterality { get { return _Laterality; } set { _Laterality = value; OnPropertyChanged("Laterality"); } } - private Hl7.Fhir.Model.CodeableConcept _Laterality; + private Hl7.Fhir.Model.CodeableConcept? _Laterality; /// /// Specimen imaged. @@ -309,39 +300,36 @@ public Hl7.Fhir.Model.CodeableConcept Laterality [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// When the series started. /// [FhirElement("started", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the series started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -354,11 +342,11 @@ public string Started [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// A single SOP instance from the series. @@ -368,34 +356,30 @@ public List Performer [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; protected internal override void CopyToInternal(Base other) { - var dest = other as SeriesComponent; - - if (dest == null) - { + if(other is not SeriesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Id)UidElement.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(Modality != null) dest.Modality = (Hl7.Fhir.Model.CodeableConcept)Modality.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)BodySite.DeepCopyInternal(); - if(Laterality != null) dest.Laterality = (Hl7.Fhir.Model.CodeableConcept)Laterality.DeepCopyInternal(); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Id)_UidElement.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = (Hl7.Fhir.Model.CodeableConcept)_Modality.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)_BodySite.DeepCopyInternal(); + if(_Laterality is not null) dest.Laterality = (Hl7.Fhir.Model.CodeableConcept)_Laterality.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -407,111 +391,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SeriesComponent; - if(otherT == null) return false; + if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Laterality, otherT.Laterality)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Laterality, otherT._Laterality)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "modality": - value = Modality; - return Modality is not null; + value = _Modality; + return _Modality is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "laterality": - value = Laterality; - return Laterality is not null; + value = _Laterality; + return _Laterality is not null; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Id)value; + UidElement = (Hl7.Fhir.Model.Id?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "modality": - Modality = (Hl7.Fhir.Model.CodeableConcept)value; + Modality = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableReference)value; + BodySite = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "laterality": - Laterality = (Hl7.Fhir.Model.CodeableConcept)value; + Laterality = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; default: return base.SetValue(key, value); @@ -522,18 +506,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (Modality is not null) yield return new KeyValuePair("modality",Modality); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Laterality is not null) yield return new KeyValuePair("laterality",Laterality); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_Modality is not null) yield return new KeyValuePair("modality",_Modality); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Laterality is not null) yield return new KeyValuePair("laterality",_Laterality); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); } } @@ -561,13 +545,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("EventPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the series. @@ -577,26 +561,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson","HealthcareService")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -608,41 +588,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -653,8 +633,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -681,28 +661,25 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uid", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id UidElement + public Hl7.Fhir.Model.Id? UidElement { get { return _UidElement; } set { _UidElement = value; OnPropertyChanged("UidElement"); } } - private Hl7.Fhir.Model.Id _UidElement; + private Hl7.Fhir.Model.Id? _UidElement; /// /// DICOM SOP Instance UID /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uid + public string? Uid { - get { return UidElement != null ? UidElement.Value : null; } + get => _UidElement?.Value; set { - if (value == null) - UidElement = null; - else - UidElement = new Hl7.Fhir.Model.Id(value); + UidElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Uid"); } } @@ -714,26 +691,26 @@ public string Uid [Binding("sopClass")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding SopClass + public Hl7.Fhir.Model.Coding? SopClass { get { return _SopClass; } set { _SopClass = value; OnPropertyChanged("SopClass"); } } - private Hl7.Fhir.Model.Coding _SopClass; + private Hl7.Fhir.Model.Coding? _SopClass; /// /// The number of this instance in the series. /// [FhirElement("number", Order=60)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberElement + public Hl7.Fhir.Model.UnsignedInt? NumberElement { get { return _NumberElement; } set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberElement; /// /// The number of this instance in the series @@ -742,13 +719,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberElement [IgnoreDataMember] public int? Number { - get { return NumberElement != null ? NumberElement.Value : null; } + get => _NumberElement?.Value; set { - if (value == null) - NumberElement = null; - else - NumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Number"); } } @@ -758,46 +732,39 @@ public int? Number /// [FhirElement("title", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Description of instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UidElement != null) dest.UidElement = (Hl7.Fhir.Model.Id)UidElement.DeepCopyInternal(); - if(SopClass != null) dest.SopClass = (Hl7.Fhir.Model.Coding)SopClass.DeepCopyInternal(); - if(NumberElement != null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)NumberElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); + if(_UidElement is not null) dest.UidElement = (Hl7.Fhir.Model.Id)_UidElement.DeepCopyInternal(); + if(_SopClass is not null) dest.SopClass = (Hl7.Fhir.Model.Coding)_SopClass.DeepCopyInternal(); + if(_NumberElement is not null) dest.NumberElement = (Hl7.Fhir.Model.UnsignedInt)_NumberElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -809,55 +776,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UidElement, otherT.UidElement)) return false; - if(!comparer.Equals(SopClass, otherT.SopClass)) return false; - if(!comparer.Equals(NumberElement, otherT.NumberElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uid": - value = UidElement; - return UidElement is not null; + value = _UidElement; + return _UidElement is not null; case "sopClass": - value = SopClass; - return SopClass is not null; + value = _SopClass; + return _SopClass is not null; case "number": - value = NumberElement; - return NumberElement is not null; + value = _NumberElement; + return _NumberElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uid": - UidElement = (Hl7.Fhir.Model.Id)value; + UidElement = (Hl7.Fhir.Model.Id?)value; return this; case "sopClass": - SopClass = (Hl7.Fhir.Model.Coding)value; + SopClass = (Hl7.Fhir.Model.Coding?)value; return this; case "number": - NumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -868,10 +835,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UidElement is not null) yield return new KeyValuePair("uid",UidElement); - if (SopClass is not null) yield return new KeyValuePair("sopClass",SopClass); - if (NumberElement is not null) yield return new KeyValuePair("number",NumberElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); + if (_UidElement is not null) yield return new KeyValuePair("uid",_UidElement); + if (_SopClass is not null) yield return new KeyValuePair("sopClass",_SopClass); + if (_NumberElement is not null) yield return new KeyValuePair("number",_NumberElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); } } @@ -884,11 +851,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// registered | available | cancelled | entered-in-error | unknown. @@ -898,13 +865,13 @@ public List Identifier [Binding("ImagingStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | available | cancelled | entered-in-error | unknown @@ -913,13 +880,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -933,11 +897,11 @@ public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status [DataMember] public List Modality { - get { if(_Modality==null) _Modality = new List(); return _Modality; } + get => _Modality ?? new List(); set { _Modality = value; OnPropertyChanged("Modality"); } } - private List _Modality; + private List? _Modality; /// /// Who or what is the subject of the study. @@ -947,13 +911,13 @@ public List Modality [References("Patient","Device","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter with which this imaging study is associated. @@ -962,41 +926,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the study was started. /// [FhirElement("started", InSummary=true, Order=140, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartedElement + public Hl7.Fhir.Model.FhirDateTime? StartedElement { get { return _StartedElement; } set { _StartedElement = value; OnPropertyChanged("StartedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartedElement; + private Hl7.Fhir.Model.FhirDateTime? _StartedElement; /// /// When the study was started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Started + public string? Started { - get { return StartedElement != null ? StartedElement.Value : null; } + get => _StartedElement?.Value; set { - if (value == null) - StartedElement = null; - else - StartedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Started"); } } @@ -1011,11 +972,11 @@ public string Started [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -1027,11 +988,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Referring physician. @@ -1040,13 +1001,13 @@ public List PartOf [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Referrer + public Hl7.Fhir.Model.ResourceReference? Referrer { get { return _Referrer; } set { _Referrer = value; OnPropertyChanged("Referrer"); } } - private Hl7.Fhir.Model.ResourceReference _Referrer; + private Hl7.Fhir.Model.ResourceReference? _Referrer; /// /// Study access endpoint. @@ -1058,24 +1019,24 @@ public Hl7.Fhir.Model.ResourceReference Referrer [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Number of Study Related Series. /// [FhirElement("numberOfSeries", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfSeriesElement { get { return _NumberOfSeriesElement; } set { _NumberOfSeriesElement = value; OnPropertyChanged("NumberOfSeriesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfSeriesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfSeriesElement; /// /// Number of Study Related Series @@ -1084,13 +1045,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfSeriesElement [IgnoreDataMember] public int? NumberOfSeries { - get { return NumberOfSeriesElement != null ? NumberOfSeriesElement.Value : null; } + get => _NumberOfSeriesElement?.Value; set { - if (value == null) - NumberOfSeriesElement = null; - else - NumberOfSeriesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfSeriesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfSeries"); } } @@ -1100,13 +1058,13 @@ public int? NumberOfSeries /// [FhirElement("numberOfInstances", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfInstancesElement { get { return _NumberOfInstancesElement; } set { _NumberOfInstancesElement = value; OnPropertyChanged("NumberOfInstancesElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfInstancesElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfInstancesElement; /// /// Number of Study Related Instances @@ -1115,13 +1073,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfInstancesElement [IgnoreDataMember] public int? NumberOfInstances { - get { return NumberOfInstancesElement != null ? NumberOfInstancesElement.Value : null; } + get => _NumberOfInstancesElement?.Value; set { - if (value == null) - NumberOfInstancesElement = null; - else - NumberOfInstancesElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfInstancesElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfInstances"); } } @@ -1135,11 +1090,11 @@ public int? NumberOfInstances [DataMember] public List Procedure { - get { if(_Procedure==null) _Procedure = new List(); return _Procedure; } + get => _Procedure ?? new List(); set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private List _Procedure; + private List? _Procedure; /// /// Where ImagingStudy occurred. @@ -1148,13 +1103,13 @@ public List Procedure [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Why the study was requested / performed. @@ -1165,11 +1120,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// User-defined comments. @@ -1179,39 +1134,36 @@ public List Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Institution-generated description. /// [FhirElement("description", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Institution-generated description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1224,42 +1176,38 @@ public string Description [DataMember] public List Series { - get { if(_Series==null) _Series = new List(); return _Series; } + get => _Series ?? new List(); set { _Series = value; OnPropertyChanged("Series"); } } - private List _Series; + private List? _Series; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImagingStudy; - - if (dest == null) - { + if(other is not ImagingStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Modality.Any()) dest.Modality = new List(Modality.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(StartedElement != null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)StartedElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(Referrer != null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)Referrer.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(NumberOfSeriesElement != null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfSeriesElement.DeepCopyInternal(); - if(NumberOfInstancesElement != null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfInstancesElement.DeepCopyInternal(); - if(Procedure.Any()) dest.Procedure = new List(Procedure.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Series.Any()) dest.Series = new List(Series.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Modality is not null) dest.Modality = new List(_Modality.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_StartedElement is not null) dest.StartedElement = (Hl7.Fhir.Model.FhirDateTime)_StartedElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_Referrer is not null) dest.Referrer = (Hl7.Fhir.Model.ResourceReference)_Referrer.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_NumberOfSeriesElement is not null) dest.NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfSeriesElement.DeepCopyInternal(); + if(_NumberOfInstancesElement is not null) dest.NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfInstancesElement.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = new List(_Procedure.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Series is not null) dest.Series = new List(_Series.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1271,153 +1219,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImagingStudy; - if(otherT == null) return false; + if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Modality, otherT.Modality)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(StartedElement, otherT.StartedElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(Referrer, otherT.Referrer)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(NumberOfSeriesElement, otherT.NumberOfSeriesElement)) return false; - if(!comparer.Equals(NumberOfInstancesElement, otherT.NumberOfInstancesElement)) return false; - if(!comparer.ListEquals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Series, otherT.Series)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Modality, otherT._Modality)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_Referrer, otherT._Referrer)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_NumberOfSeriesElement, otherT._NumberOfSeriesElement)) return false; + if(!comparer.Equals(_NumberOfInstancesElement, otherT._NumberOfInstancesElement)) return false; + if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Series, otherT._Series)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "modality": - value = Modality; - return Modality?.Any() == true; + value = _Modality; + return _Modality?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "started": - value = StartedElement; - return StartedElement is not null; + value = _StartedElement; + return _StartedElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "referrer": - value = Referrer; - return Referrer is not null; + value = _Referrer; + return _Referrer is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "numberOfSeries": - value = NumberOfSeriesElement; - return NumberOfSeriesElement is not null; + value = _NumberOfSeriesElement; + return _NumberOfSeriesElement is not null; case "numberOfInstances": - value = NumberOfInstancesElement; - return NumberOfInstancesElement is not null; + value = _NumberOfInstancesElement; + return _NumberOfInstancesElement is not null; case "procedure": - value = Procedure; - return Procedure?.Any() == true; + value = _Procedure; + return _Procedure?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = Series; - return Series?.Any() == true; + value = _Series; + return _Series?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "modality": - Modality = (List)value; + Modality = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "started": - StartedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "referrer": - Referrer = (Hl7.Fhir.Model.ResourceReference)value; + Referrer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "numberOfSeries": - NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfSeriesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "numberOfInstances": - NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfInstancesElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "procedure": - Procedure = (List)value; + Procedure = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "series": - Series = (List)value; + Series = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1428,24 +1376,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Modality?.Any() == true) yield return new KeyValuePair("modality",Modality); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (StartedElement is not null) yield return new KeyValuePair("started",StartedElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (Referrer is not null) yield return new KeyValuePair("referrer",Referrer); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",NumberOfSeriesElement); - if (NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",NumberOfInstancesElement); - if (Procedure?.Any() == true) yield return new KeyValuePair("procedure",Procedure); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Series?.Any() == true) yield return new KeyValuePair("series",Series); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Modality?.Any() == true) yield return new KeyValuePair("modality",_Modality); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_StartedElement is not null) yield return new KeyValuePair("started",_StartedElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_Referrer is not null) yield return new KeyValuePair("referrer",_Referrer); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_NumberOfSeriesElement is not null) yield return new KeyValuePair("numberOfSeries",_NumberOfSeriesElement); + if (_NumberOfInstancesElement is not null) yield return new KeyValuePair("numberOfInstances",_NumberOfInstancesElement); + if (_Procedure?.Any() == true) yield return new KeyValuePair("procedure",_Procedure); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Series?.Any() == true) yield return new KeyValuePair("series",_Series); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs index ce6bb69cc..7a88166ab 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,13 +112,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("ImmunizationFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual or organization who was performing. @@ -125,26 +128,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -156,41 +155,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -201,8 +200,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -230,13 +229,13 @@ public partial class ProgramEligibilityComponent : Hl7.Fhir.Model.BackboneElemen [Binding("VaccineFundingProgram")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Program + public Hl7.Fhir.Model.CodeableConcept? Program { get { return _Program; } set { _Program = value; OnPropertyChanged("Program"); } } - private Hl7.Fhir.Model.CodeableConcept _Program; + private Hl7.Fhir.Model.CodeableConcept? _Program; /// /// The patient's eligibility status for the program. @@ -245,26 +244,22 @@ public Hl7.Fhir.Model.CodeableConcept Program [Binding("ProgramEligibility")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ProgramStatus + public Hl7.Fhir.Model.CodeableConcept? ProgramStatus { get { return _ProgramStatus; } set { _ProgramStatus = value; OnPropertyChanged("ProgramStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ProgramStatus; + private Hl7.Fhir.Model.CodeableConcept? _ProgramStatus; protected internal override void CopyToInternal(Base other) { - var dest = other as ProgramEligibilityComponent; - - if (dest == null) - { + if(other is not ProgramEligibilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Program != null) dest.Program = (Hl7.Fhir.Model.CodeableConcept)Program.DeepCopyInternal(); - if(ProgramStatus != null) dest.ProgramStatus = (Hl7.Fhir.Model.CodeableConcept)ProgramStatus.DeepCopyInternal(); + if(_Program is not null) dest.Program = (Hl7.Fhir.Model.CodeableConcept)_Program.DeepCopyInternal(); + if(_ProgramStatus is not null) dest.ProgramStatus = (Hl7.Fhir.Model.CodeableConcept)_ProgramStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -276,41 +271,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProgramEligibilityComponent; - if(otherT == null) return false; + if(other is not ProgramEligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Program, otherT.Program)) return false; - if(!comparer.Equals(ProgramStatus, otherT.ProgramStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Program, otherT._Program)) return false; + if(!comparer.Equals(_ProgramStatus, otherT._ProgramStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "program": - value = Program; - return Program is not null; + value = _Program; + return _Program is not null; case "programStatus": - value = ProgramStatus; - return ProgramStatus is not null; + value = _ProgramStatus; + return _ProgramStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "program": - Program = (Hl7.Fhir.Model.CodeableConcept)value; + Program = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "programStatus": - ProgramStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ProgramStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -321,8 +316,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Program is not null) yield return new KeyValuePair("program",Program); - if (ProgramStatus is not null) yield return new KeyValuePair("programStatus",ProgramStatus); + if (_Program is not null) yield return new KeyValuePair("program",_Program); + if (_ProgramStatus is not null) yield return new KeyValuePair("programStatus",_ProgramStatus); } } @@ -349,28 +344,25 @@ public partial class ReactionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("date", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When reaction started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -380,26 +372,26 @@ public string Date /// [FhirElement("manifestation", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Manifestation + public Hl7.Fhir.Model.CodeableReference? Manifestation { get { return _Manifestation; } set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } - private Hl7.Fhir.Model.CodeableReference _Manifestation; + private Hl7.Fhir.Model.CodeableReference? _Manifestation; /// /// Indicates self-reported reaction. /// [FhirElement("reported", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReportedElement + public Hl7.Fhir.Model.FhirBoolean? ReportedElement { get { return _ReportedElement; } set { _ReportedElement = value; OnPropertyChanged("ReportedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReportedElement; + private Hl7.Fhir.Model.FhirBoolean? _ReportedElement; /// /// Indicates self-reported reaction @@ -408,30 +400,23 @@ public Hl7.Fhir.Model.FhirBoolean ReportedElement [IgnoreDataMember] public bool? Reported { - get { return ReportedElement != null ? ReportedElement.Value : null; } + get => _ReportedElement?.Value; set { - if (value == null) - ReportedElement = null; - else - ReportedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReportedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Reported"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReactionComponent; - - if (dest == null) - { + if(other is not ReactionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Manifestation != null) dest.Manifestation = (Hl7.Fhir.Model.CodeableReference)Manifestation.DeepCopyInternal(); - if(ReportedElement != null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)ReportedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Manifestation is not null) dest.Manifestation = (Hl7.Fhir.Model.CodeableReference)_Manifestation.DeepCopyInternal(); + if(_ReportedElement is not null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)_ReportedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -443,48 +428,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReactionComponent; - if(otherT == null) return false; + if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Manifestation, otherT.Manifestation)) return false; - if(!comparer.Equals(ReportedElement, otherT.ReportedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Manifestation, otherT._Manifestation)) return false; + if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "manifestation": - value = Manifestation; - return Manifestation is not null; + value = _Manifestation; + return _Manifestation is not null; case "reported": - value = ReportedElement; - return ReportedElement is not null; + value = _ReportedElement; + return _ReportedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "manifestation": - Manifestation = (Hl7.Fhir.Model.CodeableReference)value; + Manifestation = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "reported": - ReportedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReportedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -495,9 +480,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Manifestation is not null) yield return new KeyValuePair("manifestation",Manifestation); - if (ReportedElement is not null) yield return new KeyValuePair("reported",ReportedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Manifestation is not null) yield return new KeyValuePair("manifestation",_Manifestation); + if (_ReportedElement is not null) yield return new KeyValuePair("reported",_ReportedElement); } } @@ -523,28 +508,25 @@ public partial class ProtocolAppliedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("series", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccine series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -556,13 +538,13 @@ public string Series [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Vaccine preventatable disease being targeted. @@ -573,11 +555,11 @@ public Hl7.Fhir.Model.ResourceReference Authority [DataMember] public List TargetDisease { - get { if(_TargetDisease==null) _TargetDisease = new List(); return _TargetDisease; } + get => _TargetDisease ?? new List(); set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private List _TargetDisease; + private List? _TargetDisease; /// /// Dose number within series. @@ -585,28 +567,25 @@ public List TargetDisease [FhirElement("doseNumber", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DoseNumberElement + public Hl7.Fhir.Model.FhirString? DoseNumberElement { get { return _DoseNumberElement; } set { _DoseNumberElement = value; OnPropertyChanged("DoseNumberElement"); } } - private Hl7.Fhir.Model.FhirString _DoseNumberElement; + private Hl7.Fhir.Model.FhirString? _DoseNumberElement; /// /// Dose number within series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DoseNumber + public string? DoseNumber { - get { return DoseNumberElement != null ? DoseNumberElement.Value : null; } + get => _DoseNumberElement?.Value; set { - if (value == null) - DoseNumberElement = null; - else - DoseNumberElement = new Hl7.Fhir.Model.FhirString(value); + DoseNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DoseNumber"); } } @@ -616,47 +595,40 @@ public string DoseNumber /// [FhirElement("seriesDoses", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesDosesElement + public Hl7.Fhir.Model.FhirString? SeriesDosesElement { get { return _SeriesDosesElement; } set { _SeriesDosesElement = value; OnPropertyChanged("SeriesDosesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesDosesElement; + private Hl7.Fhir.Model.FhirString? _SeriesDosesElement; /// /// Recommended number of doses for immunity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SeriesDoses + public string? SeriesDoses { - get { return SeriesDosesElement != null ? SeriesDosesElement.Value : null; } + get => _SeriesDosesElement?.Value; set { - if (value == null) - SeriesDosesElement = null; - else - SeriesDosesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesDosesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SeriesDoses"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ProtocolAppliedComponent; - - if (dest == null) - { + if(other is not ProtocolAppliedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(TargetDisease.Any()) dest.TargetDisease = new List(TargetDisease.DeepCopyInternal()); - if(DoseNumberElement != null) dest.DoseNumberElement = (Hl7.Fhir.Model.FhirString)DoseNumberElement.DeepCopyInternal(); - if(SeriesDosesElement != null) dest.SeriesDosesElement = (Hl7.Fhir.Model.FhirString)SeriesDosesElement.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = new List(_TargetDisease.DeepCopyInternal()); + if(_DoseNumberElement is not null) dest.DoseNumberElement = (Hl7.Fhir.Model.FhirString)_DoseNumberElement.DeepCopyInternal(); + if(_SeriesDosesElement is not null) dest.SeriesDosesElement = (Hl7.Fhir.Model.FhirString)_SeriesDosesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -668,62 +640,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProtocolAppliedComponent; - if(otherT == null) return false; + if(other is not ProtocolAppliedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(DoseNumberElement, otherT.DoseNumberElement)) return false; - if(!comparer.Equals(SeriesDosesElement, otherT.SeriesDosesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_DoseNumberElement, otherT._DoseNumberElement)) return false; + if(!comparer.Equals(_SeriesDosesElement, otherT._SeriesDosesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease?.Any() == true; + value = _TargetDisease; + return _TargetDisease?.Any() == true; case "doseNumber": - value = DoseNumberElement; - return DoseNumberElement is not null; + value = _DoseNumberElement; + return _DoseNumberElement is not null; case "seriesDoses": - value = SeriesDosesElement; - return SeriesDosesElement is not null; + value = _SeriesDosesElement; + return _SeriesDosesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "targetDisease": - TargetDisease = (List)value; + TargetDisease = (List?)value!; return this; case "doseNumber": - DoseNumberElement = (Hl7.Fhir.Model.FhirString)value; + DoseNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "seriesDoses": - SeriesDosesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesDosesElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -734,11 +706,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",TargetDisease); - if (DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",DoseNumberElement); - if (SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",SeriesDosesElement); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",_DoseNumberElement); + if (_SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",_SeriesDosesElement); } } @@ -751,11 +723,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Authority that the immunization event is based on. @@ -767,11 +739,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// completed | entered-in-error | not-done. @@ -781,13 +753,13 @@ public List BasedOn [Binding("ImmunizationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | entered-in-error | not-done @@ -796,13 +768,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -813,13 +782,13 @@ public Hl7.Fhir.Model.Immunization.ImmunizationStatusCodes? Status [FhirElement("statusReason", Order=120)] [Binding("ImmunizationStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Vaccine administered. @@ -828,67 +797,64 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [Binding("VaccineCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept VaccineCode + public Hl7.Fhir.Model.CodeableConcept? VaccineCode { get { return _VaccineCode; } set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private Hl7.Fhir.Model.CodeableConcept _VaccineCode; + private Hl7.Fhir.Model.CodeableConcept? _VaccineCode; /// /// Product that was administered. /// [FhirElement("administeredProduct", Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableReference AdministeredProduct + public Hl7.Fhir.Model.CodeableReference? AdministeredProduct { get { return _AdministeredProduct; } set { _AdministeredProduct = value; OnPropertyChanged("AdministeredProduct"); } } - private Hl7.Fhir.Model.CodeableReference _AdministeredProduct; + private Hl7.Fhir.Model.CodeableReference? _AdministeredProduct; /// /// Vaccine manufacturer. /// [FhirElement("manufacturer", Order=150)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Manufacturer + public Hl7.Fhir.Model.CodeableReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.CodeableReference _Manufacturer; + private Hl7.Fhir.Model.CodeableReference? _Manufacturer; /// /// Vaccine lot number. /// [FhirElement("lotNumber", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Vaccine lot number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -898,28 +864,25 @@ public string LotNumber /// [FhirElement("expirationDate", Order=170)] [DataMember] - public Hl7.Fhir.Model.Date ExpirationDateElement + public Hl7.Fhir.Model.Date? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.Date _ExpirationDateElement; + private Hl7.Fhir.Model.Date? _ExpirationDateElement; /// /// Vaccine expiration date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.Date(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ExpirationDate"); } } @@ -932,13 +895,13 @@ public string ExpirationDate [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter immunization was part of. @@ -947,13 +910,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Additional information in support of the immunization. @@ -965,11 +928,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Vaccine administration date. @@ -979,26 +942,26 @@ public List SupportingInformation [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirString))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Indicates context the data was captured in. /// [FhirElement("primarySource", InSummary=true, Order=220, FiveWs="FiveWs.source")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement + public Hl7.Fhir.Model.FhirBoolean? PrimarySourceElement { get { return _PrimarySourceElement; } set { _PrimarySourceElement = value; OnPropertyChanged("PrimarySourceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PrimarySourceElement; + private Hl7.Fhir.Model.FhirBoolean? _PrimarySourceElement; /// /// Indicates context the data was captured in @@ -1007,13 +970,10 @@ public Hl7.Fhir.Model.FhirBoolean PrimarySourceElement [IgnoreDataMember] public bool? PrimarySource { - get { return PrimarySourceElement != null ? PrimarySourceElement.Value : null; } + get => _PrimarySourceElement?.Value; set { - if (value == null) - PrimarySourceElement = null; - else - PrimarySourceElement = new Hl7.Fhir.Model.FhirBoolean(value); + PrimarySourceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("PrimarySource"); } } @@ -1024,13 +984,13 @@ public bool? PrimarySource [FhirElement("informationSource", Order=230, FiveWs="FiveWs.source")] [Binding("ImmunizationReportOrigin")] [DataMember] - public Hl7.Fhir.Model.CodeableReference InformationSource + public Hl7.Fhir.Model.CodeableReference? InformationSource { get { return _InformationSource; } set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private Hl7.Fhir.Model.CodeableReference _InformationSource; + private Hl7.Fhir.Model.CodeableReference? _InformationSource; /// /// Where immunization occurred. @@ -1039,13 +999,13 @@ public Hl7.Fhir.Model.CodeableReference InformationSource [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Body site vaccine was administered. @@ -1053,13 +1013,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("site", Order=250)] [Binding("ImmunizationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// How vaccine entered body. @@ -1067,26 +1027,26 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=260)] [Binding("ImmunizationRoute")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// Amount of vaccine administered. /// [FhirElement("doseQuantity", Order=270)] [DataMember] - public Hl7.Fhir.Model.Quantity DoseQuantity + public Hl7.Fhir.Model.Quantity? DoseQuantity { get { return _DoseQuantity; } set { _DoseQuantity = value; OnPropertyChanged("DoseQuantity"); } } - private Hl7.Fhir.Model.Quantity _DoseQuantity; + private Hl7.Fhir.Model.Quantity? _DoseQuantity; /// /// Who performed event. @@ -1096,11 +1056,11 @@ public Hl7.Fhir.Model.Quantity DoseQuantity [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Additional immunization notes. @@ -1110,11 +1070,11 @@ public List Performer [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Why immunization occurred. @@ -1125,24 +1085,24 @@ public List Note [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Dose potency. /// [FhirElement("isSubpotent", InSummary=true, IsModifier=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsSubpotentElement + public Hl7.Fhir.Model.FhirBoolean? IsSubpotentElement { get { return _IsSubpotentElement; } set { _IsSubpotentElement = value; OnPropertyChanged("IsSubpotentElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsSubpotentElement; + private Hl7.Fhir.Model.FhirBoolean? _IsSubpotentElement; /// /// Dose potency @@ -1151,13 +1111,10 @@ public Hl7.Fhir.Model.FhirBoolean IsSubpotentElement [IgnoreDataMember] public bool? IsSubpotent { - get { return IsSubpotentElement != null ? IsSubpotentElement.Value : null; } + get => _IsSubpotentElement?.Value; set { - if (value == null) - IsSubpotentElement = null; - else - IsSubpotentElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsSubpotentElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsSubpotent"); } } @@ -1171,11 +1128,11 @@ public bool? IsSubpotent [DataMember] public List SubpotentReason { - get { if(_SubpotentReason==null) _SubpotentReason = new List(); return _SubpotentReason; } + get => _SubpotentReason ?? new List(); set { _SubpotentReason = value; OnPropertyChanged("SubpotentReason"); } } - private List _SubpotentReason; + private List? _SubpotentReason; /// /// Patient eligibility for a specific vaccination program. @@ -1185,11 +1142,11 @@ public List SubpotentReason [DataMember] public List ProgramEligibility { - get { if(_ProgramEligibility==null) _ProgramEligibility = new List(); return _ProgramEligibility; } + get => _ProgramEligibility ?? new List(); set { _ProgramEligibility = value; OnPropertyChanged("ProgramEligibility"); } } - private List _ProgramEligibility; + private List? _ProgramEligibility; /// /// Funding source for the vaccine. @@ -1197,13 +1154,13 @@ public List ProgramElig [FhirElement("fundingSource", Order=340)] [Binding("FundingSource")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FundingSource + public Hl7.Fhir.Model.CodeableConcept? FundingSource { get { return _FundingSource; } set { _FundingSource = value; OnPropertyChanged("FundingSource"); } } - private Hl7.Fhir.Model.CodeableConcept _FundingSource; + private Hl7.Fhir.Model.CodeableConcept? _FundingSource; /// /// Details of a reaction that follows immunization. @@ -1213,11 +1170,11 @@ public Hl7.Fhir.Model.CodeableConcept FundingSource [DataMember] public List Reaction { - get { if(_Reaction==null) _Reaction = new List(); return _Reaction; } + get => _Reaction ?? new List(); set { _Reaction = value; OnPropertyChanged("Reaction"); } } - private List _Reaction; + private List? _Reaction; /// /// Protocol followed by the provider. @@ -1227,52 +1184,48 @@ public List Reaction [DataMember] public List ProtocolApplied { - get { if(_ProtocolApplied==null) _ProtocolApplied = new List(); return _ProtocolApplied; } + get => _ProtocolApplied ?? new List(); set { _ProtocolApplied = value; OnPropertyChanged("ProtocolApplied"); } } - private List _ProtocolApplied; + private List? _ProtocolApplied; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Immunization; - - if (dest == null) - { + if(other is not Immunization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(VaccineCode != null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)VaccineCode.DeepCopyInternal(); - if(AdministeredProduct != null) dest.AdministeredProduct = (Hl7.Fhir.Model.CodeableReference)AdministeredProduct.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.CodeableReference)Manufacturer.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)ExpirationDateElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(PrimarySourceElement != null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)PrimarySourceElement.DeepCopyInternal(); - if(InformationSource != null) dest.InformationSource = (Hl7.Fhir.Model.CodeableReference)InformationSource.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(DoseQuantity != null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)DoseQuantity.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(IsSubpotentElement != null) dest.IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)IsSubpotentElement.DeepCopyInternal(); - if(SubpotentReason.Any()) dest.SubpotentReason = new List(SubpotentReason.DeepCopyInternal()); - if(ProgramEligibility.Any()) dest.ProgramEligibility = new List(ProgramEligibility.DeepCopyInternal()); - if(FundingSource != null) dest.FundingSource = (Hl7.Fhir.Model.CodeableConcept)FundingSource.DeepCopyInternal(); - if(Reaction.Any()) dest.Reaction = new List(Reaction.DeepCopyInternal()); - if(ProtocolApplied.Any()) dest.ProtocolApplied = new List(ProtocolApplied.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_VaccineCode is not null) dest.VaccineCode = (Hl7.Fhir.Model.CodeableConcept)_VaccineCode.DeepCopyInternal(); + if(_AdministeredProduct is not null) dest.AdministeredProduct = (Hl7.Fhir.Model.CodeableReference)_AdministeredProduct.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.CodeableReference)_Manufacturer.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)_ExpirationDateElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_PrimarySourceElement is not null) dest.PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)_PrimarySourceElement.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = (Hl7.Fhir.Model.CodeableReference)_InformationSource.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_DoseQuantity is not null) dest.DoseQuantity = (Hl7.Fhir.Model.Quantity)_DoseQuantity.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_IsSubpotentElement is not null) dest.IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)_IsSubpotentElement.DeepCopyInternal(); + if(_SubpotentReason is not null) dest.SubpotentReason = new List(_SubpotentReason.DeepCopyInternal()); + if(_ProgramEligibility is not null) dest.ProgramEligibility = new List(_ProgramEligibility.DeepCopyInternal()); + if(_FundingSource is not null) dest.FundingSource = (Hl7.Fhir.Model.CodeableConcept)_FundingSource.DeepCopyInternal(); + if(_Reaction is not null) dest.Reaction = new List(_Reaction.DeepCopyInternal()); + if(_ProtocolApplied is not null) dest.ProtocolApplied = new List(_ProtocolApplied.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1284,223 +1237,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Immunization; - if(otherT == null) return false; + if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.Equals(AdministeredProduct, otherT.AdministeredProduct)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(PrimarySourceElement, otherT.PrimarySourceElement)) return false; - if(!comparer.Equals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(DoseQuantity, otherT.DoseQuantity)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(IsSubpotentElement, otherT.IsSubpotentElement)) return false; - if(!comparer.ListEquals(SubpotentReason, otherT.SubpotentReason)) return false; - if(!comparer.ListEquals(ProgramEligibility, otherT.ProgramEligibility)) return false; - if(!comparer.Equals(FundingSource, otherT.FundingSource)) return false; - if(!comparer.ListEquals(Reaction, otherT.Reaction)) return false; - if(!comparer.ListEquals(ProtocolApplied, otherT.ProtocolApplied)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.Equals(_AdministeredProduct, otherT._AdministeredProduct)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_PrimarySourceElement, otherT._PrimarySourceElement)) return false; + if(!comparer.Equals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_DoseQuantity, otherT._DoseQuantity)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_IsSubpotentElement, otherT._IsSubpotentElement)) return false; + if(!comparer.ListEquals(_SubpotentReason, otherT._SubpotentReason)) return false; + if(!comparer.ListEquals(_ProgramEligibility, otherT._ProgramEligibility)) return false; + if(!comparer.Equals(_FundingSource, otherT._FundingSource)) return false; + if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; + if(!comparer.ListEquals(_ProtocolApplied, otherT._ProtocolApplied)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "vaccineCode": - value = VaccineCode; - return VaccineCode is not null; + value = _VaccineCode; + return _VaccineCode is not null; case "administeredProduct": - value = AdministeredProduct; - return AdministeredProduct is not null; + value = _AdministeredProduct; + return _AdministeredProduct is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "primarySource": - value = PrimarySourceElement; - return PrimarySourceElement is not null; + value = _PrimarySourceElement; + return _PrimarySourceElement is not null; case "informationSource": - value = InformationSource; - return InformationSource is not null; + value = _InformationSource; + return _InformationSource is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "doseQuantity": - value = DoseQuantity; - return DoseQuantity is not null; + value = _DoseQuantity; + return _DoseQuantity is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "isSubpotent": - value = IsSubpotentElement; - return IsSubpotentElement is not null; + value = _IsSubpotentElement; + return _IsSubpotentElement is not null; case "subpotentReason": - value = SubpotentReason; - return SubpotentReason?.Any() == true; + value = _SubpotentReason; + return _SubpotentReason?.Any() == true; case "programEligibility": - value = ProgramEligibility; - return ProgramEligibility?.Any() == true; + value = _ProgramEligibility; + return _ProgramEligibility?.Any() == true; case "fundingSource": - value = FundingSource; - return FundingSource is not null; + value = _FundingSource; + return _FundingSource is not null; case "reaction": - value = Reaction; - return Reaction?.Any() == true; + value = _Reaction; + return _Reaction?.Any() == true; case "protocolApplied": - value = ProtocolApplied; - return ProtocolApplied?.Any() == true; + value = _ProtocolApplied; + return _ProtocolApplied?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "vaccineCode": - VaccineCode = (Hl7.Fhir.Model.CodeableConcept)value; + VaccineCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "administeredProduct": - AdministeredProduct = (Hl7.Fhir.Model.CodeableReference)value; + AdministeredProduct = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.CodeableReference)value; + Manufacturer = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.Date)value; + ExpirationDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "primarySource": - PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean)value; + PrimarySourceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "informationSource": - InformationSource = (Hl7.Fhir.Model.CodeableReference)value; + InformationSource = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseQuantity": - DoseQuantity = (Hl7.Fhir.Model.Quantity)value; + DoseQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "isSubpotent": - IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsSubpotentElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subpotentReason": - SubpotentReason = (List)value; + SubpotentReason = (List?)value!; return this; case "programEligibility": - ProgramEligibility = (List)value; + ProgramEligibility = (List?)value!; return this; case "fundingSource": - FundingSource = (Hl7.Fhir.Model.CodeableConcept)value; + FundingSource = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reaction": - Reaction = (List)value; + Reaction = (List?)value!; return this; case "protocolApplied": - ProtocolApplied = (List)value; + ProtocolApplied = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1511,34 +1464,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (VaccineCode is not null) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (AdministeredProduct is not null) yield return new KeyValuePair("administeredProduct",AdministeredProduct); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",PrimarySourceElement); - if (InformationSource is not null) yield return new KeyValuePair("informationSource",InformationSource); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",DoseQuantity); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (IsSubpotentElement is not null) yield return new KeyValuePair("isSubpotent",IsSubpotentElement); - if (SubpotentReason?.Any() == true) yield return new KeyValuePair("subpotentReason",SubpotentReason); - if (ProgramEligibility?.Any() == true) yield return new KeyValuePair("programEligibility",ProgramEligibility); - if (FundingSource is not null) yield return new KeyValuePair("fundingSource",FundingSource); - if (Reaction?.Any() == true) yield return new KeyValuePair("reaction",Reaction); - if (ProtocolApplied?.Any() == true) yield return new KeyValuePair("protocolApplied",ProtocolApplied); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_VaccineCode is not null) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_AdministeredProduct is not null) yield return new KeyValuePair("administeredProduct",_AdministeredProduct); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_PrimarySourceElement is not null) yield return new KeyValuePair("primarySource",_PrimarySourceElement); + if (_InformationSource is not null) yield return new KeyValuePair("informationSource",_InformationSource); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_DoseQuantity is not null) yield return new KeyValuePair("doseQuantity",_DoseQuantity); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_IsSubpotentElement is not null) yield return new KeyValuePair("isSubpotent",_IsSubpotentElement); + if (_SubpotentReason?.Any() == true) yield return new KeyValuePair("subpotentReason",_SubpotentReason); + if (_ProgramEligibility?.Any() == true) yield return new KeyValuePair("programEligibility",_ProgramEligibility); + if (_FundingSource is not null) yield return new KeyValuePair("fundingSource",_FundingSource); + if (_Reaction?.Any() == true) yield return new KeyValuePair("reaction",_Reaction); + if (_ProtocolApplied?.Any() == true) yield return new KeyValuePair("protocolApplied",_ProtocolApplied); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs index 2c7003ce5..c83a34451 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -89,11 +92,11 @@ public enum ImmunizationEvaluationStatusCodes [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// completed | entered-in-error. @@ -103,13 +106,13 @@ public List Identifier [Binding("ImmunizationEvaluationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | entered-in-error @@ -118,13 +121,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -137,41 +137,38 @@ public Hl7.Fhir.Model.ImmunizationEvaluation.ImmunizationEvaluationStatusCodes? [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Date evaluation was performed. /// [FhirElement("date", Order=120, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date evaluation was performed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -183,13 +180,13 @@ public string Date [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// The vaccine preventable disease schedule being evaluated. @@ -198,13 +195,13 @@ public Hl7.Fhir.Model.ResourceReference Authority [Binding("EvaluationTargetDisease")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TargetDisease + public Hl7.Fhir.Model.CodeableConcept? TargetDisease { get { return _TargetDisease; } set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private Hl7.Fhir.Model.CodeableConcept _TargetDisease; + private Hl7.Fhir.Model.CodeableConcept? _TargetDisease; /// /// Immunization being evaluated. @@ -214,13 +211,13 @@ public Hl7.Fhir.Model.CodeableConcept TargetDisease [References("Immunization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference ImmunizationEvent + public Hl7.Fhir.Model.ResourceReference? ImmunizationEvent { get { return _ImmunizationEvent; } set { _ImmunizationEvent = value; OnPropertyChanged("ImmunizationEvent"); } } - private Hl7.Fhir.Model.ResourceReference _ImmunizationEvent; + private Hl7.Fhir.Model.ResourceReference? _ImmunizationEvent; /// /// Status of the dose relative to published recommendations. @@ -229,13 +226,13 @@ public Hl7.Fhir.Model.ResourceReference ImmunizationEvent [Binding("EvaluationDoseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseStatus + public Hl7.Fhir.Model.CodeableConcept? DoseStatus { get { return _DoseStatus; } set { _DoseStatus = value; OnPropertyChanged("DoseStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseStatus; + private Hl7.Fhir.Model.CodeableConcept? _DoseStatus; /// /// Reason why the doese is considered valid, invalid or some other status. @@ -246,39 +243,36 @@ public Hl7.Fhir.Model.CodeableConcept DoseStatus [DataMember] public List DoseStatusReason { - get { if(_DoseStatusReason==null) _DoseStatusReason = new List(); return _DoseStatusReason; } + get => _DoseStatusReason ?? new List(); set { _DoseStatusReason = value; OnPropertyChanged("DoseStatusReason"); } } - private List _DoseStatusReason; + private List? _DoseStatusReason; /// /// Evaluation notes. /// [FhirElement("description", Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Evaluation notes /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -288,28 +282,25 @@ public string Description /// [FhirElement("series", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccine series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -319,28 +310,25 @@ public string Series /// [FhirElement("doseNumber", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DoseNumberElement + public Hl7.Fhir.Model.FhirString? DoseNumberElement { get { return _DoseNumberElement; } set { _DoseNumberElement = value; OnPropertyChanged("DoseNumberElement"); } } - private Hl7.Fhir.Model.FhirString _DoseNumberElement; + private Hl7.Fhir.Model.FhirString? _DoseNumberElement; /// /// Dose number within series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DoseNumber + public string? DoseNumber { - get { return DoseNumberElement != null ? DoseNumberElement.Value : null; } + get => _DoseNumberElement?.Value; set { - if (value == null) - DoseNumberElement = null; - else - DoseNumberElement = new Hl7.Fhir.Model.FhirString(value); + DoseNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DoseNumber"); } } @@ -350,28 +338,25 @@ public string DoseNumber /// [FhirElement("seriesDoses", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesDosesElement + public Hl7.Fhir.Model.FhirString? SeriesDosesElement { get { return _SeriesDosesElement; } set { _SeriesDosesElement = value; OnPropertyChanged("SeriesDosesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesDosesElement; + private Hl7.Fhir.Model.FhirString? _SeriesDosesElement; /// /// Recommended number of doses for immunity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SeriesDoses + public string? SeriesDoses { - get { return SeriesDosesElement != null ? SeriesDosesElement.Value : null; } + get => _SeriesDosesElement?.Value; set { - if (value == null) - SeriesDosesElement = null; - else - SeriesDosesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesDosesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SeriesDoses"); } } @@ -380,27 +365,23 @@ public string SeriesDoses protected internal override void CopyToInternal(Base other) { - var dest = other as ImmunizationEvaluation; - - if (dest == null) - { + if(other is not ImmunizationEvaluation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(TargetDisease != null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)TargetDisease.DeepCopyInternal(); - if(ImmunizationEvent != null) dest.ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)ImmunizationEvent.DeepCopyInternal(); - if(DoseStatus != null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)DoseStatus.DeepCopyInternal(); - if(DoseStatusReason.Any()) dest.DoseStatusReason = new List(DoseStatusReason.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(DoseNumberElement != null) dest.DoseNumberElement = (Hl7.Fhir.Model.FhirString)DoseNumberElement.DeepCopyInternal(); - if(SeriesDosesElement != null) dest.SeriesDosesElement = (Hl7.Fhir.Model.FhirString)SeriesDosesElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_TargetDisease is not null) dest.TargetDisease = (Hl7.Fhir.Model.CodeableConcept)_TargetDisease.DeepCopyInternal(); + if(_ImmunizationEvent is not null) dest.ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)_ImmunizationEvent.DeepCopyInternal(); + if(_DoseStatus is not null) dest.DoseStatus = (Hl7.Fhir.Model.CodeableConcept)_DoseStatus.DeepCopyInternal(); + if(_DoseStatusReason is not null) dest.DoseStatusReason = new List(_DoseStatusReason.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_DoseNumberElement is not null) dest.DoseNumberElement = (Hl7.Fhir.Model.FhirString)_DoseNumberElement.DeepCopyInternal(); + if(_SeriesDosesElement is not null) dest.SeriesDosesElement = (Hl7.Fhir.Model.FhirString)_SeriesDosesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -412,118 +393,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImmunizationEvaluation; - if(otherT == null) return false; + if(other is not ImmunizationEvaluation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.Equals(ImmunizationEvent, otherT.ImmunizationEvent)) return false; - if(!comparer.Equals(DoseStatus, otherT.DoseStatus)) return false; - if(!comparer.ListEquals(DoseStatusReason, otherT.DoseStatusReason)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(DoseNumberElement, otherT.DoseNumberElement)) return false; - if(!comparer.Equals(SeriesDosesElement, otherT.SeriesDosesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.Equals(_ImmunizationEvent, otherT._ImmunizationEvent)) return false; + if(!comparer.Equals(_DoseStatus, otherT._DoseStatus)) return false; + if(!comparer.ListEquals(_DoseStatusReason, otherT._DoseStatusReason)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_DoseNumberElement, otherT._DoseNumberElement)) return false; + if(!comparer.Equals(_SeriesDosesElement, otherT._SeriesDosesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "targetDisease": - value = TargetDisease; - return TargetDisease is not null; + value = _TargetDisease; + return _TargetDisease is not null; case "immunizationEvent": - value = ImmunizationEvent; - return ImmunizationEvent is not null; + value = _ImmunizationEvent; + return _ImmunizationEvent is not null; case "doseStatus": - value = DoseStatus; - return DoseStatus is not null; + value = _DoseStatus; + return _DoseStatus is not null; case "doseStatusReason": - value = DoseStatusReason; - return DoseStatusReason?.Any() == true; + value = _DoseStatusReason; + return _DoseStatusReason?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "doseNumber": - value = DoseNumberElement; - return DoseNumberElement is not null; + value = _DoseNumberElement; + return _DoseNumberElement is not null; case "seriesDoses": - value = SeriesDosesElement; - return SeriesDosesElement is not null; + value = _SeriesDosesElement; + return _SeriesDosesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "targetDisease": - TargetDisease = (Hl7.Fhir.Model.CodeableConcept)value; + TargetDisease = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "immunizationEvent": - ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference)value; + ImmunizationEvent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "doseStatus": - DoseStatus = (Hl7.Fhir.Model.CodeableConcept)value; + DoseStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "doseStatusReason": - DoseStatusReason = (List)value; + DoseStatusReason = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "doseNumber": - DoseNumberElement = (Hl7.Fhir.Model.FhirString)value; + DoseNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "seriesDoses": - SeriesDosesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesDosesElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -534,19 +515,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (TargetDisease is not null) yield return new KeyValuePair("targetDisease",TargetDisease); - if (ImmunizationEvent is not null) yield return new KeyValuePair("immunizationEvent",ImmunizationEvent); - if (DoseStatus is not null) yield return new KeyValuePair("doseStatus",DoseStatus); - if (DoseStatusReason?.Any() == true) yield return new KeyValuePair("doseStatusReason",DoseStatusReason); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",DoseNumberElement); - if (SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",SeriesDosesElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_TargetDisease is not null) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_ImmunizationEvent is not null) yield return new KeyValuePair("immunizationEvent",_ImmunizationEvent); + if (_DoseStatus is not null) yield return new KeyValuePair("doseStatus",_DoseStatus); + if (_DoseStatusReason?.Any() == true) yield return new KeyValuePair("doseStatusReason",_DoseStatusReason); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",_DoseNumberElement); + if (_SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",_SeriesDosesElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs index e52a0a503..2ee076e4b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,11 +87,11 @@ public partial class RecommendationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List VaccineCode { - get { if(_VaccineCode==null) _VaccineCode = new List(); return _VaccineCode; } + get => _VaccineCode ?? new List(); set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } - private List _VaccineCode; + private List? _VaccineCode; /// /// Disease to be immunized against. @@ -99,11 +102,11 @@ public List VaccineCode [DataMember] public List TargetDisease { - get { if(_TargetDisease==null) _TargetDisease = new List(); return _TargetDisease; } + get => _TargetDisease ?? new List(); set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } - private List _TargetDisease; + private List? _TargetDisease; /// /// Vaccine which is contraindicated to fulfill the recommendation. @@ -114,11 +117,11 @@ public List TargetDisease [DataMember] public List ContraindicatedVaccineCode { - get { if(_ContraindicatedVaccineCode==null) _ContraindicatedVaccineCode = new List(); return _ContraindicatedVaccineCode; } + get => _ContraindicatedVaccineCode ?? new List(); set { _ContraindicatedVaccineCode = value; OnPropertyChanged("ContraindicatedVaccineCode"); } } - private List _ContraindicatedVaccineCode; + private List? _ContraindicatedVaccineCode; /// /// Vaccine recommendation status. @@ -127,13 +130,13 @@ public List ContraindicatedVaccineCode [Binding("ImmunizationRecommendationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ForecastStatus + public Hl7.Fhir.Model.CodeableConcept? ForecastStatus { get { return _ForecastStatus; } set { _ForecastStatus = value; OnPropertyChanged("ForecastStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ForecastStatus; + private Hl7.Fhir.Model.CodeableConcept? _ForecastStatus; /// /// Vaccine administration status reason. @@ -144,11 +147,11 @@ public Hl7.Fhir.Model.CodeableConcept ForecastStatus [DataMember] public List ForecastReason { - get { if(_ForecastReason==null) _ForecastReason = new List(); return _ForecastReason; } + get => _ForecastReason ?? new List(); set { _ForecastReason = value; OnPropertyChanged("ForecastReason"); } } - private List _ForecastReason; + private List? _ForecastReason; /// /// Dates governing proposed immunization. @@ -158,39 +161,36 @@ public List ForecastReason [DataMember] public List DateCriterion { - get { if(_DateCriterion==null) _DateCriterion = new List(); return _DateCriterion; } + get => _DateCriterion ?? new List(); set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } - private List _DateCriterion; + private List? _DateCriterion; /// /// Protocol details. /// [FhirElement("description", Order=100)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Protocol details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -200,28 +200,25 @@ public string Description /// [FhirElement("series", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesElement + public Hl7.Fhir.Model.FhirString? SeriesElement { get { return _SeriesElement; } set { _SeriesElement = value; OnPropertyChanged("SeriesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesElement; + private Hl7.Fhir.Model.FhirString? _SeriesElement; /// /// Name of vaccination series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Series + public string? Series { - get { return SeriesElement != null ? SeriesElement.Value : null; } + get => _SeriesElement?.Value; set { - if (value == null) - SeriesElement = null; - else - SeriesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Series"); } } @@ -231,28 +228,25 @@ public string Series /// [FhirElement("doseNumber", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString DoseNumberElement + public Hl7.Fhir.Model.FhirString? DoseNumberElement { get { return _DoseNumberElement; } set { _DoseNumberElement = value; OnPropertyChanged("DoseNumberElement"); } } - private Hl7.Fhir.Model.FhirString _DoseNumberElement; + private Hl7.Fhir.Model.FhirString? _DoseNumberElement; /// /// Recommended dose number within series /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DoseNumber + public string? DoseNumber { - get { return DoseNumberElement != null ? DoseNumberElement.Value : null; } + get => _DoseNumberElement?.Value; set { - if (value == null) - DoseNumberElement = null; - else - DoseNumberElement = new Hl7.Fhir.Model.FhirString(value); + DoseNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DoseNumber"); } } @@ -262,28 +256,25 @@ public string DoseNumber /// [FhirElement("seriesDoses", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString SeriesDosesElement + public Hl7.Fhir.Model.FhirString? SeriesDosesElement { get { return _SeriesDosesElement; } set { _SeriesDosesElement = value; OnPropertyChanged("SeriesDosesElement"); } } - private Hl7.Fhir.Model.FhirString _SeriesDosesElement; + private Hl7.Fhir.Model.FhirString? _SeriesDosesElement; /// /// Recommended number of doses for immunity /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SeriesDoses + public string? SeriesDoses { - get { return SeriesDosesElement != null ? SeriesDosesElement.Value : null; } + get => _SeriesDosesElement?.Value; set { - if (value == null) - SeriesDosesElement = null; - else - SeriesDosesElement = new Hl7.Fhir.Model.FhirString(value); + SeriesDosesElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SeriesDoses"); } } @@ -298,11 +289,11 @@ public string SeriesDoses [DataMember] public List SupportingImmunization { - get { if(_SupportingImmunization==null) _SupportingImmunization = new List(); return _SupportingImmunization; } + get => _SupportingImmunization ?? new List(); set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } - private List _SupportingImmunization; + private List? _SupportingImmunization; /// /// Patient observations supporting recommendation. @@ -314,34 +305,30 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get { if(_SupportingPatientInformation==null) _SupportingPatientInformation = new List(); return _SupportingPatientInformation; } + get => _SupportingPatientInformation ?? new List(); set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } - private List _SupportingPatientInformation; + private List? _SupportingPatientInformation; protected internal override void CopyToInternal(Base other) { - var dest = other as RecommendationComponent; - - if (dest == null) - { + if(other is not RecommendationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(VaccineCode.Any()) dest.VaccineCode = new List(VaccineCode.DeepCopyInternal()); - if(TargetDisease.Any()) dest.TargetDisease = new List(TargetDisease.DeepCopyInternal()); - if(ContraindicatedVaccineCode.Any()) dest.ContraindicatedVaccineCode = new List(ContraindicatedVaccineCode.DeepCopyInternal()); - if(ForecastStatus != null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)ForecastStatus.DeepCopyInternal(); - if(ForecastReason.Any()) dest.ForecastReason = new List(ForecastReason.DeepCopyInternal()); - if(DateCriterion.Any()) dest.DateCriterion = new List(DateCriterion.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(SeriesElement != null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)SeriesElement.DeepCopyInternal(); - if(DoseNumberElement != null) dest.DoseNumberElement = (Hl7.Fhir.Model.FhirString)DoseNumberElement.DeepCopyInternal(); - if(SeriesDosesElement != null) dest.SeriesDosesElement = (Hl7.Fhir.Model.FhirString)SeriesDosesElement.DeepCopyInternal(); - if(SupportingImmunization.Any()) dest.SupportingImmunization = new List(SupportingImmunization.DeepCopyInternal()); - if(SupportingPatientInformation.Any()) dest.SupportingPatientInformation = new List(SupportingPatientInformation.DeepCopyInternal()); + if(_VaccineCode is not null) dest.VaccineCode = new List(_VaccineCode.DeepCopyInternal()); + if(_TargetDisease is not null) dest.TargetDisease = new List(_TargetDisease.DeepCopyInternal()); + if(_ContraindicatedVaccineCode is not null) dest.ContraindicatedVaccineCode = new List(_ContraindicatedVaccineCode.DeepCopyInternal()); + if(_ForecastStatus is not null) dest.ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)_ForecastStatus.DeepCopyInternal(); + if(_ForecastReason is not null) dest.ForecastReason = new List(_ForecastReason.DeepCopyInternal()); + if(_DateCriterion is not null) dest.DateCriterion = new List(_DateCriterion.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_SeriesElement is not null) dest.SeriesElement = (Hl7.Fhir.Model.FhirString)_SeriesElement.DeepCopyInternal(); + if(_DoseNumberElement is not null) dest.DoseNumberElement = (Hl7.Fhir.Model.FhirString)_DoseNumberElement.DeepCopyInternal(); + if(_SeriesDosesElement is not null) dest.SeriesDosesElement = (Hl7.Fhir.Model.FhirString)_SeriesDosesElement.DeepCopyInternal(); + if(_SupportingImmunization is not null) dest.SupportingImmunization = new List(_SupportingImmunization.DeepCopyInternal()); + if(_SupportingPatientInformation is not null) dest.SupportingPatientInformation = new List(_SupportingPatientInformation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -353,111 +340,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RecommendationComponent; - if(otherT == null) return false; + if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(VaccineCode, otherT.VaccineCode)) return false; - if(!comparer.ListEquals(TargetDisease, otherT.TargetDisease)) return false; - if(!comparer.ListEquals(ContraindicatedVaccineCode, otherT.ContraindicatedVaccineCode)) return false; - if(!comparer.Equals(ForecastStatus, otherT.ForecastStatus)) return false; - if(!comparer.ListEquals(ForecastReason, otherT.ForecastReason)) return false; - if(!comparer.ListEquals(DateCriterion, otherT.DateCriterion)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(SeriesElement, otherT.SeriesElement)) return false; - if(!comparer.Equals(DoseNumberElement, otherT.DoseNumberElement)) return false; - if(!comparer.Equals(SeriesDosesElement, otherT.SeriesDosesElement)) return false; - if(!comparer.ListEquals(SupportingImmunization, otherT.SupportingImmunization)) return false; - if(!comparer.ListEquals(SupportingPatientInformation, otherT.SupportingPatientInformation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; + if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; + if(!comparer.ListEquals(_ContraindicatedVaccineCode, otherT._ContraindicatedVaccineCode)) return false; + if(!comparer.Equals(_ForecastStatus, otherT._ForecastStatus)) return false; + if(!comparer.ListEquals(_ForecastReason, otherT._ForecastReason)) return false; + if(!comparer.ListEquals(_DateCriterion, otherT._DateCriterion)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + if(!comparer.Equals(_DoseNumberElement, otherT._DoseNumberElement)) return false; + if(!comparer.Equals(_SeriesDosesElement, otherT._SeriesDosesElement)) return false; + if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; + if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "vaccineCode": - value = VaccineCode; - return VaccineCode?.Any() == true; + value = _VaccineCode; + return _VaccineCode?.Any() == true; case "targetDisease": - value = TargetDisease; - return TargetDisease?.Any() == true; + value = _TargetDisease; + return _TargetDisease?.Any() == true; case "contraindicatedVaccineCode": - value = ContraindicatedVaccineCode; - return ContraindicatedVaccineCode?.Any() == true; + value = _ContraindicatedVaccineCode; + return _ContraindicatedVaccineCode?.Any() == true; case "forecastStatus": - value = ForecastStatus; - return ForecastStatus is not null; + value = _ForecastStatus; + return _ForecastStatus is not null; case "forecastReason": - value = ForecastReason; - return ForecastReason?.Any() == true; + value = _ForecastReason; + return _ForecastReason?.Any() == true; case "dateCriterion": - value = DateCriterion; - return DateCriterion?.Any() == true; + value = _DateCriterion; + return _DateCriterion?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "series": - value = SeriesElement; - return SeriesElement is not null; + value = _SeriesElement; + return _SeriesElement is not null; case "doseNumber": - value = DoseNumberElement; - return DoseNumberElement is not null; + value = _DoseNumberElement; + return _DoseNumberElement is not null; case "seriesDoses": - value = SeriesDosesElement; - return SeriesDosesElement is not null; + value = _SeriesDosesElement; + return _SeriesDosesElement is not null; case "supportingImmunization": - value = SupportingImmunization; - return SupportingImmunization?.Any() == true; + value = _SupportingImmunization; + return _SupportingImmunization?.Any() == true; case "supportingPatientInformation": - value = SupportingPatientInformation; - return SupportingPatientInformation?.Any() == true; + value = _SupportingPatientInformation; + return _SupportingPatientInformation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "vaccineCode": - VaccineCode = (List)value; + VaccineCode = (List?)value!; return this; case "targetDisease": - TargetDisease = (List)value; + TargetDisease = (List?)value!; return this; case "contraindicatedVaccineCode": - ContraindicatedVaccineCode = (List)value; + ContraindicatedVaccineCode = (List?)value!; return this; case "forecastStatus": - ForecastStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ForecastStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "forecastReason": - ForecastReason = (List)value; + ForecastReason = (List?)value!; return this; case "dateCriterion": - DateCriterion = (List)value; + DateCriterion = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "series": - SeriesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "doseNumber": - DoseNumberElement = (Hl7.Fhir.Model.FhirString)value; + DoseNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "seriesDoses": - SeriesDosesElement = (Hl7.Fhir.Model.FhirString)value; + SeriesDosesElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "supportingImmunization": - SupportingImmunization = (List)value; + SupportingImmunization = (List?)value!; return this; case "supportingPatientInformation": - SupportingPatientInformation = (List)value; + SupportingPatientInformation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -468,18 +455,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (VaccineCode?.Any() == true) yield return new KeyValuePair("vaccineCode",VaccineCode); - if (TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",TargetDisease); - if (ContraindicatedVaccineCode?.Any() == true) yield return new KeyValuePair("contraindicatedVaccineCode",ContraindicatedVaccineCode); - if (ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",ForecastStatus); - if (ForecastReason?.Any() == true) yield return new KeyValuePair("forecastReason",ForecastReason); - if (DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",DateCriterion); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (SeriesElement is not null) yield return new KeyValuePair("series",SeriesElement); - if (DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",DoseNumberElement); - if (SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",SeriesDosesElement); - if (SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",SupportingImmunization); - if (SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",SupportingPatientInformation); + if (_VaccineCode?.Any() == true) yield return new KeyValuePair("vaccineCode",_VaccineCode); + if (_TargetDisease?.Any() == true) yield return new KeyValuePair("targetDisease",_TargetDisease); + if (_ContraindicatedVaccineCode?.Any() == true) yield return new KeyValuePair("contraindicatedVaccineCode",_ContraindicatedVaccineCode); + if (_ForecastStatus is not null) yield return new KeyValuePair("forecastStatus",_ForecastStatus); + if (_ForecastReason?.Any() == true) yield return new KeyValuePair("forecastReason",_ForecastReason); + if (_DateCriterion?.Any() == true) yield return new KeyValuePair("dateCriterion",_DateCriterion); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_SeriesElement is not null) yield return new KeyValuePair("series",_SeriesElement); + if (_DoseNumberElement is not null) yield return new KeyValuePair("doseNumber",_DoseNumberElement); + if (_SeriesDosesElement is not null) yield return new KeyValuePair("seriesDoses",_SeriesDosesElement); + if (_SupportingImmunization?.Any() == true) yield return new KeyValuePair("supportingImmunization",_SupportingImmunization); + if (_SupportingPatientInformation?.Any() == true) yield return new KeyValuePair("supportingPatientInformation",_SupportingPatientInformation); } } @@ -507,13 +494,13 @@ public partial class DateCriterionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ImmunizationRecommendationDateCriterion")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Recommended date. @@ -521,44 +508,37 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValueElement + public Hl7.Fhir.Model.FhirDateTime? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValueElement; + private Hl7.Fhir.Model.FhirDateTime? _ValueElement; /// /// Recommended date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DateCriterionComponent; - - if (dest == null) - { + if(other is not DateCriterionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)ValueElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDateTime)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -570,41 +550,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DateCriterionComponent; - if(otherT == null) return false; + if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValueElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -615,8 +595,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -629,11 +609,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Who this profile is for. @@ -643,13 +623,13 @@ public List Identifier [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Date recommendation(s) created. @@ -657,28 +637,25 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("date", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date recommendation(s) created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -690,13 +667,13 @@ public string Date [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Authority + public Hl7.Fhir.Model.ResourceReference? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.ResourceReference _Authority; + private Hl7.Fhir.Model.ResourceReference? _Authority; /// /// Vaccine administration recommendations. @@ -706,29 +683,25 @@ public Hl7.Fhir.Model.ResourceReference Authority [DataMember] public List Recommendation { - get { if(_Recommendation==null) _Recommendation = new List(); return _Recommendation; } + get => _Recommendation ?? new List(); set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } - private List _Recommendation; + private List? _Recommendation; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImmunizationRecommendation; - - if (dest == null) - { + if(other is not ImmunizationRecommendation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)Authority.DeepCopyInternal(); - if(Recommendation.Any()) dest.Recommendation = new List(Recommendation.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.ResourceReference)_Authority.DeepCopyInternal(); + if(_Recommendation is not null) dest.Recommendation = new List(_Recommendation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -740,62 +713,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImmunizationRecommendation; - if(otherT == null) return false; + if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.ListEquals(Recommendation, otherT.Recommendation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "recommendation": - value = Recommendation; - return Recommendation?.Any() == true; + value = _Recommendation; + return _Recommendation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "authority": - Authority = (Hl7.Fhir.Model.ResourceReference)value; + Authority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recommendation": - Recommendation = (List)value; + Recommendation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -806,11 +779,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",Recommendation); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_Recommendation?.Any() == true) yield return new KeyValuePair("recommendation",_Recommendation); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs index f5347e13d..c8dde7930 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -2201,28 +2204,25 @@ public partial class DependsOnComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("uri", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical UriElement + public Hl7.Fhir.Model.Canonical? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.Canonical _UriElement; + private Hl7.Fhir.Model.Canonical? _UriElement; /// /// Identity of the IG that this depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.Canonical(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Uri"); } } @@ -2232,28 +2232,25 @@ public string Uri /// [FhirElement("packageId", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Id PackageIdElement + public Hl7.Fhir.Model.Id? PackageIdElement { get { return _PackageIdElement; } set { _PackageIdElement = value; OnPropertyChanged("PackageIdElement"); } } - private Hl7.Fhir.Model.Id _PackageIdElement; + private Hl7.Fhir.Model.Id? _PackageIdElement; /// /// NPM Package name for IG this depends on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PackageId + public string? PackageId { - get { return PackageIdElement != null ? PackageIdElement.Value : null; } + get => _PackageIdElement?.Value; set { - if (value == null) - PackageIdElement = null; - else - PackageIdElement = new Hl7.Fhir.Model.Id(value); + PackageIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("PackageId"); } } @@ -2263,28 +2260,25 @@ public string PackageId /// [FhirElement("version", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of the IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2294,46 +2288,39 @@ public string Version /// [FhirElement("reason", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown ReasonElement + public Hl7.Fhir.Model.Markdown? ReasonElement { get { return _ReasonElement; } set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private Hl7.Fhir.Model.Markdown _ReasonElement; + private Hl7.Fhir.Model.Markdown? _ReasonElement; /// /// Why dependency exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reason + public string? Reason { - get { return ReasonElement != null ? ReasonElement.Value : null; } + get => _ReasonElement?.Value; set { - if (value == null) - ReasonElement = null; - else - ReasonElement = new Hl7.Fhir.Model.Markdown(value); + ReasonElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Reason"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DependsOnComponent; - - if (dest == null) - { + if(other is not DependsOnComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.Canonical)UriElement.DeepCopyInternal(); - if(PackageIdElement != null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)PackageIdElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(ReasonElement != null) dest.ReasonElement = (Hl7.Fhir.Model.Markdown)ReasonElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.Canonical)_UriElement.DeepCopyInternal(); + if(_PackageIdElement is not null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)_PackageIdElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_ReasonElement is not null) dest.ReasonElement = (Hl7.Fhir.Model.Markdown)_ReasonElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2345,55 +2332,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependsOnComponent; - if(otherT == null) return false; + if(other is not DependsOnComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(PackageIdElement, otherT.PackageIdElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(ReasonElement, otherT.ReasonElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "packageId": - value = PackageIdElement; - return PackageIdElement is not null; + value = _PackageIdElement; + return _PackageIdElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "reason": - value = ReasonElement; - return ReasonElement is not null; + value = _ReasonElement; + return _ReasonElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uri": - UriElement = (Hl7.Fhir.Model.Canonical)value; + UriElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "packageId": - PackageIdElement = (Hl7.Fhir.Model.Id)value; + PackageIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "reason": - ReasonElement = (Hl7.Fhir.Model.Markdown)value; + ReasonElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2404,10 +2391,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (PackageIdElement is not null) yield return new KeyValuePair("packageId",PackageIdElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (ReasonElement is not null) yield return new KeyValuePair("reason",ReasonElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_PackageIdElement is not null) yield return new KeyValuePair("packageId",_PackageIdElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_ReasonElement is not null) yield return new KeyValuePair("reason",_ReasonElement); } } @@ -2437,13 +2424,13 @@ public partial class GlobalComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// Type this profile applies to @@ -2452,13 +2439,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2469,44 +2453,37 @@ public Hl7.Fhir.Model.ResourceType? Type [FhirElement("profile", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile that all resources must conform to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GlobalComponent; - - if (dest == null) - { + if(other is not GlobalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2518,41 +2495,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GlobalComponent; - if(otherT == null) return false; + if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -2563,8 +2540,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } @@ -2594,11 +2571,11 @@ public partial class DefinitionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Grouping { - get { if(_Grouping==null) _Grouping = new List(); return _Grouping; } + get => _Grouping ?? new List(); set { _Grouping = value; OnPropertyChanged("Grouping"); } } - private List _Grouping; + private List? _Grouping; /// /// Resource in the implementation guide. @@ -2608,24 +2585,24 @@ public List Grouping [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// Page/Section in the Guide. /// [FhirElement("page", Order=60)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.PageComponent Page + public Hl7.Fhir.Model.ImplementationGuide.PageComponent? Page { get { return _Page; } set { _Page = value; OnPropertyChanged("Page"); } } - private Hl7.Fhir.Model.ImplementationGuide.PageComponent _Page; + private Hl7.Fhir.Model.ImplementationGuide.PageComponent? _Page; /// /// Defines how IG is built by tools. @@ -2635,11 +2612,11 @@ public Hl7.Fhir.Model.ImplementationGuide.PageComponent Page [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// A template for building resources. @@ -2649,27 +2626,23 @@ public List Parameter [DataMember] public List Template { - get { if(_Template==null) _Template = new List(); return _Template; } + get => _Template ?? new List(); set { _Template = value; OnPropertyChanged("Template"); } } - private List _Template; + private List? _Template; protected internal override void CopyToInternal(Base other) { - var dest = other as DefinitionComponent; - - if (dest == null) - { + if(other is not DefinitionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Grouping.Any()) dest.Grouping = new List(Grouping.DeepCopyInternal()); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Page != null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)Page.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Template.Any()) dest.Template = new List(Template.DeepCopyInternal()); + if(_Grouping is not null) dest.Grouping = new List(_Grouping.DeepCopyInternal()); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Page is not null) dest.Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)_Page.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Template is not null) dest.Template = new List(_Template.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2681,62 +2654,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DefinitionComponent; - if(otherT == null) return false; + if(other is not DefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Grouping, otherT.Grouping)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.Equals(Page, otherT.Page)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Template, otherT.Template)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.Equals(_Page, otherT._Page)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Template, otherT._Template)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "grouping": - value = Grouping; - return Grouping?.Any() == true; + value = _Grouping; + return _Grouping?.Any() == true; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "page": - value = Page; - return Page is not null; + value = _Page; + return _Page is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "template": - value = Template; - return Template?.Any() == true; + value = _Template; + return _Template?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "grouping": - Grouping = (List)value; + Grouping = (List?)value!; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "page": - Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent)value; + Page = (Hl7.Fhir.Model.ImplementationGuide.PageComponent?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "template": - Template = (List)value; + Template = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2747,11 +2720,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Grouping?.Any() == true) yield return new KeyValuePair("grouping",Grouping); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Page is not null) yield return new KeyValuePair("page",Page); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Template?.Any() == true) yield return new KeyValuePair("template",Template); + if (_Grouping?.Any() == true) yield return new KeyValuePair("grouping",_Grouping); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Page is not null) yield return new KeyValuePair("page",_Page); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Template?.Any() == true) yield return new KeyValuePair("template",_Template); } } @@ -2779,28 +2752,25 @@ public partial class GroupingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptive name for the package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2810,44 +2780,37 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Human readable text describing the package /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GroupingComponent; - - if (dest == null) - { + if(other is not GroupingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2859,41 +2822,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupingComponent; - if(otherT == null) return false; + if(other is not GroupingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -2904,8 +2867,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -2934,13 +2897,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Versions this applies to (if different to IG). @@ -2952,24 +2915,24 @@ public Hl7.Fhir.Model.ResourceReference Reference [DataMember] public List> FhirVersionElement { - get { if(_FhirVersionElement==null) _FhirVersionElement = new List>(); return _FhirVersionElement; } + get => _FhirVersionElement ?? new List>(); set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private List> _FhirVersionElement; + private List>? _FhirVersionElement; /// /// Versions this applies to (if different to IG) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FhirVersion + public IEnumerable? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Select(elem => elem.Value) : null; } + get => _FhirVersionElement?.Select(elem => elem.Value); set { if (value == null) - FhirVersionElement = null; + FhirVersionElement = null!; else FhirVersionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("FhirVersion"); @@ -2981,28 +2944,25 @@ public IEnumerable FhirVersion /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human readable name for the resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3012,28 +2972,25 @@ public string Name /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Reason why included in guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -3043,13 +3000,13 @@ public string Description /// [FhirElement("isExample", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsExampleElement + public Hl7.Fhir.Model.FhirBoolean? IsExampleElement { get { return _IsExampleElement; } set { _IsExampleElement = value; OnPropertyChanged("IsExampleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsExampleElement; + private Hl7.Fhir.Model.FhirBoolean? _IsExampleElement; /// /// Is this an example @@ -3058,13 +3015,10 @@ public Hl7.Fhir.Model.FhirBoolean IsExampleElement [IgnoreDataMember] public bool? IsExample { - get { return IsExampleElement != null ? IsExampleElement.Value : null; } + get => _IsExampleElement?.Value; set { - if (value == null) - IsExampleElement = null; - else - IsExampleElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsExampleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsExample"); } } @@ -3077,24 +3031,24 @@ public bool? IsExample [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// Profile(s) this is an example of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -3106,49 +3060,42 @@ public IEnumerable Profile /// [FhirElement("groupingId", Order=100)] [DataMember] - public Hl7.Fhir.Model.Id GroupingIdElement + public Hl7.Fhir.Model.Id? GroupingIdElement { get { return _GroupingIdElement; } set { _GroupingIdElement = value; OnPropertyChanged("GroupingIdElement"); } } - private Hl7.Fhir.Model.Id _GroupingIdElement; + private Hl7.Fhir.Model.Id? _GroupingIdElement; /// /// Grouping this is part of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string GroupingId + public string? GroupingId { - get { return GroupingIdElement != null ? GroupingIdElement.Value : null; } + get => _GroupingIdElement?.Value; set { - if (value == null) - GroupingIdElement = null; - else - GroupingIdElement = new Hl7.Fhir.Model.Id(value); + GroupingIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("GroupingId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(FhirVersionElement.Any()) dest.FhirVersionElement = new List>(FhirVersionElement.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(IsExampleElement != null) dest.IsExampleElement = (Hl7.Fhir.Model.FhirBoolean)IsExampleElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(GroupingIdElement != null) dest.GroupingIdElement = (Hl7.Fhir.Model.Id)GroupingIdElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = new List>(_FhirVersionElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_IsExampleElement is not null) dest.IsExampleElement = (Hl7.Fhir.Model.FhirBoolean)_IsExampleElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_GroupingIdElement is not null) dest.GroupingIdElement = (Hl7.Fhir.Model.Id)_GroupingIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3160,76 +3107,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.ListEquals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(IsExampleElement, otherT.IsExampleElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(GroupingIdElement, otherT.GroupingIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_IsExampleElement, otherT._IsExampleElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_GroupingIdElement, otherT._GroupingIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement?.Any() == true; + value = _FhirVersionElement; + return _FhirVersionElement?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "isExample": - value = IsExampleElement; - return IsExampleElement is not null; + value = _IsExampleElement; + return _IsExampleElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "groupingId": - value = GroupingIdElement; - return GroupingIdElement is not null; + value = _GroupingIdElement; + return _GroupingIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "fhirVersion": - FhirVersionElement = (List>)value; + FhirVersionElement = (List>?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "isExample": - IsExampleElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsExampleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "groupingId": - GroupingIdElement = (Hl7.Fhir.Model.Id)value; + GroupingIdElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -3240,13 +3187,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (IsExampleElement is not null) yield return new KeyValuePair("isExample",IsExampleElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (GroupingIdElement is not null) yield return new KeyValuePair("groupingId",GroupingIdElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_IsExampleElement is not null) yield return new KeyValuePair("isExample",_IsExampleElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_GroupingIdElement is not null) yield return new KeyValuePair("groupingId",_GroupingIdElement); } } @@ -3275,13 +3222,13 @@ public partial class PageComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Markdown))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// Name of the page when published. @@ -3289,28 +3236,25 @@ public Hl7.Fhir.Model.DataType Source [FhirElement("name", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUrl NameElement + public Hl7.Fhir.Model.FhirUrl? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirUrl _NameElement; + private Hl7.Fhir.Model.FhirUrl? _NameElement; /// /// Name of the page when published /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirUrl(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Name"); } } @@ -3321,28 +3265,25 @@ public string Name [FhirElement("title", Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Short title shown for navigational assistance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -3355,13 +3296,13 @@ public string Title [Binding("GuidePageGeneration")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code GenerationElement + public Code? GenerationElement { get { return _GenerationElement; } set { _GenerationElement = value; OnPropertyChanged("GenerationElement"); } } - private Code _GenerationElement; + private Code? _GenerationElement; /// /// html | markdown | xml | generated @@ -3370,13 +3311,10 @@ public Code GenerationEl [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation { - get { return GenerationElement != null ? GenerationElement.Value : null; } + get => _GenerationElement?.Value; set { - if (value == null) - GenerationElement = null; - else - GenerationElement = new Code(value); + GenerationElement = value is null ? null : new Code(value); OnPropertyChanged("Generation"); } } @@ -3389,27 +3327,23 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation [DataMember] public List Page { - get { if(_Page==null) _Page = new List(); return _Page; } + get => _Page ?? new List(); set { _Page = value; OnPropertyChanged("Page"); } } - private List _Page; + private List? _Page; protected internal override void CopyToInternal(Base other) { - var dest = other as PageComponent; - - if (dest == null) - { + if(other is not PageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirUrl)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(GenerationElement != null) dest.GenerationElement = (Code)GenerationElement.DeepCopyInternal(); - if(Page.Any()) dest.Page = new List(Page.DeepCopyInternal()); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirUrl)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_GenerationElement is not null) dest.GenerationElement = (Code)_GenerationElement.DeepCopyInternal(); + if(_Page is not null) dest.Page = new List(_Page.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3421,62 +3355,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PageComponent; - if(otherT == null) return false; + if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(GenerationElement, otherT.GenerationElement)) return false; - if(!comparer.ListEquals(Page, otherT.Page)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_GenerationElement, otherT._GenerationElement)) return false; + if(!comparer.ListEquals(_Page, otherT._Page)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "generation": - value = GenerationElement; - return GenerationElement is not null; + value = _GenerationElement; + return _GenerationElement is not null; case "page": - value = Page; - return Page?.Any() == true; + value = _Page; + return _Page?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirUrl)value; + NameElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "generation": - GenerationElement = (Code)value; + GenerationElement = (Code?)value; return this; case "page": - Page = (List)value; + Page = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3487,11 +3421,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Source is not null) yield return new KeyValuePair("source",Source); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (GenerationElement is not null) yield return new KeyValuePair("generation",GenerationElement); - if (Page?.Any() == true) yield return new KeyValuePair("page",Page); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_GenerationElement is not null) yield return new KeyValuePair("generation",_GenerationElement); + if (_Page?.Any() == true) yield return new KeyValuePair("page",_Page); } } @@ -3519,13 +3453,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Code + public Hl7.Fhir.Model.Coding? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.Coding _Code; + private Hl7.Fhir.Model.Coding? _Code; /// /// Value for named type. @@ -3533,44 +3467,37 @@ public Hl7.Fhir.Model.Coding Code [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value for named type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.Coding)Code.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.Coding)_Code.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3582,41 +3509,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.Coding)value; + Code = (Hl7.Fhir.Model.Coding?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3627,8 +3554,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -3652,28 +3579,25 @@ public partial class TemplateComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Type of template specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -3684,28 +3608,25 @@ public string Code [FhirElement("source", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// The source location for the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -3715,45 +3636,38 @@ public string Source /// [FhirElement("scope", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ScopeElement + public Hl7.Fhir.Model.FhirString? ScopeElement { get { return _ScopeElement; } set { _ScopeElement = value; OnPropertyChanged("ScopeElement"); } } - private Hl7.Fhir.Model.FhirString _ScopeElement; + private Hl7.Fhir.Model.FhirString? _ScopeElement; /// /// The scope in which the template applies /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Scope + public string? Scope { - get { return ScopeElement != null ? ScopeElement.Value : null; } + get => _ScopeElement?.Value; set { - if (value == null) - ScopeElement = null; - else - ScopeElement = new Hl7.Fhir.Model.FhirString(value); + ScopeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Scope"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TemplateComponent; - - if (dest == null) - { + if(other is not TemplateComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(ScopeElement != null) dest.ScopeElement = (Hl7.Fhir.Model.FhirString)ScopeElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_ScopeElement is not null) dest.ScopeElement = (Hl7.Fhir.Model.FhirString)_ScopeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3765,48 +3679,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TemplateComponent; - if(otherT == null) return false; + if(other is not TemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(ScopeElement, otherT.ScopeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "scope": - value = ScopeElement; - return ScopeElement is not null; + value = _ScopeElement; + return _ScopeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "scope": - ScopeElement = (Hl7.Fhir.Model.FhirString)value; + ScopeElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3817,9 +3731,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (ScopeElement is not null) yield return new KeyValuePair("scope",ScopeElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_ScopeElement is not null) yield return new KeyValuePair("scope",_ScopeElement); } } @@ -3845,28 +3759,25 @@ public partial class ManifestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("rendering", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUrl RenderingElement + public Hl7.Fhir.Model.FhirUrl? RenderingElement { get { return _RenderingElement; } set { _RenderingElement = value; OnPropertyChanged("RenderingElement"); } } - private Hl7.Fhir.Model.FhirUrl _RenderingElement; + private Hl7.Fhir.Model.FhirUrl? _RenderingElement; /// /// Location of rendered implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rendering + public string? Rendering { - get { return RenderingElement != null ? RenderingElement.Value : null; } + get => _RenderingElement?.Value; set { - if (value == null) - RenderingElement = null; - else - RenderingElement = new Hl7.Fhir.Model.FhirUrl(value); + RenderingElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Rendering"); } } @@ -3879,11 +3790,11 @@ public string Rendering [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// HTML page within the parent IG. @@ -3893,11 +3804,11 @@ public List Resour [DataMember] public List Page { - get { if(_Page==null) _Page = new List(); return _Page; } + get => _Page ?? new List(); set { _Page = value; OnPropertyChanged("Page"); } } - private List _Page; + private List? _Page; /// /// Image within the IG. @@ -3907,24 +3818,24 @@ public List Page [DataMember] public List ImageElement { - get { if(_ImageElement==null) _ImageElement = new List(); return _ImageElement; } + get => _ImageElement ?? new List(); set { _ImageElement = value; OnPropertyChanged("ImageElement"); } } - private List _ImageElement; + private List? _ImageElement; /// /// Image within the IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Image + public IEnumerable? Image { - get { return ImageElement != null ? ImageElement.Select(elem => elem.Value) : null; } + get => _ImageElement?.Select(elem => elem.Value); set { if (value == null) - ImageElement = null; + ImageElement = null!; else ImageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Image"); @@ -3939,24 +3850,24 @@ public IEnumerable Image [DataMember] public List OtherElement { - get { if(_OtherElement==null) _OtherElement = new List(); return _OtherElement; } + get => _OtherElement ?? new List(); set { _OtherElement = value; OnPropertyChanged("OtherElement"); } } - private List _OtherElement; + private List? _OtherElement; /// /// Additional linkable file in IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Other + public IEnumerable? Other { - get { return OtherElement != null ? OtherElement.Select(elem => elem.Value) : null; } + get => _OtherElement?.Select(elem => elem.Value); set { if (value == null) - OtherElement = null; + OtherElement = null!; else OtherElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Other"); @@ -3965,19 +3876,15 @@ public IEnumerable Other protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestComponent; - - if (dest == null) - { + if(other is not ManifestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RenderingElement != null) dest.RenderingElement = (Hl7.Fhir.Model.FhirUrl)RenderingElement.DeepCopyInternal(); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Page.Any()) dest.Page = new List(Page.DeepCopyInternal()); - if(ImageElement.Any()) dest.ImageElement = new List(ImageElement.DeepCopyInternal()); - if(OtherElement.Any()) dest.OtherElement = new List(OtherElement.DeepCopyInternal()); + if(_RenderingElement is not null) dest.RenderingElement = (Hl7.Fhir.Model.FhirUrl)_RenderingElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Page is not null) dest.Page = new List(_Page.DeepCopyInternal()); + if(_ImageElement is not null) dest.ImageElement = new List(_ImageElement.DeepCopyInternal()); + if(_OtherElement is not null) dest.OtherElement = new List(_OtherElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3989,62 +3896,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestComponent; - if(otherT == null) return false; + if(other is not ManifestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RenderingElement, otherT.RenderingElement)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Page, otherT.Page)) return false; - if(!comparer.ListEquals(ImageElement, otherT.ImageElement)) return false; - if(!comparer.ListEquals(OtherElement, otherT.OtherElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Page, otherT._Page)) return false; + if(!comparer.ListEquals(_ImageElement, otherT._ImageElement)) return false; + if(!comparer.ListEquals(_OtherElement, otherT._OtherElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "rendering": - value = RenderingElement; - return RenderingElement is not null; + value = _RenderingElement; + return _RenderingElement is not null; case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "page": - value = Page; - return Page?.Any() == true; + value = _Page; + return _Page?.Any() == true; case "image": - value = ImageElement; - return ImageElement?.Any() == true; + value = _ImageElement; + return _ImageElement?.Any() == true; case "other": - value = OtherElement; - return OtherElement?.Any() == true; + value = _OtherElement; + return _OtherElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "rendering": - RenderingElement = (Hl7.Fhir.Model.FhirUrl)value; + RenderingElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "page": - Page = (List)value; + Page = (List?)value!; return this; case "image": - ImageElement = (List)value; + ImageElement = (List?)value!; return this; case "other": - OtherElement = (List)value; + OtherElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4055,11 +3962,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RenderingElement is not null) yield return new KeyValuePair("rendering",RenderingElement); - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Page?.Any() == true) yield return new KeyValuePair("page",Page); - if (ImageElement?.Any() == true) yield return new KeyValuePair("image",ImageElement); - if (OtherElement?.Any() == true) yield return new KeyValuePair("other",OtherElement); + if (_RenderingElement is not null) yield return new KeyValuePair("rendering",_RenderingElement); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Page?.Any() == true) yield return new KeyValuePair("page",_Page); + if (_ImageElement?.Any() == true) yield return new KeyValuePair("image",_ImageElement); + if (_OtherElement?.Any() == true) yield return new KeyValuePair("other",_OtherElement); } } @@ -4088,26 +3995,26 @@ public partial class ManifestResourceComponent : Hl7.Fhir.Model.BackboneElement [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; /// /// Is this an example. /// [FhirElement("isExample", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsExampleElement + public Hl7.Fhir.Model.FhirBoolean? IsExampleElement { get { return _IsExampleElement; } set { _IsExampleElement = value; OnPropertyChanged("IsExampleElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsExampleElement; + private Hl7.Fhir.Model.FhirBoolean? _IsExampleElement; /// /// Is this an example @@ -4116,13 +4023,10 @@ public Hl7.Fhir.Model.FhirBoolean IsExampleElement [IgnoreDataMember] public bool? IsExample { - get { return IsExampleElement != null ? IsExampleElement.Value : null; } + get => _IsExampleElement?.Value; set { - if (value == null) - IsExampleElement = null; - else - IsExampleElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsExampleElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsExample"); } } @@ -4135,24 +4039,24 @@ public bool? IsExample [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// Profile(s) this is an example of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -4164,46 +4068,39 @@ public IEnumerable Profile /// [FhirElement("relativePath", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUrl RelativePathElement + public Hl7.Fhir.Model.FhirUrl? RelativePathElement { get { return _RelativePathElement; } set { _RelativePathElement = value; OnPropertyChanged("RelativePathElement"); } } - private Hl7.Fhir.Model.FhirUrl _RelativePathElement; + private Hl7.Fhir.Model.FhirUrl? _RelativePathElement; /// /// Relative path for page in IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelativePath + public string? RelativePath { - get { return RelativePathElement != null ? RelativePathElement.Value : null; } + get => _RelativePathElement?.Value; set { - if (value == null) - RelativePathElement = null; - else - RelativePathElement = new Hl7.Fhir.Model.FhirUrl(value); + RelativePathElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("RelativePath"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestResourceComponent; - - if (dest == null) - { + if(other is not ManifestResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); - if(IsExampleElement != null) dest.IsExampleElement = (Hl7.Fhir.Model.FhirBoolean)IsExampleElement.DeepCopyInternal(); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(RelativePathElement != null) dest.RelativePathElement = (Hl7.Fhir.Model.FhirUrl)RelativePathElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); + if(_IsExampleElement is not null) dest.IsExampleElement = (Hl7.Fhir.Model.FhirBoolean)_IsExampleElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_RelativePathElement is not null) dest.RelativePathElement = (Hl7.Fhir.Model.FhirUrl)_RelativePathElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4215,55 +4112,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestResourceComponent; - if(otherT == null) return false; + if(other is not ManifestResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; - if(!comparer.Equals(IsExampleElement, otherT.IsExampleElement)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(RelativePathElement, otherT.RelativePathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + if(!comparer.Equals(_IsExampleElement, otherT._IsExampleElement)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_RelativePathElement, otherT._RelativePathElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; case "isExample": - value = IsExampleElement; - return IsExampleElement is not null; + value = _IsExampleElement; + return _IsExampleElement is not null; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "relativePath": - value = RelativePathElement; - return RelativePathElement is not null; + value = _RelativePathElement; + return _RelativePathElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "isExample": - IsExampleElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsExampleElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "relativePath": - RelativePathElement = (Hl7.Fhir.Model.FhirUrl)value; + RelativePathElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -4274,10 +4171,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Reference is not null) yield return new KeyValuePair("reference",Reference); - if (IsExampleElement is not null) yield return new KeyValuePair("isExample",IsExampleElement); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (RelativePathElement is not null) yield return new KeyValuePair("relativePath",RelativePathElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); + if (_IsExampleElement is not null) yield return new KeyValuePair("isExample",_IsExampleElement); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_RelativePathElement is not null) yield return new KeyValuePair("relativePath",_RelativePathElement); } } @@ -4304,28 +4201,25 @@ public partial class ManifestPageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// HTML page name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4335,28 +4229,25 @@ public string Name /// [FhirElement("title", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Title of the page, for references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4369,24 +4260,24 @@ public string Title [DataMember] public List AnchorElement { - get { if(_AnchorElement==null) _AnchorElement = new List(); return _AnchorElement; } + get => _AnchorElement ?? new List(); set { _AnchorElement = value; OnPropertyChanged("AnchorElement"); } } - private List _AnchorElement; + private List? _AnchorElement; /// /// Anchor available on the page /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Anchor + public IEnumerable? Anchor { - get { return AnchorElement != null ? AnchorElement.Select(elem => elem.Value) : null; } + get => _AnchorElement?.Select(elem => elem.Value); set { if (value == null) - AnchorElement = null; + AnchorElement = null!; else AnchorElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Anchor"); @@ -4395,17 +4286,13 @@ public IEnumerable Anchor protected internal override void CopyToInternal(Base other) { - var dest = other as ManifestPageComponent; - - if (dest == null) - { + if(other is not ManifestPageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(AnchorElement.Any()) dest.AnchorElement = new List(AnchorElement.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_AnchorElement is not null) dest.AnchorElement = new List(_AnchorElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4417,48 +4304,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManifestPageComponent; - if(otherT == null) return false; + if(other is not ManifestPageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(AnchorElement, otherT.AnchorElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_AnchorElement, otherT._AnchorElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "anchor": - value = AnchorElement; - return AnchorElement?.Any() == true; + value = _AnchorElement; + return _AnchorElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "anchor": - AnchorElement = (List)value; + AnchorElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4469,9 +4356,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (AnchorElement?.Any() == true) yield return new KeyValuePair("anchor",AnchorElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_AnchorElement?.Any() == true) yield return new KeyValuePair("anchor",_AnchorElement); } } @@ -4482,28 +4369,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this implementation guide, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -4516,39 +4400,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the implementation guide. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -4560,13 +4441,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this implementation guide (computer friendly). @@ -4574,28 +4455,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this implementation guide (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4605,28 +4483,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this implementation guide (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -4639,13 +4514,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -4654,13 +4529,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -4670,13 +4542,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -4685,13 +4557,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -4701,28 +4570,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -4732,28 +4598,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -4766,39 +4629,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the implementation guide. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the implementation guide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -4811,11 +4671,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for implementation guide (if applicable). @@ -4826,39 +4686,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this implementation guide is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this implementation guide is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -4868,28 +4725,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -4899,28 +4753,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -4931,28 +4782,25 @@ public string CopyrightLabel [FhirElement("packageId", InSummary=true, Order=260)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id PackageIdElement + public Hl7.Fhir.Model.Id? PackageIdElement { get { return _PackageIdElement; } set { _PackageIdElement = value; OnPropertyChanged("PackageIdElement"); } } - private Hl7.Fhir.Model.Id _PackageIdElement; + private Hl7.Fhir.Model.Id? _PackageIdElement; /// /// NPM Package name for IG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PackageId + public string? PackageId { - get { return PackageIdElement != null ? PackageIdElement.Value : null; } + get => _PackageIdElement?.Value; set { - if (value == null) - PackageIdElement = null; - else - PackageIdElement = new Hl7.Fhir.Model.Id(value); + PackageIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("PackageId"); } } @@ -4964,13 +4812,13 @@ public string PackageId [DeclaredType(Type = typeof(Code))] [Binding("SPDXLicense")] [DataMember] - public Code LicenseElement + public Code? LicenseElement { get { return _LicenseElement; } set { _LicenseElement = value; OnPropertyChanged("LicenseElement"); } } - private Code _LicenseElement; + private Code? _LicenseElement; /// /// SPDX license code for this IG (or not-open-source) @@ -4979,13 +4827,10 @@ public Code LicenseElement [IgnoreDataMember] public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License { - get { return LicenseElement != null ? LicenseElement.Value : null; } + get => _LicenseElement?.Value; set { - if (value == null) - LicenseElement = null; - else - LicenseElement = new Code(value); + LicenseElement = value is null ? null : new Code(value); OnPropertyChanged("License"); } } @@ -5000,24 +4845,24 @@ public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License [DataMember] public List> FhirVersionElement { - get { if(_FhirVersionElement==null) _FhirVersionElement = new List>(); return _FhirVersionElement; } + get => _FhirVersionElement ?? new List>(); set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } - private List> _FhirVersionElement; + private List>? _FhirVersionElement; /// /// FHIR Version(s) this Implementation Guide targets /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable FhirVersion + public IEnumerable? FhirVersion { - get { return FhirVersionElement != null ? FhirVersionElement.Select(elem => elem.Value) : null; } + get => _FhirVersionElement?.Select(elem => elem.Value); set { if (value == null) - FhirVersionElement = null; + FhirVersionElement = null!; else FhirVersionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("FhirVersion"); @@ -5032,11 +4877,11 @@ public IEnumerable FhirVersion [DataMember] public List DependsOn { - get { if(_DependsOn==null) _DependsOn = new List(); return _DependsOn; } + get => _DependsOn ?? new List(); set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } - private List _DependsOn; + private List? _DependsOn; /// /// Profiles that apply globally. @@ -5046,74 +4891,70 @@ public List DependsOn [DataMember] public List Global { - get { if(_Global==null) _Global = new List(); return _Global; } + get => _Global ?? new List(); set { _Global = value; OnPropertyChanged("Global"); } } - private List _Global; + private List? _Global; /// /// Information needed to build the IG. /// [FhirElement("definition", Order=310)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent Definition + public Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent _Definition; + private Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent? _Definition; /// /// Information about an assembled IG. /// [FhirElement("manifest", Order=320)] [DataMember] - public Hl7.Fhir.Model.ImplementationGuide.ManifestComponent Manifest + public Hl7.Fhir.Model.ImplementationGuide.ManifestComponent? Manifest { get { return _Manifest; } set { _Manifest = value; OnPropertyChanged("Manifest"); } } - private Hl7.Fhir.Model.ImplementationGuide.ManifestComponent _Manifest; + private Hl7.Fhir.Model.ImplementationGuide.ManifestComponent? _Manifest; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationGuide; - - if (dest == null) - { + if(other is not ImplementationGuide dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(PackageIdElement != null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)PackageIdElement.DeepCopyInternal(); - if(LicenseElement != null) dest.LicenseElement = (Code)LicenseElement.DeepCopyInternal(); - if(FhirVersionElement.Any()) dest.FhirVersionElement = new List>(FhirVersionElement.DeepCopyInternal()); - if(DependsOn.Any()) dest.DependsOn = new List(DependsOn.DeepCopyInternal()); - if(Global.Any()) dest.Global = new List(Global.DeepCopyInternal()); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)Definition.DeepCopyInternal(); - if(Manifest != null) dest.Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)Manifest.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_PackageIdElement is not null) dest.PackageIdElement = (Hl7.Fhir.Model.Id)_PackageIdElement.DeepCopyInternal(); + if(_LicenseElement is not null) dest.LicenseElement = (Code)_LicenseElement.DeepCopyInternal(); + if(_FhirVersionElement is not null) dest.FhirVersionElement = new List>(_FhirVersionElement.DeepCopyInternal()); + if(_DependsOn is not null) dest.DependsOn = new List(_DependsOn.DeepCopyInternal()); + if(_Global is not null) dest.Global = new List(_Global.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)_Definition.DeepCopyInternal(); + if(_Manifest is not null) dest.Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)_Manifest.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5125,195 +4966,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationGuide; - if(otherT == null) return false; + if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(PackageIdElement, otherT.PackageIdElement)) return false; - if(!comparer.Equals(LicenseElement, otherT.LicenseElement)) return false; - if(!comparer.ListEquals(FhirVersionElement, otherT.FhirVersionElement)) return false; - if(!comparer.ListEquals(DependsOn, otherT.DependsOn)) return false; - if(!comparer.ListEquals(Global, otherT.Global)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(Manifest, otherT.Manifest)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; + if(!comparer.Equals(_LicenseElement, otherT._LicenseElement)) return false; + if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; + if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; + if(!comparer.ListEquals(_Global, otherT._Global)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_Manifest, otherT._Manifest)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "packageId": - value = PackageIdElement; - return PackageIdElement is not null; + value = _PackageIdElement; + return _PackageIdElement is not null; case "license": - value = LicenseElement; - return LicenseElement is not null; + value = _LicenseElement; + return _LicenseElement is not null; case "fhirVersion": - value = FhirVersionElement; - return FhirVersionElement?.Any() == true; + value = _FhirVersionElement; + return _FhirVersionElement?.Any() == true; case "dependsOn": - value = DependsOn; - return DependsOn?.Any() == true; + value = _DependsOn; + return _DependsOn?.Any() == true; case "global": - value = Global; - return Global?.Any() == true; + value = _Global; + return _Global?.Any() == true; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "manifest": - value = Manifest; - return Manifest is not null; + value = _Manifest; + return _Manifest is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "packageId": - PackageIdElement = (Hl7.Fhir.Model.Id)value; + PackageIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "license": - LicenseElement = (Code)value; + LicenseElement = (Code?)value; return this; case "fhirVersion": - FhirVersionElement = (List>)value; + FhirVersionElement = (List>?)value!; return this; case "dependsOn": - DependsOn = (List)value; + DependsOn = (List?)value!; return this; case "global": - Global = (List)value; + Global = (List?)value!; return this; case "definition": - Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent)value; + Definition = (Hl7.Fhir.Model.ImplementationGuide.DefinitionComponent?)value; return this; case "manifest": - Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent)value; + Manifest = (Hl7.Fhir.Model.ImplementationGuide.ManifestComponent?)value; return this; default: return base.SetValue(key, value); @@ -5324,30 +5165,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (PackageIdElement is not null) yield return new KeyValuePair("packageId",PackageIdElement); - if (LicenseElement is not null) yield return new KeyValuePair("license",LicenseElement); - if (FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",FhirVersionElement); - if (DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",DependsOn); - if (Global?.Any() == true) yield return new KeyValuePair("global",Global); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (Manifest is not null) yield return new KeyValuePair("manifest",Manifest); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_PackageIdElement is not null) yield return new KeyValuePair("packageId",_PackageIdElement); + if (_LicenseElement is not null) yield return new KeyValuePair("license",_LicenseElement); + if (_FhirVersionElement?.Any() == true) yield return new KeyValuePair("fhirVersion",_FhirVersionElement); + if (_DependsOn?.Any() == true) yield return new KeyValuePair("dependsOn",_DependsOn); + if (_Global?.Any() == true) yield return new KeyValuePair("global",_Global); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_Manifest is not null) yield return new KeyValuePair("manifest",_Manifest); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs b/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs index 49bfe775e..42694ff11 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Ingredient","http://hl7.org/fhir/StructureDefinition/Ingredient")] - public partial class Ingredient : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class Ingredient : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -107,13 +110,13 @@ public partial class ManufacturerComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("IngredientManufacturerRole")] [DataMember] - public Code RoleElement + public Code? RoleElement { get { return _RoleElement; } set { _RoleElement = value; OnPropertyChanged("RoleElement"); } } - private Code _RoleElement; + private Code? _RoleElement; /// /// allowed | possible | actual @@ -122,13 +125,10 @@ public Code RoleElement [IgnoreDataMember] public Hl7.Fhir.Model.Ingredient.IngredientManufacturerRole? Role { - get { return RoleElement != null ? RoleElement.Value : null; } + get => _RoleElement?.Value; set { - if (value == null) - RoleElement = null; - else - RoleElement = new Code(value); + RoleElement = value is null ? null : new Code(value); OnPropertyChanged("Role"); } } @@ -141,26 +141,22 @@ public Hl7.Fhir.Model.Ingredient.IngredientManufacturerRole? Role [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manufacturer + public Hl7.Fhir.Model.ResourceReference? Manufacturer { get { return _Manufacturer; } set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private Hl7.Fhir.Model.ResourceReference _Manufacturer; + private Hl7.Fhir.Model.ResourceReference? _Manufacturer; protected internal override void CopyToInternal(Base other) { - var dest = other as ManufacturerComponent; - - if (dest == null) - { + if(other is not ManufacturerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RoleElement != null) dest.RoleElement = (Code)RoleElement.DeepCopyInternal(); - if(Manufacturer != null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)Manufacturer.DeepCopyInternal(); + if(_RoleElement is not null) dest.RoleElement = (Code)_RoleElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = (Hl7.Fhir.Model.ResourceReference)_Manufacturer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -172,41 +168,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManufacturerComponent; - if(otherT == null) return false; + if(other is not ManufacturerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RoleElement, otherT.RoleElement)) return false; - if(!comparer.Equals(Manufacturer, otherT.Manufacturer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = RoleElement; - return RoleElement is not null; + value = _RoleElement; + return _RoleElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer is not null; + value = _Manufacturer; + return _Manufacturer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - RoleElement = (Code)value; + RoleElement = (Code?)value; return this; case "manufacturer": - Manufacturer = (Hl7.Fhir.Model.ResourceReference)value; + Manufacturer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -217,8 +213,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RoleElement is not null) yield return new KeyValuePair("role",RoleElement); - if (Manufacturer is not null) yield return new KeyValuePair("manufacturer",Manufacturer); + if (_RoleElement is not null) yield return new KeyValuePair("role",_RoleElement); + if (_Manufacturer is not null) yield return new KeyValuePair("manufacturer",_Manufacturer); } } @@ -243,13 +239,13 @@ public partial class SubstanceComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTSubstanceCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Code + public Hl7.Fhir.Model.CodeableReference? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableReference _Code; + private Hl7.Fhir.Model.CodeableReference? _Code; /// /// The quantity of substance, per presentation, or per volume or mass, and type of quantity. @@ -259,24 +255,20 @@ public Hl7.Fhir.Model.CodeableReference Code [DataMember] public List Strength { - get { if(_Strength==null) _Strength = new List(); return _Strength; } + get => _Strength ?? new List(); set { _Strength = value; OnPropertyChanged("Strength"); } } - private List _Strength; + private List? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceComponent; - - if (dest == null) - { + if(other is not SubstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableReference)Code.DeepCopyInternal(); - if(Strength.Any()) dest.Strength = new List(Strength.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableReference)_Code.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = new List(_Strength.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -288,41 +280,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceComponent; - if(otherT == null) return false; + if(other is not SubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "strength": - value = Strength; - return Strength?.Any() == true; + value = _Strength; + return _Strength?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableReference)value; + Code = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "strength": - Strength = (List)value; + Strength = (List?)value!; return this; default: return base.SetValue(key, value); @@ -333,8 +325,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Strength?.Any() == true) yield return new KeyValuePair("strength",Strength); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Strength?.Any() == true) yield return new KeyValuePair("strength",_Strength); } } @@ -362,41 +354,38 @@ public partial class StrengthComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Presentation + public Hl7.Fhir.Model.DataType? Presentation { get { return _Presentation; } set { _Presentation = value; OnPropertyChanged("Presentation"); } } - private Hl7.Fhir.Model.DataType _Presentation; + private Hl7.Fhir.Model.DataType? _Presentation; /// /// Text of either the whole presentation strength or a part of it (rest being in Strength.presentation as a ratio). /// [FhirElement("textPresentation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextPresentationElement + public Hl7.Fhir.Model.FhirString? TextPresentationElement { get { return _TextPresentationElement; } set { _TextPresentationElement = value; OnPropertyChanged("TextPresentationElement"); } } - private Hl7.Fhir.Model.FhirString _TextPresentationElement; + private Hl7.Fhir.Model.FhirString? _TextPresentationElement; /// /// Text of either the whole presentation strength or a part of it (rest being in Strength.presentation as a ratio) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextPresentation + public string? TextPresentation { - get { return TextPresentationElement != null ? TextPresentationElement.Value : null; } + get => _TextPresentationElement?.Value; set { - if (value == null) - TextPresentationElement = null; - else - TextPresentationElement = new Hl7.Fhir.Model.FhirString(value); + TextPresentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextPresentation"); } } @@ -408,41 +397,38 @@ public string TextPresentation [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Concentration + public Hl7.Fhir.Model.DataType? Concentration { get { return _Concentration; } set { _Concentration = value; OnPropertyChanged("Concentration"); } } - private Hl7.Fhir.Model.DataType _Concentration; + private Hl7.Fhir.Model.DataType? _Concentration; /// /// Text of either the whole concentration strength or a part of it (rest being in Strength.concentration as a ratio). /// [FhirElement("textConcentration", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TextConcentrationElement + public Hl7.Fhir.Model.FhirString? TextConcentrationElement { get { return _TextConcentrationElement; } set { _TextConcentrationElement = value; OnPropertyChanged("TextConcentrationElement"); } } - private Hl7.Fhir.Model.FhirString _TextConcentrationElement; + private Hl7.Fhir.Model.FhirString? _TextConcentrationElement; /// /// Text of either the whole concentration strength or a part of it (rest being in Strength.concentration as a ratio) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextConcentration + public string? TextConcentration { - get { return TextConcentrationElement != null ? TextConcentrationElement.Value : null; } + get => _TextConcentrationElement?.Value; set { - if (value == null) - TextConcentrationElement = null; - else - TextConcentrationElement = new Hl7.Fhir.Model.FhirString(value); + TextConcentrationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TextConcentration"); } } @@ -452,41 +438,38 @@ public string TextConcentration /// [FhirElement("basis", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Basis + public Hl7.Fhir.Model.CodeableConcept? Basis { get { return _Basis; } set { _Basis = value; OnPropertyChanged("Basis"); } } - private Hl7.Fhir.Model.CodeableConcept _Basis; + private Hl7.Fhir.Model.CodeableConcept? _Basis; /// /// When strength is measured at a particular point or distance. /// [FhirElement("measurementPoint", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString MeasurementPointElement + public Hl7.Fhir.Model.FhirString? MeasurementPointElement { get { return _MeasurementPointElement; } set { _MeasurementPointElement = value; OnPropertyChanged("MeasurementPointElement"); } } - private Hl7.Fhir.Model.FhirString _MeasurementPointElement; + private Hl7.Fhir.Model.FhirString? _MeasurementPointElement; /// /// When strength is measured at a particular point or distance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeasurementPoint + public string? MeasurementPoint { - get { return MeasurementPointElement != null ? MeasurementPointElement.Value : null; } + get => _MeasurementPointElement?.Value; set { - if (value == null) - MeasurementPointElement = null; - else - MeasurementPointElement = new Hl7.Fhir.Model.FhirString(value); + MeasurementPointElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MeasurementPoint"); } } @@ -500,11 +483,11 @@ public string MeasurementPoint [DataMember] public List Country { - get { if(_Country==null) _Country = new List(); return _Country; } + get => _Country ?? new List(); set { _Country = value; OnPropertyChanged("Country"); } } - private List _Country; + private List? _Country; /// /// Strength expressed in terms of a reference substance. @@ -514,30 +497,26 @@ public List Country [DataMember] public List ReferenceStrength { - get { if(_ReferenceStrength==null) _ReferenceStrength = new List(); return _ReferenceStrength; } + get => _ReferenceStrength ?? new List(); set { _ReferenceStrength = value; OnPropertyChanged("ReferenceStrength"); } } - private List _ReferenceStrength; + private List? _ReferenceStrength; protected internal override void CopyToInternal(Base other) { - var dest = other as StrengthComponent; - - if (dest == null) - { + if(other is not StrengthComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Presentation != null) dest.Presentation = (Hl7.Fhir.Model.DataType)Presentation.DeepCopyInternal(); - if(TextPresentationElement != null) dest.TextPresentationElement = (Hl7.Fhir.Model.FhirString)TextPresentationElement.DeepCopyInternal(); - if(Concentration != null) dest.Concentration = (Hl7.Fhir.Model.DataType)Concentration.DeepCopyInternal(); - if(TextConcentrationElement != null) dest.TextConcentrationElement = (Hl7.Fhir.Model.FhirString)TextConcentrationElement.DeepCopyInternal(); - if(Basis != null) dest.Basis = (Hl7.Fhir.Model.CodeableConcept)Basis.DeepCopyInternal(); - if(MeasurementPointElement != null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)MeasurementPointElement.DeepCopyInternal(); - if(Country.Any()) dest.Country = new List(Country.DeepCopyInternal()); - if(ReferenceStrength.Any()) dest.ReferenceStrength = new List(ReferenceStrength.DeepCopyInternal()); + if(_Presentation is not null) dest.Presentation = (Hl7.Fhir.Model.DataType)_Presentation.DeepCopyInternal(); + if(_TextPresentationElement is not null) dest.TextPresentationElement = (Hl7.Fhir.Model.FhirString)_TextPresentationElement.DeepCopyInternal(); + if(_Concentration is not null) dest.Concentration = (Hl7.Fhir.Model.DataType)_Concentration.DeepCopyInternal(); + if(_TextConcentrationElement is not null) dest.TextConcentrationElement = (Hl7.Fhir.Model.FhirString)_TextConcentrationElement.DeepCopyInternal(); + if(_Basis is not null) dest.Basis = (Hl7.Fhir.Model.CodeableConcept)_Basis.DeepCopyInternal(); + if(_MeasurementPointElement is not null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)_MeasurementPointElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = new List(_Country.DeepCopyInternal()); + if(_ReferenceStrength is not null) dest.ReferenceStrength = new List(_ReferenceStrength.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -549,83 +528,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StrengthComponent; - if(otherT == null) return false; + if(other is not StrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Presentation, otherT.Presentation)) return false; - if(!comparer.Equals(TextPresentationElement, otherT.TextPresentationElement)) return false; - if(!comparer.Equals(Concentration, otherT.Concentration)) return false; - if(!comparer.Equals(TextConcentrationElement, otherT.TextConcentrationElement)) return false; - if(!comparer.Equals(Basis, otherT.Basis)) return false; - if(!comparer.Equals(MeasurementPointElement, otherT.MeasurementPointElement)) return false; - if(!comparer.ListEquals(Country, otherT.Country)) return false; - if(!comparer.ListEquals(ReferenceStrength, otherT.ReferenceStrength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; + if(!comparer.Equals(_TextPresentationElement, otherT._TextPresentationElement)) return false; + if(!comparer.Equals(_Concentration, otherT._Concentration)) return false; + if(!comparer.Equals(_TextConcentrationElement, otherT._TextConcentrationElement)) return false; + if(!comparer.Equals(_Basis, otherT._Basis)) return false; + if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; + if(!comparer.ListEquals(_Country, otherT._Country)) return false; + if(!comparer.ListEquals(_ReferenceStrength, otherT._ReferenceStrength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "presentation": - value = Presentation; - return Presentation is not null; + value = _Presentation; + return _Presentation is not null; case "textPresentation": - value = TextPresentationElement; - return TextPresentationElement is not null; + value = _TextPresentationElement; + return _TextPresentationElement is not null; case "concentration": - value = Concentration; - return Concentration is not null; + value = _Concentration; + return _Concentration is not null; case "textConcentration": - value = TextConcentrationElement; - return TextConcentrationElement is not null; + value = _TextConcentrationElement; + return _TextConcentrationElement is not null; case "basis": - value = Basis; - return Basis is not null; + value = _Basis; + return _Basis is not null; case "measurementPoint": - value = MeasurementPointElement; - return MeasurementPointElement is not null; + value = _MeasurementPointElement; + return _MeasurementPointElement is not null; case "country": - value = Country; - return Country?.Any() == true; + value = _Country; + return _Country?.Any() == true; case "referenceStrength": - value = ReferenceStrength; - return ReferenceStrength?.Any() == true; + value = _ReferenceStrength; + return _ReferenceStrength?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "presentation": - Presentation = (Hl7.Fhir.Model.DataType)value; + Presentation = (Hl7.Fhir.Model.DataType?)value; return this; case "textPresentation": - TextPresentationElement = (Hl7.Fhir.Model.FhirString)value; + TextPresentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "concentration": - Concentration = (Hl7.Fhir.Model.DataType)value; + Concentration = (Hl7.Fhir.Model.DataType?)value; return this; case "textConcentration": - TextConcentrationElement = (Hl7.Fhir.Model.FhirString)value; + TextConcentrationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "basis": - Basis = (Hl7.Fhir.Model.CodeableConcept)value; + Basis = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "measurementPoint": - MeasurementPointElement = (Hl7.Fhir.Model.FhirString)value; + MeasurementPointElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - Country = (List)value; + Country = (List?)value!; return this; case "referenceStrength": - ReferenceStrength = (List)value; + ReferenceStrength = (List?)value!; return this; default: return base.SetValue(key, value); @@ -636,14 +615,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Presentation is not null) yield return new KeyValuePair("presentation",Presentation); - if (TextPresentationElement is not null) yield return new KeyValuePair("textPresentation",TextPresentationElement); - if (Concentration is not null) yield return new KeyValuePair("concentration",Concentration); - if (TextConcentrationElement is not null) yield return new KeyValuePair("textConcentration",TextConcentrationElement); - if (Basis is not null) yield return new KeyValuePair("basis",Basis); - if (MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",MeasurementPointElement); - if (Country?.Any() == true) yield return new KeyValuePair("country",Country); - if (ReferenceStrength?.Any() == true) yield return new KeyValuePair("referenceStrength",ReferenceStrength); + if (_Presentation is not null) yield return new KeyValuePair("presentation",_Presentation); + if (_TextPresentationElement is not null) yield return new KeyValuePair("textPresentation",_TextPresentationElement); + if (_Concentration is not null) yield return new KeyValuePair("concentration",_Concentration); + if (_TextConcentrationElement is not null) yield return new KeyValuePair("textConcentration",_TextConcentrationElement); + if (_Basis is not null) yield return new KeyValuePair("basis",_Basis); + if (_MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",_MeasurementPointElement); + if (_Country?.Any() == true) yield return new KeyValuePair("country",_Country); + if (_ReferenceStrength?.Any() == true) yield return new KeyValuePair("referenceStrength",_ReferenceStrength); } } @@ -671,13 +650,13 @@ public partial class ReferenceStrengthComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTSubstanceCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Substance + public Hl7.Fhir.Model.CodeableReference? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.CodeableReference _Substance; + private Hl7.Fhir.Model.CodeableReference? _Substance; /// /// Strength expressed in terms of a reference substance. @@ -687,41 +666,38 @@ public Hl7.Fhir.Model.CodeableReference Substance [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange),typeof(Hl7.Fhir.Model.Quantity))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Strength + public Hl7.Fhir.Model.DataType? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.DataType _Strength; + private Hl7.Fhir.Model.DataType? _Strength; /// /// When strength is measured at a particular point or distance. /// [FhirElement("measurementPoint", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MeasurementPointElement + public Hl7.Fhir.Model.FhirString? MeasurementPointElement { get { return _MeasurementPointElement; } set { _MeasurementPointElement = value; OnPropertyChanged("MeasurementPointElement"); } } - private Hl7.Fhir.Model.FhirString _MeasurementPointElement; + private Hl7.Fhir.Model.FhirString? _MeasurementPointElement; /// /// When strength is measured at a particular point or distance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MeasurementPoint + public string? MeasurementPoint { - get { return MeasurementPointElement != null ? MeasurementPointElement.Value : null; } + get => _MeasurementPointElement?.Value; set { - if (value == null) - MeasurementPointElement = null; - else - MeasurementPointElement = new Hl7.Fhir.Model.FhirString(value); + MeasurementPointElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MeasurementPoint"); } } @@ -735,26 +711,22 @@ public string MeasurementPoint [DataMember] public List Country { - get { if(_Country==null) _Country = new List(); return _Country; } + get => _Country ?? new List(); set { _Country = value; OnPropertyChanged("Country"); } } - private List _Country; + private List? _Country; protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceStrengthComponent; - - if (dest == null) - { + if(other is not ReferenceStrengthComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.CodeableReference)Substance.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.DataType)Strength.DeepCopyInternal(); - if(MeasurementPointElement != null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)MeasurementPointElement.DeepCopyInternal(); - if(Country.Any()) dest.Country = new List(Country.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.CodeableReference)_Substance.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.DataType)_Strength.DeepCopyInternal(); + if(_MeasurementPointElement is not null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)_MeasurementPointElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = new List(_Country.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -766,55 +738,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceStrengthComponent; - if(otherT == null) return false; + if(other is not ReferenceStrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; - if(!comparer.Equals(MeasurementPointElement, otherT.MeasurementPointElement)) return false; - if(!comparer.ListEquals(Country, otherT.Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; + if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; + if(!comparer.ListEquals(_Country, otherT._Country)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; case "measurementPoint": - value = MeasurementPointElement; - return MeasurementPointElement is not null; + value = _MeasurementPointElement; + return _MeasurementPointElement is not null; case "country": - value = Country; - return Country?.Any() == true; + value = _Country; + return _Country?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substance": - Substance = (Hl7.Fhir.Model.CodeableReference)value; + Substance = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.DataType)value; + Strength = (Hl7.Fhir.Model.DataType?)value; return this; case "measurementPoint": - MeasurementPointElement = (Hl7.Fhir.Model.FhirString)value; + MeasurementPointElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "country": - Country = (List)value; + Country = (List?)value!; return this; default: return base.SetValue(key, value); @@ -825,10 +797,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Substance is not null) yield return new KeyValuePair("substance",Substance); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); - if (MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",MeasurementPointElement); - if (Country?.Any() == true) yield return new KeyValuePair("country",Country); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); + if (_MeasurementPointElement is not null) yield return new KeyValuePair("measurementPoint",_MeasurementPointElement); + if (_Country?.Any() == true) yield return new KeyValuePair("country",_Country); } } @@ -838,13 +810,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// draft | active | retired | unknown. @@ -854,13 +826,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -869,13 +841,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -890,11 +859,11 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List For { - get { if(_For==null) _For = new List(); return _For; } + get => _For ?? new List(); set { _For = value; OnPropertyChanged("For"); } } - private List _For; + private List? _For; /// /// Purpose of the ingredient within the product, e.g. active, inactive. @@ -903,13 +872,13 @@ public List For [Binding("IngredientRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Precise action within the drug product, e.g. antioxidant, alkalizing agent. @@ -920,37 +889,37 @@ public Hl7.Fhir.Model.CodeableConcept Role [DataMember] public List Function { - get { if(_Function==null) _Function = new List(); return _Function; } + get => _Function ?? new List(); set { _Function = value; OnPropertyChanged("Function"); } } - private List _Function; + private List? _Function; /// /// A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink. /// [FhirElement("group", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Group + public Hl7.Fhir.Model.CodeableConcept? Group { get { return _Group; } set { _Group = value; OnPropertyChanged("Group"); } } - private Hl7.Fhir.Model.CodeableConcept _Group; + private Hl7.Fhir.Model.CodeableConcept? _Group; /// /// If the ingredient is a known or suspected allergen. /// [FhirElement("allergenicIndicator", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? AllergenicIndicatorElement { get { return _AllergenicIndicatorElement; } set { _AllergenicIndicatorElement = value; OnPropertyChanged("AllergenicIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllergenicIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _AllergenicIndicatorElement; /// /// If the ingredient is a known or suspected allergen @@ -959,13 +928,10 @@ public Hl7.Fhir.Model.FhirBoolean AllergenicIndicatorElement [IgnoreDataMember] public bool? AllergenicIndicator { - get { return AllergenicIndicatorElement != null ? AllergenicIndicatorElement.Value : null; } + get => _AllergenicIndicatorElement?.Value; set { - if (value == null) - AllergenicIndicatorElement = null; - else - AllergenicIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllergenicIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AllergenicIndicator"); } } @@ -975,28 +941,25 @@ public bool? AllergenicIndicator /// [FhirElement("comment", Order=160)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// A place for providing any notes that are relevant to the component, e.g. removed during process, adjusted for loss on drying /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -1009,11 +972,11 @@ public string Comment [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// The substance that comprises this ingredient. @@ -1021,36 +984,32 @@ public List Manufacturer [FhirElement("substance", InSummary=true, Order=180)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Ingredient.SubstanceComponent Substance + public Hl7.Fhir.Model.Ingredient.SubstanceComponent? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.Ingredient.SubstanceComponent _Substance; + private Hl7.Fhir.Model.Ingredient.SubstanceComponent? _Substance; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Ingredient; - - if (dest == null) - { + if(other is not Ingredient dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(For.Any()) dest.For = new List(For.DeepCopyInternal()); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Function.Any()) dest.Function = new List(Function.DeepCopyInternal()); - if(Group != null) dest.Group = (Hl7.Fhir.Model.CodeableConcept)Group.DeepCopyInternal(); - if(AllergenicIndicatorElement != null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)AllergenicIndicatorElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent)Substance.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_For is not null) dest.For = new List(_For.DeepCopyInternal()); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Function is not null) dest.Function = new List(_Function.DeepCopyInternal()); + if(_Group is not null) dest.Group = (Hl7.Fhir.Model.CodeableConcept)_Group.DeepCopyInternal(); + if(_AllergenicIndicatorElement is not null) dest.AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_AllergenicIndicatorElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent)_Substance.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1062,97 +1021,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Ingredient; - if(otherT == null) return false; + if(other is not Ingredient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(For, otherT.For)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.ListEquals(Function, otherT.Function)) return false; - if(!comparer.Equals(Group, otherT.Group)) return false; - if(!comparer.Equals(AllergenicIndicatorElement, otherT.AllergenicIndicatorElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_For, otherT._For)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.ListEquals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Group, otherT._Group)) return false; + if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.Equals(_Substance, otherT._Substance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "for": - value = For; - return For?.Any() == true; + value = _For; + return _For?.Any() == true; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "function": - value = Function; - return Function?.Any() == true; + value = _Function; + return _Function?.Any() == true; case "group": - value = Group; - return Group is not null; + value = _Group; + return _Group is not null; case "allergenicIndicator": - value = AllergenicIndicatorElement; - return AllergenicIndicatorElement is not null; + value = _AllergenicIndicatorElement; + return _AllergenicIndicatorElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "for": - For = (List)value; + For = (List?)value!; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "function": - Function = (List)value; + Function = (List?)value!; return this; case "group": - Group = (Hl7.Fhir.Model.CodeableConcept)value; + Group = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allergenicIndicator": - AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllergenicIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "substance": - Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent)value; + Substance = (Hl7.Fhir.Model.Ingredient.SubstanceComponent?)value; return this; default: return base.SetValue(key, value); @@ -1163,16 +1122,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (For?.Any() == true) yield return new KeyValuePair("for",For); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Function?.Any() == true) yield return new KeyValuePair("function",Function); - if (Group is not null) yield return new KeyValuePair("group",Group); - if (AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",AllergenicIndicatorElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Substance is not null) yield return new KeyValuePair("substance",Substance); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_For?.Any() == true) yield return new KeyValuePair("for",_For); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Function?.Any() == true) yield return new KeyValuePair("function",_Function); + if (_Group is not null) yield return new KeyValuePair("group",_Group); + if (_AllergenicIndicatorElement is not null) yield return new KeyValuePair("allergenicIndicator",_AllergenicIndicatorElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs index 605844ed6..662002761 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -106,13 +109,13 @@ public partial class CoverageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// What networks provide coverage. @@ -124,11 +127,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// List of benefits. @@ -138,25 +141,21 @@ public List Network [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageComponent; - - if (dest == null) - { + if(other is not CoverageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -168,48 +167,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageComponent; - if(otherT == null) return false; + if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -220,9 +219,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); } } @@ -249,41 +248,38 @@ public partial class CoverageBenefitComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Referral requirements. /// [FhirElement("requirement", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RequirementElement + public Hl7.Fhir.Model.FhirString? RequirementElement { get { return _RequirementElement; } set { _RequirementElement = value; OnPropertyChanged("RequirementElement"); } } - private Hl7.Fhir.Model.FhirString _RequirementElement; + private Hl7.Fhir.Model.FhirString? _RequirementElement; /// /// Referral requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirement + public string? Requirement { - get { return RequirementElement != null ? RequirementElement.Value : null; } + get => _RequirementElement?.Value; set { - if (value == null) - RequirementElement = null; - else - RequirementElement = new Hl7.Fhir.Model.FhirString(value); + RequirementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Requirement"); } } @@ -296,25 +292,21 @@ public string Requirement [DataMember] public List Limit { - get { if(_Limit==null) _Limit = new List(); return _Limit; } + get => _Limit ?? new List(); set { _Limit = value; OnPropertyChanged("Limit"); } } - private List _Limit; + private List? _Limit; protected internal override void CopyToInternal(Base other) { - var dest = other as CoverageBenefitComponent; - - if (dest == null) - { + if(other is not CoverageBenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RequirementElement != null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)RequirementElement.DeepCopyInternal(); - if(Limit.Any()) dest.Limit = new List(Limit.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RequirementElement is not null) dest.RequirementElement = (Hl7.Fhir.Model.FhirString)_RequirementElement.DeepCopyInternal(); + if(_Limit is not null) dest.Limit = new List(_Limit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -326,48 +318,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CoverageBenefitComponent; - if(otherT == null) return false; + if(other is not CoverageBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RequirementElement, otherT.RequirementElement)) return false; - if(!comparer.ListEquals(Limit, otherT.Limit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; + if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "requirement": - value = RequirementElement; - return RequirementElement is not null; + value = _RequirementElement; + return _RequirementElement is not null; case "limit": - value = Limit; - return Limit?.Any() == true; + value = _Limit; + return _Limit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "requirement": - RequirementElement = (Hl7.Fhir.Model.FhirString)value; + RequirementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "limit": - Limit = (List)value; + Limit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -378,9 +370,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RequirementElement is not null) yield return new KeyValuePair("requirement",RequirementElement); - if (Limit?.Any() == true) yield return new KeyValuePair("limit",Limit); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RequirementElement is not null) yield return new KeyValuePair("requirement",_RequirementElement); + if (_Limit?.Any() == true) yield return new KeyValuePair("limit",_Limit); } } @@ -406,39 +398,35 @@ public partial class LimitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("value", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; /// /// Benefit limit details. /// [FhirElement("code", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as LimitComponent; - - if (dest == null) - { + if(other is not LimitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -450,41 +438,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LimitComponent; - if(otherT == null) return false; + if(other is not LimitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -495,8 +483,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } @@ -525,24 +513,24 @@ public partial class PlanComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Type of plan. /// [FhirElement("type", Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where product applies. @@ -554,11 +542,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// What networks provide coverage. @@ -570,11 +558,11 @@ public List CoverageArea [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Overall costs. @@ -584,11 +572,11 @@ public List Network [DataMember] public List GeneralCost { - get { if(_GeneralCost==null) _GeneralCost = new List(); return _GeneralCost; } + get => _GeneralCost ?? new List(); set { _GeneralCost = value; OnPropertyChanged("GeneralCost"); } } - private List _GeneralCost; + private List? _GeneralCost; /// /// Specific costs. @@ -598,28 +586,24 @@ public List GeneralCost [DataMember] public List SpecificCost { - get { if(_SpecificCost==null) _SpecificCost = new List(); return _SpecificCost; } + get => _SpecificCost ?? new List(); set { _SpecificCost = value; OnPropertyChanged("SpecificCost"); } } - private List _SpecificCost; + private List? _SpecificCost; protected internal override void CopyToInternal(Base other) { - var dest = other as PlanComponent; - - if (dest == null) - { + if(other is not PlanComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(GeneralCost.Any()) dest.GeneralCost = new List(GeneralCost.DeepCopyInternal()); - if(SpecificCost.Any()) dest.SpecificCost = new List(SpecificCost.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_GeneralCost is not null) dest.GeneralCost = new List(_GeneralCost.DeepCopyInternal()); + if(_SpecificCost is not null) dest.SpecificCost = new List(_SpecificCost.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -631,69 +615,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanComponent; - if(otherT == null) return false; + if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(GeneralCost, otherT.GeneralCost)) return false; - if(!comparer.ListEquals(SpecificCost, otherT.SpecificCost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_GeneralCost, otherT._GeneralCost)) return false; + if(!comparer.ListEquals(_SpecificCost, otherT._SpecificCost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "generalCost": - value = GeneralCost; - return GeneralCost?.Any() == true; + value = _GeneralCost; + return _GeneralCost?.Any() == true; case "specificCost": - value = SpecificCost; - return SpecificCost?.Any() == true; + value = _SpecificCost; + return _SpecificCost?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "generalCost": - GeneralCost = (List)value; + GeneralCost = (List?)value!; return this; case "specificCost": - SpecificCost = (List)value; + SpecificCost = (List?)value!; return this; default: return base.SetValue(key, value); @@ -704,12 +688,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (GeneralCost?.Any() == true) yield return new KeyValuePair("generalCost",GeneralCost); - if (SpecificCost?.Any() == true) yield return new KeyValuePair("specificCost",SpecificCost); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_GeneralCost?.Any() == true) yield return new KeyValuePair("generalCost",_GeneralCost); + if (_SpecificCost?.Any() == true) yield return new KeyValuePair("specificCost",_SpecificCost); } } @@ -735,26 +719,26 @@ public partial class GeneralCostComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Number of enrollees. /// [FhirElement("groupSize", Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt GroupSizeElement + public Hl7.Fhir.Model.PositiveInt? GroupSizeElement { get { return _GroupSizeElement; } set { _GroupSizeElement = value; OnPropertyChanged("GroupSizeElement"); } } - private Hl7.Fhir.Model.PositiveInt _GroupSizeElement; + private Hl7.Fhir.Model.PositiveInt? _GroupSizeElement; /// /// Number of enrollees @@ -763,13 +747,10 @@ public Hl7.Fhir.Model.PositiveInt GroupSizeElement [IgnoreDataMember] public int? GroupSize { - get { return GroupSizeElement != null ? GroupSizeElement.Value : null; } + get => _GroupSizeElement?.Value; set { - if (value == null) - GroupSizeElement = null; - else - GroupSizeElement = new Hl7.Fhir.Model.PositiveInt(value); + GroupSizeElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("GroupSize"); } } @@ -779,59 +760,52 @@ public int? GroupSize /// [FhirElement("cost", Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Cost + public Hl7.Fhir.Model.Money? Cost { get { return _Cost; } set { _Cost = value; OnPropertyChanged("Cost"); } } - private Hl7.Fhir.Model.Money _Cost; + private Hl7.Fhir.Model.Money? _Cost; /// /// Additional cost information. /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Additional cost information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as GeneralCostComponent; - - if (dest == null) - { + if(other is not GeneralCostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupSizeElement != null) dest.GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)GroupSizeElement.DeepCopyInternal(); - if(Cost != null) dest.Cost = (Hl7.Fhir.Model.Money)Cost.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupSizeElement is not null) dest.GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)_GroupSizeElement.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = (Hl7.Fhir.Model.Money)_Cost.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -843,55 +817,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GeneralCostComponent; - if(otherT == null) return false; + if(other is not GeneralCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupSizeElement, otherT.GroupSizeElement)) return false; - if(!comparer.Equals(Cost, otherT.Cost)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupSizeElement, otherT._GroupSizeElement)) return false; + if(!comparer.Equals(_Cost, otherT._Cost)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupSize": - value = GroupSizeElement; - return GroupSizeElement is not null; + value = _GroupSizeElement; + return _GroupSizeElement is not null; case "cost": - value = Cost; - return Cost is not null; + value = _Cost; + return _Cost is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupSize": - GroupSizeElement = (Hl7.Fhir.Model.PositiveInt)value; + GroupSizeElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "cost": - Cost = (Hl7.Fhir.Model.Money)value; + Cost = (Hl7.Fhir.Model.Money?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -902,10 +876,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupSizeElement is not null) yield return new KeyValuePair("groupSize",GroupSizeElement); - if (Cost is not null) yield return new KeyValuePair("cost",Cost); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupSizeElement is not null) yield return new KeyValuePair("groupSize",_GroupSizeElement); + if (_Cost is not null) yield return new KeyValuePair("cost",_Cost); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -932,13 +906,13 @@ public partial class SpecificCostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Benefits list. @@ -948,24 +922,20 @@ public Hl7.Fhir.Model.CodeableConcept Category [DataMember] public List Benefit { - get { if(_Benefit==null) _Benefit = new List(); return _Benefit; } + get => _Benefit ?? new List(); set { _Benefit = value; OnPropertyChanged("Benefit"); } } - private List _Benefit; + private List? _Benefit; protected internal override void CopyToInternal(Base other) { - var dest = other as SpecificCostComponent; - - if (dest == null) - { + if(other is not SpecificCostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Benefit.Any()) dest.Benefit = new List(Benefit.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Benefit is not null) dest.Benefit = new List(_Benefit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -977,41 +947,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecificCostComponent; - if(otherT == null) return false; + if(other is not SpecificCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Benefit, otherT.Benefit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "benefit": - value = Benefit; - return Benefit?.Any() == true; + value = _Benefit; + return _Benefit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "benefit": - Benefit = (List)value; + Benefit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1022,8 +992,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Benefit?.Any() == true) yield return new KeyValuePair("benefit",Benefit); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Benefit?.Any() == true) yield return new KeyValuePair("benefit",_Benefit); } } @@ -1050,13 +1020,13 @@ public partial class PlanBenefitComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// List of the costs. @@ -1066,24 +1036,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Cost { - get { if(_Cost==null) _Cost = new List(); return _Cost; } + get => _Cost ?? new List(); set { _Cost = value; OnPropertyChanged("Cost"); } } - private List _Cost; + private List? _Cost; protected internal override void CopyToInternal(Base other) { - var dest = other as PlanBenefitComponent; - - if (dest == null) - { + if(other is not PlanBenefitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Cost.Any()) dest.Cost = new List(Cost.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = new List(_Cost.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1095,41 +1061,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanBenefitComponent; - if(otherT == null) return false; + if(other is not PlanBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Cost, otherT.Cost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "cost": - value = Cost; - return Cost?.Any() == true; + value = _Cost; + return _Cost?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cost": - Cost = (List)value; + Cost = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1140,8 +1106,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Cost?.Any() == true) yield return new KeyValuePair("cost",Cost); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Cost?.Any() == true) yield return new KeyValuePair("cost",_Cost); } } @@ -1168,13 +1134,13 @@ public partial class CostComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// in-network | out-of-network | other. @@ -1182,13 +1148,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("applicability", Order=50)] [Binding("BenefitCostApplicability")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Applicability + public Hl7.Fhir.Model.CodeableConcept? Applicability { get { return _Applicability; } set { _Applicability = value; OnPropertyChanged("Applicability"); } } - private Hl7.Fhir.Model.CodeableConcept _Applicability; + private Hl7.Fhir.Model.CodeableConcept? _Applicability; /// /// Additional information about the cost. @@ -1198,39 +1164,35 @@ public Hl7.Fhir.Model.CodeableConcept Applicability [DataMember] public List Qualifiers { - get { if(_Qualifiers==null) _Qualifiers = new List(); return _Qualifiers; } + get => _Qualifiers ?? new List(); set { _Qualifiers = value; OnPropertyChanged("Qualifiers"); } } - private List _Qualifiers; + private List? _Qualifiers; /// /// The actual cost value. /// [FhirElement("value", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Value + public Hl7.Fhir.Model.Quantity? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.Quantity _Value; + private Hl7.Fhir.Model.Quantity? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CostComponent; - - if (dest == null) - { + if(other is not CostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Applicability != null) dest.Applicability = (Hl7.Fhir.Model.CodeableConcept)Applicability.DeepCopyInternal(); - if(Qualifiers.Any()) dest.Qualifiers = new List(Qualifiers.DeepCopyInternal()); - if(Value != null) dest.Value = (Hl7.Fhir.Model.Quantity)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Applicability is not null) dest.Applicability = (Hl7.Fhir.Model.CodeableConcept)_Applicability.DeepCopyInternal(); + if(_Qualifiers is not null) dest.Qualifiers = new List(_Qualifiers.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.Quantity)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1242,55 +1204,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostComponent; - if(otherT == null) return false; + if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Applicability, otherT.Applicability)) return false; - if(!comparer.ListEquals(Qualifiers, otherT.Qualifiers)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; + if(!comparer.ListEquals(_Qualifiers, otherT._Qualifiers)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "applicability": - value = Applicability; - return Applicability is not null; + value = _Applicability; + return _Applicability is not null; case "qualifiers": - value = Qualifiers; - return Qualifiers?.Any() == true; + value = _Qualifiers; + return _Qualifiers?.Any() == true; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "applicability": - Applicability = (Hl7.Fhir.Model.CodeableConcept)value; + Applicability = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "qualifiers": - Qualifiers = (List)value; + Qualifiers = (List?)value!; return this; case "value": - Value = (Hl7.Fhir.Model.Quantity)value; + Value = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -1301,10 +1263,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Applicability is not null) yield return new KeyValuePair("applicability",Applicability); - if (Qualifiers?.Any() == true) yield return new KeyValuePair("qualifiers",Qualifiers); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Applicability is not null) yield return new KeyValuePair("applicability",_Applicability); + if (_Qualifiers?.Any() == true) yield return new KeyValuePair("qualifiers",_Qualifiers); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1317,11 +1279,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -1330,13 +1292,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("PublicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1345,13 +1307,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1365,39 +1324,36 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Official name. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Official name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1410,24 +1366,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// Alternate names /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -1439,13 +1395,13 @@ public IEnumerable Alias /// [FhirElement("period", Order=140)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Product issuer. @@ -1454,13 +1410,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OwnedBy + public Hl7.Fhir.Model.ResourceReference? OwnedBy { get { return _OwnedBy; } set { _OwnedBy = value; OnPropertyChanged("OwnedBy"); } } - private Hl7.Fhir.Model.ResourceReference _OwnedBy; + private Hl7.Fhir.Model.ResourceReference? _OwnedBy; /// /// Product administrator. @@ -1469,13 +1425,13 @@ public Hl7.Fhir.Model.ResourceReference OwnedBy [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference AdministeredBy + public Hl7.Fhir.Model.ResourceReference? AdministeredBy { get { return _AdministeredBy; } set { _AdministeredBy = value; OnPropertyChanged("AdministeredBy"); } } - private Hl7.Fhir.Model.ResourceReference _AdministeredBy; + private Hl7.Fhir.Model.ResourceReference? _AdministeredBy; /// /// Where product applies. @@ -1487,11 +1443,11 @@ public Hl7.Fhir.Model.ResourceReference AdministeredBy [DataMember] public List CoverageArea { - get { if(_CoverageArea==null) _CoverageArea = new List(); return _CoverageArea; } + get => _CoverageArea ?? new List(); set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } - private List _CoverageArea; + private List? _CoverageArea; /// /// Official contact details relevant to the health insurance plan/product. @@ -1501,11 +1457,11 @@ public List CoverageArea [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Technical endpoint. @@ -1517,11 +1473,11 @@ public List Contact [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// What networks are Included. @@ -1533,11 +1489,11 @@ public List Endpoint [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Coverage details. @@ -1547,11 +1503,11 @@ public List Network [DataMember] public List Coverage { - get { if(_Coverage==null) _Coverage = new List(); return _Coverage; } + get => _Coverage ?? new List(); set { _Coverage = value; OnPropertyChanged("Coverage"); } } - private List _Coverage; + private List? _Coverage; /// /// Plan details. @@ -1561,38 +1517,34 @@ public List Coverage [DataMember] public List Plan { - get { if(_Plan==null) _Plan = new List(); return _Plan; } + get => _Plan ?? new List(); set { _Plan = value; OnPropertyChanged("Plan"); } } - private List _Plan; + private List? _Plan; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as InsurancePlan; - - if (dest == null) - { + if(other is not InsurancePlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(OwnedBy != null) dest.OwnedBy = (Hl7.Fhir.Model.ResourceReference)OwnedBy.DeepCopyInternal(); - if(AdministeredBy != null) dest.AdministeredBy = (Hl7.Fhir.Model.ResourceReference)AdministeredBy.DeepCopyInternal(); - if(CoverageArea.Any()) dest.CoverageArea = new List(CoverageArea.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Coverage.Any()) dest.Coverage = new List(Coverage.DeepCopyInternal()); - if(Plan.Any()) dest.Plan = new List(Plan.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_OwnedBy is not null) dest.OwnedBy = (Hl7.Fhir.Model.ResourceReference)_OwnedBy.DeepCopyInternal(); + if(_AdministeredBy is not null) dest.AdministeredBy = (Hl7.Fhir.Model.ResourceReference)_AdministeredBy.DeepCopyInternal(); + if(_CoverageArea is not null) dest.CoverageArea = new List(_CoverageArea.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Coverage is not null) dest.Coverage = new List(_Coverage.DeepCopyInternal()); + if(_Plan is not null) dest.Plan = new List(_Plan.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1604,125 +1556,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InsurancePlan; - if(otherT == null) return false; + if(other is not InsurancePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(OwnedBy, otherT.OwnedBy)) return false; - if(!comparer.Equals(AdministeredBy, otherT.AdministeredBy)) return false; - if(!comparer.ListEquals(CoverageArea, otherT.CoverageArea)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Coverage, otherT.Coverage)) return false; - if(!comparer.ListEquals(Plan, otherT.Plan)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_OwnedBy, otherT._OwnedBy)) return false; + if(!comparer.Equals(_AdministeredBy, otherT._AdministeredBy)) return false; + if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; + if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "ownedBy": - value = OwnedBy; - return OwnedBy is not null; + value = _OwnedBy; + return _OwnedBy is not null; case "administeredBy": - value = AdministeredBy; - return AdministeredBy is not null; + value = _AdministeredBy; + return _AdministeredBy is not null; case "coverageArea": - value = CoverageArea; - return CoverageArea?.Any() == true; + value = _CoverageArea; + return _CoverageArea?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "coverage": - value = Coverage; - return Coverage?.Any() == true; + value = _Coverage; + return _Coverage?.Any() == true; case "plan": - value = Plan; - return Plan?.Any() == true; + value = _Plan; + return _Plan?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "ownedBy": - OwnedBy = (Hl7.Fhir.Model.ResourceReference)value; + OwnedBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "administeredBy": - AdministeredBy = (Hl7.Fhir.Model.ResourceReference)value; + AdministeredBy = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "coverageArea": - CoverageArea = (List)value; + CoverageArea = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "coverage": - Coverage = (List)value; + Coverage = (List?)value!; return this; case "plan": - Plan = (List)value; + Plan = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1733,20 +1685,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (OwnedBy is not null) yield return new KeyValuePair("ownedBy",OwnedBy); - if (AdministeredBy is not null) yield return new KeyValuePair("administeredBy",AdministeredBy); - if (CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",CoverageArea); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Coverage?.Any() == true) yield return new KeyValuePair("coverage",Coverage); - if (Plan?.Any() == true) yield return new KeyValuePair("plan",Plan); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_OwnedBy is not null) yield return new KeyValuePair("ownedBy",_OwnedBy); + if (_AdministeredBy is not null) yield return new KeyValuePair("administeredBy",_AdministeredBy); + if (_CoverageArea?.Any() == true) yield return new KeyValuePair("coverageArea",_CoverageArea); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Coverage?.Any() == true) yield return new KeyValuePair("coverage",_Coverage); + if (_Plan?.Any() == true) yield return new KeyValuePair("plan",_Plan); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs b/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs index 46c1fe624..63b22bf30 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -113,13 +116,13 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [Binding("NameType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding NameType + public Hl7.Fhir.Model.Coding? NameType { get { return _NameType; } set { _NameType = value; OnPropertyChanged("NameType"); } } - private Hl7.Fhir.Model.Coding _NameType; + private Hl7.Fhir.Model.Coding? _NameType; /// /// The language used to express the item name. @@ -129,13 +132,13 @@ public Hl7.Fhir.Model.Coding NameType [Binding("NameLanguage")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code LanguageElement + public Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Code _LanguageElement; + private Code? _LanguageElement; /// /// The language used to express the item name @@ -144,13 +147,10 @@ public Code LanguageElement [IgnoreDataMember] public Hl7.Fhir.Model.CommonLanguages? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Code(value); + LanguageElement = value is null ? null : new Code(value); OnPropertyChanged("Language"); } } @@ -161,45 +161,38 @@ public Hl7.Fhir.Model.CommonLanguages? Language [FhirElement("name", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name or designation of the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameType != null) dest.NameType = (Hl7.Fhir.Model.Coding)NameType.DeepCopyInternal(); - if(LanguageElement != null) dest.LanguageElement = (Code)LanguageElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); + if(_NameType is not null) dest.NameType = (Hl7.Fhir.Model.Coding)_NameType.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Code)_LanguageElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -211,48 +204,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameType, otherT.NameType)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameType, otherT._NameType)) return false; + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "nameType": - value = NameType; - return NameType is not null; + value = _NameType; + return _NameType is not null; case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "nameType": - NameType = (Hl7.Fhir.Model.Coding)value; + NameType = (Hl7.Fhir.Model.Coding?)value; return this; case "language": - LanguageElement = (Code)value; + LanguageElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -263,9 +256,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameType is not null) yield return new KeyValuePair("nameType",NameType); - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); + if (_NameType is not null) yield return new KeyValuePair("nameType",_NameType); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); } } @@ -289,13 +282,13 @@ public partial class ResponsibleOrganizationComponent : Hl7.Fhir.Model.BackboneE [FhirElement("role", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// An organization that is associated with the item. @@ -305,26 +298,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; protected internal override void CopyToInternal(Base other) { - var dest = other as ResponsibleOrganizationComponent; - - if (dest == null) - { + if(other is not ResponsibleOrganizationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -336,41 +325,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResponsibleOrganizationComponent; - if(otherT == null) return false; + if(other is not ResponsibleOrganizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -381,8 +370,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); } } @@ -410,13 +399,13 @@ public partial class DescriptionComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ItemDescriptionLanguage")] [DataMember] - public Code LanguageElement + public Code? LanguageElement { get { return _LanguageElement; } set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private Code _LanguageElement; + private Code? _LanguageElement; /// /// The language that is used in the item description @@ -425,13 +414,10 @@ public Code LanguageElement [IgnoreDataMember] public Hl7.Fhir.Model.CommonLanguages? Language { - get { return LanguageElement != null ? LanguageElement.Value : null; } + get => _LanguageElement?.Value; set { - if (value == null) - LanguageElement = null; - else - LanguageElement = new Code(value); + LanguageElement = value is null ? null : new Code(value); OnPropertyChanged("Language"); } } @@ -441,44 +427,37 @@ public Hl7.Fhir.Model.CommonLanguages? Language /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DescriptionComponent; - - if (dest == null) - { + if(other is not DescriptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LanguageElement != null) dest.LanguageElement = (Code)LanguageElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = (Code)_LanguageElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -490,41 +469,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DescriptionComponent; - if(otherT == null) return false; + if(other is not DescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = LanguageElement; - return LanguageElement is not null; + value = _LanguageElement; + return _LanguageElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - LanguageElement = (Code)value; + LanguageElement = (Code?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -535,8 +514,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LanguageElement is not null) yield return new KeyValuePair("language",LanguageElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_LanguageElement is not null) yield return new KeyValuePair("language",_LanguageElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -560,13 +539,13 @@ public partial class AssociationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("associationType", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AssociationType + public Hl7.Fhir.Model.CodeableConcept? AssociationType { get { return _AssociationType; } set { _AssociationType = value; OnPropertyChanged("AssociationType"); } } - private Hl7.Fhir.Model.CodeableConcept _AssociationType; + private Hl7.Fhir.Model.CodeableConcept? _AssociationType; /// /// The related item or product. @@ -576,13 +555,13 @@ public Hl7.Fhir.Model.CodeableConcept AssociationType [References("InventoryItem","Medication","MedicationKnowledge","Device","DeviceDefinition","NutritionProduct","BiologicallyDerivedProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference RelatedItem + public Hl7.Fhir.Model.ResourceReference? RelatedItem { get { return _RelatedItem; } set { _RelatedItem = value; OnPropertyChanged("RelatedItem"); } } - private Hl7.Fhir.Model.ResourceReference _RelatedItem; + private Hl7.Fhir.Model.ResourceReference? _RelatedItem; /// /// The quantity of the product in this product. @@ -590,27 +569,23 @@ public Hl7.Fhir.Model.ResourceReference RelatedItem [FhirElement("quantity", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Ratio Quantity + public Hl7.Fhir.Model.Ratio? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Ratio _Quantity; + private Hl7.Fhir.Model.Ratio? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as AssociationComponent; - - if (dest == null) - { + if(other is not AssociationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AssociationType != null) dest.AssociationType = (Hl7.Fhir.Model.CodeableConcept)AssociationType.DeepCopyInternal(); - if(RelatedItem != null) dest.RelatedItem = (Hl7.Fhir.Model.ResourceReference)RelatedItem.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Ratio)Quantity.DeepCopyInternal(); + if(_AssociationType is not null) dest.AssociationType = (Hl7.Fhir.Model.CodeableConcept)_AssociationType.DeepCopyInternal(); + if(_RelatedItem is not null) dest.RelatedItem = (Hl7.Fhir.Model.ResourceReference)_RelatedItem.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Ratio)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -622,48 +597,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssociationComponent; - if(otherT == null) return false; + if(other is not AssociationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AssociationType, otherT.AssociationType)) return false; - if(!comparer.Equals(RelatedItem, otherT.RelatedItem)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AssociationType, otherT._AssociationType)) return false; + if(!comparer.Equals(_RelatedItem, otherT._RelatedItem)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "associationType": - value = AssociationType; - return AssociationType is not null; + value = _AssociationType; + return _AssociationType is not null; case "relatedItem": - value = RelatedItem; - return RelatedItem is not null; + value = _RelatedItem; + return _RelatedItem is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "associationType": - AssociationType = (Hl7.Fhir.Model.CodeableConcept)value; + AssociationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "relatedItem": - RelatedItem = (Hl7.Fhir.Model.ResourceReference)value; + RelatedItem = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Ratio)value; + Quantity = (Hl7.Fhir.Model.Ratio?)value; return this; default: return base.SetValue(key, value); @@ -674,9 +649,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AssociationType is not null) yield return new KeyValuePair("associationType",AssociationType); - if (RelatedItem is not null) yield return new KeyValuePair("relatedItem",RelatedItem); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_AssociationType is not null) yield return new KeyValuePair("associationType",_AssociationType); + if (_RelatedItem is not null) yield return new KeyValuePair("relatedItem",_RelatedItem); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -703,13 +678,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("characteristicType", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CharacteristicType + public Hl7.Fhir.Model.CodeableConcept? CharacteristicType { get { return _CharacteristicType; } set { _CharacteristicType = value; OnPropertyChanged("CharacteristicType"); } } - private Hl7.Fhir.Model.CodeableConcept _CharacteristicType; + private Hl7.Fhir.Model.CodeableConcept? _CharacteristicType; /// /// The value of the attribute. @@ -719,26 +694,22 @@ public Hl7.Fhir.Model.CodeableConcept CharacteristicType [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CharacteristicType != null) dest.CharacteristicType = (Hl7.Fhir.Model.CodeableConcept)CharacteristicType.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_CharacteristicType is not null) dest.CharacteristicType = (Hl7.Fhir.Model.CodeableConcept)_CharacteristicType.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -750,41 +721,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CharacteristicType, otherT.CharacteristicType)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CharacteristicType, otherT._CharacteristicType)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "characteristicType": - value = CharacteristicType; - return CharacteristicType is not null; + value = _CharacteristicType; + return _CharacteristicType is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "characteristicType": - CharacteristicType = (Hl7.Fhir.Model.CodeableConcept)value; + CharacteristicType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -795,8 +766,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CharacteristicType is not null) yield return new KeyValuePair("characteristicType",CharacteristicType); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_CharacteristicType is not null) yield return new KeyValuePair("characteristicType",_CharacteristicType); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -822,39 +793,36 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The lot or batch number of the item. /// [FhirElement("lotNumber", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// The lot or batch number of the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -864,28 +832,25 @@ public string LotNumber /// [FhirElement("expiry", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpiryElement + public Hl7.Fhir.Model.FhirDateTime? ExpiryElement { get { return _ExpiryElement; } set { _ExpiryElement = value; OnPropertyChanged("ExpiryElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpiryElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpiryElement; /// /// The expiry date or date and time for the product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expiry + public string? Expiry { - get { return ExpiryElement != null ? ExpiryElement.Value : null; } + get => _ExpiryElement?.Value; set { - if (value == null) - ExpiryElement = null; - else - ExpiryElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpiryElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Expiry"); } } @@ -897,13 +862,13 @@ public string Expiry [CLSCompliant(false)] [References("Patient","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The location that the item is associated with. @@ -912,29 +877,25 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpiryElement != null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)ExpiryElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpiryElement is not null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)_ExpiryElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -946,62 +907,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpiryElement, otherT.ExpiryElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expiry": - value = ExpiryElement; - return ExpiryElement is not null; + value = _ExpiryElement; + return _ExpiryElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expiry": - ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpiryElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1012,11 +973,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpiryElement is not null) yield return new KeyValuePair("expiry",ExpiryElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Location is not null) yield return new KeyValuePair("location",Location); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpiryElement is not null) yield return new KeyValuePair("expiry",_ExpiryElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Location is not null) yield return new KeyValuePair("location",_Location); } } @@ -1029,11 +990,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | inactive | entered-in-error | unknown. @@ -1043,13 +1004,13 @@ public List Identifier [Binding("InventoryItemStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error | unknown @@ -1058,13 +1019,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.InventoryItem.InventoryItemStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1077,11 +1035,11 @@ public Hl7.Fhir.Model.InventoryItem.InventoryItemStatusCodes? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Code designating the specific type of item. @@ -1091,11 +1049,11 @@ public List Category [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// The item name(s) - the brand name, or common name, functional name, generic name or others. @@ -1105,11 +1063,11 @@ public List Code [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// Organization(s) responsible for the product. @@ -1119,24 +1077,24 @@ public List Name [DataMember] public List ResponsibleOrganization { - get { if(_ResponsibleOrganization==null) _ResponsibleOrganization = new List(); return _ResponsibleOrganization; } + get => _ResponsibleOrganization ?? new List(); set { _ResponsibleOrganization = value; OnPropertyChanged("ResponsibleOrganization"); } } - private List _ResponsibleOrganization; + private List? _ResponsibleOrganization; /// /// Descriptive characteristics of the item. /// [FhirElement("description", Order=150)] [DataMember] - public Hl7.Fhir.Model.InventoryItem.DescriptionComponent Description + public Hl7.Fhir.Model.InventoryItem.DescriptionComponent? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.InventoryItem.DescriptionComponent _Description; + private Hl7.Fhir.Model.InventoryItem.DescriptionComponent? _Description; /// /// The usage status like recalled, in use, discarded. @@ -1146,37 +1104,37 @@ public Hl7.Fhir.Model.InventoryItem.DescriptionComponent Description [DataMember] public List InventoryStatus { - get { if(_InventoryStatus==null) _InventoryStatus = new List(); return _InventoryStatus; } + get => _InventoryStatus ?? new List(); set { _InventoryStatus = value; OnPropertyChanged("InventoryStatus"); } } - private List _InventoryStatus; + private List? _InventoryStatus; /// /// The base unit of measure - the unit in which the product is used or counted. /// [FhirElement("baseUnit", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BaseUnit + public Hl7.Fhir.Model.CodeableConcept? BaseUnit { get { return _BaseUnit; } set { _BaseUnit = value; OnPropertyChanged("BaseUnit"); } } - private Hl7.Fhir.Model.CodeableConcept _BaseUnit; + private Hl7.Fhir.Model.CodeableConcept? _BaseUnit; /// /// Net content or amount present in the item. /// [FhirElement("netContent", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Quantity NetContent + public Hl7.Fhir.Model.Quantity? NetContent { get { return _NetContent; } set { _NetContent = value; OnPropertyChanged("NetContent"); } } - private Hl7.Fhir.Model.Quantity _NetContent; + private Hl7.Fhir.Model.Quantity? _NetContent; /// /// Association with other items or products. @@ -1186,11 +1144,11 @@ public Hl7.Fhir.Model.Quantity NetContent [DataMember] public List Association { - get { if(_Association==null) _Association = new List(); return _Association; } + get => _Association ?? new List(); set { _Association = value; OnPropertyChanged("Association"); } } - private List _Association; + private List? _Association; /// /// Characteristic of the item. @@ -1200,24 +1158,24 @@ public List Association [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// Instances or occurrences of the product. /// [FhirElement("instance", Order=210)] [DataMember] - public Hl7.Fhir.Model.InventoryItem.InstanceComponent Instance + public Hl7.Fhir.Model.InventoryItem.InstanceComponent? Instance { get { return _Instance; } set { _Instance = value; OnPropertyChanged("Instance"); } } - private Hl7.Fhir.Model.InventoryItem.InstanceComponent _Instance; + private Hl7.Fhir.Model.InventoryItem.InstanceComponent? _Instance; /// /// Link to a product resource used in clinical workflows. @@ -1226,40 +1184,36 @@ public Hl7.Fhir.Model.InventoryItem.InstanceComponent Instance [CLSCompliant(false)] [References("Medication","Device","NutritionProduct","BiologicallyDerivedProduct")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ProductReference + public Hl7.Fhir.Model.ResourceReference? ProductReference { get { return _ProductReference; } set { _ProductReference = value; OnPropertyChanged("ProductReference"); } } - private Hl7.Fhir.Model.ResourceReference _ProductReference; + private Hl7.Fhir.Model.ResourceReference? _ProductReference; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as InventoryItem; - - if (dest == null) - { + if(other is not InventoryItem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(ResponsibleOrganization.Any()) dest.ResponsibleOrganization = new List(ResponsibleOrganization.DeepCopyInternal()); - if(Description != null) dest.Description = (Hl7.Fhir.Model.InventoryItem.DescriptionComponent)Description.DeepCopyInternal(); - if(InventoryStatus.Any()) dest.InventoryStatus = new List(InventoryStatus.DeepCopyInternal()); - if(BaseUnit != null) dest.BaseUnit = (Hl7.Fhir.Model.CodeableConcept)BaseUnit.DeepCopyInternal(); - if(NetContent != null) dest.NetContent = (Hl7.Fhir.Model.Quantity)NetContent.DeepCopyInternal(); - if(Association.Any()) dest.Association = new List(Association.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Instance != null) dest.Instance = (Hl7.Fhir.Model.InventoryItem.InstanceComponent)Instance.DeepCopyInternal(); - if(ProductReference != null) dest.ProductReference = (Hl7.Fhir.Model.ResourceReference)ProductReference.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_ResponsibleOrganization is not null) dest.ResponsibleOrganization = new List(_ResponsibleOrganization.DeepCopyInternal()); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.InventoryItem.DescriptionComponent)_Description.DeepCopyInternal(); + if(_InventoryStatus is not null) dest.InventoryStatus = new List(_InventoryStatus.DeepCopyInternal()); + if(_BaseUnit is not null) dest.BaseUnit = (Hl7.Fhir.Model.CodeableConcept)_BaseUnit.DeepCopyInternal(); + if(_NetContent is not null) dest.NetContent = (Hl7.Fhir.Model.Quantity)_NetContent.DeepCopyInternal(); + if(_Association is not null) dest.Association = new List(_Association.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = (Hl7.Fhir.Model.InventoryItem.InstanceComponent)_Instance.DeepCopyInternal(); + if(_ProductReference is not null) dest.ProductReference = (Hl7.Fhir.Model.ResourceReference)_ProductReference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1271,125 +1225,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InventoryItem; - if(otherT == null) return false; + if(other is not InventoryItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(ResponsibleOrganization, otherT.ResponsibleOrganization)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.ListEquals(InventoryStatus, otherT.InventoryStatus)) return false; - if(!comparer.Equals(BaseUnit, otherT.BaseUnit)) return false; - if(!comparer.Equals(NetContent, otherT.NetContent)) return false; - if(!comparer.ListEquals(Association, otherT.Association)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.Equals(Instance, otherT.Instance)) return false; - if(!comparer.Equals(ProductReference, otherT.ProductReference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_ResponsibleOrganization, otherT._ResponsibleOrganization)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.ListEquals(_InventoryStatus, otherT._InventoryStatus)) return false; + if(!comparer.Equals(_BaseUnit, otherT._BaseUnit)) return false; + if(!comparer.Equals(_NetContent, otherT._NetContent)) return false; + if(!comparer.ListEquals(_Association, otherT._Association)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.Equals(_Instance, otherT._Instance)) return false; + if(!comparer.Equals(_ProductReference, otherT._ProductReference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "responsibleOrganization": - value = ResponsibleOrganization; - return ResponsibleOrganization?.Any() == true; + value = _ResponsibleOrganization; + return _ResponsibleOrganization?.Any() == true; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "inventoryStatus": - value = InventoryStatus; - return InventoryStatus?.Any() == true; + value = _InventoryStatus; + return _InventoryStatus?.Any() == true; case "baseUnit": - value = BaseUnit; - return BaseUnit is not null; + value = _BaseUnit; + return _BaseUnit is not null; case "netContent": - value = NetContent; - return NetContent is not null; + value = _NetContent; + return _NetContent is not null; case "association": - value = Association; - return Association?.Any() == true; + value = _Association; + return _Association?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "instance": - value = Instance; - return Instance is not null; + value = _Instance; + return _Instance is not null; case "productReference": - value = ProductReference; - return ProductReference is not null; + value = _ProductReference; + return _ProductReference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "responsibleOrganization": - ResponsibleOrganization = (List)value; + ResponsibleOrganization = (List?)value!; return this; case "description": - Description = (Hl7.Fhir.Model.InventoryItem.DescriptionComponent)value; + Description = (Hl7.Fhir.Model.InventoryItem.DescriptionComponent?)value; return this; case "inventoryStatus": - InventoryStatus = (List)value; + InventoryStatus = (List?)value!; return this; case "baseUnit": - BaseUnit = (Hl7.Fhir.Model.CodeableConcept)value; + BaseUnit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "netContent": - NetContent = (Hl7.Fhir.Model.Quantity)value; + NetContent = (Hl7.Fhir.Model.Quantity?)value; return this; case "association": - Association = (List)value; + Association = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "instance": - Instance = (Hl7.Fhir.Model.InventoryItem.InstanceComponent)value; + Instance = (Hl7.Fhir.Model.InventoryItem.InstanceComponent?)value; return this; case "productReference": - ProductReference = (Hl7.Fhir.Model.ResourceReference)value; + ProductReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1400,20 +1354,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (ResponsibleOrganization?.Any() == true) yield return new KeyValuePair("responsibleOrganization",ResponsibleOrganization); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (InventoryStatus?.Any() == true) yield return new KeyValuePair("inventoryStatus",InventoryStatus); - if (BaseUnit is not null) yield return new KeyValuePair("baseUnit",BaseUnit); - if (NetContent is not null) yield return new KeyValuePair("netContent",NetContent); - if (Association?.Any() == true) yield return new KeyValuePair("association",Association); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Instance is not null) yield return new KeyValuePair("instance",Instance); - if (ProductReference is not null) yield return new KeyValuePair("productReference",ProductReference); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_ResponsibleOrganization?.Any() == true) yield return new KeyValuePair("responsibleOrganization",_ResponsibleOrganization); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_InventoryStatus?.Any() == true) yield return new KeyValuePair("inventoryStatus",_InventoryStatus); + if (_BaseUnit is not null) yield return new KeyValuePair("baseUnit",_BaseUnit); + if (_NetContent is not null) yield return new KeyValuePair("netContent",_NetContent); + if (_Association?.Any() == true) yield return new KeyValuePair("association",_Association); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Instance is not null) yield return new KeyValuePair("instance",_Instance); + if (_ProductReference is not null) yield return new KeyValuePair("productReference",_ProductReference); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs b/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs index cc2ffc758..f8e88d7e2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -132,54 +135,51 @@ public partial class InventoryListingComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// The status of the items that are being reported. /// [FhirElement("itemStatus", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ItemStatus + public Hl7.Fhir.Model.CodeableConcept? ItemStatus { get { return _ItemStatus; } set { _ItemStatus = value; OnPropertyChanged("ItemStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ItemStatus; + private Hl7.Fhir.Model.CodeableConcept? _ItemStatus; /// /// The date and time when the items were counted. /// [FhirElement("countingDateTime", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CountingDateTimeElement + public Hl7.Fhir.Model.FhirDateTime? CountingDateTimeElement { get { return _CountingDateTimeElement; } set { _CountingDateTimeElement = value; OnPropertyChanged("CountingDateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CountingDateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _CountingDateTimeElement; /// /// The date and time when the items were counted /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CountingDateTime + public string? CountingDateTime { - get { return CountingDateTimeElement != null ? CountingDateTimeElement.Value : null; } + get => _CountingDateTimeElement?.Value; set { - if (value == null) - CountingDateTimeElement = null; - else - CountingDateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + CountingDateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("CountingDateTime"); } } @@ -192,26 +192,22 @@ public string CountingDateTime [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as InventoryListingComponent; - - if (dest == null) - { + if(other is not InventoryListingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(ItemStatus != null) dest.ItemStatus = (Hl7.Fhir.Model.CodeableConcept)ItemStatus.DeepCopyInternal(); - if(CountingDateTimeElement != null) dest.CountingDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)CountingDateTimeElement.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_ItemStatus is not null) dest.ItemStatus = (Hl7.Fhir.Model.CodeableConcept)_ItemStatus.DeepCopyInternal(); + if(_CountingDateTimeElement is not null) dest.CountingDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_CountingDateTimeElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -223,55 +219,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InventoryListingComponent; - if(otherT == null) return false; + if(other is not InventoryListingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(ItemStatus, otherT.ItemStatus)) return false; - if(!comparer.Equals(CountingDateTimeElement, otherT.CountingDateTimeElement)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_ItemStatus, otherT._ItemStatus)) return false; + if(!comparer.Equals(_CountingDateTimeElement, otherT._CountingDateTimeElement)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "itemStatus": - value = ItemStatus; - return ItemStatus is not null; + value = _ItemStatus; + return _ItemStatus is not null; case "countingDateTime": - value = CountingDateTimeElement; - return CountingDateTimeElement is not null; + value = _CountingDateTimeElement; + return _CountingDateTimeElement is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "itemStatus": - ItemStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ItemStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "countingDateTime": - CountingDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + CountingDateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -282,10 +278,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Location is not null) yield return new KeyValuePair("location",Location); - if (ItemStatus is not null) yield return new KeyValuePair("itemStatus",ItemStatus); - if (CountingDateTimeElement is not null) yield return new KeyValuePair("countingDateTime",CountingDateTimeElement); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_ItemStatus is not null) yield return new KeyValuePair("itemStatus",_ItemStatus); + if (_CountingDateTimeElement is not null) yield return new KeyValuePair("countingDateTime",_CountingDateTimeElement); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -308,13 +304,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("category", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// The quantity of the item or items being reported. @@ -322,13 +318,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [FhirElement("quantity", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The code or reference to the item type. @@ -336,27 +332,23 @@ public Hl7.Fhir.Model.Quantity Quantity [FhirElement("item", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -368,48 +360,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; default: return base.SetValue(key, value); @@ -420,9 +412,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -435,11 +427,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | requested | active | entered-in-error. @@ -449,13 +441,13 @@ public List Identifier [Binding("InventoryReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | requested | active | entered-in-error @@ -464,13 +456,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.InventoryReport.InventoryReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -483,13 +472,13 @@ public Hl7.Fhir.Model.InventoryReport.InventoryReportStatus? Status [Binding("InventoryCountType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CountTypeElement + public Code? CountTypeElement { get { return _CountTypeElement; } set { _CountTypeElement = value; OnPropertyChanged("CountTypeElement"); } } - private Code _CountTypeElement; + private Code? _CountTypeElement; /// /// snapshot | difference @@ -498,13 +487,10 @@ public Code CountTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.InventoryReport.InventoryCountType? CountType { - get { return CountTypeElement != null ? CountTypeElement.Value : null; } + get => _CountTypeElement?.Value; set { - if (value == null) - CountTypeElement = null; - else - CountTypeElement = new Code(value); + CountTypeElement = value is null ? null : new Code(value); OnPropertyChanged("CountType"); } } @@ -514,26 +500,26 @@ public Hl7.Fhir.Model.InventoryReport.InventoryCountType? CountType /// [FhirElement("operationType", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OperationType + public Hl7.Fhir.Model.CodeableConcept? OperationType { get { return _OperationType; } set { _OperationType = value; OnPropertyChanged("OperationType"); } } - private Hl7.Fhir.Model.CodeableConcept _OperationType; + private Hl7.Fhir.Model.CodeableConcept? _OperationType; /// /// The reason for this count - regular count, ad-hoc count, new arrivals, etc. /// [FhirElement("operationTypeReason", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OperationTypeReason + public Hl7.Fhir.Model.CodeableConcept? OperationTypeReason { get { return _OperationTypeReason; } set { _OperationTypeReason = value; OnPropertyChanged("OperationTypeReason"); } } - private Hl7.Fhir.Model.CodeableConcept _OperationTypeReason; + private Hl7.Fhir.Model.CodeableConcept? _OperationTypeReason; /// /// When the report has been submitted. @@ -541,28 +527,25 @@ public Hl7.Fhir.Model.CodeableConcept OperationTypeReason [FhirElement("reportedDateTime", InSummary=true, Order=140)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReportedDateTimeElement + public Hl7.Fhir.Model.FhirDateTime? ReportedDateTimeElement { get { return _ReportedDateTimeElement; } set { _ReportedDateTimeElement = value; OnPropertyChanged("ReportedDateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReportedDateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _ReportedDateTimeElement; /// /// When the report has been submitted /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReportedDateTime + public string? ReportedDateTime { - get { return ReportedDateTimeElement != null ? ReportedDateTimeElement.Value : null; } + get => _ReportedDateTimeElement?.Value; set { - if (value == null) - ReportedDateTimeElement = null; - else - ReportedDateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReportedDateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ReportedDateTime"); } } @@ -574,26 +557,26 @@ public string ReportedDateTime [CLSCompliant(false)] [References("Practitioner","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reporter + public Hl7.Fhir.Model.ResourceReference? Reporter { get { return _Reporter; } set { _Reporter = value; OnPropertyChanged("Reporter"); } } - private Hl7.Fhir.Model.ResourceReference _Reporter; + private Hl7.Fhir.Model.ResourceReference? _Reporter; /// /// The period the report refers to. /// [FhirElement("reportingPeriod", Order=160)] [DataMember] - public Hl7.Fhir.Model.Period ReportingPeriod + public Hl7.Fhir.Model.Period? ReportingPeriod { get { return _ReportingPeriod; } set { _ReportingPeriod = value; OnPropertyChanged("ReportingPeriod"); } } - private Hl7.Fhir.Model.Period _ReportingPeriod; + private Hl7.Fhir.Model.Period? _ReportingPeriod; /// /// An inventory listing section (grouped by any of the attributes). @@ -603,11 +586,11 @@ public Hl7.Fhir.Model.Period ReportingPeriod [DataMember] public List InventoryListing { - get { if(_InventoryListing==null) _InventoryListing = new List(); return _InventoryListing; } + get => _InventoryListing ?? new List(); set { _InventoryListing = value; OnPropertyChanged("InventoryListing"); } } - private List _InventoryListing; + private List? _InventoryListing; /// /// A note associated with the InventoryReport. @@ -617,34 +600,30 @@ public List InventoryL [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as InventoryReport; - - if (dest == null) - { + if(other is not InventoryReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CountTypeElement != null) dest.CountTypeElement = (Code)CountTypeElement.DeepCopyInternal(); - if(OperationType != null) dest.OperationType = (Hl7.Fhir.Model.CodeableConcept)OperationType.DeepCopyInternal(); - if(OperationTypeReason != null) dest.OperationTypeReason = (Hl7.Fhir.Model.CodeableConcept)OperationTypeReason.DeepCopyInternal(); - if(ReportedDateTimeElement != null) dest.ReportedDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)ReportedDateTimeElement.DeepCopyInternal(); - if(Reporter != null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)Reporter.DeepCopyInternal(); - if(ReportingPeriod != null) dest.ReportingPeriod = (Hl7.Fhir.Model.Period)ReportingPeriod.DeepCopyInternal(); - if(InventoryListing.Any()) dest.InventoryListing = new List(InventoryListing.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CountTypeElement is not null) dest.CountTypeElement = (Code)_CountTypeElement.DeepCopyInternal(); + if(_OperationType is not null) dest.OperationType = (Hl7.Fhir.Model.CodeableConcept)_OperationType.DeepCopyInternal(); + if(_OperationTypeReason is not null) dest.OperationTypeReason = (Hl7.Fhir.Model.CodeableConcept)_OperationTypeReason.DeepCopyInternal(); + if(_ReportedDateTimeElement is not null) dest.ReportedDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_ReportedDateTimeElement.DeepCopyInternal(); + if(_Reporter is not null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)_Reporter.DeepCopyInternal(); + if(_ReportingPeriod is not null) dest.ReportingPeriod = (Hl7.Fhir.Model.Period)_ReportingPeriod.DeepCopyInternal(); + if(_InventoryListing is not null) dest.InventoryListing = new List(_InventoryListing.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -656,97 +635,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InventoryReport; - if(otherT == null) return false; + if(other is not InventoryReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CountTypeElement, otherT.CountTypeElement)) return false; - if(!comparer.Equals(OperationType, otherT.OperationType)) return false; - if(!comparer.Equals(OperationTypeReason, otherT.OperationTypeReason)) return false; - if(!comparer.Equals(ReportedDateTimeElement, otherT.ReportedDateTimeElement)) return false; - if(!comparer.Equals(Reporter, otherT.Reporter)) return false; - if(!comparer.Equals(ReportingPeriod, otherT.ReportingPeriod)) return false; - if(!comparer.ListEquals(InventoryListing, otherT.InventoryListing)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CountTypeElement, otherT._CountTypeElement)) return false; + if(!comparer.Equals(_OperationType, otherT._OperationType)) return false; + if(!comparer.Equals(_OperationTypeReason, otherT._OperationTypeReason)) return false; + if(!comparer.Equals(_ReportedDateTimeElement, otherT._ReportedDateTimeElement)) return false; + if(!comparer.Equals(_Reporter, otherT._Reporter)) return false; + if(!comparer.Equals(_ReportingPeriod, otherT._ReportingPeriod)) return false; + if(!comparer.ListEquals(_InventoryListing, otherT._InventoryListing)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "countType": - value = CountTypeElement; - return CountTypeElement is not null; + value = _CountTypeElement; + return _CountTypeElement is not null; case "operationType": - value = OperationType; - return OperationType is not null; + value = _OperationType; + return _OperationType is not null; case "operationTypeReason": - value = OperationTypeReason; - return OperationTypeReason is not null; + value = _OperationTypeReason; + return _OperationTypeReason is not null; case "reportedDateTime": - value = ReportedDateTimeElement; - return ReportedDateTimeElement is not null; + value = _ReportedDateTimeElement; + return _ReportedDateTimeElement is not null; case "reporter": - value = Reporter; - return Reporter is not null; + value = _Reporter; + return _Reporter is not null; case "reportingPeriod": - value = ReportingPeriod; - return ReportingPeriod is not null; + value = _ReportingPeriod; + return _ReportingPeriod is not null; case "inventoryListing": - value = InventoryListing; - return InventoryListing?.Any() == true; + value = _InventoryListing; + return _InventoryListing?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "countType": - CountTypeElement = (Code)value; + CountTypeElement = (Code?)value; return this; case "operationType": - OperationType = (Hl7.Fhir.Model.CodeableConcept)value; + OperationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "operationTypeReason": - OperationTypeReason = (Hl7.Fhir.Model.CodeableConcept)value; + OperationTypeReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reportedDateTime": - ReportedDateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReportedDateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reporter": - Reporter = (Hl7.Fhir.Model.ResourceReference)value; + Reporter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reportingPeriod": - ReportingPeriod = (Hl7.Fhir.Model.Period)value; + ReportingPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "inventoryListing": - InventoryListing = (List)value; + InventoryListing = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -757,16 +736,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CountTypeElement is not null) yield return new KeyValuePair("countType",CountTypeElement); - if (OperationType is not null) yield return new KeyValuePair("operationType",OperationType); - if (OperationTypeReason is not null) yield return new KeyValuePair("operationTypeReason",OperationTypeReason); - if (ReportedDateTimeElement is not null) yield return new KeyValuePair("reportedDateTime",ReportedDateTimeElement); - if (Reporter is not null) yield return new KeyValuePair("reporter",Reporter); - if (ReportingPeriod is not null) yield return new KeyValuePair("reportingPeriod",ReportingPeriod); - if (InventoryListing?.Any() == true) yield return new KeyValuePair("inventoryListing",InventoryListing); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CountTypeElement is not null) yield return new KeyValuePair("countType",_CountTypeElement); + if (_OperationType is not null) yield return new KeyValuePair("operationType",_OperationType); + if (_OperationTypeReason is not null) yield return new KeyValuePair("operationTypeReason",_OperationTypeReason); + if (_ReportedDateTimeElement is not null) yield return new KeyValuePair("reportedDateTime",_ReportedDateTimeElement); + if (_Reporter is not null) yield return new KeyValuePair("reporter",_Reporter); + if (_ReportingPeriod is not null) yield return new KeyValuePair("reportingPeriod",_ReportingPeriod); + if (_InventoryListing?.Any() == true) yield return new KeyValuePair("inventoryListing",_InventoryListing); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs index f909c20a5..b750d654a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -120,13 +123,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("role", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Individual who was involved. @@ -136,26 +139,22 @@ public Hl7.Fhir.Model.CodeableConcept Role [References("Practitioner","Organization","Patient","PractitionerRole","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -167,41 +166,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -212,8 +211,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -239,13 +238,13 @@ public partial class LineItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("sequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt SequenceElement + public Hl7.Fhir.Model.PositiveInt? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.PositiveInt _SequenceElement; + private Hl7.Fhir.Model.PositiveInt? _SequenceElement; /// /// Sequence number of line item @@ -254,13 +253,10 @@ public Hl7.Fhir.Model.PositiveInt SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.PositiveInt(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Sequence"); } } @@ -272,13 +268,13 @@ public int? Sequence [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Serviced + public Hl7.Fhir.Model.DataType? Serviced { get { return _Serviced; } set { _Serviced = value; OnPropertyChanged("Serviced"); } } - private Hl7.Fhir.Model.DataType _Serviced; + private Hl7.Fhir.Model.DataType? _Serviced; /// /// Reference to ChargeItem containing details of this line item or an inline billing code. @@ -289,13 +285,13 @@ public Hl7.Fhir.Model.DataType Serviced [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType ChargeItem + public Hl7.Fhir.Model.DataType? ChargeItem { get { return _ChargeItem; } set { _ChargeItem = value; OnPropertyChanged("ChargeItem"); } } - private Hl7.Fhir.Model.DataType _ChargeItem; + private Hl7.Fhir.Model.DataType? _ChargeItem; /// /// Components of total line item price. @@ -305,26 +301,22 @@ public Hl7.Fhir.Model.DataType ChargeItem [DataMember] public List PriceComponent { - get { if(_PriceComponent==null) _PriceComponent = new List(); return _PriceComponent; } + get => _PriceComponent ?? new List(); set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } - private List _PriceComponent; + private List? _PriceComponent; protected internal override void CopyToInternal(Base other) { - var dest = other as LineItemComponent; - - if (dest == null) - { + if(other is not LineItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)SequenceElement.DeepCopyInternal(); - if(Serviced != null) dest.Serviced = (Hl7.Fhir.Model.DataType)Serviced.DeepCopyInternal(); - if(ChargeItem != null) dest.ChargeItem = (Hl7.Fhir.Model.DataType)ChargeItem.DeepCopyInternal(); - if(PriceComponent.Any()) dest.PriceComponent = new List(PriceComponent.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.PositiveInt)_SequenceElement.DeepCopyInternal(); + if(_Serviced is not null) dest.Serviced = (Hl7.Fhir.Model.DataType)_Serviced.DeepCopyInternal(); + if(_ChargeItem is not null) dest.ChargeItem = (Hl7.Fhir.Model.DataType)_ChargeItem.DeepCopyInternal(); + if(_PriceComponent is not null) dest.PriceComponent = new List(_PriceComponent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -336,55 +328,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LineItemComponent; - if(otherT == null) return false; + if(other is not LineItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(Serviced, otherT.Serviced)) return false; - if(!comparer.Equals(ChargeItem, otherT.ChargeItem)) return false; - if(!comparer.ListEquals(PriceComponent, otherT.PriceComponent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; + if(!comparer.Equals(_ChargeItem, otherT._ChargeItem)) return false; + if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "serviced": - value = Serviced; - return Serviced is not null; + value = _Serviced; + return _Serviced is not null; case "chargeItem": - value = ChargeItem; - return ChargeItem is not null; + value = _ChargeItem; + return _ChargeItem is not null; case "priceComponent": - value = PriceComponent; - return PriceComponent?.Any() == true; + value = _PriceComponent; + return _PriceComponent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.PositiveInt)value; + SequenceElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "serviced": - Serviced = (Hl7.Fhir.Model.DataType)value; + Serviced = (Hl7.Fhir.Model.DataType?)value; return this; case "chargeItem": - ChargeItem = (Hl7.Fhir.Model.DataType)value; + ChargeItem = (Hl7.Fhir.Model.DataType?)value; return this; case "priceComponent": - PriceComponent = (List)value; + PriceComponent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -395,10 +387,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Serviced is not null) yield return new KeyValuePair("serviced",Serviced); - if (ChargeItem is not null) yield return new KeyValuePair("chargeItem",ChargeItem); - if (PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",PriceComponent); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Serviced is not null) yield return new KeyValuePair("serviced",_Serviced); + if (_ChargeItem is not null) yield return new KeyValuePair("chargeItem",_ChargeItem); + if (_PriceComponent?.Any() == true) yield return new KeyValuePair("priceComponent",_PriceComponent); } } @@ -411,11 +403,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | issued | balanced | cancelled | entered-in-error. @@ -425,13 +417,13 @@ public List Identifier [Binding("InvoiceStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | issued | balanced | cancelled | entered-in-error @@ -440,13 +432,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Invoice.InvoiceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -456,28 +445,25 @@ public Hl7.Fhir.Model.Invoice.InvoiceStatus? Status /// [FhirElement("cancelledReason", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CancelledReasonElement + public Hl7.Fhir.Model.FhirString? CancelledReasonElement { get { return _CancelledReasonElement; } set { _CancelledReasonElement = value; OnPropertyChanged("CancelledReasonElement"); } } - private Hl7.Fhir.Model.FhirString _CancelledReasonElement; + private Hl7.Fhir.Model.FhirString? _CancelledReasonElement; /// /// Reason for cancellation of this Invoice /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CancelledReason + public string? CancelledReason { - get { return CancelledReasonElement != null ? CancelledReasonElement.Value : null; } + get => _CancelledReasonElement?.Value; set { - if (value == null) - CancelledReasonElement = null; - else - CancelledReasonElement = new Hl7.Fhir.Model.FhirString(value); + CancelledReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CancelledReason"); } } @@ -487,13 +473,13 @@ public string CancelledReason /// [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Recipient(s) of goods and services. @@ -502,13 +488,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Recipient of this invoice. @@ -517,41 +503,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// DEPRICATED. /// [FhirElement("date", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// DEPRICATED /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -561,28 +544,25 @@ public string Date /// [FhirElement("creation", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreationElement + public Hl7.Fhir.Model.FhirDateTime? CreationElement { get { return _CreationElement; } set { _CreationElement = value; OnPropertyChanged("CreationElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreationElement; + private Hl7.Fhir.Model.FhirDateTime? _CreationElement; /// /// When posted /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Creation + public string? Creation { - get { return CreationElement != null ? CreationElement.Value : null; } + get => _CreationElement?.Value; set { - if (value == null) - CreationElement = null; - else - CreationElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreationElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Creation"); } } @@ -594,13 +574,13 @@ public string Creation [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Period + public Hl7.Fhir.Model.DataType? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.DataType _Period; + private Hl7.Fhir.Model.DataType? _Period; /// /// Participant in creation of this Invoice. @@ -610,11 +590,11 @@ public Hl7.Fhir.Model.DataType Period [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// Issuing Organization of Invoice. @@ -623,13 +603,13 @@ public List Participant [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; /// /// Account that is being balanced. @@ -638,13 +618,13 @@ public Hl7.Fhir.Model.ResourceReference Issuer [CLSCompliant(false)] [References("Account")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Account + public Hl7.Fhir.Model.ResourceReference? Account { get { return _Account; } set { _Account = value; OnPropertyChanged("Account"); } } - private Hl7.Fhir.Model.ResourceReference _Account; + private Hl7.Fhir.Model.ResourceReference? _Account; /// /// Line items of this Invoice. @@ -654,11 +634,11 @@ public Hl7.Fhir.Model.ResourceReference Account [DataMember] public List LineItem { - get { if(_LineItem==null) _LineItem = new List(); return _LineItem; } + get => _LineItem ?? new List(); set { _LineItem = value; OnPropertyChanged("LineItem"); } } - private List _LineItem; + private List? _LineItem; /// /// Components of Invoice total. @@ -668,65 +648,62 @@ public List LineItem [DataMember] public List TotalPriceComponent { - get { if(_TotalPriceComponent==null) _TotalPriceComponent = new List(); return _TotalPriceComponent; } + get => _TotalPriceComponent ?? new List(); set { _TotalPriceComponent = value; OnPropertyChanged("TotalPriceComponent"); } } - private List _TotalPriceComponent; + private List? _TotalPriceComponent; /// /// Net total of this Invoice. /// [FhirElement("totalNet", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Money TotalNet + public Hl7.Fhir.Model.Money? TotalNet { get { return _TotalNet; } set { _TotalNet = value; OnPropertyChanged("TotalNet"); } } - private Hl7.Fhir.Model.Money _TotalNet; + private Hl7.Fhir.Model.Money? _TotalNet; /// /// Gross total of this Invoice. /// [FhirElement("totalGross", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.Money TotalGross + public Hl7.Fhir.Model.Money? TotalGross { get { return _TotalGross; } set { _TotalGross = value; OnPropertyChanged("TotalGross"); } } - private Hl7.Fhir.Model.Money _TotalGross; + private Hl7.Fhir.Model.Money? _TotalGross; /// /// Payment details. /// [FhirElement("paymentTerms", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown PaymentTermsElement + public Hl7.Fhir.Model.Markdown? PaymentTermsElement { get { return _PaymentTermsElement; } set { _PaymentTermsElement = value; OnPropertyChanged("PaymentTermsElement"); } } - private Hl7.Fhir.Model.Markdown _PaymentTermsElement; + private Hl7.Fhir.Model.Markdown? _PaymentTermsElement; /// /// Payment details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentTerms + public string? PaymentTerms { - get { return PaymentTermsElement != null ? PaymentTermsElement.Value : null; } + get => _PaymentTermsElement?.Value; set { - if (value == null) - PaymentTermsElement = null; - else - PaymentTermsElement = new Hl7.Fhir.Model.Markdown(value); + PaymentTermsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PaymentTerms"); } } @@ -739,42 +716,38 @@ public string PaymentTerms [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Invoice; - - if (dest == null) - { + if(other is not Invoice dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CancelledReasonElement != null) dest.CancelledReasonElement = (Hl7.Fhir.Model.FhirString)CancelledReasonElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(CreationElement != null) dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)CreationElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.DataType)Period.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); - if(Account != null) dest.Account = (Hl7.Fhir.Model.ResourceReference)Account.DeepCopyInternal(); - if(LineItem.Any()) dest.LineItem = new List(LineItem.DeepCopyInternal()); - if(TotalPriceComponent.Any()) dest.TotalPriceComponent = new List(TotalPriceComponent.DeepCopyInternal()); - if(TotalNet != null) dest.TotalNet = (Hl7.Fhir.Model.Money)TotalNet.DeepCopyInternal(); - if(TotalGross != null) dest.TotalGross = (Hl7.Fhir.Model.Money)TotalGross.DeepCopyInternal(); - if(PaymentTermsElement != null) dest.PaymentTermsElement = (Hl7.Fhir.Model.Markdown)PaymentTermsElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CancelledReasonElement is not null) dest.CancelledReasonElement = (Hl7.Fhir.Model.FhirString)_CancelledReasonElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_CreationElement is not null) dest.CreationElement = (Hl7.Fhir.Model.FhirDateTime)_CreationElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.DataType)_Period.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); + if(_Account is not null) dest.Account = (Hl7.Fhir.Model.ResourceReference)_Account.DeepCopyInternal(); + if(_LineItem is not null) dest.LineItem = new List(_LineItem.DeepCopyInternal()); + if(_TotalPriceComponent is not null) dest.TotalPriceComponent = new List(_TotalPriceComponent.DeepCopyInternal()); + if(_TotalNet is not null) dest.TotalNet = (Hl7.Fhir.Model.Money)_TotalNet.DeepCopyInternal(); + if(_TotalGross is not null) dest.TotalGross = (Hl7.Fhir.Model.Money)_TotalGross.DeepCopyInternal(); + if(_PaymentTermsElement is not null) dest.PaymentTermsElement = (Hl7.Fhir.Model.Markdown)_PaymentTermsElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -786,153 +759,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Invoice; - if(otherT == null) return false; + if(other is not Invoice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CancelledReasonElement, otherT.CancelledReasonElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(CreationElement, otherT.CreationElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; - if(!comparer.Equals(Account, otherT.Account)) return false; - if(!comparer.ListEquals(LineItem, otherT.LineItem)) return false; - if(!comparer.ListEquals(TotalPriceComponent, otherT.TotalPriceComponent)) return false; - if(!comparer.Equals(TotalNet, otherT.TotalNet)) return false; - if(!comparer.Equals(TotalGross, otherT.TotalGross)) return false; - if(!comparer.Equals(PaymentTermsElement, otherT.PaymentTermsElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CancelledReasonElement, otherT._CancelledReasonElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_CreationElement, otherT._CreationElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; + if(!comparer.Equals(_Account, otherT._Account)) return false; + if(!comparer.ListEquals(_LineItem, otherT._LineItem)) return false; + if(!comparer.ListEquals(_TotalPriceComponent, otherT._TotalPriceComponent)) return false; + if(!comparer.Equals(_TotalNet, otherT._TotalNet)) return false; + if(!comparer.Equals(_TotalGross, otherT._TotalGross)) return false; + if(!comparer.Equals(_PaymentTermsElement, otherT._PaymentTermsElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "cancelledReason": - value = CancelledReasonElement; - return CancelledReasonElement is not null; + value = _CancelledReasonElement; + return _CancelledReasonElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "creation": - value = CreationElement; - return CreationElement is not null; + value = _CreationElement; + return _CreationElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; case "account": - value = Account; - return Account is not null; + value = _Account; + return _Account is not null; case "lineItem": - value = LineItem; - return LineItem?.Any() == true; + value = _LineItem; + return _LineItem?.Any() == true; case "totalPriceComponent": - value = TotalPriceComponent; - return TotalPriceComponent?.Any() == true; + value = _TotalPriceComponent; + return _TotalPriceComponent?.Any() == true; case "totalNet": - value = TotalNet; - return TotalNet is not null; + value = _TotalNet; + return _TotalNet is not null; case "totalGross": - value = TotalGross; - return TotalGross is not null; + value = _TotalGross; + return _TotalGross is not null; case "paymentTerms": - value = PaymentTermsElement; - return PaymentTermsElement is not null; + value = _PaymentTermsElement; + return _PaymentTermsElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "cancelledReason": - CancelledReasonElement = (Hl7.Fhir.Model.FhirString)value; + CancelledReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "creation": - CreationElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreationElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "period": - Period = (Hl7.Fhir.Model.DataType)value; + Period = (Hl7.Fhir.Model.DataType?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "account": - Account = (Hl7.Fhir.Model.ResourceReference)value; + Account = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lineItem": - LineItem = (List)value; + LineItem = (List?)value!; return this; case "totalPriceComponent": - TotalPriceComponent = (List)value; + TotalPriceComponent = (List?)value!; return this; case "totalNet": - TotalNet = (Hl7.Fhir.Model.Money)value; + TotalNet = (Hl7.Fhir.Model.Money?)value; return this; case "totalGross": - TotalGross = (Hl7.Fhir.Model.Money)value; + TotalGross = (Hl7.Fhir.Model.Money?)value; return this; case "paymentTerms": - PaymentTermsElement = (Hl7.Fhir.Model.Markdown)value; + PaymentTermsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -943,24 +916,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CancelledReasonElement is not null) yield return new KeyValuePair("cancelledReason",CancelledReasonElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (CreationElement is not null) yield return new KeyValuePair("creation",CreationElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); - if (Account is not null) yield return new KeyValuePair("account",Account); - if (LineItem?.Any() == true) yield return new KeyValuePair("lineItem",LineItem); - if (TotalPriceComponent?.Any() == true) yield return new KeyValuePair("totalPriceComponent",TotalPriceComponent); - if (TotalNet is not null) yield return new KeyValuePair("totalNet",TotalNet); - if (TotalGross is not null) yield return new KeyValuePair("totalGross",TotalGross); - if (PaymentTermsElement is not null) yield return new KeyValuePair("paymentTerms",PaymentTermsElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CancelledReasonElement is not null) yield return new KeyValuePair("cancelledReason",_CancelledReasonElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_CreationElement is not null) yield return new KeyValuePair("creation",_CreationElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); + if (_Account is not null) yield return new KeyValuePair("account",_Account); + if (_LineItem?.Any() == true) yield return new KeyValuePair("lineItem",_LineItem); + if (_TotalPriceComponent?.Any() == true) yield return new KeyValuePair("totalPriceComponent",_TotalPriceComponent); + if (_TotalNet is not null) yield return new KeyValuePair("totalNet",_TotalNet); + if (_TotalGross is not null) yield return new KeyValuePair("totalGross",_TotalGross); + if (_PaymentTermsElement is not null) yield return new KeyValuePair("paymentTerms",_PaymentTermsElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Library.cs b/src/Hl7.Fhir.R5/Model/Generated/Library.cs index 4742d28f5..f7a11994c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Library.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class Library : Hl7.Fhir.Model.DomainResource, IIdentifiable [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this library, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -98,39 +98,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the library. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -142,41 +139,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this library (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this library (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -186,28 +180,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this library (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -217,28 +208,25 @@ public string Title /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -251,13 +239,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -266,13 +254,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -282,13 +267,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -297,13 +282,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -315,13 +297,13 @@ public bool? Experimental [Binding("LibraryType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Type of individual the library content is focused on. @@ -332,41 +314,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -376,28 +355,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=210, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -410,39 +386,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the library. /// [FhirElement("description", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -455,11 +428,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for library (if applicable). @@ -470,39 +443,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this library is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this library is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -512,28 +482,25 @@ public string Purpose /// [FhirElement("usage", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown UsageElement + public Hl7.Fhir.Model.Markdown? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.Markdown _UsageElement; + private Hl7.Fhir.Model.Markdown? _UsageElement; /// /// Describes the clinical usage of the library /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.Markdown(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Usage"); } } @@ -543,28 +510,25 @@ public string Usage /// [FhirElement("copyright", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -574,28 +538,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -605,28 +566,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the library was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -636,28 +594,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=310)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the library was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -667,13 +622,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=320)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -684,11 +639,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -698,11 +653,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -712,11 +667,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -726,11 +681,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -740,11 +695,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -754,11 +709,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Parameters defined by the library. @@ -768,11 +723,11 @@ public List RelatedArtifact [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// What data is referenced by this library. @@ -782,11 +737,11 @@ public List Parameter [DataMember] public List DataRequirement { - get { if(_DataRequirement==null) _DataRequirement = new List(); return _DataRequirement; } + get => _DataRequirement ?? new List(); set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } - private List _DataRequirement; + private List? _DataRequirement; /// /// Contents of the library, either embedded or referenced. @@ -796,57 +751,53 @@ public List DataRequirement [DataMember] public List Content { - get { if(_Content==null) _Content = new List(); return _Content; } + get => _Content ?? new List(); set { _Content = value; OnPropertyChanged("Content"); } } - private List _Content; + private List? _Content; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Library; - - if (dest == null) - { + if(other is not Library dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(DataRequirement.Any()) dest.DataRequirement = new List(DataRequirement.DeepCopyInternal()); - if(Content.Any()) dest.Content = new List(Content.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_DataRequirement is not null) dest.DataRequirement = new List(_DataRequirement.DeepCopyInternal()); + if(_Content is not null) dest.Content = new List(_Content.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -858,258 +809,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Library; - if(otherT == null) return false; + if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(DataRequirement, otherT.DataRequirement)) return false; - if(!comparer.ListEquals(Content, otherT.Content)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; + if(!comparer.ListEquals(_Content, otherT._Content)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "dataRequirement": - value = DataRequirement; - return DataRequirement?.Any() == true; + value = _DataRequirement; + return _DataRequirement?.Any() == true; case "content": - value = Content; - return Content?.Any() == true; + value = _Content; + return _Content?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.Markdown)value; + UsageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "dataRequirement": - DataRequirement = (List)value; + DataRequirement = (List?)value!; return this; case "content": - Content = (List)value; + Content = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1120,39 +1071,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",DataRequirement); - if (Content?.Any() == true) yield return new KeyValuePair("content",Content); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_DataRequirement?.Any() == true) yield return new KeyValuePair("dataRequirement",_DataRequirement); + if (_Content?.Any() == true) yield return new KeyValuePair("content",_Content); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs index 4ea4e5bb4..c574df6b5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -111,13 +114,13 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [Binding("LinkageType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// source | alternate | historical @@ -126,13 +129,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Linkage.LinkageType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -145,26 +145,22 @@ public Hl7.Fhir.Model.Linkage.LinkageType? Type [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -176,41 +172,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -221,8 +217,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -232,13 +228,13 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("active", InSummary=true, Order=90, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this linkage assertion is active or not @@ -247,13 +243,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -265,13 +258,13 @@ public bool? Active [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Item to be linked. @@ -281,25 +274,21 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as Linkage; - - if (dest == null) - { + if(other is not Linkage dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -311,48 +300,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Linkage; - if(otherT == null) return false; + if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -363,9 +352,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/List.cs b/src/Hl7.Fhir.R5/Model/Generated/List.cs index 07d4a544f..71034752b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/List.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,26 +113,26 @@ public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("flag", Order=40)] [Binding("ListItemFlag")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Flag + public Hl7.Fhir.Model.CodeableConcept? Flag { get { return _Flag; } set { _Flag = value; OnPropertyChanged("Flag"); } } - private Hl7.Fhir.Model.CodeableConcept _Flag; + private Hl7.Fhir.Model.CodeableConcept? _Flag; /// /// If this item is actually marked as deleted. /// [FhirElement("deleted", IsModifier=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DeletedElement + public Hl7.Fhir.Model.FhirBoolean? DeletedElement { get { return _DeletedElement; } set { _DeletedElement = value; OnPropertyChanged("DeletedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DeletedElement; + private Hl7.Fhir.Model.FhirBoolean? _DeletedElement; /// /// If this item is actually marked as deleted @@ -138,13 +141,10 @@ public Hl7.Fhir.Model.FhirBoolean DeletedElement [IgnoreDataMember] public bool? Deleted { - get { return DeletedElement != null ? DeletedElement.Value : null; } + get => _DeletedElement?.Value; set { - if (value == null) - DeletedElement = null; - else - DeletedElement = new Hl7.Fhir.Model.FhirBoolean(value); + DeletedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Deleted"); } } @@ -154,28 +154,25 @@ public bool? Deleted /// [FhirElement("date", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When item added to list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -188,28 +185,24 @@ public string Date [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Item + public Hl7.Fhir.Model.ResourceReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.ResourceReference _Item; + private Hl7.Fhir.Model.ResourceReference? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as EntryComponent; - - if (dest == null) - { + if(other is not EntryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Flag != null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)Flag.DeepCopyInternal(); - if(DeletedElement != null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)DeletedElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.ResourceReference)Item.DeepCopyInternal(); + if(_Flag is not null) dest.Flag = (Hl7.Fhir.Model.CodeableConcept)_Flag.DeepCopyInternal(); + if(_DeletedElement is not null) dest.DeletedElement = (Hl7.Fhir.Model.FhirBoolean)_DeletedElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.ResourceReference)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -221,55 +214,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntryComponent; - if(otherT == null) return false; + if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Flag, otherT.Flag)) return false; - if(!comparer.Equals(DeletedElement, otherT.DeletedElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "flag": - value = Flag; - return Flag is not null; + value = _Flag; + return _Flag is not null; case "deleted": - value = DeletedElement; - return DeletedElement is not null; + value = _DeletedElement; + return _DeletedElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "flag": - Flag = (Hl7.Fhir.Model.CodeableConcept)value; + Flag = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "deleted": - DeletedElement = (Hl7.Fhir.Model.FhirBoolean)value; + DeletedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "item": - Item = (Hl7.Fhir.Model.ResourceReference)value; + Item = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -280,10 +273,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Flag is not null) yield return new KeyValuePair("flag",Flag); - if (DeletedElement is not null) yield return new KeyValuePair("deleted",DeletedElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Flag is not null) yield return new KeyValuePair("flag",_Flag); + if (_DeletedElement is not null) yield return new KeyValuePair("deleted",_DeletedElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -296,11 +289,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// current | retired | entered-in-error. @@ -310,13 +303,13 @@ public List Identifier [Binding("ListStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// current | retired | entered-in-error @@ -325,13 +318,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.List.ListStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -344,13 +334,13 @@ public Hl7.Fhir.Model.List.ListStatus? Status [Binding("ListMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// working | snapshot | changes @@ -359,13 +349,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.ListMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -375,28 +362,25 @@ public Hl7.Fhir.Model.ListMode? Mode /// [FhirElement("title", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Descriptive name for the list /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -407,13 +391,13 @@ public string Title [FhirElement("code", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [Binding("ListPurpose")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// If all resources have the same subject(s). @@ -425,11 +409,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Context in which list created. @@ -438,41 +422,38 @@ public List Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the list was prepared. /// [FhirElement("date", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the list was prepared /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -484,13 +465,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","Device","Organization","RelatedPerson","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// What order the list has. @@ -498,13 +479,13 @@ public Hl7.Fhir.Model.ResourceReference Source [FhirElement("orderedBy", Order=180)] [Binding("ListOrder")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrderedBy + public Hl7.Fhir.Model.CodeableConcept? OrderedBy { get { return _OrderedBy; } set { _OrderedBy = value; OnPropertyChanged("OrderedBy"); } } - private Hl7.Fhir.Model.CodeableConcept _OrderedBy; + private Hl7.Fhir.Model.CodeableConcept? _OrderedBy; /// /// Comments about the list. @@ -514,11 +495,11 @@ public Hl7.Fhir.Model.CodeableConcept OrderedBy [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Entries in the list. @@ -528,11 +509,11 @@ public List Note [DataMember] public List Entry { - get { if(_Entry==null) _Entry = new List(); return _Entry; } + get => _Entry ?? new List(); set { _Entry = value; OnPropertyChanged("Entry"); } } - private List _Entry; + private List? _Entry; /// /// Why list is empty. @@ -540,39 +521,35 @@ public List Entry [FhirElement("emptyReason", Order=210)] [Binding("ListEmptyReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept EmptyReason + public Hl7.Fhir.Model.CodeableConcept? EmptyReason { get { return _EmptyReason; } set { _EmptyReason = value; OnPropertyChanged("EmptyReason"); } } - private Hl7.Fhir.Model.CodeableConcept _EmptyReason; + private Hl7.Fhir.Model.CodeableConcept? _EmptyReason; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as List; - - if (dest == null) - { + if(other is not List dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(OrderedBy != null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)OrderedBy.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Entry.Any()) dest.Entry = new List(Entry.DeepCopyInternal()); - if(EmptyReason != null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)EmptyReason.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_OrderedBy is not null) dest.OrderedBy = (Hl7.Fhir.Model.CodeableConcept)_OrderedBy.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Entry is not null) dest.Entry = new List(_Entry.DeepCopyInternal()); + if(_EmptyReason is not null) dest.EmptyReason = (Hl7.Fhir.Model.CodeableConcept)_EmptyReason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -584,118 +561,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as List; - if(otherT == null) return false; + if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(OrderedBy, otherT.OrderedBy)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Entry, otherT.Entry)) return false; - if(!comparer.Equals(EmptyReason, otherT.EmptyReason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_OrderedBy, otherT._OrderedBy)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; + if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "orderedBy": - value = OrderedBy; - return OrderedBy is not null; + value = _OrderedBy; + return _OrderedBy is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "entry": - value = Entry; - return Entry?.Any() == true; + value = _Entry; + return _Entry?.Any() == true; case "emptyReason": - value = EmptyReason; - return EmptyReason is not null; + value = _EmptyReason; + return _EmptyReason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "orderedBy": - OrderedBy = (Hl7.Fhir.Model.CodeableConcept)value; + OrderedBy = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "entry": - Entry = (List)value; + Entry = (List?)value!; return this; case "emptyReason": - EmptyReason = (Hl7.Fhir.Model.CodeableConcept)value; + EmptyReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -706,19 +683,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (OrderedBy is not null) yield return new KeyValuePair("orderedBy",OrderedBy); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Entry?.Any() == true) yield return new KeyValuePair("entry",Entry); - if (EmptyReason is not null) yield return new KeyValuePair("emptyReason",EmptyReason); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_OrderedBy is not null) yield return new KeyValuePair("orderedBy",_OrderedBy); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Entry?.Any() == true) yield return new KeyValuePair("entry",_Entry); + if (_EmptyReason is not null) yield return new KeyValuePair("emptyReason",_EmptyReason); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Location.cs b/src/Hl7.Fhir.R5/Model/Generated/Location.cs index 1cd9ad9a6..8f224dcc4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Location.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -132,13 +135,13 @@ public partial class PositionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("longitude", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LongitudeElement + public Hl7.Fhir.Model.FhirDecimal? LongitudeElement { get { return _LongitudeElement; } set { _LongitudeElement = value; OnPropertyChanged("LongitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LongitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LongitudeElement; /// /// Longitude with WGS84 datum @@ -147,13 +150,10 @@ public Hl7.Fhir.Model.FhirDecimal LongitudeElement [IgnoreDataMember] public decimal? Longitude { - get { return LongitudeElement != null ? LongitudeElement.Value : null; } + get => _LongitudeElement?.Value; set { - if (value == null) - LongitudeElement = null; - else - LongitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LongitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Longitude"); } } @@ -164,13 +164,13 @@ public decimal? Longitude [FhirElement("latitude", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LatitudeElement + public Hl7.Fhir.Model.FhirDecimal? LatitudeElement { get { return _LatitudeElement; } set { _LatitudeElement = value; OnPropertyChanged("LatitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LatitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _LatitudeElement; /// /// Latitude with WGS84 datum @@ -179,13 +179,10 @@ public Hl7.Fhir.Model.FhirDecimal LatitudeElement [IgnoreDataMember] public decimal? Latitude { - get { return LatitudeElement != null ? LatitudeElement.Value : null; } + get => _LatitudeElement?.Value; set { - if (value == null) - LatitudeElement = null; - else - LatitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + LatitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Latitude"); } } @@ -195,13 +192,13 @@ public decimal? Latitude /// [FhirElement("altitude", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AltitudeElement + public Hl7.Fhir.Model.FhirDecimal? AltitudeElement { get { return _AltitudeElement; } set { _AltitudeElement = value; OnPropertyChanged("AltitudeElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AltitudeElement; + private Hl7.Fhir.Model.FhirDecimal? _AltitudeElement; /// /// Altitude with WGS84 datum @@ -210,30 +207,23 @@ public Hl7.Fhir.Model.FhirDecimal AltitudeElement [IgnoreDataMember] public decimal? Altitude { - get { return AltitudeElement != null ? AltitudeElement.Value : null; } + get => _AltitudeElement?.Value; set { - if (value == null) - AltitudeElement = null; - else - AltitudeElement = new Hl7.Fhir.Model.FhirDecimal(value); + AltitudeElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Altitude"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PositionComponent; - - if (dest == null) - { + if(other is not PositionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LongitudeElement != null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)LongitudeElement.DeepCopyInternal(); - if(LatitudeElement != null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)LatitudeElement.DeepCopyInternal(); - if(AltitudeElement != null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)AltitudeElement.DeepCopyInternal(); + if(_LongitudeElement is not null) dest.LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LongitudeElement.DeepCopyInternal(); + if(_LatitudeElement is not null) dest.LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)_LatitudeElement.DeepCopyInternal(); + if(_AltitudeElement is not null) dest.AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)_AltitudeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -245,48 +235,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PositionComponent; - if(otherT == null) return false; + if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LongitudeElement, otherT.LongitudeElement)) return false; - if(!comparer.Equals(LatitudeElement, otherT.LatitudeElement)) return false; - if(!comparer.Equals(AltitudeElement, otherT.AltitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; + if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "longitude": - value = LongitudeElement; - return LongitudeElement is not null; + value = _LongitudeElement; + return _LongitudeElement is not null; case "latitude": - value = LatitudeElement; - return LatitudeElement is not null; + value = _LatitudeElement; + return _LatitudeElement is not null; case "altitude": - value = AltitudeElement; - return AltitudeElement is not null; + value = _AltitudeElement; + return _AltitudeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "longitude": - LongitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LongitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "latitude": - LatitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + LatitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "altitude": - AltitudeElement = (Hl7.Fhir.Model.FhirDecimal)value; + AltitudeElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; default: return base.SetValue(key, value); @@ -297,9 +287,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LongitudeElement is not null) yield return new KeyValuePair("longitude",LongitudeElement); - if (LatitudeElement is not null) yield return new KeyValuePair("latitude",LatitudeElement); - if (AltitudeElement is not null) yield return new KeyValuePair("altitude",AltitudeElement); + if (_LongitudeElement is not null) yield return new KeyValuePair("longitude",_LongitudeElement); + if (_LatitudeElement is not null) yield return new KeyValuePair("latitude",_LatitudeElement); + if (_AltitudeElement is not null) yield return new KeyValuePair("altitude",_AltitudeElement); } } @@ -312,11 +302,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | suspended | inactive. @@ -325,13 +315,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("LocationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | suspended | inactive @@ -340,13 +330,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -357,41 +344,38 @@ public Hl7.Fhir.Model.Location.LocationStatus? Status [FhirElement("operationalStatus", InSummary=true, Order=110, FiveWs="FiveWs.status")] [Binding("OperationalStatus")] [DataMember] - public Hl7.Fhir.Model.Coding OperationalStatus + public Hl7.Fhir.Model.Coding? OperationalStatus { get { return _OperationalStatus; } set { _OperationalStatus = value; OnPropertyChanged("OperationalStatus"); } } - private Hl7.Fhir.Model.Coding _OperationalStatus; + private Hl7.Fhir.Model.Coding? _OperationalStatus; /// /// Name of the location as used by humans. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the location as used by humans /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -404,24 +388,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the location is known as, or was known as, in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -433,28 +417,25 @@ public IEnumerable Alias /// [FhirElement("description", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Additional details about the location that could be displayed as further information to identify the location beyond its name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -466,13 +447,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("LocationMode")] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// instance | kind @@ -481,13 +462,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.Location.LocationMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -501,11 +479,11 @@ public Hl7.Fhir.Model.Location.LocationMode? Mode [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Official contact details for the location. @@ -515,24 +493,24 @@ public List Type [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Physical location. /// [FhirElement("address", Order=180)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// Physical form of the location. @@ -540,26 +518,26 @@ public Hl7.Fhir.Model.Address Address [FhirElement("form", InSummary=true, Order=190, FiveWs="FiveWs.class")] [Binding("LocationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// The absolute geographic location. /// [FhirElement("position", Order=200)] [DataMember] - public Hl7.Fhir.Model.Location.PositionComponent Position + public Hl7.Fhir.Model.Location.PositionComponent? Position { get { return _Position; } set { _Position = value; OnPropertyChanged("Position"); } } - private Hl7.Fhir.Model.Location.PositionComponent _Position; + private Hl7.Fhir.Model.Location.PositionComponent? _Position; /// /// Organization responsible for provisioning and upkeep. @@ -568,13 +546,13 @@ public Hl7.Fhir.Model.Location.PositionComponent Position [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Another Location this one is physically a part of. @@ -583,13 +561,13 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// Collection of characteristics (attributes). @@ -600,11 +578,11 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// What days/times during a week is this location usually open (including exceptions). @@ -614,11 +592,11 @@ public List Characteristic [DataMember] public List HoursOfOperation { - get { if(_HoursOfOperation==null) _HoursOfOperation = new List(); return _HoursOfOperation; } + get => _HoursOfOperation ?? new List(); set { _HoursOfOperation = value; OnPropertyChanged("HoursOfOperation"); } } - private List _HoursOfOperation; + private List? _HoursOfOperation; /// /// Connection details of a virtual service (e.g. conference call). @@ -628,11 +606,11 @@ public List HoursOfOperation [DataMember] public List VirtualService { - get { if(_VirtualService==null) _VirtualService = new List(); return _VirtualService; } + get => _VirtualService ?? new List(); set { _VirtualService = value; OnPropertyChanged("VirtualService"); } } - private List _VirtualService; + private List? _VirtualService; /// /// Technical endpoints providing access to services operated for the location. @@ -644,42 +622,38 @@ public List VirtualService [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Location; - - if (dest == null) - { + if(other is not Location dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(OperationalStatus != null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)OperationalStatus.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(Position != null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)Position.DeepCopyInternal(); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(HoursOfOperation.Any()) dest.HoursOfOperation = new List(HoursOfOperation.DeepCopyInternal()); - if(VirtualService.Any()) dest.VirtualService = new List(VirtualService.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_OperationalStatus is not null) dest.OperationalStatus = (Hl7.Fhir.Model.Coding)_OperationalStatus.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_Position is not null) dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)_Position.DeepCopyInternal(); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_HoursOfOperation is not null) dest.HoursOfOperation = new List(_HoursOfOperation.DeepCopyInternal()); + if(_VirtualService is not null) dest.VirtualService = new List(_VirtualService.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -691,153 +665,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Location; - if(otherT == null) return false; + if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(OperationalStatus, otherT.OperationalStatus)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.Equals(Position, otherT.Position)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(HoursOfOperation, otherT.HoursOfOperation)) return false; - if(!comparer.ListEquals(VirtualService, otherT.VirtualService)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.Equals(_Position, otherT._Position)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_HoursOfOperation, otherT._HoursOfOperation)) return false; + if(!comparer.ListEquals(_VirtualService, otherT._VirtualService)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "operationalStatus": - value = OperationalStatus; - return OperationalStatus is not null; + value = _OperationalStatus; + return _OperationalStatus is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "position": - value = Position; - return Position is not null; + value = _Position; + return _Position is not null; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "hoursOfOperation": - value = HoursOfOperation; - return HoursOfOperation?.Any() == true; + value = _HoursOfOperation; + return _HoursOfOperation?.Any() == true; case "virtualService": - value = VirtualService; - return VirtualService?.Any() == true; + value = _VirtualService; + return _VirtualService?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "operationalStatus": - OperationalStatus = (Hl7.Fhir.Model.Coding)value; + OperationalStatus = (Hl7.Fhir.Model.Coding?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "position": - Position = (Hl7.Fhir.Model.Location.PositionComponent)value; + Position = (Hl7.Fhir.Model.Location.PositionComponent?)value; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "hoursOfOperation": - HoursOfOperation = (List)value; + HoursOfOperation = (List?)value!; return this; case "virtualService": - VirtualService = (List)value; + VirtualService = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -848,24 +822,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",OperationalStatus); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (Position is not null) yield return new KeyValuePair("position",Position); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (HoursOfOperation?.Any() == true) yield return new KeyValuePair("hoursOfOperation",HoursOfOperation); - if (VirtualService?.Any() == true) yield return new KeyValuePair("virtualService",VirtualService); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_OperationalStatus is not null) yield return new KeyValuePair("operationalStatus",_OperationalStatus); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_Position is not null) yield return new KeyValuePair("position",_Position); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_HoursOfOperation?.Any() == true) yield return new KeyValuePair("hoursOfOperation",_HoursOfOperation); + if (_VirtualService?.Any() == true) yield return new KeyValuePair("virtualService",_VirtualService); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs index 4320007e9..7d0141bf8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -76,13 +79,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTCharacteristicCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -92,26 +95,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Binary")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -123,41 +122,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -168,8 +167,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -193,13 +192,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The function of this component within the item e.g. delivers active ingredient, masks taste. @@ -209,11 +208,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Function { - get { if(_Function==null) _Function = new List(); return _Function; } + get => _Function ?? new List(); set { _Function = value; OnPropertyChanged("Function"); } } - private List _Function; + private List? _Function; /// /// The measurable amount of total quantity of all substances in the component, expressable in different ways (e.g. by mass or volume). @@ -223,11 +222,11 @@ public List Function [DataMember] public List Amount { - get { if(_Amount==null) _Amount = new List(); return _Amount; } + get => _Amount ?? new List(); set { _Amount = value; OnPropertyChanged("Amount"); } } - private List _Amount; + private List? _Amount; /// /// A reference to a constituent of the manufactured item as a whole, linked here so that its component location within the item can be indicated. This not where the item's ingredient are primarily stated (for which see Ingredient.for or ManufacturedItemDefinition.ingredient). @@ -237,11 +236,11 @@ public List Amount [DataMember] public List Constituent { - get { if(_Constituent==null) _Constituent = new List(); return _Constituent; } + get => _Constituent ?? new List(); set { _Constituent = value; OnPropertyChanged("Constituent"); } } - private List _Constituent; + private List? _Constituent; /// /// General characteristics of this component. @@ -251,11 +250,11 @@ public List Cons [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// A component that this component contains or is made from. @@ -265,28 +264,24 @@ public List Propert [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Function.Any()) dest.Function = new List(Function.DeepCopyInternal()); - if(Amount.Any()) dest.Amount = new List(Amount.DeepCopyInternal()); - if(Constituent.Any()) dest.Constituent = new List(Constituent.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Function is not null) dest.Function = new List(_Function.DeepCopyInternal()); + if(_Amount is not null) dest.Amount = new List(_Amount.DeepCopyInternal()); + if(_Constituent is not null) dest.Constituent = new List(_Constituent.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -298,69 +293,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Function, otherT.Function)) return false; - if(!comparer.ListEquals(Amount, otherT.Amount)) return false; - if(!comparer.ListEquals(Constituent, otherT.Constituent)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Function, otherT._Function)) return false; + if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; + if(!comparer.ListEquals(_Constituent, otherT._Constituent)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "function": - value = Function; - return Function?.Any() == true; + value = _Function; + return _Function?.Any() == true; case "amount": - value = Amount; - return Amount?.Any() == true; + value = _Amount; + return _Amount?.Any() == true; case "constituent": - value = Constituent; - return Constituent?.Any() == true; + value = _Constituent; + return _Constituent?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "function": - Function = (List)value; + Function = (List?)value!; return this; case "amount": - Amount = (List)value; + Amount = (List?)value!; return this; case "constituent": - Constituent = (List)value; + Constituent = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -371,12 +366,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Function?.Any() == true) yield return new KeyValuePair("function",Function); - if (Amount?.Any() == true) yield return new KeyValuePair("amount",Amount); - if (Constituent?.Any() == true) yield return new KeyValuePair("constituent",Constituent); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Function?.Any() == true) yield return new KeyValuePair("function",_Function); + if (_Amount?.Any() == true) yield return new KeyValuePair("amount",_Amount); + if (_Constituent?.Any() == true) yield return new KeyValuePair("constituent",_Constituent); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } @@ -402,11 +397,11 @@ public partial class ConstituentComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Amount { - get { if(_Amount==null) _Amount = new List(); return _Amount; } + get => _Amount ?? new List(); set { _Amount = value; OnPropertyChanged("Amount"); } } - private List _Amount; + private List? _Amount; /// /// The physical location of the constituent/ingredient within the component. @@ -416,11 +411,11 @@ public List Amount [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// The function of this constituent within the component e.g. binder. @@ -430,11 +425,11 @@ public List Location [DataMember] public List Function { - get { if(_Function==null) _Function = new List(); return _Function; } + get => _Function ?? new List(); set { _Function = value; OnPropertyChanged("Function"); } } - private List _Function; + private List? _Function; /// /// The ingredient that is the constituent of the given component. @@ -444,26 +439,22 @@ public List Function [DataMember] public List HasIngredient { - get { if(_HasIngredient==null) _HasIngredient = new List(); return _HasIngredient; } + get => _HasIngredient ?? new List(); set { _HasIngredient = value; OnPropertyChanged("HasIngredient"); } } - private List _HasIngredient; + private List? _HasIngredient; protected internal override void CopyToInternal(Base other) { - var dest = other as ConstituentComponent; - - if (dest == null) - { + if(other is not ConstituentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Amount.Any()) dest.Amount = new List(Amount.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(Function.Any()) dest.Function = new List(Function.DeepCopyInternal()); - if(HasIngredient.Any()) dest.HasIngredient = new List(HasIngredient.DeepCopyInternal()); + if(_Amount is not null) dest.Amount = new List(_Amount.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_Function is not null) dest.Function = new List(_Function.DeepCopyInternal()); + if(_HasIngredient is not null) dest.HasIngredient = new List(_HasIngredient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -475,55 +466,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConstituentComponent; - if(otherT == null) return false; + if(other is not ConstituentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Amount, otherT.Amount)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Function, otherT.Function)) return false; - if(!comparer.ListEquals(HasIngredient, otherT.HasIngredient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Function, otherT._Function)) return false; + if(!comparer.ListEquals(_HasIngredient, otherT._HasIngredient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "amount": - value = Amount; - return Amount?.Any() == true; + value = _Amount; + return _Amount?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "function": - value = Function; - return Function?.Any() == true; + value = _Function; + return _Function?.Any() == true; case "hasIngredient": - value = HasIngredient; - return HasIngredient?.Any() == true; + value = _HasIngredient; + return _HasIngredient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "amount": - Amount = (List)value; + Amount = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "function": - Function = (List)value; + Function = (List?)value!; return this; case "hasIngredient": - HasIngredient = (List)value; + HasIngredient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -534,10 +525,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Amount?.Any() == true) yield return new KeyValuePair("amount",Amount); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (Function?.Any() == true) yield return new KeyValuePair("function",Function); - if (HasIngredient?.Any() == true) yield return new KeyValuePair("hasIngredient",HasIngredient); + if (_Amount?.Any() == true) yield return new KeyValuePair("amount",_Amount); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_Function?.Any() == true) yield return new KeyValuePair("function",_Function); + if (_HasIngredient?.Any() == true) yield return new KeyValuePair("hasIngredient",_HasIngredient); } } @@ -550,11 +541,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -564,13 +555,13 @@ public List Identifier [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -579,13 +570,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -595,28 +583,25 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("name", InSummary=true, Order=110, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A descriptive name applied to this item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -628,13 +613,13 @@ public string Name [Binding("ManufacturedDoseForm")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ManufacturedDoseForm + public Hl7.Fhir.Model.CodeableConcept? ManufacturedDoseForm { get { return _ManufacturedDoseForm; } set { _ManufacturedDoseForm = value; OnPropertyChanged("ManufacturedDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _ManufacturedDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _ManufacturedDoseForm; /// /// The “real-world” units in which the quantity of the item is described. @@ -642,13 +627,13 @@ public Hl7.Fhir.Model.CodeableConcept ManufacturedDoseForm [FhirElement("unitOfPresentation", InSummary=true, Order=130)] [Binding("UnitOfPresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation + public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation { get { return _UnitOfPresentation; } set { _UnitOfPresentation = value; OnPropertyChanged("UnitOfPresentation"); } } - private Hl7.Fhir.Model.CodeableConcept _UnitOfPresentation; + private Hl7.Fhir.Model.CodeableConcept? _UnitOfPresentation; /// /// Manufacturer of the item, one of several possible. @@ -660,11 +645,11 @@ public Hl7.Fhir.Model.CodeableConcept UnitOfPresentation [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated. @@ -674,11 +659,11 @@ public List Manufacturer [DataMember] public List MarketingStatus { - get { if(_MarketingStatus==null) _MarketingStatus = new List(); return _MarketingStatus; } + get => _MarketingStatus ?? new List(); set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } - private List _MarketingStatus; + private List? _MarketingStatus; /// /// The ingredients of this manufactured item. Only needed if these are not specified by incoming references from the Ingredient resource. @@ -689,11 +674,11 @@ public List MarketingStatus [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// General characteristics of this item. @@ -703,11 +688,11 @@ public List Ingredient [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// Physical parts of the manufactured item, that it is intrisically made from. This is distinct from the ingredients that are part of its chemical makeup. @@ -717,34 +702,30 @@ public List Propert [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ManufacturedItemDefinition; - - if (dest == null) - { + if(other is not ManufacturedItemDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ManufacturedDoseForm != null) dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)ManufacturedDoseForm.DeepCopyInternal(); - if(UnitOfPresentation != null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)UnitOfPresentation.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(MarketingStatus.Any()) dest.MarketingStatus = new List(MarketingStatus.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ManufacturedDoseForm is not null) dest.ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)_ManufacturedDoseForm.DeepCopyInternal(); + if(_UnitOfPresentation is not null) dest.UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)_UnitOfPresentation.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_MarketingStatus is not null) dest.MarketingStatus = new List(_MarketingStatus.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -756,97 +737,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ManufacturedItemDefinition; - if(otherT == null) return false; + if(other is not ManufacturedItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ManufacturedDoseForm, otherT.ManufacturedDoseForm)) return false; - if(!comparer.Equals(UnitOfPresentation, otherT.UnitOfPresentation)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(MarketingStatus, otherT.MarketingStatus)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ManufacturedDoseForm, otherT._ManufacturedDoseForm)) return false; + if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_MarketingStatus, otherT._MarketingStatus)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "manufacturedDoseForm": - value = ManufacturedDoseForm; - return ManufacturedDoseForm is not null; + value = _ManufacturedDoseForm; + return _ManufacturedDoseForm is not null; case "unitOfPresentation": - value = UnitOfPresentation; - return UnitOfPresentation is not null; + value = _UnitOfPresentation; + return _UnitOfPresentation is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "marketingStatus": - value = MarketingStatus; - return MarketingStatus?.Any() == true; + value = _MarketingStatus; + return _MarketingStatus?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "manufacturedDoseForm": - ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + ManufacturedDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "unitOfPresentation": - UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept)value; + UnitOfPresentation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "marketingStatus": - MarketingStatus = (List)value; + MarketingStatus = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -857,16 +838,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ManufacturedDoseForm is not null) yield return new KeyValuePair("manufacturedDoseForm",ManufacturedDoseForm); - if (UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",UnitOfPresentation); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",MarketingStatus); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ManufacturedDoseForm is not null) yield return new KeyValuePair("manufacturedDoseForm",_ManufacturedDoseForm); + if (_UnitOfPresentation is not null) yield return new KeyValuePair("unitOfPresentation",_UnitOfPresentation); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",_MarketingStatus); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs b/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs index a5b2bee82..4f3b8c2bb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,26 +64,26 @@ public partial class MarketingStatus : Hl7.Fhir.Model.BackboneType /// [FhirElement("country", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Country + public Hl7.Fhir.Model.CodeableConcept? Country { get { return _Country; } set { _Country = value; OnPropertyChanged("Country"); } } - private Hl7.Fhir.Model.CodeableConcept _Country; + private Hl7.Fhir.Model.CodeableConcept? _Country; /// /// Where a Medicines Regulatory Agency has granted a marketing authorization for which specific provisions within a jurisdiction apply, the jurisdiction can be specified using an appropriate controlled terminology The controlled term and the controlled term identifier shall be specified. /// [FhirElement("jurisdiction", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; /// /// This attribute provides information on the status of the marketing of the medicinal product See ISO/TS 20443 for more information and examples. @@ -88,73 +91,66 @@ public Hl7.Fhir.Model.CodeableConcept Jurisdiction [FhirElement("status", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorization Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. /// [FhirElement("dateRange", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Period DateRange + public Hl7.Fhir.Model.Period? DateRange { get { return _DateRange; } set { _DateRange = value; OnPropertyChanged("DateRange"); } } - private Hl7.Fhir.Model.Period _DateRange; + private Hl7.Fhir.Model.Period? _DateRange; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorization Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain. /// [FhirElement("restoreDate", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RestoreDateElement + public Hl7.Fhir.Model.FhirDateTime? RestoreDateElement { get { return _RestoreDateElement; } set { _RestoreDateElement = value; OnPropertyChanged("RestoreDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RestoreDateElement; + private Hl7.Fhir.Model.FhirDateTime? _RestoreDateElement; /// /// The date when the Medicinal Product is placed on the market by the Marketing Authorization Holder (or where applicable, the manufacturer/distributor) in a country and/or jurisdiction shall be provided A complete date consisting of day, month and year shall be specified using the ISO 8601 date format NOTE “Placed on the market” refers to the release of the Medicinal Product into the distribution chain /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RestoreDate + public string? RestoreDate { - get { return RestoreDateElement != null ? RestoreDateElement.Value : null; } + get => _RestoreDateElement?.Value; set { - if (value == null) - RestoreDateElement = null; - else - RestoreDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + RestoreDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("RestoreDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MarketingStatus; - - if (dest == null) - { + if(other is not MarketingStatus dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Country != null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)Country.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(DateRange != null) dest.DateRange = (Hl7.Fhir.Model.Period)DateRange.DeepCopyInternal(); - if(RestoreDateElement != null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)RestoreDateElement.DeepCopyInternal(); + if(_Country is not null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)_Country.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_DateRange is not null) dest.DateRange = (Hl7.Fhir.Model.Period)_DateRange.DeepCopyInternal(); + if(_RestoreDateElement is not null) dest.RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)_RestoreDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -166,62 +162,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MarketingStatus; - if(otherT == null) return false; + if(other is not MarketingStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Country, otherT.Country)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(DateRange, otherT.DateRange)) return false; - if(!comparer.Equals(RestoreDateElement, otherT.RestoreDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_DateRange, otherT._DateRange)) return false; + if(!comparer.Equals(_RestoreDateElement, otherT._RestoreDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "country": - value = Country; - return Country is not null; + value = _Country; + return _Country is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "dateRange": - value = DateRange; - return DateRange is not null; + value = _DateRange; + return _DateRange is not null; case "restoreDate": - value = RestoreDateElement; - return RestoreDateElement is not null; + value = _RestoreDateElement; + return _RestoreDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "country": - Country = (Hl7.Fhir.Model.CodeableConcept)value; + Country = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dateRange": - DateRange = (Hl7.Fhir.Model.Period)value; + DateRange = (Hl7.Fhir.Model.Period?)value; return this; case "restoreDate": - RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + RestoreDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -232,11 +228,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Country is not null) yield return new KeyValuePair("country",Country); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (DateRange is not null) yield return new KeyValuePair("dateRange",DateRange); - if (RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",RestoreDateElement); + if (_Country is not null) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_DateRange is not null) yield return new KeyValuePair("dateRange",_DateRange); + if (_RestoreDateElement is not null) yield return new KeyValuePair("restoreDate",_RestoreDateElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs index fce7cf26c..2801257e3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,57 +84,50 @@ public partial class TermComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Binding("DefinitionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Meaning of the term. /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DefinitionElement + public Hl7.Fhir.Model.Markdown? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Markdown _DefinitionElement; + private Hl7.Fhir.Model.Markdown? _DefinitionElement; /// /// Meaning of the term /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Markdown(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Definition"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TermComponent; - - if (dest == null) - { + if(other is not TermComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Markdown)DefinitionElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Markdown)_DefinitionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,41 +139,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TermComponent; - if(otherT == null) return false; + if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Markdown)value; + DefinitionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -188,8 +184,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); } } @@ -215,28 +211,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for group in measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -247,41 +240,38 @@ public string LinkId [FhirElement("code", Order=50)] [Binding("MeasureGroupExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Summary description. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Summary description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -295,11 +285,11 @@ public string Description [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// E.g. Patient, Practitioner, RelatedPerson, Organization, Location, Device. @@ -310,13 +300,13 @@ public List Type [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Population basis. @@ -325,13 +315,13 @@ public Hl7.Fhir.Model.DataType Subject [DeclaredType(Type = typeof(Code))] [Binding("BasisType")] [DataMember] - public Code BasisElement + public Code? BasisElement { get { return _BasisElement; } set { _BasisElement = value; OnPropertyChanged("BasisElement"); } } - private Code _BasisElement; + private Code? _BasisElement; /// /// Population basis @@ -340,13 +330,10 @@ public Code BasisElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Basis { - get { return BasisElement != null ? BasisElement.Value : null; } + get => _BasisElement?.Value; set { - if (value == null) - BasisElement = null; - else - BasisElement = new Code(value); + BasisElement = value is null ? null : new Code(value); OnPropertyChanged("Basis"); } } @@ -357,13 +344,13 @@ public Hl7.Fhir.Model.FHIRAllTypes? Basis [FhirElement("scoring", InSummary=true, Order=100)] [Binding("MeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; /// /// What units?. @@ -371,41 +358,38 @@ public Hl7.Fhir.Model.CodeableConcept Scoring [FhirElement("scoringUnit", InSummary=true, Order=110)] [Binding("MeasureScoringUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ScoringUnit + public Hl7.Fhir.Model.CodeableConcept? ScoringUnit { get { return _ScoringUnit; } set { _ScoringUnit = value; OnPropertyChanged("ScoringUnit"); } } - private Hl7.Fhir.Model.CodeableConcept _ScoringUnit; + private Hl7.Fhir.Model.CodeableConcept? _ScoringUnit; /// /// How is rate aggregation performed for this measure. /// [FhirElement("rateAggregation", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Markdown RateAggregationElement + public Hl7.Fhir.Model.Markdown? RateAggregationElement { get { return _RateAggregationElement; } set { _RateAggregationElement = value; OnPropertyChanged("RateAggregationElement"); } } - private Hl7.Fhir.Model.Markdown _RateAggregationElement; + private Hl7.Fhir.Model.Markdown? _RateAggregationElement; /// /// How is rate aggregation performed for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RateAggregation + public string? RateAggregation { - get { return RateAggregationElement != null ? RateAggregationElement.Value : null; } + get => _RateAggregationElement?.Value; set { - if (value == null) - RateAggregationElement = null; - else - RateAggregationElement = new Hl7.Fhir.Model.Markdown(value); + RateAggregationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("RateAggregation"); } } @@ -416,13 +400,13 @@ public string RateAggregation [FhirElement("improvementNotation", InSummary=true, Order=130)] [Binding("MeasureImprovementNotation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ImprovementNotation + public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation { get { return _ImprovementNotation; } set { _ImprovementNotation = value; OnPropertyChanged("ImprovementNotation"); } } - private Hl7.Fhir.Model.CodeableConcept _ImprovementNotation; + private Hl7.Fhir.Model.CodeableConcept? _ImprovementNotation; /// /// Logic used by the measure group. @@ -432,24 +416,24 @@ public Hl7.Fhir.Model.CodeableConcept ImprovementNotation [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the measure group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -464,11 +448,11 @@ public IEnumerable Library [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// Stratifier criteria for the measure. @@ -478,35 +462,31 @@ public List Population [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(BasisElement != null) dest.BasisElement = (Code)BasisElement.DeepCopyInternal(); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); - if(ScoringUnit != null) dest.ScoringUnit = (Hl7.Fhir.Model.CodeableConcept)ScoringUnit.DeepCopyInternal(); - if(RateAggregationElement != null) dest.RateAggregationElement = (Hl7.Fhir.Model.Markdown)RateAggregationElement.DeepCopyInternal(); - if(ImprovementNotation != null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)ImprovementNotation.DeepCopyInternal(); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_BasisElement is not null) dest.BasisElement = (Code)_BasisElement.DeepCopyInternal(); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); + if(_ScoringUnit is not null) dest.ScoringUnit = (Hl7.Fhir.Model.CodeableConcept)_ScoringUnit.DeepCopyInternal(); + if(_RateAggregationElement is not null) dest.RateAggregationElement = (Hl7.Fhir.Model.Markdown)_RateAggregationElement.DeepCopyInternal(); + if(_ImprovementNotation is not null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)_ImprovementNotation.DeepCopyInternal(); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -518,118 +498,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(BasisElement, otherT.BasisElement)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; - if(!comparer.Equals(ScoringUnit, otherT.ScoringUnit)) return false; - if(!comparer.Equals(RateAggregationElement, otherT.RateAggregationElement)) return false; - if(!comparer.Equals(ImprovementNotation, otherT.ImprovementNotation)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; + if(!comparer.Equals(_ScoringUnit, otherT._ScoringUnit)) return false; + if(!comparer.Equals(_RateAggregationElement, otherT._RateAggregationElement)) return false; + if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "basis": - value = BasisElement; - return BasisElement is not null; + value = _BasisElement; + return _BasisElement is not null; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; case "scoringUnit": - value = ScoringUnit; - return ScoringUnit is not null; + value = _ScoringUnit; + return _ScoringUnit is not null; case "rateAggregation": - value = RateAggregationElement; - return RateAggregationElement is not null; + value = _RateAggregationElement; + return _RateAggregationElement is not null; case "improvementNotation": - value = ImprovementNotation; - return ImprovementNotation is not null; + value = _ImprovementNotation; + return _ImprovementNotation is not null; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "basis": - BasisElement = (Code)value; + BasisElement = (Code?)value; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "scoringUnit": - ScoringUnit = (Hl7.Fhir.Model.CodeableConcept)value; + ScoringUnit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "rateAggregation": - RateAggregationElement = (Hl7.Fhir.Model.Markdown)value; + RateAggregationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "improvementNotation": - ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)value; + ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -640,19 +620,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (BasisElement is not null) yield return new KeyValuePair("basis",BasisElement); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); - if (ScoringUnit is not null) yield return new KeyValuePair("scoringUnit",ScoringUnit); - if (RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",RateAggregationElement); - if (ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotation); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_BasisElement is not null) yield return new KeyValuePair("basis",_BasisElement); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); + if (_ScoringUnit is not null) yield return new KeyValuePair("scoringUnit",_ScoringUnit); + if (_RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",_RateAggregationElement); + if (_ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotation); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -678,28 +658,25 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for population in measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -710,41 +687,38 @@ public string LinkId [FhirElement("code", Order=50)] [Binding("MeasurePopulationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this population criteria. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The human readable description of this population criteria /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -754,13 +728,13 @@ public string Description /// [FhirElement("criteria", Order=70)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; /// /// A group resource that defines this population. @@ -769,41 +743,38 @@ public Hl7.Fhir.Model.Expression Criteria [CLSCompliant(false)] [References("Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference GroupDefinition + public Hl7.Fhir.Model.ResourceReference? GroupDefinition { get { return _GroupDefinition; } set { _GroupDefinition = value; OnPropertyChanged("GroupDefinition"); } } - private Hl7.Fhir.Model.ResourceReference _GroupDefinition; + private Hl7.Fhir.Model.ResourceReference? _GroupDefinition; /// /// Which population. /// [FhirElement("inputPopulationId", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString InputPopulationIdElement + public Hl7.Fhir.Model.FhirString? InputPopulationIdElement { get { return _InputPopulationIdElement; } set { _InputPopulationIdElement = value; OnPropertyChanged("InputPopulationIdElement"); } } - private Hl7.Fhir.Model.FhirString _InputPopulationIdElement; + private Hl7.Fhir.Model.FhirString? _InputPopulationIdElement; /// /// Which population /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InputPopulationId + public string? InputPopulationId { - get { return InputPopulationIdElement != null ? InputPopulationIdElement.Value : null; } + get => _InputPopulationIdElement?.Value; set { - if (value == null) - InputPopulationIdElement = null; - else - InputPopulationIdElement = new Hl7.Fhir.Model.FhirString(value); + InputPopulationIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("InputPopulationId"); } } @@ -814,31 +785,27 @@ public string InputPopulationId [FhirElement("aggregateMethod", Order=100)] [Binding("MeasureAggregateMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AggregateMethod + public Hl7.Fhir.Model.CodeableConcept? AggregateMethod { get { return _AggregateMethod; } set { _AggregateMethod = value; OnPropertyChanged("AggregateMethod"); } } - private Hl7.Fhir.Model.CodeableConcept _AggregateMethod; + private Hl7.Fhir.Model.CodeableConcept? _AggregateMethod; protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); - if(GroupDefinition != null) dest.GroupDefinition = (Hl7.Fhir.Model.ResourceReference)GroupDefinition.DeepCopyInternal(); - if(InputPopulationIdElement != null) dest.InputPopulationIdElement = (Hl7.Fhir.Model.FhirString)InputPopulationIdElement.DeepCopyInternal(); - if(AggregateMethod != null) dest.AggregateMethod = (Hl7.Fhir.Model.CodeableConcept)AggregateMethod.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); + if(_GroupDefinition is not null) dest.GroupDefinition = (Hl7.Fhir.Model.ResourceReference)_GroupDefinition.DeepCopyInternal(); + if(_InputPopulationIdElement is not null) dest.InputPopulationIdElement = (Hl7.Fhir.Model.FhirString)_InputPopulationIdElement.DeepCopyInternal(); + if(_AggregateMethod is not null) dest.AggregateMethod = (Hl7.Fhir.Model.CodeableConcept)_AggregateMethod.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -850,76 +817,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; - if(!comparer.Equals(GroupDefinition, otherT.GroupDefinition)) return false; - if(!comparer.Equals(InputPopulationIdElement, otherT.InputPopulationIdElement)) return false; - if(!comparer.Equals(AggregateMethod, otherT.AggregateMethod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; + if(!comparer.Equals(_GroupDefinition, otherT._GroupDefinition)) return false; + if(!comparer.Equals(_InputPopulationIdElement, otherT._InputPopulationIdElement)) return false; + if(!comparer.Equals(_AggregateMethod, otherT._AggregateMethod)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; case "groupDefinition": - value = GroupDefinition; - return GroupDefinition is not null; + value = _GroupDefinition; + return _GroupDefinition is not null; case "inputPopulationId": - value = InputPopulationIdElement; - return InputPopulationIdElement is not null; + value = _InputPopulationIdElement; + return _InputPopulationIdElement is not null; case "aggregateMethod": - value = AggregateMethod; - return AggregateMethod is not null; + value = _AggregateMethod; + return _AggregateMethod is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; case "groupDefinition": - GroupDefinition = (Hl7.Fhir.Model.ResourceReference)value; + GroupDefinition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "inputPopulationId": - InputPopulationIdElement = (Hl7.Fhir.Model.FhirString)value; + InputPopulationIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "aggregateMethod": - AggregateMethod = (Hl7.Fhir.Model.CodeableConcept)value; + AggregateMethod = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -930,13 +897,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); - if (GroupDefinition is not null) yield return new KeyValuePair("groupDefinition",GroupDefinition); - if (InputPopulationIdElement is not null) yield return new KeyValuePair("inputPopulationId",InputPopulationIdElement); - if (AggregateMethod is not null) yield return new KeyValuePair("aggregateMethod",AggregateMethod); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); + if (_GroupDefinition is not null) yield return new KeyValuePair("groupDefinition",_GroupDefinition); + if (_InputPopulationIdElement is not null) yield return new KeyValuePair("inputPopulationId",_InputPopulationIdElement); + if (_AggregateMethod is not null) yield return new KeyValuePair("aggregateMethod",_AggregateMethod); } } @@ -962,28 +929,25 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for stratifier in measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -994,41 +958,38 @@ public string LinkId [FhirElement("code", Order=50)] [Binding("MeasureStratifierExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this stratifier. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The human readable description of this stratifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1038,13 +999,13 @@ public string Description /// [FhirElement("criteria", Order=70)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; /// /// A group resource that defines this population. @@ -1053,13 +1014,13 @@ public Hl7.Fhir.Model.Expression Criteria [CLSCompliant(false)] [References("Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference GroupDefinition + public Hl7.Fhir.Model.ResourceReference? GroupDefinition { get { return _GroupDefinition; } set { _GroupDefinition = value; OnPropertyChanged("GroupDefinition"); } } - private Hl7.Fhir.Model.ResourceReference _GroupDefinition; + private Hl7.Fhir.Model.ResourceReference? _GroupDefinition; /// /// Stratifier criteria component for the measure. @@ -1069,28 +1030,24 @@ public Hl7.Fhir.Model.ResourceReference GroupDefinition [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); - if(GroupDefinition != null) dest.GroupDefinition = (Hl7.Fhir.Model.ResourceReference)GroupDefinition.DeepCopyInternal(); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); + if(_GroupDefinition is not null) dest.GroupDefinition = (Hl7.Fhir.Model.ResourceReference)_GroupDefinition.DeepCopyInternal(); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1102,69 +1059,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; - if(!comparer.Equals(GroupDefinition, otherT.GroupDefinition)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; + if(!comparer.Equals(_GroupDefinition, otherT._GroupDefinition)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; case "groupDefinition": - value = GroupDefinition; - return GroupDefinition is not null; + value = _GroupDefinition; + return _GroupDefinition is not null; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; case "groupDefinition": - GroupDefinition = (Hl7.Fhir.Model.ResourceReference)value; + GroupDefinition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1175,12 +1132,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); - if (GroupDefinition is not null) yield return new KeyValuePair("groupDefinition",GroupDefinition); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); + if (_GroupDefinition is not null) yield return new KeyValuePair("groupDefinition",_GroupDefinition); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } @@ -1207,28 +1164,25 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for stratifier component in measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -1239,41 +1193,38 @@ public string LinkId [FhirElement("code", Order=50)] [Binding("MeasureStratifierExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The human readable description of this stratifier component. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The human readable description of this stratifier component /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1283,13 +1234,13 @@ public string Description /// [FhirElement("criteria", Order=70)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; /// /// A group resource that defines this population. @@ -1298,29 +1249,25 @@ public Hl7.Fhir.Model.Expression Criteria [CLSCompliant(false)] [References("Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference GroupDefinition + public Hl7.Fhir.Model.ResourceReference? GroupDefinition { get { return _GroupDefinition; } set { _GroupDefinition = value; OnPropertyChanged("GroupDefinition"); } } - private Hl7.Fhir.Model.ResourceReference _GroupDefinition; + private Hl7.Fhir.Model.ResourceReference? _GroupDefinition; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); - if(GroupDefinition != null) dest.GroupDefinition = (Hl7.Fhir.Model.ResourceReference)GroupDefinition.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); + if(_GroupDefinition is not null) dest.GroupDefinition = (Hl7.Fhir.Model.ResourceReference)_GroupDefinition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1332,62 +1279,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; - if(!comparer.Equals(GroupDefinition, otherT.GroupDefinition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; + if(!comparer.Equals(_GroupDefinition, otherT._GroupDefinition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; case "groupDefinition": - value = GroupDefinition; - return GroupDefinition is not null; + value = _GroupDefinition; + return _GroupDefinition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; case "groupDefinition": - GroupDefinition = (Hl7.Fhir.Model.ResourceReference)value; + GroupDefinition = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1398,11 +1345,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); - if (GroupDefinition is not null) yield return new KeyValuePair("groupDefinition",GroupDefinition); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); + if (_GroupDefinition is not null) yield return new KeyValuePair("groupDefinition",_GroupDefinition); } } @@ -1429,28 +1376,25 @@ public partial class SupplementalDataComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for supplementalData in measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -1461,13 +1405,13 @@ public string LinkId [FhirElement("code", Order=50)] [Binding("MeasureSupplementalDataExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// supplemental-data | risk-adjustment-factor. @@ -1478,39 +1422,36 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Usage { - get { if(_Usage==null) _Usage = new List(); return _Usage; } + get => _Usage ?? new List(); set { _Usage = value; OnPropertyChanged("Usage"); } } - private List _Usage; + private List? _Usage; /// /// The human readable description of this supplemental data. /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The human readable description of this supplemental data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1521,29 +1462,25 @@ public string Description [FhirElement("criteria", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Expression Criteria + public Hl7.Fhir.Model.Expression? Criteria { get { return _Criteria; } set { _Criteria = value; OnPropertyChanged("Criteria"); } } - private Hl7.Fhir.Model.Expression _Criteria; + private Hl7.Fhir.Model.Expression? _Criteria; protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementalDataComponent; - - if (dest == null) - { + if(other is not SupplementalDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Usage.Any()) dest.Usage = new List(Usage.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Criteria != null) dest.Criteria = (Hl7.Fhir.Model.Expression)Criteria.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Usage is not null) dest.Usage = new List(_Usage.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Criteria is not null) dest.Criteria = (Hl7.Fhir.Model.Expression)_Criteria.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1555,62 +1492,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementalDataComponent; - if(otherT == null) return false; + if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Usage, otherT.Usage)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Criteria, otherT.Criteria)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "usage": - value = Usage; - return Usage?.Any() == true; + value = _Usage; + return _Usage?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "criteria": - value = Criteria; - return Criteria is not null; + value = _Criteria; + return _Criteria is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "usage": - Usage = (List)value; + Usage = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "criteria": - Criteria = (Hl7.Fhir.Model.Expression)value; + Criteria = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -1621,11 +1558,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Usage?.Any() == true) yield return new KeyValuePair("usage",Usage); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Criteria is not null) yield return new KeyValuePair("criteria",Criteria); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Usage?.Any() == true) yield return new KeyValuePair("usage",_Usage); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Criteria is not null) yield return new KeyValuePair("criteria",_Criteria); } } @@ -1635,28 +1572,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this measure, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1669,39 +1603,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the measure. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1713,41 +1644,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this measure (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this measure (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1757,28 +1685,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this measure (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1788,28 +1713,25 @@ public string Title /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -1822,13 +1744,13 @@ public string Subtitle [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1837,13 +1759,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1853,13 +1772,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1868,13 +1787,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1888,13 +1804,13 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Population basis. @@ -1903,13 +1819,13 @@ public Hl7.Fhir.Model.DataType Subject [DeclaredType(Type = typeof(Code))] [Binding("BasisType")] [DataMember] - public Code BasisElement + public Code? BasisElement { get { return _BasisElement; } set { _BasisElement = value; OnPropertyChanged("BasisElement"); } } - private Code _BasisElement; + private Code? _BasisElement; /// /// Population basis @@ -1918,13 +1834,10 @@ public Code BasisElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Basis { - get { return BasisElement != null ? BasisElement.Value : null; } + get => _BasisElement?.Value; set { - if (value == null) - BasisElement = null; - else - BasisElement = new Code(value); + BasisElement = value is null ? null : new Code(value); OnPropertyChanged("Basis"); } } @@ -1934,28 +1847,25 @@ public Hl7.Fhir.Model.FHIRAllTypes? Basis /// [FhirElement("date", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1965,28 +1875,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=210, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1999,39 +1906,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the measure. /// [FhirElement("description", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2044,11 +1948,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for measure (if applicable). @@ -2059,39 +1963,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this measure is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this measure is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2101,28 +2002,25 @@ public string Purpose /// [FhirElement("usage", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown UsageElement + public Hl7.Fhir.Model.Markdown? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.Markdown _UsageElement; + private Hl7.Fhir.Model.Markdown? _UsageElement; /// /// Describes the clinical usage of the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.Markdown(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Usage"); } } @@ -2132,28 +2030,25 @@ public string Usage /// [FhirElement("copyright", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2163,28 +2058,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -2194,28 +2086,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the measure was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -2225,28 +2114,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=310)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the measure was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2256,13 +2142,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=320)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// The category of the measure, such as Education, Treatment, Assessment, etc. @@ -2273,11 +2159,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -2287,11 +2173,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -2301,11 +2187,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -2315,11 +2201,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -2329,11 +2215,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -2343,11 +2229,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the measure. @@ -2357,24 +2243,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -2386,28 +2272,25 @@ public IEnumerable Library /// [FhirElement("disclaimer", InSummary=true, Order=400)] [DataMember] - public Hl7.Fhir.Model.Markdown DisclaimerElement + public Hl7.Fhir.Model.Markdown? DisclaimerElement { get { return _DisclaimerElement; } set { _DisclaimerElement = value; OnPropertyChanged("DisclaimerElement"); } } - private Hl7.Fhir.Model.Markdown _DisclaimerElement; + private Hl7.Fhir.Model.Markdown? _DisclaimerElement; /// /// Disclaimer for use of the measure or its referenced content /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disclaimer + public string? Disclaimer { - get { return DisclaimerElement != null ? DisclaimerElement.Value : null; } + get => _DisclaimerElement?.Value; set { - if (value == null) - DisclaimerElement = null; - else - DisclaimerElement = new Hl7.Fhir.Model.Markdown(value); + DisclaimerElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Disclaimer"); } } @@ -2418,13 +2301,13 @@ public string Disclaimer [FhirElement("scoring", InSummary=true, Order=410)] [Binding("MeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; /// /// What units?. @@ -2432,13 +2315,13 @@ public Hl7.Fhir.Model.CodeableConcept Scoring [FhirElement("scoringUnit", InSummary=true, Order=420)] [Binding("MeasureScoringUnit")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ScoringUnit + public Hl7.Fhir.Model.CodeableConcept? ScoringUnit { get { return _ScoringUnit; } set { _ScoringUnit = value; OnPropertyChanged("ScoringUnit"); } } - private Hl7.Fhir.Model.CodeableConcept _ScoringUnit; + private Hl7.Fhir.Model.CodeableConcept? _ScoringUnit; /// /// opportunity | all-or-nothing | linear | weighted. @@ -2446,13 +2329,13 @@ public Hl7.Fhir.Model.CodeableConcept ScoringUnit [FhirElement("compositeScoring", InSummary=true, Order=430)] [Binding("CompositeMeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CompositeScoring + public Hl7.Fhir.Model.CodeableConcept? CompositeScoring { get { return _CompositeScoring; } set { _CompositeScoring = value; OnPropertyChanged("CompositeScoring"); } } - private Hl7.Fhir.Model.CodeableConcept _CompositeScoring; + private Hl7.Fhir.Model.CodeableConcept? _CompositeScoring; /// /// process | outcome | structure | patient-reported-outcome | composite. @@ -2463,39 +2346,36 @@ public Hl7.Fhir.Model.CodeableConcept CompositeScoring [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// How risk adjustment is applied for this measure. /// [FhirElement("riskAdjustment", InSummary=true, Order=450)] [DataMember] - public Hl7.Fhir.Model.Markdown RiskAdjustmentElement + public Hl7.Fhir.Model.Markdown? RiskAdjustmentElement { get { return _RiskAdjustmentElement; } set { _RiskAdjustmentElement = value; OnPropertyChanged("RiskAdjustmentElement"); } } - private Hl7.Fhir.Model.Markdown _RiskAdjustmentElement; + private Hl7.Fhir.Model.Markdown? _RiskAdjustmentElement; /// /// How risk adjustment is applied for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RiskAdjustment + public string? RiskAdjustment { - get { return RiskAdjustmentElement != null ? RiskAdjustmentElement.Value : null; } + get => _RiskAdjustmentElement?.Value; set { - if (value == null) - RiskAdjustmentElement = null; - else - RiskAdjustmentElement = new Hl7.Fhir.Model.Markdown(value); + RiskAdjustmentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("RiskAdjustment"); } } @@ -2505,28 +2385,25 @@ public string RiskAdjustment /// [FhirElement("rateAggregation", InSummary=true, Order=460)] [DataMember] - public Hl7.Fhir.Model.Markdown RateAggregationElement + public Hl7.Fhir.Model.Markdown? RateAggregationElement { get { return _RateAggregationElement; } set { _RateAggregationElement = value; OnPropertyChanged("RateAggregationElement"); } } - private Hl7.Fhir.Model.Markdown _RateAggregationElement; + private Hl7.Fhir.Model.Markdown? _RateAggregationElement; /// /// How is rate aggregation performed for this measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RateAggregation + public string? RateAggregation { - get { return RateAggregationElement != null ? RateAggregationElement.Value : null; } + get => _RateAggregationElement?.Value; set { - if (value == null) - RateAggregationElement = null; - else - RateAggregationElement = new Hl7.Fhir.Model.Markdown(value); + RateAggregationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("RateAggregation"); } } @@ -2536,28 +2413,25 @@ public string RateAggregation /// [FhirElement("rationale", InSummary=true, Order=470)] [DataMember] - public Hl7.Fhir.Model.Markdown RationaleElement + public Hl7.Fhir.Model.Markdown? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.Markdown _RationaleElement; + private Hl7.Fhir.Model.Markdown? _RationaleElement; /// /// Detailed description of why the measure exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.Markdown(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Rationale"); } } @@ -2567,28 +2441,25 @@ public string Rationale /// [FhirElement("clinicalRecommendationStatement", InSummary=true, Order=480)] [DataMember] - public Hl7.Fhir.Model.Markdown ClinicalRecommendationStatementElement + public Hl7.Fhir.Model.Markdown? ClinicalRecommendationStatementElement { get { return _ClinicalRecommendationStatementElement; } set { _ClinicalRecommendationStatementElement = value; OnPropertyChanged("ClinicalRecommendationStatementElement"); } } - private Hl7.Fhir.Model.Markdown _ClinicalRecommendationStatementElement; + private Hl7.Fhir.Model.Markdown? _ClinicalRecommendationStatementElement; /// /// Summary of clinical guidelines /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ClinicalRecommendationStatement + public string? ClinicalRecommendationStatement { - get { return ClinicalRecommendationStatementElement != null ? ClinicalRecommendationStatementElement.Value : null; } + get => _ClinicalRecommendationStatementElement?.Value; set { - if (value == null) - ClinicalRecommendationStatementElement = null; - else - ClinicalRecommendationStatementElement = new Hl7.Fhir.Model.Markdown(value); + ClinicalRecommendationStatementElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ClinicalRecommendationStatement"); } } @@ -2599,13 +2470,13 @@ public string ClinicalRecommendationStatement [FhirElement("improvementNotation", InSummary=true, Order=490)] [Binding("MeasureImprovementNotation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ImprovementNotation + public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation { get { return _ImprovementNotation; } set { _ImprovementNotation = value; OnPropertyChanged("ImprovementNotation"); } } - private Hl7.Fhir.Model.CodeableConcept _ImprovementNotation; + private Hl7.Fhir.Model.CodeableConcept? _ImprovementNotation; /// /// Defined terms used in the measure documentation. @@ -2615,39 +2486,36 @@ public Hl7.Fhir.Model.CodeableConcept ImprovementNotation [DataMember] public List Term { - get { if(_Term==null) _Term = new List(); return _Term; } + get => _Term ?? new List(); set { _Term = value; OnPropertyChanged("Term"); } } - private List _Term; + private List? _Term; /// /// Additional guidance for implementers (deprecated). /// [FhirElement("guidance", InSummary=true, Order=510)] [DataMember] - public Hl7.Fhir.Model.Markdown GuidanceElement + public Hl7.Fhir.Model.Markdown? GuidanceElement { get { return _GuidanceElement; } set { _GuidanceElement = value; OnPropertyChanged("GuidanceElement"); } } - private Hl7.Fhir.Model.Markdown _GuidanceElement; + private Hl7.Fhir.Model.Markdown? _GuidanceElement; /// /// Additional guidance for implementers (deprecated) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Guidance + public string? Guidance { - get { return GuidanceElement != null ? GuidanceElement.Value : null; } + get => _GuidanceElement?.Value; set { - if (value == null) - GuidanceElement = null; - else - GuidanceElement = new Hl7.Fhir.Model.Markdown(value); + GuidanceElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Guidance"); } } @@ -2660,11 +2528,11 @@ public string Guidance [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// What other data should be reported with the measure. @@ -2674,69 +2542,65 @@ public List Group [DataMember] public List SupplementalData { - get { if(_SupplementalData==null) _SupplementalData = new List(); return _SupplementalData; } + get => _SupplementalData ?? new List(); set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } - private List _SupplementalData; + private List? _SupplementalData; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Measure; - - if (dest == null) - { + if(other is not Measure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(BasisElement != null) dest.BasisElement = (Code)BasisElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(DisclaimerElement != null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)DisclaimerElement.DeepCopyInternal(); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); - if(ScoringUnit != null) dest.ScoringUnit = (Hl7.Fhir.Model.CodeableConcept)ScoringUnit.DeepCopyInternal(); - if(CompositeScoring != null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)CompositeScoring.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(RiskAdjustmentElement != null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.Markdown)RiskAdjustmentElement.DeepCopyInternal(); - if(RateAggregationElement != null) dest.RateAggregationElement = (Hl7.Fhir.Model.Markdown)RateAggregationElement.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)RationaleElement.DeepCopyInternal(); - if(ClinicalRecommendationStatementElement != null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)ClinicalRecommendationStatementElement.DeepCopyInternal(); - if(ImprovementNotation != null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)ImprovementNotation.DeepCopyInternal(); - if(Term.Any()) dest.Term = new List(Term.DeepCopyInternal()); - if(GuidanceElement != null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)GuidanceElement.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(SupplementalData.Any()) dest.SupplementalData = new List(SupplementalData.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_BasisElement is not null) dest.BasisElement = (Code)_BasisElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_DisclaimerElement is not null) dest.DisclaimerElement = (Hl7.Fhir.Model.Markdown)_DisclaimerElement.DeepCopyInternal(); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); + if(_ScoringUnit is not null) dest.ScoringUnit = (Hl7.Fhir.Model.CodeableConcept)_ScoringUnit.DeepCopyInternal(); + if(_CompositeScoring is not null) dest.CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)_CompositeScoring.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_RiskAdjustmentElement is not null) dest.RiskAdjustmentElement = (Hl7.Fhir.Model.Markdown)_RiskAdjustmentElement.DeepCopyInternal(); + if(_RateAggregationElement is not null) dest.RateAggregationElement = (Hl7.Fhir.Model.Markdown)_RateAggregationElement.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.Markdown)_RationaleElement.DeepCopyInternal(); + if(_ClinicalRecommendationStatementElement is not null) dest.ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)_ClinicalRecommendationStatementElement.DeepCopyInternal(); + if(_ImprovementNotation is not null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)_ImprovementNotation.DeepCopyInternal(); + if(_Term is not null) dest.Term = new List(_Term.DeepCopyInternal()); + if(_GuidanceElement is not null) dest.GuidanceElement = (Hl7.Fhir.Model.Markdown)_GuidanceElement.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_SupplementalData is not null) dest.SupplementalData = new List(_SupplementalData.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2748,342 +2612,342 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Measure; - if(otherT == null) return false; + if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(BasisElement, otherT.BasisElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.Equals(DisclaimerElement, otherT.DisclaimerElement)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; - if(!comparer.Equals(ScoringUnit, otherT.ScoringUnit)) return false; - if(!comparer.Equals(CompositeScoring, otherT.CompositeScoring)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(RiskAdjustmentElement, otherT.RiskAdjustmentElement)) return false; - if(!comparer.Equals(RateAggregationElement, otherT.RateAggregationElement)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; - if(!comparer.Equals(ClinicalRecommendationStatementElement, otherT.ClinicalRecommendationStatementElement)) return false; - if(!comparer.Equals(ImprovementNotation, otherT.ImprovementNotation)) return false; - if(!comparer.ListEquals(Term, otherT.Term)) return false; - if(!comparer.Equals(GuidanceElement, otherT.GuidanceElement)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.ListEquals(SupplementalData, otherT.SupplementalData)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.Equals(_DisclaimerElement, otherT._DisclaimerElement)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; + if(!comparer.Equals(_ScoringUnit, otherT._ScoringUnit)) return false; + if(!comparer.Equals(_CompositeScoring, otherT._CompositeScoring)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RiskAdjustmentElement, otherT._RiskAdjustmentElement)) return false; + if(!comparer.Equals(_RateAggregationElement, otherT._RateAggregationElement)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; + if(!comparer.Equals(_ClinicalRecommendationStatementElement, otherT._ClinicalRecommendationStatementElement)) return false; + if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; + if(!comparer.ListEquals(_Term, otherT._Term)) return false; + if(!comparer.Equals(_GuidanceElement, otherT._GuidanceElement)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "basis": - value = BasisElement; - return BasisElement is not null; + value = _BasisElement; + return _BasisElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "disclaimer": - value = DisclaimerElement; - return DisclaimerElement is not null; + value = _DisclaimerElement; + return _DisclaimerElement is not null; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; case "scoringUnit": - value = ScoringUnit; - return ScoringUnit is not null; + value = _ScoringUnit; + return _ScoringUnit is not null; case "compositeScoring": - value = CompositeScoring; - return CompositeScoring is not null; + value = _CompositeScoring; + return _CompositeScoring is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "riskAdjustment": - value = RiskAdjustmentElement; - return RiskAdjustmentElement is not null; + value = _RiskAdjustmentElement; + return _RiskAdjustmentElement is not null; case "rateAggregation": - value = RateAggregationElement; - return RateAggregationElement is not null; + value = _RateAggregationElement; + return _RateAggregationElement is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; case "clinicalRecommendationStatement": - value = ClinicalRecommendationStatementElement; - return ClinicalRecommendationStatementElement is not null; + value = _ClinicalRecommendationStatementElement; + return _ClinicalRecommendationStatementElement is not null; case "improvementNotation": - value = ImprovementNotation; - return ImprovementNotation is not null; + value = _ImprovementNotation; + return _ImprovementNotation is not null; case "term": - value = Term; - return Term?.Any() == true; + value = _Term; + return _Term?.Any() == true; case "guidance": - value = GuidanceElement; - return GuidanceElement is not null; + value = _GuidanceElement; + return _GuidanceElement is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "supplementalData": - value = SupplementalData; - return SupplementalData?.Any() == true; + value = _SupplementalData; + return _SupplementalData?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "basis": - BasisElement = (Code)value; + BasisElement = (Code?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.Markdown)value; + UsageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "disclaimer": - DisclaimerElement = (Hl7.Fhir.Model.Markdown)value; + DisclaimerElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "scoringUnit": - ScoringUnit = (Hl7.Fhir.Model.CodeableConcept)value; + ScoringUnit = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "compositeScoring": - CompositeScoring = (Hl7.Fhir.Model.CodeableConcept)value; + CompositeScoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "riskAdjustment": - RiskAdjustmentElement = (Hl7.Fhir.Model.Markdown)value; + RiskAdjustmentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "rateAggregation": - RateAggregationElement = (Hl7.Fhir.Model.Markdown)value; + RateAggregationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.Markdown)value; + RationaleElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "clinicalRecommendationStatement": - ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown)value; + ClinicalRecommendationStatementElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "improvementNotation": - ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)value; + ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "term": - Term = (List)value; + Term = (List?)value!; return this; case "guidance": - GuidanceElement = (Hl7.Fhir.Model.Markdown)value; + GuidanceElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "supplementalData": - SupplementalData = (List)value; + SupplementalData = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3094,51 +2958,51 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (BasisElement is not null) yield return new KeyValuePair("basis",BasisElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",DisclaimerElement); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); - if (ScoringUnit is not null) yield return new KeyValuePair("scoringUnit",ScoringUnit); - if (CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",CompositeScoring); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",RiskAdjustmentElement); - if (RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",RateAggregationElement); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); - if (ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",ClinicalRecommendationStatementElement); - if (ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotation); - if (Term?.Any() == true) yield return new KeyValuePair("term",Term); - if (GuidanceElement is not null) yield return new KeyValuePair("guidance",GuidanceElement); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",SupplementalData); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_BasisElement is not null) yield return new KeyValuePair("basis",_BasisElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_DisclaimerElement is not null) yield return new KeyValuePair("disclaimer",_DisclaimerElement); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); + if (_ScoringUnit is not null) yield return new KeyValuePair("scoringUnit",_ScoringUnit); + if (_CompositeScoring is not null) yield return new KeyValuePair("compositeScoring",_CompositeScoring); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_RiskAdjustmentElement is not null) yield return new KeyValuePair("riskAdjustment",_RiskAdjustmentElement); + if (_RateAggregationElement is not null) yield return new KeyValuePair("rateAggregation",_RateAggregationElement); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); + if (_ClinicalRecommendationStatementElement is not null) yield return new KeyValuePair("clinicalRecommendationStatement",_ClinicalRecommendationStatementElement); + if (_ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotation); + if (_Term?.Any() == true) yield return new KeyValuePair("term",_Term); + if (_GuidanceElement is not null) yield return new KeyValuePair("guidance",_GuidanceElement); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",_SupplementalData); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs index 40c514795..f5b5da34e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -164,28 +167,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific group from Measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -196,13 +196,13 @@ public string LinkId [FhirElement("code", InSummary=true, Order=50)] [Binding("MeasureGroupExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// What individual(s) the report is for. @@ -211,13 +211,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("CareTeam","Device","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The populations in the group. @@ -227,11 +227,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this group achieved. @@ -240,13 +240,13 @@ public List Population [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType MeasureScore + public Hl7.Fhir.Model.DataType? MeasureScore { get { return _MeasureScore; } set { _MeasureScore = value; OnPropertyChanged("MeasureScore"); } } - private Hl7.Fhir.Model.DataType _MeasureScore; + private Hl7.Fhir.Model.DataType? _MeasureScore; /// /// Stratification results. @@ -256,28 +256,24 @@ public Hl7.Fhir.Model.DataType MeasureScore [DataMember] public List Stratifier { - get { if(_Stratifier==null) _Stratifier = new List(); return _Stratifier; } + get => _Stratifier ?? new List(); set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } - private List _Stratifier; + private List? _Stratifier; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScore != null) dest.MeasureScore = (Hl7.Fhir.Model.DataType)MeasureScore.DeepCopyInternal(); - if(Stratifier.Any()) dest.Stratifier = new List(Stratifier.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScore is not null) dest.MeasureScore = (Hl7.Fhir.Model.DataType)_MeasureScore.DeepCopyInternal(); + if(_Stratifier is not null) dest.Stratifier = new List(_Stratifier.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -289,69 +285,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScore, otherT.MeasureScore)) return false; - if(!comparer.ListEquals(Stratifier, otherT.Stratifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; + if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScore; - return MeasureScore is not null; + value = _MeasureScore; + return _MeasureScore is not null; case "stratifier": - value = Stratifier; - return Stratifier?.Any() == true; + value = _Stratifier; + return _Stratifier?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScore = (Hl7.Fhir.Model.DataType)value; + MeasureScore = (Hl7.Fhir.Model.DataType?)value; return this; case "stratifier": - Stratifier = (List)value; + Stratifier = (List?)value!; return this; default: return base.SetValue(key, value); @@ -362,12 +358,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScore is not null) yield return new KeyValuePair("measureScore",MeasureScore); - if (Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",Stratifier); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScore is not null) yield return new KeyValuePair("measureScore",_MeasureScore); + if (_Stratifier?.Any() == true) yield return new KeyValuePair("stratifier",_Stratifier); } } @@ -393,28 +389,25 @@ public partial class PopulationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific population from Measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -425,26 +418,26 @@ public string LinkId [FhirElement("code", InSummary=true, Order=50)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -453,13 +446,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -471,13 +461,13 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SubjectResults + public Hl7.Fhir.Model.ResourceReference? SubjectResults { get { return _SubjectResults; } set { _SubjectResults = value; OnPropertyChanged("SubjectResults"); } } - private Hl7.Fhir.Model.ResourceReference _SubjectResults; + private Hl7.Fhir.Model.ResourceReference? _SubjectResults; /// /// For subject-list reports, a subject result in this population. @@ -489,11 +479,11 @@ public Hl7.Fhir.Model.ResourceReference SubjectResults [DataMember] public List SubjectReport { - get { if(_SubjectReport==null) _SubjectReport = new List(); return _SubjectReport; } + get => _SubjectReport ?? new List(); set { _SubjectReport = value; OnPropertyChanged("SubjectReport"); } } - private List _SubjectReport; + private List? _SubjectReport; /// /// What individual(s) in the population. @@ -502,30 +492,26 @@ public List SubjectReport [CLSCompliant(false)] [References("Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subjects + public Hl7.Fhir.Model.ResourceReference? Subjects { get { return _Subjects; } set { _Subjects = value; OnPropertyChanged("Subjects"); } } - private Hl7.Fhir.Model.ResourceReference _Subjects; + private Hl7.Fhir.Model.ResourceReference? _Subjects; protected internal override void CopyToInternal(Base other) { - var dest = other as PopulationComponent; - - if (dest == null) - { + if(other is not PopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(SubjectResults != null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)SubjectResults.DeepCopyInternal(); - if(SubjectReport.Any()) dest.SubjectReport = new List(SubjectReport.DeepCopyInternal()); - if(Subjects != null) dest.Subjects = (Hl7.Fhir.Model.ResourceReference)Subjects.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_SubjectResults is not null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)_SubjectResults.DeepCopyInternal(); + if(_SubjectReport is not null) dest.SubjectReport = new List(_SubjectReport.DeepCopyInternal()); + if(_Subjects is not null) dest.Subjects = (Hl7.Fhir.Model.ResourceReference)_Subjects.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -537,69 +523,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PopulationComponent; - if(otherT == null) return false; + if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(SubjectResults, otherT.SubjectResults)) return false; - if(!comparer.ListEquals(SubjectReport, otherT.SubjectReport)) return false; - if(!comparer.Equals(Subjects, otherT.Subjects)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; + if(!comparer.ListEquals(_SubjectReport, otherT._SubjectReport)) return false; + if(!comparer.Equals(_Subjects, otherT._Subjects)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "subjectResults": - value = SubjectResults; - return SubjectResults is not null; + value = _SubjectResults; + return _SubjectResults is not null; case "subjectReport": - value = SubjectReport; - return SubjectReport?.Any() == true; + value = _SubjectReport; + return _SubjectReport?.Any() == true; case "subjects": - value = Subjects; - return Subjects is not null; + value = _Subjects; + return _Subjects is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "subjectResults": - SubjectResults = (Hl7.Fhir.Model.ResourceReference)value; + SubjectResults = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subjectReport": - SubjectReport = (List)value; + SubjectReport = (List?)value!; return this; case "subjects": - Subjects = (Hl7.Fhir.Model.ResourceReference)value; + Subjects = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -610,12 +596,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (SubjectResults is not null) yield return new KeyValuePair("subjectResults",SubjectResults); - if (SubjectReport?.Any() == true) yield return new KeyValuePair("subjectReport",SubjectReport); - if (Subjects is not null) yield return new KeyValuePair("subjects",Subjects); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_SubjectResults is not null) yield return new KeyValuePair("subjectResults",_SubjectResults); + if (_SubjectReport?.Any() == true) yield return new KeyValuePair("subjectReport",_SubjectReport); + if (_Subjects is not null) yield return new KeyValuePair("subjects",_Subjects); } } @@ -641,28 +627,25 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific stratifier from Measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -673,13 +656,13 @@ public string LinkId [FhirElement("code", Order=50)] [Binding("MeasureStratifierExample")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Stratum results, one for each unique value, or set of values, in the stratifier, or stratifier components. @@ -689,25 +672,21 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Stratum { - get { if(_Stratum==null) _Stratum = new List(); return _Stratum; } + get => _Stratum ?? new List(); set { _Stratum = value; OnPropertyChanged("Stratum"); } } - private List _Stratum; + private List? _Stratum; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierComponent; - - if (dest == null) - { + if(other is not StratifierComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Stratum.Any()) dest.Stratum = new List(Stratum.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Stratum is not null) dest.Stratum = new List(_Stratum.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -719,48 +698,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierComponent; - if(otherT == null) return false; + if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Stratum, otherT.Stratum)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "stratum": - value = Stratum; - return Stratum?.Any() == true; + value = _Stratum; + return _Stratum?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "stratum": - Stratum = (List)value; + Stratum = (List?)value!; return this; default: return base.SetValue(key, value); @@ -771,9 +750,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Stratum?.Any() == true) yield return new KeyValuePair("stratum",Stratum); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Stratum?.Any() == true) yield return new KeyValuePair("stratum",_Stratum); } } @@ -802,13 +781,13 @@ public partial class StratifierGroupComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Stratifier component values. @@ -818,11 +797,11 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; /// /// Population results in this stratum. @@ -832,11 +811,11 @@ public List Component [DataMember] public List Population { - get { if(_Population==null) _Population = new List(); return _Population; } + get => _Population ?? new List(); set { _Population = value; OnPropertyChanged("Population"); } } - private List _Population; + private List? _Population; /// /// What score this stratum achieved. @@ -845,28 +824,24 @@ public List Pop [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType MeasureScore + public Hl7.Fhir.Model.DataType? MeasureScore { get { return _MeasureScore; } set { _MeasureScore = value; OnPropertyChanged("MeasureScore"); } } - private Hl7.Fhir.Model.DataType _MeasureScore; + private Hl7.Fhir.Model.DataType? _MeasureScore; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupComponent; - - if (dest == null) - { + if(other is not StratifierGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); - if(Population.Any()) dest.Population = new List(Population.DeepCopyInternal()); - if(MeasureScore != null) dest.MeasureScore = (Hl7.Fhir.Model.DataType)MeasureScore.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); + if(_Population is not null) dest.Population = new List(_Population.DeepCopyInternal()); + if(_MeasureScore is not null) dest.MeasureScore = (Hl7.Fhir.Model.DataType)_MeasureScore.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -878,55 +853,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupComponent; - if(otherT == null) return false; + if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; - if(!comparer.ListEquals(Population, otherT.Population)) return false; - if(!comparer.Equals(MeasureScore, otherT.MeasureScore)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; + if(!comparer.ListEquals(_Population, otherT._Population)) return false; + if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; case "population": - value = Population; - return Population?.Any() == true; + value = _Population; + return _Population?.Any() == true; case "measureScore": - value = MeasureScore; - return MeasureScore is not null; + value = _MeasureScore; + return _MeasureScore is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; case "population": - Population = (List)value; + Population = (List?)value!; return this; case "measureScore": - MeasureScore = (Hl7.Fhir.Model.DataType)value; + MeasureScore = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -937,10 +912,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); - if (Population?.Any() == true) yield return new KeyValuePair("population",Population); - if (MeasureScore is not null) yield return new KeyValuePair("measureScore",MeasureScore); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); + if (_Population?.Any() == true) yield return new KeyValuePair("population",_Population); + if (_MeasureScore is not null) yield return new KeyValuePair("measureScore",_MeasureScore); } } @@ -966,28 +941,25 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific stratifier component from Measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -999,13 +971,13 @@ public string LinkId [Binding("MeasureStratifierExample")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The stratum component value, e.g. male. @@ -1016,27 +988,23 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1048,48 +1016,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1100,9 +1068,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1128,28 +1096,25 @@ public partial class StratifierGroupPopulationComponent : Hl7.Fhir.Model.Backbon /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific population from Measure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -1160,26 +1125,26 @@ public string LinkId [FhirElement("code", Order=50)] [Binding("MeasurePopulation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Size of the population. /// [FhirElement("count", Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer CountElement + public Hl7.Fhir.Model.Integer? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.Integer _CountElement; + private Hl7.Fhir.Model.Integer? _CountElement; /// /// Size of the population @@ -1188,13 +1153,10 @@ public Hl7.Fhir.Model.Integer CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.Integer(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Count"); } } @@ -1206,13 +1168,13 @@ public int? Count [CLSCompliant(false)] [References("List")] [DataMember] - public Hl7.Fhir.Model.ResourceReference SubjectResults + public Hl7.Fhir.Model.ResourceReference? SubjectResults { get { return _SubjectResults; } set { _SubjectResults = value; OnPropertyChanged("SubjectResults"); } } - private Hl7.Fhir.Model.ResourceReference _SubjectResults; + private Hl7.Fhir.Model.ResourceReference? _SubjectResults; /// /// For subject-list reports, a subject result in this population. @@ -1224,11 +1186,11 @@ public Hl7.Fhir.Model.ResourceReference SubjectResults [DataMember] public List SubjectReport { - get { if(_SubjectReport==null) _SubjectReport = new List(); return _SubjectReport; } + get => _SubjectReport ?? new List(); set { _SubjectReport = value; OnPropertyChanged("SubjectReport"); } } - private List _SubjectReport; + private List? _SubjectReport; /// /// What individual(s) in the population. @@ -1237,30 +1199,26 @@ public List SubjectReport [CLSCompliant(false)] [References("Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subjects + public Hl7.Fhir.Model.ResourceReference? Subjects { get { return _Subjects; } set { _Subjects = value; OnPropertyChanged("Subjects"); } } - private Hl7.Fhir.Model.ResourceReference _Subjects; + private Hl7.Fhir.Model.ResourceReference? _Subjects; protected internal override void CopyToInternal(Base other) { - var dest = other as StratifierGroupPopulationComponent; - - if (dest == null) - { + if(other is not StratifierGroupPopulationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.Integer)CountElement.DeepCopyInternal(); - if(SubjectResults != null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)SubjectResults.DeepCopyInternal(); - if(SubjectReport.Any()) dest.SubjectReport = new List(SubjectReport.DeepCopyInternal()); - if(Subjects != null) dest.Subjects = (Hl7.Fhir.Model.ResourceReference)Subjects.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.Integer)_CountElement.DeepCopyInternal(); + if(_SubjectResults is not null) dest.SubjectResults = (Hl7.Fhir.Model.ResourceReference)_SubjectResults.DeepCopyInternal(); + if(_SubjectReport is not null) dest.SubjectReport = new List(_SubjectReport.DeepCopyInternal()); + if(_Subjects is not null) dest.Subjects = (Hl7.Fhir.Model.ResourceReference)_Subjects.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1272,69 +1230,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StratifierGroupPopulationComponent; - if(otherT == null) return false; + if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(SubjectResults, otherT.SubjectResults)) return false; - if(!comparer.ListEquals(SubjectReport, otherT.SubjectReport)) return false; - if(!comparer.Equals(Subjects, otherT.Subjects)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; + if(!comparer.ListEquals(_SubjectReport, otherT._SubjectReport)) return false; + if(!comparer.Equals(_Subjects, otherT._Subjects)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "subjectResults": - value = SubjectResults; - return SubjectResults is not null; + value = _SubjectResults; + return _SubjectResults is not null; case "subjectReport": - value = SubjectReport; - return SubjectReport?.Any() == true; + value = _SubjectReport; + return _SubjectReport?.Any() == true; case "subjects": - value = Subjects; - return Subjects is not null; + value = _Subjects; + return _Subjects is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.Integer)value; + CountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "subjectResults": - SubjectResults = (Hl7.Fhir.Model.ResourceReference)value; + SubjectResults = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subjectReport": - SubjectReport = (List)value; + SubjectReport = (List?)value!; return this; case "subjects": - Subjects = (Hl7.Fhir.Model.ResourceReference)value; + Subjects = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1345,12 +1303,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (SubjectResults is not null) yield return new KeyValuePair("subjectResults",SubjectResults); - if (SubjectReport?.Any() == true) yield return new KeyValuePair("subjectReport",SubjectReport); - if (Subjects is not null) yield return new KeyValuePair("subjects",Subjects); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_SubjectResults is not null) yield return new KeyValuePair("subjectResults",_SubjectResults); + if (_SubjectReport?.Any() == true) yield return new KeyValuePair("subjectReport",_SubjectReport); + if (_Subjects is not null) yield return new KeyValuePair("subjects",_Subjects); } } @@ -1363,11 +1321,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// complete | pending | error. @@ -1377,13 +1335,13 @@ public List Identifier [Binding("MeasureReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// complete | pending | error @@ -1392,13 +1350,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1411,13 +1366,13 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportStatus? Status [Binding("MeasureReportType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// individual | subject-list | summary | data-exchange @@ -1426,13 +1381,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1444,13 +1396,13 @@ public Hl7.Fhir.Model.MeasureReport.MeasureReportType? Type [DeclaredType(Type = typeof(Code))] [Binding("SubmitDataUpdateType")] [DataMember] - public Code DataUpdateTypeElement + public Code? DataUpdateTypeElement { get { return _DataUpdateTypeElement; } set { _DataUpdateTypeElement = value; OnPropertyChanged("DataUpdateTypeElement"); } } - private Code _DataUpdateTypeElement; + private Code? _DataUpdateTypeElement; /// /// incremental | snapshot @@ -1459,13 +1411,10 @@ public Code DataUpdateTypeEle [IgnoreDataMember] public Hl7.Fhir.Model.MeasureReport.SubmitDataUpdateType? DataUpdateType { - get { return DataUpdateTypeElement != null ? DataUpdateTypeElement.Value : null; } + get => _DataUpdateTypeElement?.Value; set { - if (value == null) - DataUpdateTypeElement = null; - else - DataUpdateTypeElement = new Code(value); + DataUpdateTypeElement = value is null ? null : new Code(value); OnPropertyChanged("DataUpdateType"); } } @@ -1475,28 +1424,25 @@ public Hl7.Fhir.Model.MeasureReport.SubmitDataUpdateType? DataUpdateType /// [FhirElement("measure", InSummary=true, Order=130, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.Canonical MeasureElement + public Hl7.Fhir.Model.Canonical? MeasureElement { get { return _MeasureElement; } set { _MeasureElement = value; OnPropertyChanged("MeasureElement"); } } - private Hl7.Fhir.Model.Canonical _MeasureElement; + private Hl7.Fhir.Model.Canonical? _MeasureElement; /// /// What measure was calculated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Measure + public string? Measure { - get { return MeasureElement != null ? MeasureElement.Value : null; } + get => _MeasureElement?.Value; set { - if (value == null) - MeasureElement = null; - else - MeasureElement = new Hl7.Fhir.Model.Canonical(value); + MeasureElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Measure"); } } @@ -1508,41 +1454,38 @@ public string Measure [CLSCompliant(false)] [References("CareTeam","Device","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// When the measure was calculated. /// [FhirElement("date", InSummary=true, Order=150, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// When the measure was calculated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1554,13 +1497,13 @@ public string Date [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reporter + public Hl7.Fhir.Model.ResourceReference? Reporter { get { return _Reporter; } set { _Reporter = value; OnPropertyChanged("Reporter"); } } - private Hl7.Fhir.Model.ResourceReference _Reporter; + private Hl7.Fhir.Model.ResourceReference? _Reporter; /// /// What vendor prepared the data. @@ -1569,13 +1512,13 @@ public Hl7.Fhir.Model.ResourceReference Reporter [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReportingVendor + public Hl7.Fhir.Model.ResourceReference? ReportingVendor { get { return _ReportingVendor; } set { _ReportingVendor = value; OnPropertyChanged("ReportingVendor"); } } - private Hl7.Fhir.Model.ResourceReference _ReportingVendor; + private Hl7.Fhir.Model.ResourceReference? _ReportingVendor; /// /// Where the reported data is from. @@ -1584,13 +1527,13 @@ public Hl7.Fhir.Model.ResourceReference ReportingVendor [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// What period the report covers. @@ -1598,13 +1541,13 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("period", InSummary=true, Order=190)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// What parameters were provided to the report. @@ -1613,13 +1556,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Parameters")] [DataMember] - public Hl7.Fhir.Model.ResourceReference InputParameters + public Hl7.Fhir.Model.ResourceReference? InputParameters { get { return _InputParameters; } set { _InputParameters = value; OnPropertyChanged("InputParameters"); } } - private Hl7.Fhir.Model.ResourceReference _InputParameters; + private Hl7.Fhir.Model.ResourceReference? _InputParameters; /// /// What scoring method (e.g. proportion, ratio, continuous-variable). @@ -1627,13 +1570,13 @@ public Hl7.Fhir.Model.ResourceReference InputParameters [FhirElement("scoring", InSummary=true, IsModifier=true, Order=210)] [Binding("MeasureScoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Scoring + public Hl7.Fhir.Model.CodeableConcept? Scoring { get { return _Scoring; } set { _Scoring = value; OnPropertyChanged("Scoring"); } } - private Hl7.Fhir.Model.CodeableConcept _Scoring; + private Hl7.Fhir.Model.CodeableConcept? _Scoring; /// /// increase | decrease. @@ -1641,13 +1584,13 @@ public Hl7.Fhir.Model.CodeableConcept Scoring [FhirElement("improvementNotation", InSummary=true, IsModifier=true, Order=220)] [Binding("MeasureImprovementNotation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ImprovementNotation + public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation { get { return _ImprovementNotation; } set { _ImprovementNotation = value; OnPropertyChanged("ImprovementNotation"); } } - private Hl7.Fhir.Model.CodeableConcept _ImprovementNotation; + private Hl7.Fhir.Model.CodeableConcept? _ImprovementNotation; /// /// Measure results for each group. @@ -1657,11 +1600,11 @@ public Hl7.Fhir.Model.CodeableConcept ImprovementNotation [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; /// /// Additional information collected for the report. @@ -1673,11 +1616,11 @@ public List Group [DataMember] public List SupplementalData { - get { if(_SupplementalData==null) _SupplementalData = new List(); return _SupplementalData; } + get => _SupplementalData ?? new List(); set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } - private List _SupplementalData; + private List? _SupplementalData; /// /// What data was used to calculate the measure score. @@ -1689,41 +1632,37 @@ public List SupplementalData [DataMember] public List EvaluatedResource { - get { if(_EvaluatedResource==null) _EvaluatedResource = new List(); return _EvaluatedResource; } + get => _EvaluatedResource ?? new List(); set { _EvaluatedResource = value; OnPropertyChanged("EvaluatedResource"); } } - private List _EvaluatedResource; + private List? _EvaluatedResource; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MeasureReport; - - if (dest == null) - { + if(other is not MeasureReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(DataUpdateTypeElement != null) dest.DataUpdateTypeElement = (Code)DataUpdateTypeElement.DeepCopyInternal(); - if(MeasureElement != null) dest.MeasureElement = (Hl7.Fhir.Model.Canonical)MeasureElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(Reporter != null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)Reporter.DeepCopyInternal(); - if(ReportingVendor != null) dest.ReportingVendor = (Hl7.Fhir.Model.ResourceReference)ReportingVendor.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(InputParameters != null) dest.InputParameters = (Hl7.Fhir.Model.ResourceReference)InputParameters.DeepCopyInternal(); - if(Scoring != null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)Scoring.DeepCopyInternal(); - if(ImprovementNotation != null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)ImprovementNotation.DeepCopyInternal(); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); - if(SupplementalData.Any()) dest.SupplementalData = new List(SupplementalData.DeepCopyInternal()); - if(EvaluatedResource.Any()) dest.EvaluatedResource = new List(EvaluatedResource.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_DataUpdateTypeElement is not null) dest.DataUpdateTypeElement = (Code)_DataUpdateTypeElement.DeepCopyInternal(); + if(_MeasureElement is not null) dest.MeasureElement = (Hl7.Fhir.Model.Canonical)_MeasureElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_Reporter is not null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)_Reporter.DeepCopyInternal(); + if(_ReportingVendor is not null) dest.ReportingVendor = (Hl7.Fhir.Model.ResourceReference)_ReportingVendor.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_InputParameters is not null) dest.InputParameters = (Hl7.Fhir.Model.ResourceReference)_InputParameters.DeepCopyInternal(); + if(_Scoring is not null) dest.Scoring = (Hl7.Fhir.Model.CodeableConcept)_Scoring.DeepCopyInternal(); + if(_ImprovementNotation is not null) dest.ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)_ImprovementNotation.DeepCopyInternal(); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); + if(_SupplementalData is not null) dest.SupplementalData = new List(_SupplementalData.DeepCopyInternal()); + if(_EvaluatedResource is not null) dest.EvaluatedResource = new List(_EvaluatedResource.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1735,146 +1674,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MeasureReport; - if(otherT == null) return false; + if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DataUpdateTypeElement, otherT.DataUpdateTypeElement)) return false; - if(!comparer.Equals(MeasureElement, otherT.MeasureElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Reporter, otherT.Reporter)) return false; - if(!comparer.Equals(ReportingVendor, otherT.ReportingVendor)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(InputParameters, otherT.InputParameters)) return false; - if(!comparer.Equals(Scoring, otherT.Scoring)) return false; - if(!comparer.Equals(ImprovementNotation, otherT.ImprovementNotation)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; - if(!comparer.ListEquals(SupplementalData, otherT.SupplementalData)) return false; - if(!comparer.ListEquals(EvaluatedResource, otherT.EvaluatedResource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DataUpdateTypeElement, otherT._DataUpdateTypeElement)) return false; + if(!comparer.Equals(_MeasureElement, otherT._MeasureElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Reporter, otherT._Reporter)) return false; + if(!comparer.Equals(_ReportingVendor, otherT._ReportingVendor)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_InputParameters, otherT._InputParameters)) return false; + if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; + if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; + if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; + if(!comparer.ListEquals(_EvaluatedResource, otherT._EvaluatedResource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "dataUpdateType": - value = DataUpdateTypeElement; - return DataUpdateTypeElement is not null; + value = _DataUpdateTypeElement; + return _DataUpdateTypeElement is not null; case "measure": - value = MeasureElement; - return MeasureElement is not null; + value = _MeasureElement; + return _MeasureElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "reporter": - value = Reporter; - return Reporter is not null; + value = _Reporter; + return _Reporter is not null; case "reportingVendor": - value = ReportingVendor; - return ReportingVendor is not null; + value = _ReportingVendor; + return _ReportingVendor is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "inputParameters": - value = InputParameters; - return InputParameters is not null; + value = _InputParameters; + return _InputParameters is not null; case "scoring": - value = Scoring; - return Scoring is not null; + value = _Scoring; + return _Scoring is not null; case "improvementNotation": - value = ImprovementNotation; - return ImprovementNotation is not null; + value = _ImprovementNotation; + return _ImprovementNotation is not null; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; case "supplementalData": - value = SupplementalData; - return SupplementalData?.Any() == true; + value = _SupplementalData; + return _SupplementalData?.Any() == true; case "evaluatedResource": - value = EvaluatedResource; - return EvaluatedResource?.Any() == true; + value = _EvaluatedResource; + return _EvaluatedResource?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "dataUpdateType": - DataUpdateTypeElement = (Code)value; + DataUpdateTypeElement = (Code?)value; return this; case "measure": - MeasureElement = (Hl7.Fhir.Model.Canonical)value; + MeasureElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reporter": - Reporter = (Hl7.Fhir.Model.ResourceReference)value; + Reporter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reportingVendor": - ReportingVendor = (Hl7.Fhir.Model.ResourceReference)value; + ReportingVendor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "inputParameters": - InputParameters = (Hl7.Fhir.Model.ResourceReference)value; + InputParameters = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "scoring": - Scoring = (Hl7.Fhir.Model.CodeableConcept)value; + Scoring = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "improvementNotation": - ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept)value; + ImprovementNotation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; case "supplementalData": - SupplementalData = (List)value; + SupplementalData = (List?)value!; return this; case "evaluatedResource": - EvaluatedResource = (List)value; + EvaluatedResource = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1885,23 +1824,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DataUpdateTypeElement is not null) yield return new KeyValuePair("dataUpdateType",DataUpdateTypeElement); - if (MeasureElement is not null) yield return new KeyValuePair("measure",MeasureElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Reporter is not null) yield return new KeyValuePair("reporter",Reporter); - if (ReportingVendor is not null) yield return new KeyValuePair("reportingVendor",ReportingVendor); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (InputParameters is not null) yield return new KeyValuePair("inputParameters",InputParameters); - if (Scoring is not null) yield return new KeyValuePair("scoring",Scoring); - if (ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",ImprovementNotation); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); - if (SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",SupplementalData); - if (EvaluatedResource?.Any() == true) yield return new KeyValuePair("evaluatedResource",EvaluatedResource); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DataUpdateTypeElement is not null) yield return new KeyValuePair("dataUpdateType",_DataUpdateTypeElement); + if (_MeasureElement is not null) yield return new KeyValuePair("measure",_MeasureElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Reporter is not null) yield return new KeyValuePair("reporter",_Reporter); + if (_ReportingVendor is not null) yield return new KeyValuePair("reportingVendor",_ReportingVendor); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_InputParameters is not null) yield return new KeyValuePair("inputParameters",_InputParameters); + if (_Scoring is not null) yield return new KeyValuePair("scoring",_Scoring); + if (_ImprovementNotation is not null) yield return new KeyValuePair("improvementNotation",_ImprovementNotation); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); + if (_SupplementalData?.Any() == true) yield return new KeyValuePair("supplementalData",_SupplementalData); + if (_EvaluatedResource?.Any() == true) yield return new KeyValuePair("evaluatedResource",_EvaluatedResource); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Medication.cs b/src/Hl7.Fhir.R5/Model/Generated/Medication.cs index e2c58b450..3ea35c0f7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Medication.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -111,26 +114,26 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [Binding("MedicationFormalRepresentation")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// Active ingredient indicator. /// [FhirElement("isActive", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsActiveElement + public Hl7.Fhir.Model.FhirBoolean? IsActiveElement { get { return _IsActiveElement; } set { _IsActiveElement = value; OnPropertyChanged("IsActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _IsActiveElement; /// /// Active ingredient indicator @@ -139,13 +142,10 @@ public Hl7.Fhir.Model.FhirBoolean IsActiveElement [IgnoreDataMember] public bool? IsActive { - get { return IsActiveElement != null ? IsActiveElement.Value : null; } + get => _IsActiveElement?.Value; set { - if (value == null) - IsActiveElement = null; - else - IsActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsActive"); } } @@ -158,27 +158,23 @@ public bool? IsActive [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Strength + public Hl7.Fhir.Model.DataType? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.DataType _Strength; + private Hl7.Fhir.Model.DataType? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(IsActiveElement != null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)IsActiveElement.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.DataType)Strength.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_IsActiveElement is not null) dest.IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)_IsActiveElement.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.DataType)_Strength.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -190,48 +186,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(IsActiveElement, otherT.IsActiveElement)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "isActive": - value = IsActiveElement; - return IsActiveElement is not null; + value = _IsActiveElement; + return _IsActiveElement is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "isActive": - IsActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.DataType)value; + Strength = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -242,9 +238,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (IsActiveElement is not null) yield return new KeyValuePair("isActive",IsActiveElement); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_IsActiveElement is not null) yield return new KeyValuePair("isActive",_IsActiveElement); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); } } @@ -270,28 +266,25 @@ public partial class BatchComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("lotNumber", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// Identifier assigned to batch /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -301,44 +294,37 @@ public string LotNumber /// [FhirElement("expirationDate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpirationDateElement + public Hl7.Fhir.Model.FhirDateTime? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpirationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpirationDateElement; /// /// When batch will expire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ExpirationDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BatchComponent; - - if (dest == null) - { + if(other is not BatchComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)ExpirationDateElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ExpirationDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -350,41 +336,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BatchComponent; - if(otherT == null) return false; + if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpirationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -395,8 +381,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); } } @@ -409,11 +395,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Codes that identify this medication. @@ -421,13 +407,13 @@ public List Identifier [FhirElement("code", InSummary=true, Order=100, FiveWs="FiveWs.class")] [Binding("MedicationFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | inactive | entered-in-error. @@ -436,13 +422,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("MedicationStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -451,13 +437,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Medication.MedicationStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -469,13 +452,13 @@ public Hl7.Fhir.Model.Medication.MedicationStatusCodes? Status [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference MarketingAuthorizationHolder + public Hl7.Fhir.Model.ResourceReference? MarketingAuthorizationHolder { get { return _MarketingAuthorizationHolder; } set { _MarketingAuthorizationHolder = value; OnPropertyChanged("MarketingAuthorizationHolder"); } } - private Hl7.Fhir.Model.ResourceReference _MarketingAuthorizationHolder; + private Hl7.Fhir.Model.ResourceReference? _MarketingAuthorizationHolder; /// /// powder | tablets | capsule +. @@ -483,26 +466,26 @@ public Hl7.Fhir.Model.ResourceReference MarketingAuthorizationHolder [FhirElement("doseForm", Order=130)] [Binding("MedicationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseForm + public Hl7.Fhir.Model.CodeableConcept? DoseForm { get { return _DoseForm; } set { _DoseForm = value; OnPropertyChanged("DoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseForm; + private Hl7.Fhir.Model.CodeableConcept? _DoseForm; /// /// When the specified product code does not infer a package size, this is the specific amount of drug in the product. /// [FhirElement("totalVolume", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Quantity TotalVolume + public Hl7.Fhir.Model.Quantity? TotalVolume { get { return _TotalVolume; } set { _TotalVolume = value; OnPropertyChanged("TotalVolume"); } } - private Hl7.Fhir.Model.Quantity _TotalVolume; + private Hl7.Fhir.Model.Quantity? _TotalVolume; /// /// Active or inactive ingredient. @@ -512,24 +495,24 @@ public Hl7.Fhir.Model.Quantity TotalVolume [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Details about packaged medications. /// [FhirElement("batch", Order=160)] [DataMember] - public Hl7.Fhir.Model.Medication.BatchComponent Batch + public Hl7.Fhir.Model.Medication.BatchComponent? Batch { get { return _Batch; } set { _Batch = value; OnPropertyChanged("Batch"); } } - private Hl7.Fhir.Model.Medication.BatchComponent _Batch; + private Hl7.Fhir.Model.Medication.BatchComponent? _Batch; /// /// Knowledge about this medication. @@ -538,35 +521,31 @@ public Hl7.Fhir.Model.Medication.BatchComponent Batch [CLSCompliant(false)] [References("MedicationKnowledge")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Definition + public Hl7.Fhir.Model.ResourceReference? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.ResourceReference _Definition; + private Hl7.Fhir.Model.ResourceReference? _Definition; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Medication; - - if (dest == null) - { + if(other is not Medication dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(MarketingAuthorizationHolder != null) dest.MarketingAuthorizationHolder = (Hl7.Fhir.Model.ResourceReference)MarketingAuthorizationHolder.DeepCopyInternal(); - if(DoseForm != null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)DoseForm.DeepCopyInternal(); - if(TotalVolume != null) dest.TotalVolume = (Hl7.Fhir.Model.Quantity)TotalVolume.DeepCopyInternal(); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Batch != null) dest.Batch = (Hl7.Fhir.Model.Medication.BatchComponent)Batch.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)Definition.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_MarketingAuthorizationHolder is not null) dest.MarketingAuthorizationHolder = (Hl7.Fhir.Model.ResourceReference)_MarketingAuthorizationHolder.DeepCopyInternal(); + if(_DoseForm is not null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)_DoseForm.DeepCopyInternal(); + if(_TotalVolume is not null) dest.TotalVolume = (Hl7.Fhir.Model.Quantity)_TotalVolume.DeepCopyInternal(); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Batch is not null) dest.Batch = (Hl7.Fhir.Model.Medication.BatchComponent)_Batch.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.ResourceReference)_Definition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -578,90 +557,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Medication; - if(otherT == null) return false; + if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(MarketingAuthorizationHolder, otherT.MarketingAuthorizationHolder)) return false; - if(!comparer.Equals(DoseForm, otherT.DoseForm)) return false; - if(!comparer.Equals(TotalVolume, otherT.TotalVolume)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.Equals(Batch, otherT.Batch)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_MarketingAuthorizationHolder, otherT._MarketingAuthorizationHolder)) return false; + if(!comparer.Equals(_DoseForm, otherT._DoseForm)) return false; + if(!comparer.Equals(_TotalVolume, otherT._TotalVolume)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.Equals(_Batch, otherT._Batch)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "marketingAuthorizationHolder": - value = MarketingAuthorizationHolder; - return MarketingAuthorizationHolder is not null; + value = _MarketingAuthorizationHolder; + return _MarketingAuthorizationHolder is not null; case "doseForm": - value = DoseForm; - return DoseForm is not null; + value = _DoseForm; + return _DoseForm is not null; case "totalVolume": - value = TotalVolume; - return TotalVolume is not null; + value = _TotalVolume; + return _TotalVolume is not null; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "batch": - value = Batch; - return Batch is not null; + value = _Batch; + return _Batch is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "marketingAuthorizationHolder": - MarketingAuthorizationHolder = (Hl7.Fhir.Model.ResourceReference)value; + MarketingAuthorizationHolder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "doseForm": - DoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + DoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "totalVolume": - TotalVolume = (Hl7.Fhir.Model.Quantity)value; + TotalVolume = (Hl7.Fhir.Model.Quantity?)value; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "batch": - Batch = (Hl7.Fhir.Model.Medication.BatchComponent)value; + Batch = (Hl7.Fhir.Model.Medication.BatchComponent?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.ResourceReference)value; + Definition = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -672,15 +651,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (MarketingAuthorizationHolder is not null) yield return new KeyValuePair("marketingAuthorizationHolder",MarketingAuthorizationHolder); - if (DoseForm is not null) yield return new KeyValuePair("doseForm",DoseForm); - if (TotalVolume is not null) yield return new KeyValuePair("totalVolume",TotalVolume); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Batch is not null) yield return new KeyValuePair("batch",Batch); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_MarketingAuthorizationHolder is not null) yield return new KeyValuePair("marketingAuthorizationHolder",_MarketingAuthorizationHolder); + if (_DoseForm is not null) yield return new KeyValuePair("doseForm",_DoseForm); + if (_TotalVolume is not null) yield return new KeyValuePair("totalVolume",_TotalVolume); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Batch is not null) yield return new KeyValuePair("batch",_Batch); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs index 14176ffea..c54b4ed97 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,13 +136,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("MedicationAdministrationPerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who or what performed the medication administration. @@ -147,26 +150,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [FhirElement("actor", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Actor + public Hl7.Fhir.Model.CodeableReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.CodeableReference _Actor; + private Hl7.Fhir.Model.CodeableReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.CodeableReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.CodeableReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -178,41 +177,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.CodeableReference)value; + Actor = (Hl7.Fhir.Model.CodeableReference?)value; return this; default: return base.SetValue(key, value); @@ -223,8 +222,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -250,28 +249,25 @@ public partial class DosageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("text", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Free text dosage instructions e.g. SIG /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -282,13 +278,13 @@ public string Text [FhirElement("site", Order=50)] [Binding("MedicationAdministrationSite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Site + public Hl7.Fhir.Model.CodeableConcept? Site { get { return _Site; } set { _Site = value; OnPropertyChanged("Site"); } } - private Hl7.Fhir.Model.CodeableConcept _Site; + private Hl7.Fhir.Model.CodeableConcept? _Site; /// /// Path of substance into body. @@ -296,13 +292,13 @@ public Hl7.Fhir.Model.CodeableConcept Site [FhirElement("route", Order=60)] [Binding("RouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Route + public Hl7.Fhir.Model.CodeableConcept? Route { get { return _Route; } set { _Route = value; OnPropertyChanged("Route"); } } - private Hl7.Fhir.Model.CodeableConcept _Route; + private Hl7.Fhir.Model.CodeableConcept? _Route; /// /// How drug was administered. @@ -310,26 +306,26 @@ public Hl7.Fhir.Model.CodeableConcept Route [FhirElement("method", Order=70)] [Binding("MedicationAdministrationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Amount of medication per dose. /// [FhirElement("dose", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Dose + public Hl7.Fhir.Model.Quantity? Dose { get { return _Dose; } set { _Dose = value; OnPropertyChanged("Dose"); } } - private Hl7.Fhir.Model.Quantity _Dose; + private Hl7.Fhir.Model.Quantity? _Dose; /// /// Dose quantity per unit of time. @@ -338,30 +334,26 @@ public Hl7.Fhir.Model.Quantity Dose [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as DosageComponent; - - if (dest == null) - { + if(other is not DosageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Site != null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)Site.DeepCopyInternal(); - if(Route != null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)Route.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Dose != null) dest.Dose = (Hl7.Fhir.Model.Quantity)Dose.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Site is not null) dest.Site = (Hl7.Fhir.Model.CodeableConcept)_Site.DeepCopyInternal(); + if(_Route is not null) dest.Route = (Hl7.Fhir.Model.CodeableConcept)_Route.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Dose is not null) dest.Dose = (Hl7.Fhir.Model.Quantity)_Dose.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -373,69 +365,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosageComponent; - if(otherT == null) return false; + if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(Site, otherT.Site)) return false; - if(!comparer.Equals(Route, otherT.Route)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Dose, otherT.Dose)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_Site, otherT._Site)) return false; + if(!comparer.Equals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Dose, otherT._Dose)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "site": - value = Site; - return Site is not null; + value = _Site; + return _Site is not null; case "route": - value = Route; - return Route is not null; + value = _Route; + return _Route is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "dose": - value = Dose; - return Dose is not null; + value = _Dose; + return _Dose is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "site": - Site = (Hl7.Fhir.Model.CodeableConcept)value; + Site = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (Hl7.Fhir.Model.CodeableConcept)value; + Route = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dose": - Dose = (Hl7.Fhir.Model.Quantity)value; + Dose = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -446,12 +438,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Site is not null) yield return new KeyValuePair("site",Site); - if (Route is not null) yield return new KeyValuePair("route",Route); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Dose is not null) yield return new KeyValuePair("dose",Dose); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Site is not null) yield return new KeyValuePair("site",_Site); + if (_Route is not null) yield return new KeyValuePair("route",_Route); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Dose is not null) yield return new KeyValuePair("dose",_Dose); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -464,11 +456,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Plan this is fulfilled by this administration. @@ -480,11 +472,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -496,11 +488,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | not-done | on-hold | completed | entered-in-error | stopped | unknown. @@ -510,13 +502,13 @@ public List PartOf [Binding("MedicationAdministrationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | not-done | on-hold | completed | entered-in-error | stopped | unknown @@ -525,13 +517,10 @@ public Code _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -545,11 +534,11 @@ public Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCod [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// Type of medication administration. @@ -560,11 +549,11 @@ public List StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What was administered. @@ -573,13 +562,13 @@ public List Category [Binding("MedicationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Medication + public Hl7.Fhir.Model.CodeableReference? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.CodeableReference _Medication; + private Hl7.Fhir.Model.CodeableReference? _Medication; /// /// Who received medication. @@ -589,13 +578,13 @@ public Hl7.Fhir.Model.CodeableReference Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter administered as part of. @@ -604,13 +593,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Additional information to support administration. @@ -622,11 +611,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Specific date/time or interval of time during which the administration took place (or did not take place). @@ -636,41 +625,38 @@ public List SupportingInformation [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Occurence + public Hl7.Fhir.Model.DataType? Occurence { get { return _Occurence; } set { _Occurence = value; OnPropertyChanged("Occurence"); } } - private Hl7.Fhir.Model.DataType _Occurence; + private Hl7.Fhir.Model.DataType? _Occurence; /// /// When the MedicationAdministration was first captured in the subject's record. /// [FhirElement("recorded", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedElement + public Hl7.Fhir.Model.FhirDateTime? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedElement; /// /// When the MedicationAdministration was first captured in the subject's record /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Recorded + public string? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Recorded"); } } @@ -680,13 +666,13 @@ public string Recorded /// [FhirElement("isSubPotent", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsSubPotentElement + public Hl7.Fhir.Model.FhirBoolean? IsSubPotentElement { get { return _IsSubPotentElement; } set { _IsSubPotentElement = value; OnPropertyChanged("IsSubPotentElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsSubPotentElement; + private Hl7.Fhir.Model.FhirBoolean? _IsSubPotentElement; /// /// Full dose was not administered @@ -695,13 +681,10 @@ public Hl7.Fhir.Model.FhirBoolean IsSubPotentElement [IgnoreDataMember] public bool? IsSubPotent { - get { return IsSubPotentElement != null ? IsSubPotentElement.Value : null; } + get => _IsSubPotentElement?.Value; set { - if (value == null) - IsSubPotentElement = null; - else - IsSubPotentElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsSubPotentElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsSubPotent"); } } @@ -715,11 +698,11 @@ public bool? IsSubPotent [DataMember] public List SubPotentReason { - get { if(_SubPotentReason==null) _SubPotentReason = new List(); return _SubPotentReason; } + get => _SubPotentReason ?? new List(); set { _SubPotentReason = value; OnPropertyChanged("SubPotentReason"); } } - private List _SubPotentReason; + private List? _SubPotentReason; /// /// Who or what performed the medication administration and what type of performance they did. @@ -729,11 +712,11 @@ public List SubPotentReason [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Concept, condition or observation that supports why the medication was administered. @@ -744,11 +727,11 @@ public List Performe [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Request administration performed against. @@ -757,13 +740,13 @@ public List Reason [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Device used to administer. @@ -773,11 +756,11 @@ public Hl7.Fhir.Model.ResourceReference Request [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// Information about the administration. @@ -787,24 +770,24 @@ public List Device [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Details of how medication was taken. /// [FhirElement("dosage", Order=280)] [DataMember] - public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage + public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage { get { return _Dosage; } set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private Hl7.Fhir.Model.MedicationAdministration.DosageComponent _Dosage; + private Hl7.Fhir.Model.MedicationAdministration.DosageComponent? _Dosage; /// /// A list of events of interest in the lifecycle. @@ -816,45 +799,41 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent Dosage [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationAdministration; - - if (dest == null) - { + if(other is not MedicationAdministration dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Occurence != null) dest.Occurence = (Hl7.Fhir.Model.DataType)Occurence.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)RecordedElement.DeepCopyInternal(); - if(IsSubPotentElement != null) dest.IsSubPotentElement = (Hl7.Fhir.Model.FhirBoolean)IsSubPotentElement.DeepCopyInternal(); - if(SubPotentReason.Any()) dest.SubPotentReason = new List(SubPotentReason.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Dosage != null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)Dosage.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Occurence is not null) dest.Occurence = (Hl7.Fhir.Model.DataType)_Occurence.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedElement.DeepCopyInternal(); + if(_IsSubPotentElement is not null) dest.IsSubPotentElement = (Hl7.Fhir.Model.FhirBoolean)_IsSubPotentElement.DeepCopyInternal(); + if(_SubPotentReason is not null) dest.SubPotentReason = new List(_SubPotentReason.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Dosage is not null) dest.Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)_Dosage.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -866,174 +845,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationAdministration; - if(otherT == null) return false; + if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(Occurence, otherT.Occurence)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(IsSubPotentElement, otherT.IsSubPotentElement)) return false; - if(!comparer.ListEquals(SubPotentReason, otherT.SubPotentReason)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(Dosage, otherT.Dosage)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_Occurence, otherT._Occurence)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_IsSubPotentElement, otherT._IsSubPotentElement)) return false; + if(!comparer.ListEquals(_SubPotentReason, otherT._SubPotentReason)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "occurence": - value = Occurence; - return Occurence is not null; + value = _Occurence; + return _Occurence is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "isSubPotent": - value = IsSubPotentElement; - return IsSubPotentElement is not null; + value = _IsSubPotentElement; + return _IsSubPotentElement is not null; case "subPotentReason": - value = SubPotentReason; - return SubPotentReason?.Any() == true; + value = _SubPotentReason; + return _SubPotentReason?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "dosage": - value = Dosage; - return Dosage is not null; + value = _Dosage; + return _Dosage is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "medication": - Medication = (Hl7.Fhir.Model.CodeableReference)value; + Medication = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "occurence": - Occurence = (Hl7.Fhir.Model.DataType)value; + Occurence = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "isSubPotent": - IsSubPotentElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsSubPotentElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subPotentReason": - SubPotentReason = (List)value; + SubPotentReason = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "dosage": - Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent)value; + Dosage = (Hl7.Fhir.Model.MedicationAdministration.DosageComponent?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1044,27 +1023,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Occurence is not null) yield return new KeyValuePair("occurence",Occurence); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (IsSubPotentElement is not null) yield return new KeyValuePair("isSubPotent",IsSubPotentElement); - if (SubPotentReason?.Any() == true) yield return new KeyValuePair("subPotentReason",SubPotentReason); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Dosage is not null) yield return new KeyValuePair("dosage",Dosage); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Occurence is not null) yield return new KeyValuePair("occurence",_Occurence); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_IsSubPotentElement is not null) yield return new KeyValuePair("isSubPotent",_IsSubPotentElement); + if (_SubPotentReason?.Any() == true) yield return new KeyValuePair("subPotentReason",_SubPotentReason); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Dosage is not null) yield return new KeyValuePair("dosage",_Dosage); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs index b3e928e3a..b7d7754dc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -145,13 +148,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("MedicationDispensePerformerFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Individual who was performing. @@ -161,26 +164,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","Device","RelatedPerson","CareTeam")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -192,41 +191,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -237,8 +236,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -265,13 +264,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("wasSubstituted", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement + public Hl7.Fhir.Model.FhirBoolean? WasSubstitutedElement { get { return _WasSubstitutedElement; } set { _WasSubstitutedElement = value; OnPropertyChanged("WasSubstitutedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WasSubstitutedElement; + private Hl7.Fhir.Model.FhirBoolean? _WasSubstitutedElement; /// /// Whether a substitution was or was not performed on the dispense @@ -280,13 +279,10 @@ public Hl7.Fhir.Model.FhirBoolean WasSubstitutedElement [IgnoreDataMember] public bool? WasSubstituted { - get { return WasSubstitutedElement != null ? WasSubstitutedElement.Value : null; } + get => _WasSubstitutedElement?.Value; set { - if (value == null) - WasSubstitutedElement = null; - else - WasSubstitutedElement = new Hl7.Fhir.Model.FhirBoolean(value); + WasSubstitutedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WasSubstituted"); } } @@ -297,13 +293,13 @@ public bool? WasSubstituted [FhirElement("type", Order=50)] [Binding("MedicationIntendedSubstitutionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Why was substitution made. @@ -314,11 +310,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Who is responsible for the substitution. @@ -327,28 +323,24 @@ public List Reason [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ResponsibleParty + public Hl7.Fhir.Model.ResourceReference? ResponsibleParty { get { return _ResponsibleParty; } set { _ResponsibleParty = value; OnPropertyChanged("ResponsibleParty"); } } - private Hl7.Fhir.Model.ResourceReference _ResponsibleParty; + private Hl7.Fhir.Model.ResourceReference? _ResponsibleParty; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(WasSubstitutedElement != null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)WasSubstitutedElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(ResponsibleParty != null) dest.ResponsibleParty = (Hl7.Fhir.Model.ResourceReference)ResponsibleParty.DeepCopyInternal(); + if(_WasSubstitutedElement is not null) dest.WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)_WasSubstitutedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_ResponsibleParty is not null) dest.ResponsibleParty = (Hl7.Fhir.Model.ResourceReference)_ResponsibleParty.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -360,55 +352,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(WasSubstitutedElement, otherT.WasSubstitutedElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(ResponsibleParty, otherT.ResponsibleParty)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_ResponsibleParty, otherT._ResponsibleParty)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "wasSubstituted": - value = WasSubstitutedElement; - return WasSubstitutedElement is not null; + value = _WasSubstitutedElement; + return _WasSubstitutedElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "responsibleParty": - value = ResponsibleParty; - return ResponsibleParty is not null; + value = _ResponsibleParty; + return _ResponsibleParty is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "wasSubstituted": - WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean)value; + WasSubstitutedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "responsibleParty": - ResponsibleParty = (Hl7.Fhir.Model.ResourceReference)value; + ResponsibleParty = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -419,10 +411,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",WasSubstitutedElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (ResponsibleParty is not null) yield return new KeyValuePair("responsibleParty",ResponsibleParty); + if (_WasSubstitutedElement is not null) yield return new KeyValuePair("wasSubstituted",_WasSubstitutedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_ResponsibleParty is not null) yield return new KeyValuePair("responsibleParty",_ResponsibleParty); } } @@ -435,11 +427,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Plan that is fulfilled by this dispense. @@ -451,11 +443,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Event that dispense is part of. @@ -467,11 +459,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown. @@ -481,13 +473,13 @@ public List PartOf [Binding("MedicationDispenseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown @@ -496,13 +488,10 @@ public Code Sta [IgnoreDataMember] public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -513,41 +502,38 @@ public Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes? Status [FhirElement("notPerformedReason", Order=130)] [Binding("MedicationDispenseStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableReference NotPerformedReason + public Hl7.Fhir.Model.CodeableReference? NotPerformedReason { get { return _NotPerformedReason; } set { _NotPerformedReason = value; OnPropertyChanged("NotPerformedReason"); } } - private Hl7.Fhir.Model.CodeableReference _NotPerformedReason; + private Hl7.Fhir.Model.CodeableReference? _NotPerformedReason; /// /// When the status changed. /// [FhirElement("statusChanged", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusChangedElement + public Hl7.Fhir.Model.FhirDateTime? StatusChangedElement { get { return _StatusChangedElement; } set { _StatusChangedElement = value; OnPropertyChanged("StatusChangedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusChangedElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusChangedElement; /// /// When the status changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusChanged + public string? StatusChanged { - get { return StatusChangedElement != null ? StatusChangedElement.Value : null; } + get => _StatusChangedElement?.Value; set { - if (value == null) - StatusChangedElement = null; - else - StatusChangedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusChangedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusChanged"); } } @@ -561,11 +547,11 @@ public string StatusChanged [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What medication was supplied. @@ -574,13 +560,13 @@ public List Category [Binding("MedicationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Medication + public Hl7.Fhir.Model.CodeableReference? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.CodeableReference _Medication; + private Hl7.Fhir.Model.CodeableReference? _Medication; /// /// Who the dispense is for. @@ -590,13 +576,13 @@ public Hl7.Fhir.Model.CodeableReference Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter associated with event. @@ -605,13 +591,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Information that supports the dispensing of the medication. @@ -623,11 +609,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Who performed event. @@ -637,11 +623,11 @@ public List SupportingInformation [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the dispense occurred. @@ -650,13 +636,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Medication order that authorizes the dispense. @@ -668,11 +654,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List AuthorizingPrescription { - get { if(_AuthorizingPrescription==null) _AuthorizingPrescription = new List(); return _AuthorizingPrescription; } + get => _AuthorizingPrescription ?? new List(); set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } - private List _AuthorizingPrescription; + private List? _AuthorizingPrescription; /// /// Trial fill, partial fill, emergency fill, etc. @@ -680,67 +666,64 @@ public List AuthorizingPrescription [FhirElement("type", Order=230)] [Binding("MedicationDispenseType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Amount dispensed. /// [FhirElement("quantity", Order=240)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Amount of medication expressed as a timing amount. /// [FhirElement("daysSupply", Order=250)] [DataMember] - public Hl7.Fhir.Model.Quantity DaysSupply + public Hl7.Fhir.Model.Quantity? DaysSupply { get { return _DaysSupply; } set { _DaysSupply = value; OnPropertyChanged("DaysSupply"); } } - private Hl7.Fhir.Model.Quantity _DaysSupply; + private Hl7.Fhir.Model.Quantity? _DaysSupply; /// /// When the recording of the dispense started. /// [FhirElement("recorded", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedElement + public Hl7.Fhir.Model.FhirDateTime? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedElement; /// /// When the recording of the dispense started /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Recorded + public string? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Recorded"); } } @@ -750,28 +733,25 @@ public string Recorded /// [FhirElement("whenPrepared", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenPreparedElement + public Hl7.Fhir.Model.FhirDateTime? WhenPreparedElement { get { return _WhenPreparedElement; } set { _WhenPreparedElement = value; OnPropertyChanged("WhenPreparedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenPreparedElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenPreparedElement; /// /// When product was packaged and reviewed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenPrepared + public string? WhenPrepared { - get { return WhenPreparedElement != null ? WhenPreparedElement.Value : null; } + get => _WhenPreparedElement?.Value; set { - if (value == null) - WhenPreparedElement = null; - else - WhenPreparedElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenPreparedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenPrepared"); } } @@ -781,28 +761,25 @@ public string WhenPrepared /// [FhirElement("whenHandedOver", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime WhenHandedOverElement + public Hl7.Fhir.Model.FhirDateTime? WhenHandedOverElement { get { return _WhenHandedOverElement; } set { _WhenHandedOverElement = value; OnPropertyChanged("WhenHandedOverElement"); } } - private Hl7.Fhir.Model.FhirDateTime _WhenHandedOverElement; + private Hl7.Fhir.Model.FhirDateTime? _WhenHandedOverElement; /// /// When product was given out /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string WhenHandedOver + public string? WhenHandedOver { - get { return WhenHandedOverElement != null ? WhenHandedOverElement.Value : null; } + get => _WhenHandedOverElement?.Value; set { - if (value == null) - WhenHandedOverElement = null; - else - WhenHandedOverElement = new Hl7.Fhir.Model.FhirDateTime(value); + WhenHandedOverElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("WhenHandedOver"); } } @@ -814,13 +791,13 @@ public string WhenHandedOver [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who collected the medication or where the medication was delivered. @@ -832,11 +809,11 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; /// /// Information about the dispense. @@ -846,39 +823,36 @@ public List Receiver [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Full representation of the dosage instructions. /// [FhirElement("renderedDosageInstruction", Order=320)] [DataMember] - public Hl7.Fhir.Model.Markdown RenderedDosageInstructionElement + public Hl7.Fhir.Model.Markdown? RenderedDosageInstructionElement { get { return _RenderedDosageInstructionElement; } set { _RenderedDosageInstructionElement = value; OnPropertyChanged("RenderedDosageInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _RenderedDosageInstructionElement; + private Hl7.Fhir.Model.Markdown? _RenderedDosageInstructionElement; /// /// Full representation of the dosage instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RenderedDosageInstruction + public string? RenderedDosageInstruction { - get { return RenderedDosageInstructionElement != null ? RenderedDosageInstructionElement.Value : null; } + get => _RenderedDosageInstructionElement?.Value; set { - if (value == null) - RenderedDosageInstructionElement = null; - else - RenderedDosageInstructionElement = new Hl7.Fhir.Model.Markdown(value); + RenderedDosageInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("RenderedDosageInstruction"); } } @@ -891,24 +865,24 @@ public string RenderedDosageInstruction [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Whether a substitution was performed on the dispense. /// [FhirElement("substitution", Order=340)] [DataMember] - public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? _Substitution; /// /// A list of relevant lifecycle events. @@ -920,51 +894,47 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent Substitution [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationDispense; - - if (dest == null) - { + if(other is not MedicationDispense dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(NotPerformedReason != null) dest.NotPerformedReason = (Hl7.Fhir.Model.CodeableReference)NotPerformedReason.DeepCopyInternal(); - if(StatusChangedElement != null) dest.StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime)StatusChangedElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(AuthorizingPrescription.Any()) dest.AuthorizingPrescription = new List(AuthorizingPrescription.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(DaysSupply != null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)DaysSupply.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)RecordedElement.DeepCopyInternal(); - if(WhenPreparedElement != null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)WhenPreparedElement.DeepCopyInternal(); - if(WhenHandedOverElement != null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RenderedDosageInstructionElement != null) dest.RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)RenderedDosageInstructionElement.DeepCopyInternal(); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_NotPerformedReason is not null) dest.NotPerformedReason = (Hl7.Fhir.Model.CodeableReference)_NotPerformedReason.DeepCopyInternal(); + if(_StatusChangedElement is not null) dest.StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime)_StatusChangedElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_AuthorizingPrescription is not null) dest.AuthorizingPrescription = new List(_AuthorizingPrescription.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_DaysSupply is not null) dest.DaysSupply = (Hl7.Fhir.Model.Quantity)_DaysSupply.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedElement.DeepCopyInternal(); + if(_WhenPreparedElement is not null) dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)_WhenPreparedElement.DeepCopyInternal(); + if(_WhenHandedOverElement is not null) dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)_WhenHandedOverElement.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RenderedDosageInstructionElement is not null) dest.RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)_RenderedDosageInstructionElement.DeepCopyInternal(); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -976,216 +946,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationDispense; - if(otherT == null) return false; + if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(NotPerformedReason, otherT.NotPerformedReason)) return false; - if(!comparer.Equals(StatusChangedElement, otherT.StatusChangedElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(AuthorizingPrescription, otherT.AuthorizingPrescription)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(DaysSupply, otherT.DaysSupply)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(WhenPreparedElement, otherT.WhenPreparedElement)) return false; - if(!comparer.Equals(WhenHandedOverElement, otherT.WhenHandedOverElement)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(RenderedDosageInstructionElement, otherT.RenderedDosageInstructionElement)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_NotPerformedReason, otherT._NotPerformedReason)) return false; + if(!comparer.Equals(_StatusChangedElement, otherT._StatusChangedElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_AuthorizingPrescription, otherT._AuthorizingPrescription)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_DaysSupply, otherT._DaysSupply)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_WhenPreparedElement, otherT._WhenPreparedElement)) return false; + if(!comparer.Equals(_WhenHandedOverElement, otherT._WhenHandedOverElement)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_RenderedDosageInstructionElement, otherT._RenderedDosageInstructionElement)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "notPerformedReason": - value = NotPerformedReason; - return NotPerformedReason is not null; + value = _NotPerformedReason; + return _NotPerformedReason is not null; case "statusChanged": - value = StatusChangedElement; - return StatusChangedElement is not null; + value = _StatusChangedElement; + return _StatusChangedElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "authorizingPrescription": - value = AuthorizingPrescription; - return AuthorizingPrescription?.Any() == true; + value = _AuthorizingPrescription; + return _AuthorizingPrescription?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "daysSupply": - value = DaysSupply; - return DaysSupply is not null; + value = _DaysSupply; + return _DaysSupply is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "whenPrepared": - value = WhenPreparedElement; - return WhenPreparedElement is not null; + value = _WhenPreparedElement; + return _WhenPreparedElement is not null; case "whenHandedOver": - value = WhenHandedOverElement; - return WhenHandedOverElement is not null; + value = _WhenHandedOverElement; + return _WhenHandedOverElement is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "renderedDosageInstruction": - value = RenderedDosageInstructionElement; - return RenderedDosageInstructionElement is not null; + value = _RenderedDosageInstructionElement; + return _RenderedDosageInstructionElement is not null; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "notPerformedReason": - NotPerformedReason = (Hl7.Fhir.Model.CodeableReference)value; + NotPerformedReason = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "statusChanged": - StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "medication": - Medication = (Hl7.Fhir.Model.CodeableReference)value; + Medication = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authorizingPrescription": - AuthorizingPrescription = (List)value; + AuthorizingPrescription = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "daysSupply": - DaysSupply = (Hl7.Fhir.Model.Quantity)value; + DaysSupply = (Hl7.Fhir.Model.Quantity?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "whenPrepared": - WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "whenHandedOver": - WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)value; + WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "renderedDosageInstruction": - RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)value; + RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1196,33 +1166,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (NotPerformedReason is not null) yield return new KeyValuePair("notPerformedReason",NotPerformedReason); - if (StatusChangedElement is not null) yield return new KeyValuePair("statusChanged",StatusChangedElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",AuthorizingPrescription); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (DaysSupply is not null) yield return new KeyValuePair("daysSupply",DaysSupply); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",WhenPreparedElement); - if (WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",WhenHandedOverElement); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RenderedDosageInstructionElement is not null) yield return new KeyValuePair("renderedDosageInstruction",RenderedDosageInstructionElement); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_NotPerformedReason is not null) yield return new KeyValuePair("notPerformedReason",_NotPerformedReason); + if (_StatusChangedElement is not null) yield return new KeyValuePair("statusChanged",_StatusChangedElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_AuthorizingPrescription?.Any() == true) yield return new KeyValuePair("authorizingPrescription",_AuthorizingPrescription); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_DaysSupply is not null) yield return new KeyValuePair("daysSupply",_DaysSupply); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_WhenPreparedElement is not null) yield return new KeyValuePair("whenPrepared",_WhenPreparedElement); + if (_WhenHandedOverElement is not null) yield return new KeyValuePair("whenHandedOver",_WhenHandedOverElement); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RenderedDosageInstructionElement is not null) yield return new KeyValuePair("renderedDosageInstruction",_RenderedDosageInstructionElement); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs index d2fd048b4..f767f7e1b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,13 +112,13 @@ public partial class RelatedMedicationKnowledgeComponent : Hl7.Fhir.Model.Backbo [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Associated documentation about the associated medication knowledge. @@ -127,24 +130,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Reference { - get { if(_Reference==null) _Reference = new List(); return _Reference; } + get => _Reference ?? new List(); set { _Reference = value; OnPropertyChanged("Reference"); } } - private List _Reference; + private List? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedMedicationKnowledgeComponent; - - if (dest == null) - { + if(other is not RelatedMedicationKnowledgeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Reference.Any()) dest.Reference = new List(Reference.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = new List(_Reference.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -156,41 +155,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedMedicationKnowledgeComponent; - if(otherT == null) return false; + if(other is not RelatedMedicationKnowledgeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "reference": - value = Reference; - return Reference?.Any() == true; + value = _Reference; + return _Reference?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reference": - Reference = (List)value; + Reference = (List?)value!; return this; default: return base.SetValue(key, value); @@ -201,8 +200,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Reference?.Any() == true) yield return new KeyValuePair("reference",Reference); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Reference?.Any() == true) yield return new KeyValuePair("reference",_Reference); } } @@ -225,13 +224,13 @@ public partial class MonographComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Associated documentation about the medication. @@ -240,26 +239,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("DocumentReference")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as MonographComponent; - - if (dest == null) - { + if(other is not MonographComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -271,41 +266,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonographComponent; - if(otherT == null) return false; + if(other is not MonographComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -316,8 +311,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Source is not null) yield return new KeyValuePair("source",Source); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Source is not null) yield return new KeyValuePair("source",_Source); } } @@ -346,11 +341,11 @@ public partial class CostComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List EffectiveDate { - get { if(_EffectiveDate==null) _EffectiveDate = new List(); return _EffectiveDate; } + get => _EffectiveDate ?? new List(); set { _EffectiveDate = value; OnPropertyChanged("EffectiveDate"); } } - private List _EffectiveDate; + private List? _EffectiveDate; /// /// The category of the cost information. @@ -358,41 +353,38 @@ public List EffectiveDate [FhirElement("type", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The source or owner for the price information. /// [FhirElement("source", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// The source or owner for the price information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -406,28 +398,24 @@ public string Source [AllowedTypes(typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Cost + public Hl7.Fhir.Model.DataType? Cost { get { return _Cost; } set { _Cost = value; OnPropertyChanged("Cost"); } } - private Hl7.Fhir.Model.DataType _Cost; + private Hl7.Fhir.Model.DataType? _Cost; protected internal override void CopyToInternal(Base other) { - var dest = other as CostComponent; - - if (dest == null) - { + if(other is not CostComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(EffectiveDate.Any()) dest.EffectiveDate = new List(EffectiveDate.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(Cost != null) dest.Cost = (Hl7.Fhir.Model.DataType)Cost.DeepCopyInternal(); + if(_EffectiveDate is not null) dest.EffectiveDate = new List(_EffectiveDate.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = (Hl7.Fhir.Model.DataType)_Cost.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -439,55 +427,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CostComponent; - if(otherT == null) return false; + if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(EffectiveDate, otherT.EffectiveDate)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(Cost, otherT.Cost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EffectiveDate, otherT._EffectiveDate)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_Cost, otherT._Cost)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "effectiveDate": - value = EffectiveDate; - return EffectiveDate?.Any() == true; + value = _EffectiveDate; + return _EffectiveDate?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "cost": - value = Cost; - return Cost is not null; + value = _Cost; + return _Cost is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "effectiveDate": - EffectiveDate = (List)value; + EffectiveDate = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cost": - Cost = (Hl7.Fhir.Model.DataType)value; + Cost = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -498,10 +486,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (EffectiveDate?.Any() == true) yield return new KeyValuePair("effectiveDate",EffectiveDate); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (Cost is not null) yield return new KeyValuePair("cost",Cost); + if (_EffectiveDate?.Any() == true) yield return new KeyValuePair("effectiveDate",_EffectiveDate); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_Cost is not null) yield return new KeyValuePair("cost",_Cost); } } @@ -527,57 +515,50 @@ public partial class MonitoringProgramComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Name of the reviewing program. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of the reviewing program /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MonitoringProgramComponent; - - if (dest == null) - { + if(other is not MonitoringProgramComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -589,41 +570,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonitoringProgramComponent; - if(otherT == null) return false; + if(other is not MonitoringProgramComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -634,8 +615,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); } } @@ -664,11 +645,11 @@ public partial class IndicationGuidelineComponent : Hl7.Fhir.Model.BackboneEleme [DataMember] public List Indication { - get { if(_Indication==null) _Indication = new List(); return _Indication; } + get => _Indication ?? new List(); set { _Indication = value; OnPropertyChanged("Indication"); } } - private List _Indication; + private List? _Indication; /// /// Guidelines for dosage of the medication. @@ -678,24 +659,20 @@ public List Indication [DataMember] public List DosingGuideline { - get { if(_DosingGuideline==null) _DosingGuideline = new List(); return _DosingGuideline; } + get => _DosingGuideline ?? new List(); set { _DosingGuideline = value; OnPropertyChanged("DosingGuideline"); } } - private List _DosingGuideline; + private List? _DosingGuideline; protected internal override void CopyToInternal(Base other) { - var dest = other as IndicationGuidelineComponent; - - if (dest == null) - { + if(other is not IndicationGuidelineComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Indication.Any()) dest.Indication = new List(Indication.DeepCopyInternal()); - if(DosingGuideline.Any()) dest.DosingGuideline = new List(DosingGuideline.DeepCopyInternal()); + if(_Indication is not null) dest.Indication = new List(_Indication.DeepCopyInternal()); + if(_DosingGuideline is not null) dest.DosingGuideline = new List(_DosingGuideline.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -707,41 +684,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IndicationGuidelineComponent; - if(otherT == null) return false; + if(other is not IndicationGuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Indication, otherT.Indication)) return false; - if(!comparer.ListEquals(DosingGuideline, otherT.DosingGuideline)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + if(!comparer.ListEquals(_DosingGuideline, otherT._DosingGuideline)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "indication": - value = Indication; - return Indication?.Any() == true; + value = _Indication; + return _Indication?.Any() == true; case "dosingGuideline": - value = DosingGuideline; - return DosingGuideline?.Any() == true; + value = _DosingGuideline; + return _DosingGuideline?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "indication": - Indication = (List)value; + Indication = (List?)value!; return this; case "dosingGuideline": - DosingGuideline = (List)value; + DosingGuideline = (List?)value!; return this; default: return base.SetValue(key, value); @@ -752,8 +729,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Indication?.Any() == true) yield return new KeyValuePair("indication",Indication); - if (DosingGuideline?.Any() == true) yield return new KeyValuePair("dosingGuideline",DosingGuideline); + if (_Indication?.Any() == true) yield return new KeyValuePair("indication",_Indication); + if (_DosingGuideline?.Any() == true) yield return new KeyValuePair("dosingGuideline",_DosingGuideline); } } @@ -779,13 +756,13 @@ public partial class DosingGuidelineComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("treatmentIntent", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TreatmentIntent + public Hl7.Fhir.Model.CodeableConcept? TreatmentIntent { get { return _TreatmentIntent; } set { _TreatmentIntent = value; OnPropertyChanged("TreatmentIntent"); } } - private Hl7.Fhir.Model.CodeableConcept _TreatmentIntent; + private Hl7.Fhir.Model.CodeableConcept? _TreatmentIntent; /// /// Dosage for the medication for the specific guidelines. @@ -795,24 +772,24 @@ public Hl7.Fhir.Model.CodeableConcept TreatmentIntent [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// Type of treatment the guideline applies to. /// [FhirElement("administrationTreatment", Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdministrationTreatment + public Hl7.Fhir.Model.CodeableConcept? AdministrationTreatment { get { return _AdministrationTreatment; } set { _AdministrationTreatment = value; OnPropertyChanged("AdministrationTreatment"); } } - private Hl7.Fhir.Model.CodeableConcept _AdministrationTreatment; + private Hl7.Fhir.Model.CodeableConcept? _AdministrationTreatment; /// /// Characteristics of the patient that are relevant to the administration guidelines. @@ -822,26 +799,22 @@ public Hl7.Fhir.Model.CodeableConcept AdministrationTreatment [DataMember] public List PatientCharacteristic { - get { if(_PatientCharacteristic==null) _PatientCharacteristic = new List(); return _PatientCharacteristic; } + get => _PatientCharacteristic ?? new List(); set { _PatientCharacteristic = value; OnPropertyChanged("PatientCharacteristic"); } } - private List _PatientCharacteristic; + private List? _PatientCharacteristic; protected internal override void CopyToInternal(Base other) { - var dest = other as DosingGuidelineComponent; - - if (dest == null) - { + if(other is not DosingGuidelineComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TreatmentIntent != null) dest.TreatmentIntent = (Hl7.Fhir.Model.CodeableConcept)TreatmentIntent.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(AdministrationTreatment != null) dest.AdministrationTreatment = (Hl7.Fhir.Model.CodeableConcept)AdministrationTreatment.DeepCopyInternal(); - if(PatientCharacteristic.Any()) dest.PatientCharacteristic = new List(PatientCharacteristic.DeepCopyInternal()); + if(_TreatmentIntent is not null) dest.TreatmentIntent = (Hl7.Fhir.Model.CodeableConcept)_TreatmentIntent.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_AdministrationTreatment is not null) dest.AdministrationTreatment = (Hl7.Fhir.Model.CodeableConcept)_AdministrationTreatment.DeepCopyInternal(); + if(_PatientCharacteristic is not null) dest.PatientCharacteristic = new List(_PatientCharacteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -853,55 +826,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosingGuidelineComponent; - if(otherT == null) return false; + if(other is not DosingGuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TreatmentIntent, otherT.TreatmentIntent)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.Equals(AdministrationTreatment, otherT.AdministrationTreatment)) return false; - if(!comparer.ListEquals(PatientCharacteristic, otherT.PatientCharacteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TreatmentIntent, otherT._TreatmentIntent)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.Equals(_AdministrationTreatment, otherT._AdministrationTreatment)) return false; + if(!comparer.ListEquals(_PatientCharacteristic, otherT._PatientCharacteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "treatmentIntent": - value = TreatmentIntent; - return TreatmentIntent is not null; + value = _TreatmentIntent; + return _TreatmentIntent is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "administrationTreatment": - value = AdministrationTreatment; - return AdministrationTreatment is not null; + value = _AdministrationTreatment; + return _AdministrationTreatment is not null; case "patientCharacteristic": - value = PatientCharacteristic; - return PatientCharacteristic?.Any() == true; + value = _PatientCharacteristic; + return _PatientCharacteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "treatmentIntent": - TreatmentIntent = (Hl7.Fhir.Model.CodeableConcept)value; + TreatmentIntent = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "administrationTreatment": - AdministrationTreatment = (Hl7.Fhir.Model.CodeableConcept)value; + AdministrationTreatment = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patientCharacteristic": - PatientCharacteristic = (List)value; + PatientCharacteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -912,10 +885,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TreatmentIntent is not null) yield return new KeyValuePair("treatmentIntent",TreatmentIntent); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (AdministrationTreatment is not null) yield return new KeyValuePair("administrationTreatment",AdministrationTreatment); - if (PatientCharacteristic?.Any() == true) yield return new KeyValuePair("patientCharacteristic",PatientCharacteristic); + if (_TreatmentIntent is not null) yield return new KeyValuePair("treatmentIntent",_TreatmentIntent); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_AdministrationTreatment is not null) yield return new KeyValuePair("administrationTreatment",_AdministrationTreatment); + if (_PatientCharacteristic?.Any() == true) yield return new KeyValuePair("patientCharacteristic",_PatientCharacteristic); } } @@ -939,13 +912,13 @@ public partial class DosageComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Dosage for the medication for the specific guidelines. @@ -955,24 +928,20 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; protected internal override void CopyToInternal(Base other) { - var dest = other as DosageComponent; - - if (dest == null) - { + if(other is not DosageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -984,41 +953,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DosageComponent; - if(otherT == null) return false; + if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1029,8 +998,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); } } @@ -1057,13 +1026,13 @@ public partial class PatientCharacteristicComponent : Hl7.Fhir.Model.BackboneEle [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The specific characteristic. @@ -1072,26 +1041,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PatientCharacteristicComponent; - - if (dest == null) - { + if(other is not PatientCharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1103,41 +1068,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PatientCharacteristicComponent; - if(otherT == null) return false; + if(other is not PatientCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1148,8 +1113,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1173,13 +1138,13 @@ public partial class MedicineClassificationComponent : Hl7.Fhir.Model.BackboneEl [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The source of the classification. @@ -1188,13 +1153,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; /// /// Specific category assigned to the medication. @@ -1204,25 +1169,21 @@ public Hl7.Fhir.Model.DataType Source [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; protected internal override void CopyToInternal(Base other) { - var dest = other as MedicineClassificationComponent; - - if (dest == null) - { + if(other is not MedicineClassificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1234,48 +1195,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicineClassificationComponent; - if(otherT == null) return false; + if(other is not MedicineClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1286,9 +1247,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); } } @@ -1317,11 +1278,11 @@ public partial class PackagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Cost { - get { if(_Cost==null) _Cost = new List(); return _Cost; } + get => _Cost ?? new List(); set { _Cost = value; OnPropertyChanged("Cost"); } } - private List _Cost; + private List? _Cost; /// /// The packaged medication that is being priced. @@ -1330,26 +1291,22 @@ public List Cost [CLSCompliant(false)] [References("PackagedProductDefinition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PackagedProduct + public Hl7.Fhir.Model.ResourceReference? PackagedProduct { get { return _PackagedProduct; } set { _PackagedProduct = value; OnPropertyChanged("PackagedProduct"); } } - private Hl7.Fhir.Model.ResourceReference _PackagedProduct; + private Hl7.Fhir.Model.ResourceReference? _PackagedProduct; protected internal override void CopyToInternal(Base other) { - var dest = other as PackagingComponent; - - if (dest == null) - { + if(other is not PackagingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Cost.Any()) dest.Cost = new List(Cost.DeepCopyInternal()); - if(PackagedProduct != null) dest.PackagedProduct = (Hl7.Fhir.Model.ResourceReference)PackagedProduct.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = new List(_Cost.DeepCopyInternal()); + if(_PackagedProduct is not null) dest.PackagedProduct = (Hl7.Fhir.Model.ResourceReference)_PackagedProduct.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1361,41 +1318,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagingComponent; - if(otherT == null) return false; + if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Cost, otherT.Cost)) return false; - if(!comparer.Equals(PackagedProduct, otherT.PackagedProduct)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; + if(!comparer.Equals(_PackagedProduct, otherT._PackagedProduct)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "cost": - value = Cost; - return Cost?.Any() == true; + value = _Cost; + return _Cost?.Any() == true; case "packagedProduct": - value = PackagedProduct; - return PackagedProduct is not null; + value = _PackagedProduct; + return _PackagedProduct is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "cost": - Cost = (List)value; + Cost = (List?)value!; return this; case "packagedProduct": - PackagedProduct = (Hl7.Fhir.Model.ResourceReference)value; + PackagedProduct = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1406,8 +1363,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Cost?.Any() == true) yield return new KeyValuePair("cost",Cost); - if (PackagedProduct is not null) yield return new KeyValuePair("packagedProduct",PackagedProduct); + if (_Cost?.Any() == true) yield return new KeyValuePair("cost",_Cost); + if (_PackagedProduct is not null) yield return new KeyValuePair("packagedProduct",_PackagedProduct); } } @@ -1433,28 +1390,25 @@ public partial class StorageGuidelineComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("reference", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirUri ReferenceElement + public Hl7.Fhir.Model.FhirUri? ReferenceElement { get { return _ReferenceElement; } set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private Hl7.Fhir.Model.FhirUri _ReferenceElement; + private Hl7.Fhir.Model.FhirUri? _ReferenceElement; /// /// Reference to additional information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reference + public string? Reference { - get { return ReferenceElement != null ? ReferenceElement.Value : null; } + get => _ReferenceElement?.Value; set { - if (value == null) - ReferenceElement = null; - else - ReferenceElement = new Hl7.Fhir.Model.FhirUri(value); + ReferenceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Reference"); } } @@ -1467,24 +1421,24 @@ public string Reference [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Duration remains stable. /// [FhirElement("stabilityDuration", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration StabilityDuration + public Hl7.Fhir.Model.Duration? StabilityDuration { get { return _StabilityDuration; } set { _StabilityDuration = value; OnPropertyChanged("StabilityDuration"); } } - private Hl7.Fhir.Model.Duration _StabilityDuration; + private Hl7.Fhir.Model.Duration? _StabilityDuration; /// /// Setting or value of environment for adequate storage. @@ -1494,26 +1448,22 @@ public Hl7.Fhir.Model.Duration StabilityDuration [DataMember] public List EnvironmentalSetting { - get { if(_EnvironmentalSetting==null) _EnvironmentalSetting = new List(); return _EnvironmentalSetting; } + get => _EnvironmentalSetting ?? new List(); set { _EnvironmentalSetting = value; OnPropertyChanged("EnvironmentalSetting"); } } - private List _EnvironmentalSetting; + private List? _EnvironmentalSetting; protected internal override void CopyToInternal(Base other) { - var dest = other as StorageGuidelineComponent; - - if (dest == null) - { + if(other is not StorageGuidelineComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ReferenceElement != null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)ReferenceElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(StabilityDuration != null) dest.StabilityDuration = (Hl7.Fhir.Model.Duration)StabilityDuration.DeepCopyInternal(); - if(EnvironmentalSetting.Any()) dest.EnvironmentalSetting = new List(EnvironmentalSetting.DeepCopyInternal()); + if(_ReferenceElement is not null) dest.ReferenceElement = (Hl7.Fhir.Model.FhirUri)_ReferenceElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_StabilityDuration is not null) dest.StabilityDuration = (Hl7.Fhir.Model.Duration)_StabilityDuration.DeepCopyInternal(); + if(_EnvironmentalSetting is not null) dest.EnvironmentalSetting = new List(_EnvironmentalSetting.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1525,55 +1475,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StorageGuidelineComponent; - if(otherT == null) return false; + if(other is not StorageGuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(StabilityDuration, otherT.StabilityDuration)) return false; - if(!comparer.ListEquals(EnvironmentalSetting, otherT.EnvironmentalSetting)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_StabilityDuration, otherT._StabilityDuration)) return false; + if(!comparer.ListEquals(_EnvironmentalSetting, otherT._EnvironmentalSetting)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "reference": - value = ReferenceElement; - return ReferenceElement is not null; + value = _ReferenceElement; + return _ReferenceElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "stabilityDuration": - value = StabilityDuration; - return StabilityDuration is not null; + value = _StabilityDuration; + return _StabilityDuration is not null; case "environmentalSetting": - value = EnvironmentalSetting; - return EnvironmentalSetting?.Any() == true; + value = _EnvironmentalSetting; + return _EnvironmentalSetting?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "reference": - ReferenceElement = (Hl7.Fhir.Model.FhirUri)value; + ReferenceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "stabilityDuration": - StabilityDuration = (Hl7.Fhir.Model.Duration)value; + StabilityDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "environmentalSetting": - EnvironmentalSetting = (List)value; + EnvironmentalSetting = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1584,10 +1534,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ReferenceElement is not null) yield return new KeyValuePair("reference",ReferenceElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (StabilityDuration is not null) yield return new KeyValuePair("stabilityDuration",StabilityDuration); - if (EnvironmentalSetting?.Any() == true) yield return new KeyValuePair("environmentalSetting",EnvironmentalSetting); + if (_ReferenceElement is not null) yield return new KeyValuePair("reference",_ReferenceElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_StabilityDuration is not null) yield return new KeyValuePair("stabilityDuration",_StabilityDuration); + if (_EnvironmentalSetting?.Any() == true) yield return new KeyValuePair("environmentalSetting",_EnvironmentalSetting); } } @@ -1614,13 +1564,13 @@ public partial class EnvironmentalSettingComponent : Hl7.Fhir.Model.BackboneElem [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Value of the setting. @@ -1630,26 +1580,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as EnvironmentalSettingComponent; - - if (dest == null) - { + if(other is not EnvironmentalSettingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1661,41 +1607,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnvironmentalSettingComponent; - if(otherT == null) return false; + if(other is not EnvironmentalSettingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1706,8 +1652,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1733,13 +1679,13 @@ public partial class RegulatoryComponent : Hl7.Fhir.Model.BackboneElement [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference RegulatoryAuthority + public Hl7.Fhir.Model.ResourceReference? RegulatoryAuthority { get { return _RegulatoryAuthority; } set { _RegulatoryAuthority = value; OnPropertyChanged("RegulatoryAuthority"); } } - private Hl7.Fhir.Model.ResourceReference _RegulatoryAuthority; + private Hl7.Fhir.Model.ResourceReference? _RegulatoryAuthority; /// /// Specifies if changes are allowed when dispensing a medication from a regulatory perspective. @@ -1749,11 +1695,11 @@ public Hl7.Fhir.Model.ResourceReference RegulatoryAuthority [DataMember] public List Substitution { - get { if(_Substitution==null) _Substitution = new List(); return _Substitution; } + get => _Substitution ?? new List(); set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private List _Substitution; + private List? _Substitution; /// /// Specifies the schedule of a medication in jurisdiction. @@ -1763,39 +1709,35 @@ public List Substituti [DataMember] public List Schedule { - get { if(_Schedule==null) _Schedule = new List(); return _Schedule; } + get => _Schedule ?? new List(); set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private List _Schedule; + private List? _Schedule; /// /// The maximum number of units of the medication that can be dispensed in a period. /// [FhirElement("maxDispense", Order=70)] [DataMember] - public Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent MaxDispense + public Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent? MaxDispense { get { return _MaxDispense; } set { _MaxDispense = value; OnPropertyChanged("MaxDispense"); } } - private Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent _MaxDispense; + private Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent? _MaxDispense; protected internal override void CopyToInternal(Base other) { - var dest = other as RegulatoryComponent; - - if (dest == null) - { + if(other is not RegulatoryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RegulatoryAuthority != null) dest.RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)RegulatoryAuthority.DeepCopyInternal(); - if(Substitution.Any()) dest.Substitution = new List(Substitution.DeepCopyInternal()); - if(Schedule.Any()) dest.Schedule = new List(Schedule.DeepCopyInternal()); - if(MaxDispense != null) dest.MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)MaxDispense.DeepCopyInternal(); + if(_RegulatoryAuthority is not null) dest.RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)_RegulatoryAuthority.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = new List(_Substitution.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = new List(_Schedule.DeepCopyInternal()); + if(_MaxDispense is not null) dest.MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)_MaxDispense.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1807,55 +1749,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RegulatoryComponent; - if(otherT == null) return false; + if(other is not RegulatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RegulatoryAuthority, otherT.RegulatoryAuthority)) return false; - if(!comparer.ListEquals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(MaxDispense, otherT.MaxDispense)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; + if(!comparer.ListEquals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_MaxDispense, otherT._MaxDispense)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "regulatoryAuthority": - value = RegulatoryAuthority; - return RegulatoryAuthority is not null; + value = _RegulatoryAuthority; + return _RegulatoryAuthority is not null; case "substitution": - value = Substitution; - return Substitution?.Any() == true; + value = _Substitution; + return _Substitution?.Any() == true; case "schedule": - value = Schedule; - return Schedule?.Any() == true; + value = _Schedule; + return _Schedule?.Any() == true; case "maxDispense": - value = MaxDispense; - return MaxDispense is not null; + value = _MaxDispense; + return _MaxDispense is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "regulatoryAuthority": - RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference)value; + RegulatoryAuthority = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "substitution": - Substitution = (List)value; + Substitution = (List?)value!; return this; case "schedule": - Schedule = (List)value; + Schedule = (List?)value!; return this; case "maxDispense": - MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent)value; + MaxDispense = (Hl7.Fhir.Model.MedicationKnowledge.MaxDispenseComponent?)value; return this; default: return base.SetValue(key, value); @@ -1866,10 +1808,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RegulatoryAuthority is not null) yield return new KeyValuePair("regulatoryAuthority",RegulatoryAuthority); - if (Substitution?.Any() == true) yield return new KeyValuePair("substitution",Substitution); - if (Schedule?.Any() == true) yield return new KeyValuePair("schedule",Schedule); - if (MaxDispense is not null) yield return new KeyValuePair("maxDispense",MaxDispense); + if (_RegulatoryAuthority is not null) yield return new KeyValuePair("regulatoryAuthority",_RegulatoryAuthority); + if (_Substitution?.Any() == true) yield return new KeyValuePair("substitution",_Substitution); + if (_Schedule?.Any() == true) yield return new KeyValuePair("schedule",_Schedule); + if (_MaxDispense is not null) yield return new KeyValuePair("maxDispense",_MaxDispense); } } @@ -1893,13 +1835,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Specifies if regulation allows for changes in the medication when dispensing. @@ -1907,13 +1849,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("allowed", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AllowedElement + public Hl7.Fhir.Model.FhirBoolean? AllowedElement { get { return _AllowedElement; } set { _AllowedElement = value; OnPropertyChanged("AllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _AllowedElement; /// /// Specifies if regulation allows for changes in the medication when dispensing @@ -1922,29 +1864,22 @@ public Hl7.Fhir.Model.FhirBoolean AllowedElement [IgnoreDataMember] public bool? Allowed { - get { return AllowedElement != null ? AllowedElement.Value : null; } + get => _AllowedElement?.Value; set { - if (value == null) - AllowedElement = null; - else - AllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + AllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Allowed"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AllowedElement != null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)AllowedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AllowedElement is not null) dest.AllowedElement = (Hl7.Fhir.Model.FhirBoolean)_AllowedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1956,41 +1891,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(AllowedElement, otherT.AllowedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "allowed": - value = AllowedElement; - return AllowedElement is not null; + value = _AllowedElement; + return _AllowedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "allowed": - AllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + AllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -2001,8 +1936,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AllowedElement is not null) yield return new KeyValuePair("allowed",AllowedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AllowedElement is not null) yield return new KeyValuePair("allowed",_AllowedElement); } } @@ -2026,39 +1961,35 @@ public partial class MaxDispenseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("quantity", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The period that applies to the maximum number of units. /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration Period + public Hl7.Fhir.Model.Duration? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Duration _Period; + private Hl7.Fhir.Model.Duration? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as MaxDispenseComponent; - - if (dest == null) - { + if(other is not MaxDispenseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Duration)Period.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Duration)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2070,41 +2001,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MaxDispenseComponent; - if(otherT == null) return false; + if(other is not MaxDispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Duration)value; + Period = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -2115,8 +2046,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -2147,11 +2078,11 @@ public partial class DefinitionalComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Definition { - get { if(_Definition==null) _Definition = new List(); return _Definition; } + get => _Definition ?? new List(); set { _Definition = value; OnPropertyChanged("Definition"); } } - private List _Definition; + private List? _Definition; /// /// powder | tablets | capsule +. @@ -2159,13 +2090,13 @@ public List Definition [FhirElement("doseForm", Order=50)] [Binding("MedicationForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseForm + public Hl7.Fhir.Model.CodeableConcept? DoseForm { get { return _DoseForm; } set { _DoseForm = value; OnPropertyChanged("DoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseForm; + private Hl7.Fhir.Model.CodeableConcept? _DoseForm; /// /// The intended or approved route of administration. @@ -2176,11 +2107,11 @@ public Hl7.Fhir.Model.CodeableConcept DoseForm [DataMember] public List IntendedRoute { - get { if(_IntendedRoute==null) _IntendedRoute = new List(); return _IntendedRoute; } + get => _IntendedRoute ?? new List(); set { _IntendedRoute = value; OnPropertyChanged("IntendedRoute"); } } - private List _IntendedRoute; + private List? _IntendedRoute; /// /// Active or inactive ingredient. @@ -2190,11 +2121,11 @@ public List IntendedRoute [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Specifies descriptive properties of the medicine. @@ -2204,27 +2135,23 @@ public List Ingredient [DataMember] public List DrugCharacteristic { - get { if(_DrugCharacteristic==null) _DrugCharacteristic = new List(); return _DrugCharacteristic; } + get => _DrugCharacteristic ?? new List(); set { _DrugCharacteristic = value; OnPropertyChanged("DrugCharacteristic"); } } - private List _DrugCharacteristic; + private List? _DrugCharacteristic; protected internal override void CopyToInternal(Base other) { - var dest = other as DefinitionalComponent; - - if (dest == null) - { + if(other is not DefinitionalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Definition.Any()) dest.Definition = new List(Definition.DeepCopyInternal()); - if(DoseForm != null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)DoseForm.DeepCopyInternal(); - if(IntendedRoute.Any()) dest.IntendedRoute = new List(IntendedRoute.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(DrugCharacteristic.Any()) dest.DrugCharacteristic = new List(DrugCharacteristic.DeepCopyInternal()); + if(_Definition is not null) dest.Definition = new List(_Definition.DeepCopyInternal()); + if(_DoseForm is not null) dest.DoseForm = (Hl7.Fhir.Model.CodeableConcept)_DoseForm.DeepCopyInternal(); + if(_IntendedRoute is not null) dest.IntendedRoute = new List(_IntendedRoute.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_DrugCharacteristic is not null) dest.DrugCharacteristic = new List(_DrugCharacteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2236,62 +2163,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DefinitionalComponent; - if(otherT == null) return false; + if(other is not DefinitionalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(DoseForm, otherT.DoseForm)) return false; - if(!comparer.ListEquals(IntendedRoute, otherT.IntendedRoute)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(DrugCharacteristic, otherT.DrugCharacteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_DoseForm, otherT._DoseForm)) return false; + if(!comparer.ListEquals(_IntendedRoute, otherT._IntendedRoute)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_DrugCharacteristic, otherT._DrugCharacteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "definition": - value = Definition; - return Definition?.Any() == true; + value = _Definition; + return _Definition?.Any() == true; case "doseForm": - value = DoseForm; - return DoseForm is not null; + value = _DoseForm; + return _DoseForm is not null; case "intendedRoute": - value = IntendedRoute; - return IntendedRoute?.Any() == true; + value = _IntendedRoute; + return _IntendedRoute?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "drugCharacteristic": - value = DrugCharacteristic; - return DrugCharacteristic?.Any() == true; + value = _DrugCharacteristic; + return _DrugCharacteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "definition": - Definition = (List)value; + Definition = (List?)value!; return this; case "doseForm": - DoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + DoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intendedRoute": - IntendedRoute = (List)value; + IntendedRoute = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "drugCharacteristic": - DrugCharacteristic = (List)value; + DrugCharacteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2302,11 +2229,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Definition?.Any() == true) yield return new KeyValuePair("definition",Definition); - if (DoseForm is not null) yield return new KeyValuePair("doseForm",DoseForm); - if (IntendedRoute?.Any() == true) yield return new KeyValuePair("intendedRoute",IntendedRoute); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (DrugCharacteristic?.Any() == true) yield return new KeyValuePair("drugCharacteristic",DrugCharacteristic); + if (_Definition?.Any() == true) yield return new KeyValuePair("definition",_Definition); + if (_DoseForm is not null) yield return new KeyValuePair("doseForm",_DoseForm); + if (_IntendedRoute?.Any() == true) yield return new KeyValuePair("intendedRoute",_IntendedRoute); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_DrugCharacteristic?.Any() == true) yield return new KeyValuePair("drugCharacteristic",_DrugCharacteristic); } } @@ -2333,13 +2260,13 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// A code that defines the type of ingredient, active, base, etc. @@ -2347,13 +2274,13 @@ public Hl7.Fhir.Model.CodeableReference Item [FhirElement("type", Order=50)] [Binding("MedicationIngredientIsActive")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Quantity of ingredient present. @@ -2363,27 +2290,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity))] [DataMember] - public Hl7.Fhir.Model.DataType Strength + public Hl7.Fhir.Model.DataType? Strength { get { return _Strength; } set { _Strength = value; OnPropertyChanged("Strength"); } } - private Hl7.Fhir.Model.DataType _Strength; + private Hl7.Fhir.Model.DataType? _Strength; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Strength != null) dest.Strength = (Hl7.Fhir.Model.DataType)Strength.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Strength is not null) dest.Strength = (Hl7.Fhir.Model.DataType)_Strength.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2395,48 +2318,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Strength, otherT.Strength)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Strength, otherT._Strength)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "strength": - value = Strength; - return Strength is not null; + value = _Strength; + return _Strength is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "strength": - Strength = (Hl7.Fhir.Model.DataType)value; + Strength = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2447,9 +2370,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Strength is not null) yield return new KeyValuePair("strength",Strength); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Strength is not null) yield return new KeyValuePair("strength",_Strength); } } @@ -2476,13 +2399,13 @@ public partial class DrugCharacteristicComponent : Hl7.Fhir.Model.BackboneElemen [FhirElement("type", Order=40)] [Binding("MedicationCharacteristic")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Description of the characteristic. @@ -2491,26 +2414,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as DrugCharacteristicComponent; - - if (dest == null) - { + if(other is not DrugCharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2522,41 +2441,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DrugCharacteristicComponent; - if(otherT == null) return false; + if(other is not DrugCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2567,8 +2486,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -2581,11 +2500,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Code that identifies this medication. @@ -2593,13 +2512,13 @@ public List Identifier [FhirElement("code", InSummary=true, Order=100, FiveWs="FiveWs.class")] [Binding("MedicationFormalRepresentation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | entered-in-error | inactive. @@ -2608,13 +2527,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [DeclaredType(Type = typeof(Code))] [Binding("MedicationKnowledgeStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | entered-in-error | inactive @@ -2623,13 +2542,10 @@ public Code S [IgnoreDataMember] public Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2641,13 +2557,13 @@ public Hl7.Fhir.Model.MedicationKnowledge.MedicationKnowledgeStatusCodes? Status [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Codes that identify the different jurisdictions for which the information of this resource was created. @@ -2657,11 +2573,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List IntendedJurisdiction { - get { if(_IntendedJurisdiction==null) _IntendedJurisdiction = new List(); return _IntendedJurisdiction; } + get => _IntendedJurisdiction ?? new List(); set { _IntendedJurisdiction = value; OnPropertyChanged("IntendedJurisdiction"); } } - private List _IntendedJurisdiction; + private List? _IntendedJurisdiction; /// /// A name associated with the medication being described. @@ -2671,24 +2587,24 @@ public List IntendedJurisdiction [DataMember] public List NameElement { - get { if(_NameElement==null) _NameElement = new List(); return _NameElement; } + get => _NameElement ?? new List(); set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private List _NameElement; + private List? _NameElement; /// /// A name associated with the medication being described /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Name + public IEnumerable? Name { - get { return NameElement != null ? NameElement.Select(elem => elem.Value) : null; } + get => _NameElement?.Select(elem => elem.Value); set { if (value == null) - NameElement = null; + NameElement = null!; else NameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Name"); @@ -2703,11 +2619,11 @@ public IEnumerable Name [DataMember] public List RelatedMedicationKnowledge { - get { if(_RelatedMedicationKnowledge==null) _RelatedMedicationKnowledge = new List(); return _RelatedMedicationKnowledge; } + get => _RelatedMedicationKnowledge ?? new List(); set { _RelatedMedicationKnowledge = value; OnPropertyChanged("RelatedMedicationKnowledge"); } } - private List _RelatedMedicationKnowledge; + private List? _RelatedMedicationKnowledge; /// /// The set of medication resources that are associated with this medication. @@ -2719,11 +2635,11 @@ public List AssociatedMedication { - get { if(_AssociatedMedication==null) _AssociatedMedication = new List(); return _AssociatedMedication; } + get => _AssociatedMedication ?? new List(); set { _AssociatedMedication = value; OnPropertyChanged("AssociatedMedication"); } } - private List _AssociatedMedication; + private List? _AssociatedMedication; /// /// Category of the medication or product. @@ -2733,11 +2649,11 @@ public List AssociatedMedication [DataMember] public List ProductType { - get { if(_ProductType==null) _ProductType = new List(); return _ProductType; } + get => _ProductType ?? new List(); set { _ProductType = value; OnPropertyChanged("ProductType"); } } - private List _ProductType; + private List? _ProductType; /// /// Associated documentation about the medication. @@ -2747,39 +2663,36 @@ public List ProductType [DataMember] public List Monograph { - get { if(_Monograph==null) _Monograph = new List(); return _Monograph; } + get => _Monograph ?? new List(); set { _Monograph = value; OnPropertyChanged("Monograph"); } } - private List _Monograph; + private List? _Monograph; /// /// The instructions for preparing the medication. /// [FhirElement("preparationInstruction", Order=190)] [DataMember] - public Hl7.Fhir.Model.Markdown PreparationInstructionElement + public Hl7.Fhir.Model.Markdown? PreparationInstructionElement { get { return _PreparationInstructionElement; } set { _PreparationInstructionElement = value; OnPropertyChanged("PreparationInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _PreparationInstructionElement; + private Hl7.Fhir.Model.Markdown? _PreparationInstructionElement; /// /// The instructions for preparing the medication /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreparationInstruction + public string? PreparationInstruction { - get { return PreparationInstructionElement != null ? PreparationInstructionElement.Value : null; } + get => _PreparationInstructionElement?.Value; set { - if (value == null) - PreparationInstructionElement = null; - else - PreparationInstructionElement = new Hl7.Fhir.Model.Markdown(value); + PreparationInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("PreparationInstruction"); } } @@ -2792,11 +2705,11 @@ public string PreparationInstruction [DataMember] public List Cost { - get { if(_Cost==null) _Cost = new List(); return _Cost; } + get => _Cost ?? new List(); set { _Cost = value; OnPropertyChanged("Cost"); } } - private List _Cost; + private List? _Cost; /// /// Program under which a medication is reviewed. @@ -2806,11 +2719,11 @@ public List Cost [DataMember] public List MonitoringProgram { - get { if(_MonitoringProgram==null) _MonitoringProgram = new List(); return _MonitoringProgram; } + get => _MonitoringProgram ?? new List(); set { _MonitoringProgram = value; OnPropertyChanged("MonitoringProgram"); } } - private List _MonitoringProgram; + private List? _MonitoringProgram; /// /// Guidelines or protocols for administration of the medication for an indication. @@ -2820,11 +2733,11 @@ public List Monit [DataMember] public List IndicationGuideline { - get { if(_IndicationGuideline==null) _IndicationGuideline = new List(); return _IndicationGuideline; } + get => _IndicationGuideline ?? new List(); set { _IndicationGuideline = value; OnPropertyChanged("IndicationGuideline"); } } - private List _IndicationGuideline; + private List? _IndicationGuideline; /// /// Categorization of the medication within a formulary or classification system. @@ -2834,11 +2747,11 @@ public List Ind [DataMember] public List MedicineClassification { - get { if(_MedicineClassification==null) _MedicineClassification = new List(); return _MedicineClassification; } + get => _MedicineClassification ?? new List(); set { _MedicineClassification = value; OnPropertyChanged("MedicineClassification"); } } - private List _MedicineClassification; + private List? _MedicineClassification; /// /// Details about packaged medications. @@ -2848,11 +2761,11 @@ public List [DataMember] public List Packaging { - get { if(_Packaging==null) _Packaging = new List(); return _Packaging; } + get => _Packaging ?? new List(); set { _Packaging = value; OnPropertyChanged("Packaging"); } } - private List _Packaging; + private List? _Packaging; /// /// Potential clinical issue with or between medication(s). @@ -2864,11 +2777,11 @@ public List Packaging [DataMember] public List ClinicalUseIssue { - get { if(_ClinicalUseIssue==null) _ClinicalUseIssue = new List(); return _ClinicalUseIssue; } + get => _ClinicalUseIssue ?? new List(); set { _ClinicalUseIssue = value; OnPropertyChanged("ClinicalUseIssue"); } } - private List _ClinicalUseIssue; + private List? _ClinicalUseIssue; /// /// How the medication should be stored. @@ -2878,11 +2791,11 @@ public List ClinicalUseIssue [DataMember] public List StorageGuideline { - get { if(_StorageGuideline==null) _StorageGuideline = new List(); return _StorageGuideline; } + get => _StorageGuideline ?? new List(); set { _StorageGuideline = value; OnPropertyChanged("StorageGuideline"); } } - private List _StorageGuideline; + private List? _StorageGuideline; /// /// Regulatory information about a medication. @@ -2892,57 +2805,53 @@ public List Storag [DataMember] public List Regulatory { - get { if(_Regulatory==null) _Regulatory = new List(); return _Regulatory; } + get => _Regulatory ?? new List(); set { _Regulatory = value; OnPropertyChanged("Regulatory"); } } - private List _Regulatory; + private List? _Regulatory; /// /// Minimal definition information about the medication. /// [FhirElement("definitional", Order=280)] [DataMember] - public Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent Definitional + public Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent? Definitional { get { return _Definitional; } set { _Definitional = value; OnPropertyChanged("Definitional"); } } - private Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent _Definitional; + private Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent? _Definitional; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationKnowledge; - - if (dest == null) - { + if(other is not MedicationKnowledge dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(IntendedJurisdiction.Any()) dest.IntendedJurisdiction = new List(IntendedJurisdiction.DeepCopyInternal()); - if(NameElement.Any()) dest.NameElement = new List(NameElement.DeepCopyInternal()); - if(RelatedMedicationKnowledge.Any()) dest.RelatedMedicationKnowledge = new List(RelatedMedicationKnowledge.DeepCopyInternal()); - if(AssociatedMedication.Any()) dest.AssociatedMedication = new List(AssociatedMedication.DeepCopyInternal()); - if(ProductType.Any()) dest.ProductType = new List(ProductType.DeepCopyInternal()); - if(Monograph.Any()) dest.Monograph = new List(Monograph.DeepCopyInternal()); - if(PreparationInstructionElement != null) dest.PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)PreparationInstructionElement.DeepCopyInternal(); - if(Cost.Any()) dest.Cost = new List(Cost.DeepCopyInternal()); - if(MonitoringProgram.Any()) dest.MonitoringProgram = new List(MonitoringProgram.DeepCopyInternal()); - if(IndicationGuideline.Any()) dest.IndicationGuideline = new List(IndicationGuideline.DeepCopyInternal()); - if(MedicineClassification.Any()) dest.MedicineClassification = new List(MedicineClassification.DeepCopyInternal()); - if(Packaging.Any()) dest.Packaging = new List(Packaging.DeepCopyInternal()); - if(ClinicalUseIssue.Any()) dest.ClinicalUseIssue = new List(ClinicalUseIssue.DeepCopyInternal()); - if(StorageGuideline.Any()) dest.StorageGuideline = new List(StorageGuideline.DeepCopyInternal()); - if(Regulatory.Any()) dest.Regulatory = new List(Regulatory.DeepCopyInternal()); - if(Definitional != null) dest.Definitional = (Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent)Definitional.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_IntendedJurisdiction is not null) dest.IntendedJurisdiction = new List(_IntendedJurisdiction.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = new List(_NameElement.DeepCopyInternal()); + if(_RelatedMedicationKnowledge is not null) dest.RelatedMedicationKnowledge = new List(_RelatedMedicationKnowledge.DeepCopyInternal()); + if(_AssociatedMedication is not null) dest.AssociatedMedication = new List(_AssociatedMedication.DeepCopyInternal()); + if(_ProductType is not null) dest.ProductType = new List(_ProductType.DeepCopyInternal()); + if(_Monograph is not null) dest.Monograph = new List(_Monograph.DeepCopyInternal()); + if(_PreparationInstructionElement is not null) dest.PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)_PreparationInstructionElement.DeepCopyInternal(); + if(_Cost is not null) dest.Cost = new List(_Cost.DeepCopyInternal()); + if(_MonitoringProgram is not null) dest.MonitoringProgram = new List(_MonitoringProgram.DeepCopyInternal()); + if(_IndicationGuideline is not null) dest.IndicationGuideline = new List(_IndicationGuideline.DeepCopyInternal()); + if(_MedicineClassification is not null) dest.MedicineClassification = new List(_MedicineClassification.DeepCopyInternal()); + if(_Packaging is not null) dest.Packaging = new List(_Packaging.DeepCopyInternal()); + if(_ClinicalUseIssue is not null) dest.ClinicalUseIssue = new List(_ClinicalUseIssue.DeepCopyInternal()); + if(_StorageGuideline is not null) dest.StorageGuideline = new List(_StorageGuideline.DeepCopyInternal()); + if(_Regulatory is not null) dest.Regulatory = new List(_Regulatory.DeepCopyInternal()); + if(_Definitional is not null) dest.Definitional = (Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent)_Definitional.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2954,167 +2863,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationKnowledge; - if(otherT == null) return false; + if(other is not MedicationKnowledge otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(IntendedJurisdiction, otherT.IntendedJurisdiction)) return false; - if(!comparer.ListEquals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(RelatedMedicationKnowledge, otherT.RelatedMedicationKnowledge)) return false; - if(!comparer.ListEquals(AssociatedMedication, otherT.AssociatedMedication)) return false; - if(!comparer.ListEquals(ProductType, otherT.ProductType)) return false; - if(!comparer.ListEquals(Monograph, otherT.Monograph)) return false; - if(!comparer.Equals(PreparationInstructionElement, otherT.PreparationInstructionElement)) return false; - if(!comparer.ListEquals(Cost, otherT.Cost)) return false; - if(!comparer.ListEquals(MonitoringProgram, otherT.MonitoringProgram)) return false; - if(!comparer.ListEquals(IndicationGuideline, otherT.IndicationGuideline)) return false; - if(!comparer.ListEquals(MedicineClassification, otherT.MedicineClassification)) return false; - if(!comparer.ListEquals(Packaging, otherT.Packaging)) return false; - if(!comparer.ListEquals(ClinicalUseIssue, otherT.ClinicalUseIssue)) return false; - if(!comparer.ListEquals(StorageGuideline, otherT.StorageGuideline)) return false; - if(!comparer.ListEquals(Regulatory, otherT.Regulatory)) return false; - if(!comparer.Equals(Definitional, otherT.Definitional)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_IntendedJurisdiction, otherT._IntendedJurisdiction)) return false; + if(!comparer.ListEquals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_RelatedMedicationKnowledge, otherT._RelatedMedicationKnowledge)) return false; + if(!comparer.ListEquals(_AssociatedMedication, otherT._AssociatedMedication)) return false; + if(!comparer.ListEquals(_ProductType, otherT._ProductType)) return false; + if(!comparer.ListEquals(_Monograph, otherT._Monograph)) return false; + if(!comparer.Equals(_PreparationInstructionElement, otherT._PreparationInstructionElement)) return false; + if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; + if(!comparer.ListEquals(_MonitoringProgram, otherT._MonitoringProgram)) return false; + if(!comparer.ListEquals(_IndicationGuideline, otherT._IndicationGuideline)) return false; + if(!comparer.ListEquals(_MedicineClassification, otherT._MedicineClassification)) return false; + if(!comparer.ListEquals(_Packaging, otherT._Packaging)) return false; + if(!comparer.ListEquals(_ClinicalUseIssue, otherT._ClinicalUseIssue)) return false; + if(!comparer.ListEquals(_StorageGuideline, otherT._StorageGuideline)) return false; + if(!comparer.ListEquals(_Regulatory, otherT._Regulatory)) return false; + if(!comparer.Equals(_Definitional, otherT._Definitional)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "intendedJurisdiction": - value = IntendedJurisdiction; - return IntendedJurisdiction?.Any() == true; + value = _IntendedJurisdiction; + return _IntendedJurisdiction?.Any() == true; case "name": - value = NameElement; - return NameElement?.Any() == true; + value = _NameElement; + return _NameElement?.Any() == true; case "relatedMedicationKnowledge": - value = RelatedMedicationKnowledge; - return RelatedMedicationKnowledge?.Any() == true; + value = _RelatedMedicationKnowledge; + return _RelatedMedicationKnowledge?.Any() == true; case "associatedMedication": - value = AssociatedMedication; - return AssociatedMedication?.Any() == true; + value = _AssociatedMedication; + return _AssociatedMedication?.Any() == true; case "productType": - value = ProductType; - return ProductType?.Any() == true; + value = _ProductType; + return _ProductType?.Any() == true; case "monograph": - value = Monograph; - return Monograph?.Any() == true; + value = _Monograph; + return _Monograph?.Any() == true; case "preparationInstruction": - value = PreparationInstructionElement; - return PreparationInstructionElement is not null; + value = _PreparationInstructionElement; + return _PreparationInstructionElement is not null; case "cost": - value = Cost; - return Cost?.Any() == true; + value = _Cost; + return _Cost?.Any() == true; case "monitoringProgram": - value = MonitoringProgram; - return MonitoringProgram?.Any() == true; + value = _MonitoringProgram; + return _MonitoringProgram?.Any() == true; case "indicationGuideline": - value = IndicationGuideline; - return IndicationGuideline?.Any() == true; + value = _IndicationGuideline; + return _IndicationGuideline?.Any() == true; case "medicineClassification": - value = MedicineClassification; - return MedicineClassification?.Any() == true; + value = _MedicineClassification; + return _MedicineClassification?.Any() == true; case "packaging": - value = Packaging; - return Packaging?.Any() == true; + value = _Packaging; + return _Packaging?.Any() == true; case "clinicalUseIssue": - value = ClinicalUseIssue; - return ClinicalUseIssue?.Any() == true; + value = _ClinicalUseIssue; + return _ClinicalUseIssue?.Any() == true; case "storageGuideline": - value = StorageGuideline; - return StorageGuideline?.Any() == true; + value = _StorageGuideline; + return _StorageGuideline?.Any() == true; case "regulatory": - value = Regulatory; - return Regulatory?.Any() == true; + value = _Regulatory; + return _Regulatory?.Any() == true; case "definitional": - value = Definitional; - return Definitional is not null; + value = _Definitional; + return _Definitional is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "intendedJurisdiction": - IntendedJurisdiction = (List)value; + IntendedJurisdiction = (List?)value!; return this; case "name": - NameElement = (List)value; + NameElement = (List?)value!; return this; case "relatedMedicationKnowledge": - RelatedMedicationKnowledge = (List)value; + RelatedMedicationKnowledge = (List?)value!; return this; case "associatedMedication": - AssociatedMedication = (List)value; + AssociatedMedication = (List?)value!; return this; case "productType": - ProductType = (List)value; + ProductType = (List?)value!; return this; case "monograph": - Monograph = (List)value; + Monograph = (List?)value!; return this; case "preparationInstruction": - PreparationInstructionElement = (Hl7.Fhir.Model.Markdown)value; + PreparationInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "cost": - Cost = (List)value; + Cost = (List?)value!; return this; case "monitoringProgram": - MonitoringProgram = (List)value; + MonitoringProgram = (List?)value!; return this; case "indicationGuideline": - IndicationGuideline = (List)value; + IndicationGuideline = (List?)value!; return this; case "medicineClassification": - MedicineClassification = (List)value; + MedicineClassification = (List?)value!; return this; case "packaging": - Packaging = (List)value; + Packaging = (List?)value!; return this; case "clinicalUseIssue": - ClinicalUseIssue = (List)value; + ClinicalUseIssue = (List?)value!; return this; case "storageGuideline": - StorageGuideline = (List)value; + StorageGuideline = (List?)value!; return this; case "regulatory": - Regulatory = (List)value; + Regulatory = (List?)value!; return this; case "definitional": - Definitional = (Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent)value; + Definitional = (Hl7.Fhir.Model.MedicationKnowledge.DefinitionalComponent?)value; return this; default: return base.SetValue(key, value); @@ -3125,26 +3034,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (IntendedJurisdiction?.Any() == true) yield return new KeyValuePair("intendedJurisdiction",IntendedJurisdiction); - if (NameElement?.Any() == true) yield return new KeyValuePair("name",NameElement); - if (RelatedMedicationKnowledge?.Any() == true) yield return new KeyValuePair("relatedMedicationKnowledge",RelatedMedicationKnowledge); - if (AssociatedMedication?.Any() == true) yield return new KeyValuePair("associatedMedication",AssociatedMedication); - if (ProductType?.Any() == true) yield return new KeyValuePair("productType",ProductType); - if (Monograph?.Any() == true) yield return new KeyValuePair("monograph",Monograph); - if (PreparationInstructionElement is not null) yield return new KeyValuePair("preparationInstruction",PreparationInstructionElement); - if (Cost?.Any() == true) yield return new KeyValuePair("cost",Cost); - if (MonitoringProgram?.Any() == true) yield return new KeyValuePair("monitoringProgram",MonitoringProgram); - if (IndicationGuideline?.Any() == true) yield return new KeyValuePair("indicationGuideline",IndicationGuideline); - if (MedicineClassification?.Any() == true) yield return new KeyValuePair("medicineClassification",MedicineClassification); - if (Packaging?.Any() == true) yield return new KeyValuePair("packaging",Packaging); - if (ClinicalUseIssue?.Any() == true) yield return new KeyValuePair("clinicalUseIssue",ClinicalUseIssue); - if (StorageGuideline?.Any() == true) yield return new KeyValuePair("storageGuideline",StorageGuideline); - if (Regulatory?.Any() == true) yield return new KeyValuePair("regulatory",Regulatory); - if (Definitional is not null) yield return new KeyValuePair("definitional",Definitional); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_IntendedJurisdiction?.Any() == true) yield return new KeyValuePair("intendedJurisdiction",_IntendedJurisdiction); + if (_NameElement?.Any() == true) yield return new KeyValuePair("name",_NameElement); + if (_RelatedMedicationKnowledge?.Any() == true) yield return new KeyValuePair("relatedMedicationKnowledge",_RelatedMedicationKnowledge); + if (_AssociatedMedication?.Any() == true) yield return new KeyValuePair("associatedMedication",_AssociatedMedication); + if (_ProductType?.Any() == true) yield return new KeyValuePair("productType",_ProductType); + if (_Monograph?.Any() == true) yield return new KeyValuePair("monograph",_Monograph); + if (_PreparationInstructionElement is not null) yield return new KeyValuePair("preparationInstruction",_PreparationInstructionElement); + if (_Cost?.Any() == true) yield return new KeyValuePair("cost",_Cost); + if (_MonitoringProgram?.Any() == true) yield return new KeyValuePair("monitoringProgram",_MonitoringProgram); + if (_IndicationGuideline?.Any() == true) yield return new KeyValuePair("indicationGuideline",_IndicationGuideline); + if (_MedicineClassification?.Any() == true) yield return new KeyValuePair("medicineClassification",_MedicineClassification); + if (_Packaging?.Any() == true) yield return new KeyValuePair("packaging",_Packaging); + if (_ClinicalUseIssue?.Any() == true) yield return new KeyValuePair("clinicalUseIssue",_ClinicalUseIssue); + if (_StorageGuideline?.Any() == true) yield return new KeyValuePair("storageGuideline",_StorageGuideline); + if (_Regulatory?.Any() == true) yield return new KeyValuePair("regulatory",_Regulatory); + if (_Definitional is not null) yield return new KeyValuePair("definitional",_Definitional); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs index c263a2d02..fe732223c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -202,52 +205,52 @@ public partial class DispenseRequestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("initialFill", Order=40)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.InitialFillComponent InitialFill + public Hl7.Fhir.Model.MedicationRequest.InitialFillComponent? InitialFill { get { return _InitialFill; } set { _InitialFill = value; OnPropertyChanged("InitialFill"); } } - private Hl7.Fhir.Model.MedicationRequest.InitialFillComponent _InitialFill; + private Hl7.Fhir.Model.MedicationRequest.InitialFillComponent? _InitialFill; /// /// Minimum period of time between dispenses. /// [FhirElement("dispenseInterval", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration DispenseInterval + public Hl7.Fhir.Model.Duration? DispenseInterval { get { return _DispenseInterval; } set { _DispenseInterval = value; OnPropertyChanged("DispenseInterval"); } } - private Hl7.Fhir.Model.Duration _DispenseInterval; + private Hl7.Fhir.Model.Duration? _DispenseInterval; /// /// Time period supply is authorized for. /// [FhirElement("validityPeriod", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// Number of refills authorized. /// [FhirElement("numberOfRepeatsAllowed", Order=70)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt NumberOfRepeatsAllowedElement + public Hl7.Fhir.Model.UnsignedInt? NumberOfRepeatsAllowedElement { get { return _NumberOfRepeatsAllowedElement; } set { _NumberOfRepeatsAllowedElement = value; OnPropertyChanged("NumberOfRepeatsAllowedElement"); } } - private Hl7.Fhir.Model.UnsignedInt _NumberOfRepeatsAllowedElement; + private Hl7.Fhir.Model.UnsignedInt? _NumberOfRepeatsAllowedElement; /// /// Number of refills authorized @@ -256,13 +259,10 @@ public Hl7.Fhir.Model.UnsignedInt NumberOfRepeatsAllowedElement [IgnoreDataMember] public int? NumberOfRepeatsAllowed { - get { return NumberOfRepeatsAllowedElement != null ? NumberOfRepeatsAllowedElement.Value : null; } + get => _NumberOfRepeatsAllowedElement?.Value; set { - if (value == null) - NumberOfRepeatsAllowedElement = null; - else - NumberOfRepeatsAllowedElement = new Hl7.Fhir.Model.UnsignedInt(value); + NumberOfRepeatsAllowedElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("NumberOfRepeatsAllowed"); } } @@ -272,26 +272,26 @@ public int? NumberOfRepeatsAllowed /// [FhirElement("quantity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Number of days supply per dispense. /// [FhirElement("expectedSupplyDuration", Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration ExpectedSupplyDuration + public Hl7.Fhir.Model.Duration? ExpectedSupplyDuration { get { return _ExpectedSupplyDuration; } set { _ExpectedSupplyDuration = value; OnPropertyChanged("ExpectedSupplyDuration"); } } - private Hl7.Fhir.Model.Duration _ExpectedSupplyDuration; + private Hl7.Fhir.Model.Duration? _ExpectedSupplyDuration; /// /// Intended performer of dispense. @@ -300,13 +300,13 @@ public Hl7.Fhir.Model.Duration ExpectedSupplyDuration [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Dispenser + public Hl7.Fhir.Model.ResourceReference? Dispenser { get { return _Dispenser; } set { _Dispenser = value; OnPropertyChanged("Dispenser"); } } - private Hl7.Fhir.Model.ResourceReference _Dispenser; + private Hl7.Fhir.Model.ResourceReference? _Dispenser; /// /// Additional information for the dispenser. @@ -316,11 +316,11 @@ public Hl7.Fhir.Model.ResourceReference Dispenser [DataMember] public List DispenserInstruction { - get { if(_DispenserInstruction==null) _DispenserInstruction = new List(); return _DispenserInstruction; } + get => _DispenserInstruction ?? new List(); set { _DispenserInstruction = value; OnPropertyChanged("DispenserInstruction"); } } - private List _DispenserInstruction; + private List? _DispenserInstruction; /// /// Type of adherence packaging to use for the dispense. @@ -328,33 +328,29 @@ public List DispenserInstruction [FhirElement("doseAdministrationAid", Order=120)] [Binding("MedicationRequestDoseAdministrationAid")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DoseAdministrationAid + public Hl7.Fhir.Model.CodeableConcept? DoseAdministrationAid { get { return _DoseAdministrationAid; } set { _DoseAdministrationAid = value; OnPropertyChanged("DoseAdministrationAid"); } } - private Hl7.Fhir.Model.CodeableConcept _DoseAdministrationAid; + private Hl7.Fhir.Model.CodeableConcept? _DoseAdministrationAid; protected internal override void CopyToInternal(Base other) { - var dest = other as DispenseRequestComponent; - - if (dest == null) - { + if(other is not DispenseRequestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(InitialFill != null) dest.InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)InitialFill.DeepCopyInternal(); - if(DispenseInterval != null) dest.DispenseInterval = (Hl7.Fhir.Model.Duration)DispenseInterval.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(NumberOfRepeatsAllowedElement != null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)NumberOfRepeatsAllowedElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(ExpectedSupplyDuration != null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)ExpectedSupplyDuration.DeepCopyInternal(); - if(Dispenser != null) dest.Dispenser = (Hl7.Fhir.Model.ResourceReference)Dispenser.DeepCopyInternal(); - if(DispenserInstruction.Any()) dest.DispenserInstruction = new List(DispenserInstruction.DeepCopyInternal()); - if(DoseAdministrationAid != null) dest.DoseAdministrationAid = (Hl7.Fhir.Model.CodeableConcept)DoseAdministrationAid.DeepCopyInternal(); + if(_InitialFill is not null) dest.InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)_InitialFill.DeepCopyInternal(); + if(_DispenseInterval is not null) dest.DispenseInterval = (Hl7.Fhir.Model.Duration)_DispenseInterval.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_NumberOfRepeatsAllowedElement is not null) dest.NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)_NumberOfRepeatsAllowedElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_ExpectedSupplyDuration is not null) dest.ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)_ExpectedSupplyDuration.DeepCopyInternal(); + if(_Dispenser is not null) dest.Dispenser = (Hl7.Fhir.Model.ResourceReference)_Dispenser.DeepCopyInternal(); + if(_DispenserInstruction is not null) dest.DispenserInstruction = new List(_DispenserInstruction.DeepCopyInternal()); + if(_DoseAdministrationAid is not null) dest.DoseAdministrationAid = (Hl7.Fhir.Model.CodeableConcept)_DoseAdministrationAid.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -366,90 +362,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DispenseRequestComponent; - if(otherT == null) return false; + if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(InitialFill, otherT.InitialFill)) return false; - if(!comparer.Equals(DispenseInterval, otherT.DispenseInterval)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.Equals(NumberOfRepeatsAllowedElement, otherT.NumberOfRepeatsAllowedElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(ExpectedSupplyDuration, otherT.ExpectedSupplyDuration)) return false; - if(!comparer.Equals(Dispenser, otherT.Dispenser)) return false; - if(!comparer.ListEquals(DispenserInstruction, otherT.DispenserInstruction)) return false; - if(!comparer.Equals(DoseAdministrationAid, otherT.DoseAdministrationAid)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; + if(!comparer.Equals(_DispenseInterval, otherT._DispenseInterval)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_ExpectedSupplyDuration, otherT._ExpectedSupplyDuration)) return false; + if(!comparer.Equals(_Dispenser, otherT._Dispenser)) return false; + if(!comparer.ListEquals(_DispenserInstruction, otherT._DispenserInstruction)) return false; + if(!comparer.Equals(_DoseAdministrationAid, otherT._DoseAdministrationAid)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "initialFill": - value = InitialFill; - return InitialFill is not null; + value = _InitialFill; + return _InitialFill is not null; case "dispenseInterval": - value = DispenseInterval; - return DispenseInterval is not null; + value = _DispenseInterval; + return _DispenseInterval is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "numberOfRepeatsAllowed": - value = NumberOfRepeatsAllowedElement; - return NumberOfRepeatsAllowedElement is not null; + value = _NumberOfRepeatsAllowedElement; + return _NumberOfRepeatsAllowedElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "expectedSupplyDuration": - value = ExpectedSupplyDuration; - return ExpectedSupplyDuration is not null; + value = _ExpectedSupplyDuration; + return _ExpectedSupplyDuration is not null; case "dispenser": - value = Dispenser; - return Dispenser is not null; + value = _Dispenser; + return _Dispenser is not null; case "dispenserInstruction": - value = DispenserInstruction; - return DispenserInstruction?.Any() == true; + value = _DispenserInstruction; + return _DispenserInstruction?.Any() == true; case "doseAdministrationAid": - value = DoseAdministrationAid; - return DoseAdministrationAid is not null; + value = _DoseAdministrationAid; + return _DoseAdministrationAid is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "initialFill": - InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent)value; + InitialFill = (Hl7.Fhir.Model.MedicationRequest.InitialFillComponent?)value; return this; case "dispenseInterval": - DispenseInterval = (Hl7.Fhir.Model.Duration)value; + DispenseInterval = (Hl7.Fhir.Model.Duration?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "numberOfRepeatsAllowed": - NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt)value; + NumberOfRepeatsAllowedElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "expectedSupplyDuration": - ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration)value; + ExpectedSupplyDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "dispenser": - Dispenser = (Hl7.Fhir.Model.ResourceReference)value; + Dispenser = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dispenserInstruction": - DispenserInstruction = (List)value; + DispenserInstruction = (List?)value!; return this; case "doseAdministrationAid": - DoseAdministrationAid = (Hl7.Fhir.Model.CodeableConcept)value; + DoseAdministrationAid = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -460,15 +456,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (InitialFill is not null) yield return new KeyValuePair("initialFill",InitialFill); - if (DispenseInterval is not null) yield return new KeyValuePair("dispenseInterval",DispenseInterval); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",NumberOfRepeatsAllowedElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",ExpectedSupplyDuration); - if (Dispenser is not null) yield return new KeyValuePair("dispenser",Dispenser); - if (DispenserInstruction?.Any() == true) yield return new KeyValuePair("dispenserInstruction",DispenserInstruction); - if (DoseAdministrationAid is not null) yield return new KeyValuePair("doseAdministrationAid",DoseAdministrationAid); + if (_InitialFill is not null) yield return new KeyValuePair("initialFill",_InitialFill); + if (_DispenseInterval is not null) yield return new KeyValuePair("dispenseInterval",_DispenseInterval); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_NumberOfRepeatsAllowedElement is not null) yield return new KeyValuePair("numberOfRepeatsAllowed",_NumberOfRepeatsAllowedElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_ExpectedSupplyDuration is not null) yield return new KeyValuePair("expectedSupplyDuration",_ExpectedSupplyDuration); + if (_Dispenser is not null) yield return new KeyValuePair("dispenser",_Dispenser); + if (_DispenserInstruction?.Any() == true) yield return new KeyValuePair("dispenserInstruction",_DispenserInstruction); + if (_DoseAdministrationAid is not null) yield return new KeyValuePair("doseAdministrationAid",_DoseAdministrationAid); } } @@ -495,39 +491,35 @@ public partial class InitialFillComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// First fill duration. /// [FhirElement("duration", Order=50)] [DataMember] - public Hl7.Fhir.Model.Duration Duration + public Hl7.Fhir.Model.Duration? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Duration _Duration; + private Hl7.Fhir.Model.Duration? _Duration; protected internal override void CopyToInternal(Base other) { - var dest = other as InitialFillComponent; - - if (dest == null) - { + if(other is not InitialFillComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Duration)_Duration.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -539,41 +531,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InitialFillComponent; - if(otherT == null) return false; + if(other is not InitialFillComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Duration)value; + Duration = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -584,8 +576,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); } } @@ -615,13 +607,13 @@ public partial class SubstitutionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Allowed + public Hl7.Fhir.Model.DataType? Allowed { get { return _Allowed; } set { _Allowed = value; OnPropertyChanged("Allowed"); } } - private Hl7.Fhir.Model.DataType _Allowed; + private Hl7.Fhir.Model.DataType? _Allowed; /// /// Why should (not) substitution be made. @@ -629,26 +621,22 @@ public Hl7.Fhir.Model.DataType Allowed [FhirElement("reason", Order=50)] [Binding("MedicationIntendedSubstitutionReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstitutionComponent; - - if (dest == null) - { + if(other is not SubstitutionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Allowed != null) dest.Allowed = (Hl7.Fhir.Model.DataType)Allowed.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_Allowed is not null) dest.Allowed = (Hl7.Fhir.Model.DataType)_Allowed.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -660,41 +648,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstitutionComponent; - if(otherT == null) return false; + if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Allowed, otherT.Allowed)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "allowed": - value = Allowed; - return Allowed is not null; + value = _Allowed; + return _Allowed is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "allowed": - Allowed = (Hl7.Fhir.Model.DataType)value; + Allowed = (Hl7.Fhir.Model.DataType?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -705,8 +693,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Allowed is not null) yield return new KeyValuePair("allowed",Allowed); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_Allowed is not null) yield return new KeyValuePair("allowed",_Allowed); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -719,11 +707,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A plan or request that is fulfilled in whole or in part by this medication request. @@ -735,11 +723,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Reference to an order/prescription that is being replaced by this MedicationRequest. @@ -748,26 +736,26 @@ public List BasedOn [CLSCompliant(false)] [References("MedicationRequest")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PriorPrescription + public Hl7.Fhir.Model.ResourceReference? PriorPrescription { get { return _PriorPrescription; } set { _PriorPrescription = value; OnPropertyChanged("PriorPrescription"); } } - private Hl7.Fhir.Model.ResourceReference _PriorPrescription; + private Hl7.Fhir.Model.ResourceReference? _PriorPrescription; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// active | on-hold | ended | stopped | completed | cancelled | entered-in-error | draft | unknown. @@ -777,13 +765,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("MedicationRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | on-hold | ended | stopped | completed | cancelled | entered-in-error | draft | unknown @@ -792,13 +780,10 @@ public Code StatusElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationrequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -809,41 +794,38 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationrequestStatus? Status [FhirElement("statusReason", Order=140)] [Binding("MedicationRequestStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// When the status was changed. /// [FhirElement("statusChanged", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusChangedElement + public Hl7.Fhir.Model.FhirDateTime? StatusChangedElement { get { return _StatusChangedElement; } set { _StatusChangedElement = value; OnPropertyChanged("StatusChangedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusChangedElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusChangedElement; /// /// When the status was changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusChanged + public string? StatusChanged { - get { return StatusChangedElement != null ? StatusChangedElement.Value : null; } + get => _StatusChangedElement?.Value; set { - if (value == null) - StatusChangedElement = null; - else - StatusChangedElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusChangedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusChanged"); } } @@ -856,13 +838,13 @@ public string StatusChanged [Binding("MedicationRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option @@ -871,13 +853,10 @@ public Code IntentElem [IgnoreDataMember] public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -891,11 +870,11 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -904,13 +883,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("MedicationRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -919,13 +898,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -935,13 +911,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if patient is to stop taking or not to start taking the medication @@ -950,13 +926,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -968,13 +941,13 @@ public bool? DoNotPerform [Binding("MedicationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Medication + public Hl7.Fhir.Model.CodeableReference? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.CodeableReference _Medication; + private Hl7.Fhir.Model.CodeableReference? _Medication; /// /// Individual or group for whom the medication has been requested. @@ -984,13 +957,13 @@ public Hl7.Fhir.Model.CodeableReference Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The person or organization who provided the information about this request, if the source is someone other than the requestor. @@ -1002,11 +975,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List InformationSource { - get { if(_InformationSource==null) _InformationSource = new List(); return _InformationSource; } + get => _InformationSource ?? new List(); set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private List _InformationSource; + private List? _InformationSource; /// /// Encounter created as part of encounter/admission/stay. @@ -1015,13 +988,13 @@ public List InformationSource [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Information to support fulfilling of the medication. @@ -1033,39 +1006,36 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// When request was initially authored. /// [FhirElement("authoredOn", InSummary=true, Order=250, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When request was initially authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -1077,26 +1047,26 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Reported rather than primary record. /// [FhirElement("reported", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReportedElement + public Hl7.Fhir.Model.FhirBoolean? ReportedElement { get { return _ReportedElement; } set { _ReportedElement = value; OnPropertyChanged("ReportedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReportedElement; + private Hl7.Fhir.Model.FhirBoolean? _ReportedElement; /// /// Reported rather than primary record @@ -1105,13 +1075,10 @@ public Hl7.Fhir.Model.FhirBoolean ReportedElement [IgnoreDataMember] public bool? Reported { - get { return ReportedElement != null ? ReportedElement.Value : null; } + get => _ReportedElement?.Value; set { - if (value == null) - ReportedElement = null; - else - ReportedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReportedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Reported"); } } @@ -1122,13 +1089,13 @@ public bool? Reported [FhirElement("performerType", InSummary=true, Order=280)] [Binding("MedicationRequestPerformerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Intended performer of administration. @@ -1140,11 +1107,11 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Intended type of device for the administration. @@ -1154,11 +1121,11 @@ public List Performer [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// Person who entered the request. @@ -1167,13 +1134,13 @@ public List Device [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Reason or indication for ordering or not ordering the medication. @@ -1184,11 +1151,11 @@ public Hl7.Fhir.Model.ResourceReference Recorder [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Overall pattern of medication administration. @@ -1196,13 +1163,13 @@ public List Reason [FhirElement("courseOfTherapyType", Order=330)] [Binding("MedicationRequestCourseOfTherapy")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CourseOfTherapyType + public Hl7.Fhir.Model.CodeableConcept? CourseOfTherapyType { get { return _CourseOfTherapyType; } set { _CourseOfTherapyType = value; OnPropertyChanged("CourseOfTherapyType"); } } - private Hl7.Fhir.Model.CodeableConcept _CourseOfTherapyType; + private Hl7.Fhir.Model.CodeableConcept? _CourseOfTherapyType; /// /// Associated insurance coverage. @@ -1214,11 +1181,11 @@ public Hl7.Fhir.Model.CodeableConcept CourseOfTherapyType [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Information about the prescription. @@ -1228,39 +1195,36 @@ public List Insurance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Full representation of the dosage instructions. /// [FhirElement("renderedDosageInstruction", Order=360)] [DataMember] - public Hl7.Fhir.Model.Markdown RenderedDosageInstructionElement + public Hl7.Fhir.Model.Markdown? RenderedDosageInstructionElement { get { return _RenderedDosageInstructionElement; } set { _RenderedDosageInstructionElement = value; OnPropertyChanged("RenderedDosageInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _RenderedDosageInstructionElement; + private Hl7.Fhir.Model.Markdown? _RenderedDosageInstructionElement; /// /// Full representation of the dosage instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RenderedDosageInstruction + public string? RenderedDosageInstruction { - get { return RenderedDosageInstructionElement != null ? RenderedDosageInstructionElement.Value : null; } + get => _RenderedDosageInstructionElement?.Value; set { - if (value == null) - RenderedDosageInstructionElement = null; - else - RenderedDosageInstructionElement = new Hl7.Fhir.Model.Markdown(value); + RenderedDosageInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("RenderedDosageInstruction"); } } @@ -1270,13 +1234,13 @@ public string RenderedDosageInstruction /// [FhirElement("effectiveDosePeriod", Order=370)] [DataMember] - public Hl7.Fhir.Model.Period EffectiveDosePeriod + public Hl7.Fhir.Model.Period? EffectiveDosePeriod { get { return _EffectiveDosePeriod; } set { _EffectiveDosePeriod = value; OnPropertyChanged("EffectiveDosePeriod"); } } - private Hl7.Fhir.Model.Period _EffectiveDosePeriod; + private Hl7.Fhir.Model.Period? _EffectiveDosePeriod; /// /// Specific instructions for how the medication should be taken. @@ -1286,37 +1250,37 @@ public Hl7.Fhir.Model.Period EffectiveDosePeriod [DataMember] public List DosageInstruction { - get { if(_DosageInstruction==null) _DosageInstruction = new List(); return _DosageInstruction; } + get => _DosageInstruction ?? new List(); set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } - private List _DosageInstruction; + private List? _DosageInstruction; /// /// Medication supply authorization. /// [FhirElement("dispenseRequest", Order=390)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent DispenseRequest + public Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? DispenseRequest { get { return _DispenseRequest; } set { _DispenseRequest = value; OnPropertyChanged("DispenseRequest"); } } - private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent _DispenseRequest; + private Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent? _DispenseRequest; /// /// Any restrictions on medication substitution. /// [FhirElement("substitution", Order=400)] [DataMember] - public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution + public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? Substitution { get { return _Substitution; } set { _Substitution = value; OnPropertyChanged("Substitution"); } } - private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent _Substitution; + private Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? _Substitution; /// /// A list of events of interest in the lifecycle. @@ -1328,57 +1292,53 @@ public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent Substitution [DataMember] public List EventHistory { - get { if(_EventHistory==null) _EventHistory = new List(); return _EventHistory; } + get => _EventHistory ?? new List(); set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } - private List _EventHistory; + private List? _EventHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationRequest; - - if (dest == null) - { + if(other is not MedicationRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PriorPrescription != null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)PriorPrescription.DeepCopyInternal(); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(StatusChangedElement != null) dest.StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime)StatusChangedElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(InformationSource.Any()) dest.InformationSource = new List(InformationSource.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(ReportedElement != null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)ReportedElement.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(CourseOfTherapyType != null) dest.CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)CourseOfTherapyType.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RenderedDosageInstructionElement != null) dest.RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)RenderedDosageInstructionElement.DeepCopyInternal(); - if(EffectiveDosePeriod != null) dest.EffectiveDosePeriod = (Hl7.Fhir.Model.Period)EffectiveDosePeriod.DeepCopyInternal(); - if(DosageInstruction.Any()) dest.DosageInstruction = new List(DosageInstruction.DeepCopyInternal()); - if(DispenseRequest != null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)DispenseRequest.DeepCopyInternal(); - if(Substitution != null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)Substitution.DeepCopyInternal(); - if(EventHistory.Any()) dest.EventHistory = new List(EventHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PriorPrescription is not null) dest.PriorPrescription = (Hl7.Fhir.Model.ResourceReference)_PriorPrescription.DeepCopyInternal(); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_StatusChangedElement is not null) dest.StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime)_StatusChangedElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = new List(_InformationSource.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_ReportedElement is not null) dest.ReportedElement = (Hl7.Fhir.Model.FhirBoolean)_ReportedElement.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_CourseOfTherapyType is not null) dest.CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)_CourseOfTherapyType.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RenderedDosageInstructionElement is not null) dest.RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)_RenderedDosageInstructionElement.DeepCopyInternal(); + if(_EffectiveDosePeriod is not null) dest.EffectiveDosePeriod = (Hl7.Fhir.Model.Period)_EffectiveDosePeriod.DeepCopyInternal(); + if(_DosageInstruction is not null) dest.DosageInstruction = new List(_DosageInstruction.DeepCopyInternal()); + if(_DispenseRequest is not null) dest.DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)_DispenseRequest.DeepCopyInternal(); + if(_Substitution is not null) dest.Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)_Substitution.DeepCopyInternal(); + if(_EventHistory is not null) dest.EventHistory = new List(_EventHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1390,258 +1350,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationRequest; - if(otherT == null) return false; + if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(PriorPrescription, otherT.PriorPrescription)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(StatusChangedElement, otherT.StatusChangedElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(ReportedElement, otherT.ReportedElement)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(CourseOfTherapyType, otherT.CourseOfTherapyType)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(RenderedDosageInstructionElement, otherT.RenderedDosageInstructionElement)) return false; - if(!comparer.Equals(EffectiveDosePeriod, otherT.EffectiveDosePeriod)) return false; - if(!comparer.ListEquals(DosageInstruction, otherT.DosageInstruction)) return false; - if(!comparer.Equals(DispenseRequest, otherT.DispenseRequest)) return false; - if(!comparer.Equals(Substitution, otherT.Substitution)) return false; - if(!comparer.ListEquals(EventHistory, otherT.EventHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_StatusChangedElement, otherT._StatusChangedElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_CourseOfTherapyType, otherT._CourseOfTherapyType)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_RenderedDosageInstructionElement, otherT._RenderedDosageInstructionElement)) return false; + if(!comparer.Equals(_EffectiveDosePeriod, otherT._EffectiveDosePeriod)) return false; + if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; + if(!comparer.Equals(_DispenseRequest, otherT._DispenseRequest)) return false; + if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; + if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "priorPrescription": - value = PriorPrescription; - return PriorPrescription is not null; + value = _PriorPrescription; + return _PriorPrescription is not null; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "statusChanged": - value = StatusChangedElement; - return StatusChangedElement is not null; + value = _StatusChangedElement; + return _StatusChangedElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "informationSource": - value = InformationSource; - return InformationSource?.Any() == true; + value = _InformationSource; + return _InformationSource?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "reported": - value = ReportedElement; - return ReportedElement is not null; + value = _ReportedElement; + return _ReportedElement is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "courseOfTherapyType": - value = CourseOfTherapyType; - return CourseOfTherapyType is not null; + value = _CourseOfTherapyType; + return _CourseOfTherapyType is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "renderedDosageInstruction": - value = RenderedDosageInstructionElement; - return RenderedDosageInstructionElement is not null; + value = _RenderedDosageInstructionElement; + return _RenderedDosageInstructionElement is not null; case "effectiveDosePeriod": - value = EffectiveDosePeriod; - return EffectiveDosePeriod is not null; + value = _EffectiveDosePeriod; + return _EffectiveDosePeriod is not null; case "dosageInstruction": - value = DosageInstruction; - return DosageInstruction?.Any() == true; + value = _DosageInstruction; + return _DosageInstruction?.Any() == true; case "dispenseRequest": - value = DispenseRequest; - return DispenseRequest is not null; + value = _DispenseRequest; + return _DispenseRequest is not null; case "substitution": - value = Substitution; - return Substitution is not null; + value = _Substitution; + return _Substitution is not null; case "eventHistory": - value = EventHistory; - return EventHistory?.Any() == true; + value = _EventHistory; + return _EventHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "priorPrescription": - PriorPrescription = (Hl7.Fhir.Model.ResourceReference)value; + PriorPrescription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusChanged": - StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusChangedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "medication": - Medication = (Hl7.Fhir.Model.CodeableReference)value; + Medication = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "informationSource": - InformationSource = (List)value; + InformationSource = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reported": - ReportedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReportedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "courseOfTherapyType": - CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept)value; + CourseOfTherapyType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "renderedDosageInstruction": - RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)value; + RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "effectiveDosePeriod": - EffectiveDosePeriod = (Hl7.Fhir.Model.Period)value; + EffectiveDosePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "dosageInstruction": - DosageInstruction = (List)value; + DosageInstruction = (List?)value!; return this; case "dispenseRequest": - DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent)value; + DispenseRequest = (Hl7.Fhir.Model.MedicationRequest.DispenseRequestComponent?)value; return this; case "substitution": - Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent)value; + Substitution = (Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent?)value; return this; case "eventHistory": - EventHistory = (List)value; + EventHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1652,39 +1612,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",PriorPrescription); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (StatusChangedElement is not null) yield return new KeyValuePair("statusChanged",StatusChangedElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",InformationSource); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (ReportedElement is not null) yield return new KeyValuePair("reported",ReportedElement); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (CourseOfTherapyType is not null) yield return new KeyValuePair("courseOfTherapyType",CourseOfTherapyType); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RenderedDosageInstructionElement is not null) yield return new KeyValuePair("renderedDosageInstruction",RenderedDosageInstructionElement); - if (EffectiveDosePeriod is not null) yield return new KeyValuePair("effectiveDosePeriod",EffectiveDosePeriod); - if (DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",DosageInstruction); - if (DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",DispenseRequest); - if (Substitution is not null) yield return new KeyValuePair("substitution",Substitution); - if (EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",EventHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PriorPrescription is not null) yield return new KeyValuePair("priorPrescription",_PriorPrescription); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_StatusChangedElement is not null) yield return new KeyValuePair("statusChanged",_StatusChangedElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",_InformationSource); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_ReportedElement is not null) yield return new KeyValuePair("reported",_ReportedElement); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_CourseOfTherapyType is not null) yield return new KeyValuePair("courseOfTherapyType",_CourseOfTherapyType); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RenderedDosageInstructionElement is not null) yield return new KeyValuePair("renderedDosageInstruction",_RenderedDosageInstructionElement); + if (_EffectiveDosePeriod is not null) yield return new KeyValuePair("effectiveDosePeriod",_EffectiveDosePeriod); + if (_DosageInstruction?.Any() == true) yield return new KeyValuePair("dosageInstruction",_DosageInstruction); + if (_DispenseRequest is not null) yield return new KeyValuePair("dispenseRequest",_DispenseRequest); + if (_Substitution is not null) yield return new KeyValuePair("substitution",_Substitution); + if (_EventHistory?.Any() == true) yield return new KeyValuePair("eventHistory",_EventHistory); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs index 21ef577f7..ce0c88d9c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,13 +115,13 @@ public partial class AdherenceComponent : Hl7.Fhir.Model.BackboneElement [Binding("MedicationStatementAdherence")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Details of the reason for the current use of the medication. @@ -126,26 +129,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("reason", Order=50)] [Binding("MedicationStatementStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; protected internal override void CopyToInternal(Base other) { - var dest = other as AdherenceComponent; - - if (dest == null) - { + if(other is not AdherenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -157,41 +156,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdherenceComponent; - if(otherT == null) return false; + if(other is not AdherenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -202,8 +201,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); } } @@ -216,11 +215,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Part of referenced event. @@ -232,11 +231,11 @@ public List Identifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// recorded | entered-in-error | draft. @@ -246,13 +245,13 @@ public List PartOf [Binding("MedicationStatementStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// recorded | entered-in-error | draft @@ -261,13 +260,10 @@ public Code S [IgnoreDataMember] public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -281,11 +277,11 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatusCodes? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What medication was taken. @@ -294,13 +290,13 @@ public List Category [Binding("MedicationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Medication + public Hl7.Fhir.Model.CodeableReference? Medication { get { return _Medication; } set { _Medication = value; OnPropertyChanged("Medication"); } } - private Hl7.Fhir.Model.CodeableReference _Medication; + private Hl7.Fhir.Model.CodeableReference? _Medication; /// /// Who is/was taking the medication. @@ -310,13 +306,13 @@ public Hl7.Fhir.Model.CodeableReference Medication [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter associated with MedicationStatement. @@ -325,13 +321,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// The date/time or interval when the medication is/was/will be taken. @@ -340,41 +336,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// When the usage was asserted?. /// [FhirElement("dateAsserted", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateAssertedElement + public Hl7.Fhir.Model.FhirDateTime? DateAssertedElement { get { return _DateAssertedElement; } set { _DateAssertedElement = value; OnPropertyChanged("DateAssertedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateAssertedElement; + private Hl7.Fhir.Model.FhirDateTime? _DateAssertedElement; /// /// When the usage was asserted? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateAsserted + public string? DateAsserted { - get { return DateAssertedElement != null ? DateAssertedElement.Value : null; } + get => _DateAssertedElement?.Value; set { - if (value == null) - DateAssertedElement = null; - else - DateAssertedElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateAssertedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateAsserted"); } } @@ -389,11 +382,11 @@ public string DateAsserted [DataMember] public List InformationSource { - get { if(_InformationSource==null) _InformationSource = new List(); return _InformationSource; } + get => _InformationSource ?? new List(); set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private List _InformationSource; + private List? _InformationSource; /// /// Link to information used to derive the MedicationStatement. @@ -405,11 +398,11 @@ public List InformationSource [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// Reason for why the medication is being/was taken. @@ -420,11 +413,11 @@ public List DerivedFrom [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Further information about the usage. @@ -434,11 +427,11 @@ public List Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Link to information relevant to the usage of a medication. @@ -450,39 +443,36 @@ public List Note [DataMember] public List RelatedClinicalInformation { - get { if(_RelatedClinicalInformation==null) _RelatedClinicalInformation = new List(); return _RelatedClinicalInformation; } + get => _RelatedClinicalInformation ?? new List(); set { _RelatedClinicalInformation = value; OnPropertyChanged("RelatedClinicalInformation"); } } - private List _RelatedClinicalInformation; + private List? _RelatedClinicalInformation; /// /// Full representation of the dosage instructions. /// [FhirElement("renderedDosageInstruction", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown RenderedDosageInstructionElement + public Hl7.Fhir.Model.Markdown? RenderedDosageInstructionElement { get { return _RenderedDosageInstructionElement; } set { _RenderedDosageInstructionElement = value; OnPropertyChanged("RenderedDosageInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _RenderedDosageInstructionElement; + private Hl7.Fhir.Model.Markdown? _RenderedDosageInstructionElement; /// /// Full representation of the dosage instructions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RenderedDosageInstruction + public string? RenderedDosageInstruction { - get { return RenderedDosageInstructionElement != null ? RenderedDosageInstructionElement.Value : null; } + get => _RenderedDosageInstructionElement?.Value; set { - if (value == null) - RenderedDosageInstructionElement = null; - else - RenderedDosageInstructionElement = new Hl7.Fhir.Model.Markdown(value); + RenderedDosageInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("RenderedDosageInstruction"); } } @@ -495,54 +485,50 @@ public string RenderedDosageInstruction [DataMember] public List Dosage { - get { if(_Dosage==null) _Dosage = new List(); return _Dosage; } + get => _Dosage ?? new List(); set { _Dosage = value; OnPropertyChanged("Dosage"); } } - private List _Dosage; + private List? _Dosage; /// /// Indicates whether the medication is or is not being consumed or administered. /// [FhirElement("adherence", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.MedicationStatement.AdherenceComponent Adherence + public Hl7.Fhir.Model.MedicationStatement.AdherenceComponent? Adherence { get { return _Adherence; } set { _Adherence = value; OnPropertyChanged("Adherence"); } } - private Hl7.Fhir.Model.MedicationStatement.AdherenceComponent _Adherence; + private Hl7.Fhir.Model.MedicationStatement.AdherenceComponent? _Adherence; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicationStatement; - - if (dest == null) - { + if(other is not MedicationStatement dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Medication != null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)Medication.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(DateAssertedElement != null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)DateAssertedElement.DeepCopyInternal(); - if(InformationSource.Any()) dest.InformationSource = new List(InformationSource.DeepCopyInternal()); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelatedClinicalInformation.Any()) dest.RelatedClinicalInformation = new List(RelatedClinicalInformation.DeepCopyInternal()); - if(RenderedDosageInstructionElement != null) dest.RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)RenderedDosageInstructionElement.DeepCopyInternal(); - if(Dosage.Any()) dest.Dosage = new List(Dosage.DeepCopyInternal()); - if(Adherence != null) dest.Adherence = (Hl7.Fhir.Model.MedicationStatement.AdherenceComponent)Adherence.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Medication is not null) dest.Medication = (Hl7.Fhir.Model.CodeableReference)_Medication.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_DateAssertedElement is not null) dest.DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)_DateAssertedElement.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = new List(_InformationSource.DeepCopyInternal()); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelatedClinicalInformation is not null) dest.RelatedClinicalInformation = new List(_RelatedClinicalInformation.DeepCopyInternal()); + if(_RenderedDosageInstructionElement is not null) dest.RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)_RenderedDosageInstructionElement.DeepCopyInternal(); + if(_Dosage is not null) dest.Dosage = new List(_Dosage.DeepCopyInternal()); + if(_Adherence is not null) dest.Adherence = (Hl7.Fhir.Model.MedicationStatement.AdherenceComponent)_Adherence.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -554,146 +540,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicationStatement; - if(otherT == null) return false; + if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Medication, otherT.Medication)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(DateAssertedElement, otherT.DateAssertedElement)) return false; - if(!comparer.ListEquals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelatedClinicalInformation, otherT.RelatedClinicalInformation)) return false; - if(!comparer.Equals(RenderedDosageInstructionElement, otherT.RenderedDosageInstructionElement)) return false; - if(!comparer.ListEquals(Dosage, otherT.Dosage)) return false; - if(!comparer.Equals(Adherence, otherT.Adherence)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Medication, otherT._Medication)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_DateAssertedElement, otherT._DateAssertedElement)) return false; + if(!comparer.ListEquals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelatedClinicalInformation, otherT._RelatedClinicalInformation)) return false; + if(!comparer.Equals(_RenderedDosageInstructionElement, otherT._RenderedDosageInstructionElement)) return false; + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + if(!comparer.Equals(_Adherence, otherT._Adherence)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "medication": - value = Medication; - return Medication is not null; + value = _Medication; + return _Medication is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "dateAsserted": - value = DateAssertedElement; - return DateAssertedElement is not null; + value = _DateAssertedElement; + return _DateAssertedElement is not null; case "informationSource": - value = InformationSource; - return InformationSource?.Any() == true; + value = _InformationSource; + return _InformationSource?.Any() == true; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relatedClinicalInformation": - value = RelatedClinicalInformation; - return RelatedClinicalInformation?.Any() == true; + value = _RelatedClinicalInformation; + return _RelatedClinicalInformation?.Any() == true; case "renderedDosageInstruction": - value = RenderedDosageInstructionElement; - return RenderedDosageInstructionElement is not null; + value = _RenderedDosageInstructionElement; + return _RenderedDosageInstructionElement is not null; case "dosage": - value = Dosage; - return Dosage?.Any() == true; + value = _Dosage; + return _Dosage?.Any() == true; case "adherence": - value = Adherence; - return Adherence is not null; + value = _Adherence; + return _Adherence is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "medication": - Medication = (Hl7.Fhir.Model.CodeableReference)value; + Medication = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "dateAsserted": - DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateAssertedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "informationSource": - InformationSource = (List)value; + InformationSource = (List?)value!; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relatedClinicalInformation": - RelatedClinicalInformation = (List)value; + RelatedClinicalInformation = (List?)value!; return this; case "renderedDosageInstruction": - RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown)value; + RenderedDosageInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "dosage": - Dosage = (List)value; + Dosage = (List?)value!; return this; case "adherence": - Adherence = (Hl7.Fhir.Model.MedicationStatement.AdherenceComponent)value; + Adherence = (Hl7.Fhir.Model.MedicationStatement.AdherenceComponent?)value; return this; default: return base.SetValue(key, value); @@ -704,23 +690,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Medication is not null) yield return new KeyValuePair("medication",Medication); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",DateAssertedElement); - if (InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",InformationSource); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelatedClinicalInformation?.Any() == true) yield return new KeyValuePair("relatedClinicalInformation",RelatedClinicalInformation); - if (RenderedDosageInstructionElement is not null) yield return new KeyValuePair("renderedDosageInstruction",RenderedDosageInstructionElement); - if (Dosage?.Any() == true) yield return new KeyValuePair("dosage",Dosage); - if (Adherence is not null) yield return new KeyValuePair("adherence",Adherence); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Medication is not null) yield return new KeyValuePair("medication",_Medication); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_DateAssertedElement is not null) yield return new KeyValuePair("dateAsserted",_DateAssertedElement); + if (_InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",_InformationSource); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelatedClinicalInformation?.Any() == true) yield return new KeyValuePair("relatedClinicalInformation",_RelatedClinicalInformation); + if (_RenderedDosageInstructionElement is not null) yield return new KeyValuePair("renderedDosageInstruction",_RenderedDosageInstructionElement); + if (_Dosage?.Any() == true) yield return new KeyValuePair("dosage",_Dosage); + if (_Adherence is not null) yield return new KeyValuePair("adherence",_Adherence); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs index 7c5741a93..d3f028479 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -78,13 +81,13 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("ProductContactType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A product specific contact, person (in a role), or an organization. @@ -94,26 +97,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [References("Organization","PractitionerRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Contact + public Hl7.Fhir.Model.ResourceReference? Contact { get { return _Contact; } set { _Contact = value; OnPropertyChanged("Contact"); } } - private Hl7.Fhir.Model.ResourceReference _Contact; + private Hl7.Fhir.Model.ResourceReference? _Contact; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Contact != null) dest.Contact = (Hl7.Fhir.Model.ResourceReference)Contact.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = (Hl7.Fhir.Model.ResourceReference)_Contact.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -125,41 +124,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Contact, otherT.Contact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Contact, otherT._Contact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "contact": - value = Contact; - return Contact is not null; + value = _Contact; + return _Contact is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "contact": - Contact = (Hl7.Fhir.Model.ResourceReference)value; + Contact = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -170,8 +169,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Contact is not null) yield return new KeyValuePair("contact",Contact); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Contact is not null) yield return new KeyValuePair("contact",_Contact); } } @@ -195,28 +194,25 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("productName", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// The full product name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -227,13 +223,13 @@ public string ProductName [FhirElement("type", InSummary=true, Order=50)] [Binding("ProductNameType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Coding words or phrases of the name. @@ -243,11 +239,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Part { - get { if(_Part==null) _Part = new List(); return _Part; } + get => _Part ?? new List(); set { _Part = value; OnPropertyChanged("Part"); } } - private List _Part; + private List? _Part; /// /// Country and jurisdiction where the name applies. @@ -257,26 +253,22 @@ public List Part [DataMember] public List Usage { - get { if(_Usage==null) _Usage = new List(); return _Usage; } + get => _Usage ?? new List(); set { _Usage = value; OnPropertyChanged("Usage"); } } - private List _Usage; + private List? _Usage; protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Part.Any()) dest.Part = new List(Part.DeepCopyInternal()); - if(Usage.Any()) dest.Usage = new List(Usage.DeepCopyInternal()); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Part is not null) dest.Part = new List(_Part.DeepCopyInternal()); + if(_Usage is not null) dest.Usage = new List(_Usage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -288,55 +280,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Part, otherT.Part)) return false; - if(!comparer.ListEquals(Usage, otherT.Usage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Part, otherT._Part)) return false; + if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "part": - value = Part; - return Part?.Any() == true; + value = _Part; + return _Part?.Any() == true; case "usage": - value = Usage; - return Usage?.Any() == true; + value = _Usage; + return _Usage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "part": - Part = (List)value; + Part = (List?)value!; return this; case "usage": - Usage = (List)value; + Usage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -347,10 +339,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Part?.Any() == true) yield return new KeyValuePair("part",Part); - if (Usage?.Any() == true) yield return new KeyValuePair("usage",Usage); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Part?.Any() == true) yield return new KeyValuePair("part",_Part); + if (_Usage?.Any() == true) yield return new KeyValuePair("usage",_Usage); } } @@ -374,28 +366,25 @@ public partial class PartComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("part", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString PartElement + public Hl7.Fhir.Model.FhirString? PartElement { get { return _PartElement; } set { _PartElement = value; OnPropertyChanged("PartElement"); } } - private Hl7.Fhir.Model.FhirString _PartElement; + private Hl7.Fhir.Model.FhirString? _PartElement; /// /// A fragment of a product name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Part + public string? Part { - get { return PartElement != null ? PartElement.Value : null; } + get => _PartElement?.Value; set { - if (value == null) - PartElement = null; - else - PartElement = new Hl7.Fhir.Model.FhirString(value); + PartElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Part"); } } @@ -407,26 +396,22 @@ public string Part [Binding("ProductNamePartType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as PartComponent; - - if (dest == null) - { + if(other is not PartComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PartElement != null) dest.PartElement = (Hl7.Fhir.Model.FhirString)PartElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_PartElement is not null) dest.PartElement = (Hl7.Fhir.Model.FhirString)_PartElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -438,41 +423,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PartComponent; - if(otherT == null) return false; + if(other is not PartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PartElement, otherT.PartElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "part": - value = PartElement; - return PartElement is not null; + value = _PartElement; + return _PartElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "part": - PartElement = (Hl7.Fhir.Model.FhirString)value; + PartElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -483,8 +468,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PartElement is not null) yield return new KeyValuePair("part",PartElement); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_PartElement is not null) yield return new KeyValuePair("part",_PartElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -512,13 +497,13 @@ public partial class UsageComponent : Hl7.Fhir.Model.BackboneElement [Binding("Country")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Country + public Hl7.Fhir.Model.CodeableConcept? Country { get { return _Country; } set { _Country = value; OnPropertyChanged("Country"); } } - private Hl7.Fhir.Model.CodeableConcept _Country; + private Hl7.Fhir.Model.CodeableConcept? _Country; /// /// Jurisdiction code for where this name applies. @@ -526,13 +511,13 @@ public Hl7.Fhir.Model.CodeableConcept Country [FhirElement("jurisdiction", InSummary=true, Order=50)] [Binding("Jurisdiction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; /// /// Language code for this name. @@ -541,27 +526,23 @@ public Hl7.Fhir.Model.CodeableConcept Jurisdiction [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; protected internal override void CopyToInternal(Base other) { - var dest = other as UsageComponent; - - if (dest == null) - { + if(other is not UsageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Country != null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)Country.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); + if(_Country is not null) dest.Country = (Hl7.Fhir.Model.CodeableConcept)_Country.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -573,48 +554,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UsageComponent; - if(otherT == null) return false; + if(other is not UsageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Country, otherT.Country)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_Language, otherT._Language)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "country": - value = Country; - return Country is not null; + value = _Country; + return _Country is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "country": - Country = (Hl7.Fhir.Model.CodeableConcept)value; + Country = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -625,9 +606,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Country is not null) yield return new KeyValuePair("country",Country); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Language is not null) yield return new KeyValuePair("language",Language); + if (_Country is not null) yield return new KeyValuePair("country",_Country); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Language is not null) yield return new KeyValuePair("language",_Language); } } @@ -654,13 +635,13 @@ public partial class CrossReferenceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("product", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Product + public Hl7.Fhir.Model.CodeableReference? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.CodeableReference _Product; + private Hl7.Fhir.Model.CodeableReference? _Product; /// /// The type of relationship, for instance branded to generic or virtual to actual product. @@ -668,26 +649,22 @@ public Hl7.Fhir.Model.CodeableReference Product [FhirElement("type", InSummary=true, Order=50)] [Binding("ProductCrossReferenceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; protected internal override void CopyToInternal(Base other) { - var dest = other as CrossReferenceComponent; - - if (dest == null) - { + if(other is not CrossReferenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Product != null) dest.Product = (Hl7.Fhir.Model.CodeableReference)Product.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.CodeableReference)_Product.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -699,41 +676,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CrossReferenceComponent; - if(otherT == null) return false; + if(other is not CrossReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "product": - Product = (Hl7.Fhir.Model.CodeableReference)value; + Product = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -744,8 +721,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Product is not null) yield return new KeyValuePair("product",Product); - if (Type is not null) yield return new KeyValuePair("type",Type); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_Type is not null) yield return new KeyValuePair("type",_Type); } } @@ -771,26 +748,26 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Type + public Hl7.Fhir.Model.CodeableReference? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableReference _Type; + private Hl7.Fhir.Model.CodeableReference? _Type; /// /// Date range of applicability. /// [FhirElement("effectiveDate", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Period EffectiveDate + public Hl7.Fhir.Model.Period? EffectiveDate { get { return _EffectiveDate; } set { _EffectiveDate = value; OnPropertyChanged("EffectiveDate"); } } - private Hl7.Fhir.Model.Period _EffectiveDate; + private Hl7.Fhir.Model.Period? _EffectiveDate; /// /// The organization responsible for the particular process, e.g. the manufacturer or importer. @@ -802,11 +779,11 @@ public Hl7.Fhir.Model.Period EffectiveDate [DataMember] public List Organization { - get { if(_Organization==null) _Organization = new List(); return _Organization; } + get => _Organization ?? new List(); set { _Organization = value; OnPropertyChanged("Organization"); } } - private List _Organization; + private List? _Organization; /// /// Specifies whether this process is considered proprietary or confidential. @@ -814,28 +791,24 @@ public List Organization [FhirElement("confidentialityIndicator", InSummary=true, Order=70)] [Binding("ProductConfidentiality")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ConfidentialityIndicator + public Hl7.Fhir.Model.CodeableConcept? ConfidentialityIndicator { get { return _ConfidentialityIndicator; } set { _ConfidentialityIndicator = value; OnPropertyChanged("ConfidentialityIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _ConfidentialityIndicator; + private Hl7.Fhir.Model.CodeableConcept? _ConfidentialityIndicator; protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableReference)Type.DeepCopyInternal(); - if(EffectiveDate != null) dest.EffectiveDate = (Hl7.Fhir.Model.Period)EffectiveDate.DeepCopyInternal(); - if(Organization.Any()) dest.Organization = new List(Organization.DeepCopyInternal()); - if(ConfidentialityIndicator != null) dest.ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)ConfidentialityIndicator.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableReference)_Type.DeepCopyInternal(); + if(_EffectiveDate is not null) dest.EffectiveDate = (Hl7.Fhir.Model.Period)_EffectiveDate.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = new List(_Organization.DeepCopyInternal()); + if(_ConfidentialityIndicator is not null) dest.ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)_ConfidentialityIndicator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -847,55 +820,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(EffectiveDate, otherT.EffectiveDate)) return false; - if(!comparer.ListEquals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(ConfidentialityIndicator, otherT.ConfidentialityIndicator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_EffectiveDate, otherT._EffectiveDate)) return false; + if(!comparer.ListEquals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_ConfidentialityIndicator, otherT._ConfidentialityIndicator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "effectiveDate": - value = EffectiveDate; - return EffectiveDate is not null; + value = _EffectiveDate; + return _EffectiveDate is not null; case "organization": - value = Organization; - return Organization?.Any() == true; + value = _Organization; + return _Organization?.Any() == true; case "confidentialityIndicator": - value = ConfidentialityIndicator; - return ConfidentialityIndicator is not null; + value = _ConfidentialityIndicator; + return _ConfidentialityIndicator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableReference)value; + Type = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "effectiveDate": - EffectiveDate = (Hl7.Fhir.Model.Period)value; + EffectiveDate = (Hl7.Fhir.Model.Period?)value; return this; case "organization": - Organization = (List)value; + Organization = (List?)value!; return this; case "confidentialityIndicator": - ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + ConfidentialityIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -906,10 +879,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (EffectiveDate is not null) yield return new KeyValuePair("effectiveDate",EffectiveDate); - if (Organization?.Any() == true) yield return new KeyValuePair("organization",Organization); - if (ConfidentialityIndicator is not null) yield return new KeyValuePair("confidentialityIndicator",ConfidentialityIndicator); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_EffectiveDate is not null) yield return new KeyValuePair("effectiveDate",_EffectiveDate); + if (_Organization?.Any() == true) yield return new KeyValuePair("organization",_Organization); + if (_ConfidentialityIndicator is not null) yield return new KeyValuePair("confidentialityIndicator",_ConfidentialityIndicator); } } @@ -937,13 +910,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProductCharacteristic")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -952,26 +925,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -983,41 +952,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1028,8 +997,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1042,11 +1011,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Regulatory type, e.g. Investigational or Authorized. @@ -1054,13 +1023,13 @@ public List Identifier [FhirElement("type", InSummary=true, Order=100)] [Binding("MedicinalProductType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// If this medicine applies to human or veterinary uses. @@ -1068,41 +1037,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("domain", InSummary=true, Order=110)] [Binding("MedicinalProductType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Domain + public Hl7.Fhir.Model.CodeableConcept? Domain { get { return _Domain; } set { _Domain = value; OnPropertyChanged("Domain"); } } - private Hl7.Fhir.Model.CodeableConcept _Domain; + private Hl7.Fhir.Model.CodeableConcept? _Domain; /// /// A business identifier relating to a specific version of the product. /// [FhirElement("version", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// A business identifier relating to a specific version of the product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1113,41 +1079,38 @@ public string Version [FhirElement("status", InSummary=true, IsModifier=true, Order=130)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the given status became applicable. /// [FhirElement("statusDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the given status became applicable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -1157,28 +1120,25 @@ public string StatusDate /// [FhirElement("description", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// General description of this product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1189,13 +1149,13 @@ public string Description [FhirElement("combinedPharmaceuticalDoseForm", InSummary=true, Order=160)] [Binding("CombinedDoseForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CombinedPharmaceuticalDoseForm + public Hl7.Fhir.Model.CodeableConcept? CombinedPharmaceuticalDoseForm { get { return _CombinedPharmaceuticalDoseForm; } set { _CombinedPharmaceuticalDoseForm = value; OnPropertyChanged("CombinedPharmaceuticalDoseForm"); } } - private Hl7.Fhir.Model.CodeableConcept _CombinedPharmaceuticalDoseForm; + private Hl7.Fhir.Model.CodeableConcept? _CombinedPharmaceuticalDoseForm; /// /// The path by which the product is taken into or makes contact with the body. @@ -1206,39 +1166,36 @@ public Hl7.Fhir.Model.CodeableConcept CombinedPharmaceuticalDoseForm [DataMember] public List Route { - get { if(_Route==null) _Route = new List(); return _Route; } + get => _Route ?? new List(); set { _Route = value; OnPropertyChanged("Route"); } } - private List _Route; + private List? _Route; /// /// Description of indication(s) for this product, used when structured indications are not required. /// [FhirElement("indication", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Markdown IndicationElement + public Hl7.Fhir.Model.Markdown? IndicationElement { get { return _IndicationElement; } set { _IndicationElement = value; OnPropertyChanged("IndicationElement"); } } - private Hl7.Fhir.Model.Markdown _IndicationElement; + private Hl7.Fhir.Model.Markdown? _IndicationElement; /// /// Description of indication(s) for this product, used when structured indications are not required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Indication + public string? Indication { - get { return IndicationElement != null ? IndicationElement.Value : null; } + get => _IndicationElement?.Value; set { - if (value == null) - IndicationElement = null; - else - IndicationElement = new Hl7.Fhir.Model.Markdown(value); + IndicationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Indication"); } } @@ -1249,13 +1206,13 @@ public string Indication [FhirElement("legalStatusOfSupply", InSummary=true, Order=190)] [Binding("LegalStatusOfSupply")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply + public Hl7.Fhir.Model.CodeableConcept? LegalStatusOfSupply { get { return _LegalStatusOfSupply; } set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } - private Hl7.Fhir.Model.CodeableConcept _LegalStatusOfSupply; + private Hl7.Fhir.Model.CodeableConcept? _LegalStatusOfSupply; /// /// Whether the Medicinal Product is subject to additional monitoring for regulatory reasons. @@ -1263,13 +1220,13 @@ public Hl7.Fhir.Model.CodeableConcept LegalStatusOfSupply [FhirElement("additionalMonitoringIndicator", InSummary=true, Order=200)] [Binding("AdditionalMonitoring")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AdditionalMonitoringIndicator + public Hl7.Fhir.Model.CodeableConcept? AdditionalMonitoringIndicator { get { return _AdditionalMonitoringIndicator; } set { _AdditionalMonitoringIndicator = value; OnPropertyChanged("AdditionalMonitoringIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _AdditionalMonitoringIndicator; + private Hl7.Fhir.Model.CodeableConcept? _AdditionalMonitoringIndicator; /// /// Whether the Medicinal Product is subject to special measures for regulatory reasons. @@ -1280,11 +1237,11 @@ public Hl7.Fhir.Model.CodeableConcept AdditionalMonitoringIndicator [DataMember] public List SpecialMeasures { - get { if(_SpecialMeasures==null) _SpecialMeasures = new List(); return _SpecialMeasures; } + get => _SpecialMeasures ?? new List(); set { _SpecialMeasures = value; OnPropertyChanged("SpecialMeasures"); } } - private List _SpecialMeasures; + private List? _SpecialMeasures; /// /// If authorised for use in children. @@ -1292,13 +1249,13 @@ public List SpecialMeasures [FhirElement("pediatricUseIndicator", InSummary=true, Order=220)] [Binding("PediatricUse")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PediatricUseIndicator + public Hl7.Fhir.Model.CodeableConcept? PediatricUseIndicator { get { return _PediatricUseIndicator; } set { _PediatricUseIndicator = value; OnPropertyChanged("PediatricUseIndicator"); } } - private Hl7.Fhir.Model.CodeableConcept _PediatricUseIndicator; + private Hl7.Fhir.Model.CodeableConcept? _PediatricUseIndicator; /// /// Allows the product to be classified by various systems. @@ -1309,11 +1266,11 @@ public Hl7.Fhir.Model.CodeableConcept PediatricUseIndicator [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// Marketing status of the medicinal product, in contrast to marketing authorization. @@ -1323,11 +1280,11 @@ public List Classification [DataMember] public List MarketingStatus { - get { if(_MarketingStatus==null) _MarketingStatus = new List(); return _MarketingStatus; } + get => _MarketingStatus ?? new List(); set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } - private List _MarketingStatus; + private List? _MarketingStatus; /// /// Package type for the product. @@ -1338,11 +1295,11 @@ public List MarketingStatus [DataMember] public List PackagedMedicinalProduct { - get { if(_PackagedMedicinalProduct==null) _PackagedMedicinalProduct = new List(); return _PackagedMedicinalProduct; } + get => _PackagedMedicinalProduct ?? new List(); set { _PackagedMedicinalProduct = value; OnPropertyChanged("PackagedMedicinalProduct"); } } - private List _PackagedMedicinalProduct; + private List? _PackagedMedicinalProduct; /// /// Types of medicinal manufactured items and/or devices that this product consists of, such as tablets, capsule, or syringes. @@ -1354,11 +1311,11 @@ public List PackagedMedicinalProduct [DataMember] public List ComprisedOf { - get { if(_ComprisedOf==null) _ComprisedOf = new List(); return _ComprisedOf; } + get => _ComprisedOf ?? new List(); set { _ComprisedOf = value; OnPropertyChanged("ComprisedOf"); } } - private List _ComprisedOf; + private List? _ComprisedOf; /// /// The ingredients of this medicinal product - when not detailed in other resources. @@ -1369,11 +1326,11 @@ public List ComprisedOf [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Any component of the drug product which is not the chemical entity defined as the drug substance, or an excipient in the drug product. @@ -1384,11 +1341,11 @@ public List Ingredient [DataMember] public List Impurity { - get { if(_Impurity==null) _Impurity = new List(); return _Impurity; } + get => _Impurity ?? new List(); set { _Impurity = value; OnPropertyChanged("Impurity"); } } - private List _Impurity; + private List? _Impurity; /// /// Additional documentation about the medicinal product. @@ -1400,11 +1357,11 @@ public List Impurity [DataMember] public List AttachedDocument { - get { if(_AttachedDocument==null) _AttachedDocument = new List(); return _AttachedDocument; } + get => _AttachedDocument ?? new List(); set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } - private List _AttachedDocument; + private List? _AttachedDocument; /// /// A master file for the medicinal product (e.g. Pharmacovigilance System Master File). @@ -1416,11 +1373,11 @@ public List AttachedDocument [DataMember] public List MasterFile { - get { if(_MasterFile==null) _MasterFile = new List(); return _MasterFile; } + get => _MasterFile ?? new List(); set { _MasterFile = value; OnPropertyChanged("MasterFile"); } } - private List _MasterFile; + private List? _MasterFile; /// /// A product specific contact, person (in a role), or an organization. @@ -1430,11 +1387,11 @@ public List MasterFile [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Clinical trials or studies that this product is involved in. @@ -1446,11 +1403,11 @@ public List Contact [DataMember] public List ClinicalTrial { - get { if(_ClinicalTrial==null) _ClinicalTrial = new List(); return _ClinicalTrial; } + get => _ClinicalTrial ?? new List(); set { _ClinicalTrial = value; OnPropertyChanged("ClinicalTrial"); } } - private List _ClinicalTrial; + private List? _ClinicalTrial; /// /// A code that this product is known by, within some formal terminology. @@ -1461,11 +1418,11 @@ public List ClinicalTrial [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// The product's name, including full name and possibly coded parts. @@ -1475,11 +1432,11 @@ public List Code [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// Reference to another product, e.g. for linking authorised to investigational product. @@ -1489,11 +1446,11 @@ public List Name [DataMember] public List CrossReference { - get { if(_CrossReference==null) _CrossReference = new List(); return _CrossReference; } + get => _CrossReference ?? new List(); set { _CrossReference = value; OnPropertyChanged("CrossReference"); } } - private List _CrossReference; + private List? _CrossReference; /// /// A manufacturing or administrative process for the medicinal product. @@ -1503,11 +1460,11 @@ public List C [DataMember] public List Operation { - get { if(_Operation==null) _Operation = new List(); return _Operation; } + get => _Operation ?? new List(); set { _Operation = value; OnPropertyChanged("Operation"); } } - private List _Operation; + private List? _Operation; /// /// Key product features such as "sugar free", "modified release". @@ -1517,53 +1474,49 @@ public List Operat [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MedicinalProductDefinition; - - if (dest == null) - { + if(other is not MedicinalProductDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Domain != null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)Domain.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(CombinedPharmaceuticalDoseForm != null) dest.CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)CombinedPharmaceuticalDoseForm.DeepCopyInternal(); - if(Route.Any()) dest.Route = new List(Route.DeepCopyInternal()); - if(IndicationElement != null) dest.IndicationElement = (Hl7.Fhir.Model.Markdown)IndicationElement.DeepCopyInternal(); - if(LegalStatusOfSupply != null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)LegalStatusOfSupply.DeepCopyInternal(); - if(AdditionalMonitoringIndicator != null) dest.AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)AdditionalMonitoringIndicator.DeepCopyInternal(); - if(SpecialMeasures.Any()) dest.SpecialMeasures = new List(SpecialMeasures.DeepCopyInternal()); - if(PediatricUseIndicator != null) dest.PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)PediatricUseIndicator.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(MarketingStatus.Any()) dest.MarketingStatus = new List(MarketingStatus.DeepCopyInternal()); - if(PackagedMedicinalProduct.Any()) dest.PackagedMedicinalProduct = new List(PackagedMedicinalProduct.DeepCopyInternal()); - if(ComprisedOf.Any()) dest.ComprisedOf = new List(ComprisedOf.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(Impurity.Any()) dest.Impurity = new List(Impurity.DeepCopyInternal()); - if(AttachedDocument.Any()) dest.AttachedDocument = new List(AttachedDocument.DeepCopyInternal()); - if(MasterFile.Any()) dest.MasterFile = new List(MasterFile.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(ClinicalTrial.Any()) dest.ClinicalTrial = new List(ClinicalTrial.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(CrossReference.Any()) dest.CrossReference = new List(CrossReference.DeepCopyInternal()); - if(Operation.Any()) dest.Operation = new List(Operation.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Domain is not null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)_Domain.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_CombinedPharmaceuticalDoseForm is not null) dest.CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)_CombinedPharmaceuticalDoseForm.DeepCopyInternal(); + if(_Route is not null) dest.Route = new List(_Route.DeepCopyInternal()); + if(_IndicationElement is not null) dest.IndicationElement = (Hl7.Fhir.Model.Markdown)_IndicationElement.DeepCopyInternal(); + if(_LegalStatusOfSupply is not null) dest.LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)_LegalStatusOfSupply.DeepCopyInternal(); + if(_AdditionalMonitoringIndicator is not null) dest.AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)_AdditionalMonitoringIndicator.DeepCopyInternal(); + if(_SpecialMeasures is not null) dest.SpecialMeasures = new List(_SpecialMeasures.DeepCopyInternal()); + if(_PediatricUseIndicator is not null) dest.PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)_PediatricUseIndicator.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_MarketingStatus is not null) dest.MarketingStatus = new List(_MarketingStatus.DeepCopyInternal()); + if(_PackagedMedicinalProduct is not null) dest.PackagedMedicinalProduct = new List(_PackagedMedicinalProduct.DeepCopyInternal()); + if(_ComprisedOf is not null) dest.ComprisedOf = new List(_ComprisedOf.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_Impurity is not null) dest.Impurity = new List(_Impurity.DeepCopyInternal()); + if(_AttachedDocument is not null) dest.AttachedDocument = new List(_AttachedDocument.DeepCopyInternal()); + if(_MasterFile is not null) dest.MasterFile = new List(_MasterFile.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_ClinicalTrial is not null) dest.ClinicalTrial = new List(_ClinicalTrial.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_CrossReference is not null) dest.CrossReference = new List(_CrossReference.DeepCopyInternal()); + if(_Operation is not null) dest.Operation = new List(_Operation.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1575,230 +1528,230 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MedicinalProductDefinition; - if(otherT == null) return false; + if(other is not MedicinalProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Domain, otherT.Domain)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(CombinedPharmaceuticalDoseForm, otherT.CombinedPharmaceuticalDoseForm)) return false; - if(!comparer.ListEquals(Route, otherT.Route)) return false; - if(!comparer.Equals(IndicationElement, otherT.IndicationElement)) return false; - if(!comparer.Equals(LegalStatusOfSupply, otherT.LegalStatusOfSupply)) return false; - if(!comparer.Equals(AdditionalMonitoringIndicator, otherT.AdditionalMonitoringIndicator)) return false; - if(!comparer.ListEquals(SpecialMeasures, otherT.SpecialMeasures)) return false; - if(!comparer.Equals(PediatricUseIndicator, otherT.PediatricUseIndicator)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.ListEquals(MarketingStatus, otherT.MarketingStatus)) return false; - if(!comparer.ListEquals(PackagedMedicinalProduct, otherT.PackagedMedicinalProduct)) return false; - if(!comparer.ListEquals(ComprisedOf, otherT.ComprisedOf)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(Impurity, otherT.Impurity)) return false; - if(!comparer.ListEquals(AttachedDocument, otherT.AttachedDocument)) return false; - if(!comparer.ListEquals(MasterFile, otherT.MasterFile)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(ClinicalTrial, otherT.ClinicalTrial)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(CrossReference, otherT.CrossReference)) return false; - if(!comparer.ListEquals(Operation, otherT.Operation)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Domain, otherT._Domain)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_CombinedPharmaceuticalDoseForm, otherT._CombinedPharmaceuticalDoseForm)) return false; + if(!comparer.ListEquals(_Route, otherT._Route)) return false; + if(!comparer.Equals(_IndicationElement, otherT._IndicationElement)) return false; + if(!comparer.Equals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; + if(!comparer.Equals(_AdditionalMonitoringIndicator, otherT._AdditionalMonitoringIndicator)) return false; + if(!comparer.ListEquals(_SpecialMeasures, otherT._SpecialMeasures)) return false; + if(!comparer.Equals(_PediatricUseIndicator, otherT._PediatricUseIndicator)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.ListEquals(_MarketingStatus, otherT._MarketingStatus)) return false; + if(!comparer.ListEquals(_PackagedMedicinalProduct, otherT._PackagedMedicinalProduct)) return false; + if(!comparer.ListEquals(_ComprisedOf, otherT._ComprisedOf)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_Impurity, otherT._Impurity)) return false; + if(!comparer.ListEquals(_AttachedDocument, otherT._AttachedDocument)) return false; + if(!comparer.ListEquals(_MasterFile, otherT._MasterFile)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_ClinicalTrial, otherT._ClinicalTrial)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_CrossReference, otherT._CrossReference)) return false; + if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "domain": - value = Domain; - return Domain is not null; + value = _Domain; + return _Domain is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "combinedPharmaceuticalDoseForm": - value = CombinedPharmaceuticalDoseForm; - return CombinedPharmaceuticalDoseForm is not null; + value = _CombinedPharmaceuticalDoseForm; + return _CombinedPharmaceuticalDoseForm is not null; case "route": - value = Route; - return Route?.Any() == true; + value = _Route; + return _Route?.Any() == true; case "indication": - value = IndicationElement; - return IndicationElement is not null; + value = _IndicationElement; + return _IndicationElement is not null; case "legalStatusOfSupply": - value = LegalStatusOfSupply; - return LegalStatusOfSupply is not null; + value = _LegalStatusOfSupply; + return _LegalStatusOfSupply is not null; case "additionalMonitoringIndicator": - value = AdditionalMonitoringIndicator; - return AdditionalMonitoringIndicator is not null; + value = _AdditionalMonitoringIndicator; + return _AdditionalMonitoringIndicator is not null; case "specialMeasures": - value = SpecialMeasures; - return SpecialMeasures?.Any() == true; + value = _SpecialMeasures; + return _SpecialMeasures?.Any() == true; case "pediatricUseIndicator": - value = PediatricUseIndicator; - return PediatricUseIndicator is not null; + value = _PediatricUseIndicator; + return _PediatricUseIndicator is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "marketingStatus": - value = MarketingStatus; - return MarketingStatus?.Any() == true; + value = _MarketingStatus; + return _MarketingStatus?.Any() == true; case "packagedMedicinalProduct": - value = PackagedMedicinalProduct; - return PackagedMedicinalProduct?.Any() == true; + value = _PackagedMedicinalProduct; + return _PackagedMedicinalProduct?.Any() == true; case "comprisedOf": - value = ComprisedOf; - return ComprisedOf?.Any() == true; + value = _ComprisedOf; + return _ComprisedOf?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "impurity": - value = Impurity; - return Impurity?.Any() == true; + value = _Impurity; + return _Impurity?.Any() == true; case "attachedDocument": - value = AttachedDocument; - return AttachedDocument?.Any() == true; + value = _AttachedDocument; + return _AttachedDocument?.Any() == true; case "masterFile": - value = MasterFile; - return MasterFile?.Any() == true; + value = _MasterFile; + return _MasterFile?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "clinicalTrial": - value = ClinicalTrial; - return ClinicalTrial?.Any() == true; + value = _ClinicalTrial; + return _ClinicalTrial?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "crossReference": - value = CrossReference; - return CrossReference?.Any() == true; + value = _CrossReference; + return _CrossReference?.Any() == true; case "operation": - value = Operation; - return Operation?.Any() == true; + value = _Operation; + return _Operation?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "domain": - Domain = (Hl7.Fhir.Model.CodeableConcept)value; + Domain = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "combinedPharmaceuticalDoseForm": - CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept)value; + CombinedPharmaceuticalDoseForm = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "route": - Route = (List)value; + Route = (List?)value!; return this; case "indication": - IndicationElement = (Hl7.Fhir.Model.Markdown)value; + IndicationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "legalStatusOfSupply": - LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept)value; + LegalStatusOfSupply = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additionalMonitoringIndicator": - AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + AdditionalMonitoringIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specialMeasures": - SpecialMeasures = (List)value; + SpecialMeasures = (List?)value!; return this; case "pediatricUseIndicator": - PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept)value; + PediatricUseIndicator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "marketingStatus": - MarketingStatus = (List)value; + MarketingStatus = (List?)value!; return this; case "packagedMedicinalProduct": - PackagedMedicinalProduct = (List)value; + PackagedMedicinalProduct = (List?)value!; return this; case "comprisedOf": - ComprisedOf = (List)value; + ComprisedOf = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "impurity": - Impurity = (List)value; + Impurity = (List?)value!; return this; case "attachedDocument": - AttachedDocument = (List)value; + AttachedDocument = (List?)value!; return this; case "masterFile": - MasterFile = (List)value; + MasterFile = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "clinicalTrial": - ClinicalTrial = (List)value; + ClinicalTrial = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "crossReference": - CrossReference = (List)value; + CrossReference = (List?)value!; return this; case "operation": - Operation = (List)value; + Operation = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1809,35 +1762,35 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Domain is not null) yield return new KeyValuePair("domain",Domain); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (CombinedPharmaceuticalDoseForm is not null) yield return new KeyValuePair("combinedPharmaceuticalDoseForm",CombinedPharmaceuticalDoseForm); - if (Route?.Any() == true) yield return new KeyValuePair("route",Route); - if (IndicationElement is not null) yield return new KeyValuePair("indication",IndicationElement); - if (LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",LegalStatusOfSupply); - if (AdditionalMonitoringIndicator is not null) yield return new KeyValuePair("additionalMonitoringIndicator",AdditionalMonitoringIndicator); - if (SpecialMeasures?.Any() == true) yield return new KeyValuePair("specialMeasures",SpecialMeasures); - if (PediatricUseIndicator is not null) yield return new KeyValuePair("pediatricUseIndicator",PediatricUseIndicator); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",MarketingStatus); - if (PackagedMedicinalProduct?.Any() == true) yield return new KeyValuePair("packagedMedicinalProduct",PackagedMedicinalProduct); - if (ComprisedOf?.Any() == true) yield return new KeyValuePair("comprisedOf",ComprisedOf); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (Impurity?.Any() == true) yield return new KeyValuePair("impurity",Impurity); - if (AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",AttachedDocument); - if (MasterFile?.Any() == true) yield return new KeyValuePair("masterFile",MasterFile); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (ClinicalTrial?.Any() == true) yield return new KeyValuePair("clinicalTrial",ClinicalTrial); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (CrossReference?.Any() == true) yield return new KeyValuePair("crossReference",CrossReference); - if (Operation?.Any() == true) yield return new KeyValuePair("operation",Operation); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Domain is not null) yield return new KeyValuePair("domain",_Domain); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_CombinedPharmaceuticalDoseForm is not null) yield return new KeyValuePair("combinedPharmaceuticalDoseForm",_CombinedPharmaceuticalDoseForm); + if (_Route?.Any() == true) yield return new KeyValuePair("route",_Route); + if (_IndicationElement is not null) yield return new KeyValuePair("indication",_IndicationElement); + if (_LegalStatusOfSupply is not null) yield return new KeyValuePair("legalStatusOfSupply",_LegalStatusOfSupply); + if (_AdditionalMonitoringIndicator is not null) yield return new KeyValuePair("additionalMonitoringIndicator",_AdditionalMonitoringIndicator); + if (_SpecialMeasures?.Any() == true) yield return new KeyValuePair("specialMeasures",_SpecialMeasures); + if (_PediatricUseIndicator is not null) yield return new KeyValuePair("pediatricUseIndicator",_PediatricUseIndicator); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",_MarketingStatus); + if (_PackagedMedicinalProduct?.Any() == true) yield return new KeyValuePair("packagedMedicinalProduct",_PackagedMedicinalProduct); + if (_ComprisedOf?.Any() == true) yield return new KeyValuePair("comprisedOf",_ComprisedOf); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_Impurity?.Any() == true) yield return new KeyValuePair("impurity",_Impurity); + if (_AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",_AttachedDocument); + if (_MasterFile?.Any() == true) yield return new KeyValuePair("masterFile",_MasterFile); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_ClinicalTrial?.Any() == true) yield return new KeyValuePair("clinicalTrial",_ClinicalTrial); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_CrossReference?.Any() == true) yield return new KeyValuePair("crossReference",_CrossReference); + if (_Operation?.Any() == true) yield return new KeyValuePair("operation",_Operation); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs index 6b7f9ebee..bb189a76f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -146,13 +149,13 @@ public partial class FocusComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResourceType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// Type of resource @@ -161,13 +164,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.ResourceType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -177,28 +177,25 @@ public Hl7.Fhir.Model.ResourceType? Code /// [FhirElement("profile", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// Profile that must be adhered to by focus /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } @@ -209,13 +206,13 @@ public string Profile [FhirElement("min", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt MinElement + public Hl7.Fhir.Model.UnsignedInt? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.UnsignedInt _MinElement; + private Hl7.Fhir.Model.UnsignedInt? _MinElement; /// /// Minimum number of focuses of this type @@ -224,13 +221,10 @@ public Hl7.Fhir.Model.UnsignedInt MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.UnsignedInt(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Min"); } } @@ -240,46 +234,39 @@ public int? Min /// [FhirElement("max", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum number of focuses of this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FocusComponent; - - if (dest == null) - { + if(other is not FocusComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.UnsignedInt)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -291,55 +278,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocusComponent; - if(otherT == null) return false; + if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.UnsignedInt)value; + MinElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -350,10 +337,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); } } @@ -381,28 +368,25 @@ public partial class AllowedResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("message", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical MessageElement + public Hl7.Fhir.Model.Canonical? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Canonical _MessageElement; + private Hl7.Fhir.Model.Canonical? _MessageElement; /// /// Reference to allowed message definition response /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Canonical(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Message"); } } @@ -412,44 +396,37 @@ public string Message /// [FhirElement("situation", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown SituationElement + public Hl7.Fhir.Model.Markdown? SituationElement { get { return _SituationElement; } set { _SituationElement = value; OnPropertyChanged("SituationElement"); } } - private Hl7.Fhir.Model.Markdown _SituationElement; + private Hl7.Fhir.Model.Markdown? _SituationElement; /// /// When should this response be used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Situation + public string? Situation { - get { return SituationElement != null ? SituationElement.Value : null; } + get => _SituationElement?.Value; set { - if (value == null) - SituationElement = null; - else - SituationElement = new Hl7.Fhir.Model.Markdown(value); + SituationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Situation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AllowedResponseComponent; - - if (dest == null) - { + if(other is not AllowedResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Canonical)MessageElement.DeepCopyInternal(); - if(SituationElement != null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)SituationElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Canonical)_MessageElement.DeepCopyInternal(); + if(_SituationElement is not null) dest.SituationElement = (Hl7.Fhir.Model.Markdown)_SituationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -461,41 +438,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllowedResponseComponent; - if(otherT == null) return false; + if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(SituationElement, otherT.SituationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "situation": - value = SituationElement; - return SituationElement is not null; + value = _SituationElement; + return _SituationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "message": - MessageElement = (Hl7.Fhir.Model.Canonical)value; + MessageElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "situation": - SituationElement = (Hl7.Fhir.Model.Markdown)value; + SituationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -506,8 +483,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (SituationElement is not null) yield return new KeyValuePair("situation",SituationElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_SituationElement is not null) yield return new KeyValuePair("situation",_SituationElement); } } @@ -517,28 +494,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// The cannonical URL for a given MessageDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -551,39 +525,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the message definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -595,41 +566,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this message definition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this message definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -639,28 +607,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this message definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -673,24 +638,24 @@ public string Title [DataMember] public List ReplacesElement { - get { if(_ReplacesElement==null) _ReplacesElement = new List(); return _ReplacesElement; } + get => _ReplacesElement ?? new List(); set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } - private List _ReplacesElement; + private List? _ReplacesElement; /// /// Takes the place of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Replaces + public IEnumerable? Replaces { - get { return ReplacesElement != null ? ReplacesElement.Select(elem => elem.Value) : null; } + get => _ReplacesElement?.Select(elem => elem.Value); set { if (value == null) - ReplacesElement = null; + ReplacesElement = null!; else ReplacesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Replaces"); @@ -705,13 +670,13 @@ public IEnumerable Replaces [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -720,13 +685,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -736,13 +698,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -751,13 +713,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -768,28 +727,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -799,28 +755,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -833,39 +786,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the message definition. /// [FhirElement("description", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the message definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -878,11 +828,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for message definition (if applicable). @@ -893,39 +843,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this message definition is defined. /// [FhirElement("purpose", InSummary=true, Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this message definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -935,28 +882,25 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -966,28 +910,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -997,28 +938,25 @@ public string CopyrightLabel /// [FhirElement("base", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.Canonical BaseElement + public Hl7.Fhir.Model.Canonical? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Hl7.Fhir.Model.Canonical _BaseElement; + private Hl7.Fhir.Model.Canonical? _BaseElement; /// /// Definition this one is based on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Base + public string? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Hl7.Fhir.Model.Canonical(value); + BaseElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Base"); } } @@ -1031,24 +969,24 @@ public string Base [DataMember] public List ParentElement { - get { if(_ParentElement==null) _ParentElement = new List(); return _ParentElement; } + get => _ParentElement ?? new List(); set { _ParentElement = value; OnPropertyChanged("ParentElement"); } } - private List _ParentElement; + private List? _ParentElement; /// /// Protocol/workflow this is part of /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Parent + public IEnumerable? Parent { - get { return ParentElement != null ? ParentElement.Select(elem => elem.Value) : null; } + get => _ParentElement?.Select(elem => elem.Value); set { if (value == null) - ParentElement = null; + ParentElement = null!; else ParentElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Parent"); @@ -1064,13 +1002,13 @@ public IEnumerable Parent [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.FhirUri))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Event + public Hl7.Fhir.Model.DataType? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.DataType _Event; + private Hl7.Fhir.Model.DataType? _Event; /// /// consequence | currency | notification. @@ -1079,13 +1017,13 @@ public Hl7.Fhir.Model.DataType Event [DeclaredType(Type = typeof(Code))] [Binding("MessageSignificanceCategory")] [DataMember] - public Code CategoryElement + public Code? CategoryElement { get { return _CategoryElement; } set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } - private Code _CategoryElement; + private Code? _CategoryElement; /// /// consequence | currency | notification @@ -1094,13 +1032,10 @@ public Code Catego [IgnoreDataMember] public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category { - get { return CategoryElement != null ? CategoryElement.Value : null; } + get => _CategoryElement?.Value; set { - if (value == null) - CategoryElement = null; - else - CategoryElement = new Code(value); + CategoryElement = value is null ? null : new Code(value); OnPropertyChanged("Category"); } } @@ -1113,11 +1048,11 @@ public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// always | on-error | never | on-success. @@ -1126,13 +1061,13 @@ public List Focus [DeclaredType(Type = typeof(Code))] [Binding("messageheader-response-request")] [DataMember] - public Code ResponseRequiredElement + public Code? ResponseRequiredElement { get { return _ResponseRequiredElement; } set { _ResponseRequiredElement = value; OnPropertyChanged("ResponseRequiredElement"); } } - private Code _ResponseRequiredElement; + private Code? _ResponseRequiredElement; /// /// always | on-error | never | on-success @@ -1141,13 +1076,10 @@ public Code Respo [IgnoreDataMember] public Hl7.Fhir.Model.MessageDefinition.MessageheaderResponseRequest? ResponseRequired { - get { return ResponseRequiredElement != null ? ResponseRequiredElement.Value : null; } + get => _ResponseRequiredElement?.Value; set { - if (value == null) - ResponseRequiredElement = null; - else - ResponseRequiredElement = new Code(value); + ResponseRequiredElement = value is null ? null : new Code(value); OnPropertyChanged("ResponseRequired"); } } @@ -1160,39 +1092,36 @@ public Hl7.Fhir.Model.MessageDefinition.MessageheaderResponseRequest? ResponseRe [DataMember] public List AllowedResponse { - get { if(_AllowedResponse==null) _AllowedResponse = new List(); return _AllowedResponse; } + get => _AllowedResponse ?? new List(); set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } - private List _AllowedResponse; + private List? _AllowedResponse; /// /// Canonical reference to a GraphDefinition. /// [FhirElement("graph", Order=340)] [DataMember] - public Hl7.Fhir.Model.Canonical GraphElement + public Hl7.Fhir.Model.Canonical? GraphElement { get { return _GraphElement; } set { _GraphElement = value; OnPropertyChanged("GraphElement"); } } - private Hl7.Fhir.Model.Canonical _GraphElement; + private Hl7.Fhir.Model.Canonical? _GraphElement; /// /// Canonical reference to a GraphDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Graph + public string? Graph { - get { return GraphElement != null ? GraphElement.Value : null; } + get => _GraphElement?.Value; set { - if (value == null) - GraphElement = null; - else - GraphElement = new Hl7.Fhir.Model.Canonical(value); + GraphElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Graph"); } } @@ -1201,40 +1130,36 @@ public string Graph protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDefinition; - - if (dest == null) - { + if(other is not MessageDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(ReplacesElement.Any()) dest.ReplacesElement = new List(ReplacesElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)BaseElement.DeepCopyInternal(); - if(ParentElement.Any()) dest.ParentElement = new List(ParentElement.DeepCopyInternal()); - if(Event != null) dest.Event = (Hl7.Fhir.Model.DataType)Event.DeepCopyInternal(); - if(CategoryElement != null) dest.CategoryElement = (Code)CategoryElement.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(ResponseRequiredElement != null) dest.ResponseRequiredElement = (Code)ResponseRequiredElement.DeepCopyInternal(); - if(AllowedResponse.Any()) dest.AllowedResponse = new List(AllowedResponse.DeepCopyInternal()); - if(GraphElement != null) dest.GraphElement = (Hl7.Fhir.Model.Canonical)GraphElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_ReplacesElement is not null) dest.ReplacesElement = new List(_ReplacesElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)_BaseElement.DeepCopyInternal(); + if(_ParentElement is not null) dest.ParentElement = new List(_ParentElement.DeepCopyInternal()); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.DataType)_Event.DeepCopyInternal(); + if(_CategoryElement is not null) dest.CategoryElement = (Code)_CategoryElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_ResponseRequiredElement is not null) dest.ResponseRequiredElement = (Code)_ResponseRequiredElement.DeepCopyInternal(); + if(_AllowedResponse is not null) dest.AllowedResponse = new List(_AllowedResponse.DeepCopyInternal()); + if(_GraphElement is not null) dest.GraphElement = (Hl7.Fhir.Model.Canonical)_GraphElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1246,209 +1171,209 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDefinition; - if(otherT == null) return false; + if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(ReplacesElement, otherT.ReplacesElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.ListEquals(ParentElement, otherT.ParentElement)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(CategoryElement, otherT.CategoryElement)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(ResponseRequiredElement, otherT.ResponseRequiredElement)) return false; - if(!comparer.ListEquals(AllowedResponse, otherT.AllowedResponse)) return false; - if(!comparer.Equals(GraphElement, otherT.GraphElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_ReplacesElement, otherT._ReplacesElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.ListEquals(_ParentElement, otherT._ParentElement)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; + if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; + if(!comparer.Equals(_GraphElement, otherT._GraphElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "replaces": - value = ReplacesElement; - return ReplacesElement?.Any() == true; + value = _ReplacesElement; + return _ReplacesElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; case "parent": - value = ParentElement; - return ParentElement?.Any() == true; + value = _ParentElement; + return _ParentElement?.Any() == true; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "category": - value = CategoryElement; - return CategoryElement is not null; + value = _CategoryElement; + return _CategoryElement is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "responseRequired": - value = ResponseRequiredElement; - return ResponseRequiredElement is not null; + value = _ResponseRequiredElement; + return _ResponseRequiredElement is not null; case "allowedResponse": - value = AllowedResponse; - return AllowedResponse?.Any() == true; + value = _AllowedResponse; + return _AllowedResponse?.Any() == true; case "graph": - value = GraphElement; - return GraphElement is not null; + value = _GraphElement; + return _GraphElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "replaces": - ReplacesElement = (List)value; + ReplacesElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "base": - BaseElement = (Hl7.Fhir.Model.Canonical)value; + BaseElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "parent": - ParentElement = (List)value; + ParentElement = (List?)value!; return this; case "event": - Event = (Hl7.Fhir.Model.DataType)value; + Event = (Hl7.Fhir.Model.DataType?)value; return this; case "category": - CategoryElement = (Code)value; + CategoryElement = (Code?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "responseRequired": - ResponseRequiredElement = (Code)value; + ResponseRequiredElement = (Code?)value; return this; case "allowedResponse": - AllowedResponse = (List)value; + AllowedResponse = (List?)value!; return this; case "graph": - GraphElement = (Hl7.Fhir.Model.Canonical)value; + GraphElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1459,32 +1384,32 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",ReplacesElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); - if (ParentElement?.Any() == true) yield return new KeyValuePair("parent",ParentElement); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (CategoryElement is not null) yield return new KeyValuePair("category",CategoryElement); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",ResponseRequiredElement); - if (AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",AllowedResponse); - if (GraphElement is not null) yield return new KeyValuePair("graph",GraphElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_ReplacesElement?.Any() == true) yield return new KeyValuePair("replaces",_ReplacesElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); + if (_ParentElement?.Any() == true) yield return new KeyValuePair("parent",_ParentElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_CategoryElement is not null) yield return new KeyValuePair("category",_CategoryElement); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_ResponseRequiredElement is not null) yield return new KeyValuePair("responseRequired",_ResponseRequiredElement); + if (_AllowedResponse?.Any() == true) yield return new KeyValuePair("allowedResponse",_AllowedResponse); + if (_GraphElement is not null) yield return new KeyValuePair("graph",_GraphElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs index 6b46f67bf..611b71799 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,41 +115,38 @@ public partial class MessageDestinationComponent : Hl7.Fhir.Model.BackboneElemen [References("Endpoint")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Endpoint + public Hl7.Fhir.Model.DataType? Endpoint { get { return _Endpoint; } set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private Hl7.Fhir.Model.DataType _Endpoint; + private Hl7.Fhir.Model.DataType? _Endpoint; /// /// Name of system. /// [FhirElement("name", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -158,13 +158,13 @@ public string Name [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// Intended "real-world" recipient for the data. @@ -173,28 +173,24 @@ public Hl7.Fhir.Model.ResourceReference Target [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Receiver + public Hl7.Fhir.Model.ResourceReference? Receiver { get { return _Receiver; } set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private Hl7.Fhir.Model.ResourceReference _Receiver; + private Hl7.Fhir.Model.ResourceReference? _Receiver; protected internal override void CopyToInternal(Base other) { - var dest = other as MessageDestinationComponent; - - if (dest == null) - { + if(other is not MessageDestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Endpoint != null) dest.Endpoint = (Hl7.Fhir.Model.DataType)Endpoint.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(Receiver != null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)Receiver.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = (Hl7.Fhir.Model.DataType)_Endpoint.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = (Hl7.Fhir.Model.ResourceReference)_Receiver.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -206,55 +202,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageDestinationComponent; - if(otherT == null) return false; + if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(Receiver, otherT.Receiver)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "endpoint": - value = Endpoint; - return Endpoint is not null; + value = _Endpoint; + return _Endpoint is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "receiver": - value = Receiver; - return Receiver is not null; + value = _Receiver; + return _Receiver is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "endpoint": - Endpoint = (Hl7.Fhir.Model.DataType)value; + Endpoint = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (Hl7.Fhir.Model.ResourceReference)value; + Receiver = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -265,10 +261,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Endpoint is not null) yield return new KeyValuePair("endpoint",Endpoint); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (Receiver is not null) yield return new KeyValuePair("receiver",Receiver); + if (_Endpoint is not null) yield return new KeyValuePair("endpoint",_Endpoint); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_Receiver is not null) yield return new KeyValuePair("receiver",_Receiver); } } @@ -297,41 +293,38 @@ public partial class MessageSourceComponent : Hl7.Fhir.Model.BackboneElement [References("Endpoint")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Endpoint + public Hl7.Fhir.Model.DataType? Endpoint { get { return _Endpoint; } set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private Hl7.Fhir.Model.DataType _Endpoint; + private Hl7.Fhir.Model.DataType? _Endpoint; /// /// Name of system. /// [FhirElement("name", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -341,28 +334,25 @@ public string Name /// [FhirElement("software", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString SoftwareElement + public Hl7.Fhir.Model.FhirString? SoftwareElement { get { return _SoftwareElement; } set { _SoftwareElement = value; OnPropertyChanged("SoftwareElement"); } } - private Hl7.Fhir.Model.FhirString _SoftwareElement; + private Hl7.Fhir.Model.FhirString? _SoftwareElement; /// /// Name of software running the system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Software + public string? Software { - get { return SoftwareElement != null ? SoftwareElement.Value : null; } + get => _SoftwareElement?.Value; set { - if (value == null) - SoftwareElement = null; - else - SoftwareElement = new Hl7.Fhir.Model.FhirString(value); + SoftwareElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Software"); } } @@ -372,28 +362,25 @@ public string Software /// [FhirElement("version", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version of software running /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -403,29 +390,25 @@ public string Version /// [FhirElement("contact", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.ContactPoint Contact + public Hl7.Fhir.Model.ContactPoint? Contact { get { return _Contact; } set { _Contact = value; OnPropertyChanged("Contact"); } } - private Hl7.Fhir.Model.ContactPoint _Contact; + private Hl7.Fhir.Model.ContactPoint? _Contact; protected internal override void CopyToInternal(Base other) { - var dest = other as MessageSourceComponent; - - if (dest == null) - { + if(other is not MessageSourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Endpoint != null) dest.Endpoint = (Hl7.Fhir.Model.DataType)Endpoint.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(SoftwareElement != null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)SoftwareElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Contact != null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)Contact.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = (Hl7.Fhir.Model.DataType)_Endpoint.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_SoftwareElement is not null) dest.SoftwareElement = (Hl7.Fhir.Model.FhirString)_SoftwareElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = (Hl7.Fhir.Model.ContactPoint)_Contact.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -437,62 +420,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageSourceComponent; - if(otherT == null) return false; + if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(SoftwareElement, otherT.SoftwareElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Contact, otherT.Contact)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Contact, otherT._Contact)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "endpoint": - value = Endpoint; - return Endpoint is not null; + value = _Endpoint; + return _Endpoint is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "software": - value = SoftwareElement; - return SoftwareElement is not null; + value = _SoftwareElement; + return _SoftwareElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "contact": - value = Contact; - return Contact is not null; + value = _Contact; + return _Contact is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "endpoint": - Endpoint = (Hl7.Fhir.Model.DataType)value; + Endpoint = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "software": - SoftwareElement = (Hl7.Fhir.Model.FhirString)value; + SoftwareElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (Hl7.Fhir.Model.ContactPoint)value; + Contact = (Hl7.Fhir.Model.ContactPoint?)value; return this; default: return base.SetValue(key, value); @@ -503,11 +486,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Endpoint is not null) yield return new KeyValuePair("endpoint",Endpoint); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (SoftwareElement is not null) yield return new KeyValuePair("software",SoftwareElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Contact is not null) yield return new KeyValuePair("contact",Contact); + if (_Endpoint is not null) yield return new KeyValuePair("endpoint",_Endpoint); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_SoftwareElement is not null) yield return new KeyValuePair("software",_SoftwareElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Contact is not null) yield return new KeyValuePair("contact",_Contact); } } @@ -534,13 +517,13 @@ public partial class ResponseComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("identifier", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// ok | transient-error | fatal-error. @@ -550,13 +533,13 @@ public Hl7.Fhir.Model.Identifier Identifier [Binding("ResponseType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CodeElement + public Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Code _CodeElement; + private Code? _CodeElement; /// /// ok | transient-error | fatal-error @@ -565,13 +548,10 @@ public Code CodeElement [IgnoreDataMember] public Hl7.Fhir.Model.MessageHeader.ResponseType? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Code(value); + CodeElement = value is null ? null : new Code(value); OnPropertyChanged("Code"); } } @@ -583,27 +563,23 @@ public Hl7.Fhir.Model.MessageHeader.ResponseType? Code [CLSCompliant(false)] [References("OperationOutcome")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Details + public Hl7.Fhir.Model.ResourceReference? Details { get { return _Details; } set { _Details = value; OnPropertyChanged("Details"); } } - private Hl7.Fhir.Model.ResourceReference _Details; + private Hl7.Fhir.Model.ResourceReference? _Details; protected internal override void CopyToInternal(Base other) { - var dest = other as ResponseComponent; - - if (dest == null) - { + if(other is not ResponseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Code)CodeElement.DeepCopyInternal(); - if(Details != null) dest.Details = (Hl7.Fhir.Model.ResourceReference)Details.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Code)_CodeElement.DeepCopyInternal(); + if(_Details is not null) dest.Details = (Hl7.Fhir.Model.ResourceReference)_Details.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -615,48 +591,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResponseComponent; - if(otherT == null) return false; + if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(Details, otherT.Details)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_Details, otherT._Details)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "details": - value = Details; - return Details is not null; + value = _Details; + return _Details is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "code": - CodeElement = (Code)value; + CodeElement = (Code?)value; return this; case "details": - Details = (Hl7.Fhir.Model.ResourceReference)value; + Details = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -667,9 +643,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (Details is not null) yield return new KeyValuePair("details",Details); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_Details is not null) yield return new KeyValuePair("details",_Details); } } @@ -683,13 +659,13 @@ public override IEnumerable> EnumerateElements() [AllowedTypes(typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Canonical))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Event + public Hl7.Fhir.Model.DataType? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.DataType _Event; + private Hl7.Fhir.Model.DataType? _Event; /// /// Message destination application(s). @@ -699,11 +675,11 @@ public Hl7.Fhir.Model.DataType Event [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Real world sender of the message. @@ -712,13 +688,13 @@ public List Destinatio [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Device","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Sender + public Hl7.Fhir.Model.ResourceReference? Sender { get { return _Sender; } set { _Sender = value; OnPropertyChanged("Sender"); } } - private Hl7.Fhir.Model.ResourceReference _Sender; + private Hl7.Fhir.Model.ResourceReference? _Sender; /// /// The source of the decision. @@ -727,13 +703,13 @@ public Hl7.Fhir.Model.ResourceReference Sender [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Device","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Message source application. @@ -741,13 +717,13 @@ public Hl7.Fhir.Model.ResourceReference Author [FhirElement("source", InSummary=true, Order=130, FiveWs="FiveWs.actor")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source + public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent _Source; + private Hl7.Fhir.Model.MessageHeader.MessageSourceComponent? _Source; /// /// Final responsibility for event. @@ -756,13 +732,13 @@ public Hl7.Fhir.Model.MessageHeader.MessageSourceComponent Source [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Cause of event. @@ -770,26 +746,26 @@ public Hl7.Fhir.Model.ResourceReference Responsible [FhirElement("reason", InSummary=true, Order=150, FiveWs="FiveWs.why[x]")] [Binding("EventReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// If this is a reply to prior message. /// [FhirElement("response", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response + public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.MessageHeader.ResponseComponent _Response; + private Hl7.Fhir.Model.MessageHeader.ResponseComponent? _Response; /// /// The actual content of the message. @@ -801,63 +777,56 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent Response [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Link to the definition for this message. /// [FhirElement("definition", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Link to the definition for this message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as MessageHeader; - - if (dest == null) - { + if(other is not MessageHeader dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Event != null) dest.Event = (Hl7.Fhir.Model.DataType)Event.DeepCopyInternal(); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Sender != null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)Sender.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)Source.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)Response.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.DataType)_Event.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Sender is not null) dest.Sender = (Hl7.Fhir.Model.ResourceReference)_Sender.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)_Source.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)_Response.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -869,97 +838,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MessageHeader; - if(otherT == null) return false; + if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Sender, otherT.Sender)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Sender, otherT._Sender)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "sender": - value = Sender; - return Sender is not null; + value = _Sender; + return _Sender is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - Event = (Hl7.Fhir.Model.DataType)value; + Event = (Hl7.Fhir.Model.DataType?)value; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "sender": - Sender = (Hl7.Fhir.Model.ResourceReference)value; + Sender = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent)value; + Source = (Hl7.Fhir.Model.MessageHeader.MessageSourceComponent?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "response": - Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent)value; + Response = (Hl7.Fhir.Model.MessageHeader.ResponseComponent?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -970,16 +939,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Event is not null) yield return new KeyValuePair("event",Event); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Sender is not null) yield return new KeyValuePair("sender",Sender); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Sender is not null) yield return new KeyValuePair("sender",_Sender); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs index e0bd68489..db12db555 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -148,26 +151,26 @@ public partial class RelativeComponent : Hl7.Fhir.Model.BackboneElement [Binding("LL5323-2")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CoordinateSystem + public Hl7.Fhir.Model.CodeableConcept? CoordinateSystem { get { return _CoordinateSystem; } set { _CoordinateSystem = value; OnPropertyChanged("CoordinateSystem"); } } - private Hl7.Fhir.Model.CodeableConcept _CoordinateSystem; + private Hl7.Fhir.Model.CodeableConcept? _CoordinateSystem; /// /// Indicates the order in which the sequence should be considered when putting multiple 'relative' elements together. /// [FhirElement("ordinalPosition", Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer OrdinalPositionElement + public Hl7.Fhir.Model.Integer? OrdinalPositionElement { get { return _OrdinalPositionElement; } set { _OrdinalPositionElement = value; OnPropertyChanged("OrdinalPositionElement"); } } - private Hl7.Fhir.Model.Integer _OrdinalPositionElement; + private Hl7.Fhir.Model.Integer? _OrdinalPositionElement; /// /// Indicates the order in which the sequence should be considered when putting multiple 'relative' elements together @@ -176,13 +179,10 @@ public Hl7.Fhir.Model.Integer OrdinalPositionElement [IgnoreDataMember] public int? OrdinalPosition { - get { return OrdinalPositionElement != null ? OrdinalPositionElement.Value : null; } + get => _OrdinalPositionElement?.Value; set { - if (value == null) - OrdinalPositionElement = null; - else - OrdinalPositionElement = new Hl7.Fhir.Model.Integer(value); + OrdinalPositionElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("OrdinalPosition"); } } @@ -192,26 +192,26 @@ public int? OrdinalPosition /// [FhirElement("sequenceRange", Order=60)] [DataMember] - public Hl7.Fhir.Model.Range SequenceRange + public Hl7.Fhir.Model.Range? SequenceRange { get { return _SequenceRange; } set { _SequenceRange = value; OnPropertyChanged("SequenceRange"); } } - private Hl7.Fhir.Model.Range _SequenceRange; + private Hl7.Fhir.Model.Range? _SequenceRange; /// /// A sequence used as starting sequence. /// [FhirElement("startingSequence", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent StartingSequence + public Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent? StartingSequence { get { return _StartingSequence; } set { _StartingSequence = value; OnPropertyChanged("StartingSequence"); } } - private Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent _StartingSequence; + private Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent? _StartingSequence; /// /// Changes in sequence from the starting sequence. @@ -221,27 +221,23 @@ public Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent StartingSequen [DataMember] public List Edit { - get { if(_Edit==null) _Edit = new List(); return _Edit; } + get => _Edit ?? new List(); set { _Edit = value; OnPropertyChanged("Edit"); } } - private List _Edit; + private List? _Edit; protected internal override void CopyToInternal(Base other) { - var dest = other as RelativeComponent; - - if (dest == null) - { + if(other is not RelativeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CoordinateSystem != null) dest.CoordinateSystem = (Hl7.Fhir.Model.CodeableConcept)CoordinateSystem.DeepCopyInternal(); - if(OrdinalPositionElement != null) dest.OrdinalPositionElement = (Hl7.Fhir.Model.Integer)OrdinalPositionElement.DeepCopyInternal(); - if(SequenceRange != null) dest.SequenceRange = (Hl7.Fhir.Model.Range)SequenceRange.DeepCopyInternal(); - if(StartingSequence != null) dest.StartingSequence = (Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent)StartingSequence.DeepCopyInternal(); - if(Edit.Any()) dest.Edit = new List(Edit.DeepCopyInternal()); + if(_CoordinateSystem is not null) dest.CoordinateSystem = (Hl7.Fhir.Model.CodeableConcept)_CoordinateSystem.DeepCopyInternal(); + if(_OrdinalPositionElement is not null) dest.OrdinalPositionElement = (Hl7.Fhir.Model.Integer)_OrdinalPositionElement.DeepCopyInternal(); + if(_SequenceRange is not null) dest.SequenceRange = (Hl7.Fhir.Model.Range)_SequenceRange.DeepCopyInternal(); + if(_StartingSequence is not null) dest.StartingSequence = (Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent)_StartingSequence.DeepCopyInternal(); + if(_Edit is not null) dest.Edit = new List(_Edit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -253,62 +249,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelativeComponent; - if(otherT == null) return false; + if(other is not RelativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CoordinateSystem, otherT.CoordinateSystem)) return false; - if(!comparer.Equals(OrdinalPositionElement, otherT.OrdinalPositionElement)) return false; - if(!comparer.Equals(SequenceRange, otherT.SequenceRange)) return false; - if(!comparer.Equals(StartingSequence, otherT.StartingSequence)) return false; - if(!comparer.ListEquals(Edit, otherT.Edit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CoordinateSystem, otherT._CoordinateSystem)) return false; + if(!comparer.Equals(_OrdinalPositionElement, otherT._OrdinalPositionElement)) return false; + if(!comparer.Equals(_SequenceRange, otherT._SequenceRange)) return false; + if(!comparer.Equals(_StartingSequence, otherT._StartingSequence)) return false; + if(!comparer.ListEquals(_Edit, otherT._Edit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "coordinateSystem": - value = CoordinateSystem; - return CoordinateSystem is not null; + value = _CoordinateSystem; + return _CoordinateSystem is not null; case "ordinalPosition": - value = OrdinalPositionElement; - return OrdinalPositionElement is not null; + value = _OrdinalPositionElement; + return _OrdinalPositionElement is not null; case "sequenceRange": - value = SequenceRange; - return SequenceRange is not null; + value = _SequenceRange; + return _SequenceRange is not null; case "startingSequence": - value = StartingSequence; - return StartingSequence is not null; + value = _StartingSequence; + return _StartingSequence is not null; case "edit": - value = Edit; - return Edit?.Any() == true; + value = _Edit; + return _Edit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "coordinateSystem": - CoordinateSystem = (Hl7.Fhir.Model.CodeableConcept)value; + CoordinateSystem = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "ordinalPosition": - OrdinalPositionElement = (Hl7.Fhir.Model.Integer)value; + OrdinalPositionElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequenceRange": - SequenceRange = (Hl7.Fhir.Model.Range)value; + SequenceRange = (Hl7.Fhir.Model.Range?)value; return this; case "startingSequence": - StartingSequence = (Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent)value; + StartingSequence = (Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent?)value; return this; case "edit": - Edit = (List)value; + Edit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -319,11 +315,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CoordinateSystem is not null) yield return new KeyValuePair("coordinateSystem",CoordinateSystem); - if (OrdinalPositionElement is not null) yield return new KeyValuePair("ordinalPosition",OrdinalPositionElement); - if (SequenceRange is not null) yield return new KeyValuePair("sequenceRange",SequenceRange); - if (StartingSequence is not null) yield return new KeyValuePair("startingSequence",StartingSequence); - if (Edit?.Any() == true) yield return new KeyValuePair("edit",Edit); + if (_CoordinateSystem is not null) yield return new KeyValuePair("coordinateSystem",_CoordinateSystem); + if (_OrdinalPositionElement is not null) yield return new KeyValuePair("ordinalPosition",_OrdinalPositionElement); + if (_SequenceRange is not null) yield return new KeyValuePair("sequenceRange",_SequenceRange); + if (_StartingSequence is not null) yield return new KeyValuePair("startingSequence",_StartingSequence); + if (_Edit?.Any() == true) yield return new KeyValuePair("edit",_Edit); } } @@ -350,13 +346,13 @@ public partial class StartingSequenceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("genomeAssembly", InSummary=true, Order=40)] [Binding("LL1040-6")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept GenomeAssembly + public Hl7.Fhir.Model.CodeableConcept? GenomeAssembly { get { return _GenomeAssembly; } set { _GenomeAssembly = value; OnPropertyChanged("GenomeAssembly"); } } - private Hl7.Fhir.Model.CodeableConcept _GenomeAssembly; + private Hl7.Fhir.Model.CodeableConcept? _GenomeAssembly; /// /// Chromosome Identifier. @@ -364,13 +360,13 @@ public Hl7.Fhir.Model.CodeableConcept GenomeAssembly [FhirElement("chromosome", InSummary=true, Order=50)] [Binding("LL2938-0")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Chromosome + public Hl7.Fhir.Model.CodeableConcept? Chromosome { get { return _Chromosome; } set { _Chromosome = value; OnPropertyChanged("Chromosome"); } } - private Hl7.Fhir.Model.CodeableConcept _Chromosome; + private Hl7.Fhir.Model.CodeableConcept? _Chromosome; /// /// The reference sequence that represents the starting sequence. @@ -381,26 +377,26 @@ public Hl7.Fhir.Model.CodeableConcept Chromosome [References("MolecularSequence")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Sequence + public Hl7.Fhir.Model.DataType? Sequence { get { return _Sequence; } set { _Sequence = value; OnPropertyChanged("Sequence"); } } - private Hl7.Fhir.Model.DataType _Sequence; + private Hl7.Fhir.Model.DataType? _Sequence; /// /// Start position of the window on the starting sequence. /// [FhirElement("windowStart", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer WindowStartElement + public Hl7.Fhir.Model.Integer? WindowStartElement { get { return _WindowStartElement; } set { _WindowStartElement = value; OnPropertyChanged("WindowStartElement"); } } - private Hl7.Fhir.Model.Integer _WindowStartElement; + private Hl7.Fhir.Model.Integer? _WindowStartElement; /// /// Start position of the window on the starting sequence @@ -409,13 +405,10 @@ public Hl7.Fhir.Model.Integer WindowStartElement [IgnoreDataMember] public int? WindowStart { - get { return WindowStartElement != null ? WindowStartElement.Value : null; } + get => _WindowStartElement?.Value; set { - if (value == null) - WindowStartElement = null; - else - WindowStartElement = new Hl7.Fhir.Model.Integer(value); + WindowStartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowStart"); } } @@ -425,13 +418,13 @@ public int? WindowStart /// [FhirElement("windowEnd", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer WindowEndElement + public Hl7.Fhir.Model.Integer? WindowEndElement { get { return _WindowEndElement; } set { _WindowEndElement = value; OnPropertyChanged("WindowEndElement"); } } - private Hl7.Fhir.Model.Integer _WindowEndElement; + private Hl7.Fhir.Model.Integer? _WindowEndElement; /// /// End position of the window on the starting sequence @@ -440,13 +433,10 @@ public Hl7.Fhir.Model.Integer WindowEndElement [IgnoreDataMember] public int? WindowEnd { - get { return WindowEndElement != null ? WindowEndElement.Value : null; } + get => _WindowEndElement?.Value; set { - if (value == null) - WindowEndElement = null; - else - WindowEndElement = new Hl7.Fhir.Model.Integer(value); + WindowEndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("WindowEnd"); } } @@ -458,13 +448,13 @@ public int? WindowEnd [DeclaredType(Type = typeof(Code))] [Binding("orientationType")] [DataMember] - public Code OrientationElement + public Code? OrientationElement { get { return _OrientationElement; } set { _OrientationElement = value; OnPropertyChanged("OrientationElement"); } } - private Code _OrientationElement; + private Code? _OrientationElement; /// /// sense | antisense @@ -473,13 +463,10 @@ public Code OrientationElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.OrientationType? Orientation { - get { return OrientationElement != null ? OrientationElement.Value : null; } + get => _OrientationElement?.Value; set { - if (value == null) - OrientationElement = null; - else - OrientationElement = new Code(value); + OrientationElement = value is null ? null : new Code(value); OnPropertyChanged("Orientation"); } } @@ -491,13 +478,13 @@ public Hl7.Fhir.Model.MolecularSequence.OrientationType? Orientation [DeclaredType(Type = typeof(Code))] [Binding("strandType")] [DataMember] - public Code StrandElement + public Code? StrandElement { get { return _StrandElement; } set { _StrandElement = value; OnPropertyChanged("StrandElement"); } } - private Code _StrandElement; + private Code? _StrandElement; /// /// watson | crick @@ -506,34 +493,27 @@ public Code StrandElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.StrandType? Strand { - get { return StrandElement != null ? StrandElement.Value : null; } + get => _StrandElement?.Value; set { - if (value == null) - StrandElement = null; - else - StrandElement = new Code(value); + StrandElement = value is null ? null : new Code(value); OnPropertyChanged("Strand"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StartingSequenceComponent; - - if (dest == null) - { + if(other is not StartingSequenceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(GenomeAssembly != null) dest.GenomeAssembly = (Hl7.Fhir.Model.CodeableConcept)GenomeAssembly.DeepCopyInternal(); - if(Chromosome != null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)Chromosome.DeepCopyInternal(); - if(Sequence != null) dest.Sequence = (Hl7.Fhir.Model.DataType)Sequence.DeepCopyInternal(); - if(WindowStartElement != null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)WindowStartElement.DeepCopyInternal(); - if(WindowEndElement != null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)WindowEndElement.DeepCopyInternal(); - if(OrientationElement != null) dest.OrientationElement = (Code)OrientationElement.DeepCopyInternal(); - if(StrandElement != null) dest.StrandElement = (Code)StrandElement.DeepCopyInternal(); + if(_GenomeAssembly is not null) dest.GenomeAssembly = (Hl7.Fhir.Model.CodeableConcept)_GenomeAssembly.DeepCopyInternal(); + if(_Chromosome is not null) dest.Chromosome = (Hl7.Fhir.Model.CodeableConcept)_Chromosome.DeepCopyInternal(); + if(_Sequence is not null) dest.Sequence = (Hl7.Fhir.Model.DataType)_Sequence.DeepCopyInternal(); + if(_WindowStartElement is not null) dest.WindowStartElement = (Hl7.Fhir.Model.Integer)_WindowStartElement.DeepCopyInternal(); + if(_WindowEndElement is not null) dest.WindowEndElement = (Hl7.Fhir.Model.Integer)_WindowEndElement.DeepCopyInternal(); + if(_OrientationElement is not null) dest.OrientationElement = (Code)_OrientationElement.DeepCopyInternal(); + if(_StrandElement is not null) dest.StrandElement = (Code)_StrandElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -545,76 +525,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StartingSequenceComponent; - if(otherT == null) return false; + if(other is not StartingSequenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(GenomeAssembly, otherT.GenomeAssembly)) return false; - if(!comparer.Equals(Chromosome, otherT.Chromosome)) return false; - if(!comparer.Equals(Sequence, otherT.Sequence)) return false; - if(!comparer.Equals(WindowStartElement, otherT.WindowStartElement)) return false; - if(!comparer.Equals(WindowEndElement, otherT.WindowEndElement)) return false; - if(!comparer.Equals(OrientationElement, otherT.OrientationElement)) return false; - if(!comparer.Equals(StrandElement, otherT.StrandElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GenomeAssembly, otherT._GenomeAssembly)) return false; + if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; + if(!comparer.Equals(_Sequence, otherT._Sequence)) return false; + if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; + if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; + if(!comparer.Equals(_OrientationElement, otherT._OrientationElement)) return false; + if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "genomeAssembly": - value = GenomeAssembly; - return GenomeAssembly is not null; + value = _GenomeAssembly; + return _GenomeAssembly is not null; case "chromosome": - value = Chromosome; - return Chromosome is not null; + value = _Chromosome; + return _Chromosome is not null; case "sequence": - value = Sequence; - return Sequence is not null; + value = _Sequence; + return _Sequence is not null; case "windowStart": - value = WindowStartElement; - return WindowStartElement is not null; + value = _WindowStartElement; + return _WindowStartElement is not null; case "windowEnd": - value = WindowEndElement; - return WindowEndElement is not null; + value = _WindowEndElement; + return _WindowEndElement is not null; case "orientation": - value = OrientationElement; - return OrientationElement is not null; + value = _OrientationElement; + return _OrientationElement is not null; case "strand": - value = StrandElement; - return StrandElement is not null; + value = _StrandElement; + return _StrandElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "genomeAssembly": - GenomeAssembly = (Hl7.Fhir.Model.CodeableConcept)value; + GenomeAssembly = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "chromosome": - Chromosome = (Hl7.Fhir.Model.CodeableConcept)value; + Chromosome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sequence": - Sequence = (Hl7.Fhir.Model.DataType)value; + Sequence = (Hl7.Fhir.Model.DataType?)value; return this; case "windowStart": - WindowStartElement = (Hl7.Fhir.Model.Integer)value; + WindowStartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "windowEnd": - WindowEndElement = (Hl7.Fhir.Model.Integer)value; + WindowEndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "orientation": - OrientationElement = (Code)value; + OrientationElement = (Code?)value; return this; case "strand": - StrandElement = (Code)value; + StrandElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -625,13 +605,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (GenomeAssembly is not null) yield return new KeyValuePair("genomeAssembly",GenomeAssembly); - if (Chromosome is not null) yield return new KeyValuePair("chromosome",Chromosome); - if (Sequence is not null) yield return new KeyValuePair("sequence",Sequence); - if (WindowStartElement is not null) yield return new KeyValuePair("windowStart",WindowStartElement); - if (WindowEndElement is not null) yield return new KeyValuePair("windowEnd",WindowEndElement); - if (OrientationElement is not null) yield return new KeyValuePair("orientation",OrientationElement); - if (StrandElement is not null) yield return new KeyValuePair("strand",StrandElement); + if (_GenomeAssembly is not null) yield return new KeyValuePair("genomeAssembly",_GenomeAssembly); + if (_Chromosome is not null) yield return new KeyValuePair("chromosome",_Chromosome); + if (_Sequence is not null) yield return new KeyValuePair("sequence",_Sequence); + if (_WindowStartElement is not null) yield return new KeyValuePair("windowStart",_WindowStartElement); + if (_WindowEndElement is not null) yield return new KeyValuePair("windowEnd",_WindowEndElement); + if (_OrientationElement is not null) yield return new KeyValuePair("orientation",_OrientationElement); + if (_StrandElement is not null) yield return new KeyValuePair("strand",_StrandElement); } } @@ -654,13 +634,13 @@ public partial class EditComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("start", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer StartElement + public Hl7.Fhir.Model.Integer? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Integer _StartElement; + private Hl7.Fhir.Model.Integer? _StartElement; /// /// Start position of the edit on the starting sequence @@ -669,13 +649,10 @@ public Hl7.Fhir.Model.Integer StartElement [IgnoreDataMember] public int? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Integer(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Start"); } } @@ -685,13 +662,13 @@ public int? Start /// [FhirElement("end", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer EndElement + public Hl7.Fhir.Model.Integer? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Integer _EndElement; + private Hl7.Fhir.Model.Integer? _EndElement; /// /// End position of the edit on the starting sequence @@ -700,13 +677,10 @@ public Hl7.Fhir.Model.Integer EndElement [IgnoreDataMember] public int? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Integer(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("End"); } } @@ -716,28 +690,25 @@ public int? End /// [FhirElement("replacementSequence", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ReplacementSequenceElement + public Hl7.Fhir.Model.FhirString? ReplacementSequenceElement { get { return _ReplacementSequenceElement; } set { _ReplacementSequenceElement = value; OnPropertyChanged("ReplacementSequenceElement"); } } - private Hl7.Fhir.Model.FhirString _ReplacementSequenceElement; + private Hl7.Fhir.Model.FhirString? _ReplacementSequenceElement; /// /// Allele that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReplacementSequence + public string? ReplacementSequence { - get { return ReplacementSequenceElement != null ? ReplacementSequenceElement.Value : null; } + get => _ReplacementSequenceElement?.Value; set { - if (value == null) - ReplacementSequenceElement = null; - else - ReplacementSequenceElement = new Hl7.Fhir.Model.FhirString(value); + ReplacementSequenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReplacementSequence"); } } @@ -747,46 +718,39 @@ public string ReplacementSequence /// [FhirElement("replacedSequence", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ReplacedSequenceElement + public Hl7.Fhir.Model.FhirString? ReplacedSequenceElement { get { return _ReplacedSequenceElement; } set { _ReplacedSequenceElement = value; OnPropertyChanged("ReplacedSequenceElement"); } } - private Hl7.Fhir.Model.FhirString _ReplacedSequenceElement; + private Hl7.Fhir.Model.FhirString? _ReplacedSequenceElement; /// /// Allele in the starting sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReplacedSequence + public string? ReplacedSequence { - get { return ReplacedSequenceElement != null ? ReplacedSequenceElement.Value : null; } + get => _ReplacedSequenceElement?.Value; set { - if (value == null) - ReplacedSequenceElement = null; - else - ReplacedSequenceElement = new Hl7.Fhir.Model.FhirString(value); + ReplacedSequenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReplacedSequence"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EditComponent; - - if (dest == null) - { + if(other is not EditComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Integer)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Integer)EndElement.DeepCopyInternal(); - if(ReplacementSequenceElement != null) dest.ReplacementSequenceElement = (Hl7.Fhir.Model.FhirString)ReplacementSequenceElement.DeepCopyInternal(); - if(ReplacedSequenceElement != null) dest.ReplacedSequenceElement = (Hl7.Fhir.Model.FhirString)ReplacedSequenceElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Integer)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Integer)_EndElement.DeepCopyInternal(); + if(_ReplacementSequenceElement is not null) dest.ReplacementSequenceElement = (Hl7.Fhir.Model.FhirString)_ReplacementSequenceElement.DeepCopyInternal(); + if(_ReplacedSequenceElement is not null) dest.ReplacedSequenceElement = (Hl7.Fhir.Model.FhirString)_ReplacedSequenceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -798,55 +762,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EditComponent; - if(otherT == null) return false; + if(other is not EditComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ReplacementSequenceElement, otherT.ReplacementSequenceElement)) return false; - if(!comparer.Equals(ReplacedSequenceElement, otherT.ReplacedSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ReplacementSequenceElement, otherT._ReplacementSequenceElement)) return false; + if(!comparer.Equals(_ReplacedSequenceElement, otherT._ReplacedSequenceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "replacementSequence": - value = ReplacementSequenceElement; - return ReplacementSequenceElement is not null; + value = _ReplacementSequenceElement; + return _ReplacementSequenceElement is not null; case "replacedSequence": - value = ReplacedSequenceElement; - return ReplacedSequenceElement is not null; + value = _ReplacedSequenceElement; + return _ReplacedSequenceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "start": - StartElement = (Hl7.Fhir.Model.Integer)value; + StartElement = (Hl7.Fhir.Model.Integer?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Integer)value; + EndElement = (Hl7.Fhir.Model.Integer?)value; return this; case "replacementSequence": - ReplacementSequenceElement = (Hl7.Fhir.Model.FhirString)value; + ReplacementSequenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "replacedSequence": - ReplacedSequenceElement = (Hl7.Fhir.Model.FhirString)value; + ReplacedSequenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -857,10 +821,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ReplacementSequenceElement is not null) yield return new KeyValuePair("replacementSequence",ReplacementSequenceElement); - if (ReplacedSequenceElement is not null) yield return new KeyValuePair("replacedSequence",ReplacedSequenceElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ReplacementSequenceElement is not null) yield return new KeyValuePair("replacementSequence",_ReplacementSequenceElement); + if (_ReplacedSequenceElement is not null) yield return new KeyValuePair("replacedSequence",_ReplacedSequenceElement); } } @@ -873,11 +837,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// aa | dna | rna. @@ -886,13 +850,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("sequenceType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// aa | dna | rna @@ -901,13 +865,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MolecularSequence.SequenceType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -919,13 +880,13 @@ public Hl7.Fhir.Model.MolecularSequence.SequenceType? Type [CLSCompliant(false)] [References("Patient","Group","Substance","BiologicallyDerivedProduct","NutritionProduct")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// What the molecular sequence is about, when it is not about the subject of record. @@ -937,11 +898,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Specimen used for sequencing. @@ -950,13 +911,13 @@ public List Focus [CLSCompliant(false)] [References("Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// The method for sequencing. @@ -965,13 +926,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Who should be responsible for test result. @@ -980,41 +941,38 @@ public Hl7.Fhir.Model.ResourceReference Device [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Sequence that was observed. /// [FhirElement("literal", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString LiteralElement + public Hl7.Fhir.Model.FhirString? LiteralElement { get { return _LiteralElement; } set { _LiteralElement = value; OnPropertyChanged("LiteralElement"); } } - private Hl7.Fhir.Model.FhirString _LiteralElement; + private Hl7.Fhir.Model.FhirString? _LiteralElement; /// /// Sequence that was observed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Literal + public string? Literal { - get { return LiteralElement != null ? LiteralElement.Value : null; } + get => _LiteralElement?.Value; set { - if (value == null) - LiteralElement = null; - else - LiteralElement = new Hl7.Fhir.Model.FhirString(value); + LiteralElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Literal"); } } @@ -1027,11 +985,11 @@ public string Literal [DataMember] public List Formatted { - get { if(_Formatted==null) _Formatted = new List(); return _Formatted; } + get => _Formatted ?? new List(); set { _Formatted = value; OnPropertyChanged("Formatted"); } } - private List _Formatted; + private List? _Formatted; /// /// A sequence defined relative to another sequence. @@ -1041,34 +999,30 @@ public List Formatted [DataMember] public List Relative { - get { if(_Relative==null) _Relative = new List(); return _Relative; } + get => _Relative ?? new List(); set { _Relative = value; OnPropertyChanged("Relative"); } } - private List _Relative; + private List? _Relative; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as MolecularSequence; - - if (dest == null) - { + if(other is not MolecularSequence dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(LiteralElement != null) dest.LiteralElement = (Hl7.Fhir.Model.FhirString)LiteralElement.DeepCopyInternal(); - if(Formatted.Any()) dest.Formatted = new List(Formatted.DeepCopyInternal()); - if(Relative.Any()) dest.Relative = new List(Relative.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_LiteralElement is not null) dest.LiteralElement = (Hl7.Fhir.Model.FhirString)_LiteralElement.DeepCopyInternal(); + if(_Formatted is not null) dest.Formatted = new List(_Formatted.DeepCopyInternal()); + if(_Relative is not null) dest.Relative = new List(_Relative.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1080,97 +1034,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MolecularSequence; - if(otherT == null) return false; + if(other is not MolecularSequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(LiteralElement, otherT.LiteralElement)) return false; - if(!comparer.ListEquals(Formatted, otherT.Formatted)) return false; - if(!comparer.ListEquals(Relative, otherT.Relative)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_LiteralElement, otherT._LiteralElement)) return false; + if(!comparer.ListEquals(_Formatted, otherT._Formatted)) return false; + if(!comparer.ListEquals(_Relative, otherT._Relative)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "literal": - value = LiteralElement; - return LiteralElement is not null; + value = _LiteralElement; + return _LiteralElement is not null; case "formatted": - value = Formatted; - return Formatted?.Any() == true; + value = _Formatted; + return _Formatted?.Any() == true; case "relative": - value = Relative; - return Relative?.Any() == true; + value = _Relative; + return _Relative?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "literal": - LiteralElement = (Hl7.Fhir.Model.FhirString)value; + LiteralElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "formatted": - Formatted = (List)value; + Formatted = (List?)value!; return this; case "relative": - Relative = (List)value; + Relative = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1181,16 +1135,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (LiteralElement is not null) yield return new KeyValuePair("literal",LiteralElement); - if (Formatted?.Any() == true) yield return new KeyValuePair("formatted",Formatted); - if (Relative?.Any() == true) yield return new KeyValuePair("relative",Relative); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_LiteralElement is not null) yield return new KeyValuePair("literal",_LiteralElement); + if (_Formatted?.Any() == true) yield return new KeyValuePair("formatted",_Formatted); + if (_Relative?.Any() == true) yield return new KeyValuePair("relative",_Relative); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs b/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs index fc0526b17..17b2f6f69 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,13 +113,13 @@ public enum PriceComponentType [Binding("PriceComponentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// base | surcharge | deduction | discount | tax | informational @@ -125,13 +128,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.MonetaryComponent.PriceComponentType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -142,26 +142,26 @@ public Hl7.Fhir.Model.MonetaryComponent.PriceComponentType? Type [FhirElement("code", InSummary=true, Order=40)] [Binding("PriceComponentCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Factor used for calculating this component. /// [FhirElement("factor", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Factor used for calculating this component @@ -170,13 +170,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -186,28 +183,24 @@ public decimal? Factor /// [FhirElement("amount", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as MonetaryComponent; - - if (dest == null) - { + if(other is not MonetaryComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -219,55 +212,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonetaryComponent; - if(otherT == null) return false; + if(other is not MonetaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -278,10 +271,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Money.cs b/src/Hl7.Fhir.R5/Model/Generated/Money.cs index 6b527e42b..dbeb385ed 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Money.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Money.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,13 +64,13 @@ public partial class Money : Hl7.Fhir.Model.DataType /// [FhirElement("value", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ValueElement + public Hl7.Fhir.Model.FhirDecimal? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ValueElement; + private Hl7.Fhir.Model.FhirDecimal? _ValueElement; /// /// Numerical value (with implicit precision) @@ -76,13 +79,10 @@ public Hl7.Fhir.Model.FhirDecimal ValueElement [IgnoreDataMember] public decimal? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirDecimal(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Value"); } } @@ -94,13 +94,13 @@ public decimal? Value [DeclaredType(Type = typeof(Code))] [Binding("CurrencyCode")] [DataMember] - public Code CurrencyElement + public Code? CurrencyElement { get { return _CurrencyElement; } set { _CurrencyElement = value; OnPropertyChanged("CurrencyElement"); } } - private Code _CurrencyElement; + private Code? _CurrencyElement; /// /// ISO 4217 Currency Code @@ -109,29 +109,22 @@ public Code CurrencyElement [IgnoreDataMember] public Hl7.Fhir.Model.Currencies? Currency { - get { return CurrencyElement != null ? CurrencyElement.Value : null; } + get => _CurrencyElement?.Value; set { - if (value == null) - CurrencyElement = null; - else - CurrencyElement = new Code(value); + CurrencyElement = value is null ? null : new Code(value); OnPropertyChanged("Currency"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as Money; - - if (dest == null) - { + if(other is not Money dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)ValueElement.DeepCopyInternal(); - if(CurrencyElement != null) dest.CurrencyElement = (Code)CurrencyElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirDecimal)_ValueElement.DeepCopyInternal(); + if(_CurrencyElement is not null) dest.CurrencyElement = (Code)_CurrencyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -143,41 +136,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Money; - if(otherT == null) return false; + if(other is not Money otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(CurrencyElement, otherT.CurrencyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_CurrencyElement, otherT._CurrencyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "currency": - value = CurrencyElement; - return CurrencyElement is not null; + value = _CurrencyElement; + return _CurrencyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - ValueElement = (Hl7.Fhir.Model.FhirDecimal)value; + ValueElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "currency": - CurrencyElement = (Code)value; + CurrencyElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -188,8 +181,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (CurrencyElement is not null) yield return new KeyValuePair("currency",CurrencyElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_CurrencyElement is not null) yield return new KeyValuePair("currency",_CurrencyElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs index 6c489f8d1..8c6888eac 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -158,13 +161,13 @@ public partial class UniqueIdComponent : Hl7.Fhir.Model.BackboneElement [Binding("NamingSystemIdentifierType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// oid | uuid | uri | iri-stem | v2csmnemonic | other @@ -173,13 +176,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -190,28 +190,25 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemIdentifierType? Type [FhirElement("value", InSummary=true, Order=50, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The unique identifier /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -221,13 +218,13 @@ public string Value /// [FhirElement("preferred", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Is this the id that should be used for this type @@ -236,13 +233,10 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } @@ -252,28 +246,25 @@ public bool? Preferred /// [FhirElement("comment", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Notes about identifier usage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -283,26 +274,26 @@ public string Comment /// [FhirElement("period", Order=80)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Whether the identifier is authoritative. /// [FhirElement("authoritative", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AuthoritativeElement + public Hl7.Fhir.Model.FhirBoolean? AuthoritativeElement { get { return _AuthoritativeElement; } set { _AuthoritativeElement = value; OnPropertyChanged("AuthoritativeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AuthoritativeElement; + private Hl7.Fhir.Model.FhirBoolean? _AuthoritativeElement; /// /// Whether the identifier is authoritative @@ -311,33 +302,26 @@ public Hl7.Fhir.Model.FhirBoolean AuthoritativeElement [IgnoreDataMember] public bool? Authoritative { - get { return AuthoritativeElement != null ? AuthoritativeElement.Value : null; } + get => _AuthoritativeElement?.Value; set { - if (value == null) - AuthoritativeElement = null; - else - AuthoritativeElement = new Hl7.Fhir.Model.FhirBoolean(value); + AuthoritativeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Authoritative"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as UniqueIdComponent; - - if (dest == null) - { + if(other is not UniqueIdComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(AuthoritativeElement != null) dest.AuthoritativeElement = (Hl7.Fhir.Model.FhirBoolean)AuthoritativeElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_AuthoritativeElement is not null) dest.AuthoritativeElement = (Hl7.Fhir.Model.FhirBoolean)_AuthoritativeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,69 +333,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as UniqueIdComponent; - if(otherT == null) return false; + if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(AuthoritativeElement, otherT.AuthoritativeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_AuthoritativeElement, otherT._AuthoritativeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "authoritative": - value = AuthoritativeElement; - return AuthoritativeElement is not null; + value = _AuthoritativeElement; + return _AuthoritativeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "authoritative": - AuthoritativeElement = (Hl7.Fhir.Model.FhirBoolean)value; + AuthoritativeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -422,12 +406,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (AuthoritativeElement is not null) yield return new KeyValuePair("authoritative",AuthoritativeElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_AuthoritativeElement is not null) yield return new KeyValuePair("authoritative",_AuthoritativeElement); } } @@ -437,28 +421,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this naming system, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -471,39 +452,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the naming system. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the naming system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -515,13 +493,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this naming system (computer friendly). @@ -529,28 +507,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this naming system (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -560,28 +535,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Title for this naming system (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -594,13 +566,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -609,13 +581,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -628,13 +597,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("NamingSystemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// codesystem | identifier | root @@ -643,13 +612,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -659,13 +625,13 @@ public Hl7.Fhir.Model.NamingSystem.NamingSystemType? Kind /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -674,13 +640,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -691,28 +654,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -722,28 +682,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -756,39 +713,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Who maintains system namespace?. /// [FhirElement("responsible", Order=210, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString ResponsibleElement + public Hl7.Fhir.Model.FhirString? ResponsibleElement { get { return _ResponsibleElement; } set { _ResponsibleElement = value; OnPropertyChanged("ResponsibleElement"); } } - private Hl7.Fhir.Model.FhirString _ResponsibleElement; + private Hl7.Fhir.Model.FhirString? _ResponsibleElement; /// /// Who maintains system namespace? /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Responsible + public string? Responsible { - get { return ResponsibleElement != null ? ResponsibleElement.Value : null; } + get => _ResponsibleElement?.Value; set { - if (value == null) - ResponsibleElement = null; - else - ResponsibleElement = new Hl7.Fhir.Model.FhirString(value); + ResponsibleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Responsible"); } } @@ -799,41 +753,38 @@ public string Responsible [FhirElement("type", Order=220)] [Binding("NamingSystemIdentifierSystemType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Natural language description of the naming system. /// [FhirElement("description", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the naming system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -846,11 +797,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for naming system (if applicable). @@ -861,39 +812,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this naming system is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this naming system is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -903,28 +851,25 @@ public string Purpose /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -934,28 +879,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -965,28 +907,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the NamingSystem was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -996,28 +935,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the NamingSystem was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1027,13 +963,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment, etc. @@ -1044,11 +980,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the CodeSystem. @@ -1058,11 +994,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the NamingSystem. @@ -1072,11 +1008,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the NamingSystem. @@ -1086,11 +1022,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the NamingSystem. @@ -1100,11 +1036,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations, etc. @@ -1114,39 +1050,36 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// How/where is it used. /// [FhirElement("usage", Order=380)] [DataMember] - public Hl7.Fhir.Model.FhirString UsageElement + public Hl7.Fhir.Model.FhirString? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.FhirString _UsageElement; + private Hl7.Fhir.Model.FhirString? _UsageElement; /// /// How/where is it used /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.FhirString(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Usage"); } } @@ -1159,55 +1092,51 @@ public string Usage [DataMember] public List UniqueId { - get { if(_UniqueId==null) _UniqueId = new List(); return _UniqueId; } + get => _UniqueId ?? new List(); set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } - private List _UniqueId; + private List? _UniqueId; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as NamingSystem; - - if (dest == null) - { + if(other is not NamingSystem dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(ResponsibleElement != null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)ResponsibleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)UsageElement.DeepCopyInternal(); - if(UniqueId.Any()) dest.UniqueId = new List(UniqueId.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_ResponsibleElement is not null) dest.ResponsibleElement = (Hl7.Fhir.Model.FhirString)_ResponsibleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.FhirString)_UsageElement.DeepCopyInternal(); + if(_UniqueId is not null) dest.UniqueId = new List(_UniqueId.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1219,244 +1148,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NamingSystem; - if(otherT == null) return false; + if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(ResponsibleElement, otherT.ResponsibleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.ListEquals(UniqueId, otherT.UniqueId)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "responsible": - value = ResponsibleElement; - return ResponsibleElement is not null; + value = _ResponsibleElement; + return _ResponsibleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "uniqueId": - value = UniqueId; - return UniqueId?.Any() == true; + value = _UniqueId; + return _UniqueId?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "responsible": - ResponsibleElement = (Hl7.Fhir.Model.FhirString)value; + ResponsibleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.FhirString)value; + UsageElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "uniqueId": - UniqueId = (List)value; + UniqueId = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1467,37 +1396,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (ResponsibleElement is not null) yield return new KeyValuePair("responsible",ResponsibleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",UniqueId); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_ResponsibleElement is not null) yield return new KeyValuePair("responsible",_ResponsibleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_UniqueId?.Any() == true) yield return new KeyValuePair("uniqueId",_UniqueId); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs index 1235294bd..8db9788ef 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -79,13 +82,13 @@ public partial class ConsumedItemComponent : Hl7.Fhir.Model.BackboneElement [Binding("FoodType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Code that identifies the food or fluid product that was consumed. @@ -94,65 +97,65 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("FoodProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference NutritionProduct + public Hl7.Fhir.Model.CodeableReference? NutritionProduct { get { return _NutritionProduct; } set { _NutritionProduct = value; OnPropertyChanged("NutritionProduct"); } } - private Hl7.Fhir.Model.CodeableReference _NutritionProduct; + private Hl7.Fhir.Model.CodeableReference? _NutritionProduct; /// /// Scheduled frequency of consumption. /// [FhirElement("schedule", Order=60)] [DataMember] - public Hl7.Fhir.Model.Timing Schedule + public Hl7.Fhir.Model.Timing? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.Timing _Schedule; + private Hl7.Fhir.Model.Timing? _Schedule; /// /// Quantity of the specified food. /// [FhirElement("amount", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; /// /// Rate at which enteral feeding was administered. /// [FhirElement("rate", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Rate + public Hl7.Fhir.Model.Quantity? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.Quantity _Rate; + private Hl7.Fhir.Model.Quantity? _Rate; /// /// Flag to indicate if the food or fluid item was refused or otherwise not consumed. /// [FhirElement("notConsumed", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NotConsumedElement + public Hl7.Fhir.Model.FhirBoolean? NotConsumedElement { get { return _NotConsumedElement; } set { _NotConsumedElement = value; OnPropertyChanged("NotConsumedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NotConsumedElement; + private Hl7.Fhir.Model.FhirBoolean? _NotConsumedElement; /// /// Flag to indicate if the food or fluid item was refused or otherwise not consumed @@ -161,13 +164,10 @@ public Hl7.Fhir.Model.FhirBoolean NotConsumedElement [IgnoreDataMember] public bool? NotConsumed { - get { return NotConsumedElement != null ? NotConsumedElement.Value : null; } + get => _NotConsumedElement?.Value; set { - if (value == null) - NotConsumedElement = null; - else - NotConsumedElement = new Hl7.Fhir.Model.FhirBoolean(value); + NotConsumedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NotConsumed"); } } @@ -178,31 +178,27 @@ public bool? NotConsumed [FhirElement("notConsumedReason", Order=100)] [Binding("NotConsumedReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept NotConsumedReason + public Hl7.Fhir.Model.CodeableConcept? NotConsumedReason { get { return _NotConsumedReason; } set { _NotConsumedReason = value; OnPropertyChanged("NotConsumedReason"); } } - private Hl7.Fhir.Model.CodeableConcept _NotConsumedReason; + private Hl7.Fhir.Model.CodeableConcept? _NotConsumedReason; protected internal override void CopyToInternal(Base other) { - var dest = other as ConsumedItemComponent; - - if (dest == null) - { + if(other is not ConsumedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(NutritionProduct != null) dest.NutritionProduct = (Hl7.Fhir.Model.CodeableReference)NutritionProduct.DeepCopyInternal(); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.Timing)Schedule.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.Quantity)Rate.DeepCopyInternal(); - if(NotConsumedElement != null) dest.NotConsumedElement = (Hl7.Fhir.Model.FhirBoolean)NotConsumedElement.DeepCopyInternal(); - if(NotConsumedReason != null) dest.NotConsumedReason = (Hl7.Fhir.Model.CodeableConcept)NotConsumedReason.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_NutritionProduct is not null) dest.NutritionProduct = (Hl7.Fhir.Model.CodeableReference)_NutritionProduct.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.Timing)_Schedule.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.Quantity)_Rate.DeepCopyInternal(); + if(_NotConsumedElement is not null) dest.NotConsumedElement = (Hl7.Fhir.Model.FhirBoolean)_NotConsumedElement.DeepCopyInternal(); + if(_NotConsumedReason is not null) dest.NotConsumedReason = (Hl7.Fhir.Model.CodeableConcept)_NotConsumedReason.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -214,76 +210,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConsumedItemComponent; - if(otherT == null) return false; + if(other is not ConsumedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(NutritionProduct, otherT.NutritionProduct)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; - if(!comparer.Equals(NotConsumedElement, otherT.NotConsumedElement)) return false; - if(!comparer.Equals(NotConsumedReason, otherT.NotConsumedReason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NutritionProduct, otherT._NutritionProduct)) return false; + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; + if(!comparer.Equals(_NotConsumedElement, otherT._NotConsumedElement)) return false; + if(!comparer.Equals(_NotConsumedReason, otherT._NotConsumedReason)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "nutritionProduct": - value = NutritionProduct; - return NutritionProduct is not null; + value = _NutritionProduct; + return _NutritionProduct is not null; case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; case "notConsumed": - value = NotConsumedElement; - return NotConsumedElement is not null; + value = _NotConsumedElement; + return _NotConsumedElement is not null; case "notConsumedReason": - value = NotConsumedReason; - return NotConsumedReason is not null; + value = _NotConsumedReason; + return _NotConsumedReason is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "nutritionProduct": - NutritionProduct = (Hl7.Fhir.Model.CodeableReference)value; + NutritionProduct = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "schedule": - Schedule = (Hl7.Fhir.Model.Timing)value; + Schedule = (Hl7.Fhir.Model.Timing?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.Quantity)value; + Rate = (Hl7.Fhir.Model.Quantity?)value; return this; case "notConsumed": - NotConsumedElement = (Hl7.Fhir.Model.FhirBoolean)value; + NotConsumedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "notConsumedReason": - NotConsumedReason = (Hl7.Fhir.Model.CodeableConcept)value; + NotConsumedReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -294,13 +290,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (NutritionProduct is not null) yield return new KeyValuePair("nutritionProduct",NutritionProduct); - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); - if (NotConsumedElement is not null) yield return new KeyValuePair("notConsumed",NotConsumedElement); - if (NotConsumedReason is not null) yield return new KeyValuePair("notConsumedReason",NotConsumedReason); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_NutritionProduct is not null) yield return new KeyValuePair("nutritionProduct",_NutritionProduct); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); + if (_NotConsumedElement is not null) yield return new KeyValuePair("notConsumed",_NotConsumedElement); + if (_NotConsumedReason is not null) yield return new KeyValuePair("notConsumedReason",_NotConsumedReason); } } @@ -329,13 +325,13 @@ public partial class IngredientLabelComponent : Hl7.Fhir.Model.BackboneElement [Binding("NutrientType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Nutrient + public Hl7.Fhir.Model.CodeableReference? Nutrient { get { return _Nutrient; } set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } - private Hl7.Fhir.Model.CodeableReference _Nutrient; + private Hl7.Fhir.Model.CodeableReference? _Nutrient; /// /// Total amount of nutrient consumed. @@ -343,26 +339,22 @@ public Hl7.Fhir.Model.CodeableReference Nutrient [FhirElement("amount", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientLabelComponent; - - if (dest == null) - { + if(other is not IngredientLabelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Nutrient != null) dest.Nutrient = (Hl7.Fhir.Model.CodeableReference)Nutrient.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Nutrient is not null) dest.Nutrient = (Hl7.Fhir.Model.CodeableReference)_Nutrient.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -374,41 +366,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientLabelComponent; - if(otherT == null) return false; + if(other is not IngredientLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Nutrient, otherT.Nutrient)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Nutrient, otherT._Nutrient)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "nutrient": - value = Nutrient; - return Nutrient is not null; + value = _Nutrient; + return _Nutrient is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "nutrient": - Nutrient = (Hl7.Fhir.Model.CodeableReference)value; + Nutrient = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -419,8 +411,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Nutrient is not null) yield return new KeyValuePair("nutrient",Nutrient); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Nutrient is not null) yield return new KeyValuePair("nutrient",_Nutrient); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -447,13 +439,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", Order=40)] [Binding("NutritionPerformerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the intake. @@ -463,26 +455,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -494,41 +482,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -539,8 +527,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -553,11 +541,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -567,24 +555,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -599,24 +587,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -633,11 +621,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -649,11 +637,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -663,13 +651,13 @@ public List PartOf [Binding("NutritionIntakeStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -678,13 +666,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -698,11 +683,11 @@ public Hl7.Fhir.Model.EventStatus? Status [DataMember] public List StatusReason { - get { if(_StatusReason==null) _StatusReason = new List(); return _StatusReason; } + get => _StatusReason ?? new List(); set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private List _StatusReason; + private List? _StatusReason; /// /// Code representing an overall type of nutrition intake. @@ -710,13 +695,13 @@ public List StatusReason [FhirElement("code", InSummary=true, Order=160, FiveWs="FiveWs.class")] [Binding("NutritionIntakeCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who is/was consuming the food or fluid. @@ -726,13 +711,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter associated with NutritionIntake. @@ -741,13 +726,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// The date/time or interval when the food or fluid is/was consumed. @@ -756,41 +741,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the intake was recorded. /// [FhirElement("recorded", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedElement + public Hl7.Fhir.Model.FhirDateTime? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedElement; /// /// When the intake was recorded /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Recorded + public string? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Recorded"); } } @@ -803,13 +785,13 @@ public string Recorded [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reported + public Hl7.Fhir.Model.DataType? Reported { get { return _Reported; } set { _Reported = value; OnPropertyChanged("Reported"); } } - private Hl7.Fhir.Model.DataType _Reported; + private Hl7.Fhir.Model.DataType? _Reported; /// /// What food or fluid product or item was consumed. @@ -819,11 +801,11 @@ public Hl7.Fhir.Model.DataType Reported [DataMember] public List ConsumedItem { - get { if(_ConsumedItem==null) _ConsumedItem = new List(); return _ConsumedItem; } + get => _ConsumedItem ?? new List(); set { _ConsumedItem = value; OnPropertyChanged("ConsumedItem"); } } - private List _ConsumedItem; + private List? _ConsumedItem; /// /// Total nutrient for the whole meal, product, serving. @@ -833,11 +815,11 @@ public List ConsumedItem [DataMember] public List IngredientLabel { - get { if(_IngredientLabel==null) _IngredientLabel = new List(); return _IngredientLabel; } + get => _IngredientLabel ?? new List(); set { _IngredientLabel = value; OnPropertyChanged("IngredientLabel"); } } - private List _IngredientLabel; + private List? _IngredientLabel; /// /// Who was performed in the intake. @@ -847,11 +829,11 @@ public List IngredientL [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the intake occurred. @@ -860,13 +842,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Additional supporting information. @@ -878,11 +860,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// Reason for why the food or fluid is /was consumed. @@ -893,11 +875,11 @@ public List DerivedFrom [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Further information about the consumption. @@ -907,44 +889,40 @@ public List Reason [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as NutritionIntake; - - if (dest == null) - { + if(other is not NutritionIntake dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason.Any()) dest.StatusReason = new List(StatusReason.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)RecordedElement.DeepCopyInternal(); - if(Reported != null) dest.Reported = (Hl7.Fhir.Model.DataType)Reported.DeepCopyInternal(); - if(ConsumedItem.Any()) dest.ConsumedItem = new List(ConsumedItem.DeepCopyInternal()); - if(IngredientLabel.Any()) dest.IngredientLabel = new List(IngredientLabel.DeepCopyInternal()); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = new List(_StatusReason.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedElement.DeepCopyInternal(); + if(_Reported is not null) dest.Reported = (Hl7.Fhir.Model.DataType)_Reported.DeepCopyInternal(); + if(_ConsumedItem is not null) dest.ConsumedItem = new List(_ConsumedItem.DeepCopyInternal()); + if(_IngredientLabel is not null) dest.IngredientLabel = new List(_IngredientLabel.DeepCopyInternal()); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -956,167 +934,167 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutritionIntake; - if(otherT == null) return false; + if(other is not NutritionIntake otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(Reported, otherT.Reported)) return false; - if(!comparer.ListEquals(ConsumedItem, otherT.ConsumedItem)) return false; - if(!comparer.ListEquals(IngredientLabel, otherT.IngredientLabel)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_Reported, otherT._Reported)) return false; + if(!comparer.ListEquals(_ConsumedItem, otherT._ConsumedItem)) return false; + if(!comparer.ListEquals(_IngredientLabel, otherT._IngredientLabel)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason?.Any() == true; + value = _StatusReason; + return _StatusReason?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "reported": - value = Reported; - return Reported is not null; + value = _Reported; + return _Reported is not null; case "consumedItem": - value = ConsumedItem; - return ConsumedItem?.Any() == true; + value = _ConsumedItem; + return _ConsumedItem?.Any() == true; case "ingredientLabel": - value = IngredientLabel; - return IngredientLabel?.Any() == true; + value = _IngredientLabel; + return _IngredientLabel?.Any() == true; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (List)value; + StatusReason = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reported": - Reported = (Hl7.Fhir.Model.DataType)value; + Reported = (Hl7.Fhir.Model.DataType?)value; return this; case "consumedItem": - ConsumedItem = (List)value; + ConsumedItem = (List?)value!; return this; case "ingredientLabel": - IngredientLabel = (List)value; + IngredientLabel = (List?)value!; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1127,26 +1105,26 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",StatusReason); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (Reported is not null) yield return new KeyValuePair("reported",Reported); - if (ConsumedItem?.Any() == true) yield return new KeyValuePair("consumedItem",ConsumedItem); - if (IngredientLabel?.Any() == true) yield return new KeyValuePair("ingredientLabel",IngredientLabel); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason?.Any() == true) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_Reported is not null) yield return new KeyValuePair("reported",_Reported); + if (_ConsumedItem?.Any() == true) yield return new KeyValuePair("consumedItem",_ConsumedItem); + if (_IngredientLabel?.Any() == true) yield return new KeyValuePair("ingredientLabel",_IngredientLabel); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs index 5e02fbba6..b85dcfc7f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -85,24 +88,24 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Scheduling information for oral diets. /// [FhirElement("schedule", Order=50)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent Schedule + public Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent _Schedule; + private Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent? _Schedule; /// /// Required nutrient modifications. @@ -112,11 +115,11 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent Schedule [DataMember] public List Nutrient { - get { if(_Nutrient==null) _Nutrient = new List(); return _Nutrient; } + get => _Nutrient ?? new List(); set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } - private List _Nutrient; + private List? _Nutrient; /// /// Required texture modifications. @@ -126,11 +129,11 @@ public List Nutrient [DataMember] public List Texture { - get { if(_Texture==null) _Texture = new List(); return _Texture; } + get => _Texture ?? new List(); set { _Texture = value; OnPropertyChanged("Texture"); } } - private List _Texture; + private List? _Texture; /// /// The required consistency of fluids and liquids provided to the patient. @@ -141,59 +144,52 @@ public List Texture [DataMember] public List FluidConsistencyType { - get { if(_FluidConsistencyType==null) _FluidConsistencyType = new List(); return _FluidConsistencyType; } + get => _FluidConsistencyType ?? new List(); set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } - private List _FluidConsistencyType; + private List? _FluidConsistencyType; /// /// Instructions or additional information about the oral diet. /// [FhirElement("instruction", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral diet /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OralDietComponent; - - if (dest == null) - { + if(other is not OralDietComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent)Schedule.DeepCopyInternal(); - if(Nutrient.Any()) dest.Nutrient = new List(Nutrient.DeepCopyInternal()); - if(Texture.Any()) dest.Texture = new List(Texture.DeepCopyInternal()); - if(FluidConsistencyType.Any()) dest.FluidConsistencyType = new List(FluidConsistencyType.DeepCopyInternal()); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent)_Schedule.DeepCopyInternal(); + if(_Nutrient is not null) dest.Nutrient = new List(_Nutrient.DeepCopyInternal()); + if(_Texture is not null) dest.Texture = new List(_Texture.DeepCopyInternal()); + if(_FluidConsistencyType is not null) dest.FluidConsistencyType = new List(_FluidConsistencyType.DeepCopyInternal()); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -205,69 +201,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OralDietComponent; - if(otherT == null) return false; + if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.ListEquals(Nutrient, otherT.Nutrient)) return false; - if(!comparer.ListEquals(Texture, otherT.Texture)) return false; - if(!comparer.ListEquals(FluidConsistencyType, otherT.FluidConsistencyType)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; + if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; + if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "nutrient": - value = Nutrient; - return Nutrient?.Any() == true; + value = _Nutrient; + return _Nutrient?.Any() == true; case "texture": - value = Texture; - return Texture?.Any() == true; + value = _Texture; + return _Texture?.Any() == true; case "fluidConsistencyType": - value = FluidConsistencyType; - return FluidConsistencyType?.Any() == true; + value = _FluidConsistencyType; + return _FluidConsistencyType?.Any() == true; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "schedule": - Schedule = (Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent)value; + Schedule = (Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent?)value; return this; case "nutrient": - Nutrient = (List)value; + Nutrient = (List?)value!; return this; case "texture": - Texture = (List)value; + Texture = (List?)value!; return this; case "fluidConsistencyType": - FluidConsistencyType = (List)value; + FluidConsistencyType = (List?)value!; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -278,12 +274,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",Nutrient); - if (Texture?.Any() == true) yield return new KeyValuePair("texture",Texture); - if (FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",FluidConsistencyType); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",_Nutrient); + if (_Texture?.Any() == true) yield return new KeyValuePair("texture",_Texture); + if (_FluidConsistencyType?.Any() == true) yield return new KeyValuePair("fluidConsistencyType",_FluidConsistencyType); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -312,24 +308,24 @@ public partial class OralDietScheduleComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Timing { - get { if(_Timing==null) _Timing = new List(); return _Timing; } + get => _Timing ?? new List(); set { _Timing = value; OnPropertyChanged("Timing"); } } - private List _Timing; + private List? _Timing; /// /// Take 'as needed'. /// [FhirElement("asNeeded", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AsNeededElement + public Hl7.Fhir.Model.FhirBoolean? AsNeededElement { get { return _AsNeededElement; } set { _AsNeededElement = value; OnPropertyChanged("AsNeededElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AsNeededElement; + private Hl7.Fhir.Model.FhirBoolean? _AsNeededElement; /// /// Take 'as needed' @@ -338,13 +334,10 @@ public Hl7.Fhir.Model.FhirBoolean AsNeededElement [IgnoreDataMember] public bool? AsNeeded { - get { return AsNeededElement != null ? AsNeededElement.Value : null; } + get => _AsNeededElement?.Value; set { - if (value == null) - AsNeededElement = null; - else - AsNeededElement = new Hl7.Fhir.Model.FhirBoolean(value); + AsNeededElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AsNeeded"); } } @@ -355,27 +348,23 @@ public bool? AsNeeded [FhirElement("asNeededFor", Order=60)] [Binding("OralDietAsNeededReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AsNeededFor + public Hl7.Fhir.Model.CodeableConcept? AsNeededFor { get { return _AsNeededFor; } set { _AsNeededFor = value; OnPropertyChanged("AsNeededFor"); } } - private Hl7.Fhir.Model.CodeableConcept _AsNeededFor; + private Hl7.Fhir.Model.CodeableConcept? _AsNeededFor; protected internal override void CopyToInternal(Base other) { - var dest = other as OralDietScheduleComponent; - - if (dest == null) - { + if(other is not OralDietScheduleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Timing.Any()) dest.Timing = new List(Timing.DeepCopyInternal()); - if(AsNeededElement != null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)AsNeededElement.DeepCopyInternal(); - if(AsNeededFor != null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)AsNeededFor.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = new List(_Timing.DeepCopyInternal()); + if(_AsNeededElement is not null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)_AsNeededElement.DeepCopyInternal(); + if(_AsNeededFor is not null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)_AsNeededFor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -387,48 +376,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OralDietScheduleComponent; - if(otherT == null) return false; + if(other is not OralDietScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeededElement, otherT.AsNeededElement)) return false; - if(!comparer.Equals(AsNeededFor, otherT.AsNeededFor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; + if(!comparer.Equals(_AsNeededFor, otherT._AsNeededFor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "timing": - value = Timing; - return Timing?.Any() == true; + value = _Timing; + return _Timing?.Any() == true; case "asNeeded": - value = AsNeededElement; - return AsNeededElement is not null; + value = _AsNeededElement; + return _AsNeededElement is not null; case "asNeededFor": - value = AsNeededFor; - return AsNeededFor is not null; + value = _AsNeededFor; + return _AsNeededFor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "timing": - Timing = (List)value; + Timing = (List?)value!; return this; case "asNeeded": - AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)value; + AsNeededElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "asNeededFor": - AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)value; + AsNeededFor = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -439,9 +428,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Timing?.Any() == true) yield return new KeyValuePair("timing",Timing); - if (AsNeededElement is not null) yield return new KeyValuePair("asNeeded",AsNeededElement); - if (AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",AsNeededFor); + if (_Timing?.Any() == true) yield return new KeyValuePair("timing",_Timing); + if (_AsNeededElement is not null) yield return new KeyValuePair("asNeeded",_AsNeededElement); + if (_AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",_AsNeededFor); } } @@ -468,39 +457,35 @@ public partial class NutrientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40, FiveWs="FiveWs.what[x]")] [Binding("NutrientModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Quantity of the specified nutrient. /// [FhirElement("amount", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as NutrientComponent; - - if (dest == null) - { + if(other is not NutrientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -512,41 +497,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutrientComponent; - if(otherT == null) return false; + if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -557,8 +542,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -585,13 +570,13 @@ public partial class TextureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("modifier", Order=40)] [Binding("TextureModifier")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Modifier + public Hl7.Fhir.Model.CodeableConcept? Modifier { get { return _Modifier; } set { _Modifier = value; OnPropertyChanged("Modifier"); } } - private Hl7.Fhir.Model.CodeableConcept _Modifier; + private Hl7.Fhir.Model.CodeableConcept? _Modifier; /// /// Concepts that are used to identify an entity that is ingested for nutritional purposes. @@ -599,26 +584,22 @@ public Hl7.Fhir.Model.CodeableConcept Modifier [FhirElement("foodType", Order=50)] [Binding("TextureModifiedFoodType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FoodType + public Hl7.Fhir.Model.CodeableConcept? FoodType { get { return _FoodType; } set { _FoodType = value; OnPropertyChanged("FoodType"); } } - private Hl7.Fhir.Model.CodeableConcept _FoodType; + private Hl7.Fhir.Model.CodeableConcept? _FoodType; protected internal override void CopyToInternal(Base other) { - var dest = other as TextureComponent; - - if (dest == null) - { + if(other is not TextureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Modifier != null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)Modifier.DeepCopyInternal(); - if(FoodType != null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)FoodType.DeepCopyInternal(); + if(_Modifier is not null) dest.Modifier = (Hl7.Fhir.Model.CodeableConcept)_Modifier.DeepCopyInternal(); + if(_FoodType is not null) dest.FoodType = (Hl7.Fhir.Model.CodeableConcept)_FoodType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -630,41 +611,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TextureComponent; - if(otherT == null) return false; + if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Modifier, otherT.Modifier)) return false; - if(!comparer.Equals(FoodType, otherT.FoodType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "modifier": - value = Modifier; - return Modifier is not null; + value = _Modifier; + return _Modifier is not null; case "foodType": - value = FoodType; - return FoodType is not null; + value = _FoodType; + return _FoodType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "modifier": - Modifier = (Hl7.Fhir.Model.CodeableConcept)value; + Modifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "foodType": - FoodType = (Hl7.Fhir.Model.CodeableConcept)value; + FoodType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -675,8 +656,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Modifier is not null) yield return new KeyValuePair("modifier",Modifier); - if (FoodType is not null) yield return new KeyValuePair("foodType",FoodType); + if (_Modifier is not null) yield return new KeyValuePair("modifier",_Modifier); + if (_FoodType is not null) yield return new KeyValuePair("foodType",_FoodType); } } @@ -703,41 +684,38 @@ public partial class SupplementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [Binding("SupplementType")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Type + public Hl7.Fhir.Model.CodeableReference? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableReference _Type; + private Hl7.Fhir.Model.CodeableReference? _Type; /// /// Product or brand name of the nutritional supplement. /// [FhirElement("productName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// Product or brand name of the nutritional supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -747,73 +725,66 @@ public string ProductName /// [FhirElement("schedule", Order=60)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent Schedule + public Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent _Schedule; + private Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent? _Schedule; /// /// Amount of the nutritional supplement. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Instructions or additional information about the oral supplement. /// [FhirElement("instruction", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString InstructionElement + public Hl7.Fhir.Model.FhirString? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.FhirString _InstructionElement; + private Hl7.Fhir.Model.FhirString? _InstructionElement; /// /// Instructions or additional information about the oral supplement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.FhirString(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementComponent; - - if (dest == null) - { + if(other is not SupplementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableReference)Type.DeepCopyInternal(); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent)Schedule.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)InstructionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableReference)_Type.DeepCopyInternal(); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent)_Schedule.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.FhirString)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -825,62 +796,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementComponent; - if(otherT == null) return false; + if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableReference)value; + Type = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "schedule": - Schedule = (Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent)value; + Schedule = (Hl7.Fhir.Model.NutritionOrder.SupplementScheduleComponent?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.FhirString)value; + InstructionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -891,11 +862,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -924,24 +895,24 @@ public partial class SupplementScheduleComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Timing { - get { if(_Timing==null) _Timing = new List(); return _Timing; } + get => _Timing ?? new List(); set { _Timing = value; OnPropertyChanged("Timing"); } } - private List _Timing; + private List? _Timing; /// /// Take 'as needed'. /// [FhirElement("asNeeded", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AsNeededElement + public Hl7.Fhir.Model.FhirBoolean? AsNeededElement { get { return _AsNeededElement; } set { _AsNeededElement = value; OnPropertyChanged("AsNeededElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AsNeededElement; + private Hl7.Fhir.Model.FhirBoolean? _AsNeededElement; /// /// Take 'as needed' @@ -950,13 +921,10 @@ public Hl7.Fhir.Model.FhirBoolean AsNeededElement [IgnoreDataMember] public bool? AsNeeded { - get { return AsNeededElement != null ? AsNeededElement.Value : null; } + get => _AsNeededElement?.Value; set { - if (value == null) - AsNeededElement = null; - else - AsNeededElement = new Hl7.Fhir.Model.FhirBoolean(value); + AsNeededElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AsNeeded"); } } @@ -967,27 +935,23 @@ public bool? AsNeeded [FhirElement("asNeededFor", Order=60)] [Binding("SupplementAsNeededReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AsNeededFor + public Hl7.Fhir.Model.CodeableConcept? AsNeededFor { get { return _AsNeededFor; } set { _AsNeededFor = value; OnPropertyChanged("AsNeededFor"); } } - private Hl7.Fhir.Model.CodeableConcept _AsNeededFor; + private Hl7.Fhir.Model.CodeableConcept? _AsNeededFor; protected internal override void CopyToInternal(Base other) { - var dest = other as SupplementScheduleComponent; - - if (dest == null) - { + if(other is not SupplementScheduleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Timing.Any()) dest.Timing = new List(Timing.DeepCopyInternal()); - if(AsNeededElement != null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)AsNeededElement.DeepCopyInternal(); - if(AsNeededFor != null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)AsNeededFor.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = new List(_Timing.DeepCopyInternal()); + if(_AsNeededElement is not null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)_AsNeededElement.DeepCopyInternal(); + if(_AsNeededFor is not null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)_AsNeededFor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -999,48 +963,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplementScheduleComponent; - if(otherT == null) return false; + if(other is not SupplementScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeededElement, otherT.AsNeededElement)) return false; - if(!comparer.Equals(AsNeededFor, otherT.AsNeededFor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; + if(!comparer.Equals(_AsNeededFor, otherT._AsNeededFor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "timing": - value = Timing; - return Timing?.Any() == true; + value = _Timing; + return _Timing?.Any() == true; case "asNeeded": - value = AsNeededElement; - return AsNeededElement is not null; + value = _AsNeededElement; + return _AsNeededElement is not null; case "asNeededFor": - value = AsNeededFor; - return AsNeededFor is not null; + value = _AsNeededFor; + return _AsNeededFor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "timing": - Timing = (List)value; + Timing = (List?)value!; return this; case "asNeeded": - AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)value; + AsNeededElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "asNeededFor": - AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)value; + AsNeededFor = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1051,9 +1015,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Timing?.Any() == true) yield return new KeyValuePair("timing",Timing); - if (AsNeededElement is not null) yield return new KeyValuePair("asNeeded",AsNeededElement); - if (AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",AsNeededFor); + if (_Timing?.Any() == true) yield return new KeyValuePair("timing",_Timing); + if (_AsNeededElement is not null) yield return new KeyValuePair("asNeeded",_AsNeededElement); + if (_AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",_AsNeededFor); } } @@ -1080,41 +1044,38 @@ public partial class EnteralFormulaComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("baseFormulaType", InSummary=true, Order=40, FiveWs="FiveWs.what[x]")] [Binding("EnteralFormulaType")] [DataMember] - public Hl7.Fhir.Model.CodeableReference BaseFormulaType + public Hl7.Fhir.Model.CodeableReference? BaseFormulaType { get { return _BaseFormulaType; } set { _BaseFormulaType = value; OnPropertyChanged("BaseFormulaType"); } } - private Hl7.Fhir.Model.CodeableReference _BaseFormulaType; + private Hl7.Fhir.Model.CodeableReference? _BaseFormulaType; /// /// Product or brand name of the enteral or infant formula. /// [FhirElement("baseFormulaProductName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString BaseFormulaProductNameElement + public Hl7.Fhir.Model.FhirString? BaseFormulaProductNameElement { get { return _BaseFormulaProductNameElement; } set { _BaseFormulaProductNameElement = value; OnPropertyChanged("BaseFormulaProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _BaseFormulaProductNameElement; + private Hl7.Fhir.Model.FhirString? _BaseFormulaProductNameElement; /// /// Product or brand name of the enteral or infant formula /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BaseFormulaProductName + public string? BaseFormulaProductName { - get { return BaseFormulaProductNameElement != null ? BaseFormulaProductNameElement.Value : null; } + get => _BaseFormulaProductNameElement?.Value; set { - if (value == null) - BaseFormulaProductNameElement = null; - else - BaseFormulaProductNameElement = new Hl7.Fhir.Model.FhirString(value); + BaseFormulaProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("BaseFormulaProductName"); } } @@ -1127,11 +1088,11 @@ public string BaseFormulaProductName [DataMember] public List DeliveryDevice { - get { if(_DeliveryDevice==null) _DeliveryDevice = new List(); return _DeliveryDevice; } + get => _DeliveryDevice ?? new List(); set { _DeliveryDevice = value; OnPropertyChanged("DeliveryDevice"); } } - private List _DeliveryDevice; + private List? _DeliveryDevice; /// /// Components to add to the feeding. @@ -1141,24 +1102,24 @@ public List DeliveryDevice [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Amount of energy per specified volume that is required. /// [FhirElement("caloricDensity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity CaloricDensity + public Hl7.Fhir.Model.Quantity? CaloricDensity { get { return _CaloricDensity; } set { _CaloricDensity = value; OnPropertyChanged("CaloricDensity"); } } - private Hl7.Fhir.Model.Quantity _CaloricDensity; + private Hl7.Fhir.Model.Quantity? _CaloricDensity; /// /// How the formula should enter the patient's gastrointestinal tract. @@ -1166,13 +1127,13 @@ public Hl7.Fhir.Model.Quantity CaloricDensity [FhirElement("routeOfAdministration", Order=90)] [Binding("EnteralRouteOfAdministration")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RouteOfAdministration + public Hl7.Fhir.Model.CodeableConcept? RouteOfAdministration { get { return _RouteOfAdministration; } set { _RouteOfAdministration = value; OnPropertyChanged("RouteOfAdministration"); } } - private Hl7.Fhir.Model.CodeableConcept _RouteOfAdministration; + private Hl7.Fhir.Model.CodeableConcept? _RouteOfAdministration; /// /// Formula feeding instruction as structured data. @@ -1182,75 +1143,68 @@ public Hl7.Fhir.Model.CodeableConcept RouteOfAdministration [DataMember] public List Administration { - get { if(_Administration==null) _Administration = new List(); return _Administration; } + get => _Administration ?? new List(); set { _Administration = value; OnPropertyChanged("Administration"); } } - private List _Administration; + private List? _Administration; /// /// Upper limit on formula volume per unit of time. /// [FhirElement("maxVolumeToDeliver", Order=110)] [DataMember] - public Hl7.Fhir.Model.Quantity MaxVolumeToDeliver + public Hl7.Fhir.Model.Quantity? MaxVolumeToDeliver { get { return _MaxVolumeToDeliver; } set { _MaxVolumeToDeliver = value; OnPropertyChanged("MaxVolumeToDeliver"); } } - private Hl7.Fhir.Model.Quantity _MaxVolumeToDeliver; + private Hl7.Fhir.Model.Quantity? _MaxVolumeToDeliver; /// /// Formula feeding instructions expressed as text. /// [FhirElement("administrationInstruction", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Markdown AdministrationInstructionElement + public Hl7.Fhir.Model.Markdown? AdministrationInstructionElement { get { return _AdministrationInstructionElement; } set { _AdministrationInstructionElement = value; OnPropertyChanged("AdministrationInstructionElement"); } } - private Hl7.Fhir.Model.Markdown _AdministrationInstructionElement; + private Hl7.Fhir.Model.Markdown? _AdministrationInstructionElement; /// /// Formula feeding instructions expressed as text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AdministrationInstruction + public string? AdministrationInstruction { - get { return AdministrationInstructionElement != null ? AdministrationInstructionElement.Value : null; } + get => _AdministrationInstructionElement?.Value; set { - if (value == null) - AdministrationInstructionElement = null; - else - AdministrationInstructionElement = new Hl7.Fhir.Model.Markdown(value); + AdministrationInstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("AdministrationInstruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EnteralFormulaComponent; - - if (dest == null) - { + if(other is not EnteralFormulaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(BaseFormulaType != null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableReference)BaseFormulaType.DeepCopyInternal(); - if(BaseFormulaProductNameElement != null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)BaseFormulaProductNameElement.DeepCopyInternal(); - if(DeliveryDevice.Any()) dest.DeliveryDevice = new List(DeliveryDevice.DeepCopyInternal()); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(CaloricDensity != null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)CaloricDensity.DeepCopyInternal(); - if(RouteOfAdministration != null) dest.RouteOfAdministration = (Hl7.Fhir.Model.CodeableConcept)RouteOfAdministration.DeepCopyInternal(); - if(Administration.Any()) dest.Administration = new List(Administration.DeepCopyInternal()); - if(MaxVolumeToDeliver != null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)MaxVolumeToDeliver.DeepCopyInternal(); - if(AdministrationInstructionElement != null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.Markdown)AdministrationInstructionElement.DeepCopyInternal(); + if(_BaseFormulaType is not null) dest.BaseFormulaType = (Hl7.Fhir.Model.CodeableReference)_BaseFormulaType.DeepCopyInternal(); + if(_BaseFormulaProductNameElement is not null) dest.BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)_BaseFormulaProductNameElement.DeepCopyInternal(); + if(_DeliveryDevice is not null) dest.DeliveryDevice = new List(_DeliveryDevice.DeepCopyInternal()); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_CaloricDensity is not null) dest.CaloricDensity = (Hl7.Fhir.Model.Quantity)_CaloricDensity.DeepCopyInternal(); + if(_RouteOfAdministration is not null) dest.RouteOfAdministration = (Hl7.Fhir.Model.CodeableConcept)_RouteOfAdministration.DeepCopyInternal(); + if(_Administration is not null) dest.Administration = new List(_Administration.DeepCopyInternal()); + if(_MaxVolumeToDeliver is not null) dest.MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)_MaxVolumeToDeliver.DeepCopyInternal(); + if(_AdministrationInstructionElement is not null) dest.AdministrationInstructionElement = (Hl7.Fhir.Model.Markdown)_AdministrationInstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1262,90 +1216,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnteralFormulaComponent; - if(otherT == null) return false; + if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(BaseFormulaType, otherT.BaseFormulaType)) return false; - if(!comparer.Equals(BaseFormulaProductNameElement, otherT.BaseFormulaProductNameElement)) return false; - if(!comparer.ListEquals(DeliveryDevice, otherT.DeliveryDevice)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(CaloricDensity, otherT.CaloricDensity)) return false; - if(!comparer.Equals(RouteOfAdministration, otherT.RouteOfAdministration)) return false; - if(!comparer.ListEquals(Administration, otherT.Administration)) return false; - if(!comparer.Equals(MaxVolumeToDeliver, otherT.MaxVolumeToDeliver)) return false; - if(!comparer.Equals(AdministrationInstructionElement, otherT.AdministrationInstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; + if(!comparer.ListEquals(_DeliveryDevice, otherT._DeliveryDevice)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_CaloricDensity, otherT._CaloricDensity)) return false; + if(!comparer.Equals(_RouteOfAdministration, otherT._RouteOfAdministration)) return false; + if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; + if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; + if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "baseFormulaType": - value = BaseFormulaType; - return BaseFormulaType is not null; + value = _BaseFormulaType; + return _BaseFormulaType is not null; case "baseFormulaProductName": - value = BaseFormulaProductNameElement; - return BaseFormulaProductNameElement is not null; + value = _BaseFormulaProductNameElement; + return _BaseFormulaProductNameElement is not null; case "deliveryDevice": - value = DeliveryDevice; - return DeliveryDevice?.Any() == true; + value = _DeliveryDevice; + return _DeliveryDevice?.Any() == true; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "caloricDensity": - value = CaloricDensity; - return CaloricDensity is not null; + value = _CaloricDensity; + return _CaloricDensity is not null; case "routeOfAdministration": - value = RouteOfAdministration; - return RouteOfAdministration is not null; + value = _RouteOfAdministration; + return _RouteOfAdministration is not null; case "administration": - value = Administration; - return Administration?.Any() == true; + value = _Administration; + return _Administration?.Any() == true; case "maxVolumeToDeliver": - value = MaxVolumeToDeliver; - return MaxVolumeToDeliver is not null; + value = _MaxVolumeToDeliver; + return _MaxVolumeToDeliver is not null; case "administrationInstruction": - value = AdministrationInstructionElement; - return AdministrationInstructionElement is not null; + value = _AdministrationInstructionElement; + return _AdministrationInstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "baseFormulaType": - BaseFormulaType = (Hl7.Fhir.Model.CodeableReference)value; + BaseFormulaType = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "baseFormulaProductName": - BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString)value; + BaseFormulaProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "deliveryDevice": - DeliveryDevice = (List)value; + DeliveryDevice = (List?)value!; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "caloricDensity": - CaloricDensity = (Hl7.Fhir.Model.Quantity)value; + CaloricDensity = (Hl7.Fhir.Model.Quantity?)value; return this; case "routeOfAdministration": - RouteOfAdministration = (Hl7.Fhir.Model.CodeableConcept)value; + RouteOfAdministration = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "administration": - Administration = (List)value; + Administration = (List?)value!; return this; case "maxVolumeToDeliver": - MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity)value; + MaxVolumeToDeliver = (Hl7.Fhir.Model.Quantity?)value; return this; case "administrationInstruction": - AdministrationInstructionElement = (Hl7.Fhir.Model.Markdown)value; + AdministrationInstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1356,15 +1310,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",BaseFormulaType); - if (BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",BaseFormulaProductNameElement); - if (DeliveryDevice?.Any() == true) yield return new KeyValuePair("deliveryDevice",DeliveryDevice); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",CaloricDensity); - if (RouteOfAdministration is not null) yield return new KeyValuePair("routeOfAdministration",RouteOfAdministration); - if (Administration?.Any() == true) yield return new KeyValuePair("administration",Administration); - if (MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",MaxVolumeToDeliver); - if (AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",AdministrationInstructionElement); + if (_BaseFormulaType is not null) yield return new KeyValuePair("baseFormulaType",_BaseFormulaType); + if (_BaseFormulaProductNameElement is not null) yield return new KeyValuePair("baseFormulaProductName",_BaseFormulaProductNameElement); + if (_DeliveryDevice?.Any() == true) yield return new KeyValuePair("deliveryDevice",_DeliveryDevice); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_CaloricDensity is not null) yield return new KeyValuePair("caloricDensity",_CaloricDensity); + if (_RouteOfAdministration is not null) yield return new KeyValuePair("routeOfAdministration",_RouteOfAdministration); + if (_Administration?.Any() == true) yield return new KeyValuePair("administration",_Administration); + if (_MaxVolumeToDeliver is not null) yield return new KeyValuePair("maxVolumeToDeliver",_MaxVolumeToDeliver); + if (_AdministrationInstructionElement is not null) yield return new KeyValuePair("administrationInstruction",_AdministrationInstructionElement); } } @@ -1391,41 +1345,38 @@ public partial class AdditiveComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40, FiveWs="FiveWs.what[x]")] [Binding("EnteralFormulaAdditiveType")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Type + public Hl7.Fhir.Model.CodeableReference? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableReference _Type; + private Hl7.Fhir.Model.CodeableReference? _Type; /// /// Product or brand name of the modular additive. /// [FhirElement("productName", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ProductNameElement + public Hl7.Fhir.Model.FhirString? ProductNameElement { get { return _ProductNameElement; } set { _ProductNameElement = value; OnPropertyChanged("ProductNameElement"); } } - private Hl7.Fhir.Model.FhirString _ProductNameElement; + private Hl7.Fhir.Model.FhirString? _ProductNameElement; /// /// Product or brand name of the modular additive /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProductName + public string? ProductName { - get { return ProductNameElement != null ? ProductNameElement.Value : null; } + get => _ProductNameElement?.Value; set { - if (value == null) - ProductNameElement = null; - else - ProductNameElement = new Hl7.Fhir.Model.FhirString(value); + ProductNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProductName"); } } @@ -1435,27 +1386,23 @@ public string ProductName /// [FhirElement("quantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; protected internal override void CopyToInternal(Base other) { - var dest = other as AdditiveComponent; - - if (dest == null) - { + if(other is not AdditiveComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableReference)Type.DeepCopyInternal(); - if(ProductNameElement != null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)ProductNameElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableReference)_Type.DeepCopyInternal(); + if(_ProductNameElement is not null) dest.ProductNameElement = (Hl7.Fhir.Model.FhirString)_ProductNameElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1467,48 +1414,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdditiveComponent; - if(otherT == null) return false; + if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ProductNameElement, otherT.ProductNameElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "productName": - value = ProductNameElement; - return ProductNameElement is not null; + value = _ProductNameElement; + return _ProductNameElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableReference)value; + Type = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "productName": - ProductNameElement = (Hl7.Fhir.Model.FhirString)value; + ProductNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -1519,9 +1466,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ProductNameElement is not null) yield return new KeyValuePair("productName",ProductNameElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ProductNameElement is not null) yield return new KeyValuePair("productName",_ProductNameElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); } } @@ -1548,26 +1495,26 @@ public partial class AdministrationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("schedule", Order=40)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent Schedule + public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent _Schedule; + private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent? _Schedule; /// /// The volume of formula to provide. /// [FhirElement("quantity", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Speed with which the formula is provided per period of time. @@ -1576,27 +1523,23 @@ public Hl7.Fhir.Model.Quantity Quantity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Rate + public Hl7.Fhir.Model.DataType? Rate { get { return _Rate; } set { _Rate = value; OnPropertyChanged("Rate"); } } - private Hl7.Fhir.Model.DataType _Rate; + private Hl7.Fhir.Model.DataType? _Rate; protected internal override void CopyToInternal(Base other) { - var dest = other as AdministrationComponent; - - if (dest == null) - { + if(other is not AdministrationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent)Schedule.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Rate != null) dest.Rate = (Hl7.Fhir.Model.DataType)Rate.DeepCopyInternal(); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent)_Schedule.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Rate is not null) dest.Rate = (Hl7.Fhir.Model.DataType)_Rate.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1608,48 +1551,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdministrationComponent; - if(otherT == null) return false; + if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Rate, otherT.Rate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Rate, otherT._Rate)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "rate": - value = Rate; - return Rate is not null; + value = _Rate; + return _Rate is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "schedule": - Schedule = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent)value; + Schedule = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaScheduleComponent?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "rate": - Rate = (Hl7.Fhir.Model.DataType)value; + Rate = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1660,9 +1603,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Rate is not null) yield return new KeyValuePair("rate",Rate); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Rate is not null) yield return new KeyValuePair("rate",_Rate); } } @@ -1691,24 +1634,24 @@ public partial class EnteralFormulaScheduleComponent : Hl7.Fhir.Model.BackboneEl [DataMember] public List Timing { - get { if(_Timing==null) _Timing = new List(); return _Timing; } + get => _Timing ?? new List(); set { _Timing = value; OnPropertyChanged("Timing"); } } - private List _Timing; + private List? _Timing; /// /// Take 'as needed'. /// [FhirElement("asNeeded", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AsNeededElement + public Hl7.Fhir.Model.FhirBoolean? AsNeededElement { get { return _AsNeededElement; } set { _AsNeededElement = value; OnPropertyChanged("AsNeededElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AsNeededElement; + private Hl7.Fhir.Model.FhirBoolean? _AsNeededElement; /// /// Take 'as needed' @@ -1717,13 +1660,10 @@ public Hl7.Fhir.Model.FhirBoolean AsNeededElement [IgnoreDataMember] public bool? AsNeeded { - get { return AsNeededElement != null ? AsNeededElement.Value : null; } + get => _AsNeededElement?.Value; set { - if (value == null) - AsNeededElement = null; - else - AsNeededElement = new Hl7.Fhir.Model.FhirBoolean(value); + AsNeededElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AsNeeded"); } } @@ -1734,27 +1674,23 @@ public bool? AsNeeded [FhirElement("asNeededFor", Order=60)] [Binding("EnteralFormulaAsNeededReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AsNeededFor + public Hl7.Fhir.Model.CodeableConcept? AsNeededFor { get { return _AsNeededFor; } set { _AsNeededFor = value; OnPropertyChanged("AsNeededFor"); } } - private Hl7.Fhir.Model.CodeableConcept _AsNeededFor; + private Hl7.Fhir.Model.CodeableConcept? _AsNeededFor; protected internal override void CopyToInternal(Base other) { - var dest = other as EnteralFormulaScheduleComponent; - - if (dest == null) - { + if(other is not EnteralFormulaScheduleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Timing.Any()) dest.Timing = new List(Timing.DeepCopyInternal()); - if(AsNeededElement != null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)AsNeededElement.DeepCopyInternal(); - if(AsNeededFor != null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)AsNeededFor.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = new List(_Timing.DeepCopyInternal()); + if(_AsNeededElement is not null) dest.AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)_AsNeededElement.DeepCopyInternal(); + if(_AsNeededFor is not null) dest.AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)_AsNeededFor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1766,48 +1702,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnteralFormulaScheduleComponent; - if(otherT == null) return false; + if(other is not EnteralFormulaScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(AsNeededElement, otherT.AsNeededElement)) return false; - if(!comparer.Equals(AsNeededFor, otherT.AsNeededFor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; + if(!comparer.Equals(_AsNeededFor, otherT._AsNeededFor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "timing": - value = Timing; - return Timing?.Any() == true; + value = _Timing; + return _Timing?.Any() == true; case "asNeeded": - value = AsNeededElement; - return AsNeededElement is not null; + value = _AsNeededElement; + return _AsNeededElement is not null; case "asNeededFor": - value = AsNeededFor; - return AsNeededFor is not null; + value = _AsNeededFor; + return _AsNeededFor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "timing": - Timing = (List)value; + Timing = (List?)value!; return this; case "asNeeded": - AsNeededElement = (Hl7.Fhir.Model.FhirBoolean)value; + AsNeededElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "asNeededFor": - AsNeededFor = (Hl7.Fhir.Model.CodeableConcept)value; + AsNeededFor = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1818,9 +1754,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Timing?.Any() == true) yield return new KeyValuePair("timing",Timing); - if (AsNeededElement is not null) yield return new KeyValuePair("asNeeded",AsNeededElement); - if (AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",AsNeededFor); + if (_Timing?.Any() == true) yield return new KeyValuePair("timing",_Timing); + if (_AsNeededElement is not null) yield return new KeyValuePair("asNeeded",_AsNeededElement); + if (_AsNeededFor is not null) yield return new KeyValuePair("asNeededFor",_AsNeededFor); } } @@ -1833,11 +1769,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -1847,24 +1783,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -1879,24 +1815,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -1911,24 +1847,24 @@ public IEnumerable InstantiatesUri [DataMember] public List InstantiatesElement { - get { if(_InstantiatesElement==null) _InstantiatesElement = new List(); return _InstantiatesElement; } + get => _InstantiatesElement ?? new List(); set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } - private List _InstantiatesElement; + private List? _InstantiatesElement; /// /// Instantiates protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Instantiates + public IEnumerable? Instantiates { - get { return InstantiatesElement != null ? InstantiatesElement.Select(elem => elem.Value) : null; } + get => _InstantiatesElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesElement = null; + InstantiatesElement = null!; else InstantiatesElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Instantiates"); @@ -1945,24 +1881,24 @@ public IEnumerable Instantiates [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Composite Request ID. /// [FhirElement("groupIdentifier", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -1972,13 +1908,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("NutritionOrderStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -1987,13 +1923,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2006,13 +1939,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("NutritiionOrderIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -2021,13 +1954,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -2039,13 +1969,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("NutritionOrderPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -2054,13 +1984,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -2073,13 +2000,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The encounter associated with this nutrition order. @@ -2088,13 +2015,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Information to support fulfilling of the nutrition order. @@ -2106,11 +2033,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List SupportingInformation { - get { if(_SupportingInformation==null) _SupportingInformation = new List(); return _SupportingInformation; } + get => _SupportingInformation ?? new List(); set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } - private List _SupportingInformation; + private List? _SupportingInformation; /// /// Date and time the nutrition order was requested. @@ -2118,28 +2045,25 @@ public List SupportingInformation [FhirElement("dateTime", InSummary=true, Order=210, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateTimeElement + public Hl7.Fhir.Model.FhirDateTime? DateTimeElement { get { return _DateTimeElement; } set { _DateTimeElement = value; OnPropertyChanged("DateTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _DateTimeElement; /// /// Date and time the nutrition order was requested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateTime + public string? DateTime { - get { return DateTimeElement != null ? DateTimeElement.Value : null; } + get => _DateTimeElement?.Value; set { - if (value == null) - DateTimeElement = null; - else - DateTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateTime"); } } @@ -2151,13 +2075,13 @@ public string DateTime [CLSCompliant(false)] [References("Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Orderer + public Hl7.Fhir.Model.ResourceReference? Orderer { get { return _Orderer; } set { _Orderer = value; OnPropertyChanged("Orderer"); } } - private Hl7.Fhir.Model.ResourceReference _Orderer; + private Hl7.Fhir.Model.ResourceReference? _Orderer; /// /// Who is desired to perform the administration of what is being ordered. @@ -2167,11 +2091,11 @@ public Hl7.Fhir.Model.ResourceReference Orderer [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// List of the patient's food and nutrition-related allergies and intolerances. @@ -2183,11 +2107,11 @@ public List Performer [DataMember] public List AllergyIntolerance { - get { if(_AllergyIntolerance==null) _AllergyIntolerance = new List(); return _AllergyIntolerance; } + get => _AllergyIntolerance ?? new List(); set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } - private List _AllergyIntolerance; + private List? _AllergyIntolerance; /// /// Order-specific modifier about the type of food that should be given. @@ -2198,11 +2122,11 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get { if(_FoodPreferenceModifier==null) _FoodPreferenceModifier = new List(); return _FoodPreferenceModifier; } + get => _FoodPreferenceModifier ?? new List(); set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } - private List _FoodPreferenceModifier; + private List? _FoodPreferenceModifier; /// /// Order-specific modifier about the type of food that should not be given. @@ -2213,24 +2137,24 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get { if(_ExcludeFoodModifier==null) _ExcludeFoodModifier = new List(); return _ExcludeFoodModifier; } + get => _ExcludeFoodModifier ?? new List(); set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } - private List _ExcludeFoodModifier; + private List? _ExcludeFoodModifier; /// /// Capture when a food item is brought in by the patient and/or family. /// [FhirElement("outsideFoodAllowed", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OutsideFoodAllowedElement + public Hl7.Fhir.Model.FhirBoolean? OutsideFoodAllowedElement { get { return _OutsideFoodAllowedElement; } set { _OutsideFoodAllowedElement = value; OnPropertyChanged("OutsideFoodAllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OutsideFoodAllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _OutsideFoodAllowedElement; /// /// Capture when a food item is brought in by the patient and/or family @@ -2239,13 +2163,10 @@ public Hl7.Fhir.Model.FhirBoolean OutsideFoodAllowedElement [IgnoreDataMember] public bool? OutsideFoodAllowed { - get { return OutsideFoodAllowedElement != null ? OutsideFoodAllowedElement.Value : null; } + get => _OutsideFoodAllowedElement?.Value; set { - if (value == null) - OutsideFoodAllowedElement = null; - else - OutsideFoodAllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OutsideFoodAllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("OutsideFoodAllowed"); } } @@ -2255,13 +2176,13 @@ public bool? OutsideFoodAllowed /// [FhirElement("oralDiet", Order=280)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet + public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet { get { return _OralDiet; } set { _OralDiet = value; OnPropertyChanged("OralDiet"); } } - private Hl7.Fhir.Model.NutritionOrder.OralDietComponent _OralDiet; + private Hl7.Fhir.Model.NutritionOrder.OralDietComponent? _OralDiet; /// /// Supplement components. @@ -2271,24 +2192,24 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent OralDiet [DataMember] public List Supplement { - get { if(_Supplement==null) _Supplement = new List(); return _Supplement; } + get => _Supplement ?? new List(); set { _Supplement = value; OnPropertyChanged("Supplement"); } } - private List _Supplement; + private List? _Supplement; /// /// Enteral formula components. /// [FhirElement("enteralFormula", Order=300)] [DataMember] - public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent EnteralFormula + public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? EnteralFormula { get { return _EnteralFormula; } set { _EnteralFormula = value; OnPropertyChanged("EnteralFormula"); } } - private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent _EnteralFormula; + private Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? _EnteralFormula; /// /// Comments. @@ -2298,47 +2219,43 @@ public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent EnteralFormula [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as NutritionOrder; - - if (dest == null) - { + if(other is not NutritionOrder dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(InstantiatesElement.Any()) dest.InstantiatesElement = new List(InstantiatesElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(SupportingInformation.Any()) dest.SupportingInformation = new List(SupportingInformation.DeepCopyInternal()); - if(DateTimeElement != null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)DateTimeElement.DeepCopyInternal(); - if(Orderer != null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)Orderer.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(AllergyIntolerance.Any()) dest.AllergyIntolerance = new List(AllergyIntolerance.DeepCopyInternal()); - if(FoodPreferenceModifier.Any()) dest.FoodPreferenceModifier = new List(FoodPreferenceModifier.DeepCopyInternal()); - if(ExcludeFoodModifier.Any()) dest.ExcludeFoodModifier = new List(ExcludeFoodModifier.DeepCopyInternal()); - if(OutsideFoodAllowedElement != null) dest.OutsideFoodAllowedElement = (Hl7.Fhir.Model.FhirBoolean)OutsideFoodAllowedElement.DeepCopyInternal(); - if(OralDiet != null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)OralDiet.DeepCopyInternal(); - if(Supplement.Any()) dest.Supplement = new List(Supplement.DeepCopyInternal()); - if(EnteralFormula != null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)EnteralFormula.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_InstantiatesElement is not null) dest.InstantiatesElement = new List(_InstantiatesElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_SupportingInformation is not null) dest.SupportingInformation = new List(_SupportingInformation.DeepCopyInternal()); + if(_DateTimeElement is not null) dest.DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)_DateTimeElement.DeepCopyInternal(); + if(_Orderer is not null) dest.Orderer = (Hl7.Fhir.Model.ResourceReference)_Orderer.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_AllergyIntolerance is not null) dest.AllergyIntolerance = new List(_AllergyIntolerance.DeepCopyInternal()); + if(_FoodPreferenceModifier is not null) dest.FoodPreferenceModifier = new List(_FoodPreferenceModifier.DeepCopyInternal()); + if(_ExcludeFoodModifier is not null) dest.ExcludeFoodModifier = new List(_ExcludeFoodModifier.DeepCopyInternal()); + if(_OutsideFoodAllowedElement is not null) dest.OutsideFoodAllowedElement = (Hl7.Fhir.Model.FhirBoolean)_OutsideFoodAllowedElement.DeepCopyInternal(); + if(_OralDiet is not null) dest.OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)_OralDiet.DeepCopyInternal(); + if(_Supplement is not null) dest.Supplement = new List(_Supplement.DeepCopyInternal()); + if(_EnteralFormula is not null) dest.EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)_EnteralFormula.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2350,188 +2267,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutritionOrder; - if(otherT == null) return false; + if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(InstantiatesElement, otherT.InstantiatesElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(SupportingInformation, otherT.SupportingInformation)) return false; - if(!comparer.Equals(DateTimeElement, otherT.DateTimeElement)) return false; - if(!comparer.Equals(Orderer, otherT.Orderer)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(AllergyIntolerance, otherT.AllergyIntolerance)) return false; - if(!comparer.ListEquals(FoodPreferenceModifier, otherT.FoodPreferenceModifier)) return false; - if(!comparer.ListEquals(ExcludeFoodModifier, otherT.ExcludeFoodModifier)) return false; - if(!comparer.Equals(OutsideFoodAllowedElement, otherT.OutsideFoodAllowedElement)) return false; - if(!comparer.Equals(OralDiet, otherT.OralDiet)) return false; - if(!comparer.ListEquals(Supplement, otherT.Supplement)) return false; - if(!comparer.Equals(EnteralFormula, otherT.EnteralFormula)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; + if(!comparer.Equals(_DateTimeElement, otherT._DateTimeElement)) return false; + if(!comparer.Equals(_Orderer, otherT._Orderer)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_AllergyIntolerance, otherT._AllergyIntolerance)) return false; + if(!comparer.ListEquals(_FoodPreferenceModifier, otherT._FoodPreferenceModifier)) return false; + if(!comparer.ListEquals(_ExcludeFoodModifier, otherT._ExcludeFoodModifier)) return false; + if(!comparer.Equals(_OutsideFoodAllowedElement, otherT._OutsideFoodAllowedElement)) return false; + if(!comparer.Equals(_OralDiet, otherT._OralDiet)) return false; + if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; + if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "instantiates": - value = InstantiatesElement; - return InstantiatesElement?.Any() == true; + value = _InstantiatesElement; + return _InstantiatesElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "supportingInformation": - value = SupportingInformation; - return SupportingInformation?.Any() == true; + value = _SupportingInformation; + return _SupportingInformation?.Any() == true; case "dateTime": - value = DateTimeElement; - return DateTimeElement is not null; + value = _DateTimeElement; + return _DateTimeElement is not null; case "orderer": - value = Orderer; - return Orderer is not null; + value = _Orderer; + return _Orderer is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "allergyIntolerance": - value = AllergyIntolerance; - return AllergyIntolerance?.Any() == true; + value = _AllergyIntolerance; + return _AllergyIntolerance?.Any() == true; case "foodPreferenceModifier": - value = FoodPreferenceModifier; - return FoodPreferenceModifier?.Any() == true; + value = _FoodPreferenceModifier; + return _FoodPreferenceModifier?.Any() == true; case "excludeFoodModifier": - value = ExcludeFoodModifier; - return ExcludeFoodModifier?.Any() == true; + value = _ExcludeFoodModifier; + return _ExcludeFoodModifier?.Any() == true; case "outsideFoodAllowed": - value = OutsideFoodAllowedElement; - return OutsideFoodAllowedElement is not null; + value = _OutsideFoodAllowedElement; + return _OutsideFoodAllowedElement is not null; case "oralDiet": - value = OralDiet; - return OralDiet is not null; + value = _OralDiet; + return _OralDiet is not null; case "supplement": - value = Supplement; - return Supplement?.Any() == true; + value = _Supplement; + return _Supplement?.Any() == true; case "enteralFormula": - value = EnteralFormula; - return EnteralFormula is not null; + value = _EnteralFormula; + return _EnteralFormula is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "instantiates": - InstantiatesElement = (List)value; + InstantiatesElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supportingInformation": - SupportingInformation = (List)value; + SupportingInformation = (List?)value!; return this; case "dateTime": - DateTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "orderer": - Orderer = (Hl7.Fhir.Model.ResourceReference)value; + Orderer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "allergyIntolerance": - AllergyIntolerance = (List)value; + AllergyIntolerance = (List?)value!; return this; case "foodPreferenceModifier": - FoodPreferenceModifier = (List)value; + FoodPreferenceModifier = (List?)value!; return this; case "excludeFoodModifier": - ExcludeFoodModifier = (List)value; + ExcludeFoodModifier = (List?)value!; return this; case "outsideFoodAllowed": - OutsideFoodAllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OutsideFoodAllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "oralDiet": - OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent)value; + OralDiet = (Hl7.Fhir.Model.NutritionOrder.OralDietComponent?)value; return this; case "supplement": - Supplement = (List)value; + Supplement = (List?)value!; return this; case "enteralFormula": - EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent)value; + EnteralFormula = (Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2542,29 +2459,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",InstantiatesElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",SupportingInformation); - if (DateTimeElement is not null) yield return new KeyValuePair("dateTime",DateTimeElement); - if (Orderer is not null) yield return new KeyValuePair("orderer",Orderer); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",AllergyIntolerance); - if (FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",FoodPreferenceModifier); - if (ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",ExcludeFoodModifier); - if (OutsideFoodAllowedElement is not null) yield return new KeyValuePair("outsideFoodAllowed",OutsideFoodAllowedElement); - if (OralDiet is not null) yield return new KeyValuePair("oralDiet",OralDiet); - if (Supplement?.Any() == true) yield return new KeyValuePair("supplement",Supplement); - if (EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",EnteralFormula); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_InstantiatesElement?.Any() == true) yield return new KeyValuePair("instantiates",_InstantiatesElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_SupportingInformation?.Any() == true) yield return new KeyValuePair("supportingInformation",_SupportingInformation); + if (_DateTimeElement is not null) yield return new KeyValuePair("dateTime",_DateTimeElement); + if (_Orderer is not null) yield return new KeyValuePair("orderer",_Orderer); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_AllergyIntolerance?.Any() == true) yield return new KeyValuePair("allergyIntolerance",_AllergyIntolerance); + if (_FoodPreferenceModifier?.Any() == true) yield return new KeyValuePair("foodPreferenceModifier",_FoodPreferenceModifier); + if (_ExcludeFoodModifier?.Any() == true) yield return new KeyValuePair("excludeFoodModifier",_ExcludeFoodModifier); + if (_OutsideFoodAllowedElement is not null) yield return new KeyValuePair("outsideFoodAllowed",_OutsideFoodAllowedElement); + if (_OralDiet is not null) yield return new KeyValuePair("oralDiet",_OralDiet); + if (_Supplement?.Any() == true) yield return new KeyValuePair("supplement",_Supplement); + if (_EnteralFormula is not null) yield return new KeyValuePair("enteralFormula",_EnteralFormula); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs index eb9c6bc97..19f5cbff5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,13 +112,13 @@ public partial class NutrientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", Order=40)] [Binding("NutritionProductNutrient")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// The amount of nutrient expressed in one or more units: X per pack / per serving / per dose. @@ -125,24 +128,20 @@ public Hl7.Fhir.Model.CodeableReference Item [DataMember] public List Amount { - get { if(_Amount==null) _Amount = new List(); return _Amount; } + get => _Amount ?? new List(); set { _Amount = value; OnPropertyChanged("Amount"); } } - private List _Amount; + private List? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as NutrientComponent; - - if (dest == null) - { + if(other is not NutrientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Amount.Any()) dest.Amount = new List(Amount.DeepCopyInternal()); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = new List(_Amount.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -154,41 +153,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutrientComponent; - if(otherT == null) return false; + if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "amount": - value = Amount; - return Amount?.Any() == true; + value = _Amount; + return _Amount?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "amount": - Amount = (List)value; + Amount = (List?)value!; return this; default: return base.SetValue(key, value); @@ -199,8 +198,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Amount?.Any() == true) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Amount?.Any() == true) yield return new KeyValuePair("amount",_Amount); } } @@ -224,13 +223,13 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// The amount of ingredient that is in the product. @@ -240,24 +239,20 @@ public Hl7.Fhir.Model.CodeableReference Item [DataMember] public List Amount { - get { if(_Amount==null) _Amount = new List(); return _Amount; } + get => _Amount ?? new List(); set { _Amount = value; OnPropertyChanged("Amount"); } } - private List _Amount; + private List? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Amount.Any()) dest.Amount = new List(Amount.DeepCopyInternal()); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = new List(_Amount.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -269,41 +264,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.ListEquals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "amount": - value = Amount; - return Amount?.Any() == true; + value = _Amount; + return _Amount?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "amount": - Amount = (List)value; + Amount = (List?)value!; return this; default: return base.SetValue(key, value); @@ -314,8 +309,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Amount?.Any() == true) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Amount?.Any() == true) yield return new KeyValuePair("amount",_Amount); } } @@ -340,13 +335,13 @@ public partial class CharacteristicComponent : Hl7.Fhir.Model.BackboneElement [Binding("PropertyCharacteristic")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The value of the characteristic. @@ -356,26 +351,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.FhirBoolean))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacteristicComponent; - - if (dest == null) - { + if(other is not CharacteristicComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -387,41 +378,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacteristicComponent; - if(otherT == null) return false; + if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -432,8 +423,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -459,13 +450,13 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// The identifier for the physical instance, typically a serial number or manufacturer number. @@ -475,39 +466,36 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The name for the specific product. /// [FhirElement("name", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name for the specific product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -517,28 +505,25 @@ public string Name /// [FhirElement("lotNumber", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString LotNumberElement + public Hl7.Fhir.Model.FhirString? LotNumberElement { get { return _LotNumberElement; } set { _LotNumberElement = value; OnPropertyChanged("LotNumberElement"); } } - private Hl7.Fhir.Model.FhirString _LotNumberElement; + private Hl7.Fhir.Model.FhirString? _LotNumberElement; /// /// The identification of the batch or lot of the product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LotNumber + public string? LotNumber { - get { return LotNumberElement != null ? LotNumberElement.Value : null; } + get => _LotNumberElement?.Value; set { - if (value == null) - LotNumberElement = null; - else - LotNumberElement = new Hl7.Fhir.Model.FhirString(value); + LotNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LotNumber"); } } @@ -548,28 +533,25 @@ public string LotNumber /// [FhirElement("expiry", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpiryElement + public Hl7.Fhir.Model.FhirDateTime? ExpiryElement { get { return _ExpiryElement; } set { _ExpiryElement = value; OnPropertyChanged("ExpiryElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpiryElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpiryElement; /// /// The expiry date or date and time for the product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expiry + public string? Expiry { - get { return ExpiryElement != null ? ExpiryElement.Value : null; } + get => _ExpiryElement?.Value; set { - if (value == null) - ExpiryElement = null; - else - ExpiryElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpiryElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Expiry"); } } @@ -579,28 +561,25 @@ public string Expiry /// [FhirElement("useBy", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime UseByElement + public Hl7.Fhir.Model.FhirDateTime? UseByElement { get { return _UseByElement; } set { _UseByElement = value; OnPropertyChanged("UseByElement"); } } - private Hl7.Fhir.Model.FhirDateTime _UseByElement; + private Hl7.Fhir.Model.FhirDateTime? _UseByElement; /// /// The date until which the product is expected to be good for consumption /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string UseBy + public string? UseBy { - get { return UseByElement != null ? UseByElement.Value : null; } + get => _UseByElement?.Value; set { - if (value == null) - UseByElement = null; - else - UseByElement = new Hl7.Fhir.Model.FhirDateTime(value); + UseByElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("UseBy"); } } @@ -610,31 +589,27 @@ public string UseBy /// [FhirElement("biologicalSourceEvent", Order=100)] [DataMember] - public Hl7.Fhir.Model.Identifier BiologicalSourceEvent + public Hl7.Fhir.Model.Identifier? BiologicalSourceEvent { get { return _BiologicalSourceEvent; } set { _BiologicalSourceEvent = value; OnPropertyChanged("BiologicalSourceEvent"); } } - private Hl7.Fhir.Model.Identifier _BiologicalSourceEvent; + private Hl7.Fhir.Model.Identifier? _BiologicalSourceEvent; protected internal override void CopyToInternal(Base other) { - var dest = other as InstanceComponent; - - if (dest == null) - { + if(other is not InstanceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(LotNumberElement != null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)LotNumberElement.DeepCopyInternal(); - if(ExpiryElement != null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)ExpiryElement.DeepCopyInternal(); - if(UseByElement != null) dest.UseByElement = (Hl7.Fhir.Model.FhirDateTime)UseByElement.DeepCopyInternal(); - if(BiologicalSourceEvent != null) dest.BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)BiologicalSourceEvent.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_LotNumberElement is not null) dest.LotNumberElement = (Hl7.Fhir.Model.FhirString)_LotNumberElement.DeepCopyInternal(); + if(_ExpiryElement is not null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)_ExpiryElement.DeepCopyInternal(); + if(_UseByElement is not null) dest.UseByElement = (Hl7.Fhir.Model.FhirDateTime)_UseByElement.DeepCopyInternal(); + if(_BiologicalSourceEvent is not null) dest.BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)_BiologicalSourceEvent.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -646,76 +621,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InstanceComponent; - if(otherT == null) return false; + if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(LotNumberElement, otherT.LotNumberElement)) return false; - if(!comparer.Equals(ExpiryElement, otherT.ExpiryElement)) return false; - if(!comparer.Equals(UseByElement, otherT.UseByElement)) return false; - if(!comparer.Equals(BiologicalSourceEvent, otherT.BiologicalSourceEvent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; + if(!comparer.Equals(_UseByElement, otherT._UseByElement)) return false; + if(!comparer.Equals(_BiologicalSourceEvent, otherT._BiologicalSourceEvent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "lotNumber": - value = LotNumberElement; - return LotNumberElement is not null; + value = _LotNumberElement; + return _LotNumberElement is not null; case "expiry": - value = ExpiryElement; - return ExpiryElement is not null; + value = _ExpiryElement; + return _ExpiryElement is not null; case "useBy": - value = UseByElement; - return UseByElement is not null; + value = _UseByElement; + return _UseByElement is not null; case "biologicalSourceEvent": - value = BiologicalSourceEvent; - return BiologicalSourceEvent is not null; + value = _BiologicalSourceEvent; + return _BiologicalSourceEvent is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "lotNumber": - LotNumberElement = (Hl7.Fhir.Model.FhirString)value; + LotNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expiry": - ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpiryElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "useBy": - UseByElement = (Hl7.Fhir.Model.FhirDateTime)value; + UseByElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "biologicalSourceEvent": - BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier)value; + BiologicalSourceEvent = (Hl7.Fhir.Model.Identifier?)value; return this; default: return base.SetValue(key, value); @@ -726,13 +701,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (LotNumberElement is not null) yield return new KeyValuePair("lotNumber",LotNumberElement); - if (ExpiryElement is not null) yield return new KeyValuePair("expiry",ExpiryElement); - if (UseByElement is not null) yield return new KeyValuePair("useBy",UseByElement); - if (BiologicalSourceEvent is not null) yield return new KeyValuePair("biologicalSourceEvent",BiologicalSourceEvent); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_LotNumberElement is not null) yield return new KeyValuePair("lotNumber",_LotNumberElement); + if (_ExpiryElement is not null) yield return new KeyValuePair("expiry",_ExpiryElement); + if (_UseByElement is not null) yield return new KeyValuePair("useBy",_UseByElement); + if (_BiologicalSourceEvent is not null) yield return new KeyValuePair("biologicalSourceEvent",_BiologicalSourceEvent); } } @@ -743,13 +718,13 @@ public override IEnumerable> EnumerateElements() [FhirElement("code", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Binding("NutritionProductCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// active | inactive | entered-in-error. @@ -759,13 +734,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [Binding("NutritionProductStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -774,13 +749,10 @@ public Code StatusElemen [IgnoreDataMember] public Hl7.Fhir.Model.NutritionProduct.NutritionProductStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -794,11 +766,11 @@ public Hl7.Fhir.Model.NutritionProduct.NutritionProductStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Manufacturer, representative or officially responsible for the product. @@ -810,11 +782,11 @@ public List Category [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// The product's nutritional information expressed by the nutrients. @@ -824,11 +796,11 @@ public List Manufacturer [DataMember] public List Nutrient { - get { if(_Nutrient==null) _Nutrient = new List(); return _Nutrient; } + get => _Nutrient ?? new List(); set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } - private List _Nutrient; + private List? _Nutrient; /// /// Ingredients contained in this product. @@ -838,11 +810,11 @@ public List Nutrient [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; /// /// Known or suspected allergens that are a part of this product. @@ -853,11 +825,11 @@ public List Ingredient [DataMember] public List KnownAllergen { - get { if(_KnownAllergen==null) _KnownAllergen = new List(); return _KnownAllergen; } + get => _KnownAllergen ?? new List(); set { _KnownAllergen = value; OnPropertyChanged("KnownAllergen"); } } - private List _KnownAllergen; + private List? _KnownAllergen; /// /// Specifies descriptive properties of the nutrition product. @@ -867,11 +839,11 @@ public List KnownAllergen [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// One or several physical instances or occurrences of the nutrition product. @@ -881,11 +853,11 @@ public List Characteris [DataMember] public List Instance { - get { if(_Instance==null) _Instance = new List(); return _Instance; } + get => _Instance ?? new List(); set { _Instance = value; OnPropertyChanged("Instance"); } } - private List _Instance; + private List? _Instance; /// /// Comments made about the product. @@ -895,32 +867,28 @@ public List Instance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as NutritionProduct; - - if (dest == null) - { + if(other is not NutritionProduct dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Nutrient.Any()) dest.Nutrient = new List(Nutrient.DeepCopyInternal()); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); - if(KnownAllergen.Any()) dest.KnownAllergen = new List(KnownAllergen.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Instance.Any()) dest.Instance = new List(Instance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Nutrient is not null) dest.Nutrient = new List(_Nutrient.DeepCopyInternal()); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); + if(_KnownAllergen is not null) dest.KnownAllergen = new List(_KnownAllergen.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Instance is not null) dest.Instance = new List(_Instance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -932,97 +900,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NutritionProduct; - if(otherT == null) return false; + if(other is not NutritionProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Nutrient, otherT.Nutrient)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; - if(!comparer.ListEquals(KnownAllergen, otherT.KnownAllergen)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Instance, otherT.Instance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; + if(!comparer.ListEquals(_KnownAllergen, otherT._KnownAllergen)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "nutrient": - value = Nutrient; - return Nutrient?.Any() == true; + value = _Nutrient; + return _Nutrient?.Any() == true; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; case "knownAllergen": - value = KnownAllergen; - return KnownAllergen?.Any() == true; + value = _KnownAllergen; + return _KnownAllergen?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "instance": - value = Instance; - return Instance?.Any() == true; + value = _Instance; + return _Instance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "nutrient": - Nutrient = (List)value; + Nutrient = (List?)value!; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; case "knownAllergen": - KnownAllergen = (List)value; + KnownAllergen = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "instance": - Instance = (List)value; + Instance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1033,16 +1001,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",Nutrient); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); - if (KnownAllergen?.Any() == true) yield return new KeyValuePair("knownAllergen",KnownAllergen); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Instance?.Any() == true) yield return new KeyValuePair("instance",Instance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Nutrient?.Any() == true) yield return new KeyValuePair("nutrient",_Nutrient); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); + if (_KnownAllergen?.Any() == true) yield return new KeyValuePair("knownAllergen",_KnownAllergen); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Instance?.Any() == true) yield return new KeyValuePair("instance",_Instance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Observation.cs b/src/Hl7.Fhir.R5/Model/Generated/Observation.cs index dc1eb6747..363eb6e1e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Observation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -112,13 +115,13 @@ public partial class TriggeredByComponent : Hl7.Fhir.Model.BackboneElement [References("Observation")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Observation + public Hl7.Fhir.Model.ResourceReference? Observation { get { return _Observation; } set { _Observation = value; OnPropertyChanged("Observation"); } } - private Hl7.Fhir.Model.ResourceReference _Observation; + private Hl7.Fhir.Model.ResourceReference? _Observation; /// /// reflex | repeat | re-run. @@ -128,13 +131,13 @@ public Hl7.Fhir.Model.ResourceReference Observation [Binding("TriggeredByType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// reflex | repeat | re-run @@ -143,13 +146,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Observation.TriggeredBytype? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -159,45 +159,38 @@ public Hl7.Fhir.Model.Observation.TriggeredBytype? Type /// [FhirElement("reason", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ReasonElement + public Hl7.Fhir.Model.FhirString? ReasonElement { get { return _ReasonElement; } set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private Hl7.Fhir.Model.FhirString _ReasonElement; + private Hl7.Fhir.Model.FhirString? _ReasonElement; /// /// Reason that the observation was triggered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reason + public string? Reason { - get { return ReasonElement != null ? ReasonElement.Value : null; } + get => _ReasonElement?.Value; set { - if (value == null) - ReasonElement = null; - else - ReasonElement = new Hl7.Fhir.Model.FhirString(value); + ReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Reason"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TriggeredByComponent; - - if (dest == null) - { + if(other is not TriggeredByComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Observation != null) dest.Observation = (Hl7.Fhir.Model.ResourceReference)Observation.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ReasonElement != null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)ReasonElement.DeepCopyInternal(); + if(_Observation is not null) dest.Observation = (Hl7.Fhir.Model.ResourceReference)_Observation.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ReasonElement is not null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)_ReasonElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -209,48 +202,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TriggeredByComponent; - if(otherT == null) return false; + if(other is not TriggeredByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Observation, otherT.Observation)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ReasonElement, otherT.ReasonElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Observation, otherT._Observation)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "observation": - value = Observation; - return Observation is not null; + value = _Observation; + return _Observation is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "reason": - value = ReasonElement; - return ReasonElement is not null; + value = _ReasonElement; + return _ReasonElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "observation": - Observation = (Hl7.Fhir.Model.ResourceReference)value; + Observation = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "reason": - ReasonElement = (Hl7.Fhir.Model.FhirString)value; + ReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -261,9 +254,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Observation is not null) yield return new KeyValuePair("observation",Observation); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ReasonElement is not null) yield return new KeyValuePair("reason",ReasonElement); + if (_Observation is not null) yield return new KeyValuePair("observation",_Observation); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ReasonElement is not null) yield return new KeyValuePair("reason",_ReasonElement); } } @@ -290,26 +283,26 @@ public partial class ReferenceRangeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("low", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Low + public Hl7.Fhir.Model.Quantity? Low { get { return _Low; } set { _Low = value; OnPropertyChanged("Low"); } } - private Hl7.Fhir.Model.Quantity _Low; + private Hl7.Fhir.Model.Quantity? _Low; /// /// High Range, if relevant. /// [FhirElement("high", Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity High + public Hl7.Fhir.Model.Quantity? High { get { return _High; } set { _High = value; OnPropertyChanged("High"); } } - private Hl7.Fhir.Model.Quantity _High; + private Hl7.Fhir.Model.Quantity? _High; /// /// Normal value, if relevant. @@ -317,13 +310,13 @@ public Hl7.Fhir.Model.Quantity High [FhirElement("normalValue", Order=60)] [Binding("ObservationReferenceRangeNormalValue")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept NormalValue + public Hl7.Fhir.Model.CodeableConcept? NormalValue { get { return _NormalValue; } set { _NormalValue = value; OnPropertyChanged("NormalValue"); } } - private Hl7.Fhir.Model.CodeableConcept _NormalValue; + private Hl7.Fhir.Model.CodeableConcept? _NormalValue; /// /// Reference range qualifier. @@ -331,13 +324,13 @@ public Hl7.Fhir.Model.CodeableConcept NormalValue [FhirElement("type", Order=70)] [Binding("ObservationRangeMeaning")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Reference range population. @@ -348,73 +341,66 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List AppliesTo { - get { if(_AppliesTo==null) _AppliesTo = new List(); return _AppliesTo; } + get => _AppliesTo ?? new List(); set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } - private List _AppliesTo; + private List? _AppliesTo; /// /// Applicable age range, if relevant. /// [FhirElement("age", Order=90)] [DataMember] - public Hl7.Fhir.Model.Range Age + public Hl7.Fhir.Model.Range? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.Range _Age; + private Hl7.Fhir.Model.Range? _Age; /// /// Text based reference range in an observation. /// [FhirElement("text", Order=100)] [DataMember] - public Hl7.Fhir.Model.Markdown TextElement + public Hl7.Fhir.Model.Markdown? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.Markdown _TextElement; + private Hl7.Fhir.Model.Markdown? _TextElement; /// /// Text based reference range in an observation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.Markdown(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferenceRangeComponent; - - if (dest == null) - { + if(other is not ReferenceRangeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Low != null) dest.Low = (Hl7.Fhir.Model.Quantity)Low.DeepCopyInternal(); - if(High != null) dest.High = (Hl7.Fhir.Model.Quantity)High.DeepCopyInternal(); - if(NormalValue != null) dest.NormalValue = (Hl7.Fhir.Model.CodeableConcept)NormalValue.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AppliesTo.Any()) dest.AppliesTo = new List(AppliesTo.DeepCopyInternal()); - if(Age != null) dest.Age = (Hl7.Fhir.Model.Range)Age.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.Markdown)TextElement.DeepCopyInternal(); + if(_Low is not null) dest.Low = (Hl7.Fhir.Model.Quantity)_Low.DeepCopyInternal(); + if(_High is not null) dest.High = (Hl7.Fhir.Model.Quantity)_High.DeepCopyInternal(); + if(_NormalValue is not null) dest.NormalValue = (Hl7.Fhir.Model.CodeableConcept)_NormalValue.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AppliesTo is not null) dest.AppliesTo = new List(_AppliesTo.DeepCopyInternal()); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.Range)_Age.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.Markdown)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -426,76 +412,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferenceRangeComponent; - if(otherT == null) return false; + if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Low, otherT.Low)) return false; - if(!comparer.Equals(High, otherT.High)) return false; - if(!comparer.Equals(NormalValue, otherT.NormalValue)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(AppliesTo, otherT.AppliesTo)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + if(!comparer.Equals(_High, otherT._High)) return false; + if(!comparer.Equals(_NormalValue, otherT._NormalValue)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "low": - value = Low; - return Low is not null; + value = _Low; + return _Low is not null; case "high": - value = High; - return High is not null; + value = _High; + return _High is not null; case "normalValue": - value = NormalValue; - return NormalValue is not null; + value = _NormalValue; + return _NormalValue is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "appliesTo": - value = AppliesTo; - return AppliesTo?.Any() == true; + value = _AppliesTo; + return _AppliesTo?.Any() == true; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "low": - Low = (Hl7.Fhir.Model.Quantity)value; + Low = (Hl7.Fhir.Model.Quantity?)value; return this; case "high": - High = (Hl7.Fhir.Model.Quantity)value; + High = (Hl7.Fhir.Model.Quantity?)value; return this; case "normalValue": - NormalValue = (Hl7.Fhir.Model.CodeableConcept)value; + NormalValue = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "appliesTo": - AppliesTo = (List)value; + AppliesTo = (List?)value!; return this; case "age": - Age = (Hl7.Fhir.Model.Range)value; + Age = (Hl7.Fhir.Model.Range?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.Markdown)value; + TextElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -506,13 +492,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Low is not null) yield return new KeyValuePair("low",Low); - if (High is not null) yield return new KeyValuePair("high",High); - if (NormalValue is not null) yield return new KeyValuePair("normalValue",NormalValue); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",AppliesTo); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_Low is not null) yield return new KeyValuePair("low",_Low); + if (_High is not null) yield return new KeyValuePair("high",_High); + if (_NormalValue is not null) yield return new KeyValuePair("normalValue",_NormalValue); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",_AppliesTo); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -541,13 +527,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Actual component result. @@ -557,13 +543,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("MolecularSequence")] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the component result is missing. @@ -571,13 +557,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=60)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -588,11 +574,11 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [DataMember] public List Interpretation { - get { if(_Interpretation==null) _Interpretation = new List(); return _Interpretation; } + get => _Interpretation ?? new List(); set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private List _Interpretation; + private List? _Interpretation; /// /// Provides guide for interpretation of component result. @@ -602,27 +588,23 @@ public List Interpretation [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation.Any()) dest.Interpretation = new List(Interpretation.DeepCopyInternal()); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = new List(_Interpretation.DeepCopyInternal()); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -634,62 +616,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.ListEquals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation?.Any() == true; + value = _Interpretation; + return _Interpretation?.Any() == true; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (List)value; + Interpretation = (List?)value!; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; default: return base.SetValue(key, value); @@ -700,11 +682,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",Interpretation); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",_Interpretation); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); } } @@ -717,11 +699,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR ObservationDefinition. @@ -731,13 +713,13 @@ public List Identifier [References("ObservationDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Instantiates + public Hl7.Fhir.Model.DataType? Instantiates { get { return _Instantiates; } set { _Instantiates = value; OnPropertyChanged("Instantiates"); } } - private Hl7.Fhir.Model.DataType _Instantiates; + private Hl7.Fhir.Model.DataType? _Instantiates; /// /// Fulfills plan, proposal or order. @@ -749,11 +731,11 @@ public Hl7.Fhir.Model.DataType Instantiates [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Triggering observation(s). @@ -763,11 +745,11 @@ public List BasedOn [DataMember] public List TriggeredBy { - get { if(_TriggeredBy==null) _TriggeredBy = new List(); return _TriggeredBy; } + get => _TriggeredBy ?? new List(); set { _TriggeredBy = value; OnPropertyChanged("TriggeredBy"); } } - private List _TriggeredBy; + private List? _TriggeredBy; /// /// Part of referenced event. @@ -779,11 +761,11 @@ public List TriggeredBy [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// registered | preliminary | final | amended +. @@ -793,13 +775,13 @@ public List PartOf [Binding("ObservationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -808,13 +790,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -828,11 +807,11 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of observation (code / type). @@ -841,13 +820,13 @@ public List Category [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who and/or what the observation is about. @@ -856,13 +835,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("Patient","Group","Device","Location","Organization","Procedure","Practitioner","Medication","Substance","BiologicallyDerivedProduct","NutritionProduct")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// What the observation is about, when it is not about the subject of record. @@ -874,11 +853,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Healthcare event during which this observation is made. @@ -887,13 +866,13 @@ public List Focus [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Clinically relevant time/time-period for observation. @@ -902,26 +881,26 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.Instant))] [DataMember] - public Hl7.Fhir.Model.DataType Effective + public Hl7.Fhir.Model.DataType? Effective { get { return _Effective; } set { _Effective = value; OnPropertyChanged("Effective"); } } - private Hl7.Fhir.Model.DataType _Effective; + private Hl7.Fhir.Model.DataType? _Effective; /// /// Date/Time this version was made available. /// [FhirElement("issued", InSummary=true, Order=210, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant IssuedElement + public Hl7.Fhir.Model.Instant? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.Instant _IssuedElement; + private Hl7.Fhir.Model.Instant? _IssuedElement; /// /// Date/Time this version was made available @@ -930,13 +909,10 @@ public Hl7.Fhir.Model.Instant IssuedElement [IgnoreDataMember] public DateTimeOffset? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.Instant(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Issued"); } } @@ -951,11 +927,11 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Actual result. @@ -965,13 +941,13 @@ public List Performer [References("MolecularSequence")] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Why the result is missing. @@ -979,13 +955,13 @@ public Hl7.Fhir.Model.DataType Value [FhirElement("dataAbsentReason", Order=240)] [Binding("ObservationValueAbsentReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DataAbsentReason + public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason { get { return _DataAbsentReason; } set { _DataAbsentReason = value; OnPropertyChanged("DataAbsentReason"); } } - private Hl7.Fhir.Model.CodeableConcept _DataAbsentReason; + private Hl7.Fhir.Model.CodeableConcept? _DataAbsentReason; /// /// High, low, normal, etc. @@ -996,11 +972,11 @@ public Hl7.Fhir.Model.CodeableConcept DataAbsentReason [DataMember] public List Interpretation { - get { if(_Interpretation==null) _Interpretation = new List(); return _Interpretation; } + get => _Interpretation ?? new List(); set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } - private List _Interpretation; + private List? _Interpretation; /// /// Comments about the observation. @@ -1010,11 +986,11 @@ public List Interpretation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Observed body part. @@ -1022,13 +998,13 @@ public List Note [FhirElement("bodySite", Order=270)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Observed body structure. @@ -1037,13 +1013,13 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [CLSCompliant(false)] [References("BodyStructure")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BodyStructure + public Hl7.Fhir.Model.ResourceReference? BodyStructure { get { return _BodyStructure; } set { _BodyStructure = value; OnPropertyChanged("BodyStructure"); } } - private Hl7.Fhir.Model.ResourceReference _BodyStructure; + private Hl7.Fhir.Model.ResourceReference? _BodyStructure; /// /// How it was done. @@ -1051,13 +1027,13 @@ public Hl7.Fhir.Model.ResourceReference BodyStructure [FhirElement("method", Order=290)] [Binding("ObservationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Specimen used for this observation. @@ -1066,13 +1042,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [CLSCompliant(false)] [References("Specimen","Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Specimen + public Hl7.Fhir.Model.ResourceReference? Specimen { get { return _Specimen; } set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private Hl7.Fhir.Model.ResourceReference _Specimen; + private Hl7.Fhir.Model.ResourceReference? _Specimen; /// /// A reference to the device that generates the measurements or the device settings for the device. @@ -1081,13 +1057,13 @@ public Hl7.Fhir.Model.ResourceReference Specimen [CLSCompliant(false)] [References("Device","DeviceMetric")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Provides guide for interpretation. @@ -1097,11 +1073,11 @@ public Hl7.Fhir.Model.ResourceReference Device [DataMember] public List ReferenceRange { - get { if(_ReferenceRange==null) _ReferenceRange = new List(); return _ReferenceRange; } + get => _ReferenceRange ?? new List(); set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } - private List _ReferenceRange; + private List? _ReferenceRange; /// /// Related resource that belongs to the Observation group. @@ -1113,11 +1089,11 @@ public List ReferenceRange [DataMember] public List HasMember { - get { if(_HasMember==null) _HasMember = new List(); return _HasMember; } + get => _HasMember ?? new List(); set { _HasMember = value; OnPropertyChanged("HasMember"); } } - private List _HasMember; + private List? _HasMember; /// /// Related resource from which the observation is made. @@ -1129,11 +1105,11 @@ public List HasMember [DataMember] public List DerivedFrom { - get { if(_DerivedFrom==null) _DerivedFrom = new List(); return _DerivedFrom; } + get => _DerivedFrom ?? new List(); set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } - private List _DerivedFrom; + private List? _DerivedFrom; /// /// Component results. @@ -1143,51 +1119,47 @@ public List DerivedFrom [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Observation; - - if (dest == null) - { + if(other is not Observation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Instantiates != null) dest.Instantiates = (Hl7.Fhir.Model.DataType)Instantiates.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(TriggeredBy.Any()) dest.TriggeredBy = new List(TriggeredBy.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Effective != null) dest.Effective = (Hl7.Fhir.Model.DataType)Effective.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(DataAbsentReason != null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopyInternal(); - if(Interpretation.Any()) dest.Interpretation = new List(Interpretation.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(BodyStructure != null) dest.BodyStructure = (Hl7.Fhir.Model.ResourceReference)BodyStructure.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Specimen != null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(ReferenceRange.Any()) dest.ReferenceRange = new List(ReferenceRange.DeepCopyInternal()); - if(HasMember.Any()) dest.HasMember = new List(HasMember.DeepCopyInternal()); - if(DerivedFrom.Any()) dest.DerivedFrom = new List(DerivedFrom.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Instantiates is not null) dest.Instantiates = (Hl7.Fhir.Model.DataType)_Instantiates.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_TriggeredBy is not null) dest.TriggeredBy = new List(_TriggeredBy.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Effective is not null) dest.Effective = (Hl7.Fhir.Model.DataType)_Effective.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.Instant)_IssuedElement.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_DataAbsentReason is not null) dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)_DataAbsentReason.DeepCopyInternal(); + if(_Interpretation is not null) dest.Interpretation = new List(_Interpretation.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_BodyStructure is not null) dest.BodyStructure = (Hl7.Fhir.Model.ResourceReference)_BodyStructure.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = (Hl7.Fhir.Model.ResourceReference)_Specimen.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_ReferenceRange is not null) dest.ReferenceRange = new List(_ReferenceRange.DeepCopyInternal()); + if(_HasMember is not null) dest.HasMember = new List(_HasMember.DeepCopyInternal()); + if(_DerivedFrom is not null) dest.DerivedFrom = new List(_DerivedFrom.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1199,216 +1171,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Observation; - if(otherT == null) return false; + if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Instantiates, otherT.Instantiates)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(TriggeredBy, otherT.TriggeredBy)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Effective, otherT.Effective)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(DataAbsentReason, otherT.DataAbsentReason)) return false; - if(!comparer.ListEquals(Interpretation, otherT.Interpretation)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(BodyStructure, otherT.BodyStructure)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Specimen, otherT.Specimen)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.ListEquals(ReferenceRange, otherT.ReferenceRange)) return false; - if(!comparer.ListEquals(HasMember, otherT.HasMember)) return false; - if(!comparer.ListEquals(DerivedFrom, otherT.DerivedFrom)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Instantiates, otherT._Instantiates)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_TriggeredBy, otherT._TriggeredBy)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Effective, otherT._Effective)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; + if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_BodyStructure, otherT._BodyStructure)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Specimen, otherT._Specimen)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; + if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; + if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiates": - value = Instantiates; - return Instantiates is not null; + value = _Instantiates; + return _Instantiates is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "triggeredBy": - value = TriggeredBy; - return TriggeredBy?.Any() == true; + value = _TriggeredBy; + return _TriggeredBy?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "effective": - value = Effective; - return Effective is not null; + value = _Effective; + return _Effective is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "dataAbsentReason": - value = DataAbsentReason; - return DataAbsentReason is not null; + value = _DataAbsentReason; + return _DataAbsentReason is not null; case "interpretation": - value = Interpretation; - return Interpretation?.Any() == true; + value = _Interpretation; + return _Interpretation?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "bodyStructure": - value = BodyStructure; - return BodyStructure is not null; + value = _BodyStructure; + return _BodyStructure is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "specimen": - value = Specimen; - return Specimen is not null; + value = _Specimen; + return _Specimen is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "referenceRange": - value = ReferenceRange; - return ReferenceRange?.Any() == true; + value = _ReferenceRange; + return _ReferenceRange?.Any() == true; case "hasMember": - value = HasMember; - return HasMember?.Any() == true; + value = _HasMember; + return _HasMember?.Any() == true; case "derivedFrom": - value = DerivedFrom; - return DerivedFrom?.Any() == true; + value = _DerivedFrom; + return _DerivedFrom?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiates": - Instantiates = (Hl7.Fhir.Model.DataType)value; + Instantiates = (Hl7.Fhir.Model.DataType?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "triggeredBy": - TriggeredBy = (List)value; + TriggeredBy = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "effective": - Effective = (Hl7.Fhir.Model.DataType)value; + Effective = (Hl7.Fhir.Model.DataType?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.Instant)value; + IssuedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "dataAbsentReason": - DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)value; + DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interpretation": - Interpretation = (List)value; + Interpretation = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "bodyStructure": - BodyStructure = (Hl7.Fhir.Model.ResourceReference)value; + BodyStructure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specimen": - Specimen = (Hl7.Fhir.Model.ResourceReference)value; + Specimen = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "referenceRange": - ReferenceRange = (List)value; + ReferenceRange = (List?)value!; return this; case "hasMember": - HasMember = (List)value; + HasMember = (List?)value!; return this; case "derivedFrom": - DerivedFrom = (List)value; + DerivedFrom = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1419,33 +1391,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Instantiates is not null) yield return new KeyValuePair("instantiates",Instantiates); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (TriggeredBy?.Any() == true) yield return new KeyValuePair("triggeredBy",TriggeredBy); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Effective is not null) yield return new KeyValuePair("effective",Effective); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Value is not null) yield return new KeyValuePair("value",Value); - if (DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",DataAbsentReason); - if (Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",Interpretation); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (BodyStructure is not null) yield return new KeyValuePair("bodyStructure",BodyStructure); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Specimen is not null) yield return new KeyValuePair("specimen",Specimen); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",ReferenceRange); - if (HasMember?.Any() == true) yield return new KeyValuePair("hasMember",HasMember); - if (DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFrom); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Instantiates is not null) yield return new KeyValuePair("instantiates",_Instantiates); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_TriggeredBy?.Any() == true) yield return new KeyValuePair("triggeredBy",_TriggeredBy); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Effective is not null) yield return new KeyValuePair("effective",_Effective); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_DataAbsentReason is not null) yield return new KeyValuePair("dataAbsentReason",_DataAbsentReason); + if (_Interpretation?.Any() == true) yield return new KeyValuePair("interpretation",_Interpretation); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_BodyStructure is not null) yield return new KeyValuePair("bodyStructure",_BodyStructure); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Specimen is not null) yield return new KeyValuePair("specimen",_Specimen); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_ReferenceRange?.Any() == true) yield return new KeyValuePair("referenceRange",_ReferenceRange); + if (_HasMember?.Any() == true) yield return new KeyValuePair("hasMember",_HasMember); + if (_DerivedFrom?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFrom); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs index 60baf25f4..18366b6cf 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -53,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ObservationDefinition","http://hl7.org/fhir/StructureDefinition/ObservationDefinition")] - public partial class ObservationDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ObservationDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -186,13 +189,13 @@ public partial class QualifiedValueComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("context", Order=40)] [Binding("ObservationRangeMeaning")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Context + public Hl7.Fhir.Model.CodeableConcept? Context { get { return _Context; } set { _Context = value; OnPropertyChanged("Context"); } } - private Hl7.Fhir.Model.CodeableConcept _Context; + private Hl7.Fhir.Model.CodeableConcept? _Context; /// /// Targetted population for the set of qualified values. @@ -203,11 +206,11 @@ public Hl7.Fhir.Model.CodeableConcept Context [DataMember] public List AppliesTo { - get { if(_AppliesTo==null) _AppliesTo = new List(); return _AppliesTo; } + get => _AppliesTo ?? new List(); set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } - private List _AppliesTo; + private List? _AppliesTo; /// /// male | female | other | unknown. @@ -216,13 +219,13 @@ public List AppliesTo [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -231,13 +234,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -247,54 +247,51 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("age", Order=70)] [DataMember] - public Hl7.Fhir.Model.Range Age + public Hl7.Fhir.Model.Range? Age { get { return _Age; } set { _Age = value; OnPropertyChanged("Age"); } } - private Hl7.Fhir.Model.Range _Age; + private Hl7.Fhir.Model.Range? _Age; /// /// Applicable gestational age range for the set of qualified values. /// [FhirElement("gestationalAge", Order=80)] [DataMember] - public Hl7.Fhir.Model.Range GestationalAge + public Hl7.Fhir.Model.Range? GestationalAge { get { return _GestationalAge; } set { _GestationalAge = value; OnPropertyChanged("GestationalAge"); } } - private Hl7.Fhir.Model.Range _GestationalAge; + private Hl7.Fhir.Model.Range? _GestationalAge; /// /// Condition associated with the set of qualified values. /// [FhirElement("condition", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// Condition associated with the set of qualified values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -306,13 +303,13 @@ public string Condition [DeclaredType(Type = typeof(Code))] [Binding("ObservationRangeCategory")] [DataMember] - public Code RangeCategoryElement + public Code? RangeCategoryElement { get { return _RangeCategoryElement; } set { _RangeCategoryElement = value; OnPropertyChanged("RangeCategoryElement"); } } - private Code _RangeCategoryElement; + private Code? _RangeCategoryElement; /// /// reference | critical | absolute @@ -321,13 +318,10 @@ public Code Range [IgnoreDataMember] public Hl7.Fhir.Model.ObservationDefinition.ObservationRangeCategory? RangeCategory { - get { return RangeCategoryElement != null ? RangeCategoryElement.Value : null; } + get => _RangeCategoryElement?.Value; set { - if (value == null) - RangeCategoryElement = null; - else - RangeCategoryElement = new Code(value); + RangeCategoryElement = value is null ? null : new Code(value); OnPropertyChanged("RangeCategory"); } } @@ -337,41 +331,38 @@ public Hl7.Fhir.Model.ObservationDefinition.ObservationRangeCategory? RangeCateg /// [FhirElement("range", Order=110)] [DataMember] - public Hl7.Fhir.Model.Range Range + public Hl7.Fhir.Model.Range? Range { get { return _Range; } set { _Range = value; OnPropertyChanged("Range"); } } - private Hl7.Fhir.Model.Range _Range; + private Hl7.Fhir.Model.Range? _Range; /// /// Value set of valid coded values as part of this set of qualified values. /// [FhirElement("validCodedValueSet", Order=120)] [DataMember] - public Hl7.Fhir.Model.Canonical ValidCodedValueSetElement + public Hl7.Fhir.Model.Canonical? ValidCodedValueSetElement { get { return _ValidCodedValueSetElement; } set { _ValidCodedValueSetElement = value; OnPropertyChanged("ValidCodedValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValidCodedValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValidCodedValueSetElement; /// /// Value set of valid coded values as part of this set of qualified values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidCodedValueSet + public string? ValidCodedValueSet { - get { return ValidCodedValueSetElement != null ? ValidCodedValueSetElement.Value : null; } + get => _ValidCodedValueSetElement?.Value; set { - if (value == null) - ValidCodedValueSetElement = null; - else - ValidCodedValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValidCodedValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValidCodedValueSet"); } } @@ -381,28 +372,25 @@ public string ValidCodedValueSet /// [FhirElement("normalCodedValueSet", Order=130)] [DataMember] - public Hl7.Fhir.Model.Canonical NormalCodedValueSetElement + public Hl7.Fhir.Model.Canonical? NormalCodedValueSetElement { get { return _NormalCodedValueSetElement; } set { _NormalCodedValueSetElement = value; OnPropertyChanged("NormalCodedValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _NormalCodedValueSetElement; + private Hl7.Fhir.Model.Canonical? _NormalCodedValueSetElement; /// /// Value set of normal coded values as part of this set of qualified values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string NormalCodedValueSet + public string? NormalCodedValueSet { - get { return NormalCodedValueSetElement != null ? NormalCodedValueSetElement.Value : null; } + get => _NormalCodedValueSetElement?.Value; set { - if (value == null) - NormalCodedValueSetElement = null; - else - NormalCodedValueSetElement = new Hl7.Fhir.Model.Canonical(value); + NormalCodedValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("NormalCodedValueSet"); } } @@ -412,28 +400,25 @@ public string NormalCodedValueSet /// [FhirElement("abnormalCodedValueSet", Order=140)] [DataMember] - public Hl7.Fhir.Model.Canonical AbnormalCodedValueSetElement + public Hl7.Fhir.Model.Canonical? AbnormalCodedValueSetElement { get { return _AbnormalCodedValueSetElement; } set { _AbnormalCodedValueSetElement = value; OnPropertyChanged("AbnormalCodedValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _AbnormalCodedValueSetElement; + private Hl7.Fhir.Model.Canonical? _AbnormalCodedValueSetElement; /// /// Value set of abnormal coded values as part of this set of qualified values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AbnormalCodedValueSet + public string? AbnormalCodedValueSet { - get { return AbnormalCodedValueSetElement != null ? AbnormalCodedValueSetElement.Value : null; } + get => _AbnormalCodedValueSetElement?.Value; set { - if (value == null) - AbnormalCodedValueSetElement = null; - else - AbnormalCodedValueSetElement = new Hl7.Fhir.Model.Canonical(value); + AbnormalCodedValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("AbnormalCodedValueSet"); } } @@ -443,54 +428,47 @@ public string AbnormalCodedValueSet /// [FhirElement("criticalCodedValueSet", Order=150)] [DataMember] - public Hl7.Fhir.Model.Canonical CriticalCodedValueSetElement + public Hl7.Fhir.Model.Canonical? CriticalCodedValueSetElement { get { return _CriticalCodedValueSetElement; } set { _CriticalCodedValueSetElement = value; OnPropertyChanged("CriticalCodedValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _CriticalCodedValueSetElement; + private Hl7.Fhir.Model.Canonical? _CriticalCodedValueSetElement; /// /// Value set of critical coded values as part of this set of qualified values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CriticalCodedValueSet + public string? CriticalCodedValueSet { - get { return CriticalCodedValueSetElement != null ? CriticalCodedValueSetElement.Value : null; } + get => _CriticalCodedValueSetElement?.Value; set { - if (value == null) - CriticalCodedValueSetElement = null; - else - CriticalCodedValueSetElement = new Hl7.Fhir.Model.Canonical(value); + CriticalCodedValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("CriticalCodedValueSet"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QualifiedValueComponent; - - if (dest == null) - { + if(other is not QualifiedValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Context != null) dest.Context = (Hl7.Fhir.Model.CodeableConcept)Context.DeepCopyInternal(); - if(AppliesTo.Any()) dest.AppliesTo = new List(AppliesTo.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Age != null) dest.Age = (Hl7.Fhir.Model.Range)Age.DeepCopyInternal(); - if(GestationalAge != null) dest.GestationalAge = (Hl7.Fhir.Model.Range)GestationalAge.DeepCopyInternal(); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(RangeCategoryElement != null) dest.RangeCategoryElement = (Code)RangeCategoryElement.DeepCopyInternal(); - if(Range != null) dest.Range = (Hl7.Fhir.Model.Range)Range.DeepCopyInternal(); - if(ValidCodedValueSetElement != null) dest.ValidCodedValueSetElement = (Hl7.Fhir.Model.Canonical)ValidCodedValueSetElement.DeepCopyInternal(); - if(NormalCodedValueSetElement != null) dest.NormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)NormalCodedValueSetElement.DeepCopyInternal(); - if(AbnormalCodedValueSetElement != null) dest.AbnormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)AbnormalCodedValueSetElement.DeepCopyInternal(); - if(CriticalCodedValueSetElement != null) dest.CriticalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)CriticalCodedValueSetElement.DeepCopyInternal(); + if(_Context is not null) dest.Context = (Hl7.Fhir.Model.CodeableConcept)_Context.DeepCopyInternal(); + if(_AppliesTo is not null) dest.AppliesTo = new List(_AppliesTo.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Age is not null) dest.Age = (Hl7.Fhir.Model.Range)_Age.DeepCopyInternal(); + if(_GestationalAge is not null) dest.GestationalAge = (Hl7.Fhir.Model.Range)_GestationalAge.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_RangeCategoryElement is not null) dest.RangeCategoryElement = (Code)_RangeCategoryElement.DeepCopyInternal(); + if(_Range is not null) dest.Range = (Hl7.Fhir.Model.Range)_Range.DeepCopyInternal(); + if(_ValidCodedValueSetElement is not null) dest.ValidCodedValueSetElement = (Hl7.Fhir.Model.Canonical)_ValidCodedValueSetElement.DeepCopyInternal(); + if(_NormalCodedValueSetElement is not null) dest.NormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)_NormalCodedValueSetElement.DeepCopyInternal(); + if(_AbnormalCodedValueSetElement is not null) dest.AbnormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)_AbnormalCodedValueSetElement.DeepCopyInternal(); + if(_CriticalCodedValueSetElement is not null) dest.CriticalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)_CriticalCodedValueSetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -502,111 +480,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualifiedValueComponent; - if(otherT == null) return false; + if(other is not QualifiedValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Context, otherT.Context)) return false; - if(!comparer.ListEquals(AppliesTo, otherT.AppliesTo)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Age, otherT.Age)) return false; - if(!comparer.Equals(GestationalAge, otherT.GestationalAge)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.Equals(RangeCategoryElement, otherT.RangeCategoryElement)) return false; - if(!comparer.Equals(Range, otherT.Range)) return false; - if(!comparer.Equals(ValidCodedValueSetElement, otherT.ValidCodedValueSetElement)) return false; - if(!comparer.Equals(NormalCodedValueSetElement, otherT.NormalCodedValueSetElement)) return false; - if(!comparer.Equals(AbnormalCodedValueSetElement, otherT.AbnormalCodedValueSetElement)) return false; - if(!comparer.Equals(CriticalCodedValueSetElement, otherT.CriticalCodedValueSetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Context, otherT._Context)) return false; + if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Age, otherT._Age)) return false; + if(!comparer.Equals(_GestationalAge, otherT._GestationalAge)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.Equals(_RangeCategoryElement, otherT._RangeCategoryElement)) return false; + if(!comparer.Equals(_Range, otherT._Range)) return false; + if(!comparer.Equals(_ValidCodedValueSetElement, otherT._ValidCodedValueSetElement)) return false; + if(!comparer.Equals(_NormalCodedValueSetElement, otherT._NormalCodedValueSetElement)) return false; + if(!comparer.Equals(_AbnormalCodedValueSetElement, otherT._AbnormalCodedValueSetElement)) return false; + if(!comparer.Equals(_CriticalCodedValueSetElement, otherT._CriticalCodedValueSetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = Context; - return Context is not null; + value = _Context; + return _Context is not null; case "appliesTo": - value = AppliesTo; - return AppliesTo?.Any() == true; + value = _AppliesTo; + return _AppliesTo?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "age": - value = Age; - return Age is not null; + value = _Age; + return _Age is not null; case "gestationalAge": - value = GestationalAge; - return GestationalAge is not null; + value = _GestationalAge; + return _GestationalAge is not null; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "rangeCategory": - value = RangeCategoryElement; - return RangeCategoryElement is not null; + value = _RangeCategoryElement; + return _RangeCategoryElement is not null; case "range": - value = Range; - return Range is not null; + value = _Range; + return _Range is not null; case "validCodedValueSet": - value = ValidCodedValueSetElement; - return ValidCodedValueSetElement is not null; + value = _ValidCodedValueSetElement; + return _ValidCodedValueSetElement is not null; case "normalCodedValueSet": - value = NormalCodedValueSetElement; - return NormalCodedValueSetElement is not null; + value = _NormalCodedValueSetElement; + return _NormalCodedValueSetElement is not null; case "abnormalCodedValueSet": - value = AbnormalCodedValueSetElement; - return AbnormalCodedValueSetElement is not null; + value = _AbnormalCodedValueSetElement; + return _AbnormalCodedValueSetElement is not null; case "criticalCodedValueSet": - value = CriticalCodedValueSetElement; - return CriticalCodedValueSetElement is not null; + value = _CriticalCodedValueSetElement; + return _CriticalCodedValueSetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - Context = (Hl7.Fhir.Model.CodeableConcept)value; + Context = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "appliesTo": - AppliesTo = (List)value; + AppliesTo = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "age": - Age = (Hl7.Fhir.Model.Range)value; + Age = (Hl7.Fhir.Model.Range?)value; return this; case "gestationalAge": - GestationalAge = (Hl7.Fhir.Model.Range)value; + GestationalAge = (Hl7.Fhir.Model.Range?)value; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "rangeCategory": - RangeCategoryElement = (Code)value; + RangeCategoryElement = (Code?)value; return this; case "range": - Range = (Hl7.Fhir.Model.Range)value; + Range = (Hl7.Fhir.Model.Range?)value; return this; case "validCodedValueSet": - ValidCodedValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValidCodedValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "normalCodedValueSet": - NormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)value; + NormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "abnormalCodedValueSet": - AbnormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)value; + AbnormalCodedValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "criticalCodedValueSet": - CriticalCodedValueSetElement = (Hl7.Fhir.Model.Canonical)value; + CriticalCodedValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -617,18 +595,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Context is not null) yield return new KeyValuePair("context",Context); - if (AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",AppliesTo); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Age is not null) yield return new KeyValuePair("age",Age); - if (GestationalAge is not null) yield return new KeyValuePair("gestationalAge",GestationalAge); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (RangeCategoryElement is not null) yield return new KeyValuePair("rangeCategory",RangeCategoryElement); - if (Range is not null) yield return new KeyValuePair("range",Range); - if (ValidCodedValueSetElement is not null) yield return new KeyValuePair("validCodedValueSet",ValidCodedValueSetElement); - if (NormalCodedValueSetElement is not null) yield return new KeyValuePair("normalCodedValueSet",NormalCodedValueSetElement); - if (AbnormalCodedValueSetElement is not null) yield return new KeyValuePair("abnormalCodedValueSet",AbnormalCodedValueSetElement); - if (CriticalCodedValueSetElement is not null) yield return new KeyValuePair("criticalCodedValueSet",CriticalCodedValueSetElement); + if (_Context is not null) yield return new KeyValuePair("context",_Context); + if (_AppliesTo?.Any() == true) yield return new KeyValuePair("appliesTo",_AppliesTo); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Age is not null) yield return new KeyValuePair("age",_Age); + if (_GestationalAge is not null) yield return new KeyValuePair("gestationalAge",_GestationalAge); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_RangeCategoryElement is not null) yield return new KeyValuePair("rangeCategory",_RangeCategoryElement); + if (_Range is not null) yield return new KeyValuePair("range",_Range); + if (_ValidCodedValueSetElement is not null) yield return new KeyValuePair("validCodedValueSet",_ValidCodedValueSetElement); + if (_NormalCodedValueSetElement is not null) yield return new KeyValuePair("normalCodedValueSet",_NormalCodedValueSetElement); + if (_AbnormalCodedValueSetElement is not null) yield return new KeyValuePair("abnormalCodedValueSet",_AbnormalCodedValueSetElement); + if (_CriticalCodedValueSetElement is not null) yield return new KeyValuePair("criticalCodedValueSet",_CriticalCodedValueSetElement); } } @@ -656,13 +634,13 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period. @@ -674,24 +652,24 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List> PermittedDataTypeElement { - get { if(_PermittedDataTypeElement==null) _PermittedDataTypeElement = new List>(); return _PermittedDataTypeElement; } + get => _PermittedDataTypeElement ?? new List>(); set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } - private List> _PermittedDataTypeElement; + private List>? _PermittedDataTypeElement; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PermittedDataType + public IEnumerable? PermittedDataType { - get { return PermittedDataTypeElement != null ? PermittedDataTypeElement.Select(elem => elem.Value) : null; } + get => _PermittedDataTypeElement?.Select(elem => elem.Value); set { if (value == null) - PermittedDataTypeElement = null; + PermittedDataTypeElement = null!; else PermittedDataTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("PermittedDataType"); @@ -707,11 +685,11 @@ public IEnumerable Pe [DataMember] public List PermittedUnit { - get { if(_PermittedUnit==null) _PermittedUnit = new List(); return _PermittedUnit; } + get => _PermittedUnit ?? new List(); set { _PermittedUnit = value; OnPropertyChanged("PermittedUnit"); } } - private List _PermittedUnit; + private List? _PermittedUnit; /// /// Set of qualified values for observation results. @@ -721,26 +699,22 @@ public List PermittedUnit [DataMember] public List QualifiedValue { - get { if(_QualifiedValue==null) _QualifiedValue = new List(); return _QualifiedValue; } + get => _QualifiedValue ?? new List(); set { _QualifiedValue = value; OnPropertyChanged("QualifiedValue"); } } - private List _QualifiedValue; + private List? _QualifiedValue; protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(PermittedDataTypeElement.Any()) dest.PermittedDataTypeElement = new List>(PermittedDataTypeElement.DeepCopyInternal()); - if(PermittedUnit.Any()) dest.PermittedUnit = new List(PermittedUnit.DeepCopyInternal()); - if(QualifiedValue.Any()) dest.QualifiedValue = new List(QualifiedValue.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_PermittedDataTypeElement is not null) dest.PermittedDataTypeElement = new List>(_PermittedDataTypeElement.DeepCopyInternal()); + if(_PermittedUnit is not null) dest.PermittedUnit = new List(_PermittedUnit.DeepCopyInternal()); + if(_QualifiedValue is not null) dest.QualifiedValue = new List(_QualifiedValue.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -752,55 +726,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(PermittedDataTypeElement, otherT.PermittedDataTypeElement)) return false; - if(!comparer.ListEquals(PermittedUnit, otherT.PermittedUnit)) return false; - if(!comparer.ListEquals(QualifiedValue, otherT.QualifiedValue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_PermittedDataTypeElement, otherT._PermittedDataTypeElement)) return false; + if(!comparer.ListEquals(_PermittedUnit, otherT._PermittedUnit)) return false; + if(!comparer.ListEquals(_QualifiedValue, otherT._QualifiedValue)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "permittedDataType": - value = PermittedDataTypeElement; - return PermittedDataTypeElement?.Any() == true; + value = _PermittedDataTypeElement; + return _PermittedDataTypeElement?.Any() == true; case "permittedUnit": - value = PermittedUnit; - return PermittedUnit?.Any() == true; + value = _PermittedUnit; + return _PermittedUnit?.Any() == true; case "qualifiedValue": - value = QualifiedValue; - return QualifiedValue?.Any() == true; + value = _QualifiedValue; + return _QualifiedValue?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "permittedDataType": - PermittedDataTypeElement = (List>)value; + PermittedDataTypeElement = (List>?)value!; return this; case "permittedUnit": - PermittedUnit = (List)value; + PermittedUnit = (List?)value!; return this; case "qualifiedValue": - QualifiedValue = (List)value; + QualifiedValue = (List?)value!; return this; default: return base.SetValue(key, value); @@ -811,10 +785,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",PermittedDataTypeElement); - if (PermittedUnit?.Any() == true) yield return new KeyValuePair("permittedUnit",PermittedUnit); - if (QualifiedValue?.Any() == true) yield return new KeyValuePair("qualifiedValue",QualifiedValue); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",_PermittedDataTypeElement); + if (_PermittedUnit?.Any() == true) yield return new KeyValuePair("permittedUnit",_PermittedUnit); + if (_QualifiedValue?.Any() == true) yield return new KeyValuePair("qualifiedValue",_QualifiedValue); } } @@ -824,28 +798,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical canonical URL to reference this ObservationDefinition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -855,41 +826,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the ObservationDefinition. /// [FhirElement("version", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the ObservationDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -901,41 +869,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this ObservationDefinition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this ObservationDefinition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -945,28 +910,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this ObservationDefinition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -979,13 +941,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -994,13 +956,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1010,13 +969,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// If for testing purposes, not real usage @@ -1025,13 +984,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1041,28 +997,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1072,28 +1025,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// The name of the individual or organization that published the ObservationDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1106,39 +1056,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the ObservationDefinition. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the ObservationDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1151,11 +1098,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for this ObservationDefinition (if applicable). @@ -1166,39 +1113,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this ObservationDefinition is defined. /// [FhirElement("purpose", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this ObservationDefinition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1208,28 +1152,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1239,28 +1180,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1270,28 +1208,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=260)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When ObservationDefinition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1301,28 +1236,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// Date on which the asset content was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1332,13 +1264,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Based on FHIR definition of another observation. @@ -1348,24 +1280,24 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List DerivedFromCanonicalElement { - get { if(_DerivedFromCanonicalElement==null) _DerivedFromCanonicalElement = new List(); return _DerivedFromCanonicalElement; } + get => _DerivedFromCanonicalElement ?? new List(); set { _DerivedFromCanonicalElement = value; OnPropertyChanged("DerivedFromCanonicalElement"); } } - private List _DerivedFromCanonicalElement; + private List? _DerivedFromCanonicalElement; /// /// Based on FHIR definition of another observation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFromCanonical + public IEnumerable? DerivedFromCanonical { - get { return DerivedFromCanonicalElement != null ? DerivedFromCanonicalElement.Select(elem => elem.Value) : null; } + get => _DerivedFromCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromCanonicalElement = null; + DerivedFromCanonicalElement = null!; else DerivedFromCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFromCanonical"); @@ -1380,24 +1312,24 @@ public IEnumerable DerivedFromCanonical [DataMember] public List DerivedFromUriElement { - get { if(_DerivedFromUriElement==null) _DerivedFromUriElement = new List(); return _DerivedFromUriElement; } + get => _DerivedFromUriElement ?? new List(); set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } - private List _DerivedFromUriElement; + private List? _DerivedFromUriElement; /// /// Based on external definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFromUri + public IEnumerable? DerivedFromUri { - get { return DerivedFromUriElement != null ? DerivedFromUriElement.Select(elem => elem.Value) : null; } + get => _DerivedFromUriElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromUriElement = null; + DerivedFromUriElement = null!; else DerivedFromUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DerivedFromUri"); @@ -1412,24 +1344,24 @@ public IEnumerable DerivedFromUri [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Desired kind of performer for such kind of observation. /// [FhirElement("performerType", InSummary=true, Order=320)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// General type of observation. @@ -1440,11 +1372,11 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Type of observation. @@ -1453,13 +1385,13 @@ public List Category [Binding("ObservationCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period. @@ -1471,24 +1403,24 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List> PermittedDataTypeElement { - get { if(_PermittedDataTypeElement==null) _PermittedDataTypeElement = new List>(); return _PermittedDataTypeElement; } + get => _PermittedDataTypeElement ?? new List>(); set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } - private List> _PermittedDataTypeElement; + private List>? _PermittedDataTypeElement; /// /// Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable PermittedDataType + public IEnumerable? PermittedDataType { - get { return PermittedDataTypeElement != null ? PermittedDataTypeElement.Select(elem => elem.Value) : null; } + get => _PermittedDataTypeElement?.Select(elem => elem.Value); set { if (value == null) - PermittedDataTypeElement = null; + PermittedDataTypeElement = null!; else PermittedDataTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("PermittedDataType"); @@ -1500,13 +1432,13 @@ public IEnumerable Pe /// [FhirElement("multipleResultsAllowed", Order=360)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleResultsAllowedElement + public Hl7.Fhir.Model.FhirBoolean? MultipleResultsAllowedElement { get { return _MultipleResultsAllowedElement; } set { _MultipleResultsAllowedElement = value; OnPropertyChanged("MultipleResultsAllowedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleResultsAllowedElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleResultsAllowedElement; /// /// Multiple results allowed for conforming observations @@ -1515,13 +1447,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleResultsAllowedElement [IgnoreDataMember] public bool? MultipleResultsAllowed { - get { return MultipleResultsAllowedElement != null ? MultipleResultsAllowedElement.Value : null; } + get => _MultipleResultsAllowedElement?.Value; set { - if (value == null) - MultipleResultsAllowedElement = null; - else - MultipleResultsAllowedElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleResultsAllowedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleResultsAllowed"); } } @@ -1532,13 +1461,13 @@ public bool? MultipleResultsAllowed [FhirElement("bodySite", Order=370)] [Binding("ObservationBodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BodySite + public Hl7.Fhir.Model.CodeableConcept? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableConcept _BodySite; + private Hl7.Fhir.Model.CodeableConcept? _BodySite; /// /// Method used to produce the observation. @@ -1546,13 +1475,13 @@ public Hl7.Fhir.Model.CodeableConcept BodySite [FhirElement("method", Order=380)] [Binding("ObservationMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Kind of specimen used by this type of observation. @@ -1564,11 +1493,11 @@ public Hl7.Fhir.Model.CodeableConcept Method [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Measurement device or model of device. @@ -1580,39 +1509,36 @@ public List Specimen [DataMember] public List Device { - get { if(_Device==null) _Device = new List(); return _Device; } + get => _Device ?? new List(); set { _Device = value; OnPropertyChanged("Device"); } } - private List _Device; + private List? _Device; /// /// The preferred name to be used when reporting the observation results. /// [FhirElement("preferredReportName", Order=410)] [DataMember] - public Hl7.Fhir.Model.FhirString PreferredReportNameElement + public Hl7.Fhir.Model.FhirString? PreferredReportNameElement { get { return _PreferredReportNameElement; } set { _PreferredReportNameElement = value; OnPropertyChanged("PreferredReportNameElement"); } } - private Hl7.Fhir.Model.FhirString _PreferredReportNameElement; + private Hl7.Fhir.Model.FhirString? _PreferredReportNameElement; /// /// The preferred name to be used when reporting the observation results /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PreferredReportName + public string? PreferredReportName { - get { return PreferredReportNameElement != null ? PreferredReportNameElement.Value : null; } + get => _PreferredReportNameElement?.Value; set { - if (value == null) - PreferredReportNameElement = null; - else - PreferredReportNameElement = new Hl7.Fhir.Model.FhirString(value); + PreferredReportNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PreferredReportName"); } } @@ -1626,11 +1552,11 @@ public string PreferredReportName [DataMember] public List PermittedUnit { - get { if(_PermittedUnit==null) _PermittedUnit = new List(); return _PermittedUnit; } + get => _PermittedUnit ?? new List(); set { _PermittedUnit = value; OnPropertyChanged("PermittedUnit"); } } - private List _PermittedUnit; + private List? _PermittedUnit; /// /// Set of qualified values for observation results. @@ -1640,11 +1566,11 @@ public List PermittedUnit [DataMember] public List QualifiedValue { - get { if(_QualifiedValue==null) _QualifiedValue = new List(); return _QualifiedValue; } + get => _QualifiedValue ?? new List(); set { _QualifiedValue = value; OnPropertyChanged("QualifiedValue"); } } - private List _QualifiedValue; + private List? _QualifiedValue; /// /// Definitions of related resources belonging to this kind of observation group. @@ -1656,11 +1582,11 @@ public List Qualif [DataMember] public List HasMember { - get { if(_HasMember==null) _HasMember = new List(); return _HasMember; } + get => _HasMember ?? new List(); set { _HasMember = value; OnPropertyChanged("HasMember"); } } - private List _HasMember; + private List? _HasMember; /// /// Component results. @@ -1670,61 +1596,57 @@ public List HasMember [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ObservationDefinition; - - if (dest == null) - { + if(other is not ObservationDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(DerivedFromCanonicalElement.Any()) dest.DerivedFromCanonicalElement = new List(DerivedFromCanonicalElement.DeepCopyInternal()); - if(DerivedFromUriElement.Any()) dest.DerivedFromUriElement = new List(DerivedFromUriElement.DeepCopyInternal()); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(PermittedDataTypeElement.Any()) dest.PermittedDataTypeElement = new List>(PermittedDataTypeElement.DeepCopyInternal()); - if(MultipleResultsAllowedElement != null) dest.MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)MultipleResultsAllowedElement.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(Device.Any()) dest.Device = new List(Device.DeepCopyInternal()); - if(PreferredReportNameElement != null) dest.PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)PreferredReportNameElement.DeepCopyInternal(); - if(PermittedUnit.Any()) dest.PermittedUnit = new List(PermittedUnit.DeepCopyInternal()); - if(QualifiedValue.Any()) dest.QualifiedValue = new List(QualifiedValue.DeepCopyInternal()); - if(HasMember.Any()) dest.HasMember = new List(HasMember.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_DerivedFromCanonicalElement is not null) dest.DerivedFromCanonicalElement = new List(_DerivedFromCanonicalElement.DeepCopyInternal()); + if(_DerivedFromUriElement is not null) dest.DerivedFromUriElement = new List(_DerivedFromUriElement.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_PermittedDataTypeElement is not null) dest.PermittedDataTypeElement = new List>(_PermittedDataTypeElement.DeepCopyInternal()); + if(_MultipleResultsAllowedElement is not null) dest.MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleResultsAllowedElement.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)_BodySite.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_Device is not null) dest.Device = new List(_Device.DeepCopyInternal()); + if(_PreferredReportNameElement is not null) dest.PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)_PreferredReportNameElement.DeepCopyInternal(); + if(_PermittedUnit is not null) dest.PermittedUnit = new List(_PermittedUnit.DeepCopyInternal()); + if(_QualifiedValue is not null) dest.QualifiedValue = new List(_QualifiedValue.DeepCopyInternal()); + if(_HasMember is not null) dest.HasMember = new List(_HasMember.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1736,286 +1658,286 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ObservationDefinition; - if(otherT == null) return false; + if(other is not ObservationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(DerivedFromCanonicalElement, otherT.DerivedFromCanonicalElement)) return false; - if(!comparer.ListEquals(DerivedFromUriElement, otherT.DerivedFromUriElement)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(PermittedDataTypeElement, otherT.PermittedDataTypeElement)) return false; - if(!comparer.Equals(MultipleResultsAllowedElement, otherT.MultipleResultsAllowedElement)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(Device, otherT.Device)) return false; - if(!comparer.Equals(PreferredReportNameElement, otherT.PreferredReportNameElement)) return false; - if(!comparer.ListEquals(PermittedUnit, otherT.PermittedUnit)) return false; - if(!comparer.ListEquals(QualifiedValue, otherT.QualifiedValue)) return false; - if(!comparer.ListEquals(HasMember, otherT.HasMember)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_DerivedFromCanonicalElement, otherT._DerivedFromCanonicalElement)) return false; + if(!comparer.ListEquals(_DerivedFromUriElement, otherT._DerivedFromUriElement)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_PermittedDataTypeElement, otherT._PermittedDataTypeElement)) return false; + if(!comparer.Equals(_MultipleResultsAllowedElement, otherT._MultipleResultsAllowedElement)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_PreferredReportNameElement, otherT._PreferredReportNameElement)) return false; + if(!comparer.ListEquals(_PermittedUnit, otherT._PermittedUnit)) return false; + if(!comparer.ListEquals(_QualifiedValue, otherT._QualifiedValue)) return false; + if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "derivedFromCanonical": - value = DerivedFromCanonicalElement; - return DerivedFromCanonicalElement?.Any() == true; + value = _DerivedFromCanonicalElement; + return _DerivedFromCanonicalElement?.Any() == true; case "derivedFromUri": - value = DerivedFromUriElement; - return DerivedFromUriElement?.Any() == true; + value = _DerivedFromUriElement; + return _DerivedFromUriElement?.Any() == true; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "permittedDataType": - value = PermittedDataTypeElement; - return PermittedDataTypeElement?.Any() == true; + value = _PermittedDataTypeElement; + return _PermittedDataTypeElement?.Any() == true; case "multipleResultsAllowed": - value = MultipleResultsAllowedElement; - return MultipleResultsAllowedElement is not null; + value = _MultipleResultsAllowedElement; + return _MultipleResultsAllowedElement is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "device": - value = Device; - return Device?.Any() == true; + value = _Device; + return _Device?.Any() == true; case "preferredReportName": - value = PreferredReportNameElement; - return PreferredReportNameElement is not null; + value = _PreferredReportNameElement; + return _PreferredReportNameElement is not null; case "permittedUnit": - value = PermittedUnit; - return PermittedUnit?.Any() == true; + value = _PermittedUnit; + return _PermittedUnit?.Any() == true; case "qualifiedValue": - value = QualifiedValue; - return QualifiedValue?.Any() == true; + value = _QualifiedValue; + return _QualifiedValue?.Any() == true; case "hasMember": - value = HasMember; - return HasMember?.Any() == true; + value = _HasMember; + return _HasMember?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "derivedFromCanonical": - DerivedFromCanonicalElement = (List)value; + DerivedFromCanonicalElement = (List?)value!; return this; case "derivedFromUri": - DerivedFromUriElement = (List)value; + DerivedFromUriElement = (List?)value!; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "permittedDataType": - PermittedDataTypeElement = (List>)value; + PermittedDataTypeElement = (List>?)value!; return this; case "multipleResultsAllowed": - MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleResultsAllowedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableConcept)value; + BodySite = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "device": - Device = (List)value; + Device = (List?)value!; return this; case "preferredReportName": - PreferredReportNameElement = (Hl7.Fhir.Model.FhirString)value; + PreferredReportNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "permittedUnit": - PermittedUnit = (List)value; + PermittedUnit = (List?)value!; return this; case "qualifiedValue": - QualifiedValue = (List)value; + QualifiedValue = (List?)value!; return this; case "hasMember": - HasMember = (List)value; + HasMember = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2026,43 +1948,43 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (DerivedFromCanonicalElement?.Any() == true) yield return new KeyValuePair("derivedFromCanonical",DerivedFromCanonicalElement); - if (DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",DerivedFromUriElement); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",PermittedDataTypeElement); - if (MultipleResultsAllowedElement is not null) yield return new KeyValuePair("multipleResultsAllowed",MultipleResultsAllowedElement); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (Device?.Any() == true) yield return new KeyValuePair("device",Device); - if (PreferredReportNameElement is not null) yield return new KeyValuePair("preferredReportName",PreferredReportNameElement); - if (PermittedUnit?.Any() == true) yield return new KeyValuePair("permittedUnit",PermittedUnit); - if (QualifiedValue?.Any() == true) yield return new KeyValuePair("qualifiedValue",QualifiedValue); - if (HasMember?.Any() == true) yield return new KeyValuePair("hasMember",HasMember); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_DerivedFromCanonicalElement?.Any() == true) yield return new KeyValuePair("derivedFromCanonical",_DerivedFromCanonicalElement); + if (_DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",_DerivedFromUriElement); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_PermittedDataTypeElement?.Any() == true) yield return new KeyValuePair("permittedDataType",_PermittedDataTypeElement); + if (_MultipleResultsAllowedElement is not null) yield return new KeyValuePair("multipleResultsAllowed",_MultipleResultsAllowedElement); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_Device?.Any() == true) yield return new KeyValuePair("device",_Device); + if (_PreferredReportNameElement is not null) yield return new KeyValuePair("preferredReportName",_PreferredReportNameElement); + if (_PermittedUnit?.Any() == true) yield return new KeyValuePair("permittedUnit",_PermittedUnit); + if (_QualifiedValue?.Any() == true) yield return new KeyValuePair("qualifiedValue",_QualifiedValue); + if (_HasMember?.Any() == true) yield return new KeyValuePair("hasMember",_HasMember); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs index 554fe7173..e24e61ca5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -132,28 +135,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name in Parameters.parameter.name or in URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -166,13 +166,13 @@ public string Name [Binding("OperationParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -181,13 +181,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -202,24 +199,24 @@ public Hl7.Fhir.Model.OperationParameterUse? Use [DataMember] public List> ScopeElement { - get { if(_ScopeElement==null) _ScopeElement = new List>(); return _ScopeElement; } + get => _ScopeElement ?? new List>(); set { _ScopeElement = value; OnPropertyChanged("ScopeElement"); } } - private List> _ScopeElement; + private List>? _ScopeElement; /// /// instance | type | system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Scope + public IEnumerable? Scope { - get { return ScopeElement != null ? ScopeElement.Select(elem => elem.Value) : null; } + get => _ScopeElement?.Select(elem => elem.Value); set { if (value == null) - ScopeElement = null; + ScopeElement = null!; else ScopeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Scope"); @@ -232,13 +229,13 @@ public IEnumerable [FhirElement("min", Order=70)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum Cardinality @@ -247,13 +244,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -264,28 +258,25 @@ public int? Min [FhirElement("max", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum Cardinality (a number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -295,28 +286,25 @@ public string Max /// [FhirElement("documentation", Order=90)] [DataMember] - public Hl7.Fhir.Model.Markdown DocumentationElement + public Hl7.Fhir.Model.Markdown? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.Markdown _DocumentationElement; + private Hl7.Fhir.Model.Markdown? _DocumentationElement; /// /// Description of meaning/use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.Markdown(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Documentation"); } } @@ -328,13 +316,13 @@ public string Documentation [DeclaredType(Type = typeof(Code))] [Binding("FHIRAllTypes")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type this parameter has @@ -343,13 +331,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -364,24 +349,24 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List> AllowedTypeElement { - get { if(_AllowedTypeElement==null) _AllowedTypeElement = new List>(); return _AllowedTypeElement; } + get => _AllowedTypeElement ?? new List>(); set { _AllowedTypeElement = value; OnPropertyChanged("AllowedTypeElement"); } } - private List> _AllowedTypeElement; + private List>? _AllowedTypeElement; /// /// Allowed sub-type this parameter can have (if type is abstract) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable AllowedType + public IEnumerable? AllowedType { - get { return AllowedTypeElement != null ? AllowedTypeElement.Select(elem => elem.Value) : null; } + get => _AllowedTypeElement?.Select(elem => elem.Value); set { if (value == null) - AllowedTypeElement = null; + AllowedTypeElement = null!; else AllowedTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("AllowedType"); @@ -396,24 +381,24 @@ public IEnumerable AllowedType [DataMember] public List TargetProfileElement { - get { if(_TargetProfileElement==null) _TargetProfileElement = new List(); return _TargetProfileElement; } + get => _TargetProfileElement ?? new List(); set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } - private List _TargetProfileElement; + private List? _TargetProfileElement; /// /// If type is Reference | canonical, allowed targets. If type is 'Resource', then this constrains the allowed resource types /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TargetProfile + public IEnumerable? TargetProfile { - get { return TargetProfileElement != null ? TargetProfileElement.Select(elem => elem.Value) : null; } + get => _TargetProfileElement?.Select(elem => elem.Value); set { if (value == null) - TargetProfileElement = null; + TargetProfileElement = null!; else TargetProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("TargetProfile"); @@ -427,13 +412,13 @@ public IEnumerable TargetProfile [DeclaredType(Type = typeof(Code))] [Binding("SearchParamType")] [DataMember] - public Code SearchTypeElement + public Code? SearchTypeElement { get { return _SearchTypeElement; } set { _SearchTypeElement = value; OnPropertyChanged("SearchTypeElement"); } } - private Code _SearchTypeElement; + private Code? _SearchTypeElement; /// /// number | date | string | token | reference | composite | quantity | uri | special @@ -442,13 +427,10 @@ public Code SearchTypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? SearchType { - get { return SearchTypeElement != null ? SearchTypeElement.Value : null; } + get => _SearchTypeElement?.Value; set { - if (value == null) - SearchTypeElement = null; - else - SearchTypeElement = new Code(value); + SearchTypeElement = value is null ? null : new Code(value); OnPropertyChanged("SearchType"); } } @@ -458,13 +440,13 @@ public Hl7.Fhir.Model.SearchParamType? SearchType /// [FhirElement("binding", Order=140)] [DataMember] - public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding + public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding { get { return _Binding; } set { _Binding = value; OnPropertyChanged("Binding"); } } - private Hl7.Fhir.Model.OperationDefinition.BindingComponent _Binding; + private Hl7.Fhir.Model.OperationDefinition.BindingComponent? _Binding; /// /// References to this parameter. @@ -474,11 +456,11 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent Binding [DataMember] public List ReferencedFrom { - get { if(_ReferencedFrom==null) _ReferencedFrom = new List(); return _ReferencedFrom; } + get => _ReferencedFrom ?? new List(); set { _ReferencedFrom = value; OnPropertyChanged("ReferencedFrom"); } } - private List _ReferencedFrom; + private List? _ReferencedFrom; /// /// Parts of a nested Parameter. @@ -488,35 +470,31 @@ public List Referenc [DataMember] public List Part { - get { if(_Part==null) _Part = new List(); return _Part; } + get => _Part ?? new List(); set { _Part = value; OnPropertyChanged("Part"); } } - private List _Part; + private List? _Part; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(ScopeElement.Any()) dest.ScopeElement = new List>(ScopeElement.DeepCopyInternal()); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(AllowedTypeElement.Any()) dest.AllowedTypeElement = new List>(AllowedTypeElement.DeepCopyInternal()); - if(TargetProfileElement.Any()) dest.TargetProfileElement = new List(TargetProfileElement.DeepCopyInternal()); - if(SearchTypeElement != null) dest.SearchTypeElement = (Code)SearchTypeElement.DeepCopyInternal(); - if(Binding != null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)Binding.DeepCopyInternal(); - if(ReferencedFrom.Any()) dest.ReferencedFrom = new List(ReferencedFrom.DeepCopyInternal()); - if(Part.Any()) dest.Part = new List(Part.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_ScopeElement is not null) dest.ScopeElement = new List>(_ScopeElement.DeepCopyInternal()); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.Markdown)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_AllowedTypeElement is not null) dest.AllowedTypeElement = new List>(_AllowedTypeElement.DeepCopyInternal()); + if(_TargetProfileElement is not null) dest.TargetProfileElement = new List(_TargetProfileElement.DeepCopyInternal()); + if(_SearchTypeElement is not null) dest.SearchTypeElement = (Code)_SearchTypeElement.DeepCopyInternal(); + if(_Binding is not null) dest.Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)_Binding.DeepCopyInternal(); + if(_ReferencedFrom is not null) dest.ReferencedFrom = new List(_ReferencedFrom.DeepCopyInternal()); + if(_Part is not null) dest.Part = new List(_Part.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -528,118 +506,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.ListEquals(ScopeElement, otherT.ScopeElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(AllowedTypeElement, otherT.AllowedTypeElement)) return false; - if(!comparer.ListEquals(TargetProfileElement, otherT.TargetProfileElement)) return false; - if(!comparer.Equals(SearchTypeElement, otherT.SearchTypeElement)) return false; - if(!comparer.Equals(Binding, otherT.Binding)) return false; - if(!comparer.ListEquals(ReferencedFrom, otherT.ReferencedFrom)) return false; - if(!comparer.ListEquals(Part, otherT.Part)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.ListEquals(_ScopeElement, otherT._ScopeElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_AllowedTypeElement, otherT._AllowedTypeElement)) return false; + if(!comparer.ListEquals(_TargetProfileElement, otherT._TargetProfileElement)) return false; + if(!comparer.Equals(_SearchTypeElement, otherT._SearchTypeElement)) return false; + if(!comparer.Equals(_Binding, otherT._Binding)) return false; + if(!comparer.ListEquals(_ReferencedFrom, otherT._ReferencedFrom)) return false; + if(!comparer.ListEquals(_Part, otherT._Part)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "scope": - value = ScopeElement; - return ScopeElement?.Any() == true; + value = _ScopeElement; + return _ScopeElement?.Any() == true; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "allowedType": - value = AllowedTypeElement; - return AllowedTypeElement?.Any() == true; + value = _AllowedTypeElement; + return _AllowedTypeElement?.Any() == true; case "targetProfile": - value = TargetProfileElement; - return TargetProfileElement?.Any() == true; + value = _TargetProfileElement; + return _TargetProfileElement?.Any() == true; case "searchType": - value = SearchTypeElement; - return SearchTypeElement is not null; + value = _SearchTypeElement; + return _SearchTypeElement is not null; case "binding": - value = Binding; - return Binding is not null; + value = _Binding; + return _Binding is not null; case "referencedFrom": - value = ReferencedFrom; - return ReferencedFrom?.Any() == true; + value = _ReferencedFrom; + return _ReferencedFrom?.Any() == true; case "part": - value = Part; - return Part?.Any() == true; + value = _Part; + return _Part?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "scope": - ScopeElement = (List>)value; + ScopeElement = (List>?)value!; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.Markdown)value; + DocumentationElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "allowedType": - AllowedTypeElement = (List>)value; + AllowedTypeElement = (List>?)value!; return this; case "targetProfile": - TargetProfileElement = (List)value; + TargetProfileElement = (List?)value!; return this; case "searchType": - SearchTypeElement = (Code)value; + SearchTypeElement = (Code?)value; return this; case "binding": - Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent)value; + Binding = (Hl7.Fhir.Model.OperationDefinition.BindingComponent?)value; return this; case "referencedFrom": - ReferencedFrom = (List)value; + ReferencedFrom = (List?)value!; return this; case "part": - Part = (List)value; + Part = (List?)value!; return this; default: return base.SetValue(key, value); @@ -650,19 +628,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (ScopeElement?.Any() == true) yield return new KeyValuePair("scope",ScopeElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (AllowedTypeElement?.Any() == true) yield return new KeyValuePair("allowedType",AllowedTypeElement); - if (TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",TargetProfileElement); - if (SearchTypeElement is not null) yield return new KeyValuePair("searchType",SearchTypeElement); - if (Binding is not null) yield return new KeyValuePair("binding",Binding); - if (ReferencedFrom?.Any() == true) yield return new KeyValuePair("referencedFrom",ReferencedFrom); - if (Part?.Any() == true) yield return new KeyValuePair("part",Part); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_ScopeElement?.Any() == true) yield return new KeyValuePair("scope",_ScopeElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_AllowedTypeElement?.Any() == true) yield return new KeyValuePair("allowedType",_AllowedTypeElement); + if (_TargetProfileElement?.Any() == true) yield return new KeyValuePair("targetProfile",_TargetProfileElement); + if (_SearchTypeElement is not null) yield return new KeyValuePair("searchType",_SearchTypeElement); + if (_Binding is not null) yield return new KeyValuePair("binding",_Binding); + if (_ReferencedFrom?.Any() == true) yield return new KeyValuePair("referencedFrom",_ReferencedFrom); + if (_Part?.Any() == true) yield return new KeyValuePair("part",_Part); } } @@ -691,13 +669,13 @@ public partial class BindingComponent : Hl7.Fhir.Model.BackboneElement [Binding("BindingStrength")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StrengthElement + public Code? StrengthElement { get { return _StrengthElement; } set { _StrengthElement = value; OnPropertyChanged("StrengthElement"); } } - private Code _StrengthElement; + private Code? _StrengthElement; /// /// required | extensible | preferred | example @@ -706,13 +684,10 @@ public Code StrengthElement [IgnoreDataMember] public Hl7.Fhir.Model.BindingStrength? Strength { - get { return StrengthElement != null ? StrengthElement.Value : null; } + get => _StrengthElement?.Value; set { - if (value == null) - StrengthElement = null; - else - StrengthElement = new Code(value); + StrengthElement = value is null ? null : new Code(value); OnPropertyChanged("Strength"); } } @@ -723,44 +698,37 @@ public Hl7.Fhir.Model.BindingStrength? Strength [FhirElement("valueSet", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ValueSetElement + public Hl7.Fhir.Model.Canonical? ValueSetElement { get { return _ValueSetElement; } set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _ValueSetElement; + private Hl7.Fhir.Model.Canonical? _ValueSetElement; /// /// Source of value set /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValueSet + public string? ValueSet { - get { return ValueSetElement != null ? ValueSetElement.Value : null; } + get => _ValueSetElement?.Value; set { - if (value == null) - ValueSetElement = null; - else - ValueSetElement = new Hl7.Fhir.Model.Canonical(value); + ValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("ValueSet"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as BindingComponent; - - if (dest == null) - { + if(other is not BindingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StrengthElement != null) dest.StrengthElement = (Code)StrengthElement.DeepCopyInternal(); - if(ValueSetElement != null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)ValueSetElement.DeepCopyInternal(); + if(_StrengthElement is not null) dest.StrengthElement = (Code)_StrengthElement.DeepCopyInternal(); + if(_ValueSetElement is not null) dest.ValueSetElement = (Hl7.Fhir.Model.Canonical)_ValueSetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -772,41 +740,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as BindingComponent; - if(otherT == null) return false; + if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StrengthElement, otherT.StrengthElement)) return false; - if(!comparer.Equals(ValueSetElement, otherT.ValueSetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "strength": - value = StrengthElement; - return StrengthElement is not null; + value = _StrengthElement; + return _StrengthElement is not null; case "valueSet": - value = ValueSetElement; - return ValueSetElement is not null; + value = _ValueSetElement; + return _ValueSetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "strength": - StrengthElement = (Code)value; + StrengthElement = (Code?)value; return this; case "valueSet": - ValueSetElement = (Hl7.Fhir.Model.Canonical)value; + ValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -817,8 +785,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StrengthElement is not null) yield return new KeyValuePair("strength",StrengthElement); - if (ValueSetElement is not null) yield return new KeyValuePair("valueSet",ValueSetElement); + if (_StrengthElement is not null) yield return new KeyValuePair("strength",_StrengthElement); + if (_ValueSetElement is not null) yield return new KeyValuePair("valueSet",_ValueSetElement); } } @@ -846,28 +814,25 @@ public partial class ReferencedFromComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("source", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceElement + public Hl7.Fhir.Model.FhirString? SourceElement { get { return _SourceElement; } set { _SourceElement = value; OnPropertyChanged("SourceElement"); } } - private Hl7.Fhir.Model.FhirString _SourceElement; + private Hl7.Fhir.Model.FhirString? _SourceElement; /// /// Referencing parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Source + public string? Source { - get { return SourceElement != null ? SourceElement.Value : null; } + get => _SourceElement?.Value; set { - if (value == null) - SourceElement = null; - else - SourceElement = new Hl7.Fhir.Model.FhirString(value); + SourceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Source"); } } @@ -877,44 +842,37 @@ public string Source /// [FhirElement("sourceId", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceIdElement + public Hl7.Fhir.Model.FhirString? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _SourceIdElement; + private Hl7.Fhir.Model.FhirString? _SourceIdElement; /// /// Element id of reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.FhirString(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ReferencedFromComponent; - - if (dest == null) - { + if(other is not ReferencedFromComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceElement != null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)SourceElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.FhirString)SourceIdElement.DeepCopyInternal(); + if(_SourceElement is not null) dest.SourceElement = (Hl7.Fhir.Model.FhirString)_SourceElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.FhirString)_SourceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -926,41 +884,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ReferencedFromComponent; - if(otherT == null) return false; + if(other is not ReferencedFromComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceElement, otherT.SourceElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "source": - value = SourceElement; - return SourceElement is not null; + value = _SourceElement; + return _SourceElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "source": - SourceElement = (Hl7.Fhir.Model.FhirString)value; + SourceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.FhirString)value; + SourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -971,8 +929,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceElement is not null) yield return new KeyValuePair("source",SourceElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); + if (_SourceElement is not null) yield return new KeyValuePair("source",_SourceElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); } } @@ -1002,24 +960,24 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get { if(_ParameterNameElement==null) _ParameterNameElement = new List(); return _ParameterNameElement; } + get => _ParameterNameElement ?? new List(); set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } - private List _ParameterNameElement; + private List? _ParameterNameElement; /// /// Name of parameter to include in overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ParameterName + public IEnumerable? ParameterName { - get { return ParameterNameElement != null ? ParameterNameElement.Select(elem => elem.Value) : null; } + get => _ParameterNameElement?.Select(elem => elem.Value); set { if (value == null) - ParameterNameElement = null; + ParameterNameElement = null!; else ParameterNameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ParameterName"); @@ -1031,44 +989,37 @@ public IEnumerable ParameterName /// [FhirElement("comment", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments to go on overload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OverloadComponent; - - if (dest == null) - { + if(other is not OverloadComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ParameterNameElement.Any()) dest.ParameterNameElement = new List(ParameterNameElement.DeepCopyInternal()); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_ParameterNameElement is not null) dest.ParameterNameElement = new List(_ParameterNameElement.DeepCopyInternal()); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1080,41 +1031,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OverloadComponent; - if(otherT == null) return false; + if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(ParameterNameElement, otherT.ParameterNameElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "parameterName": - value = ParameterNameElement; - return ParameterNameElement?.Any() == true; + value = _ParameterNameElement; + return _ParameterNameElement?.Any() == true; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "parameterName": - ParameterNameElement = (List)value; + ParameterNameElement = (List?)value!; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1125,8 +1076,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",ParameterNameElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_ParameterNameElement?.Any() == true) yield return new KeyValuePair("parameterName",_ParameterNameElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } @@ -1136,28 +1087,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this operation definition, represented as an absolute URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1170,39 +1118,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the operation definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1214,13 +1159,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this operation definition (computer friendly). @@ -1228,28 +1173,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this operation definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1259,28 +1201,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this operation definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1293,13 +1232,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1308,13 +1247,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1327,13 +1263,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [Binding("OperationKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// operation | query @@ -1342,13 +1278,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1358,13 +1291,13 @@ public Hl7.Fhir.Model.OperationDefinition.OperationKind? Kind /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1373,13 +1306,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1389,28 +1319,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1420,28 +1347,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1454,39 +1378,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the operation definition. /// [FhirElement("description", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the operation definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1499,11 +1420,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for operation definition (if applicable). @@ -1514,39 +1435,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this operation definition is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this operation definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1556,28 +1474,25 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1587,28 +1502,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1618,13 +1530,13 @@ public string CopyrightLabel /// [FhirElement("affectsState", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AffectsStateElement + public Hl7.Fhir.Model.FhirBoolean? AffectsStateElement { get { return _AffectsStateElement; } set { _AffectsStateElement = value; OnPropertyChanged("AffectsStateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AffectsStateElement; + private Hl7.Fhir.Model.FhirBoolean? _AffectsStateElement; /// /// Whether content is changed by the operation @@ -1633,13 +1545,10 @@ public Hl7.Fhir.Model.FhirBoolean AffectsStateElement [IgnoreDataMember] public bool? AffectsState { - get { return AffectsStateElement != null ? AffectsStateElement.Value : null; } + get => _AffectsStateElement?.Value; set { - if (value == null) - AffectsStateElement = null; - else - AffectsStateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AffectsStateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("AffectsState"); } } @@ -1650,28 +1559,25 @@ public bool? AffectsState [FhirElement("code", InSummary=true, Order=280)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Recommended name for operation in search url /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -1681,28 +1587,25 @@ public string Code /// [FhirElement("comment", Order=290)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Additional information about use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -1712,28 +1615,25 @@ public string Comment /// [FhirElement("base", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.Canonical BaseElement + public Hl7.Fhir.Model.Canonical? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Hl7.Fhir.Model.Canonical _BaseElement; + private Hl7.Fhir.Model.Canonical? _BaseElement; /// /// Marks this as a profile of the base /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Base + public string? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Hl7.Fhir.Model.Canonical(value); + BaseElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Base"); } } @@ -1748,24 +1648,24 @@ public string Base [DataMember] public List> ResourceElement { - get { if(_ResourceElement==null) _ResourceElement = new List>(); return _ResourceElement; } + get => _ResourceElement ?? new List>(); set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private List> _ResourceElement; + private List>? _ResourceElement; /// /// Types this operation applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Resource + public IEnumerable? Resource { - get { return ResourceElement != null ? ResourceElement.Select(elem => elem.Value) : null; } + get => _ResourceElement?.Select(elem => elem.Value); set { if (value == null) - ResourceElement = null; + ResourceElement = null!; else ResourceElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Resource"); @@ -1778,13 +1678,13 @@ public IEnumerable Resource [FhirElement("system", InSummary=true, Order=320)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SystemElement + public Hl7.Fhir.Model.FhirBoolean? SystemElement { get { return _SystemElement; } set { _SystemElement = value; OnPropertyChanged("SystemElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SystemElement; + private Hl7.Fhir.Model.FhirBoolean? _SystemElement; /// /// Invoke at the system level? @@ -1793,13 +1693,10 @@ public Hl7.Fhir.Model.FhirBoolean SystemElement [IgnoreDataMember] public bool? System { - get { return SystemElement != null ? SystemElement.Value : null; } + get => _SystemElement?.Value; set { - if (value == null) - SystemElement = null; - else - SystemElement = new Hl7.Fhir.Model.FhirBoolean(value); + SystemElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("System"); } } @@ -1810,13 +1707,13 @@ public bool? System [FhirElement("type", InSummary=true, Order=330)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TypeElement + public Hl7.Fhir.Model.FhirBoolean? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TypeElement; + private Hl7.Fhir.Model.FhirBoolean? _TypeElement; /// /// Invoke at the type level? @@ -1825,13 +1722,10 @@ public Hl7.Fhir.Model.FhirBoolean TypeElement [IgnoreDataMember] public bool? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirBoolean(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Type"); } } @@ -1842,13 +1736,13 @@ public bool? Type [FhirElement("instance", InSummary=true, Order=340)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InstanceElement + public Hl7.Fhir.Model.FhirBoolean? InstanceElement { get { return _InstanceElement; } set { _InstanceElement = value; OnPropertyChanged("InstanceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InstanceElement; + private Hl7.Fhir.Model.FhirBoolean? _InstanceElement; /// /// Invoke on an instance? @@ -1857,13 +1751,10 @@ public Hl7.Fhir.Model.FhirBoolean InstanceElement [IgnoreDataMember] public bool? Instance { - get { return InstanceElement != null ? InstanceElement.Value : null; } + get => _InstanceElement?.Value; set { - if (value == null) - InstanceElement = null; - else - InstanceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InstanceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Instance"); } } @@ -1873,28 +1764,25 @@ public bool? Instance /// [FhirElement("inputProfile", Order=350)] [DataMember] - public Hl7.Fhir.Model.Canonical InputProfileElement + public Hl7.Fhir.Model.Canonical? InputProfileElement { get { return _InputProfileElement; } set { _InputProfileElement = value; OnPropertyChanged("InputProfileElement"); } } - private Hl7.Fhir.Model.Canonical _InputProfileElement; + private Hl7.Fhir.Model.Canonical? _InputProfileElement; /// /// Validation information for in parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InputProfile + public string? InputProfile { - get { return InputProfileElement != null ? InputProfileElement.Value : null; } + get => _InputProfileElement?.Value; set { - if (value == null) - InputProfileElement = null; - else - InputProfileElement = new Hl7.Fhir.Model.Canonical(value); + InputProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InputProfile"); } } @@ -1904,28 +1792,25 @@ public string InputProfile /// [FhirElement("outputProfile", Order=360)] [DataMember] - public Hl7.Fhir.Model.Canonical OutputProfileElement + public Hl7.Fhir.Model.Canonical? OutputProfileElement { get { return _OutputProfileElement; } set { _OutputProfileElement = value; OnPropertyChanged("OutputProfileElement"); } } - private Hl7.Fhir.Model.Canonical _OutputProfileElement; + private Hl7.Fhir.Model.Canonical? _OutputProfileElement; /// /// Validation information for out parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OutputProfile + public string? OutputProfile { - get { return OutputProfileElement != null ? OutputProfileElement.Value : null; } + get => _OutputProfileElement?.Value; set { - if (value == null) - OutputProfileElement = null; - else - OutputProfileElement = new Hl7.Fhir.Model.Canonical(value); + OutputProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("OutputProfile"); } } @@ -1938,11 +1823,11 @@ public string OutputProfile [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Define overloaded variants for when generating code. @@ -1952,54 +1837,50 @@ public List Parameter [DataMember] public List Overload { - get { if(_Overload==null) _Overload = new List(); return _Overload; } + get => _Overload ?? new List(); set { _Overload = value; OnPropertyChanged("Overload"); } } - private List _Overload; + private List? _Overload; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationDefinition; - - if (dest == null) - { + if(other is not OperationDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(AffectsStateElement != null) dest.AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)AffectsStateElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)BaseElement.DeepCopyInternal(); - if(ResourceElement.Any()) dest.ResourceElement = new List>(ResourceElement.DeepCopyInternal()); - if(SystemElement != null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)SystemElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)TypeElement.DeepCopyInternal(); - if(InstanceElement != null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)InstanceElement.DeepCopyInternal(); - if(InputProfileElement != null) dest.InputProfileElement = (Hl7.Fhir.Model.Canonical)InputProfileElement.DeepCopyInternal(); - if(OutputProfileElement != null) dest.OutputProfileElement = (Hl7.Fhir.Model.Canonical)OutputProfileElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Overload.Any()) dest.Overload = new List(Overload.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_AffectsStateElement is not null) dest.AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)_AffectsStateElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Hl7.Fhir.Model.Canonical)_BaseElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = new List>(_ResourceElement.DeepCopyInternal()); + if(_SystemElement is not null) dest.SystemElement = (Hl7.Fhir.Model.FhirBoolean)_SystemElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirBoolean)_TypeElement.DeepCopyInternal(); + if(_InstanceElement is not null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)_InstanceElement.DeepCopyInternal(); + if(_InputProfileElement is not null) dest.InputProfileElement = (Hl7.Fhir.Model.Canonical)_InputProfileElement.DeepCopyInternal(); + if(_OutputProfileElement is not null) dest.OutputProfileElement = (Hl7.Fhir.Model.Canonical)_OutputProfileElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Overload is not null) dest.Overload = new List(_Overload.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2011,237 +1892,237 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationDefinition; - if(otherT == null) return false; + if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(AffectsStateElement, otherT.AffectsStateElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.ListEquals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(SystemElement, otherT.SystemElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(InstanceElement, otherT.InstanceElement)) return false; - if(!comparer.Equals(InputProfileElement, otherT.InputProfileElement)) return false; - if(!comparer.Equals(OutputProfileElement, otherT.OutputProfileElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.ListEquals(Overload, otherT.Overload)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_AffectsStateElement, otherT._AffectsStateElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.ListEquals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_InstanceElement, otherT._InstanceElement)) return false; + if(!comparer.Equals(_InputProfileElement, otherT._InputProfileElement)) return false; + if(!comparer.Equals(_OutputProfileElement, otherT._OutputProfileElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "affectsState": - value = AffectsStateElement; - return AffectsStateElement is not null; + value = _AffectsStateElement; + return _AffectsStateElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; case "resource": - value = ResourceElement; - return ResourceElement?.Any() == true; + value = _ResourceElement; + return _ResourceElement?.Any() == true; case "system": - value = SystemElement; - return SystemElement is not null; + value = _SystemElement; + return _SystemElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "instance": - value = InstanceElement; - return InstanceElement is not null; + value = _InstanceElement; + return _InstanceElement is not null; case "inputProfile": - value = InputProfileElement; - return InputProfileElement is not null; + value = _InputProfileElement; + return _InputProfileElement is not null; case "outputProfile": - value = OutputProfileElement; - return OutputProfileElement is not null; + value = _OutputProfileElement; + return _OutputProfileElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "overload": - value = Overload; - return Overload?.Any() == true; + value = _Overload; + return _Overload?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "affectsState": - AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AffectsStateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "base": - BaseElement = (Hl7.Fhir.Model.Canonical)value; + BaseElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "resource": - ResourceElement = (List>)value; + ResourceElement = (List>?)value!; return this; case "system": - SystemElement = (Hl7.Fhir.Model.FhirBoolean)value; + SystemElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirBoolean)value; + TypeElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "instance": - InstanceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InstanceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "inputProfile": - InputProfileElement = (Hl7.Fhir.Model.Canonical)value; + InputProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "outputProfile": - OutputProfileElement = (Hl7.Fhir.Model.Canonical)value; + OutputProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "overload": - Overload = (List)value; + Overload = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2252,36 +2133,36 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (AffectsStateElement is not null) yield return new KeyValuePair("affectsState",AffectsStateElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); - if (ResourceElement?.Any() == true) yield return new KeyValuePair("resource",ResourceElement); - if (SystemElement is not null) yield return new KeyValuePair("system",SystemElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (InstanceElement is not null) yield return new KeyValuePair("instance",InstanceElement); - if (InputProfileElement is not null) yield return new KeyValuePair("inputProfile",InputProfileElement); - if (OutputProfileElement is not null) yield return new KeyValuePair("outputProfile",OutputProfileElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Overload?.Any() == true) yield return new KeyValuePair("overload",Overload); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_AffectsStateElement is not null) yield return new KeyValuePair("affectsState",_AffectsStateElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); + if (_ResourceElement?.Any() == true) yield return new KeyValuePair("resource",_ResourceElement); + if (_SystemElement is not null) yield return new KeyValuePair("system",_SystemElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_InstanceElement is not null) yield return new KeyValuePair("instance",_InstanceElement); + if (_InputProfileElement is not null) yield return new KeyValuePair("inputProfile",_InputProfileElement); + if (_OutputProfileElement is not null) yield return new KeyValuePair("outputProfile",_OutputProfileElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Overload?.Any() == true) yield return new KeyValuePair("overload",_Overload); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs index 2a9824772..ce2628752 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -84,11 +87,11 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Coded representation of the qualification. @@ -97,26 +100,26 @@ public List Identifier [Binding("Qualification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Period during which the qualification is valid. /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that regulates and issues the qualification. @@ -125,28 +128,24 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; protected internal override void CopyToInternal(Base other) { - var dest = other as QualificationComponent; - - if (dest == null) - { + if(other is not QualificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -158,55 +157,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualificationComponent; - if(otherT == null) return false; + if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -217,10 +216,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); } } @@ -233,24 +232,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether the organization's record is still in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether the organization's record is still in active use @@ -259,13 +258,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -279,39 +275,36 @@ public bool? Active [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Name used for the organization. /// [FhirElement("name", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name used for the organization /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -324,24 +317,24 @@ public string Name [DataMember] public List AliasElement { - get { if(_AliasElement==null) _AliasElement = new List(); return _AliasElement; } + get => _AliasElement ?? new List(); set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private List _AliasElement; + private List? _AliasElement; /// /// A list of alternate names that the organization is known as, or was known as in the past /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Alias + public IEnumerable? Alias { - get { return AliasElement != null ? AliasElement.Select(elem => elem.Value) : null; } + get => _AliasElement?.Select(elem => elem.Value); set { if (value == null) - AliasElement = null; + AliasElement = null!; else AliasElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Alias"); @@ -353,28 +346,25 @@ public IEnumerable Alias /// [FhirElement("description", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Additional details about the Organization that could be displayed as further information to identify the Organization beyond its name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -387,11 +377,11 @@ public string Description [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// The organization of which this organization forms a part. @@ -400,13 +390,13 @@ public List Contact [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PartOf + public Hl7.Fhir.Model.ResourceReference? PartOf { get { return _PartOf; } set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private Hl7.Fhir.Model.ResourceReference _PartOf; + private Hl7.Fhir.Model.ResourceReference? _PartOf; /// /// Technical endpoints providing access to services operated for the organization. @@ -418,11 +408,11 @@ public Hl7.Fhir.Model.ResourceReference PartOf [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; /// /// Qualifications, certifications, accreditations, licenses, training, etc. pertaining to the provision of care. @@ -432,34 +422,30 @@ public List Endpoint [DataMember] public List Qualification { - get { if(_Qualification==null) _Qualification = new List(); return _Qualification; } + get => _Qualification ?? new List(); set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private List _Qualification; + private List? _Qualification; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Organization; - - if (dest == null) - { + if(other is not Organization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(AliasElement.Any()) dest.AliasElement = new List(AliasElement.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(PartOf != null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopyInternal(); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); - if(Qualification.Any()) dest.Qualification = new List(Qualification.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = new List(_AliasElement.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = (Hl7.Fhir.Model.ResourceReference)_PartOf.DeepCopyInternal(); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); + if(_Qualification is not null) dest.Qualification = new List(_Qualification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -471,97 +457,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Organization; - if(otherT == null) return false; + if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; - if(!comparer.ListEquals(Qualification, otherT.Qualification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "alias": - value = AliasElement; - return AliasElement?.Any() == true; + value = _AliasElement; + return _AliasElement?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "partOf": - value = PartOf; - return PartOf is not null; + value = _PartOf; + return _PartOf is not null; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; case "qualification": - value = Qualification; - return Qualification?.Any() == true; + value = _Qualification; + return _Qualification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "alias": - AliasElement = (List)value; + AliasElement = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "partOf": - PartOf = (Hl7.Fhir.Model.ResourceReference)value; + PartOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; case "qualification": - Qualification = (List)value; + Qualification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -572,16 +558,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (AliasElement?.Any() == true) yield return new KeyValuePair("alias",AliasElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (PartOf is not null) yield return new KeyValuePair("partOf",PartOf); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); - if (Qualification?.Any() == true) yield return new KeyValuePair("qualification",Qualification); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_AliasElement?.Any() == true) yield return new KeyValuePair("alias",_AliasElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_PartOf is not null) yield return new KeyValuePair("partOf",_PartOf); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); + if (_Qualification?.Any() == true) yield return new KeyValuePair("qualification",_Qualification); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs index f44d9f0ca..1d3f24e56 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,24 +67,24 @@ public partial class OrganizationAffiliation : Hl7.Fhir.Model.DomainResource, II [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this organization affiliation record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this organization affiliation record is in active use @@ -90,13 +93,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -106,13 +106,13 @@ public bool? Active /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization where the role is available. @@ -121,13 +121,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Organization that provides/performs the role (e.g. providing services or is a member of). @@ -136,13 +136,13 @@ public Hl7.Fhir.Model.ResourceReference Organization [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ParticipatingOrganization + public Hl7.Fhir.Model.ResourceReference? ParticipatingOrganization { get { return _ParticipatingOrganization; } set { _ParticipatingOrganization = value; OnPropertyChanged("ParticipatingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ParticipatingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ParticipatingOrganization; /// /// The network in which the participatingOrganization provides the role's services (if defined) at the indicated locations (if defined). @@ -154,11 +154,11 @@ public Hl7.Fhir.Model.ResourceReference ParticipatingOrganization [DataMember] public List Network { - get { if(_Network==null) _Network = new List(); return _Network; } + get => _Network ?? new List(); set { _Network = value; OnPropertyChanged("Network"); } } - private List _Network; + private List? _Network; /// /// Definition of the role the participatingOrganization plays. @@ -169,11 +169,11 @@ public List Network [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Specific specialty of the participatingOrganization in the context of the role. @@ -184,11 +184,11 @@ public List Code [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The location(s) at which the role occurs. @@ -200,11 +200,11 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Healthcare services provided through the role. @@ -216,11 +216,11 @@ public List Location [DataMember] public List HealthcareService { - get { if(_HealthcareService==null) _HealthcareService = new List(); return _HealthcareService; } + get => _HealthcareService ?? new List(); set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } - private List _HealthcareService; + private List? _HealthcareService; /// /// Official contact details at the participatingOrganization relevant to this Affiliation. @@ -230,11 +230,11 @@ public List HealthcareService [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Technical endpoints providing access to services operated for this role. @@ -246,36 +246,32 @@ public List Contact [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as OrganizationAffiliation; - - if (dest == null) - { + if(other is not OrganizationAffiliation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(ParticipatingOrganization != null) dest.ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)ParticipatingOrganization.DeepCopyInternal(); - if(Network.Any()) dest.Network = new List(Network.DeepCopyInternal()); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(HealthcareService.Any()) dest.HealthcareService = new List(HealthcareService.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_ParticipatingOrganization is not null) dest.ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)_ParticipatingOrganization.DeepCopyInternal(); + if(_Network is not null) dest.Network = new List(_Network.DeepCopyInternal()); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_HealthcareService is not null) dest.HealthcareService = new List(_HealthcareService.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -287,111 +283,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrganizationAffiliation; - if(otherT == null) return false; + if(other is not OrganizationAffiliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(ParticipatingOrganization, otherT.ParticipatingOrganization)) return false; - if(!comparer.ListEquals(Network, otherT.Network)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(HealthcareService, otherT.HealthcareService)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_ParticipatingOrganization, otherT._ParticipatingOrganization)) return false; + if(!comparer.ListEquals(_Network, otherT._Network)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "participatingOrganization": - value = ParticipatingOrganization; - return ParticipatingOrganization is not null; + value = _ParticipatingOrganization; + return _ParticipatingOrganization is not null; case "network": - value = Network; - return Network?.Any() == true; + value = _Network; + return _Network?.Any() == true; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "healthcareService": - value = HealthcareService; - return HealthcareService?.Any() == true; + value = _HealthcareService; + return _HealthcareService?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "participatingOrganization": - ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ParticipatingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "network": - Network = (List)value; + Network = (List?)value!; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "healthcareService": - HealthcareService = (List)value; + HealthcareService = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -402,18 +398,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (ParticipatingOrganization is not null) yield return new KeyValuePair("participatingOrganization",ParticipatingOrganization); - if (Network?.Any() == true) yield return new KeyValuePair("network",Network); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",HealthcareService); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_ParticipatingOrganization is not null) yield return new KeyValuePair("participatingOrganization",_ParticipatingOrganization); + if (_Network?.Any() == true) yield return new KeyValuePair("network",_Network); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",_HealthcareService); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs index b6f185680..2e81e636f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -75,13 +78,13 @@ public partial class LegalStatusOfSupplyComponent : Hl7.Fhir.Model.BackboneEleme [FhirElement("code", InSummary=true, Order=40)] [Binding("LegalStatusOfSupply")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The place where the legal status of supply applies. @@ -89,26 +92,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("jurisdiction", InSummary=true, Order=50)] [Binding("Jurisdiction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Jurisdiction + public Hl7.Fhir.Model.CodeableConcept? Jurisdiction { get { return _Jurisdiction; } set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private Hl7.Fhir.Model.CodeableConcept _Jurisdiction; + private Hl7.Fhir.Model.CodeableConcept? _Jurisdiction; protected internal override void CopyToInternal(Base other) { - var dest = other as LegalStatusOfSupplyComponent; - - if (dest == null) - { + if(other is not LegalStatusOfSupplyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Jurisdiction != null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)Jurisdiction.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Jurisdiction is not null) dest.Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)_Jurisdiction.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -120,41 +119,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LegalStatusOfSupplyComponent; - if(otherT == null) return false; + if(other is not LegalStatusOfSupplyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Jurisdiction, otherT.Jurisdiction)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction is not null; + value = _Jurisdiction; + return _Jurisdiction is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "jurisdiction": - Jurisdiction = (Hl7.Fhir.Model.CodeableConcept)value; + Jurisdiction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -165,8 +164,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",Jurisdiction); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Jurisdiction is not null) yield return new KeyValuePair("jurisdiction",_Jurisdiction); } } @@ -195,11 +194,11 @@ public partial class PackagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The physical type of the container of the items. @@ -207,26 +206,26 @@ public List Identifier [FhirElement("type", InSummary=true, Order=50)] [Binding("PackagingType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Is this a part of the packaging (e.g. a cap or bottle stopper), rather than the packaging itself (e.g. a bottle or vial). /// [FhirElement("componentPart", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ComponentPartElement + public Hl7.Fhir.Model.FhirBoolean? ComponentPartElement { get { return _ComponentPartElement; } set { _ComponentPartElement = value; OnPropertyChanged("ComponentPartElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ComponentPartElement; + private Hl7.Fhir.Model.FhirBoolean? _ComponentPartElement; /// /// Is this a part of the packaging (e.g. a cap or bottle stopper), rather than the packaging itself (e.g. a bottle or vial) @@ -235,13 +234,10 @@ public Hl7.Fhir.Model.FhirBoolean ComponentPartElement [IgnoreDataMember] public bool? ComponentPart { - get { return ComponentPartElement != null ? ComponentPartElement.Value : null; } + get => _ComponentPartElement?.Value; set { - if (value == null) - ComponentPartElement = null; - else - ComponentPartElement = new Hl7.Fhir.Model.FhirBoolean(value); + ComponentPartElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ComponentPart"); } } @@ -251,13 +247,13 @@ public bool? ComponentPart /// [FhirElement("quantity", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer QuantityElement + public Hl7.Fhir.Model.Integer? QuantityElement { get { return _QuantityElement; } set { _QuantityElement = value; OnPropertyChanged("QuantityElement"); } } - private Hl7.Fhir.Model.Integer _QuantityElement; + private Hl7.Fhir.Model.Integer? _QuantityElement; /// /// The quantity of this level of packaging in the package that contains it (with the outermost level being 1) @@ -266,13 +262,10 @@ public Hl7.Fhir.Model.Integer QuantityElement [IgnoreDataMember] public int? Quantity { - get { return QuantityElement != null ? QuantityElement.Value : null; } + get => _QuantityElement?.Value; set { - if (value == null) - QuantityElement = null; - else - QuantityElement = new Hl7.Fhir.Model.Integer(value); + QuantityElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Quantity"); } } @@ -286,11 +279,11 @@ public int? Quantity [DataMember] public List Material { - get { if(_Material==null) _Material = new List(); return _Material; } + get => _Material ?? new List(); set { _Material = value; OnPropertyChanged("Material"); } } - private List _Material; + private List? _Material; /// /// A possible alternate material for this part of the packaging, that is allowed to be used instead of the usual material. @@ -301,11 +294,11 @@ public List Material [DataMember] public List AlternateMaterial { - get { if(_AlternateMaterial==null) _AlternateMaterial = new List(); return _AlternateMaterial; } + get => _AlternateMaterial ?? new List(); set { _AlternateMaterial = value; OnPropertyChanged("AlternateMaterial"); } } - private List _AlternateMaterial; + private List? _AlternateMaterial; /// /// Shelf Life and storage information. @@ -315,11 +308,11 @@ public List AlternateMaterial [DataMember] public List ShelfLifeStorage { - get { if(_ShelfLifeStorage==null) _ShelfLifeStorage = new List(); return _ShelfLifeStorage; } + get => _ShelfLifeStorage ?? new List(); set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } - private List _ShelfLifeStorage; + private List? _ShelfLifeStorage; /// /// Manufacturer of this packaging item (multiple means these are all potential manufacturers). @@ -331,11 +324,11 @@ public List ShelfLifeStorage [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// General characteristics of this item. @@ -345,11 +338,11 @@ public List Manufacturer [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// The item(s) within the packaging. @@ -359,11 +352,11 @@ public List Property [DataMember] public List ContainedItem { - get { if(_ContainedItem==null) _ContainedItem = new List(); return _ContainedItem; } + get => _ContainedItem ?? new List(); set { _ContainedItem = value; OnPropertyChanged("ContainedItem"); } } - private List _ContainedItem; + private List? _ContainedItem; /// /// Allows containers (and parts of containers) within containers, still as a part of single packaged product. @@ -373,33 +366,29 @@ public List Con [DataMember] public List Packaging { - get { if(_Packaging==null) _Packaging = new List(); return _Packaging; } + get => _Packaging ?? new List(); set { _Packaging = value; OnPropertyChanged("Packaging"); } } - private List _Packaging; + private List? _Packaging; protected internal override void CopyToInternal(Base other) { - var dest = other as PackagingComponent; - - if (dest == null) - { + if(other is not PackagingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ComponentPartElement != null) dest.ComponentPartElement = (Hl7.Fhir.Model.FhirBoolean)ComponentPartElement.DeepCopyInternal(); - if(QuantityElement != null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)QuantityElement.DeepCopyInternal(); - if(Material.Any()) dest.Material = new List(Material.DeepCopyInternal()); - if(AlternateMaterial.Any()) dest.AlternateMaterial = new List(AlternateMaterial.DeepCopyInternal()); - if(ShelfLifeStorage.Any()) dest.ShelfLifeStorage = new List(ShelfLifeStorage.DeepCopyInternal()); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(ContainedItem.Any()) dest.ContainedItem = new List(ContainedItem.DeepCopyInternal()); - if(Packaging.Any()) dest.Packaging = new List(Packaging.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ComponentPartElement is not null) dest.ComponentPartElement = (Hl7.Fhir.Model.FhirBoolean)_ComponentPartElement.DeepCopyInternal(); + if(_QuantityElement is not null) dest.QuantityElement = (Hl7.Fhir.Model.Integer)_QuantityElement.DeepCopyInternal(); + if(_Material is not null) dest.Material = new List(_Material.DeepCopyInternal()); + if(_AlternateMaterial is not null) dest.AlternateMaterial = new List(_AlternateMaterial.DeepCopyInternal()); + if(_ShelfLifeStorage is not null) dest.ShelfLifeStorage = new List(_ShelfLifeStorage.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_ContainedItem is not null) dest.ContainedItem = new List(_ContainedItem.DeepCopyInternal()); + if(_Packaging is not null) dest.Packaging = new List(_Packaging.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -411,104 +400,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagingComponent; - if(otherT == null) return false; + if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ComponentPartElement, otherT.ComponentPartElement)) return false; - if(!comparer.Equals(QuantityElement, otherT.QuantityElement)) return false; - if(!comparer.ListEquals(Material, otherT.Material)) return false; - if(!comparer.ListEquals(AlternateMaterial, otherT.AlternateMaterial)) return false; - if(!comparer.ListEquals(ShelfLifeStorage, otherT.ShelfLifeStorage)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.ListEquals(ContainedItem, otherT.ContainedItem)) return false; - if(!comparer.ListEquals(Packaging, otherT.Packaging)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ComponentPartElement, otherT._ComponentPartElement)) return false; + if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; + if(!comparer.ListEquals(_Material, otherT._Material)) return false; + if(!comparer.ListEquals(_AlternateMaterial, otherT._AlternateMaterial)) return false; + if(!comparer.ListEquals(_ShelfLifeStorage, otherT._ShelfLifeStorage)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.ListEquals(_ContainedItem, otherT._ContainedItem)) return false; + if(!comparer.ListEquals(_Packaging, otherT._Packaging)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "componentPart": - value = ComponentPartElement; - return ComponentPartElement is not null; + value = _ComponentPartElement; + return _ComponentPartElement is not null; case "quantity": - value = QuantityElement; - return QuantityElement is not null; + value = _QuantityElement; + return _QuantityElement is not null; case "material": - value = Material; - return Material?.Any() == true; + value = _Material; + return _Material?.Any() == true; case "alternateMaterial": - value = AlternateMaterial; - return AlternateMaterial?.Any() == true; + value = _AlternateMaterial; + return _AlternateMaterial?.Any() == true; case "shelfLifeStorage": - value = ShelfLifeStorage; - return ShelfLifeStorage?.Any() == true; + value = _ShelfLifeStorage; + return _ShelfLifeStorage?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "containedItem": - value = ContainedItem; - return ContainedItem?.Any() == true; + value = _ContainedItem; + return _ContainedItem?.Any() == true; case "packaging": - value = Packaging; - return Packaging?.Any() == true; + value = _Packaging; + return _Packaging?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "componentPart": - ComponentPartElement = (Hl7.Fhir.Model.FhirBoolean)value; + ComponentPartElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "quantity": - QuantityElement = (Hl7.Fhir.Model.Integer)value; + QuantityElement = (Hl7.Fhir.Model.Integer?)value; return this; case "material": - Material = (List)value; + Material = (List?)value!; return this; case "alternateMaterial": - AlternateMaterial = (List)value; + AlternateMaterial = (List?)value!; return this; case "shelfLifeStorage": - ShelfLifeStorage = (List)value; + ShelfLifeStorage = (List?)value!; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "containedItem": - ContainedItem = (List)value; + ContainedItem = (List?)value!; return this; case "packaging": - Packaging = (List)value; + Packaging = (List?)value!; return this; default: return base.SetValue(key, value); @@ -519,17 +508,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ComponentPartElement is not null) yield return new KeyValuePair("componentPart",ComponentPartElement); - if (QuantityElement is not null) yield return new KeyValuePair("quantity",QuantityElement); - if (Material?.Any() == true) yield return new KeyValuePair("material",Material); - if (AlternateMaterial?.Any() == true) yield return new KeyValuePair("alternateMaterial",AlternateMaterial); - if (ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",ShelfLifeStorage); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (ContainedItem?.Any() == true) yield return new KeyValuePair("containedItem",ContainedItem); - if (Packaging?.Any() == true) yield return new KeyValuePair("packaging",Packaging); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ComponentPartElement is not null) yield return new KeyValuePair("componentPart",_ComponentPartElement); + if (_QuantityElement is not null) yield return new KeyValuePair("quantity",_QuantityElement); + if (_Material?.Any() == true) yield return new KeyValuePair("material",_Material); + if (_AlternateMaterial?.Any() == true) yield return new KeyValuePair("alternateMaterial",_AlternateMaterial); + if (_ShelfLifeStorage?.Any() == true) yield return new KeyValuePair("shelfLifeStorage",_ShelfLifeStorage); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_ContainedItem?.Any() == true) yield return new KeyValuePair("containedItem",_ContainedItem); + if (_Packaging?.Any() == true) yield return new KeyValuePair("packaging",_Packaging); } } @@ -554,13 +543,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProductCharacteristic")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the characteristic. @@ -569,26 +558,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -600,41 +585,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -645,8 +630,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -670,39 +655,35 @@ public partial class ContainedItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("item", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// The number of this type of item within this packaging or for continuous items such as liquids it is the quantity (for example 25ml). See also PackagedProductDefinition.containedItemQuantity (especially the long definition). /// [FhirElement("amount", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainedItemComponent; - - if (dest == null) - { + if(other is not ContainedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -714,41 +695,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainedItemComponent; - if(otherT == null) return false; + if(other is not ContainedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -759,8 +740,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -773,39 +754,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A name for this package. Typically as listed in a drug formulary, catalogue, inventory etc. /// [FhirElement("name", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name for this package. Typically as listed in a drug formulary, catalogue, inventory etc /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -816,13 +794,13 @@ public string Name [FhirElement("type", InSummary=true, Order=110)] [Binding("PackageType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The product that this is a pack for. @@ -834,11 +812,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List PackageFor { - get { if(_PackageFor==null) _PackageFor = new List(); return _PackageFor; } + get => _PackageFor ?? new List(); set { _PackageFor = value; OnPropertyChanged("PackageFor"); } } - private List _PackageFor; + private List? _PackageFor; /// /// The status within the lifecycle of this item. High level - not intended to duplicate details elsewhere e.g. legal status, or authorization/marketing status. @@ -846,41 +824,38 @@ public List PackageFor [FhirElement("status", InSummary=true, IsModifier=true, Order=130)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the given status became applicable. /// [FhirElement("statusDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the given status became applicable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -893,39 +868,36 @@ public string StatusDate [DataMember] public List ContainedItemQuantity { - get { if(_ContainedItemQuantity==null) _ContainedItemQuantity = new List(); return _ContainedItemQuantity; } + get => _ContainedItemQuantity ?? new List(); set { _ContainedItemQuantity = value; OnPropertyChanged("ContainedItemQuantity"); } } - private List _ContainedItemQuantity; + private List? _ContainedItemQuantity; /// /// Textual description. Note that this is not the name of the package or product. /// [FhirElement("description", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description. Note that this is not the name of the package or product /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -938,11 +910,11 @@ public string Description [DataMember] public List LegalStatusOfSupply { - get { if(_LegalStatusOfSupply==null) _LegalStatusOfSupply = new List(); return _LegalStatusOfSupply; } + get => _LegalStatusOfSupply ?? new List(); set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } - private List _LegalStatusOfSupply; + private List? _LegalStatusOfSupply; /// /// Allows specifying that an item is on the market for sale, or that it is not available, and the dates and locations associated. @@ -952,24 +924,24 @@ public List MarketingStatus { - get { if(_MarketingStatus==null) _MarketingStatus = new List(); return _MarketingStatus; } + get => _MarketingStatus ?? new List(); set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } - private List _MarketingStatus; + private List? _MarketingStatus; /// /// Identifies if the drug product is supplied with another item such as a diluent or adjuvant. /// [FhirElement("copackagedIndicator", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CopackagedIndicatorElement + public Hl7.Fhir.Model.FhirBoolean? CopackagedIndicatorElement { get { return _CopackagedIndicatorElement; } set { _CopackagedIndicatorElement = value; OnPropertyChanged("CopackagedIndicatorElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CopackagedIndicatorElement; + private Hl7.Fhir.Model.FhirBoolean? _CopackagedIndicatorElement; /// /// Identifies if the drug product is supplied with another item such as a diluent or adjuvant @@ -978,13 +950,10 @@ public Hl7.Fhir.Model.FhirBoolean CopackagedIndicatorElement [IgnoreDataMember] public bool? CopackagedIndicator { - get { return CopackagedIndicatorElement != null ? CopackagedIndicatorElement.Value : null; } + get => _CopackagedIndicatorElement?.Value; set { - if (value == null) - CopackagedIndicatorElement = null; - else - CopackagedIndicatorElement = new Hl7.Fhir.Model.FhirBoolean(value); + CopackagedIndicatorElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("CopackagedIndicator"); } } @@ -999,11 +968,11 @@ public bool? CopackagedIndicator [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// Additional information or supporting documentation about the packaged product. @@ -1015,24 +984,24 @@ public List Manufacturer [DataMember] public List AttachedDocument { - get { if(_AttachedDocument==null) _AttachedDocument = new List(); return _AttachedDocument; } + get => _AttachedDocument ?? new List(); set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } - private List _AttachedDocument; + private List? _AttachedDocument; /// /// A packaging item, as a container for medically related items, possibly with other packaging items within, or a packaging component, such as bottle cap. /// [FhirElement("packaging", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent Packaging + public Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent? Packaging { get { return _Packaging; } set { _Packaging = value; OnPropertyChanged("Packaging"); } } - private Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent _Packaging; + private Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent? _Packaging; /// /// Allows the key features to be recorded, such as "hospital pack", "nurse prescribable". @@ -1042,39 +1011,35 @@ public Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent Packaging [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PackagedProductDefinition; - - if (dest == null) - { + if(other is not PackagedProductDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PackageFor.Any()) dest.PackageFor = new List(PackageFor.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(ContainedItemQuantity.Any()) dest.ContainedItemQuantity = new List(ContainedItemQuantity.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(LegalStatusOfSupply.Any()) dest.LegalStatusOfSupply = new List(LegalStatusOfSupply.DeepCopyInternal()); - if(MarketingStatus.Any()) dest.MarketingStatus = new List(MarketingStatus.DeepCopyInternal()); - if(CopackagedIndicatorElement != null) dest.CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)CopackagedIndicatorElement.DeepCopyInternal(); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(AttachedDocument.Any()) dest.AttachedDocument = new List(AttachedDocument.DeepCopyInternal()); - if(Packaging != null) dest.Packaging = (Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent)Packaging.DeepCopyInternal(); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PackageFor is not null) dest.PackageFor = new List(_PackageFor.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_ContainedItemQuantity is not null) dest.ContainedItemQuantity = new List(_ContainedItemQuantity.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_LegalStatusOfSupply is not null) dest.LegalStatusOfSupply = new List(_LegalStatusOfSupply.DeepCopyInternal()); + if(_MarketingStatus is not null) dest.MarketingStatus = new List(_MarketingStatus.DeepCopyInternal()); + if(_CopackagedIndicatorElement is not null) dest.CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)_CopackagedIndicatorElement.DeepCopyInternal(); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_AttachedDocument is not null) dest.AttachedDocument = new List(_AttachedDocument.DeepCopyInternal()); + if(_Packaging is not null) dest.Packaging = (Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent)_Packaging.DeepCopyInternal(); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1086,132 +1051,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PackagedProductDefinition; - if(otherT == null) return false; + if(other is not PackagedProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(PackageFor, otherT.PackageFor)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.ListEquals(ContainedItemQuantity, otherT.ContainedItemQuantity)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(LegalStatusOfSupply, otherT.LegalStatusOfSupply)) return false; - if(!comparer.ListEquals(MarketingStatus, otherT.MarketingStatus)) return false; - if(!comparer.Equals(CopackagedIndicatorElement, otherT.CopackagedIndicatorElement)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(AttachedDocument, otherT.AttachedDocument)) return false; - if(!comparer.Equals(Packaging, otherT.Packaging)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_PackageFor, otherT._PackageFor)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.ListEquals(_ContainedItemQuantity, otherT._ContainedItemQuantity)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; + if(!comparer.ListEquals(_MarketingStatus, otherT._MarketingStatus)) return false; + if(!comparer.Equals(_CopackagedIndicatorElement, otherT._CopackagedIndicatorElement)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_AttachedDocument, otherT._AttachedDocument)) return false; + if(!comparer.Equals(_Packaging, otherT._Packaging)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "packageFor": - value = PackageFor; - return PackageFor?.Any() == true; + value = _PackageFor; + return _PackageFor?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "containedItemQuantity": - value = ContainedItemQuantity; - return ContainedItemQuantity?.Any() == true; + value = _ContainedItemQuantity; + return _ContainedItemQuantity?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "legalStatusOfSupply": - value = LegalStatusOfSupply; - return LegalStatusOfSupply?.Any() == true; + value = _LegalStatusOfSupply; + return _LegalStatusOfSupply?.Any() == true; case "marketingStatus": - value = MarketingStatus; - return MarketingStatus?.Any() == true; + value = _MarketingStatus; + return _MarketingStatus?.Any() == true; case "copackagedIndicator": - value = CopackagedIndicatorElement; - return CopackagedIndicatorElement is not null; + value = _CopackagedIndicatorElement; + return _CopackagedIndicatorElement is not null; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "attachedDocument": - value = AttachedDocument; - return AttachedDocument?.Any() == true; + value = _AttachedDocument; + return _AttachedDocument?.Any() == true; case "packaging": - value = Packaging; - return Packaging is not null; + value = _Packaging; + return _Packaging is not null; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "packageFor": - PackageFor = (List)value; + PackageFor = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "containedItemQuantity": - ContainedItemQuantity = (List)value; + ContainedItemQuantity = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "legalStatusOfSupply": - LegalStatusOfSupply = (List)value; + LegalStatusOfSupply = (List?)value!; return this; case "marketingStatus": - MarketingStatus = (List)value; + MarketingStatus = (List?)value!; return this; case "copackagedIndicator": - CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean)value; + CopackagedIndicatorElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "attachedDocument": - AttachedDocument = (List)value; + AttachedDocument = (List?)value!; return this; case "packaging": - Packaging = (Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent)value; + Packaging = (Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent?)value; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1222,21 +1187,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PackageFor?.Any() == true) yield return new KeyValuePair("packageFor",PackageFor); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (ContainedItemQuantity?.Any() == true) yield return new KeyValuePair("containedItemQuantity",ContainedItemQuantity); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (LegalStatusOfSupply?.Any() == true) yield return new KeyValuePair("legalStatusOfSupply",LegalStatusOfSupply); - if (MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",MarketingStatus); - if (CopackagedIndicatorElement is not null) yield return new KeyValuePair("copackagedIndicator",CopackagedIndicatorElement); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",AttachedDocument); - if (Packaging is not null) yield return new KeyValuePair("packaging",Packaging); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PackageFor?.Any() == true) yield return new KeyValuePair("packageFor",_PackageFor); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_ContainedItemQuantity?.Any() == true) yield return new KeyValuePair("containedItemQuantity",_ContainedItemQuantity); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_LegalStatusOfSupply?.Any() == true) yield return new KeyValuePair("legalStatusOfSupply",_LegalStatusOfSupply); + if (_MarketingStatus?.Any() == true) yield return new KeyValuePair("marketingStatus",_MarketingStatus); + if (_CopackagedIndicatorElement is not null) yield return new KeyValuePair("copackagedIndicator",_CopackagedIndicatorElement); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",_AttachedDocument); + if (_Packaging is not null) yield return new KeyValuePair("packaging",_Packaging); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs index 380640e4e..67e3b9a33 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,28 +67,25 @@ public partial class ParameterDefinition : Hl7.Fhir.Model.DataType /// [FhirElement("name", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name used to access the parameter value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -98,13 +98,13 @@ public string Name [Binding("ParameterUse")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code UseElement + public Code? UseElement { get { return _UseElement; } set { _UseElement = value; OnPropertyChanged("UseElement"); } } - private Code _UseElement; + private Code? _UseElement; /// /// in | out @@ -113,13 +113,10 @@ public Code UseElement [IgnoreDataMember] public Hl7.Fhir.Model.OperationParameterUse? Use { - get { return UseElement != null ? UseElement.Value : null; } + get => _UseElement?.Value; set { - if (value == null) - UseElement = null; - else - UseElement = new Code(value); + UseElement = value is null ? null : new Code(value); OnPropertyChanged("Use"); } } @@ -129,13 +126,13 @@ public Hl7.Fhir.Model.OperationParameterUse? Use /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Minimum cardinality @@ -144,13 +141,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -160,28 +154,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Maximum cardinality (a number of *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -191,28 +182,25 @@ public string Max /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// A brief description of the parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -225,13 +213,13 @@ public string Documentation [Binding("FHIRTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// What type of value @@ -240,13 +228,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.FHIRAllTypes? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -256,49 +241,42 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type /// [FhirElement("profile", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Canonical ProfileElement + public Hl7.Fhir.Model.Canonical? ProfileElement { get { return _ProfileElement; } set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private Hl7.Fhir.Model.Canonical _ProfileElement; + private Hl7.Fhir.Model.Canonical? _ProfileElement; /// /// What profile the value is expected to be /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Profile + public string? Profile { - get { return ProfileElement != null ? ProfileElement.Value : null; } + get => _ProfileElement?.Value; set { - if (value == null) - ProfileElement = null; - else - ProfileElement = new Hl7.Fhir.Model.Canonical(value); + ProfileElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Profile"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterDefinition; - - if (dest == null) - { + if(other is not ParameterDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(UseElement != null) dest.UseElement = (Code)UseElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ProfileElement != null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)ProfileElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_UseElement is not null) dest.UseElement = (Code)_UseElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ProfileElement is not null) dest.ProfileElement = (Hl7.Fhir.Model.Canonical)_ProfileElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -310,76 +288,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterDefinition; - if(otherT == null) return false; + if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(UseElement, otherT.UseElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ProfileElement, otherT.ProfileElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "use": - value = UseElement; - return UseElement is not null; + value = _UseElement; + return _UseElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "profile": - value = ProfileElement; - return ProfileElement is not null; + value = _ProfileElement; + return _ProfileElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "use": - UseElement = (Code)value; + UseElement = (Code?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "profile": - ProfileElement = (Hl7.Fhir.Model.Canonical)value; + ProfileElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -390,13 +368,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (UseElement is not null) yield return new KeyValuePair("use",UseElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ProfileElement is not null) yield return new KeyValuePair("profile",ProfileElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_UseElement is not null) yield return new KeyValuePair("use",_UseElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ProfileElement is not null) yield return new KeyValuePair("profile",_ProfileElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Patient.cs b/src/Hl7.Fhir.R5/Model/Generated/Patient.cs index b66eeafc4..80a51c4fc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Patient.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -118,24 +121,24 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// A name associated with the contact person. /// [FhirElement("name", Order=50)] [DataMember] - public Hl7.Fhir.Model.HumanName Name + public Hl7.Fhir.Model.HumanName? Name { get { return _Name; } set { _Name = value; OnPropertyChanged("Name"); } } - private Hl7.Fhir.Model.HumanName _Name; + private Hl7.Fhir.Model.HumanName? _Name; /// /// A contact detail for the person. @@ -145,24 +148,24 @@ public Hl7.Fhir.Model.HumanName Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// Address for the contact person. /// [FhirElement("address", Order=70)] [DataMember] - public Hl7.Fhir.Model.Address Address + public Hl7.Fhir.Model.Address? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.Address _Address; + private Hl7.Fhir.Model.Address? _Address; /// /// male | female | other | unknown. @@ -171,13 +174,13 @@ public Hl7.Fhir.Model.Address Address [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -186,13 +189,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -204,44 +204,40 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// The period during which this contact person or organization is valid to be contacted relating to this patient. /// [FhirElement("period", Order=100)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ContactComponent; - - if (dest == null) - { + if(other is not ContactComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(Name != null) dest.Name = (Hl7.Fhir.Model.HumanName)Name.DeepCopyInternal(); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(Address != null) dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopyInternal(); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_Name is not null) dest.Name = (Hl7.Fhir.Model.HumanName)_Name.DeepCopyInternal(); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.Address)_Address.DeepCopyInternal(); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -253,76 +249,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContactComponent; - if(otherT == null) return false; + if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "name": - value = Name; - return Name is not null; + value = _Name; + return _Name is not null; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "name": - Name = (Hl7.Fhir.Model.HumanName)value; + Name = (Hl7.Fhir.Model.HumanName?)value; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "address": - Address = (Hl7.Fhir.Model.Address)value; + Address = (Hl7.Fhir.Model.Address?)value; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -333,13 +329,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (Name is not null) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_Name is not null) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -367,26 +363,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -395,29 +391,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -429,41 +418,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -474,8 +463,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -504,13 +493,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Other + public Hl7.Fhir.Model.ResourceReference? Other { get { return _Other; } set { _Other = value; OnPropertyChanged("Other"); } } - private Hl7.Fhir.Model.ResourceReference _Other; + private Hl7.Fhir.Model.ResourceReference? _Other; /// /// replaced-by | replaces | refer | seealso. @@ -520,13 +509,13 @@ public Hl7.Fhir.Model.ResourceReference Other [Binding("LinkType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// replaced-by | replaces | refer | seealso @@ -535,29 +524,22 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Patient.LinkType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Other != null) dest.Other = (Hl7.Fhir.Model.ResourceReference)Other.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); + if(_Other is not null) dest.Other = (Hl7.Fhir.Model.ResourceReference)_Other.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -569,41 +551,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Other, otherT.Other)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "other": - value = Other; - return Other is not null; + value = _Other; + return _Other is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "other": - Other = (Hl7.Fhir.Model.ResourceReference)value; + Other = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -614,8 +596,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Other is not null) yield return new KeyValuePair("other",Other); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); + if (_Other is not null) yield return new KeyValuePair("other",_Other); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); } } @@ -628,24 +610,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this patient's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this patient's record is in active use @@ -654,13 +636,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -673,11 +652,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the individual. @@ -687,11 +666,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -700,13 +679,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -715,13 +694,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -731,28 +707,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date of birth for the individual /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -764,13 +737,13 @@ public string BirthDate [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// An address for the individual. @@ -780,11 +753,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Marital (civil) status of a patient. @@ -792,13 +765,13 @@ public List Address [FhirElement("maritalStatus", Order=170)] [Binding("MaritalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MaritalStatus + public Hl7.Fhir.Model.CodeableConcept? MaritalStatus { get { return _MaritalStatus; } set { _MaritalStatus = value; OnPropertyChanged("MaritalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _MaritalStatus; + private Hl7.Fhir.Model.CodeableConcept? _MaritalStatus; /// /// Whether patient is part of a multiple birth. @@ -807,13 +780,13 @@ public Hl7.Fhir.Model.CodeableConcept MaritalStatus [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer))] [DataMember] - public Hl7.Fhir.Model.DataType MultipleBirth + public Hl7.Fhir.Model.DataType? MultipleBirth { get { return _MultipleBirth; } set { _MultipleBirth = value; OnPropertyChanged("MultipleBirth"); } } - private Hl7.Fhir.Model.DataType _MultipleBirth; + private Hl7.Fhir.Model.DataType? _MultipleBirth; /// /// Image of the patient. @@ -823,11 +796,11 @@ public Hl7.Fhir.Model.DataType MultipleBirth [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// A contact party (e.g. guardian, partner, friend) for the patient. @@ -837,11 +810,11 @@ public List Photo [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// A language which may be used to communicate with the patient about his or her health. @@ -851,11 +824,11 @@ public List Contact [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Patient's nominated primary care provider. @@ -867,11 +840,11 @@ public List Communication [DataMember] public List GeneralPractitioner { - get { if(_GeneralPractitioner==null) _GeneralPractitioner = new List(); return _GeneralPractitioner; } + get => _GeneralPractitioner ?? new List(); set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } - private List _GeneralPractitioner; + private List? _GeneralPractitioner; /// /// Organization that is the custodian of the patient record. @@ -880,13 +853,13 @@ public List GeneralPractitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Link to a Patient or RelatedPerson resource that concerns the same actual individual. @@ -896,40 +869,36 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Patient; - - if (dest == null) - { + if(other is not Patient dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(MaritalStatus != null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)MaritalStatus.DeepCopyInternal(); - if(MultipleBirth != null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)MultipleBirth.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(GeneralPractitioner.Any()) dest.GeneralPractitioner = new List(GeneralPractitioner.DeepCopyInternal()); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_MaritalStatus is not null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)_MaritalStatus.DeepCopyInternal(); + if(_MultipleBirth is not null) dest.MultipleBirth = (Hl7.Fhir.Model.DataType)_MultipleBirth.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_GeneralPractitioner is not null) dest.GeneralPractitioner = new List(_GeneralPractitioner.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -941,139 +910,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Patient; - if(otherT == null) return false; + if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(MaritalStatus, otherT.MaritalStatus)) return false; - if(!comparer.Equals(MultipleBirth, otherT.MultipleBirth)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(GeneralPractitioner, otherT.GeneralPractitioner)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_MaritalStatus, otherT._MaritalStatus)) return false; + if(!comparer.Equals(_MultipleBirth, otherT._MultipleBirth)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "maritalStatus": - value = MaritalStatus; - return MaritalStatus is not null; + value = _MaritalStatus; + return _MaritalStatus is not null; case "multipleBirth": - value = MultipleBirth; - return MultipleBirth is not null; + value = _MultipleBirth; + return _MultipleBirth is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "generalPractitioner": - value = GeneralPractitioner; - return GeneralPractitioner?.Any() == true; + value = _GeneralPractitioner; + return _GeneralPractitioner?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "maritalStatus": - MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + MaritalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "multipleBirth": - MultipleBirth = (Hl7.Fhir.Model.DataType)value; + MultipleBirth = (Hl7.Fhir.Model.DataType?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "generalPractitioner": - GeneralPractitioner = (List)value; + GeneralPractitioner = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1084,22 +1053,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",MaritalStatus); - if (MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",MultipleBirth); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",GeneralPractitioner); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",_MaritalStatus); + if (_MultipleBirth is not null) yield return new KeyValuePair("multipleBirth",_MultipleBirth); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_GeneralPractitioner?.Any() == true) yield return new KeyValuePair("generalPractitioner",_GeneralPractitioner); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs index 180261b4b..0d6f2630c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,11 +70,11 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -81,13 +84,13 @@ public List Identifier [Binding("PaymentNoticeStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -96,13 +99,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -114,13 +114,13 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Response reference. @@ -129,13 +129,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Creation date. @@ -143,28 +143,25 @@ public Hl7.Fhir.Model.ResourceReference Response [FhirElement("created", InSummary=true, Order=130, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -176,13 +173,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reporter + public Hl7.Fhir.Model.ResourceReference? Reporter { get { return _Reporter; } set { _Reporter = value; OnPropertyChanged("Reporter"); } } - private Hl7.Fhir.Model.ResourceReference _Reporter; + private Hl7.Fhir.Model.ResourceReference? _Reporter; /// /// Payment reference. @@ -191,41 +188,38 @@ public Hl7.Fhir.Model.ResourceReference Reporter [CLSCompliant(false)] [References("PaymentReconciliation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payment + public Hl7.Fhir.Model.ResourceReference? Payment { get { return _Payment; } set { _Payment = value; OnPropertyChanged("Payment"); } } - private Hl7.Fhir.Model.ResourceReference _Payment; + private Hl7.Fhir.Model.ResourceReference? _Payment; /// /// Payment or clearing date. /// [FhirElement("paymentDate", Order=160)] [DataMember] - public Hl7.Fhir.Model.Date PaymentDateElement + public Hl7.Fhir.Model.Date? PaymentDateElement { get { return _PaymentDateElement; } set { _PaymentDateElement = value; OnPropertyChanged("PaymentDateElement"); } } - private Hl7.Fhir.Model.Date _PaymentDateElement; + private Hl7.Fhir.Model.Date? _PaymentDateElement; /// /// Payment or clearing date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaymentDate + public string? PaymentDate { - get { return PaymentDateElement != null ? PaymentDateElement.Value : null; } + get => _PaymentDateElement?.Value; set { - if (value == null) - PaymentDateElement = null; - else - PaymentDateElement = new Hl7.Fhir.Model.Date(value); + PaymentDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("PaymentDate"); } } @@ -237,13 +231,13 @@ public string PaymentDate [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payee + public Hl7.Fhir.Model.ResourceReference? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ResourceReference _Payee; + private Hl7.Fhir.Model.ResourceReference? _Payee; /// /// Party being notified. @@ -253,13 +247,13 @@ public Hl7.Fhir.Model.ResourceReference Payee [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recipient + public Hl7.Fhir.Model.ResourceReference? Recipient { get { return _Recipient; } set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private Hl7.Fhir.Model.ResourceReference _Recipient; + private Hl7.Fhir.Model.ResourceReference? _Recipient; /// /// Monetary amount of the payment. @@ -267,13 +261,13 @@ public Hl7.Fhir.Model.ResourceReference Recipient [FhirElement("amount", InSummary=true, Order=190)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Issued or cleared Status of the payment. @@ -281,38 +275,34 @@ public Hl7.Fhir.Model.Money Amount [FhirElement("paymentStatus", Order=200)] [Binding("PaymentStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PaymentStatus + public Hl7.Fhir.Model.CodeableConcept? PaymentStatus { get { return _PaymentStatus; } set { _PaymentStatus = value; OnPropertyChanged("PaymentStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _PaymentStatus; + private Hl7.Fhir.Model.CodeableConcept? _PaymentStatus; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentNotice; - - if (dest == null) - { + if(other is not PaymentNotice dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Reporter != null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)Reporter.DeepCopyInternal(); - if(Payment != null) dest.Payment = (Hl7.Fhir.Model.ResourceReference)Payment.DeepCopyInternal(); - if(PaymentDateElement != null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)PaymentDateElement.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopyInternal(); - if(Recipient != null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)Recipient.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(PaymentStatus != null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)PaymentStatus.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Reporter is not null) dest.Reporter = (Hl7.Fhir.Model.ResourceReference)_Reporter.DeepCopyInternal(); + if(_Payment is not null) dest.Payment = (Hl7.Fhir.Model.ResourceReference)_Payment.DeepCopyInternal(); + if(_PaymentDateElement is not null) dest.PaymentDateElement = (Hl7.Fhir.Model.Date)_PaymentDateElement.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)_Payee.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = (Hl7.Fhir.Model.ResourceReference)_Recipient.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_PaymentStatus is not null) dest.PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)_PaymentStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -324,111 +314,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentNotice; - if(otherT == null) return false; + if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Reporter, otherT.Reporter)) return false; - if(!comparer.Equals(Payment, otherT.Payment)) return false; - if(!comparer.Equals(PaymentDateElement, otherT.PaymentDateElement)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Recipient, otherT.Recipient)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(PaymentStatus, otherT.PaymentStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Reporter, otherT._Reporter)) return false; + if(!comparer.Equals(_Payment, otherT._Payment)) return false; + if(!comparer.Equals(_PaymentDateElement, otherT._PaymentDateElement)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "reporter": - value = Reporter; - return Reporter is not null; + value = _Reporter; + return _Reporter is not null; case "payment": - value = Payment; - return Payment is not null; + value = _Payment; + return _Payment is not null; case "paymentDate": - value = PaymentDateElement; - return PaymentDateElement is not null; + value = _PaymentDateElement; + return _PaymentDateElement is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "recipient": - value = Recipient; - return Recipient is not null; + value = _Recipient; + return _Recipient is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "paymentStatus": - value = PaymentStatus; - return PaymentStatus is not null; + value = _PaymentStatus; + return _PaymentStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "reporter": - Reporter = (Hl7.Fhir.Model.ResourceReference)value; + Reporter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payment": - Payment = (Hl7.Fhir.Model.ResourceReference)value; + Payment = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "paymentDate": - PaymentDateElement = (Hl7.Fhir.Model.Date)value; + PaymentDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ResourceReference)value; + Payee = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "recipient": - Recipient = (Hl7.Fhir.Model.ResourceReference)value; + Recipient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "paymentStatus": - PaymentStatus = (Hl7.Fhir.Model.CodeableConcept)value; + PaymentStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -439,18 +429,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Reporter is not null) yield return new KeyValuePair("reporter",Reporter); - if (Payment is not null) yield return new KeyValuePair("payment",Payment); - if (PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",PaymentDateElement); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Recipient is not null) yield return new KeyValuePair("recipient",Recipient); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",PaymentStatus); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Reporter is not null) yield return new KeyValuePair("reporter",_Reporter); + if (_Payment is not null) yield return new KeyValuePair("payment",_Payment); + if (_PaymentDateElement is not null) yield return new KeyValuePair("paymentDate",_PaymentDateElement); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Recipient is not null) yield return new KeyValuePair("recipient",_Recipient); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_PaymentStatus is not null) yield return new KeyValuePair("paymentStatus",_PaymentStatus); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs index 7ac17a281..69619c836 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -114,26 +117,26 @@ public partial class AllocationComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business identifier of the prior payment detail. /// [FhirElement("predecessor", Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Predecessor + public Hl7.Fhir.Model.Identifier? Predecessor { get { return _Predecessor; } set { _Predecessor = value; OnPropertyChanged("Predecessor"); } } - private Hl7.Fhir.Model.Identifier _Predecessor; + private Hl7.Fhir.Model.Identifier? _Predecessor; /// /// Subject of the payment. @@ -142,13 +145,13 @@ public Hl7.Fhir.Model.Identifier Predecessor [CLSCompliant(false)] [References("Claim","Account","Invoice","ChargeItem","Encounter","Contract")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// Sub-element of the subject. @@ -157,13 +160,13 @@ public Hl7.Fhir.Model.ResourceReference Target [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.PositiveInt))] [DataMember] - public Hl7.Fhir.Model.DataType TargetItem + public Hl7.Fhir.Model.DataType? TargetItem { get { return _TargetItem; } set { _TargetItem = value; OnPropertyChanged("TargetItem"); } } - private Hl7.Fhir.Model.DataType _TargetItem; + private Hl7.Fhir.Model.DataType? _TargetItem; /// /// Applied-to encounter. @@ -172,13 +175,13 @@ public Hl7.Fhir.Model.DataType TargetItem [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Applied-to account. @@ -187,13 +190,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [References("Account")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Account + public Hl7.Fhir.Model.ResourceReference? Account { get { return _Account; } set { _Account = value; OnPropertyChanged("Account"); } } - private Hl7.Fhir.Model.ResourceReference _Account; + private Hl7.Fhir.Model.ResourceReference? _Account; /// /// Category of payment. @@ -201,13 +204,13 @@ public Hl7.Fhir.Model.ResourceReference Account [FhirElement("type", Order=100)] [Binding("PaymentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Submitter of the request. @@ -216,13 +219,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Submitter + public Hl7.Fhir.Model.ResourceReference? Submitter { get { return _Submitter; } set { _Submitter = value; OnPropertyChanged("Submitter"); } } - private Hl7.Fhir.Model.ResourceReference _Submitter; + private Hl7.Fhir.Model.ResourceReference? _Submitter; /// /// Response committing to a payment. @@ -231,41 +234,38 @@ public Hl7.Fhir.Model.ResourceReference Submitter [CLSCompliant(false)] [References("ClaimResponse")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Response + public Hl7.Fhir.Model.ResourceReference? Response { get { return _Response; } set { _Response = value; OnPropertyChanged("Response"); } } - private Hl7.Fhir.Model.ResourceReference _Response; + private Hl7.Fhir.Model.ResourceReference? _Response; /// /// Date of commitment to pay. /// [FhirElement("date", Order=130)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// Date of commitment to pay /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -277,13 +277,13 @@ public string Date [CLSCompliant(false)] [References("PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Responsible + public Hl7.Fhir.Model.ResourceReference? Responsible { get { return _Responsible; } set { _Responsible = value; OnPropertyChanged("Responsible"); } } - private Hl7.Fhir.Model.ResourceReference _Responsible; + private Hl7.Fhir.Model.ResourceReference? _Responsible; /// /// Recipient of the payment. @@ -292,50 +292,46 @@ public Hl7.Fhir.Model.ResourceReference Responsible [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Payee + public Hl7.Fhir.Model.ResourceReference? Payee { get { return _Payee; } set { _Payee = value; OnPropertyChanged("Payee"); } } - private Hl7.Fhir.Model.ResourceReference _Payee; + private Hl7.Fhir.Model.ResourceReference? _Payee; /// /// Amount allocated to this payable. /// [FhirElement("amount", Order=160)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as AllocationComponent; - - if (dest == null) - { + if(other is not AllocationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Predecessor != null) dest.Predecessor = (Hl7.Fhir.Model.Identifier)Predecessor.DeepCopyInternal(); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(TargetItem != null) dest.TargetItem = (Hl7.Fhir.Model.DataType)TargetItem.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Account != null) dest.Account = (Hl7.Fhir.Model.ResourceReference)Account.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Submitter != null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)Submitter.DeepCopyInternal(); - if(Response != null) dest.Response = (Hl7.Fhir.Model.ResourceReference)Response.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Responsible != null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)Responsible.DeepCopyInternal(); - if(Payee != null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)Payee.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Predecessor is not null) dest.Predecessor = (Hl7.Fhir.Model.Identifier)_Predecessor.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_TargetItem is not null) dest.TargetItem = (Hl7.Fhir.Model.DataType)_TargetItem.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Account is not null) dest.Account = (Hl7.Fhir.Model.ResourceReference)_Account.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Submitter is not null) dest.Submitter = (Hl7.Fhir.Model.ResourceReference)_Submitter.DeepCopyInternal(); + if(_Response is not null) dest.Response = (Hl7.Fhir.Model.ResourceReference)_Response.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Responsible is not null) dest.Responsible = (Hl7.Fhir.Model.ResourceReference)_Responsible.DeepCopyInternal(); + if(_Payee is not null) dest.Payee = (Hl7.Fhir.Model.ResourceReference)_Payee.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -347,118 +343,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AllocationComponent; - if(otherT == null) return false; + if(other is not AllocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Predecessor, otherT.Predecessor)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(TargetItem, otherT.TargetItem)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Account, otherT.Account)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Submitter, otherT.Submitter)) return false; - if(!comparer.Equals(Response, otherT.Response)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Responsible, otherT.Responsible)) return false; - if(!comparer.Equals(Payee, otherT.Payee)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; + if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_TargetItem, otherT._TargetItem)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Account, otherT._Account)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Submitter, otherT._Submitter)) return false; + if(!comparer.Equals(_Response, otherT._Response)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; + if(!comparer.Equals(_Payee, otherT._Payee)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "predecessor": - value = Predecessor; - return Predecessor is not null; + value = _Predecessor; + return _Predecessor is not null; case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "targetItem": - value = TargetItem; - return TargetItem is not null; + value = _TargetItem; + return _TargetItem is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "account": - value = Account; - return Account is not null; + value = _Account; + return _Account is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "submitter": - value = Submitter; - return Submitter is not null; + value = _Submitter; + return _Submitter is not null; case "response": - value = Response; - return Response is not null; + value = _Response; + return _Response is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "responsible": - value = Responsible; - return Responsible is not null; + value = _Responsible; + return _Responsible is not null; case "payee": - value = Payee; - return Payee is not null; + value = _Payee; + return _Payee is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "predecessor": - Predecessor = (Hl7.Fhir.Model.Identifier)value; + Predecessor = (Hl7.Fhir.Model.Identifier?)value; return this; case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "targetItem": - TargetItem = (Hl7.Fhir.Model.DataType)value; + TargetItem = (Hl7.Fhir.Model.DataType?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "account": - Account = (Hl7.Fhir.Model.ResourceReference)value; + Account = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "submitter": - Submitter = (Hl7.Fhir.Model.ResourceReference)value; + Submitter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "response": - Response = (Hl7.Fhir.Model.ResourceReference)value; + Response = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "responsible": - Responsible = (Hl7.Fhir.Model.ResourceReference)value; + Responsible = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "payee": - Payee = (Hl7.Fhir.Model.ResourceReference)value; + Payee = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; default: return base.SetValue(key, value); @@ -469,19 +465,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Predecessor is not null) yield return new KeyValuePair("predecessor",Predecessor); - if (Target is not null) yield return new KeyValuePair("target",Target); - if (TargetItem is not null) yield return new KeyValuePair("targetItem",TargetItem); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Account is not null) yield return new KeyValuePair("account",Account); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Submitter is not null) yield return new KeyValuePair("submitter",Submitter); - if (Response is not null) yield return new KeyValuePair("response",Response); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Responsible is not null) yield return new KeyValuePair("responsible",Responsible); - if (Payee is not null) yield return new KeyValuePair("payee",Payee); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Predecessor is not null) yield return new KeyValuePair("predecessor",_Predecessor); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_TargetItem is not null) yield return new KeyValuePair("targetItem",_TargetItem); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Account is not null) yield return new KeyValuePair("account",_Account); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Submitter is not null) yield return new KeyValuePair("submitter",_Submitter); + if (_Response is not null) yield return new KeyValuePair("response",_Response); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Responsible is not null) yield return new KeyValuePair("responsible",_Responsible); + if (_Payee is not null) yield return new KeyValuePair("payee",_Payee); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -509,13 +505,13 @@ public partial class NotesComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("NoteType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// display | print | printoper @@ -524,13 +520,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.NoteType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -540,44 +533,37 @@ public Hl7.Fhir.Model.NoteType? Type /// [FhirElement("text", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Note explanatory text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as NotesComponent; - - if (dest == null) - { + if(other is not NotesComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -589,41 +575,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotesComponent; - if(otherT == null) return false; + if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -634,8 +620,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); } } @@ -648,11 +634,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Category of payment. @@ -661,13 +647,13 @@ public List Identifier [Binding("PaymentType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// active | cancelled | draft | entered-in-error. @@ -677,13 +663,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("PaymentReconciliationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -692,13 +678,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -709,26 +692,26 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("kind", Order=120)] [Binding("PaymentKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Kind + public Hl7.Fhir.Model.CodeableConcept? Kind { get { return _Kind; } set { _Kind = value; OnPropertyChanged("Kind"); } } - private Hl7.Fhir.Model.CodeableConcept _Kind; + private Hl7.Fhir.Model.CodeableConcept? _Kind; /// /// Period covered. /// [FhirElement("period", InSummary=true, Order=130, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Creation date. @@ -736,28 +719,25 @@ public Hl7.Fhir.Model.Period Period [FhirElement("created", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -769,13 +749,13 @@ public string Created [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Enterer + public Hl7.Fhir.Model.ResourceReference? Enterer { get { return _Enterer; } set { _Enterer = value; OnPropertyChanged("Enterer"); } } - private Hl7.Fhir.Model.ResourceReference _Enterer; + private Hl7.Fhir.Model.ResourceReference? _Enterer; /// /// Nature of the source. @@ -783,13 +763,13 @@ public Hl7.Fhir.Model.ResourceReference Enterer [FhirElement("issuerType", Order=160)] [Binding("PaymentIssuerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept IssuerType + public Hl7.Fhir.Model.CodeableConcept? IssuerType { get { return _IssuerType; } set { _IssuerType = value; OnPropertyChanged("IssuerType"); } } - private Hl7.Fhir.Model.CodeableConcept _IssuerType; + private Hl7.Fhir.Model.CodeableConcept? _IssuerType; /// /// Party generating payment. @@ -798,13 +778,13 @@ public Hl7.Fhir.Model.CodeableConcept IssuerType [CLSCompliant(false)] [References("Organization","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference PaymentIssuer + public Hl7.Fhir.Model.ResourceReference? PaymentIssuer { get { return _PaymentIssuer; } set { _PaymentIssuer = value; OnPropertyChanged("PaymentIssuer"); } } - private Hl7.Fhir.Model.ResourceReference _PaymentIssuer; + private Hl7.Fhir.Model.ResourceReference? _PaymentIssuer; /// /// Reference to requesting resource. @@ -813,13 +793,13 @@ public Hl7.Fhir.Model.ResourceReference PaymentIssuer [CLSCompliant(false)] [References("Task")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Request + public Hl7.Fhir.Model.ResourceReference? Request { get { return _Request; } set { _Request = value; OnPropertyChanged("Request"); } } - private Hl7.Fhir.Model.ResourceReference _Request; + private Hl7.Fhir.Model.ResourceReference? _Request; /// /// Responsible practitioner. @@ -828,13 +808,13 @@ public Hl7.Fhir.Model.ResourceReference Request [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requestor + public Hl7.Fhir.Model.ResourceReference? Requestor { get { return _Requestor; } set { _Requestor = value; OnPropertyChanged("Requestor"); } } - private Hl7.Fhir.Model.ResourceReference _Requestor; + private Hl7.Fhir.Model.ResourceReference? _Requestor; /// /// queued | complete | error | partial. @@ -843,13 +823,13 @@ public Hl7.Fhir.Model.ResourceReference Requestor [DeclaredType(Type = typeof(Code))] [Binding("PaymentOutcome")] [DataMember] - public Code OutcomeElement + public Code? OutcomeElement { get { return _OutcomeElement; } set { _OutcomeElement = value; OnPropertyChanged("OutcomeElement"); } } - private Code _OutcomeElement; + private Code? _OutcomeElement; /// /// queued | complete | error | partial @@ -858,13 +838,10 @@ public Code OutcomeElement [IgnoreDataMember] public Hl7.Fhir.Model.PaymentReconciliation.PaymentOutcome? Outcome { - get { return OutcomeElement != null ? OutcomeElement.Value : null; } + get => _OutcomeElement?.Value; set { - if (value == null) - OutcomeElement = null; - else - OutcomeElement = new Code(value); + OutcomeElement = value is null ? null : new Code(value); OnPropertyChanged("Outcome"); } } @@ -874,28 +851,25 @@ public Hl7.Fhir.Model.PaymentReconciliation.PaymentOutcome? Outcome /// [FhirElement("disposition", Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString DispositionElement + public Hl7.Fhir.Model.FhirString? DispositionElement { get { return _DispositionElement; } set { _DispositionElement = value; OnPropertyChanged("DispositionElement"); } } - private Hl7.Fhir.Model.FhirString _DispositionElement; + private Hl7.Fhir.Model.FhirString? _DispositionElement; /// /// Disposition message /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Disposition + public string? Disposition { - get { return DispositionElement != null ? DispositionElement.Value : null; } + get => _DispositionElement?.Value; set { - if (value == null) - DispositionElement = null; - else - DispositionElement = new Hl7.Fhir.Model.FhirString(value); + DispositionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Disposition"); } } @@ -906,28 +880,25 @@ public string Disposition [FhirElement("date", InSummary=true, Order=220)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// When payment issued /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -939,13 +910,13 @@ public string Date [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Payment instrument. @@ -953,41 +924,38 @@ public Hl7.Fhir.Model.ResourceReference Location [FhirElement("method", Order=240)] [Binding("PaymentMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of card. /// [FhirElement("cardBrand", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CardBrandElement + public Hl7.Fhir.Model.FhirString? CardBrandElement { get { return _CardBrandElement; } set { _CardBrandElement = value; OnPropertyChanged("CardBrandElement"); } } - private Hl7.Fhir.Model.FhirString _CardBrandElement; + private Hl7.Fhir.Model.FhirString? _CardBrandElement; /// /// Type of card /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CardBrand + public string? CardBrand { - get { return CardBrandElement != null ? CardBrandElement.Value : null; } + get => _CardBrandElement?.Value; set { - if (value == null) - CardBrandElement = null; - else - CardBrandElement = new Hl7.Fhir.Model.FhirString(value); + CardBrandElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CardBrand"); } } @@ -997,28 +965,25 @@ public string CardBrand /// [FhirElement("accountNumber", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString AccountNumberElement + public Hl7.Fhir.Model.FhirString? AccountNumberElement { get { return _AccountNumberElement; } set { _AccountNumberElement = value; OnPropertyChanged("AccountNumberElement"); } } - private Hl7.Fhir.Model.FhirString _AccountNumberElement; + private Hl7.Fhir.Model.FhirString? _AccountNumberElement; /// /// Digits for verification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AccountNumber + public string? AccountNumber { - get { return AccountNumberElement != null ? AccountNumberElement.Value : null; } + get => _AccountNumberElement?.Value; set { - if (value == null) - AccountNumberElement = null; - else - AccountNumberElement = new Hl7.Fhir.Model.FhirString(value); + AccountNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AccountNumber"); } } @@ -1028,28 +993,25 @@ public string AccountNumber /// [FhirElement("expirationDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ExpirationDateElement + public Hl7.Fhir.Model.Date? ExpirationDateElement { get { return _ExpirationDateElement; } set { _ExpirationDateElement = value; OnPropertyChanged("ExpirationDateElement"); } } - private Hl7.Fhir.Model.Date _ExpirationDateElement; + private Hl7.Fhir.Model.Date? _ExpirationDateElement; /// /// Expiration year-month /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExpirationDate + public string? ExpirationDate { - get { return ExpirationDateElement != null ? ExpirationDateElement.Value : null; } + get => _ExpirationDateElement?.Value; set { - if (value == null) - ExpirationDateElement = null; - else - ExpirationDateElement = new Hl7.Fhir.Model.Date(value); + ExpirationDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ExpirationDate"); } } @@ -1059,28 +1021,25 @@ public string ExpirationDate /// [FhirElement("processor", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirString ProcessorElement + public Hl7.Fhir.Model.FhirString? ProcessorElement { get { return _ProcessorElement; } set { _ProcessorElement = value; OnPropertyChanged("ProcessorElement"); } } - private Hl7.Fhir.Model.FhirString _ProcessorElement; + private Hl7.Fhir.Model.FhirString? _ProcessorElement; /// /// Processor name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Processor + public string? Processor { - get { return ProcessorElement != null ? ProcessorElement.Value : null; } + get => _ProcessorElement?.Value; set { - if (value == null) - ProcessorElement = null; - else - ProcessorElement = new Hl7.Fhir.Model.FhirString(value); + ProcessorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Processor"); } } @@ -1090,28 +1049,25 @@ public string Processor /// [FhirElement("referenceNumber", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirString ReferenceNumberElement + public Hl7.Fhir.Model.FhirString? ReferenceNumberElement { get { return _ReferenceNumberElement; } set { _ReferenceNumberElement = value; OnPropertyChanged("ReferenceNumberElement"); } } - private Hl7.Fhir.Model.FhirString _ReferenceNumberElement; + private Hl7.Fhir.Model.FhirString? _ReferenceNumberElement; /// /// Check number or payment reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReferenceNumber + public string? ReferenceNumber { - get { return ReferenceNumberElement != null ? ReferenceNumberElement.Value : null; } + get => _ReferenceNumberElement?.Value; set { - if (value == null) - ReferenceNumberElement = null; - else - ReferenceNumberElement = new Hl7.Fhir.Model.FhirString(value); + ReferenceNumberElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ReferenceNumber"); } } @@ -1121,28 +1077,25 @@ public string ReferenceNumber /// [FhirElement("authorization", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirString AuthorizationElement + public Hl7.Fhir.Model.FhirString? AuthorizationElement { get { return _AuthorizationElement; } set { _AuthorizationElement = value; OnPropertyChanged("AuthorizationElement"); } } - private Hl7.Fhir.Model.FhirString _AuthorizationElement; + private Hl7.Fhir.Model.FhirString? _AuthorizationElement; /// /// Authorization number /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authorization + public string? Authorization { - get { return AuthorizationElement != null ? AuthorizationElement.Value : null; } + get => _AuthorizationElement?.Value; set { - if (value == null) - AuthorizationElement = null; - else - AuthorizationElement = new Hl7.Fhir.Model.FhirString(value); + AuthorizationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Authorization"); } } @@ -1152,26 +1105,26 @@ public string Authorization /// [FhirElement("tenderedAmount", Order=310)] [DataMember] - public Hl7.Fhir.Model.Money TenderedAmount + public Hl7.Fhir.Model.Money? TenderedAmount { get { return _TenderedAmount; } set { _TenderedAmount = value; OnPropertyChanged("TenderedAmount"); } } - private Hl7.Fhir.Model.Money _TenderedAmount; + private Hl7.Fhir.Model.Money? _TenderedAmount; /// /// Amount returned by the receiver. /// [FhirElement("returnedAmount", Order=320)] [DataMember] - public Hl7.Fhir.Model.Money ReturnedAmount + public Hl7.Fhir.Model.Money? ReturnedAmount { get { return _ReturnedAmount; } set { _ReturnedAmount = value; OnPropertyChanged("ReturnedAmount"); } } - private Hl7.Fhir.Model.Money _ReturnedAmount; + private Hl7.Fhir.Model.Money? _ReturnedAmount; /// /// Total amount of Payment. @@ -1179,26 +1132,26 @@ public Hl7.Fhir.Model.Money ReturnedAmount [FhirElement("amount", InSummary=true, Order=330)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Money Amount + public Hl7.Fhir.Model.Money? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Money _Amount; + private Hl7.Fhir.Model.Money? _Amount; /// /// Business identifier for the payment. /// [FhirElement("paymentIdentifier", Order=340)] [DataMember] - public Hl7.Fhir.Model.Identifier PaymentIdentifier + public Hl7.Fhir.Model.Identifier? PaymentIdentifier { get { return _PaymentIdentifier; } set { _PaymentIdentifier = value; OnPropertyChanged("PaymentIdentifier"); } } - private Hl7.Fhir.Model.Identifier _PaymentIdentifier; + private Hl7.Fhir.Model.Identifier? _PaymentIdentifier; /// /// Settlement particulars. @@ -1208,11 +1161,11 @@ public Hl7.Fhir.Model.Identifier PaymentIdentifier [DataMember] public List Allocation { - get { if(_Allocation==null) _Allocation = new List(); return _Allocation; } + get => _Allocation ?? new List(); set { _Allocation = value; OnPropertyChanged("Allocation"); } } - private List _Allocation; + private List? _Allocation; /// /// Printed form identifier. @@ -1220,13 +1173,13 @@ public List Allocation [FhirElement("formCode", Order=360)] [Binding("Forms")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FormCode + public Hl7.Fhir.Model.CodeableConcept? FormCode { get { return _FormCode; } set { _FormCode = value; OnPropertyChanged("FormCode"); } } - private Hl7.Fhir.Model.CodeableConcept _FormCode; + private Hl7.Fhir.Model.CodeableConcept? _FormCode; /// /// Note concerning processing. @@ -1236,53 +1189,49 @@ public Hl7.Fhir.Model.CodeableConcept FormCode [DataMember] public List ProcessNote { - get { if(_ProcessNote==null) _ProcessNote = new List(); return _ProcessNote; } + get => _ProcessNote ?? new List(); set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } - private List _ProcessNote; + private List? _ProcessNote; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PaymentReconciliation; - - if (dest == null) - { + if(other is not PaymentReconciliation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Kind != null) dest.Kind = (Hl7.Fhir.Model.CodeableConcept)Kind.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Enterer != null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopyInternal(); - if(IssuerType != null) dest.IssuerType = (Hl7.Fhir.Model.CodeableConcept)IssuerType.DeepCopyInternal(); - if(PaymentIssuer != null) dest.PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)PaymentIssuer.DeepCopyInternal(); - if(Request != null) dest.Request = (Hl7.Fhir.Model.ResourceReference)Request.DeepCopyInternal(); - if(Requestor != null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)Requestor.DeepCopyInternal(); - if(OutcomeElement != null) dest.OutcomeElement = (Code)OutcomeElement.DeepCopyInternal(); - if(DispositionElement != null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)DispositionElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(CardBrandElement != null) dest.CardBrandElement = (Hl7.Fhir.Model.FhirString)CardBrandElement.DeepCopyInternal(); - if(AccountNumberElement != null) dest.AccountNumberElement = (Hl7.Fhir.Model.FhirString)AccountNumberElement.DeepCopyInternal(); - if(ExpirationDateElement != null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)ExpirationDateElement.DeepCopyInternal(); - if(ProcessorElement != null) dest.ProcessorElement = (Hl7.Fhir.Model.FhirString)ProcessorElement.DeepCopyInternal(); - if(ReferenceNumberElement != null) dest.ReferenceNumberElement = (Hl7.Fhir.Model.FhirString)ReferenceNumberElement.DeepCopyInternal(); - if(AuthorizationElement != null) dest.AuthorizationElement = (Hl7.Fhir.Model.FhirString)AuthorizationElement.DeepCopyInternal(); - if(TenderedAmount != null) dest.TenderedAmount = (Hl7.Fhir.Model.Money)TenderedAmount.DeepCopyInternal(); - if(ReturnedAmount != null) dest.ReturnedAmount = (Hl7.Fhir.Model.Money)ReturnedAmount.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Money)Amount.DeepCopyInternal(); - if(PaymentIdentifier != null) dest.PaymentIdentifier = (Hl7.Fhir.Model.Identifier)PaymentIdentifier.DeepCopyInternal(); - if(Allocation.Any()) dest.Allocation = new List(Allocation.DeepCopyInternal()); - if(FormCode != null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)FormCode.DeepCopyInternal(); - if(ProcessNote.Any()) dest.ProcessNote = new List(ProcessNote.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Kind is not null) dest.Kind = (Hl7.Fhir.Model.CodeableConcept)_Kind.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Enterer is not null) dest.Enterer = (Hl7.Fhir.Model.ResourceReference)_Enterer.DeepCopyInternal(); + if(_IssuerType is not null) dest.IssuerType = (Hl7.Fhir.Model.CodeableConcept)_IssuerType.DeepCopyInternal(); + if(_PaymentIssuer is not null) dest.PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)_PaymentIssuer.DeepCopyInternal(); + if(_Request is not null) dest.Request = (Hl7.Fhir.Model.ResourceReference)_Request.DeepCopyInternal(); + if(_Requestor is not null) dest.Requestor = (Hl7.Fhir.Model.ResourceReference)_Requestor.DeepCopyInternal(); + if(_OutcomeElement is not null) dest.OutcomeElement = (Code)_OutcomeElement.DeepCopyInternal(); + if(_DispositionElement is not null) dest.DispositionElement = (Hl7.Fhir.Model.FhirString)_DispositionElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_CardBrandElement is not null) dest.CardBrandElement = (Hl7.Fhir.Model.FhirString)_CardBrandElement.DeepCopyInternal(); + if(_AccountNumberElement is not null) dest.AccountNumberElement = (Hl7.Fhir.Model.FhirString)_AccountNumberElement.DeepCopyInternal(); + if(_ExpirationDateElement is not null) dest.ExpirationDateElement = (Hl7.Fhir.Model.Date)_ExpirationDateElement.DeepCopyInternal(); + if(_ProcessorElement is not null) dest.ProcessorElement = (Hl7.Fhir.Model.FhirString)_ProcessorElement.DeepCopyInternal(); + if(_ReferenceNumberElement is not null) dest.ReferenceNumberElement = (Hl7.Fhir.Model.FhirString)_ReferenceNumberElement.DeepCopyInternal(); + if(_AuthorizationElement is not null) dest.AuthorizationElement = (Hl7.Fhir.Model.FhirString)_AuthorizationElement.DeepCopyInternal(); + if(_TenderedAmount is not null) dest.TenderedAmount = (Hl7.Fhir.Model.Money)_TenderedAmount.DeepCopyInternal(); + if(_ReturnedAmount is not null) dest.ReturnedAmount = (Hl7.Fhir.Model.Money)_ReturnedAmount.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Money)_Amount.DeepCopyInternal(); + if(_PaymentIdentifier is not null) dest.PaymentIdentifier = (Hl7.Fhir.Model.Identifier)_PaymentIdentifier.DeepCopyInternal(); + if(_Allocation is not null) dest.Allocation = new List(_Allocation.DeepCopyInternal()); + if(_FormCode is not null) dest.FormCode = (Hl7.Fhir.Model.CodeableConcept)_FormCode.DeepCopyInternal(); + if(_ProcessNote is not null) dest.ProcessNote = new List(_ProcessNote.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1294,230 +1243,230 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PaymentReconciliation; - if(otherT == null) return false; + if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Kind, otherT.Kind)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Enterer, otherT.Enterer)) return false; - if(!comparer.Equals(IssuerType, otherT.IssuerType)) return false; - if(!comparer.Equals(PaymentIssuer, otherT.PaymentIssuer)) return false; - if(!comparer.Equals(Request, otherT.Request)) return false; - if(!comparer.Equals(Requestor, otherT.Requestor)) return false; - if(!comparer.Equals(OutcomeElement, otherT.OutcomeElement)) return false; - if(!comparer.Equals(DispositionElement, otherT.DispositionElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(CardBrandElement, otherT.CardBrandElement)) return false; - if(!comparer.Equals(AccountNumberElement, otherT.AccountNumberElement)) return false; - if(!comparer.Equals(ExpirationDateElement, otherT.ExpirationDateElement)) return false; - if(!comparer.Equals(ProcessorElement, otherT.ProcessorElement)) return false; - if(!comparer.Equals(ReferenceNumberElement, otherT.ReferenceNumberElement)) return false; - if(!comparer.Equals(AuthorizationElement, otherT.AuthorizationElement)) return false; - if(!comparer.Equals(TenderedAmount, otherT.TenderedAmount)) return false; - if(!comparer.Equals(ReturnedAmount, otherT.ReturnedAmount)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(PaymentIdentifier, otherT.PaymentIdentifier)) return false; - if(!comparer.ListEquals(Allocation, otherT.Allocation)) return false; - if(!comparer.Equals(FormCode, otherT.FormCode)) return false; - if(!comparer.ListEquals(ProcessNote, otherT.ProcessNote)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Kind, otherT._Kind)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; + if(!comparer.Equals(_IssuerType, otherT._IssuerType)) return false; + if(!comparer.Equals(_PaymentIssuer, otherT._PaymentIssuer)) return false; + if(!comparer.Equals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_Requestor, otherT._Requestor)) return false; + if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; + if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_CardBrandElement, otherT._CardBrandElement)) return false; + if(!comparer.Equals(_AccountNumberElement, otherT._AccountNumberElement)) return false; + if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; + if(!comparer.Equals(_ProcessorElement, otherT._ProcessorElement)) return false; + if(!comparer.Equals(_ReferenceNumberElement, otherT._ReferenceNumberElement)) return false; + if(!comparer.Equals(_AuthorizationElement, otherT._AuthorizationElement)) return false; + if(!comparer.Equals(_TenderedAmount, otherT._TenderedAmount)) return false; + if(!comparer.Equals(_ReturnedAmount, otherT._ReturnedAmount)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_PaymentIdentifier, otherT._PaymentIdentifier)) return false; + if(!comparer.ListEquals(_Allocation, otherT._Allocation)) return false; + if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; + if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "kind": - value = Kind; - return Kind is not null; + value = _Kind; + return _Kind is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "enterer": - value = Enterer; - return Enterer is not null; + value = _Enterer; + return _Enterer is not null; case "issuerType": - value = IssuerType; - return IssuerType is not null; + value = _IssuerType; + return _IssuerType is not null; case "paymentIssuer": - value = PaymentIssuer; - return PaymentIssuer is not null; + value = _PaymentIssuer; + return _PaymentIssuer is not null; case "request": - value = Request; - return Request is not null; + value = _Request; + return _Request is not null; case "requestor": - value = Requestor; - return Requestor is not null; + value = _Requestor; + return _Requestor is not null; case "outcome": - value = OutcomeElement; - return OutcomeElement is not null; + value = _OutcomeElement; + return _OutcomeElement is not null; case "disposition": - value = DispositionElement; - return DispositionElement is not null; + value = _DispositionElement; + return _DispositionElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "cardBrand": - value = CardBrandElement; - return CardBrandElement is not null; + value = _CardBrandElement; + return _CardBrandElement is not null; case "accountNumber": - value = AccountNumberElement; - return AccountNumberElement is not null; + value = _AccountNumberElement; + return _AccountNumberElement is not null; case "expirationDate": - value = ExpirationDateElement; - return ExpirationDateElement is not null; + value = _ExpirationDateElement; + return _ExpirationDateElement is not null; case "processor": - value = ProcessorElement; - return ProcessorElement is not null; + value = _ProcessorElement; + return _ProcessorElement is not null; case "referenceNumber": - value = ReferenceNumberElement; - return ReferenceNumberElement is not null; + value = _ReferenceNumberElement; + return _ReferenceNumberElement is not null; case "authorization": - value = AuthorizationElement; - return AuthorizationElement is not null; + value = _AuthorizationElement; + return _AuthorizationElement is not null; case "tenderedAmount": - value = TenderedAmount; - return TenderedAmount is not null; + value = _TenderedAmount; + return _TenderedAmount is not null; case "returnedAmount": - value = ReturnedAmount; - return ReturnedAmount is not null; + value = _ReturnedAmount; + return _ReturnedAmount is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "paymentIdentifier": - value = PaymentIdentifier; - return PaymentIdentifier is not null; + value = _PaymentIdentifier; + return _PaymentIdentifier is not null; case "allocation": - value = Allocation; - return Allocation?.Any() == true; + value = _Allocation; + return _Allocation?.Any() == true; case "formCode": - value = FormCode; - return FormCode is not null; + value = _FormCode; + return _FormCode is not null; case "processNote": - value = ProcessNote; - return ProcessNote?.Any() == true; + value = _ProcessNote; + return _ProcessNote?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "kind": - Kind = (Hl7.Fhir.Model.CodeableConcept)value; + Kind = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "enterer": - Enterer = (Hl7.Fhir.Model.ResourceReference)value; + Enterer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "issuerType": - IssuerType = (Hl7.Fhir.Model.CodeableConcept)value; + IssuerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "paymentIssuer": - PaymentIssuer = (Hl7.Fhir.Model.ResourceReference)value; + PaymentIssuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "request": - Request = (Hl7.Fhir.Model.ResourceReference)value; + Request = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestor": - Requestor = (Hl7.Fhir.Model.ResourceReference)value; + Requestor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "outcome": - OutcomeElement = (Code)value; + OutcomeElement = (Code?)value; return this; case "disposition": - DispositionElement = (Hl7.Fhir.Model.FhirString)value; + DispositionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cardBrand": - CardBrandElement = (Hl7.Fhir.Model.FhirString)value; + CardBrandElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "accountNumber": - AccountNumberElement = (Hl7.Fhir.Model.FhirString)value; + AccountNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expirationDate": - ExpirationDateElement = (Hl7.Fhir.Model.Date)value; + ExpirationDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "processor": - ProcessorElement = (Hl7.Fhir.Model.FhirString)value; + ProcessorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "referenceNumber": - ReferenceNumberElement = (Hl7.Fhir.Model.FhirString)value; + ReferenceNumberElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "authorization": - AuthorizationElement = (Hl7.Fhir.Model.FhirString)value; + AuthorizationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "tenderedAmount": - TenderedAmount = (Hl7.Fhir.Model.Money)value; + TenderedAmount = (Hl7.Fhir.Model.Money?)value; return this; case "returnedAmount": - ReturnedAmount = (Hl7.Fhir.Model.Money)value; + ReturnedAmount = (Hl7.Fhir.Model.Money?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Money)value; + Amount = (Hl7.Fhir.Model.Money?)value; return this; case "paymentIdentifier": - PaymentIdentifier = (Hl7.Fhir.Model.Identifier)value; + PaymentIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "allocation": - Allocation = (List)value; + Allocation = (List?)value!; return this; case "formCode": - FormCode = (Hl7.Fhir.Model.CodeableConcept)value; + FormCode = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "processNote": - ProcessNote = (List)value; + ProcessNote = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1528,35 +1477,35 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Kind is not null) yield return new KeyValuePair("kind",Kind); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Enterer is not null) yield return new KeyValuePair("enterer",Enterer); - if (IssuerType is not null) yield return new KeyValuePair("issuerType",IssuerType); - if (PaymentIssuer is not null) yield return new KeyValuePair("paymentIssuer",PaymentIssuer); - if (Request is not null) yield return new KeyValuePair("request",Request); - if (Requestor is not null) yield return new KeyValuePair("requestor",Requestor); - if (OutcomeElement is not null) yield return new KeyValuePair("outcome",OutcomeElement); - if (DispositionElement is not null) yield return new KeyValuePair("disposition",DispositionElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (CardBrandElement is not null) yield return new KeyValuePair("cardBrand",CardBrandElement); - if (AccountNumberElement is not null) yield return new KeyValuePair("accountNumber",AccountNumberElement); - if (ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",ExpirationDateElement); - if (ProcessorElement is not null) yield return new KeyValuePair("processor",ProcessorElement); - if (ReferenceNumberElement is not null) yield return new KeyValuePair("referenceNumber",ReferenceNumberElement); - if (AuthorizationElement is not null) yield return new KeyValuePair("authorization",AuthorizationElement); - if (TenderedAmount is not null) yield return new KeyValuePair("tenderedAmount",TenderedAmount); - if (ReturnedAmount is not null) yield return new KeyValuePair("returnedAmount",ReturnedAmount); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (PaymentIdentifier is not null) yield return new KeyValuePair("paymentIdentifier",PaymentIdentifier); - if (Allocation?.Any() == true) yield return new KeyValuePair("allocation",Allocation); - if (FormCode is not null) yield return new KeyValuePair("formCode",FormCode); - if (ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",ProcessNote); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Kind is not null) yield return new KeyValuePair("kind",_Kind); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Enterer is not null) yield return new KeyValuePair("enterer",_Enterer); + if (_IssuerType is not null) yield return new KeyValuePair("issuerType",_IssuerType); + if (_PaymentIssuer is not null) yield return new KeyValuePair("paymentIssuer",_PaymentIssuer); + if (_Request is not null) yield return new KeyValuePair("request",_Request); + if (_Requestor is not null) yield return new KeyValuePair("requestor",_Requestor); + if (_OutcomeElement is not null) yield return new KeyValuePair("outcome",_OutcomeElement); + if (_DispositionElement is not null) yield return new KeyValuePair("disposition",_DispositionElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_CardBrandElement is not null) yield return new KeyValuePair("cardBrand",_CardBrandElement); + if (_AccountNumberElement is not null) yield return new KeyValuePair("accountNumber",_AccountNumberElement); + if (_ExpirationDateElement is not null) yield return new KeyValuePair("expirationDate",_ExpirationDateElement); + if (_ProcessorElement is not null) yield return new KeyValuePair("processor",_ProcessorElement); + if (_ReferenceNumberElement is not null) yield return new KeyValuePair("referenceNumber",_ReferenceNumberElement); + if (_AuthorizationElement is not null) yield return new KeyValuePair("authorization",_AuthorizationElement); + if (_TenderedAmount is not null) yield return new KeyValuePair("tenderedAmount",_TenderedAmount); + if (_ReturnedAmount is not null) yield return new KeyValuePair("returnedAmount",_ReturnedAmount); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_PaymentIdentifier is not null) yield return new KeyValuePair("paymentIdentifier",_PaymentIdentifier); + if (_Allocation?.Any() == true) yield return new KeyValuePair("allocation",_Allocation); + if (_FormCode is not null) yield return new KeyValuePair("formCode",_FormCode); + if (_ProcessNote?.Any() == true) yield return new KeyValuePair("processNote",_ProcessNote); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs index 0e9837a79..76b53f31b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -161,11 +164,11 @@ public partial class JustificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Basis { - get { if(_Basis==null) _Basis = new List(); return _Basis; } + get => _Basis ?? new List(); set { _Basis = value; OnPropertyChanged("Basis"); } } - private List _Basis; + private List? _Basis; /// /// Justifing rational. @@ -177,24 +180,20 @@ public List Basis [DataMember] public List Evidence { - get { if(_Evidence==null) _Evidence = new List(); return _Evidence; } + get => _Evidence ?? new List(); set { _Evidence = value; OnPropertyChanged("Evidence"); } } - private List _Evidence; + private List? _Evidence; protected internal override void CopyToInternal(Base other) { - var dest = other as JustificationComponent; - - if (dest == null) - { + if(other is not JustificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Basis.Any()) dest.Basis = new List(Basis.DeepCopyInternal()); - if(Evidence.Any()) dest.Evidence = new List(Evidence.DeepCopyInternal()); + if(_Basis is not null) dest.Basis = new List(_Basis.DeepCopyInternal()); + if(_Evidence is not null) dest.Evidence = new List(_Evidence.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -206,41 +205,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as JustificationComponent; - if(otherT == null) return false; + if(other is not JustificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Basis, otherT.Basis)) return false; - if(!comparer.ListEquals(Evidence, otherT.Evidence)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "basis": - value = Basis; - return Basis?.Any() == true; + value = _Basis; + return _Basis?.Any() == true; case "evidence": - value = Evidence; - return Evidence?.Any() == true; + value = _Evidence; + return _Evidence?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "basis": - Basis = (List)value; + Basis = (List?)value!; return this; case "evidence": - Evidence = (List)value; + Evidence = (List?)value!; return this; default: return base.SetValue(key, value); @@ -251,8 +250,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Basis?.Any() == true) yield return new KeyValuePair("basis",Basis); - if (Evidence?.Any() == true) yield return new KeyValuePair("evidence",Evidence); + if (_Basis?.Any() == true) yield return new KeyValuePair("basis",_Basis); + if (_Evidence?.Any() == true) yield return new KeyValuePair("evidence",_Evidence); } } @@ -280,13 +279,13 @@ public partial class RuleComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("PermissionProvisionType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// deny | permit @@ -295,13 +294,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ConsentProvisionType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -314,11 +310,11 @@ public Hl7.Fhir.Model.ConsentProvisionType? Type [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// A description or definition of which activities are allowed to be done on the data. @@ -328,11 +324,11 @@ public List Data [DataMember] public List Activity { - get { if(_Activity==null) _Activity = new List(); return _Activity; } + get => _Activity ?? new List(); set { _Activity = value; OnPropertyChanged("Activity"); } } - private List _Activity; + private List? _Activity; /// /// What limits apply to the use of the data. @@ -343,26 +339,22 @@ public List Activity [DataMember] public List Limit { - get { if(_Limit==null) _Limit = new List(); return _Limit; } + get => _Limit ?? new List(); set { _Limit = value; OnPropertyChanged("Limit"); } } - private List _Limit; + private List? _Limit; protected internal override void CopyToInternal(Base other) { - var dest = other as RuleComponent; - - if (dest == null) - { + if(other is not RuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Activity.Any()) dest.Activity = new List(Activity.DeepCopyInternal()); - if(Limit.Any()) dest.Limit = new List(Limit.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = new List(_Activity.DeepCopyInternal()); + if(_Limit is not null) dest.Limit = new List(_Limit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -374,55 +366,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RuleComponent; - if(otherT == null) return false; + if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.ListEquals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(Limit, otherT.Limit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "activity": - value = Activity; - return Activity?.Any() == true; + value = _Activity; + return _Activity?.Any() == true; case "limit": - value = Limit; - return Limit?.Any() == true; + value = _Limit; + return _Limit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "activity": - Activity = (List)value; + Activity = (List?)value!; return this; case "limit": - Limit = (List)value; + Limit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -433,10 +425,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Activity?.Any() == true) yield return new KeyValuePair("activity",Activity); - if (Limit?.Any() == true) yield return new KeyValuePair("limit",Limit); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Activity?.Any() == true) yield return new KeyValuePair("activity",_Activity); + if (_Limit?.Any() == true) yield return new KeyValuePair("limit",_Limit); } } @@ -465,11 +457,11 @@ public partial class DataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Resource { - get { if(_Resource==null) _Resource = new List(); return _Resource; } + get => _Resource ?? new List(); set { _Resource = value; OnPropertyChanged("Resource"); } } - private List _Resource; + private List? _Resource; /// /// Security tag code on .meta.security. @@ -479,11 +471,11 @@ public List Resource [DataMember] public List Security { - get { if(_Security==null) _Security = new List(); return _Security; } + get => _Security ?? new List(); set { _Security = value; OnPropertyChanged("Security"); } } - private List _Security; + private List? _Security; /// /// Timeframe encompasing data create/update. @@ -493,39 +485,35 @@ public List Security [DataMember] public List Period { - get { if(_Period==null) _Period = new List(); return _Period; } + get => _Period ?? new List(); set { _Period = value; OnPropertyChanged("Period"); } } - private List _Period; + private List? _Period; /// /// Expression identifying the data. /// [FhirElement("expression", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DataComponent; - - if (dest == null) - { + if(other is not DataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Resource.Any()) dest.Resource = new List(Resource.DeepCopyInternal()); - if(Security.Any()) dest.Security = new List(Security.DeepCopyInternal()); - if(Period.Any()) dest.Period = new List(Period.DeepCopyInternal()); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = new List(_Resource.DeepCopyInternal()); + if(_Security is not null) dest.Security = new List(_Security.DeepCopyInternal()); + if(_Period is not null) dest.Period = new List(_Period.DeepCopyInternal()); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -537,55 +525,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DataComponent; - if(otherT == null) return false; + if(other is not DataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Resource, otherT.Resource)) return false; - if(!comparer.ListEquals(Security, otherT.Security)) return false; - if(!comparer.ListEquals(Period, otherT.Period)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + if(!comparer.ListEquals(_Security, otherT._Security)) return false; + if(!comparer.ListEquals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resource": - value = Resource; - return Resource?.Any() == true; + value = _Resource; + return _Resource?.Any() == true; case "security": - value = Security; - return Security?.Any() == true; + value = _Security; + return _Security?.Any() == true; case "period": - value = Period; - return Period?.Any() == true; + value = _Period; + return _Period?.Any() == true; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resource": - Resource = (List)value; + Resource = (List?)value!; return this; case "security": - Security = (List)value; + Security = (List?)value!; return this; case "period": - Period = (List)value; + Period = (List?)value!; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -596,10 +584,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Resource?.Any() == true) yield return new KeyValuePair("resource",Resource); - if (Security?.Any() == true) yield return new KeyValuePair("security",Security); - if (Period?.Any() == true) yield return new KeyValuePair("period",Period); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_Resource?.Any() == true) yield return new KeyValuePair("resource",_Resource); + if (_Security?.Any() == true) yield return new KeyValuePair("security",_Security); + if (_Period?.Any() == true) yield return new KeyValuePair("period",_Period); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -625,13 +613,13 @@ public partial class ResourceComponent : Hl7.Fhir.Model.BackboneElement [Binding("ConsentDataMeaning")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code MeaningElement + public Code? MeaningElement { get { return _MeaningElement; } set { _MeaningElement = value; OnPropertyChanged("MeaningElement"); } } - private Code _MeaningElement; + private Code? _MeaningElement; /// /// instance | related | dependents | authoredby @@ -640,13 +628,10 @@ public Code MeaningElement [IgnoreDataMember] public Hl7.Fhir.Model.ConsentDataMeaning? Meaning { - get { return MeaningElement != null ? MeaningElement.Value : null; } + get => _MeaningElement?.Value; set { - if (value == null) - MeaningElement = null; - else - MeaningElement = new Code(value); + MeaningElement = value is null ? null : new Code(value); OnPropertyChanged("Meaning"); } } @@ -659,26 +644,22 @@ public Hl7.Fhir.Model.ConsentDataMeaning? Meaning [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceComponent; - - if (dest == null) - { + if(other is not ResourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MeaningElement != null) dest.MeaningElement = (Code)MeaningElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_MeaningElement is not null) dest.MeaningElement = (Code)_MeaningElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -690,41 +671,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceComponent; - if(otherT == null) return false; + if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MeaningElement, otherT.MeaningElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "meaning": - value = MeaningElement; - return MeaningElement is not null; + value = _MeaningElement; + return _MeaningElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "meaning": - MeaningElement = (Code)value; + MeaningElement = (Code?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -735,8 +716,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MeaningElement is not null) yield return new KeyValuePair("meaning",MeaningElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_MeaningElement is not null) yield return new KeyValuePair("meaning",_MeaningElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -764,11 +745,11 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Actions controlled by this rule. @@ -779,11 +760,11 @@ public List Actor [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// The purpose for which the permission is given. @@ -794,25 +775,21 @@ public List Action [DataMember] public List Purpose { - get { if(_Purpose==null) _Purpose = new List(); return _Purpose; } + get => _Purpose ?? new List(); set { _Purpose = value; OnPropertyChanged("Purpose"); } } - private List _Purpose; + private List? _Purpose; protected internal override void CopyToInternal(Base other) { - var dest = other as ActivityComponent; - - if (dest == null) - { + if(other is not ActivityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(Purpose.Any()) dest.Purpose = new List(Purpose.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_Purpose is not null) dest.Purpose = new List(_Purpose.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -824,48 +801,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActivityComponent; - if(otherT == null) return false; + if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.ListEquals(Purpose, otherT.Purpose)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.ListEquals(_Purpose, otherT._Purpose)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "purpose": - value = Purpose; - return Purpose?.Any() == true; + value = _Purpose; + return _Purpose?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "purpose": - Purpose = (List)value; + Purpose = (List?)value!; return this; default: return base.SetValue(key, value); @@ -876,9 +853,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (Purpose?.Any() == true) yield return new KeyValuePair("purpose",Purpose); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_Purpose?.Any() == true) yield return new KeyValuePair("purpose",_Purpose); } } @@ -891,13 +868,13 @@ public override IEnumerable> EnumerateElements() [Binding("PermissionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | entered-in-error | draft | rejected @@ -906,13 +883,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Permission.PermissionStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -924,13 +898,13 @@ public Hl7.Fhir.Model.Permission.PermissionStatus? Status [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","RelatedPerson","HealthcareService")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Asserter + public Hl7.Fhir.Model.ResourceReference? Asserter { get { return _Asserter; } set { _Asserter = value; OnPropertyChanged("Asserter"); } } - private Hl7.Fhir.Model.ResourceReference _Asserter; + private Hl7.Fhir.Model.ResourceReference? _Asserter; /// /// The date that permission was asserted. @@ -940,24 +914,24 @@ public Hl7.Fhir.Model.ResourceReference Asserter [DataMember] public List DateElement { - get { if(_DateElement==null) _DateElement = new List(); return _DateElement; } + get => _DateElement ?? new List(); set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private List _DateElement; + private List? _DateElement; /// /// The date that permission was asserted /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Date + public IEnumerable? Date { - get { return DateElement != null ? DateElement.Select(elem => elem.Value) : null; } + get => _DateElement?.Select(elem => elem.Value); set { if (value == null) - DateElement = null; + DateElement = null!; else DateElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDateTime(elem))); OnPropertyChanged("Date"); @@ -969,26 +943,26 @@ public IEnumerable Date /// [FhirElement("validity", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period Validity + public Hl7.Fhir.Model.Period? Validity { get { return _Validity; } set { _Validity = value; OnPropertyChanged("Validity"); } } - private Hl7.Fhir.Model.Period _Validity; + private Hl7.Fhir.Model.Period? _Validity; /// /// The asserted justification for using the data. /// [FhirElement("justification", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Permission.JustificationComponent Justification + public Hl7.Fhir.Model.Permission.JustificationComponent? Justification { get { return _Justification; } set { _Justification = value; OnPropertyChanged("Justification"); } } - private Hl7.Fhir.Model.Permission.JustificationComponent _Justification; + private Hl7.Fhir.Model.Permission.JustificationComponent? _Justification; /// /// deny-overrides | permit-overrides | ordered-deny-overrides | ordered-permit-overrides | deny-unless-permit | permit-unless-deny. @@ -998,13 +972,13 @@ public Hl7.Fhir.Model.Permission.JustificationComponent Justification [Binding("PermissionCombining")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code CombiningElement + public Code? CombiningElement { get { return _CombiningElement; } set { _CombiningElement = value; OnPropertyChanged("CombiningElement"); } } - private Code _CombiningElement; + private Code? _CombiningElement; /// /// deny-overrides | permit-overrides | ordered-deny-overrides | ordered-permit-overrides | deny-unless-permit | permit-unless-deny @@ -1013,13 +987,10 @@ public Code CombiningElement [IgnoreDataMember] public Hl7.Fhir.Model.Permission.PermissionRuleCombining? Combining { - get { return CombiningElement != null ? CombiningElement.Value : null; } + get => _CombiningElement?.Value; set { - if (value == null) - CombiningElement = null; - else - CombiningElement = new Code(value); + CombiningElement = value is null ? null : new Code(value); OnPropertyChanged("Combining"); } } @@ -1032,29 +1003,25 @@ public Hl7.Fhir.Model.Permission.PermissionRuleCombining? Combining [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; protected internal override void CopyToInternal(Base other) { - var dest = other as Permission; - - if (dest == null) - { + if(other is not Permission dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Asserter != null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)Asserter.DeepCopyInternal(); - if(DateElement.Any()) dest.DateElement = new List(DateElement.DeepCopyInternal()); - if(Validity != null) dest.Validity = (Hl7.Fhir.Model.Period)Validity.DeepCopyInternal(); - if(Justification != null) dest.Justification = (Hl7.Fhir.Model.Permission.JustificationComponent)Justification.DeepCopyInternal(); - if(CombiningElement != null) dest.CombiningElement = (Code)CombiningElement.DeepCopyInternal(); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Asserter is not null) dest.Asserter = (Hl7.Fhir.Model.ResourceReference)_Asserter.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = new List(_DateElement.DeepCopyInternal()); + if(_Validity is not null) dest.Validity = (Hl7.Fhir.Model.Period)_Validity.DeepCopyInternal(); + if(_Justification is not null) dest.Justification = (Hl7.Fhir.Model.Permission.JustificationComponent)_Justification.DeepCopyInternal(); + if(_CombiningElement is not null) dest.CombiningElement = (Code)_CombiningElement.DeepCopyInternal(); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1066,76 +1033,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Permission; - if(otherT == null) return false; + if(other is not Permission otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Asserter, otherT.Asserter)) return false; - if(!comparer.ListEquals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(Validity, otherT.Validity)) return false; - if(!comparer.Equals(Justification, otherT.Justification)) return false; - if(!comparer.Equals(CombiningElement, otherT.CombiningElement)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; + if(!comparer.ListEquals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_Validity, otherT._Validity)) return false; + if(!comparer.Equals(_Justification, otherT._Justification)) return false; + if(!comparer.Equals(_CombiningElement, otherT._CombiningElement)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "asserter": - value = Asserter; - return Asserter is not null; + value = _Asserter; + return _Asserter is not null; case "date": - value = DateElement; - return DateElement?.Any() == true; + value = _DateElement; + return _DateElement?.Any() == true; case "validity": - value = Validity; - return Validity is not null; + value = _Validity; + return _Validity is not null; case "justification": - value = Justification; - return Justification is not null; + value = _Justification; + return _Justification is not null; case "combining": - value = CombiningElement; - return CombiningElement is not null; + value = _CombiningElement; + return _CombiningElement is not null; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "asserter": - Asserter = (Hl7.Fhir.Model.ResourceReference)value; + Asserter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "date": - DateElement = (List)value; + DateElement = (List?)value!; return this; case "validity": - Validity = (Hl7.Fhir.Model.Period)value; + Validity = (Hl7.Fhir.Model.Period?)value; return this; case "justification": - Justification = (Hl7.Fhir.Model.Permission.JustificationComponent)value; + Justification = (Hl7.Fhir.Model.Permission.JustificationComponent?)value; return this; case "combining": - CombiningElement = (Code)value; + CombiningElement = (Code?)value; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1146,13 +1113,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Asserter is not null) yield return new KeyValuePair("asserter",Asserter); - if (DateElement?.Any() == true) yield return new KeyValuePair("date",DateElement); - if (Validity is not null) yield return new KeyValuePair("validity",Validity); - if (Justification is not null) yield return new KeyValuePair("justification",Justification); - if (CombiningElement is not null) yield return new KeyValuePair("combining",CombiningElement); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Asserter is not null) yield return new KeyValuePair("asserter",_Asserter); + if (_DateElement?.Any() == true) yield return new KeyValuePair("date",_DateElement); + if (_Validity is not null) yield return new KeyValuePair("validity",_Validity); + if (_Justification is not null) yield return new KeyValuePair("justification",_Justification); + if (_CombiningElement is not null) yield return new KeyValuePair("combining",_CombiningElement); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Person.cs b/src/Hl7.Fhir.R5/Model/Generated/Person.cs index 95bba6733..cb95d1d5d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Person.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -118,26 +121,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -146,29 +149,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -180,41 +176,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -225,8 +221,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -252,13 +248,13 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [References("Patient","Practitioner","RelatedPerson","Person")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Target + public Hl7.Fhir.Model.ResourceReference? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.ResourceReference _Target; + private Hl7.Fhir.Model.ResourceReference? _Target; /// /// level1 | level2 | level3 | level4. @@ -267,13 +263,13 @@ public Hl7.Fhir.Model.ResourceReference Target [DeclaredType(Type = typeof(Code))] [Binding("IdentityAssuranceLevel")] [DataMember] - public Code AssuranceElement + public Code? AssuranceElement { get { return _AssuranceElement; } set { _AssuranceElement = value; OnPropertyChanged("AssuranceElement"); } } - private Code _AssuranceElement; + private Code? _AssuranceElement; /// /// level1 | level2 | level3 | level4 @@ -282,29 +278,22 @@ public Code AssuranceElement [IgnoreDataMember] public Hl7.Fhir.Model.Person.IdentityAssuranceLevel? Assurance { - get { return AssuranceElement != null ? AssuranceElement.Value : null; } + get => _AssuranceElement?.Value; set { - if (value == null) - AssuranceElement = null; - else - AssuranceElement = new Code(value); + AssuranceElement = value is null ? null : new Code(value); OnPropertyChanged("Assurance"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target != null) dest.Target = (Hl7.Fhir.Model.ResourceReference)Target.DeepCopyInternal(); - if(AssuranceElement != null) dest.AssuranceElement = (Code)AssuranceElement.DeepCopyInternal(); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.ResourceReference)_Target.DeepCopyInternal(); + if(_AssuranceElement is not null) dest.AssuranceElement = (Code)_AssuranceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -316,41 +305,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(AssuranceElement, otherT.AssuranceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "assurance": - value = AssuranceElement; - return AssuranceElement is not null; + value = _AssuranceElement; + return _AssuranceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (Hl7.Fhir.Model.ResourceReference)value; + Target = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assurance": - AssuranceElement = (Code)value; + AssuranceElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -361,8 +350,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target is not null) yield return new KeyValuePair("target",Target); - if (AssuranceElement is not null) yield return new KeyValuePair("assurance",AssuranceElement); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_AssuranceElement is not null) yield return new KeyValuePair("assurance",_AssuranceElement); } } @@ -375,24 +364,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// This person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// This person's record is in active use @@ -401,13 +390,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -420,11 +406,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -434,11 +420,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -447,13 +433,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -462,13 +448,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -478,28 +461,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -511,13 +491,13 @@ public string BirthDate [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// One or more addresses for the person. @@ -527,11 +507,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Marital (civil) status of a person. @@ -539,13 +519,13 @@ public List Address [FhirElement("maritalStatus", Order=170)] [Binding("MaritalStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MaritalStatus + public Hl7.Fhir.Model.CodeableConcept? MaritalStatus { get { return _MaritalStatus; } set { _MaritalStatus = value; OnPropertyChanged("MaritalStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _MaritalStatus; + private Hl7.Fhir.Model.CodeableConcept? _MaritalStatus; /// /// Image of the person. @@ -555,11 +535,11 @@ public Hl7.Fhir.Model.CodeableConcept MaritalStatus [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// A language which may be used to communicate with the person about his or her health. @@ -569,11 +549,11 @@ public List Photo [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// The organization that is the custodian of the person record. @@ -582,13 +562,13 @@ public List Communication [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingOrganization + public Hl7.Fhir.Model.ResourceReference? ManagingOrganization { get { return _ManagingOrganization; } set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingOrganization; + private Hl7.Fhir.Model.ResourceReference? _ManagingOrganization; /// /// Link to a resource that concerns the same actual person. @@ -598,37 +578,33 @@ public Hl7.Fhir.Model.ResourceReference ManagingOrganization [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Person; - - if (dest == null) - { + if(other is not Person dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(MaritalStatus != null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)MaritalStatus.DeepCopyInternal(); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(ManagingOrganization != null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopyInternal(); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_MaritalStatus is not null) dest.MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)_MaritalStatus.DeepCopyInternal(); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_ManagingOrganization is not null) dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)_ManagingOrganization.DeepCopyInternal(); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -640,118 +616,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Person; - if(otherT == null) return false; + if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.Equals(MaritalStatus, otherT.MaritalStatus)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.Equals(ManagingOrganization, otherT.ManagingOrganization)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.Equals(_MaritalStatus, otherT._MaritalStatus)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; + if(!comparer.ListEquals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "maritalStatus": - value = MaritalStatus; - return MaritalStatus is not null; + value = _MaritalStatus; + return _MaritalStatus is not null; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "managingOrganization": - value = ManagingOrganization; - return ManagingOrganization is not null; + value = _ManagingOrganization; + return _ManagingOrganization is not null; case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "maritalStatus": - MaritalStatus = (Hl7.Fhir.Model.CodeableConcept)value; + MaritalStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "managingOrganization": - ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)value; + ManagingOrganization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "link": - Link = (List)value; + Link = (List?)value!; return this; default: return base.SetValue(key, value); @@ -762,19 +738,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",MaritalStatus); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",ManagingOrganization); - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_MaritalStatus is not null) yield return new KeyValuePair("maritalStatus",_MaritalStatus); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_ManagingOrganization is not null) yield return new KeyValuePair("managingOrganization",_ManagingOrganization); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs index 87524bf09..ab0183795 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class GoalComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("category", Order=40)] [Binding("GoalCategory")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Code or text describing the goal. @@ -96,13 +99,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [Binding("GoalDescription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Description + public Hl7.Fhir.Model.CodeableConcept? Description { get { return _Description; } set { _Description = value; OnPropertyChanged("Description"); } } - private Hl7.Fhir.Model.CodeableConcept _Description; + private Hl7.Fhir.Model.CodeableConcept? _Description; /// /// high-priority | medium-priority | low-priority. @@ -110,13 +113,13 @@ public Hl7.Fhir.Model.CodeableConcept Description [FhirElement("priority", Order=60)] [Binding("GoalPriority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Priority + public Hl7.Fhir.Model.CodeableConcept? Priority { get { return _Priority; } set { _Priority = value; OnPropertyChanged("Priority"); } } - private Hl7.Fhir.Model.CodeableConcept _Priority; + private Hl7.Fhir.Model.CodeableConcept? _Priority; /// /// When goal pursuit begins. @@ -124,13 +127,13 @@ public Hl7.Fhir.Model.CodeableConcept Priority [FhirElement("start", Order=70)] [Binding("GoalStartEvent")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Start + public Hl7.Fhir.Model.CodeableConcept? Start { get { return _Start; } set { _Start = value; OnPropertyChanged("Start"); } } - private Hl7.Fhir.Model.CodeableConcept _Start; + private Hl7.Fhir.Model.CodeableConcept? _Start; /// /// What does the goal address. @@ -141,11 +144,11 @@ public Hl7.Fhir.Model.CodeableConcept Start [DataMember] public List Addresses { - get { if(_Addresses==null) _Addresses = new List(); return _Addresses; } + get => _Addresses ?? new List(); set { _Addresses = value; OnPropertyChanged("Addresses"); } } - private List _Addresses; + private List? _Addresses; /// /// Supporting documentation for the goal. @@ -155,11 +158,11 @@ public List Addresses [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// Target outcome for the goal. @@ -169,29 +172,25 @@ public List Documentation [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as GoalComponent; - - if (dest == null) - { + if(other is not GoalComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(Description != null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)Description.DeepCopyInternal(); - if(Priority != null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopyInternal(); - if(Start != null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)Start.DeepCopyInternal(); - if(Addresses.Any()) dest.Addresses = new List(Addresses.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_Description is not null) dest.Description = (Hl7.Fhir.Model.CodeableConcept)_Description.DeepCopyInternal(); + if(_Priority is not null) dest.Priority = (Hl7.Fhir.Model.CodeableConcept)_Priority.DeepCopyInternal(); + if(_Start is not null) dest.Start = (Hl7.Fhir.Model.CodeableConcept)_Start.DeepCopyInternal(); + if(_Addresses is not null) dest.Addresses = new List(_Addresses.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -203,76 +202,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GoalComponent; - if(otherT == null) return false; + if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(Description, otherT.Description)) return false; - if(!comparer.Equals(Priority, otherT.Priority)) return false; - if(!comparer.Equals(Start, otherT.Start)) return false; - if(!comparer.ListEquals(Addresses, otherT.Addresses)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Description, otherT._Description)) return false; + if(!comparer.Equals(_Priority, otherT._Priority)) return false; + if(!comparer.Equals(_Start, otherT._Start)) return false; + if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "description": - value = Description; - return Description is not null; + value = _Description; + return _Description is not null; case "priority": - value = Priority; - return Priority is not null; + value = _Priority; + return _Priority is not null; case "start": - value = Start; - return Start is not null; + value = _Start; + return _Start is not null; case "addresses": - value = Addresses; - return Addresses?.Any() == true; + value = _Addresses; + return _Addresses?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - Description = (Hl7.Fhir.Model.CodeableConcept)value; + Description = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - Priority = (Hl7.Fhir.Model.CodeableConcept)value; + Priority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "start": - Start = (Hl7.Fhir.Model.CodeableConcept)value; + Start = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "addresses": - Addresses = (List)value; + Addresses = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -283,13 +282,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Category is not null) yield return new KeyValuePair("category",Category); - if (Description is not null) yield return new KeyValuePair("description",Description); - if (Priority is not null) yield return new KeyValuePair("priority",Priority); - if (Start is not null) yield return new KeyValuePair("start",Start); - if (Addresses?.Any() == true) yield return new KeyValuePair("addresses",Addresses); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_Description is not null) yield return new KeyValuePair("description",_Description); + if (_Priority is not null) yield return new KeyValuePair("priority",_Priority); + if (_Start is not null) yield return new KeyValuePair("start",_Start); + if (_Addresses?.Any() == true) yield return new KeyValuePair("addresses",_Addresses); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } @@ -316,13 +315,13 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("measure", Order=40)] [Binding("GoalTargetMeasure")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Measure + public Hl7.Fhir.Model.CodeableConcept? Measure { get { return _Measure; } set { _Measure = value; OnPropertyChanged("Measure"); } } - private Hl7.Fhir.Model.CodeableConcept _Measure; + private Hl7.Fhir.Model.CodeableConcept? _Measure; /// /// The target value to be achieved. @@ -331,40 +330,36 @@ public Hl7.Fhir.Model.CodeableConcept Measure [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Ratio))] [DataMember] - public Hl7.Fhir.Model.DataType Detail + public Hl7.Fhir.Model.DataType? Detail { get { return _Detail; } set { _Detail = value; OnPropertyChanged("Detail"); } } - private Hl7.Fhir.Model.DataType _Detail; + private Hl7.Fhir.Model.DataType? _Detail; /// /// Reach goal within. /// [FhirElement("due", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration Due + public Hl7.Fhir.Model.Duration? Due { get { return _Due; } set { _Due = value; OnPropertyChanged("Due"); } } - private Hl7.Fhir.Model.Duration _Due; + private Hl7.Fhir.Model.Duration? _Due; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Measure != null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)Measure.DeepCopyInternal(); - if(Detail != null) dest.Detail = (Hl7.Fhir.Model.DataType)Detail.DeepCopyInternal(); - if(Due != null) dest.Due = (Hl7.Fhir.Model.Duration)Due.DeepCopyInternal(); + if(_Measure is not null) dest.Measure = (Hl7.Fhir.Model.CodeableConcept)_Measure.DeepCopyInternal(); + if(_Detail is not null) dest.Detail = (Hl7.Fhir.Model.DataType)_Detail.DeepCopyInternal(); + if(_Due is not null) dest.Due = (Hl7.Fhir.Model.Duration)_Due.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -376,48 +371,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Measure, otherT.Measure)) return false; - if(!comparer.Equals(Detail, otherT.Detail)) return false; - if(!comparer.Equals(Due, otherT.Due)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + if(!comparer.Equals(_Detail, otherT._Detail)) return false; + if(!comparer.Equals(_Due, otherT._Due)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "measure": - value = Measure; - return Measure is not null; + value = _Measure; + return _Measure is not null; case "detail": - value = Detail; - return Detail is not null; + value = _Detail; + return _Detail is not null; case "due": - value = Due; - return Due is not null; + value = _Due; + return _Due is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "measure": - Measure = (Hl7.Fhir.Model.CodeableConcept)value; + Measure = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "detail": - Detail = (Hl7.Fhir.Model.DataType)value; + Detail = (Hl7.Fhir.Model.DataType?)value; return this; case "due": - Due = (Hl7.Fhir.Model.Duration)value; + Due = (Hl7.Fhir.Model.Duration?)value; return this; default: return base.SetValue(key, value); @@ -428,9 +423,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Measure is not null) yield return new KeyValuePair("measure",Measure); - if (Detail is not null) yield return new KeyValuePair("detail",Detail); - if (Due is not null) yield return new KeyValuePair("due",Due); + if (_Measure is not null) yield return new KeyValuePair("measure",_Measure); + if (_Detail is not null) yield return new KeyValuePair("detail",_Detail); + if (_Due is not null) yield return new KeyValuePair("due",_Due); } } @@ -456,28 +451,25 @@ public partial class ActorComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -487,28 +479,25 @@ public string Title /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Describes the actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -521,25 +510,21 @@ public string Description [DataMember] public List Option { - get { if(_Option==null) _Option = new List(); return _Option; } + get => _Option ?? new List(); set { _Option = value; OnPropertyChanged("Option"); } } - private List _Option; + private List? _Option; protected internal override void CopyToInternal(Base other) { - var dest = other as ActorComponent; - - if (dest == null) - { + if(other is not ActorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Option.Any()) dest.Option = new List(Option.DeepCopyInternal()); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Option is not null) dest.Option = new List(_Option.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -551,48 +536,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActorComponent; - if(otherT == null) return false; + if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Option, otherT.Option)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Option, otherT._Option)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "option": - value = Option; - return Option?.Any() == true; + value = _Option; + return _Option?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "option": - Option = (List)value; + Option = (List?)value!; return this; default: return base.SetValue(key, value); @@ -603,9 +588,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Option?.Any() == true) yield return new KeyValuePair("option",Option); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Option?.Any() == true) yield return new KeyValuePair("option",_Option); } } @@ -633,13 +618,13 @@ public partial class OptionComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ActivityParticipantType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson @@ -648,13 +633,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -664,28 +646,25 @@ public Hl7.Fhir.Model.ActionParticipantType? Type /// [FhirElement("typeCanonical", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical TypeCanonicalElement + public Hl7.Fhir.Model.Canonical? TypeCanonicalElement { get { return _TypeCanonicalElement; } set { _TypeCanonicalElement = value; OnPropertyChanged("TypeCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _TypeCanonicalElement; + private Hl7.Fhir.Model.Canonical? _TypeCanonicalElement; /// /// Who or what can participate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TypeCanonical + public string? TypeCanonical { - get { return TypeCanonicalElement != null ? TypeCanonicalElement.Value : null; } + get => _TypeCanonicalElement?.Value; set { - if (value == null) - TypeCanonicalElement = null; - else - TypeCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + TypeCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("TypeCanonical"); } } @@ -697,13 +676,13 @@ public string TypeCanonical [CLSCompliant(false)] [References("CareTeam","Device","DeviceDefinition","Endpoint","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference TypeReference + public Hl7.Fhir.Model.ResourceReference? TypeReference { get { return _TypeReference; } set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } - private Hl7.Fhir.Model.ResourceReference _TypeReference; + private Hl7.Fhir.Model.ResourceReference? _TypeReference; /// /// E.g. Nurse, Surgeon, Parent. @@ -711,28 +690,24 @@ public Hl7.Fhir.Model.ResourceReference TypeReference [FhirElement("role", Order=70)] [Binding("ActionParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; protected internal override void CopyToInternal(Base other) { - var dest = other as OptionComponent; - - if (dest == null) - { + if(other is not OptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TypeCanonicalElement != null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)TypeCanonicalElement.DeepCopyInternal(); - if(TypeReference != null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)TypeReference.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TypeCanonicalElement is not null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)_TypeCanonicalElement.DeepCopyInternal(); + if(_TypeReference is not null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)_TypeReference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -744,55 +719,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OptionComponent; - if(otherT == null) return false; + if(other is not OptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TypeCanonicalElement, otherT.TypeCanonicalElement)) return false; - if(!comparer.Equals(TypeReference, otherT.TypeReference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; + if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "typeCanonical": - value = TypeCanonicalElement; - return TypeCanonicalElement is not null; + value = _TypeCanonicalElement; + return _TypeCanonicalElement is not null; case "typeReference": - value = TypeReference; - return TypeReference is not null; + value = _TypeReference; + return _TypeReference is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "typeCanonical": - TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + TypeCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "typeReference": - TypeReference = (Hl7.Fhir.Model.ResourceReference)value; + TypeReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -803,10 +778,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",TypeCanonicalElement); - if (TypeReference is not null) yield return new KeyValuePair("typeReference",TypeReference); - if (Role is not null) yield return new KeyValuePair("role",Role); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",_TypeCanonicalElement); + if (_TypeReference is not null) yield return new KeyValuePair("typeReference",_TypeReference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); } } @@ -833,28 +808,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for the action in the PlanDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -864,28 +836,25 @@ public string LinkId /// [FhirElement("prefix", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// User-visible prefix for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -895,28 +864,25 @@ public string Prefix /// [FhirElement("title", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -926,28 +892,25 @@ public string Title /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Brief description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -957,28 +920,25 @@ public string Description /// [FhirElement("textEquivalent", Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown TextEquivalentElement + public Hl7.Fhir.Model.Markdown? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.Markdown _TextEquivalentElement; + private Hl7.Fhir.Model.Markdown? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.Markdown(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("TextEquivalent"); } } @@ -990,13 +950,13 @@ public string TextEquivalent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -1005,13 +965,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -1022,13 +979,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [FhirElement("code", Order=100)] [Binding("ActionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Why the action should be performed. @@ -1039,11 +996,11 @@ public Hl7.Fhir.Model.CodeableConcept Code [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Supporting documentation for the intended performer of the action. @@ -1053,11 +1010,11 @@ public List Reason [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// What goals this action supports. @@ -1067,24 +1024,24 @@ public List Documentation [DataMember] public List GoalIdElement { - get { if(_GoalIdElement==null) _GoalIdElement = new List(); return _GoalIdElement; } + get => _GoalIdElement ?? new List(); set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } - private List _GoalIdElement; + private List? _GoalIdElement; /// /// What goals this action supports /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable GoalId + public IEnumerable? GoalId { - get { return GoalIdElement != null ? GoalIdElement.Select(elem => elem.Value) : null; } + get => _GoalIdElement?.Select(elem => elem.Value); set { if (value == null) - GoalIdElement = null; + GoalIdElement = null!; else GoalIdElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Id(elem))); OnPropertyChanged("GoalId"); @@ -1100,13 +1057,13 @@ public IEnumerable GoalId [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// When the action should be triggered. @@ -1116,11 +1073,11 @@ public Hl7.Fhir.Model.DataType Subject [DataMember] public List Trigger { - get { if(_Trigger==null) _Trigger = new List(); return _Trigger; } + get => _Trigger ?? new List(); set { _Trigger = value; OnPropertyChanged("Trigger"); } } - private List _Trigger; + private List? _Trigger; /// /// Whether or not the action is applicable. @@ -1130,11 +1087,11 @@ public List Trigger [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Input data requirements. @@ -1144,11 +1101,11 @@ public List Condition [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Output data definition. @@ -1158,11 +1115,11 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; /// /// Relationship to another action. @@ -1172,11 +1129,11 @@ public List Output [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -1185,26 +1142,26 @@ public List RelatedAction [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Where it should happen. /// [FhirElement("location", Order=210)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Location + public Hl7.Fhir.Model.CodeableReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.CodeableReference _Location; + private Hl7.Fhir.Model.CodeableReference? _Location; /// /// Who should participate in the action. @@ -1214,11 +1171,11 @@ public Hl7.Fhir.Model.CodeableReference Location [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -1226,13 +1183,13 @@ public List Participant [FhirElement("type", Order=230)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// visual-group | logical-group | sentence-group. @@ -1241,13 +1198,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -1256,13 +1213,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -1274,13 +1228,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -1289,13 +1243,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -1307,13 +1258,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -1322,13 +1273,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -1340,13 +1288,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -1355,13 +1303,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -1373,13 +1318,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -1388,13 +1333,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -1406,41 +1348,38 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// Transform to apply the template. /// [FhirElement("transform", Order=300)] [DataMember] - public Hl7.Fhir.Model.Canonical TransformElement + public Hl7.Fhir.Model.Canonical? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Hl7.Fhir.Model.Canonical _TransformElement; + private Hl7.Fhir.Model.Canonical? _TransformElement; /// /// Transform to apply the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Transform + public string? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Hl7.Fhir.Model.Canonical(value); + TransformElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Transform"); } } @@ -1453,11 +1392,11 @@ public string Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; /// /// A sub-action. @@ -1467,51 +1406,47 @@ public List DynamicValue [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.Markdown)TextEquivalentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(GoalIdElement.Any()) dest.GoalIdElement = new List(GoalIdElement.DeepCopyInternal()); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(Trigger.Any()) dest.Trigger = new List(Trigger.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.CodeableReference)Location.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)TransformElement.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.Markdown)_TextEquivalentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_GoalIdElement is not null) dest.GoalIdElement = new List(_GoalIdElement.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_Trigger is not null) dest.Trigger = new List(_Trigger.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.CodeableReference)_Location.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)_TransformElement.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1523,230 +1458,230 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(GoalIdElement, otherT.GoalIdElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Trigger, otherT.Trigger)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_GoalIdElement, otherT._GoalIdElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "goalId": - value = GoalIdElement; - return GoalIdElement?.Any() == true; + value = _GoalIdElement; + return _GoalIdElement?.Any() == true; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "trigger": - value = Trigger; - return Trigger?.Any() == true; + value = _Trigger; + return _Trigger?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.Markdown)value; + TextEquivalentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "goalId": - GoalIdElement = (List)value; + GoalIdElement = (List?)value!; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "trigger": - Trigger = (List)value; + Trigger = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.CodeableReference)value; + Location = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "transform": - TransformElement = (Hl7.Fhir.Model.Canonical)value; + TransformElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1757,35 +1692,35 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",GoalIdElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Trigger?.Any() == true) yield return new KeyValuePair("trigger",Trigger); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_GoalIdElement?.Any() == true) yield return new KeyValuePair("goalId",_GoalIdElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Trigger?.Any() == true) yield return new KeyValuePair("trigger",_Trigger); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1815,13 +1750,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -1830,13 +1765,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1846,26 +1778,22 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1877,41 +1805,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -1922,8 +1850,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -1949,28 +1877,25 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1980,58 +1905,51 @@ public string Title /// [FhirElement("requirement", Order=50)] [DataMember] - public Hl7.Fhir.Model.DataRequirement Requirement + public Hl7.Fhir.Model.DataRequirement? Requirement { get { return _Requirement; } set { _Requirement = value; OnPropertyChanged("Requirement"); } } - private Hl7.Fhir.Model.DataRequirement _Requirement; + private Hl7.Fhir.Model.DataRequirement? _Requirement; /// /// What data is provided. /// [FhirElement("relatedData", Order=60)] [DataMember] - public Hl7.Fhir.Model.Id RelatedDataElement + public Hl7.Fhir.Model.Id? RelatedDataElement { get { return _RelatedDataElement; } set { _RelatedDataElement = value; OnPropertyChanged("RelatedDataElement"); } } - private Hl7.Fhir.Model.Id _RelatedDataElement; + private Hl7.Fhir.Model.Id? _RelatedDataElement; /// /// What data is provided /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelatedData + public string? RelatedData { - get { return RelatedDataElement != null ? RelatedDataElement.Value : null; } + get => _RelatedDataElement?.Value; set { - if (value == null) - RelatedDataElement = null; - else - RelatedDataElement = new Hl7.Fhir.Model.Id(value); + RelatedDataElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RelatedData"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Requirement != null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)Requirement.DeepCopyInternal(); - if(RelatedDataElement != null) dest.RelatedDataElement = (Hl7.Fhir.Model.Id)RelatedDataElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Requirement is not null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)_Requirement.DeepCopyInternal(); + if(_RelatedDataElement is not null) dest.RelatedDataElement = (Hl7.Fhir.Model.Id)_RelatedDataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2043,48 +1961,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Requirement, otherT.Requirement)) return false; - if(!comparer.Equals(RelatedDataElement, otherT.RelatedDataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; + if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "requirement": - value = Requirement; - return Requirement is not null; + value = _Requirement; + return _Requirement is not null; case "relatedData": - value = RelatedDataElement; - return RelatedDataElement is not null; + value = _RelatedDataElement; + return _RelatedDataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requirement": - Requirement = (Hl7.Fhir.Model.DataRequirement)value; + Requirement = (Hl7.Fhir.Model.DataRequirement?)value; return this; case "relatedData": - RelatedDataElement = (Hl7.Fhir.Model.Id)value; + RelatedDataElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -2095,9 +2013,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Requirement is not null) yield return new KeyValuePair("requirement",Requirement); - if (RelatedDataElement is not null) yield return new KeyValuePair("relatedData",RelatedDataElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Requirement is not null) yield return new KeyValuePair("requirement",_Requirement); + if (_RelatedDataElement is not null) yield return new KeyValuePair("relatedData",_RelatedDataElement); } } @@ -2123,28 +2041,25 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2154,58 +2069,51 @@ public string Title /// [FhirElement("requirement", Order=50)] [DataMember] - public Hl7.Fhir.Model.DataRequirement Requirement + public Hl7.Fhir.Model.DataRequirement? Requirement { get { return _Requirement; } set { _Requirement = value; OnPropertyChanged("Requirement"); } } - private Hl7.Fhir.Model.DataRequirement _Requirement; + private Hl7.Fhir.Model.DataRequirement? _Requirement; /// /// What data is provided. /// [FhirElement("relatedData", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString RelatedDataElement + public Hl7.Fhir.Model.FhirString? RelatedDataElement { get { return _RelatedDataElement; } set { _RelatedDataElement = value; OnPropertyChanged("RelatedDataElement"); } } - private Hl7.Fhir.Model.FhirString _RelatedDataElement; + private Hl7.Fhir.Model.FhirString? _RelatedDataElement; /// /// What data is provided /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelatedData + public string? RelatedData { - get { return RelatedDataElement != null ? RelatedDataElement.Value : null; } + get => _RelatedDataElement?.Value; set { - if (value == null) - RelatedDataElement = null; - else - RelatedDataElement = new Hl7.Fhir.Model.FhirString(value); + RelatedDataElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RelatedData"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Requirement != null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)Requirement.DeepCopyInternal(); - if(RelatedDataElement != null) dest.RelatedDataElement = (Hl7.Fhir.Model.FhirString)RelatedDataElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Requirement is not null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)_Requirement.DeepCopyInternal(); + if(_RelatedDataElement is not null) dest.RelatedDataElement = (Hl7.Fhir.Model.FhirString)_RelatedDataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2217,48 +2125,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Requirement, otherT.Requirement)) return false; - if(!comparer.Equals(RelatedDataElement, otherT.RelatedDataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; + if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "requirement": - value = Requirement; - return Requirement is not null; + value = _Requirement; + return _Requirement is not null; case "relatedData": - value = RelatedDataElement; - return RelatedDataElement is not null; + value = _RelatedDataElement; + return _RelatedDataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requirement": - Requirement = (Hl7.Fhir.Model.DataRequirement)value; + Requirement = (Hl7.Fhir.Model.DataRequirement?)value; return this; case "relatedData": - RelatedDataElement = (Hl7.Fhir.Model.FhirString)value; + RelatedDataElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -2269,9 +2177,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Requirement is not null) yield return new KeyValuePair("requirement",Requirement); - if (RelatedDataElement is not null) yield return new KeyValuePair("relatedData",RelatedDataElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Requirement is not null) yield return new KeyValuePair("requirement",_Requirement); + if (_RelatedDataElement is not null) yield return new KeyValuePair("relatedData",_RelatedDataElement); } } @@ -2299,28 +2207,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("targetId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id TargetIdElement + public Hl7.Fhir.Model.Id? TargetIdElement { get { return _TargetIdElement; } set { _TargetIdElement = value; OnPropertyChanged("TargetIdElement"); } } - private Hl7.Fhir.Model.Id _TargetIdElement; + private Hl7.Fhir.Model.Id? _TargetIdElement; /// /// What action is this related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetId + public string? TargetId { - get { return TargetIdElement != null ? TargetIdElement.Value : null; } + get => _TargetIdElement?.Value; set { - if (value == null) - TargetIdElement = null; - else - TargetIdElement = new Hl7.Fhir.Model.Id(value); + TargetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("TargetId"); } } @@ -2333,13 +2238,13 @@ public string TargetId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end @@ -2348,13 +2253,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -2366,13 +2268,13 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [DeclaredType(Type = typeof(Code))] [Binding("ActionRelationshipType")] [DataMember] - public Code EndRelationshipElement + public Code? EndRelationshipElement { get { return _EndRelationshipElement; } set { _EndRelationshipElement = value; OnPropertyChanged("EndRelationshipElement"); } } - private Code _EndRelationshipElement; + private Code? _EndRelationshipElement; /// /// before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end @@ -2381,13 +2283,10 @@ public Code EndRelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? EndRelationship { - get { return EndRelationshipElement != null ? EndRelationshipElement.Value : null; } + get => _EndRelationshipElement?.Value; set { - if (value == null) - EndRelationshipElement = null; - else - EndRelationshipElement = new Code(value); + EndRelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("EndRelationship"); } } @@ -2399,28 +2298,24 @@ public Hl7.Fhir.Model.ActionRelationshipType? EndRelationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TargetIdElement != null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)TargetIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(EndRelationshipElement != null) dest.EndRelationshipElement = (Code)EndRelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_TargetIdElement is not null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)_TargetIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_EndRelationshipElement is not null) dest.EndRelationshipElement = (Code)_EndRelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2432,55 +2327,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TargetIdElement, otherT.TargetIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(EndRelationshipElement, otherT.EndRelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_EndRelationshipElement, otherT._EndRelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "targetId": - value = TargetIdElement; - return TargetIdElement is not null; + value = _TargetIdElement; + return _TargetIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "endRelationship": - value = EndRelationshipElement; - return EndRelationshipElement is not null; + value = _EndRelationshipElement; + return _EndRelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "targetId": - TargetIdElement = (Hl7.Fhir.Model.Id)value; + TargetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "endRelationship": - EndRelationshipElement = (Code)value; + EndRelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2491,10 +2386,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TargetIdElement is not null) yield return new KeyValuePair("targetId",TargetIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (EndRelationshipElement is not null) yield return new KeyValuePair("endRelationship",EndRelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_TargetIdElement is not null) yield return new KeyValuePair("targetId",_TargetIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_EndRelationshipElement is not null) yield return new KeyValuePair("endRelationship",_EndRelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -2520,28 +2415,25 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("actorId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString ActorIdElement + public Hl7.Fhir.Model.FhirString? ActorIdElement { get { return _ActorIdElement; } set { _ActorIdElement = value; OnPropertyChanged("ActorIdElement"); } } - private Hl7.Fhir.Model.FhirString _ActorIdElement; + private Hl7.Fhir.Model.FhirString? _ActorIdElement; /// /// What actor /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActorId + public string? ActorId { - get { return ActorIdElement != null ? ActorIdElement.Value : null; } + get => _ActorIdElement?.Value; set { - if (value == null) - ActorIdElement = null; - else - ActorIdElement = new Hl7.Fhir.Model.FhirString(value); + ActorIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ActorId"); } } @@ -2553,13 +2445,13 @@ public string ActorId [DeclaredType(Type = typeof(Code))] [Binding("ActivityParticipantType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson @@ -2568,13 +2460,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -2584,28 +2473,25 @@ public Hl7.Fhir.Model.ActionParticipantType? Type /// [FhirElement("typeCanonical", Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical TypeCanonicalElement + public Hl7.Fhir.Model.Canonical? TypeCanonicalElement { get { return _TypeCanonicalElement; } set { _TypeCanonicalElement = value; OnPropertyChanged("TypeCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _TypeCanonicalElement; + private Hl7.Fhir.Model.Canonical? _TypeCanonicalElement; /// /// Who or what can participate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TypeCanonical + public string? TypeCanonical { - get { return TypeCanonicalElement != null ? TypeCanonicalElement.Value : null; } + get => _TypeCanonicalElement?.Value; set { - if (value == null) - TypeCanonicalElement = null; - else - TypeCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + TypeCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("TypeCanonical"); } } @@ -2617,13 +2503,13 @@ public string TypeCanonical [CLSCompliant(false)] [References("CareTeam","Device","DeviceDefinition","Endpoint","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference TypeReference + public Hl7.Fhir.Model.ResourceReference? TypeReference { get { return _TypeReference; } set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } - private Hl7.Fhir.Model.ResourceReference _TypeReference; + private Hl7.Fhir.Model.ResourceReference? _TypeReference; /// /// E.g. Nurse, Surgeon, Parent. @@ -2631,13 +2517,13 @@ public Hl7.Fhir.Model.ResourceReference TypeReference [FhirElement("role", Order=80)] [Binding("ActionParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// E.g. Author, Reviewer, Witness, etc. @@ -2645,30 +2531,26 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("function", Order=90)] [Binding("ActionParticipantFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ActorIdElement != null) dest.ActorIdElement = (Hl7.Fhir.Model.FhirString)ActorIdElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TypeCanonicalElement != null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)TypeCanonicalElement.DeepCopyInternal(); - if(TypeReference != null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)TypeReference.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); + if(_ActorIdElement is not null) dest.ActorIdElement = (Hl7.Fhir.Model.FhirString)_ActorIdElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TypeCanonicalElement is not null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)_TypeCanonicalElement.DeepCopyInternal(); + if(_TypeReference is not null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)_TypeReference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2680,69 +2562,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ActorIdElement, otherT.ActorIdElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TypeCanonicalElement, otherT.TypeCanonicalElement)) return false; - if(!comparer.Equals(TypeReference, otherT.TypeReference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; + if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Function, otherT._Function)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "actorId": - value = ActorIdElement; - return ActorIdElement is not null; + value = _ActorIdElement; + return _ActorIdElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "typeCanonical": - value = TypeCanonicalElement; - return TypeCanonicalElement is not null; + value = _TypeCanonicalElement; + return _TypeCanonicalElement is not null; case "typeReference": - value = TypeReference; - return TypeReference is not null; + value = _TypeReference; + return _TypeReference is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "actorId": - ActorIdElement = (Hl7.Fhir.Model.FhirString)value; + ActorIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "typeCanonical": - TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + TypeCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "typeReference": - TypeReference = (Hl7.Fhir.Model.ResourceReference)value; + TypeReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -2753,12 +2635,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ActorIdElement is not null) yield return new KeyValuePair("actorId",ActorIdElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",TypeCanonicalElement); - if (TypeReference is not null) yield return new KeyValuePair("typeReference",TypeReference); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Function is not null) yield return new KeyValuePair("function",Function); + if (_ActorIdElement is not null) yield return new KeyValuePair("actorId",_ActorIdElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",_TypeCanonicalElement); + if (_TypeReference is not null) yield return new KeyValuePair("typeReference",_TypeReference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Function is not null) yield return new KeyValuePair("function",_Function); } } @@ -2785,28 +2667,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("path", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -2816,26 +2695,22 @@ public string Path /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2847,41 +2722,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -2892,8 +2767,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -2903,28 +2778,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this plan definition, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2937,39 +2809,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the plan definition. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2981,41 +2850,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this plan definition (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this plan definition (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -3025,28 +2891,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this plan definition (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -3056,28 +2919,25 @@ public string Title /// [FhirElement("subtitle", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString SubtitleElement + public Hl7.Fhir.Model.FhirString? SubtitleElement { get { return _SubtitleElement; } set { _SubtitleElement = value; OnPropertyChanged("SubtitleElement"); } } - private Hl7.Fhir.Model.FhirString _SubtitleElement; + private Hl7.Fhir.Model.FhirString? _SubtitleElement; /// /// Subordinate title of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Subtitle + public string? Subtitle { - get { return SubtitleElement != null ? SubtitleElement.Value : null; } + get => _SubtitleElement?.Value; set { - if (value == null) - SubtitleElement = null; - else - SubtitleElement = new Hl7.Fhir.Model.FhirString(value); + SubtitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Subtitle"); } } @@ -3088,13 +2948,13 @@ public string Subtitle [FhirElement("type", InSummary=true, Order=160)] [Binding("PlanDefinitionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// draft | active | retired | unknown. @@ -3104,13 +2964,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -3119,13 +2979,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -3135,13 +2992,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=180, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -3150,13 +3007,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -3170,41 +3024,38 @@ public bool? Experimental [References("Group","MedicinalProductDefinition","SubstanceDefinition","AdministrableProductDefinition","ManufacturedItemDefinition","PackagedProductDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date last changed. /// [FhirElement("date", InSummary=true, Order=200, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -3214,28 +3065,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=210, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -3248,39 +3096,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the plan definition. /// [FhirElement("description", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -3293,11 +3138,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for plan definition (if applicable). @@ -3308,39 +3153,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this plan definition is defined. /// [FhirElement("purpose", Order=260, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this plan definition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -3350,28 +3192,25 @@ public string Purpose /// [FhirElement("usage", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown UsageElement + public Hl7.Fhir.Model.Markdown? UsageElement { get { return _UsageElement; } set { _UsageElement = value; OnPropertyChanged("UsageElement"); } } - private Hl7.Fhir.Model.Markdown _UsageElement; + private Hl7.Fhir.Model.Markdown? _UsageElement; /// /// Describes the clinical usage of the plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Usage + public string? Usage { - get { return UsageElement != null ? UsageElement.Value : null; } + get => _UsageElement?.Value; set { - if (value == null) - UsageElement = null; - else - UsageElement = new Hl7.Fhir.Model.Markdown(value); + UsageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Usage"); } } @@ -3381,28 +3220,25 @@ public string Usage /// [FhirElement("copyright", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -3412,28 +3248,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -3443,28 +3276,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the plan definition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -3474,28 +3304,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=310)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the plan definition was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -3505,13 +3332,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=320)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// E.g. Education, Treatment, Assessment. @@ -3522,11 +3349,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Topic { - get { if(_Topic==null) _Topic = new List(); return _Topic; } + get => _Topic ?? new List(); set { _Topic = value; OnPropertyChanged("Topic"); } } - private List _Topic; + private List? _Topic; /// /// Who authored the content. @@ -3536,11 +3363,11 @@ public List Topic [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// Who edited the content. @@ -3550,11 +3377,11 @@ public List Author [DataMember] public List Editor { - get { if(_Editor==null) _Editor = new List(); return _Editor; } + get => _Editor ?? new List(); set { _Editor = value; OnPropertyChanged("Editor"); } } - private List _Editor; + private List? _Editor; /// /// Who reviewed the content. @@ -3564,11 +3391,11 @@ public List Editor [DataMember] public List Reviewer { - get { if(_Reviewer==null) _Reviewer = new List(); return _Reviewer; } + get => _Reviewer ?? new List(); set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } - private List _Reviewer; + private List? _Reviewer; /// /// Who endorsed the content. @@ -3578,11 +3405,11 @@ public List Reviewer [DataMember] public List Endorser { - get { if(_Endorser==null) _Endorser = new List(); return _Endorser; } + get => _Endorser ?? new List(); set { _Endorser = value; OnPropertyChanged("Endorser"); } } - private List _Endorser; + private List? _Endorser; /// /// Additional documentation, citations. @@ -3592,11 +3419,11 @@ public List Endorser [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Logic used by the plan definition. @@ -3606,24 +3433,24 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get { if(_LibraryElement==null) _LibraryElement = new List(); return _LibraryElement; } + get => _LibraryElement ?? new List(); set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } - private List _LibraryElement; + private List? _LibraryElement; /// /// Logic used by the plan definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Library + public IEnumerable? Library { - get { return LibraryElement != null ? LibraryElement.Select(elem => elem.Value) : null; } + get => _LibraryElement?.Select(elem => elem.Value); set { if (value == null) - LibraryElement = null; + LibraryElement = null!; else LibraryElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Library"); @@ -3638,11 +3465,11 @@ public IEnumerable Library [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Actors within the plan. @@ -3652,11 +3479,11 @@ public List Goal [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Action defined by the plan. @@ -3666,11 +3493,11 @@ public List Actor [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; /// /// Preconditions for service. @@ -3680,61 +3507,57 @@ public List Action [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PlanDefinition; - - if (dest == null) - { + if(other is not PlanDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(SubtitleElement != null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)SubtitleElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(UsageElement != null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)UsageElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Topic.Any()) dest.Topic = new List(Topic.DeepCopyInternal()); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Editor.Any()) dest.Editor = new List(Editor.DeepCopyInternal()); - if(Reviewer.Any()) dest.Reviewer = new List(Reviewer.DeepCopyInternal()); - if(Endorser.Any()) dest.Endorser = new List(Endorser.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(LibraryElement.Any()) dest.LibraryElement = new List(LibraryElement.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_SubtitleElement is not null) dest.SubtitleElement = (Hl7.Fhir.Model.FhirString)_SubtitleElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_UsageElement is not null) dest.UsageElement = (Hl7.Fhir.Model.Markdown)_UsageElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Topic is not null) dest.Topic = new List(_Topic.DeepCopyInternal()); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Editor is not null) dest.Editor = new List(_Editor.DeepCopyInternal()); + if(_Reviewer is not null) dest.Reviewer = new List(_Reviewer.DeepCopyInternal()); + if(_Endorser is not null) dest.Endorser = new List(_Endorser.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_LibraryElement is not null) dest.LibraryElement = new List(_LibraryElement.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3746,272 +3569,272 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PlanDefinition; - if(otherT == null) return false; + if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(SubtitleElement, otherT.SubtitleElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(UsageElement, otherT.UsageElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Topic, otherT.Topic)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Editor, otherT.Editor)) return false; - if(!comparer.ListEquals(Reviewer, otherT.Reviewer)) return false; - if(!comparer.ListEquals(Endorser, otherT.Endorser)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.ListEquals(LibraryElement, otherT.LibraryElement)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_SubtitleElement, otherT._SubtitleElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Topic, otherT._Topic)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Editor, otherT._Editor)) return false; + if(!comparer.ListEquals(_Reviewer, otherT._Reviewer)) return false; + if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "subtitle": - value = SubtitleElement; - return SubtitleElement is not null; + value = _SubtitleElement; + return _SubtitleElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "usage": - value = UsageElement; - return UsageElement is not null; + value = _UsageElement; + return _UsageElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "topic": - value = Topic; - return Topic?.Any() == true; + value = _Topic; + return _Topic?.Any() == true; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "editor": - value = Editor; - return Editor?.Any() == true; + value = _Editor; + return _Editor?.Any() == true; case "reviewer": - value = Reviewer; - return Reviewer?.Any() == true; + value = _Reviewer; + return _Reviewer?.Any() == true; case "endorser": - value = Endorser; - return Endorser?.Any() == true; + value = _Endorser; + return _Endorser?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "library": - value = LibraryElement; - return LibraryElement?.Any() == true; + value = _LibraryElement; + return _LibraryElement?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "subtitle": - SubtitleElement = (Hl7.Fhir.Model.FhirString)value; + SubtitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "usage": - UsageElement = (Hl7.Fhir.Model.Markdown)value; + UsageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "topic": - Topic = (List)value; + Topic = (List?)value!; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "editor": - Editor = (List)value; + Editor = (List?)value!; return this; case "reviewer": - Reviewer = (List)value; + Reviewer = (List?)value!; return this; case "endorser": - Endorser = (List)value; + Endorser = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "library": - LibraryElement = (List)value; + LibraryElement = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -4022,41 +3845,41 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (SubtitleElement is not null) yield return new KeyValuePair("subtitle",SubtitleElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (UsageElement is not null) yield return new KeyValuePair("usage",UsageElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Topic?.Any() == true) yield return new KeyValuePair("topic",Topic); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Editor?.Any() == true) yield return new KeyValuePair("editor",Editor); - if (Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",Reviewer); - if (Endorser?.Any() == true) yield return new KeyValuePair("endorser",Endorser); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (LibraryElement?.Any() == true) yield return new KeyValuePair("library",LibraryElement); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_SubtitleElement is not null) yield return new KeyValuePair("subtitle",_SubtitleElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_UsageElement is not null) yield return new KeyValuePair("usage",_UsageElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Topic?.Any() == true) yield return new KeyValuePair("topic",_Topic); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Editor?.Any() == true) yield return new KeyValuePair("editor",_Editor); + if (_Reviewer?.Any() == true) yield return new KeyValuePair("reviewer",_Reviewer); + if (_Endorser?.Any() == true) yield return new KeyValuePair("endorser",_Endorser); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_LibraryElement?.Any() == true) yield return new KeyValuePair("library",_LibraryElement); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs index d62bbcad6..9ec591872 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -85,11 +88,11 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Coded representation of the qualification. @@ -98,26 +101,26 @@ public List Identifier [Binding("Qualification")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Period during which the qualification is valid. /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Organization that regulates and issues the qualification. @@ -126,28 +129,24 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Issuer + public Hl7.Fhir.Model.ResourceReference? Issuer { get { return _Issuer; } set { _Issuer = value; OnPropertyChanged("Issuer"); } } - private Hl7.Fhir.Model.ResourceReference _Issuer; + private Hl7.Fhir.Model.ResourceReference? _Issuer; protected internal override void CopyToInternal(Base other) { - var dest = other as QualificationComponent; - - if (dest == null) - { + if(other is not QualificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Issuer != null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)Issuer.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Issuer is not null) dest.Issuer = (Hl7.Fhir.Model.ResourceReference)_Issuer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -159,55 +158,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QualificationComponent; - if(otherT == null) return false; + if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Issuer, otherT.Issuer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "issuer": - value = Issuer; - return Issuer is not null; + value = _Issuer; + return _Issuer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "issuer": - Issuer = (Hl7.Fhir.Model.ResourceReference)value; + Issuer = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -218,10 +217,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Issuer is not null) yield return new KeyValuePair("issuer",Issuer); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Issuer is not null) yield return new KeyValuePair("issuer",_Issuer); } } @@ -252,26 +251,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -280,29 +279,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -314,41 +306,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -359,8 +351,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -373,24 +365,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner's record is in active use @@ -399,13 +391,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -418,11 +407,11 @@ public bool? Active [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the practitioner (that apply to all roles). @@ -432,11 +421,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -445,13 +434,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -460,13 +449,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -476,28 +462,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the practitioner was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -509,13 +492,13 @@ public string BirthDate [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Deceased + public Hl7.Fhir.Model.DataType? Deceased { get { return _Deceased; } set { _Deceased = value; OnPropertyChanged("Deceased"); } } - private Hl7.Fhir.Model.DataType _Deceased; + private Hl7.Fhir.Model.DataType? _Deceased; /// /// Address(es) of the practitioner that are not role specific (typically home address). @@ -525,11 +508,11 @@ public Hl7.Fhir.Model.DataType Deceased [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. @@ -539,11 +522,11 @@ public List Address [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Qualifications, certifications, accreditations, licenses, training, etc. pertaining to the provision of care. @@ -553,11 +536,11 @@ public List Photo [DataMember] public List Qualification { - get { if(_Qualification==null) _Qualification = new List(); return _Qualification; } + get => _Qualification ?? new List(); set { _Qualification = value; OnPropertyChanged("Qualification"); } } - private List _Qualification; + private List? _Qualification; /// /// A language which may be used to communicate with the practitioner. @@ -567,35 +550,31 @@ public List Qualification [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Practitioner; - - if (dest == null) - { + if(other is not Practitioner dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Deceased != null) dest.Deceased = (Hl7.Fhir.Model.DataType)Deceased.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Qualification.Any()) dest.Qualification = new List(Qualification.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Deceased is not null) dest.Deceased = (Hl7.Fhir.Model.DataType)_Deceased.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Qualification is not null) dest.Qualification = new List(_Qualification.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -607,104 +586,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Practitioner; - if(otherT == null) return false; + if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.Equals(Deceased, otherT.Deceased)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.ListEquals(Qualification, otherT.Qualification)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.Equals(_Deceased, otherT._Deceased)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "deceased": - value = Deceased; - return Deceased is not null; + value = _Deceased; + return _Deceased is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "qualification": - value = Qualification; - return Qualification?.Any() == true; + value = _Qualification; + return _Qualification?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "deceased": - Deceased = (Hl7.Fhir.Model.DataType)value; + Deceased = (Hl7.Fhir.Model.DataType?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "qualification": - Qualification = (List)value; + Qualification = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -715,17 +694,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Deceased is not null) yield return new KeyValuePair("deceased",Deceased); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Qualification?.Any() == true) yield return new KeyValuePair("qualification",Qualification); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Deceased is not null) yield return new KeyValuePair("deceased",_Deceased); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Qualification?.Any() == true) yield return new KeyValuePair("qualification",_Qualification); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs index 010007f53..bdbfa51d1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -67,24 +70,24 @@ public partial class PractitionerRole : Hl7.Fhir.Model.DomainResource, IIdentifi [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this practitioner role record is in active use. /// [FhirElement("active", InSummary=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this practitioner role record is in active use @@ -93,13 +96,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -109,13 +109,13 @@ public bool? Active /// [FhirElement("period", InSummary=true, Order=110, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Practitioner that provides services for the organization. @@ -124,13 +124,13 @@ public Hl7.Fhir.Model.Period Period [CLSCompliant(false)] [References("Practitioner")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Practitioner + public Hl7.Fhir.Model.ResourceReference? Practitioner { get { return _Practitioner; } set { _Practitioner = value; OnPropertyChanged("Practitioner"); } } - private Hl7.Fhir.Model.ResourceReference _Practitioner; + private Hl7.Fhir.Model.ResourceReference? _Practitioner; /// /// Organization where the roles are available. @@ -139,13 +139,13 @@ public Hl7.Fhir.Model.ResourceReference Practitioner [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// Roles which this practitioner may perform. @@ -156,11 +156,11 @@ public Hl7.Fhir.Model.ResourceReference Organization [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Specific specialty of the practitioner. @@ -171,11 +171,11 @@ public List Code [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Location(s) where the practitioner provides care. @@ -187,11 +187,11 @@ public List Specialty [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Healthcare services provided for this role's Organization/Location(s). @@ -203,11 +203,11 @@ public List Location [DataMember] public List HealthcareService { - get { if(_HealthcareService==null) _HealthcareService = new List(); return _HealthcareService; } + get => _HealthcareService ?? new List(); set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } - private List _HealthcareService; + private List? _HealthcareService; /// /// Official contact details relating to this PractitionerRole. @@ -217,11 +217,11 @@ public List HealthcareService [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Collection of characteristics (attributes). @@ -232,11 +232,11 @@ public List Contact [DataMember] public List Characteristic { - get { if(_Characteristic==null) _Characteristic = new List(); return _Characteristic; } + get => _Characteristic ?? new List(); set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } - private List _Characteristic; + private List? _Characteristic; /// /// A language the practitioner (in this role) can use in patient communication. @@ -247,11 +247,11 @@ public List Characteristic [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; /// /// Times the Practitioner is available at this location and/or healthcare service (including exceptions). @@ -261,11 +261,11 @@ public List Communication [DataMember] public List Availability { - get { if(_Availability==null) _Availability = new List(); return _Availability; } + get => _Availability ?? new List(); set { _Availability = value; OnPropertyChanged("Availability"); } } - private List _Availability; + private List? _Availability; /// /// Endpoints for interacting with the practitioner in this role. @@ -277,38 +277,34 @@ public List Availability [DataMember] public List Endpoint { - get { if(_Endpoint==null) _Endpoint = new List(); return _Endpoint; } + get => _Endpoint ?? new List(); set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } - private List _Endpoint; + private List? _Endpoint; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as PractitionerRole; - - if (dest == null) - { + if(other is not PractitionerRole dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Practitioner != null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)Practitioner.DeepCopyInternal(); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(HealthcareService.Any()) dest.HealthcareService = new List(HealthcareService.DeepCopyInternal()); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(Characteristic.Any()) dest.Characteristic = new List(Characteristic.DeepCopyInternal()); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); - if(Availability.Any()) dest.Availability = new List(Availability.DeepCopyInternal()); - if(Endpoint.Any()) dest.Endpoint = new List(Endpoint.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Practitioner is not null) dest.Practitioner = (Hl7.Fhir.Model.ResourceReference)_Practitioner.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_HealthcareService is not null) dest.HealthcareService = new List(_HealthcareService.DeepCopyInternal()); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_Characteristic is not null) dest.Characteristic = new List(_Characteristic.DeepCopyInternal()); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); + if(_Availability is not null) dest.Availability = new List(_Availability.DeepCopyInternal()); + if(_Endpoint is not null) dest.Endpoint = new List(_Endpoint.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -320,125 +316,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PractitionerRole; - if(otherT == null) return false; + if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Practitioner, otherT.Practitioner)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(HealthcareService, otherT.HealthcareService)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.ListEquals(Characteristic, otherT.Characteristic)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; - if(!comparer.ListEquals(Availability, otherT.Availability)) return false; - if(!comparer.ListEquals(Endpoint, otherT.Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; + if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; + if(!comparer.ListEquals(_Availability, otherT._Availability)) return false; + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "practitioner": - value = Practitioner; - return Practitioner is not null; + value = _Practitioner; + return _Practitioner is not null; case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "healthcareService": - value = HealthcareService; - return HealthcareService?.Any() == true; + value = _HealthcareService; + return _HealthcareService?.Any() == true; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "characteristic": - value = Characteristic; - return Characteristic?.Any() == true; + value = _Characteristic; + return _Characteristic?.Any() == true; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; case "availability": - value = Availability; - return Availability?.Any() == true; + value = _Availability; + return _Availability?.Any() == true; case "endpoint": - value = Endpoint; - return Endpoint?.Any() == true; + value = _Endpoint; + return _Endpoint?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "practitioner": - Practitioner = (Hl7.Fhir.Model.ResourceReference)value; + Practitioner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "healthcareService": - HealthcareService = (List)value; + HealthcareService = (List?)value!; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "characteristic": - Characteristic = (List)value; + Characteristic = (List?)value!; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; case "availability": - Availability = (List)value; + Availability = (List?)value!; return this; case "endpoint": - Endpoint = (List)value; + Endpoint = (List?)value!; return this; default: return base.SetValue(key, value); @@ -449,20 +445,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Practitioner is not null) yield return new KeyValuePair("practitioner",Practitioner); - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",HealthcareService); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",Characteristic); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); - if (Availability?.Any() == true) yield return new KeyValuePair("availability",Availability); - if (Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",Endpoint); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Practitioner is not null) yield return new KeyValuePair("practitioner",_Practitioner); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_HealthcareService?.Any() == true) yield return new KeyValuePair("healthcareService",_HealthcareService); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_Characteristic?.Any() == true) yield return new KeyValuePair("characteristic",_Characteristic); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); + if (_Availability?.Any() == true) yield return new KeyValuePair("availability",_Availability); + if (_Endpoint?.Any() == true) yield return new KeyValuePair("endpoint",_Endpoint); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs index d4c0d8a9a..ab0fcc643 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("ProcedurePerformerRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the procedure. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device","CareTeam","HealthcareService")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; /// /// Organization the device or practitioner was acting for. @@ -112,41 +115,37 @@ public Hl7.Fhir.Model.ResourceReference Actor [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// When the performer performed the procedure. /// [FhirElement("period", Order=70)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -158,55 +157,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -217,10 +216,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -247,13 +246,13 @@ public partial class FocalDeviceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("action", Order=40)] [Binding("DeviceActionKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Action + public Hl7.Fhir.Model.CodeableConcept? Action { get { return _Action; } set { _Action = value; OnPropertyChanged("Action"); } } - private Hl7.Fhir.Model.CodeableConcept _Action; + private Hl7.Fhir.Model.CodeableConcept? _Action; /// /// Device that was changed. @@ -263,26 +262,22 @@ public Hl7.Fhir.Model.CodeableConcept Action [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Manipulated + public Hl7.Fhir.Model.ResourceReference? Manipulated { get { return _Manipulated; } set { _Manipulated = value; OnPropertyChanged("Manipulated"); } } - private Hl7.Fhir.Model.ResourceReference _Manipulated; + private Hl7.Fhir.Model.ResourceReference? _Manipulated; protected internal override void CopyToInternal(Base other) { - var dest = other as FocalDeviceComponent; - - if (dest == null) - { + if(other is not FocalDeviceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action != null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)Action.DeepCopyInternal(); - if(Manipulated != null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)Manipulated.DeepCopyInternal(); + if(_Action is not null) dest.Action = (Hl7.Fhir.Model.CodeableConcept)_Action.DeepCopyInternal(); + if(_Manipulated is not null) dest.Manipulated = (Hl7.Fhir.Model.ResourceReference)_Manipulated.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -294,41 +289,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FocalDeviceComponent; - if(otherT == null) return false; + if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Action, otherT.Action)) return false; - if(!comparer.Equals(Manipulated, otherT.Manipulated)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action is not null; + value = _Action; + return _Action is not null; case "manipulated": - value = Manipulated; - return Manipulated is not null; + value = _Manipulated; + return _Manipulated is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (Hl7.Fhir.Model.CodeableConcept)value; + Action = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "manipulated": - Manipulated = (Hl7.Fhir.Model.ResourceReference)value; + Manipulated = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -339,8 +334,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action is not null) yield return new KeyValuePair("action",Action); - if (Manipulated is not null) yield return new KeyValuePair("manipulated",Manipulated); + if (_Action is not null) yield return new KeyValuePair("action",_Action); + if (_Manipulated is not null) yield return new KeyValuePair("manipulated",_Manipulated); } } @@ -353,11 +348,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -367,24 +362,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -399,24 +394,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -433,11 +428,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -449,11 +444,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown. @@ -463,13 +458,13 @@ public List PartOf [Binding("ProcedureStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// preparation | in-progress | not-done | on-hold | stopped | completed | entered-in-error | unknown @@ -478,13 +473,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.EventStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -495,13 +487,13 @@ public Hl7.Fhir.Model.EventStatus? Status [FhirElement("statusReason", InSummary=true, Order=150)] [Binding("ProcedureNegationReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// Classification of the procedure. @@ -512,11 +504,11 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// Identification of the procedure. @@ -524,13 +516,13 @@ public List Category [FhirElement("code", InSummary=true, Order=170, FiveWs="FiveWs.what[x]")] [Binding("ProcedureCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Individual or entity the procedure was performed on. @@ -540,13 +532,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group","Device","Practitioner","Organization","Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Who is the target of the procedure when it is not the subject of record only. @@ -555,13 +547,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Patient","Group","RelatedPerson","Practitioner","Organization","CareTeam","PractitionerRole","Specimen")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// The Encounter during which this Procedure was created. @@ -570,13 +562,13 @@ public Hl7.Fhir.Model.ResourceReference Focus [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the procedure occurred or is occurring. @@ -585,41 +577,38 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the procedure was first captured in the subject's record. /// [FhirElement("recorded", InSummary=true, Order=220, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime RecordedElement + public Hl7.Fhir.Model.FhirDateTime? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _RecordedElement; + private Hl7.Fhir.Model.FhirDateTime? _RecordedElement; /// /// When the procedure was first captured in the subject's record /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Recorded + public string? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.FhirDateTime(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Recorded"); } } @@ -631,13 +620,13 @@ public string Recorded [CLSCompliant(false)] [References("Patient","RelatedPerson","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Recorder + public Hl7.Fhir.Model.ResourceReference? Recorder { get { return _Recorder; } set { _Recorder = value; OnPropertyChanged("Recorder"); } } - private Hl7.Fhir.Model.ResourceReference _Recorder; + private Hl7.Fhir.Model.ResourceReference? _Recorder; /// /// Reported rather than primary record. @@ -647,13 +636,13 @@ public Hl7.Fhir.Model.ResourceReference Recorder [References("Patient","RelatedPerson","Practitioner","PractitionerRole","Organization")] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Reported + public Hl7.Fhir.Model.DataType? Reported { get { return _Reported; } set { _Reported = value; OnPropertyChanged("Reported"); } } - private Hl7.Fhir.Model.DataType _Reported; + private Hl7.Fhir.Model.DataType? _Reported; /// /// Who performed the procedure and what they did. @@ -663,11 +652,11 @@ public Hl7.Fhir.Model.DataType Reported [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where the procedure happened. @@ -676,13 +665,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// The justification that the procedure was performed. @@ -693,11 +682,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Target body sites. @@ -708,11 +697,11 @@ public List Reason [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// The result of procedure. @@ -720,13 +709,13 @@ public List BodySite [FhirElement("outcome", InSummary=true, Order=290)] [Binding("ProcedureOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Any report resulting from the procedure. @@ -738,11 +727,11 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [DataMember] public List Report { - get { if(_Report==null) _Report = new List(); return _Report; } + get => _Report ?? new List(); set { _Report = value; OnPropertyChanged("Report"); } } - private List _Report; + private List? _Report; /// /// Complication following the procedure. @@ -753,11 +742,11 @@ public List Report [DataMember] public List Complication { - get { if(_Complication==null) _Complication = new List(); return _Complication; } + get => _Complication ?? new List(); set { _Complication = value; OnPropertyChanged("Complication"); } } - private List _Complication; + private List? _Complication; /// /// Instructions for follow up. @@ -768,11 +757,11 @@ public List Complication [DataMember] public List FollowUp { - get { if(_FollowUp==null) _FollowUp = new List(); return _FollowUp; } + get => _FollowUp ?? new List(); set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } - private List _FollowUp; + private List? _FollowUp; /// /// Additional information about the procedure. @@ -782,11 +771,11 @@ public List FollowUp [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Manipulated, implanted, or removed device. @@ -796,11 +785,11 @@ public List Note [DataMember] public List FocalDevice { - get { if(_FocalDevice==null) _FocalDevice = new List(); return _FocalDevice; } + get => _FocalDevice ?? new List(); set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } - private List _FocalDevice; + private List? _FocalDevice; /// /// Items used during procedure. @@ -811,11 +800,11 @@ public List FocalDevice [DataMember] public List Used { - get { if(_Used==null) _Used = new List(); return _Used; } + get => _Used ?? new List(); set { _Used = value; OnPropertyChanged("Used"); } } - private List _Used; + private List? _Used; /// /// Extra information relevant to the procedure. @@ -827,52 +816,48 @@ public List Used [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Procedure; - - if (dest == null) - { + if(other is not Procedure dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)RecordedElement.DeepCopyInternal(); - if(Recorder != null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)Recorder.DeepCopyInternal(); - if(Reported != null) dest.Reported = (Hl7.Fhir.Model.DataType)Reported.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Report.Any()) dest.Report = new List(Report.DeepCopyInternal()); - if(Complication.Any()) dest.Complication = new List(Complication.DeepCopyInternal()); - if(FollowUp.Any()) dest.FollowUp = new List(FollowUp.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(FocalDevice.Any()) dest.FocalDevice = new List(FocalDevice.DeepCopyInternal()); - if(Used.Any()) dest.Used = new List(Used.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.FhirDateTime)_RecordedElement.DeepCopyInternal(); + if(_Recorder is not null) dest.Recorder = (Hl7.Fhir.Model.ResourceReference)_Recorder.DeepCopyInternal(); + if(_Reported is not null) dest.Reported = (Hl7.Fhir.Model.DataType)_Reported.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Report is not null) dest.Report = new List(_Report.DeepCopyInternal()); + if(_Complication is not null) dest.Complication = new List(_Complication.DeepCopyInternal()); + if(_FollowUp is not null) dest.FollowUp = new List(_FollowUp.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_FocalDevice is not null) dest.FocalDevice = new List(_FocalDevice.DeepCopyInternal()); + if(_Used is not null) dest.Used = new List(_Used.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -884,223 +869,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Procedure; - if(otherT == null) return false; + if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.Equals(Recorder, otherT.Recorder)) return false; - if(!comparer.Equals(Reported, otherT.Reported)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.ListEquals(Report, otherT.Report)) return false; - if(!comparer.ListEquals(Complication, otherT.Complication)) return false; - if(!comparer.ListEquals(FollowUp, otherT.FollowUp)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(FocalDevice, otherT.FocalDevice)) return false; - if(!comparer.ListEquals(Used, otherT.Used)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.Equals(_Recorder, otherT._Recorder)) return false; + if(!comparer.Equals(_Reported, otherT._Reported)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.ListEquals(_Report, otherT._Report)) return false; + if(!comparer.ListEquals(_Complication, otherT._Complication)) return false; + if(!comparer.ListEquals(_FollowUp, otherT._FollowUp)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; + if(!comparer.ListEquals(_Used, otherT._Used)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "recorder": - value = Recorder; - return Recorder is not null; + value = _Recorder; + return _Recorder is not null; case "reported": - value = Reported; - return Reported is not null; + value = _Reported; + return _Reported is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "report": - value = Report; - return Report?.Any() == true; + value = _Report; + return _Report?.Any() == true; case "complication": - value = Complication; - return Complication?.Any() == true; + value = _Complication; + return _Complication?.Any() == true; case "followUp": - value = FollowUp; - return FollowUp?.Any() == true; + value = _FollowUp; + return _FollowUp?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "focalDevice": - value = FocalDevice; - return FocalDevice?.Any() == true; + value = _FocalDevice; + return _FocalDevice?.Any() == true; case "used": - value = Used; - return Used?.Any() == true; + value = _Used; + return _Used?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.FhirDateTime)value; + RecordedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "recorder": - Recorder = (Hl7.Fhir.Model.ResourceReference)value; + Recorder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reported": - Reported = (Hl7.Fhir.Model.DataType)value; + Reported = (Hl7.Fhir.Model.DataType?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "report": - Report = (List)value; + Report = (List?)value!; return this; case "complication": - Complication = (List)value; + Complication = (List?)value!; return this; case "followUp": - FollowUp = (List)value; + FollowUp = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "focalDevice": - FocalDevice = (List)value; + FocalDevice = (List?)value!; return this; case "used": - Used = (List)value; + Used = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1111,34 +1096,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (Recorder is not null) yield return new KeyValuePair("recorder",Recorder); - if (Reported is not null) yield return new KeyValuePair("reported",Reported); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Report?.Any() == true) yield return new KeyValuePair("report",Report); - if (Complication?.Any() == true) yield return new KeyValuePair("complication",Complication); - if (FollowUp?.Any() == true) yield return new KeyValuePair("followUp",FollowUp); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",FocalDevice); - if (Used?.Any() == true) yield return new KeyValuePair("used",Used); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_Recorder is not null) yield return new KeyValuePair("recorder",_Recorder); + if (_Reported is not null) yield return new KeyValuePair("reported",_Reported); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Report?.Any() == true) yield return new KeyValuePair("report",_Report); + if (_Complication?.Any() == true) yield return new KeyValuePair("complication",_Complication); + if (_FollowUp?.Any() == true) yield return new KeyValuePair("followUp",_FollowUp); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_FocalDevice?.Any() == true) yield return new KeyValuePair("focalDevice",_FocalDevice); + if (_Used?.Any() == true) yield return new KeyValuePair("used",_Used); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs index 3495aa2fb..df362949b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -61,13 +64,13 @@ public partial class ProductShelfLife : Hl7.Fhir.Model.BackboneType /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The shelf life time period can be specified using a numerical value for the period of time and its unit of time measurement The unit of measurement shall be specified in accordance with ISO 11240 and the resulting terminology The symbol and the symbol identifier shall be used. @@ -76,13 +79,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Period + public Hl7.Fhir.Model.DataType? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.DataType _Period; + private Hl7.Fhir.Model.DataType? _Period; /// /// Special precautions for storage, if any, can be specified using an appropriate controlled vocabulary The controlled term and the controlled term identifier shall be specified. @@ -92,25 +95,21 @@ public Hl7.Fhir.Model.DataType Period [DataMember] public List SpecialPrecautionsForStorage { - get { if(_SpecialPrecautionsForStorage==null) _SpecialPrecautionsForStorage = new List(); return _SpecialPrecautionsForStorage; } + get => _SpecialPrecautionsForStorage ?? new List(); set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } - private List _SpecialPrecautionsForStorage; + private List? _SpecialPrecautionsForStorage; protected internal override void CopyToInternal(Base other) { - var dest = other as ProductShelfLife; - - if (dest == null) - { + if(other is not ProductShelfLife dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.DataType)Period.DeepCopyInternal(); - if(SpecialPrecautionsForStorage.Any()) dest.SpecialPrecautionsForStorage = new List(SpecialPrecautionsForStorage.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.DataType)_Period.DeepCopyInternal(); + if(_SpecialPrecautionsForStorage is not null) dest.SpecialPrecautionsForStorage = new List(_SpecialPrecautionsForStorage.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -122,48 +121,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProductShelfLife; - if(otherT == null) return false; + if(other is not ProductShelfLife otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(SpecialPrecautionsForStorage, otherT.SpecialPrecautionsForStorage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "specialPrecautionsForStorage": - value = SpecialPrecautionsForStorage; - return SpecialPrecautionsForStorage?.Any() == true; + value = _SpecialPrecautionsForStorage; + return _SpecialPrecautionsForStorage?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (Hl7.Fhir.Model.DataType)value; + Period = (Hl7.Fhir.Model.DataType?)value; return this; case "specialPrecautionsForStorage": - SpecialPrecautionsForStorage = (List)value; + SpecialPrecautionsForStorage = (List?)value!; return this; default: return base.SetValue(key, value); @@ -174,9 +173,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",SpecialPrecautionsForStorage); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_SpecialPrecautionsForStorage?.Any() == true) yield return new KeyValuePair("specialPrecautionsForStorage",_SpecialPrecautionsForStorage); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs index 761d728cc..ec911f5cd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -123,13 +126,13 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("ProvenanceAgentType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// What the agents role was. @@ -140,11 +143,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// The agent that participated in the event. @@ -154,13 +157,13 @@ public List Role [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","Device","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// The agent that delegated. @@ -169,28 +172,24 @@ public Hl7.Fhir.Model.ResourceReference Who [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; protected internal override void CopyToInternal(Base other) { - var dest = other as AgentComponent; - - if (dest == null) - { + if(other is not AgentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -202,55 +201,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AgentComponent; - if(otherT == null) return false; + if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -261,10 +260,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); } } @@ -290,13 +289,13 @@ public partial class EntityComponent : Hl7.Fhir.Model.BackboneElement [Binding("ProvenanceEntityRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RoleElement + public Code? RoleElement { get { return _RoleElement; } set { _RoleElement = value; OnPropertyChanged("RoleElement"); } } - private Code _RoleElement; + private Code? _RoleElement; /// /// revision | quotation | source | instantiates | removal @@ -305,13 +304,10 @@ public Code RoleElement [IgnoreDataMember] public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role { - get { return RoleElement != null ? RoleElement.Value : null; } + get => _RoleElement?.Value; set { - if (value == null) - RoleElement = null; - else - RoleElement = new Code(value); + RoleElement = value is null ? null : new Code(value); OnPropertyChanged("Role"); } } @@ -324,13 +320,13 @@ public Hl7.Fhir.Model.Provenance.ProvenanceEntityRole? Role [References("Resource")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference What + public Hl7.Fhir.Model.ResourceReference? What { get { return _What; } set { _What = value; OnPropertyChanged("What"); } } - private Hl7.Fhir.Model.ResourceReference _What; + private Hl7.Fhir.Model.ResourceReference? _What; /// /// Entity is attributed to this agent. @@ -340,25 +336,21 @@ public Hl7.Fhir.Model.ResourceReference What [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; protected internal override void CopyToInternal(Base other) { - var dest = other as EntityComponent; - - if (dest == null) - { + if(other is not EntityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RoleElement != null) dest.RoleElement = (Code)RoleElement.DeepCopyInternal(); - if(What != null) dest.What = (Hl7.Fhir.Model.ResourceReference)What.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); + if(_RoleElement is not null) dest.RoleElement = (Code)_RoleElement.DeepCopyInternal(); + if(_What is not null) dest.What = (Hl7.Fhir.Model.ResourceReference)_What.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -370,48 +362,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EntityComponent; - if(otherT == null) return false; + if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RoleElement, otherT.RoleElement)) return false; - if(!comparer.Equals(What, otherT.What)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + if(!comparer.Equals(_What, otherT._What)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = RoleElement; - return RoleElement is not null; + value = _RoleElement; + return _RoleElement is not null; case "what": - value = What; - return What is not null; + value = _What; + return _What is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - RoleElement = (Code)value; + RoleElement = (Code?)value; return this; case "what": - What = (Hl7.Fhir.Model.ResourceReference)value; + What = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -422,9 +414,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RoleElement is not null) yield return new KeyValuePair("role",RoleElement); - if (What is not null) yield return new KeyValuePair("what",What); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); + if (_RoleElement is not null) yield return new KeyValuePair("role",_RoleElement); + if (_What is not null) yield return new KeyValuePair("what",_What); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); } } @@ -439,11 +431,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// When the activity occurred. @@ -452,26 +444,26 @@ public List Target [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Occurred + public Hl7.Fhir.Model.DataType? Occurred { get { return _Occurred; } set { _Occurred = value; OnPropertyChanged("Occurred"); } } - private Hl7.Fhir.Model.DataType _Occurred; + private Hl7.Fhir.Model.DataType? _Occurred; /// /// When the activity was recorded / updated. /// [FhirElement("recorded", InSummary=true, Order=110, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.Instant RecordedElement + public Hl7.Fhir.Model.Instant? RecordedElement { get { return _RecordedElement; } set { _RecordedElement = value; OnPropertyChanged("RecordedElement"); } } - private Hl7.Fhir.Model.Instant _RecordedElement; + private Hl7.Fhir.Model.Instant? _RecordedElement; /// /// When the activity was recorded / updated @@ -480,13 +472,10 @@ public Hl7.Fhir.Model.Instant RecordedElement [IgnoreDataMember] public DateTimeOffset? Recorded { - get { return RecordedElement != null ? RecordedElement.Value : null; } + get => _RecordedElement?.Value; set { - if (value == null) - RecordedElement = null; - else - RecordedElement = new Hl7.Fhir.Model.Instant(value); + RecordedElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Recorded"); } } @@ -499,24 +488,24 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get { if(_PolicyElement==null) _PolicyElement = new List(); return _PolicyElement; } + get => _PolicyElement ?? new List(); set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } - private List _PolicyElement; + private List? _PolicyElement; /// /// Policy or plan the activity was defined by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Policy + public IEnumerable? Policy { - get { return PolicyElement != null ? PolicyElement.Select(elem => elem.Value) : null; } + get => _PolicyElement?.Select(elem => elem.Value); set { if (value == null) - PolicyElement = null; + PolicyElement = null!; else PolicyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Policy"); @@ -530,13 +519,13 @@ public IEnumerable Policy [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Authorization (purposeOfUse) related to the event. @@ -547,11 +536,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Authorization { - get { if(_Authorization==null) _Authorization = new List(); return _Authorization; } + get => _Authorization ?? new List(); set { _Authorization = value; OnPropertyChanged("Authorization"); } } - private List _Authorization; + private List? _Authorization; /// /// Activity that occurred. @@ -559,13 +548,13 @@ public List Authorization [FhirElement("activity", Order=150, FiveWs="FiveWs.why[x]")] [Binding("ProvenanceActivity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Activity + public Hl7.Fhir.Model.CodeableConcept? Activity { get { return _Activity; } set { _Activity = value; OnPropertyChanged("Activity"); } } - private Hl7.Fhir.Model.CodeableConcept _Activity; + private Hl7.Fhir.Model.CodeableConcept? _Activity; /// /// Workflow authorization within which this event occurred. @@ -577,11 +566,11 @@ public Hl7.Fhir.Model.CodeableConcept Activity [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// The patient is the subject of the data created/updated (.target) by the activity. @@ -590,13 +579,13 @@ public List BasedOn [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Encounter within which this event occurred or which the event is tightly associated. @@ -605,13 +594,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Actor involved. @@ -621,11 +610,11 @@ public Hl7.Fhir.Model.ResourceReference Encounter [DataMember] public List Agent { - get { if(_Agent==null) _Agent = new List(); return _Agent; } + get => _Agent ?? new List(); set { _Agent = value; OnPropertyChanged("Agent"); } } - private List _Agent; + private List? _Agent; /// /// An entity used in this activity. @@ -635,11 +624,11 @@ public List Agent [DataMember] public List Entity { - get { if(_Entity==null) _Entity = new List(); return _Entity; } + get => _Entity ?? new List(); set { _Entity = value; OnPropertyChanged("Entity"); } } - private List _Entity; + private List? _Entity; /// /// Signature on target. @@ -649,35 +638,31 @@ public List Entity [DataMember] public List Signature { - get { if(_Signature==null) _Signature = new List(); return _Signature; } + get => _Signature ?? new List(); set { _Signature = value; OnPropertyChanged("Signature"); } } - private List _Signature; + private List? _Signature; protected internal override void CopyToInternal(Base other) { - var dest = other as Provenance; - - if (dest == null) - { + if(other is not Provenance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Occurred != null) dest.Occurred = (Hl7.Fhir.Model.DataType)Occurred.DeepCopyInternal(); - if(RecordedElement != null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)RecordedElement.DeepCopyInternal(); - if(PolicyElement.Any()) dest.PolicyElement = new List(PolicyElement.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Authorization.Any()) dest.Authorization = new List(Authorization.DeepCopyInternal()); - if(Activity != null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)Activity.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Agent.Any()) dest.Agent = new List(Agent.DeepCopyInternal()); - if(Entity.Any()) dest.Entity = new List(Entity.DeepCopyInternal()); - if(Signature.Any()) dest.Signature = new List(Signature.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Occurred is not null) dest.Occurred = (Hl7.Fhir.Model.DataType)_Occurred.DeepCopyInternal(); + if(_RecordedElement is not null) dest.RecordedElement = (Hl7.Fhir.Model.Instant)_RecordedElement.DeepCopyInternal(); + if(_PolicyElement is not null) dest.PolicyElement = new List(_PolicyElement.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Authorization is not null) dest.Authorization = new List(_Authorization.DeepCopyInternal()); + if(_Activity is not null) dest.Activity = (Hl7.Fhir.Model.CodeableConcept)_Activity.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Agent is not null) dest.Agent = new List(_Agent.DeepCopyInternal()); + if(_Entity is not null) dest.Entity = new List(_Entity.DeepCopyInternal()); + if(_Signature is not null) dest.Signature = new List(_Signature.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -689,118 +674,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Provenance; - if(otherT == null) return false; + if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.Equals(Occurred, otherT.Occurred)) return false; - if(!comparer.Equals(RecordedElement, otherT.RecordedElement)) return false; - if(!comparer.ListEquals(PolicyElement, otherT.PolicyElement)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Authorization, otherT.Authorization)) return false; - if(!comparer.Equals(Activity, otherT.Activity)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.ListEquals(Agent, otherT.Agent)) return false; - if(!comparer.ListEquals(Entity, otherT.Entity)) return false; - if(!comparer.ListEquals(Signature, otherT.Signature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Occurred, otherT._Occurred)) return false; + if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; + if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Authorization, otherT._Authorization)) return false; + if(!comparer.Equals(_Activity, otherT._Activity)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; + if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; + if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "occurred": - value = Occurred; - return Occurred is not null; + value = _Occurred; + return _Occurred is not null; case "recorded": - value = RecordedElement; - return RecordedElement is not null; + value = _RecordedElement; + return _RecordedElement is not null; case "policy": - value = PolicyElement; - return PolicyElement?.Any() == true; + value = _PolicyElement; + return _PolicyElement?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "authorization": - value = Authorization; - return Authorization?.Any() == true; + value = _Authorization; + return _Authorization?.Any() == true; case "activity": - value = Activity; - return Activity is not null; + value = _Activity; + return _Activity is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "agent": - value = Agent; - return Agent?.Any() == true; + value = _Agent; + return _Agent?.Any() == true; case "entity": - value = Entity; - return Entity?.Any() == true; + value = _Entity; + return _Entity?.Any() == true; case "signature": - value = Signature; - return Signature?.Any() == true; + value = _Signature; + return _Signature?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (List)value; + Target = (List?)value!; return this; case "occurred": - Occurred = (Hl7.Fhir.Model.DataType)value; + Occurred = (Hl7.Fhir.Model.DataType?)value; return this; case "recorded": - RecordedElement = (Hl7.Fhir.Model.Instant)value; + RecordedElement = (Hl7.Fhir.Model.Instant?)value; return this; case "policy": - PolicyElement = (List)value; + PolicyElement = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authorization": - Authorization = (List)value; + Authorization = (List?)value!; return this; case "activity": - Activity = (Hl7.Fhir.Model.CodeableConcept)value; + Activity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "agent": - Agent = (List)value; + Agent = (List?)value!; return this; case "entity": - Entity = (List)value; + Entity = (List?)value!; return this; case "signature": - Signature = (List)value; + Signature = (List?)value!; return this; default: return base.SetValue(key, value); @@ -811,19 +796,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Occurred is not null) yield return new KeyValuePair("occurred",Occurred); - if (RecordedElement is not null) yield return new KeyValuePair("recorded",RecordedElement); - if (PolicyElement?.Any() == true) yield return new KeyValuePair("policy",PolicyElement); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Authorization?.Any() == true) yield return new KeyValuePair("authorization",Authorization); - if (Activity is not null) yield return new KeyValuePair("activity",Activity); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Agent?.Any() == true) yield return new KeyValuePair("agent",Agent); - if (Entity?.Any() == true) yield return new KeyValuePair("entity",Entity); - if (Signature?.Any() == true) yield return new KeyValuePair("signature",Signature); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Occurred is not null) yield return new KeyValuePair("occurred",_Occurred); + if (_RecordedElement is not null) yield return new KeyValuePair("recorded",_RecordedElement); + if (_PolicyElement?.Any() == true) yield return new KeyValuePair("policy",_PolicyElement); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Authorization?.Any() == true) yield return new KeyValuePair("authorization",_Authorization); + if (_Activity is not null) yield return new KeyValuePair("activity",_Activity); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Agent?.Any() == true) yield return new KeyValuePair("agent",_Agent); + if (_Entity?.Any() == true) yield return new KeyValuePair("entity",_Entity); + if (_Signature?.Any() == true) yield return new KeyValuePair("signature",_Signature); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs index 219d5153c..353eb9e27 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -312,28 +315,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Unique id for item in questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -343,28 +343,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -378,39 +375,36 @@ public string Definition [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// E.g. "1(a)", "2.5.3". /// [FhirElement("prefix", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// E.g. "1(a)", "2.5.3" /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -420,28 +414,25 @@ public string Prefix /// [FhirElement("text", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Primary text for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -454,13 +445,13 @@ public string Text [Binding("QuestionnaireItemType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// group | display | boolean | decimal | integer | date | dateTime + @@ -469,13 +460,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -488,11 +476,11 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get { if(_EnableWhen==null) _EnableWhen = new List(); return _EnableWhen; } + get => _EnableWhen ?? new List(); set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } - private List _EnableWhen; + private List? _EnableWhen; /// /// all | any. @@ -501,13 +489,13 @@ public List EnableWhen [DeclaredType(Type = typeof(Code))] [Binding("EnableWhenBehavior")] [DataMember] - public Code EnableBehaviorElement + public Code? EnableBehaviorElement { get { return _EnableBehaviorElement; } set { _EnableBehaviorElement = value; OnPropertyChanged("EnableBehaviorElement"); } } - private Code _EnableBehaviorElement; + private Code? _EnableBehaviorElement; /// /// all | any @@ -516,13 +504,10 @@ public Code EnableBehaviorEleme [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.EnableWhenBehavior? EnableBehavior { - get { return EnableBehaviorElement != null ? EnableBehaviorElement.Value : null; } + get => _EnableBehaviorElement?.Value; set { - if (value == null) - EnableBehaviorElement = null; - else - EnableBehaviorElement = new Code(value); + EnableBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("EnableBehavior"); } } @@ -534,13 +519,13 @@ public Hl7.Fhir.Model.Questionnaire.EnableWhenBehavior? EnableBehavior [DeclaredType(Type = typeof(Code))] [Binding("DisabledDisplay")] [DataMember] - public Code DisabledDisplayElement + public Code? DisabledDisplayElement { get { return _DisabledDisplayElement; } set { _DisabledDisplayElement = value; OnPropertyChanged("DisabledDisplayElement"); } } - private Code _DisabledDisplayElement; + private Code? _DisabledDisplayElement; /// /// hidden | protected @@ -549,13 +534,10 @@ public Code Disab [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemDisabledDisplay? DisabledDisplay { - get { return DisabledDisplayElement != null ? DisabledDisplayElement.Value : null; } + get => _DisabledDisplayElement?.Value; set { - if (value == null) - DisabledDisplayElement = null; - else - DisabledDisplayElement = new Code(value); + DisabledDisplayElement = value is null ? null : new Code(value); OnPropertyChanged("DisabledDisplay"); } } @@ -565,13 +547,13 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemDisabledDisplay? DisabledDi /// [FhirElement("required", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Whether the item must be included in data results @@ -580,13 +562,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -596,13 +575,13 @@ public bool? Required /// [FhirElement("repeats", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RepeatsElement + public Hl7.Fhir.Model.FhirBoolean? RepeatsElement { get { return _RepeatsElement; } set { _RepeatsElement = value; OnPropertyChanged("RepeatsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RepeatsElement; + private Hl7.Fhir.Model.FhirBoolean? _RepeatsElement; /// /// Whether the item may repeat @@ -611,13 +590,10 @@ public Hl7.Fhir.Model.FhirBoolean RepeatsElement [IgnoreDataMember] public bool? Repeats { - get { return RepeatsElement != null ? RepeatsElement.Value : null; } + get => _RepeatsElement?.Value; set { - if (value == null) - RepeatsElement = null; - else - RepeatsElement = new Hl7.Fhir.Model.FhirBoolean(value); + RepeatsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Repeats"); } } @@ -627,13 +603,13 @@ public bool? Repeats /// [FhirElement("readOnly", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement + public Hl7.Fhir.Model.FhirBoolean? ReadOnlyElement { get { return _ReadOnlyElement; } set { _ReadOnlyElement = value; OnPropertyChanged("ReadOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ReadOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _ReadOnlyElement; /// /// Don't allow human editing @@ -642,13 +618,10 @@ public Hl7.Fhir.Model.FhirBoolean ReadOnlyElement [IgnoreDataMember] public bool? ReadOnly { - get { return ReadOnlyElement != null ? ReadOnlyElement.Value : null; } + get => _ReadOnlyElement?.Value; set { - if (value == null) - ReadOnlyElement = null; - else - ReadOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + ReadOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("ReadOnly"); } } @@ -658,13 +631,13 @@ public bool? ReadOnly /// [FhirElement("maxLength", Order=160)] [DataMember] - public Hl7.Fhir.Model.Integer MaxLengthElement + public Hl7.Fhir.Model.Integer? MaxLengthElement { get { return _MaxLengthElement; } set { _MaxLengthElement = value; OnPropertyChanged("MaxLengthElement"); } } - private Hl7.Fhir.Model.Integer _MaxLengthElement; + private Hl7.Fhir.Model.Integer? _MaxLengthElement; /// /// No more than these many characters @@ -673,13 +646,10 @@ public Hl7.Fhir.Model.Integer MaxLengthElement [IgnoreDataMember] public int? MaxLength { - get { return MaxLengthElement != null ? MaxLengthElement.Value : null; } + get => _MaxLengthElement?.Value; set { - if (value == null) - MaxLengthElement = null; - else - MaxLengthElement = new Hl7.Fhir.Model.Integer(value); + MaxLengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("MaxLength"); } } @@ -691,13 +661,13 @@ public int? MaxLength [DeclaredType(Type = typeof(Code))] [Binding("QuestionnaireAnswerConstraint")] [DataMember] - public Code AnswerConstraintElement + public Code? AnswerConstraintElement { get { return _AnswerConstraintElement; } set { _AnswerConstraintElement = value; OnPropertyChanged("AnswerConstraintElement"); } } - private Code _AnswerConstraintElement; + private Code? _AnswerConstraintElement; /// /// optionsOnly | optionsOrType | optionsOrString @@ -706,13 +676,10 @@ public Code AnswerCo [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireAnswerConstraint? AnswerConstraint { - get { return AnswerConstraintElement != null ? AnswerConstraintElement.Value : null; } + get => _AnswerConstraintElement?.Value; set { - if (value == null) - AnswerConstraintElement = null; - else - AnswerConstraintElement = new Code(value); + AnswerConstraintElement = value is null ? null : new Code(value); OnPropertyChanged("AnswerConstraint"); } } @@ -722,28 +689,25 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireAnswerConstraint? AnswerConstra /// [FhirElement("answerValueSet", Order=180)] [DataMember] - public Hl7.Fhir.Model.Canonical AnswerValueSetElement + public Hl7.Fhir.Model.Canonical? AnswerValueSetElement { get { return _AnswerValueSetElement; } set { _AnswerValueSetElement = value; OnPropertyChanged("AnswerValueSetElement"); } } - private Hl7.Fhir.Model.Canonical _AnswerValueSetElement; + private Hl7.Fhir.Model.Canonical? _AnswerValueSetElement; /// /// ValueSet containing permitted answers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AnswerValueSet + public string? AnswerValueSet { - get { return AnswerValueSetElement != null ? AnswerValueSetElement.Value : null; } + get => _AnswerValueSetElement?.Value; set { - if (value == null) - AnswerValueSetElement = null; - else - AnswerValueSetElement = new Hl7.Fhir.Model.Canonical(value); + AnswerValueSetElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("AnswerValueSet"); } } @@ -756,11 +720,11 @@ public string AnswerValueSet [DataMember] public List AnswerOption { - get { if(_AnswerOption==null) _AnswerOption = new List(); return _AnswerOption; } + get => _AnswerOption ?? new List(); set { _AnswerOption = value; OnPropertyChanged("AnswerOption"); } } - private List _AnswerOption; + private List? _AnswerOption; /// /// Initial value(s) when item is first rendered. @@ -770,11 +734,11 @@ public List AnswerOption [DataMember] public List Initial { - get { if(_Initial==null) _Initial = new List(); return _Initial; } + get => _Initial ?? new List(); set { _Initial = value; OnPropertyChanged("Initial"); } } - private List _Initial; + private List? _Initial; /// /// Nested questionnaire items. @@ -784,40 +748,36 @@ public List Initial [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EnableWhen.Any()) dest.EnableWhen = new List(EnableWhen.DeepCopyInternal()); - if(EnableBehaviorElement != null) dest.EnableBehaviorElement = (Code)EnableBehaviorElement.DeepCopyInternal(); - if(DisabledDisplayElement != null) dest.DisabledDisplayElement = (Code)DisabledDisplayElement.DeepCopyInternal(); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(RepeatsElement != null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)RepeatsElement.DeepCopyInternal(); - if(ReadOnlyElement != null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)ReadOnlyElement.DeepCopyInternal(); - if(MaxLengthElement != null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)MaxLengthElement.DeepCopyInternal(); - if(AnswerConstraintElement != null) dest.AnswerConstraintElement = (Code)AnswerConstraintElement.DeepCopyInternal(); - if(AnswerValueSetElement != null) dest.AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)AnswerValueSetElement.DeepCopyInternal(); - if(AnswerOption.Any()) dest.AnswerOption = new List(AnswerOption.DeepCopyInternal()); - if(Initial.Any()) dest.Initial = new List(Initial.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EnableWhen is not null) dest.EnableWhen = new List(_EnableWhen.DeepCopyInternal()); + if(_EnableBehaviorElement is not null) dest.EnableBehaviorElement = (Code)_EnableBehaviorElement.DeepCopyInternal(); + if(_DisabledDisplayElement is not null) dest.DisabledDisplayElement = (Code)_DisabledDisplayElement.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_RepeatsElement is not null) dest.RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)_RepeatsElement.DeepCopyInternal(); + if(_ReadOnlyElement is not null) dest.ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_ReadOnlyElement.DeepCopyInternal(); + if(_MaxLengthElement is not null) dest.MaxLengthElement = (Hl7.Fhir.Model.Integer)_MaxLengthElement.DeepCopyInternal(); + if(_AnswerConstraintElement is not null) dest.AnswerConstraintElement = (Code)_AnswerConstraintElement.DeepCopyInternal(); + if(_AnswerValueSetElement is not null) dest.AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)_AnswerValueSetElement.DeepCopyInternal(); + if(_AnswerOption is not null) dest.AnswerOption = new List(_AnswerOption.DeepCopyInternal()); + if(_Initial is not null) dest.Initial = new List(_Initial.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -829,153 +789,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.ListEquals(EnableWhen, otherT.EnableWhen)) return false; - if(!comparer.Equals(EnableBehaviorElement, otherT.EnableBehaviorElement)) return false; - if(!comparer.Equals(DisabledDisplayElement, otherT.DisabledDisplayElement)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(RepeatsElement, otherT.RepeatsElement)) return false; - if(!comparer.Equals(ReadOnlyElement, otherT.ReadOnlyElement)) return false; - if(!comparer.Equals(MaxLengthElement, otherT.MaxLengthElement)) return false; - if(!comparer.Equals(AnswerConstraintElement, otherT.AnswerConstraintElement)) return false; - if(!comparer.Equals(AnswerValueSetElement, otherT.AnswerValueSetElement)) return false; - if(!comparer.ListEquals(AnswerOption, otherT.AnswerOption)) return false; - if(!comparer.ListEquals(Initial, otherT.Initial)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.ListEquals(_EnableWhen, otherT._EnableWhen)) return false; + if(!comparer.Equals(_EnableBehaviorElement, otherT._EnableBehaviorElement)) return false; + if(!comparer.Equals(_DisabledDisplayElement, otherT._DisabledDisplayElement)) return false; + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_RepeatsElement, otherT._RepeatsElement)) return false; + if(!comparer.Equals(_ReadOnlyElement, otherT._ReadOnlyElement)) return false; + if(!comparer.Equals(_MaxLengthElement, otherT._MaxLengthElement)) return false; + if(!comparer.Equals(_AnswerConstraintElement, otherT._AnswerConstraintElement)) return false; + if(!comparer.Equals(_AnswerValueSetElement, otherT._AnswerValueSetElement)) return false; + if(!comparer.ListEquals(_AnswerOption, otherT._AnswerOption)) return false; + if(!comparer.ListEquals(_Initial, otherT._Initial)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "enableWhen": - value = EnableWhen; - return EnableWhen?.Any() == true; + value = _EnableWhen; + return _EnableWhen?.Any() == true; case "enableBehavior": - value = EnableBehaviorElement; - return EnableBehaviorElement is not null; + value = _EnableBehaviorElement; + return _EnableBehaviorElement is not null; case "disabledDisplay": - value = DisabledDisplayElement; - return DisabledDisplayElement is not null; + value = _DisabledDisplayElement; + return _DisabledDisplayElement is not null; case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "repeats": - value = RepeatsElement; - return RepeatsElement is not null; + value = _RepeatsElement; + return _RepeatsElement is not null; case "readOnly": - value = ReadOnlyElement; - return ReadOnlyElement is not null; + value = _ReadOnlyElement; + return _ReadOnlyElement is not null; case "maxLength": - value = MaxLengthElement; - return MaxLengthElement is not null; + value = _MaxLengthElement; + return _MaxLengthElement is not null; case "answerConstraint": - value = AnswerConstraintElement; - return AnswerConstraintElement is not null; + value = _AnswerConstraintElement; + return _AnswerConstraintElement is not null; case "answerValueSet": - value = AnswerValueSetElement; - return AnswerValueSetElement is not null; + value = _AnswerValueSetElement; + return _AnswerValueSetElement is not null; case "answerOption": - value = AnswerOption; - return AnswerOption?.Any() == true; + value = _AnswerOption; + return _AnswerOption?.Any() == true; case "initial": - value = Initial; - return Initial?.Any() == true; + value = _Initial; + return _Initial?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "enableWhen": - EnableWhen = (List)value; + EnableWhen = (List?)value!; return this; case "enableBehavior": - EnableBehaviorElement = (Code)value; + EnableBehaviorElement = (Code?)value; return this; case "disabledDisplay": - DisabledDisplayElement = (Code)value; + DisabledDisplayElement = (Code?)value; return this; case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "repeats": - RepeatsElement = (Hl7.Fhir.Model.FhirBoolean)value; + RepeatsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "readOnly": - ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + ReadOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "maxLength": - MaxLengthElement = (Hl7.Fhir.Model.Integer)value; + MaxLengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "answerConstraint": - AnswerConstraintElement = (Code)value; + AnswerConstraintElement = (Code?)value; return this; case "answerValueSet": - AnswerValueSetElement = (Hl7.Fhir.Model.Canonical)value; + AnswerValueSetElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "answerOption": - AnswerOption = (List)value; + AnswerOption = (List?)value!; return this; case "initial": - Initial = (List)value; + Initial = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -986,24 +946,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",EnableWhen); - if (EnableBehaviorElement is not null) yield return new KeyValuePair("enableBehavior",EnableBehaviorElement); - if (DisabledDisplayElement is not null) yield return new KeyValuePair("disabledDisplay",DisabledDisplayElement); - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (RepeatsElement is not null) yield return new KeyValuePair("repeats",RepeatsElement); - if (ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",ReadOnlyElement); - if (MaxLengthElement is not null) yield return new KeyValuePair("maxLength",MaxLengthElement); - if (AnswerConstraintElement is not null) yield return new KeyValuePair("answerConstraint",AnswerConstraintElement); - if (AnswerValueSetElement is not null) yield return new KeyValuePair("answerValueSet",AnswerValueSetElement); - if (AnswerOption?.Any() == true) yield return new KeyValuePair("answerOption",AnswerOption); - if (Initial?.Any() == true) yield return new KeyValuePair("initial",Initial); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EnableWhen?.Any() == true) yield return new KeyValuePair("enableWhen",_EnableWhen); + if (_EnableBehaviorElement is not null) yield return new KeyValuePair("enableBehavior",_EnableBehaviorElement); + if (_DisabledDisplayElement is not null) yield return new KeyValuePair("disabledDisplay",_DisabledDisplayElement); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_RepeatsElement is not null) yield return new KeyValuePair("repeats",_RepeatsElement); + if (_ReadOnlyElement is not null) yield return new KeyValuePair("readOnly",_ReadOnlyElement); + if (_MaxLengthElement is not null) yield return new KeyValuePair("maxLength",_MaxLengthElement); + if (_AnswerConstraintElement is not null) yield return new KeyValuePair("answerConstraint",_AnswerConstraintElement); + if (_AnswerValueSetElement is not null) yield return new KeyValuePair("answerValueSet",_AnswerValueSetElement); + if (_AnswerOption?.Any() == true) yield return new KeyValuePair("answerOption",_AnswerOption); + if (_Initial?.Any() == true) yield return new KeyValuePair("initial",_Initial); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -1031,28 +991,25 @@ public partial class EnableWhenComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("question", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString QuestionElement + public Hl7.Fhir.Model.FhirString? QuestionElement { get { return _QuestionElement; } set { _QuestionElement = value; OnPropertyChanged("QuestionElement"); } } - private Hl7.Fhir.Model.FhirString _QuestionElement; + private Hl7.Fhir.Model.FhirString? _QuestionElement; /// /// The linkId of question that determines whether item is enabled/disabled /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Question + public string? Question { - get { return QuestionElement != null ? QuestionElement.Value : null; } + get => _QuestionElement?.Value; set { - if (value == null) - QuestionElement = null; - else - QuestionElement = new Hl7.Fhir.Model.FhirString(value); + QuestionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Question"); } } @@ -1065,13 +1022,13 @@ public string Question [Binding("QuestionnaireItemOperator")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code OperatorElement + public Code? OperatorElement { get { return _OperatorElement; } set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private Code _OperatorElement; + private Code? _OperatorElement; /// /// exists | = | != | > | < | >= | <= @@ -1080,13 +1037,10 @@ public Code OperatorElem [IgnoreDataMember] public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemOperator? Operator { - get { return OperatorElement != null ? OperatorElement.Value : null; } + get => _OperatorElement?.Value; set { - if (value == null) - OperatorElement = null; - else - OperatorElement = new Code(value); + OperatorElement = value is null ? null : new Code(value); OnPropertyChanged("Operator"); } } @@ -1101,27 +1055,23 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemOperator? Operator [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Answer + public Hl7.Fhir.Model.DataType? Answer { get { return _Answer; } set { _Answer = value; OnPropertyChanged("Answer"); } } - private Hl7.Fhir.Model.DataType _Answer; + private Hl7.Fhir.Model.DataType? _Answer; protected internal override void CopyToInternal(Base other) { - var dest = other as EnableWhenComponent; - - if (dest == null) - { + if(other is not EnableWhenComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(QuestionElement != null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)QuestionElement.DeepCopyInternal(); - if(OperatorElement != null) dest.OperatorElement = (Code)OperatorElement.DeepCopyInternal(); - if(Answer != null) dest.Answer = (Hl7.Fhir.Model.DataType)Answer.DeepCopyInternal(); + if(_QuestionElement is not null) dest.QuestionElement = (Hl7.Fhir.Model.FhirString)_QuestionElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = (Code)_OperatorElement.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = (Hl7.Fhir.Model.DataType)_Answer.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1133,48 +1083,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EnableWhenComponent; - if(otherT == null) return false; + if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(QuestionElement, otherT.QuestionElement)) return false; - if(!comparer.Equals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(Answer, otherT.Answer)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_Answer, otherT._Answer)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "question": - value = QuestionElement; - return QuestionElement is not null; + value = _QuestionElement; + return _QuestionElement is not null; case "operator": - value = OperatorElement; - return OperatorElement is not null; + value = _OperatorElement; + return _OperatorElement is not null; case "answer": - value = Answer; - return Answer is not null; + value = _Answer; + return _Answer is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "question": - QuestionElement = (Hl7.Fhir.Model.FhirString)value; + QuestionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "operator": - OperatorElement = (Code)value; + OperatorElement = (Code?)value; return this; case "answer": - Answer = (Hl7.Fhir.Model.DataType)value; + Answer = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1185,9 +1135,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (QuestionElement is not null) yield return new KeyValuePair("question",QuestionElement); - if (OperatorElement is not null) yield return new KeyValuePair("operator",OperatorElement); - if (Answer is not null) yield return new KeyValuePair("answer",Answer); + if (_QuestionElement is not null) yield return new KeyValuePair("question",_QuestionElement); + if (_OperatorElement is not null) yield return new KeyValuePair("operator",_OperatorElement); + if (_Answer is not null) yield return new KeyValuePair("answer",_Answer); } } @@ -1219,26 +1169,26 @@ public partial class AnswerOptionComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Whether option is selected by default. /// [FhirElement("initialSelected", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InitialSelectedElement + public Hl7.Fhir.Model.FhirBoolean? InitialSelectedElement { get { return _InitialSelectedElement; } set { _InitialSelectedElement = value; OnPropertyChanged("InitialSelectedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InitialSelectedElement; + private Hl7.Fhir.Model.FhirBoolean? _InitialSelectedElement; /// /// Whether option is selected by default @@ -1247,29 +1197,22 @@ public Hl7.Fhir.Model.FhirBoolean InitialSelectedElement [IgnoreDataMember] public bool? InitialSelected { - get { return InitialSelectedElement != null ? InitialSelectedElement.Value : null; } + get => _InitialSelectedElement?.Value; set { - if (value == null) - InitialSelectedElement = null; - else - InitialSelectedElement = new Hl7.Fhir.Model.FhirBoolean(value); + InitialSelectedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("InitialSelected"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerOptionComponent; - - if (dest == null) - { + if(other is not AnswerOptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(InitialSelectedElement != null) dest.InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)InitialSelectedElement.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_InitialSelectedElement is not null) dest.InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)_InitialSelectedElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1281,41 +1224,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerOptionComponent; - if(otherT == null) return false; + if(other is not AnswerOptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.Equals(InitialSelectedElement, otherT.InitialSelectedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.Equals(_InitialSelectedElement, otherT._InitialSelectedElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "initialSelected": - value = InitialSelectedElement; - return InitialSelectedElement is not null; + value = _InitialSelectedElement; + return _InitialSelectedElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "initialSelected": - InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean)value; + InitialSelectedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1326,8 +1269,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (InitialSelectedElement is not null) yield return new KeyValuePair("initialSelected",InitialSelectedElement); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_InitialSelectedElement is not null) yield return new KeyValuePair("initialSelected",_InitialSelectedElement); } } @@ -1359,25 +1302,21 @@ public partial class InitialComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as InitialComponent; - - if (dest == null) - { + if(other is not InitialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1389,34 +1328,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InitialComponent; - if(otherT == null) return false; + if(other is not InitialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1427,7 +1366,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -1437,28 +1376,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this questionnaire, represented as an absolute URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1471,39 +1407,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the questionnaire. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1515,41 +1448,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this questionnaire (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this questionnaire (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1559,28 +1489,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this questionnaire (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1593,24 +1520,24 @@ public string Title [DataMember] public List DerivedFromElement { - get { if(_DerivedFromElement==null) _DerivedFromElement = new List(); return _DerivedFromElement; } + get => _DerivedFromElement ?? new List(); set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private List _DerivedFromElement; + private List? _DerivedFromElement; /// /// Based on Questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFrom + public IEnumerable? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Select(elem => elem.Value) : null; } + get => _DerivedFromElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromElement = null; + DerivedFromElement = null!; else DerivedFromElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFrom"); @@ -1625,13 +1552,13 @@ public IEnumerable DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1640,13 +1567,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1656,13 +1580,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1671,13 +1595,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1692,24 +1613,24 @@ public bool? Experimental [DataMember] public List> SubjectTypeElement { - get { if(_SubjectTypeElement==null) _SubjectTypeElement = new List>(); return _SubjectTypeElement; } + get => _SubjectTypeElement ?? new List>(); set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } - private List> _SubjectTypeElement; + private List>? _SubjectTypeElement; /// /// Resource that can be subject of QuestionnaireResponse /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SubjectType + public IEnumerable? SubjectType { - get { return SubjectTypeElement != null ? SubjectTypeElement.Select(elem => elem.Value) : null; } + get => _SubjectTypeElement?.Select(elem => elem.Value); set { if (value == null) - SubjectTypeElement = null; + SubjectTypeElement = null!; else SubjectTypeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("SubjectType"); @@ -1721,28 +1642,25 @@ public IEnumerable SubjectType /// [FhirElement("date", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1752,28 +1670,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=200, FiveWs="FiveWs.author")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1786,39 +1701,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the questionnaire. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1831,11 +1743,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for questionnaire (if applicable). @@ -1846,39 +1758,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this questionnaire is defined. /// [FhirElement("purpose", Order=250, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this questionnaire is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1888,28 +1797,25 @@ public string Purpose /// [FhirElement("copyright", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1919,28 +1825,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=270)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1950,28 +1853,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When the questionnaire was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1981,28 +1881,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// When the questionnaire was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -2012,13 +1909,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=300)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Concept that represents the overall questionnaire. @@ -2029,11 +1926,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Questions and sections within the Questionnaire. @@ -2043,48 +1940,44 @@ public List Code [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Questionnaire; - - if (dest == null) - { + if(other is not Questionnaire dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromElement.Any()) dest.DerivedFromElement = new List(DerivedFromElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(SubjectTypeElement.Any()) dest.SubjectTypeElement = new List>(SubjectTypeElement.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = new List(_DerivedFromElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_SubjectTypeElement is not null) dest.SubjectTypeElement = new List>(_SubjectTypeElement.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2096,195 +1989,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Questionnaire; - if(otherT == null) return false; + if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.ListEquals(SubjectTypeElement, otherT.SubjectTypeElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.ListEquals(_SubjectTypeElement, otherT._SubjectTypeElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement?.Any() == true; + value = _DerivedFromElement; + return _DerivedFromElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subjectType": - value = SubjectTypeElement; - return SubjectTypeElement?.Any() == true; + value = _SubjectTypeElement; + return _SubjectTypeElement?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (List)value; + DerivedFromElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subjectType": - SubjectTypeElement = (List>)value; + SubjectTypeElement = (List>?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2295,30 +2188,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",SubjectTypeElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_SubjectTypeElement?.Any() == true) yield return new KeyValuePair("subjectType",_SubjectTypeElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs index fa2af5a19..6e9cb8d2b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -123,28 +126,25 @@ public partial class ItemComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("linkId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific item from Questionnaire /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -154,28 +154,25 @@ public string LinkId /// [FhirElement("definition", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUri DefinitionElement + public Hl7.Fhir.Model.FhirUri? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _DefinitionElement; + private Hl7.Fhir.Model.FhirUri? _DefinitionElement; /// /// ElementDefinition - details for the item /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Definition"); } } @@ -185,28 +182,25 @@ public string Definition /// [FhirElement("text", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TextElement + public Hl7.Fhir.Model.FhirString? TextElement { get { return _TextElement; } set { _TextElement = value; OnPropertyChanged("TextElement"); } } - private Hl7.Fhir.Model.FhirString _TextElement; + private Hl7.Fhir.Model.FhirString? _TextElement; /// /// Name for group or question text /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Text + public string? Text { - get { return TextElement != null ? TextElement.Value : null; } + get => _TextElement?.Value; set { - if (value == null) - TextElement = null; - else - TextElement = new Hl7.Fhir.Model.FhirString(value); + TextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Text"); } } @@ -219,11 +213,11 @@ public string Text [DataMember] public List Answer { - get { if(_Answer==null) _Answer = new List(); return _Answer; } + get => _Answer ?? new List(); set { _Answer = value; OnPropertyChanged("Answer"); } } - private List _Answer; + private List? _Answer; /// /// Child items of group item. @@ -233,27 +227,23 @@ public List Answer [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as ItemComponent; - - if (dest == null) - { + if(other is not ItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)DefinitionElement.DeepCopyInternal(); - if(TextElement != null) dest.TextElement = (Hl7.Fhir.Model.FhirString)TextElement.DeepCopyInternal(); - if(Answer.Any()) dest.Answer = new List(Answer.DeepCopyInternal()); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.FhirUri)_DefinitionElement.DeepCopyInternal(); + if(_TextElement is not null) dest.TextElement = (Hl7.Fhir.Model.FhirString)_TextElement.DeepCopyInternal(); + if(_Answer is not null) dest.Answer = new List(_Answer.DeepCopyInternal()); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -265,62 +255,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ItemComponent; - if(otherT == null) return false; + if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(TextElement, otherT.TextElement)) return false; - if(!comparer.ListEquals(Answer, otherT.Answer)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "text": - value = TextElement; - return TextElement is not null; + value = _TextElement; + return _TextElement is not null; case "answer": - value = Answer; - return Answer?.Any() == true; + value = _Answer; + return _Answer?.Any() == true; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "definition": - DefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + DefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "text": - TextElement = (Hl7.Fhir.Model.FhirString)value; + TextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "answer": - Answer = (List)value; + Answer = (List?)value!; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -331,11 +321,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (TextElement is not null) yield return new KeyValuePair("text",TextElement); - if (Answer?.Any() == true) yield return new KeyValuePair("answer",Answer); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_TextElement is not null) yield return new KeyValuePair("text",_TextElement); + if (_Answer?.Any() == true) yield return new KeyValuePair("answer",_Answer); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -367,13 +357,13 @@ public partial class AnswerComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; /// /// Child items of question. @@ -383,24 +373,20 @@ public Hl7.Fhir.Model.DataType Value [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as AnswerComponent; - - if (dest == null) - { + if(other is not AnswerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -412,41 +398,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AnswerComponent; - if(otherT == null) return false; + if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -457,8 +443,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Value is not null) yield return new KeyValuePair("value",_Value); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } @@ -471,11 +457,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Request fulfilled by this QuestionnaireResponse. @@ -487,11 +473,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -503,11 +489,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// Canonical URL of Questionnaire being answered. @@ -515,28 +501,25 @@ public List PartOf [FhirElement("questionnaire", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical QuestionnaireElement + public Hl7.Fhir.Model.Canonical? QuestionnaireElement { get { return _QuestionnaireElement; } set { _QuestionnaireElement = value; OnPropertyChanged("QuestionnaireElement"); } } - private Hl7.Fhir.Model.Canonical _QuestionnaireElement; + private Hl7.Fhir.Model.Canonical? _QuestionnaireElement; /// /// Canonical URL of Questionnaire being answered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Questionnaire + public string? Questionnaire { - get { return QuestionnaireElement != null ? QuestionnaireElement.Value : null; } + get => _QuestionnaireElement?.Value; set { - if (value == null) - QuestionnaireElement = null; - else - QuestionnaireElement = new Hl7.Fhir.Model.Canonical(value); + QuestionnaireElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Questionnaire"); } } @@ -549,13 +532,13 @@ public string Questionnaire [Binding("QuestionnaireResponseStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | amended | entered-in-error | stopped @@ -564,13 +547,10 @@ public Code St [IgnoreDataMember] public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -582,13 +562,13 @@ public Hl7.Fhir.Model.QuestionnaireResponse.QuestionnaireResponseStatus? Status [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Encounter the questionnaire response is part of. @@ -597,41 +577,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Date the answers were gathered. /// [FhirElement("authored", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredElement { get { return _AuthoredElement; } set { _AuthoredElement = value; OnPropertyChanged("AuthoredElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredElement; /// /// Date the answers were gathered /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Authored + public string? Authored { - get { return AuthoredElement != null ? AuthoredElement.Value : null; } + get => _AuthoredElement?.Value; set { - if (value == null) - AuthoredElement = null; - else - AuthoredElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Authored"); } } @@ -643,13 +620,13 @@ public string Authored [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole","Patient","RelatedPerson","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// The individual or device that answered the questions. @@ -658,13 +635,13 @@ public Hl7.Fhir.Model.ResourceReference Author [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Source + public Hl7.Fhir.Model.ResourceReference? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.ResourceReference _Source; + private Hl7.Fhir.Model.ResourceReference? _Source; /// /// Groups and questions. @@ -674,35 +651,31 @@ public Hl7.Fhir.Model.ResourceReference Source [DataMember] public List Item { - get { if(_Item==null) _Item = new List(); return _Item; } + get => _Item ?? new List(); set { _Item = value; OnPropertyChanged("Item"); } } - private List _Item; + private List? _Item; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as QuestionnaireResponse; - - if (dest == null) - { + if(other is not QuestionnaireResponse dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(QuestionnaireElement != null) dest.QuestionnaireElement = (Hl7.Fhir.Model.Canonical)QuestionnaireElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(AuthoredElement != null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.ResourceReference)Source.DeepCopyInternal(); - if(Item.Any()) dest.Item = new List(Item.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_QuestionnaireElement is not null) dest.QuestionnaireElement = (Hl7.Fhir.Model.Canonical)_QuestionnaireElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_AuthoredElement is not null) dest.AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.ResourceReference)_Source.DeepCopyInternal(); + if(_Item is not null) dest.Item = new List(_Item.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -714,104 +687,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QuestionnaireResponse; - if(otherT == null) return false; + if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(QuestionnaireElement, otherT.QuestionnaireElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(AuthoredElement, otherT.AuthoredElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_QuestionnaireElement, otherT._QuestionnaireElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_AuthoredElement, otherT._AuthoredElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "questionnaire": - value = QuestionnaireElement; - return QuestionnaireElement is not null; + value = _QuestionnaireElement; + return _QuestionnaireElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "authored": - value = AuthoredElement; - return AuthoredElement is not null; + value = _AuthoredElement; + return _AuthoredElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; case "item": - value = Item; - return Item?.Any() == true; + value = _Item; + return _Item?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "questionnaire": - QuestionnaireElement = (Hl7.Fhir.Model.Canonical)value; + QuestionnaireElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authored": - AuthoredElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.ResourceReference)value; + Source = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (List)value; + Item = (List?)value!; return this; default: return base.SetValue(key, value); @@ -822,17 +795,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (QuestionnaireElement is not null) yield return new KeyValuePair("questionnaire",QuestionnaireElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (AuthoredElement is not null) yield return new KeyValuePair("authored",AuthoredElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Source is not null) yield return new KeyValuePair("source",Source); - if (Item?.Any() == true) yield return new KeyValuePair("item",Item); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_QuestionnaireElement is not null) yield return new KeyValuePair("questionnaire",_QuestionnaireElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_AuthoredElement is not null) yield return new KeyValuePair("authored",_AuthoredElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Source is not null) yield return new KeyValuePair("source",_Source); + if (_Item?.Any() == true) yield return new KeyValuePair("item",_Item); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs b/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs index 63266396e..4b3c712c2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -65,39 +68,35 @@ public partial class Ratio : Hl7.Fhir.Model.DataType /// [FhirElement("numerator", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity Numerator + public Hl7.Fhir.Model.Quantity? Numerator { get { return _Numerator; } set { _Numerator = value; OnPropertyChanged("Numerator"); } } - private Hl7.Fhir.Model.Quantity _Numerator; + private Hl7.Fhir.Model.Quantity? _Numerator; /// /// Denominator value. /// [FhirElement("denominator", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Denominator + public Hl7.Fhir.Model.Quantity? Denominator { get { return _Denominator; } set { _Denominator = value; OnPropertyChanged("Denominator"); } } - private Hl7.Fhir.Model.Quantity _Denominator; + private Hl7.Fhir.Model.Quantity? _Denominator; protected internal override void CopyToInternal(Base other) { - var dest = other as Ratio; - - if (dest == null) - { + if(other is not Ratio dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Numerator != null) dest.Numerator = (Hl7.Fhir.Model.Quantity)Numerator.DeepCopyInternal(); - if(Denominator != null) dest.Denominator = (Hl7.Fhir.Model.Quantity)Denominator.DeepCopyInternal(); + if(_Numerator is not null) dest.Numerator = (Hl7.Fhir.Model.Quantity)_Numerator.DeepCopyInternal(); + if(_Denominator is not null) dest.Denominator = (Hl7.Fhir.Model.Quantity)_Denominator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -109,41 +108,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Ratio; - if(otherT == null) return false; + if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Numerator, otherT.Numerator)) return false; - if(!comparer.Equals(Denominator, otherT.Denominator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "numerator": - value = Numerator; - return Numerator is not null; + value = _Numerator; + return _Numerator is not null; case "denominator": - value = Denominator; - return Denominator is not null; + value = _Denominator; + return _Denominator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "numerator": - Numerator = (Hl7.Fhir.Model.Quantity)value; + Numerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "denominator": - Denominator = (Hl7.Fhir.Model.Quantity)value; + Denominator = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -154,8 +153,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Numerator is not null) yield return new KeyValuePair("numerator",Numerator); - if (Denominator is not null) yield return new KeyValuePair("denominator",Denominator); + if (_Numerator is not null) yield return new KeyValuePair("numerator",_Numerator); + if (_Denominator is not null) yield return new KeyValuePair("denominator",_Denominator); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs b/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs index f0c3aaa50..209d22ffa 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -65,53 +68,49 @@ public partial class RatioRange : Hl7.Fhir.Model.DataType /// [FhirElement("lowNumerator", InSummary=true, Order=30)] [DataMember] - public Hl7.Fhir.Model.Quantity LowNumerator + public Hl7.Fhir.Model.Quantity? LowNumerator { get { return _LowNumerator; } set { _LowNumerator = value; OnPropertyChanged("LowNumerator"); } } - private Hl7.Fhir.Model.Quantity _LowNumerator; + private Hl7.Fhir.Model.Quantity? _LowNumerator; /// /// High Numerator limit. /// [FhirElement("highNumerator", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity HighNumerator + public Hl7.Fhir.Model.Quantity? HighNumerator { get { return _HighNumerator; } set { _HighNumerator = value; OnPropertyChanged("HighNumerator"); } } - private Hl7.Fhir.Model.Quantity _HighNumerator; + private Hl7.Fhir.Model.Quantity? _HighNumerator; /// /// Denominator value. /// [FhirElement("denominator", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Quantity Denominator + public Hl7.Fhir.Model.Quantity? Denominator { get { return _Denominator; } set { _Denominator = value; OnPropertyChanged("Denominator"); } } - private Hl7.Fhir.Model.Quantity _Denominator; + private Hl7.Fhir.Model.Quantity? _Denominator; protected internal override void CopyToInternal(Base other) { - var dest = other as RatioRange; - - if (dest == null) - { + if(other is not RatioRange dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LowNumerator != null) dest.LowNumerator = (Hl7.Fhir.Model.Quantity)LowNumerator.DeepCopyInternal(); - if(HighNumerator != null) dest.HighNumerator = (Hl7.Fhir.Model.Quantity)HighNumerator.DeepCopyInternal(); - if(Denominator != null) dest.Denominator = (Hl7.Fhir.Model.Quantity)Denominator.DeepCopyInternal(); + if(_LowNumerator is not null) dest.LowNumerator = (Hl7.Fhir.Model.Quantity)_LowNumerator.DeepCopyInternal(); + if(_HighNumerator is not null) dest.HighNumerator = (Hl7.Fhir.Model.Quantity)_HighNumerator.DeepCopyInternal(); + if(_Denominator is not null) dest.Denominator = (Hl7.Fhir.Model.Quantity)_Denominator.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -123,48 +122,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RatioRange; - if(otherT == null) return false; + if(other is not RatioRange otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LowNumerator, otherT.LowNumerator)) return false; - if(!comparer.Equals(HighNumerator, otherT.HighNumerator)) return false; - if(!comparer.Equals(Denominator, otherT.Denominator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LowNumerator, otherT._LowNumerator)) return false; + if(!comparer.Equals(_HighNumerator, otherT._HighNumerator)) return false; + if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "lowNumerator": - value = LowNumerator; - return LowNumerator is not null; + value = _LowNumerator; + return _LowNumerator is not null; case "highNumerator": - value = HighNumerator; - return HighNumerator is not null; + value = _HighNumerator; + return _HighNumerator is not null; case "denominator": - value = Denominator; - return Denominator is not null; + value = _Denominator; + return _Denominator is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "lowNumerator": - LowNumerator = (Hl7.Fhir.Model.Quantity)value; + LowNumerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "highNumerator": - HighNumerator = (Hl7.Fhir.Model.Quantity)value; + HighNumerator = (Hl7.Fhir.Model.Quantity?)value; return this; case "denominator": - Denominator = (Hl7.Fhir.Model.Quantity)value; + Denominator = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -175,9 +174,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LowNumerator is not null) yield return new KeyValuePair("lowNumerator",LowNumerator); - if (HighNumerator is not null) yield return new KeyValuePair("highNumerator",HighNumerator); - if (Denominator is not null) yield return new KeyValuePair("denominator",Denominator); + if (_LowNumerator is not null) yield return new KeyValuePair("lowNumerator",_LowNumerator); + if (_HighNumerator is not null) yield return new KeyValuePair("highNumerator",_HighNumerator); + if (_Denominator is not null) yield return new KeyValuePair("denominator",_Denominator); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs b/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs index 7f38c9bfd..6ba57b66d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,13 +83,13 @@ public partial class CaseComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// The defining type of case. @@ -94,13 +97,13 @@ public Hl7.Fhir.Model.Identifier Identifier [FhirElement("type", InSummary=true, Order=50)] [Binding("RegulatedAuthorizationCaseType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The status associated with the case. @@ -108,13 +111,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("status", InSummary=true, Order=60)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Relevant date for this case. @@ -123,13 +126,13 @@ public Hl7.Fhir.Model.CodeableConcept Status [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Date + public Hl7.Fhir.Model.DataType? Date { get { return _Date; } set { _Date = value; OnPropertyChanged("Date"); } } - private Hl7.Fhir.Model.DataType _Date; + private Hl7.Fhir.Model.DataType? _Date; /// /// Applications submitted to obtain a regulated authorization. Steps within the longer running case or procedure. @@ -139,27 +142,23 @@ public Hl7.Fhir.Model.DataType Date [DataMember] public List Application { - get { if(_Application==null) _Application = new List(); return _Application; } + get => _Application ?? new List(); set { _Application = value; OnPropertyChanged("Application"); } } - private List _Application; + private List? _Application; protected internal override void CopyToInternal(Base other) { - var dest = other as CaseComponent; - - if (dest == null) - { + if(other is not CaseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Date != null) dest.Date = (Hl7.Fhir.Model.DataType)Date.DeepCopyInternal(); - if(Application.Any()) dest.Application = new List(Application.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Date is not null) dest.Date = (Hl7.Fhir.Model.DataType)_Date.DeepCopyInternal(); + if(_Application is not null) dest.Application = new List(_Application.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -171,62 +170,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CaseComponent; - if(otherT == null) return false; + if(other is not CaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(Date, otherT.Date)) return false; - if(!comparer.ListEquals(Application, otherT.Application)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_Date, otherT._Date)) return false; + if(!comparer.ListEquals(_Application, otherT._Application)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "date": - value = Date; - return Date is not null; + value = _Date; + return _Date is not null; case "application": - value = Application; - return Application?.Any() == true; + value = _Application; + return _Application?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - Date = (Hl7.Fhir.Model.DataType)value; + Date = (Hl7.Fhir.Model.DataType?)value; return this; case "application": - Application = (List)value; + Application = (List?)value!; return this; default: return base.SetValue(key, value); @@ -237,11 +236,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Date is not null) yield return new KeyValuePair("date",Date); - if (Application?.Any() == true) yield return new KeyValuePair("application",Application); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Date is not null) yield return new KeyValuePair("date",_Date); + if (_Application?.Any() == true) yield return new KeyValuePair("application",_Application); } } @@ -254,11 +253,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The product type, treatment, facility or activity that is being authorized. @@ -270,11 +269,11 @@ public List Identifier [DataMember] public List Subject { - get { if(_Subject==null) _Subject = new List(); return _Subject; } + get => _Subject ?? new List(); set { _Subject = value; OnPropertyChanged("Subject"); } } - private List _Subject; + private List? _Subject; /// /// Overall type of this authorization, for example drug marketing approval, orphan drug designation. @@ -282,41 +281,38 @@ public List Subject [FhirElement("type", InSummary=true, Order=110)] [Binding("RegulatedAuthorizationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// General textual supporting information. /// [FhirElement("description", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// General textual supporting information /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -330,11 +326,11 @@ public string Description [DataMember] public List Region { - get { if(_Region==null) _Region = new List(); return _Region; } + get => _Region ?? new List(); set { _Region = value; OnPropertyChanged("Region"); } } - private List _Region; + private List? _Region; /// /// The status that is authorised e.g. approved. Intermediate states can be tracked with cases and applications. @@ -342,41 +338,38 @@ public List Region [FhirElement("status", InSummary=true, Order=140)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the current status was assigned. /// [FhirElement("statusDate", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the current status was assigned /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -386,13 +379,13 @@ public string StatusDate /// [FhirElement("validityPeriod", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Period ValidityPeriod + public Hl7.Fhir.Model.Period? ValidityPeriod { get { return _ValidityPeriod; } set { _ValidityPeriod = value; OnPropertyChanged("ValidityPeriod"); } } - private Hl7.Fhir.Model.Period _ValidityPeriod; + private Hl7.Fhir.Model.Period? _ValidityPeriod; /// /// Condition for which the use of the regulated product applies. @@ -402,11 +395,11 @@ public Hl7.Fhir.Model.Period ValidityPeriod [DataMember] public List Indication { - get { if(_Indication==null) _Indication = new List(); return _Indication; } + get => _Indication ?? new List(); set { _Indication = value; OnPropertyChanged("Indication"); } } - private List _Indication; + private List? _Indication; /// /// The intended use of the product, e.g. prevention, treatment. @@ -414,13 +407,13 @@ public List Indication [FhirElement("intendedUse", InSummary=true, Order=180)] [Binding("ProductIntendedUse")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept IntendedUse + public Hl7.Fhir.Model.CodeableConcept? IntendedUse { get { return _IntendedUse; } set { _IntendedUse = value; OnPropertyChanged("IntendedUse"); } } - private Hl7.Fhir.Model.CodeableConcept _IntendedUse; + private Hl7.Fhir.Model.CodeableConcept? _IntendedUse; /// /// The legal/regulatory framework or reasons under which this authorization is granted. @@ -431,11 +424,11 @@ public Hl7.Fhir.Model.CodeableConcept IntendedUse [DataMember] public List Basis { - get { if(_Basis==null) _Basis = new List(); return _Basis; } + get => _Basis ?? new List(); set { _Basis = value; OnPropertyChanged("Basis"); } } - private List _Basis; + private List? _Basis; /// /// The organization that has been granted this authorization, by the regulator. @@ -444,13 +437,13 @@ public List Basis [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Holder + public Hl7.Fhir.Model.ResourceReference? Holder { get { return _Holder; } set { _Holder = value; OnPropertyChanged("Holder"); } } - private Hl7.Fhir.Model.ResourceReference _Holder; + private Hl7.Fhir.Model.ResourceReference? _Holder; /// /// The regulatory authority or authorizing body granting the authorization. @@ -459,13 +452,13 @@ public Hl7.Fhir.Model.ResourceReference Holder [CLSCompliant(false)] [References("Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Regulator + public Hl7.Fhir.Model.ResourceReference? Regulator { get { return _Regulator; } set { _Regulator = value; OnPropertyChanged("Regulator"); } } - private Hl7.Fhir.Model.ResourceReference _Regulator; + private Hl7.Fhir.Model.ResourceReference? _Regulator; /// /// Additional information or supporting documentation about the authorization. @@ -477,52 +470,48 @@ public Hl7.Fhir.Model.ResourceReference Regulator [DataMember] public List AttachedDocument { - get { if(_AttachedDocument==null) _AttachedDocument = new List(); return _AttachedDocument; } + get => _AttachedDocument ?? new List(); set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } - private List _AttachedDocument; + private List? _AttachedDocument; /// /// The case or regulatory procedure for granting or amending a regulated authorization. Note: This area is subject to ongoing review and the workgroup is seeking implementer feedback on its use (see link at bottom of page). /// [FhirElement("case", InSummary=true, Order=230)] [DataMember] - public Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent Case + public Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent? Case { get { return _Case; } set { _Case = value; OnPropertyChanged("Case"); } } - private Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent _Case; + private Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent? _Case; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RegulatedAuthorization; - - if (dest == null) - { + if(other is not RegulatedAuthorization dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(Subject.Any()) dest.Subject = new List(Subject.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Region.Any()) dest.Region = new List(Region.DeepCopyInternal()); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(ValidityPeriod != null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)ValidityPeriod.DeepCopyInternal(); - if(Indication.Any()) dest.Indication = new List(Indication.DeepCopyInternal()); - if(IntendedUse != null) dest.IntendedUse = (Hl7.Fhir.Model.CodeableConcept)IntendedUse.DeepCopyInternal(); - if(Basis.Any()) dest.Basis = new List(Basis.DeepCopyInternal()); - if(Holder != null) dest.Holder = (Hl7.Fhir.Model.ResourceReference)Holder.DeepCopyInternal(); - if(Regulator != null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)Regulator.DeepCopyInternal(); - if(AttachedDocument.Any()) dest.AttachedDocument = new List(AttachedDocument.DeepCopyInternal()); - if(Case != null) dest.Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent)Case.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_Subject is not null) dest.Subject = new List(_Subject.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Region is not null) dest.Region = new List(_Region.DeepCopyInternal()); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_ValidityPeriod is not null) dest.ValidityPeriod = (Hl7.Fhir.Model.Period)_ValidityPeriod.DeepCopyInternal(); + if(_Indication is not null) dest.Indication = new List(_Indication.DeepCopyInternal()); + if(_IntendedUse is not null) dest.IntendedUse = (Hl7.Fhir.Model.CodeableConcept)_IntendedUse.DeepCopyInternal(); + if(_Basis is not null) dest.Basis = new List(_Basis.DeepCopyInternal()); + if(_Holder is not null) dest.Holder = (Hl7.Fhir.Model.ResourceReference)_Holder.DeepCopyInternal(); + if(_Regulator is not null) dest.Regulator = (Hl7.Fhir.Model.ResourceReference)_Regulator.DeepCopyInternal(); + if(_AttachedDocument is not null) dest.AttachedDocument = new List(_AttachedDocument.DeepCopyInternal()); + if(_Case is not null) dest.Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent)_Case.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -534,132 +523,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RegulatedAuthorization; - if(otherT == null) return false; + if(other is not RegulatedAuthorization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Region, otherT.Region)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(ValidityPeriod, otherT.ValidityPeriod)) return false; - if(!comparer.ListEquals(Indication, otherT.Indication)) return false; - if(!comparer.Equals(IntendedUse, otherT.IntendedUse)) return false; - if(!comparer.ListEquals(Basis, otherT.Basis)) return false; - if(!comparer.Equals(Holder, otherT.Holder)) return false; - if(!comparer.Equals(Regulator, otherT.Regulator)) return false; - if(!comparer.ListEquals(AttachedDocument, otherT.AttachedDocument)) return false; - if(!comparer.Equals(Case, otherT.Case)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Region, otherT._Region)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + if(!comparer.Equals(_IntendedUse, otherT._IntendedUse)) return false; + if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + if(!comparer.Equals(_Holder, otherT._Holder)) return false; + if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; + if(!comparer.ListEquals(_AttachedDocument, otherT._AttachedDocument)) return false; + if(!comparer.Equals(_Case, otherT._Case)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "subject": - value = Subject; - return Subject?.Any() == true; + value = _Subject; + return _Subject?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "region": - value = Region; - return Region?.Any() == true; + value = _Region; + return _Region?.Any() == true; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "validityPeriod": - value = ValidityPeriod; - return ValidityPeriod is not null; + value = _ValidityPeriod; + return _ValidityPeriod is not null; case "indication": - value = Indication; - return Indication?.Any() == true; + value = _Indication; + return _Indication?.Any() == true; case "intendedUse": - value = IntendedUse; - return IntendedUse is not null; + value = _IntendedUse; + return _IntendedUse is not null; case "basis": - value = Basis; - return Basis?.Any() == true; + value = _Basis; + return _Basis?.Any() == true; case "holder": - value = Holder; - return Holder is not null; + value = _Holder; + return _Holder is not null; case "regulator": - value = Regulator; - return Regulator is not null; + value = _Regulator; + return _Regulator is not null; case "attachedDocument": - value = AttachedDocument; - return AttachedDocument?.Any() == true; + value = _AttachedDocument; + return _AttachedDocument?.Any() == true; case "case": - value = Case; - return Case is not null; + value = _Case; + return _Case is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "subject": - Subject = (List)value; + Subject = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "region": - Region = (List)value; + Region = (List?)value!; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "validityPeriod": - ValidityPeriod = (Hl7.Fhir.Model.Period)value; + ValidityPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "indication": - Indication = (List)value; + Indication = (List?)value!; return this; case "intendedUse": - IntendedUse = (Hl7.Fhir.Model.CodeableConcept)value; + IntendedUse = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "basis": - Basis = (List)value; + Basis = (List?)value!; return this; case "holder": - Holder = (Hl7.Fhir.Model.ResourceReference)value; + Holder = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "regulator": - Regulator = (Hl7.Fhir.Model.ResourceReference)value; + Regulator = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "attachedDocument": - AttachedDocument = (List)value; + AttachedDocument = (List?)value!; return this; case "case": - Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent)value; + Case = (Hl7.Fhir.Model.RegulatedAuthorization.CaseComponent?)value; return this; default: return base.SetValue(key, value); @@ -670,21 +659,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (Subject?.Any() == true) yield return new KeyValuePair("subject",Subject); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Region?.Any() == true) yield return new KeyValuePair("region",Region); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",ValidityPeriod); - if (Indication?.Any() == true) yield return new KeyValuePair("indication",Indication); - if (IntendedUse is not null) yield return new KeyValuePair("intendedUse",IntendedUse); - if (Basis?.Any() == true) yield return new KeyValuePair("basis",Basis); - if (Holder is not null) yield return new KeyValuePair("holder",Holder); - if (Regulator is not null) yield return new KeyValuePair("regulator",Regulator); - if (AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",AttachedDocument); - if (Case is not null) yield return new KeyValuePair("case",Case); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_Subject?.Any() == true) yield return new KeyValuePair("subject",_Subject); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Region?.Any() == true) yield return new KeyValuePair("region",_Region); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_ValidityPeriod is not null) yield return new KeyValuePair("validityPeriod",_ValidityPeriod); + if (_Indication?.Any() == true) yield return new KeyValuePair("indication",_Indication); + if (_IntendedUse is not null) yield return new KeyValuePair("intendedUse",_IntendedUse); + if (_Basis?.Any() == true) yield return new KeyValuePair("basis",_Basis); + if (_Holder is not null) yield return new KeyValuePair("holder",_Holder); + if (_Regulator is not null) yield return new KeyValuePair("regulator",_Regulator); + if (_AttachedDocument?.Any() == true) yield return new KeyValuePair("attachedDocument",_AttachedDocument); + if (_Case is not null) yield return new KeyValuePair("case",_Case); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs index 480543d8a..ef861befd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,26 +85,26 @@ public partial class CommunicationComponent : Hl7.Fhir.Model.BackboneElement [Binding("Language")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// Language preference indicator. /// [FhirElement("preferred", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// Language preference indicator @@ -110,29 +113,22 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CommunicationComponent; - - if (dest == null) - { + if(other is not CommunicationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -144,41 +140,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CommunicationComponent; - if(otherT == null) return false; + if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -189,8 +185,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); } } @@ -203,24 +199,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this related person's record is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this related person's record is in active use @@ -229,13 +225,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -248,13 +241,13 @@ public bool? Active [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// The relationship of the related person to the patient. @@ -265,11 +258,11 @@ public Hl7.Fhir.Model.ResourceReference Patient [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// A name associated with the person. @@ -279,11 +272,11 @@ public List Relationship [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A contact detail for the person. @@ -293,11 +286,11 @@ public List Name [DataMember] public List Telecom { - get { if(_Telecom==null) _Telecom = new List(); return _Telecom; } + get => _Telecom ?? new List(); set { _Telecom = value; OnPropertyChanged("Telecom"); } } - private List _Telecom; + private List? _Telecom; /// /// male | female | other | unknown. @@ -306,13 +299,13 @@ public List Telecom [DeclaredType(Type = typeof(Code))] [Binding("AdministrativeGender")] [DataMember] - public Code GenderElement + public Code? GenderElement { get { return _GenderElement; } set { _GenderElement = value; OnPropertyChanged("GenderElement"); } } - private Code _GenderElement; + private Code? _GenderElement; /// /// male | female | other | unknown @@ -321,13 +314,10 @@ public Code GenderElement [IgnoreDataMember] public Hl7.Fhir.Model.AdministrativeGender? Gender { - get { return GenderElement != null ? GenderElement.Value : null; } + get => _GenderElement?.Value; set { - if (value == null) - GenderElement = null; - else - GenderElement = new Code(value); + GenderElement = value is null ? null : new Code(value); OnPropertyChanged("Gender"); } } @@ -337,28 +327,25 @@ public Hl7.Fhir.Model.AdministrativeGender? Gender /// [FhirElement("birthDate", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Date BirthDateElement + public Hl7.Fhir.Model.Date? BirthDateElement { get { return _BirthDateElement; } set { _BirthDateElement = value; OnPropertyChanged("BirthDateElement"); } } - private Hl7.Fhir.Model.Date _BirthDateElement; + private Hl7.Fhir.Model.Date? _BirthDateElement; /// /// The date on which the related person was born /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string BirthDate + public string? BirthDate { - get { return BirthDateElement != null ? BirthDateElement.Value : null; } + get => _BirthDateElement?.Value; set { - if (value == null) - BirthDateElement = null; - else - BirthDateElement = new Hl7.Fhir.Model.Date(value); + BirthDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("BirthDate"); } } @@ -371,11 +358,11 @@ public string BirthDate [DataMember] public List Address { - get { if(_Address==null) _Address = new List(); return _Address; } + get => _Address ?? new List(); set { _Address = value; OnPropertyChanged("Address"); } } - private List _Address; + private List? _Address; /// /// Image of the person. @@ -385,24 +372,24 @@ public List Address [DataMember] public List Photo { - get { if(_Photo==null) _Photo = new List(); return _Photo; } + get => _Photo ?? new List(); set { _Photo = value; OnPropertyChanged("Photo"); } } - private List _Photo; + private List? _Photo; /// /// Period of time that this relationship is considered valid. /// [FhirElement("period", Order=190, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// A language which may be used to communicate with the related person about the patient's health. @@ -412,36 +399,32 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Communication { - get { if(_Communication==null) _Communication = new List(); return _Communication; } + get => _Communication ?? new List(); set { _Communication = value; OnPropertyChanged("Communication"); } } - private List _Communication; + private List? _Communication; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedPerson; - - if (dest == null) - { + if(other is not RelatedPerson dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Telecom.Any()) dest.Telecom = new List(Telecom.DeepCopyInternal()); - if(GenderElement != null) dest.GenderElement = (Code)GenderElement.DeepCopyInternal(); - if(BirthDateElement != null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)BirthDateElement.DeepCopyInternal(); - if(Address.Any()) dest.Address = new List(Address.DeepCopyInternal()); - if(Photo.Any()) dest.Photo = new List(Photo.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Communication.Any()) dest.Communication = new List(Communication.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Telecom is not null) dest.Telecom = new List(_Telecom.DeepCopyInternal()); + if(_GenderElement is not null) dest.GenderElement = (Code)_GenderElement.DeepCopyInternal(); + if(_BirthDateElement is not null) dest.BirthDateElement = (Hl7.Fhir.Model.Date)_BirthDateElement.DeepCopyInternal(); + if(_Address is not null) dest.Address = new List(_Address.DeepCopyInternal()); + if(_Photo is not null) dest.Photo = new List(_Photo.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Communication is not null) dest.Communication = new List(_Communication.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -453,111 +436,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedPerson; - if(otherT == null) return false; + if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Telecom, otherT.Telecom)) return false; - if(!comparer.Equals(GenderElement, otherT.GenderElement)) return false; - if(!comparer.Equals(BirthDateElement, otherT.BirthDateElement)) return false; - if(!comparer.ListEquals(Address, otherT.Address)) return false; - if(!comparer.ListEquals(Photo, otherT.Photo)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Communication, otherT.Communication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; + if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; + if(!comparer.Equals(_BirthDateElement, otherT._BirthDateElement)) return false; + if(!comparer.ListEquals(_Address, otherT._Address)) return false; + if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "telecom": - value = Telecom; - return Telecom?.Any() == true; + value = _Telecom; + return _Telecom?.Any() == true; case "gender": - value = GenderElement; - return GenderElement is not null; + value = _GenderElement; + return _GenderElement is not null; case "birthDate": - value = BirthDateElement; - return BirthDateElement is not null; + value = _BirthDateElement; + return _BirthDateElement is not null; case "address": - value = Address; - return Address?.Any() == true; + value = _Address; + return _Address?.Any() == true; case "photo": - value = Photo; - return Photo?.Any() == true; + value = _Photo; + return _Photo?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "communication": - value = Communication; - return Communication?.Any() == true; + value = _Communication; + return _Communication?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "telecom": - Telecom = (List)value; + Telecom = (List?)value!; return this; case "gender": - GenderElement = (Code)value; + GenderElement = (Code?)value; return this; case "birthDate": - BirthDateElement = (Hl7.Fhir.Model.Date)value; + BirthDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "address": - Address = (List)value; + Address = (List?)value!; return this; case "photo": - Photo = (List)value; + Photo = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "communication": - Communication = (List)value; + Communication = (List?)value!; return this; default: return base.SetValue(key, value); @@ -568,18 +551,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Telecom?.Any() == true) yield return new KeyValuePair("telecom",Telecom); - if (GenderElement is not null) yield return new KeyValuePair("gender",GenderElement); - if (BirthDateElement is not null) yield return new KeyValuePair("birthDate",BirthDateElement); - if (Address?.Any() == true) yield return new KeyValuePair("address",Address); - if (Photo?.Any() == true) yield return new KeyValuePair("photo",Photo); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Communication?.Any() == true) yield return new KeyValuePair("communication",Communication); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Telecom?.Any() == true) yield return new KeyValuePair("telecom",_Telecom); + if (_GenderElement is not null) yield return new KeyValuePair("gender",_GenderElement); + if (_BirthDateElement is not null) yield return new KeyValuePair("birthDate",_BirthDateElement); + if (_Address?.Any() == true) yield return new KeyValuePair("address",_Address); + if (_Photo?.Any() == true) yield return new KeyValuePair("photo",_Photo); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Communication?.Any() == true) yield return new KeyValuePair("communication",_Communication); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs index 1d236f208..5525562a2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,28 +83,25 @@ public partial class ActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LinkIdElement + public Hl7.Fhir.Model.FhirString? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.FhirString _LinkIdElement; + private Hl7.Fhir.Model.FhirString? _LinkIdElement; /// /// Pointer to specific item from the PlanDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.FhirString(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LinkId"); } } @@ -111,28 +111,25 @@ public string LinkId /// [FhirElement("prefix", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString PrefixElement + public Hl7.Fhir.Model.FhirString? PrefixElement { get { return _PrefixElement; } set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } - private Hl7.Fhir.Model.FhirString _PrefixElement; + private Hl7.Fhir.Model.FhirString? _PrefixElement; /// /// User-visible prefix for the action (e.g. 1. or A.) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Prefix + public string? Prefix { - get { return PrefixElement != null ? PrefixElement.Value : null; } + get => _PrefixElement?.Value; set { - if (value == null) - PrefixElement = null; - else - PrefixElement = new Hl7.Fhir.Model.FhirString(value); + PrefixElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Prefix"); } } @@ -142,28 +139,25 @@ public string Prefix /// [FhirElement("title", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -173,28 +167,25 @@ public string Title /// [FhirElement("description", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Short description of the action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -204,28 +195,25 @@ public string Description /// [FhirElement("textEquivalent", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown TextEquivalentElement + public Hl7.Fhir.Model.Markdown? TextEquivalentElement { get { return _TextEquivalentElement; } set { _TextEquivalentElement = value; OnPropertyChanged("TextEquivalentElement"); } } - private Hl7.Fhir.Model.Markdown _TextEquivalentElement; + private Hl7.Fhir.Model.Markdown? _TextEquivalentElement; /// /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextEquivalent + public string? TextEquivalent { - get { return TextEquivalentElement != null ? TextEquivalentElement.Value : null; } + get => _TextEquivalentElement?.Value; set { - if (value == null) - TextEquivalentElement = null; - else - TextEquivalentElement = new Hl7.Fhir.Model.Markdown(value); + TextEquivalentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("TextEquivalent"); } } @@ -237,13 +225,13 @@ public string TextEquivalent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -252,13 +240,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -272,11 +257,11 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Supporting documentation for the intended performer of the action. @@ -286,11 +271,11 @@ public List Code [DataMember] public List Documentation { - get { if(_Documentation==null) _Documentation = new List(); return _Documentation; } + get => _Documentation ?? new List(); set { _Documentation = value; OnPropertyChanged("Documentation"); } } - private List _Documentation; + private List? _Documentation; /// /// What goals. @@ -302,11 +287,11 @@ public List Documentation [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Whether or not the action is applicable. @@ -316,11 +301,11 @@ public List Goal [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Input data requirements. @@ -330,11 +315,11 @@ public List Condition [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Output data definition. @@ -344,11 +329,11 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; /// /// Relationship to another action. @@ -358,11 +343,11 @@ public List Output [DataMember] public List RelatedAction { - get { if(_RelatedAction==null) _RelatedAction = new List(); return _RelatedAction; } + get => _RelatedAction ?? new List(); set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } - private List _RelatedAction; + private List? _RelatedAction; /// /// When the action should take place. @@ -371,26 +356,26 @@ public List RelatedA [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Where it should happen. /// [FhirElement("location", Order=180)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Location + public Hl7.Fhir.Model.CodeableReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.CodeableReference _Location; + private Hl7.Fhir.Model.CodeableReference? _Location; /// /// Who should perform the action. @@ -400,11 +385,11 @@ public Hl7.Fhir.Model.CodeableReference Location [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// create | update | remove | fire-event. @@ -412,13 +397,13 @@ public List Participan [FhirElement("type", Order=200)] [Binding("ActionType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// visual-group | logical-group | sentence-group. @@ -427,13 +412,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [DeclaredType(Type = typeof(Code))] [Binding("ActionGroupingBehavior")] [DataMember] - public Code GroupingBehaviorElement + public Code? GroupingBehaviorElement { get { return _GroupingBehaviorElement; } set { _GroupingBehaviorElement = value; OnPropertyChanged("GroupingBehaviorElement"); } } - private Code _GroupingBehaviorElement; + private Code? _GroupingBehaviorElement; /// /// visual-group | logical-group | sentence-group @@ -442,13 +427,10 @@ public Code GroupingBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior { - get { return GroupingBehaviorElement != null ? GroupingBehaviorElement.Value : null; } + get => _GroupingBehaviorElement?.Value; set { - if (value == null) - GroupingBehaviorElement = null; - else - GroupingBehaviorElement = new Code(value); + GroupingBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("GroupingBehavior"); } } @@ -460,13 +442,13 @@ public Hl7.Fhir.Model.ActionGroupingBehavior? GroupingBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionSelectionBehavior")] [DataMember] - public Code SelectionBehaviorElement + public Code? SelectionBehaviorElement { get { return _SelectionBehaviorElement; } set { _SelectionBehaviorElement = value; OnPropertyChanged("SelectionBehaviorElement"); } } - private Code _SelectionBehaviorElement; + private Code? _SelectionBehaviorElement; /// /// any | all | all-or-none | exactly-one | at-most-one | one-or-more @@ -475,13 +457,10 @@ public Code SelectionBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior { - get { return SelectionBehaviorElement != null ? SelectionBehaviorElement.Value : null; } + get => _SelectionBehaviorElement?.Value; set { - if (value == null) - SelectionBehaviorElement = null; - else - SelectionBehaviorElement = new Code(value); + SelectionBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("SelectionBehavior"); } } @@ -493,13 +472,13 @@ public Hl7.Fhir.Model.ActionSelectionBehavior? SelectionBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionRequiredBehavior")] [DataMember] - public Code RequiredBehaviorElement + public Code? RequiredBehaviorElement { get { return _RequiredBehaviorElement; } set { _RequiredBehaviorElement = value; OnPropertyChanged("RequiredBehaviorElement"); } } - private Code _RequiredBehaviorElement; + private Code? _RequiredBehaviorElement; /// /// must | could | must-unless-documented @@ -508,13 +487,10 @@ public Code RequiredBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior { - get { return RequiredBehaviorElement != null ? RequiredBehaviorElement.Value : null; } + get => _RequiredBehaviorElement?.Value; set { - if (value == null) - RequiredBehaviorElement = null; - else - RequiredBehaviorElement = new Code(value); + RequiredBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("RequiredBehavior"); } } @@ -526,13 +502,13 @@ public Hl7.Fhir.Model.ActionRequiredBehavior? RequiredBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionPrecheckBehavior")] [DataMember] - public Code PrecheckBehaviorElement + public Code? PrecheckBehaviorElement { get { return _PrecheckBehaviorElement; } set { _PrecheckBehaviorElement = value; OnPropertyChanged("PrecheckBehaviorElement"); } } - private Code _PrecheckBehaviorElement; + private Code? _PrecheckBehaviorElement; /// /// yes | no @@ -541,13 +517,10 @@ public Code PrecheckBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior { - get { return PrecheckBehaviorElement != null ? PrecheckBehaviorElement.Value : null; } + get => _PrecheckBehaviorElement?.Value; set { - if (value == null) - PrecheckBehaviorElement = null; - else - PrecheckBehaviorElement = new Code(value); + PrecheckBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("PrecheckBehavior"); } } @@ -559,13 +532,13 @@ public Hl7.Fhir.Model.ActionPrecheckBehavior? PrecheckBehavior [DeclaredType(Type = typeof(Code))] [Binding("ActionCardinalityBehavior")] [DataMember] - public Code CardinalityBehaviorElement + public Code? CardinalityBehaviorElement { get { return _CardinalityBehaviorElement; } set { _CardinalityBehaviorElement = value; OnPropertyChanged("CardinalityBehaviorElement"); } } - private Code _CardinalityBehaviorElement; + private Code? _CardinalityBehaviorElement; /// /// single | multiple @@ -574,13 +547,10 @@ public Code CardinalityBehaviorElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior { - get { return CardinalityBehaviorElement != null ? CardinalityBehaviorElement.Value : null; } + get => _CardinalityBehaviorElement?.Value; set { - if (value == null) - CardinalityBehaviorElement = null; - else - CardinalityBehaviorElement = new Code(value); + CardinalityBehaviorElement = value is null ? null : new Code(value); OnPropertyChanged("CardinalityBehavior"); } } @@ -592,13 +562,13 @@ public Hl7.Fhir.Model.ActionCardinalityBehavior? CardinalityBehavior [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; /// /// Description of the activity to be performed. @@ -607,41 +577,38 @@ public Hl7.Fhir.Model.ResourceReference Resource [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.FhirUri))] [DataMember] - public Hl7.Fhir.Model.DataType Definition + public Hl7.Fhir.Model.DataType? Definition { get { return _Definition; } set { _Definition = value; OnPropertyChanged("Definition"); } } - private Hl7.Fhir.Model.DataType _Definition; + private Hl7.Fhir.Model.DataType? _Definition; /// /// Transform to apply the template. /// [FhirElement("transform", Order=280)] [DataMember] - public Hl7.Fhir.Model.Canonical TransformElement + public Hl7.Fhir.Model.Canonical? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Hl7.Fhir.Model.Canonical _TransformElement; + private Hl7.Fhir.Model.Canonical? _TransformElement; /// /// Transform to apply the template /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Transform + public string? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Hl7.Fhir.Model.Canonical(value); + TransformElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Transform"); } } @@ -654,11 +621,11 @@ public string Transform [DataMember] public List DynamicValue { - get { if(_DynamicValue==null) _DynamicValue = new List(); return _DynamicValue; } + get => _DynamicValue ?? new List(); set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } - private List _DynamicValue; + private List? _DynamicValue; /// /// Sub action. @@ -668,49 +635,45 @@ public List DynamicVa [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as ActionComponent; - - if (dest == null) - { + if(other is not ActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)LinkIdElement.DeepCopyInternal(); - if(PrefixElement != null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)PrefixElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(TextEquivalentElement != null) dest.TextEquivalentElement = (Hl7.Fhir.Model.Markdown)TextEquivalentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Documentation.Any()) dest.Documentation = new List(Documentation.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); - if(RelatedAction.Any()) dest.RelatedAction = new List(RelatedAction.DeepCopyInternal()); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.CodeableReference)Location.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(GroupingBehaviorElement != null) dest.GroupingBehaviorElement = (Code)GroupingBehaviorElement.DeepCopyInternal(); - if(SelectionBehaviorElement != null) dest.SelectionBehaviorElement = (Code)SelectionBehaviorElement.DeepCopyInternal(); - if(RequiredBehaviorElement != null) dest.RequiredBehaviorElement = (Code)RequiredBehaviorElement.DeepCopyInternal(); - if(PrecheckBehaviorElement != null) dest.PrecheckBehaviorElement = (Code)PrecheckBehaviorElement.DeepCopyInternal(); - if(CardinalityBehaviorElement != null) dest.CardinalityBehaviorElement = (Code)CardinalityBehaviorElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); - if(Definition != null) dest.Definition = (Hl7.Fhir.Model.DataType)Definition.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)TransformElement.DeepCopyInternal(); - if(DynamicValue.Any()) dest.DynamicValue = new List(DynamicValue.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.FhirString)_LinkIdElement.DeepCopyInternal(); + if(_PrefixElement is not null) dest.PrefixElement = (Hl7.Fhir.Model.FhirString)_PrefixElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_TextEquivalentElement is not null) dest.TextEquivalentElement = (Hl7.Fhir.Model.Markdown)_TextEquivalentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Documentation is not null) dest.Documentation = new List(_Documentation.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); + if(_RelatedAction is not null) dest.RelatedAction = new List(_RelatedAction.DeepCopyInternal()); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.CodeableReference)_Location.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_GroupingBehaviorElement is not null) dest.GroupingBehaviorElement = (Code)_GroupingBehaviorElement.DeepCopyInternal(); + if(_SelectionBehaviorElement is not null) dest.SelectionBehaviorElement = (Code)_SelectionBehaviorElement.DeepCopyInternal(); + if(_RequiredBehaviorElement is not null) dest.RequiredBehaviorElement = (Code)_RequiredBehaviorElement.DeepCopyInternal(); + if(_PrecheckBehaviorElement is not null) dest.PrecheckBehaviorElement = (Code)_PrecheckBehaviorElement.DeepCopyInternal(); + if(_CardinalityBehaviorElement is not null) dest.CardinalityBehaviorElement = (Code)_CardinalityBehaviorElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); + if(_Definition is not null) dest.Definition = (Hl7.Fhir.Model.DataType)_Definition.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Hl7.Fhir.Model.Canonical)_TransformElement.DeepCopyInternal(); + if(_DynamicValue is not null) dest.DynamicValue = new List(_DynamicValue.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -722,216 +685,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ActionComponent; - if(otherT == null) return false; + if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(PrefixElement, otherT.PrefixElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(TextEquivalentElement, otherT.TextEquivalentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Documentation, otherT.Documentation)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; - if(!comparer.ListEquals(RelatedAction, otherT.RelatedAction)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(GroupingBehaviorElement, otherT.GroupingBehaviorElement)) return false; - if(!comparer.Equals(SelectionBehaviorElement, otherT.SelectionBehaviorElement)) return false; - if(!comparer.Equals(RequiredBehaviorElement, otherT.RequiredBehaviorElement)) return false; - if(!comparer.Equals(PrecheckBehaviorElement, otherT.PrecheckBehaviorElement)) return false; - if(!comparer.Equals(CardinalityBehaviorElement, otherT.CardinalityBehaviorElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; - if(!comparer.Equals(Definition, otherT.Definition)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(DynamicValue, otherT.DynamicValue)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; + if(!comparer.ListEquals(_RelatedAction, otherT._RelatedAction)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_GroupingBehaviorElement, otherT._GroupingBehaviorElement)) return false; + if(!comparer.Equals(_SelectionBehaviorElement, otherT._SelectionBehaviorElement)) return false; + if(!comparer.Equals(_RequiredBehaviorElement, otherT._RequiredBehaviorElement)) return false; + if(!comparer.Equals(_PrecheckBehaviorElement, otherT._PrecheckBehaviorElement)) return false; + if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; + if(!comparer.Equals(_Definition, otherT._Definition)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "prefix": - value = PrefixElement; - return PrefixElement is not null; + value = _PrefixElement; + return _PrefixElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "textEquivalent": - value = TextEquivalentElement; - return TextEquivalentElement is not null; + value = _TextEquivalentElement; + return _TextEquivalentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "documentation": - value = Documentation; - return Documentation?.Any() == true; + value = _Documentation; + return _Documentation?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; case "relatedAction": - value = RelatedAction; - return RelatedAction?.Any() == true; + value = _RelatedAction; + return _RelatedAction?.Any() == true; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "groupingBehavior": - value = GroupingBehaviorElement; - return GroupingBehaviorElement is not null; + value = _GroupingBehaviorElement; + return _GroupingBehaviorElement is not null; case "selectionBehavior": - value = SelectionBehaviorElement; - return SelectionBehaviorElement is not null; + value = _SelectionBehaviorElement; + return _SelectionBehaviorElement is not null; case "requiredBehavior": - value = RequiredBehaviorElement; - return RequiredBehaviorElement is not null; + value = _RequiredBehaviorElement; + return _RequiredBehaviorElement is not null; case "precheckBehavior": - value = PrecheckBehaviorElement; - return PrecheckBehaviorElement is not null; + value = _PrecheckBehaviorElement; + return _PrecheckBehaviorElement is not null; case "cardinalityBehavior": - value = CardinalityBehaviorElement; - return CardinalityBehaviorElement is not null; + value = _CardinalityBehaviorElement; + return _CardinalityBehaviorElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; case "definition": - value = Definition; - return Definition is not null; + value = _Definition; + return _Definition is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "dynamicValue": - value = DynamicValue; - return DynamicValue?.Any() == true; + value = _DynamicValue; + return _DynamicValue?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.FhirString)value; + LinkIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "prefix": - PrefixElement = (Hl7.Fhir.Model.FhirString)value; + PrefixElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "textEquivalent": - TextEquivalentElement = (Hl7.Fhir.Model.Markdown)value; + TextEquivalentElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "documentation": - Documentation = (List)value; + Documentation = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; case "relatedAction": - RelatedAction = (List)value; + RelatedAction = (List?)value!; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "location": - Location = (Hl7.Fhir.Model.CodeableReference)value; + Location = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "groupingBehavior": - GroupingBehaviorElement = (Code)value; + GroupingBehaviorElement = (Code?)value; return this; case "selectionBehavior": - SelectionBehaviorElement = (Code)value; + SelectionBehaviorElement = (Code?)value; return this; case "requiredBehavior": - RequiredBehaviorElement = (Code)value; + RequiredBehaviorElement = (Code?)value; return this; case "precheckBehavior": - PrecheckBehaviorElement = (Code)value; + PrecheckBehaviorElement = (Code?)value; return this; case "cardinalityBehavior": - CardinalityBehaviorElement = (Code)value; + CardinalityBehaviorElement = (Code?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "definition": - Definition = (Hl7.Fhir.Model.DataType)value; + Definition = (Hl7.Fhir.Model.DataType?)value; return this; case "transform": - TransformElement = (Hl7.Fhir.Model.Canonical)value; + TransformElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "dynamicValue": - DynamicValue = (List)value; + DynamicValue = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -942,33 +905,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (PrefixElement is not null) yield return new KeyValuePair("prefix",PrefixElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",TextEquivalentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Documentation?.Any() == true) yield return new KeyValuePair("documentation",Documentation); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); - if (RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",RelatedAction); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",GroupingBehaviorElement); - if (SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",SelectionBehaviorElement); - if (RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",RequiredBehaviorElement); - if (PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",PrecheckBehaviorElement); - if (CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",CardinalityBehaviorElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); - if (Definition is not null) yield return new KeyValuePair("definition",Definition); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",DynamicValue); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_PrefixElement is not null) yield return new KeyValuePair("prefix",_PrefixElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_TextEquivalentElement is not null) yield return new KeyValuePair("textEquivalent",_TextEquivalentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Documentation?.Any() == true) yield return new KeyValuePair("documentation",_Documentation); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); + if (_RelatedAction?.Any() == true) yield return new KeyValuePair("relatedAction",_RelatedAction); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_GroupingBehaviorElement is not null) yield return new KeyValuePair("groupingBehavior",_GroupingBehaviorElement); + if (_SelectionBehaviorElement is not null) yield return new KeyValuePair("selectionBehavior",_SelectionBehaviorElement); + if (_RequiredBehaviorElement is not null) yield return new KeyValuePair("requiredBehavior",_RequiredBehaviorElement); + if (_PrecheckBehaviorElement is not null) yield return new KeyValuePair("precheckBehavior",_PrecheckBehaviorElement); + if (_CardinalityBehaviorElement is not null) yield return new KeyValuePair("cardinalityBehavior",_CardinalityBehaviorElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); + if (_Definition is not null) yield return new KeyValuePair("definition",_Definition); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_DynamicValue?.Any() == true) yield return new KeyValuePair("dynamicValue",_DynamicValue); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -998,13 +961,13 @@ public partial class ConditionComponent : Hl7.Fhir.Model.BackboneElement [Binding("ActionConditionKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// applicability | start | stop @@ -1013,13 +976,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionConditionKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -1029,26 +989,22 @@ public Hl7.Fhir.Model.ActionConditionKind? Kind /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as ConditionComponent; - - if (dest == null) - { + if(other is not ConditionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1060,41 +1016,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConditionComponent; - if(otherT == null) return false; + if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -1105,8 +1061,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -1132,28 +1088,25 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1163,58 +1116,51 @@ public string Title /// [FhirElement("requirement", Order=50)] [DataMember] - public Hl7.Fhir.Model.DataRequirement Requirement + public Hl7.Fhir.Model.DataRequirement? Requirement { get { return _Requirement; } set { _Requirement = value; OnPropertyChanged("Requirement"); } } - private Hl7.Fhir.Model.DataRequirement _Requirement; + private Hl7.Fhir.Model.DataRequirement? _Requirement; /// /// What data is provided. /// [FhirElement("relatedData", Order=60)] [DataMember] - public Hl7.Fhir.Model.Id RelatedDataElement + public Hl7.Fhir.Model.Id? RelatedDataElement { get { return _RelatedDataElement; } set { _RelatedDataElement = value; OnPropertyChanged("RelatedDataElement"); } } - private Hl7.Fhir.Model.Id _RelatedDataElement; + private Hl7.Fhir.Model.Id? _RelatedDataElement; /// /// What data is provided /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelatedData + public string? RelatedData { - get { return RelatedDataElement != null ? RelatedDataElement.Value : null; } + get => _RelatedDataElement?.Value; set { - if (value == null) - RelatedDataElement = null; - else - RelatedDataElement = new Hl7.Fhir.Model.Id(value); + RelatedDataElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RelatedData"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Requirement != null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)Requirement.DeepCopyInternal(); - if(RelatedDataElement != null) dest.RelatedDataElement = (Hl7.Fhir.Model.Id)RelatedDataElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Requirement is not null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)_Requirement.DeepCopyInternal(); + if(_RelatedDataElement is not null) dest.RelatedDataElement = (Hl7.Fhir.Model.Id)_RelatedDataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1226,48 +1172,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Requirement, otherT.Requirement)) return false; - if(!comparer.Equals(RelatedDataElement, otherT.RelatedDataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; + if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "requirement": - value = Requirement; - return Requirement is not null; + value = _Requirement; + return _Requirement is not null; case "relatedData": - value = RelatedDataElement; - return RelatedDataElement is not null; + value = _RelatedDataElement; + return _RelatedDataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requirement": - Requirement = (Hl7.Fhir.Model.DataRequirement)value; + Requirement = (Hl7.Fhir.Model.DataRequirement?)value; return this; case "relatedData": - RelatedDataElement = (Hl7.Fhir.Model.Id)value; + RelatedDataElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -1278,9 +1224,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Requirement is not null) yield return new KeyValuePair("requirement",Requirement); - if (RelatedDataElement is not null) yield return new KeyValuePair("relatedData",RelatedDataElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Requirement is not null) yield return new KeyValuePair("requirement",_Requirement); + if (_RelatedDataElement is not null) yield return new KeyValuePair("relatedData",_RelatedDataElement); } } @@ -1306,28 +1252,25 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("title", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// User-visible title /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1337,58 +1280,51 @@ public string Title /// [FhirElement("requirement", Order=50)] [DataMember] - public Hl7.Fhir.Model.DataRequirement Requirement + public Hl7.Fhir.Model.DataRequirement? Requirement { get { return _Requirement; } set { _Requirement = value; OnPropertyChanged("Requirement"); } } - private Hl7.Fhir.Model.DataRequirement _Requirement; + private Hl7.Fhir.Model.DataRequirement? _Requirement; /// /// What data is provided. /// [FhirElement("relatedData", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString RelatedDataElement + public Hl7.Fhir.Model.FhirString? RelatedDataElement { get { return _RelatedDataElement; } set { _RelatedDataElement = value; OnPropertyChanged("RelatedDataElement"); } } - private Hl7.Fhir.Model.FhirString _RelatedDataElement; + private Hl7.Fhir.Model.FhirString? _RelatedDataElement; /// /// What data is provided /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RelatedData + public string? RelatedData { - get { return RelatedDataElement != null ? RelatedDataElement.Value : null; } + get => _RelatedDataElement?.Value; set { - if (value == null) - RelatedDataElement = null; - else - RelatedDataElement = new Hl7.Fhir.Model.FhirString(value); + RelatedDataElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RelatedData"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Requirement != null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)Requirement.DeepCopyInternal(); - if(RelatedDataElement != null) dest.RelatedDataElement = (Hl7.Fhir.Model.FhirString)RelatedDataElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Requirement is not null) dest.Requirement = (Hl7.Fhir.Model.DataRequirement)_Requirement.DeepCopyInternal(); + if(_RelatedDataElement is not null) dest.RelatedDataElement = (Hl7.Fhir.Model.FhirString)_RelatedDataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1400,48 +1336,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(Requirement, otherT.Requirement)) return false; - if(!comparer.Equals(RelatedDataElement, otherT.RelatedDataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; + if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "requirement": - value = Requirement; - return Requirement is not null; + value = _Requirement; + return _Requirement is not null; case "relatedData": - value = RelatedDataElement; - return RelatedDataElement is not null; + value = _RelatedDataElement; + return _RelatedDataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requirement": - Requirement = (Hl7.Fhir.Model.DataRequirement)value; + Requirement = (Hl7.Fhir.Model.DataRequirement?)value; return this; case "relatedData": - RelatedDataElement = (Hl7.Fhir.Model.FhirString)value; + RelatedDataElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1452,9 +1388,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Requirement is not null) yield return new KeyValuePair("requirement",Requirement); - if (RelatedDataElement is not null) yield return new KeyValuePair("relatedData",RelatedDataElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Requirement is not null) yield return new KeyValuePair("requirement",_Requirement); + if (_RelatedDataElement is not null) yield return new KeyValuePair("relatedData",_RelatedDataElement); } } @@ -1481,28 +1417,25 @@ public partial class RelatedActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("targetId", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id TargetIdElement + public Hl7.Fhir.Model.Id? TargetIdElement { get { return _TargetIdElement; } set { _TargetIdElement = value; OnPropertyChanged("TargetIdElement"); } } - private Hl7.Fhir.Model.Id _TargetIdElement; + private Hl7.Fhir.Model.Id? _TargetIdElement; /// /// What action this is related to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetId + public string? TargetId { - get { return TargetIdElement != null ? TargetIdElement.Value : null; } + get => _TargetIdElement?.Value; set { - if (value == null) - TargetIdElement = null; - else - TargetIdElement = new Hl7.Fhir.Model.Id(value); + TargetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("TargetId"); } } @@ -1515,13 +1448,13 @@ public string TargetId [Binding("ActionRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code RelationshipElement + public Code? RelationshipElement { get { return _RelationshipElement; } set { _RelationshipElement = value; OnPropertyChanged("RelationshipElement"); } } - private Code _RelationshipElement; + private Code? _RelationshipElement; /// /// before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end @@ -1530,13 +1463,10 @@ public Code RelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? Relationship { - get { return RelationshipElement != null ? RelationshipElement.Value : null; } + get => _RelationshipElement?.Value; set { - if (value == null) - RelationshipElement = null; - else - RelationshipElement = new Code(value); + RelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("Relationship"); } } @@ -1548,13 +1478,13 @@ public Hl7.Fhir.Model.ActionRelationshipType? Relationship [DeclaredType(Type = typeof(Code))] [Binding("ActionRelationshipType")] [DataMember] - public Code EndRelationshipElement + public Code? EndRelationshipElement { get { return _EndRelationshipElement; } set { _EndRelationshipElement = value; OnPropertyChanged("EndRelationshipElement"); } } - private Code _EndRelationshipElement; + private Code? _EndRelationshipElement; /// /// before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end @@ -1563,13 +1493,10 @@ public Code EndRelationshipElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionRelationshipType? EndRelationship { - get { return EndRelationshipElement != null ? EndRelationshipElement.Value : null; } + get => _EndRelationshipElement?.Value; set { - if (value == null) - EndRelationshipElement = null; - else - EndRelationshipElement = new Code(value); + EndRelationshipElement = value is null ? null : new Code(value); OnPropertyChanged("EndRelationship"); } } @@ -1581,28 +1508,24 @@ public Hl7.Fhir.Model.ActionRelationshipType? EndRelationship [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Offset + public Hl7.Fhir.Model.DataType? Offset { get { return _Offset; } set { _Offset = value; OnPropertyChanged("Offset"); } } - private Hl7.Fhir.Model.DataType _Offset; + private Hl7.Fhir.Model.DataType? _Offset; protected internal override void CopyToInternal(Base other) { - var dest = other as RelatedActionComponent; - - if (dest == null) - { + if(other is not RelatedActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TargetIdElement != null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)TargetIdElement.DeepCopyInternal(); - if(RelationshipElement != null) dest.RelationshipElement = (Code)RelationshipElement.DeepCopyInternal(); - if(EndRelationshipElement != null) dest.EndRelationshipElement = (Code)EndRelationshipElement.DeepCopyInternal(); - if(Offset != null) dest.Offset = (Hl7.Fhir.Model.DataType)Offset.DeepCopyInternal(); + if(_TargetIdElement is not null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)_TargetIdElement.DeepCopyInternal(); + if(_RelationshipElement is not null) dest.RelationshipElement = (Code)_RelationshipElement.DeepCopyInternal(); + if(_EndRelationshipElement is not null) dest.EndRelationshipElement = (Code)_EndRelationshipElement.DeepCopyInternal(); + if(_Offset is not null) dest.Offset = (Hl7.Fhir.Model.DataType)_Offset.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1614,55 +1537,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelatedActionComponent; - if(otherT == null) return false; + if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TargetIdElement, otherT.TargetIdElement)) return false; - if(!comparer.Equals(RelationshipElement, otherT.RelationshipElement)) return false; - if(!comparer.Equals(EndRelationshipElement, otherT.EndRelationshipElement)) return false; - if(!comparer.Equals(Offset, otherT.Offset)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; + if(!comparer.Equals(_EndRelationshipElement, otherT._EndRelationshipElement)) return false; + if(!comparer.Equals(_Offset, otherT._Offset)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "targetId": - value = TargetIdElement; - return TargetIdElement is not null; + value = _TargetIdElement; + return _TargetIdElement is not null; case "relationship": - value = RelationshipElement; - return RelationshipElement is not null; + value = _RelationshipElement; + return _RelationshipElement is not null; case "endRelationship": - value = EndRelationshipElement; - return EndRelationshipElement is not null; + value = _EndRelationshipElement; + return _EndRelationshipElement is not null; case "offset": - value = Offset; - return Offset is not null; + value = _Offset; + return _Offset is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "targetId": - TargetIdElement = (Hl7.Fhir.Model.Id)value; + TargetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "relationship": - RelationshipElement = (Code)value; + RelationshipElement = (Code?)value; return this; case "endRelationship": - EndRelationshipElement = (Code)value; + EndRelationshipElement = (Code?)value; return this; case "offset": - Offset = (Hl7.Fhir.Model.DataType)value; + Offset = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1673,10 +1596,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TargetIdElement is not null) yield return new KeyValuePair("targetId",TargetIdElement); - if (RelationshipElement is not null) yield return new KeyValuePair("relationship",RelationshipElement); - if (EndRelationshipElement is not null) yield return new KeyValuePair("endRelationship",EndRelationshipElement); - if (Offset is not null) yield return new KeyValuePair("offset",Offset); + if (_TargetIdElement is not null) yield return new KeyValuePair("targetId",_TargetIdElement); + if (_RelationshipElement is not null) yield return new KeyValuePair("relationship",_RelationshipElement); + if (_EndRelationshipElement is not null) yield return new KeyValuePair("endRelationship",_EndRelationshipElement); + if (_Offset is not null) yield return new KeyValuePair("offset",_Offset); } } @@ -1705,13 +1628,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DeclaredType(Type = typeof(Code))] [Binding("ActivityParticipantType")] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson @@ -1720,13 +1643,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.ActionParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -1736,28 +1656,25 @@ public Hl7.Fhir.Model.ActionParticipantType? Type /// [FhirElement("typeCanonical", Order=50)] [DataMember] - public Hl7.Fhir.Model.Canonical TypeCanonicalElement + public Hl7.Fhir.Model.Canonical? TypeCanonicalElement { get { return _TypeCanonicalElement; } set { _TypeCanonicalElement = value; OnPropertyChanged("TypeCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _TypeCanonicalElement; + private Hl7.Fhir.Model.Canonical? _TypeCanonicalElement; /// /// Who or what can participate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TypeCanonical + public string? TypeCanonical { - get { return TypeCanonicalElement != null ? TypeCanonicalElement.Value : null; } + get => _TypeCanonicalElement?.Value; set { - if (value == null) - TypeCanonicalElement = null; - else - TypeCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + TypeCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("TypeCanonical"); } } @@ -1769,13 +1686,13 @@ public string TypeCanonical [CLSCompliant(false)] [References("CareTeam","Device","DeviceDefinition","Endpoint","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference TypeReference + public Hl7.Fhir.Model.ResourceReference? TypeReference { get { return _TypeReference; } set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } - private Hl7.Fhir.Model.ResourceReference _TypeReference; + private Hl7.Fhir.Model.ResourceReference? _TypeReference; /// /// E.g. Nurse, Surgeon, Parent, etc. @@ -1783,13 +1700,13 @@ public Hl7.Fhir.Model.ResourceReference TypeReference [FhirElement("role", Order=70)] [Binding("ActivityParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// E.g. Author, Reviewer, Witness, etc. @@ -1797,13 +1714,13 @@ public Hl7.Fhir.Model.CodeableConcept Role [FhirElement("function", Order=80)] [Binding("ActionParticipantFunction")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who/what is participating?. @@ -1813,30 +1730,26 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("CareTeam","Device","DeviceDefinition","Endpoint","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [AllowedTypes(typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Actor + public Hl7.Fhir.Model.DataType? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.DataType _Actor; + private Hl7.Fhir.Model.DataType? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(TypeCanonicalElement != null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)TypeCanonicalElement.DeepCopyInternal(); - if(TypeReference != null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)TypeReference.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.DataType)Actor.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_TypeCanonicalElement is not null) dest.TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)_TypeCanonicalElement.DeepCopyInternal(); + if(_TypeReference is not null) dest.TypeReference = (Hl7.Fhir.Model.ResourceReference)_TypeReference.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.DataType)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1848,69 +1761,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(TypeCanonicalElement, otherT.TypeCanonicalElement)) return false; - if(!comparer.Equals(TypeReference, otherT.TypeReference)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; + if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "typeCanonical": - value = TypeCanonicalElement; - return TypeCanonicalElement is not null; + value = _TypeCanonicalElement; + return _TypeCanonicalElement is not null; case "typeReference": - value = TypeReference; - return TypeReference is not null; + value = _TypeReference; + return _TypeReference is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "typeCanonical": - TypeCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + TypeCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "typeReference": - TypeReference = (Hl7.Fhir.Model.ResourceReference)value; + TypeReference = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.DataType)value; + Actor = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1921,12 +1834,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",TypeCanonicalElement); - if (TypeReference is not null) yield return new KeyValuePair("typeReference",TypeReference); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_TypeCanonicalElement is not null) yield return new KeyValuePair("typeCanonical",_TypeCanonicalElement); + if (_TypeReference is not null) yield return new KeyValuePair("typeReference",_TypeReference); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -1953,28 +1866,25 @@ public partial class DynamicValueComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("path", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// The path to the element to be set dynamically /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -1984,26 +1894,22 @@ public string Path /// [FhirElement("expression", Order=50)] [DataMember] - public Hl7.Fhir.Model.Expression Expression + public Hl7.Fhir.Model.Expression? Expression { get { return _Expression; } set { _Expression = value; OnPropertyChanged("Expression"); } } - private Hl7.Fhir.Model.Expression _Expression; + private Hl7.Fhir.Model.Expression? _Expression; protected internal override void CopyToInternal(Base other) { - var dest = other as DynamicValueComponent; - - if (dest == null) - { + if(other is not DynamicValueComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(Expression != null) dest.Expression = (Hl7.Fhir.Model.Expression)Expression.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_Expression is not null) dest.Expression = (Hl7.Fhir.Model.Expression)_Expression.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2015,41 +1921,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DynamicValueComponent; - if(otherT == null) return false; + if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(Expression, otherT.Expression)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_Expression, otherT._Expression)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "expression": - value = Expression; - return Expression is not null; + value = _Expression; + return _Expression is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - Expression = (Hl7.Fhir.Model.Expression)value; + Expression = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -2060,8 +1966,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (Expression is not null) yield return new KeyValuePair("expression",Expression); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_Expression is not null) yield return new KeyValuePair("expression",_Expression); } } @@ -2074,11 +1980,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -2088,24 +1994,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -2120,24 +2026,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -2154,11 +2060,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Request(s) replaced by this request. @@ -2170,24 +2076,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite request this is part of. /// [FhirElement("groupIdentifier", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -2197,13 +2103,13 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [Binding("RequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -2212,13 +2118,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2231,13 +2134,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("RequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option @@ -2246,13 +2149,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -2264,13 +2164,13 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -2279,13 +2179,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -2296,13 +2193,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [FhirElement("code", InSummary=true, Order=180, FiveWs="FiveWs.what[x]")] [Binding("RequestCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who the request orchestration is about. @@ -2311,13 +2208,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [References("CareTeam","Device","Group","HealthcareService","Location","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Created as part of. @@ -2326,41 +2223,38 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the request orchestration was authored. /// [FhirElement("authoredOn", Order=210, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request orchestration was authored /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -2372,13 +2266,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Device","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Author + public Hl7.Fhir.Model.ResourceReference? Author { get { return _Author; } set { _Author = value; OnPropertyChanged("Author"); } } - private Hl7.Fhir.Model.ResourceReference _Author; + private Hl7.Fhir.Model.ResourceReference? _Author; /// /// Why the request orchestration is needed. @@ -2389,11 +2283,11 @@ public Hl7.Fhir.Model.ResourceReference Author [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// What goals. @@ -2405,11 +2299,11 @@ public List Reason [DataMember] public List Goal { - get { if(_Goal==null) _Goal = new List(); return _Goal; } + get => _Goal ?? new List(); set { _Goal = value; OnPropertyChanged("Goal"); } } - private List _Goal; + private List? _Goal; /// /// Additional notes about the response. @@ -2419,11 +2313,11 @@ public List Goal [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Proposed actions, if any. @@ -2433,42 +2327,38 @@ public List Note [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestOrchestration; - - if (dest == null) - { + if(other is not RequestOrchestration dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Author != null) dest.Author = (Hl7.Fhir.Model.ResourceReference)Author.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Goal.Any()) dest.Goal = new List(Goal.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = (Hl7.Fhir.Model.ResourceReference)_Author.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Goal is not null) dest.Goal = new List(_Goal.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2480,153 +2370,153 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestOrchestration; - if(otherT == null) return false; + if(other is not RequestOrchestration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Author, otherT.Author)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Goal, otherT.Goal)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Author, otherT._Author)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "author": - value = Author; - return Author is not null; + value = _Author; + return _Author is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "goal": - value = Goal; - return Goal?.Any() == true; + value = _Goal; + return _Goal?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "author": - Author = (Hl7.Fhir.Model.ResourceReference)value; + Author = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "goal": - Goal = (List)value; + Goal = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2637,24 +2527,24 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Author is not null) yield return new KeyValuePair("author",Author); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Goal?.Any() == true) yield return new KeyValuePair("goal",Goal); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Author is not null) yield return new KeyValuePair("author",_Author); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Goal?.Any() == true) yield return new KeyValuePair("goal",_Goal); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs index 30604c06f..7061dd19c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -115,28 +118,25 @@ public partial class StatementComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("key", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id KeyElement + public Hl7.Fhir.Model.Id? KeyElement { get { return _KeyElement; } set { _KeyElement = value; OnPropertyChanged("KeyElement"); } } - private Hl7.Fhir.Model.Id _KeyElement; + private Hl7.Fhir.Model.Id? _KeyElement; /// /// Key that identifies this statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Key + public string? Key { - get { return KeyElement != null ? KeyElement.Value : null; } + get => _KeyElement?.Value; set { - if (value == null) - KeyElement = null; - else - KeyElement = new Hl7.Fhir.Model.Id(value); + KeyElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Key"); } } @@ -146,28 +146,25 @@ public string Key /// [FhirElement("label", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Short Human label for this statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -182,24 +179,24 @@ public string Label [DataMember] public List> ConformanceElement { - get { if(_ConformanceElement==null) _ConformanceElement = new List>(); return _ConformanceElement; } + get => _ConformanceElement ?? new List>(); set { _ConformanceElement = value; OnPropertyChanged("ConformanceElement"); } } - private List> _ConformanceElement; + private List>? _ConformanceElement; /// /// SHALL | SHOULD | MAY | SHOULD-NOT /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Conformance + public IEnumerable? Conformance { - get { return ConformanceElement != null ? ConformanceElement.Select(elem => elem.Value) : null; } + get => _ConformanceElement?.Select(elem => elem.Value); set { if (value == null) - ConformanceElement = null; + ConformanceElement = null!; else ConformanceElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Conformance"); @@ -211,13 +208,13 @@ public IEnumerable Conforma /// [FhirElement("conditionality", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ConditionalityElement + public Hl7.Fhir.Model.FhirBoolean? ConditionalityElement { get { return _ConditionalityElement; } set { _ConditionalityElement = value; OnPropertyChanged("ConditionalityElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ConditionalityElement; + private Hl7.Fhir.Model.FhirBoolean? _ConditionalityElement; /// /// Set to true if requirements statement is conditional @@ -226,13 +223,10 @@ public Hl7.Fhir.Model.FhirBoolean ConditionalityElement [IgnoreDataMember] public bool? Conditionality { - get { return ConditionalityElement != null ? ConditionalityElement.Value : null; } + get => _ConditionalityElement?.Value; set { - if (value == null) - ConditionalityElement = null; - else - ConditionalityElement = new Hl7.Fhir.Model.FhirBoolean(value); + ConditionalityElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Conditionality"); } } @@ -243,28 +237,25 @@ public bool? Conditionality [FhirElement("requirement", Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown RequirementElement + public Hl7.Fhir.Model.Markdown? RequirementElement { get { return _RequirementElement; } set { _RequirementElement = value; OnPropertyChanged("RequirementElement"); } } - private Hl7.Fhir.Model.Markdown _RequirementElement; + private Hl7.Fhir.Model.Markdown? _RequirementElement; /// /// The actual requirement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirement + public string? Requirement { - get { return RequirementElement != null ? RequirementElement.Value : null; } + get => _RequirementElement?.Value; set { - if (value == null) - RequirementElement = null; - else - RequirementElement = new Hl7.Fhir.Model.Markdown(value); + RequirementElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Requirement"); } } @@ -274,28 +265,25 @@ public string Requirement /// [FhirElement("derivedFrom", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DerivedFromElement + public Hl7.Fhir.Model.FhirString? DerivedFromElement { get { return _DerivedFromElement; } set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private Hl7.Fhir.Model.FhirString _DerivedFromElement; + private Hl7.Fhir.Model.FhirString? _DerivedFromElement; /// /// Another statement this clarifies/restricts ([url#]key) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DerivedFrom + public string? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Value : null; } + get => _DerivedFromElement?.Value; set { - if (value == null) - DerivedFromElement = null; - else - DerivedFromElement = new Hl7.Fhir.Model.FhirString(value); + DerivedFromElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DerivedFrom"); } } @@ -305,28 +293,25 @@ public string DerivedFrom /// [FhirElement("parent", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString ParentElement + public Hl7.Fhir.Model.FhirString? ParentElement { get { return _ParentElement; } set { _ParentElement = value; OnPropertyChanged("ParentElement"); } } - private Hl7.Fhir.Model.FhirString _ParentElement; + private Hl7.Fhir.Model.FhirString? _ParentElement; /// /// A larger requirement that this requirement helps to refine and enable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Parent + public string? Parent { - get { return ParentElement != null ? ParentElement.Value : null; } + get => _ParentElement?.Value; set { - if (value == null) - ParentElement = null; - else - ParentElement = new Hl7.Fhir.Model.FhirString(value); + ParentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Parent"); } } @@ -339,24 +324,24 @@ public string Parent [DataMember] public List SatisfiedByElement { - get { if(_SatisfiedByElement==null) _SatisfiedByElement = new List(); return _SatisfiedByElement; } + get => _SatisfiedByElement ?? new List(); set { _SatisfiedByElement = value; OnPropertyChanged("SatisfiedByElement"); } } - private List _SatisfiedByElement; + private List? _SatisfiedByElement; /// /// Design artifact that satisfies this requirement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SatisfiedBy + public IEnumerable? SatisfiedBy { - get { return SatisfiedByElement != null ? SatisfiedByElement.Select(elem => elem.Value) : null; } + get => _SatisfiedByElement?.Select(elem => elem.Value); set { if (value == null) - SatisfiedByElement = null; + SatisfiedByElement = null!; else SatisfiedByElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUrl(elem))); OnPropertyChanged("SatisfiedBy"); @@ -371,24 +356,24 @@ public IEnumerable SatisfiedBy [DataMember] public List ReferenceElement { - get { if(_ReferenceElement==null) _ReferenceElement = new List(); return _ReferenceElement; } + get => _ReferenceElement ?? new List(); set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private List _ReferenceElement; + private List? _ReferenceElement; /// /// External artifact (rule/document etc. that) created this requirement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Reference + public IEnumerable? Reference { - get { return ReferenceElement != null ? ReferenceElement.Select(elem => elem.Value) : null; } + get => _ReferenceElement?.Select(elem => elem.Value); set { if (value == null) - ReferenceElement = null; + ReferenceElement = null!; else ReferenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUrl(elem))); OnPropertyChanged("Reference"); @@ -405,32 +390,28 @@ public IEnumerable Reference [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as StatementComponent; - - if (dest == null) - { + if(other is not StatementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(KeyElement != null) dest.KeyElement = (Hl7.Fhir.Model.Id)KeyElement.DeepCopyInternal(); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(ConformanceElement.Any()) dest.ConformanceElement = new List>(ConformanceElement.DeepCopyInternal()); - if(ConditionalityElement != null) dest.ConditionalityElement = (Hl7.Fhir.Model.FhirBoolean)ConditionalityElement.DeepCopyInternal(); - if(RequirementElement != null) dest.RequirementElement = (Hl7.Fhir.Model.Markdown)RequirementElement.DeepCopyInternal(); - if(DerivedFromElement != null) dest.DerivedFromElement = (Hl7.Fhir.Model.FhirString)DerivedFromElement.DeepCopyInternal(); - if(ParentElement != null) dest.ParentElement = (Hl7.Fhir.Model.FhirString)ParentElement.DeepCopyInternal(); - if(SatisfiedByElement.Any()) dest.SatisfiedByElement = new List(SatisfiedByElement.DeepCopyInternal()); - if(ReferenceElement.Any()) dest.ReferenceElement = new List(ReferenceElement.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_KeyElement is not null) dest.KeyElement = (Hl7.Fhir.Model.Id)_KeyElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_ConformanceElement is not null) dest.ConformanceElement = new List>(_ConformanceElement.DeepCopyInternal()); + if(_ConditionalityElement is not null) dest.ConditionalityElement = (Hl7.Fhir.Model.FhirBoolean)_ConditionalityElement.DeepCopyInternal(); + if(_RequirementElement is not null) dest.RequirementElement = (Hl7.Fhir.Model.Markdown)_RequirementElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = (Hl7.Fhir.Model.FhirString)_DerivedFromElement.DeepCopyInternal(); + if(_ParentElement is not null) dest.ParentElement = (Hl7.Fhir.Model.FhirString)_ParentElement.DeepCopyInternal(); + if(_SatisfiedByElement is not null) dest.SatisfiedByElement = new List(_SatisfiedByElement.DeepCopyInternal()); + if(_ReferenceElement is not null) dest.ReferenceElement = new List(_ReferenceElement.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -442,97 +423,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StatementComponent; - if(otherT == null) return false; + if(other is not StatementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(KeyElement, otherT.KeyElement)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.ListEquals(ConformanceElement, otherT.ConformanceElement)) return false; - if(!comparer.Equals(ConditionalityElement, otherT.ConditionalityElement)) return false; - if(!comparer.Equals(RequirementElement, otherT.RequirementElement)) return false; - if(!comparer.Equals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(ParentElement, otherT.ParentElement)) return false; - if(!comparer.ListEquals(SatisfiedByElement, otherT.SatisfiedByElement)) return false; - if(!comparer.ListEquals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.ListEquals(_ConformanceElement, otherT._ConformanceElement)) return false; + if(!comparer.Equals(_ConditionalityElement, otherT._ConditionalityElement)) return false; + if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; + if(!comparer.Equals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_ParentElement, otherT._ParentElement)) return false; + if(!comparer.ListEquals(_SatisfiedByElement, otherT._SatisfiedByElement)) return false; + if(!comparer.ListEquals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "key": - value = KeyElement; - return KeyElement is not null; + value = _KeyElement; + return _KeyElement is not null; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "conformance": - value = ConformanceElement; - return ConformanceElement?.Any() == true; + value = _ConformanceElement; + return _ConformanceElement?.Any() == true; case "conditionality": - value = ConditionalityElement; - return ConditionalityElement is not null; + value = _ConditionalityElement; + return _ConditionalityElement is not null; case "requirement": - value = RequirementElement; - return RequirementElement is not null; + value = _RequirementElement; + return _RequirementElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement is not null; + value = _DerivedFromElement; + return _DerivedFromElement is not null; case "parent": - value = ParentElement; - return ParentElement is not null; + value = _ParentElement; + return _ParentElement is not null; case "satisfiedBy": - value = SatisfiedByElement; - return SatisfiedByElement?.Any() == true; + value = _SatisfiedByElement; + return _SatisfiedByElement?.Any() == true; case "reference": - value = ReferenceElement; - return ReferenceElement?.Any() == true; + value = _ReferenceElement; + return _ReferenceElement?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "key": - KeyElement = (Hl7.Fhir.Model.Id)value; + KeyElement = (Hl7.Fhir.Model.Id?)value; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "conformance": - ConformanceElement = (List>)value; + ConformanceElement = (List>?)value!; return this; case "conditionality": - ConditionalityElement = (Hl7.Fhir.Model.FhirBoolean)value; + ConditionalityElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "requirement": - RequirementElement = (Hl7.Fhir.Model.Markdown)value; + RequirementElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "derivedFrom": - DerivedFromElement = (Hl7.Fhir.Model.FhirString)value; + DerivedFromElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "parent": - ParentElement = (Hl7.Fhir.Model.FhirString)value; + ParentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "satisfiedBy": - SatisfiedByElement = (List)value; + SatisfiedByElement = (List?)value!; return this; case "reference": - ReferenceElement = (List)value; + ReferenceElement = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -543,16 +524,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (KeyElement is not null) yield return new KeyValuePair("key",KeyElement); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (ConformanceElement?.Any() == true) yield return new KeyValuePair("conformance",ConformanceElement); - if (ConditionalityElement is not null) yield return new KeyValuePair("conditionality",ConditionalityElement); - if (RequirementElement is not null) yield return new KeyValuePair("requirement",RequirementElement); - if (DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (ParentElement is not null) yield return new KeyValuePair("parent",ParentElement); - if (SatisfiedByElement?.Any() == true) yield return new KeyValuePair("satisfiedBy",SatisfiedByElement); - if (ReferenceElement?.Any() == true) yield return new KeyValuePair("reference",ReferenceElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_KeyElement is not null) yield return new KeyValuePair("key",_KeyElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_ConformanceElement?.Any() == true) yield return new KeyValuePair("conformance",_ConformanceElement); + if (_ConditionalityElement is not null) yield return new KeyValuePair("conditionality",_ConditionalityElement); + if (_RequirementElement is not null) yield return new KeyValuePair("requirement",_RequirementElement); + if (_DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_ParentElement is not null) yield return new KeyValuePair("parent",_ParentElement); + if (_SatisfiedByElement?.Any() == true) yield return new KeyValuePair("satisfiedBy",_SatisfiedByElement); + if (_ReferenceElement?.Any() == true) yield return new KeyValuePair("reference",_ReferenceElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -562,28 +543,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this Requirements, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -596,39 +574,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the Requirements. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the Requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -640,41 +615,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this Requirements (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this Requirements (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -684,28 +656,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this Requirements (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -718,13 +687,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -733,13 +702,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -749,13 +715,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -764,13 +730,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -780,28 +743,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -811,28 +771,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -845,39 +802,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the requirements. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -890,11 +844,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for Requirements (if applicable). @@ -905,39 +859,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this Requirements is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this Requirements is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -947,28 +898,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -978,28 +926,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1012,24 +957,24 @@ public string CopyrightLabel [DataMember] public List DerivedFromElement { - get { if(_DerivedFromElement==null) _DerivedFromElement = new List(); return _DerivedFromElement; } + get => _DerivedFromElement ?? new List(); set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private List _DerivedFromElement; + private List? _DerivedFromElement; /// /// Other set of Requirements this builds on /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFrom + public IEnumerable? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Select(elem => elem.Value) : null; } + get => _DerivedFromElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromElement = null; + DerivedFromElement = null!; else DerivedFromElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFrom"); @@ -1044,24 +989,24 @@ public IEnumerable DerivedFrom [DataMember] public List ReferenceElement { - get { if(_ReferenceElement==null) _ReferenceElement = new List(); return _ReferenceElement; } + get => _ReferenceElement ?? new List(); set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } - private List _ReferenceElement; + private List? _ReferenceElement; /// /// External artifact (rule/document etc. that) created this set of requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Reference + public IEnumerable? Reference { - get { return ReferenceElement != null ? ReferenceElement.Select(elem => elem.Value) : null; } + get => _ReferenceElement?.Select(elem => elem.Value); set { if (value == null) - ReferenceElement = null; + ReferenceElement = null!; else ReferenceElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUrl(elem))); OnPropertyChanged("Reference"); @@ -1076,24 +1021,24 @@ public IEnumerable Reference [DataMember] public List ActorElement { - get { if(_ActorElement==null) _ActorElement = new List(); return _ActorElement; } + get => _ActorElement ?? new List(); set { _ActorElement = value; OnPropertyChanged("ActorElement"); } } - private List _ActorElement; + private List? _ActorElement; /// /// Actor for these requirements /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Actor + public IEnumerable? Actor { - get { return ActorElement != null ? ActorElement.Select(elem => elem.Value) : null; } + get => _ActorElement?.Select(elem => elem.Value); set { if (value == null) - ActorElement = null; + ActorElement = null!; else ActorElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Actor"); @@ -1108,45 +1053,41 @@ public IEnumerable Actor [DataMember] public List Statement { - get { if(_Statement==null) _Statement = new List(); return _Statement; } + get => _Statement ?? new List(); set { _Statement = value; OnPropertyChanged("Statement"); } } - private List _Statement; + private List? _Statement; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Requirements; - - if (dest == null) - { + if(other is not Requirements dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(DerivedFromElement.Any()) dest.DerivedFromElement = new List(DerivedFromElement.DeepCopyInternal()); - if(ReferenceElement.Any()) dest.ReferenceElement = new List(ReferenceElement.DeepCopyInternal()); - if(ActorElement.Any()) dest.ActorElement = new List(ActorElement.DeepCopyInternal()); - if(Statement.Any()) dest.Statement = new List(Statement.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = new List(_DerivedFromElement.DeepCopyInternal()); + if(_ReferenceElement is not null) dest.ReferenceElement = new List(_ReferenceElement.DeepCopyInternal()); + if(_ActorElement is not null) dest.ActorElement = new List(_ActorElement.DeepCopyInternal()); + if(_Statement is not null) dest.Statement = new List(_Statement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1158,174 +1099,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Requirements; - if(otherT == null) return false; + if(other is not Requirements otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.ListEquals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.ListEquals(ReferenceElement, otherT.ReferenceElement)) return false; - if(!comparer.ListEquals(ActorElement, otherT.ActorElement)) return false; - if(!comparer.ListEquals(Statement, otherT.Statement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.ListEquals(_ReferenceElement, otherT._ReferenceElement)) return false; + if(!comparer.ListEquals(_ActorElement, otherT._ActorElement)) return false; + if(!comparer.ListEquals(_Statement, otherT._Statement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement?.Any() == true; + value = _DerivedFromElement; + return _DerivedFromElement?.Any() == true; case "reference": - value = ReferenceElement; - return ReferenceElement?.Any() == true; + value = _ReferenceElement; + return _ReferenceElement?.Any() == true; case "actor": - value = ActorElement; - return ActorElement?.Any() == true; + value = _ActorElement; + return _ActorElement?.Any() == true; case "statement": - value = Statement; - return Statement?.Any() == true; + value = _Statement; + return _Statement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (List)value; + DerivedFromElement = (List?)value!; return this; case "reference": - ReferenceElement = (List)value; + ReferenceElement = (List?)value!; return this; case "actor": - ActorElement = (List)value; + ActorElement = (List?)value!; return this; case "statement": - Statement = (List)value; + Statement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1336,27 +1277,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (ReferenceElement?.Any() == true) yield return new KeyValuePair("reference",ReferenceElement); - if (ActorElement?.Any() == true) yield return new KeyValuePair("actor",ActorElement); - if (Statement?.Any() == true) yield return new KeyValuePair("statement",Statement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_ReferenceElement?.Any() == true) yield return new KeyValuePair("reference",_ReferenceElement); + if (_ActorElement?.Any() == true) yield return new KeyValuePair("actor",_ActorElement); + if (_Statement?.Any() == true) yield return new KeyValuePair("statement",_Statement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs index 33b1d0741..25d759c5d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -79,57 +82,50 @@ public partial class LabelComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("TitleType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The name. /// [FhirElement("value", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LabelComponent; - - if (dest == null) - { + if(other is not LabelComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -141,41 +137,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LabelComponent; - if(otherT == null) return false; + if(other is not LabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -186,8 +182,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -213,28 +209,25 @@ public partial class AssociatedPartyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name of associated party /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -246,13 +239,13 @@ public string Name [Binding("ResearchStudyPartyRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// When active in the role. @@ -262,11 +255,11 @@ public Hl7.Fhir.Model.CodeableConcept Role [DataMember] public List Period { - get { if(_Period==null) _Period = new List(); return _Period; } + get => _Period ?? new List(); set { _Period = value; OnPropertyChanged("Period"); } } - private List _Period; + private List? _Period; /// /// nih | fda | government | nonprofit | academic | industry. @@ -277,11 +270,11 @@ public List Period [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// Individual or organization associated with study (use practitionerRole to specify their organisation). @@ -290,29 +283,25 @@ public List Classifier [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Party + public Hl7.Fhir.Model.ResourceReference? Party { get { return _Party; } set { _Party = value; OnPropertyChanged("Party"); } } - private Hl7.Fhir.Model.ResourceReference _Party; + private Hl7.Fhir.Model.ResourceReference? _Party; protected internal override void CopyToInternal(Base other) { - var dest = other as AssociatedPartyComponent; - - if (dest == null) - { + if(other is not AssociatedPartyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Period.Any()) dest.Period = new List(Period.DeepCopyInternal()); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(Party != null) dest.Party = (Hl7.Fhir.Model.ResourceReference)Party.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Period is not null) dest.Period = new List(_Period.DeepCopyInternal()); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_Party is not null) dest.Party = (Hl7.Fhir.Model.ResourceReference)_Party.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -324,62 +313,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssociatedPartyComponent; - if(otherT == null) return false; + if(other is not AssociatedPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.ListEquals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.Equals(Party, otherT.Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.ListEquals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.Equals(_Party, otherT._Party)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "period": - value = Period; - return Period?.Any() == true; + value = _Period; + return _Period?.Any() == true; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "party": - value = Party; - return Party is not null; + value = _Party; + return _Party is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "period": - Period = (List)value; + Period = (List?)value!; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "party": - Party = (Hl7.Fhir.Model.ResourceReference)value; + Party = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -390,11 +379,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Period?.Any() == true) yield return new KeyValuePair("period",Period); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (Party is not null) yield return new KeyValuePair("party",Party); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Period?.Any() == true) yield return new KeyValuePair("period",_Period); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_Party is not null) yield return new KeyValuePair("party",_Party); } } @@ -419,26 +408,26 @@ public partial class ProgressStatusComponent : Hl7.Fhir.Model.BackboneElement [Binding("ResearchStudyStudyStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept State + public Hl7.Fhir.Model.CodeableConcept? State { get { return _State; } set { _State = value; OnPropertyChanged("State"); } } - private Hl7.Fhir.Model.CodeableConcept _State; + private Hl7.Fhir.Model.CodeableConcept? _State; /// /// Actual if true else anticipated. /// [FhirElement("actual", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActualElement + public Hl7.Fhir.Model.FhirBoolean? ActualElement { get { return _ActualElement; } set { _ActualElement = value; OnPropertyChanged("ActualElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActualElement; + private Hl7.Fhir.Model.FhirBoolean? _ActualElement; /// /// Actual if true else anticipated @@ -447,13 +436,10 @@ public Hl7.Fhir.Model.FhirBoolean ActualElement [IgnoreDataMember] public bool? Actual { - get { return ActualElement != null ? ActualElement.Value : null; } + get => _ActualElement?.Value; set { - if (value == null) - ActualElement = null; - else - ActualElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActualElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Actual"); } } @@ -463,27 +449,23 @@ public bool? Actual /// [FhirElement("period", Order=60)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; protected internal override void CopyToInternal(Base other) { - var dest = other as ProgressStatusComponent; - - if (dest == null) - { + if(other is not ProgressStatusComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(State != null) dest.State = (Hl7.Fhir.Model.CodeableConcept)State.DeepCopyInternal(); - if(ActualElement != null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)ActualElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); + if(_State is not null) dest.State = (Hl7.Fhir.Model.CodeableConcept)_State.DeepCopyInternal(); + if(_ActualElement is not null) dest.ActualElement = (Hl7.Fhir.Model.FhirBoolean)_ActualElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -495,48 +477,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProgressStatusComponent; - if(otherT == null) return false; + if(other is not ProgressStatusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(State, otherT.State)) return false; - if(!comparer.Equals(ActualElement, otherT.ActualElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_State, otherT._State)) return false; + if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "state": - value = State; - return State is not null; + value = _State; + return _State is not null; case "actual": - value = ActualElement; - return ActualElement is not null; + value = _ActualElement; + return _ActualElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "state": - State = (Hl7.Fhir.Model.CodeableConcept)value; + State = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actual": - ActualElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActualElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; default: return base.SetValue(key, value); @@ -547,9 +529,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (State is not null) yield return new KeyValuePair("state",State); - if (ActualElement is not null) yield return new KeyValuePair("actual",ActualElement); - if (Period is not null) yield return new KeyValuePair("period",Period); + if (_State is not null) yield return new KeyValuePair("state",_State); + if (_ActualElement is not null) yield return new KeyValuePair("actual",_ActualElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); } } @@ -572,13 +554,13 @@ public partial class RecruitmentComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("targetNumber", Order=40)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt TargetNumberElement + public Hl7.Fhir.Model.UnsignedInt? TargetNumberElement { get { return _TargetNumberElement; } set { _TargetNumberElement = value; OnPropertyChanged("TargetNumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _TargetNumberElement; + private Hl7.Fhir.Model.UnsignedInt? _TargetNumberElement; /// /// Estimated total number of participants to be enrolled @@ -587,13 +569,10 @@ public Hl7.Fhir.Model.UnsignedInt TargetNumberElement [IgnoreDataMember] public int? TargetNumber { - get { return TargetNumberElement != null ? TargetNumberElement.Value : null; } + get => _TargetNumberElement?.Value; set { - if (value == null) - TargetNumberElement = null; - else - TargetNumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + TargetNumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("TargetNumber"); } } @@ -603,13 +582,13 @@ public int? TargetNumber /// [FhirElement("actualNumber", Order=50)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt ActualNumberElement + public Hl7.Fhir.Model.UnsignedInt? ActualNumberElement { get { return _ActualNumberElement; } set { _ActualNumberElement = value; OnPropertyChanged("ActualNumberElement"); } } - private Hl7.Fhir.Model.UnsignedInt _ActualNumberElement; + private Hl7.Fhir.Model.UnsignedInt? _ActualNumberElement; /// /// Actual total number of participants enrolled in study @@ -618,13 +597,10 @@ public Hl7.Fhir.Model.UnsignedInt ActualNumberElement [IgnoreDataMember] public int? ActualNumber { - get { return ActualNumberElement != null ? ActualNumberElement.Value : null; } + get => _ActualNumberElement?.Value; set { - if (value == null) - ActualNumberElement = null; - else - ActualNumberElement = new Hl7.Fhir.Model.UnsignedInt(value); + ActualNumberElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("ActualNumber"); } } @@ -636,13 +612,13 @@ public int? ActualNumber [CLSCompliant(false)] [References("Group","EvidenceVariable")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Eligibility + public Hl7.Fhir.Model.ResourceReference? Eligibility { get { return _Eligibility; } set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } - private Hl7.Fhir.Model.ResourceReference _Eligibility; + private Hl7.Fhir.Model.ResourceReference? _Eligibility; /// /// Group of participants who were enrolled in study. @@ -651,28 +627,24 @@ public Hl7.Fhir.Model.ResourceReference Eligibility [CLSCompliant(false)] [References("Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ActualGroup + public Hl7.Fhir.Model.ResourceReference? ActualGroup { get { return _ActualGroup; } set { _ActualGroup = value; OnPropertyChanged("ActualGroup"); } } - private Hl7.Fhir.Model.ResourceReference _ActualGroup; + private Hl7.Fhir.Model.ResourceReference? _ActualGroup; protected internal override void CopyToInternal(Base other) { - var dest = other as RecruitmentComponent; - - if (dest == null) - { + if(other is not RecruitmentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TargetNumberElement != null) dest.TargetNumberElement = (Hl7.Fhir.Model.UnsignedInt)TargetNumberElement.DeepCopyInternal(); - if(ActualNumberElement != null) dest.ActualNumberElement = (Hl7.Fhir.Model.UnsignedInt)ActualNumberElement.DeepCopyInternal(); - if(Eligibility != null) dest.Eligibility = (Hl7.Fhir.Model.ResourceReference)Eligibility.DeepCopyInternal(); - if(ActualGroup != null) dest.ActualGroup = (Hl7.Fhir.Model.ResourceReference)ActualGroup.DeepCopyInternal(); + if(_TargetNumberElement is not null) dest.TargetNumberElement = (Hl7.Fhir.Model.UnsignedInt)_TargetNumberElement.DeepCopyInternal(); + if(_ActualNumberElement is not null) dest.ActualNumberElement = (Hl7.Fhir.Model.UnsignedInt)_ActualNumberElement.DeepCopyInternal(); + if(_Eligibility is not null) dest.Eligibility = (Hl7.Fhir.Model.ResourceReference)_Eligibility.DeepCopyInternal(); + if(_ActualGroup is not null) dest.ActualGroup = (Hl7.Fhir.Model.ResourceReference)_ActualGroup.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -684,55 +656,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RecruitmentComponent; - if(otherT == null) return false; + if(other is not RecruitmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TargetNumberElement, otherT.TargetNumberElement)) return false; - if(!comparer.Equals(ActualNumberElement, otherT.ActualNumberElement)) return false; - if(!comparer.Equals(Eligibility, otherT.Eligibility)) return false; - if(!comparer.Equals(ActualGroup, otherT.ActualGroup)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TargetNumberElement, otherT._TargetNumberElement)) return false; + if(!comparer.Equals(_ActualNumberElement, otherT._ActualNumberElement)) return false; + if(!comparer.Equals(_Eligibility, otherT._Eligibility)) return false; + if(!comparer.Equals(_ActualGroup, otherT._ActualGroup)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "targetNumber": - value = TargetNumberElement; - return TargetNumberElement is not null; + value = _TargetNumberElement; + return _TargetNumberElement is not null; case "actualNumber": - value = ActualNumberElement; - return ActualNumberElement is not null; + value = _ActualNumberElement; + return _ActualNumberElement is not null; case "eligibility": - value = Eligibility; - return Eligibility is not null; + value = _Eligibility; + return _Eligibility is not null; case "actualGroup": - value = ActualGroup; - return ActualGroup is not null; + value = _ActualGroup; + return _ActualGroup is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "targetNumber": - TargetNumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + TargetNumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "actualNumber": - ActualNumberElement = (Hl7.Fhir.Model.UnsignedInt)value; + ActualNumberElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "eligibility": - Eligibility = (Hl7.Fhir.Model.ResourceReference)value; + Eligibility = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "actualGroup": - ActualGroup = (Hl7.Fhir.Model.ResourceReference)value; + ActualGroup = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -743,10 +715,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TargetNumberElement is not null) yield return new KeyValuePair("targetNumber",TargetNumberElement); - if (ActualNumberElement is not null) yield return new KeyValuePair("actualNumber",ActualNumberElement); - if (Eligibility is not null) yield return new KeyValuePair("eligibility",Eligibility); - if (ActualGroup is not null) yield return new KeyValuePair("actualGroup",ActualGroup); + if (_TargetNumberElement is not null) yield return new KeyValuePair("targetNumber",_TargetNumberElement); + if (_ActualNumberElement is not null) yield return new KeyValuePair("actualNumber",_ActualNumberElement); + if (_Eligibility is not null) yield return new KeyValuePair("eligibility",_Eligibility); + if (_ActualGroup is not null) yield return new KeyValuePair("actualGroup",_ActualGroup); } } @@ -773,28 +745,25 @@ public partial class ComparisonGroupComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("linkId", Order=40)] [DataMember] - public Hl7.Fhir.Model.Id LinkIdElement + public Hl7.Fhir.Model.Id? LinkIdElement { get { return _LinkIdElement; } set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } - private Hl7.Fhir.Model.Id _LinkIdElement; + private Hl7.Fhir.Model.Id? _LinkIdElement; /// /// Allows the comparisonGroup for the study and the comparisonGroup for the subject to be linked easily /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LinkId + public string? LinkId { - get { return LinkIdElement != null ? LinkIdElement.Value : null; } + get => _LinkIdElement?.Value; set { - if (value == null) - LinkIdElement = null; - else - LinkIdElement = new Hl7.Fhir.Model.Id(value); + LinkIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("LinkId"); } } @@ -805,28 +774,25 @@ public string LinkId [FhirElement("name", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for study comparisonGroup /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -837,41 +803,38 @@ public string Name [FhirElement("type", Order=60)] [Binding("ResearchStudyArmType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Short explanation of study path. /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Short explanation of study path /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -886,11 +849,11 @@ public string Description [DataMember] public List IntendedExposure { - get { if(_IntendedExposure==null) _IntendedExposure = new List(); return _IntendedExposure; } + get => _IntendedExposure ?? new List(); set { _IntendedExposure = value; OnPropertyChanged("IntendedExposure"); } } - private List _IntendedExposure; + private List? _IntendedExposure; /// /// Group of participants who were enrolled in study comparisonGroup. @@ -899,30 +862,26 @@ public List IntendedExposure [CLSCompliant(false)] [References("Group")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ObservedGroup + public Hl7.Fhir.Model.ResourceReference? ObservedGroup { get { return _ObservedGroup; } set { _ObservedGroup = value; OnPropertyChanged("ObservedGroup"); } } - private Hl7.Fhir.Model.ResourceReference _ObservedGroup; + private Hl7.Fhir.Model.ResourceReference? _ObservedGroup; protected internal override void CopyToInternal(Base other) { - var dest = other as ComparisonGroupComponent; - - if (dest == null) - { + if(other is not ComparisonGroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LinkIdElement != null) dest.LinkIdElement = (Hl7.Fhir.Model.Id)LinkIdElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(IntendedExposure.Any()) dest.IntendedExposure = new List(IntendedExposure.DeepCopyInternal()); - if(ObservedGroup != null) dest.ObservedGroup = (Hl7.Fhir.Model.ResourceReference)ObservedGroup.DeepCopyInternal(); + if(_LinkIdElement is not null) dest.LinkIdElement = (Hl7.Fhir.Model.Id)_LinkIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_IntendedExposure is not null) dest.IntendedExposure = new List(_IntendedExposure.DeepCopyInternal()); + if(_ObservedGroup is not null) dest.ObservedGroup = (Hl7.Fhir.Model.ResourceReference)_ObservedGroup.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -934,69 +893,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComparisonGroupComponent; - if(otherT == null) return false; + if(other is not ComparisonGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LinkIdElement, otherT.LinkIdElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(IntendedExposure, otherT.IntendedExposure)) return false; - if(!comparer.Equals(ObservedGroup, otherT.ObservedGroup)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_IntendedExposure, otherT._IntendedExposure)) return false; + if(!comparer.Equals(_ObservedGroup, otherT._ObservedGroup)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "linkId": - value = LinkIdElement; - return LinkIdElement is not null; + value = _LinkIdElement; + return _LinkIdElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "intendedExposure": - value = IntendedExposure; - return IntendedExposure?.Any() == true; + value = _IntendedExposure; + return _IntendedExposure?.Any() == true; case "observedGroup": - value = ObservedGroup; - return ObservedGroup is not null; + value = _ObservedGroup; + return _ObservedGroup is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "linkId": - LinkIdElement = (Hl7.Fhir.Model.Id)value; + LinkIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "intendedExposure": - IntendedExposure = (List)value; + IntendedExposure = (List?)value!; return this; case "observedGroup": - ObservedGroup = (Hl7.Fhir.Model.ResourceReference)value; + ObservedGroup = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1007,12 +966,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LinkIdElement is not null) yield return new KeyValuePair("linkId",LinkIdElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (IntendedExposure?.Any() == true) yield return new KeyValuePair("intendedExposure",IntendedExposure); - if (ObservedGroup is not null) yield return new KeyValuePair("observedGroup",ObservedGroup); + if (_LinkIdElement is not null) yield return new KeyValuePair("linkId",_LinkIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_IntendedExposure?.Any() == true) yield return new KeyValuePair("intendedExposure",_IntendedExposure); + if (_ObservedGroup is not null) yield return new KeyValuePair("observedGroup",_ObservedGroup); } } @@ -1038,28 +997,25 @@ public partial class ObjectiveComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for the objective /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1070,58 +1026,51 @@ public string Name [FhirElement("type", Order=50)] [Binding("ResearchStudyObjectiveType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Description of the objective. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of the objective /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ObjectiveComponent; - - if (dest == null) - { + if(other is not ObjectiveComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1133,48 +1082,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ObjectiveComponent; - if(otherT == null) return false; + if(other is not ObjectiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1185,9 +1134,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -1214,28 +1163,25 @@ public partial class OutcomeMeasureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Label for the outcome /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1249,39 +1195,36 @@ public string Name [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Description of the outcome. /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of the outcome /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1293,28 +1236,24 @@ public string Description [CLSCompliant(false)] [References("EvidenceVariable")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Reference + public Hl7.Fhir.Model.ResourceReference? Reference { get { return _Reference; } set { _Reference = value; OnPropertyChanged("Reference"); } } - private Hl7.Fhir.Model.ResourceReference _Reference; + private Hl7.Fhir.Model.ResourceReference? _Reference; protected internal override void CopyToInternal(Base other) { - var dest = other as OutcomeMeasureComponent; - - if (dest == null) - { + if(other is not OutcomeMeasureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Reference != null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)Reference.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Reference is not null) dest.Reference = (Hl7.Fhir.Model.ResourceReference)_Reference.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1326,55 +1265,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutcomeMeasureComponent; - if(otherT == null) return false; + if(other is not OutcomeMeasureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Reference, otherT.Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Reference, otherT._Reference)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "reference": - value = Reference; - return Reference is not null; + value = _Reference; + return _Reference is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "reference": - Reference = (Hl7.Fhir.Model.ResourceReference)value; + Reference = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1385,10 +1324,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Reference is not null) yield return new KeyValuePair("reference",Reference); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Reference is not null) yield return new KeyValuePair("reference",_Reference); } } @@ -1398,28 +1337,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this study resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1432,39 +1368,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// The business version for the study record. /// [FhirElement("version", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// The business version for the study record /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1474,28 +1407,25 @@ public string Version /// [FhirElement("name", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this study (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1505,28 +1435,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Human readable name of the study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1539,11 +1466,11 @@ public string Title [DataMember] public List Label { - get { if(_Label==null) _Label = new List(); return _Label; } + get => _Label ?? new List(); set { _Label = value; OnPropertyChanged("Label"); } } - private List _Label; + private List? _Label; /// /// Steps followed in executing study. @@ -1555,11 +1482,11 @@ public List Label [DataMember] public List Protocol { - get { if(_Protocol==null) _Protocol = new List(); return _Protocol; } + get => _Protocol ?? new List(); set { _Protocol = value; OnPropertyChanged("Protocol"); } } - private List _Protocol; + private List? _Protocol; /// /// Part of larger study. @@ -1571,11 +1498,11 @@ public List Protocol [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// References, URLs, and attachments. @@ -1585,39 +1512,36 @@ public List PartOf [DataMember] public List RelatedArtifact { - get { if(_RelatedArtifact==null) _RelatedArtifact = new List(); return _RelatedArtifact; } + get => _RelatedArtifact ?? new List(); set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } - private List _RelatedArtifact; + private List? _RelatedArtifact; /// /// Date the resource last changed. /// [FhirElement("date", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date the resource last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1630,13 +1554,13 @@ public string Date [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1645,13 +1569,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1662,13 +1583,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status [FhirElement("primaryPurposeType", InSummary=true, Order=200)] [Binding("ResearchStudyPrimaryPurposeType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PrimaryPurposeType + public Hl7.Fhir.Model.CodeableConcept? PrimaryPurposeType { get { return _PrimaryPurposeType; } set { _PrimaryPurposeType = value; OnPropertyChanged("PrimaryPurposeType"); } } - private Hl7.Fhir.Model.CodeableConcept _PrimaryPurposeType; + private Hl7.Fhir.Model.CodeableConcept? _PrimaryPurposeType; /// /// n-a | early-phase-1 | phase-1 | phase-1-phase-2 | phase-2 | phase-2-phase-3 | phase-3 | phase-4. @@ -1676,13 +1597,13 @@ public Hl7.Fhir.Model.CodeableConcept PrimaryPurposeType [FhirElement("phase", InSummary=true, Order=210)] [Binding("ResearchStudyPhase")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Phase + public Hl7.Fhir.Model.CodeableConcept? Phase { get { return _Phase; } set { _Phase = value; OnPropertyChanged("Phase"); } } - private Hl7.Fhir.Model.CodeableConcept _Phase; + private Hl7.Fhir.Model.CodeableConcept? _Phase; /// /// Classifications of the study design characteristics. @@ -1693,11 +1614,11 @@ public Hl7.Fhir.Model.CodeableConcept Phase [DataMember] public List StudyDesign { - get { if(_StudyDesign==null) _StudyDesign = new List(); return _StudyDesign; } + get => _StudyDesign ?? new List(); set { _StudyDesign = value; OnPropertyChanged("StudyDesign"); } } - private List _StudyDesign; + private List? _StudyDesign; /// /// Drugs, devices, etc. under study. @@ -1708,11 +1629,11 @@ public List StudyDesign [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Condition being studied. @@ -1723,11 +1644,11 @@ public List Focus [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Used to search for the study. @@ -1738,11 +1659,11 @@ public List Condition [DataMember] public List Keyword { - get { if(_Keyword==null) _Keyword = new List(); return _Keyword; } + get => _Keyword ?? new List(); set { _Keyword = value; OnPropertyChanged("Keyword"); } } - private List _Keyword; + private List? _Keyword; /// /// Geographic area for the study. @@ -1753,39 +1674,36 @@ public List Keyword [DataMember] public List Region { - get { if(_Region==null) _Region = new List(); return _Region; } + get => _Region ?? new List(); set { _Region = value; OnPropertyChanged("Region"); } } - private List _Region; + private List? _Region; /// /// Brief text explaining the study. /// [FhirElement("descriptionSummary", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionSummaryElement + public Hl7.Fhir.Model.Markdown? DescriptionSummaryElement { get { return _DescriptionSummaryElement; } set { _DescriptionSummaryElement = value; OnPropertyChanged("DescriptionSummaryElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionSummaryElement; + private Hl7.Fhir.Model.Markdown? _DescriptionSummaryElement; /// /// Brief text explaining the study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DescriptionSummary + public string? DescriptionSummary { - get { return DescriptionSummaryElement != null ? DescriptionSummaryElement.Value : null; } + get => _DescriptionSummaryElement?.Value; set { - if (value == null) - DescriptionSummaryElement = null; - else - DescriptionSummaryElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionSummaryElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("DescriptionSummary"); } } @@ -1795,28 +1713,25 @@ public string DescriptionSummary /// [FhirElement("description", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Detailed narrative of the study /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1826,13 +1741,13 @@ public string Description /// [FhirElement("period", InSummary=true, Order=290, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Facility where study activities are conducted. @@ -1844,11 +1759,11 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Site { - get { if(_Site==null) _Site = new List(); return _Site; } + get => _Site ?? new List(); set { _Site = value; OnPropertyChanged("Site"); } } - private List _Site; + private List? _Site; /// /// Comments made about the study. @@ -1858,11 +1773,11 @@ public List Site [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Classification for the study. @@ -1873,11 +1788,11 @@ public List Note [DataMember] public List Classifier { - get { if(_Classifier==null) _Classifier = new List(); return _Classifier; } + get => _Classifier ?? new List(); set { _Classifier = value; OnPropertyChanged("Classifier"); } } - private List _Classifier; + private List? _Classifier; /// /// Sponsors, collaborators, and other parties. @@ -1887,11 +1802,11 @@ public List Classifier [DataMember] public List AssociatedParty { - get { if(_AssociatedParty==null) _AssociatedParty = new List(); return _AssociatedParty; } + get => _AssociatedParty ?? new List(); set { _AssociatedParty = value; OnPropertyChanged("AssociatedParty"); } } - private List _AssociatedParty; + private List? _AssociatedParty; /// /// Status of study with time for that status. @@ -1901,11 +1816,11 @@ public List AssociatedPar [DataMember] public List ProgressStatus { - get { if(_ProgressStatus==null) _ProgressStatus = new List(); return _ProgressStatus; } + get => _ProgressStatus ?? new List(); set { _ProgressStatus = value; OnPropertyChanged("ProgressStatus"); } } - private List _ProgressStatus; + private List? _ProgressStatus; /// /// accrual-goal-met | closed-due-to-toxicity | closed-due-to-lack-of-study-progress | temporarily-closed-per-study-design. @@ -1913,26 +1828,26 @@ public List ProgressStatus [FhirElement("whyStopped", InSummary=true, Order=350, FiveWs="FiveWs.why[x]")] [Binding("ResearchStudyReasonStopped")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept WhyStopped + public Hl7.Fhir.Model.CodeableConcept? WhyStopped { get { return _WhyStopped; } set { _WhyStopped = value; OnPropertyChanged("WhyStopped"); } } - private Hl7.Fhir.Model.CodeableConcept _WhyStopped; + private Hl7.Fhir.Model.CodeableConcept? _WhyStopped; /// /// Target or actual group of participants enrolled in study. /// [FhirElement("recruitment", InSummary=true, Order=360, FiveWs="FiveWs.subject")] [DataMember] - public Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent Recruitment + public Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent? Recruitment { get { return _Recruitment; } set { _Recruitment = value; OnPropertyChanged("Recruitment"); } } - private Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent _Recruitment; + private Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent? _Recruitment; /// /// Defined path through the study for a subject. @@ -1942,11 +1857,11 @@ public Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent Recruitment [DataMember] public List ComparisonGroup { - get { if(_ComparisonGroup==null) _ComparisonGroup = new List(); return _ComparisonGroup; } + get => _ComparisonGroup ?? new List(); set { _ComparisonGroup = value; OnPropertyChanged("ComparisonGroup"); } } - private List _ComparisonGroup; + private List? _ComparisonGroup; /// /// A goal for the study. @@ -1956,11 +1871,11 @@ public List ComparisonGro [DataMember] public List Objective { - get { if(_Objective==null) _Objective = new List(); return _Objective; } + get => _Objective ?? new List(); set { _Objective = value; OnPropertyChanged("Objective"); } } - private List _Objective; + private List? _Objective; /// /// A variable measured during the study. @@ -1970,11 +1885,11 @@ public List Objective [DataMember] public List OutcomeMeasure { - get { if(_OutcomeMeasure==null) _OutcomeMeasure = new List(); return _OutcomeMeasure; } + get => _OutcomeMeasure ?? new List(); set { _OutcomeMeasure = value; OnPropertyChanged("OutcomeMeasure"); } } - private List _OutcomeMeasure; + private List? _OutcomeMeasure; /// /// Link to results generated during the study. @@ -1986,56 +1901,52 @@ public List OutcomeMeasure [DataMember] public List Result { - get { if(_Result==null) _Result = new List(); return _Result; } + get => _Result ?? new List(); set { _Result = value; OnPropertyChanged("Result"); } } - private List _Result; + private List? _Result; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchStudy; - - if (dest == null) - { + if(other is not ResearchStudy dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(Label.Any()) dest.Label = new List(Label.DeepCopyInternal()); - if(Protocol.Any()) dest.Protocol = new List(Protocol.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(RelatedArtifact.Any()) dest.RelatedArtifact = new List(RelatedArtifact.DeepCopyInternal()); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(PrimaryPurposeType != null) dest.PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)PrimaryPurposeType.DeepCopyInternal(); - if(Phase != null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)Phase.DeepCopyInternal(); - if(StudyDesign.Any()) dest.StudyDesign = new List(StudyDesign.DeepCopyInternal()); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Keyword.Any()) dest.Keyword = new List(Keyword.DeepCopyInternal()); - if(Region.Any()) dest.Region = new List(Region.DeepCopyInternal()); - if(DescriptionSummaryElement != null) dest.DescriptionSummaryElement = (Hl7.Fhir.Model.Markdown)DescriptionSummaryElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Site.Any()) dest.Site = new List(Site.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Classifier.Any()) dest.Classifier = new List(Classifier.DeepCopyInternal()); - if(AssociatedParty.Any()) dest.AssociatedParty = new List(AssociatedParty.DeepCopyInternal()); - if(ProgressStatus.Any()) dest.ProgressStatus = new List(ProgressStatus.DeepCopyInternal()); - if(WhyStopped != null) dest.WhyStopped = (Hl7.Fhir.Model.CodeableConcept)WhyStopped.DeepCopyInternal(); - if(Recruitment != null) dest.Recruitment = (Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent)Recruitment.DeepCopyInternal(); - if(ComparisonGroup.Any()) dest.ComparisonGroup = new List(ComparisonGroup.DeepCopyInternal()); - if(Objective.Any()) dest.Objective = new List(Objective.DeepCopyInternal()); - if(OutcomeMeasure.Any()) dest.OutcomeMeasure = new List(OutcomeMeasure.DeepCopyInternal()); - if(Result.Any()) dest.Result = new List(Result.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_Label is not null) dest.Label = new List(_Label.DeepCopyInternal()); + if(_Protocol is not null) dest.Protocol = new List(_Protocol.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_RelatedArtifact is not null) dest.RelatedArtifact = new List(_RelatedArtifact.DeepCopyInternal()); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_PrimaryPurposeType is not null) dest.PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)_PrimaryPurposeType.DeepCopyInternal(); + if(_Phase is not null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)_Phase.DeepCopyInternal(); + if(_StudyDesign is not null) dest.StudyDesign = new List(_StudyDesign.DeepCopyInternal()); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Keyword is not null) dest.Keyword = new List(_Keyword.DeepCopyInternal()); + if(_Region is not null) dest.Region = new List(_Region.DeepCopyInternal()); + if(_DescriptionSummaryElement is not null) dest.DescriptionSummaryElement = (Hl7.Fhir.Model.Markdown)_DescriptionSummaryElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Site is not null) dest.Site = new List(_Site.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Classifier is not null) dest.Classifier = new List(_Classifier.DeepCopyInternal()); + if(_AssociatedParty is not null) dest.AssociatedParty = new List(_AssociatedParty.DeepCopyInternal()); + if(_ProgressStatus is not null) dest.ProgressStatus = new List(_ProgressStatus.DeepCopyInternal()); + if(_WhyStopped is not null) dest.WhyStopped = (Hl7.Fhir.Model.CodeableConcept)_WhyStopped.DeepCopyInternal(); + if(_Recruitment is not null) dest.Recruitment = (Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent)_Recruitment.DeepCopyInternal(); + if(_ComparisonGroup is not null) dest.ComparisonGroup = new List(_ComparisonGroup.DeepCopyInternal()); + if(_Objective is not null) dest.Objective = new List(_Objective.DeepCopyInternal()); + if(_OutcomeMeasure is not null) dest.OutcomeMeasure = new List(_OutcomeMeasure.DeepCopyInternal()); + if(_Result is not null) dest.Result = new List(_Result.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2047,251 +1958,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchStudy; - if(otherT == null) return false; + if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(Label, otherT.Label)) return false; - if(!comparer.ListEquals(Protocol, otherT.Protocol)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.ListEquals(RelatedArtifact, otherT.RelatedArtifact)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(PrimaryPurposeType, otherT.PrimaryPurposeType)) return false; - if(!comparer.Equals(Phase, otherT.Phase)) return false; - if(!comparer.ListEquals(StudyDesign, otherT.StudyDesign)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Keyword, otherT.Keyword)) return false; - if(!comparer.ListEquals(Region, otherT.Region)) return false; - if(!comparer.Equals(DescriptionSummaryElement, otherT.DescriptionSummaryElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Site, otherT.Site)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Classifier, otherT.Classifier)) return false; - if(!comparer.ListEquals(AssociatedParty, otherT.AssociatedParty)) return false; - if(!comparer.ListEquals(ProgressStatus, otherT.ProgressStatus)) return false; - if(!comparer.Equals(WhyStopped, otherT.WhyStopped)) return false; - if(!comparer.Equals(Recruitment, otherT.Recruitment)) return false; - if(!comparer.ListEquals(ComparisonGroup, otherT.ComparisonGroup)) return false; - if(!comparer.ListEquals(Objective, otherT.Objective)) return false; - if(!comparer.ListEquals(OutcomeMeasure, otherT.OutcomeMeasure)) return false; - if(!comparer.ListEquals(Result, otherT.Result)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_Label, otherT._Label)) return false; + if(!comparer.ListEquals(_Protocol, otherT._Protocol)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_PrimaryPurposeType, otherT._PrimaryPurposeType)) return false; + if(!comparer.Equals(_Phase, otherT._Phase)) return false; + if(!comparer.ListEquals(_StudyDesign, otherT._StudyDesign)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Keyword, otherT._Keyword)) return false; + if(!comparer.ListEquals(_Region, otherT._Region)) return false; + if(!comparer.Equals(_DescriptionSummaryElement, otherT._DescriptionSummaryElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Site, otherT._Site)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + if(!comparer.ListEquals(_AssociatedParty, otherT._AssociatedParty)) return false; + if(!comparer.ListEquals(_ProgressStatus, otherT._ProgressStatus)) return false; + if(!comparer.Equals(_WhyStopped, otherT._WhyStopped)) return false; + if(!comparer.Equals(_Recruitment, otherT._Recruitment)) return false; + if(!comparer.ListEquals(_ComparisonGroup, otherT._ComparisonGroup)) return false; + if(!comparer.ListEquals(_Objective, otherT._Objective)) return false; + if(!comparer.ListEquals(_OutcomeMeasure, otherT._OutcomeMeasure)) return false; + if(!comparer.ListEquals(_Result, otherT._Result)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "label": - value = Label; - return Label?.Any() == true; + value = _Label; + return _Label?.Any() == true; case "protocol": - value = Protocol; - return Protocol?.Any() == true; + value = _Protocol; + return _Protocol?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "relatedArtifact": - value = RelatedArtifact; - return RelatedArtifact?.Any() == true; + value = _RelatedArtifact; + return _RelatedArtifact?.Any() == true; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "primaryPurposeType": - value = PrimaryPurposeType; - return PrimaryPurposeType is not null; + value = _PrimaryPurposeType; + return _PrimaryPurposeType is not null; case "phase": - value = Phase; - return Phase is not null; + value = _Phase; + return _Phase is not null; case "studyDesign": - value = StudyDesign; - return StudyDesign?.Any() == true; + value = _StudyDesign; + return _StudyDesign?.Any() == true; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "keyword": - value = Keyword; - return Keyword?.Any() == true; + value = _Keyword; + return _Keyword?.Any() == true; case "region": - value = Region; - return Region?.Any() == true; + value = _Region; + return _Region?.Any() == true; case "descriptionSummary": - value = DescriptionSummaryElement; - return DescriptionSummaryElement is not null; + value = _DescriptionSummaryElement; + return _DescriptionSummaryElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "site": - value = Site; - return Site?.Any() == true; + value = _Site; + return _Site?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "classifier": - value = Classifier; - return Classifier?.Any() == true; + value = _Classifier; + return _Classifier?.Any() == true; case "associatedParty": - value = AssociatedParty; - return AssociatedParty?.Any() == true; + value = _AssociatedParty; + return _AssociatedParty?.Any() == true; case "progressStatus": - value = ProgressStatus; - return ProgressStatus?.Any() == true; + value = _ProgressStatus; + return _ProgressStatus?.Any() == true; case "whyStopped": - value = WhyStopped; - return WhyStopped is not null; + value = _WhyStopped; + return _WhyStopped is not null; case "recruitment": - value = Recruitment; - return Recruitment is not null; + value = _Recruitment; + return _Recruitment is not null; case "comparisonGroup": - value = ComparisonGroup; - return ComparisonGroup?.Any() == true; + value = _ComparisonGroup; + return _ComparisonGroup?.Any() == true; case "objective": - value = Objective; - return Objective?.Any() == true; + value = _Objective; + return _Objective?.Any() == true; case "outcomeMeasure": - value = OutcomeMeasure; - return OutcomeMeasure?.Any() == true; + value = _OutcomeMeasure; + return _OutcomeMeasure?.Any() == true; case "result": - value = Result; - return Result?.Any() == true; + value = _Result; + return _Result?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "label": - Label = (List)value; + Label = (List?)value!; return this; case "protocol": - Protocol = (List)value; + Protocol = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "relatedArtifact": - RelatedArtifact = (List)value; + RelatedArtifact = (List?)value!; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "primaryPurposeType": - PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept)value; + PrimaryPurposeType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "phase": - Phase = (Hl7.Fhir.Model.CodeableConcept)value; + Phase = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "studyDesign": - StudyDesign = (List)value; + StudyDesign = (List?)value!; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "keyword": - Keyword = (List)value; + Keyword = (List?)value!; return this; case "region": - Region = (List)value; + Region = (List?)value!; return this; case "descriptionSummary": - DescriptionSummaryElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionSummaryElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "site": - Site = (List)value; + Site = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "classifier": - Classifier = (List)value; + Classifier = (List?)value!; return this; case "associatedParty": - AssociatedParty = (List)value; + AssociatedParty = (List?)value!; return this; case "progressStatus": - ProgressStatus = (List)value; + ProgressStatus = (List?)value!; return this; case "whyStopped": - WhyStopped = (Hl7.Fhir.Model.CodeableConcept)value; + WhyStopped = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "recruitment": - Recruitment = (Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent)value; + Recruitment = (Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent?)value; return this; case "comparisonGroup": - ComparisonGroup = (List)value; + ComparisonGroup = (List?)value!; return this; case "objective": - Objective = (List)value; + Objective = (List?)value!; return this; case "outcomeMeasure": - OutcomeMeasure = (List)value; + OutcomeMeasure = (List?)value!; return this; case "result": - Result = (List)value; + Result = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2302,38 +2213,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (Label?.Any() == true) yield return new KeyValuePair("label",Label); - if (Protocol?.Any() == true) yield return new KeyValuePair("protocol",Protocol); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",RelatedArtifact); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (PrimaryPurposeType is not null) yield return new KeyValuePair("primaryPurposeType",PrimaryPurposeType); - if (Phase is not null) yield return new KeyValuePair("phase",Phase); - if (StudyDesign?.Any() == true) yield return new KeyValuePair("studyDesign",StudyDesign); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Keyword?.Any() == true) yield return new KeyValuePair("keyword",Keyword); - if (Region?.Any() == true) yield return new KeyValuePair("region",Region); - if (DescriptionSummaryElement is not null) yield return new KeyValuePair("descriptionSummary",DescriptionSummaryElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Site?.Any() == true) yield return new KeyValuePair("site",Site); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Classifier?.Any() == true) yield return new KeyValuePair("classifier",Classifier); - if (AssociatedParty?.Any() == true) yield return new KeyValuePair("associatedParty",AssociatedParty); - if (ProgressStatus?.Any() == true) yield return new KeyValuePair("progressStatus",ProgressStatus); - if (WhyStopped is not null) yield return new KeyValuePair("whyStopped",WhyStopped); - if (Recruitment is not null) yield return new KeyValuePair("recruitment",Recruitment); - if (ComparisonGroup?.Any() == true) yield return new KeyValuePair("comparisonGroup",ComparisonGroup); - if (Objective?.Any() == true) yield return new KeyValuePair("objective",Objective); - if (OutcomeMeasure?.Any() == true) yield return new KeyValuePair("outcomeMeasure",OutcomeMeasure); - if (Result?.Any() == true) yield return new KeyValuePair("result",Result); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_Label?.Any() == true) yield return new KeyValuePair("label",_Label); + if (_Protocol?.Any() == true) yield return new KeyValuePair("protocol",_Protocol); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_RelatedArtifact?.Any() == true) yield return new KeyValuePair("relatedArtifact",_RelatedArtifact); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_PrimaryPurposeType is not null) yield return new KeyValuePair("primaryPurposeType",_PrimaryPurposeType); + if (_Phase is not null) yield return new KeyValuePair("phase",_Phase); + if (_StudyDesign?.Any() == true) yield return new KeyValuePair("studyDesign",_StudyDesign); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Keyword?.Any() == true) yield return new KeyValuePair("keyword",_Keyword); + if (_Region?.Any() == true) yield return new KeyValuePair("region",_Region); + if (_DescriptionSummaryElement is not null) yield return new KeyValuePair("descriptionSummary",_DescriptionSummaryElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Site?.Any() == true) yield return new KeyValuePair("site",_Site); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Classifier?.Any() == true) yield return new KeyValuePair("classifier",_Classifier); + if (_AssociatedParty?.Any() == true) yield return new KeyValuePair("associatedParty",_AssociatedParty); + if (_ProgressStatus?.Any() == true) yield return new KeyValuePair("progressStatus",_ProgressStatus); + if (_WhyStopped is not null) yield return new KeyValuePair("whyStopped",_WhyStopped); + if (_Recruitment is not null) yield return new KeyValuePair("recruitment",_Recruitment); + if (_ComparisonGroup?.Any() == true) yield return new KeyValuePair("comparisonGroup",_ComparisonGroup); + if (_Objective?.Any() == true) yield return new KeyValuePair("objective",_Objective); + if (_OutcomeMeasure?.Any() == true) yield return new KeyValuePair("outcomeMeasure",_OutcomeMeasure); + if (_Result?.Any() == true) yield return new KeyValuePair("result",_Result); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs index cfc61638d..b9a69025e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -172,13 +175,13 @@ public partial class ProgressComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("ResearchSubjectStateType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// candidate | eligible | follow-up | ineligible | not-registered | off-study | on-study | on-study-intervention | on-study-observation | pending-on-study | potential-candidate | screening | withdrawn. @@ -186,13 +189,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("subjectState", Order=50, FiveWs="FiveWs.status")] [Binding("ResearchSubjectProgresss")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SubjectState + public Hl7.Fhir.Model.CodeableConcept? SubjectState { get { return _SubjectState; } set { _SubjectState = value; OnPropertyChanged("SubjectState"); } } - private Hl7.Fhir.Model.CodeableConcept _SubjectState; + private Hl7.Fhir.Model.CodeableConcept? _SubjectState; /// /// SignedUp | Screened | Randomized. @@ -200,13 +203,13 @@ public Hl7.Fhir.Model.CodeableConcept SubjectState [FhirElement("milestone", Order=60, FiveWs="FiveWs.status")] [Binding("ResearchSubjectMilestone")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Milestone + public Hl7.Fhir.Model.CodeableConcept? Milestone { get { return _Milestone; } set { _Milestone = value; OnPropertyChanged("Milestone"); } } - private Hl7.Fhir.Model.CodeableConcept _Milestone; + private Hl7.Fhir.Model.CodeableConcept? _Milestone; /// /// State change reason. @@ -214,41 +217,38 @@ public Hl7.Fhir.Model.CodeableConcept Milestone [FhirElement("reason", Order=70)] [Binding("StateChangeReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Reason + public Hl7.Fhir.Model.CodeableConcept? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableConcept _Reason; + private Hl7.Fhir.Model.CodeableConcept? _Reason; /// /// State change date. /// [FhirElement("startDate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StartDateElement + public Hl7.Fhir.Model.FhirDateTime? StartDateElement { get { return _StartDateElement; } set { _StartDateElement = value; OnPropertyChanged("StartDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StartDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StartDateElement; /// /// State change date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StartDate + public string? StartDate { - get { return StartDateElement != null ? StartDateElement.Value : null; } + get => _StartDateElement?.Value; set { - if (value == null) - StartDateElement = null; - else - StartDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StartDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StartDate"); } } @@ -258,48 +258,41 @@ public string StartDate /// [FhirElement("endDate", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime EndDateElement + public Hl7.Fhir.Model.FhirDateTime? EndDateElement { get { return _EndDateElement; } set { _EndDateElement = value; OnPropertyChanged("EndDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _EndDateElement; + private Hl7.Fhir.Model.FhirDateTime? _EndDateElement; /// /// State change date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string EndDate + public string? EndDate { - get { return EndDateElement != null ? EndDateElement.Value : null; } + get => _EndDateElement?.Value; set { - if (value == null) - EndDateElement = null; - else - EndDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + EndDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("EndDate"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ProgressComponent; - - if (dest == null) - { + if(other is not ProgressComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SubjectState != null) dest.SubjectState = (Hl7.Fhir.Model.CodeableConcept)SubjectState.DeepCopyInternal(); - if(Milestone != null) dest.Milestone = (Hl7.Fhir.Model.CodeableConcept)Milestone.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)Reason.DeepCopyInternal(); - if(StartDateElement != null) dest.StartDateElement = (Hl7.Fhir.Model.FhirDateTime)StartDateElement.DeepCopyInternal(); - if(EndDateElement != null) dest.EndDateElement = (Hl7.Fhir.Model.FhirDateTime)EndDateElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SubjectState is not null) dest.SubjectState = (Hl7.Fhir.Model.CodeableConcept)_SubjectState.DeepCopyInternal(); + if(_Milestone is not null) dest.Milestone = (Hl7.Fhir.Model.CodeableConcept)_Milestone.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableConcept)_Reason.DeepCopyInternal(); + if(_StartDateElement is not null) dest.StartDateElement = (Hl7.Fhir.Model.FhirDateTime)_StartDateElement.DeepCopyInternal(); + if(_EndDateElement is not null) dest.EndDateElement = (Hl7.Fhir.Model.FhirDateTime)_EndDateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -311,69 +304,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProgressComponent; - if(otherT == null) return false; + if(other is not ProgressComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(SubjectState, otherT.SubjectState)) return false; - if(!comparer.Equals(Milestone, otherT.Milestone)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(StartDateElement, otherT.StartDateElement)) return false; - if(!comparer.Equals(EndDateElement, otherT.EndDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_SubjectState, otherT._SubjectState)) return false; + if(!comparer.Equals(_Milestone, otherT._Milestone)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_StartDateElement, otherT._StartDateElement)) return false; + if(!comparer.Equals(_EndDateElement, otherT._EndDateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subjectState": - value = SubjectState; - return SubjectState is not null; + value = _SubjectState; + return _SubjectState is not null; case "milestone": - value = Milestone; - return Milestone is not null; + value = _Milestone; + return _Milestone is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "startDate": - value = StartDateElement; - return StartDateElement is not null; + value = _StartDateElement; + return _StartDateElement is not null; case "endDate": - value = EndDateElement; - return EndDateElement is not null; + value = _EndDateElement; + return _EndDateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subjectState": - SubjectState = (Hl7.Fhir.Model.CodeableConcept)value; + SubjectState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "milestone": - Milestone = (Hl7.Fhir.Model.CodeableConcept)value; + Milestone = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableConcept)value; + Reason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "startDate": - StartDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StartDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "endDate": - EndDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + EndDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -384,12 +377,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SubjectState is not null) yield return new KeyValuePair("subjectState",SubjectState); - if (Milestone is not null) yield return new KeyValuePair("milestone",Milestone); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (StartDateElement is not null) yield return new KeyValuePair("startDate",StartDateElement); - if (EndDateElement is not null) yield return new KeyValuePair("endDate",EndDateElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SubjectState is not null) yield return new KeyValuePair("subjectState",_SubjectState); + if (_Milestone is not null) yield return new KeyValuePair("milestone",_Milestone); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_StartDateElement is not null) yield return new KeyValuePair("startDate",_StartDateElement); + if (_EndDateElement is not null) yield return new KeyValuePair("endDate",_EndDateElement); } } @@ -402,11 +395,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | retired | unknown. @@ -416,13 +409,13 @@ public List Identifier [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -431,13 +424,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -450,24 +440,24 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Progress { - get { if(_Progress==null) _Progress = new List(); return _Progress; } + get => _Progress ?? new List(); set { _Progress = value; OnPropertyChanged("Progress"); } } - private List _Progress; + private List? _Progress; /// /// Start and end of participation. /// [FhirElement("period", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// Study subject is part of. @@ -477,13 +467,13 @@ public Hl7.Fhir.Model.Period Period [References("ResearchStudy")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Study + public Hl7.Fhir.Model.ResourceReference? Study { get { return _Study; } set { _Study = value; OnPropertyChanged("Study"); } } - private Hl7.Fhir.Model.ResourceReference _Study; + private Hl7.Fhir.Model.ResourceReference? _Study; /// /// Who or what is part of study. @@ -493,41 +483,38 @@ public Hl7.Fhir.Model.ResourceReference Study [References("Patient","Group","Specimen","Device","Medication","Substance","BiologicallyDerivedProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// What path should be followed. /// [FhirElement("assignedComparisonGroup", Order=150)] [DataMember] - public Hl7.Fhir.Model.Id AssignedComparisonGroupElement + public Hl7.Fhir.Model.Id? AssignedComparisonGroupElement { get { return _AssignedComparisonGroupElement; } set { _AssignedComparisonGroupElement = value; OnPropertyChanged("AssignedComparisonGroupElement"); } } - private Hl7.Fhir.Model.Id _AssignedComparisonGroupElement; + private Hl7.Fhir.Model.Id? _AssignedComparisonGroupElement; /// /// What path should be followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AssignedComparisonGroup + public string? AssignedComparisonGroup { - get { return AssignedComparisonGroupElement != null ? AssignedComparisonGroupElement.Value : null; } + get => _AssignedComparisonGroupElement?.Value; set { - if (value == null) - AssignedComparisonGroupElement = null; - else - AssignedComparisonGroupElement = new Hl7.Fhir.Model.Id(value); + AssignedComparisonGroupElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("AssignedComparisonGroup"); } } @@ -537,28 +524,25 @@ public string AssignedComparisonGroup /// [FhirElement("actualComparisonGroup", Order=160)] [DataMember] - public Hl7.Fhir.Model.Id ActualComparisonGroupElement + public Hl7.Fhir.Model.Id? ActualComparisonGroupElement { get { return _ActualComparisonGroupElement; } set { _ActualComparisonGroupElement = value; OnPropertyChanged("ActualComparisonGroupElement"); } } - private Hl7.Fhir.Model.Id _ActualComparisonGroupElement; + private Hl7.Fhir.Model.Id? _ActualComparisonGroupElement; /// /// What path was followed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ActualComparisonGroup + public string? ActualComparisonGroup { - get { return ActualComparisonGroupElement != null ? ActualComparisonGroupElement.Value : null; } + get => _ActualComparisonGroupElement?.Value; set { - if (value == null) - ActualComparisonGroupElement = null; - else - ActualComparisonGroupElement = new Hl7.Fhir.Model.Id(value); + ActualComparisonGroupElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ActualComparisonGroup"); } } @@ -573,33 +557,29 @@ public string ActualComparisonGroup [DataMember] public List Consent { - get { if(_Consent==null) _Consent = new List(); return _Consent; } + get => _Consent ?? new List(); set { _Consent = value; OnPropertyChanged("Consent"); } } - private List _Consent; + private List? _Consent; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ResearchSubject; - - if (dest == null) - { + if(other is not ResearchSubject dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Progress.Any()) dest.Progress = new List(Progress.DeepCopyInternal()); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Study != null) dest.Study = (Hl7.Fhir.Model.ResourceReference)Study.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(AssignedComparisonGroupElement != null) dest.AssignedComparisonGroupElement = (Hl7.Fhir.Model.Id)AssignedComparisonGroupElement.DeepCopyInternal(); - if(ActualComparisonGroupElement != null) dest.ActualComparisonGroupElement = (Hl7.Fhir.Model.Id)ActualComparisonGroupElement.DeepCopyInternal(); - if(Consent.Any()) dest.Consent = new List(Consent.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Progress is not null) dest.Progress = new List(_Progress.DeepCopyInternal()); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Study is not null) dest.Study = (Hl7.Fhir.Model.ResourceReference)_Study.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_AssignedComparisonGroupElement is not null) dest.AssignedComparisonGroupElement = (Hl7.Fhir.Model.Id)_AssignedComparisonGroupElement.DeepCopyInternal(); + if(_ActualComparisonGroupElement is not null) dest.ActualComparisonGroupElement = (Hl7.Fhir.Model.Id)_ActualComparisonGroupElement.DeepCopyInternal(); + if(_Consent is not null) dest.Consent = new List(_Consent.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -611,90 +591,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResearchSubject; - if(otherT == null) return false; + if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Progress, otherT.Progress)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.Equals(Study, otherT.Study)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(AssignedComparisonGroupElement, otherT.AssignedComparisonGroupElement)) return false; - if(!comparer.Equals(ActualComparisonGroupElement, otherT.ActualComparisonGroupElement)) return false; - if(!comparer.ListEquals(Consent, otherT.Consent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.Equals(_Study, otherT._Study)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_AssignedComparisonGroupElement, otherT._AssignedComparisonGroupElement)) return false; + if(!comparer.Equals(_ActualComparisonGroupElement, otherT._ActualComparisonGroupElement)) return false; + if(!comparer.ListEquals(_Consent, otherT._Consent)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "progress": - value = Progress; - return Progress?.Any() == true; + value = _Progress; + return _Progress?.Any() == true; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "study": - value = Study; - return Study is not null; + value = _Study; + return _Study is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "assignedComparisonGroup": - value = AssignedComparisonGroupElement; - return AssignedComparisonGroupElement is not null; + value = _AssignedComparisonGroupElement; + return _AssignedComparisonGroupElement is not null; case "actualComparisonGroup": - value = ActualComparisonGroupElement; - return ActualComparisonGroupElement is not null; + value = _ActualComparisonGroupElement; + return _ActualComparisonGroupElement is not null; case "consent": - value = Consent; - return Consent?.Any() == true; + value = _Consent; + return _Consent?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "progress": - Progress = (List)value; + Progress = (List?)value!; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "study": - Study = (Hl7.Fhir.Model.ResourceReference)value; + Study = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "assignedComparisonGroup": - AssignedComparisonGroupElement = (Hl7.Fhir.Model.Id)value; + AssignedComparisonGroupElement = (Hl7.Fhir.Model.Id?)value; return this; case "actualComparisonGroup": - ActualComparisonGroupElement = (Hl7.Fhir.Model.Id)value; + ActualComparisonGroupElement = (Hl7.Fhir.Model.Id?)value; return this; case "consent": - Consent = (List)value; + Consent = (List?)value!; return this; default: return base.SetValue(key, value); @@ -705,15 +685,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Progress?.Any() == true) yield return new KeyValuePair("progress",Progress); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Study is not null) yield return new KeyValuePair("study",Study); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (AssignedComparisonGroupElement is not null) yield return new KeyValuePair("assignedComparisonGroup",AssignedComparisonGroupElement); - if (ActualComparisonGroupElement is not null) yield return new KeyValuePair("actualComparisonGroup",ActualComparisonGroupElement); - if (Consent?.Any() == true) yield return new KeyValuePair("consent",Consent); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Progress?.Any() == true) yield return new KeyValuePair("progress",_Progress); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Study is not null) yield return new KeyValuePair("study",_Study); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_AssignedComparisonGroupElement is not null) yield return new KeyValuePair("assignedComparisonGroup",_AssignedComparisonGroupElement); + if (_ActualComparisonGroupElement is not null) yield return new KeyValuePair("actualComparisonGroup",_ActualComparisonGroupElement); + if (_Consent?.Any() == true) yield return new KeyValuePair("consent",_Consent); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs index ed14611ea..ecc7caad5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -82,13 +85,13 @@ public partial class PredictionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("outcome", Order=40)] [Binding("RiskAssessmentOutcome")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Outcome + public Hl7.Fhir.Model.CodeableConcept? Outcome { get { return _Outcome; } set { _Outcome = value; OnPropertyChanged("Outcome"); } } - private Hl7.Fhir.Model.CodeableConcept _Outcome; + private Hl7.Fhir.Model.CodeableConcept? _Outcome; /// /// Likelihood of specified outcome. @@ -97,13 +100,13 @@ public Hl7.Fhir.Model.CodeableConcept Outcome [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Probability + public Hl7.Fhir.Model.DataType? Probability { get { return _Probability; } set { _Probability = value; OnPropertyChanged("Probability"); } } - private Hl7.Fhir.Model.DataType _Probability; + private Hl7.Fhir.Model.DataType? _Probability; /// /// Likelihood of specified outcome as a qualitative value. @@ -111,26 +114,26 @@ public Hl7.Fhir.Model.DataType Probability [FhirElement("qualitativeRisk", Order=60)] [Binding("RiskAssessmentProbability")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept QualitativeRisk + public Hl7.Fhir.Model.CodeableConcept? QualitativeRisk { get { return _QualitativeRisk; } set { _QualitativeRisk = value; OnPropertyChanged("QualitativeRisk"); } } - private Hl7.Fhir.Model.CodeableConcept _QualitativeRisk; + private Hl7.Fhir.Model.CodeableConcept? _QualitativeRisk; /// /// Relative likelihood. /// [FhirElement("relativeRisk", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement + public Hl7.Fhir.Model.FhirDecimal? RelativeRiskElement { get { return _RelativeRiskElement; } set { _RelativeRiskElement = value; OnPropertyChanged("RelativeRiskElement"); } } - private Hl7.Fhir.Model.FhirDecimal _RelativeRiskElement; + private Hl7.Fhir.Model.FhirDecimal? _RelativeRiskElement; /// /// Relative likelihood @@ -139,13 +142,10 @@ public Hl7.Fhir.Model.FhirDecimal RelativeRiskElement [IgnoreDataMember] public decimal? RelativeRisk { - get { return RelativeRiskElement != null ? RelativeRiskElement.Value : null; } + get => _RelativeRiskElement?.Value; set { - if (value == null) - RelativeRiskElement = null; - else - RelativeRiskElement = new Hl7.Fhir.Model.FhirDecimal(value); + RelativeRiskElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("RelativeRisk"); } } @@ -157,61 +157,54 @@ public decimal? RelativeRisk [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType When + public Hl7.Fhir.Model.DataType? When { get { return _When; } set { _When = value; OnPropertyChanged("When"); } } - private Hl7.Fhir.Model.DataType _When; + private Hl7.Fhir.Model.DataType? _When; /// /// Explanation of prediction. /// [FhirElement("rationale", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString RationaleElement + public Hl7.Fhir.Model.FhirString? RationaleElement { get { return _RationaleElement; } set { _RationaleElement = value; OnPropertyChanged("RationaleElement"); } } - private Hl7.Fhir.Model.FhirString _RationaleElement; + private Hl7.Fhir.Model.FhirString? _RationaleElement; /// /// Explanation of prediction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Rationale + public string? Rationale { - get { return RationaleElement != null ? RationaleElement.Value : null; } + get => _RationaleElement?.Value; set { - if (value == null) - RationaleElement = null; - else - RationaleElement = new Hl7.Fhir.Model.FhirString(value); + RationaleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Rationale"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PredictionComponent; - - if (dest == null) - { + if(other is not PredictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Outcome != null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)Outcome.DeepCopyInternal(); - if(Probability != null) dest.Probability = (Hl7.Fhir.Model.DataType)Probability.DeepCopyInternal(); - if(QualitativeRisk != null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)QualitativeRisk.DeepCopyInternal(); - if(RelativeRiskElement != null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)RelativeRiskElement.DeepCopyInternal(); - if(When != null) dest.When = (Hl7.Fhir.Model.DataType)When.DeepCopyInternal(); - if(RationaleElement != null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)RationaleElement.DeepCopyInternal(); + if(_Outcome is not null) dest.Outcome = (Hl7.Fhir.Model.CodeableConcept)_Outcome.DeepCopyInternal(); + if(_Probability is not null) dest.Probability = (Hl7.Fhir.Model.DataType)_Probability.DeepCopyInternal(); + if(_QualitativeRisk is not null) dest.QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)_QualitativeRisk.DeepCopyInternal(); + if(_RelativeRiskElement is not null) dest.RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)_RelativeRiskElement.DeepCopyInternal(); + if(_When is not null) dest.When = (Hl7.Fhir.Model.DataType)_When.DeepCopyInternal(); + if(_RationaleElement is not null) dest.RationaleElement = (Hl7.Fhir.Model.FhirString)_RationaleElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -223,69 +216,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PredictionComponent; - if(otherT == null) return false; + if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Outcome, otherT.Outcome)) return false; - if(!comparer.Equals(Probability, otherT.Probability)) return false; - if(!comparer.Equals(QualitativeRisk, otherT.QualitativeRisk)) return false; - if(!comparer.Equals(RelativeRiskElement, otherT.RelativeRiskElement)) return false; - if(!comparer.Equals(When, otherT.When)) return false; - if(!comparer.Equals(RationaleElement, otherT.RationaleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + if(!comparer.Equals(_Probability, otherT._Probability)) return false; + if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; + if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; + if(!comparer.Equals(_When, otherT._When)) return false; + if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "outcome": - value = Outcome; - return Outcome is not null; + value = _Outcome; + return _Outcome is not null; case "probability": - value = Probability; - return Probability is not null; + value = _Probability; + return _Probability is not null; case "qualitativeRisk": - value = QualitativeRisk; - return QualitativeRisk is not null; + value = _QualitativeRisk; + return _QualitativeRisk is not null; case "relativeRisk": - value = RelativeRiskElement; - return RelativeRiskElement is not null; + value = _RelativeRiskElement; + return _RelativeRiskElement is not null; case "when": - value = When; - return When is not null; + value = _When; + return _When is not null; case "rationale": - value = RationaleElement; - return RationaleElement is not null; + value = _RationaleElement; + return _RationaleElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "outcome": - Outcome = (Hl7.Fhir.Model.CodeableConcept)value; + Outcome = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "probability": - Probability = (Hl7.Fhir.Model.DataType)value; + Probability = (Hl7.Fhir.Model.DataType?)value; return this; case "qualitativeRisk": - QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept)value; + QualitativeRisk = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "relativeRisk": - RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal)value; + RelativeRiskElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "when": - When = (Hl7.Fhir.Model.DataType)value; + When = (Hl7.Fhir.Model.DataType?)value; return this; case "rationale": - RationaleElement = (Hl7.Fhir.Model.FhirString)value; + RationaleElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -296,12 +289,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Outcome is not null) yield return new KeyValuePair("outcome",Outcome); - if (Probability is not null) yield return new KeyValuePair("probability",Probability); - if (QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",QualitativeRisk); - if (RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",RelativeRiskElement); - if (When is not null) yield return new KeyValuePair("when",When); - if (RationaleElement is not null) yield return new KeyValuePair("rationale",RationaleElement); + if (_Outcome is not null) yield return new KeyValuePair("outcome",_Outcome); + if (_Probability is not null) yield return new KeyValuePair("probability",_Probability); + if (_QualitativeRisk is not null) yield return new KeyValuePair("qualitativeRisk",_QualitativeRisk); + if (_RelativeRiskElement is not null) yield return new KeyValuePair("relativeRisk",_RelativeRiskElement); + if (_When is not null) yield return new KeyValuePair("when",_When); + if (_RationaleElement is not null) yield return new KeyValuePair("rationale",_RationaleElement); } } @@ -314,11 +307,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Request fulfilled by this assessment. @@ -327,13 +320,13 @@ public List Identifier [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BasedOn + public Hl7.Fhir.Model.ResourceReference? BasedOn { get { return _BasedOn; } set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private Hl7.Fhir.Model.ResourceReference _BasedOn; + private Hl7.Fhir.Model.ResourceReference? _BasedOn; /// /// Part of this occurrence. @@ -342,13 +335,13 @@ public Hl7.Fhir.Model.ResourceReference BasedOn [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Parent + public Hl7.Fhir.Model.ResourceReference? Parent { get { return _Parent; } set { _Parent = value; OnPropertyChanged("Parent"); } } - private Hl7.Fhir.Model.ResourceReference _Parent; + private Hl7.Fhir.Model.ResourceReference? _Parent; /// /// registered | preliminary | final | amended +. @@ -358,13 +351,13 @@ public Hl7.Fhir.Model.ResourceReference Parent [Binding("RiskAssessmentStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// registered | preliminary | final | amended + @@ -373,13 +366,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.ObservationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -390,26 +380,26 @@ public Hl7.Fhir.Model.ObservationStatus? Status [FhirElement("method", InSummary=true, Order=130, FiveWs="FiveWs.class")] [Binding("RiskAssessmentMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of assessment. /// [FhirElement("code", InSummary=true, Order=140, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Who/what does assessment apply to?. @@ -419,13 +409,13 @@ public Hl7.Fhir.Model.CodeableConcept Code [References("Patient","Group")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// Where was assessment performed?. @@ -434,13 +424,13 @@ public Hl7.Fhir.Model.ResourceReference Subject [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When was assessment made?. @@ -449,13 +439,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Condition assessed. @@ -464,13 +454,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Condition")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Condition + public Hl7.Fhir.Model.ResourceReference? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.ResourceReference _Condition; + private Hl7.Fhir.Model.ResourceReference? _Condition; /// /// Who did assessment?. @@ -479,13 +469,13 @@ public Hl7.Fhir.Model.ResourceReference Condition [CLSCompliant(false)] [References("Patient","Practitioner","PractitionerRole","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Performer + public Hl7.Fhir.Model.ResourceReference? Performer { get { return _Performer; } set { _Performer = value; OnPropertyChanged("Performer"); } } - private Hl7.Fhir.Model.ResourceReference _Performer; + private Hl7.Fhir.Model.ResourceReference? _Performer; /// /// Why the assessment was necessary?. @@ -495,11 +485,11 @@ public Hl7.Fhir.Model.ResourceReference Performer [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Information used in assessment. @@ -511,11 +501,11 @@ public List Reason [DataMember] public List Basis { - get { if(_Basis==null) _Basis = new List(); return _Basis; } + get => _Basis ?? new List(); set { _Basis = value; OnPropertyChanged("Basis"); } } - private List _Basis; + private List? _Basis; /// /// Outcome predicted. @@ -525,39 +515,36 @@ public List Basis [DataMember] public List Prediction { - get { if(_Prediction==null) _Prediction = new List(); return _Prediction; } + get => _Prediction ?? new List(); set { _Prediction = value; OnPropertyChanged("Prediction"); } } - private List _Prediction; + private List? _Prediction; /// /// How to reduce risk. /// [FhirElement("mitigation", Order=230)] [DataMember] - public Hl7.Fhir.Model.FhirString MitigationElement + public Hl7.Fhir.Model.FhirString? MitigationElement { get { return _MitigationElement; } set { _MitigationElement = value; OnPropertyChanged("MitigationElement"); } } - private Hl7.Fhir.Model.FhirString _MitigationElement; + private Hl7.Fhir.Model.FhirString? _MitigationElement; /// /// How to reduce risk /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Mitigation + public string? Mitigation { - get { return MitigationElement != null ? MitigationElement.Value : null; } + get => _MitigationElement?.Value; set { - if (value == null) - MitigationElement = null; - else - MitigationElement = new Hl7.Fhir.Model.FhirString(value); + MitigationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Mitigation"); } } @@ -570,40 +557,36 @@ public string Mitigation [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as RiskAssessment; - - if (dest == null) - { + if(other is not RiskAssessment dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn != null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)BasedOn.DeepCopyInternal(); - if(Parent != null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)Parent.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)Condition.DeepCopyInternal(); - if(Performer != null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Basis.Any()) dest.Basis = new List(Basis.DeepCopyInternal()); - if(Prediction.Any()) dest.Prediction = new List(Prediction.DeepCopyInternal()); - if(MitigationElement != null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)MitigationElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = (Hl7.Fhir.Model.ResourceReference)_BasedOn.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = (Hl7.Fhir.Model.ResourceReference)_Parent.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.ResourceReference)_Condition.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = (Hl7.Fhir.Model.ResourceReference)_Performer.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Basis is not null) dest.Basis = new List(_Basis.DeepCopyInternal()); + if(_Prediction is not null) dest.Prediction = new List(_Prediction.DeepCopyInternal()); + if(_MitigationElement is not null) dest.MitigationElement = (Hl7.Fhir.Model.FhirString)_MitigationElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -615,139 +598,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RiskAssessment; - if(otherT == null) return false; + if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Parent, otherT.Parent)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; - if(!comparer.Equals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Basis, otherT.Basis)) return false; - if(!comparer.ListEquals(Prediction, otherT.Prediction)) return false; - if(!comparer.Equals(MitigationElement, otherT.MitigationElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Parent, otherT._Parent)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; + if(!comparer.Equals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; + if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn is not null; + value = _BasedOn; + return _BasedOn is not null; case "parent": - value = Parent; - return Parent is not null; + value = _Parent; + return _Parent is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; case "performer": - value = Performer; - return Performer is not null; + value = _Performer; + return _Performer is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "basis": - value = Basis; - return Basis?.Any() == true; + value = _Basis; + return _Basis?.Any() == true; case "prediction": - value = Prediction; - return Prediction?.Any() == true; + value = _Prediction; + return _Prediction?.Any() == true; case "mitigation": - value = MitigationElement; - return MitigationElement is not null; + value = _MitigationElement; + return _MitigationElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (Hl7.Fhir.Model.ResourceReference)value; + BasedOn = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "parent": - Parent = (Hl7.Fhir.Model.ResourceReference)value; + Parent = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "condition": - Condition = (Hl7.Fhir.Model.ResourceReference)value; + Condition = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (Hl7.Fhir.Model.ResourceReference)value; + Performer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "basis": - Basis = (List)value; + Basis = (List?)value!; return this; case "prediction": - Prediction = (List)value; + Prediction = (List?)value!; return this; case "mitigation": - MitigationElement = (Hl7.Fhir.Model.FhirString)value; + MitigationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -758,22 +741,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn is not null) yield return new KeyValuePair("basedOn",BasedOn); - if (Parent is not null) yield return new KeyValuePair("parent",Parent); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); - if (Performer is not null) yield return new KeyValuePair("performer",Performer); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Basis?.Any() == true) yield return new KeyValuePair("basis",Basis); - if (Prediction?.Any() == true) yield return new KeyValuePair("prediction",Prediction); - if (MitigationElement is not null) yield return new KeyValuePair("mitigation",MitigationElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn is not null) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Parent is not null) yield return new KeyValuePair("parent",_Parent); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); + if (_Performer is not null) yield return new KeyValuePair("performer",_Performer); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Basis?.Any() == true) yield return new KeyValuePair("basis",_Basis); + if (_Prediction?.Any() == true) yield return new KeyValuePair("prediction",_Prediction); + if (_MitigationElement is not null) yield return new KeyValuePair("mitigation",_MitigationElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs b/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs index 02044e175..ca6dbae58 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -66,26 +69,26 @@ public partial class SampledData : Hl7.Fhir.Model.DataType [FhirElement("origin", InSummary=true, Order=30)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Origin + public Hl7.Fhir.Model.Quantity? Origin { get { return _Origin; } set { _Origin = value; OnPropertyChanged("Origin"); } } - private Hl7.Fhir.Model.Quantity _Origin; + private Hl7.Fhir.Model.Quantity? _Origin; /// /// Number of intervalUnits between samples. /// [FhirElement("interval", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal IntervalElement + public Hl7.Fhir.Model.FhirDecimal? IntervalElement { get { return _IntervalElement; } set { _IntervalElement = value; OnPropertyChanged("IntervalElement"); } } - private Hl7.Fhir.Model.FhirDecimal _IntervalElement; + private Hl7.Fhir.Model.FhirDecimal? _IntervalElement; /// /// Number of intervalUnits between samples @@ -94,13 +97,10 @@ public Hl7.Fhir.Model.FhirDecimal IntervalElement [IgnoreDataMember] public decimal? Interval { - get { return IntervalElement != null ? IntervalElement.Value : null; } + get => _IntervalElement?.Value; set { - if (value == null) - IntervalElement = null; - else - IntervalElement = new Hl7.Fhir.Model.FhirDecimal(value); + IntervalElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Interval"); } } @@ -112,28 +112,25 @@ public decimal? Interval [Binding("Units")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code IntervalUnitElement + public Hl7.Fhir.Model.Code? IntervalUnitElement { get { return _IntervalUnitElement; } set { _IntervalUnitElement = value; OnPropertyChanged("IntervalUnitElement"); } } - private Hl7.Fhir.Model.Code _IntervalUnitElement; + private Hl7.Fhir.Model.Code? _IntervalUnitElement; /// /// The measurement unit of the interval between samples /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IntervalUnit + public string? IntervalUnit { - get { return IntervalUnitElement != null ? IntervalUnitElement.Value : null; } + get => _IntervalUnitElement?.Value; set { - if (value == null) - IntervalUnitElement = null; - else - IntervalUnitElement = new Hl7.Fhir.Model.Code(value); + IntervalUnitElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("IntervalUnit"); } } @@ -143,13 +140,13 @@ public string IntervalUnit /// [FhirElement("factor", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal FactorElement + public Hl7.Fhir.Model.FhirDecimal? FactorElement { get { return _FactorElement; } set { _FactorElement = value; OnPropertyChanged("FactorElement"); } } - private Hl7.Fhir.Model.FhirDecimal _FactorElement; + private Hl7.Fhir.Model.FhirDecimal? _FactorElement; /// /// Multiply data by this before adding to origin @@ -158,13 +155,10 @@ public Hl7.Fhir.Model.FhirDecimal FactorElement [IgnoreDataMember] public decimal? Factor { - get { return FactorElement != null ? FactorElement.Value : null; } + get => _FactorElement?.Value; set { - if (value == null) - FactorElement = null; - else - FactorElement = new Hl7.Fhir.Model.FhirDecimal(value); + FactorElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Factor"); } } @@ -174,13 +168,13 @@ public decimal? Factor /// [FhirElement("lowerLimit", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal LowerLimitElement + public Hl7.Fhir.Model.FhirDecimal? LowerLimitElement { get { return _LowerLimitElement; } set { _LowerLimitElement = value; OnPropertyChanged("LowerLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _LowerLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _LowerLimitElement; /// /// Lower limit of detection @@ -189,13 +183,10 @@ public Hl7.Fhir.Model.FhirDecimal LowerLimitElement [IgnoreDataMember] public decimal? LowerLimit { - get { return LowerLimitElement != null ? LowerLimitElement.Value : null; } + get => _LowerLimitElement?.Value; set { - if (value == null) - LowerLimitElement = null; - else - LowerLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + LowerLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("LowerLimit"); } } @@ -205,13 +196,13 @@ public decimal? LowerLimit /// [FhirElement("upperLimit", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal UpperLimitElement + public Hl7.Fhir.Model.FhirDecimal? UpperLimitElement { get { return _UpperLimitElement; } set { _UpperLimitElement = value; OnPropertyChanged("UpperLimitElement"); } } - private Hl7.Fhir.Model.FhirDecimal _UpperLimitElement; + private Hl7.Fhir.Model.FhirDecimal? _UpperLimitElement; /// /// Upper limit of detection @@ -220,13 +211,10 @@ public Hl7.Fhir.Model.FhirDecimal UpperLimitElement [IgnoreDataMember] public decimal? UpperLimit { - get { return UpperLimitElement != null ? UpperLimitElement.Value : null; } + get => _UpperLimitElement?.Value; set { - if (value == null) - UpperLimitElement = null; - else - UpperLimitElement = new Hl7.Fhir.Model.FhirDecimal(value); + UpperLimitElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("UpperLimit"); } } @@ -237,13 +225,13 @@ public decimal? UpperLimit [FhirElement("dimensions", InSummary=true, Order=90)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.PositiveInt DimensionsElement + public Hl7.Fhir.Model.PositiveInt? DimensionsElement { get { return _DimensionsElement; } set { _DimensionsElement = value; OnPropertyChanged("DimensionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _DimensionsElement; + private Hl7.Fhir.Model.PositiveInt? _DimensionsElement; /// /// Number of sample points at each time point @@ -252,13 +240,10 @@ public Hl7.Fhir.Model.PositiveInt DimensionsElement [IgnoreDataMember] public int? Dimensions { - get { return DimensionsElement != null ? DimensionsElement.Value : null; } + get => _DimensionsElement?.Value; set { - if (value == null) - DimensionsElement = null; - else - DimensionsElement = new Hl7.Fhir.Model.PositiveInt(value); + DimensionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Dimensions"); } } @@ -268,28 +253,25 @@ public int? Dimensions /// [FhirElement("codeMap", Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical CodeMapElement + public Hl7.Fhir.Model.Canonical? CodeMapElement { get { return _CodeMapElement; } set { _CodeMapElement = value; OnPropertyChanged("CodeMapElement"); } } - private Hl7.Fhir.Model.Canonical _CodeMapElement; + private Hl7.Fhir.Model.Canonical? _CodeMapElement; /// /// Defines the codes used in the data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CodeMap + public string? CodeMap { - get { return CodeMapElement != null ? CodeMapElement.Value : null; } + get => _CodeMapElement?.Value; set { - if (value == null) - CodeMapElement = null; - else - CodeMapElement = new Hl7.Fhir.Model.Canonical(value); + CodeMapElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("CodeMap"); } } @@ -299,28 +281,25 @@ public string CodeMap /// [FhirElement("offsets", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString OffsetsElement + public Hl7.Fhir.Model.FhirString? OffsetsElement { get { return _OffsetsElement; } set { _OffsetsElement = value; OnPropertyChanged("OffsetsElement"); } } - private Hl7.Fhir.Model.FhirString _OffsetsElement; + private Hl7.Fhir.Model.FhirString? _OffsetsElement; /// /// Offsets, typically in time, at which data values were taken /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Offsets + public string? Offsets { - get { return OffsetsElement != null ? OffsetsElement.Value : null; } + get => _OffsetsElement?.Value; set { - if (value == null) - OffsetsElement = null; - else - OffsetsElement = new Hl7.Fhir.Model.FhirString(value); + OffsetsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Offsets"); } } @@ -330,52 +309,45 @@ public string Offsets /// [FhirElement("data", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString DataElement + public Hl7.Fhir.Model.FhirString? DataElement { get { return _DataElement; } set { _DataElement = value; OnPropertyChanged("DataElement"); } } - private Hl7.Fhir.Model.FhirString _DataElement; + private Hl7.Fhir.Model.FhirString? _DataElement; /// /// Decimal values with spaces, or "E" | "U" | "L", or another code /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Data + public string? Data { - get { return DataElement != null ? DataElement.Value : null; } + get => _DataElement?.Value; set { - if (value == null) - DataElement = null; - else - DataElement = new Hl7.Fhir.Model.FhirString(value); + DataElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Data"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SampledData; - - if (dest == null) - { + if(other is not SampledData dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Origin != null) dest.Origin = (Hl7.Fhir.Model.Quantity)Origin.DeepCopyInternal(); - if(IntervalElement != null) dest.IntervalElement = (Hl7.Fhir.Model.FhirDecimal)IntervalElement.DeepCopyInternal(); - if(IntervalUnitElement != null) dest.IntervalUnitElement = (Hl7.Fhir.Model.Code)IntervalUnitElement.DeepCopyInternal(); - if(FactorElement != null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)FactorElement.DeepCopyInternal(); - if(LowerLimitElement != null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)LowerLimitElement.DeepCopyInternal(); - if(UpperLimitElement != null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)UpperLimitElement.DeepCopyInternal(); - if(DimensionsElement != null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)DimensionsElement.DeepCopyInternal(); - if(CodeMapElement != null) dest.CodeMapElement = (Hl7.Fhir.Model.Canonical)CodeMapElement.DeepCopyInternal(); - if(OffsetsElement != null) dest.OffsetsElement = (Hl7.Fhir.Model.FhirString)OffsetsElement.DeepCopyInternal(); - if(DataElement != null) dest.DataElement = (Hl7.Fhir.Model.FhirString)DataElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = (Hl7.Fhir.Model.Quantity)_Origin.DeepCopyInternal(); + if(_IntervalElement is not null) dest.IntervalElement = (Hl7.Fhir.Model.FhirDecimal)_IntervalElement.DeepCopyInternal(); + if(_IntervalUnitElement is not null) dest.IntervalUnitElement = (Hl7.Fhir.Model.Code)_IntervalUnitElement.DeepCopyInternal(); + if(_FactorElement is not null) dest.FactorElement = (Hl7.Fhir.Model.FhirDecimal)_FactorElement.DeepCopyInternal(); + if(_LowerLimitElement is not null) dest.LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)_LowerLimitElement.DeepCopyInternal(); + if(_UpperLimitElement is not null) dest.UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)_UpperLimitElement.DeepCopyInternal(); + if(_DimensionsElement is not null) dest.DimensionsElement = (Hl7.Fhir.Model.PositiveInt)_DimensionsElement.DeepCopyInternal(); + if(_CodeMapElement is not null) dest.CodeMapElement = (Hl7.Fhir.Model.Canonical)_CodeMapElement.DeepCopyInternal(); + if(_OffsetsElement is not null) dest.OffsetsElement = (Hl7.Fhir.Model.FhirString)_OffsetsElement.DeepCopyInternal(); + if(_DataElement is not null) dest.DataElement = (Hl7.Fhir.Model.FhirString)_DataElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -387,97 +359,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SampledData; - if(otherT == null) return false; + if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Origin, otherT.Origin)) return false; - if(!comparer.Equals(IntervalElement, otherT.IntervalElement)) return false; - if(!comparer.Equals(IntervalUnitElement, otherT.IntervalUnitElement)) return false; - if(!comparer.Equals(FactorElement, otherT.FactorElement)) return false; - if(!comparer.Equals(LowerLimitElement, otherT.LowerLimitElement)) return false; - if(!comparer.Equals(UpperLimitElement, otherT.UpperLimitElement)) return false; - if(!comparer.Equals(DimensionsElement, otherT.DimensionsElement)) return false; - if(!comparer.Equals(CodeMapElement, otherT.CodeMapElement)) return false; - if(!comparer.Equals(OffsetsElement, otherT.OffsetsElement)) return false; - if(!comparer.Equals(DataElement, otherT.DataElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + if(!comparer.Equals(_IntervalElement, otherT._IntervalElement)) return false; + if(!comparer.Equals(_IntervalUnitElement, otherT._IntervalUnitElement)) return false; + if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; + if(!comparer.Equals(_LowerLimitElement, otherT._LowerLimitElement)) return false; + if(!comparer.Equals(_UpperLimitElement, otherT._UpperLimitElement)) return false; + if(!comparer.Equals(_DimensionsElement, otherT._DimensionsElement)) return false; + if(!comparer.Equals(_CodeMapElement, otherT._CodeMapElement)) return false; + if(!comparer.Equals(_OffsetsElement, otherT._OffsetsElement)) return false; + if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "origin": - value = Origin; - return Origin is not null; + value = _Origin; + return _Origin is not null; case "interval": - value = IntervalElement; - return IntervalElement is not null; + value = _IntervalElement; + return _IntervalElement is not null; case "intervalUnit": - value = IntervalUnitElement; - return IntervalUnitElement is not null; + value = _IntervalUnitElement; + return _IntervalUnitElement is not null; case "factor": - value = FactorElement; - return FactorElement is not null; + value = _FactorElement; + return _FactorElement is not null; case "lowerLimit": - value = LowerLimitElement; - return LowerLimitElement is not null; + value = _LowerLimitElement; + return _LowerLimitElement is not null; case "upperLimit": - value = UpperLimitElement; - return UpperLimitElement is not null; + value = _UpperLimitElement; + return _UpperLimitElement is not null; case "dimensions": - value = DimensionsElement; - return DimensionsElement is not null; + value = _DimensionsElement; + return _DimensionsElement is not null; case "codeMap": - value = CodeMapElement; - return CodeMapElement is not null; + value = _CodeMapElement; + return _CodeMapElement is not null; case "offsets": - value = OffsetsElement; - return OffsetsElement is not null; + value = _OffsetsElement; + return _OffsetsElement is not null; case "data": - value = DataElement; - return DataElement is not null; + value = _DataElement; + return _DataElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "origin": - Origin = (Hl7.Fhir.Model.Quantity)value; + Origin = (Hl7.Fhir.Model.Quantity?)value; return this; case "interval": - IntervalElement = (Hl7.Fhir.Model.FhirDecimal)value; + IntervalElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "intervalUnit": - IntervalUnitElement = (Hl7.Fhir.Model.Code)value; + IntervalUnitElement = (Hl7.Fhir.Model.Code?)value; return this; case "factor": - FactorElement = (Hl7.Fhir.Model.FhirDecimal)value; + FactorElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "lowerLimit": - LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + LowerLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "upperLimit": - UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal)value; + UpperLimitElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "dimensions": - DimensionsElement = (Hl7.Fhir.Model.PositiveInt)value; + DimensionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "codeMap": - CodeMapElement = (Hl7.Fhir.Model.Canonical)value; + CodeMapElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "offsets": - OffsetsElement = (Hl7.Fhir.Model.FhirString)value; + OffsetsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "data": - DataElement = (Hl7.Fhir.Model.FhirString)value; + DataElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -488,16 +460,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Origin is not null) yield return new KeyValuePair("origin",Origin); - if (IntervalElement is not null) yield return new KeyValuePair("interval",IntervalElement); - if (IntervalUnitElement is not null) yield return new KeyValuePair("intervalUnit",IntervalUnitElement); - if (FactorElement is not null) yield return new KeyValuePair("factor",FactorElement); - if (LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",LowerLimitElement); - if (UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",UpperLimitElement); - if (DimensionsElement is not null) yield return new KeyValuePair("dimensions",DimensionsElement); - if (CodeMapElement is not null) yield return new KeyValuePair("codeMap",CodeMapElement); - if (OffsetsElement is not null) yield return new KeyValuePair("offsets",OffsetsElement); - if (DataElement is not null) yield return new KeyValuePair("data",DataElement); + if (_Origin is not null) yield return new KeyValuePair("origin",_Origin); + if (_IntervalElement is not null) yield return new KeyValuePair("interval",_IntervalElement); + if (_IntervalUnitElement is not null) yield return new KeyValuePair("intervalUnit",_IntervalUnitElement); + if (_FactorElement is not null) yield return new KeyValuePair("factor",_FactorElement); + if (_LowerLimitElement is not null) yield return new KeyValuePair("lowerLimit",_LowerLimitElement); + if (_UpperLimitElement is not null) yield return new KeyValuePair("upperLimit",_UpperLimitElement); + if (_DimensionsElement is not null) yield return new KeyValuePair("dimensions",_DimensionsElement); + if (_CodeMapElement is not null) yield return new KeyValuePair("codeMap",_CodeMapElement); + if (_OffsetsElement is not null) yield return new KeyValuePair("offsets",_OffsetsElement); + if (_DataElement is not null) yield return new KeyValuePair("data",_DataElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs index 745d961ad..35c133e16 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -64,24 +67,24 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Whether this schedule is in active use. /// [FhirElement("active", InSummary=true, IsModifier=true, Order=100, FiveWs="FiveWs.status")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ActiveElement + public Hl7.Fhir.Model.FhirBoolean? ActiveElement { get { return _ActiveElement; } set { _ActiveElement = value; OnPropertyChanged("ActiveElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ActiveElement; + private Hl7.Fhir.Model.FhirBoolean? _ActiveElement; /// /// Whether this schedule is in active use @@ -90,13 +93,10 @@ public Hl7.Fhir.Model.FhirBoolean ActiveElement [IgnoreDataMember] public bool? Active { - get { return ActiveElement != null ? ActiveElement.Value : null; } + get => _ActiveElement?.Value; set { - if (value == null) - ActiveElement = null; - else - ActiveElement = new Hl7.Fhir.Model.FhirBoolean(value); + ActiveElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Active"); } } @@ -110,11 +110,11 @@ public bool? Active [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// Specific service. @@ -125,11 +125,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// Type of specialty needed. @@ -140,39 +140,36 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// Human-readable label. /// [FhirElement("name", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -187,52 +184,49 @@ public string Name [DataMember] public List Actor { - get { if(_Actor==null) _Actor = new List(); return _Actor; } + get => _Actor ?? new List(); set { _Actor = value; OnPropertyChanged("Actor"); } } - private List _Actor; + private List? _Actor; /// /// Period of time covered by schedule. /// [FhirElement("planningHorizon", InSummary=true, Order=160, FiveWs="FiveWs.planned")] [DataMember] - public Hl7.Fhir.Model.Period PlanningHorizon + public Hl7.Fhir.Model.Period? PlanningHorizon { get { return _PlanningHorizon; } set { _PlanningHorizon = value; OnPropertyChanged("PlanningHorizon"); } } - private Hl7.Fhir.Model.Period _PlanningHorizon; + private Hl7.Fhir.Model.Period? _PlanningHorizon; /// /// Comments on availability. /// [FhirElement("comment", Order=170)] [DataMember] - public Hl7.Fhir.Model.Markdown CommentElement + public Hl7.Fhir.Model.Markdown? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.Markdown _CommentElement; + private Hl7.Fhir.Model.Markdown? _CommentElement; /// /// Comments on availability /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.Markdown(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Comment"); } } @@ -241,23 +235,19 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Schedule; - - if (dest == null) - { + if(other is not Schedule dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ActiveElement != null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)ActiveElement.DeepCopyInternal(); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Actor.Any()) dest.Actor = new List(Actor.DeepCopyInternal()); - if(PlanningHorizon != null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)PlanningHorizon.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ActiveElement is not null) dest.ActiveElement = (Hl7.Fhir.Model.FhirBoolean)_ActiveElement.DeepCopyInternal(); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = new List(_Actor.DeepCopyInternal()); + if(_PlanningHorizon is not null) dest.PlanningHorizon = (Hl7.Fhir.Model.Period)_PlanningHorizon.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.Markdown)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -269,90 +259,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Schedule; - if(otherT == null) return false; + if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(ActiveElement, otherT.ActiveElement)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Actor, otherT.Actor)) return false; - if(!comparer.Equals(PlanningHorizon, otherT.PlanningHorizon)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "active": - value = ActiveElement; - return ActiveElement is not null; + value = _ActiveElement; + return _ActiveElement is not null; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "actor": - value = Actor; - return Actor?.Any() == true; + value = _Actor; + return _Actor?.Any() == true; case "planningHorizon": - value = PlanningHorizon; - return PlanningHorizon is not null; + value = _PlanningHorizon; + return _PlanningHorizon is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "active": - ActiveElement = (Hl7.Fhir.Model.FhirBoolean)value; + ActiveElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "actor": - Actor = (List)value; + Actor = (List?)value!; return this; case "planningHorizon": - PlanningHorizon = (Hl7.Fhir.Model.Period)value; + PlanningHorizon = (Hl7.Fhir.Model.Period?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.Markdown)value; + CommentElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -363,15 +353,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ActiveElement is not null) yield return new KeyValuePair("active",ActiveElement); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Actor?.Any() == true) yield return new KeyValuePair("actor",Actor); - if (PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",PlanningHorizon); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ActiveElement is not null) yield return new KeyValuePair("active",_ActiveElement); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Actor?.Any() == true) yield return new KeyValuePair("actor",_Actor); + if (_PlanningHorizon is not null) yield return new KeyValuePair("planningHorizon",_PlanningHorizon); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs index 149fa2796..a5c799c1c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -110,28 +113,25 @@ public partial class ComponentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("definition", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical DefinitionElement + public Hl7.Fhir.Model.Canonical? DefinitionElement { get { return _DefinitionElement; } set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } - private Hl7.Fhir.Model.Canonical _DefinitionElement; + private Hl7.Fhir.Model.Canonical? _DefinitionElement; /// /// Defines how the part works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Definition + public string? Definition { - get { return DefinitionElement != null ? DefinitionElement.Value : null; } + get => _DefinitionElement?.Value; set { - if (value == null) - DefinitionElement = null; - else - DefinitionElement = new Hl7.Fhir.Model.Canonical(value); + DefinitionElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Definition"); } } @@ -142,44 +142,37 @@ public string Definition [FhirElement("expression", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// Subexpression relative to main expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ComponentComponent; - - if (dest == null) - { + if(other is not ComponentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DefinitionElement != null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)DefinitionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); + if(_DefinitionElement is not null) dest.DefinitionElement = (Hl7.Fhir.Model.Canonical)_DefinitionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -191,41 +184,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ComponentComponent; - if(otherT == null) return false; + if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DefinitionElement, otherT.DefinitionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "definition": - value = DefinitionElement; - return DefinitionElement is not null; + value = _DefinitionElement; + return _DefinitionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "definition": - DefinitionElement = (Hl7.Fhir.Model.Canonical)value; + DefinitionElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -236,8 +229,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DefinitionElement is not null) yield return new KeyValuePair("definition",DefinitionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); + if (_DefinitionElement is not null) yield return new KeyValuePair("definition",_DefinitionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); } } @@ -248,28 +241,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this search parameter, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -282,39 +272,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the search parameter. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -326,13 +313,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this search parameter (computer friendly). @@ -340,28 +327,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this search parameter (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -371,28 +355,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this search parameter (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -402,28 +383,25 @@ public string Title /// [FhirElement("derivedFrom", Order=150)] [DataMember] - public Hl7.Fhir.Model.Canonical DerivedFromElement + public Hl7.Fhir.Model.Canonical? DerivedFromElement { get { return _DerivedFromElement; } set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private Hl7.Fhir.Model.Canonical _DerivedFromElement; + private Hl7.Fhir.Model.Canonical? _DerivedFromElement; /// /// Original definition for the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DerivedFrom + public string? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Value : null; } + get => _DerivedFromElement?.Value; set { - if (value == null) - DerivedFromElement = null; - else - DerivedFromElement = new Hl7.Fhir.Model.Canonical(value); + DerivedFromElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("DerivedFrom"); } } @@ -436,13 +414,13 @@ public string DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -451,13 +429,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -467,13 +442,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -482,13 +457,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -498,28 +470,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -529,28 +498,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -563,11 +529,11 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the search parameter. @@ -575,28 +541,25 @@ public List Contact [FhirElement("description", InSummary=true, Order=210)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the search parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -609,11 +572,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for search parameter (if applicable). @@ -624,39 +587,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this search parameter is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this search parameter is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -666,28 +626,25 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -697,28 +654,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -729,28 +683,25 @@ public string CopyrightLabel [FhirElement("code", InSummary=true, Order=270)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Recommended name for parameter in search url /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -765,24 +716,24 @@ public string Code [DataMember] public List> BaseElement { - get { if(_BaseElement==null) _BaseElement = new List>(); return _BaseElement; } + get => _BaseElement ?? new List>(); set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private List> _BaseElement; + private List>? _BaseElement; /// /// The resource type(s) this search parameter applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Base + public IEnumerable? Base { - get { return BaseElement != null ? BaseElement.Select(elem => elem.Value) : null; } + get => _BaseElement?.Select(elem => elem.Value); set { if (value == null) - BaseElement = null; + BaseElement = null!; else BaseElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Base"); @@ -797,13 +748,13 @@ public IEnumerable Base [Binding("SearchParamType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// number | date | string | token | reference | composite | quantity | uri | special @@ -812,13 +763,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchParamType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -828,28 +776,25 @@ public Hl7.Fhir.Model.SearchParamType? Type /// [FhirElement("expression", Order=300)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// FHIRPath expression that extracts the values /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -861,13 +806,13 @@ public string Expression [DeclaredType(Type = typeof(Code))] [Binding("SearchProcessingModeType")] [DataMember] - public Code ProcessingModeElement + public Code? ProcessingModeElement { get { return _ProcessingModeElement; } set { _ProcessingModeElement = value; OnPropertyChanged("ProcessingModeElement"); } } - private Code _ProcessingModeElement; + private Code? _ProcessingModeElement; /// /// normal | phonetic | other @@ -876,13 +821,10 @@ public Code ProcessingM [IgnoreDataMember] public Hl7.Fhir.Model.SearchParameter.SearchProcessingModeType? ProcessingMode { - get { return ProcessingModeElement != null ? ProcessingModeElement.Value : null; } + get => _ProcessingModeElement?.Value; set { - if (value == null) - ProcessingModeElement = null; - else - ProcessingModeElement = new Code(value); + ProcessingModeElement = value is null ? null : new Code(value); OnPropertyChanged("ProcessingMode"); } } @@ -892,28 +834,25 @@ public Hl7.Fhir.Model.SearchParameter.SearchProcessingModeType? ProcessingMode /// [FhirElement("constraint", Order=320)] [DataMember] - public Hl7.Fhir.Model.FhirString ConstraintElement + public Hl7.Fhir.Model.FhirString? ConstraintElement { get { return _ConstraintElement; } set { _ConstraintElement = value; OnPropertyChanged("ConstraintElement"); } } - private Hl7.Fhir.Model.FhirString _ConstraintElement; + private Hl7.Fhir.Model.FhirString? _ConstraintElement; /// /// FHIRPath expression that constraints the usage of this SearchParamete /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Constraint + public string? Constraint { - get { return ConstraintElement != null ? ConstraintElement.Value : null; } + get => _ConstraintElement?.Value; set { - if (value == null) - ConstraintElement = null; - else - ConstraintElement = new Hl7.Fhir.Model.FhirString(value); + ConstraintElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Constraint"); } } @@ -928,24 +867,24 @@ public string Constraint [DataMember] public List> TargetElement { - get { if(_TargetElement==null) _TargetElement = new List>(); return _TargetElement; } + get => _TargetElement ?? new List>(); set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } - private List> _TargetElement; + private List>? _TargetElement; /// /// Types of resource (if a resource reference) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Target + public IEnumerable? Target { - get { return TargetElement != null ? TargetElement.Select(elem => elem.Value) : null; } + get => _TargetElement?.Select(elem => elem.Value); set { if (value == null) - TargetElement = null; + TargetElement = null!; else TargetElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Target"); @@ -957,13 +896,13 @@ public IEnumerable Target /// [FhirElement("multipleOr", Order=340)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleOrElement + public Hl7.Fhir.Model.FhirBoolean? MultipleOrElement { get { return _MultipleOrElement; } set { _MultipleOrElement = value; OnPropertyChanged("MultipleOrElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleOrElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleOrElement; /// /// Allow multiple values per parameter (or) @@ -972,13 +911,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleOrElement [IgnoreDataMember] public bool? MultipleOr { - get { return MultipleOrElement != null ? MultipleOrElement.Value : null; } + get => _MultipleOrElement?.Value; set { - if (value == null) - MultipleOrElement = null; - else - MultipleOrElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleOrElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleOr"); } } @@ -988,13 +924,13 @@ public bool? MultipleOr /// [FhirElement("multipleAnd", Order=350)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean MultipleAndElement + public Hl7.Fhir.Model.FhirBoolean? MultipleAndElement { get { return _MultipleAndElement; } set { _MultipleAndElement = value; OnPropertyChanged("MultipleAndElement"); } } - private Hl7.Fhir.Model.FhirBoolean _MultipleAndElement; + private Hl7.Fhir.Model.FhirBoolean? _MultipleAndElement; /// /// Allow multiple parameters (and) @@ -1003,13 +939,10 @@ public Hl7.Fhir.Model.FhirBoolean MultipleAndElement [IgnoreDataMember] public bool? MultipleAnd { - get { return MultipleAndElement != null ? MultipleAndElement.Value : null; } + get => _MultipleAndElement?.Value; set { - if (value == null) - MultipleAndElement = null; - else - MultipleAndElement = new Hl7.Fhir.Model.FhirBoolean(value); + MultipleAndElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("MultipleAnd"); } } @@ -1024,24 +957,24 @@ public bool? MultipleAnd [DataMember] public List> ComparatorElement { - get { if(_ComparatorElement==null) _ComparatorElement = new List>(); return _ComparatorElement; } + get => _ComparatorElement ?? new List>(); set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private List> _ComparatorElement; + private List>? _ComparatorElement; /// /// eq | ne | gt | lt | ge | le | sa | eb | ap /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comparator + public IEnumerable? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Select(elem => elem.Value) : null; } + get => _ComparatorElement?.Select(elem => elem.Value); set { if (value == null) - ComparatorElement = null; + ComparatorElement = null!; else ComparatorElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Comparator"); @@ -1058,24 +991,24 @@ public IEnumerable Comparator [DataMember] public List> ModifierElement { - get { if(_ModifierElement==null) _ModifierElement = new List>(); return _ModifierElement; } + get => _ModifierElement ?? new List>(); set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } - private List> _ModifierElement; + private List>? _ModifierElement; /// /// missing | exact | contains | not | text | in | not-in | below | above | type | identifier | of-type | code-text | text-advanced | iterate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Modifier + public IEnumerable? Modifier { - get { return ModifierElement != null ? ModifierElement.Select(elem => elem.Value) : null; } + get => _ModifierElement?.Select(elem => elem.Value); set { if (value == null) - ModifierElement = null; + ModifierElement = null!; else ModifierElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Modifier"); @@ -1090,24 +1023,24 @@ public IEnumerable Modifier [DataMember] public List ChainElement { - get { if(_ChainElement==null) _ChainElement = new List(); return _ChainElement; } + get => _ChainElement ?? new List(); set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } - private List _ChainElement; + private List? _ChainElement; /// /// Chained names supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Chain + public IEnumerable? Chain { - get { return ChainElement != null ? ChainElement.Select(elem => elem.Value) : null; } + get => _ChainElement?.Select(elem => elem.Value); set { if (value == null) - ChainElement = null; + ChainElement = null!; else ChainElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Chain"); @@ -1122,55 +1055,51 @@ public IEnumerable Chain [DataMember] public List Component { - get { if(_Component==null) _Component = new List(); return _Component; } + get => _Component ?? new List(); set { _Component = value; OnPropertyChanged("Component"); } } - private List _Component; + private List? _Component; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SearchParameter; - - if (dest == null) - { + if(other is not SearchParameter dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromElement != null) dest.DerivedFromElement = (Hl7.Fhir.Model.Canonical)DerivedFromElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(BaseElement.Any()) dest.BaseElement = new List>(BaseElement.DeepCopyInternal()); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(ProcessingModeElement != null) dest.ProcessingModeElement = (Code)ProcessingModeElement.DeepCopyInternal(); - if(ConstraintElement != null) dest.ConstraintElement = (Hl7.Fhir.Model.FhirString)ConstraintElement.DeepCopyInternal(); - if(TargetElement.Any()) dest.TargetElement = new List>(TargetElement.DeepCopyInternal()); - if(MultipleOrElement != null) dest.MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)MultipleOrElement.DeepCopyInternal(); - if(MultipleAndElement != null) dest.MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)MultipleAndElement.DeepCopyInternal(); - if(ComparatorElement.Any()) dest.ComparatorElement = new List>(ComparatorElement.DeepCopyInternal()); - if(ModifierElement.Any()) dest.ModifierElement = new List>(ModifierElement.DeepCopyInternal()); - if(ChainElement.Any()) dest.ChainElement = new List(ChainElement.DeepCopyInternal()); - if(Component.Any()) dest.Component = new List(Component.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = (Hl7.Fhir.Model.Canonical)_DerivedFromElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = new List>(_BaseElement.DeepCopyInternal()); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_ProcessingModeElement is not null) dest.ProcessingModeElement = (Code)_ProcessingModeElement.DeepCopyInternal(); + if(_ConstraintElement is not null) dest.ConstraintElement = (Hl7.Fhir.Model.FhirString)_ConstraintElement.DeepCopyInternal(); + if(_TargetElement is not null) dest.TargetElement = new List>(_TargetElement.DeepCopyInternal()); + if(_MultipleOrElement is not null) dest.MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleOrElement.DeepCopyInternal(); + if(_MultipleAndElement is not null) dest.MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)_MultipleAndElement.DeepCopyInternal(); + if(_ComparatorElement is not null) dest.ComparatorElement = new List>(_ComparatorElement.DeepCopyInternal()); + if(_ModifierElement is not null) dest.ModifierElement = new List>(_ModifierElement.DeepCopyInternal()); + if(_ChainElement is not null) dest.ChainElement = new List(_ChainElement.DeepCopyInternal()); + if(_Component is not null) dest.Component = new List(_Component.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1182,244 +1111,244 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SearchParameter; - if(otherT == null) return false; + if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(BaseElement, otherT.BaseElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(ProcessingModeElement, otherT.ProcessingModeElement)) return false; - if(!comparer.Equals(ConstraintElement, otherT.ConstraintElement)) return false; - if(!comparer.ListEquals(TargetElement, otherT.TargetElement)) return false; - if(!comparer.Equals(MultipleOrElement, otherT.MultipleOrElement)) return false; - if(!comparer.Equals(MultipleAndElement, otherT.MultipleAndElement)) return false; - if(!comparer.ListEquals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.ListEquals(ModifierElement, otherT.ModifierElement)) return false; - if(!comparer.ListEquals(ChainElement, otherT.ChainElement)) return false; - if(!comparer.ListEquals(Component, otherT.Component)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_BaseElement, otherT._BaseElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_ProcessingModeElement, otherT._ProcessingModeElement)) return false; + if(!comparer.Equals(_ConstraintElement, otherT._ConstraintElement)) return false; + if(!comparer.ListEquals(_TargetElement, otherT._TargetElement)) return false; + if(!comparer.Equals(_MultipleOrElement, otherT._MultipleOrElement)) return false; + if(!comparer.Equals(_MultipleAndElement, otherT._MultipleAndElement)) return false; + if(!comparer.ListEquals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; + if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; + if(!comparer.ListEquals(_Component, otherT._Component)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement is not null; + value = _DerivedFromElement; + return _DerivedFromElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "base": - value = BaseElement; - return BaseElement?.Any() == true; + value = _BaseElement; + return _BaseElement?.Any() == true; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "processingMode": - value = ProcessingModeElement; - return ProcessingModeElement is not null; + value = _ProcessingModeElement; + return _ProcessingModeElement is not null; case "constraint": - value = ConstraintElement; - return ConstraintElement is not null; + value = _ConstraintElement; + return _ConstraintElement is not null; case "target": - value = TargetElement; - return TargetElement?.Any() == true; + value = _TargetElement; + return _TargetElement?.Any() == true; case "multipleOr": - value = MultipleOrElement; - return MultipleOrElement is not null; + value = _MultipleOrElement; + return _MultipleOrElement is not null; case "multipleAnd": - value = MultipleAndElement; - return MultipleAndElement is not null; + value = _MultipleAndElement; + return _MultipleAndElement is not null; case "comparator": - value = ComparatorElement; - return ComparatorElement?.Any() == true; + value = _ComparatorElement; + return _ComparatorElement?.Any() == true; case "modifier": - value = ModifierElement; - return ModifierElement?.Any() == true; + value = _ModifierElement; + return _ModifierElement?.Any() == true; case "chain": - value = ChainElement; - return ChainElement?.Any() == true; + value = _ChainElement; + return _ChainElement?.Any() == true; case "component": - value = Component; - return Component?.Any() == true; + value = _Component; + return _Component?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (Hl7.Fhir.Model.Canonical)value; + DerivedFromElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "base": - BaseElement = (List>)value; + BaseElement = (List>?)value!; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "processingMode": - ProcessingModeElement = (Code)value; + ProcessingModeElement = (Code?)value; return this; case "constraint": - ConstraintElement = (Hl7.Fhir.Model.FhirString)value; + ConstraintElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "target": - TargetElement = (List>)value; + TargetElement = (List>?)value!; return this; case "multipleOr": - MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleOrElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "multipleAnd": - MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean)value; + MultipleAndElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comparator": - ComparatorElement = (List>)value; + ComparatorElement = (List>?)value!; return this; case "modifier": - ModifierElement = (List>)value; + ModifierElement = (List>?)value!; return this; case "chain": - ChainElement = (List)value; + ChainElement = (List?)value!; return this; case "component": - Component = (List)value; + Component = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1430,37 +1359,37 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (BaseElement?.Any() == true) yield return new KeyValuePair("base",BaseElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (ProcessingModeElement is not null) yield return new KeyValuePair("processingMode",ProcessingModeElement); - if (ConstraintElement is not null) yield return new KeyValuePair("constraint",ConstraintElement); - if (TargetElement?.Any() == true) yield return new KeyValuePair("target",TargetElement); - if (MultipleOrElement is not null) yield return new KeyValuePair("multipleOr",MultipleOrElement); - if (MultipleAndElement is not null) yield return new KeyValuePair("multipleAnd",MultipleAndElement); - if (ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",ComparatorElement); - if (ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",ModifierElement); - if (ChainElement?.Any() == true) yield return new KeyValuePair("chain",ChainElement); - if (Component?.Any() == true) yield return new KeyValuePair("component",Component); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromElement is not null) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_BaseElement?.Any() == true) yield return new KeyValuePair("base",_BaseElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_ProcessingModeElement is not null) yield return new KeyValuePair("processingMode",_ProcessingModeElement); + if (_ConstraintElement is not null) yield return new KeyValuePair("constraint",_ConstraintElement); + if (_TargetElement?.Any() == true) yield return new KeyValuePair("target",_TargetElement); + if (_MultipleOrElement is not null) yield return new KeyValuePair("multipleOr",_MultipleOrElement); + if (_MultipleAndElement is not null) yield return new KeyValuePair("multipleAnd",_MultipleAndElement); + if (_ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",_ModifierElement); + if (_ChainElement?.Any() == true) yield return new KeyValuePair("chain",_ChainElement); + if (_Component?.Any() == true) yield return new KeyValuePair("component",_Component); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs index 54c8a14ff..73957b85b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -81,13 +84,13 @@ public partial class OrderDetailComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("parameterFocus", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableReference ParameterFocus + public Hl7.Fhir.Model.CodeableReference? ParameterFocus { get { return _ParameterFocus; } set { _ParameterFocus = value; OnPropertyChanged("ParameterFocus"); } } - private Hl7.Fhir.Model.CodeableReference _ParameterFocus; + private Hl7.Fhir.Model.CodeableReference? _ParameterFocus; /// /// The parameter details for the service being requested. @@ -97,24 +100,20 @@ public Hl7.Fhir.Model.CodeableReference ParameterFocus [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; protected internal override void CopyToInternal(Base other) { - var dest = other as OrderDetailComponent; - - if (dest == null) - { + if(other is not OrderDetailComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ParameterFocus != null) dest.ParameterFocus = (Hl7.Fhir.Model.CodeableReference)ParameterFocus.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); + if(_ParameterFocus is not null) dest.ParameterFocus = (Hl7.Fhir.Model.CodeableReference)_ParameterFocus.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -126,41 +125,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrderDetailComponent; - if(otherT == null) return false; + if(other is not OrderDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ParameterFocus, otherT.ParameterFocus)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ParameterFocus, otherT._ParameterFocus)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "parameterFocus": - value = ParameterFocus; - return ParameterFocus is not null; + value = _ParameterFocus; + return _ParameterFocus is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "parameterFocus": - ParameterFocus = (Hl7.Fhir.Model.CodeableReference)value; + ParameterFocus = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; default: return base.SetValue(key, value); @@ -171,8 +170,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ParameterFocus is not null) yield return new KeyValuePair("parameterFocus",ParameterFocus); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); + if (_ParameterFocus is not null) yield return new KeyValuePair("parameterFocus",_ParameterFocus); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); } } @@ -197,13 +196,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [Binding("ServiceRequestOrderDetailParameterCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// The value for the order detail. @@ -213,26 +212,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Period))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -244,41 +239,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -289,8 +284,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -319,25 +314,21 @@ public partial class PatientInstructionComponent : Hl7.Fhir.Model.BackboneElemen [References("DocumentReference")] [AllowedTypes(typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Instruction + public Hl7.Fhir.Model.DataType? Instruction { get { return _Instruction; } set { _Instruction = value; OnPropertyChanged("Instruction"); } } - private Hl7.Fhir.Model.DataType _Instruction; + private Hl7.Fhir.Model.DataType? _Instruction; protected internal override void CopyToInternal(Base other) { - var dest = other as PatientInstructionComponent; - - if (dest == null) - { + if(other is not PatientInstructionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Instruction != null) dest.Instruction = (Hl7.Fhir.Model.DataType)Instruction.DeepCopyInternal(); + if(_Instruction is not null) dest.Instruction = (Hl7.Fhir.Model.DataType)_Instruction.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -349,34 +340,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PatientInstructionComponent; - if(otherT == null) return false; + if(other is not PatientInstructionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Instruction, otherT.Instruction)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instruction, otherT._Instruction)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "instruction": - value = Instruction; - return Instruction is not null; + value = _Instruction; + return _Instruction is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "instruction": - Instruction = (Hl7.Fhir.Model.DataType)value; + Instruction = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -387,7 +378,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Instruction is not null) yield return new KeyValuePair("instruction",Instruction); + if (_Instruction is not null) yield return new KeyValuePair("instruction",_Instruction); } } @@ -400,11 +391,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Instantiates FHIR protocol or definition. @@ -414,24 +405,24 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get { if(_InstantiatesCanonicalElement==null) _InstantiatesCanonicalElement = new List(); return _InstantiatesCanonicalElement; } + get => _InstantiatesCanonicalElement ?? new List(); set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private List _InstantiatesCanonicalElement; + private List? _InstantiatesCanonicalElement; /// /// Instantiates FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesCanonical + public IEnumerable? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Select(elem => elem.Value) : null; } + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesCanonicalElement = null; + InstantiatesCanonicalElement = null!; else InstantiatesCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("InstantiatesCanonical"); @@ -446,24 +437,24 @@ public IEnumerable InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get { if(_InstantiatesUriElement==null) _InstantiatesUriElement = new List(); return _InstantiatesUriElement; } + get => _InstantiatesUriElement ?? new List(); set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private List _InstantiatesUriElement; + private List? _InstantiatesUriElement; /// /// Instantiates external protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable InstantiatesUri + public IEnumerable? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Select(elem => elem.Value) : null; } + get => _InstantiatesUriElement?.Select(elem => elem.Value); set { if (value == null) - InstantiatesUriElement = null; + InstantiatesUriElement = null!; else InstantiatesUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("InstantiatesUri"); @@ -480,11 +471,11 @@ public IEnumerable InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// What request replaces. @@ -496,24 +487,24 @@ public List BasedOn [DataMember] public List Replaces { - get { if(_Replaces==null) _Replaces = new List(); return _Replaces; } + get => _Replaces ?? new List(); set { _Replaces = value; OnPropertyChanged("Replaces"); } } - private List _Replaces; + private List? _Replaces; /// /// Composite Request ID. /// [FhirElement("requisition", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Identifier Requisition + public Hl7.Fhir.Model.Identifier? Requisition { get { return _Requisition; } set { _Requisition = value; OnPropertyChanged("Requisition"); } } - private Hl7.Fhir.Model.Identifier _Requisition; + private Hl7.Fhir.Model.Identifier? _Requisition; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown. @@ -523,13 +514,13 @@ public Hl7.Fhir.Model.Identifier Requisition [Binding("ServiceRequestStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | on-hold | revoked | completed | entered-in-error | unknown @@ -538,13 +529,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -557,13 +545,13 @@ public Hl7.Fhir.Model.RequestStatus? Status [Binding("ServiceRequestIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// proposal | plan | directive | order + @@ -572,13 +560,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -592,11 +577,11 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// routine | urgent | asap | stat. @@ -605,13 +590,13 @@ public List Category [DeclaredType(Type = typeof(Code))] [Binding("ServiceRequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -620,13 +605,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -636,13 +618,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if service/procedure should not be performed @@ -651,13 +633,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -668,13 +647,13 @@ public bool? DoNotPerform [FhirElement("code", InSummary=true, Order=200, FiveWs="FiveWs.what[x]")] [Binding("ServiceRequestCode")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Code + public Hl7.Fhir.Model.CodeableReference? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableReference _Code; + private Hl7.Fhir.Model.CodeableReference? _Code; /// /// Additional order information. @@ -684,11 +663,11 @@ public Hl7.Fhir.Model.CodeableReference Code [DataMember] public List OrderDetail { - get { if(_OrderDetail==null) _OrderDetail = new List(); return _OrderDetail; } + get => _OrderDetail ?? new List(); set { _OrderDetail = value; OnPropertyChanged("OrderDetail"); } } - private List _OrderDetail; + private List? _OrderDetail; /// /// Service amount. @@ -697,13 +676,13 @@ public List OrderDetail [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.Range))] [DataMember] - public Hl7.Fhir.Model.DataType Quantity + public Hl7.Fhir.Model.DataType? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.DataType _Quantity; + private Hl7.Fhir.Model.DataType? _Quantity; /// /// Individual or Entity the service is ordered for. @@ -713,13 +692,13 @@ public Hl7.Fhir.Model.DataType Quantity [References("Patient","Group","Location","Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// What the service request is about, when it is not about the subject of record. @@ -731,11 +710,11 @@ public Hl7.Fhir.Model.ResourceReference Subject [DataMember] public List Focus { - get { if(_Focus==null) _Focus = new List(); return _Focus; } + get => _Focus ?? new List(); set { _Focus = value; OnPropertyChanged("Focus"); } } - private List _Focus; + private List? _Focus; /// /// Encounter in which the request was created. @@ -744,13 +723,13 @@ public List Focus [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When service should occur. @@ -759,13 +738,13 @@ public Hl7.Fhir.Model.ResourceReference Encounter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// Preconditions for service. @@ -775,41 +754,38 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType AsNeeded + public Hl7.Fhir.Model.DataType? AsNeeded { get { return _AsNeeded; } set { _AsNeeded = value; OnPropertyChanged("AsNeeded"); } } - private Hl7.Fhir.Model.DataType _AsNeeded; + private Hl7.Fhir.Model.DataType? _AsNeeded; /// /// Date request signed. /// [FhirElement("authoredOn", InSummary=true, Order=280, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Date request signed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -821,13 +797,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Performer role. @@ -835,13 +811,13 @@ public Hl7.Fhir.Model.ResourceReference Requester [FhirElement("performerType", InSummary=true, Order=300, FiveWs="FiveWs.actor")] [Binding("ServiceRequestParticipantRole")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PerformerType + public Hl7.Fhir.Model.CodeableConcept? PerformerType { get { return _PerformerType; } set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private Hl7.Fhir.Model.CodeableConcept _PerformerType; + private Hl7.Fhir.Model.CodeableConcept? _PerformerType; /// /// Requested performer. @@ -853,11 +829,11 @@ public Hl7.Fhir.Model.CodeableConcept PerformerType [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Requested location. @@ -868,11 +844,11 @@ public List Performer [DataMember] public List Location { - get { if(_Location==null) _Location = new List(); return _Location; } + get => _Location ?? new List(); set { _Location = value; OnPropertyChanged("Location"); } } - private List _Location; + private List? _Location; /// /// Explanation/Justification for procedure or service. @@ -883,11 +859,11 @@ public List Location [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Associated insurance coverage. @@ -899,11 +875,11 @@ public List Reason [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Additional clinical information. @@ -913,11 +889,11 @@ public List Insurance [DataMember] public List SupportingInfo { - get { if(_SupportingInfo==null) _SupportingInfo = new List(); return _SupportingInfo; } + get => _SupportingInfo ?? new List(); set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } - private List _SupportingInfo; + private List? _SupportingInfo; /// /// Procedure Samples. @@ -929,11 +905,11 @@ public List SupportingInfo [DataMember] public List Specimen { - get { if(_Specimen==null) _Specimen = new List(); return _Specimen; } + get => _Specimen ?? new List(); set { _Specimen = value; OnPropertyChanged("Specimen"); } } - private List _Specimen; + private List? _Specimen; /// /// Coded location on Body. @@ -944,11 +920,11 @@ public List Specimen [DataMember] public List BodySite { - get { if(_BodySite==null) _BodySite = new List(); return _BodySite; } + get => _BodySite ?? new List(); set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private List _BodySite; + private List? _BodySite; /// /// BodyStructure-based location on the body. @@ -957,13 +933,13 @@ public List BodySite [CLSCompliant(false)] [References("BodyStructure")] [DataMember] - public Hl7.Fhir.Model.ResourceReference BodyStructure + public Hl7.Fhir.Model.ResourceReference? BodyStructure { get { return _BodyStructure; } set { _BodyStructure = value; OnPropertyChanged("BodyStructure"); } } - private Hl7.Fhir.Model.ResourceReference _BodyStructure; + private Hl7.Fhir.Model.ResourceReference? _BodyStructure; /// /// Comments. @@ -973,11 +949,11 @@ public Hl7.Fhir.Model.ResourceReference BodyStructure [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Patient or consumer-oriented instructions. @@ -987,11 +963,11 @@ public List Note [DataMember] public List PatientInstruction { - get { if(_PatientInstruction==null) _PatientInstruction = new List(); return _PatientInstruction; } + get => _PatientInstruction ?? new List(); set { _PatientInstruction = value; OnPropertyChanged("PatientInstruction"); } } - private List _PatientInstruction; + private List? _PatientInstruction; /// /// Request provenance. @@ -1003,57 +979,53 @@ public List PatientIn [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as ServiceRequest; - - if (dest == null) - { + if(other is not ServiceRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement.Any()) dest.InstantiatesCanonicalElement = new List(InstantiatesCanonicalElement.DeepCopyInternal()); - if(InstantiatesUriElement.Any()) dest.InstantiatesUriElement = new List(InstantiatesUriElement.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Replaces.Any()) dest.Replaces = new List(Replaces.DeepCopyInternal()); - if(Requisition != null) dest.Requisition = (Hl7.Fhir.Model.Identifier)Requisition.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableReference)Code.DeepCopyInternal(); - if(OrderDetail.Any()) dest.OrderDetail = new List(OrderDetail.DeepCopyInternal()); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.DataType)Quantity.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(Focus.Any()) dest.Focus = new List(Focus.DeepCopyInternal()); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AsNeeded != null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType != null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location.Any()) dest.Location = new List(Location.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(SupportingInfo.Any()) dest.SupportingInfo = new List(SupportingInfo.DeepCopyInternal()); - if(Specimen.Any()) dest.Specimen = new List(Specimen.DeepCopyInternal()); - if(BodySite.Any()) dest.BodySite = new List(BodySite.DeepCopyInternal()); - if(BodyStructure != null) dest.BodyStructure = (Hl7.Fhir.Model.ResourceReference)BodyStructure.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(PatientInstruction.Any()) dest.PatientInstruction = new List(PatientInstruction.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = new List(_InstantiatesCanonicalElement.DeepCopyInternal()); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = new List(_InstantiatesUriElement.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Replaces is not null) dest.Replaces = new List(_Replaces.DeepCopyInternal()); + if(_Requisition is not null) dest.Requisition = (Hl7.Fhir.Model.Identifier)_Requisition.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableReference)_Code.DeepCopyInternal(); + if(_OrderDetail is not null) dest.OrderDetail = new List(_OrderDetail.DeepCopyInternal()); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.DataType)_Quantity.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = new List(_Focus.DeepCopyInternal()); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AsNeeded is not null) dest.AsNeeded = (Hl7.Fhir.Model.DataType)_AsNeeded.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)_PerformerType.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = new List(_Location.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_SupportingInfo is not null) dest.SupportingInfo = new List(_SupportingInfo.DeepCopyInternal()); + if(_Specimen is not null) dest.Specimen = new List(_Specimen.DeepCopyInternal()); + if(_BodySite is not null) dest.BodySite = new List(_BodySite.DeepCopyInternal()); + if(_BodyStructure is not null) dest.BodyStructure = (Hl7.Fhir.Model.ResourceReference)_BodyStructure.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_PatientInstruction is not null) dest.PatientInstruction = new List(_PatientInstruction.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1065,258 +1037,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ServiceRequest; - if(otherT == null) return false; + if(other is not ServiceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.ListEquals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(Replaces, otherT.Replaces)) return false; - if(!comparer.Equals(Requisition, otherT.Requisition)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(OrderDetail, otherT.OrderDetail)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.ListEquals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AsNeeded, otherT.AsNeeded)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.Equals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.ListEquals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(SupportingInfo, otherT.SupportingInfo)) return false; - if(!comparer.ListEquals(Specimen, otherT.Specimen)) return false; - if(!comparer.ListEquals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(BodyStructure, otherT.BodyStructure)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(PatientInstruction, otherT.PatientInstruction)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; + if(!comparer.Equals(_Requisition, otherT._Requisition)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_OrderDetail, otherT._OrderDetail)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.Equals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.ListEquals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; + if(!comparer.ListEquals(_Specimen, otherT._Specimen)) return false; + if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_BodyStructure, otherT._BodyStructure)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_PatientInstruction, otherT._PatientInstruction)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement?.Any() == true; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement?.Any() == true; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement?.Any() == true; + value = _InstantiatesUriElement; + return _InstantiatesUriElement?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "replaces": - value = Replaces; - return Replaces?.Any() == true; + value = _Replaces; + return _Replaces?.Any() == true; case "requisition": - value = Requisition; - return Requisition is not null; + value = _Requisition; + return _Requisition is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "orderDetail": - value = OrderDetail; - return OrderDetail?.Any() == true; + value = _OrderDetail; + return _OrderDetail?.Any() == true; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "focus": - value = Focus; - return Focus?.Any() == true; + value = _Focus; + return _Focus?.Any() == true; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "asNeeded": - value = AsNeeded; - return AsNeeded is not null; + value = _AsNeeded; + return _AsNeeded is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType is not null; + value = _PerformerType; + return _PerformerType is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location?.Any() == true; + value = _Location; + return _Location?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "supportingInfo": - value = SupportingInfo; - return SupportingInfo?.Any() == true; + value = _SupportingInfo; + return _SupportingInfo?.Any() == true; case "specimen": - value = Specimen; - return Specimen?.Any() == true; + value = _Specimen; + return _Specimen?.Any() == true; case "bodySite": - value = BodySite; - return BodySite?.Any() == true; + value = _BodySite; + return _BodySite?.Any() == true; case "bodyStructure": - value = BodyStructure; - return BodyStructure is not null; + value = _BodyStructure; + return _BodyStructure is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "patientInstruction": - value = PatientInstruction; - return PatientInstruction?.Any() == true; + value = _PatientInstruction; + return _PatientInstruction?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (List)value; + InstantiatesCanonicalElement = (List?)value!; return this; case "instantiatesUri": - InstantiatesUriElement = (List)value; + InstantiatesUriElement = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "replaces": - Replaces = (List)value; + Replaces = (List?)value!; return this; case "requisition": - Requisition = (Hl7.Fhir.Model.Identifier)value; + Requisition = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableReference)value; + Code = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "orderDetail": - OrderDetail = (List)value; + OrderDetail = (List?)value!; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.DataType)value; + Quantity = (Hl7.Fhir.Model.DataType?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "focus": - Focus = (List)value; + Focus = (List?)value!; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "asNeeded": - AsNeeded = (Hl7.Fhir.Model.DataType)value; + AsNeeded = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (Hl7.Fhir.Model.CodeableConcept)value; + PerformerType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (List)value; + Location = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "supportingInfo": - SupportingInfo = (List)value; + SupportingInfo = (List?)value!; return this; case "specimen": - Specimen = (List)value; + Specimen = (List?)value!; return this; case "bodySite": - BodySite = (List)value; + BodySite = (List?)value!; return this; case "bodyStructure": - BodyStructure = (Hl7.Fhir.Model.ResourceReference)value; + BodyStructure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "patientInstruction": - PatientInstruction = (List)value; + PatientInstruction = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1327,39 +1299,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Replaces?.Any() == true) yield return new KeyValuePair("replaces",Replaces); - if (Requisition is not null) yield return new KeyValuePair("requisition",Requisition); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (OrderDetail?.Any() == true) yield return new KeyValuePair("orderDetail",OrderDetail); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (Focus?.Any() == true) yield return new KeyValuePair("focus",Focus); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AsNeeded is not null) yield return new KeyValuePair("asNeeded",AsNeeded); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType is not null) yield return new KeyValuePair("performerType",PerformerType); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location?.Any() == true) yield return new KeyValuePair("location",Location); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",SupportingInfo); - if (Specimen?.Any() == true) yield return new KeyValuePair("specimen",Specimen); - if (BodySite?.Any() == true) yield return new KeyValuePair("bodySite",BodySite); - if (BodyStructure is not null) yield return new KeyValuePair("bodyStructure",BodyStructure); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (PatientInstruction?.Any() == true) yield return new KeyValuePair("patientInstruction",PatientInstruction); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement?.Any() == true) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement?.Any() == true) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Replaces?.Any() == true) yield return new KeyValuePair("replaces",_Replaces); + if (_Requisition is not null) yield return new KeyValuePair("requisition",_Requisition); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_OrderDetail?.Any() == true) yield return new KeyValuePair("orderDetail",_OrderDetail); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_Focus?.Any() == true) yield return new KeyValuePair("focus",_Focus); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AsNeeded is not null) yield return new KeyValuePair("asNeeded",_AsNeeded); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType is not null) yield return new KeyValuePair("performerType",_PerformerType); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location?.Any() == true) yield return new KeyValuePair("location",_Location); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_SupportingInfo?.Any() == true) yield return new KeyValuePair("supportingInfo",_SupportingInfo); + if (_Specimen?.Any() == true) yield return new KeyValuePair("specimen",_Specimen); + if (_BodySite?.Any() == true) yield return new KeyValuePair("bodySite",_BodySite); + if (_BodyStructure is not null) yield return new KeyValuePair("bodyStructure",_BodyStructure); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_PatientInstruction?.Any() == true) yield return new KeyValuePair("patientInstruction",_PatientInstruction); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Slot.cs b/src/Hl7.Fhir.R5/Model/Generated/Slot.cs index 60f587787..d91072a21 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Slot.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -104,11 +107,11 @@ public enum SlotStatus [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A broad categorization of the service that is to be performed during this appointment. @@ -119,11 +122,11 @@ public List Identifier [DataMember] public List ServiceCategory { - get { if(_ServiceCategory==null) _ServiceCategory = new List(); return _ServiceCategory; } + get => _ServiceCategory ?? new List(); set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } - private List _ServiceCategory; + private List? _ServiceCategory; /// /// The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the Schedule resource. @@ -134,11 +137,11 @@ public List ServiceCategory [DataMember] public List ServiceType { - get { if(_ServiceType==null) _ServiceType = new List(); return _ServiceType; } + get => _ServiceType ?? new List(); set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } - private List _ServiceType; + private List? _ServiceType; /// /// The specialty of a practitioner that would be required to perform the service requested in this appointment. @@ -149,11 +152,11 @@ public List ServiceType [DataMember] public List Specialty { - get { if(_Specialty==null) _Specialty = new List(); return _Specialty; } + get => _Specialty ?? new List(); set { _Specialty = value; OnPropertyChanged("Specialty"); } } - private List _Specialty; + private List? _Specialty; /// /// The style of appointment or patient that may be booked in the slot (not service type). @@ -164,11 +167,11 @@ public List Specialty [DataMember] public List AppointmentType { - get { if(_AppointmentType==null) _AppointmentType = new List(); return _AppointmentType; } + get => _AppointmentType ?? new List(); set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } - private List _AppointmentType; + private List? _AppointmentType; /// /// The schedule resource that this slot defines an interval of status information. @@ -178,13 +181,13 @@ public List AppointmentType [References("Schedule")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Schedule + public Hl7.Fhir.Model.ResourceReference? Schedule { get { return _Schedule; } set { _Schedule = value; OnPropertyChanged("Schedule"); } } - private Hl7.Fhir.Model.ResourceReference _Schedule; + private Hl7.Fhir.Model.ResourceReference? _Schedule; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error. @@ -194,13 +197,13 @@ public Hl7.Fhir.Model.ResourceReference Schedule [Binding("SlotStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// busy | free | busy-unavailable | busy-tentative | entered-in-error @@ -209,13 +212,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Slot.SlotStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -226,13 +226,13 @@ public Hl7.Fhir.Model.Slot.SlotStatus? Status [FhirElement("start", InSummary=true, Order=160, FiveWs="FiveWs.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant StartElement + public Hl7.Fhir.Model.Instant? StartElement { get { return _StartElement; } set { _StartElement = value; OnPropertyChanged("StartElement"); } } - private Hl7.Fhir.Model.Instant _StartElement; + private Hl7.Fhir.Model.Instant? _StartElement; /// /// Date/Time that the slot is to begin @@ -241,13 +241,10 @@ public Hl7.Fhir.Model.Instant StartElement [IgnoreDataMember] public DateTimeOffset? Start { - get { return StartElement != null ? StartElement.Value : null; } + get => _StartElement?.Value; set { - if (value == null) - StartElement = null; - else - StartElement = new Hl7.Fhir.Model.Instant(value); + StartElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Start"); } } @@ -258,13 +255,13 @@ public DateTimeOffset? Start [FhirElement("end", InSummary=true, Order=170, FiveWs="FiveWs.planned")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// Date/Time that the slot is to conclude @@ -273,13 +270,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -289,13 +283,13 @@ public DateTimeOffset? End /// [FhirElement("overbooked", Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean OverbookedElement + public Hl7.Fhir.Model.FhirBoolean? OverbookedElement { get { return _OverbookedElement; } set { _OverbookedElement = value; OnPropertyChanged("OverbookedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _OverbookedElement; + private Hl7.Fhir.Model.FhirBoolean? _OverbookedElement; /// /// This slot has already been overbooked, appointments are unlikely to be accepted for this time @@ -304,13 +298,10 @@ public Hl7.Fhir.Model.FhirBoolean OverbookedElement [IgnoreDataMember] public bool? Overbooked { - get { return OverbookedElement != null ? OverbookedElement.Value : null; } + get => _OverbookedElement?.Value; set { - if (value == null) - OverbookedElement = null; - else - OverbookedElement = new Hl7.Fhir.Model.FhirBoolean(value); + OverbookedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Overbooked"); } } @@ -320,28 +311,25 @@ public bool? Overbooked /// [FhirElement("comment", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Comments on the slot to describe any extended information. Such as custom constraints on the slot /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -350,25 +338,21 @@ public string Comment protected internal override void CopyToInternal(Base other) { - var dest = other as Slot; - - if (dest == null) - { + if(other is not Slot dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(ServiceCategory.Any()) dest.ServiceCategory = new List(ServiceCategory.DeepCopyInternal()); - if(ServiceType.Any()) dest.ServiceType = new List(ServiceType.DeepCopyInternal()); - if(Specialty.Any()) dest.Specialty = new List(Specialty.DeepCopyInternal()); - if(AppointmentType.Any()) dest.AppointmentType = new List(AppointmentType.DeepCopyInternal()); - if(Schedule != null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)Schedule.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StartElement != null) dest.StartElement = (Hl7.Fhir.Model.Instant)StartElement.DeepCopyInternal(); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(OverbookedElement != null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)OverbookedElement.DeepCopyInternal(); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_ServiceCategory is not null) dest.ServiceCategory = new List(_ServiceCategory.DeepCopyInternal()); + if(_ServiceType is not null) dest.ServiceType = new List(_ServiceType.DeepCopyInternal()); + if(_Specialty is not null) dest.Specialty = new List(_Specialty.DeepCopyInternal()); + if(_AppointmentType is not null) dest.AppointmentType = new List(_AppointmentType.DeepCopyInternal()); + if(_Schedule is not null) dest.Schedule = (Hl7.Fhir.Model.ResourceReference)_Schedule.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StartElement is not null) dest.StartElement = (Hl7.Fhir.Model.Instant)_StartElement.DeepCopyInternal(); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_OverbookedElement is not null) dest.OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)_OverbookedElement.DeepCopyInternal(); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -380,104 +364,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Slot; - if(otherT == null) return false; + if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(ServiceCategory, otherT.ServiceCategory)) return false; - if(!comparer.ListEquals(ServiceType, otherT.ServiceType)) return false; - if(!comparer.ListEquals(Specialty, otherT.Specialty)) return false; - if(!comparer.ListEquals(AppointmentType, otherT.AppointmentType)) return false; - if(!comparer.Equals(Schedule, otherT.Schedule)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StartElement, otherT.StartElement)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(OverbookedElement, otherT.OverbookedElement)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; + if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; + if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; + if(!comparer.ListEquals(_AppointmentType, otherT._AppointmentType)) return false; + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "serviceCategory": - value = ServiceCategory; - return ServiceCategory?.Any() == true; + value = _ServiceCategory; + return _ServiceCategory?.Any() == true; case "serviceType": - value = ServiceType; - return ServiceType?.Any() == true; + value = _ServiceType; + return _ServiceType?.Any() == true; case "specialty": - value = Specialty; - return Specialty?.Any() == true; + value = _Specialty; + return _Specialty?.Any() == true; case "appointmentType": - value = AppointmentType; - return AppointmentType?.Any() == true; + value = _AppointmentType; + return _AppointmentType?.Any() == true; case "schedule": - value = Schedule; - return Schedule is not null; + value = _Schedule; + return _Schedule is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "start": - value = StartElement; - return StartElement is not null; + value = _StartElement; + return _StartElement is not null; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "overbooked": - value = OverbookedElement; - return OverbookedElement is not null; + value = _OverbookedElement; + return _OverbookedElement is not null; case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "serviceCategory": - ServiceCategory = (List)value; + ServiceCategory = (List?)value!; return this; case "serviceType": - ServiceType = (List)value; + ServiceType = (List?)value!; return this; case "specialty": - Specialty = (List)value; + Specialty = (List?)value!; return this; case "appointmentType": - AppointmentType = (List)value; + AppointmentType = (List?)value!; return this; case "schedule": - Schedule = (Hl7.Fhir.Model.ResourceReference)value; + Schedule = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "start": - StartElement = (Hl7.Fhir.Model.Instant)value; + StartElement = (Hl7.Fhir.Model.Instant?)value; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "overbooked": - OverbookedElement = (Hl7.Fhir.Model.FhirBoolean)value; + OverbookedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -488,17 +472,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",ServiceCategory); - if (ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",ServiceType); - if (Specialty?.Any() == true) yield return new KeyValuePair("specialty",Specialty); - if (AppointmentType?.Any() == true) yield return new KeyValuePair("appointmentType",AppointmentType); - if (Schedule is not null) yield return new KeyValuePair("schedule",Schedule); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StartElement is not null) yield return new KeyValuePair("start",StartElement); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (OverbookedElement is not null) yield return new KeyValuePair("overbooked",OverbookedElement); - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_ServiceCategory?.Any() == true) yield return new KeyValuePair("serviceCategory",_ServiceCategory); + if (_ServiceType?.Any() == true) yield return new KeyValuePair("serviceType",_ServiceType); + if (_Specialty?.Any() == true) yield return new KeyValuePair("specialty",_Specialty); + if (_AppointmentType?.Any() == true) yield return new KeyValuePair("appointmentType",_AppointmentType); + if (_Schedule is not null) yield return new KeyValuePair("schedule",_Schedule); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StartElement is not null) yield return new KeyValuePair("start",_StartElement); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_OverbookedElement is not null) yield return new KeyValuePair("overbooked",_OverbookedElement); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs index 90552c472..a1fe5dd1e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -138,13 +141,13 @@ public partial class FeatureComponent : Hl7.Fhir.Model.BackboneElement [Binding("SpecimenFeatureType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Information about the feature. @@ -152,44 +155,37 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("description", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Information about the feature /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FeatureComponent; - - if (dest == null) - { + if(other is not FeatureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -201,41 +197,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FeatureComponent; - if(otherT == null) return false; + if(other is not FeatureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -246,8 +242,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -275,13 +271,13 @@ public partial class CollectionComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Collector + public Hl7.Fhir.Model.ResourceReference? Collector { get { return _Collector; } set { _Collector = value; OnPropertyChanged("Collector"); } } - private Hl7.Fhir.Model.ResourceReference _Collector; + private Hl7.Fhir.Model.ResourceReference? _Collector; /// /// Collection time. @@ -290,39 +286,39 @@ public Hl7.Fhir.Model.ResourceReference Collector [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Collected + public Hl7.Fhir.Model.DataType? Collected { get { return _Collected; } set { _Collected = value; OnPropertyChanged("Collected"); } } - private Hl7.Fhir.Model.DataType _Collected; + private Hl7.Fhir.Model.DataType? _Collected; /// /// How long it took to collect specimen. /// [FhirElement("duration", InSummary=true, Order=60, FiveWs="FiveWs.init")] [DataMember] - public Hl7.Fhir.Model.Duration Duration + public Hl7.Fhir.Model.Duration? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Duration _Duration; + private Hl7.Fhir.Model.Duration? _Duration; /// /// The quantity of specimen collected. /// [FhirElement("quantity", Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Technique used to perform collection. @@ -330,13 +326,13 @@ public Hl7.Fhir.Model.Quantity Quantity [FhirElement("method", Order=80)] [Binding("SpecimenCollectionMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Device used to perform collection. @@ -344,13 +340,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [FhirElement("device", Order=90)] [Binding("SpecimenCollectionDevice")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Device + public Hl7.Fhir.Model.CodeableReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.CodeableReference _Device; + private Hl7.Fhir.Model.CodeableReference? _Device; /// /// The procedure that collects the specimen. @@ -359,13 +355,13 @@ public Hl7.Fhir.Model.CodeableReference Device [CLSCompliant(false)] [References("Procedure")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Procedure + public Hl7.Fhir.Model.ResourceReference? Procedure { get { return _Procedure; } set { _Procedure = value; OnPropertyChanged("Procedure"); } } - private Hl7.Fhir.Model.ResourceReference _Procedure; + private Hl7.Fhir.Model.ResourceReference? _Procedure; /// /// Anatomical collection site. @@ -373,13 +369,13 @@ public Hl7.Fhir.Model.ResourceReference Procedure [FhirElement("bodySite", Order=110)] [Binding("BodySite")] [DataMember] - public Hl7.Fhir.Model.CodeableReference BodySite + public Hl7.Fhir.Model.CodeableReference? BodySite { get { return _BodySite; } set { _BodySite = value; OnPropertyChanged("BodySite"); } } - private Hl7.Fhir.Model.CodeableReference _BodySite; + private Hl7.Fhir.Model.CodeableReference? _BodySite; /// /// Whether or how long patient abstained from food and/or drink. @@ -389,33 +385,29 @@ public Hl7.Fhir.Model.CodeableReference BodySite [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Duration))] [DataMember] - public Hl7.Fhir.Model.DataType FastingStatus + public Hl7.Fhir.Model.DataType? FastingStatus { get { return _FastingStatus; } set { _FastingStatus = value; OnPropertyChanged("FastingStatus"); } } - private Hl7.Fhir.Model.DataType _FastingStatus; + private Hl7.Fhir.Model.DataType? _FastingStatus; protected internal override void CopyToInternal(Base other) { - var dest = other as CollectionComponent; - - if (dest == null) - { + if(other is not CollectionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Collector != null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)Collector.DeepCopyInternal(); - if(Collected != null) dest.Collected = (Hl7.Fhir.Model.DataType)Collected.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Duration)Duration.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Device != null) dest.Device = (Hl7.Fhir.Model.CodeableReference)Device.DeepCopyInternal(); - if(Procedure != null) dest.Procedure = (Hl7.Fhir.Model.ResourceReference)Procedure.DeepCopyInternal(); - if(BodySite != null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)BodySite.DeepCopyInternal(); - if(FastingStatus != null) dest.FastingStatus = (Hl7.Fhir.Model.DataType)FastingStatus.DeepCopyInternal(); + if(_Collector is not null) dest.Collector = (Hl7.Fhir.Model.ResourceReference)_Collector.DeepCopyInternal(); + if(_Collected is not null) dest.Collected = (Hl7.Fhir.Model.DataType)_Collected.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Duration)_Duration.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.CodeableReference)_Device.DeepCopyInternal(); + if(_Procedure is not null) dest.Procedure = (Hl7.Fhir.Model.ResourceReference)_Procedure.DeepCopyInternal(); + if(_BodySite is not null) dest.BodySite = (Hl7.Fhir.Model.CodeableReference)_BodySite.DeepCopyInternal(); + if(_FastingStatus is not null) dest.FastingStatus = (Hl7.Fhir.Model.DataType)_FastingStatus.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -427,90 +419,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CollectionComponent; - if(otherT == null) return false; + if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Collector, otherT.Collector)) return false; - if(!comparer.Equals(Collected, otherT.Collected)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Procedure, otherT.Procedure)) return false; - if(!comparer.Equals(BodySite, otherT.BodySite)) return false; - if(!comparer.Equals(FastingStatus, otherT.FastingStatus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + if(!comparer.Equals(_Collected, otherT._Collected)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; + if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; + if(!comparer.Equals(_FastingStatus, otherT._FastingStatus)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "collector": - value = Collector; - return Collector is not null; + value = _Collector; + return _Collector is not null; case "collected": - value = Collected; - return Collected is not null; + value = _Collected; + return _Collected is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "procedure": - value = Procedure; - return Procedure is not null; + value = _Procedure; + return _Procedure is not null; case "bodySite": - value = BodySite; - return BodySite is not null; + value = _BodySite; + return _BodySite is not null; case "fastingStatus": - value = FastingStatus; - return FastingStatus is not null; + value = _FastingStatus; + return _FastingStatus is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "collector": - Collector = (Hl7.Fhir.Model.ResourceReference)value; + Collector = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "collected": - Collected = (Hl7.Fhir.Model.DataType)value; + Collected = (Hl7.Fhir.Model.DataType?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Duration)value; + Duration = (Hl7.Fhir.Model.Duration?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "device": - Device = (Hl7.Fhir.Model.CodeableReference)value; + Device = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "procedure": - Procedure = (Hl7.Fhir.Model.ResourceReference)value; + Procedure = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "bodySite": - BodySite = (Hl7.Fhir.Model.CodeableReference)value; + BodySite = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "fastingStatus": - FastingStatus = (Hl7.Fhir.Model.DataType)value; + FastingStatus = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -521,15 +513,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Collector is not null) yield return new KeyValuePair("collector",Collector); - if (Collected is not null) yield return new KeyValuePair("collected",Collected); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Procedure is not null) yield return new KeyValuePair("procedure",Procedure); - if (BodySite is not null) yield return new KeyValuePair("bodySite",BodySite); - if (FastingStatus is not null) yield return new KeyValuePair("fastingStatus",FastingStatus); + if (_Collector is not null) yield return new KeyValuePair("collector",_Collector); + if (_Collected is not null) yield return new KeyValuePair("collected",_Collected); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Procedure is not null) yield return new KeyValuePair("procedure",_Procedure); + if (_BodySite is not null) yield return new KeyValuePair("bodySite",_BodySite); + if (_FastingStatus is not null) yield return new KeyValuePair("fastingStatus",_FastingStatus); } } @@ -555,28 +547,25 @@ public partial class ProcessingComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Textual description of procedure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -587,13 +576,13 @@ public string Description [FhirElement("method", Order=50)] [Binding("SpecimenProcessingMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Material used in the processing step. @@ -605,11 +594,11 @@ public Hl7.Fhir.Model.CodeableConcept Method [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Date and time of specimen processing. @@ -618,28 +607,24 @@ public List Additive [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Time + public Hl7.Fhir.Model.DataType? Time { get { return _Time; } set { _Time = value; OnPropertyChanged("Time"); } } - private Hl7.Fhir.Model.DataType _Time; + private Hl7.Fhir.Model.DataType? _Time; protected internal override void CopyToInternal(Base other) { - var dest = other as ProcessingComponent; - - if (dest == null) - { + if(other is not ProcessingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(Time != null) dest.Time = (Hl7.Fhir.Model.DataType)Time.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_Time is not null) dest.Time = (Hl7.Fhir.Model.DataType)_Time.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -651,55 +636,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ProcessingComponent; - if(otherT == null) return false; + if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(Time, otherT.Time)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_Time, otherT._Time)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "time": - value = Time; - return Time is not null; + value = _Time; + return _Time is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "time": - Time = (Hl7.Fhir.Model.DataType)value; + Time = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -710,10 +695,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (Time is not null) yield return new KeyValuePair("time",Time); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_Time is not null) yield return new KeyValuePair("time",_Time); } } @@ -742,13 +727,13 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [References("Device")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Device + public Hl7.Fhir.Model.ResourceReference? Device { get { return _Device; } set { _Device = value; OnPropertyChanged("Device"); } } - private Hl7.Fhir.Model.ResourceReference _Device; + private Hl7.Fhir.Model.ResourceReference? _Device; /// /// Where the container is. @@ -757,40 +742,36 @@ public Hl7.Fhir.Model.ResourceReference Device [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Quantity of specimen within container. /// [FhirElement("specimenQuantity", Order=60)] [DataMember] - public Hl7.Fhir.Model.Quantity SpecimenQuantity + public Hl7.Fhir.Model.Quantity? SpecimenQuantity { get { return _SpecimenQuantity; } set { _SpecimenQuantity = value; OnPropertyChanged("SpecimenQuantity"); } } - private Hl7.Fhir.Model.Quantity _SpecimenQuantity; + private Hl7.Fhir.Model.Quantity? _SpecimenQuantity; protected internal override void CopyToInternal(Base other) { - var dest = other as ContainerComponent; - - if (dest == null) - { + if(other is not ContainerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Device != null) dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(SpecimenQuantity != null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)SpecimenQuantity.DeepCopyInternal(); + if(_Device is not null) dest.Device = (Hl7.Fhir.Model.ResourceReference)_Device.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_SpecimenQuantity is not null) dest.SpecimenQuantity = (Hl7.Fhir.Model.Quantity)_SpecimenQuantity.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -802,48 +783,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainerComponent; - if(otherT == null) return false; + if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Device, otherT.Device)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.Equals(SpecimenQuantity, otherT.SpecimenQuantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Device, otherT._Device)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "device": - value = Device; - return Device is not null; + value = _Device; + return _Device is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "specimenQuantity": - value = SpecimenQuantity; - return SpecimenQuantity is not null; + value = _SpecimenQuantity; + return _SpecimenQuantity is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "device": - Device = (Hl7.Fhir.Model.ResourceReference)value; + Device = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "specimenQuantity": - SpecimenQuantity = (Hl7.Fhir.Model.Quantity)value; + SpecimenQuantity = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -854,9 +835,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Device is not null) yield return new KeyValuePair("device",Device); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",SpecimenQuantity); + if (_Device is not null) yield return new KeyValuePair("device",_Device); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_SpecimenQuantity is not null) yield return new KeyValuePair("specimenQuantity",_SpecimenQuantity); } } @@ -869,24 +850,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Identifier assigned by the lab. /// [FhirElement("accessionIdentifier", InSummary=true, Order=100, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier AccessionIdentifier + public Hl7.Fhir.Model.Identifier? AccessionIdentifier { get { return _AccessionIdentifier; } set { _AccessionIdentifier = value; OnPropertyChanged("AccessionIdentifier"); } } - private Hl7.Fhir.Model.Identifier _AccessionIdentifier; + private Hl7.Fhir.Model.Identifier? _AccessionIdentifier; /// /// available | unavailable | unsatisfactory | entered-in-error. @@ -895,13 +876,13 @@ public Hl7.Fhir.Model.Identifier AccessionIdentifier [DeclaredType(Type = typeof(Code))] [Binding("SpecimenStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// available | unavailable | unsatisfactory | entered-in-error @@ -910,13 +891,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -927,13 +905,13 @@ public Hl7.Fhir.Model.Specimen.SpecimenStatus? Status [FhirElement("type", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Binding("SpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Where the specimen came from. This may be from patient(s), from a location (e.g., the source of an environmental sample), or a sampling of a substance, a biologically-derived product, or a device. @@ -942,41 +920,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [References("Patient","Group","Device","BiologicallyDerivedProduct","Substance","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subject + public Hl7.Fhir.Model.ResourceReference? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.ResourceReference _Subject; + private Hl7.Fhir.Model.ResourceReference? _Subject; /// /// The time when specimen is received by the testing laboratory. /// [FhirElement("receivedTime", InSummary=true, Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ReceivedTimeElement + public Hl7.Fhir.Model.FhirDateTime? ReceivedTimeElement { get { return _ReceivedTimeElement; } set { _ReceivedTimeElement = value; OnPropertyChanged("ReceivedTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ReceivedTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _ReceivedTimeElement; /// /// The time when specimen is received by the testing laboratory /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ReceivedTime + public string? ReceivedTime { - get { return ReceivedTimeElement != null ? ReceivedTimeElement.Value : null; } + get => _ReceivedTimeElement?.Value; set { - if (value == null) - ReceivedTimeElement = null; - else - ReceivedTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + ReceivedTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ReceivedTime"); } } @@ -991,11 +966,11 @@ public string ReceivedTime [DataMember] public List Parent { - get { if(_Parent==null) _Parent = new List(); return _Parent; } + get => _Parent ?? new List(); set { _Parent = value; OnPropertyChanged("Parent"); } } - private List _Parent; + private List? _Parent; /// /// Why the specimen was collected. @@ -1007,11 +982,11 @@ public List Parent [DataMember] public List Request { - get { if(_Request==null) _Request = new List(); return _Request; } + get => _Request ?? new List(); set { _Request = value; OnPropertyChanged("Request"); } } - private List _Request; + private List? _Request; /// /// grouped | pooled. @@ -1020,13 +995,13 @@ public List Request [DeclaredType(Type = typeof(Code))] [Binding("PublicationStatus")] [DataMember] - public Code CombinedElement + public Code? CombinedElement { get { return _CombinedElement; } set { _CombinedElement = value; OnPropertyChanged("CombinedElement"); } } - private Code _CombinedElement; + private Code? _CombinedElement; /// /// grouped | pooled @@ -1035,13 +1010,10 @@ public Code CombinedElement [IgnoreDataMember] public Hl7.Fhir.Model.Specimen.SpecimenCombined? Combined { - get { return CombinedElement != null ? CombinedElement.Value : null; } + get => _CombinedElement?.Value; set { - if (value == null) - CombinedElement = null; - else - CombinedElement = new Code(value); + CombinedElement = value is null ? null : new Code(value); OnPropertyChanged("Combined"); } } @@ -1055,11 +1027,11 @@ public Hl7.Fhir.Model.Specimen.SpecimenCombined? Combined [DataMember] public List Role { - get { if(_Role==null) _Role = new List(); return _Role; } + get => _Role ?? new List(); set { _Role = value; OnPropertyChanged("Role"); } } - private List _Role; + private List? _Role; /// /// The physical feature of a specimen. @@ -1069,24 +1041,24 @@ public List Role [DataMember] public List Feature { - get { if(_Feature==null) _Feature = new List(); return _Feature; } + get => _Feature ?? new List(); set { _Feature = value; OnPropertyChanged("Feature"); } } - private List _Feature; + private List? _Feature; /// /// Collection details. /// [FhirElement("collection", Order=200)] [DataMember] - public Hl7.Fhir.Model.Specimen.CollectionComponent Collection + public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection { get { return _Collection; } set { _Collection = value; OnPropertyChanged("Collection"); } } - private Hl7.Fhir.Model.Specimen.CollectionComponent _Collection; + private Hl7.Fhir.Model.Specimen.CollectionComponent? _Collection; /// /// Processing and processing step details. @@ -1096,11 +1068,11 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent Collection [DataMember] public List Processing { - get { if(_Processing==null) _Processing = new List(); return _Processing; } + get => _Processing ?? new List(); set { _Processing = value; OnPropertyChanged("Processing"); } } - private List _Processing; + private List? _Processing; /// /// Direct container of specimen (tube/slide, etc.). @@ -1110,11 +1082,11 @@ public List Processing [DataMember] public List Container { - get { if(_Container==null) _Container = new List(); return _Container; } + get => _Container ?? new List(); set { _Container = value; OnPropertyChanged("Container"); } } - private List _Container; + private List? _Container; /// /// State of the specimen. @@ -1125,11 +1097,11 @@ public List Container [DataMember] public List Condition { - get { if(_Condition==null) _Condition = new List(); return _Condition; } + get => _Condition ?? new List(); set { _Condition = value; OnPropertyChanged("Condition"); } } - private List _Condition; + private List? _Condition; /// /// Comments. @@ -1139,40 +1111,36 @@ public List Condition [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Specimen; - - if (dest == null) - { + if(other is not Specimen dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(AccessionIdentifier != null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)AccessionIdentifier.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopyInternal(); - if(ReceivedTimeElement != null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)ReceivedTimeElement.DeepCopyInternal(); - if(Parent.Any()) dest.Parent = new List(Parent.DeepCopyInternal()); - if(Request.Any()) dest.Request = new List(Request.DeepCopyInternal()); - if(CombinedElement != null) dest.CombinedElement = (Code)CombinedElement.DeepCopyInternal(); - if(Role.Any()) dest.Role = new List(Role.DeepCopyInternal()); - if(Feature.Any()) dest.Feature = new List(Feature.DeepCopyInternal()); - if(Collection != null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)Collection.DeepCopyInternal(); - if(Processing.Any()) dest.Processing = new List(Processing.DeepCopyInternal()); - if(Container.Any()) dest.Container = new List(Container.DeepCopyInternal()); - if(Condition.Any()) dest.Condition = new List(Condition.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_AccessionIdentifier is not null) dest.AccessionIdentifier = (Hl7.Fhir.Model.Identifier)_AccessionIdentifier.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.ResourceReference)_Subject.DeepCopyInternal(); + if(_ReceivedTimeElement is not null) dest.ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)_ReceivedTimeElement.DeepCopyInternal(); + if(_Parent is not null) dest.Parent = new List(_Parent.DeepCopyInternal()); + if(_Request is not null) dest.Request = new List(_Request.DeepCopyInternal()); + if(_CombinedElement is not null) dest.CombinedElement = (Code)_CombinedElement.DeepCopyInternal(); + if(_Role is not null) dest.Role = new List(_Role.DeepCopyInternal()); + if(_Feature is not null) dest.Feature = new List(_Feature.DeepCopyInternal()); + if(_Collection is not null) dest.Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)_Collection.DeepCopyInternal(); + if(_Processing is not null) dest.Processing = new List(_Processing.DeepCopyInternal()); + if(_Container is not null) dest.Container = new List(_Container.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = new List(_Condition.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1184,139 +1152,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Specimen; - if(otherT == null) return false; + if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(AccessionIdentifier, otherT.AccessionIdentifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(ReceivedTimeElement, otherT.ReceivedTimeElement)) return false; - if(!comparer.ListEquals(Parent, otherT.Parent)) return false; - if(!comparer.ListEquals(Request, otherT.Request)) return false; - if(!comparer.Equals(CombinedElement, otherT.CombinedElement)) return false; - if(!comparer.ListEquals(Role, otherT.Role)) return false; - if(!comparer.ListEquals(Feature, otherT.Feature)) return false; - if(!comparer.Equals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(Processing, otherT.Processing)) return false; - if(!comparer.ListEquals(Container, otherT.Container)) return false; - if(!comparer.ListEquals(Condition, otherT.Condition)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_ReceivedTimeElement, otherT._ReceivedTimeElement)) return false; + if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; + if(!comparer.ListEquals(_Request, otherT._Request)) return false; + if(!comparer.Equals(_CombinedElement, otherT._CombinedElement)) return false; + if(!comparer.ListEquals(_Role, otherT._Role)) return false; + if(!comparer.ListEquals(_Feature, otherT._Feature)) return false; + if(!comparer.Equals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; + if(!comparer.ListEquals(_Container, otherT._Container)) return false; + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "accessionIdentifier": - value = AccessionIdentifier; - return AccessionIdentifier is not null; + value = _AccessionIdentifier; + return _AccessionIdentifier is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "receivedTime": - value = ReceivedTimeElement; - return ReceivedTimeElement is not null; + value = _ReceivedTimeElement; + return _ReceivedTimeElement is not null; case "parent": - value = Parent; - return Parent?.Any() == true; + value = _Parent; + return _Parent?.Any() == true; case "request": - value = Request; - return Request?.Any() == true; + value = _Request; + return _Request?.Any() == true; case "combined": - value = CombinedElement; - return CombinedElement is not null; + value = _CombinedElement; + return _CombinedElement is not null; case "role": - value = Role; - return Role?.Any() == true; + value = _Role; + return _Role?.Any() == true; case "feature": - value = Feature; - return Feature?.Any() == true; + value = _Feature; + return _Feature?.Any() == true; case "collection": - value = Collection; - return Collection is not null; + value = _Collection; + return _Collection is not null; case "processing": - value = Processing; - return Processing?.Any() == true; + value = _Processing; + return _Processing?.Any() == true; case "container": - value = Container; - return Container?.Any() == true; + value = _Container; + return _Container?.Any() == true; case "condition": - value = Condition; - return Condition?.Any() == true; + value = _Condition; + return _Condition?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "accessionIdentifier": - AccessionIdentifier = (Hl7.Fhir.Model.Identifier)value; + AccessionIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.ResourceReference)value; + Subject = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receivedTime": - ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + ReceivedTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "parent": - Parent = (List)value; + Parent = (List?)value!; return this; case "request": - Request = (List)value; + Request = (List?)value!; return this; case "combined": - CombinedElement = (Code)value; + CombinedElement = (Code?)value; return this; case "role": - Role = (List)value; + Role = (List?)value!; return this; case "feature": - Feature = (List)value; + Feature = (List?)value!; return this; case "collection": - Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent)value; + Collection = (Hl7.Fhir.Model.Specimen.CollectionComponent?)value; return this; case "processing": - Processing = (List)value; + Processing = (List?)value!; return this; case "container": - Container = (List)value; + Container = (List?)value!; return this; case "condition": - Condition = (List)value; + Condition = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1327,22 +1295,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",AccessionIdentifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",ReceivedTimeElement); - if (Parent?.Any() == true) yield return new KeyValuePair("parent",Parent); - if (Request?.Any() == true) yield return new KeyValuePair("request",Request); - if (CombinedElement is not null) yield return new KeyValuePair("combined",CombinedElement); - if (Role?.Any() == true) yield return new KeyValuePair("role",Role); - if (Feature?.Any() == true) yield return new KeyValuePair("feature",Feature); - if (Collection is not null) yield return new KeyValuePair("collection",Collection); - if (Processing?.Any() == true) yield return new KeyValuePair("processing",Processing); - if (Container?.Any() == true) yield return new KeyValuePair("container",Container); - if (Condition?.Any() == true) yield return new KeyValuePair("condition",Condition); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_AccessionIdentifier is not null) yield return new KeyValuePair("accessionIdentifier",_AccessionIdentifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_ReceivedTimeElement is not null) yield return new KeyValuePair("receivedTime",_ReceivedTimeElement); + if (_Parent?.Any() == true) yield return new KeyValuePair("parent",_Parent); + if (_Request?.Any() == true) yield return new KeyValuePair("request",_Request); + if (_CombinedElement is not null) yield return new KeyValuePair("combined",_CombinedElement); + if (_Role?.Any() == true) yield return new KeyValuePair("role",_Role); + if (_Feature?.Any() == true) yield return new KeyValuePair("feature",_Feature); + if (_Collection is not null) yield return new KeyValuePair("collection",_Collection); + if (_Processing?.Any() == true) yield return new KeyValuePair("processing",_Processing); + if (_Container?.Any() == true) yield return new KeyValuePair("container",_Container); + if (_Condition?.Any() == true) yield return new KeyValuePair("condition",_Condition); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs index dfe5abd31..57f545bb5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SpecimenDefinition","http://hl7.org/fhir/StructureDefinition/SpecimenDefinition")] - public partial class SpecimenDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class SpecimenDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -102,13 +105,13 @@ public partial class TypeTestedComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("isDerived", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDerivedElement + public Hl7.Fhir.Model.FhirBoolean? IsDerivedElement { get { return _IsDerivedElement; } set { _IsDerivedElement = value; OnPropertyChanged("IsDerivedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDerivedElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDerivedElement; /// /// Primary or secondary specimen @@ -117,13 +120,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDerivedElement [IgnoreDataMember] public bool? IsDerived { - get { return IsDerivedElement != null ? IsDerivedElement.Value : null; } + get => _IsDerivedElement?.Value; set { - if (value == null) - IsDerivedElement = null; - else - IsDerivedElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDerivedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDerived"); } } @@ -134,13 +134,13 @@ public bool? IsDerived [FhirElement("type", Order=50, FiveWs="FiveWs.what[x]")] [Binding("IntendedSpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// preferred | alternate. @@ -150,13 +150,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [Binding("SpecimenContainedPreference")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code PreferenceElement + public Code? PreferenceElement { get { return _PreferenceElement; } set { _PreferenceElement = value; OnPropertyChanged("PreferenceElement"); } } - private Code _PreferenceElement; + private Code? _PreferenceElement; /// /// preferred | alternate @@ -165,13 +165,10 @@ public Code Prefe [IgnoreDataMember] public Hl7.Fhir.Model.SpecimenDefinition.SpecimenContainedPreference? Preference { - get { return PreferenceElement != null ? PreferenceElement.Value : null; } + get => _PreferenceElement?.Value; set { - if (value == null) - PreferenceElement = null; - else - PreferenceElement = new Code(value); + PreferenceElement = value is null ? null : new Code(value); OnPropertyChanged("Preference"); } } @@ -181,41 +178,38 @@ public Hl7.Fhir.Model.SpecimenDefinition.SpecimenContainedPreference? Preference /// [FhirElement("container", Order=70)] [DataMember] - public Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent Container + public Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent? Container { get { return _Container; } set { _Container = value; OnPropertyChanged("Container"); } } - private Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent _Container; + private Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent? _Container; /// /// Requirements for specimen delivery and special handling. /// [FhirElement("requirement", Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown RequirementElement + public Hl7.Fhir.Model.Markdown? RequirementElement { get { return _RequirementElement; } set { _RequirementElement = value; OnPropertyChanged("RequirementElement"); } } - private Hl7.Fhir.Model.Markdown _RequirementElement; + private Hl7.Fhir.Model.Markdown? _RequirementElement; /// /// Requirements for specimen delivery and special handling /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Requirement + public string? Requirement { - get { return RequirementElement != null ? RequirementElement.Value : null; } + get => _RequirementElement?.Value; set { - if (value == null) - RequirementElement = null; - else - RequirementElement = new Hl7.Fhir.Model.Markdown(value); + RequirementElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Requirement"); } } @@ -225,26 +219,26 @@ public string Requirement /// [FhirElement("retentionTime", Order=90)] [DataMember] - public Hl7.Fhir.Model.Duration RetentionTime + public Hl7.Fhir.Model.Duration? RetentionTime { get { return _RetentionTime; } set { _RetentionTime = value; OnPropertyChanged("RetentionTime"); } } - private Hl7.Fhir.Model.Duration _RetentionTime; + private Hl7.Fhir.Model.Duration? _RetentionTime; /// /// Specimen for single use only. /// [FhirElement("singleUse", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SingleUseElement + public Hl7.Fhir.Model.FhirBoolean? SingleUseElement { get { return _SingleUseElement; } set { _SingleUseElement = value; OnPropertyChanged("SingleUseElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SingleUseElement; + private Hl7.Fhir.Model.FhirBoolean? _SingleUseElement; /// /// Specimen for single use only @@ -253,13 +247,10 @@ public Hl7.Fhir.Model.FhirBoolean SingleUseElement [IgnoreDataMember] public bool? SingleUse { - get { return SingleUseElement != null ? SingleUseElement.Value : null; } + get => _SingleUseElement?.Value; set { - if (value == null) - SingleUseElement = null; - else - SingleUseElement = new Hl7.Fhir.Model.FhirBoolean(value); + SingleUseElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("SingleUse"); } } @@ -273,11 +264,11 @@ public bool? SingleUse [DataMember] public List RejectionCriterion { - get { if(_RejectionCriterion==null) _RejectionCriterion = new List(); return _RejectionCriterion; } + get => _RejectionCriterion ?? new List(); set { _RejectionCriterion = value; OnPropertyChanged("RejectionCriterion"); } } - private List _RejectionCriterion; + private List? _RejectionCriterion; /// /// Specimen handling before testing. @@ -287,11 +278,11 @@ public List RejectionCriterion [DataMember] public List Handling { - get { if(_Handling==null) _Handling = new List(); return _Handling; } + get => _Handling ?? new List(); set { _Handling = value; OnPropertyChanged("Handling"); } } - private List _Handling; + private List? _Handling; /// /// Where the specimen will be tested. @@ -302,32 +293,28 @@ public List Handling [DataMember] public List TestingDestination { - get { if(_TestingDestination==null) _TestingDestination = new List(); return _TestingDestination; } + get => _TestingDestination ?? new List(); set { _TestingDestination = value; OnPropertyChanged("TestingDestination"); } } - private List _TestingDestination; + private List? _TestingDestination; protected internal override void CopyToInternal(Base other) { - var dest = other as TypeTestedComponent; - - if (dest == null) - { + if(other is not TypeTestedComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IsDerivedElement != null) dest.IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)IsDerivedElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(PreferenceElement != null) dest.PreferenceElement = (Code)PreferenceElement.DeepCopyInternal(); - if(Container != null) dest.Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)Container.DeepCopyInternal(); - if(RequirementElement != null) dest.RequirementElement = (Hl7.Fhir.Model.Markdown)RequirementElement.DeepCopyInternal(); - if(RetentionTime != null) dest.RetentionTime = (Hl7.Fhir.Model.Duration)RetentionTime.DeepCopyInternal(); - if(SingleUseElement != null) dest.SingleUseElement = (Hl7.Fhir.Model.FhirBoolean)SingleUseElement.DeepCopyInternal(); - if(RejectionCriterion.Any()) dest.RejectionCriterion = new List(RejectionCriterion.DeepCopyInternal()); - if(Handling.Any()) dest.Handling = new List(Handling.DeepCopyInternal()); - if(TestingDestination.Any()) dest.TestingDestination = new List(TestingDestination.DeepCopyInternal()); + if(_IsDerivedElement is not null) dest.IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)_IsDerivedElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_PreferenceElement is not null) dest.PreferenceElement = (Code)_PreferenceElement.DeepCopyInternal(); + if(_Container is not null) dest.Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)_Container.DeepCopyInternal(); + if(_RequirementElement is not null) dest.RequirementElement = (Hl7.Fhir.Model.Markdown)_RequirementElement.DeepCopyInternal(); + if(_RetentionTime is not null) dest.RetentionTime = (Hl7.Fhir.Model.Duration)_RetentionTime.DeepCopyInternal(); + if(_SingleUseElement is not null) dest.SingleUseElement = (Hl7.Fhir.Model.FhirBoolean)_SingleUseElement.DeepCopyInternal(); + if(_RejectionCriterion is not null) dest.RejectionCriterion = new List(_RejectionCriterion.DeepCopyInternal()); + if(_Handling is not null) dest.Handling = new List(_Handling.DeepCopyInternal()); + if(_TestingDestination is not null) dest.TestingDestination = new List(_TestingDestination.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -339,97 +326,97 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TypeTestedComponent; - if(otherT == null) return false; + if(other is not TypeTestedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IsDerivedElement, otherT.IsDerivedElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(PreferenceElement, otherT.PreferenceElement)) return false; - if(!comparer.Equals(Container, otherT.Container)) return false; - if(!comparer.Equals(RequirementElement, otherT.RequirementElement)) return false; - if(!comparer.Equals(RetentionTime, otherT.RetentionTime)) return false; - if(!comparer.Equals(SingleUseElement, otherT.SingleUseElement)) return false; - if(!comparer.ListEquals(RejectionCriterion, otherT.RejectionCriterion)) return false; - if(!comparer.ListEquals(Handling, otherT.Handling)) return false; - if(!comparer.ListEquals(TestingDestination, otherT.TestingDestination)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_PreferenceElement, otherT._PreferenceElement)) return false; + if(!comparer.Equals(_Container, otherT._Container)) return false; + if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; + if(!comparer.Equals(_RetentionTime, otherT._RetentionTime)) return false; + if(!comparer.Equals(_SingleUseElement, otherT._SingleUseElement)) return false; + if(!comparer.ListEquals(_RejectionCriterion, otherT._RejectionCriterion)) return false; + if(!comparer.ListEquals(_Handling, otherT._Handling)) return false; + if(!comparer.ListEquals(_TestingDestination, otherT._TestingDestination)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "isDerived": - value = IsDerivedElement; - return IsDerivedElement is not null; + value = _IsDerivedElement; + return _IsDerivedElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "preference": - value = PreferenceElement; - return PreferenceElement is not null; + value = _PreferenceElement; + return _PreferenceElement is not null; case "container": - value = Container; - return Container is not null; + value = _Container; + return _Container is not null; case "requirement": - value = RequirementElement; - return RequirementElement is not null; + value = _RequirementElement; + return _RequirementElement is not null; case "retentionTime": - value = RetentionTime; - return RetentionTime is not null; + value = _RetentionTime; + return _RetentionTime is not null; case "singleUse": - value = SingleUseElement; - return SingleUseElement is not null; + value = _SingleUseElement; + return _SingleUseElement is not null; case "rejectionCriterion": - value = RejectionCriterion; - return RejectionCriterion?.Any() == true; + value = _RejectionCriterion; + return _RejectionCriterion?.Any() == true; case "handling": - value = Handling; - return Handling?.Any() == true; + value = _Handling; + return _Handling?.Any() == true; case "testingDestination": - value = TestingDestination; - return TestingDestination?.Any() == true; + value = _TestingDestination; + return _TestingDestination?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "isDerived": - IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDerivedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preference": - PreferenceElement = (Code)value; + PreferenceElement = (Code?)value; return this; case "container": - Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent)value; + Container = (Hl7.Fhir.Model.SpecimenDefinition.ContainerComponent?)value; return this; case "requirement": - RequirementElement = (Hl7.Fhir.Model.Markdown)value; + RequirementElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "retentionTime": - RetentionTime = (Hl7.Fhir.Model.Duration)value; + RetentionTime = (Hl7.Fhir.Model.Duration?)value; return this; case "singleUse": - SingleUseElement = (Hl7.Fhir.Model.FhirBoolean)value; + SingleUseElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "rejectionCriterion": - RejectionCriterion = (List)value; + RejectionCriterion = (List?)value!; return this; case "handling": - Handling = (List)value; + Handling = (List?)value!; return this; case "testingDestination": - TestingDestination = (List)value; + TestingDestination = (List?)value!; return this; default: return base.SetValue(key, value); @@ -440,16 +427,16 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IsDerivedElement is not null) yield return new KeyValuePair("isDerived",IsDerivedElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (PreferenceElement is not null) yield return new KeyValuePair("preference",PreferenceElement); - if (Container is not null) yield return new KeyValuePair("container",Container); - if (RequirementElement is not null) yield return new KeyValuePair("requirement",RequirementElement); - if (RetentionTime is not null) yield return new KeyValuePair("retentionTime",RetentionTime); - if (SingleUseElement is not null) yield return new KeyValuePair("singleUse",SingleUseElement); - if (RejectionCriterion?.Any() == true) yield return new KeyValuePair("rejectionCriterion",RejectionCriterion); - if (Handling?.Any() == true) yield return new KeyValuePair("handling",Handling); - if (TestingDestination?.Any() == true) yield return new KeyValuePair("testingDestination",TestingDestination); + if (_IsDerivedElement is not null) yield return new KeyValuePair("isDerived",_IsDerivedElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_PreferenceElement is not null) yield return new KeyValuePair("preference",_PreferenceElement); + if (_Container is not null) yield return new KeyValuePair("container",_Container); + if (_RequirementElement is not null) yield return new KeyValuePair("requirement",_RequirementElement); + if (_RetentionTime is not null) yield return new KeyValuePair("retentionTime",_RetentionTime); + if (_SingleUseElement is not null) yield return new KeyValuePair("singleUse",_SingleUseElement); + if (_RejectionCriterion?.Any() == true) yield return new KeyValuePair("rejectionCriterion",_RejectionCriterion); + if (_Handling?.Any() == true) yield return new KeyValuePair("handling",_Handling); + if (_TestingDestination?.Any() == true) yield return new KeyValuePair("testingDestination",_TestingDestination); } } @@ -473,13 +460,13 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("material", Order=40)] [Binding("ContainerMaterial")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Material + public Hl7.Fhir.Model.CodeableConcept? Material { get { return _Material; } set { _Material = value; OnPropertyChanged("Material"); } } - private Hl7.Fhir.Model.CodeableConcept _Material; + private Hl7.Fhir.Model.CodeableConcept? _Material; /// /// Kind of container associated with the kind of specimen. @@ -487,13 +474,13 @@ public Hl7.Fhir.Model.CodeableConcept Material [FhirElement("type", Order=50)] [Binding("ContainerType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Color of container cap. @@ -501,41 +488,38 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("cap", Order=60)] [Binding("ContainerCap")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Cap + public Hl7.Fhir.Model.CodeableConcept? Cap { get { return _Cap; } set { _Cap = value; OnPropertyChanged("Cap"); } } - private Hl7.Fhir.Model.CodeableConcept _Cap; + private Hl7.Fhir.Model.CodeableConcept? _Cap; /// /// The description of the kind of container. /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The description of the kind of container /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -545,13 +529,13 @@ public string Description /// [FhirElement("capacity", Order=80)] [DataMember] - public Hl7.Fhir.Model.Quantity Capacity + public Hl7.Fhir.Model.Quantity? Capacity { get { return _Capacity; } set { _Capacity = value; OnPropertyChanged("Capacity"); } } - private Hl7.Fhir.Model.Quantity _Capacity; + private Hl7.Fhir.Model.Quantity? _Capacity; /// /// Minimum volume. @@ -560,13 +544,13 @@ public Hl7.Fhir.Model.Quantity Capacity [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType MinimumVolume + public Hl7.Fhir.Model.DataType? MinimumVolume { get { return _MinimumVolume; } set { _MinimumVolume = value; OnPropertyChanged("MinimumVolume"); } } - private Hl7.Fhir.Model.DataType _MinimumVolume; + private Hl7.Fhir.Model.DataType? _MinimumVolume; /// /// Additive associated with container. @@ -576,61 +560,54 @@ public Hl7.Fhir.Model.DataType MinimumVolume [DataMember] public List Additive { - get { if(_Additive==null) _Additive = new List(); return _Additive; } + get => _Additive ?? new List(); set { _Additive = value; OnPropertyChanged("Additive"); } } - private List _Additive; + private List? _Additive; /// /// Special processing applied to the container for this specimen type. /// [FhirElement("preparation", Order=110)] [DataMember] - public Hl7.Fhir.Model.Markdown PreparationElement + public Hl7.Fhir.Model.Markdown? PreparationElement { get { return _PreparationElement; } set { _PreparationElement = value; OnPropertyChanged("PreparationElement"); } } - private Hl7.Fhir.Model.Markdown _PreparationElement; + private Hl7.Fhir.Model.Markdown? _PreparationElement; /// /// Special processing applied to the container for this specimen type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Preparation + public string? Preparation { - get { return PreparationElement != null ? PreparationElement.Value : null; } + get => _PreparationElement?.Value; set { - if (value == null) - PreparationElement = null; - else - PreparationElement = new Hl7.Fhir.Model.Markdown(value); + PreparationElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Preparation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ContainerComponent; - - if (dest == null) - { + if(other is not ContainerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Material != null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)Material.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Cap != null) dest.Cap = (Hl7.Fhir.Model.CodeableConcept)Cap.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Capacity != null) dest.Capacity = (Hl7.Fhir.Model.Quantity)Capacity.DeepCopyInternal(); - if(MinimumVolume != null) dest.MinimumVolume = (Hl7.Fhir.Model.DataType)MinimumVolume.DeepCopyInternal(); - if(Additive.Any()) dest.Additive = new List(Additive.DeepCopyInternal()); - if(PreparationElement != null) dest.PreparationElement = (Hl7.Fhir.Model.Markdown)PreparationElement.DeepCopyInternal(); + if(_Material is not null) dest.Material = (Hl7.Fhir.Model.CodeableConcept)_Material.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Cap is not null) dest.Cap = (Hl7.Fhir.Model.CodeableConcept)_Cap.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Capacity is not null) dest.Capacity = (Hl7.Fhir.Model.Quantity)_Capacity.DeepCopyInternal(); + if(_MinimumVolume is not null) dest.MinimumVolume = (Hl7.Fhir.Model.DataType)_MinimumVolume.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = new List(_Additive.DeepCopyInternal()); + if(_PreparationElement is not null) dest.PreparationElement = (Hl7.Fhir.Model.Markdown)_PreparationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -642,83 +619,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ContainerComponent; - if(otherT == null) return false; + if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Material, otherT.Material)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Cap, otherT.Cap)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Capacity, otherT.Capacity)) return false; - if(!comparer.Equals(MinimumVolume, otherT.MinimumVolume)) return false; - if(!comparer.ListEquals(Additive, otherT.Additive)) return false; - if(!comparer.Equals(PreparationElement, otherT.PreparationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Cap, otherT._Cap)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; + if(!comparer.Equals(_MinimumVolume, otherT._MinimumVolume)) return false; + if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; + if(!comparer.Equals(_PreparationElement, otherT._PreparationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "material": - value = Material; - return Material is not null; + value = _Material; + return _Material is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "cap": - value = Cap; - return Cap is not null; + value = _Cap; + return _Cap is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "capacity": - value = Capacity; - return Capacity is not null; + value = _Capacity; + return _Capacity is not null; case "minimumVolume": - value = MinimumVolume; - return MinimumVolume is not null; + value = _MinimumVolume; + return _MinimumVolume is not null; case "additive": - value = Additive; - return Additive?.Any() == true; + value = _Additive; + return _Additive?.Any() == true; case "preparation": - value = PreparationElement; - return PreparationElement is not null; + value = _PreparationElement; + return _PreparationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "material": - Material = (Hl7.Fhir.Model.CodeableConcept)value; + Material = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "cap": - Cap = (Hl7.Fhir.Model.CodeableConcept)value; + Cap = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "capacity": - Capacity = (Hl7.Fhir.Model.Quantity)value; + Capacity = (Hl7.Fhir.Model.Quantity?)value; return this; case "minimumVolume": - MinimumVolume = (Hl7.Fhir.Model.DataType)value; + MinimumVolume = (Hl7.Fhir.Model.DataType?)value; return this; case "additive": - Additive = (List)value; + Additive = (List?)value!; return this; case "preparation": - PreparationElement = (Hl7.Fhir.Model.Markdown)value; + PreparationElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -729,14 +706,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Material is not null) yield return new KeyValuePair("material",Material); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Cap is not null) yield return new KeyValuePair("cap",Cap); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Capacity is not null) yield return new KeyValuePair("capacity",Capacity); - if (MinimumVolume is not null) yield return new KeyValuePair("minimumVolume",MinimumVolume); - if (Additive?.Any() == true) yield return new KeyValuePair("additive",Additive); - if (PreparationElement is not null) yield return new KeyValuePair("preparation",PreparationElement); + if (_Material is not null) yield return new KeyValuePair("material",_Material); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Cap is not null) yield return new KeyValuePair("cap",_Cap); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Capacity is not null) yield return new KeyValuePair("capacity",_Capacity); + if (_MinimumVolume is not null) yield return new KeyValuePair("minimumVolume",_MinimumVolume); + if (_Additive?.Any() == true) yield return new KeyValuePair("additive",_Additive); + if (_PreparationElement is not null) yield return new KeyValuePair("preparation",_PreparationElement); } } @@ -767,25 +744,21 @@ public partial class AdditiveComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Additive + public Hl7.Fhir.Model.DataType? Additive { get { return _Additive; } set { _Additive = value; OnPropertyChanged("Additive"); } } - private Hl7.Fhir.Model.DataType _Additive; + private Hl7.Fhir.Model.DataType? _Additive; protected internal override void CopyToInternal(Base other) { - var dest = other as AdditiveComponent; - - if (dest == null) - { + if(other is not AdditiveComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Additive != null) dest.Additive = (Hl7.Fhir.Model.DataType)Additive.DeepCopyInternal(); + if(_Additive is not null) dest.Additive = (Hl7.Fhir.Model.DataType)_Additive.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -797,34 +770,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AdditiveComponent; - if(otherT == null) return false; + if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Additive, otherT.Additive)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Additive, otherT._Additive)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "additive": - value = Additive; - return Additive is not null; + value = _Additive; + return _Additive is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "additive": - Additive = (Hl7.Fhir.Model.DataType)value; + Additive = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -835,7 +808,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Additive is not null) yield return new KeyValuePair("additive",Additive); + if (_Additive is not null) yield return new KeyValuePair("additive",_Additive); } } @@ -862,85 +835,78 @@ public partial class HandlingComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("temperatureQualifier", Order=40)] [Binding("HandlingConditionSet")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TemperatureQualifier + public Hl7.Fhir.Model.CodeableConcept? TemperatureQualifier { get { return _TemperatureQualifier; } set { _TemperatureQualifier = value; OnPropertyChanged("TemperatureQualifier"); } } - private Hl7.Fhir.Model.CodeableConcept _TemperatureQualifier; + private Hl7.Fhir.Model.CodeableConcept? _TemperatureQualifier; /// /// Temperature range for these handling instructions. /// [FhirElement("temperatureRange", Order=50)] [DataMember] - public Hl7.Fhir.Model.Range TemperatureRange + public Hl7.Fhir.Model.Range? TemperatureRange { get { return _TemperatureRange; } set { _TemperatureRange = value; OnPropertyChanged("TemperatureRange"); } } - private Hl7.Fhir.Model.Range _TemperatureRange; + private Hl7.Fhir.Model.Range? _TemperatureRange; /// /// Maximum preservation time. /// [FhirElement("maxDuration", Order=60)] [DataMember] - public Hl7.Fhir.Model.Duration MaxDuration + public Hl7.Fhir.Model.Duration? MaxDuration { get { return _MaxDuration; } set { _MaxDuration = value; OnPropertyChanged("MaxDuration"); } } - private Hl7.Fhir.Model.Duration _MaxDuration; + private Hl7.Fhir.Model.Duration? _MaxDuration; /// /// Preservation instruction. /// [FhirElement("instruction", Order=70)] [DataMember] - public Hl7.Fhir.Model.Markdown InstructionElement + public Hl7.Fhir.Model.Markdown? InstructionElement { get { return _InstructionElement; } set { _InstructionElement = value; OnPropertyChanged("InstructionElement"); } } - private Hl7.Fhir.Model.Markdown _InstructionElement; + private Hl7.Fhir.Model.Markdown? _InstructionElement; /// /// Preservation instruction /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Instruction + public string? Instruction { - get { return InstructionElement != null ? InstructionElement.Value : null; } + get => _InstructionElement?.Value; set { - if (value == null) - InstructionElement = null; - else - InstructionElement = new Hl7.Fhir.Model.Markdown(value); + InstructionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Instruction"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as HandlingComponent; - - if (dest == null) - { + if(other is not HandlingComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TemperatureQualifier != null) dest.TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)TemperatureQualifier.DeepCopyInternal(); - if(TemperatureRange != null) dest.TemperatureRange = (Hl7.Fhir.Model.Range)TemperatureRange.DeepCopyInternal(); - if(MaxDuration != null) dest.MaxDuration = (Hl7.Fhir.Model.Duration)MaxDuration.DeepCopyInternal(); - if(InstructionElement != null) dest.InstructionElement = (Hl7.Fhir.Model.Markdown)InstructionElement.DeepCopyInternal(); + if(_TemperatureQualifier is not null) dest.TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)_TemperatureQualifier.DeepCopyInternal(); + if(_TemperatureRange is not null) dest.TemperatureRange = (Hl7.Fhir.Model.Range)_TemperatureRange.DeepCopyInternal(); + if(_MaxDuration is not null) dest.MaxDuration = (Hl7.Fhir.Model.Duration)_MaxDuration.DeepCopyInternal(); + if(_InstructionElement is not null) dest.InstructionElement = (Hl7.Fhir.Model.Markdown)_InstructionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -952,55 +918,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HandlingComponent; - if(otherT == null) return false; + if(other is not HandlingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TemperatureQualifier, otherT.TemperatureQualifier)) return false; - if(!comparer.Equals(TemperatureRange, otherT.TemperatureRange)) return false; - if(!comparer.Equals(MaxDuration, otherT.MaxDuration)) return false; - if(!comparer.Equals(InstructionElement, otherT.InstructionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; + if(!comparer.Equals(_TemperatureRange, otherT._TemperatureRange)) return false; + if(!comparer.Equals(_MaxDuration, otherT._MaxDuration)) return false; + if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "temperatureQualifier": - value = TemperatureQualifier; - return TemperatureQualifier is not null; + value = _TemperatureQualifier; + return _TemperatureQualifier is not null; case "temperatureRange": - value = TemperatureRange; - return TemperatureRange is not null; + value = _TemperatureRange; + return _TemperatureRange is not null; case "maxDuration": - value = MaxDuration; - return MaxDuration is not null; + value = _MaxDuration; + return _MaxDuration is not null; case "instruction": - value = InstructionElement; - return InstructionElement is not null; + value = _InstructionElement; + return _InstructionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "temperatureQualifier": - TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept)value; + TemperatureQualifier = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "temperatureRange": - TemperatureRange = (Hl7.Fhir.Model.Range)value; + TemperatureRange = (Hl7.Fhir.Model.Range?)value; return this; case "maxDuration": - MaxDuration = (Hl7.Fhir.Model.Duration)value; + MaxDuration = (Hl7.Fhir.Model.Duration?)value; return this; case "instruction": - InstructionElement = (Hl7.Fhir.Model.Markdown)value; + InstructionElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1011,10 +977,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TemperatureQualifier is not null) yield return new KeyValuePair("temperatureQualifier",TemperatureQualifier); - if (TemperatureRange is not null) yield return new KeyValuePair("temperatureRange",TemperatureRange); - if (MaxDuration is not null) yield return new KeyValuePair("maxDuration",MaxDuration); - if (InstructionElement is not null) yield return new KeyValuePair("instruction",InstructionElement); + if (_TemperatureQualifier is not null) yield return new KeyValuePair("temperatureQualifier",_TemperatureQualifier); + if (_TemperatureRange is not null) yield return new KeyValuePair("temperatureRange",_TemperatureRange); + if (_MaxDuration is not null) yield return new KeyValuePair("maxDuration",_MaxDuration); + if (_InstructionElement is not null) yield return new KeyValuePair("instruction",_InstructionElement); } } @@ -1024,28 +990,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Logical canonical URL to reference this SpecimenDefinition (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1055,41 +1018,38 @@ public string Url /// [FhirElement("identifier", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Business version of the SpecimenDefinition. /// [FhirElement("version", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the SpecimenDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1101,41 +1061,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this {{title}} (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this {{title}} (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1145,28 +1102,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this SpecimenDefinition (Human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1179,24 +1133,24 @@ public string Title [DataMember] public List DerivedFromCanonicalElement { - get { if(_DerivedFromCanonicalElement==null) _DerivedFromCanonicalElement = new List(); return _DerivedFromCanonicalElement; } + get => _DerivedFromCanonicalElement ?? new List(); set { _DerivedFromCanonicalElement = value; OnPropertyChanged("DerivedFromCanonicalElement"); } } - private List _DerivedFromCanonicalElement; + private List? _DerivedFromCanonicalElement; /// /// Based on FHIR definition of another SpecimenDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFromCanonical + public IEnumerable? DerivedFromCanonical { - get { return DerivedFromCanonicalElement != null ? DerivedFromCanonicalElement.Select(elem => elem.Value) : null; } + get => _DerivedFromCanonicalElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromCanonicalElement = null; + DerivedFromCanonicalElement = null!; else DerivedFromCanonicalElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFromCanonical"); @@ -1211,24 +1165,24 @@ public IEnumerable DerivedFromCanonical [DataMember] public List DerivedFromUriElement { - get { if(_DerivedFromUriElement==null) _DerivedFromUriElement = new List(); return _DerivedFromUriElement; } + get => _DerivedFromUriElement ?? new List(); set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } - private List _DerivedFromUriElement; + private List? _DerivedFromUriElement; /// /// Based on external definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFromUri + public IEnumerable? DerivedFromUri { - get { return DerivedFromUriElement != null ? DerivedFromUriElement.Select(elem => elem.Value) : null; } + get => _DerivedFromUriElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromUriElement = null; + DerivedFromUriElement = null!; else DerivedFromUriElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("DerivedFromUri"); @@ -1243,13 +1197,13 @@ public IEnumerable DerivedFromUri [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1258,13 +1212,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1274,13 +1225,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// If this SpecimenDefinition is not for real usage @@ -1289,13 +1240,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1308,41 +1256,38 @@ public bool? Experimental [References("Group")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Subject + public Hl7.Fhir.Model.DataType? Subject { get { return _Subject; } set { _Subject = value; OnPropertyChanged("Subject"); } } - private Hl7.Fhir.Model.DataType _Subject; + private Hl7.Fhir.Model.DataType? _Subject; /// /// Date status first applied. /// [FhirElement("date", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date status first applied /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1352,28 +1297,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// The name of the individual or organization that published the SpecimenDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1386,39 +1328,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the SpecimenDefinition. /// [FhirElement("description", Order=230)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the SpecimenDefinition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1431,11 +1370,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for this SpecimenDefinition (if applicable). @@ -1446,39 +1385,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this SpecimenDefinition is defined. /// [FhirElement("purpose", Order=260)] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this SpecimenDefinition is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1488,28 +1424,25 @@ public string Purpose /// [FhirElement("copyright", Order=270)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1519,28 +1452,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=280)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1550,28 +1480,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=290)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When SpecimenDefinition was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1581,28 +1508,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=300)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// The date on which the asset content was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1612,13 +1536,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=310)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Kind of material to collect. @@ -1626,13 +1550,13 @@ public Hl7.Fhir.Model.Period EffectivePeriod [FhirElement("typeCollected", InSummary=true, Order=320)] [Binding("CollectedSpecimenType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept TypeCollected + public Hl7.Fhir.Model.CodeableConcept? TypeCollected { get { return _TypeCollected; } set { _TypeCollected = value; OnPropertyChanged("TypeCollected"); } } - private Hl7.Fhir.Model.CodeableConcept _TypeCollected; + private Hl7.Fhir.Model.CodeableConcept? _TypeCollected; /// /// Patient preparation for collection. @@ -1643,39 +1567,36 @@ public Hl7.Fhir.Model.CodeableConcept TypeCollected [DataMember] public List PatientPreparation { - get { if(_PatientPreparation==null) _PatientPreparation = new List(); return _PatientPreparation; } + get => _PatientPreparation ?? new List(); set { _PatientPreparation = value; OnPropertyChanged("PatientPreparation"); } } - private List _PatientPreparation; + private List? _PatientPreparation; /// /// Time aspect for collection. /// [FhirElement("timeAspect", InSummary=true, Order=340)] [DataMember] - public Hl7.Fhir.Model.FhirString TimeAspectElement + public Hl7.Fhir.Model.FhirString? TimeAspectElement { get { return _TimeAspectElement; } set { _TimeAspectElement = value; OnPropertyChanged("TimeAspectElement"); } } - private Hl7.Fhir.Model.FhirString _TimeAspectElement; + private Hl7.Fhir.Model.FhirString? _TimeAspectElement; /// /// Time aspect for collection /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TimeAspect + public string? TimeAspect { - get { return TimeAspectElement != null ? TimeAspectElement.Value : null; } + get => _TimeAspectElement?.Value; set { - if (value == null) - TimeAspectElement = null; - else - TimeAspectElement = new Hl7.Fhir.Model.FhirString(value); + TimeAspectElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("TimeAspect"); } } @@ -1689,11 +1610,11 @@ public string TimeAspect [DataMember] public List Collection { - get { if(_Collection==null) _Collection = new List(); return _Collection; } + get => _Collection ?? new List(); set { _Collection = value; OnPropertyChanged("Collection"); } } - private List _Collection; + private List? _Collection; /// /// Specimen in container intended for testing by lab. @@ -1703,52 +1624,48 @@ public List Collection [DataMember] public List TypeTested { - get { if(_TypeTested==null) _TypeTested = new List(); return _TypeTested; } + get => _TypeTested ?? new List(); set { _TypeTested = value; OnPropertyChanged("TypeTested"); } } - private List _TypeTested; + private List? _TypeTested; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SpecimenDefinition; - - if (dest == null) - { + if(other is not SpecimenDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromCanonicalElement.Any()) dest.DerivedFromCanonicalElement = new List(DerivedFromCanonicalElement.DeepCopyInternal()); - if(DerivedFromUriElement.Any()) dest.DerivedFromUriElement = new List(DerivedFromUriElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(Subject != null) dest.Subject = (Hl7.Fhir.Model.DataType)Subject.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(TypeCollected != null) dest.TypeCollected = (Hl7.Fhir.Model.CodeableConcept)TypeCollected.DeepCopyInternal(); - if(PatientPreparation.Any()) dest.PatientPreparation = new List(PatientPreparation.DeepCopyInternal()); - if(TimeAspectElement != null) dest.TimeAspectElement = (Hl7.Fhir.Model.FhirString)TimeAspectElement.DeepCopyInternal(); - if(Collection.Any()) dest.Collection = new List(Collection.DeepCopyInternal()); - if(TypeTested.Any()) dest.TypeTested = new List(TypeTested.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromCanonicalElement is not null) dest.DerivedFromCanonicalElement = new List(_DerivedFromCanonicalElement.DeepCopyInternal()); + if(_DerivedFromUriElement is not null) dest.DerivedFromUriElement = new List(_DerivedFromUriElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_Subject is not null) dest.Subject = (Hl7.Fhir.Model.DataType)_Subject.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_TypeCollected is not null) dest.TypeCollected = (Hl7.Fhir.Model.CodeableConcept)_TypeCollected.DeepCopyInternal(); + if(_PatientPreparation is not null) dest.PatientPreparation = new List(_PatientPreparation.DeepCopyInternal()); + if(_TimeAspectElement is not null) dest.TimeAspectElement = (Hl7.Fhir.Model.FhirString)_TimeAspectElement.DeepCopyInternal(); + if(_Collection is not null) dest.Collection = new List(_Collection.DeepCopyInternal()); + if(_TypeTested is not null) dest.TypeTested = new List(_TypeTested.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1760,223 +1677,223 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SpecimenDefinition; - if(otherT == null) return false; + if(other is not SpecimenDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromCanonicalElement, otherT.DerivedFromCanonicalElement)) return false; - if(!comparer.ListEquals(DerivedFromUriElement, otherT.DerivedFromUriElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(Subject, otherT.Subject)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.Equals(TypeCollected, otherT.TypeCollected)) return false; - if(!comparer.ListEquals(PatientPreparation, otherT.PatientPreparation)) return false; - if(!comparer.Equals(TimeAspectElement, otherT.TimeAspectElement)) return false; - if(!comparer.ListEquals(Collection, otherT.Collection)) return false; - if(!comparer.ListEquals(TypeTested, otherT.TypeTested)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromCanonicalElement, otherT._DerivedFromCanonicalElement)) return false; + if(!comparer.ListEquals(_DerivedFromUriElement, otherT._DerivedFromUriElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_Subject, otherT._Subject)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.Equals(_TypeCollected, otherT._TypeCollected)) return false; + if(!comparer.ListEquals(_PatientPreparation, otherT._PatientPreparation)) return false; + if(!comparer.Equals(_TimeAspectElement, otherT._TimeAspectElement)) return false; + if(!comparer.ListEquals(_Collection, otherT._Collection)) return false; + if(!comparer.ListEquals(_TypeTested, otherT._TypeTested)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFromCanonical": - value = DerivedFromCanonicalElement; - return DerivedFromCanonicalElement?.Any() == true; + value = _DerivedFromCanonicalElement; + return _DerivedFromCanonicalElement?.Any() == true; case "derivedFromUri": - value = DerivedFromUriElement; - return DerivedFromUriElement?.Any() == true; + value = _DerivedFromUriElement; + return _DerivedFromUriElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "subject": - value = Subject; - return Subject is not null; + value = _Subject; + return _Subject is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "typeCollected": - value = TypeCollected; - return TypeCollected is not null; + value = _TypeCollected; + return _TypeCollected is not null; case "patientPreparation": - value = PatientPreparation; - return PatientPreparation?.Any() == true; + value = _PatientPreparation; + return _PatientPreparation?.Any() == true; case "timeAspect": - value = TimeAspectElement; - return TimeAspectElement is not null; + value = _TimeAspectElement; + return _TimeAspectElement is not null; case "collection": - value = Collection; - return Collection?.Any() == true; + value = _Collection; + return _Collection?.Any() == true; case "typeTested": - value = TypeTested; - return TypeTested?.Any() == true; + value = _TypeTested; + return _TypeTested?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFromCanonical": - DerivedFromCanonicalElement = (List)value; + DerivedFromCanonicalElement = (List?)value!; return this; case "derivedFromUri": - DerivedFromUriElement = (List)value; + DerivedFromUriElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "subject": - Subject = (Hl7.Fhir.Model.DataType)value; + Subject = (Hl7.Fhir.Model.DataType?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "typeCollected": - TypeCollected = (Hl7.Fhir.Model.CodeableConcept)value; + TypeCollected = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "patientPreparation": - PatientPreparation = (List)value; + PatientPreparation = (List?)value!; return this; case "timeAspect": - TimeAspectElement = (Hl7.Fhir.Model.FhirString)value; + TimeAspectElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "collection": - Collection = (List)value; + Collection = (List?)value!; return this; case "typeTested": - TypeTested = (List)value; + TypeTested = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1987,34 +1904,34 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromCanonicalElement?.Any() == true) yield return new KeyValuePair("derivedFromCanonical",DerivedFromCanonicalElement); - if (DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",DerivedFromUriElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (Subject is not null) yield return new KeyValuePair("subject",Subject); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (TypeCollected is not null) yield return new KeyValuePair("typeCollected",TypeCollected); - if (PatientPreparation?.Any() == true) yield return new KeyValuePair("patientPreparation",PatientPreparation); - if (TimeAspectElement is not null) yield return new KeyValuePair("timeAspect",TimeAspectElement); - if (Collection?.Any() == true) yield return new KeyValuePair("collection",Collection); - if (TypeTested?.Any() == true) yield return new KeyValuePair("typeTested",TypeTested); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromCanonicalElement?.Any() == true) yield return new KeyValuePair("derivedFromCanonical",_DerivedFromCanonicalElement); + if (_DerivedFromUriElement?.Any() == true) yield return new KeyValuePair("derivedFromUri",_DerivedFromUriElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_Subject is not null) yield return new KeyValuePair("subject",_Subject); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_TypeCollected is not null) yield return new KeyValuePair("typeCollected",_TypeCollected); + if (_PatientPreparation?.Any() == true) yield return new KeyValuePair("patientPreparation",_PatientPreparation); + if (_TimeAspectElement is not null) yield return new KeyValuePair("timeAspect",_TimeAspectElement); + if (_Collection?.Any() == true) yield return new KeyValuePair("collection",_Collection); + if (_TypeTested?.Any() == true) yield return new KeyValuePair("typeTested",_TypeTested); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs index eb57135a6..b72ce00b7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -343,28 +346,25 @@ public partial class StructureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical UrlElement + public Hl7.Fhir.Model.Canonical? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.Canonical _UrlElement; + private Hl7.Fhir.Model.Canonical? _UrlElement; /// /// Canonical reference to structure definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.Canonical(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Url"); } } @@ -377,13 +377,13 @@ public string Url [Binding("StructureMapModelMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | queried | target | produced @@ -392,13 +392,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -408,28 +405,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapModelMode? Mode /// [FhirElement("alias", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString AliasElement + public Hl7.Fhir.Model.FhirString? AliasElement { get { return _AliasElement; } set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } - private Hl7.Fhir.Model.FhirString _AliasElement; + private Hl7.Fhir.Model.FhirString? _AliasElement; /// /// Name for type in this map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Alias + public string? Alias { - get { return AliasElement != null ? AliasElement.Value : null; } + get => _AliasElement?.Value; set { - if (value == null) - AliasElement = null; - else - AliasElement = new Hl7.Fhir.Model.FhirString(value); + AliasElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Alias"); } } @@ -439,46 +433,39 @@ public string Alias /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation on use of structure /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureComponent; - - if (dest == null) - { + if(other is not StructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)UrlElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(AliasElement != null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)AliasElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.Canonical)_UrlElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_AliasElement is not null) dest.AliasElement = (Hl7.Fhir.Model.FhirString)_AliasElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -490,55 +477,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureComponent; - if(otherT == null) return false; + if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(AliasElement, otherT.AliasElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "alias": - value = AliasElement; - return AliasElement is not null; + value = _AliasElement; + return _AliasElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.Canonical)value; + UrlElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "alias": - AliasElement = (Hl7.Fhir.Model.FhirString)value; + AliasElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -549,10 +536,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (AliasElement is not null) yield return new KeyValuePair("alias",AliasElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_AliasElement is not null) yield return new KeyValuePair("alias",_AliasElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -578,28 +565,25 @@ public partial class ConstComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Constant name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -609,44 +593,37 @@ public string Name /// [FhirElement("value", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// FHIRPath exression - value of the constant /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ConstComponent; - - if (dest == null) - { + if(other is not ConstComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -658,41 +635,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ConstComponent; - if(otherT == null) return false; + if(other is not ConstComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -703,8 +680,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -731,28 +708,25 @@ public partial class GroupComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Human-readable label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -762,28 +736,25 @@ public string Name /// [FhirElement("extends", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Id ExtendsElement + public Hl7.Fhir.Model.Id? ExtendsElement { get { return _ExtendsElement; } set { _ExtendsElement = value; OnPropertyChanged("ExtendsElement"); } } - private Hl7.Fhir.Model.Id _ExtendsElement; + private Hl7.Fhir.Model.Id? _ExtendsElement; /// /// Another group that this group adds rules to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Extends + public string? Extends { - get { return ExtendsElement != null ? ExtendsElement.Value : null; } + get => _ExtendsElement?.Value; set { - if (value == null) - ExtendsElement = null; - else - ExtendsElement = new Hl7.Fhir.Model.Id(value); + ExtendsElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Extends"); } } @@ -795,13 +766,13 @@ public string Extends [DeclaredType(Type = typeof(Code))] [Binding("StructureMapGroupTypeMode")] [DataMember] - public Code TypeModeElement + public Code? TypeModeElement { get { return _TypeModeElement; } set { _TypeModeElement = value; OnPropertyChanged("TypeModeElement"); } } - private Code _TypeModeElement; + private Code? _TypeModeElement; /// /// types | type-and-types @@ -810,13 +781,10 @@ public Code TypeModeEleme [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode { - get { return TypeModeElement != null ? TypeModeElement.Value : null; } + get => _TypeModeElement?.Value; set { - if (value == null) - TypeModeElement = null; - else - TypeModeElement = new Code(value); + TypeModeElement = value is null ? null : new Code(value); OnPropertyChanged("TypeMode"); } } @@ -826,28 +794,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapGroupTypeMode? TypeMode /// [FhirElement("documentation", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Additional description/explanation for group /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } @@ -860,11 +825,11 @@ public string Documentation [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Transform Rule from source to target. @@ -874,28 +839,24 @@ public List Input [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; protected internal override void CopyToInternal(Base other) { - var dest = other as GroupComponent; - - if (dest == null) - { + if(other is not GroupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(ExtendsElement != null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)ExtendsElement.DeepCopyInternal(); - if(TypeModeElement != null) dest.TypeModeElement = (Code)TypeModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_ExtendsElement is not null) dest.ExtendsElement = (Hl7.Fhir.Model.Id)_ExtendsElement.DeepCopyInternal(); + if(_TypeModeElement is not null) dest.TypeModeElement = (Code)_TypeModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -907,69 +868,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GroupComponent; - if(otherT == null) return false; + if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ExtendsElement, otherT.ExtendsElement)) return false; - if(!comparer.Equals(TypeModeElement, otherT.TypeModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; + if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "extends": - value = ExtendsElement; - return ExtendsElement is not null; + value = _ExtendsElement; + return _ExtendsElement is not null; case "typeMode": - value = TypeModeElement; - return TypeModeElement is not null; + value = _TypeModeElement; + return _TypeModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "extends": - ExtendsElement = (Hl7.Fhir.Model.Id)value; + ExtendsElement = (Hl7.Fhir.Model.Id?)value; return this; case "typeMode": - TypeModeElement = (Code)value; + TypeModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; default: return base.SetValue(key, value); @@ -980,12 +941,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ExtendsElement is not null) yield return new KeyValuePair("extends",ExtendsElement); - if (TypeModeElement is not null) yield return new KeyValuePair("typeMode",TypeModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ExtendsElement is not null) yield return new KeyValuePair("extends",_ExtendsElement); + if (_TypeModeElement is not null) yield return new KeyValuePair("typeMode",_TypeModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); } } @@ -1013,28 +974,25 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -1044,28 +1002,25 @@ public string Name /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Type for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1078,13 +1033,13 @@ public string Type [Binding("StructureMapInputMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ModeElement + public Code? ModeElement { get { return _ModeElement; } set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } - private Code _ModeElement; + private Code? _ModeElement; /// /// source | target @@ -1093,13 +1048,10 @@ public Code ModeElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode { - get { return ModeElement != null ? ModeElement.Value : null; } + get => _ModeElement?.Value; set { - if (value == null) - ModeElement = null; - else - ModeElement = new Code(value); + ModeElement = value is null ? null : new Code(value); OnPropertyChanged("Mode"); } } @@ -1109,46 +1061,39 @@ public Hl7.Fhir.Model.StructureMap.StructureMapInputMode? Mode /// [FhirElement("documentation", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(ModeElement != null) dest.ModeElement = (Code)ModeElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_ModeElement is not null) dest.ModeElement = (Code)_ModeElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1160,55 +1105,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(ModeElement, otherT.ModeElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "mode": - value = ModeElement; - return ModeElement is not null; + value = _ModeElement; + return _ModeElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "mode": - ModeElement = (Code)value; + ModeElement = (Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1219,10 +1164,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (ModeElement is not null) yield return new KeyValuePair("mode",ModeElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_ModeElement is not null) yield return new KeyValuePair("mode",_ModeElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1245,28 +1190,25 @@ public partial class RuleComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of the rule for internal references /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -1279,11 +1221,11 @@ public string Name [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; /// /// Content to create because of this mapping rule. @@ -1293,11 +1235,11 @@ public List Source [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// Rules contained in this rule. @@ -1307,11 +1249,11 @@ public List Target [DataMember] public List Rule { - get { if(_Rule==null) _Rule = new List(); return _Rule; } + get => _Rule ?? new List(); set { _Rule = value; OnPropertyChanged("Rule"); } } - private List _Rule; + private List? _Rule; /// /// Which other rules to apply in the context of this rule. @@ -1321,59 +1263,52 @@ public List Rule [DataMember] public List Dependent { - get { if(_Dependent==null) _Dependent = new List(); return _Dependent; } + get => _Dependent ?? new List(); set { _Dependent = value; OnPropertyChanged("Dependent"); } } - private List _Dependent; + private List? _Dependent; /// /// Documentation for this instance of data. /// [FhirElement("documentation", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Documentation for this instance of data /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RuleComponent; - - if (dest == null) - { + if(other is not RuleComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(Rule.Any()) dest.Rule = new List(Rule.DeepCopyInternal()); - if(Dependent.Any()) dest.Dependent = new List(Dependent.DeepCopyInternal()); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_Rule is not null) dest.Rule = new List(_Rule.DeepCopyInternal()); + if(_Dependent is not null) dest.Dependent = new List(_Dependent.DeepCopyInternal()); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1385,69 +1320,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RuleComponent; - if(otherT == null) return false; + if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(Rule, otherT.Rule)) return false; - if(!comparer.ListEquals(Dependent, otherT.Dependent)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; + if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "rule": - value = Rule; - return Rule?.Any() == true; + value = _Rule; + return _Rule?.Any() == true; case "dependent": - value = Dependent; - return Dependent?.Any() == true; + value = _Dependent; + return _Dependent?.Any() == true; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; case "rule": - Rule = (List)value; + Rule = (List?)value!; return this; case "dependent": - Dependent = (List)value; + Dependent = (List?)value!; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1458,12 +1393,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (Rule?.Any() == true) yield return new KeyValuePair("rule",Rule); - if (Dependent?.Any() == true) yield return new KeyValuePair("dependent",Dependent); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_Rule?.Any() == true) yield return new KeyValuePair("rule",_Rule); + if (_Dependent?.Any() == true) yield return new KeyValuePair("dependent",_Dependent); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1487,28 +1422,25 @@ public partial class SourceComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("context", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id ContextElement + public Hl7.Fhir.Model.Id? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.Id _ContextElement; + private Hl7.Fhir.Model.Id? _ContextElement; /// /// Type or variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.Id(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Context"); } } @@ -1518,13 +1450,13 @@ public string Context /// [FhirElement("min", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer MinElement + public Hl7.Fhir.Model.Integer? MinElement { get { return _MinElement; } set { _MinElement = value; OnPropertyChanged("MinElement"); } } - private Hl7.Fhir.Model.Integer _MinElement; + private Hl7.Fhir.Model.Integer? _MinElement; /// /// Specified minimum cardinality @@ -1533,13 +1465,10 @@ public Hl7.Fhir.Model.Integer MinElement [IgnoreDataMember] public int? Min { - get { return MinElement != null ? MinElement.Value : null; } + get => _MinElement?.Value; set { - if (value == null) - MinElement = null; - else - MinElement = new Hl7.Fhir.Model.Integer(value); + MinElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Min"); } } @@ -1549,28 +1478,25 @@ public int? Min /// [FhirElement("max", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MaxElement + public Hl7.Fhir.Model.FhirString? MaxElement { get { return _MaxElement; } set { _MaxElement = value; OnPropertyChanged("MaxElement"); } } - private Hl7.Fhir.Model.FhirString _MaxElement; + private Hl7.Fhir.Model.FhirString? _MaxElement; /// /// Specified maximum cardinality (number or *) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Max + public string? Max { - get { return MaxElement != null ? MaxElement.Value : null; } + get => _MaxElement?.Value; set { - if (value == null) - MaxElement = null; - else - MaxElement = new Hl7.Fhir.Model.FhirString(value); + MaxElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Max"); } } @@ -1580,28 +1506,25 @@ public string Max /// [FhirElement("type", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString TypeElement + public Hl7.Fhir.Model.FhirString? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Hl7.Fhir.Model.FhirString _TypeElement; + private Hl7.Fhir.Model.FhirString? _TypeElement; /// /// Rule only applies if source has this type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Type + public string? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Hl7.Fhir.Model.FhirString(value); + TypeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Type"); } } @@ -1611,28 +1534,25 @@ public string Type /// [FhirElement("defaultValue", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString DefaultValueElement + public Hl7.Fhir.Model.FhirString? DefaultValueElement { get { return _DefaultValueElement; } set { _DefaultValueElement = value; OnPropertyChanged("DefaultValueElement"); } } - private Hl7.Fhir.Model.FhirString _DefaultValueElement; + private Hl7.Fhir.Model.FhirString? _DefaultValueElement; /// /// Default value if no value exists /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DefaultValue + public string? DefaultValue { - get { return DefaultValueElement != null ? DefaultValueElement.Value : null; } + get => _DefaultValueElement?.Value; set { - if (value == null) - DefaultValueElement = null; - else - DefaultValueElement = new Hl7.Fhir.Model.FhirString(value); + DefaultValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DefaultValue"); } } @@ -1642,28 +1562,25 @@ public string DefaultValue /// [FhirElement("element", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Optional field for this source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -1675,13 +1592,13 @@ public string Element [DeclaredType(Type = typeof(Code))] [Binding("StructureMapSourceListMode")] [DataMember] - public Code ListModeElement + public Code? ListModeElement { get { return _ListModeElement; } set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private Code _ListModeElement; + private Code? _ListModeElement; /// /// first | not_first | last | not_last | only_one @@ -1690,13 +1607,10 @@ public Code ListModeElem [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode { - get { return ListModeElement != null ? ListModeElement.Value : null; } + get => _ListModeElement?.Value; set { - if (value == null) - ListModeElement = null; - else - ListModeElement = new Code(value); + ListModeElement = value is null ? null : new Code(value); OnPropertyChanged("ListMode"); } } @@ -1706,28 +1620,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapSourceListMode? ListMode /// [FhirElement("variable", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -1737,28 +1648,25 @@ public string Variable /// [FhirElement("condition", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ConditionElement + public Hl7.Fhir.Model.FhirString? ConditionElement { get { return _ConditionElement; } set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } - private Hl7.Fhir.Model.FhirString _ConditionElement; + private Hl7.Fhir.Model.FhirString? _ConditionElement; /// /// FHIRPath expression - must be true or the rule does not apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Condition + public string? Condition { - get { return ConditionElement != null ? ConditionElement.Value : null; } + get => _ConditionElement?.Value; set { - if (value == null) - ConditionElement = null; - else - ConditionElement = new Hl7.Fhir.Model.FhirString(value); + ConditionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Condition"); } } @@ -1768,28 +1676,25 @@ public string Condition /// [FhirElement("check", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString CheckElement + public Hl7.Fhir.Model.FhirString? CheckElement { get { return _CheckElement; } set { _CheckElement = value; OnPropertyChanged("CheckElement"); } } - private Hl7.Fhir.Model.FhirString _CheckElement; + private Hl7.Fhir.Model.FhirString? _CheckElement; /// /// FHIRPath expression - must be true or the mapping engine throws an error instead of completing /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Check + public string? Check { - get { return CheckElement != null ? CheckElement.Value : null; } + get => _CheckElement?.Value; set { - if (value == null) - CheckElement = null; - else - CheckElement = new Hl7.Fhir.Model.FhirString(value); + CheckElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Check"); } } @@ -1799,53 +1704,46 @@ public string Check /// [FhirElement("logMessage", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString LogMessageElement + public Hl7.Fhir.Model.FhirString? LogMessageElement { get { return _LogMessageElement; } set { _LogMessageElement = value; OnPropertyChanged("LogMessageElement"); } } - private Hl7.Fhir.Model.FhirString _LogMessageElement; + private Hl7.Fhir.Model.FhirString? _LogMessageElement; /// /// Message to put in log if source exists (FHIRPath) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LogMessage + public string? LogMessage { - get { return LogMessageElement != null ? LogMessageElement.Value : null; } + get => _LogMessageElement?.Value; set { - if (value == null) - LogMessageElement = null; - else - LogMessageElement = new Hl7.Fhir.Model.FhirString(value); + LogMessageElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("LogMessage"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SourceComponent; - - if (dest == null) - { + if(other is not SourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.Id)ContextElement.DeepCopyInternal(); - if(MinElement != null) dest.MinElement = (Hl7.Fhir.Model.Integer)MinElement.DeepCopyInternal(); - if(MaxElement != null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)MaxElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)TypeElement.DeepCopyInternal(); - if(DefaultValueElement != null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)DefaultValueElement.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(ListModeElement != null) dest.ListModeElement = (Code)ListModeElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ConditionElement != null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)ConditionElement.DeepCopyInternal(); - if(CheckElement != null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)CheckElement.DeepCopyInternal(); - if(LogMessageElement != null) dest.LogMessageElement = (Hl7.Fhir.Model.FhirString)LogMessageElement.DeepCopyInternal(); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.Id)_ContextElement.DeepCopyInternal(); + if(_MinElement is not null) dest.MinElement = (Hl7.Fhir.Model.Integer)_MinElement.DeepCopyInternal(); + if(_MaxElement is not null) dest.MaxElement = (Hl7.Fhir.Model.FhirString)_MaxElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Hl7.Fhir.Model.FhirString)_TypeElement.DeepCopyInternal(); + if(_DefaultValueElement is not null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)_DefaultValueElement.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = (Code)_ListModeElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ConditionElement is not null) dest.ConditionElement = (Hl7.Fhir.Model.FhirString)_ConditionElement.DeepCopyInternal(); + if(_CheckElement is not null) dest.CheckElement = (Hl7.Fhir.Model.FhirString)_CheckElement.DeepCopyInternal(); + if(_LogMessageElement is not null) dest.LogMessageElement = (Hl7.Fhir.Model.FhirString)_LogMessageElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1857,104 +1755,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceComponent; - if(otherT == null) return false; + if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(MinElement, otherT.MinElement)) return false; - if(!comparer.Equals(MaxElement, otherT.MaxElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(DefaultValueElement, otherT.DefaultValueElement)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.Equals(ConditionElement, otherT.ConditionElement)) return false; - if(!comparer.Equals(CheckElement, otherT.CheckElement)) return false; - if(!comparer.Equals(LogMessageElement, otherT.LogMessageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; + if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; + if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; + if(!comparer.Equals(_LogMessageElement, otherT._LogMessageElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "min": - value = MinElement; - return MinElement is not null; + value = _MinElement; + return _MinElement is not null; case "max": - value = MaxElement; - return MaxElement is not null; + value = _MaxElement; + return _MaxElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "defaultValue": - value = DefaultValueElement; - return DefaultValueElement is not null; + value = _DefaultValueElement; + return _DefaultValueElement is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement is not null; + value = _ListModeElement; + return _ListModeElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "condition": - value = ConditionElement; - return ConditionElement is not null; + value = _ConditionElement; + return _ConditionElement is not null; case "check": - value = CheckElement; - return CheckElement is not null; + value = _CheckElement; + return _CheckElement is not null; case "logMessage": - value = LogMessageElement; - return LogMessageElement is not null; + value = _LogMessageElement; + return _LogMessageElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.Id)value; + ContextElement = (Hl7.Fhir.Model.Id?)value; return this; case "min": - MinElement = (Hl7.Fhir.Model.Integer)value; + MinElement = (Hl7.Fhir.Model.Integer?)value; return this; case "max": - MaxElement = (Hl7.Fhir.Model.FhirString)value; + MaxElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - TypeElement = (Hl7.Fhir.Model.FhirString)value; + TypeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValueElement = (Hl7.Fhir.Model.FhirString)value; + DefaultValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "listMode": - ListModeElement = (Code)value; + ListModeElement = (Code?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "condition": - ConditionElement = (Hl7.Fhir.Model.FhirString)value; + ConditionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "check": - CheckElement = (Hl7.Fhir.Model.FhirString)value; + CheckElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "logMessage": - LogMessageElement = (Hl7.Fhir.Model.FhirString)value; + LogMessageElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1965,17 +1863,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (MinElement is not null) yield return new KeyValuePair("min",MinElement); - if (MaxElement is not null) yield return new KeyValuePair("max",MaxElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",DefaultValueElement); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (ListModeElement is not null) yield return new KeyValuePair("listMode",ListModeElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ConditionElement is not null) yield return new KeyValuePair("condition",ConditionElement); - if (CheckElement is not null) yield return new KeyValuePair("check",CheckElement); - if (LogMessageElement is not null) yield return new KeyValuePair("logMessage",LogMessageElement); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_MinElement is not null) yield return new KeyValuePair("min",_MinElement); + if (_MaxElement is not null) yield return new KeyValuePair("max",_MaxElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",_DefaultValueElement); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_ListModeElement is not null) yield return new KeyValuePair("listMode",_ListModeElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ConditionElement is not null) yield return new KeyValuePair("condition",_ConditionElement); + if (_CheckElement is not null) yield return new KeyValuePair("check",_CheckElement); + if (_LogMessageElement is not null) yield return new KeyValuePair("logMessage",_LogMessageElement); } } @@ -1998,28 +1896,25 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("context", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString ContextElement + public Hl7.Fhir.Model.FhirString? ContextElement { get { return _ContextElement; } set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } - private Hl7.Fhir.Model.FhirString _ContextElement; + private Hl7.Fhir.Model.FhirString? _ContextElement; /// /// Variable this rule applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Context + public string? Context { - get { return ContextElement != null ? ContextElement.Value : null; } + get => _ContextElement?.Value; set { - if (value == null) - ContextElement = null; - else - ContextElement = new Hl7.Fhir.Model.FhirString(value); + ContextElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Context"); } } @@ -2029,28 +1924,25 @@ public string Context /// [FhirElement("element", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString ElementElement + public Hl7.Fhir.Model.FhirString? ElementElement { get { return _ElementElement; } set { _ElementElement = value; OnPropertyChanged("ElementElement"); } } - private Hl7.Fhir.Model.FhirString _ElementElement; + private Hl7.Fhir.Model.FhirString? _ElementElement; /// /// Field to create in the context /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Element + public string? Element { - get { return ElementElement != null ? ElementElement.Value : null; } + get => _ElementElement?.Value; set { - if (value == null) - ElementElement = null; - else - ElementElement = new Hl7.Fhir.Model.FhirString(value); + ElementElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Element"); } } @@ -2060,28 +1952,25 @@ public string Element /// [FhirElement("variable", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Id VariableElement + public Hl7.Fhir.Model.Id? VariableElement { get { return _VariableElement; } set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } - private Hl7.Fhir.Model.Id _VariableElement; + private Hl7.Fhir.Model.Id? _VariableElement; /// /// Named context for field, if desired, and a field is specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Variable + public string? Variable { - get { return VariableElement != null ? VariableElement.Value : null; } + get => _VariableElement?.Value; set { - if (value == null) - VariableElement = null; - else - VariableElement = new Hl7.Fhir.Model.Id(value); + VariableElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Variable"); } } @@ -2096,24 +1985,24 @@ public string Variable [DataMember] public List> ListModeElement { - get { if(_ListModeElement==null) _ListModeElement = new List>(); return _ListModeElement; } + get => _ListModeElement ?? new List>(); set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } - private List> _ListModeElement; + private List>? _ListModeElement; /// /// first | share | last | single /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ListMode + public IEnumerable? ListMode { - get { return ListModeElement != null ? ListModeElement.Select(elem => elem.Value) : null; } + get => _ListModeElement?.Select(elem => elem.Value); set { if (value == null) - ListModeElement = null; + ListModeElement = null!; else ListModeElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("ListMode"); @@ -2125,28 +2014,25 @@ public IEnumerable List /// [FhirElement("listRuleId", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Id ListRuleIdElement + public Hl7.Fhir.Model.Id? ListRuleIdElement { get { return _ListRuleIdElement; } set { _ListRuleIdElement = value; OnPropertyChanged("ListRuleIdElement"); } } - private Hl7.Fhir.Model.Id _ListRuleIdElement; + private Hl7.Fhir.Model.Id? _ListRuleIdElement; /// /// Internal rule reference for shared list items /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ListRuleId + public string? ListRuleId { - get { return ListRuleIdElement != null ? ListRuleIdElement.Value : null; } + get => _ListRuleIdElement?.Value; set { - if (value == null) - ListRuleIdElement = null; - else - ListRuleIdElement = new Hl7.Fhir.Model.Id(value); + ListRuleIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ListRuleId"); } } @@ -2158,13 +2044,13 @@ public string ListRuleId [DeclaredType(Type = typeof(Code))] [Binding("StructureMapTransform")] [DataMember] - public Code TransformElement + public Code? TransformElement { get { return _TransformElement; } set { _TransformElement = value; OnPropertyChanged("TransformElement"); } } - private Code _TransformElement; + private Code? _TransformElement; /// /// create | copy + @@ -2173,13 +2059,10 @@ public Code TransformElement [IgnoreDataMember] public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform { - get { return TransformElement != null ? TransformElement.Value : null; } + get => _TransformElement?.Value; set { - if (value == null) - TransformElement = null; - else - TransformElement = new Code(value); + TransformElement = value is null ? null : new Code(value); OnPropertyChanged("Transform"); } } @@ -2192,29 +2075,25 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ContextElement != null) dest.ContextElement = (Hl7.Fhir.Model.FhirString)ContextElement.DeepCopyInternal(); - if(ElementElement != null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)ElementElement.DeepCopyInternal(); - if(VariableElement != null) dest.VariableElement = (Hl7.Fhir.Model.Id)VariableElement.DeepCopyInternal(); - if(ListModeElement.Any()) dest.ListModeElement = new List>(ListModeElement.DeepCopyInternal()); - if(ListRuleIdElement != null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)ListRuleIdElement.DeepCopyInternal(); - if(TransformElement != null) dest.TransformElement = (Code)TransformElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); + if(_ContextElement is not null) dest.ContextElement = (Hl7.Fhir.Model.FhirString)_ContextElement.DeepCopyInternal(); + if(_ElementElement is not null) dest.ElementElement = (Hl7.Fhir.Model.FhirString)_ElementElement.DeepCopyInternal(); + if(_VariableElement is not null) dest.VariableElement = (Hl7.Fhir.Model.Id)_VariableElement.DeepCopyInternal(); + if(_ListModeElement is not null) dest.ListModeElement = new List>(_ListModeElement.DeepCopyInternal()); + if(_ListRuleIdElement is not null) dest.ListRuleIdElement = (Hl7.Fhir.Model.Id)_ListRuleIdElement.DeepCopyInternal(); + if(_TransformElement is not null) dest.TransformElement = (Code)_TransformElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2226,76 +2105,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ContextElement, otherT.ContextElement)) return false; - if(!comparer.Equals(ElementElement, otherT.ElementElement)) return false; - if(!comparer.Equals(VariableElement, otherT.VariableElement)) return false; - if(!comparer.ListEquals(ListModeElement, otherT.ListModeElement)) return false; - if(!comparer.Equals(ListRuleIdElement, otherT.ListRuleIdElement)) return false; - if(!comparer.Equals(TransformElement, otherT.TransformElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; + if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; + if(!comparer.ListEquals(_ListModeElement, otherT._ListModeElement)) return false; + if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; + if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "context": - value = ContextElement; - return ContextElement is not null; + value = _ContextElement; + return _ContextElement is not null; case "element": - value = ElementElement; - return ElementElement is not null; + value = _ElementElement; + return _ElementElement is not null; case "variable": - value = VariableElement; - return VariableElement is not null; + value = _VariableElement; + return _VariableElement is not null; case "listMode": - value = ListModeElement; - return ListModeElement?.Any() == true; + value = _ListModeElement; + return _ListModeElement?.Any() == true; case "listRuleId": - value = ListRuleIdElement; - return ListRuleIdElement is not null; + value = _ListRuleIdElement; + return _ListRuleIdElement is not null; case "transform": - value = TransformElement; - return TransformElement is not null; + value = _TransformElement; + return _TransformElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "context": - ContextElement = (Hl7.Fhir.Model.FhirString)value; + ContextElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "element": - ElementElement = (Hl7.Fhir.Model.FhirString)value; + ElementElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "variable": - VariableElement = (Hl7.Fhir.Model.Id)value; + VariableElement = (Hl7.Fhir.Model.Id?)value; return this; case "listMode": - ListModeElement = (List>)value; + ListModeElement = (List>?)value!; return this; case "listRuleId": - ListRuleIdElement = (Hl7.Fhir.Model.Id)value; + ListRuleIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "transform": - TransformElement = (Code)value; + TransformElement = (Code?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2306,13 +2185,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ContextElement is not null) yield return new KeyValuePair("context",ContextElement); - if (ElementElement is not null) yield return new KeyValuePair("element",ElementElement); - if (VariableElement is not null) yield return new KeyValuePair("variable",VariableElement); - if (ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",ListModeElement); - if (ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",ListRuleIdElement); - if (TransformElement is not null) yield return new KeyValuePair("transform",TransformElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); + if (_ContextElement is not null) yield return new KeyValuePair("context",_ContextElement); + if (_ElementElement is not null) yield return new KeyValuePair("element",_ElementElement); + if (_VariableElement is not null) yield return new KeyValuePair("variable",_VariableElement); + if (_ListModeElement?.Any() == true) yield return new KeyValuePair("listMode",_ListModeElement); + if (_ListRuleIdElement is not null) yield return new KeyValuePair("listRuleId",_ListRuleIdElement); + if (_TransformElement is not null) yield return new KeyValuePair("transform",_TransformElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); } } @@ -2338,25 +2217,21 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [AllowedTypes(typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.FhirDateTime))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2368,34 +2243,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -2406,7 +2281,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -2430,28 +2305,25 @@ public partial class DependentComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Id NameElement + public Hl7.Fhir.Model.Id? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Id _NameElement; + private Hl7.Fhir.Model.Id? _NameElement; /// /// Name of a rule or group to apply /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Id(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("Name"); } } @@ -2464,24 +2336,20 @@ public string Name [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; protected internal override void CopyToInternal(Base other) { - var dest = other as DependentComponent; - - if (dest == null) - { + if(other is not DependentComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Id)NameElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Id)_NameElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2493,41 +2361,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependentComponent; - if(otherT == null) return false; + if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Id)value; + NameElement = (Hl7.Fhir.Model.Id?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2538,8 +2406,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); } } @@ -2550,28 +2418,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this structure map, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -2584,39 +2449,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the structure map. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2628,13 +2490,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this structure map (computer friendly). @@ -2642,28 +2504,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this structure map (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -2673,28 +2532,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this structure map (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -2707,13 +2563,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -2722,13 +2578,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -2738,13 +2591,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2753,13 +2606,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2769,28 +2619,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2800,28 +2647,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2834,39 +2678,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the structure map. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the structure map /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2879,11 +2720,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for structure map (if applicable). @@ -2894,39 +2735,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this structure map is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this structure map is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2936,28 +2774,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2967,28 +2802,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -3001,11 +2833,11 @@ public string CopyrightLabel [DataMember] public List Structure { - get { if(_Structure==null) _Structure = new List(); return _Structure; } + get => _Structure ?? new List(); set { _Structure = value; OnPropertyChanged("Structure"); } } - private List _Structure; + private List? _Structure; /// /// Other maps used by this map (canonical URLs). @@ -3015,24 +2847,24 @@ public List Structure [DataMember] public List ImportElement { - get { if(_ImportElement==null) _ImportElement = new List(); return _ImportElement; } + get => _ImportElement ?? new List(); set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } - private List _ImportElement; + private List? _ImportElement; /// /// Other maps used by this map (canonical URLs) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Import + public IEnumerable? Import { - get { return ImportElement != null ? ImportElement.Select(elem => elem.Value) : null; } + get => _ImportElement?.Select(elem => elem.Value); set { if (value == null) - ImportElement = null; + ImportElement = null!; else ImportElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Import"); @@ -3047,11 +2879,11 @@ public IEnumerable Import [DataMember] public List Const { - get { if(_Const==null) _Const = new List(); return _Const; } + get => _Const ?? new List(); set { _Const = value; OnPropertyChanged("Const"); } } - private List _Const; + private List? _Const; /// /// Named sections for reader convenience. @@ -3061,45 +2893,41 @@ public List Const [DataMember] public List Group { - get { if(_Group==null) _Group = new List(); return _Group; } + get => _Group ?? new List(); set { _Group = value; OnPropertyChanged("Group"); } } - private List _Group; + private List? _Group; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as StructureMap; - - if (dest == null) - { + if(other is not StructureMap dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(Structure.Any()) dest.Structure = new List(Structure.DeepCopyInternal()); - if(ImportElement.Any()) dest.ImportElement = new List(ImportElement.DeepCopyInternal()); - if(Const.Any()) dest.Const = new List(Const.DeepCopyInternal()); - if(Group.Any()) dest.Group = new List(Group.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_Structure is not null) dest.Structure = new List(_Structure.DeepCopyInternal()); + if(_ImportElement is not null) dest.ImportElement = new List(_ImportElement.DeepCopyInternal()); + if(_Const is not null) dest.Const = new List(_Const.DeepCopyInternal()); + if(_Group is not null) dest.Group = new List(_Group.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -3111,174 +2939,174 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureMap; - if(otherT == null) return false; + if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.ListEquals(Structure, otherT.Structure)) return false; - if(!comparer.ListEquals(ImportElement, otherT.ImportElement)) return false; - if(!comparer.ListEquals(Const, otherT.Const)) return false; - if(!comparer.ListEquals(Group, otherT.Group)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.ListEquals(_Structure, otherT._Structure)) return false; + if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; + if(!comparer.ListEquals(_Const, otherT._Const)) return false; + if(!comparer.ListEquals(_Group, otherT._Group)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "structure": - value = Structure; - return Structure?.Any() == true; + value = _Structure; + return _Structure?.Any() == true; case "import": - value = ImportElement; - return ImportElement?.Any() == true; + value = _ImportElement; + return _ImportElement?.Any() == true; case "const": - value = Const; - return Const?.Any() == true; + value = _Const; + return _Const?.Any() == true; case "group": - value = Group; - return Group?.Any() == true; + value = _Group; + return _Group?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "structure": - Structure = (List)value; + Structure = (List?)value!; return this; case "import": - ImportElement = (List)value; + ImportElement = (List?)value!; return this; case "const": - Const = (List)value; + Const = (List?)value!; return this; case "group": - Group = (List)value; + Group = (List?)value!; return this; default: return base.SetValue(key, value); @@ -3289,27 +3117,27 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (Structure?.Any() == true) yield return new KeyValuePair("structure",Structure); - if (ImportElement?.Any() == true) yield return new KeyValuePair("import",ImportElement); - if (Const?.Any() == true) yield return new KeyValuePair("const",Const); - if (Group?.Any() == true) yield return new KeyValuePair("group",Group); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_Structure?.Any() == true) yield return new KeyValuePair("structure",_Structure); + if (_ImportElement?.Any() == true) yield return new KeyValuePair("import",_ImportElement); + if (_Const?.Any() == true) yield return new KeyValuePair("const",_Const); + if (_Group?.Any() == true) yield return new KeyValuePair("group",_Group); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs index 7a7853bac..2c7264c77 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,28 +112,25 @@ public partial class FilterByComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("resourceType", InSummary=true, Order=40)] [Binding("FHIRTypes")] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceTypeElement + public Hl7.Fhir.Model.FhirUri? ResourceTypeElement { get { return _ResourceTypeElement; } set { _ResourceTypeElement = value; OnPropertyChanged("ResourceTypeElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceTypeElement; + private Hl7.Fhir.Model.FhirUri? _ResourceTypeElement; /// /// Allowed Resource (reference to definition) for this Subscription filter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResourceType + public string? ResourceType { - get { return ResourceTypeElement != null ? ResourceTypeElement.Value : null; } + get => _ResourceTypeElement?.Value; set { - if (value == null) - ResourceTypeElement = null; - else - ResourceTypeElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceTypeElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("ResourceType"); } } @@ -141,28 +141,25 @@ public string ResourceType [FhirElement("filterParameter", InSummary=true, Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString FilterParameterElement + public Hl7.Fhir.Model.FhirString? FilterParameterElement { get { return _FilterParameterElement; } set { _FilterParameterElement = value; OnPropertyChanged("FilterParameterElement"); } } - private Hl7.Fhir.Model.FhirString _FilterParameterElement; + private Hl7.Fhir.Model.FhirString? _FilterParameterElement; /// /// Filter label defined in SubscriptionTopic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FilterParameter + public string? FilterParameter { - get { return FilterParameterElement != null ? FilterParameterElement.Value : null; } + get => _FilterParameterElement?.Value; set { - if (value == null) - FilterParameterElement = null; - else - FilterParameterElement = new Hl7.Fhir.Model.FhirString(value); + FilterParameterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("FilterParameter"); } } @@ -174,13 +171,13 @@ public string FilterParameter [DeclaredType(Type = typeof(Code))] [Binding("SearchComparator")] [DataMember] - public Code ComparatorElement + public Code? ComparatorElement { get { return _ComparatorElement; } set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private Code _ComparatorElement; + private Code? _ComparatorElement; /// /// eq | ne | gt | lt | ge | le | sa | eb | ap @@ -189,13 +186,10 @@ public Code ComparatorElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchComparator? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Value : null; } + get => _ComparatorElement?.Value; set { - if (value == null) - ComparatorElement = null; - else - ComparatorElement = new Code(value); + ComparatorElement = value is null ? null : new Code(value); OnPropertyChanged("Comparator"); } } @@ -207,13 +201,13 @@ public Hl7.Fhir.Model.SearchComparator? Comparator [DeclaredType(Type = typeof(Code))] [Binding("SearchModifierCode")] [DataMember] - public Code ModifierElement + public Code? ModifierElement { get { return _ModifierElement; } set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } - private Code _ModifierElement; + private Code? _ModifierElement; /// /// missing | exact | contains | not | text | in | not-in | below | above | type | identifier | of-type | code-text | text-advanced | iterate @@ -222,13 +216,10 @@ public Code ModifierElement [IgnoreDataMember] public Hl7.Fhir.Model.SearchModifierCode? Modifier { - get { return ModifierElement != null ? ModifierElement.Value : null; } + get => _ModifierElement?.Value; set { - if (value == null) - ModifierElement = null; - else - ModifierElement = new Code(value); + ModifierElement = value is null ? null : new Code(value); OnPropertyChanged("Modifier"); } } @@ -239,47 +230,40 @@ public Hl7.Fhir.Model.SearchModifierCode? Modifier [FhirElement("value", InSummary=true, Order=80)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Literal value or resource path /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as FilterByComponent; - - if (dest == null) - { + if(other is not FilterByComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResourceTypeElement != null) dest.ResourceTypeElement = (Hl7.Fhir.Model.FhirUri)ResourceTypeElement.DeepCopyInternal(); - if(FilterParameterElement != null) dest.FilterParameterElement = (Hl7.Fhir.Model.FhirString)FilterParameterElement.DeepCopyInternal(); - if(ComparatorElement != null) dest.ComparatorElement = (Code)ComparatorElement.DeepCopyInternal(); - if(ModifierElement != null) dest.ModifierElement = (Code)ModifierElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_ResourceTypeElement is not null) dest.ResourceTypeElement = (Hl7.Fhir.Model.FhirUri)_ResourceTypeElement.DeepCopyInternal(); + if(_FilterParameterElement is not null) dest.FilterParameterElement = (Hl7.Fhir.Model.FhirString)_FilterParameterElement.DeepCopyInternal(); + if(_ComparatorElement is not null) dest.ComparatorElement = (Code)_ComparatorElement.DeepCopyInternal(); + if(_ModifierElement is not null) dest.ModifierElement = (Code)_ModifierElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -291,62 +275,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterByComponent; - if(otherT == null) return false; + if(other is not FilterByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResourceTypeElement, otherT.ResourceTypeElement)) return false; - if(!comparer.Equals(FilterParameterElement, otherT.FilterParameterElement)) return false; - if(!comparer.Equals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.Equals(ModifierElement, otherT.ModifierElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceTypeElement, otherT._ResourceTypeElement)) return false; + if(!comparer.Equals(_FilterParameterElement, otherT._FilterParameterElement)) return false; + if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.Equals(_ModifierElement, otherT._ModifierElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resourceType": - value = ResourceTypeElement; - return ResourceTypeElement is not null; + value = _ResourceTypeElement; + return _ResourceTypeElement is not null; case "filterParameter": - value = FilterParameterElement; - return FilterParameterElement is not null; + value = _FilterParameterElement; + return _FilterParameterElement is not null; case "comparator": - value = ComparatorElement; - return ComparatorElement is not null; + value = _ComparatorElement; + return _ComparatorElement is not null; case "modifier": - value = ModifierElement; - return ModifierElement is not null; + value = _ModifierElement; + return _ModifierElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resourceType": - ResourceTypeElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceTypeElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "filterParameter": - FilterParameterElement = (Hl7.Fhir.Model.FhirString)value; + FilterParameterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "comparator": - ComparatorElement = (Code)value; + ComparatorElement = (Code?)value; return this; case "modifier": - ModifierElement = (Code)value; + ModifierElement = (Code?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -357,11 +341,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResourceTypeElement is not null) yield return new KeyValuePair("resourceType",ResourceTypeElement); - if (FilterParameterElement is not null) yield return new KeyValuePair("filterParameter",FilterParameterElement); - if (ComparatorElement is not null) yield return new KeyValuePair("comparator",ComparatorElement); - if (ModifierElement is not null) yield return new KeyValuePair("modifier",ModifierElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_ResourceTypeElement is not null) yield return new KeyValuePair("resourceType",_ResourceTypeElement); + if (_FilterParameterElement is not null) yield return new KeyValuePair("filterParameter",_FilterParameterElement); + if (_ComparatorElement is not null) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_ModifierElement is not null) yield return new KeyValuePair("modifier",_ModifierElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -389,28 +373,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name (key) of the parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -421,44 +402,37 @@ public string Name [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// Value of the parameter to use or pass through /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -470,41 +444,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -515,8 +489,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -529,39 +503,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Human readable name for this subscription. /// [FhirElement("name", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Human readable name for this subscription /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -574,13 +545,13 @@ public string Name [Binding("SubscriptionStatusCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// requested | active | error | off | entered-in-error @@ -589,13 +560,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -606,28 +574,25 @@ public Hl7.Fhir.Model.SubscriptionStatusCodes? Status [FhirElement("topic", InSummary=true, Order=120, FiveWs="FiveWs.what[x]")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical TopicElement + public Hl7.Fhir.Model.Canonical? TopicElement { get { return _TopicElement; } set { _TopicElement = value; OnPropertyChanged("TopicElement"); } } - private Hl7.Fhir.Model.Canonical _TopicElement; + private Hl7.Fhir.Model.Canonical? _TopicElement; /// /// Reference to the subscription topic being subscribed to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Topic + public string? Topic { - get { return TopicElement != null ? TopicElement.Value : null; } + get => _TopicElement?.Value; set { - if (value == null) - TopicElement = null; - else - TopicElement = new Hl7.Fhir.Model.Canonical(value); + TopicElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Topic"); } } @@ -640,24 +605,24 @@ public string Topic [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// When to automatically delete the subscription. /// [FhirElement("end", InSummary=true, Order=140, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Instant EndElement + public Hl7.Fhir.Model.Instant? EndElement { get { return _EndElement; } set { _EndElement = value; OnPropertyChanged("EndElement"); } } - private Hl7.Fhir.Model.Instant _EndElement; + private Hl7.Fhir.Model.Instant? _EndElement; /// /// When to automatically delete the subscription @@ -666,13 +631,10 @@ public Hl7.Fhir.Model.Instant EndElement [IgnoreDataMember] public DateTimeOffset? End { - get { return EndElement != null ? EndElement.Value : null; } + get => _EndElement?.Value; set { - if (value == null) - EndElement = null; - else - EndElement = new Hl7.Fhir.Model.Instant(value); + EndElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("End"); } } @@ -684,41 +646,38 @@ public DateTimeOffset? End [CLSCompliant(false)] [References("CareTeam","HealthcareService","Organization","RelatedPerson","Patient","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ManagingEntity + public Hl7.Fhir.Model.ResourceReference? ManagingEntity { get { return _ManagingEntity; } set { _ManagingEntity = value; OnPropertyChanged("ManagingEntity"); } } - private Hl7.Fhir.Model.ResourceReference _ManagingEntity; + private Hl7.Fhir.Model.ResourceReference? _ManagingEntity; /// /// Description of why this subscription was created. /// [FhirElement("reason", InSummary=true, Order=160, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.FhirString ReasonElement + public Hl7.Fhir.Model.FhirString? ReasonElement { get { return _ReasonElement; } set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } - private Hl7.Fhir.Model.FhirString _ReasonElement; + private Hl7.Fhir.Model.FhirString? _ReasonElement; /// /// Description of why this subscription was created /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Reason + public string? Reason { - get { return ReasonElement != null ? ReasonElement.Value : null; } + get => _ReasonElement?.Value; set { - if (value == null) - ReasonElement = null; - else - ReasonElement = new Hl7.Fhir.Model.FhirString(value); + ReasonElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Reason"); } } @@ -731,11 +690,11 @@ public string Reason [DataMember] public List FilterBy { - get { if(_FilterBy==null) _FilterBy = new List(); return _FilterBy; } + get => _FilterBy ?? new List(); set { _FilterBy = value; OnPropertyChanged("FilterBy"); } } - private List _FilterBy; + private List? _FilterBy; /// /// Channel type for notifications. @@ -744,41 +703,38 @@ public List FilterBy [Binding("SubscriptionChannelType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding ChannelType + public Hl7.Fhir.Model.Coding? ChannelType { get { return _ChannelType; } set { _ChannelType = value; OnPropertyChanged("ChannelType"); } } - private Hl7.Fhir.Model.Coding _ChannelType; + private Hl7.Fhir.Model.Coding? _ChannelType; /// /// Where the channel points to. /// [FhirElement("endpoint", InSummary=true, Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirUrl EndpointElement + public Hl7.Fhir.Model.FhirUrl? EndpointElement { get { return _EndpointElement; } set { _EndpointElement = value; OnPropertyChanged("EndpointElement"); } } - private Hl7.Fhir.Model.FhirUrl _EndpointElement; + private Hl7.Fhir.Model.FhirUrl? _EndpointElement; /// /// Where the channel points to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Endpoint + public string? Endpoint { - get { return EndpointElement != null ? EndpointElement.Value : null; } + get => _EndpointElement?.Value; set { - if (value == null) - EndpointElement = null; - else - EndpointElement = new Hl7.Fhir.Model.FhirUrl(value); + EndpointElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Endpoint"); } } @@ -791,24 +747,24 @@ public string Endpoint [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Interval in seconds to send 'heartbeat' notification. /// [FhirElement("heartbeatPeriod", InSummary=true, Order=210)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt HeartbeatPeriodElement + public Hl7.Fhir.Model.UnsignedInt? HeartbeatPeriodElement { get { return _HeartbeatPeriodElement; } set { _HeartbeatPeriodElement = value; OnPropertyChanged("HeartbeatPeriodElement"); } } - private Hl7.Fhir.Model.UnsignedInt _HeartbeatPeriodElement; + private Hl7.Fhir.Model.UnsignedInt? _HeartbeatPeriodElement; /// /// Interval in seconds to send 'heartbeat' notification @@ -817,13 +773,10 @@ public Hl7.Fhir.Model.UnsignedInt HeartbeatPeriodElement [IgnoreDataMember] public int? HeartbeatPeriod { - get { return HeartbeatPeriodElement != null ? HeartbeatPeriodElement.Value : null; } + get => _HeartbeatPeriodElement?.Value; set { - if (value == null) - HeartbeatPeriodElement = null; - else - HeartbeatPeriodElement = new Hl7.Fhir.Model.UnsignedInt(value); + HeartbeatPeriodElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("HeartbeatPeriod"); } } @@ -833,13 +786,13 @@ public int? HeartbeatPeriod /// [FhirElement("timeout", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt TimeoutElement + public Hl7.Fhir.Model.UnsignedInt? TimeoutElement { get { return _TimeoutElement; } set { _TimeoutElement = value; OnPropertyChanged("TimeoutElement"); } } - private Hl7.Fhir.Model.UnsignedInt _TimeoutElement; + private Hl7.Fhir.Model.UnsignedInt? _TimeoutElement; /// /// Timeout in seconds to attempt notification delivery @@ -848,13 +801,10 @@ public Hl7.Fhir.Model.UnsignedInt TimeoutElement [IgnoreDataMember] public int? Timeout { - get { return TimeoutElement != null ? TimeoutElement.Value : null; } + get => _TimeoutElement?.Value; set { - if (value == null) - TimeoutElement = null; - else - TimeoutElement = new Hl7.Fhir.Model.UnsignedInt(value); + TimeoutElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Timeout"); } } @@ -865,28 +815,25 @@ public int? Timeout [FhirElement("contentType", InSummary=true, Order=230)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// MIME type to send, or omit for no payload /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -898,13 +845,13 @@ public string ContentType [DeclaredType(Type = typeof(Code))] [Binding("SubscriptionPayloadContent")] [DataMember] - public Code ContentElement + public Code? ContentElement { get { return _ContentElement; } set { _ContentElement = value; OnPropertyChanged("ContentElement"); } } - private Code _ContentElement; + private Code? _ContentElement; /// /// empty | id-only | full-resource @@ -913,13 +860,10 @@ public Code ContentEleme [IgnoreDataMember] public Hl7.Fhir.Model.Subscription.SubscriptionPayloadContent? Content { - get { return ContentElement != null ? ContentElement.Value : null; } + get => _ContentElement?.Value; set { - if (value == null) - ContentElement = null; - else - ContentElement = new Code(value); + ContentElement = value is null ? null : new Code(value); OnPropertyChanged("Content"); } } @@ -929,13 +873,13 @@ public Hl7.Fhir.Model.Subscription.SubscriptionPayloadContent? Content /// [FhirElement("maxCount", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.PositiveInt MaxCountElement + public Hl7.Fhir.Model.PositiveInt? MaxCountElement { get { return _MaxCountElement; } set { _MaxCountElement = value; OnPropertyChanged("MaxCountElement"); } } - private Hl7.Fhir.Model.PositiveInt _MaxCountElement; + private Hl7.Fhir.Model.PositiveInt? _MaxCountElement; /// /// Maximum number of events that can be combined in a single notification @@ -944,13 +888,10 @@ public Hl7.Fhir.Model.PositiveInt MaxCountElement [IgnoreDataMember] public int? MaxCount { - get { return MaxCountElement != null ? MaxCountElement.Value : null; } + get => _MaxCountElement?.Value; set { - if (value == null) - MaxCountElement = null; - else - MaxCountElement = new Hl7.Fhir.Model.PositiveInt(value); + MaxCountElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("MaxCount"); } } @@ -959,31 +900,27 @@ public int? MaxCount protected internal override void CopyToInternal(Base other) { - var dest = other as Subscription; - - if (dest == null) - { + if(other is not Subscription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TopicElement != null) dest.TopicElement = (Hl7.Fhir.Model.Canonical)TopicElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(EndElement != null) dest.EndElement = (Hl7.Fhir.Model.Instant)EndElement.DeepCopyInternal(); - if(ManagingEntity != null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)ManagingEntity.DeepCopyInternal(); - if(ReasonElement != null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)ReasonElement.DeepCopyInternal(); - if(FilterBy.Any()) dest.FilterBy = new List(FilterBy.DeepCopyInternal()); - if(ChannelType != null) dest.ChannelType = (Hl7.Fhir.Model.Coding)ChannelType.DeepCopyInternal(); - if(EndpointElement != null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)EndpointElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(HeartbeatPeriodElement != null) dest.HeartbeatPeriodElement = (Hl7.Fhir.Model.UnsignedInt)HeartbeatPeriodElement.DeepCopyInternal(); - if(TimeoutElement != null) dest.TimeoutElement = (Hl7.Fhir.Model.UnsignedInt)TimeoutElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(ContentElement != null) dest.ContentElement = (Code)ContentElement.DeepCopyInternal(); - if(MaxCountElement != null) dest.MaxCountElement = (Hl7.Fhir.Model.PositiveInt)MaxCountElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TopicElement is not null) dest.TopicElement = (Hl7.Fhir.Model.Canonical)_TopicElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_EndElement is not null) dest.EndElement = (Hl7.Fhir.Model.Instant)_EndElement.DeepCopyInternal(); + if(_ManagingEntity is not null) dest.ManagingEntity = (Hl7.Fhir.Model.ResourceReference)_ManagingEntity.DeepCopyInternal(); + if(_ReasonElement is not null) dest.ReasonElement = (Hl7.Fhir.Model.FhirString)_ReasonElement.DeepCopyInternal(); + if(_FilterBy is not null) dest.FilterBy = new List(_FilterBy.DeepCopyInternal()); + if(_ChannelType is not null) dest.ChannelType = (Hl7.Fhir.Model.Coding)_ChannelType.DeepCopyInternal(); + if(_EndpointElement is not null) dest.EndpointElement = (Hl7.Fhir.Model.FhirUrl)_EndpointElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_HeartbeatPeriodElement is not null) dest.HeartbeatPeriodElement = (Hl7.Fhir.Model.UnsignedInt)_HeartbeatPeriodElement.DeepCopyInternal(); + if(_TimeoutElement is not null) dest.TimeoutElement = (Hl7.Fhir.Model.UnsignedInt)_TimeoutElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_ContentElement is not null) dest.ContentElement = (Code)_ContentElement.DeepCopyInternal(); + if(_MaxCountElement is not null) dest.MaxCountElement = (Hl7.Fhir.Model.PositiveInt)_MaxCountElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -995,146 +932,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Subscription; - if(otherT == null) return false; + if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TopicElement, otherT.TopicElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(EndElement, otherT.EndElement)) return false; - if(!comparer.Equals(ManagingEntity, otherT.ManagingEntity)) return false; - if(!comparer.Equals(ReasonElement, otherT.ReasonElement)) return false; - if(!comparer.ListEquals(FilterBy, otherT.FilterBy)) return false; - if(!comparer.Equals(ChannelType, otherT.ChannelType)) return false; - if(!comparer.Equals(EndpointElement, otherT.EndpointElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(HeartbeatPeriodElement, otherT.HeartbeatPeriodElement)) return false; - if(!comparer.Equals(TimeoutElement, otherT.TimeoutElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(ContentElement, otherT.ContentElement)) return false; - if(!comparer.Equals(MaxCountElement, otherT.MaxCountElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TopicElement, otherT._TopicElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; + if(!comparer.Equals(_ManagingEntity, otherT._ManagingEntity)) return false; + if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; + if(!comparer.ListEquals(_FilterBy, otherT._FilterBy)) return false; + if(!comparer.Equals(_ChannelType, otherT._ChannelType)) return false; + if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_HeartbeatPeriodElement, otherT._HeartbeatPeriodElement)) return false; + if(!comparer.Equals(_TimeoutElement, otherT._TimeoutElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; + if(!comparer.Equals(_MaxCountElement, otherT._MaxCountElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "topic": - value = TopicElement; - return TopicElement is not null; + value = _TopicElement; + return _TopicElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "end": - value = EndElement; - return EndElement is not null; + value = _EndElement; + return _EndElement is not null; case "managingEntity": - value = ManagingEntity; - return ManagingEntity is not null; + value = _ManagingEntity; + return _ManagingEntity is not null; case "reason": - value = ReasonElement; - return ReasonElement is not null; + value = _ReasonElement; + return _ReasonElement is not null; case "filterBy": - value = FilterBy; - return FilterBy?.Any() == true; + value = _FilterBy; + return _FilterBy?.Any() == true; case "channelType": - value = ChannelType; - return ChannelType is not null; + value = _ChannelType; + return _ChannelType is not null; case "endpoint": - value = EndpointElement; - return EndpointElement is not null; + value = _EndpointElement; + return _EndpointElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "heartbeatPeriod": - value = HeartbeatPeriodElement; - return HeartbeatPeriodElement is not null; + value = _HeartbeatPeriodElement; + return _HeartbeatPeriodElement is not null; case "timeout": - value = TimeoutElement; - return TimeoutElement is not null; + value = _TimeoutElement; + return _TimeoutElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "content": - value = ContentElement; - return ContentElement is not null; + value = _ContentElement; + return _ContentElement is not null; case "maxCount": - value = MaxCountElement; - return MaxCountElement is not null; + value = _MaxCountElement; + return _MaxCountElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "topic": - TopicElement = (Hl7.Fhir.Model.Canonical)value; + TopicElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "end": - EndElement = (Hl7.Fhir.Model.Instant)value; + EndElement = (Hl7.Fhir.Model.Instant?)value; return this; case "managingEntity": - ManagingEntity = (Hl7.Fhir.Model.ResourceReference)value; + ManagingEntity = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - ReasonElement = (Hl7.Fhir.Model.FhirString)value; + ReasonElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "filterBy": - FilterBy = (List)value; + FilterBy = (List?)value!; return this; case "channelType": - ChannelType = (Hl7.Fhir.Model.Coding)value; + ChannelType = (Hl7.Fhir.Model.Coding?)value; return this; case "endpoint": - EndpointElement = (Hl7.Fhir.Model.FhirUrl)value; + EndpointElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "heartbeatPeriod": - HeartbeatPeriodElement = (Hl7.Fhir.Model.UnsignedInt)value; + HeartbeatPeriodElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "timeout": - TimeoutElement = (Hl7.Fhir.Model.UnsignedInt)value; + TimeoutElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "content": - ContentElement = (Code)value; + ContentElement = (Code?)value; return this; case "maxCount": - MaxCountElement = (Hl7.Fhir.Model.PositiveInt)value; + MaxCountElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; default: return base.SetValue(key, value); @@ -1145,23 +1082,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TopicElement is not null) yield return new KeyValuePair("topic",TopicElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (EndElement is not null) yield return new KeyValuePair("end",EndElement); - if (ManagingEntity is not null) yield return new KeyValuePair("managingEntity",ManagingEntity); - if (ReasonElement is not null) yield return new KeyValuePair("reason",ReasonElement); - if (FilterBy?.Any() == true) yield return new KeyValuePair("filterBy",FilterBy); - if (ChannelType is not null) yield return new KeyValuePair("channelType",ChannelType); - if (EndpointElement is not null) yield return new KeyValuePair("endpoint",EndpointElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (HeartbeatPeriodElement is not null) yield return new KeyValuePair("heartbeatPeriod",HeartbeatPeriodElement); - if (TimeoutElement is not null) yield return new KeyValuePair("timeout",TimeoutElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (ContentElement is not null) yield return new KeyValuePair("content",ContentElement); - if (MaxCountElement is not null) yield return new KeyValuePair("maxCount",MaxCountElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TopicElement is not null) yield return new KeyValuePair("topic",_TopicElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_EndElement is not null) yield return new KeyValuePair("end",_EndElement); + if (_ManagingEntity is not null) yield return new KeyValuePair("managingEntity",_ManagingEntity); + if (_ReasonElement is not null) yield return new KeyValuePair("reason",_ReasonElement); + if (_FilterBy?.Any() == true) yield return new KeyValuePair("filterBy",_FilterBy); + if (_ChannelType is not null) yield return new KeyValuePair("channelType",_ChannelType); + if (_EndpointElement is not null) yield return new KeyValuePair("endpoint",_EndpointElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_HeartbeatPeriodElement is not null) yield return new KeyValuePair("heartbeatPeriod",_HeartbeatPeriodElement); + if (_TimeoutElement is not null) yield return new KeyValuePair("timeout",_TimeoutElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_ContentElement is not null) yield return new KeyValuePair("content",_ContentElement); + if (_MaxCountElement is not null) yield return new KeyValuePair("maxCount",_MaxCountElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs index 243d429dc..6fe999668 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -121,13 +124,13 @@ public partial class NotificationEventComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("eventNumber", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer64 EventNumberElement + public Hl7.Fhir.Model.Integer64? EventNumberElement { get { return _EventNumberElement; } set { _EventNumberElement = value; OnPropertyChanged("EventNumberElement"); } } - private Hl7.Fhir.Model.Integer64 _EventNumberElement; + private Hl7.Fhir.Model.Integer64? _EventNumberElement; /// /// Sequencing index of this event @@ -136,13 +139,10 @@ public Hl7.Fhir.Model.Integer64 EventNumberElement [IgnoreDataMember] public long? EventNumber { - get { return EventNumberElement != null ? EventNumberElement.Value : null; } + get => _EventNumberElement?.Value; set { - if (value == null) - EventNumberElement = null; - else - EventNumberElement = new Hl7.Fhir.Model.Integer64(value); + EventNumberElement = value is null ? null : new Hl7.Fhir.Model.Integer64(value); OnPropertyChanged("EventNumber"); } } @@ -152,13 +152,13 @@ public long? EventNumber /// [FhirElement("timestamp", Order=50)] [DataMember] - public Hl7.Fhir.Model.Instant TimestampElement + public Hl7.Fhir.Model.Instant? TimestampElement { get { return _TimestampElement; } set { _TimestampElement = value; OnPropertyChanged("TimestampElement"); } } - private Hl7.Fhir.Model.Instant _TimestampElement; + private Hl7.Fhir.Model.Instant? _TimestampElement; /// /// The instant this event occurred @@ -167,13 +167,10 @@ public Hl7.Fhir.Model.Instant TimestampElement [IgnoreDataMember] public DateTimeOffset? Timestamp { - get { return TimestampElement != null ? TimestampElement.Value : null; } + get => _TimestampElement?.Value; set { - if (value == null) - TimestampElement = null; - else - TimestampElement = new Hl7.Fhir.Model.Instant(value); + TimestampElement = value is null ? null : new Hl7.Fhir.Model.Instant(value); OnPropertyChanged("Timestamp"); } } @@ -185,13 +182,13 @@ public DateTimeOffset? Timestamp [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// References related to the focus resource and/or context of this event. @@ -203,26 +200,22 @@ public Hl7.Fhir.Model.ResourceReference Focus [DataMember] public List AdditionalContext { - get { if(_AdditionalContext==null) _AdditionalContext = new List(); return _AdditionalContext; } + get => _AdditionalContext ?? new List(); set { _AdditionalContext = value; OnPropertyChanged("AdditionalContext"); } } - private List _AdditionalContext; + private List? _AdditionalContext; protected internal override void CopyToInternal(Base other) { - var dest = other as NotificationEventComponent; - - if (dest == null) - { + if(other is not NotificationEventComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(EventNumberElement != null) dest.EventNumberElement = (Hl7.Fhir.Model.Integer64)EventNumberElement.DeepCopyInternal(); - if(TimestampElement != null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)TimestampElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(AdditionalContext.Any()) dest.AdditionalContext = new List(AdditionalContext.DeepCopyInternal()); + if(_EventNumberElement is not null) dest.EventNumberElement = (Hl7.Fhir.Model.Integer64)_EventNumberElement.DeepCopyInternal(); + if(_TimestampElement is not null) dest.TimestampElement = (Hl7.Fhir.Model.Instant)_TimestampElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_AdditionalContext is not null) dest.AdditionalContext = new List(_AdditionalContext.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -234,55 +227,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotificationEventComponent; - if(otherT == null) return false; + if(other is not NotificationEventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(EventNumberElement, otherT.EventNumberElement)) return false; - if(!comparer.Equals(TimestampElement, otherT.TimestampElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.ListEquals(AdditionalContext, otherT.AdditionalContext)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_EventNumberElement, otherT._EventNumberElement)) return false; + if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.ListEquals(_AdditionalContext, otherT._AdditionalContext)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "eventNumber": - value = EventNumberElement; - return EventNumberElement is not null; + value = _EventNumberElement; + return _EventNumberElement is not null; case "timestamp": - value = TimestampElement; - return TimestampElement is not null; + value = _TimestampElement; + return _TimestampElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "additionalContext": - value = AdditionalContext; - return AdditionalContext?.Any() == true; + value = _AdditionalContext; + return _AdditionalContext?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "eventNumber": - EventNumberElement = (Hl7.Fhir.Model.Integer64)value; + EventNumberElement = (Hl7.Fhir.Model.Integer64?)value; return this; case "timestamp": - TimestampElement = (Hl7.Fhir.Model.Instant)value; + TimestampElement = (Hl7.Fhir.Model.Instant?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "additionalContext": - AdditionalContext = (List)value; + AdditionalContext = (List?)value!; return this; default: return base.SetValue(key, value); @@ -293,10 +286,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (EventNumberElement is not null) yield return new KeyValuePair("eventNumber",EventNumberElement); - if (TimestampElement is not null) yield return new KeyValuePair("timestamp",TimestampElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (AdditionalContext?.Any() == true) yield return new KeyValuePair("additionalContext",AdditionalContext); + if (_EventNumberElement is not null) yield return new KeyValuePair("eventNumber",_EventNumberElement); + if (_TimestampElement is not null) yield return new KeyValuePair("timestamp",_TimestampElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_AdditionalContext?.Any() == true) yield return new KeyValuePair("additionalContext",_AdditionalContext); } } @@ -308,13 +301,13 @@ public override IEnumerable> EnumerateElements() [DeclaredType(Type = typeof(Code))] [Binding("SubscriptionStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// requested | active | error | off | entered-in-error @@ -323,13 +316,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -342,13 +332,13 @@ public Hl7.Fhir.Model.SubscriptionStatusCodes? Status [Binding("SubscriptionNotificationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// handshake | heartbeat | event-notification | query-status | query-event @@ -357,13 +347,10 @@ public Code Type [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionStatus.SubscriptionNotificationType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -373,13 +360,13 @@ public Hl7.Fhir.Model.SubscriptionStatus.SubscriptionNotificationType? Type /// [FhirElement("eventsSinceSubscriptionStart", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.Integer64 EventsSinceSubscriptionStartElement + public Hl7.Fhir.Model.Integer64? EventsSinceSubscriptionStartElement { get { return _EventsSinceSubscriptionStartElement; } set { _EventsSinceSubscriptionStartElement = value; OnPropertyChanged("EventsSinceSubscriptionStartElement"); } } - private Hl7.Fhir.Model.Integer64 _EventsSinceSubscriptionStartElement; + private Hl7.Fhir.Model.Integer64? _EventsSinceSubscriptionStartElement; /// /// Events since the Subscription was created @@ -388,13 +375,10 @@ public Hl7.Fhir.Model.Integer64 EventsSinceSubscriptionStartElement [IgnoreDataMember] public long? EventsSinceSubscriptionStart { - get { return EventsSinceSubscriptionStartElement != null ? EventsSinceSubscriptionStartElement.Value : null; } + get => _EventsSinceSubscriptionStartElement?.Value; set { - if (value == null) - EventsSinceSubscriptionStartElement = null; - else - EventsSinceSubscriptionStartElement = new Hl7.Fhir.Model.Integer64(value); + EventsSinceSubscriptionStartElement = value is null ? null : new Hl7.Fhir.Model.Integer64(value); OnPropertyChanged("EventsSinceSubscriptionStart"); } } @@ -407,11 +391,11 @@ public long? EventsSinceSubscriptionStart [DataMember] public List NotificationEvent { - get { if(_NotificationEvent==null) _NotificationEvent = new List(); return _NotificationEvent; } + get => _NotificationEvent ?? new List(); set { _NotificationEvent = value; OnPropertyChanged("NotificationEvent"); } } - private List _NotificationEvent; + private List? _NotificationEvent; /// /// Reference to the Subscription responsible for this notification. @@ -421,41 +405,38 @@ public List Notifi [References("Subscription")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Subscription + public Hl7.Fhir.Model.ResourceReference? Subscription { get { return _Subscription; } set { _Subscription = value; OnPropertyChanged("Subscription"); } } - private Hl7.Fhir.Model.ResourceReference _Subscription; + private Hl7.Fhir.Model.ResourceReference? _Subscription; /// /// Reference to the SubscriptionTopic this notification relates to. /// [FhirElement("topic", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Canonical TopicElement + public Hl7.Fhir.Model.Canonical? TopicElement { get { return _TopicElement; } set { _TopicElement = value; OnPropertyChanged("TopicElement"); } } - private Hl7.Fhir.Model.Canonical _TopicElement; + private Hl7.Fhir.Model.Canonical? _TopicElement; /// /// Reference to the SubscriptionTopic this notification relates to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Topic + public string? Topic { - get { return TopicElement != null ? TopicElement.Value : null; } + get => _TopicElement?.Value; set { - if (value == null) - TopicElement = null; - else - TopicElement = new Hl7.Fhir.Model.Canonical(value); + TopicElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Topic"); } } @@ -469,29 +450,25 @@ public string Topic [DataMember] public List Error { - get { if(_Error==null) _Error = new List(); return _Error; } + get => _Error ?? new List(); set { _Error = value; OnPropertyChanged("Error"); } } - private List _Error; + private List? _Error; protected internal override void CopyToInternal(Base other) { - var dest = other as SubscriptionStatus; - - if (dest == null) - { + if(other is not SubscriptionStatus dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(EventsSinceSubscriptionStartElement != null) dest.EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.Integer64)EventsSinceSubscriptionStartElement.DeepCopyInternal(); - if(NotificationEvent.Any()) dest.NotificationEvent = new List(NotificationEvent.DeepCopyInternal()); - if(Subscription != null) dest.Subscription = (Hl7.Fhir.Model.ResourceReference)Subscription.DeepCopyInternal(); - if(TopicElement != null) dest.TopicElement = (Hl7.Fhir.Model.Canonical)TopicElement.DeepCopyInternal(); - if(Error.Any()) dest.Error = new List(Error.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_EventsSinceSubscriptionStartElement is not null) dest.EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.Integer64)_EventsSinceSubscriptionStartElement.DeepCopyInternal(); + if(_NotificationEvent is not null) dest.NotificationEvent = new List(_NotificationEvent.DeepCopyInternal()); + if(_Subscription is not null) dest.Subscription = (Hl7.Fhir.Model.ResourceReference)_Subscription.DeepCopyInternal(); + if(_TopicElement is not null) dest.TopicElement = (Hl7.Fhir.Model.Canonical)_TopicElement.DeepCopyInternal(); + if(_Error is not null) dest.Error = new List(_Error.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -503,76 +480,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubscriptionStatus; - if(otherT == null) return false; + if(other is not SubscriptionStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(EventsSinceSubscriptionStartElement, otherT.EventsSinceSubscriptionStartElement)) return false; - if(!comparer.ListEquals(NotificationEvent, otherT.NotificationEvent)) return false; - if(!comparer.Equals(Subscription, otherT.Subscription)) return false; - if(!comparer.Equals(TopicElement, otherT.TopicElement)) return false; - if(!comparer.ListEquals(Error, otherT.Error)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_EventsSinceSubscriptionStartElement, otherT._EventsSinceSubscriptionStartElement)) return false; + if(!comparer.ListEquals(_NotificationEvent, otherT._NotificationEvent)) return false; + if(!comparer.Equals(_Subscription, otherT._Subscription)) return false; + if(!comparer.Equals(_TopicElement, otherT._TopicElement)) return false; + if(!comparer.ListEquals(_Error, otherT._Error)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "eventsSinceSubscriptionStart": - value = EventsSinceSubscriptionStartElement; - return EventsSinceSubscriptionStartElement is not null; + value = _EventsSinceSubscriptionStartElement; + return _EventsSinceSubscriptionStartElement is not null; case "notificationEvent": - value = NotificationEvent; - return NotificationEvent?.Any() == true; + value = _NotificationEvent; + return _NotificationEvent?.Any() == true; case "subscription": - value = Subscription; - return Subscription is not null; + value = _Subscription; + return _Subscription is not null; case "topic": - value = TopicElement; - return TopicElement is not null; + value = _TopicElement; + return _TopicElement is not null; case "error": - value = Error; - return Error?.Any() == true; + value = _Error; + return _Error?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "eventsSinceSubscriptionStart": - EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.Integer64)value; + EventsSinceSubscriptionStartElement = (Hl7.Fhir.Model.Integer64?)value; return this; case "notificationEvent": - NotificationEvent = (List)value; + NotificationEvent = (List?)value!; return this; case "subscription": - Subscription = (Hl7.Fhir.Model.ResourceReference)value; + Subscription = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "topic": - TopicElement = (Hl7.Fhir.Model.Canonical)value; + TopicElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "error": - Error = (List)value; + Error = (List?)value!; return this; default: return base.SetValue(key, value); @@ -583,13 +560,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (EventsSinceSubscriptionStartElement is not null) yield return new KeyValuePair("eventsSinceSubscriptionStart",EventsSinceSubscriptionStartElement); - if (NotificationEvent?.Any() == true) yield return new KeyValuePair("notificationEvent",NotificationEvent); - if (Subscription is not null) yield return new KeyValuePair("subscription",Subscription); - if (TopicElement is not null) yield return new KeyValuePair("topic",TopicElement); - if (Error?.Any() == true) yield return new KeyValuePair("error",Error); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_EventsSinceSubscriptionStartElement is not null) yield return new KeyValuePair("eventsSinceSubscriptionStart",_EventsSinceSubscriptionStartElement); + if (_NotificationEvent?.Any() == true) yield return new KeyValuePair("notificationEvent",_NotificationEvent); + if (_Subscription is not null) yield return new KeyValuePair("subscription",_Subscription); + if (_TopicElement is not null) yield return new KeyValuePair("topic",_TopicElement); + if (_Error?.Any() == true) yield return new KeyValuePair("error",_Error); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs index ff2e723a6..f886bf2d7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -130,28 +133,25 @@ public partial class ResourceTriggerComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Text representation of the resource trigger /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -163,28 +163,25 @@ public string Description [Binding("FHIRTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// Data Type or Resource (reference to definition) for this trigger definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -199,24 +196,24 @@ public string Resource [DataMember] public List> SupportedInteractionElement { - get { if(_SupportedInteractionElement==null) _SupportedInteractionElement = new List>(); return _SupportedInteractionElement; } + get => _SupportedInteractionElement ?? new List>(); set { _SupportedInteractionElement = value; OnPropertyChanged("SupportedInteractionElement"); } } - private List> _SupportedInteractionElement; + private List>? _SupportedInteractionElement; /// /// create | update | delete /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable SupportedInteraction + public IEnumerable? SupportedInteraction { - get { return SupportedInteractionElement != null ? SupportedInteractionElement.Select(elem => elem.Value) : null; } + get => _SupportedInteractionElement?.Select(elem => elem.Value); set { if (value == null) - SupportedInteractionElement = null; + SupportedInteractionElement = null!; else SupportedInteractionElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("SupportedInteraction"); @@ -228,60 +225,53 @@ public IEnumerable Support /// [FhirElement("queryCriteria", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent QueryCriteria + public Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent? QueryCriteria { get { return _QueryCriteria; } set { _QueryCriteria = value; OnPropertyChanged("QueryCriteria"); } } - private Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent _QueryCriteria; + private Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent? _QueryCriteria; /// /// FHIRPath based trigger rule. /// [FhirElement("fhirPathCriteria", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString FhirPathCriteriaElement + public Hl7.Fhir.Model.FhirString? FhirPathCriteriaElement { get { return _FhirPathCriteriaElement; } set { _FhirPathCriteriaElement = value; OnPropertyChanged("FhirPathCriteriaElement"); } } - private Hl7.Fhir.Model.FhirString _FhirPathCriteriaElement; + private Hl7.Fhir.Model.FhirString? _FhirPathCriteriaElement; /// /// FHIRPath based trigger rule /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FhirPathCriteria + public string? FhirPathCriteria { - get { return FhirPathCriteriaElement != null ? FhirPathCriteriaElement.Value : null; } + get => _FhirPathCriteriaElement?.Value; set { - if (value == null) - FhirPathCriteriaElement = null; - else - FhirPathCriteriaElement = new Hl7.Fhir.Model.FhirString(value); + FhirPathCriteriaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("FhirPathCriteria"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ResourceTriggerComponent; - - if (dest == null) - { + if(other is not ResourceTriggerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(SupportedInteractionElement.Any()) dest.SupportedInteractionElement = new List>(SupportedInteractionElement.DeepCopyInternal()); - if(QueryCriteria != null) dest.QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent)QueryCriteria.DeepCopyInternal(); - if(FhirPathCriteriaElement != null) dest.FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString)FhirPathCriteriaElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_SupportedInteractionElement is not null) dest.SupportedInteractionElement = new List>(_SupportedInteractionElement.DeepCopyInternal()); + if(_QueryCriteria is not null) dest.QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent)_QueryCriteria.DeepCopyInternal(); + if(_FhirPathCriteriaElement is not null) dest.FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString)_FhirPathCriteriaElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -293,62 +283,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ResourceTriggerComponent; - if(otherT == null) return false; + if(other is not ResourceTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.ListEquals(SupportedInteractionElement, otherT.SupportedInteractionElement)) return false; - if(!comparer.Equals(QueryCriteria, otherT.QueryCriteria)) return false; - if(!comparer.Equals(FhirPathCriteriaElement, otherT.FhirPathCriteriaElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.ListEquals(_SupportedInteractionElement, otherT._SupportedInteractionElement)) return false; + if(!comparer.Equals(_QueryCriteria, otherT._QueryCriteria)) return false; + if(!comparer.Equals(_FhirPathCriteriaElement, otherT._FhirPathCriteriaElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "supportedInteraction": - value = SupportedInteractionElement; - return SupportedInteractionElement?.Any() == true; + value = _SupportedInteractionElement; + return _SupportedInteractionElement?.Any() == true; case "queryCriteria": - value = QueryCriteria; - return QueryCriteria is not null; + value = _QueryCriteria; + return _QueryCriteria is not null; case "fhirPathCriteria": - value = FhirPathCriteriaElement; - return FhirPathCriteriaElement is not null; + value = _FhirPathCriteriaElement; + return _FhirPathCriteriaElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "supportedInteraction": - SupportedInteractionElement = (List>)value; + SupportedInteractionElement = (List>?)value!; return this; case "queryCriteria": - QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent)value; + QueryCriteria = (Hl7.Fhir.Model.SubscriptionTopic.QueryCriteriaComponent?)value; return this; case "fhirPathCriteria": - FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString)value; + FhirPathCriteriaElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -359,11 +349,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (SupportedInteractionElement?.Any() == true) yield return new KeyValuePair("supportedInteraction",SupportedInteractionElement); - if (QueryCriteria is not null) yield return new KeyValuePair("queryCriteria",QueryCriteria); - if (FhirPathCriteriaElement is not null) yield return new KeyValuePair("fhirPathCriteria",FhirPathCriteriaElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_SupportedInteractionElement?.Any() == true) yield return new KeyValuePair("supportedInteraction",_SupportedInteractionElement); + if (_QueryCriteria is not null) yield return new KeyValuePair("queryCriteria",_QueryCriteria); + if (_FhirPathCriteriaElement is not null) yield return new KeyValuePair("fhirPathCriteria",_FhirPathCriteriaElement); } } @@ -389,28 +379,25 @@ public partial class QueryCriteriaComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("previous", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString PreviousElement + public Hl7.Fhir.Model.FhirString? PreviousElement { get { return _PreviousElement; } set { _PreviousElement = value; OnPropertyChanged("PreviousElement"); } } - private Hl7.Fhir.Model.FhirString _PreviousElement; + private Hl7.Fhir.Model.FhirString? _PreviousElement; /// /// Rule applied to previous resource state /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Previous + public string? Previous { - get { return PreviousElement != null ? PreviousElement.Value : null; } + get => _PreviousElement?.Value; set { - if (value == null) - PreviousElement = null; - else - PreviousElement = new Hl7.Fhir.Model.FhirString(value); + PreviousElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Previous"); } } @@ -422,13 +409,13 @@ public string Previous [DeclaredType(Type = typeof(Code))] [Binding("CriteriaNotExistsBehavior")] [DataMember] - public Code ResultForCreateElement + public Code? ResultForCreateElement { get { return _ResultForCreateElement; } set { _ResultForCreateElement = value; OnPropertyChanged("ResultForCreateElement"); } } - private Code _ResultForCreateElement; + private Code? _ResultForCreateElement; /// /// test-passes | test-fails @@ -437,13 +424,10 @@ public Code ResultFo [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForCreate { - get { return ResultForCreateElement != null ? ResultForCreateElement.Value : null; } + get => _ResultForCreateElement?.Value; set { - if (value == null) - ResultForCreateElement = null; - else - ResultForCreateElement = new Code(value); + ResultForCreateElement = value is null ? null : new Code(value); OnPropertyChanged("ResultForCreate"); } } @@ -453,28 +437,25 @@ public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForCrea /// [FhirElement("current", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString CurrentElement + public Hl7.Fhir.Model.FhirString? CurrentElement { get { return _CurrentElement; } set { _CurrentElement = value; OnPropertyChanged("CurrentElement"); } } - private Hl7.Fhir.Model.FhirString _CurrentElement; + private Hl7.Fhir.Model.FhirString? _CurrentElement; /// /// Rule applied to current resource state /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Current + public string? Current { - get { return CurrentElement != null ? CurrentElement.Value : null; } + get => _CurrentElement?.Value; set { - if (value == null) - CurrentElement = null; - else - CurrentElement = new Hl7.Fhir.Model.FhirString(value); + CurrentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Current"); } } @@ -486,13 +467,13 @@ public string Current [DeclaredType(Type = typeof(Code))] [Binding("CriteriaNotExistsBehavior")] [DataMember] - public Code ResultForDeleteElement + public Code? ResultForDeleteElement { get { return _ResultForDeleteElement; } set { _ResultForDeleteElement = value; OnPropertyChanged("ResultForDeleteElement"); } } - private Code _ResultForDeleteElement; + private Code? _ResultForDeleteElement; /// /// test-passes | test-fails @@ -501,13 +482,10 @@ public Code ResultFo [IgnoreDataMember] public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForDelete { - get { return ResultForDeleteElement != null ? ResultForDeleteElement.Value : null; } + get => _ResultForDeleteElement?.Value; set { - if (value == null) - ResultForDeleteElement = null; - else - ResultForDeleteElement = new Code(value); + ResultForDeleteElement = value is null ? null : new Code(value); OnPropertyChanged("ResultForDelete"); } } @@ -517,13 +495,13 @@ public Hl7.Fhir.Model.SubscriptionTopic.CriteriaNotExistsBehavior? ResultForDele /// [FhirElement("requireBoth", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequireBothElement + public Hl7.Fhir.Model.FhirBoolean? RequireBothElement { get { return _RequireBothElement; } set { _RequireBothElement = value; OnPropertyChanged("RequireBothElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequireBothElement; + private Hl7.Fhir.Model.FhirBoolean? _RequireBothElement; /// /// Both must be true flag @@ -532,32 +510,25 @@ public Hl7.Fhir.Model.FhirBoolean RequireBothElement [IgnoreDataMember] public bool? RequireBoth { - get { return RequireBothElement != null ? RequireBothElement.Value : null; } + get => _RequireBothElement?.Value; set { - if (value == null) - RequireBothElement = null; - else - RequireBothElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequireBothElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("RequireBoth"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as QueryCriteriaComponent; - - if (dest == null) - { + if(other is not QueryCriteriaComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(PreviousElement != null) dest.PreviousElement = (Hl7.Fhir.Model.FhirString)PreviousElement.DeepCopyInternal(); - if(ResultForCreateElement != null) dest.ResultForCreateElement = (Code)ResultForCreateElement.DeepCopyInternal(); - if(CurrentElement != null) dest.CurrentElement = (Hl7.Fhir.Model.FhirString)CurrentElement.DeepCopyInternal(); - if(ResultForDeleteElement != null) dest.ResultForDeleteElement = (Code)ResultForDeleteElement.DeepCopyInternal(); - if(RequireBothElement != null) dest.RequireBothElement = (Hl7.Fhir.Model.FhirBoolean)RequireBothElement.DeepCopyInternal(); + if(_PreviousElement is not null) dest.PreviousElement = (Hl7.Fhir.Model.FhirString)_PreviousElement.DeepCopyInternal(); + if(_ResultForCreateElement is not null) dest.ResultForCreateElement = (Code)_ResultForCreateElement.DeepCopyInternal(); + if(_CurrentElement is not null) dest.CurrentElement = (Hl7.Fhir.Model.FhirString)_CurrentElement.DeepCopyInternal(); + if(_ResultForDeleteElement is not null) dest.ResultForDeleteElement = (Code)_ResultForDeleteElement.DeepCopyInternal(); + if(_RequireBothElement is not null) dest.RequireBothElement = (Hl7.Fhir.Model.FhirBoolean)_RequireBothElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -569,62 +540,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as QueryCriteriaComponent; - if(otherT == null) return false; + if(other is not QueryCriteriaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(PreviousElement, otherT.PreviousElement)) return false; - if(!comparer.Equals(ResultForCreateElement, otherT.ResultForCreateElement)) return false; - if(!comparer.Equals(CurrentElement, otherT.CurrentElement)) return false; - if(!comparer.Equals(ResultForDeleteElement, otherT.ResultForDeleteElement)) return false; - if(!comparer.Equals(RequireBothElement, otherT.RequireBothElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreviousElement, otherT._PreviousElement)) return false; + if(!comparer.Equals(_ResultForCreateElement, otherT._ResultForCreateElement)) return false; + if(!comparer.Equals(_CurrentElement, otherT._CurrentElement)) return false; + if(!comparer.Equals(_ResultForDeleteElement, otherT._ResultForDeleteElement)) return false; + if(!comparer.Equals(_RequireBothElement, otherT._RequireBothElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "previous": - value = PreviousElement; - return PreviousElement is not null; + value = _PreviousElement; + return _PreviousElement is not null; case "resultForCreate": - value = ResultForCreateElement; - return ResultForCreateElement is not null; + value = _ResultForCreateElement; + return _ResultForCreateElement is not null; case "current": - value = CurrentElement; - return CurrentElement is not null; + value = _CurrentElement; + return _CurrentElement is not null; case "resultForDelete": - value = ResultForDeleteElement; - return ResultForDeleteElement is not null; + value = _ResultForDeleteElement; + return _ResultForDeleteElement is not null; case "requireBoth": - value = RequireBothElement; - return RequireBothElement is not null; + value = _RequireBothElement; + return _RequireBothElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "previous": - PreviousElement = (Hl7.Fhir.Model.FhirString)value; + PreviousElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resultForCreate": - ResultForCreateElement = (Code)value; + ResultForCreateElement = (Code?)value; return this; case "current": - CurrentElement = (Hl7.Fhir.Model.FhirString)value; + CurrentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resultForDelete": - ResultForDeleteElement = (Code)value; + ResultForDeleteElement = (Code?)value; return this; case "requireBoth": - RequireBothElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequireBothElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -635,11 +606,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (PreviousElement is not null) yield return new KeyValuePair("previous",PreviousElement); - if (ResultForCreateElement is not null) yield return new KeyValuePair("resultForCreate",ResultForCreateElement); - if (CurrentElement is not null) yield return new KeyValuePair("current",CurrentElement); - if (ResultForDeleteElement is not null) yield return new KeyValuePair("resultForDelete",ResultForDeleteElement); - if (RequireBothElement is not null) yield return new KeyValuePair("requireBoth",RequireBothElement); + if (_PreviousElement is not null) yield return new KeyValuePair("previous",_PreviousElement); + if (_ResultForCreateElement is not null) yield return new KeyValuePair("resultForCreate",_ResultForCreateElement); + if (_CurrentElement is not null) yield return new KeyValuePair("current",_CurrentElement); + if (_ResultForDeleteElement is not null) yield return new KeyValuePair("resultForDelete",_ResultForDeleteElement); + if (_RequireBothElement is not null) yield return new KeyValuePair("requireBoth",_RequireBothElement); } } @@ -665,28 +636,25 @@ public partial class EventTriggerComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Text representation of the event trigger /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -698,13 +666,13 @@ public string Description [Binding("SubscriptionTopicEventTrigger")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Event + public Hl7.Fhir.Model.CodeableConcept? Event { get { return _Event; } set { _Event = value; OnPropertyChanged("Event"); } } - private Hl7.Fhir.Model.CodeableConcept _Event; + private Hl7.Fhir.Model.CodeableConcept? _Event; /// /// Data Type or Resource (reference to definition) for this trigger definition. @@ -713,45 +681,38 @@ public Hl7.Fhir.Model.CodeableConcept Event [Binding("FHIRTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// Data Type or Resource (reference to definition) for this trigger definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as EventTriggerComponent; - - if (dest == null) - { + if(other is not EventTriggerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Event != null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)Event.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Event is not null) dest.Event = (Hl7.Fhir.Model.CodeableConcept)_Event.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -763,48 +724,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as EventTriggerComponent; - if(otherT == null) return false; + if(other is not EventTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Event, otherT.Event)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Event, otherT._Event)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "event": - value = Event; - return Event is not null; + value = _Event; + return _Event is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "event": - Event = (Hl7.Fhir.Model.CodeableConcept)value; + Event = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -815,9 +776,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Event is not null) yield return new KeyValuePair("event",Event); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Event is not null) yield return new KeyValuePair("event",_Event); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); } } @@ -843,28 +804,25 @@ public partial class CanFilterByComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of this filter parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -875,28 +833,25 @@ public string Description [FhirElement("resource", InSummary=true, Order=50)] [Binding("FHIRTypes")] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// URL of the triggering Resource that this filter applies to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -907,28 +862,25 @@ public string Resource [FhirElement("filterParameter", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString FilterParameterElement + public Hl7.Fhir.Model.FhirString? FilterParameterElement { get { return _FilterParameterElement; } set { _FilterParameterElement = value; OnPropertyChanged("FilterParameterElement"); } } - private Hl7.Fhir.Model.FhirString _FilterParameterElement; + private Hl7.Fhir.Model.FhirString? _FilterParameterElement; /// /// Human-readable and computation-friendly name for a filter parameter usable by subscriptions on this topic, via Subscription.filterBy.filterParameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FilterParameter + public string? FilterParameter { - get { return FilterParameterElement != null ? FilterParameterElement.Value : null; } + get => _FilterParameterElement?.Value; set { - if (value == null) - FilterParameterElement = null; - else - FilterParameterElement = new Hl7.Fhir.Model.FhirString(value); + FilterParameterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("FilterParameter"); } } @@ -938,28 +890,25 @@ public string FilterParameter /// [FhirElement("filterDefinition", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirUri FilterDefinitionElement + public Hl7.Fhir.Model.FhirUri? FilterDefinitionElement { get { return _FilterDefinitionElement; } set { _FilterDefinitionElement = value; OnPropertyChanged("FilterDefinitionElement"); } } - private Hl7.Fhir.Model.FhirUri _FilterDefinitionElement; + private Hl7.Fhir.Model.FhirUri? _FilterDefinitionElement; /// /// Canonical URL for a filterParameter definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string FilterDefinition + public string? FilterDefinition { - get { return FilterDefinitionElement != null ? FilterDefinitionElement.Value : null; } + get => _FilterDefinitionElement?.Value; set { - if (value == null) - FilterDefinitionElement = null; - else - FilterDefinitionElement = new Hl7.Fhir.Model.FhirUri(value); + FilterDefinitionElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("FilterDefinition"); } } @@ -974,24 +923,24 @@ public string FilterDefinition [DataMember] public List> ComparatorElement { - get { if(_ComparatorElement==null) _ComparatorElement = new List>(); return _ComparatorElement; } + get => _ComparatorElement ?? new List>(); set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } - private List> _ComparatorElement; + private List>? _ComparatorElement; /// /// eq | ne | gt | lt | ge | le | sa | eb | ap /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Comparator + public IEnumerable? Comparator { - get { return ComparatorElement != null ? ComparatorElement.Select(elem => elem.Value) : null; } + get => _ComparatorElement?.Select(elem => elem.Value); set { if (value == null) - ComparatorElement = null; + ComparatorElement = null!; else ComparatorElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Comparator"); @@ -1008,24 +957,24 @@ public IEnumerable Comparator [DataMember] public List> ModifierElement { - get { if(_ModifierElement==null) _ModifierElement = new List>(); return _ModifierElement; } + get => _ModifierElement ?? new List>(); set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } - private List> _ModifierElement; + private List>? _ModifierElement; /// /// missing | exact | contains | not | text | in | not-in | below | above | type | identifier | of-type | code-text | text-advanced | iterate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Modifier + public IEnumerable? Modifier { - get { return ModifierElement != null ? ModifierElement.Select(elem => elem.Value) : null; } + get => _ModifierElement?.Select(elem => elem.Value); set { if (value == null) - ModifierElement = null; + ModifierElement = null!; else ModifierElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Modifier"); @@ -1034,20 +983,16 @@ public IEnumerable Modifier protected internal override void CopyToInternal(Base other) { - var dest = other as CanFilterByComponent; - - if (dest == null) - { + if(other is not CanFilterByComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(FilterParameterElement != null) dest.FilterParameterElement = (Hl7.Fhir.Model.FhirString)FilterParameterElement.DeepCopyInternal(); - if(FilterDefinitionElement != null) dest.FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri)FilterDefinitionElement.DeepCopyInternal(); - if(ComparatorElement.Any()) dest.ComparatorElement = new List>(ComparatorElement.DeepCopyInternal()); - if(ModifierElement.Any()) dest.ModifierElement = new List>(ModifierElement.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_FilterParameterElement is not null) dest.FilterParameterElement = (Hl7.Fhir.Model.FhirString)_FilterParameterElement.DeepCopyInternal(); + if(_FilterDefinitionElement is not null) dest.FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri)_FilterDefinitionElement.DeepCopyInternal(); + if(_ComparatorElement is not null) dest.ComparatorElement = new List>(_ComparatorElement.DeepCopyInternal()); + if(_ModifierElement is not null) dest.ModifierElement = new List>(_ModifierElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1059,69 +1004,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CanFilterByComponent; - if(otherT == null) return false; + if(other is not CanFilterByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(FilterParameterElement, otherT.FilterParameterElement)) return false; - if(!comparer.Equals(FilterDefinitionElement, otherT.FilterDefinitionElement)) return false; - if(!comparer.ListEquals(ComparatorElement, otherT.ComparatorElement)) return false; - if(!comparer.ListEquals(ModifierElement, otherT.ModifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_FilterParameterElement, otherT._FilterParameterElement)) return false; + if(!comparer.Equals(_FilterDefinitionElement, otherT._FilterDefinitionElement)) return false; + if(!comparer.ListEquals(_ComparatorElement, otherT._ComparatorElement)) return false; + if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "filterParameter": - value = FilterParameterElement; - return FilterParameterElement is not null; + value = _FilterParameterElement; + return _FilterParameterElement is not null; case "filterDefinition": - value = FilterDefinitionElement; - return FilterDefinitionElement is not null; + value = _FilterDefinitionElement; + return _FilterDefinitionElement is not null; case "comparator": - value = ComparatorElement; - return ComparatorElement?.Any() == true; + value = _ComparatorElement; + return _ComparatorElement?.Any() == true; case "modifier": - value = ModifierElement; - return ModifierElement?.Any() == true; + value = _ModifierElement; + return _ModifierElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "filterParameter": - FilterParameterElement = (Hl7.Fhir.Model.FhirString)value; + FilterParameterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "filterDefinition": - FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri)value; + FilterDefinitionElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "comparator": - ComparatorElement = (List>)value; + ComparatorElement = (List>?)value!; return this; case "modifier": - ModifierElement = (List>)value; + ModifierElement = (List>?)value!; return this; default: return base.SetValue(key, value); @@ -1132,12 +1077,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (FilterParameterElement is not null) yield return new KeyValuePair("filterParameter",FilterParameterElement); - if (FilterDefinitionElement is not null) yield return new KeyValuePair("filterDefinition",FilterDefinitionElement); - if (ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",ComparatorElement); - if (ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",ModifierElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_FilterParameterElement is not null) yield return new KeyValuePair("filterParameter",_FilterParameterElement); + if (_FilterDefinitionElement is not null) yield return new KeyValuePair("filterDefinition",_FilterDefinitionElement); + if (_ComparatorElement?.Any() == true) yield return new KeyValuePair("comparator",_ComparatorElement); + if (_ModifierElement?.Any() == true) yield return new KeyValuePair("modifier",_ModifierElement); } } @@ -1165,28 +1110,25 @@ public partial class NotificationShapeComponent : Hl7.Fhir.Model.BackboneElement [Binding("FHIRTypes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// URL of the Resource that is the focus (main) resource in a notification shape /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -1199,24 +1141,24 @@ public string Resource [DataMember] public List IncludeElement { - get { if(_IncludeElement==null) _IncludeElement = new List(); return _IncludeElement; } + get => _IncludeElement ?? new List(); set { _IncludeElement = value; OnPropertyChanged("IncludeElement"); } } - private List _IncludeElement; + private List? _IncludeElement; /// /// Include directives, rooted in the resource for this shape /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Include + public IEnumerable? Include { - get { return IncludeElement != null ? IncludeElement.Select(elem => elem.Value) : null; } + get => _IncludeElement?.Select(elem => elem.Value); set { if (value == null) - IncludeElement = null; + IncludeElement = null!; else IncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("Include"); @@ -1231,24 +1173,24 @@ public IEnumerable Include [DataMember] public List RevIncludeElement { - get { if(_RevIncludeElement==null) _RevIncludeElement = new List(); return _RevIncludeElement; } + get => _RevIncludeElement ?? new List(); set { _RevIncludeElement = value; OnPropertyChanged("RevIncludeElement"); } } - private List _RevIncludeElement; + private List? _RevIncludeElement; /// /// Reverse include directives, rooted in the resource for this shape /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable RevInclude + public IEnumerable? RevInclude { - get { return RevIncludeElement != null ? RevIncludeElement.Select(elem => elem.Value) : null; } + get => _RevIncludeElement?.Select(elem => elem.Value); set { if (value == null) - RevIncludeElement = null; + RevIncludeElement = null!; else RevIncludeElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("RevInclude"); @@ -1257,17 +1199,13 @@ public IEnumerable RevInclude protected internal override void CopyToInternal(Base other) { - var dest = other as NotificationShapeComponent; - - if (dest == null) - { + if(other is not NotificationShapeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(IncludeElement.Any()) dest.IncludeElement = new List(IncludeElement.DeepCopyInternal()); - if(RevIncludeElement.Any()) dest.RevIncludeElement = new List(RevIncludeElement.DeepCopyInternal()); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_IncludeElement is not null) dest.IncludeElement = new List(_IncludeElement.DeepCopyInternal()); + if(_RevIncludeElement is not null) dest.RevIncludeElement = new List(_RevIncludeElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1279,48 +1217,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NotificationShapeComponent; - if(otherT == null) return false; + if(other is not NotificationShapeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.ListEquals(IncludeElement, otherT.IncludeElement)) return false; - if(!comparer.ListEquals(RevIncludeElement, otherT.RevIncludeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.ListEquals(_IncludeElement, otherT._IncludeElement)) return false; + if(!comparer.ListEquals(_RevIncludeElement, otherT._RevIncludeElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "include": - value = IncludeElement; - return IncludeElement?.Any() == true; + value = _IncludeElement; + return _IncludeElement?.Any() == true; case "revInclude": - value = RevIncludeElement; - return RevIncludeElement?.Any() == true; + value = _RevIncludeElement; + return _RevIncludeElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "include": - IncludeElement = (List)value; + IncludeElement = (List?)value!; return this; case "revInclude": - RevIncludeElement = (List)value; + RevIncludeElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1331,9 +1269,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (IncludeElement?.Any() == true) yield return new KeyValuePair("include",IncludeElement); - if (RevIncludeElement?.Any() == true) yield return new KeyValuePair("revInclude",RevIncludeElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_IncludeElement?.Any() == true) yield return new KeyValuePair("include",_IncludeElement); + if (_RevIncludeElement?.Any() == true) yield return new KeyValuePair("revInclude",_RevIncludeElement); } } @@ -1344,28 +1282,25 @@ public override IEnumerable> EnumerateElements() [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this subscription topic, represented as an absolute URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1378,39 +1313,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the subscription topic. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the subscription topic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1422,41 +1354,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this subscription topic (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this subscription topic (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1466,28 +1395,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this subscription topic (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1500,24 +1426,24 @@ public string Title [DataMember] public List DerivedFromElement { - get { if(_DerivedFromElement==null) _DerivedFromElement = new List(); return _DerivedFromElement; } + get => _DerivedFromElement ?? new List(); set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } - private List _DerivedFromElement; + private List? _DerivedFromElement; /// /// Based on FHIR protocol or definition /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DerivedFrom + public IEnumerable? DerivedFrom { - get { return DerivedFromElement != null ? DerivedFromElement.Select(elem => elem.Value) : null; } + get => _DerivedFromElement?.Select(elem => elem.Value); set { if (value == null) - DerivedFromElement = null; + DerivedFromElement = null!; else DerivedFromElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("DerivedFrom"); @@ -1532,13 +1458,13 @@ public IEnumerable DerivedFrom [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1547,13 +1473,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1563,13 +1486,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=170, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// If for testing purposes, not real usage @@ -1578,13 +1501,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1594,28 +1514,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=180, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date status first applied /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1625,28 +1542,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=190, FiveWs="FiveWs.author")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// The name of the individual or organization that published the SubscriptionTopic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1659,39 +1573,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the SubscriptionTopic. /// [FhirElement("description", Order=210)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the SubscriptionTopic /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1704,11 +1615,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction of the SubscriptionTopic (if applicable). @@ -1719,39 +1630,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this SubscriptionTopic is defined. /// [FhirElement("purpose", Order=240, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this SubscriptionTopic is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1761,28 +1669,25 @@ public string Purpose /// [FhirElement("copyright", Order=250)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1792,28 +1697,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1823,28 +1725,25 @@ public string CopyrightLabel /// [FhirElement("approvalDate", Order=270)] [DataMember] - public Hl7.Fhir.Model.Date ApprovalDateElement + public Hl7.Fhir.Model.Date? ApprovalDateElement { get { return _ApprovalDateElement; } set { _ApprovalDateElement = value; OnPropertyChanged("ApprovalDateElement"); } } - private Hl7.Fhir.Model.Date _ApprovalDateElement; + private Hl7.Fhir.Model.Date? _ApprovalDateElement; /// /// When SubscriptionTopic is/was approved by publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ApprovalDate + public string? ApprovalDate { - get { return ApprovalDateElement != null ? ApprovalDateElement.Value : null; } + get => _ApprovalDateElement?.Value; set { - if (value == null) - ApprovalDateElement = null; - else - ApprovalDateElement = new Hl7.Fhir.Model.Date(value); + ApprovalDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("ApprovalDate"); } } @@ -1854,28 +1753,25 @@ public string ApprovalDate /// [FhirElement("lastReviewDate", Order=280)] [DataMember] - public Hl7.Fhir.Model.Date LastReviewDateElement + public Hl7.Fhir.Model.Date? LastReviewDateElement { get { return _LastReviewDateElement; } set { _LastReviewDateElement = value; OnPropertyChanged("LastReviewDateElement"); } } - private Hl7.Fhir.Model.Date _LastReviewDateElement; + private Hl7.Fhir.Model.Date? _LastReviewDateElement; /// /// Date the Subscription Topic was last reviewed by the publisher /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastReviewDate + public string? LastReviewDate { - get { return LastReviewDateElement != null ? LastReviewDateElement.Value : null; } + get => _LastReviewDateElement?.Value; set { - if (value == null) - LastReviewDateElement = null; - else - LastReviewDateElement = new Hl7.Fhir.Model.Date(value); + LastReviewDateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("LastReviewDate"); } } @@ -1885,13 +1781,13 @@ public string LastReviewDate /// [FhirElement("effectivePeriod", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.Period EffectivePeriod + public Hl7.Fhir.Model.Period? EffectivePeriod { get { return _EffectivePeriod; } set { _EffectivePeriod = value; OnPropertyChanged("EffectivePeriod"); } } - private Hl7.Fhir.Model.Period _EffectivePeriod; + private Hl7.Fhir.Model.Period? _EffectivePeriod; /// /// Definition of a resource-based trigger for the subscription topic. @@ -1901,11 +1797,11 @@ public Hl7.Fhir.Model.Period EffectivePeriod [DataMember] public List ResourceTrigger { - get { if(_ResourceTrigger==null) _ResourceTrigger = new List(); return _ResourceTrigger; } + get => _ResourceTrigger ?? new List(); set { _ResourceTrigger = value; OnPropertyChanged("ResourceTrigger"); } } - private List _ResourceTrigger; + private List? _ResourceTrigger; /// /// Event definitions the SubscriptionTopic. @@ -1915,11 +1811,11 @@ public List ResourceT [DataMember] public List EventTrigger { - get { if(_EventTrigger==null) _EventTrigger = new List(); return _EventTrigger; } + get => _EventTrigger ?? new List(); set { _EventTrigger = value; OnPropertyChanged("EventTrigger"); } } - private List _EventTrigger; + private List? _EventTrigger; /// /// Properties by which a Subscription can filter notifications from the SubscriptionTopic. @@ -1929,11 +1825,11 @@ public List EventTrigger [DataMember] public List CanFilterBy { - get { if(_CanFilterBy==null) _CanFilterBy = new List(); return _CanFilterBy; } + get => _CanFilterBy ?? new List(); set { _CanFilterBy = value; OnPropertyChanged("CanFilterBy"); } } - private List _CanFilterBy; + private List? _CanFilterBy; /// /// Properties for describing the shape of notifications generated by this topic. @@ -1943,49 +1839,45 @@ public List CanFilterBy [DataMember] public List NotificationShape { - get { if(_NotificationShape==null) _NotificationShape = new List(); return _NotificationShape; } + get => _NotificationShape ?? new List(); set { _NotificationShape = value; OnPropertyChanged("NotificationShape"); } } - private List _NotificationShape; + private List? _NotificationShape; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SubscriptionTopic; - - if (dest == null) - { + if(other is not SubscriptionTopic dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(DerivedFromElement.Any()) dest.DerivedFromElement = new List(DerivedFromElement.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(ApprovalDateElement != null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)ApprovalDateElement.DeepCopyInternal(); - if(LastReviewDateElement != null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)LastReviewDateElement.DeepCopyInternal(); - if(EffectivePeriod != null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)EffectivePeriod.DeepCopyInternal(); - if(ResourceTrigger.Any()) dest.ResourceTrigger = new List(ResourceTrigger.DeepCopyInternal()); - if(EventTrigger.Any()) dest.EventTrigger = new List(EventTrigger.DeepCopyInternal()); - if(CanFilterBy.Any()) dest.CanFilterBy = new List(CanFilterBy.DeepCopyInternal()); - if(NotificationShape.Any()) dest.NotificationShape = new List(NotificationShape.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_DerivedFromElement is not null) dest.DerivedFromElement = new List(_DerivedFromElement.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_ApprovalDateElement is not null) dest.ApprovalDateElement = (Hl7.Fhir.Model.Date)_ApprovalDateElement.DeepCopyInternal(); + if(_LastReviewDateElement is not null) dest.LastReviewDateElement = (Hl7.Fhir.Model.Date)_LastReviewDateElement.DeepCopyInternal(); + if(_EffectivePeriod is not null) dest.EffectivePeriod = (Hl7.Fhir.Model.Period)_EffectivePeriod.DeepCopyInternal(); + if(_ResourceTrigger is not null) dest.ResourceTrigger = new List(_ResourceTrigger.DeepCopyInternal()); + if(_EventTrigger is not null) dest.EventTrigger = new List(_EventTrigger.DeepCopyInternal()); + if(_CanFilterBy is not null) dest.CanFilterBy = new List(_CanFilterBy.DeepCopyInternal()); + if(_NotificationShape is not null) dest.NotificationShape = new List(_NotificationShape.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1997,202 +1889,202 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubscriptionTopic; - if(otherT == null) return false; + if(other is not SubscriptionTopic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.ListEquals(DerivedFromElement, otherT.DerivedFromElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(ApprovalDateElement, otherT.ApprovalDateElement)) return false; - if(!comparer.Equals(LastReviewDateElement, otherT.LastReviewDateElement)) return false; - if(!comparer.Equals(EffectivePeriod, otherT.EffectivePeriod)) return false; - if(!comparer.ListEquals(ResourceTrigger, otherT.ResourceTrigger)) return false; - if(!comparer.ListEquals(EventTrigger, otherT.EventTrigger)) return false; - if(!comparer.ListEquals(CanFilterBy, otherT.CanFilterBy)) return false; - if(!comparer.ListEquals(NotificationShape, otherT.NotificationShape)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_ApprovalDateElement, otherT._ApprovalDateElement)) return false; + if(!comparer.Equals(_LastReviewDateElement, otherT._LastReviewDateElement)) return false; + if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; + if(!comparer.ListEquals(_ResourceTrigger, otherT._ResourceTrigger)) return false; + if(!comparer.ListEquals(_EventTrigger, otherT._EventTrigger)) return false; + if(!comparer.ListEquals(_CanFilterBy, otherT._CanFilterBy)) return false; + if(!comparer.ListEquals(_NotificationShape, otherT._NotificationShape)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "derivedFrom": - value = DerivedFromElement; - return DerivedFromElement?.Any() == true; + value = _DerivedFromElement; + return _DerivedFromElement?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "approvalDate": - value = ApprovalDateElement; - return ApprovalDateElement is not null; + value = _ApprovalDateElement; + return _ApprovalDateElement is not null; case "lastReviewDate": - value = LastReviewDateElement; - return LastReviewDateElement is not null; + value = _LastReviewDateElement; + return _LastReviewDateElement is not null; case "effectivePeriod": - value = EffectivePeriod; - return EffectivePeriod is not null; + value = _EffectivePeriod; + return _EffectivePeriod is not null; case "resourceTrigger": - value = ResourceTrigger; - return ResourceTrigger?.Any() == true; + value = _ResourceTrigger; + return _ResourceTrigger?.Any() == true; case "eventTrigger": - value = EventTrigger; - return EventTrigger?.Any() == true; + value = _EventTrigger; + return _EventTrigger?.Any() == true; case "canFilterBy": - value = CanFilterBy; - return CanFilterBy?.Any() == true; + value = _CanFilterBy; + return _CanFilterBy?.Any() == true; case "notificationShape": - value = NotificationShape; - return NotificationShape?.Any() == true; + value = _NotificationShape; + return _NotificationShape?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "derivedFrom": - DerivedFromElement = (List)value; + DerivedFromElement = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "approvalDate": - ApprovalDateElement = (Hl7.Fhir.Model.Date)value; + ApprovalDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "lastReviewDate": - LastReviewDateElement = (Hl7.Fhir.Model.Date)value; + LastReviewDateElement = (Hl7.Fhir.Model.Date?)value; return this; case "effectivePeriod": - EffectivePeriod = (Hl7.Fhir.Model.Period)value; + EffectivePeriod = (Hl7.Fhir.Model.Period?)value; return this; case "resourceTrigger": - ResourceTrigger = (List)value; + ResourceTrigger = (List?)value!; return this; case "eventTrigger": - EventTrigger = (List)value; + EventTrigger = (List?)value!; return this; case "canFilterBy": - CanFilterBy = (List)value; + CanFilterBy = (List?)value!; return this; case "notificationShape": - NotificationShape = (List)value; + NotificationShape = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2203,31 +2095,31 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",DerivedFromElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",ApprovalDateElement); - if (LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",LastReviewDateElement); - if (EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",EffectivePeriod); - if (ResourceTrigger?.Any() == true) yield return new KeyValuePair("resourceTrigger",ResourceTrigger); - if (EventTrigger?.Any() == true) yield return new KeyValuePair("eventTrigger",EventTrigger); - if (CanFilterBy?.Any() == true) yield return new KeyValuePair("canFilterBy",CanFilterBy); - if (NotificationShape?.Any() == true) yield return new KeyValuePair("notificationShape",NotificationShape); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_DerivedFromElement?.Any() == true) yield return new KeyValuePair("derivedFrom",_DerivedFromElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_ApprovalDateElement is not null) yield return new KeyValuePair("approvalDate",_ApprovalDateElement); + if (_LastReviewDateElement is not null) yield return new KeyValuePair("lastReviewDate",_LastReviewDateElement); + if (_EffectivePeriod is not null) yield return new KeyValuePair("effectivePeriod",_EffectivePeriod); + if (_ResourceTrigger?.Any() == true) yield return new KeyValuePair("resourceTrigger",_ResourceTrigger); + if (_EventTrigger?.Any() == true) yield return new KeyValuePair("eventTrigger",_EventTrigger); + if (_CanFilterBy?.Any() == true) yield return new KeyValuePair("canFilterBy",_CanFilterBy); + if (_NotificationShape?.Any() == true) yield return new KeyValuePair("notificationShape",_NotificationShape); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Substance.cs b/src/Hl7.Fhir.R5/Model/Generated/Substance.cs index c92b924ce..fc96081d6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Substance.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -105,13 +108,13 @@ public partial class IngredientComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Ratio Quantity + public Hl7.Fhir.Model.Ratio? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Ratio _Quantity; + private Hl7.Fhir.Model.Ratio? _Quantity; /// /// A component of the substance. @@ -123,26 +126,22 @@ public Hl7.Fhir.Model.Ratio Quantity [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Substance + public Hl7.Fhir.Model.DataType? Substance { get { return _Substance; } set { _Substance = value; OnPropertyChanged("Substance"); } } - private Hl7.Fhir.Model.DataType _Substance; + private Hl7.Fhir.Model.DataType? _Substance; protected internal override void CopyToInternal(Base other) { - var dest = other as IngredientComponent; - - if (dest == null) - { + if(other is not IngredientComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Ratio)Quantity.DeepCopyInternal(); - if(Substance != null) dest.Substance = (Hl7.Fhir.Model.DataType)Substance.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Ratio)_Quantity.DeepCopyInternal(); + if(_Substance is not null) dest.Substance = (Hl7.Fhir.Model.DataType)_Substance.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -154,41 +153,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as IngredientComponent; - if(otherT == null) return false; + if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Substance, otherT.Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Substance, otherT._Substance)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "substance": - value = Substance; - return Substance is not null; + value = _Substance; + return _Substance is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Ratio)value; + Quantity = (Hl7.Fhir.Model.Ratio?)value; return this; case "substance": - Substance = (Hl7.Fhir.Model.DataType)value; + Substance = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -199,8 +198,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Substance is not null) yield return new KeyValuePair("substance",Substance); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Substance is not null) yield return new KeyValuePair("substance",_Substance); } } @@ -213,11 +212,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Is this an instance of a substance or a kind of one. @@ -225,13 +224,13 @@ public List Identifier [FhirElement("instance", InSummary=true, IsModifier=true, Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean InstanceElement + public Hl7.Fhir.Model.FhirBoolean? InstanceElement { get { return _InstanceElement; } set { _InstanceElement = value; OnPropertyChanged("InstanceElement"); } } - private Hl7.Fhir.Model.FhirBoolean _InstanceElement; + private Hl7.Fhir.Model.FhirBoolean? _InstanceElement; /// /// Is this an instance of a substance or a kind of one @@ -240,13 +239,10 @@ public Hl7.Fhir.Model.FhirBoolean InstanceElement [IgnoreDataMember] public bool? Instance { - get { return InstanceElement != null ? InstanceElement.Value : null; } + get => _InstanceElement?.Value; set { - if (value == null) - InstanceElement = null; - else - InstanceElement = new Hl7.Fhir.Model.FhirBoolean(value); + InstanceElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Instance"); } } @@ -258,13 +254,13 @@ public bool? Instance [DeclaredType(Type = typeof(Code))] [Binding("FHIRSubstanceStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | inactive | entered-in-error @@ -273,13 +269,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -293,11 +286,11 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What substance this is. @@ -306,41 +299,38 @@ public List Category [Binding("SubstanceCode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Code + public Hl7.Fhir.Model.CodeableReference? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableReference _Code; + private Hl7.Fhir.Model.CodeableReference? _Code; /// /// Textual description of the substance, comments. /// [FhirElement("description", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description of the substance, comments /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -350,28 +340,25 @@ public string Description /// [FhirElement("expiry", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ExpiryElement + public Hl7.Fhir.Model.FhirDateTime? ExpiryElement { get { return _ExpiryElement; } set { _ExpiryElement = value; OnPropertyChanged("ExpiryElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ExpiryElement; + private Hl7.Fhir.Model.FhirDateTime? _ExpiryElement; /// /// When no longer valid to use /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expiry + public string? Expiry { - get { return ExpiryElement != null ? ExpiryElement.Value : null; } + get => _ExpiryElement?.Value; set { - if (value == null) - ExpiryElement = null; - else - ExpiryElement = new Hl7.Fhir.Model.FhirDateTime(value); + ExpiryElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Expiry"); } } @@ -381,13 +368,13 @@ public string Expiry /// [FhirElement("quantity", InSummary=true, Order=160)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Composition information about the substance. @@ -397,33 +384,29 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Ingredient { - get { if(_Ingredient==null) _Ingredient = new List(); return _Ingredient; } + get => _Ingredient ?? new List(); set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } - private List _Ingredient; + private List? _Ingredient; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Substance; - - if (dest == null) - { + if(other is not Substance dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstanceElement != null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)InstanceElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableReference)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(ExpiryElement != null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)ExpiryElement.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Ingredient.Any()) dest.Ingredient = new List(Ingredient.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstanceElement is not null) dest.InstanceElement = (Hl7.Fhir.Model.FhirBoolean)_InstanceElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableReference)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_ExpiryElement is not null) dest.ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)_ExpiryElement.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Ingredient is not null) dest.Ingredient = new List(_Ingredient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -435,90 +418,90 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Substance; - if(otherT == null) return false; + if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(InstanceElement, otherT.InstanceElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ExpiryElement, otherT.ExpiryElement)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Ingredient, otherT.Ingredient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_InstanceElement, otherT._InstanceElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instance": - value = InstanceElement; - return InstanceElement is not null; + value = _InstanceElement; + return _InstanceElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "expiry": - value = ExpiryElement; - return ExpiryElement is not null; + value = _ExpiryElement; + return _ExpiryElement is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "ingredient": - value = Ingredient; - return Ingredient?.Any() == true; + value = _Ingredient; + return _Ingredient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instance": - InstanceElement = (Hl7.Fhir.Model.FhirBoolean)value; + InstanceElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableReference)value; + Code = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "expiry": - ExpiryElement = (Hl7.Fhir.Model.FhirDateTime)value; + ExpiryElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "ingredient": - Ingredient = (List)value; + Ingredient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -529,15 +512,15 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstanceElement is not null) yield return new KeyValuePair("instance",InstanceElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ExpiryElement is not null) yield return new KeyValuePair("expiry",ExpiryElement); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",Ingredient); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstanceElement is not null) yield return new KeyValuePair("instance",_InstanceElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ExpiryElement is not null) yield return new KeyValuePair("expiry",_ExpiryElement); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Ingredient?.Any() == true) yield return new KeyValuePair("ingredient",_Ingredient); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs index 25ece50b6..b6fabb021 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,54 +77,51 @@ public partial class MoietyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("role", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Role + public Hl7.Fhir.Model.CodeableConcept? Role { get { return _Role; } set { _Role = value; OnPropertyChanged("Role"); } } - private Hl7.Fhir.Model.CodeableConcept _Role; + private Hl7.Fhir.Model.CodeableConcept? _Role; /// /// Identifier by which this moiety substance is known. /// [FhirElement("identifier", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Textual name for this moiety substance. /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Textual name for this moiety substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -132,13 +132,13 @@ public string Name [FhirElement("stereochemistry", InSummary=true, Order=70)] [Binding("SubstanceStereochemistry")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Stereochemistry + public Hl7.Fhir.Model.CodeableConcept? Stereochemistry { get { return _Stereochemistry; } set { _Stereochemistry = value; OnPropertyChanged("Stereochemistry"); } } - private Hl7.Fhir.Model.CodeableConcept _Stereochemistry; + private Hl7.Fhir.Model.CodeableConcept? _Stereochemistry; /// /// Optical activity type. @@ -146,41 +146,38 @@ public Hl7.Fhir.Model.CodeableConcept Stereochemistry [FhirElement("opticalActivity", InSummary=true, Order=80)] [Binding("SubstanceOpticalActivity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OpticalActivity + public Hl7.Fhir.Model.CodeableConcept? OpticalActivity { get { return _OpticalActivity; } set { _OpticalActivity = value; OnPropertyChanged("OpticalActivity"); } } - private Hl7.Fhir.Model.CodeableConcept _OpticalActivity; + private Hl7.Fhir.Model.CodeableConcept? _OpticalActivity; /// /// Molecular formula for this moiety (e.g. with the Hill system). /// [FhirElement("molecularFormula", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaElement { get { return _MolecularFormulaElement; } set { _MolecularFormulaElement = value; OnPropertyChanged("MolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaElement; /// /// Molecular formula for this moiety (e.g. with the Hill system) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormula + public string? MolecularFormula { - get { return MolecularFormulaElement != null ? MolecularFormulaElement.Value : null; } + get => _MolecularFormulaElement?.Value; set { - if (value == null) - MolecularFormulaElement = null; - else - MolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormula"); } } @@ -192,13 +189,13 @@ public string MolecularFormula [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// The measurement type of the quantitative value. @@ -206,32 +203,28 @@ public Hl7.Fhir.Model.DataType Amount [FhirElement("measurementType", InSummary=true, Order=110)] [Binding("SubstanceAmountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MeasurementType + public Hl7.Fhir.Model.CodeableConcept? MeasurementType { get { return _MeasurementType; } set { _MeasurementType = value; OnPropertyChanged("MeasurementType"); } } - private Hl7.Fhir.Model.CodeableConcept _MeasurementType; + private Hl7.Fhir.Model.CodeableConcept? _MeasurementType; protected internal override void CopyToInternal(Base other) { - var dest = other as MoietyComponent; - - if (dest == null) - { + if(other is not MoietyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Role != null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)Role.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Stereochemistry != null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)Stereochemistry.DeepCopyInternal(); - if(OpticalActivity != null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)OpticalActivity.DeepCopyInternal(); - if(MolecularFormulaElement != null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(MeasurementType != null) dest.MeasurementType = (Hl7.Fhir.Model.CodeableConcept)MeasurementType.DeepCopyInternal(); + if(_Role is not null) dest.Role = (Hl7.Fhir.Model.CodeableConcept)_Role.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Stereochemistry is not null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)_Stereochemistry.DeepCopyInternal(); + if(_OpticalActivity is not null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)_OpticalActivity.DeepCopyInternal(); + if(_MolecularFormulaElement is not null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_MeasurementType is not null) dest.MeasurementType = (Hl7.Fhir.Model.CodeableConcept)_MeasurementType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -243,83 +236,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MoietyComponent; - if(otherT == null) return false; + if(other is not MoietyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Role, otherT.Role)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Stereochemistry, otherT.Stereochemistry)) return false; - if(!comparer.Equals(OpticalActivity, otherT.OpticalActivity)) return false; - if(!comparer.Equals(MolecularFormulaElement, otherT.MolecularFormulaElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(MeasurementType, otherT.MeasurementType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; + if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_MeasurementType, otherT._MeasurementType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "role": - value = Role; - return Role is not null; + value = _Role; + return _Role is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "stereochemistry": - value = Stereochemistry; - return Stereochemistry is not null; + value = _Stereochemistry; + return _Stereochemistry is not null; case "opticalActivity": - value = OpticalActivity; - return OpticalActivity is not null; + value = _OpticalActivity; + return _OpticalActivity is not null; case "molecularFormula": - value = MolecularFormulaElement; - return MolecularFormulaElement is not null; + value = _MolecularFormulaElement; + return _MolecularFormulaElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "measurementType": - value = MeasurementType; - return MeasurementType is not null; + value = _MeasurementType; + return _MeasurementType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "role": - Role = (Hl7.Fhir.Model.CodeableConcept)value; + Role = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "stereochemistry": - Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)value; + Stereochemistry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "opticalActivity": - OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)value; + OpticalActivity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "molecularFormula": - MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "measurementType": - MeasurementType = (Hl7.Fhir.Model.CodeableConcept)value; + MeasurementType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -330,14 +323,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Role is not null) yield return new KeyValuePair("role",Role); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",Stereochemistry); - if (OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",OpticalActivity); - if (MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",MolecularFormulaElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (MeasurementType is not null) yield return new KeyValuePair("measurementType",MeasurementType); + if (_Role is not null) yield return new KeyValuePair("role",_Role); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",_Stereochemistry); + if (_OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",_OpticalActivity); + if (_MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",_MolecularFormulaElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_MeasurementType is not null) yield return new KeyValuePair("measurementType",_MeasurementType); } } @@ -361,13 +354,13 @@ public partial class CharacterizationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("technique", InSummary=true, Order=40)] [Binding("SubstanceStructureTechnique")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Technique + public Hl7.Fhir.Model.CodeableConcept? Technique { get { return _Technique; } set { _Technique = value; OnPropertyChanged("Technique"); } } - private Hl7.Fhir.Model.CodeableConcept _Technique; + private Hl7.Fhir.Model.CodeableConcept? _Technique; /// /// Describes the nature of the chemical entity and explains, for instance, whether this is a base or a salt form. @@ -375,41 +368,38 @@ public Hl7.Fhir.Model.CodeableConcept Technique [FhirElement("form", InSummary=true, Order=50)] [Binding("SubstanceForm")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Form + public Hl7.Fhir.Model.CodeableConcept? Form { get { return _Form; } set { _Form = value; OnPropertyChanged("Form"); } } - private Hl7.Fhir.Model.CodeableConcept _Form; + private Hl7.Fhir.Model.CodeableConcept? _Form; /// /// The description or justification in support of the interpretation of the data file. /// [FhirElement("description", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// The description or justification in support of the interpretation of the data file /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -422,26 +412,22 @@ public string Description [DataMember] public List File { - get { if(_File==null) _File = new List(); return _File; } + get => _File ?? new List(); set { _File = value; OnPropertyChanged("File"); } } - private List _File; + private List? _File; protected internal override void CopyToInternal(Base other) { - var dest = other as CharacterizationComponent; - - if (dest == null) - { + if(other is not CharacterizationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Technique != null) dest.Technique = (Hl7.Fhir.Model.CodeableConcept)Technique.DeepCopyInternal(); - if(Form != null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)Form.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(File.Any()) dest.File = new List(File.DeepCopyInternal()); + if(_Technique is not null) dest.Technique = (Hl7.Fhir.Model.CodeableConcept)_Technique.DeepCopyInternal(); + if(_Form is not null) dest.Form = (Hl7.Fhir.Model.CodeableConcept)_Form.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_File is not null) dest.File = new List(_File.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -453,55 +439,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CharacterizationComponent; - if(otherT == null) return false; + if(other is not CharacterizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Technique, otherT.Technique)) return false; - if(!comparer.Equals(Form, otherT.Form)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(File, otherT.File)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Technique, otherT._Technique)) return false; + if(!comparer.Equals(_Form, otherT._Form)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_File, otherT._File)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "technique": - value = Technique; - return Technique is not null; + value = _Technique; + return _Technique is not null; case "form": - value = Form; - return Form is not null; + value = _Form; + return _Form is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "file": - value = File; - return File?.Any() == true; + value = _File; + return _File?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "technique": - Technique = (Hl7.Fhir.Model.CodeableConcept)value; + Technique = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "form": - Form = (Hl7.Fhir.Model.CodeableConcept)value; + Form = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "file": - File = (List)value; + File = (List?)value!; return this; default: return base.SetValue(key, value); @@ -512,10 +498,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Technique is not null) yield return new KeyValuePair("technique",Technique); - if (Form is not null) yield return new KeyValuePair("form",Form); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (File?.Any() == true) yield return new KeyValuePair("file",File); + if (_Technique is not null) yield return new KeyValuePair("technique",_Technique); + if (_Form is not null) yield return new KeyValuePair("form",_Form); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_File?.Any() == true) yield return new KeyValuePair("file",_File); } } @@ -540,13 +526,13 @@ public partial class PropertyComponent : Hl7.Fhir.Model.BackboneElement [Binding("SNOMEDCTCharacteristicCodes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// A value for the property. @@ -555,26 +541,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Attachment))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as PropertyComponent; - - if (dest == null) - { + if(other is not PropertyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -586,41 +568,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PropertyComponent; - if(otherT == null) return false; + if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -631,8 +613,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -659,13 +641,13 @@ public partial class MolecularWeightComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("method", InSummary=true, Order=40)] [Binding("SubstanceWeightMethod")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Method + public Hl7.Fhir.Model.CodeableConcept? Method { get { return _Method; } set { _Method = value; OnPropertyChanged("Method"); } } - private Hl7.Fhir.Model.CodeableConcept _Method; + private Hl7.Fhir.Model.CodeableConcept? _Method; /// /// Type of molecular weight e.g. exact, average, weight average. @@ -673,13 +655,13 @@ public Hl7.Fhir.Model.CodeableConcept Method [FhirElement("type", InSummary=true, Order=50)] [Binding("SubstanceWeightType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Used to capture quantitative values for a variety of elements. @@ -687,27 +669,23 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("amount", InSummary=true, Order=60)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as MolecularWeightComponent; - - if (dest == null) - { + if(other is not MolecularWeightComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Method != null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Method is not null) dest.Method = (Hl7.Fhir.Model.CodeableConcept)_Method.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -719,48 +697,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MolecularWeightComponent; - if(otherT == null) return false; + if(other is not MolecularWeightComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Method, otherT.Method)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Method, otherT._Method)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "method": - value = Method; - return Method is not null; + value = _Method; + return _Method is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "method": - Method = (Hl7.Fhir.Model.CodeableConcept)value; + Method = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -771,9 +749,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Method is not null) yield return new KeyValuePair("method",Method); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Method is not null) yield return new KeyValuePair("method",_Method); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -797,13 +775,13 @@ public partial class StructureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("stereochemistry", InSummary=true, Order=40)] [Binding("SubstanceStereochemistry")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Stereochemistry + public Hl7.Fhir.Model.CodeableConcept? Stereochemistry { get { return _Stereochemistry; } set { _Stereochemistry = value; OnPropertyChanged("Stereochemistry"); } } - private Hl7.Fhir.Model.CodeableConcept _Stereochemistry; + private Hl7.Fhir.Model.CodeableConcept? _Stereochemistry; /// /// Optical activity type. @@ -811,41 +789,38 @@ public Hl7.Fhir.Model.CodeableConcept Stereochemistry [FhirElement("opticalActivity", InSummary=true, Order=50)] [Binding("SubstanceOpticalActivity")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OpticalActivity + public Hl7.Fhir.Model.CodeableConcept? OpticalActivity { get { return _OpticalActivity; } set { _OpticalActivity = value; OnPropertyChanged("OpticalActivity"); } } - private Hl7.Fhir.Model.CodeableConcept _OpticalActivity; + private Hl7.Fhir.Model.CodeableConcept? _OpticalActivity; /// /// An expression which states the number and type of atoms present in a molecule of a substance. /// [FhirElement("molecularFormula", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaElement { get { return _MolecularFormulaElement; } set { _MolecularFormulaElement = value; OnPropertyChanged("MolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaElement; /// /// An expression which states the number and type of atoms present in a molecule of a substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormula + public string? MolecularFormula { - get { return MolecularFormulaElement != null ? MolecularFormulaElement.Value : null; } + get => _MolecularFormulaElement?.Value; set { - if (value == null) - MolecularFormulaElement = null; - else - MolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormula"); } } @@ -855,28 +830,25 @@ public string MolecularFormula /// [FhirElement("molecularFormulaByMoiety", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString MolecularFormulaByMoietyElement + public Hl7.Fhir.Model.FhirString? MolecularFormulaByMoietyElement { get { return _MolecularFormulaByMoietyElement; } set { _MolecularFormulaByMoietyElement = value; OnPropertyChanged("MolecularFormulaByMoietyElement"); } } - private Hl7.Fhir.Model.FhirString _MolecularFormulaByMoietyElement; + private Hl7.Fhir.Model.FhirString? _MolecularFormulaByMoietyElement; /// /// Specified per moiety according to the Hill system /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MolecularFormulaByMoiety + public string? MolecularFormulaByMoiety { - get { return MolecularFormulaByMoietyElement != null ? MolecularFormulaByMoietyElement.Value : null; } + get => _MolecularFormulaByMoietyElement?.Value; set { - if (value == null) - MolecularFormulaByMoietyElement = null; - else - MolecularFormulaByMoietyElement = new Hl7.Fhir.Model.FhirString(value); + MolecularFormulaByMoietyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MolecularFormulaByMoiety"); } } @@ -886,13 +858,13 @@ public string MolecularFormulaByMoiety /// [FhirElement("molecularWeight", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent MolecularWeight + public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent? MolecularWeight { get { return _MolecularWeight; } set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } - private Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent _MolecularWeight; + private Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent? _MolecularWeight; /// /// The method used to find the structure e.g. X-ray, NMR. @@ -903,11 +875,11 @@ public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent MolecularWeig [DataMember] public List Technique { - get { if(_Technique==null) _Technique = new List(); return _Technique; } + get => _Technique ?? new List(); set { _Technique = value; OnPropertyChanged("Technique"); } } - private List _Technique; + private List? _Technique; /// /// Source of information for the structure. @@ -919,11 +891,11 @@ public List Technique [DataMember] public List SourceDocument { - get { if(_SourceDocument==null) _SourceDocument = new List(); return _SourceDocument; } + get => _SourceDocument ?? new List(); set { _SourceDocument = value; OnPropertyChanged("SourceDocument"); } } - private List _SourceDocument; + private List? _SourceDocument; /// /// A depiction of the structure of the substance. @@ -933,30 +905,26 @@ public List SourceDocument [DataMember] public List Representation { - get { if(_Representation==null) _Representation = new List(); return _Representation; } + get => _Representation ?? new List(); set { _Representation = value; OnPropertyChanged("Representation"); } } - private List _Representation; + private List? _Representation; protected internal override void CopyToInternal(Base other) { - var dest = other as StructureComponent; - - if (dest == null) - { + if(other is not StructureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Stereochemistry != null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)Stereochemistry.DeepCopyInternal(); - if(OpticalActivity != null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)OpticalActivity.DeepCopyInternal(); - if(MolecularFormulaElement != null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaElement.DeepCopyInternal(); - if(MolecularFormulaByMoietyElement != null) dest.MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)MolecularFormulaByMoietyElement.DeepCopyInternal(); - if(MolecularWeight != null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent)MolecularWeight.DeepCopyInternal(); - if(Technique.Any()) dest.Technique = new List(Technique.DeepCopyInternal()); - if(SourceDocument.Any()) dest.SourceDocument = new List(SourceDocument.DeepCopyInternal()); - if(Representation.Any()) dest.Representation = new List(Representation.DeepCopyInternal()); + if(_Stereochemistry is not null) dest.Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)_Stereochemistry.DeepCopyInternal(); + if(_OpticalActivity is not null) dest.OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)_OpticalActivity.DeepCopyInternal(); + if(_MolecularFormulaElement is not null) dest.MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaElement.DeepCopyInternal(); + if(_MolecularFormulaByMoietyElement is not null) dest.MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)_MolecularFormulaByMoietyElement.DeepCopyInternal(); + if(_MolecularWeight is not null) dest.MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent)_MolecularWeight.DeepCopyInternal(); + if(_Technique is not null) dest.Technique = new List(_Technique.DeepCopyInternal()); + if(_SourceDocument is not null) dest.SourceDocument = new List(_SourceDocument.DeepCopyInternal()); + if(_Representation is not null) dest.Representation = new List(_Representation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -968,83 +936,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructureComponent; - if(otherT == null) return false; + if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Stereochemistry, otherT.Stereochemistry)) return false; - if(!comparer.Equals(OpticalActivity, otherT.OpticalActivity)) return false; - if(!comparer.Equals(MolecularFormulaElement, otherT.MolecularFormulaElement)) return false; - if(!comparer.Equals(MolecularFormulaByMoietyElement, otherT.MolecularFormulaByMoietyElement)) return false; - if(!comparer.Equals(MolecularWeight, otherT.MolecularWeight)) return false; - if(!comparer.ListEquals(Technique, otherT.Technique)) return false; - if(!comparer.ListEquals(SourceDocument, otherT.SourceDocument)) return false; - if(!comparer.ListEquals(Representation, otherT.Representation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; + if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; + if(!comparer.Equals(_MolecularFormulaByMoietyElement, otherT._MolecularFormulaByMoietyElement)) return false; + if(!comparer.Equals(_MolecularWeight, otherT._MolecularWeight)) return false; + if(!comparer.ListEquals(_Technique, otherT._Technique)) return false; + if(!comparer.ListEquals(_SourceDocument, otherT._SourceDocument)) return false; + if(!comparer.ListEquals(_Representation, otherT._Representation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "stereochemistry": - value = Stereochemistry; - return Stereochemistry is not null; + value = _Stereochemistry; + return _Stereochemistry is not null; case "opticalActivity": - value = OpticalActivity; - return OpticalActivity is not null; + value = _OpticalActivity; + return _OpticalActivity is not null; case "molecularFormula": - value = MolecularFormulaElement; - return MolecularFormulaElement is not null; + value = _MolecularFormulaElement; + return _MolecularFormulaElement is not null; case "molecularFormulaByMoiety": - value = MolecularFormulaByMoietyElement; - return MolecularFormulaByMoietyElement is not null; + value = _MolecularFormulaByMoietyElement; + return _MolecularFormulaByMoietyElement is not null; case "molecularWeight": - value = MolecularWeight; - return MolecularWeight is not null; + value = _MolecularWeight; + return _MolecularWeight is not null; case "technique": - value = Technique; - return Technique?.Any() == true; + value = _Technique; + return _Technique?.Any() == true; case "sourceDocument": - value = SourceDocument; - return SourceDocument?.Any() == true; + value = _SourceDocument; + return _SourceDocument?.Any() == true; case "representation": - value = Representation; - return Representation?.Any() == true; + value = _Representation; + return _Representation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "stereochemistry": - Stereochemistry = (Hl7.Fhir.Model.CodeableConcept)value; + Stereochemistry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "opticalActivity": - OpticalActivity = (Hl7.Fhir.Model.CodeableConcept)value; + OpticalActivity = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "molecularFormula": - MolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "molecularFormulaByMoiety": - MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString)value; + MolecularFormulaByMoietyElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "molecularWeight": - MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent)value; + MolecularWeight = (Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent?)value; return this; case "technique": - Technique = (List)value; + Technique = (List?)value!; return this; case "sourceDocument": - SourceDocument = (List)value; + SourceDocument = (List?)value!; return this; case "representation": - Representation = (List)value; + Representation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1055,14 +1023,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",Stereochemistry); - if (OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",OpticalActivity); - if (MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",MolecularFormulaElement); - if (MolecularFormulaByMoietyElement is not null) yield return new KeyValuePair("molecularFormulaByMoiety",MolecularFormulaByMoietyElement); - if (MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",MolecularWeight); - if (Technique?.Any() == true) yield return new KeyValuePair("technique",Technique); - if (SourceDocument?.Any() == true) yield return new KeyValuePair("sourceDocument",SourceDocument); - if (Representation?.Any() == true) yield return new KeyValuePair("representation",Representation); + if (_Stereochemistry is not null) yield return new KeyValuePair("stereochemistry",_Stereochemistry); + if (_OpticalActivity is not null) yield return new KeyValuePair("opticalActivity",_OpticalActivity); + if (_MolecularFormulaElement is not null) yield return new KeyValuePair("molecularFormula",_MolecularFormulaElement); + if (_MolecularFormulaByMoietyElement is not null) yield return new KeyValuePair("molecularFormulaByMoiety",_MolecularFormulaByMoietyElement); + if (_MolecularWeight is not null) yield return new KeyValuePair("molecularWeight",_MolecularWeight); + if (_Technique?.Any() == true) yield return new KeyValuePair("technique",_Technique); + if (_SourceDocument?.Any() == true) yield return new KeyValuePair("sourceDocument",_SourceDocument); + if (_Representation?.Any() == true) yield return new KeyValuePair("representation",_Representation); } } @@ -1086,41 +1054,38 @@ public partial class RepresentationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("SubstanceRepresentationType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The structural representation as a text string in a standard format. /// [FhirElement("representation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RepresentationElement + public Hl7.Fhir.Model.FhirString? RepresentationElement { get { return _RepresentationElement; } set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } - private Hl7.Fhir.Model.FhirString _RepresentationElement; + private Hl7.Fhir.Model.FhirString? _RepresentationElement; /// /// The structural representation as a text string in a standard format /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Representation + public string? Representation { - get { return RepresentationElement != null ? RepresentationElement.Value : null; } + get => _RepresentationElement?.Value; set { - if (value == null) - RepresentationElement = null; - else - RepresentationElement = new Hl7.Fhir.Model.FhirString(value); + RepresentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Representation"); } } @@ -1131,13 +1096,13 @@ public string Representation [FhirElement("format", InSummary=true, Order=60)] [Binding("SubstanceRepresentationFormat")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Format + public Hl7.Fhir.Model.CodeableConcept? Format { get { return _Format; } set { _Format = value; OnPropertyChanged("Format"); } } - private Hl7.Fhir.Model.CodeableConcept _Format; + private Hl7.Fhir.Model.CodeableConcept? _Format; /// /// An attachment with the structural representation e.g. a structure graphic or AnIML file. @@ -1146,28 +1111,24 @@ public Hl7.Fhir.Model.CodeableConcept Format [CLSCompliant(false)] [References("DocumentReference")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Document + public Hl7.Fhir.Model.ResourceReference? Document { get { return _Document; } set { _Document = value; OnPropertyChanged("Document"); } } - private Hl7.Fhir.Model.ResourceReference _Document; + private Hl7.Fhir.Model.ResourceReference? _Document; protected internal override void CopyToInternal(Base other) { - var dest = other as RepresentationComponent; - - if (dest == null) - { + if(other is not RepresentationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RepresentationElement != null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)RepresentationElement.DeepCopyInternal(); - if(Format != null) dest.Format = (Hl7.Fhir.Model.CodeableConcept)Format.DeepCopyInternal(); - if(Document != null) dest.Document = (Hl7.Fhir.Model.ResourceReference)Document.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RepresentationElement is not null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)_RepresentationElement.DeepCopyInternal(); + if(_Format is not null) dest.Format = (Hl7.Fhir.Model.CodeableConcept)_Format.DeepCopyInternal(); + if(_Document is not null) dest.Document = (Hl7.Fhir.Model.ResourceReference)_Document.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1179,55 +1140,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepresentationComponent; - if(otherT == null) return false; + if(other is not RepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RepresentationElement, otherT.RepresentationElement)) return false; - if(!comparer.Equals(Format, otherT.Format)) return false; - if(!comparer.Equals(Document, otherT.Document)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; + if(!comparer.Equals(_Format, otherT._Format)) return false; + if(!comparer.Equals(_Document, otherT._Document)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "representation": - value = RepresentationElement; - return RepresentationElement is not null; + value = _RepresentationElement; + return _RepresentationElement is not null; case "format": - value = Format; - return Format is not null; + value = _Format; + return _Format is not null; case "document": - value = Document; - return Document is not null; + value = _Document; + return _Document is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "representation": - RepresentationElement = (Hl7.Fhir.Model.FhirString)value; + RepresentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "format": - Format = (Hl7.Fhir.Model.CodeableConcept)value; + Format = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "document": - Document = (Hl7.Fhir.Model.ResourceReference)value; + Document = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1238,10 +1199,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RepresentationElement is not null) yield return new KeyValuePair("representation",RepresentationElement); - if (Format is not null) yield return new KeyValuePair("format",Format); - if (Document is not null) yield return new KeyValuePair("document",Document); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RepresentationElement is not null) yield return new KeyValuePair("representation",_RepresentationElement); + if (_Format is not null) yield return new KeyValuePair("format",_Format); + if (_Document is not null) yield return new KeyValuePair("document",_Document); } } @@ -1264,13 +1225,13 @@ public partial class CodeComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Status of the code assignment, for example 'provisional', 'approved'. @@ -1278,41 +1239,38 @@ public Hl7.Fhir.Model.CodeableConcept Code [FhirElement("status", InSummary=true, Order=50)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// The date at which the code status was changed. /// [FhirElement("statusDate", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// The date at which the code status was changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -1325,11 +1283,11 @@ public string StatusDate [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Supporting literature. @@ -1341,27 +1299,23 @@ public List Note [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as CodeComponent; - - if (dest == null) - { + if(other is not CodeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1373,62 +1327,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeComponent; - if(otherT == null) return false; + if(other is not CodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1439,11 +1393,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -1467,28 +1421,25 @@ public partial class NameComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The actual name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1499,13 +1450,13 @@ public string Name [FhirElement("type", InSummary=true, Order=50)] [Binding("SubstanceNameType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The status of the name e.g. 'current', 'proposed'. @@ -1513,26 +1464,26 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("status", InSummary=true, Order=60)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// If this is the preferred name for this substance. /// [FhirElement("preferred", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PreferredElement + public Hl7.Fhir.Model.FhirBoolean? PreferredElement { get { return _PreferredElement; } set { _PreferredElement = value; OnPropertyChanged("PreferredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PreferredElement; + private Hl7.Fhir.Model.FhirBoolean? _PreferredElement; /// /// If this is the preferred name for this substance @@ -1541,13 +1492,10 @@ public Hl7.Fhir.Model.FhirBoolean PreferredElement [IgnoreDataMember] public bool? Preferred { - get { return PreferredElement != null ? PreferredElement.Value : null; } + get => _PreferredElement?.Value; set { - if (value == null) - PreferredElement = null; - else - PreferredElement = new Hl7.Fhir.Model.FhirBoolean(value); + PreferredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Preferred"); } } @@ -1561,11 +1509,11 @@ public bool? Preferred [DataMember] public List Language { - get { if(_Language==null) _Language = new List(); return _Language; } + get => _Language ?? new List(); set { _Language = value; OnPropertyChanged("Language"); } } - private List _Language; + private List? _Language; /// /// The use context of this name e.g. as an active ingredient or as a food colour additive. @@ -1576,11 +1524,11 @@ public List Language [DataMember] public List Domain { - get { if(_Domain==null) _Domain = new List(); return _Domain; } + get => _Domain ?? new List(); set { _Domain = value; OnPropertyChanged("Domain"); } } - private List _Domain; + private List? _Domain; /// /// The jurisdiction where this name applies. @@ -1591,11 +1539,11 @@ public List Domain [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// A synonym of this particular name, by which the substance is also known. @@ -1605,11 +1553,11 @@ public List Jurisdiction [DataMember] public List Synonym { - get { if(_Synonym==null) _Synonym = new List(); return _Synonym; } + get => _Synonym ?? new List(); set { _Synonym = value; OnPropertyChanged("Synonym"); } } - private List _Synonym; + private List? _Synonym; /// /// A translation for this name into another human language. @@ -1619,11 +1567,11 @@ public List Synonym [DataMember] public List Translation { - get { if(_Translation==null) _Translation = new List(); return _Translation; } + get => _Translation ?? new List(); set { _Translation = value; OnPropertyChanged("Translation"); } } - private List _Translation; + private List? _Translation; /// /// Details of the official nature of this name. @@ -1633,11 +1581,11 @@ public List Translation [DataMember] public List Official { - get { if(_Official==null) _Official = new List(); return _Official; } + get => _Official ?? new List(); set { _Official = value; OnPropertyChanged("Official"); } } - private List _Official; + private List? _Official; /// /// Supporting literature. @@ -1649,33 +1597,29 @@ public List Official [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as NameComponent; - - if (dest == null) - { + if(other is not NameComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(PreferredElement != null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)PreferredElement.DeepCopyInternal(); - if(Language.Any()) dest.Language = new List(Language.DeepCopyInternal()); - if(Domain.Any()) dest.Domain = new List(Domain.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(Synonym.Any()) dest.Synonym = new List(Synonym.DeepCopyInternal()); - if(Translation.Any()) dest.Translation = new List(Translation.DeepCopyInternal()); - if(Official.Any()) dest.Official = new List(Official.DeepCopyInternal()); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_PreferredElement is not null) dest.PreferredElement = (Hl7.Fhir.Model.FhirBoolean)_PreferredElement.DeepCopyInternal(); + if(_Language is not null) dest.Language = new List(_Language.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = new List(_Domain.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_Synonym is not null) dest.Synonym = new List(_Synonym.DeepCopyInternal()); + if(_Translation is not null) dest.Translation = new List(_Translation.DeepCopyInternal()); + if(_Official is not null) dest.Official = new List(_Official.DeepCopyInternal()); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1687,104 +1631,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as NameComponent; - if(otherT == null) return false; + if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(PreferredElement, otherT.PreferredElement)) return false; - if(!comparer.ListEquals(Language, otherT.Language)) return false; - if(!comparer.ListEquals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.ListEquals(Synonym, otherT.Synonym)) return false; - if(!comparer.ListEquals(Translation, otherT.Translation)) return false; - if(!comparer.ListEquals(Official, otherT.Official)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; + if(!comparer.ListEquals(_Language, otherT._Language)) return false; + if(!comparer.ListEquals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.ListEquals(_Synonym, otherT._Synonym)) return false; + if(!comparer.ListEquals(_Translation, otherT._Translation)) return false; + if(!comparer.ListEquals(_Official, otherT._Official)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "preferred": - value = PreferredElement; - return PreferredElement is not null; + value = _PreferredElement; + return _PreferredElement is not null; case "language": - value = Language; - return Language?.Any() == true; + value = _Language; + return _Language?.Any() == true; case "domain": - value = Domain; - return Domain?.Any() == true; + value = _Domain; + return _Domain?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "synonym": - value = Synonym; - return Synonym?.Any() == true; + value = _Synonym; + return _Synonym?.Any() == true; case "translation": - value = Translation; - return Translation?.Any() == true; + value = _Translation; + return _Translation?.Any() == true; case "official": - value = Official; - return Official?.Any() == true; + value = _Official; + return _Official?.Any() == true; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "preferred": - PreferredElement = (Hl7.Fhir.Model.FhirBoolean)value; + PreferredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "language": - Language = (List)value; + Language = (List?)value!; return this; case "domain": - Domain = (List)value; + Domain = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "synonym": - Synonym = (List)value; + Synonym = (List?)value!; return this; case "translation": - Translation = (List)value; + Translation = (List?)value!; return this; case "official": - Official = (List)value; + Official = (List?)value!; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1795,17 +1739,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (PreferredElement is not null) yield return new KeyValuePair("preferred",PreferredElement); - if (Language?.Any() == true) yield return new KeyValuePair("language",Language); - if (Domain?.Any() == true) yield return new KeyValuePair("domain",Domain); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (Synonym?.Any() == true) yield return new KeyValuePair("synonym",Synonym); - if (Translation?.Any() == true) yield return new KeyValuePair("translation",Translation); - if (Official?.Any() == true) yield return new KeyValuePair("official",Official); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_PreferredElement is not null) yield return new KeyValuePair("preferred",_PreferredElement); + if (_Language?.Any() == true) yield return new KeyValuePair("language",_Language); + if (_Domain?.Any() == true) yield return new KeyValuePair("domain",_Domain); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_Synonym?.Any() == true) yield return new KeyValuePair("synonym",_Synonym); + if (_Translation?.Any() == true) yield return new KeyValuePair("translation",_Translation); + if (_Official?.Any() == true) yield return new KeyValuePair("official",_Official); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -1829,13 +1773,13 @@ public partial class OfficialComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("authority", InSummary=true, Order=40)] [Binding("SubstanceNameAuthority")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Authority + public Hl7.Fhir.Model.CodeableConcept? Authority { get { return _Authority; } set { _Authority = value; OnPropertyChanged("Authority"); } } - private Hl7.Fhir.Model.CodeableConcept _Authority; + private Hl7.Fhir.Model.CodeableConcept? _Authority; /// /// The status of the official name, for example 'draft', 'active'. @@ -1843,58 +1787,51 @@ public Hl7.Fhir.Model.CodeableConcept Authority [FhirElement("status", InSummary=true, Order=50)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// Date of official name change. /// [FhirElement("date", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date of official name change /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OfficialComponent; - - if (dest == null) - { + if(other is not OfficialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Authority != null) dest.Authority = (Hl7.Fhir.Model.CodeableConcept)Authority.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); + if(_Authority is not null) dest.Authority = (Hl7.Fhir.Model.CodeableConcept)_Authority.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1906,48 +1843,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OfficialComponent; - if(otherT == null) return false; + if(other is not OfficialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Authority, otherT.Authority)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Authority, otherT._Authority)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authority": - value = Authority; - return Authority is not null; + value = _Authority; + return _Authority is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authority": - Authority = (Hl7.Fhir.Model.CodeableConcept)value; + Authority = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; default: return base.SetValue(key, value); @@ -1958,9 +1895,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Authority is not null) yield return new KeyValuePair("authority",Authority); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); + if (_Authority is not null) yield return new KeyValuePair("authority",_Authority); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); } } @@ -1989,13 +1926,13 @@ public partial class RelationshipComponent : Hl7.Fhir.Model.BackboneElement [References("SubstanceDefinition")] [AllowedTypes(typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.CodeableConcept))] [DataMember] - public Hl7.Fhir.Model.DataType SubstanceDefinition + public Hl7.Fhir.Model.DataType? SubstanceDefinition { get { return _SubstanceDefinition; } set { _SubstanceDefinition = value; OnPropertyChanged("SubstanceDefinition"); } } - private Hl7.Fhir.Model.DataType _SubstanceDefinition; + private Hl7.Fhir.Model.DataType? _SubstanceDefinition; /// /// For example "salt to parent", "active moiety". @@ -2004,26 +1941,26 @@ public Hl7.Fhir.Model.DataType SubstanceDefinition [Binding("SubstanceRelationshipType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible relationships. /// [FhirElement("isDefining", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefiningElement + public Hl7.Fhir.Model.FhirBoolean? IsDefiningElement { get { return _IsDefiningElement; } set { _IsDefiningElement = value; OnPropertyChanged("IsDefiningElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefiningElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefiningElement; /// /// For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible relationships @@ -2032,13 +1969,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefiningElement [IgnoreDataMember] public bool? IsDefining { - get { return IsDefiningElement != null ? IsDefiningElement.Value : null; } + get => _IsDefiningElement?.Value; set { - if (value == null) - IsDefiningElement = null; - else - IsDefiningElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefiningElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefining"); } } @@ -2050,26 +1984,26 @@ public bool? IsDefining [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// For use when the numeric has an uncertain range. /// [FhirElement("ratioHighLimitAmount", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Ratio RatioHighLimitAmount + public Hl7.Fhir.Model.Ratio? RatioHighLimitAmount { get { return _RatioHighLimitAmount; } set { _RatioHighLimitAmount = value; OnPropertyChanged("RatioHighLimitAmount"); } } - private Hl7.Fhir.Model.Ratio _RatioHighLimitAmount; + private Hl7.Fhir.Model.Ratio? _RatioHighLimitAmount; /// /// An operator for the amount, for example "average", "approximately", "less than". @@ -2077,13 +2011,13 @@ public Hl7.Fhir.Model.Ratio RatioHighLimitAmount [FhirElement("comparator", InSummary=true, Order=90)] [Binding("SubstanceAmountType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Comparator + public Hl7.Fhir.Model.CodeableConcept? Comparator { get { return _Comparator; } set { _Comparator = value; OnPropertyChanged("Comparator"); } } - private Hl7.Fhir.Model.CodeableConcept _Comparator; + private Hl7.Fhir.Model.CodeableConcept? _Comparator; /// /// Supporting literature. @@ -2095,29 +2029,25 @@ public Hl7.Fhir.Model.CodeableConcept Comparator [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as RelationshipComponent; - - if (dest == null) - { + if(other is not RelationshipComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubstanceDefinition != null) dest.SubstanceDefinition = (Hl7.Fhir.Model.DataType)SubstanceDefinition.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(IsDefiningElement != null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)IsDefiningElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(RatioHighLimitAmount != null) dest.RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio)RatioHighLimitAmount.DeepCopyInternal(); - if(Comparator != null) dest.Comparator = (Hl7.Fhir.Model.CodeableConcept)Comparator.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_SubstanceDefinition is not null) dest.SubstanceDefinition = (Hl7.Fhir.Model.DataType)_SubstanceDefinition.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_IsDefiningElement is not null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefiningElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_RatioHighLimitAmount is not null) dest.RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio)_RatioHighLimitAmount.DeepCopyInternal(); + if(_Comparator is not null) dest.Comparator = (Hl7.Fhir.Model.CodeableConcept)_Comparator.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2129,76 +2059,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RelationshipComponent; - if(otherT == null) return false; + if(other is not RelationshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubstanceDefinition, otherT.SubstanceDefinition)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(IsDefiningElement, otherT.IsDefiningElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(RatioHighLimitAmount, otherT.RatioHighLimitAmount)) return false; - if(!comparer.Equals(Comparator, otherT.Comparator)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubstanceDefinition, otherT._SubstanceDefinition)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_RatioHighLimitAmount, otherT._RatioHighLimitAmount)) return false; + if(!comparer.Equals(_Comparator, otherT._Comparator)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "substanceDefinition": - value = SubstanceDefinition; - return SubstanceDefinition is not null; + value = _SubstanceDefinition; + return _SubstanceDefinition is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "isDefining": - value = IsDefiningElement; - return IsDefiningElement is not null; + value = _IsDefiningElement; + return _IsDefiningElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "ratioHighLimitAmount": - value = RatioHighLimitAmount; - return RatioHighLimitAmount is not null; + value = _RatioHighLimitAmount; + return _RatioHighLimitAmount is not null; case "comparator": - value = Comparator; - return Comparator is not null; + value = _Comparator; + return _Comparator is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "substanceDefinition": - SubstanceDefinition = (Hl7.Fhir.Model.DataType)value; + SubstanceDefinition = (Hl7.Fhir.Model.DataType?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "isDefining": - IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "ratioHighLimitAmount": - RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio)value; + RatioHighLimitAmount = (Hl7.Fhir.Model.Ratio?)value; return this; case "comparator": - Comparator = (Hl7.Fhir.Model.CodeableConcept)value; + Comparator = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2209,13 +2139,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubstanceDefinition is not null) yield return new KeyValuePair("substanceDefinition",SubstanceDefinition); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (IsDefiningElement is not null) yield return new KeyValuePair("isDefining",IsDefiningElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (RatioHighLimitAmount is not null) yield return new KeyValuePair("ratioHighLimitAmount",RatioHighLimitAmount); - if (Comparator is not null) yield return new KeyValuePair("comparator",Comparator); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_SubstanceDefinition is not null) yield return new KeyValuePair("substanceDefinition",_SubstanceDefinition); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_IsDefiningElement is not null) yield return new KeyValuePair("isDefining",_IsDefiningElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_RatioHighLimitAmount is not null) yield return new KeyValuePair("ratioHighLimitAmount",_RatioHighLimitAmount); + if (_Comparator is not null) yield return new KeyValuePair("comparator",_Comparator); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -2242,13 +2172,13 @@ public partial class SourceMaterialComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", InSummary=true, Order=40)] [Binding("SourceMaterialType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The genus of an organism e.g. the Latin epithet of the plant/animal scientific name. @@ -2256,13 +2186,13 @@ public Hl7.Fhir.Model.CodeableConcept Type [FhirElement("genus", InSummary=true, Order=50)] [Binding("SourceMaterialGenus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Genus + public Hl7.Fhir.Model.CodeableConcept? Genus { get { return _Genus; } set { _Genus = value; OnPropertyChanged("Genus"); } } - private Hl7.Fhir.Model.CodeableConcept _Genus; + private Hl7.Fhir.Model.CodeableConcept? _Genus; /// /// The species of an organism e.g. the Latin epithet of the species of the plant/animal. @@ -2270,13 +2200,13 @@ public Hl7.Fhir.Model.CodeableConcept Genus [FhirElement("species", InSummary=true, Order=60)] [Binding("SourceMaterialSpecies")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Species + public Hl7.Fhir.Model.CodeableConcept? Species { get { return _Species; } set { _Species = value; OnPropertyChanged("Species"); } } - private Hl7.Fhir.Model.CodeableConcept _Species; + private Hl7.Fhir.Model.CodeableConcept? _Species; /// /// An anatomical origin of the source material within an organism. @@ -2284,13 +2214,13 @@ public Hl7.Fhir.Model.CodeableConcept Species [FhirElement("part", InSummary=true, Order=70)] [Binding("SourceMaterialPart")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Part + public Hl7.Fhir.Model.CodeableConcept? Part { get { return _Part; } set { _Part = value; OnPropertyChanged("Part"); } } - private Hl7.Fhir.Model.CodeableConcept _Part; + private Hl7.Fhir.Model.CodeableConcept? _Part; /// /// The country or countries where the material is harvested. @@ -2301,27 +2231,23 @@ public Hl7.Fhir.Model.CodeableConcept Part [DataMember] public List CountryOfOrigin { - get { if(_CountryOfOrigin==null) _CountryOfOrigin = new List(); return _CountryOfOrigin; } + get => _CountryOfOrigin ?? new List(); set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } - private List _CountryOfOrigin; + private List? _CountryOfOrigin; protected internal override void CopyToInternal(Base other) { - var dest = other as SourceMaterialComponent; - - if (dest == null) - { + if(other is not SourceMaterialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Genus != null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)Genus.DeepCopyInternal(); - if(Species != null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)Species.DeepCopyInternal(); - if(Part != null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)Part.DeepCopyInternal(); - if(CountryOfOrigin.Any()) dest.CountryOfOrigin = new List(CountryOfOrigin.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Genus is not null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)_Genus.DeepCopyInternal(); + if(_Species is not null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)_Species.DeepCopyInternal(); + if(_Part is not null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)_Part.DeepCopyInternal(); + if(_CountryOfOrigin is not null) dest.CountryOfOrigin = new List(_CountryOfOrigin.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2333,62 +2259,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SourceMaterialComponent; - if(otherT == null) return false; + if(other is not SourceMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Genus, otherT.Genus)) return false; - if(!comparer.Equals(Species, otherT.Species)) return false; - if(!comparer.Equals(Part, otherT.Part)) return false; - if(!comparer.ListEquals(CountryOfOrigin, otherT.CountryOfOrigin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Genus, otherT._Genus)) return false; + if(!comparer.Equals(_Species, otherT._Species)) return false; + if(!comparer.Equals(_Part, otherT._Part)) return false; + if(!comparer.ListEquals(_CountryOfOrigin, otherT._CountryOfOrigin)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "genus": - value = Genus; - return Genus is not null; + value = _Genus; + return _Genus is not null; case "species": - value = Species; - return Species is not null; + value = _Species; + return _Species is not null; case "part": - value = Part; - return Part is not null; + value = _Part; + return _Part is not null; case "countryOfOrigin": - value = CountryOfOrigin; - return CountryOfOrigin?.Any() == true; + value = _CountryOfOrigin; + return _CountryOfOrigin?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genus": - Genus = (Hl7.Fhir.Model.CodeableConcept)value; + Genus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "species": - Species = (Hl7.Fhir.Model.CodeableConcept)value; + Species = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "part": - Part = (Hl7.Fhir.Model.CodeableConcept)value; + Part = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "countryOfOrigin": - CountryOfOrigin = (List)value; + CountryOfOrigin = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2399,11 +2325,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Genus is not null) yield return new KeyValuePair("genus",Genus); - if (Species is not null) yield return new KeyValuePair("species",Species); - if (Part is not null) yield return new KeyValuePair("part",Part); - if (CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",CountryOfOrigin); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Genus is not null) yield return new KeyValuePair("genus",_Genus); + if (_Species is not null) yield return new KeyValuePair("species",_Species); + if (_Part is not null) yield return new KeyValuePair("part",_Part); + if (_CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",_CountryOfOrigin); } } @@ -2416,39 +2342,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// A business level version identifier of the substance. /// [FhirElement("version", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// A business level version identifier of the substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -2459,13 +2382,13 @@ public string Version [FhirElement("status", InSummary=true, Order=110)] [Binding("PublicationStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Status + public Hl7.Fhir.Model.CodeableConcept? Status { get { return _Status; } set { _Status = value; OnPropertyChanged("Status"); } } - private Hl7.Fhir.Model.CodeableConcept _Status; + private Hl7.Fhir.Model.CodeableConcept? _Status; /// /// A categorization, high level e.g. polymer or nucleic acid, or food, chemical, biological, or lower e.g. polymer linear or branch chain, or type of impurity. @@ -2475,11 +2398,11 @@ public Hl7.Fhir.Model.CodeableConcept Status [DataMember] public List Classification { - get { if(_Classification==null) _Classification = new List(); return _Classification; } + get => _Classification ?? new List(); set { _Classification = value; OnPropertyChanged("Classification"); } } - private List _Classification; + private List? _Classification; /// /// If the substance applies to human or veterinary use. @@ -2487,13 +2410,13 @@ public List Classification [FhirElement("domain", InSummary=true, Order=130)] [Binding("MedicinalProductType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Domain + public Hl7.Fhir.Model.CodeableConcept? Domain { get { return _Domain; } set { _Domain = value; OnPropertyChanged("Domain"); } } - private Hl7.Fhir.Model.CodeableConcept _Domain; + private Hl7.Fhir.Model.CodeableConcept? _Domain; /// /// The quality standard, established benchmark, to which substance complies (e.g. USP/NF, BP). @@ -2504,39 +2427,36 @@ public Hl7.Fhir.Model.CodeableConcept Domain [DataMember] public List Grade { - get { if(_Grade==null) _Grade = new List(); return _Grade; } + get => _Grade ?? new List(); set { _Grade = value; OnPropertyChanged("Grade"); } } - private List _Grade; + private List? _Grade; /// /// Textual description of the substance. /// [FhirElement("description", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Textual description of the substance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2551,11 +2471,11 @@ public string Description [DataMember] public List InformationSource { - get { if(_InformationSource==null) _InformationSource = new List(); return _InformationSource; } + get => _InformationSource ?? new List(); set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } - private List _InformationSource; + private List? _InformationSource; /// /// Textual comment about the substance's catalogue or registry record. @@ -2565,11 +2485,11 @@ public List InformationSource [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// The entity that creates, makes, produces or fabricates the substance. @@ -2581,11 +2501,11 @@ public List Note [DataMember] public List Manufacturer { - get { if(_Manufacturer==null) _Manufacturer = new List(); return _Manufacturer; } + get => _Manufacturer ?? new List(); set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } - private List _Manufacturer; + private List? _Manufacturer; /// /// An entity that is the source for the substance. It may be different from the manufacturer. @@ -2597,11 +2517,11 @@ public List Manufacturer [DataMember] public List Supplier { - get { if(_Supplier==null) _Supplier = new List(); return _Supplier; } + get => _Supplier ?? new List(); set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private List _Supplier; + private List? _Supplier; /// /// Moiety, for structural modifications. @@ -2611,11 +2531,11 @@ public List Supplier [DataMember] public List Moiety { - get { if(_Moiety==null) _Moiety = new List(); return _Moiety; } + get => _Moiety ?? new List(); set { _Moiety = value; OnPropertyChanged("Moiety"); } } - private List _Moiety; + private List? _Moiety; /// /// General specifications for this substance. @@ -2625,11 +2545,11 @@ public List Moiety [DataMember] public List Characterization { - get { if(_Characterization==null) _Characterization = new List(); return _Characterization; } + get => _Characterization ?? new List(); set { _Characterization = value; OnPropertyChanged("Characterization"); } } - private List _Characterization; + private List? _Characterization; /// /// General specifications for this substance. @@ -2639,11 +2559,11 @@ public List Charac [DataMember] public List Property { - get { if(_Property==null) _Property = new List(); return _Property; } + get => _Property ?? new List(); set { _Property = value; OnPropertyChanged("Property"); } } - private List _Property; + private List? _Property; /// /// General information detailing this substance. @@ -2652,13 +2572,13 @@ public List Property [CLSCompliant(false)] [References("SubstanceReferenceInformation")] [DataMember] - public Hl7.Fhir.Model.ResourceReference ReferenceInformation + public Hl7.Fhir.Model.ResourceReference? ReferenceInformation { get { return _ReferenceInformation; } set { _ReferenceInformation = value; OnPropertyChanged("ReferenceInformation"); } } - private Hl7.Fhir.Model.ResourceReference _ReferenceInformation; + private Hl7.Fhir.Model.ResourceReference? _ReferenceInformation; /// /// The average mass of a molecule of a compound. @@ -2668,24 +2588,24 @@ public Hl7.Fhir.Model.ResourceReference ReferenceInformation [DataMember] public List MolecularWeight { - get { if(_MolecularWeight==null) _MolecularWeight = new List(); return _MolecularWeight; } + get => _MolecularWeight ?? new List(); set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } - private List _MolecularWeight; + private List? _MolecularWeight; /// /// Structural information. /// [FhirElement("structure", InSummary=true, Order=250)] [DataMember] - public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent Structure + public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent? Structure { get { return _Structure; } set { _Structure = value; OnPropertyChanged("Structure"); } } - private Hl7.Fhir.Model.SubstanceDefinition.StructureComponent _Structure; + private Hl7.Fhir.Model.SubstanceDefinition.StructureComponent? _Structure; /// /// Codes associated with the substance. @@ -2695,11 +2615,11 @@ public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent Structure [DataMember] public List Code { - get { if(_Code==null) _Code = new List(); return _Code; } + get => _Code ?? new List(); set { _Code = value; OnPropertyChanged("Code"); } } - private List _Code; + private List? _Code; /// /// Names applicable to this substance. @@ -2709,11 +2629,11 @@ public List Code [DataMember] public List Name { - get { if(_Name==null) _Name = new List(); return _Name; } + get => _Name ?? new List(); set { _Name = value; OnPropertyChanged("Name"); } } - private List _Name; + private List? _Name; /// /// A link between this substance and another. @@ -2723,11 +2643,11 @@ public List Name [DataMember] public List Relationship { - get { if(_Relationship==null) _Relationship = new List(); return _Relationship; } + get => _Relationship ?? new List(); set { _Relationship = value; OnPropertyChanged("Relationship"); } } - private List _Relationship; + private List? _Relationship; /// /// Data items specific to nucleic acids. @@ -2736,13 +2656,13 @@ public List Relationsh [CLSCompliant(false)] [References("SubstanceNucleicAcid")] [DataMember] - public Hl7.Fhir.Model.ResourceReference NucleicAcid + public Hl7.Fhir.Model.ResourceReference? NucleicAcid { get { return _NucleicAcid; } set { _NucleicAcid = value; OnPropertyChanged("NucleicAcid"); } } - private Hl7.Fhir.Model.ResourceReference _NucleicAcid; + private Hl7.Fhir.Model.ResourceReference? _NucleicAcid; /// /// Data items specific to polymers. @@ -2751,13 +2671,13 @@ public Hl7.Fhir.Model.ResourceReference NucleicAcid [CLSCompliant(false)] [References("SubstancePolymer")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Polymer + public Hl7.Fhir.Model.ResourceReference? Polymer { get { return _Polymer; } set { _Polymer = value; OnPropertyChanged("Polymer"); } } - private Hl7.Fhir.Model.ResourceReference _Polymer; + private Hl7.Fhir.Model.ResourceReference? _Polymer; /// /// Data items specific to proteins. @@ -2766,63 +2686,59 @@ public Hl7.Fhir.Model.ResourceReference Polymer [CLSCompliant(false)] [References("SubstanceProtein")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Protein + public Hl7.Fhir.Model.ResourceReference? Protein { get { return _Protein; } set { _Protein = value; OnPropertyChanged("Protein"); } } - private Hl7.Fhir.Model.ResourceReference _Protein; + private Hl7.Fhir.Model.ResourceReference? _Protein; /// /// Material or taxonomic/anatomical source. /// [FhirElement("sourceMaterial", InSummary=true, Order=320)] [DataMember] - public Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent SourceMaterial + public Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent? SourceMaterial { get { return _SourceMaterial; } set { _SourceMaterial = value; OnPropertyChanged("SourceMaterial"); } } - private Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent _SourceMaterial; + private Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent? _SourceMaterial; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceDefinition; - - if (dest == null) - { + if(other is not SubstanceDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(Status != null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)Status.DeepCopyInternal(); - if(Classification.Any()) dest.Classification = new List(Classification.DeepCopyInternal()); - if(Domain != null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)Domain.DeepCopyInternal(); - if(Grade.Any()) dest.Grade = new List(Grade.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(InformationSource.Any()) dest.InformationSource = new List(InformationSource.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(Manufacturer.Any()) dest.Manufacturer = new List(Manufacturer.DeepCopyInternal()); - if(Supplier.Any()) dest.Supplier = new List(Supplier.DeepCopyInternal()); - if(Moiety.Any()) dest.Moiety = new List(Moiety.DeepCopyInternal()); - if(Characterization.Any()) dest.Characterization = new List(Characterization.DeepCopyInternal()); - if(Property.Any()) dest.Property = new List(Property.DeepCopyInternal()); - if(ReferenceInformation != null) dest.ReferenceInformation = (Hl7.Fhir.Model.ResourceReference)ReferenceInformation.DeepCopyInternal(); - if(MolecularWeight.Any()) dest.MolecularWeight = new List(MolecularWeight.DeepCopyInternal()); - if(Structure != null) dest.Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent)Structure.DeepCopyInternal(); - if(Code.Any()) dest.Code = new List(Code.DeepCopyInternal()); - if(Name.Any()) dest.Name = new List(Name.DeepCopyInternal()); - if(Relationship.Any()) dest.Relationship = new List(Relationship.DeepCopyInternal()); - if(NucleicAcid != null) dest.NucleicAcid = (Hl7.Fhir.Model.ResourceReference)NucleicAcid.DeepCopyInternal(); - if(Polymer != null) dest.Polymer = (Hl7.Fhir.Model.ResourceReference)Polymer.DeepCopyInternal(); - if(Protein != null) dest.Protein = (Hl7.Fhir.Model.ResourceReference)Protein.DeepCopyInternal(); - if(SourceMaterial != null) dest.SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent)SourceMaterial.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_Status is not null) dest.Status = (Hl7.Fhir.Model.CodeableConcept)_Status.DeepCopyInternal(); + if(_Classification is not null) dest.Classification = new List(_Classification.DeepCopyInternal()); + if(_Domain is not null) dest.Domain = (Hl7.Fhir.Model.CodeableConcept)_Domain.DeepCopyInternal(); + if(_Grade is not null) dest.Grade = new List(_Grade.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_InformationSource is not null) dest.InformationSource = new List(_InformationSource.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_Manufacturer is not null) dest.Manufacturer = new List(_Manufacturer.DeepCopyInternal()); + if(_Supplier is not null) dest.Supplier = new List(_Supplier.DeepCopyInternal()); + if(_Moiety is not null) dest.Moiety = new List(_Moiety.DeepCopyInternal()); + if(_Characterization is not null) dest.Characterization = new List(_Characterization.DeepCopyInternal()); + if(_Property is not null) dest.Property = new List(_Property.DeepCopyInternal()); + if(_ReferenceInformation is not null) dest.ReferenceInformation = (Hl7.Fhir.Model.ResourceReference)_ReferenceInformation.DeepCopyInternal(); + if(_MolecularWeight is not null) dest.MolecularWeight = new List(_MolecularWeight.DeepCopyInternal()); + if(_Structure is not null) dest.Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent)_Structure.DeepCopyInternal(); + if(_Code is not null) dest.Code = new List(_Code.DeepCopyInternal()); + if(_Name is not null) dest.Name = new List(_Name.DeepCopyInternal()); + if(_Relationship is not null) dest.Relationship = new List(_Relationship.DeepCopyInternal()); + if(_NucleicAcid is not null) dest.NucleicAcid = (Hl7.Fhir.Model.ResourceReference)_NucleicAcid.DeepCopyInternal(); + if(_Polymer is not null) dest.Polymer = (Hl7.Fhir.Model.ResourceReference)_Polymer.DeepCopyInternal(); + if(_Protein is not null) dest.Protein = (Hl7.Fhir.Model.ResourceReference)_Protein.DeepCopyInternal(); + if(_SourceMaterial is not null) dest.SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent)_SourceMaterial.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2834,195 +2750,195 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceDefinition; - if(otherT == null) return false; + if(other is not SubstanceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(Status, otherT.Status)) return false; - if(!comparer.ListEquals(Classification, otherT.Classification)) return false; - if(!comparer.Equals(Domain, otherT.Domain)) return false; - if(!comparer.ListEquals(Grade, otherT.Grade)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(InformationSource, otherT.InformationSource)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(Manufacturer, otherT.Manufacturer)) return false; - if(!comparer.ListEquals(Supplier, otherT.Supplier)) return false; - if(!comparer.ListEquals(Moiety, otherT.Moiety)) return false; - if(!comparer.ListEquals(Characterization, otherT.Characterization)) return false; - if(!comparer.ListEquals(Property, otherT.Property)) return false; - if(!comparer.Equals(ReferenceInformation, otherT.ReferenceInformation)) return false; - if(!comparer.ListEquals(MolecularWeight, otherT.MolecularWeight)) return false; - if(!comparer.Equals(Structure, otherT.Structure)) return false; - if(!comparer.ListEquals(Code, otherT.Code)) return false; - if(!comparer.ListEquals(Name, otherT.Name)) return false; - if(!comparer.ListEquals(Relationship, otherT.Relationship)) return false; - if(!comparer.Equals(NucleicAcid, otherT.NucleicAcid)) return false; - if(!comparer.Equals(Polymer, otherT.Polymer)) return false; - if(!comparer.Equals(Protein, otherT.Protein)) return false; - if(!comparer.Equals(SourceMaterial, otherT.SourceMaterial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_Status, otherT._Status)) return false; + if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; + if(!comparer.Equals(_Domain, otherT._Domain)) return false; + if(!comparer.ListEquals(_Grade, otherT._Grade)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_InformationSource, otherT._InformationSource)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; + if(!comparer.ListEquals(_Supplier, otherT._Supplier)) return false; + if(!comparer.ListEquals(_Moiety, otherT._Moiety)) return false; + if(!comparer.ListEquals(_Characterization, otherT._Characterization)) return false; + if(!comparer.ListEquals(_Property, otherT._Property)) return false; + if(!comparer.Equals(_ReferenceInformation, otherT._ReferenceInformation)) return false; + if(!comparer.ListEquals(_MolecularWeight, otherT._MolecularWeight)) return false; + if(!comparer.Equals(_Structure, otherT._Structure)) return false; + if(!comparer.ListEquals(_Code, otherT._Code)) return false; + if(!comparer.ListEquals(_Name, otherT._Name)) return false; + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + if(!comparer.Equals(_NucleicAcid, otherT._NucleicAcid)) return false; + if(!comparer.Equals(_Polymer, otherT._Polymer)) return false; + if(!comparer.Equals(_Protein, otherT._Protein)) return false; + if(!comparer.Equals(_SourceMaterial, otherT._SourceMaterial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "status": - value = Status; - return Status is not null; + value = _Status; + return _Status is not null; case "classification": - value = Classification; - return Classification?.Any() == true; + value = _Classification; + return _Classification?.Any() == true; case "domain": - value = Domain; - return Domain is not null; + value = _Domain; + return _Domain is not null; case "grade": - value = Grade; - return Grade?.Any() == true; + value = _Grade; + return _Grade?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "informationSource": - value = InformationSource; - return InformationSource?.Any() == true; + value = _InformationSource; + return _InformationSource?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "manufacturer": - value = Manufacturer; - return Manufacturer?.Any() == true; + value = _Manufacturer; + return _Manufacturer?.Any() == true; case "supplier": - value = Supplier; - return Supplier?.Any() == true; + value = _Supplier; + return _Supplier?.Any() == true; case "moiety": - value = Moiety; - return Moiety?.Any() == true; + value = _Moiety; + return _Moiety?.Any() == true; case "characterization": - value = Characterization; - return Characterization?.Any() == true; + value = _Characterization; + return _Characterization?.Any() == true; case "property": - value = Property; - return Property?.Any() == true; + value = _Property; + return _Property?.Any() == true; case "referenceInformation": - value = ReferenceInformation; - return ReferenceInformation is not null; + value = _ReferenceInformation; + return _ReferenceInformation is not null; case "molecularWeight": - value = MolecularWeight; - return MolecularWeight?.Any() == true; + value = _MolecularWeight; + return _MolecularWeight?.Any() == true; case "structure": - value = Structure; - return Structure is not null; + value = _Structure; + return _Structure is not null; case "code": - value = Code; - return Code?.Any() == true; + value = _Code; + return _Code?.Any() == true; case "name": - value = Name; - return Name?.Any() == true; + value = _Name; + return _Name?.Any() == true; case "relationship": - value = Relationship; - return Relationship?.Any() == true; + value = _Relationship; + return _Relationship?.Any() == true; case "nucleicAcid": - value = NucleicAcid; - return NucleicAcid is not null; + value = _NucleicAcid; + return _NucleicAcid is not null; case "polymer": - value = Polymer; - return Polymer is not null; + value = _Polymer; + return _Polymer is not null; case "protein": - value = Protein; - return Protein is not null; + value = _Protein; + return _Protein is not null; case "sourceMaterial": - value = SourceMaterial; - return SourceMaterial is not null; + value = _SourceMaterial; + return _SourceMaterial is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - Status = (Hl7.Fhir.Model.CodeableConcept)value; + Status = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "classification": - Classification = (List)value; + Classification = (List?)value!; return this; case "domain": - Domain = (Hl7.Fhir.Model.CodeableConcept)value; + Domain = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "grade": - Grade = (List)value; + Grade = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "informationSource": - InformationSource = (List)value; + InformationSource = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "manufacturer": - Manufacturer = (List)value; + Manufacturer = (List?)value!; return this; case "supplier": - Supplier = (List)value; + Supplier = (List?)value!; return this; case "moiety": - Moiety = (List)value; + Moiety = (List?)value!; return this; case "characterization": - Characterization = (List)value; + Characterization = (List?)value!; return this; case "property": - Property = (List)value; + Property = (List?)value!; return this; case "referenceInformation": - ReferenceInformation = (Hl7.Fhir.Model.ResourceReference)value; + ReferenceInformation = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "molecularWeight": - MolecularWeight = (List)value; + MolecularWeight = (List?)value!; return this; case "structure": - Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent)value; + Structure = (Hl7.Fhir.Model.SubstanceDefinition.StructureComponent?)value; return this; case "code": - Code = (List)value; + Code = (List?)value!; return this; case "name": - Name = (List)value; + Name = (List?)value!; return this; case "relationship": - Relationship = (List)value; + Relationship = (List?)value!; return this; case "nucleicAcid": - NucleicAcid = (Hl7.Fhir.Model.ResourceReference)value; + NucleicAcid = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "polymer": - Polymer = (Hl7.Fhir.Model.ResourceReference)value; + Polymer = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "protein": - Protein = (Hl7.Fhir.Model.ResourceReference)value; + Protein = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "sourceMaterial": - SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent)value; + SourceMaterial = (Hl7.Fhir.Model.SubstanceDefinition.SourceMaterialComponent?)value; return this; default: return base.SetValue(key, value); @@ -3033,30 +2949,30 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (Status is not null) yield return new KeyValuePair("status",Status); - if (Classification?.Any() == true) yield return new KeyValuePair("classification",Classification); - if (Domain is not null) yield return new KeyValuePair("domain",Domain); - if (Grade?.Any() == true) yield return new KeyValuePair("grade",Grade); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",InformationSource); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",Manufacturer); - if (Supplier?.Any() == true) yield return new KeyValuePair("supplier",Supplier); - if (Moiety?.Any() == true) yield return new KeyValuePair("moiety",Moiety); - if (Characterization?.Any() == true) yield return new KeyValuePair("characterization",Characterization); - if (Property?.Any() == true) yield return new KeyValuePair("property",Property); - if (ReferenceInformation is not null) yield return new KeyValuePair("referenceInformation",ReferenceInformation); - if (MolecularWeight?.Any() == true) yield return new KeyValuePair("molecularWeight",MolecularWeight); - if (Structure is not null) yield return new KeyValuePair("structure",Structure); - if (Code?.Any() == true) yield return new KeyValuePair("code",Code); - if (Name?.Any() == true) yield return new KeyValuePair("name",Name); - if (Relationship?.Any() == true) yield return new KeyValuePair("relationship",Relationship); - if (NucleicAcid is not null) yield return new KeyValuePair("nucleicAcid",NucleicAcid); - if (Polymer is not null) yield return new KeyValuePair("polymer",Polymer); - if (Protein is not null) yield return new KeyValuePair("protein",Protein); - if (SourceMaterial is not null) yield return new KeyValuePair("sourceMaterial",SourceMaterial); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_Status is not null) yield return new KeyValuePair("status",_Status); + if (_Classification?.Any() == true) yield return new KeyValuePair("classification",_Classification); + if (_Domain is not null) yield return new KeyValuePair("domain",_Domain); + if (_Grade?.Any() == true) yield return new KeyValuePair("grade",_Grade); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_InformationSource?.Any() == true) yield return new KeyValuePair("informationSource",_InformationSource); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_Manufacturer?.Any() == true) yield return new KeyValuePair("manufacturer",_Manufacturer); + if (_Supplier?.Any() == true) yield return new KeyValuePair("supplier",_Supplier); + if (_Moiety?.Any() == true) yield return new KeyValuePair("moiety",_Moiety); + if (_Characterization?.Any() == true) yield return new KeyValuePair("characterization",_Characterization); + if (_Property?.Any() == true) yield return new KeyValuePair("property",_Property); + if (_ReferenceInformation is not null) yield return new KeyValuePair("referenceInformation",_ReferenceInformation); + if (_MolecularWeight?.Any() == true) yield return new KeyValuePair("molecularWeight",_MolecularWeight); + if (_Structure is not null) yield return new KeyValuePair("structure",_Structure); + if (_Code?.Any() == true) yield return new KeyValuePair("code",_Code); + if (_Name?.Any() == true) yield return new KeyValuePair("name",_Name); + if (_Relationship?.Any() == true) yield return new KeyValuePair("relationship",_Relationship); + if (_NucleicAcid is not null) yield return new KeyValuePair("nucleicAcid",_NucleicAcid); + if (_Polymer is not null) yield return new KeyValuePair("polymer",_Polymer); + if (_Protein is not null) yield return new KeyValuePair("protein",_Protein); + if (_SourceMaterial is not null) yield return new KeyValuePair("sourceMaterial",_SourceMaterial); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs index e184dd78d..6d37609c5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,13 +77,13 @@ public partial class SubunitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("subunit", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SubunitElement + public Hl7.Fhir.Model.Integer? SubunitElement { get { return _SubunitElement; } set { _SubunitElement = value; OnPropertyChanged("SubunitElement"); } } - private Hl7.Fhir.Model.Integer _SubunitElement; + private Hl7.Fhir.Model.Integer? _SubunitElement; /// /// Index of linear sequences of nucleic acids in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts @@ -89,13 +92,10 @@ public Hl7.Fhir.Model.Integer SubunitElement [IgnoreDataMember] public int? Subunit { - get { return SubunitElement != null ? SubunitElement.Value : null; } + get => _SubunitElement?.Value; set { - if (value == null) - SubunitElement = null; - else - SubunitElement = new Hl7.Fhir.Model.Integer(value); + SubunitElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Subunit"); } } @@ -105,28 +105,25 @@ public int? Subunit /// [FhirElement("sequence", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SequenceElement + public Hl7.Fhir.Model.FhirString? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.FhirString _SequenceElement; + private Hl7.Fhir.Model.FhirString? _SequenceElement; /// /// Actual nucleotide sequence notation from 5' to 3' end using standard single letter codes. In addition to the base sequence, sugar and type of phosphate or non-phosphate linkage should also be captured /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sequence + public string? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.FhirString(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Sequence"); } } @@ -136,13 +133,13 @@ public string Sequence /// [FhirElement("length", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer LengthElement + public Hl7.Fhir.Model.Integer? LengthElement { get { return _LengthElement; } set { _LengthElement = value; OnPropertyChanged("LengthElement"); } } - private Hl7.Fhir.Model.Integer _LengthElement; + private Hl7.Fhir.Model.Integer? _LengthElement; /// /// The length of the sequence shall be captured @@ -151,13 +148,10 @@ public Hl7.Fhir.Model.Integer LengthElement [IgnoreDataMember] public int? Length { - get { return LengthElement != null ? LengthElement.Value : null; } + get => _LengthElement?.Value; set { - if (value == null) - LengthElement = null; - else - LengthElement = new Hl7.Fhir.Model.Integer(value); + LengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Length"); } } @@ -167,39 +161,39 @@ public int? Length /// [FhirElement("sequenceAttachment", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Attachment SequenceAttachment + public Hl7.Fhir.Model.Attachment? SequenceAttachment { get { return _SequenceAttachment; } set { _SequenceAttachment = value; OnPropertyChanged("SequenceAttachment"); } } - private Hl7.Fhir.Model.Attachment _SequenceAttachment; + private Hl7.Fhir.Model.Attachment? _SequenceAttachment; /// /// The nucleotide present at the 5’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the first position in the sequence. A separate representation would be redundant. /// [FhirElement("fivePrime", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FivePrime + public Hl7.Fhir.Model.CodeableConcept? FivePrime { get { return _FivePrime; } set { _FivePrime = value; OnPropertyChanged("FivePrime"); } } - private Hl7.Fhir.Model.CodeableConcept _FivePrime; + private Hl7.Fhir.Model.CodeableConcept? _FivePrime; /// /// The nucleotide present at the 3’ terminal shall be specified based on a controlled vocabulary. Since the sequence is represented from the 5' to the 3' end, the 5’ prime nucleotide is the letter at the last position in the sequence. A separate representation would be redundant. /// [FhirElement("threePrime", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ThreePrime + public Hl7.Fhir.Model.CodeableConcept? ThreePrime { get { return _ThreePrime; } set { _ThreePrime = value; OnPropertyChanged("ThreePrime"); } } - private Hl7.Fhir.Model.CodeableConcept _ThreePrime; + private Hl7.Fhir.Model.CodeableConcept? _ThreePrime; /// /// The linkages between sugar residues will also be captured. @@ -209,11 +203,11 @@ public Hl7.Fhir.Model.CodeableConcept ThreePrime [DataMember] public List Linkage { - get { if(_Linkage==null) _Linkage = new List(); return _Linkage; } + get => _Linkage ?? new List(); set { _Linkage = value; OnPropertyChanged("Linkage"); } } - private List _Linkage; + private List? _Linkage; /// /// 5.3.6.8.1 Sugar ID (Mandatory). @@ -223,30 +217,26 @@ public List Linkage [DataMember] public List Sugar { - get { if(_Sugar==null) _Sugar = new List(); return _Sugar; } + get => _Sugar ?? new List(); set { _Sugar = value; OnPropertyChanged("Sugar"); } } - private List _Sugar; + private List? _Sugar; protected internal override void CopyToInternal(Base other) { - var dest = other as SubunitComponent; - - if (dest == null) - { + if(other is not SubunitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubunitElement != null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)SubunitElement.DeepCopyInternal(); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)SequenceElement.DeepCopyInternal(); - if(LengthElement != null) dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopyInternal(); - if(SequenceAttachment != null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)SequenceAttachment.DeepCopyInternal(); - if(FivePrime != null) dest.FivePrime = (Hl7.Fhir.Model.CodeableConcept)FivePrime.DeepCopyInternal(); - if(ThreePrime != null) dest.ThreePrime = (Hl7.Fhir.Model.CodeableConcept)ThreePrime.DeepCopyInternal(); - if(Linkage.Any()) dest.Linkage = new List(Linkage.DeepCopyInternal()); - if(Sugar.Any()) dest.Sugar = new List(Sugar.DeepCopyInternal()); + if(_SubunitElement is not null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)_SubunitElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)_SequenceElement.DeepCopyInternal(); + if(_LengthElement is not null) dest.LengthElement = (Hl7.Fhir.Model.Integer)_LengthElement.DeepCopyInternal(); + if(_SequenceAttachment is not null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)_SequenceAttachment.DeepCopyInternal(); + if(_FivePrime is not null) dest.FivePrime = (Hl7.Fhir.Model.CodeableConcept)_FivePrime.DeepCopyInternal(); + if(_ThreePrime is not null) dest.ThreePrime = (Hl7.Fhir.Model.CodeableConcept)_ThreePrime.DeepCopyInternal(); + if(_Linkage is not null) dest.Linkage = new List(_Linkage.DeepCopyInternal()); + if(_Sugar is not null) dest.Sugar = new List(_Sugar.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -258,83 +248,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubunitComponent; - if(otherT == null) return false; + if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubunitElement, otherT.SubunitElement)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(LengthElement, otherT.LengthElement)) return false; - if(!comparer.Equals(SequenceAttachment, otherT.SequenceAttachment)) return false; - if(!comparer.Equals(FivePrime, otherT.FivePrime)) return false; - if(!comparer.Equals(ThreePrime, otherT.ThreePrime)) return false; - if(!comparer.ListEquals(Linkage, otherT.Linkage)) return false; - if(!comparer.ListEquals(Sugar, otherT.Sugar)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; + if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; + if(!comparer.Equals(_FivePrime, otherT._FivePrime)) return false; + if(!comparer.Equals(_ThreePrime, otherT._ThreePrime)) return false; + if(!comparer.ListEquals(_Linkage, otherT._Linkage)) return false; + if(!comparer.ListEquals(_Sugar, otherT._Sugar)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subunit": - value = SubunitElement; - return SubunitElement is not null; + value = _SubunitElement; + return _SubunitElement is not null; case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "length": - value = LengthElement; - return LengthElement is not null; + value = _LengthElement; + return _LengthElement is not null; case "sequenceAttachment": - value = SequenceAttachment; - return SequenceAttachment is not null; + value = _SequenceAttachment; + return _SequenceAttachment is not null; case "fivePrime": - value = FivePrime; - return FivePrime is not null; + value = _FivePrime; + return _FivePrime is not null; case "threePrime": - value = ThreePrime; - return ThreePrime is not null; + value = _ThreePrime; + return _ThreePrime is not null; case "linkage": - value = Linkage; - return Linkage?.Any() == true; + value = _Linkage; + return _Linkage?.Any() == true; case "sugar": - value = Sugar; - return Sugar?.Any() == true; + value = _Sugar; + return _Sugar?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subunit": - SubunitElement = (Hl7.Fhir.Model.Integer)value; + SubunitElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequence": - SequenceElement = (Hl7.Fhir.Model.FhirString)value; + SequenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "length": - LengthElement = (Hl7.Fhir.Model.Integer)value; + LengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequenceAttachment": - SequenceAttachment = (Hl7.Fhir.Model.Attachment)value; + SequenceAttachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "fivePrime": - FivePrime = (Hl7.Fhir.Model.CodeableConcept)value; + FivePrime = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "threePrime": - ThreePrime = (Hl7.Fhir.Model.CodeableConcept)value; + ThreePrime = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "linkage": - Linkage = (List)value; + Linkage = (List?)value!; return this; case "sugar": - Sugar = (List)value; + Sugar = (List?)value!; return this; default: return base.SetValue(key, value); @@ -345,14 +335,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubunitElement is not null) yield return new KeyValuePair("subunit",SubunitElement); - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (LengthElement is not null) yield return new KeyValuePair("length",LengthElement); - if (SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",SequenceAttachment); - if (FivePrime is not null) yield return new KeyValuePair("fivePrime",FivePrime); - if (ThreePrime is not null) yield return new KeyValuePair("threePrime",ThreePrime); - if (Linkage?.Any() == true) yield return new KeyValuePair("linkage",Linkage); - if (Sugar?.Any() == true) yield return new KeyValuePair("sugar",Sugar); + if (_SubunitElement is not null) yield return new KeyValuePair("subunit",_SubunitElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_LengthElement is not null) yield return new KeyValuePair("length",_LengthElement); + if (_SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",_SequenceAttachment); + if (_FivePrime is not null) yield return new KeyValuePair("fivePrime",_FivePrime); + if (_ThreePrime is not null) yield return new KeyValuePair("threePrime",_ThreePrime); + if (_Linkage?.Any() == true) yield return new KeyValuePair("linkage",_Linkage); + if (_Sugar?.Any() == true) yield return new KeyValuePair("sugar",_Sugar); } } @@ -375,28 +365,25 @@ public partial class LinkageComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("connectivity", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString ConnectivityElement + public Hl7.Fhir.Model.FhirString? ConnectivityElement { get { return _ConnectivityElement; } set { _ConnectivityElement = value; OnPropertyChanged("ConnectivityElement"); } } - private Hl7.Fhir.Model.FhirString _ConnectivityElement; + private Hl7.Fhir.Model.FhirString? _ConnectivityElement; /// /// The entity that links the sugar residues together should also be captured for nearly all naturally occurring nucleic acid the linkage is a phosphate group. For many synthetic oligonucleotides phosphorothioate linkages are often seen. Linkage connectivity is assumed to be 3’-5’. If the linkage is either 3’-3’ or 5’-5’ this should be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Connectivity + public string? Connectivity { - get { return ConnectivityElement != null ? ConnectivityElement.Value : null; } + get => _ConnectivityElement?.Value; set { - if (value == null) - ConnectivityElement = null; - else - ConnectivityElement = new Hl7.Fhir.Model.FhirString(value); + ConnectivityElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Connectivity"); } } @@ -406,41 +393,38 @@ public string Connectivity /// [FhirElement("identifier", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Each linkage will be registered as a fragment and have at least one name. A single name shall be assigned to each linkage. /// [FhirElement("name", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Each linkage will be registered as a fragment and have at least one name. A single name shall be assigned to each linkage /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -450,46 +434,39 @@ public string Name /// [FhirElement("residueSite", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ResidueSiteElement + public Hl7.Fhir.Model.FhirString? ResidueSiteElement { get { return _ResidueSiteElement; } set { _ResidueSiteElement = value; OnPropertyChanged("ResidueSiteElement"); } } - private Hl7.Fhir.Model.FhirString _ResidueSiteElement; + private Hl7.Fhir.Model.FhirString? _ResidueSiteElement; /// /// Residues shall be captured as described in 5.3.6.8.3 /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResidueSite + public string? ResidueSite { - get { return ResidueSiteElement != null ? ResidueSiteElement.Value : null; } + get => _ResidueSiteElement?.Value; set { - if (value == null) - ResidueSiteElement = null; - else - ResidueSiteElement = new Hl7.Fhir.Model.FhirString(value); + ResidueSiteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResidueSite"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkageComponent; - - if (dest == null) - { + if(other is not LinkageComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ConnectivityElement != null) dest.ConnectivityElement = (Hl7.Fhir.Model.FhirString)ConnectivityElement.DeepCopyInternal(); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ResidueSiteElement != null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)ResidueSiteElement.DeepCopyInternal(); + if(_ConnectivityElement is not null) dest.ConnectivityElement = (Hl7.Fhir.Model.FhirString)_ConnectivityElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ResidueSiteElement is not null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)_ResidueSiteElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -501,55 +478,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkageComponent; - if(otherT == null) return false; + if(other is not LinkageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ConnectivityElement, otherT.ConnectivityElement)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ResidueSiteElement, otherT.ResidueSiteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ConnectivityElement, otherT._ConnectivityElement)) return false; + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "connectivity": - value = ConnectivityElement; - return ConnectivityElement is not null; + value = _ConnectivityElement; + return _ConnectivityElement is not null; case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "residueSite": - value = ResidueSiteElement; - return ResidueSiteElement is not null; + value = _ResidueSiteElement; + return _ResidueSiteElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "connectivity": - ConnectivityElement = (Hl7.Fhir.Model.FhirString)value; + ConnectivityElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "residueSite": - ResidueSiteElement = (Hl7.Fhir.Model.FhirString)value; + ResidueSiteElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -560,10 +537,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ConnectivityElement is not null) yield return new KeyValuePair("connectivity",ConnectivityElement); - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",ResidueSiteElement); + if (_ConnectivityElement is not null) yield return new KeyValuePair("connectivity",_ConnectivityElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",_ResidueSiteElement); } } @@ -586,41 +563,38 @@ public partial class SugarComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("identifier", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// The name of the sugar or sugar-like component that make up the nucleotide. /// [FhirElement("name", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// The name of the sugar or sugar-like component that make up the nucleotide /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -630,45 +604,38 @@ public string Name /// [FhirElement("residueSite", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString ResidueSiteElement + public Hl7.Fhir.Model.FhirString? ResidueSiteElement { get { return _ResidueSiteElement; } set { _ResidueSiteElement = value; OnPropertyChanged("ResidueSiteElement"); } } - private Hl7.Fhir.Model.FhirString _ResidueSiteElement; + private Hl7.Fhir.Model.FhirString? _ResidueSiteElement; /// /// The residues that contain a given sugar will be captured. The order of given residues will be captured in the 5‘-3‘direction consistent with the base sequences listed above /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResidueSite + public string? ResidueSite { - get { return ResidueSiteElement != null ? ResidueSiteElement.Value : null; } + get => _ResidueSiteElement?.Value; set { - if (value == null) - ResidueSiteElement = null; - else - ResidueSiteElement = new Hl7.Fhir.Model.FhirString(value); + ResidueSiteElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResidueSite"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SugarComponent; - - if (dest == null) - { + if(other is not SugarComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(ResidueSiteElement != null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)ResidueSiteElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_ResidueSiteElement is not null) dest.ResidueSiteElement = (Hl7.Fhir.Model.FhirString)_ResidueSiteElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -680,48 +647,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SugarComponent; - if(otherT == null) return false; + if(other is not SugarComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(ResidueSiteElement, otherT.ResidueSiteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "residueSite": - value = ResidueSiteElement; - return ResidueSiteElement is not null; + value = _ResidueSiteElement; + return _ResidueSiteElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "residueSite": - ResidueSiteElement = (Hl7.Fhir.Model.FhirString)value; + ResidueSiteElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -732,9 +699,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",ResidueSiteElement); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_ResidueSiteElement is not null) yield return new KeyValuePair("residueSite",_ResidueSiteElement); } } @@ -744,26 +711,26 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sequenceType", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SequenceType + public Hl7.Fhir.Model.CodeableConcept? SequenceType { get { return _SequenceType; } set { _SequenceType = value; OnPropertyChanged("SequenceType"); } } - private Hl7.Fhir.Model.CodeableConcept _SequenceType; + private Hl7.Fhir.Model.CodeableConcept? _SequenceType; /// /// The number of linear sequences of nucleotides linked through phosphodiester bonds shall be described. Subunits would be strands of nucleic acids that are tightly associated typically through Watson-Crick base pairing. NOTE: If not specified in the reference source, the assumption is that there is 1 subunit. /// [FhirElement("numberOfSubunits", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfSubunitsElement + public Hl7.Fhir.Model.Integer? NumberOfSubunitsElement { get { return _NumberOfSubunitsElement; } set { _NumberOfSubunitsElement = value; OnPropertyChanged("NumberOfSubunitsElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfSubunitsElement; + private Hl7.Fhir.Model.Integer? _NumberOfSubunitsElement; /// /// The number of linear sequences of nucleotides linked through phosphodiester bonds shall be described. Subunits would be strands of nucleic acids that are tightly associated typically through Watson-Crick base pairing. NOTE: If not specified in the reference source, the assumption is that there is 1 subunit @@ -772,13 +739,10 @@ public Hl7.Fhir.Model.Integer NumberOfSubunitsElement [IgnoreDataMember] public int? NumberOfSubunits { - get { return NumberOfSubunitsElement != null ? NumberOfSubunitsElement.Value : null; } + get => _NumberOfSubunitsElement?.Value; set { - if (value == null) - NumberOfSubunitsElement = null; - else - NumberOfSubunitsElement = new Hl7.Fhir.Model.Integer(value); + NumberOfSubunitsElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfSubunits"); } } @@ -788,28 +752,25 @@ public int? NumberOfSubunits /// [FhirElement("areaOfHybridisation", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString AreaOfHybridisationElement + public Hl7.Fhir.Model.FhirString? AreaOfHybridisationElement { get { return _AreaOfHybridisationElement; } set { _AreaOfHybridisationElement = value; OnPropertyChanged("AreaOfHybridisationElement"); } } - private Hl7.Fhir.Model.FhirString _AreaOfHybridisationElement; + private Hl7.Fhir.Model.FhirString? _AreaOfHybridisationElement; /// /// The area of hybridisation shall be described if applicable for double stranded RNA or DNA. The number associated with the subunit followed by the number associated to the residue shall be specified in increasing order. The underscore “” shall be used as separator as follows: “Subunitnumber Residue” /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AreaOfHybridisation + public string? AreaOfHybridisation { - get { return AreaOfHybridisationElement != null ? AreaOfHybridisationElement.Value : null; } + get => _AreaOfHybridisationElement?.Value; set { - if (value == null) - AreaOfHybridisationElement = null; - else - AreaOfHybridisationElement = new Hl7.Fhir.Model.FhirString(value); + AreaOfHybridisationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AreaOfHybridisation"); } } @@ -819,13 +780,13 @@ public string AreaOfHybridisation /// [FhirElement("oligoNucleotideType", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OligoNucleotideType + public Hl7.Fhir.Model.CodeableConcept? OligoNucleotideType { get { return _OligoNucleotideType; } set { _OligoNucleotideType = value; OnPropertyChanged("OligoNucleotideType"); } } - private Hl7.Fhir.Model.CodeableConcept _OligoNucleotideType; + private Hl7.Fhir.Model.CodeableConcept? _OligoNucleotideType; /// /// Subunits are listed in order of decreasing length; sequences of the same length will be ordered by molecular weight; subunits that have identical sequences will be repeated multiple times. @@ -835,27 +796,23 @@ public Hl7.Fhir.Model.CodeableConcept OligoNucleotideType [DataMember] public List Subunit { - get { if(_Subunit==null) _Subunit = new List(); return _Subunit; } + get => _Subunit ?? new List(); set { _Subunit = value; OnPropertyChanged("Subunit"); } } - private List _Subunit; + private List? _Subunit; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceNucleicAcid; - - if (dest == null) - { + if(other is not SubstanceNucleicAcid dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceType != null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)SequenceType.DeepCopyInternal(); - if(NumberOfSubunitsElement != null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)NumberOfSubunitsElement.DeepCopyInternal(); - if(AreaOfHybridisationElement != null) dest.AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString)AreaOfHybridisationElement.DeepCopyInternal(); - if(OligoNucleotideType != null) dest.OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept)OligoNucleotideType.DeepCopyInternal(); - if(Subunit.Any()) dest.Subunit = new List(Subunit.DeepCopyInternal()); + if(_SequenceType is not null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)_SequenceType.DeepCopyInternal(); + if(_NumberOfSubunitsElement is not null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)_NumberOfSubunitsElement.DeepCopyInternal(); + if(_AreaOfHybridisationElement is not null) dest.AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString)_AreaOfHybridisationElement.DeepCopyInternal(); + if(_OligoNucleotideType is not null) dest.OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept)_OligoNucleotideType.DeepCopyInternal(); + if(_Subunit is not null) dest.Subunit = new List(_Subunit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -867,62 +824,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceNucleicAcid; - if(otherT == null) return false; + if(other is not SubstanceNucleicAcid otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceType, otherT.SequenceType)) return false; - if(!comparer.Equals(NumberOfSubunitsElement, otherT.NumberOfSubunitsElement)) return false; - if(!comparer.Equals(AreaOfHybridisationElement, otherT.AreaOfHybridisationElement)) return false; - if(!comparer.Equals(OligoNucleotideType, otherT.OligoNucleotideType)) return false; - if(!comparer.ListEquals(Subunit, otherT.Subunit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; + if(!comparer.Equals(_AreaOfHybridisationElement, otherT._AreaOfHybridisationElement)) return false; + if(!comparer.Equals(_OligoNucleotideType, otherT._OligoNucleotideType)) return false; + if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceType": - value = SequenceType; - return SequenceType is not null; + value = _SequenceType; + return _SequenceType is not null; case "numberOfSubunits": - value = NumberOfSubunitsElement; - return NumberOfSubunitsElement is not null; + value = _NumberOfSubunitsElement; + return _NumberOfSubunitsElement is not null; case "areaOfHybridisation": - value = AreaOfHybridisationElement; - return AreaOfHybridisationElement is not null; + value = _AreaOfHybridisationElement; + return _AreaOfHybridisationElement is not null; case "oligoNucleotideType": - value = OligoNucleotideType; - return OligoNucleotideType is not null; + value = _OligoNucleotideType; + return _OligoNucleotideType is not null; case "subunit": - value = Subunit; - return Subunit?.Any() == true; + value = _Subunit; + return _Subunit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceType": - SequenceType = (Hl7.Fhir.Model.CodeableConcept)value; + SequenceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "numberOfSubunits": - NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)value; + NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer?)value; return this; case "areaOfHybridisation": - AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString)value; + AreaOfHybridisationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "oligoNucleotideType": - OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept)value; + OligoNucleotideType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subunit": - Subunit = (List)value; + Subunit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -933,11 +890,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceType is not null) yield return new KeyValuePair("sequenceType",SequenceType); - if (NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",NumberOfSubunitsElement); - if (AreaOfHybridisationElement is not null) yield return new KeyValuePair("areaOfHybridisation",AreaOfHybridisationElement); - if (OligoNucleotideType is not null) yield return new KeyValuePair("oligoNucleotideType",OligoNucleotideType); - if (Subunit?.Any() == true) yield return new KeyValuePair("subunit",Subunit); + if (_SequenceType is not null) yield return new KeyValuePair("sequenceType",_SequenceType); + if (_NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",_NumberOfSubunitsElement); + if (_AreaOfHybridisationElement is not null) yield return new KeyValuePair("areaOfHybridisation",_AreaOfHybridisationElement); + if (_OligoNucleotideType is not null) yield return new KeyValuePair("oligoNucleotideType",_OligoNucleotideType); + if (_Subunit?.Any() == true) yield return new KeyValuePair("subunit",_Subunit); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs index 99db66b9b..cbd813256 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -49,7 +52,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SubstancePolymer","http://hl7.org/fhir/StructureDefinition/SubstancePolymer")] - public partial class SubstancePolymer : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class SubstancePolymer : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -74,13 +77,13 @@ public partial class MonomerSetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("ratioType", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RatioType + public Hl7.Fhir.Model.CodeableConcept? RatioType { get { return _RatioType; } set { _RatioType = value; OnPropertyChanged("RatioType"); } } - private Hl7.Fhir.Model.CodeableConcept _RatioType; + private Hl7.Fhir.Model.CodeableConcept? _RatioType; /// /// The starting materials - monomer(s) used in the synthesis of the polymer. @@ -90,24 +93,20 @@ public Hl7.Fhir.Model.CodeableConcept RatioType [DataMember] public List StartingMaterial { - get { if(_StartingMaterial==null) _StartingMaterial = new List(); return _StartingMaterial; } + get => _StartingMaterial ?? new List(); set { _StartingMaterial = value; OnPropertyChanged("StartingMaterial"); } } - private List _StartingMaterial; + private List? _StartingMaterial; protected internal override void CopyToInternal(Base other) { - var dest = other as MonomerSetComponent; - - if (dest == null) - { + if(other is not MonomerSetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RatioType != null) dest.RatioType = (Hl7.Fhir.Model.CodeableConcept)RatioType.DeepCopyInternal(); - if(StartingMaterial.Any()) dest.StartingMaterial = new List(StartingMaterial.DeepCopyInternal()); + if(_RatioType is not null) dest.RatioType = (Hl7.Fhir.Model.CodeableConcept)_RatioType.DeepCopyInternal(); + if(_StartingMaterial is not null) dest.StartingMaterial = new List(_StartingMaterial.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -119,41 +118,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MonomerSetComponent; - if(otherT == null) return false; + if(other is not MonomerSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RatioType, otherT.RatioType)) return false; - if(!comparer.ListEquals(StartingMaterial, otherT.StartingMaterial)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RatioType, otherT._RatioType)) return false; + if(!comparer.ListEquals(_StartingMaterial, otherT._StartingMaterial)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "ratioType": - value = RatioType; - return RatioType is not null; + value = _RatioType; + return _RatioType is not null; case "startingMaterial": - value = StartingMaterial; - return StartingMaterial?.Any() == true; + value = _StartingMaterial; + return _StartingMaterial?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "ratioType": - RatioType = (Hl7.Fhir.Model.CodeableConcept)value; + RatioType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "startingMaterial": - StartingMaterial = (List)value; + StartingMaterial = (List?)value!; return this; default: return base.SetValue(key, value); @@ -164,8 +163,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RatioType is not null) yield return new KeyValuePair("ratioType",RatioType); - if (StartingMaterial?.Any() == true) yield return new KeyValuePair("startingMaterial",StartingMaterial); + if (_RatioType is not null) yield return new KeyValuePair("ratioType",_RatioType); + if (_StartingMaterial?.Any() == true) yield return new KeyValuePair("startingMaterial",_StartingMaterial); } } @@ -188,39 +187,39 @@ public partial class StartingMaterialComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Substance high level category, e.g. chemical substance. /// [FhirElement("category", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// Used to specify whether the attribute described is a defining element for the unique identification of the polymer. /// [FhirElement("isDefining", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefiningElement + public Hl7.Fhir.Model.FhirBoolean? IsDefiningElement { get { return _IsDefiningElement; } set { _IsDefiningElement = value; OnPropertyChanged("IsDefiningElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefiningElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefiningElement; /// /// Used to specify whether the attribute described is a defining element for the unique identification of the polymer @@ -229,13 +228,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefiningElement [IgnoreDataMember] public bool? IsDefining { - get { return IsDefiningElement != null ? IsDefiningElement.Value : null; } + get => _IsDefiningElement?.Value; set { - if (value == null) - IsDefiningElement = null; - else - IsDefiningElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefiningElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefining"); } } @@ -245,28 +241,24 @@ public bool? IsDefining /// [FhirElement("amount", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Quantity Amount + public Hl7.Fhir.Model.Quantity? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.Quantity _Amount; + private Hl7.Fhir.Model.Quantity? _Amount; protected internal override void CopyToInternal(Base other) { - var dest = other as StartingMaterialComponent; - - if (dest == null) - { + if(other is not StartingMaterialComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(IsDefiningElement != null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)IsDefiningElement.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.Quantity)Amount.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_IsDefiningElement is not null) dest.IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefiningElement.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.Quantity)_Amount.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -278,55 +270,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StartingMaterialComponent; - if(otherT == null) return false; + if(other is not StartingMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(IsDefiningElement, otherT.IsDefiningElement)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "isDefining": - value = IsDefiningElement; - return IsDefiningElement is not null; + value = _IsDefiningElement; + return _IsDefiningElement is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "isDefining": - IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefiningElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.Quantity)value; + Amount = (Hl7.Fhir.Model.Quantity?)value; return this; default: return base.SetValue(key, value); @@ -337,10 +329,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (IsDefiningElement is not null) yield return new KeyValuePair("isDefining",IsDefiningElement); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_IsDefiningElement is not null) yield return new KeyValuePair("isDefining",_IsDefiningElement); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); } } @@ -363,28 +355,25 @@ public partial class RepeatComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("averageMolecularFormula", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString AverageMolecularFormulaElement + public Hl7.Fhir.Model.FhirString? AverageMolecularFormulaElement { get { return _AverageMolecularFormulaElement; } set { _AverageMolecularFormulaElement = value; OnPropertyChanged("AverageMolecularFormulaElement"); } } - private Hl7.Fhir.Model.FhirString _AverageMolecularFormulaElement; + private Hl7.Fhir.Model.FhirString? _AverageMolecularFormulaElement; /// /// A representation of an (average) molecular formula from a polymer /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AverageMolecularFormula + public string? AverageMolecularFormula { - get { return AverageMolecularFormulaElement != null ? AverageMolecularFormulaElement.Value : null; } + get => _AverageMolecularFormulaElement?.Value; set { - if (value == null) - AverageMolecularFormulaElement = null; - else - AverageMolecularFormulaElement = new Hl7.Fhir.Model.FhirString(value); + AverageMolecularFormulaElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AverageMolecularFormula"); } } @@ -394,13 +383,13 @@ public string AverageMolecularFormula /// [FhirElement("repeatUnitAmountType", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept RepeatUnitAmountType + public Hl7.Fhir.Model.CodeableConcept? RepeatUnitAmountType { get { return _RepeatUnitAmountType; } set { _RepeatUnitAmountType = value; OnPropertyChanged("RepeatUnitAmountType"); } } - private Hl7.Fhir.Model.CodeableConcept _RepeatUnitAmountType; + private Hl7.Fhir.Model.CodeableConcept? _RepeatUnitAmountType; /// /// An SRU - Structural Repeat Unit. @@ -410,25 +399,21 @@ public Hl7.Fhir.Model.CodeableConcept RepeatUnitAmountType [DataMember] public List RepeatUnit { - get { if(_RepeatUnit==null) _RepeatUnit = new List(); return _RepeatUnit; } + get => _RepeatUnit ?? new List(); set { _RepeatUnit = value; OnPropertyChanged("RepeatUnit"); } } - private List _RepeatUnit; + private List? _RepeatUnit; protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatComponent; - - if (dest == null) - { + if(other is not RepeatComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AverageMolecularFormulaElement != null) dest.AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString)AverageMolecularFormulaElement.DeepCopyInternal(); - if(RepeatUnitAmountType != null) dest.RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept)RepeatUnitAmountType.DeepCopyInternal(); - if(RepeatUnit.Any()) dest.RepeatUnit = new List(RepeatUnit.DeepCopyInternal()); + if(_AverageMolecularFormulaElement is not null) dest.AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString)_AverageMolecularFormulaElement.DeepCopyInternal(); + if(_RepeatUnitAmountType is not null) dest.RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept)_RepeatUnitAmountType.DeepCopyInternal(); + if(_RepeatUnit is not null) dest.RepeatUnit = new List(_RepeatUnit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -440,48 +425,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatComponent; - if(otherT == null) return false; + if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AverageMolecularFormulaElement, otherT.AverageMolecularFormulaElement)) return false; - if(!comparer.Equals(RepeatUnitAmountType, otherT.RepeatUnitAmountType)) return false; - if(!comparer.ListEquals(RepeatUnit, otherT.RepeatUnit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AverageMolecularFormulaElement, otherT._AverageMolecularFormulaElement)) return false; + if(!comparer.Equals(_RepeatUnitAmountType, otherT._RepeatUnitAmountType)) return false; + if(!comparer.ListEquals(_RepeatUnit, otherT._RepeatUnit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "averageMolecularFormula": - value = AverageMolecularFormulaElement; - return AverageMolecularFormulaElement is not null; + value = _AverageMolecularFormulaElement; + return _AverageMolecularFormulaElement is not null; case "repeatUnitAmountType": - value = RepeatUnitAmountType; - return RepeatUnitAmountType is not null; + value = _RepeatUnitAmountType; + return _RepeatUnitAmountType is not null; case "repeatUnit": - value = RepeatUnit; - return RepeatUnit?.Any() == true; + value = _RepeatUnit; + return _RepeatUnit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "averageMolecularFormula": - AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString)value; + AverageMolecularFormulaElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "repeatUnitAmountType": - RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept)value; + RepeatUnitAmountType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "repeatUnit": - RepeatUnit = (List)value; + RepeatUnit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -492,9 +477,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AverageMolecularFormulaElement is not null) yield return new KeyValuePair("averageMolecularFormula",AverageMolecularFormulaElement); - if (RepeatUnitAmountType is not null) yield return new KeyValuePair("repeatUnitAmountType",RepeatUnitAmountType); - if (RepeatUnit?.Any() == true) yield return new KeyValuePair("repeatUnit",RepeatUnit); + if (_AverageMolecularFormulaElement is not null) yield return new KeyValuePair("averageMolecularFormula",_AverageMolecularFormulaElement); + if (_RepeatUnitAmountType is not null) yield return new KeyValuePair("repeatUnitAmountType",_RepeatUnitAmountType); + if (_RepeatUnit?.Any() == true) yield return new KeyValuePair("repeatUnit",_RepeatUnit); } } @@ -517,28 +502,25 @@ public partial class RepeatUnitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("unit", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString UnitElement + public Hl7.Fhir.Model.FhirString? UnitElement { get { return _UnitElement; } set { _UnitElement = value; OnPropertyChanged("UnitElement"); } } - private Hl7.Fhir.Model.FhirString _UnitElement; + private Hl7.Fhir.Model.FhirString? _UnitElement; /// /// Structural repeat units are essential elements for defining polymers /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Unit + public string? Unit { - get { return UnitElement != null ? UnitElement.Value : null; } + get => _UnitElement?.Value; set { - if (value == null) - UnitElement = null; - else - UnitElement = new Hl7.Fhir.Model.FhirString(value); + UnitElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Unit"); } } @@ -548,26 +530,26 @@ public string Unit /// [FhirElement("orientation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Orientation + public Hl7.Fhir.Model.CodeableConcept? Orientation { get { return _Orientation; } set { _Orientation = value; OnPropertyChanged("Orientation"); } } - private Hl7.Fhir.Model.CodeableConcept _Orientation; + private Hl7.Fhir.Model.CodeableConcept? _Orientation; /// /// Number of repeats of this unit. /// [FhirElement("amount", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer AmountElement + public Hl7.Fhir.Model.Integer? AmountElement { get { return _AmountElement; } set { _AmountElement = value; OnPropertyChanged("AmountElement"); } } - private Hl7.Fhir.Model.Integer _AmountElement; + private Hl7.Fhir.Model.Integer? _AmountElement; /// /// Number of repeats of this unit @@ -576,13 +558,10 @@ public Hl7.Fhir.Model.Integer AmountElement [IgnoreDataMember] public int? Amount { - get { return AmountElement != null ? AmountElement.Value : null; } + get => _AmountElement?.Value; set { - if (value == null) - AmountElement = null; - else - AmountElement = new Hl7.Fhir.Model.Integer(value); + AmountElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Amount"); } } @@ -595,11 +574,11 @@ public int? Amount [DataMember] public List DegreeOfPolymerisation { - get { if(_DegreeOfPolymerisation==null) _DegreeOfPolymerisation = new List(); return _DegreeOfPolymerisation; } + get => _DegreeOfPolymerisation ?? new List(); set { _DegreeOfPolymerisation = value; OnPropertyChanged("DegreeOfPolymerisation"); } } - private List _DegreeOfPolymerisation; + private List? _DegreeOfPolymerisation; /// /// A graphical structure for this SRU. @@ -609,27 +588,23 @@ public List Deg [DataMember] public List StructuralRepresentation { - get { if(_StructuralRepresentation==null) _StructuralRepresentation = new List(); return _StructuralRepresentation; } + get => _StructuralRepresentation ?? new List(); set { _StructuralRepresentation = value; OnPropertyChanged("StructuralRepresentation"); } } - private List _StructuralRepresentation; + private List? _StructuralRepresentation; protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatUnitComponent; - - if (dest == null) - { + if(other is not RepeatUnitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UnitElement != null) dest.UnitElement = (Hl7.Fhir.Model.FhirString)UnitElement.DeepCopyInternal(); - if(Orientation != null) dest.Orientation = (Hl7.Fhir.Model.CodeableConcept)Orientation.DeepCopyInternal(); - if(AmountElement != null) dest.AmountElement = (Hl7.Fhir.Model.Integer)AmountElement.DeepCopyInternal(); - if(DegreeOfPolymerisation.Any()) dest.DegreeOfPolymerisation = new List(DegreeOfPolymerisation.DeepCopyInternal()); - if(StructuralRepresentation.Any()) dest.StructuralRepresentation = new List(StructuralRepresentation.DeepCopyInternal()); + if(_UnitElement is not null) dest.UnitElement = (Hl7.Fhir.Model.FhirString)_UnitElement.DeepCopyInternal(); + if(_Orientation is not null) dest.Orientation = (Hl7.Fhir.Model.CodeableConcept)_Orientation.DeepCopyInternal(); + if(_AmountElement is not null) dest.AmountElement = (Hl7.Fhir.Model.Integer)_AmountElement.DeepCopyInternal(); + if(_DegreeOfPolymerisation is not null) dest.DegreeOfPolymerisation = new List(_DegreeOfPolymerisation.DeepCopyInternal()); + if(_StructuralRepresentation is not null) dest.StructuralRepresentation = new List(_StructuralRepresentation.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -641,62 +616,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatUnitComponent; - if(otherT == null) return false; + if(other is not RepeatUnitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UnitElement, otherT.UnitElement)) return false; - if(!comparer.Equals(Orientation, otherT.Orientation)) return false; - if(!comparer.Equals(AmountElement, otherT.AmountElement)) return false; - if(!comparer.ListEquals(DegreeOfPolymerisation, otherT.DegreeOfPolymerisation)) return false; - if(!comparer.ListEquals(StructuralRepresentation, otherT.StructuralRepresentation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UnitElement, otherT._UnitElement)) return false; + if(!comparer.Equals(_Orientation, otherT._Orientation)) return false; + if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; + if(!comparer.ListEquals(_DegreeOfPolymerisation, otherT._DegreeOfPolymerisation)) return false; + if(!comparer.ListEquals(_StructuralRepresentation, otherT._StructuralRepresentation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "unit": - value = UnitElement; - return UnitElement is not null; + value = _UnitElement; + return _UnitElement is not null; case "orientation": - value = Orientation; - return Orientation is not null; + value = _Orientation; + return _Orientation is not null; case "amount": - value = AmountElement; - return AmountElement is not null; + value = _AmountElement; + return _AmountElement is not null; case "degreeOfPolymerisation": - value = DegreeOfPolymerisation; - return DegreeOfPolymerisation?.Any() == true; + value = _DegreeOfPolymerisation; + return _DegreeOfPolymerisation?.Any() == true; case "structuralRepresentation": - value = StructuralRepresentation; - return StructuralRepresentation?.Any() == true; + value = _StructuralRepresentation; + return _StructuralRepresentation?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "unit": - UnitElement = (Hl7.Fhir.Model.FhirString)value; + UnitElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "orientation": - Orientation = (Hl7.Fhir.Model.CodeableConcept)value; + Orientation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - AmountElement = (Hl7.Fhir.Model.Integer)value; + AmountElement = (Hl7.Fhir.Model.Integer?)value; return this; case "degreeOfPolymerisation": - DegreeOfPolymerisation = (List)value; + DegreeOfPolymerisation = (List?)value!; return this; case "structuralRepresentation": - StructuralRepresentation = (List)value; + StructuralRepresentation = (List?)value!; return this; default: return base.SetValue(key, value); @@ -707,11 +682,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UnitElement is not null) yield return new KeyValuePair("unit",UnitElement); - if (Orientation is not null) yield return new KeyValuePair("orientation",Orientation); - if (AmountElement is not null) yield return new KeyValuePair("amount",AmountElement); - if (DegreeOfPolymerisation?.Any() == true) yield return new KeyValuePair("degreeOfPolymerisation",DegreeOfPolymerisation); - if (StructuralRepresentation?.Any() == true) yield return new KeyValuePair("structuralRepresentation",StructuralRepresentation); + if (_UnitElement is not null) yield return new KeyValuePair("unit",_UnitElement); + if (_Orientation is not null) yield return new KeyValuePair("orientation",_Orientation); + if (_AmountElement is not null) yield return new KeyValuePair("amount",_AmountElement); + if (_DegreeOfPolymerisation?.Any() == true) yield return new KeyValuePair("degreeOfPolymerisation",_DegreeOfPolymerisation); + if (_StructuralRepresentation?.Any() == true) yield return new KeyValuePair("structuralRepresentation",_StructuralRepresentation); } } @@ -734,26 +709,26 @@ public partial class DegreeOfPolymerisationComponent : Hl7.Fhir.Model.BackboneEl /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// An average amount of polymerisation. /// [FhirElement("average", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Integer AverageElement + public Hl7.Fhir.Model.Integer? AverageElement { get { return _AverageElement; } set { _AverageElement = value; OnPropertyChanged("AverageElement"); } } - private Hl7.Fhir.Model.Integer _AverageElement; + private Hl7.Fhir.Model.Integer? _AverageElement; /// /// An average amount of polymerisation @@ -762,13 +737,10 @@ public Hl7.Fhir.Model.Integer AverageElement [IgnoreDataMember] public int? Average { - get { return AverageElement != null ? AverageElement.Value : null; } + get => _AverageElement?.Value; set { - if (value == null) - AverageElement = null; - else - AverageElement = new Hl7.Fhir.Model.Integer(value); + AverageElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Average"); } } @@ -778,13 +750,13 @@ public int? Average /// [FhirElement("low", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer LowElement + public Hl7.Fhir.Model.Integer? LowElement { get { return _LowElement; } set { _LowElement = value; OnPropertyChanged("LowElement"); } } - private Hl7.Fhir.Model.Integer _LowElement; + private Hl7.Fhir.Model.Integer? _LowElement; /// /// A low expected limit of the amount @@ -793,13 +765,10 @@ public Hl7.Fhir.Model.Integer LowElement [IgnoreDataMember] public int? Low { - get { return LowElement != null ? LowElement.Value : null; } + get => _LowElement?.Value; set { - if (value == null) - LowElement = null; - else - LowElement = new Hl7.Fhir.Model.Integer(value); + LowElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Low"); } } @@ -809,13 +778,13 @@ public int? Low /// [FhirElement("high", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Integer HighElement + public Hl7.Fhir.Model.Integer? HighElement { get { return _HighElement; } set { _HighElement = value; OnPropertyChanged("HighElement"); } } - private Hl7.Fhir.Model.Integer _HighElement; + private Hl7.Fhir.Model.Integer? _HighElement; /// /// A high expected limit of the amount @@ -824,31 +793,24 @@ public Hl7.Fhir.Model.Integer HighElement [IgnoreDataMember] public int? High { - get { return HighElement != null ? HighElement.Value : null; } + get => _HighElement?.Value; set { - if (value == null) - HighElement = null; - else - HighElement = new Hl7.Fhir.Model.Integer(value); + HighElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("High"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DegreeOfPolymerisationComponent; - - if (dest == null) - { + if(other is not DegreeOfPolymerisationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(AverageElement != null) dest.AverageElement = (Hl7.Fhir.Model.Integer)AverageElement.DeepCopyInternal(); - if(LowElement != null) dest.LowElement = (Hl7.Fhir.Model.Integer)LowElement.DeepCopyInternal(); - if(HighElement != null) dest.HighElement = (Hl7.Fhir.Model.Integer)HighElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_AverageElement is not null) dest.AverageElement = (Hl7.Fhir.Model.Integer)_AverageElement.DeepCopyInternal(); + if(_LowElement is not null) dest.LowElement = (Hl7.Fhir.Model.Integer)_LowElement.DeepCopyInternal(); + if(_HighElement is not null) dest.HighElement = (Hl7.Fhir.Model.Integer)_HighElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -860,55 +822,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DegreeOfPolymerisationComponent; - if(otherT == null) return false; + if(other is not DegreeOfPolymerisationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(AverageElement, otherT.AverageElement)) return false; - if(!comparer.Equals(LowElement, otherT.LowElement)) return false; - if(!comparer.Equals(HighElement, otherT.HighElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_AverageElement, otherT._AverageElement)) return false; + if(!comparer.Equals(_LowElement, otherT._LowElement)) return false; + if(!comparer.Equals(_HighElement, otherT._HighElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "average": - value = AverageElement; - return AverageElement is not null; + value = _AverageElement; + return _AverageElement is not null; case "low": - value = LowElement; - return LowElement is not null; + value = _LowElement; + return _LowElement is not null; case "high": - value = HighElement; - return HighElement is not null; + value = _HighElement; + return _HighElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "average": - AverageElement = (Hl7.Fhir.Model.Integer)value; + AverageElement = (Hl7.Fhir.Model.Integer?)value; return this; case "low": - LowElement = (Hl7.Fhir.Model.Integer)value; + LowElement = (Hl7.Fhir.Model.Integer?)value; return this; case "high": - HighElement = (Hl7.Fhir.Model.Integer)value; + HighElement = (Hl7.Fhir.Model.Integer?)value; return this; default: return base.SetValue(key, value); @@ -919,10 +881,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (AverageElement is not null) yield return new KeyValuePair("average",AverageElement); - if (LowElement is not null) yield return new KeyValuePair("low",LowElement); - if (HighElement is not null) yield return new KeyValuePair("high",HighElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_AverageElement is not null) yield return new KeyValuePair("average",_AverageElement); + if (_LowElement is not null) yield return new KeyValuePair("low",_LowElement); + if (_HighElement is not null) yield return new KeyValuePair("high",_HighElement); } } @@ -945,41 +907,38 @@ public partial class StructuralRepresentationComponent : Hl7.Fhir.Model.Backbone /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The structural representation as text string in a standard format e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. /// [FhirElement("representation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString RepresentationElement + public Hl7.Fhir.Model.FhirString? RepresentationElement { get { return _RepresentationElement; } set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } - private Hl7.Fhir.Model.FhirString _RepresentationElement; + private Hl7.Fhir.Model.FhirString? _RepresentationElement; /// /// The structural representation as text string in a standard format e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Representation + public string? Representation { - get { return RepresentationElement != null ? RepresentationElement.Value : null; } + get => _RepresentationElement?.Value; set { - if (value == null) - RepresentationElement = null; - else - RepresentationElement = new Hl7.Fhir.Model.FhirString(value); + RepresentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Representation"); } } @@ -989,41 +948,37 @@ public string Representation /// [FhirElement("format", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Format + public Hl7.Fhir.Model.CodeableConcept? Format { get { return _Format; } set { _Format = value; OnPropertyChanged("Format"); } } - private Hl7.Fhir.Model.CodeableConcept _Format; + private Hl7.Fhir.Model.CodeableConcept? _Format; /// /// An attached file with the structural representation. /// [FhirElement("attachment", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Attachment Attachment + public Hl7.Fhir.Model.Attachment? Attachment { get { return _Attachment; } set { _Attachment = value; OnPropertyChanged("Attachment"); } } - private Hl7.Fhir.Model.Attachment _Attachment; + private Hl7.Fhir.Model.Attachment? _Attachment; protected internal override void CopyToInternal(Base other) { - var dest = other as StructuralRepresentationComponent; - - if (dest == null) - { + if(other is not StructuralRepresentationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(RepresentationElement != null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)RepresentationElement.DeepCopyInternal(); - if(Format != null) dest.Format = (Hl7.Fhir.Model.CodeableConcept)Format.DeepCopyInternal(); - if(Attachment != null) dest.Attachment = (Hl7.Fhir.Model.Attachment)Attachment.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_RepresentationElement is not null) dest.RepresentationElement = (Hl7.Fhir.Model.FhirString)_RepresentationElement.DeepCopyInternal(); + if(_Format is not null) dest.Format = (Hl7.Fhir.Model.CodeableConcept)_Format.DeepCopyInternal(); + if(_Attachment is not null) dest.Attachment = (Hl7.Fhir.Model.Attachment)_Attachment.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1035,55 +990,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as StructuralRepresentationComponent; - if(otherT == null) return false; + if(other is not StructuralRepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(RepresentationElement, otherT.RepresentationElement)) return false; - if(!comparer.Equals(Format, otherT.Format)) return false; - if(!comparer.Equals(Attachment, otherT.Attachment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; + if(!comparer.Equals(_Format, otherT._Format)) return false; + if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "representation": - value = RepresentationElement; - return RepresentationElement is not null; + value = _RepresentationElement; + return _RepresentationElement is not null; case "format": - value = Format; - return Format is not null; + value = _Format; + return _Format is not null; case "attachment": - value = Attachment; - return Attachment is not null; + value = _Attachment; + return _Attachment is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "representation": - RepresentationElement = (Hl7.Fhir.Model.FhirString)value; + RepresentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "format": - Format = (Hl7.Fhir.Model.CodeableConcept)value; + Format = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "attachment": - Attachment = (Hl7.Fhir.Model.Attachment)value; + Attachment = (Hl7.Fhir.Model.Attachment?)value; return this; default: return base.SetValue(key, value); @@ -1094,10 +1049,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (RepresentationElement is not null) yield return new KeyValuePair("representation",RepresentationElement); - if (Format is not null) yield return new KeyValuePair("format",Format); - if (Attachment is not null) yield return new KeyValuePair("attachment",Attachment); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_RepresentationElement is not null) yield return new KeyValuePair("representation",_RepresentationElement); + if (_Format is not null) yield return new KeyValuePair("format",_Format); + if (_Attachment is not null) yield return new KeyValuePair("attachment",_Attachment); } } @@ -1107,39 +1062,39 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Overall type of the polymer. /// [FhirElement("class", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Class + public Hl7.Fhir.Model.CodeableConcept? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.CodeableConcept _Class; + private Hl7.Fhir.Model.CodeableConcept? _Class; /// /// Polymer geometry, e.g. linear, branched, cross-linked, network or dendritic. /// [FhirElement("geometry", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Geometry + public Hl7.Fhir.Model.CodeableConcept? Geometry { get { return _Geometry; } set { _Geometry = value; OnPropertyChanged("Geometry"); } } - private Hl7.Fhir.Model.CodeableConcept _Geometry; + private Hl7.Fhir.Model.CodeableConcept? _Geometry; /// /// Descrtibes the copolymer sequence type (polymer connectivity). @@ -1149,39 +1104,36 @@ public Hl7.Fhir.Model.CodeableConcept Geometry [DataMember] public List CopolymerConnectivity { - get { if(_CopolymerConnectivity==null) _CopolymerConnectivity = new List(); return _CopolymerConnectivity; } + get => _CopolymerConnectivity ?? new List(); set { _CopolymerConnectivity = value; OnPropertyChanged("CopolymerConnectivity"); } } - private List _CopolymerConnectivity; + private List? _CopolymerConnectivity; /// /// Todo - this is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder. /// [FhirElement("modification", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString ModificationElement + public Hl7.Fhir.Model.FhirString? ModificationElement { get { return _ModificationElement; } set { _ModificationElement = value; OnPropertyChanged("ModificationElement"); } } - private Hl7.Fhir.Model.FhirString _ModificationElement; + private Hl7.Fhir.Model.FhirString? _ModificationElement; /// /// Todo - this is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Modification + public string? Modification { - get { return ModificationElement != null ? ModificationElement.Value : null; } + get => _ModificationElement?.Value; set { - if (value == null) - ModificationElement = null; - else - ModificationElement = new Hl7.Fhir.Model.FhirString(value); + ModificationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Modification"); } } @@ -1194,11 +1146,11 @@ public string Modification [DataMember] public List MonomerSet { - get { if(_MonomerSet==null) _MonomerSet = new List(); return _MonomerSet; } + get => _MonomerSet ?? new List(); set { _MonomerSet = value; OnPropertyChanged("MonomerSet"); } } - private List _MonomerSet; + private List? _MonomerSet; /// /// Specifies and quantifies the repeated units and their configuration. @@ -1208,31 +1160,27 @@ public List MonomerSet [DataMember] public List Repeat { - get { if(_Repeat==null) _Repeat = new List(); return _Repeat; } + get => _Repeat ?? new List(); set { _Repeat = value; OnPropertyChanged("Repeat"); } } - private List _Repeat; + private List? _Repeat; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SubstancePolymer; - - if (dest == null) - { + if(other is not SubstancePolymer dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(Class != null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopyInternal(); - if(Geometry != null) dest.Geometry = (Hl7.Fhir.Model.CodeableConcept)Geometry.DeepCopyInternal(); - if(CopolymerConnectivity.Any()) dest.CopolymerConnectivity = new List(CopolymerConnectivity.DeepCopyInternal()); - if(ModificationElement != null) dest.ModificationElement = (Hl7.Fhir.Model.FhirString)ModificationElement.DeepCopyInternal(); - if(MonomerSet.Any()) dest.MonomerSet = new List(MonomerSet.DeepCopyInternal()); - if(Repeat.Any()) dest.Repeat = new List(Repeat.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)_Class.DeepCopyInternal(); + if(_Geometry is not null) dest.Geometry = (Hl7.Fhir.Model.CodeableConcept)_Geometry.DeepCopyInternal(); + if(_CopolymerConnectivity is not null) dest.CopolymerConnectivity = new List(_CopolymerConnectivity.DeepCopyInternal()); + if(_ModificationElement is not null) dest.ModificationElement = (Hl7.Fhir.Model.FhirString)_ModificationElement.DeepCopyInternal(); + if(_MonomerSet is not null) dest.MonomerSet = new List(_MonomerSet.DeepCopyInternal()); + if(_Repeat is not null) dest.Repeat = new List(_Repeat.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1244,76 +1192,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstancePolymer; - if(otherT == null) return false; + if(other is not SubstancePolymer otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Geometry, otherT.Geometry)) return false; - if(!comparer.ListEquals(CopolymerConnectivity, otherT.CopolymerConnectivity)) return false; - if(!comparer.Equals(ModificationElement, otherT.ModificationElement)) return false; - if(!comparer.ListEquals(MonomerSet, otherT.MonomerSet)) return false; - if(!comparer.ListEquals(Repeat, otherT.Repeat)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Geometry, otherT._Geometry)) return false; + if(!comparer.ListEquals(_CopolymerConnectivity, otherT._CopolymerConnectivity)) return false; + if(!comparer.Equals(_ModificationElement, otherT._ModificationElement)) return false; + if(!comparer.ListEquals(_MonomerSet, otherT._MonomerSet)) return false; + if(!comparer.ListEquals(_Repeat, otherT._Repeat)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "geometry": - value = Geometry; - return Geometry is not null; + value = _Geometry; + return _Geometry is not null; case "copolymerConnectivity": - value = CopolymerConnectivity; - return CopolymerConnectivity?.Any() == true; + value = _CopolymerConnectivity; + return _CopolymerConnectivity?.Any() == true; case "modification": - value = ModificationElement; - return ModificationElement is not null; + value = _ModificationElement; + return _ModificationElement is not null; case "monomerSet": - value = MonomerSet; - return MonomerSet?.Any() == true; + value = _MonomerSet; + return _MonomerSet?.Any() == true; case "repeat": - value = Repeat; - return Repeat?.Any() == true; + value = _Repeat; + return _Repeat?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "class": - Class = (Hl7.Fhir.Model.CodeableConcept)value; + Class = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "geometry": - Geometry = (Hl7.Fhir.Model.CodeableConcept)value; + Geometry = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "copolymerConnectivity": - CopolymerConnectivity = (List)value; + CopolymerConnectivity = (List?)value!; return this; case "modification": - ModificationElement = (Hl7.Fhir.Model.FhirString)value; + ModificationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "monomerSet": - MonomerSet = (List)value; + MonomerSet = (List?)value!; return this; case "repeat": - Repeat = (List)value; + Repeat = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1324,13 +1272,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Geometry is not null) yield return new KeyValuePair("geometry",Geometry); - if (CopolymerConnectivity?.Any() == true) yield return new KeyValuePair("copolymerConnectivity",CopolymerConnectivity); - if (ModificationElement is not null) yield return new KeyValuePair("modification",ModificationElement); - if (MonomerSet?.Any() == true) yield return new KeyValuePair("monomerSet",MonomerSet); - if (Repeat?.Any() == true) yield return new KeyValuePair("repeat",Repeat); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Geometry is not null) yield return new KeyValuePair("geometry",_Geometry); + if (_CopolymerConnectivity?.Any() == true) yield return new KeyValuePair("copolymerConnectivity",_CopolymerConnectivity); + if (_ModificationElement is not null) yield return new KeyValuePair("modification",_ModificationElement); + if (_MonomerSet?.Any() == true) yield return new KeyValuePair("monomerSet",_MonomerSet); + if (_Repeat?.Any() == true) yield return new KeyValuePair("repeat",_Repeat); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs index c59ff8e46..0a71a150b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,13 +77,13 @@ public partial class SubunitComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("subunit", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SubunitElement + public Hl7.Fhir.Model.Integer? SubunitElement { get { return _SubunitElement; } set { _SubunitElement = value; OnPropertyChanged("SubunitElement"); } } - private Hl7.Fhir.Model.Integer _SubunitElement; + private Hl7.Fhir.Model.Integer? _SubunitElement; /// /// Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts @@ -89,13 +92,10 @@ public Hl7.Fhir.Model.Integer SubunitElement [IgnoreDataMember] public int? Subunit { - get { return SubunitElement != null ? SubunitElement.Value : null; } + get => _SubunitElement?.Value; set { - if (value == null) - SubunitElement = null; - else - SubunitElement = new Hl7.Fhir.Model.Integer(value); + SubunitElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Subunit"); } } @@ -105,28 +105,25 @@ public int? Subunit /// [FhirElement("sequence", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString SequenceElement + public Hl7.Fhir.Model.FhirString? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.FhirString _SequenceElement; + private Hl7.Fhir.Model.FhirString? _SequenceElement; /// /// The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Sequence + public string? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.FhirString(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Sequence"); } } @@ -136,13 +133,13 @@ public string Sequence /// [FhirElement("length", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Integer LengthElement + public Hl7.Fhir.Model.Integer? LengthElement { get { return _LengthElement; } set { _LengthElement = value; OnPropertyChanged("LengthElement"); } } - private Hl7.Fhir.Model.Integer _LengthElement; + private Hl7.Fhir.Model.Integer? _LengthElement; /// /// Length of linear sequences of amino acids contained in the subunit @@ -151,13 +148,10 @@ public Hl7.Fhir.Model.Integer LengthElement [IgnoreDataMember] public int? Length { - get { return LengthElement != null ? LengthElement.Value : null; } + get => _LengthElement?.Value; set { - if (value == null) - LengthElement = null; - else - LengthElement = new Hl7.Fhir.Model.Integer(value); + LengthElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Length"); } } @@ -167,54 +161,51 @@ public int? Length /// [FhirElement("sequenceAttachment", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Attachment SequenceAttachment + public Hl7.Fhir.Model.Attachment? SequenceAttachment { get { return _SequenceAttachment; } set { _SequenceAttachment = value; OnPropertyChanged("SequenceAttachment"); } } - private Hl7.Fhir.Model.Attachment _SequenceAttachment; + private Hl7.Fhir.Model.Attachment? _SequenceAttachment; /// /// Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID. /// [FhirElement("nTerminalModificationId", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.Identifier NTerminalModificationId + public Hl7.Fhir.Model.Identifier? NTerminalModificationId { get { return _NTerminalModificationId; } set { _NTerminalModificationId = value; OnPropertyChanged("NTerminalModificationId"); } } - private Hl7.Fhir.Model.Identifier _NTerminalModificationId; + private Hl7.Fhir.Model.Identifier? _NTerminalModificationId; /// /// The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified. /// [FhirElement("nTerminalModification", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString NTerminalModificationElement + public Hl7.Fhir.Model.FhirString? NTerminalModificationElement { get { return _NTerminalModificationElement; } set { _NTerminalModificationElement = value; OnPropertyChanged("NTerminalModificationElement"); } } - private Hl7.Fhir.Model.FhirString _NTerminalModificationElement; + private Hl7.Fhir.Model.FhirString? _NTerminalModificationElement; /// /// The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string NTerminalModification + public string? NTerminalModification { - get { return NTerminalModificationElement != null ? NTerminalModificationElement.Value : null; } + get => _NTerminalModificationElement?.Value; set { - if (value == null) - NTerminalModificationElement = null; - else - NTerminalModificationElement = new Hl7.Fhir.Model.FhirString(value); + NTerminalModificationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("NTerminalModification"); } } @@ -224,63 +215,56 @@ public string NTerminalModification /// [FhirElement("cTerminalModificationId", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Identifier CTerminalModificationId + public Hl7.Fhir.Model.Identifier? CTerminalModificationId { get { return _CTerminalModificationId; } set { _CTerminalModificationId = value; OnPropertyChanged("CTerminalModificationId"); } } - private Hl7.Fhir.Model.Identifier _CTerminalModificationId; + private Hl7.Fhir.Model.Identifier? _CTerminalModificationId; /// /// The modification at the C-terminal shall be specified. /// [FhirElement("cTerminalModification", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirString CTerminalModificationElement + public Hl7.Fhir.Model.FhirString? CTerminalModificationElement { get { return _CTerminalModificationElement; } set { _CTerminalModificationElement = value; OnPropertyChanged("CTerminalModificationElement"); } } - private Hl7.Fhir.Model.FhirString _CTerminalModificationElement; + private Hl7.Fhir.Model.FhirString? _CTerminalModificationElement; /// /// The modification at the C-terminal shall be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CTerminalModification + public string? CTerminalModification { - get { return CTerminalModificationElement != null ? CTerminalModificationElement.Value : null; } + get => _CTerminalModificationElement?.Value; set { - if (value == null) - CTerminalModificationElement = null; - else - CTerminalModificationElement = new Hl7.Fhir.Model.FhirString(value); + CTerminalModificationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CTerminalModification"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SubunitComponent; - - if (dest == null) - { + if(other is not SubunitComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SubunitElement != null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)SubunitElement.DeepCopyInternal(); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)SequenceElement.DeepCopyInternal(); - if(LengthElement != null) dest.LengthElement = (Hl7.Fhir.Model.Integer)LengthElement.DeepCopyInternal(); - if(SequenceAttachment != null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)SequenceAttachment.DeepCopyInternal(); - if(NTerminalModificationId != null) dest.NTerminalModificationId = (Hl7.Fhir.Model.Identifier)NTerminalModificationId.DeepCopyInternal(); - if(NTerminalModificationElement != null) dest.NTerminalModificationElement = (Hl7.Fhir.Model.FhirString)NTerminalModificationElement.DeepCopyInternal(); - if(CTerminalModificationId != null) dest.CTerminalModificationId = (Hl7.Fhir.Model.Identifier)CTerminalModificationId.DeepCopyInternal(); - if(CTerminalModificationElement != null) dest.CTerminalModificationElement = (Hl7.Fhir.Model.FhirString)CTerminalModificationElement.DeepCopyInternal(); + if(_SubunitElement is not null) dest.SubunitElement = (Hl7.Fhir.Model.Integer)_SubunitElement.DeepCopyInternal(); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.FhirString)_SequenceElement.DeepCopyInternal(); + if(_LengthElement is not null) dest.LengthElement = (Hl7.Fhir.Model.Integer)_LengthElement.DeepCopyInternal(); + if(_SequenceAttachment is not null) dest.SequenceAttachment = (Hl7.Fhir.Model.Attachment)_SequenceAttachment.DeepCopyInternal(); + if(_NTerminalModificationId is not null) dest.NTerminalModificationId = (Hl7.Fhir.Model.Identifier)_NTerminalModificationId.DeepCopyInternal(); + if(_NTerminalModificationElement is not null) dest.NTerminalModificationElement = (Hl7.Fhir.Model.FhirString)_NTerminalModificationElement.DeepCopyInternal(); + if(_CTerminalModificationId is not null) dest.CTerminalModificationId = (Hl7.Fhir.Model.Identifier)_CTerminalModificationId.DeepCopyInternal(); + if(_CTerminalModificationElement is not null) dest.CTerminalModificationElement = (Hl7.Fhir.Model.FhirString)_CTerminalModificationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -292,83 +276,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubunitComponent; - if(otherT == null) return false; + if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SubunitElement, otherT.SubunitElement)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.Equals(LengthElement, otherT.LengthElement)) return false; - if(!comparer.Equals(SequenceAttachment, otherT.SequenceAttachment)) return false; - if(!comparer.Equals(NTerminalModificationId, otherT.NTerminalModificationId)) return false; - if(!comparer.Equals(NTerminalModificationElement, otherT.NTerminalModificationElement)) return false; - if(!comparer.Equals(CTerminalModificationId, otherT.CTerminalModificationId)) return false; - if(!comparer.Equals(CTerminalModificationElement, otherT.CTerminalModificationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; + if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; + if(!comparer.Equals(_NTerminalModificationId, otherT._NTerminalModificationId)) return false; + if(!comparer.Equals(_NTerminalModificationElement, otherT._NTerminalModificationElement)) return false; + if(!comparer.Equals(_CTerminalModificationId, otherT._CTerminalModificationId)) return false; + if(!comparer.Equals(_CTerminalModificationElement, otherT._CTerminalModificationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "subunit": - value = SubunitElement; - return SubunitElement is not null; + value = _SubunitElement; + return _SubunitElement is not null; case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "length": - value = LengthElement; - return LengthElement is not null; + value = _LengthElement; + return _LengthElement is not null; case "sequenceAttachment": - value = SequenceAttachment; - return SequenceAttachment is not null; + value = _SequenceAttachment; + return _SequenceAttachment is not null; case "nTerminalModificationId": - value = NTerminalModificationId; - return NTerminalModificationId is not null; + value = _NTerminalModificationId; + return _NTerminalModificationId is not null; case "nTerminalModification": - value = NTerminalModificationElement; - return NTerminalModificationElement is not null; + value = _NTerminalModificationElement; + return _NTerminalModificationElement is not null; case "cTerminalModificationId": - value = CTerminalModificationId; - return CTerminalModificationId is not null; + value = _CTerminalModificationId; + return _CTerminalModificationId is not null; case "cTerminalModification": - value = CTerminalModificationElement; - return CTerminalModificationElement is not null; + value = _CTerminalModificationElement; + return _CTerminalModificationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "subunit": - SubunitElement = (Hl7.Fhir.Model.Integer)value; + SubunitElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequence": - SequenceElement = (Hl7.Fhir.Model.FhirString)value; + SequenceElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "length": - LengthElement = (Hl7.Fhir.Model.Integer)value; + LengthElement = (Hl7.Fhir.Model.Integer?)value; return this; case "sequenceAttachment": - SequenceAttachment = (Hl7.Fhir.Model.Attachment)value; + SequenceAttachment = (Hl7.Fhir.Model.Attachment?)value; return this; case "nTerminalModificationId": - NTerminalModificationId = (Hl7.Fhir.Model.Identifier)value; + NTerminalModificationId = (Hl7.Fhir.Model.Identifier?)value; return this; case "nTerminalModification": - NTerminalModificationElement = (Hl7.Fhir.Model.FhirString)value; + NTerminalModificationElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "cTerminalModificationId": - CTerminalModificationId = (Hl7.Fhir.Model.Identifier)value; + CTerminalModificationId = (Hl7.Fhir.Model.Identifier?)value; return this; case "cTerminalModification": - CTerminalModificationElement = (Hl7.Fhir.Model.FhirString)value; + CTerminalModificationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -379,14 +363,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SubunitElement is not null) yield return new KeyValuePair("subunit",SubunitElement); - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (LengthElement is not null) yield return new KeyValuePair("length",LengthElement); - if (SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",SequenceAttachment); - if (NTerminalModificationId is not null) yield return new KeyValuePair("nTerminalModificationId",NTerminalModificationId); - if (NTerminalModificationElement is not null) yield return new KeyValuePair("nTerminalModification",NTerminalModificationElement); - if (CTerminalModificationId is not null) yield return new KeyValuePair("cTerminalModificationId",CTerminalModificationId); - if (CTerminalModificationElement is not null) yield return new KeyValuePair("cTerminalModification",CTerminalModificationElement); + if (_SubunitElement is not null) yield return new KeyValuePair("subunit",_SubunitElement); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_LengthElement is not null) yield return new KeyValuePair("length",_LengthElement); + if (_SequenceAttachment is not null) yield return new KeyValuePair("sequenceAttachment",_SequenceAttachment); + if (_NTerminalModificationId is not null) yield return new KeyValuePair("nTerminalModificationId",_NTerminalModificationId); + if (_NTerminalModificationElement is not null) yield return new KeyValuePair("nTerminalModification",_NTerminalModificationElement); + if (_CTerminalModificationId is not null) yield return new KeyValuePair("cTerminalModificationId",_CTerminalModificationId); + if (_CTerminalModificationElement is not null) yield return new KeyValuePair("cTerminalModification",_CTerminalModificationElement); } } @@ -396,26 +380,26 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sequenceType", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SequenceType + public Hl7.Fhir.Model.CodeableConcept? SequenceType { get { return _SequenceType; } set { _SequenceType = value; OnPropertyChanged("SequenceType"); } } - private Hl7.Fhir.Model.CodeableConcept _SequenceType; + private Hl7.Fhir.Model.CodeableConcept? _SequenceType; /// /// Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable. /// [FhirElement("numberOfSubunits", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer NumberOfSubunitsElement + public Hl7.Fhir.Model.Integer? NumberOfSubunitsElement { get { return _NumberOfSubunitsElement; } set { _NumberOfSubunitsElement = value; OnPropertyChanged("NumberOfSubunitsElement"); } } - private Hl7.Fhir.Model.Integer _NumberOfSubunitsElement; + private Hl7.Fhir.Model.Integer? _NumberOfSubunitsElement; /// /// Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable @@ -424,13 +408,10 @@ public Hl7.Fhir.Model.Integer NumberOfSubunitsElement [IgnoreDataMember] public int? NumberOfSubunits { - get { return NumberOfSubunitsElement != null ? NumberOfSubunitsElement.Value : null; } + get => _NumberOfSubunitsElement?.Value; set { - if (value == null) - NumberOfSubunitsElement = null; - else - NumberOfSubunitsElement = new Hl7.Fhir.Model.Integer(value); + NumberOfSubunitsElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("NumberOfSubunits"); } } @@ -443,24 +424,24 @@ public int? NumberOfSubunits [DataMember] public List DisulfideLinkageElement { - get { if(_DisulfideLinkageElement==null) _DisulfideLinkageElement = new List(); return _DisulfideLinkageElement; } + get => _DisulfideLinkageElement ?? new List(); set { _DisulfideLinkageElement = value; OnPropertyChanged("DisulfideLinkageElement"); } } - private List _DisulfideLinkageElement; + private List? _DisulfideLinkageElement; /// /// The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DisulfideLinkage + public IEnumerable? DisulfideLinkage { - get { return DisulfideLinkageElement != null ? DisulfideLinkageElement.Select(elem => elem.Value) : null; } + get => _DisulfideLinkageElement?.Select(elem => elem.Value); set { if (value == null) - DisulfideLinkageElement = null; + DisulfideLinkageElement = null!; else DisulfideLinkageElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("DisulfideLinkage"); @@ -475,26 +456,22 @@ public IEnumerable DisulfideLinkage [DataMember] public List Subunit { - get { if(_Subunit==null) _Subunit = new List(); return _Subunit; } + get => _Subunit ?? new List(); set { _Subunit = value; OnPropertyChanged("Subunit"); } } - private List _Subunit; + private List? _Subunit; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceProtein; - - if (dest == null) - { + if(other is not SubstanceProtein dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceType != null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)SequenceType.DeepCopyInternal(); - if(NumberOfSubunitsElement != null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)NumberOfSubunitsElement.DeepCopyInternal(); - if(DisulfideLinkageElement.Any()) dest.DisulfideLinkageElement = new List(DisulfideLinkageElement.DeepCopyInternal()); - if(Subunit.Any()) dest.Subunit = new List(Subunit.DeepCopyInternal()); + if(_SequenceType is not null) dest.SequenceType = (Hl7.Fhir.Model.CodeableConcept)_SequenceType.DeepCopyInternal(); + if(_NumberOfSubunitsElement is not null) dest.NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)_NumberOfSubunitsElement.DeepCopyInternal(); + if(_DisulfideLinkageElement is not null) dest.DisulfideLinkageElement = new List(_DisulfideLinkageElement.DeepCopyInternal()); + if(_Subunit is not null) dest.Subunit = new List(_Subunit.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -506,55 +483,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceProtein; - if(otherT == null) return false; + if(other is not SubstanceProtein otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceType, otherT.SequenceType)) return false; - if(!comparer.Equals(NumberOfSubunitsElement, otherT.NumberOfSubunitsElement)) return false; - if(!comparer.ListEquals(DisulfideLinkageElement, otherT.DisulfideLinkageElement)) return false; - if(!comparer.ListEquals(Subunit, otherT.Subunit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; + if(!comparer.ListEquals(_DisulfideLinkageElement, otherT._DisulfideLinkageElement)) return false; + if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequenceType": - value = SequenceType; - return SequenceType is not null; + value = _SequenceType; + return _SequenceType is not null; case "numberOfSubunits": - value = NumberOfSubunitsElement; - return NumberOfSubunitsElement is not null; + value = _NumberOfSubunitsElement; + return _NumberOfSubunitsElement is not null; case "disulfideLinkage": - value = DisulfideLinkageElement; - return DisulfideLinkageElement?.Any() == true; + value = _DisulfideLinkageElement; + return _DisulfideLinkageElement?.Any() == true; case "subunit": - value = Subunit; - return Subunit?.Any() == true; + value = _Subunit; + return _Subunit?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequenceType": - SequenceType = (Hl7.Fhir.Model.CodeableConcept)value; + SequenceType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "numberOfSubunits": - NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer)value; + NumberOfSubunitsElement = (Hl7.Fhir.Model.Integer?)value; return this; case "disulfideLinkage": - DisulfideLinkageElement = (List)value; + DisulfideLinkageElement = (List?)value!; return this; case "subunit": - Subunit = (List)value; + Subunit = (List?)value!; return this; default: return base.SetValue(key, value); @@ -565,10 +542,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceType is not null) yield return new KeyValuePair("sequenceType",SequenceType); - if (NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",NumberOfSubunitsElement); - if (DisulfideLinkageElement?.Any() == true) yield return new KeyValuePair("disulfideLinkage",DisulfideLinkageElement); - if (Subunit?.Any() == true) yield return new KeyValuePair("subunit",Subunit); + if (_SequenceType is not null) yield return new KeyValuePair("sequenceType",_SequenceType); + if (_NumberOfSubunitsElement is not null) yield return new KeyValuePair("numberOfSubunits",_NumberOfSubunitsElement); + if (_DisulfideLinkageElement?.Any() == true) yield return new KeyValuePair("disulfideLinkage",_DisulfideLinkageElement); + if (_Subunit?.Any() == true) yield return new KeyValuePair("subunit",_Subunit); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs index 031e75a50..b854c5e14 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,26 +77,26 @@ public partial class GeneComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("geneSequenceOrigin", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept GeneSequenceOrigin + public Hl7.Fhir.Model.CodeableConcept? GeneSequenceOrigin { get { return _GeneSequenceOrigin; } set { _GeneSequenceOrigin = value; OnPropertyChanged("GeneSequenceOrigin"); } } - private Hl7.Fhir.Model.CodeableConcept _GeneSequenceOrigin; + private Hl7.Fhir.Model.CodeableConcept? _GeneSequenceOrigin; /// /// Todo. /// [FhirElement("gene", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Gene + public Hl7.Fhir.Model.CodeableConcept? Gene { get { return _Gene; } set { _Gene = value; OnPropertyChanged("Gene"); } } - private Hl7.Fhir.Model.CodeableConcept _Gene; + private Hl7.Fhir.Model.CodeableConcept? _Gene; /// /// Todo. @@ -105,25 +108,21 @@ public Hl7.Fhir.Model.CodeableConcept Gene [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as GeneComponent; - - if (dest == null) - { + if(other is not GeneComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(GeneSequenceOrigin != null) dest.GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept)GeneSequenceOrigin.DeepCopyInternal(); - if(Gene != null) dest.Gene = (Hl7.Fhir.Model.CodeableConcept)Gene.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_GeneSequenceOrigin is not null) dest.GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept)_GeneSequenceOrigin.DeepCopyInternal(); + if(_Gene is not null) dest.Gene = (Hl7.Fhir.Model.CodeableConcept)_Gene.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -135,48 +134,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GeneComponent; - if(otherT == null) return false; + if(other is not GeneComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(GeneSequenceOrigin, otherT.GeneSequenceOrigin)) return false; - if(!comparer.Equals(Gene, otherT.Gene)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GeneSequenceOrigin, otherT._GeneSequenceOrigin)) return false; + if(!comparer.Equals(_Gene, otherT._Gene)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "geneSequenceOrigin": - value = GeneSequenceOrigin; - return GeneSequenceOrigin is not null; + value = _GeneSequenceOrigin; + return _GeneSequenceOrigin is not null; case "gene": - value = Gene; - return Gene is not null; + value = _Gene; + return _Gene is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "geneSequenceOrigin": - GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept)value; + GeneSequenceOrigin = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "gene": - Gene = (Hl7.Fhir.Model.CodeableConcept)value; + Gene = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -187,9 +186,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (GeneSequenceOrigin is not null) yield return new KeyValuePair("geneSequenceOrigin",GeneSequenceOrigin); - if (Gene is not null) yield return new KeyValuePair("gene",Gene); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_GeneSequenceOrigin is not null) yield return new KeyValuePair("geneSequenceOrigin",_GeneSequenceOrigin); + if (_Gene is not null) yield return new KeyValuePair("gene",_Gene); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -212,26 +211,26 @@ public partial class GeneElementComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("type", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Todo. /// [FhirElement("element", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Identifier Element + public Hl7.Fhir.Model.Identifier? Element { get { return _Element; } set { _Element = value; OnPropertyChanged("Element"); } } - private Hl7.Fhir.Model.Identifier _Element; + private Hl7.Fhir.Model.Identifier? _Element; /// /// Todo. @@ -243,25 +242,21 @@ public Hl7.Fhir.Model.Identifier Element [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as GeneElementComponent; - - if (dest == null) - { + if(other is not GeneElementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Element != null) dest.Element = (Hl7.Fhir.Model.Identifier)Element.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Element is not null) dest.Element = (Hl7.Fhir.Model.Identifier)_Element.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -273,48 +268,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as GeneElementComponent; - if(otherT == null) return false; + if(other is not GeneElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Element, otherT.Element)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Element, otherT._Element)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "element": - value = Element; - return Element is not null; + value = _Element; + return _Element is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "element": - Element = (Hl7.Fhir.Model.Identifier)value; + Element = (Hl7.Fhir.Model.Identifier?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -325,9 +320,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Element is not null) yield return new KeyValuePair("element",Element); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Element is not null) yield return new KeyValuePair("element",_Element); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -350,65 +345,65 @@ public partial class TargetComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("target", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.Identifier Target + public Hl7.Fhir.Model.Identifier? Target { get { return _Target; } set { _Target = value; OnPropertyChanged("Target"); } } - private Hl7.Fhir.Model.Identifier _Target; + private Hl7.Fhir.Model.Identifier? _Target; /// /// Todo. /// [FhirElement("type", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Todo. /// [FhirElement("interaction", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Interaction + public Hl7.Fhir.Model.CodeableConcept? Interaction { get { return _Interaction; } set { _Interaction = value; OnPropertyChanged("Interaction"); } } - private Hl7.Fhir.Model.CodeableConcept _Interaction; + private Hl7.Fhir.Model.CodeableConcept? _Interaction; /// /// Todo. /// [FhirElement("organism", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Organism + public Hl7.Fhir.Model.CodeableConcept? Organism { get { return _Organism; } set { _Organism = value; OnPropertyChanged("Organism"); } } - private Hl7.Fhir.Model.CodeableConcept _Organism; + private Hl7.Fhir.Model.CodeableConcept? _Organism; /// /// Todo. /// [FhirElement("organismType", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept OrganismType + public Hl7.Fhir.Model.CodeableConcept? OrganismType { get { return _OrganismType; } set { _OrganismType = value; OnPropertyChanged("OrganismType"); } } - private Hl7.Fhir.Model.CodeableConcept _OrganismType; + private Hl7.Fhir.Model.CodeableConcept? _OrganismType; /// /// Todo. @@ -417,26 +412,26 @@ public Hl7.Fhir.Model.CodeableConcept OrganismType [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirString))] [DataMember] - public Hl7.Fhir.Model.DataType Amount + public Hl7.Fhir.Model.DataType? Amount { get { return _Amount; } set { _Amount = value; OnPropertyChanged("Amount"); } } - private Hl7.Fhir.Model.DataType _Amount; + private Hl7.Fhir.Model.DataType? _Amount; /// /// Todo. /// [FhirElement("amountType", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AmountType + public Hl7.Fhir.Model.CodeableConcept? AmountType { get { return _AmountType; } set { _AmountType = value; OnPropertyChanged("AmountType"); } } - private Hl7.Fhir.Model.CodeableConcept _AmountType; + private Hl7.Fhir.Model.CodeableConcept? _AmountType; /// /// Todo. @@ -448,30 +443,26 @@ public Hl7.Fhir.Model.CodeableConcept AmountType [DataMember] public List Source { - get { if(_Source==null) _Source = new List(); return _Source; } + get => _Source ?? new List(); set { _Source = value; OnPropertyChanged("Source"); } } - private List _Source; + private List? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as TargetComponent; - - if (dest == null) - { + if(other is not TargetComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target != null) dest.Target = (Hl7.Fhir.Model.Identifier)Target.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Interaction != null) dest.Interaction = (Hl7.Fhir.Model.CodeableConcept)Interaction.DeepCopyInternal(); - if(Organism != null) dest.Organism = (Hl7.Fhir.Model.CodeableConcept)Organism.DeepCopyInternal(); - if(OrganismType != null) dest.OrganismType = (Hl7.Fhir.Model.CodeableConcept)OrganismType.DeepCopyInternal(); - if(Amount != null) dest.Amount = (Hl7.Fhir.Model.DataType)Amount.DeepCopyInternal(); - if(AmountType != null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)AmountType.DeepCopyInternal(); - if(Source.Any()) dest.Source = new List(Source.DeepCopyInternal()); + if(_Target is not null) dest.Target = (Hl7.Fhir.Model.Identifier)_Target.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Interaction is not null) dest.Interaction = (Hl7.Fhir.Model.CodeableConcept)_Interaction.DeepCopyInternal(); + if(_Organism is not null) dest.Organism = (Hl7.Fhir.Model.CodeableConcept)_Organism.DeepCopyInternal(); + if(_OrganismType is not null) dest.OrganismType = (Hl7.Fhir.Model.CodeableConcept)_OrganismType.DeepCopyInternal(); + if(_Amount is not null) dest.Amount = (Hl7.Fhir.Model.DataType)_Amount.DeepCopyInternal(); + if(_AmountType is not null) dest.AmountType = (Hl7.Fhir.Model.CodeableConcept)_AmountType.DeepCopyInternal(); + if(_Source is not null) dest.Source = new List(_Source.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -483,83 +474,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TargetComponent; - if(otherT == null) return false; + if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Target, otherT.Target)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Interaction, otherT.Interaction)) return false; - if(!comparer.Equals(Organism, otherT.Organism)) return false; - if(!comparer.Equals(OrganismType, otherT.OrganismType)) return false; - if(!comparer.Equals(Amount, otherT.Amount)) return false; - if(!comparer.Equals(AmountType, otherT.AmountType)) return false; - if(!comparer.ListEquals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Interaction, otherT._Interaction)) return false; + if(!comparer.Equals(_Organism, otherT._Organism)) return false; + if(!comparer.Equals(_OrganismType, otherT._OrganismType)) return false; + if(!comparer.Equals(_Amount, otherT._Amount)) return false; + if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; + if(!comparer.ListEquals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target is not null; + value = _Target; + return _Target is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "interaction": - value = Interaction; - return Interaction is not null; + value = _Interaction; + return _Interaction is not null; case "organism": - value = Organism; - return Organism is not null; + value = _Organism; + return _Organism is not null; case "organismType": - value = OrganismType; - return OrganismType is not null; + value = _OrganismType; + return _OrganismType is not null; case "amount": - value = Amount; - return Amount is not null; + value = _Amount; + return _Amount is not null; case "amountType": - value = AmountType; - return AmountType is not null; + value = _AmountType; + return _AmountType is not null; case "source": - value = Source; - return Source?.Any() == true; + value = _Source; + return _Source?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (Hl7.Fhir.Model.Identifier)value; + Target = (Hl7.Fhir.Model.Identifier?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "interaction": - Interaction = (Hl7.Fhir.Model.CodeableConcept)value; + Interaction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "organism": - Organism = (Hl7.Fhir.Model.CodeableConcept)value; + Organism = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "organismType": - OrganismType = (Hl7.Fhir.Model.CodeableConcept)value; + OrganismType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "amount": - Amount = (Hl7.Fhir.Model.DataType)value; + Amount = (Hl7.Fhir.Model.DataType?)value; return this; case "amountType": - AmountType = (Hl7.Fhir.Model.CodeableConcept)value; + AmountType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (List)value; + Source = (List?)value!; return this; default: return base.SetValue(key, value); @@ -570,14 +561,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target is not null) yield return new KeyValuePair("target",Target); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Interaction is not null) yield return new KeyValuePair("interaction",Interaction); - if (Organism is not null) yield return new KeyValuePair("organism",Organism); - if (OrganismType is not null) yield return new KeyValuePair("organismType",OrganismType); - if (Amount is not null) yield return new KeyValuePair("amount",Amount); - if (AmountType is not null) yield return new KeyValuePair("amountType",AmountType); - if (Source?.Any() == true) yield return new KeyValuePair("source",Source); + if (_Target is not null) yield return new KeyValuePair("target",_Target); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Interaction is not null) yield return new KeyValuePair("interaction",_Interaction); + if (_Organism is not null) yield return new KeyValuePair("organism",_Organism); + if (_OrganismType is not null) yield return new KeyValuePair("organismType",_OrganismType); + if (_Amount is not null) yield return new KeyValuePair("amount",_Amount); + if (_AmountType is not null) yield return new KeyValuePair("amountType",_AmountType); + if (_Source?.Any() == true) yield return new KeyValuePair("source",_Source); } } @@ -587,28 +578,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("comment", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString CommentElement + public Hl7.Fhir.Model.FhirString? CommentElement { get { return _CommentElement; } set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } - private Hl7.Fhir.Model.FhirString _CommentElement; + private Hl7.Fhir.Model.FhirString? _CommentElement; /// /// Todo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Comment + public string? Comment { - get { return CommentElement != null ? CommentElement.Value : null; } + get => _CommentElement?.Value; set { - if (value == null) - CommentElement = null; - else - CommentElement = new Hl7.Fhir.Model.FhirString(value); + CommentElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Comment"); } } @@ -621,11 +609,11 @@ public string Comment [DataMember] public List Gene { - get { if(_Gene==null) _Gene = new List(); return _Gene; } + get => _Gene ?? new List(); set { _Gene = value; OnPropertyChanged("Gene"); } } - private List _Gene; + private List? _Gene; /// /// Todo. @@ -635,11 +623,11 @@ public List Gene [DataMember] public List GeneElement { - get { if(_GeneElement==null) _GeneElement = new List(); return _GeneElement; } + get => _GeneElement ?? new List(); set { _GeneElement = value; OnPropertyChanged("GeneElement"); } } - private List _GeneElement; + private List? _GeneElement; /// /// Todo. @@ -649,26 +637,22 @@ public List G [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceReferenceInformation; - - if (dest == null) - { + if(other is not SubstanceReferenceInformation dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CommentElement != null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)CommentElement.DeepCopyInternal(); - if(Gene.Any()) dest.Gene = new List(Gene.DeepCopyInternal()); - if(GeneElement.Any()) dest.GeneElement = new List(GeneElement.DeepCopyInternal()); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); + if(_CommentElement is not null) dest.CommentElement = (Hl7.Fhir.Model.FhirString)_CommentElement.DeepCopyInternal(); + if(_Gene is not null) dest.Gene = new List(_Gene.DeepCopyInternal()); + if(_GeneElement is not null) dest.GeneElement = new List(_GeneElement.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -680,55 +664,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceReferenceInformation; - if(otherT == null) return false; + if(other is not SubstanceReferenceInformation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CommentElement, otherT.CommentElement)) return false; - if(!comparer.ListEquals(Gene, otherT.Gene)) return false; - if(!comparer.ListEquals(GeneElement, otherT.GeneElement)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + if(!comparer.ListEquals(_Gene, otherT._Gene)) return false; + if(!comparer.ListEquals(_GeneElement, otherT._GeneElement)) return false; + if(!comparer.ListEquals(_Target, otherT._Target)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "comment": - value = CommentElement; - return CommentElement is not null; + value = _CommentElement; + return _CommentElement is not null; case "gene": - value = Gene; - return Gene?.Any() == true; + value = _Gene; + return _Gene?.Any() == true; case "geneElement": - value = GeneElement; - return GeneElement?.Any() == true; + value = _GeneElement; + return _GeneElement?.Any() == true; case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "comment": - CommentElement = (Hl7.Fhir.Model.FhirString)value; + CommentElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "gene": - Gene = (List)value; + Gene = (List?)value!; return this; case "geneElement": - GeneElement = (List)value; + GeneElement = (List?)value!; return this; case "target": - Target = (List)value; + Target = (List?)value!; return this; default: return base.SetValue(key, value); @@ -739,10 +723,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CommentElement is not null) yield return new KeyValuePair("comment",CommentElement); - if (Gene?.Any() == true) yield return new KeyValuePair("gene",Gene); - if (GeneElement?.Any() == true) yield return new KeyValuePair("geneElement",GeneElement); - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); + if (_CommentElement is not null) yield return new KeyValuePair("comment",_CommentElement); + if (_Gene?.Any() == true) yield return new KeyValuePair("gene",_Gene); + if (_GeneElement?.Any() == true) yield return new KeyValuePair("geneElement",_GeneElement); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs index ffc6598f6..fbf4ffcf1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -74,28 +77,25 @@ public partial class FractionDescriptionComponent : Hl7.Fhir.Model.BackboneEleme /// [FhirElement("fraction", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString FractionElement + public Hl7.Fhir.Model.FhirString? FractionElement { get { return _FractionElement; } set { _FractionElement = value; OnPropertyChanged("FractionElement"); } } - private Hl7.Fhir.Model.FhirString _FractionElement; + private Hl7.Fhir.Model.FhirString? _FractionElement; /// /// This element is capturing information about the fraction of a plant part, or human plasma for fractionation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Fraction + public string? Fraction { - get { return FractionElement != null ? FractionElement.Value : null; } + get => _FractionElement?.Value; set { - if (value == null) - FractionElement = null; - else - FractionElement = new Hl7.Fhir.Model.FhirString(value); + FractionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Fraction"); } } @@ -105,26 +105,22 @@ public string Fraction /// [FhirElement("materialType", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept MaterialType + public Hl7.Fhir.Model.CodeableConcept? MaterialType { get { return _MaterialType; } set { _MaterialType = value; OnPropertyChanged("MaterialType"); } } - private Hl7.Fhir.Model.CodeableConcept _MaterialType; + private Hl7.Fhir.Model.CodeableConcept? _MaterialType; protected internal override void CopyToInternal(Base other) { - var dest = other as FractionDescriptionComponent; - - if (dest == null) - { + if(other is not FractionDescriptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FractionElement != null) dest.FractionElement = (Hl7.Fhir.Model.FhirString)FractionElement.DeepCopyInternal(); - if(MaterialType != null) dest.MaterialType = (Hl7.Fhir.Model.CodeableConcept)MaterialType.DeepCopyInternal(); + if(_FractionElement is not null) dest.FractionElement = (Hl7.Fhir.Model.FhirString)_FractionElement.DeepCopyInternal(); + if(_MaterialType is not null) dest.MaterialType = (Hl7.Fhir.Model.CodeableConcept)_MaterialType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -136,41 +132,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FractionDescriptionComponent; - if(otherT == null) return false; + if(other is not FractionDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FractionElement, otherT.FractionElement)) return false; - if(!comparer.Equals(MaterialType, otherT.MaterialType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FractionElement, otherT._FractionElement)) return false; + if(!comparer.Equals(_MaterialType, otherT._MaterialType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "fraction": - value = FractionElement; - return FractionElement is not null; + value = _FractionElement; + return _FractionElement is not null; case "materialType": - value = MaterialType; - return MaterialType is not null; + value = _MaterialType; + return _MaterialType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "fraction": - FractionElement = (Hl7.Fhir.Model.FhirString)value; + FractionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "materialType": - MaterialType = (Hl7.Fhir.Model.CodeableConcept)value; + MaterialType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -181,8 +177,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FractionElement is not null) yield return new KeyValuePair("fraction",FractionElement); - if (MaterialType is not null) yield return new KeyValuePair("materialType",MaterialType); + if (_FractionElement is not null) yield return new KeyValuePair("fraction",_FractionElement); + if (_MaterialType is not null) yield return new KeyValuePair("materialType",_MaterialType); } } @@ -205,80 +201,77 @@ public partial class OrganismComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("family", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Family + public Hl7.Fhir.Model.CodeableConcept? Family { get { return _Family; } set { _Family = value; OnPropertyChanged("Family"); } } - private Hl7.Fhir.Model.CodeableConcept _Family; + private Hl7.Fhir.Model.CodeableConcept? _Family; /// /// The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies. /// [FhirElement("genus", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Genus + public Hl7.Fhir.Model.CodeableConcept? Genus { get { return _Genus; } set { _Genus = value; OnPropertyChanged("Genus"); } } - private Hl7.Fhir.Model.CodeableConcept _Genus; + private Hl7.Fhir.Model.CodeableConcept? _Genus; /// /// The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies. /// [FhirElement("species", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Species + public Hl7.Fhir.Model.CodeableConcept? Species { get { return _Species; } set { _Species = value; OnPropertyChanged("Species"); } } - private Hl7.Fhir.Model.CodeableConcept _Species; + private Hl7.Fhir.Model.CodeableConcept? _Species; /// /// The Intraspecific type of an organism shall be specified. /// [FhirElement("intraspecificType", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept IntraspecificType + public Hl7.Fhir.Model.CodeableConcept? IntraspecificType { get { return _IntraspecificType; } set { _IntraspecificType = value; OnPropertyChanged("IntraspecificType"); } } - private Hl7.Fhir.Model.CodeableConcept _IntraspecificType; + private Hl7.Fhir.Model.CodeableConcept? _IntraspecificType; /// /// The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention. /// [FhirElement("intraspecificDescription", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString IntraspecificDescriptionElement + public Hl7.Fhir.Model.FhirString? IntraspecificDescriptionElement { get { return _IntraspecificDescriptionElement; } set { _IntraspecificDescriptionElement = value; OnPropertyChanged("IntraspecificDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _IntraspecificDescriptionElement; + private Hl7.Fhir.Model.FhirString? _IntraspecificDescriptionElement; /// /// The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IntraspecificDescription + public string? IntraspecificDescription { - get { return IntraspecificDescriptionElement != null ? IntraspecificDescriptionElement.Value : null; } + get => _IntraspecificDescriptionElement?.Value; set { - if (value == null) - IntraspecificDescriptionElement = null; - else - IntraspecificDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + IntraspecificDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IntraspecificDescription"); } } @@ -291,56 +284,52 @@ public string IntraspecificDescription [DataMember] public List Author { - get { if(_Author==null) _Author = new List(); return _Author; } + get => _Author ?? new List(); set { _Author = value; OnPropertyChanged("Author"); } } - private List _Author; + private List? _Author; /// /// 4.9.13.8.1 Hybrid species maternal organism ID (Optional). /// [FhirElement("hybrid", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent Hybrid + public Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent? Hybrid { get { return _Hybrid; } set { _Hybrid = value; OnPropertyChanged("Hybrid"); } } - private Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent _Hybrid; + private Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent? _Hybrid; /// /// 4.9.13.7.1 Kingdom (Conditional). /// [FhirElement("organismGeneral", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent OrganismGeneral + public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent? OrganismGeneral { get { return _OrganismGeneral; } set { _OrganismGeneral = value; OnPropertyChanged("OrganismGeneral"); } } - private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent _OrganismGeneral; + private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent? _OrganismGeneral; protected internal override void CopyToInternal(Base other) { - var dest = other as OrganismComponent; - - if (dest == null) - { + if(other is not OrganismComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Family != null) dest.Family = (Hl7.Fhir.Model.CodeableConcept)Family.DeepCopyInternal(); - if(Genus != null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)Genus.DeepCopyInternal(); - if(Species != null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)Species.DeepCopyInternal(); - if(IntraspecificType != null) dest.IntraspecificType = (Hl7.Fhir.Model.CodeableConcept)IntraspecificType.DeepCopyInternal(); - if(IntraspecificDescriptionElement != null) dest.IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString)IntraspecificDescriptionElement.DeepCopyInternal(); - if(Author.Any()) dest.Author = new List(Author.DeepCopyInternal()); - if(Hybrid != null) dest.Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent)Hybrid.DeepCopyInternal(); - if(OrganismGeneral != null) dest.OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent)OrganismGeneral.DeepCopyInternal(); + if(_Family is not null) dest.Family = (Hl7.Fhir.Model.CodeableConcept)_Family.DeepCopyInternal(); + if(_Genus is not null) dest.Genus = (Hl7.Fhir.Model.CodeableConcept)_Genus.DeepCopyInternal(); + if(_Species is not null) dest.Species = (Hl7.Fhir.Model.CodeableConcept)_Species.DeepCopyInternal(); + if(_IntraspecificType is not null) dest.IntraspecificType = (Hl7.Fhir.Model.CodeableConcept)_IntraspecificType.DeepCopyInternal(); + if(_IntraspecificDescriptionElement is not null) dest.IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString)_IntraspecificDescriptionElement.DeepCopyInternal(); + if(_Author is not null) dest.Author = new List(_Author.DeepCopyInternal()); + if(_Hybrid is not null) dest.Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent)_Hybrid.DeepCopyInternal(); + if(_OrganismGeneral is not null) dest.OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent)_OrganismGeneral.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -352,83 +341,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrganismComponent; - if(otherT == null) return false; + if(other is not OrganismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Family, otherT.Family)) return false; - if(!comparer.Equals(Genus, otherT.Genus)) return false; - if(!comparer.Equals(Species, otherT.Species)) return false; - if(!comparer.Equals(IntraspecificType, otherT.IntraspecificType)) return false; - if(!comparer.Equals(IntraspecificDescriptionElement, otherT.IntraspecificDescriptionElement)) return false; - if(!comparer.ListEquals(Author, otherT.Author)) return false; - if(!comparer.Equals(Hybrid, otherT.Hybrid)) return false; - if(!comparer.Equals(OrganismGeneral, otherT.OrganismGeneral)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Family, otherT._Family)) return false; + if(!comparer.Equals(_Genus, otherT._Genus)) return false; + if(!comparer.Equals(_Species, otherT._Species)) return false; + if(!comparer.Equals(_IntraspecificType, otherT._IntraspecificType)) return false; + if(!comparer.Equals(_IntraspecificDescriptionElement, otherT._IntraspecificDescriptionElement)) return false; + if(!comparer.ListEquals(_Author, otherT._Author)) return false; + if(!comparer.Equals(_Hybrid, otherT._Hybrid)) return false; + if(!comparer.Equals(_OrganismGeneral, otherT._OrganismGeneral)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "family": - value = Family; - return Family is not null; + value = _Family; + return _Family is not null; case "genus": - value = Genus; - return Genus is not null; + value = _Genus; + return _Genus is not null; case "species": - value = Species; - return Species is not null; + value = _Species; + return _Species is not null; case "intraspecificType": - value = IntraspecificType; - return IntraspecificType is not null; + value = _IntraspecificType; + return _IntraspecificType is not null; case "intraspecificDescription": - value = IntraspecificDescriptionElement; - return IntraspecificDescriptionElement is not null; + value = _IntraspecificDescriptionElement; + return _IntraspecificDescriptionElement is not null; case "author": - value = Author; - return Author?.Any() == true; + value = _Author; + return _Author?.Any() == true; case "hybrid": - value = Hybrid; - return Hybrid is not null; + value = _Hybrid; + return _Hybrid is not null; case "organismGeneral": - value = OrganismGeneral; - return OrganismGeneral is not null; + value = _OrganismGeneral; + return _OrganismGeneral is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "family": - Family = (Hl7.Fhir.Model.CodeableConcept)value; + Family = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "genus": - Genus = (Hl7.Fhir.Model.CodeableConcept)value; + Genus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "species": - Species = (Hl7.Fhir.Model.CodeableConcept)value; + Species = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intraspecificType": - IntraspecificType = (Hl7.Fhir.Model.CodeableConcept)value; + IntraspecificType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intraspecificDescription": - IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + IntraspecificDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "author": - Author = (List)value; + Author = (List?)value!; return this; case "hybrid": - Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent)value; + Hybrid = (Hl7.Fhir.Model.SubstanceSourceMaterial.HybridComponent?)value; return this; case "organismGeneral": - OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent)value; + OrganismGeneral = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismGeneralComponent?)value; return this; default: return base.SetValue(key, value); @@ -439,14 +428,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Family is not null) yield return new KeyValuePair("family",Family); - if (Genus is not null) yield return new KeyValuePair("genus",Genus); - if (Species is not null) yield return new KeyValuePair("species",Species); - if (IntraspecificType is not null) yield return new KeyValuePair("intraspecificType",IntraspecificType); - if (IntraspecificDescriptionElement is not null) yield return new KeyValuePair("intraspecificDescription",IntraspecificDescriptionElement); - if (Author?.Any() == true) yield return new KeyValuePair("author",Author); - if (Hybrid is not null) yield return new KeyValuePair("hybrid",Hybrid); - if (OrganismGeneral is not null) yield return new KeyValuePair("organismGeneral",OrganismGeneral); + if (_Family is not null) yield return new KeyValuePair("family",_Family); + if (_Genus is not null) yield return new KeyValuePair("genus",_Genus); + if (_Species is not null) yield return new KeyValuePair("species",_Species); + if (_IntraspecificType is not null) yield return new KeyValuePair("intraspecificType",_IntraspecificType); + if (_IntraspecificDescriptionElement is not null) yield return new KeyValuePair("intraspecificDescription",_IntraspecificDescriptionElement); + if (_Author?.Any() == true) yield return new KeyValuePair("author",_Author); + if (_Hybrid is not null) yield return new KeyValuePair("hybrid",_Hybrid); + if (_OrganismGeneral is not null) yield return new KeyValuePair("organismGeneral",_OrganismGeneral); } } @@ -469,57 +458,50 @@ public partial class AuthorComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("authorType", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept AuthorType + public Hl7.Fhir.Model.CodeableConcept? AuthorType { get { return _AuthorType; } set { _AuthorType = value; OnPropertyChanged("AuthorType"); } } - private Hl7.Fhir.Model.CodeableConcept _AuthorType; + private Hl7.Fhir.Model.CodeableConcept? _AuthorType; /// /// The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank). /// [FhirElement("authorDescription", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString AuthorDescriptionElement + public Hl7.Fhir.Model.FhirString? AuthorDescriptionElement { get { return _AuthorDescriptionElement; } set { _AuthorDescriptionElement = value; OnPropertyChanged("AuthorDescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _AuthorDescriptionElement; + private Hl7.Fhir.Model.FhirString? _AuthorDescriptionElement; /// /// The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthorDescription + public string? AuthorDescription { - get { return AuthorDescriptionElement != null ? AuthorDescriptionElement.Value : null; } + get => _AuthorDescriptionElement?.Value; set { - if (value == null) - AuthorDescriptionElement = null; - else - AuthorDescriptionElement = new Hl7.Fhir.Model.FhirString(value); + AuthorDescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("AuthorDescription"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as AuthorComponent; - - if (dest == null) - { + if(other is not AuthorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AuthorType != null) dest.AuthorType = (Hl7.Fhir.Model.CodeableConcept)AuthorType.DeepCopyInternal(); - if(AuthorDescriptionElement != null) dest.AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString)AuthorDescriptionElement.DeepCopyInternal(); + if(_AuthorType is not null) dest.AuthorType = (Hl7.Fhir.Model.CodeableConcept)_AuthorType.DeepCopyInternal(); + if(_AuthorDescriptionElement is not null) dest.AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString)_AuthorDescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -531,41 +513,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AuthorComponent; - if(otherT == null) return false; + if(other is not AuthorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AuthorType, otherT.AuthorType)) return false; - if(!comparer.Equals(AuthorDescriptionElement, otherT.AuthorDescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorType, otherT._AuthorType)) return false; + if(!comparer.Equals(_AuthorDescriptionElement, otherT._AuthorDescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "authorType": - value = AuthorType; - return AuthorType is not null; + value = _AuthorType; + return _AuthorType is not null; case "authorDescription": - value = AuthorDescriptionElement; - return AuthorDescriptionElement is not null; + value = _AuthorDescriptionElement; + return _AuthorDescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "authorType": - AuthorType = (Hl7.Fhir.Model.CodeableConcept)value; + AuthorType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "authorDescription": - AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString)value; + AuthorDescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -576,8 +558,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AuthorType is not null) yield return new KeyValuePair("authorType",AuthorType); - if (AuthorDescriptionElement is not null) yield return new KeyValuePair("authorDescription",AuthorDescriptionElement); + if (_AuthorType is not null) yield return new KeyValuePair("authorType",_AuthorType); + if (_AuthorDescriptionElement is not null) yield return new KeyValuePair("authorDescription",_AuthorDescriptionElement); } } @@ -600,28 +582,25 @@ public partial class HybridComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("maternalOrganismId", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString MaternalOrganismIdElement + public Hl7.Fhir.Model.FhirString? MaternalOrganismIdElement { get { return _MaternalOrganismIdElement; } set { _MaternalOrganismIdElement = value; OnPropertyChanged("MaternalOrganismIdElement"); } } - private Hl7.Fhir.Model.FhirString _MaternalOrganismIdElement; + private Hl7.Fhir.Model.FhirString? _MaternalOrganismIdElement; /// /// The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MaternalOrganismId + public string? MaternalOrganismId { - get { return MaternalOrganismIdElement != null ? MaternalOrganismIdElement.Value : null; } + get => _MaternalOrganismIdElement?.Value; set { - if (value == null) - MaternalOrganismIdElement = null; - else - MaternalOrganismIdElement = new Hl7.Fhir.Model.FhirString(value); + MaternalOrganismIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MaternalOrganismId"); } } @@ -631,28 +610,25 @@ public string MaternalOrganismId /// [FhirElement("maternalOrganismName", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString MaternalOrganismNameElement + public Hl7.Fhir.Model.FhirString? MaternalOrganismNameElement { get { return _MaternalOrganismNameElement; } set { _MaternalOrganismNameElement = value; OnPropertyChanged("MaternalOrganismNameElement"); } } - private Hl7.Fhir.Model.FhirString _MaternalOrganismNameElement; + private Hl7.Fhir.Model.FhirString? _MaternalOrganismNameElement; /// /// The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MaternalOrganismName + public string? MaternalOrganismName { - get { return MaternalOrganismNameElement != null ? MaternalOrganismNameElement.Value : null; } + get => _MaternalOrganismNameElement?.Value; set { - if (value == null) - MaternalOrganismNameElement = null; - else - MaternalOrganismNameElement = new Hl7.Fhir.Model.FhirString(value); + MaternalOrganismNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MaternalOrganismName"); } } @@ -662,28 +638,25 @@ public string MaternalOrganismName /// [FhirElement("paternalOrganismId", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString PaternalOrganismIdElement + public Hl7.Fhir.Model.FhirString? PaternalOrganismIdElement { get { return _PaternalOrganismIdElement; } set { _PaternalOrganismIdElement = value; OnPropertyChanged("PaternalOrganismIdElement"); } } - private Hl7.Fhir.Model.FhirString _PaternalOrganismIdElement; + private Hl7.Fhir.Model.FhirString? _PaternalOrganismIdElement; /// /// The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaternalOrganismId + public string? PaternalOrganismId { - get { return PaternalOrganismIdElement != null ? PaternalOrganismIdElement.Value : null; } + get => _PaternalOrganismIdElement?.Value; set { - if (value == null) - PaternalOrganismIdElement = null; - else - PaternalOrganismIdElement = new Hl7.Fhir.Model.FhirString(value); + PaternalOrganismIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PaternalOrganismId"); } } @@ -693,28 +666,25 @@ public string PaternalOrganismId /// [FhirElement("paternalOrganismName", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString PaternalOrganismNameElement + public Hl7.Fhir.Model.FhirString? PaternalOrganismNameElement { get { return _PaternalOrganismNameElement; } set { _PaternalOrganismNameElement = value; OnPropertyChanged("PaternalOrganismNameElement"); } } - private Hl7.Fhir.Model.FhirString _PaternalOrganismNameElement; + private Hl7.Fhir.Model.FhirString? _PaternalOrganismNameElement; /// /// The name of the paternal species constituting the hybrid organism shall be specified /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string PaternalOrganismName + public string? PaternalOrganismName { - get { return PaternalOrganismNameElement != null ? PaternalOrganismNameElement.Value : null; } + get => _PaternalOrganismNameElement?.Value; set { - if (value == null) - PaternalOrganismNameElement = null; - else - PaternalOrganismNameElement = new Hl7.Fhir.Model.FhirString(value); + PaternalOrganismNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("PaternalOrganismName"); } } @@ -724,29 +694,25 @@ public string PaternalOrganismName /// [FhirElement("hybridType", InSummary=true, Order=80)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept HybridType + public Hl7.Fhir.Model.CodeableConcept? HybridType { get { return _HybridType; } set { _HybridType = value; OnPropertyChanged("HybridType"); } } - private Hl7.Fhir.Model.CodeableConcept _HybridType; + private Hl7.Fhir.Model.CodeableConcept? _HybridType; protected internal override void CopyToInternal(Base other) { - var dest = other as HybridComponent; - - if (dest == null) - { + if(other is not HybridComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(MaternalOrganismIdElement != null) dest.MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)MaternalOrganismIdElement.DeepCopyInternal(); - if(MaternalOrganismNameElement != null) dest.MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)MaternalOrganismNameElement.DeepCopyInternal(); - if(PaternalOrganismIdElement != null) dest.PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)PaternalOrganismIdElement.DeepCopyInternal(); - if(PaternalOrganismNameElement != null) dest.PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)PaternalOrganismNameElement.DeepCopyInternal(); - if(HybridType != null) dest.HybridType = (Hl7.Fhir.Model.CodeableConcept)HybridType.DeepCopyInternal(); + if(_MaternalOrganismIdElement is not null) dest.MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)_MaternalOrganismIdElement.DeepCopyInternal(); + if(_MaternalOrganismNameElement is not null) dest.MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)_MaternalOrganismNameElement.DeepCopyInternal(); + if(_PaternalOrganismIdElement is not null) dest.PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)_PaternalOrganismIdElement.DeepCopyInternal(); + if(_PaternalOrganismNameElement is not null) dest.PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)_PaternalOrganismNameElement.DeepCopyInternal(); + if(_HybridType is not null) dest.HybridType = (Hl7.Fhir.Model.CodeableConcept)_HybridType.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -758,62 +724,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as HybridComponent; - if(otherT == null) return false; + if(other is not HybridComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(MaternalOrganismIdElement, otherT.MaternalOrganismIdElement)) return false; - if(!comparer.Equals(MaternalOrganismNameElement, otherT.MaternalOrganismNameElement)) return false; - if(!comparer.Equals(PaternalOrganismIdElement, otherT.PaternalOrganismIdElement)) return false; - if(!comparer.Equals(PaternalOrganismNameElement, otherT.PaternalOrganismNameElement)) return false; - if(!comparer.Equals(HybridType, otherT.HybridType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MaternalOrganismIdElement, otherT._MaternalOrganismIdElement)) return false; + if(!comparer.Equals(_MaternalOrganismNameElement, otherT._MaternalOrganismNameElement)) return false; + if(!comparer.Equals(_PaternalOrganismIdElement, otherT._PaternalOrganismIdElement)) return false; + if(!comparer.Equals(_PaternalOrganismNameElement, otherT._PaternalOrganismNameElement)) return false; + if(!comparer.Equals(_HybridType, otherT._HybridType)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "maternalOrganismId": - value = MaternalOrganismIdElement; - return MaternalOrganismIdElement is not null; + value = _MaternalOrganismIdElement; + return _MaternalOrganismIdElement is not null; case "maternalOrganismName": - value = MaternalOrganismNameElement; - return MaternalOrganismNameElement is not null; + value = _MaternalOrganismNameElement; + return _MaternalOrganismNameElement is not null; case "paternalOrganismId": - value = PaternalOrganismIdElement; - return PaternalOrganismIdElement is not null; + value = _PaternalOrganismIdElement; + return _PaternalOrganismIdElement is not null; case "paternalOrganismName": - value = PaternalOrganismNameElement; - return PaternalOrganismNameElement is not null; + value = _PaternalOrganismNameElement; + return _PaternalOrganismNameElement is not null; case "hybridType": - value = HybridType; - return HybridType is not null; + value = _HybridType; + return _HybridType is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "maternalOrganismId": - MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)value; + MaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "maternalOrganismName": - MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)value; + MaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paternalOrganismId": - PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString)value; + PaternalOrganismIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "paternalOrganismName": - PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString)value; + PaternalOrganismNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "hybridType": - HybridType = (Hl7.Fhir.Model.CodeableConcept)value; + HybridType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -824,11 +790,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (MaternalOrganismIdElement is not null) yield return new KeyValuePair("maternalOrganismId",MaternalOrganismIdElement); - if (MaternalOrganismNameElement is not null) yield return new KeyValuePair("maternalOrganismName",MaternalOrganismNameElement); - if (PaternalOrganismIdElement is not null) yield return new KeyValuePair("paternalOrganismId",PaternalOrganismIdElement); - if (PaternalOrganismNameElement is not null) yield return new KeyValuePair("paternalOrganismName",PaternalOrganismNameElement); - if (HybridType is not null) yield return new KeyValuePair("hybridType",HybridType); + if (_MaternalOrganismIdElement is not null) yield return new KeyValuePair("maternalOrganismId",_MaternalOrganismIdElement); + if (_MaternalOrganismNameElement is not null) yield return new KeyValuePair("maternalOrganismName",_MaternalOrganismNameElement); + if (_PaternalOrganismIdElement is not null) yield return new KeyValuePair("paternalOrganismId",_PaternalOrganismIdElement); + if (_PaternalOrganismNameElement is not null) yield return new KeyValuePair("paternalOrganismName",_PaternalOrganismNameElement); + if (_HybridType is not null) yield return new KeyValuePair("hybridType",_HybridType); } } @@ -851,67 +817,63 @@ public partial class OrganismGeneralComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("kingdom", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Kingdom + public Hl7.Fhir.Model.CodeableConcept? Kingdom { get { return _Kingdom; } set { _Kingdom = value; OnPropertyChanged("Kingdom"); } } - private Hl7.Fhir.Model.CodeableConcept _Kingdom; + private Hl7.Fhir.Model.CodeableConcept? _Kingdom; /// /// The phylum of an organism shall be specified. /// [FhirElement("phylum", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Phylum + public Hl7.Fhir.Model.CodeableConcept? Phylum { get { return _Phylum; } set { _Phylum = value; OnPropertyChanged("Phylum"); } } - private Hl7.Fhir.Model.CodeableConcept _Phylum; + private Hl7.Fhir.Model.CodeableConcept? _Phylum; /// /// The class of an organism shall be specified. /// [FhirElement("class", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Class + public Hl7.Fhir.Model.CodeableConcept? Class { get { return _Class; } set { _Class = value; OnPropertyChanged("Class"); } } - private Hl7.Fhir.Model.CodeableConcept _Class; + private Hl7.Fhir.Model.CodeableConcept? _Class; /// /// The order of an organism shall be specified,. /// [FhirElement("order", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Order + public Hl7.Fhir.Model.CodeableConcept? Order { get { return _Order; } set { _Order = value; OnPropertyChanged("Order"); } } - private Hl7.Fhir.Model.CodeableConcept _Order; + private Hl7.Fhir.Model.CodeableConcept? _Order; protected internal override void CopyToInternal(Base other) { - var dest = other as OrganismGeneralComponent; - - if (dest == null) - { + if(other is not OrganismGeneralComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Kingdom != null) dest.Kingdom = (Hl7.Fhir.Model.CodeableConcept)Kingdom.DeepCopyInternal(); - if(Phylum != null) dest.Phylum = (Hl7.Fhir.Model.CodeableConcept)Phylum.DeepCopyInternal(); - if(Class != null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopyInternal(); - if(Order != null) dest.Order = (Hl7.Fhir.Model.CodeableConcept)Order.DeepCopyInternal(); + if(_Kingdom is not null) dest.Kingdom = (Hl7.Fhir.Model.CodeableConcept)_Kingdom.DeepCopyInternal(); + if(_Phylum is not null) dest.Phylum = (Hl7.Fhir.Model.CodeableConcept)_Phylum.DeepCopyInternal(); + if(_Class is not null) dest.Class = (Hl7.Fhir.Model.CodeableConcept)_Class.DeepCopyInternal(); + if(_Order is not null) dest.Order = (Hl7.Fhir.Model.CodeableConcept)_Order.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -923,55 +885,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OrganismGeneralComponent; - if(otherT == null) return false; + if(other is not OrganismGeneralComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Kingdom, otherT.Kingdom)) return false; - if(!comparer.Equals(Phylum, otherT.Phylum)) return false; - if(!comparer.Equals(Class, otherT.Class)) return false; - if(!comparer.Equals(Order, otherT.Order)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Kingdom, otherT._Kingdom)) return false; + if(!comparer.Equals(_Phylum, otherT._Phylum)) return false; + if(!comparer.Equals(_Class, otherT._Class)) return false; + if(!comparer.Equals(_Order, otherT._Order)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "kingdom": - value = Kingdom; - return Kingdom is not null; + value = _Kingdom; + return _Kingdom is not null; case "phylum": - value = Phylum; - return Phylum is not null; + value = _Phylum; + return _Phylum is not null; case "class": - value = Class; - return Class is not null; + value = _Class; + return _Class is not null; case "order": - value = Order; - return Order is not null; + value = _Order; + return _Order is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "kingdom": - Kingdom = (Hl7.Fhir.Model.CodeableConcept)value; + Kingdom = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "phylum": - Phylum = (Hl7.Fhir.Model.CodeableConcept)value; + Phylum = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "class": - Class = (Hl7.Fhir.Model.CodeableConcept)value; + Class = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "order": - Order = (Hl7.Fhir.Model.CodeableConcept)value; + Order = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -982,10 +944,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Kingdom is not null) yield return new KeyValuePair("kingdom",Kingdom); - if (Phylum is not null) yield return new KeyValuePair("phylum",Phylum); - if (Class is not null) yield return new KeyValuePair("class",Class); - if (Order is not null) yield return new KeyValuePair("order",Order); + if (_Kingdom is not null) yield return new KeyValuePair("kingdom",_Kingdom); + if (_Phylum is not null) yield return new KeyValuePair("phylum",_Phylum); + if (_Class is not null) yield return new KeyValuePair("class",_Class); + if (_Order is not null) yield return new KeyValuePair("order",_Order); } } @@ -1008,39 +970,35 @@ public partial class PartDescriptionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("part", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Part + public Hl7.Fhir.Model.CodeableConcept? Part { get { return _Part; } set { _Part = value; OnPropertyChanged("Part"); } } - private Hl7.Fhir.Model.CodeableConcept _Part; + private Hl7.Fhir.Model.CodeableConcept? _Part; /// /// The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply. /// [FhirElement("partLocation", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept PartLocation + public Hl7.Fhir.Model.CodeableConcept? PartLocation { get { return _PartLocation; } set { _PartLocation = value; OnPropertyChanged("PartLocation"); } } - private Hl7.Fhir.Model.CodeableConcept _PartLocation; + private Hl7.Fhir.Model.CodeableConcept? _PartLocation; protected internal override void CopyToInternal(Base other) { - var dest = other as PartDescriptionComponent; - - if (dest == null) - { + if(other is not PartDescriptionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Part != null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)Part.DeepCopyInternal(); - if(PartLocation != null) dest.PartLocation = (Hl7.Fhir.Model.CodeableConcept)PartLocation.DeepCopyInternal(); + if(_Part is not null) dest.Part = (Hl7.Fhir.Model.CodeableConcept)_Part.DeepCopyInternal(); + if(_PartLocation is not null) dest.PartLocation = (Hl7.Fhir.Model.CodeableConcept)_PartLocation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1052,41 +1010,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PartDescriptionComponent; - if(otherT == null) return false; + if(other is not PartDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Part, otherT.Part)) return false; - if(!comparer.Equals(PartLocation, otherT.PartLocation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Part, otherT._Part)) return false; + if(!comparer.Equals(_PartLocation, otherT._PartLocation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "part": - value = Part; - return Part is not null; + value = _Part; + return _Part is not null; case "partLocation": - value = PartLocation; - return PartLocation is not null; + value = _PartLocation; + return _PartLocation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "part": - Part = (Hl7.Fhir.Model.CodeableConcept)value; + Part = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "partLocation": - PartLocation = (Hl7.Fhir.Model.CodeableConcept)value; + PartLocation = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1097,8 +1055,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Part is not null) yield return new KeyValuePair("part",Part); - if (PartLocation is not null) yield return new KeyValuePair("partLocation",PartLocation); + if (_Part is not null) yield return new KeyValuePair("part",_Part); + if (_PartLocation is not null) yield return new KeyValuePair("partLocation",_PartLocation); } } @@ -1108,80 +1066,77 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("sourceMaterialClass", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SourceMaterialClass + public Hl7.Fhir.Model.CodeableConcept? SourceMaterialClass { get { return _SourceMaterialClass; } set { _SourceMaterialClass = value; OnPropertyChanged("SourceMaterialClass"); } } - private Hl7.Fhir.Model.CodeableConcept _SourceMaterialClass; + private Hl7.Fhir.Model.CodeableConcept? _SourceMaterialClass; /// /// The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent. /// [FhirElement("sourceMaterialType", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SourceMaterialType + public Hl7.Fhir.Model.CodeableConcept? SourceMaterialType { get { return _SourceMaterialType; } set { _SourceMaterialType = value; OnPropertyChanged("SourceMaterialType"); } } - private Hl7.Fhir.Model.CodeableConcept _SourceMaterialType; + private Hl7.Fhir.Model.CodeableConcept? _SourceMaterialType; /// /// The state of the source material when extracted. /// [FhirElement("sourceMaterialState", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept SourceMaterialState + public Hl7.Fhir.Model.CodeableConcept? SourceMaterialState { get { return _SourceMaterialState; } set { _SourceMaterialState = value; OnPropertyChanged("SourceMaterialState"); } } - private Hl7.Fhir.Model.CodeableConcept _SourceMaterialState; + private Hl7.Fhir.Model.CodeableConcept? _SourceMaterialState; /// /// The unique identifier associated with the source material parent organism shall be specified. /// [FhirElement("organismId", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.Identifier OrganismId + public Hl7.Fhir.Model.Identifier? OrganismId { get { return _OrganismId; } set { _OrganismId = value; OnPropertyChanged("OrganismId"); } } - private Hl7.Fhir.Model.Identifier _OrganismId; + private Hl7.Fhir.Model.Identifier? _OrganismId; /// /// The organism accepted Scientific name shall be provided based on the organism taxonomy. /// [FhirElement("organismName", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString OrganismNameElement + public Hl7.Fhir.Model.FhirString? OrganismNameElement { get { return _OrganismNameElement; } set { _OrganismNameElement = value; OnPropertyChanged("OrganismNameElement"); } } - private Hl7.Fhir.Model.FhirString _OrganismNameElement; + private Hl7.Fhir.Model.FhirString? _OrganismNameElement; /// /// The organism accepted Scientific name shall be provided based on the organism taxonomy /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string OrganismName + public string? OrganismName { - get { return OrganismNameElement != null ? OrganismNameElement.Value : null; } + get => _OrganismNameElement?.Value; set { - if (value == null) - OrganismNameElement = null; - else - OrganismNameElement = new Hl7.Fhir.Model.FhirString(value); + OrganismNameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("OrganismName"); } } @@ -1194,11 +1149,11 @@ public string OrganismName [DataMember] public List ParentSubstanceId { - get { if(_ParentSubstanceId==null) _ParentSubstanceId = new List(); return _ParentSubstanceId; } + get => _ParentSubstanceId ?? new List(); set { _ParentSubstanceId = value; OnPropertyChanged("ParentSubstanceId"); } } - private List _ParentSubstanceId; + private List? _ParentSubstanceId; /// /// The parent substance of the Herbal Drug, or Herbal preparation. @@ -1208,24 +1163,24 @@ public List ParentSubstanceId [DataMember] public List ParentSubstanceNameElement { - get { if(_ParentSubstanceNameElement==null) _ParentSubstanceNameElement = new List(); return _ParentSubstanceNameElement; } + get => _ParentSubstanceNameElement ?? new List(); set { _ParentSubstanceNameElement = value; OnPropertyChanged("ParentSubstanceNameElement"); } } - private List _ParentSubstanceNameElement; + private List? _ParentSubstanceNameElement; /// /// The parent substance of the Herbal Drug, or Herbal preparation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable ParentSubstanceName + public IEnumerable? ParentSubstanceName { - get { return ParentSubstanceNameElement != null ? ParentSubstanceNameElement.Select(elem => elem.Value) : null; } + get => _ParentSubstanceNameElement?.Select(elem => elem.Value); set { if (value == null) - ParentSubstanceNameElement = null; + ParentSubstanceNameElement = null!; else ParentSubstanceNameElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("ParentSubstanceName"); @@ -1240,11 +1195,11 @@ public IEnumerable ParentSubstanceName [DataMember] public List CountryOfOrigin { - get { if(_CountryOfOrigin==null) _CountryOfOrigin = new List(); return _CountryOfOrigin; } + get => _CountryOfOrigin ?? new List(); set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } - private List _CountryOfOrigin; + private List? _CountryOfOrigin; /// /// The place/region where the plant is harvested or the places/regions where the animal source material has its habitat. @@ -1254,24 +1209,24 @@ public List CountryOfOrigin [DataMember] public List GeographicalLocationElement { - get { if(_GeographicalLocationElement==null) _GeographicalLocationElement = new List(); return _GeographicalLocationElement; } + get => _GeographicalLocationElement ?? new List(); set { _GeographicalLocationElement = value; OnPropertyChanged("GeographicalLocationElement"); } } - private List _GeographicalLocationElement; + private List? _GeographicalLocationElement; /// /// The place/region where the plant is harvested or the places/regions where the animal source material has its habitat /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable GeographicalLocation + public IEnumerable? GeographicalLocation { - get { return GeographicalLocationElement != null ? GeographicalLocationElement.Select(elem => elem.Value) : null; } + get => _GeographicalLocationElement?.Select(elem => elem.Value); set { if (value == null) - GeographicalLocationElement = null; + GeographicalLocationElement = null!; else GeographicalLocationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("GeographicalLocation"); @@ -1283,13 +1238,13 @@ public IEnumerable GeographicalLocation /// [FhirElement("developmentStage", InSummary=true, Order=180)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept DevelopmentStage + public Hl7.Fhir.Model.CodeableConcept? DevelopmentStage { get { return _DevelopmentStage; } set { _DevelopmentStage = value; OnPropertyChanged("DevelopmentStage"); } } - private Hl7.Fhir.Model.CodeableConcept _DevelopmentStage; + private Hl7.Fhir.Model.CodeableConcept? _DevelopmentStage; /// /// Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels. @@ -1299,24 +1254,24 @@ public Hl7.Fhir.Model.CodeableConcept DevelopmentStage [DataMember] public List FractionDescription { - get { if(_FractionDescription==null) _FractionDescription = new List(); return _FractionDescription; } + get => _FractionDescription ?? new List(); set { _FractionDescription = value; OnPropertyChanged("FractionDescription"); } } - private List _FractionDescription; + private List? _FractionDescription; /// /// This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf. /// [FhirElement("organism", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent Organism + public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent? Organism { get { return _Organism; } set { _Organism = value; OnPropertyChanged("Organism"); } } - private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent _Organism; + private Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent? _Organism; /// /// To do. @@ -1326,35 +1281,31 @@ public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent Organism [DataMember] public List PartDescription { - get { if(_PartDescription==null) _PartDescription = new List(); return _PartDescription; } + get => _PartDescription ?? new List(); set { _PartDescription = value; OnPropertyChanged("PartDescription"); } } - private List _PartDescription; + private List? _PartDescription; protected internal override void CopyToInternal(Base other) { - var dest = other as SubstanceSourceMaterial; - - if (dest == null) - { + if(other is not SubstanceSourceMaterial dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SourceMaterialClass != null) dest.SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept)SourceMaterialClass.DeepCopyInternal(); - if(SourceMaterialType != null) dest.SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept)SourceMaterialType.DeepCopyInternal(); - if(SourceMaterialState != null) dest.SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept)SourceMaterialState.DeepCopyInternal(); - if(OrganismId != null) dest.OrganismId = (Hl7.Fhir.Model.Identifier)OrganismId.DeepCopyInternal(); - if(OrganismNameElement != null) dest.OrganismNameElement = (Hl7.Fhir.Model.FhirString)OrganismNameElement.DeepCopyInternal(); - if(ParentSubstanceId.Any()) dest.ParentSubstanceId = new List(ParentSubstanceId.DeepCopyInternal()); - if(ParentSubstanceNameElement.Any()) dest.ParentSubstanceNameElement = new List(ParentSubstanceNameElement.DeepCopyInternal()); - if(CountryOfOrigin.Any()) dest.CountryOfOrigin = new List(CountryOfOrigin.DeepCopyInternal()); - if(GeographicalLocationElement.Any()) dest.GeographicalLocationElement = new List(GeographicalLocationElement.DeepCopyInternal()); - if(DevelopmentStage != null) dest.DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept)DevelopmentStage.DeepCopyInternal(); - if(FractionDescription.Any()) dest.FractionDescription = new List(FractionDescription.DeepCopyInternal()); - if(Organism != null) dest.Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent)Organism.DeepCopyInternal(); - if(PartDescription.Any()) dest.PartDescription = new List(PartDescription.DeepCopyInternal()); + if(_SourceMaterialClass is not null) dest.SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept)_SourceMaterialClass.DeepCopyInternal(); + if(_SourceMaterialType is not null) dest.SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept)_SourceMaterialType.DeepCopyInternal(); + if(_SourceMaterialState is not null) dest.SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept)_SourceMaterialState.DeepCopyInternal(); + if(_OrganismId is not null) dest.OrganismId = (Hl7.Fhir.Model.Identifier)_OrganismId.DeepCopyInternal(); + if(_OrganismNameElement is not null) dest.OrganismNameElement = (Hl7.Fhir.Model.FhirString)_OrganismNameElement.DeepCopyInternal(); + if(_ParentSubstanceId is not null) dest.ParentSubstanceId = new List(_ParentSubstanceId.DeepCopyInternal()); + if(_ParentSubstanceNameElement is not null) dest.ParentSubstanceNameElement = new List(_ParentSubstanceNameElement.DeepCopyInternal()); + if(_CountryOfOrigin is not null) dest.CountryOfOrigin = new List(_CountryOfOrigin.DeepCopyInternal()); + if(_GeographicalLocationElement is not null) dest.GeographicalLocationElement = new List(_GeographicalLocationElement.DeepCopyInternal()); + if(_DevelopmentStage is not null) dest.DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept)_DevelopmentStage.DeepCopyInternal(); + if(_FractionDescription is not null) dest.FractionDescription = new List(_FractionDescription.DeepCopyInternal()); + if(_Organism is not null) dest.Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent)_Organism.DeepCopyInternal(); + if(_PartDescription is not null) dest.PartDescription = new List(_PartDescription.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1366,118 +1317,118 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SubstanceSourceMaterial; - if(otherT == null) return false; + if(other is not SubstanceSourceMaterial otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SourceMaterialClass, otherT.SourceMaterialClass)) return false; - if(!comparer.Equals(SourceMaterialType, otherT.SourceMaterialType)) return false; - if(!comparer.Equals(SourceMaterialState, otherT.SourceMaterialState)) return false; - if(!comparer.Equals(OrganismId, otherT.OrganismId)) return false; - if(!comparer.Equals(OrganismNameElement, otherT.OrganismNameElement)) return false; - if(!comparer.ListEquals(ParentSubstanceId, otherT.ParentSubstanceId)) return false; - if(!comparer.ListEquals(ParentSubstanceNameElement, otherT.ParentSubstanceNameElement)) return false; - if(!comparer.ListEquals(CountryOfOrigin, otherT.CountryOfOrigin)) return false; - if(!comparer.ListEquals(GeographicalLocationElement, otherT.GeographicalLocationElement)) return false; - if(!comparer.Equals(DevelopmentStage, otherT.DevelopmentStage)) return false; - if(!comparer.ListEquals(FractionDescription, otherT.FractionDescription)) return false; - if(!comparer.Equals(Organism, otherT.Organism)) return false; - if(!comparer.ListEquals(PartDescription, otherT.PartDescription)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceMaterialClass, otherT._SourceMaterialClass)) return false; + if(!comparer.Equals(_SourceMaterialType, otherT._SourceMaterialType)) return false; + if(!comparer.Equals(_SourceMaterialState, otherT._SourceMaterialState)) return false; + if(!comparer.Equals(_OrganismId, otherT._OrganismId)) return false; + if(!comparer.Equals(_OrganismNameElement, otherT._OrganismNameElement)) return false; + if(!comparer.ListEquals(_ParentSubstanceId, otherT._ParentSubstanceId)) return false; + if(!comparer.ListEquals(_ParentSubstanceNameElement, otherT._ParentSubstanceNameElement)) return false; + if(!comparer.ListEquals(_CountryOfOrigin, otherT._CountryOfOrigin)) return false; + if(!comparer.ListEquals(_GeographicalLocationElement, otherT._GeographicalLocationElement)) return false; + if(!comparer.Equals(_DevelopmentStage, otherT._DevelopmentStage)) return false; + if(!comparer.ListEquals(_FractionDescription, otherT._FractionDescription)) return false; + if(!comparer.Equals(_Organism, otherT._Organism)) return false; + if(!comparer.ListEquals(_PartDescription, otherT._PartDescription)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sourceMaterialClass": - value = SourceMaterialClass; - return SourceMaterialClass is not null; + value = _SourceMaterialClass; + return _SourceMaterialClass is not null; case "sourceMaterialType": - value = SourceMaterialType; - return SourceMaterialType is not null; + value = _SourceMaterialType; + return _SourceMaterialType is not null; case "sourceMaterialState": - value = SourceMaterialState; - return SourceMaterialState is not null; + value = _SourceMaterialState; + return _SourceMaterialState is not null; case "organismId": - value = OrganismId; - return OrganismId is not null; + value = _OrganismId; + return _OrganismId is not null; case "organismName": - value = OrganismNameElement; - return OrganismNameElement is not null; + value = _OrganismNameElement; + return _OrganismNameElement is not null; case "parentSubstanceId": - value = ParentSubstanceId; - return ParentSubstanceId?.Any() == true; + value = _ParentSubstanceId; + return _ParentSubstanceId?.Any() == true; case "parentSubstanceName": - value = ParentSubstanceNameElement; - return ParentSubstanceNameElement?.Any() == true; + value = _ParentSubstanceNameElement; + return _ParentSubstanceNameElement?.Any() == true; case "countryOfOrigin": - value = CountryOfOrigin; - return CountryOfOrigin?.Any() == true; + value = _CountryOfOrigin; + return _CountryOfOrigin?.Any() == true; case "geographicalLocation": - value = GeographicalLocationElement; - return GeographicalLocationElement?.Any() == true; + value = _GeographicalLocationElement; + return _GeographicalLocationElement?.Any() == true; case "developmentStage": - value = DevelopmentStage; - return DevelopmentStage is not null; + value = _DevelopmentStage; + return _DevelopmentStage is not null; case "fractionDescription": - value = FractionDescription; - return FractionDescription?.Any() == true; + value = _FractionDescription; + return _FractionDescription?.Any() == true; case "organism": - value = Organism; - return Organism is not null; + value = _Organism; + return _Organism is not null; case "partDescription": - value = PartDescription; - return PartDescription?.Any() == true; + value = _PartDescription; + return _PartDescription?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sourceMaterialClass": - SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept)value; + SourceMaterialClass = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sourceMaterialType": - SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept)value; + SourceMaterialType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "sourceMaterialState": - SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept)value; + SourceMaterialState = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "organismId": - OrganismId = (Hl7.Fhir.Model.Identifier)value; + OrganismId = (Hl7.Fhir.Model.Identifier?)value; return this; case "organismName": - OrganismNameElement = (Hl7.Fhir.Model.FhirString)value; + OrganismNameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "parentSubstanceId": - ParentSubstanceId = (List)value; + ParentSubstanceId = (List?)value!; return this; case "parentSubstanceName": - ParentSubstanceNameElement = (List)value; + ParentSubstanceNameElement = (List?)value!; return this; case "countryOfOrigin": - CountryOfOrigin = (List)value; + CountryOfOrigin = (List?)value!; return this; case "geographicalLocation": - GeographicalLocationElement = (List)value; + GeographicalLocationElement = (List?)value!; return this; case "developmentStage": - DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept)value; + DevelopmentStage = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "fractionDescription": - FractionDescription = (List)value; + FractionDescription = (List?)value!; return this; case "organism": - Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent)value; + Organism = (Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent?)value; return this; case "partDescription": - PartDescription = (List)value; + PartDescription = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1488,19 +1439,19 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SourceMaterialClass is not null) yield return new KeyValuePair("sourceMaterialClass",SourceMaterialClass); - if (SourceMaterialType is not null) yield return new KeyValuePair("sourceMaterialType",SourceMaterialType); - if (SourceMaterialState is not null) yield return new KeyValuePair("sourceMaterialState",SourceMaterialState); - if (OrganismId is not null) yield return new KeyValuePair("organismId",OrganismId); - if (OrganismNameElement is not null) yield return new KeyValuePair("organismName",OrganismNameElement); - if (ParentSubstanceId?.Any() == true) yield return new KeyValuePair("parentSubstanceId",ParentSubstanceId); - if (ParentSubstanceNameElement?.Any() == true) yield return new KeyValuePair("parentSubstanceName",ParentSubstanceNameElement); - if (CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",CountryOfOrigin); - if (GeographicalLocationElement?.Any() == true) yield return new KeyValuePair("geographicalLocation",GeographicalLocationElement); - if (DevelopmentStage is not null) yield return new KeyValuePair("developmentStage",DevelopmentStage); - if (FractionDescription?.Any() == true) yield return new KeyValuePair("fractionDescription",FractionDescription); - if (Organism is not null) yield return new KeyValuePair("organism",Organism); - if (PartDescription?.Any() == true) yield return new KeyValuePair("partDescription",PartDescription); + if (_SourceMaterialClass is not null) yield return new KeyValuePair("sourceMaterialClass",_SourceMaterialClass); + if (_SourceMaterialType is not null) yield return new KeyValuePair("sourceMaterialType",_SourceMaterialType); + if (_SourceMaterialState is not null) yield return new KeyValuePair("sourceMaterialState",_SourceMaterialState); + if (_OrganismId is not null) yield return new KeyValuePair("organismId",_OrganismId); + if (_OrganismNameElement is not null) yield return new KeyValuePair("organismName",_OrganismNameElement); + if (_ParentSubstanceId?.Any() == true) yield return new KeyValuePair("parentSubstanceId",_ParentSubstanceId); + if (_ParentSubstanceNameElement?.Any() == true) yield return new KeyValuePair("parentSubstanceName",_ParentSubstanceNameElement); + if (_CountryOfOrigin?.Any() == true) yield return new KeyValuePair("countryOfOrigin",_CountryOfOrigin); + if (_GeographicalLocationElement?.Any() == true) yield return new KeyValuePair("geographicalLocation",_GeographicalLocationElement); + if (_DevelopmentStage is not null) yield return new KeyValuePair("developmentStage",_DevelopmentStage); + if (_FractionDescription?.Any() == true) yield return new KeyValuePair("fractionDescription",_FractionDescription); + if (_Organism is not null) yield return new KeyValuePair("organism",_Organism); + if (_PartDescription?.Any() == true) yield return new KeyValuePair("partDescription",_PartDescription); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs index f042a7497..4af47d8e3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -142,13 +145,13 @@ public partial class SuppliedItemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("quantity", Order=40)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Medication, Substance, Device or Biologically Derived Product supplied. @@ -159,26 +162,22 @@ public Hl7.Fhir.Model.Quantity Quantity [References("Medication","Substance","Device","BiologicallyDerivedProduct","NutritionProduct","InventoryItem")] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Item + public Hl7.Fhir.Model.DataType? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.DataType _Item; + private Hl7.Fhir.Model.DataType? _Item; protected internal override void CopyToInternal(Base other) { - var dest = other as SuppliedItemComponent; - - if (dest == null) - { + if(other is not SuppliedItemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.DataType)Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.DataType)_Item.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -190,41 +189,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SuppliedItemComponent; - if(otherT == null) return false; + if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "item": - Item = (Hl7.Fhir.Model.DataType)value; + Item = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -235,8 +234,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Item is not null) yield return new KeyValuePair("item",Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Item is not null) yield return new KeyValuePair("item",_Item); } } @@ -249,11 +248,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Fulfills plan, proposal or order. @@ -265,11 +264,11 @@ public List Identifier [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Part of referenced event. @@ -281,11 +280,11 @@ public List BasedOn [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | completed | abandoned | entered-in-error. @@ -294,13 +293,13 @@ public List PartOf [DeclaredType(Type = typeof(Code))] [Binding("SupplyDeliveryStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | abandoned | entered-in-error @@ -309,13 +308,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -327,13 +323,13 @@ public Hl7.Fhir.Model.SupplyDelivery.SupplyDeliveryStatus? Status [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Category of supply event. @@ -341,13 +337,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [FhirElement("type", Order=140)] [Binding("SupplyDeliverySupplyItemType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// The item that is delivered or supplied. @@ -357,11 +353,11 @@ public Hl7.Fhir.Model.CodeableConcept Type [DataMember] public List SuppliedItem { - get { if(_SuppliedItem==null) _SuppliedItem = new List(); return _SuppliedItem; } + get => _SuppliedItem ?? new List(); set { _SuppliedItem = value; OnPropertyChanged("SuppliedItem"); } } - private List _SuppliedItem; + private List? _SuppliedItem; /// /// When event occurred. @@ -370,13 +366,13 @@ public List SuppliedItem [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// The item supplier. @@ -385,13 +381,13 @@ public Hl7.Fhir.Model.DataType Occurrence [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Supplier + public Hl7.Fhir.Model.ResourceReference? Supplier { get { return _Supplier; } set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private Hl7.Fhir.Model.ResourceReference _Supplier; + private Hl7.Fhir.Model.ResourceReference? _Supplier; /// /// Where the delivery was sent. @@ -400,13 +396,13 @@ public Hl7.Fhir.Model.ResourceReference Supplier [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Destination + public Hl7.Fhir.Model.ResourceReference? Destination { get { return _Destination; } set { _Destination = value; OnPropertyChanged("Destination"); } } - private Hl7.Fhir.Model.ResourceReference _Destination; + private Hl7.Fhir.Model.ResourceReference? _Destination; /// /// Who received the delivery. @@ -418,35 +414,31 @@ public Hl7.Fhir.Model.ResourceReference Destination [DataMember] public List Receiver { - get { if(_Receiver==null) _Receiver = new List(); return _Receiver; } + get => _Receiver ?? new List(); set { _Receiver = value; OnPropertyChanged("Receiver"); } } - private List _Receiver; + private List? _Receiver; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyDelivery; - - if (dest == null) - { + if(other is not SupplyDelivery dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(SuppliedItem.Any()) dest.SuppliedItem = new List(SuppliedItem.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(Supplier != null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)Supplier.DeepCopyInternal(); - if(Destination != null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopyInternal(); - if(Receiver.Any()) dest.Receiver = new List(Receiver.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_SuppliedItem is not null) dest.SuppliedItem = new List(_SuppliedItem.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = (Hl7.Fhir.Model.ResourceReference)_Supplier.DeepCopyInternal(); + if(_Destination is not null) dest.Destination = (Hl7.Fhir.Model.ResourceReference)_Destination.DeepCopyInternal(); + if(_Receiver is not null) dest.Receiver = new List(_Receiver.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -458,104 +450,104 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyDelivery; - if(otherT == null) return false; + if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(SuppliedItem, otherT.SuppliedItem)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(Supplier, otherT.Supplier)) return false; - if(!comparer.Equals(Destination, otherT.Destination)) return false; - if(!comparer.ListEquals(Receiver, otherT.Receiver)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_SuppliedItem, otherT._SuppliedItem)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; + if(!comparer.Equals(_Destination, otherT._Destination)) return false; + if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "suppliedItem": - value = SuppliedItem; - return SuppliedItem?.Any() == true; + value = _SuppliedItem; + return _SuppliedItem?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "supplier": - value = Supplier; - return Supplier is not null; + value = _Supplier; + return _Supplier is not null; case "destination": - value = Destination; - return Destination is not null; + value = _Destination; + return _Destination is not null; case "receiver": - value = Receiver; - return Receiver?.Any() == true; + value = _Receiver; + return _Receiver?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "suppliedItem": - SuppliedItem = (List)value; + SuppliedItem = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "supplier": - Supplier = (Hl7.Fhir.Model.ResourceReference)value; + Supplier = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "destination": - Destination = (Hl7.Fhir.Model.ResourceReference)value; + Destination = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "receiver": - Receiver = (List)value; + Receiver = (List?)value!; return this; default: return base.SetValue(key, value); @@ -566,17 +558,17 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Type is not null) yield return new KeyValuePair("type",Type); - if (SuppliedItem?.Any() == true) yield return new KeyValuePair("suppliedItem",SuppliedItem); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (Supplier is not null) yield return new KeyValuePair("supplier",Supplier); - if (Destination is not null) yield return new KeyValuePair("destination",Destination); - if (Receiver?.Any() == true) yield return new KeyValuePair("receiver",Receiver); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_SuppliedItem?.Any() == true) yield return new KeyValuePair("suppliedItem",_SuppliedItem); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_Supplier is not null) yield return new KeyValuePair("supplier",_Supplier); + if (_Destination is not null) yield return new KeyValuePair("destination",_Destination); + if (_Receiver?.Any() == true) yield return new KeyValuePair("receiver",_Receiver); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs index ea6b4f139..dd65e6aec 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -133,13 +136,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40, FiveWs="FiveWs.what[x]")] [Binding("ParameterCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Value of detail. @@ -148,26 +151,22 @@ public Hl7.Fhir.Model.CodeableConcept Code [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.FhirBoolean))] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -179,41 +178,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -224,8 +223,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Code is not null) yield return new KeyValuePair("code",Code); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -238,11 +237,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// draft | active | suspended +. @@ -251,13 +250,13 @@ public List Identifier [DeclaredType(Type = typeof(Code))] [Binding("SupplyRequestStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | suspended + @@ -266,13 +265,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -287,11 +283,11 @@ public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// The kind of supply (central, non-stock, etc.). @@ -299,13 +295,13 @@ public List BasedOn [FhirElement("category", InSummary=true, Order=120, FiveWs="FiveWs.class")] [Binding("SupplyRequestKind")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Category + public Hl7.Fhir.Model.CodeableConcept? Category { get { return _Category; } set { _Category = value; OnPropertyChanged("Category"); } } - private Hl7.Fhir.Model.CodeableConcept _Category; + private Hl7.Fhir.Model.CodeableConcept? _Category; /// /// routine | urgent | asap | stat. @@ -314,13 +310,13 @@ public Hl7.Fhir.Model.CodeableConcept Category [DeclaredType(Type = typeof(Code))] [Binding("RequestPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -329,13 +325,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -347,13 +340,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority [CLSCompliant(false)] [References("Patient")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverFor + public Hl7.Fhir.Model.ResourceReference? DeliverFor { get { return _DeliverFor; } set { _DeliverFor = value; OnPropertyChanged("DeliverFor"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverFor; + private Hl7.Fhir.Model.ResourceReference? _DeliverFor; /// /// Medication, Substance, or Device requested to be supplied. @@ -362,13 +355,13 @@ public Hl7.Fhir.Model.ResourceReference DeliverFor [Binding("SupplyRequestItem")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableReference Item + public Hl7.Fhir.Model.CodeableReference? Item { get { return _Item; } set { _Item = value; OnPropertyChanged("Item"); } } - private Hl7.Fhir.Model.CodeableReference _Item; + private Hl7.Fhir.Model.CodeableReference? _Item; /// /// The requested amount of the item indicated. @@ -376,13 +369,13 @@ public Hl7.Fhir.Model.CodeableReference Item [FhirElement("quantity", InSummary=true, Order=160)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Quantity Quantity + public Hl7.Fhir.Model.Quantity? Quantity { get { return _Quantity; } set { _Quantity = value; OnPropertyChanged("Quantity"); } } - private Hl7.Fhir.Model.Quantity _Quantity; + private Hl7.Fhir.Model.Quantity? _Quantity; /// /// Ordered item details. @@ -392,11 +385,11 @@ public Hl7.Fhir.Model.Quantity Quantity [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// When the request should be fulfilled. @@ -405,41 +398,38 @@ public List Parameter [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Timing))] [DataMember] - public Hl7.Fhir.Model.DataType Occurrence + public Hl7.Fhir.Model.DataType? Occurrence { get { return _Occurrence; } set { _Occurrence = value; OnPropertyChanged("Occurrence"); } } - private Hl7.Fhir.Model.DataType _Occurrence; + private Hl7.Fhir.Model.DataType? _Occurrence; /// /// When the request was made. /// [FhirElement("authoredOn", InSummary=true, Order=190, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// When the request was made /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -451,13 +441,13 @@ public string AuthoredOn [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","Patient","RelatedPerson","Device","CareTeam")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Who is intended to fulfill the request. @@ -469,11 +459,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List Supplier { - get { if(_Supplier==null) _Supplier = new List(); return _Supplier; } + get => _Supplier ?? new List(); set { _Supplier = value; OnPropertyChanged("Supplier"); } } - private List _Supplier; + private List? _Supplier; /// /// The reason why the supply item was requested. @@ -484,11 +474,11 @@ public List Supplier [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// The origin of the supply. @@ -497,13 +487,13 @@ public List Reason [CLSCompliant(false)] [References("Organization","Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverFrom + public Hl7.Fhir.Model.ResourceReference? DeliverFrom { get { return _DeliverFrom; } set { _DeliverFrom = value; OnPropertyChanged("DeliverFrom"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverFrom; + private Hl7.Fhir.Model.ResourceReference? _DeliverFrom; /// /// The destination of the supply. @@ -512,42 +502,38 @@ public Hl7.Fhir.Model.ResourceReference DeliverFrom [CLSCompliant(false)] [References("Organization","Location","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference DeliverTo + public Hl7.Fhir.Model.ResourceReference? DeliverTo { get { return _DeliverTo; } set { _DeliverTo = value; OnPropertyChanged("DeliverTo"); } } - private Hl7.Fhir.Model.ResourceReference _DeliverTo; + private Hl7.Fhir.Model.ResourceReference? _DeliverTo; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as SupplyRequest; - - if (dest == null) - { + if(other is not SupplyRequest dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(Category != null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DeliverFor != null) dest.DeliverFor = (Hl7.Fhir.Model.ResourceReference)DeliverFor.DeepCopyInternal(); - if(Item != null) dest.Item = (Hl7.Fhir.Model.CodeableReference)Item.DeepCopyInternal(); - if(Quantity != null) dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(Occurrence != null) dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(Supplier.Any()) dest.Supplier = new List(Supplier.DeepCopyInternal()); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(DeliverFrom != null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)DeliverFrom.DeepCopyInternal(); - if(DeliverTo != null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)DeliverTo.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_Category is not null) dest.Category = (Hl7.Fhir.Model.CodeableConcept)_Category.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DeliverFor is not null) dest.DeliverFor = (Hl7.Fhir.Model.ResourceReference)_DeliverFor.DeepCopyInternal(); + if(_Item is not null) dest.Item = (Hl7.Fhir.Model.CodeableReference)_Item.DeepCopyInternal(); + if(_Quantity is not null) dest.Quantity = (Hl7.Fhir.Model.Quantity)_Quantity.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_Occurrence is not null) dest.Occurrence = (Hl7.Fhir.Model.DataType)_Occurrence.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_Supplier is not null) dest.Supplier = new List(_Supplier.DeepCopyInternal()); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_DeliverFrom is not null) dest.DeliverFrom = (Hl7.Fhir.Model.ResourceReference)_DeliverFrom.DeepCopyInternal(); + if(_DeliverTo is not null) dest.DeliverTo = (Hl7.Fhir.Model.ResourceReference)_DeliverTo.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -559,139 +545,139 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SupplyRequest; - if(otherT == null) return false; + if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(Category, otherT.Category)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DeliverFor, otherT.DeliverFor)) return false; - if(!comparer.Equals(Item, otherT.Item)) return false; - if(!comparer.Equals(Quantity, otherT.Quantity)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(Occurrence, otherT.Occurrence)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(Supplier, otherT.Supplier)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(DeliverFrom, otherT.DeliverFrom)) return false; - if(!comparer.Equals(DeliverTo, otherT.DeliverTo)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_Category, otherT._Category)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DeliverFor, otherT._DeliverFor)) return false; + if(!comparer.Equals(_Item, otherT._Item)) return false; + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_Occurrence, otherT._Occurrence)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_Supplier, otherT._Supplier)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; + if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "category": - value = Category; - return Category is not null; + value = _Category; + return _Category is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "deliverFor": - value = DeliverFor; - return DeliverFor is not null; + value = _DeliverFor; + return _DeliverFor is not null; case "item": - value = Item; - return Item is not null; + value = _Item; + return _Item is not null; case "quantity": - value = Quantity; - return Quantity is not null; + value = _Quantity; + return _Quantity is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "occurrence": - value = Occurrence; - return Occurrence is not null; + value = _Occurrence; + return _Occurrence is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "supplier": - value = Supplier; - return Supplier?.Any() == true; + value = _Supplier; + return _Supplier?.Any() == true; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "deliverFrom": - value = DeliverFrom; - return DeliverFrom is not null; + value = _DeliverFrom; + return _DeliverFrom is not null; case "deliverTo": - value = DeliverTo; - return DeliverTo is not null; + value = _DeliverTo; + return _DeliverTo is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "category": - Category = (Hl7.Fhir.Model.CodeableConcept)value; + Category = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "deliverFor": - DeliverFor = (Hl7.Fhir.Model.ResourceReference)value; + DeliverFor = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "item": - Item = (Hl7.Fhir.Model.CodeableReference)value; + Item = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "quantity": - Quantity = (Hl7.Fhir.Model.Quantity)value; + Quantity = (Hl7.Fhir.Model.Quantity?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "occurrence": - Occurrence = (Hl7.Fhir.Model.DataType)value; + Occurrence = (Hl7.Fhir.Model.DataType?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "supplier": - Supplier = (List)value; + Supplier = (List?)value!; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "deliverFrom": - DeliverFrom = (Hl7.Fhir.Model.ResourceReference)value; + DeliverFrom = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "deliverTo": - DeliverTo = (Hl7.Fhir.Model.ResourceReference)value; + DeliverTo = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -702,22 +688,22 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (Category is not null) yield return new KeyValuePair("category",Category); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DeliverFor is not null) yield return new KeyValuePair("deliverFor",DeliverFor); - if (Item is not null) yield return new KeyValuePair("item",Item); - if (Quantity is not null) yield return new KeyValuePair("quantity",Quantity); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (Occurrence is not null) yield return new KeyValuePair("occurrence",Occurrence); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (Supplier?.Any() == true) yield return new KeyValuePair("supplier",Supplier); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",DeliverFrom); - if (DeliverTo is not null) yield return new KeyValuePair("deliverTo",DeliverTo); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_Category is not null) yield return new KeyValuePair("category",_Category); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DeliverFor is not null) yield return new KeyValuePair("deliverFor",_DeliverFor); + if (_Item is not null) yield return new KeyValuePair("item",_Item); + if (_Quantity is not null) yield return new KeyValuePair("quantity",_Quantity); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_Occurrence is not null) yield return new KeyValuePair("occurrence",_Occurrence); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_Supplier?.Any() == true) yield return new KeyValuePair("supplier",_Supplier); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_DeliverFrom is not null) yield return new KeyValuePair("deliverFrom",_DeliverFrom); + if (_DeliverTo is not null) yield return new KeyValuePair("deliverTo",_DeliverTo); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Task.cs b/src/Hl7.Fhir.R5/Model/Generated/Task.cs index 36e90a54d..0f283fde6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Task.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -224,13 +227,13 @@ public partial class PerformerComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("function", InSummary=true, Order=40)] [Binding("TaskPerformerFunctionCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Function + public Hl7.Fhir.Model.CodeableConcept? Function { get { return _Function; } set { _Function = value; OnPropertyChanged("Function"); } } - private Hl7.Fhir.Model.CodeableConcept _Function; + private Hl7.Fhir.Model.CodeableConcept? _Function; /// /// Who performed the task. @@ -240,26 +243,22 @@ public Hl7.Fhir.Model.CodeableConcept Function [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","RelatedPerson")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Actor + public Hl7.Fhir.Model.ResourceReference? Actor { get { return _Actor; } set { _Actor = value; OnPropertyChanged("Actor"); } } - private Hl7.Fhir.Model.ResourceReference _Actor; + private Hl7.Fhir.Model.ResourceReference? _Actor; protected internal override void CopyToInternal(Base other) { - var dest = other as PerformerComponent; - - if (dest == null) - { + if(other is not PerformerComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Function != null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)Function.DeepCopyInternal(); - if(Actor != null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)Actor.DeepCopyInternal(); + if(_Function is not null) dest.Function = (Hl7.Fhir.Model.CodeableConcept)_Function.DeepCopyInternal(); + if(_Actor is not null) dest.Actor = (Hl7.Fhir.Model.ResourceReference)_Actor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -271,41 +270,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PerformerComponent; - if(otherT == null) return false; + if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Function, otherT.Function)) return false; - if(!comparer.Equals(Actor, otherT.Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + if(!comparer.Equals(_Actor, otherT._Actor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "function": - value = Function; - return Function is not null; + value = _Function; + return _Function is not null; case "actor": - value = Actor; - return Actor is not null; + value = _Actor; + return _Actor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "function": - Function = (Hl7.Fhir.Model.CodeableConcept)value; + Function = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "actor": - Actor = (Hl7.Fhir.Model.ResourceReference)value; + Actor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -316,8 +315,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Function is not null) yield return new KeyValuePair("function",Function); - if (Actor is not null) yield return new KeyValuePair("actor",Actor); + if (_Function is not null) yield return new KeyValuePair("function",_Function); + if (_Actor is not null) yield return new KeyValuePair("actor",_Actor); } } @@ -344,13 +343,13 @@ public partial class RestrictionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("repetitions", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RepetitionsElement + public Hl7.Fhir.Model.PositiveInt? RepetitionsElement { get { return _RepetitionsElement; } set { _RepetitionsElement = value; OnPropertyChanged("RepetitionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _RepetitionsElement; + private Hl7.Fhir.Model.PositiveInt? _RepetitionsElement; /// /// How many times to repeat @@ -359,13 +358,10 @@ public Hl7.Fhir.Model.PositiveInt RepetitionsElement [IgnoreDataMember] public int? Repetitions { - get { return RepetitionsElement != null ? RepetitionsElement.Value : null; } + get => _RepetitionsElement?.Value; set { - if (value == null) - RepetitionsElement = null; - else - RepetitionsElement = new Hl7.Fhir.Model.PositiveInt(value); + RepetitionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Repetitions"); } } @@ -375,13 +371,13 @@ public int? Repetitions /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// For whom is fulfillment sought?. @@ -393,25 +389,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; protected internal override void CopyToInternal(Base other) { - var dest = other as RestrictionComponent; - - if (dest == null) - { + if(other is not RestrictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RepetitionsElement != null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)RepetitionsElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); + if(_RepetitionsElement is not null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)_RepetitionsElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -423,48 +415,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RestrictionComponent; - if(otherT == null) return false; + if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RepetitionsElement, otherT.RepetitionsElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "repetitions": - value = RepetitionsElement; - return RepetitionsElement is not null; + value = _RepetitionsElement; + return _RepetitionsElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "repetitions": - RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)value; + RepetitionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -475,9 +467,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RepetitionsElement is not null) yield return new KeyValuePair("repetitions",RepetitionsElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); + if (_RepetitionsElement is not null) yield return new KeyValuePair("repetitions",_RepetitionsElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); } } @@ -505,13 +497,13 @@ public partial class InputComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskInputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Content to use in performing the task. @@ -521,26 +513,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Integer64),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.CodeableReference),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Availability),typeof(Hl7.Fhir.Model.ExtendedContactDetail),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as InputComponent; - - if (dest == null) - { + if(other is not InputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -552,41 +540,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as InputComponent; - if(otherT == null) return false; + if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -597,8 +585,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -626,13 +614,13 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement [Binding("TaskOutputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Result of output. @@ -642,26 +630,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Integer64),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.CodeableReference),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Availability),typeof(Hl7.Fhir.Model.ExtendedContactDetail),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -673,41 +657,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -718,8 +702,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -732,39 +716,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Formal definition of task. /// [FhirElement("instantiatesCanonical", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical InstantiatesCanonicalElement + public Hl7.Fhir.Model.Canonical? InstantiatesCanonicalElement { get { return _InstantiatesCanonicalElement; } set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _InstantiatesCanonicalElement; + private Hl7.Fhir.Model.Canonical? _InstantiatesCanonicalElement; /// /// Formal definition of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesCanonical + public string? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Value : null; } + get => _InstantiatesCanonicalElement?.Value; set { - if (value == null) - InstantiatesCanonicalElement = null; - else - InstantiatesCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + InstantiatesCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InstantiatesCanonical"); } } @@ -774,28 +755,25 @@ public string InstantiatesCanonical /// [FhirElement("instantiatesUri", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// Formal definition of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -810,24 +788,24 @@ public string InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Requisition or grouper id. /// [FhirElement("groupIdentifier", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// Composite task. @@ -839,11 +817,11 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// draft | requested | received | accepted | +. @@ -853,13 +831,13 @@ public List PartOf [Binding("TaskStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | requested | received | accepted | + @@ -868,13 +846,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Task.TaskStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -885,13 +860,13 @@ public Hl7.Fhir.Model.Task.TaskStatus? Status [FhirElement("statusReason", InSummary=true, Order=160)] [Binding("TaskStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableReference StatusReason + public Hl7.Fhir.Model.CodeableReference? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableReference _StatusReason; + private Hl7.Fhir.Model.CodeableReference? _StatusReason; /// /// E.g. "Specimen collected", "IV prepped". @@ -899,13 +874,13 @@ public Hl7.Fhir.Model.CodeableReference StatusReason [FhirElement("businessStatus", InSummary=true, Order=170)] [Binding("TaskBusinessStatus")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept BusinessStatus + public Hl7.Fhir.Model.CodeableConcept? BusinessStatus { get { return _BusinessStatus; } set { _BusinessStatus = value; OnPropertyChanged("BusinessStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _BusinessStatus; + private Hl7.Fhir.Model.CodeableConcept? _BusinessStatus; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option. @@ -915,13 +890,13 @@ public Hl7.Fhir.Model.CodeableConcept BusinessStatus [Binding("TaskIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option @@ -930,13 +905,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.Task.TaskIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -948,13 +920,13 @@ public Hl7.Fhir.Model.Task.TaskIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("TaskPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -963,13 +935,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -979,13 +948,13 @@ public Hl7.Fhir.Model.RequestPriority? Priority /// [FhirElement("doNotPerform", InSummary=true, IsModifier=true, Order=200, FiveWs="FiveWs.what[x]")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement + public Hl7.Fhir.Model.FhirBoolean? DoNotPerformElement { get { return _DoNotPerformElement; } set { _DoNotPerformElement = value; OnPropertyChanged("DoNotPerformElement"); } } - private Hl7.Fhir.Model.FhirBoolean _DoNotPerformElement; + private Hl7.Fhir.Model.FhirBoolean? _DoNotPerformElement; /// /// True if Task is prohibiting action @@ -994,13 +963,10 @@ public Hl7.Fhir.Model.FhirBoolean DoNotPerformElement [IgnoreDataMember] public bool? DoNotPerform { - get { return DoNotPerformElement != null ? DoNotPerformElement.Value : null; } + get => _DoNotPerformElement?.Value; set { - if (value == null) - DoNotPerformElement = null; - else - DoNotPerformElement = new Hl7.Fhir.Model.FhirBoolean(value); + DoNotPerformElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("DoNotPerform"); } } @@ -1011,41 +977,38 @@ public bool? DoNotPerform [FhirElement("code", InSummary=true, Order=210, FiveWs="FiveWs.what[x]")] [Binding("TaskCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Human-readable explanation of task. /// [FhirElement("description", InSummary=true, Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable explanation of task /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1057,13 +1020,13 @@ public string Description [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Beneficiary of the Task. @@ -1072,13 +1035,13 @@ public Hl7.Fhir.Model.ResourceReference Focus [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference For + public Hl7.Fhir.Model.ResourceReference? For { get { return _For; } set { _For = value; OnPropertyChanged("For"); } } - private Hl7.Fhir.Model.ResourceReference _For; + private Hl7.Fhir.Model.ResourceReference? _For; /// /// Healthcare event during which this task originated. @@ -1087,67 +1050,64 @@ public Hl7.Fhir.Model.ResourceReference For [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When the task should be performed. /// [FhirElement("requestedPeriod", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.Period RequestedPeriod + public Hl7.Fhir.Model.Period? RequestedPeriod { get { return _RequestedPeriod; } set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } - private Hl7.Fhir.Model.Period _RequestedPeriod; + private Hl7.Fhir.Model.Period? _RequestedPeriod; /// /// Start and end time of execution. /// [FhirElement("executionPeriod", InSummary=true, Order=270, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.Period ExecutionPeriod + public Hl7.Fhir.Model.Period? ExecutionPeriod { get { return _ExecutionPeriod; } set { _ExecutionPeriod = value; OnPropertyChanged("ExecutionPeriod"); } } - private Hl7.Fhir.Model.Period _ExecutionPeriod; + private Hl7.Fhir.Model.Period? _ExecutionPeriod; /// /// Task Creation Date. /// [FhirElement("authoredOn", Order=280, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Task Creation Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -1157,28 +1117,25 @@ public string AuthoredOn /// [FhirElement("lastModified", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastModifiedElement + public Hl7.Fhir.Model.FhirDateTime? LastModifiedElement { get { return _LastModifiedElement; } set { _LastModifiedElement = value; OnPropertyChanged("LastModifiedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastModifiedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastModifiedElement; /// /// Task Last Modified Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastModified + public string? LastModified { - get { return LastModifiedElement != null ? LastModifiedElement.Value : null; } + get => _LastModifiedElement?.Value; set { - if (value == null) - LastModifiedElement = null; - else - LastModifiedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastModifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastModified"); } } @@ -1190,13 +1147,13 @@ public string LastModified [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Who should perform Task. @@ -1207,11 +1164,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List RequestedPerformer { - get { if(_RequestedPerformer==null) _RequestedPerformer = new List(); return _RequestedPerformer; } + get => _RequestedPerformer ?? new List(); set { _RequestedPerformer = value; OnPropertyChanged("RequestedPerformer"); } } - private List _RequestedPerformer; + private List? _RequestedPerformer; /// /// Responsible individual. @@ -1220,13 +1177,13 @@ public List RequestedPerformer [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","Patient","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Who or what performed the task. @@ -1236,11 +1193,11 @@ public Hl7.Fhir.Model.ResourceReference Owner [DataMember] public List Performer { - get { if(_Performer==null) _Performer = new List(); return _Performer; } + get => _Performer ?? new List(); set { _Performer = value; OnPropertyChanged("Performer"); } } - private List _Performer; + private List? _Performer; /// /// Where task occurs. @@ -1249,13 +1206,13 @@ public List Performer [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Why task is needed. @@ -1266,11 +1223,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Reason { - get { if(_Reason==null) _Reason = new List(); return _Reason; } + get => _Reason ?? new List(); set { _Reason = value; OnPropertyChanged("Reason"); } } - private List _Reason; + private List? _Reason; /// /// Associated insurance coverage. @@ -1282,11 +1239,11 @@ public List Reason [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Comments made about the task. @@ -1296,11 +1253,11 @@ public List Insurance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Key events in history of the Task. @@ -1312,24 +1269,24 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Constraints on fulfillment tasks. /// [FhirElement("restriction", Order=390)] [DataMember] - public Hl7.Fhir.Model.Task.RestrictionComponent Restriction + public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction { get { return _Restriction; } set { _Restriction = value; OnPropertyChanged("Restriction"); } } - private Hl7.Fhir.Model.Task.RestrictionComponent _Restriction; + private Hl7.Fhir.Model.Task.RestrictionComponent? _Restriction; /// /// Information used to perform task. @@ -1339,11 +1296,11 @@ public Hl7.Fhir.Model.Task.RestrictionComponent Restriction [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Information produced as part of task. @@ -1353,57 +1310,53 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Task; - - if (dest == null) - { + if(other is not Task dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)InstantiatesCanonicalElement.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableReference)StatusReason.DeepCopyInternal(); - if(BusinessStatus != null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)BusinessStatus.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(DoNotPerformElement != null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(For != null) dest.For = (Hl7.Fhir.Model.ResourceReference)For.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(RequestedPeriod != null) dest.RequestedPeriod = (Hl7.Fhir.Model.Period)RequestedPeriod.DeepCopyInternal(); - if(ExecutionPeriod != null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)ExecutionPeriod.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(LastModifiedElement != null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)LastModifiedElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(RequestedPerformer.Any()) dest.RequestedPerformer = new List(RequestedPerformer.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Performer.Any()) dest.Performer = new List(Performer.DeepCopyInternal()); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Reason.Any()) dest.Reason = new List(Reason.DeepCopyInternal()); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Restriction != null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)Restriction.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)_InstantiatesCanonicalElement.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableReference)_StatusReason.DeepCopyInternal(); + if(_BusinessStatus is not null) dest.BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)_BusinessStatus.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_DoNotPerformElement is not null) dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)_DoNotPerformElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_For is not null) dest.For = (Hl7.Fhir.Model.ResourceReference)_For.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_RequestedPeriod is not null) dest.RequestedPeriod = (Hl7.Fhir.Model.Period)_RequestedPeriod.DeepCopyInternal(); + if(_ExecutionPeriod is not null) dest.ExecutionPeriod = (Hl7.Fhir.Model.Period)_ExecutionPeriod.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_LastModifiedElement is not null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)_LastModifiedElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_RequestedPerformer is not null) dest.RequestedPerformer = new List(_RequestedPerformer.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Performer is not null) dest.Performer = new List(_Performer.DeepCopyInternal()); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = new List(_Reason.DeepCopyInternal()); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Restriction is not null) dest.Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)_Restriction.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1415,258 +1368,258 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Task; - if(otherT == null) return false; + if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(BusinessStatus, otherT.BusinessStatus)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(DoNotPerformElement, otherT.DoNotPerformElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(For, otherT.For)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(RequestedPeriod, otherT.RequestedPeriod)) return false; - if(!comparer.Equals(ExecutionPeriod, otherT.ExecutionPeriod)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(LastModifiedElement, otherT.LastModifiedElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(RequestedPerformer, otherT.RequestedPerformer)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.ListEquals(Performer, otherT.Performer)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Reason, otherT.Reason)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.Equals(Restriction, otherT.Restriction)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_BusinessStatus, otherT._BusinessStatus)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_For, otherT._For)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_RequestedPeriod, otherT._RequestedPeriod)) return false; + if(!comparer.Equals(_ExecutionPeriod, otherT._ExecutionPeriod)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_RequestedPerformer, otherT._RequestedPerformer)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement is not null; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "businessStatus": - value = BusinessStatus; - return BusinessStatus is not null; + value = _BusinessStatus; + return _BusinessStatus is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "doNotPerform": - value = DoNotPerformElement; - return DoNotPerformElement is not null; + value = _DoNotPerformElement; + return _DoNotPerformElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "for": - value = For; - return For is not null; + value = _For; + return _For is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "requestedPeriod": - value = RequestedPeriod; - return RequestedPeriod is not null; + value = _RequestedPeriod; + return _RequestedPeriod is not null; case "executionPeriod": - value = ExecutionPeriod; - return ExecutionPeriod is not null; + value = _ExecutionPeriod; + return _ExecutionPeriod is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "lastModified": - value = LastModifiedElement; - return LastModifiedElement is not null; + value = _LastModifiedElement; + return _LastModifiedElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "requestedPerformer": - value = RequestedPerformer; - return RequestedPerformer?.Any() == true; + value = _RequestedPerformer; + return _RequestedPerformer?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "performer": - value = Performer; - return Performer?.Any() == true; + value = _Performer; + return _Performer?.Any() == true; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "reason": - value = Reason; - return Reason?.Any() == true; + value = _Reason; + return _Reason?.Any() == true; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "restriction": - value = Restriction; - return Restriction is not null; + value = _Restriction; + return _Restriction is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableReference)value; + StatusReason = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "businessStatus": - BusinessStatus = (Hl7.Fhir.Model.CodeableConcept)value; + BusinessStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "doNotPerform": - DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)value; + DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "for": - For = (Hl7.Fhir.Model.ResourceReference)value; + For = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestedPeriod": - RequestedPeriod = (Hl7.Fhir.Model.Period)value; + RequestedPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "executionPeriod": - ExecutionPeriod = (Hl7.Fhir.Model.Period)value; + ExecutionPeriod = (Hl7.Fhir.Model.Period?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastModified": - LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "requestedPerformer": - RequestedPerformer = (List)value; + RequestedPerformer = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performer": - Performer = (List)value; + Performer = (List?)value!; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (List)value; + Reason = (List?)value!; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "restriction": - Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent)value; + Restriction = (Hl7.Fhir.Model.Task.RestrictionComponent?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1677,39 +1630,39 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (BusinessStatus is not null) yield return new KeyValuePair("businessStatus",BusinessStatus); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",DoNotPerformElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (For is not null) yield return new KeyValuePair("for",For); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (RequestedPeriod is not null) yield return new KeyValuePair("requestedPeriod",RequestedPeriod); - if (ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",ExecutionPeriod); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (LastModifiedElement is not null) yield return new KeyValuePair("lastModified",LastModifiedElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (RequestedPerformer?.Any() == true) yield return new KeyValuePair("requestedPerformer",RequestedPerformer); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Performer?.Any() == true) yield return new KeyValuePair("performer",Performer); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Reason?.Any() == true) yield return new KeyValuePair("reason",Reason); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Restriction is not null) yield return new KeyValuePair("restriction",Restriction); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_BusinessStatus is not null) yield return new KeyValuePair("businessStatus",_BusinessStatus); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_DoNotPerformElement is not null) yield return new KeyValuePair("doNotPerform",_DoNotPerformElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_For is not null) yield return new KeyValuePair("for",_For); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_RequestedPeriod is not null) yield return new KeyValuePair("requestedPeriod",_RequestedPeriod); + if (_ExecutionPeriod is not null) yield return new KeyValuePair("executionPeriod",_ExecutionPeriod); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_LastModifiedElement is not null) yield return new KeyValuePair("lastModified",_LastModifiedElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_RequestedPerformer?.Any() == true) yield return new KeyValuePair("requestedPerformer",_RequestedPerformer); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Performer?.Any() == true) yield return new KeyValuePair("performer",_Performer); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Reason?.Any() == true) yield return new KeyValuePair("reason",_Reason); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Restriction is not null) yield return new KeyValuePair("restriction",_Restriction); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs index 719db496b..f2c6438eb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -109,28 +112,25 @@ public partial class SoftwareComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// A name the software is known by /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -140,44 +140,37 @@ public string Name /// [FhirElement("version", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Version covered by this statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as SoftwareComponent; - - if (dest == null) - { + if(other is not SoftwareComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -189,41 +182,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SoftwareComponent; - if(otherT == null) return false; + if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -234,8 +227,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); } } @@ -262,28 +255,25 @@ public partial class ImplementationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("description", InSummary=true, Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Describes this specific instance /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -293,44 +283,37 @@ public string Description /// [FhirElement("url", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// Base URL for the implementation /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ImplementationComponent; - - if (dest == null) - { + if(other is not ImplementationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -342,41 +325,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ImplementationComponent; - if(otherT == null) return false; + if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -387,8 +370,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -415,28 +398,25 @@ public partial class CodeSystemComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("uri", Order=40)] [DataMember] - public Hl7.Fhir.Model.Canonical UriElement + public Hl7.Fhir.Model.Canonical? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.Canonical _UriElement; + private Hl7.Fhir.Model.Canonical? _UriElement; /// /// Canonical identifier for the code system, represented as a URI /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.Canonical(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Uri"); } } @@ -449,11 +429,11 @@ public string Uri [DataMember] public List Version { - get { if(_Version==null) _Version = new List(); return _Version; } + get => _Version ?? new List(); set { _Version = value; OnPropertyChanged("Version"); } } - private List _Version; + private List? _Version; /// /// not-present | example | fragment | complete | supplement. @@ -463,13 +443,13 @@ public List Version [Binding("CodeSystemContentMode")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ContentElement + public Code? ContentElement { get { return _ContentElement; } set { _ContentElement = value; OnPropertyChanged("ContentElement"); } } - private Code _ContentElement; + private Code? _ContentElement; /// /// not-present | example | fragment | complete | supplement @@ -478,13 +458,10 @@ public Code ContentElement [IgnoreDataMember] public Hl7.Fhir.Model.CodeSystemContentMode? Content { - get { return ContentElement != null ? ContentElement.Value : null; } + get => _ContentElement?.Value; set { - if (value == null) - ContentElement = null; - else - ContentElement = new Code(value); + ContentElement = value is null ? null : new Code(value); OnPropertyChanged("Content"); } } @@ -494,13 +471,13 @@ public Hl7.Fhir.Model.CodeSystemContentMode? Content /// [FhirElement("subsumption", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean SubsumptionElement + public Hl7.Fhir.Model.FhirBoolean? SubsumptionElement { get { return _SubsumptionElement; } set { _SubsumptionElement = value; OnPropertyChanged("SubsumptionElement"); } } - private Hl7.Fhir.Model.FhirBoolean _SubsumptionElement; + private Hl7.Fhir.Model.FhirBoolean? _SubsumptionElement; /// /// Whether subsumption is supported @@ -509,31 +486,24 @@ public Hl7.Fhir.Model.FhirBoolean SubsumptionElement [IgnoreDataMember] public bool? Subsumption { - get { return SubsumptionElement != null ? SubsumptionElement.Value : null; } + get => _SubsumptionElement?.Value; set { - if (value == null) - SubsumptionElement = null; - else - SubsumptionElement = new Hl7.Fhir.Model.FhirBoolean(value); + SubsumptionElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Subsumption"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CodeSystemComponent; - - if (dest == null) - { + if(other is not CodeSystemComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.Canonical)UriElement.DeepCopyInternal(); - if(Version.Any()) dest.Version = new List(Version.DeepCopyInternal()); - if(ContentElement != null) dest.ContentElement = (Code)ContentElement.DeepCopyInternal(); - if(SubsumptionElement != null) dest.SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)SubsumptionElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.Canonical)_UriElement.DeepCopyInternal(); + if(_Version is not null) dest.Version = new List(_Version.DeepCopyInternal()); + if(_ContentElement is not null) dest.ContentElement = (Code)_ContentElement.DeepCopyInternal(); + if(_SubsumptionElement is not null) dest.SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)_SubsumptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -545,55 +515,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CodeSystemComponent; - if(otherT == null) return false; + if(other is not CodeSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.ListEquals(Version, otherT.Version)) return false; - if(!comparer.Equals(ContentElement, otherT.ContentElement)) return false; - if(!comparer.Equals(SubsumptionElement, otherT.SubsumptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.ListEquals(_Version, otherT._Version)) return false; + if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; + if(!comparer.Equals(_SubsumptionElement, otherT._SubsumptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "version": - value = Version; - return Version?.Any() == true; + value = _Version; + return _Version?.Any() == true; case "content": - value = ContentElement; - return ContentElement is not null; + value = _ContentElement; + return _ContentElement is not null; case "subsumption": - value = SubsumptionElement; - return SubsumptionElement is not null; + value = _SubsumptionElement; + return _SubsumptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "uri": - UriElement = (Hl7.Fhir.Model.Canonical)value; + UriElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "version": - Version = (List)value; + Version = (List?)value!; return this; case "content": - ContentElement = (Code)value; + ContentElement = (Code?)value; return this; case "subsumption": - SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean)value; + SubsumptionElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -604,10 +574,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (Version?.Any() == true) yield return new KeyValuePair("version",Version); - if (ContentElement is not null) yield return new KeyValuePair("content",ContentElement); - if (SubsumptionElement is not null) yield return new KeyValuePair("subsumption",SubsumptionElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_Version?.Any() == true) yield return new KeyValuePair("version",_Version); + if (_ContentElement is not null) yield return new KeyValuePair("content",_ContentElement); + if (_SubsumptionElement is not null) yield return new KeyValuePair("subsumption",_SubsumptionElement); } } @@ -634,28 +604,25 @@ public partial class VersionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("code", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString CodeElement + public Hl7.Fhir.Model.FhirString? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.FhirString _CodeElement; + private Hl7.Fhir.Model.FhirString? _CodeElement; /// /// Version identifier for this version /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.FhirString(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Code"); } } @@ -665,13 +632,13 @@ public string Code /// [FhirElement("isDefault", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IsDefaultElement + public Hl7.Fhir.Model.FhirBoolean? IsDefaultElement { get { return _IsDefaultElement; } set { _IsDefaultElement = value; OnPropertyChanged("IsDefaultElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IsDefaultElement; + private Hl7.Fhir.Model.FhirBoolean? _IsDefaultElement; /// /// If this is the default version for this code system @@ -680,13 +647,10 @@ public Hl7.Fhir.Model.FhirBoolean IsDefaultElement [IgnoreDataMember] public bool? IsDefault { - get { return IsDefaultElement != null ? IsDefaultElement.Value : null; } + get => _IsDefaultElement?.Value; set { - if (value == null) - IsDefaultElement = null; - else - IsDefaultElement = new Hl7.Fhir.Model.FhirBoolean(value); + IsDefaultElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("IsDefault"); } } @@ -696,13 +660,13 @@ public bool? IsDefault /// [FhirElement("compositional", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean CompositionalElement + public Hl7.Fhir.Model.FhirBoolean? CompositionalElement { get { return _CompositionalElement; } set { _CompositionalElement = value; OnPropertyChanged("CompositionalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _CompositionalElement; + private Hl7.Fhir.Model.FhirBoolean? _CompositionalElement; /// /// If compositional grammar is supported @@ -711,13 +675,10 @@ public Hl7.Fhir.Model.FhirBoolean CompositionalElement [IgnoreDataMember] public bool? Compositional { - get { return CompositionalElement != null ? CompositionalElement.Value : null; } + get => _CompositionalElement?.Value; set { - if (value == null) - CompositionalElement = null; - else - CompositionalElement = new Hl7.Fhir.Model.FhirBoolean(value); + CompositionalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Compositional"); } } @@ -732,24 +693,24 @@ public bool? Compositional [DataMember] public List> LanguageElement { - get { if(_LanguageElement==null) _LanguageElement = new List>(); return _LanguageElement; } + get => _LanguageElement ?? new List>(); set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } - private List> _LanguageElement; + private List>? _LanguageElement; /// /// Language Displays supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Language + public IEnumerable? Language { - get { return LanguageElement != null ? LanguageElement.Select(elem => elem.Value) : null; } + get => _LanguageElement?.Select(elem => elem.Value); set { if (value == null) - LanguageElement = null; + LanguageElement = null!; else LanguageElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("Language"); @@ -764,11 +725,11 @@ public IEnumerable Language [DataMember] public List Filter { - get { if(_Filter==null) _Filter = new List(); return _Filter; } + get => _Filter ?? new List(); set { _Filter = value; OnPropertyChanged("Filter"); } } - private List _Filter; + private List? _Filter; /// /// Properties supported for $lookup. @@ -778,24 +739,24 @@ public List Filter [DataMember] public List PropertyElement { - get { if(_PropertyElement==null) _PropertyElement = new List(); return _PropertyElement; } + get => _PropertyElement ?? new List(); set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } - private List _PropertyElement; + private List? _PropertyElement; /// /// Properties supported for $lookup /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Property + public IEnumerable? Property { - get { return PropertyElement != null ? PropertyElement.Select(elem => elem.Value) : null; } + get => _PropertyElement?.Select(elem => elem.Value); set { if (value == null) - PropertyElement = null; + PropertyElement = null!; else PropertyElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Property"); @@ -804,20 +765,16 @@ public IEnumerable Property protected internal override void CopyToInternal(Base other) { - var dest = other as VersionComponent; - - if (dest == null) - { + if(other is not VersionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)CodeElement.DeepCopyInternal(); - if(IsDefaultElement != null) dest.IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)IsDefaultElement.DeepCopyInternal(); - if(CompositionalElement != null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)CompositionalElement.DeepCopyInternal(); - if(LanguageElement.Any()) dest.LanguageElement = new List>(LanguageElement.DeepCopyInternal()); - if(Filter.Any()) dest.Filter = new List(Filter.DeepCopyInternal()); - if(PropertyElement.Any()) dest.PropertyElement = new List(PropertyElement.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.FhirString)_CodeElement.DeepCopyInternal(); + if(_IsDefaultElement is not null) dest.IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)_IsDefaultElement.DeepCopyInternal(); + if(_CompositionalElement is not null) dest.CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)_CompositionalElement.DeepCopyInternal(); + if(_LanguageElement is not null) dest.LanguageElement = new List>(_LanguageElement.DeepCopyInternal()); + if(_Filter is not null) dest.Filter = new List(_Filter.DeepCopyInternal()); + if(_PropertyElement is not null) dest.PropertyElement = new List(_PropertyElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -829,69 +786,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VersionComponent; - if(otherT == null) return false; + if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.Equals(IsDefaultElement, otherT.IsDefaultElement)) return false; - if(!comparer.Equals(CompositionalElement, otherT.CompositionalElement)) return false; - if(!comparer.ListEquals(LanguageElement, otherT.LanguageElement)) return false; - if(!comparer.ListEquals(Filter, otherT.Filter)) return false; - if(!comparer.ListEquals(PropertyElement, otherT.PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.Equals(_IsDefaultElement, otherT._IsDefaultElement)) return false; + if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; + if(!comparer.ListEquals(_LanguageElement, otherT._LanguageElement)) return false; + if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; + if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "isDefault": - value = IsDefaultElement; - return IsDefaultElement is not null; + value = _IsDefaultElement; + return _IsDefaultElement is not null; case "compositional": - value = CompositionalElement; - return CompositionalElement is not null; + value = _CompositionalElement; + return _CompositionalElement is not null; case "language": - value = LanguageElement; - return LanguageElement?.Any() == true; + value = _LanguageElement; + return _LanguageElement?.Any() == true; case "filter": - value = Filter; - return Filter?.Any() == true; + value = _Filter; + return _Filter?.Any() == true; case "property": - value = PropertyElement; - return PropertyElement?.Any() == true; + value = _PropertyElement; + return _PropertyElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.FhirString)value; + CodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "isDefault": - IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean)value; + IsDefaultElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "compositional": - CompositionalElement = (Hl7.Fhir.Model.FhirBoolean)value; + CompositionalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "language": - LanguageElement = (List>)value; + LanguageElement = (List>?)value!; return this; case "filter": - Filter = (List)value; + Filter = (List?)value!; return this; case "property": - PropertyElement = (List)value; + PropertyElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -902,12 +859,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (IsDefaultElement is not null) yield return new KeyValuePair("isDefault",IsDefaultElement); - if (CompositionalElement is not null) yield return new KeyValuePair("compositional",CompositionalElement); - if (LanguageElement?.Any() == true) yield return new KeyValuePair("language",LanguageElement); - if (Filter?.Any() == true) yield return new KeyValuePair("filter",Filter); - if (PropertyElement?.Any() == true) yield return new KeyValuePair("property",PropertyElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_IsDefaultElement is not null) yield return new KeyValuePair("isDefault",_IsDefaultElement); + if (_CompositionalElement is not null) yield return new KeyValuePair("compositional",_CompositionalElement); + if (_LanguageElement?.Any() == true) yield return new KeyValuePair("language",_LanguageElement); + if (_Filter?.Any() == true) yield return new KeyValuePair("filter",_Filter); + if (_PropertyElement?.Any() == true) yield return new KeyValuePair("property",_PropertyElement); } } @@ -931,28 +888,25 @@ public partial class FilterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("code", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code CodeElement + public Hl7.Fhir.Model.Code? CodeElement { get { return _CodeElement; } set { _CodeElement = value; OnPropertyChanged("CodeElement"); } } - private Hl7.Fhir.Model.Code _CodeElement; + private Hl7.Fhir.Model.Code? _CodeElement; /// /// Code of the property supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Code + public string? Code { - get { return CodeElement != null ? CodeElement.Value : null; } + get => _CodeElement?.Value; set { - if (value == null) - CodeElement = null; - else - CodeElement = new Hl7.Fhir.Model.Code(value); + CodeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Code"); } } @@ -965,24 +919,24 @@ public string Code [DataMember] public List OpElement { - get { if(_OpElement==null) _OpElement = new List(); return _OpElement; } + get => _OpElement ?? new List(); set { _OpElement = value; OnPropertyChanged("OpElement"); } } - private List _OpElement; + private List? _OpElement; /// /// Operations supported for the property /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Op + public IEnumerable? Op { - get { return OpElement != null ? OpElement.Select(elem => elem.Value) : null; } + get => _OpElement?.Select(elem => elem.Value); set { if (value == null) - OpElement = null; + OpElement = null!; else OpElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Code(elem))); OnPropertyChanged("Op"); @@ -991,16 +945,12 @@ public IEnumerable Op protected internal override void CopyToInternal(Base other) { - var dest = other as FilterComponent; - - if (dest == null) - { + if(other is not FilterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(CodeElement != null) dest.CodeElement = (Hl7.Fhir.Model.Code)CodeElement.DeepCopyInternal(); - if(OpElement.Any()) dest.OpElement = new List(OpElement.DeepCopyInternal()); + if(_CodeElement is not null) dest.CodeElement = (Hl7.Fhir.Model.Code)_CodeElement.DeepCopyInternal(); + if(_OpElement is not null) dest.OpElement = new List(_OpElement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1012,41 +962,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FilterComponent; - if(otherT == null) return false; + if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(CodeElement, otherT.CodeElement)) return false; - if(!comparer.ListEquals(OpElement, otherT.OpElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + if(!comparer.ListEquals(_OpElement, otherT._OpElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "code": - value = CodeElement; - return CodeElement is not null; + value = _CodeElement; + return _CodeElement is not null; case "op": - value = OpElement; - return OpElement?.Any() == true; + value = _OpElement; + return _OpElement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "code": - CodeElement = (Hl7.Fhir.Model.Code)value; + CodeElement = (Hl7.Fhir.Model.Code?)value; return this; case "op": - OpElement = (List)value; + OpElement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1057,8 +1007,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (CodeElement is not null) yield return new KeyValuePair("code",CodeElement); - if (OpElement?.Any() == true) yield return new KeyValuePair("op",OpElement); + if (_CodeElement is not null) yield return new KeyValuePair("code",_CodeElement); + if (_OpElement?.Any() == true) yield return new KeyValuePair("op",_OpElement); } } @@ -1081,13 +1031,13 @@ public partial class ExpansionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("hierarchical", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean HierarchicalElement + public Hl7.Fhir.Model.FhirBoolean? HierarchicalElement { get { return _HierarchicalElement; } set { _HierarchicalElement = value; OnPropertyChanged("HierarchicalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _HierarchicalElement; + private Hl7.Fhir.Model.FhirBoolean? _HierarchicalElement; /// /// Whether the server can return nested value sets @@ -1096,13 +1046,10 @@ public Hl7.Fhir.Model.FhirBoolean HierarchicalElement [IgnoreDataMember] public bool? Hierarchical { - get { return HierarchicalElement != null ? HierarchicalElement.Value : null; } + get => _HierarchicalElement?.Value; set { - if (value == null) - HierarchicalElement = null; - else - HierarchicalElement = new Hl7.Fhir.Model.FhirBoolean(value); + HierarchicalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Hierarchical"); } } @@ -1112,13 +1059,13 @@ public bool? Hierarchical /// [FhirElement("paging", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean PagingElement + public Hl7.Fhir.Model.FhirBoolean? PagingElement { get { return _PagingElement; } set { _PagingElement = value; OnPropertyChanged("PagingElement"); } } - private Hl7.Fhir.Model.FhirBoolean _PagingElement; + private Hl7.Fhir.Model.FhirBoolean? _PagingElement; /// /// Whether the server supports paging on expansion @@ -1127,13 +1074,10 @@ public Hl7.Fhir.Model.FhirBoolean PagingElement [IgnoreDataMember] public bool? Paging { - get { return PagingElement != null ? PagingElement.Value : null; } + get => _PagingElement?.Value; set { - if (value == null) - PagingElement = null; - else - PagingElement = new Hl7.Fhir.Model.FhirBoolean(value); + PagingElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Paging"); } } @@ -1143,13 +1087,13 @@ public bool? Paging /// [FhirElement("incomplete", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean IncompleteElement + public Hl7.Fhir.Model.FhirBoolean? IncompleteElement { get { return _IncompleteElement; } set { _IncompleteElement = value; OnPropertyChanged("IncompleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _IncompleteElement; + private Hl7.Fhir.Model.FhirBoolean? _IncompleteElement; /// /// Allow request for incomplete expansions? @@ -1158,13 +1102,10 @@ public Hl7.Fhir.Model.FhirBoolean IncompleteElement [IgnoreDataMember] public bool? Incomplete { - get { return IncompleteElement != null ? IncompleteElement.Value : null; } + get => _IncompleteElement?.Value; set { - if (value == null) - IncompleteElement = null; - else - IncompleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + IncompleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Incomplete"); } } @@ -1177,58 +1118,51 @@ public bool? Incomplete [DataMember] public List Parameter { - get { if(_Parameter==null) _Parameter = new List(); return _Parameter; } + get => _Parameter ?? new List(); set { _Parameter = value; OnPropertyChanged("Parameter"); } } - private List _Parameter; + private List? _Parameter; /// /// Documentation about text searching works. /// [FhirElement("textFilter", Order=80)] [DataMember] - public Hl7.Fhir.Model.Markdown TextFilterElement + public Hl7.Fhir.Model.Markdown? TextFilterElement { get { return _TextFilterElement; } set { _TextFilterElement = value; OnPropertyChanged("TextFilterElement"); } } - private Hl7.Fhir.Model.Markdown _TextFilterElement; + private Hl7.Fhir.Model.Markdown? _TextFilterElement; /// /// Documentation about text searching works /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TextFilter + public string? TextFilter { - get { return TextFilterElement != null ? TextFilterElement.Value : null; } + get => _TextFilterElement?.Value; set { - if (value == null) - TextFilterElement = null; - else - TextFilterElement = new Hl7.Fhir.Model.Markdown(value); + TextFilterElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("TextFilter"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ExpansionComponent; - - if (dest == null) - { + if(other is not ExpansionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(HierarchicalElement != null) dest.HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)HierarchicalElement.DeepCopyInternal(); - if(PagingElement != null) dest.PagingElement = (Hl7.Fhir.Model.FhirBoolean)PagingElement.DeepCopyInternal(); - if(IncompleteElement != null) dest.IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)IncompleteElement.DeepCopyInternal(); - if(Parameter.Any()) dest.Parameter = new List(Parameter.DeepCopyInternal()); - if(TextFilterElement != null) dest.TextFilterElement = (Hl7.Fhir.Model.Markdown)TextFilterElement.DeepCopyInternal(); + if(_HierarchicalElement is not null) dest.HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)_HierarchicalElement.DeepCopyInternal(); + if(_PagingElement is not null) dest.PagingElement = (Hl7.Fhir.Model.FhirBoolean)_PagingElement.DeepCopyInternal(); + if(_IncompleteElement is not null) dest.IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)_IncompleteElement.DeepCopyInternal(); + if(_Parameter is not null) dest.Parameter = new List(_Parameter.DeepCopyInternal()); + if(_TextFilterElement is not null) dest.TextFilterElement = (Hl7.Fhir.Model.Markdown)_TextFilterElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1240,62 +1174,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ExpansionComponent; - if(otherT == null) return false; + if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(HierarchicalElement, otherT.HierarchicalElement)) return false; - if(!comparer.Equals(PagingElement, otherT.PagingElement)) return false; - if(!comparer.Equals(IncompleteElement, otherT.IncompleteElement)) return false; - if(!comparer.ListEquals(Parameter, otherT.Parameter)) return false; - if(!comparer.Equals(TextFilterElement, otherT.TextFilterElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; + if(!comparer.Equals(_PagingElement, otherT._PagingElement)) return false; + if(!comparer.Equals(_IncompleteElement, otherT._IncompleteElement)) return false; + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + if(!comparer.Equals(_TextFilterElement, otherT._TextFilterElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "hierarchical": - value = HierarchicalElement; - return HierarchicalElement is not null; + value = _HierarchicalElement; + return _HierarchicalElement is not null; case "paging": - value = PagingElement; - return PagingElement is not null; + value = _PagingElement; + return _PagingElement is not null; case "incomplete": - value = IncompleteElement; - return IncompleteElement is not null; + value = _IncompleteElement; + return _IncompleteElement is not null; case "parameter": - value = Parameter; - return Parameter?.Any() == true; + value = _Parameter; + return _Parameter?.Any() == true; case "textFilter": - value = TextFilterElement; - return TextFilterElement is not null; + value = _TextFilterElement; + return _TextFilterElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "hierarchical": - HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean)value; + HierarchicalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "paging": - PagingElement = (Hl7.Fhir.Model.FhirBoolean)value; + PagingElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "incomplete": - IncompleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + IncompleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "parameter": - Parameter = (List)value; + Parameter = (List?)value!; return this; case "textFilter": - TextFilterElement = (Hl7.Fhir.Model.Markdown)value; + TextFilterElement = (Hl7.Fhir.Model.Markdown?)value; return this; default: return base.SetValue(key, value); @@ -1306,11 +1240,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (HierarchicalElement is not null) yield return new KeyValuePair("hierarchical",HierarchicalElement); - if (PagingElement is not null) yield return new KeyValuePair("paging",PagingElement); - if (IncompleteElement is not null) yield return new KeyValuePair("incomplete",IncompleteElement); - if (Parameter?.Any() == true) yield return new KeyValuePair("parameter",Parameter); - if (TextFilterElement is not null) yield return new KeyValuePair("textFilter",TextFilterElement); + if (_HierarchicalElement is not null) yield return new KeyValuePair("hierarchical",_HierarchicalElement); + if (_PagingElement is not null) yield return new KeyValuePair("paging",_PagingElement); + if (_IncompleteElement is not null) yield return new KeyValuePair("incomplete",_IncompleteElement); + if (_Parameter?.Any() == true) yield return new KeyValuePair("parameter",_Parameter); + if (_TextFilterElement is not null) yield return new KeyValuePair("textFilter",_TextFilterElement); } } @@ -1334,28 +1268,25 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Code NameElement + public Hl7.Fhir.Model.Code? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.Code _NameElement; + private Hl7.Fhir.Model.Code? _NameElement; /// /// Name of the supported expansion parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.Code(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Name"); } } @@ -1365,44 +1296,37 @@ public string Name /// [FhirElement("documentation", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DocumentationElement + public Hl7.Fhir.Model.FhirString? DocumentationElement { get { return _DocumentationElement; } set { _DocumentationElement = value; OnPropertyChanged("DocumentationElement"); } } - private Hl7.Fhir.Model.FhirString _DocumentationElement; + private Hl7.Fhir.Model.FhirString? _DocumentationElement; /// /// Description of support for parameter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Documentation + public string? Documentation { - get { return DocumentationElement != null ? DocumentationElement.Value : null; } + get => _DocumentationElement?.Value; set { - if (value == null) - DocumentationElement = null; - else - DocumentationElement = new Hl7.Fhir.Model.FhirString(value); + DocumentationElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Documentation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.Code)NameElement.DeepCopyInternal(); - if(DocumentationElement != null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)DocumentationElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.Code)_NameElement.DeepCopyInternal(); + if(_DocumentationElement is not null) dest.DocumentationElement = (Hl7.Fhir.Model.FhirString)_DocumentationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1414,41 +1338,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DocumentationElement, otherT.DocumentationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "documentation": - value = DocumentationElement; - return DocumentationElement is not null; + value = _DocumentationElement; + return _DocumentationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.Code)value; + NameElement = (Hl7.Fhir.Model.Code?)value; return this; case "documentation": - DocumentationElement = (Hl7.Fhir.Model.FhirString)value; + DocumentationElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1459,8 +1383,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DocumentationElement is not null) yield return new KeyValuePair("documentation",DocumentationElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DocumentationElement is not null) yield return new KeyValuePair("documentation",_DocumentationElement); } } @@ -1484,13 +1408,13 @@ public partial class ValidateCodeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("translations", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TranslationsElement + public Hl7.Fhir.Model.FhirBoolean? TranslationsElement { get { return _TranslationsElement; } set { _TranslationsElement = value; OnPropertyChanged("TranslationsElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TranslationsElement; + private Hl7.Fhir.Model.FhirBoolean? _TranslationsElement; /// /// Whether translations are validated @@ -1499,28 +1423,21 @@ public Hl7.Fhir.Model.FhirBoolean TranslationsElement [IgnoreDataMember] public bool? Translations { - get { return TranslationsElement != null ? TranslationsElement.Value : null; } + get => _TranslationsElement?.Value; set { - if (value == null) - TranslationsElement = null; - else - TranslationsElement = new Hl7.Fhir.Model.FhirBoolean(value); + TranslationsElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Translations"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ValidateCodeComponent; - - if (dest == null) - { + if(other is not ValidateCodeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TranslationsElement != null) dest.TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)TranslationsElement.DeepCopyInternal(); + if(_TranslationsElement is not null) dest.TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)_TranslationsElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1532,34 +1449,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValidateCodeComponent; - if(otherT == null) return false; + if(other is not ValidateCodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TranslationsElement, otherT.TranslationsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "translations": - value = TranslationsElement; - return TranslationsElement is not null; + value = _TranslationsElement; + return _TranslationsElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "translations": - TranslationsElement = (Hl7.Fhir.Model.FhirBoolean)value; + TranslationsElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1570,7 +1487,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TranslationsElement is not null) yield return new KeyValuePair("translations",TranslationsElement); + if (_TranslationsElement is not null) yield return new KeyValuePair("translations",_TranslationsElement); } } @@ -1594,13 +1511,13 @@ public partial class TranslationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("needsMap", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NeedsMapElement + public Hl7.Fhir.Model.FhirBoolean? NeedsMapElement { get { return _NeedsMapElement; } set { _NeedsMapElement = value; OnPropertyChanged("NeedsMapElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NeedsMapElement; + private Hl7.Fhir.Model.FhirBoolean? _NeedsMapElement; /// /// Whether the client must identify the map @@ -1609,28 +1526,21 @@ public Hl7.Fhir.Model.FhirBoolean NeedsMapElement [IgnoreDataMember] public bool? NeedsMap { - get { return NeedsMapElement != null ? NeedsMapElement.Value : null; } + get => _NeedsMapElement?.Value; set { - if (value == null) - NeedsMapElement = null; - else - NeedsMapElement = new Hl7.Fhir.Model.FhirBoolean(value); + NeedsMapElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NeedsMap"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as TranslationComponent; - - if (dest == null) - { + if(other is not TranslationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NeedsMapElement != null) dest.NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)NeedsMapElement.DeepCopyInternal(); + if(_NeedsMapElement is not null) dest.NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)_NeedsMapElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1642,34 +1552,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TranslationComponent; - if(otherT == null) return false; + if(other is not TranslationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NeedsMapElement, otherT.NeedsMapElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "needsMap": - value = NeedsMapElement; - return NeedsMapElement is not null; + value = _NeedsMapElement; + return _NeedsMapElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "needsMap": - NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean)value; + NeedsMapElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1680,7 +1590,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NeedsMapElement is not null) yield return new KeyValuePair("needsMap",NeedsMapElement); + if (_NeedsMapElement is not null) yield return new KeyValuePair("needsMap",_NeedsMapElement); } } @@ -1706,13 +1616,13 @@ public partial class ClosureComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("translation", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean TranslationElement + public Hl7.Fhir.Model.FhirBoolean? TranslationElement { get { return _TranslationElement; } set { _TranslationElement = value; OnPropertyChanged("TranslationElement"); } } - private Hl7.Fhir.Model.FhirBoolean _TranslationElement; + private Hl7.Fhir.Model.FhirBoolean? _TranslationElement; /// /// If cross-system closure is supported @@ -1721,28 +1631,21 @@ public Hl7.Fhir.Model.FhirBoolean TranslationElement [IgnoreDataMember] public bool? Translation { - get { return TranslationElement != null ? TranslationElement.Value : null; } + get => _TranslationElement?.Value; set { - if (value == null) - TranslationElement = null; - else - TranslationElement = new Hl7.Fhir.Model.FhirBoolean(value); + TranslationElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Translation"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ClosureComponent; - - if (dest == null) - { + if(other is not ClosureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TranslationElement != null) dest.TranslationElement = (Hl7.Fhir.Model.FhirBoolean)TranslationElement.DeepCopyInternal(); + if(_TranslationElement is not null) dest.TranslationElement = (Hl7.Fhir.Model.FhirBoolean)_TranslationElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1754,34 +1657,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ClosureComponent; - if(otherT == null) return false; + if(other is not ClosureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TranslationElement, otherT.TranslationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "translation": - value = TranslationElement; - return TranslationElement is not null; + value = _TranslationElement; + return _TranslationElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "translation": - TranslationElement = (Hl7.Fhir.Model.FhirBoolean)value; + TranslationElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; default: return base.SetValue(key, value); @@ -1792,7 +1695,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TranslationElement is not null) yield return new KeyValuePair("translation",TranslationElement); + if (_TranslationElement is not null) yield return new KeyValuePair("translation",_TranslationElement); } } @@ -1802,28 +1705,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this terminology capabilities, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1836,39 +1736,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the terminology capabilities. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the terminology capabilities /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1880,41 +1777,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this terminology capabilities (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this terminology capabilities (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1924,28 +1818,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this terminology capabilities (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1958,13 +1849,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1973,13 +1864,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1989,13 +1877,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -2004,13 +1892,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -2021,28 +1906,25 @@ public bool? Experimental [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -2052,28 +1934,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -2086,39 +1965,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the terminology capabilities. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the terminology capabilities /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -2131,11 +2007,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for terminology capabilities (if applicable). @@ -2146,39 +2022,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this terminology capabilities is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this terminology capabilities is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -2188,28 +2061,25 @@ public string Purpose /// [FhirElement("copyright", InSummary=true, Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -2219,28 +2089,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -2253,13 +2120,13 @@ public string CopyrightLabel [Binding("CapabilityStatementKind")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code KindElement + public Code? KindElement { get { return _KindElement; } set { _KindElement = value; OnPropertyChanged("KindElement"); } } - private Code _KindElement; + private Code? _KindElement; /// /// instance | capability | requirements @@ -2268,13 +2135,10 @@ public Code KindElement [IgnoreDataMember] public Hl7.Fhir.Model.CapabilityStatementKind? Kind { - get { return KindElement != null ? KindElement.Value : null; } + get => _KindElement?.Value; set { - if (value == null) - KindElement = null; - else - KindElement = new Code(value); + KindElement = value is null ? null : new Code(value); OnPropertyChanged("Kind"); } } @@ -2284,39 +2148,39 @@ public Hl7.Fhir.Model.CapabilityStatementKind? Kind /// [FhirElement("software", InSummary=true, Order=270)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent Software + public Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent? Software { get { return _Software; } set { _Software = value; OnPropertyChanged("Software"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent _Software; + private Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent? _Software; /// /// If this describes a specific instance. /// [FhirElement("implementation", InSummary=true, Order=280)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent Implementation + public Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent? Implementation { get { return _Implementation; } set { _Implementation = value; OnPropertyChanged("Implementation"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent _Implementation; + private Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent? _Implementation; /// /// Whether lockedDate is supported. /// [FhirElement("lockedDate", InSummary=true, Order=290)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean LockedDateElement + public Hl7.Fhir.Model.FhirBoolean? LockedDateElement { get { return _LockedDateElement; } set { _LockedDateElement = value; OnPropertyChanged("LockedDateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _LockedDateElement; + private Hl7.Fhir.Model.FhirBoolean? _LockedDateElement; /// /// Whether lockedDate is supported @@ -2325,13 +2189,10 @@ public Hl7.Fhir.Model.FhirBoolean LockedDateElement [IgnoreDataMember] public bool? LockedDate { - get { return LockedDateElement != null ? LockedDateElement.Value : null; } + get => _LockedDateElement?.Value; set { - if (value == null) - LockedDateElement = null; - else - LockedDateElement = new Hl7.Fhir.Model.FhirBoolean(value); + LockedDateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("LockedDate"); } } @@ -2344,24 +2205,24 @@ public bool? LockedDate [DataMember] public List CodeSystem { - get { if(_CodeSystem==null) _CodeSystem = new List(); return _CodeSystem; } + get => _CodeSystem ?? new List(); set { _CodeSystem = value; OnPropertyChanged("CodeSystem"); } } - private List _CodeSystem; + private List? _CodeSystem; /// /// Information about the [ValueSet/$expand](valueset-operation-expand.html) operation. /// [FhirElement("expansion", Order=310)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent Expansion + public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent? Expansion { get { return _Expansion; } set { _Expansion = value; OnPropertyChanged("Expansion"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent _Expansion; + private Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent? _Expansion; /// /// in-compose | in-expansion | in-compose-or-expansion. @@ -2370,13 +2231,13 @@ public Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent Expansion [DeclaredType(Type = typeof(Code))] [Binding("CodeSearchSupport")] [DataMember] - public Code CodeSearchElement + public Code? CodeSearchElement { get { return _CodeSearchElement; } set { _CodeSearchElement = value; OnPropertyChanged("CodeSearchElement"); } } - private Code _CodeSearchElement; + private Code? _CodeSearchElement; /// /// in-compose | in-expansion | in-compose-or-expansion @@ -2385,13 +2246,10 @@ public Code CodeSearch [IgnoreDataMember] public Hl7.Fhir.Model.TerminologyCapabilities.CodeSearchSupport? CodeSearch { - get { return CodeSearchElement != null ? CodeSearchElement.Value : null; } + get => _CodeSearchElement?.Value; set { - if (value == null) - CodeSearchElement = null; - else - CodeSearchElement = new Code(value); + CodeSearchElement = value is null ? null : new Code(value); OnPropertyChanged("CodeSearch"); } } @@ -2401,79 +2259,75 @@ public Hl7.Fhir.Model.TerminologyCapabilities.CodeSearchSupport? CodeSearch /// [FhirElement("validateCode", Order=330)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent ValidateCode + public Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent? ValidateCode { get { return _ValidateCode; } set { _ValidateCode = value; OnPropertyChanged("ValidateCode"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent _ValidateCode; + private Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent? _ValidateCode; /// /// Information about the [ConceptMap/$translate](conceptmap-operation-translate.html) operation. /// [FhirElement("translation", Order=340)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent Translation + public Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent? Translation { get { return _Translation; } set { _Translation = value; OnPropertyChanged("Translation"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent _Translation; + private Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent? _Translation; /// /// Information about the [ConceptMap/$closure](conceptmap-operation-closure.html) operation. /// [FhirElement("closure", Order=350)] [DataMember] - public Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent Closure + public Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent? Closure { get { return _Closure; } set { _Closure = value; OnPropertyChanged("Closure"); } } - private Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent _Closure; + private Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent? _Closure; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TerminologyCapabilities; - - if (dest == null) - { + if(other is not TerminologyCapabilities dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(KindElement != null) dest.KindElement = (Code)KindElement.DeepCopyInternal(); - if(Software != null) dest.Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)Software.DeepCopyInternal(); - if(Implementation != null) dest.Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)Implementation.DeepCopyInternal(); - if(LockedDateElement != null) dest.LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)LockedDateElement.DeepCopyInternal(); - if(CodeSystem.Any()) dest.CodeSystem = new List(CodeSystem.DeepCopyInternal()); - if(Expansion != null) dest.Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)Expansion.DeepCopyInternal(); - if(CodeSearchElement != null) dest.CodeSearchElement = (Code)CodeSearchElement.DeepCopyInternal(); - if(ValidateCode != null) dest.ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)ValidateCode.DeepCopyInternal(); - if(Translation != null) dest.Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)Translation.DeepCopyInternal(); - if(Closure != null) dest.Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)Closure.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_KindElement is not null) dest.KindElement = (Code)_KindElement.DeepCopyInternal(); + if(_Software is not null) dest.Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)_Software.DeepCopyInternal(); + if(_Implementation is not null) dest.Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)_Implementation.DeepCopyInternal(); + if(_LockedDateElement is not null) dest.LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)_LockedDateElement.DeepCopyInternal(); + if(_CodeSystem is not null) dest.CodeSystem = new List(_CodeSystem.DeepCopyInternal()); + if(_Expansion is not null) dest.Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)_Expansion.DeepCopyInternal(); + if(_CodeSearchElement is not null) dest.CodeSearchElement = (Code)_CodeSearchElement.DeepCopyInternal(); + if(_ValidateCode is not null) dest.ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)_ValidateCode.DeepCopyInternal(); + if(_Translation is not null) dest.Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)_Translation.DeepCopyInternal(); + if(_Closure is not null) dest.Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)_Closure.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2485,216 +2339,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TerminologyCapabilities; - if(otherT == null) return false; + if(other is not TerminologyCapabilities otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.Equals(KindElement, otherT.KindElement)) return false; - if(!comparer.Equals(Software, otherT.Software)) return false; - if(!comparer.Equals(Implementation, otherT.Implementation)) return false; - if(!comparer.Equals(LockedDateElement, otherT.LockedDateElement)) return false; - if(!comparer.ListEquals(CodeSystem, otherT.CodeSystem)) return false; - if(!comparer.Equals(Expansion, otherT.Expansion)) return false; - if(!comparer.Equals(CodeSearchElement, otherT.CodeSearchElement)) return false; - if(!comparer.Equals(ValidateCode, otherT.ValidateCode)) return false; - if(!comparer.Equals(Translation, otherT.Translation)) return false; - if(!comparer.Equals(Closure, otherT.Closure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + if(!comparer.Equals(_Software, otherT._Software)) return false; + if(!comparer.Equals(_Implementation, otherT._Implementation)) return false; + if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + if(!comparer.ListEquals(_CodeSystem, otherT._CodeSystem)) return false; + if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; + if(!comparer.Equals(_CodeSearchElement, otherT._CodeSearchElement)) return false; + if(!comparer.Equals(_ValidateCode, otherT._ValidateCode)) return false; + if(!comparer.Equals(_Translation, otherT._Translation)) return false; + if(!comparer.Equals(_Closure, otherT._Closure)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "kind": - value = KindElement; - return KindElement is not null; + value = _KindElement; + return _KindElement is not null; case "software": - value = Software; - return Software is not null; + value = _Software; + return _Software is not null; case "implementation": - value = Implementation; - return Implementation is not null; + value = _Implementation; + return _Implementation is not null; case "lockedDate": - value = LockedDateElement; - return LockedDateElement is not null; + value = _LockedDateElement; + return _LockedDateElement is not null; case "codeSystem": - value = CodeSystem; - return CodeSystem?.Any() == true; + value = _CodeSystem; + return _CodeSystem?.Any() == true; case "expansion": - value = Expansion; - return Expansion is not null; + value = _Expansion; + return _Expansion is not null; case "codeSearch": - value = CodeSearchElement; - return CodeSearchElement is not null; + value = _CodeSearchElement; + return _CodeSearchElement is not null; case "validateCode": - value = ValidateCode; - return ValidateCode is not null; + value = _ValidateCode; + return _ValidateCode is not null; case "translation": - value = Translation; - return Translation is not null; + value = _Translation; + return _Translation is not null; case "closure": - value = Closure; - return Closure is not null; + value = _Closure; + return _Closure is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "kind": - KindElement = (Code)value; + KindElement = (Code?)value; return this; case "software": - Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent)value; + Software = (Hl7.Fhir.Model.TerminologyCapabilities.SoftwareComponent?)value; return this; case "implementation": - Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent)value; + Implementation = (Hl7.Fhir.Model.TerminologyCapabilities.ImplementationComponent?)value; return this; case "lockedDate": - LockedDateElement = (Hl7.Fhir.Model.FhirBoolean)value; + LockedDateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "codeSystem": - CodeSystem = (List)value; + CodeSystem = (List?)value!; return this; case "expansion": - Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent)value; + Expansion = (Hl7.Fhir.Model.TerminologyCapabilities.ExpansionComponent?)value; return this; case "codeSearch": - CodeSearchElement = (Code)value; + CodeSearchElement = (Code?)value; return this; case "validateCode": - ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent)value; + ValidateCode = (Hl7.Fhir.Model.TerminologyCapabilities.ValidateCodeComponent?)value; return this; case "translation": - Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent)value; + Translation = (Hl7.Fhir.Model.TerminologyCapabilities.TranslationComponent?)value; return this; case "closure": - Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent)value; + Closure = (Hl7.Fhir.Model.TerminologyCapabilities.ClosureComponent?)value; return this; default: return base.SetValue(key, value); @@ -2705,33 +2559,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (KindElement is not null) yield return new KeyValuePair("kind",KindElement); - if (Software is not null) yield return new KeyValuePair("software",Software); - if (Implementation is not null) yield return new KeyValuePair("implementation",Implementation); - if (LockedDateElement is not null) yield return new KeyValuePair("lockedDate",LockedDateElement); - if (CodeSystem?.Any() == true) yield return new KeyValuePair("codeSystem",CodeSystem); - if (Expansion is not null) yield return new KeyValuePair("expansion",Expansion); - if (CodeSearchElement is not null) yield return new KeyValuePair("codeSearch",CodeSearchElement); - if (ValidateCode is not null) yield return new KeyValuePair("validateCode",ValidateCode); - if (Translation is not null) yield return new KeyValuePair("translation",Translation); - if (Closure is not null) yield return new KeyValuePair("closure",Closure); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_KindElement is not null) yield return new KeyValuePair("kind",_KindElement); + if (_Software is not null) yield return new KeyValuePair("software",_Software); + if (_Implementation is not null) yield return new KeyValuePair("implementation",_Implementation); + if (_LockedDateElement is not null) yield return new KeyValuePair("lockedDate",_LockedDateElement); + if (_CodeSystem?.Any() == true) yield return new KeyValuePair("codeSystem",_CodeSystem); + if (_Expansion is not null) yield return new KeyValuePair("expansion",_Expansion); + if (_CodeSearchElement is not null) yield return new KeyValuePair("codeSearch",_CodeSearchElement); + if (_ValidateCode is not null) yield return new KeyValuePair("validateCode",_ValidateCode); + if (_Translation is not null) yield return new KeyValuePair("translation",_Translation); + if (_Closure is not null) yield return new KeyValuePair("closure",_Closure); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs b/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs index 3b6effc70..ed509977c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -80,28 +83,25 @@ public partial class DependencyComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of the dependency criterium /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -111,26 +111,22 @@ public string Description /// [FhirElement("predecessor", Order=50)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Predecessor + public Hl7.Fhir.Model.ResourceReference? Predecessor { get { return _Predecessor; } set { _Predecessor = value; OnPropertyChanged("Predecessor"); } } - private Hl7.Fhir.Model.ResourceReference _Predecessor; + private Hl7.Fhir.Model.ResourceReference? _Predecessor; protected internal override void CopyToInternal(Base other) { - var dest = other as DependencyComponent; - - if (dest == null) - { + if(other is not DependencyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Predecessor != null) dest.Predecessor = (Hl7.Fhir.Model.ResourceReference)Predecessor.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Predecessor is not null) dest.Predecessor = (Hl7.Fhir.Model.ResourceReference)_Predecessor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -142,41 +138,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DependencyComponent; - if(otherT == null) return false; + if(other is not DependencyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Predecessor, otherT.Predecessor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "predecessor": - value = Predecessor; - return Predecessor is not null; + value = _Predecessor; + return _Predecessor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "predecessor": - Predecessor = (Hl7.Fhir.Model.ResourceReference)value; + Predecessor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -187,8 +183,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Predecessor is not null) yield return new KeyValuePair("predecessor",Predecessor); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Predecessor is not null) yield return new KeyValuePair("predecessor",_Predecessor); } } @@ -214,13 +210,13 @@ public partial class TestCaseComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("sequence", Order=40)] [DataMember] - public Hl7.Fhir.Model.Integer SequenceElement + public Hl7.Fhir.Model.Integer? SequenceElement { get { return _SequenceElement; } set { _SequenceElement = value; OnPropertyChanged("SequenceElement"); } } - private Hl7.Fhir.Model.Integer _SequenceElement; + private Hl7.Fhir.Model.Integer? _SequenceElement; /// /// Sequence of test case in the test plan @@ -229,13 +225,10 @@ public Hl7.Fhir.Model.Integer SequenceElement [IgnoreDataMember] public int? Sequence { - get { return SequenceElement != null ? SequenceElement.Value : null; } + get => _SequenceElement?.Value; set { - if (value == null) - SequenceElement = null; - else - SequenceElement = new Hl7.Fhir.Model.Integer(value); + SequenceElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Sequence"); } } @@ -248,11 +241,11 @@ public int? Sequence [DataMember] public List Scope { - get { if(_Scope==null) _Scope = new List(); return _Scope; } + get => _Scope ?? new List(); set { _Scope = value; OnPropertyChanged("Scope"); } } - private List _Scope; + private List? _Scope; /// /// Required criteria to execute the test case. @@ -262,11 +255,11 @@ public List Scope [DataMember] public List Dependency { - get { if(_Dependency==null) _Dependency = new List(); return _Dependency; } + get => _Dependency ?? new List(); set { _Dependency = value; OnPropertyChanged("Dependency"); } } - private List _Dependency; + private List? _Dependency; /// /// The actual test to be executed. @@ -276,11 +269,11 @@ public List Dependency [DataMember] public List TestRun { - get { if(_TestRun==null) _TestRun = new List(); return _TestRun; } + get => _TestRun ?? new List(); set { _TestRun = value; OnPropertyChanged("TestRun"); } } - private List _TestRun; + private List? _TestRun; /// /// The test data used in the test case. @@ -290,11 +283,11 @@ public List TestRun [DataMember] public List TestData { - get { if(_TestData==null) _TestData = new List(); return _TestData; } + get => _TestData ?? new List(); set { _TestData = value; OnPropertyChanged("TestData"); } } - private List _TestData; + private List? _TestData; /// /// Test assertions or expectations. @@ -304,28 +297,24 @@ public List TestData [DataMember] public List Assertion { - get { if(_Assertion==null) _Assertion = new List(); return _Assertion; } + get => _Assertion ?? new List(); set { _Assertion = value; OnPropertyChanged("Assertion"); } } - private List _Assertion; + private List? _Assertion; protected internal override void CopyToInternal(Base other) { - var dest = other as TestCaseComponent; - - if (dest == null) - { + if(other is not TestCaseComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(SequenceElement != null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)SequenceElement.DeepCopyInternal(); - if(Scope.Any()) dest.Scope = new List(Scope.DeepCopyInternal()); - if(Dependency.Any()) dest.Dependency = new List(Dependency.DeepCopyInternal()); - if(TestRun.Any()) dest.TestRun = new List(TestRun.DeepCopyInternal()); - if(TestData.Any()) dest.TestData = new List(TestData.DeepCopyInternal()); - if(Assertion.Any()) dest.Assertion = new List(Assertion.DeepCopyInternal()); + if(_SequenceElement is not null) dest.SequenceElement = (Hl7.Fhir.Model.Integer)_SequenceElement.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = new List(_Scope.DeepCopyInternal()); + if(_Dependency is not null) dest.Dependency = new List(_Dependency.DeepCopyInternal()); + if(_TestRun is not null) dest.TestRun = new List(_TestRun.DeepCopyInternal()); + if(_TestData is not null) dest.TestData = new List(_TestData.DeepCopyInternal()); + if(_Assertion is not null) dest.Assertion = new List(_Assertion.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -337,69 +326,69 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestCaseComponent; - if(otherT == null) return false; + if(other is not TestCaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(SequenceElement, otherT.SequenceElement)) return false; - if(!comparer.ListEquals(Scope, otherT.Scope)) return false; - if(!comparer.ListEquals(Dependency, otherT.Dependency)) return false; - if(!comparer.ListEquals(TestRun, otherT.TestRun)) return false; - if(!comparer.ListEquals(TestData, otherT.TestData)) return false; - if(!comparer.ListEquals(Assertion, otherT.Assertion)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + if(!comparer.ListEquals(_Scope, otherT._Scope)) return false; + if(!comparer.ListEquals(_Dependency, otherT._Dependency)) return false; + if(!comparer.ListEquals(_TestRun, otherT._TestRun)) return false; + if(!comparer.ListEquals(_TestData, otherT._TestData)) return false; + if(!comparer.ListEquals(_Assertion, otherT._Assertion)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "sequence": - value = SequenceElement; - return SequenceElement is not null; + value = _SequenceElement; + return _SequenceElement is not null; case "scope": - value = Scope; - return Scope?.Any() == true; + value = _Scope; + return _Scope?.Any() == true; case "dependency": - value = Dependency; - return Dependency?.Any() == true; + value = _Dependency; + return _Dependency?.Any() == true; case "testRun": - value = TestRun; - return TestRun?.Any() == true; + value = _TestRun; + return _TestRun?.Any() == true; case "testData": - value = TestData; - return TestData?.Any() == true; + value = _TestData; + return _TestData?.Any() == true; case "assertion": - value = Assertion; - return Assertion?.Any() == true; + value = _Assertion; + return _Assertion?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "sequence": - SequenceElement = (Hl7.Fhir.Model.Integer)value; + SequenceElement = (Hl7.Fhir.Model.Integer?)value; return this; case "scope": - Scope = (List)value; + Scope = (List?)value!; return this; case "dependency": - Dependency = (List)value; + Dependency = (List?)value!; return this; case "testRun": - TestRun = (List)value; + TestRun = (List?)value!; return this; case "testData": - TestData = (List)value; + TestData = (List?)value!; return this; case "assertion": - Assertion = (List)value; + Assertion = (List?)value!; return this; default: return base.SetValue(key, value); @@ -410,12 +399,12 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (SequenceElement is not null) yield return new KeyValuePair("sequence",SequenceElement); - if (Scope?.Any() == true) yield return new KeyValuePair("scope",Scope); - if (Dependency?.Any() == true) yield return new KeyValuePair("dependency",Dependency); - if (TestRun?.Any() == true) yield return new KeyValuePair("testRun",TestRun); - if (TestData?.Any() == true) yield return new KeyValuePair("testData",TestData); - if (Assertion?.Any() == true) yield return new KeyValuePair("assertion",Assertion); + if (_SequenceElement is not null) yield return new KeyValuePair("sequence",_SequenceElement); + if (_Scope?.Any() == true) yield return new KeyValuePair("scope",_Scope); + if (_Dependency?.Any() == true) yield return new KeyValuePair("dependency",_Dependency); + if (_TestRun?.Any() == true) yield return new KeyValuePair("testRun",_TestRun); + if (_TestData?.Any() == true) yield return new KeyValuePair("testData",_TestData); + if (_Assertion?.Any() == true) yield return new KeyValuePair("assertion",_Assertion); } } @@ -441,28 +430,25 @@ public partial class TestCaseDependencyComponent : Hl7.Fhir.Model.BackboneElemen /// [FhirElement("description", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Description of the criteria /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -472,26 +458,22 @@ public string Description /// [FhirElement("predecessor", Order=50)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Predecessor + public Hl7.Fhir.Model.ResourceReference? Predecessor { get { return _Predecessor; } set { _Predecessor = value; OnPropertyChanged("Predecessor"); } } - private Hl7.Fhir.Model.ResourceReference _Predecessor; + private Hl7.Fhir.Model.ResourceReference? _Predecessor; protected internal override void CopyToInternal(Base other) { - var dest = other as TestCaseDependencyComponent; - - if (dest == null) - { + if(other is not TestCaseDependencyComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(Predecessor != null) dest.Predecessor = (Hl7.Fhir.Model.ResourceReference)Predecessor.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_Predecessor is not null) dest.Predecessor = (Hl7.Fhir.Model.ResourceReference)_Predecessor.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -503,41 +485,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestCaseDependencyComponent; - if(otherT == null) return false; + if(other is not TestCaseDependencyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Predecessor, otherT.Predecessor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "predecessor": - value = Predecessor; - return Predecessor is not null; + value = _Predecessor; + return _Predecessor is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "predecessor": - Predecessor = (Hl7.Fhir.Model.ResourceReference)value; + Predecessor = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -548,8 +530,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Predecessor is not null) yield return new KeyValuePair("predecessor",Predecessor); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Predecessor is not null) yield return new KeyValuePair("predecessor",_Predecessor); } } @@ -572,28 +554,25 @@ public partial class TestRunComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("narrative", Order=40)] [DataMember] - public Hl7.Fhir.Model.Markdown NarrativeElement + public Hl7.Fhir.Model.Markdown? NarrativeElement { get { return _NarrativeElement; } set { _NarrativeElement = value; OnPropertyChanged("NarrativeElement"); } } - private Hl7.Fhir.Model.Markdown _NarrativeElement; + private Hl7.Fhir.Model.Markdown? _NarrativeElement; /// /// The narrative description of the tests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Narrative + public string? Narrative { - get { return NarrativeElement != null ? NarrativeElement.Value : null; } + get => _NarrativeElement?.Value; set { - if (value == null) - NarrativeElement = null; - else - NarrativeElement = new Hl7.Fhir.Model.Markdown(value); + NarrativeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Narrative"); } } @@ -603,26 +582,22 @@ public string Narrative /// [FhirElement("script", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestPlan.ScriptComponent Script + public Hl7.Fhir.Model.TestPlan.ScriptComponent? Script { get { return _Script; } set { _Script = value; OnPropertyChanged("Script"); } } - private Hl7.Fhir.Model.TestPlan.ScriptComponent _Script; + private Hl7.Fhir.Model.TestPlan.ScriptComponent? _Script; protected internal override void CopyToInternal(Base other) { - var dest = other as TestRunComponent; - - if (dest == null) - { + if(other is not TestRunComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NarrativeElement != null) dest.NarrativeElement = (Hl7.Fhir.Model.Markdown)NarrativeElement.DeepCopyInternal(); - if(Script != null) dest.Script = (Hl7.Fhir.Model.TestPlan.ScriptComponent)Script.DeepCopyInternal(); + if(_NarrativeElement is not null) dest.NarrativeElement = (Hl7.Fhir.Model.Markdown)_NarrativeElement.DeepCopyInternal(); + if(_Script is not null) dest.Script = (Hl7.Fhir.Model.TestPlan.ScriptComponent)_Script.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -634,41 +609,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestRunComponent; - if(otherT == null) return false; + if(other is not TestRunComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NarrativeElement, otherT.NarrativeElement)) return false; - if(!comparer.Equals(Script, otherT.Script)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NarrativeElement, otherT._NarrativeElement)) return false; + if(!comparer.Equals(_Script, otherT._Script)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "narrative": - value = NarrativeElement; - return NarrativeElement is not null; + value = _NarrativeElement; + return _NarrativeElement is not null; case "script": - value = Script; - return Script is not null; + value = _Script; + return _Script is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "narrative": - NarrativeElement = (Hl7.Fhir.Model.Markdown)value; + NarrativeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "script": - Script = (Hl7.Fhir.Model.TestPlan.ScriptComponent)value; + Script = (Hl7.Fhir.Model.TestPlan.ScriptComponent?)value; return this; default: return base.SetValue(key, value); @@ -679,8 +654,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NarrativeElement is not null) yield return new KeyValuePair("narrative",NarrativeElement); - if (Script is not null) yield return new KeyValuePair("script",Script); + if (_NarrativeElement is not null) yield return new KeyValuePair("narrative",_NarrativeElement); + if (_Script is not null) yield return new KeyValuePair("script",_Script); } } @@ -703,13 +678,13 @@ public partial class ScriptComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("language", Order=40)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Language + public Hl7.Fhir.Model.CodeableConcept? Language { get { return _Language; } set { _Language = value; OnPropertyChanged("Language"); } } - private Hl7.Fhir.Model.CodeableConcept _Language; + private Hl7.Fhir.Model.CodeableConcept? _Language; /// /// The actual content of the cases - references to TestScripts or externally defined content. @@ -718,26 +693,22 @@ public Hl7.Fhir.Model.CodeableConcept Language [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as ScriptComponent; - - if (dest == null) - { + if(other is not ScriptComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Language != null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)Language.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); + if(_Language is not null) dest.Language = (Hl7.Fhir.Model.CodeableConcept)_Language.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -749,41 +720,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ScriptComponent; - if(otherT == null) return false; + if(other is not ScriptComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Language, otherT.Language)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "language": - value = Language; - return Language is not null; + value = _Language; + return _Language is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "language": - Language = (Hl7.Fhir.Model.CodeableConcept)value; + Language = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -794,8 +765,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Language is not null) yield return new KeyValuePair("language",Language); - if (Source is not null) yield return new KeyValuePair("source",Source); + if (_Language is not null) yield return new KeyValuePair("language",_Language); + if (_Source is not null) yield return new KeyValuePair("source",_Source); } } @@ -819,26 +790,26 @@ public partial class TestDataComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// The actual test resources when they exist. /// [FhirElement("content", Order=50)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Content + public Hl7.Fhir.Model.ResourceReference? Content { get { return _Content; } set { _Content = value; OnPropertyChanged("Content"); } } - private Hl7.Fhir.Model.ResourceReference _Content; + private Hl7.Fhir.Model.ResourceReference? _Content; /// /// Pointer to a definition of test resources - narrative or structured e.g. synthetic data generation, etc. @@ -847,27 +818,23 @@ public Hl7.Fhir.Model.ResourceReference Content [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.ResourceReference))] [DataMember] - public Hl7.Fhir.Model.DataType Source + public Hl7.Fhir.Model.DataType? Source { get { return _Source; } set { _Source = value; OnPropertyChanged("Source"); } } - private Hl7.Fhir.Model.DataType _Source; + private Hl7.Fhir.Model.DataType? _Source; protected internal override void CopyToInternal(Base other) { - var dest = other as TestDataComponent; - - if (dest == null) - { + if(other is not TestDataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(Content != null) dest.Content = (Hl7.Fhir.Model.ResourceReference)Content.DeepCopyInternal(); - if(Source != null) dest.Source = (Hl7.Fhir.Model.DataType)Source.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_Content is not null) dest.Content = (Hl7.Fhir.Model.ResourceReference)_Content.DeepCopyInternal(); + if(_Source is not null) dest.Source = (Hl7.Fhir.Model.DataType)_Source.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -879,48 +846,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestDataComponent; - if(otherT == null) return false; + if(other is not TestDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Content, otherT.Content)) return false; - if(!comparer.Equals(Source, otherT.Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Content, otherT._Content)) return false; + if(!comparer.Equals(_Source, otherT._Source)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "content": - value = Content; - return Content is not null; + value = _Content; + return _Content is not null; case "source": - value = Source; - return Source is not null; + value = _Source; + return _Source is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "content": - Content = (Hl7.Fhir.Model.ResourceReference)value; + Content = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "source": - Source = (Hl7.Fhir.Model.DataType)value; + Source = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -931,9 +898,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Content is not null) yield return new KeyValuePair("content",Content); - if (Source is not null) yield return new KeyValuePair("source",Source); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Content is not null) yield return new KeyValuePair("content",_Content); + if (_Source is not null) yield return new KeyValuePair("source",_Source); } } @@ -962,11 +929,11 @@ public partial class AssertionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// The focus or object of the assertion. @@ -976,11 +943,11 @@ public List Type [DataMember] public List Object { - get { if(_Object==null) _Object = new List(); return _Object; } + get => _Object ?? new List(); set { _Object = value; OnPropertyChanged("Object"); } } - private List _Object; + private List? _Object; /// /// The actual result assertion. @@ -990,25 +957,21 @@ public List Object [DataMember] public List Result { - get { if(_Result==null) _Result = new List(); return _Result; } + get => _Result ?? new List(); set { _Result = value; OnPropertyChanged("Result"); } } - private List _Result; + private List? _Result; protected internal override void CopyToInternal(Base other) { - var dest = other as AssertionComponent; - - if (dest == null) - { + if(other is not AssertionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(Object.Any()) dest.Object = new List(Object.DeepCopyInternal()); - if(Result.Any()) dest.Result = new List(Result.DeepCopyInternal()); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_Object is not null) dest.Object = new List(_Object.DeepCopyInternal()); + if(_Result is not null) dest.Result = new List(_Result.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1020,48 +983,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertionComponent; - if(otherT == null) return false; + if(other is not AssertionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(Object, otherT.Object)) return false; - if(!comparer.ListEquals(Result, otherT.Result)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_Object, otherT._Object)) return false; + if(!comparer.ListEquals(_Result, otherT._Result)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "object": - value = Object; - return Object?.Any() == true; + value = _Object; + return _Object?.Any() == true; case "result": - value = Result; - return Result?.Any() == true; + value = _Result; + return _Result?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (List)value; + Type = (List?)value!; return this; case "object": - Object = (List)value; + Object = (List?)value!; return this; case "result": - Result = (List)value; + Result = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1072,9 +1035,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (Object?.Any() == true) yield return new KeyValuePair("object",Object); - if (Result?.Any() == true) yield return new KeyValuePair("result",Result); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_Object?.Any() == true) yield return new KeyValuePair("object",_Object); + if (_Result?.Any() == true) yield return new KeyValuePair("result",_Result); } } @@ -1084,28 +1047,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this test plan, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1118,39 +1078,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the test plan. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the test plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -1162,41 +1119,38 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this test plan (computer friendly). /// [FhirElement("name", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this test plan (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1206,28 +1160,25 @@ public string Name /// [FhirElement("title", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this test plan (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -1240,13 +1191,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -1255,13 +1206,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1271,13 +1219,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -1286,13 +1234,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -1302,28 +1247,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -1333,28 +1275,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -1367,39 +1306,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the test plan. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the test plan /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -1412,11 +1348,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction where the test plan applies (if applicable). @@ -1427,39 +1363,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this test plan is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this test plan is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -1469,28 +1402,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -1500,28 +1430,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -1535,11 +1462,11 @@ public string CopyrightLabel [DataMember] public List Category { - get { if(_Category==null) _Category = new List(); return _Category; } + get => _Category ?? new List(); set { _Category = value; OnPropertyChanged("Category"); } } - private List _Category; + private List? _Category; /// /// What is being tested with this Test Plan - a conformance resource, or narrative criteria, or an external reference. @@ -1549,39 +1476,36 @@ public List Category [DataMember] public List Scope { - get { if(_Scope==null) _Scope = new List(); return _Scope; } + get => _Scope ?? new List(); set { _Scope = value; OnPropertyChanged("Scope"); } } - private List _Scope; + private List? _Scope; /// /// A description of test tools to be used in the test plan - narrative for now. /// [FhirElement("testTools", Order=280)] [DataMember] - public Hl7.Fhir.Model.Markdown TestToolsElement + public Hl7.Fhir.Model.Markdown? TestToolsElement { get { return _TestToolsElement; } set { _TestToolsElement = value; OnPropertyChanged("TestToolsElement"); } } - private Hl7.Fhir.Model.Markdown _TestToolsElement; + private Hl7.Fhir.Model.Markdown? _TestToolsElement; /// /// A description of test tools to be used in the test plan - narrative for now /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TestTools + public string? TestTools { - get { return TestToolsElement != null ? TestToolsElement.Value : null; } + get => _TestToolsElement?.Value; set { - if (value == null) - TestToolsElement = null; - else - TestToolsElement = new Hl7.Fhir.Model.Markdown(value); + TestToolsElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("TestTools"); } } @@ -1594,39 +1518,36 @@ public string TestTools [DataMember] public List Dependency { - get { if(_Dependency==null) _Dependency = new List(); return _Dependency; } + get => _Dependency ?? new List(); set { _Dependency = value; OnPropertyChanged("Dependency"); } } - private List _Dependency; + private List? _Dependency; /// /// The threshold or criteria for the test plan to be considered successfully executed - narrative. /// [FhirElement("exitCriteria", Order=300)] [DataMember] - public Hl7.Fhir.Model.Markdown ExitCriteriaElement + public Hl7.Fhir.Model.Markdown? ExitCriteriaElement { get { return _ExitCriteriaElement; } set { _ExitCriteriaElement = value; OnPropertyChanged("ExitCriteriaElement"); } } - private Hl7.Fhir.Model.Markdown _ExitCriteriaElement; + private Hl7.Fhir.Model.Markdown? _ExitCriteriaElement; /// /// The threshold or criteria for the test plan to be considered successfully executed - narrative /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ExitCriteria + public string? ExitCriteria { - get { return ExitCriteriaElement != null ? ExitCriteriaElement.Value : null; } + get => _ExitCriteriaElement?.Value; set { - if (value == null) - ExitCriteriaElement = null; - else - ExitCriteriaElement = new Hl7.Fhir.Model.Markdown(value); + ExitCriteriaElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("ExitCriteria"); } } @@ -1639,47 +1560,43 @@ public string ExitCriteria [DataMember] public List TestCase { - get { if(_TestCase==null) _TestCase = new List(); return _TestCase; } + get => _TestCase ?? new List(); set { _TestCase = value; OnPropertyChanged("TestCase"); } } - private List _TestCase; + private List? _TestCase; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestPlan; - - if (dest == null) - { + if(other is not TestPlan dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(Category.Any()) dest.Category = new List(Category.DeepCopyInternal()); - if(Scope.Any()) dest.Scope = new List(Scope.DeepCopyInternal()); - if(TestToolsElement != null) dest.TestToolsElement = (Hl7.Fhir.Model.Markdown)TestToolsElement.DeepCopyInternal(); - if(Dependency.Any()) dest.Dependency = new List(Dependency.DeepCopyInternal()); - if(ExitCriteriaElement != null) dest.ExitCriteriaElement = (Hl7.Fhir.Model.Markdown)ExitCriteriaElement.DeepCopyInternal(); - if(TestCase.Any()) dest.TestCase = new List(TestCase.DeepCopyInternal()); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_Category is not null) dest.Category = new List(_Category.DeepCopyInternal()); + if(_Scope is not null) dest.Scope = new List(_Scope.DeepCopyInternal()); + if(_TestToolsElement is not null) dest.TestToolsElement = (Hl7.Fhir.Model.Markdown)_TestToolsElement.DeepCopyInternal(); + if(_Dependency is not null) dest.Dependency = new List(_Dependency.DeepCopyInternal()); + if(_ExitCriteriaElement is not null) dest.ExitCriteriaElement = (Hl7.Fhir.Model.Markdown)_ExitCriteriaElement.DeepCopyInternal(); + if(_TestCase is not null) dest.TestCase = new List(_TestCase.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1691,188 +1608,188 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestPlan; - if(otherT == null) return false; + if(other is not TestPlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.ListEquals(Category, otherT.Category)) return false; - if(!comparer.ListEquals(Scope, otherT.Scope)) return false; - if(!comparer.Equals(TestToolsElement, otherT.TestToolsElement)) return false; - if(!comparer.ListEquals(Dependency, otherT.Dependency)) return false; - if(!comparer.Equals(ExitCriteriaElement, otherT.ExitCriteriaElement)) return false; - if(!comparer.ListEquals(TestCase, otherT.TestCase)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.ListEquals(_Category, otherT._Category)) return false; + if(!comparer.ListEquals(_Scope, otherT._Scope)) return false; + if(!comparer.Equals(_TestToolsElement, otherT._TestToolsElement)) return false; + if(!comparer.ListEquals(_Dependency, otherT._Dependency)) return false; + if(!comparer.Equals(_ExitCriteriaElement, otherT._ExitCriteriaElement)) return false; + if(!comparer.ListEquals(_TestCase, otherT._TestCase)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "category": - value = Category; - return Category?.Any() == true; + value = _Category; + return _Category?.Any() == true; case "scope": - value = Scope; - return Scope?.Any() == true; + value = _Scope; + return _Scope?.Any() == true; case "testTools": - value = TestToolsElement; - return TestToolsElement is not null; + value = _TestToolsElement; + return _TestToolsElement is not null; case "dependency": - value = Dependency; - return Dependency?.Any() == true; + value = _Dependency; + return _Dependency?.Any() == true; case "exitCriteria": - value = ExitCriteriaElement; - return ExitCriteriaElement is not null; + value = _ExitCriteriaElement; + return _ExitCriteriaElement is not null; case "testCase": - value = TestCase; - return TestCase?.Any() == true; + value = _TestCase; + return _TestCase?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "category": - Category = (List)value; + Category = (List?)value!; return this; case "scope": - Scope = (List)value; + Scope = (List?)value!; return this; case "testTools": - TestToolsElement = (Hl7.Fhir.Model.Markdown)value; + TestToolsElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "dependency": - Dependency = (List)value; + Dependency = (List?)value!; return this; case "exitCriteria": - ExitCriteriaElement = (Hl7.Fhir.Model.Markdown)value; + ExitCriteriaElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "testCase": - TestCase = (List)value; + TestCase = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1883,29 +1800,29 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (Category?.Any() == true) yield return new KeyValuePair("category",Category); - if (Scope?.Any() == true) yield return new KeyValuePair("scope",Scope); - if (TestToolsElement is not null) yield return new KeyValuePair("testTools",TestToolsElement); - if (Dependency?.Any() == true) yield return new KeyValuePair("dependency",Dependency); - if (ExitCriteriaElement is not null) yield return new KeyValuePair("exitCriteria",ExitCriteriaElement); - if (TestCase?.Any() == true) yield return new KeyValuePair("testCase",TestCase); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_Category?.Any() == true) yield return new KeyValuePair("category",_Category); + if (_Scope?.Any() == true) yield return new KeyValuePair("scope",_Scope); + if (_TestToolsElement is not null) yield return new KeyValuePair("testTools",_TestToolsElement); + if (_Dependency?.Any() == true) yield return new KeyValuePair("dependency",_Dependency); + if (_ExitCriteriaElement is not null) yield return new KeyValuePair("exitCriteria",_ExitCriteriaElement); + if (_TestCase?.Any() == true) yield return new KeyValuePair("testCase",_TestCase); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs index ac00c5b39..ff2897192 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -52,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("TestReport","http://hl7.org/fhir/StructureDefinition/TestReport")] - public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -216,13 +219,13 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportParticipantType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// test-engine | client | server @@ -231,13 +234,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -248,28 +248,25 @@ public Hl7.Fhir.Model.TestReport.TestReportParticipantType? Type [FhirElement("uri", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UriElement + public Hl7.Fhir.Model.FhirUri? UriElement { get { return _UriElement; } set { _UriElement = value; OnPropertyChanged("UriElement"); } } - private Hl7.Fhir.Model.FhirUri _UriElement; + private Hl7.Fhir.Model.FhirUri? _UriElement; /// /// The uri of the participant. An absolute URL is preferred /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Uri + public string? Uri { - get { return UriElement != null ? UriElement.Value : null; } + get => _UriElement?.Value; set { - if (value == null) - UriElement = null; - else - UriElement = new Hl7.Fhir.Model.FhirUri(value); + UriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Uri"); } } @@ -279,45 +276,38 @@ public string Uri /// [FhirElement("display", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DisplayElement + public Hl7.Fhir.Model.FhirString? DisplayElement { get { return _DisplayElement; } set { _DisplayElement = value; OnPropertyChanged("DisplayElement"); } } - private Hl7.Fhir.Model.FhirString _DisplayElement; + private Hl7.Fhir.Model.FhirString? _DisplayElement; /// /// The display name of the participant /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Display + public string? Display { - get { return DisplayElement != null ? DisplayElement.Value : null; } + get => _DisplayElement?.Value; set { - if (value == null) - DisplayElement = null; - else - DisplayElement = new Hl7.Fhir.Model.FhirString(value); + DisplayElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Display"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as ParticipantComponent; - - if (dest == null) - { + if(other is not ParticipantComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(UriElement != null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)UriElement.DeepCopyInternal(); - if(DisplayElement != null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)DisplayElement.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_UriElement is not null) dest.UriElement = (Hl7.Fhir.Model.FhirUri)_UriElement.DeepCopyInternal(); + if(_DisplayElement is not null) dest.DisplayElement = (Hl7.Fhir.Model.FhirString)_DisplayElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -329,48 +319,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParticipantComponent; - if(otherT == null) return false; + if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(UriElement, otherT.UriElement)) return false; - if(!comparer.Equals(DisplayElement, otherT.DisplayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "uri": - value = UriElement; - return UriElement is not null; + value = _UriElement; + return _UriElement is not null; case "display": - value = DisplayElement; - return DisplayElement is not null; + value = _DisplayElement; + return _DisplayElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "uri": - UriElement = (Hl7.Fhir.Model.FhirUri)value; + UriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "display": - DisplayElement = (Hl7.Fhir.Model.FhirString)value; + DisplayElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -381,9 +371,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (UriElement is not null) yield return new KeyValuePair("uri",UriElement); - if (DisplayElement is not null) yield return new KeyValuePair("display",DisplayElement); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_UriElement is not null) yield return new KeyValuePair("uri",_UriElement); + if (_DisplayElement is not null) yield return new KeyValuePair("display",_DisplayElement); } } @@ -409,23 +399,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -437,34 +423,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -475,7 +461,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -502,39 +488,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -546,41 +528,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -591,8 +573,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -621,13 +603,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -636,13 +618,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -652,28 +631,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -683,45 +659,38 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUri DetailElement + public Hl7.Fhir.Model.FhirUri? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirUri _DetailElement; + private Hl7.Fhir.Model.FhirUri? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirUri(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Detail"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)DetailElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirUri)_DetailElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -733,48 +702,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirUri)value; + DetailElement = (Hl7.Fhir.Model.FhirUri?)value; return this; default: return base.SetValue(key, value); @@ -785,9 +754,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); } } @@ -816,13 +785,13 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement [Binding("TestReportActionResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | skip | fail | warning | error @@ -831,13 +800,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -847,28 +813,25 @@ public Hl7.Fhir.Model.TestReport.TestReportActionResult? Result /// [FhirElement("message", Order=50)] [DataMember] - public Hl7.Fhir.Model.Markdown MessageElement + public Hl7.Fhir.Model.Markdown? MessageElement { get { return _MessageElement; } set { _MessageElement = value; OnPropertyChanged("MessageElement"); } } - private Hl7.Fhir.Model.Markdown _MessageElement; + private Hl7.Fhir.Model.Markdown? _MessageElement; /// /// A message associated with the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Message + public string? Message { - get { return MessageElement != null ? MessageElement.Value : null; } + get => _MessageElement?.Value; set { - if (value == null) - MessageElement = null; - else - MessageElement = new Hl7.Fhir.Model.Markdown(value); + MessageElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Message"); } } @@ -878,28 +841,25 @@ public string Message /// [FhirElement("detail", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DetailElement + public Hl7.Fhir.Model.FhirString? DetailElement { get { return _DetailElement; } set { _DetailElement = value; OnPropertyChanged("DetailElement"); } } - private Hl7.Fhir.Model.FhirString _DetailElement; + private Hl7.Fhir.Model.FhirString? _DetailElement; /// /// A link to further details on the result /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Detail + public string? Detail { - get { return DetailElement != null ? DetailElement.Value : null; } + get => _DetailElement?.Value; set { - if (value == null) - DetailElement = null; - else - DetailElement = new Hl7.Fhir.Model.FhirString(value); + DetailElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Detail"); } } @@ -912,26 +872,22 @@ public string Detail [DataMember] public List Requirement { - get { if(_Requirement==null) _Requirement = new List(); return _Requirement; } + get => _Requirement ?? new List(); set { _Requirement = value; OnPropertyChanged("Requirement"); } } - private List _Requirement; + private List? _Requirement; protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(MessageElement != null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)MessageElement.DeepCopyInternal(); - if(DetailElement != null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)DetailElement.DeepCopyInternal(); - if(Requirement.Any()) dest.Requirement = new List(Requirement.DeepCopyInternal()); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_MessageElement is not null) dest.MessageElement = (Hl7.Fhir.Model.Markdown)_MessageElement.DeepCopyInternal(); + if(_DetailElement is not null) dest.DetailElement = (Hl7.Fhir.Model.FhirString)_DetailElement.DeepCopyInternal(); + if(_Requirement is not null) dest.Requirement = new List(_Requirement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -943,55 +899,55 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(MessageElement, otherT.MessageElement)) return false; - if(!comparer.Equals(DetailElement, otherT.DetailElement)) return false; - if(!comparer.ListEquals(Requirement, otherT.Requirement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; + if(!comparer.ListEquals(_Requirement, otherT._Requirement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "message": - value = MessageElement; - return MessageElement is not null; + value = _MessageElement; + return _MessageElement is not null; case "detail": - value = DetailElement; - return DetailElement is not null; + value = _DetailElement; + return _DetailElement is not null; case "requirement": - value = Requirement; - return Requirement?.Any() == true; + value = _Requirement; + return _Requirement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "message": - MessageElement = (Hl7.Fhir.Model.Markdown)value; + MessageElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "detail": - DetailElement = (Hl7.Fhir.Model.FhirString)value; + DetailElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requirement": - Requirement = (List)value; + Requirement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1002,10 +958,10 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (MessageElement is not null) yield return new KeyValuePair("message",MessageElement); - if (DetailElement is not null) yield return new KeyValuePair("detail",DetailElement); - if (Requirement?.Any() == true) yield return new KeyValuePair("requirement",Requirement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_MessageElement is not null) yield return new KeyValuePair("message",_MessageElement); + if (_DetailElement is not null) yield return new KeyValuePair("detail",_DetailElement); + if (_Requirement?.Any() == true) yield return new KeyValuePair("requirement",_Requirement); } } @@ -1034,25 +990,21 @@ public partial class RequirementComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Link + public Hl7.Fhir.Model.DataType? Link { get { return _Link; } set { _Link = value; OnPropertyChanged("Link"); } } - private Hl7.Fhir.Model.DataType _Link; + private Hl7.Fhir.Model.DataType? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as RequirementComponent; - - if (dest == null) - { + if(other is not RequirementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Link != null) dest.Link = (Hl7.Fhir.Model.DataType)Link.DeepCopyInternal(); + if(_Link is not null) dest.Link = (Hl7.Fhir.Model.DataType)_Link.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1064,34 +1016,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequirementComponent; - if(otherT == null) return false; + if(other is not RequirementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "link": - value = Link; - return Link is not null; + value = _Link; + return _Link is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "link": - Link = (Hl7.Fhir.Model.DataType)value; + Link = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -1102,7 +1054,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Link is not null) yield return new KeyValuePair("link",Link); + if (_Link is not null) yield return new KeyValuePair("link",_Link); } } @@ -1125,28 +1077,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1156,28 +1105,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1190,25 +1136,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1220,48 +1162,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1272,9 +1214,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1301,39 +1243,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; /// /// The assertion performed. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestReport.AssertComponent Assert + public Hl7.Fhir.Model.TestReport.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestReport.AssertComponent _Assert; + private Hl7.Fhir.Model.TestReport.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1345,41 +1283,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestReport.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestReport.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -1390,8 +1328,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -1420,23 +1358,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1448,34 +1382,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1486,7 +1420,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -1514,25 +1448,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestReport.OperationComponent Operation + public Hl7.Fhir.Model.TestReport.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestReport.OperationComponent _Operation; + private Hl7.Fhir.Model.TestReport.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1544,34 +1474,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestReport.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestReport.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -1582,7 +1512,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -1592,41 +1522,38 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("identifier", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.Identifier Identifier + public Hl7.Fhir.Model.Identifier? Identifier { get { return _Identifier; } set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private Hl7.Fhir.Model.Identifier _Identifier; + private Hl7.Fhir.Model.Identifier? _Identifier; /// /// Informal name of the executed TestReport. /// [FhirElement("name", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Informal name of the executed TestReport /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1639,13 +1566,13 @@ public string Name [Binding("TestReportStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// completed | in-progress | waiting | stopped | entered-in-error @@ -1654,13 +1581,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -1671,28 +1595,25 @@ public Hl7.Fhir.Model.TestReport.TestReportStatus? Status [FhirElement("testScript", InSummary=true, Order=120)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical TestScriptElement + public Hl7.Fhir.Model.Canonical? TestScriptElement { get { return _TestScriptElement; } set { _TestScriptElement = value; OnPropertyChanged("TestScriptElement"); } } - private Hl7.Fhir.Model.Canonical _TestScriptElement; + private Hl7.Fhir.Model.Canonical? _TestScriptElement; /// /// Canonical URL to the version-specific TestScript that was executed to produce this TestReport /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TestScript + public string? TestScript { - get { return TestScriptElement != null ? TestScriptElement.Value : null; } + get => _TestScriptElement?.Value; set { - if (value == null) - TestScriptElement = null; - else - TestScriptElement = new Hl7.Fhir.Model.Canonical(value); + TestScriptElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("TestScript"); } } @@ -1705,13 +1626,13 @@ public string TestScript [Binding("TestReportResult")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code ResultElement + public Code? ResultElement { get { return _ResultElement; } set { _ResultElement = value; OnPropertyChanged("ResultElement"); } } - private Code _ResultElement; + private Code? _ResultElement; /// /// pass | fail | pending @@ -1720,13 +1641,10 @@ public Code ResultElement [IgnoreDataMember] public Hl7.Fhir.Model.TestReport.TestReportResult? Result { - get { return ResultElement != null ? ResultElement.Value : null; } + get => _ResultElement?.Value; set { - if (value == null) - ResultElement = null; - else - ResultElement = new Code(value); + ResultElement = value is null ? null : new Code(value); OnPropertyChanged("Result"); } } @@ -1736,13 +1654,13 @@ public Hl7.Fhir.Model.TestReport.TestReportResult? Result /// [FhirElement("score", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal ScoreElement + public Hl7.Fhir.Model.FhirDecimal? ScoreElement { get { return _ScoreElement; } set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } - private Hl7.Fhir.Model.FhirDecimal _ScoreElement; + private Hl7.Fhir.Model.FhirDecimal? _ScoreElement; /// /// The final score (percentage of tests passed) resulting from the execution of the TestScript @@ -1751,13 +1669,10 @@ public Hl7.Fhir.Model.FhirDecimal ScoreElement [IgnoreDataMember] public decimal? Score { - get { return ScoreElement != null ? ScoreElement.Value : null; } + get => _ScoreElement?.Value; set { - if (value == null) - ScoreElement = null; - else - ScoreElement = new Hl7.Fhir.Model.FhirDecimal(value); + ScoreElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Score"); } } @@ -1767,28 +1682,25 @@ public decimal? Score /// [FhirElement("tester", InSummary=true, Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString TesterElement + public Hl7.Fhir.Model.FhirString? TesterElement { get { return _TesterElement; } set { _TesterElement = value; OnPropertyChanged("TesterElement"); } } - private Hl7.Fhir.Model.FhirString _TesterElement; + private Hl7.Fhir.Model.FhirString? _TesterElement; /// /// Name of the tester producing this report (Organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Tester + public string? Tester { - get { return TesterElement != null ? TesterElement.Value : null; } + get => _TesterElement?.Value; set { - if (value == null) - TesterElement = null; - else - TesterElement = new Hl7.Fhir.Model.FhirString(value); + TesterElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Tester"); } } @@ -1798,28 +1710,25 @@ public string Tester /// [FhirElement("issued", InSummary=true, Order=160, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime IssuedElement + public Hl7.Fhir.Model.FhirDateTime? IssuedElement { get { return _IssuedElement; } set { _IssuedElement = value; OnPropertyChanged("IssuedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _IssuedElement; + private Hl7.Fhir.Model.FhirDateTime? _IssuedElement; /// /// When the TestScript was executed and this TestReport was generated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Issued + public string? Issued { - get { return IssuedElement != null ? IssuedElement.Value : null; } + get => _IssuedElement?.Value; set { - if (value == null) - IssuedElement = null; - else - IssuedElement = new Hl7.Fhir.Model.FhirDateTime(value); + IssuedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Issued"); } } @@ -1832,24 +1741,24 @@ public string Issued [DataMember] public List Participant { - get { if(_Participant==null) _Participant = new List(); return _Participant; } + get => _Participant ?? new List(); set { _Participant = value; OnPropertyChanged("Participant"); } } - private List _Participant; + private List? _Participant; /// /// The results of the series of required setup operations before the tests were executed. /// [FhirElement("setup", Order=180)] [DataMember] - public Hl7.Fhir.Model.TestReport.SetupComponent Setup + public Hl7.Fhir.Model.TestReport.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestReport.SetupComponent _Setup; + private Hl7.Fhir.Model.TestReport.SetupComponent? _Setup; /// /// A test executed from the test script. @@ -1859,49 +1768,45 @@ public Hl7.Fhir.Model.TestReport.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// The results of running the series of required clean up steps. /// [FhirElement("teardown", Order=200)] [DataMember] - public Hl7.Fhir.Model.TestReport.TeardownComponent Teardown + public Hl7.Fhir.Model.TestReport.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestReport.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestReport.TeardownComponent? _Teardown; - Identifier IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestReport; - - if (dest == null) - { + if(other is not TestReport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier != null) dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(TestScriptElement != null) dest.TestScriptElement = (Hl7.Fhir.Model.Canonical)TestScriptElement.DeepCopyInternal(); - if(ResultElement != null) dest.ResultElement = (Code)ResultElement.DeepCopyInternal(); - if(ScoreElement != null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)ScoreElement.DeepCopyInternal(); - if(TesterElement != null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)TesterElement.DeepCopyInternal(); - if(IssuedElement != null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopyInternal(); - if(Participant.Any()) dest.Participant = new List(Participant.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)Teardown.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = (Hl7.Fhir.Model.Identifier)_Identifier.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_TestScriptElement is not null) dest.TestScriptElement = (Hl7.Fhir.Model.Canonical)_TestScriptElement.DeepCopyInternal(); + if(_ResultElement is not null) dest.ResultElement = (Code)_ResultElement.DeepCopyInternal(); + if(_ScoreElement is not null) dest.ScoreElement = (Hl7.Fhir.Model.FhirDecimal)_ScoreElement.DeepCopyInternal(); + if(_TesterElement is not null) dest.TesterElement = (Hl7.Fhir.Model.FhirString)_TesterElement.DeepCopyInternal(); + if(_IssuedElement is not null) dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)_IssuedElement.DeepCopyInternal(); + if(_Participant is not null) dest.Participant = new List(_Participant.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1913,111 +1818,111 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestReport; - if(otherT == null) return false; + if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(TestScriptElement, otherT.TestScriptElement)) return false; - if(!comparer.Equals(ResultElement, otherT.ResultElement)) return false; - if(!comparer.Equals(ScoreElement, otherT.ScoreElement)) return false; - if(!comparer.Equals(TesterElement, otherT.TesterElement)) return false; - if(!comparer.Equals(IssuedElement, otherT.IssuedElement)) return false; - if(!comparer.ListEquals(Participant, otherT.Participant)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_TestScriptElement, otherT._TestScriptElement)) return false; + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false; + if(!comparer.Equals(_TesterElement, otherT._TesterElement)) return false; + if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; + if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier is not null; + value = _Identifier; + return _Identifier is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "testScript": - value = TestScriptElement; - return TestScriptElement is not null; + value = _TestScriptElement; + return _TestScriptElement is not null; case "result": - value = ResultElement; - return ResultElement is not null; + value = _ResultElement; + return _ResultElement is not null; case "score": - value = ScoreElement; - return ScoreElement is not null; + value = _ScoreElement; + return _ScoreElement is not null; case "tester": - value = TesterElement; - return TesterElement is not null; + value = _TesterElement; + return _TesterElement is not null; case "issued": - value = IssuedElement; - return IssuedElement is not null; + value = _IssuedElement; + return _IssuedElement is not null; case "participant": - value = Participant; - return Participant?.Any() == true; + value = _Participant; + return _Participant?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (Hl7.Fhir.Model.Identifier)value; + Identifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "testScript": - TestScriptElement = (Hl7.Fhir.Model.Canonical)value; + TestScriptElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "result": - ResultElement = (Code)value; + ResultElement = (Code?)value; return this; case "score": - ScoreElement = (Hl7.Fhir.Model.FhirDecimal)value; + ScoreElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "tester": - TesterElement = (Hl7.Fhir.Model.FhirString)value; + TesterElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "issued": - IssuedElement = (Hl7.Fhir.Model.FhirDateTime)value; + IssuedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "participant": - Participant = (List)value; + Participant = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestReport.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestReport.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestReport.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -2028,18 +1933,18 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier is not null) yield return new KeyValuePair("identifier",Identifier); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (TestScriptElement is not null) yield return new KeyValuePair("testScript",TestScriptElement); - if (ResultElement is not null) yield return new KeyValuePair("result",ResultElement); - if (ScoreElement is not null) yield return new KeyValuePair("score",ScoreElement); - if (TesterElement is not null) yield return new KeyValuePair("tester",TesterElement); - if (IssuedElement is not null) yield return new KeyValuePair("issued",IssuedElement); - if (Participant?.Any() == true) yield return new KeyValuePair("participant",Participant); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_Identifier is not null) yield return new KeyValuePair("identifier",_Identifier); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_TestScriptElement is not null) yield return new KeyValuePair("testScript",_TestScriptElement); + if (_ResultElement is not null) yield return new KeyValuePair("result",_ResultElement); + if (_ScoreElement is not null) yield return new KeyValuePair("score",_ScoreElement); + if (_TesterElement is not null) yield return new KeyValuePair("tester",_TesterElement); + if (_IssuedElement is not null) yield return new KeyValuePair("issued",_IssuedElement); + if (_Participant?.Any() == true) yield return new KeyValuePair("participant",_Participant); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs index 5df7afa6f..2b41171bd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -546,13 +549,13 @@ public partial class OriginComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract origin server starting at 1 @@ -561,13 +564,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -579,58 +579,51 @@ public int? Index [Binding("TestScriptProfileOriginType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; /// /// The url path of the origin server. /// [FhirElement("url", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// The url path of the origin server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OriginComponent; - - if (dest == null) - { + if(other is not OriginComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -642,48 +635,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OriginComponent; - if(otherT == null) return false; + if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -694,9 +687,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -724,13 +717,13 @@ public partial class DestinationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("index", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Integer IndexElement + public Hl7.Fhir.Model.Integer? IndexElement { get { return _IndexElement; } set { _IndexElement = value; OnPropertyChanged("IndexElement"); } } - private Hl7.Fhir.Model.Integer _IndexElement; + private Hl7.Fhir.Model.Integer? _IndexElement; /// /// The index of the abstract destination server starting at 1 @@ -739,13 +732,10 @@ public Hl7.Fhir.Model.Integer IndexElement [IgnoreDataMember] public int? Index { - get { return IndexElement != null ? IndexElement.Value : null; } + get => _IndexElement?.Value; set { - if (value == null) - IndexElement = null; - else - IndexElement = new Hl7.Fhir.Model.Integer(value); + IndexElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Index"); } } @@ -757,58 +747,51 @@ public int? Index [Binding("TestScriptProfileDestinationType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Coding Profile + public Hl7.Fhir.Model.Coding? Profile { get { return _Profile; } set { _Profile = value; OnPropertyChanged("Profile"); } } - private Hl7.Fhir.Model.Coding _Profile; + private Hl7.Fhir.Model.Coding? _Profile; /// /// The url path of the destination server. /// [FhirElement("url", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirUrl UrlElement + public Hl7.Fhir.Model.FhirUrl? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUrl _UrlElement; + private Hl7.Fhir.Model.FhirUrl? _UrlElement; /// /// The url path of the destination server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUrl(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUrl(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as DestinationComponent; - - if (dest == null) - { + if(other is not DestinationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(IndexElement != null) dest.IndexElement = (Hl7.Fhir.Model.Integer)IndexElement.DeepCopyInternal(); - if(Profile != null) dest.Profile = (Hl7.Fhir.Model.Coding)Profile.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)UrlElement.DeepCopyInternal(); + if(_IndexElement is not null) dest.IndexElement = (Hl7.Fhir.Model.Integer)_IndexElement.DeepCopyInternal(); + if(_Profile is not null) dest.Profile = (Hl7.Fhir.Model.Coding)_Profile.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUrl)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -820,48 +803,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as DestinationComponent; - if(otherT == null) return false; + if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(IndexElement, otherT.IndexElement)) return false; - if(!comparer.Equals(Profile, otherT.Profile)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + if(!comparer.Equals(_Profile, otherT._Profile)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "index": - value = IndexElement; - return IndexElement is not null; + value = _IndexElement; + return _IndexElement is not null; case "profile": - value = Profile; - return Profile is not null; + value = _Profile; + return _Profile is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "index": - IndexElement = (Hl7.Fhir.Model.Integer)value; + IndexElement = (Hl7.Fhir.Model.Integer?)value; return this; case "profile": - Profile = (Hl7.Fhir.Model.Coding)value; + Profile = (Hl7.Fhir.Model.Coding?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirUrl)value; + UrlElement = (Hl7.Fhir.Model.FhirUrl?)value; return this; default: return base.SetValue(key, value); @@ -872,9 +855,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (IndexElement is not null) yield return new KeyValuePair("index",IndexElement); - if (Profile is not null) yield return new KeyValuePair("profile",Profile); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_IndexElement is not null) yield return new KeyValuePair("index",_IndexElement); + if (_Profile is not null) yield return new KeyValuePair("profile",_Profile); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -903,11 +886,11 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get { if(_Link==null) _Link = new List(); return _Link; } + get => _Link ?? new List(); set { _Link = value; OnPropertyChanged("Link"); } } - private List _Link; + private List? _Link; /// /// Capabilities that are assumed to function correctly on the FHIR server being tested. @@ -917,24 +900,20 @@ public List Link [DataMember] public List Capability { - get { if(_Capability==null) _Capability = new List(); return _Capability; } + get => _Capability ?? new List(); set { _Capability = value; OnPropertyChanged("Capability"); } } - private List _Capability; + private List? _Capability; protected internal override void CopyToInternal(Base other) { - var dest = other as MetadataComponent; - - if (dest == null) - { + if(other is not MetadataComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Link.Any()) dest.Link = new List(Link.DeepCopyInternal()); - if(Capability.Any()) dest.Capability = new List(Capability.DeepCopyInternal()); + if(_Link is not null) dest.Link = new List(_Link.DeepCopyInternal()); + if(_Capability is not null) dest.Capability = new List(_Capability.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -946,41 +925,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as MetadataComponent; - if(otherT == null) return false; + if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Link, otherT.Link)) return false; - if(!comparer.ListEquals(Capability, otherT.Capability)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "link": - value = Link; - return Link?.Any() == true; + value = _Link; + return _Link?.Any() == true; case "capability": - value = Capability; - return Capability?.Any() == true; + value = _Capability; + return _Capability?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "link": - Link = (List)value; + Link = (List?)value!; return this; case "capability": - Capability = (List)value; + Capability = (List?)value!; return this; default: return base.SetValue(key, value); @@ -991,8 +970,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Link?.Any() == true) yield return new KeyValuePair("link",Link); - if (Capability?.Any() == true) yield return new KeyValuePair("capability",Capability); + if (_Link?.Any() == true) yield return new KeyValuePair("link",_Link); + if (_Capability?.Any() == true) yield return new KeyValuePair("capability",_Capability); } } @@ -1019,28 +998,25 @@ public partial class LinkComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("url", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// URL to the specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -1050,44 +1026,37 @@ public string Url /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Short description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as LinkComponent; - - if (dest == null) - { + if(other is not LinkComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1099,41 +1068,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LinkComponent; - if(otherT == null) return false; + if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -1144,8 +1113,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); } } @@ -1173,13 +1142,13 @@ public partial class CapabilityComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("required", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean RequiredElement + public Hl7.Fhir.Model.FhirBoolean? RequiredElement { get { return _RequiredElement; } set { _RequiredElement = value; OnPropertyChanged("RequiredElement"); } } - private Hl7.Fhir.Model.FhirBoolean _RequiredElement; + private Hl7.Fhir.Model.FhirBoolean? _RequiredElement; /// /// Are the capabilities required? @@ -1188,13 +1157,10 @@ public Hl7.Fhir.Model.FhirBoolean RequiredElement [IgnoreDataMember] public bool? Required { - get { return RequiredElement != null ? RequiredElement.Value : null; } + get => _RequiredElement?.Value; set { - if (value == null) - RequiredElement = null; - else - RequiredElement = new Hl7.Fhir.Model.FhirBoolean(value); + RequiredElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Required"); } } @@ -1205,13 +1171,13 @@ public bool? Required [FhirElement("validated", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ValidatedElement + public Hl7.Fhir.Model.FhirBoolean? ValidatedElement { get { return _ValidatedElement; } set { _ValidatedElement = value; OnPropertyChanged("ValidatedElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ValidatedElement; + private Hl7.Fhir.Model.FhirBoolean? _ValidatedElement; /// /// Are the capabilities validated? @@ -1220,13 +1186,10 @@ public Hl7.Fhir.Model.FhirBoolean ValidatedElement [IgnoreDataMember] public bool? Validated { - get { return ValidatedElement != null ? ValidatedElement.Value : null; } + get => _ValidatedElement?.Value; set { - if (value == null) - ValidatedElement = null; - else - ValidatedElement = new Hl7.Fhir.Model.FhirBoolean(value); + ValidatedElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Validated"); } } @@ -1236,28 +1199,25 @@ public bool? Validated /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// The expected capabilities of the server /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1270,24 +1230,24 @@ public string Description [DataMember] public List OriginElement { - get { if(_OriginElement==null) _OriginElement = new List(); return _OriginElement; } + get => _OriginElement ?? new List(); set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private List _OriginElement; + private List? _OriginElement; /// /// Which origin server these requirements apply to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Origin + public IEnumerable? Origin { - get { return OriginElement != null ? OriginElement.Select(elem => elem.Value) : null; } + get => _OriginElement?.Select(elem => elem.Value); set { if (value == null) - OriginElement = null; + OriginElement = null!; else OriginElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Integer(elem))); OnPropertyChanged("Origin"); @@ -1299,13 +1259,13 @@ public IEnumerable Origin /// [FhirElement("destination", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Which server these requirements apply to @@ -1314,13 +1274,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -1333,24 +1290,24 @@ public int? Destination [DataMember] public List LinkElement { - get { if(_LinkElement==null) _LinkElement = new List(); return _LinkElement; } + get => _LinkElement ?? new List(); set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } - private List _LinkElement; + private List? _LinkElement; /// /// Links to the FHIR specification /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Link + public IEnumerable? Link { - get { return LinkElement != null ? LinkElement.Select(elem => elem.Value) : null; } + get => _LinkElement?.Select(elem => elem.Value); set { if (value == null) - LinkElement = null; + LinkElement = null!; else LinkElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUri(elem))); OnPropertyChanged("Link"); @@ -1363,49 +1320,42 @@ public IEnumerable Link [FhirElement("capabilities", Order=100)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical CapabilitiesElement + public Hl7.Fhir.Model.Canonical? CapabilitiesElement { get { return _CapabilitiesElement; } set { _CapabilitiesElement = value; OnPropertyChanged("CapabilitiesElement"); } } - private Hl7.Fhir.Model.Canonical _CapabilitiesElement; + private Hl7.Fhir.Model.Canonical? _CapabilitiesElement; /// /// Required Capability Statement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Capabilities + public string? Capabilities { - get { return CapabilitiesElement != null ? CapabilitiesElement.Value : null; } + get => _CapabilitiesElement?.Value; set { - if (value == null) - CapabilitiesElement = null; - else - CapabilitiesElement = new Hl7.Fhir.Model.Canonical(value); + CapabilitiesElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Capabilities"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as CapabilityComponent; - - if (dest == null) - { + if(other is not CapabilityComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RequiredElement != null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)RequiredElement.DeepCopyInternal(); - if(ValidatedElement != null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)ValidatedElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(OriginElement.Any()) dest.OriginElement = new List(OriginElement.DeepCopyInternal()); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(LinkElement.Any()) dest.LinkElement = new List(LinkElement.DeepCopyInternal()); - if(CapabilitiesElement != null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)CapabilitiesElement.DeepCopyInternal(); + if(_RequiredElement is not null) dest.RequiredElement = (Hl7.Fhir.Model.FhirBoolean)_RequiredElement.DeepCopyInternal(); + if(_ValidatedElement is not null) dest.ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)_ValidatedElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = new List(_OriginElement.DeepCopyInternal()); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_LinkElement is not null) dest.LinkElement = new List(_LinkElement.DeepCopyInternal()); + if(_CapabilitiesElement is not null) dest.CapabilitiesElement = (Hl7.Fhir.Model.Canonical)_CapabilitiesElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1417,76 +1367,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as CapabilityComponent; - if(otherT == null) return false; + if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RequiredElement, otherT.RequiredElement)) return false; - if(!comparer.Equals(ValidatedElement, otherT.ValidatedElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.ListEquals(LinkElement, otherT.LinkElement)) return false; - if(!comparer.Equals(CapabilitiesElement, otherT.CapabilitiesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; + if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "required": - value = RequiredElement; - return RequiredElement is not null; + value = _RequiredElement; + return _RequiredElement is not null; case "validated": - value = ValidatedElement; - return ValidatedElement is not null; + value = _ValidatedElement; + return _ValidatedElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "origin": - value = OriginElement; - return OriginElement?.Any() == true; + value = _OriginElement; + return _OriginElement?.Any() == true; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "link": - value = LinkElement; - return LinkElement?.Any() == true; + value = _LinkElement; + return _LinkElement?.Any() == true; case "capabilities": - value = CapabilitiesElement; - return CapabilitiesElement is not null; + value = _CapabilitiesElement; + return _CapabilitiesElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "required": - RequiredElement = (Hl7.Fhir.Model.FhirBoolean)value; + RequiredElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "validated": - ValidatedElement = (Hl7.Fhir.Model.FhirBoolean)value; + ValidatedElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "origin": - OriginElement = (List)value; + OriginElement = (List?)value!; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "link": - LinkElement = (List)value; + LinkElement = (List?)value!; return this; case "capabilities": - CapabilitiesElement = (Hl7.Fhir.Model.Canonical)value; + CapabilitiesElement = (Hl7.Fhir.Model.Canonical?)value; return this; default: return base.SetValue(key, value); @@ -1497,13 +1447,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RequiredElement is not null) yield return new KeyValuePair("required",RequiredElement); - if (ValidatedElement is not null) yield return new KeyValuePair("validated",ValidatedElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (OriginElement?.Any() == true) yield return new KeyValuePair("origin",OriginElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (LinkElement?.Any() == true) yield return new KeyValuePair("link",LinkElement); - if (CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",CapabilitiesElement); + if (_RequiredElement is not null) yield return new KeyValuePair("required",_RequiredElement); + if (_ValidatedElement is not null) yield return new KeyValuePair("validated",_ValidatedElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_OriginElement?.Any() == true) yield return new KeyValuePair("origin",_OriginElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_LinkElement?.Any() == true) yield return new KeyValuePair("link",_LinkElement); + if (_CapabilitiesElement is not null) yield return new KeyValuePair("capabilities",_CapabilitiesElement); } } @@ -1530,28 +1480,25 @@ public partial class ScopeComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("artifact", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.Canonical ArtifactElement + public Hl7.Fhir.Model.Canonical? ArtifactElement { get { return _ArtifactElement; } set { _ArtifactElement = value; OnPropertyChanged("ArtifactElement"); } } - private Hl7.Fhir.Model.Canonical _ArtifactElement; + private Hl7.Fhir.Model.Canonical? _ArtifactElement; /// /// The specific conformance artifact being tested /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Artifact + public string? Artifact { - get { return ArtifactElement != null ? ArtifactElement.Value : null; } + get => _ArtifactElement?.Value; set { - if (value == null) - ArtifactElement = null; - else - ArtifactElement = new Hl7.Fhir.Model.Canonical(value); + ArtifactElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("Artifact"); } } @@ -1562,13 +1509,13 @@ public string Artifact [FhirElement("conformance", Order=50)] [Binding("TestScriptScopeConformanceType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Conformance + public Hl7.Fhir.Model.CodeableConcept? Conformance { get { return _Conformance; } set { _Conformance = value; OnPropertyChanged("Conformance"); } } - private Hl7.Fhir.Model.CodeableConcept _Conformance; + private Hl7.Fhir.Model.CodeableConcept? _Conformance; /// /// unit | integration | production. @@ -1576,27 +1523,23 @@ public Hl7.Fhir.Model.CodeableConcept Conformance [FhirElement("phase", Order=60)] [Binding("TestScriptScopePhaseType")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Phase + public Hl7.Fhir.Model.CodeableConcept? Phase { get { return _Phase; } set { _Phase = value; OnPropertyChanged("Phase"); } } - private Hl7.Fhir.Model.CodeableConcept _Phase; + private Hl7.Fhir.Model.CodeableConcept? _Phase; protected internal override void CopyToInternal(Base other) { - var dest = other as ScopeComponent; - - if (dest == null) - { + if(other is not ScopeComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ArtifactElement != null) dest.ArtifactElement = (Hl7.Fhir.Model.Canonical)ArtifactElement.DeepCopyInternal(); - if(Conformance != null) dest.Conformance = (Hl7.Fhir.Model.CodeableConcept)Conformance.DeepCopyInternal(); - if(Phase != null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)Phase.DeepCopyInternal(); + if(_ArtifactElement is not null) dest.ArtifactElement = (Hl7.Fhir.Model.Canonical)_ArtifactElement.DeepCopyInternal(); + if(_Conformance is not null) dest.Conformance = (Hl7.Fhir.Model.CodeableConcept)_Conformance.DeepCopyInternal(); + if(_Phase is not null) dest.Phase = (Hl7.Fhir.Model.CodeableConcept)_Phase.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1608,48 +1551,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ScopeComponent; - if(otherT == null) return false; + if(other is not ScopeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ArtifactElement, otherT.ArtifactElement)) return false; - if(!comparer.Equals(Conformance, otherT.Conformance)) return false; - if(!comparer.Equals(Phase, otherT.Phase)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ArtifactElement, otherT._ArtifactElement)) return false; + if(!comparer.Equals(_Conformance, otherT._Conformance)) return false; + if(!comparer.Equals(_Phase, otherT._Phase)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "artifact": - value = ArtifactElement; - return ArtifactElement is not null; + value = _ArtifactElement; + return _ArtifactElement is not null; case "conformance": - value = Conformance; - return Conformance is not null; + value = _Conformance; + return _Conformance is not null; case "phase": - value = Phase; - return Phase is not null; + value = _Phase; + return _Phase is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "artifact": - ArtifactElement = (Hl7.Fhir.Model.Canonical)value; + ArtifactElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "conformance": - Conformance = (Hl7.Fhir.Model.CodeableConcept)value; + Conformance = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "phase": - Phase = (Hl7.Fhir.Model.CodeableConcept)value; + Phase = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1660,9 +1603,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ArtifactElement is not null) yield return new KeyValuePair("artifact",ArtifactElement); - if (Conformance is not null) yield return new KeyValuePair("conformance",Conformance); - if (Phase is not null) yield return new KeyValuePair("phase",Phase); + if (_ArtifactElement is not null) yield return new KeyValuePair("artifact",_ArtifactElement); + if (_Conformance is not null) yield return new KeyValuePair("conformance",_Conformance); + if (_Phase is not null) yield return new KeyValuePair("phase",_Phase); } } @@ -1689,13 +1632,13 @@ public partial class FixtureComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("autocreate", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutocreateElement + public Hl7.Fhir.Model.FhirBoolean? AutocreateElement { get { return _AutocreateElement; } set { _AutocreateElement = value; OnPropertyChanged("AutocreateElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutocreateElement; + private Hl7.Fhir.Model.FhirBoolean? _AutocreateElement; /// /// Whether or not to implicitly create the fixture during setup @@ -1704,13 +1647,10 @@ public Hl7.Fhir.Model.FhirBoolean AutocreateElement [IgnoreDataMember] public bool? Autocreate { - get { return AutocreateElement != null ? AutocreateElement.Value : null; } + get => _AutocreateElement?.Value; set { - if (value == null) - AutocreateElement = null; - else - AutocreateElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutocreateElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autocreate"); } } @@ -1721,13 +1661,13 @@ public bool? Autocreate [FhirElement("autodelete", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean AutodeleteElement + public Hl7.Fhir.Model.FhirBoolean? AutodeleteElement { get { return _AutodeleteElement; } set { _AutodeleteElement = value; OnPropertyChanged("AutodeleteElement"); } } - private Hl7.Fhir.Model.FhirBoolean _AutodeleteElement; + private Hl7.Fhir.Model.FhirBoolean? _AutodeleteElement; /// /// Whether or not to implicitly delete the fixture during teardown @@ -1736,13 +1676,10 @@ public Hl7.Fhir.Model.FhirBoolean AutodeleteElement [IgnoreDataMember] public bool? Autodelete { - get { return AutodeleteElement != null ? AutodeleteElement.Value : null; } + get => _AutodeleteElement?.Value; set { - if (value == null) - AutodeleteElement = null; - else - AutodeleteElement = new Hl7.Fhir.Model.FhirBoolean(value); + AutodeleteElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Autodelete"); } } @@ -1754,27 +1691,23 @@ public bool? Autodelete [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Resource + public Hl7.Fhir.Model.ResourceReference? Resource { get { return _Resource; } set { _Resource = value; OnPropertyChanged("Resource"); } } - private Hl7.Fhir.Model.ResourceReference _Resource; + private Hl7.Fhir.Model.ResourceReference? _Resource; protected internal override void CopyToInternal(Base other) { - var dest = other as FixtureComponent; - - if (dest == null) - { + if(other is not FixtureComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AutocreateElement != null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)AutocreateElement.DeepCopyInternal(); - if(AutodeleteElement != null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)AutodeleteElement.DeepCopyInternal(); - if(Resource != null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)Resource.DeepCopyInternal(); + if(_AutocreateElement is not null) dest.AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)_AutocreateElement.DeepCopyInternal(); + if(_AutodeleteElement is not null) dest.AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)_AutodeleteElement.DeepCopyInternal(); + if(_Resource is not null) dest.Resource = (Hl7.Fhir.Model.ResourceReference)_Resource.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1786,48 +1719,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as FixtureComponent; - if(otherT == null) return false; + if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AutocreateElement, otherT.AutocreateElement)) return false; - if(!comparer.Equals(AutodeleteElement, otherT.AutodeleteElement)) return false; - if(!comparer.Equals(Resource, otherT.Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; + if(!comparer.Equals(_Resource, otherT._Resource)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "autocreate": - value = AutocreateElement; - return AutocreateElement is not null; + value = _AutocreateElement; + return _AutocreateElement is not null; case "autodelete": - value = AutodeleteElement; - return AutodeleteElement is not null; + value = _AutodeleteElement; + return _AutodeleteElement is not null; case "resource": - value = Resource; - return Resource is not null; + value = _Resource; + return _Resource is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "autocreate": - AutocreateElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutocreateElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "autodelete": - AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean)value; + AutodeleteElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "resource": - Resource = (Hl7.Fhir.Model.ResourceReference)value; + Resource = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1838,9 +1771,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AutocreateElement is not null) yield return new KeyValuePair("autocreate",AutocreateElement); - if (AutodeleteElement is not null) yield return new KeyValuePair("autodelete",AutodeleteElement); - if (Resource is not null) yield return new KeyValuePair("resource",Resource); + if (_AutocreateElement is not null) yield return new KeyValuePair("autocreate",_AutocreateElement); + if (_AutodeleteElement is not null) yield return new KeyValuePair("autodelete",_AutodeleteElement); + if (_Resource is not null) yield return new KeyValuePair("resource",_Resource); } } @@ -1868,28 +1801,25 @@ public partial class VariableComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("name", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Descriptive name for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -1899,28 +1829,25 @@ public string Name /// [FhirElement("defaultValue", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DefaultValueElement + public Hl7.Fhir.Model.FhirString? DefaultValueElement { get { return _DefaultValueElement; } set { _DefaultValueElement = value; OnPropertyChanged("DefaultValueElement"); } } - private Hl7.Fhir.Model.FhirString _DefaultValueElement; + private Hl7.Fhir.Model.FhirString? _DefaultValueElement; /// /// Default, hard-coded, or user-defined value for this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DefaultValue + public string? DefaultValue { - get { return DefaultValueElement != null ? DefaultValueElement.Value : null; } + get => _DefaultValueElement?.Value; set { - if (value == null) - DefaultValueElement = null; - else - DefaultValueElement = new Hl7.Fhir.Model.FhirString(value); + DefaultValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("DefaultValue"); } } @@ -1930,28 +1857,25 @@ public string DefaultValue /// [FhirElement("description", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Natural language description of the variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -1961,28 +1885,25 @@ public string Description /// [FhirElement("expression", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The FHIRPath expression against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -1992,28 +1913,25 @@ public string Expression /// [FhirElement("headerField", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name for source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -2023,28 +1941,25 @@ public string HeaderField /// [FhirElement("hint", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString HintElement + public Hl7.Fhir.Model.FhirString? HintElement { get { return _HintElement; } set { _HintElement = value; OnPropertyChanged("HintElement"); } } - private Hl7.Fhir.Model.FhirString _HintElement; + private Hl7.Fhir.Model.FhirString? _HintElement; /// /// Hint help text for default value to enter /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Hint + public string? Hint { - get { return HintElement != null ? HintElement.Value : null; } + get => _HintElement?.Value; set { - if (value == null) - HintElement = null; - else - HintElement = new Hl7.Fhir.Model.FhirString(value); + HintElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Hint"); } } @@ -2054,28 +1969,25 @@ public string Hint /// [FhirElement("path", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath against the fixture body /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -2085,50 +1997,43 @@ public string Path /// [FhirElement("sourceId", Order=110)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField within this variable /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VariableComponent; - - if (dest == null) - { + if(other is not VariableComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DefaultValueElement != null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)DefaultValueElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(HintElement != null) dest.HintElement = (Hl7.Fhir.Model.FhirString)HintElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DefaultValueElement is not null) dest.DefaultValueElement = (Hl7.Fhir.Model.FhirString)_DefaultValueElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_HintElement is not null) dest.HintElement = (Hl7.Fhir.Model.FhirString)_HintElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2140,83 +2045,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VariableComponent; - if(otherT == null) return false; + if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DefaultValueElement, otherT.DefaultValueElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(HintElement, otherT.HintElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "defaultValue": - value = DefaultValueElement; - return DefaultValueElement is not null; + value = _DefaultValueElement; + return _DefaultValueElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "hint": - value = HintElement; - return HintElement is not null; + value = _HintElement; + return _HintElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "defaultValue": - DefaultValueElement = (Hl7.Fhir.Model.FhirString)value; + DefaultValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "hint": - HintElement = (Hl7.Fhir.Model.FhirString)value; + HintElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; default: return base.SetValue(key, value); @@ -2227,14 +2132,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",DefaultValueElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (HintElement is not null) yield return new KeyValuePair("hint",HintElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DefaultValueElement is not null) yield return new KeyValuePair("defaultValue",_DefaultValueElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_HintElement is not null) yield return new KeyValuePair("hint",_HintElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); } } @@ -2260,23 +2165,19 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupComponent; - - if (dest == null) - { + if(other is not SetupComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -2288,34 +2189,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupComponent; - if(otherT == null) return false; + if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -2326,7 +2227,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -2353,39 +2254,35 @@ public partial class SetupActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as SetupActionComponent; - - if (dest == null) - { + if(other is not SetupActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -2397,41 +2294,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as SetupActionComponent; - if(otherT == null) return false; + if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -2442,8 +2339,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -2470,13 +2367,13 @@ public partial class OperationComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("type", Order=40)] [Binding("TestScriptOperationCode")] [DataMember] - public Hl7.Fhir.Model.Coding Type + public Hl7.Fhir.Model.Coding? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.Coding _Type; + private Hl7.Fhir.Model.Coding? _Type; /// /// Resource type. @@ -2484,28 +2381,25 @@ public Hl7.Fhir.Model.Coding Type [FhirElement("resource", Order=50)] [Binding("FHIRConcreteTypes")] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// Resource type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -2515,28 +2409,25 @@ public string Resource /// [FhirElement("label", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging operation label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -2546,28 +2437,25 @@ public string Label /// [FhirElement("description", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting operation description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -2578,28 +2466,25 @@ public string Description [FhirElement("accept", Order=80)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code AcceptElement + public Hl7.Fhir.Model.Code? AcceptElement { get { return _AcceptElement; } set { _AcceptElement = value; OnPropertyChanged("AcceptElement"); } } - private Hl7.Fhir.Model.Code _AcceptElement; + private Hl7.Fhir.Model.Code? _AcceptElement; /// /// Mime type to accept in the payload of the response, with charset etc /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Accept + public string? Accept { - get { return AcceptElement != null ? AcceptElement.Value : null; } + get => _AcceptElement?.Value; set { - if (value == null) - AcceptElement = null; - else - AcceptElement = new Hl7.Fhir.Model.Code(value); + AcceptElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("Accept"); } } @@ -2610,28 +2495,25 @@ public string Accept [FhirElement("contentType", Order=90)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// Mime type of the request payload contents, with charset etc /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -2641,13 +2523,13 @@ public string ContentType /// [FhirElement("destination", Order=100)] [DataMember] - public Hl7.Fhir.Model.Integer DestinationElement + public Hl7.Fhir.Model.Integer? DestinationElement { get { return _DestinationElement; } set { _DestinationElement = value; OnPropertyChanged("DestinationElement"); } } - private Hl7.Fhir.Model.Integer _DestinationElement; + private Hl7.Fhir.Model.Integer? _DestinationElement; /// /// Server responding to the request @@ -2656,13 +2538,10 @@ public Hl7.Fhir.Model.Integer DestinationElement [IgnoreDataMember] public int? Destination { - get { return DestinationElement != null ? DestinationElement.Value : null; } + get => _DestinationElement?.Value; set { - if (value == null) - DestinationElement = null; - else - DestinationElement = new Hl7.Fhir.Model.Integer(value); + DestinationElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Destination"); } } @@ -2673,13 +2552,13 @@ public int? Destination [FhirElement("encodeRequestUrl", Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement + public Hl7.Fhir.Model.FhirBoolean? EncodeRequestUrlElement { get { return _EncodeRequestUrlElement; } set { _EncodeRequestUrlElement = value; OnPropertyChanged("EncodeRequestUrlElement"); } } - private Hl7.Fhir.Model.FhirBoolean _EncodeRequestUrlElement; + private Hl7.Fhir.Model.FhirBoolean? _EncodeRequestUrlElement; /// /// Whether or not to send the request url in encoded format @@ -2688,13 +2567,10 @@ public Hl7.Fhir.Model.FhirBoolean EncodeRequestUrlElement [IgnoreDataMember] public bool? EncodeRequestUrl { - get { return EncodeRequestUrlElement != null ? EncodeRequestUrlElement.Value : null; } + get => _EncodeRequestUrlElement?.Value; set { - if (value == null) - EncodeRequestUrlElement = null; - else - EncodeRequestUrlElement = new Hl7.Fhir.Model.FhirBoolean(value); + EncodeRequestUrlElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("EncodeRequestUrl"); } } @@ -2706,13 +2582,13 @@ public bool? EncodeRequestUrl [DeclaredType(Type = typeof(Code))] [Binding("TestScriptRequestMethodCode")] [DataMember] - public Code MethodElement + public Code? MethodElement { get { return _MethodElement; } set { _MethodElement = value; OnPropertyChanged("MethodElement"); } } - private Code _MethodElement; + private Code? _MethodElement; /// /// delete | get | options | patch | post | put | head @@ -2721,13 +2597,10 @@ public Code MethodElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? Method { - get { return MethodElement != null ? MethodElement.Value : null; } + get => _MethodElement?.Value; set { - if (value == null) - MethodElement = null; - else - MethodElement = new Code(value); + MethodElement = value is null ? null : new Code(value); OnPropertyChanged("Method"); } } @@ -2737,13 +2610,13 @@ public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? Method /// [FhirElement("origin", Order=130)] [DataMember] - public Hl7.Fhir.Model.Integer OriginElement + public Hl7.Fhir.Model.Integer? OriginElement { get { return _OriginElement; } set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } - private Hl7.Fhir.Model.Integer _OriginElement; + private Hl7.Fhir.Model.Integer? _OriginElement; /// /// Server initiating the request @@ -2752,13 +2625,10 @@ public Hl7.Fhir.Model.Integer OriginElement [IgnoreDataMember] public int? Origin { - get { return OriginElement != null ? OriginElement.Value : null; } + get => _OriginElement?.Value; set { - if (value == null) - OriginElement = null; - else - OriginElement = new Hl7.Fhir.Model.Integer(value); + OriginElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Origin"); } } @@ -2768,28 +2638,25 @@ public int? Origin /// [FhirElement("params", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString ParamsElement + public Hl7.Fhir.Model.FhirString? ParamsElement { get { return _ParamsElement; } set { _ParamsElement = value; OnPropertyChanged("ParamsElement"); } } - private Hl7.Fhir.Model.FhirString _ParamsElement; + private Hl7.Fhir.Model.FhirString? _ParamsElement; /// /// Explicitly defined path parameters /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Params + public string? Params { - get { return ParamsElement != null ? ParamsElement.Value : null; } + get => _ParamsElement?.Value; set { - if (value == null) - ParamsElement = null; - else - ParamsElement = new Hl7.Fhir.Model.FhirString(value); + ParamsElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Params"); } } @@ -2802,39 +2669,36 @@ public string Params [DataMember] public List RequestHeader { - get { if(_RequestHeader==null) _RequestHeader = new List(); return _RequestHeader; } + get => _RequestHeader ?? new List(); set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } - private List _RequestHeader; + private List? _RequestHeader; /// /// Fixture Id of mapped request. /// [FhirElement("requestId", Order=160)] [DataMember] - public Hl7.Fhir.Model.Id RequestIdElement + public Hl7.Fhir.Model.Id? RequestIdElement { get { return _RequestIdElement; } set { _RequestIdElement = value; OnPropertyChanged("RequestIdElement"); } } - private Hl7.Fhir.Model.Id _RequestIdElement; + private Hl7.Fhir.Model.Id? _RequestIdElement; /// /// Fixture Id of mapped request /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestId + public string? RequestId { - get { return RequestIdElement != null ? RequestIdElement.Value : null; } + get => _RequestIdElement?.Value; set { - if (value == null) - RequestIdElement = null; - else - RequestIdElement = new Hl7.Fhir.Model.Id(value); + RequestIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("RequestId"); } } @@ -2844,28 +2708,25 @@ public string RequestId /// [FhirElement("responseId", Order=170)] [DataMember] - public Hl7.Fhir.Model.Id ResponseIdElement + public Hl7.Fhir.Model.Id? ResponseIdElement { get { return _ResponseIdElement; } set { _ResponseIdElement = value; OnPropertyChanged("ResponseIdElement"); } } - private Hl7.Fhir.Model.Id _ResponseIdElement; + private Hl7.Fhir.Model.Id? _ResponseIdElement; /// /// Fixture Id of mapped response /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseId + public string? ResponseId { - get { return ResponseIdElement != null ? ResponseIdElement.Value : null; } + get => _ResponseIdElement?.Value; set { - if (value == null) - ResponseIdElement = null; - else - ResponseIdElement = new Hl7.Fhir.Model.Id(value); + ResponseIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ResponseId"); } } @@ -2875,28 +2736,25 @@ public string ResponseId /// [FhirElement("sourceId", Order=180)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of body for PUT and POST requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -2906,28 +2764,25 @@ public string SourceId /// [FhirElement("targetId", Order=190)] [DataMember] - public Hl7.Fhir.Model.Id TargetIdElement + public Hl7.Fhir.Model.Id? TargetIdElement { get { return _TargetIdElement; } set { _TargetIdElement = value; OnPropertyChanged("TargetIdElement"); } } - private Hl7.Fhir.Model.Id _TargetIdElement; + private Hl7.Fhir.Model.Id? _TargetIdElement; /// /// Id of fixture used for extracting the [id], [type], and [vid] for GET requests /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string TargetId + public string? TargetId { - get { return TargetIdElement != null ? TargetIdElement.Value : null; } + get => _TargetIdElement?.Value; set { - if (value == null) - TargetIdElement = null; - else - TargetIdElement = new Hl7.Fhir.Model.Id(value); + TargetIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("TargetId"); } } @@ -2937,59 +2792,52 @@ public string TargetId /// [FhirElement("url", Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString UrlElement + public Hl7.Fhir.Model.FhirString? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirString _UrlElement; + private Hl7.Fhir.Model.FhirString? _UrlElement; /// /// Request URL /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirString(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Url"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as OperationComponent; - - if (dest == null) - { + if(other is not OperationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(AcceptElement != null) dest.AcceptElement = (Hl7.Fhir.Model.Code)AcceptElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(DestinationElement != null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)DestinationElement.DeepCopyInternal(); - if(EncodeRequestUrlElement != null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)EncodeRequestUrlElement.DeepCopyInternal(); - if(MethodElement != null) dest.MethodElement = (Code)MethodElement.DeepCopyInternal(); - if(OriginElement != null) dest.OriginElement = (Hl7.Fhir.Model.Integer)OriginElement.DeepCopyInternal(); - if(ParamsElement != null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)ParamsElement.DeepCopyInternal(); - if(RequestHeader.Any()) dest.RequestHeader = new List(RequestHeader.DeepCopyInternal()); - if(RequestIdElement != null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)RequestIdElement.DeepCopyInternal(); - if(ResponseIdElement != null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)ResponseIdElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(TargetIdElement != null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)TargetIdElement.DeepCopyInternal(); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)UrlElement.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.Coding)_Type.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_AcceptElement is not null) dest.AcceptElement = (Hl7.Fhir.Model.Code)_AcceptElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_DestinationElement is not null) dest.DestinationElement = (Hl7.Fhir.Model.Integer)_DestinationElement.DeepCopyInternal(); + if(_EncodeRequestUrlElement is not null) dest.EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)_EncodeRequestUrlElement.DeepCopyInternal(); + if(_MethodElement is not null) dest.MethodElement = (Code)_MethodElement.DeepCopyInternal(); + if(_OriginElement is not null) dest.OriginElement = (Hl7.Fhir.Model.Integer)_OriginElement.DeepCopyInternal(); + if(_ParamsElement is not null) dest.ParamsElement = (Hl7.Fhir.Model.FhirString)_ParamsElement.DeepCopyInternal(); + if(_RequestHeader is not null) dest.RequestHeader = new List(_RequestHeader.DeepCopyInternal()); + if(_RequestIdElement is not null) dest.RequestIdElement = (Hl7.Fhir.Model.Id)_RequestIdElement.DeepCopyInternal(); + if(_ResponseIdElement is not null) dest.ResponseIdElement = (Hl7.Fhir.Model.Id)_ResponseIdElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_TargetIdElement is not null) dest.TargetIdElement = (Hl7.Fhir.Model.Id)_TargetIdElement.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirString)_UrlElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3001,146 +2849,146 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OperationComponent; - if(otherT == null) return false; + if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(AcceptElement, otherT.AcceptElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(DestinationElement, otherT.DestinationElement)) return false; - if(!comparer.Equals(EncodeRequestUrlElement, otherT.EncodeRequestUrlElement)) return false; - if(!comparer.Equals(MethodElement, otherT.MethodElement)) return false; - if(!comparer.Equals(OriginElement, otherT.OriginElement)) return false; - if(!comparer.Equals(ParamsElement, otherT.ParamsElement)) return false; - if(!comparer.ListEquals(RequestHeader, otherT.RequestHeader)) return false; - if(!comparer.Equals(RequestIdElement, otherT.RequestIdElement)) return false; - if(!comparer.Equals(ResponseIdElement, otherT.ResponseIdElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(TargetIdElement, otherT.TargetIdElement)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_AcceptElement, otherT._AcceptElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; + if(!comparer.Equals(_EncodeRequestUrlElement, otherT._EncodeRequestUrlElement)) return false; + if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; + if(!comparer.Equals(_OriginElement, otherT._OriginElement)) return false; + if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; + if(!comparer.ListEquals(_RequestHeader, otherT._RequestHeader)) return false; + if(!comparer.Equals(_RequestIdElement, otherT._RequestIdElement)) return false; + if(!comparer.Equals(_ResponseIdElement, otherT._ResponseIdElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "accept": - value = AcceptElement; - return AcceptElement is not null; + value = _AcceptElement; + return _AcceptElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "destination": - value = DestinationElement; - return DestinationElement is not null; + value = _DestinationElement; + return _DestinationElement is not null; case "encodeRequestUrl": - value = EncodeRequestUrlElement; - return EncodeRequestUrlElement is not null; + value = _EncodeRequestUrlElement; + return _EncodeRequestUrlElement is not null; case "method": - value = MethodElement; - return MethodElement is not null; + value = _MethodElement; + return _MethodElement is not null; case "origin": - value = OriginElement; - return OriginElement is not null; + value = _OriginElement; + return _OriginElement is not null; case "params": - value = ParamsElement; - return ParamsElement is not null; + value = _ParamsElement; + return _ParamsElement is not null; case "requestHeader": - value = RequestHeader; - return RequestHeader?.Any() == true; + value = _RequestHeader; + return _RequestHeader?.Any() == true; case "requestId": - value = RequestIdElement; - return RequestIdElement is not null; + value = _RequestIdElement; + return _RequestIdElement is not null; case "responseId": - value = ResponseIdElement; - return ResponseIdElement is not null; + value = _ResponseIdElement; + return _ResponseIdElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "targetId": - value = TargetIdElement; - return TargetIdElement is not null; + value = _TargetIdElement; + return _TargetIdElement is not null; case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.Coding)value; + Type = (Hl7.Fhir.Model.Coding?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "accept": - AcceptElement = (Hl7.Fhir.Model.Code)value; + AcceptElement = (Hl7.Fhir.Model.Code?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "destination": - DestinationElement = (Hl7.Fhir.Model.Integer)value; + DestinationElement = (Hl7.Fhir.Model.Integer?)value; return this; case "encodeRequestUrl": - EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean)value; + EncodeRequestUrlElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "method": - MethodElement = (Code)value; + MethodElement = (Code?)value; return this; case "origin": - OriginElement = (Hl7.Fhir.Model.Integer)value; + OriginElement = (Hl7.Fhir.Model.Integer?)value; return this; case "params": - ParamsElement = (Hl7.Fhir.Model.FhirString)value; + ParamsElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestHeader": - RequestHeader = (List)value; + RequestHeader = (List?)value!; return this; case "requestId": - RequestIdElement = (Hl7.Fhir.Model.Id)value; + RequestIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "responseId": - ResponseIdElement = (Hl7.Fhir.Model.Id)value; + ResponseIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "targetId": - TargetIdElement = (Hl7.Fhir.Model.Id)value; + TargetIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "url": - UrlElement = (Hl7.Fhir.Model.FhirString)value; + UrlElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3151,23 +2999,23 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (AcceptElement is not null) yield return new KeyValuePair("accept",AcceptElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (DestinationElement is not null) yield return new KeyValuePair("destination",DestinationElement); - if (EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",EncodeRequestUrlElement); - if (MethodElement is not null) yield return new KeyValuePair("method",MethodElement); - if (OriginElement is not null) yield return new KeyValuePair("origin",OriginElement); - if (ParamsElement is not null) yield return new KeyValuePair("params",ParamsElement); - if (RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",RequestHeader); - if (RequestIdElement is not null) yield return new KeyValuePair("requestId",RequestIdElement); - if (ResponseIdElement is not null) yield return new KeyValuePair("responseId",ResponseIdElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (TargetIdElement is not null) yield return new KeyValuePair("targetId",TargetIdElement); - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_AcceptElement is not null) yield return new KeyValuePair("accept",_AcceptElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_DestinationElement is not null) yield return new KeyValuePair("destination",_DestinationElement); + if (_EncodeRequestUrlElement is not null) yield return new KeyValuePair("encodeRequestUrl",_EncodeRequestUrlElement); + if (_MethodElement is not null) yield return new KeyValuePair("method",_MethodElement); + if (_OriginElement is not null) yield return new KeyValuePair("origin",_OriginElement); + if (_ParamsElement is not null) yield return new KeyValuePair("params",_ParamsElement); + if (_RequestHeader?.Any() == true) yield return new KeyValuePair("requestHeader",_RequestHeader); + if (_RequestIdElement is not null) yield return new KeyValuePair("requestId",_RequestIdElement); + if (_ResponseIdElement is not null) yield return new KeyValuePair("responseId",_ResponseIdElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_TargetIdElement is not null) yield return new KeyValuePair("targetId",_TargetIdElement); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); } } @@ -3195,28 +3043,25 @@ public partial class RequestHeaderComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("field", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString FieldElement + public Hl7.Fhir.Model.FhirString? FieldElement { get { return _FieldElement; } set { _FieldElement = value; OnPropertyChanged("FieldElement"); } } - private Hl7.Fhir.Model.FhirString _FieldElement; + private Hl7.Fhir.Model.FhirString? _FieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Field + public string? Field { - get { return FieldElement != null ? FieldElement.Value : null; } + get => _FieldElement?.Value; set { - if (value == null) - FieldElement = null; - else - FieldElement = new Hl7.Fhir.Model.FhirString(value); + FieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Field"); } } @@ -3227,44 +3072,37 @@ public string Field [FhirElement("value", Order=50)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// HTTP headerfield value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RequestHeaderComponent; - - if (dest == null) - { + if(other is not RequestHeaderComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(FieldElement != null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)FieldElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); + if(_FieldElement is not null) dest.FieldElement = (Hl7.Fhir.Model.FhirString)_FieldElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -3276,41 +3114,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequestHeaderComponent; - if(otherT == null) return false; + if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(FieldElement, otherT.FieldElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "field": - value = FieldElement; - return FieldElement is not null; + value = _FieldElement; + return _FieldElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "field": - FieldElement = (Hl7.Fhir.Model.FhirString)value; + FieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -3321,8 +3159,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (FieldElement is not null) yield return new KeyValuePair("field",FieldElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); + if (_FieldElement is not null) yield return new KeyValuePair("field",_FieldElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); } } @@ -3349,28 +3187,25 @@ public partial class AssertComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("label", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString LabelElement + public Hl7.Fhir.Model.FhirString? LabelElement { get { return _LabelElement; } set { _LabelElement = value; OnPropertyChanged("LabelElement"); } } - private Hl7.Fhir.Model.FhirString _LabelElement; + private Hl7.Fhir.Model.FhirString? _LabelElement; /// /// Tracking/logging assertion label /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Label + public string? Label { - get { return LabelElement != null ? LabelElement.Value : null; } + get => _LabelElement?.Value; set { - if (value == null) - LabelElement = null; - else - LabelElement = new Hl7.Fhir.Model.FhirString(value); + LabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Label"); } } @@ -3380,28 +3215,25 @@ public string Label /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting assertion description /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -3413,13 +3245,13 @@ public string Description [DeclaredType(Type = typeof(Code))] [Binding("AssertionDirectionType")] [DataMember] - public Code DirectionElement + public Code? DirectionElement { get { return _DirectionElement; } set { _DirectionElement = value; OnPropertyChanged("DirectionElement"); } } - private Code _DirectionElement; + private Code? _DirectionElement; /// /// response | request @@ -3428,13 +3260,10 @@ public Code DirectionElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction { - get { return DirectionElement != null ? DirectionElement.Value : null; } + get => _DirectionElement?.Value; set { - if (value == null) - DirectionElement = null; - else - DirectionElement = new Code(value); + DirectionElement = value is null ? null : new Code(value); OnPropertyChanged("Direction"); } } @@ -3444,28 +3273,25 @@ public Hl7.Fhir.Model.TestScript.AssertionDirectionType? Direction /// [FhirElement("compareToSourceId", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceIdElement + public Hl7.Fhir.Model.FhirString? CompareToSourceIdElement { get { return _CompareToSourceIdElement; } set { _CompareToSourceIdElement = value; OnPropertyChanged("CompareToSourceIdElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceIdElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceIdElement; /// /// Id of the source fixture to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceId + public string? CompareToSourceId { - get { return CompareToSourceIdElement != null ? CompareToSourceIdElement.Value : null; } + get => _CompareToSourceIdElement?.Value; set { - if (value == null) - CompareToSourceIdElement = null; - else - CompareToSourceIdElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceId"); } } @@ -3475,28 +3301,25 @@ public string CompareToSourceId /// [FhirElement("compareToSourceExpression", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourceExpressionElement + public Hl7.Fhir.Model.FhirString? CompareToSourceExpressionElement { get { return _CompareToSourceExpressionElement; } set { _CompareToSourceExpressionElement = value; OnPropertyChanged("CompareToSourceExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourceExpressionElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourceExpressionElement; /// /// The FHIRPath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourceExpression + public string? CompareToSourceExpression { - get { return CompareToSourceExpressionElement != null ? CompareToSourceExpressionElement.Value : null; } + get => _CompareToSourceExpressionElement?.Value; set { - if (value == null) - CompareToSourceExpressionElement = null; - else - CompareToSourceExpressionElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourceExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourceExpression"); } } @@ -3506,28 +3329,25 @@ public string CompareToSourceExpression /// [FhirElement("compareToSourcePath", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString CompareToSourcePathElement + public Hl7.Fhir.Model.FhirString? CompareToSourcePathElement { get { return _CompareToSourcePathElement; } set { _CompareToSourcePathElement = value; OnPropertyChanged("CompareToSourcePathElement"); } } - private Hl7.Fhir.Model.FhirString _CompareToSourcePathElement; + private Hl7.Fhir.Model.FhirString? _CompareToSourcePathElement; /// /// XPath or JSONPath expression to evaluate against the source fixture /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompareToSourcePath + public string? CompareToSourcePath { - get { return CompareToSourcePathElement != null ? CompareToSourcePathElement.Value : null; } + get => _CompareToSourcePathElement?.Value; set { - if (value == null) - CompareToSourcePathElement = null; - else - CompareToSourcePathElement = new Hl7.Fhir.Model.FhirString(value); + CompareToSourcePathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CompareToSourcePath"); } } @@ -3538,28 +3358,25 @@ public string CompareToSourcePath [FhirElement("contentType", Order=100)] [Binding("MimeType")] [DataMember] - public Hl7.Fhir.Model.Code ContentTypeElement + public Hl7.Fhir.Model.Code? ContentTypeElement { get { return _ContentTypeElement; } set { _ContentTypeElement = value; OnPropertyChanged("ContentTypeElement"); } } - private Hl7.Fhir.Model.Code _ContentTypeElement; + private Hl7.Fhir.Model.Code? _ContentTypeElement; /// /// Mime type to compare against the 'Content-Type' header /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ContentType + public string? ContentType { - get { return ContentTypeElement != null ? ContentTypeElement.Value : null; } + get => _ContentTypeElement?.Value; set { - if (value == null) - ContentTypeElement = null; - else - ContentTypeElement = new Hl7.Fhir.Model.Code(value); + ContentTypeElement = value is null ? null : new Hl7.Fhir.Model.Code(value); OnPropertyChanged("ContentType"); } } @@ -3571,13 +3388,13 @@ public string ContentType [DeclaredType(Type = typeof(Code))] [Binding("AssertionManualCompletionType")] [DataMember] - public Code DefaultManualCompletionElement + public Code? DefaultManualCompletionElement { get { return _DefaultManualCompletionElement; } set { _DefaultManualCompletionElement = value; OnPropertyChanged("DefaultManualCompletionElement"); } } - private Code _DefaultManualCompletionElement; + private Code? _DefaultManualCompletionElement; /// /// fail | pass | skip | stop @@ -3586,13 +3403,10 @@ public Code DefaultManu [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionManualCompletionType? DefaultManualCompletion { - get { return DefaultManualCompletionElement != null ? DefaultManualCompletionElement.Value : null; } + get => _DefaultManualCompletionElement?.Value; set { - if (value == null) - DefaultManualCompletionElement = null; - else - DefaultManualCompletionElement = new Code(value); + DefaultManualCompletionElement = value is null ? null : new Code(value); OnPropertyChanged("DefaultManualCompletion"); } } @@ -3602,28 +3416,25 @@ public Hl7.Fhir.Model.TestScript.AssertionManualCompletionType? DefaultManualCom /// [FhirElement("expression", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirString ExpressionElement + public Hl7.Fhir.Model.FhirString? ExpressionElement { get { return _ExpressionElement; } set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } - private Hl7.Fhir.Model.FhirString _ExpressionElement; + private Hl7.Fhir.Model.FhirString? _ExpressionElement; /// /// The FHIRPath expression to be evaluated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Expression + public string? Expression { - get { return ExpressionElement != null ? ExpressionElement.Value : null; } + get => _ExpressionElement?.Value; set { - if (value == null) - ExpressionElement = null; - else - ExpressionElement = new Hl7.Fhir.Model.FhirString(value); + ExpressionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Expression"); } } @@ -3633,28 +3444,25 @@ public string Expression /// [FhirElement("headerField", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirString HeaderFieldElement + public Hl7.Fhir.Model.FhirString? HeaderFieldElement { get { return _HeaderFieldElement; } set { _HeaderFieldElement = value; OnPropertyChanged("HeaderFieldElement"); } } - private Hl7.Fhir.Model.FhirString _HeaderFieldElement; + private Hl7.Fhir.Model.FhirString? _HeaderFieldElement; /// /// HTTP header field name /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string HeaderField + public string? HeaderField { - get { return HeaderFieldElement != null ? HeaderFieldElement.Value : null; } + get => _HeaderFieldElement?.Value; set { - if (value == null) - HeaderFieldElement = null; - else - HeaderFieldElement = new Hl7.Fhir.Model.FhirString(value); + HeaderFieldElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("HeaderField"); } } @@ -3664,28 +3472,25 @@ public string HeaderField /// [FhirElement("minimumId", Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString MinimumIdElement + public Hl7.Fhir.Model.FhirString? MinimumIdElement { get { return _MinimumIdElement; } set { _MinimumIdElement = value; OnPropertyChanged("MinimumIdElement"); } } - private Hl7.Fhir.Model.FhirString _MinimumIdElement; + private Hl7.Fhir.Model.FhirString? _MinimumIdElement; /// /// Fixture Id of minimum content resource /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string MinimumId + public string? MinimumId { - get { return MinimumIdElement != null ? MinimumIdElement.Value : null; } + get => _MinimumIdElement?.Value; set { - if (value == null) - MinimumIdElement = null; - else - MinimumIdElement = new Hl7.Fhir.Model.FhirString(value); + MinimumIdElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("MinimumId"); } } @@ -3695,13 +3500,13 @@ public string MinimumId /// [FhirElement("navigationLinks", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement + public Hl7.Fhir.Model.FhirBoolean? NavigationLinksElement { get { return _NavigationLinksElement; } set { _NavigationLinksElement = value; OnPropertyChanged("NavigationLinksElement"); } } - private Hl7.Fhir.Model.FhirBoolean _NavigationLinksElement; + private Hl7.Fhir.Model.FhirBoolean? _NavigationLinksElement; /// /// Perform validation on navigation links? @@ -3710,13 +3515,10 @@ public Hl7.Fhir.Model.FhirBoolean NavigationLinksElement [IgnoreDataMember] public bool? NavigationLinks { - get { return NavigationLinksElement != null ? NavigationLinksElement.Value : null; } + get => _NavigationLinksElement?.Value; set { - if (value == null) - NavigationLinksElement = null; - else - NavigationLinksElement = new Hl7.Fhir.Model.FhirBoolean(value); + NavigationLinksElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("NavigationLinks"); } } @@ -3728,13 +3530,13 @@ public bool? NavigationLinks [DeclaredType(Type = typeof(Code))] [Binding("AssertionOperatorType")] [DataMember] - public Code OperatorElement + public Code? OperatorElement { get { return _OperatorElement; } set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } - private Code _OperatorElement; + private Code? _OperatorElement; /// /// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval | manualEval @@ -3743,13 +3545,10 @@ public Code OperatorElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator { - get { return OperatorElement != null ? OperatorElement.Value : null; } + get => _OperatorElement?.Value; set { - if (value == null) - OperatorElement = null; - else - OperatorElement = new Code(value); + OperatorElement = value is null ? null : new Code(value); OnPropertyChanged("Operator"); } } @@ -3759,28 +3558,25 @@ public Hl7.Fhir.Model.TestScript.AssertionOperatorType? Operator /// [FhirElement("path", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirString PathElement + public Hl7.Fhir.Model.FhirString? PathElement { get { return _PathElement; } set { _PathElement = value; OnPropertyChanged("PathElement"); } } - private Hl7.Fhir.Model.FhirString _PathElement; + private Hl7.Fhir.Model.FhirString? _PathElement; /// /// XPath or JSONPath expression /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Path + public string? Path { - get { return PathElement != null ? PathElement.Value : null; } + get => _PathElement?.Value; set { - if (value == null) - PathElement = null; - else - PathElement = new Hl7.Fhir.Model.FhirString(value); + PathElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Path"); } } @@ -3792,13 +3588,13 @@ public string Path [DeclaredType(Type = typeof(Code))] [Binding("TestScriptRequestMethodCode")] [DataMember] - public Code RequestMethodElement + public Code? RequestMethodElement { get { return _RequestMethodElement; } set { _RequestMethodElement = value; OnPropertyChanged("RequestMethodElement"); } } - private Code _RequestMethodElement; + private Code? _RequestMethodElement; /// /// delete | get | options | patch | post | put | head @@ -3807,13 +3603,10 @@ public Code RequestMethod [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod { - get { return RequestMethodElement != null ? RequestMethodElement.Value : null; } + get => _RequestMethodElement?.Value; set { - if (value == null) - RequestMethodElement = null; - else - RequestMethodElement = new Code(value); + RequestMethodElement = value is null ? null : new Code(value); OnPropertyChanged("RequestMethod"); } } @@ -3823,28 +3616,25 @@ public Hl7.Fhir.Model.TestScript.TestScriptRequestMethodCode? RequestMethod /// [FhirElement("requestURL", Order=190)] [DataMember] - public Hl7.Fhir.Model.FhirString RequestURLElement + public Hl7.Fhir.Model.FhirString? RequestURLElement { get { return _RequestURLElement; } set { _RequestURLElement = value; OnPropertyChanged("RequestURLElement"); } } - private Hl7.Fhir.Model.FhirString _RequestURLElement; + private Hl7.Fhir.Model.FhirString? _RequestURLElement; /// /// Request URL comparison value /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string RequestURL + public string? RequestURL { - get { return RequestURLElement != null ? RequestURLElement.Value : null; } + get => _RequestURLElement?.Value; set { - if (value == null) - RequestURLElement = null; - else - RequestURLElement = new Hl7.Fhir.Model.FhirString(value); + RequestURLElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("RequestURL"); } } @@ -3855,28 +3645,25 @@ public string RequestURL [FhirElement("resource", Order=200)] [Binding("FHIRConcreteType")] [DataMember] - public Hl7.Fhir.Model.FhirUri ResourceElement + public Hl7.Fhir.Model.FhirUri? ResourceElement { get { return _ResourceElement; } set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } - private Hl7.Fhir.Model.FhirUri _ResourceElement; + private Hl7.Fhir.Model.FhirUri? _ResourceElement; /// /// Resource type /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Resource + public string? Resource { - get { return ResourceElement != null ? ResourceElement.Value : null; } + get => _ResourceElement?.Value; set { - if (value == null) - ResourceElement = null; - else - ResourceElement = new Hl7.Fhir.Model.FhirUri(value); + ResourceElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Resource"); } } @@ -3888,13 +3675,13 @@ public string Resource [DeclaredType(Type = typeof(Code))] [Binding("AssertionResponseTypes")] [DataMember] - public Code ResponseElement + public Code? ResponseElement { get { return _ResponseElement; } set { _ResponseElement = value; OnPropertyChanged("ResponseElement"); } } - private Code _ResponseElement; + private Code? _ResponseElement; /// /// continue | switchingProtocols | okay | created | accepted | nonAuthoritativeInformation | noContent | resetContent | partialContent | multipleChoices | movedPermanently | found | seeOther | notModified | useProxy | temporaryRedirect | permanentRedirect | badRequest | unauthorized | paymentRequired | forbidden | notFound | methodNotAllowed | notAcceptable | proxyAuthenticationRequired | requestTimeout | conflict | gone | lengthRequired | preconditionFailed | contentTooLarge | uriTooLong | unsupportedMediaType | rangeNotSatisfiable | expectationFailed | misdirectedRequest | unprocessableContent | upgradeRequired | internalServerError | notImplemented | badGateway | serviceUnavailable | gatewayTimeout | httpVersionNotSupported @@ -3903,13 +3690,10 @@ public Code ResponseElement [IgnoreDataMember] public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response { - get { return ResponseElement != null ? ResponseElement.Value : null; } + get => _ResponseElement?.Value; set { - if (value == null) - ResponseElement = null; - else - ResponseElement = new Code(value); + ResponseElement = value is null ? null : new Code(value); OnPropertyChanged("Response"); } } @@ -3919,28 +3703,25 @@ public Hl7.Fhir.Model.TestScript.AssertionResponseTypes? Response /// [FhirElement("responseCode", Order=220)] [DataMember] - public Hl7.Fhir.Model.FhirString ResponseCodeElement + public Hl7.Fhir.Model.FhirString? ResponseCodeElement { get { return _ResponseCodeElement; } set { _ResponseCodeElement = value; OnPropertyChanged("ResponseCodeElement"); } } - private Hl7.Fhir.Model.FhirString _ResponseCodeElement; + private Hl7.Fhir.Model.FhirString? _ResponseCodeElement; /// /// HTTP response code to test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ResponseCode + public string? ResponseCode { - get { return ResponseCodeElement != null ? ResponseCodeElement.Value : null; } + get => _ResponseCodeElement?.Value; set { - if (value == null) - ResponseCodeElement = null; - else - ResponseCodeElement = new Hl7.Fhir.Model.FhirString(value); + ResponseCodeElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ResponseCode"); } } @@ -3950,28 +3731,25 @@ public string ResponseCode /// [FhirElement("sourceId", Order=230)] [DataMember] - public Hl7.Fhir.Model.Id SourceIdElement + public Hl7.Fhir.Model.Id? SourceIdElement { get { return _SourceIdElement; } set { _SourceIdElement = value; OnPropertyChanged("SourceIdElement"); } } - private Hl7.Fhir.Model.Id _SourceIdElement; + private Hl7.Fhir.Model.Id? _SourceIdElement; /// /// Fixture Id of source expression or headerField /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceId + public string? SourceId { - get { return SourceIdElement != null ? SourceIdElement.Value : null; } + get => _SourceIdElement?.Value; set { - if (value == null) - SourceIdElement = null; - else - SourceIdElement = new Hl7.Fhir.Model.Id(value); + SourceIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("SourceId"); } } @@ -3982,13 +3760,13 @@ public string SourceId [FhirElement("stopTestOnFail", Order=240)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean StopTestOnFailElement + public Hl7.Fhir.Model.FhirBoolean? StopTestOnFailElement { get { return _StopTestOnFailElement; } set { _StopTestOnFailElement = value; OnPropertyChanged("StopTestOnFailElement"); } } - private Hl7.Fhir.Model.FhirBoolean _StopTestOnFailElement; + private Hl7.Fhir.Model.FhirBoolean? _StopTestOnFailElement; /// /// If this assert fails, will the current test execution stop? @@ -3997,13 +3775,10 @@ public Hl7.Fhir.Model.FhirBoolean StopTestOnFailElement [IgnoreDataMember] public bool? StopTestOnFail { - get { return StopTestOnFailElement != null ? StopTestOnFailElement.Value : null; } + get => _StopTestOnFailElement?.Value; set { - if (value == null) - StopTestOnFailElement = null; - else - StopTestOnFailElement = new Hl7.Fhir.Model.FhirBoolean(value); + StopTestOnFailElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("StopTestOnFail"); } } @@ -4013,28 +3788,25 @@ public bool? StopTestOnFail /// [FhirElement("validateProfileId", Order=250)] [DataMember] - public Hl7.Fhir.Model.Id ValidateProfileIdElement + public Hl7.Fhir.Model.Id? ValidateProfileIdElement { get { return _ValidateProfileIdElement; } set { _ValidateProfileIdElement = value; OnPropertyChanged("ValidateProfileIdElement"); } } - private Hl7.Fhir.Model.Id _ValidateProfileIdElement; + private Hl7.Fhir.Model.Id? _ValidateProfileIdElement; /// /// Profile Id of validation profile reference /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidateProfileId + public string? ValidateProfileId { - get { return ValidateProfileIdElement != null ? ValidateProfileIdElement.Value : null; } + get => _ValidateProfileIdElement?.Value; set { - if (value == null) - ValidateProfileIdElement = null; - else - ValidateProfileIdElement = new Hl7.Fhir.Model.Id(value); + ValidateProfileIdElement = value is null ? null : new Hl7.Fhir.Model.Id(value); OnPropertyChanged("ValidateProfileId"); } } @@ -4044,28 +3816,25 @@ public string ValidateProfileId /// [FhirElement("value", Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirString ValueElement + public Hl7.Fhir.Model.FhirString? ValueElement { get { return _ValueElement; } set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } - private Hl7.Fhir.Model.FhirString _ValueElement; + private Hl7.Fhir.Model.FhirString? _ValueElement; /// /// The value to compare to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Value + public string? Value { - get { return ValueElement != null ? ValueElement.Value : null; } + get => _ValueElement?.Value; set { - if (value == null) - ValueElement = null; - else - ValueElement = new Hl7.Fhir.Model.FhirString(value); + ValueElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Value"); } } @@ -4076,13 +3845,13 @@ public string Value [FhirElement("warningOnly", Order=270)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement + public Hl7.Fhir.Model.FhirBoolean? WarningOnlyElement { get { return _WarningOnlyElement; } set { _WarningOnlyElement = value; OnPropertyChanged("WarningOnlyElement"); } } - private Hl7.Fhir.Model.FhirBoolean _WarningOnlyElement; + private Hl7.Fhir.Model.FhirBoolean? _WarningOnlyElement; /// /// Will this assert produce a warning only on error? @@ -4091,13 +3860,10 @@ public Hl7.Fhir.Model.FhirBoolean WarningOnlyElement [IgnoreDataMember] public bool? WarningOnly { - get { return WarningOnlyElement != null ? WarningOnlyElement.Value : null; } + get => _WarningOnlyElement?.Value; set { - if (value == null) - WarningOnlyElement = null; - else - WarningOnlyElement = new Hl7.Fhir.Model.FhirBoolean(value); + WarningOnlyElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("WarningOnly"); } } @@ -4110,47 +3876,43 @@ public bool? WarningOnly [DataMember] public List Requirement { - get { if(_Requirement==null) _Requirement = new List(); return _Requirement; } + get => _Requirement ?? new List(); set { _Requirement = value; OnPropertyChanged("Requirement"); } } - private List _Requirement; + private List? _Requirement; protected internal override void CopyToInternal(Base other) { - var dest = other as AssertComponent; - - if (dest == null) - { + if(other is not AssertComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(LabelElement != null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)LabelElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(DirectionElement != null) dest.DirectionElement = (Code)DirectionElement.DeepCopyInternal(); - if(CompareToSourceIdElement != null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)CompareToSourceIdElement.DeepCopyInternal(); - if(CompareToSourceExpressionElement != null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)CompareToSourceExpressionElement.DeepCopyInternal(); - if(CompareToSourcePathElement != null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)CompareToSourcePathElement.DeepCopyInternal(); - if(ContentTypeElement != null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)ContentTypeElement.DeepCopyInternal(); - if(DefaultManualCompletionElement != null) dest.DefaultManualCompletionElement = (Code)DefaultManualCompletionElement.DeepCopyInternal(); - if(ExpressionElement != null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)ExpressionElement.DeepCopyInternal(); - if(HeaderFieldElement != null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)HeaderFieldElement.DeepCopyInternal(); - if(MinimumIdElement != null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)MinimumIdElement.DeepCopyInternal(); - if(NavigationLinksElement != null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)NavigationLinksElement.DeepCopyInternal(); - if(OperatorElement != null) dest.OperatorElement = (Code)OperatorElement.DeepCopyInternal(); - if(PathElement != null) dest.PathElement = (Hl7.Fhir.Model.FhirString)PathElement.DeepCopyInternal(); - if(RequestMethodElement != null) dest.RequestMethodElement = (Code)RequestMethodElement.DeepCopyInternal(); - if(RequestURLElement != null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)RequestURLElement.DeepCopyInternal(); - if(ResourceElement != null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)ResourceElement.DeepCopyInternal(); - if(ResponseElement != null) dest.ResponseElement = (Code)ResponseElement.DeepCopyInternal(); - if(ResponseCodeElement != null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)ResponseCodeElement.DeepCopyInternal(); - if(SourceIdElement != null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)SourceIdElement.DeepCopyInternal(); - if(StopTestOnFailElement != null) dest.StopTestOnFailElement = (Hl7.Fhir.Model.FhirBoolean)StopTestOnFailElement.DeepCopyInternal(); - if(ValidateProfileIdElement != null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)ValidateProfileIdElement.DeepCopyInternal(); - if(ValueElement != null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)ValueElement.DeepCopyInternal(); - if(WarningOnlyElement != null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)WarningOnlyElement.DeepCopyInternal(); - if(Requirement.Any()) dest.Requirement = new List(Requirement.DeepCopyInternal()); + if(_LabelElement is not null) dest.LabelElement = (Hl7.Fhir.Model.FhirString)_LabelElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_DirectionElement is not null) dest.DirectionElement = (Code)_DirectionElement.DeepCopyInternal(); + if(_CompareToSourceIdElement is not null) dest.CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceIdElement.DeepCopyInternal(); + if(_CompareToSourceExpressionElement is not null) dest.CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)_CompareToSourceExpressionElement.DeepCopyInternal(); + if(_CompareToSourcePathElement is not null) dest.CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)_CompareToSourcePathElement.DeepCopyInternal(); + if(_ContentTypeElement is not null) dest.ContentTypeElement = (Hl7.Fhir.Model.Code)_ContentTypeElement.DeepCopyInternal(); + if(_DefaultManualCompletionElement is not null) dest.DefaultManualCompletionElement = (Code)_DefaultManualCompletionElement.DeepCopyInternal(); + if(_ExpressionElement is not null) dest.ExpressionElement = (Hl7.Fhir.Model.FhirString)_ExpressionElement.DeepCopyInternal(); + if(_HeaderFieldElement is not null) dest.HeaderFieldElement = (Hl7.Fhir.Model.FhirString)_HeaderFieldElement.DeepCopyInternal(); + if(_MinimumIdElement is not null) dest.MinimumIdElement = (Hl7.Fhir.Model.FhirString)_MinimumIdElement.DeepCopyInternal(); + if(_NavigationLinksElement is not null) dest.NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)_NavigationLinksElement.DeepCopyInternal(); + if(_OperatorElement is not null) dest.OperatorElement = (Code)_OperatorElement.DeepCopyInternal(); + if(_PathElement is not null) dest.PathElement = (Hl7.Fhir.Model.FhirString)_PathElement.DeepCopyInternal(); + if(_RequestMethodElement is not null) dest.RequestMethodElement = (Code)_RequestMethodElement.DeepCopyInternal(); + if(_RequestURLElement is not null) dest.RequestURLElement = (Hl7.Fhir.Model.FhirString)_RequestURLElement.DeepCopyInternal(); + if(_ResourceElement is not null) dest.ResourceElement = (Hl7.Fhir.Model.FhirUri)_ResourceElement.DeepCopyInternal(); + if(_ResponseElement is not null) dest.ResponseElement = (Code)_ResponseElement.DeepCopyInternal(); + if(_ResponseCodeElement is not null) dest.ResponseCodeElement = (Hl7.Fhir.Model.FhirString)_ResponseCodeElement.DeepCopyInternal(); + if(_SourceIdElement is not null) dest.SourceIdElement = (Hl7.Fhir.Model.Id)_SourceIdElement.DeepCopyInternal(); + if(_StopTestOnFailElement is not null) dest.StopTestOnFailElement = (Hl7.Fhir.Model.FhirBoolean)_StopTestOnFailElement.DeepCopyInternal(); + if(_ValidateProfileIdElement is not null) dest.ValidateProfileIdElement = (Hl7.Fhir.Model.Id)_ValidateProfileIdElement.DeepCopyInternal(); + if(_ValueElement is not null) dest.ValueElement = (Hl7.Fhir.Model.FhirString)_ValueElement.DeepCopyInternal(); + if(_WarningOnlyElement is not null) dest.WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)_WarningOnlyElement.DeepCopyInternal(); + if(_Requirement is not null) dest.Requirement = new List(_Requirement.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4162,202 +3924,202 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AssertComponent; - if(otherT == null) return false; + if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(LabelElement, otherT.LabelElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(DirectionElement, otherT.DirectionElement)) return false; - if(!comparer.Equals(CompareToSourceIdElement, otherT.CompareToSourceIdElement)) return false; - if(!comparer.Equals(CompareToSourceExpressionElement, otherT.CompareToSourceExpressionElement)) return false; - if(!comparer.Equals(CompareToSourcePathElement, otherT.CompareToSourcePathElement)) return false; - if(!comparer.Equals(ContentTypeElement, otherT.ContentTypeElement)) return false; - if(!comparer.Equals(DefaultManualCompletionElement, otherT.DefaultManualCompletionElement)) return false; - if(!comparer.Equals(ExpressionElement, otherT.ExpressionElement)) return false; - if(!comparer.Equals(HeaderFieldElement, otherT.HeaderFieldElement)) return false; - if(!comparer.Equals(MinimumIdElement, otherT.MinimumIdElement)) return false; - if(!comparer.Equals(NavigationLinksElement, otherT.NavigationLinksElement)) return false; - if(!comparer.Equals(OperatorElement, otherT.OperatorElement)) return false; - if(!comparer.Equals(PathElement, otherT.PathElement)) return false; - if(!comparer.Equals(RequestMethodElement, otherT.RequestMethodElement)) return false; - if(!comparer.Equals(RequestURLElement, otherT.RequestURLElement)) return false; - if(!comparer.Equals(ResourceElement, otherT.ResourceElement)) return false; - if(!comparer.Equals(ResponseElement, otherT.ResponseElement)) return false; - if(!comparer.Equals(ResponseCodeElement, otherT.ResponseCodeElement)) return false; - if(!comparer.Equals(SourceIdElement, otherT.SourceIdElement)) return false; - if(!comparer.Equals(StopTestOnFailElement, otherT.StopTestOnFailElement)) return false; - if(!comparer.Equals(ValidateProfileIdElement, otherT.ValidateProfileIdElement)) return false; - if(!comparer.Equals(ValueElement, otherT.ValueElement)) return false; - if(!comparer.Equals(WarningOnlyElement, otherT.WarningOnlyElement)) return false; - if(!comparer.ListEquals(Requirement, otherT.Requirement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; + if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; + if(!comparer.Equals(_CompareToSourceExpressionElement, otherT._CompareToSourceExpressionElement)) return false; + if(!comparer.Equals(_CompareToSourcePathElement, otherT._CompareToSourcePathElement)) return false; + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + if(!comparer.Equals(_DefaultManualCompletionElement, otherT._DefaultManualCompletionElement)) return false; + if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; + if(!comparer.Equals(_HeaderFieldElement, otherT._HeaderFieldElement)) return false; + if(!comparer.Equals(_MinimumIdElement, otherT._MinimumIdElement)) return false; + if(!comparer.Equals(_NavigationLinksElement, otherT._NavigationLinksElement)) return false; + if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + if(!comparer.Equals(_RequestMethodElement, otherT._RequestMethodElement)) return false; + if(!comparer.Equals(_RequestURLElement, otherT._RequestURLElement)) return false; + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + if(!comparer.Equals(_ResponseElement, otherT._ResponseElement)) return false; + if(!comparer.Equals(_ResponseCodeElement, otherT._ResponseCodeElement)) return false; + if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; + if(!comparer.Equals(_StopTestOnFailElement, otherT._StopTestOnFailElement)) return false; + if(!comparer.Equals(_ValidateProfileIdElement, otherT._ValidateProfileIdElement)) return false; + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; + if(!comparer.ListEquals(_Requirement, otherT._Requirement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "label": - value = LabelElement; - return LabelElement is not null; + value = _LabelElement; + return _LabelElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "direction": - value = DirectionElement; - return DirectionElement is not null; + value = _DirectionElement; + return _DirectionElement is not null; case "compareToSourceId": - value = CompareToSourceIdElement; - return CompareToSourceIdElement is not null; + value = _CompareToSourceIdElement; + return _CompareToSourceIdElement is not null; case "compareToSourceExpression": - value = CompareToSourceExpressionElement; - return CompareToSourceExpressionElement is not null; + value = _CompareToSourceExpressionElement; + return _CompareToSourceExpressionElement is not null; case "compareToSourcePath": - value = CompareToSourcePathElement; - return CompareToSourcePathElement is not null; + value = _CompareToSourcePathElement; + return _CompareToSourcePathElement is not null; case "contentType": - value = ContentTypeElement; - return ContentTypeElement is not null; + value = _ContentTypeElement; + return _ContentTypeElement is not null; case "defaultManualCompletion": - value = DefaultManualCompletionElement; - return DefaultManualCompletionElement is not null; + value = _DefaultManualCompletionElement; + return _DefaultManualCompletionElement is not null; case "expression": - value = ExpressionElement; - return ExpressionElement is not null; + value = _ExpressionElement; + return _ExpressionElement is not null; case "headerField": - value = HeaderFieldElement; - return HeaderFieldElement is not null; + value = _HeaderFieldElement; + return _HeaderFieldElement is not null; case "minimumId": - value = MinimumIdElement; - return MinimumIdElement is not null; + value = _MinimumIdElement; + return _MinimumIdElement is not null; case "navigationLinks": - value = NavigationLinksElement; - return NavigationLinksElement is not null; + value = _NavigationLinksElement; + return _NavigationLinksElement is not null; case "operator": - value = OperatorElement; - return OperatorElement is not null; + value = _OperatorElement; + return _OperatorElement is not null; case "path": - value = PathElement; - return PathElement is not null; + value = _PathElement; + return _PathElement is not null; case "requestMethod": - value = RequestMethodElement; - return RequestMethodElement is not null; + value = _RequestMethodElement; + return _RequestMethodElement is not null; case "requestURL": - value = RequestURLElement; - return RequestURLElement is not null; + value = _RequestURLElement; + return _RequestURLElement is not null; case "resource": - value = ResourceElement; - return ResourceElement is not null; + value = _ResourceElement; + return _ResourceElement is not null; case "response": - value = ResponseElement; - return ResponseElement is not null; + value = _ResponseElement; + return _ResponseElement is not null; case "responseCode": - value = ResponseCodeElement; - return ResponseCodeElement is not null; + value = _ResponseCodeElement; + return _ResponseCodeElement is not null; case "sourceId": - value = SourceIdElement; - return SourceIdElement is not null; + value = _SourceIdElement; + return _SourceIdElement is not null; case "stopTestOnFail": - value = StopTestOnFailElement; - return StopTestOnFailElement is not null; + value = _StopTestOnFailElement; + return _StopTestOnFailElement is not null; case "validateProfileId": - value = ValidateProfileIdElement; - return ValidateProfileIdElement is not null; + value = _ValidateProfileIdElement; + return _ValidateProfileIdElement is not null; case "value": - value = ValueElement; - return ValueElement is not null; + value = _ValueElement; + return _ValueElement is not null; case "warningOnly": - value = WarningOnlyElement; - return WarningOnlyElement is not null; + value = _WarningOnlyElement; + return _WarningOnlyElement is not null; case "requirement": - value = Requirement; - return Requirement?.Any() == true; + value = _Requirement; + return _Requirement?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "label": - LabelElement = (Hl7.Fhir.Model.FhirString)value; + LabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "direction": - DirectionElement = (Code)value; + DirectionElement = (Code?)value; return this; case "compareToSourceId": - CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourceExpression": - CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourceExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "compareToSourcePath": - CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString)value; + CompareToSourcePathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contentType": - ContentTypeElement = (Hl7.Fhir.Model.Code)value; + ContentTypeElement = (Hl7.Fhir.Model.Code?)value; return this; case "defaultManualCompletion": - DefaultManualCompletionElement = (Code)value; + DefaultManualCompletionElement = (Code?)value; return this; case "expression": - ExpressionElement = (Hl7.Fhir.Model.FhirString)value; + ExpressionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "headerField": - HeaderFieldElement = (Hl7.Fhir.Model.FhirString)value; + HeaderFieldElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "minimumId": - MinimumIdElement = (Hl7.Fhir.Model.FhirString)value; + MinimumIdElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "navigationLinks": - NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean)value; + NavigationLinksElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "operator": - OperatorElement = (Code)value; + OperatorElement = (Code?)value; return this; case "path": - PathElement = (Hl7.Fhir.Model.FhirString)value; + PathElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "requestMethod": - RequestMethodElement = (Code)value; + RequestMethodElement = (Code?)value; return this; case "requestURL": - RequestURLElement = (Hl7.Fhir.Model.FhirString)value; + RequestURLElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "resource": - ResourceElement = (Hl7.Fhir.Model.FhirUri)value; + ResourceElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "response": - ResponseElement = (Code)value; + ResponseElement = (Code?)value; return this; case "responseCode": - ResponseCodeElement = (Hl7.Fhir.Model.FhirString)value; + ResponseCodeElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "sourceId": - SourceIdElement = (Hl7.Fhir.Model.Id)value; + SourceIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "stopTestOnFail": - StopTestOnFailElement = (Hl7.Fhir.Model.FhirBoolean)value; + StopTestOnFailElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "validateProfileId": - ValidateProfileIdElement = (Hl7.Fhir.Model.Id)value; + ValidateProfileIdElement = (Hl7.Fhir.Model.Id?)value; return this; case "value": - ValueElement = (Hl7.Fhir.Model.FhirString)value; + ValueElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "warningOnly": - WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean)value; + WarningOnlyElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "requirement": - Requirement = (List)value; + Requirement = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4368,31 +4130,31 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (LabelElement is not null) yield return new KeyValuePair("label",LabelElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (DirectionElement is not null) yield return new KeyValuePair("direction",DirectionElement); - if (CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",CompareToSourceIdElement); - if (CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",CompareToSourceExpressionElement); - if (CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",CompareToSourcePathElement); - if (ContentTypeElement is not null) yield return new KeyValuePair("contentType",ContentTypeElement); - if (DefaultManualCompletionElement is not null) yield return new KeyValuePair("defaultManualCompletion",DefaultManualCompletionElement); - if (ExpressionElement is not null) yield return new KeyValuePair("expression",ExpressionElement); - if (HeaderFieldElement is not null) yield return new KeyValuePair("headerField",HeaderFieldElement); - if (MinimumIdElement is not null) yield return new KeyValuePair("minimumId",MinimumIdElement); - if (NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",NavigationLinksElement); - if (OperatorElement is not null) yield return new KeyValuePair("operator",OperatorElement); - if (PathElement is not null) yield return new KeyValuePair("path",PathElement); - if (RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",RequestMethodElement); - if (RequestURLElement is not null) yield return new KeyValuePair("requestURL",RequestURLElement); - if (ResourceElement is not null) yield return new KeyValuePair("resource",ResourceElement); - if (ResponseElement is not null) yield return new KeyValuePair("response",ResponseElement); - if (ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",ResponseCodeElement); - if (SourceIdElement is not null) yield return new KeyValuePair("sourceId",SourceIdElement); - if (StopTestOnFailElement is not null) yield return new KeyValuePair("stopTestOnFail",StopTestOnFailElement); - if (ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",ValidateProfileIdElement); - if (ValueElement is not null) yield return new KeyValuePair("value",ValueElement); - if (WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",WarningOnlyElement); - if (Requirement?.Any() == true) yield return new KeyValuePair("requirement",Requirement); + if (_LabelElement is not null) yield return new KeyValuePair("label",_LabelElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_DirectionElement is not null) yield return new KeyValuePair("direction",_DirectionElement); + if (_CompareToSourceIdElement is not null) yield return new KeyValuePair("compareToSourceId",_CompareToSourceIdElement); + if (_CompareToSourceExpressionElement is not null) yield return new KeyValuePair("compareToSourceExpression",_CompareToSourceExpressionElement); + if (_CompareToSourcePathElement is not null) yield return new KeyValuePair("compareToSourcePath",_CompareToSourcePathElement); + if (_ContentTypeElement is not null) yield return new KeyValuePair("contentType",_ContentTypeElement); + if (_DefaultManualCompletionElement is not null) yield return new KeyValuePair("defaultManualCompletion",_DefaultManualCompletionElement); + if (_ExpressionElement is not null) yield return new KeyValuePair("expression",_ExpressionElement); + if (_HeaderFieldElement is not null) yield return new KeyValuePair("headerField",_HeaderFieldElement); + if (_MinimumIdElement is not null) yield return new KeyValuePair("minimumId",_MinimumIdElement); + if (_NavigationLinksElement is not null) yield return new KeyValuePair("navigationLinks",_NavigationLinksElement); + if (_OperatorElement is not null) yield return new KeyValuePair("operator",_OperatorElement); + if (_PathElement is not null) yield return new KeyValuePair("path",_PathElement); + if (_RequestMethodElement is not null) yield return new KeyValuePair("requestMethod",_RequestMethodElement); + if (_RequestURLElement is not null) yield return new KeyValuePair("requestURL",_RequestURLElement); + if (_ResourceElement is not null) yield return new KeyValuePair("resource",_ResourceElement); + if (_ResponseElement is not null) yield return new KeyValuePair("response",_ResponseElement); + if (_ResponseCodeElement is not null) yield return new KeyValuePair("responseCode",_ResponseCodeElement); + if (_SourceIdElement is not null) yield return new KeyValuePair("sourceId",_SourceIdElement); + if (_StopTestOnFailElement is not null) yield return new KeyValuePair("stopTestOnFail",_StopTestOnFailElement); + if (_ValidateProfileIdElement is not null) yield return new KeyValuePair("validateProfileId",_ValidateProfileIdElement); + if (_ValueElement is not null) yield return new KeyValuePair("value",_ValueElement); + if (_WarningOnlyElement is not null) yield return new KeyValuePair("warningOnly",_WarningOnlyElement); + if (_Requirement?.Any() == true) yield return new KeyValuePair("requirement",_Requirement); } } @@ -4421,25 +4183,21 @@ public partial class RequirementComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.Canonical))] [DataMember] - public Hl7.Fhir.Model.DataType Link + public Hl7.Fhir.Model.DataType? Link { get { return _Link; } set { _Link = value; OnPropertyChanged("Link"); } } - private Hl7.Fhir.Model.DataType _Link; + private Hl7.Fhir.Model.DataType? _Link; protected internal override void CopyToInternal(Base other) { - var dest = other as RequirementComponent; - - if (dest == null) - { + if(other is not RequirementComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Link != null) dest.Link = (Hl7.Fhir.Model.DataType)Link.DeepCopyInternal(); + if(_Link is not null) dest.Link = (Hl7.Fhir.Model.DataType)_Link.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4451,34 +4209,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RequirementComponent; - if(otherT == null) return false; + if(other is not RequirementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Link, otherT.Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Link, otherT._Link)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "link": - value = Link; - return Link is not null; + value = _Link; + return _Link is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "link": - Link = (Hl7.Fhir.Model.DataType)value; + Link = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -4489,7 +4247,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Link is not null) yield return new KeyValuePair("link",Link); + if (_Link is not null) yield return new KeyValuePair("link",_Link); } } @@ -4512,28 +4270,25 @@ public partial class TestComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("name", Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Tracking/logging name of this test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -4543,28 +4298,25 @@ public string Name /// [FhirElement("description", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Tracking/reporting short description of the test /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -4577,25 +4329,21 @@ public string Description [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TestComponent; - - if (dest == null) - { + if(other is not TestComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4607,48 +4355,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestComponent; - if(otherT == null) return false; + if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4659,9 +4407,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -4688,39 +4436,35 @@ public partial class TestActionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("operation", Order=40)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; /// /// The setup assertion to perform. /// [FhirElement("assert", Order=50)] [DataMember] - public Hl7.Fhir.Model.TestScript.AssertComponent Assert + public Hl7.Fhir.Model.TestScript.AssertComponent? Assert { get { return _Assert; } set { _Assert = value; OnPropertyChanged("Assert"); } } - private Hl7.Fhir.Model.TestScript.AssertComponent _Assert; + private Hl7.Fhir.Model.TestScript.AssertComponent? _Assert; protected internal override void CopyToInternal(Base other) { - var dest = other as TestActionComponent; - - if (dest == null) - { + if(other is not TestActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); - if(Assert != null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)Assert.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); + if(_Assert is not null) dest.Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)_Assert.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4732,41 +4476,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestActionComponent; - if(otherT == null) return false; + if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; - if(!comparer.Equals(Assert, otherT.Assert)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + if(!comparer.Equals(_Assert, otherT._Assert)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; case "assert": - value = Assert; - return Assert is not null; + value = _Assert; + return _Assert is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; case "assert": - Assert = (Hl7.Fhir.Model.TestScript.AssertComponent)value; + Assert = (Hl7.Fhir.Model.TestScript.AssertComponent?)value; return this; default: return base.SetValue(key, value); @@ -4777,8 +4521,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); - if (Assert is not null) yield return new KeyValuePair("assert",Assert); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); + if (_Assert is not null) yield return new KeyValuePair("assert",_Assert); } } @@ -4807,23 +4551,19 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get { if(_Action==null) _Action = new List(); return _Action; } + get => _Action ?? new List(); set { _Action = value; OnPropertyChanged("Action"); } } - private List _Action; + private List? _Action; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownComponent; - - if (dest == null) - { + if(other is not TeardownComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Action.Any()) dest.Action = new List(Action.DeepCopyInternal()); + if(_Action is not null) dest.Action = new List(_Action.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -4835,34 +4575,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownComponent; - if(otherT == null) return false; + if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Action, otherT.Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "action": - value = Action; - return Action?.Any() == true; + value = _Action; + return _Action?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "action": - Action = (List)value; + Action = (List?)value!; return this; default: return base.SetValue(key, value); @@ -4873,7 +4613,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Action?.Any() == true) yield return new KeyValuePair("action",Action); + if (_Action?.Any() == true) yield return new KeyValuePair("action",_Action); } } @@ -4901,25 +4641,21 @@ public partial class TeardownActionComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("operation", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.TestScript.OperationComponent Operation + public Hl7.Fhir.Model.TestScript.OperationComponent? Operation { get { return _Operation; } set { _Operation = value; OnPropertyChanged("Operation"); } } - private Hl7.Fhir.Model.TestScript.OperationComponent _Operation; + private Hl7.Fhir.Model.TestScript.OperationComponent? _Operation; protected internal override void CopyToInternal(Base other) { - var dest = other as TeardownActionComponent; - - if (dest == null) - { + if(other is not TeardownActionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Operation != null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)Operation.DeepCopyInternal(); + if(_Operation is not null) dest.Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)_Operation.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -4931,34 +4667,34 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TeardownActionComponent; - if(otherT == null) return false; + if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Operation, otherT.Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "operation": - value = Operation; - return Operation is not null; + value = _Operation; + return _Operation is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "operation": - Operation = (Hl7.Fhir.Model.TestScript.OperationComponent)value; + Operation = (Hl7.Fhir.Model.TestScript.OperationComponent?)value; return this; default: return base.SetValue(key, value); @@ -4969,7 +4705,7 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Operation is not null) yield return new KeyValuePair("operation",Operation); + if (_Operation is not null) yield return new KeyValuePair("operation",_Operation); } } @@ -4979,28 +4715,25 @@ public override IEnumerable> EnumerateElements() /// [FhirElement("url", InSummary=true, Order=90, FiveWs="FiveWs.identifier")] [DataMember] - public Hl7.Fhir.Model.FhirUri UrlElement + public Hl7.Fhir.Model.FhirUri? UrlElement { get { return _UrlElement; } set { _UrlElement = value; OnPropertyChanged("UrlElement"); } } - private Hl7.Fhir.Model.FhirUri _UrlElement; + private Hl7.Fhir.Model.FhirUri? _UrlElement; /// /// Canonical identifier for this test script, represented as a URI (globally unique) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Url + public string? Url { - get { return UrlElement != null ? UrlElement.Value : null; } + get => _UrlElement?.Value; set { - if (value == null) - UrlElement = null; - else - UrlElement = new Hl7.Fhir.Model.FhirUri(value); + UrlElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("Url"); } } @@ -5013,39 +4746,36 @@ public string Url [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Business version of the test script. /// [FhirElement("version", InSummary=true, Order=110, FiveWs="FiveWs.version")] [DataMember] - public Hl7.Fhir.Model.FhirString VersionElement + public Hl7.Fhir.Model.FhirString? VersionElement { get { return _VersionElement; } set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } - private Hl7.Fhir.Model.FhirString _VersionElement; + private Hl7.Fhir.Model.FhirString? _VersionElement; /// /// Business version of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Version + public string? Version { - get { return VersionElement != null ? VersionElement.Value : null; } + get => _VersionElement?.Value; set { - if (value == null) - VersionElement = null; - else - VersionElement = new Hl7.Fhir.Model.FhirString(value); + VersionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Version"); } } @@ -5057,13 +4787,13 @@ public string Version [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Coding))] [DataMember] - public Hl7.Fhir.Model.DataType VersionAlgorithm + public Hl7.Fhir.Model.DataType? VersionAlgorithm { get { return _VersionAlgorithm; } set { _VersionAlgorithm = value; OnPropertyChanged("VersionAlgorithm"); } } - private Hl7.Fhir.Model.DataType _VersionAlgorithm; + private Hl7.Fhir.Model.DataType? _VersionAlgorithm; /// /// Name for this test script (computer friendly). @@ -5071,28 +4801,25 @@ public Hl7.Fhir.Model.DataType VersionAlgorithm [FhirElement("name", InSummary=true, Order=130)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name for this test script (computer friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -5102,28 +4829,25 @@ public string Name /// [FhirElement("title", InSummary=true, Order=140)] [DataMember] - public Hl7.Fhir.Model.FhirString TitleElement + public Hl7.Fhir.Model.FhirString? TitleElement { get { return _TitleElement; } set { _TitleElement = value; OnPropertyChanged("TitleElement"); } } - private Hl7.Fhir.Model.FhirString _TitleElement; + private Hl7.Fhir.Model.FhirString? _TitleElement; /// /// Name for this test script (human friendly) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Title + public string? Title { - get { return TitleElement != null ? TitleElement.Value : null; } + get => _TitleElement?.Value; set { - if (value == null) - TitleElement = null; - else - TitleElement = new Hl7.Fhir.Model.FhirString(value); + TitleElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Title"); } } @@ -5136,13 +4860,13 @@ public string Title [Binding("PublicationStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// draft | active | retired | unknown @@ -5151,13 +4875,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.PublicationStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -5167,13 +4888,13 @@ public Hl7.Fhir.Model.PublicationStatus? Status /// [FhirElement("experimental", InSummary=true, Order=160, FiveWs="FiveWs.class")] [DataMember] - public Hl7.Fhir.Model.FhirBoolean ExperimentalElement + public Hl7.Fhir.Model.FhirBoolean? ExperimentalElement { get { return _ExperimentalElement; } set { _ExperimentalElement = value; OnPropertyChanged("ExperimentalElement"); } } - private Hl7.Fhir.Model.FhirBoolean _ExperimentalElement; + private Hl7.Fhir.Model.FhirBoolean? _ExperimentalElement; /// /// For testing purposes, not real usage @@ -5182,13 +4903,10 @@ public Hl7.Fhir.Model.FhirBoolean ExperimentalElement [IgnoreDataMember] public bool? Experimental { - get { return ExperimentalElement != null ? ExperimentalElement.Value : null; } + get => _ExperimentalElement?.Value; set { - if (value == null) - ExperimentalElement = null; - else - ExperimentalElement = new Hl7.Fhir.Model.FhirBoolean(value); + ExperimentalElement = value is null ? null : new Hl7.Fhir.Model.FhirBoolean(value); OnPropertyChanged("Experimental"); } } @@ -5198,28 +4916,25 @@ public bool? Experimental /// [FhirElement("date", InSummary=true, Order=170, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateElement + public Hl7.Fhir.Model.FhirDateTime? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateElement; + private Hl7.Fhir.Model.FhirDateTime? _DateElement; /// /// Date last changed /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Date"); } } @@ -5229,28 +4944,25 @@ public string Date /// [FhirElement("publisher", InSummary=true, Order=180, FiveWs="FiveWs.witness")] [DataMember] - public Hl7.Fhir.Model.FhirString PublisherElement + public Hl7.Fhir.Model.FhirString? PublisherElement { get { return _PublisherElement; } set { _PublisherElement = value; OnPropertyChanged("PublisherElement"); } } - private Hl7.Fhir.Model.FhirString _PublisherElement; + private Hl7.Fhir.Model.FhirString? _PublisherElement; /// /// Name of the publisher/steward (organization or individual) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Publisher + public string? Publisher { - get { return PublisherElement != null ? PublisherElement.Value : null; } + get => _PublisherElement?.Value; set { - if (value == null) - PublisherElement = null; - else - PublisherElement = new Hl7.Fhir.Model.FhirString(value); + PublisherElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Publisher"); } } @@ -5263,39 +4975,36 @@ public string Publisher [DataMember] public List Contact { - get { if(_Contact==null) _Contact = new List(); return _Contact; } + get => _Contact ?? new List(); set { _Contact = value; OnPropertyChanged("Contact"); } } - private List _Contact; + private List? _Contact; /// /// Natural language description of the test script. /// [FhirElement("description", Order=200)] [DataMember] - public Hl7.Fhir.Model.Markdown DescriptionElement + public Hl7.Fhir.Model.Markdown? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.Markdown _DescriptionElement; + private Hl7.Fhir.Model.Markdown? _DescriptionElement; /// /// Natural language description of the test script /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.Markdown(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Description"); } } @@ -5308,11 +5017,11 @@ public string Description [DataMember] public List UseContext { - get { if(_UseContext==null) _UseContext = new List(); return _UseContext; } + get => _UseContext ?? new List(); set { _UseContext = value; OnPropertyChanged("UseContext"); } } - private List _UseContext; + private List? _UseContext; /// /// Intended jurisdiction for test script (if applicable). @@ -5323,39 +5032,36 @@ public List UseContext [DataMember] public List Jurisdiction { - get { if(_Jurisdiction==null) _Jurisdiction = new List(); return _Jurisdiction; } + get => _Jurisdiction ?? new List(); set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } - private List _Jurisdiction; + private List? _Jurisdiction; /// /// Why this test script is defined. /// [FhirElement("purpose", Order=230, FiveWs="FiveWs.why[x]")] [DataMember] - public Hl7.Fhir.Model.Markdown PurposeElement + public Hl7.Fhir.Model.Markdown? PurposeElement { get { return _PurposeElement; } set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } - private Hl7.Fhir.Model.Markdown _PurposeElement; + private Hl7.Fhir.Model.Markdown? _PurposeElement; /// /// Why this test script is defined /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Purpose + public string? Purpose { - get { return PurposeElement != null ? PurposeElement.Value : null; } + get => _PurposeElement?.Value; set { - if (value == null) - PurposeElement = null; - else - PurposeElement = new Hl7.Fhir.Model.Markdown(value); + PurposeElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Purpose"); } } @@ -5365,28 +5071,25 @@ public string Purpose /// [FhirElement("copyright", Order=240)] [DataMember] - public Hl7.Fhir.Model.Markdown CopyrightElement + public Hl7.Fhir.Model.Markdown? CopyrightElement { get { return _CopyrightElement; } set { _CopyrightElement = value; OnPropertyChanged("CopyrightElement"); } } - private Hl7.Fhir.Model.Markdown _CopyrightElement; + private Hl7.Fhir.Model.Markdown? _CopyrightElement; /// /// Use and/or publishing restrictions /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Copyright + public string? Copyright { - get { return CopyrightElement != null ? CopyrightElement.Value : null; } + get => _CopyrightElement?.Value; set { - if (value == null) - CopyrightElement = null; - else - CopyrightElement = new Hl7.Fhir.Model.Markdown(value); + CopyrightElement = value is null ? null : new Hl7.Fhir.Model.Markdown(value); OnPropertyChanged("Copyright"); } } @@ -5396,28 +5099,25 @@ public string Copyright /// [FhirElement("copyrightLabel", Order=250)] [DataMember] - public Hl7.Fhir.Model.FhirString CopyrightLabelElement + public Hl7.Fhir.Model.FhirString? CopyrightLabelElement { get { return _CopyrightLabelElement; } set { _CopyrightLabelElement = value; OnPropertyChanged("CopyrightLabelElement"); } } - private Hl7.Fhir.Model.FhirString _CopyrightLabelElement; + private Hl7.Fhir.Model.FhirString? _CopyrightLabelElement; /// /// Copyright holder and year(s) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CopyrightLabel + public string? CopyrightLabel { - get { return CopyrightLabelElement != null ? CopyrightLabelElement.Value : null; } + get => _CopyrightLabelElement?.Value; set { - if (value == null) - CopyrightLabelElement = null; - else - CopyrightLabelElement = new Hl7.Fhir.Model.FhirString(value); + CopyrightLabelElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("CopyrightLabel"); } } @@ -5430,11 +5130,11 @@ public string CopyrightLabel [DataMember] public List Origin { - get { if(_Origin==null) _Origin = new List(); return _Origin; } + get => _Origin ?? new List(); set { _Origin = value; OnPropertyChanged("Origin"); } } - private List _Origin; + private List? _Origin; /// /// An abstract server representing a destination or receiver in a message exchange. @@ -5444,24 +5144,24 @@ public List Origin [DataMember] public List Destination { - get { if(_Destination==null) _Destination = new List(); return _Destination; } + get => _Destination ?? new List(); set { _Destination = value; OnPropertyChanged("Destination"); } } - private List _Destination; + private List? _Destination; /// /// Required capability that is assumed to function correctly on the FHIR server being tested. /// [FhirElement("metadata", Order=280)] [DataMember] - public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata + public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata { get { return _Metadata; } set { _Metadata = value; OnPropertyChanged("Metadata"); } } - private Hl7.Fhir.Model.TestScript.MetadataComponent _Metadata; + private Hl7.Fhir.Model.TestScript.MetadataComponent? _Metadata; /// /// Indication of the artifact(s) that are tested by this test case. @@ -5471,11 +5171,11 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent Metadata [DataMember] public List Scope { - get { if(_Scope==null) _Scope = new List(); return _Scope; } + get => _Scope ?? new List(); set { _Scope = value; OnPropertyChanged("Scope"); } } - private List _Scope; + private List? _Scope; /// /// Fixture in the test script - by reference (uri). @@ -5485,11 +5185,11 @@ public List Scope [DataMember] public List Fixture { - get { if(_Fixture==null) _Fixture = new List(); return _Fixture; } + get => _Fixture ?? new List(); set { _Fixture = value; OnPropertyChanged("Fixture"); } } - private List _Fixture; + private List? _Fixture; /// /// Reference of the validation profile. @@ -5499,24 +5199,24 @@ public List Fixture [DataMember] public List ProfileElement { - get { if(_ProfileElement==null) _ProfileElement = new List(); return _ProfileElement; } + get => _ProfileElement ?? new List(); set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } - private List _ProfileElement; + private List? _ProfileElement; /// /// Reference of the validation profile /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Profile + public IEnumerable? Profile { - get { return ProfileElement != null ? ProfileElement.Select(elem => elem.Value) : null; } + get => _ProfileElement?.Select(elem => elem.Value); set { if (value == null) - ProfileElement = null; + ProfileElement = null!; else ProfileElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Canonical(elem))); OnPropertyChanged("Profile"); @@ -5531,24 +5231,24 @@ public IEnumerable Profile [DataMember] public List Variable { - get { if(_Variable==null) _Variable = new List(); return _Variable; } + get => _Variable ?? new List(); set { _Variable = value; OnPropertyChanged("Variable"); } } - private List _Variable; + private List? _Variable; /// /// A series of required setup operations before tests are executed. /// [FhirElement("setup", Order=330)] [DataMember] - public Hl7.Fhir.Model.TestScript.SetupComponent Setup + public Hl7.Fhir.Model.TestScript.SetupComponent? Setup { get { return _Setup; } set { _Setup = value; OnPropertyChanged("Setup"); } } - private Hl7.Fhir.Model.TestScript.SetupComponent _Setup; + private Hl7.Fhir.Model.TestScript.SetupComponent? _Setup; /// /// A test in this script. @@ -5558,64 +5258,60 @@ public Hl7.Fhir.Model.TestScript.SetupComponent Setup [DataMember] public List Test { - get { if(_Test==null) _Test = new List(); return _Test; } + get => _Test ?? new List(); set { _Test = value; OnPropertyChanged("Test"); } } - private List _Test; + private List? _Test; /// /// A series of required clean up steps. /// [FhirElement("teardown", Order=350)] [DataMember] - public Hl7.Fhir.Model.TestScript.TeardownComponent Teardown + public Hl7.Fhir.Model.TestScript.TeardownComponent? Teardown { get { return _Teardown; } set { _Teardown = value; OnPropertyChanged("Teardown"); } } - private Hl7.Fhir.Model.TestScript.TeardownComponent _Teardown; + private Hl7.Fhir.Model.TestScript.TeardownComponent? _Teardown; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as TestScript; - - if (dest == null) - { + if(other is not TestScript dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(UrlElement != null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)UrlElement.DeepCopyInternal(); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(VersionElement != null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)VersionElement.DeepCopyInternal(); - if(VersionAlgorithm != null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)VersionAlgorithm.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(TitleElement != null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)TitleElement.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(ExperimentalElement != null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)ExperimentalElement.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)DateElement.DeepCopyInternal(); - if(PublisherElement != null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)PublisherElement.DeepCopyInternal(); - if(Contact.Any()) dest.Contact = new List(Contact.DeepCopyInternal()); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)DescriptionElement.DeepCopyInternal(); - if(UseContext.Any()) dest.UseContext = new List(UseContext.DeepCopyInternal()); - if(Jurisdiction.Any()) dest.Jurisdiction = new List(Jurisdiction.DeepCopyInternal()); - if(PurposeElement != null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)PurposeElement.DeepCopyInternal(); - if(CopyrightElement != null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)CopyrightElement.DeepCopyInternal(); - if(CopyrightLabelElement != null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)CopyrightLabelElement.DeepCopyInternal(); - if(Origin.Any()) dest.Origin = new List(Origin.DeepCopyInternal()); - if(Destination.Any()) dest.Destination = new List(Destination.DeepCopyInternal()); - if(Metadata != null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)Metadata.DeepCopyInternal(); - if(Scope.Any()) dest.Scope = new List(Scope.DeepCopyInternal()); - if(Fixture.Any()) dest.Fixture = new List(Fixture.DeepCopyInternal()); - if(ProfileElement.Any()) dest.ProfileElement = new List(ProfileElement.DeepCopyInternal()); - if(Variable.Any()) dest.Variable = new List(Variable.DeepCopyInternal()); - if(Setup != null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)Setup.DeepCopyInternal(); - if(Test.Any()) dest.Test = new List(Test.DeepCopyInternal()); - if(Teardown != null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)Teardown.DeepCopyInternal(); + if(_UrlElement is not null) dest.UrlElement = (Hl7.Fhir.Model.FhirUri)_UrlElement.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_VersionElement is not null) dest.VersionElement = (Hl7.Fhir.Model.FhirString)_VersionElement.DeepCopyInternal(); + if(_VersionAlgorithm is not null) dest.VersionAlgorithm = (Hl7.Fhir.Model.DataType)_VersionAlgorithm.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_TitleElement is not null) dest.TitleElement = (Hl7.Fhir.Model.FhirString)_TitleElement.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_ExperimentalElement is not null) dest.ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)_ExperimentalElement.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.FhirDateTime)_DateElement.DeepCopyInternal(); + if(_PublisherElement is not null) dest.PublisherElement = (Hl7.Fhir.Model.FhirString)_PublisherElement.DeepCopyInternal(); + if(_Contact is not null) dest.Contact = new List(_Contact.DeepCopyInternal()); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.Markdown)_DescriptionElement.DeepCopyInternal(); + if(_UseContext is not null) dest.UseContext = new List(_UseContext.DeepCopyInternal()); + if(_Jurisdiction is not null) dest.Jurisdiction = new List(_Jurisdiction.DeepCopyInternal()); + if(_PurposeElement is not null) dest.PurposeElement = (Hl7.Fhir.Model.Markdown)_PurposeElement.DeepCopyInternal(); + if(_CopyrightElement is not null) dest.CopyrightElement = (Hl7.Fhir.Model.Markdown)_CopyrightElement.DeepCopyInternal(); + if(_CopyrightLabelElement is not null) dest.CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)_CopyrightLabelElement.DeepCopyInternal(); + if(_Origin is not null) dest.Origin = new List(_Origin.DeepCopyInternal()); + if(_Destination is not null) dest.Destination = new List(_Destination.DeepCopyInternal()); + if(_Metadata is not null) dest.Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)_Metadata.DeepCopyInternal(); + if(_Scope is not null) dest.Scope = new List(_Scope.DeepCopyInternal()); + if(_Fixture is not null) dest.Fixture = new List(_Fixture.DeepCopyInternal()); + if(_ProfileElement is not null) dest.ProfileElement = new List(_ProfileElement.DeepCopyInternal()); + if(_Variable is not null) dest.Variable = new List(_Variable.DeepCopyInternal()); + if(_Setup is not null) dest.Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)_Setup.DeepCopyInternal(); + if(_Test is not null) dest.Test = new List(_Test.DeepCopyInternal()); + if(_Teardown is not null) dest.Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)_Teardown.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -5627,216 +5323,216 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TestScript; - if(otherT == null) return false; + if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(UrlElement, otherT.UrlElement)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(VersionElement, otherT.VersionElement)) return false; - if(!comparer.Equals(VersionAlgorithm, otherT.VersionAlgorithm)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(TitleElement, otherT.TitleElement)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(ExperimentalElement, otherT.ExperimentalElement)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(PublisherElement, otherT.PublisherElement)) return false; - if(!comparer.ListEquals(Contact, otherT.Contact)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.ListEquals(UseContext, otherT.UseContext)) return false; - if(!comparer.ListEquals(Jurisdiction, otherT.Jurisdiction)) return false; - if(!comparer.Equals(PurposeElement, otherT.PurposeElement)) return false; - if(!comparer.Equals(CopyrightElement, otherT.CopyrightElement)) return false; - if(!comparer.Equals(CopyrightLabelElement, otherT.CopyrightLabelElement)) return false; - if(!comparer.ListEquals(Origin, otherT.Origin)) return false; - if(!comparer.ListEquals(Destination, otherT.Destination)) return false; - if(!comparer.Equals(Metadata, otherT.Metadata)) return false; - if(!comparer.ListEquals(Scope, otherT.Scope)) return false; - if(!comparer.ListEquals(Fixture, otherT.Fixture)) return false; - if(!comparer.ListEquals(ProfileElement, otherT.ProfileElement)) return false; - if(!comparer.ListEquals(Variable, otherT.Variable)) return false; - if(!comparer.Equals(Setup, otherT.Setup)) return false; - if(!comparer.ListEquals(Test, otherT.Test)) return false; - if(!comparer.Equals(Teardown, otherT.Teardown)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; + if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_ExperimentalElement, otherT._ExperimentalElement)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_PublisherElement, otherT._PublisherElement)) return false; + if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; + if(!comparer.Equals(_CopyrightLabelElement, otherT._CopyrightLabelElement)) return false; + if(!comparer.ListEquals(_Origin, otherT._Origin)) return false; + if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; + if(!comparer.Equals(_Metadata, otherT._Metadata)) return false; + if(!comparer.ListEquals(_Scope, otherT._Scope)) return false; + if(!comparer.ListEquals(_Fixture, otherT._Fixture)) return false; + if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; + if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; + if(!comparer.Equals(_Setup, otherT._Setup)) return false; + if(!comparer.ListEquals(_Test, otherT._Test)) return false; + if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "url": - value = UrlElement; - return UrlElement is not null; + value = _UrlElement; + return _UrlElement is not null; case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "version": - value = VersionElement; - return VersionElement is not null; + value = _VersionElement; + return _VersionElement is not null; case "versionAlgorithm": - value = VersionAlgorithm; - return VersionAlgorithm is not null; + value = _VersionAlgorithm; + return _VersionAlgorithm is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "title": - value = TitleElement; - return TitleElement is not null; + value = _TitleElement; + return _TitleElement is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "experimental": - value = ExperimentalElement; - return ExperimentalElement is not null; + value = _ExperimentalElement; + return _ExperimentalElement is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "publisher": - value = PublisherElement; - return PublisherElement is not null; + value = _PublisherElement; + return _PublisherElement is not null; case "contact": - value = Contact; - return Contact?.Any() == true; + value = _Contact; + return _Contact?.Any() == true; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "useContext": - value = UseContext; - return UseContext?.Any() == true; + value = _UseContext; + return _UseContext?.Any() == true; case "jurisdiction": - value = Jurisdiction; - return Jurisdiction?.Any() == true; + value = _Jurisdiction; + return _Jurisdiction?.Any() == true; case "purpose": - value = PurposeElement; - return PurposeElement is not null; + value = _PurposeElement; + return _PurposeElement is not null; case "copyright": - value = CopyrightElement; - return CopyrightElement is not null; + value = _CopyrightElement; + return _CopyrightElement is not null; case "copyrightLabel": - value = CopyrightLabelElement; - return CopyrightLabelElement is not null; + value = _CopyrightLabelElement; + return _CopyrightLabelElement is not null; case "origin": - value = Origin; - return Origin?.Any() == true; + value = _Origin; + return _Origin?.Any() == true; case "destination": - value = Destination; - return Destination?.Any() == true; + value = _Destination; + return _Destination?.Any() == true; case "metadata": - value = Metadata; - return Metadata is not null; + value = _Metadata; + return _Metadata is not null; case "scope": - value = Scope; - return Scope?.Any() == true; + value = _Scope; + return _Scope?.Any() == true; case "fixture": - value = Fixture; - return Fixture?.Any() == true; + value = _Fixture; + return _Fixture?.Any() == true; case "profile": - value = ProfileElement; - return ProfileElement?.Any() == true; + value = _ProfileElement; + return _ProfileElement?.Any() == true; case "variable": - value = Variable; - return Variable?.Any() == true; + value = _Variable; + return _Variable?.Any() == true; case "setup": - value = Setup; - return Setup is not null; + value = _Setup; + return _Setup is not null; case "test": - value = Test; - return Test?.Any() == true; + value = _Test; + return _Test?.Any() == true; case "teardown": - value = Teardown; - return Teardown is not null; + value = _Teardown; + return _Teardown is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "url": - UrlElement = (Hl7.Fhir.Model.FhirUri)value; + UrlElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "version": - VersionElement = (Hl7.Fhir.Model.FhirString)value; + VersionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "versionAlgorithm": - VersionAlgorithm = (Hl7.Fhir.Model.DataType)value; + VersionAlgorithm = (Hl7.Fhir.Model.DataType?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "title": - TitleElement = (Hl7.Fhir.Model.FhirString)value; + TitleElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "experimental": - ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean)value; + ExperimentalElement = (Hl7.Fhir.Model.FhirBoolean?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "publisher": - PublisherElement = (Hl7.Fhir.Model.FhirString)value; + PublisherElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "contact": - Contact = (List)value; + Contact = (List?)value!; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.Markdown)value; + DescriptionElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "useContext": - UseContext = (List)value; + UseContext = (List?)value!; return this; case "jurisdiction": - Jurisdiction = (List)value; + Jurisdiction = (List?)value!; return this; case "purpose": - PurposeElement = (Hl7.Fhir.Model.Markdown)value; + PurposeElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyright": - CopyrightElement = (Hl7.Fhir.Model.Markdown)value; + CopyrightElement = (Hl7.Fhir.Model.Markdown?)value; return this; case "copyrightLabel": - CopyrightLabelElement = (Hl7.Fhir.Model.FhirString)value; + CopyrightLabelElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "origin": - Origin = (List)value; + Origin = (List?)value!; return this; case "destination": - Destination = (List)value; + Destination = (List?)value!; return this; case "metadata": - Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent)value; + Metadata = (Hl7.Fhir.Model.TestScript.MetadataComponent?)value; return this; case "scope": - Scope = (List)value; + Scope = (List?)value!; return this; case "fixture": - Fixture = (List)value; + Fixture = (List?)value!; return this; case "profile": - ProfileElement = (List)value; + ProfileElement = (List?)value!; return this; case "variable": - Variable = (List)value; + Variable = (List?)value!; return this; case "setup": - Setup = (Hl7.Fhir.Model.TestScript.SetupComponent)value; + Setup = (Hl7.Fhir.Model.TestScript.SetupComponent?)value; return this; case "test": - Test = (List)value; + Test = (List?)value!; return this; case "teardown": - Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent)value; + Teardown = (Hl7.Fhir.Model.TestScript.TeardownComponent?)value; return this; default: return base.SetValue(key, value); @@ -5847,33 +5543,33 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (UrlElement is not null) yield return new KeyValuePair("url",UrlElement); - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (VersionElement is not null) yield return new KeyValuePair("version",VersionElement); - if (VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",VersionAlgorithm); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (TitleElement is not null) yield return new KeyValuePair("title",TitleElement); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (ExperimentalElement is not null) yield return new KeyValuePair("experimental",ExperimentalElement); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (PublisherElement is not null) yield return new KeyValuePair("publisher",PublisherElement); - if (Contact?.Any() == true) yield return new KeyValuePair("contact",Contact); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (UseContext?.Any() == true) yield return new KeyValuePair("useContext",UseContext); - if (Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",Jurisdiction); - if (PurposeElement is not null) yield return new KeyValuePair("purpose",PurposeElement); - if (CopyrightElement is not null) yield return new KeyValuePair("copyright",CopyrightElement); - if (CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",CopyrightLabelElement); - if (Origin?.Any() == true) yield return new KeyValuePair("origin",Origin); - if (Destination?.Any() == true) yield return new KeyValuePair("destination",Destination); - if (Metadata is not null) yield return new KeyValuePair("metadata",Metadata); - if (Scope?.Any() == true) yield return new KeyValuePair("scope",Scope); - if (Fixture?.Any() == true) yield return new KeyValuePair("fixture",Fixture); - if (ProfileElement?.Any() == true) yield return new KeyValuePair("profile",ProfileElement); - if (Variable?.Any() == true) yield return new KeyValuePair("variable",Variable); - if (Setup is not null) yield return new KeyValuePair("setup",Setup); - if (Test?.Any() == true) yield return new KeyValuePair("test",Test); - if (Teardown is not null) yield return new KeyValuePair("teardown",Teardown); + if (_UrlElement is not null) yield return new KeyValuePair("url",_UrlElement); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_VersionElement is not null) yield return new KeyValuePair("version",_VersionElement); + if (_VersionAlgorithm is not null) yield return new KeyValuePair("versionAlgorithm",_VersionAlgorithm); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_TitleElement is not null) yield return new KeyValuePair("title",_TitleElement); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_ExperimentalElement is not null) yield return new KeyValuePair("experimental",_ExperimentalElement); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_PublisherElement is not null) yield return new KeyValuePair("publisher",_PublisherElement); + if (_Contact?.Any() == true) yield return new KeyValuePair("contact",_Contact); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_UseContext?.Any() == true) yield return new KeyValuePair("useContext",_UseContext); + if (_Jurisdiction?.Any() == true) yield return new KeyValuePair("jurisdiction",_Jurisdiction); + if (_PurposeElement is not null) yield return new KeyValuePair("purpose",_PurposeElement); + if (_CopyrightElement is not null) yield return new KeyValuePair("copyright",_CopyrightElement); + if (_CopyrightLabelElement is not null) yield return new KeyValuePair("copyrightLabel",_CopyrightLabelElement); + if (_Origin?.Any() == true) yield return new KeyValuePair("origin",_Origin); + if (_Destination?.Any() == true) yield return new KeyValuePair("destination",_Destination); + if (_Metadata is not null) yield return new KeyValuePair("metadata",_Metadata); + if (_Scope?.Any() == true) yield return new KeyValuePair("scope",_Scope); + if (_Fixture?.Any() == true) yield return new KeyValuePair("fixture",_Fixture); + if (_ProfileElement?.Any() == true) yield return new KeyValuePair("profile",_ProfileElement); + if (_Variable?.Any() == true) yield return new KeyValuePair("variable",_Variable); + if (_Setup is not null) yield return new KeyValuePair("setup",_Setup); + if (_Test?.Any() == true) yield return new KeyValuePair("test",_Test); + if (_Teardown is not null) yield return new KeyValuePair("teardown",_Teardown); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs index 321fa9e1e..f672ebcbc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -308,26 +311,26 @@ public partial class RepeatComponent : Hl7.Fhir.Model.Element [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Period))] [DataMember] - public Hl7.Fhir.Model.DataType Bounds + public Hl7.Fhir.Model.DataType? Bounds { get { return _Bounds; } set { _Bounds = value; OnPropertyChanged("Bounds"); } } - private Hl7.Fhir.Model.DataType _Bounds; + private Hl7.Fhir.Model.DataType? _Bounds; /// /// Number of times to repeat. /// [FhirElement("count", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt CountElement + public Hl7.Fhir.Model.PositiveInt? CountElement { get { return _CountElement; } set { _CountElement = value; OnPropertyChanged("CountElement"); } } - private Hl7.Fhir.Model.PositiveInt _CountElement; + private Hl7.Fhir.Model.PositiveInt? _CountElement; /// /// Number of times to repeat @@ -336,13 +339,10 @@ public Hl7.Fhir.Model.PositiveInt CountElement [IgnoreDataMember] public int? Count { - get { return CountElement != null ? CountElement.Value : null; } + get => _CountElement?.Value; set { - if (value == null) - CountElement = null; - else - CountElement = new Hl7.Fhir.Model.PositiveInt(value); + CountElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Count"); } } @@ -352,13 +352,13 @@ public int? Count /// [FhirElement("countMax", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.PositiveInt CountMaxElement + public Hl7.Fhir.Model.PositiveInt? CountMaxElement { get { return _CountMaxElement; } set { _CountMaxElement = value; OnPropertyChanged("CountMaxElement"); } } - private Hl7.Fhir.Model.PositiveInt _CountMaxElement; + private Hl7.Fhir.Model.PositiveInt? _CountMaxElement; /// /// Maximum number of times to repeat @@ -367,13 +367,10 @@ public Hl7.Fhir.Model.PositiveInt CountMaxElement [IgnoreDataMember] public int? CountMax { - get { return CountMaxElement != null ? CountMaxElement.Value : null; } + get => _CountMaxElement?.Value; set { - if (value == null) - CountMaxElement = null; - else - CountMaxElement = new Hl7.Fhir.Model.PositiveInt(value); + CountMaxElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("CountMax"); } } @@ -383,13 +380,13 @@ public int? CountMax /// [FhirElement("duration", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationElement + public Hl7.Fhir.Model.FhirDecimal? DurationElement { get { return _DurationElement; } set { _DurationElement = value; OnPropertyChanged("DurationElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationElement; /// /// How long when it happens @@ -398,13 +395,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationElement [IgnoreDataMember] public decimal? Duration { - get { return DurationElement != null ? DurationElement.Value : null; } + get => _DurationElement?.Value; set { - if (value == null) - DurationElement = null; - else - DurationElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Duration"); } } @@ -414,13 +408,13 @@ public decimal? Duration /// [FhirElement("durationMax", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DurationMaxElement + public Hl7.Fhir.Model.FhirDecimal? DurationMaxElement { get { return _DurationMaxElement; } set { _DurationMaxElement = value; OnPropertyChanged("DurationMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DurationMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _DurationMaxElement; /// /// How long when it happens (Max) @@ -429,13 +423,10 @@ public Hl7.Fhir.Model.FhirDecimal DurationMaxElement [IgnoreDataMember] public decimal? DurationMax { - get { return DurationMaxElement != null ? DurationMaxElement.Value : null; } + get => _DurationMaxElement?.Value; set { - if (value == null) - DurationMaxElement = null; - else - DurationMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + DurationMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("DurationMax"); } } @@ -447,13 +438,13 @@ public decimal? DurationMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code DurationUnitElement + public Code? DurationUnitElement { get { return _DurationUnitElement; } set { _DurationUnitElement = value; OnPropertyChanged("DurationUnitElement"); } } - private Code _DurationUnitElement; + private Code? _DurationUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -462,13 +453,10 @@ public Code DurationUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit { - get { return DurationUnitElement != null ? DurationUnitElement.Value : null; } + get => _DurationUnitElement?.Value; set { - if (value == null) - DurationUnitElement = null; - else - DurationUnitElement = new Code(value); + DurationUnitElement = value is null ? null : new Code(value); OnPropertyChanged("DurationUnit"); } } @@ -478,13 +466,13 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? DurationUnit /// [FhirElement("frequency", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FrequencyElement + public Hl7.Fhir.Model.PositiveInt? FrequencyElement { get { return _FrequencyElement; } set { _FrequencyElement = value; OnPropertyChanged("FrequencyElement"); } } - private Hl7.Fhir.Model.PositiveInt _FrequencyElement; + private Hl7.Fhir.Model.PositiveInt? _FrequencyElement; /// /// Indicates the number of repetitions that should occur within a period. I.e. Event occurs frequency times per period @@ -493,13 +481,10 @@ public Hl7.Fhir.Model.PositiveInt FrequencyElement [IgnoreDataMember] public int? Frequency { - get { return FrequencyElement != null ? FrequencyElement.Value : null; } + get => _FrequencyElement?.Value; set { - if (value == null) - FrequencyElement = null; - else - FrequencyElement = new Hl7.Fhir.Model.PositiveInt(value); + FrequencyElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Frequency"); } } @@ -509,13 +494,13 @@ public int? Frequency /// [FhirElement("frequencyMax", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.PositiveInt FrequencyMaxElement + public Hl7.Fhir.Model.PositiveInt? FrequencyMaxElement { get { return _FrequencyMaxElement; } set { _FrequencyMaxElement = value; OnPropertyChanged("FrequencyMaxElement"); } } - private Hl7.Fhir.Model.PositiveInt _FrequencyMaxElement; + private Hl7.Fhir.Model.PositiveInt? _FrequencyMaxElement; /// /// Event occurs up to frequencyMax times per period @@ -524,13 +509,10 @@ public Hl7.Fhir.Model.PositiveInt FrequencyMaxElement [IgnoreDataMember] public int? FrequencyMax { - get { return FrequencyMaxElement != null ? FrequencyMaxElement.Value : null; } + get => _FrequencyMaxElement?.Value; set { - if (value == null) - FrequencyMaxElement = null; - else - FrequencyMaxElement = new Hl7.Fhir.Model.PositiveInt(value); + FrequencyMaxElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("FrequencyMax"); } } @@ -540,13 +522,13 @@ public int? FrequencyMax /// [FhirElement("period", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodElement + public Hl7.Fhir.Model.FhirDecimal? PeriodElement { get { return _PeriodElement; } set { _PeriodElement = value; OnPropertyChanged("PeriodElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodElement; /// /// The duration to which the frequency applies. I.e. Event occurs frequency times per period @@ -555,13 +537,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodElement [IgnoreDataMember] public decimal? Period { - get { return PeriodElement != null ? PeriodElement.Value : null; } + get => _PeriodElement?.Value; set { - if (value == null) - PeriodElement = null; - else - PeriodElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Period"); } } @@ -571,13 +550,13 @@ public decimal? Period /// [FhirElement("periodMax", InSummary=true, Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement + public Hl7.Fhir.Model.FhirDecimal? PeriodMaxElement { get { return _PeriodMaxElement; } set { _PeriodMaxElement = value; OnPropertyChanged("PeriodMaxElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PeriodMaxElement; + private Hl7.Fhir.Model.FhirDecimal? _PeriodMaxElement; /// /// Upper limit of period (3-4 hours) @@ -586,13 +565,10 @@ public Hl7.Fhir.Model.FhirDecimal PeriodMaxElement [IgnoreDataMember] public decimal? PeriodMax { - get { return PeriodMaxElement != null ? PeriodMaxElement.Value : null; } + get => _PeriodMaxElement?.Value; set { - if (value == null) - PeriodMaxElement = null; - else - PeriodMaxElement = new Hl7.Fhir.Model.FhirDecimal(value); + PeriodMaxElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("PeriodMax"); } } @@ -604,13 +580,13 @@ public decimal? PeriodMax [DeclaredType(Type = typeof(Code))] [Binding("UnitsOfTime")] [DataMember] - public Code PeriodUnitElement + public Code? PeriodUnitElement { get { return _PeriodUnitElement; } set { _PeriodUnitElement = value; OnPropertyChanged("PeriodUnitElement"); } } - private Code _PeriodUnitElement; + private Code? _PeriodUnitElement; /// /// s | min | h | d | wk | mo | a - unit of time (UCUM) @@ -619,13 +595,10 @@ public Code PeriodUnitElement [IgnoreDataMember] public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit { - get { return PeriodUnitElement != null ? PeriodUnitElement.Value : null; } + get => _PeriodUnitElement?.Value; set { - if (value == null) - PeriodUnitElement = null; - else - PeriodUnitElement = new Code(value); + PeriodUnitElement = value is null ? null : new Code(value); OnPropertyChanged("PeriodUnit"); } } @@ -640,24 +613,24 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get { if(_DayOfWeekElement==null) _DayOfWeekElement = new List>(); return _DayOfWeekElement; } + get => _DayOfWeekElement ?? new List>(); set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } - private List> _DayOfWeekElement; + private List>? _DayOfWeekElement; /// /// mon | tue | wed | thu | fri | sat | sun /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable DayOfWeek + public IEnumerable? DayOfWeek { - get { return DayOfWeekElement != null ? DayOfWeekElement.Select(elem => elem.Value) : null; } + get => _DayOfWeekElement?.Select(elem => elem.Value); set { if (value == null) - DayOfWeekElement = null; + DayOfWeekElement = null!; else DayOfWeekElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("DayOfWeek"); @@ -672,24 +645,24 @@ public IEnumerable DayOfWeek [DataMember] public List TimeOfDayElement { - get { if(_TimeOfDayElement==null) _TimeOfDayElement = new List(); return _TimeOfDayElement; } + get => _TimeOfDayElement ?? new List(); set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } - private List _TimeOfDayElement; + private List? _TimeOfDayElement; /// /// Time of day for action /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TimeOfDay + public IEnumerable? TimeOfDay { - get { return TimeOfDayElement != null ? TimeOfDayElement.Select(elem => elem.Value) : null; } + get => _TimeOfDayElement?.Select(elem => elem.Value); set { if (value == null) - TimeOfDayElement = null; + TimeOfDayElement = null!; else TimeOfDayElement = new List(value.Select(elem=>new Hl7.Fhir.Model.Time(elem))); OnPropertyChanged("TimeOfDay"); @@ -706,24 +679,24 @@ public IEnumerable TimeOfDay [DataMember] public List> WhenElement { - get { if(_WhenElement==null) _WhenElement = new List>(); return _WhenElement; } + get => _WhenElement ?? new List>(); set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } - private List> _WhenElement; + private List>? _WhenElement; /// /// Code for time period of occurrence /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable When + public IEnumerable? When { - get { return WhenElement != null ? WhenElement.Select(elem => elem.Value) : null; } + get => _WhenElement?.Select(elem => elem.Value); set { if (value == null) - WhenElement = null; + WhenElement = null!; else WhenElement = new List>(value.Select(elem=>new Code(elem))); OnPropertyChanged("When"); @@ -735,13 +708,13 @@ public IEnumerable When /// [FhirElement("offset", InSummary=true, Order=170)] [DataMember] - public Hl7.Fhir.Model.UnsignedInt OffsetElement + public Hl7.Fhir.Model.UnsignedInt? OffsetElement { get { return _OffsetElement; } set { _OffsetElement = value; OnPropertyChanged("OffsetElement"); } } - private Hl7.Fhir.Model.UnsignedInt _OffsetElement; + private Hl7.Fhir.Model.UnsignedInt? _OffsetElement; /// /// Minutes from event (before or after) @@ -750,42 +723,35 @@ public Hl7.Fhir.Model.UnsignedInt OffsetElement [IgnoreDataMember] public int? Offset { - get { return OffsetElement != null ? OffsetElement.Value : null; } + get => _OffsetElement?.Value; set { - if (value == null) - OffsetElement = null; - else - OffsetElement = new Hl7.Fhir.Model.UnsignedInt(value); + OffsetElement = value is null ? null : new Hl7.Fhir.Model.UnsignedInt(value); OnPropertyChanged("Offset"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as RepeatComponent; - - if (dest == null) - { + if(other is not RepeatComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Bounds != null) dest.Bounds = (Hl7.Fhir.Model.DataType)Bounds.DeepCopyInternal(); - if(CountElement != null) dest.CountElement = (Hl7.Fhir.Model.PositiveInt)CountElement.DeepCopyInternal(); - if(CountMaxElement != null) dest.CountMaxElement = (Hl7.Fhir.Model.PositiveInt)CountMaxElement.DeepCopyInternal(); - if(DurationElement != null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)DurationElement.DeepCopyInternal(); - if(DurationMaxElement != null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)DurationMaxElement.DeepCopyInternal(); - if(DurationUnitElement != null) dest.DurationUnitElement = (Code)DurationUnitElement.DeepCopyInternal(); - if(FrequencyElement != null) dest.FrequencyElement = (Hl7.Fhir.Model.PositiveInt)FrequencyElement.DeepCopyInternal(); - if(FrequencyMaxElement != null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)FrequencyMaxElement.DeepCopyInternal(); - if(PeriodElement != null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)PeriodElement.DeepCopyInternal(); - if(PeriodMaxElement != null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)PeriodMaxElement.DeepCopyInternal(); - if(PeriodUnitElement != null) dest.PeriodUnitElement = (Code)PeriodUnitElement.DeepCopyInternal(); - if(DayOfWeekElement.Any()) dest.DayOfWeekElement = new List>(DayOfWeekElement.DeepCopyInternal()); - if(TimeOfDayElement.Any()) dest.TimeOfDayElement = new List(TimeOfDayElement.DeepCopyInternal()); - if(WhenElement.Any()) dest.WhenElement = new List>(WhenElement.DeepCopyInternal()); - if(OffsetElement != null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)OffsetElement.DeepCopyInternal(); + if(_Bounds is not null) dest.Bounds = (Hl7.Fhir.Model.DataType)_Bounds.DeepCopyInternal(); + if(_CountElement is not null) dest.CountElement = (Hl7.Fhir.Model.PositiveInt)_CountElement.DeepCopyInternal(); + if(_CountMaxElement is not null) dest.CountMaxElement = (Hl7.Fhir.Model.PositiveInt)_CountMaxElement.DeepCopyInternal(); + if(_DurationElement is not null) dest.DurationElement = (Hl7.Fhir.Model.FhirDecimal)_DurationElement.DeepCopyInternal(); + if(_DurationMaxElement is not null) dest.DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)_DurationMaxElement.DeepCopyInternal(); + if(_DurationUnitElement is not null) dest.DurationUnitElement = (Code)_DurationUnitElement.DeepCopyInternal(); + if(_FrequencyElement is not null) dest.FrequencyElement = (Hl7.Fhir.Model.PositiveInt)_FrequencyElement.DeepCopyInternal(); + if(_FrequencyMaxElement is not null) dest.FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)_FrequencyMaxElement.DeepCopyInternal(); + if(_PeriodElement is not null) dest.PeriodElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodElement.DeepCopyInternal(); + if(_PeriodMaxElement is not null) dest.PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)_PeriodMaxElement.DeepCopyInternal(); + if(_PeriodUnitElement is not null) dest.PeriodUnitElement = (Code)_PeriodUnitElement.DeepCopyInternal(); + if(_DayOfWeekElement is not null) dest.DayOfWeekElement = new List>(_DayOfWeekElement.DeepCopyInternal()); + if(_TimeOfDayElement is not null) dest.TimeOfDayElement = new List(_TimeOfDayElement.DeepCopyInternal()); + if(_WhenElement is not null) dest.WhenElement = new List>(_WhenElement.DeepCopyInternal()); + if(_OffsetElement is not null) dest.OffsetElement = (Hl7.Fhir.Model.UnsignedInt)_OffsetElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -797,132 +763,132 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RepeatComponent; - if(otherT == null) return false; + if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Bounds, otherT.Bounds)) return false; - if(!comparer.Equals(CountElement, otherT.CountElement)) return false; - if(!comparer.Equals(CountMaxElement, otherT.CountMaxElement)) return false; - if(!comparer.Equals(DurationElement, otherT.DurationElement)) return false; - if(!comparer.Equals(DurationMaxElement, otherT.DurationMaxElement)) return false; - if(!comparer.Equals(DurationUnitElement, otherT.DurationUnitElement)) return false; - if(!comparer.Equals(FrequencyElement, otherT.FrequencyElement)) return false; - if(!comparer.Equals(FrequencyMaxElement, otherT.FrequencyMaxElement)) return false; - if(!comparer.Equals(PeriodElement, otherT.PeriodElement)) return false; - if(!comparer.Equals(PeriodMaxElement, otherT.PeriodMaxElement)) return false; - if(!comparer.Equals(PeriodUnitElement, otherT.PeriodUnitElement)) return false; - if(!comparer.ListEquals(DayOfWeekElement, otherT.DayOfWeekElement)) return false; - if(!comparer.ListEquals(TimeOfDayElement, otherT.TimeOfDayElement)) return false; - if(!comparer.ListEquals(WhenElement, otherT.WhenElement)) return false; - if(!comparer.Equals(OffsetElement, otherT.OffsetElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; + if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; + if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; + if(!comparer.Equals(_DurationMaxElement, otherT._DurationMaxElement)) return false; + if(!comparer.Equals(_DurationUnitElement, otherT._DurationUnitElement)) return false; + if(!comparer.Equals(_FrequencyElement, otherT._FrequencyElement)) return false; + if(!comparer.Equals(_FrequencyMaxElement, otherT._FrequencyMaxElement)) return false; + if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; + if(!comparer.Equals(_PeriodMaxElement, otherT._PeriodMaxElement)) return false; + if(!comparer.Equals(_PeriodUnitElement, otherT._PeriodUnitElement)) return false; + if(!comparer.ListEquals(_DayOfWeekElement, otherT._DayOfWeekElement)) return false; + if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; + if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; + if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "bounds": - value = Bounds; - return Bounds is not null; + value = _Bounds; + return _Bounds is not null; case "count": - value = CountElement; - return CountElement is not null; + value = _CountElement; + return _CountElement is not null; case "countMax": - value = CountMaxElement; - return CountMaxElement is not null; + value = _CountMaxElement; + return _CountMaxElement is not null; case "duration": - value = DurationElement; - return DurationElement is not null; + value = _DurationElement; + return _DurationElement is not null; case "durationMax": - value = DurationMaxElement; - return DurationMaxElement is not null; + value = _DurationMaxElement; + return _DurationMaxElement is not null; case "durationUnit": - value = DurationUnitElement; - return DurationUnitElement is not null; + value = _DurationUnitElement; + return _DurationUnitElement is not null; case "frequency": - value = FrequencyElement; - return FrequencyElement is not null; + value = _FrequencyElement; + return _FrequencyElement is not null; case "frequencyMax": - value = FrequencyMaxElement; - return FrequencyMaxElement is not null; + value = _FrequencyMaxElement; + return _FrequencyMaxElement is not null; case "period": - value = PeriodElement; - return PeriodElement is not null; + value = _PeriodElement; + return _PeriodElement is not null; case "periodMax": - value = PeriodMaxElement; - return PeriodMaxElement is not null; + value = _PeriodMaxElement; + return _PeriodMaxElement is not null; case "periodUnit": - value = PeriodUnitElement; - return PeriodUnitElement is not null; + value = _PeriodUnitElement; + return _PeriodUnitElement is not null; case "dayOfWeek": - value = DayOfWeekElement; - return DayOfWeekElement?.Any() == true; + value = _DayOfWeekElement; + return _DayOfWeekElement?.Any() == true; case "timeOfDay": - value = TimeOfDayElement; - return TimeOfDayElement?.Any() == true; + value = _TimeOfDayElement; + return _TimeOfDayElement?.Any() == true; case "when": - value = WhenElement; - return WhenElement?.Any() == true; + value = _WhenElement; + return _WhenElement?.Any() == true; case "offset": - value = OffsetElement; - return OffsetElement is not null; + value = _OffsetElement; + return _OffsetElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "bounds": - Bounds = (Hl7.Fhir.Model.DataType)value; + Bounds = (Hl7.Fhir.Model.DataType?)value; return this; case "count": - CountElement = (Hl7.Fhir.Model.PositiveInt)value; + CountElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "countMax": - CountMaxElement = (Hl7.Fhir.Model.PositiveInt)value; + CountMaxElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "duration": - DurationElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationMax": - DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + DurationMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "durationUnit": - DurationUnitElement = (Code)value; + DurationUnitElement = (Code?)value; return this; case "frequency": - FrequencyElement = (Hl7.Fhir.Model.PositiveInt)value; + FrequencyElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "frequencyMax": - FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt)value; + FrequencyMaxElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - PeriodElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodMax": - PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal)value; + PeriodMaxElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "periodUnit": - PeriodUnitElement = (Code)value; + PeriodUnitElement = (Code?)value; return this; case "dayOfWeek": - DayOfWeekElement = (List>)value; + DayOfWeekElement = (List>?)value!; return this; case "timeOfDay": - TimeOfDayElement = (List)value; + TimeOfDayElement = (List?)value!; return this; case "when": - WhenElement = (List>)value; + WhenElement = (List>?)value!; return this; case "offset": - OffsetElement = (Hl7.Fhir.Model.UnsignedInt)value; + OffsetElement = (Hl7.Fhir.Model.UnsignedInt?)value; return this; default: return base.SetValue(key, value); @@ -933,21 +899,21 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Bounds is not null) yield return new KeyValuePair("bounds",Bounds); - if (CountElement is not null) yield return new KeyValuePair("count",CountElement); - if (CountMaxElement is not null) yield return new KeyValuePair("countMax",CountMaxElement); - if (DurationElement is not null) yield return new KeyValuePair("duration",DurationElement); - if (DurationMaxElement is not null) yield return new KeyValuePair("durationMax",DurationMaxElement); - if (DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",DurationUnitElement); - if (FrequencyElement is not null) yield return new KeyValuePair("frequency",FrequencyElement); - if (FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",FrequencyMaxElement); - if (PeriodElement is not null) yield return new KeyValuePair("period",PeriodElement); - if (PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",PeriodMaxElement); - if (PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",PeriodUnitElement); - if (DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",DayOfWeekElement); - if (TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",TimeOfDayElement); - if (WhenElement?.Any() == true) yield return new KeyValuePair("when",WhenElement); - if (OffsetElement is not null) yield return new KeyValuePair("offset",OffsetElement); + if (_Bounds is not null) yield return new KeyValuePair("bounds",_Bounds); + if (_CountElement is not null) yield return new KeyValuePair("count",_CountElement); + if (_CountMaxElement is not null) yield return new KeyValuePair("countMax",_CountMaxElement); + if (_DurationElement is not null) yield return new KeyValuePair("duration",_DurationElement); + if (_DurationMaxElement is not null) yield return new KeyValuePair("durationMax",_DurationMaxElement); + if (_DurationUnitElement is not null) yield return new KeyValuePair("durationUnit",_DurationUnitElement); + if (_FrequencyElement is not null) yield return new KeyValuePair("frequency",_FrequencyElement); + if (_FrequencyMaxElement is not null) yield return new KeyValuePair("frequencyMax",_FrequencyMaxElement); + if (_PeriodElement is not null) yield return new KeyValuePair("period",_PeriodElement); + if (_PeriodMaxElement is not null) yield return new KeyValuePair("periodMax",_PeriodMaxElement); + if (_PeriodUnitElement is not null) yield return new KeyValuePair("periodUnit",_PeriodUnitElement); + if (_DayOfWeekElement?.Any() == true) yield return new KeyValuePair("dayOfWeek",_DayOfWeekElement); + if (_TimeOfDayElement?.Any() == true) yield return new KeyValuePair("timeOfDay",_TimeOfDayElement); + if (_WhenElement?.Any() == true) yield return new KeyValuePair("when",_WhenElement); + if (_OffsetElement is not null) yield return new KeyValuePair("offset",_OffsetElement); } } @@ -960,24 +926,24 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get { if(_EventElement==null) _EventElement = new List(); return _EventElement; } + get => _EventElement ?? new List(); set { _EventElement = value; OnPropertyChanged("EventElement"); } } - private List _EventElement; + private List? _EventElement; /// /// When the event occurs /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable Event + public IEnumerable? Event { - get { return EventElement != null ? EventElement.Select(elem => elem.Value) : null; } + get => _EventElement?.Select(elem => elem.Value); set { if (value == null) - EventElement = null; + EventElement = null!; else EventElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirDateTime(elem))); OnPropertyChanged("Event"); @@ -989,13 +955,13 @@ public IEnumerable Event /// [FhirElement("repeat", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.Timing.RepeatComponent Repeat + public Hl7.Fhir.Model.Timing.RepeatComponent? Repeat { get { return _Repeat; } set { _Repeat = value; OnPropertyChanged("Repeat"); } } - private Hl7.Fhir.Model.Timing.RepeatComponent _Repeat; + private Hl7.Fhir.Model.Timing.RepeatComponent? _Repeat; /// /// C | BID | TID | QID | AM | PM | QD | QOD | +. @@ -1003,27 +969,23 @@ public Hl7.Fhir.Model.Timing.RepeatComponent Repeat [FhirElement("code", InSummary=true, Order=60)] [Binding("TimingAbbreviation")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; protected internal override void CopyToInternal(Base other) { - var dest = other as Timing; - - if (dest == null) - { + if(other is not Timing dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(EventElement.Any()) dest.EventElement = new List(EventElement.DeepCopyInternal()); - if(Repeat != null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)Repeat.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); + if(_EventElement is not null) dest.EventElement = new List(_EventElement.DeepCopyInternal()); + if(_Repeat is not null) dest.Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)_Repeat.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1035,48 +997,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Timing; - if(otherT == null) return false; + if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(EventElement, otherT.EventElement)) return false; - if(!comparer.Equals(Repeat, otherT.Repeat)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "event": - value = EventElement; - return EventElement?.Any() == true; + value = _EventElement; + return _EventElement?.Any() == true; case "repeat": - value = Repeat; - return Repeat is not null; + value = _Repeat; + return _Repeat is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "event": - EventElement = (List)value; + EventElement = (List?)value!; return this; case "repeat": - Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent)value; + Repeat = (Hl7.Fhir.Model.Timing.RepeatComponent?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; default: return base.SetValue(key, value); @@ -1087,9 +1049,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (EventElement?.Any() == true) yield return new KeyValuePair("event",EventElement); - if (Repeat is not null) yield return new KeyValuePair("repeat",Repeat); - if (Code is not null) yield return new KeyValuePair("code",Code); + if (_EventElement?.Any() == true) yield return new KeyValuePair("event",_EventElement); + if (_Repeat is not null) yield return new KeyValuePair("repeat",_Repeat); + if (_Code is not null) yield return new KeyValuePair("code",_Code); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Transport.cs b/src/Hl7.Fhir.R5/Model/Generated/Transport.cs index 52517062a..0c65e1412 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Transport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Transport.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -190,13 +193,13 @@ public partial class RestrictionComponent : Hl7.Fhir.Model.BackboneElement /// [FhirElement("repetitions", Order=40)] [DataMember] - public Hl7.Fhir.Model.PositiveInt RepetitionsElement + public Hl7.Fhir.Model.PositiveInt? RepetitionsElement { get { return _RepetitionsElement; } set { _RepetitionsElement = value; OnPropertyChanged("RepetitionsElement"); } } - private Hl7.Fhir.Model.PositiveInt _RepetitionsElement; + private Hl7.Fhir.Model.PositiveInt? _RepetitionsElement; /// /// How many times to repeat @@ -205,13 +208,10 @@ public Hl7.Fhir.Model.PositiveInt RepetitionsElement [IgnoreDataMember] public int? Repetitions { - get { return RepetitionsElement != null ? RepetitionsElement.Value : null; } + get => _RepetitionsElement?.Value; set { - if (value == null) - RepetitionsElement = null; - else - RepetitionsElement = new Hl7.Fhir.Model.PositiveInt(value); + RepetitionsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("Repetitions"); } } @@ -221,13 +221,13 @@ public int? Repetitions /// [FhirElement("period", Order=50)] [DataMember] - public Hl7.Fhir.Model.Period Period + public Hl7.Fhir.Model.Period? Period { get { return _Period; } set { _Period = value; OnPropertyChanged("Period"); } } - private Hl7.Fhir.Model.Period _Period; + private Hl7.Fhir.Model.Period? _Period; /// /// For whom is fulfillment sought?. @@ -239,25 +239,21 @@ public Hl7.Fhir.Model.Period Period [DataMember] public List Recipient { - get { if(_Recipient==null) _Recipient = new List(); return _Recipient; } + get => _Recipient ?? new List(); set { _Recipient = value; OnPropertyChanged("Recipient"); } } - private List _Recipient; + private List? _Recipient; protected internal override void CopyToInternal(Base other) { - var dest = other as RestrictionComponent; - - if (dest == null) - { + if(other is not RestrictionComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(RepetitionsElement != null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)RepetitionsElement.DeepCopyInternal(); - if(Period != null) dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopyInternal(); - if(Recipient.Any()) dest.Recipient = new List(Recipient.DeepCopyInternal()); + if(_RepetitionsElement is not null) dest.RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)_RepetitionsElement.DeepCopyInternal(); + if(_Period is not null) dest.Period = (Hl7.Fhir.Model.Period)_Period.DeepCopyInternal(); + if(_Recipient is not null) dest.Recipient = new List(_Recipient.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -269,48 +265,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as RestrictionComponent; - if(otherT == null) return false; + if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(RepetitionsElement, otherT.RepetitionsElement)) return false; - if(!comparer.Equals(Period, otherT.Period)) return false; - if(!comparer.ListEquals(Recipient, otherT.Recipient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + if(!comparer.Equals(_Period, otherT._Period)) return false; + if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "repetitions": - value = RepetitionsElement; - return RepetitionsElement is not null; + value = _RepetitionsElement; + return _RepetitionsElement is not null; case "period": - value = Period; - return Period is not null; + value = _Period; + return _Period is not null; case "recipient": - value = Recipient; - return Recipient?.Any() == true; + value = _Recipient; + return _Recipient?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "repetitions": - RepetitionsElement = (Hl7.Fhir.Model.PositiveInt)value; + RepetitionsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "period": - Period = (Hl7.Fhir.Model.Period)value; + Period = (Hl7.Fhir.Model.Period?)value; return this; case "recipient": - Recipient = (List)value; + Recipient = (List?)value!; return this; default: return base.SetValue(key, value); @@ -321,9 +317,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (RepetitionsElement is not null) yield return new KeyValuePair("repetitions",RepetitionsElement); - if (Period is not null) yield return new KeyValuePair("period",Period); - if (Recipient?.Any() == true) yield return new KeyValuePair("recipient",Recipient); + if (_RepetitionsElement is not null) yield return new KeyValuePair("repetitions",_RepetitionsElement); + if (_Period is not null) yield return new KeyValuePair("period",_Period); + if (_Recipient?.Any() == true) yield return new KeyValuePair("recipient",_Recipient); } } @@ -351,13 +347,13 @@ public partial class ParameterComponent : Hl7.Fhir.Model.BackboneElement [Binding("TransportInputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Content to use in performing the transport. @@ -367,26 +363,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Integer64),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.CodeableReference),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Availability),typeof(Hl7.Fhir.Model.ExtendedContactDetail),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as ParameterComponent; - - if (dest == null) - { + if(other is not ParameterComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -398,41 +390,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ParameterComponent; - if(otherT == null) return false; + if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -443,8 +435,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -472,13 +464,13 @@ public partial class OutputComponent : Hl7.Fhir.Model.BackboneElement [Binding("TransportOutputParameterType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Type + public Hl7.Fhir.Model.CodeableConcept? Type { get { return _Type; } set { _Type = value; OnPropertyChanged("Type"); } } - private Hl7.Fhir.Model.CodeableConcept _Type; + private Hl7.Fhir.Model.CodeableConcept? _Type; /// /// Result of output. @@ -488,26 +480,22 @@ public Hl7.Fhir.Model.CodeableConcept Type [AllowedTypes(typeof(Hl7.Fhir.Model.Base64Binary),typeof(Hl7.Fhir.Model.FhirBoolean),typeof(Hl7.Fhir.Model.Canonical),typeof(Hl7.Fhir.Model.Code),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime),typeof(Hl7.Fhir.Model.FhirDecimal),typeof(Hl7.Fhir.Model.Id),typeof(Hl7.Fhir.Model.Instant),typeof(Hl7.Fhir.Model.Integer),typeof(Hl7.Fhir.Model.Integer64),typeof(Hl7.Fhir.Model.Markdown),typeof(Hl7.Fhir.Model.Oid),typeof(Hl7.Fhir.Model.PositiveInt),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.Time),typeof(Hl7.Fhir.Model.UnsignedInt),typeof(Hl7.Fhir.Model.FhirUri),typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.Uuid),typeof(Hl7.Fhir.Model.Address),typeof(Hl7.Fhir.Model.Age),typeof(Hl7.Fhir.Model.Annotation),typeof(Hl7.Fhir.Model.Attachment),typeof(Hl7.Fhir.Model.CodeableConcept),typeof(Hl7.Fhir.Model.CodeableReference),typeof(Hl7.Fhir.Model.Coding),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.Count),typeof(Hl7.Fhir.Model.Distance),typeof(Hl7.Fhir.Model.Duration),typeof(Hl7.Fhir.Model.HumanName),typeof(Hl7.Fhir.Model.Identifier),typeof(Hl7.Fhir.Model.Money),typeof(Hl7.Fhir.Model.Period),typeof(Hl7.Fhir.Model.Quantity),typeof(Hl7.Fhir.Model.Range),typeof(Hl7.Fhir.Model.Ratio),typeof(Hl7.Fhir.Model.RatioRange),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.SampledData),typeof(Hl7.Fhir.Model.Signature),typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ContactDetail),typeof(Hl7.Fhir.Model.DataRequirement),typeof(Hl7.Fhir.Model.Expression),typeof(Hl7.Fhir.Model.ParameterDefinition),typeof(Hl7.Fhir.Model.RelatedArtifact),typeof(Hl7.Fhir.Model.TriggerDefinition),typeof(Hl7.Fhir.Model.UsageContext),typeof(Hl7.Fhir.Model.Availability),typeof(Hl7.Fhir.Model.ExtendedContactDetail),typeof(Hl7.Fhir.Model.Dosage),typeof(Hl7.Fhir.Model.Meta))] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.DataType Value + public Hl7.Fhir.Model.DataType? Value { get { return _Value; } set { _Value = value; OnPropertyChanged("Value"); } } - private Hl7.Fhir.Model.DataType _Value; + private Hl7.Fhir.Model.DataType? _Value; protected internal override void CopyToInternal(Base other) { - var dest = other as OutputComponent; - - if (dest == null) - { + if(other is not OutputComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Type != null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopyInternal(); - if(Value != null) dest.Value = (Hl7.Fhir.Model.DataType)Value.DeepCopyInternal(); + if(_Type is not null) dest.Type = (Hl7.Fhir.Model.CodeableConcept)_Type.DeepCopyInternal(); + if(_Value is not null) dest.Value = (Hl7.Fhir.Model.DataType)_Value.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -519,41 +507,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as OutputComponent; - if(otherT == null) return false; + if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Type, otherT.Type)) return false; - if(!comparer.Equals(Value, otherT.Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + if(!comparer.Equals(_Value, otherT._Value)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = Type; - return Type is not null; + value = _Type; + return _Type is not null; case "value": - value = Value; - return Value is not null; + value = _Value; + return _Value is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - Type = (Hl7.Fhir.Model.CodeableConcept)value; + Type = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "value": - Value = (Hl7.Fhir.Model.DataType)value; + Value = (Hl7.Fhir.Model.DataType?)value; return this; default: return base.SetValue(key, value); @@ -564,8 +552,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Type is not null) yield return new KeyValuePair("type",Type); - if (Value is not null) yield return new KeyValuePair("value",Value); + if (_Type is not null) yield return new KeyValuePair("type",_Type); + if (_Value is not null) yield return new KeyValuePair("value",_Value); } } @@ -578,39 +566,36 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// Formal definition of transport. /// [FhirElement("instantiatesCanonical", InSummary=true, Order=100)] [DataMember] - public Hl7.Fhir.Model.Canonical InstantiatesCanonicalElement + public Hl7.Fhir.Model.Canonical? InstantiatesCanonicalElement { get { return _InstantiatesCanonicalElement; } set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } - private Hl7.Fhir.Model.Canonical _InstantiatesCanonicalElement; + private Hl7.Fhir.Model.Canonical? _InstantiatesCanonicalElement; /// /// Formal definition of transport /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesCanonical + public string? InstantiatesCanonical { - get { return InstantiatesCanonicalElement != null ? InstantiatesCanonicalElement.Value : null; } + get => _InstantiatesCanonicalElement?.Value; set { - if (value == null) - InstantiatesCanonicalElement = null; - else - InstantiatesCanonicalElement = new Hl7.Fhir.Model.Canonical(value); + InstantiatesCanonicalElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("InstantiatesCanonical"); } } @@ -620,28 +605,25 @@ public string InstantiatesCanonical /// [FhirElement("instantiatesUri", InSummary=true, Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirUri InstantiatesUriElement + public Hl7.Fhir.Model.FhirUri? InstantiatesUriElement { get { return _InstantiatesUriElement; } set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } - private Hl7.Fhir.Model.FhirUri _InstantiatesUriElement; + private Hl7.Fhir.Model.FhirUri? _InstantiatesUriElement; /// /// Formal definition of transport /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string InstantiatesUri + public string? InstantiatesUri { - get { return InstantiatesUriElement != null ? InstantiatesUriElement.Value : null; } + get => _InstantiatesUriElement?.Value; set { - if (value == null) - InstantiatesUriElement = null; - else - InstantiatesUriElement = new Hl7.Fhir.Model.FhirUri(value); + InstantiatesUriElement = value is null ? null : new Hl7.Fhir.Model.FhirUri(value); OnPropertyChanged("InstantiatesUri"); } } @@ -656,24 +638,24 @@ public string InstantiatesUri [DataMember] public List BasedOn { - get { if(_BasedOn==null) _BasedOn = new List(); return _BasedOn; } + get => _BasedOn ?? new List(); set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } - private List _BasedOn; + private List? _BasedOn; /// /// Requisition or grouper id. /// [FhirElement("groupIdentifier", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.Identifier GroupIdentifier + public Hl7.Fhir.Model.Identifier? GroupIdentifier { get { return _GroupIdentifier; } set { _GroupIdentifier = value; OnPropertyChanged("GroupIdentifier"); } } - private Hl7.Fhir.Model.Identifier _GroupIdentifier; + private Hl7.Fhir.Model.Identifier? _GroupIdentifier; /// /// Part of referenced event. @@ -685,11 +667,11 @@ public Hl7.Fhir.Model.Identifier GroupIdentifier [DataMember] public List PartOf { - get { if(_PartOf==null) _PartOf = new List(); return _PartOf; } + get => _PartOf ?? new List(); set { _PartOf = value; OnPropertyChanged("PartOf"); } } - private List _PartOf; + private List? _PartOf; /// /// in-progress | completed | abandoned | cancelled | planned | entered-in-error. @@ -698,13 +680,13 @@ public List PartOf [DeclaredType(Type = typeof(Code))] [Binding("TransportStatus")] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// in-progress | completed | abandoned | cancelled | planned | entered-in-error @@ -713,13 +695,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.Transport.TransportStatus? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -730,13 +709,13 @@ public Hl7.Fhir.Model.Transport.TransportStatus? Status [FhirElement("statusReason", InSummary=true, Order=160)] [Binding("TransportStatusReason")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept StatusReason + public Hl7.Fhir.Model.CodeableConcept? StatusReason { get { return _StatusReason; } set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } - private Hl7.Fhir.Model.CodeableConcept _StatusReason; + private Hl7.Fhir.Model.CodeableConcept? _StatusReason; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option. @@ -746,13 +725,13 @@ public Hl7.Fhir.Model.CodeableConcept StatusReason [Binding("TransportIntent")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code IntentElement + public Code? IntentElement { get { return _IntentElement; } set { _IntentElement = value; OnPropertyChanged("IntentElement"); } } - private Code _IntentElement; + private Code? _IntentElement; /// /// unknown | proposal | plan | order | original-order | reflex-order | filler-order | instance-order | option @@ -761,13 +740,10 @@ public Code IntentElement [IgnoreDataMember] public Hl7.Fhir.Model.Transport.TransportIntent? Intent { - get { return IntentElement != null ? IntentElement.Value : null; } + get => _IntentElement?.Value; set { - if (value == null) - IntentElement = null; - else - IntentElement = new Code(value); + IntentElement = value is null ? null : new Code(value); OnPropertyChanged("Intent"); } } @@ -779,13 +755,13 @@ public Hl7.Fhir.Model.Transport.TransportIntent? Intent [DeclaredType(Type = typeof(Code))] [Binding("TransportPriority")] [DataMember] - public Code PriorityElement + public Code? PriorityElement { get { return _PriorityElement; } set { _PriorityElement = value; OnPropertyChanged("PriorityElement"); } } - private Code _PriorityElement; + private Code? _PriorityElement; /// /// routine | urgent | asap | stat @@ -794,13 +770,10 @@ public Code PriorityElement [IgnoreDataMember] public Hl7.Fhir.Model.RequestPriority? Priority { - get { return PriorityElement != null ? PriorityElement.Value : null; } + get => _PriorityElement?.Value; set { - if (value == null) - PriorityElement = null; - else - PriorityElement = new Code(value); + PriorityElement = value is null ? null : new Code(value); OnPropertyChanged("Priority"); } } @@ -811,41 +784,38 @@ public Hl7.Fhir.Model.RequestPriority? Priority [FhirElement("code", InSummary=true, Order=190, FiveWs="FiveWs.what[x]")] [Binding("TransportCode")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// Human-readable explanation of transport. /// [FhirElement("description", InSummary=true, Order=200)] [DataMember] - public Hl7.Fhir.Model.FhirString DescriptionElement + public Hl7.Fhir.Model.FhirString? DescriptionElement { get { return _DescriptionElement; } set { _DescriptionElement = value; OnPropertyChanged("DescriptionElement"); } } - private Hl7.Fhir.Model.FhirString _DescriptionElement; + private Hl7.Fhir.Model.FhirString? _DescriptionElement; /// /// Human-readable explanation of transport /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Description + public string? Description { - get { return DescriptionElement != null ? DescriptionElement.Value : null; } + get => _DescriptionElement?.Value; set { - if (value == null) - DescriptionElement = null; - else - DescriptionElement = new Hl7.Fhir.Model.FhirString(value); + DescriptionElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Description"); } } @@ -857,13 +827,13 @@ public string Description [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Focus + public Hl7.Fhir.Model.ResourceReference? Focus { get { return _Focus; } set { _Focus = value; OnPropertyChanged("Focus"); } } - private Hl7.Fhir.Model.ResourceReference _Focus; + private Hl7.Fhir.Model.ResourceReference? _Focus; /// /// Beneficiary of the Transport. @@ -872,13 +842,13 @@ public Hl7.Fhir.Model.ResourceReference Focus [CLSCompliant(false)] [References("Resource")] [DataMember] - public Hl7.Fhir.Model.ResourceReference For + public Hl7.Fhir.Model.ResourceReference? For { get { return _For; } set { _For = value; OnPropertyChanged("For"); } } - private Hl7.Fhir.Model.ResourceReference _For; + private Hl7.Fhir.Model.ResourceReference? _For; /// /// Healthcare event during which this transport originated. @@ -887,41 +857,38 @@ public Hl7.Fhir.Model.ResourceReference For [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// Completion time of the event (the occurrence). /// [FhirElement("completionTime", InSummary=true, Order=240, FiveWs="FiveWs.done[x]")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CompletionTimeElement + public Hl7.Fhir.Model.FhirDateTime? CompletionTimeElement { get { return _CompletionTimeElement; } set { _CompletionTimeElement = value; OnPropertyChanged("CompletionTimeElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CompletionTimeElement; + private Hl7.Fhir.Model.FhirDateTime? _CompletionTimeElement; /// /// Completion time of the event (the occurrence) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string CompletionTime + public string? CompletionTime { - get { return CompletionTimeElement != null ? CompletionTimeElement.Value : null; } + get => _CompletionTimeElement?.Value; set { - if (value == null) - CompletionTimeElement = null; - else - CompletionTimeElement = new Hl7.Fhir.Model.FhirDateTime(value); + CompletionTimeElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("CompletionTime"); } } @@ -931,28 +898,25 @@ public string CompletionTime /// [FhirElement("authoredOn", Order=250, FiveWs="FiveWs.recorded")] [DataMember] - public Hl7.Fhir.Model.FhirDateTime AuthoredOnElement + public Hl7.Fhir.Model.FhirDateTime? AuthoredOnElement { get { return _AuthoredOnElement; } set { _AuthoredOnElement = value; OnPropertyChanged("AuthoredOnElement"); } } - private Hl7.Fhir.Model.FhirDateTime _AuthoredOnElement; + private Hl7.Fhir.Model.FhirDateTime? _AuthoredOnElement; /// /// Transport Creation Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string AuthoredOn + public string? AuthoredOn { - get { return AuthoredOnElement != null ? AuthoredOnElement.Value : null; } + get => _AuthoredOnElement?.Value; set { - if (value == null) - AuthoredOnElement = null; - else - AuthoredOnElement = new Hl7.Fhir.Model.FhirDateTime(value); + AuthoredOnElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("AuthoredOn"); } } @@ -962,28 +926,25 @@ public string AuthoredOn /// [FhirElement("lastModified", InSummary=true, Order=260)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastModifiedElement + public Hl7.Fhir.Model.FhirDateTime? LastModifiedElement { get { return _LastModifiedElement; } set { _LastModifiedElement = value; OnPropertyChanged("LastModifiedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastModifiedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastModifiedElement; /// /// Transport Last Modified Date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastModified + public string? LastModified { - get { return LastModifiedElement != null ? LastModifiedElement.Value : null; } + get => _LastModifiedElement?.Value; set { - if (value == null) - LastModifiedElement = null; - else - LastModifiedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastModifiedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastModified"); } } @@ -995,13 +956,13 @@ public string LastModified [CLSCompliant(false)] [References("Device","Organization","Patient","Practitioner","PractitionerRole","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Requester + public Hl7.Fhir.Model.ResourceReference? Requester { get { return _Requester; } set { _Requester = value; OnPropertyChanged("Requester"); } } - private Hl7.Fhir.Model.ResourceReference _Requester; + private Hl7.Fhir.Model.ResourceReference? _Requester; /// /// Requested performer. @@ -1012,11 +973,11 @@ public Hl7.Fhir.Model.ResourceReference Requester [DataMember] public List PerformerType { - get { if(_PerformerType==null) _PerformerType = new List(); return _PerformerType; } + get => _PerformerType ?? new List(); set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } - private List _PerformerType; + private List? _PerformerType; /// /// Responsible individual. @@ -1025,13 +986,13 @@ public List PerformerType [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization","CareTeam","HealthcareService","Patient","Device","RelatedPerson")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Owner + public Hl7.Fhir.Model.ResourceReference? Owner { get { return _Owner; } set { _Owner = value; OnPropertyChanged("Owner"); } } - private Hl7.Fhir.Model.ResourceReference _Owner; + private Hl7.Fhir.Model.ResourceReference? _Owner; /// /// Where transport occurs. @@ -1040,13 +1001,13 @@ public Hl7.Fhir.Model.ResourceReference Owner [CLSCompliant(false)] [References("Location")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Location + public Hl7.Fhir.Model.ResourceReference? Location { get { return _Location; } set { _Location = value; OnPropertyChanged("Location"); } } - private Hl7.Fhir.Model.ResourceReference _Location; + private Hl7.Fhir.Model.ResourceReference? _Location; /// /// Associated insurance coverage. @@ -1058,11 +1019,11 @@ public Hl7.Fhir.Model.ResourceReference Location [DataMember] public List Insurance { - get { if(_Insurance==null) _Insurance = new List(); return _Insurance; } + get => _Insurance ?? new List(); set { _Insurance = value; OnPropertyChanged("Insurance"); } } - private List _Insurance; + private List? _Insurance; /// /// Comments made about the transport. @@ -1072,11 +1033,11 @@ public List Insurance [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; /// /// Key events in history of the Transport. @@ -1088,24 +1049,24 @@ public List Note [DataMember] public List RelevantHistory { - get { if(_RelevantHistory==null) _RelevantHistory = new List(); return _RelevantHistory; } + get => _RelevantHistory ?? new List(); set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } - private List _RelevantHistory; + private List? _RelevantHistory; /// /// Constraints on fulfillment transports. /// [FhirElement("restriction", Order=340)] [DataMember] - public Hl7.Fhir.Model.Transport.RestrictionComponent Restriction + public Hl7.Fhir.Model.Transport.RestrictionComponent? Restriction { get { return _Restriction; } set { _Restriction = value; OnPropertyChanged("Restriction"); } } - private Hl7.Fhir.Model.Transport.RestrictionComponent _Restriction; + private Hl7.Fhir.Model.Transport.RestrictionComponent? _Restriction; /// /// Information used to perform transport. @@ -1115,11 +1076,11 @@ public Hl7.Fhir.Model.Transport.RestrictionComponent Restriction [DataMember] public List Input { - get { if(_Input==null) _Input = new List(); return _Input; } + get => _Input ?? new List(); set { _Input = value; OnPropertyChanged("Input"); } } - private List _Input; + private List? _Input; /// /// Information produced as part of transport. @@ -1129,11 +1090,11 @@ public List Input [DataMember] public List Output { - get { if(_Output==null) _Output = new List(); return _Output; } + get => _Output ?? new List(); set { _Output = value; OnPropertyChanged("Output"); } } - private List _Output; + private List? _Output; /// /// The desired location. @@ -1143,13 +1104,13 @@ public List Output [References("Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference RequestedLocation + public Hl7.Fhir.Model.ResourceReference? RequestedLocation { get { return _RequestedLocation; } set { _RequestedLocation = value; OnPropertyChanged("RequestedLocation"); } } - private Hl7.Fhir.Model.ResourceReference _RequestedLocation; + private Hl7.Fhir.Model.ResourceReference? _RequestedLocation; /// /// The entity current location. @@ -1159,13 +1120,13 @@ public Hl7.Fhir.Model.ResourceReference RequestedLocation [References("Location")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference CurrentLocation + public Hl7.Fhir.Model.ResourceReference? CurrentLocation { get { return _CurrentLocation; } set { _CurrentLocation = value; OnPropertyChanged("CurrentLocation"); } } - private Hl7.Fhir.Model.ResourceReference _CurrentLocation; + private Hl7.Fhir.Model.ResourceReference? _CurrentLocation; /// /// Why transport is needed. @@ -1173,13 +1134,13 @@ public Hl7.Fhir.Model.ResourceReference CurrentLocation [FhirElement("reason", Order=390, FiveWs="FiveWs.why[x]")] [Binding("TransportReason")] [DataMember] - public Hl7.Fhir.Model.CodeableReference Reason + public Hl7.Fhir.Model.CodeableReference? Reason { get { return _Reason; } set { _Reason = value; OnPropertyChanged("Reason"); } } - private Hl7.Fhir.Model.CodeableReference _Reason; + private Hl7.Fhir.Model.CodeableReference? _Reason; /// /// Parent (or preceding) transport. @@ -1188,58 +1149,54 @@ public Hl7.Fhir.Model.CodeableReference Reason [CLSCompliant(false)] [References("Transport")] [DataMember] - public Hl7.Fhir.Model.ResourceReference History + public Hl7.Fhir.Model.ResourceReference? History { get { return _History; } set { _History = value; OnPropertyChanged("History"); } } - private Hl7.Fhir.Model.ResourceReference _History; + private Hl7.Fhir.Model.ResourceReference? _History; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as Transport; - - if (dest == null) - { + if(other is not Transport dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(InstantiatesCanonicalElement != null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)InstantiatesCanonicalElement.DeepCopyInternal(); - if(InstantiatesUriElement != null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)InstantiatesUriElement.DeepCopyInternal(); - if(BasedOn.Any()) dest.BasedOn = new List(BasedOn.DeepCopyInternal()); - if(GroupIdentifier != null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)GroupIdentifier.DeepCopyInternal(); - if(PartOf.Any()) dest.PartOf = new List(PartOf.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusReason != null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)StatusReason.DeepCopyInternal(); - if(IntentElement != null) dest.IntentElement = (Code)IntentElement.DeepCopyInternal(); - if(PriorityElement != null) dest.PriorityElement = (Code)PriorityElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(DescriptionElement != null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopyInternal(); - if(Focus != null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)Focus.DeepCopyInternal(); - if(For != null) dest.For = (Hl7.Fhir.Model.ResourceReference)For.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(CompletionTimeElement != null) dest.CompletionTimeElement = (Hl7.Fhir.Model.FhirDateTime)CompletionTimeElement.DeepCopyInternal(); - if(AuthoredOnElement != null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopyInternal(); - if(LastModifiedElement != null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)LastModifiedElement.DeepCopyInternal(); - if(Requester != null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)Requester.DeepCopyInternal(); - if(PerformerType.Any()) dest.PerformerType = new List(PerformerType.DeepCopyInternal()); - if(Owner != null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)Owner.DeepCopyInternal(); - if(Location != null) dest.Location = (Hl7.Fhir.Model.ResourceReference)Location.DeepCopyInternal(); - if(Insurance.Any()) dest.Insurance = new List(Insurance.DeepCopyInternal()); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); - if(RelevantHistory.Any()) dest.RelevantHistory = new List(RelevantHistory.DeepCopyInternal()); - if(Restriction != null) dest.Restriction = (Hl7.Fhir.Model.Transport.RestrictionComponent)Restriction.DeepCopyInternal(); - if(Input.Any()) dest.Input = new List(Input.DeepCopyInternal()); - if(Output.Any()) dest.Output = new List(Output.DeepCopyInternal()); - if(RequestedLocation != null) dest.RequestedLocation = (Hl7.Fhir.Model.ResourceReference)RequestedLocation.DeepCopyInternal(); - if(CurrentLocation != null) dest.CurrentLocation = (Hl7.Fhir.Model.ResourceReference)CurrentLocation.DeepCopyInternal(); - if(Reason != null) dest.Reason = (Hl7.Fhir.Model.CodeableReference)Reason.DeepCopyInternal(); - if(History != null) dest.History = (Hl7.Fhir.Model.ResourceReference)History.DeepCopyInternal(); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_InstantiatesCanonicalElement is not null) dest.InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)_InstantiatesCanonicalElement.DeepCopyInternal(); + if(_InstantiatesUriElement is not null) dest.InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)_InstantiatesUriElement.DeepCopyInternal(); + if(_BasedOn is not null) dest.BasedOn = new List(_BasedOn.DeepCopyInternal()); + if(_GroupIdentifier is not null) dest.GroupIdentifier = (Hl7.Fhir.Model.Identifier)_GroupIdentifier.DeepCopyInternal(); + if(_PartOf is not null) dest.PartOf = new List(_PartOf.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusReason is not null) dest.StatusReason = (Hl7.Fhir.Model.CodeableConcept)_StatusReason.DeepCopyInternal(); + if(_IntentElement is not null) dest.IntentElement = (Code)_IntentElement.DeepCopyInternal(); + if(_PriorityElement is not null) dest.PriorityElement = (Code)_PriorityElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_DescriptionElement is not null) dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)_DescriptionElement.DeepCopyInternal(); + if(_Focus is not null) dest.Focus = (Hl7.Fhir.Model.ResourceReference)_Focus.DeepCopyInternal(); + if(_For is not null) dest.For = (Hl7.Fhir.Model.ResourceReference)_For.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_CompletionTimeElement is not null) dest.CompletionTimeElement = (Hl7.Fhir.Model.FhirDateTime)_CompletionTimeElement.DeepCopyInternal(); + if(_AuthoredOnElement is not null) dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)_AuthoredOnElement.DeepCopyInternal(); + if(_LastModifiedElement is not null) dest.LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)_LastModifiedElement.DeepCopyInternal(); + if(_Requester is not null) dest.Requester = (Hl7.Fhir.Model.ResourceReference)_Requester.DeepCopyInternal(); + if(_PerformerType is not null) dest.PerformerType = new List(_PerformerType.DeepCopyInternal()); + if(_Owner is not null) dest.Owner = (Hl7.Fhir.Model.ResourceReference)_Owner.DeepCopyInternal(); + if(_Location is not null) dest.Location = (Hl7.Fhir.Model.ResourceReference)_Location.DeepCopyInternal(); + if(_Insurance is not null) dest.Insurance = new List(_Insurance.DeepCopyInternal()); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); + if(_RelevantHistory is not null) dest.RelevantHistory = new List(_RelevantHistory.DeepCopyInternal()); + if(_Restriction is not null) dest.Restriction = (Hl7.Fhir.Model.Transport.RestrictionComponent)_Restriction.DeepCopyInternal(); + if(_Input is not null) dest.Input = new List(_Input.DeepCopyInternal()); + if(_Output is not null) dest.Output = new List(_Output.DeepCopyInternal()); + if(_RequestedLocation is not null) dest.RequestedLocation = (Hl7.Fhir.Model.ResourceReference)_RequestedLocation.DeepCopyInternal(); + if(_CurrentLocation is not null) dest.CurrentLocation = (Hl7.Fhir.Model.ResourceReference)_CurrentLocation.DeepCopyInternal(); + if(_Reason is not null) dest.Reason = (Hl7.Fhir.Model.CodeableReference)_Reason.DeepCopyInternal(); + if(_History is not null) dest.History = (Hl7.Fhir.Model.ResourceReference)_History.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -1251,251 +1208,251 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as Transport; - if(otherT == null) return false; + if(other is not Transport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(InstantiatesCanonicalElement, otherT.InstantiatesCanonicalElement)) return false; - if(!comparer.Equals(InstantiatesUriElement, otherT.InstantiatesUriElement)) return false; - if(!comparer.ListEquals(BasedOn, otherT.BasedOn)) return false; - if(!comparer.Equals(GroupIdentifier, otherT.GroupIdentifier)) return false; - if(!comparer.ListEquals(PartOf, otherT.PartOf)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusReason, otherT.StatusReason)) return false; - if(!comparer.Equals(IntentElement, otherT.IntentElement)) return false; - if(!comparer.Equals(PriorityElement, otherT.PriorityElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(DescriptionElement, otherT.DescriptionElement)) return false; - if(!comparer.Equals(Focus, otherT.Focus)) return false; - if(!comparer.Equals(For, otherT.For)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(CompletionTimeElement, otherT.CompletionTimeElement)) return false; - if(!comparer.Equals(AuthoredOnElement, otherT.AuthoredOnElement)) return false; - if(!comparer.Equals(LastModifiedElement, otherT.LastModifiedElement)) return false; - if(!comparer.Equals(Requester, otherT.Requester)) return false; - if(!comparer.ListEquals(PerformerType, otherT.PerformerType)) return false; - if(!comparer.Equals(Owner, otherT.Owner)) return false; - if(!comparer.Equals(Location, otherT.Location)) return false; - if(!comparer.ListEquals(Insurance, otherT.Insurance)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; - if(!comparer.ListEquals(RelevantHistory, otherT.RelevantHistory)) return false; - if(!comparer.Equals(Restriction, otherT.Restriction)) return false; - if(!comparer.ListEquals(Input, otherT.Input)) return false; - if(!comparer.ListEquals(Output, otherT.Output)) return false; - if(!comparer.Equals(RequestedLocation, otherT.RequestedLocation)) return false; - if(!comparer.Equals(CurrentLocation, otherT.CurrentLocation)) return false; - if(!comparer.Equals(Reason, otherT.Reason)) return false; - if(!comparer.Equals(History, otherT.History)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; + if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; + if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; + if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; + if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; + if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; + if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + if(!comparer.Equals(_Focus, otherT._Focus)) return false; + if(!comparer.Equals(_For, otherT._For)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_CompletionTimeElement, otherT._CompletionTimeElement)) return false; + if(!comparer.Equals(_AuthoredOnElement, otherT._AuthoredOnElement)) return false; + if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; + if(!comparer.Equals(_Requester, otherT._Requester)) return false; + if(!comparer.ListEquals(_PerformerType, otherT._PerformerType)) return false; + if(!comparer.Equals(_Owner, otherT._Owner)) return false; + if(!comparer.Equals(_Location, otherT._Location)) return false; + if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; + if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; + if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; + if(!comparer.ListEquals(_Input, otherT._Input)) return false; + if(!comparer.ListEquals(_Output, otherT._Output)) return false; + if(!comparer.Equals(_RequestedLocation, otherT._RequestedLocation)) return false; + if(!comparer.Equals(_CurrentLocation, otherT._CurrentLocation)) return false; + if(!comparer.Equals(_Reason, otherT._Reason)) return false; + if(!comparer.Equals(_History, otherT._History)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "instantiatesCanonical": - value = InstantiatesCanonicalElement; - return InstantiatesCanonicalElement is not null; + value = _InstantiatesCanonicalElement; + return _InstantiatesCanonicalElement is not null; case "instantiatesUri": - value = InstantiatesUriElement; - return InstantiatesUriElement is not null; + value = _InstantiatesUriElement; + return _InstantiatesUriElement is not null; case "basedOn": - value = BasedOn; - return BasedOn?.Any() == true; + value = _BasedOn; + return _BasedOn?.Any() == true; case "groupIdentifier": - value = GroupIdentifier; - return GroupIdentifier is not null; + value = _GroupIdentifier; + return _GroupIdentifier is not null; case "partOf": - value = PartOf; - return PartOf?.Any() == true; + value = _PartOf; + return _PartOf?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusReason": - value = StatusReason; - return StatusReason is not null; + value = _StatusReason; + return _StatusReason is not null; case "intent": - value = IntentElement; - return IntentElement is not null; + value = _IntentElement; + return _IntentElement is not null; case "priority": - value = PriorityElement; - return PriorityElement is not null; + value = _PriorityElement; + return _PriorityElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "description": - value = DescriptionElement; - return DescriptionElement is not null; + value = _DescriptionElement; + return _DescriptionElement is not null; case "focus": - value = Focus; - return Focus is not null; + value = _Focus; + return _Focus is not null; case "for": - value = For; - return For is not null; + value = _For; + return _For is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "completionTime": - value = CompletionTimeElement; - return CompletionTimeElement is not null; + value = _CompletionTimeElement; + return _CompletionTimeElement is not null; case "authoredOn": - value = AuthoredOnElement; - return AuthoredOnElement is not null; + value = _AuthoredOnElement; + return _AuthoredOnElement is not null; case "lastModified": - value = LastModifiedElement; - return LastModifiedElement is not null; + value = _LastModifiedElement; + return _LastModifiedElement is not null; case "requester": - value = Requester; - return Requester is not null; + value = _Requester; + return _Requester is not null; case "performerType": - value = PerformerType; - return PerformerType?.Any() == true; + value = _PerformerType; + return _PerformerType?.Any() == true; case "owner": - value = Owner; - return Owner is not null; + value = _Owner; + return _Owner is not null; case "location": - value = Location; - return Location is not null; + value = _Location; + return _Location is not null; case "insurance": - value = Insurance; - return Insurance?.Any() == true; + value = _Insurance; + return _Insurance?.Any() == true; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; case "relevantHistory": - value = RelevantHistory; - return RelevantHistory?.Any() == true; + value = _RelevantHistory; + return _RelevantHistory?.Any() == true; case "restriction": - value = Restriction; - return Restriction is not null; + value = _Restriction; + return _Restriction is not null; case "input": - value = Input; - return Input?.Any() == true; + value = _Input; + return _Input?.Any() == true; case "output": - value = Output; - return Output?.Any() == true; + value = _Output; + return _Output?.Any() == true; case "requestedLocation": - value = RequestedLocation; - return RequestedLocation is not null; + value = _RequestedLocation; + return _RequestedLocation is not null; case "currentLocation": - value = CurrentLocation; - return CurrentLocation is not null; + value = _CurrentLocation; + return _CurrentLocation is not null; case "reason": - value = Reason; - return Reason is not null; + value = _Reason; + return _Reason is not null; case "history": - value = History; - return History is not null; + value = _History; + return _History is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "instantiatesCanonical": - InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical)value; + InstantiatesCanonicalElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "instantiatesUri": - InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri)value; + InstantiatesUriElement = (Hl7.Fhir.Model.FhirUri?)value; return this; case "basedOn": - BasedOn = (List)value; + BasedOn = (List?)value!; return this; case "groupIdentifier": - GroupIdentifier = (Hl7.Fhir.Model.Identifier)value; + GroupIdentifier = (Hl7.Fhir.Model.Identifier?)value; return this; case "partOf": - PartOf = (List)value; + PartOf = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusReason": - StatusReason = (Hl7.Fhir.Model.CodeableConcept)value; + StatusReason = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "intent": - IntentElement = (Code)value; + IntentElement = (Code?)value; return this; case "priority": - PriorityElement = (Code)value; + PriorityElement = (Code?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "description": - DescriptionElement = (Hl7.Fhir.Model.FhirString)value; + DescriptionElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "focus": - Focus = (Hl7.Fhir.Model.ResourceReference)value; + Focus = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "for": - For = (Hl7.Fhir.Model.ResourceReference)value; + For = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "completionTime": - CompletionTimeElement = (Hl7.Fhir.Model.FhirDateTime)value; + CompletionTimeElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "authoredOn": - AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)value; + AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "lastModified": - LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastModifiedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "requester": - Requester = (Hl7.Fhir.Model.ResourceReference)value; + Requester = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "performerType": - PerformerType = (List)value; + PerformerType = (List?)value!; return this; case "owner": - Owner = (Hl7.Fhir.Model.ResourceReference)value; + Owner = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "location": - Location = (Hl7.Fhir.Model.ResourceReference)value; + Location = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "insurance": - Insurance = (List)value; + Insurance = (List?)value!; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; case "relevantHistory": - RelevantHistory = (List)value; + RelevantHistory = (List?)value!; return this; case "restriction": - Restriction = (Hl7.Fhir.Model.Transport.RestrictionComponent)value; + Restriction = (Hl7.Fhir.Model.Transport.RestrictionComponent?)value; return this; case "input": - Input = (List)value; + Input = (List?)value!; return this; case "output": - Output = (List)value; + Output = (List?)value!; return this; case "requestedLocation": - RequestedLocation = (Hl7.Fhir.Model.ResourceReference)value; + RequestedLocation = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "currentLocation": - CurrentLocation = (Hl7.Fhir.Model.ResourceReference)value; + CurrentLocation = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "reason": - Reason = (Hl7.Fhir.Model.CodeableReference)value; + Reason = (Hl7.Fhir.Model.CodeableReference?)value; return this; case "history": - History = (Hl7.Fhir.Model.ResourceReference)value; + History = (Hl7.Fhir.Model.ResourceReference?)value; return this; default: return base.SetValue(key, value); @@ -1506,38 +1463,38 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",InstantiatesCanonicalElement); - if (InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",InstantiatesUriElement); - if (BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",BasedOn); - if (GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",GroupIdentifier); - if (PartOf?.Any() == true) yield return new KeyValuePair("partOf",PartOf); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusReason is not null) yield return new KeyValuePair("statusReason",StatusReason); - if (IntentElement is not null) yield return new KeyValuePair("intent",IntentElement); - if (PriorityElement is not null) yield return new KeyValuePair("priority",PriorityElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (DescriptionElement is not null) yield return new KeyValuePair("description",DescriptionElement); - if (Focus is not null) yield return new KeyValuePair("focus",Focus); - if (For is not null) yield return new KeyValuePair("for",For); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (CompletionTimeElement is not null) yield return new KeyValuePair("completionTime",CompletionTimeElement); - if (AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",AuthoredOnElement); - if (LastModifiedElement is not null) yield return new KeyValuePair("lastModified",LastModifiedElement); - if (Requester is not null) yield return new KeyValuePair("requester",Requester); - if (PerformerType?.Any() == true) yield return new KeyValuePair("performerType",PerformerType); - if (Owner is not null) yield return new KeyValuePair("owner",Owner); - if (Location is not null) yield return new KeyValuePair("location",Location); - if (Insurance?.Any() == true) yield return new KeyValuePair("insurance",Insurance); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); - if (RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",RelevantHistory); - if (Restriction is not null) yield return new KeyValuePair("restriction",Restriction); - if (Input?.Any() == true) yield return new KeyValuePair("input",Input); - if (Output?.Any() == true) yield return new KeyValuePair("output",Output); - if (RequestedLocation is not null) yield return new KeyValuePair("requestedLocation",RequestedLocation); - if (CurrentLocation is not null) yield return new KeyValuePair("currentLocation",CurrentLocation); - if (Reason is not null) yield return new KeyValuePair("reason",Reason); - if (History is not null) yield return new KeyValuePair("history",History); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_InstantiatesCanonicalElement is not null) yield return new KeyValuePair("instantiatesCanonical",_InstantiatesCanonicalElement); + if (_InstantiatesUriElement is not null) yield return new KeyValuePair("instantiatesUri",_InstantiatesUriElement); + if (_BasedOn?.Any() == true) yield return new KeyValuePair("basedOn",_BasedOn); + if (_GroupIdentifier is not null) yield return new KeyValuePair("groupIdentifier",_GroupIdentifier); + if (_PartOf?.Any() == true) yield return new KeyValuePair("partOf",_PartOf); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusReason is not null) yield return new KeyValuePair("statusReason",_StatusReason); + if (_IntentElement is not null) yield return new KeyValuePair("intent",_IntentElement); + if (_PriorityElement is not null) yield return new KeyValuePair("priority",_PriorityElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_DescriptionElement is not null) yield return new KeyValuePair("description",_DescriptionElement); + if (_Focus is not null) yield return new KeyValuePair("focus",_Focus); + if (_For is not null) yield return new KeyValuePair("for",_For); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_CompletionTimeElement is not null) yield return new KeyValuePair("completionTime",_CompletionTimeElement); + if (_AuthoredOnElement is not null) yield return new KeyValuePair("authoredOn",_AuthoredOnElement); + if (_LastModifiedElement is not null) yield return new KeyValuePair("lastModified",_LastModifiedElement); + if (_Requester is not null) yield return new KeyValuePair("requester",_Requester); + if (_PerformerType?.Any() == true) yield return new KeyValuePair("performerType",_PerformerType); + if (_Owner is not null) yield return new KeyValuePair("owner",_Owner); + if (_Location is not null) yield return new KeyValuePair("location",_Location); + if (_Insurance?.Any() == true) yield return new KeyValuePair("insurance",_Insurance); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); + if (_RelevantHistory?.Any() == true) yield return new KeyValuePair("relevantHistory",_RelevantHistory); + if (_Restriction is not null) yield return new KeyValuePair("restriction",_Restriction); + if (_Input?.Any() == true) yield return new KeyValuePair("input",_Input); + if (_Output?.Any() == true) yield return new KeyValuePair("output",_Output); + if (_RequestedLocation is not null) yield return new KeyValuePair("requestedLocation",_RequestedLocation); + if (_CurrentLocation is not null) yield return new KeyValuePair("currentLocation",_CurrentLocation); + if (_Reason is not null) yield return new KeyValuePair("reason",_Reason); + if (_History is not null) yield return new KeyValuePair("history",_History); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs index 66fe96c90..0298f26d2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -126,13 +129,13 @@ public enum TriggerType [Binding("TriggerType")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code TypeElement + public Code? TypeElement { get { return _TypeElement; } set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } - private Code _TypeElement; + private Code? _TypeElement; /// /// named-event | periodic | data-changed | data-added | data-modified | data-removed | data-accessed | data-access-ended @@ -141,13 +144,10 @@ public Code TypeElement [IgnoreDataMember] public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type { - get { return TypeElement != null ? TypeElement.Value : null; } + get => _TypeElement?.Value; set { - if (value == null) - TypeElement = null; - else - TypeElement = new Code(value); + TypeElement = value is null ? null : new Code(value); OnPropertyChanged("Type"); } } @@ -157,28 +157,25 @@ public Hl7.Fhir.Model.TriggerDefinition.TriggerType? Type /// [FhirElement("name", InSummary=true, Order=40)] [DataMember] - public Hl7.Fhir.Model.FhirString NameElement + public Hl7.Fhir.Model.FhirString? NameElement { get { return _NameElement; } set { _NameElement = value; OnPropertyChanged("NameElement"); } } - private Hl7.Fhir.Model.FhirString _NameElement; + private Hl7.Fhir.Model.FhirString? _NameElement; /// /// Name or URI that identifies the event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Name + public string? Name { - get { return NameElement != null ? NameElement.Value : null; } + get => _NameElement?.Value; set { - if (value == null) - NameElement = null; - else - NameElement = new Hl7.Fhir.Model.FhirString(value); + NameElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Name"); } } @@ -188,41 +185,38 @@ public string Name /// [FhirElement("code", InSummary=true, Order=50)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Code + public Hl7.Fhir.Model.CodeableConcept? Code { get { return _Code; } set { _Code = value; OnPropertyChanged("Code"); } } - private Hl7.Fhir.Model.CodeableConcept _Code; + private Hl7.Fhir.Model.CodeableConcept? _Code; /// /// What event. /// [FhirElement("subscriptionTopic", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.Canonical SubscriptionTopicElement + public Hl7.Fhir.Model.Canonical? SubscriptionTopicElement { get { return _SubscriptionTopicElement; } set { _SubscriptionTopicElement = value; OnPropertyChanged("SubscriptionTopicElement"); } } - private Hl7.Fhir.Model.Canonical _SubscriptionTopicElement; + private Hl7.Fhir.Model.Canonical? _SubscriptionTopicElement; /// /// What event /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SubscriptionTopic + public string? SubscriptionTopic { - get { return SubscriptionTopicElement != null ? SubscriptionTopicElement.Value : null; } + get => _SubscriptionTopicElement?.Value; set { - if (value == null) - SubscriptionTopicElement = null; - else - SubscriptionTopicElement = new Hl7.Fhir.Model.Canonical(value); + SubscriptionTopicElement = value is null ? null : new Hl7.Fhir.Model.Canonical(value); OnPropertyChanged("SubscriptionTopic"); } } @@ -235,13 +229,13 @@ public string SubscriptionTopic [References("Schedule")] [AllowedTypes(typeof(Hl7.Fhir.Model.Timing),typeof(Hl7.Fhir.Model.ResourceReference),typeof(Hl7.Fhir.Model.Date),typeof(Hl7.Fhir.Model.FhirDateTime))] [DataMember] - public Hl7.Fhir.Model.DataType Timing + public Hl7.Fhir.Model.DataType? Timing { get { return _Timing; } set { _Timing = value; OnPropertyChanged("Timing"); } } - private Hl7.Fhir.Model.DataType _Timing; + private Hl7.Fhir.Model.DataType? _Timing; /// /// Triggering data of the event (multiple = 'and'). @@ -251,42 +245,38 @@ public Hl7.Fhir.Model.DataType Timing [DataMember] public List Data { - get { if(_Data==null) _Data = new List(); return _Data; } + get => _Data ?? new List(); set { _Data = value; OnPropertyChanged("Data"); } } - private List _Data; + private List? _Data; /// /// Whether the event triggers (boolean expression). /// [FhirElement("condition", InSummary=true, Order=90)] [DataMember] - public Hl7.Fhir.Model.Expression Condition + public Hl7.Fhir.Model.Expression? Condition { get { return _Condition; } set { _Condition = value; OnPropertyChanged("Condition"); } } - private Hl7.Fhir.Model.Expression _Condition; + private Hl7.Fhir.Model.Expression? _Condition; protected internal override void CopyToInternal(Base other) { - var dest = other as TriggerDefinition; - - if (dest == null) - { + if(other is not TriggerDefinition dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(TypeElement != null) dest.TypeElement = (Code)TypeElement.DeepCopyInternal(); - if(NameElement != null) dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopyInternal(); - if(Code != null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopyInternal(); - if(SubscriptionTopicElement != null) dest.SubscriptionTopicElement = (Hl7.Fhir.Model.Canonical)SubscriptionTopicElement.DeepCopyInternal(); - if(Timing != null) dest.Timing = (Hl7.Fhir.Model.DataType)Timing.DeepCopyInternal(); - if(Data.Any()) dest.Data = new List(Data.DeepCopyInternal()); - if(Condition != null) dest.Condition = (Hl7.Fhir.Model.Expression)Condition.DeepCopyInternal(); + if(_TypeElement is not null) dest.TypeElement = (Code)_TypeElement.DeepCopyInternal(); + if(_NameElement is not null) dest.NameElement = (Hl7.Fhir.Model.FhirString)_NameElement.DeepCopyInternal(); + if(_Code is not null) dest.Code = (Hl7.Fhir.Model.CodeableConcept)_Code.DeepCopyInternal(); + if(_SubscriptionTopicElement is not null) dest.SubscriptionTopicElement = (Hl7.Fhir.Model.Canonical)_SubscriptionTopicElement.DeepCopyInternal(); + if(_Timing is not null) dest.Timing = (Hl7.Fhir.Model.DataType)_Timing.DeepCopyInternal(); + if(_Data is not null) dest.Data = new List(_Data.DeepCopyInternal()); + if(_Condition is not null) dest.Condition = (Hl7.Fhir.Model.Expression)_Condition.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -298,76 +288,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as TriggerDefinition; - if(otherT == null) return false; + if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(TypeElement, otherT.TypeElement)) return false; - if(!comparer.Equals(NameElement, otherT.NameElement)) return false; - if(!comparer.Equals(Code, otherT.Code)) return false; - if(!comparer.Equals(SubscriptionTopicElement, otherT.SubscriptionTopicElement)) return false; - if(!comparer.Equals(Timing, otherT.Timing)) return false; - if(!comparer.ListEquals(Data, otherT.Data)) return false; - if(!comparer.Equals(Condition, otherT.Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + if(!comparer.Equals(_Code, otherT._Code)) return false; + if(!comparer.Equals(_SubscriptionTopicElement, otherT._SubscriptionTopicElement)) return false; + if(!comparer.Equals(_Timing, otherT._Timing)) return false; + if(!comparer.ListEquals(_Data, otherT._Data)) return false; + if(!comparer.Equals(_Condition, otherT._Condition)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "type": - value = TypeElement; - return TypeElement is not null; + value = _TypeElement; + return _TypeElement is not null; case "name": - value = NameElement; - return NameElement is not null; + value = _NameElement; + return _NameElement is not null; case "code": - value = Code; - return Code is not null; + value = _Code; + return _Code is not null; case "subscriptionTopic": - value = SubscriptionTopicElement; - return SubscriptionTopicElement is not null; + value = _SubscriptionTopicElement; + return _SubscriptionTopicElement is not null; case "timing": - value = Timing; - return Timing is not null; + value = _Timing; + return _Timing is not null; case "data": - value = Data; - return Data?.Any() == true; + value = _Data; + return _Data?.Any() == true; case "condition": - value = Condition; - return Condition is not null; + value = _Condition; + return _Condition is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "type": - TypeElement = (Code)value; + TypeElement = (Code?)value; return this; case "name": - NameElement = (Hl7.Fhir.Model.FhirString)value; + NameElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "code": - Code = (Hl7.Fhir.Model.CodeableConcept)value; + Code = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "subscriptionTopic": - SubscriptionTopicElement = (Hl7.Fhir.Model.Canonical)value; + SubscriptionTopicElement = (Hl7.Fhir.Model.Canonical?)value; return this; case "timing": - Timing = (Hl7.Fhir.Model.DataType)value; + Timing = (Hl7.Fhir.Model.DataType?)value; return this; case "data": - Data = (List)value; + Data = (List?)value!; return this; case "condition": - Condition = (Hl7.Fhir.Model.Expression)value; + Condition = (Hl7.Fhir.Model.Expression?)value; return this; default: return base.SetValue(key, value); @@ -378,13 +368,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (TypeElement is not null) yield return new KeyValuePair("type",TypeElement); - if (NameElement is not null) yield return new KeyValuePair("name",NameElement); - if (Code is not null) yield return new KeyValuePair("code",Code); - if (SubscriptionTopicElement is not null) yield return new KeyValuePair("subscriptionTopic",SubscriptionTopicElement); - if (Timing is not null) yield return new KeyValuePair("timing",Timing); - if (Data?.Any() == true) yield return new KeyValuePair("data",Data); - if (Condition is not null) yield return new KeyValuePair("condition",Condition); + if (_TypeElement is not null) yield return new KeyValuePair("type",_TypeElement); + if (_NameElement is not null) yield return new KeyValuePair("name",_NameElement); + if (_Code is not null) yield return new KeyValuePair("code",_Code); + if (_SubscriptionTopicElement is not null) yield return new KeyValuePair("subscriptionTopic",_SubscriptionTopicElement); + if (_Timing is not null) yield return new KeyValuePair("timing",_Timing); + if (_Data?.Any() == true) yield return new KeyValuePair("data",_Data); + if (_Condition is not null) yield return new KeyValuePair("condition",_Condition); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs index 1b6fb680d..497087ceb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -128,13 +131,13 @@ public partial class PrimarySourceComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Organization","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// Type of primary source (License Board; Primary Education; Continuing Education; Postal Service; Relationship owner; Registration Authority; legal source; issuing source; authoritative source). @@ -145,11 +148,11 @@ public Hl7.Fhir.Model.ResourceReference Who [DataMember] public List Type { - get { if(_Type==null) _Type = new List(); return _Type; } + get => _Type ?? new List(); set { _Type = value; OnPropertyChanged("Type"); } } - private List _Type; + private List? _Type; /// /// Method for exchanging information with the primary source. @@ -160,11 +163,11 @@ public List Type [DataMember] public List CommunicationMethod { - get { if(_CommunicationMethod==null) _CommunicationMethod = new List(); return _CommunicationMethod; } + get => _CommunicationMethod ?? new List(); set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } - private List _CommunicationMethod; + private List? _CommunicationMethod; /// /// successful | failed | unknown. @@ -172,41 +175,38 @@ public List CommunicationMethod [FhirElement("validationStatus", Order=70)] [Binding("validation-status")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ValidationStatus + public Hl7.Fhir.Model.CodeableConcept? ValidationStatus { get { return _ValidationStatus; } set { _ValidationStatus = value; OnPropertyChanged("ValidationStatus"); } } - private Hl7.Fhir.Model.CodeableConcept _ValidationStatus; + private Hl7.Fhir.Model.CodeableConcept? _ValidationStatus; /// /// When the target was validated against the primary source. /// [FhirElement("validationDate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime ValidationDateElement + public Hl7.Fhir.Model.FhirDateTime? ValidationDateElement { get { return _ValidationDateElement; } set { _ValidationDateElement = value; OnPropertyChanged("ValidationDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _ValidationDateElement; + private Hl7.Fhir.Model.FhirDateTime? _ValidationDateElement; /// /// When the target was validated against the primary source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ValidationDate + public string? ValidationDate { - get { return ValidationDateElement != null ? ValidationDateElement.Value : null; } + get => _ValidationDateElement?.Value; set { - if (value == null) - ValidationDateElement = null; - else - ValidationDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + ValidationDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("ValidationDate"); } } @@ -217,13 +217,13 @@ public string ValidationDate [FhirElement("canPushUpdates", InSummary=true, Order=90)] [Binding("can-push-updates")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CanPushUpdates + public Hl7.Fhir.Model.CodeableConcept? CanPushUpdates { get { return _CanPushUpdates; } set { _CanPushUpdates = value; OnPropertyChanged("CanPushUpdates"); } } - private Hl7.Fhir.Model.CodeableConcept _CanPushUpdates; + private Hl7.Fhir.Model.CodeableConcept? _CanPushUpdates; /// /// specific | any | source. @@ -234,29 +234,25 @@ public Hl7.Fhir.Model.CodeableConcept CanPushUpdates [DataMember] public List PushTypeAvailable { - get { if(_PushTypeAvailable==null) _PushTypeAvailable = new List(); return _PushTypeAvailable; } + get => _PushTypeAvailable ?? new List(); set { _PushTypeAvailable = value; OnPropertyChanged("PushTypeAvailable"); } } - private List _PushTypeAvailable; + private List? _PushTypeAvailable; protected internal override void CopyToInternal(Base other) { - var dest = other as PrimarySourceComponent; - - if (dest == null) - { + if(other is not PrimarySourceComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(Type.Any()) dest.Type = new List(Type.DeepCopyInternal()); - if(CommunicationMethod.Any()) dest.CommunicationMethod = new List(CommunicationMethod.DeepCopyInternal()); - if(ValidationStatus != null) dest.ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)ValidationStatus.DeepCopyInternal(); - if(ValidationDateElement != null) dest.ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)ValidationDateElement.DeepCopyInternal(); - if(CanPushUpdates != null) dest.CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)CanPushUpdates.DeepCopyInternal(); - if(PushTypeAvailable.Any()) dest.PushTypeAvailable = new List(PushTypeAvailable.DeepCopyInternal()); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_Type is not null) dest.Type = new List(_Type.DeepCopyInternal()); + if(_CommunicationMethod is not null) dest.CommunicationMethod = new List(_CommunicationMethod.DeepCopyInternal()); + if(_ValidationStatus is not null) dest.ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)_ValidationStatus.DeepCopyInternal(); + if(_ValidationDateElement is not null) dest.ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)_ValidationDateElement.DeepCopyInternal(); + if(_CanPushUpdates is not null) dest.CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)_CanPushUpdates.DeepCopyInternal(); + if(_PushTypeAvailable is not null) dest.PushTypeAvailable = new List(_PushTypeAvailable.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -268,76 +264,76 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrimarySourceComponent; - if(otherT == null) return false; + if(other is not PrimarySourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.ListEquals(Type, otherT.Type)) return false; - if(!comparer.ListEquals(CommunicationMethod, otherT.CommunicationMethod)) return false; - if(!comparer.Equals(ValidationStatus, otherT.ValidationStatus)) return false; - if(!comparer.Equals(ValidationDateElement, otherT.ValidationDateElement)) return false; - if(!comparer.Equals(CanPushUpdates, otherT.CanPushUpdates)) return false; - if(!comparer.ListEquals(PushTypeAvailable, otherT.PushTypeAvailable)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.ListEquals(_Type, otherT._Type)) return false; + if(!comparer.ListEquals(_CommunicationMethod, otherT._CommunicationMethod)) return false; + if(!comparer.Equals(_ValidationStatus, otherT._ValidationStatus)) return false; + if(!comparer.Equals(_ValidationDateElement, otherT._ValidationDateElement)) return false; + if(!comparer.Equals(_CanPushUpdates, otherT._CanPushUpdates)) return false; + if(!comparer.ListEquals(_PushTypeAvailable, otherT._PushTypeAvailable)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "type": - value = Type; - return Type?.Any() == true; + value = _Type; + return _Type?.Any() == true; case "communicationMethod": - value = CommunicationMethod; - return CommunicationMethod?.Any() == true; + value = _CommunicationMethod; + return _CommunicationMethod?.Any() == true; case "validationStatus": - value = ValidationStatus; - return ValidationStatus is not null; + value = _ValidationStatus; + return _ValidationStatus is not null; case "validationDate": - value = ValidationDateElement; - return ValidationDateElement is not null; + value = _ValidationDateElement; + return _ValidationDateElement is not null; case "canPushUpdates": - value = CanPushUpdates; - return CanPushUpdates is not null; + value = _CanPushUpdates; + return _CanPushUpdates is not null; case "pushTypeAvailable": - value = PushTypeAvailable; - return PushTypeAvailable?.Any() == true; + value = _PushTypeAvailable; + return _PushTypeAvailable?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "type": - Type = (List)value; + Type = (List?)value!; return this; case "communicationMethod": - CommunicationMethod = (List)value; + CommunicationMethod = (List?)value!; return this; case "validationStatus": - ValidationStatus = (Hl7.Fhir.Model.CodeableConcept)value; + ValidationStatus = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "validationDate": - ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + ValidationDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "canPushUpdates": - CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept)value; + CanPushUpdates = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "pushTypeAvailable": - PushTypeAvailable = (List)value; + PushTypeAvailable = (List?)value!; return this; default: return base.SetValue(key, value); @@ -348,13 +344,13 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Who is not null) yield return new KeyValuePair("who",Who); - if (Type?.Any() == true) yield return new KeyValuePair("type",Type); - if (CommunicationMethod?.Any() == true) yield return new KeyValuePair("communicationMethod",CommunicationMethod); - if (ValidationStatus is not null) yield return new KeyValuePair("validationStatus",ValidationStatus); - if (ValidationDateElement is not null) yield return new KeyValuePair("validationDate",ValidationDateElement); - if (CanPushUpdates is not null) yield return new KeyValuePair("canPushUpdates",CanPushUpdates); - if (PushTypeAvailable?.Any() == true) yield return new KeyValuePair("pushTypeAvailable",PushTypeAvailable); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_Type?.Any() == true) yield return new KeyValuePair("type",_Type); + if (_CommunicationMethod?.Any() == true) yield return new KeyValuePair("communicationMethod",_CommunicationMethod); + if (_ValidationStatus is not null) yield return new KeyValuePair("validationStatus",_ValidationStatus); + if (_ValidationDateElement is not null) yield return new KeyValuePair("validationDate",_ValidationDateElement); + if (_CanPushUpdates is not null) yield return new KeyValuePair("canPushUpdates",_CanPushUpdates); + if (_PushTypeAvailable?.Any() == true) yield return new KeyValuePair("pushTypeAvailable",_PushTypeAvailable); } } @@ -379,13 +375,13 @@ public partial class AttestationComponent : Hl7.Fhir.Model.BackboneElement [CLSCompliant(false)] [References("Practitioner","PractitionerRole","Organization")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Who + public Hl7.Fhir.Model.ResourceReference? Who { get { return _Who; } set { _Who = value; OnPropertyChanged("Who"); } } - private Hl7.Fhir.Model.ResourceReference _Who; + private Hl7.Fhir.Model.ResourceReference? _Who; /// /// When the who is asserting on behalf of another (organization or individual). @@ -394,13 +390,13 @@ public Hl7.Fhir.Model.ResourceReference Who [CLSCompliant(false)] [References("Organization","Practitioner","PractitionerRole")] [DataMember] - public Hl7.Fhir.Model.ResourceReference OnBehalfOf + public Hl7.Fhir.Model.ResourceReference? OnBehalfOf { get { return _OnBehalfOf; } set { _OnBehalfOf = value; OnPropertyChanged("OnBehalfOf"); } } - private Hl7.Fhir.Model.ResourceReference _OnBehalfOf; + private Hl7.Fhir.Model.ResourceReference? _OnBehalfOf; /// /// The method by which attested information was submitted/retrieved. @@ -408,41 +404,38 @@ public Hl7.Fhir.Model.ResourceReference OnBehalfOf [FhirElement("communicationMethod", InSummary=true, Order=60)] [Binding("communication-method")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept CommunicationMethod + public Hl7.Fhir.Model.CodeableConcept? CommunicationMethod { get { return _CommunicationMethod; } set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } - private Hl7.Fhir.Model.CodeableConcept _CommunicationMethod; + private Hl7.Fhir.Model.CodeableConcept? _CommunicationMethod; /// /// The date the information was attested to. /// [FhirElement("date", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.Date DateElement + public Hl7.Fhir.Model.Date? DateElement { get { return _DateElement; } set { _DateElement = value; OnPropertyChanged("DateElement"); } } - private Hl7.Fhir.Model.Date _DateElement; + private Hl7.Fhir.Model.Date? _DateElement; /// /// The date the information was attested to /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Date + public string? Date { - get { return DateElement != null ? DateElement.Value : null; } + get => _DateElement?.Value; set { - if (value == null) - DateElement = null; - else - DateElement = new Hl7.Fhir.Model.Date(value); + DateElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("Date"); } } @@ -452,28 +445,25 @@ public string Date /// [FhirElement("sourceIdentityCertificate", Order=80)] [DataMember] - public Hl7.Fhir.Model.FhirString SourceIdentityCertificateElement + public Hl7.Fhir.Model.FhirString? SourceIdentityCertificateElement { get { return _SourceIdentityCertificateElement; } set { _SourceIdentityCertificateElement = value; OnPropertyChanged("SourceIdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _SourceIdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _SourceIdentityCertificateElement; /// /// A digital identity certificate associated with the attestation source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SourceIdentityCertificate + public string? SourceIdentityCertificate { - get { return SourceIdentityCertificateElement != null ? SourceIdentityCertificateElement.Value : null; } + get => _SourceIdentityCertificateElement?.Value; set { - if (value == null) - SourceIdentityCertificateElement = null; - else - SourceIdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + SourceIdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SourceIdentityCertificate"); } } @@ -483,28 +473,25 @@ public string SourceIdentityCertificate /// [FhirElement("proxyIdentityCertificate", Order=90)] [DataMember] - public Hl7.Fhir.Model.FhirString ProxyIdentityCertificateElement + public Hl7.Fhir.Model.FhirString? ProxyIdentityCertificateElement { get { return _ProxyIdentityCertificateElement; } set { _ProxyIdentityCertificateElement = value; OnPropertyChanged("ProxyIdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _ProxyIdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _ProxyIdentityCertificateElement; /// /// A digital identity certificate associated with the proxy entity submitting attested information on behalf of the attestation source /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string ProxyIdentityCertificate + public string? ProxyIdentityCertificate { - get { return ProxyIdentityCertificateElement != null ? ProxyIdentityCertificateElement.Value : null; } + get => _ProxyIdentityCertificateElement?.Value; set { - if (value == null) - ProxyIdentityCertificateElement = null; - else - ProxyIdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + ProxyIdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("ProxyIdentityCertificate"); } } @@ -514,45 +501,41 @@ public string ProxyIdentityCertificate /// [FhirElement("proxySignature", Order=100)] [DataMember] - public Hl7.Fhir.Model.Signature ProxySignature + public Hl7.Fhir.Model.Signature? ProxySignature { get { return _ProxySignature; } set { _ProxySignature = value; OnPropertyChanged("ProxySignature"); } } - private Hl7.Fhir.Model.Signature _ProxySignature; + private Hl7.Fhir.Model.Signature? _ProxySignature; /// /// Attester signature (digital or image). /// [FhirElement("sourceSignature", Order=110)] [DataMember] - public Hl7.Fhir.Model.Signature SourceSignature + public Hl7.Fhir.Model.Signature? SourceSignature { get { return _SourceSignature; } set { _SourceSignature = value; OnPropertyChanged("SourceSignature"); } } - private Hl7.Fhir.Model.Signature _SourceSignature; + private Hl7.Fhir.Model.Signature? _SourceSignature; protected internal override void CopyToInternal(Base other) { - var dest = other as AttestationComponent; - - if (dest == null) - { + if(other is not AttestationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Who != null) dest.Who = (Hl7.Fhir.Model.ResourceReference)Who.DeepCopyInternal(); - if(OnBehalfOf != null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)OnBehalfOf.DeepCopyInternal(); - if(CommunicationMethod != null) dest.CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)CommunicationMethod.DeepCopyInternal(); - if(DateElement != null) dest.DateElement = (Hl7.Fhir.Model.Date)DateElement.DeepCopyInternal(); - if(SourceIdentityCertificateElement != null) dest.SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)SourceIdentityCertificateElement.DeepCopyInternal(); - if(ProxyIdentityCertificateElement != null) dest.ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)ProxyIdentityCertificateElement.DeepCopyInternal(); - if(ProxySignature != null) dest.ProxySignature = (Hl7.Fhir.Model.Signature)ProxySignature.DeepCopyInternal(); - if(SourceSignature != null) dest.SourceSignature = (Hl7.Fhir.Model.Signature)SourceSignature.DeepCopyInternal(); + if(_Who is not null) dest.Who = (Hl7.Fhir.Model.ResourceReference)_Who.DeepCopyInternal(); + if(_OnBehalfOf is not null) dest.OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)_OnBehalfOf.DeepCopyInternal(); + if(_CommunicationMethod is not null) dest.CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)_CommunicationMethod.DeepCopyInternal(); + if(_DateElement is not null) dest.DateElement = (Hl7.Fhir.Model.Date)_DateElement.DeepCopyInternal(); + if(_SourceIdentityCertificateElement is not null) dest.SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_SourceIdentityCertificateElement.DeepCopyInternal(); + if(_ProxyIdentityCertificateElement is not null) dest.ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_ProxyIdentityCertificateElement.DeepCopyInternal(); + if(_ProxySignature is not null) dest.ProxySignature = (Hl7.Fhir.Model.Signature)_ProxySignature.DeepCopyInternal(); + if(_SourceSignature is not null) dest.SourceSignature = (Hl7.Fhir.Model.Signature)_SourceSignature.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -564,83 +547,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as AttestationComponent; - if(otherT == null) return false; + if(other is not AttestationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Who, otherT.Who)) return false; - if(!comparer.Equals(OnBehalfOf, otherT.OnBehalfOf)) return false; - if(!comparer.Equals(CommunicationMethod, otherT.CommunicationMethod)) return false; - if(!comparer.Equals(DateElement, otherT.DateElement)) return false; - if(!comparer.Equals(SourceIdentityCertificateElement, otherT.SourceIdentityCertificateElement)) return false; - if(!comparer.Equals(ProxyIdentityCertificateElement, otherT.ProxyIdentityCertificateElement)) return false; - if(!comparer.Equals(ProxySignature, otherT.ProxySignature)) return false; - if(!comparer.Equals(SourceSignature, otherT.SourceSignature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; + if(!comparer.Equals(_CommunicationMethod, otherT._CommunicationMethod)) return false; + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + if(!comparer.Equals(_SourceIdentityCertificateElement, otherT._SourceIdentityCertificateElement)) return false; + if(!comparer.Equals(_ProxyIdentityCertificateElement, otherT._ProxyIdentityCertificateElement)) return false; + if(!comparer.Equals(_ProxySignature, otherT._ProxySignature)) return false; + if(!comparer.Equals(_SourceSignature, otherT._SourceSignature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "who": - value = Who; - return Who is not null; + value = _Who; + return _Who is not null; case "onBehalfOf": - value = OnBehalfOf; - return OnBehalfOf is not null; + value = _OnBehalfOf; + return _OnBehalfOf is not null; case "communicationMethod": - value = CommunicationMethod; - return CommunicationMethod is not null; + value = _CommunicationMethod; + return _CommunicationMethod is not null; case "date": - value = DateElement; - return DateElement is not null; + value = _DateElement; + return _DateElement is not null; case "sourceIdentityCertificate": - value = SourceIdentityCertificateElement; - return SourceIdentityCertificateElement is not null; + value = _SourceIdentityCertificateElement; + return _SourceIdentityCertificateElement is not null; case "proxyIdentityCertificate": - value = ProxyIdentityCertificateElement; - return ProxyIdentityCertificateElement is not null; + value = _ProxyIdentityCertificateElement; + return _ProxyIdentityCertificateElement is not null; case "proxySignature": - value = ProxySignature; - return ProxySignature is not null; + value = _ProxySignature; + return _ProxySignature is not null; case "sourceSignature": - value = SourceSignature; - return SourceSignature is not null; + value = _SourceSignature; + return _SourceSignature is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "who": - Who = (Hl7.Fhir.Model.ResourceReference)value; + Who = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "onBehalfOf": - OnBehalfOf = (Hl7.Fhir.Model.ResourceReference)value; + OnBehalfOf = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "communicationMethod": - CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept)value; + CommunicationMethod = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "date": - DateElement = (Hl7.Fhir.Model.Date)value; + DateElement = (Hl7.Fhir.Model.Date?)value; return this; case "sourceIdentityCertificate": - SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + SourceIdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "proxyIdentityCertificate": - ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + ProxyIdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "proxySignature": - ProxySignature = (Hl7.Fhir.Model.Signature)value; + ProxySignature = (Hl7.Fhir.Model.Signature?)value; return this; case "sourceSignature": - SourceSignature = (Hl7.Fhir.Model.Signature)value; + SourceSignature = (Hl7.Fhir.Model.Signature?)value; return this; default: return base.SetValue(key, value); @@ -651,14 +634,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Who is not null) yield return new KeyValuePair("who",Who); - if (OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",OnBehalfOf); - if (CommunicationMethod is not null) yield return new KeyValuePair("communicationMethod",CommunicationMethod); - if (DateElement is not null) yield return new KeyValuePair("date",DateElement); - if (SourceIdentityCertificateElement is not null) yield return new KeyValuePair("sourceIdentityCertificate",SourceIdentityCertificateElement); - if (ProxyIdentityCertificateElement is not null) yield return new KeyValuePair("proxyIdentityCertificate",ProxyIdentityCertificateElement); - if (ProxySignature is not null) yield return new KeyValuePair("proxySignature",ProxySignature); - if (SourceSignature is not null) yield return new KeyValuePair("sourceSignature",SourceSignature); + if (_Who is not null) yield return new KeyValuePair("who",_Who); + if (_OnBehalfOf is not null) yield return new KeyValuePair("onBehalfOf",_OnBehalfOf); + if (_CommunicationMethod is not null) yield return new KeyValuePair("communicationMethod",_CommunicationMethod); + if (_DateElement is not null) yield return new KeyValuePair("date",_DateElement); + if (_SourceIdentityCertificateElement is not null) yield return new KeyValuePair("sourceIdentityCertificate",_SourceIdentityCertificateElement); + if (_ProxyIdentityCertificateElement is not null) yield return new KeyValuePair("proxyIdentityCertificate",_ProxyIdentityCertificateElement); + if (_ProxySignature is not null) yield return new KeyValuePair("proxySignature",_ProxySignature); + if (_SourceSignature is not null) yield return new KeyValuePair("sourceSignature",_SourceSignature); } } @@ -684,41 +667,38 @@ public partial class ValidatorComponent : Hl7.Fhir.Model.BackboneElement [References("Organization")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Organization + public Hl7.Fhir.Model.ResourceReference? Organization { get { return _Organization; } set { _Organization = value; OnPropertyChanged("Organization"); } } - private Hl7.Fhir.Model.ResourceReference _Organization; + private Hl7.Fhir.Model.ResourceReference? _Organization; /// /// A digital identity certificate associated with the validator. /// [FhirElement("identityCertificate", Order=50)] [DataMember] - public Hl7.Fhir.Model.FhirString IdentityCertificateElement + public Hl7.Fhir.Model.FhirString? IdentityCertificateElement { get { return _IdentityCertificateElement; } set { _IdentityCertificateElement = value; OnPropertyChanged("IdentityCertificateElement"); } } - private Hl7.Fhir.Model.FhirString _IdentityCertificateElement; + private Hl7.Fhir.Model.FhirString? _IdentityCertificateElement; /// /// A digital identity certificate associated with the validator /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string IdentityCertificate + public string? IdentityCertificate { - get { return IdentityCertificateElement != null ? IdentityCertificateElement.Value : null; } + get => _IdentityCertificateElement?.Value; set { - if (value == null) - IdentityCertificateElement = null; - else - IdentityCertificateElement = new Hl7.Fhir.Model.FhirString(value); + IdentityCertificateElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("IdentityCertificate"); } } @@ -728,27 +708,23 @@ public string IdentityCertificate /// [FhirElement("attestationSignature", Order=60)] [DataMember] - public Hl7.Fhir.Model.Signature AttestationSignature + public Hl7.Fhir.Model.Signature? AttestationSignature { get { return _AttestationSignature; } set { _AttestationSignature = value; OnPropertyChanged("AttestationSignature"); } } - private Hl7.Fhir.Model.Signature _AttestationSignature; + private Hl7.Fhir.Model.Signature? _AttestationSignature; protected internal override void CopyToInternal(Base other) { - var dest = other as ValidatorComponent; - - if (dest == null) - { + if(other is not ValidatorComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Organization != null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopyInternal(); - if(IdentityCertificateElement != null) dest.IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)IdentityCertificateElement.DeepCopyInternal(); - if(AttestationSignature != null) dest.AttestationSignature = (Hl7.Fhir.Model.Signature)AttestationSignature.DeepCopyInternal(); + if(_Organization is not null) dest.Organization = (Hl7.Fhir.Model.ResourceReference)_Organization.DeepCopyInternal(); + if(_IdentityCertificateElement is not null) dest.IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)_IdentityCertificateElement.DeepCopyInternal(); + if(_AttestationSignature is not null) dest.AttestationSignature = (Hl7.Fhir.Model.Signature)_AttestationSignature.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -760,48 +736,48 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as ValidatorComponent; - if(otherT == null) return false; + if(other is not ValidatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Organization, otherT.Organization)) return false; - if(!comparer.Equals(IdentityCertificateElement, otherT.IdentityCertificateElement)) return false; - if(!comparer.Equals(AttestationSignature, otherT.AttestationSignature)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Organization, otherT._Organization)) return false; + if(!comparer.Equals(_IdentityCertificateElement, otherT._IdentityCertificateElement)) return false; + if(!comparer.Equals(_AttestationSignature, otherT._AttestationSignature)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "organization": - value = Organization; - return Organization is not null; + value = _Organization; + return _Organization is not null; case "identityCertificate": - value = IdentityCertificateElement; - return IdentityCertificateElement is not null; + value = _IdentityCertificateElement; + return _IdentityCertificateElement is not null; case "attestationSignature": - value = AttestationSignature; - return AttestationSignature is not null; + value = _AttestationSignature; + return _AttestationSignature is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "organization": - Organization = (Hl7.Fhir.Model.ResourceReference)value; + Organization = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "identityCertificate": - IdentityCertificateElement = (Hl7.Fhir.Model.FhirString)value; + IdentityCertificateElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "attestationSignature": - AttestationSignature = (Hl7.Fhir.Model.Signature)value; + AttestationSignature = (Hl7.Fhir.Model.Signature?)value; return this; default: return base.SetValue(key, value); @@ -812,9 +788,9 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Organization is not null) yield return new KeyValuePair("organization",Organization); - if (IdentityCertificateElement is not null) yield return new KeyValuePair("identityCertificate",IdentityCertificateElement); - if (AttestationSignature is not null) yield return new KeyValuePair("attestationSignature",AttestationSignature); + if (_Organization is not null) yield return new KeyValuePair("organization",_Organization); + if (_IdentityCertificateElement is not null) yield return new KeyValuePair("identityCertificate",_IdentityCertificateElement); + if (_AttestationSignature is not null) yield return new KeyValuePair("attestationSignature",_AttestationSignature); } } @@ -829,11 +805,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get { if(_Target==null) _Target = new List(); return _Target; } + get => _Target ?? new List(); set { _Target = value; OnPropertyChanged("Target"); } } - private List _Target; + private List? _Target; /// /// The fhirpath location(s) within the resource that was validated. @@ -843,24 +819,24 @@ public List Target [DataMember] public List TargetLocationElement { - get { if(_TargetLocationElement==null) _TargetLocationElement = new List(); return _TargetLocationElement; } + get => _TargetLocationElement ?? new List(); set { _TargetLocationElement = value; OnPropertyChanged("TargetLocationElement"); } } - private List _TargetLocationElement; + private List? _TargetLocationElement; /// /// The fhirpath location(s) within the resource that was validated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable TargetLocation + public IEnumerable? TargetLocation { - get { return TargetLocationElement != null ? TargetLocationElement.Select(elem => elem.Value) : null; } + get => _TargetLocationElement?.Select(elem => elem.Value); set { if (value == null) - TargetLocationElement = null; + TargetLocationElement = null!; else TargetLocationElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirString(elem))); OnPropertyChanged("TargetLocation"); @@ -873,13 +849,13 @@ public IEnumerable TargetLocation [FhirElement("need", InSummary=true, Order=110)] [Binding("need")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Need + public Hl7.Fhir.Model.CodeableConcept? Need { get { return _Need; } set { _Need = value; OnPropertyChanged("Need"); } } - private Hl7.Fhir.Model.CodeableConcept _Need; + private Hl7.Fhir.Model.CodeableConcept? _Need; /// /// attested | validated | in-process | req-revalid | val-fail | reval-fail | entered-in-error. @@ -889,13 +865,13 @@ public Hl7.Fhir.Model.CodeableConcept Need [Binding("status")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// attested | validated | in-process | req-revalid | val-fail | reval-fail | entered-in-error @@ -904,13 +880,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.VerificationResult.StatusCode? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -920,28 +893,25 @@ public Hl7.Fhir.Model.VerificationResult.StatusCode? Status /// [FhirElement("statusDate", InSummary=true, Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime StatusDateElement + public Hl7.Fhir.Model.FhirDateTime? StatusDateElement { get { return _StatusDateElement; } set { _StatusDateElement = value; OnPropertyChanged("StatusDateElement"); } } - private Hl7.Fhir.Model.FhirDateTime _StatusDateElement; + private Hl7.Fhir.Model.FhirDateTime? _StatusDateElement; /// /// When the validation status was updated /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string StatusDate + public string? StatusDate { - get { return StatusDateElement != null ? StatusDateElement.Value : null; } + get => _StatusDateElement?.Value; set { - if (value == null) - StatusDateElement = null; - else - StatusDateElement = new Hl7.Fhir.Model.FhirDateTime(value); + StatusDateElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("StatusDate"); } } @@ -952,13 +922,13 @@ public string StatusDate [FhirElement("validationType", InSummary=true, Order=140)] [Binding("validation-type")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept ValidationType + public Hl7.Fhir.Model.CodeableConcept? ValidationType { get { return _ValidationType; } set { _ValidationType = value; OnPropertyChanged("ValidationType"); } } - private Hl7.Fhir.Model.CodeableConcept _ValidationType; + private Hl7.Fhir.Model.CodeableConcept? _ValidationType; /// /// The primary process by which the target is validated (edit check; value set; primary source; multiple sources; standalone; in context). @@ -969,52 +939,49 @@ public Hl7.Fhir.Model.CodeableConcept ValidationType [DataMember] public List ValidationProcess { - get { if(_ValidationProcess==null) _ValidationProcess = new List(); return _ValidationProcess; } + get => _ValidationProcess ?? new List(); set { _ValidationProcess = value; OnPropertyChanged("ValidationProcess"); } } - private List _ValidationProcess; + private List? _ValidationProcess; /// /// Frequency of revalidation. /// [FhirElement("frequency", Order=160)] [DataMember] - public Hl7.Fhir.Model.Timing Frequency + public Hl7.Fhir.Model.Timing? Frequency { get { return _Frequency; } set { _Frequency = value; OnPropertyChanged("Frequency"); } } - private Hl7.Fhir.Model.Timing _Frequency; + private Hl7.Fhir.Model.Timing? _Frequency; /// /// The date/time validation was last completed (including failed validations). /// [FhirElement("lastPerformed", Order=170)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime LastPerformedElement + public Hl7.Fhir.Model.FhirDateTime? LastPerformedElement { get { return _LastPerformedElement; } set { _LastPerformedElement = value; OnPropertyChanged("LastPerformedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _LastPerformedElement; + private Hl7.Fhir.Model.FhirDateTime? _LastPerformedElement; /// /// The date/time validation was last completed (including failed validations) /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string LastPerformed + public string? LastPerformed { - get { return LastPerformedElement != null ? LastPerformedElement.Value : null; } + get => _LastPerformedElement?.Value; set { - if (value == null) - LastPerformedElement = null; - else - LastPerformedElement = new Hl7.Fhir.Model.FhirDateTime(value); + LastPerformedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("LastPerformed"); } } @@ -1024,28 +991,25 @@ public string LastPerformed /// [FhirElement("nextScheduled", Order=180)] [DataMember] - public Hl7.Fhir.Model.Date NextScheduledElement + public Hl7.Fhir.Model.Date? NextScheduledElement { get { return _NextScheduledElement; } set { _NextScheduledElement = value; OnPropertyChanged("NextScheduledElement"); } } - private Hl7.Fhir.Model.Date _NextScheduledElement; + private Hl7.Fhir.Model.Date? _NextScheduledElement; /// /// The date when target is next validated, if appropriate /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string NextScheduled + public string? NextScheduled { - get { return NextScheduledElement != null ? NextScheduledElement.Value : null; } + get => _NextScheduledElement?.Value; set { - if (value == null) - NextScheduledElement = null; - else - NextScheduledElement = new Hl7.Fhir.Model.Date(value); + NextScheduledElement = value is null ? null : new Hl7.Fhir.Model.Date(value); OnPropertyChanged("NextScheduled"); } } @@ -1056,13 +1020,13 @@ public string NextScheduled [FhirElement("failureAction", InSummary=true, Order=190)] [Binding("failure-action")] [DataMember] - public Hl7.Fhir.Model.CodeableConcept FailureAction + public Hl7.Fhir.Model.CodeableConcept? FailureAction { get { return _FailureAction; } set { _FailureAction = value; OnPropertyChanged("FailureAction"); } } - private Hl7.Fhir.Model.CodeableConcept _FailureAction; + private Hl7.Fhir.Model.CodeableConcept? _FailureAction; /// /// Information about the primary source(s) involved in validation. @@ -1072,24 +1036,24 @@ public Hl7.Fhir.Model.CodeableConcept FailureAction [DataMember] public List PrimarySource { - get { if(_PrimarySource==null) _PrimarySource = new List(); return _PrimarySource; } + get => _PrimarySource ?? new List(); set { _PrimarySource = value; OnPropertyChanged("PrimarySource"); } } - private List _PrimarySource; + private List? _PrimarySource; /// /// Information about the entity attesting to information. /// [FhirElement("attestation", Order=210)] [DataMember] - public Hl7.Fhir.Model.VerificationResult.AttestationComponent Attestation + public Hl7.Fhir.Model.VerificationResult.AttestationComponent? Attestation { get { return _Attestation; } set { _Attestation = value; OnPropertyChanged("Attestation"); } } - private Hl7.Fhir.Model.VerificationResult.AttestationComponent _Attestation; + private Hl7.Fhir.Model.VerificationResult.AttestationComponent? _Attestation; /// /// Information about the entity validating information. @@ -1099,36 +1063,32 @@ public Hl7.Fhir.Model.VerificationResult.AttestationComponent Attestation [DataMember] public List Validator { - get { if(_Validator==null) _Validator = new List(); return _Validator; } + get => _Validator ?? new List(); set { _Validator = value; OnPropertyChanged("Validator"); } } - private List _Validator; + private List? _Validator; protected internal override void CopyToInternal(Base other) { - var dest = other as VerificationResult; - - if (dest == null) - { + if(other is not VerificationResult dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Target.Any()) dest.Target = new List(Target.DeepCopyInternal()); - if(TargetLocationElement.Any()) dest.TargetLocationElement = new List(TargetLocationElement.DeepCopyInternal()); - if(Need != null) dest.Need = (Hl7.Fhir.Model.CodeableConcept)Need.DeepCopyInternal(); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(StatusDateElement != null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)StatusDateElement.DeepCopyInternal(); - if(ValidationType != null) dest.ValidationType = (Hl7.Fhir.Model.CodeableConcept)ValidationType.DeepCopyInternal(); - if(ValidationProcess.Any()) dest.ValidationProcess = new List(ValidationProcess.DeepCopyInternal()); - if(Frequency != null) dest.Frequency = (Hl7.Fhir.Model.Timing)Frequency.DeepCopyInternal(); - if(LastPerformedElement != null) dest.LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)LastPerformedElement.DeepCopyInternal(); - if(NextScheduledElement != null) dest.NextScheduledElement = (Hl7.Fhir.Model.Date)NextScheduledElement.DeepCopyInternal(); - if(FailureAction != null) dest.FailureAction = (Hl7.Fhir.Model.CodeableConcept)FailureAction.DeepCopyInternal(); - if(PrimarySource.Any()) dest.PrimarySource = new List(PrimarySource.DeepCopyInternal()); - if(Attestation != null) dest.Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)Attestation.DeepCopyInternal(); - if(Validator.Any()) dest.Validator = new List(Validator.DeepCopyInternal()); + if(_Target is not null) dest.Target = new List(_Target.DeepCopyInternal()); + if(_TargetLocationElement is not null) dest.TargetLocationElement = new List(_TargetLocationElement.DeepCopyInternal()); + if(_Need is not null) dest.Need = (Hl7.Fhir.Model.CodeableConcept)_Need.DeepCopyInternal(); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_StatusDateElement is not null) dest.StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)_StatusDateElement.DeepCopyInternal(); + if(_ValidationType is not null) dest.ValidationType = (Hl7.Fhir.Model.CodeableConcept)_ValidationType.DeepCopyInternal(); + if(_ValidationProcess is not null) dest.ValidationProcess = new List(_ValidationProcess.DeepCopyInternal()); + if(_Frequency is not null) dest.Frequency = (Hl7.Fhir.Model.Timing)_Frequency.DeepCopyInternal(); + if(_LastPerformedElement is not null) dest.LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)_LastPerformedElement.DeepCopyInternal(); + if(_NextScheduledElement is not null) dest.NextScheduledElement = (Hl7.Fhir.Model.Date)_NextScheduledElement.DeepCopyInternal(); + if(_FailureAction is not null) dest.FailureAction = (Hl7.Fhir.Model.CodeableConcept)_FailureAction.DeepCopyInternal(); + if(_PrimarySource is not null) dest.PrimarySource = new List(_PrimarySource.DeepCopyInternal()); + if(_Attestation is not null) dest.Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)_Attestation.DeepCopyInternal(); + if(_Validator is not null) dest.Validator = new List(_Validator.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1140,125 +1100,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VerificationResult; - if(otherT == null) return false; + if(other is not VerificationResult otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Target, otherT.Target)) return false; - if(!comparer.ListEquals(TargetLocationElement, otherT.TargetLocationElement)) return false; - if(!comparer.Equals(Need, otherT.Need)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(StatusDateElement, otherT.StatusDateElement)) return false; - if(!comparer.Equals(ValidationType, otherT.ValidationType)) return false; - if(!comparer.ListEquals(ValidationProcess, otherT.ValidationProcess)) return false; - if(!comparer.Equals(Frequency, otherT.Frequency)) return false; - if(!comparer.Equals(LastPerformedElement, otherT.LastPerformedElement)) return false; - if(!comparer.Equals(NextScheduledElement, otherT.NextScheduledElement)) return false; - if(!comparer.Equals(FailureAction, otherT.FailureAction)) return false; - if(!comparer.ListEquals(PrimarySource, otherT.PrimarySource)) return false; - if(!comparer.Equals(Attestation, otherT.Attestation)) return false; - if(!comparer.ListEquals(Validator, otherT.Validator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + if(!comparer.ListEquals(_TargetLocationElement, otherT._TargetLocationElement)) return false; + if(!comparer.Equals(_Need, otherT._Need)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; + if(!comparer.Equals(_ValidationType, otherT._ValidationType)) return false; + if(!comparer.ListEquals(_ValidationProcess, otherT._ValidationProcess)) return false; + if(!comparer.Equals(_Frequency, otherT._Frequency)) return false; + if(!comparer.Equals(_LastPerformedElement, otherT._LastPerformedElement)) return false; + if(!comparer.Equals(_NextScheduledElement, otherT._NextScheduledElement)) return false; + if(!comparer.Equals(_FailureAction, otherT._FailureAction)) return false; + if(!comparer.ListEquals(_PrimarySource, otherT._PrimarySource)) return false; + if(!comparer.Equals(_Attestation, otherT._Attestation)) return false; + if(!comparer.ListEquals(_Validator, otherT._Validator)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "target": - value = Target; - return Target?.Any() == true; + value = _Target; + return _Target?.Any() == true; case "targetLocation": - value = TargetLocationElement; - return TargetLocationElement?.Any() == true; + value = _TargetLocationElement; + return _TargetLocationElement?.Any() == true; case "need": - value = Need; - return Need is not null; + value = _Need; + return _Need is not null; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "statusDate": - value = StatusDateElement; - return StatusDateElement is not null; + value = _StatusDateElement; + return _StatusDateElement is not null; case "validationType": - value = ValidationType; - return ValidationType is not null; + value = _ValidationType; + return _ValidationType is not null; case "validationProcess": - value = ValidationProcess; - return ValidationProcess?.Any() == true; + value = _ValidationProcess; + return _ValidationProcess?.Any() == true; case "frequency": - value = Frequency; - return Frequency is not null; + value = _Frequency; + return _Frequency is not null; case "lastPerformed": - value = LastPerformedElement; - return LastPerformedElement is not null; + value = _LastPerformedElement; + return _LastPerformedElement is not null; case "nextScheduled": - value = NextScheduledElement; - return NextScheduledElement is not null; + value = _NextScheduledElement; + return _NextScheduledElement is not null; case "failureAction": - value = FailureAction; - return FailureAction is not null; + value = _FailureAction; + return _FailureAction is not null; case "primarySource": - value = PrimarySource; - return PrimarySource?.Any() == true; + value = _PrimarySource; + return _PrimarySource?.Any() == true; case "attestation": - value = Attestation; - return Attestation is not null; + value = _Attestation; + return _Attestation is not null; case "validator": - value = Validator; - return Validator?.Any() == true; + value = _Validator; + return _Validator?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "target": - Target = (List)value; + Target = (List?)value!; return this; case "targetLocation": - TargetLocationElement = (List)value; + TargetLocationElement = (List?)value!; return this; case "need": - Need = (Hl7.Fhir.Model.CodeableConcept)value; + Need = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "statusDate": - StatusDateElement = (Hl7.Fhir.Model.FhirDateTime)value; + StatusDateElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "validationType": - ValidationType = (Hl7.Fhir.Model.CodeableConcept)value; + ValidationType = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "validationProcess": - ValidationProcess = (List)value; + ValidationProcess = (List?)value!; return this; case "frequency": - Frequency = (Hl7.Fhir.Model.Timing)value; + Frequency = (Hl7.Fhir.Model.Timing?)value; return this; case "lastPerformed": - LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime)value; + LastPerformedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "nextScheduled": - NextScheduledElement = (Hl7.Fhir.Model.Date)value; + NextScheduledElement = (Hl7.Fhir.Model.Date?)value; return this; case "failureAction": - FailureAction = (Hl7.Fhir.Model.CodeableConcept)value; + FailureAction = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "primarySource": - PrimarySource = (List)value; + PrimarySource = (List?)value!; return this; case "attestation": - Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent)value; + Attestation = (Hl7.Fhir.Model.VerificationResult.AttestationComponent?)value; return this; case "validator": - Validator = (List)value; + Validator = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1269,20 +1229,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Target?.Any() == true) yield return new KeyValuePair("target",Target); - if (TargetLocationElement?.Any() == true) yield return new KeyValuePair("targetLocation",TargetLocationElement); - if (Need is not null) yield return new KeyValuePair("need",Need); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (StatusDateElement is not null) yield return new KeyValuePair("statusDate",StatusDateElement); - if (ValidationType is not null) yield return new KeyValuePair("validationType",ValidationType); - if (ValidationProcess?.Any() == true) yield return new KeyValuePair("validationProcess",ValidationProcess); - if (Frequency is not null) yield return new KeyValuePair("frequency",Frequency); - if (LastPerformedElement is not null) yield return new KeyValuePair("lastPerformed",LastPerformedElement); - if (NextScheduledElement is not null) yield return new KeyValuePair("nextScheduled",NextScheduledElement); - if (FailureAction is not null) yield return new KeyValuePair("failureAction",FailureAction); - if (PrimarySource?.Any() == true) yield return new KeyValuePair("primarySource",PrimarySource); - if (Attestation is not null) yield return new KeyValuePair("attestation",Attestation); - if (Validator?.Any() == true) yield return new KeyValuePair("validator",Validator); + if (_Target?.Any() == true) yield return new KeyValuePair("target",_Target); + if (_TargetLocationElement?.Any() == true) yield return new KeyValuePair("targetLocation",_TargetLocationElement); + if (_Need is not null) yield return new KeyValuePair("need",_Need); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_StatusDateElement is not null) yield return new KeyValuePair("statusDate",_StatusDateElement); + if (_ValidationType is not null) yield return new KeyValuePair("validationType",_ValidationType); + if (_ValidationProcess?.Any() == true) yield return new KeyValuePair("validationProcess",_ValidationProcess); + if (_Frequency is not null) yield return new KeyValuePair("frequency",_Frequency); + if (_LastPerformedElement is not null) yield return new KeyValuePair("lastPerformed",_LastPerformedElement); + if (_NextScheduledElement is not null) yield return new KeyValuePair("nextScheduled",_NextScheduledElement); + if (_FailureAction is not null) yield return new KeyValuePair("failureAction",_FailureAction); + if (_PrimarySource?.Any() == true) yield return new KeyValuePair("primarySource",_PrimarySource); + if (_Attestation is not null) yield return new KeyValuePair("attestation",_Attestation); + if (_Validator?.Any() == true) yield return new KeyValuePair("validator",_Validator); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs index 23bd84eee..473805ca2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -62,13 +65,13 @@ public partial class VirtualServiceDetail : Hl7.Fhir.Model.DataType [FhirElement("channelType", InSummary=true, Order=30)] [Binding("VirtualServiceType")] [DataMember] - public Hl7.Fhir.Model.Coding ChannelType + public Hl7.Fhir.Model.Coding? ChannelType { get { return _ChannelType; } set { _ChannelType = value; OnPropertyChanged("ChannelType"); } } - private Hl7.Fhir.Model.Coding _ChannelType; + private Hl7.Fhir.Model.Coding? _ChannelType; /// /// Contact address/number. @@ -77,13 +80,13 @@ public Hl7.Fhir.Model.Coding ChannelType [CLSCompliant(false)] [AllowedTypes(typeof(Hl7.Fhir.Model.FhirUrl),typeof(Hl7.Fhir.Model.FhirString),typeof(Hl7.Fhir.Model.ContactPoint),typeof(Hl7.Fhir.Model.ExtendedContactDetail))] [DataMember] - public Hl7.Fhir.Model.DataType Address + public Hl7.Fhir.Model.DataType? Address { get { return _Address; } set { _Address = value; OnPropertyChanged("Address"); } } - private Hl7.Fhir.Model.DataType _Address; + private Hl7.Fhir.Model.DataType? _Address; /// /// Address to see alternative connection details. @@ -93,24 +96,24 @@ public Hl7.Fhir.Model.DataType Address [DataMember] public List AdditionalInfoElement { - get { if(_AdditionalInfoElement==null) _AdditionalInfoElement = new List(); return _AdditionalInfoElement; } + get => _AdditionalInfoElement ?? new List(); set { _AdditionalInfoElement = value; OnPropertyChanged("AdditionalInfoElement"); } } - private List _AdditionalInfoElement; + private List? _AdditionalInfoElement; /// /// Address to see alternative connection details /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable AdditionalInfo + public IEnumerable? AdditionalInfo { - get { return AdditionalInfoElement != null ? AdditionalInfoElement.Select(elem => elem.Value) : null; } + get => _AdditionalInfoElement?.Select(elem => elem.Value); set { if (value == null) - AdditionalInfoElement = null; + AdditionalInfoElement = null!; else AdditionalInfoElement = new List(value.Select(elem=>new Hl7.Fhir.Model.FhirUrl(elem))); OnPropertyChanged("AdditionalInfo"); @@ -122,13 +125,13 @@ public IEnumerable AdditionalInfo /// [FhirElement("maxParticipants", InSummary=true, Order=60)] [DataMember] - public Hl7.Fhir.Model.PositiveInt MaxParticipantsElement + public Hl7.Fhir.Model.PositiveInt? MaxParticipantsElement { get { return _MaxParticipantsElement; } set { _MaxParticipantsElement = value; OnPropertyChanged("MaxParticipantsElement"); } } - private Hl7.Fhir.Model.PositiveInt _MaxParticipantsElement; + private Hl7.Fhir.Model.PositiveInt? _MaxParticipantsElement; /// /// Maximum number of participants supported by the virtual service @@ -137,13 +140,10 @@ public Hl7.Fhir.Model.PositiveInt MaxParticipantsElement [IgnoreDataMember] public int? MaxParticipants { - get { return MaxParticipantsElement != null ? MaxParticipantsElement.Value : null; } + get => _MaxParticipantsElement?.Value; set { - if (value == null) - MaxParticipantsElement = null; - else - MaxParticipantsElement = new Hl7.Fhir.Model.PositiveInt(value); + MaxParticipantsElement = value is null ? null : new Hl7.Fhir.Model.PositiveInt(value); OnPropertyChanged("MaxParticipants"); } } @@ -153,47 +153,40 @@ public int? MaxParticipants /// [FhirElement("sessionKey", InSummary=true, Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirString SessionKeyElement + public Hl7.Fhir.Model.FhirString? SessionKeyElement { get { return _SessionKeyElement; } set { _SessionKeyElement = value; OnPropertyChanged("SessionKeyElement"); } } - private Hl7.Fhir.Model.FhirString _SessionKeyElement; + private Hl7.Fhir.Model.FhirString? _SessionKeyElement; /// /// Session Key required by the virtual service /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string SessionKey + public string? SessionKey { - get { return SessionKeyElement != null ? SessionKeyElement.Value : null; } + get => _SessionKeyElement?.Value; set { - if (value == null) - SessionKeyElement = null; - else - SessionKeyElement = new Hl7.Fhir.Model.FhirString(value); + SessionKeyElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("SessionKey"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as VirtualServiceDetail; - - if (dest == null) - { + if(other is not VirtualServiceDetail dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(ChannelType != null) dest.ChannelType = (Hl7.Fhir.Model.Coding)ChannelType.DeepCopyInternal(); - if(Address != null) dest.Address = (Hl7.Fhir.Model.DataType)Address.DeepCopyInternal(); - if(AdditionalInfoElement.Any()) dest.AdditionalInfoElement = new List(AdditionalInfoElement.DeepCopyInternal()); - if(MaxParticipantsElement != null) dest.MaxParticipantsElement = (Hl7.Fhir.Model.PositiveInt)MaxParticipantsElement.DeepCopyInternal(); - if(SessionKeyElement != null) dest.SessionKeyElement = (Hl7.Fhir.Model.FhirString)SessionKeyElement.DeepCopyInternal(); + if(_ChannelType is not null) dest.ChannelType = (Hl7.Fhir.Model.Coding)_ChannelType.DeepCopyInternal(); + if(_Address is not null) dest.Address = (Hl7.Fhir.Model.DataType)_Address.DeepCopyInternal(); + if(_AdditionalInfoElement is not null) dest.AdditionalInfoElement = new List(_AdditionalInfoElement.DeepCopyInternal()); + if(_MaxParticipantsElement is not null) dest.MaxParticipantsElement = (Hl7.Fhir.Model.PositiveInt)_MaxParticipantsElement.DeepCopyInternal(); + if(_SessionKeyElement is not null) dest.SessionKeyElement = (Hl7.Fhir.Model.FhirString)_SessionKeyElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -205,62 +198,62 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VirtualServiceDetail; - if(otherT == null) return false; + if(other is not VirtualServiceDetail otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(ChannelType, otherT.ChannelType)) return false; - if(!comparer.Equals(Address, otherT.Address)) return false; - if(!comparer.ListEquals(AdditionalInfoElement, otherT.AdditionalInfoElement)) return false; - if(!comparer.Equals(MaxParticipantsElement, otherT.MaxParticipantsElement)) return false; - if(!comparer.Equals(SessionKeyElement, otherT.SessionKeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ChannelType, otherT._ChannelType)) return false; + if(!comparer.Equals(_Address, otherT._Address)) return false; + if(!comparer.ListEquals(_AdditionalInfoElement, otherT._AdditionalInfoElement)) return false; + if(!comparer.Equals(_MaxParticipantsElement, otherT._MaxParticipantsElement)) return false; + if(!comparer.Equals(_SessionKeyElement, otherT._SessionKeyElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "channelType": - value = ChannelType; - return ChannelType is not null; + value = _ChannelType; + return _ChannelType is not null; case "address": - value = Address; - return Address is not null; + value = _Address; + return _Address is not null; case "additionalInfo": - value = AdditionalInfoElement; - return AdditionalInfoElement?.Any() == true; + value = _AdditionalInfoElement; + return _AdditionalInfoElement?.Any() == true; case "maxParticipants": - value = MaxParticipantsElement; - return MaxParticipantsElement is not null; + value = _MaxParticipantsElement; + return _MaxParticipantsElement is not null; case "sessionKey": - value = SessionKeyElement; - return SessionKeyElement is not null; + value = _SessionKeyElement; + return _SessionKeyElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "channelType": - ChannelType = (Hl7.Fhir.Model.Coding)value; + ChannelType = (Hl7.Fhir.Model.Coding?)value; return this; case "address": - Address = (Hl7.Fhir.Model.DataType)value; + Address = (Hl7.Fhir.Model.DataType?)value; return this; case "additionalInfo": - AdditionalInfoElement = (List)value; + AdditionalInfoElement = (List?)value!; return this; case "maxParticipants": - MaxParticipantsElement = (Hl7.Fhir.Model.PositiveInt)value; + MaxParticipantsElement = (Hl7.Fhir.Model.PositiveInt?)value; return this; case "sessionKey": - SessionKeyElement = (Hl7.Fhir.Model.FhirString)value; + SessionKeyElement = (Hl7.Fhir.Model.FhirString?)value; return this; default: return base.SetValue(key, value); @@ -271,11 +264,11 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (ChannelType is not null) yield return new KeyValuePair("channelType",ChannelType); - if (Address is not null) yield return new KeyValuePair("address",Address); - if (AdditionalInfoElement?.Any() == true) yield return new KeyValuePair("additionalInfo",AdditionalInfoElement); - if (MaxParticipantsElement is not null) yield return new KeyValuePair("maxParticipants",MaxParticipantsElement); - if (SessionKeyElement is not null) yield return new KeyValuePair("sessionKey",SessionKeyElement); + if (_ChannelType is not null) yield return new KeyValuePair("channelType",_ChannelType); + if (_Address is not null) yield return new KeyValuePair("address",_Address); + if (_AdditionalInfoElement?.Any() == true) yield return new KeyValuePair("additionalInfo",_AdditionalInfoElement); + if (_MaxParticipantsElement is not null) yield return new KeyValuePair("maxParticipants",_MaxParticipantsElement); + if (_SessionKeyElement is not null) yield return new KeyValuePair("sessionKey",_SessionKeyElement); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs index fd90a3cee..509bdf614 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs @@ -10,8 +10,11 @@ using Hl7.Fhir.Specification; using Hl7.Fhir.Utility; using Hl7.Fhir.Validation; +using System.Diagnostics.CodeAnalysis; using SystemPrimitive = Hl7.Fhir.ElementModel.Types; +#nullable enable + /* Copyright (c) 2011+, HL7, Inc. All rights reserved. @@ -138,13 +141,13 @@ public partial class LensSpecificationComponent : Hl7.Fhir.Model.BackboneElement [Binding("VisionProduct")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.CodeableConcept Product + public Hl7.Fhir.Model.CodeableConcept? Product { get { return _Product; } set { _Product = value; OnPropertyChanged("Product"); } } - private Hl7.Fhir.Model.CodeableConcept _Product; + private Hl7.Fhir.Model.CodeableConcept? _Product; /// /// right | left. @@ -154,13 +157,13 @@ public Hl7.Fhir.Model.CodeableConcept Product [Binding("VisionEyes")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code EyeElement + public Code? EyeElement { get { return _EyeElement; } set { _EyeElement = value; OnPropertyChanged("EyeElement"); } } - private Code _EyeElement; + private Code? _EyeElement; /// /// right | left @@ -169,13 +172,10 @@ public Code EyeElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye { - get { return EyeElement != null ? EyeElement.Value : null; } + get => _EyeElement?.Value; set { - if (value == null) - EyeElement = null; - else - EyeElement = new Code(value); + EyeElement = value is null ? null : new Code(value); OnPropertyChanged("Eye"); } } @@ -185,13 +185,13 @@ public Hl7.Fhir.Model.VisionPrescription.VisionEyes? Eye /// [FhirElement("sphere", Order=60)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal SphereElement + public Hl7.Fhir.Model.FhirDecimal? SphereElement { get { return _SphereElement; } set { _SphereElement = value; OnPropertyChanged("SphereElement"); } } - private Hl7.Fhir.Model.FhirDecimal _SphereElement; + private Hl7.Fhir.Model.FhirDecimal? _SphereElement; /// /// Power of the lens @@ -200,13 +200,10 @@ public Hl7.Fhir.Model.FhirDecimal SphereElement [IgnoreDataMember] public decimal? Sphere { - get { return SphereElement != null ? SphereElement.Value : null; } + get => _SphereElement?.Value; set { - if (value == null) - SphereElement = null; - else - SphereElement = new Hl7.Fhir.Model.FhirDecimal(value); + SphereElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Sphere"); } } @@ -216,13 +213,13 @@ public decimal? Sphere /// [FhirElement("cylinder", Order=70)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal CylinderElement + public Hl7.Fhir.Model.FhirDecimal? CylinderElement { get { return _CylinderElement; } set { _CylinderElement = value; OnPropertyChanged("CylinderElement"); } } - private Hl7.Fhir.Model.FhirDecimal _CylinderElement; + private Hl7.Fhir.Model.FhirDecimal? _CylinderElement; /// /// Lens power for astigmatism @@ -231,13 +228,10 @@ public Hl7.Fhir.Model.FhirDecimal CylinderElement [IgnoreDataMember] public decimal? Cylinder { - get { return CylinderElement != null ? CylinderElement.Value : null; } + get => _CylinderElement?.Value; set { - if (value == null) - CylinderElement = null; - else - CylinderElement = new Hl7.Fhir.Model.FhirDecimal(value); + CylinderElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Cylinder"); } } @@ -247,13 +241,13 @@ public decimal? Cylinder /// [FhirElement("axis", Order=80)] [DataMember] - public Hl7.Fhir.Model.Integer AxisElement + public Hl7.Fhir.Model.Integer? AxisElement { get { return _AxisElement; } set { _AxisElement = value; OnPropertyChanged("AxisElement"); } } - private Hl7.Fhir.Model.Integer _AxisElement; + private Hl7.Fhir.Model.Integer? _AxisElement; /// /// Lens meridian which contain no power for astigmatism @@ -262,13 +256,10 @@ public Hl7.Fhir.Model.Integer AxisElement [IgnoreDataMember] public int? Axis { - get { return AxisElement != null ? AxisElement.Value : null; } + get => _AxisElement?.Value; set { - if (value == null) - AxisElement = null; - else - AxisElement = new Hl7.Fhir.Model.Integer(value); + AxisElement = value is null ? null : new Hl7.Fhir.Model.Integer(value); OnPropertyChanged("Axis"); } } @@ -281,24 +272,24 @@ public int? Axis [DataMember] public List Prism { - get { if(_Prism==null) _Prism = new List(); return _Prism; } + get => _Prism ?? new List(); set { _Prism = value; OnPropertyChanged("Prism"); } } - private List _Prism; + private List? _Prism; /// /// Added power for multifocal levels. /// [FhirElement("add", Order=100)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AddElement + public Hl7.Fhir.Model.FhirDecimal? AddElement { get { return _AddElement; } set { _AddElement = value; OnPropertyChanged("AddElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AddElement; + private Hl7.Fhir.Model.FhirDecimal? _AddElement; /// /// Added power for multifocal levels @@ -307,13 +298,10 @@ public Hl7.Fhir.Model.FhirDecimal AddElement [IgnoreDataMember] public decimal? Add { - get { return AddElement != null ? AddElement.Value : null; } + get => _AddElement?.Value; set { - if (value == null) - AddElement = null; - else - AddElement = new Hl7.Fhir.Model.FhirDecimal(value); + AddElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Add"); } } @@ -323,13 +311,13 @@ public decimal? Add /// [FhirElement("power", Order=110)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal PowerElement + public Hl7.Fhir.Model.FhirDecimal? PowerElement { get { return _PowerElement; } set { _PowerElement = value; OnPropertyChanged("PowerElement"); } } - private Hl7.Fhir.Model.FhirDecimal _PowerElement; + private Hl7.Fhir.Model.FhirDecimal? _PowerElement; /// /// Contact lens power @@ -338,13 +326,10 @@ public Hl7.Fhir.Model.FhirDecimal PowerElement [IgnoreDataMember] public decimal? Power { - get { return PowerElement != null ? PowerElement.Value : null; } + get => _PowerElement?.Value; set { - if (value == null) - PowerElement = null; - else - PowerElement = new Hl7.Fhir.Model.FhirDecimal(value); + PowerElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Power"); } } @@ -354,13 +339,13 @@ public decimal? Power /// [FhirElement("backCurve", Order=120)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal BackCurveElement + public Hl7.Fhir.Model.FhirDecimal? BackCurveElement { get { return _BackCurveElement; } set { _BackCurveElement = value; OnPropertyChanged("BackCurveElement"); } } - private Hl7.Fhir.Model.FhirDecimal _BackCurveElement; + private Hl7.Fhir.Model.FhirDecimal? _BackCurveElement; /// /// Contact lens back curvature @@ -369,13 +354,10 @@ public Hl7.Fhir.Model.FhirDecimal BackCurveElement [IgnoreDataMember] public decimal? BackCurve { - get { return BackCurveElement != null ? BackCurveElement.Value : null; } + get => _BackCurveElement?.Value; set { - if (value == null) - BackCurveElement = null; - else - BackCurveElement = new Hl7.Fhir.Model.FhirDecimal(value); + BackCurveElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("BackCurve"); } } @@ -385,13 +367,13 @@ public decimal? BackCurve /// [FhirElement("diameter", Order=130)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal DiameterElement + public Hl7.Fhir.Model.FhirDecimal? DiameterElement { get { return _DiameterElement; } set { _DiameterElement = value; OnPropertyChanged("DiameterElement"); } } - private Hl7.Fhir.Model.FhirDecimal _DiameterElement; + private Hl7.Fhir.Model.FhirDecimal? _DiameterElement; /// /// Contact lens diameter @@ -400,13 +382,10 @@ public Hl7.Fhir.Model.FhirDecimal DiameterElement [IgnoreDataMember] public decimal? Diameter { - get { return DiameterElement != null ? DiameterElement.Value : null; } + get => _DiameterElement?.Value; set { - if (value == null) - DiameterElement = null; - else - DiameterElement = new Hl7.Fhir.Model.FhirDecimal(value); + DiameterElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Diameter"); } } @@ -416,41 +395,38 @@ public decimal? Diameter /// [FhirElement("duration", Order=140)] [DataMember] - public Hl7.Fhir.Model.Quantity Duration + public Hl7.Fhir.Model.Quantity? Duration { get { return _Duration; } set { _Duration = value; OnPropertyChanged("Duration"); } } - private Hl7.Fhir.Model.Quantity _Duration; + private Hl7.Fhir.Model.Quantity? _Duration; /// /// Color required. /// [FhirElement("color", Order=150)] [DataMember] - public Hl7.Fhir.Model.FhirString ColorElement + public Hl7.Fhir.Model.FhirString? ColorElement { get { return _ColorElement; } set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } - private Hl7.Fhir.Model.FhirString _ColorElement; + private Hl7.Fhir.Model.FhirString? _ColorElement; /// /// Color required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Color + public string? Color { - get { return ColorElement != null ? ColorElement.Value : null; } + get => _ColorElement?.Value; set { - if (value == null) - ColorElement = null; - else - ColorElement = new Hl7.Fhir.Model.FhirString(value); + ColorElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Color"); } } @@ -460,28 +436,25 @@ public string Color /// [FhirElement("brand", Order=160)] [DataMember] - public Hl7.Fhir.Model.FhirString BrandElement + public Hl7.Fhir.Model.FhirString? BrandElement { get { return _BrandElement; } set { _BrandElement = value; OnPropertyChanged("BrandElement"); } } - private Hl7.Fhir.Model.FhirString _BrandElement; + private Hl7.Fhir.Model.FhirString? _BrandElement; /// /// Brand required /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Brand + public string? Brand { - get { return BrandElement != null ? BrandElement.Value : null; } + get => _BrandElement?.Value; set { - if (value == null) - BrandElement = null; - else - BrandElement = new Hl7.Fhir.Model.FhirString(value); + BrandElement = value is null ? null : new Hl7.Fhir.Model.FhirString(value); OnPropertyChanged("Brand"); } } @@ -494,36 +467,32 @@ public string Brand [DataMember] public List Note { - get { if(_Note==null) _Note = new List(); return _Note; } + get => _Note ?? new List(); set { _Note = value; OnPropertyChanged("Note"); } } - private List _Note; + private List? _Note; protected internal override void CopyToInternal(Base other) { - var dest = other as LensSpecificationComponent; - - if (dest == null) - { + if(other is not LensSpecificationComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Product != null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)Product.DeepCopyInternal(); - if(EyeElement != null) dest.EyeElement = (Code)EyeElement.DeepCopyInternal(); - if(SphereElement != null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)SphereElement.DeepCopyInternal(); - if(CylinderElement != null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)CylinderElement.DeepCopyInternal(); - if(AxisElement != null) dest.AxisElement = (Hl7.Fhir.Model.Integer)AxisElement.DeepCopyInternal(); - if(Prism.Any()) dest.Prism = new List(Prism.DeepCopyInternal()); - if(AddElement != null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)AddElement.DeepCopyInternal(); - if(PowerElement != null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)PowerElement.DeepCopyInternal(); - if(BackCurveElement != null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)BackCurveElement.DeepCopyInternal(); - if(DiameterElement != null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)DiameterElement.DeepCopyInternal(); - if(Duration != null) dest.Duration = (Hl7.Fhir.Model.Quantity)Duration.DeepCopyInternal(); - if(ColorElement != null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)ColorElement.DeepCopyInternal(); - if(BrandElement != null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)BrandElement.DeepCopyInternal(); - if(Note.Any()) dest.Note = new List(Note.DeepCopyInternal()); + if(_Product is not null) dest.Product = (Hl7.Fhir.Model.CodeableConcept)_Product.DeepCopyInternal(); + if(_EyeElement is not null) dest.EyeElement = (Code)_EyeElement.DeepCopyInternal(); + if(_SphereElement is not null) dest.SphereElement = (Hl7.Fhir.Model.FhirDecimal)_SphereElement.DeepCopyInternal(); + if(_CylinderElement is not null) dest.CylinderElement = (Hl7.Fhir.Model.FhirDecimal)_CylinderElement.DeepCopyInternal(); + if(_AxisElement is not null) dest.AxisElement = (Hl7.Fhir.Model.Integer)_AxisElement.DeepCopyInternal(); + if(_Prism is not null) dest.Prism = new List(_Prism.DeepCopyInternal()); + if(_AddElement is not null) dest.AddElement = (Hl7.Fhir.Model.FhirDecimal)_AddElement.DeepCopyInternal(); + if(_PowerElement is not null) dest.PowerElement = (Hl7.Fhir.Model.FhirDecimal)_PowerElement.DeepCopyInternal(); + if(_BackCurveElement is not null) dest.BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)_BackCurveElement.DeepCopyInternal(); + if(_DiameterElement is not null) dest.DiameterElement = (Hl7.Fhir.Model.FhirDecimal)_DiameterElement.DeepCopyInternal(); + if(_Duration is not null) dest.Duration = (Hl7.Fhir.Model.Quantity)_Duration.DeepCopyInternal(); + if(_ColorElement is not null) dest.ColorElement = (Hl7.Fhir.Model.FhirString)_ColorElement.DeepCopyInternal(); + if(_BrandElement is not null) dest.BrandElement = (Hl7.Fhir.Model.FhirString)_BrandElement.DeepCopyInternal(); + if(_Note is not null) dest.Note = new List(_Note.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -535,125 +504,125 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as LensSpecificationComponent; - if(otherT == null) return false; + if(other is not LensSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(Product, otherT.Product)) return false; - if(!comparer.Equals(EyeElement, otherT.EyeElement)) return false; - if(!comparer.Equals(SphereElement, otherT.SphereElement)) return false; - if(!comparer.Equals(CylinderElement, otherT.CylinderElement)) return false; - if(!comparer.Equals(AxisElement, otherT.AxisElement)) return false; - if(!comparer.ListEquals(Prism, otherT.Prism)) return false; - if(!comparer.Equals(AddElement, otherT.AddElement)) return false; - if(!comparer.Equals(PowerElement, otherT.PowerElement)) return false; - if(!comparer.Equals(BackCurveElement, otherT.BackCurveElement)) return false; - if(!comparer.Equals(DiameterElement, otherT.DiameterElement)) return false; - if(!comparer.Equals(Duration, otherT.Duration)) return false; - if(!comparer.Equals(ColorElement, otherT.ColorElement)) return false; - if(!comparer.Equals(BrandElement, otherT.BrandElement)) return false; - if(!comparer.ListEquals(Note, otherT.Note)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; + if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; + if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; + if(!comparer.Equals(_AxisElement, otherT._AxisElement)) return false; + if(!comparer.ListEquals(_Prism, otherT._Prism)) return false; + if(!comparer.Equals(_AddElement, otherT._AddElement)) return false; + if(!comparer.Equals(_PowerElement, otherT._PowerElement)) return false; + if(!comparer.Equals(_BackCurveElement, otherT._BackCurveElement)) return false; + if(!comparer.Equals(_DiameterElement, otherT._DiameterElement)) return false; + if(!comparer.Equals(_Duration, otherT._Duration)) return false; + if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; + if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; + if(!comparer.ListEquals(_Note, otherT._Note)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "product": - value = Product; - return Product is not null; + value = _Product; + return _Product is not null; case "eye": - value = EyeElement; - return EyeElement is not null; + value = _EyeElement; + return _EyeElement is not null; case "sphere": - value = SphereElement; - return SphereElement is not null; + value = _SphereElement; + return _SphereElement is not null; case "cylinder": - value = CylinderElement; - return CylinderElement is not null; + value = _CylinderElement; + return _CylinderElement is not null; case "axis": - value = AxisElement; - return AxisElement is not null; + value = _AxisElement; + return _AxisElement is not null; case "prism": - value = Prism; - return Prism?.Any() == true; + value = _Prism; + return _Prism?.Any() == true; case "add": - value = AddElement; - return AddElement is not null; + value = _AddElement; + return _AddElement is not null; case "power": - value = PowerElement; - return PowerElement is not null; + value = _PowerElement; + return _PowerElement is not null; case "backCurve": - value = BackCurveElement; - return BackCurveElement is not null; + value = _BackCurveElement; + return _BackCurveElement is not null; case "diameter": - value = DiameterElement; - return DiameterElement is not null; + value = _DiameterElement; + return _DiameterElement is not null; case "duration": - value = Duration; - return Duration is not null; + value = _Duration; + return _Duration is not null; case "color": - value = ColorElement; - return ColorElement is not null; + value = _ColorElement; + return _ColorElement is not null; case "brand": - value = BrandElement; - return BrandElement is not null; + value = _BrandElement; + return _BrandElement is not null; case "note": - value = Note; - return Note?.Any() == true; + value = _Note; + return _Note?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "product": - Product = (Hl7.Fhir.Model.CodeableConcept)value; + Product = (Hl7.Fhir.Model.CodeableConcept?)value; return this; case "eye": - EyeElement = (Code)value; + EyeElement = (Code?)value; return this; case "sphere": - SphereElement = (Hl7.Fhir.Model.FhirDecimal)value; + SphereElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "cylinder": - CylinderElement = (Hl7.Fhir.Model.FhirDecimal)value; + CylinderElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "axis": - AxisElement = (Hl7.Fhir.Model.Integer)value; + AxisElement = (Hl7.Fhir.Model.Integer?)value; return this; case "prism": - Prism = (List)value; + Prism = (List?)value!; return this; case "add": - AddElement = (Hl7.Fhir.Model.FhirDecimal)value; + AddElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "power": - PowerElement = (Hl7.Fhir.Model.FhirDecimal)value; + PowerElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "backCurve": - BackCurveElement = (Hl7.Fhir.Model.FhirDecimal)value; + BackCurveElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "diameter": - DiameterElement = (Hl7.Fhir.Model.FhirDecimal)value; + DiameterElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "duration": - Duration = (Hl7.Fhir.Model.Quantity)value; + Duration = (Hl7.Fhir.Model.Quantity?)value; return this; case "color": - ColorElement = (Hl7.Fhir.Model.FhirString)value; + ColorElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "brand": - BrandElement = (Hl7.Fhir.Model.FhirString)value; + BrandElement = (Hl7.Fhir.Model.FhirString?)value; return this; case "note": - Note = (List)value; + Note = (List?)value!; return this; default: return base.SetValue(key, value); @@ -664,20 +633,20 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Product is not null) yield return new KeyValuePair("product",Product); - if (EyeElement is not null) yield return new KeyValuePair("eye",EyeElement); - if (SphereElement is not null) yield return new KeyValuePair("sphere",SphereElement); - if (CylinderElement is not null) yield return new KeyValuePair("cylinder",CylinderElement); - if (AxisElement is not null) yield return new KeyValuePair("axis",AxisElement); - if (Prism?.Any() == true) yield return new KeyValuePair("prism",Prism); - if (AddElement is not null) yield return new KeyValuePair("add",AddElement); - if (PowerElement is not null) yield return new KeyValuePair("power",PowerElement); - if (BackCurveElement is not null) yield return new KeyValuePair("backCurve",BackCurveElement); - if (DiameterElement is not null) yield return new KeyValuePair("diameter",DiameterElement); - if (Duration is not null) yield return new KeyValuePair("duration",Duration); - if (ColorElement is not null) yield return new KeyValuePair("color",ColorElement); - if (BrandElement is not null) yield return new KeyValuePair("brand",BrandElement); - if (Note?.Any() == true) yield return new KeyValuePair("note",Note); + if (_Product is not null) yield return new KeyValuePair("product",_Product); + if (_EyeElement is not null) yield return new KeyValuePair("eye",_EyeElement); + if (_SphereElement is not null) yield return new KeyValuePair("sphere",_SphereElement); + if (_CylinderElement is not null) yield return new KeyValuePair("cylinder",_CylinderElement); + if (_AxisElement is not null) yield return new KeyValuePair("axis",_AxisElement); + if (_Prism?.Any() == true) yield return new KeyValuePair("prism",_Prism); + if (_AddElement is not null) yield return new KeyValuePair("add",_AddElement); + if (_PowerElement is not null) yield return new KeyValuePair("power",_PowerElement); + if (_BackCurveElement is not null) yield return new KeyValuePair("backCurve",_BackCurveElement); + if (_DiameterElement is not null) yield return new KeyValuePair("diameter",_DiameterElement); + if (_Duration is not null) yield return new KeyValuePair("duration",_Duration); + if (_ColorElement is not null) yield return new KeyValuePair("color",_ColorElement); + if (_BrandElement is not null) yield return new KeyValuePair("brand",_BrandElement); + if (_Note?.Any() == true) yield return new KeyValuePair("note",_Note); } } @@ -704,13 +673,13 @@ public partial class PrismComponent : Hl7.Fhir.Model.BackboneElement [FhirElement("amount", Order=40)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDecimal AmountElement + public Hl7.Fhir.Model.FhirDecimal? AmountElement { get { return _AmountElement; } set { _AmountElement = value; OnPropertyChanged("AmountElement"); } } - private Hl7.Fhir.Model.FhirDecimal _AmountElement; + private Hl7.Fhir.Model.FhirDecimal? _AmountElement; /// /// Amount of adjustment @@ -719,13 +688,10 @@ public Hl7.Fhir.Model.FhirDecimal AmountElement [IgnoreDataMember] public decimal? Amount { - get { return AmountElement != null ? AmountElement.Value : null; } + get => _AmountElement?.Value; set { - if (value == null) - AmountElement = null; - else - AmountElement = new Hl7.Fhir.Model.FhirDecimal(value); + AmountElement = value is null ? null : new Hl7.Fhir.Model.FhirDecimal(value); OnPropertyChanged("Amount"); } } @@ -738,13 +704,13 @@ public decimal? Amount [Binding("VisionBase")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code BaseElement + public Code? BaseElement { get { return _BaseElement; } set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } - private Code _BaseElement; + private Code? _BaseElement; /// /// up | down | in | out @@ -753,29 +719,22 @@ public Code BaseElement [IgnoreDataMember] public Hl7.Fhir.Model.VisionPrescription.VisionBase? Base { - get { return BaseElement != null ? BaseElement.Value : null; } + get => _BaseElement?.Value; set { - if (value == null) - BaseElement = null; - else - BaseElement = new Code(value); + BaseElement = value is null ? null : new Code(value); OnPropertyChanged("Base"); } } protected internal override void CopyToInternal(Base other) { - var dest = other as PrismComponent; - - if (dest == null) - { + if(other is not PrismComponent dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(AmountElement != null) dest.AmountElement = (Hl7.Fhir.Model.FhirDecimal)AmountElement.DeepCopyInternal(); - if(BaseElement != null) dest.BaseElement = (Code)BaseElement.DeepCopyInternal(); + if(_AmountElement is not null) dest.AmountElement = (Hl7.Fhir.Model.FhirDecimal)_AmountElement.DeepCopyInternal(); + if(_BaseElement is not null) dest.BaseElement = (Code)_BaseElement.DeepCopyInternal(); } protected internal override Base DeepCopyInternal() @@ -787,41 +746,41 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as PrismComponent; - if(otherT == null) return false; + if(other is not PrismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.Equals(AmountElement, otherT.AmountElement)) return false; - if(!comparer.Equals(BaseElement, otherT.BaseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; + if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "amount": - value = AmountElement; - return AmountElement is not null; + value = _AmountElement; + return _AmountElement is not null; case "base": - value = BaseElement; - return BaseElement is not null; + value = _BaseElement; + return _BaseElement is not null; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "amount": - AmountElement = (Hl7.Fhir.Model.FhirDecimal)value; + AmountElement = (Hl7.Fhir.Model.FhirDecimal?)value; return this; case "base": - BaseElement = (Code)value; + BaseElement = (Code?)value; return this; default: return base.SetValue(key, value); @@ -832,8 +791,8 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (AmountElement is not null) yield return new KeyValuePair("amount",AmountElement); - if (BaseElement is not null) yield return new KeyValuePair("base",BaseElement); + if (_AmountElement is not null) yield return new KeyValuePair("amount",_AmountElement); + if (_BaseElement is not null) yield return new KeyValuePair("base",_BaseElement); } } @@ -846,11 +805,11 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get { if(_Identifier==null) _Identifier = new List(); return _Identifier; } + get => _Identifier ?? new List(); set { _Identifier = value; OnPropertyChanged("Identifier"); } } - private List _Identifier; + private List? _Identifier; /// /// active | cancelled | draft | entered-in-error. @@ -860,13 +819,13 @@ public List Identifier [Binding("VisionStatus")] [Cardinality(Min=1,Max=1)] [DataMember] - public Code StatusElement + public Code? StatusElement { get { return _StatusElement; } set { _StatusElement = value; OnPropertyChanged("StatusElement"); } } - private Code _StatusElement; + private Code? _StatusElement; /// /// active | cancelled | draft | entered-in-error @@ -875,13 +834,10 @@ public Code StatusElement [IgnoreDataMember] public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status { - get { return StatusElement != null ? StatusElement.Value : null; } + get => _StatusElement?.Value; set { - if (value == null) - StatusElement = null; - else - StatusElement = new Code(value); + StatusElement = value is null ? null : new Code(value); OnPropertyChanged("Status"); } } @@ -892,28 +848,25 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [FhirElement("created", InSummary=true, Order=110)] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime CreatedElement + public Hl7.Fhir.Model.FhirDateTime? CreatedElement { get { return _CreatedElement; } set { _CreatedElement = value; OnPropertyChanged("CreatedElement"); } } - private Hl7.Fhir.Model.FhirDateTime _CreatedElement; + private Hl7.Fhir.Model.FhirDateTime? _CreatedElement; /// /// Response creation date /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string Created + public string? Created { - get { return CreatedElement != null ? CreatedElement.Value : null; } + get => _CreatedElement?.Value; set { - if (value == null) - CreatedElement = null; - else - CreatedElement = new Hl7.Fhir.Model.FhirDateTime(value); + CreatedElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("Created"); } } @@ -926,13 +879,13 @@ public string Created [References("Patient")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Patient + public Hl7.Fhir.Model.ResourceReference? Patient { get { return _Patient; } set { _Patient = value; OnPropertyChanged("Patient"); } } - private Hl7.Fhir.Model.ResourceReference _Patient; + private Hl7.Fhir.Model.ResourceReference? _Patient; /// /// Created during encounter / admission / stay. @@ -941,13 +894,13 @@ public Hl7.Fhir.Model.ResourceReference Patient [CLSCompliant(false)] [References("Encounter")] [DataMember] - public Hl7.Fhir.Model.ResourceReference Encounter + public Hl7.Fhir.Model.ResourceReference? Encounter { get { return _Encounter; } set { _Encounter = value; OnPropertyChanged("Encounter"); } } - private Hl7.Fhir.Model.ResourceReference _Encounter; + private Hl7.Fhir.Model.ResourceReference? _Encounter; /// /// When prescription was authorized. @@ -955,28 +908,25 @@ public Hl7.Fhir.Model.ResourceReference Encounter [FhirElement("dateWritten", InSummary=true, Order=140, FiveWs="FiveWs.recorded")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.FhirDateTime DateWrittenElement + public Hl7.Fhir.Model.FhirDateTime? DateWrittenElement { get { return _DateWrittenElement; } set { _DateWrittenElement = value; OnPropertyChanged("DateWrittenElement"); } } - private Hl7.Fhir.Model.FhirDateTime _DateWrittenElement; + private Hl7.Fhir.Model.FhirDateTime? _DateWrittenElement; /// /// When prescription was authorized /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public string DateWritten + public string? DateWritten { - get { return DateWrittenElement != null ? DateWrittenElement.Value : null; } + get => _DateWrittenElement?.Value; set { - if (value == null) - DateWrittenElement = null; - else - DateWrittenElement = new Hl7.Fhir.Model.FhirDateTime(value); + DateWrittenElement = value is null ? null : new Hl7.Fhir.Model.FhirDateTime(value); OnPropertyChanged("DateWritten"); } } @@ -989,13 +939,13 @@ public string DateWritten [References("Practitioner","PractitionerRole")] [Cardinality(Min=1,Max=1)] [DataMember] - public Hl7.Fhir.Model.ResourceReference Prescriber + public Hl7.Fhir.Model.ResourceReference? Prescriber { get { return _Prescriber; } set { _Prescriber = value; OnPropertyChanged("Prescriber"); } } - private Hl7.Fhir.Model.ResourceReference _Prescriber; + private Hl7.Fhir.Model.ResourceReference? _Prescriber; /// /// Vision lens authorization. @@ -1005,32 +955,28 @@ public Hl7.Fhir.Model.ResourceReference Prescriber [DataMember] public List LensSpecification { - get { if(_LensSpecification==null) _LensSpecification = new List(); return _LensSpecification; } + get => _LensSpecification ?? new List(); set { _LensSpecification = value; OnPropertyChanged("LensSpecification"); } } - private List _LensSpecification; + private List? _LensSpecification; List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { - var dest = other as VisionPrescription; - - if (dest == null) - { + if(other is not VisionPrescription dest) throw new ArgumentException("Can only copy to an object of the same type", "other"); - } base.CopyToInternal(dest); - if(Identifier.Any()) dest.Identifier = new List(Identifier.DeepCopyInternal()); - if(StatusElement != null) dest.StatusElement = (Code)StatusElement.DeepCopyInternal(); - if(CreatedElement != null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopyInternal(); - if(Patient != null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopyInternal(); - if(Encounter != null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopyInternal(); - if(DateWrittenElement != null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)DateWrittenElement.DeepCopyInternal(); - if(Prescriber != null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)Prescriber.DeepCopyInternal(); - if(LensSpecification.Any()) dest.LensSpecification = new List(LensSpecification.DeepCopyInternal()); + if(_Identifier is not null) dest.Identifier = new List(_Identifier.DeepCopyInternal()); + if(_StatusElement is not null) dest.StatusElement = (Code)_StatusElement.DeepCopyInternal(); + if(_CreatedElement is not null) dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)_CreatedElement.DeepCopyInternal(); + if(_Patient is not null) dest.Patient = (Hl7.Fhir.Model.ResourceReference)_Patient.DeepCopyInternal(); + if(_Encounter is not null) dest.Encounter = (Hl7.Fhir.Model.ResourceReference)_Encounter.DeepCopyInternal(); + if(_DateWrittenElement is not null) dest.DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)_DateWrittenElement.DeepCopyInternal(); + if(_Prescriber is not null) dest.Prescriber = (Hl7.Fhir.Model.ResourceReference)_Prescriber.DeepCopyInternal(); + if(_LensSpecification is not null) dest.LensSpecification = new List(_LensSpecification.DeepCopyInternal()); } protected internal override Base DeepCopyInternal() @@ -1042,83 +988,83 @@ protected internal override Base DeepCopyInternal() public override bool CompareChildren(Base other, IEqualityComparer comparer) { - var otherT = other as VisionPrescription; - if(otherT == null) return false; + if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - if(!comparer.ListEquals(Identifier, otherT.Identifier)) return false; - if(!comparer.Equals(StatusElement, otherT.StatusElement)) return false; - if(!comparer.Equals(CreatedElement, otherT.CreatedElement)) return false; - if(!comparer.Equals(Patient, otherT.Patient)) return false; - if(!comparer.Equals(Encounter, otherT.Encounter)) return false; - if(!comparer.Equals(DateWrittenElement, otherT.DateWrittenElement)) return false; - if(!comparer.Equals(Prescriber, otherT.Prescriber)) return false; - if(!comparer.ListEquals(LensSpecification, otherT.LensSpecification)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; + if(!comparer.Equals(_Patient, otherT._Patient)) return false; + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + if(!comparer.Equals(_DateWrittenElement, otherT._DateWrittenElement)) return false; + if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; + if(!comparer.ListEquals(_LensSpecification, otherT._LensSpecification)) return false; +#pragma warning restore CS8604 // Possible null reference argument. return true; } - public override bool TryGetValue(string key, out object value) + public override bool TryGetValue(string key, [NotNullWhen(true)] out object? value) { switch (key) { case "identifier": - value = Identifier; - return Identifier?.Any() == true; + value = _Identifier; + return _Identifier?.Any() == true; case "status": - value = StatusElement; - return StatusElement is not null; + value = _StatusElement; + return _StatusElement is not null; case "created": - value = CreatedElement; - return CreatedElement is not null; + value = _CreatedElement; + return _CreatedElement is not null; case "patient": - value = Patient; - return Patient is not null; + value = _Patient; + return _Patient is not null; case "encounter": - value = Encounter; - return Encounter is not null; + value = _Encounter; + return _Encounter is not null; case "dateWritten": - value = DateWrittenElement; - return DateWrittenElement is not null; + value = _DateWrittenElement; + return _DateWrittenElement is not null; case "prescriber": - value = Prescriber; - return Prescriber is not null; + value = _Prescriber; + return _Prescriber is not null; case "lensSpecification": - value = LensSpecification; - return LensSpecification?.Any() == true; + value = _LensSpecification; + return _LensSpecification?.Any() == true; default: return base.TryGetValue(key, out value); } } - public override Base SetValue(string key, object value) + public override Base SetValue(string key, object? value) { switch (key) { case "identifier": - Identifier = (List)value; + Identifier = (List?)value!; return this; case "status": - StatusElement = (Code)value; + StatusElement = (Code?)value; return this; case "created": - CreatedElement = (Hl7.Fhir.Model.FhirDateTime)value; + CreatedElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "patient": - Patient = (Hl7.Fhir.Model.ResourceReference)value; + Patient = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "encounter": - Encounter = (Hl7.Fhir.Model.ResourceReference)value; + Encounter = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "dateWritten": - DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime)value; + DateWrittenElement = (Hl7.Fhir.Model.FhirDateTime?)value; return this; case "prescriber": - Prescriber = (Hl7.Fhir.Model.ResourceReference)value; + Prescriber = (Hl7.Fhir.Model.ResourceReference?)value; return this; case "lensSpecification": - LensSpecification = (List)value; + LensSpecification = (List?)value!; return this; default: return base.SetValue(key, value); @@ -1129,14 +1075,14 @@ public override Base SetValue(string key, object value) public override IEnumerable> EnumerateElements() { foreach (var kvp in base.EnumerateElements()) yield return kvp; - if (Identifier?.Any() == true) yield return new KeyValuePair("identifier",Identifier); - if (StatusElement is not null) yield return new KeyValuePair("status",StatusElement); - if (CreatedElement is not null) yield return new KeyValuePair("created",CreatedElement); - if (Patient is not null) yield return new KeyValuePair("patient",Patient); - if (Encounter is not null) yield return new KeyValuePair("encounter",Encounter); - if (DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",DateWrittenElement); - if (Prescriber is not null) yield return new KeyValuePair("prescriber",Prescriber); - if (LensSpecification?.Any() == true) yield return new KeyValuePair("lensSpecification",LensSpecification); + if (_Identifier?.Any() == true) yield return new KeyValuePair("identifier",_Identifier); + if (_StatusElement is not null) yield return new KeyValuePair("status",_StatusElement); + if (_CreatedElement is not null) yield return new KeyValuePair("created",_CreatedElement); + if (_Patient is not null) yield return new KeyValuePair("patient",_Patient); + if (_Encounter is not null) yield return new KeyValuePair("encounter",_Encounter); + if (_DateWrittenElement is not null) yield return new KeyValuePair("dateWritten",_DateWrittenElement); + if (_Prescriber is not null) yield return new KeyValuePair("prescriber",_Prescriber); + if (_LensSpecification?.Any() == true) yield return new KeyValuePair("lensSpecification",_LensSpecification); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs index 00dc62fee..88c8dbbd0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("AdverseEvent","http://hl7.org/fhir/StructureDefinition/AdverseEvent")] - public partial class AdverseEvent : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class AdverseEvent : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -695,7 +695,7 @@ public List Study private List? _Study; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs index 917cc5e20..3cada58a1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs @@ -637,7 +637,7 @@ public List> /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Category + public IEnumerable? Category { get => _CategoryElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs index 0ead43ade..d5d1ca517 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs @@ -1699,7 +1699,7 @@ public List> Re /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ReferencePolicy + public IEnumerable? ReferencePolicy { get => _ReferencePolicyElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs index 104ca8211..7d02b0c2a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ChargeItem","http://hl7.org/fhir/StructureDefinition/ChargeItem")] - public partial class ChargeItem : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ChargeItem : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -644,7 +644,7 @@ public List SupportingInformation private List? _SupportingInformation; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs index 074092cf1..3a5a45f8d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs @@ -1654,7 +1654,7 @@ public List CareTeamLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamLinkId + public IEnumerable? CareTeamLinkId { get => _CareTeamLinkIdElement?.Select(elem => elem.Value); set @@ -1686,7 +1686,7 @@ public List DiagnosisLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisLinkId + public IEnumerable? DiagnosisLinkId { get => _DiagnosisLinkIdElement?.Select(elem => elem.Value); set @@ -1718,7 +1718,7 @@ public List ProcedureLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureLinkId + public IEnumerable? ProcedureLinkId { get => _ProcedureLinkIdElement?.Select(elem => elem.Value); set @@ -1750,7 +1750,7 @@ public List InformationLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationLinkId + public IEnumerable? InformationLinkId { get => _InformationLinkIdElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs index 2c708b830..ada8e095d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs @@ -126,7 +126,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -493,7 +493,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -686,7 +686,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -827,7 +827,7 @@ public List SequenceLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SequenceLinkId + public IEnumerable? SequenceLinkId { get => _SequenceLinkIdElement?.Select(elem => elem.Value); set @@ -929,7 +929,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -1208,7 +1208,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs index 92b4c2729..afc131048 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("CodeSystem","http://hl7.org/fhir/StructureDefinition/CodeSystem")] - public partial class CodeSystem : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class CodeSystem : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -270,7 +270,7 @@ public List> OperatorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Operator + public IEnumerable? Operator { get => _OperatorElement?.Select(elem => elem.Value); set @@ -1778,7 +1778,7 @@ public List Concept private List? _Concept; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs index 85ccc4567..e20101fc4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs @@ -56,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Composition","http://hl7.org/fhir/StructureDefinition/Composition")] - public partial class Composition : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class Composition : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -198,7 +198,7 @@ public List> ModeEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Mode + public IEnumerable? Mode { get => _ModeElement?.Select(elem => elem.Value); set @@ -1170,7 +1170,7 @@ public List Section private List? _Section; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs index 567c2452d..7e3a2622c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ConceptMap","http://hl7.org/fhir/StructureDefinition/ConceptMap")] - public partial class ConceptMap : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ConceptMap : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -1703,7 +1703,7 @@ public List Group private List? _Group; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs index 8043d71b2..3b830a7c4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs @@ -56,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Consent","http://hl7.org/fhir/StructureDefinition/Consent")] - public partial class Consent : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class Consent : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -1431,7 +1431,7 @@ public List Except private List? _Except; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs index f479aab14..b897ae0c1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("Contract","http://hl7.org/fhir/StructureDefinition/Contract")] - public partial class Contract : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class Contract : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -2167,7 +2167,7 @@ public List Rule private List? _Rule; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs index 47ec61452..ec334364a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("DetectedIssue","http://hl7.org/fhir/StructureDefinition/DetectedIssue")] - public partial class DetectedIssue : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class DetectedIssue : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -475,7 +475,7 @@ public List Mitigation private List? _Mitigation; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs index f95269f1a..611f0655b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs @@ -56,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("DeviceComponent","http://hl7.org/fhir/StructureDefinition/DeviceComponent")] - public partial class DeviceComponent : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class DeviceComponent : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -463,7 +463,7 @@ public Hl7.Fhir.Model.CodeableConcept? LanguageCode private Hl7.Fhir.Model.CodeableConcept? _LanguageCode; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs index e97f3f21c..001b9b355 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs @@ -56,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("DeviceMetric","http://hl7.org/fhir/StructureDefinition/DeviceMetric")] - public partial class DeviceMetric : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class DeviceMetric : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -628,7 +628,7 @@ public List Calibration private List? _Calibration; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs index e1ae6fca0..f8c8c1f4b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs @@ -908,7 +908,7 @@ public List> AggregationE /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Aggregation + public IEnumerable? Aggregation { get => _AggregationElement?.Select(elem => elem.Value); set @@ -1959,7 +1959,7 @@ public List> Repre /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Representation + public IEnumerable? Representation { get => _RepresentationElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs index 1ca385928..359083ee6 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ExpansionProfile","http://hl7.org/fhir/StructureDefinition/ExpansionProfile")] - public partial class ExpansionProfile : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ExpansionProfile : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -1514,7 +1514,7 @@ public bool? LimitedExpansion } } - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs index a6d4f898d..8f4e9f4f2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs @@ -1667,7 +1667,7 @@ public List CareTeamLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamLinkId + public IEnumerable? CareTeamLinkId { get => _CareTeamLinkIdElement?.Select(elem => elem.Value); set @@ -1699,7 +1699,7 @@ public List DiagnosisLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisLinkId + public IEnumerable? DiagnosisLinkId { get => _DiagnosisLinkIdElement?.Select(elem => elem.Value); set @@ -1731,7 +1731,7 @@ public List ProcedureLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureLinkId + public IEnumerable? ProcedureLinkId { get => _ProcedureLinkIdElement?.Select(elem => elem.Value); set @@ -1763,7 +1763,7 @@ public List InformationLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationLinkId + public IEnumerable? InformationLinkId { get => _InformationLinkIdElement?.Select(elem => elem.Value); set @@ -2027,7 +2027,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -2735,7 +2735,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -3197,7 +3197,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -3437,7 +3437,7 @@ public List SequenceLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SequenceLinkId + public IEnumerable? SequenceLinkId { get => _SequenceLinkIdElement?.Select(elem => elem.Value); set @@ -3539,7 +3539,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set @@ -3818,7 +3818,7 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable? NoteNumber { get => _NoteNumberElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs index 1a383575e..3eaa39c44 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("GuidanceResponse","http://hl7.org/fhir/StructureDefinition/GuidanceResponse")] - public partial class GuidanceResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class GuidanceResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -359,7 +359,7 @@ public List DataRequirement private List? _DataRequirement; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs index 78353a6e9..dcf8b75c4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs @@ -97,7 +97,7 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable? DaysOfWeek { get => _DaysOfWeekElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs index 9af996ce4..debe8e9f1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ImagingManifest","http://hl7.org/fhir/StructureDefinition/ImagingManifest")] - public partial class ImagingManifest : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ImagingManifest : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -655,7 +655,7 @@ public List Study private List? _Study; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs index f59146c8a..282005def 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs @@ -982,7 +982,7 @@ public List> TypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Type + public IEnumerable? Type { get => _TypeElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs index 9b7c7853d..2e8e9387f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MeasureReport","http://hl7.org/fhir/StructureDefinition/MeasureReport")] - public partial class MeasureReport : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class MeasureReport : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -1111,7 +1111,7 @@ public Hl7.Fhir.Model.ResourceReference? EvaluatedResources private Hl7.Fhir.Model.ResourceReference? _EvaluatedResources; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs index 10f1cc883..1782ca360 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs @@ -56,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("MessageDefinition","http://hl7.org/fhir/StructureDefinition/MessageDefinition")] - public partial class MessageDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class MessageDefinition : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -916,7 +916,7 @@ public List AllowedRe private List? _AllowedResponse; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs index 580e7186e..682c9f426 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs @@ -1223,7 +1223,7 @@ public List> ResourceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Resource + public IEnumerable? Resource { get => _ResourceElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs index cfbd1e15f..cabccfd35 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs @@ -100,7 +100,7 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable? DaysOfWeek { get => _DaysOfWeekElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs index 5b9abf9d5..f3993fb73 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs @@ -1456,7 +1456,7 @@ public List> SubjectTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubjectType + public IEnumerable? SubjectType { get => _SubjectTypeElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs index 42e5e6bf9..8205f0ab2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs @@ -56,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("QuestionnaireResponse","http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse")] - public partial class QuestionnaireResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class QuestionnaireResponse : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -665,7 +665,7 @@ public List Item private List? _Item; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs index d58d6776f..82f5e6d68 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs @@ -56,7 +56,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("ResearchSubject","http://hl7.org/fhir/StructureDefinition/ResearchSubject")] - public partial class ResearchSubject : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class ResearchSubject : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -269,7 +269,7 @@ public Hl7.Fhir.Model.ResourceReference? Consent private Hl7.Fhir.Model.ResourceReference? _Consent; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs index 1596161ea..224a7b00b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("RiskAssessment","http://hl7.org/fhir/StructureDefinition/RiskAssessment")] - public partial class RiskAssessment : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class RiskAssessment : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -578,7 +578,7 @@ public string? Comment } } - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs index 186e886a4..ecafd1c43 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs @@ -690,7 +690,7 @@ public List> BaseElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Base + public IEnumerable? Base { get => _BaseElement?.Select(elem => elem.Value); set @@ -898,7 +898,7 @@ public List> TargetElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Target + public IEnumerable? Target { get => _TargetElement?.Select(elem => elem.Value); set @@ -932,7 +932,7 @@ public List> ComparatorEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comparator + public IEnumerable? Comparator { get => _ComparatorElement?.Select(elem => elem.Value); set @@ -966,7 +966,7 @@ public List> ModifierEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modifier + public IEnumerable? Modifier { get => _ModifierElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs index 401943f5f..37d5fbe2c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs @@ -1864,7 +1864,7 @@ public List> ListMo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ListMode + public IEnumerable? ListMode { get => _ListModeElement?.Select(elem => elem.Value); set diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs index b727b7922..0954367a9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SupplyDelivery","http://hl7.org/fhir/StructureDefinition/SupplyDelivery")] - public partial class SupplyDelivery : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class SupplyDelivery : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -412,7 +412,7 @@ public List Receiver private List? _Receiver; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs index 91b83aad1..9748a4d19 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("SupplyRequest","http://hl7.org/fhir/StructureDefinition/SupplyRequest")] - public partial class SupplyRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class SupplyRequest : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -564,7 +564,7 @@ public Hl7.Fhir.Model.ResourceReference? DeliverTo private Hl7.Fhir.Model.ResourceReference? _DeliverTo; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs index a1d5f4890..5cc94f0e8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("TestReport","http://hl7.org/fhir/StructureDefinition/TestReport")] - public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class TestReport : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -1658,7 +1658,7 @@ public Hl7.Fhir.Model.TestReport.TeardownComponent? Teardown private Hl7.Fhir.Model.TestReport.TeardownComponent? _Teardown; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs index e3f195cfe..11a509ce2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs @@ -55,7 +55,7 @@ namespace Hl7.Fhir.Model [Serializable] [DataContract] [FhirType("TestScript","http://hl7.org/fhir/StructureDefinition/TestScript")] - public partial class TestScript : Hl7.Fhir.Model.DomainResource, IIdentifiable + public partial class TestScript : Hl7.Fhir.Model.DomainResource, IIdentifiable { /// /// FHIR Type Name @@ -961,7 +961,7 @@ public List OriginElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Origin + public IEnumerable? Origin { get => _OriginElement?.Select(elem => elem.Value); set @@ -5932,7 +5932,7 @@ public Hl7.Fhir.Model.TestScript.TeardownComponent? Teardown private Hl7.Fhir.Model.TestScript.TeardownComponent? _Teardown; - Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } + Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } protected internal override void CopyToInternal(Base other) { diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs index 30155b1b2..b5f60d580 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs @@ -579,7 +579,7 @@ public List> DayOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DayOfWeek + public IEnumerable? DayOfWeek { get => _DayOfWeekElement?.Select(elem => elem.Value); set @@ -645,7 +645,7 @@ public List> WhenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? When + public IEnumerable? When { get => _WhenElement?.Select(elem => elem.Value); set diff --git a/src/firely-net-sdk-tests.props b/src/firely-net-sdk-tests.props index 3958e103f..5afe695e8 100644 --- a/src/firely-net-sdk-tests.props +++ b/src/firely-net-sdk-tests.props @@ -3,7 +3,7 @@ net8.0 12.0 true - true + diff --git a/src/firely-net-sdk.props b/src/firely-net-sdk.props index db6551484..971812c54 100644 --- a/src/firely-net-sdk.props +++ b/src/firely-net-sdk.props @@ -41,7 +41,7 @@ CS4014 - true + From b283ffcf24696fbd805e5eeccb367c16a53a9a73 Mon Sep 17 00:00:00 2001 From: Ewout Kramer Date: Mon, 24 Feb 2025 17:07:16 +0100 Subject: [PATCH 4/6] Oops, list initialization was wrong. --- .../Model/Generated/BackboneElement.cs | 2 +- .../Model/Generated/BackboneType.cs | 2 +- src/Hl7.Fhir.Base/Model/Generated/Bundle.cs | 6 +- .../Model/Generated/CodeableConcept.cs | 2 +- .../Model/Generated/ContactDetail.cs | 2 +- .../Model/Generated/DomainResource.cs | 6 +- src/Hl7.Fhir.Base/Model/Generated/Element.cs | 2 +- src/Hl7.Fhir.Base/Model/Generated/Meta.cs | 6 +- .../Model/Generated/OperationOutcome.cs | 6 +- .../Model/Generated/Parameters.cs | 4 +- .../Model/Generated/Signature.cs | 2 +- .../Model/Generated/CapabilityStatement.cs | 56 +++---- .../Model/Generated/CodeSystem.cs | 36 ++--- .../Model/Generated/ElementDefinition.cs | 30 ++-- .../Model/Generated/RelatedArtifact.cs | 2 +- .../Model/Generated/StructureDefinition.cs | 20 +-- .../Model/Generated/ValueSet.cs | 50 +++--- src/Hl7.Fhir.R4/Model/Generated/Account.cs | 8 +- .../Model/Generated/ActivityDefinition.cs | 36 ++--- src/Hl7.Fhir.R4/Model/Generated/Address.cs | 2 +- .../Model/Generated/AdverseEvent.cs | 16 +- .../Model/Generated/AllergyIntolerance.cs | 12 +- .../Model/Generated/Appointment.cs | 24 +-- .../Model/Generated/AppointmentResponse.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs | 20 +-- src/Hl7.Fhir.R4/Model/Generated/Basic.cs | 2 +- .../Generated/BiologicallyDerivedProduct.cs | 10 +- .../Model/Generated/BodyStructure.cs | 6 +- src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs | 46 +++--- src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs | 18 +-- .../Model/Generated/CatalogEntry.cs | 12 +- src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs | 22 +-- .../Model/Generated/ChargeItemDefinition.cs | 24 +-- src/Hl7.Fhir.R4/Model/Generated/Claim.cs | 58 +++---- .../Model/Generated/ClaimResponse.cs | 68 ++++---- .../Model/Generated/ClinicalImpression.cs | 20 +-- .../Model/Generated/Communication.cs | 28 ++-- .../Model/Generated/CommunicationRequest.cs | 22 +-- .../Model/Generated/CompartmentDefinition.cs | 8 +- .../Model/Generated/Composition.cs | 22 +-- src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs | 16 +- src/Hl7.Fhir.R4/Model/Generated/Condition.cs | 18 +-- src/Hl7.Fhir.R4/Model/Generated/Consent.cs | 28 ++-- src/Hl7.Fhir.R4/Model/Generated/Contract.cs | 114 ++++++------- .../Model/Generated/Contributor.cs | 2 +- src/Hl7.Fhir.R4/Model/Generated/Coverage.cs | 12 +- .../Generated/CoverageEligibilityRequest.cs | 18 +-- .../Generated/CoverageEligibilityResponse.cs | 16 +- .../Model/Generated/DataRequirement.cs | 12 +- .../Model/Generated/DetectedIssue.cs | 12 +- src/Hl7.Fhir.R4/Model/Generated/Device.cs | 24 +-- .../Model/Generated/DeviceDefinition.cs | 32 ++-- .../Model/Generated/DeviceMetric.cs | 4 +- .../Model/Generated/DeviceRequest.cs | 24 +-- .../Model/Generated/DeviceUseStatement.cs | 12 +- .../Model/Generated/DiagnosticReport.cs | 22 +-- .../Model/Generated/DocumentManifest.cs | 10 +- .../Model/Generated/DocumentReference.cs | 18 +-- src/Hl7.Fhir.R4/Model/Generated/Dosage.cs | 4 +- .../Generated/EffectEvidenceSynthesis.cs | 40 ++--- src/Hl7.Fhir.R4/Model/Generated/Encounter.cs | 34 ++-- src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs | 10 +- .../Model/Generated/EnrollmentRequest.cs | 2 +- .../Model/Generated/EnrollmentResponse.cs | 2 +- .../Model/Generated/EpisodeOfCare.cs | 14 +- .../Model/Generated/EventDefinition.cs | 22 +-- src/Hl7.Fhir.R4/Model/Generated/Evidence.cs | 26 +-- .../Model/Generated/EvidenceVariable.cs | 26 +-- .../Model/Generated/ExampleScenario.cs | 28 ++-- .../Model/Generated/ExplanationOfBenefit.cs | 120 +++++++------- .../Model/Generated/FamilyMemberHistory.cs | 16 +- src/Hl7.Fhir.R4/Model/Generated/Flag.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/Goal.cs | 14 +- .../Model/Generated/GraphDefinition.cs | 14 +- src/Hl7.Fhir.R4/Model/Generated/Group.cs | 6 +- .../Model/Generated/GuidanceResponse.cs | 12 +- .../Model/Generated/HealthcareService.cs | 34 ++-- src/Hl7.Fhir.R4/Model/Generated/HumanName.cs | 6 +- .../Model/Generated/ImagingStudy.cs | 28 ++-- .../Model/Generated/Immunization.cs | 22 +-- .../Model/Generated/ImmunizationEvaluation.cs | 4 +- .../Generated/ImmunizationRecommendation.cs | 16 +- .../Model/Generated/ImplementationGuide.cs | 34 ++-- .../Model/Generated/InsurancePlan.cs | 42 ++--- src/Hl7.Fhir.R4/Model/Generated/Invoice.cs | 12 +- src/Hl7.Fhir.R4/Model/Generated/Library.cs | 26 +-- src/Hl7.Fhir.R4/Model/Generated/Linkage.cs | 2 +- src/Hl7.Fhir.R4/Model/Generated/List.cs | 6 +- src/Hl7.Fhir.R4/Model/Generated/Location.cs | 14 +- src/Hl7.Fhir.R4/Model/Generated/Measure.cs | 38 ++--- .../Model/Generated/MeasureReport.cs | 18 +-- src/Hl7.Fhir.R4/Model/Generated/Media.cs | 10 +- src/Hl7.Fhir.R4/Model/Generated/Medication.cs | 4 +- .../Generated/MedicationAdministration.cs | 22 +-- .../Model/Generated/MedicationDispense.cs | 24 +-- .../Model/Generated/MedicationKnowledge.cs | 50 +++--- .../Model/Generated/MedicationRequest.cs | 26 +-- .../Model/Generated/MedicationStatement.cs | 18 +-- .../Model/Generated/MedicinalProduct.cs | 36 ++--- .../MedicinalProductAuthorization.cs | 14 +- .../MedicinalProductContraindication.cs | 10 +- .../Generated/MedicinalProductIndication.cs | 10 +- .../Generated/MedicinalProductIngredient.cs | 14 +- .../Generated/MedicinalProductInteraction.cs | 4 +- .../Generated/MedicinalProductManufactured.cs | 6 +- .../Generated/MedicinalProductPackaged.cs | 30 ++-- .../MedicinalProductPharmaceutical.cs | 14 +- .../MedicinalProductUndesirableEffect.cs | 4 +- .../Model/Generated/MessageDefinition.cs | 18 +-- .../Model/Generated/MessageHeader.cs | 4 +- .../Model/Generated/MolecularSequence.cs | 26 +-- .../Model/Generated/NamingSystem.cs | 8 +- .../Model/Generated/NutritionOrder.cs | 32 ++-- .../Model/Generated/Observation.cs | 30 ++-- .../Model/Generated/ObservationDefinition.cs | 10 +- .../Model/Generated/OperationDefinition.cs | 20 +-- .../Model/Generated/Organization.cs | 16 +- .../Generated/OrganizationAffiliation.cs | 16 +- src/Hl7.Fhir.R4/Model/Generated/Patient.cs | 22 +-- .../Model/Generated/PaymentNotice.cs | 2 +- .../Model/Generated/PaymentReconciliation.cs | 6 +- src/Hl7.Fhir.R4/Model/Generated/Person.cs | 10 +- .../Model/Generated/PlanDefinition.cs | 56 +++---- .../Model/Generated/Practitioner.cs | 16 +- .../Model/Generated/PractitionerRole.cs | 20 +-- src/Hl7.Fhir.R4/Model/Generated/Procedure.cs | 34 ++-- .../Model/Generated/ProdCharacteristic.cs | 6 +- .../Model/Generated/ProductShelfLife.cs | 2 +- src/Hl7.Fhir.R4/Model/Generated/Provenance.cs | 16 +- .../Model/Generated/Questionnaire.cs | 26 +-- .../Model/Generated/QuestionnaireResponse.cs | 12 +- .../Model/Generated/RelatedPerson.cs | 14 +- .../Model/Generated/RequestGroup.cs | 30 ++-- .../Model/Generated/ResearchDefinition.cs | 24 +-- .../Generated/ResearchElementDefinition.cs | 28 ++-- .../Model/Generated/ResearchStudy.cs | 30 ++-- .../Model/Generated/ResearchSubject.cs | 2 +- .../Model/Generated/RiskAssessment.cs | 12 +- .../Model/Generated/RiskEvidenceSynthesis.cs | 36 ++--- src/Hl7.Fhir.R4/Model/Generated/Schedule.cs | 10 +- .../Model/Generated/SearchParameter.cs | 18 +-- .../Model/Generated/ServiceRequest.cs | 36 ++--- src/Hl7.Fhir.R4/Model/Generated/Slot.cs | 8 +- src/Hl7.Fhir.R4/Model/Generated/Specimen.cs | 18 +-- .../Model/Generated/SpecimenDefinition.cs | 12 +- .../Model/Generated/StructureMap.cs | 32 ++-- .../Model/Generated/Subscription.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/Substance.cs | 8 +- .../Model/Generated/SubstanceNucleicAcid.cs | 6 +- .../Model/Generated/SubstancePolymer.cs | 16 +- .../Model/Generated/SubstanceProtein.cs | 4 +- .../SubstanceReferenceInformation.cs | 18 +-- .../Generated/SubstanceSourceMaterial.cs | 14 +- .../Model/Generated/SubstanceSpecification.cs | 38 ++--- .../Model/Generated/SupplyDelivery.cs | 8 +- .../Model/Generated/SupplyRequest.cs | 10 +- src/Hl7.Fhir.R4/Model/Generated/Task.cs | 20 +-- .../Generated/TerminologyCapabilities.cs | 20 +-- src/Hl7.Fhir.R4/Model/Generated/TestReport.cs | 10 +- src/Hl7.Fhir.R4/Model/Generated/TestScript.cs | 34 ++-- src/Hl7.Fhir.R4/Model/Generated/Timing.cs | 8 +- .../Model/Generated/TriggerDefinition.cs | 2 +- .../Model/Generated/VerificationResult.cs | 16 +- .../Model/Generated/VisionPrescription.cs | 8 +- src/Hl7.Fhir.R4B/Model/Generated/Account.cs | 8 +- .../Model/Generated/ActivityDefinition.cs | 36 ++--- src/Hl7.Fhir.R4B/Model/Generated/Address.cs | 2 +- .../AdministrableProductDefinition.cs | 16 +- .../Model/Generated/AdverseEvent.cs | 16 +- .../Model/Generated/AllergyIntolerance.cs | 12 +- .../Model/Generated/Appointment.cs | 24 +-- .../Model/Generated/AppointmentResponse.cs | 4 +- .../Model/Generated/AuditEvent.cs | 20 +-- src/Hl7.Fhir.R4B/Model/Generated/Basic.cs | 2 +- .../Generated/BiologicallyDerivedProduct.cs | 10 +- .../Model/Generated/BodyStructure.cs | 6 +- src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs | 46 +++--- src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs | 18 +-- .../Model/Generated/CatalogEntry.cs | 12 +- .../Model/Generated/ChargeItem.cs | 22 +-- .../Model/Generated/ChargeItemDefinition.cs | 24 +-- src/Hl7.Fhir.R4B/Model/Generated/Citation.cs | 82 +++++----- src/Hl7.Fhir.R4B/Model/Generated/Claim.cs | 58 +++---- .../Model/Generated/ClaimResponse.cs | 68 ++++---- .../Model/Generated/ClinicalImpression.cs | 20 +-- .../Model/Generated/ClinicalUseDefinition.cs | 24 +-- .../Model/Generated/Communication.cs | 28 ++-- .../Model/Generated/CommunicationRequest.cs | 22 +-- .../Model/Generated/CompartmentDefinition.cs | 8 +- .../Model/Generated/Composition.cs | 22 +-- .../Model/Generated/ConceptMap.cs | 16 +- src/Hl7.Fhir.R4B/Model/Generated/Condition.cs | 18 +-- src/Hl7.Fhir.R4B/Model/Generated/Consent.cs | 28 ++-- src/Hl7.Fhir.R4B/Model/Generated/Contract.cs | 114 ++++++------- .../Model/Generated/Contributor.cs | 2 +- src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs | 12 +- .../Generated/CoverageEligibilityRequest.cs | 18 +-- .../Generated/CoverageEligibilityResponse.cs | 16 +- .../Model/Generated/DataRequirement.cs | 12 +- .../Model/Generated/DetectedIssue.cs | 12 +- src/Hl7.Fhir.R4B/Model/Generated/Device.cs | 24 +-- .../Model/Generated/DeviceDefinition.cs | 32 ++-- .../Model/Generated/DeviceMetric.cs | 4 +- .../Model/Generated/DeviceRequest.cs | 24 +-- .../Model/Generated/DeviceUseStatement.cs | 12 +- .../Model/Generated/DiagnosticReport.cs | 22 +-- .../Model/Generated/DocumentManifest.cs | 10 +- .../Model/Generated/DocumentReference.cs | 18 +-- src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs | 34 ++-- src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs | 10 +- .../Model/Generated/EnrollmentRequest.cs | 2 +- .../Model/Generated/EnrollmentResponse.cs | 2 +- .../Model/Generated/EpisodeOfCare.cs | 14 +- .../Model/Generated/EventDefinition.cs | 22 +-- src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs | 52 +++--- .../Model/Generated/EvidenceReport.cs | 38 ++--- .../Model/Generated/EvidenceVariable.cs | 24 +-- .../Model/Generated/ExampleScenario.cs | 28 ++-- .../Model/Generated/ExplanationOfBenefit.cs | 120 +++++++------- .../Model/Generated/FamilyMemberHistory.cs | 16 +- src/Hl7.Fhir.R4B/Model/Generated/Flag.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/Goal.cs | 14 +- .../Model/Generated/GraphDefinition.cs | 14 +- src/Hl7.Fhir.R4B/Model/Generated/Group.cs | 6 +- .../Model/Generated/GuidanceResponse.cs | 12 +- .../Model/Generated/HealthcareService.cs | 34 ++-- src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs | 6 +- .../Model/Generated/ImagingStudy.cs | 28 ++-- .../Model/Generated/Immunization.cs | 22 +-- .../Model/Generated/ImmunizationEvaluation.cs | 4 +- .../Generated/ImmunizationRecommendation.cs | 16 +- .../Model/Generated/ImplementationGuide.cs | 34 ++-- .../Model/Generated/Ingredient.cs | 14 +- .../Model/Generated/InsurancePlan.cs | 42 ++--- src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs | 12 +- src/Hl7.Fhir.R4B/Model/Generated/Library.cs | 26 +-- src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs | 2 +- src/Hl7.Fhir.R4B/Model/Generated/List.cs | 6 +- src/Hl7.Fhir.R4B/Model/Generated/Location.cs | 14 +- .../Generated/ManufacturedItemDefinition.cs | 8 +- src/Hl7.Fhir.R4B/Model/Generated/Measure.cs | 38 ++--- .../Model/Generated/MeasureReport.cs | 18 +-- src/Hl7.Fhir.R4B/Model/Generated/Media.cs | 10 +- .../Model/Generated/Medication.cs | 4 +- .../Generated/MedicationAdministration.cs | 22 +-- .../Model/Generated/MedicationDispense.cs | 24 +-- .../Model/Generated/MedicationKnowledge.cs | 50 +++--- .../Model/Generated/MedicationRequest.cs | 26 +-- .../Model/Generated/MedicationStatement.cs | 18 +-- .../Generated/MedicinalProductDefinition.cs | 40 ++--- .../Model/Generated/MessageDefinition.cs | 18 +-- .../Model/Generated/MessageHeader.cs | 4 +- .../Model/Generated/MolecularSequence.cs | 26 +-- .../Model/Generated/NamingSystem.cs | 8 +- .../Model/Generated/NutritionOrder.cs | 32 ++-- .../Model/Generated/NutritionProduct.cs | 20 +-- .../Model/Generated/Observation.cs | 30 ++-- .../Model/Generated/ObservationDefinition.cs | 10 +- .../Model/Generated/OperationDefinition.cs | 20 +-- .../Model/Generated/Organization.cs | 16 +- .../Generated/OrganizationAffiliation.cs | 16 +- .../Generated/PackagedProductDefinition.cs | 32 ++-- src/Hl7.Fhir.R4B/Model/Generated/Patient.cs | 22 +-- .../Model/Generated/PaymentNotice.cs | 2 +- .../Model/Generated/PaymentReconciliation.cs | 6 +- src/Hl7.Fhir.R4B/Model/Generated/Person.cs | 10 +- .../Model/Generated/PlanDefinition.cs | 56 +++---- .../Model/Generated/Practitioner.cs | 16 +- .../Model/Generated/PractitionerRole.cs | 20 +-- src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs | 34 ++-- .../Model/Generated/ProdCharacteristic.cs | 6 +- .../Model/Generated/ProductShelfLife.cs | 2 +- .../Model/Generated/Provenance.cs | 16 +- .../Model/Generated/Questionnaire.cs | 26 +-- .../Model/Generated/QuestionnaireResponse.cs | 12 +- .../Model/Generated/RegulatedAuthorization.cs | 10 +- .../Model/Generated/RelatedPerson.cs | 14 +- .../Model/Generated/RequestGroup.cs | 30 ++-- .../Model/Generated/ResearchDefinition.cs | 24 +-- .../Generated/ResearchElementDefinition.cs | 28 ++-- .../Model/Generated/ResearchStudy.cs | 30 ++-- .../Model/Generated/ResearchSubject.cs | 2 +- .../Model/Generated/RiskAssessment.cs | 12 +- src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs | 10 +- .../Model/Generated/SearchParameter.cs | 18 +-- .../Model/Generated/ServiceRequest.cs | 36 ++--- src/Hl7.Fhir.R4B/Model/Generated/Slot.cs | 8 +- src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs | 18 +-- .../Model/Generated/SpecimenDefinition.cs | 12 +- .../Model/Generated/StructureMap.cs | 32 ++-- .../Model/Generated/Subscription.cs | 4 +- .../Model/Generated/SubscriptionStatus.cs | 6 +- .../Model/Generated/SubscriptionTopic.cs | 26 +-- src/Hl7.Fhir.R4B/Model/Generated/Substance.cs | 8 +- .../Model/Generated/SubstanceDefinition.cs | 54 +++---- .../Model/Generated/SupplyDelivery.cs | 8 +- .../Model/Generated/SupplyRequest.cs | 10 +- src/Hl7.Fhir.R4B/Model/Generated/Task.cs | 20 +-- .../Generated/TerminologyCapabilities.cs | 20 +-- .../Model/Generated/TestReport.cs | 10 +- .../Model/Generated/TestScript.cs | 34 ++-- src/Hl7.Fhir.R4B/Model/Generated/Timing.cs | 8 +- .../Model/Generated/TriggerDefinition.cs | 2 +- .../Model/Generated/VerificationResult.cs | 16 +- .../Model/Generated/VisionPrescription.cs | 8 +- src/Hl7.Fhir.R5/Model/Generated/Account.cs | 26 +-- .../Model/Generated/ActivityDefinition.cs | 36 ++--- .../Model/Generated/ActorDefinition.cs | 12 +- src/Hl7.Fhir.R5/Model/Generated/Address.cs | 2 +- .../AdministrableProductDefinition.cs | 16 +- .../Model/Generated/AdverseEvent.cs | 24 +-- .../Model/Generated/AllergyIntolerance.cs | 14 +- .../Model/Generated/Appointment.cs | 42 ++--- .../Model/Generated/AppointmentResponse.cs | 4 +- .../Model/Generated/ArtifactAssessment.cs | 12 +- src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs | 26 +-- .../Model/Generated/Availability.cs | 6 +- src/Hl7.Fhir.R5/Model/Generated/Basic.cs | 2 +- .../Generated/BiologicallyDerivedProduct.cs | 10 +- .../BiologicallyDerivedProductDispense.cs | 10 +- .../Model/Generated/BodyStructure.cs | 26 +-- src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs | 32 ++-- src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs | 14 +- src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs | 24 +-- .../Model/Generated/ChargeItemDefinition.cs | 24 +-- src/Hl7.Fhir.R5/Model/Generated/Citation.cs | 76 ++++----- src/Hl7.Fhir.R5/Model/Generated/Claim.cs | 76 ++++----- .../Model/Generated/ClaimResponse.cs | 96 +++++------ .../Model/Generated/ClinicalImpression.cs | 16 +- .../Model/Generated/ClinicalUseDefinition.cs | 26 +-- .../Model/Generated/Communication.cs | 26 +-- .../Model/Generated/CommunicationRequest.cs | 22 +-- .../Model/Generated/CompartmentDefinition.cs | 8 +- .../Model/Generated/Composition.cs | 28 ++-- src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs | 36 ++--- src/Hl7.Fhir.R5/Model/Generated/Condition.cs | 16 +- .../Model/Generated/ConditionDefinition.cs | 22 +-- src/Hl7.Fhir.R5/Model/Generated/Consent.cs | 44 ++--- src/Hl7.Fhir.R5/Model/Generated/Contract.cs | 110 ++++++------- .../Model/Generated/Contributor.cs | 2 +- src/Hl7.Fhir.R5/Model/Generated/Coverage.cs | 14 +- .../Generated/CoverageEligibilityRequest.cs | 20 +-- .../Generated/CoverageEligibilityResponse.cs | 20 +-- .../Model/Generated/DataRequirement.cs | 14 +- .../Model/Generated/DetectedIssue.cs | 16 +- src/Hl7.Fhir.R5/Model/Generated/Device.cs | 26 +-- .../Model/Generated/DeviceAssociation.cs | 10 +- .../Model/Generated/DeviceDefinition.cs | 66 ++++---- .../Model/Generated/DeviceDispense.cs | 16 +- .../Model/Generated/DeviceMetric.cs | 4 +- .../Model/Generated/DeviceRequest.cs | 22 +-- .../Model/Generated/DeviceUsage.cs | 16 +- .../Model/Generated/DiagnosticReport.cs | 26 +-- .../Model/Generated/DocumentReference.cs | 26 +-- src/Hl7.Fhir.R5/Model/Generated/Dosage.cs | 8 +- src/Hl7.Fhir.R5/Model/Generated/Encounter.cs | 44 ++--- .../Model/Generated/EncounterHistory.cs | 8 +- src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs | 16 +- .../Model/Generated/EnrollmentRequest.cs | 2 +- .../Model/Generated/EnrollmentResponse.cs | 2 +- .../Model/Generated/EpisodeOfCare.cs | 20 +-- .../Model/Generated/EventDefinition.cs | 22 +-- src/Hl7.Fhir.R5/Model/Generated/Evidence.cs | 54 +++---- .../Model/Generated/EvidenceReport.cs | 38 ++--- .../Model/Generated/EvidenceVariable.cs | 32 ++-- .../Model/Generated/ExampleScenario.cs | 24 +-- .../Model/Generated/ExplanationOfBenefit.cs | 152 +++++++++--------- .../Model/Generated/ExtendedContactDetail.cs | 4 +- .../Model/Generated/FamilyMemberHistory.cs | 20 +-- src/Hl7.Fhir.R5/Model/Generated/Flag.cs | 4 +- .../Model/Generated/FormularyItem.cs | 2 +- .../Model/Generated/GenomicStudy.cs | 38 ++--- src/Hl7.Fhir.R5/Model/Generated/Goal.cs | 12 +- .../Model/Generated/GraphDefinition.cs | 14 +- src/Hl7.Fhir.R5/Model/Generated/Group.cs | 6 +- .../Model/Generated/GuidanceResponse.cs | 10 +- .../Model/Generated/HealthcareService.cs | 32 ++-- src/Hl7.Fhir.R5/Model/Generated/HumanName.cs | 6 +- .../Model/Generated/ImagingSelection.cs | 26 +-- .../Model/Generated/ImagingStudy.cs | 26 +-- .../Model/Generated/Immunization.cs | 22 +-- .../Model/Generated/ImmunizationEvaluation.cs | 4 +- .../Generated/ImmunizationRecommendation.cs | 18 +-- .../Model/Generated/ImplementationGuide.cs | 40 ++--- src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs | 14 +- .../Model/Generated/InsurancePlan.cs | 40 ++--- .../Model/Generated/InventoryItem.cs | 18 +-- .../Model/Generated/InventoryReport.cs | 8 +- src/Hl7.Fhir.R5/Model/Generated/Invoice.cs | 12 +- src/Hl7.Fhir.R5/Model/Generated/Library.cs | 26 +-- src/Hl7.Fhir.R5/Model/Generated/Linkage.cs | 2 +- src/Hl7.Fhir.R5/Model/Generated/List.cs | 8 +- src/Hl7.Fhir.R5/Model/Generated/Location.cs | 16 +- .../Generated/ManufacturedItemDefinition.cs | 30 ++-- src/Hl7.Fhir.R5/Model/Generated/Measure.cs | 42 ++--- .../Model/Generated/MeasureReport.cs | 22 +-- src/Hl7.Fhir.R5/Model/Generated/Medication.cs | 4 +- .../Generated/MedicationAdministration.cs | 24 +-- .../Model/Generated/MedicationDispense.cs | 24 +-- .../Model/Generated/MedicationKnowledge.cs | 64 ++++---- .../Model/Generated/MedicationRequest.cs | 26 +-- .../Model/Generated/MedicationStatement.cs | 18 +-- .../Generated/MedicinalProductDefinition.cs | 42 ++--- .../Model/Generated/MessageDefinition.cs | 16 +- .../Model/Generated/MessageHeader.cs | 4 +- .../Model/Generated/MolecularSequence.cs | 10 +- .../Model/Generated/NamingSystem.cs | 22 +-- .../Model/Generated/NutritionIntake.cs | 24 +-- .../Model/Generated/NutritionOrder.cs | 44 ++--- .../Model/Generated/NutritionProduct.cs | 22 +-- .../Model/Generated/Observation.cs | 32 ++-- .../Model/Generated/ObservationDefinition.cs | 36 ++--- .../Model/Generated/OperationDefinition.cs | 26 +-- .../Model/Generated/Organization.cs | 14 +- .../Generated/OrganizationAffiliation.cs | 16 +- .../Generated/PackagedProductDefinition.cs | 32 ++-- src/Hl7.Fhir.R5/Model/Generated/Patient.cs | 22 +-- .../Model/Generated/PaymentNotice.cs | 2 +- .../Model/Generated/PaymentReconciliation.cs | 6 +- src/Hl7.Fhir.R5/Model/Generated/Permission.cs | 26 +-- src/Hl7.Fhir.R5/Model/Generated/Person.cs | 14 +- .../Model/Generated/PlanDefinition.cs | 58 +++---- .../Model/Generated/Practitioner.cs | 16 +- .../Model/Generated/PractitionerRole.cs | 20 +-- src/Hl7.Fhir.R5/Model/Generated/Procedure.cs | 32 ++-- .../Model/Generated/ProductShelfLife.cs | 2 +- src/Hl7.Fhir.R5/Model/Generated/Provenance.cs | 18 +-- .../Model/Generated/Questionnaire.cs | 26 +-- .../Model/Generated/QuestionnaireResponse.cs | 14 +- .../Model/Generated/RegulatedAuthorization.cs | 14 +- .../Model/Generated/RelatedPerson.cs | 14 +- .../Model/Generated/RequestOrchestration.cs | 38 ++--- .../Model/Generated/Requirements.cs | 24 +-- .../Model/Generated/ResearchStudy.cs | 46 +++--- .../Model/Generated/ResearchSubject.cs | 6 +- .../Model/Generated/RiskAssessment.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Schedule.cs | 10 +- .../Model/Generated/SearchParameter.cs | 20 +-- .../Model/Generated/ServiceRequest.cs | 38 ++--- src/Hl7.Fhir.R5/Model/Generated/Slot.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Specimen.cs | 20 +-- .../Model/Generated/SpecimenDefinition.cs | 24 +-- .../Model/Generated/StructureMap.cs | 34 ++-- .../Model/Generated/Subscription.cs | 8 +- .../Model/Generated/SubscriptionStatus.cs | 6 +- .../Model/Generated/SubscriptionTopic.cs | 28 ++-- src/Hl7.Fhir.R5/Model/Generated/Substance.cs | 6 +- .../Model/Generated/SubstanceDefinition.cs | 58 +++---- .../Model/Generated/SubstanceNucleicAcid.cs | 6 +- .../Model/Generated/SubstancePolymer.cs | 14 +- .../Model/Generated/SubstanceProtein.cs | 4 +- .../SubstanceReferenceInformation.cs | 12 +- .../Generated/SubstanceSourceMaterial.cs | 14 +- .../Model/Generated/SupplyDelivery.cs | 10 +- .../Model/Generated/SupplyRequest.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Task.cs | 24 +-- .../Generated/TerminologyCapabilities.cs | 22 +-- src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs | 32 ++-- src/Hl7.Fhir.R5/Model/Generated/TestReport.cs | 12 +- src/Hl7.Fhir.R5/Model/Generated/TestScript.cs | 40 ++--- src/Hl7.Fhir.R5/Model/Generated/Timing.cs | 8 +- src/Hl7.Fhir.R5/Model/Generated/Transport.cs | 20 +-- .../Model/Generated/TriggerDefinition.cs | 2 +- .../Model/Generated/VerificationResult.cs | 16 +- .../Model/Generated/VirtualServiceDetail.cs | 2 +- .../Model/Generated/VisionPrescription.cs | 8 +- src/Hl7.Fhir.STU3/Model/Generated/Account.cs | 6 +- .../Model/Generated/ActivityDefinition.cs | 24 +-- src/Hl7.Fhir.STU3/Model/Generated/Address.cs | 2 +- .../Model/Generated/AdverseEvent.cs | 10 +- .../Model/Generated/AllergyIntolerance.cs | 12 +- .../Model/Generated/Appointment.cs | 22 +-- .../Model/Generated/AppointmentResponse.cs | 4 +- .../Model/Generated/AuditEvent.cs | 20 +-- src/Hl7.Fhir.STU3/Model/Generated/Basic.cs | 2 +- src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs | 6 +- .../Model/Generated/CapabilityStatement.cs | 52 +++--- src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs | 40 ++--- src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs | 14 +- .../Model/Generated/ChargeItem.cs | 18 +-- src/Hl7.Fhir.STU3/Model/Generated/Claim.cs | 56 +++---- .../Model/Generated/ClaimResponse.cs | 48 +++--- .../Model/Generated/ClinicalImpression.cs | 20 +-- .../Model/Generated/CodeSystem.cs | 20 +-- .../Model/Generated/Communication.cs | 24 +-- .../Model/Generated/CommunicationRequest.cs | 22 +-- .../Model/Generated/CompartmentDefinition.cs | 10 +- .../Model/Generated/Composition.cs | 20 +-- .../Model/Generated/ConceptMap.cs | 16 +- .../Model/Generated/Condition.cs | 16 +- src/Hl7.Fhir.STU3/Model/Generated/Consent.cs | 34 ++-- src/Hl7.Fhir.STU3/Model/Generated/Contract.cs | 50 +++--- .../Model/Generated/Contributor.cs | 2 +- src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs | 6 +- .../Model/Generated/DataElement.cs | 12 +- .../Model/Generated/DataRequirement.cs | 14 +- .../Model/Generated/DetectedIssue.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Device.cs | 8 +- .../Model/Generated/DeviceComponent.cs | 4 +- .../Model/Generated/DeviceMetric.cs | 2 +- .../Model/Generated/DeviceRequest.cs | 18 +-- .../Model/Generated/DeviceUseStatement.cs | 6 +- .../Model/Generated/DiagnosticReport.cs | 18 +-- .../Model/Generated/DocumentManifest.cs | 10 +- .../Model/Generated/DocumentReference.cs | 14 +- src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs | 2 +- .../Model/Generated/ElementDefinition.cs | 20 +-- .../Model/Generated/EligibilityRequest.cs | 2 +- .../Model/Generated/EligibilityResponse.cs | 10 +- .../Model/Generated/Encounter.cs | 30 ++-- src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs | 10 +- .../Model/Generated/EnrollmentRequest.cs | 2 +- .../Model/Generated/EnrollmentResponse.cs | 2 +- .../Model/Generated/EpisodeOfCare.cs | 14 +- .../Model/Generated/ExpansionProfile.cs | 12 +- .../Model/Generated/ExplanationOfBenefit.cs | 90 +++++------ .../Model/Generated/FamilyMemberHistory.cs | 14 +- src/Hl7.Fhir.STU3/Model/Generated/Flag.cs | 2 +- src/Hl7.Fhir.STU3/Model/Generated/Goal.cs | 12 +- .../Model/Generated/GraphDefinition.cs | 14 +- src/Hl7.Fhir.STU3/Model/Generated/Group.cs | 6 +- .../Model/Generated/GuidanceResponse.cs | 6 +- .../Model/Generated/HealthcareService.cs | 28 ++-- .../Model/Generated/HumanName.cs | 6 +- .../Model/Generated/ImagingManifest.cs | 10 +- .../Model/Generated/ImagingStudy.cs | 22 +-- .../Model/Generated/Immunization.cs | 16 +- .../Generated/ImmunizationRecommendation.cs | 10 +- .../Model/Generated/ImplementationGuide.cs | 22 +-- src/Hl7.Fhir.STU3/Model/Generated/Library.cs | 20 +-- src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs | 2 +- src/Hl7.Fhir.STU3/Model/Generated/List.cs | 6 +- src/Hl7.Fhir.STU3/Model/Generated/Location.cs | 8 +- src/Hl7.Fhir.STU3/Model/Generated/Measure.cs | 30 ++-- .../Model/Generated/MeasureReport.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/Media.cs | 8 +- .../Model/Generated/Medication.cs | 8 +- .../Generated/MedicationAdministration.cs | 22 +-- .../Model/Generated/MedicationDispense.cs | 24 +-- .../Model/Generated/MedicationRequest.cs | 20 +-- .../Model/Generated/MedicationStatement.cs | 18 +-- .../Model/Generated/MessageDefinition.cs | 14 +- .../Model/Generated/MessageHeader.cs | 4 +- .../Model/Generated/NamingSystem.cs | 8 +- .../Model/Generated/NutritionOrder.cs | 24 +-- .../Model/Generated/Observation.cs | 18 +-- .../Model/Generated/OperationDefinition.cs | 16 +- .../Model/Generated/Organization.cs | 16 +- src/Hl7.Fhir.STU3/Model/Generated/Patient.cs | 22 +-- .../Model/Generated/PaymentNotice.cs | 2 +- .../Model/Generated/PaymentReconciliation.cs | 6 +- src/Hl7.Fhir.STU3/Model/Generated/Person.cs | 10 +- .../Model/Generated/PlanDefinition.cs | 50 +++--- .../Model/Generated/Practitioner.cs | 16 +- .../Model/Generated/PractitionerRole.cs | 20 +-- .../Model/Generated/Procedure.cs | 32 ++-- .../Model/Generated/ProcedureRequest.cs | 24 +-- .../Model/Generated/ProcessRequest.cs | 8 +- .../Model/Generated/ProcessResponse.cs | 8 +- .../Model/Generated/Provenance.cs | 16 +- .../Model/Generated/Questionnaire.cs | 22 +-- .../Model/Generated/QuestionnaireResponse.cs | 12 +- .../Model/Generated/ReferralRequest.cs | 22 +-- .../Model/Generated/RelatedPerson.cs | 10 +- .../Model/Generated/RequestGroup.cs | 24 +-- .../Model/Generated/ResearchStudy.cs | 26 +-- .../Model/Generated/RiskAssessment.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs | 8 +- .../Model/Generated/SearchParameter.cs | 18 +-- src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs | 10 +- .../Model/Generated/ServiceDefinition.cs | 18 +-- src/Hl7.Fhir.STU3/Model/Generated/Slot.cs | 6 +- src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs | 16 +- .../Model/Generated/StructureDefinition.cs | 20 +-- .../Model/Generated/StructureMap.cs | 32 ++-- .../Model/Generated/Subscription.cs | 6 +- .../Model/Generated/Substance.cs | 8 +- .../Model/Generated/SupplyDelivery.cs | 6 +- .../Model/Generated/SupplyRequest.cs | 2 +- src/Hl7.Fhir.STU3/Model/Generated/Task.cs | 18 +-- .../Model/Generated/TestReport.cs | 10 +- .../Model/Generated/TestScript.cs | 50 +++--- src/Hl7.Fhir.STU3/Model/Generated/Timing.cs | 8 +- src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs | 28 ++-- .../Model/Generated/VisionPrescription.cs | 6 +- 586 files changed, 5773 insertions(+), 5773 deletions(-) diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs index 37c03a8fa..afbc4bd61 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs @@ -65,7 +65,7 @@ public abstract partial class BackboneElement : Hl7.Fhir.Model.Element, Hl7.Fhir [DataMember] public List ModifierExtension { - get => _ModifierExtension ?? new List(); + get => _ModifierExtension ??= []; set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs index b1d432607..c5827e04b 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs @@ -65,7 +65,7 @@ public abstract partial class BackboneType : Hl7.Fhir.Model.DataType, Hl7.Fhir.M [DataMember] public List ModifierExtension { - get => _ModifierExtension ?? new List(); + get => _ModifierExtension ??= []; set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs index 592729fde..a8c430b8e 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs @@ -1133,7 +1133,7 @@ public partial class EntryComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -2117,7 +2117,7 @@ public int? Total [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -2131,7 +2131,7 @@ public List Link [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs index cf276bd70..7503ed595 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs @@ -71,7 +71,7 @@ public partial class CodeableConcept : Hl7.Fhir.Model.DataType [DataMember] public List Coding { - get => _Coding ?? new List(); + get => _Coding ??= []; set { _Coding = value; OnPropertyChanged("Coding"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs index d942b6a91..b0e516256 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs @@ -98,7 +98,7 @@ public string? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs index 13e061c48..961a4af0b 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs @@ -80,7 +80,7 @@ public Hl7.Fhir.Model.Narrative? Text [DataMember] public List Contained { - get => _Contained ?? new List(); + get => _Contained ??= []; set { _Contained = value; OnPropertyChanged("Contained"); } } @@ -94,7 +94,7 @@ public List Contained [DataMember] public List Extension { - get => _Extension ?? new List(); + get => _Extension ??= []; set { _Extension = value; OnPropertyChanged("Extension"); } } @@ -108,7 +108,7 @@ public List Extension [DataMember] public List ModifierExtension { - get => _ModifierExtension ?? new List(); + get => _ModifierExtension ??= []; set { _ModifierExtension = value; OnPropertyChanged("ModifierExtension"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Element.cs b/src/Hl7.Fhir.Base/Model/Generated/Element.cs index a6f832d73..69213de62 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Element.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Element.cs @@ -93,7 +93,7 @@ public string? ElementId [DataMember] public List Extension { - get => _Extension ?? new List(); + get => _Extension ??= []; set { _Extension = value; OnPropertyChanged("Extension"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs index 29b44baa9..a68afa6d7 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs @@ -167,7 +167,7 @@ public string? Source [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -218,7 +218,7 @@ public IEnumerable? Profile [DataMember] public List Security { - get => _Security ?? new List(); + get => _Security ??= []; set { _Security = value; OnPropertyChanged("Security"); } } @@ -233,7 +233,7 @@ public List Security [DataMember] public List Tag { - get => _Tag ?? new List(); + get => _Tag ??= []; set { _Tag = value; OnPropertyChanged("Tag"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs index 255eff126..2bb07b803 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs @@ -440,7 +440,7 @@ public string? Diagnostics [DataMember] public List LocationElement { - get => _LocationElement ?? new List(); + get => _LocationElement ??= []; set { _LocationElement = value; OnPropertyChanged("LocationElement"); } } @@ -472,7 +472,7 @@ public IEnumerable? Location [DataMember] public List ExpressionElement { - get => _ExpressionElement ?? new List(); + get => _ExpressionElement ??= []; set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } @@ -610,7 +610,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Issue { - get => _Issue ?? new List(); + get => _Issue ??= []; set { _Issue = value; OnPropertyChanged("Issue"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs index 00388fcd2..965bde319 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.Resource? Resource [DataMember] public List Part { - get => _Part ?? new List(); + get => _Part ??= []; set { _Part = value; OnPropertyChanged("Part"); } } @@ -246,7 +246,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs index 56425b966..f74464cca 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs @@ -75,7 +75,7 @@ public partial class Signature : Hl7.Fhir.Model.DataType [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs index 119511634..db68421e2 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs @@ -826,7 +826,7 @@ public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? Security [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -840,7 +840,7 @@ public List Resource [DataMember] public List Interaction { - get => _Interaction ?? new List(); + get => _Interaction ??= []; set { _Interaction = value; OnPropertyChanged("Interaction"); } } @@ -854,7 +854,7 @@ public List Inter [DataMember] public List SearchParam { - get => _SearchParam ?? new List(); + get => _SearchParam ??= []; set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } @@ -868,7 +868,7 @@ public List SearchParam [DataMember] public List Operation { - get => _Operation ?? new List(); + get => _Operation ??= []; set { _Operation = value; OnPropertyChanged("Operation"); } } @@ -882,7 +882,7 @@ public List Operation [DataMember] public List CompartmentElement { - get => _CompartmentElement ?? new List(); + get => _CompartmentElement ??= []; set { _CompartmentElement = value; OnPropertyChanged("CompartmentElement"); } } @@ -1083,7 +1083,7 @@ public bool? Cors [DataMember] public List Service { - get => _Service ?? new List(); + get => _Service ??= []; set { _Service = value; OnPropertyChanged("Service"); } } @@ -1279,7 +1279,7 @@ public string? Profile [DataMember] public List SupportedProfileElement { - get => _SupportedProfileElement ?? new List(); + get => _SupportedProfileElement ??= []; set { _SupportedProfileElement = value; OnPropertyChanged("SupportedProfileElement"); } } @@ -1339,7 +1339,7 @@ public string? Documentation [DataMember] public List Interaction { - get => _Interaction ?? new List(); + get => _Interaction ??= []; set { _Interaction = value; OnPropertyChanged("Interaction"); } } @@ -1588,7 +1588,7 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDe [DataMember] public List> ReferencePolicyElement { - get => _ReferencePolicyElement ?? new List>(); + get => _ReferencePolicyElement ??= []; set { _ReferencePolicyElement = value; OnPropertyChanged("ReferencePolicyElement"); } } @@ -1620,7 +1620,7 @@ public IEnumerable? [DataMember] public List SearchIncludeElement { - get => _SearchIncludeElement ?? new List(); + get => _SearchIncludeElement ??= []; set { _SearchIncludeElement = value; OnPropertyChanged("SearchIncludeElement"); } } @@ -1652,7 +1652,7 @@ public IEnumerable? SearchInclude [DataMember] public List SearchRevIncludeElement { - get => _SearchRevIncludeElement ?? new List(); + get => _SearchRevIncludeElement ??= []; set { _SearchRevIncludeElement = value; OnPropertyChanged("SearchRevIncludeElement"); } } @@ -1684,7 +1684,7 @@ public IEnumerable? SearchRevInclude [DataMember] public List SearchParam { - get => _SearchParam ?? new List(); + get => _SearchParam ??= []; set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } @@ -1698,7 +1698,7 @@ public List SearchParam [DataMember] public List Operation { - get => _Operation ?? new List(); + get => _Operation ??= []; set { _Operation = value; OnPropertyChanged("Operation"); } } @@ -2638,7 +2638,7 @@ public partial class MessagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -2708,7 +2708,7 @@ public string? Documentation [DataMember] public List SupportedMessage { - get => _SupportedMessage ?? new List(); + get => _SupportedMessage ??= []; set { _SupportedMessage = value; OnPropertyChanged("SupportedMessage"); } } @@ -3301,7 +3301,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3533,7 +3533,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -3575,7 +3575,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -3590,7 +3590,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -3722,7 +3722,7 @@ public Hl7.Fhir.Model.CapabilityStatementKind? Kind [DataMember] public List InstantiatesElement { - get => _InstantiatesElement ?? new List(); + get => _InstantiatesElement ??= []; set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -3754,7 +3754,7 @@ public IEnumerable? Instantiates [DataMember] public List ImportsElement { - get => _ImportsElement ?? new List(); + get => _ImportsElement ??= []; set { _ImportsElement = value; OnPropertyChanged("ImportsElement"); } } @@ -3844,7 +3844,7 @@ public Hl7.Fhir.Model.FHIRVersion? FhirVersion [DataMember] public List FormatElement { - get => _FormatElement ?? new List(); + get => _FormatElement ??= []; set { _FormatElement = value; OnPropertyChanged("FormatElement"); } } @@ -3877,7 +3877,7 @@ public IEnumerable? Format [DataMember] public List PatchFormatElement { - get => _PatchFormatElement ?? new List(); + get => _PatchFormatElement ??= []; set { _PatchFormatElement = value; OnPropertyChanged("PatchFormatElement"); } } @@ -3913,7 +3913,7 @@ public IEnumerable? PatchFormat [DataMember] public List AcceptLanguageElement { - get => _AcceptLanguageElement ?? new List(); + get => _AcceptLanguageElement ??= []; set { _AcceptLanguageElement = value; OnPropertyChanged("AcceptLanguageElement"); } } @@ -3945,7 +3945,7 @@ public IEnumerable? AcceptLanguage [DataMember] public List ImplementationGuideElement { - get => _ImplementationGuideElement ?? new List(); + get => _ImplementationGuideElement ??= []; set { _ImplementationGuideElement = value; OnPropertyChanged("ImplementationGuideElement"); } } @@ -3977,7 +3977,7 @@ public IEnumerable? ImplementationGuide [DataMember] public List Rest { - get => _Rest ?? new List(); + get => _Rest ??= []; set { _Rest = value; OnPropertyChanged("Rest"); } } @@ -3991,7 +3991,7 @@ public List Rest [DataMember] public List Messaging { - get => _Messaging ?? new List(); + get => _Messaging ??= []; set { _Messaging = value; OnPropertyChanged("Messaging"); } } @@ -4005,7 +4005,7 @@ public List Messaging [DataMember] public List Document { - get => _Document ?? new List(); + get => _Document ??= []; set { _Document = value; OnPropertyChanged("Document"); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs index 482b8e746..c0a90ffd4 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs @@ -232,7 +232,7 @@ public string? Description [DataMember] public List> OperatorElement { - get => _OperatorElement ?? new List>(); + get => _OperatorElement ??= []; set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } @@ -704,7 +704,7 @@ public string? Definition [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -718,7 +718,7 @@ public List Designation [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -732,7 +732,7 @@ public List Property [DataMember] public List Concept { - get => _Concept ?? new List(); + get => _Concept ??= []; set { _Concept = value; OnPropertyChanged("Concept"); } } @@ -916,7 +916,7 @@ public Hl7.Fhir.Model.Coding? Use [DataMember] public List AdditionalUse { - get => _AdditionalUse ?? new List(); + get => _AdditionalUse ??= []; set { _AdditionalUse = value; OnPropertyChanged("AdditionalUse"); } } @@ -1206,7 +1206,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1437,7 +1437,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1479,7 +1479,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1494,7 +1494,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1677,7 +1677,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1694,7 +1694,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1711,7 +1711,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1728,7 +1728,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1745,7 +1745,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1762,7 +1762,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2005,7 +2005,7 @@ public int? Count [DataMember] public List Filter { - get => _Filter ?? new List(); + get => _Filter ??= []; set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -2019,7 +2019,7 @@ public List Filter [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -2033,7 +2033,7 @@ public List Property [DataMember] public List Concept { - get => _Concept ?? new List(); + get => _Concept ??= []; set { _Concept = value; OnPropertyChanged("Concept"); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs index cb0f98df2..9e98e3329 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs @@ -328,7 +328,7 @@ public partial class SlicingComponent : Hl7.Fhir.Model.Element [DataMember] public List Discriminator { - get => _Discriminator ?? new List(); + get => _Discriminator ??= []; set { _Discriminator = value; OnPropertyChanged("Discriminator"); } } @@ -894,7 +894,7 @@ public string? Code [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -926,7 +926,7 @@ public IEnumerable? Profile [DataMember] public List TargetProfileElement { - get => _TargetProfileElement ?? new List(); + get => _TargetProfileElement ??= []; set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } @@ -960,7 +960,7 @@ public IEnumerable? TargetProfile [DataMember] public List> AggregationElement { - get => _AggregationElement ?? new List>(); + get => _AggregationElement ??= []; set { _AggregationElement = value; OnPropertyChanged("AggregationElement"); } } @@ -1783,7 +1783,7 @@ public string? ValueSet [DataMember] public List Additional { - get => _Additional ?? new List(); + get => _Additional ??= []; set { _Additional = value; OnPropertyChanged("Additional"); } } @@ -2032,7 +2032,7 @@ public string? ShortDoco [DataMember] public List Usage { - get => _Usage ?? new List(); + get => _Usage ??= []; set { _Usage = value; OnPropertyChanged("Usage"); } } @@ -2459,7 +2459,7 @@ public string? Path [DataMember] public List> RepresentationElement { - get => _RepresentationElement ?? new List>(); + get => _RepresentationElement ??= []; set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } @@ -2576,7 +2576,7 @@ public string? Label [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2715,7 +2715,7 @@ public string? Requirements [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -2844,7 +2844,7 @@ public string? ContentReference [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -2953,7 +2953,7 @@ public Hl7.Fhir.Model.DataType? Pattern [DataMember] public List Example { - get => _Example ?? new List(); + get => _Example ??= []; set { _Example = value; OnPropertyChanged("Example"); } } @@ -3025,7 +3025,7 @@ public int? MaxLength [DataMember] public List ConditionElement { - get => _ConditionElement ?? new List(); + get => _ConditionElement ??= []; set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } @@ -3057,7 +3057,7 @@ public IEnumerable? Condition [DataMember] public List Constraint { - get => _Constraint ?? new List(); + get => _Constraint ??= []; set { _Constraint = value; OnPropertyChanged("Constraint"); } } @@ -3105,7 +3105,7 @@ public bool? MustHaveValue [DataMember] public List ValueAlternativesElement { - get => _ValueAlternativesElement ?? new List(); + get => _ValueAlternativesElement ??= []; set { _ValueAlternativesElement = value; OnPropertyChanged("ValueAlternativesElement"); } } @@ -3262,7 +3262,7 @@ public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent? Bindi [DataMember] public List Mapping { - get => _Mapping ?? new List(); + get => _Mapping ??= []; set { _Mapping = value; OnPropertyChanged("Mapping"); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs index d8e9f5d8f..9c7a542cb 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs @@ -332,7 +332,7 @@ public Hl7.Fhir.Model.RelatedArtifact.RelatedArtifactType? Type [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs index 2b35ea2d1..1ac6c5c6b 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs @@ -533,7 +533,7 @@ public partial class SnapshotComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -624,7 +624,7 @@ public partial class DifferentialComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -728,7 +728,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -960,7 +960,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1002,7 +1002,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1017,7 +1017,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1119,7 +1119,7 @@ public string? CopyrightLabel [DataMember] public List Keyword { - get => _Keyword ?? new List(); + get => _Keyword ??= []; set { _Keyword = value; OnPropertyChanged("Keyword"); } } @@ -1163,7 +1163,7 @@ public Hl7.Fhir.Model.FHIRVersion? FhirVersion [DataMember] public List Mapping { - get => _Mapping ?? new List(); + get => _Mapping ??= []; set { _Mapping = value; OnPropertyChanged("Mapping"); } } @@ -1237,7 +1237,7 @@ public bool? Abstract [DataMember] public List Context { - get => _Context ?? new List(); + get => _Context ??= []; set { _Context = value; OnPropertyChanged("Context"); } } @@ -1251,7 +1251,7 @@ public List Context [DataMember] public List ContextInvariantElement { - get => _ContextInvariantElement ?? new List(); + get => _ContextInvariantElement ??= []; set { _ContextInvariantElement = value; OnPropertyChanged("ContextInvariantElement"); } } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs index 7a321bbcb..b33996692 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs @@ -142,7 +142,7 @@ public bool? Inactive [DataMember] public List Include { - get => _Include ?? new List(); + get => _Include ??= []; set { _Include = value; OnPropertyChanged("Include"); } } @@ -156,7 +156,7 @@ public List Include [DataMember] public List Exclude { - get => _Exclude ?? new List(); + get => _Exclude ??= []; set { _Exclude = value; OnPropertyChanged("Exclude"); } } @@ -173,7 +173,7 @@ public List Exclude [DataMember] public List PropertyElement { - get => _PropertyElement ?? new List(); + get => _PropertyElement ??= []; set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } @@ -374,7 +374,7 @@ public string? Version [DataMember] public List Concept { - get => _Concept ?? new List(); + get => _Concept ??= []; set { _Concept = value; OnPropertyChanged("Concept"); } } @@ -388,7 +388,7 @@ public List Concept [DataMember] public List Filter { - get => _Filter ?? new List(); + get => _Filter ??= []; set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -402,7 +402,7 @@ public List Filter [DataMember] public List ValueSetElement { - get => _ValueSetElement ?? new List(); + get => _ValueSetElement ??= []; set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } @@ -645,7 +645,7 @@ public string? Display [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -802,7 +802,7 @@ public Hl7.Fhir.Model.Coding? Use [DataMember] public List AdditionalUse { - get => _AdditionalUse ?? new List(); + get => _AdditionalUse ??= []; set { _AdditionalUse = value; OnPropertyChanged("AdditionalUse"); } } @@ -1280,7 +1280,7 @@ public int? Offset [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1297,7 +1297,7 @@ public List Parameter [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1311,7 +1311,7 @@ public List Property [DataMember] public List Contains { - get => _Contains ?? new List(); + get => _Contains ??= []; set { _Contains = value; OnPropertyChanged("Contains"); } } @@ -1907,7 +1907,7 @@ public string? Display [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -1924,7 +1924,7 @@ public List Designation [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1938,7 +1938,7 @@ public List Property [DataMember] public List Contains { - get => _Contains ?? new List(); + get => _Contains ??= []; set { _Contains = value; OnPropertyChanged("Contains"); } } @@ -2149,7 +2149,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List SubProperty { - get => _SubProperty ?? new List(); + get => _SubProperty ??= []; set { _SubProperty = value; OnPropertyChanged("SubProperty"); } } @@ -2587,7 +2587,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2818,7 +2818,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2860,7 +2860,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2875,7 +2875,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -3086,7 +3086,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -3103,7 +3103,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -3120,7 +3120,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -3137,7 +3137,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -3154,7 +3154,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -3171,7 +3171,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Account.cs b/src/Hl7.Fhir.R4/Model/Generated/Account.cs index 51dbbc7de..790de8022 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Account.cs @@ -394,7 +394,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -483,7 +483,7 @@ public string? Name [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -510,7 +510,7 @@ public Hl7.Fhir.Model.Period? ServicePeriod [DataMember] public List Coverage { - get => _Coverage ?? new List(); + get => _Coverage ??= []; set { _Coverage = value; OnPropertyChanged("Coverage"); } } @@ -567,7 +567,7 @@ public string? Description [DataMember] public List Guarantor { - get => _Guarantor ?? new List(); + get => _Guarantor ??= []; set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs index 18cde249f..246dfac11 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs @@ -459,7 +459,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -717,7 +717,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -759,7 +759,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -774,7 +774,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -942,7 +942,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -956,7 +956,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -970,7 +970,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -984,7 +984,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -998,7 +998,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1012,7 +1012,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1026,7 +1026,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -1248,7 +1248,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1292,7 +1292,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -1307,7 +1307,7 @@ public List Dosage [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -1323,7 +1323,7 @@ public List BodySite [DataMember] public List SpecimenRequirement { - get => _SpecimenRequirement ?? new List(); + get => _SpecimenRequirement ??= []; set { _SpecimenRequirement = value; OnPropertyChanged("SpecimenRequirement"); } } @@ -1339,7 +1339,7 @@ public List SpecimenRequirement [DataMember] public List ObservationRequirement { - get => _ObservationRequirement ?? new List(); + get => _ObservationRequirement ??= []; set { _ObservationRequirement = value; OnPropertyChanged("ObservationRequirement"); } } @@ -1355,7 +1355,7 @@ public List ObservationRequirement [DataMember] public List ObservationResultRequirement { - get => _ObservationResultRequirement ?? new List(); + get => _ObservationResultRequirement ??= []; set { _ObservationResultRequirement = value; OnPropertyChanged("ObservationResultRequirement"); } } @@ -1397,7 +1397,7 @@ public string? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Address.cs b/src/Hl7.Fhir.R4/Model/Generated/Address.cs index 6d2805ec6..889e19bac 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Address.cs @@ -227,7 +227,7 @@ public string? Text [DataMember] public List LineElement { - get => _LineElement ?? new List(); + get => _LineElement ??= []; set { _LineElement = value; OnPropertyChanged("LineElement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs index d12ab7155..a95e0cc4e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs @@ -198,7 +198,7 @@ public Hl7.Fhir.Model.ResourceReference? Instance [DataMember] public List Causality { - get => _Causality ?? new List(); + get => _Causality ??= []; set { _Causality = value; OnPropertyChanged("Causality"); } } @@ -499,7 +499,7 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -644,7 +644,7 @@ public string? RecordedDate [DataMember] public List ResultingCondition { - get => _ResultingCondition ?? new List(); + get => _ResultingCondition ??= []; set { _ResultingCondition = value; OnPropertyChanged("ResultingCondition"); } } @@ -732,7 +732,7 @@ public Hl7.Fhir.Model.ResourceReference? Recorder [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -746,7 +746,7 @@ public List Contributor [DataMember] public List SuspectEntity { - get => _SuspectEntity ?? new List(); + get => _SuspectEntity ??= []; set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } @@ -762,7 +762,7 @@ public List SuspectEntity [DataMember] public List SubjectMedicalHistory { - get => _SubjectMedicalHistory ?? new List(); + get => _SubjectMedicalHistory ??= []; set { _SubjectMedicalHistory = value; OnPropertyChanged("SubjectMedicalHistory"); } } @@ -778,7 +778,7 @@ public List SubjectMedicalHistory [DataMember] public List ReferenceDocument { - get => _ReferenceDocument ?? new List(); + get => _ReferenceDocument ??= []; set { _ReferenceDocument = value; OnPropertyChanged("ReferenceDocument"); } } @@ -794,7 +794,7 @@ public List ReferenceDocument [DataMember] public List Study { - get => _Study ?? new List(); + get => _Study ??= []; set { _Study = value; OnPropertyChanged("Study"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs index d08328265..bdfd9cafe 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs @@ -276,7 +276,7 @@ public Hl7.Fhir.Model.CodeableConcept? Substance [DataMember] public List Manifestation { - get => _Manifestation ?? new List(); + get => _Manifestation ??= []; set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } @@ -390,7 +390,7 @@ public Hl7.Fhir.Model.CodeableConcept? ExposureRoute [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -519,7 +519,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -593,7 +593,7 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type [DataMember] public List> CategoryElement { - get => _CategoryElement ?? new List>(); + get => _CategoryElement ??= []; set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } @@ -801,7 +801,7 @@ public string? LastOccurrence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -815,7 +815,7 @@ public List Note [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs index 67304cb06..684122889 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs @@ -182,7 +182,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -382,7 +382,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -442,7 +442,7 @@ public Hl7.Fhir.Model.CodeableConcept? CancelationReason [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -457,7 +457,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -472,7 +472,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -501,7 +501,7 @@ public Hl7.Fhir.Model.CodeableConcept? AppointmentType [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -517,7 +517,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -589,7 +589,7 @@ public string? Description [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -689,7 +689,7 @@ public int? MinutesDuration [DataMember] public List Slot { - get => _Slot ?? new List(); + get => _Slot ??= []; set { _Slot = value; OnPropertyChanged("Slot"); } } @@ -789,7 +789,7 @@ public string? PatientInstruction [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -803,7 +803,7 @@ public List BasedOn [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -817,7 +817,7 @@ public List Participant [DataMember] public List RequestedPeriod { - get => _RequestedPeriod ?? new List(); + get => _RequestedPeriod ??= []; set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs index 128048de6..f92c7329b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs @@ -67,7 +67,7 @@ public partial class AppointmentResponse : Hl7.Fhir.Model.DomainResource, IIdent [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -154,7 +154,7 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get => _ParticipantType ?? new List(); + get => _ParticipantType ??= []; set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs index d9dcc4b63..aa2dd7d06 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs @@ -218,7 +218,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -347,7 +347,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -407,7 +407,7 @@ public Hl7.Fhir.Model.AuditEvent.NetworkComponent? Network [DataMember] public List PurposeOfUse { - get => _PurposeOfUse ?? new List(); + get => _PurposeOfUse ??= []; set { _PurposeOfUse = value; OnPropertyChanged("PurposeOfUse"); } } @@ -778,7 +778,7 @@ public Hl7.Fhir.Model.ResourceReference? Observer [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -946,7 +946,7 @@ public Hl7.Fhir.Model.Coding? Lifecycle [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -1044,7 +1044,7 @@ public byte[]? Query [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -1338,7 +1338,7 @@ public Hl7.Fhir.Model.Coding? Type [DataMember] public List Subtype { - get => _Subtype ?? new List(); + get => _Subtype ??= []; set { _Subtype = value; OnPropertyChanged("Subtype"); } } @@ -1483,7 +1483,7 @@ public string? OutcomeDesc [DataMember] public List PurposeOfEvent { - get => _PurposeOfEvent ?? new List(); + get => _PurposeOfEvent ??= []; set { _PurposeOfEvent = value; OnPropertyChanged("PurposeOfEvent"); } } @@ -1497,7 +1497,7 @@ public List PurposeOfEvent [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -1525,7 +1525,7 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Basic.cs b/src/Hl7.Fhir.R4/Model/Generated/Basic.cs index ffe741719..da7af8e4e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Basic.cs @@ -70,7 +70,7 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs index ab2575776..4d0aa0f51 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs @@ -804,7 +804,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -894,7 +894,7 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatu [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -938,7 +938,7 @@ public int? Quantity [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -965,7 +965,7 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? Collection [DataMember] public List Processing { - get => _Processing ?? new List(); + get => _Processing ??= []; set { _Processing = value; OnPropertyChanged("Processing"); } } @@ -992,7 +992,7 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent? Manipula [DataMember] public List Storage { - get => _Storage ?? new List(); + get => _Storage ??= []; set { _Storage = value; OnPropertyChanged("Storage"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs index 0e2801bb4..a48db8c74 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs @@ -70,7 +70,7 @@ public partial class BodyStructure : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -141,7 +141,7 @@ public Hl7.Fhir.Model.CodeableConcept? Location [DataMember] public List LocationQualifier { - get => _LocationQualifier ?? new List(); + get => _LocationQualifier ??= []; set { _LocationQualifier = value; OnPropertyChanged("LocationQualifier"); } } @@ -183,7 +183,7 @@ public string? Description [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs index b4daec901..5a1c54181 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs @@ -243,7 +243,7 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List OutcomeCodeableConcept { - get => _OutcomeCodeableConcept ?? new List(); + get => _OutcomeCodeableConcept ??= []; set { _OutcomeCodeableConcept = value; OnPropertyChanged("OutcomeCodeableConcept"); } } @@ -259,7 +259,7 @@ public List OutcomeCodeableConcept [DataMember] public List OutcomeReference { - get => _OutcomeReference ?? new List(); + get => _OutcomeReference ??= []; set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } @@ -273,7 +273,7 @@ public List OutcomeReference [DataMember] public List Progress { - get => _Progress ?? new List(); + get => _Progress ??= []; set { _Progress = value; OnPropertyChanged("Progress"); } } @@ -458,7 +458,7 @@ public Hl7.Fhir.Model.CarePlan.CarePlanActivityKind? Kind [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -490,7 +490,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -553,7 +553,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -569,7 +569,7 @@ public List ReasonReference [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -687,7 +687,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -977,7 +977,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -991,7 +991,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1023,7 +1023,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1057,7 +1057,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1073,7 +1073,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -1089,7 +1089,7 @@ public List Replaces [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1166,7 +1166,7 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1325,7 +1325,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -1341,7 +1341,7 @@ public List Contributor [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -1357,7 +1357,7 @@ public List CareTeam [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -1373,7 +1373,7 @@ public List Addresses [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -1389,7 +1389,7 @@ public List SupportingInfo [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -1403,7 +1403,7 @@ public List Goal [DataMember] public List Activity { - get => _Activity ?? new List(); + get => _Activity ??= []; set { _Activity = value; OnPropertyChanged("Activity"); } } @@ -1417,7 +1417,7 @@ public List Activity [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs index 506f7ad0e..e2ed0854e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs @@ -127,7 +127,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -272,7 +272,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -317,7 +317,7 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -402,7 +402,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -417,7 +417,7 @@ public List Participant [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -433,7 +433,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -449,7 +449,7 @@ public List ReasonReference [DataMember] public List ManagingOrganization { - get => _ManagingOrganization ?? new List(); + get => _ManagingOrganization ??= []; set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } @@ -463,7 +463,7 @@ public List ManagingOrganization [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -477,7 +477,7 @@ public List Telecom [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs b/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs index 5a8334684..74c9bc17f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs @@ -225,7 +225,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -297,7 +297,7 @@ public Hl7.Fhir.Model.ResourceReference? ReferencedItem [DataMember] public List AdditionalIdentifier { - get => _AdditionalIdentifier ?? new List(); + get => _AdditionalIdentifier ??= []; set { _AdditionalIdentifier = value; OnPropertyChanged("AdditionalIdentifier"); } } @@ -311,7 +311,7 @@ public List AdditionalIdentifier [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -424,7 +424,7 @@ public string? LastUpdated [DataMember] public List AdditionalCharacteristic { - get => _AdditionalCharacteristic ?? new List(); + get => _AdditionalCharacteristic ??= []; set { _AdditionalCharacteristic = value; OnPropertyChanged("AdditionalCharacteristic"); } } @@ -438,7 +438,7 @@ public List AdditionalCharacteristic [DataMember] public List AdditionalClassification { - get => _AdditionalClassification ?? new List(); + get => _AdditionalClassification ??= []; set { _AdditionalClassification = value; OnPropertyChanged("AdditionalClassification"); } } @@ -452,7 +452,7 @@ public List AdditionalClassification [DataMember] public List RelatedEntry { - get => _RelatedEntry ?? new List(); + get => _RelatedEntry ??= []; set { _RelatedEntry = value; OnPropertyChanged("RelatedEntry"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs index 385c508d2..9bc79ce51 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs @@ -238,7 +238,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -252,7 +252,7 @@ public List Identifier [DataMember] public List DefinitionUriElement { - get => _DefinitionUriElement ?? new List(); + get => _DefinitionUriElement ??= []; set { _DefinitionUriElement = value; OnPropertyChanged("DefinitionUriElement"); } } @@ -284,7 +284,7 @@ public IEnumerable? DefinitionUri [DataMember] public List DefinitionCanonicalElement { - get => _DefinitionCanonicalElement ?? new List(); + get => _DefinitionCanonicalElement ??= []; set { _DefinitionCanonicalElement = value; OnPropertyChanged("DefinitionCanonicalElement"); } } @@ -349,7 +349,7 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -424,7 +424,7 @@ public Hl7.Fhir.Model.DataType? Occurrence [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -497,7 +497,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Bodysite { - get => _Bodysite ?? new List(); + get => _Bodysite ??= []; set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } @@ -624,7 +624,7 @@ public string? EnteredDate [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -640,7 +640,7 @@ public List Reason [DataMember] public List Service { - get => _Service ?? new List(); + get => _Service ??= []; set { _Service = value; OnPropertyChanged("Service"); } } @@ -673,7 +673,7 @@ public Hl7.Fhir.Model.DataType? Product [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -687,7 +687,7 @@ public List Account [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -703,7 +703,7 @@ public List Note [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs index 288f730c7..3065d1c60 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs @@ -266,7 +266,7 @@ public partial class PropertyGroupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Applicability { - get => _Applicability ?? new List(); + get => _Applicability ??= []; set { _Applicability = value; OnPropertyChanged("Applicability"); } } @@ -280,7 +280,7 @@ public List Applicab [DataMember] public List PriceComponent { - get => _PriceComponent ?? new List(); + get => _PriceComponent ??= []; set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } @@ -582,7 +582,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -652,7 +652,7 @@ public string? Title [DataMember] public List DerivedFromUriElement { - get => _DerivedFromUriElement ?? new List(); + get => _DerivedFromUriElement ??= []; set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } @@ -684,7 +684,7 @@ public IEnumerable? DerivedFromUri [DataMember] public List PartOfElement { - get => _PartOfElement ?? new List(); + get => _PartOfElement ??= []; set { _PartOfElement = value; OnPropertyChanged("PartOfElement"); } } @@ -716,7 +716,7 @@ public IEnumerable? PartOf [DataMember] public List ReplacesElement { - get => _ReplacesElement ?? new List(); + get => _ReplacesElement ??= []; set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } @@ -863,7 +863,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -905,7 +905,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -920,7 +920,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1047,7 +1047,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -1061,7 +1061,7 @@ public List Instance [DataMember] public List Applicability { - get => _Applicability ?? new List(); + get => _Applicability ??= []; set { _Applicability = value; OnPropertyChanged("Applicability"); } } @@ -1075,7 +1075,7 @@ public List Applicab [DataMember] public List PropertyGroup { - get => _PropertyGroup ?? new List(); + get => _PropertyGroup ??= []; set { _PropertyGroup = value; OnPropertyChanged("PropertyGroup"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs index 453b1e600..df1b02c27 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs @@ -830,7 +830,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1015,7 +1015,7 @@ public int? Sequence [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1077,7 +1077,7 @@ public Hl7.Fhir.Model.DataType? Procedure [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1320,7 +1320,7 @@ public string? BusinessArrangement [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1681,7 +1681,7 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get => _CareTeamSequenceElement ?? new List(); + get => _CareTeamSequenceElement ??= []; set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } @@ -1713,7 +1713,7 @@ public IEnumerable? CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get => _DiagnosisSequenceElement ?? new List(); + get => _DiagnosisSequenceElement ??= []; set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } @@ -1745,7 +1745,7 @@ public IEnumerable? DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get => _ProcedureSequenceElement ?? new List(); + get => _ProcedureSequenceElement ??= []; set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } @@ -1777,7 +1777,7 @@ public IEnumerable? ProcedureSequence [DataMember] public List InformationSequenceElement { - get => _InformationSequenceElement ?? new List(); + get => _InformationSequenceElement ??= []; set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } @@ -1853,7 +1853,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1868,7 +1868,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1983,7 +1983,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2012,7 +2012,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -2028,7 +2028,7 @@ public List SubSite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -2042,7 +2042,7 @@ public List Encounter [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2386,7 +2386,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2401,7 +2401,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2484,7 +2484,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2498,7 +2498,7 @@ public List Udi [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -2761,7 +2761,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2776,7 +2776,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2859,7 +2859,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3024,7 +3024,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3262,7 +3262,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundsReserve [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -3349,7 +3349,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -3363,7 +3363,7 @@ public List CareTeam [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -3377,7 +3377,7 @@ public List SupportingInfo [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -3391,7 +3391,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -3405,7 +3405,7 @@ public List Procedure [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -3432,7 +3432,7 @@ public Hl7.Fhir.Model.Claim.AccidentComponent? Accident [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs index 193734f0f..dfd179452 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs @@ -115,7 +115,7 @@ public int? ItemSequence [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -147,7 +147,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -161,7 +161,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -482,7 +482,7 @@ public int? DetailSequence [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -514,7 +514,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -528,7 +528,7 @@ public List Adjudication [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -675,7 +675,7 @@ public int? SubDetailSequence [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -707,7 +707,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -816,7 +816,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get => _ItemSequenceElement ?? new List(); + get => _ItemSequenceElement ??= []; set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } @@ -848,7 +848,7 @@ public IEnumerable? ItemSequence [DataMember] public List DetailSequenceElement { - get => _DetailSequenceElement ?? new List(); + get => _DetailSequenceElement ??= []; set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } @@ -880,7 +880,7 @@ public IEnumerable? DetailSequence [DataMember] public List SubdetailSequenceElement { - get => _SubdetailSequenceElement ?? new List(); + get => _SubdetailSequenceElement ??= []; set { _SubdetailSequenceElement = value; OnPropertyChanged("SubdetailSequenceElement"); } } @@ -914,7 +914,7 @@ public IEnumerable? SubdetailSequence [DataMember] public List Provider { - get => _Provider ?? new List(); + get => _Provider ??= []; set { _Provider = value; OnPropertyChanged("Provider"); } } @@ -944,7 +944,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -959,7 +959,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1087,7 +1087,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -1101,7 +1101,7 @@ public List SubSite [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1133,7 +1133,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1147,7 +1147,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -1407,7 +1407,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1488,7 +1488,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1520,7 +1520,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1534,7 +1534,7 @@ public List Adjudication [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -1713,7 +1713,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1794,7 +1794,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1826,7 +1826,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2939,7 +2939,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3249,7 +3249,7 @@ public Hl7.Fhir.Model.CodeableConcept? PayeeType [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -3263,7 +3263,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -3277,7 +3277,7 @@ public List AddItem [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3291,7 +3291,7 @@ public List Adjudication [DataMember] public List Total { - get => _Total ?? new List(); + get => _Total ??= []; set { _Total = value; OnPropertyChanged("Total"); } } @@ -3359,7 +3359,7 @@ public Hl7.Fhir.Model.Attachment? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -3375,7 +3375,7 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get => _CommunicationRequest ?? new List(); + get => _CommunicationRequest ??= []; set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } @@ -3389,7 +3389,7 @@ public List CommunicationRequest [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -3403,7 +3403,7 @@ public List Insurance [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs index efd86314d..30c5cdccd 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs @@ -131,7 +131,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -367,7 +367,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -574,7 +574,7 @@ public Hl7.Fhir.Model.ResourceReference? Previous [DataMember] public List Problem { - get => _Problem ?? new List(); + get => _Problem ??= []; set { _Problem = value; OnPropertyChanged("Problem"); } } @@ -588,7 +588,7 @@ public List Problem [DataMember] public List Investigation { - get => _Investigation ?? new List(); + get => _Investigation ??= []; set { _Investigation = value; OnPropertyChanged("Investigation"); } } @@ -602,7 +602,7 @@ public List Investigat [DataMember] public List ProtocolElement { - get => _ProtocolElement ?? new List(); + get => _ProtocolElement ??= []; set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } @@ -662,7 +662,7 @@ public string? Summary [DataMember] public List Finding { - get => _Finding ?? new List(); + get => _Finding ??= []; set { _Finding = value; OnPropertyChanged("Finding"); } } @@ -677,7 +677,7 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get => _PrognosisCodeableConcept ?? new List(); + get => _PrognosisCodeableConcept ??= []; set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } @@ -693,7 +693,7 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get => _PrognosisReference ?? new List(); + get => _PrognosisReference ??= []; set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } @@ -709,7 +709,7 @@ public List PrognosisReference [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -723,7 +723,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs index 8e0c99b3c..ab66c4d5e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs @@ -164,7 +164,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -178,7 +178,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -210,7 +210,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -244,7 +244,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -260,7 +260,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -276,7 +276,7 @@ public List PartOf [DataMember] public List InResponseTo { - get => _InResponseTo ?? new List(); + get => _InResponseTo ??= []; set { _InResponseTo = value; OnPropertyChanged("InResponseTo"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.CodeableConcept? StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -381,7 +381,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -426,7 +426,7 @@ public Hl7.Fhir.Model.CodeableConcept? Topic [DataMember] public List About { - get => _About ?? new List(); + get => _About ??= []; set { _About = value; OnPropertyChanged("About"); } } @@ -513,7 +513,7 @@ public string? Received [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -543,7 +543,7 @@ public Hl7.Fhir.Model.ResourceReference? Sender [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -559,7 +559,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -573,7 +573,7 @@ public List ReasonReference [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -587,7 +587,7 @@ public List Payload [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs index b9fdd43eb..ba0611d9d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs @@ -164,7 +164,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -180,7 +180,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -196,7 +196,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -269,7 +269,7 @@ public Hl7.Fhir.Model.CodeableConcept? StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -342,7 +342,7 @@ public bool? DoNotPerform [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -373,7 +373,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List About { - get => _About ?? new List(); + get => _About ??= []; set { _About = value; OnPropertyChanged("About"); } } @@ -402,7 +402,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -476,7 +476,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -506,7 +506,7 @@ public Hl7.Fhir.Model.ResourceReference? Sender [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -522,7 +522,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -536,7 +536,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs index 4735f3c56..e91fe3d3a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs @@ -118,7 +118,7 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get => _ParamElement ?? new List(); + get => _ParamElement ??= []; set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } @@ -458,7 +458,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -500,7 +500,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -602,7 +602,7 @@ public bool? Search [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Composition.cs b/src/Hl7.Fhir.R4/Model/Generated/Composition.cs index 1484944b6..8c61c7090 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Composition.cs @@ -491,7 +491,7 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -520,7 +520,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -673,7 +673,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -761,7 +761,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } @@ -789,7 +789,7 @@ public Hl7.Fhir.Model.CodeableConcept? EmptyReason [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } @@ -1005,7 +1005,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1080,7 +1080,7 @@ public string? Date [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1153,7 +1153,7 @@ public Hl7.Fhir.Model.Composition.V3ConfidentialityClassification? Confidentiali [DataMember] public List Attester { - get => _Attester ?? new List(); + get => _Attester ??= []; set { _Attester = value; OnPropertyChanged("Attester"); } } @@ -1182,7 +1182,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -1196,7 +1196,7 @@ public List RelatesTo [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -1210,7 +1210,7 @@ public List Event [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs index 4886882e0..e604d3af2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs @@ -226,7 +226,7 @@ public string? TargetVersion [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -432,7 +432,7 @@ public string? Display [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -657,7 +657,7 @@ public string? Comment [DataMember] public List DependsOn { - get => _DependsOn ?? new List(); + get => _DependsOn ??= []; set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } @@ -671,7 +671,7 @@ public List DependsOn [DataMember] public List Product { - get => _Product ?? new List(); + get => _Product ??= []; set { _Product = value; OnPropertyChanged("Product"); } } @@ -1469,7 +1469,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1511,7 +1511,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1526,7 +1526,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1626,7 +1626,7 @@ public Hl7.Fhir.Model.DataType? Target [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Condition.cs b/src/Hl7.Fhir.R4/Model/Generated/Condition.cs index 6f7807d8b..26e6d31ac 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Condition.cs @@ -194,7 +194,7 @@ public Hl7.Fhir.Model.CodeableConcept? Summary [DataMember] public List Assessment { - get => _Assessment ?? new List(); + get => _Assessment ??= []; set { _Assessment = value; OnPropertyChanged("Assessment"); } } @@ -319,7 +319,7 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -335,7 +335,7 @@ public List Code [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -419,7 +419,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -462,7 +462,7 @@ public Hl7.Fhir.Model.CodeableConcept? VerificationStatus [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -505,7 +505,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -638,7 +638,7 @@ public Hl7.Fhir.Model.ResourceReference? Asserter [DataMember] public List Stage { - get => _Stage ?? new List(); + get => _Stage ??= []; set { _Stage = value; OnPropertyChanged("Stage"); } } @@ -652,7 +652,7 @@ public List Stage [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -666,7 +666,7 @@ public List Evidence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Consent.cs b/src/Hl7.Fhir.R4/Model/Generated/Consent.cs index 64eaf7f04..467d24748 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Consent.cs @@ -541,7 +541,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -556,7 +556,7 @@ public List Actor [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -571,7 +571,7 @@ public List Action [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -586,7 +586,7 @@ public List SecurityLabel [DataMember] public List Purpose { - get => _Purpose ?? new List(); + get => _Purpose ??= []; set { _Purpose = value; OnPropertyChanged("Purpose"); } } @@ -601,7 +601,7 @@ public List Purpose [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -616,7 +616,7 @@ public List Class [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -643,7 +643,7 @@ public Hl7.Fhir.Model.Period? DataPeriod [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } @@ -657,7 +657,7 @@ public List Data [DataMember] public List Provision { - get => _Provision ?? new List(); + get => _Provision ??= []; set { _Provision = value; OnPropertyChanged("Provision"); } } @@ -1072,7 +1072,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1133,7 +1133,7 @@ public Hl7.Fhir.Model.CodeableConcept? Scope [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1192,7 +1192,7 @@ public string? DateTime [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -1208,7 +1208,7 @@ public List Performer [DataMember] public List Organization { - get => _Organization ?? new List(); + get => _Organization ??= []; set { _Organization = value; OnPropertyChanged("Organization"); } } @@ -1238,7 +1238,7 @@ public Hl7.Fhir.Model.DataType? Source [DataMember] public List Policy { - get => _Policy ?? new List(); + get => _Policy ??= []; set { _Policy = value; OnPropertyChanged("Policy"); } } @@ -1266,7 +1266,7 @@ public Hl7.Fhir.Model.CodeableConcept? PolicyRule [DataMember] public List Verification { - get => _Verification ?? new List(); + get => _Verification ??= []; set { _Verification = value; OnPropertyChanged("Verification"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs index 0cb0d8fa1..027018b2e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs @@ -665,7 +665,7 @@ public string? Text [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -693,7 +693,7 @@ public Hl7.Fhir.Model.Contract.ContractOfferComponent? Offer [DataMember] public List Asset { - get => _Asset ?? new List(); + get => _Asset ??= []; set { _Asset = value; OnPropertyChanged("Asset"); } } @@ -707,7 +707,7 @@ public List Asset [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -721,7 +721,7 @@ public List Action [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -911,7 +911,7 @@ public partial class SecurityLabelComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List NumberElement { - get => _NumberElement ?? new List(); + get => _NumberElement ??= []; set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } @@ -959,7 +959,7 @@ public Hl7.Fhir.Model.Coding? Classification [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -974,7 +974,7 @@ public List Category [DataMember] public List Control { - get => _Control ?? new List(); + get => _Control ??= []; set { _Control = value; OnPropertyChanged("Control"); } } @@ -1092,7 +1092,7 @@ public partial class ContractOfferComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1106,7 +1106,7 @@ public List Identifier [DataMember] public List Party { - get => _Party ?? new List(); + get => _Party ??= []; set { _Party = value; OnPropertyChanged("Party"); } } @@ -1164,7 +1164,7 @@ public Hl7.Fhir.Model.CodeableConcept? Decision [DataMember] public List DecisionMode { - get => _DecisionMode ?? new List(); + get => _DecisionMode ??= []; set { _DecisionMode = value; OnPropertyChanged("DecisionMode"); } } @@ -1178,7 +1178,7 @@ public List DecisionMode [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -1220,7 +1220,7 @@ public string? Text [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -1252,7 +1252,7 @@ public IEnumerable? LinkId [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -1441,7 +1441,7 @@ public partial class ContractPartyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -1659,7 +1659,7 @@ public Hl7.Fhir.Model.CodeableConcept? Scope [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1675,7 +1675,7 @@ public List Type [DataMember] public List TypeReference { - get => _TypeReference ?? new List(); + get => _TypeReference ??= []; set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } @@ -1690,7 +1690,7 @@ public List TypeReference [DataMember] public List Subtype { - get => _Subtype ?? new List(); + get => _Subtype ??= []; set { _Subtype = value; OnPropertyChanged("Subtype"); } } @@ -1718,7 +1718,7 @@ public Hl7.Fhir.Model.Coding? Relationship [DataMember] public List Context { - get => _Context ?? new List(); + get => _Context ??= []; set { _Context = value; OnPropertyChanged("Context"); } } @@ -1761,7 +1761,7 @@ public string? Condition [DataMember] public List PeriodType { - get => _PeriodType ?? new List(); + get => _PeriodType ??= []; set { _PeriodType = value; OnPropertyChanged("PeriodType"); } } @@ -1775,7 +1775,7 @@ public List PeriodType [DataMember] public List Period { - get => _Period ?? new List(); + get => _Period ??= []; set { _Period = value; OnPropertyChanged("Period"); } } @@ -1789,7 +1789,7 @@ public List Period [DataMember] public List UsePeriod { - get => _UsePeriod ?? new List(); + get => _UsePeriod ??= []; set { _UsePeriod = value; OnPropertyChanged("UsePeriod"); } } @@ -1831,7 +1831,7 @@ public string? Text [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -1863,7 +1863,7 @@ public IEnumerable? LinkId [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -1877,7 +1877,7 @@ public List Answer [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -1909,7 +1909,7 @@ public IEnumerable? SecurityLabelNumber [DataMember] public List ValuedItem { - get => _ValuedItem ?? new List(); + get => _ValuedItem ??= []; set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } @@ -2139,7 +2139,7 @@ public Hl7.Fhir.Model.ResourceReference? Reference [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2511,7 +2511,7 @@ public Hl7.Fhir.Model.ResourceReference? Recipient [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -2543,7 +2543,7 @@ public IEnumerable? LinkId [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -2814,7 +2814,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -2843,7 +2843,7 @@ public Hl7.Fhir.Model.CodeableConcept? Intent [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -2905,7 +2905,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List ContextLinkIdElement { - get => _ContextLinkIdElement ?? new List(); + get => _ContextLinkIdElement ??= []; set { _ContextLinkIdElement = value; OnPropertyChanged("ContextLinkIdElement"); } } @@ -2954,7 +2954,7 @@ public Hl7.Fhir.Model.DataType? Occurrence [DataMember] public List Requester { - get => _Requester ?? new List(); + get => _Requester ??= []; set { _Requester = value; OnPropertyChanged("Requester"); } } @@ -2968,7 +2968,7 @@ public List Requester [DataMember] public List RequesterLinkIdElement { - get => _RequesterLinkIdElement ?? new List(); + get => _RequesterLinkIdElement ??= []; set { _RequesterLinkIdElement = value; OnPropertyChanged("RequesterLinkIdElement"); } } @@ -3001,7 +3001,7 @@ public IEnumerable? RequesterLinkId [DataMember] public List PerformerType { - get => _PerformerType ?? new List(); + get => _PerformerType ??= []; set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } @@ -3044,7 +3044,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List PerformerLinkIdElement { - get => _PerformerLinkIdElement ?? new List(); + get => _PerformerLinkIdElement ??= []; set { _PerformerLinkIdElement = value; OnPropertyChanged("PerformerLinkIdElement"); } } @@ -3077,7 +3077,7 @@ public IEnumerable? PerformerLinkId [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -3093,7 +3093,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -3107,7 +3107,7 @@ public List ReasonReference [DataMember] public List ReasonElement { - get => _ReasonElement ?? new List(); + get => _ReasonElement ??= []; set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } @@ -3139,7 +3139,7 @@ public IEnumerable? Reason [DataMember] public List ReasonLinkIdElement { - get => _ReasonLinkIdElement ?? new List(); + get => _ReasonLinkIdElement ??= []; set { _ReasonLinkIdElement = value; OnPropertyChanged("ReasonLinkIdElement"); } } @@ -3171,7 +3171,7 @@ public IEnumerable? ReasonLinkId [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -3185,7 +3185,7 @@ public List Note [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -3473,7 +3473,7 @@ public partial class ActionSubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -3620,7 +3620,7 @@ public Hl7.Fhir.Model.ResourceReference? Party [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } @@ -3995,7 +3995,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4223,7 +4223,7 @@ public Hl7.Fhir.Model.CodeableConcept? ExpirationType [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -4239,7 +4239,7 @@ public List Subject [DataMember] public List Authority { - get => _Authority ?? new List(); + get => _Authority ??= []; set { _Authority = value; OnPropertyChanged("Authority"); } } @@ -4255,7 +4255,7 @@ public List Authority [DataMember] public List Domain { - get => _Domain ?? new List(); + get => _Domain ??= []; set { _Domain = value; OnPropertyChanged("Domain"); } } @@ -4271,7 +4271,7 @@ public List Domain [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -4369,7 +4369,7 @@ public string? Subtitle [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -4461,7 +4461,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List SubType { - get => _SubType ?? new List(); + get => _SubType ??= []; set { _SubType = value; OnPropertyChanged("SubType"); } } @@ -4488,7 +4488,7 @@ public Hl7.Fhir.Model.Contract.ContentDefinitionComponent? ContentDefinition [DataMember] public List Term { - get => _Term ?? new List(); + get => _Term ??= []; set { _Term = value; OnPropertyChanged("Term"); } } @@ -4504,7 +4504,7 @@ public List Term [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -4520,7 +4520,7 @@ public List SupportingInfo [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -4534,7 +4534,7 @@ public List RelevantHistory [DataMember] public List Signer { - get => _Signer ?? new List(); + get => _Signer ??= []; set { _Signer = value; OnPropertyChanged("Signer"); } } @@ -4548,7 +4548,7 @@ public List Signer [DataMember] public List Friendly { - get => _Friendly ?? new List(); + get => _Friendly ??= []; set { _Friendly = value; OnPropertyChanged("Friendly"); } } @@ -4562,7 +4562,7 @@ public List Friendly [DataMember] public List Legal { - get => _Legal ?? new List(); + get => _Legal ??= []; set { _Legal = value; OnPropertyChanged("Legal"); } } @@ -4576,7 +4576,7 @@ public List Legal [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs index a59e40c98..7a0f0d6cf 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs @@ -164,7 +164,7 @@ public string? Name [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs index 483624fb7..4af96e265 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs @@ -286,7 +286,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Exception { - get => _Exception ?? new List(); + get => _Exception ??= []; set { _Exception = value; OnPropertyChanged("Exception"); } } @@ -493,7 +493,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -683,7 +683,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Payor { - get => _Payor ?? new List(); + get => _Payor ??= []; set { _Payor = value; OnPropertyChanged("Payor"); } } @@ -697,7 +697,7 @@ public List Payor [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -767,7 +767,7 @@ public string? Network [DataMember] public List CostToBeneficiary { - get => _CostToBeneficiary ?? new List(); + get => _CostToBeneficiary ??= []; set { _CostToBeneficiary = value; OnPropertyChanged("CostToBeneficiary"); } } @@ -811,7 +811,7 @@ public bool? Subrogation [DataMember] public List Contract { - get => _Contract ?? new List(); + get => _Contract ??= []; set { _Contract = value; OnPropertyChanged("Contract"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs index 1a6fb6090..ff40ecec7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs @@ -457,7 +457,7 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SupportingInfoSequenceElement { - get => _SupportingInfoSequenceElement ?? new List(); + get => _SupportingInfoSequenceElement ??= []; set { _SupportingInfoSequenceElement = value; OnPropertyChanged("SupportingInfoSequenceElement"); } } @@ -518,7 +518,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -588,7 +588,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -604,7 +604,7 @@ public List Diagno [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -854,7 +854,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -915,7 +915,7 @@ public Hl7.Fhir.Model.CodeableConcept? Priority [DataMember] public List> PurposeElement { - get => _PurposeElement ?? new List>(); + get => _PurposeElement ??= []; set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } @@ -1068,7 +1068,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -1082,7 +1082,7 @@ public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1096,7 +1096,7 @@ public List Insura [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs index 4315cd31e..f203940a8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs @@ -178,7 +178,7 @@ public Hl7.Fhir.Model.Period? BenefitPeriod [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -325,7 +325,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -480,7 +480,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -523,7 +523,7 @@ public bool? AuthorizationRequired [DataMember] public List AuthorizationSupporting { - get => _AuthorizationSupporting ?? new List(); + get => _AuthorizationSupporting ??= []; set { _AuthorizationSupporting = value; OnPropertyChanged("AuthorizationSupporting"); } } @@ -975,7 +975,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1022,7 +1022,7 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [DataMember] public List> PurposeElement { - get => _PurposeElement ?? new List>(); + get => _PurposeElement ??= []; set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } @@ -1220,7 +1220,7 @@ public Hl7.Fhir.Model.ResourceReference? Insurer [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1276,7 +1276,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs index 02a0a2600..7a700dc7f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs @@ -192,7 +192,7 @@ public string? ValueSet [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -638,7 +638,7 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -687,7 +687,7 @@ public Hl7.Fhir.Model.DataType? Subject [DataMember] public List MustSupportElement { - get => _MustSupportElement ?? new List(); + get => _MustSupportElement ??= []; set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } @@ -719,7 +719,7 @@ public IEnumerable? MustSupport [DataMember] public List CodeFilter { - get => _CodeFilter ?? new List(); + get => _CodeFilter ??= []; set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } @@ -733,7 +733,7 @@ public List CodeFilter [DataMember] public List DateFilter { - get => _DateFilter ?? new List(); + get => _DateFilter ??= []; set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } @@ -775,7 +775,7 @@ public int? Limit [DataMember] public List Sort { - get => _Sort ?? new List(); + get => _Sort ??= []; set { _Sort = value; OnPropertyChanged("Sort"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs index 41556e838..2e51cef7c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs @@ -115,7 +115,7 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -131,7 +131,7 @@ public List Code [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -368,7 +368,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -504,7 +504,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Implicated { - get => _Implicated ?? new List(); + get => _Implicated ??= []; set { _Implicated = value; OnPropertyChanged("Implicated"); } } @@ -518,7 +518,7 @@ public List Implicated [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -588,7 +588,7 @@ public string? Reference [DataMember] public List Mitigation { - get => _Mitigation ?? new List(); + get => _Mitigation ??= []; set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Device.cs b/src/Hl7.Fhir.R4/Model/Generated/Device.cs index ecb835d09..02562cc17 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Device.cs @@ -888,7 +888,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List ValueQuantity { - get => _ValueQuantity ?? new List(); + get => _ValueQuantity ??= []; set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } @@ -902,7 +902,7 @@ public List ValueQuantity [DataMember] public List ValueCode { - get => _ValueCode ?? new List(); + get => _ValueCode ??= []; set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } @@ -995,7 +995,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1024,7 +1024,7 @@ public Hl7.Fhir.Model.ResourceReference? Definition [DataMember] public List UdiCarrier { - get => _UdiCarrier ?? new List(); + get => _UdiCarrier ??= []; set { _UdiCarrier = value; OnPropertyChanged("UdiCarrier"); } } @@ -1069,7 +1069,7 @@ public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -1251,7 +1251,7 @@ public string? SerialNumber [DataMember] public List DeviceName { - get => _DeviceName ?? new List(); + get => _DeviceName ??= []; set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } @@ -1335,7 +1335,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Specialization { - get => _Specialization ?? new List(); + get => _Specialization ??= []; set { _Specialization = value; OnPropertyChanged("Specialization"); } } @@ -1349,7 +1349,7 @@ public List Specialization [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -1363,7 +1363,7 @@ public List Version [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1407,7 +1407,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1464,7 +1464,7 @@ public string? Url [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1478,7 +1478,7 @@ public List Note [DataMember] public List Safety { - get => _Safety ?? new List(); + get => _Safety ??= []; set { _Safety = value; OnPropertyChanged("Safety"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs index 545a3ca23..c7a26f9e2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs @@ -563,7 +563,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Description { - get => _Description ?? new List(); + get => _Description ??= []; set { _Description = value; OnPropertyChanged("Description"); } } @@ -674,7 +674,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List ValueQuantity { - get => _ValueQuantity ?? new List(); + get => _ValueQuantity ??= []; set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } @@ -688,7 +688,7 @@ public List ValueQuantity [DataMember] public List ValueCode { - get => _ValueCode ?? new List(); + get => _ValueCode ??= []; set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } @@ -943,7 +943,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -957,7 +957,7 @@ public List Identifier [DataMember] public List UdiDeviceIdentifier { - get => _UdiDeviceIdentifier ?? new List(); + get => _UdiDeviceIdentifier ??= []; set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } @@ -987,7 +987,7 @@ public Hl7.Fhir.Model.DataType? Manufacturer [DataMember] public List DeviceName { - get => _DeviceName ?? new List(); + get => _DeviceName ??= []; set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } @@ -1043,7 +1043,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Specialization { - get => _Specialization ?? new List(); + get => _Specialization ??= []; set { _Specialization = value; OnPropertyChanged("Specialization"); } } @@ -1057,7 +1057,7 @@ public List Specializat [DataMember] public List VersionElement { - get => _VersionElement ?? new List(); + get => _VersionElement ??= []; set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } @@ -1090,7 +1090,7 @@ public IEnumerable? Version [DataMember] public List Safety { - get => _Safety ?? new List(); + get => _Safety ??= []; set { _Safety = value; OnPropertyChanged("Safety"); } } @@ -1104,7 +1104,7 @@ public List Safety [DataMember] public List ShelfLifeStorage { - get => _ShelfLifeStorage ?? new List(); + get => _ShelfLifeStorage ??= []; set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } @@ -1131,7 +1131,7 @@ public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics [DataMember] public List LanguageCode { - get => _LanguageCode ?? new List(); + get => _LanguageCode ??= []; set { _LanguageCode = value; OnPropertyChanged("LanguageCode"); } } @@ -1145,7 +1145,7 @@ public List LanguageCode [DataMember] public List Capability { - get => _Capability ?? new List(); + get => _Capability ??= []; set { _Capability = value; OnPropertyChanged("Capability"); } } @@ -1159,7 +1159,7 @@ public List Capability [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1188,7 +1188,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1258,7 +1258,7 @@ public string? OnlineInformation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1300,7 +1300,7 @@ public Hl7.Fhir.Model.ResourceReference? ParentDevice [DataMember] public List Material { - get => _Material ?? new List(); + get => _Material ??= []; set { _Material = value; OnPropertyChanged("Material"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs index f9917889c..e199163a3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs @@ -445,7 +445,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -622,7 +622,7 @@ public Hl7.Fhir.Model.Timing? MeasurementPeriod [DataMember] public List Calibration { - get => _Calibration ?? new List(); + get => _Calibration ??= []; set { _Calibration = value; OnPropertyChanged("Calibration"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs index c28bdb096..7e1851d50 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs @@ -185,7 +185,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -199,7 +199,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -231,7 +231,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -265,7 +265,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -281,7 +281,7 @@ public List BasedOn [DataMember] public List PriorRequest { - get => _PriorRequest ?? new List(); + get => _PriorRequest ??= []; set { _PriorRequest = value; OnPropertyChanged("PriorRequest"); } } @@ -417,7 +417,7 @@ public Hl7.Fhir.Model.DataType? Code [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -550,7 +550,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -566,7 +566,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -582,7 +582,7 @@ public List ReasonReference [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -598,7 +598,7 @@ public List Insurance [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -612,7 +612,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -628,7 +628,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs index b44466ccb..c44a089e0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs @@ -116,7 +116,7 @@ public enum DeviceUseStatementStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -132,7 +132,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -195,7 +195,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -283,7 +283,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -299,7 +299,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -327,7 +327,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs index 0acbce623..766becfe6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs @@ -271,7 +271,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -287,7 +287,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -333,7 +333,7 @@ public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -437,7 +437,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -453,7 +453,7 @@ public List Performer [DataMember] public List ResultsInterpreter { - get => _ResultsInterpreter ?? new List(); + get => _ResultsInterpreter ??= []; set { _ResultsInterpreter = value; OnPropertyChanged("ResultsInterpreter"); } } @@ -469,7 +469,7 @@ public List ResultsInterpreter [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -485,7 +485,7 @@ public List Specimen [DataMember] public List Result { - get => _Result ?? new List(); + get => _Result ??= []; set { _Result = value; OnPropertyChanged("Result"); } } @@ -501,7 +501,7 @@ public List Result [DataMember] public List ImagingStudy { - get => _ImagingStudy ?? new List(); + get => _ImagingStudy ??= []; set { _ImagingStudy = value; OnPropertyChanged("ImagingStudy"); } } @@ -515,7 +515,7 @@ public List ImagingStudy [DataMember] public List Media { - get => _Media ?? new List(); + get => _Media ??= []; set { _Media = value; OnPropertyChanged("Media"); } } @@ -558,7 +558,7 @@ public string? Conclusion [DataMember] public List ConclusionCode { - get => _ConclusionCode ?? new List(); + get => _ConclusionCode ??= []; set { _ConclusionCode = value; OnPropertyChanged("ConclusionCode"); } } @@ -572,7 +572,7 @@ public List ConclusionCode [DataMember] public List PresentedForm { - get => _PresentedForm ?? new List(); + get => _PresentedForm ??= []; set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs index e3619f514..786f072b4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs @@ -198,7 +198,7 @@ public Hl7.Fhir.Model.Identifier? MasterIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -302,7 +302,7 @@ public string? Created [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -318,7 +318,7 @@ public List Author [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -390,7 +390,7 @@ public string? Description [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } @@ -404,7 +404,7 @@ public List Content [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs index 9f14f7a63..fad11429b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs @@ -338,7 +338,7 @@ public partial class ContextComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -353,7 +353,7 @@ public List Encounter [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -425,7 +425,7 @@ public Hl7.Fhir.Model.ResourceReference? SourcePatientInfo [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -567,7 +567,7 @@ public Hl7.Fhir.Model.Identifier? MasterIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -657,7 +657,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -716,7 +716,7 @@ public DateTimeOffset? Date [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -760,7 +760,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -803,7 +803,7 @@ public string? Description [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -817,7 +817,7 @@ public List SecurityLabel [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs index ca82c7fc4..1078ba783 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs @@ -266,7 +266,7 @@ public string? Text [DataMember] public List AdditionalInstruction { - get => _AdditionalInstruction ?? new List(); + get => _AdditionalInstruction ??= []; set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } @@ -379,7 +379,7 @@ public Hl7.Fhir.Model.CodeableConcept? Method [DataMember] public List DoseAndRate { - get => _DoseAndRate ?? new List(); + get => _DoseAndRate ??= []; set { _DoseAndRate = value; OnPropertyChanged("DoseAndRate"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs b/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs index 49944466d..9c26169fe 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs @@ -577,7 +577,7 @@ public Hl7.Fhir.Model.CodeableConcept? UnitOfMeasure [DataMember] public List PrecisionEstimate { - get => _PrecisionEstimate ?? new List(); + get => _PrecisionEstimate ??= []; set { _PrecisionEstimate = value; OnPropertyChanged("PrecisionEstimate"); } } @@ -916,7 +916,7 @@ public partial class CertaintyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Rating { - get => _Rating ?? new List(); + get => _Rating ??= []; set { _Rating = value; OnPropertyChanged("Rating"); } } @@ -930,7 +930,7 @@ public List Rating [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -944,7 +944,7 @@ public List Note [DataMember] public List CertaintySubcomponent { - get => _CertaintySubcomponent ?? new List(); + get => _CertaintySubcomponent ??= []; set { _CertaintySubcomponent = value; OnPropertyChanged("CertaintySubcomponent"); } } @@ -1068,7 +1068,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Rating { - get => _Rating ?? new List(); + get => _Rating ??= []; set { _Rating = value; OnPropertyChanged("Rating"); } } @@ -1082,7 +1082,7 @@ public List Rating [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1203,7 +1203,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1388,7 +1388,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1430,7 +1430,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1444,7 +1444,7 @@ public List Note [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1459,7 +1459,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1571,7 +1571,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1585,7 +1585,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1599,7 +1599,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1613,7 +1613,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1627,7 +1627,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1641,7 +1641,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1760,7 +1760,7 @@ public Hl7.Fhir.Model.EffectEvidenceSynthesis.SampleSizeComponent? SampleSize [DataMember] public List ResultsByExposure { - get => _ResultsByExposure ?? new List(); + get => _ResultsByExposure ??= []; set { _ResultsByExposure = value; OnPropertyChanged("ResultsByExposure"); } } @@ -1774,7 +1774,7 @@ public List R [DataMember] public List EffectEstimate { - get => _EffectEstimate ?? new List(); + get => _EffectEstimate ??= []; set { _EffectEstimate = value; OnPropertyChanged("EffectEstimate"); } } @@ -1788,7 +1788,7 @@ public List Effe [DataMember] public List Certainty { - get => _Certainty ?? new List(); + get => _Certainty ??= []; set { _Certainty = value; OnPropertyChanged("Certainty"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs index 654b42f38..cc8b5bbee 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs @@ -434,7 +434,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -779,7 +779,7 @@ public Hl7.Fhir.Model.CodeableConcept? ReAdmission [DataMember] public List DietPreference { - get => _DietPreference ?? new List(); + get => _DietPreference ??= []; set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } @@ -794,7 +794,7 @@ public List DietPreference [DataMember] public List SpecialCourtesy { - get => _SpecialCourtesy ?? new List(); + get => _SpecialCourtesy ??= []; set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } @@ -809,7 +809,7 @@ public List SpecialCourtesy [DataMember] public List SpecialArrangement { - get => _SpecialArrangement ?? new List(); + get => _SpecialArrangement ??= []; set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } @@ -1163,7 +1163,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1208,7 +1208,7 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [DataMember] public List StatusHistory { - get => _StatusHistory ?? new List(); + get => _StatusHistory ??= []; set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } @@ -1237,7 +1237,7 @@ public Hl7.Fhir.Model.Coding? Class [DataMember] public List ClassHistory { - get => _ClassHistory ?? new List(); + get => _ClassHistory ??= []; set { _ClassHistory = value; OnPropertyChanged("ClassHistory"); } } @@ -1252,7 +1252,7 @@ public List ClassHistory [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1311,7 +1311,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List EpisodeOfCare { - get => _EpisodeOfCare ?? new List(); + get => _EpisodeOfCare ??= []; set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } @@ -1327,7 +1327,7 @@ public List EpisodeOfCare [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1341,7 +1341,7 @@ public List BasedOn [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1357,7 +1357,7 @@ public List Participant [DataMember] public List Appointment { - get => _Appointment ?? new List(); + get => _Appointment ??= []; set { _Appointment = value; OnPropertyChanged("Appointment"); } } @@ -1398,7 +1398,7 @@ public Hl7.Fhir.Model.Duration? Length [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1414,7 +1414,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1428,7 +1428,7 @@ public List ReasonReference [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -1444,7 +1444,7 @@ public List Diagnosis [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -1471,7 +1471,7 @@ public Hl7.Fhir.Model.Encounter.HospitalizationComponent? Hospitalization [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs index e989a70bb..7666d77c3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs @@ -116,7 +116,7 @@ public enum EndpointStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -219,7 +219,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -247,7 +247,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List PayloadType { - get => _PayloadType ?? new List(); + get => _PayloadType ??= []; set { _PayloadType = value; OnPropertyChanged("PayloadType"); } } @@ -262,7 +262,7 @@ public List PayloadType [DataMember] public List PayloadMimeTypeElement { - get => _PayloadMimeTypeElement ?? new List(); + get => _PayloadMimeTypeElement ??= []; set { _PayloadMimeTypeElement = value; OnPropertyChanged("PayloadMimeTypeElement"); } } @@ -323,7 +323,7 @@ public string? Address [DataMember] public List HeaderElement { - get => _HeaderElement ?? new List(); + get => _HeaderElement ??= []; set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs index 611d7d182..447b5c0a4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs @@ -70,7 +70,7 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs index 271cee57c..a1a029ad7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs @@ -70,7 +70,7 @@ public partial class EnrollmentResponse : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs index 21f515117..4e8117083 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs @@ -403,7 +403,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -448,7 +448,7 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get => _StatusHistory ?? new List(); + get => _StatusHistory ??= []; set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } @@ -463,7 +463,7 @@ public List StatusHistory [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -477,7 +477,7 @@ public List Type [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List ReferralRequest { - get => _ReferralRequest ?? new List(); + get => _ReferralRequest ??= []; set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } @@ -568,7 +568,7 @@ public Hl7.Fhir.Model.ResourceReference? CareManager [DataMember] public List Team { - get => _Team ?? new List(); + get => _Team ??= []; set { _Team = value; OnPropertyChanged("Team"); } } @@ -584,7 +584,7 @@ public List Team [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs index 9b422b393..42383727d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -356,7 +356,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -398,7 +398,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -413,7 +413,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -581,7 +581,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -595,7 +595,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -609,7 +609,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -623,7 +623,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -637,7 +637,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -651,7 +651,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -665,7 +665,7 @@ public List RelatedArtifact [DataMember] public List Trigger { - get => _Trigger ?? new List(); + get => _Trigger ??= []; set { _Trigger = value; OnPropertyChanged("Trigger"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs index f8ea99a67..db88ea9c9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -339,7 +339,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -381,7 +381,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -395,7 +395,7 @@ public List Note [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -410,7 +410,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -522,7 +522,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -536,7 +536,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -550,7 +550,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -564,7 +564,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -578,7 +578,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -592,7 +592,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -624,7 +624,7 @@ public Hl7.Fhir.Model.ResourceReference? ExposureBackground [DataMember] public List ExposureVariant { - get => _ExposureVariant ?? new List(); + get => _ExposureVariant ??= []; set { _ExposureVariant = value; OnPropertyChanged("ExposureVariant"); } } @@ -640,7 +640,7 @@ public List ExposureVariant [DataMember] public List Outcome { - get => _Outcome ?? new List(); + get => _Outcome ??= []; set { _Outcome = value; OnPropertyChanged("Outcome"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs index c6583a367..1a814acc6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs @@ -133,7 +133,7 @@ public Hl7.Fhir.Model.DataType? Definition [DataMember] public List UsageContext { - get => _UsageContext ?? new List(); + get => _UsageContext ??= []; set { _UsageContext = value; OnPropertyChanged("UsageContext"); } } @@ -376,7 +376,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -617,7 +617,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -659,7 +659,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -673,7 +673,7 @@ public List Note [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -688,7 +688,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -800,7 +800,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -814,7 +814,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -828,7 +828,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -842,7 +842,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -856,7 +856,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -870,7 +870,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -914,7 +914,7 @@ public Hl7.Fhir.Model.VariableTypeCode? Type [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs index 49e9a5f49..54d9063d6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs @@ -435,7 +435,7 @@ public string? Description [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -449,7 +449,7 @@ public List Version [DataMember] public List ContainedInstance { - get => _ContainedInstance ?? new List(); + get => _ContainedInstance ??= []; set { _ContainedInstance = value; OnPropertyChanged("ContainedInstance"); } } @@ -979,7 +979,7 @@ public string? PostConditions [DataMember] public List Step { - get => _Step ?? new List(); + get => _Step ??= []; set { _Step = value; OnPropertyChanged("Step"); } } @@ -1103,7 +1103,7 @@ public partial class StepComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Process { - get => _Process ?? new List(); + get => _Process ??= []; set { _Process = value; OnPropertyChanged("Process"); } } @@ -1158,7 +1158,7 @@ public Hl7.Fhir.Model.ExampleScenario.OperationComponent? Operation [DataMember] public List Alternative { - get => _Alternative ?? new List(); + get => _Alternative ??= []; set { _Alternative = value; OnPropertyChanged("Alternative"); } } @@ -1739,7 +1739,7 @@ public string? Description [DataMember] public List Step { - get => _Step ?? new List(); + get => _Step ??= []; set { _Step = value; OnPropertyChanged("Step"); } } @@ -1860,7 +1860,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2045,7 +2045,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2059,7 +2059,7 @@ public List Contact [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2074,7 +2074,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2144,7 +2144,7 @@ public string? Purpose [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -2158,7 +2158,7 @@ public List Actor [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -2172,7 +2172,7 @@ public List Instance [DataMember] public List Process { - get => _Process ?? new List(); + get => _Process ??= []; set { _Process = value; OnPropertyChanged("Process"); } } @@ -2186,7 +2186,7 @@ public List Process [DataMember] public List WorkflowElement { - get => _WorkflowElement ?? new List(); + get => _WorkflowElement ??= []; set { _WorkflowElement = value; OnPropertyChanged("WorkflowElement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs index df7a4ce33..d37590800 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs @@ -862,7 +862,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1047,7 +1047,7 @@ public int? Sequence [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1109,7 +1109,7 @@ public Hl7.Fhir.Model.DataType? Procedure [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1282,7 +1282,7 @@ public Hl7.Fhir.Model.ResourceReference? Coverage [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1591,7 +1591,7 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get => _CareTeamSequenceElement ?? new List(); + get => _CareTeamSequenceElement ??= []; set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } @@ -1623,7 +1623,7 @@ public IEnumerable? CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get => _DiagnosisSequenceElement ?? new List(); + get => _DiagnosisSequenceElement ??= []; set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } @@ -1655,7 +1655,7 @@ public IEnumerable? DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get => _ProcedureSequenceElement ?? new List(); + get => _ProcedureSequenceElement ??= []; set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } @@ -1687,7 +1687,7 @@ public IEnumerable? ProcedureSequence [DataMember] public List InformationSequenceElement { - get => _InformationSequenceElement ?? new List(); + get => _InformationSequenceElement ??= []; set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } @@ -1763,7 +1763,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1778,7 +1778,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1893,7 +1893,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1922,7 +1922,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -1938,7 +1938,7 @@ public List SubSite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -1952,7 +1952,7 @@ public List Encounter [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1984,7 +1984,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1998,7 +1998,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2534,7 +2534,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2549,7 +2549,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2632,7 +2632,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2646,7 +2646,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -2678,7 +2678,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2692,7 +2692,7 @@ public List Adjudicat [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -2973,7 +2973,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2988,7 +2988,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3071,7 +3071,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3085,7 +3085,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3117,7 +3117,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3316,7 +3316,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get => _ItemSequenceElement ?? new List(); + get => _ItemSequenceElement ??= []; set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } @@ -3348,7 +3348,7 @@ public IEnumerable? ItemSequence [DataMember] public List DetailSequenceElement { - get => _DetailSequenceElement ?? new List(); + get => _DetailSequenceElement ??= []; set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } @@ -3380,7 +3380,7 @@ public IEnumerable? DetailSequence [DataMember] public List SubDetailSequenceElement { - get => _SubDetailSequenceElement ?? new List(); + get => _SubDetailSequenceElement ??= []; set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } @@ -3414,7 +3414,7 @@ public IEnumerable? SubDetailSequence [DataMember] public List Provider { - get => _Provider ?? new List(); + get => _Provider ??= []; set { _Provider = value; OnPropertyChanged("Provider"); } } @@ -3444,7 +3444,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3459,7 +3459,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3587,7 +3587,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -3601,7 +3601,7 @@ public List SubSite [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3633,7 +3633,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3647,7 +3647,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -3907,7 +3907,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3988,7 +3988,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -4020,7 +4020,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -4034,7 +4034,7 @@ public List Adjudicat [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -4213,7 +4213,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -4294,7 +4294,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -4326,7 +4326,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -5155,7 +5155,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Financial { - get => _Financial ?? new List(); + get => _Financial ??= []; set { _Financial = value; OnPropertyChanged("Financial"); } } @@ -5433,7 +5433,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -5685,7 +5685,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundsReserve [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -5861,7 +5861,7 @@ public string? Disposition [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -5893,7 +5893,7 @@ public IEnumerable? PreAuthRef [DataMember] public List PreAuthRefPeriod { - get => _PreAuthRefPeriod ?? new List(); + get => _PreAuthRefPeriod ??= []; set { _PreAuthRefPeriod = value; OnPropertyChanged("PreAuthRefPeriod"); } } @@ -5907,7 +5907,7 @@ public List PreAuthRefPeriod [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -5921,7 +5921,7 @@ public List CareTeam [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -5935,7 +5935,7 @@ public List [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -5949,7 +5949,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -5991,7 +5991,7 @@ public int? Precedence [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -6018,7 +6018,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? Accident [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -6032,7 +6032,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -6046,7 +6046,7 @@ public List AddItem [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -6060,7 +6060,7 @@ public List Adjudicat [DataMember] public List Total { - get => _Total ?? new List(); + get => _Total ??= []; set { _Total = value; OnPropertyChanged("Total"); } } @@ -6114,7 +6114,7 @@ public Hl7.Fhir.Model.Attachment? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -6141,7 +6141,7 @@ public Hl7.Fhir.Model.Period? BenefitPeriod [DataMember] public List BenefitBalance { - get => _BenefitBalance ?? new List(); + get => _BenefitBalance ??= []; set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs index 68a7ff753..8aadb7f9c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs @@ -192,7 +192,7 @@ public Hl7.Fhir.Model.DataType? Onset [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -303,7 +303,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -317,7 +317,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -349,7 +349,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -601,7 +601,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -617,7 +617,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -631,7 +631,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -645,7 +645,7 @@ public List Note [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Flag.cs b/src/Hl7.Fhir.R4/Model/Generated/Flag.cs index 266e7dc6e..15bfdd3a7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Flag.cs @@ -98,7 +98,7 @@ public enum FlagStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.Flag.FlagStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Goal.cs b/src/Hl7.Fhir.R4/Model/Generated/Goal.cs index 380af5f4f..974b8e8b1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Goal.cs @@ -276,7 +276,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.CodeableConcept? AchievementStatus [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -411,7 +411,7 @@ public Hl7.Fhir.Model.DataType? Start [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -498,7 +498,7 @@ public Hl7.Fhir.Model.ResourceReference? ExpressedBy [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -512,7 +512,7 @@ public List Addresses [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -527,7 +527,7 @@ public List Note [DataMember] public List OutcomeCode { - get => _OutcomeCode ?? new List(); + get => _OutcomeCode ??= []; set { _OutcomeCode = value; OnPropertyChanged("OutcomeCode"); } } @@ -543,7 +543,7 @@ public List OutcomeCode [DataMember] public List OutcomeReference { - get => _OutcomeReference ?? new List(); + get => _OutcomeReference ??= []; set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs index e68ecb4ce..6125b5904 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs @@ -279,7 +279,7 @@ public string? Description [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -499,7 +499,7 @@ public string? Profile [DataMember] public List Compartment { - get => _Compartment ?? new List(); + get => _Compartment ??= []; set { _Compartment = value; OnPropertyChanged("Compartment"); } } @@ -513,7 +513,7 @@ public List Compartment [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -1083,7 +1083,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1125,7 +1125,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1140,7 +1140,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1241,7 +1241,7 @@ public string? Profile [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Group.cs b/src/Hl7.Fhir.R4/Model/Generated/Group.cs index 9e4b8526b..8df8362c9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Group.cs @@ -448,7 +448,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -635,7 +635,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingEntity [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -649,7 +649,7 @@ public List Characteristic [DataMember] public List Member { - get => _Member ?? new List(); + get => _Member ??= []; set { _Member = value; OnPropertyChanged("Member"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs index 7e814684e..1ceead631 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs @@ -129,7 +129,7 @@ public Hl7.Fhir.Model.Identifier? RequestIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -263,7 +263,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -279,7 +279,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -293,7 +293,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -309,7 +309,7 @@ public List Note [DataMember] public List EvaluationMessage { - get => _EvaluationMessage ?? new List(); + get => _EvaluationMessage ??= []; set { _EvaluationMessage = value; OnPropertyChanged("EvaluationMessage"); } } @@ -353,7 +353,7 @@ public Hl7.Fhir.Model.ResourceReference? Result [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs index 2bf4f1cc3..651d74787 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs @@ -214,7 +214,7 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -546,7 +546,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -604,7 +604,7 @@ public Hl7.Fhir.Model.ResourceReference? ProvidedBy [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -619,7 +619,7 @@ public List Category [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -634,7 +634,7 @@ public List Type [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -650,7 +650,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -761,7 +761,7 @@ public Hl7.Fhir.Model.Attachment? Photo [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -777,7 +777,7 @@ public List Telecom [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -792,7 +792,7 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get => _ServiceProvisionCode ?? new List(); + get => _ServiceProvisionCode ??= []; set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } @@ -806,7 +806,7 @@ public List ServiceProvisionCode [DataMember] public List Eligibility { - get => _Eligibility ?? new List(); + get => _Eligibility ??= []; set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } @@ -821,7 +821,7 @@ public List Eligibility [DataMember] public List Program { - get => _Program ?? new List(); + get => _Program ??= []; set { _Program = value; OnPropertyChanged("Program"); } } @@ -836,7 +836,7 @@ public List Program [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -851,7 +851,7 @@ public List Characteristic [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -866,7 +866,7 @@ public List Communication [DataMember] public List ReferralMethod { - get => _ReferralMethod ?? new List(); + get => _ReferralMethod ??= []; set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } @@ -908,7 +908,7 @@ public bool? AppointmentRequired [DataMember] public List AvailableTime { - get => _AvailableTime ?? new List(); + get => _AvailableTime ??= []; set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } @@ -922,7 +922,7 @@ public List AvailableTi [DataMember] public List NotAvailable { - get => _NotAvailable ?? new List(); + get => _NotAvailable ??= []; set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } @@ -966,7 +966,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs index f3f15cc66..094bbd90d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs @@ -209,7 +209,7 @@ public string? Family [DataMember] public List GivenElement { - get => _GivenElement ?? new List(); + get => _GivenElement ??= []; set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } @@ -241,7 +241,7 @@ public IEnumerable? Given [DataMember] public List PrefixElement { - get => _PrefixElement ?? new List(); + get => _PrefixElement ??= []; set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } @@ -273,7 +273,7 @@ public IEnumerable? Prefix [DataMember] public List SuffixElement { - get => _SuffixElement ?? new List(); + get => _SuffixElement ??= []; set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs index 23c9c8a93..1bde1a7ea 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs @@ -256,7 +256,7 @@ public int? NumberOfInstances [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -300,7 +300,7 @@ public Hl7.Fhir.Model.Coding? Laterality [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -342,7 +342,7 @@ public string? Started [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -356,7 +356,7 @@ public List Performer [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -851,7 +851,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -897,7 +897,7 @@ public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status [DataMember] public List Modality { - get => _Modality ?? new List(); + get => _Modality ??= []; set { _Modality = value; OnPropertyChanged("Modality"); } } @@ -972,7 +972,7 @@ public string? Started [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1003,7 +1003,7 @@ public Hl7.Fhir.Model.ResourceReference? Referrer [DataMember] public List Interpreter { - get => _Interpreter ?? new List(); + get => _Interpreter ??= []; set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } @@ -1019,7 +1019,7 @@ public List Interpreter [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1105,7 +1105,7 @@ public Hl7.Fhir.Model.ResourceReference? ProcedureReference [DataMember] public List ProcedureCode { - get => _ProcedureCode ?? new List(); + get => _ProcedureCode ??= []; set { _ProcedureCode = value; OnPropertyChanged("ProcedureCode"); } } @@ -1135,7 +1135,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1151,7 +1151,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1165,7 +1165,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1207,7 +1207,7 @@ public string? Description [DataMember] public List Series { - get => _Series ?? new List(); + get => _Series ??= []; set { _Series = value; OnPropertyChanged("Series"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs index 78b6cdce3..19bd67103 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs @@ -657,7 +657,7 @@ public Hl7.Fhir.Model.ResourceReference? Authority [DataMember] public List TargetDisease { - get => _TargetDisease ?? new List(); + get => _TargetDisease ??= []; set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } @@ -799,7 +799,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1117,7 +1117,7 @@ public Hl7.Fhir.Model.Quantity? DoseQuantity [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -1131,7 +1131,7 @@ public List Performer [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1146,7 +1146,7 @@ public List Note [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1162,7 +1162,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1205,7 +1205,7 @@ public bool? IsSubpotent [DataMember] public List SubpotentReason { - get => _SubpotentReason ?? new List(); + get => _SubpotentReason ??= []; set { _SubpotentReason = value; OnPropertyChanged("SubpotentReason"); } } @@ -1219,7 +1219,7 @@ public List SubpotentReason [DataMember] public List Education { - get => _Education ?? new List(); + get => _Education ??= []; set { _Education = value; OnPropertyChanged("Education"); } } @@ -1234,7 +1234,7 @@ public List Education [DataMember] public List ProgramEligibility { - get => _ProgramEligibility ?? new List(); + get => _ProgramEligibility ??= []; set { _ProgramEligibility = value; OnPropertyChanged("ProgramEligibility"); } } @@ -1262,7 +1262,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundingSource [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } @@ -1276,7 +1276,7 @@ public List Reaction [DataMember] public List ProtocolApplied { - get => _ProtocolApplied ?? new List(); + get => _ProtocolApplied ??= []; set { _ProtocolApplied = value; OnPropertyChanged("ProtocolApplied"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs index b6dd8f5f3..59d2b8785 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs @@ -92,7 +92,7 @@ public enum ImmunizationEvaluationStatusCodes [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -243,7 +243,7 @@ public Hl7.Fhir.Model.CodeableConcept? DoseStatus [DataMember] public List DoseStatusReason { - get => _DoseStatusReason ?? new List(); + get => _DoseStatusReason ??= []; set { _DoseStatusReason = value; OnPropertyChanged("DoseStatusReason"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs index 7f754ee4d..fa997baa4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs @@ -84,7 +84,7 @@ public partial class RecommendationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List VaccineCode { - get => _VaccineCode ?? new List(); + get => _VaccineCode ??= []; set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } @@ -113,7 +113,7 @@ public Hl7.Fhir.Model.CodeableConcept? TargetDisease [DataMember] public List ContraindicatedVaccineCode { - get => _ContraindicatedVaccineCode ?? new List(); + get => _ContraindicatedVaccineCode ??= []; set { _ContraindicatedVaccineCode = value; OnPropertyChanged("ContraindicatedVaccineCode"); } } @@ -143,7 +143,7 @@ public Hl7.Fhir.Model.CodeableConcept? ForecastStatus [DataMember] public List ForecastReason { - get => _ForecastReason ?? new List(); + get => _ForecastReason ??= []; set { _ForecastReason = value; OnPropertyChanged("ForecastReason"); } } @@ -157,7 +157,7 @@ public List ForecastReason [DataMember] public List DateCriterion { - get => _DateCriterion ?? new List(); + get => _DateCriterion ??= []; set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } @@ -259,7 +259,7 @@ public Hl7.Fhir.Model.DataType? SeriesDoses [DataMember] public List SupportingImmunization { - get => _SupportingImmunization ?? new List(); + get => _SupportingImmunization ??= []; set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } @@ -275,7 +275,7 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get => _SupportingPatientInformation ?? new List(); + get => _SupportingPatientInformation ??= []; set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } @@ -579,7 +579,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -653,7 +653,7 @@ public Hl7.Fhir.Model.ResourceReference? Authority [DataMember] public List Recommendation { - get => _Recommendation ?? new List(); + get => _Recommendation ??= []; set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs index 9d654dd12..21deb820c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs @@ -2604,7 +2604,7 @@ public partial class DefinitionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Grouping { - get => _Grouping ?? new List(); + get => _Grouping ??= []; set { _Grouping = value; OnPropertyChanged("Grouping"); } } @@ -2618,7 +2618,7 @@ public List Grouping [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -2645,7 +2645,7 @@ public Hl7.Fhir.Model.ImplementationGuide.PageComponent? Page [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2659,7 +2659,7 @@ public List Parameter [DataMember] public List Template { - get => _Template ?? new List(); + get => _Template ??= []; set { _Template = value; OnPropertyChanged("Template"); } } @@ -2948,7 +2948,7 @@ public Hl7.Fhir.Model.ResourceReference? Reference [DataMember] public List> FhirVersionElement { - get => _FhirVersionElement ?? new List>(); + get => _FhirVersionElement ??= []; set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } @@ -3279,7 +3279,7 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation [DataMember] public List Page { - get => _Page ?? new List(); + get => _Page ??= []; set { _Page = value; OnPropertyChanged("Page"); } } @@ -3746,7 +3746,7 @@ public string? Rendering [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -3760,7 +3760,7 @@ public List Resour [DataMember] public List Page { - get => _Page ?? new List(); + get => _Page ??= []; set { _Page = value; OnPropertyChanged("Page"); } } @@ -3774,7 +3774,7 @@ public List Page [DataMember] public List ImageElement { - get => _ImageElement ?? new List(); + get => _ImageElement ??= []; set { _ImageElement = value; OnPropertyChanged("ImageElement"); } } @@ -3806,7 +3806,7 @@ public IEnumerable? Image [DataMember] public List OtherElement { - get => _OtherElement ?? new List(); + get => _OtherElement ??= []; set { _OtherElement = value; OnPropertyChanged("OtherElement"); } } @@ -4162,7 +4162,7 @@ public string? Title [DataMember] public List AnchorElement { - get => _AnchorElement ?? new List(); + get => _AnchorElement ??= []; set { _AnchorElement = value; OnPropertyChanged("AnchorElement"); } } @@ -4502,7 +4502,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -4544,7 +4544,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -4559,7 +4559,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -4662,7 +4662,7 @@ public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License [DataMember] public List> FhirVersionElement { - get => _FhirVersionElement ?? new List>(); + get => _FhirVersionElement ??= []; set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } @@ -4694,7 +4694,7 @@ public IEnumerable? FhirVersion [DataMember] public List DependsOn { - get => _DependsOn ?? new List(); + get => _DependsOn ??= []; set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } @@ -4708,7 +4708,7 @@ public List DependsOn [DataMember] public List Global { - get => _Global ?? new List(); + get => _Global ??= []; set { _Global = value; OnPropertyChanged("Global"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs index 7fb26d055..f67d7a418 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs @@ -139,7 +139,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -286,7 +286,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -300,7 +300,7 @@ public List Network [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -451,7 +451,7 @@ public string? Requirement [DataMember] public List Limit { - get => _Limit ?? new List(); + get => _Limit ??= []; set { _Limit = value; OnPropertyChanged("Limit"); } } @@ -672,7 +672,7 @@ public partial class PlanComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -701,7 +701,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -717,7 +717,7 @@ public List CoverageArea [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -731,7 +731,7 @@ public List Network [DataMember] public List GeneralCost { - get => _GeneralCost ?? new List(); + get => _GeneralCost ??= []; set { _GeneralCost = value; OnPropertyChanged("GeneralCost"); } } @@ -745,7 +745,7 @@ public List GeneralCost [DataMember] public List SpecificCost { - get => _SpecificCost ?? new List(); + get => _SpecificCost ??= []; set { _SpecificCost = value; OnPropertyChanged("SpecificCost"); } } @@ -1081,7 +1081,7 @@ public Hl7.Fhir.Model.CodeableConcept? Category [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -1195,7 +1195,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Cost { - get => _Cost ?? new List(); + get => _Cost ??= []; set { _Cost = value; OnPropertyChanged("Cost"); } } @@ -1323,7 +1323,7 @@ public Hl7.Fhir.Model.CodeableConcept? Applicability [DataMember] public List Qualifiers { - get => _Qualifiers ?? new List(); + get => _Qualifiers ??= []; set { _Qualifiers = value; OnPropertyChanged("Qualifiers"); } } @@ -1438,7 +1438,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1483,7 +1483,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1525,7 +1525,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -1602,7 +1602,7 @@ public Hl7.Fhir.Model.ResourceReference? AdministeredBy [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -1616,7 +1616,7 @@ public List CoverageArea [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1632,7 +1632,7 @@ public List Contact [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1648,7 +1648,7 @@ public List Endpoint [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -1662,7 +1662,7 @@ public List Network [DataMember] public List Coverage { - get => _Coverage ?? new List(); + get => _Coverage ??= []; set { _Coverage = value; OnPropertyChanged("Coverage"); } } @@ -1676,7 +1676,7 @@ public List Coverage [DataMember] public List Plan { - get => _Plan ?? new List(); + get => _Plan ??= []; set { _Plan = value; OnPropertyChanged("Plan"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs index 8f2780a1a..dd97349c4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs @@ -286,7 +286,7 @@ public Hl7.Fhir.Model.DataType? ChargeItem [DataMember] public List PriceComponent { - get => _PriceComponent ?? new List(); + get => _PriceComponent ??= []; set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } @@ -568,7 +568,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -712,7 +712,7 @@ public string? Date [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -756,7 +756,7 @@ public Hl7.Fhir.Model.ResourceReference? Account [DataMember] public List LineItem { - get => _LineItem ?? new List(); + get => _LineItem ??= []; set { _LineItem = value; OnPropertyChanged("LineItem"); } } @@ -770,7 +770,7 @@ public List LineItem [DataMember] public List TotalPriceComponent { - get => _TotalPriceComponent ?? new List(); + get => _TotalPriceComponent ??= []; set { _TotalPriceComponent = value; OnPropertyChanged("TotalPriceComponent"); } } @@ -838,7 +838,7 @@ public string? PaymentTerms [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Library.cs b/src/Hl7.Fhir.R4/Model/Generated/Library.cs index f579d1f7c..b9ab8512a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Library.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -371,7 +371,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -413,7 +413,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -428,7 +428,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -596,7 +596,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -610,7 +610,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -624,7 +624,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -638,7 +638,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -652,7 +652,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -666,7 +666,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -680,7 +680,7 @@ public List RelatedArtifact [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -694,7 +694,7 @@ public List Parameter [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } @@ -708,7 +708,7 @@ public List DataRequirement [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs index 284a7d24a..4f306336d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs @@ -274,7 +274,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/List.cs b/src/Hl7.Fhir.R4/Model/Generated/List.cs index 0f3e7244c..553396b6f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/List.cs @@ -286,7 +286,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -491,7 +491,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -505,7 +505,7 @@ public List Note [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Location.cs b/src/Hl7.Fhir.R4/Model/Generated/Location.cs index e5a43aa79..4825ac53a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Location.cs @@ -320,7 +320,7 @@ public partial class HoursOfOperationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -524,7 +524,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -610,7 +610,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -701,7 +701,7 @@ public Hl7.Fhir.Model.Location.LocationMode? Mode [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -715,7 +715,7 @@ public List Type [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -799,7 +799,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List HoursOfOperation { - get => _HoursOfOperation ?? new List(); + get => _HoursOfOperation ??= []; set { _HoursOfOperation = value; OnPropertyChanged("HoursOfOperation"); } } @@ -843,7 +843,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs index f08bac39c..f2092f011 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs @@ -127,7 +127,7 @@ public string? Description [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -141,7 +141,7 @@ public List Population [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -464,7 +464,7 @@ public Hl7.Fhir.Model.Expression? Criteria [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -748,7 +748,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Usage { - get => _Usage ?? new List(); + get => _Usage ??= []; set { _Usage = value; OnPropertyChanged("Usage"); } } @@ -920,7 +920,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1178,7 +1178,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1220,7 +1220,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1235,7 +1235,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1403,7 +1403,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1417,7 +1417,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1431,7 +1431,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1445,7 +1445,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1459,7 +1459,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1473,7 +1473,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1487,7 +1487,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -1576,7 +1576,7 @@ public Hl7.Fhir.Model.CodeableConcept? CompositeScoring [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1716,7 +1716,7 @@ public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation [DataMember] public List DefinitionElement { - get => _DefinitionElement ?? new List(); + get => _DefinitionElement ??= []; set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } @@ -1776,7 +1776,7 @@ public string? Guidance [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -1790,7 +1790,7 @@ public List Group [DataMember] public List SupplementalData { - get => _SupplementalData ?? new List(); + get => _SupplementalData ??= []; set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs index df6087f88..620268217 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs @@ -161,7 +161,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -188,7 +188,7 @@ public Hl7.Fhir.Model.Quantity? MeasureScore [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -458,7 +458,7 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -472,7 +472,7 @@ public List Code [DataMember] public List Stratum { - get => _Stratum ?? new List(); + get => _Stratum ??= []; set { _Stratum = value; OnPropertyChanged("Stratum"); } } @@ -585,7 +585,7 @@ public Hl7.Fhir.Model.CodeableConcept? Value [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -599,7 +599,7 @@ public List Component [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -980,7 +980,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1171,7 +1171,7 @@ public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -1187,7 +1187,7 @@ public List Group [DataMember] public List EvaluatedResource { - get => _EvaluatedResource ?? new List(); + get => _EvaluatedResource ??= []; set { _EvaluatedResource = value; OnPropertyChanged("EvaluatedResource"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Media.cs b/src/Hl7.Fhir.R4/Model/Generated/Media.cs index 85e47159f..8306fb1a8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Media.cs @@ -67,7 +67,7 @@ public partial class Media : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -83,7 +83,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -99,7 +99,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -275,7 +275,7 @@ public Hl7.Fhir.Model.ResourceReference? Operator [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -472,7 +472,7 @@ public Hl7.Fhir.Model.Attachment? Content [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Medication.cs b/src/Hl7.Fhir.R4/Model/Generated/Medication.cs index 42a34fd89..df1f8d33d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Medication.cs @@ -394,7 +394,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -494,7 +494,7 @@ public Hl7.Fhir.Model.Ratio? Amount [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs index 04021a4f1..f69f29a14 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs @@ -458,7 +458,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -472,7 +472,7 @@ public List Identifier [DataMember] public List InstantiatesElement { - get => _InstantiatesElement ?? new List(); + get => _InstantiatesElement ??= []; set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -506,7 +506,7 @@ public IEnumerable? Instantiates [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -552,7 +552,7 @@ public Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCod [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -631,7 +631,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -661,7 +661,7 @@ public Hl7.Fhir.Model.DataType? Effective [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -676,7 +676,7 @@ public List Performe [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -692,7 +692,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -723,7 +723,7 @@ public Hl7.Fhir.Model.ResourceReference? Request [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -737,7 +737,7 @@ public List Device [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -766,7 +766,7 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs index 043f65949..0aed9ae91 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs @@ -310,7 +310,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -326,7 +326,7 @@ public List Reason [DataMember] public List ResponsibleParty { - get => _ResponsibleParty ?? new List(); + get => _ResponsibleParty ??= []; set { _ResponsibleParty = value; OnPropertyChanged("ResponsibleParty"); } } @@ -428,7 +428,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -444,7 +444,7 @@ public List Identifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -570,7 +570,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -584,7 +584,7 @@ public List SupportingInformation [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -615,7 +615,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List AuthorizingPrescription { - get => _AuthorizingPrescription ?? new List(); + get => _AuthorizingPrescription ??= []; set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } @@ -742,7 +742,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } @@ -756,7 +756,7 @@ public List Receiver [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -770,7 +770,7 @@ public List Note [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -799,7 +799,7 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution [DataMember] public List DetectedIssue { - get => _DetectedIssue ?? new List(); + get => _DetectedIssue ??= []; set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } @@ -815,7 +815,7 @@ public List DetectedIssue [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs index 42695a355..95cf9c369 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs @@ -130,7 +130,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -772,7 +772,7 @@ public partial class AdministrationGuidelinesComponent : Hl7.Fhir.Model.Backbone [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -802,7 +802,7 @@ public Hl7.Fhir.Model.DataType? Indication [DataMember] public List PatientCharacteristics { - get => _PatientCharacteristics ?? new List(); + get => _PatientCharacteristics ??= []; set { _PatientCharacteristics = value; OnPropertyChanged("PatientCharacteristics"); } } @@ -922,7 +922,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -1038,7 +1038,7 @@ public Hl7.Fhir.Model.DataType? Characteristic [DataMember] public List ValueElement { - get => _ValueElement ?? new List(); + get => _ValueElement ??= []; set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } @@ -1167,7 +1167,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -1508,7 +1508,7 @@ public Hl7.Fhir.Model.ResourceReference? RegulatoryAuthority [DataMember] public List Substitution { - get => _Substitution ?? new List(); + get => _Substitution ??= []; set { _Substitution = value; OnPropertyChanged("Substitution"); } } @@ -1522,7 +1522,7 @@ public List Substituti [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -1974,7 +1974,7 @@ public partial class KineticsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List AreaUnderCurve { - get => _AreaUnderCurve ?? new List(); + get => _AreaUnderCurve ??= []; set { _AreaUnderCurve = value; OnPropertyChanged("AreaUnderCurve"); } } @@ -1988,7 +1988,7 @@ public List AreaUnderCurve [DataMember] public List LethalDose50 { - get => _LethalDose50 ?? new List(); + get => _LethalDose50 ??= []; set { _LethalDose50 = value; OnPropertyChanged("LethalDose50"); } } @@ -2180,7 +2180,7 @@ public Hl7.Fhir.Model.Quantity? Amount [DataMember] public List SynonymElement { - get => _SynonymElement ?? new List(); + get => _SynonymElement ??= []; set { _SynonymElement = value; OnPropertyChanged("SynonymElement"); } } @@ -2212,7 +2212,7 @@ public IEnumerable? Synonym [DataMember] public List RelatedMedicationKnowledge { - get => _RelatedMedicationKnowledge ?? new List(); + get => _RelatedMedicationKnowledge ??= []; set { _RelatedMedicationKnowledge = value; OnPropertyChanged("RelatedMedicationKnowledge"); } } @@ -2228,7 +2228,7 @@ public List AssociatedMedication { - get => _AssociatedMedication ?? new List(); + get => _AssociatedMedication ??= []; set { _AssociatedMedication = value; OnPropertyChanged("AssociatedMedication"); } } @@ -2242,7 +2242,7 @@ public List AssociatedMedication [DataMember] public List ProductType { - get => _ProductType ?? new List(); + get => _ProductType ??= []; set { _ProductType = value; OnPropertyChanged("ProductType"); } } @@ -2256,7 +2256,7 @@ public List ProductType [DataMember] public List Monograph { - get => _Monograph ?? new List(); + get => _Monograph ??= []; set { _Monograph = value; OnPropertyChanged("Monograph"); } } @@ -2270,7 +2270,7 @@ public List Monograph [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -2313,7 +2313,7 @@ public string? PreparationInstruction [DataMember] public List IntendedRoute { - get => _IntendedRoute ?? new List(); + get => _IntendedRoute ??= []; set { _IntendedRoute = value; OnPropertyChanged("IntendedRoute"); } } @@ -2327,7 +2327,7 @@ public List IntendedRoute [DataMember] public List Cost { - get => _Cost ?? new List(); + get => _Cost ??= []; set { _Cost = value; OnPropertyChanged("Cost"); } } @@ -2341,7 +2341,7 @@ public List Cost [DataMember] public List MonitoringProgram { - get => _MonitoringProgram ?? new List(); + get => _MonitoringProgram ??= []; set { _MonitoringProgram = value; OnPropertyChanged("MonitoringProgram"); } } @@ -2355,7 +2355,7 @@ public List Monit [DataMember] public List AdministrationGuidelines { - get => _AdministrationGuidelines ?? new List(); + get => _AdministrationGuidelines ??= []; set { _AdministrationGuidelines = value; OnPropertyChanged("AdministrationGuidelines"); } } @@ -2369,7 +2369,7 @@ public List MedicineClassification { - get => _MedicineClassification ?? new List(); + get => _MedicineClassification ??= []; set { _MedicineClassification = value; OnPropertyChanged("MedicineClassification"); } } @@ -2396,7 +2396,7 @@ public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent? Packaging [DataMember] public List DrugCharacteristic { - get => _DrugCharacteristic ?? new List(); + get => _DrugCharacteristic ??= []; set { _DrugCharacteristic = value; OnPropertyChanged("DrugCharacteristic"); } } @@ -2412,7 +2412,7 @@ public List Drug [DataMember] public List Contraindication { - get => _Contraindication ?? new List(); + get => _Contraindication ??= []; set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } @@ -2426,7 +2426,7 @@ public List Contraindication [DataMember] public List Regulatory { - get => _Regulatory ?? new List(); + get => _Regulatory ??= []; set { _Regulatory = value; OnPropertyChanged("Regulatory"); } } @@ -2440,7 +2440,7 @@ public List Regulatory [DataMember] public List Kinetics { - get => _Kinetics ?? new List(); + get => _Kinetics ??= []; set { _Kinetics = value; OnPropertyChanged("Kinetics"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs index 081ac9c51..b212c9cc5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs @@ -655,7 +655,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -746,7 +746,7 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -885,7 +885,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -987,7 +987,7 @@ public Hl7.Fhir.Model.ResourceReference? Recorder [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1003,7 +1003,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1017,7 +1017,7 @@ public List ReasonReference [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1049,7 +1049,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1083,7 +1083,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1126,7 +1126,7 @@ public Hl7.Fhir.Model.CodeableConcept? CourseOfTherapyType [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1140,7 +1140,7 @@ public List Insurance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1154,7 +1154,7 @@ public List Note [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -1211,7 +1211,7 @@ public Hl7.Fhir.Model.ResourceReference? PriorPrescription [DataMember] public List DetectedIssue { - get => _DetectedIssue ?? new List(); + get => _DetectedIssue ??= []; set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } @@ -1227,7 +1227,7 @@ public List DetectedIssue [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs index dffd793a9..a85c5d9b9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs @@ -139,7 +139,7 @@ public enum MedicationStatusCodes [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -155,7 +155,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -171,7 +171,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -217,7 +217,7 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatusCodes? Status [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -354,7 +354,7 @@ public Hl7.Fhir.Model.ResourceReference? InformationSource [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -369,7 +369,7 @@ public List DerivedFrom [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -385,7 +385,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -399,7 +399,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -413,7 +413,7 @@ public List Note [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs index ca20691df..9589012e2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs @@ -109,7 +109,7 @@ public string? ProductName [DataMember] public List NamePart { - get => _NamePart ?? new List(); + get => _NamePart ??= []; set { _NamePart = value; OnPropertyChanged("NamePart"); } } @@ -123,7 +123,7 @@ public List NamePart [DataMember] public List CountryLanguage { - get => _CountryLanguage ?? new List(); + get => _CountryLanguage ??= []; set { _CountryLanguage = value; OnPropertyChanged("CountryLanguage"); } } @@ -557,7 +557,7 @@ public Hl7.Fhir.Model.CodeableConcept? ConfidentialityIndicator [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -705,7 +705,7 @@ public partial class SpecialDesignationComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -930,7 +930,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1009,7 +1009,7 @@ public Hl7.Fhir.Model.CodeableConcept? AdditionalMonitoringIndicator [DataMember] public List SpecialMeasuresElement { - get => _SpecialMeasuresElement ?? new List(); + get => _SpecialMeasuresElement ??= []; set { _SpecialMeasuresElement = value; OnPropertyChanged("SpecialMeasuresElement"); } } @@ -1054,7 +1054,7 @@ public Hl7.Fhir.Model.CodeableConcept? PaediatricUseIndicator [DataMember] public List ProductClassification { - get => _ProductClassification ?? new List(); + get => _ProductClassification ??= []; set { _ProductClassification = value; OnPropertyChanged("ProductClassification"); } } @@ -1068,7 +1068,7 @@ public List ProductClassification [DataMember] public List MarketingStatus { - get => _MarketingStatus ?? new List(); + get => _MarketingStatus ??= []; set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } @@ -1084,7 +1084,7 @@ public List MarketingStatus [DataMember] public List PharmaceuticalProduct { - get => _PharmaceuticalProduct ?? new List(); + get => _PharmaceuticalProduct ??= []; set { _PharmaceuticalProduct = value; OnPropertyChanged("PharmaceuticalProduct"); } } @@ -1100,7 +1100,7 @@ public List PharmaceuticalProduct [DataMember] public List PackagedMedicinalProduct { - get => _PackagedMedicinalProduct ?? new List(); + get => _PackagedMedicinalProduct ??= []; set { _PackagedMedicinalProduct = value; OnPropertyChanged("PackagedMedicinalProduct"); } } @@ -1116,7 +1116,7 @@ public List PackagedMedicinalProduct [DataMember] public List AttachedDocument { - get => _AttachedDocument ?? new List(); + get => _AttachedDocument ??= []; set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } @@ -1132,7 +1132,7 @@ public List AttachedDocument [DataMember] public List MasterFile { - get => _MasterFile ?? new List(); + get => _MasterFile ??= []; set { _MasterFile = value; OnPropertyChanged("MasterFile"); } } @@ -1148,7 +1148,7 @@ public List MasterFile [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1164,7 +1164,7 @@ public List Contact [DataMember] public List ClinicalTrial { - get => _ClinicalTrial ?? new List(); + get => _ClinicalTrial ??= []; set { _ClinicalTrial = value; OnPropertyChanged("ClinicalTrial"); } } @@ -1178,7 +1178,7 @@ public List ClinicalTrial [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -1192,7 +1192,7 @@ public List Name [DataMember] public List CrossReference { - get => _CrossReference ?? new List(); + get => _CrossReference ??= []; set { _CrossReference = value; OnPropertyChanged("CrossReference"); } } @@ -1206,7 +1206,7 @@ public List CrossReference [DataMember] public List ManufacturingBusinessOperation { - get => _ManufacturingBusinessOperation ?? new List(); + get => _ManufacturingBusinessOperation ??= []; set { _ManufacturingBusinessOperation = value; OnPropertyChanged("ManufacturingBusinessOperation"); } } @@ -1220,7 +1220,7 @@ public List SpecialDesignation { - get => _SpecialDesignation ?? new List(); + get => _SpecialDesignation ??= []; set { _SpecialDesignation = value; OnPropertyChanged("SpecialDesignation"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs index cd8917ea0..4784bff97 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs @@ -80,7 +80,7 @@ public partial class JurisdictionalAuthorizationComponent : Hl7.Fhir.Model.Backb [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -107,7 +107,7 @@ public Hl7.Fhir.Model.CodeableConcept? Country [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -299,7 +299,7 @@ public Hl7.Fhir.Model.DataType? Date [DataMember] public List Application { - get => _Application ?? new List(); + get => _Application ??= []; set { _Application = value; OnPropertyChanged("Application"); } } @@ -401,7 +401,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -430,7 +430,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Country { - get => _Country ?? new List(); + get => _Country ??= []; set { _Country = value; OnPropertyChanged("Country"); } } @@ -444,7 +444,7 @@ public List Country [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -622,7 +622,7 @@ public Hl7.Fhir.Model.CodeableConcept? LegalBasis [DataMember] public List JurisdictionalAuthorization { - get => _JurisdictionalAuthorization ?? new List(); + get => _JurisdictionalAuthorization ??= []; set { _JurisdictionalAuthorization = value; OnPropertyChanged("JurisdictionalAuthorization"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs index 881d9ccbd..7fd20767e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs @@ -186,7 +186,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -226,7 +226,7 @@ public Hl7.Fhir.Model.CodeableConcept? DiseaseStatus [DataMember] public List Comorbidity { - get => _Comorbidity ?? new List(); + get => _Comorbidity ??= []; set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } @@ -242,7 +242,7 @@ public List Comorbidity [DataMember] public List TherapeuticIndication { - get => _TherapeuticIndication ?? new List(); + get => _TherapeuticIndication ??= []; set { _TherapeuticIndication = value; OnPropertyChanged("TherapeuticIndication"); } } @@ -256,7 +256,7 @@ public List TherapeuticIndication [DataMember] public List OtherTherapy { - get => _OtherTherapy ?? new List(); + get => _OtherTherapy ??= []; set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } @@ -270,7 +270,7 @@ public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs index 1cc1d28ab..ffe371ee4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs @@ -186,7 +186,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -226,7 +226,7 @@ public Hl7.Fhir.Model.CodeableConcept? DiseaseStatus [DataMember] public List Comorbidity { - get => _Comorbidity ?? new List(); + get => _Comorbidity ??= []; set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } @@ -266,7 +266,7 @@ public Hl7.Fhir.Model.Quantity? Duration [DataMember] public List OtherTherapy { - get => _OtherTherapy ?? new List(); + get => _OtherTherapy ??= []; set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } @@ -282,7 +282,7 @@ public List Oth [DataMember] public List UndesirableEffect { - get => _UndesirableEffect ?? new List(); + get => _UndesirableEffect ??= []; set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } @@ -296,7 +296,7 @@ public List UndesirableEffect [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs index f452b842a..b27f82130 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs @@ -121,7 +121,7 @@ public Hl7.Fhir.Model.CodeableConcept? Confidentiality [DataMember] public List Strength { - get => _Strength ?? new List(); + get => _Strength ??= []; set { _Strength = value; OnPropertyChanged("Strength"); } } @@ -317,7 +317,7 @@ public string? MeasurementPoint [DataMember] public List Country { - get => _Country ?? new List(); + get => _Country ??= []; set { _Country = value; OnPropertyChanged("Country"); } } @@ -331,7 +331,7 @@ public List Country [DataMember] public List ReferenceStrength { - get => _ReferenceStrength ?? new List(); + get => _ReferenceStrength ??= []; set { _ReferenceStrength = value; OnPropertyChanged("ReferenceStrength"); } } @@ -541,7 +541,7 @@ public string? MeasurementPoint [DataMember] public List Country { - get => _Country ?? new List(); + get => _Country ??= []; set { _Country = value; OnPropertyChanged("Country"); } } @@ -679,7 +679,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Strength { - get => _Strength ?? new List(); + get => _Strength ??= []; set { _Strength = value; OnPropertyChanged("Strength"); } } @@ -820,7 +820,7 @@ public bool? AllergenicIndicator [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -834,7 +834,7 @@ public List Manufacturer [DataMember] public List SpecifiedSubstance { - get => _SpecifiedSubstance ?? new List(); + get => _SpecifiedSubstance ??= []; set { _SpecifiedSubstance = value; OnPropertyChanged("SpecifiedSubstance"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs index c9dafaa50..5affd6fc8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs @@ -163,7 +163,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -205,7 +205,7 @@ public string? Description [DataMember] public List Interactant { - get => _Interactant ?? new List(); + get => _Interactant ??= []; set { _Interactant = value; OnPropertyChanged("Interactant"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs index 8b7033f5a..6f8b9545b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs @@ -110,7 +110,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -126,7 +126,7 @@ public List Manufacturer [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -153,7 +153,7 @@ public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics [DataMember] public List OtherCharacteristics { - get => _OtherCharacteristics ?? new List(); + get => _OtherCharacteristics ??= []; set { _OtherCharacteristics = value; OnPropertyChanged("OtherCharacteristics"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs index 0f6c628d1..3961d543b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs @@ -190,7 +190,7 @@ public partial class PackageItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -232,7 +232,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Material { - get => _Material ?? new List(); + get => _Material ??= []; set { _Material = value; OnPropertyChanged("Material"); } } @@ -246,7 +246,7 @@ public List Material [DataMember] public List AlternateMaterial { - get => _AlternateMaterial ?? new List(); + get => _AlternateMaterial ??= []; set { _AlternateMaterial = value; OnPropertyChanged("AlternateMaterial"); } } @@ -262,7 +262,7 @@ public List AlternateMaterial [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -278,7 +278,7 @@ public List Device [DataMember] public List ManufacturedItem { - get => _ManufacturedItem ?? new List(); + get => _ManufacturedItem ??= []; set { _ManufacturedItem = value; OnPropertyChanged("ManufacturedItem"); } } @@ -292,7 +292,7 @@ public List ManufacturedItem [DataMember] public List PackageItem { - get => _PackageItem ?? new List(); + get => _PackageItem ??= []; set { _PackageItem = value; OnPropertyChanged("PackageItem"); } } @@ -319,7 +319,7 @@ public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics [DataMember] public List OtherCharacteristics { - get => _OtherCharacteristics ?? new List(); + get => _OtherCharacteristics ??= []; set { _OtherCharacteristics = value; OnPropertyChanged("OtherCharacteristics"); } } @@ -333,7 +333,7 @@ public List OtherCharacteristics [DataMember] public List ShelfLifeStorage { - get => _ShelfLifeStorage ?? new List(); + get => _ShelfLifeStorage ??= []; set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } @@ -349,7 +349,7 @@ public List ShelfLifeStorage [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -523,7 +523,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -539,7 +539,7 @@ public List Identifier [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -594,7 +594,7 @@ public Hl7.Fhir.Model.CodeableConcept? LegalStatusOfSupply [DataMember] public List MarketingStatus { - get => _MarketingStatus ?? new List(); + get => _MarketingStatus ??= []; set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } @@ -625,7 +625,7 @@ public Hl7.Fhir.Model.ResourceReference? MarketingAuthorization [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -639,7 +639,7 @@ public List Manufacturer [DataMember] public List BatchIdentifier { - get => _BatchIdentifier ?? new List(); + get => _BatchIdentifier ??= []; set { _BatchIdentifier = value; OnPropertyChanged("BatchIdentifier"); } } @@ -653,7 +653,7 @@ public List Ba [DataMember] public List PackageItem { - get => _PackageItem ?? new List(); + get => _PackageItem ??= []; set { _PackageItem = value; OnPropertyChanged("PackageItem"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs index c6c318086..f637091a6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs @@ -269,7 +269,7 @@ public Hl7.Fhir.Model.Duration? MaxTreatmentPeriod [DataMember] public List TargetSpecies { - get => _TargetSpecies ?? new List(); + get => _TargetSpecies ??= []; set { _TargetSpecies = value; OnPropertyChanged("TargetSpecies"); } } @@ -425,7 +425,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List WithdrawalPeriod { - get => _WithdrawalPeriod ?? new List(); + get => _WithdrawalPeriod ??= []; set { _WithdrawalPeriod = value; OnPropertyChanged("WithdrawalPeriod"); } } @@ -657,7 +657,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -700,7 +700,7 @@ public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -716,7 +716,7 @@ public List Ingredient [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -730,7 +730,7 @@ public List Device [DataMember] public List Characteristics { - get => _Characteristics ?? new List(); + get => _Characteristics ??= []; set { _Characteristics = value; OnPropertyChanged("Characteristics"); } } @@ -744,7 +744,7 @@ public List RouteOfAdministration { - get => _RouteOfAdministration ?? new List(); + get => _RouteOfAdministration ??= []; set { _RouteOfAdministration = value; OnPropertyChanged("RouteOfAdministration"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs index 1c59c4f1b..f381faed8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs @@ -72,7 +72,7 @@ public partial class MedicinalProductUndesirableEffect : Hl7.Fhir.Model.DomainRe [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -125,7 +125,7 @@ public Hl7.Fhir.Model.CodeableConcept? FrequencyOfOccurrence [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs index 416520972..8dda863a9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs @@ -491,7 +491,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -589,7 +589,7 @@ public string? Title [DataMember] public List ReplacesElement { - get => _ReplacesElement ?? new List(); + get => _ReplacesElement ??= []; set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } @@ -737,7 +737,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -779,7 +779,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -794,7 +794,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -892,7 +892,7 @@ public string? Base [DataMember] public List ParentElement { - get => _ParentElement ?? new List(); + get => _ParentElement ??= []; set { _ParentElement = value; OnPropertyChanged("ParentElement"); } } @@ -971,7 +971,7 @@ public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -1015,7 +1015,7 @@ public Hl7.Fhir.Model.MessageheaderResponseRequest? ResponseRequired [DataMember] public List AllowedResponse { - get => _AllowedResponse ?? new List(); + get => _AllowedResponse ??= []; set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } @@ -1029,7 +1029,7 @@ public List AllowedRe [DataMember] public List GraphElement { - get => _GraphElement ?? new List(); + get => _GraphElement ??= []; set { _GraphElement = value; OnPropertyChanged("GraphElement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs index d53596169..7a163da40 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs @@ -716,7 +716,7 @@ public Hl7.Fhir.Model.DataType? Event [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -833,7 +833,7 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs index cb20b79f5..e4f49d271 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs @@ -1435,7 +1435,7 @@ public partial class RocComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ScoreElement { - get => _ScoreElement ?? new List(); + get => _ScoreElement ??= []; set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } @@ -1467,7 +1467,7 @@ public IEnumerable? Score [DataMember] public List NumTPElement { - get => _NumTPElement ?? new List(); + get => _NumTPElement ??= []; set { _NumTPElement = value; OnPropertyChanged("NumTPElement"); } } @@ -1499,7 +1499,7 @@ public IEnumerable? NumTP [DataMember] public List NumFPElement { - get => _NumFPElement ?? new List(); + get => _NumFPElement ??= []; set { _NumFPElement = value; OnPropertyChanged("NumFPElement"); } } @@ -1531,7 +1531,7 @@ public IEnumerable? NumFP [DataMember] public List NumFNElement { - get => _NumFNElement ?? new List(); + get => _NumFNElement ??= []; set { _NumFNElement = value; OnPropertyChanged("NumFNElement"); } } @@ -1563,7 +1563,7 @@ public IEnumerable? NumFN [DataMember] public List PrecisionElement { - get => _PrecisionElement ?? new List(); + get => _PrecisionElement ??= []; set { _PrecisionElement = value; OnPropertyChanged("PrecisionElement"); } } @@ -1595,7 +1595,7 @@ public IEnumerable? Precision [DataMember] public List SensitivityElement { - get => _SensitivityElement ?? new List(); + get => _SensitivityElement ??= []; set { _SensitivityElement = value; OnPropertyChanged("SensitivityElement"); } } @@ -1627,7 +1627,7 @@ public IEnumerable? Sensitivity [DataMember] public List FMeasureElement { - get => _FMeasureElement ?? new List(); + get => _FMeasureElement ??= []; set { _FMeasureElement = value; OnPropertyChanged("FMeasureElement"); } } @@ -2554,7 +2554,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2713,7 +2713,7 @@ public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent? ReferenceSeq [DataMember] public List Variant { - get => _Variant ?? new List(); + get => _Variant ??= []; set { _Variant = value; OnPropertyChanged("Variant"); } } @@ -2755,7 +2755,7 @@ public string? ObservedSeq [DataMember] public List Quality { - get => _Quality ?? new List(); + get => _Quality ??= []; set { _Quality = value; OnPropertyChanged("Quality"); } } @@ -2797,7 +2797,7 @@ public int? ReadCoverage [DataMember] public List Repository { - get => _Repository ?? new List(); + get => _Repository ??= []; set { _Repository = value; OnPropertyChanged("Repository"); } } @@ -2813,7 +2813,7 @@ public List Repository [DataMember] public List Pointer { - get => _Pointer ?? new List(); + get => _Pointer ??= []; set { _Pointer = value; OnPropertyChanged("Pointer"); } } @@ -2827,7 +2827,7 @@ public List Pointer [DataMember] public List StructureVariant { - get => _StructureVariant ?? new List(); + get => _StructureVariant ??= []; set { _StructureVariant = value; OnPropertyChanged("StructureVariant"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs index abb41b228..a55f0d8d7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs @@ -523,7 +523,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -607,7 +607,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -622,7 +622,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -664,7 +664,7 @@ public string? Usage [DataMember] public List UniqueId { - get => _UniqueId ?? new List(); + get => _UniqueId ??= []; set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs index a6df831df..679ebdbaf 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs @@ -88,7 +88,7 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -102,7 +102,7 @@ public List Type [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -116,7 +116,7 @@ public List Schedule [DataMember] public List Nutrient { - get => _Nutrient ?? new List(); + get => _Nutrient ??= []; set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } @@ -130,7 +130,7 @@ public List Nutrient [DataMember] public List Texture { - get => _Texture ?? new List(); + get => _Texture ??= []; set { _Texture = value; OnPropertyChanged("Texture"); } } @@ -145,7 +145,7 @@ public List Texture [DataMember] public List FluidConsistencyType { - get => _FluidConsistencyType ?? new List(); + get => _FluidConsistencyType ??= []; set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } @@ -578,7 +578,7 @@ public string? ProductName [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -857,7 +857,7 @@ public Hl7.Fhir.Model.CodeableConcept? RouteofAdministration [DataMember] public List Administration { - get => _Administration ?? new List(); + get => _Administration ??= []; set { _Administration = value; OnPropertyChanged("Administration"); } } @@ -1182,7 +1182,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1196,7 +1196,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1228,7 +1228,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1260,7 +1260,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List InstantiatesElement { - get => _InstantiatesElement ?? new List(); + get => _InstantiatesElement ??= []; set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -1431,7 +1431,7 @@ public Hl7.Fhir.Model.ResourceReference? Orderer [DataMember] public List AllergyIntolerance { - get => _AllergyIntolerance ?? new List(); + get => _AllergyIntolerance ??= []; set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } @@ -1446,7 +1446,7 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get => _FoodPreferenceModifier ?? new List(); + get => _FoodPreferenceModifier ??= []; set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } @@ -1461,7 +1461,7 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get => _ExcludeFoodModifier ?? new List(); + get => _ExcludeFoodModifier ??= []; set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } @@ -1488,7 +1488,7 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet [DataMember] public List Supplement { - get => _Supplement ?? new List(); + get => _Supplement ??= []; set { _Supplement = value; OnPropertyChanged("Supplement"); } } @@ -1515,7 +1515,7 @@ public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? EnteralFormula [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Observation.cs b/src/Hl7.Fhir.R4/Model/Generated/Observation.cs index dc045b88c..381df344d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Observation.cs @@ -129,7 +129,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List AppliesTo { - get => _AppliesTo ?? new List(); + get => _AppliesTo ??= []; set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } @@ -352,7 +352,7 @@ public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason [DataMember] public List Interpretation { - get => _Interpretation ?? new List(); + get => _Interpretation ??= []; set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } @@ -366,7 +366,7 @@ public List Interpretation [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -477,7 +477,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -493,7 +493,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -509,7 +509,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -555,7 +555,7 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -601,7 +601,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -675,7 +675,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -719,7 +719,7 @@ public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason [DataMember] public List Interpretation { - get => _Interpretation ?? new List(); + get => _Interpretation ??= []; set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } @@ -733,7 +733,7 @@ public List Interpretation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -805,7 +805,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -821,7 +821,7 @@ public List ReferenceRange [DataMember] public List HasMember { - get => _HasMember ?? new List(); + get => _HasMember ??= []; set { _HasMember = value; OnPropertyChanged("HasMember"); } } @@ -837,7 +837,7 @@ public List HasMember [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -851,7 +851,7 @@ public List DerivedFrom [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs index 3611fbede..2a00c7cc5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs @@ -437,7 +437,7 @@ public Hl7.Fhir.Model.CodeableConcept? Context [DataMember] public List AppliesTo { - get => _AppliesTo ?? new List(); + get => _AppliesTo ??= []; set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } @@ -660,7 +660,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -689,7 +689,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -705,7 +705,7 @@ public List Identifier [DataMember] public List> PermittedDataTypeElement { - get => _PermittedDataTypeElement ?? new List>(); + get => _PermittedDataTypeElement ??= []; set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } @@ -820,7 +820,7 @@ public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent? Quanti [DataMember] public List QualifiedInterval { - get => _QualifiedInterval ?? new List(); + get => _QualifiedInterval ??= []; set { _QualifiedInterval = value; OnPropertyChanged("QualifiedInterval"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs index a902888cf..ea796bac2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs @@ -285,7 +285,7 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List TargetProfileElement { - get => _TargetProfileElement ?? new List(); + get => _TargetProfileElement ??= []; set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } @@ -360,7 +360,7 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding [DataMember] public List ReferencedFrom { - get => _ReferencedFrom ?? new List(); + get => _ReferencedFrom ??= []; set { _ReferencedFrom = value; OnPropertyChanged("ReferencedFrom"); } } @@ -374,7 +374,7 @@ public List Referenc [DataMember] public List Part { - get => _Part ?? new List(); + get => _Part ??= []; set { _Part = value; OnPropertyChanged("Part"); } } @@ -846,7 +846,7 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get => _ParameterNameElement ?? new List(); + get => _ParameterNameElement ??= []; set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } @@ -1235,7 +1235,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1277,7 +1277,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1292,7 +1292,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1449,7 +1449,7 @@ public string? Base [DataMember] public List> ResourceElement { - get => _ResourceElement ?? new List>(); + get => _ResourceElement ??= []; set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } @@ -1624,7 +1624,7 @@ public string? OutputProfile [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1638,7 +1638,7 @@ public List Parameter [DataMember] public List Overload { - get => _Overload ?? new List(); + get => _Overload ??= []; set { _Overload = value; OnPropertyChanged("Overload"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs index 95dd6dec2..a69f89b51 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs @@ -113,7 +113,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -228,7 +228,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -271,7 +271,7 @@ public bool? Active [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -313,7 +313,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -345,7 +345,7 @@ public IEnumerable? Alias [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -359,7 +359,7 @@ public List Telecom [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -388,7 +388,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -404,7 +404,7 @@ public List Contact [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs index 64d7368b2..ad5acdc9b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs @@ -67,7 +67,7 @@ public partial class OrganizationAffiliation : Hl7.Fhir.Model.DomainResource, II [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -154,7 +154,7 @@ public Hl7.Fhir.Model.ResourceReference? ParticipatingOrganization [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -169,7 +169,7 @@ public List Network [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -184,7 +184,7 @@ public List Code [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -200,7 +200,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -216,7 +216,7 @@ public List Location [DataMember] public List HealthcareService { - get => _HealthcareService ?? new List(); + get => _HealthcareService ??= []; set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } @@ -230,7 +230,7 @@ public List HealthcareService [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -246,7 +246,7 @@ public List Telecom [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Patient.cs b/src/Hl7.Fhir.R4/Model/Generated/Patient.cs index 09154cb10..539553a40 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Patient.cs @@ -121,7 +121,7 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } @@ -148,7 +148,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -611,7 +611,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -653,7 +653,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -667,7 +667,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -754,7 +754,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -797,7 +797,7 @@ public Hl7.Fhir.Model.DataType? MultipleBirth [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -811,7 +811,7 @@ public List Photo [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -825,7 +825,7 @@ public List Contact [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -841,7 +841,7 @@ public List Communication [DataMember] public List GeneralPractitioner { - get => _GeneralPractitioner ?? new List(); + get => _GeneralPractitioner ??= []; set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } @@ -870,7 +870,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs index 0253db4a0..f90648025 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs @@ -70,7 +70,7 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs index d9bca9e50..418481be2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs @@ -529,7 +529,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -775,7 +775,7 @@ public Hl7.Fhir.Model.Identifier? PaymentIdentifier [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -803,7 +803,7 @@ public Hl7.Fhir.Model.CodeableConcept? FormCode [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Person.cs b/src/Hl7.Fhir.R4/Model/Generated/Person.cs index 5a450053d..19a03ec07 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Person.cs @@ -234,7 +234,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -248,7 +248,7 @@ public List Identifier [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -262,7 +262,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -334,7 +334,7 @@ public string? BirthDate [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -404,7 +404,7 @@ public bool? Active [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs index 506e3e461..f0af7b8c1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.CodeableConcept? Start [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -158,7 +158,7 @@ public List Addresses [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -172,7 +172,7 @@ public List Documentation [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -597,7 +597,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -611,7 +611,7 @@ public List Code [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -625,7 +625,7 @@ public List Reason [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -639,7 +639,7 @@ public List Documentation [DataMember] public List GoalIdElement { - get => _GoalIdElement ?? new List(); + get => _GoalIdElement ??= []; set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } @@ -688,7 +688,7 @@ public Hl7.Fhir.Model.DataType? Subject [DataMember] public List Trigger { - get => _Trigger ?? new List(); + get => _Trigger ??= []; set { _Trigger = value; OnPropertyChanged("Trigger"); } } @@ -702,7 +702,7 @@ public List Trigger [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -716,7 +716,7 @@ public List Condition [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -730,7 +730,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } @@ -744,7 +744,7 @@ public List Output [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -773,7 +773,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -994,7 +994,7 @@ public string? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } @@ -1008,7 +1008,7 @@ public List DynamicValue [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1906,7 +1906,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2178,7 +2178,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2220,7 +2220,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2235,7 +2235,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2403,7 +2403,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -2417,7 +2417,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -2431,7 +2431,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -2445,7 +2445,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -2459,7 +2459,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -2473,7 +2473,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2487,7 +2487,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -2519,7 +2519,7 @@ public IEnumerable? Library [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -2533,7 +2533,7 @@ public List Goal [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs index 59b76aa3e..360b69de8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs @@ -86,7 +86,7 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -231,7 +231,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -273,7 +273,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -287,7 +287,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -301,7 +301,7 @@ public List Telecom [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -373,7 +373,7 @@ public string? BirthDate [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -387,7 +387,7 @@ public List Photo [DataMember] public List Qualification { - get => _Qualification ?? new List(); + get => _Qualification ??= []; set { _Qualification = value; OnPropertyChanged("Qualification"); } } @@ -402,7 +402,7 @@ public List Qualification [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs index 0af24c393..127055983 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs @@ -89,7 +89,7 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -421,7 +421,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -507,7 +507,7 @@ public Hl7.Fhir.Model.ResourceReference? Organization [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -522,7 +522,7 @@ public List Code [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -538,7 +538,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -554,7 +554,7 @@ public List Location [DataMember] public List HealthcareService { - get => _HealthcareService ?? new List(); + get => _HealthcareService ??= []; set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } @@ -568,7 +568,7 @@ public List HealthcareService [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -582,7 +582,7 @@ public List Telecom [DataMember] public List AvailableTime { - get => _AvailableTime ?? new List(); + get => _AvailableTime ??= []; set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } @@ -596,7 +596,7 @@ public List AvailableTim [DataMember] public List NotAvailable { - get => _NotAvailable ?? new List(); + get => _NotAvailable ??= []; set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } @@ -640,7 +640,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs index a10ffd4da..b1697cfb9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs @@ -326,7 +326,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -340,7 +340,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -372,7 +372,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -406,7 +406,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -422,7 +422,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -585,7 +585,7 @@ public Hl7.Fhir.Model.ResourceReference? Asserter [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -615,7 +615,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -631,7 +631,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -646,7 +646,7 @@ public List ReasonReference [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -676,7 +676,7 @@ public Hl7.Fhir.Model.CodeableConcept? Outcome [DataMember] public List Report { - get => _Report ?? new List(); + get => _Report ??= []; set { _Report = value; OnPropertyChanged("Report"); } } @@ -691,7 +691,7 @@ public List Report [DataMember] public List Complication { - get => _Complication ?? new List(); + get => _Complication ??= []; set { _Complication = value; OnPropertyChanged("Complication"); } } @@ -707,7 +707,7 @@ public List Complication [DataMember] public List ComplicationDetail { - get => _ComplicationDetail ?? new List(); + get => _ComplicationDetail ??= []; set { _ComplicationDetail = value; OnPropertyChanged("ComplicationDetail"); } } @@ -722,7 +722,7 @@ public List ComplicationDetail [DataMember] public List FollowUp { - get => _FollowUp ?? new List(); + get => _FollowUp ??= []; set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } @@ -736,7 +736,7 @@ public List FollowUp [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -750,7 +750,7 @@ public List Note [DataMember] public List FocalDevice { - get => _FocalDevice ?? new List(); + get => _FocalDevice ??= []; set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } @@ -766,7 +766,7 @@ public List FocalDevice [DataMember] public List UsedReference { - get => _UsedReference ?? new List(); + get => _UsedReference ??= []; set { _UsedReference = value; OnPropertyChanged("UsedReference"); } } @@ -781,7 +781,7 @@ public List UsedReference [DataMember] public List UsedCode { - get => _UsedCode ?? new List(); + get => _UsedCode ??= []; set { _UsedCode = value; OnPropertyChanged("UsedCode"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs index ca0380bba..2975d5f2e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs @@ -173,7 +173,7 @@ public string? Shape [DataMember] public List ColorElement { - get => _ColorElement ?? new List(); + get => _ColorElement ??= []; set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } @@ -205,7 +205,7 @@ public IEnumerable? Color [DataMember] public List ImprintElement { - get => _ImprintElement ?? new List(); + get => _ImprintElement ??= []; set { _ImprintElement = value; OnPropertyChanged("ImprintElement"); } } @@ -237,7 +237,7 @@ public IEnumerable? Imprint [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs index 66d285163..91df7e4dc 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs @@ -108,7 +108,7 @@ public Hl7.Fhir.Model.Quantity? Period [DataMember] public List SpecialPrecautionsForStorage { - get => _SpecialPrecautionsForStorage ?? new List(); + get => _SpecialPrecautionsForStorage ??= []; set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs index f0e015489..638405617 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs @@ -143,7 +143,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.ResourceReference? What [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -431,7 +431,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -489,7 +489,7 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -565,7 +565,7 @@ public Hl7.Fhir.Model.CodeableConcept? Activity [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -579,7 +579,7 @@ public List Agent [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } @@ -593,7 +593,7 @@ public List Entity [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs index 9eae64631..0153959ef 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs @@ -325,7 +325,7 @@ public string? Definition [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -426,7 +426,7 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get => _EnableWhen ?? new List(); + get => _EnableWhen ??= []; set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } @@ -610,7 +610,7 @@ public string? AnswerValueSet [DataMember] public List AnswerOption { - get => _AnswerOption ?? new List(); + get => _AnswerOption ??= []; set { _AnswerOption = value; OnPropertyChanged("AnswerOption"); } } @@ -624,7 +624,7 @@ public List AnswerOption [DataMember] public List Initial { - get => _Initial ?? new List(); + get => _Initial ??= []; set { _Initial = value; OnPropertyChanged("Initial"); } } @@ -638,7 +638,7 @@ public List Initial [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -1279,7 +1279,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1377,7 +1377,7 @@ public string? Title [DataMember] public List DerivedFromElement { - get => _DerivedFromElement ?? new List(); + get => _DerivedFromElement ??= []; set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } @@ -1470,7 +1470,7 @@ public bool? Experimental [DataMember] public List> SubjectTypeElement { - get => _SubjectTypeElement ?? new List>(); + get => _SubjectTypeElement ??= []; set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } @@ -1558,7 +1558,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1600,7 +1600,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1615,7 +1615,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1755,7 +1755,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -1769,7 +1769,7 @@ public List Code [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs index 567e90946..fe8d2897e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs @@ -213,7 +213,7 @@ public string? Text [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -227,7 +227,7 @@ public List Answer [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -372,7 +372,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -471,7 +471,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -487,7 +487,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -648,7 +648,7 @@ public Hl7.Fhir.Model.ResourceReference? Source [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs index fa1a4f7ac..f355be305 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs @@ -199,7 +199,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -258,7 +258,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } @@ -272,7 +272,7 @@ public List Relationship [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -286,7 +286,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -358,7 +358,7 @@ public string? BirthDate [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -372,7 +372,7 @@ public List Address [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -399,7 +399,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs index 2fbc15656..544ee882a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs @@ -228,7 +228,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -242,7 +242,7 @@ public List Code [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -256,7 +256,7 @@ public List Documentation [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -270,7 +270,7 @@ public List Condition [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -301,7 +301,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -494,7 +494,7 @@ public Hl7.Fhir.Model.ResourceReference? Resource [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1032,7 +1032,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1046,7 +1046,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1078,7 +1078,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1112,7 +1112,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1128,7 +1128,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -1333,7 +1333,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1349,7 +1349,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1363,7 +1363,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1377,7 +1377,7 @@ public List Note [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs index 9fbe9cf5a..47b4f7f6a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -384,7 +384,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -426,7 +426,7 @@ public string? Description [DataMember] public List CommentElement { - get => _CommentElement ?? new List(); + get => _CommentElement ??= []; set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } @@ -458,7 +458,7 @@ public IEnumerable? Comment [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -473,7 +473,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -641,7 +641,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -655,7 +655,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -669,7 +669,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -683,7 +683,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -697,7 +697,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -711,7 +711,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -725,7 +725,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs index bdbf8b635..67a4c2f2c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs @@ -132,7 +132,7 @@ public Hl7.Fhir.Model.DataType? Definition [DataMember] public List UsageContext { - get => _UsageContext ?? new List(); + get => _UsageContext ??= []; set { _UsageContext = value; OnPropertyChanged("UsageContext"); } } @@ -548,7 +548,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -834,7 +834,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -876,7 +876,7 @@ public string? Description [DataMember] public List CommentElement { - get => _CommentElement ?? new List(); + get => _CommentElement ??= []; set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } @@ -908,7 +908,7 @@ public IEnumerable? Comment [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -923,7 +923,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1091,7 +1091,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1105,7 +1105,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1119,7 +1119,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1133,7 +1133,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1147,7 +1147,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1161,7 +1161,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1175,7 +1175,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -1268,7 +1268,7 @@ public Hl7.Fhir.Model.VariableTypeCode? VariableType [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs index 17e9044e8..20699689f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs @@ -440,7 +440,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -484,7 +484,7 @@ public string? Title [DataMember] public List Protocol { - get => _Protocol ?? new List(); + get => _Protocol ??= []; set { _Protocol = value; OnPropertyChanged("Protocol"); } } @@ -500,7 +500,7 @@ public List Protocol [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -574,7 +574,7 @@ public Hl7.Fhir.Model.CodeableConcept? Phase [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -589,7 +589,7 @@ public List Category [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -604,7 +604,7 @@ public List Focus [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -618,7 +618,7 @@ public List Condition [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -632,7 +632,7 @@ public List Contact [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -647,7 +647,7 @@ public List RelatedArtifact [DataMember] public List Keyword { - get => _Keyword ?? new List(); + get => _Keyword ??= []; set { _Keyword = value; OnPropertyChanged("Keyword"); } } @@ -662,7 +662,7 @@ public List Keyword [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -706,7 +706,7 @@ public string? Description [DataMember] public List Enrollment { - get => _Enrollment ?? new List(); + get => _Enrollment ??= []; set { _Enrollment = value; OnPropertyChanged("Enrollment"); } } @@ -765,7 +765,7 @@ public Hl7.Fhir.Model.ResourceReference? PrincipalInvestigator [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -793,7 +793,7 @@ public Hl7.Fhir.Model.CodeableConcept? ReasonStopped [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -807,7 +807,7 @@ public List Note [DataMember] public List Arm { - get => _Arm ?? new List(); + get => _Arm ??= []; set { _Arm = value; OnPropertyChanged("Arm"); } } @@ -821,7 +821,7 @@ public List Arm [DataMember] public List Objective { - get => _Objective ?? new List(); + get => _Objective ??= []; set { _Objective = value; OnPropertyChanged("Objective"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs index 87a276b84..64fdc5ffd 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs @@ -159,7 +159,7 @@ public enum ResearchSubjectStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs index cb25add02..7356e2793 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs @@ -307,7 +307,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -485,7 +485,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -501,7 +501,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -517,7 +517,7 @@ public List ReasonReference [DataMember] public List Basis { - get => _Basis ?? new List(); + get => _Basis ??= []; set { _Basis = value; OnPropertyChanged("Basis"); } } @@ -531,7 +531,7 @@ public List Basis [DataMember] public List Prediction { - get => _Prediction ?? new List(); + get => _Prediction ??= []; set { _Prediction = value; OnPropertyChanged("Prediction"); } } @@ -573,7 +573,7 @@ public string? Mitigation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs b/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs index b14ba2bdc..0e7d5febf 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs @@ -405,7 +405,7 @@ public int? NumeratorCount [DataMember] public List PrecisionEstimate { - get => _PrecisionEstimate ?? new List(); + get => _PrecisionEstimate ??= []; set { _PrecisionEstimate = value; OnPropertyChanged("PrecisionEstimate"); } } @@ -753,7 +753,7 @@ public partial class CertaintyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Rating { - get => _Rating ?? new List(); + get => _Rating ??= []; set { _Rating = value; OnPropertyChanged("Rating"); } } @@ -767,7 +767,7 @@ public List Rating [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -781,7 +781,7 @@ public List Note [DataMember] public List CertaintySubcomponent { - get => _CertaintySubcomponent ?? new List(); + get => _CertaintySubcomponent ??= []; set { _CertaintySubcomponent = value; OnPropertyChanged("CertaintySubcomponent"); } } @@ -905,7 +905,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Rating { - get => _Rating ?? new List(); + get => _Rating ??= []; set { _Rating = value; OnPropertyChanged("Rating"); } } @@ -919,7 +919,7 @@ public List Rating [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1040,7 +1040,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1225,7 +1225,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1267,7 +1267,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1281,7 +1281,7 @@ public List Note [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1296,7 +1296,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1408,7 +1408,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1422,7 +1422,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1436,7 +1436,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1450,7 +1450,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1464,7 +1464,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1478,7 +1478,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1593,7 +1593,7 @@ public Hl7.Fhir.Model.RiskEvidenceSynthesis.RiskEstimateComponent? RiskEstimate [DataMember] public List Certainty { - get => _Certainty ?? new List(); + get => _Certainty ??= []; set { _Certainty = value; OnPropertyChanged("Certainty"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs index e28394979..d741294ae 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs @@ -67,7 +67,7 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -110,7 +110,7 @@ public bool? Active [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -125,7 +125,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -140,7 +140,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -156,7 +156,7 @@ public List Specialty [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs index 88a5b3994..68cf933a7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs @@ -630,7 +630,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -673,7 +673,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -688,7 +688,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -761,7 +761,7 @@ public string? Code [DataMember] public List> BaseElement { - get => _BaseElement ?? new List>(); + get => _BaseElement ??= []; set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } @@ -912,7 +912,7 @@ public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage [DataMember] public List> TargetElement { - get => _TargetElement ?? new List>(); + get => _TargetElement ??= []; set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } @@ -1002,7 +1002,7 @@ public bool? MultipleAnd [DataMember] public List> ComparatorElement { - get => _ComparatorElement ?? new List>(); + get => _ComparatorElement ??= []; set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } @@ -1036,7 +1036,7 @@ public IEnumerable? Comparator [DataMember] public List> ModifierElement { - get => _ModifierElement ?? new List>(); + get => _ModifierElement ??= []; set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } @@ -1068,7 +1068,7 @@ public IEnumerable? Modifier [DataMember] public List ChainElement { - get => _ChainElement ?? new List(); + get => _ChainElement ??= []; set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } @@ -1100,7 +1100,7 @@ public IEnumerable? Chain [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs index d15d1ab10..7ee8df037 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs @@ -70,7 +70,7 @@ public partial class ServiceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiab [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -84,7 +84,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -116,7 +116,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -150,7 +150,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -166,7 +166,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -256,7 +256,7 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -343,7 +343,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List OrderDetail { - get => _OrderDetail ?? new List(); + get => _OrderDetail ??= []; set { _OrderDetail = value; OnPropertyChanged("OrderDetail"); } } @@ -493,7 +493,7 @@ public Hl7.Fhir.Model.CodeableConcept? PerformerType [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -508,7 +508,7 @@ public List Performer [DataMember] public List LocationCode { - get => _LocationCode ?? new List(); + get => _LocationCode ??= []; set { _LocationCode = value; OnPropertyChanged("LocationCode"); } } @@ -524,7 +524,7 @@ public List LocationCode [DataMember] public List LocationReference { - get => _LocationReference ?? new List(); + get => _LocationReference ??= []; set { _LocationReference = value; OnPropertyChanged("LocationReference"); } } @@ -539,7 +539,7 @@ public List LocationReference [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -555,7 +555,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -571,7 +571,7 @@ public List ReasonReference [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -587,7 +587,7 @@ public List Insurance [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -603,7 +603,7 @@ public List SupportingInfo [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -618,7 +618,7 @@ public List Specimen [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -632,7 +632,7 @@ public List BodySite [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -676,7 +676,7 @@ public string? PatientInstruction [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Slot.cs b/src/Hl7.Fhir.R4/Model/Generated/Slot.cs index 4dc435a0a..29e4525e6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Slot.cs @@ -107,7 +107,7 @@ public enum SlotStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -122,7 +122,7 @@ public List Identifier [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -137,7 +137,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -152,7 +152,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs index 3c25a8243..f1c0cb6e5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs @@ -395,7 +395,7 @@ public Hl7.Fhir.Model.CodeableConcept? Procedure [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -528,7 +528,7 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -733,7 +733,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -849,7 +849,7 @@ public string? ReceivedTime [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -865,7 +865,7 @@ public List Parent [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -892,7 +892,7 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection [DataMember] public List Processing { - get => _Processing ?? new List(); + get => _Processing ??= []; set { _Processing = value; OnPropertyChanged("Processing"); } } @@ -906,7 +906,7 @@ public List Processing [DataMember] public List Container { - get => _Container ?? new List(); + get => _Container ??= []; set { _Container = value; OnPropertyChanged("Container"); } } @@ -921,7 +921,7 @@ public List Container [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -935,7 +935,7 @@ public List Condition [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs index 36c06c6a3..1479a1c31 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs @@ -236,7 +236,7 @@ public Hl7.Fhir.Model.Duration? RetentionTime [DataMember] public List RejectionCriterion { - get => _RejectionCriterion ?? new List(); + get => _RejectionCriterion ??= []; set { _RejectionCriterion = value; OnPropertyChanged("RejectionCriterion"); } } @@ -250,7 +250,7 @@ public List RejectionCriterion [DataMember] public List Handling { - get => _Handling ?? new List(); + get => _Handling ??= []; set { _Handling = value; OnPropertyChanged("Handling"); } } @@ -499,7 +499,7 @@ public Hl7.Fhir.Model.DataType? MinimumVolume [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -960,7 +960,7 @@ public Hl7.Fhir.Model.CodeableConcept? TypeCollected [DataMember] public List PatientPreparation { - get => _PatientPreparation ?? new List(); + get => _PatientPreparation ??= []; set { _PatientPreparation = value; OnPropertyChanged("PatientPreparation"); } } @@ -1003,7 +1003,7 @@ public string? TimeAspect [DataMember] public List Collection { - get => _Collection ?? new List(); + get => _Collection ??= []; set { _Collection = value; OnPropertyChanged("Collection"); } } @@ -1017,7 +1017,7 @@ public List Collection [DataMember] public List TypeTested { - get => _TypeTested ?? new List(); + get => _TypeTested ??= []; set { _TypeTested = value; OnPropertyChanged("TypeTested"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs index 851bf3e96..5329a9f79 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs @@ -712,7 +712,7 @@ public string? Documentation [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -726,7 +726,7 @@ public List Input [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1109,7 +1109,7 @@ public string? Name [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1123,7 +1123,7 @@ public List Source [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -1137,7 +1137,7 @@ public List Target [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1151,7 +1151,7 @@ public List Rule [DataMember] public List Dependent { - get => _Dependent ?? new List(); + get => _Dependent ??= []; set { _Dependent = value; OnPropertyChanged("Dependent"); } } @@ -1890,7 +1890,7 @@ public string? Variable [DataMember] public List> ListModeElement { - get => _ListModeElement ?? new List>(); + get => _ListModeElement ??= []; set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } @@ -1980,7 +1980,7 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2250,7 +2250,7 @@ public string? Name [DataMember] public List VariableElement { - get => _VariableElement ?? new List(); + get => _VariableElement ??= []; set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } @@ -2381,7 +2381,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2595,7 +2595,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2637,7 +2637,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2652,7 +2652,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2722,7 +2722,7 @@ public string? Copyright [DataMember] public List Structure { - get => _Structure ?? new List(); + get => _Structure ??= []; set { _Structure = value; OnPropertyChanged("Structure"); } } @@ -2736,7 +2736,7 @@ public List Structure [DataMember] public List ImportElement { - get => _ImportElement ?? new List(); + get => _ImportElement ??= []; set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } @@ -2768,7 +2768,7 @@ public IEnumerable? Import [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs index cf161543e..3110b8c93 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs @@ -248,7 +248,7 @@ public string? Payload [DataMember] public List HeaderElement { - get => _HeaderElement ?? new List(); + get => _HeaderElement ??= []; set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } @@ -399,7 +399,7 @@ public Hl7.Fhir.Model.Subscription.SubscriptionStatus? Status [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Substance.cs b/src/Hl7.Fhir.R4/Model/Generated/Substance.cs index 32414b5ea..b0e1e6f4c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Substance.cs @@ -361,7 +361,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -406,7 +406,7 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -463,7 +463,7 @@ public string? Description [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -477,7 +477,7 @@ public List Instance [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs index 8b82e61aa..0296dc6a3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs @@ -203,7 +203,7 @@ public Hl7.Fhir.Model.CodeableConcept? ThreePrime [DataMember] public List Linkage { - get => _Linkage ?? new List(); + get => _Linkage ??= []; set { _Linkage = value; OnPropertyChanged("Linkage"); } } @@ -217,7 +217,7 @@ public List Linkage [DataMember] public List Sugar { - get => _Sugar ?? new List(); + get => _Sugar ??= []; set { _Sugar = value; OnPropertyChanged("Sugar"); } } @@ -796,7 +796,7 @@ public Hl7.Fhir.Model.CodeableConcept? OligoNucleotideType [DataMember] public List Subunit { - get => _Subunit ?? new List(); + get => _Subunit ??= []; set { _Subunit = value; OnPropertyChanged("Subunit"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs index 8cfd93eea..45275fece 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs @@ -93,7 +93,7 @@ public Hl7.Fhir.Model.CodeableConcept? RatioType [DataMember] public List StartingMaterial { - get => _StartingMaterial ?? new List(); + get => _StartingMaterial ??= []; set { _StartingMaterial = value; OnPropertyChanged("StartingMaterial"); } } @@ -427,7 +427,7 @@ public Hl7.Fhir.Model.CodeableConcept? RepeatUnitAmountType [DataMember] public List RepeatUnit { - get => _RepeatUnit ?? new List(); + get => _RepeatUnit ??= []; set { _RepeatUnit = value; OnPropertyChanged("RepeatUnit"); } } @@ -596,7 +596,7 @@ public Hl7.Fhir.Model.SubstanceAmount? Amount [DataMember] public List DegreeOfPolymerisation { - get => _DegreeOfPolymerisation ?? new List(); + get => _DegreeOfPolymerisation ??= []; set { _DegreeOfPolymerisation = value; OnPropertyChanged("DegreeOfPolymerisation"); } } @@ -610,7 +610,7 @@ public List Deg [DataMember] public List StructuralRepresentation { - get => _StructuralRepresentation ?? new List(); + get => _StructuralRepresentation ??= []; set { _StructuralRepresentation = value; OnPropertyChanged("StructuralRepresentation"); } } @@ -1002,7 +1002,7 @@ public Hl7.Fhir.Model.CodeableConcept? Geometry [DataMember] public List CopolymerConnectivity { - get => _CopolymerConnectivity ?? new List(); + get => _CopolymerConnectivity ??= []; set { _CopolymerConnectivity = value; OnPropertyChanged("CopolymerConnectivity"); } } @@ -1016,7 +1016,7 @@ public List CopolymerConnectivity [DataMember] public List ModificationElement { - get => _ModificationElement ?? new List(); + get => _ModificationElement ??= []; set { _ModificationElement = value; OnPropertyChanged("ModificationElement"); } } @@ -1048,7 +1048,7 @@ public IEnumerable? Modification [DataMember] public List MonomerSet { - get => _MonomerSet ?? new List(); + get => _MonomerSet ??= []; set { _MonomerSet = value; OnPropertyChanged("MonomerSet"); } } @@ -1062,7 +1062,7 @@ public List MonomerSet [DataMember] public List Repeat { - get => _Repeat ?? new List(); + get => _Repeat ??= []; set { _Repeat = value; OnPropertyChanged("Repeat"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs index 980e68129..4fe9d6b1d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs @@ -424,7 +424,7 @@ public int? NumberOfSubunits [DataMember] public List DisulfideLinkageElement { - get => _DisulfideLinkageElement ?? new List(); + get => _DisulfideLinkageElement ??= []; set { _DisulfideLinkageElement = value; OnPropertyChanged("DisulfideLinkageElement"); } } @@ -456,7 +456,7 @@ public IEnumerable? DisulfideLinkage [DataMember] public List Subunit { - get => _Subunit ?? new List(); + get => _Subunit ??= []; set { _Subunit = value; OnPropertyChanged("Subunit"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs index 1e72d987d..02733cc0d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs @@ -108,7 +108,7 @@ public Hl7.Fhir.Model.CodeableConcept? Gene [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -242,7 +242,7 @@ public Hl7.Fhir.Model.Identifier? Element [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -374,7 +374,7 @@ public Hl7.Fhir.Model.CodeableConcept? Classification [DataMember] public List Subtype { - get => _Subtype ?? new List(); + get => _Subtype ??= []; set { _Subtype = value; OnPropertyChanged("Subtype"); } } @@ -390,7 +390,7 @@ public List Subtype [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -600,7 +600,7 @@ public Hl7.Fhir.Model.CodeableConcept? AmountType [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -766,7 +766,7 @@ public string? Comment [DataMember] public List Gene { - get => _Gene ?? new List(); + get => _Gene ??= []; set { _Gene = value; OnPropertyChanged("Gene"); } } @@ -780,7 +780,7 @@ public List Gene [DataMember] public List GeneElement { - get => _GeneElement ?? new List(); + get => _GeneElement ??= []; set { _GeneElement = value; OnPropertyChanged("GeneElement"); } } @@ -794,7 +794,7 @@ public List G [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -808,7 +808,7 @@ public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs index d57fbc4e2..3075fed78 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs @@ -284,7 +284,7 @@ public string? IntraspecificDescription [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1149,7 +1149,7 @@ public string? OrganismName [DataMember] public List ParentSubstanceId { - get => _ParentSubstanceId ?? new List(); + get => _ParentSubstanceId ??= []; set { _ParentSubstanceId = value; OnPropertyChanged("ParentSubstanceId"); } } @@ -1163,7 +1163,7 @@ public List ParentSubstanceId [DataMember] public List ParentSubstanceNameElement { - get => _ParentSubstanceNameElement ?? new List(); + get => _ParentSubstanceNameElement ??= []; set { _ParentSubstanceNameElement = value; OnPropertyChanged("ParentSubstanceNameElement"); } } @@ -1195,7 +1195,7 @@ public IEnumerable? ParentSubstanceName [DataMember] public List CountryOfOrigin { - get => _CountryOfOrigin ?? new List(); + get => _CountryOfOrigin ??= []; set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } @@ -1209,7 +1209,7 @@ public List CountryOfOrigin [DataMember] public List GeographicalLocationElement { - get => _GeographicalLocationElement ?? new List(); + get => _GeographicalLocationElement ??= []; set { _GeographicalLocationElement = value; OnPropertyChanged("GeographicalLocationElement"); } } @@ -1254,7 +1254,7 @@ public Hl7.Fhir.Model.CodeableConcept? DevelopmentStage [DataMember] public List FractionDescription { - get => _FractionDescription ?? new List(); + get => _FractionDescription ??= []; set { _FractionDescription = value; OnPropertyChanged("FractionDescription"); } } @@ -1281,7 +1281,7 @@ public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent? Organism [DataMember] public List PartDescription { - get => _PartDescription ?? new List(); + get => _PartDescription ??= []; set { _PartDescription = value; OnPropertyChanged("PartDescription"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs index cd4a7fa66..08feaf58c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs @@ -608,7 +608,7 @@ public string? MolecularFormulaByMoiety [DataMember] public List Isotope { - get => _Isotope ?? new List(); + get => _Isotope ??= []; set { _Isotope = value; OnPropertyChanged("Isotope"); } } @@ -637,7 +637,7 @@ public Hl7.Fhir.Model.SubstanceSpecification.MolecularWeightComponent? Molecular [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -651,7 +651,7 @@ public List Source [DataMember] public List Representation { - get => _Representation ?? new List(); + get => _Representation ??= []; set { _Representation = value; OnPropertyChanged("Representation"); } } @@ -1338,7 +1338,7 @@ public string? Comment [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1545,7 +1545,7 @@ public bool? Preferred [DataMember] public List Language { - get => _Language ?? new List(); + get => _Language ??= []; set { _Language = value; OnPropertyChanged("Language"); } } @@ -1559,7 +1559,7 @@ public List Language [DataMember] public List Domain { - get => _Domain ?? new List(); + get => _Domain ??= []; set { _Domain = value; OnPropertyChanged("Domain"); } } @@ -1573,7 +1573,7 @@ public List Domain [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1587,7 +1587,7 @@ public List Jurisdiction [DataMember] public List Synonym { - get => _Synonym ?? new List(); + get => _Synonym ??= []; set { _Synonym = value; OnPropertyChanged("Synonym"); } } @@ -1601,7 +1601,7 @@ public List Synonym [DataMember] public List Translation { - get => _Translation ?? new List(); + get => _Translation ??= []; set { _Translation = value; OnPropertyChanged("Translation"); } } @@ -1615,7 +1615,7 @@ public List Translation [DataMember] public List Official { - get => _Official ?? new List(); + get => _Official ??= []; set { _Official = value; OnPropertyChanged("Official"); } } @@ -1631,7 +1631,7 @@ public List Official [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -2055,7 +2055,7 @@ public Hl7.Fhir.Model.CodeableConcept? AmountType [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -2266,7 +2266,7 @@ public string? Description [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -2308,7 +2308,7 @@ public string? Comment [DataMember] public List Moiety { - get => _Moiety ?? new List(); + get => _Moiety ??= []; set { _Moiety = value; OnPropertyChanged("Moiety"); } } @@ -2322,7 +2322,7 @@ public List Moiety [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -2364,7 +2364,7 @@ public Hl7.Fhir.Model.SubstanceSpecification.StructureComponent? Structure [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2378,7 +2378,7 @@ public List Code [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -2392,7 +2392,7 @@ public List Name [DataMember] public List MolecularWeight { - get => _MolecularWeight ?? new List(); + get => _MolecularWeight ??= []; set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } @@ -2406,7 +2406,7 @@ public List Mole [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs index 4f8236b52..29480855c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs @@ -242,7 +242,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -258,7 +258,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -274,7 +274,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -407,7 +407,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs index b4f50224b..290825e30 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs @@ -237,7 +237,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -357,7 +357,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -431,7 +431,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List Supplier { - get => _Supplier ?? new List(); + get => _Supplier ??= []; set { _Supplier = value; OnPropertyChanged("Supplier"); } } @@ -446,7 +446,7 @@ public List Supplier [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -462,7 +462,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Task.cs b/src/Hl7.Fhir.R4/Model/Generated/Task.cs index 19ef8c0ec..55613bc4c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Task.cs @@ -272,7 +272,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -599,7 +599,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -671,7 +671,7 @@ public string? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -700,7 +700,7 @@ public Hl7.Fhir.Model.Identifier? GroupIdentifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1006,7 +1006,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List PerformerType { - get => _PerformerType ?? new List(); + get => _PerformerType ??= []; set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } @@ -1081,7 +1081,7 @@ public Hl7.Fhir.Model.ResourceReference? ReasonReference [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1095,7 +1095,7 @@ public List Insurance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1111,7 +1111,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -1138,7 +1138,7 @@ public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -1152,7 +1152,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs index d167f2c0a..7150c1d08 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs @@ -423,7 +423,7 @@ public string? Uri [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -645,7 +645,7 @@ public bool? Compositional [DataMember] public List LanguageElement { - get => _LanguageElement ?? new List(); + get => _LanguageElement ??= []; set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } @@ -677,7 +677,7 @@ public IEnumerable? Language [DataMember] public List Filter { - get => _Filter ?? new List(); + get => _Filter ??= []; set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -691,7 +691,7 @@ public List Filter [DataMember] public List PropertyElement { - get => _PropertyElement ?? new List(); + get => _PropertyElement ??= []; set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } @@ -871,7 +871,7 @@ public string? Code [DataMember] public List OpElement { - get => _OpElement ?? new List(); + get => _OpElement ??= []; set { _OpElement = value; OnPropertyChanged("OpElement"); } } @@ -1070,7 +1070,7 @@ public bool? Incomplete [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1888,7 +1888,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1930,7 +1930,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1945,7 +1945,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2100,7 +2100,7 @@ public bool? LockedDate [DataMember] public List CodeSystem { - get => _CodeSystem ?? new List(); + get => _CodeSystem ??= []; set { _CodeSystem = value; OnPropertyChanged("CodeSystem"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs index 8b814160a..b18b9490d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs @@ -399,7 +399,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1020,7 +1020,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1242,7 +1242,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1612,7 +1612,7 @@ public string? Issued [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1639,7 +1639,7 @@ public Hl7.Fhir.Model.TestReport.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs index 5d44dd5de..7e5b2dc8f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs @@ -580,7 +580,7 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -594,7 +594,7 @@ public List Link [DataMember] public List Capability { - get => _Capability ?? new List(); + get => _Capability ??= []; set { _Capability = value; OnPropertyChanged("Capability"); } } @@ -924,7 +924,7 @@ public string? Description [DataMember] public List OriginElement { - get => _OriginElement ?? new List(); + get => _OriginElement ??= []; set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } @@ -984,7 +984,7 @@ public int? Destination [DataMember] public List LinkElement { - get => _LinkElement ?? new List(); + get => _LinkElement ??= []; set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } @@ -1707,7 +1707,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -2212,7 +2212,7 @@ public string? Params [DataMember] public List RequestHeader { - get => _RequestHeader ?? new List(); + get => _RequestHeader ??= []; set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } @@ -3680,7 +3680,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -3902,7 +3902,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -4311,7 +4311,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -4353,7 +4353,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -4368,7 +4368,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -4438,7 +4438,7 @@ public string? Copyright [DataMember] public List Origin { - get => _Origin ?? new List(); + get => _Origin ??= []; set { _Origin = value; OnPropertyChanged("Origin"); } } @@ -4452,7 +4452,7 @@ public List Origin [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -4479,7 +4479,7 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata [DataMember] public List Fixture { - get => _Fixture ?? new List(); + get => _Fixture ??= []; set { _Fixture = value; OnPropertyChanged("Fixture"); } } @@ -4495,7 +4495,7 @@ public List Fixture [DataMember] public List Profile { - get => _Profile ?? new List(); + get => _Profile ??= []; set { _Profile = value; OnPropertyChanged("Profile"); } } @@ -4509,7 +4509,7 @@ public List Profile [DataMember] public List Variable { - get => _Variable ?? new List(); + get => _Variable ??= []; set { _Variable = value; OnPropertyChanged("Variable"); } } @@ -4536,7 +4536,7 @@ public Hl7.Fhir.Model.TestScript.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs index 01d8f11bc..293e216ec 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs @@ -611,7 +611,7 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get => _DayOfWeekElement ?? new List>(); + get => _DayOfWeekElement ??= []; set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } @@ -643,7 +643,7 @@ public IEnumerable? DayOfWeek [DataMember] public List TimeOfDayElement { - get => _TimeOfDayElement ?? new List(); + get => _TimeOfDayElement ??= []; set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } @@ -677,7 +677,7 @@ public IEnumerable? TimeOfDay [DataMember] public List> WhenElement { - get => _WhenElement ?? new List>(); + get => _WhenElement ??= []; set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } @@ -924,7 +924,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get => _EventElement ?? new List(); + get => _EventElement ??= []; set { _EventElement = value; OnPropertyChanged("EventElement"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs index 1ea54c12d..1038a37e0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs @@ -204,7 +204,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs index 7306371c4..8c1960d38 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs @@ -142,7 +142,7 @@ public Hl7.Fhir.Model.ResourceReference? Who [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -157,7 +157,7 @@ public List Type [DataMember] public List CommunicationMethod { - get => _CommunicationMethod ?? new List(); + get => _CommunicationMethod ??= []; set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } @@ -228,7 +228,7 @@ public Hl7.Fhir.Model.CodeableConcept? CanPushUpdates [DataMember] public List PushTypeAvailable { - get => _PushTypeAvailable ?? new List(); + get => _PushTypeAvailable ??= []; set { _PushTypeAvailable = value; OnPropertyChanged("PushTypeAvailable"); } } @@ -799,7 +799,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -813,7 +813,7 @@ public List Target [DataMember] public List TargetLocationElement { - get => _TargetLocationElement ?? new List(); + get => _TargetLocationElement ??= []; set { _TargetLocationElement = value; OnPropertyChanged("TargetLocationElement"); } } @@ -933,7 +933,7 @@ public Hl7.Fhir.Model.CodeableConcept? ValidationType [DataMember] public List ValidationProcess { - get => _ValidationProcess ?? new List(); + get => _ValidationProcess ??= []; set { _ValidationProcess = value; OnPropertyChanged("ValidationProcess"); } } @@ -1030,7 +1030,7 @@ public Hl7.Fhir.Model.CodeableConcept? FailureAction [DataMember] public List PrimarySource { - get => _PrimarySource ?? new List(); + get => _PrimarySource ??= []; set { _PrimarySource = value; OnPropertyChanged("PrimarySource"); } } @@ -1057,7 +1057,7 @@ public Hl7.Fhir.Model.VerificationResult.AttestationComponent? Attestation [DataMember] public List Validator { - get => _Validator ?? new List(); + get => _Validator ??= []; set { _Validator = value; OnPropertyChanged("Validator"); } } diff --git a/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs index 7c8278a23..dadfd1fe7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs @@ -272,7 +272,7 @@ public int? Axis [DataMember] public List Prism { - get => _Prism ?? new List(); + get => _Prism ??= []; set { _Prism = value; OnPropertyChanged("Prism"); } } @@ -467,7 +467,7 @@ public string? Brand [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -805,7 +805,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -955,7 +955,7 @@ public Hl7.Fhir.Model.ResourceReference? Prescriber [DataMember] public List LensSpecification { - get => _LensSpecification ?? new List(); + get => _LensSpecification ??= []; set { _LensSpecification = value; OnPropertyChanged("LensSpecification"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Account.cs b/src/Hl7.Fhir.R4B/Model/Generated/Account.cs index 12be095e0..8ca31cd18 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Account.cs @@ -394,7 +394,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -483,7 +483,7 @@ public string? Name [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -510,7 +510,7 @@ public Hl7.Fhir.Model.Period? ServicePeriod [DataMember] public List Coverage { - get => _Coverage ?? new List(); + get => _Coverage ??= []; set { _Coverage = value; OnPropertyChanged("Coverage"); } } @@ -567,7 +567,7 @@ public string? Description [DataMember] public List Guarantor { - get => _Guarantor ?? new List(); + get => _Guarantor ??= []; set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs index 86d177b54..516d37022 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs @@ -459,7 +459,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -717,7 +717,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -759,7 +759,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -774,7 +774,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -942,7 +942,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -956,7 +956,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -970,7 +970,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -984,7 +984,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -998,7 +998,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1012,7 +1012,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1026,7 +1026,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -1248,7 +1248,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1292,7 +1292,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -1307,7 +1307,7 @@ public List Dosage [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -1323,7 +1323,7 @@ public List BodySite [DataMember] public List SpecimenRequirement { - get => _SpecimenRequirement ?? new List(); + get => _SpecimenRequirement ??= []; set { _SpecimenRequirement = value; OnPropertyChanged("SpecimenRequirement"); } } @@ -1339,7 +1339,7 @@ public List SpecimenRequirement [DataMember] public List ObservationRequirement { - get => _ObservationRequirement ?? new List(); + get => _ObservationRequirement ??= []; set { _ObservationRequirement = value; OnPropertyChanged("ObservationRequirement"); } } @@ -1355,7 +1355,7 @@ public List ObservationRequirement [DataMember] public List ObservationResultRequirement { - get => _ObservationResultRequirement ?? new List(); + get => _ObservationResultRequirement ??= []; set { _ObservationResultRequirement = value; OnPropertyChanged("ObservationResultRequirement"); } } @@ -1397,7 +1397,7 @@ public string? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs index e3888ea28..48807ef9f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs @@ -227,7 +227,7 @@ public string? Text [DataMember] public List LineElement { - get => _LineElement ?? new List(); + get => _LineElement ??= []; set { _LineElement = value; OnPropertyChanged("LineElement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs index 1b3f97991..06a6030fc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs @@ -302,7 +302,7 @@ public Hl7.Fhir.Model.Duration? MaxTreatmentPeriod [DataMember] public List TargetSpecies { - get => _TargetSpecies ?? new List(); + get => _TargetSpecies ??= []; set { _TargetSpecies = value; OnPropertyChanged("TargetSpecies"); } } @@ -459,7 +459,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List WithdrawalPeriod { - get => _WithdrawalPeriod ?? new List(); + get => _WithdrawalPeriod ??= []; set { _WithdrawalPeriod = value; OnPropertyChanged("WithdrawalPeriod"); } } @@ -692,7 +692,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -739,7 +739,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List FormOf { - get => _FormOf ?? new List(); + get => _FormOf ??= []; set { _FormOf = value; OnPropertyChanged("FormOf"); } } @@ -783,7 +783,7 @@ public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation [DataMember] public List ProducedFrom { - get => _ProducedFrom ?? new List(); + get => _ProducedFrom ??= []; set { _ProducedFrom = value; OnPropertyChanged("ProducedFrom"); } } @@ -798,7 +798,7 @@ public List ProducedFrom [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -827,7 +827,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -841,7 +841,7 @@ public List Pro [DataMember] public List RouteOfAdministration { - get => _RouteOfAdministration ?? new List(); + get => _RouteOfAdministration ??= []; set { _RouteOfAdministration = value; OnPropertyChanged("RouteOfAdministration"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs index 1fd0e8f83..d284d7976 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs @@ -198,7 +198,7 @@ public Hl7.Fhir.Model.ResourceReference? Instance [DataMember] public List Causality { - get => _Causality ?? new List(); + get => _Causality ??= []; set { _Causality = value; OnPropertyChanged("Causality"); } } @@ -499,7 +499,7 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -644,7 +644,7 @@ public string? RecordedDate [DataMember] public List ResultingCondition { - get => _ResultingCondition ?? new List(); + get => _ResultingCondition ??= []; set { _ResultingCondition = value; OnPropertyChanged("ResultingCondition"); } } @@ -732,7 +732,7 @@ public Hl7.Fhir.Model.ResourceReference? Recorder [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -746,7 +746,7 @@ public List Contributor [DataMember] public List SuspectEntity { - get => _SuspectEntity ?? new List(); + get => _SuspectEntity ??= []; set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } @@ -762,7 +762,7 @@ public List SuspectEntity [DataMember] public List SubjectMedicalHistory { - get => _SubjectMedicalHistory ?? new List(); + get => _SubjectMedicalHistory ??= []; set { _SubjectMedicalHistory = value; OnPropertyChanged("SubjectMedicalHistory"); } } @@ -778,7 +778,7 @@ public List SubjectMedicalHistory [DataMember] public List ReferenceDocument { - get => _ReferenceDocument ?? new List(); + get => _ReferenceDocument ??= []; set { _ReferenceDocument = value; OnPropertyChanged("ReferenceDocument"); } } @@ -794,7 +794,7 @@ public List ReferenceDocument [DataMember] public List Study { - get => _Study ?? new List(); + get => _Study ??= []; set { _Study = value; OnPropertyChanged("Study"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs index 2ae8572e9..ccdaa6064 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs @@ -276,7 +276,7 @@ public Hl7.Fhir.Model.CodeableConcept? Substance [DataMember] public List Manifestation { - get => _Manifestation ?? new List(); + get => _Manifestation ??= []; set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } @@ -390,7 +390,7 @@ public Hl7.Fhir.Model.CodeableConcept? ExposureRoute [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -519,7 +519,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -593,7 +593,7 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type [DataMember] public List> CategoryElement { - get => _CategoryElement ?? new List>(); + get => _CategoryElement ??= []; set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } @@ -801,7 +801,7 @@ public string? LastOccurrence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -815,7 +815,7 @@ public List Note [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs index ce1e1feff..283622637 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs @@ -182,7 +182,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -382,7 +382,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -442,7 +442,7 @@ public Hl7.Fhir.Model.CodeableConcept? CancelationReason [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -457,7 +457,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -472,7 +472,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -501,7 +501,7 @@ public Hl7.Fhir.Model.CodeableConcept? AppointmentType [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -517,7 +517,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -589,7 +589,7 @@ public string? Description [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -689,7 +689,7 @@ public int? MinutesDuration [DataMember] public List Slot { - get => _Slot ?? new List(); + get => _Slot ??= []; set { _Slot = value; OnPropertyChanged("Slot"); } } @@ -789,7 +789,7 @@ public string? PatientInstruction [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -803,7 +803,7 @@ public List BasedOn [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -817,7 +817,7 @@ public List Participant [DataMember] public List RequestedPeriod { - get => _RequestedPeriod ?? new List(); + get => _RequestedPeriod ??= []; set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs index 32e48ef36..e4d1cd6dd 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs @@ -67,7 +67,7 @@ public partial class AppointmentResponse : Hl7.Fhir.Model.DomainResource, IIdent [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -154,7 +154,7 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get => _ParticipantType ?? new List(); + get => _ParticipantType ??= []; set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs index 5d79d5beb..7c58ad234 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs @@ -218,7 +218,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -347,7 +347,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -407,7 +407,7 @@ public Hl7.Fhir.Model.AuditEvent.NetworkComponent? Network [DataMember] public List PurposeOfUse { - get => _PurposeOfUse ?? new List(); + get => _PurposeOfUse ??= []; set { _PurposeOfUse = value; OnPropertyChanged("PurposeOfUse"); } } @@ -778,7 +778,7 @@ public Hl7.Fhir.Model.ResourceReference? Observer [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -946,7 +946,7 @@ public Hl7.Fhir.Model.Coding? Lifecycle [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -1044,7 +1044,7 @@ public byte[]? Query [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -1338,7 +1338,7 @@ public Hl7.Fhir.Model.Coding? Type [DataMember] public List Subtype { - get => _Subtype ?? new List(); + get => _Subtype ??= []; set { _Subtype = value; OnPropertyChanged("Subtype"); } } @@ -1483,7 +1483,7 @@ public string? OutcomeDesc [DataMember] public List PurposeOfEvent { - get => _PurposeOfEvent ?? new List(); + get => _PurposeOfEvent ??= []; set { _PurposeOfEvent = value; OnPropertyChanged("PurposeOfEvent"); } } @@ -1497,7 +1497,7 @@ public List PurposeOfEvent [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -1525,7 +1525,7 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs b/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs index 906578bb1..6068c7f05 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs @@ -70,7 +70,7 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs index 9e615362e..2448f95d2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs @@ -804,7 +804,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -894,7 +894,7 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.BiologicallyDerivedProductStatu [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -938,7 +938,7 @@ public int? Quantity [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -965,7 +965,7 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.CollectionComponent? Collection [DataMember] public List Processing { - get => _Processing ?? new List(); + get => _Processing ??= []; set { _Processing = value; OnPropertyChanged("Processing"); } } @@ -992,7 +992,7 @@ public Hl7.Fhir.Model.BiologicallyDerivedProduct.ManipulationComponent? Manipula [DataMember] public List Storage { - get => _Storage ?? new List(); + get => _Storage ??= []; set { _Storage = value; OnPropertyChanged("Storage"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs index 878e66abe..8521442b2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs @@ -70,7 +70,7 @@ public partial class BodyStructure : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -141,7 +141,7 @@ public Hl7.Fhir.Model.CodeableConcept? Location [DataMember] public List LocationQualifier { - get => _LocationQualifier ?? new List(); + get => _LocationQualifier ??= []; set { _LocationQualifier = value; OnPropertyChanged("LocationQualifier"); } } @@ -183,7 +183,7 @@ public string? Description [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs index 2a6ad9510..bb15792b8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs @@ -243,7 +243,7 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List OutcomeCodeableConcept { - get => _OutcomeCodeableConcept ?? new List(); + get => _OutcomeCodeableConcept ??= []; set { _OutcomeCodeableConcept = value; OnPropertyChanged("OutcomeCodeableConcept"); } } @@ -259,7 +259,7 @@ public List OutcomeCodeableConcept [DataMember] public List OutcomeReference { - get => _OutcomeReference ?? new List(); + get => _OutcomeReference ??= []; set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } @@ -273,7 +273,7 @@ public List OutcomeReference [DataMember] public List Progress { - get => _Progress ?? new List(); + get => _Progress ??= []; set { _Progress = value; OnPropertyChanged("Progress"); } } @@ -458,7 +458,7 @@ public Hl7.Fhir.Model.CarePlan.CarePlanActivityKind? Kind [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -490,7 +490,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -553,7 +553,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -569,7 +569,7 @@ public List ReasonReference [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -687,7 +687,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -977,7 +977,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -991,7 +991,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1023,7 +1023,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1057,7 +1057,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1073,7 +1073,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -1089,7 +1089,7 @@ public List Replaces [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1166,7 +1166,7 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1325,7 +1325,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -1341,7 +1341,7 @@ public List Contributor [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -1357,7 +1357,7 @@ public List CareTeam [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -1373,7 +1373,7 @@ public List Addresses [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -1389,7 +1389,7 @@ public List SupportingInfo [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -1403,7 +1403,7 @@ public List Goal [DataMember] public List Activity { - get => _Activity ?? new List(); + get => _Activity ??= []; set { _Activity = value; OnPropertyChanged("Activity"); } } @@ -1417,7 +1417,7 @@ public List Activity [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs index 03b33790a..128ca4470 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs @@ -127,7 +127,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -272,7 +272,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -317,7 +317,7 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -402,7 +402,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -417,7 +417,7 @@ public List Participant [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -433,7 +433,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -449,7 +449,7 @@ public List ReasonReference [DataMember] public List ManagingOrganization { - get => _ManagingOrganization ?? new List(); + get => _ManagingOrganization ??= []; set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } @@ -463,7 +463,7 @@ public List ManagingOrganization [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -477,7 +477,7 @@ public List Telecom [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs b/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs index 39c07b2d9..7eab917c4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs @@ -225,7 +225,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -297,7 +297,7 @@ public Hl7.Fhir.Model.ResourceReference? ReferencedItem [DataMember] public List AdditionalIdentifier { - get => _AdditionalIdentifier ?? new List(); + get => _AdditionalIdentifier ??= []; set { _AdditionalIdentifier = value; OnPropertyChanged("AdditionalIdentifier"); } } @@ -311,7 +311,7 @@ public List AdditionalIdentifier [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -424,7 +424,7 @@ public string? LastUpdated [DataMember] public List AdditionalCharacteristic { - get => _AdditionalCharacteristic ?? new List(); + get => _AdditionalCharacteristic ??= []; set { _AdditionalCharacteristic = value; OnPropertyChanged("AdditionalCharacteristic"); } } @@ -438,7 +438,7 @@ public List AdditionalCharacteristic [DataMember] public List AdditionalClassification { - get => _AdditionalClassification ?? new List(); + get => _AdditionalClassification ??= []; set { _AdditionalClassification = value; OnPropertyChanged("AdditionalClassification"); } } @@ -452,7 +452,7 @@ public List AdditionalClassification [DataMember] public List RelatedEntry { - get => _RelatedEntry ?? new List(); + get => _RelatedEntry ??= []; set { _RelatedEntry = value; OnPropertyChanged("RelatedEntry"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs index 42f1b6ae1..0bf034afc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs @@ -238,7 +238,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -252,7 +252,7 @@ public List Identifier [DataMember] public List DefinitionUriElement { - get => _DefinitionUriElement ?? new List(); + get => _DefinitionUriElement ??= []; set { _DefinitionUriElement = value; OnPropertyChanged("DefinitionUriElement"); } } @@ -284,7 +284,7 @@ public IEnumerable? DefinitionUri [DataMember] public List DefinitionCanonicalElement { - get => _DefinitionCanonicalElement ?? new List(); + get => _DefinitionCanonicalElement ??= []; set { _DefinitionCanonicalElement = value; OnPropertyChanged("DefinitionCanonicalElement"); } } @@ -349,7 +349,7 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -424,7 +424,7 @@ public Hl7.Fhir.Model.DataType? Occurrence [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -497,7 +497,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Bodysite { - get => _Bodysite ?? new List(); + get => _Bodysite ??= []; set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } @@ -624,7 +624,7 @@ public string? EnteredDate [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -640,7 +640,7 @@ public List Reason [DataMember] public List Service { - get => _Service ?? new List(); + get => _Service ??= []; set { _Service = value; OnPropertyChanged("Service"); } } @@ -673,7 +673,7 @@ public Hl7.Fhir.Model.DataType? Product [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -687,7 +687,7 @@ public List Account [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -703,7 +703,7 @@ public List Note [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs index e3dfd001a..5458d3fa3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs @@ -266,7 +266,7 @@ public partial class PropertyGroupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Applicability { - get => _Applicability ?? new List(); + get => _Applicability ??= []; set { _Applicability = value; OnPropertyChanged("Applicability"); } } @@ -280,7 +280,7 @@ public List Applicab [DataMember] public List PriceComponent { - get => _PriceComponent ?? new List(); + get => _PriceComponent ??= []; set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } @@ -582,7 +582,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -652,7 +652,7 @@ public string? Title [DataMember] public List DerivedFromUriElement { - get => _DerivedFromUriElement ?? new List(); + get => _DerivedFromUriElement ??= []; set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } @@ -684,7 +684,7 @@ public IEnumerable? DerivedFromUri [DataMember] public List PartOfElement { - get => _PartOfElement ?? new List(); + get => _PartOfElement ??= []; set { _PartOfElement = value; OnPropertyChanged("PartOfElement"); } } @@ -716,7 +716,7 @@ public IEnumerable? PartOf [DataMember] public List ReplacesElement { - get => _ReplacesElement ?? new List(); + get => _ReplacesElement ??= []; set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } @@ -863,7 +863,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -905,7 +905,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -920,7 +920,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1047,7 +1047,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -1061,7 +1061,7 @@ public List Instance [DataMember] public List Applicability { - get => _Applicability ?? new List(); + get => _Applicability ??= []; set { _Applicability = value; OnPropertyChanged("Applicability"); } } @@ -1075,7 +1075,7 @@ public List Applicab [DataMember] public List PropertyGroup { - get => _PropertyGroup ?? new List(); + get => _PropertyGroup ??= []; set { _PropertyGroup = value; OnPropertyChanged("PropertyGroup"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs index 0a1709efd..0662d59d6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs @@ -224,7 +224,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -486,7 +486,7 @@ public Hl7.Fhir.Model.CodeableConcept? RelationshipType [DataMember] public List TargetClassifier { - get => _TargetClassifier ?? new List(); + get => _TargetClassifier ??= []; set { _TargetClassifier = value; OnPropertyChanged("TargetClassifier"); } } @@ -609,7 +609,7 @@ public partial class CitedArtifactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -623,7 +623,7 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get => _RelatedIdentifier ?? new List(); + get => _RelatedIdentifier ??= []; set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } @@ -679,7 +679,7 @@ public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent? Version [DataMember] public List CurrentState { - get => _CurrentState ?? new List(); + get => _CurrentState ??= []; set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } @@ -693,7 +693,7 @@ public List CurrentState [DataMember] public List StatusDate { - get => _StatusDate ?? new List(); + get => _StatusDate ??= []; set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } @@ -707,7 +707,7 @@ public List StatusDate [DataMember] public List Title { - get => _Title ?? new List(); + get => _Title ??= []; set { _Title = value; OnPropertyChanged("Title"); } } @@ -721,7 +721,7 @@ public List Title [DataMember] public List Abstract { - get => _Abstract ?? new List(); + get => _Abstract ??= []; set { _Abstract = value; OnPropertyChanged("Abstract"); } } @@ -748,7 +748,7 @@ public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent? Part [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -762,7 +762,7 @@ public List RelatesTo [DataMember] public List PublicationForm { - get => _PublicationForm ?? new List(); + get => _PublicationForm ??= []; set { _PublicationForm = value; OnPropertyChanged("PublicationForm"); } } @@ -776,7 +776,7 @@ public List Publi [DataMember] public List WebLocation { - get => _WebLocation ?? new List(); + get => _WebLocation ??= []; set { _WebLocation = value; OnPropertyChanged("WebLocation"); } } @@ -790,7 +790,7 @@ public List WebLocati [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -817,7 +817,7 @@ public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent? Contributo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1308,7 +1308,7 @@ public partial class CitedArtifactTitleComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1808,7 +1808,7 @@ public Hl7.Fhir.Model.CodeableConcept? RelationshipType [DataMember] public List TargetClassifier { - get => _TargetClassifier ?? new List(); + get => _TargetClassifier ??= []; set { _TargetClassifier = value; OnPropertyChanged("TargetClassifier"); } } @@ -2017,7 +2017,7 @@ public string? LastRevisionDate [DataMember] public List Language { - get => _Language ?? new List(); + get => _Language ??= []; set { _Language = value; OnPropertyChanged("Language"); } } @@ -2377,7 +2377,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3183,7 +3183,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -3544,7 +3544,7 @@ public bool? Complete [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } @@ -3558,7 +3558,7 @@ public List [DataMember] public List Summary { - get => _Summary ?? new List(); + get => _Summary ??= []; set { _Summary = value; OnPropertyChanged("Summary"); } } @@ -3737,7 +3737,7 @@ public string? CollectiveName [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3751,7 +3751,7 @@ public List Identifier [DataMember] public List AffiliationInfo { - get => _AffiliationInfo ?? new List(); + get => _AffiliationInfo ??= []; set { _AffiliationInfo = value; OnPropertyChanged("AffiliationInfo"); } } @@ -3765,7 +3765,7 @@ public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -3779,7 +3779,7 @@ public List Address [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -3794,7 +3794,7 @@ public List Telecom [DataMember] public List ContributionType { - get => _ContributionType ?? new List(); + get => _ContributionType ??= []; set { _ContributionType = value; OnPropertyChanged("ContributionType"); } } @@ -3822,7 +3822,7 @@ public Hl7.Fhir.Model.CodeableConcept? Role [DataMember] public List ContributionInstance { - get => _ContributionInstance ?? new List(); + get => _ContributionInstance ??= []; set { _ContributionInstance = value; OnPropertyChanged("ContributionInstance"); } } @@ -4124,7 +4124,7 @@ public string? Role [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4543,7 +4543,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4756,7 +4756,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -4798,7 +4798,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -4813,7 +4813,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -4952,7 +4952,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -4966,7 +4966,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -4980,7 +4980,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -4994,7 +4994,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -5008,7 +5008,7 @@ public List Endorser [DataMember] public List Summary { - get => _Summary ?? new List(); + get => _Summary ??= []; set { _Summary = value; OnPropertyChanged("Summary"); } } @@ -5022,7 +5022,7 @@ public List Summary [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -5036,7 +5036,7 @@ public List Classification [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -5051,7 +5051,7 @@ public List Note [DataMember] public List CurrentState { - get => _CurrentState ?? new List(); + get => _CurrentState ??= []; set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } @@ -5065,7 +5065,7 @@ public List CurrentState [DataMember] public List StatusDate { - get => _StatusDate ?? new List(); + get => _StatusDate ??= []; set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } @@ -5079,7 +5079,7 @@ public List StatusDate [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs index 45d0d325d..28c627e73 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs @@ -830,7 +830,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1015,7 +1015,7 @@ public int? Sequence [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1077,7 +1077,7 @@ public Hl7.Fhir.Model.DataType? Procedure [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1320,7 +1320,7 @@ public string? BusinessArrangement [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1681,7 +1681,7 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get => _CareTeamSequenceElement ?? new List(); + get => _CareTeamSequenceElement ??= []; set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } @@ -1713,7 +1713,7 @@ public IEnumerable? CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get => _DiagnosisSequenceElement ?? new List(); + get => _DiagnosisSequenceElement ??= []; set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } @@ -1745,7 +1745,7 @@ public IEnumerable? DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get => _ProcedureSequenceElement ?? new List(); + get => _ProcedureSequenceElement ??= []; set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } @@ -1777,7 +1777,7 @@ public IEnumerable? ProcedureSequence [DataMember] public List InformationSequenceElement { - get => _InformationSequenceElement ?? new List(); + get => _InformationSequenceElement ??= []; set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } @@ -1853,7 +1853,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1868,7 +1868,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1983,7 +1983,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2012,7 +2012,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -2028,7 +2028,7 @@ public List SubSite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -2042,7 +2042,7 @@ public List Encounter [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2386,7 +2386,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2401,7 +2401,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2484,7 +2484,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2498,7 +2498,7 @@ public List Udi [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -2761,7 +2761,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2776,7 +2776,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2859,7 +2859,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3024,7 +3024,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3262,7 +3262,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundsReserve [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -3349,7 +3349,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -3363,7 +3363,7 @@ public List CareTeam [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -3377,7 +3377,7 @@ public List SupportingInfo [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -3391,7 +3391,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -3405,7 +3405,7 @@ public List Procedure [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -3432,7 +3432,7 @@ public Hl7.Fhir.Model.Claim.AccidentComponent? Accident [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs index 31cf35729..b4f1a87c8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs @@ -115,7 +115,7 @@ public int? ItemSequence [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -147,7 +147,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -161,7 +161,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -482,7 +482,7 @@ public int? DetailSequence [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -514,7 +514,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -528,7 +528,7 @@ public List Adjudication [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -675,7 +675,7 @@ public int? SubDetailSequence [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -707,7 +707,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -816,7 +816,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get => _ItemSequenceElement ?? new List(); + get => _ItemSequenceElement ??= []; set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } @@ -848,7 +848,7 @@ public IEnumerable? ItemSequence [DataMember] public List DetailSequenceElement { - get => _DetailSequenceElement ?? new List(); + get => _DetailSequenceElement ??= []; set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } @@ -880,7 +880,7 @@ public IEnumerable? DetailSequence [DataMember] public List SubdetailSequenceElement { - get => _SubdetailSequenceElement ?? new List(); + get => _SubdetailSequenceElement ??= []; set { _SubdetailSequenceElement = value; OnPropertyChanged("SubdetailSequenceElement"); } } @@ -914,7 +914,7 @@ public IEnumerable? SubdetailSequence [DataMember] public List Provider { - get => _Provider ?? new List(); + get => _Provider ??= []; set { _Provider = value; OnPropertyChanged("Provider"); } } @@ -944,7 +944,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -959,7 +959,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1087,7 +1087,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -1101,7 +1101,7 @@ public List SubSite [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1133,7 +1133,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1147,7 +1147,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -1407,7 +1407,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1488,7 +1488,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1520,7 +1520,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1534,7 +1534,7 @@ public List Adjudication [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -1713,7 +1713,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1794,7 +1794,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1826,7 +1826,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2939,7 +2939,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3249,7 +3249,7 @@ public Hl7.Fhir.Model.CodeableConcept? PayeeType [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -3263,7 +3263,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -3277,7 +3277,7 @@ public List AddItem [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3291,7 +3291,7 @@ public List Adjudication [DataMember] public List Total { - get => _Total ?? new List(); + get => _Total ??= []; set { _Total = value; OnPropertyChanged("Total"); } } @@ -3359,7 +3359,7 @@ public Hl7.Fhir.Model.Attachment? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -3375,7 +3375,7 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get => _CommunicationRequest ?? new List(); + get => _CommunicationRequest ??= []; set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } @@ -3389,7 +3389,7 @@ public List CommunicationRequest [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -3403,7 +3403,7 @@ public List Insurance [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs index 6cff37b67..2ce53505e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs @@ -131,7 +131,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -367,7 +367,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -574,7 +574,7 @@ public Hl7.Fhir.Model.ResourceReference? Previous [DataMember] public List Problem { - get => _Problem ?? new List(); + get => _Problem ??= []; set { _Problem = value; OnPropertyChanged("Problem"); } } @@ -588,7 +588,7 @@ public List Problem [DataMember] public List Investigation { - get => _Investigation ?? new List(); + get => _Investigation ??= []; set { _Investigation = value; OnPropertyChanged("Investigation"); } } @@ -602,7 +602,7 @@ public List Investigat [DataMember] public List ProtocolElement { - get => _ProtocolElement ?? new List(); + get => _ProtocolElement ??= []; set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } @@ -662,7 +662,7 @@ public string? Summary [DataMember] public List Finding { - get => _Finding ?? new List(); + get => _Finding ??= []; set { _Finding = value; OnPropertyChanged("Finding"); } } @@ -677,7 +677,7 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get => _PrognosisCodeableConcept ?? new List(); + get => _PrognosisCodeableConcept ??= []; set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } @@ -693,7 +693,7 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get => _PrognosisReference ?? new List(); + get => _PrognosisReference ??= []; set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } @@ -709,7 +709,7 @@ public List PrognosisReference [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -723,7 +723,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs index e80998634..2a833a13c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs @@ -149,7 +149,7 @@ public Hl7.Fhir.Model.CodeableReference? DiseaseStatus [DataMember] public List Comorbidity { - get => _Comorbidity ?? new List(); + get => _Comorbidity ??= []; set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } @@ -165,7 +165,7 @@ public List Comorbidity [DataMember] public List Indication { - get => _Indication ?? new List(); + get => _Indication ??= []; set { _Indication = value; OnPropertyChanged("Indication"); } } @@ -179,7 +179,7 @@ public List Indication [DataMember] public List OtherTherapy { - get => _OtherTherapy ?? new List(); + get => _OtherTherapy ??= []; set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } @@ -448,7 +448,7 @@ public Hl7.Fhir.Model.CodeableReference? DiseaseStatus [DataMember] public List Comorbidity { - get => _Comorbidity ?? new List(); + get => _Comorbidity ??= []; set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } @@ -493,7 +493,7 @@ public Hl7.Fhir.Model.DataType? Duration [DataMember] public List UndesirableEffect { - get => _UndesirableEffect ?? new List(); + get => _UndesirableEffect ??= []; set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } @@ -507,7 +507,7 @@ public List UndesirableEffect [DataMember] public List OtherTherapy { - get => _OtherTherapy ?? new List(); + get => _OtherTherapy ??= []; set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } @@ -649,7 +649,7 @@ public partial class InteractionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Interactant { - get => _Interactant ?? new List(); + get => _Interactant ??= []; set { _Interactant = value; OnPropertyChanged("Interactant"); } } @@ -706,7 +706,7 @@ public Hl7.Fhir.Model.CodeableConcept? Incidence [DataMember] public List Management { - get => _Management ?? new List(); + get => _Management ??= []; set { _Management = value; OnPropertyChanged("Management"); } } @@ -1174,7 +1174,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1220,7 +1220,7 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.ClinicalUseDefinitionType? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1236,7 +1236,7 @@ public List Category [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -1305,7 +1305,7 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent? Interaction [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs index ed087d621..4116abd8c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs @@ -164,7 +164,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -178,7 +178,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -210,7 +210,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -244,7 +244,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -260,7 +260,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -276,7 +276,7 @@ public List PartOf [DataMember] public List InResponseTo { - get => _InResponseTo ?? new List(); + get => _InResponseTo ??= []; set { _InResponseTo = value; OnPropertyChanged("InResponseTo"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.CodeableConcept? StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -381,7 +381,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -426,7 +426,7 @@ public Hl7.Fhir.Model.CodeableConcept? Topic [DataMember] public List About { - get => _About ?? new List(); + get => _About ??= []; set { _About = value; OnPropertyChanged("About"); } } @@ -513,7 +513,7 @@ public string? Received [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -543,7 +543,7 @@ public Hl7.Fhir.Model.ResourceReference? Sender [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -559,7 +559,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -573,7 +573,7 @@ public List ReasonReference [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -587,7 +587,7 @@ public List Payload [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs index a5cd3c348..69b1a7649 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs @@ -164,7 +164,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -180,7 +180,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -196,7 +196,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -269,7 +269,7 @@ public Hl7.Fhir.Model.CodeableConcept? StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -342,7 +342,7 @@ public bool? DoNotPerform [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -373,7 +373,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List About { - get => _About ?? new List(); + get => _About ??= []; set { _About = value; OnPropertyChanged("About"); } } @@ -402,7 +402,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -476,7 +476,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -506,7 +506,7 @@ public Hl7.Fhir.Model.ResourceReference? Sender [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -522,7 +522,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -536,7 +536,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs index 62bff412f..e7cb90199 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs @@ -118,7 +118,7 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get => _ParamElement ?? new List(); + get => _ParamElement ??= []; set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } @@ -458,7 +458,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -500,7 +500,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -602,7 +602,7 @@ public bool? Search [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs b/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs index 68ac51ff5..5ee4cfabd 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs @@ -474,7 +474,7 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -503,7 +503,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -656,7 +656,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -744,7 +744,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } @@ -772,7 +772,7 @@ public Hl7.Fhir.Model.CodeableConcept? EmptyReason [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } @@ -988,7 +988,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1063,7 +1063,7 @@ public string? Date [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1136,7 +1136,7 @@ public Hl7.Fhir.Model.Composition.ConfidentialityCode? Confidentiality [DataMember] public List Attester { - get => _Attester ?? new List(); + get => _Attester ??= []; set { _Attester = value; OnPropertyChanged("Attester"); } } @@ -1165,7 +1165,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -1179,7 +1179,7 @@ public List RelatesTo [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -1193,7 +1193,7 @@ public List Event [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs index d80d5db36..731e8eb12 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs @@ -226,7 +226,7 @@ public string? TargetVersion [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -432,7 +432,7 @@ public string? Display [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -657,7 +657,7 @@ public string? Comment [DataMember] public List DependsOn { - get => _DependsOn ?? new List(); + get => _DependsOn ??= []; set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } @@ -671,7 +671,7 @@ public List DependsOn [DataMember] public List Product { - get => _Product ?? new List(); + get => _Product ??= []; set { _Product = value; OnPropertyChanged("Product"); } } @@ -1469,7 +1469,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1511,7 +1511,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1526,7 +1526,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1626,7 +1626,7 @@ public Hl7.Fhir.Model.DataType? Target [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs b/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs index e64a6930a..3267218c3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs @@ -194,7 +194,7 @@ public Hl7.Fhir.Model.CodeableConcept? Summary [DataMember] public List Assessment { - get => _Assessment ?? new List(); + get => _Assessment ??= []; set { _Assessment = value; OnPropertyChanged("Assessment"); } } @@ -319,7 +319,7 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -335,7 +335,7 @@ public List Code [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -419,7 +419,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -462,7 +462,7 @@ public Hl7.Fhir.Model.CodeableConcept? VerificationStatus [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -505,7 +505,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -638,7 +638,7 @@ public Hl7.Fhir.Model.ResourceReference? Asserter [DataMember] public List Stage { - get => _Stage ?? new List(); + get => _Stage ??= []; set { _Stage = value; OnPropertyChanged("Stage"); } } @@ -652,7 +652,7 @@ public List Stage [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -666,7 +666,7 @@ public List Evidence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs b/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs index efe7c0aa0..f4cea6a8d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs @@ -541,7 +541,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -556,7 +556,7 @@ public List Actor [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -571,7 +571,7 @@ public List Action [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -586,7 +586,7 @@ public List SecurityLabel [DataMember] public List Purpose { - get => _Purpose ?? new List(); + get => _Purpose ??= []; set { _Purpose = value; OnPropertyChanged("Purpose"); } } @@ -601,7 +601,7 @@ public List Purpose [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -616,7 +616,7 @@ public List Class [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -643,7 +643,7 @@ public Hl7.Fhir.Model.Period? DataPeriod [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } @@ -657,7 +657,7 @@ public List Data [DataMember] public List Provision { - get => _Provision ?? new List(); + get => _Provision ??= []; set { _Provision = value; OnPropertyChanged("Provision"); } } @@ -1072,7 +1072,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1133,7 +1133,7 @@ public Hl7.Fhir.Model.CodeableConcept? Scope [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1192,7 +1192,7 @@ public string? DateTime [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -1208,7 +1208,7 @@ public List Performer [DataMember] public List Organization { - get => _Organization ?? new List(); + get => _Organization ??= []; set { _Organization = value; OnPropertyChanged("Organization"); } } @@ -1238,7 +1238,7 @@ public Hl7.Fhir.Model.DataType? Source [DataMember] public List Policy { - get => _Policy ?? new List(); + get => _Policy ??= []; set { _Policy = value; OnPropertyChanged("Policy"); } } @@ -1266,7 +1266,7 @@ public Hl7.Fhir.Model.CodeableConcept? PolicyRule [DataMember] public List Verification { - get => _Verification ?? new List(); + get => _Verification ??= []; set { _Verification = value; OnPropertyChanged("Verification"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs index 3c4018219..ffd35f164 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs @@ -665,7 +665,7 @@ public string? Text [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -693,7 +693,7 @@ public Hl7.Fhir.Model.Contract.ContractOfferComponent? Offer [DataMember] public List Asset { - get => _Asset ?? new List(); + get => _Asset ??= []; set { _Asset = value; OnPropertyChanged("Asset"); } } @@ -707,7 +707,7 @@ public List Asset [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -721,7 +721,7 @@ public List Action [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -911,7 +911,7 @@ public partial class SecurityLabelComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List NumberElement { - get => _NumberElement ?? new List(); + get => _NumberElement ??= []; set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } @@ -959,7 +959,7 @@ public Hl7.Fhir.Model.Coding? Classification [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -974,7 +974,7 @@ public List Category [DataMember] public List Control { - get => _Control ?? new List(); + get => _Control ??= []; set { _Control = value; OnPropertyChanged("Control"); } } @@ -1092,7 +1092,7 @@ public partial class ContractOfferComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1106,7 +1106,7 @@ public List Identifier [DataMember] public List Party { - get => _Party ?? new List(); + get => _Party ??= []; set { _Party = value; OnPropertyChanged("Party"); } } @@ -1164,7 +1164,7 @@ public Hl7.Fhir.Model.CodeableConcept? Decision [DataMember] public List DecisionMode { - get => _DecisionMode ?? new List(); + get => _DecisionMode ??= []; set { _DecisionMode = value; OnPropertyChanged("DecisionMode"); } } @@ -1178,7 +1178,7 @@ public List DecisionMode [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -1220,7 +1220,7 @@ public string? Text [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -1252,7 +1252,7 @@ public IEnumerable? LinkId [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -1441,7 +1441,7 @@ public partial class ContractPartyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -1659,7 +1659,7 @@ public Hl7.Fhir.Model.CodeableConcept? Scope [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1675,7 +1675,7 @@ public List Type [DataMember] public List TypeReference { - get => _TypeReference ?? new List(); + get => _TypeReference ??= []; set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } @@ -1690,7 +1690,7 @@ public List TypeReference [DataMember] public List Subtype { - get => _Subtype ?? new List(); + get => _Subtype ??= []; set { _Subtype = value; OnPropertyChanged("Subtype"); } } @@ -1718,7 +1718,7 @@ public Hl7.Fhir.Model.Coding? Relationship [DataMember] public List Context { - get => _Context ?? new List(); + get => _Context ??= []; set { _Context = value; OnPropertyChanged("Context"); } } @@ -1761,7 +1761,7 @@ public string? Condition [DataMember] public List PeriodType { - get => _PeriodType ?? new List(); + get => _PeriodType ??= []; set { _PeriodType = value; OnPropertyChanged("PeriodType"); } } @@ -1775,7 +1775,7 @@ public List PeriodType [DataMember] public List Period { - get => _Period ?? new List(); + get => _Period ??= []; set { _Period = value; OnPropertyChanged("Period"); } } @@ -1789,7 +1789,7 @@ public List Period [DataMember] public List UsePeriod { - get => _UsePeriod ?? new List(); + get => _UsePeriod ??= []; set { _UsePeriod = value; OnPropertyChanged("UsePeriod"); } } @@ -1831,7 +1831,7 @@ public string? Text [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -1863,7 +1863,7 @@ public IEnumerable? LinkId [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -1877,7 +1877,7 @@ public List Answer [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -1909,7 +1909,7 @@ public IEnumerable? SecurityLabelNumber [DataMember] public List ValuedItem { - get => _ValuedItem ?? new List(); + get => _ValuedItem ??= []; set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } @@ -2139,7 +2139,7 @@ public Hl7.Fhir.Model.ResourceReference? Reference [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2511,7 +2511,7 @@ public Hl7.Fhir.Model.ResourceReference? Recipient [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -2543,7 +2543,7 @@ public IEnumerable? LinkId [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -2814,7 +2814,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -2843,7 +2843,7 @@ public Hl7.Fhir.Model.CodeableConcept? Intent [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -2905,7 +2905,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List ContextLinkIdElement { - get => _ContextLinkIdElement ?? new List(); + get => _ContextLinkIdElement ??= []; set { _ContextLinkIdElement = value; OnPropertyChanged("ContextLinkIdElement"); } } @@ -2954,7 +2954,7 @@ public Hl7.Fhir.Model.DataType? Occurrence [DataMember] public List Requester { - get => _Requester ?? new List(); + get => _Requester ??= []; set { _Requester = value; OnPropertyChanged("Requester"); } } @@ -2968,7 +2968,7 @@ public List Requester [DataMember] public List RequesterLinkIdElement { - get => _RequesterLinkIdElement ?? new List(); + get => _RequesterLinkIdElement ??= []; set { _RequesterLinkIdElement = value; OnPropertyChanged("RequesterLinkIdElement"); } } @@ -3001,7 +3001,7 @@ public IEnumerable? RequesterLinkId [DataMember] public List PerformerType { - get => _PerformerType ?? new List(); + get => _PerformerType ??= []; set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } @@ -3044,7 +3044,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List PerformerLinkIdElement { - get => _PerformerLinkIdElement ?? new List(); + get => _PerformerLinkIdElement ??= []; set { _PerformerLinkIdElement = value; OnPropertyChanged("PerformerLinkIdElement"); } } @@ -3077,7 +3077,7 @@ public IEnumerable? PerformerLinkId [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -3093,7 +3093,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -3107,7 +3107,7 @@ public List ReasonReference [DataMember] public List ReasonElement { - get => _ReasonElement ?? new List(); + get => _ReasonElement ??= []; set { _ReasonElement = value; OnPropertyChanged("ReasonElement"); } } @@ -3139,7 +3139,7 @@ public IEnumerable? Reason [DataMember] public List ReasonLinkIdElement { - get => _ReasonLinkIdElement ?? new List(); + get => _ReasonLinkIdElement ??= []; set { _ReasonLinkIdElement = value; OnPropertyChanged("ReasonLinkIdElement"); } } @@ -3171,7 +3171,7 @@ public IEnumerable? ReasonLinkId [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -3185,7 +3185,7 @@ public List Note [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -3473,7 +3473,7 @@ public partial class ActionSubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -3620,7 +3620,7 @@ public Hl7.Fhir.Model.ResourceReference? Party [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } @@ -3995,7 +3995,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4223,7 +4223,7 @@ public Hl7.Fhir.Model.CodeableConcept? ExpirationType [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -4239,7 +4239,7 @@ public List Subject [DataMember] public List Authority { - get => _Authority ?? new List(); + get => _Authority ??= []; set { _Authority = value; OnPropertyChanged("Authority"); } } @@ -4255,7 +4255,7 @@ public List Authority [DataMember] public List Domain { - get => _Domain ?? new List(); + get => _Domain ??= []; set { _Domain = value; OnPropertyChanged("Domain"); } } @@ -4271,7 +4271,7 @@ public List Domain [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -4369,7 +4369,7 @@ public string? Subtitle [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -4461,7 +4461,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List SubType { - get => _SubType ?? new List(); + get => _SubType ??= []; set { _SubType = value; OnPropertyChanged("SubType"); } } @@ -4488,7 +4488,7 @@ public Hl7.Fhir.Model.Contract.ContentDefinitionComponent? ContentDefinition [DataMember] public List Term { - get => _Term ?? new List(); + get => _Term ??= []; set { _Term = value; OnPropertyChanged("Term"); } } @@ -4504,7 +4504,7 @@ public List Term [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -4520,7 +4520,7 @@ public List SupportingInfo [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -4534,7 +4534,7 @@ public List RelevantHistory [DataMember] public List Signer { - get => _Signer ?? new List(); + get => _Signer ??= []; set { _Signer = value; OnPropertyChanged("Signer"); } } @@ -4548,7 +4548,7 @@ public List Signer [DataMember] public List Friendly { - get => _Friendly ?? new List(); + get => _Friendly ??= []; set { _Friendly = value; OnPropertyChanged("Friendly"); } } @@ -4562,7 +4562,7 @@ public List Friendly [DataMember] public List Legal { - get => _Legal ?? new List(); + get => _Legal ??= []; set { _Legal = value; OnPropertyChanged("Legal"); } } @@ -4576,7 +4576,7 @@ public List Legal [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs index da0d42273..09e24bb1b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs @@ -164,7 +164,7 @@ public string? Name [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs index 0e7ddb421..6d183ef37 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs @@ -286,7 +286,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Exception { - get => _Exception ?? new List(); + get => _Exception ??= []; set { _Exception = value; OnPropertyChanged("Exception"); } } @@ -493,7 +493,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -683,7 +683,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Payor { - get => _Payor ?? new List(); + get => _Payor ??= []; set { _Payor = value; OnPropertyChanged("Payor"); } } @@ -697,7 +697,7 @@ public List Payor [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -767,7 +767,7 @@ public string? Network [DataMember] public List CostToBeneficiary { - get => _CostToBeneficiary ?? new List(); + get => _CostToBeneficiary ??= []; set { _CostToBeneficiary = value; OnPropertyChanged("CostToBeneficiary"); } } @@ -811,7 +811,7 @@ public bool? Subrogation [DataMember] public List Contract { - get => _Contract ?? new List(); + get => _Contract ??= []; set { _Contract = value; OnPropertyChanged("Contract"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs index 860a14647..c18bb0daa 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs @@ -457,7 +457,7 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SupportingInfoSequenceElement { - get => _SupportingInfoSequenceElement ?? new List(); + get => _SupportingInfoSequenceElement ??= []; set { _SupportingInfoSequenceElement = value; OnPropertyChanged("SupportingInfoSequenceElement"); } } @@ -518,7 +518,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -588,7 +588,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -604,7 +604,7 @@ public List Diagno [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -854,7 +854,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -915,7 +915,7 @@ public Hl7.Fhir.Model.CodeableConcept? Priority [DataMember] public List> PurposeElement { - get => _PurposeElement ?? new List>(); + get => _PurposeElement ??= []; set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } @@ -1068,7 +1068,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -1082,7 +1082,7 @@ public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1096,7 +1096,7 @@ public List Insura [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs index 28129efd3..40b803569 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs @@ -178,7 +178,7 @@ public Hl7.Fhir.Model.Period? BenefitPeriod [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -325,7 +325,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -480,7 +480,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -523,7 +523,7 @@ public bool? AuthorizationRequired [DataMember] public List AuthorizationSupporting { - get => _AuthorizationSupporting ?? new List(); + get => _AuthorizationSupporting ??= []; set { _AuthorizationSupporting = value; OnPropertyChanged("AuthorizationSupporting"); } } @@ -975,7 +975,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1022,7 +1022,7 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [DataMember] public List> PurposeElement { - get => _PurposeElement ?? new List>(); + get => _PurposeElement ??= []; set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } @@ -1220,7 +1220,7 @@ public Hl7.Fhir.Model.ResourceReference? Insurer [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1276,7 +1276,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs index e102038e3..ce57ce370 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs @@ -192,7 +192,7 @@ public string? ValueSet [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -638,7 +638,7 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -687,7 +687,7 @@ public Hl7.Fhir.Model.DataType? Subject [DataMember] public List MustSupportElement { - get => _MustSupportElement ?? new List(); + get => _MustSupportElement ??= []; set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } @@ -719,7 +719,7 @@ public IEnumerable? MustSupport [DataMember] public List CodeFilter { - get => _CodeFilter ?? new List(); + get => _CodeFilter ??= []; set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } @@ -733,7 +733,7 @@ public List CodeFilter [DataMember] public List DateFilter { - get => _DateFilter ?? new List(); + get => _DateFilter ??= []; set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } @@ -775,7 +775,7 @@ public int? Limit [DataMember] public List Sort { - get => _Sort ?? new List(); + get => _Sort ??= []; set { _Sort = value; OnPropertyChanged("Sort"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs index efa007ab0..52da3615f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs @@ -115,7 +115,7 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -131,7 +131,7 @@ public List Code [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -368,7 +368,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -504,7 +504,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Implicated { - get => _Implicated ?? new List(); + get => _Implicated ??= []; set { _Implicated = value; OnPropertyChanged("Implicated"); } } @@ -518,7 +518,7 @@ public List Implicated [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -588,7 +588,7 @@ public string? Reference [DataMember] public List Mitigation { - get => _Mitigation ?? new List(); + get => _Mitigation ??= []; set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Device.cs b/src/Hl7.Fhir.R4B/Model/Generated/Device.cs index ccaaf9c51..9b6dc2604 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Device.cs @@ -888,7 +888,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List ValueQuantity { - get => _ValueQuantity ?? new List(); + get => _ValueQuantity ??= []; set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } @@ -902,7 +902,7 @@ public List ValueQuantity [DataMember] public List ValueCode { - get => _ValueCode ?? new List(); + get => _ValueCode ??= []; set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } @@ -995,7 +995,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1024,7 +1024,7 @@ public Hl7.Fhir.Model.ResourceReference? Definition [DataMember] public List UdiCarrier { - get => _UdiCarrier ?? new List(); + get => _UdiCarrier ??= []; set { _UdiCarrier = value; OnPropertyChanged("UdiCarrier"); } } @@ -1069,7 +1069,7 @@ public Hl7.Fhir.Model.Device.FHIRDeviceStatus? Status [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -1251,7 +1251,7 @@ public string? SerialNumber [DataMember] public List DeviceName { - get => _DeviceName ?? new List(); + get => _DeviceName ??= []; set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } @@ -1335,7 +1335,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Specialization { - get => _Specialization ?? new List(); + get => _Specialization ??= []; set { _Specialization = value; OnPropertyChanged("Specialization"); } } @@ -1349,7 +1349,7 @@ public List Specialization [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -1363,7 +1363,7 @@ public List Version [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1407,7 +1407,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1464,7 +1464,7 @@ public string? Url [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1478,7 +1478,7 @@ public List Note [DataMember] public List Safety { - get => _Safety ?? new List(); + get => _Safety ??= []; set { _Safety = value; OnPropertyChanged("Safety"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs index 62edf6207..f4c3945c1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs @@ -563,7 +563,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Description { - get => _Description ?? new List(); + get => _Description ??= []; set { _Description = value; OnPropertyChanged("Description"); } } @@ -674,7 +674,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List ValueQuantity { - get => _ValueQuantity ?? new List(); + get => _ValueQuantity ??= []; set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } @@ -688,7 +688,7 @@ public List ValueQuantity [DataMember] public List ValueCode { - get => _ValueCode ?? new List(); + get => _ValueCode ??= []; set { _ValueCode = value; OnPropertyChanged("ValueCode"); } } @@ -943,7 +943,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -957,7 +957,7 @@ public List Identifier [DataMember] public List UdiDeviceIdentifier { - get => _UdiDeviceIdentifier ?? new List(); + get => _UdiDeviceIdentifier ??= []; set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } @@ -987,7 +987,7 @@ public Hl7.Fhir.Model.DataType? Manufacturer [DataMember] public List DeviceName { - get => _DeviceName ?? new List(); + get => _DeviceName ??= []; set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } @@ -1043,7 +1043,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Specialization { - get => _Specialization ?? new List(); + get => _Specialization ??= []; set { _Specialization = value; OnPropertyChanged("Specialization"); } } @@ -1057,7 +1057,7 @@ public List Specializat [DataMember] public List VersionElement { - get => _VersionElement ?? new List(); + get => _VersionElement ??= []; set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } @@ -1090,7 +1090,7 @@ public IEnumerable? Version [DataMember] public List Safety { - get => _Safety ?? new List(); + get => _Safety ??= []; set { _Safety = value; OnPropertyChanged("Safety"); } } @@ -1104,7 +1104,7 @@ public List Safety [DataMember] public List ShelfLifeStorage { - get => _ShelfLifeStorage ?? new List(); + get => _ShelfLifeStorage ??= []; set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } @@ -1131,7 +1131,7 @@ public Hl7.Fhir.Model.ProdCharacteristic? PhysicalCharacteristics [DataMember] public List LanguageCode { - get => _LanguageCode ?? new List(); + get => _LanguageCode ??= []; set { _LanguageCode = value; OnPropertyChanged("LanguageCode"); } } @@ -1145,7 +1145,7 @@ public List LanguageCode [DataMember] public List Capability { - get => _Capability ?? new List(); + get => _Capability ??= []; set { _Capability = value; OnPropertyChanged("Capability"); } } @@ -1159,7 +1159,7 @@ public List Capability [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1188,7 +1188,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1258,7 +1258,7 @@ public string? OnlineInformation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1300,7 +1300,7 @@ public Hl7.Fhir.Model.ResourceReference? ParentDevice [DataMember] public List Material { - get => _Material ?? new List(); + get => _Material ??= []; set { _Material = value; OnPropertyChanged("Material"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs index b32a043d9..6f1ad3962 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs @@ -445,7 +445,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -622,7 +622,7 @@ public Hl7.Fhir.Model.Timing? MeasurementPeriod [DataMember] public List Calibration { - get => _Calibration ?? new List(); + get => _Calibration ??= []; set { _Calibration = value; OnPropertyChanged("Calibration"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs index 9d96bcb2d..80aa6f08a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs @@ -185,7 +185,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -199,7 +199,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -231,7 +231,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -265,7 +265,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -281,7 +281,7 @@ public List BasedOn [DataMember] public List PriorRequest { - get => _PriorRequest ?? new List(); + get => _PriorRequest ??= []; set { _PriorRequest = value; OnPropertyChanged("PriorRequest"); } } @@ -417,7 +417,7 @@ public Hl7.Fhir.Model.DataType? Code [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -550,7 +550,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -566,7 +566,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -582,7 +582,7 @@ public List ReasonReference [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -598,7 +598,7 @@ public List Insurance [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -612,7 +612,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -628,7 +628,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs index 255f3f688..96b2a5fb6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs @@ -116,7 +116,7 @@ public enum DeviceUseStatementStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -132,7 +132,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -195,7 +195,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -283,7 +283,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -299,7 +299,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -327,7 +327,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs index 093cb4437..e341d9463 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs @@ -271,7 +271,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -287,7 +287,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -333,7 +333,7 @@ public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -437,7 +437,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -453,7 +453,7 @@ public List Performer [DataMember] public List ResultsInterpreter { - get => _ResultsInterpreter ?? new List(); + get => _ResultsInterpreter ??= []; set { _ResultsInterpreter = value; OnPropertyChanged("ResultsInterpreter"); } } @@ -469,7 +469,7 @@ public List ResultsInterpreter [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -485,7 +485,7 @@ public List Specimen [DataMember] public List Result { - get => _Result ?? new List(); + get => _Result ??= []; set { _Result = value; OnPropertyChanged("Result"); } } @@ -501,7 +501,7 @@ public List Result [DataMember] public List ImagingStudy { - get => _ImagingStudy ?? new List(); + get => _ImagingStudy ??= []; set { _ImagingStudy = value; OnPropertyChanged("ImagingStudy"); } } @@ -515,7 +515,7 @@ public List ImagingStudy [DataMember] public List Media { - get => _Media ?? new List(); + get => _Media ??= []; set { _Media = value; OnPropertyChanged("Media"); } } @@ -558,7 +558,7 @@ public string? Conclusion [DataMember] public List ConclusionCode { - get => _ConclusionCode ?? new List(); + get => _ConclusionCode ??= []; set { _ConclusionCode = value; OnPropertyChanged("ConclusionCode"); } } @@ -572,7 +572,7 @@ public List ConclusionCode [DataMember] public List PresentedForm { - get => _PresentedForm ?? new List(); + get => _PresentedForm ??= []; set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs index fbd9941b7..2c052fd1e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs @@ -198,7 +198,7 @@ public Hl7.Fhir.Model.Identifier? MasterIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -302,7 +302,7 @@ public string? Created [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -318,7 +318,7 @@ public List Author [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -390,7 +390,7 @@ public string? Description [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } @@ -404,7 +404,7 @@ public List Content [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs index 686269086..6bb84fcd9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs @@ -338,7 +338,7 @@ public partial class ContextComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -353,7 +353,7 @@ public List Encounter [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -425,7 +425,7 @@ public Hl7.Fhir.Model.ResourceReference? SourcePatientInfo [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -567,7 +567,7 @@ public Hl7.Fhir.Model.Identifier? MasterIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -657,7 +657,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -716,7 +716,7 @@ public DateTimeOffset? Date [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -760,7 +760,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -803,7 +803,7 @@ public string? Description [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -817,7 +817,7 @@ public List SecurityLabel [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs index 9b7131c55..5c395d0c9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs @@ -266,7 +266,7 @@ public string? Text [DataMember] public List AdditionalInstruction { - get => _AdditionalInstruction ?? new List(); + get => _AdditionalInstruction ??= []; set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } @@ -379,7 +379,7 @@ public Hl7.Fhir.Model.CodeableConcept? Method [DataMember] public List DoseAndRate { - get => _DoseAndRate ?? new List(); + get => _DoseAndRate ??= []; set { _DoseAndRate = value; OnPropertyChanged("DoseAndRate"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs index d105305a4..604ac19cf 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs @@ -434,7 +434,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -779,7 +779,7 @@ public Hl7.Fhir.Model.CodeableConcept? ReAdmission [DataMember] public List DietPreference { - get => _DietPreference ?? new List(); + get => _DietPreference ??= []; set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } @@ -794,7 +794,7 @@ public List DietPreference [DataMember] public List SpecialCourtesy { - get => _SpecialCourtesy ?? new List(); + get => _SpecialCourtesy ??= []; set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } @@ -809,7 +809,7 @@ public List SpecialCourtesy [DataMember] public List SpecialArrangement { - get => _SpecialArrangement ?? new List(); + get => _SpecialArrangement ??= []; set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } @@ -1163,7 +1163,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1208,7 +1208,7 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [DataMember] public List StatusHistory { - get => _StatusHistory ?? new List(); + get => _StatusHistory ??= []; set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } @@ -1237,7 +1237,7 @@ public Hl7.Fhir.Model.Coding? Class [DataMember] public List ClassHistory { - get => _ClassHistory ?? new List(); + get => _ClassHistory ??= []; set { _ClassHistory = value; OnPropertyChanged("ClassHistory"); } } @@ -1252,7 +1252,7 @@ public List ClassHistory [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1311,7 +1311,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List EpisodeOfCare { - get => _EpisodeOfCare ?? new List(); + get => _EpisodeOfCare ??= []; set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } @@ -1327,7 +1327,7 @@ public List EpisodeOfCare [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1341,7 +1341,7 @@ public List BasedOn [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1357,7 +1357,7 @@ public List Participant [DataMember] public List Appointment { - get => _Appointment ?? new List(); + get => _Appointment ??= []; set { _Appointment = value; OnPropertyChanged("Appointment"); } } @@ -1398,7 +1398,7 @@ public Hl7.Fhir.Model.Duration? Length [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1414,7 +1414,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1428,7 +1428,7 @@ public List ReasonReference [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -1444,7 +1444,7 @@ public List Diagnosis [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -1471,7 +1471,7 @@ public Hl7.Fhir.Model.Encounter.HospitalizationComponent? Hospitalization [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs index ef82a3d26..bb44afb24 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs @@ -116,7 +116,7 @@ public enum EndpointStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -219,7 +219,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -247,7 +247,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List PayloadType { - get => _PayloadType ?? new List(); + get => _PayloadType ??= []; set { _PayloadType = value; OnPropertyChanged("PayloadType"); } } @@ -262,7 +262,7 @@ public List PayloadType [DataMember] public List PayloadMimeTypeElement { - get => _PayloadMimeTypeElement ?? new List(); + get => _PayloadMimeTypeElement ??= []; set { _PayloadMimeTypeElement = value; OnPropertyChanged("PayloadMimeTypeElement"); } } @@ -323,7 +323,7 @@ public string? Address [DataMember] public List HeaderElement { - get => _HeaderElement ?? new List(); + get => _HeaderElement ??= []; set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs index ee32c0d75..cc58bfa8c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs @@ -70,7 +70,7 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs index f0a0eb640..2ed949e32 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs @@ -70,7 +70,7 @@ public partial class EnrollmentResponse : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs index 3f9a2017e..c07b7e760 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs @@ -403,7 +403,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -448,7 +448,7 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get => _StatusHistory ?? new List(); + get => _StatusHistory ??= []; set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } @@ -463,7 +463,7 @@ public List StatusHistory [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -477,7 +477,7 @@ public List Type [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List ReferralRequest { - get => _ReferralRequest ?? new List(); + get => _ReferralRequest ??= []; set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } @@ -568,7 +568,7 @@ public Hl7.Fhir.Model.ResourceReference? CareManager [DataMember] public List Team { - get => _Team ?? new List(); + get => _Team ??= []; set { _Team = value; OnPropertyChanged("Team"); } } @@ -584,7 +584,7 @@ public List Team [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs index 47b010071..aac5f7e85 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -356,7 +356,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -398,7 +398,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -413,7 +413,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -581,7 +581,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -595,7 +595,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -609,7 +609,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -623,7 +623,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -637,7 +637,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -651,7 +651,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -665,7 +665,7 @@ public List RelatedArtifact [DataMember] public List Trigger { - get => _Trigger ?? new List(); + get => _Trigger ??= []; set { _Trigger = value; OnPropertyChanged("Trigger"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs index c5e850f1f..bc5bb94b9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs @@ -111,7 +111,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -331,7 +331,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -454,7 +454,7 @@ public Hl7.Fhir.Model.Evidence.SampleSizeComponent? SampleSize [DataMember] public List AttributeEstimate { - get => _AttributeEstimate ?? new List(); + get => _AttributeEstimate ??= []; set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } @@ -468,7 +468,7 @@ public List AttributeEstimat [DataMember] public List ModelCharacteristic { - get => _ModelCharacteristic ?? new List(); + get => _ModelCharacteristic ??= []; set { _ModelCharacteristic = value; OnPropertyChanged("ModelCharacteristic"); } } @@ -665,7 +665,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -904,7 +904,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -986,7 +986,7 @@ public Hl7.Fhir.Model.Range? Range [DataMember] public List AttributeEstimate { - get => _AttributeEstimate ?? new List(); + get => _AttributeEstimate ??= []; set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } @@ -1159,7 +1159,7 @@ public Hl7.Fhir.Model.Quantity? Value [DataMember] public List Variable { - get => _Variable ?? new List(); + get => _Variable ??= []; set { _Variable = value; OnPropertyChanged("Variable"); } } @@ -1173,7 +1173,7 @@ public List Variable [DataMember] public List AttributeEstimate { - get => _AttributeEstimate ?? new List(); + get => _AttributeEstimate ??= []; set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } @@ -1334,7 +1334,7 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List ValueCategory { - get => _ValueCategory ?? new List(); + get => _ValueCategory ??= []; set { _ValueCategory = value; OnPropertyChanged("ValueCategory"); } } @@ -1348,7 +1348,7 @@ public List ValueCategory [DataMember] public List ValueQuantity { - get => _ValueQuantity ?? new List(); + get => _ValueQuantity ??= []; set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } @@ -1362,7 +1362,7 @@ public List ValueQuantity [DataMember] public List ValueRange { - get => _ValueRange ?? new List(); + get => _ValueRange ??= []; set { _ValueRange = value; OnPropertyChanged("ValueRange"); } } @@ -1517,7 +1517,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1587,7 +1587,7 @@ public string? Rater [DataMember] public List Subcomponent { - get => _Subcomponent ?? new List(); + get => _Subcomponent ??= []; set { _Subcomponent = value; OnPropertyChanged("Subcomponent"); } } @@ -1735,7 +1735,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1880,7 +1880,7 @@ public string? Date [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1978,7 +1978,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1992,7 +1992,7 @@ public List Contact [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -2006,7 +2006,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -2020,7 +2020,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -2034,7 +2034,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -2048,7 +2048,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2118,7 +2118,7 @@ public string? Assertion [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -2132,7 +2132,7 @@ public List Note [DataMember] public List VariableDefinition { - get => _VariableDefinition ?? new List(); + get => _VariableDefinition ??= []; set { _VariableDefinition = value; OnPropertyChanged("VariableDefinition"); } } @@ -2174,7 +2174,7 @@ public Hl7.Fhir.Model.CodeableConcept? StudyType [DataMember] public List Statistic { - get => _Statistic ?? new List(); + get => _Statistic ??= []; set { _Statistic = value; OnPropertyChanged("Statistic"); } } @@ -2188,7 +2188,7 @@ public List Statistic [DataMember] public List Certainty { - get => _Certainty ?? new List(); + get => _Certainty ??= []; set { _Certainty = value; OnPropertyChanged("Certainty"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs index b3510905a..d561e75d6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs @@ -145,7 +145,7 @@ public partial class SubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -159,7 +159,7 @@ public List Characteristi [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -627,7 +627,7 @@ public Hl7.Fhir.Model.ResourceReference? FocusReference [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -699,7 +699,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List EntryClassifier { - get => _EntryClassifier ?? new List(); + get => _EntryClassifier ??= []; set { _EntryClassifier = value; OnPropertyChanged("EntryClassifier"); } } @@ -715,7 +715,7 @@ public List EntryClassifier [DataMember] public List EntryReference { - get => _EntryReference ?? new List(); + get => _EntryReference ??= []; set { _EntryReference = value; OnPropertyChanged("EntryReference"); } } @@ -729,7 +729,7 @@ public List EntryReference [DataMember] public List EntryQuantity { - get => _EntryQuantity ?? new List(); + get => _EntryQuantity ??= []; set { _EntryQuantity = value; OnPropertyChanged("EntryQuantity"); } } @@ -757,7 +757,7 @@ public Hl7.Fhir.Model.CodeableConcept? EmptyReason [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } @@ -990,7 +990,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1004,7 +1004,7 @@ public List UseContext [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1018,7 +1018,7 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get => _RelatedIdentifier ?? new List(); + get => _RelatedIdentifier ??= []; set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } @@ -1062,7 +1062,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1076,7 +1076,7 @@ public List Note [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1132,7 +1132,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1146,7 +1146,7 @@ public List Contact [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1160,7 +1160,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1174,7 +1174,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1188,7 +1188,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1202,7 +1202,7 @@ public List Endorser [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -1216,7 +1216,7 @@ public List RelatesTo [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs index b074797c1..d7efea574 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs @@ -440,7 +440,7 @@ public Hl7.Fhir.Model.Range? Range [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -699,7 +699,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -940,7 +940,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -954,7 +954,7 @@ public List Note [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -996,7 +996,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1010,7 +1010,7 @@ public List Contact [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1024,7 +1024,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1038,7 +1038,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1052,7 +1052,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1066,7 +1066,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1138,7 +1138,7 @@ public Hl7.Fhir.Model.EvidenceVariable.CharacteristicCombinationCode? Characteri [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -1182,7 +1182,7 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs index 49f3df532..df54b7aeb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs @@ -435,7 +435,7 @@ public string? Description [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -449,7 +449,7 @@ public List Version [DataMember] public List ContainedInstance { - get => _ContainedInstance ?? new List(); + get => _ContainedInstance ??= []; set { _ContainedInstance = value; OnPropertyChanged("ContainedInstance"); } } @@ -979,7 +979,7 @@ public string? PostConditions [DataMember] public List Step { - get => _Step ?? new List(); + get => _Step ??= []; set { _Step = value; OnPropertyChanged("Step"); } } @@ -1103,7 +1103,7 @@ public partial class StepComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Process { - get => _Process ?? new List(); + get => _Process ??= []; set { _Process = value; OnPropertyChanged("Process"); } } @@ -1158,7 +1158,7 @@ public Hl7.Fhir.Model.ExampleScenario.OperationComponent? Operation [DataMember] public List Alternative { - get => _Alternative ?? new List(); + get => _Alternative ??= []; set { _Alternative = value; OnPropertyChanged("Alternative"); } } @@ -1739,7 +1739,7 @@ public string? Description [DataMember] public List Step { - get => _Step ?? new List(); + get => _Step ??= []; set { _Step = value; OnPropertyChanged("Step"); } } @@ -1860,7 +1860,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2045,7 +2045,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2059,7 +2059,7 @@ public List Contact [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2074,7 +2074,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2144,7 +2144,7 @@ public string? Purpose [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -2158,7 +2158,7 @@ public List Actor [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -2172,7 +2172,7 @@ public List Instance [DataMember] public List Process { - get => _Process ?? new List(); + get => _Process ??= []; set { _Process = value; OnPropertyChanged("Process"); } } @@ -2186,7 +2186,7 @@ public List Process [DataMember] public List WorkflowElement { - get => _WorkflowElement ?? new List(); + get => _WorkflowElement ??= []; set { _WorkflowElement = value; OnPropertyChanged("WorkflowElement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs index a3e3d48af..0318324c4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs @@ -862,7 +862,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1047,7 +1047,7 @@ public int? Sequence [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1109,7 +1109,7 @@ public Hl7.Fhir.Model.DataType? Procedure [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1282,7 +1282,7 @@ public Hl7.Fhir.Model.ResourceReference? Coverage [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1591,7 +1591,7 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get => _CareTeamSequenceElement ?? new List(); + get => _CareTeamSequenceElement ??= []; set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } @@ -1623,7 +1623,7 @@ public IEnumerable? CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get => _DiagnosisSequenceElement ?? new List(); + get => _DiagnosisSequenceElement ??= []; set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } @@ -1655,7 +1655,7 @@ public IEnumerable? DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get => _ProcedureSequenceElement ?? new List(); + get => _ProcedureSequenceElement ??= []; set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } @@ -1687,7 +1687,7 @@ public IEnumerable? ProcedureSequence [DataMember] public List InformationSequenceElement { - get => _InformationSequenceElement ?? new List(); + get => _InformationSequenceElement ??= []; set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } @@ -1763,7 +1763,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1778,7 +1778,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1893,7 +1893,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1922,7 +1922,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -1938,7 +1938,7 @@ public List SubSite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -1952,7 +1952,7 @@ public List Encounter [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1984,7 +1984,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1998,7 +1998,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2534,7 +2534,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2549,7 +2549,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2632,7 +2632,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2646,7 +2646,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -2678,7 +2678,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2692,7 +2692,7 @@ public List Adjudicat [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -2973,7 +2973,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2988,7 +2988,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3071,7 +3071,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3085,7 +3085,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3117,7 +3117,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3316,7 +3316,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get => _ItemSequenceElement ?? new List(); + get => _ItemSequenceElement ??= []; set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } @@ -3348,7 +3348,7 @@ public IEnumerable? ItemSequence [DataMember] public List DetailSequenceElement { - get => _DetailSequenceElement ?? new List(); + get => _DetailSequenceElement ??= []; set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } @@ -3380,7 +3380,7 @@ public IEnumerable? DetailSequence [DataMember] public List SubDetailSequenceElement { - get => _SubDetailSequenceElement ?? new List(); + get => _SubDetailSequenceElement ??= []; set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } @@ -3414,7 +3414,7 @@ public IEnumerable? SubDetailSequence [DataMember] public List Provider { - get => _Provider ?? new List(); + get => _Provider ??= []; set { _Provider = value; OnPropertyChanged("Provider"); } } @@ -3444,7 +3444,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3459,7 +3459,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3587,7 +3587,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -3601,7 +3601,7 @@ public List SubSite [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3633,7 +3633,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3647,7 +3647,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -3907,7 +3907,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3988,7 +3988,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -4020,7 +4020,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -4034,7 +4034,7 @@ public List Adjudicat [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -4213,7 +4213,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -4294,7 +4294,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -4326,7 +4326,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -5155,7 +5155,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Financial { - get => _Financial ?? new List(); + get => _Financial ??= []; set { _Financial = value; OnPropertyChanged("Financial"); } } @@ -5433,7 +5433,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -5685,7 +5685,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundsReserve [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -5861,7 +5861,7 @@ public string? Disposition [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -5893,7 +5893,7 @@ public IEnumerable? PreAuthRef [DataMember] public List PreAuthRefPeriod { - get => _PreAuthRefPeriod ?? new List(); + get => _PreAuthRefPeriod ??= []; set { _PreAuthRefPeriod = value; OnPropertyChanged("PreAuthRefPeriod"); } } @@ -5907,7 +5907,7 @@ public List PreAuthRefPeriod [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -5921,7 +5921,7 @@ public List CareTeam [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -5935,7 +5935,7 @@ public List [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -5949,7 +5949,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -5991,7 +5991,7 @@ public int? Precedence [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -6018,7 +6018,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.AccidentComponent? Accident [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -6032,7 +6032,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -6046,7 +6046,7 @@ public List AddItem [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -6060,7 +6060,7 @@ public List Adjudicat [DataMember] public List Total { - get => _Total ?? new List(); + get => _Total ??= []; set { _Total = value; OnPropertyChanged("Total"); } } @@ -6114,7 +6114,7 @@ public Hl7.Fhir.Model.Attachment? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -6141,7 +6141,7 @@ public Hl7.Fhir.Model.Period? BenefitPeriod [DataMember] public List BenefitBalance { - get => _BenefitBalance ?? new List(); + get => _BenefitBalance ??= []; set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs index a7055bce8..ef125d0ba 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs @@ -192,7 +192,7 @@ public Hl7.Fhir.Model.DataType? Onset [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -303,7 +303,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -317,7 +317,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -349,7 +349,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -601,7 +601,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -617,7 +617,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -631,7 +631,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -645,7 +645,7 @@ public List Note [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs b/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs index 06adcf9c5..7eef31be6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs @@ -98,7 +98,7 @@ public enum FlagStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.Flag.FlagStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs b/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs index ad0fe510e..16c6901a8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs @@ -276,7 +276,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.CodeableConcept? AchievementStatus [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -411,7 +411,7 @@ public Hl7.Fhir.Model.DataType? Start [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -498,7 +498,7 @@ public Hl7.Fhir.Model.ResourceReference? ExpressedBy [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -512,7 +512,7 @@ public List Addresses [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -527,7 +527,7 @@ public List Note [DataMember] public List OutcomeCode { - get => _OutcomeCode ?? new List(); + get => _OutcomeCode ??= []; set { _OutcomeCode = value; OnPropertyChanged("OutcomeCode"); } } @@ -543,7 +543,7 @@ public List OutcomeCode [DataMember] public List OutcomeReference { - get => _OutcomeReference ?? new List(); + get => _OutcomeReference ??= []; set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs index b0419760a..5c06a754c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs @@ -279,7 +279,7 @@ public string? Description [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -499,7 +499,7 @@ public string? Profile [DataMember] public List Compartment { - get => _Compartment ?? new List(); + get => _Compartment ??= []; set { _Compartment = value; OnPropertyChanged("Compartment"); } } @@ -513,7 +513,7 @@ public List Compartment [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -1083,7 +1083,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1125,7 +1125,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1140,7 +1140,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1241,7 +1241,7 @@ public string? Profile [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Group.cs b/src/Hl7.Fhir.R4B/Model/Generated/Group.cs index 5c3821081..6cea2e5dd 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Group.cs @@ -448,7 +448,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -635,7 +635,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingEntity [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -649,7 +649,7 @@ public List Characteristic [DataMember] public List Member { - get => _Member ?? new List(); + get => _Member ??= []; set { _Member = value; OnPropertyChanged("Member"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs index 518ad8c10..0b27cc7b4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs @@ -129,7 +129,7 @@ public Hl7.Fhir.Model.Identifier? RequestIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -263,7 +263,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -279,7 +279,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -293,7 +293,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -309,7 +309,7 @@ public List Note [DataMember] public List EvaluationMessage { - get => _EvaluationMessage ?? new List(); + get => _EvaluationMessage ??= []; set { _EvaluationMessage = value; OnPropertyChanged("EvaluationMessage"); } } @@ -353,7 +353,7 @@ public Hl7.Fhir.Model.ResourceReference? Result [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs index 9ed513eca..b313ffd93 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs @@ -214,7 +214,7 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -546,7 +546,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -604,7 +604,7 @@ public Hl7.Fhir.Model.ResourceReference? ProvidedBy [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -619,7 +619,7 @@ public List Category [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -634,7 +634,7 @@ public List Type [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -650,7 +650,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -761,7 +761,7 @@ public Hl7.Fhir.Model.Attachment? Photo [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -777,7 +777,7 @@ public List Telecom [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -792,7 +792,7 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get => _ServiceProvisionCode ?? new List(); + get => _ServiceProvisionCode ??= []; set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } @@ -806,7 +806,7 @@ public List ServiceProvisionCode [DataMember] public List Eligibility { - get => _Eligibility ?? new List(); + get => _Eligibility ??= []; set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } @@ -821,7 +821,7 @@ public List Eligibility [DataMember] public List Program { - get => _Program ?? new List(); + get => _Program ??= []; set { _Program = value; OnPropertyChanged("Program"); } } @@ -836,7 +836,7 @@ public List Program [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -851,7 +851,7 @@ public List Characteristic [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -866,7 +866,7 @@ public List Communication [DataMember] public List ReferralMethod { - get => _ReferralMethod ?? new List(); + get => _ReferralMethod ??= []; set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } @@ -908,7 +908,7 @@ public bool? AppointmentRequired [DataMember] public List AvailableTime { - get => _AvailableTime ?? new List(); + get => _AvailableTime ??= []; set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } @@ -922,7 +922,7 @@ public List AvailableTi [DataMember] public List NotAvailable { - get => _NotAvailable ?? new List(); + get => _NotAvailable ??= []; set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } @@ -966,7 +966,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs index 71dd75afe..bc24f5fe2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs @@ -209,7 +209,7 @@ public string? Family [DataMember] public List GivenElement { - get => _GivenElement ?? new List(); + get => _GivenElement ??= []; set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } @@ -241,7 +241,7 @@ public IEnumerable? Given [DataMember] public List PrefixElement { - get => _PrefixElement ?? new List(); + get => _PrefixElement ??= []; set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } @@ -273,7 +273,7 @@ public IEnumerable? Prefix [DataMember] public List SuffixElement { - get => _SuffixElement ?? new List(); + get => _SuffixElement ??= []; set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs index 987b02460..b62f23bf9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs @@ -256,7 +256,7 @@ public int? NumberOfInstances [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -300,7 +300,7 @@ public Hl7.Fhir.Model.Coding? Laterality [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -342,7 +342,7 @@ public string? Started [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -356,7 +356,7 @@ public List Performer [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -851,7 +851,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -897,7 +897,7 @@ public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status [DataMember] public List Modality { - get => _Modality ?? new List(); + get => _Modality ??= []; set { _Modality = value; OnPropertyChanged("Modality"); } } @@ -972,7 +972,7 @@ public string? Started [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1003,7 +1003,7 @@ public Hl7.Fhir.Model.ResourceReference? Referrer [DataMember] public List Interpreter { - get => _Interpreter ?? new List(); + get => _Interpreter ??= []; set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } @@ -1019,7 +1019,7 @@ public List Interpreter [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1105,7 +1105,7 @@ public Hl7.Fhir.Model.ResourceReference? ProcedureReference [DataMember] public List ProcedureCode { - get => _ProcedureCode ?? new List(); + get => _ProcedureCode ??= []; set { _ProcedureCode = value; OnPropertyChanged("ProcedureCode"); } } @@ -1135,7 +1135,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1151,7 +1151,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1165,7 +1165,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1207,7 +1207,7 @@ public string? Description [DataMember] public List Series { - get => _Series ?? new List(); + get => _Series ??= []; set { _Series = value; OnPropertyChanged("Series"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs index 1a546a873..171514479 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs @@ -657,7 +657,7 @@ public Hl7.Fhir.Model.ResourceReference? Authority [DataMember] public List TargetDisease { - get => _TargetDisease ?? new List(); + get => _TargetDisease ??= []; set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } @@ -799,7 +799,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1117,7 +1117,7 @@ public Hl7.Fhir.Model.Quantity? DoseQuantity [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -1131,7 +1131,7 @@ public List Performer [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1146,7 +1146,7 @@ public List Note [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1162,7 +1162,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1205,7 +1205,7 @@ public bool? IsSubpotent [DataMember] public List SubpotentReason { - get => _SubpotentReason ?? new List(); + get => _SubpotentReason ??= []; set { _SubpotentReason = value; OnPropertyChanged("SubpotentReason"); } } @@ -1219,7 +1219,7 @@ public List SubpotentReason [DataMember] public List Education { - get => _Education ?? new List(); + get => _Education ??= []; set { _Education = value; OnPropertyChanged("Education"); } } @@ -1234,7 +1234,7 @@ public List Education [DataMember] public List ProgramEligibility { - get => _ProgramEligibility ?? new List(); + get => _ProgramEligibility ??= []; set { _ProgramEligibility = value; OnPropertyChanged("ProgramEligibility"); } } @@ -1262,7 +1262,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundingSource [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } @@ -1276,7 +1276,7 @@ public List Reaction [DataMember] public List ProtocolApplied { - get => _ProtocolApplied ?? new List(); + get => _ProtocolApplied ??= []; set { _ProtocolApplied = value; OnPropertyChanged("ProtocolApplied"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs index f220af2b6..b2d60d42e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs @@ -92,7 +92,7 @@ public enum ImmunizationEvaluationStatusCodes [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -243,7 +243,7 @@ public Hl7.Fhir.Model.CodeableConcept? DoseStatus [DataMember] public List DoseStatusReason { - get => _DoseStatusReason ?? new List(); + get => _DoseStatusReason ??= []; set { _DoseStatusReason = value; OnPropertyChanged("DoseStatusReason"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs index 201094064..32090ac4b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs @@ -84,7 +84,7 @@ public partial class RecommendationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List VaccineCode { - get => _VaccineCode ?? new List(); + get => _VaccineCode ??= []; set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } @@ -113,7 +113,7 @@ public Hl7.Fhir.Model.CodeableConcept? TargetDisease [DataMember] public List ContraindicatedVaccineCode { - get => _ContraindicatedVaccineCode ?? new List(); + get => _ContraindicatedVaccineCode ??= []; set { _ContraindicatedVaccineCode = value; OnPropertyChanged("ContraindicatedVaccineCode"); } } @@ -143,7 +143,7 @@ public Hl7.Fhir.Model.CodeableConcept? ForecastStatus [DataMember] public List ForecastReason { - get => _ForecastReason ?? new List(); + get => _ForecastReason ??= []; set { _ForecastReason = value; OnPropertyChanged("ForecastReason"); } } @@ -157,7 +157,7 @@ public List ForecastReason [DataMember] public List DateCriterion { - get => _DateCriterion ?? new List(); + get => _DateCriterion ??= []; set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } @@ -259,7 +259,7 @@ public Hl7.Fhir.Model.DataType? SeriesDoses [DataMember] public List SupportingImmunization { - get => _SupportingImmunization ?? new List(); + get => _SupportingImmunization ??= []; set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } @@ -275,7 +275,7 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get => _SupportingPatientInformation ?? new List(); + get => _SupportingPatientInformation ??= []; set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } @@ -579,7 +579,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -653,7 +653,7 @@ public Hl7.Fhir.Model.ResourceReference? Authority [DataMember] public List Recommendation { - get => _Recommendation ?? new List(); + get => _Recommendation ??= []; set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs index 192755dc8..b1dc5d25e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs @@ -2604,7 +2604,7 @@ public partial class DefinitionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Grouping { - get => _Grouping ?? new List(); + get => _Grouping ??= []; set { _Grouping = value; OnPropertyChanged("Grouping"); } } @@ -2618,7 +2618,7 @@ public List Grouping [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -2645,7 +2645,7 @@ public Hl7.Fhir.Model.ImplementationGuide.PageComponent? Page [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2659,7 +2659,7 @@ public List Parameter [DataMember] public List Template { - get => _Template ?? new List(); + get => _Template ??= []; set { _Template = value; OnPropertyChanged("Template"); } } @@ -2948,7 +2948,7 @@ public Hl7.Fhir.Model.ResourceReference? Reference [DataMember] public List> FhirVersionElement { - get => _FhirVersionElement ?? new List>(); + get => _FhirVersionElement ??= []; set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } @@ -3279,7 +3279,7 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation [DataMember] public List Page { - get => _Page ?? new List(); + get => _Page ??= []; set { _Page = value; OnPropertyChanged("Page"); } } @@ -3746,7 +3746,7 @@ public string? Rendering [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -3760,7 +3760,7 @@ public List Resour [DataMember] public List Page { - get => _Page ?? new List(); + get => _Page ??= []; set { _Page = value; OnPropertyChanged("Page"); } } @@ -3774,7 +3774,7 @@ public List Page [DataMember] public List ImageElement { - get => _ImageElement ?? new List(); + get => _ImageElement ??= []; set { _ImageElement = value; OnPropertyChanged("ImageElement"); } } @@ -3806,7 +3806,7 @@ public IEnumerable? Image [DataMember] public List OtherElement { - get => _OtherElement ?? new List(); + get => _OtherElement ??= []; set { _OtherElement = value; OnPropertyChanged("OtherElement"); } } @@ -4162,7 +4162,7 @@ public string? Title [DataMember] public List AnchorElement { - get => _AnchorElement ?? new List(); + get => _AnchorElement ??= []; set { _AnchorElement = value; OnPropertyChanged("AnchorElement"); } } @@ -4502,7 +4502,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -4544,7 +4544,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -4559,7 +4559,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -4662,7 +4662,7 @@ public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License [DataMember] public List> FhirVersionElement { - get => _FhirVersionElement ?? new List>(); + get => _FhirVersionElement ??= []; set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } @@ -4694,7 +4694,7 @@ public IEnumerable? FhirVersion [DataMember] public List DependsOn { - get => _DependsOn ?? new List(); + get => _DependsOn ??= []; set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } @@ -4708,7 +4708,7 @@ public List DependsOn [DataMember] public List Global { - get => _Global ?? new List(); + get => _Global ??= []; set { _Global = value; OnPropertyChanged("Global"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs b/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs index 9c5046133..15145a925 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs @@ -255,7 +255,7 @@ public Hl7.Fhir.Model.CodeableReference? Code [DataMember] public List Strength { - get => _Strength ?? new List(); + get => _Strength ??= []; set { _Strength = value; OnPropertyChanged("Strength"); } } @@ -470,7 +470,7 @@ public string? MeasurementPoint [DataMember] public List Country { - get => _Country ?? new List(); + get => _Country ??= []; set { _Country = value; OnPropertyChanged("Country"); } } @@ -484,7 +484,7 @@ public List Country [DataMember] public List ReferenceStrength { - get => _ReferenceStrength ?? new List(); + get => _ReferenceStrength ??= []; set { _ReferenceStrength = value; OnPropertyChanged("ReferenceStrength"); } } @@ -688,7 +688,7 @@ public string? MeasurementPoint [DataMember] public List Country { - get => _Country ?? new List(); + get => _Country ??= []; set { _Country = value; OnPropertyChanged("Country"); } } @@ -836,7 +836,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List For { - get => _For ?? new List(); + get => _For ??= []; set { _For = value; OnPropertyChanged("For"); } } @@ -866,7 +866,7 @@ public Hl7.Fhir.Model.CodeableConcept? Role [DataMember] public List Function { - get => _Function ?? new List(); + get => _Function ??= []; set { _Function = value; OnPropertyChanged("Function"); } } @@ -908,7 +908,7 @@ public bool? AllergenicIndicator [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs index fae5e683b..8d4fdce0e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs @@ -139,7 +139,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -286,7 +286,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -300,7 +300,7 @@ public List Network [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -451,7 +451,7 @@ public string? Requirement [DataMember] public List Limit { - get => _Limit ?? new List(); + get => _Limit ??= []; set { _Limit = value; OnPropertyChanged("Limit"); } } @@ -672,7 +672,7 @@ public partial class PlanComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -701,7 +701,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -717,7 +717,7 @@ public List CoverageArea [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -731,7 +731,7 @@ public List Network [DataMember] public List GeneralCost { - get => _GeneralCost ?? new List(); + get => _GeneralCost ??= []; set { _GeneralCost = value; OnPropertyChanged("GeneralCost"); } } @@ -745,7 +745,7 @@ public List GeneralCost [DataMember] public List SpecificCost { - get => _SpecificCost ?? new List(); + get => _SpecificCost ??= []; set { _SpecificCost = value; OnPropertyChanged("SpecificCost"); } } @@ -1081,7 +1081,7 @@ public Hl7.Fhir.Model.CodeableConcept? Category [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -1195,7 +1195,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Cost { - get => _Cost ?? new List(); + get => _Cost ??= []; set { _Cost = value; OnPropertyChanged("Cost"); } } @@ -1323,7 +1323,7 @@ public Hl7.Fhir.Model.CodeableConcept? Applicability [DataMember] public List Qualifiers { - get => _Qualifiers ?? new List(); + get => _Qualifiers ??= []; set { _Qualifiers = value; OnPropertyChanged("Qualifiers"); } } @@ -1438,7 +1438,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1483,7 +1483,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1525,7 +1525,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -1602,7 +1602,7 @@ public Hl7.Fhir.Model.ResourceReference? AdministeredBy [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -1616,7 +1616,7 @@ public List CoverageArea [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1632,7 +1632,7 @@ public List Contact [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1648,7 +1648,7 @@ public List Endpoint [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -1662,7 +1662,7 @@ public List Network [DataMember] public List Coverage { - get => _Coverage ?? new List(); + get => _Coverage ??= []; set { _Coverage = value; OnPropertyChanged("Coverage"); } } @@ -1676,7 +1676,7 @@ public List Coverage [DataMember] public List Plan { - get => _Plan ?? new List(); + get => _Plan ??= []; set { _Plan = value; OnPropertyChanged("Plan"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs index 9eda55df1..77c5cab15 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs @@ -286,7 +286,7 @@ public Hl7.Fhir.Model.DataType? ChargeItem [DataMember] public List PriceComponent { - get => _PriceComponent ?? new List(); + get => _PriceComponent ??= []; set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } @@ -568,7 +568,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -712,7 +712,7 @@ public string? Date [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -756,7 +756,7 @@ public Hl7.Fhir.Model.ResourceReference? Account [DataMember] public List LineItem { - get => _LineItem ?? new List(); + get => _LineItem ??= []; set { _LineItem = value; OnPropertyChanged("LineItem"); } } @@ -770,7 +770,7 @@ public List LineItem [DataMember] public List TotalPriceComponent { - get => _TotalPriceComponent ?? new List(); + get => _TotalPriceComponent ??= []; set { _TotalPriceComponent = value; OnPropertyChanged("TotalPriceComponent"); } } @@ -838,7 +838,7 @@ public string? PaymentTerms [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Library.cs b/src/Hl7.Fhir.R4B/Model/Generated/Library.cs index 238aa128e..1e7f9c4ca 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Library.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -371,7 +371,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -413,7 +413,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -428,7 +428,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -596,7 +596,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -610,7 +610,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -624,7 +624,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -638,7 +638,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -652,7 +652,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -666,7 +666,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -680,7 +680,7 @@ public List RelatedArtifact [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -694,7 +694,7 @@ public List Parameter [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } @@ -708,7 +708,7 @@ public List DataRequirement [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs index 22df072d2..17ed20db6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs @@ -274,7 +274,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/List.cs b/src/Hl7.Fhir.R4B/Model/Generated/List.cs index 6f21c6c19..b73612129 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/List.cs @@ -286,7 +286,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -491,7 +491,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -505,7 +505,7 @@ public List Note [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs index b1e0c0845..6a95116c2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs @@ -320,7 +320,7 @@ public partial class HoursOfOperationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -524,7 +524,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -610,7 +610,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -701,7 +701,7 @@ public Hl7.Fhir.Model.Location.LocationMode? Mode [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -715,7 +715,7 @@ public List Type [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -799,7 +799,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List HoursOfOperation { - get => _HoursOfOperation ?? new List(); + get => _HoursOfOperation ??= []; set { _HoursOfOperation = value; OnPropertyChanged("HoursOfOperation"); } } @@ -843,7 +843,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs index 5b916e161..7729f0106 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs @@ -180,7 +180,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -256,7 +256,7 @@ public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -271,7 +271,7 @@ public List Manufacturer [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -285,7 +285,7 @@ public List Ingredient [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs index a8d0b4ccb..4140a3230 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs @@ -128,7 +128,7 @@ public string? Description [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -142,7 +142,7 @@ public List Population [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -466,7 +466,7 @@ public Hl7.Fhir.Model.Expression? Criteria [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -752,7 +752,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Usage { - get => _Usage ?? new List(); + get => _Usage ??= []; set { _Usage = value; OnPropertyChanged("Usage"); } } @@ -924,7 +924,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1182,7 +1182,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1224,7 +1224,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1239,7 +1239,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1407,7 +1407,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1421,7 +1421,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1435,7 +1435,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1449,7 +1449,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1463,7 +1463,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1477,7 +1477,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1491,7 +1491,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -1580,7 +1580,7 @@ public Hl7.Fhir.Model.CodeableConcept? CompositeScoring [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1720,7 +1720,7 @@ public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation [DataMember] public List DefinitionElement { - get => _DefinitionElement ?? new List(); + get => _DefinitionElement ??= []; set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } @@ -1780,7 +1780,7 @@ public string? Guidance [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -1794,7 +1794,7 @@ public List Group [DataMember] public List SupplementalData { - get => _SupplementalData ?? new List(); + get => _SupplementalData ??= []; set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs index ada494a21..1fbd0f3b8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs @@ -162,7 +162,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -189,7 +189,7 @@ public Hl7.Fhir.Model.Quantity? MeasureScore [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -460,7 +460,7 @@ public partial class StratifierComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -474,7 +474,7 @@ public List Code [DataMember] public List Stratum { - get => _Stratum ?? new List(); + get => _Stratum ??= []; set { _Stratum = value; OnPropertyChanged("Stratum"); } } @@ -588,7 +588,7 @@ public Hl7.Fhir.Model.CodeableConcept? Value [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -602,7 +602,7 @@ public List Component [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -985,7 +985,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1176,7 +1176,7 @@ public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -1192,7 +1192,7 @@ public List Group [DataMember] public List EvaluatedResource { - get => _EvaluatedResource ?? new List(); + get => _EvaluatedResource ??= []; set { _EvaluatedResource = value; OnPropertyChanged("EvaluatedResource"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Media.cs b/src/Hl7.Fhir.R4B/Model/Generated/Media.cs index 86abb0d83..ea48d8794 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Media.cs @@ -67,7 +67,7 @@ public partial class Media : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -83,7 +83,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -99,7 +99,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -275,7 +275,7 @@ public Hl7.Fhir.Model.ResourceReference? Operator [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -472,7 +472,7 @@ public Hl7.Fhir.Model.Attachment? Content [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs b/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs index 317eaa0bf..4bd3a1ac8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs @@ -394,7 +394,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -494,7 +494,7 @@ public Hl7.Fhir.Model.Ratio? Amount [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs index 606560a88..76261bc44 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs @@ -458,7 +458,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -472,7 +472,7 @@ public List Identifier [DataMember] public List InstantiatesElement { - get => _InstantiatesElement ?? new List(); + get => _InstantiatesElement ??= []; set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -506,7 +506,7 @@ public IEnumerable? Instantiates [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -552,7 +552,7 @@ public Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCod [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -631,7 +631,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -661,7 +661,7 @@ public Hl7.Fhir.Model.DataType? Effective [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -676,7 +676,7 @@ public List Performe [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -692,7 +692,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -723,7 +723,7 @@ public Hl7.Fhir.Model.ResourceReference? Request [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -737,7 +737,7 @@ public List Device [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -766,7 +766,7 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs index b8aabd235..6981a28cc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs @@ -310,7 +310,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -326,7 +326,7 @@ public List Reason [DataMember] public List ResponsibleParty { - get => _ResponsibleParty ?? new List(); + get => _ResponsibleParty ??= []; set { _ResponsibleParty = value; OnPropertyChanged("ResponsibleParty"); } } @@ -428,7 +428,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -444,7 +444,7 @@ public List Identifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -570,7 +570,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -584,7 +584,7 @@ public List SupportingInformation [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -615,7 +615,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List AuthorizingPrescription { - get => _AuthorizingPrescription ?? new List(); + get => _AuthorizingPrescription ??= []; set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } @@ -742,7 +742,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } @@ -756,7 +756,7 @@ public List Receiver [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -770,7 +770,7 @@ public List Note [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -799,7 +799,7 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution [DataMember] public List DetectedIssue { - get => _DetectedIssue ?? new List(); + get => _DetectedIssue ??= []; set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } @@ -815,7 +815,7 @@ public List DetectedIssue [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs index 0e58a847e..30d977992 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs @@ -130,7 +130,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -772,7 +772,7 @@ public partial class AdministrationGuidelinesComponent : Hl7.Fhir.Model.Backbone [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -802,7 +802,7 @@ public Hl7.Fhir.Model.DataType? Indication [DataMember] public List PatientCharacteristics { - get => _PatientCharacteristics ?? new List(); + get => _PatientCharacteristics ??= []; set { _PatientCharacteristics = value; OnPropertyChanged("PatientCharacteristics"); } } @@ -922,7 +922,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -1038,7 +1038,7 @@ public Hl7.Fhir.Model.DataType? Characteristic [DataMember] public List ValueElement { - get => _ValueElement ?? new List(); + get => _ValueElement ??= []; set { _ValueElement = value; OnPropertyChanged("ValueElement"); } } @@ -1167,7 +1167,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -1508,7 +1508,7 @@ public Hl7.Fhir.Model.ResourceReference? RegulatoryAuthority [DataMember] public List Substitution { - get => _Substitution ?? new List(); + get => _Substitution ??= []; set { _Substitution = value; OnPropertyChanged("Substitution"); } } @@ -1522,7 +1522,7 @@ public List Substituti [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -1974,7 +1974,7 @@ public partial class KineticsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List AreaUnderCurve { - get => _AreaUnderCurve ?? new List(); + get => _AreaUnderCurve ??= []; set { _AreaUnderCurve = value; OnPropertyChanged("AreaUnderCurve"); } } @@ -1988,7 +1988,7 @@ public List AreaUnderCurve [DataMember] public List LethalDose50 { - get => _LethalDose50 ?? new List(); + get => _LethalDose50 ??= []; set { _LethalDose50 = value; OnPropertyChanged("LethalDose50"); } } @@ -2180,7 +2180,7 @@ public Hl7.Fhir.Model.Quantity? Amount [DataMember] public List SynonymElement { - get => _SynonymElement ?? new List(); + get => _SynonymElement ??= []; set { _SynonymElement = value; OnPropertyChanged("SynonymElement"); } } @@ -2212,7 +2212,7 @@ public IEnumerable? Synonym [DataMember] public List RelatedMedicationKnowledge { - get => _RelatedMedicationKnowledge ?? new List(); + get => _RelatedMedicationKnowledge ??= []; set { _RelatedMedicationKnowledge = value; OnPropertyChanged("RelatedMedicationKnowledge"); } } @@ -2228,7 +2228,7 @@ public List AssociatedMedication { - get => _AssociatedMedication ?? new List(); + get => _AssociatedMedication ??= []; set { _AssociatedMedication = value; OnPropertyChanged("AssociatedMedication"); } } @@ -2242,7 +2242,7 @@ public List AssociatedMedication [DataMember] public List ProductType { - get => _ProductType ?? new List(); + get => _ProductType ??= []; set { _ProductType = value; OnPropertyChanged("ProductType"); } } @@ -2256,7 +2256,7 @@ public List ProductType [DataMember] public List Monograph { - get => _Monograph ?? new List(); + get => _Monograph ??= []; set { _Monograph = value; OnPropertyChanged("Monograph"); } } @@ -2270,7 +2270,7 @@ public List Monograph [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -2313,7 +2313,7 @@ public string? PreparationInstruction [DataMember] public List IntendedRoute { - get => _IntendedRoute ?? new List(); + get => _IntendedRoute ??= []; set { _IntendedRoute = value; OnPropertyChanged("IntendedRoute"); } } @@ -2327,7 +2327,7 @@ public List IntendedRoute [DataMember] public List Cost { - get => _Cost ?? new List(); + get => _Cost ??= []; set { _Cost = value; OnPropertyChanged("Cost"); } } @@ -2341,7 +2341,7 @@ public List Cost [DataMember] public List MonitoringProgram { - get => _MonitoringProgram ?? new List(); + get => _MonitoringProgram ??= []; set { _MonitoringProgram = value; OnPropertyChanged("MonitoringProgram"); } } @@ -2355,7 +2355,7 @@ public List Monit [DataMember] public List AdministrationGuidelines { - get => _AdministrationGuidelines ?? new List(); + get => _AdministrationGuidelines ??= []; set { _AdministrationGuidelines = value; OnPropertyChanged("AdministrationGuidelines"); } } @@ -2369,7 +2369,7 @@ public List MedicineClassification { - get => _MedicineClassification ?? new List(); + get => _MedicineClassification ??= []; set { _MedicineClassification = value; OnPropertyChanged("MedicineClassification"); } } @@ -2396,7 +2396,7 @@ public Hl7.Fhir.Model.MedicationKnowledge.PackagingComponent? Packaging [DataMember] public List DrugCharacteristic { - get => _DrugCharacteristic ?? new List(); + get => _DrugCharacteristic ??= []; set { _DrugCharacteristic = value; OnPropertyChanged("DrugCharacteristic"); } } @@ -2412,7 +2412,7 @@ public List Drug [DataMember] public List Contraindication { - get => _Contraindication ?? new List(); + get => _Contraindication ??= []; set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } @@ -2426,7 +2426,7 @@ public List Contraindication [DataMember] public List Regulatory { - get => _Regulatory ?? new List(); + get => _Regulatory ??= []; set { _Regulatory = value; OnPropertyChanged("Regulatory"); } } @@ -2440,7 +2440,7 @@ public List Regulatory [DataMember] public List Kinetics { - get => _Kinetics ?? new List(); + get => _Kinetics ??= []; set { _Kinetics = value; OnPropertyChanged("Kinetics"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs index 7cc41848a..8d6f91b31 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs @@ -655,7 +655,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -746,7 +746,7 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -885,7 +885,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -987,7 +987,7 @@ public Hl7.Fhir.Model.ResourceReference? Recorder [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1003,7 +1003,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1017,7 +1017,7 @@ public List ReasonReference [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1049,7 +1049,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1083,7 +1083,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1126,7 +1126,7 @@ public Hl7.Fhir.Model.CodeableConcept? CourseOfTherapyType [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1140,7 +1140,7 @@ public List Insurance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1154,7 +1154,7 @@ public List Note [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -1211,7 +1211,7 @@ public Hl7.Fhir.Model.ResourceReference? PriorPrescription [DataMember] public List DetectedIssue { - get => _DetectedIssue ?? new List(); + get => _DetectedIssue ??= []; set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } @@ -1227,7 +1227,7 @@ public List DetectedIssue [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs index 3e25a5165..e3ada5c76 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs @@ -139,7 +139,7 @@ public enum MedicationStatementStatusCodes [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -155,7 +155,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -171,7 +171,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -217,7 +217,7 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatusCodes? Status [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -354,7 +354,7 @@ public Hl7.Fhir.Model.ResourceReference? InformationSource [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -369,7 +369,7 @@ public List DerivedFrom [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -385,7 +385,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -399,7 +399,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -413,7 +413,7 @@ public List Note [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs index 6402aeff0..380493bd7 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs @@ -239,7 +239,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List NamePart { - get => _NamePart ?? new List(); + get => _NamePart ??= []; set { _NamePart = value; OnPropertyChanged("NamePart"); } } @@ -253,7 +253,7 @@ public List NamePar [DataMember] public List CountryLanguage { - get => _CountryLanguage ?? new List(); + get => _CountryLanguage ??= []; set { _CountryLanguage = value; OnPropertyChanged("CountryLanguage"); } } @@ -779,7 +779,7 @@ public Hl7.Fhir.Model.Period? EffectiveDate [DataMember] public List Organization { - get => _Organization ?? new List(); + get => _Organization ??= []; set { _Organization = value; OnPropertyChanged("Organization"); } } @@ -1011,7 +1011,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1166,7 +1166,7 @@ public Hl7.Fhir.Model.CodeableConcept? CombinedPharmaceuticalDoseForm [DataMember] public List Route { - get => _Route ?? new List(); + get => _Route ??= []; set { _Route = value; OnPropertyChanged("Route"); } } @@ -1237,7 +1237,7 @@ public Hl7.Fhir.Model.CodeableConcept? AdditionalMonitoringIndicator [DataMember] public List SpecialMeasures { - get => _SpecialMeasures ?? new List(); + get => _SpecialMeasures ??= []; set { _SpecialMeasures = value; OnPropertyChanged("SpecialMeasures"); } } @@ -1266,7 +1266,7 @@ public Hl7.Fhir.Model.CodeableConcept? PediatricUseIndicator [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -1280,7 +1280,7 @@ public List Classification [DataMember] public List MarketingStatus { - get => _MarketingStatus ?? new List(); + get => _MarketingStatus ??= []; set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } @@ -1295,7 +1295,7 @@ public List MarketingStatus [DataMember] public List PackagedMedicinalProduct { - get => _PackagedMedicinalProduct ?? new List(); + get => _PackagedMedicinalProduct ??= []; set { _PackagedMedicinalProduct = value; OnPropertyChanged("PackagedMedicinalProduct"); } } @@ -1310,7 +1310,7 @@ public List PackagedMedicinalProduct [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -1325,7 +1325,7 @@ public List Ingredient [DataMember] public List Impurity { - get => _Impurity ?? new List(); + get => _Impurity ??= []; set { _Impurity = value; OnPropertyChanged("Impurity"); } } @@ -1341,7 +1341,7 @@ public List Impurity [DataMember] public List AttachedDocument { - get => _AttachedDocument ?? new List(); + get => _AttachedDocument ??= []; set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } @@ -1357,7 +1357,7 @@ public List AttachedDocument [DataMember] public List MasterFile { - get => _MasterFile ?? new List(); + get => _MasterFile ??= []; set { _MasterFile = value; OnPropertyChanged("MasterFile"); } } @@ -1371,7 +1371,7 @@ public List MasterFile [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1387,7 +1387,7 @@ public List Contact [DataMember] public List ClinicalTrial { - get => _ClinicalTrial ?? new List(); + get => _ClinicalTrial ??= []; set { _ClinicalTrial = value; OnPropertyChanged("ClinicalTrial"); } } @@ -1402,7 +1402,7 @@ public List ClinicalTrial [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -1416,7 +1416,7 @@ public List Code [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -1430,7 +1430,7 @@ public List Name [DataMember] public List CrossReference { - get => _CrossReference ?? new List(); + get => _CrossReference ??= []; set { _CrossReference = value; OnPropertyChanged("CrossReference"); } } @@ -1444,7 +1444,7 @@ public List C [DataMember] public List Operation { - get => _Operation ?? new List(); + get => _Operation ??= []; set { _Operation = value; OnPropertyChanged("Operation"); } } @@ -1458,7 +1458,7 @@ public List Operat [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs index 67ccd8774..482932277 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs @@ -491,7 +491,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -589,7 +589,7 @@ public string? Title [DataMember] public List ReplacesElement { - get => _ReplacesElement ?? new List(); + get => _ReplacesElement ??= []; set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } @@ -737,7 +737,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -779,7 +779,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -794,7 +794,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -892,7 +892,7 @@ public string? Base [DataMember] public List ParentElement { - get => _ParentElement ?? new List(); + get => _ParentElement ??= []; set { _ParentElement = value; OnPropertyChanged("ParentElement"); } } @@ -971,7 +971,7 @@ public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -1015,7 +1015,7 @@ public Hl7.Fhir.Model.MessageheaderResponseRequest? ResponseRequired [DataMember] public List AllowedResponse { - get => _AllowedResponse ?? new List(); + get => _AllowedResponse ??= []; set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } @@ -1029,7 +1029,7 @@ public List AllowedRe [DataMember] public List GraphElement { - get => _GraphElement ?? new List(); + get => _GraphElement ??= []; set { _GraphElement = value; OnPropertyChanged("GraphElement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs index 233d346fc..58f0d88c0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs @@ -716,7 +716,7 @@ public Hl7.Fhir.Model.DataType? Event [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -833,7 +833,7 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs index 44483ec04..5ad3f3cc6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs @@ -1435,7 +1435,7 @@ public partial class RocComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ScoreElement { - get => _ScoreElement ?? new List(); + get => _ScoreElement ??= []; set { _ScoreElement = value; OnPropertyChanged("ScoreElement"); } } @@ -1467,7 +1467,7 @@ public IEnumerable? Score [DataMember] public List NumTPElement { - get => _NumTPElement ?? new List(); + get => _NumTPElement ??= []; set { _NumTPElement = value; OnPropertyChanged("NumTPElement"); } } @@ -1499,7 +1499,7 @@ public IEnumerable? NumTP [DataMember] public List NumFPElement { - get => _NumFPElement ?? new List(); + get => _NumFPElement ??= []; set { _NumFPElement = value; OnPropertyChanged("NumFPElement"); } } @@ -1531,7 +1531,7 @@ public IEnumerable? NumFP [DataMember] public List NumFNElement { - get => _NumFNElement ?? new List(); + get => _NumFNElement ??= []; set { _NumFNElement = value; OnPropertyChanged("NumFNElement"); } } @@ -1563,7 +1563,7 @@ public IEnumerable? NumFN [DataMember] public List PrecisionElement { - get => _PrecisionElement ?? new List(); + get => _PrecisionElement ??= []; set { _PrecisionElement = value; OnPropertyChanged("PrecisionElement"); } } @@ -1595,7 +1595,7 @@ public IEnumerable? Precision [DataMember] public List SensitivityElement { - get => _SensitivityElement ?? new List(); + get => _SensitivityElement ??= []; set { _SensitivityElement = value; OnPropertyChanged("SensitivityElement"); } } @@ -1627,7 +1627,7 @@ public IEnumerable? Sensitivity [DataMember] public List FMeasureElement { - get => _FMeasureElement ?? new List(); + get => _FMeasureElement ??= []; set { _FMeasureElement = value; OnPropertyChanged("FMeasureElement"); } } @@ -2554,7 +2554,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2713,7 +2713,7 @@ public Hl7.Fhir.Model.MolecularSequence.ReferenceSeqComponent? ReferenceSeq [DataMember] public List Variant { - get => _Variant ?? new List(); + get => _Variant ??= []; set { _Variant = value; OnPropertyChanged("Variant"); } } @@ -2755,7 +2755,7 @@ public string? ObservedSeq [DataMember] public List Quality { - get => _Quality ?? new List(); + get => _Quality ??= []; set { _Quality = value; OnPropertyChanged("Quality"); } } @@ -2797,7 +2797,7 @@ public int? ReadCoverage [DataMember] public List Repository { - get => _Repository ?? new List(); + get => _Repository ??= []; set { _Repository = value; OnPropertyChanged("Repository"); } } @@ -2813,7 +2813,7 @@ public List Repository [DataMember] public List Pointer { - get => _Pointer ?? new List(); + get => _Pointer ??= []; set { _Pointer = value; OnPropertyChanged("Pointer"); } } @@ -2827,7 +2827,7 @@ public List Pointer [DataMember] public List StructureVariant { - get => _StructureVariant ?? new List(); + get => _StructureVariant ??= []; set { _StructureVariant = value; OnPropertyChanged("StructureVariant"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs index 6a1997fa5..0fa799cb7 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs @@ -523,7 +523,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -607,7 +607,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -622,7 +622,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -664,7 +664,7 @@ public string? Usage [DataMember] public List UniqueId { - get => _UniqueId ?? new List(); + get => _UniqueId ??= []; set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs index 827886559..2e6677897 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs @@ -88,7 +88,7 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -102,7 +102,7 @@ public List Type [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -116,7 +116,7 @@ public List Schedule [DataMember] public List Nutrient { - get => _Nutrient ?? new List(); + get => _Nutrient ??= []; set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } @@ -130,7 +130,7 @@ public List Nutrient [DataMember] public List Texture { - get => _Texture ?? new List(); + get => _Texture ??= []; set { _Texture = value; OnPropertyChanged("Texture"); } } @@ -145,7 +145,7 @@ public List Texture [DataMember] public List FluidConsistencyType { - get => _FluidConsistencyType ?? new List(); + get => _FluidConsistencyType ??= []; set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } @@ -578,7 +578,7 @@ public string? ProductName [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -857,7 +857,7 @@ public Hl7.Fhir.Model.CodeableConcept? RouteofAdministration [DataMember] public List Administration { - get => _Administration ?? new List(); + get => _Administration ??= []; set { _Administration = value; OnPropertyChanged("Administration"); } } @@ -1182,7 +1182,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1196,7 +1196,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1228,7 +1228,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1260,7 +1260,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List InstantiatesElement { - get => _InstantiatesElement ?? new List(); + get => _InstantiatesElement ??= []; set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -1431,7 +1431,7 @@ public Hl7.Fhir.Model.ResourceReference? Orderer [DataMember] public List AllergyIntolerance { - get => _AllergyIntolerance ?? new List(); + get => _AllergyIntolerance ??= []; set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } @@ -1446,7 +1446,7 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get => _FoodPreferenceModifier ?? new List(); + get => _FoodPreferenceModifier ??= []; set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } @@ -1461,7 +1461,7 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get => _ExcludeFoodModifier ?? new List(); + get => _ExcludeFoodModifier ??= []; set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } @@ -1488,7 +1488,7 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet [DataMember] public List Supplement { - get => _Supplement ?? new List(); + get => _Supplement ??= []; set { _Supplement = value; OnPropertyChanged("Supplement"); } } @@ -1515,7 +1515,7 @@ public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? EnteralFormula [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs b/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs index 1e684ab32..da61f5992 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs @@ -128,7 +128,7 @@ public Hl7.Fhir.Model.CodeableReference? Item [DataMember] public List Amount { - get => _Amount ?? new List(); + get => _Amount ??= []; set { _Amount = value; OnPropertyChanged("Amount"); } } @@ -239,7 +239,7 @@ public Hl7.Fhir.Model.CodeableReference? Item [DataMember] public List Amount { - get => _Amount ?? new List(); + get => _Amount ??= []; set { _Amount = value; OnPropertyChanged("Amount"); } } @@ -466,7 +466,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -693,7 +693,7 @@ public Hl7.Fhir.Model.NutritionProduct.NutritionProductStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -723,7 +723,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -737,7 +737,7 @@ public List Manufacturer [DataMember] public List Nutrient { - get => _Nutrient ?? new List(); + get => _Nutrient ??= []; set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } @@ -751,7 +751,7 @@ public List Nutrient [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -766,7 +766,7 @@ public List Ingredient [DataMember] public List KnownAllergen { - get => _KnownAllergen ?? new List(); + get => _KnownAllergen ??= []; set { _KnownAllergen = value; OnPropertyChanged("KnownAllergen"); } } @@ -780,7 +780,7 @@ public List KnownAllergen [DataMember] public List ProductCharacteristic { - get => _ProductCharacteristic ?? new List(); + get => _ProductCharacteristic ??= []; set { _ProductCharacteristic = value; OnPropertyChanged("ProductCharacteristic"); } } @@ -807,7 +807,7 @@ public Hl7.Fhir.Model.NutritionProduct.InstanceComponent? Instance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs index d516d3cd4..37ea92f9b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs @@ -129,7 +129,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List AppliesTo { - get => _AppliesTo ?? new List(); + get => _AppliesTo ??= []; set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } @@ -352,7 +352,7 @@ public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason [DataMember] public List Interpretation { - get => _Interpretation ?? new List(); + get => _Interpretation ??= []; set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } @@ -366,7 +366,7 @@ public List Interpretation [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -477,7 +477,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -493,7 +493,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -509,7 +509,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -555,7 +555,7 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -601,7 +601,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -675,7 +675,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -719,7 +719,7 @@ public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason [DataMember] public List Interpretation { - get => _Interpretation ?? new List(); + get => _Interpretation ??= []; set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } @@ -733,7 +733,7 @@ public List Interpretation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -805,7 +805,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -821,7 +821,7 @@ public List ReferenceRange [DataMember] public List HasMember { - get => _HasMember ?? new List(); + get => _HasMember ??= []; set { _HasMember = value; OnPropertyChanged("HasMember"); } } @@ -837,7 +837,7 @@ public List HasMember [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -851,7 +851,7 @@ public List DerivedFrom [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs index 7b7fcbbe0..ebfd45bf4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs @@ -437,7 +437,7 @@ public Hl7.Fhir.Model.CodeableConcept? Context [DataMember] public List AppliesTo { - get => _AppliesTo ?? new List(); + get => _AppliesTo ??= []; set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } @@ -660,7 +660,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -689,7 +689,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -705,7 +705,7 @@ public List Identifier [DataMember] public List> PermittedDataTypeElement { - get => _PermittedDataTypeElement ?? new List>(); + get => _PermittedDataTypeElement ??= []; set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } @@ -820,7 +820,7 @@ public Hl7.Fhir.Model.ObservationDefinition.QuantitativeDetailsComponent? Quanti [DataMember] public List QualifiedInterval { - get => _QualifiedInterval ?? new List(); + get => _QualifiedInterval ??= []; set { _QualifiedInterval = value; OnPropertyChanged("QualifiedInterval"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs index 0ea701250..958f60f07 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs @@ -285,7 +285,7 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List TargetProfileElement { - get => _TargetProfileElement ?? new List(); + get => _TargetProfileElement ??= []; set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } @@ -360,7 +360,7 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding [DataMember] public List ReferencedFrom { - get => _ReferencedFrom ?? new List(); + get => _ReferencedFrom ??= []; set { _ReferencedFrom = value; OnPropertyChanged("ReferencedFrom"); } } @@ -374,7 +374,7 @@ public List Referenc [DataMember] public List Part { - get => _Part ?? new List(); + get => _Part ??= []; set { _Part = value; OnPropertyChanged("Part"); } } @@ -846,7 +846,7 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get => _ParameterNameElement ?? new List(); + get => _ParameterNameElement ??= []; set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } @@ -1235,7 +1235,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1277,7 +1277,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1292,7 +1292,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1449,7 +1449,7 @@ public string? Base [DataMember] public List> ResourceElement { - get => _ResourceElement ?? new List>(); + get => _ResourceElement ??= []; set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } @@ -1624,7 +1624,7 @@ public string? OutputProfile [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1638,7 +1638,7 @@ public List Parameter [DataMember] public List Overload { - get => _Overload ?? new List(); + get => _Overload ??= []; set { _Overload = value; OnPropertyChanged("Overload"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs index 579da4fe8..407b7aab3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs @@ -113,7 +113,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -228,7 +228,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -271,7 +271,7 @@ public bool? Active [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -313,7 +313,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -345,7 +345,7 @@ public IEnumerable? Alias [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -359,7 +359,7 @@ public List Telecom [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -388,7 +388,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -404,7 +404,7 @@ public List Contact [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs index 76cc91e78..eb5cf2aaa 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs @@ -67,7 +67,7 @@ public partial class OrganizationAffiliation : Hl7.Fhir.Model.DomainResource, II [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -154,7 +154,7 @@ public Hl7.Fhir.Model.ResourceReference? ParticipatingOrganization [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -169,7 +169,7 @@ public List Network [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -184,7 +184,7 @@ public List Code [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -200,7 +200,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -216,7 +216,7 @@ public List Location [DataMember] public List HealthcareService { - get => _HealthcareService ?? new List(); + get => _HealthcareService ??= []; set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } @@ -230,7 +230,7 @@ public List HealthcareService [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -246,7 +246,7 @@ public List Telecom [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs index 2bae35cb5..724a8db47 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs @@ -194,7 +194,7 @@ public partial class PackageComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -251,7 +251,7 @@ public int? Quantity [DataMember] public List Material { - get => _Material ?? new List(); + get => _Material ??= []; set { _Material = value; OnPropertyChanged("Material"); } } @@ -266,7 +266,7 @@ public List Material [DataMember] public List AlternateMaterial { - get => _AlternateMaterial ?? new List(); + get => _AlternateMaterial ??= []; set { _AlternateMaterial = value; OnPropertyChanged("AlternateMaterial"); } } @@ -280,7 +280,7 @@ public List AlternateMaterial [DataMember] public List ShelfLifeStorage { - get => _ShelfLifeStorage ?? new List(); + get => _ShelfLifeStorage ??= []; set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } @@ -296,7 +296,7 @@ public List [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -310,7 +310,7 @@ public List Manufacturer [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -324,7 +324,7 @@ public List Property [DataMember] public List ContainedItem { - get => _ContainedItem ?? new List(); + get => _ContainedItem ??= []; set { _ContainedItem = value; OnPropertyChanged("ContainedItem"); } } @@ -338,7 +338,7 @@ public List Con [DataMember] public List Package { - get => _Package ?? new List(); + get => _Package ??= []; set { _Package = value; OnPropertyChanged("Package"); } } @@ -535,7 +535,7 @@ public Hl7.Fhir.Model.DataType? Period [DataMember] public List SpecialPrecautionsForStorage { - get => _SpecialPrecautionsForStorage ?? new List(); + get => _SpecialPrecautionsForStorage ??= []; set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } @@ -851,7 +851,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -909,7 +909,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List PackageFor { - get => _PackageFor ?? new List(); + get => _PackageFor ??= []; set { _PackageFor = value; OnPropertyChanged("PackageFor"); } } @@ -965,7 +965,7 @@ public string? StatusDate [DataMember] public List ContainedItemQuantity { - get => _ContainedItemQuantity ?? new List(); + get => _ContainedItemQuantity ??= []; set { _ContainedItemQuantity = value; OnPropertyChanged("ContainedItemQuantity"); } } @@ -1007,7 +1007,7 @@ public string? Description [DataMember] public List LegalStatusOfSupply { - get => _LegalStatusOfSupply ?? new List(); + get => _LegalStatusOfSupply ??= []; set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } @@ -1021,7 +1021,7 @@ public List MarketingStatus { - get => _MarketingStatus ?? new List(); + get => _MarketingStatus ??= []; set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } @@ -1036,7 +1036,7 @@ public List MarketingStatus [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -1080,7 +1080,7 @@ public bool? CopackagedIndicator [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs b/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs index 3b9482979..4886045be 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs @@ -121,7 +121,7 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } @@ -148,7 +148,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -611,7 +611,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -653,7 +653,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -667,7 +667,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -754,7 +754,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -797,7 +797,7 @@ public Hl7.Fhir.Model.DataType? MultipleBirth [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -811,7 +811,7 @@ public List Photo [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -825,7 +825,7 @@ public List Contact [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -841,7 +841,7 @@ public List Communication [DataMember] public List GeneralPractitioner { - get => _GeneralPractitioner ?? new List(); + get => _GeneralPractitioner ??= []; set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } @@ -870,7 +870,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs index e7a24ae2f..31bd2198c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs @@ -70,7 +70,7 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs index 5e6621962..223ec7aa6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs @@ -529,7 +529,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -775,7 +775,7 @@ public Hl7.Fhir.Model.Identifier? PaymentIdentifier [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -803,7 +803,7 @@ public Hl7.Fhir.Model.CodeableConcept? FormCode [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Person.cs b/src/Hl7.Fhir.R4B/Model/Generated/Person.cs index 6dc25ae42..430734c67 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Person.cs @@ -234,7 +234,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -248,7 +248,7 @@ public List Identifier [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -262,7 +262,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -334,7 +334,7 @@ public string? BirthDate [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -404,7 +404,7 @@ public bool? Active [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs index c6ae3071f..81b6bb78e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.CodeableConcept? Start [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -158,7 +158,7 @@ public List Addresses [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -172,7 +172,7 @@ public List Documentation [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -598,7 +598,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -613,7 +613,7 @@ public List Code [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -627,7 +627,7 @@ public List Reason [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -641,7 +641,7 @@ public List Documentation [DataMember] public List GoalIdElement { - get => _GoalIdElement ?? new List(); + get => _GoalIdElement ??= []; set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } @@ -690,7 +690,7 @@ public Hl7.Fhir.Model.DataType? Subject [DataMember] public List Trigger { - get => _Trigger ?? new List(); + get => _Trigger ??= []; set { _Trigger = value; OnPropertyChanged("Trigger"); } } @@ -704,7 +704,7 @@ public List Trigger [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -718,7 +718,7 @@ public List Condition [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -732,7 +732,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } @@ -746,7 +746,7 @@ public List Output [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -775,7 +775,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -996,7 +996,7 @@ public string? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } @@ -1010,7 +1010,7 @@ public List DynamicValue [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1908,7 +1908,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2180,7 +2180,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2222,7 +2222,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2237,7 +2237,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2405,7 +2405,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -2419,7 +2419,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -2433,7 +2433,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -2447,7 +2447,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -2461,7 +2461,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -2475,7 +2475,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2489,7 +2489,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -2521,7 +2521,7 @@ public IEnumerable? Library [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -2535,7 +2535,7 @@ public List Goal [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs index adcbe0745..a7181a1de 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs @@ -86,7 +86,7 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -231,7 +231,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -273,7 +273,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -287,7 +287,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -301,7 +301,7 @@ public List Telecom [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -373,7 +373,7 @@ public string? BirthDate [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -387,7 +387,7 @@ public List Photo [DataMember] public List Qualification { - get => _Qualification ?? new List(); + get => _Qualification ??= []; set { _Qualification = value; OnPropertyChanged("Qualification"); } } @@ -402,7 +402,7 @@ public List Qualification [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs index 579005148..63490d2ac 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs @@ -89,7 +89,7 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -421,7 +421,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -507,7 +507,7 @@ public Hl7.Fhir.Model.ResourceReference? Organization [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -522,7 +522,7 @@ public List Code [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -538,7 +538,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -554,7 +554,7 @@ public List Location [DataMember] public List HealthcareService { - get => _HealthcareService ?? new List(); + get => _HealthcareService ??= []; set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } @@ -568,7 +568,7 @@ public List HealthcareService [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -582,7 +582,7 @@ public List Telecom [DataMember] public List AvailableTime { - get => _AvailableTime ?? new List(); + get => _AvailableTime ??= []; set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } @@ -596,7 +596,7 @@ public List AvailableTim [DataMember] public List NotAvailable { - get => _NotAvailable ?? new List(); + get => _NotAvailable ??= []; set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } @@ -640,7 +640,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs index 795ab52ed..d6ac7b45c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs @@ -326,7 +326,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -340,7 +340,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -372,7 +372,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -406,7 +406,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -422,7 +422,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -585,7 +585,7 @@ public Hl7.Fhir.Model.ResourceReference? Asserter [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -615,7 +615,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -631,7 +631,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -646,7 +646,7 @@ public List ReasonReference [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -676,7 +676,7 @@ public Hl7.Fhir.Model.CodeableConcept? Outcome [DataMember] public List Report { - get => _Report ?? new List(); + get => _Report ??= []; set { _Report = value; OnPropertyChanged("Report"); } } @@ -691,7 +691,7 @@ public List Report [DataMember] public List Complication { - get => _Complication ?? new List(); + get => _Complication ??= []; set { _Complication = value; OnPropertyChanged("Complication"); } } @@ -707,7 +707,7 @@ public List Complication [DataMember] public List ComplicationDetail { - get => _ComplicationDetail ?? new List(); + get => _ComplicationDetail ??= []; set { _ComplicationDetail = value; OnPropertyChanged("ComplicationDetail"); } } @@ -722,7 +722,7 @@ public List ComplicationDetail [DataMember] public List FollowUp { - get => _FollowUp ?? new List(); + get => _FollowUp ??= []; set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } @@ -736,7 +736,7 @@ public List FollowUp [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -750,7 +750,7 @@ public List Note [DataMember] public List FocalDevice { - get => _FocalDevice ?? new List(); + get => _FocalDevice ??= []; set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } @@ -766,7 +766,7 @@ public List FocalDevice [DataMember] public List UsedReference { - get => _UsedReference ?? new List(); + get => _UsedReference ??= []; set { _UsedReference = value; OnPropertyChanged("UsedReference"); } } @@ -781,7 +781,7 @@ public List UsedReference [DataMember] public List UsedCode { - get => _UsedCode ?? new List(); + get => _UsedCode ??= []; set { _UsedCode = value; OnPropertyChanged("UsedCode"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs index b69467790..1639341dc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs @@ -173,7 +173,7 @@ public string? Shape [DataMember] public List ColorElement { - get => _ColorElement ?? new List(); + get => _ColorElement ??= []; set { _ColorElement = value; OnPropertyChanged("ColorElement"); } } @@ -205,7 +205,7 @@ public IEnumerable? Color [DataMember] public List ImprintElement { - get => _ImprintElement ?? new List(); + get => _ImprintElement ??= []; set { _ImprintElement = value; OnPropertyChanged("ImprintElement"); } } @@ -237,7 +237,7 @@ public IEnumerable? Imprint [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs index 2d043de7c..53ffa0412 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs @@ -108,7 +108,7 @@ public Hl7.Fhir.Model.Quantity? Period [DataMember] public List SpecialPrecautionsForStorage { - get => _SpecialPrecautionsForStorage ?? new List(); + get => _SpecialPrecautionsForStorage ??= []; set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs index 3401ac0c9..0c3395052 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs @@ -143,7 +143,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.ResourceReference? What [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -431,7 +431,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -489,7 +489,7 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -565,7 +565,7 @@ public Hl7.Fhir.Model.CodeableConcept? Activity [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -579,7 +579,7 @@ public List Agent [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } @@ -593,7 +593,7 @@ public List Entity [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs index df38e15a3..4a122dba4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs @@ -331,7 +331,7 @@ public string? Definition [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -432,7 +432,7 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get => _EnableWhen ?? new List(); + get => _EnableWhen ??= []; set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } @@ -616,7 +616,7 @@ public string? AnswerValueSet [DataMember] public List AnswerOption { - get => _AnswerOption ?? new List(); + get => _AnswerOption ??= []; set { _AnswerOption = value; OnPropertyChanged("AnswerOption"); } } @@ -630,7 +630,7 @@ public List AnswerOption [DataMember] public List Initial { - get => _Initial ?? new List(); + get => _Initial ??= []; set { _Initial = value; OnPropertyChanged("Initial"); } } @@ -644,7 +644,7 @@ public List Initial [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -1285,7 +1285,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1383,7 +1383,7 @@ public string? Title [DataMember] public List DerivedFromElement { - get => _DerivedFromElement ?? new List(); + get => _DerivedFromElement ??= []; set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } @@ -1476,7 +1476,7 @@ public bool? Experimental [DataMember] public List> SubjectTypeElement { - get => _SubjectTypeElement ?? new List>(); + get => _SubjectTypeElement ??= []; set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } @@ -1564,7 +1564,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1606,7 +1606,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1621,7 +1621,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1761,7 +1761,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -1775,7 +1775,7 @@ public List Code [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs index af0c6373e..e6b1071a5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs @@ -213,7 +213,7 @@ public string? Text [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -227,7 +227,7 @@ public List Answer [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -372,7 +372,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -471,7 +471,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -487,7 +487,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -648,7 +648,7 @@ public Hl7.Fhir.Model.ResourceReference? Source [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs b/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs index 7a221c814..b3bc9ea19 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs @@ -142,7 +142,7 @@ public Hl7.Fhir.Model.DataType? Date [DataMember] public List Application { - get => _Application ?? new List(); + get => _Application ??= []; set { _Application = value; OnPropertyChanged("Application"); } } @@ -253,7 +253,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -269,7 +269,7 @@ public List Identifier [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -326,7 +326,7 @@ public string? Description [DataMember] public List Region { - get => _Region ?? new List(); + get => _Region ??= []; set { _Region = value; OnPropertyChanged("Region"); } } @@ -423,7 +423,7 @@ public Hl7.Fhir.Model.CodeableConcept? IntendedUse [DataMember] public List Basis { - get => _Basis ?? new List(); + get => _Basis ??= []; set { _Basis = value; OnPropertyChanged("Basis"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs index 45cffd184..52e0b1e2c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs @@ -199,7 +199,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -258,7 +258,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } @@ -272,7 +272,7 @@ public List Relationship [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -286,7 +286,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -358,7 +358,7 @@ public string? BirthDate [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -372,7 +372,7 @@ public List Address [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -399,7 +399,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs index a870e57bf..a47ce43d9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs @@ -228,7 +228,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -242,7 +242,7 @@ public List Code [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -256,7 +256,7 @@ public List Documentation [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -270,7 +270,7 @@ public List Condition [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -301,7 +301,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -494,7 +494,7 @@ public Hl7.Fhir.Model.ResourceReference? Resource [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1032,7 +1032,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1046,7 +1046,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1078,7 +1078,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1112,7 +1112,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1128,7 +1128,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -1333,7 +1333,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -1349,7 +1349,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -1363,7 +1363,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1377,7 +1377,7 @@ public List Note [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs index 7ad658580..33a13d938 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -384,7 +384,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -426,7 +426,7 @@ public string? Description [DataMember] public List CommentElement { - get => _CommentElement ?? new List(); + get => _CommentElement ??= []; set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } @@ -458,7 +458,7 @@ public IEnumerable? Comment [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -473,7 +473,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -641,7 +641,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -655,7 +655,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -669,7 +669,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -683,7 +683,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -697,7 +697,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -711,7 +711,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -725,7 +725,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs index 63831595b..bad0a6256 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs @@ -160,7 +160,7 @@ public Hl7.Fhir.Model.DataType? Definition [DataMember] public List UsageContext { - get => _UsageContext ?? new List(); + get => _UsageContext ??= []; set { _UsageContext = value; OnPropertyChanged("UsageContext"); } } @@ -576,7 +576,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -862,7 +862,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -904,7 +904,7 @@ public string? Description [DataMember] public List CommentElement { - get => _CommentElement ?? new List(); + get => _CommentElement ??= []; set { _CommentElement = value; OnPropertyChanged("CommentElement"); } } @@ -936,7 +936,7 @@ public IEnumerable? Comment [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -951,7 +951,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1119,7 +1119,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1133,7 +1133,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1147,7 +1147,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1161,7 +1161,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1175,7 +1175,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1189,7 +1189,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1203,7 +1203,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -1296,7 +1296,7 @@ public Hl7.Fhir.Model.ResearchElementDefinition.VariableTypeCode? VariableType [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs index a3ac8598c..73617374c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs @@ -440,7 +440,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -484,7 +484,7 @@ public string? Title [DataMember] public List Protocol { - get => _Protocol ?? new List(); + get => _Protocol ??= []; set { _Protocol = value; OnPropertyChanged("Protocol"); } } @@ -500,7 +500,7 @@ public List Protocol [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -574,7 +574,7 @@ public Hl7.Fhir.Model.CodeableConcept? Phase [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -589,7 +589,7 @@ public List Category [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -604,7 +604,7 @@ public List Focus [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -618,7 +618,7 @@ public List Condition [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -632,7 +632,7 @@ public List Contact [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -647,7 +647,7 @@ public List RelatedArtifact [DataMember] public List Keyword { - get => _Keyword ?? new List(); + get => _Keyword ??= []; set { _Keyword = value; OnPropertyChanged("Keyword"); } } @@ -662,7 +662,7 @@ public List Keyword [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -706,7 +706,7 @@ public string? Description [DataMember] public List Enrollment { - get => _Enrollment ?? new List(); + get => _Enrollment ??= []; set { _Enrollment = value; OnPropertyChanged("Enrollment"); } } @@ -765,7 +765,7 @@ public Hl7.Fhir.Model.ResourceReference? PrincipalInvestigator [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -793,7 +793,7 @@ public Hl7.Fhir.Model.CodeableConcept? ReasonStopped [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -807,7 +807,7 @@ public List Note [DataMember] public List Arm { - get => _Arm ?? new List(); + get => _Arm ??= []; set { _Arm = value; OnPropertyChanged("Arm"); } } @@ -821,7 +821,7 @@ public List Arm [DataMember] public List Objective { - get => _Objective ?? new List(); + get => _Objective ??= []; set { _Objective = value; OnPropertyChanged("Objective"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs index 22dece8e9..cc8b2a3b7 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs @@ -159,7 +159,7 @@ public enum ResearchSubjectStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs index 562bcfe28..49435e0d8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs @@ -307,7 +307,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -485,7 +485,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -501,7 +501,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -517,7 +517,7 @@ public List ReasonReference [DataMember] public List Basis { - get => _Basis ?? new List(); + get => _Basis ??= []; set { _Basis = value; OnPropertyChanged("Basis"); } } @@ -531,7 +531,7 @@ public List Basis [DataMember] public List Prediction { - get => _Prediction ?? new List(); + get => _Prediction ??= []; set { _Prediction = value; OnPropertyChanged("Prediction"); } } @@ -573,7 +573,7 @@ public string? Mitigation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs index 8987c0f7e..43e740ba0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs @@ -67,7 +67,7 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -110,7 +110,7 @@ public bool? Active [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -125,7 +125,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -140,7 +140,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -156,7 +156,7 @@ public List Specialty [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs index 8293cfabd..594de86a0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs @@ -630,7 +630,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -673,7 +673,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -688,7 +688,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -761,7 +761,7 @@ public string? Code [DataMember] public List> BaseElement { - get => _BaseElement ?? new List>(); + get => _BaseElement ??= []; set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } @@ -912,7 +912,7 @@ public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage [DataMember] public List> TargetElement { - get => _TargetElement ?? new List>(); + get => _TargetElement ??= []; set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } @@ -1002,7 +1002,7 @@ public bool? MultipleAnd [DataMember] public List> ComparatorElement { - get => _ComparatorElement ?? new List>(); + get => _ComparatorElement ??= []; set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } @@ -1036,7 +1036,7 @@ public IEnumerable? Comparator [DataMember] public List> ModifierElement { - get => _ModifierElement ?? new List>(); + get => _ModifierElement ??= []; set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } @@ -1068,7 +1068,7 @@ public IEnumerable? Modifier [DataMember] public List ChainElement { - get => _ChainElement ?? new List(); + get => _ChainElement ??= []; set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } @@ -1100,7 +1100,7 @@ public IEnumerable? Chain [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs index 08b2b9778..7fa67f118 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs @@ -70,7 +70,7 @@ public partial class ServiceRequest : Hl7.Fhir.Model.DomainResource, IIdentifiab [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -84,7 +84,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -116,7 +116,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -150,7 +150,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -166,7 +166,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -256,7 +256,7 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -343,7 +343,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List OrderDetail { - get => _OrderDetail ?? new List(); + get => _OrderDetail ??= []; set { _OrderDetail = value; OnPropertyChanged("OrderDetail"); } } @@ -493,7 +493,7 @@ public Hl7.Fhir.Model.CodeableConcept? PerformerType [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -508,7 +508,7 @@ public List Performer [DataMember] public List LocationCode { - get => _LocationCode ?? new List(); + get => _LocationCode ??= []; set { _LocationCode = value; OnPropertyChanged("LocationCode"); } } @@ -524,7 +524,7 @@ public List LocationCode [DataMember] public List LocationReference { - get => _LocationReference ?? new List(); + get => _LocationReference ??= []; set { _LocationReference = value; OnPropertyChanged("LocationReference"); } } @@ -539,7 +539,7 @@ public List LocationReference [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -555,7 +555,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -571,7 +571,7 @@ public List ReasonReference [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -587,7 +587,7 @@ public List Insurance [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -603,7 +603,7 @@ public List SupportingInfo [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -618,7 +618,7 @@ public List Specimen [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -632,7 +632,7 @@ public List BodySite [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -676,7 +676,7 @@ public string? PatientInstruction [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs b/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs index ad865e669..7fcbfff64 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs @@ -107,7 +107,7 @@ public enum SlotStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -122,7 +122,7 @@ public List Identifier [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -137,7 +137,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -152,7 +152,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs index 83615697e..f04880eae 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs @@ -395,7 +395,7 @@ public Hl7.Fhir.Model.CodeableConcept? Procedure [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -528,7 +528,7 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -733,7 +733,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -849,7 +849,7 @@ public string? ReceivedTime [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -865,7 +865,7 @@ public List Parent [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -892,7 +892,7 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection [DataMember] public List Processing { - get => _Processing ?? new List(); + get => _Processing ??= []; set { _Processing = value; OnPropertyChanged("Processing"); } } @@ -906,7 +906,7 @@ public List Processing [DataMember] public List Container { - get => _Container ?? new List(); + get => _Container ??= []; set { _Container = value; OnPropertyChanged("Container"); } } @@ -921,7 +921,7 @@ public List Container [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -935,7 +935,7 @@ public List Condition [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs index 62dfd5da5..bdd043545 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs @@ -236,7 +236,7 @@ public Hl7.Fhir.Model.Duration? RetentionTime [DataMember] public List RejectionCriterion { - get => _RejectionCriterion ?? new List(); + get => _RejectionCriterion ??= []; set { _RejectionCriterion = value; OnPropertyChanged("RejectionCriterion"); } } @@ -250,7 +250,7 @@ public List RejectionCriterion [DataMember] public List Handling { - get => _Handling ?? new List(); + get => _Handling ??= []; set { _Handling = value; OnPropertyChanged("Handling"); } } @@ -499,7 +499,7 @@ public Hl7.Fhir.Model.DataType? MinimumVolume [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -960,7 +960,7 @@ public Hl7.Fhir.Model.CodeableConcept? TypeCollected [DataMember] public List PatientPreparation { - get => _PatientPreparation ?? new List(); + get => _PatientPreparation ??= []; set { _PatientPreparation = value; OnPropertyChanged("PatientPreparation"); } } @@ -1003,7 +1003,7 @@ public string? TimeAspect [DataMember] public List Collection { - get => _Collection ?? new List(); + get => _Collection ??= []; set { _Collection = value; OnPropertyChanged("Collection"); } } @@ -1017,7 +1017,7 @@ public List Collection [DataMember] public List TypeTested { - get => _TypeTested ?? new List(); + get => _TypeTested ??= []; set { _TypeTested = value; OnPropertyChanged("TypeTested"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs index 87ca3fda5..e2c27eecd 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs @@ -712,7 +712,7 @@ public string? Documentation [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -726,7 +726,7 @@ public List Input [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1109,7 +1109,7 @@ public string? Name [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1123,7 +1123,7 @@ public List Source [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -1137,7 +1137,7 @@ public List Target [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1151,7 +1151,7 @@ public List Rule [DataMember] public List Dependent { - get => _Dependent ?? new List(); + get => _Dependent ??= []; set { _Dependent = value; OnPropertyChanged("Dependent"); } } @@ -1890,7 +1890,7 @@ public string? Variable [DataMember] public List> ListModeElement { - get => _ListModeElement ?? new List>(); + get => _ListModeElement ??= []; set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } @@ -1980,7 +1980,7 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2250,7 +2250,7 @@ public string? Name [DataMember] public List VariableElement { - get => _VariableElement ?? new List(); + get => _VariableElement ??= []; set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } @@ -2381,7 +2381,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2595,7 +2595,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2637,7 +2637,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2652,7 +2652,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2722,7 +2722,7 @@ public string? Copyright [DataMember] public List Structure { - get => _Structure ?? new List(); + get => _Structure ??= []; set { _Structure = value; OnPropertyChanged("Structure"); } } @@ -2736,7 +2736,7 @@ public List Structure [DataMember] public List ImportElement { - get => _ImportElement ?? new List(); + get => _ImportElement ??= []; set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } @@ -2768,7 +2768,7 @@ public IEnumerable? Import [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs index 30935191d..1208ba15d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs @@ -214,7 +214,7 @@ public string? Payload [DataMember] public List HeaderElement { - get => _HeaderElement ?? new List(); + get => _HeaderElement ??= []; set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } @@ -365,7 +365,7 @@ public Hl7.Fhir.Model.SubscriptionStatusCodes? Status [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs index dfe4293e0..4cc157a01 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs @@ -200,7 +200,7 @@ public Hl7.Fhir.Model.ResourceReference? Focus [DataMember] public List AdditionalContext { - get => _AdditionalContext ?? new List(); + get => _AdditionalContext ??= []; set { _AdditionalContext = value; OnPropertyChanged("AdditionalContext"); } } @@ -391,7 +391,7 @@ public string? EventsSinceSubscriptionStart [DataMember] public List NotificationEvent { - get => _NotificationEvent ?? new List(); + get => _NotificationEvent ??= []; set { _NotificationEvent = value; OnPropertyChanged("NotificationEvent"); } } @@ -450,7 +450,7 @@ public string? Topic [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs index 1c8393d78..21fda7ddc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs @@ -296,7 +296,7 @@ public string? Resource [DataMember] public List> SupportedInteractionElement { - get => _SupportedInteractionElement ?? new List>(); + get => _SupportedInteractionElement ??= []; set { _SupportedInteractionElement = value; OnPropertyChanged("SupportedInteractionElement"); } } @@ -1023,7 +1023,7 @@ public string? FilterDefinition [DataMember] public List> ModifierElement { - get => _ModifierElement ?? new List>(); + get => _ModifierElement ??= []; set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } @@ -1198,7 +1198,7 @@ public string? Resource [DataMember] public List IncludeElement { - get => _IncludeElement ?? new List(); + get => _IncludeElement ??= []; set { _IncludeElement = value; OnPropertyChanged("IncludeElement"); } } @@ -1230,7 +1230,7 @@ public IEnumerable? Include [DataMember] public List RevIncludeElement { - get => _RevIncludeElement ?? new List(); + get => _RevIncludeElement ??= []; set { _RevIncludeElement = value; OnPropertyChanged("RevIncludeElement"); } } @@ -1370,7 +1370,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1440,7 +1440,7 @@ public string? Title [DataMember] public List DerivedFromElement { - get => _DerivedFromElement ?? new List(); + get => _DerivedFromElement ??= []; set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } @@ -1587,7 +1587,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1629,7 +1629,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1644,7 +1644,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1783,7 +1783,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List ResourceTrigger { - get => _ResourceTrigger ?? new List(); + get => _ResourceTrigger ??= []; set { _ResourceTrigger = value; OnPropertyChanged("ResourceTrigger"); } } @@ -1797,7 +1797,7 @@ public List ResourceT [DataMember] public List EventTrigger { - get => _EventTrigger ?? new List(); + get => _EventTrigger ??= []; set { _EventTrigger = value; OnPropertyChanged("EventTrigger"); } } @@ -1811,7 +1811,7 @@ public List EventTrigger [DataMember] public List CanFilterBy { - get => _CanFilterBy ?? new List(); + get => _CanFilterBy ??= []; set { _CanFilterBy = value; OnPropertyChanged("CanFilterBy"); } } @@ -1825,7 +1825,7 @@ public List CanFilterBy [DataMember] public List NotificationShape { - get => _NotificationShape ?? new List(); + get => _NotificationShape ??= []; set { _NotificationShape = value; OnPropertyChanged("NotificationShape"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs index ed14bf499..2a507e6ef 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs @@ -361,7 +361,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -406,7 +406,7 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -463,7 +463,7 @@ public string? Description [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -477,7 +477,7 @@ public List Instance [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs index 9420c2e6f..dea8926af 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs @@ -704,7 +704,7 @@ public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent? MolecularWei [DataMember] public List Technique { - get => _Technique ?? new List(); + get => _Technique ??= []; set { _Technique = value; OnPropertyChanged("Technique"); } } @@ -720,7 +720,7 @@ public List Technique [DataMember] public List SourceDocument { - get => _SourceDocument ?? new List(); + get => _SourceDocument ??= []; set { _SourceDocument = value; OnPropertyChanged("SourceDocument"); } } @@ -734,7 +734,7 @@ public List SourceDocument [DataMember] public List Representation { - get => _Representation ?? new List(); + get => _Representation ??= []; set { _Representation = value; OnPropertyChanged("Representation"); } } @@ -1112,7 +1112,7 @@ public string? StatusDate [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1128,7 +1128,7 @@ public List Note [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1338,7 +1338,7 @@ public bool? Preferred [DataMember] public List Language { - get => _Language ?? new List(); + get => _Language ??= []; set { _Language = value; OnPropertyChanged("Language"); } } @@ -1353,7 +1353,7 @@ public List Language [DataMember] public List Domain { - get => _Domain ?? new List(); + get => _Domain ??= []; set { _Domain = value; OnPropertyChanged("Domain"); } } @@ -1368,7 +1368,7 @@ public List Domain [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1382,7 +1382,7 @@ public List Jurisdiction [DataMember] public List Synonym { - get => _Synonym ?? new List(); + get => _Synonym ??= []; set { _Synonym = value; OnPropertyChanged("Synonym"); } } @@ -1396,7 +1396,7 @@ public List Synonym [DataMember] public List Translation { - get => _Translation ?? new List(); + get => _Translation ??= []; set { _Translation = value; OnPropertyChanged("Translation"); } } @@ -1410,7 +1410,7 @@ public List Translation [DataMember] public List Official { - get => _Official ?? new List(); + get => _Official ??= []; set { _Official = value; OnPropertyChanged("Official"); } } @@ -1426,7 +1426,7 @@ public List Official [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1858,7 +1858,7 @@ public Hl7.Fhir.Model.CodeableConcept? Comparator [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -2060,7 +2060,7 @@ public Hl7.Fhir.Model.CodeableConcept? Part [DataMember] public List CountryOfOrigin { - get => _CountryOfOrigin ?? new List(); + get => _CountryOfOrigin ??= []; set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } @@ -2171,7 +2171,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2227,7 +2227,7 @@ public Hl7.Fhir.Model.CodeableConcept? Status [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -2256,7 +2256,7 @@ public Hl7.Fhir.Model.CodeableConcept? Domain [DataMember] public List Grade { - get => _Grade ?? new List(); + get => _Grade ??= []; set { _Grade = value; OnPropertyChanged("Grade"); } } @@ -2300,7 +2300,7 @@ public string? Description [DataMember] public List InformationSource { - get => _InformationSource ?? new List(); + get => _InformationSource ??= []; set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } @@ -2314,7 +2314,7 @@ public List InformationSource [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -2330,7 +2330,7 @@ public List Note [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -2346,7 +2346,7 @@ public List Manufacturer [DataMember] public List Supplier { - get => _Supplier ?? new List(); + get => _Supplier ??= []; set { _Supplier = value; OnPropertyChanged("Supplier"); } } @@ -2360,7 +2360,7 @@ public List Supplier [DataMember] public List Moiety { - get => _Moiety ?? new List(); + get => _Moiety ??= []; set { _Moiety = value; OnPropertyChanged("Moiety"); } } @@ -2374,7 +2374,7 @@ public List Moiety [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -2388,7 +2388,7 @@ public List Property [DataMember] public List MolecularWeight { - get => _MolecularWeight ?? new List(); + get => _MolecularWeight ??= []; set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } @@ -2415,7 +2415,7 @@ public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent? Structure [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2429,7 +2429,7 @@ public List Code [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -2443,7 +2443,7 @@ public List Name [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs index 6050fe5f3..13d945937 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs @@ -242,7 +242,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -258,7 +258,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -274,7 +274,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -407,7 +407,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs index 78dc22050..07faa7b84 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs @@ -237,7 +237,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -357,7 +357,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -431,7 +431,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List Supplier { - get => _Supplier ?? new List(); + get => _Supplier ??= []; set { _Supplier = value; OnPropertyChanged("Supplier"); } } @@ -446,7 +446,7 @@ public List Supplier [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -462,7 +462,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Task.cs b/src/Hl7.Fhir.R4B/Model/Generated/Task.cs index 18db9c6da..20bce4d5b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Task.cs @@ -272,7 +272,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -599,7 +599,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -671,7 +671,7 @@ public string? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -700,7 +700,7 @@ public Hl7.Fhir.Model.Identifier? GroupIdentifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1006,7 +1006,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List PerformerType { - get => _PerformerType ?? new List(); + get => _PerformerType ??= []; set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } @@ -1081,7 +1081,7 @@ public Hl7.Fhir.Model.ResourceReference? ReasonReference [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1095,7 +1095,7 @@ public List Insurance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1111,7 +1111,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -1138,7 +1138,7 @@ public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -1152,7 +1152,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs index d61089c09..49a829f4d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs @@ -423,7 +423,7 @@ public string? Uri [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -645,7 +645,7 @@ public bool? Compositional [DataMember] public List LanguageElement { - get => _LanguageElement ?? new List(); + get => _LanguageElement ??= []; set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } @@ -677,7 +677,7 @@ public IEnumerable? Language [DataMember] public List Filter { - get => _Filter ?? new List(); + get => _Filter ??= []; set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -691,7 +691,7 @@ public List Filter [DataMember] public List PropertyElement { - get => _PropertyElement ?? new List(); + get => _PropertyElement ??= []; set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } @@ -871,7 +871,7 @@ public string? Code [DataMember] public List OpElement { - get => _OpElement ?? new List(); + get => _OpElement ??= []; set { _OpElement = value; OnPropertyChanged("OpElement"); } } @@ -1070,7 +1070,7 @@ public bool? Incomplete [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1888,7 +1888,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1930,7 +1930,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1945,7 +1945,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2100,7 +2100,7 @@ public bool? LockedDate [DataMember] public List CodeSystem { - get => _CodeSystem ?? new List(); + get => _CodeSystem ??= []; set { _CodeSystem = value; OnPropertyChanged("CodeSystem"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs index 249570595..c95edd0a2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs @@ -399,7 +399,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1020,7 +1020,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1242,7 +1242,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1612,7 +1612,7 @@ public string? Issued [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1639,7 +1639,7 @@ public Hl7.Fhir.Model.TestReport.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs index 9364e6387..5ed8c86ff 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs @@ -580,7 +580,7 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -594,7 +594,7 @@ public List Link [DataMember] public List Capability { - get => _Capability ?? new List(); + get => _Capability ??= []; set { _Capability = value; OnPropertyChanged("Capability"); } } @@ -924,7 +924,7 @@ public string? Description [DataMember] public List OriginElement { - get => _OriginElement ?? new List(); + get => _OriginElement ??= []; set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } @@ -984,7 +984,7 @@ public int? Destination [DataMember] public List LinkElement { - get => _LinkElement ?? new List(); + get => _LinkElement ??= []; set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } @@ -1707,7 +1707,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -2212,7 +2212,7 @@ public string? Params [DataMember] public List RequestHeader { - get => _RequestHeader ?? new List(); + get => _RequestHeader ??= []; set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } @@ -3680,7 +3680,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -3902,7 +3902,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -4311,7 +4311,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -4353,7 +4353,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -4368,7 +4368,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -4438,7 +4438,7 @@ public string? Copyright [DataMember] public List Origin { - get => _Origin ?? new List(); + get => _Origin ??= []; set { _Origin = value; OnPropertyChanged("Origin"); } } @@ -4452,7 +4452,7 @@ public List Origin [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -4479,7 +4479,7 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata [DataMember] public List Fixture { - get => _Fixture ?? new List(); + get => _Fixture ??= []; set { _Fixture = value; OnPropertyChanged("Fixture"); } } @@ -4495,7 +4495,7 @@ public List Fixture [DataMember] public List Profile { - get => _Profile ?? new List(); + get => _Profile ??= []; set { _Profile = value; OnPropertyChanged("Profile"); } } @@ -4509,7 +4509,7 @@ public List Profile [DataMember] public List Variable { - get => _Variable ?? new List(); + get => _Variable ??= []; set { _Variable = value; OnPropertyChanged("Variable"); } } @@ -4536,7 +4536,7 @@ public Hl7.Fhir.Model.TestScript.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs index fdca22f24..746d07ef8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs @@ -607,7 +607,7 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get => _DayOfWeekElement ?? new List>(); + get => _DayOfWeekElement ??= []; set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } @@ -639,7 +639,7 @@ public IEnumerable? DayOfWeek [DataMember] public List TimeOfDayElement { - get => _TimeOfDayElement ?? new List(); + get => _TimeOfDayElement ??= []; set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } @@ -673,7 +673,7 @@ public IEnumerable? TimeOfDay [DataMember] public List> WhenElement { - get => _WhenElement ?? new List>(); + get => _WhenElement ??= []; set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } @@ -920,7 +920,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get => _EventElement ?? new List(); + get => _EventElement ??= []; set { _EventElement = value; OnPropertyChanged("EventElement"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs index a036d3573..ec42e98bf 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs @@ -204,7 +204,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs index 1540c78e2..31b07a14c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs @@ -142,7 +142,7 @@ public Hl7.Fhir.Model.ResourceReference? Who [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -157,7 +157,7 @@ public List Type [DataMember] public List CommunicationMethod { - get => _CommunicationMethod ?? new List(); + get => _CommunicationMethod ??= []; set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } @@ -228,7 +228,7 @@ public Hl7.Fhir.Model.CodeableConcept? CanPushUpdates [DataMember] public List PushTypeAvailable { - get => _PushTypeAvailable ?? new List(); + get => _PushTypeAvailable ??= []; set { _PushTypeAvailable = value; OnPropertyChanged("PushTypeAvailable"); } } @@ -799,7 +799,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -813,7 +813,7 @@ public List Target [DataMember] public List TargetLocationElement { - get => _TargetLocationElement ?? new List(); + get => _TargetLocationElement ??= []; set { _TargetLocationElement = value; OnPropertyChanged("TargetLocationElement"); } } @@ -933,7 +933,7 @@ public Hl7.Fhir.Model.CodeableConcept? ValidationType [DataMember] public List ValidationProcess { - get => _ValidationProcess ?? new List(); + get => _ValidationProcess ??= []; set { _ValidationProcess = value; OnPropertyChanged("ValidationProcess"); } } @@ -1030,7 +1030,7 @@ public Hl7.Fhir.Model.CodeableConcept? FailureAction [DataMember] public List PrimarySource { - get => _PrimarySource ?? new List(); + get => _PrimarySource ??= []; set { _PrimarySource = value; OnPropertyChanged("PrimarySource"); } } @@ -1057,7 +1057,7 @@ public Hl7.Fhir.Model.VerificationResult.AttestationComponent? Attestation [DataMember] public List Validator { - get => _Validator ?? new List(); + get => _Validator ??= []; set { _Validator = value; OnPropertyChanged("Validator"); } } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs index 5a8555971..e37af7147 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs @@ -272,7 +272,7 @@ public int? Axis [DataMember] public List Prism { - get => _Prism ?? new List(); + get => _Prism ??= []; set { _Prism = value; OnPropertyChanged("Prism"); } } @@ -467,7 +467,7 @@ public string? Brand [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -805,7 +805,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -955,7 +955,7 @@ public Hl7.Fhir.Model.ResourceReference? Prescriber [DataMember] public List LensSpecification { - get => _LensSpecification ?? new List(); + get => _LensSpecification ??= []; set { _LensSpecification = value; OnPropertyChanged("LensSpecification"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Account.cs b/src/Hl7.Fhir.R5/Model/Generated/Account.cs index 516eb614f..9319a5f45 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Account.cs @@ -482,7 +482,7 @@ public string? DateOfDiagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -525,7 +525,7 @@ public bool? OnAdmission [DataMember] public List PackageCode { - get => _PackageCode ?? new List(); + get => _PackageCode ??= []; set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } @@ -732,7 +732,7 @@ public string? DateOfService [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -747,7 +747,7 @@ public List Type [DataMember] public List PackageCode { - get => _PackageCode ?? new List(); + get => _PackageCode ??= []; set { _PackageCode = value; OnPropertyChanged("PackageCode"); } } @@ -763,7 +763,7 @@ public List PackageCode [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -1171,7 +1171,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1274,7 +1274,7 @@ public string? Name [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -1301,7 +1301,7 @@ public Hl7.Fhir.Model.Period? ServicePeriod [DataMember] public List Coverage { - get => _Coverage ?? new List(); + get => _Coverage ??= []; set { _Coverage = value; OnPropertyChanged("Coverage"); } } @@ -1358,7 +1358,7 @@ public string? Description [DataMember] public List Guarantor { - get => _Guarantor ?? new List(); + get => _Guarantor ??= []; set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } @@ -1372,7 +1372,7 @@ public List Guarantor [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -1386,7 +1386,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -1400,7 +1400,7 @@ public List Procedure [DataMember] public List RelatedAccount { - get => _RelatedAccount ?? new List(); + get => _RelatedAccount ??= []; set { _RelatedAccount = value; OnPropertyChanged("RelatedAccount"); } } @@ -1428,7 +1428,7 @@ public Hl7.Fhir.Model.CodeableConcept? Currency [DataMember] public List Balance { - get => _Balance ?? new List(); + get => _Balance ??= []; set { _Balance = value; OnPropertyChanged("Balance"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs index 2e63f3701..6b462d21a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs @@ -554,7 +554,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -827,7 +827,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -869,7 +869,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -884,7 +884,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1080,7 +1080,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1094,7 +1094,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1108,7 +1108,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1122,7 +1122,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1136,7 +1136,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1150,7 +1150,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1164,7 +1164,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -1400,7 +1400,7 @@ public Hl7.Fhir.Model.CodeableReference? Location [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1444,7 +1444,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -1459,7 +1459,7 @@ public List Dosage [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -1473,7 +1473,7 @@ public List BodySite [DataMember] public List SpecimenRequirementElement { - get => _SpecimenRequirementElement ?? new List(); + get => _SpecimenRequirementElement ??= []; set { _SpecimenRequirementElement = value; OnPropertyChanged("SpecimenRequirementElement"); } } @@ -1505,7 +1505,7 @@ public IEnumerable? SpecimenRequirement [DataMember] public List ObservationRequirementElement { - get => _ObservationRequirementElement ?? new List(); + get => _ObservationRequirementElement ??= []; set { _ObservationRequirementElement = value; OnPropertyChanged("ObservationRequirementElement"); } } @@ -1537,7 +1537,7 @@ public IEnumerable? ObservationRequirement [DataMember] public List ObservationResultRequirementElement { - get => _ObservationResultRequirementElement ?? new List(); + get => _ObservationResultRequirementElement ??= []; set { _ObservationResultRequirementElement = value; OnPropertyChanged("ObservationResultRequirementElement"); } } @@ -1597,7 +1597,7 @@ public string? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs index 9d9886d74..a5ff25a20 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -327,7 +327,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -369,7 +369,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -384,7 +384,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -541,7 +541,7 @@ public string? Documentation [DataMember] public List ReferenceElement { - get => _ReferenceElement ?? new List(); + get => _ReferenceElement ??= []; set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } @@ -601,7 +601,7 @@ public string? Capabilities [DataMember] public List DerivedFromElement { - get => _DerivedFromElement ?? new List(); + get => _DerivedFromElement ??= []; set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Address.cs b/src/Hl7.Fhir.R5/Model/Generated/Address.cs index 26e2e948f..6ad569a06 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Address.cs @@ -228,7 +228,7 @@ public string? Text [DataMember] public List LineElement { - get => _LineElement ?? new List(); + get => _LineElement ??= []; set { _LineElement = value; OnPropertyChanged("LineElement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs index 995286650..870752846 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs @@ -303,7 +303,7 @@ public Hl7.Fhir.Model.Duration? MaxTreatmentPeriod [DataMember] public List TargetSpecies { - get => _TargetSpecies ?? new List(); + get => _TargetSpecies ??= []; set { _TargetSpecies = value; OnPropertyChanged("TargetSpecies"); } } @@ -460,7 +460,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List WithdrawalPeriod { - get => _WithdrawalPeriod ?? new List(); + get => _WithdrawalPeriod ??= []; set { _WithdrawalPeriod = value; OnPropertyChanged("WithdrawalPeriod"); } } @@ -693,7 +693,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -740,7 +740,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List FormOf { - get => _FormOf ?? new List(); + get => _FormOf ??= []; set { _FormOf = value; OnPropertyChanged("FormOf"); } } @@ -784,7 +784,7 @@ public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation [DataMember] public List ProducedFrom { - get => _ProducedFrom ?? new List(); + get => _ProducedFrom ??= []; set { _ProducedFrom = value; OnPropertyChanged("ProducedFrom"); } } @@ -799,7 +799,7 @@ public List ProducedFrom [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -856,7 +856,7 @@ public string? Description [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -870,7 +870,7 @@ public List Pro [DataMember] public List RouteOfAdministration { - get => _RouteOfAdministration ?? new List(); + get => _RouteOfAdministration ??= []; set { _RouteOfAdministration = value; OnPropertyChanged("RouteOfAdministration"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs index 88e911aa4..6adf5b458 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs @@ -867,7 +867,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -944,7 +944,7 @@ public Hl7.Fhir.Model.AdverseEvent.AdverseEventActuality? Actuality [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1076,7 +1076,7 @@ public string? RecordedDate [DataMember] public List ResultingEffect { - get => _ResultingEffect ?? new List(); + get => _ResultingEffect ??= []; set { _ResultingEffect = value; OnPropertyChanged("ResultingEffect"); } } @@ -1120,7 +1120,7 @@ public Hl7.Fhir.Model.CodeableConcept? Seriousness [DataMember] public List Outcome { - get => _Outcome ?? new List(); + get => _Outcome ??= []; set { _Outcome = value; OnPropertyChanged("Outcome"); } } @@ -1149,7 +1149,7 @@ public Hl7.Fhir.Model.ResourceReference? Recorder [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1165,7 +1165,7 @@ public List Participant [DataMember] public List Study { - get => _Study ?? new List(); + get => _Study ??= []; set { _Study = value; OnPropertyChanged("Study"); } } @@ -1207,7 +1207,7 @@ public bool? ExpectedInResearchStudy [DataMember] public List SuspectEntity { - get => _SuspectEntity ?? new List(); + get => _SuspectEntity ??= []; set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } @@ -1221,7 +1221,7 @@ public List SuspectEntity [DataMember] public List ContributingFactor { - get => _ContributingFactor ?? new List(); + get => _ContributingFactor ??= []; set { _ContributingFactor = value; OnPropertyChanged("ContributingFactor"); } } @@ -1235,7 +1235,7 @@ public List Contributin [DataMember] public List PreventiveAction { - get => _PreventiveAction ?? new List(); + get => _PreventiveAction ??= []; set { _PreventiveAction = value; OnPropertyChanged("PreventiveAction"); } } @@ -1249,7 +1249,7 @@ public List PreventiveAct [DataMember] public List MitigatingAction { - get => _MitigatingAction ?? new List(); + get => _MitigatingAction ??= []; set { _MitigatingAction = value; OnPropertyChanged("MitigatingAction"); } } @@ -1263,7 +1263,7 @@ public List MitigatingAct [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -1277,7 +1277,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs index 254c4aed2..89d118233 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs @@ -376,7 +376,7 @@ public Hl7.Fhir.Model.CodeableConcept? Substance [DataMember] public List Manifestation { - get => _Manifestation ?? new List(); + get => _Manifestation ??= []; set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } @@ -490,7 +490,7 @@ public Hl7.Fhir.Model.CodeableConcept? ExposureRoute [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -619,7 +619,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -677,7 +677,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List> CategoryElement { - get => _CategoryElement ?? new List>(); + get => _CategoryElement ??= []; set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } @@ -827,7 +827,7 @@ public string? RecordedDate [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -869,7 +869,7 @@ public string? LastOccurrence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -883,7 +883,7 @@ public List Note [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs index 62d35584e..44ebb29d5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs @@ -3052,7 +3052,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -3351,7 +3351,7 @@ public int? OccurrenceCount [DataMember] public List OccurrenceDateElement { - get => _OccurrenceDateElement ?? new List(); + get => _OccurrenceDateElement ??= []; set { _OccurrenceDateElement = value; OnPropertyChanged("OccurrenceDateElement"); } } @@ -3422,7 +3422,7 @@ public Hl7.Fhir.Model.Appointment.YearlyTemplateComponent? YearlyTemplate [DataMember] public List ExcludingDateElement { - get => _ExcludingDateElement ?? new List(); + get => _ExcludingDateElement ??= []; set { _ExcludingDateElement = value; OnPropertyChanged("ExcludingDateElement"); } } @@ -3454,7 +3454,7 @@ public IEnumerable? ExcludingDate [DataMember] public List ExcludingRecurrenceIdElement { - get => _ExcludingRecurrenceIdElement ?? new List(); + get => _ExcludingRecurrenceIdElement ??= []; set { _ExcludingRecurrenceIdElement = value; OnPropertyChanged("ExcludingRecurrenceIdElement"); } } @@ -4278,7 +4278,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4338,7 +4338,7 @@ public Hl7.Fhir.Model.CodeableConcept? CancellationReason [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -4353,7 +4353,7 @@ public List Class [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -4368,7 +4368,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -4383,7 +4383,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -4412,7 +4412,7 @@ public Hl7.Fhir.Model.CodeableConcept? AppointmentType [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -4470,7 +4470,7 @@ public string? Description [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -4484,7 +4484,7 @@ public List Replaces [DataMember] public List VirtualService { - get => _VirtualService ?? new List(); + get => _VirtualService ??= []; set { _VirtualService = value; OnPropertyChanged("VirtualService"); } } @@ -4500,7 +4500,7 @@ public List VirtualService [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -4628,7 +4628,7 @@ public int? MinutesDuration [DataMember] public List RequestedPeriod { - get => _RequestedPeriod ?? new List(); + get => _RequestedPeriod ??= []; set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } @@ -4644,7 +4644,7 @@ public List RequestedPeriod [DataMember] public List Slot { - get => _Slot ?? new List(); + get => _Slot ??= []; set { _Slot = value; OnPropertyChanged("Slot"); } } @@ -4660,7 +4660,7 @@ public List Slot [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -4730,7 +4730,7 @@ public string? CancellationDate [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -4744,7 +4744,7 @@ public List Note [DataMember] public List PatientInstruction { - get => _PatientInstruction ?? new List(); + get => _PatientInstruction ??= []; set { _PatientInstruction = value; OnPropertyChanged("PatientInstruction"); } } @@ -4760,7 +4760,7 @@ public List PatientInstruction [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -4789,7 +4789,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -4859,7 +4859,7 @@ public bool? OccurrenceChanged [DataMember] public List RecurrenceTemplate { - get => _RecurrenceTemplate ?? new List(); + get => _RecurrenceTemplate ??= []; set { _RecurrenceTemplate = value; OnPropertyChanged("RecurrenceTemplate"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs index 127d40d9e..0834788df 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs @@ -107,7 +107,7 @@ public enum AppointmentResponseStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -222,7 +222,7 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get => _ParticipantType ?? new List(); + get => _ParticipantType ??= []; set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs index 021c2dff1..49ce9d6ff 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs @@ -315,7 +315,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -357,7 +357,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List PathElement { - get => _PathElement ?? new List(); + get => _PathElement ??= []; set { _PathElement = value; OnPropertyChanged("PathElement"); } } @@ -389,7 +389,7 @@ public IEnumerable? Path [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -431,7 +431,7 @@ public bool? FreeToShare [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -587,7 +587,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -774,7 +774,7 @@ public Hl7.Fhir.Model.DataType? Artifact [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs index 55969440e..b78bc3b31 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs @@ -202,7 +202,7 @@ public Hl7.Fhir.Model.Coding? Code [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -320,7 +320,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -393,7 +393,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -442,7 +442,7 @@ public Hl7.Fhir.Model.DataType? Network [DataMember] public List Authorization { - get => _Authorization ?? new List(); + get => _Authorization ??= []; set { _Authorization = value; OnPropertyChanged("Authorization"); } } @@ -629,7 +629,7 @@ public Hl7.Fhir.Model.ResourceReference? Observer [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -769,7 +769,7 @@ public Hl7.Fhir.Model.CodeableConcept? Role [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -811,7 +811,7 @@ public byte[]? Query [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -825,7 +825,7 @@ public List Detail [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -1063,7 +1063,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1210,7 +1210,7 @@ public Hl7.Fhir.Model.AuditEvent.OutcomeComponent? Outcome [DataMember] public List Authorization { - get => _Authorization ?? new List(); + get => _Authorization ??= []; set { _Authorization = value; OnPropertyChanged("Authorization"); } } @@ -1226,7 +1226,7 @@ public List Authorization [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1270,7 +1270,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -1298,7 +1298,7 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs index f13b0b0cb..e8439779f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs @@ -82,7 +82,7 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.Element [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -410,7 +410,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List AvailableTime { - get => _AvailableTime ?? new List(); + get => _AvailableTime ??= []; set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } @@ -424,7 +424,7 @@ public List AvailableTime [DataMember] public List NotAvailableTime { - get => _NotAvailableTime ?? new List(); + get => _NotAvailableTime ??= []; set { _NotAvailableTime = value; OnPropertyChanged("NotAvailableTime"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Basic.cs b/src/Hl7.Fhir.R5/Model/Generated/Basic.cs index 337bcbd30..65e23fd2b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Basic.cs @@ -70,7 +70,7 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs index 79736975e..55209ca22 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs @@ -356,7 +356,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductCode [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -372,7 +372,7 @@ public List Parent [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -386,7 +386,7 @@ public List Request [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -415,7 +415,7 @@ public Hl7.Fhir.Model.Identifier? BiologicalSourceEvent [DataMember] public List ProcessingFacility { - get => _ProcessingFacility ?? new List(); + get => _ProcessingFacility ??= []; set { _ProcessingFacility = value; OnPropertyChanged("ProcessingFacility"); } } @@ -525,7 +525,7 @@ public Hl7.Fhir.Model.Range? StorageTempRequirements [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs index 796f5dbca..aba0b9b00 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs @@ -241,7 +241,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -257,7 +257,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -273,7 +273,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -378,7 +378,7 @@ public Hl7.Fhir.Model.CodeableConcept? MatchStatus [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -491,7 +491,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs index 6e130b7ab..495dcfcbc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs @@ -115,7 +115,7 @@ public Hl7.Fhir.Model.CodeableConcept? Laterality [DataMember] public List BodyLandmarkOrientation { - get => _BodyLandmarkOrientation ?? new List(); + get => _BodyLandmarkOrientation ??= []; set { _BodyLandmarkOrientation = value; OnPropertyChanged("BodyLandmarkOrientation"); } } @@ -131,7 +131,7 @@ public List BodyL [DataMember] public List SpatialReference { - get => _SpatialReference ?? new List(); + get => _SpatialReference ??= []; set { _SpatialReference = value; OnPropertyChanged("SpatialReference"); } } @@ -146,7 +146,7 @@ public List SpatialReference [DataMember] public List Qualifier { - get => _Qualifier ?? new List(); + get => _Qualifier ??= []; set { _Qualifier = value; OnPropertyChanged("Qualifier"); } } @@ -274,7 +274,7 @@ public partial class BodyLandmarkOrientationComponent : Hl7.Fhir.Model.BackboneE [DataMember] public List LandmarkDescription { - get => _LandmarkDescription ?? new List(); + get => _LandmarkDescription ??= []; set { _LandmarkDescription = value; OnPropertyChanged("LandmarkDescription"); } } @@ -289,7 +289,7 @@ public List LandmarkDescription [DataMember] public List ClockFacePosition { - get => _ClockFacePosition ?? new List(); + get => _ClockFacePosition ??= []; set { _ClockFacePosition = value; OnPropertyChanged("ClockFacePosition"); } } @@ -303,7 +303,7 @@ public List ClockFacePosition [DataMember] public List DistanceFromLandmark { - get => _DistanceFromLandmark ?? new List(); + get => _DistanceFromLandmark ??= []; set { _DistanceFromLandmark = value; OnPropertyChanged("DistanceFromLandmark"); } } @@ -318,7 +318,7 @@ public List Distance [DataMember] public List SurfaceOrientation { - get => _SurfaceOrientation ?? new List(); + get => _SurfaceOrientation ??= []; set { _SurfaceOrientation = value; OnPropertyChanged("SurfaceOrientation"); } } @@ -437,7 +437,7 @@ public partial class DistanceFromLandmarkComponent : Hl7.Fhir.Model.BackboneElem [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -451,7 +451,7 @@ public List Device [DataMember] public List Value { - get => _Value ?? new List(); + get => _Value ??= []; set { _Value = value; OnPropertyChanged("Value"); } } @@ -535,7 +535,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -591,7 +591,7 @@ public Hl7.Fhir.Model.CodeableConcept? Morphology [DataMember] public List IncludedStructure { - get => _IncludedStructure ?? new List(); + get => _IncludedStructure ??= []; set { _IncludedStructure = value; OnPropertyChanged("IncludedStructure"); } } @@ -605,7 +605,7 @@ public List IncludedStr [DataMember] public List ExcludedStructure { - get => _ExcludedStructure ?? new List(); + get => _ExcludedStructure ??= []; set { _ExcludedStructure = value; OnPropertyChanged("ExcludedStructure"); } } @@ -647,7 +647,7 @@ public string? Description [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs index 47a1bc238..e4691c308 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs @@ -127,7 +127,7 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List PerformedActivity { - get => _PerformedActivity ?? new List(); + get => _PerformedActivity ??= []; set { _PerformedActivity = value; OnPropertyChanged("PerformedActivity"); } } @@ -141,7 +141,7 @@ public List PerformedActivity [DataMember] public List Progress { - get => _Progress ?? new List(); + get => _Progress ??= []; set { _Progress = value; OnPropertyChanged("Progress"); } } @@ -249,7 +249,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -263,7 +263,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -295,7 +295,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -329,7 +329,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -345,7 +345,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -361,7 +361,7 @@ public List Replaces [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -438,7 +438,7 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -597,7 +597,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -613,7 +613,7 @@ public List Contributor [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -628,7 +628,7 @@ public List CareTeam [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -644,7 +644,7 @@ public List Addresses [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -660,7 +660,7 @@ public List SupportingInfo [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -674,7 +674,7 @@ public List Goal [DataMember] public List Activity { - get => _Activity ?? new List(); + get => _Activity ??= []; set { _Activity = value; OnPropertyChanged("Activity"); } } @@ -688,7 +688,7 @@ public List Activity [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs index 14b2b59ab..e0ceea7bf 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs @@ -273,7 +273,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -318,7 +318,7 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -388,7 +388,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -403,7 +403,7 @@ public List Participant [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -419,7 +419,7 @@ public List Reason [DataMember] public List ManagingOrganization { - get => _ManagingOrganization ?? new List(); + get => _ManagingOrganization ??= []; set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } @@ -433,7 +433,7 @@ public List ManagingOrganization [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -447,7 +447,7 @@ public List Telecom [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs index 38ffe11ef..57299305f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs @@ -238,7 +238,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -252,7 +252,7 @@ public List Identifier [DataMember] public List DefinitionUriElement { - get => _DefinitionUriElement ?? new List(); + get => _DefinitionUriElement ??= []; set { _DefinitionUriElement = value; OnPropertyChanged("DefinitionUriElement"); } } @@ -284,7 +284,7 @@ public IEnumerable? DefinitionUri [DataMember] public List DefinitionCanonicalElement { - get => _DefinitionCanonicalElement ?? new List(); + get => _DefinitionCanonicalElement ??= []; set { _DefinitionCanonicalElement = value; OnPropertyChanged("DefinitionCanonicalElement"); } } @@ -349,7 +349,7 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -424,7 +424,7 @@ public Hl7.Fhir.Model.DataType? Occurrence [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -497,7 +497,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Bodysite { - get => _Bodysite ?? new List(); + get => _Bodysite ??= []; set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } @@ -595,7 +595,7 @@ public string? EnteredDate [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -609,7 +609,7 @@ public List Reason [DataMember] public List Service { - get => _Service ?? new List(); + get => _Service ??= []; set { _Service = value; OnPropertyChanged("Service"); } } @@ -624,7 +624,7 @@ public List Service [DataMember] public List Product { - get => _Product ?? new List(); + get => _Product ??= []; set { _Product = value; OnPropertyChanged("Product"); } } @@ -640,7 +640,7 @@ public List Product [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -654,7 +654,7 @@ public List Account [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -670,7 +670,7 @@ public List Note [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs index 1e9d3ca29..25eb997fb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs @@ -221,7 +221,7 @@ public partial class PropertyGroupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Applicability { - get => _Applicability ?? new List(); + get => _Applicability ??= []; set { _Applicability = value; OnPropertyChanged("Applicability"); } } @@ -235,7 +235,7 @@ public List Applicab [DataMember] public List PriceComponent { - get => _PriceComponent ?? new List(); + get => _PriceComponent ??= []; set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } @@ -347,7 +347,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -460,7 +460,7 @@ public string? Title [DataMember] public List DerivedFromUriElement { - get => _DerivedFromUriElement ?? new List(); + get => _DerivedFromUriElement ??= []; set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } @@ -492,7 +492,7 @@ public IEnumerable? DerivedFromUri [DataMember] public List PartOfElement { - get => _PartOfElement ?? new List(); + get => _PartOfElement ??= []; set { _PartOfElement = value; OnPropertyChanged("PartOfElement"); } } @@ -524,7 +524,7 @@ public IEnumerable? PartOf [DataMember] public List ReplacesElement { - get => _ReplacesElement ?? new List(); + get => _ReplacesElement ??= []; set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } @@ -671,7 +671,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -713,7 +713,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -728,7 +728,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -898,7 +898,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -912,7 +912,7 @@ public List Instance [DataMember] public List Applicability { - get => _Applicability ?? new List(); + get => _Applicability ??= []; set { _Applicability = value; OnPropertyChanged("Applicability"); } } @@ -926,7 +926,7 @@ public List Applicab [DataMember] public List PropertyGroup { - get => _PropertyGroup ?? new List(); + get => _PropertyGroup ??= []; set { _PropertyGroup = value; OnPropertyChanged("PropertyGroup"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Citation.cs b/src/Hl7.Fhir.R5/Model/Generated/Citation.cs index 0146ad36a..98514877a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Citation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Citation.cs @@ -465,7 +465,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -715,7 +715,7 @@ public partial class CitedArtifactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -729,7 +729,7 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get => _RelatedIdentifier ?? new List(); + get => _RelatedIdentifier ??= []; set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } @@ -785,7 +785,7 @@ public Hl7.Fhir.Model.Citation.CitedArtifactVersionComponent? Version [DataMember] public List CurrentState { - get => _CurrentState ?? new List(); + get => _CurrentState ??= []; set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } @@ -799,7 +799,7 @@ public List CurrentState [DataMember] public List StatusDate { - get => _StatusDate ?? new List(); + get => _StatusDate ??= []; set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } @@ -813,7 +813,7 @@ public List StatusDate [DataMember] public List Title { - get => _Title ?? new List(); + get => _Title ??= []; set { _Title = value; OnPropertyChanged("Title"); } } @@ -827,7 +827,7 @@ public List Title [DataMember] public List Abstract { - get => _Abstract ?? new List(); + get => _Abstract ??= []; set { _Abstract = value; OnPropertyChanged("Abstract"); } } @@ -854,7 +854,7 @@ public Hl7.Fhir.Model.Citation.CitedArtifactPartComponent? Part [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -868,7 +868,7 @@ public List RelatesTo [DataMember] public List PublicationForm { - get => _PublicationForm ?? new List(); + get => _PublicationForm ??= []; set { _PublicationForm = value; OnPropertyChanged("PublicationForm"); } } @@ -882,7 +882,7 @@ public List Publi [DataMember] public List WebLocation { - get => _WebLocation ?? new List(); + get => _WebLocation ??= []; set { _WebLocation = value; OnPropertyChanged("WebLocation"); } } @@ -896,7 +896,7 @@ public List WebLocati [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -923,7 +923,7 @@ public Hl7.Fhir.Model.Citation.CitedArtifactContributorshipComponent? Contributo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1417,7 +1417,7 @@ public partial class CitedArtifactTitleComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1939,7 +1939,7 @@ public Hl7.Fhir.Model.Citation.RelatedArtifactTypeExpanded? Type [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -2427,7 +2427,7 @@ public string? LastRevisionDate [DataMember] public List Language { - get => _Language ?? new List(); + get => _Language ??= []; set { _Language = value; OnPropertyChanged("Language"); } } @@ -2823,7 +2823,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3019,7 +3019,7 @@ public partial class CitedArtifactWebLocationComponent : Hl7.Fhir.Model.Backbone [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -3159,7 +3159,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -3175,7 +3175,7 @@ public List Classifier [DataMember] public List ArtifactAssessment { - get => _ArtifactAssessment ?? new List(); + get => _ArtifactAssessment ??= []; set { _ArtifactAssessment = value; OnPropertyChanged("ArtifactAssessment"); } } @@ -3312,7 +3312,7 @@ public bool? Complete [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } @@ -3326,7 +3326,7 @@ public List [DataMember] public List Summary { - get => _Summary ?? new List(); + get => _Summary ??= []; set { _Summary = value; OnPropertyChanged("Summary"); } } @@ -3482,7 +3482,7 @@ public string? ForenameInitials [DataMember] public List Affiliation { - get => _Affiliation ?? new List(); + get => _Affiliation ??= []; set { _Affiliation = value; OnPropertyChanged("Affiliation"); } } @@ -3497,7 +3497,7 @@ public List Affiliation [DataMember] public List ContributionType { - get => _ContributionType ?? new List(); + get => _ContributionType ??= []; set { _ContributionType = value; OnPropertyChanged("ContributionType"); } } @@ -3525,7 +3525,7 @@ public Hl7.Fhir.Model.CodeableConcept? Role [DataMember] public List ContributionInstance { - get => _ContributionInstance ?? new List(); + get => _ContributionInstance ??= []; set { _ContributionInstance = value; OnPropertyChanged("ContributionInstance"); } } @@ -4045,7 +4045,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4273,7 +4273,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -4315,7 +4315,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -4330,7 +4330,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -4497,7 +4497,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -4511,7 +4511,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -4525,7 +4525,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -4539,7 +4539,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -4553,7 +4553,7 @@ public List Endorser [DataMember] public List Summary { - get => _Summary ?? new List(); + get => _Summary ??= []; set { _Summary = value; OnPropertyChanged("Summary"); } } @@ -4567,7 +4567,7 @@ public List Summary [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -4581,7 +4581,7 @@ public List Classification [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -4596,7 +4596,7 @@ public List Note [DataMember] public List CurrentState { - get => _CurrentState ?? new List(); + get => _CurrentState ??= []; set { _CurrentState = value; OnPropertyChanged("CurrentState"); } } @@ -4610,7 +4610,7 @@ public List CurrentState [DataMember] public List StatusDate { - get => _StatusDate ?? new List(); + get => _StatusDate ??= []; set { _StatusDate = value; OnPropertyChanged("StatusDate"); } } @@ -4624,7 +4624,7 @@ public List StatusDate [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs index 92af68299..0c313fe6f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs @@ -947,7 +947,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1109,7 +1109,7 @@ public int? Sequence [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1171,7 +1171,7 @@ public Hl7.Fhir.Model.DataType? Procedure [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1414,7 +1414,7 @@ public string? BusinessArrangement [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1775,7 +1775,7 @@ public int? Sequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -1789,7 +1789,7 @@ public List TraceNumber [DataMember] public List CareTeamSequenceElement { - get => _CareTeamSequenceElement ?? new List(); + get => _CareTeamSequenceElement ??= []; set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } @@ -1821,7 +1821,7 @@ public IEnumerable? CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get => _DiagnosisSequenceElement ?? new List(); + get => _DiagnosisSequenceElement ??= []; set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } @@ -1853,7 +1853,7 @@ public IEnumerable? DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get => _ProcedureSequenceElement ?? new List(); + get => _ProcedureSequenceElement ??= []; set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } @@ -1885,7 +1885,7 @@ public IEnumerable? ProcedureSequence [DataMember] public List InformationSequenceElement { - get => _InformationSequenceElement ?? new List(); + get => _InformationSequenceElement ??= []; set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } @@ -1975,7 +1975,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -1990,7 +1990,7 @@ public List Request [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2005,7 +2005,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2146,7 +2146,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2160,7 +2160,7 @@ public List Udi [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -2176,7 +2176,7 @@ public List BodySite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -2190,7 +2190,7 @@ public List Encounter [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2498,7 +2498,7 @@ public partial class BodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -2513,7 +2513,7 @@ public List Site [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -2642,7 +2642,7 @@ public int? Sequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -2713,7 +2713,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2728,7 +2728,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2837,7 +2837,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2851,7 +2851,7 @@ public List Udi [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -3106,7 +3106,7 @@ public int? Sequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -3177,7 +3177,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3192,7 +3192,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3301,7 +3301,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3502,7 +3502,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3516,7 +3516,7 @@ public List Identifier [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -3752,7 +3752,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundsReserve [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -3826,7 +3826,7 @@ public Hl7.Fhir.Model.ResourceReference? Referral [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -3869,7 +3869,7 @@ public Hl7.Fhir.Model.CodeableConcept? DiagnosisRelatedGroup [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -3883,7 +3883,7 @@ public List Event [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -3897,7 +3897,7 @@ public List CareTeam [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -3911,7 +3911,7 @@ public List SupportingInfo [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -3925,7 +3925,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -3939,7 +3939,7 @@ public List Procedure [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -3979,7 +3979,7 @@ public Hl7.Fhir.Model.Money? PatientPaid [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs index bbdec2131..c2ead9be8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs @@ -232,7 +232,7 @@ public int? ItemSequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -246,7 +246,7 @@ public List TraceNumber [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -291,7 +291,7 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -305,7 +305,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -456,7 +456,7 @@ public Hl7.Fhir.Model.CodeableConcept? Decision [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -803,7 +803,7 @@ public int? DetailSequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -817,7 +817,7 @@ public List TraceNumber [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -862,7 +862,7 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -876,7 +876,7 @@ public List Adjudication [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -1041,7 +1041,7 @@ public int? SubDetailSequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -1055,7 +1055,7 @@ public List TraceNumber [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1100,7 +1100,7 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1227,7 +1227,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get => _ItemSequenceElement ?? new List(); + get => _ItemSequenceElement ??= []; set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } @@ -1259,7 +1259,7 @@ public IEnumerable? ItemSequence [DataMember] public List DetailSequenceElement { - get => _DetailSequenceElement ?? new List(); + get => _DetailSequenceElement ??= []; set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } @@ -1291,7 +1291,7 @@ public IEnumerable? DetailSequence [DataMember] public List SubdetailSequenceElement { - get => _SubdetailSequenceElement ?? new List(); + get => _SubdetailSequenceElement ??= []; set { _SubdetailSequenceElement = value; OnPropertyChanged("SubdetailSequenceElement"); } } @@ -1323,7 +1323,7 @@ public IEnumerable? SubdetailSequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -1339,7 +1339,7 @@ public List TraceNumber [DataMember] public List Provider { - get => _Provider ?? new List(); + get => _Provider ??= []; set { _Provider = value; OnPropertyChanged("Provider"); } } @@ -1397,7 +1397,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -1412,7 +1412,7 @@ public List Request [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1427,7 +1427,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1553,7 +1553,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -1567,7 +1567,7 @@ public List BodySite [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1612,7 +1612,7 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -1626,7 +1626,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -1916,7 +1916,7 @@ public partial class BodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -1931,7 +1931,7 @@ public List Site [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -2031,7 +2031,7 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -2088,7 +2088,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2182,7 +2182,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -2227,7 +2227,7 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2241,7 +2241,7 @@ public List Adjudication [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -2449,7 +2449,7 @@ public partial class AddedItemSubDetailComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -2506,7 +2506,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2600,7 +2600,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -2645,7 +2645,7 @@ public Hl7.Fhir.Model.ClaimResponse.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3699,7 +3699,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List ExpressionElement { - get => _ExpressionElement ?? new List(); + get => _ExpressionElement ??= []; set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } @@ -3828,7 +3828,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3842,7 +3842,7 @@ public List Identifier [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -4151,7 +4151,7 @@ public Hl7.Fhir.Model.Period? PreAuthPeriod [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -4181,7 +4181,7 @@ public Hl7.Fhir.Model.CodeableConcept? PayeeType [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -4209,7 +4209,7 @@ public Hl7.Fhir.Model.CodeableConcept? DiagnosisRelatedGroup [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -4223,7 +4223,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -4237,7 +4237,7 @@ public List AddItem [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -4251,7 +4251,7 @@ public List Adjudication [DataMember] public List Total { - get => _Total ?? new List(); + get => _Total ??= []; set { _Total = value; OnPropertyChanged("Total"); } } @@ -4319,7 +4319,7 @@ public Hl7.Fhir.Model.Attachment? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -4335,7 +4335,7 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get => _CommunicationRequest ?? new List(); + get => _CommunicationRequest ??= []; set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } @@ -4349,7 +4349,7 @@ public List CommunicationRequest [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -4363,7 +4363,7 @@ public List Insurance [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs index 8659fb999..8ac93c1b0 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs @@ -198,7 +198,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -391,7 +391,7 @@ public Hl7.Fhir.Model.ResourceReference? Previous [DataMember] public List Problem { - get => _Problem ?? new List(); + get => _Problem ??= []; set { _Problem = value; OnPropertyChanged("Problem"); } } @@ -419,7 +419,7 @@ public Hl7.Fhir.Model.CodeableConcept? ChangePattern [DataMember] public List ProtocolElement { - get => _ProtocolElement ?? new List(); + get => _ProtocolElement ??= []; set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } @@ -479,7 +479,7 @@ public string? Summary [DataMember] public List Finding { - get => _Finding ?? new List(); + get => _Finding ??= []; set { _Finding = value; OnPropertyChanged("Finding"); } } @@ -494,7 +494,7 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get => _PrognosisCodeableConcept ?? new List(); + get => _PrognosisCodeableConcept ??= []; set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } @@ -510,7 +510,7 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get => _PrognosisReference ?? new List(); + get => _PrognosisReference ??= []; set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } @@ -526,7 +526,7 @@ public List PrognosisReference [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -540,7 +540,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs index bed951801..8aaed7d9a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs @@ -149,7 +149,7 @@ public Hl7.Fhir.Model.CodeableReference? DiseaseStatus [DataMember] public List Comorbidity { - get => _Comorbidity ?? new List(); + get => _Comorbidity ??= []; set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } @@ -165,7 +165,7 @@ public List Comorbidity [DataMember] public List Indication { - get => _Indication ?? new List(); + get => _Indication ??= []; set { _Indication = value; OnPropertyChanged("Indication"); } } @@ -192,7 +192,7 @@ public Hl7.Fhir.Model.Expression? Applicability [DataMember] public List OtherTherapy { - get => _OtherTherapy ?? new List(); + get => _OtherTherapy ??= []; set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } @@ -470,7 +470,7 @@ public Hl7.Fhir.Model.CodeableReference? DiseaseStatus [DataMember] public List Comorbidity { - get => _Comorbidity ?? new List(); + get => _Comorbidity ??= []; set { _Comorbidity = value; OnPropertyChanged("Comorbidity"); } } @@ -515,7 +515,7 @@ public Hl7.Fhir.Model.DataType? Duration [DataMember] public List UndesirableEffect { - get => _UndesirableEffect ?? new List(); + get => _UndesirableEffect ??= []; set { _UndesirableEffect = value; OnPropertyChanged("UndesirableEffect"); } } @@ -542,7 +542,7 @@ public Hl7.Fhir.Model.Expression? Applicability [DataMember] public List OtherTherapy { - get => _OtherTherapy ?? new List(); + get => _OtherTherapy ??= []; set { _OtherTherapy = value; OnPropertyChanged("OtherTherapy"); } } @@ -693,7 +693,7 @@ public partial class InteractionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Interactant { - get => _Interactant ?? new List(); + get => _Interactant ??= []; set { _Interactant = value; OnPropertyChanged("Interactant"); } } @@ -750,7 +750,7 @@ public Hl7.Fhir.Model.CodeableConcept? Incidence [DataMember] public List Management { - get => _Management ?? new List(); + get => _Management ??= []; set { _Management = value; OnPropertyChanged("Management"); } } @@ -1221,7 +1221,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1267,7 +1267,7 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.ClinicalUseDefinitionType? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1283,7 +1283,7 @@ public List Category [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -1352,7 +1352,7 @@ public Hl7.Fhir.Model.ClinicalUseDefinition.InteractionComponent? Interaction [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -1366,7 +1366,7 @@ public List Population [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs index f63b6b49f..5ad00db5c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs @@ -164,7 +164,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -178,7 +178,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -210,7 +210,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -244,7 +244,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -260,7 +260,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -276,7 +276,7 @@ public List PartOf [DataMember] public List InResponseTo { - get => _InResponseTo ?? new List(); + get => _InResponseTo ??= []; set { _InResponseTo = value; OnPropertyChanged("InResponseTo"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.CodeableConcept? StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -381,7 +381,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -426,7 +426,7 @@ public Hl7.Fhir.Model.CodeableConcept? Topic [DataMember] public List About { - get => _About ?? new List(); + get => _About ??= []; set { _About = value; OnPropertyChanged("About"); } } @@ -513,7 +513,7 @@ public string? Received [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -543,7 +543,7 @@ public Hl7.Fhir.Model.ResourceReference? Sender [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -557,7 +557,7 @@ public List Reason [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -571,7 +571,7 @@ public List Payload [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs index 003a47363..9858c60be 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs @@ -164,7 +164,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -180,7 +180,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -196,7 +196,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -300,7 +300,7 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -373,7 +373,7 @@ public bool? DoNotPerform [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -404,7 +404,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List About { - get => _About ?? new List(); + get => _About ??= []; set { _About = value; OnPropertyChanged("About"); } } @@ -433,7 +433,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -507,7 +507,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -523,7 +523,7 @@ public List Recipient [DataMember] public List InformationProvider { - get => _InformationProvider ?? new List(); + get => _InformationProvider ??= []; set { _InformationProvider = value; OnPropertyChanged("InformationProvider"); } } @@ -538,7 +538,7 @@ public List InformationProvider [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -552,7 +552,7 @@ public List Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs index 321c81e15..43996d3d0 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs @@ -118,7 +118,7 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get => _ParamElement ?? new List(); + get => _ParamElement ??= []; set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } @@ -575,7 +575,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -617,7 +617,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -719,7 +719,7 @@ public bool? Search [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Composition.cs b/src/Hl7.Fhir.R5/Model/Generated/Composition.cs index d70693e34..fef4defd7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Composition.cs @@ -256,7 +256,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -400,7 +400,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -458,7 +458,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } @@ -486,7 +486,7 @@ public Hl7.Fhir.Model.CodeableConcept? EmptyReason [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } @@ -661,7 +661,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -750,7 +750,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -766,7 +766,7 @@ public List Category [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -824,7 +824,7 @@ public string? Date [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -840,7 +840,7 @@ public List UseContext [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -911,7 +911,7 @@ public string? Title [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -925,7 +925,7 @@ public List Note [DataMember] public List Attester { - get => _Attester ?? new List(); + get => _Attester ??= []; set { _Attester = value; OnPropertyChanged("Attester"); } } @@ -954,7 +954,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -968,7 +968,7 @@ public List RelatesTo [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -982,7 +982,7 @@ public List Event [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs index 579c7376c..df7f99dba 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs @@ -781,7 +781,7 @@ public string? Target [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -1025,7 +1025,7 @@ public bool? NoMap [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -1296,7 +1296,7 @@ public string? Comment [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1310,7 +1310,7 @@ public List Property [DataMember] public List DependsOn { - get => _DependsOn ?? new List(); + get => _DependsOn ??= []; set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } @@ -1324,7 +1324,7 @@ public List DependsOn [DataMember] public List Product { - get => _Product ?? new List(); + get => _Product ??= []; set { _Product = value; OnPropertyChanged("Product"); } } @@ -2084,7 +2084,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2312,7 +2312,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2354,7 +2354,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2369,7 +2369,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2537,7 +2537,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -2551,7 +2551,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -2565,7 +2565,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -2579,7 +2579,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -2593,7 +2593,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -2607,7 +2607,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2621,7 +2621,7 @@ public List RelatedArtifact [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -2635,7 +2635,7 @@ public List Property [DataMember] public List AdditionalAttribute { - get => _AdditionalAttribute ?? new List(); + get => _AdditionalAttribute ??= []; set { _AdditionalAttribute = value; OnPropertyChanged("AdditionalAttribute"); } } @@ -2679,7 +2679,7 @@ public Hl7.Fhir.Model.DataType? TargetScope [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Condition.cs b/src/Hl7.Fhir.R5/Model/Generated/Condition.cs index 9f3a48954..a474fbe82 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Condition.cs @@ -316,7 +316,7 @@ public Hl7.Fhir.Model.CodeableConcept? Summary [DataMember] public List Assessment { - get => _Assessment ?? new List(); + get => _Assessment ??= []; set { _Assessment = value; OnPropertyChanged("Assessment"); } } @@ -423,7 +423,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -467,7 +467,7 @@ public Hl7.Fhir.Model.CodeableConcept? VerificationStatus [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -510,7 +510,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -613,7 +613,7 @@ public string? RecordedDate [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -627,7 +627,7 @@ public List Participant [DataMember] public List Stage { - get => _Stage ?? new List(); + get => _Stage ??= []; set { _Stage = value; OnPropertyChanged("Stage"); } } @@ -642,7 +642,7 @@ public List Stage [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -656,7 +656,7 @@ public List Evidence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs index bb3179605..4601a300e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs @@ -768,7 +768,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1024,7 +1024,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1066,7 +1066,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1081,7 +1081,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1236,7 +1236,7 @@ public bool? HasStage [DataMember] public List DefinitionElement { - get => _DefinitionElement ?? new List(); + get => _DefinitionElement ??= []; set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } @@ -1268,7 +1268,7 @@ public IEnumerable? Definition [DataMember] public List Observation { - get => _Observation ?? new List(); + get => _Observation ??= []; set { _Observation = value; OnPropertyChanged("Observation"); } } @@ -1282,7 +1282,7 @@ public List Observation [DataMember] public List Medication { - get => _Medication ?? new List(); + get => _Medication ??= []; set { _Medication = value; OnPropertyChanged("Medication"); } } @@ -1296,7 +1296,7 @@ public List Medication [DataMember] public List Precondition { - get => _Precondition ?? new List(); + get => _Precondition ??= []; set { _Precondition = value; OnPropertyChanged("Precondition"); } } @@ -1312,7 +1312,7 @@ public List Preconditi [DataMember] public List Team { - get => _Team ?? new List(); + get => _Team ??= []; set { _Team = value; OnPropertyChanged("Team"); } } @@ -1326,7 +1326,7 @@ public List Team [DataMember] public List Questionnaire { - get => _Questionnaire ?? new List(); + get => _Questionnaire ??= []; set { _Questionnaire = value; OnPropertyChanged("Questionnaire"); } } @@ -1340,7 +1340,7 @@ public List Questionn [DataMember] public List Plan { - get => _Plan ?? new List(); + get => _Plan ??= []; set { _Plan = value; OnPropertyChanged("Plan"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs index 747f82597..b0bf16070 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs @@ -335,7 +335,7 @@ public Hl7.Fhir.Model.ResourceReference? VerifiedWith [DataMember] public List VerificationDateElement { - get => _VerificationDateElement ?? new List(); + get => _VerificationDateElement ??= []; set { _VerificationDateElement = value; OnPropertyChanged("VerificationDateElement"); } } @@ -493,7 +493,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -508,7 +508,7 @@ public List Actor [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -523,7 +523,7 @@ public List Action [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -538,7 +538,7 @@ public List SecurityLabel [DataMember] public List Purpose { - get => _Purpose ?? new List(); + get => _Purpose ??= []; set { _Purpose = value; OnPropertyChanged("Purpose"); } } @@ -553,7 +553,7 @@ public List Purpose [DataMember] public List DocumentType { - get => _DocumentType ?? new List(); + get => _DocumentType ??= []; set { _DocumentType = value; OnPropertyChanged("DocumentType"); } } @@ -568,7 +568,7 @@ public List DocumentType [DataMember] public List ResourceType { - get => _ResourceType ?? new List(); + get => _ResourceType ??= []; set { _ResourceType = value; OnPropertyChanged("ResourceType"); } } @@ -583,7 +583,7 @@ public List ResourceType [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -610,7 +610,7 @@ public Hl7.Fhir.Model.Period? DataPeriod [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } @@ -637,7 +637,7 @@ public Hl7.Fhir.Model.Expression? Expression [DataMember] public List Provision { - get => _Provision ?? new List(); + get => _Provision ??= []; set { _Provision = value; OnPropertyChanged("Provision"); } } @@ -1059,7 +1059,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1105,7 +1105,7 @@ public Hl7.Fhir.Model.Consent.ConsentState? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1177,7 +1177,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Grantor { - get => _Grantor ?? new List(); + get => _Grantor ??= []; set { _Grantor = value; OnPropertyChanged("Grantor"); } } @@ -1193,7 +1193,7 @@ public List Grantor [DataMember] public List Grantee { - get => _Grantee ?? new List(); + get => _Grantee ??= []; set { _Grantee = value; OnPropertyChanged("Grantee"); } } @@ -1209,7 +1209,7 @@ public List Grantee [DataMember] public List Manager { - get => _Manager ?? new List(); + get => _Manager ??= []; set { _Manager = value; OnPropertyChanged("Manager"); } } @@ -1225,7 +1225,7 @@ public List Manager [DataMember] public List Controller { - get => _Controller ?? new List(); + get => _Controller ??= []; set { _Controller = value; OnPropertyChanged("Controller"); } } @@ -1239,7 +1239,7 @@ public List Controller [DataMember] public List SourceAttachment { - get => _SourceAttachment ?? new List(); + get => _SourceAttachment ??= []; set { _SourceAttachment = value; OnPropertyChanged("SourceAttachment"); } } @@ -1255,7 +1255,7 @@ public List SourceAttachment [DataMember] public List SourceReference { - get => _SourceReference ?? new List(); + get => _SourceReference ??= []; set { _SourceReference = value; OnPropertyChanged("SourceReference"); } } @@ -1270,7 +1270,7 @@ public List SourceReference [DataMember] public List RegulatoryBasis { - get => _RegulatoryBasis ?? new List(); + get => _RegulatoryBasis ??= []; set { _RegulatoryBasis = value; OnPropertyChanged("RegulatoryBasis"); } } @@ -1299,7 +1299,7 @@ public Hl7.Fhir.Model.Consent.PolicyBasisComponent? PolicyBasis [DataMember] public List PolicyText { - get => _PolicyText ?? new List(); + get => _PolicyText ??= []; set { _PolicyText = value; OnPropertyChanged("PolicyText"); } } @@ -1313,7 +1313,7 @@ public List PolicyText [DataMember] public List Verification { - get => _Verification ?? new List(); + get => _Verification ??= []; set { _Verification = value; OnPropertyChanged("Verification"); } } @@ -1357,7 +1357,7 @@ public Hl7.Fhir.Model.ConsentProvisionType? Decision [DataMember] public List Provision { - get => _Provision ?? new List(); + get => _Provision ??= []; set { _Provision = value; OnPropertyChanged("Provision"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs index 00471a1d8..aef91e5f1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs @@ -665,7 +665,7 @@ public string? Text [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -693,7 +693,7 @@ public Hl7.Fhir.Model.Contract.ContractOfferComponent? Offer [DataMember] public List Asset { - get => _Asset ?? new List(); + get => _Asset ??= []; set { _Asset = value; OnPropertyChanged("Asset"); } } @@ -707,7 +707,7 @@ public List Asset [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -721,7 +721,7 @@ public List Action [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -913,7 +913,7 @@ public partial class SecurityLabelComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List NumberElement { - get => _NumberElement ?? new List(); + get => _NumberElement ??= []; set { _NumberElement = value; OnPropertyChanged("NumberElement"); } } @@ -961,7 +961,7 @@ public Hl7.Fhir.Model.Coding? Classification [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -976,7 +976,7 @@ public List Category [DataMember] public List Control { - get => _Control ?? new List(); + get => _Control ??= []; set { _Control = value; OnPropertyChanged("Control"); } } @@ -1094,7 +1094,7 @@ public partial class ContractOfferComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1108,7 +1108,7 @@ public List Identifier [DataMember] public List Party { - get => _Party ?? new List(); + get => _Party ??= []; set { _Party = value; OnPropertyChanged("Party"); } } @@ -1166,7 +1166,7 @@ public Hl7.Fhir.Model.CodeableConcept? Decision [DataMember] public List DecisionMode { - get => _DecisionMode ?? new List(); + get => _DecisionMode ??= []; set { _DecisionMode = value; OnPropertyChanged("DecisionMode"); } } @@ -1180,7 +1180,7 @@ public List DecisionMode [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -1222,7 +1222,7 @@ public string? Text [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -1254,7 +1254,7 @@ public IEnumerable? LinkId [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -1443,7 +1443,7 @@ public partial class ContractPartyComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -1661,7 +1661,7 @@ public Hl7.Fhir.Model.CodeableConcept? Scope [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1677,7 +1677,7 @@ public List Type [DataMember] public List TypeReference { - get => _TypeReference ?? new List(); + get => _TypeReference ??= []; set { _TypeReference = value; OnPropertyChanged("TypeReference"); } } @@ -1692,7 +1692,7 @@ public List TypeReference [DataMember] public List Subtype { - get => _Subtype ?? new List(); + get => _Subtype ??= []; set { _Subtype = value; OnPropertyChanged("Subtype"); } } @@ -1720,7 +1720,7 @@ public Hl7.Fhir.Model.Coding? Relationship [DataMember] public List Context { - get => _Context ?? new List(); + get => _Context ??= []; set { _Context = value; OnPropertyChanged("Context"); } } @@ -1763,7 +1763,7 @@ public string? Condition [DataMember] public List PeriodType { - get => _PeriodType ?? new List(); + get => _PeriodType ??= []; set { _PeriodType = value; OnPropertyChanged("PeriodType"); } } @@ -1777,7 +1777,7 @@ public List PeriodType [DataMember] public List Period { - get => _Period ?? new List(); + get => _Period ??= []; set { _Period = value; OnPropertyChanged("Period"); } } @@ -1791,7 +1791,7 @@ public List Period [DataMember] public List UsePeriod { - get => _UsePeriod ?? new List(); + get => _UsePeriod ??= []; set { _UsePeriod = value; OnPropertyChanged("UsePeriod"); } } @@ -1833,7 +1833,7 @@ public string? Text [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -1865,7 +1865,7 @@ public IEnumerable? LinkId [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -1879,7 +1879,7 @@ public List Answer [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -1911,7 +1911,7 @@ public IEnumerable? SecurityLabelNumber [DataMember] public List ValuedItem { - get => _ValuedItem ?? new List(); + get => _ValuedItem ??= []; set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } @@ -2141,7 +2141,7 @@ public Hl7.Fhir.Model.ResourceReference? Reference [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2513,7 +2513,7 @@ public Hl7.Fhir.Model.ResourceReference? Recipient [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -2545,7 +2545,7 @@ public IEnumerable? LinkId [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -2816,7 +2816,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -2845,7 +2845,7 @@ public Hl7.Fhir.Model.CodeableConcept? Intent [DataMember] public List LinkIdElement { - get => _LinkIdElement ?? new List(); + get => _LinkIdElement ??= []; set { _LinkIdElement = value; OnPropertyChanged("LinkIdElement"); } } @@ -2907,7 +2907,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List ContextLinkIdElement { - get => _ContextLinkIdElement ?? new List(); + get => _ContextLinkIdElement ??= []; set { _ContextLinkIdElement = value; OnPropertyChanged("ContextLinkIdElement"); } } @@ -2956,7 +2956,7 @@ public Hl7.Fhir.Model.DataType? Occurrence [DataMember] public List Requester { - get => _Requester ?? new List(); + get => _Requester ??= []; set { _Requester = value; OnPropertyChanged("Requester"); } } @@ -2970,7 +2970,7 @@ public List Requester [DataMember] public List RequesterLinkIdElement { - get => _RequesterLinkIdElement ?? new List(); + get => _RequesterLinkIdElement ??= []; set { _RequesterLinkIdElement = value; OnPropertyChanged("RequesterLinkIdElement"); } } @@ -3003,7 +3003,7 @@ public IEnumerable? RequesterLinkId [DataMember] public List PerformerType { - get => _PerformerType ?? new List(); + get => _PerformerType ??= []; set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } @@ -3046,7 +3046,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List PerformerLinkIdElement { - get => _PerformerLinkIdElement ?? new List(); + get => _PerformerLinkIdElement ??= []; set { _PerformerLinkIdElement = value; OnPropertyChanged("PerformerLinkIdElement"); } } @@ -3079,7 +3079,7 @@ public IEnumerable? PerformerLinkId [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -3093,7 +3093,7 @@ public List Reason [DataMember] public List ReasonLinkIdElement { - get => _ReasonLinkIdElement ?? new List(); + get => _ReasonLinkIdElement ??= []; set { _ReasonLinkIdElement = value; OnPropertyChanged("ReasonLinkIdElement"); } } @@ -3125,7 +3125,7 @@ public IEnumerable? ReasonLinkId [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -3139,7 +3139,7 @@ public List Note [DataMember] public List SecurityLabelNumberElement { - get => _SecurityLabelNumberElement ?? new List(); + get => _SecurityLabelNumberElement ??= []; set { _SecurityLabelNumberElement = value; OnPropertyChanged("SecurityLabelNumberElement"); } } @@ -3409,7 +3409,7 @@ public partial class ActionSubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -3556,7 +3556,7 @@ public Hl7.Fhir.Model.ResourceReference? Party [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } @@ -3931,7 +3931,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4159,7 +4159,7 @@ public Hl7.Fhir.Model.CodeableConcept? ExpirationType [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -4175,7 +4175,7 @@ public List Subject [DataMember] public List Authority { - get => _Authority ?? new List(); + get => _Authority ??= []; set { _Authority = value; OnPropertyChanged("Authority"); } } @@ -4191,7 +4191,7 @@ public List Authority [DataMember] public List Domain { - get => _Domain ?? new List(); + get => _Domain ??= []; set { _Domain = value; OnPropertyChanged("Domain"); } } @@ -4207,7 +4207,7 @@ public List Domain [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -4305,7 +4305,7 @@ public string? Subtitle [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -4397,7 +4397,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List SubType { - get => _SubType ?? new List(); + get => _SubType ??= []; set { _SubType = value; OnPropertyChanged("SubType"); } } @@ -4424,7 +4424,7 @@ public Hl7.Fhir.Model.Contract.ContentDefinitionComponent? ContentDefinition [DataMember] public List Term { - get => _Term ?? new List(); + get => _Term ??= []; set { _Term = value; OnPropertyChanged("Term"); } } @@ -4440,7 +4440,7 @@ public List Term [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -4456,7 +4456,7 @@ public List SupportingInfo [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -4470,7 +4470,7 @@ public List RelevantHistory [DataMember] public List Signer { - get => _Signer ?? new List(); + get => _Signer ??= []; set { _Signer = value; OnPropertyChanged("Signer"); } } @@ -4484,7 +4484,7 @@ public List Signer [DataMember] public List Friendly { - get => _Friendly ?? new List(); + get => _Friendly ??= []; set { _Friendly = value; OnPropertyChanged("Friendly"); } } @@ -4498,7 +4498,7 @@ public List Friendly [DataMember] public List Legal { - get => _Legal ?? new List(); + get => _Legal ??= []; set { _Legal = value; OnPropertyChanged("Legal"); } } @@ -4512,7 +4512,7 @@ public List Legal [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs index 31d8468ca..77bcc6979 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs @@ -164,7 +164,7 @@ public string? Name [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs index 2d47f8b46..4b6c1e683 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs @@ -484,7 +484,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Exception { - get => _Exception ?? new List(); + get => _Exception ??= []; set { _Exception = value; OnPropertyChanged("Exception"); } } @@ -727,7 +727,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -803,7 +803,7 @@ public Hl7.Fhir.Model.Coverage.CoverageKindCode? Kind [DataMember] public List PaymentBy { - get => _PaymentBy ?? new List(); + get => _PaymentBy ??= []; set { _PaymentBy = value; OnPropertyChanged("PaymentBy"); } } @@ -861,7 +861,7 @@ public Hl7.Fhir.Model.ResourceReference? Subscriber [DataMember] public List SubscriberId { - get => _SubscriberId ?? new List(); + get => _SubscriberId ??= []; set { _SubscriberId = value; OnPropertyChanged("SubscriberId"); } } @@ -961,7 +961,7 @@ public Hl7.Fhir.Model.ResourceReference? Insurer [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -1031,7 +1031,7 @@ public string? Network [DataMember] public List CostToBeneficiary { - get => _CostToBeneficiary ?? new List(); + get => _CostToBeneficiary ??= []; set { _CostToBeneficiary = value; OnPropertyChanged("CostToBeneficiary"); } } @@ -1075,7 +1075,7 @@ public bool? Subrogation [DataMember] public List Contract { - get => _Contract ?? new List(); + get => _Contract ??= []; set { _Contract = value; OnPropertyChanged("Contract"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs index 5e6a77f95..5ce0b0787 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs @@ -574,7 +574,7 @@ public partial class DetailsComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SupportingInfoSequenceElement { - get => _SupportingInfoSequenceElement ?? new List(); + get => _SupportingInfoSequenceElement ??= []; set { _SupportingInfoSequenceElement = value; OnPropertyChanged("SupportingInfoSequenceElement"); } } @@ -635,7 +635,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -705,7 +705,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -721,7 +721,7 @@ public List Diagno [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -971,7 +971,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1032,7 +1032,7 @@ public Hl7.Fhir.Model.CodeableConcept? Priority [DataMember] public List> PurposeElement { - get => _PurposeElement ?? new List>(); + get => _PurposeElement ??= []; set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } @@ -1080,7 +1080,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -1199,7 +1199,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -1213,7 +1213,7 @@ public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1227,7 +1227,7 @@ public List Insura [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs index 1712a4136..d255ba6dd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs @@ -329,7 +329,7 @@ public Hl7.Fhir.Model.Period? BenefitPeriod [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -476,7 +476,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrService [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -631,7 +631,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -674,7 +674,7 @@ public bool? AuthorizationRequired [DataMember] public List AuthorizationSupporting { - get => _AuthorizationSupporting ?? new List(); + get => _AuthorizationSupporting ??= []; set { _AuthorizationSupporting = value; OnPropertyChanged("AuthorizationSupporting"); } } @@ -1065,7 +1065,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List ExpressionElement { - get => _ExpressionElement ?? new List(); + get => _ExpressionElement ??= []; set { _ExpressionElement = value; OnPropertyChanged("ExpressionElement"); } } @@ -1167,7 +1167,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1214,7 +1214,7 @@ public Hl7.Fhir.Model.FinancialResourceStatusCodes? Status [DataMember] public List> PurposeElement { - get => _PurposeElement ?? new List>(); + get => _PurposeElement ??= []; set { _PurposeElement = value; OnPropertyChanged("PurposeElement"); } } @@ -1262,7 +1262,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -1426,7 +1426,7 @@ public Hl7.Fhir.Model.ResourceReference? Insurer [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1482,7 +1482,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs index 42c6430a1..8fafba8ec 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs @@ -244,7 +244,7 @@ public string? ValueSet [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -895,7 +895,7 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -944,7 +944,7 @@ public Hl7.Fhir.Model.DataType? Subject [DataMember] public List MustSupportElement { - get => _MustSupportElement ?? new List(); + get => _MustSupportElement ??= []; set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } @@ -976,7 +976,7 @@ public IEnumerable? MustSupport [DataMember] public List CodeFilter { - get => _CodeFilter ?? new List(); + get => _CodeFilter ??= []; set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } @@ -990,7 +990,7 @@ public List CodeFilter [DataMember] public List DateFilter { - get => _DateFilter ?? new List(); + get => _DateFilter ??= []; set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } @@ -1004,7 +1004,7 @@ public List DateFilter [DataMember] public List ValueFilter { - get => _ValueFilter ?? new List(); + get => _ValueFilter ??= []; set { _ValueFilter = value; OnPropertyChanged("ValueFilter"); } } @@ -1046,7 +1046,7 @@ public int? Limit [DataMember] public List Sort { - get => _Sort ?? new List(); + get => _Sort ??= []; set { _Sort = value; OnPropertyChanged("Sort"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs index f6c8f2824..afeac5c2b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs @@ -149,7 +149,7 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -165,7 +165,7 @@ public List Code [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -323,7 +323,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -425,7 +425,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -471,7 +471,7 @@ public Hl7.Fhir.Model.DetectedIssue.DetectedIssueStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -591,7 +591,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Implicated { - get => _Implicated ?? new List(); + get => _Implicated ??= []; set { _Implicated = value; OnPropertyChanged("Implicated"); } } @@ -605,7 +605,7 @@ public List Implicated [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -675,7 +675,7 @@ public string? Reference [DataMember] public List Mitigation { - get => _Mitigation ?? new List(); + get => _Mitigation ??= []; set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Device.cs b/src/Hl7.Fhir.R5/Model/Generated/Device.cs index d21f0a898..afcf3ab37 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Device.cs @@ -1083,7 +1083,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1138,7 +1138,7 @@ public Hl7.Fhir.Model.CodeableReference? Definition [DataMember] public List UdiCarrier { - get => _UdiCarrier ?? new List(); + get => _UdiCarrier ??= []; set { _UdiCarrier = value; OnPropertyChanged("UdiCarrier"); } } @@ -1349,7 +1349,7 @@ public string? SerialNumber [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -1420,7 +1420,7 @@ public string? PartNumber [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1435,7 +1435,7 @@ public List Category [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1449,7 +1449,7 @@ public List Type [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -1463,7 +1463,7 @@ public List Version [DataMember] public List ConformsTo { - get => _ConformsTo ?? new List(); + get => _ConformsTo ??= []; set { _ConformsTo = value; OnPropertyChanged("ConformsTo"); } } @@ -1477,7 +1477,7 @@ public List ConformsTo [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1546,7 +1546,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1605,7 +1605,7 @@ public string? Url [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1619,7 +1619,7 @@ public List Endpoint [DataMember] public List Gateway { - get => _Gateway ?? new List(); + get => _Gateway ??= []; set { _Gateway = value; OnPropertyChanged("Gateway"); } } @@ -1633,7 +1633,7 @@ public List Gateway [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1648,7 +1648,7 @@ public List Note [DataMember] public List Safety { - get => _Safety ?? new List(); + get => _Safety ??= []; set { _Safety = value; OnPropertyChanged("Safety"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs index 456bc111b..f4d67646c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs @@ -137,7 +137,7 @@ public Hl7.Fhir.Model.CodeableConcept? Status [DataMember] public List Operator { - get => _Operator ?? new List(); + get => _Operator ??= []; set { _Operator = value; OnPropertyChanged("Operator"); } } @@ -243,7 +243,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -273,7 +273,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -303,7 +303,7 @@ public Hl7.Fhir.Model.CodeableConcept? Status [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -360,7 +360,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Operation { - get => _Operation ?? new List(); + get => _Operation ??= []; set { _Operation = value; OnPropertyChanged("Operation"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs index 05e8c9c3b..aca5ec7b4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs @@ -276,7 +276,7 @@ public string? Jurisdiction [DataMember] public List MarketDistribution { - get => _MarketDistribution ?? new List(); + get => _MarketDistribution ??= []; set { _MarketDistribution = value; OnPropertyChanged("MarketDistribution"); } } @@ -904,7 +904,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Justification { - get => _Justification ?? new List(); + get => _Justification ??= []; set { _Justification = value; OnPropertyChanged("Justification"); } } @@ -1033,7 +1033,7 @@ public Hl7.Fhir.Model.CodeableConcept? Specification [DataMember] public List VersionElement { - get => _VersionElement ?? new List(); + get => _VersionElement ??= []; set { _VersionElement = value; OnPropertyChanged("VersionElement"); } } @@ -1065,7 +1065,7 @@ public IEnumerable? Version [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1364,7 +1364,7 @@ public int? Count [DataMember] public List Distributor { - get => _Distributor ?? new List(); + get => _Distributor ??= []; set { _Distributor = value; OnPropertyChanged("Distributor"); } } @@ -1378,7 +1378,7 @@ public List Distr [DataMember] public List UdiDeviceIdentifier { - get => _UdiDeviceIdentifier ?? new List(); + get => _UdiDeviceIdentifier ??= []; set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } @@ -1392,7 +1392,7 @@ public List UdiDev [DataMember] public List Packaging { - get => _Packaging ?? new List(); + get => _Packaging ??= []; set { _Packaging = value; OnPropertyChanged("Packaging"); } } @@ -1555,7 +1555,7 @@ public string? Name [DataMember] public List OrganizationReference { - get => _OrganizationReference ?? new List(); + get => _OrganizationReference ??= []; set { _OrganizationReference = value; OnPropertyChanged("OrganizationReference"); } } @@ -2194,7 +2194,7 @@ public partial class GuidelineComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2236,7 +2236,7 @@ public string? UsageInstruction [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2250,7 +2250,7 @@ public List RelatedArtifact [DataMember] public List Indication { - get => _Indication ?? new List(); + get => _Indication ??= []; set { _Indication = value; OnPropertyChanged("Indication"); } } @@ -2264,7 +2264,7 @@ public List Indication [DataMember] public List Contraindication { - get => _Contraindication ?? new List(); + get => _Contraindication ??= []; set { _Contraindication = value; OnPropertyChanged("Contraindication"); } } @@ -2278,7 +2278,7 @@ public List Contraindication [DataMember] public List Warning { - get => _Warning ?? new List(); + get => _Warning ??= []; set { _Warning = value; OnPropertyChanged("Warning"); } } @@ -2654,7 +2654,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2784,7 +2784,7 @@ public string? Description [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2798,7 +2798,7 @@ public List Identifier [DataMember] public List UdiDeviceIdentifier { - get => _UdiDeviceIdentifier ?? new List(); + get => _UdiDeviceIdentifier ??= []; set { _UdiDeviceIdentifier = value; OnPropertyChanged("UdiDeviceIdentifier"); } } @@ -2812,7 +2812,7 @@ public List UdiDev [DataMember] public List RegulatoryIdentifier { - get => _RegulatoryIdentifier ?? new List(); + get => _RegulatoryIdentifier ??= []; set { _RegulatoryIdentifier = value; OnPropertyChanged("RegulatoryIdentifier"); } } @@ -2869,7 +2869,7 @@ public Hl7.Fhir.Model.ResourceReference? Manufacturer [DataMember] public List DeviceName { - get => _DeviceName ?? new List(); + get => _DeviceName ??= []; set { _DeviceName = value; OnPropertyChanged("DeviceName"); } } @@ -2911,7 +2911,7 @@ public string? ModelNumber [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -2925,7 +2925,7 @@ public List Classificat [DataMember] public List ConformsTo { - get => _ConformsTo ?? new List(); + get => _ConformsTo ??= []; set { _ConformsTo = value; OnPropertyChanged("ConformsTo"); } } @@ -2939,7 +2939,7 @@ public List ConformsTo [DataMember] public List HasPart { - get => _HasPart ?? new List(); + get => _HasPart ??= []; set { _HasPart = value; OnPropertyChanged("HasPart"); } } @@ -2953,7 +2953,7 @@ public List HasPart [DataMember] public List Packaging { - get => _Packaging ?? new List(); + get => _Packaging ??= []; set { _Packaging = value; OnPropertyChanged("Packaging"); } } @@ -2967,7 +2967,7 @@ public List Packaging [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -2982,7 +2982,7 @@ public List Version [DataMember] public List Safety { - get => _Safety ?? new List(); + get => _Safety ??= []; set { _Safety = value; OnPropertyChanged("Safety"); } } @@ -2996,7 +2996,7 @@ public List Safety [DataMember] public List ShelfLifeStorage { - get => _ShelfLifeStorage ?? new List(); + get => _ShelfLifeStorage ??= []; set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } @@ -3010,7 +3010,7 @@ public List ShelfLifeStorage [DataMember] public List LanguageCode { - get => _LanguageCode ?? new List(); + get => _LanguageCode ??= []; set { _LanguageCode = value; OnPropertyChanged("LanguageCode"); } } @@ -3024,7 +3024,7 @@ public List LanguageCode [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -3053,7 +3053,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -3067,7 +3067,7 @@ public List Contact [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -3081,7 +3081,7 @@ public List Link [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -3095,7 +3095,7 @@ public List Note [DataMember] public List Material { - get => _Material ?? new List(); + get => _Material ??= []; set { _Material = value; OnPropertyChanged("Material"); } } @@ -3111,7 +3111,7 @@ public List Material [DataMember] public List> ProductionIdentifierInUDIElement { - get => _ProductionIdentifierInUDIElement ?? new List>(); + get => _ProductionIdentifierInUDIElement ??= []; set { _ProductionIdentifierInUDIElement = value; OnPropertyChanged("ProductionIdentifierInUDIElement"); } } @@ -3169,7 +3169,7 @@ public Hl7.Fhir.Model.DeviceDefinition.CorrectiveActionComponent? CorrectiveActi [DataMember] public List ChargeItem { - get => _ChargeItem ?? new List(); + get => _ChargeItem ??= []; set { _ChargeItem = value; OnPropertyChanged("ChargeItem"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs index 857528786..ed5149ac2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs @@ -249,7 +249,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -265,7 +265,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -281,7 +281,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -340,7 +340,7 @@ public Hl7.Fhir.Model.CodeableReference? StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -416,7 +416,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -430,7 +430,7 @@ public List SupportingInformation [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -556,7 +556,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -600,7 +600,7 @@ public string? UsageInstruction [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs index 093773b01..3af4dba9f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs @@ -387,7 +387,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -548,7 +548,7 @@ public Hl7.Fhir.Model.Quantity? MeasurementFrequency [DataMember] public List Calibration { - get => _Calibration ?? new List(); + get => _Calibration ??= []; set { _Calibration = value; OnPropertyChanged("Calibration"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs index ced971a57..684147112 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs @@ -185,7 +185,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -199,7 +199,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -231,7 +231,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -265,7 +265,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -281,7 +281,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -470,7 +470,7 @@ public int? Quantity [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -587,7 +587,7 @@ public Hl7.Fhir.Model.CodeableReference? Performer [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -644,7 +644,7 @@ public Hl7.Fhir.Model.CodeableConcept? AsNeededFor [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -660,7 +660,7 @@ public List Insurance [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -674,7 +674,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -690,7 +690,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs index 80e5bed63..30385ca53 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs @@ -154,7 +154,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -238,7 +238,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -254,7 +254,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -299,7 +299,7 @@ public Hl7.Fhir.Model.DeviceUsage.DeviceUsageStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -331,7 +331,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -417,7 +417,7 @@ public Hl7.Fhir.Model.CodeableConcept? UsageStatus [DataMember] public List UsageReason { - get => _UsageReason ?? new List(); + get => _UsageReason ??= []; set { _UsageReason = value; OnPropertyChanged("UsageReason"); } } @@ -473,7 +473,7 @@ public Hl7.Fhir.Model.CodeableReference? Device [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -501,7 +501,7 @@ public Hl7.Fhir.Model.CodeableReference? BodySite [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs index 5dfd2dd36..26bf8ad4d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs @@ -394,7 +394,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -410,7 +410,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -456,7 +456,7 @@ public Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -560,7 +560,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -576,7 +576,7 @@ public List Performer [DataMember] public List ResultsInterpreter { - get => _ResultsInterpreter ?? new List(); + get => _ResultsInterpreter ??= []; set { _ResultsInterpreter = value; OnPropertyChanged("ResultsInterpreter"); } } @@ -592,7 +592,7 @@ public List ResultsInterpreter [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -608,7 +608,7 @@ public List Specimen [DataMember] public List Result { - get => _Result ?? new List(); + get => _Result ??= []; set { _Result = value; OnPropertyChanged("Result"); } } @@ -622,7 +622,7 @@ public List Result [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -638,7 +638,7 @@ public List Note [DataMember] public List Study { - get => _Study ?? new List(); + get => _Study ??= []; set { _Study = value; OnPropertyChanged("Study"); } } @@ -652,7 +652,7 @@ public List Study [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -666,7 +666,7 @@ public List SupportingI [DataMember] public List Media { - get => _Media ?? new List(); + get => _Media ??= []; set { _Media = value; OnPropertyChanged("Media"); } } @@ -724,7 +724,7 @@ public string? Conclusion [DataMember] public List ConclusionCode { - get => _ConclusionCode ?? new List(); + get => _ConclusionCode ??= []; set { _ConclusionCode = value; OnPropertyChanged("ConclusionCode"); } } @@ -738,7 +738,7 @@ public List ConclusionCode [DataMember] public List PresentedForm { - get => _PresentedForm ?? new List(); + get => _PresentedForm ??= []; set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs index 03f1d1ab5..c8bc2e1a4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs @@ -402,7 +402,7 @@ public Hl7.Fhir.Model.Attachment? Attachment [DataMember] public List Profile { - get => _Profile ?? new List(); + get => _Profile ??= []; set { _Profile = value; OnPropertyChanged("Profile"); } } @@ -582,7 +582,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -626,7 +626,7 @@ public string? Version [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -702,7 +702,7 @@ public Hl7.Fhir.Model.CompositionStatus? DocStatus [DataMember] public List Modality { - get => _Modality ?? new List(); + get => _Modality ??= []; set { _Modality = value; OnPropertyChanged("Modality"); } } @@ -731,7 +731,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -762,7 +762,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Context { - get => _Context ?? new List(); + get => _Context ??= []; set { _Context = value; OnPropertyChanged("Context"); } } @@ -777,7 +777,7 @@ public List Context [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -792,7 +792,7 @@ public List Event [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -877,7 +877,7 @@ public DateTimeOffset? Date [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -891,7 +891,7 @@ public List Author [DataMember] public List Attester { - get => _Attester ?? new List(); + get => _Attester ??= []; set { _Attester = value; OnPropertyChanged("Attester"); } } @@ -920,7 +920,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -963,7 +963,7 @@ public string? Description [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -977,7 +977,7 @@ public List SecurityLabel [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs index 90bf8b7bb..a73d3ebc5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs @@ -266,7 +266,7 @@ public string? Text [DataMember] public List AdditionalInstruction { - get => _AdditionalInstruction ?? new List(); + get => _AdditionalInstruction ??= []; set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } @@ -350,7 +350,7 @@ public bool? AsNeeded [DataMember] public List AsNeededFor { - get => _AsNeededFor ?? new List(); + get => _AsNeededFor ??= []; set { _AsNeededFor = value; OnPropertyChanged("AsNeededFor"); } } @@ -406,7 +406,7 @@ public Hl7.Fhir.Model.CodeableConcept? Method [DataMember] public List DoseAndRate { - get => _DoseAndRate ?? new List(); + get => _DoseAndRate ??= []; set { _DoseAndRate = value; OnPropertyChanged("DoseAndRate"); } } @@ -420,7 +420,7 @@ public List DoseAndRate [DataMember] public List MaxDosePerPeriod { - get => _MaxDosePerPeriod ?? new List(); + get => _MaxDosePerPeriod ??= []; set { _MaxDosePerPeriod = value; OnPropertyChanged("MaxDosePerPeriod"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs index e9d47ace5..068ff53b2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs @@ -124,7 +124,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -265,7 +265,7 @@ public partial class ReasonComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Use { - get => _Use ?? new List(); + get => _Use ??= []; set { _Use = value; OnPropertyChanged("Use"); } } @@ -280,7 +280,7 @@ public List Use [DataMember] public List Value { - get => _Value ?? new List(); + get => _Value ??= []; set { _Value = value; OnPropertyChanged("Value"); } } @@ -381,7 +381,7 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -396,7 +396,7 @@ public List Condition [DataMember] public List Use { - get => _Use ?? new List(); + get => _Use ??= []; set { _Use = value; OnPropertyChanged("Use"); } } @@ -868,7 +868,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -914,7 +914,7 @@ public Hl7.Fhir.Model.EncounterStatus? Status [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -943,7 +943,7 @@ public Hl7.Fhir.Model.CodeableConcept? Priority [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -958,7 +958,7 @@ public List Type [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -1003,7 +1003,7 @@ public Hl7.Fhir.Model.CodeableConcept? SubjectStatus [DataMember] public List EpisodeOfCare { - get => _EpisodeOfCare ?? new List(); + get => _EpisodeOfCare ??= []; set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } @@ -1019,7 +1019,7 @@ public List EpisodeOfCare [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1035,7 +1035,7 @@ public List BasedOn [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -1079,7 +1079,7 @@ public Hl7.Fhir.Model.ResourceReference? ServiceProvider [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1095,7 +1095,7 @@ public List Participant [DataMember] public List Appointment { - get => _Appointment ?? new List(); + get => _Appointment ??= []; set { _Appointment = value; OnPropertyChanged("Appointment"); } } @@ -1109,7 +1109,7 @@ public List Appointment [DataMember] public List VirtualService { - get => _VirtualService ?? new List(); + get => _VirtualService ??= []; set { _VirtualService = value; OnPropertyChanged("VirtualService"); } } @@ -1205,7 +1205,7 @@ public Hl7.Fhir.Model.Duration? Length [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1219,7 +1219,7 @@ public List Reason [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -1235,7 +1235,7 @@ public List Diagnosis [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -1250,7 +1250,7 @@ public List Account [DataMember] public List DietPreference { - get => _DietPreference ?? new List(); + get => _DietPreference ??= []; set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } @@ -1265,7 +1265,7 @@ public List DietPreference [DataMember] public List SpecialArrangement { - get => _SpecialArrangement ?? new List(); + get => _SpecialArrangement ??= []; set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } @@ -1280,7 +1280,7 @@ public List SpecialArrangement [DataMember] public List SpecialCourtesy { - get => _SpecialCourtesy ?? new List(); + get => _SpecialCourtesy ??= []; set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } @@ -1307,7 +1307,7 @@ public Hl7.Fhir.Model.Encounter.AdmissionComponent? Admission [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs b/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs index 296f80b6a..9fc55249c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs @@ -202,7 +202,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -263,7 +263,7 @@ public Hl7.Fhir.Model.CodeableConcept? Class [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -278,7 +278,7 @@ public List Type [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -403,7 +403,7 @@ public Hl7.Fhir.Model.Duration? Length [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs index aceb68fa7..ae80ff501 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs @@ -128,7 +128,7 @@ public partial class PayloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -143,7 +143,7 @@ public List Type [DataMember] public List MimeTypeElement { - get => _MimeTypeElement ?? new List(); + get => _MimeTypeElement ??= []; set { _MimeTypeElement = value; OnPropertyChanged("MimeTypeElement"); } } @@ -245,7 +245,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -291,7 +291,7 @@ public Hl7.Fhir.Model.Endpoint.EndpointStatus? Status [DataMember] public List ConnectionType { - get => _ConnectionType ?? new List(); + get => _ConnectionType ??= []; set { _ConnectionType = value; OnPropertyChanged("ConnectionType"); } } @@ -362,7 +362,7 @@ public string? Description [DataMember] public List EnvironmentType { - get => _EnvironmentType ?? new List(); + get => _EnvironmentType ??= []; set { _EnvironmentType = value; OnPropertyChanged("EnvironmentType"); } } @@ -391,7 +391,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -418,7 +418,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -461,7 +461,7 @@ public string? Address [DataMember] public List HeaderElement { - get => _HeaderElement ?? new List(); + get => _HeaderElement ??= []; set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs index aa70beb22..ef97fb528 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs @@ -70,7 +70,7 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs index 9ff013da2..b9b9ef4aa 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs @@ -104,7 +104,7 @@ public enum EnrollmentOutcome [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs index f65216dfe..7bc471297 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs @@ -287,7 +287,7 @@ public Hl7.Fhir.Model.CodeableConcept? Use [DataMember] public List Value { - get => _Value ?? new List(); + get => _Value ??= []; set { _Value = value; OnPropertyChanged("Value"); } } @@ -389,7 +389,7 @@ public partial class DiagnosisComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -487,7 +487,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -532,7 +532,7 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get => _StatusHistory ?? new List(); + get => _StatusHistory ??= []; set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } @@ -547,7 +547,7 @@ public List StatusHistory [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -561,7 +561,7 @@ public List Type [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -575,7 +575,7 @@ public List Reason [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -635,7 +635,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List ReferralRequest { - get => _ReferralRequest ?? new List(); + get => _ReferralRequest ??= []; set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } @@ -666,7 +666,7 @@ public Hl7.Fhir.Model.ResourceReference? CareManager [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -682,7 +682,7 @@ public List CareTeam [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs index 3647899ec..a38c5d521 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -371,7 +371,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -413,7 +413,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -428,7 +428,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -624,7 +624,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -638,7 +638,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -652,7 +652,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -666,7 +666,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -680,7 +680,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -694,7 +694,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -708,7 +708,7 @@ public List RelatedArtifact [DataMember] public List Trigger { - get => _Trigger ?? new List(); + get => _Trigger ??= []; set { _Trigger = value; OnPropertyChanged("Trigger"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs index 4136f84dc..0a2f88a14 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs @@ -111,7 +111,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -331,7 +331,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -454,7 +454,7 @@ public Hl7.Fhir.Model.Evidence.SampleSizeComponent? SampleSize [DataMember] public List AttributeEstimate { - get => _AttributeEstimate ?? new List(); + get => _AttributeEstimate ??= []; set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } @@ -468,7 +468,7 @@ public List AttributeEstimat [DataMember] public List ModelCharacteristic { - get => _ModelCharacteristic ?? new List(); + get => _ModelCharacteristic ??= []; set { _ModelCharacteristic = value; OnPropertyChanged("ModelCharacteristic"); } } @@ -665,7 +665,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -904,7 +904,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -986,7 +986,7 @@ public Hl7.Fhir.Model.Range? Range [DataMember] public List AttributeEstimate { - get => _AttributeEstimate ?? new List(); + get => _AttributeEstimate ??= []; set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } @@ -1159,7 +1159,7 @@ public Hl7.Fhir.Model.Quantity? Value [DataMember] public List Variable { - get => _Variable ?? new List(); + get => _Variable ??= []; set { _Variable = value; OnPropertyChanged("Variable"); } } @@ -1173,7 +1173,7 @@ public List Variable [DataMember] public List AttributeEstimate { - get => _AttributeEstimate ?? new List(); + get => _AttributeEstimate ??= []; set { _AttributeEstimate = value; OnPropertyChanged("AttributeEstimate"); } } @@ -1334,7 +1334,7 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List ValueCategory { - get => _ValueCategory ?? new List(); + get => _ValueCategory ??= []; set { _ValueCategory = value; OnPropertyChanged("ValueCategory"); } } @@ -1348,7 +1348,7 @@ public List ValueCategory [DataMember] public List ValueQuantity { - get => _ValueQuantity ?? new List(); + get => _ValueQuantity ??= []; set { _ValueQuantity = value; OnPropertyChanged("ValueQuantity"); } } @@ -1362,7 +1362,7 @@ public List ValueQuantity [DataMember] public List ValueRange { - get => _ValueRange ?? new List(); + get => _ValueRange ??= []; set { _ValueRange = value; OnPropertyChanged("ValueRange"); } } @@ -1517,7 +1517,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1587,7 +1587,7 @@ public string? Rater [DataMember] public List Subcomponent { - get => _Subcomponent ?? new List(); + get => _Subcomponent ??= []; set { _Subcomponent = value; OnPropertyChanged("Subcomponent"); } } @@ -1735,7 +1735,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2035,7 +2035,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2049,7 +2049,7 @@ public List Contact [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -2063,7 +2063,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -2077,7 +2077,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -2091,7 +2091,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -2105,7 +2105,7 @@ public List Endorser [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2203,7 +2203,7 @@ public string? CopyrightLabel [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2273,7 +2273,7 @@ public string? Assertion [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -2287,7 +2287,7 @@ public List Note [DataMember] public List VariableDefinition { - get => _VariableDefinition ?? new List(); + get => _VariableDefinition ??= []; set { _VariableDefinition = value; OnPropertyChanged("VariableDefinition"); } } @@ -2316,7 +2316,7 @@ public Hl7.Fhir.Model.CodeableConcept? SynthesisType [DataMember] public List StudyDesign { - get => _StudyDesign ?? new List(); + get => _StudyDesign ??= []; set { _StudyDesign = value; OnPropertyChanged("StudyDesign"); } } @@ -2330,7 +2330,7 @@ public List StudyDesign [DataMember] public List Statistic { - get => _Statistic ?? new List(); + get => _Statistic ??= []; set { _Statistic = value; OnPropertyChanged("Statistic"); } } @@ -2344,7 +2344,7 @@ public List Statistic [DataMember] public List Certainty { - get => _Certainty ?? new List(); + get => _Certainty ??= []; set { _Certainty = value; OnPropertyChanged("Certainty"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs b/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs index 5a041a646..ffdb4288f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs @@ -145,7 +145,7 @@ public partial class SubjectComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -159,7 +159,7 @@ public List Characteristi [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -812,7 +812,7 @@ public Hl7.Fhir.Model.ResourceReference? FocusReference [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -884,7 +884,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List EntryClassifier { - get => _EntryClassifier ?? new List(); + get => _EntryClassifier ??= []; set { _EntryClassifier = value; OnPropertyChanged("EntryClassifier"); } } @@ -900,7 +900,7 @@ public List EntryClassifier [DataMember] public List EntryReference { - get => _EntryReference ?? new List(); + get => _EntryReference ??= []; set { _EntryReference = value; OnPropertyChanged("EntryReference"); } } @@ -914,7 +914,7 @@ public List EntryReference [DataMember] public List EntryQuantity { - get => _EntryQuantity ?? new List(); + get => _EntryQuantity ??= []; set { _EntryQuantity = value; OnPropertyChanged("EntryQuantity"); } } @@ -942,7 +942,7 @@ public Hl7.Fhir.Model.CodeableConcept? EmptyReason [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } @@ -1175,7 +1175,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1189,7 +1189,7 @@ public List UseContext [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1203,7 +1203,7 @@ public List Identifier [DataMember] public List RelatedIdentifier { - get => _RelatedIdentifier ?? new List(); + get => _RelatedIdentifier ??= []; set { _RelatedIdentifier = value; OnPropertyChanged("RelatedIdentifier"); } } @@ -1247,7 +1247,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1261,7 +1261,7 @@ public List Note [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1317,7 +1317,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1331,7 +1331,7 @@ public List Contact [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1345,7 +1345,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1359,7 +1359,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1373,7 +1373,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1387,7 +1387,7 @@ public List Endorser [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -1401,7 +1401,7 @@ public List RelatesTo [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs index 7c6b81ad7..744912489 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs @@ -196,7 +196,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -391,7 +391,7 @@ public Hl7.Fhir.Model.DataType? Duration [DataMember] public List TimeFromEvent { - get => _TimeFromEvent ?? new List(); + get => _TimeFromEvent ??= []; set { _TimeFromEvent = value; OnPropertyChanged("TimeFromEvent"); } } @@ -615,7 +615,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Method { - get => _Method ?? new List(); + get => _Method ??= []; set { _Method = value; OnPropertyChanged("Method"); } } @@ -846,7 +846,7 @@ public int? Threshold [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -980,7 +980,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1287,7 +1287,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1543,7 +1543,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1585,7 +1585,7 @@ public string? Description [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1599,7 +1599,7 @@ public List Note [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1766,7 +1766,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1780,7 +1780,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1794,7 +1794,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1808,7 +1808,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1822,7 +1822,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1864,7 +1864,7 @@ public bool? Actual [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -1908,7 +1908,7 @@ public Hl7.Fhir.Model.EvidenceVariableHandling? Handling [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs index c5fe2029f..0754949dd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs @@ -461,7 +461,7 @@ public Hl7.Fhir.Model.ResourceReference? Content [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -475,7 +475,7 @@ public List Version [DataMember] public List ContainedInstance { - get => _ContainedInstance ?? new List(); + get => _ContainedInstance ??= []; set { _ContainedInstance = value; OnPropertyChanged("ContainedInstance"); } } @@ -1099,7 +1099,7 @@ public string? PostConditions [DataMember] public List Step { - get => _Step ?? new List(); + get => _Step ??= []; set { _Step = value; OnPropertyChanged("Step"); } } @@ -1308,7 +1308,7 @@ public Hl7.Fhir.Model.ExampleScenario.OperationComponent? Operation [DataMember] public List Alternative { - get => _Alternative ?? new List(); + get => _Alternative ??= []; set { _Alternative = value; OnPropertyChanged("Alternative"); } } @@ -1886,7 +1886,7 @@ public string? Description [DataMember] public List Step { - get => _Step ?? new List(); + get => _Step ??= []; set { _Step = value; OnPropertyChanged("Step"); } } @@ -2007,7 +2007,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2235,7 +2235,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2277,7 +2277,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2292,7 +2292,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2390,7 +2390,7 @@ public string? CopyrightLabel [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -2404,7 +2404,7 @@ public List Actor [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -2418,7 +2418,7 @@ public List Instance [DataMember] public List Process { - get => _Process ?? new List(); + get => _Process ??= []; set { _Process = value; OnPropertyChanged("Process"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs index 87be7d771..af37cb9b4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs @@ -979,7 +979,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1141,7 +1141,7 @@ public int? Sequence [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1203,7 +1203,7 @@ public Hl7.Fhir.Model.DataType? Procedure [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1376,7 +1376,7 @@ public Hl7.Fhir.Model.ResourceReference? Coverage [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1685,7 +1685,7 @@ public int? Sequence [DataMember] public List CareTeamSequenceElement { - get => _CareTeamSequenceElement ?? new List(); + get => _CareTeamSequenceElement ??= []; set { _CareTeamSequenceElement = value; OnPropertyChanged("CareTeamSequenceElement"); } } @@ -1717,7 +1717,7 @@ public IEnumerable? CareTeamSequence [DataMember] public List DiagnosisSequenceElement { - get => _DiagnosisSequenceElement ?? new List(); + get => _DiagnosisSequenceElement ??= []; set { _DiagnosisSequenceElement = value; OnPropertyChanged("DiagnosisSequenceElement"); } } @@ -1749,7 +1749,7 @@ public IEnumerable? DiagnosisSequence [DataMember] public List ProcedureSequenceElement { - get => _ProcedureSequenceElement ?? new List(); + get => _ProcedureSequenceElement ??= []; set { _ProcedureSequenceElement = value; OnPropertyChanged("ProcedureSequenceElement"); } } @@ -1781,7 +1781,7 @@ public IEnumerable? ProcedureSequence [DataMember] public List InformationSequenceElement { - get => _InformationSequenceElement ?? new List(); + get => _InformationSequenceElement ??= []; set { _InformationSequenceElement = value; OnPropertyChanged("InformationSequenceElement"); } } @@ -1813,7 +1813,7 @@ public IEnumerable? InformationSequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -1885,7 +1885,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -1900,7 +1900,7 @@ public List Request [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1915,7 +1915,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2056,7 +2056,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2070,7 +2070,7 @@ public List Udi [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -2086,7 +2086,7 @@ public List BodySite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -2100,7 +2100,7 @@ public List Encounter [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -2145,7 +2145,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2159,7 +2159,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2494,7 +2494,7 @@ public partial class ItemBodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -2509,7 +2509,7 @@ public List Site [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -2624,7 +2624,7 @@ public Hl7.Fhir.Model.CodeableConcept? Decision [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -2971,7 +2971,7 @@ public int? Sequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -3042,7 +3042,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3057,7 +3057,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3166,7 +3166,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3180,7 +3180,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3225,7 +3225,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3239,7 +3239,7 @@ public List Adjudicat [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -3521,7 +3521,7 @@ public int? Sequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -3592,7 +3592,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3607,7 +3607,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3716,7 +3716,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3730,7 +3730,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3775,7 +3775,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -4019,7 +4019,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ItemSequenceElement { - get => _ItemSequenceElement ?? new List(); + get => _ItemSequenceElement ??= []; set { _ItemSequenceElement = value; OnPropertyChanged("ItemSequenceElement"); } } @@ -4051,7 +4051,7 @@ public IEnumerable? ItemSequence [DataMember] public List DetailSequenceElement { - get => _DetailSequenceElement ?? new List(); + get => _DetailSequenceElement ??= []; set { _DetailSequenceElement = value; OnPropertyChanged("DetailSequenceElement"); } } @@ -4083,7 +4083,7 @@ public IEnumerable? DetailSequence [DataMember] public List SubDetailSequenceElement { - get => _SubDetailSequenceElement ?? new List(); + get => _SubDetailSequenceElement ??= []; set { _SubDetailSequenceElement = value; OnPropertyChanged("SubDetailSequenceElement"); } } @@ -4115,7 +4115,7 @@ public IEnumerable? SubDetailSequence [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -4131,7 +4131,7 @@ public List TraceNumber [DataMember] public List Provider { - get => _Provider ?? new List(); + get => _Provider ??= []; set { _Provider = value; OnPropertyChanged("Provider"); } } @@ -4189,7 +4189,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -4204,7 +4204,7 @@ public List Request [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -4219,7 +4219,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -4358,7 +4358,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -4372,7 +4372,7 @@ public List Body [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -4417,7 +4417,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -4431,7 +4431,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -4730,7 +4730,7 @@ public partial class AddedItemBodySiteComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -4745,7 +4745,7 @@ public List Site [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -4845,7 +4845,7 @@ public partial class AddedItemDetailComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -4902,7 +4902,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -5009,7 +5009,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -5054,7 +5054,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -5068,7 +5068,7 @@ public List Adjudicat [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -5285,7 +5285,7 @@ public partial class AddedItemDetailSubDetailComponent : Hl7.Fhir.Model.Backbone [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -5342,7 +5342,7 @@ public Hl7.Fhir.Model.CodeableConcept? ProductOrServiceEnd [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -5449,7 +5449,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -5494,7 +5494,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.ReviewOutcomeComponent? ReviewOutcome [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -6361,7 +6361,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Financial { - get => _Financial ?? new List(); + get => _Financial ??= []; set { _Financial = value; OnPropertyChanged("Financial"); } } @@ -6639,7 +6639,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -6653,7 +6653,7 @@ public List Identifier [DataMember] public List TraceNumber { - get => _TraceNumber ?? new List(); + get => _TraceNumber ??= []; set { _TraceNumber = value; OnPropertyChanged("TraceNumber"); } } @@ -6903,7 +6903,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundsReserve [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -6947,7 +6947,7 @@ public Hl7.Fhir.Model.ResourceReference? OriginalPrescription [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -6991,7 +6991,7 @@ public Hl7.Fhir.Model.ResourceReference? Referral [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -7123,7 +7123,7 @@ public string? Disposition [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -7155,7 +7155,7 @@ public IEnumerable? PreAuthRef [DataMember] public List PreAuthRefPeriod { - get => _PreAuthRefPeriod ?? new List(); + get => _PreAuthRefPeriod ??= []; set { _PreAuthRefPeriod = value; OnPropertyChanged("PreAuthRefPeriod"); } } @@ -7183,7 +7183,7 @@ public Hl7.Fhir.Model.CodeableConcept? DiagnosisRelatedGroup [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -7197,7 +7197,7 @@ public List CareTeam [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -7211,7 +7211,7 @@ public List [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -7225,7 +7225,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -7267,7 +7267,7 @@ public int? Precedence [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -7307,7 +7307,7 @@ public Hl7.Fhir.Model.Money? PatientPaid [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -7321,7 +7321,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -7335,7 +7335,7 @@ public List AddItem [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -7349,7 +7349,7 @@ public List Adjudicat [DataMember] public List Total { - get => _Total ?? new List(); + get => _Total ??= []; set { _Total = value; OnPropertyChanged("Total"); } } @@ -7403,7 +7403,7 @@ public Hl7.Fhir.Model.Attachment? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -7430,7 +7430,7 @@ public Hl7.Fhir.Model.Period? BenefitPeriod [DataMember] public List BenefitBalance { - get => _BenefitBalance ?? new List(); + get => _BenefitBalance ??= []; set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs b/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs index a8a4634f7..cbac9f9f2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs @@ -85,7 +85,7 @@ public Hl7.Fhir.Model.CodeableConcept? Purpose [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -99,7 +99,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs index e59f3a6bd..b3ae5f522 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs @@ -308,7 +308,7 @@ public Hl7.Fhir.Model.DataType? Onset [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -507,7 +507,7 @@ public Hl7.Fhir.Model.DataType? Performed [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -618,7 +618,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -632,7 +632,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -664,7 +664,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -785,7 +785,7 @@ public string? Date [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -930,7 +930,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -944,7 +944,7 @@ public List Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -958,7 +958,7 @@ public List Note [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -972,7 +972,7 @@ public List Condition [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Flag.cs b/src/Hl7.Fhir.R5/Model/Generated/Flag.cs index 0fb7300ae..a51862636 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Flag.cs @@ -98,7 +98,7 @@ public enum FlagStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.Flag.FlagStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs b/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs index 7fd8a789d..6cdeca778 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs @@ -98,7 +98,7 @@ public enum FormularyItemStatusCodes [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs index 1c25fca0f..aab193f1f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs @@ -126,7 +126,7 @@ public partial class AnalysisComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -141,7 +141,7 @@ public List Identifier [DataMember] public List MethodType { - get => _MethodType ?? new List(); + get => _MethodType ??= []; set { _MethodType = value; OnPropertyChanged("MethodType"); } } @@ -156,7 +156,7 @@ public List MethodType [DataMember] public List ChangeType { - get => _ChangeType ?? new List(); + get => _ChangeType ??= []; set { _ChangeType = value; OnPropertyChanged("ChangeType"); } } @@ -270,7 +270,7 @@ public string? Title [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -286,7 +286,7 @@ public List Focus [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -328,7 +328,7 @@ public string? Date [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -359,7 +359,7 @@ public Hl7.Fhir.Model.ResourceReference? ProtocolPerformed [DataMember] public List RegionsStudied { - get => _RegionsStudied ?? new List(); + get => _RegionsStudied ??= []; set { _RegionsStudied = value; OnPropertyChanged("RegionsStudied"); } } @@ -375,7 +375,7 @@ public List RegionsStudied [DataMember] public List RegionsCalled { - get => _RegionsCalled ?? new List(); + get => _RegionsCalled ??= []; set { _RegionsCalled = value; OnPropertyChanged("RegionsCalled"); } } @@ -389,7 +389,7 @@ public List RegionsCalled [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -403,7 +403,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } @@ -417,7 +417,7 @@ public List Output [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -431,7 +431,7 @@ public List Performer [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -1130,7 +1130,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1176,7 +1176,7 @@ public Hl7.Fhir.Model.GenomicStudy.GenomicStudyStatus? Status [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1251,7 +1251,7 @@ public string? StartDate [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1282,7 +1282,7 @@ public Hl7.Fhir.Model.ResourceReference? Referrer [DataMember] public List Interpreter { - get => _Interpreter ?? new List(); + get => _Interpreter ??= []; set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } @@ -1296,7 +1296,7 @@ public List Interpreter [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1366,7 +1366,7 @@ public string? InstantiatesUri [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1408,7 +1408,7 @@ public string? Description [DataMember] public List Analysis { - get => _Analysis ?? new List(); + get => _Analysis ??= []; set { _Analysis = value; OnPropertyChanged("Analysis"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Goal.cs b/src/Hl7.Fhir.R5/Model/Generated/Goal.cs index 166e350df..ac15556c3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Goal.cs @@ -276,7 +276,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.CodeableConcept? AchievementStatus [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -439,7 +439,7 @@ public Hl7.Fhir.Model.DataType? Start [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -526,7 +526,7 @@ public Hl7.Fhir.Model.ResourceReference? Source [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -540,7 +540,7 @@ public List Addresses [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -555,7 +555,7 @@ public List Note [DataMember] public List Outcome { - get => _Outcome ?? new List(); + get => _Outcome ??= []; set { _Outcome = value; OnPropertyChanged("Outcome"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs index ae9a33611..12b20d372 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs @@ -582,7 +582,7 @@ public string? Params [DataMember] public List Compartment { - get => _Compartment ?? new List(); + get => _Compartment ??= []; set { _Compartment = value; OnPropertyChanged("Compartment"); } } @@ -1016,7 +1016,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1246,7 +1246,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1288,7 +1288,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1303,7 +1303,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1429,7 +1429,7 @@ public string? Start [DataMember] public List Node { - get => _Node ?? new List(); + get => _Node ??= []; set { _Node = value; OnPropertyChanged("Node"); } } @@ -1443,7 +1443,7 @@ public List Node [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Group.cs b/src/Hl7.Fhir.R5/Model/Generated/Group.cs index a79b3e353..e6358ccb4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Group.cs @@ -494,7 +494,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -710,7 +710,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingEntity [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -724,7 +724,7 @@ public List Characteristic [DataMember] public List Member { - get => _Member ?? new List(); + get => _Member ??= []; set { _Member = value; OnPropertyChanged("Member"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs index 65b8122c1..d5a90b728 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs @@ -129,7 +129,7 @@ public Hl7.Fhir.Model.Identifier? RequestIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -264,7 +264,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -278,7 +278,7 @@ public List Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -324,7 +324,7 @@ public Hl7.Fhir.Model.ResourceReference? OutputParameters [DataMember] public List Result { - get => _Result ?? new List(); + get => _Result ??= []; set { _Result = value; OnPropertyChanged("Result"); } } @@ -338,7 +338,7 @@ public List Result [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs index 1e2be3de1..c04b24680 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs @@ -195,7 +195,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -254,7 +254,7 @@ public Hl7.Fhir.Model.ResourceReference? ProvidedBy [DataMember] public List OfferedIn { - get => _OfferedIn ?? new List(); + get => _OfferedIn ??= []; set { _OfferedIn = value; OnPropertyChanged("OfferedIn"); } } @@ -269,7 +269,7 @@ public List OfferedIn [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -284,7 +284,7 @@ public List Category [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -299,7 +299,7 @@ public List Type [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -315,7 +315,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -426,7 +426,7 @@ public Hl7.Fhir.Model.Attachment? Photo [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -442,7 +442,7 @@ public List Contact [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -457,7 +457,7 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get => _ServiceProvisionCode ?? new List(); + get => _ServiceProvisionCode ??= []; set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } @@ -471,7 +471,7 @@ public List ServiceProvisionCode [DataMember] public List Eligibility { - get => _Eligibility ?? new List(); + get => _Eligibility ??= []; set { _Eligibility = value; OnPropertyChanged("Eligibility"); } } @@ -486,7 +486,7 @@ public List Eligibility [DataMember] public List Program { - get => _Program ?? new List(); + get => _Program ??= []; set { _Program = value; OnPropertyChanged("Program"); } } @@ -501,7 +501,7 @@ public List Program [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -516,7 +516,7 @@ public List Characteristic [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -531,7 +531,7 @@ public List Communication [DataMember] public List ReferralMethod { - get => _ReferralMethod ?? new List(); + get => _ReferralMethod ??= []; set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } @@ -573,7 +573,7 @@ public bool? AppointmentRequired [DataMember] public List Availability { - get => _Availability ?? new List(); + get => _Availability ??= []; set { _Availability = value; OnPropertyChanged("Availability"); } } @@ -589,7 +589,7 @@ public List Availability [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs index 1857cac4a..8f071fafd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs @@ -209,7 +209,7 @@ public string? Family [DataMember] public List GivenElement { - get => _GivenElement ?? new List(); + get => _GivenElement ??= []; set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } @@ -241,7 +241,7 @@ public IEnumerable? Given [DataMember] public List PrefixElement { - get => _PrefixElement ?? new List(); + get => _PrefixElement ??= []; set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } @@ -273,7 +273,7 @@ public IEnumerable? Prefix [DataMember] public List SuffixElement { - get => _SuffixElement ?? new List(); + get => _SuffixElement ??= []; set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs index 5a4075d7e..6d9037377 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs @@ -386,7 +386,7 @@ public Hl7.Fhir.Model.Coding? SopClass [DataMember] public List SubsetElement { - get => _SubsetElement ?? new List(); + get => _SubsetElement ??= []; set { _SubsetElement = value; OnPropertyChanged("SubsetElement"); } } @@ -418,7 +418,7 @@ public IEnumerable? Subset [DataMember] public List ImageRegion2D { - get => _ImageRegion2D ?? new List(); + get => _ImageRegion2D ??= []; set { _ImageRegion2D = value; OnPropertyChanged("ImageRegion2D"); } } @@ -432,7 +432,7 @@ public List ImageRegion2 [DataMember] public List ImageRegion3D { - get => _ImageRegion3D ?? new List(); + get => _ImageRegion3D ??= []; set { _ImageRegion3D = value; OnPropertyChanged("ImageRegion3D"); } } @@ -600,7 +600,7 @@ public Hl7.Fhir.Model.ImagingSelection.ImagingSelection2DGraphicType? RegionType [DataMember] public List CoordinateElement { - get => _CoordinateElement ?? new List(); + get => _CoordinateElement ??= []; set { _CoordinateElement = value; OnPropertyChanged("CoordinateElement"); } } @@ -749,7 +749,7 @@ public Hl7.Fhir.Model.ImagingSelection.ImagingSelection3DGraphicType? RegionType [DataMember] public List CoordinateElement { - get => _CoordinateElement ?? new List(); + get => _CoordinateElement ??= []; set { _CoordinateElement = value; OnPropertyChanged("CoordinateElement"); } } @@ -851,7 +851,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -939,7 +939,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -955,7 +955,7 @@ public List Performer [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -970,7 +970,7 @@ public List BasedOn [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1029,7 +1029,7 @@ public string? StudyUid [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -1045,7 +1045,7 @@ public List DerivedFrom [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1159,7 +1159,7 @@ public Hl7.Fhir.Model.CodeableReference? BodySite [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -1173,7 +1173,7 @@ public List Focus [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs index feb30ce60..ae4264242 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs @@ -256,7 +256,7 @@ public int? NumberOfInstances [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -300,7 +300,7 @@ public Hl7.Fhir.Model.CodeableConcept? Laterality [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -342,7 +342,7 @@ public string? Started [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -356,7 +356,7 @@ public List Performer [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -851,7 +851,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -897,7 +897,7 @@ public Hl7.Fhir.Model.ImagingStudy.ImagingStudyStatus? Status [DataMember] public List Modality { - get => _Modality ?? new List(); + get => _Modality ??= []; set { _Modality = value; OnPropertyChanged("Modality"); } } @@ -972,7 +972,7 @@ public string? Started [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -988,7 +988,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1019,7 +1019,7 @@ public Hl7.Fhir.Model.ResourceReference? Referrer [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1090,7 +1090,7 @@ public int? NumberOfInstances [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -1120,7 +1120,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1134,7 +1134,7 @@ public List Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1176,7 +1176,7 @@ public string? Description [DataMember] public List Series { - get => _Series ?? new List(); + get => _Series ??= []; set { _Series = value; OnPropertyChanged("Series"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs index 7a88166ab..48005ba37 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs @@ -555,7 +555,7 @@ public Hl7.Fhir.Model.ResourceReference? Authority [DataMember] public List TargetDisease { - get => _TargetDisease ?? new List(); + get => _TargetDisease ??= []; set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } @@ -723,7 +723,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -739,7 +739,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -928,7 +928,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -1056,7 +1056,7 @@ public Hl7.Fhir.Model.Quantity? DoseQuantity [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -1070,7 +1070,7 @@ public List Performer [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1085,7 +1085,7 @@ public List Note [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1128,7 +1128,7 @@ public bool? IsSubpotent [DataMember] public List SubpotentReason { - get => _SubpotentReason ?? new List(); + get => _SubpotentReason ??= []; set { _SubpotentReason = value; OnPropertyChanged("SubpotentReason"); } } @@ -1142,7 +1142,7 @@ public List SubpotentReason [DataMember] public List ProgramEligibility { - get => _ProgramEligibility ?? new List(); + get => _ProgramEligibility ??= []; set { _ProgramEligibility = value; OnPropertyChanged("ProgramEligibility"); } } @@ -1170,7 +1170,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundingSource [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } @@ -1184,7 +1184,7 @@ public List Reaction [DataMember] public List ProtocolApplied { - get => _ProtocolApplied ?? new List(); + get => _ProtocolApplied ??= []; set { _ProtocolApplied = value; OnPropertyChanged("ProtocolApplied"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs index c83a34451..60efe8217 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs @@ -92,7 +92,7 @@ public enum ImmunizationEvaluationStatusCodes [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -243,7 +243,7 @@ public Hl7.Fhir.Model.CodeableConcept? DoseStatus [DataMember] public List DoseStatusReason { - get => _DoseStatusReason ?? new List(); + get => _DoseStatusReason ??= []; set { _DoseStatusReason = value; OnPropertyChanged("DoseStatusReason"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs index 2ee076e4b..b3bfe3dea 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs @@ -87,7 +87,7 @@ public partial class RecommendationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List VaccineCode { - get => _VaccineCode ?? new List(); + get => _VaccineCode ??= []; set { _VaccineCode = value; OnPropertyChanged("VaccineCode"); } } @@ -102,7 +102,7 @@ public List VaccineCode [DataMember] public List TargetDisease { - get => _TargetDisease ?? new List(); + get => _TargetDisease ??= []; set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } @@ -117,7 +117,7 @@ public List TargetDisease [DataMember] public List ContraindicatedVaccineCode { - get => _ContraindicatedVaccineCode ?? new List(); + get => _ContraindicatedVaccineCode ??= []; set { _ContraindicatedVaccineCode = value; OnPropertyChanged("ContraindicatedVaccineCode"); } } @@ -147,7 +147,7 @@ public Hl7.Fhir.Model.CodeableConcept? ForecastStatus [DataMember] public List ForecastReason { - get => _ForecastReason ?? new List(); + get => _ForecastReason ??= []; set { _ForecastReason = value; OnPropertyChanged("ForecastReason"); } } @@ -161,7 +161,7 @@ public List ForecastReason [DataMember] public List DateCriterion { - get => _DateCriterion ?? new List(); + get => _DateCriterion ??= []; set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } @@ -289,7 +289,7 @@ public string? SeriesDoses [DataMember] public List SupportingImmunization { - get => _SupportingImmunization ?? new List(); + get => _SupportingImmunization ??= []; set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } @@ -305,7 +305,7 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get => _SupportingPatientInformation ?? new List(); + get => _SupportingPatientInformation ??= []; set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } @@ -609,7 +609,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -683,7 +683,7 @@ public Hl7.Fhir.Model.ResourceReference? Authority [DataMember] public List Recommendation { - get => _Recommendation ?? new List(); + get => _Recommendation ??= []; set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs index c8dde7930..98d443b90 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs @@ -2571,7 +2571,7 @@ public partial class DefinitionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Grouping { - get => _Grouping ?? new List(); + get => _Grouping ??= []; set { _Grouping = value; OnPropertyChanged("Grouping"); } } @@ -2585,7 +2585,7 @@ public List Grouping [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -2612,7 +2612,7 @@ public Hl7.Fhir.Model.ImplementationGuide.PageComponent? Page [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2626,7 +2626,7 @@ public List Parameter [DataMember] public List Template { - get => _Template ?? new List(); + get => _Template ??= []; set { _Template = value; OnPropertyChanged("Template"); } } @@ -2915,7 +2915,7 @@ public Hl7.Fhir.Model.ResourceReference? Reference [DataMember] public List> FhirVersionElement { - get => _FhirVersionElement ?? new List>(); + get => _FhirVersionElement ??= []; set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } @@ -3031,7 +3031,7 @@ public bool? IsExample [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -3327,7 +3327,7 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageGeneration? Generation [DataMember] public List Page { - get => _Page ?? new List(); + get => _Page ??= []; set { _Page = value; OnPropertyChanged("Page"); } } @@ -3790,7 +3790,7 @@ public string? Rendering [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -3804,7 +3804,7 @@ public List Resour [DataMember] public List Page { - get => _Page ?? new List(); + get => _Page ??= []; set { _Page = value; OnPropertyChanged("Page"); } } @@ -3818,7 +3818,7 @@ public List Page [DataMember] public List ImageElement { - get => _ImageElement ?? new List(); + get => _ImageElement ??= []; set { _ImageElement = value; OnPropertyChanged("ImageElement"); } } @@ -3850,7 +3850,7 @@ public IEnumerable? Image [DataMember] public List OtherElement { - get => _OtherElement ?? new List(); + get => _OtherElement ??= []; set { _OtherElement = value; OnPropertyChanged("OtherElement"); } } @@ -4039,7 +4039,7 @@ public bool? IsExample [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -4260,7 +4260,7 @@ public string? Title [DataMember] public List AnchorElement { - get => _AnchorElement ?? new List(); + get => _AnchorElement ??= []; set { _AnchorElement = value; OnPropertyChanged("AnchorElement"); } } @@ -4400,7 +4400,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4629,7 +4629,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -4671,7 +4671,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -4686,7 +4686,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -4845,7 +4845,7 @@ public Hl7.Fhir.Model.ImplementationGuide.SPDXLicense? License [DataMember] public List> FhirVersionElement { - get => _FhirVersionElement ?? new List>(); + get => _FhirVersionElement ??= []; set { _FhirVersionElement = value; OnPropertyChanged("FhirVersionElement"); } } @@ -4877,7 +4877,7 @@ public IEnumerable? FhirVersion [DataMember] public List DependsOn { - get => _DependsOn ?? new List(); + get => _DependsOn ??= []; set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } @@ -4891,7 +4891,7 @@ public List DependsOn [DataMember] public List Global { - get => _Global ?? new List(); + get => _Global ??= []; set { _Global = value; OnPropertyChanged("Global"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs b/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs index 42694ff11..902557339 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs @@ -255,7 +255,7 @@ public Hl7.Fhir.Model.CodeableReference? Code [DataMember] public List Strength { - get => _Strength ?? new List(); + get => _Strength ??= []; set { _Strength = value; OnPropertyChanged("Strength"); } } @@ -483,7 +483,7 @@ public string? MeasurementPoint [DataMember] public List Country { - get => _Country ?? new List(); + get => _Country ??= []; set { _Country = value; OnPropertyChanged("Country"); } } @@ -497,7 +497,7 @@ public List Country [DataMember] public List ReferenceStrength { - get => _ReferenceStrength ?? new List(); + get => _ReferenceStrength ??= []; set { _ReferenceStrength = value; OnPropertyChanged("ReferenceStrength"); } } @@ -711,7 +711,7 @@ public string? MeasurementPoint [DataMember] public List Country { - get => _Country ?? new List(); + get => _Country ??= []; set { _Country = value; OnPropertyChanged("Country"); } } @@ -859,7 +859,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List For { - get => _For ?? new List(); + get => _For ??= []; set { _For = value; OnPropertyChanged("For"); } } @@ -889,7 +889,7 @@ public Hl7.Fhir.Model.CodeableConcept? Role [DataMember] public List Function { - get => _Function ?? new List(); + get => _Function ??= []; set { _Function = value; OnPropertyChanged("Function"); } } @@ -972,7 +972,7 @@ public string? Comment [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs index 662002761..662e7c46c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs @@ -127,7 +127,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -141,7 +141,7 @@ public List Network [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -292,7 +292,7 @@ public string? Requirement [DataMember] public List Limit { - get => _Limit ?? new List(); + get => _Limit ??= []; set { _Limit = value; OnPropertyChanged("Limit"); } } @@ -513,7 +513,7 @@ public partial class PlanComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -542,7 +542,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -558,7 +558,7 @@ public List CoverageArea [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -572,7 +572,7 @@ public List Network [DataMember] public List GeneralCost { - get => _GeneralCost ?? new List(); + get => _GeneralCost ??= []; set { _GeneralCost = value; OnPropertyChanged("GeneralCost"); } } @@ -586,7 +586,7 @@ public List GeneralCost [DataMember] public List SpecificCost { - get => _SpecificCost ?? new List(); + get => _SpecificCost ??= []; set { _SpecificCost = value; OnPropertyChanged("SpecificCost"); } } @@ -922,7 +922,7 @@ public Hl7.Fhir.Model.CodeableConcept? Category [DataMember] public List Benefit { - get => _Benefit ?? new List(); + get => _Benefit ??= []; set { _Benefit = value; OnPropertyChanged("Benefit"); } } @@ -1036,7 +1036,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Cost { - get => _Cost ?? new List(); + get => _Cost ??= []; set { _Cost = value; OnPropertyChanged("Cost"); } } @@ -1164,7 +1164,7 @@ public Hl7.Fhir.Model.CodeableConcept? Applicability [DataMember] public List Qualifiers { - get => _Qualifiers ?? new List(); + get => _Qualifiers ??= []; set { _Qualifiers = value; OnPropertyChanged("Qualifiers"); } } @@ -1279,7 +1279,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1324,7 +1324,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1366,7 +1366,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -1443,7 +1443,7 @@ public Hl7.Fhir.Model.ResourceReference? AdministeredBy [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -1457,7 +1457,7 @@ public List CoverageArea [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1473,7 +1473,7 @@ public List Contact [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1489,7 +1489,7 @@ public List Endpoint [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -1503,7 +1503,7 @@ public List Network [DataMember] public List Coverage { - get => _Coverage ?? new List(); + get => _Coverage ??= []; set { _Coverage = value; OnPropertyChanged("Coverage"); } } @@ -1517,7 +1517,7 @@ public List Coverage [DataMember] public List Plan { - get => _Plan ?? new List(); + get => _Plan ??= []; set { _Plan = value; OnPropertyChanged("Plan"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs b/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs index 63b22bf30..14a859b10 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs @@ -793,7 +793,7 @@ public partial class InstanceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -990,7 +990,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1035,7 +1035,7 @@ public Hl7.Fhir.Model.InventoryItem.InventoryItemStatusCodes? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1049,7 +1049,7 @@ public List Category [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -1063,7 +1063,7 @@ public List Code [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -1077,7 +1077,7 @@ public List Name [DataMember] public List ResponsibleOrganization { - get => _ResponsibleOrganization ?? new List(); + get => _ResponsibleOrganization ??= []; set { _ResponsibleOrganization = value; OnPropertyChanged("ResponsibleOrganization"); } } @@ -1104,7 +1104,7 @@ public Hl7.Fhir.Model.InventoryItem.DescriptionComponent? Description [DataMember] public List InventoryStatus { - get => _InventoryStatus ?? new List(); + get => _InventoryStatus ??= []; set { _InventoryStatus = value; OnPropertyChanged("InventoryStatus"); } } @@ -1144,7 +1144,7 @@ public Hl7.Fhir.Model.Quantity? NetContent [DataMember] public List Association { - get => _Association ?? new List(); + get => _Association ??= []; set { _Association = value; OnPropertyChanged("Association"); } } @@ -1158,7 +1158,7 @@ public List Association [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs b/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs index f8e88d7e2..0ea5e9923 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs @@ -192,7 +192,7 @@ public string? CountingDateTime [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -427,7 +427,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -586,7 +586,7 @@ public Hl7.Fhir.Model.Period? ReportingPeriod [DataMember] public List InventoryListing { - get => _InventoryListing ?? new List(); + get => _InventoryListing ??= []; set { _InventoryListing = value; OnPropertyChanged("InventoryListing"); } } @@ -600,7 +600,7 @@ public List InventoryL [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs index b750d654a..2bb7a5266 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs @@ -301,7 +301,7 @@ public Hl7.Fhir.Model.DataType? ChargeItem [DataMember] public List PriceComponent { - get => _PriceComponent ?? new List(); + get => _PriceComponent ??= []; set { _PriceComponent = value; OnPropertyChanged("PriceComponent"); } } @@ -403,7 +403,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -590,7 +590,7 @@ public Hl7.Fhir.Model.DataType? Period [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -634,7 +634,7 @@ public Hl7.Fhir.Model.ResourceReference? Account [DataMember] public List LineItem { - get => _LineItem ?? new List(); + get => _LineItem ??= []; set { _LineItem = value; OnPropertyChanged("LineItem"); } } @@ -648,7 +648,7 @@ public List LineItem [DataMember] public List TotalPriceComponent { - get => _TotalPriceComponent ?? new List(); + get => _TotalPriceComponent ??= []; set { _TotalPriceComponent = value; OnPropertyChanged("TotalPriceComponent"); } } @@ -716,7 +716,7 @@ public string? PaymentTerms [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Library.cs b/src/Hl7.Fhir.R5/Model/Generated/Library.cs index f7a11994c..5713b7a55 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Library.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -386,7 +386,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -428,7 +428,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -443,7 +443,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -639,7 +639,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -653,7 +653,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -667,7 +667,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -681,7 +681,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -695,7 +695,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -709,7 +709,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -723,7 +723,7 @@ public List RelatedArtifact [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -737,7 +737,7 @@ public List Parameter [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } @@ -751,7 +751,7 @@ public List DataRequirement [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs index c574df6b5..0c2248b28 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs @@ -274,7 +274,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/List.cs b/src/Hl7.Fhir.R5/Model/Generated/List.cs index 71034752b..6ef5f3c8d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/List.cs @@ -289,7 +289,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -409,7 +409,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -495,7 +495,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -509,7 +509,7 @@ public List Note [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Location.cs b/src/Hl7.Fhir.R5/Model/Generated/Location.cs index 8f224dcc4..47c835b69 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Location.cs @@ -302,7 +302,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -388,7 +388,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -479,7 +479,7 @@ public Hl7.Fhir.Model.Location.LocationMode? Mode [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -493,7 +493,7 @@ public List Type [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -578,7 +578,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -592,7 +592,7 @@ public List Characteristic [DataMember] public List HoursOfOperation { - get => _HoursOfOperation ?? new List(); + get => _HoursOfOperation ??= []; set { _HoursOfOperation = value; OnPropertyChanged("HoursOfOperation"); } } @@ -606,7 +606,7 @@ public List HoursOfOperation [DataMember] public List VirtualService { - get => _VirtualService ?? new List(); + get => _VirtualService ??= []; set { _VirtualService = value; OnPropertyChanged("VirtualService"); } } @@ -622,7 +622,7 @@ public List VirtualService [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs index 7d0141bf8..c6af1c82e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs @@ -208,7 +208,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Function { - get => _Function ?? new List(); + get => _Function ??= []; set { _Function = value; OnPropertyChanged("Function"); } } @@ -222,7 +222,7 @@ public List Function [DataMember] public List Amount { - get => _Amount ?? new List(); + get => _Amount ??= []; set { _Amount = value; OnPropertyChanged("Amount"); } } @@ -236,7 +236,7 @@ public List Amount [DataMember] public List Constituent { - get => _Constituent ?? new List(); + get => _Constituent ??= []; set { _Constituent = value; OnPropertyChanged("Constituent"); } } @@ -250,7 +250,7 @@ public List Cons [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -264,7 +264,7 @@ public List Propert [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -397,7 +397,7 @@ public partial class ConstituentComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Amount { - get => _Amount ?? new List(); + get => _Amount ??= []; set { _Amount = value; OnPropertyChanged("Amount"); } } @@ -411,7 +411,7 @@ public List Amount [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -425,7 +425,7 @@ public List Location [DataMember] public List Function { - get => _Function ?? new List(); + get => _Function ??= []; set { _Function = value; OnPropertyChanged("Function"); } } @@ -439,7 +439,7 @@ public List Function [DataMember] public List HasIngredient { - get => _HasIngredient ?? new List(); + get => _HasIngredient ??= []; set { _HasIngredient = value; OnPropertyChanged("HasIngredient"); } } @@ -541,7 +541,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -645,7 +645,7 @@ public Hl7.Fhir.Model.CodeableConcept? UnitOfPresentation [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -659,7 +659,7 @@ public List Manufacturer [DataMember] public List MarketingStatus { - get => _MarketingStatus ?? new List(); + get => _MarketingStatus ??= []; set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } @@ -674,7 +674,7 @@ public List MarketingStatus [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -688,7 +688,7 @@ public List Ingredient [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -702,7 +702,7 @@ public List Propert [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs index 2801257e3..72957cc5b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs @@ -285,7 +285,7 @@ public string? Description [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -416,7 +416,7 @@ public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -448,7 +448,7 @@ public IEnumerable? Library [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -462,7 +462,7 @@ public List Population [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -1030,7 +1030,7 @@ public Hl7.Fhir.Model.ResourceReference? GroupDefinition [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -1422,7 +1422,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Usage { - get => _Usage ?? new List(); + get => _Usage ??= []; set { _Usage = value; OnPropertyChanged("Usage"); } } @@ -1603,7 +1603,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1906,7 +1906,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1948,7 +1948,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1963,7 +1963,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2159,7 +2159,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -2173,7 +2173,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -2187,7 +2187,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -2201,7 +2201,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -2215,7 +2215,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -2229,7 +2229,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2243,7 +2243,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -2346,7 +2346,7 @@ public Hl7.Fhir.Model.CodeableConcept? CompositeScoring [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -2486,7 +2486,7 @@ public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation [DataMember] public List Term { - get => _Term ?? new List(); + get => _Term ??= []; set { _Term = value; OnPropertyChanged("Term"); } } @@ -2528,7 +2528,7 @@ public string? Guidance [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -2542,7 +2542,7 @@ public List Group [DataMember] public List SupplementalData { - get => _SupplementalData ?? new List(); + get => _SupplementalData ??= []; set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs index f5b5da34e..1704b31b2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs @@ -227,7 +227,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -256,7 +256,7 @@ public Hl7.Fhir.Model.DataType? MeasureScore [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -479,7 +479,7 @@ public Hl7.Fhir.Model.ResourceReference? SubjectResults [DataMember] public List SubjectReport { - get => _SubjectReport ?? new List(); + get => _SubjectReport ??= []; set { _SubjectReport = value; OnPropertyChanged("SubjectReport"); } } @@ -672,7 +672,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Stratum { - get => _Stratum ?? new List(); + get => _Stratum ??= []; set { _Stratum = value; OnPropertyChanged("Stratum"); } } @@ -797,7 +797,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } @@ -811,7 +811,7 @@ public List Component [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -1186,7 +1186,7 @@ public Hl7.Fhir.Model.ResourceReference? SubjectResults [DataMember] public List SubjectReport { - get => _SubjectReport ?? new List(); + get => _SubjectReport ??= []; set { _SubjectReport = value; OnPropertyChanged("SubjectReport"); } } @@ -1321,7 +1321,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1600,7 +1600,7 @@ public Hl7.Fhir.Model.CodeableConcept? ImprovementNotation [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -1616,7 +1616,7 @@ public List Group [DataMember] public List SupplementalData { - get => _SupplementalData ?? new List(); + get => _SupplementalData ??= []; set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } @@ -1632,7 +1632,7 @@ public List SupplementalData [DataMember] public List EvaluatedResource { - get => _EvaluatedResource ?? new List(); + get => _EvaluatedResource ??= []; set { _EvaluatedResource = value; OnPropertyChanged("EvaluatedResource"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Medication.cs b/src/Hl7.Fhir.R5/Model/Generated/Medication.cs index 3ea35c0f7..735cfc44d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Medication.cs @@ -395,7 +395,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -495,7 +495,7 @@ public Hl7.Fhir.Model.Quantity? TotalVolume [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs index c54b4ed97..b9fb112fd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs @@ -456,7 +456,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -472,7 +472,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -488,7 +488,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -534,7 +534,7 @@ public Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatusCod [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -549,7 +549,7 @@ public List StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -611,7 +611,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -698,7 +698,7 @@ public bool? IsSubPotent [DataMember] public List SubPotentReason { - get => _SubPotentReason ?? new List(); + get => _SubPotentReason ??= []; set { _SubPotentReason = value; OnPropertyChanged("SubPotentReason"); } } @@ -712,7 +712,7 @@ public List SubPotentReason [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -727,7 +727,7 @@ public List Performe [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -756,7 +756,7 @@ public Hl7.Fhir.Model.ResourceReference? Request [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -770,7 +770,7 @@ public List Device [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -799,7 +799,7 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs index b7d7754dc..2c8620846 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs @@ -310,7 +310,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -427,7 +427,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -443,7 +443,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -459,7 +459,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -547,7 +547,7 @@ public string? StatusChanged [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -609,7 +609,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -623,7 +623,7 @@ public List SupportingInformation [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -654,7 +654,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List AuthorizingPrescription { - get => _AuthorizingPrescription ?? new List(); + get => _AuthorizingPrescription ??= []; set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } @@ -809,7 +809,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } @@ -823,7 +823,7 @@ public List Receiver [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -865,7 +865,7 @@ public string? RenderedDosageInstruction [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -894,7 +894,7 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs index f767f7e1b..cee893e3d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs @@ -130,7 +130,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Reference { - get => _Reference ?? new List(); + get => _Reference ??= []; set { _Reference = value; OnPropertyChanged("Reference"); } } @@ -341,7 +341,7 @@ public partial class CostComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List EffectiveDate { - get => _EffectiveDate ?? new List(); + get => _EffectiveDate ??= []; set { _EffectiveDate = value; OnPropertyChanged("EffectiveDate"); } } @@ -645,7 +645,7 @@ public partial class IndicationGuidelineComponent : Hl7.Fhir.Model.BackboneEleme [DataMember] public List Indication { - get => _Indication ?? new List(); + get => _Indication ??= []; set { _Indication = value; OnPropertyChanged("Indication"); } } @@ -659,7 +659,7 @@ public List Indication [DataMember] public List DosingGuideline { - get => _DosingGuideline ?? new List(); + get => _DosingGuideline ??= []; set { _DosingGuideline = value; OnPropertyChanged("DosingGuideline"); } } @@ -772,7 +772,7 @@ public Hl7.Fhir.Model.CodeableConcept? TreatmentIntent [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -799,7 +799,7 @@ public Hl7.Fhir.Model.CodeableConcept? AdministrationTreatment [DataMember] public List PatientCharacteristic { - get => _PatientCharacteristic ?? new List(); + get => _PatientCharacteristic ??= []; set { _PatientCharacteristic = value; OnPropertyChanged("PatientCharacteristic"); } } @@ -928,7 +928,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -1169,7 +1169,7 @@ public Hl7.Fhir.Model.DataType? Source [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -1278,7 +1278,7 @@ public partial class PackagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Cost { - get => _Cost ?? new List(); + get => _Cost ??= []; set { _Cost = value; OnPropertyChanged("Cost"); } } @@ -1421,7 +1421,7 @@ public string? Reference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1448,7 +1448,7 @@ public Hl7.Fhir.Model.Duration? StabilityDuration [DataMember] public List EnvironmentalSetting { - get => _EnvironmentalSetting ?? new List(); + get => _EnvironmentalSetting ??= []; set { _EnvironmentalSetting = value; OnPropertyChanged("EnvironmentalSetting"); } } @@ -1695,7 +1695,7 @@ public Hl7.Fhir.Model.ResourceReference? RegulatoryAuthority [DataMember] public List Substitution { - get => _Substitution ?? new List(); + get => _Substitution ??= []; set { _Substitution = value; OnPropertyChanged("Substitution"); } } @@ -1709,7 +1709,7 @@ public List Substituti [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -2078,7 +2078,7 @@ public partial class DefinitionalComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -2107,7 +2107,7 @@ public Hl7.Fhir.Model.CodeableConcept? DoseForm [DataMember] public List IntendedRoute { - get => _IntendedRoute ?? new List(); + get => _IntendedRoute ??= []; set { _IntendedRoute = value; OnPropertyChanged("IntendedRoute"); } } @@ -2121,7 +2121,7 @@ public List IntendedRoute [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -2135,7 +2135,7 @@ public List Ingredient [DataMember] public List DrugCharacteristic { - get => _DrugCharacteristic ?? new List(); + get => _DrugCharacteristic ??= []; set { _DrugCharacteristic = value; OnPropertyChanged("DrugCharacteristic"); } } @@ -2500,7 +2500,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2573,7 +2573,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List IntendedJurisdiction { - get => _IntendedJurisdiction ?? new List(); + get => _IntendedJurisdiction ??= []; set { _IntendedJurisdiction = value; OnPropertyChanged("IntendedJurisdiction"); } } @@ -2587,7 +2587,7 @@ public List IntendedJurisdiction [DataMember] public List NameElement { - get => _NameElement ?? new List(); + get => _NameElement ??= []; set { _NameElement = value; OnPropertyChanged("NameElement"); } } @@ -2619,7 +2619,7 @@ public IEnumerable? Name [DataMember] public List RelatedMedicationKnowledge { - get => _RelatedMedicationKnowledge ?? new List(); + get => _RelatedMedicationKnowledge ??= []; set { _RelatedMedicationKnowledge = value; OnPropertyChanged("RelatedMedicationKnowledge"); } } @@ -2635,7 +2635,7 @@ public List AssociatedMedication { - get => _AssociatedMedication ?? new List(); + get => _AssociatedMedication ??= []; set { _AssociatedMedication = value; OnPropertyChanged("AssociatedMedication"); } } @@ -2649,7 +2649,7 @@ public List AssociatedMedication [DataMember] public List ProductType { - get => _ProductType ?? new List(); + get => _ProductType ??= []; set { _ProductType = value; OnPropertyChanged("ProductType"); } } @@ -2663,7 +2663,7 @@ public List ProductType [DataMember] public List Monograph { - get => _Monograph ?? new List(); + get => _Monograph ??= []; set { _Monograph = value; OnPropertyChanged("Monograph"); } } @@ -2705,7 +2705,7 @@ public string? PreparationInstruction [DataMember] public List Cost { - get => _Cost ?? new List(); + get => _Cost ??= []; set { _Cost = value; OnPropertyChanged("Cost"); } } @@ -2719,7 +2719,7 @@ public List Cost [DataMember] public List MonitoringProgram { - get => _MonitoringProgram ?? new List(); + get => _MonitoringProgram ??= []; set { _MonitoringProgram = value; OnPropertyChanged("MonitoringProgram"); } } @@ -2733,7 +2733,7 @@ public List Monit [DataMember] public List IndicationGuideline { - get => _IndicationGuideline ?? new List(); + get => _IndicationGuideline ??= []; set { _IndicationGuideline = value; OnPropertyChanged("IndicationGuideline"); } } @@ -2747,7 +2747,7 @@ public List Ind [DataMember] public List MedicineClassification { - get => _MedicineClassification ?? new List(); + get => _MedicineClassification ??= []; set { _MedicineClassification = value; OnPropertyChanged("MedicineClassification"); } } @@ -2761,7 +2761,7 @@ public List [DataMember] public List Packaging { - get => _Packaging ?? new List(); + get => _Packaging ??= []; set { _Packaging = value; OnPropertyChanged("Packaging"); } } @@ -2777,7 +2777,7 @@ public List Packaging [DataMember] public List ClinicalUseIssue { - get => _ClinicalUseIssue ?? new List(); + get => _ClinicalUseIssue ??= []; set { _ClinicalUseIssue = value; OnPropertyChanged("ClinicalUseIssue"); } } @@ -2791,7 +2791,7 @@ public List ClinicalUseIssue [DataMember] public List StorageGuideline { - get => _StorageGuideline ?? new List(); + get => _StorageGuideline ??= []; set { _StorageGuideline = value; OnPropertyChanged("StorageGuideline"); } } @@ -2805,7 +2805,7 @@ public List Storag [DataMember] public List Regulatory { - get => _Regulatory ?? new List(); + get => _Regulatory ??= []; set { _Regulatory = value; OnPropertyChanged("Regulatory"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs index fe732223c..afa374268 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs @@ -316,7 +316,7 @@ public Hl7.Fhir.Model.ResourceReference? Dispenser [DataMember] public List DispenserInstruction { - get => _DispenserInstruction ?? new List(); + get => _DispenserInstruction ??= []; set { _DispenserInstruction = value; OnPropertyChanged("DispenserInstruction"); } } @@ -707,7 +707,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -723,7 +723,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -870,7 +870,7 @@ public Hl7.Fhir.Model.MedicationRequest.MedicationRequestIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -975,7 +975,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List InformationSource { - get => _InformationSource ?? new List(); + get => _InformationSource ??= []; set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } @@ -1006,7 +1006,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -1107,7 +1107,7 @@ public Hl7.Fhir.Model.CodeableConcept? PerformerType [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -1121,7 +1121,7 @@ public List Performer [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -1151,7 +1151,7 @@ public Hl7.Fhir.Model.ResourceReference? Recorder [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1181,7 +1181,7 @@ public Hl7.Fhir.Model.CodeableConcept? CourseOfTherapyType [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1195,7 +1195,7 @@ public List Insurance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1250,7 +1250,7 @@ public Hl7.Fhir.Model.Period? EffectiveDosePeriod [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -1292,7 +1292,7 @@ public Hl7.Fhir.Model.MedicationRequest.SubstitutionComponent? Substitution [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs index ce0c88d9c..6e0d97156 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs @@ -215,7 +215,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -231,7 +231,7 @@ public List Identifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -277,7 +277,7 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatementStatusCodes? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -382,7 +382,7 @@ public string? DateAsserted [DataMember] public List InformationSource { - get => _InformationSource ?? new List(); + get => _InformationSource ??= []; set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } @@ -398,7 +398,7 @@ public List InformationSource [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -413,7 +413,7 @@ public List DerivedFrom [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -427,7 +427,7 @@ public List Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -443,7 +443,7 @@ public List Note [DataMember] public List RelatedClinicalInformation { - get => _RelatedClinicalInformation ?? new List(); + get => _RelatedClinicalInformation ??= []; set { _RelatedClinicalInformation = value; OnPropertyChanged("RelatedClinicalInformation"); } } @@ -485,7 +485,7 @@ public string? RenderedDosageInstruction [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs index d3f028479..45712a138 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs @@ -239,7 +239,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Part { - get => _Part ?? new List(); + get => _Part ??= []; set { _Part = value; OnPropertyChanged("Part"); } } @@ -253,7 +253,7 @@ public List Part [DataMember] public List Usage { - get => _Usage ?? new List(); + get => _Usage ??= []; set { _Usage = value; OnPropertyChanged("Usage"); } } @@ -779,7 +779,7 @@ public Hl7.Fhir.Model.Period? EffectiveDate [DataMember] public List Organization { - get => _Organization ?? new List(); + get => _Organization ??= []; set { _Organization = value; OnPropertyChanged("Organization"); } } @@ -1011,7 +1011,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1166,7 +1166,7 @@ public Hl7.Fhir.Model.CodeableConcept? CombinedPharmaceuticalDoseForm [DataMember] public List Route { - get => _Route ?? new List(); + get => _Route ??= []; set { _Route = value; OnPropertyChanged("Route"); } } @@ -1237,7 +1237,7 @@ public Hl7.Fhir.Model.CodeableConcept? AdditionalMonitoringIndicator [DataMember] public List SpecialMeasures { - get => _SpecialMeasures ?? new List(); + get => _SpecialMeasures ??= []; set { _SpecialMeasures = value; OnPropertyChanged("SpecialMeasures"); } } @@ -1266,7 +1266,7 @@ public Hl7.Fhir.Model.CodeableConcept? PediatricUseIndicator [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -1280,7 +1280,7 @@ public List Classification [DataMember] public List MarketingStatus { - get => _MarketingStatus ?? new List(); + get => _MarketingStatus ??= []; set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } @@ -1295,7 +1295,7 @@ public List MarketingStatus [DataMember] public List PackagedMedicinalProduct { - get => _PackagedMedicinalProduct ?? new List(); + get => _PackagedMedicinalProduct ??= []; set { _PackagedMedicinalProduct = value; OnPropertyChanged("PackagedMedicinalProduct"); } } @@ -1311,7 +1311,7 @@ public List PackagedMedicinalProduct [DataMember] public List ComprisedOf { - get => _ComprisedOf ?? new List(); + get => _ComprisedOf ??= []; set { _ComprisedOf = value; OnPropertyChanged("ComprisedOf"); } } @@ -1326,7 +1326,7 @@ public List ComprisedOf [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -1341,7 +1341,7 @@ public List Ingredient [DataMember] public List Impurity { - get => _Impurity ?? new List(); + get => _Impurity ??= []; set { _Impurity = value; OnPropertyChanged("Impurity"); } } @@ -1357,7 +1357,7 @@ public List Impurity [DataMember] public List AttachedDocument { - get => _AttachedDocument ?? new List(); + get => _AttachedDocument ??= []; set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } @@ -1373,7 +1373,7 @@ public List AttachedDocument [DataMember] public List MasterFile { - get => _MasterFile ?? new List(); + get => _MasterFile ??= []; set { _MasterFile = value; OnPropertyChanged("MasterFile"); } } @@ -1387,7 +1387,7 @@ public List MasterFile [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1403,7 +1403,7 @@ public List Contact [DataMember] public List ClinicalTrial { - get => _ClinicalTrial ?? new List(); + get => _ClinicalTrial ??= []; set { _ClinicalTrial = value; OnPropertyChanged("ClinicalTrial"); } } @@ -1418,7 +1418,7 @@ public List ClinicalTrial [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -1432,7 +1432,7 @@ public List Code [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -1446,7 +1446,7 @@ public List Name [DataMember] public List CrossReference { - get => _CrossReference ?? new List(); + get => _CrossReference ??= []; set { _CrossReference = value; OnPropertyChanged("CrossReference"); } } @@ -1460,7 +1460,7 @@ public List C [DataMember] public List Operation { - get => _Operation ?? new List(); + get => _Operation ??= []; set { _Operation = value; OnPropertyChanged("Operation"); } } @@ -1474,7 +1474,7 @@ public List Operat [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs index bb189a76f..b1c2f7e6b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs @@ -525,7 +525,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -638,7 +638,7 @@ public string? Title [DataMember] public List ReplacesElement { - get => _ReplacesElement ?? new List(); + get => _ReplacesElement ??= []; set { _ReplacesElement = value; OnPropertyChanged("ReplacesElement"); } } @@ -786,7 +786,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -828,7 +828,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -843,7 +843,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -969,7 +969,7 @@ public string? Base [DataMember] public List ParentElement { - get => _ParentElement ?? new List(); + get => _ParentElement ??= []; set { _ParentElement = value; OnPropertyChanged("ParentElement"); } } @@ -1048,7 +1048,7 @@ public Hl7.Fhir.Model.MessageDefinition.MessageSignificanceCategory? Category [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -1092,7 +1092,7 @@ public Hl7.Fhir.Model.MessageDefinition.MessageheaderResponseRequest? ResponseRe [DataMember] public List AllowedResponse { - get => _AllowedResponse ?? new List(); + get => _AllowedResponse ??= []; set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs index 611b71799..ed1baa51a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs @@ -675,7 +675,7 @@ public Hl7.Fhir.Model.DataType? Event [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -777,7 +777,7 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs index db12db555..0b1f02568 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs @@ -221,7 +221,7 @@ public Hl7.Fhir.Model.MolecularSequence.StartingSequenceComponent? StartingSeque [DataMember] public List Edit { - get => _Edit ?? new List(); + get => _Edit ??= []; set { _Edit = value; OnPropertyChanged("Edit"); } } @@ -837,7 +837,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -898,7 +898,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -985,7 +985,7 @@ public string? Literal [DataMember] public List Formatted { - get => _Formatted ?? new List(); + get => _Formatted ??= []; set { _Formatted = value; OnPropertyChanged("Formatted"); } } @@ -999,7 +999,7 @@ public List Formatted [DataMember] public List Relative { - get => _Relative ?? new List(); + get => _Relative ??= []; set { _Relative = value; OnPropertyChanged("Relative"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs index 8c6888eac..56a9b2e51 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs @@ -452,7 +452,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -713,7 +713,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -797,7 +797,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -812,7 +812,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -980,7 +980,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -994,7 +994,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1008,7 +1008,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -1022,7 +1022,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -1036,7 +1036,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -1050,7 +1050,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1092,7 +1092,7 @@ public string? Usage [DataMember] public List UniqueId { - get => _UniqueId ?? new List(); + get => _UniqueId ??= []; set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs index 8db9788ef..e891c230b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs @@ -541,7 +541,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -555,7 +555,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -587,7 +587,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -621,7 +621,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -637,7 +637,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -683,7 +683,7 @@ public Hl7.Fhir.Model.EventStatus? Status [DataMember] public List StatusReason { - get => _StatusReason ?? new List(); + get => _StatusReason ??= []; set { _StatusReason = value; OnPropertyChanged("StatusReason"); } } @@ -801,7 +801,7 @@ public Hl7.Fhir.Model.DataType? Reported [DataMember] public List ConsumedItem { - get => _ConsumedItem ?? new List(); + get => _ConsumedItem ??= []; set { _ConsumedItem = value; OnPropertyChanged("ConsumedItem"); } } @@ -815,7 +815,7 @@ public List ConsumedItem [DataMember] public List IngredientLabel { - get => _IngredientLabel ?? new List(); + get => _IngredientLabel ??= []; set { _IngredientLabel = value; OnPropertyChanged("IngredientLabel"); } } @@ -829,7 +829,7 @@ public List IngredientL [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -860,7 +860,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -875,7 +875,7 @@ public List DerivedFrom [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -889,7 +889,7 @@ public List Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs index b85dcfc7f..3a707eb46 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs @@ -88,7 +88,7 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -115,7 +115,7 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietScheduleComponent? Schedule [DataMember] public List Nutrient { - get => _Nutrient ?? new List(); + get => _Nutrient ??= []; set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } @@ -129,7 +129,7 @@ public List Nutrient [DataMember] public List Texture { - get => _Texture ?? new List(); + get => _Texture ??= []; set { _Texture = value; OnPropertyChanged("Texture"); } } @@ -144,7 +144,7 @@ public List Texture [DataMember] public List FluidConsistencyType { - get => _FluidConsistencyType ?? new List(); + get => _FluidConsistencyType ??= []; set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } @@ -308,7 +308,7 @@ public partial class OralDietScheduleComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Timing { - get => _Timing ?? new List(); + get => _Timing ??= []; set { _Timing = value; OnPropertyChanged("Timing"); } } @@ -895,7 +895,7 @@ public partial class SupplementScheduleComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Timing { - get => _Timing ?? new List(); + get => _Timing ??= []; set { _Timing = value; OnPropertyChanged("Timing"); } } @@ -1088,7 +1088,7 @@ public string? BaseFormulaProductName [DataMember] public List DeliveryDevice { - get => _DeliveryDevice ?? new List(); + get => _DeliveryDevice ??= []; set { _DeliveryDevice = value; OnPropertyChanged("DeliveryDevice"); } } @@ -1102,7 +1102,7 @@ public List DeliveryDevice [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -1143,7 +1143,7 @@ public Hl7.Fhir.Model.CodeableConcept? RouteOfAdministration [DataMember] public List Administration { - get => _Administration ?? new List(); + get => _Administration ??= []; set { _Administration = value; OnPropertyChanged("Administration"); } } @@ -1634,7 +1634,7 @@ public partial class EnteralFormulaScheduleComponent : Hl7.Fhir.Model.BackboneEl [DataMember] public List Timing { - get => _Timing ?? new List(); + get => _Timing ??= []; set { _Timing = value; OnPropertyChanged("Timing"); } } @@ -1769,7 +1769,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1783,7 +1783,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -1815,7 +1815,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -1847,7 +1847,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List InstantiatesElement { - get => _InstantiatesElement ?? new List(); + get => _InstantiatesElement ??= []; set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -1881,7 +1881,7 @@ public IEnumerable? Instantiates [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -2033,7 +2033,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -2091,7 +2091,7 @@ public Hl7.Fhir.Model.ResourceReference? Orderer [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -2107,7 +2107,7 @@ public List Performer [DataMember] public List AllergyIntolerance { - get => _AllergyIntolerance ?? new List(); + get => _AllergyIntolerance ??= []; set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } @@ -2122,7 +2122,7 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get => _FoodPreferenceModifier ?? new List(); + get => _FoodPreferenceModifier ??= []; set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } @@ -2137,7 +2137,7 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get => _ExcludeFoodModifier ?? new List(); + get => _ExcludeFoodModifier ??= []; set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } @@ -2192,7 +2192,7 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet [DataMember] public List Supplement { - get => _Supplement ?? new List(); + get => _Supplement ??= []; set { _Supplement = value; OnPropertyChanged("Supplement"); } } @@ -2219,7 +2219,7 @@ public Hl7.Fhir.Model.NutritionOrder.EnteralFormulaComponent? EnteralFormula [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs index 19f5cbff5..898c8e166 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs @@ -128,7 +128,7 @@ public Hl7.Fhir.Model.CodeableReference? Item [DataMember] public List Amount { - get => _Amount ?? new List(); + get => _Amount ??= []; set { _Amount = value; OnPropertyChanged("Amount"); } } @@ -239,7 +239,7 @@ public Hl7.Fhir.Model.CodeableReference? Item [DataMember] public List Amount { - get => _Amount ?? new List(); + get => _Amount ??= []; set { _Amount = value; OnPropertyChanged("Amount"); } } @@ -466,7 +466,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -766,7 +766,7 @@ public Hl7.Fhir.Model.NutritionProduct.NutritionProductStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -782,7 +782,7 @@ public List Category [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -796,7 +796,7 @@ public List Manufacturer [DataMember] public List Nutrient { - get => _Nutrient ?? new List(); + get => _Nutrient ??= []; set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } @@ -810,7 +810,7 @@ public List Nutrient [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -825,7 +825,7 @@ public List Ingredient [DataMember] public List KnownAllergen { - get => _KnownAllergen ?? new List(); + get => _KnownAllergen ??= []; set { _KnownAllergen = value; OnPropertyChanged("KnownAllergen"); } } @@ -839,7 +839,7 @@ public List KnownAllergen [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -853,7 +853,7 @@ public List Characteris [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -867,7 +867,7 @@ public List Instance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Observation.cs b/src/Hl7.Fhir.R5/Model/Generated/Observation.cs index 363eb6e1e..9601c0b0c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Observation.cs @@ -341,7 +341,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List AppliesTo { - get => _AppliesTo ?? new List(); + get => _AppliesTo ??= []; set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } @@ -574,7 +574,7 @@ public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason [DataMember] public List Interpretation { - get => _Interpretation ?? new List(); + get => _Interpretation ??= []; set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } @@ -588,7 +588,7 @@ public List Interpretation [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -699,7 +699,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -731,7 +731,7 @@ public Hl7.Fhir.Model.DataType? Instantiates [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -745,7 +745,7 @@ public List BasedOn [DataMember] public List TriggeredBy { - get => _TriggeredBy ?? new List(); + get => _TriggeredBy ??= []; set { _TriggeredBy = value; OnPropertyChanged("TriggeredBy"); } } @@ -761,7 +761,7 @@ public List TriggeredBy [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -807,7 +807,7 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -853,7 +853,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -927,7 +927,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -972,7 +972,7 @@ public Hl7.Fhir.Model.CodeableConcept? DataAbsentReason [DataMember] public List Interpretation { - get => _Interpretation ?? new List(); + get => _Interpretation ??= []; set { _Interpretation = value; OnPropertyChanged("Interpretation"); } } @@ -986,7 +986,7 @@ public List Interpretation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1073,7 +1073,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -1089,7 +1089,7 @@ public List ReferenceRange [DataMember] public List HasMember { - get => _HasMember ?? new List(); + get => _HasMember ??= []; set { _HasMember = value; OnPropertyChanged("HasMember"); } } @@ -1105,7 +1105,7 @@ public List HasMember [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -1119,7 +1119,7 @@ public List DerivedFrom [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs index 18366b6cf..818d41edf 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs @@ -206,7 +206,7 @@ public Hl7.Fhir.Model.CodeableConcept? Context [DataMember] public List AppliesTo { - get => _AppliesTo ?? new List(); + get => _AppliesTo ??= []; set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } @@ -652,7 +652,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List> PermittedDataTypeElement { - get => _PermittedDataTypeElement ?? new List>(); + get => _PermittedDataTypeElement ??= []; set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } @@ -685,7 +685,7 @@ public IEnumerable? P [DataMember] public List PermittedUnit { - get => _PermittedUnit ?? new List(); + get => _PermittedUnit ??= []; set { _PermittedUnit = value; OnPropertyChanged("PermittedUnit"); } } @@ -699,7 +699,7 @@ public List PermittedUnit [DataMember] public List QualifiedValue { - get => _QualifiedValue ?? new List(); + get => _QualifiedValue ??= []; set { _QualifiedValue = value; OnPropertyChanged("QualifiedValue"); } } @@ -1056,7 +1056,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1098,7 +1098,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1113,7 +1113,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1280,7 +1280,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List DerivedFromCanonicalElement { - get => _DerivedFromCanonicalElement ?? new List(); + get => _DerivedFromCanonicalElement ??= []; set { _DerivedFromCanonicalElement = value; OnPropertyChanged("DerivedFromCanonicalElement"); } } @@ -1312,7 +1312,7 @@ public IEnumerable? DerivedFromCanonical [DataMember] public List DerivedFromUriElement { - get => _DerivedFromUriElement ?? new List(); + get => _DerivedFromUriElement ??= []; set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } @@ -1344,7 +1344,7 @@ public IEnumerable? DerivedFromUri [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -1372,7 +1372,7 @@ public Hl7.Fhir.Model.CodeableConcept? PerformerType [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1403,7 +1403,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List> PermittedDataTypeElement { - get => _PermittedDataTypeElement ?? new List>(); + get => _PermittedDataTypeElement ??= []; set { _PermittedDataTypeElement = value; OnPropertyChanged("PermittedDataTypeElement"); } } @@ -1493,7 +1493,7 @@ public Hl7.Fhir.Model.CodeableConcept? Method [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -1509,7 +1509,7 @@ public List Specimen [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -1552,7 +1552,7 @@ public string? PreferredReportName [DataMember] public List PermittedUnit { - get => _PermittedUnit ?? new List(); + get => _PermittedUnit ??= []; set { _PermittedUnit = value; OnPropertyChanged("PermittedUnit"); } } @@ -1566,7 +1566,7 @@ public List PermittedUnit [DataMember] public List QualifiedValue { - get => _QualifiedValue ?? new List(); + get => _QualifiedValue ??= []; set { _QualifiedValue = value; OnPropertyChanged("QualifiedValue"); } } @@ -1582,7 +1582,7 @@ public List Qualif [DataMember] public List HasMember { - get => _HasMember ?? new List(); + get => _HasMember ??= []; set { _HasMember = value; OnPropertyChanged("HasMember"); } } @@ -1596,7 +1596,7 @@ public List HasMember [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs index e24e61ca5..149de7303 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs @@ -199,7 +199,7 @@ public Hl7.Fhir.Model.OperationParameterUse? Use [DataMember] public List> ScopeElement { - get => _ScopeElement ?? new List>(); + get => _ScopeElement ??= []; set { _ScopeElement = value; OnPropertyChanged("ScopeElement"); } } @@ -349,7 +349,7 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List> AllowedTypeElement { - get => _AllowedTypeElement ?? new List>(); + get => _AllowedTypeElement ??= []; set { _AllowedTypeElement = value; OnPropertyChanged("AllowedTypeElement"); } } @@ -381,7 +381,7 @@ public IEnumerable? AllowedType [DataMember] public List TargetProfileElement { - get => _TargetProfileElement ?? new List(); + get => _TargetProfileElement ??= []; set { _TargetProfileElement = value; OnPropertyChanged("TargetProfileElement"); } } @@ -456,7 +456,7 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding [DataMember] public List ReferencedFrom { - get => _ReferencedFrom ?? new List(); + get => _ReferencedFrom ??= []; set { _ReferencedFrom = value; OnPropertyChanged("ReferencedFrom"); } } @@ -470,7 +470,7 @@ public List Referenc [DataMember] public List Part { - get => _Part ?? new List(); + get => _Part ??= []; set { _Part = value; OnPropertyChanged("Part"); } } @@ -960,7 +960,7 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get => _ParameterNameElement ?? new List(); + get => _ParameterNameElement ??= []; set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } @@ -1118,7 +1118,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1378,7 +1378,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1420,7 +1420,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1435,7 +1435,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1648,7 +1648,7 @@ public string? Base [DataMember] public List> ResourceElement { - get => _ResourceElement ?? new List>(); + get => _ResourceElement ??= []; set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } @@ -1823,7 +1823,7 @@ public string? OutputProfile [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1837,7 +1837,7 @@ public List Parameter [DataMember] public List Overload { - get => _Overload ?? new List(); + get => _Overload ??= []; set { _Overload = value; OnPropertyChanged("Overload"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs index ce2628752..ebcf1e209 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs @@ -87,7 +87,7 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -232,7 +232,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -275,7 +275,7 @@ public bool? Active [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -317,7 +317,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -377,7 +377,7 @@ public string? Description [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -408,7 +408,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -422,7 +422,7 @@ public List Endpoint [DataMember] public List Qualification { - get => _Qualification ?? new List(); + get => _Qualification ??= []; set { _Qualification = value; OnPropertyChanged("Qualification"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs index 1d3f24e56..5a185d58d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs @@ -67,7 +67,7 @@ public partial class OrganizationAffiliation : Hl7.Fhir.Model.DomainResource, II [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -154,7 +154,7 @@ public Hl7.Fhir.Model.ResourceReference? ParticipatingOrganization [DataMember] public List Network { - get => _Network ?? new List(); + get => _Network ??= []; set { _Network = value; OnPropertyChanged("Network"); } } @@ -169,7 +169,7 @@ public List Network [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -184,7 +184,7 @@ public List Code [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -200,7 +200,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -216,7 +216,7 @@ public List Location [DataMember] public List HealthcareService { - get => _HealthcareService ?? new List(); + get => _HealthcareService ??= []; set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } @@ -230,7 +230,7 @@ public List HealthcareService [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -246,7 +246,7 @@ public List Contact [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs index 2e81e636f..0543e0092 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs @@ -194,7 +194,7 @@ public partial class PackagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -279,7 +279,7 @@ public int? Quantity [DataMember] public List Material { - get => _Material ?? new List(); + get => _Material ??= []; set { _Material = value; OnPropertyChanged("Material"); } } @@ -294,7 +294,7 @@ public List Material [DataMember] public List AlternateMaterial { - get => _AlternateMaterial ?? new List(); + get => _AlternateMaterial ??= []; set { _AlternateMaterial = value; OnPropertyChanged("AlternateMaterial"); } } @@ -308,7 +308,7 @@ public List AlternateMaterial [DataMember] public List ShelfLifeStorage { - get => _ShelfLifeStorage ?? new List(); + get => _ShelfLifeStorage ??= []; set { _ShelfLifeStorage = value; OnPropertyChanged("ShelfLifeStorage"); } } @@ -324,7 +324,7 @@ public List ShelfLifeStorage [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -338,7 +338,7 @@ public List Manufacturer [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -352,7 +352,7 @@ public List Property [DataMember] public List ContainedItem { - get => _ContainedItem ?? new List(); + get => _ContainedItem ??= []; set { _ContainedItem = value; OnPropertyChanged("ContainedItem"); } } @@ -366,7 +366,7 @@ public List Con [DataMember] public List Packaging { - get => _Packaging ?? new List(); + get => _Packaging ??= []; set { _Packaging = value; OnPropertyChanged("Packaging"); } } @@ -754,7 +754,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -812,7 +812,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List PackageFor { - get => _PackageFor ?? new List(); + get => _PackageFor ??= []; set { _PackageFor = value; OnPropertyChanged("PackageFor"); } } @@ -868,7 +868,7 @@ public string? StatusDate [DataMember] public List ContainedItemQuantity { - get => _ContainedItemQuantity ?? new List(); + get => _ContainedItemQuantity ??= []; set { _ContainedItemQuantity = value; OnPropertyChanged("ContainedItemQuantity"); } } @@ -910,7 +910,7 @@ public string? Description [DataMember] public List LegalStatusOfSupply { - get => _LegalStatusOfSupply ?? new List(); + get => _LegalStatusOfSupply ??= []; set { _LegalStatusOfSupply = value; OnPropertyChanged("LegalStatusOfSupply"); } } @@ -924,7 +924,7 @@ public List MarketingStatus { - get => _MarketingStatus ?? new List(); + get => _MarketingStatus ??= []; set { _MarketingStatus = value; OnPropertyChanged("MarketingStatus"); } } @@ -968,7 +968,7 @@ public bool? CopackagedIndicator [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -984,7 +984,7 @@ public List Manufacturer [DataMember] public List AttachedDocument { - get => _AttachedDocument ?? new List(); + get => _AttachedDocument ??= []; set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } @@ -1011,7 +1011,7 @@ public Hl7.Fhir.Model.PackagedProductDefinition.PackagingComponent? Packaging [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Patient.cs b/src/Hl7.Fhir.R5/Model/Generated/Patient.cs index 80a51c4fc..470c6a573 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Patient.cs @@ -121,7 +121,7 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } @@ -148,7 +148,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -610,7 +610,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -652,7 +652,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -666,7 +666,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -753,7 +753,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -796,7 +796,7 @@ public Hl7.Fhir.Model.DataType? MultipleBirth [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -810,7 +810,7 @@ public List Photo [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -824,7 +824,7 @@ public List Contact [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -840,7 +840,7 @@ public List Communication [DataMember] public List GeneralPractitioner { - get => _GeneralPractitioner ?? new List(); + get => _GeneralPractitioner ??= []; set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } @@ -869,7 +869,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs index 0d6f2630c..c016f68da 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs @@ -70,7 +70,7 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs index 69619c836..0caff3580 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs @@ -634,7 +634,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1161,7 +1161,7 @@ public Hl7.Fhir.Model.Identifier? PaymentIdentifier [DataMember] public List Allocation { - get => _Allocation ?? new List(); + get => _Allocation ??= []; set { _Allocation = value; OnPropertyChanged("Allocation"); } } @@ -1189,7 +1189,7 @@ public Hl7.Fhir.Model.CodeableConcept? FormCode [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs index 76b53f31b..3eb3d6a80 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs @@ -164,7 +164,7 @@ public partial class JustificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Basis { - get => _Basis ?? new List(); + get => _Basis ??= []; set { _Basis = value; OnPropertyChanged("Basis"); } } @@ -180,7 +180,7 @@ public List Basis [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -310,7 +310,7 @@ public Hl7.Fhir.Model.ConsentProvisionType? Type [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } @@ -324,7 +324,7 @@ public List Data [DataMember] public List Activity { - get => _Activity ?? new List(); + get => _Activity ??= []; set { _Activity = value; OnPropertyChanged("Activity"); } } @@ -339,7 +339,7 @@ public List Activity [DataMember] public List Limit { - get => _Limit ?? new List(); + get => _Limit ??= []; set { _Limit = value; OnPropertyChanged("Limit"); } } @@ -457,7 +457,7 @@ public partial class DataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -471,7 +471,7 @@ public List Resource [DataMember] public List Security { - get => _Security ?? new List(); + get => _Security ??= []; set { _Security = value; OnPropertyChanged("Security"); } } @@ -485,7 +485,7 @@ public List Security [DataMember] public List Period { - get => _Period ?? new List(); + get => _Period ??= []; set { _Period = value; OnPropertyChanged("Period"); } } @@ -745,7 +745,7 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -760,7 +760,7 @@ public List Actor [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -775,7 +775,7 @@ public List Action [DataMember] public List Purpose { - get => _Purpose ?? new List(); + get => _Purpose ??= []; set { _Purpose = value; OnPropertyChanged("Purpose"); } } @@ -914,7 +914,7 @@ public Hl7.Fhir.Model.ResourceReference? Asserter [DataMember] public List DateElement { - get => _DateElement ?? new List(); + get => _DateElement ??= []; set { _DateElement = value; OnPropertyChanged("DateElement"); } } @@ -1003,7 +1003,7 @@ public Hl7.Fhir.Model.Permission.PermissionRuleCombining? Combining [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Person.cs b/src/Hl7.Fhir.R5/Model/Generated/Person.cs index cb95d1d5d..5ffc6312f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Person.cs @@ -364,7 +364,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -406,7 +406,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -420,7 +420,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -507,7 +507,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -535,7 +535,7 @@ public Hl7.Fhir.Model.CodeableConcept? MaritalStatus [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -549,7 +549,7 @@ public List Photo [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -578,7 +578,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs index ab0183795..c151ba0ab 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.CodeableConcept? Start [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -158,7 +158,7 @@ public List Addresses [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -172,7 +172,7 @@ public List Documentation [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -510,7 +510,7 @@ public string? Description [DataMember] public List Option { - get => _Option ?? new List(); + get => _Option ??= []; set { _Option = value; OnPropertyChanged("Option"); } } @@ -996,7 +996,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1010,7 +1010,7 @@ public List Reason [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -1024,7 +1024,7 @@ public List Documentation [DataMember] public List GoalIdElement { - get => _GoalIdElement ?? new List(); + get => _GoalIdElement ??= []; set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } @@ -1073,7 +1073,7 @@ public Hl7.Fhir.Model.DataType? Subject [DataMember] public List Trigger { - get => _Trigger ?? new List(); + get => _Trigger ??= []; set { _Trigger = value; OnPropertyChanged("Trigger"); } } @@ -1087,7 +1087,7 @@ public List Trigger [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -1101,7 +1101,7 @@ public List Condition [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -1115,7 +1115,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } @@ -1129,7 +1129,7 @@ public List Output [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -1171,7 +1171,7 @@ public Hl7.Fhir.Model.CodeableReference? Location [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1392,7 +1392,7 @@ public string? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } @@ -1406,7 +1406,7 @@ public List DynamicValue [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -2809,7 +2809,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3096,7 +3096,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -3138,7 +3138,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -3153,7 +3153,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -3349,7 +3349,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -3363,7 +3363,7 @@ public List Topic [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -3377,7 +3377,7 @@ public List Author [DataMember] public List Editor { - get => _Editor ?? new List(); + get => _Editor ??= []; set { _Editor = value; OnPropertyChanged("Editor"); } } @@ -3391,7 +3391,7 @@ public List Editor [DataMember] public List Reviewer { - get => _Reviewer ?? new List(); + get => _Reviewer ??= []; set { _Reviewer = value; OnPropertyChanged("Reviewer"); } } @@ -3405,7 +3405,7 @@ public List Reviewer [DataMember] public List Endorser { - get => _Endorser ?? new List(); + get => _Endorser ??= []; set { _Endorser = value; OnPropertyChanged("Endorser"); } } @@ -3419,7 +3419,7 @@ public List Endorser [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -3433,7 +3433,7 @@ public List RelatedArtifact [DataMember] public List LibraryElement { - get => _LibraryElement ?? new List(); + get => _LibraryElement ??= []; set { _LibraryElement = value; OnPropertyChanged("LibraryElement"); } } @@ -3465,7 +3465,7 @@ public IEnumerable? Library [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -3479,7 +3479,7 @@ public List Goal [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -3493,7 +3493,7 @@ public List Actor [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs index 9ec591872..28f9b3262 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs @@ -88,7 +88,7 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -365,7 +365,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -407,7 +407,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -421,7 +421,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -508,7 +508,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -522,7 +522,7 @@ public List Address [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -536,7 +536,7 @@ public List Photo [DataMember] public List Qualification { - get => _Qualification ?? new List(); + get => _Qualification ??= []; set { _Qualification = value; OnPropertyChanged("Qualification"); } } @@ -550,7 +550,7 @@ public List Qualification [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs index bdbfa51d1..48c082f47 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs @@ -70,7 +70,7 @@ public partial class PractitionerRole : Hl7.Fhir.Model.DomainResource, IIdentifi [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -156,7 +156,7 @@ public Hl7.Fhir.Model.ResourceReference? Organization [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -171,7 +171,7 @@ public List Code [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -187,7 +187,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -203,7 +203,7 @@ public List Location [DataMember] public List HealthcareService { - get => _HealthcareService ?? new List(); + get => _HealthcareService ??= []; set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } @@ -217,7 +217,7 @@ public List HealthcareService [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -232,7 +232,7 @@ public List Contact [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -247,7 +247,7 @@ public List Characteristic [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -261,7 +261,7 @@ public List Communication [DataMember] public List Availability { - get => _Availability ?? new List(); + get => _Availability ??= []; set { _Availability = value; OnPropertyChanged("Availability"); } } @@ -277,7 +277,7 @@ public List Availability [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs index ab0fcc643..d0fb0949c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs @@ -348,7 +348,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -362,7 +362,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -394,7 +394,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -428,7 +428,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -444,7 +444,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -504,7 +504,7 @@ public Hl7.Fhir.Model.CodeableConcept? StatusReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -652,7 +652,7 @@ public Hl7.Fhir.Model.DataType? Reported [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -682,7 +682,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -697,7 +697,7 @@ public List Reason [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -727,7 +727,7 @@ public Hl7.Fhir.Model.CodeableConcept? Outcome [DataMember] public List Report { - get => _Report ?? new List(); + get => _Report ??= []; set { _Report = value; OnPropertyChanged("Report"); } } @@ -742,7 +742,7 @@ public List Report [DataMember] public List Complication { - get => _Complication ?? new List(); + get => _Complication ??= []; set { _Complication = value; OnPropertyChanged("Complication"); } } @@ -757,7 +757,7 @@ public List Complication [DataMember] public List FollowUp { - get => _FollowUp ?? new List(); + get => _FollowUp ??= []; set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } @@ -771,7 +771,7 @@ public List FollowUp [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -785,7 +785,7 @@ public List Note [DataMember] public List FocalDevice { - get => _FocalDevice ?? new List(); + get => _FocalDevice ??= []; set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } @@ -800,7 +800,7 @@ public List FocalDevice [DataMember] public List Used { - get => _Used ?? new List(); + get => _Used ??= []; set { _Used = value; OnPropertyChanged("Used"); } } @@ -816,7 +816,7 @@ public List Used [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs index df362949b..f322f0401 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs @@ -95,7 +95,7 @@ public Hl7.Fhir.Model.DataType? Period [DataMember] public List SpecialPrecautionsForStorage { - get => _SpecialPrecautionsForStorage ?? new List(); + get => _SpecialPrecautionsForStorage ??= []; set { _SpecialPrecautionsForStorage = value; OnPropertyChanged("SpecialPrecautionsForStorage"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs index ec911f5cd..0f8de72f3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs @@ -143,7 +143,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -336,7 +336,7 @@ public Hl7.Fhir.Model.ResourceReference? What [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -431,7 +431,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -488,7 +488,7 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -536,7 +536,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Authorization { - get => _Authorization ?? new List(); + get => _Authorization ??= []; set { _Authorization = value; OnPropertyChanged("Authorization"); } } @@ -566,7 +566,7 @@ public Hl7.Fhir.Model.CodeableConcept? Activity [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -610,7 +610,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -624,7 +624,7 @@ public List Agent [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } @@ -638,7 +638,7 @@ public List Entity [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs index 353eb9e27..2ed8e0be2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs @@ -375,7 +375,7 @@ public string? Definition [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -476,7 +476,7 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get => _EnableWhen ?? new List(); + get => _EnableWhen ??= []; set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } @@ -720,7 +720,7 @@ public string? AnswerValueSet [DataMember] public List AnswerOption { - get => _AnswerOption ?? new List(); + get => _AnswerOption ??= []; set { _AnswerOption = value; OnPropertyChanged("AnswerOption"); } } @@ -734,7 +734,7 @@ public List AnswerOption [DataMember] public List Initial { - get => _Initial ?? new List(); + get => _Initial ??= []; set { _Initial = value; OnPropertyChanged("Initial"); } } @@ -748,7 +748,7 @@ public List Initial [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -1407,7 +1407,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1520,7 +1520,7 @@ public string? Title [DataMember] public List DerivedFromElement { - get => _DerivedFromElement ?? new List(); + get => _DerivedFromElement ??= []; set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } @@ -1613,7 +1613,7 @@ public bool? Experimental [DataMember] public List> SubjectTypeElement { - get => _SubjectTypeElement ?? new List>(); + get => _SubjectTypeElement ??= []; set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } @@ -1701,7 +1701,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1743,7 +1743,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1758,7 +1758,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1926,7 +1926,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -1940,7 +1940,7 @@ public List Code [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs index 6e9cb8d2b..850187aee 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs @@ -213,7 +213,7 @@ public string? Text [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -227,7 +227,7 @@ public List Answer [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -373,7 +373,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -457,7 +457,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -473,7 +473,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -489,7 +489,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -651,7 +651,7 @@ public Hl7.Fhir.Model.ResourceReference? Source [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs b/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs index 6ba57b66d..d7ac84357 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs @@ -142,7 +142,7 @@ public Hl7.Fhir.Model.DataType? Date [DataMember] public List Application { - get => _Application ?? new List(); + get => _Application ??= []; set { _Application = value; OnPropertyChanged("Application"); } } @@ -253,7 +253,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -269,7 +269,7 @@ public List Identifier [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -326,7 +326,7 @@ public string? Description [DataMember] public List Region { - get => _Region ?? new List(); + get => _Region ??= []; set { _Region = value; OnPropertyChanged("Region"); } } @@ -395,7 +395,7 @@ public Hl7.Fhir.Model.Period? ValidityPeriod [DataMember] public List Indication { - get => _Indication ?? new List(); + get => _Indication ??= []; set { _Indication = value; OnPropertyChanged("Indication"); } } @@ -424,7 +424,7 @@ public Hl7.Fhir.Model.CodeableConcept? IntendedUse [DataMember] public List Basis { - get => _Basis ?? new List(); + get => _Basis ??= []; set { _Basis = value; OnPropertyChanged("Basis"); } } @@ -470,7 +470,7 @@ public Hl7.Fhir.Model.ResourceReference? Regulator [DataMember] public List AttachedDocument { - get => _AttachedDocument ?? new List(); + get => _AttachedDocument ??= []; set { _AttachedDocument = value; OnPropertyChanged("AttachedDocument"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs index ef861befd..9b35debf1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs @@ -199,7 +199,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -258,7 +258,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } @@ -272,7 +272,7 @@ public List Relationship [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -286,7 +286,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -358,7 +358,7 @@ public string? BirthDate [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -372,7 +372,7 @@ public List Address [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -399,7 +399,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs index 5525562a2..07b19d0d5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs @@ -257,7 +257,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -271,7 +271,7 @@ public List Code [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -287,7 +287,7 @@ public List Documentation [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -301,7 +301,7 @@ public List Goal [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -315,7 +315,7 @@ public List Condition [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -329,7 +329,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } @@ -343,7 +343,7 @@ public List Output [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -385,7 +385,7 @@ public Hl7.Fhir.Model.CodeableReference? Location [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -621,7 +621,7 @@ public string? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } @@ -635,7 +635,7 @@ public List DynamicVa [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1980,7 +1980,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1994,7 +1994,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -2026,7 +2026,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -2060,7 +2060,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -2076,7 +2076,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -2283,7 +2283,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -2299,7 +2299,7 @@ public List Reason [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -2313,7 +2313,7 @@ public List Goal [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -2327,7 +2327,7 @@ public List Note [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs index 7061dd19c..080c90b23 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs @@ -179,7 +179,7 @@ public string? Label [DataMember] public List> ConformanceElement { - get => _ConformanceElement ?? new List>(); + get => _ConformanceElement ??= []; set { _ConformanceElement = value; OnPropertyChanged("ConformanceElement"); } } @@ -324,7 +324,7 @@ public string? Parent [DataMember] public List SatisfiedByElement { - get => _SatisfiedByElement ?? new List(); + get => _SatisfiedByElement ??= []; set { _SatisfiedByElement = value; OnPropertyChanged("SatisfiedByElement"); } } @@ -356,7 +356,7 @@ public IEnumerable? SatisfiedBy [DataMember] public List ReferenceElement { - get => _ReferenceElement ?? new List(); + get => _ReferenceElement ??= []; set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } @@ -390,7 +390,7 @@ public IEnumerable? Reference [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -574,7 +574,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -802,7 +802,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -844,7 +844,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -859,7 +859,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -957,7 +957,7 @@ public string? CopyrightLabel [DataMember] public List DerivedFromElement { - get => _DerivedFromElement ?? new List(); + get => _DerivedFromElement ??= []; set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } @@ -989,7 +989,7 @@ public IEnumerable? DerivedFrom [DataMember] public List ReferenceElement { - get => _ReferenceElement ?? new List(); + get => _ReferenceElement ??= []; set { _ReferenceElement = value; OnPropertyChanged("ReferenceElement"); } } @@ -1021,7 +1021,7 @@ public IEnumerable? Reference [DataMember] public List ActorElement { - get => _ActorElement ?? new List(); + get => _ActorElement ??= []; set { _ActorElement = value; OnPropertyChanged("ActorElement"); } } @@ -1053,7 +1053,7 @@ public IEnumerable? Actor [DataMember] public List Statement { - get => _Statement ?? new List(); + get => _Statement ??= []; set { _Statement = value; OnPropertyChanged("Statement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs index 25d759c5d..1ceb6a84f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs @@ -255,7 +255,7 @@ public Hl7.Fhir.Model.CodeableConcept? Role [DataMember] public List Period { - get => _Period ?? new List(); + get => _Period ??= []; set { _Period = value; OnPropertyChanged("Period"); } } @@ -270,7 +270,7 @@ public List Period [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -849,7 +849,7 @@ public string? Description [DataMember] public List IntendedExposure { - get => _IntendedExposure ?? new List(); + get => _IntendedExposure ??= []; set { _IntendedExposure = value; OnPropertyChanged("IntendedExposure"); } } @@ -1195,7 +1195,7 @@ public string? Name [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1368,7 +1368,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1466,7 +1466,7 @@ public string? Title [DataMember] public List Label { - get => _Label ?? new List(); + get => _Label ??= []; set { _Label = value; OnPropertyChanged("Label"); } } @@ -1482,7 +1482,7 @@ public List Label [DataMember] public List Protocol { - get => _Protocol ?? new List(); + get => _Protocol ??= []; set { _Protocol = value; OnPropertyChanged("Protocol"); } } @@ -1498,7 +1498,7 @@ public List Protocol [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1512,7 +1512,7 @@ public List PartOf [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1614,7 +1614,7 @@ public Hl7.Fhir.Model.CodeableConcept? Phase [DataMember] public List StudyDesign { - get => _StudyDesign ?? new List(); + get => _StudyDesign ??= []; set { _StudyDesign = value; OnPropertyChanged("StudyDesign"); } } @@ -1629,7 +1629,7 @@ public List StudyDesign [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -1644,7 +1644,7 @@ public List Focus [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -1659,7 +1659,7 @@ public List Condition [DataMember] public List Keyword { - get => _Keyword ?? new List(); + get => _Keyword ??= []; set { _Keyword = value; OnPropertyChanged("Keyword"); } } @@ -1674,7 +1674,7 @@ public List Keyword [DataMember] public List Region { - get => _Region ?? new List(); + get => _Region ??= []; set { _Region = value; OnPropertyChanged("Region"); } } @@ -1759,7 +1759,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -1773,7 +1773,7 @@ public List Site [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1788,7 +1788,7 @@ public List Note [DataMember] public List Classifier { - get => _Classifier ?? new List(); + get => _Classifier ??= []; set { _Classifier = value; OnPropertyChanged("Classifier"); } } @@ -1802,7 +1802,7 @@ public List Classifier [DataMember] public List AssociatedParty { - get => _AssociatedParty ?? new List(); + get => _AssociatedParty ??= []; set { _AssociatedParty = value; OnPropertyChanged("AssociatedParty"); } } @@ -1816,7 +1816,7 @@ public List AssociatedPar [DataMember] public List ProgressStatus { - get => _ProgressStatus ?? new List(); + get => _ProgressStatus ??= []; set { _ProgressStatus = value; OnPropertyChanged("ProgressStatus"); } } @@ -1857,7 +1857,7 @@ public Hl7.Fhir.Model.ResearchStudy.RecruitmentComponent? Recruitment [DataMember] public List ComparisonGroup { - get => _ComparisonGroup ?? new List(); + get => _ComparisonGroup ??= []; set { _ComparisonGroup = value; OnPropertyChanged("ComparisonGroup"); } } @@ -1871,7 +1871,7 @@ public List ComparisonGro [DataMember] public List Objective { - get => _Objective ?? new List(); + get => _Objective ??= []; set { _Objective = value; OnPropertyChanged("Objective"); } } @@ -1885,7 +1885,7 @@ public List Objective [DataMember] public List OutcomeMeasure { - get => _OutcomeMeasure ?? new List(); + get => _OutcomeMeasure ??= []; set { _OutcomeMeasure = value; OnPropertyChanged("OutcomeMeasure"); } } @@ -1901,7 +1901,7 @@ public List OutcomeMeasure [DataMember] public List Result { - get => _Result ?? new List(); + get => _Result ??= []; set { _Result = value; OnPropertyChanged("Result"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs index b9a69025e..87a6eaffe 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs @@ -395,7 +395,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -440,7 +440,7 @@ public Hl7.Fhir.Model.PublicationStatus? Status [DataMember] public List Progress { - get => _Progress ?? new List(); + get => _Progress ??= []; set { _Progress = value; OnPropertyChanged("Progress"); } } @@ -557,7 +557,7 @@ public string? ActualComparisonGroup [DataMember] public List Consent { - get => _Consent ?? new List(); + get => _Consent ??= []; set { _Consent = value; OnPropertyChanged("Consent"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs index ecc7caad5..fff791fa8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs @@ -307,7 +307,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -485,7 +485,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -501,7 +501,7 @@ public List Reason [DataMember] public List Basis { - get => _Basis ?? new List(); + get => _Basis ??= []; set { _Basis = value; OnPropertyChanged("Basis"); } } @@ -515,7 +515,7 @@ public List Basis [DataMember] public List Prediction { - get => _Prediction ?? new List(); + get => _Prediction ??= []; set { _Prediction = value; OnPropertyChanged("Prediction"); } } @@ -557,7 +557,7 @@ public string? Mitigation [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs index 35c133e16..895815778 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs @@ -67,7 +67,7 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -110,7 +110,7 @@ public bool? Active [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -125,7 +125,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -140,7 +140,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -184,7 +184,7 @@ public string? Name [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs index a5c799c1c..eaa429278 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs @@ -272,7 +272,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -529,7 +529,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -572,7 +572,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -587,7 +587,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -716,7 +716,7 @@ public string? Code [DataMember] public List> BaseElement { - get => _BaseElement ?? new List>(); + get => _BaseElement ??= []; set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } @@ -867,7 +867,7 @@ public string? Constraint [DataMember] public List> TargetElement { - get => _TargetElement ?? new List>(); + get => _TargetElement ??= []; set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } @@ -957,7 +957,7 @@ public bool? MultipleAnd [DataMember] public List> ComparatorElement { - get => _ComparatorElement ?? new List>(); + get => _ComparatorElement ??= []; set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } @@ -991,7 +991,7 @@ public IEnumerable? Comparator [DataMember] public List> ModifierElement { - get => _ModifierElement ?? new List>(); + get => _ModifierElement ??= []; set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } @@ -1023,7 +1023,7 @@ public IEnumerable? Modifier [DataMember] public List ChainElement { - get => _ChainElement ?? new List(); + get => _ChainElement ??= []; set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } @@ -1055,7 +1055,7 @@ public IEnumerable? Chain [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs index 73957b85b..0a183e837 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs @@ -100,7 +100,7 @@ public Hl7.Fhir.Model.CodeableReference? ParameterFocus [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -391,7 +391,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -405,7 +405,7 @@ public List Identifier [DataMember] public List InstantiatesCanonicalElement { - get => _InstantiatesCanonicalElement ?? new List(); + get => _InstantiatesCanonicalElement ??= []; set { _InstantiatesCanonicalElement = value; OnPropertyChanged("InstantiatesCanonicalElement"); } } @@ -437,7 +437,7 @@ public IEnumerable? InstantiatesCanonical [DataMember] public List InstantiatesUriElement { - get => _InstantiatesUriElement ?? new List(); + get => _InstantiatesUriElement ??= []; set { _InstantiatesUriElement = value; OnPropertyChanged("InstantiatesUriElement"); } } @@ -471,7 +471,7 @@ public IEnumerable? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -487,7 +487,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -577,7 +577,7 @@ public Hl7.Fhir.Model.RequestIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -663,7 +663,7 @@ public Hl7.Fhir.Model.CodeableReference? Code [DataMember] public List OrderDetail { - get => _OrderDetail ?? new List(); + get => _OrderDetail ??= []; set { _OrderDetail = value; OnPropertyChanged("OrderDetail"); } } @@ -710,7 +710,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -829,7 +829,7 @@ public Hl7.Fhir.Model.CodeableConcept? PerformerType [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -844,7 +844,7 @@ public List Performer [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -859,7 +859,7 @@ public List Location [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -875,7 +875,7 @@ public List Reason [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -889,7 +889,7 @@ public List Insurance [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -905,7 +905,7 @@ public List SupportingInfo [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -920,7 +920,7 @@ public List Specimen [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -949,7 +949,7 @@ public Hl7.Fhir.Model.ResourceReference? BodyStructure [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -963,7 +963,7 @@ public List Note [DataMember] public List PatientInstruction { - get => _PatientInstruction ?? new List(); + get => _PatientInstruction ??= []; set { _PatientInstruction = value; OnPropertyChanged("PatientInstruction"); } } @@ -979,7 +979,7 @@ public List PatientIn [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Slot.cs b/src/Hl7.Fhir.R5/Model/Generated/Slot.cs index d91072a21..4462511e3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Slot.cs @@ -107,7 +107,7 @@ public enum SlotStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -122,7 +122,7 @@ public List Identifier [DataMember] public List ServiceCategory { - get => _ServiceCategory ?? new List(); + get => _ServiceCategory ??= []; set { _ServiceCategory = value; OnPropertyChanged("ServiceCategory"); } } @@ -137,7 +137,7 @@ public List ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -152,7 +152,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -167,7 +167,7 @@ public List Specialty [DataMember] public List AppointmentType { - get => _AppointmentType ?? new List(); + get => _AppointmentType ??= []; set { _AppointmentType = value; OnPropertyChanged("AppointmentType"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs index a1fe5dd1e..5d38e6804 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs @@ -594,7 +594,7 @@ public Hl7.Fhir.Model.CodeableConcept? Method [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -850,7 +850,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -966,7 +966,7 @@ public string? ReceivedTime [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -982,7 +982,7 @@ public List Parent [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -1027,7 +1027,7 @@ public Hl7.Fhir.Model.Specimen.SpecimenCombined? Combined [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -1041,7 +1041,7 @@ public List Role [DataMember] public List Feature { - get => _Feature ?? new List(); + get => _Feature ??= []; set { _Feature = value; OnPropertyChanged("Feature"); } } @@ -1068,7 +1068,7 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection [DataMember] public List Processing { - get => _Processing ?? new List(); + get => _Processing ??= []; set { _Processing = value; OnPropertyChanged("Processing"); } } @@ -1082,7 +1082,7 @@ public List Processing [DataMember] public List Container { - get => _Container ?? new List(); + get => _Container ??= []; set { _Container = value; OnPropertyChanged("Container"); } } @@ -1097,7 +1097,7 @@ public List Container [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -1111,7 +1111,7 @@ public List Condition [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs index 57f545bb5..9427db882 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs @@ -264,7 +264,7 @@ public bool? SingleUse [DataMember] public List RejectionCriterion { - get => _RejectionCriterion ?? new List(); + get => _RejectionCriterion ??= []; set { _RejectionCriterion = value; OnPropertyChanged("RejectionCriterion"); } } @@ -278,7 +278,7 @@ public List RejectionCriterion [DataMember] public List Handling { - get => _Handling ?? new List(); + get => _Handling ??= []; set { _Handling = value; OnPropertyChanged("Handling"); } } @@ -293,7 +293,7 @@ public List Handling [DataMember] public List TestingDestination { - get => _TestingDestination ?? new List(); + get => _TestingDestination ??= []; set { _TestingDestination = value; OnPropertyChanged("TestingDestination"); } } @@ -560,7 +560,7 @@ public Hl7.Fhir.Model.DataType? MinimumVolume [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -1133,7 +1133,7 @@ public string? Title [DataMember] public List DerivedFromCanonicalElement { - get => _DerivedFromCanonicalElement ?? new List(); + get => _DerivedFromCanonicalElement ??= []; set { _DerivedFromCanonicalElement = value; OnPropertyChanged("DerivedFromCanonicalElement"); } } @@ -1165,7 +1165,7 @@ public IEnumerable? DerivedFromCanonical [DataMember] public List DerivedFromUriElement { - get => _DerivedFromUriElement ?? new List(); + get => _DerivedFromUriElement ??= []; set { _DerivedFromUriElement = value; OnPropertyChanged("DerivedFromUriElement"); } } @@ -1328,7 +1328,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1370,7 +1370,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1385,7 +1385,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1567,7 +1567,7 @@ public Hl7.Fhir.Model.CodeableConcept? TypeCollected [DataMember] public List PatientPreparation { - get => _PatientPreparation ?? new List(); + get => _PatientPreparation ??= []; set { _PatientPreparation = value; OnPropertyChanged("PatientPreparation"); } } @@ -1610,7 +1610,7 @@ public string? TimeAspect [DataMember] public List Collection { - get => _Collection ?? new List(); + get => _Collection ??= []; set { _Collection = value; OnPropertyChanged("Collection"); } } @@ -1624,7 +1624,7 @@ public List Collection [DataMember] public List TypeTested { - get => _TypeTested ?? new List(); + get => _TypeTested ??= []; set { _TypeTested = value; OnPropertyChanged("TypeTested"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs index b72ce00b7..75bfbd43c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs @@ -825,7 +825,7 @@ public string? Documentation [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -839,7 +839,7 @@ public List Input [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1221,7 +1221,7 @@ public string? Name [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1235,7 +1235,7 @@ public List Source [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -1249,7 +1249,7 @@ public List Target [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1263,7 +1263,7 @@ public List Rule [DataMember] public List Dependent { - get => _Dependent ?? new List(); + get => _Dependent ??= []; set { _Dependent = value; OnPropertyChanged("Dependent"); } } @@ -1985,7 +1985,7 @@ public string? Variable [DataMember] public List> ListModeElement { - get => _ListModeElement ?? new List>(); + get => _ListModeElement ??= []; set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } @@ -2075,7 +2075,7 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2336,7 +2336,7 @@ public string? Name [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2449,7 +2449,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2678,7 +2678,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2720,7 +2720,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2735,7 +2735,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2833,7 +2833,7 @@ public string? CopyrightLabel [DataMember] public List Structure { - get => _Structure ?? new List(); + get => _Structure ??= []; set { _Structure = value; OnPropertyChanged("Structure"); } } @@ -2847,7 +2847,7 @@ public List Structure [DataMember] public List ImportElement { - get => _ImportElement ?? new List(); + get => _ImportElement ??= []; set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } @@ -2879,7 +2879,7 @@ public IEnumerable? Import [DataMember] public List Const { - get => _Const ?? new List(); + get => _Const ??= []; set { _Const = value; OnPropertyChanged("Const"); } } @@ -2893,7 +2893,7 @@ public List Const [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs index 2c7264c77..a65682cc6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs @@ -503,7 +503,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -605,7 +605,7 @@ public string? Topic [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -690,7 +690,7 @@ public string? Reason [DataMember] public List FilterBy { - get => _FilterBy ?? new List(); + get => _FilterBy ??= []; set { _FilterBy = value; OnPropertyChanged("FilterBy"); } } @@ -747,7 +747,7 @@ public string? Endpoint [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs index 6fe999668..c04ef7278 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs @@ -200,7 +200,7 @@ public Hl7.Fhir.Model.ResourceReference? Focus [DataMember] public List AdditionalContext { - get => _AdditionalContext ?? new List(); + get => _AdditionalContext ??= []; set { _AdditionalContext = value; OnPropertyChanged("AdditionalContext"); } } @@ -391,7 +391,7 @@ public long? EventsSinceSubscriptionStart [DataMember] public List NotificationEvent { - get => _NotificationEvent ?? new List(); + get => _NotificationEvent ??= []; set { _NotificationEvent = value; OnPropertyChanged("NotificationEvent"); } } @@ -450,7 +450,7 @@ public string? Topic [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs index f886bf2d7..38f7a539b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs @@ -196,7 +196,7 @@ public string? Resource [DataMember] public List> SupportedInteractionElement { - get => _SupportedInteractionElement ?? new List>(); + get => _SupportedInteractionElement ??= []; set { _SupportedInteractionElement = value; OnPropertyChanged("SupportedInteractionElement"); } } @@ -923,7 +923,7 @@ public string? FilterDefinition [DataMember] public List> ComparatorElement { - get => _ComparatorElement ?? new List>(); + get => _ComparatorElement ??= []; set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } @@ -957,7 +957,7 @@ public IEnumerable? Comparator [DataMember] public List> ModifierElement { - get => _ModifierElement ?? new List>(); + get => _ModifierElement ??= []; set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } @@ -1141,7 +1141,7 @@ public string? Resource [DataMember] public List IncludeElement { - get => _IncludeElement ?? new List(); + get => _IncludeElement ??= []; set { _IncludeElement = value; OnPropertyChanged("IncludeElement"); } } @@ -1173,7 +1173,7 @@ public IEnumerable? Include [DataMember] public List RevIncludeElement { - get => _RevIncludeElement ?? new List(); + get => _RevIncludeElement ??= []; set { _RevIncludeElement = value; OnPropertyChanged("RevIncludeElement"); } } @@ -1313,7 +1313,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1426,7 +1426,7 @@ public string? Title [DataMember] public List DerivedFromElement { - get => _DerivedFromElement ?? new List(); + get => _DerivedFromElement ??= []; set { _DerivedFromElement = value; OnPropertyChanged("DerivedFromElement"); } } @@ -1573,7 +1573,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1615,7 +1615,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1630,7 +1630,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1797,7 +1797,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List ResourceTrigger { - get => _ResourceTrigger ?? new List(); + get => _ResourceTrigger ??= []; set { _ResourceTrigger = value; OnPropertyChanged("ResourceTrigger"); } } @@ -1811,7 +1811,7 @@ public List ResourceT [DataMember] public List EventTrigger { - get => _EventTrigger ?? new List(); + get => _EventTrigger ??= []; set { _EventTrigger = value; OnPropertyChanged("EventTrigger"); } } @@ -1825,7 +1825,7 @@ public List EventTrigger [DataMember] public List CanFilterBy { - get => _CanFilterBy ?? new List(); + get => _CanFilterBy ??= []; set { _CanFilterBy = value; OnPropertyChanged("CanFilterBy"); } } @@ -1839,7 +1839,7 @@ public List CanFilterBy [DataMember] public List NotificationShape { - get => _NotificationShape ?? new List(); + get => _NotificationShape ??= []; set { _NotificationShape = value; OnPropertyChanged("NotificationShape"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Substance.cs b/src/Hl7.Fhir.R5/Model/Generated/Substance.cs index fc96081d6..38759e4f1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Substance.cs @@ -212,7 +212,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -286,7 +286,7 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -384,7 +384,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs index b6fabb021..50bd8b0b7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs @@ -412,7 +412,7 @@ public string? Description [DataMember] public List File { - get => _File ?? new List(); + get => _File ??= []; set { _File = value; OnPropertyChanged("File"); } } @@ -875,7 +875,7 @@ public Hl7.Fhir.Model.SubstanceDefinition.MolecularWeightComponent? MolecularWei [DataMember] public List Technique { - get => _Technique ?? new List(); + get => _Technique ??= []; set { _Technique = value; OnPropertyChanged("Technique"); } } @@ -891,7 +891,7 @@ public List Technique [DataMember] public List SourceDocument { - get => _SourceDocument ?? new List(); + get => _SourceDocument ??= []; set { _SourceDocument = value; OnPropertyChanged("SourceDocument"); } } @@ -905,7 +905,7 @@ public List SourceDocument [DataMember] public List Representation { - get => _Representation ?? new List(); + get => _Representation ??= []; set { _Representation = value; OnPropertyChanged("Representation"); } } @@ -1283,7 +1283,7 @@ public string? StatusDate [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1299,7 +1299,7 @@ public List Note [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1509,7 +1509,7 @@ public bool? Preferred [DataMember] public List Language { - get => _Language ?? new List(); + get => _Language ??= []; set { _Language = value; OnPropertyChanged("Language"); } } @@ -1524,7 +1524,7 @@ public List Language [DataMember] public List Domain { - get => _Domain ?? new List(); + get => _Domain ??= []; set { _Domain = value; OnPropertyChanged("Domain"); } } @@ -1539,7 +1539,7 @@ public List Domain [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1553,7 +1553,7 @@ public List Jurisdiction [DataMember] public List Synonym { - get => _Synonym ?? new List(); + get => _Synonym ??= []; set { _Synonym = value; OnPropertyChanged("Synonym"); } } @@ -1567,7 +1567,7 @@ public List Synonym [DataMember] public List Translation { - get => _Translation ?? new List(); + get => _Translation ??= []; set { _Translation = value; OnPropertyChanged("Translation"); } } @@ -1581,7 +1581,7 @@ public List Translation [DataMember] public List Official { - get => _Official ?? new List(); + get => _Official ??= []; set { _Official = value; OnPropertyChanged("Official"); } } @@ -1597,7 +1597,7 @@ public List Official [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -2029,7 +2029,7 @@ public Hl7.Fhir.Model.CodeableConcept? Comparator [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -2231,7 +2231,7 @@ public Hl7.Fhir.Model.CodeableConcept? Part [DataMember] public List CountryOfOrigin { - get => _CountryOfOrigin ?? new List(); + get => _CountryOfOrigin ??= []; set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } @@ -2342,7 +2342,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2398,7 +2398,7 @@ public Hl7.Fhir.Model.CodeableConcept? Status [DataMember] public List Classification { - get => _Classification ?? new List(); + get => _Classification ??= []; set { _Classification = value; OnPropertyChanged("Classification"); } } @@ -2427,7 +2427,7 @@ public Hl7.Fhir.Model.CodeableConcept? Domain [DataMember] public List Grade { - get => _Grade ?? new List(); + get => _Grade ??= []; set { _Grade = value; OnPropertyChanged("Grade"); } } @@ -2471,7 +2471,7 @@ public string? Description [DataMember] public List InformationSource { - get => _InformationSource ?? new List(); + get => _InformationSource ??= []; set { _InformationSource = value; OnPropertyChanged("InformationSource"); } } @@ -2485,7 +2485,7 @@ public List InformationSource [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -2501,7 +2501,7 @@ public List Note [DataMember] public List Manufacturer { - get => _Manufacturer ?? new List(); + get => _Manufacturer ??= []; set { _Manufacturer = value; OnPropertyChanged("Manufacturer"); } } @@ -2517,7 +2517,7 @@ public List Manufacturer [DataMember] public List Supplier { - get => _Supplier ?? new List(); + get => _Supplier ??= []; set { _Supplier = value; OnPropertyChanged("Supplier"); } } @@ -2531,7 +2531,7 @@ public List Supplier [DataMember] public List Moiety { - get => _Moiety ?? new List(); + get => _Moiety ??= []; set { _Moiety = value; OnPropertyChanged("Moiety"); } } @@ -2545,7 +2545,7 @@ public List Moiety [DataMember] public List Characterization { - get => _Characterization ?? new List(); + get => _Characterization ??= []; set { _Characterization = value; OnPropertyChanged("Characterization"); } } @@ -2559,7 +2559,7 @@ public List Charac [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -2588,7 +2588,7 @@ public Hl7.Fhir.Model.ResourceReference? ReferenceInformation [DataMember] public List MolecularWeight { - get => _MolecularWeight ?? new List(); + get => _MolecularWeight ??= []; set { _MolecularWeight = value; OnPropertyChanged("MolecularWeight"); } } @@ -2615,7 +2615,7 @@ public Hl7.Fhir.Model.SubstanceDefinition.StructureComponent? Structure [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2629,7 +2629,7 @@ public List Code [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -2643,7 +2643,7 @@ public List Name [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs index 6d37609c5..22b9bc574 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs @@ -203,7 +203,7 @@ public Hl7.Fhir.Model.CodeableConcept? ThreePrime [DataMember] public List Linkage { - get => _Linkage ?? new List(); + get => _Linkage ??= []; set { _Linkage = value; OnPropertyChanged("Linkage"); } } @@ -217,7 +217,7 @@ public List Linkage [DataMember] public List Sugar { - get => _Sugar ?? new List(); + get => _Sugar ??= []; set { _Sugar = value; OnPropertyChanged("Sugar"); } } @@ -796,7 +796,7 @@ public Hl7.Fhir.Model.CodeableConcept? OligoNucleotideType [DataMember] public List Subunit { - get => _Subunit ?? new List(); + get => _Subunit ??= []; set { _Subunit = value; OnPropertyChanged("Subunit"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs index cbd813256..a3704e08a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs @@ -93,7 +93,7 @@ public Hl7.Fhir.Model.CodeableConcept? RatioType [DataMember] public List StartingMaterial { - get => _StartingMaterial ?? new List(); + get => _StartingMaterial ??= []; set { _StartingMaterial = value; OnPropertyChanged("StartingMaterial"); } } @@ -399,7 +399,7 @@ public Hl7.Fhir.Model.CodeableConcept? RepeatUnitAmountType [DataMember] public List RepeatUnit { - get => _RepeatUnit ?? new List(); + get => _RepeatUnit ??= []; set { _RepeatUnit = value; OnPropertyChanged("RepeatUnit"); } } @@ -574,7 +574,7 @@ public int? Amount [DataMember] public List DegreeOfPolymerisation { - get => _DegreeOfPolymerisation ?? new List(); + get => _DegreeOfPolymerisation ??= []; set { _DegreeOfPolymerisation = value; OnPropertyChanged("DegreeOfPolymerisation"); } } @@ -588,7 +588,7 @@ public List Deg [DataMember] public List StructuralRepresentation { - get => _StructuralRepresentation ?? new List(); + get => _StructuralRepresentation ??= []; set { _StructuralRepresentation = value; OnPropertyChanged("StructuralRepresentation"); } } @@ -1104,7 +1104,7 @@ public Hl7.Fhir.Model.CodeableConcept? Geometry [DataMember] public List CopolymerConnectivity { - get => _CopolymerConnectivity ?? new List(); + get => _CopolymerConnectivity ??= []; set { _CopolymerConnectivity = value; OnPropertyChanged("CopolymerConnectivity"); } } @@ -1146,7 +1146,7 @@ public string? Modification [DataMember] public List MonomerSet { - get => _MonomerSet ?? new List(); + get => _MonomerSet ??= []; set { _MonomerSet = value; OnPropertyChanged("MonomerSet"); } } @@ -1160,7 +1160,7 @@ public List MonomerSet [DataMember] public List Repeat { - get => _Repeat ?? new List(); + get => _Repeat ??= []; set { _Repeat = value; OnPropertyChanged("Repeat"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs index 0a71a150b..3fec021cf 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs @@ -424,7 +424,7 @@ public int? NumberOfSubunits [DataMember] public List DisulfideLinkageElement { - get => _DisulfideLinkageElement ?? new List(); + get => _DisulfideLinkageElement ??= []; set { _DisulfideLinkageElement = value; OnPropertyChanged("DisulfideLinkageElement"); } } @@ -456,7 +456,7 @@ public IEnumerable? DisulfideLinkage [DataMember] public List Subunit { - get => _Subunit ?? new List(); + get => _Subunit ??= []; set { _Subunit = value; OnPropertyChanged("Subunit"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs index b854c5e14..c6735a0fa 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs @@ -108,7 +108,7 @@ public Hl7.Fhir.Model.CodeableConcept? Gene [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -242,7 +242,7 @@ public Hl7.Fhir.Model.Identifier? Element [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -443,7 +443,7 @@ public Hl7.Fhir.Model.CodeableConcept? AmountType [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -609,7 +609,7 @@ public string? Comment [DataMember] public List Gene { - get => _Gene ?? new List(); + get => _Gene ??= []; set { _Gene = value; OnPropertyChanged("Gene"); } } @@ -623,7 +623,7 @@ public List Gene [DataMember] public List GeneElement { - get => _GeneElement ?? new List(); + get => _GeneElement ??= []; set { _GeneElement = value; OnPropertyChanged("GeneElement"); } } @@ -637,7 +637,7 @@ public List G [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs index fbf4ffcf1..2b4f8cf98 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs @@ -284,7 +284,7 @@ public string? IntraspecificDescription [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1149,7 +1149,7 @@ public string? OrganismName [DataMember] public List ParentSubstanceId { - get => _ParentSubstanceId ?? new List(); + get => _ParentSubstanceId ??= []; set { _ParentSubstanceId = value; OnPropertyChanged("ParentSubstanceId"); } } @@ -1163,7 +1163,7 @@ public List ParentSubstanceId [DataMember] public List ParentSubstanceNameElement { - get => _ParentSubstanceNameElement ?? new List(); + get => _ParentSubstanceNameElement ??= []; set { _ParentSubstanceNameElement = value; OnPropertyChanged("ParentSubstanceNameElement"); } } @@ -1195,7 +1195,7 @@ public IEnumerable? ParentSubstanceName [DataMember] public List CountryOfOrigin { - get => _CountryOfOrigin ?? new List(); + get => _CountryOfOrigin ??= []; set { _CountryOfOrigin = value; OnPropertyChanged("CountryOfOrigin"); } } @@ -1209,7 +1209,7 @@ public List CountryOfOrigin [DataMember] public List GeographicalLocationElement { - get => _GeographicalLocationElement ?? new List(); + get => _GeographicalLocationElement ??= []; set { _GeographicalLocationElement = value; OnPropertyChanged("GeographicalLocationElement"); } } @@ -1254,7 +1254,7 @@ public Hl7.Fhir.Model.CodeableConcept? DevelopmentStage [DataMember] public List FractionDescription { - get => _FractionDescription ?? new List(); + get => _FractionDescription ??= []; set { _FractionDescription = value; OnPropertyChanged("FractionDescription"); } } @@ -1281,7 +1281,7 @@ public Hl7.Fhir.Model.SubstanceSourceMaterial.OrganismComponent? Organism [DataMember] public List PartDescription { - get => _PartDescription ?? new List(); + get => _PartDescription ??= []; set { _PartDescription = value; OnPropertyChanged("PartDescription"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs index 4af47d8e3..398e05196 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs @@ -248,7 +248,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -264,7 +264,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -280,7 +280,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -353,7 +353,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List SuppliedItem { - get => _SuppliedItem ?? new List(); + get => _SuppliedItem ??= []; set { _SuppliedItem = value; OnPropertyChanged("SuppliedItem"); } } @@ -414,7 +414,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs index dd65e6aec..9c48693ab 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs @@ -237,7 +237,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -283,7 +283,7 @@ public Hl7.Fhir.Model.SupplyRequest.SupplyRequestStatus? Status [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -385,7 +385,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -459,7 +459,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List Supplier { - get => _Supplier ?? new List(); + get => _Supplier ??= []; set { _Supplier = value; OnPropertyChanged("Supplier"); } } @@ -474,7 +474,7 @@ public List Supplier [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Task.cs b/src/Hl7.Fhir.R5/Model/Generated/Task.cs index 0f283fde6..9c7fb3c42 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Task.cs @@ -389,7 +389,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -716,7 +716,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -788,7 +788,7 @@ public string? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -817,7 +817,7 @@ public Hl7.Fhir.Model.Identifier? GroupIdentifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1164,7 +1164,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List RequestedPerformer { - get => _RequestedPerformer ?? new List(); + get => _RequestedPerformer ??= []; set { _RequestedPerformer = value; OnPropertyChanged("RequestedPerformer"); } } @@ -1193,7 +1193,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -1223,7 +1223,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1239,7 +1239,7 @@ public List Reason [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1253,7 +1253,7 @@ public List Insurance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1269,7 +1269,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -1296,7 +1296,7 @@ public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -1310,7 +1310,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs index f2c6438eb..c1fd5a08e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs @@ -429,7 +429,7 @@ public string? Uri [DataMember] public List Version { - get => _Version ?? new List(); + get => _Version ??= []; set { _Version = value; OnPropertyChanged("Version"); } } @@ -693,7 +693,7 @@ public bool? Compositional [DataMember] public List> LanguageElement { - get => _LanguageElement ?? new List>(); + get => _LanguageElement ??= []; set { _LanguageElement = value; OnPropertyChanged("LanguageElement"); } } @@ -725,7 +725,7 @@ public IEnumerable? Language [DataMember] public List Filter { - get => _Filter ?? new List(); + get => _Filter ??= []; set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -739,7 +739,7 @@ public List Filter [DataMember] public List PropertyElement { - get => _PropertyElement ?? new List(); + get => _PropertyElement ??= []; set { _PropertyElement = value; OnPropertyChanged("PropertyElement"); } } @@ -919,7 +919,7 @@ public string? Code [DataMember] public List OpElement { - get => _OpElement ?? new List(); + get => _OpElement ??= []; set { _OpElement = value; OnPropertyChanged("OpElement"); } } @@ -1118,7 +1118,7 @@ public bool? Incomplete [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1736,7 +1736,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1965,7 +1965,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2007,7 +2007,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2022,7 +2022,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2205,7 +2205,7 @@ public bool? LockedDate [DataMember] public List CodeSystem { - get => _CodeSystem ?? new List(); + get => _CodeSystem ??= []; set { _CodeSystem = value; OnPropertyChanged("CodeSystem"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs b/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs index ed509977c..e821fcc1e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs @@ -241,7 +241,7 @@ public int? Sequence [DataMember] public List Scope { - get => _Scope ?? new List(); + get => _Scope ??= []; set { _Scope = value; OnPropertyChanged("Scope"); } } @@ -255,7 +255,7 @@ public List Scope [DataMember] public List Dependency { - get => _Dependency ?? new List(); + get => _Dependency ??= []; set { _Dependency = value; OnPropertyChanged("Dependency"); } } @@ -269,7 +269,7 @@ public List Dependency [DataMember] public List TestRun { - get => _TestRun ?? new List(); + get => _TestRun ??= []; set { _TestRun = value; OnPropertyChanged("TestRun"); } } @@ -283,7 +283,7 @@ public List TestRun [DataMember] public List TestData { - get => _TestData ?? new List(); + get => _TestData ??= []; set { _TestData = value; OnPropertyChanged("TestData"); } } @@ -297,7 +297,7 @@ public List TestData [DataMember] public List Assertion { - get => _Assertion ?? new List(); + get => _Assertion ??= []; set { _Assertion = value; OnPropertyChanged("Assertion"); } } @@ -929,7 +929,7 @@ public partial class AssertionComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -943,7 +943,7 @@ public List Type [DataMember] public List Object { - get => _Object ?? new List(); + get => _Object ??= []; set { _Object = value; OnPropertyChanged("Object"); } } @@ -957,7 +957,7 @@ public List Object [DataMember] public List Result { - get => _Result ?? new List(); + get => _Result ??= []; set { _Result = value; OnPropertyChanged("Result"); } } @@ -1078,7 +1078,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1306,7 +1306,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1348,7 +1348,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1363,7 +1363,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1462,7 +1462,7 @@ public string? CopyrightLabel [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1476,7 +1476,7 @@ public List Category [DataMember] public List Scope { - get => _Scope ?? new List(); + get => _Scope ??= []; set { _Scope = value; OnPropertyChanged("Scope"); } } @@ -1518,7 +1518,7 @@ public string? TestTools [DataMember] public List Dependency { - get => _Dependency ?? new List(); + get => _Dependency ??= []; set { _Dependency = value; OnPropertyChanged("Dependency"); } } @@ -1560,7 +1560,7 @@ public string? ExitCriteria [DataMember] public List TestCase { - get => _TestCase ?? new List(); + get => _TestCase ??= []; set { _TestCase = value; OnPropertyChanged("TestCase"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs index ff2897192..f8ab09af6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs @@ -399,7 +399,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -872,7 +872,7 @@ public string? Detail [DataMember] public List Requirement { - get => _Requirement ?? new List(); + get => _Requirement ??= []; set { _Requirement = value; OnPropertyChanged("Requirement"); } } @@ -1136,7 +1136,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1358,7 +1358,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1741,7 +1741,7 @@ public string? Issued [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1768,7 +1768,7 @@ public Hl7.Fhir.Model.TestReport.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs index 2b41171bd..c63e6918a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs @@ -886,7 +886,7 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -900,7 +900,7 @@ public List Link [DataMember] public List Capability { - get => _Capability ?? new List(); + get => _Capability ??= []; set { _Capability = value; OnPropertyChanged("Capability"); } } @@ -1230,7 +1230,7 @@ public string? Description [DataMember] public List OriginElement { - get => _OriginElement ?? new List(); + get => _OriginElement ??= []; set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } @@ -1290,7 +1290,7 @@ public int? Destination [DataMember] public List LinkElement { - get => _LinkElement ?? new List(); + get => _LinkElement ??= []; set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } @@ -2165,7 +2165,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -2669,7 +2669,7 @@ public string? Params [DataMember] public List RequestHeader { - get => _RequestHeader ?? new List(); + get => _RequestHeader ??= []; set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } @@ -3876,7 +3876,7 @@ public bool? WarningOnly [DataMember] public List Requirement { - get => _Requirement ?? new List(); + get => _Requirement ??= []; set { _Requirement = value; OnPropertyChanged("Requirement"); } } @@ -4329,7 +4329,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -4551,7 +4551,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -4746,7 +4746,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4975,7 +4975,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -5017,7 +5017,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -5032,7 +5032,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -5130,7 +5130,7 @@ public string? CopyrightLabel [DataMember] public List Origin { - get => _Origin ?? new List(); + get => _Origin ??= []; set { _Origin = value; OnPropertyChanged("Origin"); } } @@ -5144,7 +5144,7 @@ public List Origin [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -5171,7 +5171,7 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata [DataMember] public List Scope { - get => _Scope ?? new List(); + get => _Scope ??= []; set { _Scope = value; OnPropertyChanged("Scope"); } } @@ -5185,7 +5185,7 @@ public List Scope [DataMember] public List Fixture { - get => _Fixture ?? new List(); + get => _Fixture ??= []; set { _Fixture = value; OnPropertyChanged("Fixture"); } } @@ -5199,7 +5199,7 @@ public List Fixture [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -5231,7 +5231,7 @@ public IEnumerable? Profile [DataMember] public List Variable { - get => _Variable ?? new List(); + get => _Variable ??= []; set { _Variable = value; OnPropertyChanged("Variable"); } } @@ -5258,7 +5258,7 @@ public Hl7.Fhir.Model.TestScript.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs index f672ebcbc..9e8b8d67e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs @@ -613,7 +613,7 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get => _DayOfWeekElement ?? new List>(); + get => _DayOfWeekElement ??= []; set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } @@ -645,7 +645,7 @@ public IEnumerable? DayOfWeek [DataMember] public List TimeOfDayElement { - get => _TimeOfDayElement ?? new List(); + get => _TimeOfDayElement ??= []; set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } @@ -679,7 +679,7 @@ public IEnumerable? TimeOfDay [DataMember] public List> WhenElement { - get => _WhenElement ?? new List>(); + get => _WhenElement ??= []; set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } @@ -926,7 +926,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get => _EventElement ?? new List(); + get => _EventElement ??= []; set { _EventElement = value; OnPropertyChanged("EventElement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Transport.cs b/src/Hl7.Fhir.R5/Model/Generated/Transport.cs index 0c65e1412..89b243e6c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Transport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Transport.cs @@ -239,7 +239,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -566,7 +566,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -638,7 +638,7 @@ public string? InstantiatesUri [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -667,7 +667,7 @@ public Hl7.Fhir.Model.Identifier? GroupIdentifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -973,7 +973,7 @@ public Hl7.Fhir.Model.ResourceReference? Requester [DataMember] public List PerformerType { - get => _PerformerType ?? new List(); + get => _PerformerType ??= []; set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } @@ -1019,7 +1019,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -1033,7 +1033,7 @@ public List Insurance [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1049,7 +1049,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -1076,7 +1076,7 @@ public Hl7.Fhir.Model.Transport.RestrictionComponent? Restriction [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -1090,7 +1090,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs index 0298f26d2..0c9473839 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs @@ -245,7 +245,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs index 497087ceb..42b4cafa8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs @@ -148,7 +148,7 @@ public Hl7.Fhir.Model.ResourceReference? Who [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -163,7 +163,7 @@ public List Type [DataMember] public List CommunicationMethod { - get => _CommunicationMethod ?? new List(); + get => _CommunicationMethod ??= []; set { _CommunicationMethod = value; OnPropertyChanged("CommunicationMethod"); } } @@ -234,7 +234,7 @@ public Hl7.Fhir.Model.CodeableConcept? CanPushUpdates [DataMember] public List PushTypeAvailable { - get => _PushTypeAvailable ?? new List(); + get => _PushTypeAvailable ??= []; set { _PushTypeAvailable = value; OnPropertyChanged("PushTypeAvailable"); } } @@ -805,7 +805,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -819,7 +819,7 @@ public List Target [DataMember] public List TargetLocationElement { - get => _TargetLocationElement ?? new List(); + get => _TargetLocationElement ??= []; set { _TargetLocationElement = value; OnPropertyChanged("TargetLocationElement"); } } @@ -939,7 +939,7 @@ public Hl7.Fhir.Model.CodeableConcept? ValidationType [DataMember] public List ValidationProcess { - get => _ValidationProcess ?? new List(); + get => _ValidationProcess ??= []; set { _ValidationProcess = value; OnPropertyChanged("ValidationProcess"); } } @@ -1036,7 +1036,7 @@ public Hl7.Fhir.Model.CodeableConcept? FailureAction [DataMember] public List PrimarySource { - get => _PrimarySource ?? new List(); + get => _PrimarySource ??= []; set { _PrimarySource = value; OnPropertyChanged("PrimarySource"); } } @@ -1063,7 +1063,7 @@ public Hl7.Fhir.Model.VerificationResult.AttestationComponent? Attestation [DataMember] public List Validator { - get => _Validator ?? new List(); + get => _Validator ??= []; set { _Validator = value; OnPropertyChanged("Validator"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs index 473805ca2..7b69b4c91 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs @@ -96,7 +96,7 @@ public Hl7.Fhir.Model.DataType? Address [DataMember] public List AdditionalInfoElement { - get => _AdditionalInfoElement ?? new List(); + get => _AdditionalInfoElement ??= []; set { _AdditionalInfoElement = value; OnPropertyChanged("AdditionalInfoElement"); } } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs index 509bdf614..9c4778619 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs @@ -272,7 +272,7 @@ public int? Axis [DataMember] public List Prism { - get => _Prism ?? new List(); + get => _Prism ??= []; set { _Prism = value; OnPropertyChanged("Prism"); } } @@ -467,7 +467,7 @@ public string? Brand [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -805,7 +805,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -955,7 +955,7 @@ public Hl7.Fhir.Model.ResourceReference? Prescriber [DataMember] public List LensSpecification { - get => _LensSpecification ?? new List(); + get => _LensSpecification ??= []; set { _LensSpecification = value; OnPropertyChanged("LensSpecification"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Account.cs b/src/Hl7.Fhir.STU3/Model/Generated/Account.cs index 5536a4cdc..455dcdeee 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Account.cs @@ -382,7 +382,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -522,7 +522,7 @@ public Hl7.Fhir.Model.Money? Balance [DataMember] public List Coverage { - get => _Coverage ?? new List(); + get => _Coverage ??= []; set { _Coverage = value; OnPropertyChanged("Coverage"); } } @@ -579,7 +579,7 @@ public string? Description [DataMember] public List Guarantor { - get => _Guarantor ?? new List(); + get => _Guarantor ??= []; set { _Guarantor = value; OnPropertyChanged("Guarantor"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs index 2face56f0..ef9e12648 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs @@ -445,7 +445,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -811,7 +811,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -826,7 +826,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -841,7 +841,7 @@ public List Jurisdiction [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -855,7 +855,7 @@ public List Topic [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -869,7 +869,7 @@ public List Contributor [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -911,7 +911,7 @@ public string? Copyright [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -927,7 +927,7 @@ public List RelatedArtifact [DataMember] public List Library { - get => _Library ?? new List(); + get => _Library ??= []; set { _Library = value; OnPropertyChanged("Library"); } } @@ -1015,7 +1015,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1059,7 +1059,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } @@ -1074,7 +1074,7 @@ public List Dosage [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -1103,7 +1103,7 @@ public Hl7.Fhir.Model.ResourceReference? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs index a18ff620f..0607ab89e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs @@ -221,7 +221,7 @@ public string? Text [DataMember] public List LineElement { - get => _LineElement ?? new List(); + get => _LineElement ??= []; set { _LineElement = value; OnPropertyChanged("LineElement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs index 88c8dbbd0..ea4b9b1fb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs @@ -526,7 +526,7 @@ public string? Date [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } @@ -641,7 +641,7 @@ public string? Description [DataMember] public List SuspectEntity { - get => _SuspectEntity ?? new List(); + get => _SuspectEntity ??= []; set { _SuspectEntity = value; OnPropertyChanged("SuspectEntity"); } } @@ -657,7 +657,7 @@ public List SuspectEntity [DataMember] public List SubjectMedicalHistory { - get => _SubjectMedicalHistory ?? new List(); + get => _SubjectMedicalHistory ??= []; set { _SubjectMedicalHistory = value; OnPropertyChanged("SubjectMedicalHistory"); } } @@ -673,7 +673,7 @@ public List SubjectMedicalHistory [DataMember] public List ReferenceDocument { - get => _ReferenceDocument ?? new List(); + get => _ReferenceDocument ??= []; set { _ReferenceDocument = value; OnPropertyChanged("ReferenceDocument"); } } @@ -689,7 +689,7 @@ public List ReferenceDocument [DataMember] public List Study { - get => _Study ?? new List(); + get => _Study ??= []; set { _Study = value; OnPropertyChanged("Study"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs index 3cada58a1..264db83d2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs @@ -276,7 +276,7 @@ public Hl7.Fhir.Model.CodeableConcept? Substance [DataMember] public List Manifestation { - get => _Manifestation ?? new List(); + get => _Manifestation ??= []; set { _Manifestation = value; OnPropertyChanged("Manifestation"); } } @@ -390,7 +390,7 @@ public Hl7.Fhir.Model.CodeableConcept? ExposureRoute [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -519,7 +519,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -626,7 +626,7 @@ public Hl7.Fhir.Model.AllergyIntolerance.AllergyIntoleranceType? Type [DataMember] public List> CategoryElement { - get => _CategoryElement ?? new List>(); + get => _CategoryElement ??= []; set { _CategoryElement = value; OnPropertyChanged("CategoryElement"); } } @@ -819,7 +819,7 @@ public string? LastOccurrence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -833,7 +833,7 @@ public List Note [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs b/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs index 82ae2eb11..ce54bf14c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs @@ -170,7 +170,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -348,7 +348,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -408,7 +408,7 @@ public Hl7.Fhir.Model.CodeableConcept? ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -423,7 +423,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -452,7 +452,7 @@ public Hl7.Fhir.Model.CodeableConcept? AppointmentType [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -468,7 +468,7 @@ public List Reason [DataMember] public List Indication { - get => _Indication ?? new List(); + get => _Indication ??= []; set { _Indication = value; OnPropertyChanged("Indication"); } } @@ -540,7 +540,7 @@ public string? Description [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -640,7 +640,7 @@ public int? MinutesDuration [DataMember] public List Slot { - get => _Slot ?? new List(); + get => _Slot ??= []; set { _Slot = value; OnPropertyChanged("Slot"); } } @@ -712,7 +712,7 @@ public string? Comment [DataMember] public List IncomingReferral { - get => _IncomingReferral ?? new List(); + get => _IncomingReferral ??= []; set { _IncomingReferral = value; OnPropertyChanged("IncomingReferral"); } } @@ -726,7 +726,7 @@ public List IncomingReferral [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -740,7 +740,7 @@ public List Participant [DataMember] public List RequestedPeriod { - get => _RequestedPeriod ?? new List(); + get => _RequestedPeriod ??= []; set { _RequestedPeriod = value; OnPropertyChanged("RequestedPeriod"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs index a50dd282a..2dcef6eb1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs @@ -67,7 +67,7 @@ public partial class AppointmentResponse : Hl7.Fhir.Model.DomainResource, IIdent [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -154,7 +154,7 @@ public DateTimeOffset? End [DataMember] public List ParticipantType { - get => _ParticipantType ?? new List(); + get => _ParticipantType ??= []; set { _ParticipantType = value; OnPropertyChanged("ParticipantType"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs index 3daf1a325..4dc497a47 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs @@ -204,7 +204,7 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -346,7 +346,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -406,7 +406,7 @@ public Hl7.Fhir.Model.AuditEvent.NetworkComponent? Network [DataMember] public List PurposeOfUse { - get => _PurposeOfUse ?? new List(); + get => _PurposeOfUse ??= []; set { _PurposeOfUse = value; OnPropertyChanged("PurposeOfUse"); } } @@ -775,7 +775,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -956,7 +956,7 @@ public Hl7.Fhir.Model.Coding? Lifecycle [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -1054,7 +1054,7 @@ public byte[]? Query [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -1370,7 +1370,7 @@ public Hl7.Fhir.Model.Coding? Type [DataMember] public List Subtype { - get => _Subtype ?? new List(); + get => _Subtype ??= []; set { _Subtype = value; OnPropertyChanged("Subtype"); } } @@ -1502,7 +1502,7 @@ public string? OutcomeDesc [DataMember] public List PurposeOfEvent { - get => _PurposeOfEvent ?? new List(); + get => _PurposeOfEvent ??= []; set { _PurposeOfEvent = value; OnPropertyChanged("PurposeOfEvent"); } } @@ -1516,7 +1516,7 @@ public List PurposeOfEvent [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -1544,7 +1544,7 @@ public Hl7.Fhir.Model.AuditEvent.SourceComponent? Source [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs b/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs index 333840422..f01a79a7e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs @@ -70,7 +70,7 @@ public partial class Basic : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs b/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs index 87f054665..fb4241117 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs @@ -70,7 +70,7 @@ public partial class BodySite : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -127,7 +127,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Qualifier { - get => _Qualifier ?? new List(); + get => _Qualifier ??= []; set { _Qualifier = value; OnPropertyChanged("Qualifier"); } } @@ -169,7 +169,7 @@ public string? Description [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs index d5d1ca517..a4bda6768 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs @@ -838,7 +838,7 @@ public Hl7.Fhir.Model.CapabilityStatement.SecurityComponent? Security [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -852,7 +852,7 @@ public List Resource [DataMember] public List Interaction { - get => _Interaction ?? new List(); + get => _Interaction ??= []; set { _Interaction = value; OnPropertyChanged("Interaction"); } } @@ -866,7 +866,7 @@ public List Inter [DataMember] public List SearchParam { - get => _SearchParam ?? new List(); + get => _SearchParam ??= []; set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } @@ -880,7 +880,7 @@ public List SearchParam [DataMember] public List Operation { - get => _Operation ?? new List(); + get => _Operation ??= []; set { _Operation = value; OnPropertyChanged("Operation"); } } @@ -894,7 +894,7 @@ public List Operation [DataMember] public List CompartmentElement { - get => _CompartmentElement ?? new List(); + get => _CompartmentElement ??= []; set { _CompartmentElement = value; OnPropertyChanged("CompartmentElement"); } } @@ -1095,7 +1095,7 @@ public bool? Cors [DataMember] public List Service { - get => _Service ?? new List(); + get => _Service ??= []; set { _Service = value; OnPropertyChanged("Service"); } } @@ -1137,7 +1137,7 @@ public string? Description [DataMember] public List Certificate { - get => _Certificate ?? new List(); + get => _Certificate ??= []; set { _Certificate = value; OnPropertyChanged("Certificate"); } } @@ -1470,7 +1470,7 @@ public string? Documentation [DataMember] public List Interaction { - get => _Interaction ?? new List(); + get => _Interaction ??= []; set { _Interaction = value; OnPropertyChanged("Interaction"); } } @@ -1688,7 +1688,7 @@ public Hl7.Fhir.Model.CapabilityStatement.ConditionalDeleteStatus? ConditionalDe [DataMember] public List> ReferencePolicyElement { - get => _ReferencePolicyElement ?? new List>(); + get => _ReferencePolicyElement ??= []; set { _ReferencePolicyElement = value; OnPropertyChanged("ReferencePolicyElement"); } } @@ -1720,7 +1720,7 @@ public IEnumerable? [DataMember] public List SearchIncludeElement { - get => _SearchIncludeElement ?? new List(); + get => _SearchIncludeElement ??= []; set { _SearchIncludeElement = value; OnPropertyChanged("SearchIncludeElement"); } } @@ -1752,7 +1752,7 @@ public IEnumerable? SearchInclude [DataMember] public List SearchRevIncludeElement { - get => _SearchRevIncludeElement ?? new List(); + get => _SearchRevIncludeElement ??= []; set { _SearchRevIncludeElement = value; OnPropertyChanged("SearchRevIncludeElement"); } } @@ -1784,7 +1784,7 @@ public IEnumerable? SearchRevInclude [DataMember] public List SearchParam { - get => _SearchParam ?? new List(); + get => _SearchParam ??= []; set { _SearchParam = value; OnPropertyChanged("SearchParam"); } } @@ -2643,7 +2643,7 @@ public partial class MessagingComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -2713,7 +2713,7 @@ public string? Documentation [DataMember] public List SupportedMessage { - get => _SupportedMessage ?? new List(); + get => _SupportedMessage ??= []; set { _SupportedMessage = value; OnPropertyChanged("SupportedMessage"); } } @@ -2727,7 +2727,7 @@ public List Suppor [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -3799,7 +3799,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -3841,7 +3841,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -3856,7 +3856,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -3957,7 +3957,7 @@ public Hl7.Fhir.Model.CapabilityStatement.CapabilityStatementKind? Kind [DataMember] public List InstantiatesElement { - get => _InstantiatesElement ?? new List(); + get => _InstantiatesElement ??= []; set { _InstantiatesElement = value; OnPropertyChanged("InstantiatesElement"); } } @@ -4076,7 +4076,7 @@ public Hl7.Fhir.Model.CapabilityStatement.UnknownContentCode? AcceptUnknown [DataMember] public List FormatElement { - get => _FormatElement ?? new List(); + get => _FormatElement ??= []; set { _FormatElement = value; OnPropertyChanged("FormatElement"); } } @@ -4109,7 +4109,7 @@ public IEnumerable? Format [DataMember] public List PatchFormatElement { - get => _PatchFormatElement ?? new List(); + get => _PatchFormatElement ??= []; set { _PatchFormatElement = value; OnPropertyChanged("PatchFormatElement"); } } @@ -4141,7 +4141,7 @@ public IEnumerable? PatchFormat [DataMember] public List ImplementationGuideElement { - get => _ImplementationGuideElement ?? new List(); + get => _ImplementationGuideElement ??= []; set { _ImplementationGuideElement = value; OnPropertyChanged("ImplementationGuideElement"); } } @@ -4175,7 +4175,7 @@ public IEnumerable? ImplementationGuide [DataMember] public List Profile { - get => _Profile ?? new List(); + get => _Profile ??= []; set { _Profile = value; OnPropertyChanged("Profile"); } } @@ -4189,7 +4189,7 @@ public List Profile [DataMember] public List Rest { - get => _Rest ?? new List(); + get => _Rest ??= []; set { _Rest = value; OnPropertyChanged("Rest"); } } @@ -4203,7 +4203,7 @@ public List Rest [DataMember] public List Messaging { - get => _Messaging ?? new List(); + get => _Messaging ??= []; set { _Messaging = value; OnPropertyChanged("Messaging"); } } @@ -4217,7 +4217,7 @@ public List Messaging [DataMember] public List Document { - get => _Document ?? new List(); + get => _Document ??= []; set { _Document = value; OnPropertyChanged("Document"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs index 5bc0335ac..968a1e8d4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs @@ -225,7 +225,7 @@ public partial class ActivityComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List OutcomeCodeableConcept { - get => _OutcomeCodeableConcept ?? new List(); + get => _OutcomeCodeableConcept ??= []; set { _OutcomeCodeableConcept = value; OnPropertyChanged("OutcomeCodeableConcept"); } } @@ -241,7 +241,7 @@ public List OutcomeCodeableConcept [DataMember] public List OutcomeReference { - get => _OutcomeReference ?? new List(); + get => _OutcomeReference ??= []; set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } @@ -255,7 +255,7 @@ public List OutcomeReference [DataMember] public List Progress { - get => _Progress ?? new List(); + get => _Progress ??= []; set { _Progress = value; OnPropertyChanged("Progress"); } } @@ -454,7 +454,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -470,7 +470,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -486,7 +486,7 @@ public List ReasonReference [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -619,7 +619,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -900,7 +900,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -916,7 +916,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -932,7 +932,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -948,7 +948,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -964,7 +964,7 @@ public List Replaces [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1041,7 +1041,7 @@ public Hl7.Fhir.Model.CarePlan.CarePlanIntent? Intent [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1157,7 +1157,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1173,7 +1173,7 @@ public List Author [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -1189,7 +1189,7 @@ public List CareTeam [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -1205,7 +1205,7 @@ public List Addresses [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -1221,7 +1221,7 @@ public List SupportingInfo [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -1235,7 +1235,7 @@ public List Goal [DataMember] public List Activity { - get => _Activity ?? new List(); + get => _Activity ??= []; set { _Activity = value; OnPropertyChanged("Activity"); } } @@ -1249,7 +1249,7 @@ public List Activity [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs index 6d9183ed5..cf5fd029a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs @@ -271,7 +271,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -316,7 +316,7 @@ public Hl7.Fhir.Model.CareTeam.CareTeamStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -401,7 +401,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -416,7 +416,7 @@ public List Participant [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -432,7 +432,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -448,7 +448,7 @@ public List ReasonReference [DataMember] public List ManagingOrganization { - get => _ManagingOrganization ?? new List(); + get => _ManagingOrganization ??= []; set { _ManagingOrganization = value; OnPropertyChanged("ManagingOrganization"); } } @@ -462,7 +462,7 @@ public List ManagingOrganization [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs index 7d02b0c2a..9a137c1d8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs @@ -251,7 +251,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List DefinitionElement { - get => _DefinitionElement ?? new List(); + get => _DefinitionElement ??= []; set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } @@ -316,7 +316,7 @@ public Hl7.Fhir.Model.ChargeItem.ChargeItemStatus? Status [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -391,7 +391,7 @@ public Hl7.Fhir.Model.DataType? Occurrence [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -449,7 +449,7 @@ public Hl7.Fhir.Model.Quantity? Quantity [DataMember] public List Bodysite { - get => _Bodysite ?? new List(); + get => _Bodysite ??= []; set { _Bodysite = value; OnPropertyChanged("Bodysite"); } } @@ -576,7 +576,7 @@ public string? EnteredDate [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -592,7 +592,7 @@ public List Reason [DataMember] public List Service { - get => _Service ?? new List(); + get => _Service ??= []; set { _Service = value; OnPropertyChanged("Service"); } } @@ -608,7 +608,7 @@ public List Service [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -622,7 +622,7 @@ public List Account [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -638,7 +638,7 @@ public List Note [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs index 3a5a45f8d..730b00c98 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs @@ -883,7 +883,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1287,7 +1287,7 @@ public string? BusinessArrangement [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1643,7 +1643,7 @@ public int? Sequence [DataMember] public List CareTeamLinkIdElement { - get => _CareTeamLinkIdElement ?? new List(); + get => _CareTeamLinkIdElement ??= []; set { _CareTeamLinkIdElement = value; OnPropertyChanged("CareTeamLinkIdElement"); } } @@ -1675,7 +1675,7 @@ public IEnumerable? CareTeamLinkId [DataMember] public List DiagnosisLinkIdElement { - get => _DiagnosisLinkIdElement ?? new List(); + get => _DiagnosisLinkIdElement ??= []; set { _DiagnosisLinkIdElement = value; OnPropertyChanged("DiagnosisLinkIdElement"); } } @@ -1707,7 +1707,7 @@ public IEnumerable? DiagnosisLinkId [DataMember] public List ProcedureLinkIdElement { - get => _ProcedureLinkIdElement ?? new List(); + get => _ProcedureLinkIdElement ??= []; set { _ProcedureLinkIdElement = value; OnPropertyChanged("ProcedureLinkIdElement"); } } @@ -1739,7 +1739,7 @@ public IEnumerable? ProcedureLinkId [DataMember] public List InformationLinkIdElement { - get => _InformationLinkIdElement ?? new List(); + get => _InformationLinkIdElement ??= []; set { _InformationLinkIdElement = value; OnPropertyChanged("InformationLinkIdElement"); } } @@ -1814,7 +1814,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1829,7 +1829,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1944,7 +1944,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1973,7 +1973,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -1989,7 +1989,7 @@ public List SubSite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -2003,7 +2003,7 @@ public List Encounter [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2346,7 +2346,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2361,7 +2361,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2444,7 +2444,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2458,7 +2458,7 @@ public List Udi [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -2720,7 +2720,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2735,7 +2735,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2818,7 +2818,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2983,7 +2983,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -3042,7 +3042,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List SubType { - get => _SubType ?? new List(); + get => _SubType ??= []; set { _SubType = value; OnPropertyChanged("SubType"); } } @@ -3230,7 +3230,7 @@ public Hl7.Fhir.Model.CodeableConcept? FundsReserve [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -3317,7 +3317,7 @@ public Hl7.Fhir.Model.ResourceReference? Facility [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -3331,7 +3331,7 @@ public List CareTeam [DataMember] public List Information { - get => _Information ?? new List(); + get => _Information ??= []; set { _Information = value; OnPropertyChanged("Information"); } } @@ -3345,7 +3345,7 @@ public List Information [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -3359,7 +3359,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -3373,7 +3373,7 @@ public List Procedure [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -3426,7 +3426,7 @@ public Hl7.Fhir.Model.Period? Hospitalization [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs index ada8e095d..0339f7ab4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs @@ -115,7 +115,7 @@ public int? SequenceLinkId [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -147,7 +147,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -161,7 +161,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -482,7 +482,7 @@ public int? SequenceLinkId [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -514,7 +514,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -528,7 +528,7 @@ public List Adjudication [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -675,7 +675,7 @@ public int? SequenceLinkId [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -707,7 +707,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -816,7 +816,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SequenceLinkIdElement { - get => _SequenceLinkIdElement ?? new List(); + get => _SequenceLinkIdElement ??= []; set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } @@ -891,7 +891,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -918,7 +918,7 @@ public Hl7.Fhir.Model.Money? Fee [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -950,7 +950,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -964,7 +964,7 @@ public List Adjudication [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -1170,7 +1170,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1197,7 +1197,7 @@ public Hl7.Fhir.Model.Money? Fee [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -1229,7 +1229,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2084,7 +2084,7 @@ public string? BusinessArrangement [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -2237,7 +2237,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2440,7 +2440,7 @@ public Hl7.Fhir.Model.CodeableConcept? PayeeType [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -2454,7 +2454,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -2468,7 +2468,7 @@ public List AddItem [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } @@ -2562,7 +2562,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -2578,7 +2578,7 @@ public List ProcessNote [DataMember] public List CommunicationRequest { - get => _CommunicationRequest ?? new List(); + get => _CommunicationRequest ??= []; set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } @@ -2592,7 +2592,7 @@ public List CommunicationRequest [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs index c3094816a..f0af6e8ca 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs @@ -131,7 +131,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -347,7 +347,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -540,7 +540,7 @@ public Hl7.Fhir.Model.ResourceReference? Previous [DataMember] public List Problem { - get => _Problem ?? new List(); + get => _Problem ??= []; set { _Problem = value; OnPropertyChanged("Problem"); } } @@ -554,7 +554,7 @@ public List Problem [DataMember] public List Investigation { - get => _Investigation ?? new List(); + get => _Investigation ??= []; set { _Investigation = value; OnPropertyChanged("Investigation"); } } @@ -568,7 +568,7 @@ public List Investigat [DataMember] public List ProtocolElement { - get => _ProtocolElement ?? new List(); + get => _ProtocolElement ??= []; set { _ProtocolElement = value; OnPropertyChanged("ProtocolElement"); } } @@ -628,7 +628,7 @@ public string? Summary [DataMember] public List Finding { - get => _Finding ?? new List(); + get => _Finding ??= []; set { _Finding = value; OnPropertyChanged("Finding"); } } @@ -643,7 +643,7 @@ public List Finding [DataMember] public List PrognosisCodeableConcept { - get => _PrognosisCodeableConcept ?? new List(); + get => _PrognosisCodeableConcept ??= []; set { _PrognosisCodeableConcept = value; OnPropertyChanged("PrognosisCodeableConcept"); } } @@ -659,7 +659,7 @@ public List PrognosisCodeableConcept [DataMember] public List PrognosisReference { - get => _PrognosisReference ?? new List(); + get => _PrognosisReference ??= []; set { _PrognosisReference = value; OnPropertyChanged("PrognosisReference"); } } @@ -675,7 +675,7 @@ public List PrognosisReference [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -689,7 +689,7 @@ public List Action [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs index afc131048..a062c1800 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs @@ -259,7 +259,7 @@ public string? Description [DataMember] public List> OperatorElement { - get => _OperatorElement ?? new List>(); + get => _OperatorElement ??= []; set { _OperatorElement = value; OnPropertyChanged("OperatorElement"); } } @@ -730,7 +730,7 @@ public string? Definition [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -744,7 +744,7 @@ public List Designation [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -758,7 +758,7 @@ public List Property [DataMember] public List Concept { - get => _Concept ?? new List(); + get => _Concept ??= []; set { _Concept = value; OnPropertyChanged("Concept"); } } @@ -1416,7 +1416,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1458,7 +1458,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1473,7 +1473,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1744,7 +1744,7 @@ public int? Count [DataMember] public List Filter { - get => _Filter ?? new List(); + get => _Filter ??= []; set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -1758,7 +1758,7 @@ public List Filter [DataMember] public List Property { - get => _Property ?? new List(); + get => _Property ??= []; set { _Property = value; OnPropertyChanged("Property"); } } @@ -1772,7 +1772,7 @@ public List Property [DataMember] public List Concept { - get => _Concept ?? new List(); + get => _Concept ??= []; set { _Concept = value; OnPropertyChanged("Concept"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs b/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs index a430a205a..f9f0ab689 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs @@ -164,7 +164,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -180,7 +180,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -196,7 +196,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -212,7 +212,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -300,7 +300,7 @@ public Hl7.Fhir.Model.CodeableConcept? NotDoneReason [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -315,7 +315,7 @@ public List Category [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -346,7 +346,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -362,7 +362,7 @@ public List Recipient [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -463,7 +463,7 @@ public Hl7.Fhir.Model.ResourceReference? Sender [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -479,7 +479,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -493,7 +493,7 @@ public List ReasonReference [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -507,7 +507,7 @@ public List Payload [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs index 643f90c98..9e4178a78 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs @@ -281,7 +281,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -297,7 +297,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -313,7 +313,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -372,7 +372,7 @@ public Hl7.Fhir.Model.RequestStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -417,7 +417,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List Medium { - get => _Medium ?? new List(); + get => _Medium ??= []; set { _Medium = value; OnPropertyChanged("Medium"); } } @@ -448,7 +448,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -464,7 +464,7 @@ public List Recipient [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -493,7 +493,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List Payload { - get => _Payload ?? new List(); + get => _Payload ??= []; set { _Payload = value; OnPropertyChanged("Payload"); } } @@ -579,7 +579,7 @@ public Hl7.Fhir.Model.CommunicationRequest.RequesterComponent? Requester [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -595,7 +595,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -609,7 +609,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs index 8501a9ebb..6bb2f3217 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs @@ -118,7 +118,7 @@ public Hl7.Fhir.Model.ResourceType? Code [DataMember] public List ParamElement { - get => _ParamElement ?? new List(); + get => _ParamElement ??= []; set { _ParamElement = value; OnPropertyChanged("ParamElement"); } } @@ -458,7 +458,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -528,7 +528,7 @@ public string? Purpose [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -543,7 +543,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -617,7 +617,7 @@ public bool? Search [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs index e20101fc4..07d512345 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs @@ -187,7 +187,7 @@ public partial class AttesterComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> ModeElement { - get => _ModeElement ?? new List>(); + get => _ModeElement ??= []; set { _ModeElement = value; OnPropertyChanged("ModeElement"); } } @@ -494,7 +494,7 @@ public partial class EventComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -523,7 +523,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -733,7 +733,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } @@ -761,7 +761,7 @@ public Hl7.Fhir.Model.CodeableConcept? EmptyReason [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } @@ -1034,7 +1034,7 @@ public string? Date [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -1107,7 +1107,7 @@ public Hl7.Fhir.Model.Composition.ConfidentialityClassification? Confidentiality [DataMember] public List Attester { - get => _Attester ?? new List(); + get => _Attester ??= []; set { _Attester = value; OnPropertyChanged("Attester"); } } @@ -1136,7 +1136,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -1150,7 +1150,7 @@ public List RelatesTo [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -1164,7 +1164,7 @@ public List Event [DataMember] public List Section { - get => _Section ?? new List(); + get => _Section ??= []; set { _Section = value; OnPropertyChanged("Section"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs index 7e3a2622c..8714ae14e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs @@ -296,7 +296,7 @@ public string? TargetVersion [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -502,7 +502,7 @@ public string? Display [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -726,7 +726,7 @@ public string? Comment [DataMember] public List DependsOn { - get => _DependsOn ?? new List(); + get => _DependsOn ??= []; set { _DependsOn = value; OnPropertyChanged("DependsOn"); } } @@ -740,7 +740,7 @@ public List DependsOn [DataMember] public List Product { - get => _Product ?? new List(); + get => _Product ??= []; set { _Product = value; OnPropertyChanged("Product"); } } @@ -1538,7 +1538,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1580,7 +1580,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1595,7 +1595,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1697,7 +1697,7 @@ public Hl7.Fhir.Model.DataType? Target [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs index 3c1b78288..294bec4b1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs @@ -188,7 +188,7 @@ public Hl7.Fhir.Model.CodeableConcept? Summary [DataMember] public List Assessment { - get => _Assessment ?? new List(); + get => _Assessment ??= []; set { _Assessment = value; OnPropertyChanged("Assessment"); } } @@ -290,7 +290,7 @@ public partial class EvidenceComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -306,7 +306,7 @@ public List Code [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -390,7 +390,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -465,7 +465,7 @@ public Hl7.Fhir.Model.Condition.ConditionVerificationStatus? VerificationStatus [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -508,7 +508,7 @@ public Hl7.Fhir.Model.CodeableConcept? Code [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -639,7 +639,7 @@ public Hl7.Fhir.Model.Condition.StageComponent? Stage [DataMember] public List Evidence { - get => _Evidence ?? new List(); + get => _Evidence ??= []; set { _Evidence = value; OnPropertyChanged("Evidence"); } } @@ -653,7 +653,7 @@ public List Evidence [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs index 3b830a7c4..a5e9abf3c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs @@ -625,7 +625,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -640,7 +640,7 @@ public List Actor [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -655,7 +655,7 @@ public List Action [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -670,7 +670,7 @@ public List SecurityLabel [DataMember] public List Purpose { - get => _Purpose ?? new List(); + get => _Purpose ??= []; set { _Purpose = value; OnPropertyChanged("Purpose"); } } @@ -685,7 +685,7 @@ public List Purpose [DataMember] public List Class { - get => _Class ?? new List(); + get => _Class ??= []; set { _Class = value; OnPropertyChanged("Class"); } } @@ -700,7 +700,7 @@ public List Class [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -727,7 +727,7 @@ public Hl7.Fhir.Model.Period? DataPeriod [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } @@ -1178,7 +1178,7 @@ public Hl7.Fhir.Model.Consent.ConsentState? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -1251,7 +1251,7 @@ public string? DateTime [DataMember] public List ConsentingParty { - get => _ConsentingParty ?? new List(); + get => _ConsentingParty ??= []; set { _ConsentingParty = value; OnPropertyChanged("ConsentingParty"); } } @@ -1265,7 +1265,7 @@ public List ConsentingParty [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } @@ -1280,7 +1280,7 @@ public List Actor [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1296,7 +1296,7 @@ public List Action [DataMember] public List Organization { - get => _Organization ?? new List(); + get => _Organization ??= []; set { _Organization = value; OnPropertyChanged("Organization"); } } @@ -1326,7 +1326,7 @@ public Hl7.Fhir.Model.DataType? Source [DataMember] public List Policy { - get => _Policy ?? new List(); + get => _Policy ??= []; set { _Policy = value; OnPropertyChanged("Policy"); } } @@ -1369,7 +1369,7 @@ public string? PolicyRule [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -1384,7 +1384,7 @@ public List SecurityLabel [DataMember] public List Purpose { - get => _Purpose ?? new List(); + get => _Purpose ??= []; set { _Purpose = value; OnPropertyChanged("Purpose"); } } @@ -1411,7 +1411,7 @@ public Hl7.Fhir.Model.Period? DataPeriod [DataMember] public List Data { - get => _Data ?? new List(); + get => _Data ??= []; set { _Data = value; OnPropertyChanged("Data"); } } @@ -1425,7 +1425,7 @@ public List Data [DataMember] public List Except { - get => _Except ?? new List(); + get => _Except ??= []; set { _Except = value; OnPropertyChanged("Except"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs index b897ae0c1..2f4823f6e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs @@ -205,7 +205,7 @@ public Hl7.Fhir.Model.ResourceReference? Actor [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -338,7 +338,7 @@ public Hl7.Fhir.Model.ResourceReference? Party [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } @@ -820,7 +820,7 @@ public Hl7.Fhir.Model.CodeableConcept? SubType [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -835,7 +835,7 @@ public List Topic [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -850,7 +850,7 @@ public List Action [DataMember] public List ActionReason { - get => _ActionReason ?? new List(); + get => _ActionReason ??= []; set { _ActionReason = value; OnPropertyChanged("ActionReason"); } } @@ -865,7 +865,7 @@ public List ActionReason [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -879,7 +879,7 @@ public List SecurityLabel [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -921,7 +921,7 @@ public string? Text [DataMember] public List ValuedItem { - get => _ValuedItem ?? new List(); + get => _ValuedItem ??= []; set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } @@ -935,7 +935,7 @@ public List ValuedItem [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -1153,7 +1153,7 @@ public Hl7.Fhir.Model.ResourceReference? Actor [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -1897,7 +1897,7 @@ public Hl7.Fhir.Model.Period? Applies [DataMember] public List Subject { - get => _Subject ?? new List(); + get => _Subject ??= []; set { _Subject = value; OnPropertyChanged("Subject"); } } @@ -1913,7 +1913,7 @@ public List Subject [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1929,7 +1929,7 @@ public List Topic [DataMember] public List Authority { - get => _Authority ?? new List(); + get => _Authority ??= []; set { _Authority = value; OnPropertyChanged("Authority"); } } @@ -1945,7 +1945,7 @@ public List Authority [DataMember] public List Domain { - get => _Domain ?? new List(); + get => _Domain ??= []; set { _Domain = value; OnPropertyChanged("Domain"); } } @@ -1974,7 +1974,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List SubType { - get => _SubType ?? new List(); + get => _SubType ??= []; set { _SubType = value; OnPropertyChanged("SubType"); } } @@ -1989,7 +1989,7 @@ public List SubType [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -2004,7 +2004,7 @@ public List Action [DataMember] public List ActionReason { - get => _ActionReason ?? new List(); + get => _ActionReason ??= []; set { _ActionReason = value; OnPropertyChanged("ActionReason"); } } @@ -2047,7 +2047,7 @@ public Hl7.Fhir.Model.CodeableConcept? ContentDerivative [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -2061,7 +2061,7 @@ public List SecurityLabel [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -2075,7 +2075,7 @@ public List Agent [DataMember] public List Signer { - get => _Signer ?? new List(); + get => _Signer ??= []; set { _Signer = value; OnPropertyChanged("Signer"); } } @@ -2089,7 +2089,7 @@ public List Signer [DataMember] public List ValuedItem { - get => _ValuedItem ?? new List(); + get => _ValuedItem ??= []; set { _ValuedItem = value; OnPropertyChanged("ValuedItem"); } } @@ -2103,7 +2103,7 @@ public List ValuedItem [DataMember] public List Term { - get => _Term ?? new List(); + get => _Term ??= []; set { _Term = value; OnPropertyChanged("Term"); } } @@ -2133,7 +2133,7 @@ public Hl7.Fhir.Model.DataType? Binding [DataMember] public List Friendly { - get => _Friendly ?? new List(); + get => _Friendly ??= []; set { _Friendly = value; OnPropertyChanged("Friendly"); } } @@ -2147,7 +2147,7 @@ public List Friendly [DataMember] public List Legal { - get => _Legal ?? new List(); + get => _Legal ??= []; set { _Legal = value; OnPropertyChanged("Legal"); } } @@ -2161,7 +2161,7 @@ public List Legal [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs b/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs index 57b5fccd2..e5ceb9f03 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs @@ -164,7 +164,7 @@ public string? Name [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs index 800892efc..67b701327 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs @@ -582,7 +582,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -742,7 +742,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Payor { - get => _Payor ?? new List(); + get => _Payor ??= []; set { _Payor = value; OnPropertyChanged("Payor"); } } @@ -883,7 +883,7 @@ public string? Network [DataMember] public List Contract { - get => _Contract ?? new List(); + get => _Contract ??= []; set { _Contract = value; OnPropertyChanged("Contract"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs index c78dc91bb..94d36f13a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs @@ -362,7 +362,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -575,7 +575,7 @@ public string? Title [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -589,7 +589,7 @@ public List Contact [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -604,7 +604,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -676,7 +676,7 @@ public Hl7.Fhir.Model.DataElement.DataElementStringency? Stringency [DataMember] public List Mapping { - get => _Mapping ?? new List(); + get => _Mapping ??= []; set { _Mapping = value; OnPropertyChanged("Mapping"); } } @@ -690,7 +690,7 @@ public List Mapping [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs index d02ddcb37..ee86331ee 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs @@ -131,7 +131,7 @@ public Hl7.Fhir.Model.DataType? ValueSet [DataMember] public List ValueCodeElement { - get => _ValueCodeElement ?? new List(); + get => _ValueCodeElement ??= []; set { _ValueCodeElement = value; OnPropertyChanged("ValueCodeElement"); } } @@ -163,7 +163,7 @@ public IEnumerable? ValueCode [DataMember] public List ValueCoding { - get => _ValueCoding ?? new List(); + get => _ValueCoding ??= []; set { _ValueCoding = value; OnPropertyChanged("ValueCoding"); } } @@ -177,7 +177,7 @@ public List ValueCoding [DataMember] public List ValueCodeableConcept { - get => _ValueCodeableConcept ?? new List(); + get => _ValueCodeableConcept ??= []; set { _ValueCodeableConcept = value; OnPropertyChanged("ValueCodeableConcept"); } } @@ -449,7 +449,7 @@ public Hl7.Fhir.Model.FHIRAllTypes? Type [DataMember] public List ProfileElement { - get => _ProfileElement ?? new List(); + get => _ProfileElement ??= []; set { _ProfileElement = value; OnPropertyChanged("ProfileElement"); } } @@ -481,7 +481,7 @@ public IEnumerable? Profile [DataMember] public List MustSupportElement { - get => _MustSupportElement ?? new List(); + get => _MustSupportElement ??= []; set { _MustSupportElement = value; OnPropertyChanged("MustSupportElement"); } } @@ -513,7 +513,7 @@ public IEnumerable? MustSupport [DataMember] public List CodeFilter { - get => _CodeFilter ?? new List(); + get => _CodeFilter ??= []; set { _CodeFilter = value; OnPropertyChanged("CodeFilter"); } } @@ -527,7 +527,7 @@ public List CodeFilter [DataMember] public List DateFilter { - get => _DateFilter ?? new List(); + get => _DateFilter ??= []; set { _DateFilter = value; OnPropertyChanged("DateFilter"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs index ec334364a..e97a197a5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs @@ -399,7 +399,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Implicated { - get => _Implicated ?? new List(); + get => _Implicated ??= []; set { _Implicated = value; OnPropertyChanged("Implicated"); } } @@ -469,7 +469,7 @@ public string? Reference [DataMember] public List Mitigation { - get => _Mitigation ?? new List(); + get => _Mitigation ??= []; set { _Mitigation = value; OnPropertyChanged("Mitigation"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Device.cs b/src/Hl7.Fhir.STU3/Model/Generated/Device.cs index d93ab7c11..f1943a97c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Device.cs @@ -480,7 +480,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -749,7 +749,7 @@ public Hl7.Fhir.Model.ResourceReference? Owner [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -806,7 +806,7 @@ public string? Url [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -821,7 +821,7 @@ public List Note [DataMember] public List Safety { - get => _Safety ?? new List(); + get => _Safety ??= []; set { _Safety = value; OnPropertyChanged("Safety"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs index 611f0655b..fb1ec8b15 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs @@ -385,7 +385,7 @@ public Hl7.Fhir.Model.ResourceReference? Parent [DataMember] public List OperationalStatus { - get => _OperationalStatus ?? new List(); + get => _OperationalStatus ??= []; set { _OperationalStatus = value; OnPropertyChanged("OperationalStatus"); } } @@ -443,7 +443,7 @@ public Hl7.Fhir.Model.DeviceComponent.MeasmntPrinciple? MeasurementPrinciple [DataMember] public List ProductionSpecification { - get => _ProductionSpecification ?? new List(); + get => _ProductionSpecification ??= []; set { _ProductionSpecification = value; OnPropertyChanged("ProductionSpecification"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs index 001b9b355..a65a8adf2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs @@ -622,7 +622,7 @@ public Hl7.Fhir.Model.Timing? MeasurementPeriod [DataMember] public List Calibration { - get => _Calibration ?? new List(); + get => _Calibration ??= []; set { _Calibration = value; OnPropertyChanged("Calibration"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs index 27bf2a96c..3f34aedee 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs @@ -187,7 +187,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -203,7 +203,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -219,7 +219,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -235,7 +235,7 @@ public List BasedOn [DataMember] public List PriorRequest { - get => _PriorRequest ?? new List(); + get => _PriorRequest ??= []; set { _PriorRequest = value; OnPropertyChanged("PriorRequest"); } } @@ -472,7 +472,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -488,7 +488,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -504,7 +504,7 @@ public List ReasonReference [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -518,7 +518,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -534,7 +534,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs index 313a441ea..2426b2267 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs @@ -116,7 +116,7 @@ public enum DeviceUseStatementStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -264,7 +264,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List Indication { - get => _Indication ?? new List(); + get => _Indication ??= []; set { _Indication = value; OnPropertyChanged("Indication"); } } @@ -292,7 +292,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs index 63d17d8d5..8a90aa650 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs @@ -387,7 +387,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -403,7 +403,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -550,7 +550,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -566,7 +566,7 @@ public List Performer [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -582,7 +582,7 @@ public List Specimen [DataMember] public List Result { - get => _Result ?? new List(); + get => _Result ??= []; set { _Result = value; OnPropertyChanged("Result"); } } @@ -598,7 +598,7 @@ public List Result [DataMember] public List ImagingStudy { - get => _ImagingStudy ?? new List(); + get => _ImagingStudy ??= []; set { _ImagingStudy = value; OnPropertyChanged("ImagingStudy"); } } @@ -612,7 +612,7 @@ public List ImagingStudy [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } @@ -655,7 +655,7 @@ public string? Conclusion [DataMember] public List CodedDiagnosis { - get => _CodedDiagnosis ?? new List(); + get => _CodedDiagnosis ??= []; set { _CodedDiagnosis = value; OnPropertyChanged("CodedDiagnosis"); } } @@ -669,7 +669,7 @@ public List CodedDiagnosis [DataMember] public List PresentedForm { - get => _PresentedForm ?? new List(); + get => _PresentedForm ??= []; set { _PresentedForm = value; OnPropertyChanged("PresentedForm"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs index 04afc2584..874823db7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs @@ -292,7 +292,7 @@ public Hl7.Fhir.Model.Identifier? MasterIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -396,7 +396,7 @@ public string? Created [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -412,7 +412,7 @@ public List Author [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -482,7 +482,7 @@ public string? Description [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } @@ -496,7 +496,7 @@ public List Content [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs index 2688506cd..19ace727e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs @@ -351,7 +351,7 @@ public Hl7.Fhir.Model.ResourceReference? Encounter [DataMember] public List Event { - get => _Event ?? new List(); + get => _Event ??= []; set { _Event = value; OnPropertyChanged("Event"); } } @@ -421,7 +421,7 @@ public Hl7.Fhir.Model.ResourceReference? SourcePatientInfo [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -678,7 +678,7 @@ public Hl7.Fhir.Model.Identifier? MasterIdentifier [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -856,7 +856,7 @@ public DateTimeOffset? Indexed [DataMember] public List Author { - get => _Author ?? new List(); + get => _Author ??= []; set { _Author = value; OnPropertyChanged("Author"); } } @@ -900,7 +900,7 @@ public Hl7.Fhir.Model.ResourceReference? Custodian [DataMember] public List RelatesTo { - get => _RelatesTo ?? new List(); + get => _RelatesTo ??= []; set { _RelatesTo = value; OnPropertyChanged("RelatesTo"); } } @@ -943,7 +943,7 @@ public string? Description [DataMember] public List SecurityLabel { - get => _SecurityLabel ?? new List(); + get => _SecurityLabel ??= []; set { _SecurityLabel = value; OnPropertyChanged("SecurityLabel"); } } @@ -957,7 +957,7 @@ public List SecurityLabel [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs index a2eae4d55..c1d617d65 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs @@ -127,7 +127,7 @@ public string? Text [DataMember] public List AdditionalInstruction { - get => _AdditionalInstruction ?? new List(); + get => _AdditionalInstruction ??= []; set { _AdditionalInstruction = value; OnPropertyChanged("AdditionalInstruction"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs index f8c8c1f4b..6ca491f8a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs @@ -273,7 +273,7 @@ public partial class SlicingComponent : Hl7.Fhir.Model.Element [DataMember] public List Discriminator { - get => _Discriminator ?? new List(); + get => _Discriminator ??= []; set { _Discriminator = value; OnPropertyChanged("Discriminator"); } } @@ -897,7 +897,7 @@ public string? TargetProfile [DataMember] public List> AggregationElement { - get => _AggregationElement ?? new List>(); + get => _AggregationElement ??= []; set { _AggregationElement = value; OnPropertyChanged("AggregationElement"); } } @@ -1948,7 +1948,7 @@ public string? Path [DataMember] public List> RepresentationElement { - get => _RepresentationElement ?? new List>(); + get => _RepresentationElement ??= []; set { _RepresentationElement = value; OnPropertyChanged("RepresentationElement"); } } @@ -2037,7 +2037,7 @@ public string? Label [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -2176,7 +2176,7 @@ public string? Requirements [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -2305,7 +2305,7 @@ public string? ContentReference [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -2420,7 +2420,7 @@ public Hl7.Fhir.Model.DataType? Pattern [DataMember] public List Example { - get => _Example ?? new List(); + get => _Example ??= []; set { _Example = value; OnPropertyChanged("Example"); } } @@ -2492,7 +2492,7 @@ public int? MaxLength [DataMember] public List ConditionElement { - get => _ConditionElement ?? new List(); + get => _ConditionElement ??= []; set { _ConditionElement = value; OnPropertyChanged("ConditionElement"); } } @@ -2524,7 +2524,7 @@ public IEnumerable? Condition [DataMember] public List Constraint { - get => _Constraint ?? new List(); + get => _Constraint ??= []; set { _Constraint = value; OnPropertyChanged("Constraint"); } } @@ -2635,7 +2635,7 @@ public Hl7.Fhir.Model.ElementDefinition.ElementDefinitionBindingComponent? Bindi [DataMember] public List Mapping { - get => _Mapping ?? new List(); + get => _Mapping ??= []; set { _Mapping = value; OnPropertyChanged("Mapping"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs index cb3926ee9..cb86b13b8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs @@ -70,7 +70,7 @@ public partial class EligibilityRequest : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs index 4ccb4333f..d6d161e4a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs @@ -116,7 +116,7 @@ public Hl7.Fhir.Model.ResourceReference? Contract [DataMember] public List BenefitBalance { - get => _BenefitBalance ?? new List(); + get => _BenefitBalance ??= []; set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } @@ -380,7 +380,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Financial { - get => _Financial ?? new List(); + get => _Financial ??= []; set { _Financial = value; OnPropertyChanged("Financial"); } } @@ -759,7 +759,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -961,7 +961,7 @@ public bool? Inforce [DataMember] public List Insurance { - get => _Insurance ?? new List(); + get => _Insurance ??= []; set { _Insurance = value; OnPropertyChanged("Insurance"); } } @@ -989,7 +989,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs b/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs index a9d2d7eb7..25f5346cd 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs @@ -435,7 +435,7 @@ public partial class ParticipantComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -780,7 +780,7 @@ public Hl7.Fhir.Model.CodeableConcept? ReAdmission [DataMember] public List DietPreference { - get => _DietPreference ?? new List(); + get => _DietPreference ??= []; set { _DietPreference = value; OnPropertyChanged("DietPreference"); } } @@ -795,7 +795,7 @@ public List DietPreference [DataMember] public List SpecialCourtesy { - get => _SpecialCourtesy ?? new List(); + get => _SpecialCourtesy ??= []; set { _SpecialCourtesy = value; OnPropertyChanged("SpecialCourtesy"); } } @@ -810,7 +810,7 @@ public List SpecialCourtesy [DataMember] public List SpecialArrangement { - get => _SpecialArrangement ?? new List(); + get => _SpecialArrangement ??= []; set { _SpecialArrangement = value; OnPropertyChanged("SpecialArrangement"); } } @@ -1141,7 +1141,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1186,7 +1186,7 @@ public Hl7.Fhir.Model.Encounter.EncounterStatus? Status [DataMember] public List StatusHistory { - get => _StatusHistory ?? new List(); + get => _StatusHistory ??= []; set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } @@ -1214,7 +1214,7 @@ public Hl7.Fhir.Model.Coding? Class [DataMember] public List ClassHistory { - get => _ClassHistory ?? new List(); + get => _ClassHistory ??= []; set { _ClassHistory = value; OnPropertyChanged("ClassHistory"); } } @@ -1229,7 +1229,7 @@ public List ClassHistory [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1274,7 +1274,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List EpisodeOfCare { - get => _EpisodeOfCare ?? new List(); + get => _EpisodeOfCare ??= []; set { _EpisodeOfCare = value; OnPropertyChanged("EpisodeOfCare"); } } @@ -1290,7 +1290,7 @@ public List EpisodeOfCare [DataMember] public List IncomingReferral { - get => _IncomingReferral ?? new List(); + get => _IncomingReferral ??= []; set { _IncomingReferral = value; OnPropertyChanged("IncomingReferral"); } } @@ -1304,7 +1304,7 @@ public List IncomingReferral [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1360,7 +1360,7 @@ public Hl7.Fhir.Model.Duration? Length [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -1374,7 +1374,7 @@ public List Reason [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -1390,7 +1390,7 @@ public List Diagnosis [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } @@ -1417,7 +1417,7 @@ public Hl7.Fhir.Model.Encounter.HospitalizationComponent? Hospitalization [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs index 93fb62b6e..6f8968619 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs @@ -116,7 +116,7 @@ public enum EndpointStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -219,7 +219,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -247,7 +247,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List PayloadType { - get => _PayloadType ?? new List(); + get => _PayloadType ??= []; set { _PayloadType = value; OnPropertyChanged("PayloadType"); } } @@ -262,7 +262,7 @@ public List PayloadType [DataMember] public List PayloadMimeTypeElement { - get => _PayloadMimeTypeElement ?? new List(); + get => _PayloadMimeTypeElement ??= []; set { _PayloadMimeTypeElement = value; OnPropertyChanged("PayloadMimeTypeElement"); } } @@ -323,7 +323,7 @@ public string? Address [DataMember] public List HeaderElement { - get => _HeaderElement ?? new List(); + get => _HeaderElement ??= []; set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs index c115ad405..292cfb2b3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs @@ -70,7 +70,7 @@ public partial class EnrollmentRequest : Hl7.Fhir.Model.DomainResource, IIdentif [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs index 753a91e14..bb7a5a794 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs @@ -70,7 +70,7 @@ public partial class EnrollmentResponse : Hl7.Fhir.Model.DomainResource, IIdenti [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs index 119962074..ecdf1c483 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs @@ -403,7 +403,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -448,7 +448,7 @@ public Hl7.Fhir.Model.EpisodeOfCare.EpisodeOfCareStatus? Status [DataMember] public List StatusHistory { - get => _StatusHistory ?? new List(); + get => _StatusHistory ??= []; set { _StatusHistory = value; OnPropertyChanged("StatusHistory"); } } @@ -463,7 +463,7 @@ public List StatusHistory [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -477,7 +477,7 @@ public List Type [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List ReferralRequest { - get => _ReferralRequest ?? new List(); + get => _ReferralRequest ??= []; set { _ReferralRequest = value; OnPropertyChanged("ReferralRequest"); } } @@ -568,7 +568,7 @@ public Hl7.Fhir.Model.ResourceReference? CareManager [DataMember] public List Team { - get => _Team ?? new List(); + get => _Team ??= []; set { _Team = value; OnPropertyChanged("Team"); } } @@ -584,7 +584,7 @@ public List Team [DataMember] public List Account { - get => _Account ?? new List(); + get => _Account ??= []; set { _Account = value; OnPropertyChanged("Account"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs index 359083ee6..01497ce4c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs @@ -551,7 +551,7 @@ public partial class DesignationIncludeComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -769,7 +769,7 @@ public partial class DesignationExcludeComponent : Hl7.Fhir.Model.BackboneElemen [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -1186,7 +1186,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1228,7 +1228,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1243,7 +1243,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1257,7 +1257,7 @@ public List Jurisdiction [DataMember] public List FixedVersion { - get => _FixedVersion ?? new List(); + get => _FixedVersion ??= []; set { _FixedVersion = value; OnPropertyChanged("FixedVersion"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs index 8f4e9f4f2..eadf0c8ff 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs @@ -1039,7 +1039,7 @@ public Hl7.Fhir.Model.DataType? Diagnosis [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1356,7 +1356,7 @@ public Hl7.Fhir.Model.ResourceReference? Coverage [DataMember] public List PreAuthRefElement { - get => _PreAuthRefElement ?? new List(); + get => _PreAuthRefElement ??= []; set { _PreAuthRefElement = value; OnPropertyChanged("PreAuthRefElement"); } } @@ -1656,7 +1656,7 @@ public int? Sequence [DataMember] public List CareTeamLinkIdElement { - get => _CareTeamLinkIdElement ?? new List(); + get => _CareTeamLinkIdElement ??= []; set { _CareTeamLinkIdElement = value; OnPropertyChanged("CareTeamLinkIdElement"); } } @@ -1688,7 +1688,7 @@ public IEnumerable? CareTeamLinkId [DataMember] public List DiagnosisLinkIdElement { - get => _DiagnosisLinkIdElement ?? new List(); + get => _DiagnosisLinkIdElement ??= []; set { _DiagnosisLinkIdElement = value; OnPropertyChanged("DiagnosisLinkIdElement"); } } @@ -1720,7 +1720,7 @@ public IEnumerable? DiagnosisLinkId [DataMember] public List ProcedureLinkIdElement { - get => _ProcedureLinkIdElement ?? new List(); + get => _ProcedureLinkIdElement ??= []; set { _ProcedureLinkIdElement = value; OnPropertyChanged("ProcedureLinkIdElement"); } } @@ -1752,7 +1752,7 @@ public IEnumerable? ProcedureLinkId [DataMember] public List InformationLinkIdElement { - get => _InformationLinkIdElement ?? new List(); + get => _InformationLinkIdElement ??= []; set { _InformationLinkIdElement = value; OnPropertyChanged("InformationLinkIdElement"); } } @@ -1827,7 +1827,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -1842,7 +1842,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -1957,7 +1957,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -1986,7 +1986,7 @@ public Hl7.Fhir.Model.CodeableConcept? BodySite [DataMember] public List SubSite { - get => _SubSite ?? new List(); + get => _SubSite ??= []; set { _SubSite = value; OnPropertyChanged("SubSite"); } } @@ -2002,7 +2002,7 @@ public List SubSite [DataMember] public List Encounter { - get => _Encounter ?? new List(); + get => _Encounter ??= []; set { _Encounter = value; OnPropertyChanged("Encounter"); } } @@ -2016,7 +2016,7 @@ public List Encounter [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -2048,7 +2048,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2062,7 +2062,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -2612,7 +2612,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -2627,7 +2627,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -2710,7 +2710,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -2724,7 +2724,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -2756,7 +2756,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -2770,7 +2770,7 @@ public List Adjudicat [DataMember] public List SubDetail { - get => _SubDetail ?? new List(); + get => _SubDetail ??= []; set { _SubDetail = value; OnPropertyChanged("SubDetail"); } } @@ -3074,7 +3074,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3089,7 +3089,7 @@ public List Modifier [DataMember] public List ProgramCode { - get => _ProgramCode ?? new List(); + get => _ProgramCode ??= []; set { _ProgramCode = value; OnPropertyChanged("ProgramCode"); } } @@ -3172,7 +3172,7 @@ public Hl7.Fhir.Model.Money? Net [DataMember] public List Udi { - get => _Udi ?? new List(); + get => _Udi ??= []; set { _Udi = value; OnPropertyChanged("Udi"); } } @@ -3186,7 +3186,7 @@ public List Udi [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3218,7 +3218,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3426,7 +3426,7 @@ public partial class AddedItemComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List SequenceLinkIdElement { - get => _SequenceLinkIdElement ?? new List(); + get => _SequenceLinkIdElement ??= []; set { _SequenceLinkIdElement = value; OnPropertyChanged("SequenceLinkIdElement"); } } @@ -3501,7 +3501,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3528,7 +3528,7 @@ public Hl7.Fhir.Model.Money? Fee [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3560,7 +3560,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -3574,7 +3574,7 @@ public List Adjudicat [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -3780,7 +3780,7 @@ public Hl7.Fhir.Model.CodeableConcept? Service [DataMember] public List Modifier { - get => _Modifier ?? new List(); + get => _Modifier ??= []; set { _Modifier = value; OnPropertyChanged("Modifier"); } } @@ -3807,7 +3807,7 @@ public Hl7.Fhir.Model.Money? Fee [DataMember] public List NoteNumberElement { - get => _NoteNumberElement ?? new List(); + get => _NoteNumberElement ??= []; set { _NoteNumberElement = value; OnPropertyChanged("NoteNumberElement"); } } @@ -3839,7 +3839,7 @@ public IEnumerable? NoteNumber [DataMember] public List Adjudication { - get => _Adjudication ?? new List(); + get => _Adjudication ??= []; set { _Adjudication = value; OnPropertyChanged("Adjudication"); } } @@ -4541,7 +4541,7 @@ public Hl7.Fhir.Model.CodeableConcept? Term [DataMember] public List Financial { - get => _Financial ?? new List(); + get => _Financial ??= []; set { _Financial = value; OnPropertyChanged("Financial"); } } @@ -4828,7 +4828,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -4887,7 +4887,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List SubType { - get => _SubType ?? new List(); + get => _SubType ??= []; set { _SubType = value; OnPropertyChanged("SubType"); } } @@ -5119,7 +5119,7 @@ public string? Disposition [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -5176,7 +5176,7 @@ public Hl7.Fhir.Model.ExplanationOfBenefit.PayeeComponent? Payee [DataMember] public List Information { - get => _Information ?? new List(); + get => _Information ??= []; set { _Information = value; OnPropertyChanged("Information"); } } @@ -5190,7 +5190,7 @@ public List [DataMember] public List CareTeam { - get => _CareTeam ?? new List(); + get => _CareTeam ??= []; set { _CareTeam = value; OnPropertyChanged("CareTeam"); } } @@ -5204,7 +5204,7 @@ public List CareTeam [DataMember] public List Diagnosis { - get => _Diagnosis ?? new List(); + get => _Diagnosis ??= []; set { _Diagnosis = value; OnPropertyChanged("Diagnosis"); } } @@ -5218,7 +5218,7 @@ public List Diagnosis [DataMember] public List Procedure { - get => _Procedure ?? new List(); + get => _Procedure ??= []; set { _Procedure = value; OnPropertyChanged("Procedure"); } } @@ -5312,7 +5312,7 @@ public Hl7.Fhir.Model.Period? Hospitalization [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -5326,7 +5326,7 @@ public List Item [DataMember] public List AddItem { - get => _AddItem ?? new List(); + get => _AddItem ??= []; set { _AddItem = value; OnPropertyChanged("AddItem"); } } @@ -5406,7 +5406,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -5420,7 +5420,7 @@ public List ProcessNote [DataMember] public List BenefitBalance { - get => _BenefitBalance ?? new List(); + get => _BenefitBalance ??= []; set { _BenefitBalance = value; OnPropertyChanged("BenefitBalance"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs index 1a2cdf7af..f9852d6a6 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs @@ -165,7 +165,7 @@ public Hl7.Fhir.Model.DataType? Onset [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -267,7 +267,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -283,7 +283,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -561,7 +561,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -577,7 +577,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -591,7 +591,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -605,7 +605,7 @@ public List Note [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs b/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs index 5202016cc..2fd858a0f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs @@ -98,7 +98,7 @@ public enum FlagStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs b/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs index e41f2b0b8..8b8d1c9f5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs @@ -299,7 +299,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -345,7 +345,7 @@ public Hl7.Fhir.Model.Goal.GoalStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -505,7 +505,7 @@ public Hl7.Fhir.Model.ResourceReference? ExpressedBy [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -519,7 +519,7 @@ public List Addresses [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -534,7 +534,7 @@ public List Note [DataMember] public List OutcomeCode { - get => _OutcomeCode ?? new List(); + get => _OutcomeCode ??= []; set { _OutcomeCode = value; OnPropertyChanged("OutcomeCode"); } } @@ -550,7 +550,7 @@ public List OutcomeCode [DataMember] public List OutcomeReference { - get => _OutcomeReference ?? new List(); + get => _OutcomeReference ??= []; set { _OutcomeReference = value; OnPropertyChanged("OutcomeReference"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs index b326a544e..8d40baeb5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs @@ -258,7 +258,7 @@ public string? Description [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -450,7 +450,7 @@ public string? Profile [DataMember] public List Compartment { - get => _Compartment ?? new List(); + get => _Compartment ??= []; set { _Compartment = value; OnPropertyChanged("Compartment"); } } @@ -464,7 +464,7 @@ public List Compartment [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -985,7 +985,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1027,7 +1027,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1042,7 +1042,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1143,7 +1143,7 @@ public string? Profile [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Group.cs b/src/Hl7.Fhir.STU3/Model/Generated/Group.cs index 5eb62062e..601bd9568 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Group.cs @@ -447,7 +447,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -619,7 +619,7 @@ public int? Quantity [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -633,7 +633,7 @@ public List Characteristic [DataMember] public List Member { - get => _Member ?? new List(); + get => _Member ??= []; set { _Member = value; OnPropertyChanged("Member"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs index 3eaa39c44..a05cbbf61 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs @@ -293,7 +293,7 @@ public Hl7.Fhir.Model.DataType? Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -309,7 +309,7 @@ public List Note [DataMember] public List EvaluationMessage { - get => _EvaluationMessage ?? new List(); + get => _EvaluationMessage ??= []; set { _EvaluationMessage = value; OnPropertyChanged("EvaluationMessage"); } } @@ -353,7 +353,7 @@ public Hl7.Fhir.Model.ResourceReference? Result [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs index dcf8b75c4..f02648889 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs @@ -86,7 +86,7 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -418,7 +418,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -490,7 +490,7 @@ public Hl7.Fhir.Model.CodeableConcept? Category [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -505,7 +505,7 @@ public List Type [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -521,7 +521,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -632,7 +632,7 @@ public Hl7.Fhir.Model.Attachment? Photo [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -648,7 +648,7 @@ public List Telecom [DataMember] public List CoverageArea { - get => _CoverageArea ?? new List(); + get => _CoverageArea ??= []; set { _CoverageArea = value; OnPropertyChanged("CoverageArea"); } } @@ -663,7 +663,7 @@ public List CoverageArea [DataMember] public List ServiceProvisionCode { - get => _ServiceProvisionCode ?? new List(); + get => _ServiceProvisionCode ??= []; set { _ServiceProvisionCode = value; OnPropertyChanged("ServiceProvisionCode"); } } @@ -719,7 +719,7 @@ public string? EligibilityNote [DataMember] public List ProgramNameElement { - get => _ProgramNameElement ?? new List(); + get => _ProgramNameElement ??= []; set { _ProgramNameElement = value; OnPropertyChanged("ProgramNameElement"); } } @@ -752,7 +752,7 @@ public IEnumerable? ProgramName [DataMember] public List Characteristic { - get => _Characteristic ?? new List(); + get => _Characteristic ??= []; set { _Characteristic = value; OnPropertyChanged("Characteristic"); } } @@ -767,7 +767,7 @@ public List Characteristic [DataMember] public List ReferralMethod { - get => _ReferralMethod ?? new List(); + get => _ReferralMethod ??= []; set { _ReferralMethod = value; OnPropertyChanged("ReferralMethod"); } } @@ -809,7 +809,7 @@ public bool? AppointmentRequired [DataMember] public List AvailableTime { - get => _AvailableTime ?? new List(); + get => _AvailableTime ??= []; set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } @@ -823,7 +823,7 @@ public List AvailableTi [DataMember] public List NotAvailable { - get => _NotAvailable ?? new List(); + get => _NotAvailable ??= []; set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } @@ -867,7 +867,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs index 0fb3fe01a..f66b3f424 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs @@ -209,7 +209,7 @@ public string? Family [DataMember] public List GivenElement { - get => _GivenElement ?? new List(); + get => _GivenElement ??= []; set { _GivenElement = value; OnPropertyChanged("GivenElement"); } } @@ -241,7 +241,7 @@ public IEnumerable? Given [DataMember] public List PrefixElement { - get => _PrefixElement ?? new List(); + get => _PrefixElement ??= []; set { _PrefixElement = value; OnPropertyChanged("PrefixElement"); } } @@ -273,7 +273,7 @@ public IEnumerable? Prefix [DataMember] public List SuffixElement { - get => _SuffixElement ?? new List(); + get => _SuffixElement ??= []; set { _SuffixElement = value; OnPropertyChanged("SuffixElement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs index debe8e9f1..ff8e86c98 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs @@ -133,7 +133,7 @@ public Hl7.Fhir.Model.ResourceReference? ImagingStudy [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -147,7 +147,7 @@ public List Endpoint [DataMember] public List Series { - get => _Series ?? new List(); + get => _Series ??= []; set { _Series = value; OnPropertyChanged("Series"); } } @@ -297,7 +297,7 @@ public string? Uid [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -311,7 +311,7 @@ public List Endpoint [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -649,7 +649,7 @@ public string? Description [DataMember] public List Study { - get => _Study ?? new List(); + get => _Study ??= []; set { _Study = value; OnPropertyChanged("Study"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs index c5cbcd011..e92cff9b8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs @@ -280,7 +280,7 @@ public Hl7.Fhir.Model.ImagingStudy.InstanceAvailability? Availability [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -352,7 +352,7 @@ public string? Started [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -366,7 +366,7 @@ public List Performer [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -800,7 +800,7 @@ public Hl7.Fhir.Model.Identifier? Accession [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -845,7 +845,7 @@ public Hl7.Fhir.Model.ImagingStudy.InstanceAvailability? Availability [DataMember] public List ModalityList { - get => _ModalityList ?? new List(); + get => _ModalityList ??= []; set { _ModalityList = value; OnPropertyChanged("ModalityList"); } } @@ -920,7 +920,7 @@ public string? Started [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -951,7 +951,7 @@ public Hl7.Fhir.Model.ResourceReference? Referrer [DataMember] public List Interpreter { - get => _Interpreter ?? new List(); + get => _Interpreter ??= []; set { _Interpreter = value; OnPropertyChanged("Interpreter"); } } @@ -967,7 +967,7 @@ public List Interpreter [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } @@ -1039,7 +1039,7 @@ public int? NumberOfInstances [DataMember] public List ProcedureReference { - get => _ProcedureReference ?? new List(); + get => _ProcedureReference ??= []; set { _ProcedureReference = value; OnPropertyChanged("ProcedureReference"); } } @@ -1054,7 +1054,7 @@ public List ProcedureReference [DataMember] public List ProcedureCode { - get => _ProcedureCode ?? new List(); + get => _ProcedureCode ??= []; set { _ProcedureCode = value; OnPropertyChanged("ProcedureCode"); } } @@ -1110,7 +1110,7 @@ public string? Description [DataMember] public List Series { - get => _Series ?? new List(); + get => _Series ??= []; set { _Series = value; OnPropertyChanged("Series"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs b/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs index d2a61d98b..cfc103a81 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs @@ -225,7 +225,7 @@ public partial class ExplanationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -240,7 +240,7 @@ public List Reason [DataMember] public List ReasonNotGiven { - get => _ReasonNotGiven ?? new List(); + get => _ReasonNotGiven ??= []; set { _ReasonNotGiven = value; OnPropertyChanged("ReasonNotGiven"); } } @@ -635,7 +635,7 @@ public int? SeriesDoses [DataMember] public List TargetDisease { - get => _TargetDisease ?? new List(); + get => _TargetDisease ??= []; set { _TargetDisease = value; OnPropertyChanged("TargetDisease"); } } @@ -802,7 +802,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1120,7 +1120,7 @@ public Hl7.Fhir.Model.Quantity? DoseQuantity [DataMember] public List Practitioner { - get => _Practitioner ?? new List(); + get => _Practitioner ??= []; set { _Practitioner = value; OnPropertyChanged("Practitioner"); } } @@ -1134,7 +1134,7 @@ public List Practitioner [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1161,7 +1161,7 @@ public Hl7.Fhir.Model.Immunization.ExplanationComponent? Explanation [DataMember] public List Reaction { - get => _Reaction ?? new List(); + get => _Reaction ??= []; set { _Reaction = value; OnPropertyChanged("Reaction"); } } @@ -1175,7 +1175,7 @@ public List Reaction [DataMember] public List VaccinationProtocol { - get => _VaccinationProtocol ?? new List(); + get => _VaccinationProtocol ??= []; set { _VaccinationProtocol = value; OnPropertyChanged("VaccinationProtocol"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs index d8a68d89f..6bcbb67c2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs @@ -183,7 +183,7 @@ public Hl7.Fhir.Model.CodeableConcept? ForecastStatus [DataMember] public List DateCriterion { - get => _DateCriterion ?? new List(); + get => _DateCriterion ??= []; set { _DateCriterion = value; OnPropertyChanged("DateCriterion"); } } @@ -212,7 +212,7 @@ public Hl7.Fhir.Model.ImmunizationRecommendation.ProtocolComponent? Protocol [DataMember] public List SupportingImmunization { - get => _SupportingImmunization ?? new List(); + get => _SupportingImmunization ??= []; set { _SupportingImmunization = value; OnPropertyChanged("SupportingImmunization"); } } @@ -228,7 +228,7 @@ public List SupportingImmunization [DataMember] public List SupportingPatientInformation { - get => _SupportingPatientInformation ?? new List(); + get => _SupportingPatientInformation ??= []; set { _SupportingPatientInformation = value; OnPropertyChanged("SupportingPatientInformation"); } } @@ -708,7 +708,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -738,7 +738,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient [DataMember] public List Recommendation { - get => _Recommendation ?? new List(); + get => _Recommendation ??= []; set { _Recommendation = value; OnPropertyChanged("Recommendation"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs index 282005def..cf26241fa 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs @@ -369,7 +369,7 @@ public string? Description [DataMember] public List Resource { - get => _Resource ?? new List(); + get => _Resource ??= []; set { _Resource = value; OnPropertyChanged("Resource"); } } @@ -971,7 +971,7 @@ public Hl7.Fhir.Model.ImplementationGuide.GuidePageKind? Kind [DataMember] public List> TypeElement { - get => _TypeElement ?? new List>(); + get => _TypeElement ??= []; set { _TypeElement = value; OnPropertyChanged("TypeElement"); } } @@ -1003,7 +1003,7 @@ public IEnumerable? Type [DataMember] public List PackageElement { - get => _PackageElement ?? new List(); + get => _PackageElement ??= []; set { _PackageElement = value; OnPropertyChanged("PackageElement"); } } @@ -1064,7 +1064,7 @@ public string? Format [DataMember] public List Page { - get => _Page ?? new List(); + get => _Page ??= []; set { _Page = value; OnPropertyChanged("Page"); } } @@ -1394,7 +1394,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1436,7 +1436,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1451,7 +1451,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1521,7 +1521,7 @@ public string? FhirVersion [DataMember] public List Dependency { - get => _Dependency ?? new List(); + get => _Dependency ??= []; set { _Dependency = value; OnPropertyChanged("Dependency"); } } @@ -1535,7 +1535,7 @@ public List Dependency [DataMember] public List Package { - get => _Package ?? new List(); + get => _Package ??= []; set { _Package = value; OnPropertyChanged("Package"); } } @@ -1549,7 +1549,7 @@ public List Package [DataMember] public List Global { - get => _Global ?? new List(); + get => _Global ??= []; set { _Global = value; OnPropertyChanged("Global"); } } @@ -1563,7 +1563,7 @@ public List Global [DataMember] public List BinaryElement { - get => _BinaryElement ?? new List(); + get => _BinaryElement ??= []; set { _BinaryElement = value; OnPropertyChanged("BinaryElement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Library.cs b/src/Hl7.Fhir.STU3/Model/Generated/Library.cs index 88105a951..e2478e672 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Library.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -479,7 +479,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -494,7 +494,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -509,7 +509,7 @@ public List Jurisdiction [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -523,7 +523,7 @@ public List Topic [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -537,7 +537,7 @@ public List Contributor [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -579,7 +579,7 @@ public string? Copyright [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -593,7 +593,7 @@ public List RelatedArtifact [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -607,7 +607,7 @@ public List Parameter [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } @@ -621,7 +621,7 @@ public List DataRequirement [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs index fd02bf2b1..a43d5819f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs @@ -272,7 +272,7 @@ public Hl7.Fhir.Model.ResourceReference? Author [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/List.cs b/src/Hl7.Fhir.STU3/Model/Generated/List.cs index 0c835fd46..85d5f4cca 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/List.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/List.cs @@ -289,7 +289,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -494,7 +494,7 @@ public Hl7.Fhir.Model.CodeableConcept? OrderedBy [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -508,7 +508,7 @@ public List Note [DataMember] public List Entry { - get => _Entry ?? new List(); + get => _Entry ??= []; set { _Entry = value; OnPropertyChanged("Entry"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs index 51b425d12..49a1e60f1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs @@ -301,7 +301,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -387,7 +387,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -491,7 +491,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -577,7 +577,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs index c85c957a7..b5c894f43 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs @@ -156,7 +156,7 @@ public string? Description [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -170,7 +170,7 @@ public List Population [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -701,7 +701,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List Usage { - get => _Usage ?? new List(); + get => _Usage ??= []; set { _Usage = value; OnPropertyChanged("Usage"); } } @@ -887,7 +887,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1253,7 +1253,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1268,7 +1268,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1283,7 +1283,7 @@ public List Jurisdiction [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -1297,7 +1297,7 @@ public List Topic [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -1311,7 +1311,7 @@ public List Contributor [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1353,7 +1353,7 @@ public string? Copyright [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -1369,7 +1369,7 @@ public List RelatedArtifact [DataMember] public List Library { - get => _Library ?? new List(); + get => _Library ??= []; set { _Library = value; OnPropertyChanged("Library"); } } @@ -1440,7 +1440,7 @@ public Hl7.Fhir.Model.CodeableConcept? CompositeScoring [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -1594,7 +1594,7 @@ public string? ImprovementNotation [DataMember] public List DefinitionElement { - get => _DefinitionElement ?? new List(); + get => _DefinitionElement ??= []; set { _DefinitionElement = value; OnPropertyChanged("DefinitionElement"); } } @@ -1682,7 +1682,7 @@ public string? Set [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } @@ -1696,7 +1696,7 @@ public List Group [DataMember] public List SupplementalData { - get => _SupplementalData ?? new List(); + get => _SupplementalData ??= []; set { _SupplementalData = value; OnPropertyChanged("SupplementalData"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs index 2e8e9387f..d9c1ce44d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs @@ -156,7 +156,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -198,7 +198,7 @@ public decimal? MeasureScore [DataMember] public List Stratifier { - get => _Stratifier ?? new List(); + get => _Stratifier ??= []; set { _Stratifier = value; OnPropertyChanged("Stratifier"); } } @@ -503,7 +503,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List Stratum { - get => _Stratum ?? new List(); + get => _Stratum ??= []; set { _Stratum = value; OnPropertyChanged("Stratum"); } } @@ -632,7 +632,7 @@ public string? Value [DataMember] public List Population { - get => _Population ?? new List(); + get => _Population ??= []; set { _Population = value; OnPropertyChanged("Population"); } } @@ -1090,7 +1090,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Media.cs b/src/Hl7.Fhir.STU3/Model/Generated/Media.cs index 3d45adbba..158573541 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Media.cs @@ -95,7 +95,7 @@ public enum DigitalMediaType [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -111,7 +111,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -245,7 +245,7 @@ public Hl7.Fhir.Model.ResourceReference? Operator [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -414,7 +414,7 @@ public Hl7.Fhir.Model.Attachment? Content [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs b/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs index b0fd0c15c..9c57979ef 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs @@ -282,7 +282,7 @@ public Hl7.Fhir.Model.CodeableConcept? Container [DataMember] public List Content { - get => _Content ?? new List(); + get => _Content ??= []; set { _Content = value; OnPropertyChanged("Content"); } } @@ -296,7 +296,7 @@ public List Content [DataMember] public List Batch { - get => _Batch ?? new List(); + get => _Batch ??= []; set { _Batch = value; OnPropertyChanged("Batch"); } } @@ -776,7 +776,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } @@ -803,7 +803,7 @@ public Hl7.Fhir.Model.Medication.PackageComponent? Package [DataMember] public List Image { - get => _Image ?? new List(); + get => _Image ??= []; set { _Image = value; OnPropertyChanged("Image"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs index 4e38e06e3..4d12d5e11 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs @@ -454,7 +454,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -470,7 +470,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -486,7 +486,7 @@ public List Definition [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -596,7 +596,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -626,7 +626,7 @@ public Hl7.Fhir.Model.DataType? Effective [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -669,7 +669,7 @@ public bool? NotGiven [DataMember] public List ReasonNotGiven { - get => _ReasonNotGiven ?? new List(); + get => _ReasonNotGiven ??= []; set { _ReasonNotGiven = value; OnPropertyChanged("ReasonNotGiven"); } } @@ -684,7 +684,7 @@ public List ReasonNotGiven [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -700,7 +700,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -731,7 +731,7 @@ public Hl7.Fhir.Model.ResourceReference? Prescription [DataMember] public List Device { - get => _Device ?? new List(); + get => _Device ??= []; set { _Device = value; OnPropertyChanged("Device"); } } @@ -745,7 +745,7 @@ public List Device [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -774,7 +774,7 @@ public Hl7.Fhir.Model.MedicationAdministration.DosageComponent? Dosage [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs index 396e374f6..4d1285120 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs @@ -295,7 +295,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -311,7 +311,7 @@ public List Reason [DataMember] public List ResponsibleParty { - get => _ResponsibleParty ?? new List(); + get => _ResponsibleParty ??= []; set { _ResponsibleParty = value; OnPropertyChanged("ResponsibleParty"); } } @@ -413,7 +413,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -429,7 +429,7 @@ public List Identifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -537,7 +537,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -551,7 +551,7 @@ public List SupportingInformation [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -567,7 +567,7 @@ public List Performer [DataMember] public List AuthorizingPrescription { - get => _AuthorizingPrescription ?? new List(); + get => _AuthorizingPrescription ??= []; set { _AuthorizingPrescription = value; OnPropertyChanged("AuthorizingPrescription"); } } @@ -694,7 +694,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } @@ -708,7 +708,7 @@ public List Receiver [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -722,7 +722,7 @@ public List Note [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -751,7 +751,7 @@ public Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent? Substitution [DataMember] public List DetectedIssue { - get => _DetectedIssue ?? new List(); + get => _DetectedIssue ??= []; set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } @@ -811,7 +811,7 @@ public Hl7.Fhir.Model.DataType? NotDoneReason [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs index 2dfb45567..92bda625a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs @@ -637,7 +637,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -653,7 +653,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -669,7 +669,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -852,7 +852,7 @@ public Hl7.Fhir.Model.ResourceReference? Context [DataMember] public List SupportingInformation { - get => _SupportingInformation ?? new List(); + get => _SupportingInformation ??= []; set { _SupportingInformation = value; OnPropertyChanged("SupportingInformation"); } } @@ -923,7 +923,7 @@ public Hl7.Fhir.Model.ResourceReference? Recorder [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -939,7 +939,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -953,7 +953,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -967,7 +967,7 @@ public List Note [DataMember] public List DosageInstruction { - get => _DosageInstruction ?? new List(); + get => _DosageInstruction ??= []; set { _DosageInstruction = value; OnPropertyChanged("DosageInstruction"); } } @@ -1024,7 +1024,7 @@ public Hl7.Fhir.Model.ResourceReference? PriorPrescription [DataMember] public List DetectedIssue { - get => _DetectedIssue ?? new List(); + get => _DetectedIssue ??= []; set { _DetectedIssue = value; OnPropertyChanged("DetectedIssue"); } } @@ -1040,7 +1040,7 @@ public List DetectedIssue [DataMember] public List EventHistory { - get => _EventHistory ?? new List(); + get => _EventHistory ??= []; set { _EventHistory = value; OnPropertyChanged("EventHistory"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs index 2b2615abe..d7962e986 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs @@ -161,7 +161,7 @@ public enum MedicationStatementTaken [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -177,7 +177,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -193,7 +193,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -361,7 +361,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List DerivedFrom { - get => _DerivedFrom ?? new List(); + get => _DerivedFrom ??= []; set { _DerivedFrom = value; OnPropertyChanged("DerivedFrom"); } } @@ -407,7 +407,7 @@ public Hl7.Fhir.Model.MedicationStatement.MedicationStatementTaken? Taken [DataMember] public List ReasonNotTaken { - get => _ReasonNotTaken ?? new List(); + get => _ReasonNotTaken ??= []; set { _ReasonNotTaken = value; OnPropertyChanged("ReasonNotTaken"); } } @@ -422,7 +422,7 @@ public List ReasonNotTaken [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -438,7 +438,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -452,7 +452,7 @@ public List ReasonReference [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -466,7 +466,7 @@ public List Note [DataMember] public List Dosage { - get => _Dosage ?? new List(); + get => _Dosage ??= []; set { _Dosage = value; OnPropertyChanged("Dosage"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs index 1782ca360..502a8b524 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs @@ -649,7 +649,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -691,7 +691,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -706,7 +706,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -793,7 +793,7 @@ public Hl7.Fhir.Model.ResourceReference? Base [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -809,7 +809,7 @@ public List Parent [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -868,7 +868,7 @@ public Hl7.Fhir.Model.MessageSignificanceCategory? Category [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -910,7 +910,7 @@ public bool? ResponseRequired [DataMember] public List AllowedResponse { - get => _AllowedResponse ?? new List(); + get => _AllowedResponse ??= []; set { _AllowedResponse = value; OnPropertyChanged("AllowedResponse"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs index 271ef0df9..fe77e112a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs @@ -690,7 +690,7 @@ public Hl7.Fhir.Model.Coding? Event [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -851,7 +851,7 @@ public Hl7.Fhir.Model.MessageHeader.ResponseComponent? Response [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs index 255884db7..3df3c9713 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs @@ -523,7 +523,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -607,7 +607,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -622,7 +622,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -664,7 +664,7 @@ public string? Usage [DataMember] public List UniqueId { - get => _UniqueId ?? new List(); + get => _UniqueId ??= []; set { _UniqueId = value; OnPropertyChanged("UniqueId"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs index 1be7f7d99..67af37b7f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs @@ -152,7 +152,7 @@ public partial class OralDietComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -166,7 +166,7 @@ public List Type [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -180,7 +180,7 @@ public List Schedule [DataMember] public List Nutrient { - get => _Nutrient ?? new List(); + get => _Nutrient ??= []; set { _Nutrient = value; OnPropertyChanged("Nutrient"); } } @@ -194,7 +194,7 @@ public List Nutrient [DataMember] public List Texture { - get => _Texture ?? new List(); + get => _Texture ??= []; set { _Texture = value; OnPropertyChanged("Texture"); } } @@ -209,7 +209,7 @@ public List Texture [DataMember] public List FluidConsistencyType { - get => _FluidConsistencyType ?? new List(); + get => _FluidConsistencyType ??= []; set { _FluidConsistencyType = value; OnPropertyChanged("FluidConsistencyType"); } } @@ -642,7 +642,7 @@ public string? ProductName [DataMember] public List Schedule { - get => _Schedule ?? new List(); + get => _Schedule ??= []; set { _Schedule = value; OnPropertyChanged("Schedule"); } } @@ -921,7 +921,7 @@ public Hl7.Fhir.Model.CodeableConcept? RouteofAdministration [DataMember] public List Administration { - get => _Administration ?? new List(); + get => _Administration ??= []; set { _Administration = value; OnPropertyChanged("Administration"); } } @@ -1246,7 +1246,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1367,7 +1367,7 @@ public Hl7.Fhir.Model.ResourceReference? Orderer [DataMember] public List AllergyIntolerance { - get => _AllergyIntolerance ?? new List(); + get => _AllergyIntolerance ??= []; set { _AllergyIntolerance = value; OnPropertyChanged("AllergyIntolerance"); } } @@ -1382,7 +1382,7 @@ public List AllergyIntolerance [DataMember] public List FoodPreferenceModifier { - get => _FoodPreferenceModifier ?? new List(); + get => _FoodPreferenceModifier ??= []; set { _FoodPreferenceModifier = value; OnPropertyChanged("FoodPreferenceModifier"); } } @@ -1397,7 +1397,7 @@ public List FoodPreferenceModifier [DataMember] public List ExcludeFoodModifier { - get => _ExcludeFoodModifier ?? new List(); + get => _ExcludeFoodModifier ??= []; set { _ExcludeFoodModifier = value; OnPropertyChanged("ExcludeFoodModifier"); } } @@ -1424,7 +1424,7 @@ public Hl7.Fhir.Model.NutritionOrder.OralDietComponent? OralDiet [DataMember] public List Supplement { - get => _Supplement ?? new List(); + get => _Supplement ??= []; set { _Supplement = value; OnPropertyChanged("Supplement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs b/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs index 1521bba9f..58095cfa8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs @@ -175,7 +175,7 @@ public Hl7.Fhir.Model.CodeableConcept? Type [DataMember] public List AppliesTo { - get => _AppliesTo ?? new List(); + get => _AppliesTo ??= []; set { _AppliesTo = value; OnPropertyChanged("AppliesTo"); } } @@ -544,7 +544,7 @@ public Hl7.Fhir.Model.CodeableConcept? Interpretation [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -655,7 +655,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -671,7 +671,7 @@ public List Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -717,7 +717,7 @@ public Hl7.Fhir.Model.ObservationStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -821,7 +821,7 @@ public DateTimeOffset? Issued [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -964,7 +964,7 @@ public Hl7.Fhir.Model.ResourceReference? Device [DataMember] public List ReferenceRange { - get => _ReferenceRange ?? new List(); + get => _ReferenceRange ??= []; set { _ReferenceRange = value; OnPropertyChanged("ReferenceRange"); } } @@ -978,7 +978,7 @@ public List ReferenceRange [DataMember] public List Related { - get => _Related ?? new List(); + get => _Related ??= []; set { _Related = value; OnPropertyChanged("Related"); } } @@ -992,7 +992,7 @@ public List Related [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs index 682c9f426..b53419a86 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs @@ -343,7 +343,7 @@ public Hl7.Fhir.Model.OperationDefinition.BindingComponent? Binding [DataMember] public List Part { - get => _Part ?? new List(); + get => _Part ??= []; set { _Part = value; OnPropertyChanged("Part"); } } @@ -650,7 +650,7 @@ public partial class OverloadComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List ParameterNameElement { - get => _ParameterNameElement ?? new List(); + get => _ParameterNameElement ??= []; set { _ParameterNameElement = value; OnPropertyChanged("ParameterNameElement"); } } @@ -1011,7 +1011,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1053,7 +1053,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1068,7 +1068,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1212,7 +1212,7 @@ public Hl7.Fhir.Model.ResourceReference? Base [DataMember] public List> ResourceElement { - get => _ResourceElement ?? new List>(); + get => _ResourceElement ??= []; set { _ResourceElement = value; OnPropertyChanged("ResourceElement"); } } @@ -1331,7 +1331,7 @@ public bool? Instance [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1345,7 +1345,7 @@ public List Parameter [DataMember] public List Overload { - get => _Overload ?? new List(); + get => _Overload ??= []; set { _Overload = value; OnPropertyChanged("Overload"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs index 870eb2dfa..6645106d7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs @@ -113,7 +113,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -228,7 +228,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -271,7 +271,7 @@ public bool? Active [DataMember] public List Type { - get => _Type ?? new List(); + get => _Type ??= []; set { _Type = value; OnPropertyChanged("Type"); } } @@ -313,7 +313,7 @@ public string? Name [DataMember] public List AliasElement { - get => _AliasElement ?? new List(); + get => _AliasElement ??= []; set { _AliasElement = value; OnPropertyChanged("AliasElement"); } } @@ -345,7 +345,7 @@ public IEnumerable? Alias [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -359,7 +359,7 @@ public List Telecom [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -388,7 +388,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -404,7 +404,7 @@ public List Contact [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs b/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs index f4d75a2a2..c56cacd54 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs @@ -121,7 +121,7 @@ public partial class ContactComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Relationship { - get => _Relationship ?? new List(); + get => _Relationship ??= []; set { _Relationship = value; OnPropertyChanged("Relationship"); } } @@ -148,7 +148,7 @@ public Hl7.Fhir.Model.HumanName? Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -752,7 +752,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -794,7 +794,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -808,7 +808,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -895,7 +895,7 @@ public Hl7.Fhir.Model.DataType? Deceased [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -938,7 +938,7 @@ public Hl7.Fhir.Model.DataType? MultipleBirth [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -952,7 +952,7 @@ public List Photo [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -979,7 +979,7 @@ public Hl7.Fhir.Model.Patient.AnimalComponent? Animal [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } @@ -995,7 +995,7 @@ public List Communication [DataMember] public List GeneralPractitioner { - get => _GeneralPractitioner ?? new List(); + get => _GeneralPractitioner ??= []; set { _GeneralPractitioner = value; OnPropertyChanged("GeneralPractitioner"); } } @@ -1024,7 +1024,7 @@ public Hl7.Fhir.Model.ResourceReference? ManagingOrganization [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs index a2c214b46..750f62fab 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs @@ -70,7 +70,7 @@ public partial class PaymentNotice : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs index cafd81f32..ac6b4acb0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs @@ -445,7 +445,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -632,7 +632,7 @@ public Hl7.Fhir.Model.ResourceReference? RequestOrganization [DataMember] public List Detail { - get => _Detail ?? new List(); + get => _Detail ??= []; set { _Detail = value; OnPropertyChanged("Detail"); } } @@ -673,7 +673,7 @@ public Hl7.Fhir.Model.Money? Total [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Person.cs b/src/Hl7.Fhir.STU3/Model/Generated/Person.cs index 196692fb0..ffda0af4e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Person.cs @@ -234,7 +234,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -248,7 +248,7 @@ public List Identifier [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -262,7 +262,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -334,7 +334,7 @@ public string? BirthDate [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -404,7 +404,7 @@ public bool? Active [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs index 66dfab908..ef00192e7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs @@ -144,7 +144,7 @@ public Hl7.Fhir.Model.CodeableConcept? Start [DataMember] public List Addresses { - get => _Addresses ?? new List(); + get => _Addresses ??= []; set { _Addresses = value; OnPropertyChanged("Addresses"); } } @@ -158,7 +158,7 @@ public List Addresses [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -172,7 +172,7 @@ public List Documentation [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -566,7 +566,7 @@ public string? TextEquivalent [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -580,7 +580,7 @@ public List Code [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -594,7 +594,7 @@ public List Reason [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -608,7 +608,7 @@ public List Documentation [DataMember] public List GoalIdElement { - get => _GoalIdElement ?? new List(); + get => _GoalIdElement ??= []; set { _GoalIdElement = value; OnPropertyChanged("GoalIdElement"); } } @@ -640,7 +640,7 @@ public IEnumerable? GoalId [DataMember] public List TriggerDefinition { - get => _TriggerDefinition ?? new List(); + get => _TriggerDefinition ??= []; set { _TriggerDefinition = value; OnPropertyChanged("TriggerDefinition"); } } @@ -654,7 +654,7 @@ public List TriggerDefinition [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -668,7 +668,7 @@ public List Condition [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -682,7 +682,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } @@ -696,7 +696,7 @@ public List Output [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -725,7 +725,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -933,7 +933,7 @@ public Hl7.Fhir.Model.ResourceReference? Transform [DataMember] public List DynamicValue { - get => _DynamicValue ?? new List(); + get => _DynamicValue ??= []; set { _DynamicValue = value; OnPropertyChanged("DynamicValue"); } } @@ -947,7 +947,7 @@ public List DynamicValue [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -2003,7 +2003,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2383,7 +2383,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2398,7 +2398,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2413,7 +2413,7 @@ public List Jurisdiction [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -2427,7 +2427,7 @@ public List Topic [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -2441,7 +2441,7 @@ public List Contributor [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2483,7 +2483,7 @@ public string? Copyright [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -2499,7 +2499,7 @@ public List RelatedArtifact [DataMember] public List Library { - get => _Library ?? new List(); + get => _Library ??= []; set { _Library = value; OnPropertyChanged("Library"); } } @@ -2513,7 +2513,7 @@ public List Library [DataMember] public List Goal { - get => _Goal ?? new List(); + get => _Goal ??= []; set { _Goal = value; OnPropertyChanged("Goal"); } } @@ -2527,7 +2527,7 @@ public List Goal [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs index 04a97d962..03e962de3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs @@ -84,7 +84,7 @@ public partial class QualificationComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -229,7 +229,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -271,7 +271,7 @@ public bool? Active [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -285,7 +285,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -299,7 +299,7 @@ public List Telecom [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -371,7 +371,7 @@ public string? BirthDate [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } @@ -385,7 +385,7 @@ public List Photo [DataMember] public List Qualification { - get => _Qualification ?? new List(); + get => _Qualification ??= []; set { _Qualification = value; OnPropertyChanged("Qualification"); } } @@ -400,7 +400,7 @@ public List Qualification [DataMember] public List Communication { - get => _Communication ?? new List(); + get => _Communication ??= []; set { _Communication = value; OnPropertyChanged("Communication"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs index cabccfd35..724576aba 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs @@ -89,7 +89,7 @@ public partial class AvailableTimeComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List> DaysOfWeekElement { - get => _DaysOfWeekElement ?? new List>(); + get => _DaysOfWeekElement ??= []; set { _DaysOfWeekElement = value; OnPropertyChanged("DaysOfWeekElement"); } } @@ -421,7 +421,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -507,7 +507,7 @@ public Hl7.Fhir.Model.ResourceReference? Organization [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -522,7 +522,7 @@ public List Code [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -538,7 +538,7 @@ public List Specialty [DataMember] public List Location { - get => _Location ?? new List(); + get => _Location ??= []; set { _Location = value; OnPropertyChanged("Location"); } } @@ -554,7 +554,7 @@ public List Location [DataMember] public List HealthcareService { - get => _HealthcareService ?? new List(); + get => _HealthcareService ??= []; set { _HealthcareService = value; OnPropertyChanged("HealthcareService"); } } @@ -568,7 +568,7 @@ public List HealthcareService [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -582,7 +582,7 @@ public List Telecom [DataMember] public List AvailableTime { - get => _AvailableTime ?? new List(); + get => _AvailableTime ??= []; set { _AvailableTime = value; OnPropertyChanged("AvailableTime"); } } @@ -596,7 +596,7 @@ public List AvailableTim [DataMember] public List NotAvailable { - get => _NotAvailable ?? new List(); + get => _NotAvailable ??= []; set { _NotAvailable = value; OnPropertyChanged("NotAvailable"); } } @@ -640,7 +640,7 @@ public string? AvailabilityExceptions [DataMember] public List Endpoint { - get => _Endpoint ?? new List(); + get => _Endpoint ??= []; set { _Endpoint = value; OnPropertyChanged("Endpoint"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs b/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs index 9ed8209f2..62713f272 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs @@ -326,7 +326,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -342,7 +342,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -358,7 +358,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -374,7 +374,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -535,7 +535,7 @@ public Hl7.Fhir.Model.DataType? Performed [DataMember] public List Performer { - get => _Performer ?? new List(); + get => _Performer ??= []; set { _Performer = value; OnPropertyChanged("Performer"); } } @@ -565,7 +565,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -581,7 +581,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -596,7 +596,7 @@ public List ReasonReference [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -626,7 +626,7 @@ public Hl7.Fhir.Model.CodeableConcept? Outcome [DataMember] public List Report { - get => _Report ?? new List(); + get => _Report ??= []; set { _Report = value; OnPropertyChanged("Report"); } } @@ -641,7 +641,7 @@ public List Report [DataMember] public List Complication { - get => _Complication ?? new List(); + get => _Complication ??= []; set { _Complication = value; OnPropertyChanged("Complication"); } } @@ -657,7 +657,7 @@ public List Complication [DataMember] public List ComplicationDetail { - get => _ComplicationDetail ?? new List(); + get => _ComplicationDetail ??= []; set { _ComplicationDetail = value; OnPropertyChanged("ComplicationDetail"); } } @@ -672,7 +672,7 @@ public List ComplicationDetail [DataMember] public List FollowUp { - get => _FollowUp ?? new List(); + get => _FollowUp ??= []; set { _FollowUp = value; OnPropertyChanged("FollowUp"); } } @@ -686,7 +686,7 @@ public List FollowUp [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -700,7 +700,7 @@ public List Note [DataMember] public List FocalDevice { - get => _FocalDevice ?? new List(); + get => _FocalDevice ??= []; set { _FocalDevice = value; OnPropertyChanged("FocalDevice"); } } @@ -716,7 +716,7 @@ public List FocalDevice [DataMember] public List UsedReference { - get => _UsedReference ?? new List(); + get => _UsedReference ??= []; set { _UsedReference = value; OnPropertyChanged("UsedReference"); } } @@ -731,7 +731,7 @@ public List UsedReference [DataMember] public List UsedCode { - get => _UsedCode ?? new List(); + get => _UsedCode ??= []; set { _UsedCode = value; OnPropertyChanged("UsedCode"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs index c8253ddaa..b90e21299 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs @@ -188,7 +188,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -204,7 +204,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -220,7 +220,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -236,7 +236,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -384,7 +384,7 @@ public bool? DoNotPerform [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -546,7 +546,7 @@ public Hl7.Fhir.Model.ResourceReference? Performer [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -562,7 +562,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -578,7 +578,7 @@ public List ReasonReference [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -594,7 +594,7 @@ public List SupportingInfo [DataMember] public List Specimen { - get => _Specimen ?? new List(); + get => _Specimen ??= []; set { _Specimen = value; OnPropertyChanged("Specimen"); } } @@ -609,7 +609,7 @@ public List Specimen [DataMember] public List BodySite { - get => _BodySite ?? new List(); + get => _BodySite ??= []; set { _BodySite = value; OnPropertyChanged("BodySite"); } } @@ -623,7 +623,7 @@ public List BodySite [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -639,7 +639,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs index d09d17d82..4dd17277e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs @@ -210,7 +210,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -443,7 +443,7 @@ public string? Reference [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -457,7 +457,7 @@ public List Item [DataMember] public List IncludeElement { - get => _IncludeElement ?? new List(); + get => _IncludeElement ??= []; set { _IncludeElement = value; OnPropertyChanged("IncludeElement"); } } @@ -489,7 +489,7 @@ public IEnumerable? Include [DataMember] public List ExcludeElement { - get => _ExcludeElement ?? new List(); + get => _ExcludeElement ??= []; set { _ExcludeElement = value; OnPropertyChanged("ExcludeElement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs index cf0eba880..142ff7d28 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs @@ -198,7 +198,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -386,7 +386,7 @@ public Hl7.Fhir.Model.CodeableConcept? Form [DataMember] public List ProcessNote { - get => _ProcessNote ?? new List(); + get => _ProcessNote ??= []; set { _ProcessNote = value; OnPropertyChanged("ProcessNote"); } } @@ -401,7 +401,7 @@ public List ProcessNote [DataMember] public List Error { - get => _Error ?? new List(); + get => _Error ??= []; set { _Error = value; OnPropertyChanged("Error"); } } @@ -417,7 +417,7 @@ public List Error [DataMember] public List CommunicationRequest { - get => _CommunicationRequest ?? new List(); + get => _CommunicationRequest ??= []; set { _CommunicationRequest = value; OnPropertyChanged("CommunicationRequest"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs index 017b1491a..e9834d60b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs @@ -129,7 +129,7 @@ public partial class AgentComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Role { - get => _Role ?? new List(); + get => _Role ??= []; set { _Role = value; OnPropertyChanged("Role"); } } @@ -342,7 +342,7 @@ public Hl7.Fhir.Model.DataType? What [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -437,7 +437,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -493,7 +493,7 @@ public DateTimeOffset? Recorded [DataMember] public List PolicyElement { - get => _PolicyElement ?? new List(); + get => _PolicyElement ??= []; set { _PolicyElement = value; OnPropertyChanged("PolicyElement"); } } @@ -541,7 +541,7 @@ public Hl7.Fhir.Model.ResourceReference? Location [DataMember] public List Reason { - get => _Reason ?? new List(); + get => _Reason ??= []; set { _Reason = value; OnPropertyChanged("Reason"); } } @@ -569,7 +569,7 @@ public Hl7.Fhir.Model.Coding? Activity [DataMember] public List Agent { - get => _Agent ?? new List(); + get => _Agent ??= []; set { _Agent = value; OnPropertyChanged("Agent"); } } @@ -583,7 +583,7 @@ public List Agent [DataMember] public List Entity { - get => _Entity ?? new List(); + get => _Entity ??= []; set { _Entity = value; OnPropertyChanged("Entity"); } } @@ -597,7 +597,7 @@ public List Entity [DataMember] public List Signature { - get => _Signature ?? new List(); + get => _Signature ??= []; set { _Signature = value; OnPropertyChanged("Signature"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs index f3993fb73..98062bfcd 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs @@ -251,7 +251,7 @@ public string? Definition [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -352,7 +352,7 @@ public Hl7.Fhir.Model.Questionnaire.QuestionnaireItemType? Type [DataMember] public List EnableWhen { - get => _EnableWhen ?? new List(); + get => _EnableWhen ??= []; set { _EnableWhen = value; OnPropertyChanged("EnableWhen"); } } @@ -493,7 +493,7 @@ public Hl7.Fhir.Model.ResourceReference? Options [DataMember] public List Option { - get => _Option ?? new List(); + get => _Option ??= []; set { _Option = value; OnPropertyChanged("Option"); } } @@ -524,7 +524,7 @@ public Hl7.Fhir.Model.DataType? Initial [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -1019,7 +1019,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1357,7 +1357,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -1372,7 +1372,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -1386,7 +1386,7 @@ public List Jurisdiction [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -1429,7 +1429,7 @@ public string? Copyright [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -1445,7 +1445,7 @@ public List Code [DataMember] public List> SubjectTypeElement { - get => _SubjectTypeElement ?? new List>(); + get => _SubjectTypeElement ??= []; set { _SubjectTypeElement = value; OnPropertyChanged("SubjectTypeElement"); } } @@ -1477,7 +1477,7 @@ public IEnumerable? SubjectType [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs index 8205f0ab2..7a686fab4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs @@ -228,7 +228,7 @@ public Hl7.Fhir.Model.ResourceReference? Subject [DataMember] public List Answer { - get => _Answer ?? new List(); + get => _Answer ??= []; set { _Answer = value; OnPropertyChanged("Answer"); } } @@ -242,7 +242,7 @@ public List Answer [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -396,7 +396,7 @@ public Hl7.Fhir.Model.DataType? Value [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } @@ -495,7 +495,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -511,7 +511,7 @@ public List BasedOn [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -659,7 +659,7 @@ public Hl7.Fhir.Model.ResourceReference? Source [DataMember] public List Item { - get => _Item ?? new List(); + get => _Item ??= []; set { _Item = value; OnPropertyChanged("Item"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs index 4d4ed3856..5f3253a7b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs @@ -187,7 +187,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -203,7 +203,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -219,7 +219,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -235,7 +235,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -369,7 +369,7 @@ public Hl7.Fhir.Model.RequestPriority? Priority [DataMember] public List ServiceRequested { - get => _ServiceRequested ?? new List(); + get => _ServiceRequested ??= []; set { _ServiceRequested = value; OnPropertyChanged("ServiceRequested"); } } @@ -486,7 +486,7 @@ public Hl7.Fhir.Model.CodeableConcept? Specialty [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -501,7 +501,7 @@ public List Recipient [DataMember] public List ReasonCode { - get => _ReasonCode ?? new List(); + get => _ReasonCode ??= []; set { _ReasonCode = value; OnPropertyChanged("ReasonCode"); } } @@ -517,7 +517,7 @@ public List ReasonCode [DataMember] public List ReasonReference { - get => _ReasonReference ?? new List(); + get => _ReasonReference ??= []; set { _ReasonReference = value; OnPropertyChanged("ReasonReference"); } } @@ -561,7 +561,7 @@ public string? Description [DataMember] public List SupportingInfo { - get => _SupportingInfo ?? new List(); + get => _SupportingInfo ??= []; set { _SupportingInfo = value; OnPropertyChanged("SupportingInfo"); } } @@ -575,7 +575,7 @@ public List SupportingInfo [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -591,7 +591,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs index 6b6e0a711..ea4ccec83 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs @@ -70,7 +70,7 @@ public partial class RelatedPerson : Hl7.Fhir.Model.DomainResource, IIdentifiabl [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -142,7 +142,7 @@ public Hl7.Fhir.Model.CodeableConcept? Relationship [DataMember] public List Name { - get => _Name ?? new List(); + get => _Name ??= []; set { _Name = value; OnPropertyChanged("Name"); } } @@ -156,7 +156,7 @@ public List Name [DataMember] public List Telecom { - get => _Telecom ?? new List(); + get => _Telecom ??= []; set { _Telecom = value; OnPropertyChanged("Telecom"); } } @@ -228,7 +228,7 @@ public string? BirthDate [DataMember] public List Address { - get => _Address ?? new List(); + get => _Address ??= []; set { _Address = value; OnPropertyChanged("Address"); } } @@ -242,7 +242,7 @@ public List Address [DataMember] public List Photo { - get => _Photo ?? new List(); + get => _Photo ??= []; set { _Photo = value; OnPropertyChanged("Photo"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs index 236614354..88d34ffa6 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs @@ -198,7 +198,7 @@ public string? TextEquivalent [DataMember] public List Code { - get => _Code ?? new List(); + get => _Code ??= []; set { _Code = value; OnPropertyChanged("Code"); } } @@ -212,7 +212,7 @@ public List Code [DataMember] public List Documentation { - get => _Documentation ?? new List(); + get => _Documentation ??= []; set { _Documentation = value; OnPropertyChanged("Documentation"); } } @@ -226,7 +226,7 @@ public List Documentation [DataMember] public List Condition { - get => _Condition ?? new List(); + get => _Condition ??= []; set { _Condition = value; OnPropertyChanged("Condition"); } } @@ -240,7 +240,7 @@ public List Condition [DataMember] public List RelatedAction { - get => _RelatedAction ?? new List(); + get => _RelatedAction ??= []; set { _RelatedAction = value; OnPropertyChanged("RelatedAction"); } } @@ -271,7 +271,7 @@ public Hl7.Fhir.Model.DataType? Timing [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -464,7 +464,7 @@ public Hl7.Fhir.Model.ResourceReference? Resource [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1081,7 +1081,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1097,7 +1097,7 @@ public List Identifier [DataMember] public List Definition { - get => _Definition ?? new List(); + get => _Definition ??= []; set { _Definition = value; OnPropertyChanged("Definition"); } } @@ -1113,7 +1113,7 @@ public List Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -1129,7 +1129,7 @@ public List BasedOn [DataMember] public List Replaces { - get => _Replaces ?? new List(); + get => _Replaces ??= []; set { _Replaces = value; OnPropertyChanged("Replaces"); } } @@ -1337,7 +1337,7 @@ public Hl7.Fhir.Model.DataType? Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1351,7 +1351,7 @@ public List Note [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs index a18c2acd5..7280bd1db 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs @@ -282,7 +282,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -326,7 +326,7 @@ public string? Title [DataMember] public List Protocol { - get => _Protocol ?? new List(); + get => _Protocol ??= []; set { _Protocol = value; OnPropertyChanged("Protocol"); } } @@ -342,7 +342,7 @@ public List Protocol [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -388,7 +388,7 @@ public Hl7.Fhir.Model.ResearchStudy.ResearchStudyStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -403,7 +403,7 @@ public List Category [DataMember] public List Focus { - get => _Focus ?? new List(); + get => _Focus ??= []; set { _Focus = value; OnPropertyChanged("Focus"); } } @@ -417,7 +417,7 @@ public List Focus [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -431,7 +431,7 @@ public List Contact [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -446,7 +446,7 @@ public List RelatedArtifact [DataMember] public List Keyword { - get => _Keyword ?? new List(); + get => _Keyword ??= []; set { _Keyword = value; OnPropertyChanged("Keyword"); } } @@ -461,7 +461,7 @@ public List Keyword [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -505,7 +505,7 @@ public string? Description [DataMember] public List Enrollment { - get => _Enrollment ?? new List(); + get => _Enrollment ??= []; set { _Enrollment = value; OnPropertyChanged("Enrollment"); } } @@ -564,7 +564,7 @@ public Hl7.Fhir.Model.ResourceReference? PrincipalInvestigator [DataMember] public List Site { - get => _Site ?? new List(); + get => _Site ??= []; set { _Site = value; OnPropertyChanged("Site"); } } @@ -591,7 +591,7 @@ public Hl7.Fhir.Model.CodeableConcept? ReasonStopped [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -605,7 +605,7 @@ public List Note [DataMember] public List Arm { - get => _Arm ?? new List(); + get => _Arm ??= []; set { _Arm = value; OnPropertyChanged("Arm"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs index 224a7b00b..06dfddd8e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs @@ -502,7 +502,7 @@ public Hl7.Fhir.Model.DataType? Reason [DataMember] public List Basis { - get => _Basis ?? new List(); + get => _Basis ??= []; set { _Basis = value; OnPropertyChanged("Basis"); } } @@ -516,7 +516,7 @@ public List Basis [DataMember] public List Prediction { - get => _Prediction ?? new List(); + get => _Prediction ??= []; set { _Prediction = value; OnPropertyChanged("Prediction"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs b/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs index 28fdfb866..48d3e1d76 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs @@ -67,7 +67,7 @@ public partial class Schedule : Hl7.Fhir.Model.DomainResource, IIdentifiable Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -124,7 +124,7 @@ public Hl7.Fhir.Model.CodeableConcept? ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -139,7 +139,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } @@ -155,7 +155,7 @@ public List Specialty [DataMember] public List Actor { - get => _Actor ?? new List(); + get => _Actor ??= []; set { _Actor = value; OnPropertyChanged("Actor"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs index ecafd1c43..1af310283 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs @@ -577,7 +577,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -591,7 +591,7 @@ public List Contact [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -606,7 +606,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -679,7 +679,7 @@ public string? Code [DataMember] public List> BaseElement { - get => _BaseElement ?? new List>(); + get => _BaseElement ??= []; set { _BaseElement = value; OnPropertyChanged("BaseElement"); } } @@ -887,7 +887,7 @@ public Hl7.Fhir.Model.SearchParameter.XPathUsageType? XpathUsage [DataMember] public List> TargetElement { - get => _TargetElement ?? new List>(); + get => _TargetElement ??= []; set { _TargetElement = value; OnPropertyChanged("TargetElement"); } } @@ -921,7 +921,7 @@ public IEnumerable? Target [DataMember] public List> ComparatorElement { - get => _ComparatorElement ?? new List>(); + get => _ComparatorElement ??= []; set { _ComparatorElement = value; OnPropertyChanged("ComparatorElement"); } } @@ -955,7 +955,7 @@ public IEnumerable? Comparator [DataMember] public List> ModifierElement { - get => _ModifierElement ?? new List>(); + get => _ModifierElement ??= []; set { _ModifierElement = value; OnPropertyChanged("ModifierElement"); } } @@ -987,7 +987,7 @@ public IEnumerable? Modifier [DataMember] public List ChainElement { - get => _ChainElement ?? new List(); + get => _ChainElement ??= []; set { _ChainElement = value; OnPropertyChanged("ChainElement"); } } @@ -1019,7 +1019,7 @@ public IEnumerable? Chain [DataMember] public List Component { - get => _Component ?? new List(); + get => _Component ??= []; set { _Component = value; OnPropertyChanged("Component"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs b/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs index 5c79f7537..87338f61a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs @@ -1579,7 +1579,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1737,7 +1737,7 @@ public Hl7.Fhir.Model.Sequence.ReferenceSeqComponent? ReferenceSeq [DataMember] public List Variant { - get => _Variant ?? new List(); + get => _Variant ??= []; set { _Variant = value; OnPropertyChanged("Variant"); } } @@ -1779,7 +1779,7 @@ public string? ObservedSeq [DataMember] public List Quality { - get => _Quality ?? new List(); + get => _Quality ??= []; set { _Quality = value; OnPropertyChanged("Quality"); } } @@ -1821,7 +1821,7 @@ public int? ReadCoverage [DataMember] public List Repository { - get => _Repository ?? new List(); + get => _Repository ??= []; set { _Repository = value; OnPropertyChanged("Repository"); } } @@ -1837,7 +1837,7 @@ public List Repository [DataMember] public List Pointer { - get => _Pointer ?? new List(); + get => _Pointer ??= []; set { _Pointer = value; OnPropertyChanged("Pointer"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs index 27b2772ab..0bfaa0b11 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs @@ -98,7 +98,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -464,7 +464,7 @@ public Hl7.Fhir.Model.Period? EffectivePeriod [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -479,7 +479,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -494,7 +494,7 @@ public List Jurisdiction [DataMember] public List Topic { - get => _Topic ?? new List(); + get => _Topic ??= []; set { _Topic = value; OnPropertyChanged("Topic"); } } @@ -508,7 +508,7 @@ public List Topic [DataMember] public List Contributor { - get => _Contributor ?? new List(); + get => _Contributor ??= []; set { _Contributor = value; OnPropertyChanged("Contributor"); } } @@ -522,7 +522,7 @@ public List Contributor [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -564,7 +564,7 @@ public string? Copyright [DataMember] public List RelatedArtifact { - get => _RelatedArtifact ?? new List(); + get => _RelatedArtifact ??= []; set { _RelatedArtifact = value; OnPropertyChanged("RelatedArtifact"); } } @@ -578,7 +578,7 @@ public List RelatedArtifact [DataMember] public List Trigger { - get => _Trigger ?? new List(); + get => _Trigger ??= []; set { _Trigger = value; OnPropertyChanged("Trigger"); } } @@ -592,7 +592,7 @@ public List Trigger [DataMember] public List DataRequirement { - get => _DataRequirement ?? new List(); + get => _DataRequirement ??= []; set { _DataRequirement = value; OnPropertyChanged("DataRequirement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs b/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs index 2e7baeb2a..6213173fb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs @@ -107,7 +107,7 @@ public enum SlotStatus [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -136,7 +136,7 @@ public Hl7.Fhir.Model.CodeableConcept? ServiceCategory [DataMember] public List ServiceType { - get => _ServiceType ?? new List(); + get => _ServiceType ??= []; set { _ServiceType = value; OnPropertyChanged("ServiceType"); } } @@ -151,7 +151,7 @@ public List ServiceType [DataMember] public List Specialty { - get => _Specialty ?? new List(); + get => _Specialty ??= []; set { _Specialty = value; OnPropertyChanged("Specialty"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs b/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs index d35285f9a..57c0bc22c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs @@ -348,7 +348,7 @@ public Hl7.Fhir.Model.CodeableConcept? Procedure [DataMember] public List Additive { - get => _Additive ?? new List(); + get => _Additive ??= []; set { _Additive = value; OnPropertyChanged("Additive"); } } @@ -481,7 +481,7 @@ public partial class ContainerComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -686,7 +686,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -803,7 +803,7 @@ public string? ReceivedTime [DataMember] public List Parent { - get => _Parent ?? new List(); + get => _Parent ??= []; set { _Parent = value; OnPropertyChanged("Parent"); } } @@ -819,7 +819,7 @@ public List Parent [DataMember] public List Request { - get => _Request ?? new List(); + get => _Request ??= []; set { _Request = value; OnPropertyChanged("Request"); } } @@ -846,7 +846,7 @@ public Hl7.Fhir.Model.Specimen.CollectionComponent? Collection [DataMember] public List Processing { - get => _Processing ?? new List(); + get => _Processing ??= []; set { _Processing = value; OnPropertyChanged("Processing"); } } @@ -860,7 +860,7 @@ public List Processing [DataMember] public List Container { - get => _Container ?? new List(); + get => _Container ??= []; set { _Container = value; OnPropertyChanged("Container"); } } @@ -874,7 +874,7 @@ public List Container [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs index 4e17dd06e..8b2eb87aa 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs @@ -387,7 +387,7 @@ public partial class SnapshotComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -478,7 +478,7 @@ public partial class DifferentialComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Element { - get => _Element ?? new List(); + get => _Element ??= []; set { _Element = value; OnPropertyChanged("Element"); } } @@ -582,7 +582,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -796,7 +796,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -838,7 +838,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -853,7 +853,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -924,7 +924,7 @@ public string? Copyright [DataMember] public List Keyword { - get => _Keyword ?? new List(); + get => _Keyword ??= []; set { _Keyword = value; OnPropertyChanged("Keyword"); } } @@ -966,7 +966,7 @@ public string? FhirVersion [DataMember] public List Mapping { - get => _Mapping ?? new List(); + get => _Mapping ??= []; set { _Mapping = value; OnPropertyChanged("Mapping"); } } @@ -1070,7 +1070,7 @@ public Hl7.Fhir.Model.StructureDefinition.ExtensionContext? ContextType [DataMember] public List ContextElement { - get => _ContextElement ?? new List(); + get => _ContextElement ??= []; set { _ContextElement = value; OnPropertyChanged("ContextElement"); } } @@ -1102,7 +1102,7 @@ public IEnumerable? Context [DataMember] public List ContextInvariantElement { - get => _ContextInvariantElement ?? new List(); + get => _ContextInvariantElement ??= []; set { _ContextInvariantElement = value; OnPropertyChanged("ContextInvariantElement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs index 37d5fbe2c..fa5bcad49 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs @@ -712,7 +712,7 @@ public string? Documentation [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -726,7 +726,7 @@ public List Input [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1109,7 +1109,7 @@ public string? Name [DataMember] public List Source { - get => _Source ?? new List(); + get => _Source ??= []; set { _Source = value; OnPropertyChanged("Source"); } } @@ -1123,7 +1123,7 @@ public List Source [DataMember] public List Target { - get => _Target ?? new List(); + get => _Target ??= []; set { _Target = value; OnPropertyChanged("Target"); } } @@ -1137,7 +1137,7 @@ public List Target [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -1151,7 +1151,7 @@ public List Rule [DataMember] public List Dependent { - get => _Dependent ?? new List(); + get => _Dependent ??= []; set { _Dependent = value; OnPropertyChanged("Dependent"); } } @@ -1853,7 +1853,7 @@ public string? Variable [DataMember] public List> ListModeElement { - get => _ListModeElement ?? new List>(); + get => _ListModeElement ??= []; set { _ListModeElement = value; OnPropertyChanged("ListModeElement"); } } @@ -1943,7 +1943,7 @@ public Hl7.Fhir.Model.StructureMap.StructureMapTransform? Transform [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -2213,7 +2213,7 @@ public string? Name [DataMember] public List VariableElement { - get => _VariableElement ?? new List(); + get => _VariableElement ??= []; set { _VariableElement = value; OnPropertyChanged("VariableElement"); } } @@ -2344,7 +2344,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -2558,7 +2558,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2600,7 +2600,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2615,7 +2615,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -2685,7 +2685,7 @@ public string? Copyright [DataMember] public List Structure { - get => _Structure ?? new List(); + get => _Structure ??= []; set { _Structure = value; OnPropertyChanged("Structure"); } } @@ -2699,7 +2699,7 @@ public List Structure [DataMember] public List ImportElement { - get => _ImportElement ?? new List(); + get => _ImportElement ??= []; set { _ImportElement = value; OnPropertyChanged("ImportElement"); } } @@ -2731,7 +2731,7 @@ public IEnumerable? Import [DataMember] public List Group { - get => _Group ?? new List(); + get => _Group ??= []; set { _Group = value; OnPropertyChanged("Group"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs index 42b28121e..cdd8675f6 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs @@ -247,7 +247,7 @@ public string? Payload [DataMember] public List HeaderElement { - get => _HeaderElement ?? new List(); + get => _HeaderElement ??= []; set { _HeaderElement = value; OnPropertyChanged("HeaderElement"); } } @@ -398,7 +398,7 @@ public Hl7.Fhir.Model.Subscription.SubscriptionStatus? Status [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -541,7 +541,7 @@ public Hl7.Fhir.Model.Subscription.ChannelComponent? Channel [DataMember] public List Tag { - get => _Tag ?? new List(); + get => _Tag ??= []; set { _Tag = value; OnPropertyChanged("Tag"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs index 07e5e41b2..05043a938 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs @@ -361,7 +361,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -406,7 +406,7 @@ public Hl7.Fhir.Model.Substance.FHIRSubstanceStatus? Status [DataMember] public List Category { - get => _Category ?? new List(); + get => _Category ??= []; set { _Category = value; OnPropertyChanged("Category"); } } @@ -463,7 +463,7 @@ public string? Description [DataMember] public List Instance { - get => _Instance ?? new List(); + get => _Instance ??= []; set { _Instance = value; OnPropertyChanged("Instance"); } } @@ -477,7 +477,7 @@ public List Instance [DataMember] public List Ingredient { - get => _Ingredient ?? new List(); + get => _Ingredient ??= []; set { _Ingredient = value; OnPropertyChanged("Ingredient"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs index 0954367a9..290066ca7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs @@ -257,7 +257,7 @@ public Hl7.Fhir.Model.Identifier? Identifier [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -273,7 +273,7 @@ public List BasedOn [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -406,7 +406,7 @@ public Hl7.Fhir.Model.ResourceReference? Destination [DataMember] public List Receiver { - get => _Receiver ?? new List(); + get => _Receiver ??= []; set { _Receiver = value; OnPropertyChanged("Receiver"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs index 9748a4d19..935979951 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs @@ -511,7 +511,7 @@ public Hl7.Fhir.Model.SupplyRequest.RequesterComponent? Requester [DataMember] public List Supplier { - get => _Supplier ?? new List(); + get => _Supplier ??= []; set { _Supplier = value; OnPropertyChanged("Supplier"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Task.cs b/src/Hl7.Fhir.STU3/Model/Generated/Task.cs index fc2a0eed4..fbe204ab5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Task.cs @@ -325,7 +325,7 @@ public Hl7.Fhir.Model.Period? Period [DataMember] public List Recipient { - get => _Recipient ?? new List(); + get => _Recipient ??= []; set { _Recipient = value; OnPropertyChanged("Recipient"); } } @@ -652,7 +652,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -684,7 +684,7 @@ public Hl7.Fhir.Model.DataType? Definition [DataMember] public List BasedOn { - get => _BasedOn ?? new List(); + get => _BasedOn ??= []; set { _BasedOn = value; OnPropertyChanged("BasedOn"); } } @@ -713,7 +713,7 @@ public Hl7.Fhir.Model.Identifier? GroupIdentifier [DataMember] public List PartOf { - get => _PartOf ?? new List(); + get => _PartOf ??= []; set { _PartOf = value; OnPropertyChanged("PartOf"); } } @@ -1017,7 +1017,7 @@ public Hl7.Fhir.Model.Task.RequesterComponent? Requester [DataMember] public List PerformerType { - get => _PerformerType ?? new List(); + get => _PerformerType ??= []; set { _PerformerType = value; OnPropertyChanged("PerformerType"); } } @@ -1060,7 +1060,7 @@ public Hl7.Fhir.Model.CodeableConcept? Reason [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -1076,7 +1076,7 @@ public List Note [DataMember] public List RelevantHistory { - get => _RelevantHistory ?? new List(); + get => _RelevantHistory ??= []; set { _RelevantHistory = value; OnPropertyChanged("RelevantHistory"); } } @@ -1103,7 +1103,7 @@ public Hl7.Fhir.Model.Task.RestrictionComponent? Restriction [DataMember] public List Input { - get => _Input ?? new List(); + get => _Input ??= []; set { _Input = value; OnPropertyChanged("Input"); } } @@ -1117,7 +1117,7 @@ public List Input [DataMember] public List Output { - get => _Output ?? new List(); + get => _Output ??= []; set { _Output = value; OnPropertyChanged("Output"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs index 5cc94f0e8..c3308601e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs @@ -399,7 +399,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1020,7 +1020,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1242,7 +1242,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -1612,7 +1612,7 @@ public string? Issued [DataMember] public List Participant { - get => _Participant ?? new List(); + get => _Participant ??= []; set { _Participant = value; OnPropertyChanged("Participant"); } } @@ -1639,7 +1639,7 @@ public Hl7.Fhir.Model.TestReport.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs index 11a509ce2..22a9c1a23 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs @@ -608,7 +608,7 @@ public partial class MetadataComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Link { - get => _Link ?? new List(); + get => _Link ??= []; set { _Link = value; OnPropertyChanged("Link"); } } @@ -622,7 +622,7 @@ public List Link [DataMember] public List Capability { - get => _Capability ?? new List(); + get => _Capability ??= []; set { _Capability = value; OnPropertyChanged("Capability"); } } @@ -950,7 +950,7 @@ public string? Description [DataMember] public List OriginElement { - get => _OriginElement ?? new List(); + get => _OriginElement ??= []; set { _OriginElement = value; OnPropertyChanged("OriginElement"); } } @@ -1010,7 +1010,7 @@ public int? Destination [DataMember] public List LinkElement { - get => _LinkElement ?? new List(); + get => _LinkElement ??= []; set { _LinkElement = value; OnPropertyChanged("LinkElement"); } } @@ -1738,7 +1738,7 @@ public Hl7.Fhir.Model.ResourceReference? Resource [DataMember] public List Param { - get => _Param ?? new List(); + get => _Param ??= []; set { _Param = value; OnPropertyChanged("Param"); } } @@ -1999,7 +1999,7 @@ public Hl7.Fhir.Model.ResourceReference? Resource [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -2129,7 +2129,7 @@ public string? RuleId [DataMember] public List Param { - get => _Param ?? new List(); + get => _Param ??= []; set { _Param = value; OnPropertyChanged("Param"); } } @@ -2370,7 +2370,7 @@ public partial class SetupComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -2846,7 +2846,7 @@ public string? Params [DataMember] public List RequestHeader { - get => _RequestHeader ?? new List(); + get => _RequestHeader ??= []; set { _RequestHeader = value; OnPropertyChanged("RequestHeader"); } } @@ -4326,7 +4326,7 @@ public string? RuleId [DataMember] public List Param { - get => _Param ?? new List(); + get => _Param ??= []; set { _Param = value; OnPropertyChanged("Param"); } } @@ -4601,7 +4601,7 @@ public string? RulesetId [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -4731,7 +4731,7 @@ public string? RuleId [DataMember] public List Param { - get => _Param ?? new List(); + get => _Param ??= []; set { _Param = value; OnPropertyChanged("Param"); } } @@ -5029,7 +5029,7 @@ public string? Description [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -5251,7 +5251,7 @@ public partial class TeardownComponent : Hl7.Fhir.Model.BackboneElement [DataMember] public List Action { - get => _Action ?? new List(); + get => _Action ??= []; set { _Action = value; OnPropertyChanged("Action"); } } @@ -5660,7 +5660,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -5702,7 +5702,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -5717,7 +5717,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } @@ -5787,7 +5787,7 @@ public string? Copyright [DataMember] public List Origin { - get => _Origin ?? new List(); + get => _Origin ??= []; set { _Origin = value; OnPropertyChanged("Origin"); } } @@ -5801,7 +5801,7 @@ public List Origin [DataMember] public List Destination { - get => _Destination ?? new List(); + get => _Destination ??= []; set { _Destination = value; OnPropertyChanged("Destination"); } } @@ -5828,7 +5828,7 @@ public Hl7.Fhir.Model.TestScript.MetadataComponent? Metadata [DataMember] public List Fixture { - get => _Fixture ?? new List(); + get => _Fixture ??= []; set { _Fixture = value; OnPropertyChanged("Fixture"); } } @@ -5844,7 +5844,7 @@ public List Fixture [DataMember] public List Profile { - get => _Profile ?? new List(); + get => _Profile ??= []; set { _Profile = value; OnPropertyChanged("Profile"); } } @@ -5858,7 +5858,7 @@ public List Profile [DataMember] public List Variable { - get => _Variable ?? new List(); + get => _Variable ??= []; set { _Variable = value; OnPropertyChanged("Variable"); } } @@ -5872,7 +5872,7 @@ public List Variable [DataMember] public List Rule { - get => _Rule ?? new List(); + get => _Rule ??= []; set { _Rule = value; OnPropertyChanged("Rule"); } } @@ -5886,7 +5886,7 @@ public List Rule [DataMember] public List Ruleset { - get => _Ruleset ?? new List(); + get => _Ruleset ??= []; set { _Ruleset = value; OnPropertyChanged("Ruleset"); } } @@ -5913,7 +5913,7 @@ public Hl7.Fhir.Model.TestScript.SetupComponent? Setup [DataMember] public List Test { - get => _Test ?? new List(); + get => _Test ??= []; set { _Test = value; OnPropertyChanged("Test"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs index b5f60d580..0a6892e3d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs @@ -568,7 +568,7 @@ public Hl7.Fhir.Model.Timing.UnitsOfTime? PeriodUnit [DataMember] public List> DayOfWeekElement { - get => _DayOfWeekElement ?? new List>(); + get => _DayOfWeekElement ??= []; set { _DayOfWeekElement = value; OnPropertyChanged("DayOfWeekElement"); } } @@ -600,7 +600,7 @@ public IEnumerable? DayOfWeek [DataMember] public List TimeOfDayElement { - get => _TimeOfDayElement ?? new List(); + get => _TimeOfDayElement ??= []; set { _TimeOfDayElement = value; OnPropertyChanged("TimeOfDayElement"); } } @@ -634,7 +634,7 @@ public IEnumerable? TimeOfDay [DataMember] public List> WhenElement { - get => _WhenElement ?? new List>(); + get => _WhenElement ??= []; set { _WhenElement = value; OnPropertyChanged("WhenElement"); } } @@ -881,7 +881,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List EventElement { - get => _EventElement ?? new List(); + get => _EventElement ??= []; set { _EventElement = value; OnPropertyChanged("EventElement"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs index a65cb614f..4c465c3b0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs @@ -142,7 +142,7 @@ public bool? Inactive [DataMember] public List Include { - get => _Include ?? new List(); + get => _Include ??= []; set { _Include = value; OnPropertyChanged("Include"); } } @@ -156,7 +156,7 @@ public List Include [DataMember] public List Exclude { - get => _Exclude ?? new List(); + get => _Exclude ??= []; set { _Exclude = value; OnPropertyChanged("Exclude"); } } @@ -330,7 +330,7 @@ public string? Version [DataMember] public List Concept { - get => _Concept ?? new List(); + get => _Concept ??= []; set { _Concept = value; OnPropertyChanged("Concept"); } } @@ -344,7 +344,7 @@ public List Concept [DataMember] public List Filter { - get => _Filter ?? new List(); + get => _Filter ??= []; set { _Filter = value; OnPropertyChanged("Filter"); } } @@ -358,7 +358,7 @@ public List Filter [DataMember] public List ValueSetElement { - get => _ValueSetElement ?? new List(); + get => _ValueSetElement ??= []; set { _ValueSetElement = value; OnPropertyChanged("ValueSetElement"); } } @@ -561,7 +561,7 @@ public string? Display [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -1137,7 +1137,7 @@ public int? Offset [DataMember] public List Parameter { - get => _Parameter ?? new List(); + get => _Parameter ??= []; set { _Parameter = value; OnPropertyChanged("Parameter"); } } @@ -1151,7 +1151,7 @@ public List Parameter [DataMember] public List Contains { - get => _Contains ?? new List(); + get => _Contains ??= []; set { _Contains = value; OnPropertyChanged("Contains"); } } @@ -1586,7 +1586,7 @@ public string? Display [DataMember] public List Designation { - get => _Designation ?? new List(); + get => _Designation ??= []; set { _Designation = value; OnPropertyChanged("Designation"); } } @@ -1600,7 +1600,7 @@ public List Designation [DataMember] public List Contains { - get => _Contains ?? new List(); + get => _Contains ??= []; set { _Contains = value; OnPropertyChanged("Contains"); } } @@ -1766,7 +1766,7 @@ public string? Url [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -1979,7 +1979,7 @@ public string? Publisher [DataMember] public List Contact { - get => _Contact ?? new List(); + get => _Contact ??= []; set { _Contact = value; OnPropertyChanged("Contact"); } } @@ -2021,7 +2021,7 @@ public string? Description [DataMember] public List UseContext { - get => _UseContext ?? new List(); + get => _UseContext ??= []; set { _UseContext = value; OnPropertyChanged("UseContext"); } } @@ -2036,7 +2036,7 @@ public List UseContext [DataMember] public List Jurisdiction { - get => _Jurisdiction ?? new List(); + get => _Jurisdiction ??= []; set { _Jurisdiction = value; OnPropertyChanged("Jurisdiction"); } } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs index 78cda4767..14e640d39 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs @@ -509,7 +509,7 @@ public string? Brand [DataMember] public List Note { - get => _Note ?? new List(); + get => _Note ??= []; set { _Note = value; OnPropertyChanged("Note"); } } @@ -710,7 +710,7 @@ public override IEnumerable> EnumerateElements() [DataMember] public List Identifier { - get => _Identifier ?? new List(); + get => _Identifier ??= []; set { _Identifier = value; OnPropertyChanged("Identifier"); } } @@ -843,7 +843,7 @@ public Hl7.Fhir.Model.DataType? Reason [DataMember] public List Dispense { - get => _Dispense ?? new List(); + get => _Dispense ??= []; set { _Dispense = value; OnPropertyChanged("Dispense"); } } From 43daa7cb42e862713cd85d7ca5f310fb9d73683e Mon Sep 17 00:00:00 2001 From: Ewout Kramer Date: Mon, 24 Feb 2025 17:48:50 +0100 Subject: [PATCH 5/6] Herlper properies that are lists should not be null. --- src/Hl7.Fhir.Base/Model/Generated/Meta.cs | 8 +-- .../Model/Generated/OperationOutcome.cs | 8 +-- .../Model/Generated/CapabilityStatement.cs | 44 +++++++------- .../Model/Generated/CodeSystem.cs | 4 +- .../Model/Generated/ElementDefinition.cs | 28 ++++----- .../Model/Generated/StructureDefinition.cs | 4 +- .../Model/Generated/ValueSet.cs | 8 +-- .../Model/Generated/ActivityDefinition.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/Address.cs | 4 +- .../Model/Generated/AllergyIntolerance.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs | 16 ++--- src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs | 8 +-- .../Model/Generated/ChargeItemDefinition.cs | 12 ++-- src/Hl7.Fhir.R4/Model/Generated/Claim.cs | 20 +++---- .../Model/Generated/ClaimResponse.cs | 36 +++++------ .../Model/Generated/ClinicalImpression.cs | 4 +- .../Model/Generated/Communication.cs | 8 +-- .../Model/Generated/CompartmentDefinition.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/Contract.cs | 60 +++++++++---------- .../Generated/CoverageEligibilityRequest.cs | 8 +-- .../Generated/CoverageEligibilityResponse.cs | 4 +- .../Model/Generated/DataRequirement.cs | 8 +-- .../Model/Generated/DeviceDefinition.cs | 4 +- .../Model/Generated/DeviceRequest.cs | 8 +-- src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs | 8 +-- .../Model/Generated/ExampleScenario.cs | 4 +- .../Model/Generated/ExplanationOfBenefit.cs | 60 +++++++++---------- .../Model/Generated/FamilyMemberHistory.cs | 8 +-- .../Model/Generated/HealthcareService.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/HumanName.cs | 12 ++-- .../Model/Generated/ImplementationGuide.cs | 20 +++---- .../Model/Generated/InsurancePlan.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/Location.cs | 8 +-- src/Hl7.Fhir.R4/Model/Generated/Measure.cs | 8 +-- .../Generated/MedicationAdministration.cs | 4 +- .../Model/Generated/MedicationKnowledge.cs | 8 +-- .../Model/Generated/MedicationRequest.cs | 8 +-- .../Model/Generated/MedicinalProduct.cs | 4 +- .../Model/Generated/MessageDefinition.cs | 12 ++-- .../Model/Generated/MolecularSequence.cs | 28 ++++----- .../Model/Generated/NutritionOrder.cs | 12 ++-- .../Model/Generated/ObservationDefinition.cs | 4 +- .../Model/Generated/OperationDefinition.cs | 12 ++-- .../Model/Generated/Organization.cs | 4 +- .../Model/Generated/PlanDefinition.cs | 8 +-- .../Model/Generated/PractitionerRole.cs | 4 +- src/Hl7.Fhir.R4/Model/Generated/Procedure.cs | 8 +-- .../Model/Generated/ProdCharacteristic.cs | 8 +-- src/Hl7.Fhir.R4/Model/Generated/Provenance.cs | 4 +- .../Model/Generated/Questionnaire.cs | 8 +-- .../Model/Generated/RequestGroup.cs | 8 +-- .../Model/Generated/ResearchDefinition.cs | 8 +-- .../Generated/ResearchElementDefinition.cs | 8 +-- .../Model/Generated/SearchParameter.cs | 20 +++---- .../Model/Generated/ServiceRequest.cs | 8 +-- .../Model/Generated/StructureMap.cs | 12 ++-- .../Model/Generated/Subscription.cs | 4 +- .../Model/Generated/SubstancePolymer.cs | 4 +- .../Model/Generated/SubstanceProtein.cs | 4 +- .../Generated/SubstanceSourceMaterial.cs | 8 +-- .../Generated/TerminologyCapabilities.cs | 12 ++-- src/Hl7.Fhir.R4/Model/Generated/TestScript.cs | 8 +-- src/Hl7.Fhir.R4/Model/Generated/Timing.cs | 16 ++--- .../Model/Generated/VerificationResult.cs | 4 +- .../Model/Generated/ActivityDefinition.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/Address.cs | 4 +- .../Model/Generated/AllergyIntolerance.cs | 4 +- .../Model/Generated/AuditEvent.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs | 16 ++--- .../Model/Generated/ChargeItem.cs | 8 +-- .../Model/Generated/ChargeItemDefinition.cs | 12 ++-- src/Hl7.Fhir.R4B/Model/Generated/Claim.cs | 20 +++---- .../Model/Generated/ClaimResponse.cs | 36 +++++------ .../Model/Generated/ClinicalImpression.cs | 4 +- .../Model/Generated/Communication.cs | 8 +-- .../Model/Generated/CompartmentDefinition.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/Contract.cs | 60 +++++++++---------- .../Generated/CoverageEligibilityRequest.cs | 8 +-- .../Generated/CoverageEligibilityResponse.cs | 4 +- .../Model/Generated/DataRequirement.cs | 8 +-- .../Model/Generated/DeviceDefinition.cs | 4 +- .../Model/Generated/DeviceRequest.cs | 8 +-- src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs | 8 +-- .../Model/Generated/ExampleScenario.cs | 4 +- .../Model/Generated/ExplanationOfBenefit.cs | 60 +++++++++---------- .../Model/Generated/FamilyMemberHistory.cs | 8 +-- .../Model/Generated/HealthcareService.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs | 12 ++-- .../Model/Generated/ImplementationGuide.cs | 20 +++---- .../Model/Generated/InsurancePlan.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/Location.cs | 8 +-- src/Hl7.Fhir.R4B/Model/Generated/Measure.cs | 8 +-- .../Generated/MedicationAdministration.cs | 4 +- .../Model/Generated/MedicationKnowledge.cs | 8 +-- .../Model/Generated/MedicationRequest.cs | 8 +-- .../Model/Generated/MessageDefinition.cs | 12 ++-- .../Model/Generated/MolecularSequence.cs | 28 ++++----- .../Model/Generated/NutritionOrder.cs | 12 ++-- .../Model/Generated/ObservationDefinition.cs | 4 +- .../Model/Generated/OperationDefinition.cs | 12 ++-- .../Model/Generated/Organization.cs | 4 +- .../Model/Generated/PlanDefinition.cs | 8 +-- .../Model/Generated/PractitionerRole.cs | 4 +- src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs | 8 +-- .../Model/Generated/ProdCharacteristic.cs | 8 +-- .../Model/Generated/Provenance.cs | 4 +- .../Model/Generated/Questionnaire.cs | 8 +-- .../Model/Generated/RequestGroup.cs | 8 +-- .../Model/Generated/ResearchDefinition.cs | 8 +-- .../Generated/ResearchElementDefinition.cs | 8 +-- .../Model/Generated/SearchParameter.cs | 20 +++---- .../Model/Generated/ServiceRequest.cs | 8 +-- .../Model/Generated/StructureMap.cs | 12 ++-- .../Model/Generated/Subscription.cs | 4 +- .../Model/Generated/SubscriptionTopic.cs | 20 +++---- .../Generated/TerminologyCapabilities.cs | 12 ++-- .../Model/Generated/TestScript.cs | 8 +-- src/Hl7.Fhir.R4B/Model/Generated/Timing.cs | 16 ++--- .../Model/Generated/VerificationResult.cs | 4 +- .../Model/Generated/ActivityDefinition.cs | 16 ++--- .../Model/Generated/ActorDefinition.cs | 8 +-- src/Hl7.Fhir.R5/Model/Generated/Address.cs | 4 +- .../Model/Generated/AllergyIntolerance.cs | 4 +- .../Model/Generated/Appointment.cs | 12 ++-- .../Model/Generated/ArtifactAssessment.cs | 4 +- src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs | 4 +- .../Model/Generated/Availability.cs | 4 +- src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs | 8 +-- src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs | 8 +-- .../Model/Generated/ChargeItemDefinition.cs | 12 ++-- src/Hl7.Fhir.R5/Model/Generated/Claim.cs | 20 +++---- .../Model/Generated/ClaimResponse.cs | 40 ++++++------- .../Model/Generated/ClinicalImpression.cs | 4 +- .../Model/Generated/ClinicalUseDefinition.cs | 4 +- .../Model/Generated/Communication.cs | 8 +-- .../Model/Generated/CompartmentDefinition.cs | 4 +- .../Model/Generated/ConditionDefinition.cs | 4 +- src/Hl7.Fhir.R5/Model/Generated/Consent.cs | 4 +- src/Hl7.Fhir.R5/Model/Generated/Contract.cs | 56 ++++++++--------- .../Generated/CoverageEligibilityRequest.cs | 8 +-- .../Generated/CoverageEligibilityResponse.cs | 8 +-- .../Model/Generated/DataRequirement.cs | 8 +-- .../Model/Generated/DeviceDefinition.cs | 8 +-- .../Model/Generated/DeviceRequest.cs | 8 +-- src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs | 8 +-- .../Model/Generated/ExplanationOfBenefit.cs | 60 +++++++++---------- .../Model/Generated/FamilyMemberHistory.cs | 8 +-- src/Hl7.Fhir.R5/Model/Generated/HumanName.cs | 12 ++-- .../Model/Generated/ImagingSelection.cs | 12 ++-- .../Model/Generated/ImplementationGuide.cs | 28 ++++----- .../Model/Generated/InsurancePlan.cs | 4 +- src/Hl7.Fhir.R5/Model/Generated/Location.cs | 4 +- src/Hl7.Fhir.R5/Model/Generated/Measure.cs | 8 +-- .../Model/Generated/MedicationKnowledge.cs | 4 +- .../Model/Generated/MessageDefinition.cs | 8 +-- .../Model/Generated/NutritionIntake.cs | 8 +-- .../Model/Generated/NutritionOrder.cs | 12 ++-- .../Model/Generated/ObservationDefinition.cs | 16 ++--- .../Model/Generated/OperationDefinition.cs | 20 +++---- .../Model/Generated/Organization.cs | 4 +- src/Hl7.Fhir.R5/Model/Generated/Permission.cs | 4 +- .../Model/Generated/PlanDefinition.cs | 8 +-- src/Hl7.Fhir.R5/Model/Generated/Procedure.cs | 8 +-- src/Hl7.Fhir.R5/Model/Generated/Provenance.cs | 4 +- .../Model/Generated/Questionnaire.cs | 8 +-- .../Model/Generated/RequestOrchestration.cs | 8 +-- .../Model/Generated/Requirements.cs | 24 ++++---- .../Model/Generated/SearchParameter.cs | 20 +++---- .../Model/Generated/ServiceRequest.cs | 8 +-- .../Model/Generated/SpecimenDefinition.cs | 8 +-- .../Model/Generated/StructureMap.cs | 8 +-- .../Model/Generated/SubscriptionTopic.cs | 24 ++++---- .../Model/Generated/SubstanceProtein.cs | 4 +- .../Generated/SubstanceSourceMaterial.cs | 8 +-- .../Generated/TerminologyCapabilities.cs | 12 ++-- src/Hl7.Fhir.R5/Model/Generated/TestScript.cs | 12 ++-- src/Hl7.Fhir.R5/Model/Generated/Timing.cs | 16 ++--- .../Model/Generated/VerificationResult.cs | 4 +- .../Model/Generated/VirtualServiceDetail.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Address.cs | 4 +- .../Model/Generated/AllergyIntolerance.cs | 4 +- .../Model/Generated/AuditEvent.cs | 4 +- .../Model/Generated/CapabilityStatement.cs | 32 +++++----- .../Model/Generated/ChargeItem.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Claim.cs | 20 +++---- .../Model/Generated/ClaimResponse.cs | 28 ++++----- .../Model/Generated/ClinicalImpression.cs | 4 +- .../Model/Generated/CodeSystem.cs | 4 +- .../Model/Generated/CompartmentDefinition.cs | 4 +- .../Model/Generated/Composition.cs | 4 +- .../Model/Generated/DataRequirement.cs | 12 ++-- .../Model/Generated/ElementDefinition.cs | 16 ++--- src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs | 8 +-- .../Model/Generated/ExplanationOfBenefit.cs | 44 +++++++------- .../Model/Generated/HealthcareService.cs | 8 +-- .../Model/Generated/HumanName.cs | 12 ++-- .../Model/Generated/ImplementationGuide.cs | 12 ++-- src/Hl7.Fhir.STU3/Model/Generated/Location.cs | 4 +- src/Hl7.Fhir.STU3/Model/Generated/Measure.cs | 4 +- .../Model/Generated/OperationDefinition.cs | 8 +-- .../Model/Generated/Organization.cs | 4 +- .../Model/Generated/PlanDefinition.cs | 4 +- .../Model/Generated/PractitionerRole.cs | 4 +- .../Model/Generated/ProcessRequest.cs | 8 +-- .../Model/Generated/Provenance.cs | 4 +- .../Model/Generated/Questionnaire.cs | 4 +- .../Model/Generated/SearchParameter.cs | 20 +++---- .../Model/Generated/StructureDefinition.cs | 8 +-- .../Model/Generated/StructureMap.cs | 12 ++-- .../Model/Generated/Subscription.cs | 4 +- .../Model/Generated/TestScript.cs | 8 +-- src/Hl7.Fhir.STU3/Model/Generated/Timing.cs | 16 ++--- src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs | 4 +- 214 files changed, 1172 insertions(+), 1172 deletions(-) diff --git a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs index a68afa6d7..bc3425f22 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs @@ -178,9 +178,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProfileUri + public IEnumerable ProfileUri { - get => _ProfileElement?.Cast>()?.Select(elem => elem.Value); + get => _ProfileElement?.Cast>()?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -196,9 +196,9 @@ public IEnumerable? ProfileUri /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Cast>()?.Select(elem => elem.Value); + get => _ProfileElement?.Cast>()?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs index 2bb07b803..fd66f0137 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs @@ -451,9 +451,9 @@ public List LocationElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Location + public IEnumerable Location { - get => _LocationElement?.Select(elem => elem.Value); + get => _LocationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -483,9 +483,9 @@ public List ExpressionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Expression + public IEnumerable Expression { - get => _ExpressionElement?.Select(elem => elem.Value); + get => _ExpressionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs index db68421e2..ff9b060c9 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs @@ -893,9 +893,9 @@ public List CompartmentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Compartment + public IEnumerable Compartment { - get => _CompartmentElement?.Select(elem => elem.Value); + get => _CompartmentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1290,9 +1290,9 @@ public List SupportedProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SupportedProfile + public IEnumerable SupportedProfile { - get => _SupportedProfileElement?.Select(elem => elem.Value); + get => _SupportedProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1599,9 +1599,9 @@ public List> Re /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ReferencePolicy + public IEnumerable ReferencePolicy { - get => _ReferencePolicyElement?.Select(elem => elem.Value); + get => _ReferencePolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1631,9 +1631,9 @@ public List SearchIncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SearchInclude + public IEnumerable SearchInclude { - get => _SearchIncludeElement?.Select(elem => elem.Value); + get => _SearchIncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1663,9 +1663,9 @@ public List SearchRevIncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SearchRevInclude + public IEnumerable SearchRevInclude { - get => _SearchRevIncludeElement?.Select(elem => elem.Value); + get => _SearchRevIncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3733,9 +3733,9 @@ public List InstantiatesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Instantiates + public IEnumerable Instantiates { - get => _InstantiatesElement?.Select(elem => elem.Value); + get => _InstantiatesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3765,9 +3765,9 @@ public List ImportsElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Imports + public IEnumerable Imports { - get => _ImportsElement?.Select(elem => elem.Value); + get => _ImportsElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3855,9 +3855,9 @@ public List FormatElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Format + public IEnumerable Format { - get => _FormatElement?.Select(elem => elem.Value); + get => _FormatElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3888,9 +3888,9 @@ public List PatchFormatElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PatchFormat + public IEnumerable PatchFormat { - get => _PatchFormatElement?.Select(elem => elem.Value); + get => _PatchFormatElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3924,9 +3924,9 @@ public List AcceptLanguageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? AcceptLanguage + public IEnumerable AcceptLanguage { - get => _AcceptLanguageElement?.Select(elem => elem.Value); + get => _AcceptLanguageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3956,9 +3956,9 @@ public List ImplementationGuideElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ImplementationGuide + public IEnumerable ImplementationGuide { - get => _ImplementationGuideElement?.Select(elem => elem.Value); + get => _ImplementationGuideElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs index c0a90ffd4..86490e734 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs @@ -243,9 +243,9 @@ public List> OperatorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Operator + public IEnumerable Operator { - get => _OperatorElement?.Select(elem => elem.Value); + get => _OperatorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs index 9e98e3329..969d0cce2 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs @@ -905,9 +905,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -937,9 +937,9 @@ public List TargetProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TargetProfile + public IEnumerable TargetProfile { - get => _TargetProfileElement?.Select(elem => elem.Value); + get => _TargetProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -971,9 +971,9 @@ public List> AggregationE /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Aggregation + public IEnumerable Aggregation { - get => _AggregationElement?.Select(elem => elem.Value); + get => _AggregationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2470,9 +2470,9 @@ public List> Repre /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Representation + public IEnumerable Representation { - get => _RepresentationElement?.Select(elem => elem.Value); + get => _RepresentationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2726,9 +2726,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3036,9 +3036,9 @@ public List ConditionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Condition + public IEnumerable Condition { - get => _ConditionElement?.Select(elem => elem.Value); + get => _ConditionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3116,9 +3116,9 @@ public List ValueAlternativesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ValueAlternatives + public IEnumerable ValueAlternatives { - get => _ValueAlternativesElement?.Select(elem => elem.Value); + get => _ValueAlternativesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs index 1ac6c5c6b..a9ffe463f 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs @@ -1262,9 +1262,9 @@ public List ContextInvariantElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ContextInvariant + public IEnumerable ContextInvariant { - get => _ContextInvariantElement?.Select(elem => elem.Value); + get => _ContextInvariantElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs index b33996692..6c4a3c58e 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs @@ -184,9 +184,9 @@ public List PropertyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Property + public IEnumerable Property { - get => _PropertyElement?.Select(elem => elem.Value); + get => _PropertyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -413,9 +413,9 @@ public List ValueSetElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ValueSet + public IEnumerable ValueSet { - get => _ValueSetElement?.Select(elem => elem.Value); + get => _ValueSetElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs index 246dfac11..8aa6af018 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs @@ -1037,9 +1037,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Address.cs b/src/Hl7.Fhir.R4/Model/Generated/Address.cs index 889e19bac..8c10afeb5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Address.cs @@ -238,9 +238,9 @@ public List LineElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Line + public IEnumerable Line { - get => _LineElement?.Select(elem => elem.Value); + get => _LineElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs index bdfd9cafe..77132cee8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs @@ -604,9 +604,9 @@ public List> /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Category + public IEnumerable Category { - get => _CategoryElement?.Select(elem => elem.Value); + get => _CategoryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs index aa2dd7d06..5e9445b82 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs @@ -358,9 +358,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs index 5a1c54181..e1839ad4d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs @@ -469,9 +469,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -501,9 +501,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1002,9 +1002,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1034,9 +1034,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs index 9bc79ce51..006964d50 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs @@ -263,9 +263,9 @@ public List DefinitionUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DefinitionUri + public IEnumerable DefinitionUri { - get => _DefinitionUriElement?.Select(elem => elem.Value); + get => _DefinitionUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -295,9 +295,9 @@ public List DefinitionCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DefinitionCanonical + public IEnumerable DefinitionCanonical { - get => _DefinitionCanonicalElement?.Select(elem => elem.Value); + get => _DefinitionCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs index 3065d1c60..b98f14272 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs @@ -663,9 +663,9 @@ public List DerivedFromUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFromUri + public IEnumerable DerivedFromUri { - get => _DerivedFromUriElement?.Select(elem => elem.Value); + get => _DerivedFromUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -695,9 +695,9 @@ public List PartOfElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PartOf + public IEnumerable PartOf { - get => _PartOfElement?.Select(elem => elem.Value); + get => _PartOfElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -727,9 +727,9 @@ public List ReplacesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Replaces + public IEnumerable Replaces { - get => _ReplacesElement?.Select(elem => elem.Value); + get => _ReplacesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs index df1b02c27..3bd6bd287 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs @@ -1331,9 +1331,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1692,9 +1692,9 @@ public List CareTeamSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamSequence + public IEnumerable CareTeamSequence { - get => _CareTeamSequenceElement?.Select(elem => elem.Value); + get => _CareTeamSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1724,9 +1724,9 @@ public List DiagnosisSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisSequence + public IEnumerable DiagnosisSequence { - get => _DiagnosisSequenceElement?.Select(elem => elem.Value); + get => _DiagnosisSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1756,9 +1756,9 @@ public List ProcedureSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureSequence + public IEnumerable ProcedureSequence { - get => _ProcedureSequenceElement?.Select(elem => elem.Value); + get => _ProcedureSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1788,9 +1788,9 @@ public List InformationSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationSequence + public IEnumerable InformationSequence { - get => _InformationSequenceElement?.Select(elem => elem.Value); + get => _InformationSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs index dfd179452..66d10f020 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs @@ -126,9 +126,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -493,9 +493,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -686,9 +686,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -827,9 +827,9 @@ public List ItemSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ItemSequence + public IEnumerable ItemSequence { - get => _ItemSequenceElement?.Select(elem => elem.Value); + get => _ItemSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -859,9 +859,9 @@ public List DetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DetailSequence + public IEnumerable DetailSequence { - get => _DetailSequenceElement?.Select(elem => elem.Value); + get => _DetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -891,9 +891,9 @@ public List SubdetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubdetailSequence + public IEnumerable SubdetailSequence { - get => _SubdetailSequenceElement?.Select(elem => elem.Value); + get => _SubdetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1112,9 +1112,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1499,9 +1499,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1805,9 +1805,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs index 30c5cdccd..a36e4104b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs @@ -613,9 +613,9 @@ public List ProtocolElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Protocol + public IEnumerable Protocol { - get => _ProtocolElement?.Select(elem => elem.Value); + get => _ProtocolElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs index ab66c4d5e..8ecece1e2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs @@ -189,9 +189,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -221,9 +221,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs index e91fe3d3a..92d78c5f1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs @@ -129,9 +129,9 @@ public List ParamElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Param + public IEnumerable Param { - get => _ParamElement?.Select(elem => elem.Value); + get => _ParamElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs index 027018b2e..4e29fe6a7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs @@ -922,9 +922,9 @@ public List NumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Number + public IEnumerable Number { - get => _NumberElement?.Select(elem => elem.Value); + get => _NumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1231,9 +1231,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1263,9 +1263,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1842,9 +1842,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1888,9 +1888,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2522,9 +2522,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2554,9 +2554,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2854,9 +2854,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2916,9 +2916,9 @@ public List ContextLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ContextLinkId + public IEnumerable ContextLinkId { - get => _ContextLinkIdElement?.Select(elem => elem.Value); + get => _ContextLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2979,9 +2979,9 @@ public List RequesterLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? RequesterLinkId + public IEnumerable RequesterLinkId { - get => _RequesterLinkIdElement?.Select(elem => elem.Value); + get => _RequesterLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3055,9 +3055,9 @@ public List PerformerLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PerformerLinkId + public IEnumerable PerformerLinkId { - get => _PerformerLinkIdElement?.Select(elem => elem.Value); + get => _PerformerLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3118,9 +3118,9 @@ public List ReasonElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Reason + public IEnumerable Reason { - get => _ReasonElement?.Select(elem => elem.Value); + get => _ReasonElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3150,9 +3150,9 @@ public List ReasonLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ReasonLinkId + public IEnumerable ReasonLinkId { - get => _ReasonLinkIdElement?.Select(elem => elem.Value); + get => _ReasonLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3196,9 +3196,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4380,9 +4380,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs index ff40ecec7..13f6979fa 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs @@ -468,9 +468,9 @@ public List SupportingInfoSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SupportingInfoSequence + public IEnumerable SupportingInfoSequence { - get => _SupportingInfoSequenceElement?.Select(elem => elem.Value); + get => _SupportingInfoSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -926,9 +926,9 @@ public List /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Purpose + public IEnumerable Purpose { - get => _PurposeElement?.Select(elem => elem.Value); + get => _PurposeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs index f203940a8..13fc6523d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs @@ -1033,9 +1033,9 @@ public List /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Purpose + public IEnumerable Purpose { - get => _PurposeElement?.Select(elem => elem.Value); + get => _PurposeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs index 7a700dc7f..87d703a59 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs @@ -649,9 +649,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -698,9 +698,9 @@ public List MustSupportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? MustSupport + public IEnumerable MustSupport { - get => _MustSupportElement?.Select(elem => elem.Value); + get => _MustSupportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs index c7a26f9e2..159d590c9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs @@ -1068,9 +1068,9 @@ public List VersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Version + public IEnumerable Version { - get => _VersionElement?.Select(elem => elem.Value); + get => _VersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs index 7e1851d50..c8eae58d0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs @@ -210,9 +210,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -242,9 +242,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs index 7666d77c3..ad2433fe7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs @@ -273,9 +273,9 @@ public List PayloadMimeTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PayloadMimeType + public IEnumerable PayloadMimeType { - get => _PayloadMimeTypeElement?.Select(elem => elem.Value); + get => _PayloadMimeTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -334,9 +334,9 @@ public List HeaderElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Header + public IEnumerable Header { - get => _HeaderElement?.Select(elem => elem.Value); + get => _HeaderElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs index 54d9063d6..c6b332ec5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs @@ -2197,9 +2197,9 @@ public List WorkflowElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Workflow + public IEnumerable Workflow { - get => _WorkflowElement?.Select(elem => elem.Value); + get => _WorkflowElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs index d37590800..c37e65593 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs @@ -1293,9 +1293,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1602,9 +1602,9 @@ public List CareTeamSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamSequence + public IEnumerable CareTeamSequence { - get => _CareTeamSequenceElement?.Select(elem => elem.Value); + get => _CareTeamSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1634,9 +1634,9 @@ public List DiagnosisSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisSequence + public IEnumerable DiagnosisSequence { - get => _DiagnosisSequenceElement?.Select(elem => elem.Value); + get => _DiagnosisSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1666,9 +1666,9 @@ public List ProcedureSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureSequence + public IEnumerable ProcedureSequence { - get => _ProcedureSequenceElement?.Select(elem => elem.Value); + get => _ProcedureSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1698,9 +1698,9 @@ public List InformationSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationSequence + public IEnumerable InformationSequence { - get => _InformationSequenceElement?.Select(elem => elem.Value); + get => _InformationSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1963,9 +1963,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2657,9 +2657,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3096,9 +3096,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3327,9 +3327,9 @@ public List ItemSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ItemSequence + public IEnumerable ItemSequence { - get => _ItemSequenceElement?.Select(elem => elem.Value); + get => _ItemSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3359,9 +3359,9 @@ public List DetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DetailSequence + public IEnumerable DetailSequence { - get => _DetailSequenceElement?.Select(elem => elem.Value); + get => _DetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3391,9 +3391,9 @@ public List SubDetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubDetailSequence + public IEnumerable SubDetailSequence { - get => _SubDetailSequenceElement?.Select(elem => elem.Value); + get => _SubDetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3612,9 +3612,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3999,9 +3999,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4305,9 +4305,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -5872,9 +5872,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs index 8aadb7f9c..c77fe8458 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs @@ -328,9 +328,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -360,9 +360,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs index 651d74787..caae71e7d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs @@ -225,9 +225,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs index 094bbd90d..4e1dd36ca 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs @@ -220,9 +220,9 @@ public List GivenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Given + public IEnumerable Given { - get => _GivenElement?.Select(elem => elem.Value); + get => _GivenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -252,9 +252,9 @@ public List PrefixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Prefix + public IEnumerable Prefix { - get => _PrefixElement?.Select(elem => elem.Value); + get => _PrefixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -284,9 +284,9 @@ public List SuffixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Suffix + public IEnumerable Suffix { - get => _SuffixElement?.Select(elem => elem.Value); + get => _SuffixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs index 21deb820c..c1b6f345e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs @@ -2959,9 +2959,9 @@ public List> FhirVersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FhirVersion + public IEnumerable FhirVersion { - get => _FhirVersionElement?.Select(elem => elem.Value); + get => _FhirVersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3785,9 +3785,9 @@ public List ImageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Image + public IEnumerable Image { - get => _ImageElement?.Select(elem => elem.Value); + get => _ImageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3817,9 +3817,9 @@ public List OtherElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Other + public IEnumerable Other { - get => _OtherElement?.Select(elem => elem.Value); + get => _OtherElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4173,9 +4173,9 @@ public List AnchorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Anchor + public IEnumerable Anchor { - get => _AnchorElement?.Select(elem => elem.Value); + get => _AnchorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4673,9 +4673,9 @@ public List> FhirVersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FhirVersion + public IEnumerable FhirVersion { - get => _FhirVersionElement?.Select(elem => elem.Value); + get => _FhirVersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs index f67d7a418..3f40a3d21 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs @@ -1536,9 +1536,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Location.cs b/src/Hl7.Fhir.R4/Model/Generated/Location.cs index 4825ac53a..2d6f860e6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Location.cs @@ -331,9 +331,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -621,9 +621,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs index f2092f011..693946c26 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs @@ -1498,9 +1498,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1727,9 +1727,9 @@ public List DefinitionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Definition + public IEnumerable Definition { - get => _DefinitionElement?.Select(elem => elem.Value); + get => _DefinitionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs index f69f29a14..9d0af2e93 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs @@ -483,9 +483,9 @@ public List InstantiatesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Instantiates + public IEnumerable Instantiates { - get => _InstantiatesElement?.Select(elem => elem.Value); + get => _InstantiatesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs index 95cf9c369..a893ab346 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs @@ -1049,9 +1049,9 @@ public List ValueElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Value + public IEnumerable Value { - get => _ValueElement?.Select(elem => elem.Value); + get => _ValueElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2191,9 +2191,9 @@ public List SynonymElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Synonym + public IEnumerable Synonym { - get => _SynonymElement?.Select(elem => elem.Value); + get => _SynonymElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs index b212c9cc5..a0e226752 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs @@ -1028,9 +1028,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1060,9 +1060,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs index 9589012e2..a97994753 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs @@ -1020,9 +1020,9 @@ public List SpecialMeasuresElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SpecialMeasures + public IEnumerable SpecialMeasures { - get => _SpecialMeasuresElement?.Select(elem => elem.Value); + get => _SpecialMeasuresElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs index 8dda863a9..3ee3ab178 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs @@ -600,9 +600,9 @@ public List ReplacesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Replaces + public IEnumerable Replaces { - get => _ReplacesElement?.Select(elem => elem.Value); + get => _ReplacesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -903,9 +903,9 @@ public List ParentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Parent + public IEnumerable Parent { - get => _ParentElement?.Select(elem => elem.Value); + get => _ParentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1040,9 +1040,9 @@ public List GraphElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Graph + public IEnumerable Graph { - get => _GraphElement?.Select(elem => elem.Value); + get => _GraphElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs index e4f49d271..7d1fd6846 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs @@ -1446,9 +1446,9 @@ public List ScoreElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Score + public IEnumerable Score { - get => _ScoreElement?.Select(elem => elem.Value); + get => _ScoreElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1478,9 +1478,9 @@ public List NumTPElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NumTP + public IEnumerable NumTP { - get => _NumTPElement?.Select(elem => elem.Value); + get => _NumTPElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1510,9 +1510,9 @@ public List NumFPElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NumFP + public IEnumerable NumFP { - get => _NumFPElement?.Select(elem => elem.Value); + get => _NumFPElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1542,9 +1542,9 @@ public List NumFNElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NumFN + public IEnumerable NumFN { - get => _NumFNElement?.Select(elem => elem.Value); + get => _NumFNElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1574,9 +1574,9 @@ public List PrecisionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Precision + public IEnumerable Precision { - get => _PrecisionElement?.Select(elem => elem.Value); + get => _PrecisionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1606,9 +1606,9 @@ public List SensitivityElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Sensitivity + public IEnumerable Sensitivity { - get => _SensitivityElement?.Select(elem => elem.Value); + get => _SensitivityElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1638,9 +1638,9 @@ public List FMeasureElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FMeasure + public IEnumerable FMeasure { - get => _FMeasureElement?.Select(elem => elem.Value); + get => _FMeasureElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs index 679ebdbaf..e76a265e4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs @@ -1207,9 +1207,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1239,9 +1239,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1271,9 +1271,9 @@ public List InstantiatesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Instantiates + public IEnumerable Instantiates { - get => _InstantiatesElement?.Select(elem => elem.Value); + get => _InstantiatesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs index 2a00c7cc5..79a9d702f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs @@ -716,9 +716,9 @@ public List> Perm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PermittedDataType + public IEnumerable PermittedDataType { - get => _PermittedDataTypeElement?.Select(elem => elem.Value); + get => _PermittedDataTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs index ea796bac2..7501b563c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs @@ -296,9 +296,9 @@ public List TargetProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TargetProfile + public IEnumerable TargetProfile { - get => _TargetProfileElement?.Select(elem => elem.Value); + get => _TargetProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -857,9 +857,9 @@ public List ParameterNameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ParameterName + public IEnumerable ParameterName { - get => _ParameterNameElement?.Select(elem => elem.Value); + get => _ParameterNameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1460,9 +1460,9 @@ public List> ResourceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Resource + public IEnumerable Resource { - get => _ResourceElement?.Select(elem => elem.Value); + get => _ResourceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs index a69f89b51..a4b344d4a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs @@ -324,9 +324,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs index f0af7b8c1..d8212064c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs @@ -650,9 +650,9 @@ public List GoalIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? GoalId + public IEnumerable GoalId { - get => _GoalIdElement?.Select(elem => elem.Value); + get => _GoalIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2498,9 +2498,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs index 127055983..8bf8cbc20 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs @@ -100,9 +100,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs index b1697cfb9..192265fc1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs @@ -351,9 +351,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -383,9 +383,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs index 2975d5f2e..d3ae03900 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs @@ -184,9 +184,9 @@ public List ColorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Color + public IEnumerable Color { - get => _ColorElement?.Select(elem => elem.Value); + get => _ColorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -216,9 +216,9 @@ public List ImprintElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Imprint + public IEnumerable Imprint { - get => _ImprintElement?.Select(elem => elem.Value); + get => _ImprintElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs index 638405617..c0ebb4d4a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs @@ -500,9 +500,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs index 0153959ef..c5b35b464 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs @@ -1388,9 +1388,9 @@ public List DerivedFromElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFrom + public IEnumerable DerivedFrom { - get => _DerivedFromElement?.Select(elem => elem.Value); + get => _DerivedFromElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1481,9 +1481,9 @@ public List> SubjectTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubjectType + public IEnumerable SubjectType { - get => _SubjectTypeElement?.Select(elem => elem.Value); + get => _SubjectTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs index 544ee882a..39dfa6aae 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs @@ -1057,9 +1057,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1089,9 +1089,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs index 47b4f7f6a..620004cf8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs @@ -437,9 +437,9 @@ public List CommentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comment + public IEnumerable Comment { - get => _CommentElement?.Select(elem => elem.Value); + get => _CommentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -736,9 +736,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs index 67a4c2f2c..f059f8567 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs @@ -887,9 +887,9 @@ public List CommentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comment + public IEnumerable Comment { - get => _CommentElement?.Select(elem => elem.Value); + get => _CommentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1186,9 +1186,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs index 68cf933a7..ae83da0ea 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs @@ -772,9 +772,9 @@ public List> BaseElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Base + public IEnumerable Base { - get => _BaseElement?.Select(elem => elem.Value); + get => _BaseElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -923,9 +923,9 @@ public List> TargetElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Target + public IEnumerable Target { - get => _TargetElement?.Select(elem => elem.Value); + get => _TargetElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1013,9 +1013,9 @@ public List> ComparatorEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comparator + public IEnumerable Comparator { - get => _ComparatorElement?.Select(elem => elem.Value); + get => _ComparatorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1047,9 +1047,9 @@ public List> ModifierEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modifier + public IEnumerable Modifier { - get => _ModifierElement?.Select(elem => elem.Value); + get => _ModifierElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1079,9 +1079,9 @@ public List ChainElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Chain + public IEnumerable Chain { - get => _ChainElement?.Select(elem => elem.Value); + get => _ChainElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs index 7ee8df037..691db1b74 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs @@ -95,9 +95,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -127,9 +127,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs index 5329a9f79..3c02f67df 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs @@ -1901,9 +1901,9 @@ public List> ListMo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ListMode + public IEnumerable ListMode { - get => _ListModeElement?.Select(elem => elem.Value); + get => _ListModeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2261,9 +2261,9 @@ public List VariableElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Variable + public IEnumerable Variable { - get => _VariableElement?.Select(elem => elem.Value); + get => _VariableElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2747,9 +2747,9 @@ public List ImportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Import + public IEnumerable Import { - get => _ImportElement?.Select(elem => elem.Value); + get => _ImportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs index 3110b8c93..f89c54098 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs @@ -259,9 +259,9 @@ public List HeaderElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Header + public IEnumerable Header { - get => _HeaderElement?.Select(elem => elem.Value); + get => _HeaderElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs index 45275fece..db8466eb9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs @@ -1027,9 +1027,9 @@ public List ModificationElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modification + public IEnumerable Modification { - get => _ModificationElement?.Select(elem => elem.Value); + get => _ModificationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs index 4fe9d6b1d..92e2adb5b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs @@ -435,9 +435,9 @@ public List DisulfideLinkageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DisulfideLinkage + public IEnumerable DisulfideLinkage { - get => _DisulfideLinkageElement?.Select(elem => elem.Value); + get => _DisulfideLinkageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs index 3075fed78..15f6bb7ec 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs @@ -1174,9 +1174,9 @@ public List ParentSubstanceNameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ParentSubstanceName + public IEnumerable ParentSubstanceName { - get => _ParentSubstanceNameElement?.Select(elem => elem.Value); + get => _ParentSubstanceNameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1220,9 +1220,9 @@ public List GeographicalLocationElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? GeographicalLocation + public IEnumerable GeographicalLocation { - get => _GeographicalLocationElement?.Select(elem => elem.Value); + get => _GeographicalLocationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs index 7150c1d08..cfe5e76e1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs @@ -656,9 +656,9 @@ public List LanguageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Language + public IEnumerable Language { - get => _LanguageElement?.Select(elem => elem.Value); + get => _LanguageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -702,9 +702,9 @@ public List PropertyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Property + public IEnumerable Property { - get => _PropertyElement?.Select(elem => elem.Value); + get => _PropertyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -882,9 +882,9 @@ public List OpElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Op + public IEnumerable Op { - get => _OpElement?.Select(elem => elem.Value); + get => _OpElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs index 7e5b2dc8f..dfa64727b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs @@ -935,9 +935,9 @@ public List OriginElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Origin + public IEnumerable Origin { - get => _OriginElement?.Select(elem => elem.Value); + get => _OriginElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -995,9 +995,9 @@ public List LinkElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Link + public IEnumerable Link { - get => _LinkElement?.Select(elem => elem.Value); + get => _LinkElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs index 293e216ec..24479146e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs @@ -622,9 +622,9 @@ public List> DayOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DayOfWeek + public IEnumerable DayOfWeek { - get => _DayOfWeekElement?.Select(elem => elem.Value); + get => _DayOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -654,9 +654,9 @@ public List TimeOfDayElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TimeOfDay + public IEnumerable TimeOfDay { - get => _TimeOfDayElement?.Select(elem => elem.Value); + get => _TimeOfDayElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -688,9 +688,9 @@ public List> WhenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? When + public IEnumerable When { - get => _WhenElement?.Select(elem => elem.Value); + get => _WhenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -935,9 +935,9 @@ public List EventElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Event + public IEnumerable Event { - get => _EventElement?.Select(elem => elem.Value); + get => _EventElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs index 8c1960d38..82377d121 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs @@ -824,9 +824,9 @@ public List TargetLocationElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TargetLocation + public IEnumerable TargetLocation { - get => _TargetLocationElement?.Select(elem => elem.Value); + get => _TargetLocationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs index 516d37022..6296413d4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs @@ -1037,9 +1037,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs index 48807ef9f..b037ca544 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs @@ -238,9 +238,9 @@ public List LineElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Line + public IEnumerable Line { - get => _LineElement?.Select(elem => elem.Value); + get => _LineElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs index ccdaa6064..db0308bcf 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs @@ -604,9 +604,9 @@ public List> /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Category + public IEnumerable Category { - get => _CategoryElement?.Select(elem => elem.Value); + get => _CategoryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs index 7c58ad234..d489ea22e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs @@ -358,9 +358,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs index bb15792b8..3d32db805 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs @@ -469,9 +469,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -501,9 +501,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1002,9 +1002,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1034,9 +1034,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs index 0bf034afc..9b2ff12df 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs @@ -263,9 +263,9 @@ public List DefinitionUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DefinitionUri + public IEnumerable DefinitionUri { - get => _DefinitionUriElement?.Select(elem => elem.Value); + get => _DefinitionUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -295,9 +295,9 @@ public List DefinitionCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DefinitionCanonical + public IEnumerable DefinitionCanonical { - get => _DefinitionCanonicalElement?.Select(elem => elem.Value); + get => _DefinitionCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs index 5458d3fa3..b23308254 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs @@ -663,9 +663,9 @@ public List DerivedFromUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFromUri + public IEnumerable DerivedFromUri { - get => _DerivedFromUriElement?.Select(elem => elem.Value); + get => _DerivedFromUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -695,9 +695,9 @@ public List PartOfElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PartOf + public IEnumerable PartOf { - get => _PartOfElement?.Select(elem => elem.Value); + get => _PartOfElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -727,9 +727,9 @@ public List ReplacesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Replaces + public IEnumerable Replaces { - get => _ReplacesElement?.Select(elem => elem.Value); + get => _ReplacesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs index 28c627e73..f5f61114c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs @@ -1331,9 +1331,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1692,9 +1692,9 @@ public List CareTeamSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamSequence + public IEnumerable CareTeamSequence { - get => _CareTeamSequenceElement?.Select(elem => elem.Value); + get => _CareTeamSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1724,9 +1724,9 @@ public List DiagnosisSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisSequence + public IEnumerable DiagnosisSequence { - get => _DiagnosisSequenceElement?.Select(elem => elem.Value); + get => _DiagnosisSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1756,9 +1756,9 @@ public List ProcedureSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureSequence + public IEnumerable ProcedureSequence { - get => _ProcedureSequenceElement?.Select(elem => elem.Value); + get => _ProcedureSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1788,9 +1788,9 @@ public List InformationSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationSequence + public IEnumerable InformationSequence { - get => _InformationSequenceElement?.Select(elem => elem.Value); + get => _InformationSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs index b4f1a87c8..e2b8c9b51 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs @@ -126,9 +126,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -493,9 +493,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -686,9 +686,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -827,9 +827,9 @@ public List ItemSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ItemSequence + public IEnumerable ItemSequence { - get => _ItemSequenceElement?.Select(elem => elem.Value); + get => _ItemSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -859,9 +859,9 @@ public List DetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DetailSequence + public IEnumerable DetailSequence { - get => _DetailSequenceElement?.Select(elem => elem.Value); + get => _DetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -891,9 +891,9 @@ public List SubdetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubdetailSequence + public IEnumerable SubdetailSequence { - get => _SubdetailSequenceElement?.Select(elem => elem.Value); + get => _SubdetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1112,9 +1112,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1499,9 +1499,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1805,9 +1805,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs index 2ce53505e..b9860a814 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs @@ -613,9 +613,9 @@ public List ProtocolElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Protocol + public IEnumerable Protocol { - get => _ProtocolElement?.Select(elem => elem.Value); + get => _ProtocolElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs index 4116abd8c..8e5d86277 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs @@ -189,9 +189,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -221,9 +221,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs index e7cb90199..2e1f49b66 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs @@ -129,9 +129,9 @@ public List ParamElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Param + public IEnumerable Param { - get => _ParamElement?.Select(elem => elem.Value); + get => _ParamElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs index ffd35f164..4fa274f77 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs @@ -922,9 +922,9 @@ public List NumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Number + public IEnumerable Number { - get => _NumberElement?.Select(elem => elem.Value); + get => _NumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1231,9 +1231,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1263,9 +1263,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1842,9 +1842,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1888,9 +1888,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2522,9 +2522,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2554,9 +2554,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2854,9 +2854,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2916,9 +2916,9 @@ public List ContextLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ContextLinkId + public IEnumerable ContextLinkId { - get => _ContextLinkIdElement?.Select(elem => elem.Value); + get => _ContextLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2979,9 +2979,9 @@ public List RequesterLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? RequesterLinkId + public IEnumerable RequesterLinkId { - get => _RequesterLinkIdElement?.Select(elem => elem.Value); + get => _RequesterLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3055,9 +3055,9 @@ public List PerformerLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PerformerLinkId + public IEnumerable PerformerLinkId { - get => _PerformerLinkIdElement?.Select(elem => elem.Value); + get => _PerformerLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3118,9 +3118,9 @@ public List ReasonElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Reason + public IEnumerable Reason { - get => _ReasonElement?.Select(elem => elem.Value); + get => _ReasonElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3150,9 +3150,9 @@ public List ReasonLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ReasonLinkId + public IEnumerable ReasonLinkId { - get => _ReasonLinkIdElement?.Select(elem => elem.Value); + get => _ReasonLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3196,9 +3196,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4380,9 +4380,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs index c18bb0daa..68f2bb16a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs @@ -468,9 +468,9 @@ public List SupportingInfoSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SupportingInfoSequence + public IEnumerable SupportingInfoSequence { - get => _SupportingInfoSequenceElement?.Select(elem => elem.Value); + get => _SupportingInfoSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -926,9 +926,9 @@ public List /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Purpose + public IEnumerable Purpose { - get => _PurposeElement?.Select(elem => elem.Value); + get => _PurposeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs index 40b803569..d48c058ed 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs @@ -1033,9 +1033,9 @@ public List /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Purpose + public IEnumerable Purpose { - get => _PurposeElement?.Select(elem => elem.Value); + get => _PurposeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs index ce57ce370..d4297dd60 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs @@ -649,9 +649,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -698,9 +698,9 @@ public List MustSupportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? MustSupport + public IEnumerable MustSupport { - get => _MustSupportElement?.Select(elem => elem.Value); + get => _MustSupportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs index f4c3945c1..8b66a8bde 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs @@ -1068,9 +1068,9 @@ public List VersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Version + public IEnumerable Version { - get => _VersionElement?.Select(elem => elem.Value); + get => _VersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs index 80aa6f08a..3b97d2fb8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs @@ -210,9 +210,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -242,9 +242,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs index bb44afb24..bbb48db69 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs @@ -273,9 +273,9 @@ public List PayloadMimeTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PayloadMimeType + public IEnumerable PayloadMimeType { - get => _PayloadMimeTypeElement?.Select(elem => elem.Value); + get => _PayloadMimeTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -334,9 +334,9 @@ public List HeaderElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Header + public IEnumerable Header { - get => _HeaderElement?.Select(elem => elem.Value); + get => _HeaderElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs index df54b7aeb..adb39824c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs @@ -2197,9 +2197,9 @@ public List WorkflowElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Workflow + public IEnumerable Workflow { - get => _WorkflowElement?.Select(elem => elem.Value); + get => _WorkflowElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs index 0318324c4..4cf0e900e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs @@ -1293,9 +1293,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1602,9 +1602,9 @@ public List CareTeamSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamSequence + public IEnumerable CareTeamSequence { - get => _CareTeamSequenceElement?.Select(elem => elem.Value); + get => _CareTeamSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1634,9 +1634,9 @@ public List DiagnosisSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisSequence + public IEnumerable DiagnosisSequence { - get => _DiagnosisSequenceElement?.Select(elem => elem.Value); + get => _DiagnosisSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1666,9 +1666,9 @@ public List ProcedureSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureSequence + public IEnumerable ProcedureSequence { - get => _ProcedureSequenceElement?.Select(elem => elem.Value); + get => _ProcedureSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1698,9 +1698,9 @@ public List InformationSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationSequence + public IEnumerable InformationSequence { - get => _InformationSequenceElement?.Select(elem => elem.Value); + get => _InformationSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1963,9 +1963,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2657,9 +2657,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3096,9 +3096,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3327,9 +3327,9 @@ public List ItemSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ItemSequence + public IEnumerable ItemSequence { - get => _ItemSequenceElement?.Select(elem => elem.Value); + get => _ItemSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3359,9 +3359,9 @@ public List DetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DetailSequence + public IEnumerable DetailSequence { - get => _DetailSequenceElement?.Select(elem => elem.Value); + get => _DetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3391,9 +3391,9 @@ public List SubDetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubDetailSequence + public IEnumerable SubDetailSequence { - get => _SubDetailSequenceElement?.Select(elem => elem.Value); + get => _SubDetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3612,9 +3612,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3999,9 +3999,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4305,9 +4305,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -5872,9 +5872,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs index ef125d0ba..6a231d056 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs @@ -328,9 +328,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -360,9 +360,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs index b313ffd93..3bd5ef502 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs @@ -225,9 +225,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs index bc24f5fe2..11a8d08a8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs @@ -220,9 +220,9 @@ public List GivenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Given + public IEnumerable Given { - get => _GivenElement?.Select(elem => elem.Value); + get => _GivenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -252,9 +252,9 @@ public List PrefixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Prefix + public IEnumerable Prefix { - get => _PrefixElement?.Select(elem => elem.Value); + get => _PrefixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -284,9 +284,9 @@ public List SuffixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Suffix + public IEnumerable Suffix { - get => _SuffixElement?.Select(elem => elem.Value); + get => _SuffixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs index b1dc5d25e..a5a840528 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs @@ -2959,9 +2959,9 @@ public List> FhirVersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FhirVersion + public IEnumerable FhirVersion { - get => _FhirVersionElement?.Select(elem => elem.Value); + get => _FhirVersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3785,9 +3785,9 @@ public List ImageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Image + public IEnumerable Image { - get => _ImageElement?.Select(elem => elem.Value); + get => _ImageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3817,9 +3817,9 @@ public List OtherElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Other + public IEnumerable Other { - get => _OtherElement?.Select(elem => elem.Value); + get => _OtherElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4173,9 +4173,9 @@ public List AnchorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Anchor + public IEnumerable Anchor { - get => _AnchorElement?.Select(elem => elem.Value); + get => _AnchorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4673,9 +4673,9 @@ public List> FhirVersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FhirVersion + public IEnumerable FhirVersion { - get => _FhirVersionElement?.Select(elem => elem.Value); + get => _FhirVersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs index 8d4fdce0e..c0fe6c2ef 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs @@ -1536,9 +1536,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs index 6a95116c2..92374286c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs @@ -331,9 +331,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -621,9 +621,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs index 4140a3230..bb4019dc4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs @@ -1502,9 +1502,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1731,9 +1731,9 @@ public List DefinitionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Definition + public IEnumerable Definition { - get => _DefinitionElement?.Select(elem => elem.Value); + get => _DefinitionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs index 76261bc44..016d455a6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs @@ -483,9 +483,9 @@ public List InstantiatesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Instantiates + public IEnumerable Instantiates { - get => _InstantiatesElement?.Select(elem => elem.Value); + get => _InstantiatesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs index 30d977992..cde2403ee 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs @@ -1049,9 +1049,9 @@ public List ValueElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Value + public IEnumerable Value { - get => _ValueElement?.Select(elem => elem.Value); + get => _ValueElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2191,9 +2191,9 @@ public List SynonymElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Synonym + public IEnumerable Synonym { - get => _SynonymElement?.Select(elem => elem.Value); + get => _SynonymElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs index 8d6f91b31..0885291f9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs @@ -1028,9 +1028,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1060,9 +1060,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs index 482932277..126e4143d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs @@ -600,9 +600,9 @@ public List ReplacesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Replaces + public IEnumerable Replaces { - get => _ReplacesElement?.Select(elem => elem.Value); + get => _ReplacesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -903,9 +903,9 @@ public List ParentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Parent + public IEnumerable Parent { - get => _ParentElement?.Select(elem => elem.Value); + get => _ParentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1040,9 +1040,9 @@ public List GraphElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Graph + public IEnumerable Graph { - get => _GraphElement?.Select(elem => elem.Value); + get => _GraphElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs index 5ad3f3cc6..aec731b96 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs @@ -1446,9 +1446,9 @@ public List ScoreElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Score + public IEnumerable Score { - get => _ScoreElement?.Select(elem => elem.Value); + get => _ScoreElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1478,9 +1478,9 @@ public List NumTPElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NumTP + public IEnumerable NumTP { - get => _NumTPElement?.Select(elem => elem.Value); + get => _NumTPElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1510,9 +1510,9 @@ public List NumFPElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NumFP + public IEnumerable NumFP { - get => _NumFPElement?.Select(elem => elem.Value); + get => _NumFPElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1542,9 +1542,9 @@ public List NumFNElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NumFN + public IEnumerable NumFN { - get => _NumFNElement?.Select(elem => elem.Value); + get => _NumFNElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1574,9 +1574,9 @@ public List PrecisionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Precision + public IEnumerable Precision { - get => _PrecisionElement?.Select(elem => elem.Value); + get => _PrecisionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1606,9 +1606,9 @@ public List SensitivityElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Sensitivity + public IEnumerable Sensitivity { - get => _SensitivityElement?.Select(elem => elem.Value); + get => _SensitivityElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1638,9 +1638,9 @@ public List FMeasureElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FMeasure + public IEnumerable FMeasure { - get => _FMeasureElement?.Select(elem => elem.Value); + get => _FMeasureElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs index 2e6677897..e183c12da 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs @@ -1207,9 +1207,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1239,9 +1239,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1271,9 +1271,9 @@ public List InstantiatesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Instantiates + public IEnumerable Instantiates { - get => _InstantiatesElement?.Select(elem => elem.Value); + get => _InstantiatesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs index ebfd45bf4..2f1152383 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs @@ -716,9 +716,9 @@ public List> Perm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PermittedDataType + public IEnumerable PermittedDataType { - get => _PermittedDataTypeElement?.Select(elem => elem.Value); + get => _PermittedDataTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs index 958f60f07..7c16b3baf 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs @@ -296,9 +296,9 @@ public List TargetProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TargetProfile + public IEnumerable TargetProfile { - get => _TargetProfileElement?.Select(elem => elem.Value); + get => _TargetProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -857,9 +857,9 @@ public List ParameterNameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ParameterName + public IEnumerable ParameterName { - get => _ParameterNameElement?.Select(elem => elem.Value); + get => _ParameterNameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1460,9 +1460,9 @@ public List> ResourceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Resource + public IEnumerable Resource { - get => _ResourceElement?.Select(elem => elem.Value); + get => _ResourceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs index 407b7aab3..51021522c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs @@ -324,9 +324,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs index 81b6bb78e..4fcaea32c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs @@ -652,9 +652,9 @@ public List GoalIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? GoalId + public IEnumerable GoalId { - get => _GoalIdElement?.Select(elem => elem.Value); + get => _GoalIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2500,9 +2500,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs index 63490d2ac..eefb65e5a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs @@ -100,9 +100,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs index d6ac7b45c..40e5d7866 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs @@ -351,9 +351,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -383,9 +383,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs index 1639341dc..704426837 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs @@ -184,9 +184,9 @@ public List ColorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Color + public IEnumerable Color { - get => _ColorElement?.Select(elem => elem.Value); + get => _ColorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -216,9 +216,9 @@ public List ImprintElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Imprint + public IEnumerable Imprint { - get => _ImprintElement?.Select(elem => elem.Value); + get => _ImprintElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs index 0c3395052..3a6107892 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs @@ -500,9 +500,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs index 4a122dba4..b671725da 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs @@ -1394,9 +1394,9 @@ public List DerivedFromElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFrom + public IEnumerable DerivedFrom { - get => _DerivedFromElement?.Select(elem => elem.Value); + get => _DerivedFromElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1487,9 +1487,9 @@ public List> SubjectTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubjectType + public IEnumerable SubjectType { - get => _SubjectTypeElement?.Select(elem => elem.Value); + get => _SubjectTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs index a47ce43d9..31a355ee7 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs @@ -1057,9 +1057,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1089,9 +1089,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs index 33a13d938..0eb742aee 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs @@ -437,9 +437,9 @@ public List CommentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comment + public IEnumerable Comment { - get => _CommentElement?.Select(elem => elem.Value); + get => _CommentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -736,9 +736,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs index bad0a6256..f988e87eb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs @@ -915,9 +915,9 @@ public List CommentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comment + public IEnumerable Comment { - get => _CommentElement?.Select(elem => elem.Value); + get => _CommentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1214,9 +1214,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs index 594de86a0..3205e24d4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs @@ -772,9 +772,9 @@ public List> BaseElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Base + public IEnumerable Base { - get => _BaseElement?.Select(elem => elem.Value); + get => _BaseElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -923,9 +923,9 @@ public List> TargetElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Target + public IEnumerable Target { - get => _TargetElement?.Select(elem => elem.Value); + get => _TargetElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1013,9 +1013,9 @@ public List> ComparatorEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comparator + public IEnumerable Comparator { - get => _ComparatorElement?.Select(elem => elem.Value); + get => _ComparatorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1047,9 +1047,9 @@ public List> ModifierEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modifier + public IEnumerable Modifier { - get => _ModifierElement?.Select(elem => elem.Value); + get => _ModifierElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1079,9 +1079,9 @@ public List ChainElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Chain + public IEnumerable Chain { - get => _ChainElement?.Select(elem => elem.Value); + get => _ChainElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs index 7fa67f118..97ddfafeb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs @@ -95,9 +95,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -127,9 +127,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs index e2c27eecd..6c151eacb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs @@ -1901,9 +1901,9 @@ public List> ListMo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ListMode + public IEnumerable ListMode { - get => _ListModeElement?.Select(elem => elem.Value); + get => _ListModeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2261,9 +2261,9 @@ public List VariableElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Variable + public IEnumerable Variable { - get => _VariableElement?.Select(elem => elem.Value); + get => _VariableElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2747,9 +2747,9 @@ public List ImportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Import + public IEnumerable Import { - get => _ImportElement?.Select(elem => elem.Value); + get => _ImportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs index 1208ba15d..9104421c3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs @@ -225,9 +225,9 @@ public List HeaderElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Header + public IEnumerable Header { - get => _HeaderElement?.Select(elem => elem.Value); + get => _HeaderElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs index 21fda7ddc..4b58aca51 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs @@ -307,9 +307,9 @@ public List> Supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SupportedInteraction + public IEnumerable SupportedInteraction { - get => _SupportedInteractionElement?.Select(elem => elem.Value); + get => _SupportedInteractionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1034,9 +1034,9 @@ public List> M /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modifier + public IEnumerable Modifier { - get => _ModifierElement?.Select(elem => elem.Value); + get => _ModifierElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1209,9 +1209,9 @@ public List IncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Include + public IEnumerable Include { - get => _IncludeElement?.Select(elem => elem.Value); + get => _IncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1241,9 +1241,9 @@ public List RevIncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? RevInclude + public IEnumerable RevInclude { - get => _RevIncludeElement?.Select(elem => elem.Value); + get => _RevIncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1451,9 +1451,9 @@ public List DerivedFromElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFrom + public IEnumerable DerivedFrom { - get => _DerivedFromElement?.Select(elem => elem.Value); + get => _DerivedFromElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs index 49a829f4d..519dcc9ca 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs @@ -656,9 +656,9 @@ public List LanguageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Language + public IEnumerable Language { - get => _LanguageElement?.Select(elem => elem.Value); + get => _LanguageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -702,9 +702,9 @@ public List PropertyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Property + public IEnumerable Property { - get => _PropertyElement?.Select(elem => elem.Value); + get => _PropertyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -882,9 +882,9 @@ public List OpElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Op + public IEnumerable Op { - get => _OpElement?.Select(elem => elem.Value); + get => _OpElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs index 5ed8c86ff..13708c02c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs @@ -935,9 +935,9 @@ public List OriginElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Origin + public IEnumerable Origin { - get => _OriginElement?.Select(elem => elem.Value); + get => _OriginElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -995,9 +995,9 @@ public List LinkElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Link + public IEnumerable Link { - get => _LinkElement?.Select(elem => elem.Value); + get => _LinkElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs index 746d07ef8..71e481d02 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs @@ -618,9 +618,9 @@ public List> DayOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DayOfWeek + public IEnumerable DayOfWeek { - get => _DayOfWeekElement?.Select(elem => elem.Value); + get => _DayOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -650,9 +650,9 @@ public List TimeOfDayElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TimeOfDay + public IEnumerable TimeOfDay { - get => _TimeOfDayElement?.Select(elem => elem.Value); + get => _TimeOfDayElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -684,9 +684,9 @@ public List> WhenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? When + public IEnumerable When { - get => _WhenElement?.Select(elem => elem.Value); + get => _WhenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -931,9 +931,9 @@ public List EventElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Event + public IEnumerable Event { - get => _EventElement?.Select(elem => elem.Value); + get => _EventElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs index 31b07a14c..b1e2830e6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs @@ -824,9 +824,9 @@ public List TargetLocationElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TargetLocation + public IEnumerable TargetLocation { - get => _TargetLocationElement?.Select(elem => elem.Value); + get => _TargetLocationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs index 6b462d21a..3f5319349 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs @@ -1175,9 +1175,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1484,9 +1484,9 @@ public List SpecimenRequirementElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SpecimenRequirement + public IEnumerable SpecimenRequirement { - get => _SpecimenRequirementElement?.Select(elem => elem.Value); + get => _SpecimenRequirementElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1516,9 +1516,9 @@ public List ObservationRequirementElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ObservationRequirement + public IEnumerable ObservationRequirement { - get => _ObservationRequirementElement?.Select(elem => elem.Value); + get => _ObservationRequirementElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1548,9 +1548,9 @@ public List ObservationResultRequirementElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ObservationResultRequirement + public IEnumerable ObservationResultRequirement { - get => _ObservationResultRequirementElement?.Select(elem => elem.Value); + get => _ObservationResultRequirementElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs index a5ff25a20..892f59e77 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs @@ -552,9 +552,9 @@ public List ReferenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Reference + public IEnumerable Reference { - get => _ReferenceElement?.Select(elem => elem.Value); + get => _ReferenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -612,9 +612,9 @@ public List DerivedFromElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFrom + public IEnumerable DerivedFrom { - get => _DerivedFromElement?.Select(elem => elem.Value); + get => _DerivedFromElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Address.cs b/src/Hl7.Fhir.R5/Model/Generated/Address.cs index 6ad569a06..425f17c00 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Address.cs @@ -239,9 +239,9 @@ public List LineElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Line + public IEnumerable Line { - get => _LineElement?.Select(elem => elem.Value); + get => _LineElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs index 89d118233..d512c4142 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs @@ -688,9 +688,9 @@ public List> /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Category + public IEnumerable Category { - get => _CategoryElement?.Select(elem => elem.Value); + get => _CategoryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs index 44ebb29d5..13c7d186e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs @@ -3362,9 +3362,9 @@ public List OccurrenceDateElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? OccurrenceDate + public IEnumerable OccurrenceDate { - get => _OccurrenceDateElement?.Select(elem => elem.Value); + get => _OccurrenceDateElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3433,9 +3433,9 @@ public List ExcludingDateElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ExcludingDate + public IEnumerable ExcludingDate { - get => _ExcludingDateElement?.Select(elem => elem.Value); + get => _ExcludingDateElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3465,9 +3465,9 @@ public List ExcludingRecurrenceIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ExcludingRecurrenceId + public IEnumerable ExcludingRecurrenceId { - get => _ExcludingRecurrenceIdElement?.Select(elem => elem.Value); + get => _ExcludingRecurrenceIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs index 49ce9d6ff..9669995c1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs @@ -368,9 +368,9 @@ public List PathElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Path + public IEnumerable Path { - get => _PathElement?.Select(elem => elem.Value); + get => _PathElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs index b78bc3b31..482ac3a4b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs @@ -404,9 +404,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs index e8439779f..9ec0233ab 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs @@ -93,9 +93,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs index e4691c308..e69060d50 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs @@ -274,9 +274,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -306,9 +306,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs index 57299305f..a2d77fd6c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs @@ -263,9 +263,9 @@ public List DefinitionUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DefinitionUri + public IEnumerable DefinitionUri { - get => _DefinitionUriElement?.Select(elem => elem.Value); + get => _DefinitionUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -295,9 +295,9 @@ public List DefinitionCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DefinitionCanonical + public IEnumerable DefinitionCanonical { - get => _DefinitionCanonicalElement?.Select(elem => elem.Value); + get => _DefinitionCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs index 25eb997fb..eb524df89 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs @@ -471,9 +471,9 @@ public List DerivedFromUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFromUri + public IEnumerable DerivedFromUri { - get => _DerivedFromUriElement?.Select(elem => elem.Value); + get => _DerivedFromUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -503,9 +503,9 @@ public List PartOfElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PartOf + public IEnumerable PartOf { - get => _PartOfElement?.Select(elem => elem.Value); + get => _PartOfElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -535,9 +535,9 @@ public List ReplacesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Replaces + public IEnumerable Replaces { - get => _ReplacesElement?.Select(elem => elem.Value); + get => _ReplacesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs index 0c313fe6f..9a33078fc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs @@ -1425,9 +1425,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1800,9 +1800,9 @@ public List CareTeamSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamSequence + public IEnumerable CareTeamSequence { - get => _CareTeamSequenceElement?.Select(elem => elem.Value); + get => _CareTeamSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1832,9 +1832,9 @@ public List DiagnosisSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisSequence + public IEnumerable DiagnosisSequence { - get => _DiagnosisSequenceElement?.Select(elem => elem.Value); + get => _DiagnosisSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1864,9 +1864,9 @@ public List ProcedureSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureSequence + public IEnumerable ProcedureSequence { - get => _ProcedureSequenceElement?.Select(elem => elem.Value); + get => _ProcedureSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1896,9 +1896,9 @@ public List InformationSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationSequence + public IEnumerable InformationSequence { - get => _InformationSequenceElement?.Select(elem => elem.Value); + get => _InformationSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs index c2ead9be8..c7b62a426 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs @@ -257,9 +257,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -828,9 +828,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1066,9 +1066,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1238,9 +1238,9 @@ public List ItemSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ItemSequence + public IEnumerable ItemSequence { - get => _ItemSequenceElement?.Select(elem => elem.Value); + get => _ItemSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1270,9 +1270,9 @@ public List DetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DetailSequence + public IEnumerable DetailSequence { - get => _DetailSequenceElement?.Select(elem => elem.Value); + get => _DetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1302,9 +1302,9 @@ public List SubdetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubdetailSequence + public IEnumerable SubdetailSequence { - get => _SubdetailSequenceElement?.Select(elem => elem.Value); + get => _SubdetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1578,9 +1578,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2193,9 +2193,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2611,9 +2611,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3710,9 +3710,9 @@ public List ExpressionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Expression + public IEnumerable Expression { - get => _ExpressionElement?.Select(elem => elem.Value); + get => _ExpressionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs index 8ac93c1b0..6c7111f8d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs @@ -430,9 +430,9 @@ public List ProtocolElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Protocol + public IEnumerable Protocol { - get => _ProtocolElement?.Select(elem => elem.Value); + get => _ProtocolElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs index 8aaed7d9a..3a6f2cebf 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs @@ -1377,9 +1377,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs index 5ad00db5c..223e9915c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs @@ -189,9 +189,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -221,9 +221,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs index 43996d3d0..1b6c2c0fc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs @@ -129,9 +129,9 @@ public List ParamElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Param + public IEnumerable Param { - get => _ParamElement?.Select(elem => elem.Value); + get => _ParamElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs index 4601a300e..9445513bd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs @@ -1247,9 +1247,9 @@ public List DefinitionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Definition + public IEnumerable Definition { - get => _DefinitionElement?.Select(elem => elem.Value); + get => _DefinitionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs index b0bf16070..42f24cde7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs @@ -346,9 +346,9 @@ public List VerificationDateElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? VerificationDate + public IEnumerable VerificationDate { - get => _VerificationDateElement?.Select(elem => elem.Value); + get => _VerificationDateElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs index aef91e5f1..8398baf26 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs @@ -924,9 +924,9 @@ public List NumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Number + public IEnumerable Number { - get => _NumberElement?.Select(elem => elem.Value); + get => _NumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1233,9 +1233,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1265,9 +1265,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1844,9 +1844,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1890,9 +1890,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2524,9 +2524,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2556,9 +2556,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2856,9 +2856,9 @@ public List LinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? LinkId + public IEnumerable LinkId { - get => _LinkIdElement?.Select(elem => elem.Value); + get => _LinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2918,9 +2918,9 @@ public List ContextLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ContextLinkId + public IEnumerable ContextLinkId { - get => _ContextLinkIdElement?.Select(elem => elem.Value); + get => _ContextLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2981,9 +2981,9 @@ public List RequesterLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? RequesterLinkId + public IEnumerable RequesterLinkId { - get => _RequesterLinkIdElement?.Select(elem => elem.Value); + get => _RequesterLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3057,9 +3057,9 @@ public List PerformerLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PerformerLinkId + public IEnumerable PerformerLinkId { - get => _PerformerLinkIdElement?.Select(elem => elem.Value); + get => _PerformerLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3104,9 +3104,9 @@ public List ReasonLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ReasonLinkId + public IEnumerable ReasonLinkId { - get => _ReasonLinkIdElement?.Select(elem => elem.Value); + get => _ReasonLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3150,9 +3150,9 @@ public List SecurityLabelNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SecurityLabelNumber + public IEnumerable SecurityLabelNumber { - get => _SecurityLabelNumberElement?.Select(elem => elem.Value); + get => _SecurityLabelNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4316,9 +4316,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs index 5ce0b0787..bf42cbd04 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs @@ -585,9 +585,9 @@ public List SupportingInfoSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SupportingInfoSequence + public IEnumerable SupportingInfoSequence { - get => _SupportingInfoSequenceElement?.Select(elem => elem.Value); + get => _SupportingInfoSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1043,9 +1043,9 @@ public List /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Purpose + public IEnumerable Purpose { - get => _PurposeElement?.Select(elem => elem.Value); + get => _PurposeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs index d255ba6dd..6f48f298b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs @@ -1076,9 +1076,9 @@ public List ExpressionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Expression + public IEnumerable Expression { - get => _ExpressionElement?.Select(elem => elem.Value); + get => _ExpressionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1225,9 +1225,9 @@ public List /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Purpose + public IEnumerable Purpose { - get => _PurposeElement?.Select(elem => elem.Value); + get => _PurposeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs index 8fafba8ec..6685a446c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs @@ -906,9 +906,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -955,9 +955,9 @@ public List MustSupportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? MustSupport + public IEnumerable MustSupport { - get => _MustSupportElement?.Select(elem => elem.Value); + get => _MustSupportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs index aca5ec7b4..e5074c3af 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs @@ -1044,9 +1044,9 @@ public List VersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Version + public IEnumerable Version { - get => _VersionElement?.Select(elem => elem.Value); + get => _VersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3122,9 +3122,9 @@ public List /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProductionIdentifierInUDI + public IEnumerable ProductionIdentifierInUDI { - get => _ProductionIdentifierInUDIElement?.Select(elem => elem.Value); + get => _ProductionIdentifierInUDIElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs index 684147112..b587b4ea5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs @@ -210,9 +210,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -242,9 +242,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs index ae80ff501..5dd91e877 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs @@ -154,9 +154,9 @@ public List MimeTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? MimeType + public IEnumerable MimeType { - get => _MimeTypeElement?.Select(elem => elem.Value); + get => _MimeTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -472,9 +472,9 @@ public List HeaderElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Header + public IEnumerable Header { - get => _HeaderElement?.Select(elem => elem.Value); + get => _HeaderElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs index af37cb9b4..443a85064 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs @@ -1387,9 +1387,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1696,9 +1696,9 @@ public List CareTeamSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamSequence + public IEnumerable CareTeamSequence { - get => _CareTeamSequenceElement?.Select(elem => elem.Value); + get => _CareTeamSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1728,9 +1728,9 @@ public List DiagnosisSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisSequence + public IEnumerable DiagnosisSequence { - get => _DiagnosisSequenceElement?.Select(elem => elem.Value); + get => _DiagnosisSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1760,9 +1760,9 @@ public List ProcedureSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureSequence + public IEnumerable ProcedureSequence { - get => _ProcedureSequenceElement?.Select(elem => elem.Value); + get => _ProcedureSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1792,9 +1792,9 @@ public List InformationSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationSequence + public IEnumerable InformationSequence { - get => _InformationSequenceElement?.Select(elem => elem.Value); + get => _InformationSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2111,9 +2111,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3191,9 +3191,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3741,9 +3741,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4030,9 +4030,9 @@ public List ItemSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ItemSequence + public IEnumerable ItemSequence { - get => _ItemSequenceElement?.Select(elem => elem.Value); + get => _ItemSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4062,9 +4062,9 @@ public List DetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DetailSequence + public IEnumerable DetailSequence { - get => _DetailSequenceElement?.Select(elem => elem.Value); + get => _DetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4094,9 +4094,9 @@ public List SubDetailSequenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubDetailSequence + public IEnumerable SubDetailSequence { - get => _SubDetailSequenceElement?.Select(elem => elem.Value); + get => _SubDetailSequenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4383,9 +4383,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -5020,9 +5020,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -5460,9 +5460,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -7134,9 +7134,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs index b3ae5f522..a82d70f20 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs @@ -643,9 +643,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -675,9 +675,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs index 8f071fafd..74bde3184 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs @@ -220,9 +220,9 @@ public List GivenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Given + public IEnumerable Given { - get => _GivenElement?.Select(elem => elem.Value); + get => _GivenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -252,9 +252,9 @@ public List PrefixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Prefix + public IEnumerable Prefix { - get => _PrefixElement?.Select(elem => elem.Value); + get => _PrefixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -284,9 +284,9 @@ public List SuffixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Suffix + public IEnumerable Suffix { - get => _SuffixElement?.Select(elem => elem.Value); + get => _SuffixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs index 6d9037377..4d7b44c5c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs @@ -397,9 +397,9 @@ public List SubsetElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Subset + public IEnumerable Subset { - get => _SubsetElement?.Select(elem => elem.Value); + get => _SubsetElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -611,9 +611,9 @@ public List CoordinateElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Coordinate + public IEnumerable Coordinate { - get => _CoordinateElement?.Select(elem => elem.Value); + get => _CoordinateElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -760,9 +760,9 @@ public List CoordinateElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Coordinate + public IEnumerable Coordinate { - get => _CoordinateElement?.Select(elem => elem.Value); + get => _CoordinateElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs index 98d443b90..e3d7332cc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs @@ -2926,9 +2926,9 @@ public List> FhirVersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FhirVersion + public IEnumerable FhirVersion { - get => _FhirVersionElement?.Select(elem => elem.Value); + get => _FhirVersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3042,9 +3042,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3829,9 +3829,9 @@ public List ImageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Image + public IEnumerable Image { - get => _ImageElement?.Select(elem => elem.Value); + get => _ImageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3861,9 +3861,9 @@ public List OtherElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Other + public IEnumerable Other { - get => _OtherElement?.Select(elem => elem.Value); + get => _OtherElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4050,9 +4050,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4271,9 +4271,9 @@ public List AnchorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Anchor + public IEnumerable Anchor { - get => _AnchorElement?.Select(elem => elem.Value); + get => _AnchorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4856,9 +4856,9 @@ public List> FhirVersionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? FhirVersion + public IEnumerable FhirVersion { - get => _FhirVersionElement?.Select(elem => elem.Value); + get => _FhirVersionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs index 662e7c46c..505bb67cc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs @@ -1377,9 +1377,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Location.cs b/src/Hl7.Fhir.R5/Model/Generated/Location.cs index 47c835b69..2e002462c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Location.cs @@ -399,9 +399,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs index 72957cc5b..41dd39f84 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs @@ -427,9 +427,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2254,9 +2254,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs index cee893e3d..df9ae185a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs @@ -2598,9 +2598,9 @@ public List NameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Name + public IEnumerable Name { - get => _NameElement?.Select(elem => elem.Value); + get => _NameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs index b1c2f7e6b..5d11d627b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs @@ -649,9 +649,9 @@ public List ReplacesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Replaces + public IEnumerable Replaces { - get => _ReplacesElement?.Select(elem => elem.Value); + get => _ReplacesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -980,9 +980,9 @@ public List ParentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Parent + public IEnumerable Parent { - get => _ParentElement?.Select(elem => elem.Value); + get => _ParentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs index e891c230b..3cfdb22b7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs @@ -566,9 +566,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -598,9 +598,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs index 3a707eb46..9a1f6f271 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs @@ -1794,9 +1794,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1826,9 +1826,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1858,9 +1858,9 @@ public List InstantiatesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Instantiates + public IEnumerable Instantiates { - get => _InstantiatesElement?.Select(elem => elem.Value); + get => _InstantiatesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs index 818d41edf..db895e208 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs @@ -663,9 +663,9 @@ public List> Perm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PermittedDataType + public IEnumerable PermittedDataType { - get => _PermittedDataTypeElement?.Select(elem => elem.Value); + get => _PermittedDataTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1291,9 +1291,9 @@ public List DerivedFromCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFromCanonical + public IEnumerable DerivedFromCanonical { - get => _DerivedFromCanonicalElement?.Select(elem => elem.Value); + get => _DerivedFromCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1323,9 +1323,9 @@ public List DerivedFromUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFromUri + public IEnumerable DerivedFromUri { - get => _DerivedFromUriElement?.Select(elem => elem.Value); + get => _DerivedFromUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1414,9 +1414,9 @@ public List> Perm /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PermittedDataType + public IEnumerable PermittedDataType { - get => _PermittedDataTypeElement?.Select(elem => elem.Value); + get => _PermittedDataTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs index 149de7303..9407ca96b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs @@ -210,9 +210,9 @@ public List> Sc /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Scope + public IEnumerable Scope { - get => _ScopeElement?.Select(elem => elem.Value); + get => _ScopeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -360,9 +360,9 @@ public List> AllowedTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? AllowedType + public IEnumerable AllowedType { - get => _AllowedTypeElement?.Select(elem => elem.Value); + get => _AllowedTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -392,9 +392,9 @@ public List TargetProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TargetProfile + public IEnumerable TargetProfile { - get => _TargetProfileElement?.Select(elem => elem.Value); + get => _TargetProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -971,9 +971,9 @@ public List ParameterNameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ParameterName + public IEnumerable ParameterName { - get => _ParameterNameElement?.Select(elem => elem.Value); + get => _ParameterNameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1659,9 +1659,9 @@ public List> ResourceEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Resource + public IEnumerable Resource { - get => _ResourceElement?.Select(elem => elem.Value); + get => _ResourceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs index ebcf1e209..bd837c9f0 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs @@ -328,9 +328,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs index 3eb3d6a80..0869a8bb0 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs @@ -925,9 +925,9 @@ public List DateElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Date + public IEnumerable Date { - get => _DateElement?.Select(elem => elem.Value); + get => _DateElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs index c151ba0ab..dd7aee19c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs @@ -1035,9 +1035,9 @@ public List GoalIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? GoalId + public IEnumerable GoalId { - get => _GoalIdElement?.Select(elem => elem.Value); + get => _GoalIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3444,9 +3444,9 @@ public List LibraryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Library + public IEnumerable Library { - get => _LibraryElement?.Select(elem => elem.Value); + get => _LibraryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs index d0fb0949c..91e6e2d86 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs @@ -373,9 +373,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -405,9 +405,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs index 0f8de72f3..70ccd9b14 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs @@ -499,9 +499,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs index 2ed8e0be2..489c0f0a4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs @@ -1531,9 +1531,9 @@ public List DerivedFromElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFrom + public IEnumerable DerivedFrom { - get => _DerivedFromElement?.Select(elem => elem.Value); + get => _DerivedFromElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1624,9 +1624,9 @@ public List> SubjectTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubjectType + public IEnumerable SubjectType { - get => _SubjectTypeElement?.Select(elem => elem.Value); + get => _SubjectTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs index 07b19d0d5..22b872166 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs @@ -2005,9 +2005,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2037,9 +2037,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs index 080c90b23..07d7f25f2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs @@ -190,9 +190,9 @@ public List> Conformanc /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Conformance + public IEnumerable Conformance { - get => _ConformanceElement?.Select(elem => elem.Value); + get => _ConformanceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -335,9 +335,9 @@ public List SatisfiedByElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SatisfiedBy + public IEnumerable SatisfiedBy { - get => _SatisfiedByElement?.Select(elem => elem.Value); + get => _SatisfiedByElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -367,9 +367,9 @@ public List ReferenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Reference + public IEnumerable Reference { - get => _ReferenceElement?.Select(elem => elem.Value); + get => _ReferenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -968,9 +968,9 @@ public List DerivedFromElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFrom + public IEnumerable DerivedFrom { - get => _DerivedFromElement?.Select(elem => elem.Value); + get => _DerivedFromElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1000,9 +1000,9 @@ public List ReferenceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Reference + public IEnumerable Reference { - get => _ReferenceElement?.Select(elem => elem.Value); + get => _ReferenceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1032,9 +1032,9 @@ public List ActorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Actor + public IEnumerable Actor { - get => _ActorElement?.Select(elem => elem.Value); + get => _ActorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs index eaa429278..54502b636 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs @@ -727,9 +727,9 @@ public List> BaseElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Base + public IEnumerable Base { - get => _BaseElement?.Select(elem => elem.Value); + get => _BaseElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -878,9 +878,9 @@ public List> TargetEleme /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Target + public IEnumerable Target { - get => _TargetElement?.Select(elem => elem.Value); + get => _TargetElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -968,9 +968,9 @@ public List> ComparatorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comparator + public IEnumerable Comparator { - get => _ComparatorElement?.Select(elem => elem.Value); + get => _ComparatorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1002,9 +1002,9 @@ public List> ModifierElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modifier + public IEnumerable Modifier { - get => _ModifierElement?.Select(elem => elem.Value); + get => _ModifierElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1034,9 +1034,9 @@ public List ChainElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Chain + public IEnumerable Chain { - get => _ChainElement?.Select(elem => elem.Value); + get => _ChainElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs index 0a183e837..dfd84315d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs @@ -416,9 +416,9 @@ public List InstantiatesCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesCanonical + public IEnumerable InstantiatesCanonical { - get => _InstantiatesCanonicalElement?.Select(elem => elem.Value); + get => _InstantiatesCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -448,9 +448,9 @@ public List InstantiatesUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InstantiatesUri + public IEnumerable InstantiatesUri { - get => _InstantiatesUriElement?.Select(elem => elem.Value); + get => _InstantiatesUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs index 9427db882..937272fa3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs @@ -1144,9 +1144,9 @@ public List DerivedFromCanonicalElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFromCanonical + public IEnumerable DerivedFromCanonical { - get => _DerivedFromCanonicalElement?.Select(elem => elem.Value); + get => _DerivedFromCanonicalElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1176,9 +1176,9 @@ public List DerivedFromUriElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFromUri + public IEnumerable DerivedFromUri { - get => _DerivedFromUriElement?.Select(elem => elem.Value); + get => _DerivedFromUriElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs index 75bfbd43c..ab613a54e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs @@ -1996,9 +1996,9 @@ public List> ListMo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ListMode + public IEnumerable ListMode { - get => _ListModeElement?.Select(elem => elem.Value); + get => _ListModeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2858,9 +2858,9 @@ public List ImportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Import + public IEnumerable Import { - get => _ImportElement?.Select(elem => elem.Value); + get => _ImportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs index 38f7a539b..25bdd2aea 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs @@ -207,9 +207,9 @@ public List> Supported /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SupportedInteraction + public IEnumerable SupportedInteraction { - get => _SupportedInteractionElement?.Select(elem => elem.Value); + get => _SupportedInteractionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -934,9 +934,9 @@ public List> ComparatorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comparator + public IEnumerable Comparator { - get => _ComparatorElement?.Select(elem => elem.Value); + get => _ComparatorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -968,9 +968,9 @@ public List> ModifierElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modifier + public IEnumerable Modifier { - get => _ModifierElement?.Select(elem => elem.Value); + get => _ModifierElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1152,9 +1152,9 @@ public List IncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Include + public IEnumerable Include { - get => _IncludeElement?.Select(elem => elem.Value); + get => _IncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1184,9 +1184,9 @@ public List RevIncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? RevInclude + public IEnumerable RevInclude { - get => _RevIncludeElement?.Select(elem => elem.Value); + get => _RevIncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1437,9 +1437,9 @@ public List DerivedFromElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DerivedFrom + public IEnumerable DerivedFrom { - get => _DerivedFromElement?.Select(elem => elem.Value); + get => _DerivedFromElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs index 3fec021cf..7f25332f0 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs @@ -435,9 +435,9 @@ public List DisulfideLinkageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DisulfideLinkage + public IEnumerable DisulfideLinkage { - get => _DisulfideLinkageElement?.Select(elem => elem.Value); + get => _DisulfideLinkageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs index 2b4f8cf98..7ec8d8704 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs @@ -1174,9 +1174,9 @@ public List ParentSubstanceNameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ParentSubstanceName + public IEnumerable ParentSubstanceName { - get => _ParentSubstanceNameElement?.Select(elem => elem.Value); + get => _ParentSubstanceNameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1220,9 +1220,9 @@ public List GeographicalLocationElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? GeographicalLocation + public IEnumerable GeographicalLocation { - get => _GeographicalLocationElement?.Select(elem => elem.Value); + get => _GeographicalLocationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs index c1fd5a08e..b9dab7af1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs @@ -704,9 +704,9 @@ public List> LanguageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Language + public IEnumerable Language { - get => _LanguageElement?.Select(elem => elem.Value); + get => _LanguageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -750,9 +750,9 @@ public List PropertyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Property + public IEnumerable Property { - get => _PropertyElement?.Select(elem => elem.Value); + get => _PropertyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -930,9 +930,9 @@ public List OpElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Op + public IEnumerable Op { - get => _OpElement?.Select(elem => elem.Value); + get => _OpElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs index c63e6918a..661dea7b1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs @@ -1241,9 +1241,9 @@ public List OriginElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Origin + public IEnumerable Origin { - get => _OriginElement?.Select(elem => elem.Value); + get => _OriginElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1301,9 +1301,9 @@ public List LinkElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Link + public IEnumerable Link { - get => _LinkElement?.Select(elem => elem.Value); + get => _LinkElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -5210,9 +5210,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs index 9e8b8d67e..beb838e89 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs @@ -624,9 +624,9 @@ public List> DayOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DayOfWeek + public IEnumerable DayOfWeek { - get => _DayOfWeekElement?.Select(elem => elem.Value); + get => _DayOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -656,9 +656,9 @@ public List TimeOfDayElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TimeOfDay + public IEnumerable TimeOfDay { - get => _TimeOfDayElement?.Select(elem => elem.Value); + get => _TimeOfDayElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -690,9 +690,9 @@ public List> WhenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? When + public IEnumerable When { - get => _WhenElement?.Select(elem => elem.Value); + get => _WhenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -937,9 +937,9 @@ public List EventElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Event + public IEnumerable Event { - get => _EventElement?.Select(elem => elem.Value); + get => _EventElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs index 42b4cafa8..73481dd74 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs @@ -830,9 +830,9 @@ public List TargetLocationElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TargetLocation + public IEnumerable TargetLocation { - get => _TargetLocationElement?.Select(elem => elem.Value); + get => _TargetLocationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs index 7b69b4c91..920c1389a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs @@ -107,9 +107,9 @@ public List AdditionalInfoElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? AdditionalInfo + public IEnumerable AdditionalInfo { - get => _AdditionalInfoElement?.Select(elem => elem.Value); + get => _AdditionalInfoElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs index 0607ab89e..ac1937df1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs @@ -232,9 +232,9 @@ public List LineElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Line + public IEnumerable Line { - get => _LineElement?.Select(elem => elem.Value); + get => _LineElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs index 264db83d2..8f51ba1ed 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs @@ -637,9 +637,9 @@ public List> /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Category + public IEnumerable Category { - get => _CategoryElement?.Select(elem => elem.Value); + get => _CategoryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs index 4dc497a47..1f659200e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs @@ -357,9 +357,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs index a4bda6768..0bf1ee9a2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs @@ -905,9 +905,9 @@ public List CompartmentElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Compartment + public IEnumerable Compartment { - get => _CompartmentElement?.Select(elem => elem.Value); + get => _CompartmentElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1699,9 +1699,9 @@ public List> Re /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ReferencePolicy + public IEnumerable ReferencePolicy { - get => _ReferencePolicyElement?.Select(elem => elem.Value); + get => _ReferencePolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1731,9 +1731,9 @@ public List SearchIncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SearchInclude + public IEnumerable SearchInclude { - get => _SearchIncludeElement?.Select(elem => elem.Value); + get => _SearchIncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1763,9 +1763,9 @@ public List SearchRevIncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SearchRevInclude + public IEnumerable SearchRevInclude { - get => _SearchRevIncludeElement?.Select(elem => elem.Value); + get => _SearchRevIncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3968,9 +3968,9 @@ public List InstantiatesElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Instantiates + public IEnumerable Instantiates { - get => _InstantiatesElement?.Select(elem => elem.Value); + get => _InstantiatesElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4087,9 +4087,9 @@ public List FormatElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Format + public IEnumerable Format { - get => _FormatElement?.Select(elem => elem.Value); + get => _FormatElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4120,9 +4120,9 @@ public List PatchFormatElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PatchFormat + public IEnumerable PatchFormat { - get => _PatchFormatElement?.Select(elem => elem.Value); + get => _PatchFormatElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -4152,9 +4152,9 @@ public List ImplementationGuideElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ImplementationGuide + public IEnumerable ImplementationGuide { - get => _ImplementationGuideElement?.Select(elem => elem.Value); + get => _ImplementationGuideElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs index 9a137c1d8..9e8f1d57c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs @@ -262,9 +262,9 @@ public List DefinitionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Definition + public IEnumerable Definition { - get => _DefinitionElement?.Select(elem => elem.Value); + get => _DefinitionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs index 730b00c98..4b910a1e4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs @@ -1298,9 +1298,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1654,9 +1654,9 @@ public List CareTeamLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamLinkId + public IEnumerable CareTeamLinkId { - get => _CareTeamLinkIdElement?.Select(elem => elem.Value); + get => _CareTeamLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1686,9 +1686,9 @@ public List DiagnosisLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisLinkId + public IEnumerable DiagnosisLinkId { - get => _DiagnosisLinkIdElement?.Select(elem => elem.Value); + get => _DiagnosisLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1718,9 +1718,9 @@ public List ProcedureLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureLinkId + public IEnumerable ProcedureLinkId { - get => _ProcedureLinkIdElement?.Select(elem => elem.Value); + get => _ProcedureLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1750,9 +1750,9 @@ public List InformationLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationLinkId + public IEnumerable InformationLinkId { - get => _InformationLinkIdElement?.Select(elem => elem.Value); + get => _InformationLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs index 0339f7ab4..d1a008f1b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs @@ -126,9 +126,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -493,9 +493,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -686,9 +686,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -827,9 +827,9 @@ public List SequenceLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SequenceLinkId + public IEnumerable SequenceLinkId { - get => _SequenceLinkIdElement?.Select(elem => elem.Value); + get => _SequenceLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -929,9 +929,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1208,9 +1208,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2095,9 +2095,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs index f0af6e8ca..56145ed2e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs @@ -579,9 +579,9 @@ public List ProtocolElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Protocol + public IEnumerable Protocol { - get => _ProtocolElement?.Select(elem => elem.Value); + get => _ProtocolElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs index a062c1800..7557bb65d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs @@ -270,9 +270,9 @@ public List> OperatorElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Operator + public IEnumerable Operator { - get => _OperatorElement?.Select(elem => elem.Value); + get => _OperatorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs index 6bb2f3217..84cb84597 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs @@ -129,9 +129,9 @@ public List ParamElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Param + public IEnumerable Param { - get => _ParamElement?.Select(elem => elem.Value); + get => _ParamElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs index 07d512345..b5c38cf2f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs @@ -198,9 +198,9 @@ public List> ModeEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Mode + public IEnumerable Mode { - get => _ModeElement?.Select(elem => elem.Value); + get => _ModeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs index ee86331ee..f8a4f8456 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs @@ -142,9 +142,9 @@ public List ValueCodeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ValueCode + public IEnumerable ValueCode { - get => _ValueCodeElement?.Select(elem => elem.Value); + get => _ValueCodeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -460,9 +460,9 @@ public List ProfileElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Profile + public IEnumerable Profile { - get => _ProfileElement?.Select(elem => elem.Value); + get => _ProfileElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -492,9 +492,9 @@ public List MustSupportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? MustSupport + public IEnumerable MustSupport { - get => _MustSupportElement?.Select(elem => elem.Value); + get => _MustSupportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs index 6ca491f8a..7e51a3ae8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs @@ -908,9 +908,9 @@ public List> AggregationE /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Aggregation + public IEnumerable Aggregation { - get => _AggregationElement?.Select(elem => elem.Value); + get => _AggregationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1959,9 +1959,9 @@ public List> Repre /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Representation + public IEnumerable Representation { - get => _RepresentationElement?.Select(elem => elem.Value); + get => _RepresentationElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2187,9 +2187,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2503,9 +2503,9 @@ public List ConditionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Condition + public IEnumerable Condition { - get => _ConditionElement?.Select(elem => elem.Value); + get => _ConditionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs index 6f8968619..c809929d0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs @@ -273,9 +273,9 @@ public List PayloadMimeTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PayloadMimeType + public IEnumerable PayloadMimeType { - get => _PayloadMimeTypeElement?.Select(elem => elem.Value); + get => _PayloadMimeTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -334,9 +334,9 @@ public List HeaderElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Header + public IEnumerable Header { - get => _HeaderElement?.Select(elem => elem.Value); + get => _HeaderElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs index eadf0c8ff..87c5c8223 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs @@ -1367,9 +1367,9 @@ public List PreAuthRefElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? PreAuthRef + public IEnumerable PreAuthRef { - get => _PreAuthRefElement?.Select(elem => elem.Value); + get => _PreAuthRefElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1667,9 +1667,9 @@ public List CareTeamLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? CareTeamLinkId + public IEnumerable CareTeamLinkId { - get => _CareTeamLinkIdElement?.Select(elem => elem.Value); + get => _CareTeamLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1699,9 +1699,9 @@ public List DiagnosisLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DiagnosisLinkId + public IEnumerable DiagnosisLinkId { - get => _DiagnosisLinkIdElement?.Select(elem => elem.Value); + get => _DiagnosisLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1731,9 +1731,9 @@ public List ProcedureLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProcedureLinkId + public IEnumerable ProcedureLinkId { - get => _ProcedureLinkIdElement?.Select(elem => elem.Value); + get => _ProcedureLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1763,9 +1763,9 @@ public List InformationLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? InformationLinkId + public IEnumerable InformationLinkId { - get => _InformationLinkIdElement?.Select(elem => elem.Value); + get => _InformationLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2027,9 +2027,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2735,9 +2735,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3197,9 +3197,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3437,9 +3437,9 @@ public List SequenceLinkIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SequenceLinkId + public IEnumerable SequenceLinkId { - get => _SequenceLinkIdElement?.Select(elem => elem.Value); + get => _SequenceLinkIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3539,9 +3539,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -3818,9 +3818,9 @@ public List NoteNumberElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? NoteNumber + public IEnumerable NoteNumber { - get => _NoteNumberElement?.Select(elem => elem.Value); + get => _NoteNumberElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs index f02648889..c31b80a45 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs @@ -97,9 +97,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -730,9 +730,9 @@ public List ProgramNameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ProgramName + public IEnumerable ProgramName { - get => _ProgramNameElement?.Select(elem => elem.Value); + get => _ProgramNameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs index f66b3f424..02bc6cb91 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs @@ -220,9 +220,9 @@ public List GivenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Given + public IEnumerable Given { - get => _GivenElement?.Select(elem => elem.Value); + get => _GivenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -252,9 +252,9 @@ public List PrefixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Prefix + public IEnumerable Prefix { - get => _PrefixElement?.Select(elem => elem.Value); + get => _PrefixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -284,9 +284,9 @@ public List SuffixElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Suffix + public IEnumerable Suffix { - get => _SuffixElement?.Select(elem => elem.Value); + get => _SuffixElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs index cf26241fa..4854871bb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs @@ -982,9 +982,9 @@ public List> TypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Type + public IEnumerable Type { - get => _TypeElement?.Select(elem => elem.Value); + get => _TypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1014,9 +1014,9 @@ public List PackageElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Package + public IEnumerable Package { - get => _PackageElement?.Select(elem => elem.Value); + get => _PackageElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1574,9 +1574,9 @@ public List BinaryElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Binary + public IEnumerable Binary { - get => _BinaryElement?.Select(elem => elem.Value); + get => _BinaryElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs index 49a1e60f1..67e1cb1ed 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs @@ -398,9 +398,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs index b5c894f43..431131322 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs @@ -1605,9 +1605,9 @@ public List DefinitionElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Definition + public IEnumerable Definition { - get => _DefinitionElement?.Select(elem => elem.Value); + get => _DefinitionElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs index b53419a86..6c8950f64 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs @@ -661,9 +661,9 @@ public List ParameterNameElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ParameterName + public IEnumerable ParameterName { - get => _ParameterNameElement?.Select(elem => elem.Value); + get => _ParameterNameElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1223,9 +1223,9 @@ public List> ResourceElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Resource + public IEnumerable Resource { - get => _ResourceElement?.Select(elem => elem.Value); + get => _ResourceElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs index 6645106d7..83387668f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs @@ -324,9 +324,9 @@ public List AliasElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Alias + public IEnumerable Alias { - get => _AliasElement?.Select(elem => elem.Value); + get => _AliasElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs index ef00192e7..5ad812cd2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs @@ -619,9 +619,9 @@ public List GoalIdElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? GoalId + public IEnumerable GoalId { - get => _GoalIdElement?.Select(elem => elem.Value); + get => _GoalIdElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs index 724576aba..0e7000b62 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs @@ -100,9 +100,9 @@ public List> DaysOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DaysOfWeek + public IEnumerable DaysOfWeek { - get => _DaysOfWeekElement?.Select(elem => elem.Value); + get => _DaysOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs index 4dd17277e..37372519f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs @@ -468,9 +468,9 @@ public List IncludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Include + public IEnumerable Include { - get => _IncludeElement?.Select(elem => elem.Value); + get => _IncludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -500,9 +500,9 @@ public List ExcludeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Exclude + public IEnumerable Exclude { - get => _ExcludeElement?.Select(elem => elem.Value); + get => _ExcludeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs index e9834d60b..7e1971af5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs @@ -504,9 +504,9 @@ public List PolicyElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Policy + public IEnumerable Policy { - get => _PolicyElement?.Select(elem => elem.Value); + get => _PolicyElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs index 98062bfcd..eb4949e57 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs @@ -1456,9 +1456,9 @@ public List> SubjectTypeElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? SubjectType + public IEnumerable SubjectType { - get => _SubjectTypeElement?.Select(elem => elem.Value); + get => _SubjectTypeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs index 1af310283..714aaea5c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs @@ -690,9 +690,9 @@ public List> BaseElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Base + public IEnumerable Base { - get => _BaseElement?.Select(elem => elem.Value); + get => _BaseElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -898,9 +898,9 @@ public List> TargetElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Target + public IEnumerable Target { - get => _TargetElement?.Select(elem => elem.Value); + get => _TargetElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -932,9 +932,9 @@ public List> ComparatorEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Comparator + public IEnumerable Comparator { - get => _ComparatorElement?.Select(elem => elem.Value); + get => _ComparatorElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -966,9 +966,9 @@ public List> ModifierEle /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Modifier + public IEnumerable Modifier { - get => _ModifierElement?.Select(elem => elem.Value); + get => _ModifierElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -998,9 +998,9 @@ public List ChainElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Chain + public IEnumerable Chain { - get => _ChainElement?.Select(elem => elem.Value); + get => _ChainElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs index 8b2eb87aa..98390e056 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs @@ -1081,9 +1081,9 @@ public List ContextElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Context + public IEnumerable Context { - get => _ContextElement?.Select(elem => elem.Value); + get => _ContextElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1113,9 +1113,9 @@ public List ContextInvariantElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ContextInvariant + public IEnumerable ContextInvariant { - get => _ContextInvariantElement?.Select(elem => elem.Value); + get => _ContextInvariantElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs index fa5bcad49..2a379077e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs @@ -1864,9 +1864,9 @@ public List> ListMo /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ListMode + public IEnumerable ListMode { - get => _ListModeElement?.Select(elem => elem.Value); + get => _ListModeElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2224,9 +2224,9 @@ public List VariableElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Variable + public IEnumerable Variable { - get => _VariableElement?.Select(elem => elem.Value); + get => _VariableElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -2710,9 +2710,9 @@ public List ImportElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Import + public IEnumerable Import { - get => _ImportElement?.Select(elem => elem.Value); + get => _ImportElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs index cdd8675f6..e6b68d651 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs @@ -258,9 +258,9 @@ public List HeaderElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Header + public IEnumerable Header { - get => _HeaderElement?.Select(elem => elem.Value); + get => _HeaderElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs index 22a9c1a23..8fbd44c7d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs @@ -961,9 +961,9 @@ public List OriginElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Origin + public IEnumerable Origin { - get => _OriginElement?.Select(elem => elem.Value); + get => _OriginElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -1021,9 +1021,9 @@ public List LinkElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Link + public IEnumerable Link { - get => _LinkElement?.Select(elem => elem.Value); + get => _LinkElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs index 0a6892e3d..cf99411e1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs @@ -579,9 +579,9 @@ public List> DayOfWeekElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? DayOfWeek + public IEnumerable DayOfWeek { - get => _DayOfWeekElement?.Select(elem => elem.Value); + get => _DayOfWeekElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -611,9 +611,9 @@ public List TimeOfDayElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? TimeOfDay + public IEnumerable TimeOfDay { - get => _TimeOfDayElement?.Select(elem => elem.Value); + get => _TimeOfDayElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -645,9 +645,9 @@ public List> WhenElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? When + public IEnumerable When { - get => _WhenElement?.Select(elem => elem.Value); + get => _WhenElement?.Select(elem => elem.Value) ?? []; set { if (value == null) @@ -892,9 +892,9 @@ public List EventElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? Event + public IEnumerable Event { - get => _EventElement?.Select(elem => elem.Value); + get => _EventElement?.Select(elem => elem.Value) ?? []; set { if (value == null) diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs index 4c465c3b0..94be85997 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs @@ -369,9 +369,9 @@ public List ValueSetElement /// /// This uses the native .NET datatype, rather than the FHIR equivalent [IgnoreDataMember] - public IEnumerable? ValueSet + public IEnumerable ValueSet { - get => _ValueSetElement?.Select(elem => elem.Value); + get => _ValueSetElement?.Select(elem => elem.Value) ?? []; set { if (value == null) From a5d894061c246c9de9e887220175de7de47b2ba4 Mon Sep 17 00:00:00 2001 From: Ewout Kramer Date: Mon, 24 Feb 2025 21:38:31 +0100 Subject: [PATCH 6/6] Latest updates --- .../Model/Generated/Attachment.cs | 5 +- .../Model/Generated/BackboneElement.cs | 5 +- .../Model/Generated/BackboneType.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/Binary.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/Bundle.cs | 30 ++-- .../Model/Generated/CodeableConcept.cs | 5 +- .../Model/Generated/CodeableReference.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/Coding.cs | 5 +- .../Model/Generated/ContactDetail.cs | 5 +- .../Model/Generated/ContactPoint.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/DataType.cs | 3 +- .../Model/Generated/DomainResource.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/Element.cs | 5 +- .../Model/Generated/Extension.cs | 5 +- .../Model/Generated/Identifier.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/Meta.cs | 5 +- .../Model/Generated/Narrative.cs | 5 +- .../Model/Generated/OperationOutcome.cs | 10 +- .../Model/Generated/Parameters.cs | 10 +- src/Hl7.Fhir.Base/Model/Generated/Period.cs | 5 +- .../Model/Generated/PrimitiveType.cs | 3 +- src/Hl7.Fhir.Base/Model/Generated/Quantity.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/Range.cs | 5 +- src/Hl7.Fhir.Base/Model/Generated/Resource.cs | 5 +- .../Model/Generated/ResourceReference.cs | 5 +- .../Model/Generated/Signature.cs | 5 +- .../Model/Generated/UsageContext.cs | 5 +- .../Model/Generated/CapabilityStatement.cs | 70 +++++---- .../Model/Generated/CodeSystem.cs | 30 ++-- .../Model/Generated/ElementDefinition.cs | 50 ++++--- .../Model/Generated/RelatedArtifact.cs | 5 +- .../Model/Generated/StructureDefinition.cs | 25 ++-- .../Model/Generated/ValueSet.cs | 65 +++++---- src/Hl7.Fhir.R4/Model/Generated/Account.cs | 17 ++- .../Model/Generated/ActivityDefinition.cs | 17 ++- src/Hl7.Fhir.R4/Model/Generated/Address.cs | 5 +- .../Model/Generated/AdverseEvent.cs | 17 ++- .../Model/Generated/AllergyIntolerance.cs | 12 +- src/Hl7.Fhir.R4/Model/Generated/Annotation.cs | 5 +- .../Model/Generated/Appointment.cs | 12 +- .../Model/Generated/AppointmentResponse.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs | 30 ++-- src/Hl7.Fhir.R4/Model/Generated/Basic.cs | 7 +- .../Generated/BiologicallyDerivedProduct.cs | 25 ++-- .../Model/Generated/BodyStructure.cs | 7 +- src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs | 17 ++- src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs | 12 +- .../Model/Generated/CatalogEntry.cs | 10 +- src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs | 12 +- .../Model/Generated/ChargeItemDefinition.cs | 22 +-- src/Hl7.Fhir.R4/Model/Generated/Claim.cs | 62 ++++---- .../Model/Generated/ClaimResponse.cs | 65 +++++---- .../Model/Generated/ClinicalImpression.cs | 17 ++- .../Model/Generated/Communication.cs | 12 +- .../Model/Generated/CommunicationRequest.cs | 12 +- .../Model/Generated/CompartmentDefinition.cs | 10 +- .../Model/Generated/Composition.cs | 27 ++-- src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs | 30 ++-- src/Hl7.Fhir.R4/Model/Generated/Condition.cs | 17 ++- src/Hl7.Fhir.R4/Model/Generated/Consent.cs | 32 +++-- src/Hl7.Fhir.R4/Model/Generated/Contract.cs | 80 ++++++----- .../Model/Generated/Contributor.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Coverage.cs | 22 +-- .../Generated/CoverageEligibilityRequest.cs | 25 ++-- .../Generated/CoverageEligibilityResponse.cs | 25 ++-- .../Model/Generated/DataRequirement.cs | 20 +-- .../Model/Generated/DetectedIssue.cs | 17 ++- src/Hl7.Fhir.R4/Model/Generated/Device.cs | 32 +++-- .../Model/Generated/DeviceDefinition.cs | 35 +++-- .../Model/Generated/DeviceMetric.cs | 12 +- .../Model/Generated/DeviceRequest.cs | 12 +- .../Model/Generated/DeviceUseStatement.cs | 5 +- .../Model/Generated/DiagnosticReport.cs | 12 +- .../Model/Generated/DocumentManifest.cs | 10 +- .../Model/Generated/DocumentReference.cs | 20 +-- src/Hl7.Fhir.R4/Model/Generated/Dosage.cs | 10 +- .../Generated/EffectEvidenceSynthesis.cs | 35 +++-- src/Hl7.Fhir.R4/Model/Generated/Encounter.cs | 37 +++-- src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs | 5 +- .../Model/Generated/EnrollmentRequest.cs | 5 +- .../Model/Generated/EnrollmentResponse.cs | 5 +- .../Model/Generated/EpisodeOfCare.cs | 17 ++- .../Model/Generated/EventDefinition.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Evidence.cs | 5 +- .../Model/Generated/EvidenceVariable.cs | 10 +- .../Model/Generated/ExampleScenario.cs | 45 +++--- .../Model/Generated/ExplanationOfBenefit.cs | 107 ++++++++------ src/Hl7.Fhir.R4/Model/Generated/Expression.cs | 5 +- .../Model/Generated/FamilyMemberHistory.cs | 10 +- src/Hl7.Fhir.R4/Model/Generated/Flag.cs | 7 +- src/Hl7.Fhir.R4/Model/Generated/Goal.cs | 12 +- .../Model/Generated/GraphDefinition.cs | 20 +-- src/Hl7.Fhir.R4/Model/Generated/Group.cs | 17 ++- .../Model/Generated/GuidanceResponse.cs | 7 +- .../Model/Generated/HealthcareService.cs | 22 +-- src/Hl7.Fhir.R4/Model/Generated/HumanName.cs | 5 +- .../Model/Generated/ImagingStudy.cs | 20 +-- .../Model/Generated/Immunization.cs | 27 ++-- .../Model/Generated/ImmunizationEvaluation.cs | 5 +- .../Generated/ImmunizationRecommendation.cs | 15 +- .../Model/Generated/ImplementationGuide.cs | 60 ++++---- .../Model/Generated/InsurancePlan.cs | 50 ++++--- src/Hl7.Fhir.R4/Model/Generated/Invoice.cs | 20 +-- src/Hl7.Fhir.R4/Model/Generated/Library.cs | 7 +- src/Hl7.Fhir.R4/Model/Generated/Linkage.cs | 10 +- src/Hl7.Fhir.R4/Model/Generated/List.cs | 12 +- src/Hl7.Fhir.R4/Model/Generated/Location.cs | 17 ++- .../Model/Generated/MarketingStatus.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Measure.cs | 32 +++-- .../Model/Generated/MeasureReport.cs | 35 +++-- src/Hl7.Fhir.R4/Model/Generated/Media.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Medication.cs | 17 ++- .../Generated/MedicationAdministration.cs | 17 ++- .../Model/Generated/MedicationDispense.cs | 17 ++- .../Model/Generated/MedicationKnowledge.cs | 87 ++++++----- .../Model/Generated/MedicationRequest.cs | 22 +-- .../Model/Generated/MedicationStatement.cs | 7 +- .../Model/Generated/MedicinalProduct.cs | 30 ++-- .../MedicinalProductAuthorization.cs | 15 +- .../MedicinalProductContraindication.cs | 10 +- .../Generated/MedicinalProductIndication.cs | 10 +- .../Generated/MedicinalProductIngredient.cs | 25 ++-- .../Generated/MedicinalProductInteraction.cs | 10 +- .../Generated/MedicinalProductManufactured.cs | 5 +- .../Generated/MedicinalProductPackaged.cs | 15 +- .../MedicinalProductPharmaceutical.cs | 25 ++-- .../MedicinalProductUndesirableEffect.cs | 5 +- .../Model/Generated/MessageDefinition.cs | 17 ++- .../Model/Generated/MessageHeader.cs | 20 +-- .../Model/Generated/MolecularSequence.cs | 45 +++--- src/Hl7.Fhir.R4/Model/Generated/Money.cs | 5 +- .../Model/Generated/NamingSystem.cs | 10 +- .../Model/Generated/NutritionOrder.cs | 35 +++-- .../Model/Generated/Observation.cs | 17 ++- .../Model/Generated/ObservationDefinition.cs | 17 ++- .../Model/Generated/OperationDefinition.cs | 27 ++-- .../Model/Generated/Organization.cs | 10 +- .../Generated/OrganizationAffiliation.cs | 5 +- .../Model/Generated/ParameterDefinition.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Patient.cs | 20 +-- .../Model/Generated/PaymentNotice.cs | 5 +- .../Model/Generated/PaymentReconciliation.cs | 15 +- src/Hl7.Fhir.R4/Model/Generated/Person.cs | 10 +- .../Model/Generated/PlanDefinition.cs | 40 +++--- src/Hl7.Fhir.R4/Model/Generated/Population.cs | 5 +- .../Model/Generated/Practitioner.cs | 10 +- .../Model/Generated/PractitionerRole.cs | 17 ++- src/Hl7.Fhir.R4/Model/Generated/Procedure.cs | 17 ++- .../Model/Generated/ProdCharacteristic.cs | 5 +- .../Model/Generated/ProductShelfLife.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Provenance.cs | 15 +- .../Model/Generated/Questionnaire.cs | 27 ++-- .../Model/Generated/QuestionnaireResponse.cs | 15 +- src/Hl7.Fhir.R4/Model/Generated/Ratio.cs | 5 +- .../Model/Generated/RelatedPerson.cs | 12 +- .../Model/Generated/RequestGroup.cs | 22 +-- .../Model/Generated/ResearchDefinition.cs | 5 +- .../Generated/ResearchElementDefinition.cs | 10 +- .../Model/Generated/ResearchStudy.cs | 15 +- .../Model/Generated/ResearchSubject.cs | 5 +- .../Model/Generated/RiskAssessment.cs | 12 +- .../Model/Generated/RiskEvidenceSynthesis.cs | 30 ++-- .../Model/Generated/SampledData.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Schedule.cs | 5 +- .../Model/Generated/SearchParameter.cs | 12 +- .../Model/Generated/ServiceRequest.cs | 7 +- src/Hl7.Fhir.R4/Model/Generated/Slot.cs | 5 +- src/Hl7.Fhir.R4/Model/Generated/Specimen.cs | 22 +-- .../Model/Generated/SpecimenDefinition.cs | 25 ++-- .../Model/Generated/StructureMap.cs | 45 +++--- .../Model/Generated/Subscription.cs | 10 +- src/Hl7.Fhir.R4/Model/Generated/Substance.cs | 17 ++- .../Model/Generated/SubstanceAmount.cs | 10 +- .../Model/Generated/SubstanceNucleicAcid.cs | 20 +-- .../Model/Generated/SubstancePolymer.cs | 35 +++-- .../Model/Generated/SubstanceProtein.cs | 10 +- .../SubstanceReferenceInformation.cs | 25 ++-- .../Generated/SubstanceSourceMaterial.cs | 35 +++-- .../Model/Generated/SubstanceSpecification.cs | 55 ++++--- .../Model/Generated/SupplyDelivery.cs | 12 +- .../Model/Generated/SupplyRequest.cs | 12 +- src/Hl7.Fhir.R4/Model/Generated/Task.cs | 22 +-- .../Generated/TerminologyCapabilities.cs | 55 ++++--- src/Hl7.Fhir.R4/Model/Generated/TestReport.cs | 50 ++++--- src/Hl7.Fhir.R4/Model/Generated/TestScript.cs | 85 ++++++----- src/Hl7.Fhir.R4/Model/Generated/Timing.cs | 10 +- .../Model/Generated/TriggerDefinition.cs | 5 +- .../Model/Generated/VerificationResult.cs | 20 +-- .../Model/Generated/VisionPrescription.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/Account.cs | 15 +- .../Model/Generated/ActivityDefinition.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/Address.cs | 5 +- .../AdministrableProductDefinition.cs | 25 ++-- .../Model/Generated/AdverseEvent.cs | 15 +- .../Model/Generated/AllergyIntolerance.cs | 10 +- .../Model/Generated/Annotation.cs | 5 +- .../Model/Generated/Appointment.cs | 10 +- .../Model/Generated/AppointmentResponse.cs | 5 +- .../Model/Generated/AuditEvent.cs | 30 ++-- src/Hl7.Fhir.R4B/Model/Generated/Basic.cs | 5 +- .../Generated/BiologicallyDerivedProduct.cs | 25 ++-- .../Model/Generated/BodyStructure.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs | 10 +- .../Model/Generated/CatalogEntry.cs | 10 +- .../Model/Generated/ChargeItem.cs | 10 +- .../Model/Generated/ChargeItemDefinition.cs | 20 +-- src/Hl7.Fhir.R4B/Model/Generated/Citation.cs | 120 +++++++++------- src/Hl7.Fhir.R4B/Model/Generated/Claim.cs | 60 ++++---- .../Model/Generated/ClaimResponse.cs | 65 +++++---- .../Model/Generated/ClinicalImpression.cs | 15 +- .../Model/Generated/ClinicalUseDefinition.cs | 40 +++--- .../Model/Generated/Communication.cs | 10 +- .../Model/Generated/CommunicationRequest.cs | 10 +- .../Model/Generated/CompartmentDefinition.cs | 10 +- .../Model/Generated/Composition.cs | 25 ++-- .../Model/Generated/ConceptMap.cs | 30 ++-- src/Hl7.Fhir.R4B/Model/Generated/Condition.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/Consent.cs | 30 ++-- src/Hl7.Fhir.R4B/Model/Generated/Contract.cs | 80 ++++++----- .../Model/Generated/Contributor.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs | 20 +-- .../Generated/CoverageEligibilityRequest.cs | 25 ++-- .../Generated/CoverageEligibilityResponse.cs | 25 ++-- .../Model/Generated/DataRequirement.cs | 20 +-- .../Model/Generated/DetectedIssue.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/Device.cs | 30 ++-- .../Model/Generated/DeviceDefinition.cs | 35 +++-- .../Model/Generated/DeviceMetric.cs | 10 +- .../Model/Generated/DeviceRequest.cs | 10 +- .../Model/Generated/DeviceUseStatement.cs | 5 +- .../Model/Generated/DiagnosticReport.cs | 10 +- .../Model/Generated/DocumentManifest.cs | 10 +- .../Model/Generated/DocumentReference.cs | 20 +-- src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs | 10 +- src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs | 35 +++-- src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs | 5 +- .../Model/Generated/EnrollmentRequest.cs | 5 +- .../Model/Generated/EnrollmentResponse.cs | 5 +- .../Model/Generated/EpisodeOfCare.cs | 15 +- .../Model/Generated/EventDefinition.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs | 40 +++--- .../Model/Generated/EvidenceReport.cs | 25 ++-- .../Model/Generated/EvidenceVariable.cs | 20 +-- .../Model/Generated/ExampleScenario.cs | 45 +++--- .../Model/Generated/ExplanationOfBenefit.cs | 105 ++++++++------ .../Model/Generated/Expression.cs | 5 +- .../Model/Generated/FamilyMemberHistory.cs | 10 +- src/Hl7.Fhir.R4B/Model/Generated/Flag.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Goal.cs | 10 +- .../Model/Generated/GraphDefinition.cs | 20 +-- src/Hl7.Fhir.R4B/Model/Generated/Group.cs | 15 +- .../Model/Generated/GuidanceResponse.cs | 5 +- .../Model/Generated/HealthcareService.cs | 20 +-- src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs | 5 +- .../Model/Generated/ImagingStudy.cs | 20 +-- .../Model/Generated/Immunization.cs | 25 ++-- .../Model/Generated/ImmunizationEvaluation.cs | 5 +- .../Generated/ImmunizationRecommendation.cs | 15 +- .../Model/Generated/ImplementationGuide.cs | 60 ++++---- .../Model/Generated/Ingredient.cs | 25 ++-- .../Model/Generated/InsurancePlan.cs | 50 ++++--- src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs | 20 +-- src/Hl7.Fhir.R4B/Model/Generated/Library.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs | 10 +- src/Hl7.Fhir.R4B/Model/Generated/List.cs | 10 +- src/Hl7.Fhir.R4B/Model/Generated/Location.cs | 15 +- .../Generated/ManufacturedItemDefinition.cs | 10 +- .../Model/Generated/MarketingStatus.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Measure.cs | 30 ++-- .../Model/Generated/MeasureReport.cs | 35 +++-- src/Hl7.Fhir.R4B/Model/Generated/Media.cs | 5 +- .../Model/Generated/Medication.cs | 15 +- .../Generated/MedicationAdministration.cs | 15 +- .../Model/Generated/MedicationDispense.cs | 15 +- .../Model/Generated/MedicationKnowledge.cs | 85 ++++++----- .../Model/Generated/MedicationRequest.cs | 20 +-- .../Model/Generated/MedicationStatement.cs | 5 +- .../Generated/MedicinalProductDefinition.cs | 40 +++--- .../Model/Generated/MessageDefinition.cs | 15 +- .../Model/Generated/MessageHeader.cs | 20 +-- .../Model/Generated/MolecularSequence.cs | 45 +++--- src/Hl7.Fhir.R4B/Model/Generated/Money.cs | 5 +- .../Model/Generated/NamingSystem.cs | 10 +- .../Model/Generated/NutritionOrder.cs | 35 +++-- .../Model/Generated/NutritionProduct.cs | 25 ++-- .../Model/Generated/Observation.cs | 15 +- .../Model/Generated/ObservationDefinition.cs | 15 +- .../Model/Generated/OperationDefinition.cs | 25 ++-- .../Model/Generated/Organization.cs | 10 +- .../Generated/OrganizationAffiliation.cs | 5 +- .../Generated/PackagedProductDefinition.cs | 30 ++-- .../Model/Generated/ParameterDefinition.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Patient.cs | 20 +-- .../Model/Generated/PaymentNotice.cs | 5 +- .../Model/Generated/PaymentReconciliation.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/Person.cs | 10 +- .../Model/Generated/PlanDefinition.cs | 40 +++--- .../Model/Generated/Population.cs | 5 +- .../Model/Generated/Practitioner.cs | 10 +- .../Model/Generated/PractitionerRole.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs | 15 +- .../Model/Generated/ProdCharacteristic.cs | 5 +- .../Model/Generated/ProductShelfLife.cs | 5 +- .../Model/Generated/Provenance.cs | 15 +- .../Model/Generated/Questionnaire.cs | 25 ++-- .../Model/Generated/QuestionnaireResponse.cs | 15 +- src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs | 5 +- .../Model/Generated/RatioRange.cs | 5 +- .../Model/Generated/RegulatedAuthorization.cs | 10 +- .../Model/Generated/RelatedPerson.cs | 10 +- .../Model/Generated/RequestGroup.cs | 20 +-- .../Model/Generated/ResearchDefinition.cs | 5 +- .../Generated/ResearchElementDefinition.cs | 10 +- .../Model/Generated/ResearchStudy.cs | 15 +- .../Model/Generated/ResearchSubject.cs | 5 +- .../Model/Generated/RiskAssessment.cs | 10 +- .../Model/Generated/SampledData.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs | 5 +- .../Model/Generated/SearchParameter.cs | 10 +- .../Model/Generated/ServiceRequest.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Slot.cs | 5 +- src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs | 20 +-- .../Model/Generated/SpecimenDefinition.cs | 25 ++-- .../Model/Generated/StructureMap.cs | 45 +++--- .../Model/Generated/Subscription.cs | 10 +- .../Model/Generated/SubscriptionStatus.cs | 10 +- .../Model/Generated/SubscriptionTopic.cs | 30 ++-- src/Hl7.Fhir.R4B/Model/Generated/Substance.cs | 15 +- .../Model/Generated/SubstanceDefinition.cs | 55 ++++--- .../Model/Generated/SupplyDelivery.cs | 10 +- .../Model/Generated/SupplyRequest.cs | 10 +- src/Hl7.Fhir.R4B/Model/Generated/Task.cs | 20 +-- .../Generated/TerminologyCapabilities.cs | 55 ++++--- .../Model/Generated/TestReport.cs | 50 ++++--- .../Model/Generated/TestScript.cs | 85 ++++++----- src/Hl7.Fhir.R4B/Model/Generated/Timing.cs | 10 +- .../Model/Generated/TriggerDefinition.cs | 5 +- .../Model/Generated/VerificationResult.cs | 20 +-- .../Model/Generated/VisionPrescription.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Account.cs | 35 +++-- .../Model/Generated/ActivityDefinition.cs | 15 +- .../Model/Generated/ActorDefinition.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Address.cs | 5 +- .../AdministrableProductDefinition.cs | 25 ++-- .../Model/Generated/AdverseEvent.cs | 40 +++--- .../Model/Generated/AllergyIntolerance.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Annotation.cs | 5 +- .../Model/Generated/Appointment.cs | 30 ++-- .../Model/Generated/AppointmentResponse.cs | 5 +- .../Model/Generated/ArtifactAssessment.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs | 30 ++-- .../Model/Generated/Availability.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Basic.cs | 5 +- .../Generated/BiologicallyDerivedProduct.cs | 15 +- .../BiologicallyDerivedProductDispense.cs | 10 +- .../Model/Generated/BodyStructure.cs | 20 +-- src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs | 10 +- .../Model/Generated/ChargeItemDefinition.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Citation.cs | 95 +++++++----- src/Hl7.Fhir.R5/Model/Generated/Claim.cs | 70 +++++---- .../Model/Generated/ClaimResponse.cs | 80 ++++++----- .../Model/Generated/ClinicalImpression.cs | 10 +- .../Model/Generated/ClinicalUseDefinition.cs | 40 +++--- .../Model/Generated/Communication.cs | 10 +- .../Model/Generated/CommunicationRequest.cs | 10 +- .../Model/Generated/CompartmentDefinition.cs | 10 +- .../Model/Generated/Composition.cs | 20 +-- src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs | 45 +++--- src/Hl7.Fhir.R5/Model/Generated/Condition.cs | 15 +- .../Model/Generated/ConditionDefinition.cs | 30 ++-- src/Hl7.Fhir.R5/Model/Generated/Consent.cs | 30 ++-- src/Hl7.Fhir.R5/Model/Generated/Contract.cs | 80 ++++++----- .../Model/Generated/Contributor.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Coverage.cs | 25 ++-- .../Generated/CoverageEligibilityRequest.cs | 30 ++-- .../Generated/CoverageEligibilityResponse.cs | 30 ++-- .../Model/Generated/DataRequirement.cs | 25 ++-- .../Model/Generated/DetectedIssue.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Device.cs | 30 ++-- .../Model/Generated/DeviceAssociation.cs | 10 +- .../Model/Generated/DeviceDefinition.cs | 85 ++++++----- .../Model/Generated/DeviceDispense.cs | 10 +- .../Model/Generated/DeviceMetric.cs | 10 +- .../Model/Generated/DeviceRequest.cs | 10 +- .../Model/Generated/DeviceUsage.cs | 10 +- .../Model/Generated/DiagnosticReport.cs | 15 +- .../Model/Generated/DocumentReference.cs | 25 ++-- src/Hl7.Fhir.R5/Model/Generated/Dosage.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Encounter.cs | 30 ++-- .../Model/Generated/EncounterHistory.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs | 10 +- .../Model/Generated/EnrollmentRequest.cs | 5 +- .../Model/Generated/EnrollmentResponse.cs | 5 +- .../Model/Generated/EpisodeOfCare.cs | 20 +-- .../Model/Generated/EventDefinition.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Evidence.cs | 40 +++--- .../Model/Generated/EvidenceReport.cs | 30 ++-- .../Model/Generated/EvidenceVariable.cs | 30 ++-- .../Model/Generated/ExampleScenario.cs | 45 +++--- .../Model/Generated/ExplanationOfBenefit.cs | 125 +++++++++------- src/Hl7.Fhir.R5/Model/Generated/Expression.cs | 5 +- .../Model/Generated/ExtendedContactDetail.cs | 5 +- .../Model/Generated/FamilyMemberHistory.cs | 20 +-- src/Hl7.Fhir.R5/Model/Generated/Flag.cs | 5 +- .../Model/Generated/FormularyItem.cs | 5 +- .../Model/Generated/GenomicStudy.cs | 30 ++-- src/Hl7.Fhir.R5/Model/Generated/Goal.cs | 10 +- .../Model/Generated/GraphDefinition.cs | 20 +-- src/Hl7.Fhir.R5/Model/Generated/Group.cs | 15 +- .../Model/Generated/GuidanceResponse.cs | 5 +- .../Model/Generated/HealthcareService.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/HumanName.cs | 5 +- .../Model/Generated/ImagingSelection.cs | 25 ++-- .../Model/Generated/ImagingStudy.cs | 20 +-- .../Model/Generated/Immunization.cs | 25 ++-- .../Model/Generated/ImmunizationEvaluation.cs | 5 +- .../Generated/ImmunizationRecommendation.cs | 15 +- .../Model/Generated/ImplementationGuide.cs | 60 ++++---- src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs | 25 ++-- .../Model/Generated/InsurancePlan.cs | 45 +++--- .../Model/Generated/InventoryItem.cs | 35 +++-- .../Model/Generated/InventoryReport.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Invoice.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Library.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Linkage.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/List.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Location.cs | 10 +- .../Generated/ManufacturedItemDefinition.cs | 20 +-- .../Model/Generated/MarketingStatus.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Measure.cs | 35 +++-- .../Model/Generated/MeasureReport.cs | 35 +++-- src/Hl7.Fhir.R5/Model/Generated/Medication.cs | 15 +- .../Generated/MedicationAdministration.cs | 15 +- .../Model/Generated/MedicationDispense.cs | 15 +- .../Model/Generated/MedicationKnowledge.cs | 95 +++++++----- .../Model/Generated/MedicationRequest.cs | 20 +-- .../Model/Generated/MedicationStatement.cs | 10 +- .../Generated/MedicinalProductDefinition.cs | 40 +++--- .../Model/Generated/MessageDefinition.cs | 15 +- .../Model/Generated/MessageHeader.cs | 20 +-- .../Model/Generated/MolecularSequence.cs | 20 +-- .../Model/Generated/MonetaryComponent.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Money.cs | 5 +- .../Model/Generated/NamingSystem.cs | 10 +- .../Model/Generated/NutritionIntake.cs | 20 +-- .../Model/Generated/NutritionOrder.cs | 55 ++++--- .../Model/Generated/NutritionProduct.cs | 25 ++-- .../Model/Generated/Observation.cs | 20 +-- .../Model/Generated/ObservationDefinition.cs | 15 +- .../Model/Generated/OperationDefinition.cs | 25 ++-- .../Model/Generated/Organization.cs | 10 +- .../Generated/OrganizationAffiliation.cs | 5 +- .../Generated/PackagedProductDefinition.cs | 25 ++-- .../Model/Generated/ParameterDefinition.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Patient.cs | 20 +-- .../Model/Generated/PaymentNotice.cs | 5 +- .../Model/Generated/PaymentReconciliation.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Permission.cs | 30 ++-- src/Hl7.Fhir.R5/Model/Generated/Person.cs | 15 +- .../Model/Generated/PlanDefinition.cs | 60 ++++---- .../Model/Generated/Practitioner.cs | 15 +- .../Model/Generated/PractitionerRole.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Procedure.cs | 15 +- .../Model/Generated/ProductShelfLife.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Provenance.cs | 15 +- .../Model/Generated/Questionnaire.cs | 25 ++-- .../Model/Generated/QuestionnaireResponse.cs | 15 +- src/Hl7.Fhir.R5/Model/Generated/Ratio.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs | 5 +- .../Model/Generated/RegulatedAuthorization.cs | 10 +- .../Model/Generated/RelatedPerson.cs | 10 +- .../Model/Generated/RequestOrchestration.cs | 40 +++--- .../Model/Generated/Requirements.cs | 10 +- .../Model/Generated/ResearchStudy.cs | 40 +++--- .../Model/Generated/ResearchSubject.cs | 10 +- .../Model/Generated/RiskAssessment.cs | 10 +- .../Model/Generated/SampledData.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Schedule.cs | 5 +- .../Model/Generated/SearchParameter.cs | 10 +- .../Model/Generated/ServiceRequest.cs | 20 +-- src/Hl7.Fhir.R5/Model/Generated/Slot.cs | 5 +- src/Hl7.Fhir.R5/Model/Generated/Specimen.cs | 25 ++-- .../Model/Generated/SpecimenDefinition.cs | 25 ++-- .../Model/Generated/StructureMap.cs | 50 ++++--- .../Model/Generated/Subscription.cs | 15 +- .../Model/Generated/SubscriptionStatus.cs | 10 +- .../Model/Generated/SubscriptionTopic.cs | 30 ++-- src/Hl7.Fhir.R5/Model/Generated/Substance.cs | 10 +- .../Model/Generated/SubstanceDefinition.cs | 60 ++++---- .../Model/Generated/SubstanceNucleicAcid.cs | 20 +-- .../Model/Generated/SubstancePolymer.cs | 35 +++-- .../Model/Generated/SubstanceProtein.cs | 10 +- .../SubstanceReferenceInformation.cs | 20 +-- .../Generated/SubstanceSourceMaterial.cs | 35 +++-- .../Model/Generated/SupplyDelivery.cs | 10 +- .../Model/Generated/SupplyRequest.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Task.cs | 25 ++-- .../Generated/TerminologyCapabilities.cs | 55 ++++--- src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs | 40 +++--- src/Hl7.Fhir.R5/Model/Generated/TestReport.cs | 55 ++++--- src/Hl7.Fhir.R5/Model/Generated/TestScript.cs | 95 +++++++----- src/Hl7.Fhir.R5/Model/Generated/Timing.cs | 10 +- src/Hl7.Fhir.R5/Model/Generated/Transport.cs | 20 +-- .../Model/Generated/TriggerDefinition.cs | 5 +- .../Model/Generated/VerificationResult.cs | 20 +-- .../Model/Generated/VirtualServiceDetail.cs | 5 +- .../Model/Generated/VisionPrescription.cs | 15 +- src/Hl7.Fhir.STU3/Model/Generated/Account.cs | 15 +- .../Model/Generated/ActivityDefinition.cs | 15 +- src/Hl7.Fhir.STU3/Model/Generated/Address.cs | 5 +- .../Model/Generated/AdverseEvent.cs | 10 +- .../Model/Generated/AllergyIntolerance.cs | 10 +- .../Model/Generated/Annotation.cs | 5 +- .../Model/Generated/Appointment.cs | 10 +- .../Model/Generated/AppointmentResponse.cs | 5 +- .../Model/Generated/AuditEvent.cs | 30 ++-- src/Hl7.Fhir.STU3/Model/Generated/Basic.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs | 5 +- .../Model/Generated/CapabilityStatement.cs | 80 ++++++----- src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs | 15 +- src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs | 10 +- .../Model/Generated/ChargeItem.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/Claim.cs | 60 ++++---- .../Model/Generated/ClaimResponse.cs | 55 ++++--- .../Model/Generated/ClinicalImpression.cs | 15 +- .../Model/Generated/CodeSystem.cs | 30 ++-- .../Model/Generated/Communication.cs | 10 +- .../Model/Generated/CommunicationRequest.cs | 15 +- .../Model/Generated/CompartmentDefinition.cs | 10 +- .../Model/Generated/Composition.cs | 25 ++-- .../Model/Generated/ConceptMap.cs | 30 ++-- .../Model/Generated/Condition.cs | 15 +- src/Hl7.Fhir.STU3/Model/Generated/Consent.cs | 35 +++-- src/Hl7.Fhir.STU3/Model/Generated/Contract.cs | 50 ++++--- .../Model/Generated/Contributor.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs | 10 +- .../Model/Generated/DataElement.cs | 10 +- .../Model/Generated/DataRequirement.cs | 15 +- .../Model/Generated/DetectedIssue.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/Device.cs | 10 +- .../Model/Generated/DeviceComponent.cs | 10 +- .../Model/Generated/DeviceMetric.cs | 10 +- .../Model/Generated/DeviceRequest.cs | 10 +- .../Model/Generated/DeviceUseStatement.cs | 5 +- .../Model/Generated/DiagnosticReport.cs | 15 +- .../Model/Generated/DocumentManifest.cs | 15 +- .../Model/Generated/DocumentReference.cs | 25 ++-- src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs | 5 +- .../Model/Generated/ElementDefinition.cs | 45 +++--- .../Model/Generated/EligibilityRequest.cs | 5 +- .../Model/Generated/EligibilityResponse.cs | 25 ++-- .../Model/Generated/Encounter.cs | 35 +++-- src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs | 5 +- .../Model/Generated/EnrollmentRequest.cs | 5 +- .../Model/Generated/EnrollmentResponse.cs | 5 +- .../Model/Generated/EpisodeOfCare.cs | 15 +- .../Model/Generated/ExpansionProfile.cs | 40 +++--- .../Model/Generated/ExplanationOfBenefit.cs | 95 +++++++----- .../Model/Generated/FamilyMemberHistory.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/Flag.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/Goal.cs | 10 +- .../Model/Generated/GraphDefinition.cs | 20 +-- src/Hl7.Fhir.STU3/Model/Generated/Group.cs | 15 +- .../Model/Generated/GuidanceResponse.cs | 5 +- .../Model/Generated/HealthcareService.cs | 15 +- .../Model/Generated/HumanName.cs | 5 +- .../Model/Generated/ImagingManifest.cs | 20 +-- .../Model/Generated/ImagingStudy.cs | 15 +- .../Model/Generated/Immunization.cs | 25 ++-- .../Generated/ImmunizationRecommendation.cs | 20 +-- .../Model/Generated/ImplementationGuide.cs | 30 ++-- src/Hl7.Fhir.STU3/Model/Generated/Library.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/List.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/Location.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/Measure.cs | 25 ++-- .../Model/Generated/MeasureReport.cs | 30 ++-- src/Hl7.Fhir.STU3/Model/Generated/Media.cs | 5 +- .../Model/Generated/Medication.cs | 25 ++-- .../Generated/MedicationAdministration.cs | 15 +- .../Model/Generated/MedicationDispense.cs | 15 +- .../Model/Generated/MedicationRequest.cs | 20 +-- .../Model/Generated/MedicationStatement.cs | 5 +- .../Model/Generated/MessageDefinition.cs | 15 +- .../Model/Generated/MessageHeader.cs | 20 +-- .../Model/Generated/NamingSystem.cs | 10 +- .../Model/Generated/NutritionOrder.cs | 35 +++-- .../Model/Generated/Observation.cs | 20 +-- .../Model/Generated/OperationDefinition.cs | 20 +-- .../Model/Generated/Organization.cs | 10 +- .../Model/Generated/ParameterDefinition.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/Patient.cs | 25 ++-- .../Model/Generated/PaymentNotice.cs | 5 +- .../Model/Generated/PaymentReconciliation.cs | 15 +- src/Hl7.Fhir.STU3/Model/Generated/Person.cs | 10 +- .../Model/Generated/PlanDefinition.cs | 40 +++--- .../Model/Generated/Practitioner.cs | 10 +- .../Model/Generated/PractitionerRole.cs | 15 +- .../Model/Generated/Procedure.cs | 15 +- .../Model/Generated/ProcedureRequest.cs | 10 +- .../Model/Generated/ProcessRequest.cs | 10 +- .../Model/Generated/ProcessResponse.cs | 10 +- .../Model/Generated/Provenance.cs | 15 +- .../Model/Generated/Questionnaire.cs | 20 +-- .../Model/Generated/QuestionnaireResponse.cs | 15 +- src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs | 5 +- .../Model/Generated/ReferralRequest.cs | 10 +- .../Model/Generated/RelatedArtifact.cs | 5 +- .../Model/Generated/RelatedPerson.cs | 5 +- .../Model/Generated/RequestGroup.cs | 20 +-- .../Model/Generated/ResearchStudy.cs | 10 +- .../Model/Generated/ResearchSubject.cs | 5 +- .../Model/Generated/RiskAssessment.cs | 10 +- .../Model/Generated/SampledData.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs | 5 +- .../Model/Generated/SearchParameter.cs | 10 +- src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs | 25 ++-- .../Model/Generated/ServiceDefinition.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/Slot.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs | 20 +-- .../Model/Generated/StructureDefinition.cs | 20 +-- .../Model/Generated/StructureMap.cs | 45 +++--- .../Model/Generated/Subscription.cs | 10 +- .../Model/Generated/Substance.cs | 15 +- .../Model/Generated/SupplyDelivery.cs | 10 +- .../Model/Generated/SupplyRequest.cs | 15 +- src/Hl7.Fhir.STU3/Model/Generated/Task.cs | 25 ++-- .../Model/Generated/TestReport.cs | 50 ++++--- .../Model/Generated/TestScript.cs | 135 +++++++++++------- src/Hl7.Fhir.STU3/Model/Generated/Timing.cs | 10 +- .../Model/Generated/TriggerDefinition.cs | 5 +- src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs | 45 +++--- .../Model/Generated/VisionPrescription.cs | 10 +- 636 files changed, 7477 insertions(+), 5004 deletions(-) diff --git a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs index 16ef76a03..931be5efc 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Attachment.cs @@ -527,7 +527,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Attachment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; @@ -540,7 +541,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FramesElement, otherT._FramesElement)) return false; if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; if(!comparer.Equals(_PagesElement, otherT._PagesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs index afbc4bd61..8728aa3e7 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneElement.cs @@ -85,8 +85,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BackboneElement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs index c5827e04b..4f0bd9c53 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/BackboneType.cs @@ -85,8 +85,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BackboneType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs index b987dc456..380660714 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Binary.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Binary.cs @@ -198,11 +198,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Binary otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; if(!comparer.Equals(_SecurityContext, otherT._SecurityContext)) return false; if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs index a8c430b8e..3335a9984 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Bundle.cs @@ -1061,9 +1061,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationElement, otherT._RelationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RelationElement, otherT._RelationElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1247,13 +1248,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Link, otherT._Link)) return false; if(!comparer.Equals(_FullUrlElement, otherT._FullUrlElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.Equals(_Search, otherT._Search)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1423,9 +1425,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_ScoreElement, otherT._ScoreElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1685,13 +1688,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MethodElement, otherT._MethodElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_IfNoneMatchElement, otherT._IfNoneMatchElement)) return false; if(!comparer.Equals(_IfModifiedSinceElement, otherT._IfModifiedSinceElement)) return false; if(!comparer.Equals(_IfMatchElement, otherT._IfMatchElement)) return false; if(!comparer.Equals(_IfNoneExistElement, otherT._IfNoneExistElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1934,12 +1938,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_LocationElement, otherT._LocationElement)) return false; if(!comparer.Equals(_EtagElement, otherT._EtagElement)) return false; if(!comparer.Equals(_LastModifiedElement, otherT._LastModifiedElement)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2198,7 +2203,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Bundle otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; @@ -2206,7 +2212,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_Signature, otherT._Signature)) return false; if(!comparer.Equals(_Issues, otherT._Issues)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs index 7503ed595..1658d5be4 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableConcept.cs @@ -127,9 +127,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeableConcept otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Coding, otherT._Coding)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Coding, otherT._Coding)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs index 7c00ed4fd..1b8e939aa 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/CodeableReference.cs @@ -110,9 +110,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeableReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Concept, otherT._Concept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Concept, otherT._Concept)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs index 626c105eb..1e01c6593 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Coding.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Coding.cs @@ -227,12 +227,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Coding otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_UserSelectedElement, otherT._UserSelectedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs index b0e516256..97303ed63 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ContactDetail.cs @@ -126,9 +126,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactDetail otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs index cc8dc4b46..dd94c16a0 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ContactPoint.cs @@ -308,12 +308,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactPoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs index a0657de58..8e616ebd3 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/DataType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/DataType.cs @@ -70,7 +70,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs index 961a4af0b..7c709d0a1 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/DomainResource.cs @@ -131,11 +131,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DomainResource otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Text, otherT._Text)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Text, otherT._Text)) return false; if(!comparer.ListEquals(_Contained, otherT._Contained)) return false; if(!comparer.ListEquals(_Extension, otherT._Extension)) return false; if(!comparer.ListEquals(_ModifierExtension, otherT._ModifierExtension)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Element.cs b/src/Hl7.Fhir.Base/Model/Generated/Element.cs index 69213de62..49a344a70 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Element.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Element.cs @@ -114,9 +114,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Element otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ElementIdElement, otherT._ElementIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ElementIdElement, otherT._ElementIdElement)) return false; if(!comparer.ListEquals(_Extension, otherT._Extension)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs index d4a5297d5..2ec4a993d 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Extension.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Extension.cs @@ -126,9 +126,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Extension otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs index 408a14cb2..f86c1f731 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Identifier.cs @@ -257,13 +257,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Identifier otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Assigner, otherT._Assigner)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs index bc3425f22..dd4540363 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Meta.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Meta.cs @@ -265,13 +265,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Meta otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; if(!comparer.Equals(_LastUpdatedElement, otherT._LastUpdatedElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Security, otherT._Security)) return false; if(!comparer.ListEquals(_Tag, otherT._Tag)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs index 28b42e3ff..7afca62de 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Narrative.cs @@ -178,9 +178,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Narrative otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_DivElement, otherT._DivElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs index fd66f0137..e8d39db07 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/OperationOutcome.cs @@ -522,13 +522,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IssueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Details, otherT._Details)) return false; if(!comparer.Equals(_DiagnosticsElement, otherT._DiagnosticsElement)) return false; if(!comparer.ListEquals(_LocationElement, otherT._LocationElement)) return false; if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -637,8 +638,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationOutcome otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Issue, otherT._Issue)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Issue, otherT._Issue)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs index 965bde319..3a07dd6da 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Parameters.cs @@ -174,11 +174,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Part, otherT._Part)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -273,8 +274,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Parameters otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Period.cs b/src/Hl7.Fhir.Base/Model/Generated/Period.cs index 8b10bb038..4ad306120 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Period.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Period.cs @@ -142,9 +142,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Period otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs index 4c3a6baa4..e4169ed41 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/PrimitiveType.cs @@ -71,7 +71,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrimitiveType otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + #pragma warning restore CS8604 // Possible null reference argument. return Equals(ObjectValue, otherT.ObjectValue); diff --git a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs index c758b0f47..977b7121c 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Quantity.cs @@ -270,12 +270,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Quantity otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false; if(!comparer.Equals(_UnitElement, otherT._UnitElement)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Range.cs b/src/Hl7.Fhir.Base/Model/Generated/Range.cs index b59cfb048..5d3f256c7 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Range.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Range.cs @@ -111,9 +111,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Range otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Low, otherT._Low)) return false; if(!comparer.Equals(_High, otherT._High)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs index be68607ca..ef73884a2 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Resource.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Resource.cs @@ -172,11 +172,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Resource otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdElement, otherT._IdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdElement, otherT._IdElement)) return false; if(!comparer.Equals(_Meta, otherT._Meta)) return false; if(!comparer.Equals(_ImplicitRulesElement, otherT._ImplicitRulesElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs index b0731ac22..be742e81b 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/ResourceReference.cs @@ -187,11 +187,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs index f74464cca..12d0e6be6 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/Signature.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/Signature.cs @@ -346,7 +346,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Signature otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_WhenElement, otherT._WhenElement)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; @@ -355,7 +356,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SigFormatElement, otherT._SigFormatElement)) return false; if(!comparer.Equals(_BlobElement, otherT._BlobElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs index c9034bfac..ded38fcf5 100644 --- a/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs +++ b/src/Hl7.Fhir.Base/Model/Generated/UsageContext.cs @@ -117,9 +117,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UsageContext otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs index ff9b060c9..31eef3d21 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CapabilityStatement.cs @@ -481,10 +481,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_ReleaseDateElement, otherT._ReleaseDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -673,10 +674,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Custodian, otherT._Custodian)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -934,7 +936,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_Security, otherT._Security)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; @@ -942,7 +945,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_CompartmentElement, otherT._CompartmentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1140,10 +1143,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SecurityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; if(!comparer.ListEquals(_Service, otherT._Service)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1742,7 +1746,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_SupportedProfileElement, otherT._SupportedProfileElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; @@ -1760,7 +1765,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SearchRevIncludeElement, otherT._SearchRevIncludeElement)) return false; if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2016,9 +2021,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2221,11 +2227,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2412,10 +2419,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2565,9 +2573,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SystemInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2738,11 +2747,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.Equals(_ReliableCacheElement, otherT._ReliableCacheElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_SupportedMessage, otherT._SupportedMessage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2884,9 +2894,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EndpointComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3031,9 +3042,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportedMessageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3206,10 +3218,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4063,7 +4076,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -4093,7 +4107,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Rest, otherT._Rest)) return false; if(!comparer.ListEquals(_Messaging, otherT._Messaging)) return false; if(!comparer.ListEquals(_Document, otherT._Document)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs index 86490e734..16e310faa 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/CodeSystem.cs @@ -309,11 +309,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_OperatorElement, otherT._OperatorElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -530,11 +531,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -764,13 +766,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -975,11 +978,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.ListEquals(_AdditionalUse, otherT._AdditionalUse)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1122,9 +1126,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2098,7 +2103,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2135,7 +2141,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs index 969d0cce2..98b2463bc 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ElementDefinition.cs @@ -445,11 +445,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SlicingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_OrderedElement, otherT._OrderedElement)) return false; if(!comparer.Equals(_RulesElement, otherT._RulesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -608,9 +609,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiscriminatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -783,10 +785,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1039,12 +1042,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TypeRefComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_TargetProfileElement, otherT._TargetProfileElement)) return false; if(!comparer.ListEquals(_AggregationElement, otherT._AggregationElement)) return false; if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1193,9 +1197,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExampleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1547,7 +1552,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConstraintComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; if(!comparer.Equals(_RequirementsElement, otherT._RequirementsElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_SuppressElement, otherT._SuppressElement)) return false; @@ -1555,7 +1561,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1813,11 +1819,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ElementDefinitionBindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.ListEquals(_Additional, otherT._Additional)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2095,13 +2102,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdditionalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_ShortDocoElement, otherT._ShortDocoElement)) return false; if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; if(!comparer.Equals(_AnyElement, otherT._AnyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2356,11 +2364,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_MapElement, otherT._MapElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3324,7 +3333,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.ListEquals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; if(!comparer.Equals(_SliceIsConstrainingElement, otherT._SliceIsConstrainingElement)) return false; @@ -3360,7 +3370,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_IsSummaryElement, otherT._IsSummaryElement)) return false; if(!comparer.Equals(_Binding, otherT._Binding)) return false; if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs index 9c7a542cb..896a1e023 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/RelatedArtifact.cs @@ -608,7 +608,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedArtifact otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; @@ -619,7 +620,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ResourceReference, otherT._ResourceReference)) return false; if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs index a9ffe463f..bf86759c5 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/StructureDefinition.cs @@ -299,11 +299,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -461,9 +462,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -560,8 +562,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SnapshotComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -651,8 +654,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DifferentialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1440,7 +1444,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1469,7 +1474,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DerivationElement, otherT._DerivationElement)) return false; if(!comparer.Equals(_Snapshot, otherT._Snapshot)) return false; if(!comparer.Equals(_Differential, otherT._Differential)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs index 6c4a3c58e..ade67cd0b 100644 --- a/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.Conformance/Model/Generated/ValueSet.cs @@ -222,12 +222,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComposeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; if(!comparer.ListEquals(_Include, otherT._Include)) return false; if(!comparer.ListEquals(_Exclude, otherT._Exclude)) return false; if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -483,13 +484,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -674,10 +676,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -861,11 +864,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.ListEquals(_AdditionalUse, otherT._AdditionalUse)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1054,10 +1058,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; if(!comparer.Equals(_OpElement, otherT._OpElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1345,7 +1350,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; if(!comparer.Equals(_NextElement, otherT._NextElement)) return false; if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; @@ -1353,7 +1359,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1524,9 +1530,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1667,9 +1674,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1973,7 +1981,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_AbstractElement, otherT._AbstractElement)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; @@ -1982,7 +1991,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2178,10 +2187,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_SubProperty, otherT._SubProperty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2323,9 +2333,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptSubPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2495,10 +2506,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ScopeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InclusionCriteriaElement, otherT._InclusionCriteriaElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_InclusionCriteriaElement, otherT._InclusionCriteriaElement)) return false; if(!comparer.Equals(_FocusElement, otherT._FocusElement)) return false; if(!comparer.Equals(_ExclusionCriteriaElement, otherT._ExclusionCriteriaElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3271,7 +3283,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValueSet otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -3301,7 +3314,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Compose, otherT._Compose)) return false; if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; if(!comparer.Equals(_Scope, otherT._Scope)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Account.cs b/src/Hl7.Fhir.R4/Model/Generated/Account.cs index 790de8022..4fc534cbb 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Account.cs @@ -186,9 +186,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -330,10 +331,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,7 +593,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -624,7 +626,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -635,7 +638,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Guarantor, otherT._Guarantor)) return false; if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs index 8aa6af018..bacfdafa8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ActivityDefinition.cs @@ -245,9 +245,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -375,9 +376,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1406,7 +1408,7 @@ public List DynamicValu List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Topic; set => Topic = value; } - IEnumerable ICoded.ToCodings() => Topic?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Topic?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1474,7 +1476,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1520,7 +1523,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ObservationResultRequirement, otherT._ObservationResultRequirement)) return false; if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Address.cs b/src/Hl7.Fhir.R4/Model/Generated/Address.cs index 8c10afeb5..5dff931b1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Address.cs @@ -434,7 +434,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; @@ -444,7 +445,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs index a95e0cc4e..a91b2d424 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AdverseEvent.cs @@ -226,9 +226,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Causality, otherT._Causality)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -382,11 +383,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CausalityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Assessment, otherT._Assessment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Assessment, otherT._Assessment)) return false; if(!comparer.Equals(_ProductRelatednessElement, otherT._ProductRelatednessElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -803,7 +805,7 @@ public List Study Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Event; set => Event = value!; } - IEnumerable ICoded.ToCodings() => Event?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Event?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -845,7 +847,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActualityElement, otherT._ActualityElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Event, otherT._Event)) return false; @@ -865,7 +868,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SubjectMedicalHistory, otherT._SubjectMedicalHistory)) return false; if(!comparer.ListEquals(_ReferenceDocument, otherT._ReferenceDocument)) return false; if(!comparer.ListEquals(_Study, otherT._Study)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs index 77132cee8..d01047f4d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AllergyIntolerance.cs @@ -423,14 +423,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -824,7 +825,7 @@ public List Reaction List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -862,7 +863,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; @@ -878,7 +880,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs b/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs index 217c46b35..8b1129a43 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Annotation.cs @@ -159,10 +159,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs index 684122889..a994ca750 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Appointment.cs @@ -302,12 +302,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -826,7 +827,7 @@ public List RequestedPeriod List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => ServiceType; set => ServiceType = value; } - IEnumerable ICoded.ToCodings() => ServiceType?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => ServiceType?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -870,7 +871,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CancelationReason, otherT._CancelationReason)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; @@ -892,7 +894,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; if(!comparer.ListEquals(_RequestedPeriod, otherT._RequestedPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs index f92c7329b..d9ac8eab8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AppointmentResponse.cs @@ -264,7 +264,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; @@ -272,7 +273,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_ParticipantStatusElement, otherT._ParticipantStatusElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs index 5e9445b82..c05cdc1a4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/AuditEvent.cs @@ -444,7 +444,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_AltIdElement, otherT._AltIdElement)) return false; @@ -455,7 +456,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Media, otherT._Media)) return false; if(!comparer.Equals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_PurposeOfUse, otherT._PurposeOfUse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -660,9 +661,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NetworkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -807,10 +809,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; if(!comparer.Equals(_Observer, otherT._Observer)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1079,7 +1082,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_What, otherT._What)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_What, otherT._What)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Lifecycle, otherT._Lifecycle)) return false; @@ -1088,7 +1092,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1266,9 +1270,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1562,7 +1567,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; @@ -1573,7 +1579,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Basic.cs b/src/Hl7.Fhir.R4/Model/Generated/Basic.cs index da7af8e4e..13ff4874b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Basic.cs @@ -152,7 +152,7 @@ public Hl7.Fhir.Model.ResourceReference? Author List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -179,12 +179,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs index 4d0aa0f51..e36d19c1b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/BiologicallyDerivedProduct.cs @@ -235,10 +235,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Collector, otherT._Collector)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_Collected, otherT._Collected)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -403,11 +404,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.Equals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -548,9 +550,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManipulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -732,11 +735,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StorageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TemperatureElement, otherT._TemperatureElement)) return false; if(!comparer.Equals(_ScaleElement, otherT._ScaleElement)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1031,7 +1035,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BiologicallyDerivedProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ProductCategoryElement, otherT._ProductCategoryElement)) return false; if(!comparer.Equals(_ProductCode, otherT._ProductCode)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1042,7 +1047,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; if(!comparer.Equals(_Manipulation, otherT._Manipulation)) return false; if(!comparer.ListEquals(_Storage, otherT._Storage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs index a48db8c74..cccc34b6b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/BodyStructure.cs @@ -208,7 +208,7 @@ public Hl7.Fhir.Model.ResourceReference? Patient List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Location; set => Location = value!; } - IEnumerable ICoded.ToCodings() => Location?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Location?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -238,7 +238,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BodyStructure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Morphology, otherT._Morphology)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; @@ -246,7 +247,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Image, otherT._Image)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs index e1839ad4d..c1001983e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CarePlan.cs @@ -332,12 +332,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -801,7 +802,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -818,7 +820,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DailyAmount, otherT._DailyAmount)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1426,7 +1428,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1471,7 +1473,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1494,7 +1497,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs index e2ed0854e..78bdcee00 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CareTeam.cs @@ -200,11 +200,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Member, otherT._Member)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -486,7 +487,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -521,7 +522,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -534,7 +536,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs b/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs index 74c9bc17f..f2424e6d7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CatalogEntry.cs @@ -169,9 +169,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationtypeElement, otherT._RelationtypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RelationtypeElement, otherT._RelationtypeElement)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -493,7 +494,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CatalogEntry otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OrderableElement, otherT._OrderableElement)) return false; if(!comparer.Equals(_ReferencedItem, otherT._ReferencedItem)) return false; @@ -506,7 +508,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_AdditionalCharacteristic, otherT._AdditionalCharacteristic)) return false; if(!comparer.ListEquals(_AdditionalClassification, otherT._AdditionalClassification)) return false; if(!comparer.ListEquals(_RelatedEntry, otherT._RelatedEntry)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs index 006964d50..08458ee05 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItem.cs @@ -182,9 +182,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -712,7 +713,7 @@ public List SupportingInformation List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -760,7 +761,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_DefinitionUriElement, otherT._DefinitionUriElement)) return false; if(!comparer.ListEquals(_DefinitionCanonicalElement, otherT._DefinitionCanonicalElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -786,7 +788,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Account, otherT._Account)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs index b98f14272..070766ca9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ChargeItemDefinition.cs @@ -186,10 +186,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ApplicabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -308,9 +309,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -481,11 +483,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1084,7 +1087,7 @@ public List Property List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1129,7 +1132,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -1152,7 +1156,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_PropertyGroup, otherT._PropertyGroup)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs index 3bd6bd287..2e7c50bd1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Claim.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -270,9 +271,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -460,12 +462,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -678,13 +681,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -889,12 +893,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1108,12 +1113,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1386,14 +1392,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1572,10 +1579,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2089,7 +2097,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; @@ -2110,7 +2119,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2536,7 +2545,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -2548,7 +2558,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2896,7 +2906,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -2907,7 +2918,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3454,7 +3465,7 @@ public Hl7.Fhir.Model.Money? Total List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -3503,7 +3514,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; @@ -3530,7 +3542,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Accident, otherT._Accident)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Total, otherT._Total)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs index 66d10f020..bf6d35456 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClaimResponse.cs @@ -191,11 +191,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,11 +366,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -558,11 +560,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -736,10 +739,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1191,7 +1195,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_SubdetailSequenceElement, otherT._SubdetailSequenceElement)) return false; if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; @@ -1209,7 +1214,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1569,7 +1574,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -1578,7 +1584,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1860,7 +1866,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -1868,7 +1875,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2024,9 +2031,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2211,13 +2219,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2432,11 +2441,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2655,12 +2665,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2867,11 +2878,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3458,7 +3470,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; @@ -3485,7 +3498,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs index a36e4104b..0c9218fa7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ClinicalImpression.cs @@ -159,9 +159,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InvestigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -303,10 +304,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemCodeableConcept, otherT._ItemCodeableConcept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemCodeableConcept, otherT._ItemCodeableConcept)) return false; if(!comparer.Equals(_ItemReference, otherT._ItemReference)) return false; if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -732,7 +734,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -774,7 +776,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -794,7 +797,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs index 8ecece1e2..b9509fa27 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Communication.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -596,7 +597,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -641,7 +642,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -664,7 +666,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs index ba0611d9d..ee3bcfd01 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CommunicationRequest.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -545,7 +546,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -589,7 +590,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; @@ -611,7 +613,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs index 92d78c5f1..9cbf6e9ff 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CompartmentDefinition.cs @@ -193,10 +193,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -642,7 +643,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -656,7 +658,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Composition.cs b/src/Hl7.Fhir.R4/Model/Generated/Composition.cs index 8c61c7090..c079407d3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Composition.cs @@ -274,10 +274,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -417,9 +418,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -549,10 +551,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -825,7 +828,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Focus, otherT._Focus)) return false; @@ -835,7 +839,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1219,7 +1223,7 @@ public List Section Identifier? IIdentifiable.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1256,7 +1260,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1271,7 +1276,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs index e604d3af2..fa9042d48 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ConceptMap.cs @@ -271,13 +271,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_SourceVersionElement, otherT._SourceVersionElement)) return false; if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; if(!comparer.Equals(_TargetVersionElement, otherT._TargetVersionElement)) return false; if(!comparer.ListEquals(_Element, otherT._Element)) return false; if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -461,10 +462,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -703,13 +705,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_EquivalenceElement, otherT._EquivalenceElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; if(!comparer.ListEquals(_Product, otherT._Product)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -937,11 +940,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1157,11 +1161,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1672,7 +1677,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1690,7 +1696,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Condition.cs b/src/Hl7.Fhir.R4/Model/Generated/Condition.cs index 26e6d31ac..fc4f87d7f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Condition.cs @@ -237,10 +237,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Summary, otherT._Summary)) return false; if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -363,9 +364,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -675,7 +677,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -714,7 +716,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -731,7 +734,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Stage, otherT._Stage)) return false; if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Consent.cs b/src/Hl7.Fhir.R4/Model/Generated/Consent.cs index 467d24748..4b599083a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Consent.cs @@ -259,9 +259,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PolicyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -418,10 +419,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VerificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; if(!comparer.Equals(_VerifiedWith, otherT._VerifiedWith)) return false; if(!comparer.Equals(_VerificationDateElement, otherT._VerificationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -694,7 +696,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; @@ -705,7 +708,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -883,9 +886,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1016,9 +1020,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1288,7 +1293,7 @@ public Hl7.Fhir.Model.Consent.provisionComponent? Provision List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1323,7 +1328,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Scope, otherT._Scope)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1336,7 +1342,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PolicyRule, otherT._PolicyRule)) return false; if(!comparer.ListEquals(_Verification, otherT._Verification)) return false; if(!comparer.Equals(_Provision, otherT._Provision)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs index 4e29fe6a7..14ccaf1a3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Contract.cs @@ -435,13 +435,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -759,7 +760,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; if(!comparer.Equals(_Applies, otherT._Applies)) return false; if(!comparer.Equals(_Topic, otherT._Topic)) return false; @@ -771,7 +773,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Asset, otherT._Asset)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1004,11 +1006,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SecurityLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Classification, otherT._Classification)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Control, otherT._Control)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1306,7 +1309,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractOfferComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Party, otherT._Party)) return false; if(!comparer.Equals(_Topic, otherT._Topic)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -1316,7 +1320,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1484,9 +1488,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1583,8 +1588,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1950,7 +1956,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractAssetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Scope, otherT._Scope)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Scope, otherT._Scope)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_TypeReference, otherT._TypeReference)) return false; if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; @@ -1965,7 +1972,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2196,10 +2203,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssetContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2601,7 +2609,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; @@ -2615,7 +2624,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3250,7 +3259,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Intent, otherT._Intent)) return false; @@ -3271,7 +3281,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonLinkIdElement, otherT._ReasonLinkIdElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3515,9 +3525,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionSubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3649,10 +3660,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3759,8 +3771,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3853,8 +3866,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3947,8 +3961,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4653,7 +4668,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -4686,7 +4702,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; if(!comparer.Equals(_LegallyBinding, otherT._LegallyBinding)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs index 7a0f0d6cf..d2cf1c7fb 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Contributor.cs @@ -193,10 +193,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs index 4af96e265..1699ec7fd 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Coverage.cs @@ -175,10 +175,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -315,10 +316,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostToBeneficiaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Exception, otherT._Exception)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -437,9 +439,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExemptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -820,7 +823,7 @@ public List Contract List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -859,7 +862,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PolicyHolder, otherT._PolicyHolder)) return false; @@ -876,7 +880,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CostToBeneficiary, otherT._CostToBeneficiary)) return false; if(!comparer.Equals(_SubrogationElement, otherT._SubrogationElement)) return false; if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs index 13f6979fa..d79d2963b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityRequest.cs @@ -209,10 +209,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Information, otherT._Information)) return false; if(!comparer.Equals(_AppliesToAllElement, otherT._AppliesToAllElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -377,10 +378,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -640,7 +642,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; @@ -650,7 +653,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Facility, otherT._Facility)) return false; if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -806,8 +809,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1138,7 +1142,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageEligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; @@ -1152,7 +1157,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs index 13fc6523d..8a6be4f95 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/CoverageEligibilityResponse.cs @@ -208,11 +208,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_InforceElement, otherT._InforceElement)) return false; if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,7 +592,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; @@ -605,7 +607,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AuthorizationRequiredElement, otherT._AuthorizationRequiredElement)) return false; if(!comparer.ListEquals(_AuthorizationSupporting, otherT._AuthorizationSupporting)) return false; if(!comparer.Equals(_AuthorizationUrlElement, otherT._AuthorizationUrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -819,10 +821,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -927,8 +930,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1319,7 +1323,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageEligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -1334,7 +1339,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs index 87d703a59..28ecfa2a8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DataRequirement.cs @@ -222,11 +222,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -396,10 +397,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -551,9 +553,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SortComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -809,7 +812,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; @@ -817,7 +821,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_DateFilter, otherT._DateFilter)) return false; if(!comparer.Equals(_LimitElement, otherT._LimitElement)) return false; if(!comparer.ListEquals(_Sort, otherT._Sort)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs index 2e51cef7c..36e268f62 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DetectedIssue.cs @@ -159,9 +159,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -304,10 +305,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -597,7 +599,7 @@ public List Mitigation List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -631,7 +633,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; @@ -643,7 +646,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Device.cs b/src/Hl7.Fhir.R4/Model/Generated/Device.cs index 02562cc17..57c4d8601 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Device.cs @@ -355,13 +355,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiCarrierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -533,9 +534,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -658,9 +660,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemType, otherT._SystemType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemType, otherT._SystemType)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -797,10 +800,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Component, otherT._Component)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -931,10 +935,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1502,7 +1507,7 @@ public Hl7.Fhir.Model.ResourceReference? Parent List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1550,7 +1555,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_UdiCarrier, otherT._UdiCarrier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1576,7 +1582,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; if(!comparer.Equals(_Parent, otherT._Parent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs index 159d590c9..2ee5d5ee5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceDefinition.cs @@ -189,10 +189,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiDeviceIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -340,9 +341,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -480,9 +482,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemTypeElement, otherT._SystemTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemTypeElement, otherT._SystemTypeElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,9 +594,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Description, otherT._Description)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -717,10 +721,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -879,10 +884,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.Equals(_AlternateElement, otherT._AlternateElement)) return false; if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1350,7 +1356,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.ListEquals(_DeviceName, otherT._DeviceName)) return false; @@ -1372,7 +1379,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_ParentDevice, otherT._ParentDevice)) return false; if(!comparer.ListEquals(_Material, otherT._Material)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs index e199163a3..ad0d02953 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceMetric.cs @@ -381,10 +381,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -631,7 +632,7 @@ public List Calibration List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -663,7 +664,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; @@ -673,7 +675,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_MeasurementPeriod, otherT._MeasurementPeriod)) return false; if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs index c8eae58d0..85213cfcd 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceRequest.cs @@ -129,9 +129,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -637,7 +638,7 @@ public List RelevantHistory List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.DataType? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -683,7 +684,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -707,7 +709,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs index c44a089e0..92b3b0b7d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DeviceUseStatement.cs @@ -368,7 +368,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceUseStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -381,7 +382,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs index 766becfe6..73beeb2c8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DiagnosticReport.cs @@ -215,9 +215,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MediaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -581,7 +582,7 @@ public List PresentedForm List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -621,7 +622,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -639,7 +641,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; if(!comparer.ListEquals(_ConclusionCode, otherT._ConclusionCode)) return false; if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs index 786f072b4..fdc79221f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DocumentManifest.cs @@ -129,9 +129,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Ref, otherT._Ref)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -444,7 +445,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -456,7 +458,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Related, otherT._Related)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs index fad11429b..4b8aad47e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/DocumentReference.cs @@ -149,9 +149,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -263,9 +264,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; if(!comparer.Equals(_Format, otherT._Format)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -458,14 +460,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_FacilityType, otherT._FacilityType)) return false; if(!comparer.Equals(_PracticeSetting, otherT._PracticeSetting)) return false; if(!comparer.Equals(_SourcePatientInfo, otherT._SourcePatientInfo)) return false; if(!comparer.ListEquals(_Related, otherT._Related)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -874,7 +877,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_DocStatusElement, otherT._DocStatusElement)) return false; @@ -890,7 +894,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.Equals(_Context, otherT._Context)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs index 1078ba783..09ad5e36d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Dosage.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DoseAndRateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Dose, otherT._Dose)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -457,7 +458,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; @@ -470,7 +472,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MaxDosePerPeriod, otherT._MaxDosePerPeriod)) return false; if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs b/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs index 9c26169fe..5a826cdd2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EffectEvidenceSynthesis.cs @@ -207,10 +207,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -391,11 +392,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResultsByExposureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ExposureStateElement, otherT._ExposureStateElement)) return false; if(!comparer.Equals(_VariantState, otherT._VariantState)) return false; if(!comparer.Equals(_RiskEvidenceSynthesis, otherT._RiskEvidenceSynthesis)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -609,13 +611,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EffectEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_VariantState, otherT._VariantState)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; if(!comparer.ListEquals(_PrecisionEstimate, otherT._PrecisionEstimate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -827,11 +830,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrecisionEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; if(!comparer.Equals(_FromElement, otherT._FromElement)) return false; if(!comparer.Equals(_ToElement, otherT._ToElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -973,10 +977,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_CertaintySubcomponent, otherT._CertaintySubcomponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1111,10 +1116,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CertaintySubcomponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1849,7 +1855,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EffectEvidenceSynthesis otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1882,7 +1889,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ResultsByExposure, otherT._ResultsByExposure)) return false; if(!comparer.ListEquals(_EffectEstimate, otherT._EffectEstimate)) return false; if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs index cc8b5bbee..eb8032f9f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Encounter.cs @@ -246,9 +246,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -361,9 +362,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -491,10 +493,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Individual, otherT._Individual)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -641,10 +644,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -873,7 +877,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HospitalizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; @@ -882,7 +887,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SpecialArrangement, otherT._SpecialArrangement)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1091,11 +1096,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Location, otherT._Location)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_PhysicalType, otherT._PhysicalType)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1510,7 +1516,7 @@ public Hl7.Fhir.Model.ResourceReference? PartOf List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1555,7 +1561,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; @@ -1578,7 +1585,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Location, otherT._Location)) return false; if(!comparer.Equals(_ServiceProvider, otherT._ServiceProvider)) return false; if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs index ad2433fe7..2ae8cd400 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Endpoint.cs @@ -380,7 +380,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ConnectionType, otherT._ConnectionType)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -391,7 +392,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PayloadMimeTypeElement, otherT._PayloadMimeTypeElement)) return false; if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs index 447b5c0a4..8f795a3e1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentRequest.cs @@ -223,14 +223,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_Candidate, otherT._Candidate)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs index a1a029ad7..8236aff7d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EnrollmentResponse.cs @@ -267,7 +267,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; @@ -275,7 +276,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs index 4e8117083..d7426183e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EpisodeOfCare.cs @@ -197,9 +197,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -339,10 +340,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -593,7 +595,7 @@ public List Account List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -627,7 +629,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; @@ -639,7 +642,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; if(!comparer.ListEquals(_Team, otherT._Team)) return false; if(!comparer.ListEquals(_Account, otherT._Account)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs index 42383727d..7ecae9b78 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EventDefinition.cs @@ -721,7 +721,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -749,7 +750,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs index db88ea9c9..673ce39b3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Evidence.cs @@ -696,7 +696,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Evidence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -724,7 +725,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ExposureBackground, otherT._ExposureBackground)) return false; if(!comparer.ListEquals(_ExposureVariant, otherT._ExposureVariant)) return false; if(!comparer.ListEquals(_Outcome, otherT._Outcome)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs index 1a814acc6..c1eb2ff33 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/EvidenceVariable.cs @@ -252,14 +252,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_UsageContext, otherT._UsageContext)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_ParticipantEffective, otherT._ParticipantEffective)) return false; if(!comparer.Equals(_TimeFromStart, otherT._TimeFromStart)) return false; if(!comparer.Equals(_GroupMeasureElement, otherT._GroupMeasureElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -969,7 +970,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceVariable otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -996,7 +998,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs index c6b332ec5..f86541ace 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExampleScenario.cs @@ -234,11 +234,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -481,13 +482,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; if(!comparer.Equals(_ResourceTypeElement, otherT._ResourceTypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Version, otherT._Version)) return false; if(!comparer.ListEquals(_ContainedInstance, otherT._ContainedInstance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -654,9 +656,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -797,9 +800,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainedInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1010,12 +1014,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_PreConditionsElement, otherT._PreConditionsElement)) return false; if(!comparer.Equals(_PostConditionsElement, otherT._PostConditionsElement)) return false; if(!comparer.ListEquals(_Step, otherT._Step)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1188,11 +1193,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StepComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Process, otherT._Process)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Process, otherT._Process)) return false; if(!comparer.Equals(_PauseElement, otherT._PauseElement)) return false; if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_Alternative, otherT._Alternative)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1546,7 +1552,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_InitiatorElement, otherT._InitiatorElement)) return false; @@ -1556,7 +1563,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReceiverActiveElement, otherT._ReceiverActiveElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1768,10 +1775,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AlternativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Step, otherT._Step)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2249,7 +2257,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExampleScenario otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2266,7 +2275,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Process, otherT._Process)) return false; if(!comparer.ListEquals(_WorkflowElement, otherT._WorkflowElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs index c37e65593..1d6b788be 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ExplanationOfBenefit.cs @@ -178,10 +178,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -302,9 +303,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -492,12 +494,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -710,13 +713,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -921,12 +925,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1140,12 +1145,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1329,10 +1335,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1482,10 +1489,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2047,7 +2055,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; @@ -2070,7 +2079,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2373,11 +2382,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2732,7 +2742,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -2746,7 +2757,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3156,7 +3167,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -3169,7 +3181,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3691,7 +3703,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; @@ -3709,7 +3722,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4069,7 +4082,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -4078,7 +4092,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4360,7 +4374,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -4368,7 +4383,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4524,9 +4539,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4709,13 +4725,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4929,11 +4946,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5189,7 +5207,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -5197,7 +5216,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Term, otherT._Term)) return false; if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5369,10 +5388,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -6150,7 +6170,7 @@ public List Benefit List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -6215,7 +6235,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; @@ -6258,7 +6279,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Expression.cs b/src/Hl7.Fhir.R4/Model/Generated/Expression.cs index e22706524..08194e436 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Expression.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Expression.cs @@ -229,12 +229,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Expression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs index c77fe8458..53f20e65b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/FamilyMemberHistory.cs @@ -223,12 +223,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; if(!comparer.Equals(_Onset, otherT._Onset)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -691,7 +692,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -709,7 +711,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Flag.cs b/src/Hl7.Fhir.R4/Model/Generated/Flag.cs index 15bfdd3a7..82fa3386d 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Flag.cs @@ -227,7 +227,7 @@ public Hl7.Fhir.Model.ResourceReference? Author List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -257,7 +257,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -265,7 +266,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Goal.cs b/src/Hl7.Fhir.R4/Model/Generated/Goal.cs index 974b8e8b1..20bb157fe 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Goal.cs @@ -212,10 +212,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -552,7 +553,7 @@ public List OutcomeReference List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Category; set => Category = value; } - IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -590,7 +591,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_LifecycleStatusElement, otherT._LifecycleStatusElement)) return false; if(!comparer.Equals(_AchievementStatus, otherT._AchievementStatus)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -606,7 +608,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_OutcomeCode, otherT._OutcomeCode)) return false; if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs index 6125b5904..9f141b96a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/GraphDefinition.cs @@ -311,13 +311,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -544,12 +545,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -803,12 +805,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1282,7 +1285,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1297,7 +1301,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Group.cs b/src/Hl7.Fhir.R4/Model/Generated/Group.cs index 8df8362c9..9f8129ee5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Group.cs @@ -224,11 +224,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -384,10 +385,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -658,7 +660,7 @@ public List Member List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -690,7 +692,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; @@ -700,7 +703,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ManagingEntity, otherT._ManagingEntity)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_Member, otherT._Member)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs index 1ceead631..e77823e28 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/GuidanceResponse.cs @@ -362,7 +362,7 @@ public List DataRequirement List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.DataType? ICoded.Code { get => Module; set => Module = value!; } - IEnumerable ICoded.ToCodings() => Module?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Module?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -399,7 +399,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Module, otherT._Module)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -414,7 +415,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; if(!comparer.Equals(_Result, otherT._Result)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs index caae71e7d..8d9e959e1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HealthcareService.cs @@ -139,9 +139,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -346,11 +347,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -490,9 +492,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_During, otherT._During)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -975,7 +978,7 @@ public List Endpoint List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1021,7 +1024,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1045,7 +1049,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs index 4e1dd36ca..b3456eef8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/HumanName.cs @@ -337,14 +337,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs index 1bde1a7ea..9cf006220 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImagingStudy.cs @@ -394,7 +394,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Modality, otherT._Modality)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -406,7 +407,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,9 +592,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -779,11 +781,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1255,7 +1258,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Modality, otherT._Modality)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -1275,7 +1279,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Series, otherT._Series)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs index 19bd67103..6c29beb53 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Immunization.cs @@ -158,9 +158,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -358,11 +359,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EducationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DocumentTypeElement, otherT._DocumentTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DocumentTypeElement, otherT._DocumentTypeElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; if(!comparer.Equals(_PresentationDateElement, otherT._PresentationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -533,10 +535,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -719,12 +722,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProtocolAppliedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1285,7 +1289,7 @@ public List ProtocolApplie List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => VaccineCode; set => VaccineCode = value!; } - IEnumerable ICoded.ToCodings() => VaccineCode?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => VaccineCode?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1335,7 +1339,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; @@ -1363,7 +1368,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FundingSource, otherT._FundingSource)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; if(!comparer.ListEquals(_ProtocolApplied, otherT._ProtocolApplied)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs index 59d2b8785..ecf02a95b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationEvaluation.cs @@ -370,7 +370,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImmunizationEvaluation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -383,7 +384,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs index fa997baa4..001da20df 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImmunizationRecommendation.cs @@ -313,7 +313,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.ListEquals(_ContraindicatedVaccineCode, otherT._ContraindicatedVaccineCode)) return false; if(!comparer.Equals(_ForecastStatus, otherT._ForecastStatus)) return false; @@ -325,7 +326,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -523,9 +524,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -686,12 +688,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs index c1b6f345e..a58c8aaaf 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ImplementationGuide.cs @@ -2376,10 +2376,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependsOnComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2531,9 +2532,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2690,12 +2692,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; if(!comparer.Equals(_Page, otherT._Page)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Template, otherT._Template)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2858,9 +2861,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3097,13 +3101,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Example, otherT._Example)) return false; if(!comparer.Equals(_GroupingIdElement, otherT._GroupingIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3309,11 +3314,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Name, otherT._Name)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_GenerationElement, otherT._GenerationElement)) return false; if(!comparer.ListEquals(_Page, otherT._Page)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3468,9 +3474,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3638,10 +3645,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3855,12 +3863,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Page, otherT._Page)) return false; if(!comparer.ListEquals(_ImageElement, otherT._ImageElement)) return false; if(!comparer.ListEquals(_OtherElement, otherT._OtherElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4025,10 +4034,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Example, otherT._Example)) return false; if(!comparer.Equals(_RelativePathElement, otherT._RelativePathElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4209,10 +4219,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestPageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.ListEquals(_AnchorElement, otherT._AnchorElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4780,7 +4791,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -4800,7 +4812,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Global, otherT._Global)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_Manifest, otherT._Manifest)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs index 3f40a3d21..8546205ca 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/InsurancePlan.cs @@ -182,11 +182,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -329,10 +330,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -480,10 +482,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -600,9 +603,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LimitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -777,13 +781,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_GeneralCost, otherT._GeneralCost)) return false; if(!comparer.ListEquals(_SpecificCost, otherT._SpecificCost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -979,11 +984,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GeneralCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_GroupSizeElement, otherT._GroupSizeElement)) return false; if(!comparer.Equals(_Cost, otherT._Cost)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1109,9 +1115,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecificCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1223,9 +1230,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1366,11 +1374,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_Qualifiers, otherT._Qualifiers)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1718,7 +1727,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsurancePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1732,7 +1742,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs index dd97349c4..d6e923d83 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Invoice.cs @@ -169,9 +169,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -315,10 +316,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LineItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_ChargeItem, otherT._ChargeItem)) return false; if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -496,11 +498,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -882,7 +885,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Invoice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CancelledReasonElement, otherT._CancelledReasonElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -898,7 +902,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TotalGross, otherT._TotalGross)) return false; if(!comparer.Equals(_PaymentTermsElement, otherT._PaymentTermsElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Library.cs b/src/Hl7.Fhir.R4/Model/Generated/Library.cs index b9ab8512a..42a89acc9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Library.cs @@ -717,7 +717,7 @@ public List Content List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Topic; set => Topic = value; } - IEnumerable ICoded.ToCodings() => Topic?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Topic?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -770,7 +770,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -801,7 +802,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs index 4f306336d..e7d293162 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Linkage.cs @@ -175,9 +175,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -303,10 +304,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/List.cs b/src/Hl7.Fhir.R4/Model/Generated/List.cs index 553396b6f..2c1c07633 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/List.cs @@ -214,11 +214,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Flag, otherT._Flag)) return false; if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -528,7 +529,7 @@ public Hl7.Fhir.Model.CodeableConcept? EmptyReason List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -563,7 +564,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -576,7 +578,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Location.cs b/src/Hl7.Fhir.R4/Model/Generated/Location.cs index 2d6f860e6..e85054b18 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Location.cs @@ -237,10 +237,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -452,11 +453,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HoursOfOperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_OpeningTimeElement, otherT._OpeningTimeElement)) return false; if(!comparer.Equals(_ClosingTimeElement, otherT._ClosingTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -852,7 +854,7 @@ public List Endpoint List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Type; set => Type = value; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -891,7 +893,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -908,7 +911,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HoursOfOperation, otherT._HoursOfOperation)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs b/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs index 8a2cb448a..bff5e8c80 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MarketingStatus.cs @@ -167,12 +167,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MarketingStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Country, otherT._Country)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_DateRange, otherT._DateRange)) return false; if(!comparer.Equals(_RestoreDateElement, otherT._RestoreDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs index 693946c26..20ee4f475 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Measure.cs @@ -171,11 +171,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -330,10 +331,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -494,11 +496,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -653,10 +656,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -820,11 +824,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1799,7 +1804,7 @@ public List SupplementalData List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Topic; set => Topic = value; } - IEnumerable ICoded.ToCodings() => Topic?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Topic?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1862,7 +1867,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1903,7 +1909,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_GuidanceElement, otherT._GuidanceElement)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs index 620268217..dac50ec89 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MeasureReport.cs @@ -218,11 +218,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -378,10 +379,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -500,9 +502,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -642,11 +645,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -772,9 +776,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -916,10 +921,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1226,7 +1232,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_MeasureElement, otherT._MeasureElement)) return false; @@ -1237,7 +1244,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.ListEquals(_EvaluatedResource, otherT._EvaluatedResource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Media.cs b/src/Hl7.Fhir.R4/Model/Generated/Media.cs index 8306fb1a8..0e65453f2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Media.cs @@ -522,7 +522,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Media otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -544,7 +545,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; if(!comparer.Equals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Medication.cs b/src/Hl7.Fhir.R4/Model/Generated/Medication.cs index df1f8d33d..be742678b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Medication.cs @@ -188,10 +188,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -338,9 +339,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -516,7 +518,7 @@ public Hl7.Fhir.Model.Medication.BatchComponent? Batch List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -546,7 +548,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; @@ -554,7 +557,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.Equals(_Batch, otherT._Batch)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs index 9d0af2e93..44ac4bddc 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationAdministration.cs @@ -182,9 +182,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -370,13 +371,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Site, otherT._Site)) return false; if(!comparer.Equals(_Route, otherT._Route)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Dose, otherT._Dose)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -775,7 +777,7 @@ public List EventHistory List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } - IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -816,7 +818,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -835,7 +838,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs index 0aed9ae91..109cd44fe 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationDispense.cs @@ -194,9 +194,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -356,11 +357,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_ResponsibleParty, otherT._ResponsibleParty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -824,7 +826,7 @@ public List EventHistory List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } - IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -870,7 +872,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; @@ -894,7 +897,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs index a893ab346..9d29b83fa 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationKnowledge.cs @@ -158,9 +158,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedMedicationKnowledgeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -269,9 +270,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonographComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -414,10 +416,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -565,10 +568,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_Cost, otherT._Cost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -700,9 +704,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonitoringProgramComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -831,10 +836,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrationGuidelinesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; if(!comparer.Equals(_Indication, otherT._Indication)) return false; if(!comparer.ListEquals(_PatientCharacteristics, otherT._PatientCharacteristics)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -950,9 +956,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1084,9 +1091,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PatientCharacteristicsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Characteristic, otherT._Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1195,9 +1203,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicineClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1308,9 +1317,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1423,9 +1433,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DrugCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1565,11 +1576,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RegulatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; if(!comparer.ListEquals(_Substitution, otherT._Substitution)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_MaxDispense, otherT._MaxDispense)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1707,9 +1719,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1803,8 +1816,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1905,9 +1919,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MaxDispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2030,10 +2045,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not KineticsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_AreaUnderCurve, otherT._AreaUnderCurve)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_AreaUnderCurve, otherT._AreaUnderCurve)) return false; if(!comparer.ListEquals(_LethalDose50, otherT._LethalDose50)) return false; if(!comparer.Equals(_HalfLifePeriod, otherT._HalfLifePeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2447,7 +2463,7 @@ public List Kinetics private List? _Kinetics; Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -2491,7 +2507,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationKnowledge otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.Equals(_DoseForm, otherT._DoseForm)) return false; @@ -2513,7 +2530,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Contraindication, otherT._Contraindication)) return false; if(!comparer.ListEquals(_Regulatory, otherT._Regulatory)) return false; if(!comparer.ListEquals(_Kinetics, otherT._Kinetics)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs index a0e226752..d77d07cdc 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationRequest.cs @@ -329,14 +329,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; if(!comparer.Equals(_DispenseInterval, otherT._DispenseInterval)) return false; if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_ExpectedSupplyDuration, otherT._ExpectedSupplyDuration)) return false; if(!comparer.Equals(_Performer, otherT._Performer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -482,9 +483,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InitialFillComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -599,9 +601,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1236,7 +1239,7 @@ public List EventHistory List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } - IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1290,7 +1293,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; @@ -1322,7 +1326,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs index a85c5d9b9..a9a4228d5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicationStatement.cs @@ -422,7 +422,7 @@ public List Dosage List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.DataType? ICoded.Code { get => Medication; set => Medication = value!; } - IEnumerable ICoded.ToCodings() => Medication?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Medication?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -461,7 +461,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -478,7 +479,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs index a97994753..6881e6029 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProduct.cs @@ -152,10 +152,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.ListEquals(_NamePart, otherT._NamePart)) return false; if(!comparer.ListEquals(_CountryLanguage, otherT._CountryLanguage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -286,9 +287,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NamePartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -411,10 +413,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CountryLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Country, otherT._Country)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -604,13 +607,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManufacturingBusinessOperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_OperationType, otherT._OperationType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_OperationType, otherT._OperationType)) return false; if(!comparer.Equals(_AuthorisationReferenceNumber, otherT._AuthorisationReferenceNumber)) return false; if(!comparer.Equals(_EffectiveDateElement, otherT._EffectiveDateElement)) return false; if(!comparer.Equals(_ConfidentialityIndicator, otherT._ConfidentialityIndicator)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -834,14 +838,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecialDesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_IntendedUse, otherT._IntendedUse)) return false; if(!comparer.Equals(_Indication, otherT._Indication)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Species, otherT._Species)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1268,7 +1273,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Domain, otherT._Domain)) return false; if(!comparer.Equals(_CombinedPharmaceuticalDoseForm, otherT._CombinedPharmaceuticalDoseForm)) return false; @@ -1288,7 +1294,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CrossReference, otherT._CrossReference)) return false; if(!comparer.ListEquals(_ManufacturingBusinessOperation, otherT._ManufacturingBusinessOperation)) return false; if(!comparer.ListEquals(_SpecialDesignation, otherT._SpecialDesignation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs index 4784bff97..7dd3d6bd4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductAuthorization.cs @@ -164,12 +164,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not JurisdictionalAuthorizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Country, otherT._Country)) return false; if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -329,11 +330,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Date, otherT._Date)) return false; if(!comparer.ListEquals(_Application, otherT._Application)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -709,7 +711,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductAuthorization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.ListEquals(_Country, otherT._Country)) return false; if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; @@ -725,7 +728,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Holder, otherT._Holder)) return false; if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs index 7fd20767e..9ec0d5679 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductContraindication.cs @@ -128,9 +128,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TherapyRelationshipType, otherT._TherapyRelationshipType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TherapyRelationshipType, otherT._TherapyRelationshipType)) return false; if(!comparer.Equals(_Medication, otherT._Medication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -303,14 +304,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductContraindication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Disease, otherT._Disease)) return false; if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; if(!comparer.ListEquals(_TherapeuticIndication, otherT._TherapeuticIndication)) return false; if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs index ffe371ee4..e280fb717 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIndication.cs @@ -128,9 +128,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TherapyRelationshipType, otherT._TherapyRelationshipType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TherapyRelationshipType, otherT._TherapyRelationshipType)) return false; if(!comparer.Equals(_Medication, otherT._Medication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -331,7 +332,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductIndication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; @@ -340,7 +342,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; if(!comparer.ListEquals(_UndesirableEffect, otherT._UndesirableEffect)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs index b27f82130..ac844c8d6 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductIngredient.cs @@ -151,11 +151,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecifiedSubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Group, otherT._Group)) return false; if(!comparer.Equals(_Confidentiality, otherT._Confidentiality)) return false; if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -364,14 +365,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; if(!comparer.Equals(_PresentationLowLimit, otherT._PresentationLowLimit)) return false; if(!comparer.Equals(_Concentration, otherT._Concentration)) return false; if(!comparer.Equals(_ConcentrationLowLimit, otherT._ConcentrationLowLimit)) return false; if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; if(!comparer.ListEquals(_Country, otherT._Country)) return false; if(!comparer.ListEquals(_ReferenceStrength, otherT._ReferenceStrength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -572,12 +574,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceStrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; if(!comparer.Equals(_StrengthLowLimit, otherT._StrengthLowLimit)) return false; if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; if(!comparer.ListEquals(_Country, otherT._Country)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -707,9 +710,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -881,13 +885,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductIngredient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.ListEquals(_SpecifiedSubstance, otherT._SpecifiedSubstance)) return false; if(!comparer.Equals(_Substance, otherT._Substance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs index 5affd6fc8..4c9cb6c28 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductInteraction.cs @@ -113,8 +113,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InteractantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -290,14 +291,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductInteraction otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Effect, otherT._Effect)) return false; if(!comparer.Equals(_Incidence, otherT._Incidence)) return false; if(!comparer.Equals(_Management, otherT._Management)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs index 6f8b9545b..54204bca0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductManufactured.cs @@ -186,14 +186,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductManufactured otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ManufacturedDoseForm, otherT._ManufacturedDoseForm)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ManufacturedDoseForm, otherT._ManufacturedDoseForm)) return false; if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.Equals(_PhysicalCharacteristics, otherT._PhysicalCharacteristics)) return false; if(!comparer.ListEquals(_OtherCharacteristics, otherT._OtherCharacteristics)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs index 3961d543b..1f6828da0 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPackaged.cs @@ -121,9 +121,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BatchIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_OuterPackaging, otherT._OuterPackaging)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_OuterPackaging, otherT._OuterPackaging)) return false; if(!comparer.Equals(_ImmediatePackaging, otherT._ImmediatePackaging)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -387,7 +388,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackageItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.ListEquals(_Material, otherT._Material)) return false; @@ -399,7 +401,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_OtherCharacteristics, otherT._OtherCharacteristics)) return false; if(!comparer.ListEquals(_ShelfLifeStorage, otherT._ShelfLifeStorage)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -690,7 +692,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductPackaged otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_LegalStatusOfSupply, otherT._LegalStatusOfSupply)) return false; @@ -699,7 +702,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.ListEquals(_BatchIdentifier, otherT._BatchIdentifier)) return false; if(!comparer.ListEquals(_PackageItem, otherT._PackageItem)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs index f637091a6..2800e0a90 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductPharmaceutical.cs @@ -121,9 +121,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -302,14 +303,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RouteOfAdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FirstDose, otherT._FirstDose)) return false; if(!comparer.Equals(_MaxSingleDose, otherT._MaxSingleDose)) return false; if(!comparer.Equals(_MaxDosePerDay, otherT._MaxDosePerDay)) return false; if(!comparer.Equals(_MaxDosePerTreatmentPeriod, otherT._MaxDosePerTreatmentPeriod)) return false; if(!comparer.Equals(_MaxTreatmentPeriod, otherT._MaxTreatmentPeriod)) return false; if(!comparer.ListEquals(_TargetSpecies, otherT._TargetSpecies)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -453,9 +455,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetSpeciesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_WithdrawalPeriod, otherT._WithdrawalPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -593,10 +596,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not WithdrawalPeriodComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_SupportingInformationElement, otherT._SupportingInformationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -779,14 +783,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductPharmaceutical otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_AdministrableDoseForm, otherT._AdministrableDoseForm)) return false; if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.ListEquals(_Device, otherT._Device)) return false; if(!comparer.ListEquals(_Characteristics, otherT._Characteristics)) return false; if(!comparer.ListEquals(_RouteOfAdministration, otherT._RouteOfAdministration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs index f381faed8..5ca320423 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MedicinalProductUndesirableEffect.cs @@ -156,12 +156,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductUndesirableEffect otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; if(!comparer.Equals(_Classification, otherT._Classification)) return false; if(!comparer.Equals(_FrequencyOfOccurrence, otherT._FrequencyOfOccurrence)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs index 3ee3ab178..f3434cd05 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MessageDefinition.cs @@ -247,11 +247,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -407,9 +408,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1056,7 +1058,7 @@ public IEnumerable Graph List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.DataType? ICoded.Code { get => Event; set => Event = value!; } - IEnumerable ICoded.ToCodings() => Event?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Event?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1102,7 +1104,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1126,7 +1129,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; if(!comparer.ListEquals(_GraphElement, otherT._GraphElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs index 7a163da40..a5fac8802 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MessageHeader.cs @@ -218,11 +218,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -449,12 +450,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_Contact, otherT._Contact)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -635,10 +637,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Details, otherT._Details)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -898,7 +901,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_Sender, otherT._Sender)) return false; if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; @@ -909,7 +913,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Response, otherT._Response)) return false; if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs index 7d1fd6846..2074b529c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/MolecularSequence.cs @@ -462,7 +462,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceSeqComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; if(!comparer.Equals(_GenomeBuildElement, otherT._GenomeBuildElement)) return false; if(!comparer.Equals(_OrientationElement, otherT._OrientationElement)) return false; if(!comparer.Equals(_ReferenceSeqId, otherT._ReferenceSeqId)) return false; @@ -471,7 +472,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -763,13 +764,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_ObservedAlleleElement, otherT._ObservedAlleleElement)) return false; if(!comparer.Equals(_ReferenceAlleleElement, otherT._ReferenceAlleleElement)) return false; if(!comparer.Equals(_CigarElement, otherT._CigarElement)) return false; if(!comparer.Equals(_VariantPointer, otherT._VariantPointer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1259,7 +1261,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_StandardSequence, otherT._StandardSequence)) return false; if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; @@ -1274,7 +1277,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; if(!comparer.Equals(_FScoreElement, otherT._FScoreElement)) return false; if(!comparer.Equals(_Roc, otherT._Roc)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1678,14 +1681,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RocComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ScoreElement, otherT._ScoreElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ScoreElement, otherT._ScoreElement)) return false; if(!comparer.ListEquals(_NumTPElement, otherT._NumTPElement)) return false; if(!comparer.ListEquals(_NumFPElement, otherT._NumFPElement)) return false; if(!comparer.ListEquals(_NumFNElement, otherT._NumFNElement)) return false; if(!comparer.ListEquals(_PrecisionElement, otherT._PrecisionElement)) return false; if(!comparer.ListEquals(_SensitivityElement, otherT._SensitivityElement)) return false; if(!comparer.ListEquals(_FMeasureElement, otherT._FMeasureElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1979,13 +1983,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepositoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DatasetIdElement, otherT._DatasetIdElement)) return false; if(!comparer.Equals(_VariantsetIdElement, otherT._VariantsetIdElement)) return false; if(!comparer.Equals(_ReadsetIdElement, otherT._ReadsetIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2196,12 +2201,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureVariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariantType, otherT._VariantType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VariantType, otherT._VariantType)) return false; if(!comparer.Equals(_ExactElement, otherT._ExactElement)) return false; if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; if(!comparer.Equals(_Outer, otherT._Outer)) return false; if(!comparer.Equals(_Inner, otherT._Inner)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2359,9 +2365,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OuterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2498,9 +2505,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InnerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2871,7 +2879,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MolecularSequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_CoordinateSystemElement, otherT._CoordinateSystemElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -2887,7 +2896,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Repository, otherT._Repository)) return false; if(!comparer.ListEquals(_Pointer, otherT._Pointer)) return false; if(!comparer.ListEquals(_StructureVariant, otherT._StructureVariant)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Money.cs b/src/Hl7.Fhir.R4/Model/Generated/Money.cs index 8e4b91d18..776071f9c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Money.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Money.cs @@ -1241,9 +1241,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Money otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_CurrencyElement, otherT._CurrencyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs index a55f0d8d7..747f07f9b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/NamingSystem.cs @@ -295,12 +295,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -703,7 +704,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -716,7 +718,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs index e76a265e4..f301cd375 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/NutritionOrder.cs @@ -205,13 +205,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -350,9 +351,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -464,9 +466,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -650,12 +653,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -933,7 +937,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; if(!comparer.Equals(_AdditiveType, otherT._AdditiveType)) return false; if(!comparer.Equals(_AdditiveProductNameElement, otherT._AdditiveProductNameElement)) return false; @@ -942,7 +947,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1118,10 +1123,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1560,7 +1566,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; @@ -1577,7 +1584,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Observation.cs b/src/Hl7.Fhir.R4/Model/Generated/Observation.cs index 381df344d..91407f95c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Observation.cs @@ -202,13 +202,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Low, otherT._Low)) return false; if(!comparer.Equals(_High, otherT._High)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -397,12 +398,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -860,7 +862,7 @@ public List Component List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -906,7 +908,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -930,7 +933,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs index 79a9d702f..e7fb19831 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ObservationDefinition.cs @@ -291,11 +291,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QuantitativeDetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CustomaryUnit, otherT._CustomaryUnit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CustomaryUnit, otherT._CustomaryUnit)) return false; if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_ConversionFactorElement, otherT._ConversionFactorElement)) return false; if(!comparer.Equals(_DecimalPrecisionElement, otherT._DecimalPrecisionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -555,7 +556,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualifiedIntervalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_Range, otherT._Range)) return false; if(!comparer.Equals(_Context, otherT._Context)) return false; if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; @@ -563,7 +565,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_GestationalAge, otherT._GestationalAge)) return false; if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -889,7 +891,7 @@ public Hl7.Fhir.Model.ResourceReference? CriticalCodedValueSet List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -924,7 +926,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ObservationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_PermittedDataTypeElement, otherT._PermittedDataTypeElement)) return false; @@ -937,7 +940,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_NormalCodedValueSet, otherT._NormalCodedValueSet)) return false; if(!comparer.Equals(_AbnormalCodedValueSet, otherT._AbnormalCodedValueSet)) return false; if(!comparer.Equals(_CriticalCodedValueSet, otherT._CriticalCodedValueSet)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs index 7501b563c..9c6fe3cf2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/OperationDefinition.cs @@ -411,7 +411,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; @@ -422,7 +423,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Binding, otherT._Binding)) return false; if(!comparer.ListEquals(_ReferencedFrom, otherT._ReferencedFrom)) return false; if(!comparer.ListEquals(_Part, otherT._Part)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -629,9 +630,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -773,9 +775,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferencedFromComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -920,9 +923,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1645,7 +1649,7 @@ public List Overload private List? _Overload; Hl7.Fhir.Model.Code? ICoded.Code { get => CodeElement; set => CodeElement = value!; } - IEnumerable ICoded.ToCodings() => CodeElement?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => CodeElement?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1693,7 +1697,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -1719,7 +1724,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OutputProfileElement, otherT._OutputProfileElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs index a4b344d4a..9837d94b8 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Organization.cs @@ -156,11 +156,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -442,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -452,7 +454,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs index ad5acdc9b..a7341a4e7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/OrganizationAffiliation.cs @@ -286,7 +286,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrganizationAffiliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; @@ -298,7 +299,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs index 644b21642..b3ffd31ac 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ParameterDefinition.cs @@ -291,14 +291,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Patient.cs b/src/Hl7.Fhir.R4/Model/Generated/Patient.cs index 539553a40..3ff961c3e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Patient.cs @@ -252,14 +252,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -421,9 +422,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -555,9 +557,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Other, otherT._Other)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -916,7 +919,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -932,7 +936,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs index f90648025..80babbe4b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PaymentNotice.cs @@ -318,7 +318,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; @@ -330,7 +331,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs index 418481be2..e94cbee22 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PaymentReconciliation.cs @@ -265,7 +265,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; @@ -275,7 +276,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; if(!comparer.Equals(_Payee, otherT._Payee)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -473,9 +474,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -846,7 +848,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; @@ -861,7 +864,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Person.cs b/src/Hl7.Fhir.R4/Model/Generated/Person.cs index 19a03ec07..81fade0da 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Person.cs @@ -178,9 +178,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -442,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; @@ -452,7 +454,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs index d8212064c..a17c4cce4 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PlanDefinition.cs @@ -205,14 +205,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Description, otherT._Description)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.Equals(_Start, otherT._Start)) return false; if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -374,10 +375,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1061,7 +1063,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; @@ -1088,7 +1091,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1392,9 +1395,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1555,10 +1559,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1694,9 +1699,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1822,9 +1828,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2592,7 +2599,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2623,7 +2631,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Population.cs b/src/Hl7.Fhir.R4/Model/Generated/Population.cs index c0d96ef5e..9e9cc3e13 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Population.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Population.cs @@ -140,11 +140,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Population otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Age, otherT._Age)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_Gender, otherT._Gender)) return false; if(!comparer.Equals(_Race, otherT._Race)) return false; if(!comparer.Equals(_PhysiologicalCondition, otherT._PhysiologicalCondition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs index 360b69de8..2ee7cfe31 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Practitioner.cs @@ -159,11 +159,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -440,7 +441,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -450,7 +452,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs index 8bf8cbc20..299424948 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/PractitionerRole.cs @@ -221,11 +221,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,9 +366,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_During, otherT._During)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -649,7 +651,7 @@ public List Endpoint List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Code; set => Code = value; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -685,7 +687,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; @@ -699,7 +702,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs index 192265fc1..8b2a5f71f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Procedure.cs @@ -146,10 +146,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -270,9 +271,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -790,7 +792,7 @@ public List UsedCode List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -840,7 +842,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -868,7 +871,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; if(!comparer.ListEquals(_UsedReference, otherT._UsedReference)) return false; if(!comparer.ListEquals(_UsedCode, otherT._UsedCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs index d3ae03900..456c7cc12 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ProdCharacteristic.cs @@ -287,7 +287,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProdCharacteristic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Height, otherT._Height)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Height, otherT._Height)) return false; if(!comparer.Equals(_Width, otherT._Width)) return false; if(!comparer.Equals(_Depth, otherT._Depth)) return false; if(!comparer.Equals(_Weight, otherT._Weight)) return false; @@ -298,7 +299,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ImprintElement, otherT._ImprintElement)) return false; if(!comparer.ListEquals(_Image, otherT._Image)) return false; if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs index 91df7e4dc..9cb40aa84 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ProductShelfLife.cs @@ -138,11 +138,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProductShelfLife otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs index c0ebb4d4a..4f70facb9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Provenance.cs @@ -204,11 +204,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,10 +366,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; if(!comparer.Equals(_What, otherT._What)) return false; if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -629,7 +631,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.Equals(_Occurred, otherT._Occurred)) return false; if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; @@ -639,7 +642,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs index c5b35b464..3162fcc48 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Questionnaire.cs @@ -680,7 +680,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; @@ -696,7 +697,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_AnswerOption, otherT._AnswerOption)) return false; if(!comparer.ListEquals(_Initial, otherT._Initial)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -958,10 +959,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; if(!comparer.Equals(_Answer, otherT._Answer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1099,9 +1101,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerOptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_InitialSelectedElement, otherT._InitialSelectedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1203,8 +1206,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InitialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1778,7 +1782,7 @@ public List Item List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.FhirString? ICoded.Code { get => NameElement; set => NameElement = value!; } - IEnumerable ICoded.ToCodings() => NameElement?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => NameElement?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1822,7 +1826,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1844,7 +1849,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs index fe8d2897e..374506c32 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/QuestionnaireResponse.cs @@ -258,12 +258,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -400,9 +401,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -687,7 +689,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_QuestionnaireElement, otherT._QuestionnaireElement)) return false; @@ -698,7 +701,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs b/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs index dd9fff02e..dc9a9bb54 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Ratio.cs @@ -111,9 +111,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs index f355be305..ccdc761d5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RelatedPerson.cs @@ -143,9 +143,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -408,7 +409,7 @@ public List Communication List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } List ICoded>.Code { get => Relationship; set => Relationship = value; } - IEnumerable ICoded.ToCodings() => Relationship?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Relationship?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -442,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; @@ -454,7 +456,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs index 39dfa6aae..cc43d288c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RequestGroup.cs @@ -539,7 +539,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; @@ -558,7 +559,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -806,9 +807,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -968,10 +970,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1386,7 +1389,7 @@ public List Action List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1426,7 +1429,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestGroup otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1444,7 +1448,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs index 620004cf8..816d1d278 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchDefinition.cs @@ -866,7 +866,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -900,7 +901,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Exposure, otherT._Exposure)) return false; if(!comparer.Equals(_ExposureAlternative, otherT._ExposureAlternative)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs index f059f8567..7b8aa3f21 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchElementDefinition.cs @@ -384,7 +384,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Definition, otherT._Definition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_UsageContext, otherT._UsageContext)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; @@ -396,7 +397,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ParticipantEffective, otherT._ParticipantEffective)) return false; if(!comparer.Equals(_ParticipantEffectiveTimeFromStart, otherT._ParticipantEffectiveTimeFromStart)) return false; if(!comparer.Equals(_ParticipantEffectiveGroupMeasureElement, otherT._ParticipantEffectiveGroupMeasureElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1329,7 +1330,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1362,7 +1364,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_VariableTypeElement, otherT._VariableTypeElement)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs index 20699689f..0b1d4ba34 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchStudy.cs @@ -248,10 +248,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ArmComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -384,9 +385,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ObjectiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -873,7 +875,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.ListEquals(_Protocol, otherT._Protocol)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; @@ -897,7 +900,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Arm, otherT._Arm)) return false; if(!comparer.ListEquals(_Objective, otherT._Objective)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs index 64fdc5ffd..acf49aaa3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ResearchSubject.cs @@ -342,7 +342,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Study, otherT._Study)) return false; @@ -350,7 +351,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AssignedArmElement, otherT._AssignedArmElement)) return false; if(!comparer.Equals(_ActualArmElement, otherT._ActualArmElement)) return false; if(!comparer.Equals(_Consent, otherT._Consent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs index 7356e2793..26d207ed2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RiskAssessment.cs @@ -219,13 +219,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_Probability, otherT._Probability)) return false; if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; if(!comparer.Equals(_When, otherT._When)) return false; if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -582,7 +583,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -621,7 +622,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_Parent, otherT._Parent)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -638,7 +640,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs b/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs index 0e7d5febf..06e2a54ca 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/RiskEvidenceSynthesis.cs @@ -185,10 +185,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -438,14 +439,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RiskEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; if(!comparer.Equals(_DenominatorCountElement, otherT._DenominatorCountElement)) return false; if(!comparer.Equals(_NumeratorCountElement, otherT._NumeratorCountElement)) return false; if(!comparer.ListEquals(_PrecisionEstimate, otherT._PrecisionEstimate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -664,11 +666,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrecisionEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; if(!comparer.Equals(_FromElement, otherT._FromElement)) return false; if(!comparer.Equals(_ToElement, otherT._ToElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -810,10 +813,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_CertaintySubcomponent, otherT._CertaintySubcomponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -948,10 +952,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CertaintySubcomponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Rating, otherT._Rating)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1652,7 +1657,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RiskEvidenceSynthesis otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1683,7 +1689,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SampleSize, otherT._SampleSize)) return false; if(!comparer.Equals(_RiskEstimate, otherT._RiskEstimate)) return false; if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs b/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs index bc0514cf9..f2b5eb3ed 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SampledData.cs @@ -274,14 +274,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_LowerLimitElement, otherT._LowerLimitElement)) return false; if(!comparer.Equals(_UpperLimitElement, otherT._UpperLimitElement)) return false; if(!comparer.Equals(_DimensionsElement, otherT._DimensionsElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs index d741294ae..bd5c1f961 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Schedule.cs @@ -233,7 +233,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; @@ -241,7 +242,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs index ae83da0ea..fb5384f40 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SearchParameter.cs @@ -345,9 +345,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1107,7 +1108,7 @@ public List Component private List? _Component; List> ICoded>>.Code { get => TargetElement; set => TargetElement = value; } - IEnumerable ICoded.ToCodings() => TargetElement?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => TargetElement?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1155,7 +1156,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DerivedFromElement, otherT._DerivedFromElement)) return false; @@ -1181,7 +1183,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs index 691db1b74..2a4d47453 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/ServiceRequest.cs @@ -685,7 +685,7 @@ public List RelevantHistory List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -740,7 +740,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ServiceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -773,7 +774,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Slot.cs b/src/Hl7.Fhir.R4/Model/Generated/Slot.cs index 29e4525e6..f82c5d66e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Slot.cs @@ -366,7 +366,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; @@ -377,7 +378,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs index f1c0cb6e5..72743eba1 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Specimen.cs @@ -239,14 +239,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Collector, otherT._Collector)) return false; if(!comparer.Equals(_Collected, otherT._Collected)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.Equals(_FastingStatus, otherT._FastingStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -440,11 +441,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -645,13 +647,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; if(!comparer.Equals(_Additive, otherT._Additive)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -944,7 +947,7 @@ public List Note List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -979,7 +982,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -992,7 +996,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Container, otherT._Container)) return false; if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs index 1479a1c31..400c85a59 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SpecimenDefinition.cs @@ -284,7 +284,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TypeTestedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PreferenceElement, otherT._PreferenceElement)) return false; if(!comparer.Equals(_Container, otherT._Container)) return false; @@ -292,7 +293,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_RetentionTime, otherT._RetentionTime)) return false; if(!comparer.ListEquals(_RejectionCriterion, otherT._RejectionCriterion)) return false; if(!comparer.ListEquals(_Handling, otherT._Handling)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -561,7 +562,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Material, otherT._Material)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Cap, otherT._Cap)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -569,7 +571,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MinimumVolume, otherT._MinimumVolume)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_PreparationElement, otherT._PreparationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -712,8 +714,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Additive, otherT._Additive)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Additive, otherT._Additive)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -860,11 +863,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HandlingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; if(!comparer.Equals(_TemperatureRange, otherT._TemperatureRange)) return false; if(!comparer.Equals(_MaxDuration, otherT._MaxDuration)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1051,13 +1055,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecimenDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeCollected, otherT._TypeCollected)) return false; if(!comparer.ListEquals(_PatientPreparation, otherT._PatientPreparation)) return false; if(!comparer.Equals(_TimeAspectElement, otherT._TimeAspectElement)) return false; if(!comparer.ListEquals(_Collection, otherT._Collection)) return false; if(!comparer.ListEquals(_TypeTested, otherT._TypeTested)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs index 3c02f67df..0c24cc2fa 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/StructureMap.cs @@ -508,11 +508,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -758,13 +759,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -995,11 +997,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1211,13 +1214,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1633,7 +1637,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; @@ -1644,7 +1649,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; if(!comparer.Equals(_LogMessageElement, otherT._LogMessageElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2014,7 +2019,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_ContextTypeElement, otherT._ContextTypeElement)) return false; if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; @@ -2022,7 +2028,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2160,8 +2166,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2296,9 +2303,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_VariableElement, otherT._VariableElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2814,7 +2822,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2832,7 +2841,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Structure, otherT._Structure)) return false; if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs index f89c54098..fdda0887c 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Subscription.cs @@ -296,11 +296,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChannelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; if(!comparer.Equals(_PayloadElement, otherT._PayloadElement)) return false; if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -560,14 +561,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; if(!comparer.Equals(_ErrorElement, otherT._ErrorElement)) return false; if(!comparer.Equals(_Channel, otherT._Channel)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Substance.cs b/src/Hl7.Fhir.R4/Model/Generated/Substance.cs index b0e1e6f4c..eb97ff38f 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Substance.cs @@ -180,10 +180,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -305,9 +306,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Substance, otherT._Substance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -486,7 +488,7 @@ public List Ingredient List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -515,14 +517,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs index b2feb2a7f..f45438a64 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceAmount.cs @@ -120,9 +120,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LowLimit, otherT._LowLimit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LowLimit, otherT._LowLimit)) return false; if(!comparer.Equals(_HighLimit, otherT._HighLimit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -261,11 +262,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceAmount otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Amount, otherT._Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; if(!comparer.Equals(_AmountTextElement, otherT._AmountTextElement)) return false; if(!comparer.Equals(_ReferenceRange, otherT._ReferenceRange)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs index 0296dc6a3..03df8c1d5 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceNucleicAcid.cs @@ -251,7 +251,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; @@ -259,7 +260,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ThreePrime, otherT._ThreePrime)) return false; if(!comparer.ListEquals(_Linkage, otherT._Linkage)) return false; if(!comparer.ListEquals(_Sugar, otherT._Sugar)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -481,11 +482,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ConnectivityElement, otherT._ConnectivityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ConnectivityElement, otherT._ConnectivityElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -650,10 +652,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SugarComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -827,12 +830,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceNucleicAcid otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; if(!comparer.Equals(_AreaOfHybridisationElement, otherT._AreaOfHybridisationElement)) return false; if(!comparer.Equals(_OligoNucleotideType, otherT._OligoNucleotideType)) return false; if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs index db8466eb9..d000ec66e 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstancePolymer.cs @@ -121,9 +121,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonomerSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RatioType, otherT._RatioType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RatioType, otherT._RatioType)) return false; if(!comparer.ListEquals(_StartingMaterial, otherT._StartingMaterial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -273,11 +274,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StartingMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Material, otherT._Material)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -457,11 +459,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberOfUnitsElement, otherT._NumberOfUnitsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberOfUnitsElement, otherT._NumberOfUnitsElement)) return false; if(!comparer.Equals(_AverageMolecularFormulaElement, otherT._AverageMolecularFormulaElement)) return false; if(!comparer.Equals(_RepeatUnitAmountType, otherT._RepeatUnitAmountType)) return false; if(!comparer.ListEquals(_RepeatUnit, otherT._RepeatUnit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -641,12 +644,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatUnitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_OrientationOfPolymerisation, otherT._OrientationOfPolymerisation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_OrientationOfPolymerisation, otherT._OrientationOfPolymerisation)) return false; if(!comparer.Equals(_RepeatUnitElement, otherT._RepeatUnitElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.ListEquals(_DegreeOfPolymerisation, otherT._DegreeOfPolymerisation)) return false; if(!comparer.ListEquals(_StructuralRepresentation, otherT._StructuralRepresentation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -774,9 +778,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DegreeOfPolymerisationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Degree, otherT._Degree)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Degree, otherT._Degree)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -912,10 +917,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructuralRepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1094,13 +1100,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstancePolymer otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Geometry, otherT._Geometry)) return false; if(!comparer.ListEquals(_CopolymerConnectivity, otherT._CopolymerConnectivity)) return false; if(!comparer.ListEquals(_ModificationElement, otherT._ModificationElement)) return false; if(!comparer.ListEquals(_MonomerSet, otherT._MonomerSet)) return false; if(!comparer.ListEquals(_Repeat, otherT._Repeat)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs index 92e2adb5b..eff7dc108 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceProtein.cs @@ -279,7 +279,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; @@ -287,7 +288,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_NTerminalModificationElement, otherT._NTerminalModificationElement)) return false; if(!comparer.Equals(_CTerminalModificationId, otherT._CTerminalModificationId)) return false; if(!comparer.Equals(_CTerminalModificationElement, otherT._CTerminalModificationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -486,11 +487,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceProtein otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; if(!comparer.ListEquals(_DisulfideLinkageElement, otherT._DisulfideLinkageElement)) return false; if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs index 02733cc0d..ff53b47a7 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceReferenceInformation.cs @@ -137,10 +137,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GeneComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GeneSequenceOrigin, otherT._GeneSequenceOrigin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_GeneSequenceOrigin, otherT._GeneSequenceOrigin)) return false; if(!comparer.Equals(_Gene, otherT._Gene)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -271,10 +272,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GeneElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Element, otherT._Element)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -420,11 +422,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Domain, otherT._Domain)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Domain, otherT._Domain)) return false; if(!comparer.Equals(_Classification, otherT._Classification)) return false; if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -634,7 +637,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Interaction, otherT._Interaction)) return false; if(!comparer.Equals(_Organism, otherT._Organism)) return false; @@ -642,7 +646,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -839,12 +843,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceReferenceInformation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.ListEquals(_Gene, otherT._Gene)) return false; if(!comparer.ListEquals(_GeneElement, otherT._GeneElement)) return false; if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs index 15f6bb7ec..d2bafd317 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSourceMaterial.cs @@ -135,9 +135,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FractionDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FractionElement, otherT._FractionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FractionElement, otherT._FractionElement)) return false; if(!comparer.Equals(_MaterialType, otherT._MaterialType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -344,7 +345,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrganismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Family, otherT._Family)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Family, otherT._Family)) return false; if(!comparer.Equals(_Genus, otherT._Genus)) return false; if(!comparer.Equals(_Species, otherT._Species)) return false; if(!comparer.Equals(_IntraspecificType, otherT._IntraspecificType)) return false; @@ -352,7 +354,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Hybrid, otherT._Hybrid)) return false; if(!comparer.Equals(_OrganismGeneral, otherT._OrganismGeneral)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -516,9 +518,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AuthorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorType, otherT._AuthorType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AuthorType, otherT._AuthorType)) return false; if(!comparer.Equals(_AuthorDescriptionElement, otherT._AuthorDescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -727,12 +730,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HybridComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MaternalOrganismIdElement, otherT._MaternalOrganismIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MaternalOrganismIdElement, otherT._MaternalOrganismIdElement)) return false; if(!comparer.Equals(_MaternalOrganismNameElement, otherT._MaternalOrganismNameElement)) return false; if(!comparer.Equals(_PaternalOrganismIdElement, otherT._PaternalOrganismIdElement)) return false; if(!comparer.Equals(_PaternalOrganismNameElement, otherT._PaternalOrganismNameElement)) return false; if(!comparer.Equals(_HybridType, otherT._HybridType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -888,11 +892,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrganismGeneralComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Kingdom, otherT._Kingdom)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Kingdom, otherT._Kingdom)) return false; if(!comparer.Equals(_Phylum, otherT._Phylum)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Order, otherT._Order)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1013,9 +1018,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PartDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Part, otherT._Part)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Part, otherT._Part)) return false; if(!comparer.Equals(_PartLocation, otherT._PartLocation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1320,7 +1326,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceSourceMaterial otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceMaterialClass, otherT._SourceMaterialClass)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceMaterialClass, otherT._SourceMaterialClass)) return false; if(!comparer.Equals(_SourceMaterialType, otherT._SourceMaterialType)) return false; if(!comparer.Equals(_SourceMaterialState, otherT._SourceMaterialState)) return false; if(!comparer.Equals(_OrganismId, otherT._OrganismId)) return false; @@ -1333,7 +1340,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_FractionDescription, otherT._FractionDescription)) return false; if(!comparer.Equals(_Organism, otherT._Organism)) return false; if(!comparer.ListEquals(_PartDescription, otherT._PartDescription)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs index 08feaf58c..67f3bb733 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SubstanceSpecification.cs @@ -222,14 +222,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MoietyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -433,12 +434,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_ParametersElement, otherT._ParametersElement)) return false; if(!comparer.Equals(_DefiningSubstance, otherT._DefiningSubstance)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -685,7 +687,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; if(!comparer.Equals(_MolecularFormulaByMoietyElement, otherT._MolecularFormulaByMoietyElement)) return false; @@ -693,7 +696,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MolecularWeight, otherT._MolecularWeight)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Representation, otherT._Representation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -884,12 +887,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IsotopeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; if(!comparer.Equals(_HalfLife, otherT._HalfLife)) return false; if(!comparer.Equals(_MolecularWeight, otherT._MolecularWeight)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1031,10 +1035,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MolecularWeightComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Method, otherT._Method)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1177,10 +1182,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1369,12 +1375,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1668,7 +1675,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; @@ -1679,7 +1687,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Translation, otherT._Translation)) return false; if(!comparer.ListEquals(_Official, otherT._Official)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1878,10 +1886,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OfficialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Authority, otherT._Authority)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2088,14 +2097,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelationshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_AmountRatioLowLimit, otherT._AmountRatioLowLimit)) return false; if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2513,7 +2523,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceSpecification otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_Domain, otherT._Domain)) return false; @@ -2532,7 +2543,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Polymer, otherT._Polymer)) return false; if(!comparer.Equals(_Protein, otherT._Protein)) return false; if(!comparer.Equals(_SourceMaterial, otherT._SourceMaterial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs index 29480855c..a6cea8941 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SupplyDelivery.cs @@ -186,9 +186,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -416,7 +417,7 @@ public List Receiver List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Type; set => Type = value!; } - IEnumerable ICoded.ToCodings() => Type?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Type?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -449,7 +450,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -460,7 +462,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs index 290825e30..49395d4da 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/SupplyRequest.cs @@ -181,9 +181,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -501,7 +502,7 @@ public Hl7.Fhir.Model.ResourceReference? DeliverTo List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Category; set => Category = value!; } - IEnumerable ICoded.ToCodings() => Category?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Category?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -538,7 +539,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; @@ -553,7 +555,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Task.cs b/src/Hl7.Fhir.R4/Model/Generated/Task.cs index 55613bc4c..1704ad86a 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Task.cs @@ -301,10 +301,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,9 +427,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -543,9 +545,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1161,7 +1164,7 @@ public List Output List IIdentifiable>.Identifier { get => Identifier; set => Identifier = value; } Hl7.Fhir.Model.CodeableConcept? ICoded.Code { get => Code; set => Code = value!; } - IEnumerable ICoded.ToCodings() => Code?.ToCodings() ?? []; + IReadOnlyCollection ICoded.ToCodings() => Code?.ToCodings() ?? []; protected internal override void CopyToInternal(Base other) { @@ -1214,7 +1217,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1245,7 +1249,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Output, otherT._Output)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs index cfe5e76e1..3d7d5fea3 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TerminologyCapabilities.cs @@ -179,9 +179,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -322,9 +323,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -480,10 +482,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.ListEquals(_Version, otherT._Version)) return false; if(!comparer.Equals(_SubsumptionElement, otherT._SubsumptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -741,13 +744,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_IsDefaultElement, otherT._IsDefaultElement)) return false; if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; if(!comparer.ListEquals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -917,9 +921,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_OpElement, otherT._OpElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1129,12 +1134,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; if(!comparer.Equals(_PagingElement, otherT._PagingElement)) return false; if(!comparer.Equals(_IncompleteElement, otherT._IncompleteElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.Equals(_TextFilterElement, otherT._TextFilterElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1293,9 +1299,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1404,8 +1411,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValidateCodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1507,8 +1515,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TranslationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1612,8 +1621,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClosureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2232,7 +2242,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TerminologyCapabilities otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -2256,7 +2267,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ValidateCode, otherT._ValidateCode)) return false; if(!comparer.Equals(_Translation, otherT._Translation)) return false; if(!comparer.Equals(_Closure, otherT._Closure)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs index b18b9490d..73fee602b 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TestReport.cs @@ -322,10 +322,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,8 +427,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -531,9 +533,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -705,10 +708,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -887,10 +891,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1049,10 +1054,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1170,9 +1176,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1269,8 +1276,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1361,8 +1369,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1692,7 +1701,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TestScript, otherT._TestScript)) return false; @@ -1704,7 +1714,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs index dfa64727b..bc9491bf2 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TestScript.cs @@ -377,9 +377,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -508,9 +509,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -622,9 +624,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Link, otherT._Link)) return false; if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -765,9 +768,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1064,14 +1068,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1264,10 +1269,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1590,7 +1596,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; @@ -1598,7 +1605,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1734,8 +1741,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1839,9 +1847,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2395,7 +2404,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -2412,7 +2422,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2660,9 +2670,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3395,7 +3406,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; @@ -3417,7 +3429,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ValidateProfileIdElement, otherT._ValidateProfileIdElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3709,10 +3721,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3830,9 +3843,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3929,8 +3943,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4021,8 +4036,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4601,7 +4617,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -4625,7 +4642,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs index 24479146e..be5b94d37 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/Timing.cs @@ -764,7 +764,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; @@ -779,7 +780,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -998,10 +999,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs index 1038a37e0..a94e29394 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/TriggerDefinition.cs @@ -248,12 +248,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.Equals(_Condition, otherT._Condition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs index 82377d121..c2aa104d9 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/VerificationResult.cs @@ -261,14 +261,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrimarySourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_CommunicationMethod, otherT._CommunicationMethod)) return false; if(!comparer.Equals(_ValidationStatus, otherT._ValidationStatus)) return false; if(!comparer.Equals(_ValidationDateElement, otherT._ValidationDateElement)) return false; if(!comparer.Equals(_CanPushUpdates, otherT._CanPushUpdates)) return false; if(!comparer.ListEquals(_PushTypeAvailable, otherT._PushTypeAvailable)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -544,7 +545,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttestationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_CommunicationMethod, otherT._CommunicationMethod)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -552,7 +554,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ProxyIdentityCertificateElement, otherT._ProxyIdentityCertificateElement)) return false; if(!comparer.Equals(_ProxySignature, otherT._ProxySignature)) return false; if(!comparer.Equals(_SourceSignature, otherT._SourceSignature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -733,10 +735,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValidatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Organization, otherT._Organization)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_IdentityCertificateElement, otherT._IdentityCertificateElement)) return false; if(!comparer.Equals(_AttestationSignature, otherT._AttestationSignature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1097,7 +1100,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VerificationResult otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_TargetLocationElement, otherT._TargetLocationElement)) return false; if(!comparer.Equals(_Need, otherT._Need)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1111,7 +1115,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PrimarySource, otherT._PrimarySource)) return false; if(!comparer.Equals(_Attestation, otherT._Attestation)) return false; if(!comparer.ListEquals(_Validator, otherT._Validator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs index dadfd1fe7..e587f7c73 100644 --- a/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R4/Model/Generated/VisionPrescription.cs @@ -507,7 +507,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LensSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Product, otherT._Product)) return false; if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; @@ -521,7 +522,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -749,9 +750,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -991,7 +993,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -999,7 +1002,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DateWrittenElement, otherT._DateWrittenElement)) return false; if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; if(!comparer.ListEquals(_LensSpecification, otherT._LensSpecification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Account.cs b/src/Hl7.Fhir.R4B/Model/Generated/Account.cs index 8ca31cd18..d817169f0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Account.cs @@ -186,9 +186,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -330,10 +331,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -621,7 +623,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -632,7 +635,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Guarantor, otherT._Guarantor)) return false; if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs index 6296413d4..a57f5333a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ActivityDefinition.cs @@ -245,9 +245,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -375,9 +376,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1471,7 +1473,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1517,7 +1520,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ObservationResultRequirement, otherT._ObservationResultRequirement)) return false; if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs index b037ca544..7a38f167d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Address.cs @@ -434,7 +434,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; @@ -444,7 +445,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs index 06a6030fc..1d089f67e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AdministrableProductDefinition.cs @@ -142,10 +142,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -335,14 +336,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RouteOfAdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FirstDose, otherT._FirstDose)) return false; if(!comparer.Equals(_MaxSingleDose, otherT._MaxSingleDose)) return false; if(!comparer.Equals(_MaxDosePerDay, otherT._MaxDosePerDay)) return false; if(!comparer.Equals(_MaxDosePerTreatmentPeriod, otherT._MaxDosePerTreatmentPeriod)) return false; if(!comparer.Equals(_MaxTreatmentPeriod, otherT._MaxTreatmentPeriod)) return false; if(!comparer.ListEquals(_TargetSpecies, otherT._TargetSpecies)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -487,9 +489,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetSpeciesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_WithdrawalPeriod, otherT._WithdrawalPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -628,10 +631,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not WithdrawalPeriodComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_SupportingInformationElement, otherT._SupportingInformationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -879,7 +883,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrableProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_FormOf, otherT._FormOf)) return false; if(!comparer.Equals(_AdministrableDoseForm, otherT._AdministrableDoseForm)) return false; @@ -889,7 +894,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Device, otherT._Device)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_RouteOfAdministration, otherT._RouteOfAdministration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs index d284d7976..eab223bfb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AdverseEvent.cs @@ -226,9 +226,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Causality, otherT._Causality)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -382,11 +383,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CausalityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Assessment, otherT._Assessment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Assessment, otherT._Assessment)) return false; if(!comparer.Equals(_ProductRelatednessElement, otherT._ProductRelatednessElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -842,7 +844,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActualityElement, otherT._ActualityElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Event, otherT._Event)) return false; @@ -862,7 +865,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SubjectMedicalHistory, otherT._SubjectMedicalHistory)) return false; if(!comparer.ListEquals(_ReferenceDocument, otherT._ReferenceDocument)) return false; if(!comparer.ListEquals(_Study, otherT._Study)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs index db0308bcf..811cf77c4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AllergyIntolerance.cs @@ -423,14 +423,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -859,7 +860,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; @@ -875,7 +877,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs index 2c4e403d7..c53f8b45d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Annotation.cs @@ -159,10 +159,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs index 283622637..986f678ea 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Appointment.cs @@ -302,12 +302,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -867,7 +868,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CancelationReason, otherT._CancelationReason)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; @@ -889,7 +891,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; if(!comparer.ListEquals(_RequestedPeriod, otherT._RequestedPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs index e4d1cd6dd..45537f8ab 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AppointmentResponse.cs @@ -264,7 +264,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; @@ -272,7 +273,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_ParticipantStatusElement, otherT._ParticipantStatusElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs index d489ea22e..2c54d5cd8 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/AuditEvent.cs @@ -444,7 +444,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_AltIdElement, otherT._AltIdElement)) return false; @@ -455,7 +456,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Media, otherT._Media)) return false; if(!comparer.Equals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_PurposeOfUse, otherT._PurposeOfUse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -660,9 +661,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NetworkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -807,10 +809,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; if(!comparer.Equals(_Observer, otherT._Observer)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1079,7 +1082,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_What, otherT._What)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_What, otherT._What)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Lifecycle, otherT._Lifecycle)) return false; @@ -1088,7 +1092,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1266,9 +1270,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1562,7 +1567,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; @@ -1573,7 +1579,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs b/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs index 6068c7f05..c3644d2fc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Basic.cs @@ -176,12 +176,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs index 2448f95d2..6e7acc7fe 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/BiologicallyDerivedProduct.cs @@ -235,10 +235,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Collector, otherT._Collector)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_Collected, otherT._Collected)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -403,11 +404,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.Equals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -548,9 +550,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManipulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -732,11 +735,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StorageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TemperatureElement, otherT._TemperatureElement)) return false; if(!comparer.Equals(_ScaleElement, otherT._ScaleElement)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1031,7 +1035,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BiologicallyDerivedProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ProductCategoryElement, otherT._ProductCategoryElement)) return false; if(!comparer.Equals(_ProductCode, otherT._ProductCode)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1042,7 +1047,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; if(!comparer.Equals(_Manipulation, otherT._Manipulation)) return false; if(!comparer.ListEquals(_Storage, otherT._Storage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs index 8521442b2..edb35047a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/BodyStructure.cs @@ -235,7 +235,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BodyStructure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Morphology, otherT._Morphology)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; @@ -243,7 +244,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Image, otherT._Image)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs index 3d32db805..503f96535 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CarePlan.cs @@ -332,12 +332,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -801,7 +802,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -818,7 +820,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DailyAmount, otherT._DailyAmount)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1468,7 +1470,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1491,7 +1494,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs index 128ca4470..43ac7ae27 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CareTeam.cs @@ -200,11 +200,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Member, otherT._Member)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -518,7 +519,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -531,7 +533,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs b/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs index 7eab917c4..43ea17e69 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CatalogEntry.cs @@ -169,9 +169,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationtypeElement, otherT._RelationtypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RelationtypeElement, otherT._RelationtypeElement)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -493,7 +494,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CatalogEntry otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OrderableElement, otherT._OrderableElement)) return false; if(!comparer.Equals(_ReferencedItem, otherT._ReferencedItem)) return false; @@ -506,7 +508,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_AdditionalCharacteristic, otherT._AdditionalCharacteristic)) return false; if(!comparer.ListEquals(_AdditionalClassification, otherT._AdditionalClassification)) return false; if(!comparer.ListEquals(_RelatedEntry, otherT._RelatedEntry)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs index 9b2ff12df..5a4ddd1c2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItem.cs @@ -182,9 +182,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -757,7 +758,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_DefinitionUriElement, otherT._DefinitionUriElement)) return false; if(!comparer.ListEquals(_DefinitionCanonicalElement, otherT._DefinitionCanonicalElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -783,7 +785,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Account, otherT._Account)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs index b23308254..6c63f67a3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ChargeItemDefinition.cs @@ -186,10 +186,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ApplicabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -308,9 +309,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -481,11 +483,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1126,7 +1129,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -1149,7 +1153,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_PropertyGroup, otherT._PropertyGroup)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs index 0662d59d6..bd63d9194 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Citation.cs @@ -140,9 +140,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Style, otherT._Style)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Style, otherT._Style)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -252,9 +253,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -393,10 +395,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Activity, otherT._Activity)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -532,10 +535,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; if(!comparer.ListEquals(_TargetClassifier, otherT._TargetClassifier)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -858,7 +862,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_RelatedIdentifier, otherT._RelatedIdentifier)) return false; if(!comparer.Equals(_DateAccessedElement, otherT._DateAccessedElement)) return false; if(!comparer.Equals(_Version, otherT._Version)) return false; @@ -873,7 +878,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; if(!comparer.Equals(_Contributorship, otherT._Contributorship)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1089,9 +1094,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactVersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1230,10 +1236,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactStatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Activity, otherT._Activity)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1380,10 +1387,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactTitleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1558,11 +1566,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactAbstractComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1715,10 +1724,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1854,10 +1864,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactRelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; if(!comparer.ListEquals(_TargetClassifier, otherT._TargetClassifier)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2222,7 +2233,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPublicationFormComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PublishedIn, otherT._PublishedIn)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PublishedIn, otherT._PublishedIn)) return false; if(!comparer.Equals(_PeriodicRelease, otherT._PeriodicRelease)) return false; if(!comparer.Equals(_ArticleDateElement, otherT._ArticleDateElement)) return false; if(!comparer.Equals(_LastRevisionDateElement, otherT._LastRevisionDateElement)) return false; @@ -2233,7 +2245,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_LastPageElement, otherT._LastPageElement)) return false; if(!comparer.Equals(_PageCountElement, otherT._PageCountElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2479,12 +2491,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPublicationFormPublishedInComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; if(!comparer.Equals(_PublisherLocationElement, otherT._PublisherLocationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2671,11 +2684,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPublicationFormPeriodicReleaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CitedMedium, otherT._CitedMedium)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CitedMedium, otherT._CitedMedium)) return false; if(!comparer.Equals(_VolumeElement, otherT._VolumeElement)) return false; if(!comparer.Equals(_IssueElement, otherT._IssueElement)) return false; if(!comparer.Equals(_DateOfPublication, otherT._DateOfPublication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2942,13 +2956,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPublicationFormPeriodicReleaseDateOfPublicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_YearElement, otherT._YearElement)) return false; if(!comparer.Equals(_MonthElement, otherT._MonthElement)) return false; if(!comparer.Equals(_DayElement, otherT._DayElement)) return false; if(!comparer.Equals(_SeasonElement, otherT._SeasonElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3099,9 +3114,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactWebLocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3225,10 +3241,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; if(!comparer.Equals(_WhoClassified, otherT._WhoClassified)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3420,12 +3437,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactClassificationWhoClassifiedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Person, otherT._Person)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Person, otherT._Person)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; if(!comparer.Equals(_ClassifierCopyrightElement, otherT._ClassifierCopyrightElement)) return false; if(!comparer.Equals(_FreeToShareElement, otherT._FreeToShareElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3587,10 +3605,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactContributorshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CompleteElement, otherT._CompleteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CompleteElement, otherT._CompleteElement)) return false; if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.ListEquals(_Summary, otherT._Summary)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3916,7 +3935,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactContributorshipEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Name, otherT._Name)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.Equals(_InitialsElement, otherT._InitialsElement)) return false; if(!comparer.Equals(_CollectiveNameElement, otherT._CollectiveNameElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; @@ -3928,7 +3948,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ContributionInstance, otherT._ContributionInstance)) return false; if(!comparer.Equals(_CorrespondingContactElement, otherT._CorrespondingContactElement)) return false; if(!comparer.Equals(_ListOrderElement, otherT._ListOrderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4153,10 +4173,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactContributorshipEntryAffiliationInfoComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AffiliationElement, otherT._AffiliationElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AffiliationElement, otherT._AffiliationElement)) return false; if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4287,9 +4308,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactContributorshipEntryContributionInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4443,11 +4465,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContributorshipSummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Style, otherT._Style)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5149,7 +5172,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Citation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -5178,7 +5202,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_StatusDate, otherT._StatusDate)) return false; if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; if(!comparer.Equals(_CitedArtifact, otherT._CitedArtifact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs index f5f61114c..5e4359a0e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Claim.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -270,9 +271,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -460,12 +462,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -678,13 +681,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -889,12 +893,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1108,12 +1113,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1386,14 +1392,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1572,10 +1579,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2089,7 +2097,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; @@ -2110,7 +2119,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2536,7 +2545,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -2548,7 +2558,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2896,7 +2906,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -2907,7 +2918,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3500,7 +3511,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; @@ -3527,7 +3539,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Accident, otherT._Accident)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Total, otherT._Total)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs index e2b8c9b51..96b1967ce 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClaimResponse.cs @@ -191,11 +191,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,11 +366,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -558,11 +560,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -736,10 +739,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1191,7 +1195,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_SubdetailSequenceElement, otherT._SubdetailSequenceElement)) return false; if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; @@ -1209,7 +1214,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1569,7 +1574,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -1578,7 +1584,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1860,7 +1866,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -1868,7 +1875,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2024,9 +2031,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2211,13 +2219,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2432,11 +2441,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2655,12 +2665,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2867,11 +2878,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3458,7 +3470,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; @@ -3485,7 +3498,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs index b9860a814..98f18403c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalImpression.cs @@ -159,9 +159,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InvestigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -303,10 +304,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemCodeableConcept, otherT._ItemCodeableConcept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemCodeableConcept, otherT._ItemCodeableConcept)) return false; if(!comparer.Equals(_ItemReference, otherT._ItemReference)) return false; if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -771,7 +773,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -791,7 +794,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs index 2a833a13c..a14de8bd5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ClinicalUseDefinition.cs @@ -210,12 +210,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContraindicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -350,9 +351,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; if(!comparer.Equals(_Therapy, otherT._Therapy)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -540,14 +542,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IndicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; if(!comparer.Equals(_IntendedEffect, otherT._IntendedEffect)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; if(!comparer.ListEquals(_UndesirableEffect, otherT._UndesirableEffect)) return false; if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -737,12 +740,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Effect, otherT._Effect)) return false; if(!comparer.Equals(_Incidence, otherT._Incidence)) return false; if(!comparer.ListEquals(_Management, otherT._Management)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -861,8 +865,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InteractantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -982,10 +987,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UndesirableEffectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; if(!comparer.Equals(_Classification, otherT._Classification)) return false; if(!comparer.Equals(_FrequencyOfOccurrence, otherT._FrequencyOfOccurrence)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1118,9 +1124,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not WarningComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1370,7 +1377,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClinicalUseDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; @@ -1381,7 +1389,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_UndesirableEffect, otherT._UndesirableEffect)) return false; if(!comparer.Equals(_Warning, otherT._Warning)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs index 8e5d86277..b19357d43 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Communication.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -638,7 +639,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -661,7 +663,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs index 69b1a7649..e7c469fe9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CommunicationRequest.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -586,7 +587,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; @@ -608,7 +610,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs index 2e1f49b66..7fbae28d4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CompartmentDefinition.cs @@ -193,10 +193,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -642,7 +643,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -656,7 +658,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs b/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs index 5ee4cfabd..211d9b311 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Composition.cs @@ -257,10 +257,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -400,9 +401,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -532,10 +534,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -808,7 +811,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Focus, otherT._Focus)) return false; @@ -818,7 +822,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1236,7 +1240,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1251,7 +1256,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs index 731e8eb12..7b8172d4e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ConceptMap.cs @@ -271,13 +271,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_SourceVersionElement, otherT._SourceVersionElement)) return false; if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; if(!comparer.Equals(_TargetVersionElement, otherT._TargetVersionElement)) return false; if(!comparer.ListEquals(_Element, otherT._Element)) return false; if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -461,10 +462,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -703,13 +705,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_EquivalenceElement, otherT._EquivalenceElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; if(!comparer.ListEquals(_Product, otherT._Product)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -937,11 +940,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1157,11 +1161,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1672,7 +1677,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1690,7 +1696,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs b/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs index 3267218c3..cf900ebe2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Condition.cs @@ -237,10 +237,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Summary, otherT._Summary)) return false; if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -363,9 +364,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -711,7 +713,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -728,7 +731,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Stage, otherT._Stage)) return false; if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs b/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs index f4cea6a8d..1d636bb71 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Consent.cs @@ -259,9 +259,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PolicyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -418,10 +419,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VerificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; if(!comparer.Equals(_VerifiedWith, otherT._VerifiedWith)) return false; if(!comparer.Equals(_VerificationDateElement, otherT._VerificationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -694,7 +696,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; @@ -705,7 +708,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -883,9 +886,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1016,9 +1020,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1320,7 +1325,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Scope, otherT._Scope)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1333,7 +1339,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PolicyRule, otherT._PolicyRule)) return false; if(!comparer.ListEquals(_Verification, otherT._Verification)) return false; if(!comparer.Equals(_Provision, otherT._Provision)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs index 4fa274f77..3d5c01c93 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Contract.cs @@ -435,13 +435,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -759,7 +760,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; if(!comparer.Equals(_Applies, otherT._Applies)) return false; if(!comparer.Equals(_Topic, otherT._Topic)) return false; @@ -771,7 +773,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Asset, otherT._Asset)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1004,11 +1006,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SecurityLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Classification, otherT._Classification)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Control, otherT._Control)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1306,7 +1309,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractOfferComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Party, otherT._Party)) return false; if(!comparer.Equals(_Topic, otherT._Topic)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -1316,7 +1320,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1484,9 +1488,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1583,8 +1588,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1950,7 +1956,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractAssetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Scope, otherT._Scope)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Scope, otherT._Scope)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_TypeReference, otherT._TypeReference)) return false; if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; @@ -1965,7 +1972,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2196,10 +2203,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssetContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2601,7 +2609,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; @@ -2615,7 +2624,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3250,7 +3259,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Intent, otherT._Intent)) return false; @@ -3271,7 +3281,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonLinkIdElement, otherT._ReasonLinkIdElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3515,9 +3525,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionSubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3649,10 +3660,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3759,8 +3771,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3853,8 +3866,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3947,8 +3961,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4653,7 +4668,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -4686,7 +4702,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; if(!comparer.Equals(_LegallyBinding, otherT._LegallyBinding)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs index 09e24bb1b..c874bc5af 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Contributor.cs @@ -193,10 +193,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs index 6d183ef37..2fd68cde5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Coverage.cs @@ -175,10 +175,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -315,10 +316,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostToBeneficiaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Exception, otherT._Exception)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -437,9 +439,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExemptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -856,7 +859,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PolicyHolder, otherT._PolicyHolder)) return false; @@ -873,7 +877,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CostToBeneficiary, otherT._CostToBeneficiary)) return false; if(!comparer.Equals(_SubrogationElement, otherT._SubrogationElement)) return false; if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs index 68f2bb16a..beefdf912 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityRequest.cs @@ -209,10 +209,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Information, otherT._Information)) return false; if(!comparer.Equals(_AppliesToAllElement, otherT._AppliesToAllElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -377,10 +378,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -640,7 +642,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; @@ -650,7 +653,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Facility, otherT._Facility)) return false; if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -806,8 +809,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1138,7 +1142,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageEligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; @@ -1152,7 +1157,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs index d48c058ed..f2637d953 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/CoverageEligibilityResponse.cs @@ -208,11 +208,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_InforceElement, otherT._InforceElement)) return false; if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,7 +592,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; @@ -605,7 +607,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AuthorizationRequiredElement, otherT._AuthorizationRequiredElement)) return false; if(!comparer.ListEquals(_AuthorizationSupporting, otherT._AuthorizationSupporting)) return false; if(!comparer.Equals(_AuthorizationUrlElement, otherT._AuthorizationUrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -819,10 +821,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -927,8 +930,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1319,7 +1323,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageEligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -1334,7 +1339,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs index d4297dd60..d15236e4a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DataRequirement.cs @@ -222,11 +222,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -396,10 +397,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -551,9 +553,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SortComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -809,7 +812,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; @@ -817,7 +821,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_DateFilter, otherT._DateFilter)) return false; if(!comparer.Equals(_LimitElement, otherT._LimitElement)) return false; if(!comparer.ListEquals(_Sort, otherT._Sort)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs index 52da3615f..5d3307dc6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DetectedIssue.cs @@ -159,9 +159,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -304,10 +305,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -628,7 +630,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; @@ -640,7 +643,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Device.cs b/src/Hl7.Fhir.R4B/Model/Generated/Device.cs index 9b6dc2604..741cb4310 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Device.cs @@ -355,13 +355,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiCarrierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -533,9 +534,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -658,9 +660,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemType, otherT._SystemType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemType, otherT._SystemType)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -797,10 +800,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Component, otherT._Component)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -931,10 +935,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1547,7 +1552,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_UdiCarrier, otherT._UdiCarrier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1573,7 +1579,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; if(!comparer.Equals(_Parent, otherT._Parent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs index 8b66a8bde..e0c62132c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceDefinition.cs @@ -189,10 +189,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiDeviceIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -340,9 +341,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -480,9 +482,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecializationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemTypeElement, otherT._SystemTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemTypeElement, otherT._SystemTypeElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,9 +594,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Description, otherT._Description)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -717,10 +721,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; if(!comparer.ListEquals(_ValueCode, otherT._ValueCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -879,10 +884,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.Equals(_AlternateElement, otherT._AlternateElement)) return false; if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1350,7 +1356,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.ListEquals(_DeviceName, otherT._DeviceName)) return false; @@ -1372,7 +1379,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_ParentDevice, otherT._ParentDevice)) return false; if(!comparer.ListEquals(_Material, otherT._Material)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs index 6f1ad3962..66eaae4d2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceMetric.cs @@ -381,10 +381,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -660,7 +661,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; @@ -670,7 +672,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_MeasurementPeriod, otherT._MeasurementPeriod)) return false; if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs index 3b97d2fb8..00de983f6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceRequest.cs @@ -129,9 +129,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -680,7 +681,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -704,7 +706,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs index 96b2a5fb6..53ff1e530 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DeviceUseStatement.cs @@ -368,7 +368,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceUseStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -381,7 +382,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs index e341d9463..60b037cd6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DiagnosticReport.cs @@ -215,9 +215,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MediaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -618,7 +619,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -636,7 +638,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; if(!comparer.ListEquals(_ConclusionCode, otherT._ConclusionCode)) return false; if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs index 2c052fd1e..e281c14ea 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DocumentManifest.cs @@ -129,9 +129,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Ref, otherT._Ref)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -444,7 +445,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -456,7 +458,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Related, otherT._Related)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs index 6bb84fcd9..9e497e85a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/DocumentReference.cs @@ -149,9 +149,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -263,9 +264,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; if(!comparer.Equals(_Format, otherT._Format)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -458,14 +460,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_FacilityType, otherT._FacilityType)) return false; if(!comparer.Equals(_PracticeSetting, otherT._PracticeSetting)) return false; if(!comparer.Equals(_SourcePatientInfo, otherT._SourcePatientInfo)) return false; if(!comparer.ListEquals(_Related, otherT._Related)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -874,7 +877,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_DocStatusElement, otherT._DocStatusElement)) return false; @@ -890,7 +894,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.Equals(_Context, otherT._Context)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs index 5c395d0c9..090457183 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Dosage.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DoseAndRateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Dose, otherT._Dose)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -457,7 +458,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; @@ -470,7 +472,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MaxDosePerPeriod, otherT._MaxDosePerPeriod)) return false; if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs index 604ac19cf..f8677762b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Encounter.cs @@ -246,9 +246,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -361,9 +362,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -491,10 +493,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Individual, otherT._Individual)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -641,10 +644,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -873,7 +877,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HospitalizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; @@ -882,7 +887,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SpecialArrangement, otherT._SpecialArrangement)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1091,11 +1096,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Location, otherT._Location)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_PhysicalType, otherT._PhysicalType)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1552,7 +1558,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; @@ -1575,7 +1582,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Location, otherT._Location)) return false; if(!comparer.Equals(_ServiceProvider, otherT._ServiceProvider)) return false; if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs index bbb48db69..6639d8c13 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Endpoint.cs @@ -380,7 +380,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ConnectionType, otherT._ConnectionType)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -391,7 +392,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PayloadMimeTypeElement, otherT._PayloadMimeTypeElement)) return false; if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs index cc58bfa8c..6f1f57f76 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentRequest.cs @@ -223,14 +223,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_Candidate, otherT._Candidate)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs index 2ed949e32..4a90774b5 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EnrollmentResponse.cs @@ -267,7 +267,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; @@ -275,7 +276,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs index c07b7e760..1e4b2cd4d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EpisodeOfCare.cs @@ -197,9 +197,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -339,10 +340,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -624,7 +626,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; @@ -636,7 +639,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; if(!comparer.ListEquals(_Team, otherT._Team)) return false; if(!comparer.ListEquals(_Account, otherT._Account)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs index aac5f7e85..c3a65fad1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EventDefinition.cs @@ -721,7 +721,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -749,7 +750,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs index bc5bb94b9..e629af522 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Evidence.cs @@ -202,13 +202,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_VariableRole, otherT._VariableRole)) return false; if(!comparer.Equals(_Observed, otherT._Observed)) return false; if(!comparer.Equals(_Intended, otherT._Intended)) return false; if(!comparer.Equals(_DirectnessMatch, otherT._DirectnessMatch)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -504,7 +505,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatisticComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_StatisticType, otherT._StatisticType)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -514,7 +516,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SampleSize, otherT._SampleSize)) return false; if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; if(!comparer.ListEquals(_ModelCharacteristic, otherT._ModelCharacteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -780,12 +782,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; if(!comparer.Equals(_KnownDataCountElement, otherT._KnownDataCountElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1019,14 +1022,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttributeEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; if(!comparer.Equals(_Range, otherT._Range)) return false; if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1203,11 +1207,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ModelCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1393,12 +1398,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariableDefinition, otherT._VariableDefinition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VariableDefinition, otherT._VariableDefinition)) return false; if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; if(!comparer.ListEquals(_ValueCategory, otherT._ValueCategory)) return false; if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; if(!comparer.ListEquals(_ValueRange, otherT._ValueRange)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1619,13 +1625,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Rating, otherT._Rating)) return false; if(!comparer.Equals(_RaterElement, otherT._RaterElement)) return false; if(!comparer.ListEquals(_Subcomponent, otherT._Subcomponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2241,7 +2248,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Evidence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -2266,7 +2274,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StudyType, otherT._StudyType)) return false; if(!comparer.ListEquals(_Statistic, otherT._Statistic)) return false; if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs index d561e75d6..335fbecfc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceReport.cs @@ -187,9 +187,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -345,11 +346,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -496,9 +498,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -795,7 +798,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Focus, otherT._Focus)) return false; if(!comparer.Equals(_FocusReference, otherT._FocusReference)) return false; if(!comparer.ListEquals(_Author, otherT._Author)) return false; @@ -807,7 +811,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_EntryQuantity, otherT._EntryQuantity)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1262,7 +1266,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; @@ -1280,7 +1285,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs index d7efea574..cf0f6829f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/EvidenceVariable.cs @@ -274,14 +274,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Device, otherT._Device)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_TimeFromStart, otherT._TimeFromStart)) return false; if(!comparer.Equals(_GroupMeasureElement, otherT._GroupMeasureElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -470,11 +471,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TimeFromStartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Range, otherT._Range)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -615,9 +617,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CategoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1234,7 +1237,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceVariable otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1258,7 +1262,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs index adb39824c..7f18ff2a6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExampleScenario.cs @@ -234,11 +234,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -481,13 +482,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; if(!comparer.Equals(_ResourceTypeElement, otherT._ResourceTypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Version, otherT._Version)) return false; if(!comparer.ListEquals(_ContainedInstance, otherT._ContainedInstance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -654,9 +656,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -797,9 +800,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainedInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResourceIdElement, otherT._ResourceIdElement)) return false; if(!comparer.Equals(_VersionIdElement, otherT._VersionIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1010,12 +1014,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_PreConditionsElement, otherT._PreConditionsElement)) return false; if(!comparer.Equals(_PostConditionsElement, otherT._PostConditionsElement)) return false; if(!comparer.ListEquals(_Step, otherT._Step)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1188,11 +1193,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StepComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Process, otherT._Process)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Process, otherT._Process)) return false; if(!comparer.Equals(_PauseElement, otherT._PauseElement)) return false; if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_Alternative, otherT._Alternative)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1546,7 +1552,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_InitiatorElement, otherT._InitiatorElement)) return false; @@ -1556,7 +1563,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReceiverActiveElement, otherT._ReceiverActiveElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1768,10 +1775,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AlternativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Step, otherT._Step)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2249,7 +2257,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExampleScenario otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2266,7 +2275,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Process, otherT._Process)) return false; if(!comparer.ListEquals(_WorkflowElement, otherT._WorkflowElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs index 4cf0e900e..0dc52d878 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ExplanationOfBenefit.cs @@ -178,10 +178,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -302,9 +303,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -492,12 +494,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -710,13 +713,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -921,12 +925,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1140,12 +1145,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1329,10 +1335,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1482,10 +1489,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2047,7 +2055,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; @@ -2070,7 +2079,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2373,11 +2382,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2732,7 +2742,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -2746,7 +2757,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3156,7 +3167,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; @@ -3169,7 +3181,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3691,7 +3703,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.ListEquals(_Provider, otherT._Provider)) return false; @@ -3709,7 +3722,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4069,7 +4082,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -4078,7 +4092,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4360,7 +4374,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_UnitPrice, otherT._UnitPrice)) return false; @@ -4368,7 +4383,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4524,9 +4539,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4709,13 +4725,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4929,11 +4946,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5189,7 +5207,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -5197,7 +5216,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Term, otherT._Term)) return false; if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5369,10 +5388,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -6212,7 +6232,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; @@ -6255,7 +6276,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs b/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs index 2973c3874..ffe0a8dac 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Expression.cs @@ -229,12 +229,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Expression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs index 6a231d056..72e4e573f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/FamilyMemberHistory.cs @@ -223,12 +223,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; if(!comparer.Equals(_Onset, otherT._Onset)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -691,7 +692,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -709,7 +711,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs b/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs index 7eef31be6..59a961072 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Flag.cs @@ -254,7 +254,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -262,7 +263,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs b/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs index 16c6901a8..6efe00836 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Goal.cs @@ -212,10 +212,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -587,7 +588,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_LifecycleStatusElement, otherT._LifecycleStatusElement)) return false; if(!comparer.Equals(_AchievementStatus, otherT._AchievementStatus)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -603,7 +605,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_OutcomeCode, otherT._OutcomeCode)) return false; if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs index 5c06a754c..0f8b43059 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/GraphDefinition.cs @@ -311,13 +311,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -544,12 +545,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -803,12 +805,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1282,7 +1285,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1297,7 +1301,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Group.cs b/src/Hl7.Fhir.R4B/Model/Generated/Group.cs index 6cea2e5dd..2bc782527 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Group.cs @@ -224,11 +224,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -384,10 +385,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -687,7 +689,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; @@ -697,7 +700,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ManagingEntity, otherT._ManagingEntity)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_Member, otherT._Member)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs index 0b27cc7b4..727557381 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/GuidanceResponse.cs @@ -396,7 +396,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Module, otherT._Module)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -411,7 +412,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; if(!comparer.Equals(_Result, otherT._Result)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs index 3bd5ef502..f9548d728 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HealthcareService.cs @@ -139,9 +139,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -346,11 +347,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -490,9 +492,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_During, otherT._During)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1018,7 +1021,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1042,7 +1046,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs index 11a8d08a8..bdb1382a2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/HumanName.cs @@ -337,14 +337,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs index b62f23bf9..e4195dc5f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImagingStudy.cs @@ -394,7 +394,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Modality, otherT._Modality)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -406,7 +407,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,9 +592,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -779,11 +781,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1255,7 +1258,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Modality, otherT._Modality)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -1275,7 +1279,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Series, otherT._Series)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs index 171514479..8df0fdea0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Immunization.cs @@ -158,9 +158,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -358,11 +359,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EducationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DocumentTypeElement, otherT._DocumentTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DocumentTypeElement, otherT._DocumentTypeElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; if(!comparer.Equals(_PresentationDateElement, otherT._PresentationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -533,10 +535,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -719,12 +722,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProtocolAppliedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1332,7 +1336,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; @@ -1360,7 +1365,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FundingSource, otherT._FundingSource)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; if(!comparer.ListEquals(_ProtocolApplied, otherT._ProtocolApplied)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs index b2d60d42e..127c1328a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationEvaluation.cs @@ -370,7 +370,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImmunizationEvaluation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -383,7 +384,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; if(!comparer.Equals(_DoseNumber, otherT._DoseNumber)) return false; if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs index 32090ac4b..36b622c36 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImmunizationRecommendation.cs @@ -313,7 +313,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.ListEquals(_ContraindicatedVaccineCode, otherT._ContraindicatedVaccineCode)) return false; if(!comparer.Equals(_ForecastStatus, otherT._ForecastStatus)) return false; @@ -325,7 +326,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SeriesDoses, otherT._SeriesDoses)) return false; if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -523,9 +524,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -686,12 +688,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs index a5a840528..b914e4cc3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ImplementationGuide.cs @@ -2376,10 +2376,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependsOnComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2531,9 +2532,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2690,12 +2692,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; if(!comparer.Equals(_Page, otherT._Page)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Template, otherT._Template)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2858,9 +2861,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3097,13 +3101,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Example, otherT._Example)) return false; if(!comparer.Equals(_GroupingIdElement, otherT._GroupingIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3309,11 +3314,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Name, otherT._Name)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_GenerationElement, otherT._GenerationElement)) return false; if(!comparer.ListEquals(_Page, otherT._Page)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3468,9 +3474,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3638,10 +3645,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3855,12 +3863,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Page, otherT._Page)) return false; if(!comparer.ListEquals(_ImageElement, otherT._ImageElement)) return false; if(!comparer.ListEquals(_OtherElement, otherT._OtherElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4025,10 +4034,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Example, otherT._Example)) return false; if(!comparer.Equals(_RelativePathElement, otherT._RelativePathElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4209,10 +4219,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestPageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.ListEquals(_AnchorElement, otherT._AnchorElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4780,7 +4791,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -4800,7 +4812,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Global, otherT._Global)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_Manifest, otherT._Manifest)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs b/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs index 15145a925..caef0d774 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Ingredient.cs @@ -171,9 +171,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManufacturerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -283,9 +284,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -517,14 +519,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; if(!comparer.Equals(_TextPresentationElement, otherT._TextPresentationElement)) return false; if(!comparer.Equals(_Concentration, otherT._Concentration)) return false; if(!comparer.Equals(_TextConcentrationElement, otherT._TextConcentrationElement)) return false; if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; if(!comparer.ListEquals(_Country, otherT._Country)) return false; if(!comparer.ListEquals(_ReferenceStrength, otherT._ReferenceStrength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -718,11 +721,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceStrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; if(!comparer.ListEquals(_Country, otherT._Country)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -958,7 +962,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Ingredient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_For, otherT._For)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; @@ -966,7 +971,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.Equals(_Substance, otherT._Substance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs index c0fe6c2ef..8ef0f685d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/InsurancePlan.cs @@ -182,11 +182,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -329,10 +330,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -480,10 +482,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -600,9 +603,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LimitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -777,13 +781,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_GeneralCost, otherT._GeneralCost)) return false; if(!comparer.ListEquals(_SpecificCost, otherT._SpecificCost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -979,11 +984,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GeneralCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_GroupSizeElement, otherT._GroupSizeElement)) return false; if(!comparer.Equals(_Cost, otherT._Cost)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1109,9 +1115,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecificCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1223,9 +1230,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1366,11 +1374,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_Qualifiers, otherT._Qualifiers)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1718,7 +1727,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsurancePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1732,7 +1742,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs index 77c5cab15..fa415710f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Invoice.cs @@ -169,9 +169,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -315,10 +316,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LineItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_ChargeItem, otherT._ChargeItem)) return false; if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -496,11 +498,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PriceComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -882,7 +885,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Invoice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CancelledReasonElement, otherT._CancelledReasonElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -898,7 +902,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TotalGross, otherT._TotalGross)) return false; if(!comparer.Equals(_PaymentTermsElement, otherT._PaymentTermsElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Library.cs b/src/Hl7.Fhir.R4B/Model/Generated/Library.cs index 1e7f9c4ca..4ed50285d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Library.cs @@ -767,7 +767,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -798,7 +799,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs index 17ed20db6..51fbba87f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Linkage.cs @@ -175,9 +175,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -303,10 +304,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/List.cs b/src/Hl7.Fhir.R4B/Model/Generated/List.cs index b73612129..5f80cd01b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/List.cs @@ -214,11 +214,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Flag, otherT._Flag)) return false; if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -560,7 +561,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -573,7 +575,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs index 92374286c..e91527c3e 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Location.cs @@ -237,10 +237,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -452,11 +453,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HoursOfOperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_OpeningTimeElement, otherT._OpeningTimeElement)) return false; if(!comparer.Equals(_ClosingTimeElement, otherT._ClosingTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -888,7 +890,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -905,7 +908,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HoursOfOperation, otherT._HoursOfOperation)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs index 7729f0106..6887158a3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ManufacturedItemDefinition.cs @@ -124,9 +124,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -320,14 +321,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManufacturedItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ManufacturedDoseForm, otherT._ManufacturedDoseForm)) return false; if(!comparer.Equals(_UnitOfPresentation, otherT._UnitOfPresentation)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs b/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs index 1cc1fc383..71f253ee0 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MarketingStatus.cs @@ -165,12 +165,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MarketingStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Country, otherT._Country)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_DateRange, otherT._DateRange)) return false; if(!comparer.Equals(_RestoreDateElement, otherT._RestoreDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs index bb4019dc4..60302f185 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Measure.cs @@ -172,11 +172,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -331,10 +332,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -496,11 +498,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -656,10 +659,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -824,11 +828,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1863,7 +1868,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1904,7 +1910,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_GuidanceElement, otherT._GuidanceElement)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs index 1fbd0f3b8..a69e90de2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MeasureReport.cs @@ -219,11 +219,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -379,10 +380,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -502,9 +504,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -645,11 +648,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -777,9 +781,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -921,10 +926,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1231,7 +1237,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_MeasureElement, otherT._MeasureElement)) return false; @@ -1242,7 +1249,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ImprovementNotation, otherT._ImprovementNotation)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.ListEquals(_EvaluatedResource, otherT._EvaluatedResource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Media.cs b/src/Hl7.Fhir.R4B/Model/Generated/Media.cs index ea48d8794..2c964b843 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Media.cs @@ -522,7 +522,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Media otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -544,7 +545,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; if(!comparer.Equals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs b/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs index 4bd3a1ac8..4418cd4ec 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Medication.cs @@ -188,10 +188,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -338,9 +339,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -543,7 +545,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; @@ -551,7 +554,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.Equals(_Batch, otherT._Batch)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs index 016d455a6..3bcefe908 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationAdministration.cs @@ -182,9 +182,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -370,13 +371,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Site, otherT._Site)) return false; if(!comparer.Equals(_Route, otherT._Route)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Dose, otherT._Dose)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -813,7 +815,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -832,7 +835,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs index 6981a28cc..dd3642a29 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationDispense.cs @@ -194,9 +194,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -356,11 +357,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_ResponsibleParty, otherT._ResponsibleParty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -867,7 +869,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; @@ -891,7 +894,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs index cde2403ee..cea492adb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationKnowledge.cs @@ -158,9 +158,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedMedicationKnowledgeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -269,9 +270,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonographComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -414,10 +416,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -565,10 +568,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_Cost, otherT._Cost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -700,9 +704,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonitoringProgramComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -831,10 +836,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrationGuidelinesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; if(!comparer.Equals(_Indication, otherT._Indication)) return false; if(!comparer.ListEquals(_PatientCharacteristics, otherT._PatientCharacteristics)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -950,9 +956,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1084,9 +1091,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PatientCharacteristicsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Characteristic, otherT._Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1195,9 +1203,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicineClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1308,9 +1317,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1423,9 +1433,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DrugCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1565,11 +1576,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RegulatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; if(!comparer.ListEquals(_Substitution, otherT._Substitution)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_MaxDispense, otherT._MaxDispense)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1707,9 +1719,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1803,8 +1816,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1905,9 +1919,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MaxDispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2030,10 +2045,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not KineticsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_AreaUnderCurve, otherT._AreaUnderCurve)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_AreaUnderCurve, otherT._AreaUnderCurve)) return false; if(!comparer.ListEquals(_LethalDose50, otherT._LethalDose50)) return false; if(!comparer.Equals(_HalfLifePeriod, otherT._HalfLifePeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2488,7 +2504,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationKnowledge otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.Equals(_DoseForm, otherT._DoseForm)) return false; @@ -2510,7 +2527,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Contraindication, otherT._Contraindication)) return false; if(!comparer.ListEquals(_Regulatory, otherT._Regulatory)) return false; if(!comparer.ListEquals(_Kinetics, otherT._Kinetics)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs index 0885291f9..894dcd2e3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationRequest.cs @@ -329,14 +329,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; if(!comparer.Equals(_DispenseInterval, otherT._DispenseInterval)) return false; if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_ExpectedSupplyDuration, otherT._ExpectedSupplyDuration)) return false; if(!comparer.Equals(_Performer, otherT._Performer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -482,9 +483,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InitialFillComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -599,9 +601,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1287,7 +1290,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; if(!comparer.Equals(_IntentElement, otherT._IntentElement)) return false; @@ -1319,7 +1323,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs index e3ada5c76..7fc2b124d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicationStatement.cs @@ -458,7 +458,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -475,7 +476,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs index 380493bd7..d4497df29 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MedicinalProductDefinition.cs @@ -127,9 +127,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Contact, otherT._Contact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -283,11 +284,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_NamePart, otherT._NamePart)) return false; if(!comparer.ListEquals(_CountryLanguage, otherT._CountryLanguage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,9 +428,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NamePartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -557,10 +560,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CountryLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Country, otherT._Country)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -679,9 +683,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CrossReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Product, otherT._Product)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -823,11 +828,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_EffectiveDate, otherT._EffectiveDate)) return false; if(!comparer.ListEquals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_ConfidentialityIndicator, otherT._ConfidentialityIndicator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -955,9 +961,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1514,7 +1521,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Domain, otherT._Domain)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; @@ -1542,7 +1550,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CrossReference, otherT._CrossReference)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs index 126e4143d..bd8b2149c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MessageDefinition.cs @@ -247,11 +247,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -407,9 +408,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1099,7 +1101,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1123,7 +1126,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; if(!comparer.ListEquals(_GraphElement, otherT._GraphElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs index 58f0d88c0..17b6231d6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MessageHeader.cs @@ -218,11 +218,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -449,12 +450,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_Contact, otherT._Contact)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -635,10 +637,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Details, otherT._Details)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -898,7 +901,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_Sender, otherT._Sender)) return false; if(!comparer.Equals(_Enterer, otherT._Enterer)) return false; @@ -909,7 +913,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Response, otherT._Response)) return false; if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs index aec731b96..0c55c37ff 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/MolecularSequence.cs @@ -462,7 +462,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceSeqComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; if(!comparer.Equals(_GenomeBuildElement, otherT._GenomeBuildElement)) return false; if(!comparer.Equals(_OrientationElement, otherT._OrientationElement)) return false; if(!comparer.Equals(_ReferenceSeqId, otherT._ReferenceSeqId)) return false; @@ -471,7 +472,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -763,13 +764,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_ObservedAlleleElement, otherT._ObservedAlleleElement)) return false; if(!comparer.Equals(_ReferenceAlleleElement, otherT._ReferenceAlleleElement)) return false; if(!comparer.Equals(_CigarElement, otherT._CigarElement)) return false; if(!comparer.Equals(_VariantPointer, otherT._VariantPointer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1259,7 +1261,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_StandardSequence, otherT._StandardSequence)) return false; if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; @@ -1274,7 +1277,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; if(!comparer.Equals(_FScoreElement, otherT._FScoreElement)) return false; if(!comparer.Equals(_Roc, otherT._Roc)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1678,14 +1681,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RocComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ScoreElement, otherT._ScoreElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ScoreElement, otherT._ScoreElement)) return false; if(!comparer.ListEquals(_NumTPElement, otherT._NumTPElement)) return false; if(!comparer.ListEquals(_NumFPElement, otherT._NumFPElement)) return false; if(!comparer.ListEquals(_NumFNElement, otherT._NumFNElement)) return false; if(!comparer.ListEquals(_PrecisionElement, otherT._PrecisionElement)) return false; if(!comparer.ListEquals(_SensitivityElement, otherT._SensitivityElement)) return false; if(!comparer.ListEquals(_FMeasureElement, otherT._FMeasureElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1979,13 +1983,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepositoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DatasetIdElement, otherT._DatasetIdElement)) return false; if(!comparer.Equals(_VariantsetIdElement, otherT._VariantsetIdElement)) return false; if(!comparer.Equals(_ReadsetIdElement, otherT._ReadsetIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2196,12 +2201,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureVariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariantType, otherT._VariantType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VariantType, otherT._VariantType)) return false; if(!comparer.Equals(_ExactElement, otherT._ExactElement)) return false; if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; if(!comparer.Equals(_Outer, otherT._Outer)) return false; if(!comparer.Equals(_Inner, otherT._Inner)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2359,9 +2365,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OuterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2498,9 +2505,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InnerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2871,7 +2879,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MolecularSequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_CoordinateSystemElement, otherT._CoordinateSystemElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -2887,7 +2896,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Repository, otherT._Repository)) return false; if(!comparer.ListEquals(_Pointer, otherT._Pointer)) return false; if(!comparer.ListEquals(_StructureVariant, otherT._StructureVariant)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Money.cs b/src/Hl7.Fhir.R4B/Model/Generated/Money.cs index d9889510f..759a579ab 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Money.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Money.cs @@ -1241,9 +1241,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Money otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_CurrencyElement, otherT._CurrencyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs index 0fa799cb7..39308d33c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NamingSystem.cs @@ -295,12 +295,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -703,7 +704,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -716,7 +718,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs index e183c12da..0df6e23c2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NutritionOrder.cs @@ -205,13 +205,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -350,9 +351,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -464,9 +466,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -650,12 +653,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -933,7 +937,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; if(!comparer.Equals(_AdditiveType, otherT._AdditiveType)) return false; if(!comparer.Equals(_AdditiveProductNameElement, otherT._AdditiveProductNameElement)) return false; @@ -942,7 +947,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1118,10 +1123,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1560,7 +1566,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; @@ -1577,7 +1584,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs b/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs index da61f5992..8dbd51e09 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/NutritionProduct.cs @@ -156,9 +156,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -267,9 +268,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -381,9 +383,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProductCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -581,12 +584,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; if(!comparer.Equals(_UseByElement, otherT._UseByElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -843,7 +847,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutritionProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; @@ -853,7 +858,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ProductCharacteristic, otherT._ProductCharacteristic)) return false; if(!comparer.Equals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs b/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs index 37ea92f9b..b98963de4 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Observation.cs @@ -202,13 +202,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Low, otherT._Low)) return false; if(!comparer.Equals(_High, otherT._High)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -397,12 +398,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -903,7 +905,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -927,7 +930,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs index 2f1152383..8b515270b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ObservationDefinition.cs @@ -291,11 +291,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QuantitativeDetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CustomaryUnit, otherT._CustomaryUnit)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CustomaryUnit, otherT._CustomaryUnit)) return false; if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_ConversionFactorElement, otherT._ConversionFactorElement)) return false; if(!comparer.Equals(_DecimalPrecisionElement, otherT._DecimalPrecisionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -555,7 +556,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualifiedIntervalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_Range, otherT._Range)) return false; if(!comparer.Equals(_Context, otherT._Context)) return false; if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; @@ -563,7 +565,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_GestationalAge, otherT._GestationalAge)) return false; if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -921,7 +923,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ObservationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_PermittedDataTypeElement, otherT._PermittedDataTypeElement)) return false; @@ -934,7 +937,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_NormalCodedValueSet, otherT._NormalCodedValueSet)) return false; if(!comparer.Equals(_AbnormalCodedValueSet, otherT._AbnormalCodedValueSet)) return false; if(!comparer.Equals(_CriticalCodedValueSet, otherT._CriticalCodedValueSet)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs index 7c16b3baf..96ee75a0b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/OperationDefinition.cs @@ -411,7 +411,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; @@ -422,7 +423,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Binding, otherT._Binding)) return false; if(!comparer.ListEquals(_ReferencedFrom, otherT._ReferencedFrom)) return false; if(!comparer.ListEquals(_Part, otherT._Part)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -629,9 +630,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -773,9 +775,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferencedFromComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -920,9 +923,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1690,7 +1694,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -1716,7 +1721,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OutputProfileElement, otherT._OutputProfileElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs index 51021522c..bb910047a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Organization.cs @@ -156,11 +156,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -442,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -452,7 +454,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs index eb5cf2aaa..0ff675904 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/OrganizationAffiliation.cs @@ -286,7 +286,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrganizationAffiliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; @@ -298,7 +299,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs index 724a8db47..98481e9ec 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PackagedProductDefinition.cs @@ -122,9 +122,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LegalStatusOfSupplyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -374,7 +375,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; if(!comparer.ListEquals(_Material, otherT._Material)) return false; @@ -384,7 +386,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_ContainedItem, otherT._ContainedItem)) return false; if(!comparer.ListEquals(_Package, otherT._Package)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -564,10 +566,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ShelfLifeStorageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -685,9 +688,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -795,9 +799,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1135,7 +1140,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagedProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_PackageFor, otherT._PackageFor)) return false; @@ -1149,7 +1155,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CopackagedIndicatorElement, otherT._CopackagedIndicatorElement)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.Equals(_Package, otherT._Package)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs index 1d6cfa626..cc45a9c3d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ParameterDefinition.cs @@ -291,14 +291,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs b/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs index 4886045be..7a1e738fa 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Patient.cs @@ -252,14 +252,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -421,9 +422,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -555,9 +557,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Other, otherT._Other)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -914,7 +917,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -930,7 +934,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs index 31bd2198c..26ebac924 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PaymentNotice.cs @@ -318,7 +318,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; @@ -330,7 +331,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs index 223ec7aa6..d19aa5d0f 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PaymentReconciliation.cs @@ -265,7 +265,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; @@ -275,7 +276,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; if(!comparer.Equals(_Payee, otherT._Payee)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -473,9 +474,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -846,7 +848,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; @@ -861,7 +864,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Person.cs b/src/Hl7.Fhir.R4B/Model/Generated/Person.cs index 430734c67..ab3a88cd9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Person.cs @@ -178,9 +178,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -442,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; @@ -452,7 +454,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs index 4fcaea32c..0850ee312 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PlanDefinition.cs @@ -205,14 +205,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Description, otherT._Description)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.Equals(_Start, otherT._Start)) return false; if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -374,10 +375,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1063,7 +1065,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; @@ -1090,7 +1093,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1394,9 +1397,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1557,10 +1561,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1696,9 +1701,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1824,9 +1830,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2594,7 +2601,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2625,7 +2633,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Population.cs b/src/Hl7.Fhir.R4B/Model/Generated/Population.cs index a215df90a..1e37fca41 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Population.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Population.cs @@ -140,11 +140,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Population otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Age, otherT._Age)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_Gender, otherT._Gender)) return false; if(!comparer.Equals(_Race, otherT._Race)) return false; if(!comparer.Equals(_PhysiologicalCondition, otherT._PhysiologicalCondition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs index a7181a1de..8a1a654a3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Practitioner.cs @@ -159,11 +159,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -440,7 +441,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -450,7 +452,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs index eefb65e5a..23fd8fb14 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/PractitionerRole.cs @@ -221,11 +221,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,9 +366,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_During, otherT._During)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -682,7 +684,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; @@ -696,7 +699,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs index 40e5d7866..55af14b4d 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Procedure.cs @@ -146,10 +146,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -270,9 +271,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -837,7 +839,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -865,7 +868,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; if(!comparer.ListEquals(_UsedReference, otherT._UsedReference)) return false; if(!comparer.ListEquals(_UsedCode, otherT._UsedCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs index 704426837..4995237ad 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ProdCharacteristic.cs @@ -287,7 +287,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProdCharacteristic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Height, otherT._Height)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Height, otherT._Height)) return false; if(!comparer.Equals(_Width, otherT._Width)) return false; if(!comparer.Equals(_Depth, otherT._Depth)) return false; if(!comparer.Equals(_Weight, otherT._Weight)) return false; @@ -298,7 +299,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ImprintElement, otherT._ImprintElement)) return false; if(!comparer.ListEquals(_Image, otherT._Image)) return false; if(!comparer.Equals(_Scoring, otherT._Scoring)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs index 53ffa0412..ece0d0504 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ProductShelfLife.cs @@ -138,11 +138,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProductShelfLife otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs index 3a6107892..ef27805f2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Provenance.cs @@ -204,11 +204,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,10 +366,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; if(!comparer.Equals(_What, otherT._What)) return false; if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -629,7 +631,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.Equals(_Occurred, otherT._Occurred)) return false; if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; @@ -639,7 +642,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs index b671725da..307d9d966 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Questionnaire.cs @@ -686,7 +686,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; @@ -702,7 +703,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_AnswerOption, otherT._AnswerOption)) return false; if(!comparer.ListEquals(_Initial, otherT._Initial)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -964,10 +965,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; if(!comparer.Equals(_Answer, otherT._Answer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1105,9 +1107,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerOptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_InitialSelectedElement, otherT._InitialSelectedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1209,8 +1212,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InitialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1825,7 +1829,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1847,7 +1852,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs index e6b1071a5..9aa7364b3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/QuestionnaireResponse.cs @@ -258,12 +258,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -400,9 +401,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -687,7 +689,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_QuestionnaireElement, otherT._QuestionnaireElement)) return false; @@ -698,7 +701,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs b/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs index e763e934a..7f9d5addb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Ratio.cs @@ -111,9 +111,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs b/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs index ac4c44cf8..6da9ed425 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RatioRange.cs @@ -125,10 +125,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RatioRange otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LowNumerator, otherT._LowNumerator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LowNumerator, otherT._LowNumerator)) return false; if(!comparer.Equals(_HighNumerator, otherT._HighNumerator)) return false; if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs b/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs index b3bc9ea19..6b0a7dadb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RegulatedAuthorization.cs @@ -173,12 +173,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_Date, otherT._Date)) return false; if(!comparer.ListEquals(_Application, otherT._Application)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -508,7 +509,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RegulatedAuthorization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -522,7 +524,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Holder, otherT._Holder)) return false; if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; if(!comparer.Equals(_Case, otherT._Case)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs index 52e0b1e2c..a7757fb66 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RelatedPerson.cs @@ -143,9 +143,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -439,7 +440,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; @@ -451,7 +453,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs index 31a355ee7..843f52893 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RequestGroup.cs @@ -539,7 +539,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; @@ -558,7 +559,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -806,9 +807,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -968,10 +970,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1423,7 +1426,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestGroup otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1441,7 +1445,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs index 0eb742aee..433980629 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchDefinition.cs @@ -866,7 +866,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -900,7 +901,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Exposure, otherT._Exposure)) return false; if(!comparer.Equals(_ExposureAlternative, otherT._ExposureAlternative)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs index f988e87eb..6ccb6ac1a 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchElementDefinition.cs @@ -412,7 +412,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Definition, otherT._Definition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_UsageContext, otherT._UsageContext)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_UnitOfMeasure, otherT._UnitOfMeasure)) return false; @@ -424,7 +425,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ParticipantEffective, otherT._ParticipantEffective)) return false; if(!comparer.Equals(_ParticipantEffectiveTimeFromStart, otherT._ParticipantEffectiveTimeFromStart)) return false; if(!comparer.Equals(_ParticipantEffectiveGroupMeasureElement, otherT._ParticipantEffectiveGroupMeasureElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1357,7 +1358,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1390,7 +1392,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_VariableTypeElement, otherT._VariableTypeElement)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs index 73617374c..cb60df7bc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchStudy.cs @@ -248,10 +248,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ArmComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -384,9 +385,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ObjectiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -873,7 +875,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.ListEquals(_Protocol, otherT._Protocol)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; @@ -897,7 +900,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Arm, otherT._Arm)) return false; if(!comparer.ListEquals(_Objective, otherT._Objective)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs index cc8b2a3b7..4ff75b2de 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ResearchSubject.cs @@ -342,7 +342,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Study, otherT._Study)) return false; @@ -350,7 +351,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AssignedArmElement, otherT._AssignedArmElement)) return false; if(!comparer.Equals(_ActualArmElement, otherT._ActualArmElement)) return false; if(!comparer.Equals(_Consent, otherT._Consent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs index 49435e0d8..5b636a2da 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/RiskAssessment.cs @@ -219,13 +219,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_Probability, otherT._Probability)) return false; if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; if(!comparer.Equals(_When, otherT._When)) return false; if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -618,7 +619,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_Parent, otherT._Parent)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -635,7 +637,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs b/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs index 1595ff0c7..901de960b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SampledData.cs @@ -274,14 +274,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_LowerLimitElement, otherT._LowerLimitElement)) return false; if(!comparer.Equals(_UpperLimitElement, otherT._UpperLimitElement)) return false; if(!comparer.Equals(_DimensionsElement, otherT._DimensionsElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs index 43e740ba0..24dc14d6b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Schedule.cs @@ -233,7 +233,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; @@ -241,7 +242,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs index 3205e24d4..d454dc2db 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SearchParameter.cs @@ -345,9 +345,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1152,7 +1153,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DerivedFromElement, otherT._DerivedFromElement)) return false; @@ -1178,7 +1180,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs index 97ddfafeb..08d8b4b99 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/ServiceRequest.cs @@ -737,7 +737,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ServiceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -770,7 +771,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs b/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs index 7fcbfff64..aba5149fb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Slot.cs @@ -366,7 +366,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; @@ -377,7 +378,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs index f04880eae..79a581b2c 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Specimen.cs @@ -239,14 +239,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Collector, otherT._Collector)) return false; if(!comparer.Equals(_Collected, otherT._Collected)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.Equals(_FastingStatus, otherT._FastingStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -440,11 +441,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -645,13 +647,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; if(!comparer.Equals(_Additive, otherT._Additive)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -976,7 +979,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -989,7 +993,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Container, otherT._Container)) return false; if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs index bdd043545..c90d4ac89 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SpecimenDefinition.cs @@ -284,7 +284,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TypeTestedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PreferenceElement, otherT._PreferenceElement)) return false; if(!comparer.Equals(_Container, otherT._Container)) return false; @@ -292,7 +293,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_RetentionTime, otherT._RetentionTime)) return false; if(!comparer.ListEquals(_RejectionCriterion, otherT._RejectionCriterion)) return false; if(!comparer.ListEquals(_Handling, otherT._Handling)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -561,7 +562,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Material, otherT._Material)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Cap, otherT._Cap)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -569,7 +571,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MinimumVolume, otherT._MinimumVolume)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_PreparationElement, otherT._PreparationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -712,8 +714,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Additive, otherT._Additive)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Additive, otherT._Additive)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -860,11 +863,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HandlingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; if(!comparer.Equals(_TemperatureRange, otherT._TemperatureRange)) return false; if(!comparer.Equals(_MaxDuration, otherT._MaxDuration)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1051,13 +1055,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecimenDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeCollected, otherT._TypeCollected)) return false; if(!comparer.ListEquals(_PatientPreparation, otherT._PatientPreparation)) return false; if(!comparer.Equals(_TimeAspectElement, otherT._TimeAspectElement)) return false; if(!comparer.ListEquals(_Collection, otherT._Collection)) return false; if(!comparer.ListEquals(_TypeTested, otherT._TypeTested)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs index 6c151eacb..b5097e590 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/StructureMap.cs @@ -508,11 +508,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -758,13 +759,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -995,11 +997,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1211,13 +1214,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1633,7 +1637,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; @@ -1644,7 +1649,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; if(!comparer.Equals(_LogMessageElement, otherT._LogMessageElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2014,7 +2019,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_ContextTypeElement, otherT._ContextTypeElement)) return false; if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; @@ -2022,7 +2028,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2160,8 +2166,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2296,9 +2303,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_VariableElement, otherT._VariableElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2814,7 +2822,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2832,7 +2841,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Structure, otherT._Structure)) return false; if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs index 9104421c3..52e2fbec3 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Subscription.cs @@ -262,11 +262,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChannelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; if(!comparer.Equals(_PayloadElement, otherT._PayloadElement)) return false; if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -526,14 +527,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; if(!comparer.Equals(_ErrorElement, otherT._ErrorElement)) return false; if(!comparer.Equals(_Channel, otherT._Channel)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs index 4cc157a01..454babc6b 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionStatus.cs @@ -230,11 +230,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotificationEventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_EventNumberElement, otherT._EventNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_EventNumberElement, otherT._EventNumberElement)) return false; if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; if(!comparer.Equals(_Focus, otherT._Focus)) return false; if(!comparer.ListEquals(_AdditionalContext, otherT._AdditionalContext)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -483,14 +484,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubscriptionStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_EventsSinceSubscriptionStartElement, otherT._EventsSinceSubscriptionStartElement)) return false; if(!comparer.ListEquals(_NotificationEvent, otherT._NotificationEvent)) return false; if(!comparer.Equals(_Subscription, otherT._Subscription)) return false; if(!comparer.Equals(_TopicElement, otherT._TopicElement)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs index 4b58aca51..fe5fc03aa 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubscriptionTopic.cs @@ -386,12 +386,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.ListEquals(_SupportedInteractionElement, otherT._SupportedInteractionElement)) return false; if(!comparer.Equals(_QueryCriteria, otherT._QueryCriteria)) return false; if(!comparer.Equals(_FhirPathCriteriaElement, otherT._FhirPathCriteriaElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -643,12 +644,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QueryCriteriaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreviousElement, otherT._PreviousElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PreviousElement, otherT._PreviousElement)) return false; if(!comparer.Equals(_ResultForCreateElement, otherT._ResultForCreateElement)) return false; if(!comparer.Equals(_CurrentElement, otherT._CurrentElement)) return false; if(!comparer.Equals(_ResultForDeleteElement, otherT._ResultForDeleteElement)) return false; if(!comparer.Equals(_RequireBothElement, otherT._RequireBothElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -827,10 +829,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Event, otherT._Event)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1072,12 +1075,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CanFilterByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.Equals(_FilterParameterElement, otherT._FilterParameterElement)) return false; if(!comparer.Equals(_FilterDefinitionElement, otherT._FilterDefinitionElement)) return false; if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1277,10 +1281,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotificationShapeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.ListEquals(_IncludeElement, otherT._IncludeElement)) return false; if(!comparer.ListEquals(_RevIncludeElement, otherT._RevIncludeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1875,7 +1880,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubscriptionTopic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -1897,7 +1903,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_EventTrigger, otherT._EventTrigger)) return false; if(!comparer.ListEquals(_CanFilterBy, otherT._CanFilterBy)) return false; if(!comparer.ListEquals(_NotificationShape, otherT._NotificationShape)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs b/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs index 2a507e6ef..13b06e456 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Substance.cs @@ -180,10 +180,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -305,9 +306,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Substance, otherT._Substance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -512,14 +514,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs index dea8926af..26538fd53 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SubstanceDefinition.cs @@ -239,7 +239,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MoietyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; @@ -247,7 +248,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_MeasurementType, otherT._MeasurementType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -400,9 +401,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -529,10 +531,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MolecularWeightComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Method, otherT._Method)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -768,7 +771,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; if(!comparer.Equals(_MolecularFormulaByMoietyElement, otherT._MolecularFormulaByMoietyElement)) return false; @@ -776,7 +780,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Technique, otherT._Technique)) return false; if(!comparer.ListEquals(_SourceDocument, otherT._SourceDocument)) return false; if(!comparer.ListEquals(_Representation, otherT._Representation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -972,11 +976,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_Format, otherT._Format)) return false; if(!comparer.Equals(_Document, otherT._Document)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1159,12 +1164,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1463,7 +1469,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; @@ -1474,7 +1481,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Translation, otherT._Translation)) return false; if(!comparer.ListEquals(_Official, otherT._Official)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1675,10 +1682,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OfficialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Authority, otherT._Authority)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1891,14 +1899,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelationshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubstanceDefinition, otherT._SubstanceDefinition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubstanceDefinition, otherT._SubstanceDefinition)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_RatioHighLimitAmount, otherT._RatioHighLimitAmount)) return false; if(!comparer.Equals(_Comparator, otherT._Comparator)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2091,12 +2100,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Genus, otherT._Genus)) return false; if(!comparer.Equals(_Species, otherT._Species)) return false; if(!comparer.Equals(_Part, otherT._Part)) return false; if(!comparer.ListEquals(_CountryOfOrigin, otherT._CountryOfOrigin)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2503,7 +2513,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; @@ -2522,7 +2533,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_SourceMaterial, otherT._SourceMaterial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs index 13d945937..857e48ec1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SupplyDelivery.cs @@ -186,9 +186,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -446,7 +447,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -457,7 +459,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs index 07faa7b84..18244a952 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/SupplyRequest.cs @@ -181,9 +181,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -535,7 +536,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; @@ -550,7 +552,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Task.cs b/src/Hl7.Fhir.R4B/Model/Generated/Task.cs index 20bce4d5b..34268eea6 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Task.cs @@ -301,10 +301,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,9 +427,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -543,9 +545,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1211,7 +1214,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1242,7 +1246,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Output, otherT._Output)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs index 519dcc9ca..5edc69035 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TerminologyCapabilities.cs @@ -179,9 +179,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -322,9 +323,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -480,10 +482,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.ListEquals(_Version, otherT._Version)) return false; if(!comparer.Equals(_SubsumptionElement, otherT._SubsumptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -741,13 +744,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_IsDefaultElement, otherT._IsDefaultElement)) return false; if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; if(!comparer.ListEquals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -917,9 +921,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_OpElement, otherT._OpElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1129,12 +1134,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; if(!comparer.Equals(_PagingElement, otherT._PagingElement)) return false; if(!comparer.Equals(_IncompleteElement, otherT._IncompleteElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.Equals(_TextFilterElement, otherT._TextFilterElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1293,9 +1299,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1404,8 +1411,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValidateCodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1507,8 +1515,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TranslationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1612,8 +1621,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClosureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2232,7 +2242,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TerminologyCapabilities otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -2256,7 +2267,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ValidateCode, otherT._ValidateCode)) return false; if(!comparer.Equals(_Translation, otherT._Translation)) return false; if(!comparer.Equals(_Closure, otherT._Closure)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs index c95edd0a2..b536097bc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TestReport.cs @@ -322,10 +322,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,8 +427,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -531,9 +533,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -705,10 +708,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -887,10 +891,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1049,10 +1054,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1170,9 +1176,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1269,8 +1276,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1361,8 +1369,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1692,7 +1701,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TestScript, otherT._TestScript)) return false; @@ -1704,7 +1714,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs index 13708c02c..7cd49a2e1 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TestScript.cs @@ -377,9 +377,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -508,9 +509,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -622,9 +624,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Link, otherT._Link)) return false; if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -765,9 +768,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1064,14 +1068,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1264,10 +1269,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1590,7 +1596,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; @@ -1598,7 +1605,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1734,8 +1741,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1839,9 +1847,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2395,7 +2404,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -2412,7 +2422,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2660,9 +2670,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3395,7 +3406,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; @@ -3417,7 +3429,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ValidateProfileIdElement, otherT._ValidateProfileIdElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3709,10 +3721,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3830,9 +3843,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3929,8 +3943,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4021,8 +4036,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4601,7 +4617,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -4625,7 +4642,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs index 71e481d02..e01c981c2 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/Timing.cs @@ -760,7 +760,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; @@ -775,7 +776,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -994,10 +995,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs index ec42e98bf..616b2c3c9 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/TriggerDefinition.cs @@ -248,12 +248,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.Equals(_Condition, otherT._Condition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs index b1e2830e6..9f1ebb8dc 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/VerificationResult.cs @@ -261,14 +261,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrimarySourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_CommunicationMethod, otherT._CommunicationMethod)) return false; if(!comparer.Equals(_ValidationStatus, otherT._ValidationStatus)) return false; if(!comparer.Equals(_ValidationDateElement, otherT._ValidationDateElement)) return false; if(!comparer.Equals(_CanPushUpdates, otherT._CanPushUpdates)) return false; if(!comparer.ListEquals(_PushTypeAvailable, otherT._PushTypeAvailable)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -544,7 +545,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttestationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_CommunicationMethod, otherT._CommunicationMethod)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -552,7 +554,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ProxyIdentityCertificateElement, otherT._ProxyIdentityCertificateElement)) return false; if(!comparer.Equals(_ProxySignature, otherT._ProxySignature)) return false; if(!comparer.Equals(_SourceSignature, otherT._SourceSignature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -733,10 +735,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValidatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Organization, otherT._Organization)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_IdentityCertificateElement, otherT._IdentityCertificateElement)) return false; if(!comparer.Equals(_AttestationSignature, otherT._AttestationSignature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1097,7 +1100,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VerificationResult otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_TargetLocationElement, otherT._TargetLocationElement)) return false; if(!comparer.Equals(_Need, otherT._Need)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1111,7 +1115,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PrimarySource, otherT._PrimarySource)) return false; if(!comparer.Equals(_Attestation, otherT._Attestation)) return false; if(!comparer.ListEquals(_Validator, otherT._Validator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs index e37af7147..79be185bb 100644 --- a/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R4B/Model/Generated/VisionPrescription.cs @@ -507,7 +507,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LensSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Product, otherT._Product)) return false; if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; @@ -521,7 +522,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -749,9 +750,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -991,7 +993,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -999,7 +1002,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DateWrittenElement, otherT._DateWrittenElement)) return false; if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; if(!comparer.ListEquals(_LensSpecification, otherT._LensSpecification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Account.cs b/src/Hl7.Fhir.R5/Model/Generated/Account.cs index 9319a5f45..07ba26338 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Account.cs @@ -186,9 +186,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -330,10 +331,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -557,13 +559,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_DateOfDiagnosisElement, otherT._DateOfDiagnosisElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OnAdmissionElement, otherT._OnAdmissionElement)) return false; if(!comparer.ListEquals(_PackageCode, otherT._PackageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -795,13 +798,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DateOfServiceElement, otherT._DateOfServiceElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_PackageCode, otherT._PackageCode)) return false; if(!comparer.ListEquals(_Device, otherT._Device)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -940,9 +944,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedAccountComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Account, otherT._Account)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1099,11 +1104,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Aggregate, otherT._Aggregate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Aggregate, otherT._Aggregate)) return false; if(!comparer.Equals(_Term, otherT._Term)) return false; if(!comparer.Equals(_EstimateElement, otherT._EstimateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1501,7 +1507,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_BillingStatus, otherT._BillingStatus)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -1518,7 +1525,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Currency, otherT._Currency)) return false; if(!comparer.ListEquals(_Balance, otherT._Balance)) return false; if(!comparer.Equals(_CalculatedAtElement, otherT._CalculatedAtElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs index 3f5319349..8173c2000 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActivityDefinition.cs @@ -316,12 +316,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Function, otherT._Function)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -470,9 +471,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1674,7 +1676,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1723,7 +1726,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ObservationResultRequirementElement, otherT._ObservationResultRequirementElement)) return false; if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs index 892f59e77..a89d51196 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ActorDefinition.cs @@ -669,7 +669,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActorDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -691,7 +692,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; if(!comparer.ListEquals(_DerivedFromElement, otherT._DerivedFromElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Address.cs b/src/Hl7.Fhir.R5/Model/Generated/Address.cs index 425f17c00..ec8c89401 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Address.cs @@ -435,7 +435,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; @@ -445,7 +446,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs index 870752846..18346ebf1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AdministrableProductDefinition.cs @@ -143,10 +143,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -336,14 +337,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RouteOfAdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FirstDose, otherT._FirstDose)) return false; if(!comparer.Equals(_MaxSingleDose, otherT._MaxSingleDose)) return false; if(!comparer.Equals(_MaxDosePerDay, otherT._MaxDosePerDay)) return false; if(!comparer.Equals(_MaxDosePerTreatmentPeriod, otherT._MaxDosePerTreatmentPeriod)) return false; if(!comparer.Equals(_MaxTreatmentPeriod, otherT._MaxTreatmentPeriod)) return false; if(!comparer.ListEquals(_TargetSpecies, otherT._TargetSpecies)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -488,9 +490,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetSpeciesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_WithdrawalPeriod, otherT._WithdrawalPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -629,10 +632,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not WithdrawalPeriodComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Tissue, otherT._Tissue)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_SupportingInformationElement, otherT._SupportingInformationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -909,7 +913,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrableProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_FormOf, otherT._FormOf)) return false; if(!comparer.Equals(_AdministrableDoseForm, otherT._AdministrableDoseForm)) return false; @@ -920,7 +925,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_RouteOfAdministration, otherT._RouteOfAdministration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs index 6adf5b458..aee28e45e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AdverseEvent.cs @@ -186,9 +186,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -302,9 +303,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Instance, otherT._Instance)) return false; if(!comparer.Equals(_Causality, otherT._Causality)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -429,10 +431,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CausalityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AssessmentMethod, otherT._AssessmentMethod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AssessmentMethod, otherT._AssessmentMethod)) return false; if(!comparer.Equals(_EntityRelatedness, otherT._EntityRelatedness)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -540,8 +543,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContributingFactorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -632,8 +636,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PreventiveActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -727,8 +732,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MitigatingActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -819,8 +825,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInfoComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1329,7 +1336,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ActualityElement, otherT._ActualityElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1353,7 +1361,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_MitigatingAction, otherT._MitigatingAction)) return false; if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs index d512c4142..4b9a1e350 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AllergyIntolerance.cs @@ -289,9 +289,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -523,14 +524,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -926,7 +928,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -941,7 +944,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs b/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs index cc95b37c5..e14ff6349 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Annotation.cs @@ -159,10 +159,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs index 13c7d186e..34fba760d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Appointment.cs @@ -3170,12 +3170,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3508,7 +3509,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RecurrenceTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Timezone, otherT._Timezone)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Timezone, otherT._Timezone)) return false; if(!comparer.Equals(_RecurrenceType, otherT._RecurrenceType)) return false; if(!comparer.Equals(_LastOccurrenceDateElement, otherT._LastOccurrenceDateElement)) return false; if(!comparer.Equals(_OccurrenceCountElement, otherT._OccurrenceCountElement)) return false; @@ -3518,7 +3520,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_YearlyTemplate, otherT._YearlyTemplate)) return false; if(!comparer.ListEquals(_ExcludingDateElement, otherT._ExcludingDateElement)) return false; if(!comparer.ListEquals(_ExcludingRecurrenceIdElement, otherT._ExcludingRecurrenceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3885,7 +3887,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not WeeklyTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MondayElement, otherT._MondayElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MondayElement, otherT._MondayElement)) return false; if(!comparer.Equals(_TuesdayElement, otherT._TuesdayElement)) return false; if(!comparer.Equals(_WednesdayElement, otherT._WednesdayElement)) return false; if(!comparer.Equals(_ThursdayElement, otherT._ThursdayElement)) return false; @@ -3893,7 +3896,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SaturdayElement, otherT._SaturdayElement)) return false; if(!comparer.Equals(_SundayElement, otherT._SundayElement)) return false; if(!comparer.Equals(_WeekIntervalElement, otherT._WeekIntervalElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4103,11 +4106,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonthlyTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DayOfMonthElement, otherT._DayOfMonthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DayOfMonthElement, otherT._DayOfMonthElement)) return false; if(!comparer.Equals(_NthWeekOfMonth, otherT._NthWeekOfMonth)) return false; if(!comparer.Equals(_DayOfWeek, otherT._DayOfWeek)) return false; if(!comparer.Equals(_MonthIntervalElement, otherT._MonthIntervalElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4230,8 +4234,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not YearlyTemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_YearIntervalElement, otherT._YearIntervalElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_YearIntervalElement, otherT._YearIntervalElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4919,7 +4924,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CancellationReason, otherT._CancellationReason)) return false; if(!comparer.ListEquals(_Class, otherT._Class)) return false; @@ -4951,7 +4957,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_RecurrenceIdElement, otherT._RecurrenceIdElement)) return false; if(!comparer.Equals(_OccurrenceChangedElement, otherT._OccurrenceChangedElement)) return false; if(!comparer.ListEquals(_RecurrenceTemplate, otherT._RecurrenceTemplate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs index 0834788df..c0b171222 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AppointmentResponse.cs @@ -420,7 +420,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; if(!comparer.Equals(_ProposedNewTimeElement, otherT._ProposedNewTimeElement)) return false; if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; @@ -432,7 +433,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_RecurringElement, otherT._RecurringElement)) return false; if(!comparer.Equals(_OccurrenceDateElement, otherT._OccurrenceDateElement)) return false; if(!comparer.Equals(_RecurrenceIdElement, otherT._RecurrenceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs index 9669995c1..6395eff45 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ArtifactAssessment.cs @@ -467,7 +467,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InformationTypeElement, otherT._InformationTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_InformationTypeElement, otherT._InformationTypeElement)) return false; if(!comparer.Equals(_SummaryElement, otherT._SummaryElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; @@ -477,7 +478,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.Equals(_FreeToShareElement, otherT._FreeToShareElement)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -873,7 +874,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ArtifactAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_CiteAs, otherT._CiteAs)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -884,7 +886,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.Equals(_WorkflowStatusElement, otherT._WorkflowStatusElement)) return false; if(!comparer.Equals(_DispositionElement, otherT._DispositionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs index 482ac3a4b..944ec2513 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/AuditEvent.cs @@ -230,9 +230,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutcomeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -476,7 +477,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_RequestorElement, otherT._RequestorElement)) return false; @@ -484,7 +486,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; if(!comparer.Equals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_Authorization, otherT._Authorization)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -658,10 +660,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Site, otherT._Site)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Site, otherT._Site)) return false; if(!comparer.Equals(_Observer, otherT._Observer)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -857,13 +860,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_What, otherT._What)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_What, otherT._What)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1006,9 +1010,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1338,7 +1343,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; @@ -1352,7 +1358,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs index 9ec0233ab..068037508 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Availability.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Availability.cs @@ -214,11 +214,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -354,9 +355,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotAvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_During, otherT._During)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -452,9 +454,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Availability otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_AvailableTime, otherT._AvailableTime)) return false; if(!comparer.ListEquals(_NotAvailableTime, otherT._NotAvailableTime)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Basic.cs b/src/Hl7.Fhir.R5/Model/Generated/Basic.cs index 65e23fd2b..6b8a5133d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Basic.cs @@ -176,12 +176,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs index 55209ca22..4ac51e45a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProduct.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Collector, otherT._Collector)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_Collected, otherT._Collected)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -270,9 +271,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -566,7 +568,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BiologicallyDerivedProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductCategory, otherT._ProductCategory)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductCategory, otherT._ProductCategory)) return false; if(!comparer.Equals(_ProductCode, otherT._ProductCode)) return false; if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; if(!comparer.ListEquals(_Request, otherT._Request)) return false; @@ -579,7 +582,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Collection, otherT._Collection)) return false; if(!comparer.Equals(_StorageTempRequirements, otherT._StorageTempRequirements)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs index aba0b9b00..4c0ab5330 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BiologicallyDerivedProductDispense.cs @@ -185,9 +185,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -563,7 +564,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BiologicallyDerivedProductDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -579,7 +581,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_UsageInstructionElement, otherT._UsageInstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs b/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs index 495dcfcbc..0abcaa3c3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/BodyStructure.cs @@ -177,12 +177,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IncludedStructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Structure, otherT._Structure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Structure, otherT._Structure)) return false; if(!comparer.Equals(_Laterality, otherT._Laterality)) return false; if(!comparer.ListEquals(_BodyLandmarkOrientation, otherT._BodyLandmarkOrientation)) return false; if(!comparer.ListEquals(_SpatialReference, otherT._SpatialReference)) return false; if(!comparer.ListEquals(_Qualifier, otherT._Qualifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -348,11 +349,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BodyLandmarkOrientationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_LandmarkDescription, otherT._LandmarkDescription)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_LandmarkDescription, otherT._LandmarkDescription)) return false; if(!comparer.ListEquals(_ClockFacePosition, otherT._ClockFacePosition)) return false; if(!comparer.ListEquals(_DistanceFromLandmark, otherT._DistanceFromLandmark)) return false; if(!comparer.ListEquals(_SurfaceOrientation, otherT._SurfaceOrientation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -479,9 +481,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DistanceFromLandmarkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Device, otherT._Device)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Device, otherT._Device)) return false; if(!comparer.ListEquals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -699,7 +702,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BodyStructure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Morphology, otherT._Morphology)) return false; if(!comparer.ListEquals(_IncludedStructure, otherT._IncludedStructure)) return false; @@ -707,7 +711,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Image, otherT._Image)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs index e69060d50..7fc4e35c0 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CarePlan.cs @@ -185,10 +185,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_PerformedActivity, otherT._PerformedActivity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_PerformedActivity, otherT._PerformedActivity)) return false; if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; if(!comparer.Equals(_PlannedActivityReference, otherT._PlannedActivityReference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -739,7 +740,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -762,7 +764,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs index e0ceea7bf..f7f978935 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CareTeam.cs @@ -201,11 +201,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Member, otherT._Member)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -486,7 +487,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -497,7 +499,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs index a2d77fd6c..f71591ef0 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItem.cs @@ -182,9 +182,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -724,7 +725,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_DefinitionUriElement, otherT._DefinitionUriElement)) return false; if(!comparer.ListEquals(_DefinitionCanonicalElement, otherT._DefinitionCanonicalElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -750,7 +752,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Account, otherT._Account)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs index eb524df89..f6e9408a3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ChargeItemDefinition.cs @@ -141,10 +141,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ApplicabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; if(!comparer.Equals(_RelatedArtifact, otherT._RelatedArtifact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -263,9 +264,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -980,7 +982,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1006,7 +1009,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_PropertyGroup, otherT._PropertyGroup)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Citation.cs b/src/Hl7.Fhir.R5/Model/Generated/Citation.cs index 98514877a..6c3266928 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Citation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Citation.cs @@ -378,9 +378,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Style, otherT._Style)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Style, otherT._Style)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -493,9 +494,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -638,10 +640,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Activity, otherT._Activity)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -964,7 +967,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_RelatedIdentifier, otherT._RelatedIdentifier)) return false; if(!comparer.Equals(_DateAccessedElement, otherT._DateAccessedElement)) return false; if(!comparer.Equals(_Version, otherT._Version)) return false; @@ -979,7 +983,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; if(!comparer.Equals(_Contributorship, otherT._Contributorship)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1195,9 +1199,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactVersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1339,10 +1344,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactStatusDateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Activity, otherT._Activity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Activity, otherT._Activity)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1489,10 +1495,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactTitleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1670,11 +1677,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactAbstractComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1827,10 +1835,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_BaseCitation, otherT._BaseCitation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2111,7 +2120,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactRelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; @@ -2119,7 +2129,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Document, otherT._Document)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.Equals(_ResourceReference, otherT._ResourceReference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2636,7 +2646,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPublicationFormComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PublishedIn, otherT._PublishedIn)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PublishedIn, otherT._PublishedIn)) return false; if(!comparer.Equals(_CitedMedium, otherT._CitedMedium)) return false; if(!comparer.Equals(_VolumeElement, otherT._VolumeElement)) return false; if(!comparer.Equals(_IssueElement, otherT._IssueElement)) return false; @@ -2651,7 +2662,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_LastPageElement, otherT._LastPageElement)) return false; if(!comparer.Equals(_PageCountElement, otherT._PageCountElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2925,12 +2936,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactPublicationFormPublishedInComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; if(!comparer.Equals(_PublisherLocationElement, otherT._PublisherLocationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3075,9 +3087,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactWebLocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3204,10 +3217,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; if(!comparer.ListEquals(_ArtifactAssessment, otherT._ArtifactAssessment)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3355,10 +3369,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactContributorshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CompleteElement, otherT._CompleteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CompleteElement, otherT._CompleteElement)) return false; if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.ListEquals(_Summary, otherT._Summary)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3615,7 +3630,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactContributorshipEntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Contributor, otherT._Contributor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Contributor, otherT._Contributor)) return false; if(!comparer.Equals(_ForenameInitialsElement, otherT._ForenameInitialsElement)) return false; if(!comparer.ListEquals(_Affiliation, otherT._Affiliation)) return false; if(!comparer.ListEquals(_ContributionType, otherT._ContributionType)) return false; @@ -3623,7 +3639,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ContributionInstance, otherT._ContributionInstance)) return false; if(!comparer.Equals(_CorrespondingContactElement, otherT._CorrespondingContactElement)) return false; if(!comparer.Equals(_RankingOrderElement, otherT._RankingOrderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3789,9 +3805,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CitedArtifactContributorshipEntryContributionInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3945,11 +3962,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContributorshipSummaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Style, otherT._Style)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4696,7 +4714,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Citation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -4727,7 +4746,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_StatusDate, otherT._StatusDate)) return false; if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.Equals(_CitedArtifact, otherT._CitedArtifact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs index 9a33078fc..ca38abb63 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Claim.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -270,9 +271,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -387,9 +389,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_When, otherT._When)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -577,12 +580,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Specialty, otherT._Specialty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -795,13 +799,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -991,11 +996,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1202,12 +1208,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1480,14 +1487,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1666,10 +1674,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2241,7 +2250,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; @@ -2266,7 +2276,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2541,9 +2551,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Site, otherT._Site)) return false; if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2893,7 +2904,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -2909,7 +2921,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3342,7 +3354,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -3357,7 +3370,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Tax, otherT._Tax)) return false; if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4052,7 +4065,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -4084,7 +4098,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PatientPaid, otherT._PatientPaid)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Total, otherT._Total)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs index c7b62a426..e62a9b226 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClaimResponse.cs @@ -131,9 +131,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_When, otherT._When)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -337,13 +338,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -527,11 +529,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReviewOutcomeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Decision, otherT._Decision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Decision, otherT._Decision)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_PreAuthPeriod, otherT._PreAuthPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -686,11 +689,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -908,13 +912,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1131,12 +1136,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1675,7 +1681,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_SubdetailSequenceElement, otherT._SubdetailSequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; @@ -1698,7 +1705,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1959,9 +1966,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Site, otherT._Site)) return false; if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2281,7 +2289,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; @@ -2295,7 +2304,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2684,7 +2693,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; @@ -2697,7 +2707,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2888,9 +2898,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3075,13 +3086,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3280,11 +3292,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3503,12 +3516,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3748,12 +3762,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.Equals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.Equals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4423,7 +4438,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -4455,7 +4471,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs index 6c7111f8d..4aedf9aeb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalImpression.cs @@ -142,9 +142,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -587,7 +588,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -606,7 +608,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs index 3a6f2cebf..6e493ff4f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ClinicalUseDefinition.cs @@ -224,13 +224,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContraindicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -372,9 +373,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherTherapyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RelationshipType, otherT._RelationshipType)) return false; if(!comparer.Equals(_Treatment, otherT._Treatment)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -576,7 +578,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IndicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DiseaseSymptomProcedure, otherT._DiseaseSymptomProcedure)) return false; if(!comparer.Equals(_DiseaseStatus, otherT._DiseaseStatus)) return false; if(!comparer.ListEquals(_Comorbidity, otherT._Comorbidity)) return false; if(!comparer.Equals(_IntendedEffect, otherT._IntendedEffect)) return false; @@ -584,7 +587,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_UndesirableEffect, otherT._UndesirableEffect)) return false; if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_OtherTherapy, otherT._OtherTherapy)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -781,12 +784,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Interactant, otherT._Interactant)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Effect, otherT._Effect)) return false; if(!comparer.Equals(_Incidence, otherT._Incidence)) return false; if(!comparer.ListEquals(_Management, otherT._Management)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -908,8 +912,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InteractantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1029,10 +1034,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UndesirableEffectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SymptomConditionEffect, otherT._SymptomConditionEffect)) return false; if(!comparer.Equals(_Classification, otherT._Classification)) return false; if(!comparer.Equals(_FrequencyOfOccurrence, otherT._FrequencyOfOccurrence)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1165,9 +1171,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not WarningComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1450,7 +1457,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClinicalUseDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; @@ -1462,7 +1470,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; if(!comparer.Equals(_UndesirableEffect, otherT._UndesirableEffect)) return false; if(!comparer.Equals(_Warning, otherT._Warning)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs index 223e9915c..0a68aea7d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Communication.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -621,7 +622,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -643,7 +645,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs index 9858c60be..37f3eff0c 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CommunicationRequest.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -602,7 +603,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; @@ -624,7 +626,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_InformationProvider, otherT._InformationProvider)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs index 1b6c2c0fc..e075f6d5f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CompartmentDefinition.cs @@ -251,12 +251,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_StartParamElement, otherT._StartParamElement)) return false; if(!comparer.Equals(_EndParamElement, otherT._EndParamElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -761,7 +762,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -777,7 +779,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Composition.cs b/src/Hl7.Fhir.R5/Model/Generated/Composition.cs index fef4defd7..47e908fba 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Composition.cs @@ -161,10 +161,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Mode, otherT._Mode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Mode, otherT._Mode)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -284,9 +285,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Period, otherT._Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -521,7 +523,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Focus, otherT._Focus)) return false; @@ -530,7 +533,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1029,7 +1032,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1048,7 +1052,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs index df7f99dba..c07a05f28 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ConceptMap.cs @@ -408,12 +408,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -637,11 +638,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdditionalAttributeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -824,11 +826,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; if(!comparer.ListEquals(_Element, otherT._Element)) return false; if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1056,12 +1059,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.Equals(_NoMapElement, otherT._NoMapElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1358,7 +1362,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; @@ -1366,7 +1371,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; if(!comparer.ListEquals(_Product, otherT._Product)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1537,9 +1542,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1696,10 +1702,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AttributeElement, otherT._AttributeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AttributeElement, otherT._AttributeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1968,13 +1975,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_OtherMapElement, otherT._OtherMapElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2738,7 +2746,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2769,7 +2778,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SourceScope, otherT._SourceScope)) return false; if(!comparer.Equals(_TargetScope, otherT._TargetScope)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Condition.cs b/src/Hl7.Fhir.R5/Model/Generated/Condition.cs index a474fbe82..dae785089 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Condition.cs @@ -228,9 +228,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -359,10 +360,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Summary, otherT._Summary)) return false; if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -700,7 +702,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatus, otherT._ClinicalStatus)) return false; if(!comparer.Equals(_VerificationStatus, otherT._VerificationStatus)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -716,7 +719,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Stage, otherT._Stage)) return false; if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs index 9445513bd..a38695506 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ConditionDefinition.cs @@ -175,9 +175,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ObservationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -286,9 +287,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -434,10 +436,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PreconditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -572,9 +575,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QuestionnaireComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PurposeElement, otherT._PurposeElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -684,9 +688,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1397,7 +1402,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1426,7 +1432,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Team, otherT._Team)) return false; if(!comparer.ListEquals(_Questionnaire, otherT._Questionnaire)) return false; if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs index 42f24cde7..518228c36 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Consent.cs @@ -190,9 +190,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PolicyBasisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -384,12 +385,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VerificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VerifiedElement, otherT._VerifiedElement)) return false; if(!comparer.Equals(_VerificationType, otherT._VerificationType)) return false; if(!comparer.Equals(_VerifiedBy, otherT._VerifiedBy)) return false; if(!comparer.Equals(_VerifiedWith, otherT._VerifiedWith)) return false; if(!comparer.ListEquals(_VerificationDateElement, otherT._VerificationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -675,7 +677,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Period, otherT._Period)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; @@ -687,7 +690,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -870,9 +873,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1003,9 +1007,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not provisionDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1403,7 +1408,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -1421,7 +1427,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Verification, otherT._Verification)) return false; if(!comparer.Equals(_DecisionElement, otherT._DecisionElement)) return false; if(!comparer.ListEquals(_Provision, otherT._Provision)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs index 8398baf26..79c99d8c2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Contract.cs @@ -435,13 +435,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubType, otherT._SubType)) return false; if(!comparer.Equals(_Publisher, otherT._Publisher)) return false; if(!comparer.Equals(_PublicationDateElement, otherT._PublicationDateElement)) return false; if(!comparer.Equals(_PublicationStatusElement, otherT._PublicationStatusElement)) return false; if(!comparer.Equals(_CopyrightElement, otherT._CopyrightElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -759,7 +760,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; if(!comparer.Equals(_Applies, otherT._Applies)) return false; if(!comparer.Equals(_Topic, otherT._Topic)) return false; @@ -771,7 +773,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Asset, otherT._Asset)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1006,11 +1008,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SecurityLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Classification, otherT._Classification)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Control, otherT._Control)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1308,7 +1311,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractOfferComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Party, otherT._Party)) return false; if(!comparer.Equals(_Topic, otherT._Topic)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -1318,7 +1322,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1486,9 +1490,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1585,8 +1590,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1952,7 +1958,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContractAssetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Scope, otherT._Scope)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Scope, otherT._Scope)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_TypeReference, otherT._TypeReference)) return false; if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; @@ -1967,7 +1974,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2198,10 +2205,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssetContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2603,7 +2611,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; @@ -2617,7 +2626,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; if(!comparer.ListEquals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3202,7 +3211,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DoNotPerformElement, otherT._DoNotPerformElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Intent, otherT._Intent)) return false; @@ -3221,7 +3231,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonLinkIdElement, otherT._ReasonLinkIdElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_SecurityLabelNumberElement, otherT._SecurityLabelNumberElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3451,9 +3461,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionSubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3585,10 +3596,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3695,8 +3707,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3789,8 +3802,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3883,8 +3897,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4589,7 +4604,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -4622,7 +4638,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; if(!comparer.Equals(_LegallyBinding, otherT._LegallyBinding)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs b/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs index 77bcc6979..ed60287d3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Contributor.cs @@ -193,10 +193,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs b/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs index 4b6c1e683..67bf74e49 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Coverage.cs @@ -173,9 +173,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.Equals(_ResponsibilityElement, otherT._ResponsibilityElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -318,10 +319,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -517,14 +519,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostToBeneficiaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Network, otherT._Network)) return false; if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Term, otherT._Term)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Exception, otherT._Exception)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -671,9 +674,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExemptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1138,7 +1142,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.ListEquals(_PaymentBy, otherT._PaymentBy)) return false; @@ -1158,7 +1163,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SubrogationElement, otherT._SubrogationElement)) return false; if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; if(!comparer.Equals(_InsurancePlan, otherT._InsurancePlan)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs index bf42cbd04..884c9e98e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityRequest.cs @@ -165,9 +165,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_When, otherT._When)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -326,10 +327,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Information, otherT._Information)) return false; if(!comparer.Equals(_AppliesToAllElement, otherT._AppliesToAllElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -494,10 +496,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -757,7 +760,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_SupportingInfoSequenceElement, otherT._SupportingInfoSequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; @@ -767,7 +771,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Facility, otherT._Facility)) return false; if(!comparer.ListEquals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -923,8 +927,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1270,7 +1275,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageEligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; @@ -1285,7 +1291,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs index 6f48f298b..3b57b38d8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/CoverageEligibilityResponse.cs @@ -199,9 +199,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_When, otherT._When)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -359,11 +360,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_InforceElement, otherT._InforceElement)) return false; if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -742,7 +744,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; @@ -756,7 +759,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AuthorizationRequiredElement, otherT._AuthorizationRequiredElement)) return false; if(!comparer.ListEquals(_AuthorizationSupporting, otherT._AuthorizationSupporting)) return false; if(!comparer.Equals(_AuthorizationUrlElement, otherT._AuthorizationUrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -970,10 +973,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1111,9 +1115,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1526,7 +1531,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageEligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_PurposeElement, otherT._PurposeElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -1542,7 +1548,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs index 6685a446c..f338cc2d5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DataRequirement.cs @@ -274,11 +274,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -448,10 +449,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -645,11 +647,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValueFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SearchParamElement, otherT._SearchParamElement)) return false; if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -808,9 +811,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SortComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1081,7 +1085,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; @@ -1090,7 +1095,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ValueFilter, otherT._ValueFilter)) return false; if(!comparer.Equals(_LimitElement, otherT._LimitElement)) return false; if(!comparer.ListEquals(_Sort, otherT._Sort)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs index afeac5c2b..0433deff6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DetectedIssue.cs @@ -193,9 +193,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -353,11 +354,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -717,7 +719,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -731,7 +734,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Device.cs b/src/Hl7.Fhir.R5/Model/Generated/Device.cs index afcf3ab37..ebc6aad16 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Device.cs @@ -357,13 +357,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiCarrierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -564,10 +565,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -741,11 +743,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Component, otherT._Component)) return false; if(!comparer.Equals(_InstallDateElement, otherT._InstallDateElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -901,10 +904,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConformsToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Specification, otherT._Specification)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1027,9 +1031,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1723,7 +1728,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_DisplayNameElement, otherT._DisplayNameElement)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_UdiCarrier, otherT._UdiCarrier)) return false; @@ -1755,7 +1761,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; if(!comparer.Equals(_Parent, otherT._Parent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs index f4d67646c..d8fa1c1b3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceAssociation.cs @@ -179,10 +179,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Status, otherT._Status)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.ListEquals(_Operator, otherT._Operator)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -397,7 +398,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceAssociation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Device, otherT._Device)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; @@ -406,7 +408,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_BodyStructure, otherT._BodyStructure)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs index e5074c3af..f105b9694 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceDefinition.cs @@ -306,11 +306,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiDeviceIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; if(!comparer.ListEquals(_MarketDistribution, otherT._MarketDistribution)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -451,9 +452,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiDeviceIdentifierMarketDistributionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MarketPeriod, otherT._MarketPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MarketPeriod, otherT._MarketPeriod)) return false; if(!comparer.Equals(_SubJurisdictionElement, otherT._SubJurisdictionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -658,11 +660,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RegulatoryIdentifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -817,9 +820,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceNameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -932,9 +936,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Justification, otherT._Justification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1095,11 +1100,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConformsToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Specification, otherT._Specification)) return false; if(!comparer.ListEquals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1241,9 +1247,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HasPartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1424,13 +1431,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.ListEquals(_Distributor, otherT._Distributor)) return false; if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; if(!comparer.ListEquals(_Packaging, otherT._Packaging)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1583,9 +1591,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagingDistributorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_OrganizationReference, otherT._OrganizationReference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1722,10 +1731,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Component, otherT._Component)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1848,9 +1858,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1960,9 +1971,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Relation, otherT._Relation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Relation, otherT._Relation)) return false; if(!comparer.Equals(_RelatedDevice, otherT._RelatedDevice)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2114,10 +2126,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.Equals(_AlternateElement, otherT._AlternateElement)) return false; if(!comparer.Equals(_AllergenicIndicatorElement, otherT._AllergenicIndicatorElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2339,14 +2352,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; if(!comparer.Equals(_UsageInstructionElement, otherT._UsageInstructionElement)) return false; if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; if(!comparer.ListEquals(_Contraindication, otherT._Contraindication)) return false; if(!comparer.ListEquals(_Warning, otherT._Warning)) return false; if(!comparer.Equals(_IntendedUseElement, otherT._IntendedUseElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2536,10 +2550,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CorrectiveActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2684,11 +2699,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ChargeItemCode, otherT._ChargeItemCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ChargeItemCode, otherT._ChargeItemCode)) return false; if(!comparer.Equals(_Count, otherT._Count)) return false; if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3223,7 +3239,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_UdiDeviceIdentifier, otherT._UdiDeviceIdentifier)) return false; if(!comparer.ListEquals(_RegulatoryIdentifier, otherT._RegulatoryIdentifier)) return false; @@ -3249,7 +3266,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Guideline, otherT._Guideline)) return false; if(!comparer.Equals(_CorrectiveAction, otherT._CorrectiveAction)) return false; if(!comparer.ListEquals(_ChargeItem, otherT._ChargeItem)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs index ed5149ac2..a3fe928a6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceDispense.cs @@ -193,9 +193,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -649,7 +650,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -670,7 +672,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_UsageInstructionElement, otherT._UsageInstructionElement)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs index 3af4dba9f..74359db17 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceMetric.cs @@ -323,10 +323,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -585,7 +586,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Device, otherT._Device)) return false; @@ -594,7 +596,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_MeasurementFrequency, otherT._MeasurementFrequency)) return false; if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs index b587b4ea5..69d072da7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceRequest.cs @@ -129,9 +129,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -744,7 +745,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -770,7 +772,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs b/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs index 30385ca53..60a617447 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DeviceUsage.cs @@ -182,9 +182,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdherenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -546,7 +547,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceUsage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -563,7 +565,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs index 26bf8ad4d..f67f81a63 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DiagnosticReport.cs @@ -208,9 +208,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInfoComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -338,9 +339,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MediaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -787,7 +789,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -808,7 +811,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; if(!comparer.ListEquals(_ConclusionCode, otherT._ConclusionCode)) return false; if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs index c8bc2e1a4..cecc1e69a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/DocumentReference.cs @@ -189,10 +189,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Mode, otherT._Mode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Mode, otherT._Mode)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -315,9 +316,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -430,9 +432,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; if(!comparer.ListEquals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -534,8 +537,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProfileComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1028,7 +1032,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1051,7 +1056,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs b/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs index a73d3ebc5..06f208747 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Dosage.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DoseAndRateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Dose, otherT._Dose)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -486,7 +487,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; @@ -500,7 +502,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_MaxDosePerPeriod, otherT._MaxDosePerPeriod)) return false; if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs b/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs index 068ff53b2..ba156f99b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Encounter.cs @@ -181,10 +181,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -308,9 +309,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReasonComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Use, otherT._Use)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Use, otherT._Use)) return false; if(!comparer.ListEquals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -424,9 +426,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; if(!comparer.ListEquals(_Use, otherT._Use)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -602,13 +605,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdmissionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -796,11 +800,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Location, otherT._Location)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1363,7 +1368,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; @@ -1391,7 +1397,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SpecialCourtesy, otherT._SpecialCourtesy)) return false; if(!comparer.Equals(_Admission, otherT._Admission)) return false; if(!comparer.ListEquals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs b/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs index 9fc55249c..ba6dc28f5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EncounterHistory.cs @@ -131,9 +131,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Location, otherT._Location)) return false; if(!comparer.Equals(_Form, otherT._Form)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -444,7 +445,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EncounterHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; @@ -457,7 +459,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PlannedEndDateElement, otherT._PlannedEndDateElement)) return false; if(!comparer.Equals(_Length, otherT._Length)) return false; if(!comparer.ListEquals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs index 5dd91e877..d99244587 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Endpoint.cs @@ -189,9 +189,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_MimeTypeElement, otherT._MimeTypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -519,7 +520,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_ConnectionType, otherT._ConnectionType)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -531,7 +533,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs index ef97fb528..4d532d931 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentRequest.cs @@ -223,14 +223,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_Candidate, otherT._Candidate)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs index b9b9ef4aa..092f55c7a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EnrollmentResponse.cs @@ -301,7 +301,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_OutcomeElement, otherT._OutcomeElement)) return false; @@ -309,7 +310,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs index 7bc471297..0f8c08d8d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EpisodeOfCare.cs @@ -197,9 +197,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -315,9 +316,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReasonComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Use, otherT._Use)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.ListEquals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -431,9 +433,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -723,7 +726,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; @@ -736,7 +740,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; if(!comparer.ListEquals(_CareTeam, otherT._CareTeam)) return false; if(!comparer.ListEquals(_Account, otherT._Account)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs index a38c5d521..5f165c895 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EventDefinition.cs @@ -766,7 +766,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -796,7 +797,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs b/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs index 0a2f88a14..0e9202d6d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Evidence.cs @@ -202,13 +202,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_VariableRole, otherT._VariableRole)) return false; if(!comparer.Equals(_Observed, otherT._Observed)) return false; if(!comparer.Equals(_Intended, otherT._Intended)) return false; if(!comparer.Equals(_DirectnessMatch, otherT._DirectnessMatch)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -504,7 +505,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatisticComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_StatisticType, otherT._StatisticType)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -514,7 +516,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SampleSize, otherT._SampleSize)) return false; if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; if(!comparer.ListEquals(_ModelCharacteristic, otherT._ModelCharacteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -780,12 +782,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampleSizeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_NumberOfStudiesElement, otherT._NumberOfStudiesElement)) return false; if(!comparer.Equals(_NumberOfParticipantsElement, otherT._NumberOfParticipantsElement)) return false; if(!comparer.Equals(_KnownDataCountElement, otherT._KnownDataCountElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1019,14 +1022,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttributeEstimateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_LevelElement, otherT._LevelElement)) return false; if(!comparer.Equals(_Range, otherT._Range)) return false; if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1203,11 +1207,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ModelCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Variable, otherT._Variable)) return false; if(!comparer.ListEquals(_AttributeEstimate, otherT._AttributeEstimate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1393,12 +1398,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_VariableDefinition, otherT._VariableDefinition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_VariableDefinition, otherT._VariableDefinition)) return false; if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; if(!comparer.ListEquals(_ValueCategory, otherT._ValueCategory)) return false; if(!comparer.ListEquals(_ValueQuantity, otherT._ValueQuantity)) return false; if(!comparer.ListEquals(_ValueRange, otherT._ValueRange)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1619,13 +1625,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CertaintyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Rating, otherT._Rating)) return false; if(!comparer.Equals(_RaterElement, otherT._RaterElement)) return false; if(!comparer.ListEquals(_Subcomponent, otherT._Subcomponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2403,7 +2410,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Evidence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2434,7 +2442,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_StudyDesign, otherT._StudyDesign)) return false; if(!comparer.ListEquals(_Statistic, otherT._Statistic)) return false; if(!comparer.ListEquals(_Certainty, otherT._Certainty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs b/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs index ffdb4288f..29b5beb65 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EvidenceReport.cs @@ -187,9 +187,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubjectComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -345,11 +346,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -493,9 +495,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -665,11 +668,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -980,7 +984,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Focus, otherT._Focus)) return false; if(!comparer.Equals(_FocusReference, otherT._FocusReference)) return false; if(!comparer.ListEquals(_Author, otherT._Author)) return false; @@ -992,7 +997,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_EntryQuantity, otherT._EntryQuantity)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1447,7 +1452,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_UseContext, otherT._UseContext)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; @@ -1465,7 +1471,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Endorser, otherT._Endorser)) return false; if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs b/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs index 744912489..8224d5ff8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/EvidenceVariable.cs @@ -431,7 +431,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; @@ -445,7 +446,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Instances, otherT._Instances)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; if(!comparer.ListEquals(_TimeFromEvent, otherT._TimeFromEvent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -691,12 +692,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DefinitionByTypeAndValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Device, otherT._Device)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -875,10 +877,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DefinitionByCombinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ThresholdElement, otherT._ThresholdElement)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1053,12 +1056,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TimeFromEventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Event, otherT._Event)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Range, otherT._Range)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1203,9 +1207,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CategoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1966,7 +1971,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceVariable otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1996,7 +2002,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.Equals(_HandlingElement, otherT._HandlingElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs b/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs index 0754949dd..c059b67e3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExampleScenario.cs @@ -216,11 +216,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -510,7 +511,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; if(!comparer.Equals(_StructureType, otherT._StructureType)) return false; if(!comparer.Equals(_StructureVersionElement, otherT._StructureVersionElement)) return false; if(!comparer.Equals(_StructureProfile, otherT._StructureProfile)) return false; @@ -519,7 +521,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Version, otherT._Version)) return false; if(!comparer.ListEquals(_ContainedInstance, otherT._ContainedInstance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -754,11 +756,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -913,9 +916,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainedInstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InstanceReferenceElement, otherT._InstanceReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_InstanceReferenceElement, otherT._InstanceReferenceElement)) return false; if(!comparer.Equals(_VersionReferenceElement, otherT._VersionReferenceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1130,12 +1134,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_PreConditionsElement, otherT._PreConditionsElement)) return false; if(!comparer.Equals(_PostConditionsElement, otherT._PostConditionsElement)) return false; if(!comparer.ListEquals(_Step, otherT._Step)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1368,13 +1373,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StepComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Process, otherT._Process)) return false; if(!comparer.Equals(_WorkflowElement, otherT._WorkflowElement)) return false; if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_Alternative, otherT._Alternative)) return false; if(!comparer.Equals(_PauseElement, otherT._PauseElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1701,7 +1707,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_InitiatorElement, otherT._InitiatorElement)) return false; if(!comparer.Equals(_ReceiverElement, otherT._ReceiverElement)) return false; @@ -1710,7 +1717,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReceiverActiveElement, otherT._ReceiverActiveElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1915,10 +1922,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AlternativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Step, otherT._Step)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2466,7 +2474,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExampleScenario otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2486,7 +2495,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Process, otherT._Process)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs index 443a85064..b087701be 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExplanationOfBenefit.cs @@ -178,10 +178,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -303,9 +304,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_When, otherT._When)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -419,9 +421,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -609,12 +612,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Specialty, otherT._Specialty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -827,13 +831,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1023,11 +1028,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_OnAdmission, otherT._OnAdmission)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1234,12 +1240,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1423,10 +1430,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1576,10 +1584,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2213,7 +2222,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_CareTeamSequenceElement, otherT._CareTeamSequenceElement)) return false; if(!comparer.ListEquals(_DiagnosisSequenceElement, otherT._DiagnosisSequenceElement)) return false; if(!comparer.ListEquals(_ProcedureSequenceElement, otherT._ProcedureSequenceElement)) return false; @@ -2241,7 +2251,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2537,9 +2547,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemBodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Site, otherT._Site)) return false; if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2695,11 +2706,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReviewOutcomeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Decision, otherT._Decision)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Decision, otherT._Decision)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_PreAuthPeriod, otherT._PreAuthPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2854,11 +2866,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3284,7 +3297,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -3303,7 +3317,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3819,7 +3833,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -3837,7 +3852,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4481,7 +4496,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ItemSequenceElement, otherT._ItemSequenceElement)) return false; if(!comparer.ListEquals(_DetailSequenceElement, otherT._DetailSequenceElement)) return false; if(!comparer.ListEquals(_SubDetailSequenceElement, otherT._SubDetailSequenceElement)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; @@ -4505,7 +4521,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4773,9 +4789,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemBodySiteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Site, otherT._Site)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Site, otherT._Site)) return false; if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5109,7 +5126,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; @@ -5124,7 +5142,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5534,7 +5552,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemDetailSubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_ProductOrService, otherT._ProductOrService)) return false; if(!comparer.Equals(_ProductOrServiceEnd, otherT._ProductOrServiceEnd)) return false; @@ -5548,7 +5567,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.Equals(_ReviewOutcome, otherT._ReviewOutcome)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5746,9 +5765,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TotalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5931,13 +5951,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -6135,11 +6156,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -6395,7 +6417,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -6403,7 +6426,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Term, otherT._Term)) return false; if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -6575,10 +6598,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -7507,7 +7531,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_TraceNumber, otherT._TraceNumber)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -7556,7 +7581,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; if(!comparer.Equals(_BenefitPeriod, otherT._BenefitPeriod)) return false; if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Expression.cs b/src/Hl7.Fhir.R5/Model/Generated/Expression.cs index 9460b813d..619da65aa 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Expression.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Expression.cs @@ -228,12 +228,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Expression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs b/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs index cbac9f9f2..c660fb6c7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ExtendedContactDetail.cs @@ -172,13 +172,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExtendedContactDetail otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs index a82d70f20..0dd39e18d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/FamilyMemberHistory.cs @@ -164,9 +164,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -339,12 +340,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; if(!comparer.Equals(_Onset, otherT._Onset)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -538,12 +540,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_ContributedToDeathElement, otherT._ContributedToDeathElement)) return false; if(!comparer.Equals(_Performed, otherT._Performed)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1019,7 +1022,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1038,7 +1042,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; if(!comparer.ListEquals(_Procedure, otherT._Procedure)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Flag.cs b/src/Hl7.Fhir.R5/Model/Generated/Flag.cs index a51862636..e9872ac2e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Flag.cs @@ -254,7 +254,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -262,7 +263,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs b/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs index 6cdeca778..c1171f3e9 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/FormularyItem.cs @@ -173,10 +173,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FormularyItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs index aab193f1f..1077199b7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GenomicStudy.cs @@ -475,7 +475,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnalysisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_MethodType, otherT._MethodType)) return false; if(!comparer.ListEquals(_ChangeType, otherT._ChangeType)) return false; if(!comparer.Equals(_GenomeBuild, otherT._GenomeBuild)) return false; @@ -493,7 +494,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Output, otherT._Output)) return false; if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; if(!comparer.ListEquals(_Device, otherT._Device)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -732,10 +733,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_File, otherT._File)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_File, otherT._File)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_GeneratedBy, otherT._GeneratedBy)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -852,9 +854,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_File, otherT._File)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_File, otherT._File)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -963,9 +966,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1074,9 +1078,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Device, otherT._Device)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Device, otherT._Device)) return false; if(!comparer.Equals(_Function, otherT._Function)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1451,7 +1456,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GenomicStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -1466,7 +1472,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Analysis, otherT._Analysis)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Goal.cs b/src/Hl7.Fhir.R5/Model/Generated/Goal.cs index ac15556c3..68deb2eaf 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Goal.cs @@ -212,10 +212,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -599,7 +600,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_LifecycleStatusElement, otherT._LifecycleStatusElement)) return false; if(!comparer.Equals(_AchievementStatus, otherT._AchievementStatus)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -615,7 +617,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Outcome, otherT._Outcome)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs index 12b20d372..4dcc19358 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GraphDefinition.cs @@ -271,11 +271,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NodeIdElement, otherT._NodeIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NodeIdElement, otherT._NodeIdElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -617,7 +618,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; @@ -626,7 +628,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; if(!comparer.Equals(_ParamsElement, otherT._ParamsElement)) return false; if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -908,12 +910,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1491,7 +1494,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1511,7 +1515,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.ListEquals(_Node, otherT._Node)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Group.cs b/src/Hl7.Fhir.R5/Model/Generated/Group.cs index e6358ccb4..61a56af72 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Group.cs @@ -270,11 +270,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -430,10 +431,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -763,7 +765,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_MembershipElement, otherT._MembershipElement)) return false; @@ -774,7 +777,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ManagingEntity, otherT._ManagingEntity)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_Member, otherT._Member)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs index d5a90b728..f7625cc4e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/GuidanceResponse.cs @@ -380,7 +380,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequestIdentifier, otherT._RequestIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Module, otherT._Module)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -394,7 +395,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; if(!comparer.ListEquals(_Result, otherT._Result)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs index c04b24680..890bfbb83 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/HealthcareService.cs @@ -139,9 +139,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -640,7 +641,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; if(!comparer.ListEquals(_OfferedIn, otherT._OfferedIn)) return false; @@ -663,7 +665,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AppointmentRequiredElement, otherT._AppointmentRequiredElement)) return false; if(!comparer.ListEquals(_Availability, otherT._Availability)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs index 74bde3184..40e8cad82 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/HumanName.cs @@ -337,14 +337,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs index 4d7b44c5c..ad9466fc5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImagingSelection.cs @@ -243,9 +243,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -464,13 +465,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; if(!comparer.ListEquals(_SubsetElement, otherT._SubsetElement)) return false; if(!comparer.ListEquals(_ImageRegion2D, otherT._ImageRegion2D)) return false; if(!comparer.ListEquals(_ImageRegion3D, otherT._ImageRegion3D)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -646,9 +648,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImageRegion2DComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegionTypeElement, otherT._RegionTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RegionTypeElement, otherT._RegionTypeElement)) return false; if(!comparer.ListEquals(_CoordinateElement, otherT._CoordinateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -795,9 +798,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImageRegion3DComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegionTypeElement, otherT._RegionTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RegionTypeElement, otherT._RegionTypeElement)) return false; if(!comparer.ListEquals(_CoordinateElement, otherT._CoordinateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1218,7 +1222,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImagingSelection otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; @@ -1235,7 +1240,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs index ae4264242..230e378e2 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImagingStudy.cs @@ -394,7 +394,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Modality, otherT._Modality)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -406,7 +407,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,9 +592,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -779,11 +781,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_SopClass, otherT._SopClass)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1222,7 +1225,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Modality, otherT._Modality)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -1240,7 +1244,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Series, otherT._Series)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs b/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs index 48005ba37..cf4ed8069 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Immunization.cs @@ -158,9 +158,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -274,9 +275,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProgramEligibilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Program, otherT._Program)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Program, otherT._Program)) return false; if(!comparer.Equals(_ProgramStatus, otherT._ProgramStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -431,10 +433,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Manifestation, otherT._Manifestation)) return false; if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -643,12 +646,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProtocolAppliedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.Equals(_DoseNumberElement, otherT._DoseNumberElement)) return false; if(!comparer.Equals(_SeriesDosesElement, otherT._SeriesDosesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1240,7 +1244,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_StatusReason, otherT._StatusReason)) return false; @@ -1268,7 +1273,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FundingSource, otherT._FundingSource)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; if(!comparer.ListEquals(_ProtocolApplied, otherT._ProtocolApplied)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs index 60efe8217..a5dea5981 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationEvaluation.cs @@ -396,7 +396,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImmunizationEvaluation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -409,7 +410,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; if(!comparer.Equals(_DoseNumberElement, otherT._DoseNumberElement)) return false; if(!comparer.Equals(_SeriesDosesElement, otherT._SeriesDosesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs index b3bfe3dea..3548704ee 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImmunizationRecommendation.cs @@ -343,7 +343,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_VaccineCode, otherT._VaccineCode)) return false; if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.ListEquals(_ContraindicatedVaccineCode, otherT._ContraindicatedVaccineCode)) return false; if(!comparer.Equals(_ForecastStatus, otherT._ForecastStatus)) return false; @@ -355,7 +356,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SeriesDosesElement, otherT._SeriesDosesElement)) return false; if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -553,9 +554,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -716,12 +718,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs index e3d7332cc..ef608b1c8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ImplementationGuide.cs @@ -2335,11 +2335,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependsOnComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_PackageIdElement, otherT._PackageIdElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2498,9 +2499,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2657,12 +2659,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Grouping, otherT._Grouping)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; if(!comparer.Equals(_Page, otherT._Page)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Template, otherT._Template)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2825,9 +2828,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3110,14 +3114,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.ListEquals(_FhirVersionElement, otherT._FhirVersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_IsExampleElement, otherT._IsExampleElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_GroupingIdElement, otherT._GroupingIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3358,12 +3363,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Source, otherT._Source)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_GenerationElement, otherT._GenerationElement)) return false; if(!comparer.ListEquals(_Page, otherT._Page)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3512,9 +3518,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3682,10 +3689,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TemplateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_ScopeElement, otherT._ScopeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3899,12 +3907,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RenderingElement, otherT._RenderingElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Page, otherT._Page)) return false; if(!comparer.ListEquals(_ImageElement, otherT._ImageElement)) return false; if(!comparer.ListEquals(_OtherElement, otherT._OtherElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4115,11 +4124,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Reference, otherT._Reference)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_IsExampleElement, otherT._IsExampleElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_RelativePathElement, otherT._RelativePathElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4307,10 +4317,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManifestPageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.ListEquals(_AnchorElement, otherT._AnchorElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4969,7 +4980,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -4993,7 +5005,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Global, otherT._Global)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_Manifest, otherT._Manifest)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs b/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs index 902557339..995f81fde 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Ingredient.cs @@ -171,9 +171,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManufacturerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; if(!comparer.Equals(_Manufacturer, otherT._Manufacturer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -283,9 +284,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -531,7 +533,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Presentation, otherT._Presentation)) return false; if(!comparer.Equals(_TextPresentationElement, otherT._TextPresentationElement)) return false; if(!comparer.Equals(_Concentration, otherT._Concentration)) return false; if(!comparer.Equals(_TextConcentrationElement, otherT._TextConcentrationElement)) return false; @@ -539,7 +542,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; if(!comparer.ListEquals(_Country, otherT._Country)) return false; if(!comparer.ListEquals(_ReferenceStrength, otherT._ReferenceStrength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -741,11 +744,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceStrengthComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; if(!comparer.Equals(_MeasurementPointElement, otherT._MeasurementPointElement)) return false; if(!comparer.ListEquals(_Country, otherT._Country)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1024,7 +1028,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Ingredient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_For, otherT._For)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; @@ -1034,7 +1039,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; if(!comparer.Equals(_Substance, otherT._Substance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs index 505bb67cc..cf6737508 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InsurancePlan.cs @@ -170,10 +170,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -321,10 +322,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RequirementElement, otherT._RequirementElement)) return false; if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -441,9 +443,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LimitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -618,13 +621,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_CoverageArea, otherT._CoverageArea)) return false; if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_GeneralCost, otherT._GeneralCost)) return false; if(!comparer.ListEquals(_SpecificCost, otherT._SpecificCost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -820,11 +824,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GeneralCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_GroupSizeElement, otherT._GroupSizeElement)) return false; if(!comparer.Equals(_Cost, otherT._Cost)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -950,9 +955,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecificCostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Benefit, otherT._Benefit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1064,9 +1070,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanBenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1207,11 +1214,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Applicability, otherT._Applicability)) return false; if(!comparer.ListEquals(_Qualifiers, otherT._Qualifiers)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1559,7 +1567,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsurancePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1573,7 +1582,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_Coverage, otherT._Coverage)) return false; if(!comparer.ListEquals(_Plan, otherT._Plan)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs b/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs index 14a859b10..e3a4eb581 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InventoryItem.cs @@ -207,10 +207,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameType, otherT._NameType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameType, otherT._NameType)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -328,9 +329,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResponsibleOrganizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -472,9 +474,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -600,10 +603,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssociationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AssociationType, otherT._AssociationType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AssociationType, otherT._AssociationType)) return false; if(!comparer.Equals(_RelatedItem, otherT._RelatedItem)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -724,9 +728,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CharacteristicType, otherT._CharacteristicType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CharacteristicType, otherT._CharacteristicType)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -910,12 +915,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1228,7 +1234,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InventoryItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; @@ -1242,7 +1249,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.Equals(_Instance, otherT._Instance)) return false; if(!comparer.Equals(_ProductReference, otherT._ProductReference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs b/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs index 0ea5e9923..b6c4b74bd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/InventoryReport.cs @@ -222,11 +222,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InventoryListingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Location, otherT._Location)) return false; if(!comparer.Equals(_ItemStatus, otherT._ItemStatus)) return false; if(!comparer.Equals(_CountingDateTimeElement, otherT._CountingDateTimeElement)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -363,10 +364,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -638,7 +640,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InventoryReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CountTypeElement, otherT._CountTypeElement)) return false; if(!comparer.Equals(_OperationType, otherT._OperationType)) return false; @@ -648,7 +651,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReportingPeriod, otherT._ReportingPeriod)) return false; if(!comparer.ListEquals(_InventoryListing, otherT._InventoryListing)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs b/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs index 2bb7a5266..1b0acd022 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Invoice.cs @@ -169,9 +169,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -331,11 +332,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LineItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Serviced, otherT._Serviced)) return false; if(!comparer.Equals(_ChargeItem, otherT._ChargeItem)) return false; if(!comparer.ListEquals(_PriceComponent, otherT._PriceComponent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -762,7 +764,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Invoice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CancelledReasonElement, otherT._CancelledReasonElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -780,7 +783,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TotalGross, otherT._TotalGross)) return false; if(!comparer.Equals(_PaymentTermsElement, otherT._PaymentTermsElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Library.cs b/src/Hl7.Fhir.R5/Model/Generated/Library.cs index 5713b7a55..5bcbd7b89 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Library.cs @@ -812,7 +812,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -845,7 +846,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs b/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs index 0c2248b28..993857b58 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Linkage.cs @@ -175,9 +175,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -303,10 +304,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/List.cs b/src/Hl7.Fhir.R5/Model/Generated/List.cs index 6ef5f3c8d..09445c13a 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/List.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/List.cs @@ -217,11 +217,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Flag, otherT._Flag)) return false; if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -564,7 +565,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -577,7 +579,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Location.cs b/src/Hl7.Fhir.R5/Model/Generated/Location.cs index 2e002462c..7ac2441f5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Location.cs @@ -238,10 +238,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -668,7 +669,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -686,7 +688,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HoursOfOperation, otherT._HoursOfOperation)) return false; if(!comparer.ListEquals(_VirtualService, otherT._VirtualService)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs index c6af1c82e..87be1cb28 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ManufacturedItemDefinition.cs @@ -125,9 +125,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -296,13 +297,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Function, otherT._Function)) return false; if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; if(!comparer.ListEquals(_Constituent, otherT._Constituent)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -469,11 +471,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConstituentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; if(!comparer.ListEquals(_Location, otherT._Location)) return false; if(!comparer.ListEquals(_Function, otherT._Function)) return false; if(!comparer.ListEquals(_HasIngredient, otherT._HasIngredient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -740,7 +743,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ManufacturedItemDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ManufacturedDoseForm, otherT._ManufacturedDoseForm)) return false; @@ -750,7 +754,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs b/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs index 4f3b8c2bb..a8acb9c39 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MarketingStatus.cs @@ -165,12 +165,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MarketingStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Country, otherT._Country)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_DateRange, otherT._DateRange)) return false; if(!comparer.Equals(_RestoreDateElement, otherT._RestoreDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs index 41dd39f84..8d893df8b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Measure.cs @@ -142,9 +142,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -501,7 +502,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; @@ -514,7 +516,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_LibraryElement, otherT._LibraryElement)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -820,14 +822,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; if(!comparer.Equals(_GroupDefinition, otherT._GroupDefinition)) return false; if(!comparer.Equals(_InputPopulationIdElement, otherT._InputPopulationIdElement)) return false; if(!comparer.Equals(_AggregateMethod, otherT._AggregateMethod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1062,13 +1065,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; if(!comparer.Equals(_GroupDefinition, otherT._GroupDefinition)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1282,12 +1286,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; if(!comparer.Equals(_GroupDefinition, otherT._GroupDefinition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1495,12 +1500,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Criteria, otherT._Criteria)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2615,7 +2621,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2660,7 +2667,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_GuidanceElement, otherT._GuidanceElement)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs index 1704b31b2..cfc3e9a4f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MeasureReport.cs @@ -288,13 +288,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -526,13 +527,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; if(!comparer.ListEquals(_SubjectReport, otherT._SubjectReport)) return false; if(!comparer.Equals(_Subjects, otherT._Subjects)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -701,10 +703,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -856,11 +859,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScore, otherT._MeasureScore)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1019,10 +1023,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1233,13 +1238,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_SubjectResults, otherT._SubjectResults)) return false; if(!comparer.ListEquals(_SubjectReport, otherT._SubjectReport)) return false; if(!comparer.Equals(_Subjects, otherT._Subjects)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1677,7 +1683,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_DataUpdateTypeElement, otherT._DataUpdateTypeElement)) return false; @@ -1694,7 +1701,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; if(!comparer.ListEquals(_EvaluatedResource, otherT._EvaluatedResource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Medication.cs b/src/Hl7.Fhir.R5/Model/Generated/Medication.cs index 735cfc44d..dfab1ddf9 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Medication.cs @@ -189,10 +189,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -339,9 +340,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -560,7 +562,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_MarketingAuthorizationHolder, otherT._MarketingAuthorizationHolder)) return false; @@ -569,7 +572,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.Equals(_Batch, otherT._Batch)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs index b9fb112fd..624ff3e15 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationAdministration.cs @@ -180,9 +180,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -368,13 +369,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Site, otherT._Site)) return false; if(!comparer.Equals(_Route, otherT._Route)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Dose, otherT._Dose)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -848,7 +850,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -869,7 +872,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs index 2c8620846..f2e7a0635 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationDispense.cs @@ -194,9 +194,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -355,11 +356,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_ResponsibleParty, otherT._ResponsibleParty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -949,7 +951,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -976,7 +979,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_DosageInstruction, otherT._DosageInstruction)) return false; if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs index df9ae185a..0e65536a4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationKnowledge.cs @@ -158,9 +158,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedMedicationKnowledgeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -269,9 +270,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonographComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -430,11 +432,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CostComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EffectiveDate, otherT._EffectiveDate)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_EffectiveDate, otherT._EffectiveDate)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_Cost, otherT._Cost)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -573,9 +576,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonitoringProgramComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -687,9 +691,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IndicationGuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; if(!comparer.ListEquals(_DosingGuideline, otherT._DosingGuideline)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -829,11 +834,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosingGuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TreatmentIntent, otherT._TreatmentIntent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TreatmentIntent, otherT._TreatmentIntent)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; if(!comparer.Equals(_AdministrationTreatment, otherT._AdministrationTreatment)) return false; if(!comparer.ListEquals(_PatientCharacteristic, otherT._PatientCharacteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -956,9 +962,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1071,9 +1078,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PatientCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1198,10 +1206,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicineClassificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1321,9 +1330,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Cost, otherT._Cost)) return false; if(!comparer.Equals(_PackagedProduct, otherT._PackagedProduct)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1478,11 +1488,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StorageGuidelineComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_StabilityDuration, otherT._StabilityDuration)) return false; if(!comparer.ListEquals(_EnvironmentalSetting, otherT._EnvironmentalSetting)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1610,9 +1621,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnvironmentalSettingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1752,11 +1764,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RegulatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RegulatoryAuthority, otherT._RegulatoryAuthority)) return false; if(!comparer.ListEquals(_Substitution, otherT._Substitution)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_MaxDispense, otherT._MaxDispense)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1894,9 +1907,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2004,9 +2018,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MaxDispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2166,12 +2181,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DefinitionalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_DoseForm, otherT._DoseForm)) return false; if(!comparer.ListEquals(_IntendedRoute, otherT._IntendedRoute)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.ListEquals(_DrugCharacteristic, otherT._DrugCharacteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2321,10 +2337,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Strength, otherT._Strength)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2444,9 +2461,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DrugCharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2866,7 +2884,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationKnowledge otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; @@ -2886,7 +2905,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_StorageGuideline, otherT._StorageGuideline)) return false; if(!comparer.ListEquals(_Regulatory, otherT._Regulatory)) return false; if(!comparer.Equals(_Definitional, otherT._Definitional)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs index afa374268..dfa586f2f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationRequest.cs @@ -365,7 +365,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_InitialFill, otherT._InitialFill)) return false; if(!comparer.Equals(_DispenseInterval, otherT._DispenseInterval)) return false; if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; @@ -374,7 +375,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Dispenser, otherT._Dispenser)) return false; if(!comparer.ListEquals(_DispenserInstruction, otherT._DispenserInstruction)) return false; if(!comparer.Equals(_DoseAdministrationAid, otherT._DoseAdministrationAid)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -534,9 +535,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InitialFillComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -651,9 +653,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1353,7 +1356,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; @@ -1386,7 +1390,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DispenseRequest, otherT._DispenseRequest)) return false; if(!comparer.Equals(_Substitution, otherT._Substitution)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs index 6e0d97156..a79ae383e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicationStatement.cs @@ -159,9 +159,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdherenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -543,7 +544,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -560,7 +562,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_RenderedDosageInstructionElement, otherT._RenderedDosageInstructionElement)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; if(!comparer.Equals(_Adherence, otherT._Adherence)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs index 45712a138..c6febfafc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MedicinalProductDefinition.cs @@ -127,9 +127,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Contact, otherT._Contact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -283,11 +284,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Part, otherT._Part)) return false; if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,9 +428,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PartComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PartElement, otherT._PartElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -557,10 +560,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UsageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Country, otherT._Country)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Country, otherT._Country)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -679,9 +683,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CrossReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Product, otherT._Product)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -823,11 +828,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_EffectiveDate, otherT._EffectiveDate)) return false; if(!comparer.ListEquals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_ConfidentialityIndicator, otherT._ConfidentialityIndicator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -955,9 +961,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1531,7 +1538,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicinalProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Domain, otherT._Domain)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; @@ -1560,7 +1568,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_CrossReference, otherT._CrossReference)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs index 5d11d627b..e5a6ea1c5 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MessageDefinition.cs @@ -281,11 +281,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -441,9 +442,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1174,7 +1176,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1200,7 +1203,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; if(!comparer.Equals(_GraphElement, otherT._GraphElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs index ed1baa51a..60a934128 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MessageHeader.cs @@ -205,11 +205,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Endpoint, otherT._Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -423,12 +424,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Endpoint, otherT._Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_Contact, otherT._Contact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -594,10 +596,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Details, otherT._Details)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -841,7 +844,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_Sender, otherT._Sender)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; @@ -851,7 +855,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Response, otherT._Response)) return false; if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs b/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs index 0b1f02568..861d6a7d8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MolecularSequence.cs @@ -252,12 +252,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelativeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CoordinateSystem, otherT._CoordinateSystem)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CoordinateSystem, otherT._CoordinateSystem)) return false; if(!comparer.Equals(_OrdinalPositionElement, otherT._OrdinalPositionElement)) return false; if(!comparer.Equals(_SequenceRange, otherT._SequenceRange)) return false; if(!comparer.Equals(_StartingSequence, otherT._StartingSequence)) return false; if(!comparer.ListEquals(_Edit, otherT._Edit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -528,14 +529,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StartingSequenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GenomeAssembly, otherT._GenomeAssembly)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_GenomeAssembly, otherT._GenomeAssembly)) return false; if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; if(!comparer.Equals(_Sequence, otherT._Sequence)) return false; if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; if(!comparer.Equals(_OrientationElement, otherT._OrientationElement)) return false; if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -765,11 +767,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EditComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_ReplacementSequenceElement, otherT._ReplacementSequenceElement)) return false; if(!comparer.Equals(_ReplacedSequenceElement, otherT._ReplacedSequenceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1037,7 +1040,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MolecularSequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; @@ -1047,7 +1051,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_LiteralElement, otherT._LiteralElement)) return false; if(!comparer.ListEquals(_Formatted, otherT._Formatted)) return false; if(!comparer.ListEquals(_Relative, otherT._Relative)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs b/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs index 17b2f6f69..bd6059986 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/MonetaryComponent.cs @@ -215,11 +215,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonetaryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Money.cs b/src/Hl7.Fhir.R5/Model/Generated/Money.cs index dbeb385ed..9c39ff75f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Money.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Money.cs @@ -139,9 +139,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Money otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_CurrencyElement, otherT._CurrencyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs index 56a9b2e51..8d3d1bb63 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NamingSystem.cs @@ -336,13 +336,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_AuthoritativeElement, otherT._AuthoritativeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1151,7 +1152,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1182,7 +1184,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RelatedArtifact, otherT._RelatedArtifact)) return false; if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs index 3cfdb22b7..bdf22a030 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionIntake.cs @@ -213,14 +213,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConsumedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NutritionProduct, otherT._NutritionProduct)) return false; if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; if(!comparer.Equals(_NotConsumedElement, otherT._NotConsumedElement)) return false; if(!comparer.Equals(_NotConsumedReason, otherT._NotConsumedReason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -369,9 +370,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientLabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Nutrient, otherT._Nutrient)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Nutrient, otherT._Nutrient)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -485,9 +487,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -937,7 +940,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutritionIntake otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -957,7 +961,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs index 9a1f6f271..e40cecaa8 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionOrder.cs @@ -204,13 +204,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -379,10 +380,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OralDietScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; if(!comparer.Equals(_AsNeededFor, otherT._AsNeededFor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -500,9 +502,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -614,9 +617,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -799,12 +803,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -966,10 +971,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; if(!comparer.Equals(_AsNeededFor, otherT._AsNeededFor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1219,7 +1225,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; if(!comparer.ListEquals(_DeliveryDevice, otherT._DeliveryDevice)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; @@ -1228,7 +1235,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1417,10 +1424,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1554,10 +1562,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1705,10 +1714,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnteralFormulaScheduleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_AsNeededElement, otherT._AsNeededElement)) return false; if(!comparer.Equals(_AsNeededFor, otherT._AsNeededFor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2270,7 +2280,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_InstantiatesElement, otherT._InstantiatesElement)) return false; @@ -2293,7 +2304,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs b/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs index 898c8e166..bd17fbc44 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/NutritionProduct.cs @@ -156,9 +156,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -267,9 +268,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.ListEquals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -381,9 +383,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -624,14 +627,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; if(!comparer.Equals(_UseByElement, otherT._UseByElement)) return false; if(!comparer.Equals(_BiologicalSourceEvent, otherT._BiologicalSourceEvent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -903,7 +907,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutritionProduct otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.ListEquals(_Manufacturer, otherT._Manufacturer)) return false; @@ -913,7 +918,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Observation.cs b/src/Hl7.Fhir.R5/Model/Generated/Observation.cs index 9601c0b0c..154b4c412 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Observation.cs @@ -205,10 +205,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TriggeredByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Observation, otherT._Observation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Observation, otherT._Observation)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -415,14 +416,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Low, otherT._Low)) return false; if(!comparer.Equals(_High, otherT._High)) return false; if(!comparer.Equals(_NormalValue, otherT._NormalValue)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -619,12 +621,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; if(!comparer.ListEquals(_Interpretation, otherT._Interpretation)) return false; if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1174,7 +1177,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Instantiates, otherT._Instantiates)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_TriggeredBy, otherT._TriggeredBy)) return false; @@ -1201,7 +1205,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; if(!comparer.ListEquals(_DerivedFrom, otherT._DerivedFrom)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs index db895e208..77a1d2b42 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ObservationDefinition.cs @@ -483,7 +483,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualifiedValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Context, otherT._Context)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Context, otherT._Context)) return false; if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; if(!comparer.Equals(_Age, otherT._Age)) return false; @@ -495,7 +496,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_NormalCodedValueSetElement, otherT._NormalCodedValueSetElement)) return false; if(!comparer.Equals(_AbnormalCodedValueSetElement, otherT._AbnormalCodedValueSetElement)) return false; if(!comparer.Equals(_CriticalCodedValueSetElement, otherT._CriticalCodedValueSetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -729,11 +730,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_PermittedDataTypeElement, otherT._PermittedDataTypeElement)) return false; if(!comparer.ListEquals(_PermittedUnit, otherT._PermittedUnit)) return false; if(!comparer.ListEquals(_QualifiedValue, otherT._QualifiedValue)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1661,7 +1663,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ObservationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1698,7 +1701,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_QualifiedValue, otherT._QualifiedValue)) return false; if(!comparer.ListEquals(_HasMember, otherT._HasMember)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs index 9407ca96b..328923e55 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/OperationDefinition.cs @@ -509,7 +509,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.ListEquals(_ScopeElement, otherT._ScopeElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; @@ -522,7 +523,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Binding, otherT._Binding)) return false; if(!comparer.ListEquals(_ReferencedFrom, otherT._ReferencedFrom)) return false; if(!comparer.ListEquals(_Part, otherT._Part)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -743,9 +744,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; if(!comparer.Equals(_ValueSetElement, otherT._ValueSetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -887,9 +889,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferencedFromComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1034,9 +1037,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1895,7 +1899,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1925,7 +1930,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OutputProfileElement, otherT._OutputProfileElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs index bd837c9f0..108be79aa 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Organization.cs @@ -160,11 +160,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -460,7 +461,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -470,7 +472,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs b/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs index 5a185d58d..9606e1141 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/OrganizationAffiliation.cs @@ -286,7 +286,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrganizationAffiliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; @@ -298,7 +299,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_HealthcareService, otherT._HealthcareService)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs index 0543e0092..1fb88683e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PackagedProductDefinition.cs @@ -122,9 +122,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LegalStatusOfSupplyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Jurisdiction, otherT._Jurisdiction)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -403,7 +404,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ComponentPartElement, otherT._ComponentPartElement)) return false; if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; @@ -414,7 +416,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_ContainedItem, otherT._ContainedItem)) return false; if(!comparer.ListEquals(_Packaging, otherT._Packaging)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -588,9 +590,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -698,9 +701,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1054,7 +1058,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackagedProductDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_PackageFor, otherT._PackageFor)) return false; @@ -1069,7 +1074,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_AttachedDocument, otherT._AttachedDocument)) return false; if(!comparer.Equals(_Packaging, otherT._Packaging)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs index 67e3b9a33..02824f781 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ParameterDefinition.cs @@ -291,14 +291,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Patient.cs b/src/Hl7.Fhir.R5/Model/Generated/Patient.cs index 470c6a573..b4a1fda4e 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Patient.cs @@ -252,14 +252,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -421,9 +422,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -554,9 +556,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Other, otherT._Other)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -913,7 +916,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -929,7 +933,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs index c016f68da..019071f49 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PaymentNotice.cs @@ -317,7 +317,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; @@ -329,7 +330,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Recipient, otherT._Recipient)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs index 0caff3580..ecc8b2abc 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PaymentReconciliation.cs @@ -346,7 +346,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_TargetItem, otherT._TargetItem)) return false; @@ -359,7 +360,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Responsible, otherT._Responsible)) return false; if(!comparer.Equals(_Payee, otherT._Payee)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -578,9 +579,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1246,7 +1248,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Kind, otherT._Kind)) return false; @@ -1275,7 +1278,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Allocation, otherT._Allocation)) return false; if(!comparer.Equals(_FormCode, otherT._FormCode)) return false; if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs index 0869a8bb0..e3c543b01 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Permission.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Permission.cs @@ -208,9 +208,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not JustificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Basis, otherT._Basis)) return false; if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -369,11 +370,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; if(!comparer.ListEquals(_Limit, otherT._Limit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -528,11 +530,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Security, otherT._Security)) return false; if(!comparer.ListEquals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -674,9 +677,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -804,10 +808,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; if(!comparer.ListEquals(_Purpose, otherT._Purpose)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1036,14 +1041,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Permission otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Asserter, otherT._Asserter)) return false; if(!comparer.ListEquals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Validity, otherT._Validity)) return false; if(!comparer.Equals(_Justification, otherT._Justification)) return false; if(!comparer.Equals(_CombiningElement, otherT._CombiningElement)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Person.cs b/src/Hl7.Fhir.R5/Model/Generated/Person.cs index 5ffc6312f..8cba1cf5b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Person.cs @@ -179,9 +179,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -308,9 +309,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -619,7 +621,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -632,7 +635,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs index dd7aee19c..4ab52d176 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PlanDefinition.cs @@ -205,14 +205,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Description, otherT._Description)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.Equals(_Start, otherT._Start)) return false; if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -374,10 +375,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -539,10 +541,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Option, otherT._Option)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -722,11 +725,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1461,7 +1465,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -1490,7 +1495,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1808,9 +1813,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1964,10 +1970,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2128,10 +2135,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2330,11 +2338,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_EndRelationshipElement, otherT._EndRelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2565,13 +2574,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActorIdElement, otherT._ActorIdElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Function, otherT._Function)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2725,9 +2735,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3572,7 +3583,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -3607,7 +3619,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; if(!comparer.Equals(_AsNeeded, otherT._AsNeeded)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs index 28f9b3262..7a0c4ffea 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Practitioner.cs @@ -161,11 +161,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -309,9 +310,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -589,7 +591,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -600,7 +603,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs index 48c082f47..e98ecd1e9 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/PractitionerRole.cs @@ -319,7 +319,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; @@ -333,7 +334,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; if(!comparer.ListEquals(_Availability, otherT._Availability)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs index 91e6e2d86..03140001b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Procedure.cs @@ -160,11 +160,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -292,9 +293,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -872,7 +874,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -900,7 +903,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; if(!comparer.ListEquals(_Used, otherT._Used)) return false; if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs b/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs index f322f0401..ec5573d04 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ProductShelfLife.cs @@ -124,10 +124,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProductShelfLife otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_SpecialPrecautionsForStorage, otherT._SpecialPrecautionsForStorage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs index 70ccd9b14..91d001741 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Provenance.cs @@ -204,11 +204,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,10 +366,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; if(!comparer.Equals(_What, otherT._What)) return false; if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -677,7 +679,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.Equals(_Occurred, otherT._Occurred)) return false; if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; @@ -690,7 +693,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs index 489c0f0a4..4c21537b3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Questionnaire.cs @@ -792,7 +792,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; @@ -810,7 +811,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_AnswerOption, otherT._AnswerOption)) return false; if(!comparer.ListEquals(_Initial, otherT._Initial)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1086,10 +1087,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; if(!comparer.Equals(_OperatorElement, otherT._OperatorElement)) return false; if(!comparer.Equals(_Answer, otherT._Answer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1227,9 +1229,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerOptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_InitialSelectedElement, otherT._InitialSelectedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1331,8 +1334,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InitialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1992,7 +1996,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2016,7 +2021,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_EffectivePeriod, otherT._EffectivePeriod)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs index 850187aee..da47045cb 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/QuestionnaireResponse.cs @@ -258,12 +258,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -401,9 +402,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -690,7 +692,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_QuestionnaireElement, otherT._QuestionnaireElement)) return false; @@ -701,7 +704,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs b/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs index 4b3c712c2..c46182700 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Ratio.cs @@ -111,9 +111,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs b/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs index 209d22ffa..5a228ae02 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RatioRange.cs @@ -125,10 +125,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RatioRange otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LowNumerator, otherT._LowNumerator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LowNumerator, otherT._LowNumerator)) return false; if(!comparer.Equals(_HighNumerator, otherT._HighNumerator)) return false; if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs b/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs index d7ac84357..f2e84516d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RegulatedAuthorization.cs @@ -173,12 +173,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_Date, otherT._Date)) return false; if(!comparer.ListEquals(_Application, otherT._Application)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -526,7 +527,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RegulatedAuthorization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -541,7 +543,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Regulator, otherT._Regulator)) return false; if(!comparer.ListEquals(_AttachedDocument, otherT._AttachedDocument)) return false; if(!comparer.Equals(_Case, otherT._Case)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs index 9b35debf1..8d7849d5b 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RelatedPerson.cs @@ -143,9 +143,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -439,7 +440,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; @@ -451,7 +453,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs index 22b872166..12914e165 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RequestOrchestration.cs @@ -688,7 +688,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -715,7 +716,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1019,9 +1020,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1175,10 +1177,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1339,10 +1342,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Requirement, otherT._Requirement)) return false; if(!comparer.Equals(_RelatedDataElement, otherT._RelatedDataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1540,11 +1544,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_EndRelationshipElement, otherT._EndRelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1764,13 +1769,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TypeCanonicalElement, otherT._TypeCanonicalElement)) return false; if(!comparer.Equals(_TypeReference, otherT._TypeReference)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1924,9 +1930,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Expression, otherT._Expression)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2373,7 +2380,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestOrchestration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -2391,7 +2399,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs index 07d7f25f2..1bfc64a15 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Requirements.cs @@ -426,7 +426,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.ListEquals(_ConformanceElement, otherT._ConformanceElement)) return false; if(!comparer.Equals(_ConditionalityElement, otherT._ConditionalityElement)) return false; @@ -436,7 +437,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SatisfiedByElement, otherT._SatisfiedByElement)) return false; if(!comparer.ListEquals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1102,7 +1103,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Requirements otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1123,7 +1125,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.ListEquals(_ActorElement, otherT._ActorElement)) return false; if(!comparer.ListEquals(_Statement, otherT._Statement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs index 1ceb6a84f..9518491dd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ResearchStudy.cs @@ -140,9 +140,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LabelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -316,12 +317,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssociatedPartyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.ListEquals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Classifier, otherT._Classifier)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -480,10 +482,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProgressStatusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_State, otherT._State)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_State, otherT._State)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -659,11 +662,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RecruitmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TargetNumberElement, otherT._TargetNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TargetNumberElement, otherT._TargetNumberElement)) return false; if(!comparer.Equals(_ActualNumberElement, otherT._ActualNumberElement)) return false; if(!comparer.Equals(_Eligibility, otherT._Eligibility)) return false; if(!comparer.Equals(_ActualGroup, otherT._ActualGroup)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -896,13 +900,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComparisonGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_IntendedExposure, otherT._IntendedExposure)) return false; if(!comparer.Equals(_ObservedGroup, otherT._ObservedGroup)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1085,10 +1090,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ObjectiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1268,11 +1274,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutcomeMeasureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1961,7 +1968,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1993,7 +2001,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Objective, otherT._Objective)) return false; if(!comparer.ListEquals(_OutcomeMeasure, otherT._OutcomeMeasure)) return false; if(!comparer.ListEquals(_Result, otherT._Result)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs index 87a6eaffe..7a6012b90 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ResearchSubject.cs @@ -307,13 +307,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProgressComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_SubjectState, otherT._SubjectState)) return false; if(!comparer.Equals(_Milestone, otherT._Milestone)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_StartDateElement, otherT._StartDateElement)) return false; if(!comparer.Equals(_EndDateElement, otherT._EndDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -594,7 +595,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; @@ -603,7 +605,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AssignedComparisonGroupElement, otherT._AssignedComparisonGroupElement)) return false; if(!comparer.Equals(_ActualComparisonGroupElement, otherT._ActualComparisonGroupElement)) return false; if(!comparer.ListEquals(_Consent, otherT._Consent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs index fff791fa8..75b35484f 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/RiskAssessment.cs @@ -219,13 +219,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_Probability, otherT._Probability)) return false; if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; if(!comparer.Equals(_When, otherT._When)) return false; if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -601,7 +602,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_Parent, otherT._Parent)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -617,7 +619,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs b/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs index ca6dbae58..115612d14 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SampledData.cs @@ -362,7 +362,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_IntervalElement, otherT._IntervalElement)) return false; if(!comparer.Equals(_IntervalUnitElement, otherT._IntervalUnitElement)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; @@ -372,7 +373,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CodeMapElement, otherT._CodeMapElement)) return false; if(!comparer.Equals(_OffsetsElement, otherT._OffsetsElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs b/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs index 895815778..3a3886182 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Schedule.cs @@ -262,7 +262,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; @@ -271,7 +272,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs index 54502b636..36efaaeab 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SearchParameter.cs @@ -187,9 +187,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1114,7 +1115,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1145,7 +1147,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs index dfd84315d..c3b0e27ec 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/ServiceRequest.cs @@ -128,9 +128,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrderDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ParameterFocus, otherT._ParameterFocus)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ParameterFocus, otherT._ParameterFocus)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -242,9 +243,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -343,8 +345,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PatientInstructionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instruction, otherT._Instruction)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Instruction, otherT._Instruction)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1040,7 +1043,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ServiceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.ListEquals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1073,7 +1077,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_PatientInstruction, otherT._PatientInstruction)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Slot.cs b/src/Hl7.Fhir.R5/Model/Generated/Slot.cs index 4462511e3..dfb1806ad 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Slot.cs @@ -367,7 +367,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; @@ -378,7 +379,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs b/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs index 5d38e6804..57a48b2e4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Specimen.cs @@ -200,9 +200,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FeatureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -422,7 +423,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Collector, otherT._Collector)) return false; if(!comparer.Equals(_Collected, otherT._Collected)) return false; if(!comparer.Equals(_Duration, otherT._Duration)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; @@ -431,7 +433,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.Equals(_FastingStatus, otherT._FastingStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -639,11 +641,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -786,10 +789,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Device, otherT._Device)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Device, otherT._Device)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1155,7 +1159,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -1171,7 +1176,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Container, otherT._Container)) return false; if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs index 937272fa3..a75185356 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SpecimenDefinition.cs @@ -329,7 +329,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TypeTestedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IsDerivedElement, otherT._IsDerivedElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PreferenceElement, otherT._PreferenceElement)) return false; if(!comparer.Equals(_Container, otherT._Container)) return false; @@ -339,7 +340,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RejectionCriterion, otherT._RejectionCriterion)) return false; if(!comparer.ListEquals(_Handling, otherT._Handling)) return false; if(!comparer.ListEquals(_TestingDestination, otherT._TestingDestination)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -622,7 +623,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Material, otherT._Material)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Material, otherT._Material)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Cap, otherT._Cap)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -630,7 +632,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MinimumVolume, otherT._MinimumVolume)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_PreparationElement, otherT._PreparationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -773,8 +775,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdditiveComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Additive, otherT._Additive)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Additive, otherT._Additive)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -921,11 +924,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HandlingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TemperatureQualifier, otherT._TemperatureQualifier)) return false; if(!comparer.Equals(_TemperatureRange, otherT._TemperatureRange)) return false; if(!comparer.Equals(_MaxDuration, otherT._MaxDuration)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1680,7 +1684,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecimenDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1708,7 +1713,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TimeAspectElement, otherT._TimeAspectElement)) return false; if(!comparer.ListEquals(_Collection, otherT._Collection)) return false; if(!comparer.ListEquals(_TypeTested, otherT._TypeTested)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs index ab613a54e..dcfc2b370 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/StructureMap.cs @@ -480,11 +480,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -638,9 +639,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConstComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -871,13 +873,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1108,11 +1111,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1323,13 +1327,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1758,7 +1763,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; @@ -1769,7 +1775,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; if(!comparer.Equals(_LogMessageElement, otherT._LogMessageElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2108,14 +2114,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; if(!comparer.ListEquals(_ListModeElement, otherT._ListModeElement)) return false; if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2246,8 +2253,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2364,9 +2372,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2942,7 +2951,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2963,7 +2973,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; if(!comparer.ListEquals(_Const, otherT._Const)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs b/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs index a65682cc6..9fe0f1d91 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Subscription.cs @@ -278,12 +278,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceTypeElement, otherT._ResourceTypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResourceTypeElement, otherT._ResourceTypeElement)) return false; if(!comparer.Equals(_FilterParameterElement, otherT._FilterParameterElement)) return false; if(!comparer.Equals(_ComparatorElement, otherT._ComparatorElement)) return false; if(!comparer.Equals(_ModifierElement, otherT._ModifierElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -447,9 +448,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -935,7 +937,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TopicElement, otherT._TopicElement)) return false; @@ -952,7 +955,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ContentTypeElement, otherT._ContentTypeElement)) return false; if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; if(!comparer.Equals(_MaxCountElement, otherT._MaxCountElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs index c04ef7278..ae88aaf79 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionStatus.cs @@ -230,11 +230,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotificationEventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_EventNumberElement, otherT._EventNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_EventNumberElement, otherT._EventNumberElement)) return false; if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; if(!comparer.Equals(_Focus, otherT._Focus)) return false; if(!comparer.ListEquals(_AdditionalContext, otherT._AdditionalContext)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -483,14 +484,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubscriptionStatus otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_EventsSinceSubscriptionStartElement, otherT._EventsSinceSubscriptionStartElement)) return false; if(!comparer.ListEquals(_NotificationEvent, otherT._NotificationEvent)) return false; if(!comparer.Equals(_Subscription, otherT._Subscription)) return false; if(!comparer.Equals(_TopicElement, otherT._TopicElement)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs index 25bdd2aea..62b303c7d 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubscriptionTopic.cs @@ -286,12 +286,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.ListEquals(_SupportedInteractionElement, otherT._SupportedInteractionElement)) return false; if(!comparer.Equals(_QueryCriteria, otherT._QueryCriteria)) return false; if(!comparer.Equals(_FhirPathCriteriaElement, otherT._FhirPathCriteriaElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -543,12 +544,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QueryCriteriaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreviousElement, otherT._PreviousElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PreviousElement, otherT._PreviousElement)) return false; if(!comparer.Equals(_ResultForCreateElement, otherT._ResultForCreateElement)) return false; if(!comparer.Equals(_CurrentElement, otherT._CurrentElement)) return false; if(!comparer.Equals(_ResultForDeleteElement, otherT._ResultForDeleteElement)) return false; if(!comparer.Equals(_RequireBothElement, otherT._RequireBothElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -727,10 +729,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventTriggerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Event, otherT._Event)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1007,13 +1010,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CanFilterByComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.Equals(_FilterParameterElement, otherT._FilterParameterElement)) return false; if(!comparer.Equals(_FilterDefinitionElement, otherT._FilterDefinitionElement)) return false; if(!comparer.ListEquals(_ComparatorElement, otherT._ComparatorElement)) return false; if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1220,10 +1224,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotificationShapeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.ListEquals(_IncludeElement, otherT._IncludeElement)) return false; if(!comparer.ListEquals(_RevIncludeElement, otherT._RevIncludeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1892,7 +1897,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubscriptionTopic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1917,7 +1923,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_EventTrigger, otherT._EventTrigger)) return false; if(!comparer.ListEquals(_CanFilterBy, otherT._CanFilterBy)) return false; if(!comparer.ListEquals(_NotificationShape, otherT._NotificationShape)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Substance.cs b/src/Hl7.Fhir.R5/Model/Generated/Substance.cs index 38759e4f1..0b41a30ce 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Substance.cs @@ -156,9 +156,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Substance, otherT._Substance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -421,7 +422,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_InstanceElement, otherT._InstanceElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -430,7 +432,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs index 50bd8b0b7..3b706cfe6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceDefinition.cs @@ -239,7 +239,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MoietyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; @@ -247,7 +248,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_MeasurementType, otherT._MeasurementType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -442,11 +443,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacterizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Technique, otherT._Technique)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Technique, otherT._Technique)) return false; if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_File, otherT._File)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -571,9 +573,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -700,10 +703,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MolecularWeightComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Method, otherT._Method)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -939,7 +943,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Stereochemistry, otherT._Stereochemistry)) return false; if(!comparer.Equals(_OpticalActivity, otherT._OpticalActivity)) return false; if(!comparer.Equals(_MolecularFormulaElement, otherT._MolecularFormulaElement)) return false; if(!comparer.Equals(_MolecularFormulaByMoietyElement, otherT._MolecularFormulaByMoietyElement)) return false; @@ -947,7 +952,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Technique, otherT._Technique)) return false; if(!comparer.ListEquals(_SourceDocument, otherT._SourceDocument)) return false; if(!comparer.ListEquals(_Representation, otherT._Representation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1143,11 +1148,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_Format, otherT._Format)) return false; if(!comparer.Equals(_Document, otherT._Document)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1330,12 +1336,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_StatusDateElement, otherT._StatusDateElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1634,7 +1641,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NameComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; @@ -1645,7 +1653,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Translation, otherT._Translation)) return false; if(!comparer.ListEquals(_Official, otherT._Official)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1846,10 +1854,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OfficialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Authority, otherT._Authority)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2062,14 +2071,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelationshipComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubstanceDefinition, otherT._SubstanceDefinition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubstanceDefinition, otherT._SubstanceDefinition)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_RatioHighLimitAmount, otherT._RatioHighLimitAmount)) return false; if(!comparer.Equals(_Comparator, otherT._Comparator)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2262,12 +2272,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Genus, otherT._Genus)) return false; if(!comparer.Equals(_Species, otherT._Species)) return false; if(!comparer.Equals(_Part, otherT._Part)) return false; if(!comparer.ListEquals(_CountryOfOrigin, otherT._CountryOfOrigin)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2753,7 +2764,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_Status, otherT._Status)) return false; if(!comparer.ListEquals(_Classification, otherT._Classification)) return false; @@ -2777,7 +2789,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Polymer, otherT._Polymer)) return false; if(!comparer.Equals(_Protein, otherT._Protein)) return false; if(!comparer.Equals(_SourceMaterial, otherT._SourceMaterial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs index 22b9bc574..3ecc747a4 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceNucleicAcid.cs @@ -251,7 +251,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; @@ -259,7 +260,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ThreePrime, otherT._ThreePrime)) return false; if(!comparer.ListEquals(_Linkage, otherT._Linkage)) return false; if(!comparer.ListEquals(_Sugar, otherT._Sugar)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -481,11 +482,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ConnectivityElement, otherT._ConnectivityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ConnectivityElement, otherT._ConnectivityElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -650,10 +652,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SugarComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ResidueSiteElement, otherT._ResidueSiteElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -827,12 +830,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceNucleicAcid otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; if(!comparer.Equals(_AreaOfHybridisationElement, otherT._AreaOfHybridisationElement)) return false; if(!comparer.Equals(_OligoNucleotideType, otherT._OligoNucleotideType)) return false; if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs index a3704e08a..5e72086c3 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstancePolymer.cs @@ -121,9 +121,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MonomerSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RatioType, otherT._RatioType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RatioType, otherT._RatioType)) return false; if(!comparer.ListEquals(_StartingMaterial, otherT._StartingMaterial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -273,11 +274,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StartingMaterialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_IsDefiningElement, otherT._IsDefiningElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -428,10 +430,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AverageMolecularFormulaElement, otherT._AverageMolecularFormulaElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AverageMolecularFormulaElement, otherT._AverageMolecularFormulaElement)) return false; if(!comparer.Equals(_RepeatUnitAmountType, otherT._RepeatUnitAmountType)) return false; if(!comparer.ListEquals(_RepeatUnit, otherT._RepeatUnit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -619,12 +622,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatUnitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UnitElement, otherT._UnitElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UnitElement, otherT._UnitElement)) return false; if(!comparer.Equals(_Orientation, otherT._Orientation)) return false; if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; if(!comparer.ListEquals(_DegreeOfPolymerisation, otherT._DegreeOfPolymerisation)) return false; if(!comparer.ListEquals(_StructuralRepresentation, otherT._StructuralRepresentation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -825,11 +829,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DegreeOfPolymerisationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_AverageElement, otherT._AverageElement)) return false; if(!comparer.Equals(_LowElement, otherT._LowElement)) return false; if(!comparer.Equals(_HighElement, otherT._HighElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -993,11 +998,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructuralRepresentationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_Format, otherT._Format)) return false; if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1195,14 +1201,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstancePolymer otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Geometry, otherT._Geometry)) return false; if(!comparer.ListEquals(_CopolymerConnectivity, otherT._CopolymerConnectivity)) return false; if(!comparer.Equals(_ModificationElement, otherT._ModificationElement)) return false; if(!comparer.ListEquals(_MonomerSet, otherT._MonomerSet)) return false; if(!comparer.ListEquals(_Repeat, otherT._Repeat)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs index 7f25332f0..825891baf 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceProtein.cs @@ -279,7 +279,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubunitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SubunitElement, otherT._SubunitElement)) return false; if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_LengthElement, otherT._LengthElement)) return false; if(!comparer.Equals(_SequenceAttachment, otherT._SequenceAttachment)) return false; @@ -287,7 +288,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_NTerminalModificationElement, otherT._NTerminalModificationElement)) return false; if(!comparer.Equals(_CTerminalModificationId, otherT._CTerminalModificationId)) return false; if(!comparer.Equals(_CTerminalModificationElement, otherT._CTerminalModificationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -486,11 +487,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceProtein otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceType, otherT._SequenceType)) return false; if(!comparer.Equals(_NumberOfSubunitsElement, otherT._NumberOfSubunitsElement)) return false; if(!comparer.ListEquals(_DisulfideLinkageElement, otherT._DisulfideLinkageElement)) return false; if(!comparer.ListEquals(_Subunit, otherT._Subunit)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs index c6735a0fa..4358bf6dd 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceReferenceInformation.cs @@ -137,10 +137,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GeneComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GeneSequenceOrigin, otherT._GeneSequenceOrigin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_GeneSequenceOrigin, otherT._GeneSequenceOrigin)) return false; if(!comparer.Equals(_Gene, otherT._Gene)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -271,10 +272,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GeneElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Element, otherT._Element)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -477,7 +479,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Interaction, otherT._Interaction)) return false; if(!comparer.Equals(_Organism, otherT._Organism)) return false; @@ -485,7 +488,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_AmountType, otherT._AmountType)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -667,11 +670,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceReferenceInformation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.ListEquals(_Gene, otherT._Gene)) return false; if(!comparer.ListEquals(_GeneElement, otherT._GeneElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs index 7ec8d8704..600393991 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SubstanceSourceMaterial.cs @@ -135,9 +135,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FractionDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FractionElement, otherT._FractionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FractionElement, otherT._FractionElement)) return false; if(!comparer.Equals(_MaterialType, otherT._MaterialType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -344,7 +345,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrganismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Family, otherT._Family)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Family, otherT._Family)) return false; if(!comparer.Equals(_Genus, otherT._Genus)) return false; if(!comparer.Equals(_Species, otherT._Species)) return false; if(!comparer.Equals(_IntraspecificType, otherT._IntraspecificType)) return false; @@ -352,7 +354,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Hybrid, otherT._Hybrid)) return false; if(!comparer.Equals(_OrganismGeneral, otherT._OrganismGeneral)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -516,9 +518,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AuthorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorType, otherT._AuthorType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AuthorType, otherT._AuthorType)) return false; if(!comparer.Equals(_AuthorDescriptionElement, otherT._AuthorDescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -727,12 +730,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HybridComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MaternalOrganismIdElement, otherT._MaternalOrganismIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MaternalOrganismIdElement, otherT._MaternalOrganismIdElement)) return false; if(!comparer.Equals(_MaternalOrganismNameElement, otherT._MaternalOrganismNameElement)) return false; if(!comparer.Equals(_PaternalOrganismIdElement, otherT._PaternalOrganismIdElement)) return false; if(!comparer.Equals(_PaternalOrganismNameElement, otherT._PaternalOrganismNameElement)) return false; if(!comparer.Equals(_HybridType, otherT._HybridType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -888,11 +892,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrganismGeneralComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Kingdom, otherT._Kingdom)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Kingdom, otherT._Kingdom)) return false; if(!comparer.Equals(_Phylum, otherT._Phylum)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Order, otherT._Order)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1013,9 +1018,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PartDescriptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Part, otherT._Part)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Part, otherT._Part)) return false; if(!comparer.Equals(_PartLocation, otherT._PartLocation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1320,7 +1326,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstanceSourceMaterial otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceMaterialClass, otherT._SourceMaterialClass)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceMaterialClass, otherT._SourceMaterialClass)) return false; if(!comparer.Equals(_SourceMaterialType, otherT._SourceMaterialType)) return false; if(!comparer.Equals(_SourceMaterialState, otherT._SourceMaterialState)) return false; if(!comparer.Equals(_OrganismId, otherT._OrganismId)) return false; @@ -1333,7 +1340,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_FractionDescription, otherT._FractionDescription)) return false; if(!comparer.Equals(_Organism, otherT._Organism)) return false; if(!comparer.ListEquals(_PartDescription, otherT._PartDescription)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs index 398e05196..8fe2a39f6 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SupplyDelivery.cs @@ -192,9 +192,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -453,7 +454,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -464,7 +466,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs index 9c48693ab..6f7f5af66 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/SupplyRequest.cs @@ -181,9 +181,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -548,7 +549,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -564,7 +566,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Task.cs b/src/Hl7.Fhir.R5/Model/Generated/Task.cs index 9c7fb3c42..c61243865 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Task.cs @@ -273,9 +273,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Function, otherT._Function)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Function, otherT._Function)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -418,10 +419,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -543,9 +545,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -660,9 +663,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1371,7 +1375,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1404,7 +1409,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Output, otherT._Output)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs index b9dab7af1..c9d807573 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TerminologyCapabilities.cs @@ -185,9 +185,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -328,9 +329,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -518,11 +520,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.ListEquals(_Version, otherT._Version)) return false; if(!comparer.Equals(_ContentElement, otherT._ContentElement)) return false; if(!comparer.Equals(_SubsumptionElement, otherT._SubsumptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -789,13 +792,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_IsDefaultElement, otherT._IsDefaultElement)) return false; if(!comparer.Equals(_CompositionalElement, otherT._CompositionalElement)) return false; if(!comparer.ListEquals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_PropertyElement, otherT._PropertyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -965,9 +969,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_OpElement, otherT._OpElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1177,12 +1182,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_HierarchicalElement, otherT._HierarchicalElement)) return false; if(!comparer.Equals(_PagingElement, otherT._PagingElement)) return false; if(!comparer.Equals(_IncompleteElement, otherT._IncompleteElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.Equals(_TextFilterElement, otherT._TextFilterElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1341,9 +1347,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1452,8 +1459,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValidateCodeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TranslationsElement, otherT._TranslationsElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1555,8 +1563,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TranslationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NeedsMapElement, otherT._NeedsMapElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1660,8 +1669,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClosureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TranslationElement, otherT._TranslationElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2342,7 +2352,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TerminologyCapabilities otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -2369,7 +2380,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ValidateCode, otherT._ValidateCode)) return false; if(!comparer.Equals(_Translation, otherT._Translation)) return false; if(!comparer.Equals(_Closure, otherT._Closure)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs b/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs index e821fcc1e..f45c03061 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestPlan.cs @@ -141,9 +141,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependencyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -329,13 +330,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestCaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_Scope, otherT._Scope)) return false; if(!comparer.ListEquals(_Dependency, otherT._Dependency)) return false; if(!comparer.ListEquals(_TestRun, otherT._TestRun)) return false; if(!comparer.ListEquals(_TestData, otherT._TestData)) return false; if(!comparer.ListEquals(_Assertion, otherT._Assertion)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -488,9 +490,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestCaseDependencyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Predecessor, otherT._Predecessor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -612,9 +615,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestRunComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NarrativeElement, otherT._NarrativeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NarrativeElement, otherT._NarrativeElement)) return false; if(!comparer.Equals(_Script, otherT._Script)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -723,9 +727,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ScriptComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -849,10 +854,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Content, otherT._Content)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -986,10 +992,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Object, otherT._Object)) return false; if(!comparer.ListEquals(_Result, otherT._Result)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1611,7 +1618,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestPlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -1634,7 +1642,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Dependency, otherT._Dependency)) return false; if(!comparer.Equals(_ExitCriteriaElement, otherT._ExitCriteriaElement)) return false; if(!comparer.ListEquals(_TestCase, otherT._TestCase)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs b/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs index f8ab09af6..b32b40ca1 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestReport.cs @@ -322,10 +322,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,8 +427,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -531,9 +533,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -705,10 +708,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -902,11 +906,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; if(!comparer.ListEquals(_Requirement, otherT._Requirement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1019,8 +1024,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequirementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Link, otherT._Link)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1165,10 +1171,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1286,9 +1293,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1385,8 +1393,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1477,8 +1486,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1821,7 +1831,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TestScriptElement, otherT._TestScriptElement)) return false; @@ -1833,7 +1844,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs index 661dea7b1..f6be918e7 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TestScript.cs @@ -638,10 +638,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -806,10 +807,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -928,9 +930,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Link, otherT._Link)) return false; if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1071,9 +1074,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1370,14 +1374,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; if(!comparer.Equals(_CapabilitiesElement, otherT._CapabilitiesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1554,10 +1559,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ScopeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ArtifactElement, otherT._ArtifactElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ArtifactElement, otherT._ArtifactElement)) return false; if(!comparer.Equals(_Conformance, otherT._Conformance)) return false; if(!comparer.Equals(_Phase, otherT._Phase)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1722,10 +1728,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2048,7 +2055,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; @@ -2056,7 +2064,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2192,8 +2200,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2297,9 +2306,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2852,7 +2862,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -2869,7 +2880,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3117,9 +3128,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3927,7 +3939,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; @@ -3952,7 +3965,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; if(!comparer.ListEquals(_Requirement, otherT._Requirement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4212,8 +4225,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequirementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Link, otherT._Link)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4358,10 +4372,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4479,9 +4494,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4578,8 +4594,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4670,8 +4687,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5326,7 +5344,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_VersionAlgorithm, otherT._VersionAlgorithm)) return false; @@ -5353,7 +5372,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs index beb838e89..8570f10ea 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Timing.cs @@ -766,7 +766,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; @@ -781,7 +782,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1000,10 +1001,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/Transport.cs b/src/Hl7.Fhir.R5/Model/Generated/Transport.cs index 89b243e6c..c7a86e9af 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/Transport.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/Transport.cs @@ -268,10 +268,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -393,9 +394,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -510,9 +512,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1211,7 +1214,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Transport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_InstantiatesCanonicalElement, otherT._InstantiatesCanonicalElement)) return false; if(!comparer.Equals(_InstantiatesUriElement, otherT._InstantiatesUriElement)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; @@ -1243,7 +1247,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CurrentLocation, otherT._CurrentLocation)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_History, otherT._History)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs index 0c9473839..76d2ca251 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/TriggerDefinition.cs @@ -291,14 +291,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_SubscriptionTopicElement, otherT._SubscriptionTopicElement)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.Equals(_Condition, otherT._Condition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs index 73481dd74..b95a4d381 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VerificationResult.cs @@ -267,14 +267,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrimarySourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_CommunicationMethod, otherT._CommunicationMethod)) return false; if(!comparer.Equals(_ValidationStatus, otherT._ValidationStatus)) return false; if(!comparer.Equals(_ValidationDateElement, otherT._ValidationDateElement)) return false; if(!comparer.Equals(_CanPushUpdates, otherT._CanPushUpdates)) return false; if(!comparer.ListEquals(_PushTypeAvailable, otherT._PushTypeAvailable)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -550,7 +551,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttestationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Who, otherT._Who)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_CommunicationMethod, otherT._CommunicationMethod)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -558,7 +560,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ProxyIdentityCertificateElement, otherT._ProxyIdentityCertificateElement)) return false; if(!comparer.Equals(_ProxySignature, otherT._ProxySignature)) return false; if(!comparer.Equals(_SourceSignature, otherT._SourceSignature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -739,10 +741,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValidatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Organization, otherT._Organization)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_IdentityCertificateElement, otherT._IdentityCertificateElement)) return false; if(!comparer.Equals(_AttestationSignature, otherT._AttestationSignature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1103,7 +1106,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VerificationResult otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_TargetLocationElement, otherT._TargetLocationElement)) return false; if(!comparer.Equals(_Need, otherT._Need)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1117,7 +1121,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PrimarySource, otherT._PrimarySource)) return false; if(!comparer.Equals(_Attestation, otherT._Attestation)) return false; if(!comparer.ListEquals(_Validator, otherT._Validator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs index 920c1389a..493f36a68 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VirtualServiceDetail.cs @@ -201,12 +201,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VirtualServiceDetail otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ChannelType, otherT._ChannelType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ChannelType, otherT._ChannelType)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; if(!comparer.ListEquals(_AdditionalInfoElement, otherT._AdditionalInfoElement)) return false; if(!comparer.Equals(_MaxParticipantsElement, otherT._MaxParticipantsElement)) return false; if(!comparer.Equals(_SessionKeyElement, otherT._SessionKeyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs index 9c4778619..c28550f30 100644 --- a/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.R5/Model/Generated/VisionPrescription.cs @@ -507,7 +507,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LensSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Product, otherT._Product)) return false; if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; @@ -521,7 +522,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -749,9 +750,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PrismComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AmountElement, otherT._AmountElement)) return false; if(!comparer.Equals(_BaseElement, otherT._BaseElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -991,7 +993,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -999,7 +1002,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DateWrittenElement, otherT._DateWrittenElement)) return false; if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; if(!comparer.ListEquals(_LensSpecification, otherT._LensSpecification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Account.cs b/src/Hl7.Fhir.STU3/Model/Generated/Account.cs index 455dcdeee..975b057d4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Account.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Account.cs @@ -174,9 +174,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CoverageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -318,10 +319,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuarantorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Party, otherT._Party)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.Equals(_OnHoldElement, otherT._OnHoldElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -619,7 +621,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Account otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -631,7 +634,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Owner, otherT._Owner)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Guarantor, otherT._Guarantor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs index ef9e12648..f289871a6 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ActivityDefinition.cs @@ -145,9 +145,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -345,11 +346,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1165,7 +1167,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1199,7 +1202,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; if(!comparer.Equals(_Transform, otherT._Transform)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs index ac1937df1..e8e85df15 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Address.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Address.cs @@ -428,7 +428,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Address otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_LineElement, otherT._LineElement)) return false; @@ -438,7 +439,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PostalCodeElement, otherT._PostalCodeElement)) return false; if(!comparer.Equals(_CountryElement, otherT._CountryElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs index ea4b9b1fb..d6c0c192a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AdverseEvent.cs @@ -326,14 +326,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuspectEntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Instance, otherT._Instance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Instance, otherT._Instance)) return false; if(!comparer.Equals(_CausalityElement, otherT._CausalityElement)) return false; if(!comparer.Equals(_CausalityAssessment, otherT._CausalityAssessment)) return false; if(!comparer.Equals(_CausalityProductRelatednessElement, otherT._CausalityProductRelatednessElement)) return false; if(!comparer.Equals(_CausalityMethod, otherT._CausalityMethod)) return false; if(!comparer.Equals(_CausalityAuthor, otherT._CausalityAuthor)) return false; if(!comparer.Equals(_CausalityResult, otherT._CausalityResult)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -733,7 +734,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdverseEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; @@ -749,7 +751,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SubjectMedicalHistory, otherT._SubjectMedicalHistory)) return false; if(!comparer.ListEquals(_ReferenceDocument, otherT._ReferenceDocument)) return false; if(!comparer.ListEquals(_Study, otherT._Study)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs index 8f51ba1ed..a2ff6450e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AllergyIntolerance.cs @@ -423,14 +423,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Substance, otherT._Substance)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Substance, otherT._Substance)) return false; if(!comparer.ListEquals(_Manifestation, otherT._Manifestation)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_OnsetElement, otherT._OnsetElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_ExposureRoute, otherT._ExposureRoute)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -876,7 +877,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllergyIntolerance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatusElement, otherT._ClinicalStatusElement)) return false; if(!comparer.Equals(_VerificationStatusElement, otherT._VerificationStatusElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; @@ -891,7 +893,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_LastOccurrenceElement, otherT._LastOccurrenceElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs b/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs index 4f39920e1..7ccf2b74d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Annotation.cs @@ -159,10 +159,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Annotation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Author, otherT._Author)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs b/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs index ce54bf14c..24aede6ed 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Appointment.cs @@ -276,11 +276,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -788,7 +789,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Appointment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; @@ -808,7 +810,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_IncomingReferral, otherT._IncomingReferral)) return false; if(!comparer.ListEquals(_Participant, otherT._Participant)) return false; if(!comparer.ListEquals(_RequestedPeriod, otherT._RequestedPeriod)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs index 2dcef6eb1..ac93e455a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AppointmentResponse.cs @@ -264,7 +264,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AppointmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Appointment, otherT._Appointment)) return false; if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; @@ -272,7 +273,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_ParticipantStatusElement, otherT._ParticipantStatusElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs index 1f659200e..0cb50de93 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/AuditEvent.cs @@ -443,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_UserId, otherT._UserId)) return false; if(!comparer.Equals(_AltIdElement, otherT._AltIdElement)) return false; @@ -454,7 +455,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Media, otherT._Media)) return false; if(!comparer.Equals(_Network, otherT._Network)) return false; if(!comparer.ListEquals(_PurposeOfUse, otherT._PurposeOfUse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -659,9 +660,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NetworkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -804,10 +806,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SiteElement, otherT._SiteElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1090,7 +1093,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; @@ -1100,7 +1104,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_QueryElement, otherT._QueryElement)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1298,9 +1302,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1580,7 +1585,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AuditEvent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Subtype, otherT._Subtype)) return false; if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; @@ -1590,7 +1596,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs b/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs index f01a79a7e..c33f80085 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Basic.cs @@ -176,12 +176,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Basic otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs b/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs index fb4241117..0b7b3fedd 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/BodySite.cs @@ -220,14 +220,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BodySite otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Qualifier, otherT._Qualifier)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Image, otherT._Image)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs index 0bf1ee9a2..adf0a89e2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CapabilityStatement.cs @@ -542,10 +542,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SoftwareComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_ReleaseDateElement, otherT._ReleaseDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -693,9 +694,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -946,7 +948,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_Security, otherT._Security)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; @@ -954,7 +957,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; if(!comparer.ListEquals(_Operation, otherT._Operation)) return false; if(!comparer.ListEquals(_CompartmentElement, otherT._CompartmentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1167,11 +1170,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SecurityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CorsElement, otherT._CorsElement)) return false; if(!comparer.ListEquals(_Service, otherT._Service)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Certificate, otherT._Certificate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1323,9 +1327,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CertificateComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_BlobElement, otherT._BlobElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1825,7 +1830,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_Interaction, otherT._Interaction)) return false; @@ -1840,7 +1846,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SearchIncludeElement, otherT._SearchIncludeElement)) return false; if(!comparer.ListEquals(_SearchRevIncludeElement, otherT._SearchRevIncludeElement)) return false; if(!comparer.ListEquals(_SearchParam, otherT._SearchParam)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2074,9 +2080,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2278,11 +2285,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2439,9 +2447,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SystemInteractionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2570,9 +2579,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2758,12 +2768,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessagingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.Equals(_ReliableCacheElement, otherT._ReliableCacheElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_SupportedMessage, otherT._SupportedMessage)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2912,9 +2923,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EndpointComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3046,9 +3058,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportedMessageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3305,14 +3318,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_FocusElement, otherT._FocusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3507,10 +3521,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4270,7 +4285,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -4297,7 +4313,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Rest, otherT._Rest)) return false; if(!comparer.ListEquals(_Messaging, otherT._Messaging)) return false; if(!comparer.ListEquals(_Document, otherT._Document)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs b/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs index 968a1e8d4..fc48be183 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CarePlan.cs @@ -314,12 +314,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActivityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_OutcomeCodeableConcept, otherT._OutcomeCodeableConcept)) return false; if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; if(!comparer.ListEquals(_Progress, otherT._Progress)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -732,7 +733,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; @@ -748,7 +750,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DailyAmount, otherT._DailyAmount)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1297,7 +1299,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CarePlan otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; @@ -1317,7 +1320,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Activity, otherT._Activity)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs b/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs index cf5fd029a..46e0e7ee7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CareTeam.cs @@ -199,11 +199,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Member, otherT._Member)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -502,7 +503,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeam otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -514,7 +516,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs index 9e8f1d57c..832df56cb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ChargeItem.cs @@ -182,9 +182,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -689,7 +690,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChargeItem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; @@ -712,7 +714,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Account, otherT._Account)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_SupportingInformation, otherT._SupportingInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs index 4b910a1e4..2cf2484a4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Claim.cs @@ -177,10 +177,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -316,10 +317,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ResourceType, otherT._ResourceType)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -514,12 +516,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -731,13 +734,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SpecialConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -927,11 +931,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1105,10 +1110,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1352,13 +1358,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1534,10 +1541,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2050,7 +2058,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_CareTeamLinkIdElement, otherT._CareTeamLinkIdElement)) return false; if(!comparer.ListEquals(_DiagnosisLinkIdElement, otherT._DiagnosisLinkIdElement)) return false; if(!comparer.ListEquals(_ProcedureLinkIdElement, otherT._ProcedureLinkIdElement)) return false; @@ -2071,7 +2080,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SubSite, otherT._SubSite)) return false; if(!comparer.ListEquals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2496,7 +2505,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Service, otherT._Service)) return false; @@ -2508,7 +2518,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2855,7 +2865,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Service, otherT._Service)) return false; @@ -2866,7 +2877,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_Net, otherT._Net)) return false; if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3497,7 +3508,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Claim otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; @@ -3527,7 +3539,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Hospitalization, otherT._Hospitalization)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Total, otherT._Total)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs index d1a008f1b..f257b7d22 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClaimResponse.cs @@ -191,11 +191,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,11 +366,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -558,11 +560,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -736,10 +739,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -999,7 +1003,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Service, otherT._Service)) return false; @@ -1008,7 +1013,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1262,14 +1267,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemsDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Service, otherT._Service)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Fee, otherT._Fee)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1489,11 +1495,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; if(!comparer.Equals(_DetailSequenceLinkIdElement, otherT._DetailSequenceLinkIdElement)) return false; if(!comparer.Equals(_SubdetailSequenceLinkIdElement, otherT._SubdetailSequenceLinkIdElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1690,13 +1697,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1894,11 +1902,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2149,13 +2158,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_FocalElement, otherT._FocalElement)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; if(!comparer.Equals(_ClaimResponse, otherT._ClaimResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2643,7 +2653,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClaimResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; @@ -2666,7 +2677,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs index 56145ed2e..a9bf5a5e7 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ClinicalImpression.cs @@ -159,9 +159,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InvestigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -291,9 +292,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_BasisElement, otherT._BasisElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -736,7 +738,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClinicalImpression otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -755,7 +758,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PrognosisReference, otherT._PrognosisReference)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs index 7557bb65d..3392e000f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CodeSystem.cs @@ -336,11 +336,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_OperatorElement, otherT._OperatorElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -556,11 +557,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -790,13 +792,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptDefinitionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -981,10 +984,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1120,9 +1124,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptPropertyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1825,7 +1830,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1850,7 +1856,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_Property, otherT._Property)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs b/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs index f9f0ab689..c043d7dea 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Communication.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -555,7 +556,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Communication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; @@ -575,7 +577,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Payload, otherT._Payload)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs index 9e4178a78..b240c79fe 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CommunicationRequest.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -225,9 +226,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -657,7 +659,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; @@ -677,7 +680,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonCode, otherT._ReasonCode)) return false; if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs index 84cb84597..ff682188c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/CompartmentDefinition.cs @@ -193,10 +193,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.ListEquals(_ParamElement, otherT._ParamElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -658,7 +659,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -673,7 +675,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_SearchElement, otherT._SearchElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs index b5c38cf2f..04b4907dd 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Composition.cs @@ -277,10 +277,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AttesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -420,9 +421,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -552,10 +554,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EventComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -795,7 +798,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Text, otherT._Text)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; @@ -803,7 +807,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1207,7 +1211,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Composition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; @@ -1222,7 +1227,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_RelatesTo, otherT._RelatesTo)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Section, otherT._Section)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs index 8714ae14e..7aff7823e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ConceptMap.cs @@ -341,13 +341,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_SourceVersionElement, otherT._SourceVersionElement)) return false; if(!comparer.Equals(_TargetElement, otherT._TargetElement)) return false; if(!comparer.Equals(_TargetVersionElement, otherT._TargetVersionElement)) return false; if(!comparer.ListEquals(_Element, otherT._Element)) return false; if(!comparer.Equals(_Unmapped, otherT._Unmapped)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -531,10 +532,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -772,13 +774,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_EquivalenceElement, otherT._EquivalenceElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.ListEquals(_DependsOn, otherT._DependsOn)) return false; if(!comparer.ListEquals(_Product, otherT._Product)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1006,11 +1009,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OtherElementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1226,11 +1230,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UnmappedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1743,7 +1748,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1761,7 +1767,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs b/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs index 294bec4b1..b7d4effb2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Condition.cs @@ -216,9 +216,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Summary, otherT._Summary)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Summary, otherT._Summary)) return false; if(!comparer.ListEquals(_Assessment, otherT._Assessment)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -334,9 +335,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EvidenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -697,7 +699,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Condition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ClinicalStatusElement, otherT._ClinicalStatusElement)) return false; if(!comparer.Equals(_VerificationStatusElement, otherT._VerificationStatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -713,7 +716,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Stage, otherT._Stage)) return false; if(!comparer.ListEquals(_Evidence, otherT._Evidence)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs index a5e9abf3c..a4c1eb7f3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Consent.cs @@ -234,9 +234,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -376,9 +377,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PolicyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AuthorityElement, otherT._AuthorityElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -509,9 +511,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -763,7 +766,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExceptComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; @@ -773,7 +777,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -944,9 +948,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExceptActorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1077,9 +1082,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExceptDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MeaningElement, otherT._MeaningElement)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1471,7 +1477,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Consent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -1489,7 +1496,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DataPeriod, otherT._DataPeriod)) return false; if(!comparer.ListEquals(_Data, otherT._Data)) return false; if(!comparer.ListEquals(_Except, otherT._Except)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs index 2f4823f6e..567b94b7c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Contract.cs @@ -233,9 +233,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -367,10 +368,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SignatoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -616,7 +618,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; @@ -624,7 +627,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_PointsElement, otherT._PointsElement)) return false; if(!comparer.Equals(_Net, otherT._Net)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -974,7 +977,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TermComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; if(!comparer.Equals(_Applies, otherT._Applies)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -987,7 +991,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_ValuedItem, otherT._ValuedItem)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1181,9 +1185,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TermAgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.ListEquals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1425,7 +1430,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TermValuedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_EffectiveTimeElement, otherT._EffectiveTimeElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; @@ -1433,7 +1439,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_PointsElement, otherT._PointsElement)) return false; if(!comparer.Equals(_Net, otherT._Net)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1575,8 +1581,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FriendlyLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1669,8 +1676,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LegalLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1763,8 +1771,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComputableLanguageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Content, otherT._Content)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2212,7 +2221,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contract otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_IssuedElement, otherT._IssuedElement)) return false; if(!comparer.Equals(_Applies, otherT._Applies)) return false; @@ -2235,7 +2245,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Friendly, otherT._Friendly)) return false; if(!comparer.ListEquals(_Legal, otherT._Legal)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs b/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs index e5ceb9f03..f48d785d5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Contributor.cs @@ -193,10 +193,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Contributor otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs index 67b701327..63124acd9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Coverage.cs @@ -446,7 +446,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_GroupElement, otherT._GroupElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_GroupElement, otherT._GroupElement)) return false; if(!comparer.Equals(_GroupDisplayElement, otherT._GroupDisplayElement)) return false; if(!comparer.Equals(_SubGroupElement, otherT._SubGroupElement)) return false; if(!comparer.Equals(_SubGroupDisplayElement, otherT._SubGroupDisplayElement)) return false; @@ -458,7 +459,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ClassDisplayElement, otherT._ClassDisplayElement)) return false; if(!comparer.Equals(_SubClassElement, otherT._SubClassElement)) return false; if(!comparer.Equals(_SubClassDisplayElement, otherT._SubClassDisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -927,7 +928,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Coverage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PolicyHolder, otherT._PolicyHolder)) return false; @@ -943,7 +945,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OrderElement, otherT._OrderElement)) return false; if(!comparer.Equals(_NetworkElement, otherT._NetworkElement)) return false; if(!comparer.ListEquals(_Contract, otherT._Contract)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs index 94d36f13a..85e63eb58 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DataElement.cs @@ -262,11 +262,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -734,7 +735,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataElement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -750,7 +752,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StringencyElement, otherT._StringencyElement)) return false; if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; if(!comparer.ListEquals(_Element, otherT._Element)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs index f8a4f8456..b081136de 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DataRequirement.cs @@ -208,12 +208,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CodeFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_ValueSet, otherT._ValueSet)) return false; if(!comparer.ListEquals(_ValueCodeElement, otherT._ValueCodeElement)) return false; if(!comparer.ListEquals(_ValueCoding, otherT._ValueCoding)) return false; if(!comparer.ListEquals(_ValueCodeableConcept, otherT._ValueCodeableConcept)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -362,9 +363,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateFilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -558,12 +560,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DataRequirement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_MustSupportElement, otherT._MustSupportElement)) return false; if(!comparer.ListEquals(_CodeFilter, otherT._CodeFilter)) return false; if(!comparer.ListEquals(_DateFilter, otherT._DateFilter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs index e97a197a5..219bf685e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DetectedIssue.cs @@ -187,10 +187,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MitigationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -508,7 +509,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetectedIssue otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; @@ -519,7 +521,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; if(!comparer.Equals(_ReferenceElement, otherT._ReferenceElement)) return false; if(!comparer.ListEquals(_Mitigation, otherT._Mitigation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Device.cs b/src/Hl7.Fhir.STU3/Model/Generated/Device.cs index f1943a97c..bd0b3c0c4 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Device.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Device.cs @@ -384,14 +384,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UdiComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DeviceIdentifierElement, otherT._DeviceIdentifierElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_JurisdictionElement, otherT._JurisdictionElement)) return false; if(!comparer.Equals(_CarrierHRFElement, otherT._CarrierHRFElement)) return false; if(!comparer.Equals(_CarrierAIDCElement, otherT._CarrierAIDCElement)) return false; if(!comparer.Equals(_IssuerElement, otherT._IssuerElement)) return false; if(!comparer.Equals(_EntryTypeElement, otherT._EntryTypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -866,7 +867,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Device otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Udi, otherT._Udi)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -883,7 +885,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Safety, otherT._Safety)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs index fb1ec8b15..2a04d6a6a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceComponent.cs @@ -233,10 +233,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProductionSpecificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SpecType, otherT._SpecType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SpecType, otherT._SpecType)) return false; if(!comparer.Equals(_ComponentId, otherT._ComponentId)) return false; if(!comparer.Equals(_ProductionSpecElement, otherT._ProductionSpecElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -495,7 +496,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_LastSystemChangeElement, otherT._LastSystemChangeElement)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; @@ -505,7 +507,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MeasurementPrincipleElement, otherT._MeasurementPrincipleElement)) return false; if(!comparer.ListEquals(_ProductionSpecification, otherT._ProductionSpecification)) return false; if(!comparer.Equals(_LanguageCode, otherT._LanguageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs index a65a8adf2..bd0c91f72 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceMetric.cs @@ -381,10 +381,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CalibrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_StateElement, otherT._StateElement)) return false; if(!comparer.Equals(_TimeElement, otherT._TimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -660,7 +661,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceMetric otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; @@ -670,7 +672,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CategoryElement, otherT._CategoryElement)) return false; if(!comparer.Equals(_MeasurementPeriod, otherT._MeasurementPeriod)) return false; if(!comparer.ListEquals(_Calibration, otherT._Calibration)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs index 3f34aedee..504cb3b3b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceRequest.cs @@ -131,9 +131,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -583,7 +584,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PriorRequest, otherT._PriorRequest)) return false; @@ -604,7 +606,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs index 2426b2267..fe7dc0910 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DeviceUseStatement.cs @@ -331,7 +331,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DeviceUseStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_WhenUsed, otherT._WhenUsed)) return false; @@ -342,7 +343,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Indication, otherT._Indication)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs index 8a90aa650..8d1fefdb2 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DiagnosticReport.cs @@ -201,9 +201,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -331,9 +332,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -714,7 +716,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosticReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -731,7 +734,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ConclusionElement, otherT._ConclusionElement)) return false; if(!comparer.ListEquals(_CodedDiagnosis, otherT._CodedDiagnosis)) return false; if(!comparer.ListEquals(_PresentedForm, otherT._PresentedForm)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs b/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs index 874823db7..7a1a94535 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DocumentManifest.cs @@ -116,8 +116,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_P, otherT._P)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_P, otherT._P)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -223,9 +224,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Ref, otherT._Ref)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -536,7 +538,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -548,7 +551,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Related, otherT._Related)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs b/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs index 19ace727e..329e8b42c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/DocumentReference.cs @@ -148,9 +148,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatesToComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -262,9 +263,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Attachment, otherT._Attachment)) return false; if(!comparer.Equals(_Format, otherT._Format)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -454,14 +456,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContextComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; if(!comparer.ListEquals(_Event, otherT._Event)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_FacilityType, otherT._FacilityType)) return false; if(!comparer.Equals(_PracticeSetting, otherT._PracticeSetting)) return false; if(!comparer.Equals(_SourcePatientInfo, otherT._SourcePatientInfo)) return false; if(!comparer.ListEquals(_Related, otherT._Related)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -609,9 +612,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Ref, otherT._Ref)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1015,7 +1019,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DocumentReference otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_MasterIdentifier, otherT._MasterIdentifier)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_DocStatusElement, otherT._DocStatusElement)) return false; @@ -1032,7 +1037,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SecurityLabel, otherT._SecurityLabel)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.Equals(_Context, otherT._Context)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs index c1d617d65..0ee6785db 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Dosage.cs @@ -335,7 +335,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Dosage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.ListEquals(_AdditionalInstruction, otherT._AdditionalInstruction)) return false; if(!comparer.Equals(_PatientInstructionElement, otherT._PatientInstructionElement)) return false; @@ -349,7 +350,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_MaxDosePerAdministration, otherT._MaxDosePerAdministration)) return false; if(!comparer.Equals(_MaxDosePerLifetime, otherT._MaxDosePerLifetime)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs index 7e51a3ae8..178756627 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ElementDefinition.cs @@ -390,11 +390,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SlicingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Discriminator, otherT._Discriminator)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_OrderedElement, otherT._OrderedElement)) return false; if(!comparer.Equals(_RulesElement, otherT._RulesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -553,9 +554,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiscriminatorComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -728,10 +730,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BaseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -976,12 +979,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TypeRefComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.Equals(_TargetProfileElement, otherT._TargetProfileElement)) return false; if(!comparer.ListEquals(_AggregationElement, otherT._AggregationElement)) return false; if(!comparer.Equals(_VersioningElement, otherT._VersioningElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1132,9 +1136,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExampleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1430,14 +1435,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConstraintComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KeyElement, otherT._KeyElement)) return false; if(!comparer.Equals(_RequirementsElement, otherT._RequirementsElement)) return false; if(!comparer.Equals(_SeverityElement, otherT._SeverityElement)) return false; if(!comparer.Equals(_HumanElement, otherT._HumanElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_XpathElement, otherT._XpathElement)) return false; if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1633,10 +1639,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ElementDefinitionBindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ValueSet, otherT._ValueSet)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1845,11 +1852,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_MapElement, otherT._MapElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2693,7 +2701,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ElementDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.ListEquals(_RepresentationElement, otherT._RepresentationElement)) return false; if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; @@ -2725,7 +2734,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_IsSummaryElement, otherT._IsSummaryElement)) return false; if(!comparer.Equals(_Binding, otherT._Binding)) return false; if(!comparer.ListEquals(_Mapping, otherT._Mapping)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs index cb86b13b8..fd58a14a1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityRequest.cs @@ -361,7 +361,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EligibilityRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -376,7 +377,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_BusinessArrangementElement, otherT._BusinessArrangementElement)) return false; if(!comparer.Equals(_BenefitCategory, otherT._BenefitCategory)) return false; if(!comparer.Equals(_BenefitSubCategory, otherT._BenefitSubCategory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs index d6d161e4a..f6c06a5f5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EligibilityResponse.cs @@ -145,10 +145,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.Equals(_Contract, otherT._Contract)) return false; if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -415,7 +416,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_SubCategory, otherT._SubCategory)) return false; if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -424,7 +426,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Term, otherT._Term)) return false; if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -603,10 +605,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -711,8 +714,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ErrorsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1030,7 +1034,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EligibilityResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; @@ -1043,7 +1048,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Insurance, otherT._Insurance)) return false; if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs b/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs index 25f5346cd..d5f52dd0e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Encounter.cs @@ -246,9 +246,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -362,9 +363,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ClassHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Class, otherT._Class)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Class, otherT._Class)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -492,10 +494,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Individual, otherT._Individual)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -642,10 +645,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -874,7 +878,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HospitalizationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PreAdmissionIdentifier, otherT._PreAdmissionIdentifier)) return false; if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_AdmitSource, otherT._AdmitSource)) return false; if(!comparer.Equals(_ReAdmission, otherT._ReAdmission)) return false; @@ -883,7 +888,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SpecialArrangement, otherT._SpecialArrangement)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_DischargeDisposition, otherT._DischargeDisposition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1077,10 +1082,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LocationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Location, otherT._Location)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Location, otherT._Location)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1496,7 +1502,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Encounter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; if(!comparer.Equals(_Class, otherT._Class)) return false; @@ -1517,7 +1524,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Location, otherT._Location)) return false; if(!comparer.Equals(_ServiceProvider, otherT._ServiceProvider)) return false; if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs index c809929d0..3d100858b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Endpoint.cs @@ -380,7 +380,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Endpoint otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ConnectionType, otherT._ConnectionType)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -391,7 +392,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_PayloadMimeTypeElement, otherT._PayloadMimeTypeElement)) return false; if(!comparer.Equals(_AddressElement, otherT._AddressElement)) return false; if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs index 292cfb2b3..57c88646e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentRequest.cs @@ -239,7 +239,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Insurer, otherT._Insurer)) return false; @@ -247,7 +248,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs index bb7a5a794..c38fdd89d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EnrollmentResponse.cs @@ -267,7 +267,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnrollmentResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; @@ -276,7 +277,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_RequestProvider, otherT._RequestProvider)) return false; if(!comparer.Equals(_RequestOrganization, otherT._RequestOrganization)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs b/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs index ecdf1c483..3c869adcb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/EpisodeOfCare.cs @@ -197,9 +197,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StatusHistoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -339,10 +340,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Condition, otherT._Condition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Condition, otherT._Condition)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_RankElement, otherT._RankElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -624,7 +626,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EpisodeOfCare otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_StatusHistory, otherT._StatusHistory)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; @@ -636,7 +639,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CareManager, otherT._CareManager)) return false; if(!comparer.ListEquals(_Team, otherT._Team)) return false; if(!comparer.ListEquals(_Account, otherT._Account)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs index 01497ce4c..1bf8ea79e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExpansionProfile.cs @@ -218,10 +218,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FixedVersionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -370,9 +371,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExcludedSystemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -482,9 +484,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Include, otherT._Include)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Include, otherT._Include)) return false; if(!comparer.Equals(_Exclude, otherT._Exclude)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -578,8 +581,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationIncludeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -700,9 +704,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationIncludeDesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -796,8 +801,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationExcludeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -918,9 +924,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationExcludeDesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1559,7 +1566,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExpansionProfile otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1582,7 +1590,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ExcludePostCoordinatedElement, otherT._ExcludePostCoordinatedElement)) return false; if(!comparer.Equals(_DisplayLanguageElement, otherT._DisplayLanguageElement)) return false; if(!comparer.Equals(_LimitedExpansionElement, otherT._LimitedExpansionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs index 87c5c8223..68c5cf324 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ExplanationOfBenefit.cs @@ -334,10 +334,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedClaimComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Claim, otherT._Claim)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Claim, otherT._Claim)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Reference, otherT._Reference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -472,10 +473,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PayeeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ResourceType, otherT._ResourceType)) return false; if(!comparer.Equals(_Party, otherT._Party)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -673,13 +675,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupportingInformationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Timing, otherT._Timing)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -895,12 +898,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CareTeamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_ResponsibleElement, otherT._ResponsibleElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Qualification, otherT._Qualification)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1083,11 +1087,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DiagnosisComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Diagnosis, otherT._Diagnosis)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_PackageCode, otherT._PackageCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1261,10 +1266,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1402,9 +1408,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InsuranceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Coverage, otherT._Coverage)) return false; if(!comparer.ListEquals(_PreAuthRefElement, otherT._PreAuthRefElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1547,10 +1554,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AccidentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Location, otherT._Location)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2111,7 +2119,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.ListEquals(_CareTeamLinkIdElement, otherT._CareTeamLinkIdElement)) return false; if(!comparer.ListEquals(_DiagnosisLinkIdElement, otherT._DiagnosisLinkIdElement)) return false; if(!comparer.ListEquals(_ProcedureLinkIdElement, otherT._ProcedureLinkIdElement)) return false; @@ -2134,7 +2143,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2437,11 +2446,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdjudicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2811,7 +2821,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -2826,7 +2837,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_SubDetail, otherT._SubDetail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3258,7 +3269,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceElement, otherT._SequenceElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -3272,7 +3284,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Udi, otherT._Udi)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3609,7 +3621,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Service, otherT._Service)) return false; @@ -3618,7 +3631,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; if(!comparer.ListEquals(_Detail, otherT._Detail)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3872,14 +3885,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AddedItemsDetailComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Revenue, otherT._Revenue)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Service, otherT._Service)) return false; if(!comparer.ListEquals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Fee, otherT._Fee)) return false; if(!comparer.ListEquals(_NoteNumberElement, otherT._NoteNumberElement)) return false; if(!comparer.ListEquals(_Adjudication, otherT._Adjudication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4097,13 +4111,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Adjustment, otherT._Adjustment)) return false; if(!comparer.Equals(_AdjustmentReason, otherT._AdjustmentReason)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4301,11 +4316,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Language, otherT._Language)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4576,7 +4592,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitBalanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_SubCategory, otherT._SubCategory)) return false; if(!comparer.Equals(_ExcludedElement, otherT._ExcludedElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -4585,7 +4602,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Unit, otherT._Unit)) return false; if(!comparer.Equals(_Term, otherT._Term)) return false; if(!comparer.ListEquals(_Financial, otherT._Financial)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4764,10 +4781,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BenefitComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Allowed, otherT._Allowed)) return false; if(!comparer.Equals(_Used, otherT._Used)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5487,7 +5505,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExplanationOfBenefit otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_SubType, otherT._SubType)) return false; @@ -5526,7 +5545,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; if(!comparer.ListEquals(_BenefitBalance, otherT._BenefitBalance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs b/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs index f9852d6a6..9a97e0bd8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/FamilyMemberHistory.cs @@ -195,11 +195,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_Onset, otherT._Onset)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -651,7 +652,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FamilyMemberHistory otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_NotDoneElement, otherT._NotDoneElement)) return false; @@ -669,7 +671,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Condition, otherT._Condition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs b/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs index 2fd858a0f..1e6e19fbf 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Flag.cs @@ -253,7 +253,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Flag otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; @@ -261,7 +262,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs b/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs index 8b8d1c9f5..104a0e5e9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Goal.cs @@ -235,10 +235,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -593,7 +594,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Goal otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; @@ -608,7 +610,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_OutcomeCode, otherT._OutcomeCode)) return false; if(!comparer.ListEquals(_OutcomeReference, otherT._OutcomeReference)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs index 8d40baeb5..7588d3da1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/GraphDefinition.cs @@ -290,13 +290,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SliceNameElement, otherT._SliceNameElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -494,11 +495,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Compartment, otherT._Compartment)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -713,11 +715,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CompartmentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_RuleElement, otherT._RuleElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1184,7 +1187,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GraphDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1199,7 +1203,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_ProfileElement, otherT._ProfileElement)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Group.cs b/src/Hl7.Fhir.STU3/Model/Generated/Group.cs index 601bd9568..fd2a13a53 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Group.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Group.cs @@ -223,11 +223,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CharacteristicComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -383,10 +384,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MemberComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Entity, otherT._Entity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Entity, otherT._Entity)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -670,7 +672,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Group otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ActualElement, otherT._ActualElement)) return false; @@ -679,7 +682,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_QuantityElement, otherT._QuantityElement)) return false; if(!comparer.ListEquals(_Characteristic, otherT._Characteristic)) return false; if(!comparer.ListEquals(_Member, otherT._Member)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs index a05cbbf61..c3e7c9baa 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/GuidanceResponse.cs @@ -395,7 +395,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GuidanceResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequestIdElement, otherT._RequestIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequestIdElement, otherT._RequestIdElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Module, otherT._Module)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -409,7 +410,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OutputParameters, otherT._OutputParameters)) return false; if(!comparer.Equals(_Result, otherT._Result)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs index c31b80a45..22f068acf 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HealthcareService.cs @@ -218,11 +218,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -362,9 +363,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_During, otherT._During)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -919,7 +921,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HealthcareService otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_ProvidedBy, otherT._ProvidedBy)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -943,7 +946,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs index 02bc6cb91..94f5b7543 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/HumanName.cs @@ -337,14 +337,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not HumanName otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_FamilyElement, otherT._FamilyElement)) return false; if(!comparer.ListEquals(_GivenElement, otherT._GivenElement)) return false; if(!comparer.ListEquals(_PrefixElement, otherT._PrefixElement)) return false; if(!comparer.ListEquals(_SuffixElement, otherT._SuffixElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs index ff8e86c98..544bbbbc8 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImagingManifest.cs @@ -177,11 +177,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StudyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_ImagingStudy, otherT._ImagingStudy)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.ListEquals(_Series, otherT._Series)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -340,10 +341,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -493,9 +495,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SopClassElement, otherT._SopClassElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SopClassElement, otherT._SopClassElement)) return false; if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -683,13 +686,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImagingManifest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_AuthoringTimeElement, otherT._AuthoringTimeElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Study, otherT._Study)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs index e92cff9b8..64732dc96 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImagingStudy.cs @@ -404,7 +404,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SeriesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_Modality, otherT._Modality)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -416,7 +417,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StartedElement, otherT._StartedElement)) return false; if(!comparer.ListEquals(_Performer, otherT._Performer)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -686,11 +687,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_NumberElement, otherT._NumberElement)) return false; if(!comparer.Equals(_SopClassElement, otherT._SopClassElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1157,7 +1159,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImagingStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UidElement, otherT._UidElement)) return false; if(!comparer.Equals(_Accession, otherT._Accession)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_AvailabilityElement, otherT._AvailabilityElement)) return false; @@ -1176,7 +1179,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Series, otherT._Series)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs b/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs index cfc103a81..aabdec4b3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Immunization.cs @@ -152,9 +152,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PractitionerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -268,9 +269,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExplanationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_ReasonNotGiven, otherT._ReasonNotGiven)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -427,10 +429,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReactionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_ReportedElement, otherT._ReportedElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -698,7 +701,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VaccinationProtocolComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoseSequenceElement, otherT._DoseSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DoseSequenceElement, otherT._DoseSequenceElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; @@ -706,7 +710,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.Equals(_DoseStatus, otherT._DoseStatus)) return false; if(!comparer.Equals(_DoseStatusReason, otherT._DoseStatusReason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1224,7 +1228,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Immunization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_NotGivenElement, otherT._NotGivenElement)) return false; if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; @@ -1245,7 +1250,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Explanation, otherT._Explanation)) return false; if(!comparer.ListEquals(_Reaction, otherT._Reaction)) return false; if(!comparer.ListEquals(_VaccinationProtocol, otherT._VaccinationProtocol)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs index 6bcbb67c2..04e28e975 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImmunizationRecommendation.cs @@ -263,7 +263,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RecommendationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_VaccineCode, otherT._VaccineCode)) return false; if(!comparer.Equals(_TargetDisease, otherT._TargetDisease)) return false; if(!comparer.Equals(_DoseNumberElement, otherT._DoseNumberElement)) return false; @@ -272,7 +273,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Protocol, otherT._Protocol)) return false; if(!comparer.ListEquals(_SupportingImmunization, otherT._SupportingImmunization)) return false; if(!comparer.ListEquals(_SupportingPatientInformation, otherT._SupportingPatientInformation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -449,9 +450,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DateCriterionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -636,11 +638,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProtocolComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DoseSequenceElement, otherT._DoseSequenceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DoseSequenceElement, otherT._DoseSequenceElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Authority, otherT._Authority)) return false; if(!comparer.Equals(_SeriesElement, otherT._SeriesElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -769,10 +772,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImmunizationRecommendation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.ListEquals(_Recommendation, otherT._Recommendation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs index 4854871bb..ba3ee0281 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ImplementationGuide.cs @@ -240,9 +240,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependencyComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -398,10 +399,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -641,13 +643,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ExampleElement, otherT._ExampleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ExampleElement, otherT._ExampleElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_AcronymElement, otherT._AcronymElement)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.Equals(_ExampleFor, otherT._ExampleFor)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -807,9 +810,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GlobalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1097,14 +1101,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SourceElement, otherT._SourceElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.ListEquals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.ListEquals(_PackageElement, otherT._PackageElement)) return false; if(!comparer.Equals(_FormatElement, otherT._FormatElement)) return false; if(!comparer.ListEquals(_Page, otherT._Page)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1638,7 +1643,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ImplementationGuide otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1656,7 +1662,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Global, otherT._Global)) return false; if(!comparer.ListEquals(_BinaryElement, otherT._BinaryElement)) return false; if(!comparer.Equals(_Page, otherT._Page)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Library.cs b/src/Hl7.Fhir.STU3/Model/Generated/Library.cs index e2478e672..a4fa9c5e3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Library.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Library.cs @@ -675,7 +675,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Library otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -701,7 +702,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs b/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs index a43d5819f..f8e96bd87 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Linkage.cs @@ -173,9 +173,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -301,10 +302,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Linkage otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/List.cs b/src/Hl7.Fhir.STU3/Model/Generated/List.cs index 85d5f4cca..c9630a159 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/List.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/List.cs @@ -217,11 +217,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Flag, otherT._Flag)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Flag, otherT._Flag)) return false; if(!comparer.Equals(_DeletedElement, otherT._DeletedElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -563,7 +564,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not List otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; @@ -576,7 +578,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Entry, otherT._Entry)) return false; if(!comparer.Equals(_EmptyReason, otherT._EmptyReason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs index 67e1cb1ed..cb8d34b4e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Location.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Location.cs @@ -237,10 +237,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PositionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LongitudeElement, otherT._LongitudeElement)) return false; if(!comparer.Equals(_LatitudeElement, otherT._LatitudeElement)) return false; if(!comparer.Equals(_AltitudeElement, otherT._AltitudeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -620,7 +621,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Location otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_OperationalStatus, otherT._OperationalStatus)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -635,7 +637,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs index 431131322..c3b3ea9f1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Measure.cs @@ -201,12 +201,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,12 +427,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -606,10 +608,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -787,11 +790,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementalDataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Usage, otherT._Usage)) return false; if(!comparer.Equals(_CriteriaElement, otherT._CriteriaElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1761,7 +1765,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Measure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1798,7 +1803,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SetElement, otherT._SetElement)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.ListEquals(_SupplementalData, otherT._SupplementalData)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs index d9c1ce44d..b0082e9a1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MeasureReport.cs @@ -228,11 +228,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScoreElement, otherT._MeasureScoreElement)) return false; if(!comparer.ListEquals(_Stratifier, otherT._Stratifier)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -402,11 +403,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_Patients, otherT._Patients)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -531,9 +533,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Stratum, otherT._Stratum)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -689,10 +692,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.ListEquals(_Population, otherT._Population)) return false; if(!comparer.Equals(_MeasureScoreElement, otherT._MeasureScoreElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -855,11 +859,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StratifierGroupPopulationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_Patients, otherT._Patients)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1143,7 +1148,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MeasureReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Measure, otherT._Measure)) return false; @@ -1153,7 +1159,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; if(!comparer.Equals(_EvaluatedResources, otherT._EvaluatedResources)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Media.cs b/src/Hl7.Fhir.STU3/Model/Generated/Media.cs index 158573541..70a7f3eae 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Media.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Media.cs @@ -460,7 +460,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Media otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Subtype, otherT._Subtype)) return false; @@ -478,7 +479,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; if(!comparer.Equals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs b/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs index 9c57979ef..490cee99a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Medication.cs @@ -188,10 +188,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_IsActiveElement, otherT._IsActiveElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -325,10 +326,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PackageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Container, otherT._Container)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Container, otherT._Container)) return false; if(!comparer.ListEquals(_Content, otherT._Content)) return false; if(!comparer.ListEquals(_Batch, otherT._Batch)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -449,9 +451,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Item, otherT._Item)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Item, otherT._Item)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -591,9 +594,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BatchComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LotNumberElement, otherT._LotNumberElement)) return false; if(!comparer.Equals(_ExpirationDateElement, otherT._ExpirationDateElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -838,7 +842,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Medication otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_IsBrandElement, otherT._IsBrandElement)) return false; if(!comparer.Equals(_IsOverTheCounterElement, otherT._IsOverTheCounterElement)) return false; @@ -847,7 +852,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; if(!comparer.Equals(_Package, otherT._Package)) return false; if(!comparer.ListEquals(_Image, otherT._Image)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs index 4d12d5e11..565aeb4fc 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationAdministration.cs @@ -178,9 +178,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -366,13 +367,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DosageComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Site, otherT._Site)) return false; if(!comparer.Equals(_Route, otherT._Route)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_Dose, otherT._Dose)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -822,7 +824,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationAdministration otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -842,7 +845,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.Equals(_Dosage, otherT._Dosage)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs index 4d1285120..6e921b0a3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationDispense.cs @@ -179,9 +179,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Actor, otherT._Actor)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -341,11 +342,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_WasSubstitutedElement, otherT._WasSubstitutedElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_ResponsibleParty, otherT._ResponsibleParty)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -863,7 +865,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationDispense otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; @@ -887,7 +890,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_NotDoneElement, otherT._NotDoneElement)) return false; if(!comparer.Equals(_NotDoneReason, otherT._NotDoneReason)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs index 92bda625a..6a4d1a4b1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationRequest.cs @@ -257,9 +257,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -428,12 +429,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DispenseRequestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ValidityPeriod, otherT._ValidityPeriod)) return false; if(!comparer.Equals(_NumberOfRepeatsAllowedElement, otherT._NumberOfRepeatsAllowedElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_ExpectedSupplyDuration, otherT._ExpectedSupplyDuration)) return false; if(!comparer.Equals(_Performer, otherT._Performer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -581,9 +583,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SubstitutionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AllowedElement, otherT._AllowedElement)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1092,7 +1095,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; @@ -1116,7 +1120,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PriorPrescription, otherT._PriorPrescription)) return false; if(!comparer.ListEquals(_DetectedIssue, otherT._DetectedIssue)) return false; if(!comparer.ListEquals(_EventHistory, otherT._EventHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs b/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs index d7962e986..e330b194a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MedicationStatement.cs @@ -512,7 +512,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MedicationStatement otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_Context, otherT._Context)) return false; @@ -530,7 +531,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReasonReference, otherT._ReasonReference)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Dosage, otherT._Dosage)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs index 502a8b524..85e7e947a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MessageDefinition.cs @@ -205,11 +205,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocusComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -352,9 +353,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AllowedResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Message, otherT._Message)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Message, otherT._Message)) return false; if(!comparer.Equals(_SituationElement, otherT._SituationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -961,7 +963,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -984,7 +987,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; if(!comparer.Equals(_ResponseRequiredElement, otherT._ResponseRequiredElement)) return false; if(!comparer.ListEquals(_AllowedResponse, otherT._AllowedResponse)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs b/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs index fe77e112a..16b885558 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/MessageHeader.cs @@ -202,10 +202,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageDestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -425,12 +426,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageSourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_SoftwareElement, otherT._SoftwareElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_Contact, otherT._Contact)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -611,10 +613,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResponseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_Details, otherT._Details)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -889,7 +892,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MessageHeader otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Event, otherT._Event)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Event, otherT._Event)) return false; if(!comparer.ListEquals(_Destination, otherT._Destination)) return false; if(!comparer.Equals(_Receiver, otherT._Receiver)) return false; if(!comparer.Equals(_Sender, otherT._Sender)) return false; @@ -901,7 +905,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; if(!comparer.ListEquals(_Focus, otherT._Focus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs b/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs index 3df3c9713..be0a11243 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/NamingSystem.cs @@ -295,12 +295,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not UniqueIdComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -719,7 +720,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NamingSystem otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; @@ -733,7 +735,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_UsageElement, otherT._UsageElement)) return false; if(!comparer.ListEquals(_UniqueId, otherT._UniqueId)) return false; if(!comparer.Equals(_ReplacedBy, otherT._ReplacedBy)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs b/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs index 67af37b7f..0e3b03f8e 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/NutritionOrder.cs @@ -269,13 +269,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OralDietComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.ListEquals(_Nutrient, otherT._Nutrient)) return false; if(!comparer.ListEquals(_Texture, otherT._Texture)) return false; if(!comparer.ListEquals(_FluidConsistencyType, otherT._FluidConsistencyType)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -414,9 +415,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutrientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -528,9 +530,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TextureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Modifier, otherT._Modifier)) return false; if(!comparer.Equals(_FoodType, otherT._FoodType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -714,12 +717,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplementComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ProductNameElement, otherT._ProductNameElement)) return false; if(!comparer.ListEquals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_InstructionElement, otherT._InstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -997,7 +1001,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnteralFormulaComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_BaseFormulaType, otherT._BaseFormulaType)) return false; if(!comparer.Equals(_BaseFormulaProductNameElement, otherT._BaseFormulaProductNameElement)) return false; if(!comparer.Equals(_AdditiveType, otherT._AdditiveType)) return false; if(!comparer.Equals(_AdditiveProductNameElement, otherT._AdditiveProductNameElement)) return false; @@ -1006,7 +1011,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Administration, otherT._Administration)) return false; if(!comparer.Equals(_MaxVolumeToDeliver, otherT._MaxVolumeToDeliver)) return false; if(!comparer.Equals(_AdministrationInstructionElement, otherT._AdministrationInstructionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1182,10 +1187,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AdministrationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Schedule, otherT._Schedule)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Rate, otherT._Rate)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1477,7 +1483,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NutritionOrder otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; @@ -1489,7 +1496,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_OralDiet, otherT._OralDiet)) return false; if(!comparer.ListEquals(_Supplement, otherT._Supplement)) return false; if(!comparer.Equals(_EnteralFormula, otherT._EnteralFormula)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs b/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs index 58095cfa8..4275ac913 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Observation.cs @@ -248,13 +248,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceRangeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Low, otherT._Low)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Low, otherT._Low)) return false; if(!comparer.Equals(_High, otherT._High)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.ListEquals(_AppliesTo, otherT._AppliesTo)) return false; if(!comparer.Equals(_Age, otherT._Age)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -413,9 +414,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -575,12 +577,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Code, otherT._Code)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.Equals(_DataAbsentReason, otherT._DataAbsentReason)) return false; if(!comparer.Equals(_Interpretation, otherT._Interpretation)) return false; if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1041,7 +1044,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Observation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; @@ -1062,7 +1066,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ReferenceRange, otherT._ReferenceRange)) return false; if(!comparer.ListEquals(_Related, otherT._Related)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs index 6c8950f64..7e35e93ca 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/OperationDefinition.cs @@ -379,7 +379,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; @@ -389,7 +390,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Profile, otherT._Profile)) return false; if(!comparer.Equals(_Binding, otherT._Binding)) return false; if(!comparer.ListEquals(_Part, otherT._Part)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -577,9 +578,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not BindingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StrengthElement, otherT._StrengthElement)) return false; if(!comparer.Equals(_ValueSet, otherT._ValueSet)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -724,9 +726,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OverloadComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_ParameterNameElement, otherT._ParameterNameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1394,7 +1397,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1417,7 +1421,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_InstanceElement, otherT._InstanceElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Overload, otherT._Overload)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs index 83387668f..c89607c0d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Organization.cs @@ -156,11 +156,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Purpose, otherT._Purpose)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -442,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Organization otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Type, otherT._Type)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -452,7 +454,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PartOf, otherT._PartOf)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs index f51520888..e45212271 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ParameterDefinition.cs @@ -278,14 +278,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_UseElement, otherT._UseElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs b/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs index c56cacd54..2491506bc 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Patient.cs @@ -252,14 +252,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContactComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Relationship, otherT._Relationship)) return false; if(!comparer.Equals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_Address, otherT._Address)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -423,10 +424,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnimalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Species, otherT._Species)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Species, otherT._Species)) return false; if(!comparer.Equals(_Breed, otherT._Breed)) return false; if(!comparer.Equals(_GenderStatus, otherT._GenderStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -561,9 +563,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CommunicationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Language, otherT._Language)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Language, otherT._Language)) return false; if(!comparer.Equals(_PreferredElement, otherT._PreferredElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -696,9 +699,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Other, otherT._Other)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Other, otherT._Other)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1069,7 +1073,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Patient otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -1086,7 +1091,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_GeneralPractitioner, otherT._GeneralPractitioner)) return false; if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs b/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs index 750f62fab..da1cd1b44 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PaymentNotice.cs @@ -283,7 +283,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentNotice otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; @@ -293,7 +294,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Provider, otherT._Provider)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; if(!comparer.Equals(_PaymentStatus, otherT._PaymentStatus)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs b/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs index ac6b4acb0..35ee431bc 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PaymentReconciliation.cs @@ -221,14 +221,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DetailsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Request, otherT._Request)) return false; if(!comparer.Equals(_Response, otherT._Response)) return false; if(!comparer.Equals(_Submitter, otherT._Submitter)) return false; if(!comparer.Equals(_Payee, otherT._Payee)) return false; if(!comparer.Equals(_DateElement, otherT._DateElement)) return false; if(!comparer.Equals(_Amount, otherT._Amount)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -389,9 +390,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotesComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -715,7 +717,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PaymentReconciliation otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; @@ -729,7 +732,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Form, otherT._Form)) return false; if(!comparer.Equals(_Total, otherT._Total)) return false; if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Person.cs b/src/Hl7.Fhir.STU3/Model/Generated/Person.cs index ffda0af4e..e40751473 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Person.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Person.cs @@ -178,9 +178,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Target, otherT._Target)) return false; if(!comparer.Equals(_AssuranceElement, otherT._AssuranceElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -442,7 +443,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Person otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; if(!comparer.Equals(_GenderElement, otherT._GenderElement)) return false; @@ -452,7 +454,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ManagingOrganization, otherT._ManagingOrganization)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Link, otherT._Link)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs index 5ad812cd2..c1b8161a3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PlanDefinition.cs @@ -205,14 +205,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GoalComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Category, otherT._Category)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Description, otherT._Description)) return false; if(!comparer.Equals(_Priority, otherT._Priority)) return false; if(!comparer.Equals(_Start, otherT._Start)) return false; if(!comparer.ListEquals(_Addresses, otherT._Addresses)) return false; if(!comparer.ListEquals(_Documentation, otherT._Documentation)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -374,10 +375,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Measure, otherT._Measure)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Measure, otherT._Measure)) return false; if(!comparer.Equals(_Detail, otherT._Detail)) return false; if(!comparer.Equals(_Due, otherT._Due)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -998,7 +1000,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; @@ -1023,7 +1026,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Transform, otherT._Transform)) return false; if(!comparer.ListEquals(_DynamicValue, otherT._DynamicValue)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1385,11 +1388,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1564,10 +1568,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1703,9 +1708,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_Role, otherT._Role)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1903,11 +1909,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DynamicValueComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2581,7 +2588,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PlanDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2607,7 +2615,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Library, otherT._Library)) return false; if(!comparer.ListEquals(_Goal, otherT._Goal)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs b/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs index 03e962de3..1f497b4d5 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Practitioner.cs @@ -157,11 +157,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualificationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Issuer, otherT._Issuer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -438,7 +439,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Practitioner otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.ListEquals(_Name, otherT._Name)) return false; if(!comparer.ListEquals(_Telecom, otherT._Telecom)) return false; @@ -448,7 +450,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.ListEquals(_Qualification, otherT._Qualification)) return false; if(!comparer.ListEquals(_Communication, otherT._Communication)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs index 0e7000b62..c32ecf88a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/PractitionerRole.cs @@ -221,11 +221,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AvailableTimeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_DaysOfWeekElement, otherT._DaysOfWeekElement)) return false; if(!comparer.Equals(_AllDayElement, otherT._AllDayElement)) return false; if(!comparer.Equals(_AvailableStartTimeElement, otherT._AvailableStartTimeElement)) return false; if(!comparer.Equals(_AvailableEndTimeElement, otherT._AvailableEndTimeElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -365,9 +366,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not NotAvailableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_During, otherT._During)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -682,7 +684,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PractitionerRole otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Practitioner, otherT._Practitioner)) return false; @@ -696,7 +699,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_NotAvailable, otherT._NotAvailable)) return false; if(!comparer.Equals(_AvailabilityExceptionsElement, otherT._AvailabilityExceptionsElement)) return false; if(!comparer.ListEquals(_Endpoint, otherT._Endpoint)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs b/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs index 62713f272..06d3a2e58 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Procedure.cs @@ -146,10 +146,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PerformerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -270,9 +271,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FocalDeviceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Action, otherT._Action)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Action, otherT._Action)) return false; if(!comparer.Equals(_Manipulated, otherT._Manipulated)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -785,7 +787,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Procedure otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; @@ -811,7 +814,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_FocalDevice, otherT._FocalDevice)) return false; if(!comparer.ListEquals(_UsedReference, otherT._UsedReference)) return false; if(!comparer.ListEquals(_UsedCode, otherT._UsedCode)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs index b90e21299..abe7c797d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcedureRequest.cs @@ -132,9 +132,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -693,7 +694,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcedureRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; @@ -719,7 +721,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_BodySite, otherT._BodySite)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs index 37372519f..4f0a3ddb1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcessRequest.cs @@ -162,8 +162,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SequenceLinkIdElement, otherT._SequenceLinkIdElement)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -563,7 +564,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_ActionElement, otherT._ActionElement)) return false; if(!comparer.Equals(_Target, otherT._Target)) return false; @@ -578,7 +580,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_IncludeElement, otherT._IncludeElement)) return false; if(!comparer.ListEquals(_ExcludeElement, otherT._ExcludeElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs index 142ff7d28..6596dee63 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ProcessResponse.cs @@ -142,9 +142,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessNoteComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -458,7 +459,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_CreatedElement, otherT._CreatedElement)) return false; if(!comparer.Equals(_Organization, otherT._Organization)) return false; @@ -471,7 +473,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ProcessNote, otherT._ProcessNote)) return false; if(!comparer.ListEquals(_Error, otherT._Error)) return false; if(!comparer.ListEquals(_CommunicationRequest, otherT._CommunicationRequest)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs index 7e1971af5..2068b2b31 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Provenance.cs @@ -206,11 +206,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AgentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Role, otherT._Role)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Role, otherT._Role)) return false; if(!comparer.Equals(_Who, otherT._Who)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; if(!comparer.Equals(_RelatedAgentType, otherT._RelatedAgentType)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -371,10 +372,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EntityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RoleElement, otherT._RoleElement)) return false; if(!comparer.Equals(_What, otherT._What)) return false; if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -633,7 +635,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Provenance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Target, otherT._Target)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_RecordedElement, otherT._RecordedElement)) return false; if(!comparer.ListEquals(_PolicyElement, otherT._PolicyElement)) return false; @@ -643,7 +646,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Agent, otherT._Agent)) return false; if(!comparer.ListEquals(_Entity, otherT._Entity)) return false; if(!comparer.ListEquals(_Signature, otherT._Signature)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs index eb4949e57..143dc7793 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Questionnaire.cs @@ -565,7 +565,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.Equals(_PrefixElement, otherT._PrefixElement)) return false; @@ -580,7 +581,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Option, otherT._Option)) return false; if(!comparer.Equals(_Initial, otherT._Initial)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -832,10 +833,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not EnableWhenComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_QuestionElement, otherT._QuestionElement)) return false; if(!comparer.Equals(_HasAnswerElement, otherT._HasAnswerElement)) return false; if(!comparer.Equals(_Answer, otherT._Answer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -943,8 +945,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OptionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1526,7 +1529,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Questionnaire otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1547,7 +1551,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Code, otherT._Code)) return false; if(!comparer.ListEquals(_SubjectTypeElement, otherT._SubjectTypeElement)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs index 7a686fab4..28da92647 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/QuestionnaireResponse.cs @@ -274,13 +274,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LinkIdElement, otherT._LinkIdElement)) return false; if(!comparer.Equals(_DefinitionElement, otherT._DefinitionElement)) return false; if(!comparer.Equals(_TextElement, otherT._TextElement)) return false; if(!comparer.Equals(_Subject, otherT._Subject)) return false; if(!comparer.ListEquals(_Answer, otherT._Answer)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -424,9 +425,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AnswerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -698,7 +700,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QuestionnaireResponse otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Parent, otherT._Parent)) return false; if(!comparer.Equals(_Questionnaire, otherT._Questionnaire)) return false; @@ -709,7 +712,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Author, otherT._Author)) return false; if(!comparer.Equals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs b/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs index f9d57db29..8de36ba9f 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Ratio.cs @@ -110,9 +110,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Ratio otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Numerator, otherT._Numerator)) return false; if(!comparer.Equals(_Denominator, otherT._Denominator)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs index 5f3253a7b..931c21848 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ReferralRequest.cs @@ -131,9 +131,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -642,7 +643,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferralRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; @@ -665,7 +667,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_SupportingInfo, otherT._SupportingInfo)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_RelevantHistory, otherT._RelevantHistory)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs b/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs index 8b77377b7..aaf4c1e1b 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RelatedArtifact.cs @@ -294,13 +294,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedArtifact otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.Equals(_CitationElement, otherT._CitationElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Document, otherT._Document)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs b/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs index ea4ccec83..a7afd63b3 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RelatedPerson.cs @@ -294,7 +294,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedPerson otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_Relationship, otherT._Relationship)) return false; @@ -305,7 +306,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Address, otherT._Address)) return false; if(!comparer.ListEquals(_Photo, otherT._Photo)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs b/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs index 88d34ffa6..b2e0052e9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RequestGroup.cs @@ -508,7 +508,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_TextEquivalentElement, otherT._TextEquivalentElement)) return false; @@ -526,7 +527,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_CardinalityBehaviorElement, otherT._CardinalityBehaviorElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -839,11 +840,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConditionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_KindElement, otherT._KindElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1017,10 +1019,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RelatedActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ActionIdElement, otherT._ActionIdElement)) return false; if(!comparer.Equals(_RelationshipElement, otherT._RelationshipElement)) return false; if(!comparer.Equals(_Offset, otherT._Offset)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1394,7 +1397,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestGroup otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_Replaces, otherT._Replaces)) return false; @@ -1409,7 +1413,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs b/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs index 7280bd1db..dc15cd6ee 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ResearchStudy.cs @@ -218,10 +218,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ArmComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -653,7 +654,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchStudy otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TitleElement, otherT._TitleElement)) return false; if(!comparer.ListEquals(_Protocol, otherT._Protocol)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; @@ -673,7 +675,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReasonStopped, otherT._ReasonStopped)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; if(!comparer.ListEquals(_Arm, otherT._Arm)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs b/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs index 82f5e6d68..16a99f10c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ResearchSubject.cs @@ -299,7 +299,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ResearchSubject otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.Equals(_Study, otherT._Study)) return false; @@ -307,7 +308,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_AssignedArmElement, otherT._AssignedArmElement)) return false; if(!comparer.Equals(_ActualArmElement, otherT._ActualArmElement)) return false; if(!comparer.Equals(_Consent, otherT._Consent)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs index 06dfddd8e..b1e7d1950 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/RiskAssessment.cs @@ -220,13 +220,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not PredictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Outcome, otherT._Outcome)) return false; if(!comparer.Equals(_Probability, otherT._Probability)) return false; if(!comparer.Equals(_QualitativeRisk, otherT._QualitativeRisk)) return false; if(!comparer.Equals(_RelativeRiskElement, otherT._RelativeRiskElement)) return false; if(!comparer.Equals(_When, otherT._When)) return false; if(!comparer.Equals(_RationaleElement, otherT._RationaleElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -616,7 +617,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RiskAssessment otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_Parent, otherT._Parent)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -632,7 +634,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Prediction, otherT._Prediction)) return false; if(!comparer.Equals(_MitigationElement, otherT._MitigationElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs b/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs index 7864914a1..f8aa714cb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SampledData.cs @@ -275,14 +275,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SampledData otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Origin, otherT._Origin)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Origin, otherT._Origin)) return false; if(!comparer.Equals(_PeriodElement, otherT._PeriodElement)) return false; if(!comparer.Equals(_FactorElement, otherT._FactorElement)) return false; if(!comparer.Equals(_LowerLimitElement, otherT._LowerLimitElement)) return false; if(!comparer.Equals(_UpperLimitElement, otherT._UpperLimitElement)) return false; if(!comparer.Equals(_DimensionsElement, otherT._DimensionsElement)) return false; if(!comparer.Equals(_DataElement, otherT._DataElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs b/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs index 48d3e1d76..a88e79721 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Schedule.cs @@ -232,7 +232,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Schedule otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ActiveElement, otherT._ActiveElement)) return false; if(!comparer.Equals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; @@ -240,7 +241,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Actor, otherT._Actor)) return false; if(!comparer.Equals(_PlanningHorizon, otherT._PlanningHorizon)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs index 714aaea5c..3aa4de90c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SearchParameter.cs @@ -320,9 +320,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComponentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Definition, otherT._Definition)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1069,7 +1070,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SearchParameter otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -1093,7 +1095,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_ModifierElement, otherT._ModifierElement)) return false; if(!comparer.ListEquals(_ChainElement, otherT._ChainElement)) return false; if(!comparer.ListEquals(_Component, otherT._Component)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs b/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs index 87338f61a..dc1f7d366 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Sequence.cs @@ -359,7 +359,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ReferenceSeqComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Chromosome, otherT._Chromosome)) return false; if(!comparer.Equals(_GenomeBuildElement, otherT._GenomeBuildElement)) return false; if(!comparer.Equals(_ReferenceSeqId, otherT._ReferenceSeqId)) return false; if(!comparer.Equals(_ReferenceSeqPointer, otherT._ReferenceSeqPointer)) return false; @@ -367,7 +368,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_StrandElement, otherT._StrandElement)) return false; if(!comparer.Equals(_WindowStartElement, otherT._WindowStartElement)) return false; if(!comparer.Equals(_WindowEndElement, otherT._WindowEndElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -652,13 +653,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_ObservedAlleleElement, otherT._ObservedAlleleElement)) return false; if(!comparer.Equals(_ReferenceAlleleElement, otherT._ReferenceAlleleElement)) return false; if(!comparer.Equals(_CigarElement, otherT._CigarElement)) return false; if(!comparer.Equals(_VariantPointer, otherT._VariantPointer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1134,7 +1136,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not QualityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_StandardSequence, otherT._StandardSequence)) return false; if(!comparer.Equals(_StartElement, otherT._StartElement)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; @@ -1148,7 +1151,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_PrecisionElement, otherT._PrecisionElement)) return false; if(!comparer.Equals(_RecallElement, otherT._RecallElement)) return false; if(!comparer.Equals(_FScoreElement, otherT._FScoreElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1491,13 +1494,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepositoryComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DatasetIdElement, otherT._DatasetIdElement)) return false; if(!comparer.Equals(_VariantsetIdElement, otherT._VariantsetIdElement)) return false; if(!comparer.Equals(_ReadsetIdElement, otherT._ReadsetIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1880,7 +1884,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Sequence otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_CoordinateSystemElement, otherT._CoordinateSystemElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; @@ -1895,7 +1900,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ReadCoverageElement, otherT._ReadCoverageElement)) return false; if(!comparer.ListEquals(_Repository, otherT._Repository)) return false; if(!comparer.ListEquals(_Pointer, otherT._Pointer)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs index 0bfaa0b11..335ff8cfe 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ServiceDefinition.cs @@ -660,7 +660,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ServiceDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -685,7 +686,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Trigger, otherT._Trigger)) return false; if(!comparer.ListEquals(_DataRequirement, otherT._DataRequirement)) return false; if(!comparer.Equals(_OperationDefinition, otherT._OperationDefinition)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs b/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs index 6213173fb..c82bdc130 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Slot.cs @@ -365,7 +365,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Slot otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ServiceCategory, otherT._ServiceCategory)) return false; if(!comparer.ListEquals(_ServiceType, otherT._ServiceType)) return false; if(!comparer.ListEquals(_Specialty, otherT._Specialty)) return false; @@ -376,7 +377,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_OverbookedElement, otherT._OverbookedElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs b/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs index 57c0bc22c..3804352d9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Specimen.cs @@ -208,12 +208,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CollectionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Collector, otherT._Collector)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Collector, otherT._Collector)) return false; if(!comparer.Equals(_Collected, otherT._Collected)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Method, otherT._Method)) return false; if(!comparer.Equals(_BodySite, otherT._BodySite)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -393,11 +394,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ProcessingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Procedure, otherT._Procedure)) return false; if(!comparer.ListEquals(_Additive, otherT._Additive)) return false; if(!comparer.Equals(_Time, otherT._Time)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -598,13 +600,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainerComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Capacity, otherT._Capacity)) return false; if(!comparer.Equals(_SpecimenQuantity, otherT._SpecimenQuantity)) return false; if(!comparer.Equals(_Additive, otherT._Additive)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -914,7 +917,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Specimen otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_AccessionIdentifier, otherT._AccessionIdentifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Type, otherT._Type)) return false; @@ -926,7 +930,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Processing, otherT._Processing)) return false; if(!comparer.ListEquals(_Container, otherT._Container)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs index 98390e056..2d8ef85c1 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureDefinition.cs @@ -299,11 +299,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MappingComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentityElement, otherT._IdentityElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_CommentElement, otherT._CommentElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -414,8 +415,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SnapshotComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -505,8 +507,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DifferentialComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Element, otherT._Element)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Element, otherT._Element)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1290,7 +1293,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -1318,7 +1322,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DerivationElement, otherT._DerivationElement)) return false; if(!comparer.Equals(_Snapshot, otherT._Snapshot)) return false; if(!comparer.Equals(_Differential, otherT._Differential)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs index 2a379077e..c86cc747c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/StructureMap.cs @@ -508,11 +508,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_AliasElement, otherT._AliasElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -758,13 +759,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not GroupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ExtendsElement, otherT._ExtendsElement)) return false; if(!comparer.Equals(_TypeModeElement, otherT._TypeModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -995,11 +997,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_ModeElement, otherT._ModeElement)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1211,13 +1214,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_Source, otherT._Source)) return false; if(!comparer.ListEquals(_Target, otherT._Target)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; if(!comparer.ListEquals(_Dependent, otherT._Dependent)) return false; if(!comparer.Equals(_DocumentationElement, otherT._DocumentationElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1604,7 +1608,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SourceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_MinElement, otherT._MinElement)) return false; if(!comparer.Equals(_MaxElement, otherT._MaxElement)) return false; if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; @@ -1614,7 +1619,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; if(!comparer.Equals(_ConditionElement, otherT._ConditionElement)) return false; if(!comparer.Equals(_CheckElement, otherT._CheckElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1977,7 +1982,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TargetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ContextElement, otherT._ContextElement)) return false; if(!comparer.Equals(_ContextTypeElement, otherT._ContextTypeElement)) return false; if(!comparer.Equals(_ElementElement, otherT._ElementElement)) return false; if(!comparer.Equals(_VariableElement, otherT._VariableElement)) return false; @@ -1985,7 +1991,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ListRuleIdElement, otherT._ListRuleIdElement)) return false; if(!comparer.Equals(_TransformElement, otherT._TransformElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2123,8 +2129,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Value, otherT._Value)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2259,9 +2266,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DependentComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.ListEquals(_VariableElement, otherT._VariableElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2777,7 +2785,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not StructureMap otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2795,7 +2804,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_Structure, otherT._Structure)) return false; if(!comparer.ListEquals(_ImportElement, otherT._ImportElement)) return false; if(!comparer.ListEquals(_Group, otherT._Group)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs index e6b68d651..1ec4db8d0 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Subscription.cs @@ -295,11 +295,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ChannelComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_EndpointElement, otherT._EndpointElement)) return false; if(!comparer.Equals(_PayloadElement, otherT._PayloadElement)) return false; if(!comparer.ListEquals(_HeaderElement, otherT._HeaderElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -575,7 +576,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Subscription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Contact, otherT._Contact)) return false; if(!comparer.Equals(_EndElement, otherT._EndElement)) return false; if(!comparer.Equals(_ReasonElement, otherT._ReasonElement)) return false; @@ -583,7 +585,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ErrorElement, otherT._ErrorElement)) return false; if(!comparer.Equals(_Channel, otherT._Channel)) return false; if(!comparer.ListEquals(_Tag, otherT._Tag)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs b/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs index 05043a938..c96929f3d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Substance.cs @@ -180,10 +180,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not InstanceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_ExpiryElement, otherT._ExpiryElement)) return false; if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -305,9 +306,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not IngredientComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Substance, otherT._Substance)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -512,14 +514,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Substance otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.ListEquals(_Category, otherT._Category)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Instance, otherT._Instance)) return false; if(!comparer.ListEquals(_Ingredient, otherT._Ingredient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs index 290066ca7..04c1c017c 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyDelivery.cs @@ -186,9 +186,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SuppliedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -445,7 +446,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyDelivery otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.ListEquals(_PartOf, otherT._PartOf)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; @@ -456,7 +458,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Supplier, otherT._Supplier)) return false; if(!comparer.Equals(_Destination, otherT._Destination)) return false; if(!comparer.ListEquals(_Receiver, otherT._Receiver)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs index 935979951..b0eda86eb 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/SupplyRequest.cs @@ -180,9 +180,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OrderedItemComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Quantity, otherT._Quantity)) return false; if(!comparer.Equals(_Item, otherT._Item)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -297,9 +298,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -598,7 +600,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SupplyRequest otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Category, otherT._Category)) return false; if(!comparer.Equals(_PriorityElement, otherT._PriorityElement)) return false; @@ -610,7 +613,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.Equals(_DeliverFrom, otherT._DeliverFrom)) return false; if(!comparer.Equals(_DeliverTo, otherT._DeliverTo)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Task.cs b/src/Hl7.Fhir.STU3/Model/Generated/Task.cs index fbe204ab5..b6d0bcb66 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Task.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Task.cs @@ -210,9 +210,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequesterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Agent, otherT._Agent)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Agent, otherT._Agent)) return false; if(!comparer.Equals(_OnBehalfOf, otherT._OnBehalfOf)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -354,10 +355,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RestrictionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RepetitionsElement, otherT._RepetitionsElement)) return false; if(!comparer.Equals(_Period, otherT._Period)) return false; if(!comparer.ListEquals(_Recipient, otherT._Recipient)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -479,9 +481,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -596,9 +599,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OutputComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1172,7 +1176,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Task otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_Definition, otherT._Definition)) return false; if(!comparer.ListEquals(_BasedOn, otherT._BasedOn)) return false; if(!comparer.Equals(_GroupIdentifier, otherT._GroupIdentifier)) return false; @@ -1199,7 +1204,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Restriction, otherT._Restriction)) return false; if(!comparer.ListEquals(_Input, otherT._Input)) return false; if(!comparer.ListEquals(_Output, otherT._Output)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs index c3308601e..c2f7c5c53 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestReport.cs @@ -322,10 +322,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParticipantComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_UriElement, otherT._UriElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -426,8 +427,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -531,9 +533,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -705,10 +708,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -887,10 +891,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_ResultElement, otherT._ResultElement)) return false; if(!comparer.Equals(_MessageElement, otherT._MessageElement)) return false; if(!comparer.Equals(_DetailElement, otherT._DetailElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1049,10 +1054,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1170,9 +1176,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1269,8 +1276,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1361,8 +1369,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1692,7 +1701,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestReport otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_TestScript, otherT._TestScript)) return false; @@ -1704,7 +1714,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs index 8fbd44c7d..c2102dbfe 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TestScript.cs @@ -405,9 +405,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OriginComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -536,9 +537,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DestinationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IndexElement, otherT._IndexElement)) return false; if(!comparer.Equals(_Profile, otherT._Profile)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -650,9 +652,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not MetadataComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Link, otherT._Link)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Link, otherT._Link)) return false; if(!comparer.ListEquals(_Capability, otherT._Capability)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -793,9 +796,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not LinkComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1077,14 +1081,15 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not CapabilityComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RequiredElement, otherT._RequiredElement)) return false; if(!comparer.Equals(_ValidatedElement, otherT._ValidatedElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_OriginElement, otherT._OriginElement)) return false; if(!comparer.Equals(_DestinationElement, otherT._DestinationElement)) return false; if(!comparer.ListEquals(_LinkElement, otherT._LinkElement)) return false; if(!comparer.Equals(_Capabilities, otherT._Capabilities)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1275,10 +1280,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FixtureComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_AutocreateElement, otherT._AutocreateElement)) return false; if(!comparer.Equals(_AutodeleteElement, otherT._AutodeleteElement)) return false; if(!comparer.Equals(_Resource, otherT._Resource)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1601,7 +1607,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VariableComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DefaultValueElement, otherT._DefaultValueElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_ExpressionElement, otherT._ExpressionElement)) return false; @@ -1609,7 +1616,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_HintElement, otherT._HintElement)) return false; if(!comparer.Equals(_PathElement, otherT._PathElement)) return false; if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1766,9 +1773,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Resource, otherT._Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Param, otherT._Param)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1910,9 +1918,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RuleParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2027,9 +2036,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RulesetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Resource, otherT._Resource)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Resource, otherT._Resource)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2157,9 +2167,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RulesetRuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; if(!comparer.ListEquals(_Param, otherT._Param)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2301,9 +2312,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RulesetRuleParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2397,8 +2409,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2502,9 +2515,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not SetupActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3028,7 +3042,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not OperationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Type, otherT._Type)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Type, otherT._Type)) return false; if(!comparer.Equals(_ResourceElement, otherT._ResourceElement)) return false; if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; @@ -3044,7 +3059,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_SourceIdElement, otherT._SourceIdElement)) return false; if(!comparer.Equals(_TargetIdElement, otherT._TargetIdElement)) return false; if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -3285,9 +3300,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RequestHeaderComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_FieldElement, otherT._FieldElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4048,7 +4064,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not AssertComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LabelElement, otherT._LabelElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.Equals(_DirectionElement, otherT._DirectionElement)) return false; if(!comparer.Equals(_CompareToSourceIdElement, otherT._CompareToSourceIdElement)) return false; @@ -4072,7 +4089,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ValidateProfileIdElement, otherT._ValidateProfileIdElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; if(!comparer.Equals(_WarningOnlyElement, otherT._WarningOnlyElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4354,9 +4371,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionAssertRuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; if(!comparer.ListEquals(_Param, otherT._Param)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4499,9 +4517,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionAssertRuleParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4629,9 +4648,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionAssertRulesetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RulesetIdElement, otherT._RulesetIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RulesetIdElement, otherT._RulesetIdElement)) return false; if(!comparer.ListEquals(_Rule, otherT._Rule)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4759,9 +4779,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ActionAssertRulesetRuleComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_RuleIdElement, otherT._RuleIdElement)) return false; if(!comparer.ListEquals(_Param, otherT._Param)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -4904,9 +4925,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParamComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5058,10 +5080,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_DescriptionElement, otherT._DescriptionElement)) return false; if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5179,9 +5202,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; if(!comparer.Equals(_Assert, otherT._Assert)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5278,8 +5302,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Action, otherT._Action)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Action, otherT._Action)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5370,8 +5395,9 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TeardownActionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Operation, otherT._Operation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Operation, otherT._Operation)) return false; + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -5980,7 +6006,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TestScript otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.Equals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -6006,7 +6033,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Setup, otherT._Setup)) return false; if(!comparer.ListEquals(_Test, otherT._Test)) return false; if(!comparer.Equals(_Teardown, otherT._Teardown)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs index cf99411e1..153dcae9d 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/Timing.cs @@ -721,7 +721,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not RepeatComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Bounds, otherT._Bounds)) return false; if(!comparer.Equals(_CountElement, otherT._CountElement)) return false; if(!comparer.Equals(_CountMaxElement, otherT._CountMaxElement)) return false; if(!comparer.Equals(_DurationElement, otherT._DurationElement)) return false; @@ -736,7 +737,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.ListEquals(_TimeOfDayElement, otherT._TimeOfDayElement)) return false; if(!comparer.ListEquals(_WhenElement, otherT._WhenElement)) return false; if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -955,10 +956,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not Timing otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_EventElement, otherT._EventElement)) return false; if(!comparer.Equals(_Repeat, otherT._Repeat)) return false; if(!comparer.Equals(_Code, otherT._Code)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs b/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs index 1bb8890d1..bfb0a84c9 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/TriggerDefinition.cs @@ -226,11 +226,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not TriggerDefinition otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_TypeElement, otherT._TypeElement)) return false; if(!comparer.Equals(_EventNameElement, otherT._EventNameElement)) return false; if(!comparer.Equals(_EventTiming, otherT._EventTiming)) return false; if(!comparer.Equals(_EventData, otherT._EventData)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs index 94be85997..e53fb4082 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/ValueSet.cs @@ -186,11 +186,12 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ComposeComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LockedDateElement, otherT._LockedDateElement)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; if(!comparer.ListEquals(_Include, otherT._Include)) return false; if(!comparer.ListEquals(_Exclude, otherT._Exclude)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -407,12 +408,13 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptSetComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.ListEquals(_Concept, otherT._Concept)) return false; if(!comparer.ListEquals(_Filter, otherT._Filter)) return false; if(!comparer.ListEquals(_ValueSetElement, otherT._ValueSetElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -590,10 +592,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ConceptReferenceComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_CodeElement, otherT._CodeElement)) return false; if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -757,10 +760,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DesignationComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_LanguageElement, otherT._LanguageElement)) return false; if(!comparer.Equals(_Use, otherT._Use)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -942,10 +946,11 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not FilterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_PropertyElement, otherT._PropertyElement)) return false; if(!comparer.Equals(_OpElement, otherT._OpElement)) return false; if(!comparer.Equals(_ValueElement, otherT._ValueElement)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1183,13 +1188,14 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ExpansionComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_IdentifierElement, otherT._IdentifierElement)) return false; if(!comparer.Equals(_TimestampElement, otherT._TimestampElement)) return false; if(!comparer.Equals(_TotalElement, otherT._TotalElement)) return false; if(!comparer.Equals(_OffsetElement, otherT._OffsetElement)) return false; if(!comparer.ListEquals(_Parameter, otherT._Parameter)) return false; if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1346,9 +1352,10 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ParameterComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; if(!comparer.Equals(_Value, otherT._Value)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -1634,7 +1641,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ContainsComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_SystemElement, otherT._SystemElement)) return false; if(!comparer.Equals(_AbstractElement, otherT._AbstractElement)) return false; if(!comparer.Equals(_InactiveElement, otherT._InactiveElement)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; @@ -1642,7 +1650,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_DisplayElement, otherT._DisplayElement)) return false; if(!comparer.ListEquals(_Designation, otherT._Designation)) return false; if(!comparer.ListEquals(_Contains, otherT._Contains)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -2221,7 +2229,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not ValueSet otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_UrlElement, otherT._UrlElement)) return false; if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_VersionElement, otherT._VersionElement)) return false; if(!comparer.Equals(_NameElement, otherT._NameElement)) return false; @@ -2240,7 +2249,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ExtensibleElement, otherT._ExtensibleElement)) return false; if(!comparer.Equals(_Compose, otherT._Compose)) return false; if(!comparer.Equals(_Expansion, otherT._Expansion)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } diff --git a/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs b/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs index 14e640d39..1a381e38a 100644 --- a/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs +++ b/src/Hl7.Fhir.STU3/Model/Generated/VisionPrescription.cs @@ -550,7 +550,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not DispenseComponent otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.Equals(_Product, otherT._Product)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.Equals(_Product, otherT._Product)) return false; if(!comparer.Equals(_EyeElement, otherT._EyeElement)) return false; if(!comparer.Equals(_SphereElement, otherT._SphereElement)) return false; if(!comparer.Equals(_CylinderElement, otherT._CylinderElement)) return false; @@ -565,7 +566,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_ColorElement, otherT._ColorElement)) return false; if(!comparer.Equals(_BrandElement, otherT._BrandElement)) return false; if(!comparer.ListEquals(_Note, otherT._Note)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; } @@ -879,7 +880,8 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(other is not VisionPrescription otherT) return false; if(!base.CompareChildren(otherT, comparer)) return false; - #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; + #pragma warning disable CS8604 // Possible null reference argument - netstd2.1 has a wrong nullable signature here + if(!comparer.ListEquals(_Identifier, otherT._Identifier)) return false; if(!comparer.Equals(_StatusElement, otherT._StatusElement)) return false; if(!comparer.Equals(_Patient, otherT._Patient)) return false; if(!comparer.Equals(_Encounter, otherT._Encounter)) return false; @@ -887,7 +889,7 @@ public override bool CompareChildren(Base other, IEqualityComparer compare if(!comparer.Equals(_Prescriber, otherT._Prescriber)) return false; if(!comparer.Equals(_Reason, otherT._Reason)) return false; if(!comparer.ListEquals(_Dispense, otherT._Dispense)) return false; -#pragma warning restore CS8604 // Possible null reference argument. + #pragma warning restore CS8604 // Possible null reference argument. return true; }